summaryrefslogtreecommitdiffstats
path: root/quantum
diff options
context:
space:
mode:
Diffstat (limited to 'quantum')
-rw-r--r--quantum/audio/song_list.h27
-rw-r--r--quantum/process_keycode/process_unicodemap.c10
-rw-r--r--quantum/quantum.c67
-rw-r--r--quantum/quantum.h1
-rw-r--r--quantum/quantum_keycodes.h5
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 @@
E__NOTE(_E5), \
E__NOTE(_D5),
+#define COIN_SOUND \
+ E__NOTE(_A5 ), \
+ HD_NOTE(_E6 ),
+
+#define ONE_UP_SOUND \
+ Q__NOTE(_E6 ), \
+ Q__NOTE(_G6 ), \
+ Q__NOTE(_E7 ), \
+ Q__NOTE(_C7 ), \
+ Q__NOTE(_D7 ), \
+ Q__NOTE(_G7 ),
+
+#define SONIC_RING \
+ E__NOTE(_E6), \
+ E__NOTE(_G6), \
+ HD_NOTE(_C7),
+
+#define ZELDA_PUZZLE \
+ Q__NOTE(_G5), \
+ Q__NOTE(_FS5), \
+ Q__NOTE(_DS5), \
+ Q__NOTE(_A4), \
+ Q__NOTE(_GS4), \
+ Q__NOTE(_E5), \
+ Q__NOTE(_GS5), \
+ HD_NOTE(_C6),
+
#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 @@
#include "process_unicodemap.h"
+#include "process_unicode_common.h"
__attribute__((weak))
const uint32_t PROGMEM unicode_map[] = {
};
void register_hex32(uint32_t hex) {
- uint8_t onzerostart = 1;
+ bool onzerostart = true;
for(int i = 7; i >= 0; i--) {
if (i <= 3) {
- onzerostart = 0;
+ onzerostart = false;
}
uint8_t digit = ((hex >> (i*4)) & 0xF);
if (digit == 0) {
- if (onzerostart == 0) {
+ if (!onzerostart) {
register_code(hex_to_keycode(digit));
unregister_code(hex_to_keycode(digit));
}
} else {
register_code(hex_to_keycode(digit));
unregister_code(hex_to_keycode(digit));
- onzerostart = 0;
+ onzerostart = false;
}
}
}
@@ -28,6 +29,7 @@ __attribute__((weak))
void unicode_map_input_error() {}
bool process_unicode_map(uint16_t keycode, keyrecord_t *record) {
+ uint8_t input_mode = get_unicode_input_mode();
if ((keycode & QK_UNICODE_MAP) == QK_UNICODE_MAP && record->event.pressed) {
const uint32_t* map = unicode_map;
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 @@
#define TAPPING_TERM 200
#endif
+#include "backlight.h"
+extern backlight_config_t backlight_config;
+
#ifdef FAUXCLICKY_ENABLE
#include "fauxclicky.h"
#endif
@@ -294,14 +297,6 @@ bool process_record_quantum(keyrecord_t *record) {
return false;
break;
#endif
- #ifdef ADAFRUIT_BLE_ENABLE
- case OUT_BLE:
- if (record->event.pressed) {
- set_output(OUTPUT_ADAFRUIT_BLE);
- }
- return false;
- break;
- #endif
#endif
case MAGIC_SWAP_CONTROL_CAPSLOCK ... MAGIC_TOGGLE_NKRO:
if (record->event.pressed) {
@@ -604,6 +599,10 @@ void matrix_scan_quantum() {
matrix_scan_combo();
#endif
+ #if defined(BACKLIGHT_ENABLE) && defined(BACKLIGHT_PIN)
+ backlight_task();
+ #endif
+
matrix_scan_kb();
}
@@ -671,13 +670,13 @@ __attribute__ ((weak))
void backlight_set(uint8_t level)
{
// Prevent backlight blink on lowest level
- #if BACKLIGHT_ON_STATE == 0
- // PORTx &= ~n
- _SFR_IO8((backlight_pin >> 4) + 2) &= ~_BV(backlight_pin & 0xF);
- #else
- // PORTx |= n
- _SFR_IO8((backlight_pin >> 4) + 2) |= _BV(backlight_pin & 0xF);
- #endif
+ // #if BACKLIGHT_ON_STATE == 0
+ // // PORTx &= ~n
+ // _SFR_IO8((backlight_pin >> 4) + 2) &= ~_BV(backlight_pin & 0xF);
+ // #else
+ // // PORTx |= n
+ // _SFR_IO8((backlight_pin >> 4) + 2) |= _BV(backlight_pin & 0xF);
+ // #endif
if ( level == 0 ) {
#ifndef NO_BACKLIGHT_CLOCK
@@ -685,13 +684,13 @@ void backlight_set(uint8_t level)
TCCR1A &= ~(_BV(COM1x1));
OCR1x = 0x0;
#else
- #if BACKLIGHT_ON_STATE == 0
- // PORTx |= n
- _SFR_IO8((backlight_pin >> 4) + 2) |= _BV(backlight_pin & 0xF);
- #else
- // PORTx &= ~n
- _SFR_IO8((backlight_pin >> 4) + 2) &= ~_BV(backlight_pin & 0xF);
- #endif
+ // #if BACKLIGHT_ON_STATE == 0
+ // // PORTx |= n
+ // _SFR_IO8((backlight_pin >> 4) + 2) |= _BV(backlight_pin & 0xF);
+ // #else
+ // // PORTx &= ~n
+ // _SFR_IO8((backlight_pin >> 4) + 2) &= ~_BV(backlight_pin & 0xF);
+ // #endif
#endif
}
#ifndef NO_BACKLIGHT_CLOCK
@@ -714,6 +713,30 @@ void backlight_set(uint8_t level)
#endif
}
+uint8_t backlight_tick = 0;
+
+void backlight_task(void) {
+ #ifdef NO_BACKLIGHT_CLOCK
+ if ((0xFFFF >> ((BACKLIGHT_LEVELS - backlight_config.level) * ((BACKLIGHT_LEVELS + 1) / 2))) & (1 << backlight_tick)) {
+ #if BACKLIGHT_ON_STATE == 0
+ // PORTx &= ~n
+ _SFR_IO8((backlight_pin >> 4) + 2) &= ~_BV(backlight_pin & 0xF);
+ #else
+ // PORTx |= n
+ _SFR_IO8((backlight_pin >> 4) + 2) |= _BV(backlight_pin & 0xF);
+ #endif
+ } else {
+ #if BACKLIGHT_ON_STATE == 0
+ // PORTx |= n
+ _SFR_IO8((backlight_pin >> 4) + 2) |= _BV(backlight_pin & 0xF);
+ #else
+ // PORTx &= ~n
+ _SFR_IO8((backlight_pin >> 4) + 2) &= ~_BV(backlight_pin & 0xF);
+ #endif
+ }
+ backlight_tick = (backlight_tick + 1) % 16;
+ #endif
+}
#ifdef BACKLIGHT_BREATHING
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);
#ifdef BACKLIGHT_ENABLE
void backlight_init_ports(void);
+void backlight_task(void);
#ifdef BACKLIGHT_BREATHING
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 {
#ifdef BLUETOOTH_ENABLE
OUT_BT,
#endif
-#ifdef ADAFRUIT_BLE_ENABLE
- OUT_BLE,
-#endif
// always leave at the end
SAFE_RANGE
@@ -413,6 +410,7 @@ enum quantum_keycodes {
#define ALTG(kc) (kc | QK_RCTL | QK_RALT)
#define SCMD(kc) (kc | QK_LGUI | QK_LSFT)
#define SWIN(kc) SCMD(kc)
+#define LCA(kc) (kc | QK_LCTL | QK_LALT)
#define MOD_HYPR 0xf
#define MOD_MEH 0x7
@@ -566,6 +564,7 @@ enum quantum_keycodes {
#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/
#define SCMD_T(kc) MT((MOD_LGUI | MOD_LSFT), kc)
#define SWIN_T(kc) SCMD_T(kc)
+#define LCA_T(kc) MT((MOD_LCTL | MOD_LALT), kc) // Left control and left alt
// Dedicated keycode versions for Hyper and Meh, if you want to use them as standalone keys rather than mod-tap
#define KC_HYPR HYPR(KC_NO)