mirror of
https://github.com/qmk/qmk_firmware.git
synced 2025-07-16 12:51:47 +00:00
Refactor LED update functions, add pins init
This commit is contained in:
parent
60c7b8b7e5
commit
2355a6d354
@ -16,25 +16,31 @@
|
|||||||
|
|
||||||
#include "quantum.h"
|
#include "quantum.h"
|
||||||
|
|
||||||
bool led_update_kb(led_t led_state) {
|
void keyboard_post_init_kb(void) {
|
||||||
bool res = led_update_user(led_state);
|
setPinOutput(LED_CAPS);
|
||||||
if(res) {
|
setPinOutput(LED_IND1);
|
||||||
writePin(LED_CAPS, led_state.caps_lock);
|
setPinOutput(LED_IND2);
|
||||||
writePin(LED_IND1, led_state.caps_lock);
|
setPinOutput(LED_IND3);
|
||||||
writePin(LED_IND2, led_state.num_lock);
|
setPinOutput(LED_IND4);
|
||||||
writePin(LED_IND3, led_state.scroll_lock);
|
setPinOutput(LED_IND5);
|
||||||
|
setPinOutput(LED_IND6);
|
||||||
|
setPinOutput(LED_IND7);
|
||||||
|
setPinOutput(LED_IND8);
|
||||||
|
}
|
||||||
|
|
||||||
writePin(LED_IND4, led_state.scroll_lock);
|
void led_update_ports(led_t led_state) {
|
||||||
writePin(LED_IND6, led_state.scroll_lock);
|
writePin(LED_CAPS, led_state.caps_lock);
|
||||||
|
writePin(LED_IND1, led_state.caps_lock);
|
||||||
writePin(LED_IND5, led_state.num_lock);
|
writePin(LED_IND2, led_state.num_lock);
|
||||||
writePin(LED_IND8, led_state.num_lock);
|
writePin(LED_IND3, led_state.scroll_lock);
|
||||||
}
|
writePin(LED_IND4, led_state.scroll_lock);
|
||||||
return res;
|
writePin(LED_IND6, led_state.scroll_lock);
|
||||||
|
writePin(LED_IND5, led_state.num_lock);
|
||||||
|
writePin(LED_IND8, led_state.num_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
layer_state_t layer_state_set_kb(layer_state_t state) {
|
layer_state_t layer_state_set_kb(layer_state_t state) {
|
||||||
if (get_highest_layer(state) > 0) writePin(LED_IND7, 1);
|
if (get_highest_layer(state) > 0) writePin(LED_IND7, 1);
|
||||||
else writePin(LED_IND7, 0);
|
else writePin(LED_IND7, 0);
|
||||||
return state;
|
return layer_state_set_user(state);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user