aboutsummaryrefslogtreecommitdiffstats
path: root/keyboards/staryu/backlight_staryu.c
blob: 6fb9713f3a76a989baeffd49d16b5385e6273ce2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include "backlight.h"
#include <avr/pgmspace.h>

/* backlighting */
void init_backlight_led(void)
{
    DDRC |= (1<<PC2 | 1<<PC7);
    DDRD |= (1<<PD5 | 1<<PD6);
    DDRB |= (1<<PB0);
}

void backlight_led_off(uint8_t index)
{
    switch (index) {
        case 0:
            PORTC |= (1<<PC2);
            break;
        case 1:
            PORTC |= (1<<PC7);
            break;
        case 2:
            PORTD |= (1<<PD5);
            break;
        case 3:
            PORTD |= (1<<PD6);
            break;
        case 4:
            PORTB |= (1<<PB0);
            break;
    }
}

void backlight_led_on(uint8_t index)
{
    switch (index) {
        case 0:
            PORTC &= ~(1<<PC2);
            break;
        case 1:
            PORTC &= ~(1<<PC7);
            break;
        case 2:
            PORTD &= ~(1<<PD5);
            break;
        case 3:
            PORTD &= ~(1<<PD6);
            break;
        case 4:
            PORTB &= ~(1<<PB0);
            break;
    }
}