標(biāo)題: STM32控制鍵盤程序 標(biāo)準(zhǔn)的USB HID設(shè)備驅(qū)動 [打印本頁]

作者: cusoft    時間: 2019-5-14 12:44
標(biāo)題: STM32控制鍵盤程序 標(biāo)準(zhǔn)的USB HID設(shè)備驅(qū)動
STM32控制鍵盤

單片機(jī)源程序如下:
  1. #include <stm32f10x_map.h>
  2. #include <stm32f10x_nvic.h>      

  3. #include "sys.h"
  4. #include "delay.h"           
  5. #include "usb_lib.h"
  6. #include "hw_config.h"
  7. #include "usb_pwr.h"  

  8. extern u8 EP1BUSY;                        //鍵盤數(shù)據(jù)發(fā)送忙標(biāo)志
  9. extern u8 EP2BUSY;                        //鼠標(biāo)數(shù)據(jù)發(fā)送忙標(biāo)志
  10. extern u8 INIT_OK;
  11.                   
  12. int main(void)
  13. {
  14.         Stm32_Clock_Init(9);//系統(tǒng)時鐘設(shè)置
  15.         delay_init(72);                //延時初始化
  16.         //USB配置
  17.         USB_Interrupts_Config();   
  18.         Set_USBClock();  
  19.         USB_Init();
  20.         delay_ms(1000);                        //等待初始化完成   
  21.         while(1)
  22.         {
  23.                 if(EP2BUSY==0)
  24.                 {
  25.                         EP2BUSY = 1;
  26. //                                
  27.                         Joystick_Send(1,1);
  28.                         
  29.                 }
  30.         }
  31. }
復(fù)制代碼

所有資料51hei提供下載:
STM32_USB_復(fù)合設(shè)備.7z (57.76 KB, 下載次數(shù): 106)







歡迎光臨 (http://www.torrancerestoration.com/bbs/) Powered by Discuz! X3.1