Convert Encoder callbacks to be boolean functions (#12805)
Co-authored-by: James Young <18669334+noroadsleft@users.noreply.github.com>
This commit is contained in:
		| @@ -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
		Reference in New Issue
	
	Block a user