diff options
Diffstat (limited to 'keyboards/input_club/infinity60')
-rw-r--r-- | keyboards/input_club/infinity60/led.c | 52 | ||||
-rw-r--r-- | keyboards/input_club/infinity60/led_controller.c | 5 | ||||
-rw-r--r-- | keyboards/input_club/infinity60/rules.mk | 2 |
3 files changed, 31 insertions, 28 deletions
diff --git a/keyboards/input_club/infinity60/led.c b/keyboards/input_club/infinity60/led.c index 8effcea81a..33871bcc49 100644 --- a/keyboards/input_club/infinity60/led.c +++ b/keyboards/input_club/infinity60/led.c @@ -26,29 +26,33 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. * both regular threads and ISRs, unlocked (during resume-from-sleep). * In particular, I2C functions (interrupt-driven) should NOT be called from here. */ -void led_set(uint8_t usb_led) { - msg_t msg; - - if (usb_led & (1<<USB_LED_NUM_LOCK)) { - chSysUnconditionalLock(); - msg=(1 << 8) | TOGGLE_NUM_LOCK; - chMBPostI(&led_mailbox, msg); - chSysUnconditionalUnlock(); - } else { - chSysUnconditionalLock(); - msg=(0 << 8) | TOGGLE_NUM_LOCK; - chMBPostI(&led_mailbox, msg); - chSysUnconditionalUnlock(); - } - if (usb_led & (1<<USB_LED_CAPS_LOCK)) { - chSysUnconditionalLock(); - msg=(1 << 8) | TOGGLE_CAPS_LOCK; - chMBPostI(&led_mailbox, msg); - chSysUnconditionalUnlock(); - } else { - chSysUnconditionalLock(); - msg=(0 << 8) | TOGGLE_CAPS_LOCK; - chMBPostI(&led_mailbox, msg); - chSysUnconditionalUnlock(); +bool led_update_kb(led_t led_state) { + bool res = led_update_user(led_state); + if (res) { + msg_t msg; + + if (led_state.num_lock) { + chSysUnconditionalLock(); + msg=(1 << 8) | TOGGLE_NUM_LOCK; + chMBPostI(&led_mailbox, msg); + chSysUnconditionalUnlock(); + } else { + chSysUnconditionalLock(); + msg=(0 << 8) | TOGGLE_NUM_LOCK; + chMBPostI(&led_mailbox, msg); + chSysUnconditionalUnlock(); + } + if (led_state.caps_lock) { + chSysUnconditionalLock(); + msg=(1 << 8) | TOGGLE_CAPS_LOCK; + chMBPostI(&led_mailbox, msg); + chSysUnconditionalUnlock(); + } else { + chSysUnconditionalLock(); + msg=(0 << 8) | TOGGLE_CAPS_LOCK; + chMBPostI(&led_mailbox, msg); + chSysUnconditionalUnlock(); + } } + return false; } diff --git a/keyboards/input_club/infinity60/led_controller.c b/keyboards/input_club/infinity60/led_controller.c index cf3edf20dd..5ea0ae804c 100644 --- a/keyboards/input_club/infinity60/led_controller.c +++ b/keyboards/input_club/infinity60/led_controller.c @@ -187,8 +187,9 @@ static THD_FUNCTION(LEDthread, arg) { // initialize persistent variables pwm_step_status = 4; //full brightness page_status = 0; //start frame 0 (all off/on) - numlock_status = (host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) ? 1 : 0; - capslock_status = (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) ? 1 : 0; + led_t led_state = host_keyboard_led_state(); + numlock_status = led_state.num_lock ? 1 : 0; + capslock_status = led_state.caps_lock ? 1 : 0; while(true) { // wait for a message (asynchronous) diff --git a/keyboards/input_club/infinity60/rules.mk b/keyboards/input_club/infinity60/rules.mk index e47069dac9..5f885e1194 100644 --- a/keyboards/input_club/infinity60/rules.mk +++ b/keyboards/input_club/infinity60/rules.mk @@ -13,5 +13,3 @@ AUDIO_ENABLE = no # Audio output DEFAULT_FOLDER = input_club/infinity60/led -# Enter lower-power sleep mode when on the ChibiOS idle thread -OPT_DEFS += -DCORTEX_ENABLE_WFI_IDLE=TRUE |