From fc3f2dcb43f2aacdac017ac6c3f0b6ac0241162a Mon Sep 17 00:00:00 2001 From: Ramon Imbao Date: Wed, 14 Sep 2022 23:16:54 +0800 Subject: [Keyboard] Replace Nayeon ATmega32u4 config with RP2040 (#18265) --- keyboards/abatskeyboardclub/nayeon/config.h | 113 +-------------------- keyboards/abatskeyboardclub/nayeon/info.json | 15 ++- .../nayeon/keymaps/default/keymap.c | 34 ------- .../abatskeyboardclub/nayeon/keymaps/iso/keymap.c | 34 ------- .../abatskeyboardclub/nayeon/keymaps/via/keymap.c | 34 ------- keyboards/abatskeyboardclub/nayeon/nayeon.c | 27 +++++ keyboards/abatskeyboardclub/nayeon/readme.md | 2 +- keyboards/abatskeyboardclub/nayeon/rules.mk | 21 ++-- 8 files changed, 54 insertions(+), 226 deletions(-) diff --git a/keyboards/abatskeyboardclub/nayeon/config.h b/keyboards/abatskeyboardclub/nayeon/config.h index cb591b8e24..449f2da113 100644 --- a/keyboards/abatskeyboardclub/nayeon/config.h +++ b/keyboards/abatskeyboardclub/nayeon/config.h @@ -19,111 +19,8 @@ along with this program. If not, see . #include "config_common.h" -/* key matrix size */ -#define MATRIX_ROWS 6 -#define MATRIX_COLS 17 - -/* - * Keyboard Matrix Assignments - * - * Change this to how you wired your keyboard - * COLS: AVR pins used for columns, left to right - * ROWS: AVR pins used for rows, top to bottom - * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode) - * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode) - * - */ -#define MATRIX_ROW_PINS { B2, B3, B7, D6, D3, D2 } -#define MATRIX_COL_PINS { F0, F1, F4, F5, F6, F7, C7, C6, B6, B5, B4, D7, D4, D5, B0, B1, D1 } - -/* COL2ROW, ROW2COL */ -#define DIODE_DIRECTION COL2ROW - -/* - * Split Keyboard specific options, make sure you have 'SPLIT_KEYBOARD = yes' in your rules.mk, and define SOFT_SERIAL_PIN. - */ -#define SOFT_SERIAL_PIN D0 // or D1, D2, D3, E6 - -#define RGB_DI_PIN E2 -#ifdef RGB_DI_PIN -# define RGBLED_NUM 26 -# define RGBLIGHT_HUE_STEP 8 -# define RGBLIGHT_SAT_STEP 8 -# define RGBLIGHT_VAL_STEP 8 -//# define RGBLIGHT_LIMIT_VAL 255 /* The maximum brightness level */ -//# define RGBLIGHT_SLEEP /* If defined, the RGB lighting will be switched off when the host goes to sleep */ -/*== or choose animations ==*/ -# define RGBLIGHT_EFFECT_BREATHING -# define RGBLIGHT_EFFECT_RAINBOW_MOOD -# define RGBLIGHT_EFFECT_RAINBOW_SWIRL -//# define RGBLIGHT_EFFECT_SNAKE -//# define RGBLIGHT_EFFECT_KNIGHT -# define RGBLIGHT_EFFECT_CHRISTMAS -# define RGBLIGHT_EFFECT_STATIC_GRADIENT -# define RGBLIGHT_EFFECT_RGB_TEST -# define RGBLIGHT_EFFECT_ALTERNATING -/*== customize breathing effect ==*/ -/*==== (DEFAULT) use fixed table instead of exp() and sin() ====*/ -//# define RGBLIGHT_BREATHE_TABLE_SIZE 256 // 256(default) or 128 or 64 -/*==== use exp() and sin() ====*/ -//# define RGBLIGHT_EFFECT_BREATHE_CENTER 1.85 // 1 to 2.7 -//# define RGBLIGHT_EFFECT_BREATHE_MAX 255 // 0 to 255 -#endif - -/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ -#define DEBOUNCE 5 - -/* define if matrix has ghost (lacks anti-ghosting diodes) */ -//#define MATRIX_HAS_GHOST - -/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ -#define LOCKING_SUPPORT_ENABLE -/* Locking resynchronize hack */ -#define LOCKING_RESYNC_ENABLE - -/* If defined, GRAVE_ESC will always act as ESC when CTRL is held. - * This is useful for the Windows task manager shortcut (ctrl+shift+esc). - */ -//#define GRAVE_ESC_CTRL_OVERRIDE - -/* - * Force NKRO - * - * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved - * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the - * makefile for this to work.) - * - * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N) - * until the next keyboard reset. - * - * NKRO may prevent your keystrokes from being detected in the BIOS, but it is - * fully operational during normal computer usage. - * - * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N) - * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by - * bootmagic, NKRO mode will always be enabled until it is toggled again during a - * power-up. - * - */ -//#define FORCE_NKRO - -/* - * Feature disable options - * These options are also useful to firmware size reduction. - */ - -/* disable debug print */ -//#define NO_DEBUG - -/* disable print */ -//#define NO_PRINT - -/* disable action features */ -//#define NO_ACTION_LAYER -//#define NO_ACTION_TAPPING -//#define NO_ACTION_ONESHOT - - -/* Bootmagic Lite key configuration */ -//#define BOOTMAGIC_LITE_ROW 0 -//#define BOOTMAGIC_LITE_COLUMN 0 +/* RGB Matrix setup */ +#define RGB_DI_PIN GP19 +#define DRIVER_LED_TOTAL 2 +#define RGBLED_NUM 2 +#define WS2812_PIO_USE_PIO1 // Force the usage of PIO1 peripheral, by default the WS2812 implementation uses the PIO0 peripheral diff --git a/keyboards/abatskeyboardclub/nayeon/info.json b/keyboards/abatskeyboardclub/nayeon/info.json index acba956b06..8cafe5aebf 100644 --- a/keyboards/abatskeyboardclub/nayeon/info.json +++ b/keyboards/abatskeyboardclub/nayeon/info.json @@ -7,10 +7,23 @@ "LAYOUT_ansi": "LAYOUT_tkl_f13_ansi_tsangan", "LAYOUT_iso": "LAYOUT_tkl_f13_iso_tsangan" }, + "features": { + "bootmagic": true, + "mousekey": true, + "extrakey": true, + "console": false, + "command": false, + "nkro": false + }, "usb": { "vid": "0x4B47", "pid": "0x0001", - "device_version": "0.0.1" + "device_version": "2.0.0" + }, + "diode_direction": "COL2ROW", + "matrix_pins": { + "cols": ["GP29", "GP28", "GP27", "GP26", "GP25", "GP24", "GP23", "GP22", "GP18", "GP17", "GP16", "GP15", "GP14", "GP13", "GP12", "GP11", "GP5"], + "rows": ["GP0", "GP1", "GP2", "GP21", "GP3", "GP4"] }, "layouts": { "LAYOUT_tkl_f13_ansi_tsangan": { diff --git a/keyboards/abatskeyboardclub/nayeon/keymaps/default/keymap.c b/keyboards/abatskeyboardclub/nayeon/keymaps/default/keymap.c index 3ea63b5b24..134fbd4972 100644 --- a/keyboards/abatskeyboardclub/nayeon/keymaps/default/keymap.c +++ b/keyboards/abatskeyboardclub/nayeon/keymaps/default/keymap.c @@ -25,37 +25,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RGUI, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT ) }; - -#ifdef RGBLIGHT_ENABLE - -const rgblight_segment_t PROGMEM ll_none[] = RGBLIGHT_LAYER_SEGMENTS( - {0, 1, HSV_OFF}, - {1, 1, HSV_OFF} -); - -const rgblight_segment_t PROGMEM ll_cl[] = RGBLIGHT_LAYER_SEGMENTS( - {1, 1, HSV_OFF} -); - -const rgblight_segment_t PROGMEM ll_sl[] = RGBLIGHT_LAYER_SEGMENTS( - {0, 1, HSV_OFF} -); - -const rgblight_segment_t* const PROGMEM rgb_layers[] = RGBLIGHT_LAYERS_LIST(ll_none, ll_cl, ll_sl); - -void keyboard_post_init_user(void) { - rgblight_layers = rgb_layers; -} - -bool led_update_user(led_t led_state) { - uint8_t lock_bits = led_state.scroll_lock << 1 | led_state.caps_lock; - for (uint8_t i=0; i<3; i++) { - rgblight_set_layer_state(i, false); - } - if (lock_bits < 3) { - rgblight_set_layer_state(lock_bits, true); - } - - return false; -} -#endif diff --git a/keyboards/abatskeyboardclub/nayeon/keymaps/iso/keymap.c b/keyboards/abatskeyboardclub/nayeon/keymaps/iso/keymap.c index ae81182acc..74e74207a3 100644 --- a/keyboards/abatskeyboardclub/nayeon/keymaps/iso/keymap.c +++ b/keyboards/abatskeyboardclub/nayeon/keymaps/iso/keymap.c @@ -25,37 +25,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RGUI, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT ) }; - -#ifdef RGBLIGHT_ENABLE - -const rgblight_segment_t PROGMEM ll_none[] = RGBLIGHT_LAYER_SEGMENTS( - {0, 1, HSV_OFF}, - {1, 1, HSV_OFF} -); - -const rgblight_segment_t PROGMEM ll_cl[] = RGBLIGHT_LAYER_SEGMENTS( - {1, 1, HSV_OFF} -); - -const rgblight_segment_t PROGMEM ll_sl[] = RGBLIGHT_LAYER_SEGMENTS( - {0, 1, HSV_OFF} -); - -const rgblight_segment_t* const PROGMEM rgb_layers[] = RGBLIGHT_LAYERS_LIST(ll_none, ll_cl, ll_sl); - -void keyboard_post_init_user(void) { - rgblight_layers = rgb_layers; -} - -bool led_update_user(led_t led_state) { - uint8_t lock_bits = led_state.scroll_lock << 1 | led_state.caps_lock; - for (uint8_t i=0; i<3; i++) { - rgblight_set_layer_state(i, false); - } - if (lock_bits < 3) { - rgblight_set_layer_state(lock_bits, true); - } - - return false; -} -#endif diff --git a/keyboards/abatskeyboardclub/nayeon/keymaps/via/keymap.c b/keyboards/abatskeyboardclub/nayeon/keymaps/via/keymap.c index a212b820f4..062b05ec49 100644 --- a/keyboards/abatskeyboardclub/nayeon/keymaps/via/keymap.c +++ b/keyboards/abatskeyboardclub/nayeon/keymaps/via/keymap.c @@ -49,37 +49,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ) }; - -#ifdef RGBLIGHT_ENABLE - -const rgblight_segment_t PROGMEM ll_none[] = RGBLIGHT_LAYER_SEGMENTS( - {0, 1, HSV_OFF}, - {1, 1, HSV_OFF} -); - -const rgblight_segment_t PROGMEM ll_cl[] = RGBLIGHT_LAYER_SEGMENTS( - {1, 1, HSV_OFF} -); - -const rgblight_segment_t PROGMEM ll_sl[] = RGBLIGHT_LAYER_SEGMENTS( - {0, 1, HSV_OFF} -); - -const rgblight_segment_t* const PROGMEM rgb_layers[] = RGBLIGHT_LAYERS_LIST(ll_none, ll_cl, ll_sl); - -void keyboard_post_init_user(void) { - rgblight_layers = rgb_layers; -} - -bool led_update_user(led_t led_state) { - uint8_t lock_bits = led_state.scroll_lock << 1 | led_state.caps_lock; - for (uint8_t i=0; i<3; i++) { - rgblight_set_layer_state(i, false); - } - if (lock_bits < 3) { - rgblight_set_layer_state(lock_bits, true); - } - - return false; -} -#endif diff --git a/keyboards/abatskeyboardclub/nayeon/nayeon.c b/keyboards/abatskeyboardclub/nayeon/nayeon.c index 14fb22a486..6f367d3ed6 100644 --- a/keyboards/abatskeyboardclub/nayeon/nayeon.c +++ b/keyboards/abatskeyboardclub/nayeon/nayeon.c @@ -15,3 +15,30 @@ */ #include "nayeon.h" + +led_config_t g_led_config = {{ + // Key Matrix to LED Index + { NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, 1, NO_LED }, + { NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED }, + { NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED }, + { 0, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED }, + { NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED }, + { NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED } +}, { + // LED Index to Physical Position + { 5, 40 }, { 211, 0 } +}, { + // LED Index to Flag + LED_FLAG_INDICATOR, LED_FLAG_INDICATOR +}}; + +void rgb_matrix_indicators_advanced_kb(uint8_t led_min, uint8_t led_max) { + if (!host_keyboard_led_state().caps_lock) { + RGB_MATRIX_INDICATOR_SET_COLOR(0, 0, 0, 0); + } + if (!host_keyboard_led_state().scroll_lock) { + RGB_MATRIX_INDICATOR_SET_COLOR(1, 0, 0, 0); + } + + rgb_matrix_indicators_advanced_user(led_min, led_max); +} diff --git a/keyboards/abatskeyboardclub/nayeon/readme.md b/keyboards/abatskeyboardclub/nayeon/readme.md index f88c1e187d..7c7c91c1f1 100644 --- a/keyboards/abatskeyboardclub/nayeon/readme.md +++ b/keyboards/abatskeyboardclub/nayeon/readme.md @@ -5,7 +5,7 @@ Nayeon is a screwless TKL keyboard with an extra key, inspired by a K-pop artist named Im-Nayeon. * Keyboard Maintainer: [Ramon Imbao](https://github.com/ramonimbao) -* Hardware Supported: ATmega32u4 +* Hardware Supported: RP2040 Make example for this keyboard (after setting up your build environment): diff --git a/keyboards/abatskeyboardclub/nayeon/rules.mk b/keyboards/abatskeyboardclub/nayeon/rules.mk index e94c1ace18..d106ef4d6a 100644 --- a/keyboards/abatskeyboardclub/nayeon/rules.mk +++ b/keyboards/abatskeyboardclub/nayeon/rules.mk @@ -1,20 +1,13 @@ # MCU name -MCU = atmega32u4 +MCU = RP2040 # Bootloader selection -BOOTLOADER = atmel-dfu +BOOTLOADER = rp2040 -# Build Options -# change yes to no to disable -# -BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite -MOUSEKEY_ENABLE = yes # Mouse keys -EXTRAKEY_ENABLE = yes # Audio control and System control -CONSOLE_ENABLE = no # Console for debug -COMMAND_ENABLE = no # Commands for debug and configuration -NKRO_ENABLE = no # Enable N-Key Rollover -BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality -RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow -AUDIO_ENABLE = no # Audio output +# RGB Matrix +RGB_MATRIX_ENABLE = yes +RGB_MATRIX_DRIVER = WS2812 +WS2812_DRIVER = vendor LAYOUTS = tkl_f13_ansi_tsangan tkl_f13_ansi_tsangan_split_bs_rshift tkl_f13_iso_tsangan tkl_f13_iso_tsangan_split_bs_rshift + -- cgit v1.2.3