From 31ab01dce077d1788974505a4781f1cbdb3a6e5d Mon Sep 17 00:00:00 2001 From: Aidan Smith Date: Tue, 7 Mar 2023 16:06:00 -0500 Subject: Change aidansmithdotdev/fine40 to use Encoder Map (#19912) Co-authored-by: Joel Challis Co-authored-by: jack <0x6a73@protonmail.com> --- keyboards/aidansmithdotdev/fine40/fine40.c | 20 ++++++++++---------- keyboards/aidansmithdotdev/fine40/info.json | 2 +- .../aidansmithdotdev/fine40/keymaps/default/keymap.c | 9 +++++++++ .../aidansmithdotdev/fine40/keymaps/default/rules.mk | 1 + .../aidansmithdotdev/fine40/keymaps/via/keymap.c | 9 +++++++++ .../aidansmithdotdev/fine40/keymaps/via/rules.mk | 3 ++- 6 files changed, 32 insertions(+), 12 deletions(-) create mode 100644 keyboards/aidansmithdotdev/fine40/keymaps/default/rules.mk (limited to 'keyboards/aidansmithdotdev') diff --git a/keyboards/aidansmithdotdev/fine40/fine40.c b/keyboards/aidansmithdotdev/fine40/fine40.c index 73c453b6c0..0bd190321a 100644 --- a/keyboards/aidansmithdotdev/fine40/fine40.c +++ b/keyboards/aidansmithdotdev/fine40/fine40.c @@ -71,15 +71,15 @@ bool oled_task_kb(void) { #ifdef ENCODER_ENABLE bool encoder_update_kb(uint8_t index, bool clockwise) { - if (!encoder_update_user(index, clockwise)) { - return false; - } - // Volume control - if (clockwise) { - tap_code(KC_VOLU); - } else { - tap_code(KC_VOLD); - } - return false; + if (!encoder_update_user(index, clockwise)) { + return false; + } + // Volume control + if (clockwise) { + tap_code(KC_VOLU); + } else { + tap_code(KC_VOLD); + } + return true; } #endif \ No newline at end of file diff --git a/keyboards/aidansmithdotdev/fine40/info.json b/keyboards/aidansmithdotdev/fine40/info.json index c41557a920..eb0ec8f143 100644 --- a/keyboards/aidansmithdotdev/fine40/info.json +++ b/keyboards/aidansmithdotdev/fine40/info.json @@ -27,7 +27,7 @@ }, "encoder": { "rotary": [ - {"pin_a": "D5", "pin_b": "B7", "resolution": 2} + {"pin_a": "B7", "pin_b": "D5", "resolution": 2} ] }, "layouts": { diff --git a/keyboards/aidansmithdotdev/fine40/keymaps/default/keymap.c b/keyboards/aidansmithdotdev/fine40/keymaps/default/keymap.c index d157d9db31..69b9dacd27 100644 --- a/keyboards/aidansmithdotdev/fine40/keymaps/default/keymap.c +++ b/keyboards/aidansmithdotdev/fine40/keymaps/default/keymap.c @@ -41,3 +41,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______ , _______ , _______ , _______ , _______ , _______ , _______ , KC_MS_L , KC_MS_D , KC_MS_U , KC_MS_R , _______ ), }; + +#if defined(ENCODER_MAP_ENABLE) +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = { + [_MAIN] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, + [_LEFT] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, + [_RIGHT] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, + [_TAB] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, +}; +#endif \ No newline at end of file diff --git a/keyboards/aidansmithdotdev/fine40/keymaps/default/rules.mk b/keyboards/aidansmithdotdev/fine40/keymaps/default/rules.mk new file mode 100644 index 0000000000..ee32568148 --- /dev/null +++ b/keyboards/aidansmithdotdev/fine40/keymaps/default/rules.mk @@ -0,0 +1 @@ +ENCODER_MAP_ENABLE = yes diff --git a/keyboards/aidansmithdotdev/fine40/keymaps/via/keymap.c b/keyboards/aidansmithdotdev/fine40/keymaps/via/keymap.c index d157d9db31..69b9dacd27 100644 --- a/keyboards/aidansmithdotdev/fine40/keymaps/via/keymap.c +++ b/keyboards/aidansmithdotdev/fine40/keymaps/via/keymap.c @@ -41,3 +41,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______ , _______ , _______ , _______ , _______ , _______ , _______ , KC_MS_L , KC_MS_D , KC_MS_U , KC_MS_R , _______ ), }; + +#if defined(ENCODER_MAP_ENABLE) +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = { + [_MAIN] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, + [_LEFT] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, + [_RIGHT] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, + [_TAB] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, +}; +#endif \ No newline at end of file diff --git a/keyboards/aidansmithdotdev/fine40/keymaps/via/rules.mk b/keyboards/aidansmithdotdev/fine40/keymaps/via/rules.mk index 036bd6d1c3..f1adcab005 100644 --- a/keyboards/aidansmithdotdev/fine40/keymaps/via/rules.mk +++ b/keyboards/aidansmithdotdev/fine40/keymaps/via/rules.mk @@ -1 +1,2 @@ -VIA_ENABLE = yes \ No newline at end of file +VIA_ENABLE = yes +ENCODER_MAP_ENABLE = yes -- cgit v1.2.3