|
||||||||
|
MCU User Forum
![]() USB
![]() USB HID KEYBOARD (Search a Programmer)
|
| next newest topic | next oldest topic |
| Author | Topic: USB HID KEYBOARD (Search a Programmer) |
|
bliebb New Member |
Hi, At the moment I try to convert the USB_HID MouseExample from Silabs to a USB HID Keyboard Example Microcontroller: C8051F34x (development kit) I am not an expert at USB and at the moment and nothing works ! If someone can help me to convert rapidly this mouse example to a keyboard example ... I just need a source example ... that when I click to the button on the development board the example send the character "A" to the keyboard via HID. Tell me how much is it to do this kind of job and the delay ? Best Regards, Steve IP: Logged |
|
Tsuneo Member |
"I am not an expert at USB and at the moment and nothing works !" Everyone has his (her) starting point. So, don't get so desperate.
USB HID spec 1.11
b-1) Descriptors You'll find the example of keyboard descriptors in the HID spec (HID1_11.pdf p66) b-1-1) Device descriptor USB for Dummies (one dummy, anyway) b-1-2) Config descriptor b-1-3) Interface descriptor b-1-4) HID class descriptor b-1-5) Endpoint descriptor OUT endpoint is not used - delete it b-1-6) Report descriptor
Tsuneo IP: Logged |
|
Tsuneo Member |
Before continuing on the implementation of class specific requests and endpoint handling, it's better to explain about the report format. INPUT report byte The bitmap of modifier byte is defined in the HID spec. bit This assignment is done by this part of the report descriptor Usage Page (Key Codes); "HID Usage Tables" spec defines keycode 10 Keyboard/Keypad Page (0x07) (Hut1_12.pdf p54) Available range of keycode is also defined in the report descriptor Usage Page (Key Codes), While no key is pushed, all report bytes are '0'. Transition Modifier Byte keycode Array (0) Please note, the report shows a 'snapshot' of the state of pushed keys. Appendix C: Keyboard Implementation (HID1_11.pdf p62)
bit This assignment derives from the LED usage, defined in the "HID Usage Tables" spec 11 LED Page (0x08) (Hut1_12.pdf p62) And this definition in the report descriptor makes the assignment.
Tsuneo [This message has been edited by Tsuneo (edited August 29, 2007).] IP: Logged |
|
Tsuneo Member |
b-2) Class specific request The HID spec describes the implementation about class specific requests in this appendix. According to this description, these requests are required for keyboard implementation. - Get_Report( Input ) - send keycode array In the interface descriptor, bootable option is selected - Get_Protocol - return current protocol boot/report You'll see detailed description of these request in the HID spec. b-2-1) Get_Report( Input ) b-2-2) Set_Report( Output ) b-2-3) Set_Idle, Get_Idle The HID spec recommends 125 (500 ms) as the default duration for keyboard. Get_Idle returns current duration. b-2-4) Set_Protocol, Get_Protocol In this implementation, the report format is the same between 'Boot' and 'Report'. Then, Set_Protocol switches just the state variable. Get_Protocol returns current protocol state.
SOF interrupt (1ms interval) gives a good timer to count the duration. Tsuneo [This message has been edited by Tsuneo (edited September 01, 2007).] IP: Logged |
|
bliebb New Member |
Hi Tsuneo, Thank you verry much for your help ! Now I understand all and all work like a charm ! Steve Bilodeau IP: Logged |
All times are CT (US) | next newest topic | next oldest topic |
![]() |
|
Have you seen our MCU Knowledge Base?
|
| |||||
|
| |||||