diff options
Diffstat (limited to 'keyboards/maartenwut/wonderland')
-rwxr-xr-x | keyboards/maartenwut/wonderland/keymaps/default/keymap.c | 30 | ||||
-rwxr-xr-x | keyboards/maartenwut/wonderland/wonderland.c | 28 |
2 files changed, 40 insertions, 18 deletions
diff --git a/keyboards/maartenwut/wonderland/keymaps/default/keymap.c b/keyboards/maartenwut/wonderland/keymaps/default/keymap.c index ccb022f684..da03d7615e 100755 --- a/keyboards/maartenwut/wonderland/keymaps/default/keymap.c +++ b/keyboards/maartenwut/wonderland/keymaps/default/keymap.c @@ -22,3 +22,33 @@ RGB_RMOD, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX _______, KC_LALT, _______, _______, _______, KC_RALT, _______ \ ) }; + +#ifdef USE_LEDS_FOR_LAYERS +// example of how to use LEDs as layer indicators +static uint8_t top = 1; +static uint8_t middle = 0; +static uint8_t bottom = 0; + +layer_state_t layer_state_set_user(layer_state_t state) { + top = middle = bottom = 0; + switch (get_highest_layer(state)) { + case _BASE: + top = 1; + break; + case _FUNC: + middle = 1; + break; + default: // for any other layers, or the default layer + break; + } + return state; +} + +// override kb level function +bool led_update_user(led_t usb_led) { + writePin(B1, !top); + writePin(B2, !middle); + writePin(B3, !bottom); + return false; // we are using LEDs for something else override kb +} +#endif diff --git a/keyboards/maartenwut/wonderland/wonderland.c b/keyboards/maartenwut/wonderland/wonderland.c index 9f3233e0f1..4415443816 100755 --- a/keyboards/maartenwut/wonderland/wonderland.c +++ b/keyboards/maartenwut/wonderland/wonderland.c @@ -1,5 +1,6 @@ #include "wonderland.h" +__attribute__ ((weak)) void matrix_init_kb(void) { // put your keyboard start-up code here // runs once when the firmware starts up @@ -7,12 +8,14 @@ void matrix_init_kb(void) { led_init_ports(); }; +__attribute__ ((weak)) void matrix_scan_kb(void) { // put your looping keyboard code here // runs every cycle (a lot) matrix_scan_user(); }; +__attribute__ ((weak)) void led_init_ports(void) { // * Set our LED pins as output setPinOutput(B1); @@ -20,23 +23,12 @@ void led_init_ports(void) { setPinOutput(B3); } -void led_set_kb(uint8_t usb_led) { - if (IS_LED_ON(usb_led, USB_LED_NUM_LOCK)) { - writePinLow(B1); - } else { - writePinHigh(B1); +bool led_update_kb(led_t led_state) { + bool runDefault = led_update_user(led_state); + if (runDefault) { + writePin(B1, !led_state.num_lock); + writePin(B2, !led_state.caps_lock); + writePin(B3, !led_state.scroll_lock); } - - if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) { - writePinLow(B2); - } else { - writePinHigh(B2); - } - - if (IS_LED_ON(usb_led, USB_LED_SCROLL_LOCK)) { - writePinLow(B3); - } else { - writePinHigh(B3); - } - led_set_user(usb_led); + return runDefault; } |