summaryrefslogtreecommitdiff
path: root/keyboards/clueboard2/backlight.c
diff options
context:
space:
mode:
authorChristopher Browne2016-06-22 11:26:26 -0400
committerChristopher Browne2016-06-22 11:26:26 -0400
commitb0caf32741cf415a45333828f1661d9f6b72570f (patch)
tree5e2b8203ab232c0a89264e96716ebf1a859f6189 /keyboards/clueboard2/backlight.c
parentee3c7892ad585e2e702d8975420d25ae052d97bb (diff)
parent8c1bfdf0bd9aae13d8722fd107deca40ffc7932c (diff)
Merge branch 'master' of https://github.com/jackhumbert/qmk_firmware
Diffstat (limited to 'keyboards/clueboard2/backlight.c')
-rw-r--r--keyboards/clueboard2/backlight.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/keyboards/clueboard2/backlight.c b/keyboards/clueboard2/backlight.c
new file mode 100644
index 000000000..5dfa4ba0a
--- /dev/null
+++ b/keyboards/clueboard2/backlight.c
@@ -0,0 +1,41 @@
+
+#include <avr/io.h>
+#include "backlight.h"
+#include "print.h"
+
+/* Clueboard 2.0 LED locations:
+ *
+ * Capslock: B4, pull high to turn on
+ * LCtrl: Shared with Capslock, DO NOT INSTALL LED'S IN BOTH
+ * Page Up: B7, pull high to turn on
+ * Escape: D6, pull high to turn on
+ * Arrows: D4, pull high to turn on
+ */
+
+void init_backlight_pin(void) {
+ print("init_backlight_pin()\n");
+ // Set our LED pins as output
+ DDRD |= (1<<6); // Esc
+ DDRB |= (1<<7); // Page Up
+ DDRD |= (1<<4); // Arrows
+
+ // Set our LED pins low
+ PORTD &= ~(1<<6); // Esc
+ PORTB &= ~(1<<7); // Page Up
+ PORTD &= ~(1<<4); // Arrows
+}
+
+void backlight_set(uint8_t level) {
+ if ( level == 0 ) {
+ // Turn off light
+ PORTD |= (1<<6); // Esc
+ PORTB |= (1<<7); // Page Up
+ PORTD |= (1<<4); // Arrows
+ } else {
+ // Turn on light
+ PORTD &= ~(1<<6); // Esc
+ PORTB &= ~(1<<7); // Page Up
+ PORTD &= ~(1<<4); // Arrows
+ }
+}
+