Added modifiers

This commit is contained in:
Dejvino 2021-02-25 20:51:04 +01:00
parent 762eaecefd
commit 2a95fc2492

View File

@ -14,6 +14,12 @@ int keyReleaseBit = 0x80;
char m[255]; char m[255];
// MODS
// play speaker sounds of keys
const bool modKeySounds = true;
// replace CapsLock with Super key (aka GUI or Windows key)
const bool modSuperCapslock = true;
void setupKeyMapping() { void setupKeyMapping() {
m[1]=KEY_ESC; m[1]=KEY_ESC;
m[2]='1'; m[2]='1';
@ -72,7 +78,7 @@ void setupKeyMapping() {
m[55]='\335'; // num-* m[55]='\335'; // num-*
m[56]=KEY_LEFT_ALT; m[56]=KEY_LEFT_ALT;
m[57]=' '; m[57]=' ';
m[58]=KEY_CAPS_LOCK; // EVIL m[58]=(modSuperCapslock ? KEY_LEFT_GUI : KEY_CAPS_LOCK); // EVIL
m[59]=KEY_F1; m[59]=KEY_F1;
m[60]=KEY_F2; m[60]=KEY_F2;
m[61]=KEY_F3; m[61]=KEY_F3;
@ -84,6 +90,7 @@ void setupKeyMapping() {
m[67]=KEY_F9; m[67]=KEY_F9;
m[68]=KEY_F10; m[68]=KEY_F10;
// https://forum.arduino.cc/index.php?topic=266688.msg1880644#msg1880644 // https://forum.arduino.cc/index.php?topic=266688.msg1880644#msg1880644
// http://www.quadibloc.com/comp/scan.htm
const byte KEY_NUM_LOCK = 219; const byte KEY_NUM_LOCK = 219;
m[69]=KEY_NUM_LOCK; m[69]=KEY_NUM_LOCK;
const byte KEY_SCROLL_LOCK = 207; const byte KEY_SCROLL_LOCK = 207;
@ -166,7 +173,7 @@ void loop() {
if(counter >= numbits) { if(counter >= numbits) {
//Serial.println(int(data)); //Serial.println(int(data));
processKbdByte(data); processKbdByte(data);
tone(speakerPin, 60 + int(data), 25); if (modKeySounds) tone(speakerPin, 60 + int(data), 25);
data = B0; data = B0;
counter = 0; counter = 0;
} }