diff options
author | skullydazed <skullydazed@users.noreply.github.com> | 2018-04-01 12:12:45 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-01 12:12:45 -0700 |
commit | 0ca6b53f8981312415c2bf54c8cef22fdc5e2478 (patch) | |
tree | 0e1686ec3958b0f26e1fee9178d061c4d54cc89c /keyboards/clueboard/2x1800/2x1800.c | |
parent | 6f3cbdb5f725f5e82579cd8c96636a1684158f69 (diff) |
Clueboard Double 1800 support (#2655)
Diffstat (limited to 'keyboards/clueboard/2x1800/2x1800.c')
-rw-r--r-- | keyboards/clueboard/2x1800/2x1800.c | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/keyboards/clueboard/2x1800/2x1800.c b/keyboards/clueboard/2x1800/2x1800.c new file mode 100644 index 0000000000..4ad78899fc --- /dev/null +++ b/keyboards/clueboard/2x1800/2x1800.c @@ -0,0 +1,62 @@ +/* Copyright 2017 Zach White <skullydazed@gmail.com> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +#include "2x1800.h" + +void matrix_init_kb(void) { + // Set our LED pins as output + DDRB |= (1<<4); // Numlock + DDRB |= (1<<5); // Capslock + DDRB |= (1<<6); // Scroll Lock + + // JTAG disable for PORT F. write JTD bit twice within four cycles. + MCUCR |= (1<<JTD); + MCUCR |= (1<<JTD); + + // Run the keymap level init + matrix_init_user(); +} + +void matrix_scan_kb(void) { + matrix_scan_user(); +} + +bool process_record_kb(uint16_t keycode, keyrecord_t *record) { + return process_record_user(keycode, record); +} + +void led_set_kb(uint8_t usb_led) { + if (usb_led & (1<<USB_LED_NUM_LOCK)) { + // Turn numlock on + PORTB |= (1<<4); + } else { + // Turn numlock off + PORTB &= ~(1<<4); + } + if (usb_led & (1<<USB_LED_CAPS_LOCK)) { + // Turn capslock on + PORTB |= (1<<5); + } else { + // Turn capslock off + PORTB &= ~(1<<5); + } + if (usb_led & (1<<USB_LED_SCROLL_LOCK)) { + // Turn scroll lock on + PORTB |= (1<<6); + } else { + // Turn scroll lock off + PORTB &= ~(1<<6); + } +} |