diff options
59 files changed, 343 insertions, 463 deletions
diff --git a/docs/ja/feature_encoders.md b/docs/ja/feature_encoders.md index 7b7f394c83..21f42d38b7 100644 --- a/docs/ja/feature_encoders.md +++ b/docs/ja/feature_encoders.md @@ -51,15 +51,18 @@ ENCODER_ENABLE = yes コールバック関数を `<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) { + if (!encoder_update_user(index, clockwise)) { + return false; + } + } ``` あるいは `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); @@ -73,6 +76,7 @@ void encoder_update_user(uint8_t index, bool clockwise) { tap_code(KC_UP); } } + return true; } ``` diff --git a/keyboards/gmmk/pro/ansi/keymaps/willwm/keymap.c b/keyboards/gmmk/pro/ansi/keymaps/willwm/keymap.c index a17f793319..a32fef1041 100644 --- a/keyboards/gmmk/pro/ansi/keymaps/willwm/keymap.c +++ b/keyboards/gmmk/pro/ansi/keymaps/willwm/keymap.c @@ -16,16 +16,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include QMK_KEYBOARD_H +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { -// ESC F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 Del Rotary(Mute) -// ~ 1 2 3 4 5 6 7 8 9 0 - (=) BackSpc Home -// Tab Q W E R T Y U I O P [ ] \ PgUp -// Caps A S D F G H J K L ; " Enter PgDn -// Sh_L Z X C V B N M , . ? Sh_R Up End -// Ct_L Win_L Alt_L SPACE Alt_R FN Ct_R Left Down Right - - + // ESC F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 Del Rotary(Mute) + // ~ 1 2 3 4 5 6 7 8 9 0 - (=) BackSpc Home + // Tab Q W E R T Y U I O P [ ] \ PgUp + // Caps A S D F G H J K L ; " Enter PgDn + // Sh_L Z X C V B N M , . ? Sh_R Up End + // Ct_L Win_L Alt_L SPACE Alt_R FN Ct_R Left Down Right [0] = LAYOUT( KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_MUTE, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_HOME, @@ -61,14 +60,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), - }; +// clang-format on - -void encoder_update_user(uint8_t index, bool clockwise) { +bool encoder_update_user(uint8_t index, bool clockwise) { if (clockwise) { - tap_code(KC_VOLU); + tap_code(KC_VOLU); } else { - tap_code(KC_VOLD); + tap_code(KC_VOLD); } + return true; } diff --git a/keyboards/handwired/daishi/daishi.h b/keyboards/handwired/daishi/daishi.h index 49e3775897..0d0c57ab20 100644 --- a/keyboards/handwired/daishi/daishi.h +++ b/keyboards/handwired/daishi/daishi.h @@ -2,8 +2,6 @@ #include "quantum.h" -#define encoder_update(clockwise) encoder_update_user(uint8_t index, clockwise) - // The first section contains all of the arguments // The second converts the arguments into a two-dimensional array #define LAYOUT( \ diff --git a/keyboards/handwired/daishi/keymaps/default/keymap.c b/keyboards/handwired/daishi/keymaps/default/keymap.c index 5214e8b6f4..a1ef825ff2 100644 --- a/keyboards/handwired/daishi/keymaps/default/keymap.c +++ b/keyboards/handwired/daishi/keymaps/default/keymap.c @@ -82,8 +82,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { return true; }; -bool encoder_update(bool clockwise) { - if (clockwise) { +bool encoder_update_user(uint8_t index, bool clockwise) { + if (clockwise) { tap_code(KC_VOLU); } else { tap_code(KC_VOLD); diff --git a/keyboards/hub20/keymaps/left_hand_numpad/keymap.c b/keyboards/hub20/keymaps/left_hand_numpad/keymap.c index 395ebc15b4..b5817ab3c5 100644 --- a/keyboards/hub20/keymaps/left_hand_numpad/keymap.c +++ b/keyboards/hub20/keymaps/left_hand_numpad/keymap.c @@ -15,15 +15,13 @@ */ #include QMK_KEYBOARD_H - - // #define LED_MERGE_NUMPAD_LEFT_HANDED_PLUS TRUE // #define LED_MERGE_NUMPAD_LEFT_HANDED_ENTER TRUE // #define LED_MERGE_NUMPAD_LEFT_HANDED_ZERO TRUE +#define MO_NLCK LT(1, KC_NLCK) // Numlock on tap, layer change on hold -#define MO_NLCK LT(1, KC_NLCK) // Numlock on tap, layer change on hold - +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [0] = LAYOUT_left_handed( KC_MUTE, KC_MPLY, @@ -42,8 +40,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______ ) }; +// clang-format of -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_VOLU); @@ -57,5 +56,5 @@ void encoder_update_user(uint8_t index, bool clockwise) { tap_code(KC_MPRV); } } + return true; } - diff --git a/keyboards/hub20/keymaps/right_hand_numpad/keymap.c b/keyboards/hub20/keymaps/right_hand_numpad/keymap.c index 89466d31ba..ad3e5f49a3 100644 --- a/keyboards/hub20/keymaps/right_hand_numpad/keymap.c +++ b/keyboards/hub20/keymaps/right_hand_numpad/keymap.c @@ -15,15 +15,13 @@ */ #include QMK_KEYBOARD_H - - // #define LED_MERGE_NUMPAD_RIGHT_HANDED_PLUS TRUE // #define LED_MERGE_NUMPAD_RIGHT_HANDED_ENTER TRUE // #define LED_MERGE_NUMPAD_RIGHT_HANDED_ZERO TRUE +#define MO_NLCK LT(1, KC_NLCK) // Numlock on tap, layer change on hold -#define MO_NLCK LT(1, KC_NLCK) // Numlock on tap, layer change on hold - +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { //NOT TESTED, WAITING ENDORSEMENT FROM MANUFACTURER @@ -44,11 +42,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, _______ ) }; +// clang-format on - - - -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_VOLU); @@ -62,5 +58,5 @@ void encoder_update_user(uint8_t index, bool clockwise) { tap_code(KC_MPRV); } } + return true; } - diff --git a/keyboards/manyboard/macro/keymaps/default/keymap.c b/keyboards/manyboard/macro/keymaps/default/keymap.c index 4feda50808..0b9d2ac927 100644 --- a/keyboards/manyboard/macro/keymaps/default/keymap.c +++ b/keyboards/manyboard/macro/keymaps/default/keymap.c @@ -15,59 +15,61 @@ */ #include QMK_KEYBOARD_H - +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [0] = LAYOUT_ortho_4x4( - KC_F1, KC_F2, KC_F3, KC_F4, - KC_F5, KC_F6, KC_F7, KC_F8, - KC_F9, KC_F10, KC_F11, KC_F12, + [0] = LAYOUT_ortho_4x4( + KC_F1, KC_F2, KC_F3, KC_F4, + KC_F5, KC_F6, KC_F7, KC_F8, + KC_F9, KC_F10, KC_F11, KC_F12, KC_F13, KC_F14, KC_F15, TO(1) ), - [1] = LAYOUT_ortho_4x4( - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + [1] = LAYOUT_ortho_4x4( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, TO(2) ), - [2] = LAYOUT_ortho_4x4( - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + [2] = LAYOUT_ortho_4x4( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, TO(0) ), }; +// clang-format on layer_state_t layer_state_set_user(layer_state_t state) { switch (get_highest_layer(state)) { - case 0: - sethsv(HSV_WHITE, (LED_TYPE *)&led[0]); - rgblight_set(); - break; - case 1: - sethsv(HSV_GREEN, (LED_TYPE *)&led[0]); - rgblight_set(); - break; - case 2: - sethsv(HSV_BLUE, (LED_TYPE *)&led[0]); - rgblight_set(); - break; - } - return state; + case 0: + sethsv(HSV_WHITE, (LED_TYPE *)&led[0]); + rgblight_set(); + break; + case 1: + sethsv(HSV_GREEN, (LED_TYPE *)&led[0]); + rgblight_set(); + break; + case 2: + sethsv(HSV_BLUE, (LED_TYPE *)&led[0]); + rgblight_set(); + break; + } + return state; } -void 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. */ - if (clockwise) { - /* This is where the actual magic happens: this bit of code taps on the - Page Down key. You can do anything QMK allows you to do here. - You'll want to replace these lines with the things you want your - encoders to do. */ - tap_code(KC_AUDIO_VOL_UP); - } else { - /* And likewise for the other direction, this time Vol Down is pressed. */ - tap_code(KC_AUDIO_VOL_DOWN); +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. */ + if (clockwise) { + /* This is where the actual magic happens: this bit of code taps on the + Page Down key. You can do anything QMK allows you to do here. + You'll want to replace these lines with the things you want your + encoders to do. */ + tap_code(KC_AUDIO_VOL_UP); + } else { + /* And likewise for the other direction, this time Vol Down is pressed. */ + tap_code(KC_AUDIO_VOL_DOWN); + } } - } + return true; } diff --git a/keyboards/manyboard/macro/keymaps/via/keymap.c b/keyboards/manyboard/macro/keymaps/via/keymap.c index ce32d6d242..0b9d2ac927 100644 --- a/keyboards/manyboard/macro/keymaps/via/keymap.c +++ b/keyboards/manyboard/macro/keymaps/via/keymap.c @@ -15,58 +15,61 @@ */ #include QMK_KEYBOARD_H - +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [0] = LAYOUT_ortho_4x4( - KC_F1, KC_F2, KC_F3, KC_F4, - KC_F5, KC_F6, KC_F7, KC_F8, - KC_F9, KC_F10, KC_F11, KC_F12, + [0] = LAYOUT_ortho_4x4( + KC_F1, KC_F2, KC_F3, KC_F4, + KC_F5, KC_F6, KC_F7, KC_F8, + KC_F9, KC_F10, KC_F11, KC_F12, KC_F13, KC_F14, KC_F15, TO(1) ), - [1] = LAYOUT_ortho_4x4( - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + [1] = LAYOUT_ortho_4x4( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, TO(2) ), - [2] = LAYOUT_ortho_4x4( - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + [2] = LAYOUT_ortho_4x4( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, TO(0) ), }; +// clang-format on + layer_state_t layer_state_set_user(layer_state_t state) { switch (get_highest_layer(state)) { - case 0: - sethsv(HSV_WHITE, (LED_TYPE *)&led[0]); - rgblight_set(); - break; - case 1: - sethsv(HSV_GREEN, (LED_TYPE *)&led[0]); - rgblight_set(); - break; - case 2: - sethsv(HSV_BLUE, (LED_TYPE *)&led[0]); - rgblight_set(); - break; - } - return state; + case 0: + sethsv(HSV_WHITE, (LED_TYPE *)&led[0]); + rgblight_set(); + break; + case 1: + sethsv(HSV_GREEN, (LED_TYPE *)&led[0]); + rgblight_set(); + break; + case 2: + sethsv(HSV_BLUE, (LED_TYPE *)&led[0]); + rgblight_set(); + break; + } + return state; } -void 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. */ - if (clockwise) { - /* This is where the actual magic happens: this bit of code taps on the - Page Down key. You can do anything QMK allows you to do here. - You'll want to replace these lines with the things you want your - encoders to do. */ - tap_code(KC_AUDIO_VOL_UP); - } else { - /* And likewise for the other direction, this time Vol Down is pressed. */ - tap_code(KC_AUDIO_VOL_DOWN); +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. */ + if (clockwise) { + /* This is where the actual magic happens: this bit of code taps on the + Page Down key. You can do anything QMK allows you to do here. + You'll want to replace these lines with the things you want your + encoders to do. */ + tap_code(KC_AUDIO_VOL_UP); + } else { + /* And likewise for the other direction, this time Vol Down is pressed. */ + tap_code(KC_AUDIO_VOL_DOWN); + } } - } + return true; } diff --git a/keyboards/nullbitsco/nibble/keymaps/oled_status/keymap.c b/keyboards/nullbitsco/nibble/keymaps/oled_status/keymap.c index b276a042b4..b3da173957 100644 --- a/keyboards/nullbitsco/nibble/keymaps/oled_status/keymap.c +++ b/keyboards/nullbitsco/nibble/keymaps/oled_status/keymap.c @@ -19,15 +19,13 @@ # include "oled_display.h" #endif -enum layer_names { - _MA, - _FN -}; +enum layer_names { _MA, _FN }; enum custom_keycodes { KC_CUST = SAFE_RANGE, }; +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_MA] = LAYOUT_ansi( KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_HOME, @@ -44,6 +42,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), }; +// clang-format on #ifdef OLED_DRIVER_ENABLE oled_rotation_t oled_init_user(oled_rotation_t rotation) { @@ -53,7 +52,7 @@ oled_rotation_t oled_init_user(oled_rotation_t rotation) { } void oled_task_user(void) { - if (timer_elapsed(oled_timer) >= 3000) { + if (timer_elapsed(oled_timer) >= 3000) { set_oled_mode(OLED_MODE_IDLE); } render_frame(); @@ -64,23 +63,22 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { // Send keystrokes to host keyboard, if connected (see readme) process_record_remote_kb(keycode, record); - switch(keycode) { + switch (keycode) { case RGB_TOG: if (record->event.pressed) { #ifdef OLED_DRIVER_ENABLE process_record_keymap_oled(keycode); #endif } - break; - case KC_CUST: //custom macro + break; + case KC_CUST: // custom macro if (record->event.pressed) { } - break; + break; } return true; } - bool encoder_update_user(uint8_t index, bool clockwise) { if (clockwise) { tap_code(KC_VOLU); diff --git a/keyboards/pearlboards/pandora/keymaps/default/keymap.c b/keyboards/pearlboards/pandora/keymaps/default/keymap.c index 1fd9fcfb4d..879ea04a1e 100644 --- a/keyboards/pearlboards/pandora/keymaps/default/keymap.c +++ b/keyboards/pearlboards/pandora/keymaps/default/keymap.c @@ -71,7 +71,7 @@ bool encoder_update_user(uint8_t index, bool clockwise) { return true; } // Encoder click function -void dip_switch_update_user(uint8_t index, bool active) { +bool dip_switch_update_user(uint8_t index, bool active) { switch (index) { /* First encoder */ case 0: @@ -80,4 +80,5 @@ void dip_switch_update_user(uint8_t index, bool active) { } break; } + return true; } diff --git a/keyboards/pearlboards/pandora/keymaps/via/keymap.c b/keyboards/pearlboards/pandora/keymaps/via/keymap.c index 01f9ef8f43..96a8b52247 100644 --- a/keyboards/pearlboards/pandora/keymaps/via/keymap.c +++ b/keyboards/pearlboards/pandora/keymaps/via/keymap.c @@ -85,7 +85,7 @@ bool encoder_update_ |