summaryrefslogtreecommitdiff
path: root/quantum
diff options
context:
space:
mode:
authorDrashna Jaelre <drashna@live.com>2018-10-02 11:08:41 -0700
committerskullydazed <skullydazed@users.noreply.github.com>2019-04-12 14:07:05 -0700
commita2090d5e863a580d71e29de104844d5fc4fbe036 (patch)
treebf4be102f5be309d41ac1d8da2a2fd48fc775526 /quantum
parent6832a067ef8966993319f07f34a4a08b39c2ded4 (diff)
Add AltGr/RALT support to Send String
Diffstat (limited to 'quantum')
-rw-r--r--quantum/quantum.c43
1 files changed, 34 insertions, 9 deletions
diff --git a/quantum/quantum.c b/quantum/quantum.c
index a4ccccd00d..0fe918b365 100644
--- a/quantum/quantum.c
+++ b/quantum/quantum.c
@@ -851,6 +851,26 @@ const bool ascii_to_shift_lut[0x80] PROGMEM = {
};
__attribute__ ((weak))
+const bool ascii_to_alt_lut[0x80] PROGMEM = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0
+};
+
+__attribute__ ((weak))
const uint8_t ascii_to_keycode_lut[0x80] PROGMEM = {
0, 0, 0, 0, 0, 0, 0, 0,
KC_BSPC, KC_TAB, KC_ENT, 0, 0, 0, 0, 0,
@@ -932,16 +952,21 @@ void send_string_with_delay_P(const char *str, uint8_t interval) {
void send_char(char ascii_code) {
uint8_t keycode;
+ bool is_shifted;
+ bool is_alted;
+
keycode = pgm_read_byte(&ascii_to_keycode_lut[(uint8_t)ascii_code]);
- if (pgm_read_byte(&ascii_to_shift_lut[(uint8_t)ascii_code])) {
- register_code(KC_LSFT);
- register_code(keycode);
- unregister_code(keycode);
- unregister_code(KC_LSFT);
- } else {
- register_code(keycode);
- unregister_code(keycode);
- }
+ if (pgm_read_byte(&ascii_to_shift_lut[(uint8_t)ascii_code])) { is_shifted = true; } else { is_shifted = false; }
+ if (pgm_read_byte(&ascii_to_alt_lut[(uint8_t)ascii_code])) { is_alted = true; } else { is_alted = false; }
+
+ if (is_shifted) { register_code(KC_LSFT); }
+ if (is_alted) { register_code(KC_RALT); }
+
+ register_code(keycode);
+ unregister_code(keycode);
+
+ if (is_alted) { unregister_code(KC_RALT); }
+ if (is_shifted) { unregister_code(KC_LSFT); }
}
void set_single_persistent_default_layer(uint8_t default_layer) {