Convert Encoder callbacks to be boolean functions (#12805)
Co-authored-by: James Young <18669334+noroadsleft@users.noreply.github.com>master
parent
76c23b15ab
commit
a0fed0ea17
|
@ -53,15 +53,15 @@ If you are using different pinouts for the encoders on each half of a split keyb
|
||||||
The callback functions can be inserted into your `<keyboard>.c`:
|
The callback functions can be inserted into your `<keyboard>.c`:
|
||||||
|
|
||||||
```c
|
```c
|
||||||
void encoder_update_kb(uint8_t index, bool clockwise) {
|
bool encoder_update_kb(uint8_t index, bool clockwise) {
|
||||||
encoder_update_user(index, clockwise);
|
return encoder_update_user(index, clockwise);
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
or `keymap.c`:
|
or `keymap.c`:
|
||||||
|
|
||||||
```c
|
```c
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
if (index == 0) { /* First encoder */
|
if (index == 0) { /* First encoder */
|
||||||
if (clockwise) {
|
if (clockwise) {
|
||||||
tap_code(KC_PGDN);
|
tap_code(KC_PGDN);
|
||||||
|
@ -75,9 +75,12 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
tap_code(KC_UP);
|
tap_code(KC_UP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
!> If you return `true`, this will allow the keyboard level code to run, as well. Returning `false` will override the keyboard level code. Depending on how the keyboard level function is set up.
|
||||||
|
|
||||||
## Hardware
|
## Hardware
|
||||||
|
|
||||||
The A an B lines of the encoders should be wired directly to the MCU, and the C/common lines should be wired to ground.
|
The A an B lines of the encoders should be wired directly to the MCU, and the C/common lines should be wired to ground.
|
||||||
|
|
|
@ -50,7 +50,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
|
||||||
/* rotary encoder (SW3) - add more else if blocks for more granular layer control */
|
/* rotary encoder (SW3) - add more else if blocks for more granular layer control */
|
||||||
#ifdef ENCODER_ENABLE
|
#ifdef ENCODER_ENABLE
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
if (IS_LAYER_ON(_RGB)) {
|
if (IS_LAYER_ON(_RGB)) {
|
||||||
#ifdef RGBLIGHT_ENABLE
|
#ifdef RGBLIGHT_ENABLE
|
||||||
if (clockwise) {
|
if (clockwise) {
|
||||||
|
@ -72,6 +72,7 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
tap_code(KC_VOLD);
|
tap_code(KC_VOLD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
|
||||||
/* rotary encoder (SW3) - add more else if blocks for more granular layer control */
|
/* rotary encoder (SW3) - add more else if blocks for more granular layer control */
|
||||||
#ifdef ENCODER_ENABLE
|
#ifdef ENCODER_ENABLE
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
if (IS_LAYER_ON(_RGB)) {
|
if (IS_LAYER_ON(_RGB)) {
|
||||||
#ifdef RGBLIGHT_ENABLE
|
#ifdef RGBLIGHT_ENABLE
|
||||||
if (clockwise) {
|
if (clockwise) {
|
||||||
|
@ -72,6 +72,7 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
tap_code16(C(A(KC_DOWN)));
|
tap_code16(C(A(KC_DOWN)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
|
||||||
/* rotary encoder (SW3) - add more else if blocks for more granular layer control */
|
/* rotary encoder (SW3) - add more else if blocks for more granular layer control */
|
||||||
#ifdef ENCODER_ENABLE
|
#ifdef ENCODER_ENABLE
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
if (IS_LAYER_ON(_RGB)) {
|
if (IS_LAYER_ON(_RGB)) {
|
||||||
#ifdef RGBLIGHT_ENABLE
|
#ifdef RGBLIGHT_ENABLE
|
||||||
if (clockwise) {
|
if (clockwise) {
|
||||||
|
@ -72,6 +72,7 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
tap_code(KC_VOLD);
|
tap_code(KC_VOLD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ static void render_logo(void) {
|
||||||
void oled_task_user(void) { render_logo(); }
|
void oled_task_user(void) { render_logo(); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
if (index == 0) { /* First encoder */
|
if (index == 0) { /* First encoder */
|
||||||
if (clockwise) {
|
if (clockwise) {
|
||||||
tap_code(KC_PGDN);
|
tap_code(KC_PGDN);
|
||||||
|
@ -66,6 +66,7 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
tap_code(KC_PGUP);
|
tap_code(KC_PGUP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ static void render_logo(void) {
|
||||||
void oled_task_user(void) { render_logo(); }
|
void oled_task_user(void) { render_logo(); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
if (index == 0) { /* First encoder */
|
if (index == 0) { /* First encoder */
|
||||||
if (clockwise) {
|
if (clockwise) {
|
||||||
tap_code(KC_PGDN);
|
tap_code(KC_PGDN);
|
||||||
|
@ -66,6 +66,7 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
tap_code(KC_PGUP);
|
tap_code(KC_PGUP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
|
|
||||||
#ifdef ENCODER_ENABLE
|
#ifdef ENCODER_ENABLE
|
||||||
#include "encoder.h"
|
#include "encoder.h"
|
||||||
void encoder_update_user(int8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
if (index == 0) { /* First encoder */
|
if (index == 0) { /* First encoder */
|
||||||
if (clockwise) {
|
if (clockwise) {
|
||||||
tap_code(KC_VOLU);
|
tap_code(KC_VOLU);
|
||||||
|
@ -35,5 +35,6 @@ void encoder_update_user(int8_t index, bool clockwise) {
|
||||||
tap_code(KC_VOLD);
|
tap_code(KC_VOLD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include "encoder.h"
|
#include "encoder.h"
|
||||||
|
|
||||||
#ifdef ENCODER_ENABLED
|
#ifdef ENCODER_ENABLED
|
||||||
void encoder_update_kb(int8_t index, bool clockwise) {
|
bool encoder_update_kb(uint8_t index, bool clockwise) {
|
||||||
encoder_update_user(index, clockwise);
|
return encoder_update_user(index, clockwise);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -16,7 +16,7 @@ void matrix_init_user(void) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void encoder_update_user(int8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
if (clockwise) {
|
if (clockwise) {
|
||||||
tap_code(KC_PGUP);
|
tap_code(KC_PGUP);
|
||||||
|
@ -24,5 +24,5 @@ void encoder_update_user(int8_t index, bool clockwise) {
|
||||||
tap_code(KC_PGDN);
|
tap_code(KC_PGDN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ void matrix_init_user(void) {
|
||||||
debug_config.enable = 1;
|
debug_config.enable = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void encoder_update_user(int8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
if (clockwise) {
|
if (clockwise) {
|
||||||
tap_code16(C(KC_T));
|
tap_code16(C(KC_T));
|
||||||
|
@ -22,5 +22,5 @@ void encoder_update_user(int8_t index, bool clockwise) {
|
||||||
tap_code16(C(KC_W));
|
tap_code16(C(KC_W));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ void matrix_init_user(void) {
|
||||||
debug_config.enable = 1;
|
debug_config.enable = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void encoder_update_user(int8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
if (clockwise) {
|
if (clockwise) {
|
||||||
tap_code(KC_VOLU);
|
tap_code(KC_VOLU);
|
||||||
|
@ -22,4 +22,5 @@ void encoder_update_user(int8_t index, bool clockwise) {
|
||||||
tap_code(KC_VOLD);
|
tap_code(KC_VOLD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,7 +96,7 @@ layer_state_t layer_state_set_user(layer_state_t state) {
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
if (clockwise) {
|
if (clockwise) {
|
||||||
tap_code(KC_VOLU);
|
tap_code(KC_VOLU);
|
||||||
|
@ -104,4 +104,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
tap_code(KC_VOLD);
|
tap_code(KC_VOLD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,7 +96,7 @@ layer_state_t layer_state_set_user(layer_state_t state) {
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
if (clockwise) {
|
if (clockwise) {
|
||||||
tap_code(KC_VOLU);
|
tap_code(KC_VOLU);
|
||||||
|
@ -104,4 +104,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
tap_code(KC_VOLD);
|
tap_code(KC_VOLD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
switch (get_highest_layer(layer_state)) {
|
switch (get_highest_layer(layer_state)) {
|
||||||
case _BASE:
|
case _BASE:
|
||||||
|
@ -120,6 +120,7 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
|
|
|
@ -117,7 +117,7 @@ void matrix_scan_user(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
uint8_t layer = get_highest_layer(layer_state);
|
uint8_t layer = get_highest_layer(layer_state);
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
if (clockwise) {
|
if (clockwise) {
|
||||||
|
@ -126,4 +126,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
tap_code16(dynamic_keymap_get_keycode(layer, 10, 0));
|
tap_code16(dynamic_keymap_get_keycode(layer, 10, 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
|
@ -78,7 +78,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
uint8_t layer = get_highest_layer(layer_state);
|
uint8_t layer = get_highest_layer(layer_state);
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
if (clockwise) {
|
if (clockwise) {
|
||||||
|
@ -87,4 +87,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
tap_code16(dynamic_keymap_get_keycode(layer, 10, 0));
|
tap_code16(dynamic_keymap_get_keycode(layer, 10, 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,7 +132,7 @@ void matrix_init_user(void) {
|
||||||
set_unicode_input_mode(UC_WINC);
|
set_unicode_input_mode(UC_WINC);
|
||||||
}
|
}
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
|
|
||||||
switch(get_highest_layer(layer_state)) {
|
switch(get_highest_layer(layer_state)) {
|
||||||
case _BASE:
|
case _BASE:
|
||||||
|
@ -145,4 +145,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
clockwise ? tap_code(KC_MEDIA_NEXT_TRACK) : tap_code(KC_MEDIA_PREV_TRACK);
|
clockwise ? tap_code(KC_MEDIA_NEXT_TRACK) : tap_code(KC_MEDIA_PREV_TRACK);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, KC_TRNS)
|
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, KC_TRNS)
|
||||||
};
|
};
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
if (index == 0) { /* First encoder */
|
if (index == 0) { /* First encoder */
|
||||||
if (clockwise) {
|
if (clockwise) {
|
||||||
tap_code(KC_VOLU);
|
tap_code(KC_VOLU);
|
||||||
|
@ -39,4 +39,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
tap_code(KC_VOLD);
|
tap_code(KC_VOLD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
if (index == 0) { /* First encoder */
|
if (index == 0) { /* First encoder */
|
||||||
if (clockwise) {
|
if (clockwise) {
|
||||||
tap_code(KC_VOLU);
|
tap_code(KC_VOLU);
|
||||||
|
@ -63,4 +63,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
backlight_decrease();
|
backlight_decrease();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
|
@ -43,7 +43,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
if (index == 0) { /* First encoder */
|
if (index == 0) { /* First encoder */
|
||||||
if (clockwise) {
|
if (clockwise) {
|
||||||
tap_code(KC_O);
|
tap_code(KC_O);
|
||||||
|
@ -63,4 +63,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
tap_code(KC_R);
|
tap_code(KC_R);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
|
@ -308,7 +308,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
|
|
||||||
#ifdef ENCODER_ENABLE
|
#ifdef ENCODER_ENABLE
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
if (clockwise) {
|
if (clockwise) {
|
||||||
tap_code(KC_VOLU);
|
tap_code(KC_VOLU);
|
||||||
|
@ -322,6 +322,7 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
rgblight_step_reverse();
|
rgblight_step_reverse();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -311,7 +311,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
|
|
||||||
#ifdef ENCODER_ENABLE
|
#ifdef ENCODER_ENABLE
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
if (clockwise) {
|
if (clockwise) {
|
||||||
tap_code(KC_VOLU);
|
tap_code(KC_VOLU);
|
||||||
|
@ -325,6 +325,7 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
rgblight_step_reverse();
|
rgblight_step_reverse();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -16,7 +16,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
#ifdef ENCODER_ENABLE
|
#ifdef ENCODER_ENABLE
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
if (clockwise) {
|
if (clockwise) {
|
||||||
tap_code(KC_VOLU);
|
tap_code(KC_VOLU);
|
||||||
|
@ -30,6 +30,7 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
tap_code(KC_PGUP);
|
tap_code(KC_PGUP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -105,7 +105,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
if (index == 0) { /* Left encoder */
|
if (index == 0) { /* Left encoder */
|
||||||
switch (get_highest_layer(layer_state)) {
|
switch (get_highest_layer(layer_state)) {
|
||||||
case _QWERTY:
|
case _QWERTY:
|
||||||
|
@ -146,4 +146,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
tap_code(KC_PGUP);
|
tap_code(KC_PGUP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,7 +105,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
if (index == 0) { /* Left encoder */
|
if (index == 0) { /* Left encoder */
|
||||||
switch (get_highest_layer(layer_state)) {
|
switch (get_highest_layer(layer_state)) {
|
||||||
case _QWERTY:
|
case _QWERTY:
|
||||||
|
@ -146,4 +146,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
tap_code(KC_PGUP);
|
tap_code(KC_PGUP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
|
@ -118,7 +118,7 @@ void oled_task_user(void) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
switch (get_highest_layer(layer_state)) {
|
switch (get_highest_layer(layer_state)) {
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -143,4 +143,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
#include QMK_KEYBOARD_H
|
#include QMK_KEYBOARD_H
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
if (index == 0) { /* First encoder */
|
if (index == 0) { /* First encoder */
|
||||||
if (clockwise) {
|
if (clockwise) {
|
||||||
tap_code(KC_MS_WH_UP);
|
tap_code(KC_MS_WH_UP);
|
||||||
|
@ -25,6 +25,7 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
tap_code(KC_MS_WH_DOWN);
|
tap_code(KC_MS_WH_DOWN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
#include QMK_KEYBOARD_H
|
#include QMK_KEYBOARD_H
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
if (index == 0) { /* First encoder */
|
if (index == 0) { /* First encoder */
|
||||||
if (clockwise) {
|
if (clockwise) {
|
||||||
tap_code(KC_MS_WH_UP);
|
tap_code(KC_MS_WH_UP);
|
||||||
|
@ -25,6 +25,7 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
tap_code(KC_MS_WH_DOWN);
|
tap_code(KC_MS_WH_DOWN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -48,7 +48,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
if (index == 0) { /* First encoder */
|
if (index == 0) { /* First encoder */
|
||||||
if (clockwise) {
|
if (clockwise) {
|
||||||
tap_code(KC_VOLU);
|
tap_code(KC_VOLU);
|
||||||
|
@ -68,4 +68,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
tap_code(KC_LEFT);
|
tap_code(KC_LEFT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
if (index == 0) { /* First encoder */
|
if (index == 0) { /* First encoder */
|
||||||
if (clockwise) {
|
if (clockwise) {
|
||||||
tap_code(KC_VOLU);
|
tap_code(KC_VOLU);
|
||||||
|
@ -68,4 +68,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
rgblight_step_reverse();
|
rgblight_step_reverse();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
if (clockwise) {
|
if (clockwise) {
|
||||||
tap_code(KC_VOLU);
|
tap_code(KC_VOLU);
|
||||||
|
@ -49,4 +49,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
tap_code(KC_VOLD);
|
tap_code(KC_VOLD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,11 +42,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
if (clockwise) {
|
if (clockwise) {
|
||||||
tap_code(KC_VOLU);
|
tap_code(KC_VOLU);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
tap_code(KC_VOLD);
|
tap_code(KC_VOLD);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,7 +109,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
|
||||||
uint8_t go_to_layer = 0; /* Used for the layer changing code for the encoder below */
|
uint8_t go_to_layer = 0; /* Used for the layer changing code for the encoder below */
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
if (matrix_is_on(6, 10)) { /* Use the knob to change layers when holding down Menu key. Unfortunately using layers to initiate this behavior is not possible. */
|
if (matrix_is_on(6, 10)) { /* Use the knob to change layers when holding down Menu key. Unfortunately using layers to initiate this behavior is not possible. */
|
||||||
if (clockwise) {
|
if (clockwise) {
|
||||||
|
|
||||||
|
@ -151,6 +151,7 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
tap_code(KC_VOLD);
|
tap_code(KC_VOLD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Default layer is white.*/
|
/*Default layer is white.*/
|
||||||
|
@ -220,4 +221,3 @@ bool led_update_user(led_t led_state) {
|
||||||
rgblight_set_layer_state(0, true);
|
rgblight_set_layer_state(0, true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -182,9 +182,10 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
|
||||||
return process_record_user(keycode, record);
|
return process_record_user(keycode, record);
|
||||||
}
|
}
|
||||||
|
|
||||||
void encoder_update_kb(uint8_t index, bool clockwise) {
|
bool encoder_update_kb(uint8_t index, bool clockwise) {
|
||||||
encoder_value = (encoder_value + (clockwise ? 1 : -1)) % 64;
|
encoder_value = (encoder_value + (clockwise ? 1 : -1)) % 64;
|
||||||
queue_for_send = true;
|
queue_for_send = true;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -11,7 +11,8 @@ uint32_t layer_state_set_kb(uint32_t state) {
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
void encoder_update_kb(uint8_t index, bool clockwise) {
|
bool encoder_update_kb(uint8_t index, bool clockwise) {
|
||||||
|
if (!encoder_update_user(index, clockwise)) return false;
|
||||||
uint16_t mapped_code = 0;
|
uint16_t mapped_code = 0;
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
if (clockwise) {
|
if (clockwise) {
|
||||||
|
@ -46,4 +47,5 @@ void encoder_update_kb(uint8_t index, bool clockwise) {
|
||||||
while (timer_elapsed(held_keycode_timer) < MEDIA_KEY_DELAY){ /* no-op */ }
|
while (timer_elapsed(held_keycode_timer) < MEDIA_KEY_DELAY){ /* no-op */ }
|
||||||
unregister_code(mapped_code);
|
unregister_code(mapped_code);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -300,7 +300,8 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void encoder_update_kb(uint8_t index, bool clockwise) {
|
bool encoder_update_kb(uint8_t index, bool clockwise) {
|
||||||
|
if (!encoder_update_user(index, clockwise)) return false;
|
||||||
encoder_value = (encoder_value + (clockwise ? 1 : -1)) % 64;
|
encoder_value = (encoder_value + (clockwise ? 1 : -1)) % 64;
|
||||||
queue_for_send = true;
|
queue_for_send = true;
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
|
@ -325,6 +326,7 @@ void encoder_update_kb(uint8_t index, bool clockwise) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void custom_config_reset(void){
|
void custom_config_reset(void){
|
||||||
|
|
|
@ -112,7 +112,7 @@ void oled_task_user(void) {
|
||||||
|
|
||||||
void led_set_user(uint8_t usb_led) {}
|
void led_set_user(uint8_t usb_led) {}
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
oled_on();
|
oled_on();
|
||||||
if (index == 0) { /* left encoder */
|
if (index == 0) { /* left encoder */
|
||||||
switch (layer_state) {
|
switch (layer_state) {
|
||||||
|
@ -171,4 +171,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
tap_code(KC_UP);
|
tap_code(KC_UP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
#include "ck60i.h"
|
#include "ck60i.h"
|
||||||
|
|
||||||
__attribute__((weak)) void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_kb(uint8_t index, bool clockwise) {
|
||||||
|
if (!encoder_update_user(index, clockwise)) return false;
|
||||||
if (index == 0) { /* First encoder */
|
if (index == 0) { /* First encoder */
|
||||||
if (clockwise) {
|
if (clockwise) {
|
||||||
tap_code(KC_VOLU);
|
tap_code(KC_VOLU);
|
||||||
|
@ -25,4 +26,5 @@ __attribute__((weak)) void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
tap_code(KC_VOLD);
|
tap_code(KC_VOLD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -144,7 +144,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
if (index == 0) { /* First encoder */
|
if (index == 0) { /* First encoder */
|
||||||
if (clockwise) {
|
if (clockwise) {
|
||||||
tap_code(KC_PGDN);
|
tap_code(KC_PGDN);
|
||||||
|
@ -152,4 +152,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
tap_code(KC_PGUP);
|
tap_code(KC_PGUP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ You can find the default layout in `thedora/keymaps/default/keymap.c`
|
||||||
This is the bit of code at the end of `keymap.c` that needs to changed if you want to change the behavior of the rotary encoder.
|
This is the bit of code at the end of `keymap.c` that needs to changed if you want to change the behavior of the rotary encoder.
|
||||||
|
|
||||||
```
|
```
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
if (index == 0) { /* First encoder */
|
if (index == 0) { /* First encoder */
|
||||||
if (clockwise) {
|
if (clockwise) {
|
||||||
tap_code(KC_PGDN); // What the rotary encoder repeatedly does when turned right.
|
tap_code(KC_PGDN); // What the rotary encoder repeatedly does when turned right.
|
||||||
|
@ -59,6 +59,7 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
tap_code(KC_PGUP); // What it does when turned to the left.
|
tap_code(KC_PGUP); // What it does when turned to the left.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
switch (biton32(layer_state)) {
|
switch (biton32(layer_state)) {
|
||||||
case _BASE:
|
case _BASE:
|
||||||
if (clockwise) {
|
if (clockwise) {
|
||||||
|
@ -55,6 +55,7 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
tap_code(KC_MPRV);
|
tap_code(KC_MPRV);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef OLED_DRIVER_ENABLE
|
#ifdef OLED_DRIVER_ENABLE
|
||||||
|
|
|
@ -144,13 +144,11 @@ bool led_update_kb(led_t led_state) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
__attribute__ ((weak))
|
__attribute__((weak)) bool encoder_update_keymap(uint8_t index, bool clockwise) { return true; }
|
||||||
bool encoder_update_keymap(int8_t index, bool clockwise) {
|
__attribute__((weak)) bool encoder_update_user(uint8_t index, bool clockwise) { return encoder_update_keymap(index, clockwise); }
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void encoder_update_kb(int8_t index, bool clockwise) {
|
bool encoder_update_kb(uint8_t index, bool clockwise) {
|
||||||
if (!encoder_update_keymap(index, clockwise)) {
|
if (!encoder_update_user(index, clockwise)) {
|
||||||
// Encoder 1, outside left
|
// Encoder 1, outside left
|
||||||
if (index == 0 && clockwise) {
|
if (index == 0 && clockwise) {
|
||||||
tap_code(KC_MS_U); // turned right
|
tap_code(KC_MS_U); // turned right
|
||||||
|
@ -179,4 +177,5 @@ void encoder_update_kb(int8_t index, bool clockwise) {
|
||||||
tap_code(KC_MS_L); // turned left
|
tap_code(KC_MS_L); // turned left
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,8 +29,7 @@ enum TWOx1800_keycodes {
|
||||||
#define SAFE_RANGE NEW_SAFE_RANGE
|
#define SAFE_RANGE NEW_SAFE_RANGE
|
||||||
|
|
||||||
// Encoder update function that returns true/false
|
// Encoder update function that returns true/false
|
||||||
__attribute__ ((weak))
|
bool encoder_update_keymap(uint8_t index, bool clockwise);
|
||||||
bool encoder_update_keymap(int8_t index, bool clockwise);
|
|
||||||
|
|
||||||
// Encoder button combo check
|
// Encoder button combo check
|
||||||
void check_encoder_buttons(void);
|
void check_encoder_buttons(void);
|
||||||
|
|
|
@ -15,10 +15,12 @@
|
||||||
*/
|
*/
|
||||||
#include "crbn.h"
|
#include "crbn.h"
|
||||||
/* Encoder setting. only one encoder despite 4 possible spots */
|
/* Encoder setting. only one encoder despite 4 possible spots */
|
||||||
__attribute__((weak)) void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_kb(uint8_t index, bool clockwise) {
|
||||||
|
if (!encoder_update_user(index, clockwise)) return false;
|
||||||
if (clockwise) {
|
if (clockwise) {
|
||||||
tap_code(KC_VOLU);
|
tap_code(KC_VOLU);
|
||||||
} else {
|
} else {
|
||||||
tap_code(KC_VOLD);
|
tap_code(KC_VOLD);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,8 @@
|
||||||
|
|
||||||
#include "genesis.h"
|
#include "genesis.h"
|
||||||
|
|
||||||
__attribute__((weak)) void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_kb(uint8_t index, bool clockwise) {
|
||||||
|
if (!encoder_update_user(index, clockwise)) return false;
|
||||||
/* top left encoder */
|
/* top left encoder */
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
if (clockwise) {
|
if (clockwise) {
|
||||||
|
@ -33,4 +34,5 @@ __attribute__((weak)) void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
tap_code(KC_VOLD);
|
tap_code(KC_VOLD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
|
@ -106,7 +106,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
/* With an if statement we can check which encoder was turned. */
|
/* With an if statement we can check which encoder was turned. */
|
||||||
if (index == 0) { /* First encoder */
|
if (index == 0) { /* First encoder */
|
||||||
/* And with another if statement we can check the direction. */
|
/* And with another if statement we can check the direction. */
|
||||||
|
@ -131,4 +131,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
tap_code(KC_LEFT);
|
tap_code(KC_LEFT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,7 +106,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
/* With an if statement we can check which encoder was turned. */
|
/* With an if statement we can check which encoder was turned. */
|
||||||
if (index == 0) { /* First encoder */
|
if (index == 0) { /* First encoder */
|
||||||
/* And with another if statement we can check the direction. */
|
/* And with another if statement we can check the direction. */
|
||||||
|
@ -131,4 +131,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
tap_code(KC_LEFT);
|
tap_code(KC_LEFT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,7 +126,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
/* With an if statement we can check which encoder was turned. */
|
/* With an if statement we can check which encoder was turned. */
|
||||||
if (index == 0) { /* First encoder */
|
if (index == 0) { /* First encoder */
|
||||||
/* And with another if statement we can check the direction. */
|
/* And with another if statement we can check the direction. */
|
||||||
|
@ -151,4 +151,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
tap_code(KC_LEFT);
|
tap_code(KC_LEFT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,7 +107,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
/* With an if statement we can check which encoder was turned. */
|
/* With an if statement we can check which encoder was turned. */
|
||||||
if (index == 0) { /* First encoder */
|
if (index == 0) { /* First encoder */
|
||||||
/* And with another if statement we can check the direction. */
|
/* And with another if statement we can check the direction. */
|
||||||
|
@ -132,4 +132,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
tap_code(KC_LEFT);
|
tap_code(KC_LEFT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,7 +117,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
/* With an if statement we can check which encoder was turned. */
|
/* With an if statement we can check which encoder was turned. */
|
||||||
if (index == 0) { /* First encoder */
|
if (index == 0) { /* First encoder */
|
||||||
/* And with another if statement we can check the direction. */
|
/* And with another if statement we can check the direction. */
|
||||||
|
@ -158,4 +158,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,7 +104,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
/* With an if statement we can check which encoder was turned. */
|
/* With an if statement we can check which encoder was turned. */
|
||||||
if (index == 0) { /* First encoder */
|
if (index == 0) { /* First encoder */
|
||||||
/* And with another if statement we can check the direction. */
|
/* And with another if statement we can check the direction. */
|
||||||
|
@ -145,4 +145,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
switch(index) {
|
switch(index) {
|
||||||
case 0:
|
case 0:
|
||||||
if (clockwise) {
|
if (clockwise) {
|
||||||
|
@ -48,4 +48,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
if (index == 0) { /* First encoder */
|
if (index == 0) { /* First encoder */
|
||||||
if (clockwise) {
|
if (clockwise) {
|
||||||
rgblight_increase_hue(); //Cycle through the RGB hue
|
rgblight_increase_hue(); //Cycle through the RGB hue
|
||||||
|
@ -44,4 +44,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
rgblight_decrease_val();
|
rgblight_decrease_val();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
if (index == 0) { /* First encoder */
|
if (index == 0) { /* First encoder */
|
||||||
switch (currentLayer) { //break each encoder update into a switch statement for the current layer
|
switch (currentLayer) { //break each encoder update into a switch statement for the current layer
|
||||||
case _BL:
|
case _BL:
|
||||||
|
@ -124,6 +124,7 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
layer_state_t layer_state_set_user(layer_state_t state) { //This will run every time the layer is updated
|
layer_state_t layer_state_set_user(layer_state_t state) { //This will run every time the layer is updated
|
||||||
|
|
|
@ -61,7 +61,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
if (index == 0) { /* First encoder */
|
if (index == 0) { /* First encoder */
|
||||||
switch (get_highest_layer(layer_state)) { //break each encoder update into a switch statement for the current layer
|
switch (get_highest_layer(layer_state)) { //break each encoder update into a switch statement for the current layer
|
||||||
case _NUMPAD:
|
case _NUMPAD:
|
||||||
|
@ -135,6 +135,7 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
layer_state_t layer_state_set_user(layer_state_t state) { //This will run every time the layer is updated
|
layer_state_t layer_state_set_user(layer_state_t state) { //This will run every time the layer is updated
|
||||||
|
|
|
@ -200,7 +200,7 @@ void post_process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
switch (get_highest_layer(layer_state)) {
|
switch (get_highest_layer(layer_state)) {
|
||||||
case _RGB:
|
case _RGB:
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
|
@ -234,4 +234,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
if (index == 0) { /* First encoder */
|
if (index == 0) { /* First encoder */
|
||||||
if (clockwise) {
|
if (clockwise) {
|
||||||
rgblight_increase_hue(); //Cycle through the RGB hue
|
rgblight_increase_hue(); //Cycle through the RGB hue
|
||||||
|
@ -65,4 +65,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
rgblight_decrease_val();
|
rgblight_decrease_val();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
|
@ -38,7 +38,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
TG(2), RESET, KC_TRNS, KC_TRNS, KC_TRNS),
|
TG(2), RESET, KC_TRNS, KC_TRNS, KC_TRNS),
|
||||||
};
|
};
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
if (index == 0) { /* First encoder */
|
if (index == 0) { /* First encoder */
|
||||||
if (clockwise) {
|
if (clockwise) {
|
||||||
tap_code(KC_VOLU);
|
tap_code(KC_VOLU);
|
||||||
|
@ -46,6 +46,7 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
tap_code(KC_VOLD);
|
tap_code(KC_VOLD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
TG(2), RESET, KC_TRNS, KC_TRNS, KC_TRNS),
|
TG(2), RESET, KC_TRNS, KC_TRNS, KC_TRNS),
|
||||||
};
|
};
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
if (index == 0) { /* First encoder */
|
if (index == 0) { /* First encoder */
|
||||||
if (clockwise) {
|
if (clockwise) {
|
||||||
tap_code(KC_VOLU);
|
tap_code(KC_VOLU);
|
||||||
|
@ -46,6 +46,7 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
tap_code(KC_VOLD);
|
tap_code(KC_VOLD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
|
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
|
||||||
};
|
};
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
if (index == 0) { /* First encoder */
|
if (index == 0) { /* First encoder */
|
||||||
if (clockwise) {
|
if (clockwise) {
|
||||||
tap_code(KC_VOLU);
|
tap_code(KC_VOLU);
|
||||||
|
@ -53,6 +53,7 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
tap_code(KC_VOLD);
|
tap_code(KC_VOLD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -195,7 +195,7 @@ void oled_task_user(void) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENCODER_ENABLE
|
#ifdef ENCODER_ENABLE
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
// Volume control
|
// Volume control
|
||||||
if (clockwise) {
|
if (clockwise) {
|
||||||
|
@ -220,6 +220,6 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
tap_code(KC_WH_D);
|
tap_code(KC_WH_D);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -295,7 +295,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#ifdef ENCODER_ENABLE
|
#ifdef ENCODER_ENABLE
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
// Volume control
|
// Volume control
|
||||||
if (clockwise) {
|
if (clockwise) {
|
||||||
|
@ -319,5 +319,6 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
}
|
}
|
||||||
// I only have 2 encoders on the the pimoroni example board, just add else ifs for your other encoders...
|
// I only have 2 encoders on the the pimoroni example board, just add else ifs for your other encoders...
|
||||||
// the missing ones are encoder 1 on the right side and encoder 3 on the left side
|
// the missing ones are encoder 1 on the right side and encoder 3 on the left side
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -33,7 +33,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
if (clockwise) {
|
if (clockwise) {
|
||||||
tap_code(KC_VOLD);
|
tap_code(KC_VOLD);
|
||||||
|
@ -48,4 +48,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
tap_code(KC_PGDN);
|
tap_code(KC_PGDN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -189,7 +189,7 @@ void oled_task_user(void) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENCODER_ENABLE
|
#ifdef ENCODER_ENABLE
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
// master side thumb encoder
|
// master side thumb encoder
|
||||||
// Volume control
|
// Volume control
|
||||||
|
@ -226,5 +226,6 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
tap_code(KC_HOME);
|
tap_code(KC_HOME);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -387,7 +387,7 @@ void oled_task_user(void) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENCODER_ENABLE
|
#ifdef ENCODER_ENABLE
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
// master side thumb encoder
|
// master side thumb encoder
|
||||||
// Volume control
|
// Volume control
|
||||||
|
@ -424,5 +424,6 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
tap_code(KC_HOME);
|
tap_code(KC_HOME);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -72,7 +72,7 @@ void keyboard_post_init_user(void) {
|
||||||
//debug_mouse = true;
|
//debug_mouse = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
/* Custom encoder control - handles CW/CCW turning of encoder
|
/* Custom encoder control - handles CW/CCW turning of encoder
|
||||||
* Default behavior:
|
* Default behavior:
|
||||||
* main layer:
|
* main layer:
|
||||||
|
@ -103,4 +103,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {__KEYMAP_GOES_HERE__};
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {__KEYMAP_GOES_HERE__};
|
||||||
|
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
switch (get_highest_layer(layer_state)) {
|
switch (get_highest_layer(layer_state)) {
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -22,4 +22,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,7 @@ void keyboard_post_init_user(void) {
|
||||||
// debug_mouse = true;
|
// debug_mouse = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
/* Custom encoder control - handles CW/CCW turning of encoder
|
/* Custom encoder control - handles CW/CCW turning of encoder
|
||||||
* Default behavior:
|
* Default behavior:
|
||||||
* left encoder:
|
* left encoder:
|
||||||
|
@ -131,4 +131,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {__KEYMAP_GOES_HERE__};
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {__KEYMAP_GOES_HERE__};
|
||||||
|
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
switch (get_highest_layer(layer_state)) {
|
switch (get_highest_layer(layer_state)) {
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -40,4 +40,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,7 @@ void keyboard_post_init_user(void) {
|
||||||
// debug_mouse = true;
|
// debug_mouse = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
/* Custom encoder control - handles CW/CCW turning of encoder
|
/* Custom encoder control - handles CW/CCW turning of encoder
|
||||||
* Default behavior:
|
* Default behavior:
|
||||||
* main layer:
|
* main layer:
|
||||||
|
@ -103,4 +103,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {__KEYMAP_GOES_HERE__};
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {__KEYMAP_GOES_HERE__};
|
||||||
|
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
switch (get_highest_layer(layer_state)) {
|
switch (get_highest_layer(layer_state)) {
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -22,4 +22,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,7 @@ void keyboard_post_init_user(void) {
|
||||||
//debug_mouse = true;
|
//debug_mouse = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
/* Custom encoder control - handles CW/CCW turning of encoder
|
/* Custom encoder control - handles CW/CCW turning of encoder
|
||||||
* Default behavior:
|
* Default behavior:
|
||||||
* main layer:
|
* main layer:
|
||||||
|
@ -103,4 +103,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {__KEYMAP_GOES_HERE__};
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {__KEYMAP_GOES_HERE__};
|
||||||
|
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
switch (get_highest_layer(layer_state)) {
|
switch (get_highest_layer(layer_state)) {
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -22,4 +22,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,7 @@ void keyboard_post_init_user(void) {
|
||||||
// debug_mouse = true;
|
// debug_mouse = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
/* Custom encoder control - handles CW/CCW turning of encoder
|
/* Custom encoder control - handles CW/CCW turning of encoder
|
||||||
* Default behavior:
|
* Default behavior:
|
||||||
* left encoder:
|
* left encoder:
|
||||||
|
@ -131,4 +131,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {__KEYMAP_GOES_HERE__};
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {__KEYMAP_GOES_HERE__};
|
||||||
|
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
switch (get_highest_layer(layer_state)) {
|
switch (get_highest_layer(layer_state)) {
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -40,4 +40,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,7 @@ void keyboard_post_init_user(void) {
|
||||||
// debug_mouse = true;
|
// debug_mouse = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
/* Custom encoder control - handles CW/CCW turning of encoder
|
/* Custom encoder control - handles CW/CCW turning of encoder
|
||||||
* Default behavior:
|
* Default behavior:
|
||||||
* main layer:
|
* main layer:
|
||||||
|
@ -103,4 +103,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {__KEYMAP_GOES_HERE__};
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {__KEYMAP_GOES_HERE__};
|
||||||
|
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
switch (get_highest_layer(layer_state)) {
|
switch (get_highest_layer(layer_state)) {
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -22,4 +22,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,8 @@
|
||||||
|
|
||||||
|
|
||||||
// Rotary encoder functions:
|
// Rotary encoder functions:
|
||||||
__attribute__((weak)) void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_kb(uint8_t index, bool clockwise) {
|
||||||
|
if (!encoder_update_user(index, clockwise)) return false;
|
||||||
uint16_t mapped_code = 0;
|
uint16_t mapped_code = 0;
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
if (clockwise) {
|
if (clockwise) {
|
||||||
|
@ -49,6 +50,7 @@ __attribute__((weak)) void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
}
|
}
|
||||||
tap_code(mapped_code);
|
tap_code(mapped_code);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void keyboard_pre_init_kb(void) {
|
void keyboard_pre_init_kb(void) {
|
||||||
|
@ -63,4 +65,3 @@ bool led_update_kb(led_t led_state) {
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Encoder */
|
/* Encoder */
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
/* The first if reads the first encoder, not needed on this board which only features a single one */
|
/* The first if reads the first encoder, not needed on this board which only features a single one */
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
/* The switch case allows for different encoder mappings on different layers, "default" map gets applied for all unspecified layers */
|
/* The switch case allows for different encoder mappings on different layers, "default" map gets applied for all unspecified layers */
|
||||||
|
@ -71,4 +71,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Encoder */
|
/* Encoder */
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
/* The first if reads the first encoder, not needed on this board which only features a single one */
|
/* The first if reads the first encoder, not needed on this board which only features a single one */
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
/* The switch case allows for different encoder mappings on different layers, "default" map gets applied for all unspecified layers */
|
/* The switch case allows for different encoder mappings on different layers, "default" map gets applied for all unspecified layers */
|
||||||
|
@ -79,4 +79,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
if (index == 0) { /* left encoder */
|
if (index == 0) { /* left encoder */
|
||||||
if (clockwise) {
|
if (clockwise) {
|
||||||
tap_code(KC_WH_U);
|
tap_code(KC_WH_U);
|
||||||
|
@ -74,6 +74,7 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
tap_code(KC_VOLD);
|
tap_code(KC_VOLD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef COMBO_ENABLE
|
#ifdef COMBO_ENABLE
|
||||||
|
@ -91,4 +92,3 @@ combo_t key_combos[COMBO_COUNT] = {
|
||||||
[COMBO_DEL] = COMBO(combo_del,KC_DEL)
|
[COMBO_DEL] = COMBO(combo_del,KC_DEL)
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
#include "evolv.h"
|
#include "evolv.h"
|
||||||
|
|
||||||
__attribute__((weak)) void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_kb(uint8_t index, bool clockwise) {
|
||||||
|
if (!encoder_update_user(index, clockwise)) return false;
|
||||||
if (index == 0) { /* First encoder */
|
if (index == 0) { /* First encoder */
|
||||||
if (clockwise) {
|
if (clockwise) {
|
||||||
tap_code(KC_VOLU);
|
tap_code(KC_VOLU);
|
||||||
|
@ -25,4 +26,5 @@ __attribute__((weak)) void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
tap_code(KC_VOLD);
|
tap_code(KC_VOLD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
switch(get_highest_layer(layer_state)){
|
switch(get_highest_layer(layer_state)){
|
||||||
case 1: //Layer 1
|
case 1: //Layer 1
|
||||||
if (!clockwise) { // Remove ! to reverse direction
|
if (!clockwise) { // Remove ! to reverse direction
|
||||||
|
@ -35,4 +35,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
_______, _______, _______, _______, _______, _______, _______, _______),
|
_______, _______, _______, _______, _______, _______, _______, _______),
|
||||||
};
|
};
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
if (index == 0) { /* First encoder */
|
if (index == 0) { /* First encoder */
|
||||||
if (clockwise) {
|
if (clockwise) {
|
||||||
tap_code(KC_PGDN);
|
tap_code(KC_PGDN);
|
||||||
|
@ -58,4 +58,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
tap_code(KC_UP);
|
tap_code(KC_UP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
|
@ -44,7 +44,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
_______, _______, _______, _______, _______, _______, _______, _______),
|
_______, _______, _______, _______, _______, _______, _______, _______),
|
||||||
};
|
};
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
if (index == 0) { /* First encoder */
|
if (index == 0) { /* First encoder */
|
||||||
if (clockwise) {
|
if (clockwise) {
|
||||||
tap_code(KC_PGDN);
|
tap_code(KC_PGDN);
|
||||||
|
@ -58,4 +58,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
tap_code(KC_UP);
|
tap_code(KC_UP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
|
@ -71,10 +71,11 @@ layer_state_t layer_state_set_user(layer_state_t state) {
|
||||||
return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
|
return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
|
||||||
}
|
}
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
if (clockwise) {
|
if (clockwise) {
|
||||||
tap_code(KC_VOLD);
|
tap_code(KC_VOLD);
|
||||||
} else {
|
} else {
|
||||||
tap_code(KC_VOLU);
|
tap_code(KC_VOLU);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,10 +55,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
if (clockwise) {
|
if (clockwise) {
|
||||||
tap_code(KC_VOLU);
|
tap_code(KC_VOLU);
|
||||||
} else {
|
} else {
|
||||||
tap_code(KC_VOLD);
|
tap_code(KC_VOLD);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,10 +65,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
if (clockwise) {
|
if (clockwise) {
|
||||||
tap_code(KC_VOLU);
|
tap_code(KC_VOLU);
|
||||||
} else {
|
} else {
|
||||||
tap_code(KC_VOLD);
|
tap_code(KC_VOLD);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,10 +47,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
if (clockwise) {
|
if (clockwise) {
|
||||||
tap_code(KC_MS_WH_RIGHT);
|
tap_code(KC_MS_WH_RIGHT);
|
||||||
} else {
|
} else {
|
||||||
tap_code(KC_MS_WH_LEFT);
|
tap_code(KC_MS_WH_LEFT);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +1,17 @@
|
||||||
#ifndef HADRON_H
|
#ifndef HADRON_H
|
||||||
#define HADRON_H
|
#define HADRON_H
|
||||||
|
|
||||||
#ifdef SUBPROJECT_ver0
|
#include "quantum.h"
|
||||||
|
|
||||||
|
#ifdef KEYBOARD_hadron_ver0
|
||||||
#include "ver0.h"
|
#include "ver0.h"
|
||||||
#endif
|
#endif
|
||||||
#ifdef SUBPROJECT_ver2
|
#ifdef KEYBOARD_hadron_ver2
|
||||||
#include "ver2.h"
|
#include "ver2.h"
|
||||||
#endif
|
#endif
|
||||||
#ifdef SUBPROJECT_ver3
|
#ifdef KEYBOARD_hadron_ver3
|
||||||
#include "ver3.h"
|
#include "ver3.h"
|
||||||
#endif
|
#endif
|
||||||
#include "quantum.h"
|
|
||||||
|
|
||||||
|
|
||||||
#define LAYOUT( \
|
#define LAYOUT( \
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include "action_layer.h"
|
#include "action_layer.h"
|
||||||
#include "haptic.h"
|
#include "haptic.h"
|
||||||
|
|
||||||
|
|
||||||
#ifdef RGB_MATRIX_ENABLE
|
#ifdef RGB_MATRIX_ENABLE
|
||||||
#include "rgb_matrix.h"
|
#include "rgb_matrix.h"
|
||||||
|
|
||||||
|
@ -181,9 +182,13 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
|
||||||
return process_record_user(keycode, record);
|
return process_record_user(keycode, record);
|
||||||
}
|
}
|
||||||
|
|
||||||
void encoder_update_kb(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise);
|
||||||
|
|
||||||
|
bool encoder_update_kb(uint8_t index, bool clockwise) {
|
||||||
|
if (!encoder_update_user(index, clockwise)) return false;
|
||||||
encoder_value = (encoder_value + (clockwise ? 1 : -1)) % 64;
|
encoder_value = (encoder_value + (clockwise ? 1 : -1)) % 64;
|
||||||
queue_for_send = true;
|
queue_for_send = true;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -37,11 +37,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef ENCODER_ENABLE
|
#ifdef ENCODER_ENABLE
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
if (index != 0)
|
if (index != 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
tap_code(clockwise ? KC_VOLU : KC_VOLD);
|
tap_code(clockwise ? KC_VOLU : KC_VOLD);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
|
||||||
#ifdef ENCODER_ENABLE
|
#ifdef ENCODER_ENABLE
|
||||||
#include "encoder.h"
|
#include "encoder.h"
|
||||||
void encoder_update_user(int8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
if (index == 0) { /* First encoder */
|
if (index == 0) { /* First encoder */
|
||||||
if (clockwise) {
|
if (clockwise) {
|
||||||
tap_code(KC_VOLU);
|
tap_code(KC_VOLU);
|
||||||
|
@ -37,5 +37,6 @@ void encoder_update_user(int8_t index, bool clockwise) {
|
||||||
tap_code(KC_VOLD);
|
tap_code(KC_VOLD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -39,7 +39,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
if (index == _ENCODER) {
|
if (index == _ENCODER) {
|
||||||
if (clockwise) {
|
if (clockwise) {
|
||||||
tap_code(KC_VOLU);
|
tap_code(KC_VOLU);
|
||||||
|
@ -47,4 +47,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
tap_code(KC_VOLD);
|
tap_code(KC_VOLD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
if (index == _ENCODER) {
|
if (index == _ENCODER) {
|
||||||
if (clockwise) {
|
if (clockwise) {
|
||||||
tap_code(KC_VOLU);
|
tap_code(KC_VOLU);
|
||||||
|
@ -49,6 +49,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
tap_code(KC_VOLD);
|
tap_code(KC_VOLD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -229,7 +229,7 @@ layer_state_t layer_state_set_user(layer_state_t state) {
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
if (!alpha_pressed) {
|
if (!alpha_pressed) {
|
||||||
tap_code(clockwise ? KC_VOLD : KC_VOLU);
|
tap_code(clockwise ? KC_VOLD : KC_VOLU);
|
||||||
|
@ -243,6 +243,7 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
tap_code(clockwise ? KC_PGUP : KC_PGDN);
|
tap_code(clockwise ? KC_PGUP : KC_PGDN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef OLED_DRIVER_ENABLE
|
#ifdef OLED_DRIVER_ENABLE
|
||||||
|
|
|
@ -174,7 +174,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
return taphold_process(keycode, record);
|
return taphold_process(keycode, record);
|
||||||
}
|
}
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
if (!alpha_pressed) {
|
if (!alpha_pressed) {
|
||||||
tap_code(clockwise ? KC_VOLD : KC_VOLU);
|
tap_code(clockwise ? KC_VOLD : KC_VOLU);
|
||||||
|
@ -188,6 +188,7 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
tap_code(clockwise ? KC_PGUP : KC_PGDN);
|
tap_code(clockwise ? KC_PGUP : KC_PGDN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef OLED_DRIVER_ENABLE
|
#ifdef OLED_DRIVER_ENABLE
|
||||||
|
|
|
@ -561,7 +561,7 @@ void oled_task_user(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
// On the left, control the volume. On the right, scroll the page
|
// On the left, control the volume. On the right, scroll the page
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
if (clockwise) {
|
if (clockwise) {
|
||||||
|
@ -576,4 +576,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
tap_code(KC_VOLD);
|
tap_code(KC_VOLD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,12 +82,13 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
void encoder_update(bool clockwise) {
|
bool encoder_update(bool clockwise) {
|
||||||
if (clockwise) {
|
if (clockwise) {
|
||||||
tap_code(KC_VOLU);
|
tap_code(KC_VOLU);
|
||||||
} else {
|
} else {
|
||||||
tap_code(KC_VOLD);
|
tap_code(KC_VOLD);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void matrix_init_user(void) {
|
void matrix_init_user(void) {
|
||||||
|
|
|
@ -23,7 +23,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
if (index == 0) { /* First encoder */
|
if (index == 0) { /* First encoder */
|
||||||
if (clockwise) {
|
if (clockwise) {
|
||||||
tap_code(KC_PGUP);
|
tap_code(KC_PGUP);
|
||||||
|
@ -37,4 +37,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
tap_code(KC_VOLD);
|
tap_code(KC_VOLD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue