summaryrefslogtreecommitdiff
path: root/keyboards/nightly_boards/n40_o
diff options
context:
space:
mode:
authorjack <0x6A73@pm.me>2023-06-19 09:46:27 -0600
committerGitHub <noreply@github.com>2023-06-19 09:46:27 -0600
commitc4a67d3f3302f3096bb6b15921c9587643164ba9 (patch)
treebf10e469333ba42b708e76cfc085eb450d92359e /keyboards/nightly_boards/n40_o
parent74fbd5a0313769655914166bc872d41461509bd3 (diff)
Remove encoder in-matrix workaround code (#20389)
Diffstat (limited to 'keyboards/nightly_boards/n40_o')
-rw-r--r--keyboards/nightly_boards/n40_o/config.h4
-rw-r--r--keyboards/nightly_boards/n40_o/encoder_action.c47
-rw-r--r--keyboards/nightly_boards/n40_o/encoder_action.h23
-rw-r--r--keyboards/nightly_boards/n40_o/info.json67
-rw-r--r--keyboards/nightly_boards/n40_o/keymaps/via/keymap.c56
-rw-r--r--keyboards/nightly_boards/n40_o/keymaps/via/rules.mk3
-rw-r--r--keyboards/nightly_boards/n40_o/n40_o.c29
-rw-r--r--keyboards/nightly_boards/n40_o/rules.mk3
8 files changed, 34 insertions, 198 deletions
diff --git a/keyboards/nightly_boards/n40_o/config.h b/keyboards/nightly_boards/n40_o/config.h
index 3a25ad1261..43e0b691c6 100644
--- a/keyboards/nightly_boards/n40_o/config.h
+++ b/keyboards/nightly_boards/n40_o/config.h
@@ -28,10 +28,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define RGBLIGHT_EFFECT_ALTERNATING
#define RGBLIGHT_EFFECT_TWINKLE
-/* Encoders */
-#define ENCODERS_CW_KEY { { 2, 4 },{ 4, 4 },{ 6, 4 } }
-#define ENCODERS_CCW_KEY { { 1, 4 },{ 3, 4 },{ 5, 4 } }
-
/* Audio */
#define AUDIO_PIN B7
diff --git a/keyboards/nightly_boards/n40_o/encoder_action.c b/keyboards/nightly_boards/n40_o/encoder_action.c
deleted file mode 100644
index 522fb58d5a..0000000000
--- a/keyboards/nightly_boards/n40_o/encoder_action.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* Copyright 2020 Neil Brian Ramirez
- *
- * 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 3 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 <http://www.gnu.org/licenses/>.
- */
-
-#include "encoder_action.h"
-
-static uint8_t encoder_state[NUM_ENCODERS] = {0};
-static keypos_t encoder_cw[NUM_ENCODERS] = ENCODERS_CW_KEY;
-static keypos_t encoder_ccw[NUM_ENCODERS] = ENCODERS_CCW_KEY;
-
-void encoder_action_unregister(void) {
- for (int index = 0; index < NUM_ENCODERS; ++index) {
- if (encoder_state[index]) {
- keyevent_t encoder_event = (keyevent_t) {
- .key = encoder_state[index] >> 1 ? encoder_cw[index] : encoder_ccw[index],
- .pressed = false,
- .time = timer_read(),
- .type = KEY_EVENT
- };
- encoder_state[index] = 0;
- action_exec(encoder_event);
- }
- }
-}
-
-void encoder_action_register(uint8_t index, bool clockwise) {
- keyevent_t encoder_event = (keyevent_t) {
- .key = clockwise ? encoder_cw[index] : encoder_ccw[index],
- .pressed = true,
- .time = timer_read(),
- .type = KEY_EVENT
- };
- encoder_state[index] = (clockwise ^ 1) | (clockwise << 1);
- action_exec(encoder_event);
-}
diff --git a/keyboards/nightly_boards/n40_o/encoder_action.h b/keyboards/nightly_boards/n40_o/encoder_action.h
deleted file mode 100644
index fb22632632..0000000000
--- a/keyboards/nightly_boards/n40_o/encoder_action.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Copyright 2020 Neil Brian Ramirez
- *
- * 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 3 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 <http://www.gnu.org/licenses/>.
- */
-
-#pragma once
-
-#include "quantum.h"
-
-void encoder_action_unregister(void);
-
-void encoder_action_register(uint8_t index, bool clockwise); \ No newline at end of file
diff --git a/keyboards/nightly_boards/n40_o/info.json b/keyboards/nightly_boards/n40_o/info.json
index 967dd81793..78506bb728 100644
--- a/keyboards/nightly_boards/n40_o/info.json
+++ b/keyboards/nightly_boards/n40_o/info.json
@@ -10,7 +10,7 @@
},
"matrix_pins": {
"cols": ["B5", "C7", "D6", "D4", "B3", "B2", "B1", "B0", "D5", "D3", "D2", "D1", "D0"],
- "rows": ["E6", "F0", "F1", "D7", null]
+ "rows": ["E6", "F0", "F1", "D7"]
},
"diode_direction": "COL2ROW",
"encoder": {
@@ -29,71 +29,6 @@
"processor": "atmega32u4",
"bootloader": "atmel-dfu",
"layouts": {
- "LAYOUT_ortho_4x13_encoders": {
- "layout": [
- {"matrix": [4, 1], "x": 0, "y": 0},
- {"matrix": [4, 2], "x": 1, "y": 0},
- {"matrix": [0, 0], "x": 2.25, "y": 0},
- {"matrix": [0, 1], "x": 3.5, "y": 0},
- {"matrix": [0, 2], "x": 4.5, "y": 0},
- {"matrix": [0, 3], "x": 5.5, "y": 0},
- {"matrix": [0, 4], "x": 6.5, "y": 0},
- {"matrix": [0, 5], "x": 7.5, "y": 0},
- {"matrix": [0, 6], "x": 8.5, "y": 0},
- {"matrix": [0, 7], "x": 9.5, "y": 0},
- {"matrix": [0, 8], "x": 10.5, "y": 0},
- {"matrix": [0, 9], "x": 11.5, "y": 0},
- {"matrix": [0, 10], "x": 12.5, "y": 0},
- {"matrix": [0, 11], "x": 13.5, "y": 0},
- {"matrix": [0, 12], "x": 14.5, "y": 0},
-
- {"matrix": [4, 3], "x": 0, "y": 1},
- {"matrix": [4, 4], "x": 1, "y": 1},
- {"matrix": [1, 0], "x": 2.25, "y": 1},
- {"matrix": [1, 1], "x": 3.5, "y": 1},
- {"matrix": [1, 2], "x": 4.5, "y": 1},
- {"matrix": [1, 3], "x": 5.5, "y": 1},
- {"matrix": [1, 4], "x": 6.5, "y": 1},
- {"matrix": [1, 5], "x": 7.5, "y": 1},
- {"matrix": [1, 6], "x": 8.5, "y": 1},
- {"matrix": [1, 7], "x": 9.5, "y": 1},
- {"matrix": [1, 8], "x": 10.5, "y": 1},
- {"matrix": [1, 9], "x": 11.5, "y": 1},
- {"matrix": [1, 10], "x": 12.5, "y": 1},
- {"matrix": [1, 11], "x": 13.5, "y": 1},
- {"matrix": [1, 12], "x": 14.5, "y": 1},
-
- {"matrix": [4, 5], "x": 0, "y": 2},
- {"matrix": [4, 6], "x": 1, "y": 2},
- {"matrix": [2, 0], "x": 2.25, "y": 2},
- {"matrix": [2, 1], "x": 3.5, "y": 2},
- {"matrix": [2, 2], "x": 4.5, "y": 2},
- {"matrix": [2, 3], "x": 5.5, "y": 2},
- {"matrix": [2, 4], "x": 6.5, "y": 2},
- {"matrix": [2, 5], "x": 7.5, "y": 2},
- {"matrix": [2, 6], "x": 8.5, "y": 2},
- {"matrix": [2, 7], "x": 9.5, "y": 2},
- {"matrix": [2, 8], "x": 10.5, "y": 2},
- {"matrix": [2, 9], "x": 11.5, "y": 2},
- {"matrix": [2, 10], "x": 12.5, "y": 2},
- {"matrix": [2, 11], "x": 13.5, "y": 2},
- {"matrix": [2, 12], "x": 14.5, "y": 2},
-
- {"matrix": [3, 0], "x": 2.25, "y": 3},
- {"matrix": [3, 1], "x": 3.5, "y": 3},
- {"matrix": [3, 2], "x": 4.5, "y": 3},
- {"matrix": [3, 3], "x": 5.5, "y": 3},
- {"matrix": [3, 4], "x": 6.5, "y": 3},
- {"matrix": [3, 5], "x": 7.5, "y": 3},
- {"matrix": [3, 6], "x": 8.5, "y": 3},
- {"matrix": [3, 7], "x": 9.5, "y": 3},
- {"matrix": [3, 8], "x": 10.5, "y": 3},
- {"matrix": [3, 9], "x": 11.5, "y": 3},
- {"matrix": [3, 10], "x": 12.5, "y": 3},
- {"matrix": [3, 11], "x": 13.5, "y": 3},
- {"matrix": [3, 12], "x": 14.5, "y": 3}
- ]
- },
"LAYOUT_ortho_4x13": {
"layout": [
{"matrix": [0, 0], "x": 0, "y": 0},
diff --git a/keyboards/nightly_boards/n40_o/keymaps/via/keymap.c b/keyboards/nightly_boards/n40_o/keymaps/via/keymap.c
index 830d8d8782..8ad25a8f25 100644
--- a/keyboards/nightly_boards/n40_o/keymaps/via/keymap.c
+++ b/keyboards/nightly_boards/n40_o/keymaps/via/keymap.c
@@ -17,32 +17,38 @@
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
- [0] = LAYOUT_ortho_4x13_encoders(
- KC_SPC, KC_SPC, KC_SPC, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
- KC_SPC, KC_SPC, KC_SPC, KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
- KC_SPC, KC_SPC, KC_SPC, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT,
- KC_SPC, KC_SPC, KC_LCTL, KC_LALT, KC_LGUI, MO(1), KC_SPC, KC_SPC, MO(2), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT
-
- ),
- [1] = LAYOUT_ortho_4x13_encoders(
- 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,
- 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,
- 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,
- 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
-
+ [0] = LAYOUT_ortho_4x13(
+ KC_SPC, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
+ KC_SPC, KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
+ KC_SPC, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT,
+ KC_SPC, KC_SPC, KC_LCTL, KC_LALT, KC_LGUI, MO(1), KC_SPC, KC_SPC, MO(2), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT
+
),
- [2] = LAYOUT_ortho_4x13_encoders(
- 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,
- 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,
- 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,
- 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
-
+ [1] = LAYOUT_ortho_4x13(
+ 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, 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, 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, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
),
- [3] = LAYOUT_ortho_4x13_encoders(
- 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,
- 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,
- 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,
- 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
-
+ [2] = LAYOUT_ortho_4x13(
+ 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, 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, 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, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
),
+ [3] = LAYOUT_ortho_4x13(
+ 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, 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, 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, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
+ )
+};
+
+#ifdef ENCODER_MAP_ENABLE
+const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
+ [0] = { ENCODER_CCW_CW(KC_PGUP, KC_PGDN), ENCODER_CCW_CW(KC_VOLD, KC_VOLU), ENCODER_CCW_CW(KC_MPRV, KC_MNXT) },
+ [1] = { ENCODER_CCW_CW(RGB_HUD, RGB_HUI), ENCODER_CCW_CW(RGB_SAD, RGB_SAI), ENCODER_CCW_CW(RGB_VAD, RGB_VAI) },
+ [2] = { ENCODER_CCW_CW(_______, _______), ENCODER_CCW_CW(_______, _______), ENCODER_CCW_CW(_______, _______) },
+ [3] = { ENCODER_CCW_CW(_______, _______), ENCODER_CCW_CW(_______, _______), ENCODER_CCW_CW(_______, _______) }
};
+#endif
diff --git a/keyboards/nightly_boards/n40_o/keymaps/via/rules.mk b/keyboards/nightly_boards/n40_o/keymaps/via/rules.mk
index 43061db1dd..1189f4ad19 100644
--- a/keyboards/nightly_boards/n40_o/keymaps/via/rules.mk
+++ b/keyboards/nightly_boards/n40_o/keymaps/via/rules.mk
@@ -1,2 +1,3 @@
VIA_ENABLE = yes
-LTO_ENABLE = yes \ No newline at end of file
+LTO_ENABLE = yes
+ENCODER_MAP_ENABLE = yes
diff --git a/keyboards/nightly_boards/n40_o/n40_o.c b/keyboards/nightly_boards/n40_o/n40_o.c
deleted file mode 100644
index 643803f903..0000000000
--- a/keyboards/nightly_boards/n40_o/n40_o.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Copyright 2020 Neil Brian Ramirez
- *
- * 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 <http://www.gnu.org/licenses/>.
- */
-
-#include "quantum.h"
-#include "encoder_action.h"
-
-void matrix_scan_kb(void) {
- encoder_action_unregister();
- matrix_scan_user();
-}
-
-bool encoder_update_kb(uint8_t index, bool clockwise) {
-// if (!encoder_update_user(index, clockwise)) return false;
- encoder_action_register(index, clockwise);
- return true;
-};
diff --git a/keyboards/nightly_boards/n40_o/rules.mk b/keyboards/nightly_boards/n40_o/rules.mk
index f1189a87d2..a81ce0571d 100644
--- a/keyboards/nightly_boards/n40_o/rules.mk
+++ b/keyboards/nightly_boards/n40_o/rules.mk
@@ -12,6 +12,3 @@ RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow
AUDIO_ENABLE = yes # Audio output
ENCODER_ENABLE = yes # Enable Rotary Encoders
LTO_ENABLE = yes
-
-# Added encoder Action
-SRC += encoder_action.c \ No newline at end of file