1
0
Fork 0

Convert Encoder callbacks to be boolean functions (#12805)

Co-authored-by: James Young <18669334+noroadsleft@users.noreply.github.com>
This commit is contained in:
Drashna Jael're 2021-05-21 23:17:32 -07:00 committed by GitHub
parent 76c23b15ab
commit a0fed0ea17
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
437 changed files with 2542 additions and 2135 deletions

View file

@ -237,7 +237,7 @@ void rgb_matrix_indicators_user(void) {
void matrix_init_keymap(void) {}
#ifdef ENCODER_ENABLE
void encoder_update(bool clockwise) {
bool encoder_update_user(uint8_t index, bool clockwise) {
switch (get_highest_layer(layer_state)) {
case _RAISE:
clockwise ? tap_code(KC_VOLD) : tap_code(KC_VOLU);
@ -260,6 +260,7 @@ void encoder_update(bool clockwise) {
# ifdef AUDIO_CLICKY
clicky_play();
# endif
return true;
}
#endif // ENCODER_ENABLE

View file

@ -121,7 +121,7 @@ uint16_t muse_counter = 0;
uint8_t muse_offset = 70;
uint16_t muse_tempo = 50;
void encoder_update_keymap(uint8_t index, bool clockwise) {
bool encoder_update_keymap(uint8_t index, bool clockwise) {
if (muse_mode) {
if (IS_LAYER_ON(_RAISE)) {
if (clockwise) {
@ -151,6 +151,7 @@ void encoder_update_keymap(uint8_t index, bool clockwise) {
#endif
}
}
return true;
}
void dip_switch_update_user(uint8_t index, bool active) {

View file

@ -142,7 +142,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return true;
}
void encoder_update(bool clockwise) {
bool encoder_update_user(uint8_t index, bool clockwise) {
if (IS_LAYER_ON(_RAISE) || IS_LAYER_ON(_LOWER)) {
if (clockwise) {
register_code(KC_VOLU);
@ -170,6 +170,5 @@ void encoder_update(bool clockwise) {
#endif
}
}
return true;
}

View file

@ -348,7 +348,7 @@ void matrix_init_keymap(void) {
#endif // RGB_MATRIX_INIT
#ifdef ENCODER_ENABLE
void encoder_update(bool clockwise) {
bool encoder_update_user(uint8_t index, bool clockwise) {
switch (get_highest_layer(layer_state)) {
case _RAISE:
clockwise ? tap_code(KC_VOLD) : tap_code(KC_VOLU);
@ -371,6 +371,7 @@ void encoder_update(bool clockwise) {
# ifdef AUDIO_CLICKY
clicky_play();
# endif
return true;
}
#endif // ENCODER_ENABLE

View file

@ -130,7 +130,7 @@ layer_state_t layer_state_set_user(layer_state_t state) {
return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
};
void encoder_update(bool clockwise) {
bool encoder_update_user(uint8_t index, bool clockwise) {
if (clockwise) {
#ifdef MOUSEKEY_ENABLE
tap_code(KC_MS_WH_DOWN);
@ -144,6 +144,7 @@ void encoder_update(bool clockwise) {
tap_code(KC_PGUP);
#endif
}
return true;
}
bool music_mask_user(uint16_t keycode) {

View file

@ -10,7 +10,7 @@ enum planck_layers {
_RAISE,
_PLOVER,
_ADJUST,
_FN1,
_DPAD,
_DPADNUM
@ -23,7 +23,7 @@ enum planck_keycodes {
PLOVER,
BACKLIT,
EXT_PLV,
DP_ON,
DP_OFF
};
@ -49,7 +49,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, RSFT_T(KC_ENT),
KC_APP, KC_LCTL, KC_LGUI, KC_LALT, LOWER, SPACEFN, SPACEFN, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT
KC_APP, KC_LCTL, KC_LGUI, KC_LALT, LOWER, SPACEFN, SPACEFN, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT
),
/* Colemak
@ -218,10 +218,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
#ifdef AUDIO_ENABLE
float plover_song[][2] = SONG(PLOVER_SOUND);
float plover_gb_song[][2] = SONG(PLOVER_GOODBYE_SOUND);
// Borrowing audio from unused audio
// Caps Lock on and off sound too similar
float caps_song_on[][2] = SONG(NUM_LOCK_ON_SOUND);
float caps_song_off[][2] = SONG(SCROLL_LOCK_ON_SOUND);
@ -236,7 +236,7 @@ layer_state_t layer_state_set_user(layer_state_t state) {
}
#else
layer_state_t layer_state_set_user(layer_state_t state) {
// LED control, lighting up when Fn layer is activated
state = update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
@ -256,7 +256,7 @@ layer_state_t layer_state_set_user(layer_state_t state) {
return state;
}
#endif
#endif
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
@ -324,8 +324,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
return false;
break;
// Play audio upon switching Caps Lock and custom layers
case KC_CAPS:
@ -339,26 +339,26 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#endif
}
return true;
case DP_ON:
if (record->event.pressed) {
} else {
#ifdef AUDIO_ENABLE
PLAY_SONG(dpad_song_on);
#endif
layer_off(_FN1);
layer_on(_DPAD);
}
case DP_OFF:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
#ifdef AUDIO_ENABLE
PLAY_SONG(dpad_song_off);
#endif
layer_off(_DPAD);
layer_off(_DPAD);
}
}
return true;
@ -370,7 +370,7 @@ uint16_t muse_counter = 0;
uint8_t muse_offset = 70;
uint16_t muse_tempo = 50;
void encoder_update(bool clockwise) {
bool encoder_update_user(uint8_t index, bool clockwise) {
if (muse_mode) {
if (IS_LAYER_ON(_RAISE)) {
if (clockwise) {
@ -392,6 +392,7 @@ void encoder_update(bool clockwise) {
tap_code(KC_PGUP);
}
}
return true;
}
void dip_update(uint8_t index, bool active) {

View file

@ -268,7 +268,7 @@ uint16_t muse_counter = 0;
uint8_t muse_offset = 70;
uint16_t muse_tempo = 50;
void encoder_update(bool clockwise) {
bool encoder_update_user(uint8_t index, bool clockwise) {
if (muse_mode) {
if (IS_LAYER_ON(_RAISE)) {
if (clockwise) {
@ -290,6 +290,7 @@ void encoder_update(bool clockwise) {
tap_code(KC_PGUP);
}
}
return true;
}
void dip_update(uint8_t index, bool active) {

View file

@ -257,7 +257,7 @@ uint16_t muse_counter = 0;
uint8_t muse_offset = 70;
uint16_t muse_tempo = 50;
void encoder_update(bool clockwise) {
bool encoder_update_user(uint8_t index, bool clockwise) {
if (muse_mode) {
if (IS_LAYER_ON(_RAISE)) {
if (clockwise) {
@ -287,6 +287,7 @@ void encoder_update(bool clockwise) {
#endif
}
}
return true;
}
void dip_switch_update_user(uint8_t index, bool active) {

View file

@ -185,7 +185,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return true;
}
void encoder_update(bool clockwise) {
bool encoder_update_user(uint8_t index, bool clockwise) {
if (clockwise) {
register_code(KC_VOLU);
unregister_code(KC_VOLU);
@ -193,6 +193,7 @@ void encoder_update(bool clockwise) {
register_code(KC_VOLD);
unregister_code(KC_VOLD);
}
return true;
}
// flicker implementation: