signal11 / m-stack

Free USB Stack for PIC 16F, 18F, 24F, and 32MX Microcontrollers
http://www.signal11.us/oss/m-stack/
Other
183 stars 94 forks source link

hid_keyboard: Add HID keyboard example #17

Open WallaceIT opened 8 years ago

WallaceIT commented 8 years ago

In this example, the device is seen as an HID keyboard. When a pin (in this case RA3) is sensed low, a CTRL+SHIFT+1 keypress is sent to the OS.

Code comes from the hid_mouse example.

Signed-off-by: Francesco Valla valla.francesco@gmail.com

WallaceIT commented 6 years ago

Hi, It's ctrl+shift modifier, see https://gist.github.com/MightyPork/6da26e382a7ad91b5496ee55fdc73db2

sergimn commented 6 years ago

Hi! I don't know if I'm blind or I don't have the sufficient coding skills but I'm still unable to see anything that confirms your statement. In the line 39 of the code you provided there is a commented line which says:

0x03 // Keyboard Error Undefined

And no other 0x03 is found in the whole file. Am I missing something?

WallaceIT commented 6 years ago

Hi! Byte 0 is reserved for modifier mask. In my code, 0x01 (lctrl) is OR'ed with 0x02 (lshift) to provide ctrl+shift modifier (0x03). The 0x03 you are referring to is related to scan codes (bytes 2 to 7).