pull/365/head
Jesse Vincent 7 years ago
parent a9068d16d4
commit 1206a3cafb
No known key found for this signature in database
GPG Key ID: 122F5DF7108E4046

@ -120,45 +120,45 @@ static const Key ascii_to_key_map[] PROGMEM = {
Key Macros_::lookupAsciiCode(uint8_t ascii_code) { Key Macros_::lookupAsciiCode(uint8_t ascii_code) {
Key key = Key_NoKey; Key key = Key_NoKey;
switch (ascii_code) { switch (ascii_code) {
case 0x08 ... 0x09: case 0x08 ... 0x09:
key.keyCode = Key_Backspace.keyCode + ascii_code - 0x08; key.keyCode = Key_Backspace.keyCode + ascii_code - 0x08;
break; break;
case 0x0A: case 0x0A:
key.keyCode = Key_Enter.keyCode; key.keyCode = Key_Enter.keyCode;
break; break;
case 0x1B: case 0x1B:
key.keyCode = Key_Escape.keyCode; key.keyCode = Key_Escape.keyCode;
break; break;
case 0x20: case 0x20:
key.keyCode = Key_Spacebar.keyCode; key.keyCode = Key_Spacebar.keyCode;
break; break;
case 0x21 ... 0x30: case 0x21 ... 0x30:
key.raw = pgm_read_word(&ascii_to_key_map[ascii_code - 0x21]); key.raw = pgm_read_word(&ascii_to_key_map[ascii_code - 0x21]);
break; break;
case 0x31 ... 0x39: case 0x31 ... 0x39:
key.keyCode = Key_1.keyCode + ascii_code - 0x31; key.keyCode = Key_1.keyCode + ascii_code - 0x31;
break; break;
case 0x3A ... 0x40: case 0x3A ... 0x40:
key.raw = pgm_read_word(&ascii_to_key_map[ascii_code - 0x3A + 16]); key.raw = pgm_read_word(&ascii_to_key_map[ascii_code - 0x3A + 16]);
break; break;
case 0x41 ... 0x5A: case 0x41 ... 0x5A:
key.flags = SHIFT_HELD; key.flags = SHIFT_HELD;
key.keyCode = Key_A.keyCode + ascii_code - 0x41; key.keyCode = Key_A.keyCode + ascii_code - 0x41;
break; break;
case 0x5B ... 0x5F: case 0x5B ... 0x5F:
key.raw = pgm_read_word(&ascii_to_key_map[ascii_code - 0x5B + 23]); key.raw = pgm_read_word(&ascii_to_key_map[ascii_code - 0x5B + 23]);
break; break;
case 0x61 ... 0x7A: case 0x61 ... 0x7A:
key.keyCode = Key_A.keyCode + ascii_code - 0x61; key.keyCode = Key_A.keyCode + ascii_code - 0x61;
break; break;
case 0x7B ... 0x7E: case 0x7B ... 0x7E:
key.raw = pgm_read_word(&ascii_to_key_map[ascii_code - 0x7B + 29]); key.raw = pgm_read_word(&ascii_to_key_map[ascii_code - 0x7B + 29]);
break; break;
} }
return key; return key;
} }
void Macros_::type(const char *string) { void Macros_::type(const char *string) {

@ -19,7 +19,7 @@ class Macros_ : public KaleidoscopePlugin {
static byte row, col; static byte row, col;
private: private:
Key lookupAsciiCode(uint8_t ascii_code); Key lookupAsciiCode(uint8_t ascii_code);
}; };
extern Macros_ Macros; extern Macros_ Macros;

Loading…
Cancel
Save