]> git.donarmstrong.com Git - qmk_firmware.git/blob - keyboards/xd75/xd75.c
Usbasploader bootloader option addition (#6304)
[qmk_firmware.git] / keyboards / xd75 / xd75.c
1 /* Copyright 2017 Benjamin Kesselring
2  *
3  * This program is free software: you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License as published by
5  * the Free Software Foundation, either version 2 of the License, or
6  * (at your option) any later version.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
15  */
16 #include "xd75.h"
17
18 #define XD75_CAPSLOCK_LED 2  // B2
19 #define XD75_GP103_LED 4  // F4
20 #define XD75_KEYCAPS_LED 5  // F5
21 #define XD75_GP100_LED 7  // F7
22
23 void matrix_init_kb(void) {
24         // put your keyboard start-up code here
25         // runs once when the firmware starts up
26
27         capslock_led_init();
28         gp100_led_init();
29         gp103_led_init();
30         keycaps_led_init();
31
32         matrix_init_user();
33 }
34
35 void matrix_scan_kb(void) {
36         // put your looping keyboard code here
37         // runs every cycle (a lot)
38
39         matrix_scan_user();
40 }
41
42 bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
43         // put your per-action keyboard code here
44         // runs for every action, just before processing by the firmware
45
46         return process_record_user(keycode, record);
47 }
48
49 void led_set_kb(uint8_t usb_led) {
50         // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
51
52         led_set_user(usb_led);
53 }
54
55 void capslock_led_init(void) {
56         DDRB |= (1 << XD75_CAPSLOCK_LED);
57         capslock_led_off();
58 }
59
60 void capslock_led_off(void) {
61         PORTB |= (1 << XD75_CAPSLOCK_LED);
62 }
63
64 void capslock_led_on(void) {
65         PORTB &= ~(1 << XD75_CAPSLOCK_LED);
66 }
67
68 void gp100_led_init(void) {
69         DDRF |= (1 << XD75_GP100_LED);
70         gp100_led_off();
71 }
72
73 void gp100_led_off(void) {
74         PORTF |= (1 << XD75_GP100_LED);
75 }
76
77 void gp100_led_on(void) {
78         PORTF &= ~(1 << XD75_GP100_LED);
79 }
80
81 void gp103_led_init(void) {
82         DDRF |= (1 << XD75_GP103_LED);
83         gp103_led_off();
84 }
85
86 void gp103_led_off(void) {
87         PORTF &= ~(1 << XD75_GP103_LED);
88 }
89
90 void gp103_led_on(void) {
91         PORTF |= (1 << XD75_GP103_LED);
92 }
93
94 void keycaps_led_init(void) {
95         DDRF |= (1 << XD75_KEYCAPS_LED);
96         keycaps_led_off();
97 }
98
99 void keycaps_led_off(void) {
100         PORTF |= (1 << XD75_KEYCAPS_LED);
101 }
102
103 void keycaps_led_on(void) {
104         PORTF &= ~(1 << XD75_KEYCAPS_LED);
105 }