pull/365/head
Jesse Vincent 8 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 key = Key_NoKey;
switch (ascii_code) {
case 0x08 ... 0x09:
key.keyCode = Key_Backspace.keyCode + ascii_code - 0x08;
break;
case 0x0A:
key.keyCode = Key_Enter.keyCode;
break;
case 0x1B:
key.keyCode = Key_Escape.keyCode;
break;
case 0x20:
key.keyCode = Key_Spacebar.keyCode;
break;
case 0x21 ... 0x30:
key.raw = pgm_read_word(&ascii_to_key_map[ascii_code - 0x21]);
break;
case 0x31 ... 0x39:
key.keyCode = Key_1.keyCode + ascii_code - 0x31;
break;
case 0x3A ... 0x40:
key.raw = pgm_read_word(&ascii_to_key_map[ascii_code - 0x3A + 16]);
break;
case 0x41 ... 0x5A:
key.flags = SHIFT_HELD;
key.keyCode = Key_A.keyCode + ascii_code - 0x41;
break;
case 0x5B ... 0x5F:
key.raw = pgm_read_word(&ascii_to_key_map[ascii_code - 0x5B + 23]);
break;
case 0x61 ... 0x7A:
key.keyCode = Key_A.keyCode + ascii_code - 0x61;
break;
case 0x7B ... 0x7E:
key.raw = pgm_read_word(&ascii_to_key_map[ascii_code - 0x7B + 29]);
break;
}
return key;
Key key = Key_NoKey;
switch (ascii_code) {
case 0x08 ... 0x09:
key.keyCode = Key_Backspace.keyCode + ascii_code - 0x08;
break;
case 0x0A:
key.keyCode = Key_Enter.keyCode;
break;
case 0x1B:
key.keyCode = Key_Escape.keyCode;
break;
case 0x20:
key.keyCode = Key_Spacebar.keyCode;
break;
case 0x21 ... 0x30:
key.raw = pgm_read_word(&ascii_to_key_map[ascii_code - 0x21]);
break;
case 0x31 ... 0x39:
key.keyCode = Key_1.keyCode + ascii_code - 0x31;
break;
case 0x3A ... 0x40:
key.raw = pgm_read_word(&ascii_to_key_map[ascii_code - 0x3A + 16]);
break;
case 0x41 ... 0x5A:
key.flags = SHIFT_HELD;
key.keyCode = Key_A.keyCode + ascii_code - 0x41;
break;
case 0x5B ... 0x5F:
key.raw = pgm_read_word(&ascii_to_key_map[ascii_code - 0x5B + 23]);
break;
case 0x61 ... 0x7A:
key.keyCode = Key_A.keyCode + ascii_code - 0x61;
break;
case 0x7B ... 0x7E:
key.raw = pgm_read_word(&ascii_to_key_map[ascii_code - 0x7B + 29]);
break;
}
return key;
}
void Macros_::type(const char *string) {

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

Loading…
Cancel
Save