diff options
author | Jack Humbert <jack.humb@gmail.com> | 2017-03-31 18:27:44 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-31 18:27:44 -0400 |
commit | 2b4efaba53164fc1487df3147ac7ded8bece4272 (patch) | |
tree | 48e8fe12880f58ebc7e143d245af5826c20b6f54 /quantum | |
parent | b441468795ed5ca67359d02eb2588844873da3e3 (diff) | |
parent | d1e66e2e0715c680a8da3216525b54fd8f2b671f (diff) |
Merge pull request #1189 from Zay950/to_push
Unicode input_mode presistance
Diffstat (limited to 'quantum')
-rw-r--r-- | quantum/audio/song_list.h | 12 | ||||
-rw-r--r-- | quantum/process_keycode/process_tap_dance.c | 2 | ||||
-rw-r--r-- | quantum/process_keycode/process_unicode.c | 6 | ||||
-rw-r--r-- | quantum/process_keycode/process_unicode_common.c | 14 |
4 files changed, 34 insertions, 0 deletions
diff --git a/quantum/audio/song_list.h b/quantum/audio/song_list.h index 3bf20333dd..db2d1a94cd 100644 --- a/quantum/audio/song_list.h +++ b/quantum/audio/song_list.h @@ -18,6 +18,10 @@ #ifndef SONG_LIST_H #define SONG_LIST_H +#define COIN_SOUND \ + E__NOTE(_A5 ),\ + HD_NOTE(_E6 ), + #define ODE_TO_JOY \ Q__NOTE(_E4), Q__NOTE(_E4), Q__NOTE(_F4), Q__NOTE(_G4), \ Q__NOTE(_G4), Q__NOTE(_F4), Q__NOTE(_E4), Q__NOTE(_D4), \ @@ -137,6 +141,14 @@ E__NOTE(_E5), \ E__NOTE(_D5), +#define UNICODE_WINDOWS \ + E__NOTE(_B5), \ + S__NOTE(_E6), + +#define UNICODE_LINUX \ + E__NOTE(_E6), \ + S__NOTE(_B5), + #define COIN_SOUND \ E__NOTE(_A5 ), \ HD_NOTE(_E6 ), diff --git a/quantum/process_keycode/process_tap_dance.c b/quantum/process_keycode/process_tap_dance.c index 68c8425bb4..b807ec3c30 100644 --- a/quantum/process_keycode/process_tap_dance.c +++ b/quantum/process_keycode/process_tap_dance.c @@ -16,6 +16,8 @@ #include "quantum.h" #include "action_tapping.h" +uint8_t get_oneshot_mods(void); + static uint16_t last_td; static int8_t highest_td = -1; diff --git a/quantum/process_keycode/process_unicode.c b/quantum/process_keycode/process_unicode.c index 26571ea034..678a15234d 100644 --- a/quantum/process_keycode/process_unicode.c +++ b/quantum/process_keycode/process_unicode.c @@ -16,8 +16,14 @@ #include "process_unicode.h" #include "action_util.h" +static uint8_t first_flag = 0; + bool process_unicode(uint16_t keycode, keyrecord_t *record) { if (keycode > QK_UNICODE && record->event.pressed) { + if (first_flag == 0) { + set_unicode_input_mode(eeprom_read_byte(EECONFIG_UNICODEMODE)); + first_flag = 1; + } uint16_t unicode = keycode & 0x7FFF; unicode_input_start(); register_hex(unicode); diff --git a/quantum/process_keycode/process_unicode_common.c b/quantum/process_keycode/process_unicode_common.c index 6012b4f07e..1dbdec3e71 100644 --- a/quantum/process_keycode/process_unicode_common.c +++ b/quantum/process_keycode/process_unicode_common.c @@ -16,11 +16,13 @@ #include "process_unicode_common.h" +static uint8_t input_mode; uint8_t mods; void set_unicode_input_mode(uint8_t os_target) { input_mode = os_target; + eeprom_update_byte(EECONFIG_UNICODEMODE, os_target); } uint8_t get_unicode_input_mode(void) { @@ -92,6 +94,18 @@ void unicode_input_finish (void) { if (mods & MOD_BIT(KC_RGUI)) register_code(KC_RGUI); } +__attribute__((weak)) +uint16_t hex_to_keycode(uint8_t hex) +{ + if (hex == 0x0) { + return KC_0; + } else if (hex < 0xA) { + return KC_1 + (hex - 0x1); + } else { + return KC_A + (hex - 0xA); + } +} + void register_hex(uint16_t hex) { for(int i = 3; i >= 0; i--) { uint8_t digit = ((hex >> (i*4)) & 0xF); |