Close

v4 sketch makes use of multimedia keys

A project log for Pro Trinket USB Keyboard

A USB keyboard for custom shortcuts based on the Pro Trinket and Pro Micro

stefan-lochbrunnerStefan Lochbrunner 09/26/2015 at 17:351 Comment

This has been long overdue... I finally updated the sketch to make use of the multimedia keys. Implementing this was a little annoying because the the multimedia keys (and mouse movement, which is not yet implemented) require a different function to be called than 'normal' keys and the keycodes that can be used for those functions overlap. For now the colliding 'normal' keycodes (ctrl, shift, alt & gui) are ignored in favor of the mmkeys. This goes only for the bare keys, they still work as modifiers. It's not ideal but at least volume control finally works. I thought about using another variable to distinguish between normal, mmkeys and mouse movement but that array is already way too confusing as it is.


edit 2015-09-27:

Initially I added some exceptions for ctrl, shift, alt & gui to be usable with the pressKey functions instead of invoking pressMultimediaKey. However, that didn't seem to work and while playing around with it I discovered (while writing the 1st version of this update ;) ) that you can also use the corresponding modifier without a keycode (well, more specifically kyecode 0). So it seems ignoring those codes will work without limiting functionality but now the problem is that my code doesn't allow for keys to be held down. One solution to this would be to make another exception for keycode 0 to toggle the modifier(s) on press and release. I'll look into this...

Discussions

Rich T wrote 01/26/2018 at 15:04 point

So colPins, rowPins and encPins refer to the physical pins on the Trinket? Or are these the physical pins on the ATMega328, since the Pro Micro doesn't have pins 12, 13 or 17?

  Are you sure? yes | no