]> git.gir.st - tmk_keyboard.git/blob - keyboard/ergodox/led.c
Merge remote-tracking branch 'upsteam/master'
[tmk_keyboard.git] / keyboard / ergodox / led.c
1 /*
2 Copyright 2013 Oleg Kostyuk <cub.uanic@gmail.com>
3
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18 #include <stdint.h>
19 #include <avr/io.h>
20 #include "print.h"
21 #include "debug.h"
22 #include "led.h"
23 #include "ergodox.h"
24
25
26 void led_set(uint8_t usb_led)
27 {
28 // topmost - NumLock
29 #ifndef INVERT_NUMLOCK
30 if (usb_led & (1<<USB_LED_NUM_LOCK)) {
31 ergodox_right_led_1_on();
32 } else {
33 ergodox_right_led_1_off();
34 }
35 #else
36 if (usb_led & (1<<USB_LED_NUM_LOCK)) {
37 ergodox_right_led_1_off();
38 } else {
39 ergodox_right_led_1_on();
40 }
41 #endif
42
43 // middle - CapsLock
44 if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
45 ergodox_right_led_2_on();
46 } else {
47 ergodox_right_led_2_off();
48 }
49
50 // bottommost - ScrollLock
51 if (usb_led & (1<<USB_LED_SCROLL_LOCK)) {
52 ergodox_right_led_3_on();
53 } else {
54 ergodox_right_led_3_off();
55 }
56 }
Imprint / Impressum