|
STM32控制鍵盤
單片機(jī)源程序如下:
- #include <stm32f10x_map.h>
- #include <stm32f10x_nvic.h>
- #include "sys.h"
- #include "delay.h"
- #include "usb_lib.h"
- #include "hw_config.h"
- #include "usb_pwr.h"
- extern u8 EP1BUSY; //鍵盤數(shù)據(jù)發(fā)送忙標(biāo)志
- extern u8 EP2BUSY; //鼠標(biāo)數(shù)據(jù)發(fā)送忙標(biāo)志
- extern u8 INIT_OK;
-
- int main(void)
- {
- Stm32_Clock_Init(9);//系統(tǒng)時(shí)鐘設(shè)置
- delay_init(72); //延時(shí)初始化
- //USB配置
- USB_Interrupts_Config();
- Set_USBClock();
- USB_Init();
- delay_ms(1000); //等待初始化完成
- while(1)
- {
- if(EP2BUSY==0)
- {
- EP2BUSY = 1;
- //
- Joystick_Send(1,1);
-
- }
- }
- }
復(fù)制代碼
所有資料51hei提供下載:
STM32_USB_復(fù)合設(shè)備.7z
(57.76 KB, 下載次數(shù): 106)
2019-5-14 18:23 上傳
點(diǎn)擊文件名下載附件
|
|