summaryrefslogtreecommitdiffstats
path: root/keyboards/maartenwut/wonderland/wonderland.c
diff options
context:
space:
mode:
authorYan-Fa Li <yanfali@gmail.com>2019-11-22 12:55:45 -0800
committerGitHub <noreply@github.com>2019-11-22 12:55:45 -0800
commite62ab7e259d4f33c639a9433264c1cbfb6381cb5 (patch)
tree0506398d1b45c55c3eeafd30c92b459d8920c6b5 /keyboards/maartenwut/wonderland/wonderland.c
parent0270d4d5a17690ddf85676a1d4721d06fc690739 (diff)
Allow overriding of all functions in wonderland.c (#7198)
* f * Allow overriding of all functions in wonderland.c - needed for custom LED functions in keymap.c * Example of layer indication via LEDs optimize * Use newer led_update_kb and led_update_user hooks - these allow overriding without use of __attribute((weak))__ * Update led documentation a bit - clarify some of the wording around how to use led_update_user * Update led_update_user example * Update audio example to be complete * trailing spaces smh * spaces * spaces * smh * Less code is good * Update docs/custom_quantum_functions.md Co-Authored-By: fauxpark <fauxpark@gmail.com> * Update docs/custom_quantum_functions.md Co-Authored-By: fauxpark <fauxpark@gmail.com> * Update docs/custom_quantum_functions.md Co-Authored-By: fauxpark <fauxpark@gmail.com> * Update docs/custom_quantum_functions.md Co-Authored-By: fauxpark <fauxpark@gmail.com> * Update docs/custom_quantum_functions.md Co-Authored-By: fauxpark <fauxpark@gmail.com> * Update docs/custom_quantum_functions.md Co-Authored-By: fauxpark <fauxpark@gmail.com>
Diffstat (limited to 'keyboards/maartenwut/wonderland/wonderland.c')
-rwxr-xr-xkeyboards/maartenwut/wonderland/wonderland.c28
1 files changed, 10 insertions, 18 deletions
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;
}