summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPriyadi Iman Nurcahyo <priyadi@priyadi.net>2017-02-13 14:55:35 +0700
committerPriyadi Iman Nurcahyo <priyadi@priyadi.net>2017-02-13 14:55:35 +0700
commit8c93c5d9ab8a0a69d84f707db71f417b66402693 (patch)
tree47f9577431d21f7c54ed8ff0d68e77f4a42123a9
parentc68e596f32c5d450a714627871408407e9988ef7 (diff)
Add keycodes to turn on, turn off and toggle faux clicky
-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 6cfc291c05..109bd0d83e 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/>.
#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 45ea8cb73c..2088c10c95 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 ab2e790269..cc7a5013f6 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,