aboutsummaryrefslogtreecommitdiff
path: root/keyboard/lightsaber/backlight.c
diff options
context:
space:
mode:
Diffstat (limited to 'keyboard/lightsaber/backlight.c')
-rw-r--r--keyboard/lightsaber/backlight.c48
1 files changed, 39 insertions, 9 deletions
diff --git a/keyboard/lightsaber/backlight.c b/keyboard/lightsaber/backlight.c
index b28200807..59b8b4a63 100644
--- a/keyboard/lightsaber/backlight.c
+++ b/keyboard/lightsaber/backlight.c
@@ -26,8 +26,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
26 * Backside PD6 (high) 26 * Backside PD6 (high)
27 * TopRight PD7 (low) 27 * TopRight PD7 (low)
28 * F-Row PE6 (high) 28 * F-Row PE6 (high)
29 *
30 */ 29 */
30
31void backlight_set(uint8_t level) 31void backlight_set(uint8_t level)
32{ 32{
33 // Set as output. 33 // Set as output.
@@ -35,22 +35,52 @@ void backlight_set(uint8_t level)
35 DDRD |= (1<<6) | (1<<7); 35 DDRD |= (1<<6) | (1<<7);
36 DDRE |= (1<<6); 36 DDRE |= (1<<6);
37 37
38 if(level & (1<<0)) 38 if (level & BACKLIGHT_ALPHA)
39 { 39 {
40 PORTB &= ~(1<<1); 40 PORTB |= (1<<1);
41 PORTB &= ~(1<<2);
42 PORTB &= ~(1<<3);
43 PORTD &= ~(1<<6);
44 PORTD |= (1<<7);
45 PORTE &= ~(1<<6);
46 } 41 }
47 else 42 else
48 { 43 {
49 PORTB |= (1<<1); 44 PORTB &= ~(1<<1);
45 }
46 if (level & BACKLIGHT_NUMERIC)
47 {
50 PORTB |= (1<<2); 48 PORTB |= (1<<2);
49 }
50 else
51 {
52 PORTB &= ~(1<<2);
53 }
54 if (level & BACKLIGHT_MODNUM)
55 {
51 PORTB |= (1<<3); 56 PORTB |= (1<<3);
57 }
58 else
59 {
60 PORTB &= ~(1<<3);
61 }
62 if (level & BACKLIGHT_BACKSIDE)
63 {
52 PORTD |= (1<<6); 64 PORTD |= (1<<6);
65 }
66 else
67 {
68 PORTD &= ~(1<<6);
69 }
70 if (level & BACKLIGHT_TOPRIGHT)
71 {
53 PORTD &= ~(1<<7); 72 PORTD &= ~(1<<7);
73 }
74 else
75 {
76 PORTD |= (1<<7);
77 }
78 if (level & BACKLIGHT_FROW)
79 {
54 PORTE |= (1<<6); 80 PORTE |= (1<<6);
55 } 81 }
82 else
83 {
84 PORTE &= ~(1<<6);
85 }
56} 86}