文件名称:STM8S-USB-master
- 所属分类:
- 单片机(51,AVR,MSP430等)
- 资源属性:
- [C/C++] [源码]
- 上传时间:
- 2014-09-19
- 文件大小:
- 345kb
- 下载次数:
- 0次
- 提 供 者:
- 张**
- 相关连接:
- 无
- 下载说明:
- 别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容均来自于网络,请自行研究使用
这是一个stm8S003模拟USB键盘HID的程序,首先,通过中断来接收USB数据,接收完后,调用 void usb_rx_ok(void) 来应答或不应答,并识别数据包,把相应的状态写usb这个结构体里面。
然后,在主循环中不断的调用 void usb_process(void) 来根据 usb 里面的状态来做相应的动作。
设备描述符的发送是这样的:调用 void usb_send_data(uint8_t * buffer, uint8_t lenght), 将描述符打包,放到 usb.tx_buffer 里面,然后将状态改为已经准备好发送usb.event = USB_EVENT_READY_DATA_IN,等待主机发送 DATA IN 包。
usb_rx_ok 识别到 DATA IN 包并且 usb.event 为准备发送, 就会调用 void usb_send_answer(void) 来完成数据发送。-This is an analog stm8S003 HID USB keyboard procedures, first, the received USB data to the interrupt, after receiving call void usb_rx_ok (void) to answer or not to answer, and the identification data packet, to write the corresponding status of this structure usb inside.
Then, in the main loop continually calls void usb_process (void) to do the appropriate action according to usb inside the state.
Send device descr iptor is this: call void usb_send_data (uint8_t* buffer, uint8_t lenght), the descr iptor packaged into usb.tx_buffer inside, then the state is ready to send usb.event = USB_EVENT_READY_DATA_IN, waiting for the host send DATA IN packets.
usb_rx_ok recognized DATA IN packets and usb.event is ready to send, it will call the void usb_send_answer (void) to complete the data transmission.
然后,在主循环中不断的调用 void usb_process(void) 来根据 usb 里面的状态来做相应的动作。
设备描述符的发送是这样的:调用 void usb_send_data(uint8_t * buffer, uint8_t lenght), 将描述符打包,放到 usb.tx_buffer 里面,然后将状态改为已经准备好发送usb.event = USB_EVENT_READY_DATA_IN,等待主机发送 DATA IN 包。
usb_rx_ok 识别到 DATA IN 包并且 usb.event 为准备发送, 就会调用 void usb_send_answer(void) 来完成数据发送。-This is an analog stm8S003 HID USB keyboard procedures, first, the received USB data to the interrupt, after receiving call void usb_rx_ok (void) to answer or not to answer, and the identification data packet, to write the corresponding status of this structure usb inside.
Then, in the main loop continually calls void usb_process (void) to do the appropriate action according to usb inside the state.
Send device descr iptor is this: call void usb_send_data (uint8_t* buffer, uint8_t lenght), the descr iptor packaged into usb.tx_buffer inside, then the state is ready to send usb.event = USB_EVENT_READY_DATA_IN, waiting for the host send DATA IN packets.
usb_rx_ok recognized DATA IN packets and usb.event is ready to send, it will call the void usb_send_answer (void) to complete the data transmission.
(系统自动生成,下载前可以参看下载内容)
下载文件列表
STM8S-USB-master\device\usb\usb.c
................\......\...\usb.h
................\......\...\usb_rx.S
................\......\...\usb_tx.S
................\LICENSE
................\main.c
................\main.h
................\Makefile
................\mcu\peripherals\mcu_gpio.h
................\...\std_lib\inc\stm8s.h
................\...\.......\...\stm8s_adc1.h
................\...\.......\...\stm8s_adc2.h
................\...\.......\...\stm8s_awu.h
................\...\.......\...\stm8s_beep.h
................\...\.......\...\stm8s_can.h
................\...\.......\...\stm8s_clk.h
................\...\.......\...\stm8s_exti.h
................\...\.......\...\stm8s_flash.h
................\...\.......\...\stm8s_gpio.h
................\...\.......\...\stm8s_i2c.h
................\...\.......\...\stm8s_itc.h
................\...\.......\...\stm8s_iwdg.h
................\...\.......\...\stm8s_rst.h
................\...\.......\...\stm8s_spi.h
................\...\.......\...\stm8s_tim1.h
................\...\.......\...\stm8s_tim2.h
................\...\.......\...\stm8s_tim3.h
................\...\.......\...\stm8s_tim4.h
................\...\.......\...\stm8s_tim5.h
................\...\.......\...\stm8s_tim6.h
................\...\.......\...\stm8s_uart1.h
................\...\.......\...\stm8s_uart2.h
................\...\.......\...\stm8s_uart3.h
................\...\.......\...\stm8s_wwdg.h
................\...\.......\Release_Notes.html
................\...\.......\src\stm8s_adc1.c
................\...\.......\...\stm8s_adc2.c
................\...\.......\...\stm8s_awu.c
................\...\.......\...\stm8s_beep.c
................\...\.......\...\stm8s_can.c
................\...\.......\...\stm8s_clk.c
................\...\.......\...\stm8s_exti.c
................\...\.......\...\stm8s_flash.c
................\...\.......\...\stm8s_gpio.c
................\...\.......\...\stm8s_i2c.c
................\...\.......\...\stm8s_itc.c
................\...\.......\...\stm8s_iwdg.c
................\...\.......\...\stm8s_rst.c
................\...\.......\...\stm8s_spi.c
................\...\.......\...\stm8s_tim1.c
................\...\.......\...\stm8s_tim2.c
................\...\.......\...\stm8s_tim3.c
................\...\.......\...\stm8s_tim4.c
................\...\.......\...\stm8s_tim5.c
................\...\.......\...\stm8s_tim6.c
................\...\.......\...\stm8s_uart1.c
................\...\.......\...\stm8s_uart2.c
................\...\.......\...\stm8s_uart3.c
................\...\.......\...\stm8s_wwdg.c
................\...\stm8s003f3.ini
................\...\stm8s003f3.lsf
................\...\stm8s_conf.h
................\...\stm8s_it.c
................\...\stm8s_it.h
................\...\stm8_interrupt_vector.c
................\README.md
................\source insight\Untitled Project.IAB
................\..............\Untitled Project.IAD
................\..............\Untitled Project.IMB
................\..............\Untitled Project.IMD
................\..............\Untitled Project.PFI
................\..............\Untitled Project.PO
................\..............\Untitled Project.PR
................\..............\Untitled Project.PRI
................\..............\Untitled Project.PS
................\..............\Untitled Project.WK3
................\target\target.s19
................\utility\macros.c
................\.......\macros.h
................\mcu\std_lib\inc
................\...\.......\src
................\device\usb
................\mcu\peripherals
................\...\std_lib
................\device
................\mcu
................\source insight
................\target
................\utility
STM8S-USB-master