Skip to content

Commit

Permalink
feat: added encoder support to via and QK_BOOT implmentation
Browse files Browse the repository at this point in the history
* Added encoder support, fixed keymap between via and Cory Dora mapping. Added
QK_BOOT to flash without having to open the entire case up.

* Fixed config issues. Encoder is now clickable
  • Loading branch information
layogtima authored Oct 10, 2024
1 parent be84461 commit 54e9a13
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 20 deletions.
1 change: 0 additions & 1 deletion keyboards/handwired/corydora/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,3 @@
#define ENCODERS_PAD_A { GP4 }
#define ENCODERS_PAD_B { GP5 }
#define DIP_SWITCH_PINS { GP6 }

28 changes: 19 additions & 9 deletions keyboards/handwired/corydora/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,19 @@
"mousekey": true,
"nkro": true
},
"encoder": {
"enabled": true,
"rotary": [
{"pin_a": "GP4", "pin_b": "GP5"}
]
},
"dip_switch" : {
"enabled": true,
"pins": ["GP6"]
},
"matrix_pins": {
"rows": ["GP14", "GP15", "GP26"],
"cols": ["GP27", "GP28", "GP29"]
"cols": ["GP29", "GP28", "GP27"]
},
"processor": "RP2040",
"url": "",
Expand All @@ -26,15 +36,15 @@
"layouts": {
"LAYOUT_ortho_3x3": {
"layout": [
{ "matrix": [0, 0], "x": 0, "y": 0 },
{ "matrix": [0, 1], "x": 1, "y": 0 },
{ "matrix": [0, 2], "x": 2, "y": 0 },
{ "matrix": [1, 0], "x": 0, "y": 1 },
{ "matrix": [0, 0], "x": 0, "y": 2 },
{ "matrix": [0, 1], "x": 0, "y": 1 },
{ "matrix": [0, 2], "x": 0, "y": 0 },
{ "matrix": [1, 0], "x": 1, "y": 2 },
{ "matrix": [1, 1], "x": 1, "y": 1 },
{ "matrix": [1, 2], "x": 2, "y": 1 },
{ "matrix": [2, 0], "x": 0, "y": 2 },
{ "matrix": [2, 1], "x": 1, "y": 2 },
{ "matrix": [2, 2], "x": 2, "y": 2 }
{ "matrix": [1, 2], "x": 1, "y": 0 },
{ "matrix": [2, 0], "x": 2, "y": 2 },
{ "matrix": [2, 1], "x": 2, "y": 1 },
{ "matrix": [2, 2], "x": 0, "y": 1 }
]
}
}
Expand Down
17 changes: 13 additions & 4 deletions keyboards/handwired/corydora/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ uint8_t current_layer = 0; // Tracks the current layer
uint16_t last_switch_time = 0; // Tracks the last time the layer was switched

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT_ortho_3x3(KC_3, KC_2, KC_1, KC_6, KC_5, KC_4, KC_9, KC_8, KC_7),
[1] = LAYOUT_ortho_3x3(KC_C, KC_B, KC_A, KC_F, KC_E, KC_D, KC_I, KC_H, KC_G),
[2] = LAYOUT_ortho_3x3(KC_3, KC_2, KC_1, KC_6, KC_5, KC_4, KC_9, KC_8, KC_7),
[3] = LAYOUT_ortho_3x3(KC_C, KC_B, KC_A, KC_F, KC_E, KC_D, KC_I, KC_H, KC_G),
[0] = LAYOUT_ortho_3x3(KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9),
[1] = LAYOUT_ortho_3x3(KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9),
[2] = LAYOUT_ortho_3x3(KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9),
[3] = LAYOUT_ortho_3x3(KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, QK_BOOT),
};

// OLED
Expand Down Expand Up @@ -64,6 +64,15 @@ bool oled_task_user() {

#endif

#if defined(ENCODER_MAP_ENABLE)
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = {
[0] = { ENCODER_CCW_CW(KC_BRID, KC_BRIU)},
[1] = { ENCODER_CCW_CW(KC_MS_WH_UP, KC_MS_WH_DOWN)},
[2] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU)},
[3] = { ENCODER_CCW_CW(KC_MNXT, KC_MPRV)}
};
#endif

// Encode Knob
bool encoder_update_user(uint8_t index, bool clockwise) {
if (index == 0) { /* First encoder */
Expand Down
11 changes: 10 additions & 1 deletion keyboards/handwired/corydora/keymaps/via/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later

#include QMK_KEYBOARD_H
#include "timer.h"
#include "timer.h"

#define NUM_LAYERS 4 // Constant for the number of layers
#define DEBOUNCE_TIME 200 // Debounce time in milliseconds
Expand Down Expand Up @@ -64,6 +64,15 @@ bool oled_task_user() {

#endif

#if defined(ENCODER_MAP_ENABLE)
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = {
[0] = { ENCODER_CCW_CW(KC_BRID, KC_BRIU)},
[1] = { ENCODER_CCW_CW(KC_MS_WH_UP, KC_MS_WH_DOWN)},
[2] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU)},
[3] = { ENCODER_CCW_CW(KC_MNXT, KC_MPRV)}
};
#endif

// Encode Knob
bool encoder_update_user(uint8_t index, bool clockwise) {
if (index == 0) { /* First encoder */
Expand Down
2 changes: 1 addition & 1 deletion keyboards/handwired/corydora/keymaps/via/rules.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VIA_ENABLE = yes

ENCODER_MAP_ENABLE = yes


2 changes: 1 addition & 1 deletion keyboards/handwired/corydora/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ Enter the bootloader in 3 ways:

* **Bootmagic reset**: Hold down the key at (0,0) in the matrix (usually the top left key or Escape) and plug in the keyboard
* **Physical reset button**: Briefly press the button on the back of the PCB - some may have pads you must short instead
* **Keycode in layout**: Press the key mapped to `QK_BOOT` if it is available
* **Keycode in layout**: Press the key mapped to `QK_BOOT` if it is available (default set to Key 9 of Profile #4!)
2 changes: 1 addition & 1 deletion keyboards/handwired/corydora/rules.mk
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This file intentionally left blank
OLED_ENABLE = yes
LTO_ENABLE = yes
ENCODER_ENABLE = yes
ENCODER_MAP_ENABLE = yes
DIP_SWITCH_ENABLE = yes
VIA_ENABLE = yes

Expand Down
4 changes: 2 additions & 2 deletions keyboards/handwired/corydora/via.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
"vendorId": "0x4344",
"productId": "0x0001",
"matrix": {
"rows": 3,
"rows": 4,
"cols": 3
},
"layouts": {
"keymap": [
["0,0", "0,1", "0,2"],
["1,0", "1,1", "1,2"],
["2,0", "2,1", "2,2"]
["2,0", "2,1", "2,2", "3,0\n\n\n\n\n\n\n\n\ne0"]
]
}
}

0 comments on commit 54e9a13

Please sign in to comment.