Add keycodes to turn on, turn off and toggle faux clicky

example_keyboards
Priyadi Iman Nurcahyo 8 years ago
parent c68e596f32
commit 8c93c5d9ab

@ -18,6 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#endif #endif
#include "musical_notes.h" #include "musical_notes.h"
#include "stdbool.h"
__attribute__ ((weak)) __attribute__ ((weak))
float fauxclicky_pressed_note[2]; float fauxclicky_pressed_note[2];
@ -26,6 +27,8 @@ float fauxclicky_released_note[2];
__attribute__ ((weak)) __attribute__ ((weak))
float fauxclicky_beep_note[2]; float fauxclicky_beep_note[2];
bool fauxclicky_enabled;
// //
// tempo in BPM // tempo in BPM
// //
@ -52,6 +55,15 @@ float fauxclicky_beep_note[2];
fauxclicky_stop(); \ fauxclicky_stop(); \
} while (0) } while (0)
// toggle
#define FAUXCLICKY_TOGGLE do { \
if (fauxclicky_enabled) { \
FAUXCLICKY_OFF; \
} else { \
FAUXCLICKY_ON; \
} \
} while (0)
// //
// pin configuration // pin configuration
// //

@ -7,6 +7,10 @@
#define TAPPING_TERM 200 #define TAPPING_TERM 200
#endif #endif
#ifdef FAUXCLICKY_ENABLE
#include "fauxclicky.h"
#endif
static void do_code16 (uint16_t code, void (*f) (uint8_t)) { static void do_code16 (uint16_t code, void (*f) (uint8_t)) {
switch (code) { switch (code) {
case QK_MODS ... QK_MODS_MAX: case QK_MODS ... QK_MODS_MAX:
@ -196,6 +200,26 @@ bool process_record_quantum(keyrecord_t *record) {
} }
return false; return false;
break; 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 #ifdef RGBLIGHT_ENABLE
case RGB_TOG: case RGB_TOG:
if (record->event.pressed) { if (record->event.pressed) {

@ -86,6 +86,13 @@ enum quantum_keycodes {
AU_OFF, AU_OFF,
AU_TOG, AU_TOG,
#ifdef FAUXCLICKY_ENABLE
// Faux clicky
FC_ON,
FC_OFF,
FC_TOG,
#endif
// Music mode on/off/toggle // Music mode on/off/toggle
MU_ON, MU_ON,
MU_OFF, MU_OFF,

Loading…
Cancel
Save