summaryrefslogtreecommitdiff
path: root/keyboards/idb/idb_60/idb_60.c
blob: 1ca4b8796f5a460e9c44ad15fdea57c6af4a7476 (plain)
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
#include "idb_60.h"

void keyboard_pre_init_kb(void) {
    setPinOutput(C4);
    setPinOutput(C5);
}

inline void _idb_60_caps_led_on(void) {
    writePinLow(C5);
}

inline void _idb_60_fn_led_on(void) {
    writePinLow(C4);
}

inline void _idb_60_caps_led_off(void) {
    writePinHigh(C5);
}

inline void _idb_60_fn_led_off(void) {
    writePinHigh(C4);
}

// Capslock LED indicator

bool led_update_kb(led_t led_state) {
    bool res = led_update_user(led_state);
    if (res) {
        if (led_state.caps_lock) {
            _idb_60_caps_led_on();
        } else {
            _idb_60_caps_led_off();
        }
    }
    return res;
}

// Layer LED indicator - drive LED when not on base layer

__attribute__((weak)) layer_state_t layer_state_set_user(layer_state_t state) {
    if (get_highest_layer(state) == 0) {
        _idb_60_fn_led_off();
    } else {
        _idb_60_fn_led_on();
    }
    return state;
}