From 9a64c6b82ef7fc46e35f7d8c35eeccf3961ba0bf Mon Sep 17 00:00:00 2001 From: zvecr Date: Tue, 19 Feb 2019 00:48:52 +0000 Subject: [PATCH] [Keyboard] XD84 fixes for caps lock led, backlight and firmware size (#5178) * Enable backlight * Enable Link Time Optimization * Enable caps lock led --- keyboards/xd84/config.h | 8 +++--- keyboards/xd84/dev.md | 6 ++++- keyboards/xd84/keymaps/default/keymap.c | 2 +- keyboards/xd84/keymaps/default_iso/keymap.c | 2 +- keyboards/xd84/rules.mk | 4 ++- keyboards/xd84/xd84.c | 29 +++++++-------------- 6 files changed, 24 insertions(+), 27 deletions(-) diff --git a/keyboards/xd84/config.h b/keyboards/xd84/config.h index b2f850c184..abb9f17a58 100644 --- a/keyboards/xd84/config.h +++ b/keyboards/xd84/config.h @@ -47,10 +47,8 @@ /* COL2ROW, ROW2COL */ //#define DIODE_DIRECTION COL2ROW -// TODO: NOT WORKING - original kimera code seems to suggest B6 or C7 in backlight.c -// however tracing seems to suggest this is not true (as C7 is RGB) #define BACKLIGHT_PIN B5 -#define BACKLIGHT_LEVELS 3 +#define BACKLIGHT_LEVELS 10 // #define BACKLIGHT_BREATHING #define RGB_DI_PIN C7 @@ -239,3 +237,7 @@ /* Bootmagic Lite key configuration */ // #define BOOTMAGIC_LITE_ROW 0 // #define BOOTMAGIC_LITE_COLUMN 0 + +// LTO options +#define NO_ACTION_MACRO +#define NO_ACTION_FUNCTION diff --git a/keyboards/xd84/dev.md b/keyboards/xd84/dev.md index 453edb3667..536b01d06b 100644 --- a/keyboards/xd84/dev.md +++ b/keyboards/xd84/dev.md @@ -4,6 +4,7 @@ Development docs covering the following: - Kimera core - RGB - Backlight +- Light Through Cat ## Kimera core ![Kimera core](https://gd2.alicdn.com/imgextra/i4/159916802/TB2qsIgdrJkpuFjy1zcXXa5FFXa_!!159916802.jpg) @@ -77,7 +78,10 @@ Taken from [kimera-config.json](https://github.com/kairyu/tkg/blob/master/keyboa - Number of RGB LED 7 # Backlight - TODO - not working +- PIN B6 + +# Light Through Cat + TODO - PWM C6 ## Assumptions ### Pin/Port mappings diff --git a/keyboards/xd84/keymaps/default/keymap.c b/keyboards/xd84/keymaps/default/keymap.c index 4b9cf9fd24..b122fbddc3 100644 --- a/keyboards/xd84/keymaps/default/keymap.c +++ b/keyboards/xd84/keymaps/default/keymap.c @@ -22,7 +22,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [1] = LAYOUT_75_ansi( /* ┌─────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┐ */ - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, BL_TOGG, BL_STEP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, /* ├─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┴─────────┼─────────┤ */ _______, RGB_TOG, RGB_MOD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, /* ├─────────┴────┬────┴────┬────┴────┬────┴────┬────┴────┬────┴────┬────┴────┬────┴────┬────┴────┬────┴────┬────┴────┬────┴────┬────┴────┬──────────────┼─────────┤ */ diff --git a/keyboards/xd84/keymaps/default_iso/keymap.c b/keyboards/xd84/keymaps/default_iso/keymap.c index 18a0f06a82..87b4bfeea1 100644 --- a/keyboards/xd84/keymaps/default_iso/keymap.c +++ b/keyboards/xd84/keymaps/default_iso/keymap.c @@ -22,7 +22,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [1] = LAYOUT_75_iso( /* ┌─────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┐ */ - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, BL_TOGG, BL_STEP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, /* ├─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┴─────────┼─────────┤ */ _______, RGB_TOG, RGB_MOD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, /* ├─────────┴────┬────┴────┬────┴────┬────┴────┬────┴────┬────┴────┬────┴────┬────┴────┬────┴────┬────┴────┬────┴────┬────┴────┬────┴────┬──────────────┼─────────┤ */ diff --git a/keyboards/xd84/rules.mk b/keyboards/xd84/rules.mk index 0806d092ff..283d4babc7 100644 --- a/keyboards/xd84/rules.mk +++ b/keyboards/xd84/rules.mk @@ -70,7 +70,7 @@ COMMAND_ENABLE = no # Commands for debug and configuration SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend # if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work NKRO_ENABLE = no # USB Nkey Rollover -BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality on B7 by default +BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality on B7 by default RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow MIDI_ENABLE = no # MIDI support (+2400 to 4200, depending on config) UNICODE_ENABLE = no # Unicode @@ -83,4 +83,6 @@ HD44780_ENABLE = no # Enable support for HD44780 based LCDs (+400) CUSTOM_MATRIX = yes SRC = i2c_master.c custom_matrix_helper.c pca9555.c matrix.c +EXTRAFLAGS += -flto + LAYOUTS = 75_ansi 75_iso \ No newline at end of file diff --git a/keyboards/xd84/xd84.c b/keyboards/xd84/xd84.c index f7048f3252..eaf531421b 100644 --- a/keyboards/xd84/xd84.c +++ b/keyboards/xd84/xd84.c @@ -15,29 +15,18 @@ */ #include "xd84.h" -void matrix_init_kb(void) { - // put your keyboard start-up code here - // runs once when the firmware starts up +void keyboard_pre_init_kb(void) { + setPinOutput(B6); - matrix_init_user(); -} - -void matrix_scan_kb(void) { - // put your looping keyboard code here - // runs every cycle (a lot) - - matrix_scan_user(); -} - -bool process_record_kb(uint16_t keycode, keyrecord_t *record) { - // put your per-action keyboard code here - // runs for every action, just before processing by the firmware - - return process_record_user(keycode, record); + keyboard_pre_init_user(); } void led_set_kb(uint8_t usb_led) { - // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here + if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) { + writePinLow(B6); + } else { + writePinHigh(B6); + } - led_set_user(usb_led); + led_set_user(usb_led); }