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

daktil_manuform
Priyadi Iman Nurcahyo 2017-02-13 14:55:35 +07:00
parent c68e596f32
commit 8c93c5d9ab
3 changed files with 43 additions and 0 deletions

View File

@ -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
//

View File

@ -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) {

View File

@ -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,