Convert Encoder callbacks to be boolean functions (#12805)

Co-authored-by: James Young <18669334+noroadsleft@users.noreply.github.com>
python_optimizations
Drashna Jaelre 4 years ago committed by GitHub
parent 76c23b15ab
commit a0fed0ea17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      docs/feature_encoders.md
  2. 3
      keyboards/0xcb/1337/keymaps/default/keymap.c
  3. 3
      keyboards/0xcb/1337/keymaps/jakob/keymap.c
  4. 3
      keyboards/0xcb/1337/keymaps/via/keymap.c
  5. 5
      keyboards/10bleoledhub/keymaps/default/keymap.c
  6. 5
      keyboards/10bleoledhub/keymaps/via/keymap.c
  7. 3
      keyboards/1upkeyboards/sweet16/keymaps/default/keymap.c
  8. 4
      keyboards/1upkeyboards/sweet16/v2/promicro/promicro.c
  9. 4
      keyboards/2key2crawl/keymaps/default/keymap.c
  10. 4
      keyboards/2key2crawl/keymaps/tabs/keymap.c
  11. 3
      keyboards/2key2crawl/keymaps/vol/keymap.c
  12. 3
      keyboards/45_ats/keymaps/default/keymap.c
  13. 3
      keyboards/45_ats/keymaps/via/keymap.c
  14. 3
      keyboards/7c8/framework/keymaps/default/keymap.c
  15. 3
      keyboards/7c8/framework/keymaps/steven/keymap.c
  16. 3
      keyboards/7c8/framework/keymaps/via/keymap.c
  17. 3
      keyboards/abacus/keymaps/unicodemap/keymap.c
  18. 3
      keyboards/absinthe/keymaps/default/keymap.c
  19. 3
      keyboards/abstract/ellipse/keymaps/abstractkb/keymap.c
  20. 3
      keyboards/abstract/ellipse/keymaps/default/keymap.c
  21. 3
      keyboards/aleblazer/zodiark/keymaps/default/keymap.c
  22. 3
      keyboards/aleblazer/zodiark/keymaps/slimoled/keymap.c
  23. 3
      keyboards/aleblazer/zodiark/keymaps/via/encoder.c
  24. 3
      keyboards/aleth42/keymaps/default/keymap.c
  25. 3
      keyboards/aleth42/keymaps/via/keymap.c
  26. 3
      keyboards/aplyard/aplx6/rev2/keymaps/default/keymap.c
  27. 3
      keyboards/arrayperipherals/1x4p1/keymaps/default/keymap.c
  28. 3
      keyboards/arrayperipherals/1x4p1/keymaps/via/keymap.c
  29. 3
      keyboards/basekeys/trifecta/keymaps/default/keymap.c
  30. 3
      keyboards/basekeys/trifecta/keymaps/via/keymap.c
  31. 3
      keyboards/basketweave/keymaps/default/keymap.c
  32. 12
      keyboards/boston/keymaps/default/keymap.c
  33. 4
      keyboards/boston/keymaps/rgb-light-layers/keymap.c
  34. 3
      keyboards/boston_meetup/2019/2019.c
  35. 4
      keyboards/cannonkeys/ortho75/ortho75.c
  36. 4
      keyboards/cannonkeys/satisfaction75/satisfaction75.c
  37. 3
      keyboards/cassette42/keymaps/default/keymap.c
  38. 4
      keyboards/ck60i/ck60i.c
  39. 3
      keyboards/ckeys/thedora/keymaps/default/keymap.c
  40. 3
      keyboards/ckeys/thedora/readme.md
  41. 3
      keyboards/ckeys/washington/keymaps/default/keymap.c
  42. 11
      keyboards/clueboard/2x1800/2019/2019.c
  43. 3
      keyboards/clueboard/2x1800/2019/2019.h
  44. 4
      keyboards/crbn/crbn.c
  45. 4
      keyboards/custommk/genesis/genesis.c
  46. 3
      keyboards/delikeeb/vaguettelite/keymaps/default/keymap.c
  47. 3
      keyboards/delikeeb/vaguettelite/keymaps/default_625u_universal/keymap.c
  48. 3
      keyboards/delikeeb/vaguettelite/keymaps/noclew/keymap.c
  49. 3
      keyboards/delikeeb/vaguettelite/keymaps/via/keymap.c
  50. 3
      keyboards/delikeeb/vanana/keymaps/default/keymap.c
  51. 3
      keyboards/delikeeb/waaffle/keymaps/default/keymap.c
  52. 3
      keyboards/dmqdesign/spin/keymaps/codecoffeecode/keymap.c
  53. 3
      keyboards/dmqdesign/spin/keymaps/default/keymap.c
  54. 3
      keyboards/dmqdesign/spin/keymaps/encoderlayers/keymap.c
  55. 3
      keyboards/dmqdesign/spin/keymaps/gorbachev/keymap.c
  56. 3
      keyboards/dmqdesign/spin/keymaps/spidey3_pad/keymap.c
  57. 3
      keyboards/dmqdesign/spin/keymaps/via/keymap.c
  58. 5
      keyboards/doodboard/duckboard/keymaps/default/keymap.c
  59. 5
      keyboards/doodboard/duckboard_r2/keymaps/default/keymap.c
  60. 5
      keyboards/doodboard/duckboard_r2/keymaps/via/keymap.c
  61. 4
      keyboards/draculad/keymaps/default/keymap.c
  62. 3
      keyboards/draculad/keymaps/pimoroni/keymap.c
  63. 3
      keyboards/draytronics/daisy/keymaps/default/keymap.c
  64. 3
      keyboards/dumbo/keymaps/default/keymap.c
  65. 3
      keyboards/dumbo/keymaps/trip-trap/keymap.c
  66. 3
      keyboards/dumbpad/v0x/keymaps/default/keymap.c
  67. 3
      keyboards/dumbpad/v0x/templates/keymap.c
  68. 3
      keyboards/dumbpad/v0x_dualencoder/keymaps/default/keymap.c
  69. 3
      keyboards/dumbpad/v0x_dualencoder/templates/keymap.c
  70. 3
      keyboards/dumbpad/v0x_right/keymaps/default/keymap.c
  71. 3
      keyboards/dumbpad/v0x_right/templates/keymap.c
  72. 3
      keyboards/dumbpad/v1x/keymaps/default/keymap.c
  73. 3
      keyboards/dumbpad/v1x/templates/keymap.c
  74. 3
      keyboards/dumbpad/v1x_dualencoder/keymaps/default/keymap.c
  75. 3
      keyboards/dumbpad/v1x_dualencoder/templates/keymap.c
  76. 3
      keyboards/dumbpad/v1x_right/keymaps/default/keymap.c
  77. 3
      keyboards/dumbpad/v1x_right/templates/keymap.c
  78. 5
      keyboards/ealdin/quadrant/quadrant.c
  79. 3
      keyboards/ebastler/isometria_75/rev1/keymaps/default/keymap.c
  80. 3
      keyboards/ebastler/isometria_75/rev1/keymaps/via/keymap.c
  81. 4
      keyboards/eggman/keymaps/default/keymap.c
  82. 4
      keyboards/evolv/evolv.c
  83. 3
      keyboards/evyd13/ta65/keymaps/default/keymap.c
  84. 3
      keyboards/ffkeebs/siris/keymaps/default/keymap.c
  85. 3
      keyboards/ffkeebs/siris/keymaps/via/keymap.c
  86. 3
      keyboards/flxlb/zplit/keymaps/via/keymap.c
  87. 3
      keyboards/gmmk/pro/keymaps/default/keymap.c
  88. 3
      keyboards/gmmk/pro/keymaps/via/keymap.c
  89. 3
      keyboards/gmmk/pro/keymaps/wholesomeducky/keymap.c
  90. 9
      keyboards/hadron/hadron.h
  91. 7
      keyboards/hadron/ver3/ver3.c
  92. 3
      keyboards/handwired/amigopunk/keymaps/default/keymap.c
  93. 3
      keyboards/handwired/bento/keymaps/cbc02009/keymap.c
  94. 3
      keyboards/handwired/bento/keymaps/default/keymap.c
  95. 5
      keyboards/handwired/bento/keymaps/mac/keymap.c
  96. 3
      keyboards/handwired/d48/keymaps/anderson/keymap.c
  97. 3
      keyboards/handwired/d48/keymaps/default/keymap.c
  98. 3
      keyboards/handwired/dactyl_manuform/5x6_5/keymaps/333fred/keymap.c
  99. 3
      keyboards/handwired/daishi/keymaps/default/keymap.c
  100. 3
      keyboards/handwired/frankie_macropad/keymaps/default/keymap.c
  101. Some files were not shown because too many files have changed in this diff Show More

@ -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`:
```c
void encoder_update_kb(uint8_t index, bool clockwise) {
encoder_update_user(index, clockwise);
bool encoder_update_kb(uint8_t index, bool clockwise) {
return encoder_update_user(index, clockwise);
}
```
or `keymap.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 (clockwise) {
tap_code(KC_PGDN);
@ -75,9 +75,12 @@ void encoder_update_user(uint8_t index, bool clockwise) {
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
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 */
#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)) {
#ifdef RGBLIGHT_ENABLE
if (clockwise) {
@ -72,6 +72,7 @@ void encoder_update_user(uint8_t index, bool clockwise) {
tap_code(KC_VOLD);
}
}
return true;
}
#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 */
#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)) {
#ifdef RGBLIGHT_ENABLE
if (clockwise) {
@ -72,6 +72,7 @@ void encoder_update_user(uint8_t index, bool clockwise) {
tap_code16(C(A(KC_DOWN)));
}
}
return true;
}
#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 */
#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)) {
#ifdef RGBLIGHT_ENABLE
if (clockwise) {
@ -72,6 +72,7 @@ void encoder_update_user(uint8_t index, bool clockwise) {
tap_code(KC_VOLD);
}
}
return true;
}
#endif

@ -58,14 +58,15 @@ static void render_logo(void) {
void oled_task_user(void) { render_logo(); }
#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 (clockwise) {
tap_code(KC_PGDN);
} else {
tap_code(KC_PGUP);
}
}
}
return true;
}

@ -58,14 +58,15 @@ static void render_logo(void) {
void oled_task_user(void) { render_logo(); }
#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 (clockwise) {
tap_code(KC_PGDN);
} else {
tap_code(KC_PGUP);
}
}
}
return true;
}

@ -27,7 +27,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#ifdef ENCODER_ENABLE
#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 (clockwise) {
tap_code(KC_VOLU);
@ -35,5 +35,6 @@ void encoder_update_user(int8_t index, bool clockwise) {
tap_code(KC_VOLD);
}
}
return true;
}
#endif

@ -2,7 +2,7 @@
#include "encoder.h"
#ifdef ENCODER_ENABLED
void encoder_update_kb(int8_t index, bool clockwise) {
encoder_update_user(index, clockwise);
bool encoder_update_kb(uint8_t index, bool clockwise) {
return encoder_update_user(index, clockwise);
}
#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 (clockwise) {
tap_code(KC_PGUP);
@ -24,5 +24,5 @@ void encoder_update_user(int8_t index, bool clockwise) {
tap_code(KC_PGDN);
}
}
return true;
}

@ -14,7 +14,7 @@ void matrix_init_user(void) {
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 (clockwise) {
tap_code16(C(KC_T));
@ -22,5 +22,5 @@ void encoder_update_user(int8_t index, bool clockwise) {
tap_code16(C(KC_W));
}
}
return true;
}

@ -14,7 +14,7 @@ void matrix_init_user(void) {
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 (clockwise) {
tap_code(KC_VOLU);
@ -22,4 +22,5 @@ void encoder_update_user(int8_t index, bool clockwise) {
tap_code(KC_VOLD);
}
}
return true;
}

@ -96,7 +96,7 @@ layer_state_t layer_state_set_user(layer_state_t 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 (clockwise) {
tap_code(KC_VOLU);
@ -104,4 +104,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
tap_code(KC_VOLD);
}
}
return true;
}

@ -96,7 +96,7 @@ layer_state_t layer_state_set_user(layer_state_t 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 (clockwise) {
tap_code(KC_VOLU);
@ -104,4 +104,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
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) {
switch (get_highest_layer(layer_state)) {
case _BASE:
@ -120,6 +120,7 @@ void encoder_update_user(uint8_t index, bool clockwise) {
break;
}
}
return true;
}
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);
if (index == 0) {
if (clockwise) {
@ -126,4 +126,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
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);
if (index == 0) {
if (clockwise) {
@ -87,4 +87,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
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);
}
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 _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);
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)
};
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_VOLU);
@ -39,4 +39,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
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 (clockwise) {
tap_code(KC_VOLU);
@ -63,4 +63,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
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 (clockwise) {
tap_code(KC_O);
@ -63,4 +63,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
tap_code(KC_R);
}
}
return true;
}

@ -308,7 +308,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) {
if (index == 0) {
if (clockwise) {
tap_code(KC_VOLU);
@ -322,6 +322,7 @@ void encoder_update_user(uint8_t index, bool clockwise) {
rgblight_step_reverse();
}
}
return true;
}
#endif

@ -311,7 +311,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) {
if (index == 0) {
if (clockwise) {
tap_code(KC_VOLU);
@ -325,6 +325,7 @@ void encoder_update_user(uint8_t index, bool clockwise) {
rgblight_step_reverse();
}
}
return true;
}
#endif

@ -16,7 +16,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#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 (clockwise) {
tap_code(KC_VOLU);
@ -30,6 +30,7 @@ void encoder_update_user(uint8_t index, bool clockwise) {
tap_code(KC_PGUP);
}
}
return true;
}
#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 */
switch (get_highest_layer(layer_state)) {
case _QWERTY:
@ -146,4 +146,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
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 */
switch (get_highest_layer(layer_state)) {
case _QWERTY:
@ -146,4 +146,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
tap_code(KC_PGUP);
}
}
return true;
}

@ -118,7 +118,7 @@ void oled_task_user(void) {
}
#endif
void encoder_update_user(uint8_t index, bool clockwise) {
bool encoder_update_user(uint8_t index, bool clockwise) {
if (index == 0) {
switch (get_highest_layer(layer_state)) {
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
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_MS_WH_UP);
@ -25,6 +25,7 @@ void encoder_update_user(uint8_t index, bool clockwise) {
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
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_MS_WH_UP);
@ -25,6 +25,7 @@ void encoder_update_user(uint8_t index, bool clockwise) {
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 (clockwise) {
tap_code(KC_VOLU);
@ -68,4 +68,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
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 (clockwise) {
tap_code(KC_VOLU);
@ -68,4 +68,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
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 (clockwise) {
tap_code(KC_VOLU);
@ -49,4 +49,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
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) {
if (clockwise) {
bool encoder_update_user(uint8_t index, bool clockwise) {
if (clockwise) {
tap_code(KC_VOLU);
}
else {
} else {
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 */
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 (clockwise) {
@ -151,6 +151,7 @@ void encoder_update_user(uint8_t index, bool clockwise) {
tap_code(KC_VOLD);
}
}
return true;
}
/*Default layer is white.*/
@ -220,4 +221,3 @@ bool led_update_user(led_t led_state) {
rgblight_set_layer_state(0, true);
return true;
}

@ -182,9 +182,10 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *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;
queue_for_send = true;
return true;
}
#endif

@ -11,7 +11,8 @@ uint32_t layer_state_set_kb(uint32_t 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;
if (index == 0) {
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 */ }
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;
queue_for_send = true;
if (index == 0) {
@ -325,6 +326,7 @@ void encoder_update_kb(uint8_t index, bool clockwise) {
}
}
}
return true;
}
void custom_config_reset(void){

@ -112,7 +112,7 @@ void oled_task_user(void) {
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();
if (index == 0) { /* left encoder */
switch (layer_state) {
@ -171,4 +171,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
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"
__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 (clockwise) {
tap_code(KC_VOLU);
@ -25,4 +26,5 @@ __attribute__((weak)) void encoder_update_user(uint8_t index, bool clockwise) {
tap_code(KC_VOLD);
}
}
return true;
}

@ -144,7 +144,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
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 (clockwise) {
tap_code(KC_PGDN);
@ -152,4 +152,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
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.
```
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_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.
}
}
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)) {
case _BASE:
if (clockwise) {
@ -55,6 +55,7 @@ void encoder_update_user(uint8_t index, bool clockwise) {
tap_code(KC_MPRV);
}
}
return true;
}
#ifdef OLED_DRIVER_ENABLE

@ -144,13 +144,11 @@ bool led_update_kb(led_t led_state) {
return res;
}
__attribute__ ((weak))
bool encoder_update_keymap(int8_t index, bool clockwise) {
return false;
}
__attribute__((weak)) bool encoder_update_keymap(uint8_t index, bool clockwise) { return true; }
__attribute__((weak)) bool encoder_update_user(uint8_t index, bool clockwise) { return encoder_update_keymap(index, clockwise); }
void encoder_update_kb(int8_t index, bool clockwise) {
if (!encoder_update_keymap(index, clockwise)) {
bool encoder_update_kb(uint8_t index, bool clockwise) {
if (!encoder_update_user(index, clockwise)) {
// Encoder 1, outside left
if (index == 0 && clockwise) {
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
}
}
return true;
}

@ -29,8 +29,7 @@ enum TWOx1800_keycodes {
#define SAFE_RANGE NEW_SAFE_RANGE
// Encoder update function that returns true/false
__attribute__ ((weak))
bool encoder_update_keymap(int8_t index, bool clockwise);
bool encoder_update_keymap(uint8_t index, bool clockwise);
// Encoder button combo check
void check_encoder_buttons(void);

@ -15,10 +15,12 @@
*/
#include "crbn.h"
/* 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) {
tap_code(KC_VOLU);
} else {
tap_code(KC_VOLD);
}
return true;
}

@ -16,7 +16,8 @@
#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 */
if (index == 0) {
if (clockwise) {
@ -33,4 +34,5 @@ __attribute__((weak)) void encoder_update_user(uint8_t index, bool clockwise) {
tap_code(KC_VOLD);
}
}
return true;
}

@ -106,7 +106,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
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. */
if (index == 0) { /* First encoder */
/* 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);
}
}
return true;
}

@ -106,7 +106,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
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. */
if (index == 0) { /* First encoder */
/* 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);
}
}
return true;
}

@ -126,7 +126,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
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. */
if (index == 0) { /* First encoder */
/* 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);
}
}
return true;
}

@ -107,7 +107,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
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. */
if (index == 0) { /* First encoder */
/* 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);
}
}
return true;
}

@ -117,7 +117,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
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. */
if (index == 0) { /* First encoder */
/* 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;
}
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. */
if (index == 0) { /* First encoder */
/* 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) {
case 0:
if (clockwise) {
@ -48,4 +48,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
}
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 (clockwise) {
rgblight_increase_hue(); //Cycle through the RGB hue
@ -44,4 +44,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
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 */
switch (currentLayer) { //break each encoder update into a switch statement for the current layer
case _BL:
@ -124,6 +124,7 @@ void encoder_update_user(uint8_t index, bool clockwise) {
break;
}
}
return true;
}
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;
};
void encoder_update_user(uint8_t index, bool clockwise) {
bool encoder_update_user(uint8_t index, bool clockwise) {
if (index == 0) { /* First encoder */
switch (get_highest_layer(layer_state)) { //break each encoder update into a switch statement for the current layer
case _NUMPAD:
@ -135,6 +135,7 @@ void encoder_update_user(uint8_t index, bool clockwise) {
break;
}
}
return true;
}
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)) {
case _RGB:
if (index == 0) {
@ -234,4 +234,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
}
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 (clockwise) {
rgblight_increase_hue(); //Cycle through the RGB hue
@ -65,4 +65,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
rgblight_decrease_val();
}
}
return true;
}

@ -38,14 +38,15 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
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 (clockwise) {
tap_code(KC_VOLU);
} else {
tap_code(KC_VOLD);
}
}
}
return true;
}

@ -38,14 +38,15 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
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 (clockwise) {
tap_code(KC_VOLU);
} else {
tap_code(KC_VOLD);
}
}
}
return true;
}

@ -45,14 +45,15 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
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 (clockwise) {
tap_code(KC_VOLU);
} else {
tap_code(KC_VOLD);
}
}
}
return true;
}

@ -195,7 +195,7 @@ void oled_task_user(void) {
#endif
#ifdef ENCODER_ENABLE
void encoder_update_user(uint8_t index, bool clockwise) {
bool encoder_update_user(uint8_t index, bool clockwise) {
if (index == 0) {
// Volume control
if (clockwise) {
@ -220,6 +220,6 @@ void encoder_update_user(uint8_t index, bool clockwise) {
tap_code(KC_WH_D);
}
}
return true;
}
#endif

@ -295,7 +295,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record){
return true;
}
#ifdef ENCODER_ENABLE
void encoder_update_user(uint8_t index, bool clockwise) {
bool encoder_update_user(uint8_t index, bool clockwise) {
if (index == 0) {
// Volume control
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...
// the missing ones are encoder 1 on the right side and encoder 3 on the left side
return true;
}
#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 (clockwise) {
tap_code(KC_VOLD);
@ -48,4 +48,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
tap_code(KC_PGDN);
}
}
return true;
}

@ -189,7 +189,7 @@ void oled_task_user(void) {
#endif
#ifdef ENCODER_ENABLE
void encoder_update_user(uint8_t index, bool clockwise) {
bool encoder_update_user(uint8_t index, bool clockwise) {
if (index == 0) {
// master side thumb encoder
// Volume control
@ -226,5 +226,6 @@ void encoder_update_user(uint8_t index, bool clockwise) {
tap_code(KC_HOME);
}
}
return true;
}
#endif

@ -387,7 +387,7 @@ void oled_task_user(void) {
#endif
#ifdef ENCODER_ENABLE
void encoder_update_user(uint8_t index, bool clockwise) {
bool encoder_update_user(uint8_t index, bool clockwise) {
if (index == 0) {
// master side thumb encoder
// Volume control
@ -424,5 +424,6 @@ void encoder_update_user(uint8_t index, bool clockwise) {
tap_code(KC_HOME);
}
}
return true;
}
#endif

@ -72,7 +72,7 @@ void keyboard_post_init_user(void) {
//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
* Default behavior:
* main layer:
@ -103,4 +103,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
break;
}
}
return true;
}

@ -2,7 +2,7 @@
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) {
switch (get_highest_layer(layer_state)) {
case 0:
@ -22,4 +22,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
break;
}
}
return true;
}

@ -72,7 +72,7 @@ void keyboard_post_init_user(void) {
// 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
* Default behavior:
* left encoder:
@ -131,4 +131,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
break;
}
}
return true;
}

@ -2,7 +2,7 @@
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) {
switch (get_highest_layer(layer_state)) {
case 0:
@ -40,4 +40,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
break;
}
}
return true;
}

@ -72,7 +72,7 @@ void keyboard_post_init_user(void) {
// 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
* Default behavior:
* main layer:
@ -103,4 +103,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
break;
}
}
return true;
}

@ -2,7 +2,7 @@
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) {
switch (get_highest_layer(layer_state)) {
case 0:
@ -22,4 +22,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
break;
}
}
return true;
}

@ -72,7 +72,7 @@ void keyboard_post_init_user(void) {
//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
* Default behavior:
* main layer:
@ -103,4 +103,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
break;
}
}
return true;
}

@ -2,7 +2,7 @@
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) {
switch (get_highest_layer(layer_state)) {
case 0:
@ -22,4 +22,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
break;
}
}
return true;
}

@ -72,7 +72,7 @@ void keyboard_post_init_user(void) {
// 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
* Default behavior:
* left encoder:
@ -131,4 +131,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
break;
}
}
return true;
}

@ -2,7 +2,7 @@
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) {
switch (get_highest_layer(layer_state)) {
case 0:
@ -40,4 +40,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
break;
}
}
return true;
}

@ -72,7 +72,7 @@ void keyboard_post_init_user(void) {
// 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
* Default behavior:
* main layer:
@ -103,4 +103,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
break;
}
}
return true;
}

@ -2,7 +2,7 @@
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) {
switch (get_highest_layer(layer_state)) {
case 0:
@ -22,4 +22,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
break;
}
}
return true;
}

@ -17,7 +17,8 @@
// 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;
if (index == 0) {
if (clockwise) {
@ -49,6 +50,7 @@ __attribute__((weak)) void encoder_update_user(uint8_t index, bool clockwise) {
}
tap_code(mapped_code);
}
return true;
}
void keyboard_pre_init_kb(void) {
@ -63,4 +65,3 @@ bool led_update_kb(led_t led_state) {
}
return true;
}

@ -43,7 +43,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
};
/* 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 */
if (index == 0) {
/* 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;
}
}
return true;
}

@ -51,7 +51,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
};
/* 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 */
if (index == 0) {
/* 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;
}
}
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 (clockwise) {
tap_code(KC_WH_U);
@ -74,6 +74,7 @@ void encoder_update_user(uint8_t index, bool clockwise) {
tap_code(KC_VOLD);
}
}
return true;
}
#ifdef COMBO_ENABLE
@ -91,4 +92,3 @@ combo_t key_combos[COMBO_COUNT] = {
[COMBO_DEL] = COMBO(combo_del,KC_DEL)
};
#endif

@ -17,7 +17,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#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 (clockwise) {
tap_code(KC_VOLU);
@ -25,4 +26,5 @@ __attribute__((weak)) void encoder_update_user(uint8_t index, bool clockwise) {
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)){
case 1: //Layer 1
if (!clockwise) { // Remove ! to reverse direction
@ -35,4 +35,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
}
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 (clockwise) {
tap_code(KC_PGDN);
@ -58,4 +58,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
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 (clockwise) {
tap_code(KC_PGDN);
@ -58,4 +58,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
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);
}
void encoder_update_user(uint8_t index, bool clockwise) {
bool encoder_update_user(uint8_t index, bool clockwise) {
if (clockwise) {
tap_code(KC_VOLD);
} else {
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) {
tap_code(KC_VOLU);
} else {
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) {
tap_code(KC_VOLU);
} else {
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) {
tap_code(KC_MS_WH_RIGHT);
} else {
tap_code(KC_MS_WH_LEFT);
}
return true;
}

@ -1,16 +1,17 @@
#ifndef HADRON_H
#define HADRON_H
#ifdef SUBPROJECT_ver0
#include "quantum.h"
#ifdef KEYBOARD_hadron_ver0
#include "ver0.h"
#endif
#ifdef SUBPROJECT_ver2
#ifdef KEYBOARD_hadron_ver2
#include "ver2.h"
#endif
#ifdef SUBPROJECT_ver3
#ifdef KEYBOARD_hadron_ver3
#include "ver3.h"
#endif
#include "quantum.h"
#define LAYOUT( \

@ -18,6 +18,7 @@
#include "action_layer.h"
#include "haptic.h"
#ifdef RGB_MATRIX_ENABLE
#include "rgb_matrix.h"
@ -181,9 +182,13 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *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;
queue_for_send = true;
return true;
}
#endif

@ -37,11 +37,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
};
#ifdef ENCODER_ENABLE
void encoder_update_user(uint8_t index, bool clockwise) {
bool encoder_update_user(uint8_t index, bool clockwise) {
if (index != 0)
return;
tap_code(clockwise ? KC_VOLU : KC_VOLD);
return true;
}
#endif

@ -29,7 +29,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
#ifdef ENCODER_ENABLE
#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 (clockwise) {
tap_code(KC_VOLU);
@ -37,5 +37,6 @@ void encoder_update_user(int8_t index, bool clockwise) {
tap_code(KC_VOLD);
}
}
return true;
}
#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 (clockwise) {
tap_code(KC_VOLU);
@ -47,4 +47,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
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 (clockwise) {
tap_code(KC_VOLU);
@ -49,6 +49,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
tap_code(KC_VOLD);
}
}
return true;
}

@ -229,7 +229,7 @@ layer_state_t layer_state_set_user(layer_state_t 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 (!alpha_pressed) {
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);
}
}
return true;
}
#ifdef OLED_DRIVER_ENABLE

@ -174,7 +174,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *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 (!alpha_pressed) {
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);
}
}
return true;
}
#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
if (index == 0) {
if (clockwise) {
@ -576,4 +576,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
tap_code(KC_VOLD);
}
}
return true;
}

@ -82,12 +82,13 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return true;
};
void encoder_update(bool clockwise) {
bool encoder_update(bool clockwise) {
if (clockwise) {
tap_code(KC_VOLU);
} else {
tap_code(KC_VOLD);
}
return true;
}
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 (clockwise) {
tap_code(KC_PGUP);
@ -37,4 +37,5 @@ void encoder_update_user(uint8_t index, bool clockwise) {
tap_code(KC_VOLD);
}
}
return true;
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save