summaryrefslogtreecommitdiff
path: root/users/art/funcs/led_funcs.c
diff options
context:
space:
mode:
authorArtjoms Rizihs <artjomsR@users.noreply.github.com>2022-10-10 01:04:30 -0700
committerGitHub <noreply@github.com>2022-10-10 01:04:30 -0700
commitcd4a265560b45d117ac8296887188015c907e3c8 (patch)
treeb33715262450507840c75b501b559719070e167a /users/art/funcs/led_funcs.c
parent7aab5e4d896606a7731c8adfce41115611df75c2 (diff)
[Keyboard][Keymap] Fix random keys being sent on Mac + userspace changes (#15648)
* qmk art 2020+ * fix compilation * remove functions. translation matrix * fix edgecases * whitespace * fix memory oddity changing the keymap with every string print * return edge cases * support workman layout for git strings * subm * secrets * fix git ignore * rename var * workman HW feature toggle * remember lenght for inserting secrets * blink leds on secret finish * 75:fix LEDs not reflecting state on boot * move common led functions to user file * move common led funcs to separate file * move funcs file to separate folder * capsword * move string functions to a separate file * consolidate led funcs * tidy up variables * email * fix printing random keys on Mac + temp disable dynamic macro * make switch lang shortcut configurable * revert ergodone behaviour * move git ignore to userspace folder * ergodone clean up + saving space * navigation combos * shift caps always turns on caps lock. more combos * convert led funcs into header file * convert string funcs into header file * fix compilation for split75 * remove git cherry pick * update legal headers * more legal headers * home row macros * refactor combo names * redo combos for homerow + f10 11 12 * custom strings implementation (like secrets) * ergodone: more consistent f keys * tweak left right combos to minimise typing interference * ctr z shortcut * ergodone: move del to a more convenient key * rename secrets file to a shorter length * ergodone tweaks * fix after merge * removed included .c files * Update keyboards/ktec/ergodone/keymaps/art/user_config.c.example * Update keyboards/mt/split75/keymaps/art/user_config.c.example * Update users/art/secr.h.example * Update users/art/custom_definitions.h.example * Update users/art/art_user_config.h.example * Update users/art/art.h
Diffstat (limited to 'users/art/funcs/led_funcs.c')
-rw-r--r--users/art/funcs/led_funcs.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/users/art/funcs/led_funcs.c b/users/art/funcs/led_funcs.c
new file mode 100644
index 0000000000..873836d368
--- /dev/null
+++ b/users/art/funcs/led_funcs.c
@@ -0,0 +1,55 @@
+// Copyright 2022 Artjoms Rizihs (@artjomsR)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "led_funcs.h"
+
+bool hw_caps_on;
+
+__attribute__ ((weak)) void num_led_on(void) {}
+__attribute__ ((weak)) void num_led_off(void) {}
+__attribute__ ((weak)) void caps_led_on(void) {}
+__attribute__ ((weak)) void caps_led_off(void) {}
+__attribute__ ((weak)) void scroll_led_on(void) {}
+__attribute__ ((weak)) void scroll_led_off(void) {}
+
+void toggle_leds(int leds) {
+ if (NUM_LED_ON & leds) {
+ num_led_on();
+ } else {
+ num_led_off();
+ }
+ if (SCROLL_LED_ON & leds) {
+ scroll_led_on();
+ } else {
+ scroll_led_off();
+ }
+}
+
+bool led_update_user(led_t led_state) {
+ // only use caps LED - ignore Num & Scroll
+ if (led_state.caps_lock) {
+ caps_led_on();
+ } else {
+ caps_led_off();
+ }
+
+ hw_caps_on = led_state.caps_lock;
+ return false; // 'false' prevents led_update_kb from firing
+}
+
+void blink_leds(int leds) {
+ for (int i = 0; i < 3; i++) {
+ toggle_leds(leds);
+ wait_ms(BLINKING_INTERVAL);
+ toggle_leds(ALL_OFF);
+ wait_ms(BLINKING_INTERVAL);
+ }
+}
+
+void led_show_variable_status(bool value) {
+ if (value) {
+ blink_leds(NUM_LED_ON);
+ } else {
+ blink_leds(SCROLL_LED_ON);
+ }
+} \ No newline at end of file