cy384 / ppk_usb

USB HID adapter for the Palm Portable Keyboard
http://www.cy384.com/projects/palm-keyboard.html
BSD 3-Clause "New" or "Revised" License
123 stars 18 forks source link

Improved debugging, added F1-F12 keys #3

Closed hryamzik closed 8 years ago

cy384 commented 8 years ago

I merged in the escape and F keys changes, and the undefined keypresses code, which inspired me to revise/develop/clean up the debug printing more comprehensively. The ~ thing seemed less critical to me, since there's a ~ key on the keyboard already.

Thanks!

hryamzik commented 8 years ago

Perfect, thanks!

Looks like it would be nice to put key mappings and version/pin setup outside the repository, I'll take a look if it's possible. I've also managed to add some hot keys like PTT for skype:

          else if ((key_byte & MAP_MASK) == 0b01001010)
          // special case the Memo key, skype PTT and skype mute with fn pressed
          {
            if (!fn_key_down)
            {
              if (PPK_DEBUG) Serial.print("Memo key down: ") && Serial.println(!key_up);
              if (key_up)
              {
                Keyboard.release(KEY_UP_ARROW);
                Keyboard.release(KEY_LEFT_CTRL);
                Keyboard.release(KEY_LEFT_ALT);
                Keyboard.release(KEY_LEFT_GUI);
              }
              else
              {
                Keyboard.press(KEY_LEFT_GUI);
                Keyboard.press(KEY_LEFT_ALT);
                Keyboard.press(KEY_LEFT_CTRL);
                Keyboard.press(KEY_UP_ARROW);
              }
            }

But hardcoding them is definitely a quick and dirty solution, some array-styled key-mapping should be used instead.

cy384 commented 8 years ago

For the sake of simplicity, I'm not particularly interested in adding a separate file for keycode assignments and configuration, or adding a more complicated data structure for allowing multiple keycodes/macro style definitions to single key presses. I'll see if I can find a nice solution.