]> git.donarmstrong.com Git - qmk_firmware.git/blob - keyboards/clueboard/2x1800/2x1800.c
Clueboard Double 1800 support (#2655)
[qmk_firmware.git] / keyboards / clueboard / 2x1800 / 2x1800.c
1 /* Copyright 2017 Zach White <skullydazed@gmail.com>
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 "2x1800.h"
17
18 void matrix_init_kb(void) {
19         // Set our LED pins as output
20         DDRB |= (1<<4);  // Numlock
21         DDRB |= (1<<5);  // Capslock
22         DDRB |= (1<<6);  // Scroll Lock
23
24         // JTAG disable for PORT F. write JTD bit twice within four cycles.
25         MCUCR |= (1<<JTD);
26         MCUCR |= (1<<JTD);
27
28         // Run the keymap level init
29         matrix_init_user();
30 }
31
32 void matrix_scan_kb(void) {
33         matrix_scan_user();
34 }
35
36 bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
37         return process_record_user(keycode, record);
38 }
39
40 void led_set_kb(uint8_t usb_led) {
41         if (usb_led & (1<<USB_LED_NUM_LOCK)) {
42                 // Turn numlock on
43                 PORTB |= (1<<4);
44         } else {
45                 // Turn numlock off
46                 PORTB &= ~(1<<4);
47         }
48         if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
49                 // Turn capslock on
50                 PORTB |= (1<<5);
51         } else {
52                 // Turn capslock off
53                 PORTB &= ~(1<<5);
54         }
55         if (usb_led & (1<<USB_LED_SCROLL_LOCK)) {
56                 // Turn scroll lock on
57                 PORTB |= (1<<6);
58         } else {
59                 // Turn scroll lock off
60                 PORTB &= ~(1<<6);
61         }
62 }