久久久久久久999_99精品久久精品一区二区爱城_成人欧美一区二区三区在线播放_国产精品日本一区二区不卡视频_国产午夜视频_欧美精品在线观看免费

 找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 4369|回復: 2
打印 上一主題 下一主題
收起左側

MM32F103 USB應用實例Custom_HID通訊例程

[復制鏈接]
跳轉到指定樓層
樓主
ID:714588 發表于 2020-7-30 16:39 | 只看該作者 回帖獎勵 |倒序瀏覽 |閱讀模式
基于MM32F103 USB Custom_HID 通訊例程,基于32位 ARM Cortex M3 的MM32F103xBx8的例程

單片機源程序如下:
  1. /* Includes ------------------------------------------------------------------*/
  2. #include "MM32F103.h"
  3. #include "usb_lib.h"
  4. #include "hw_config.h"
  5. #include "usbio.h"
  6. #include "usb_regs.h"


  7. #include "usb_pwr.h"
  8. #include "usb_desc.h"
  9. #include "sys.h"
  10. #include "uart.h"
  11. #include "delay.h"
  12. #include "led.h"


  13. /* Private typedef -----------------------------------------------------------*/
  14. /* Private define ------------------------------------------------------------*/
  15. /* Private macro -------------------------------------------------------------*/
  16. /* Private variables ---------------------------------------------------------*/
  17. /* Extern variables ----------------------------------------------------------*/
  18. /* Private function prototypes -----------------------------------------------*/
  19. void Delay(__IO uint32_t nCount);

  20. extern uint8_t Flag_Receive;


  21. /* Private functions ---------------------------------------------------------*/

  22. /*******************************************************************************
  23. * Function Name  : main.
  24. * Description    : main routine.
  25. * Input          : None.
  26. * Output         : None.
  27. * Return         : None.
  28. *******************************************************************************/

  29. uint8_t table_data[64]={
  30.         
  31.         0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,
  32.         0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,
  33.         0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,
  34.         0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,        
  35.         
  36. };


  37. int main(void)
  38. {
  39.         
  40.         delay_init();
  41.         
  42.         uart_initwBaudRate(115200);
  43.         
  44.         LED_Init();
  45.         
  46.   Set_System();

  47.   USB_Interrupts_Config();

  48.   Set_USBClock();

  49.   USB_Init();
  50.         
  51.         printf("System Initial Success\r\n");
  52.         
  53.   while (1)
  54.   {
  55.         if(bDeviceState == CONFIGURED)  //等待USB初始化完成
  56.                                 {
  57. //                                        if(Flag_Receive)
  58. //                                        {
  59. //                                                                                         
  60. //                                                        USB_Send_Buffer[0] = 0xaa;
  61. //                                                        USB_Send_Buffer[1] = 0x55;
  62. //                                                        USB_Send_Buffer[2] = 0xaa;
  63. //                                                        USB_Send_Buffer[3] = 0x55;
  64. //                                                        USB_Send_Buffer[4] = 0xaa;
  65. //                                                        USB_Send_Buffer[5] = 0x55;
  66. //                                                        USB_SendData(USB_Send_Buffer,64);         
  67. //                                                
  68. //                                                        Flag_Receive = 0;        
  69. //                                                
  70. //                                        }                                       
  71.                                         USB_SendData(table_data,5);
  72.                                         delay_ms(5000);
  73.                                 }
  74.         //USB_SendData(table_data,64);
  75.                
  76.   }
  77.         
  78. }

  79. /*******************************************************************************
  80. * Function Name  : Delay
  81. * Description    : Inserts a delay time.
  82. * Input          : nCount: specifies the delay time length.
  83. * Output         : None
  84. * Return         : None
  85. *******************************************************************************/
  86. void Delay(__IO uint32_t nCount)
  87. {
  88.   for(; nCount!= 0;nCount--);
  89. }

  90. #ifdef  USE_FULL_ASSERT
  91. /*******************************************************************************
  92. * Function Name  : assert_failed
  93. * Description    : Reports the name of the source file and the source line number
  94. *                  where the assert_param error has occurred.
  95. * Input          : - file: pointer to the source file name
  96. *                  - line: assert_param error line source number
  97. * Output         : None
  98. * Return         : None
  99. *******************************************************************************/
  100. void assert_failed(uint8_t* file, uint32_t line)
  101. {
  102.   /* User can add his own implementation to report the file name and line number,
  103.      ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */

  104.   /* Infinite loop */
  105.   while(1)
  106.   {
  107.   }
  108. }
  109. #endif

  110. /******************* (C) COPYRIGHT 2009 Mindmotion *****END OF FILE****/
復制代碼

所有資料51hei提供下載:
MM32F103_USB_Custom_HID.7z (161.23 KB, 下載次數: 43)
分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏2 分享淘帖 頂1 踩
回復

使用道具 舉報

沙發
ID:584195 發表于 2021-8-5 22:40 | 只看該作者
樓主,好像用這個的人很少呀?你是做宣傳的嗎?
回復

使用道具 舉報

板凳
ID:825413 發表于 2022-3-31 09:18 | 只看該作者
這個程序,我在WIN10上可用正常使用,在win7  和 XP上USB不能識別,是什么問題?
回復

使用道具 舉報

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規則

小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術交流QQ群281945664

Powered by 單片機教程網

快速回復 返回頂部 返回列表
主站蜘蛛池模板: 国产伦精品一区二区三区四区视频 | 午夜影院在线视频 | 亚洲欧美视频一区 | 理论片87福利理论电影 | 久久出精品| 一区二区国产精品 | 国产精品日韩欧美一区二区 | 欧美精品一区二区三区蜜桃视频 | 亚洲国产成人精品女人 | 成人av观看 | 日本亚洲精品成人欧美一区 | 中文字幕一区二区三区精彩视频 | 久草视频网站 | 精品国产乱码久久久久久丨区2区 | 亚洲一区在线日韩在线深爱 | 日韩欧美中文 | 亚洲欧洲日韩精品 中文字幕 | 日韩在线高清 | 亚洲一区播放 | 久久久高清 | 精品蜜桃一区二区三区 | 亚洲成人激情在线观看 | 亚洲综合无码一区二区 | 男女视频在线免费观看 | 亚洲一区二区精品视频 | 狠狠干天天干 | 麻豆精品久久 | 国产欧美日韩精品在线观看 | 国产精品久久久久久中文字 | 久久久久一区二区三区四区 | 亚洲色欧美另类 | 日韩精品一区二区三区四区 | 一区二区三区回区在观看免费视频 | 狠狠做六月爱婷婷综合aⅴ 国产精品视频网 | 亚洲日韩中文字幕 | 9久9久9久女女女九九九一九 | 亚洲在线一区二区 | 亚洲成人精品 | 亚洲欧美国产一区二区三区 | 亚洲少妇综合网 | av中文网 |