aboutsummaryrefslogtreecommitdiffstats
path: root/quantum
diff options
context:
space:
mode:
Diffstat (limited to 'quantum')
-rw-r--r--quantum/audio/song_list.h27
-rw-r--r--quantum/quantum.c67
-rw-r--r--quantum/quantum.h1
-rw-r--r--quantum/quantum_keycodes.h3
4 files changed, 73 insertions, 25 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/quantum.c b/quantum/quantum.c
index 4a6d0355f..807a7084a 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
@@ -291,14 +294,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) {
@@ -601,6 +596,10 @@ void matrix_scan_quantum() {
matrix_scan_combo();
#endif
+ #if defined(BACKLIGHT_ENABLE) && defined(BACKLIGHT_PIN)
+ backlight_task();
+ #endif
+
matrix_scan_kb();
}
@@ -668,13 +667,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
@@ -682,13 +681,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
@@ -711,6 +710,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 580d51202..259bac369 100644
--- a/quantum/quantum.h
+++ b/quantum/quantum.h
@@ -103,6 +103,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 903d57f1e..78b02a0de 100644
--- a/quantum/quantum_keycodes.h
+++ b/quantum/quantum_keycodes.h
@@ -159,9 +159,6 @@ enum quantum_keycodes {
#ifdef BLUETOOTH_ENABLE
OUT_BT,
#endif
-#ifdef ADAFRUIT_BLE_ENABLE
- OUT_BLE,
-#endif
// always leave at the end
SAFE_RANGE