Эх сурвалжийг харах

[Keyboard] XD84 fixes for caps lock led, backlight and firmware size (#5178)

* Enable backlight

* Enable Link Time Optimization

* Enable caps lock led
zvecr 6 жил өмнө
parent
commit
9a64c6b82e

+ 5 - 3
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

+ 5 - 1
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

+ 1 - 1
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,  _______,  _______,  _______,  _______,  _______,  _______,  _______,  _______,  _______,  _______,  _______,            _______,
 /* ├─────────┴────┬────┴────┬────┴────┬────┴────┬────┴────┬────┴────┬────┴────┬────┴────┬────┴────┬────┴────┬────┴────┬────┴────┬────┴────┬──────────────┼─────────┤ */

+ 1 - 1
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,  _______,  _______,  _______,  _______,  _______,  _______,  _______,  _______,  _______,  _______,  _______,            _______,
 /* ├─────────┴────┬────┴────┬────┴────┬────┴────┬────┴────┬────┴────┬────┴────┬────┴────┬────┴────┬────┴────┬────┴────┬────┴────┬────┴────┬──────────────┼─────────┤ */

+ 3 - 1
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

+ 9 - 20
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);
 }