Does the PS/2 keyboard lib returns key release events?

I've been playing around with the PS/2 library on the Arduino playground,

Reading keypresses works like a charm using the provided examples, but I can't seem to find how to read key up messages (break key events, those that start with F0), I'm not even sure break events are propagated by the library. Peeking at the code it seems they are properly detected but masked out? I'm useless at bit masking arithmetic apparently :p

Several internet searches haven't returned much, if you have a workaround or an explanation I'd love to hear from you. Thanks in advance!

The library you are using does not give you key presses, it returns the ASCII code (characters). It does the interpretation from scan codes to characters for you. So you will not see the key down/ key up events.

You are correct in that the library does not pass on the key up events. It only tracks key up events in order to properly handle the shift keys. It also masks out many of the "special" keys that have an E0 prefix.

Either use a different keyboard library, or modify this one. You could tap into the get_scan_code() function to get the raw scan code and do your own handling of the F0 events. Or extend the read function to include a flag for make/break.


Thanks a lot for confirming I'm not crazy :)

I'll look into writing my own, but if someone knows of the existence of such a library, I'm all ears.