diff options
Diffstat (limited to 'keyboard/clueboard2/backlight.c')
-rw-r--r-- | keyboard/clueboard2/backlight.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/keyboard/clueboard2/backlight.c b/keyboard/clueboard2/backlight.c new file mode 100644 index 000000000..5dfa4ba0a --- /dev/null +++ b/keyboard/clueboard2/backlight.c | |||
@@ -0,0 +1,41 @@ | |||
1 | |||
2 | #include <avr/io.h> | ||
3 | #include "backlight.h" | ||
4 | #include "print.h" | ||
5 | |||
6 | /* Clueboard 2.0 LED locations: | ||
7 | * | ||
8 | * Capslock: B4, pull high to turn on | ||
9 | * LCtrl: Shared with Capslock, DO NOT INSTALL LED'S IN BOTH | ||
10 | * Page Up: B7, pull high to turn on | ||
11 | * Escape: D6, pull high to turn on | ||
12 | * Arrows: D4, pull high to turn on | ||
13 | */ | ||
14 | |||
15 | void init_backlight_pin(void) { | ||
16 | print("init_backlight_pin()\n"); | ||
17 | // Set our LED pins as output | ||
18 | DDRD |= (1<<6); // Esc | ||
19 | DDRB |= (1<<7); // Page Up | ||
20 | DDRD |= (1<<4); // Arrows | ||
21 | |||
22 | // Set our LED pins low | ||
23 | PORTD &= ~(1<<6); // Esc | ||
24 | PORTB &= ~(1<<7); // Page Up | ||
25 | PORTD &= ~(1<<4); // Arrows | ||
26 | } | ||
27 | |||
28 | void backlight_set(uint8_t level) { | ||
29 | if ( level == 0 ) { | ||
30 | // Turn off light | ||
31 | PORTD |= (1<<6); // Esc | ||
32 | PORTB |= (1<<7); // Page Up | ||
33 | PORTD |= (1<<4); // Arrows | ||
34 | } else { | ||
35 | // Turn on light | ||
36 | PORTD &= ~(1<<6); // Esc | ||
37 | PORTB &= ~(1<<7); // Page Up | ||
38 | PORTD &= ~(1<<4); // Arrows | ||
39 | } | ||
40 | } | ||
41 | |||