aboutsummaryrefslogtreecommitdiff
path: root/keyboards/ymdk_np21
diff options
context:
space:
mode:
authorDrashna Jaelre <drashna@live.com>2018-10-01 08:09:57 -0700
committerJack Humbert <jack.humb@gmail.com>2018-10-01 11:09:57 -0400
commit3907ed034bec6730d8bff401ac632161540ea3cb (patch)
tree345edb48870809e447ac308375d9427892864c88 /keyboards/ymdk_np21
parent9d949389f92b6b397ed62246b60ead86d80a57a1 (diff)
downloadqmk_firmware-3907ed034bec6730d8bff401ac632161540ea3cb.tar.gz
qmk_firmware-3907ed034bec6730d8bff401ac632161540ea3cb.zip
Fix YMDK NP21 keyboard to use proper keyboard level functions (#3042)
* Use proper function levels * Add matrix init functions * Convert KEYMAP to LAYOUT Or @mechmerlin is going to hunt me down and harm me... probably :) * Fix conflict issues
Diffstat (limited to 'keyboards/ymdk_np21')
-rw-r--r--keyboards/ymdk_np21/keymaps/default/keymap.c7
-rw-r--r--keyboards/ymdk_np21/matrix.c11
-rw-r--r--keyboards/ymdk_np21/ymdk_np21.c6
-rw-r--r--keyboards/ymdk_np21/ymdk_np21.h4
4 files changed, 19 insertions, 9 deletions
diff --git a/keyboards/ymdk_np21/keymaps/default/keymap.c b/keyboards/ymdk_np21/keymaps/default/keymap.c
index e79d326b7..3ade30479 100644
--- a/keyboards/ymdk_np21/keymaps/default/keymap.c
+++ b/keyboards/ymdk_np21/keymaps/default/keymap.c
@@ -1,5 +1,4 @@
1#include "ymdk_np21.h" 1#include QMK_KEYBOARD_H
2#include "action_layer.h"
3 2
4#define _NP 0 3#define _NP 0
5#define _BL 1 4#define _BL 1
@@ -21,7 +20,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
21 * | Enter| Enter| + | + | - | FN | 20 * | Enter| Enter| + | + | - | FN |
22 * `-----------------------------------------' 21 * `-----------------------------------------'
23 */ 22 */
24[_NP] = KEYMAP( \ 23[_NP] = LAYOUT( \
25 KC_KP_0, KC_KP_1, KC_KP_4, KC_KP_7, KC_NUMLOCK, KC_ESC, \ 24 KC_KP_0, KC_KP_1, KC_KP_4, KC_KP_7, KC_NUMLOCK, KC_ESC, \
26 KC_DOT, KC_KP_2, KC_KP_5, KC_KP_8, KC_KP_SLASH, KC_TAB, \ 25 KC_DOT, KC_KP_2, KC_KP_5, KC_KP_8, KC_KP_SLASH, KC_TAB, \
27 KC_KP_DOT, KC_KP_3, KC_KP_6, KC_KP_9, KC_KP_ASTERISK, KC_BSPACE, \ 26 KC_KP_DOT, KC_KP_3, KC_KP_6, KC_KP_9, KC_KP_ASTERISK, KC_BSPACE, \
@@ -38,7 +37,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
38 * | BL_DEC | BL_DEC | BL_INC | BL_INC | | | 37 * | BL_DEC | BL_DEC | BL_INC | BL_INC | | |
39 * `---------------------------------------------' 38 * `---------------------------------------------'
40 */ 39 */
41[_BL] = KEYMAP( \ 40[_BL] = LAYOUT( \
42 BL_BRTG, _______, _______, _______, _______, _______, \ 41 BL_BRTG, _______, _______, _______, _______, _______, \
43 _______, BL_OFF, BL_TOGG, BL_ON, _______, _______, \ 42 _______, BL_OFF, BL_TOGG, BL_ON, _______, _______, \
44 _______, _______, _______, _______, _______, _______, \ 43 _______, _______, _______, _______, _______, _______, \
diff --git a/keyboards/ymdk_np21/matrix.c b/keyboards/ymdk_np21/matrix.c
index a9e9cb539..b2bfb2f0b 100644
--- a/keyboards/ymdk_np21/matrix.c
+++ b/keyboards/ymdk_np21/matrix.c
@@ -91,12 +91,23 @@ uint8_t matrix_scan(void) {
91 return 1; 91 return 1;
92} 92}
93 93
94__attribute__ ((weak))
95void matrix_scan_user(void) {};
96
97__attribute__ ((weak))
94void matrix_scan_kb(void) { 98void matrix_scan_kb(void) {
95 // Looping keyboard code goes here 99 // Looping keyboard code goes here
96 // This runs every cycle (a lot) 100 // This runs every cycle (a lot)
97 matrix_scan_user(); 101 matrix_scan_user();
98}; 102};
99 103
104__attribute__ ((weak))
105void matrix_init_user(void) {};
106
107__attribute__ ((weak))
108void matrix_init_kb(void) {
109 matrix_init_user();
110}
100// declarations 111// declarations
101void matrix_set_row_status(uint8_t row) { 112void matrix_set_row_status(uint8_t row) {
102 DDRB = (1 << row); 113 DDRB = (1 << row);
diff --git a/keyboards/ymdk_np21/ymdk_np21.c b/keyboards/ymdk_np21/ymdk_np21.c
index 670083a11..c1b11b404 100644
--- a/keyboards/ymdk_np21/ymdk_np21.c
+++ b/keyboards/ymdk_np21/ymdk_np21.c
@@ -34,7 +34,7 @@ extern rgblight_config_t rgblight_config;
34// @Override 34// @Override
35void matrix_init_kb(void) { 35void matrix_init_kb(void) {
36 // call user level keymaps, if any 36 // call user level keymaps, if any
37 // matrix_init_user(); 37 matrix_init_user();
38} 38}
39 39
40#ifdef BACKLIGHT_ENABLE 40#ifdef BACKLIGHT_ENABLE
@@ -67,7 +67,7 @@ void rgblight_set(void) {
67} 67}
68 68
69bool rgb_init = false; 69bool rgb_init = false;
70void matrix_scan_user(void) { 70void matrix_scan_kb(void) {
71 // if LEDs were previously on before poweroff, turn them back on 71 // if LEDs were previously on before poweroff, turn them back on
72 if (rgb_init == false && rgblight_config.enable) { 72 if (rgb_init == false && rgblight_config.enable) {
73 i2c_init(); 73 i2c_init();
@@ -77,4 +77,6 @@ void matrix_scan_user(void) {
77 77
78 rgblight_task(); 78 rgblight_task();
79 /* Nothing else for now. */ 79 /* Nothing else for now. */
80
81 matrix_scan_user();
80} 82}
diff --git a/keyboards/ymdk_np21/ymdk_np21.h b/keyboards/ymdk_np21/ymdk_np21.h
index babdc8483..728406d6e 100644
--- a/keyboards/ymdk_np21/ymdk_np21.h
+++ b/keyboards/ymdk_np21/ymdk_np21.h
@@ -25,7 +25,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
25 25
26void matrix_init_user(void); // TODO port this to other PS2AVRGB boards 26void matrix_init_user(void); // TODO port this to other PS2AVRGB boards
27 27
28#define KEYMAP_GRID( \ 28#define LAYOUT( \
29 K01, K02, K03, K04, K05, K06, \ 29 K01, K02, K03, K04, K05, K06, \
30 K11, K12, K13, K14, K15, K16, \ 30 K11, K12, K13, K14, K15, K16, \
31 K21, K22, K23, K24, K25, K26, \ 31 K21, K22, K23, K24, K25, K26, \
@@ -38,6 +38,4 @@ void matrix_init_user(void); // TODO port this to other PS2AVRGB boards
38 { K36, K35, K34, K33, K32, K31 } \ 38 { K36, K35, K34, K33, K32, K31 } \
39} 39}
40 40
41#define KEYMAP KEYMAP_GRID
42
43#endif 41#endif