Convert Encoder callbacks to be boolean functions (#12805)
Co-authored-by: James Young <18669334+noroadsleft@users.noreply.github.com>
This commit is contained in:
parent
76c23b15ab
commit
a0fed0ea17
437 changed files with 2542 additions and 2135 deletions
|
@ -70,7 +70,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|||
}
|
||||
|
||||
#ifdef ENCODER_ENABLE
|
||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
||||
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||
switch (get_highest_layer(layer_state)) {
|
||||
case _QWERTY:
|
||||
#ifdef LAYERS_PROGRAMMER
|
||||
|
@ -90,6 +90,7 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
|||
}
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "encoder.h"
|
||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
||||
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||
static uint16_t kc;
|
||||
uint8_t temp_mod = get_mods();
|
||||
if (index == 0) { /* first encoder */
|
||||
|
@ -55,6 +55,7 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
|||
tap_code(KC_1);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
const uint16_t PROGMEM encoder_actions[][9] = { \
|
||||
// None CTRL ALT SHIFT GUI CTRL+ALT CTRL+SHFT ALT+SHFT HYPER
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#pragma once
|
||||
#include "quantum.h"
|
||||
const uint16_t PROGMEM encoder_actions[][9];
|
||||
void encoder_update_user(uint8_t index, bool clockwise);
|
||||
bool encoder_update_user(uint8_t index, bool clockwise);
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
#include "ninjonas.h"
|
||||
|
||||
#ifdef ENCODER_ENABLE
|
||||
#ifdef ENCODER_ENABLE
|
||||
void left_encoder_cw(void) {
|
||||
switch (get_highest_layer(layer_state)) {
|
||||
case _LOWER:
|
||||
|
@ -81,7 +81,7 @@ void right_encoder_acw(void) {
|
|||
}
|
||||
}
|
||||
|
||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
||||
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||
encoder_rotated_timer = timer_read();
|
||||
if (index == 0) {
|
||||
left_encoder_rotated = true;
|
||||
|
@ -99,6 +99,7 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
|||
right_encoder_acw();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -45,7 +45,7 @@ void ctl_copy_reset (qk_tap_dance_state_t *state, void *user_data) {
|
|||
}
|
||||
|
||||
#if defined(HAS_ROTARY)
|
||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
||||
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||
if (index == 0) { /* First encoder */
|
||||
if (clockwise) {
|
||||
tap_code(KC_VOLD);
|
||||
|
@ -53,6 +53,7 @@ void ctl_copy_reset (qk_tap_dance_state_t *state, void *user_data) {
|
|||
tap_code(KC_VOLU);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -75,7 +76,7 @@ void lock_unlock (qk_tap_dance_state_t *state, void *user_data) {
|
|||
writePin(INDICATOR_PIN_1, !led_user);
|
||||
wait_ms(200);
|
||||
writePin(INDICATOR_PIN_2, !led_user);
|
||||
#endif
|
||||
#endif
|
||||
break;
|
||||
case SINGLE_HOLD:
|
||||
break;
|
||||
|
@ -91,7 +92,7 @@ void lock_unlock (qk_tap_dance_state_t *state, void *user_data) {
|
|||
writePin(INDICATOR_PIN_1, !led_user);
|
||||
wait_ms(200);
|
||||
writePin(INDICATOR_PIN_0, !led_user);
|
||||
#endif
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ const uint16_t PROGMEM encoders[][2] = {
|
|||
{ KC_VOLU, KC_VOLD }
|
||||
};
|
||||
|
||||
void encoder_update_user(uint8_t index, bool clockwise)
|
||||
bool encoder_update_user(uint8_t index, bool clockwise)
|
||||
{
|
||||
if (!is_keyboard_master())
|
||||
return;
|
||||
|
@ -69,4 +69,5 @@ void encoder_update_user(uint8_t index, bool clockwise)
|
|||
else
|
||||
#endif // RGB_OLED_MENU
|
||||
tap_code16(pgm_read_word(&encoders[index][clockwise]));
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue