From a0fed0ea176d1c986e40fc4981b900509c90d66e Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Fri, 21 May 2021 23:17:32 -0700 Subject: Convert Encoder callbacks to be boolean functions (#12805) Co-authored-by: James Young <18669334+noroadsleft@users.noreply.github.com> --- keyboards/rgbkb/pan/keymaps/default/keymap.c | 31 +++++++++++----------- keyboards/rgbkb/sol/keymaps/brianweyer/keymap.c | 3 ++- keyboards/rgbkb/sol/keymaps/danielhklein/keymap.c | 3 ++- keyboards/rgbkb/sol/keymaps/default/keymap.c | 5 ++-- keyboards/rgbkb/sol/keymaps/kageurufu/keymap.c | 3 ++- keyboards/rgbkb/sol/keymaps/xyverz/keymap.c | 7 ++--- keyboards/rgbkb/zen/rev2/keymaps/default/keymap.c | 3 ++- keyboards/rgbkb/zygomorph/keymaps/default/keymap.c | 3 ++- .../rgbkb/zygomorph/keymaps/default_oled/keymap.c | 3 ++- .../rgbkb/zygomorph/keymaps/kageurufu/keymap.c | 3 ++- 10 files changed, 37 insertions(+), 27 deletions(-) (limited to 'keyboards/rgbkb') diff --git a/keyboards/rgbkb/pan/keymaps/default/keymap.c b/keyboards/rgbkb/pan/keymaps/default/keymap.c index c041c0b57b..f19d36256c 100644 --- a/keyboards/rgbkb/pan/keymaps/default/keymap.c +++ b/keyboards/rgbkb/pan/keymaps/default/keymap.c @@ -1,18 +1,18 @@ /* Copyright 2020 RGBKB - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ // Each layer gets a name for readability, which is then used in the keymap matrix below. // The underscores don't mean anything - you can have a layer called STUFF or any other name. // Layer names don't all need to be of the same length, obviously, and you can also skip them @@ -100,7 +100,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) { // First encoder - right if (clockwise) { tap_code(KC_VOLU); @@ -114,4 +114,5 @@ void encoder_update_user(uint8_t index, bool clockwise) { tap_code(KC_VOLD); } } + return true; } diff --git a/keyboards/rgbkb/sol/keymaps/brianweyer/keymap.c b/keyboards/rgbkb/sol/keymaps/brianweyer/keymap.c index 7f7863fdb2..2ae07984d8 100644 --- a/keyboards/rgbkb/sol/keymaps/brianweyer/keymap.c +++ b/keyboards/rgbkb/sol/keymaps/brianweyer/keymap.c @@ -131,7 +131,7 @@ bool TOG_STATUS = false; int RGB_current_mode; #ifdef ENCODER_ENABLE -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); @@ -145,6 +145,7 @@ void encoder_update_user(uint8_t index, bool clockwise) { tap_code(KC_DOWN); } } + return true; } #endif diff --git a/keyboards/rgbkb/sol/keymaps/danielhklein/keymap.c b/keyboards/rgbkb/sol/keymaps/danielhklein/keymap.c index 860361e810..96e19bf865 100644 --- a/keyboards/rgbkb/sol/keymaps/danielhklein/keymap.c +++ b/keyboards/rgbkb/sol/keymaps/danielhklein/keymap.c @@ -164,7 +164,7 @@ bool TOG_STATUS = false; int RGB_current_mode; #ifdef ENCODER_ENABLE -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); @@ -178,6 +178,7 @@ void encoder_update_user(uint8_t index, bool clockwise) { tap_code(KC_VOLD); } } + return true; } #endif diff --git a/keyboards/rgbkb/sol/keymaps/default/keymap.c b/keyboards/rgbkb/sol/keymaps/default/keymap.c index 04af5165e7..0883cb7753 100644 --- a/keyboards/rgbkb/sol/keymaps/default/keymap.c +++ b/keyboards/rgbkb/sol/keymaps/default/keymap.c @@ -223,9 +223,9 @@ const uint16_t PROGMEM encoders[][NUMBER_OF_ENCODERS * 2][2] = { ) }; -void encoder_update_user(uint8_t index, bool clockwise) { +bool encoder_update_user(uint8_t index, bool clockwise) { if (!is_keyboard_master()) - return; + return true; #ifdef RGB_OLED_MENU if (index == RGB_OLED_MENU) { @@ -244,6 +244,7 @@ void encoder_update_user(uint8_t index, bool clockwise) { if (keycode != KC_TRANSPARENT) tap_code16(keycode); } + return true; } #endif diff --git a/keyboards/rgbkb/sol/keymaps/kageurufu/keymap.c b/keyboards/rgbkb/sol/keymaps/kageurufu/keymap.c index b587ef2b3d..1c8320ac6e 100644 --- a/keyboards/rgbkb/sol/keymaps/kageurufu/keymap.c +++ b/keyboards/rgbkb/sol/keymaps/kageurufu/keymap.c @@ -79,7 +79,7 @@ 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) { /* First encoder */ if (clockwise) { tap_code(KC_VOLU); @@ -93,5 +93,6 @@ void encoder_update_user(uint8_t index, bool clockwise) { tap_code(KC_VOLD); } } + return true; } #endif diff --git a/keyboards/rgbkb/sol/keymaps/xyverz/keymap.c b/keyboards/rgbkb/sol/keymaps/xyverz/keymap.c index e38663dbb3..ed98a951c2 100644 --- a/keyboards/rgbkb/sol/keymaps/xyverz/keymap.c +++ b/keyboards/rgbkb/sol/keymaps/xyverz/keymap.c @@ -59,7 +59,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_BSPC, KC_DEL, KC_ENT, KC_SPC \ ), - + [_QWERTY] = LAYOUT( \ KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_HOME, KC_PGUP, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSLS, \ KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_END, KC_PGDN, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_SLSH, \ @@ -253,7 +253,7 @@ const uint16_t PROGMEM encoders[][NUMBER_OF_ENCODERS * 2][2] = { ) }; -void encoder_update_user(uint8_t index, bool clockwise) { +bool encoder_update_user(uint8_t index, bool clockwise) { if (!is_keyboard_master()) return; @@ -274,6 +274,7 @@ void encoder_update_user(uint8_t index, bool clockwise) { if (keycode != KC_TRANSPARENT) tap_code16(keycode); } + return true; } #endif @@ -358,4 +359,4 @@ void oled_task_user(void) { } } -#endif \ No newline at end of file +#endif diff --git a/keyboards/rgbkb/zen/rev2/keymaps/default/keymap.c b/keyboards/rgbkb/zen/rev2/keymaps/default/keymap.c index 2f0138c8e0..f31da8bf5d 100644 --- a/keyboards/rgbkb/zen/rev2/keymaps/default/keymap.c +++ b/keyboards/rgbkb/zen/rev2/keymaps/default/keymap.c @@ -67,7 +67,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); @@ -81,6 +81,7 @@ void encoder_update_user(uint8_t index, bool clockwise) { tap_code(KC_DOWN); } } + return true; } bool process_record_user(uint16_t keycode, keyrecord_t *record) { diff --git a/keyboards/rgbkb/zygomorph/keymaps/default/keymap.c b/keyboards/rgbkb/zygomorph/keymaps/default/keymap.c index f236e20a43..fa2b9a57b9 100644 --- a/keyboards/rgbkb/zygomorph/keymaps/default/keymap.c +++ b/keyboards/rgbkb/zygomorph/keymaps/default/keymap.c @@ -112,7 +112,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); @@ -126,6 +126,7 @@ void encoder_update_user(uint8_t index, bool clockwise) { tap_code(KC_DOWN); } } + return true; } bool process_record_user(uint16_t keycode, keyrecord_t *record) { diff --git a/keyboards/rgbkb/zygomorph/keymaps/default_oled/keymap.c b/keyboards/rgbkb/zygomorph/keymaps/default_oled/keymap.c index d313bec8b0..972fa4b057 100644 --- a/keyboards/rgbkb/zygomorph/keymaps/default_oled/keymap.c +++ b/keyboards/rgbkb/zygomorph/keymaps/default_oled/keymap.c @@ -112,7 +112,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); @@ -126,6 +126,7 @@ void encoder_update_user(uint8_t index, bool clockwise) { tap_code(KC_DOWN); } } + return true; } bool process_record_user(uint16_t keycode, keyrecord_t *record) { diff --git a/keyboards/rgbkb/zygomorph/keymaps/kageurufu/keymap.c b/keyboards/rgbkb/zygomorph/keymaps/kageurufu/keymap.c index 29702b614a..c4bcbcfbeb 100644 --- a/keyboards/rgbkb/zygomorph/keymaps/kageurufu/keymap.c +++ b/keyboards/rgbkb/zygomorph/keymaps/kageurufu/keymap.c @@ -67,7 +67,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); @@ -81,4 +81,5 @@ void encoder_update_user(uint8_t index, bool clockwise) { tap_code(KC_DOWN); } } + return true; } -- cgit v1.2.3