summaryrefslogtreecommitdiffstats
path: root/keyboards/maartenwut/wonderland/keymaps/default/keymap.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/keymaps/default/keymap.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/keymaps/default/keymap.c')
-rwxr-xr-xkeyboards/maartenwut/wonderland/keymaps/default/keymap.c30
1 files changed, 30 insertions, 0 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