summaryrefslogtreecommitdiffstats
path: root/keyboards
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards')
-rw-r--r--keyboards/converter/modelm101/modelm101.c26
-rw-r--r--keyboards/duck/eagle_viper/v2/v2.c27
-rw-r--r--keyboards/duck/jetfire/jetfire.c39
-rw-r--r--keyboards/duck/lightsaver/lightsaver.c32
-rw-r--r--keyboards/dumbpad/v1x/v1x.c10
-rw-r--r--keyboards/dumbpad/v1x_dualencoder/v1x_dualencoder.c10
-rw-r--r--keyboards/dumbpad/v1x_right/v1x_right.c10
-rw-r--r--keyboards/handwired/daishi/keymaps/default/keymap.c22
-rw-r--r--keyboards/handwired/promethium/promethium.h2
-rw-r--r--keyboards/handwired/retro_refit/retro_refit.c39
-rw-r--r--keyboards/kinesis/alvicstep/alvicstep.c27
-rw-r--r--keyboards/lfkeyboards/lfk78/lfk78.c10
-rw-r--r--keyboards/lfkeyboards/lfk87/lfk87.c18
-rw-r--r--keyboards/lfkeyboards/mini1800/mini1800.c18
-rw-r--r--keyboards/mechlovin/hannah910/hannah910.c14
-rw-r--r--keyboards/org60/org60.c18
-rw-r--r--keyboards/xiudi/xd60/xd60.c32
-rw-r--r--keyboards/yiancardesigns/gingham/gingham.c15
18 files changed, 166 insertions, 203 deletions
diff --git a/keyboards/converter/modelm101/modelm101.c b/keyboards/converter/modelm101/modelm101.c
index 708259cab4..02d861b917 100644
--- a/keyboards/converter/modelm101/modelm101.c
+++ b/keyboards/converter/modelm101/modelm101.c
@@ -15,7 +15,7 @@
*/
#include "modelm101.h"
-void keyboard_pre_init_kb(void) {
+void led_init_ports(void) {
/* Setting status LEDs pins to output and +5V (off) */
setPinOutput(B4);
setPinOutput(B5);
@@ -25,22 +25,12 @@ void keyboard_pre_init_kb(void) {
writePinHigh(B6);
}
-void led_set_kb(uint8_t usb_led) {
- if (usb_led & (1<<USB_LED_NUM_LOCK)) {
- writePinLow(B4);
- } else {
- writePinHigh(B4);
+bool led_update_kb(led_t led_state) {
+ bool res = led_update_user(led_state);
+ if(res) {
+ writePin(B4, !led_state.num_lock);
+ writePin(B6, !led_state.caps_lock);
+ writePin(B5, !led_state.scroll_lock);
}
- if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
- writePinLow(B6);
- } else {
- writePinHigh(B6);
- }
- if (usb_led & (1<<USB_LED_SCROLL_LOCK)) {
- writePinLow(B5);
- } else {
- writePinHigh(B5);
- }
-
- led_set_user(usb_led);
+ return res;
}
diff --git a/keyboards/duck/eagle_viper/v2/v2.c b/keyboards/duck/eagle_viper/v2/v2.c
index d3e1368de9..e7ce5d4749 100644
--- a/keyboards/duck/eagle_viper/v2/v2.c
+++ b/keyboards/duck/eagle_viper/v2/v2.c
@@ -42,20 +42,23 @@ void backlight_set(uint8_t level) {
}
}
-// Port from backlight_update_state
-void led_set_kb(uint8_t usb_led) {
+bool led_update_kb(led_t led_state) {
+ bool res = led_update_user(led_state);
+ if(res) {
bool status[8] = {
- host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK), /* LED 3 */
- host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK), /* LED 2 */
- host_keyboard_leds() & (1<<USB_LED_NUM_LOCK), /* LED 1 */
+ led_state.scroll_lock, /* LED 3 */
+ led_state.caps_lock, /* LED 2 */
+ led_state.num_lock, /* LED 1 */
- layer_state & (1<<2), /* LED 6 */
- layer_state & (1<<1), /* LED 5 */
- layer_state & (1<<0) ? 0: 1, /* LED 4 */
+ layer_state & (1<<2), /* LED 6 */
+ layer_state & (1<<1), /* LED 5 */
+ layer_state & (1<<0) ? 0: 1, /* LED 4 */
- layer_state & (1<<5), /* LED 8 */
- layer_state & (1<<4) /* LED 7 */
- };
+ layer_state & (1<<5), /* LED 8 */
+ layer_state & (1<<4) /* LED 7 */
+ };
- indicator_leds_set(status);
+ indicator_leds_set(status);
+ }
+ return res;
}
diff --git a/keyboards/duck/jetfire/jetfire.c b/keyboards/duck/jetfire/jetfire.c
index d648287156..7bebd7ad21 100644
--- a/keyboards/duck/jetfire/jetfire.c
+++ b/keyboards/duck/jetfire/jetfire.c
@@ -95,22 +95,25 @@ void backlight_update_state()
show();
}
-void led_set_kb(uint8_t usb_led)
-{
- if(usb_led & (1<<USB_LED_CAPS_LOCK)) {
- backlight_state_led |= 1<<STATE_LED_CAPS_LOCK;
- } else {
- backlight_state_led &= ~(1<<STATE_LED_CAPS_LOCK);
- }
- if(usb_led & (1<<USB_LED_SCROLL_LOCK)) {
- backlight_state_led |= 1<<STATE_LED_SCROLL_LOCK;
- } else {
- backlight_state_led &= ~(1<<STATE_LED_SCROLL_LOCK);
- }
- if(usb_led & (1<<USB_LED_NUM_LOCK)) {
- backlight_state_led |= 1<<STATE_LED_NUM_LOCK;
- } else {
- backlight_state_led &= ~(1<<STATE_LED_NUM_LOCK);
- }
- backlight_update_state();
+bool led_update_kb(led_t led_state) {
+ bool res = led_update_user(led_state);
+ if(res) {
+ if(led_state.caps_lock) {
+ backlight_state_led |= 1<<STATE_LED_CAPS_LOCK;
+ } else {
+ backlight_state_led &= ~(1<<STATE_LED_CAPS_LOCK);
+ }
+ if(led_state.scroll_lock) {
+ backlight_state_led |= 1<<STATE_LED_SCROLL_LOCK;
+ } else {
+ backlight_state_led &= ~(1<<STATE_LED_SCROLL_LOCK);
+ }
+ if(led_state.num_lock) {
+ backlight_state_led |= 1<<STATE_LED_NUM_LOCK;
+ } else {
+ backlight_state_led &= ~(1<<STATE_LED_NUM_LOCK);
+ }
+ backlight_update_state();
+ }
+ return res;
}
diff --git a/keyboards/duck/lightsaver/lightsaver.c b/keyboards/duck/lightsaver/lightsaver.c
index e0fe918e7d..eba1ce25c2 100644
--- a/keyboards/duck/lightsaver/lightsaver.c
+++ b/keyboards/duck/lightsaver/lightsaver.c
@@ -39,18 +39,20 @@ void backlight_set(uint8_t level) {
}
}
-void led_set_kb(uint8_t usb_led) {
- bool leds[8] = {
- usb_led & (1<<USB_LED_CAPS_LOCK),
- usb_led & (1<<USB_LED_SCROLL_LOCK),
- usb_led & (1<<USB_LED_NUM_LOCK),
- layer_state & (1<<1),
- layer_state & (1<<2),
- layer_state & (1<<3),
- layer_state & (1<<4),
- layer_state & (1<<5)
- };
- indicator_leds_set(leds);
-
- led_set_user(usb_led);
-}
+bool led_update_kb(led_t led_state) {
+ bool res = led_update_user(led_state);
+ if(res) {
+ bool leds[8] = {
+ led_state.caps_lock,
+ led_state.scroll_lock,
+ led_state.num_lock,
+ layer_state & (1<<1),
+ layer_state & (1<<2),
+ layer_state & (1<<3),
+ layer_state & (1<<4),
+ layer_state & (1<<5)
+ };
+ indicator_leds_set(leds);
+ }
+ return res;
+} \ No newline at end of file
diff --git a/keyboards/dumbpad/v1x/v1x.c b/keyboards/dumbpad/v1x/v1x.c
index 0adef0f610..4f4df5ece2 100644
--- a/keyboards/dumbpad/v1x/v1x.c
+++ b/keyboards/dumbpad/v1x/v1x.c
@@ -62,8 +62,10 @@ void matrix_init_kb(void) {
matrix_init_user();
}
-void led_set_kb(uint8_t usb_led) {
- // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
- writePin(LED_02, !IS_LED_ON(usb_led, USB_LED_NUM_LOCK));
- led_set_user(usb_led);
+bool led_update_kb(led_t led_state) {
+ bool res = led_update_user(led_state);
+ if(res) {
+ writePin(LED_02, !led_state.num_lock);
+ }
+ return res;
}
diff --git a/keyboards/dumbpad/v1x_dualencoder/v1x_dualencoder.c b/keyboards/dumbpad/v1x_dualencoder/v1x_dualencoder.c
index 4ea402d805..a727a257b2 100644
--- a/keyboards/dumbpad/v1x_dualencoder/v1x_dualencoder.c
+++ b/keyboards/dumbpad/v1x_dualencoder/v1x_dualencoder.c
@@ -62,8 +62,10 @@ void matrix_init_kb(void) {
matrix_init_user();
}
-void led_set_kb(uint8_t usb_led) {
- // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
- writePin(LED_02, !IS_LED_ON(usb_led, USB_LED_NUM_LOCK));
- led_set_user(usb_led);
+bool led_update_kb(led_t led_state) {
+ bool res = led_update_user(led_state);
+ if(res) {
+ writePin(LED_02, !led_state.num_lock);
+ }
+ return res;
}
diff --git a/keyboards/dumbpad/v1x_right/v1x_right.c b/keyboards/dumbpad/v1x_right/v1x_right.c
index c2adbaebed..b0b3f473df 100644
--- a/keyboards/dumbpad/v1x_right/v1x_right.c
+++ b/keyboards/dumbpad/v1x_right/v1x_right.c
@@ -62,8 +62,10 @@ void matrix_init_kb(void) {
matrix_init_user();
}
-void led_set_kb(uint8_t usb_led) {
- // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
- writePin(LED_02, !IS_LED_ON(usb_led, USB_LED_NUM_LOCK));
- led_set_user(usb_led);
+bool led_update_kb(led_t led_state) {
+ bool res = led_update_user(led_state);
+ if(res) {
+ writePin(LED_02, !led_state.num_lock);
+ }
+ return res;
}
diff --git a/keyboards/handwired/daishi/keymaps/default/keymap.c b/keyboards/handwired/daishi/keymaps/default/keymap.c
index 0607f75a30..696dda3a05 100644
--- a/keyboards/handwired/daishi/keymaps/default/keymap.c
+++ b/keyboards/handwired/daishi/keymaps/default/keymap.c
@@ -100,20 +100,10 @@ void matrix_init_user(void) {
setPinOutput(C6);
}
-void led_set_kb(uint8_t usb_led) {
- if (IS_LED_OFF(usb_led, USB_LED_NUM_LOCK)) {
- writePinLow(C4);
- } else {
- writePinHigh(C4);
- }
- if (IS_LED_OFF(usb_led, USB_LED_CAPS_LOCK)) {
- writePinLow(C5);
- } else {
- writePinHigh(C5);
- }
- if (IS_LED_OFF(usb_led, USB_LED_SCROLL_LOCK)) {
- writePinLow(C6);
- } else {
- writePinHigh(C6);
- }
+bool led_update_user(led_t led_state) {
+ writePin(C4, led_state.num_lock);
+ writePin(C5, led_state.caps_lock);
+ writePin(C6, led_state.scroll_lock);
+
+ return false;
}
diff --git a/keyboards/handwired/promethium/promethium.h b/keyboards/handwired/promethium/promethium.h
index e40d67e9fd..0d594a7942 100644
--- a/keyboards/handwired/promethium/promethium.h
+++ b/keyboards/handwired/promethium/promethium.h
@@ -3,8 +3,6 @@
#include "quantum.h"
void battery_poll(uint8_t level);
-void led_set_kb(uint8_t usb_led);
-void led_set_user(uint8_t usb_led);
#define XXX KC_NO
diff --git a/keyboards/handwired/retro_refit/retro_refit.c b/keyboards/handwired/retro_refit/retro_refit.c
index 3d610eba34..2a5476e40c 100644
--- a/keyboards/handwired/retro_refit/retro_refit.c
+++ b/keyboards/handwired/retro_refit/retro_refit.c
@@ -12,36 +12,13 @@ void matrix_init_kb(void) {
matrix_init_user();
};
-void led_set_kb(uint8_t usb_led) {
- // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
+bool led_update_kb(led_t led_state) {
+ bool res = led_update_user(led_state);
+ if(res) {
+ writePin(D0, !led_state.caps_lock);
+ writePin(D1, !led_state.num_lock);
+ writePin(C6, !led_state.scroll_lock);
- if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
- // output low
- DDRD |= (1<<0);
- PORTD &= ~(1<<0);
- } else {
- // Hi-Z
- DDRD &= ~(1<<0);
- PORTD &= ~(1<<0);
}
- if (usb_led & (1<<USB_LED_NUM_LOCK)) {
- // output low
- DDRD |= (1<<1);
- PORTD &= ~(1<<1);
- } else {
- // Hi-Z
- DDRD &= ~(1<<1);
- PORTD &= ~(1<<1);
- }
- if (usb_led & (1<<USB_LED_SCROLL_LOCK)) {
- // output low
- DDRC |= (1<<6);
- PORTC &= ~(1<<6);
- } else {
- // Hi-Z
- DDRC &= ~(1<<6);
- PORTC &= ~(1<<6);
- }
-
- led_set_user(usb_led);
-}; \ No newline at end of file
+ return res;
+} \ No newline at end of file
diff --git a/keyboards/kinesis/alvicstep/alvicstep.c b/keyboards/kinesis/alvicstep/alvicstep.c
index 735032d6a4..a2a62df36a 100644
--- a/keyboards/kinesis/alvicstep/alvicstep.c
+++ b/keyboards/kinesis/alvicstep/alvicstep.c
@@ -70,19 +70,20 @@ void blink_all_leds(void)
matrix_init_user();
}
-void led_set_kb(uint8_t usb_led) {
- // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
+bool led_update_kb(led_t led_state) {
+ bool res = led_update_user(led_state);
+ if(res) {
//Copyright 2014 Warren Janssens <warren.janssens@gmail.com>
- uint8_t leds = 0xF0;
- if (usb_led & 1 << USB_LED_NUM_LOCK)
- leds &= ~0x10;
- if (usb_led & 1 << USB_LED_CAPS_LOCK)
- leds &= ~0x80;
- if (usb_led & 1 << USB_LED_SCROLL_LOCK)
- leds &= ~0x20;
- PORTD = (PORTD & 0x0F) | leds;
-
- led_set_user(usb_led);
-
+ uint8_t leds = 0xF0;
+ if (led_state.num_lock)
+ leds &= ~0x10;
+ if (led_state.caps_lock)
+ leds &= ~0x80;
+ if (led_state.scroll_lock)
+ leds &= ~0x20;
+ PORTD = (PORTD & 0x0F) | leds;
+
+ }
+ return res;
}
diff --git a/keyboards/lfkeyboards/lfk78/lfk78.c b/keyboards/lfkeyboards/lfk78/lfk78.c
index 6f61d6e2e2..110bbd4168 100644
--- a/keyboards/lfkeyboards/lfk78/lfk78.c
+++ b/keyboards/lfkeyboards/lfk78/lfk78.c
@@ -151,11 +151,12 @@ void reset_keyboard_kb() {
reset_keyboard();
}
-void led_set_kb(uint8_t usb_led) {
- // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
+bool led_update_kb(led_t led_state) {
+ bool res = led_update_user(led_state);
+ if(res) {
#ifdef ISSI_ENABLE
# ifdef CAPSLOCK_LED
- if (usb_led & (1 << USB_LED_CAPS_LOCK)) {
+ if (led_state.caps_lock) {
activateLED(0, 3, 7, 255);
} else {
activateLED(0, 3, 7, 0);
@@ -163,7 +164,8 @@ void led_set_kb(uint8_t usb_led) {
# endif // CAPSLOCK_LED
#endif // ISS_ENABLE
- led_set_user(usb_led);
+ }
+ return res;
}
// LFK lighting info
diff --git a/keyboards/lfkeyboards/lfk87/lfk87.c b/keyboards/lfkeyboards/lfk87/lfk87.c
index 553c66da6d..18ddd86adc 100644
--- a/keyboards/lfkeyboards/lfk87/lfk87.c
+++ b/keyboards/lfkeyboards/lfk87/lfk87.c
@@ -128,15 +128,17 @@ void reset_keyboard_kb(){
reset_keyboard();
}
-void led_set_kb(uint8_t usb_led)
-{
- // Set capslock LED to Blue
- if (usb_led & (1 << USB_LED_CAPS_LOCK)) {
- set_rgb(31, 0x00, 0x00, 0x7F);
- }else{
- set_rgb(31, 0x00, 0x00, 0x00);
+bool led_update_kb(led_t led_state) {
+ bool res = led_update_user(led_state);
+ if(res) {
+ // Set capslock LED to Blue
+ if (led_state.caps_lock) {
+ set_rgb(31, 0x00, 0x00, 0x7F);
+ } else{
+ set_rgb(31, 0x00, 0x00, 0x00);
+ }
}
- led_set_user(usb_led);
+ return res;
}
// Lighting info, see lighting.h for details
diff --git a/keyboards/lfkeyboards/mini1800/mini1800.c b/keyboards/lfkeyboards/mini1800/mini1800.c
index ac6b0533b4..cf7e42f134 100644
--- a/keyboards/lfkeyboards/mini1800/mini1800.c
+++ b/keyboards/lfkeyboards/mini1800/mini1800.c
@@ -134,15 +134,17 @@ void reset_keyboard_kb(){
reset_keyboard();
}
-void led_set_kb(uint8_t usb_led)
-{
- // Set capslock LED to Blue
- if (usb_led & (1 << USB_LED_CAPS_LOCK)) {
- set_rgb(31, 0x00, 0x00, 0x7F);
- }else{
- set_rgb(31, 0x00, 0x00, 0x00);
+bool led_update_kb(led_t led_state) {
+ bool res = led_update_user(led_state);
+ if(res) {
+ // Set capslock LED to Blue
+ if (led_state.caps_lock) {
+ set_rgb(31, 0x00, 0x00, 0x7F);
+ } else{
+ set_rgb(31, 0x00, 0x00, 0x00);
+ }
}
- led_set_user(usb_led);
+ return res;
}
// Lighting info, see lighting.h for details
diff --git a/keyboards/mechlovin/hannah910/hannah910.c b/keyboards/mechlovin/hannah910/hannah910.c
index 70c1a7b8e3..fa5b04ea76 100644
--- a/keyboards/mechlovin/hannah910/hannah910.c
+++ b/keyboards/mechlovin/hannah910/hannah910.c
@@ -22,13 +22,13 @@ void led_init_ports(void) {
setPinOutput(D2);
}
-void led_set_kb(uint8_t usb_led) {
- if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) {
- writePinHigh(B2);
- } else {
- writePinLow(B2);
- }
- led_set_user(usb_led);
+
+bool led_update_kb(led_t led_state) {
+ bool res = led_update_user(led_state);
+ if(res) {
+ writePin(B2, led_state.caps_lock);
+ }
+ return res;
}
layer_state_t layer_state_set_user(layer_state_t state)
diff --git a/keyboards/org60/org60.c b/keyboards/org60/org60.c
index 77a5e7c18b..940067538e 100644
--- a/keyboards/org60/org60.c
+++ b/keyboards/org60/org60.c
@@ -8,12 +8,14 @@ extern inline void org60_caps_led_off(void);
extern inline void org60_bl_led_off(void);
-void led_set_kb(uint8_t usb_led) {
- if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
- org60_caps_led_on();
- } else {
- org60_caps_led_off();
- }
-
- led_set_user(usb_led);
+bool led_update_kb(led_t led_state) {
+ bool res = led_update_user(led_state);
+ if(res) {
+ if (led_state.caps_lock) {
+ org60_caps_led_on();
+ } else {
+ org60_caps_led_off();
+ }
+ }
+ return res;
}
diff --git a/keyboards/xiudi/xd60/xd60.c b/keyboards/xiudi/xd60/xd60.c
index c3b63e5eaf..9a0a91e948 100644
--- a/keyboards/xiudi/xd60/xd60.c
+++ b/keyboards/xiudi/xd60/xd60.c
@@ -8,26 +8,14 @@ extern inline void xd60_caps_led_off(void);
extern inline void xd60_bl_led_off(void);
-void led_set_kb(uint8_t usb_led) {
- // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
-
- if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
- xd60_caps_led_on();
- } else {
- xd60_caps_led_off();
- }
-
- // if (usb_led & (1<<USB_LED_NUM_LOCK)) {
- // xd60_esc_led_on();
- // } else {
- // xd60_esc_led_off();
- // }
-
- // if (usb_led & (1<<USB_LED_SCROLL_LOCK)) {
- // xd60_fn_led_on();
- // } else {
- // xd60_fn_led_off();
- // }
-
- led_set_user(usb_led);
+bool led_update_kb(led_t led_state) {
+ bool res = led_update_user(led_state);
+ if(res) {
+ if (led_state.caps_lock) {
+ xd60_caps_led_on();
+ } else {
+ xd60_caps_led_off();
+ }
+ }
+ return res;
}
diff --git a/keyboards/yiancardesigns/gingham/gingham.c b/keyboards/yiancardesigns/gingham/gingham.c
index 9a5ffe4530..a70ca71df0 100644
--- a/keyboards/yiancardesigns/gingham/gingham.c
+++ b/keyboards/yiancardesigns/gingham/gingham.c
@@ -27,14 +27,11 @@ void matrix_init_kb(void) {
matrix_init_user();
}
-void led_set_kb(uint8_t usb_led) {
- // Bit 3 is Green LED, bit 4 is Red LED.
- if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) {
- send_data = 0x18;
- } else {
- send_data = 0x10;
+bool led_update_kb(led_t led_state) {
+ bool res = led_update_user(led_state);
+ if(res) {
+ send_data = led_state.caps_lock ? 0x18 : 0x10;
+ i2c_writeReg((PORT_EXPANDER_ADDRESS << 1), 0x09, &send_data, 1, 20);
}
- i2c_writeReg((PORT_EXPANDER_ADDRESS << 1), 0x09, &send_data, 1, 20);
-
- led_set_user(usb_led);
+ return res;
}