diff --git a/quantum/fauxclicky.h b/quantum/fauxclicky.h index 6cfc291c0..109bd0d83 100644 --- a/quantum/fauxclicky.h +++ b/quantum/fauxclicky.h @@ -18,6 +18,7 @@ along with this program. If not, see . #endif #include "musical_notes.h" +#include "stdbool.h" __attribute__ ((weak)) float fauxclicky_pressed_note[2]; @@ -26,6 +27,8 @@ float fauxclicky_released_note[2]; __attribute__ ((weak)) float fauxclicky_beep_note[2]; +bool fauxclicky_enabled; + // // tempo in BPM // @@ -52,6 +55,15 @@ float fauxclicky_beep_note[2]; fauxclicky_stop(); \ } while (0) +// toggle +#define FAUXCLICKY_TOGGLE do { \ + if (fauxclicky_enabled) { \ + FAUXCLICKY_OFF; \ + } else { \ + FAUXCLICKY_ON; \ + } \ +} while (0) + // // pin configuration // diff --git a/quantum/quantum.c b/quantum/quantum.c index 45ea8cb73..2088c10c9 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c @@ -7,6 +7,10 @@ #define TAPPING_TERM 200 #endif +#ifdef FAUXCLICKY_ENABLE +#include "fauxclicky.h" +#endif + static void do_code16 (uint16_t code, void (*f) (uint8_t)) { switch (code) { case QK_MODS ... QK_MODS_MAX: @@ -196,6 +200,26 @@ bool process_record_quantum(keyrecord_t *record) { } return false; break; + #ifdef FAUXCLICKY_ENABLE + case FC_TOG: + if (record->event.pressed) { + FAUXCLICKY_TOGGLE; + } + return false; + break; + case FC_ON: + if (record->event.pressed) { + FAUXCLICKY_ON; + } + return false; + break; + case FC_OFF: + if (record->event.pressed) { + FAUXCLICKY_OFF; + } + return false; + break; + #endif #ifdef RGBLIGHT_ENABLE case RGB_TOG: if (record->event.pressed) { diff --git a/quantum/quantum_keycodes.h b/quantum/quantum_keycodes.h index ab2e79026..cc7a5013f 100644 --- a/quantum/quantum_keycodes.h +++ b/quantum/quantum_keycodes.h @@ -86,6 +86,13 @@ enum quantum_keycodes { AU_OFF, AU_TOG, +#ifdef FAUXCLICKY_ENABLE + // Faux clicky + FC_ON, + FC_OFF, + FC_TOG, +#endif + // Music mode on/off/toggle MU_ON, MU_OFF,