diff options
author | Drashna Jaelre <drashna@live.com> | 2018-10-01 08:09:57 -0700 |
---|---|---|
committer | Jack Humbert <jack.humb@gmail.com> | 2018-10-01 11:09:57 -0400 |
commit | 3907ed034bec6730d8bff401ac632161540ea3cb (patch) | |
tree | 345edb48870809e447ac308375d9427892864c88 | |
parent | 9d949389f92b6b397ed62246b60ead86d80a57a1 (diff) | |
download | qmk_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
-rw-r--r-- | keyboards/ymdk_np21/keymaps/default/keymap.c | 7 | ||||
-rw-r--r-- | keyboards/ymdk_np21/matrix.c | 11 | ||||
-rw-r--r-- | keyboards/ymdk_np21/ymdk_np21.c | 6 | ||||
-rw-r--r-- | keyboards/ymdk_np21/ymdk_np21.h | 4 |
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 e79d326b7c..3ade30479f 100644 --- a/keyboards/ymdk_np21/keymaps/default/keymap.c +++ b/keyboards/ymdk_np21/keymaps/default/keymap.c @@ -1,5 +1,4 @@ -#include "ymdk_np21.h" -#include "action_layer.h" +#include QMK_KEYBOARD_H #define _NP 0 #define _BL 1 @@ -21,7 +20,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * | Enter| Enter| + | + | - | FN | * `-----------------------------------------' */ -[_NP] = KEYMAP( \ +[_NP] = LAYOUT( \ KC_KP_0, KC_KP_1, KC_KP_4, KC_KP_7, KC_NUMLOCK, KC_ESC, \ KC_DOT, KC_KP_2, KC_KP_5, KC_KP_8, KC_KP_SLASH, KC_TAB, \ 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] = { * | BL_DEC | BL_DEC | BL_INC | BL_INC | | | * `---------------------------------------------' */ -[_BL] = KEYMAP( \ +[_BL] = LAYOUT( \ BL_BRTG, _______, _______, _______, _______, _______, \ _______, BL_OFF, BL_TOGG, BL_ON, _______, _______, \ _______, _______, _______, _______, _______, _______, \ diff --git a/keyboards/ymdk_np21/matrix.c b/keyboards/ymdk_np21/matrix.c index a9e9cb5397..b2bfb2f0bb 100644 --- a/keyboards/ymdk_np21/matrix.c +++ b/keyboards/ymdk_np21/matrix.c @@ -91,12 +91,23 @@ uint8_t matrix_scan(void) { return 1; } +__attribute__ ((weak)) +void matrix_scan_user(void) {}; + +__attribute__ ((weak)) void matrix_scan_kb(void) { // Looping keyboard code goes here // This runs every cycle (a lot) matrix_scan_user(); }; +__attribute__ ((weak)) +void matrix_init_user(void) {}; + +__attribute__ ((weak)) +void matrix_init_kb(void) { + matrix_init_user(); +} // declarations void matrix_set_row_status(uint8_t row) { DDRB = (1 << row); diff --git a/keyboards/ymdk_np21/ymdk_np21.c b/keyboards/ymdk_np21/ymdk_np21.c index 670083a116..c1b11b4046 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; // @Override void matrix_init_kb(void) { // call user level keymaps, if any - // matrix_init_user(); + matrix_init_user(); } #ifdef BACKLIGHT_ENABLE @@ -67,7 +67,7 @@ void rgblight_set(void) { } bool rgb_init = false; -void matrix_scan_user(void) { +void matrix_scan_kb(void) { // if LEDs were previously on before poweroff, turn them back on if (rgb_init == false && rgblight_config.enable) { i2c_init(); @@ -77,4 +77,6 @@ void matrix_scan_user(void) { rgblight_task(); /* Nothing else for now. */ + + matrix_scan_user(); } diff --git a/keyboards/ymdk_np21/ymdk_np21.h b/keyboards/ymdk_np21/ymdk_np21.h index babdc84831..728406d6e5 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/>. void matrix_init_user(void); // TODO port this to other PS2AVRGB boards -#define KEYMAP_GRID( \ +#define LAYOUT( \ K01, K02, K03, K04, K05, K06, \ K11, K12, K13, K14, K15, K16, \ K21, K22, K23, K24, K25, K26, \ @@ -38,6 +38,4 @@ void matrix_init_user(void); // TODO port this to other PS2AVRGB boards { K36, K35, K34, K33, K32, K31 } \ } -#define KEYMAP KEYMAP_GRID - #endif |