summaryrefslogtreecommitdiffstats
path: root/keyboards/clueboard_60/led.c
diff options
context:
space:
mode:
authorskullydazed <skullydazed@users.noreply.github.com>2017-09-29 16:17:30 -0700
committerGitHub <noreply@github.com>2017-09-29 16:17:30 -0700
commit5fd68266f5d90b2c7045f44f678d71b782907752 (patch)
tree443e70a3f0dcebadd39a0c96857130546cc690a7 /keyboards/clueboard_60/led.c
parentb736f25e85171fceb06f01cf45a45f84dd0a4911 (diff)
Clueboard 60% support (#1746)
* initial clueboard_60 support * LED lighting support * fix the clueboard->clueboard_66 rename * Add layout support to clueboard_60 * Fix the 60_iso layout so it's actually iso * add a default keymap for AEK layout * fix clueboard_17 * Fixup the ISO layouts * Fix the `wait_ms()/wait_us()` definitions for chibios * Fix up the wait_ms/wait_us hack. Reduce stack size. * Add a missing #include "wait.h" * commit files that should have already been comitted
Diffstat (limited to 'keyboards/clueboard_60/led.c')
-rw-r--r--keyboards/clueboard_60/led.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/keyboards/clueboard_60/led.c b/keyboards/clueboard_60/led.c
new file mode 100644
index 0000000000..fdf244ad50
--- /dev/null
+++ b/keyboards/clueboard_60/led.c
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2017 skully <skullydazed@gmail.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "hal.h"
+#include "backlight.h"
+#include "led.h"
+#include "printf.h"
+
+void backlight_init_ports(void) {
+ printf("backlight_init_ports()\n");
+ #ifdef BACKLIGHT_ENABLE
+ palSetPadMode(GPIOB, 8, PAL_MODE_OUTPUT_PUSHPULL);
+ palSetPad(GPIOB, 8);
+ #endif
+}
+
+void backlight_set(uint8_t level) {
+ printf("backlight_set(%d)\n", level);
+ #ifdef BACKLIGHT_ENABLE
+ if (level == 0) {
+ // Turn backlight off
+ palSetPad(GPIOB, 8);
+ } else {
+ // Turn backlight on
+ palClearPad(GPIOB, 8);
+ }
+ #endif
+}
+
+void led_init_ports() {
+ printf("led_init_ports()\n");
+ palSetPadMode(GPIOB, 7, PAL_MODE_OUTPUT_PUSHPULL);
+}
+
+void led_set_kb(uint8_t usb_led) {
+ printf("led_init_ports()\n");
+ if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
+ // Turn capslock on
+ palSetPad(GPIOB, 7);
+ } else {
+ // Turn capslock off
+ palClearPad(GPIOB, 7);
+ }
+}