From ef8878fba5d3786e3f9c66436da63a560cd36ac9 Mon Sep 17 00:00:00 2001 From: MechMerlin <30334081+mechmerlin@users.noreply.github.com> Date: Mon, 24 Feb 2020 12:04:40 -0800 Subject: Hineybush h87a lock indicators (#8237) * move lighting code from VIA into the keyboard's .c file so that every keymap can access it * after some serious conversations with default and wkl, they agreed to let me modify their keymaps. They weren't too happy --- keyboards/hineybush/h87a/h87a.c | 11 ++++++++++- keyboards/hineybush/h87a/keymaps/default/keymap.c | 21 --------------------- keyboards/hineybush/h87a/keymaps/via/keymap.c | 11 ----------- keyboards/hineybush/h87a/keymaps/wkl/keymap.c | 23 ----------------------- 4 files changed, 10 insertions(+), 56 deletions(-) (limited to 'keyboards') diff --git a/keyboards/hineybush/h87a/h87a.c b/keyboards/hineybush/h87a/h87a.c index c3bb890806..a3f511ffcc 100644 --- a/keyboards/hineybush/h87a/h87a.c +++ b/keyboards/hineybush/h87a/h87a.c @@ -18,7 +18,8 @@ void matrix_init_kb(void) { // put your keyboard start-up code here // runs once when the firmware starts up - + setPinOutput(D5); + setPinOutput(E6); matrix_init_user(); } @@ -42,6 +43,14 @@ void led_set_kb(uint8_t usb_led) { led_set_user(usb_led); } +bool led_update_kb(led_t led_state) { + if(led_update_user(led_state)) { + writePin(D5, !led_state.caps_lock); + writePin(E6, !led_state.scroll_lock); + } + return true; +} + void eeconfig_init_kb(void) { // EEPROM is getting reset! rgblight_enable(); // Enable RGB by default rgblight_sethsv(0, 255, 128); // Set default HSV - red hue, full saturation, medium brightness diff --git a/keyboards/hineybush/h87a/keymaps/default/keymap.c b/keyboards/hineybush/h87a/keymaps/default/keymap.c index 8aa116c93e..abca0b199c 100644 --- a/keyboards/hineybush/h87a/keymaps/default/keymap.c +++ b/keyboards/hineybush/h87a/keymaps/default/keymap.c @@ -46,24 +46,3 @@ void matrix_scan_user(void) { bool process_record_user(uint16_t keycode, keyrecord_t *record) { return true; } - -void led_init_ports(void) { - DDRD |= (1<<5); // OUT - DDRE |= (1<<6); // OUT -} - -void led_set_user(uint8_t usb_led) { - - if (usb_led & (1 << USB_LED_CAPS_LOCK)) { - DDRD |= (1 << 5); PORTD &= ~(1 << 5); - } else { - DDRD &= ~(1 << 5); PORTD &= ~(1 << 5); - } - - if (usb_led & (1 << USB_LED_SCROLL_LOCK)) { - DDRE |= (1 << 6); PORTE &= ~(1 << 6); - } else { - DDRE &= ~(1 << 6); PORTE &= ~(1 << 6); - } - -} diff --git a/keyboards/hineybush/h87a/keymaps/via/keymap.c b/keyboards/hineybush/h87a/keymaps/via/keymap.c index e4be1cfc9b..d248a6d4a3 100644 --- a/keyboards/hineybush/h87a/keymaps/via/keymap.c +++ b/keyboards/hineybush/h87a/keymaps/via/keymap.c @@ -50,14 +50,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), }; - -void led_init_ports(void) { - setPinOutput(D5); - setPinOutput(E6); -} - -bool led_update_user(led_t led_state) { - writePin(D5, !led_state.caps_lock); - writePin(E6, !led_state.scroll_lock); - return true; -} diff --git a/keyboards/hineybush/h87a/keymaps/wkl/keymap.c b/keyboards/hineybush/h87a/keymaps/wkl/keymap.c index e3e4108233..208cd3b347 100644 --- a/keyboards/hineybush/h87a/keymaps/wkl/keymap.c +++ b/keyboards/hineybush/h87a/keymaps/wkl/keymap.c @@ -46,26 +46,3 @@ void matrix_scan_user(void) { bool process_record_user(uint16_t keycode, keyrecord_t *record) { return true; } - -void led_init_ports(void) { - setPinOutput(D5); - setPinOutput(E6); -} - -void led_set_user(uint8_t usb_led) { - - if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) { - setPinOutput(D5); - writePinLow(D5); - } else { - setPinInput(D5); - } - - if (IS_LED_ON(usb_led, USB_LED_SCROLL_LOCK)) { - setPinOutput(E6); - writePinLow(E6); - } else { - setPinInput(E6); - } - -} -- cgit v1.2.3