aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--quantum/fauxclicky.h12
-rw-r--r--quantum/quantum.c24
-rw-r--r--quantum/quantum_keycodes.h7
3 files changed, 43 insertions, 0 deletions
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 <http://www.gnu.org/licenses/>.
18#endif 18#endif
19 19
20#include "musical_notes.h" 20#include "musical_notes.h"
21#include "stdbool.h"
21 22
22__attribute__ ((weak)) 23__attribute__ ((weak))
23float fauxclicky_pressed_note[2]; 24float fauxclicky_pressed_note[2];
@@ -26,6 +27,8 @@ float fauxclicky_released_note[2];
26__attribute__ ((weak)) 27__attribute__ ((weak))
27float fauxclicky_beep_note[2]; 28float fauxclicky_beep_note[2];
28 29
30bool fauxclicky_enabled;
31
29// 32//
30// tempo in BPM 33// tempo in BPM
31// 34//
@@ -52,6 +55,15 @@ float fauxclicky_beep_note[2];
52 fauxclicky_stop(); \ 55 fauxclicky_stop(); \
53} while (0) 56} while (0)
54 57
58// toggle
59#define FAUXCLICKY_TOGGLE do { \
60 if (fauxclicky_enabled) { \
61 FAUXCLICKY_OFF; \
62 } else { \
63 FAUXCLICKY_ON; \
64 } \
65} while (0)
66
55// 67//
56// pin configuration 68// pin configuration
57// 69//
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 @@
7#define TAPPING_TERM 200 7#define TAPPING_TERM 200
8#endif 8#endif
9 9
10#ifdef FAUXCLICKY_ENABLE
11#include "fauxclicky.h"
12#endif
13
10static void do_code16 (uint16_t code, void (*f) (uint8_t)) { 14static void do_code16 (uint16_t code, void (*f) (uint8_t)) {
11 switch (code) { 15 switch (code) {
12 case QK_MODS ... QK_MODS_MAX: 16 case QK_MODS ... QK_MODS_MAX:
@@ -196,6 +200,26 @@ bool process_record_quantum(keyrecord_t *record) {
196 } 200 }
197 return false; 201 return false;
198 break; 202 break;
203 #ifdef FAUXCLICKY_ENABLE
204 case FC_TOG:
205 if (record->event.pressed) {
206 FAUXCLICKY_TOGGLE;
207 }
208 return false;
209 break;
210 case FC_ON:
211 if (record->event.pressed) {
212 FAUXCLICKY_ON;
213 }
214 return false;
215 break;
216 case FC_OFF:
217 if (record->event.pressed) {
218 FAUXCLICKY_OFF;
219 }
220 return false;
221 break;
222 #endif
199 #ifdef RGBLIGHT_ENABLE 223 #ifdef RGBLIGHT_ENABLE
200 case RGB_TOG: 224 case RGB_TOG:
201 if (record->event.pressed) { 225 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 {
86 AU_OFF, 86 AU_OFF,
87 AU_TOG, 87 AU_TOG,
88 88
89#ifdef FAUXCLICKY_ENABLE
90 // Faux clicky
91 FC_ON,
92 FC_OFF,
93 FC_TOG,
94#endif
95
89 // Music mode on/off/toggle 96 // Music mode on/off/toggle
90 MU_ON, 97 MU_ON,
91 MU_OFF, 98 MU_OFF,