Author Topic: DigiKeyboard scancodes  (Read 11524 times)

vikiPlayground

  • Newbie
  • *
  • Posts: 1
DigiKeyboard scancodes
« on: May 31, 2016, 01:47:29 pm »
Hello Guys

I was playing around with the digispark and the keyboard lib and had some problems with adjusting scancodes. I edited scancode-acii-table.h to match my Belgian poin keyboard and almost found all the necessary keys & codes. Almost... what i can't find are the "<" ">" and everything that needs a combination with the "Alt Gr" key. The combination with shift key was easy, I just had to add 128 to the code to have the right key stroke. Is there also a way to get it working with "Alt Gr"? And how can i find the correct key code for "<" and ">"?

I used these imgages for the rest of Belgian azerty keyboard key's



But as you can see ... the <> key doesn't have any key code on it ...

thx in advance

« Last Edit: May 31, 2016, 01:49:46 pm by vikiPlayground »

Fardenco

  • Newbie
  • *
  • Posts: 8
Re: DigiKeyboard scancodes
« Reply #1 on: February 17, 2017, 05:28:13 pm »
I had the same issue, I modified a few files to comply with azerty layout.

My solution for finding "<>" was simply to write a for loop sending keystrokes for all scancodes from 1 to 255, and looking what each of these were doing until I see "<" on the screen. ">" is simply the same key with shift modifier.

For altgr key combination, I found out that keycodes for keyboard characters fit on the 6 less significant bits of a char. The 1st msb is already used to apply or not shift modifier, I simply used the 2nd msb to apply or not altgr modifier.

But there was a problem, "<" keycode is 100, and this is the only one that does not fit in 6 bits and so it use the bit I just used for altgr modifier. My solution for this is quite dirty but it works : I simply put a condition precisely for "<" and ">" characters case.

Finaly this works, for testing I used the following line :

DigiKeyboard.println("abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ 1234567890 !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~");

and all characters works fine.

I don't know how to upload files on this forum, but I uploaded them on this Github thread :

https://github.com/digistump/DigistumpArduino/issues/46

I suppose you could use the same process for any keyboard layout.