m-stack icon indicating copy to clipboard operation
m-stack copied to clipboard

hid_keyboard: Add HID keyboard example

Open WallaceIT opened this issue 8 years ago • 3 comments

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 [email protected]

WallaceIT avatar Jun 12 '16 18:06 WallaceIT

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

WallaceIT avatar Jan 07 '18 21:01 WallaceIT

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?

sergimn avatar Jan 07 '18 21:01 sergimn

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).

WallaceIT avatar Jan 07 '18 21:01 WallaceIT