diff options
Diffstat (limited to 'quantum')
-rw-r--r-- | quantum/audio/song_list.h | 27 | ||||
-rw-r--r-- | quantum/process_keycode/process_unicodemap.c | 10 | ||||
-rw-r--r-- | quantum/quantum.c | 67 | ||||
-rw-r--r-- | quantum/quantum.h | 1 | ||||
-rw-r--r-- | quantum/quantum_keycodes.h | 5 |
5 files changed, 81 insertions, 29 deletions
diff --git a/quantum/audio/song_list.h b/quantum/audio/song_list.h index 8022ca672..400915db9 100644 --- a/quantum/audio/song_list.h +++ b/quantum/audio/song_list.h | |||
@@ -122,4 +122,31 @@ | |||
122 | E__NOTE(_E5), \ | 122 | E__NOTE(_E5), \ |
123 | E__NOTE(_D5), | 123 | E__NOTE(_D5), |
124 | 124 | ||
125 | #define COIN_SOUND \ | ||
126 | E__NOTE(_A5 ), \ | ||
127 | HD_NOTE(_E6 ), | ||
128 | |||
129 | #define ONE_UP_SOUND \ | ||
130 | Q__NOTE(_E6 ), \ | ||
131 | Q__NOTE(_G6 ), \ | ||
132 | Q__NOTE(_E7 ), \ | ||
133 | Q__NOTE(_C7 ), \ | ||
134 | Q__NOTE(_D7 ), \ | ||
135 | Q__NOTE(_G7 ), | ||
136 | |||
137 | #define SONIC_RING \ | ||
138 | E__NOTE(_E6), \ | ||
139 | E__NOTE(_G6), \ | ||
140 | HD_NOTE(_C7), | ||
141 | |||
142 | #define ZELDA_PUZZLE \ | ||
143 | Q__NOTE(_G5), \ | ||
144 | Q__NOTE(_FS5), \ | ||
145 | Q__NOTE(_DS5), \ | ||
146 | Q__NOTE(_A4), \ | ||
147 | Q__NOTE(_GS4), \ | ||
148 | Q__NOTE(_E5), \ | ||
149 | Q__NOTE(_GS5), \ | ||
150 | HD_NOTE(_C6), | ||
151 | |||
125 | #endif | 152 | #endif |
diff --git a/quantum/process_keycode/process_unicodemap.c b/quantum/process_keycode/process_unicodemap.c index 37f10df86..68a593a18 100644 --- a/quantum/process_keycode/process_unicodemap.c +++ b/quantum/process_keycode/process_unicodemap.c | |||
@@ -1,25 +1,26 @@ | |||
1 | #include "process_unicodemap.h" | 1 | #include "process_unicodemap.h" |
2 | #include "process_unicode_common.h" | ||
2 | 3 | ||
3 | __attribute__((weak)) | 4 | __attribute__((weak)) |
4 | const uint32_t PROGMEM unicode_map[] = { | 5 | const uint32_t PROGMEM unicode_map[] = { |
5 | }; | 6 | }; |
6 | 7 | ||
7 | void register_hex32(uint32_t hex) { | 8 | void register_hex32(uint32_t hex) { |
8 | uint8_t onzerostart = 1; | 9 | bool onzerostart = true; |
9 | for(int i = 7; i >= 0; i--) { | 10 | for(int i = 7; i >= 0; i--) { |
10 | if (i <= 3) { | 11 | if (i <= 3) { |
11 | onzerostart = 0; | 12 | onzerostart = false; |
12 | } | 13 | } |
13 | uint8_t digit = ((hex >> (i*4)) & 0xF); | 14 | uint8_t digit = ((hex >> (i*4)) & 0xF); |
14 | if (digit == 0) { | 15 | if (digit == 0) { |
15 | if (onzerostart == 0) { | 16 | if (!onzerostart) { |
16 | register_code(hex_to_keycode(digit)); | 17 | register_code(hex_to_keycode(digit)); |
17 | unregister_code(hex_to_keycode(digit)); | 18 | unregister_code(hex_to_keycode(digit)); |
18 | } | 19 | } |
19 | } else { | 20 | } else { |
20 | register_code(hex_to_keycode(digit)); | 21 | register_code(hex_to_keycode(digit)); |
21 | unregister_code(hex_to_keycode(digit)); | 22 | unregister_code(hex_to_keycode(digit)); |
22 | onzerostart = 0; | 23 | onzerostart = false; |
23 | } | 24 | } |
24 | } | 25 | } |
25 | } | 26 | } |
@@ -28,6 +29,7 @@ __attribute__((weak)) | |||
28 | void unicode_map_input_error() {} | 29 | void unicode_map_input_error() {} |
29 | 30 | ||
30 | bool process_unicode_map(uint16_t keycode, keyrecord_t *record) { | 31 | bool process_unicode_map(uint16_t keycode, keyrecord_t *record) { |
32 | uint8_t input_mode = get_unicode_input_mode(); | ||
31 | if ((keycode & QK_UNICODE_MAP) == QK_UNICODE_MAP && record->event.pressed) { | 33 | if ((keycode & QK_UNICODE_MAP) == QK_UNICODE_MAP && record->event.pressed) { |
32 | const uint32_t* map = unicode_map; | 34 | const uint32_t* map = unicode_map; |
33 | uint16_t index = keycode - QK_UNICODE_MAP; | 35 | uint16_t index = keycode - QK_UNICODE_MAP; |
diff --git a/quantum/quantum.c b/quantum/quantum.c index a4a12061b..5a9e771a9 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c | |||
@@ -7,6 +7,9 @@ | |||
7 | #define TAPPING_TERM 200 | 7 | #define TAPPING_TERM 200 |
8 | #endif | 8 | #endif |
9 | 9 | ||
10 | #include "backlight.h" | ||
11 | extern backlight_config_t backlight_config; | ||
12 | |||
10 | #ifdef FAUXCLICKY_ENABLE | 13 | #ifdef FAUXCLICKY_ENABLE |
11 | #include "fauxclicky.h" | 14 | #include "fauxclicky.h" |
12 | #endif | 15 | #endif |
@@ -294,14 +297,6 @@ bool process_record_quantum(keyrecord_t *record) { | |||
294 | return false; | 297 | return false; |
295 | break; | 298 | break; |
296 | #endif | 299 | #endif |
297 | #ifdef ADAFRUIT_BLE_ENABLE | ||
298 | case OUT_BLE: | ||
299 | if (record->event.pressed) { | ||
300 | set_output(OUTPUT_ADAFRUIT_BLE); | ||
301 | } | ||
302 | return false; | ||
303 | break; | ||
304 | #endif | ||
305 | #endif | 300 | #endif |
306 | case MAGIC_SWAP_CONTROL_CAPSLOCK ... MAGIC_TOGGLE_NKRO: | 301 | case MAGIC_SWAP_CONTROL_CAPSLOCK ... MAGIC_TOGGLE_NKRO: |
307 | if (record->event.pressed) { | 302 | if (record->event.pressed) { |
@@ -604,6 +599,10 @@ void matrix_scan_quantum() { | |||
604 | matrix_scan_combo(); | 599 | matrix_scan_combo(); |
605 | #endif | 600 | #endif |
606 | 601 | ||
602 | #if defined(BACKLIGHT_ENABLE) && defined(BACKLIGHT_PIN) | ||
603 | backlight_task(); | ||
604 | #endif | ||
605 | |||
607 | matrix_scan_kb(); | 606 | matrix_scan_kb(); |
608 | } | 607 | } |
609 | 608 | ||
@@ -671,13 +670,13 @@ __attribute__ ((weak)) | |||
671 | void backlight_set(uint8_t level) | 670 | void backlight_set(uint8_t level) |
672 | { | 671 | { |
673 | // Prevent backlight blink on lowest level | 672 | // Prevent backlight blink on lowest level |
674 | #if BACKLIGHT_ON_STATE == 0 | 673 | // #if BACKLIGHT_ON_STATE == 0 |
675 | // PORTx &= ~n | 674 | // // PORTx &= ~n |
676 | _SFR_IO8((backlight_pin >> 4) + 2) &= ~_BV(backlight_pin & 0xF); | 675 | // _SFR_IO8((backlight_pin >> 4) + 2) &= ~_BV(backlight_pin & 0xF); |
677 | #else | 676 | // #else |
678 | // PORTx |= n | 677 | // // PORTx |= n |
679 | _SFR_IO8((backlight_pin >> 4) + 2) |= _BV(backlight_pin & 0xF); | 678 | // _SFR_IO8((backlight_pin >> 4) + 2) |= _BV(backlight_pin & 0xF); |
680 | #endif | 679 | // #endif |
681 | 680 | ||
682 | if ( level == 0 ) { | 681 | if ( level == 0 ) { |
683 | #ifndef NO_BACKLIGHT_CLOCK | 682 | #ifndef NO_BACKLIGHT_CLOCK |
@@ -685,13 +684,13 @@ void backlight_set(uint8_t level) | |||
685 | TCCR1A &= ~(_BV(COM1x1)); | 684 | TCCR1A &= ~(_BV(COM1x1)); |
686 | OCR1x = 0x0; | 685 | OCR1x = 0x0; |
687 | #else | 686 | #else |
688 | #if BACKLIGHT_ON_STATE == 0 | 687 | // #if BACKLIGHT_ON_STATE == 0 |
689 | // PORTx |= n | 688 | // // PORTx |= n |
690 | _SFR_IO8((backlight_pin >> 4) + 2) |= _BV(backlight_pin & 0xF); | 689 | // _SFR_IO8((backlight_pin >> 4) + 2) |= _BV(backlight_pin & 0xF); |
691 | #else | 690 | // #else |
692 | // PORTx &= ~n | 691 | // // PORTx &= ~n |
693 | _SFR_IO8((backlight_pin >> 4) + 2) &= ~_BV(backlight_pin & 0xF); | 692 | // _SFR_IO8((backlight_pin >> 4) + 2) &= ~_BV(backlight_pin & 0xF); |
694 | #endif | 693 | // #endif |
695 | #endif | 694 | #endif |
696 | } | 695 | } |
697 | #ifndef NO_BACKLIGHT_CLOCK | 696 | #ifndef NO_BACKLIGHT_CLOCK |
@@ -714,6 +713,30 @@ void backlight_set(uint8_t level) | |||
714 | #endif | 713 | #endif |
715 | } | 714 | } |
716 | 715 | ||
716 | uint8_t backlight_tick = 0; | ||
717 | |||
718 | void backlight_task(void) { | ||
719 | #ifdef NO_BACKLIGHT_CLOCK | ||
720 | if ((0xFFFF >> ((BACKLIGHT_LEVELS - backlight_config.level) * ((BACKLIGHT_LEVELS + 1) / 2))) & (1 << backlight_tick)) { | ||
721 | #if BACKLIGHT_ON_STATE == 0 | ||
722 | // PORTx &= ~n | ||
723 | _SFR_IO8((backlight_pin >> 4) + 2) &= ~_BV(backlight_pin & 0xF); | ||
724 | #else | ||
725 | // PORTx |= n | ||
726 | _SFR_IO8((backlight_pin >> 4) + 2) |= _BV(backlight_pin & 0xF); | ||
727 | #endif | ||
728 | } else { | ||
729 | #if BACKLIGHT_ON_STATE == 0 | ||
730 | // PORTx |= n | ||
731 | _SFR_IO8((backlight_pin >> 4) + 2) |= _BV(backlight_pin & 0xF); | ||
732 | #else | ||
733 | // PORTx &= ~n | ||
734 | _SFR_IO8((backlight_pin >> 4) + 2) &= ~_BV(backlight_pin & 0xF); | ||
735 | #endif | ||
736 | } | ||
737 | backlight_tick = (backlight_tick + 1) % 16; | ||
738 | #endif | ||
739 | } | ||
717 | 740 | ||
718 | #ifdef BACKLIGHT_BREATHING | 741 | #ifdef BACKLIGHT_BREATHING |
719 | 742 | ||
diff --git a/quantum/quantum.h b/quantum/quantum.h index 77732d43f..1f1bb0afd 100644 --- a/quantum/quantum.h +++ b/quantum/quantum.h | |||
@@ -108,6 +108,7 @@ void unregister_code16 (uint16_t code); | |||
108 | 108 | ||
109 | #ifdef BACKLIGHT_ENABLE | 109 | #ifdef BACKLIGHT_ENABLE |
110 | void backlight_init_ports(void); | 110 | void backlight_init_ports(void); |
111 | void backlight_task(void); | ||
111 | 112 | ||
112 | #ifdef BACKLIGHT_BREATHING | 113 | #ifdef BACKLIGHT_BREATHING |
113 | void breathing_enable(void); | 114 | void breathing_enable(void); |
diff --git a/quantum/quantum_keycodes.h b/quantum/quantum_keycodes.h index 56228f276..1e3df9fa6 100644 --- a/quantum/quantum_keycodes.h +++ b/quantum/quantum_keycodes.h | |||
@@ -389,9 +389,6 @@ enum quantum_keycodes { | |||
389 | #ifdef BLUETOOTH_ENABLE | 389 | #ifdef BLUETOOTH_ENABLE |
390 | OUT_BT, | 390 | OUT_BT, |
391 | #endif | 391 | #endif |
392 | #ifdef ADAFRUIT_BLE_ENABLE | ||
393 | OUT_BLE, | ||
394 | #endif | ||
395 | 392 | ||
396 | // always leave at the end | 393 | // always leave at the end |
397 | SAFE_RANGE | 394 | SAFE_RANGE |
@@ -413,6 +410,7 @@ enum quantum_keycodes { | |||
413 | #define ALTG(kc) (kc | QK_RCTL | QK_RALT) | 410 | #define ALTG(kc) (kc | QK_RCTL | QK_RALT) |
414 | #define SCMD(kc) (kc | QK_LGUI | QK_LSFT) | 411 | #define SCMD(kc) (kc | QK_LGUI | QK_LSFT) |
415 | #define SWIN(kc) SCMD(kc) | 412 | #define SWIN(kc) SCMD(kc) |
413 | #define LCA(kc) (kc | QK_LCTL | QK_LALT) | ||
416 | 414 | ||
417 | #define MOD_HYPR 0xf | 415 | #define MOD_HYPR 0xf |
418 | #define MOD_MEH 0x7 | 416 | #define MOD_MEH 0x7 |
@@ -566,6 +564,7 @@ enum quantum_keycodes { | |||
566 | #define ALL_T(kc) MT((MOD_LCTL | MOD_LSFT | MOD_LALT | MOD_LGUI), kc) // see http://brettterpstra.com/2012/12/08/a-useful-caps-lock-key/ | 564 | #define ALL_T(kc) MT((MOD_LCTL | MOD_LSFT | MOD_LALT | MOD_LGUI), kc) // see http://brettterpstra.com/2012/12/08/a-useful-caps-lock-key/ |
567 | #define SCMD_T(kc) MT((MOD_LGUI | MOD_LSFT), kc) | 565 | #define SCMD_T(kc) MT((MOD_LGUI | MOD_LSFT), kc) |
568 | #define SWIN_T(kc) SCMD_T(kc) | 566 | #define SWIN_T(kc) SCMD_T(kc) |
567 | #define LCA_T(kc) MT((MOD_LCTL | MOD_LALT), kc) // Left control and left alt | ||
569 | 568 | ||
570 | // Dedicated keycode versions for Hyper and Meh, if you want to use them as standalone keys rather than mod-tap | 569 | // Dedicated keycode versions for Hyper and Meh, if you want to use them as standalone keys rather than mod-tap |
571 | #define KC_HYPR HYPR(KC_NO) | 570 | #define KC_HYPR HYPR(KC_NO) |