Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change aidansmithdotdev/fine40 to use Encoder Map #19912

Merged
merged 17 commits into from
Mar 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions keyboards/aidansmithdotdev/fine40/fine40.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion keyboards/aidansmithdotdev/fine40/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
},
"encoder": {
"rotary": [
{"pin_a": "D5", "pin_b": "B7", "resolution": 2}
{"pin_a": "B7", "pin_b": "D5", "resolution": 2}
]
},
"layouts": {
Expand Down
9 changes: 9 additions & 0 deletions keyboards/aidansmithdotdev/fine40/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions keyboards/aidansmithdotdev/fine40/keymaps/default/rules.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ENCODER_MAP_ENABLE = yes
9 changes: 9 additions & 0 deletions keyboards/aidansmithdotdev/fine40/keymaps/via/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 2 additions & 1 deletion keyboards/aidansmithdotdev/fine40/keymaps/via/rules.mk
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
VIA_ENABLE = yes
VIA_ENABLE = yes
ENCODER_MAP_ENABLE = yes