diff options
Diffstat (limited to 'keyboards/mode/m65s/m65s.c')
-rw-r--r-- | keyboards/mode/m65s/m65s.c | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/keyboards/mode/m65s/m65s.c b/keyboards/mode/m65s/m65s.c new file mode 100644 index 000000000..298fc9414 --- /dev/null +++ b/keyboards/mode/m65s/m65s.c | |||
@@ -0,0 +1,68 @@ | |||
1 | /* | ||
2 | Copyright 2020 Álvaro "Gondolindrim" Volpato <alvaro.volpato@usp.br> | ||
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 "m65s.h" | ||
19 | |||
20 | void board_init(void) { | ||
21 | setPinInput(B9); | ||
22 | setPinInput(B10); | ||
23 | } | ||
24 | |||
25 | #define LED_PIN_ON_STATE 1 | ||
26 | void led_init_ports(void) { | ||
27 | |||
28 | /** If the OPENDRAIN_INDICATORS option is not defined in config.h, the indicator | ||
29 | pins default to push-pull output. Else, they are defined as open-drain. The | ||
30 | pin mode configuration is done through the INDICATOR_PIN_MODE which is | ||
31 | attributed right at the beggining. **/ | ||
32 | |||
33 | #ifndef OPENDRAIN_INDICATORS | ||
34 | # define INDICATOR_PIN_MODE PAL_MODE_OUTPUT_PUSHPULL | ||
35 | #else | ||
36 | # define INDICATOR_PIN_MODE PAL_MODE_OUTPUT_OPENDRAIN | ||
37 | |||
38 | #endif | ||
39 | |||
40 | #ifdef LED_NUM_LOCK_PIN | ||
41 | palSetLineMode(LED_NUM_LOCK_PIN, INDICATOR_PIN_MODE); | ||
42 | #endif | ||
43 | #ifdef LED_CAPS_LOCK_PIN | ||
44 | palSetLineMode(LED_CAPS_LOCK_PIN, INDICATOR_PIN_MODE); | ||
45 | #endif | ||
46 | #ifdef LED_SCROLL_LOCK_PIN | ||
47 | palSetLineMode(LED_SCROLL_LOCK_PIN, INDICATOR_PIN_MODE); | ||
48 | #endif | ||
49 | #ifdef LED_COMPOSE_PIN | ||
50 | palSetLineMode(LED_COMPOSE_PIN, INDICATOR_PIN_MODE); | ||
51 | #endif | ||
52 | #ifdef LED_KANA_PIN | ||
53 | palSetLineMode(LED_KANA_PIN, INDICATOR_PIN_MODE); | ||
54 | #endif | ||
55 | } | ||
56 | |||
57 | bool led_update_kb(led_t led_state) { | ||
58 | bool res = led_update_user(led_state); | ||
59 | if(res) { | ||
60 | // writePin sets the pin high for 1 and low for 0. | ||
61 | // In this example the pins are inverted, setting | ||
62 | // it low/0 turns it on, and high/1 turns the LED off. | ||
63 | // This behavior depends on whether the LED is between the pin | ||
64 | // and VCC or the pin and GND. | ||
65 | writePin(LED_CAPS_LOCK_PIN, !led_state.caps_lock); | ||
66 | } | ||
67 | return res; | ||
68 | } | ||