summaryrefslogtreecommitdiffstats
path: root/keyboards/clueboard/66_hotswap/gen1/gen1.c
diff options
context:
space:
mode:
authorskullydazed <skullydazed@users.noreply.github.com>2018-02-11 02:09:47 +0100
committerGitHub <noreply@github.com>2018-02-11 02:09:47 +0100
commit994d94140e16f60515f193337309d89af6e6695e (patch)
treeb5f779a25f5a064e329bdb5944eeeb6a028b8e05 /keyboards/clueboard/66_hotswap/gen1/gen1.c
parentfa72d4aa5ad278bd830fdea6da4e6d1311bba96d (diff)
downloadqmk_firmware-994d94140e16f60515f193337309d89af6e6695e.tar.gz
qmk_firmware-994d94140e16f60515f193337309d89af6e6695e.tar.xz
Clueboard hotswap support (#2376)
Diffstat (limited to 'keyboards/clueboard/66_hotswap/gen1/gen1.c')
-rw-r--r--keyboards/clueboard/66_hotswap/gen1/gen1.c63
1 files changed, 63 insertions, 0 deletions
diff --git a/keyboards/clueboard/66_hotswap/gen1/gen1.c b/keyboards/clueboard/66_hotswap/gen1/gen1.c
new file mode 100644
index 000000000..01f74bc50
--- /dev/null
+++ b/keyboards/clueboard/66_hotswap/gen1/gen1.c
@@ -0,0 +1,63 @@
+#include "gen1.h"
+#include <avr/io.h>
+#include "backlight.h"
+#include "print.h"
+
+void matrix_init_kb(void) {
+ // put your keyboard start-up code here
+ // runs once when the firmware starts up
+ matrix_init_user();
+ led_init_ports();
+
+ // JTAG disable for PORT F. write JTD bit twice within four cycles.
+ MCUCR |= (1<<JTD);
+ MCUCR |= (1<<JTD);
+}
+
+
+void matrix_scan_kb(void) {
+ matrix_scan_user();
+}
+
+void backlight_init_ports(void) {
+ print("init_backlight_pin()\n");
+ // Set our LED pins as output
+ DDRD |= (1<<0); // Esc
+ DDRD |= (1<<4); // Page Up
+ DDRD |= (1<<1); // Arrows
+
+ // Set our LED pins low
+ PORTD &= ~(1<<0); // Esc
+ PORTD &= ~(1<<4); // Page Up
+ PORTD &= ~(1<<1); // Arrows
+}
+
+void backlight_set(uint8_t level) {
+ if ( level == 0 ) {
+ // Turn off light
+ PORTD |= (1<<0); // Esc
+ PORTD |= (1<<4); // Page Up
+ PORTD |= (1<<1); // Arrows
+ } else {
+ // Turn on light
+ PORTD &= ~(1<<0); // Esc
+ PORTD &= ~(1<<4); // Page Up
+ PORTD &= ~(1<<1); // Arrows
+ }
+}
+
+void led_init_ports() {
+ // * Set our LED pins as output
+ DDRB |= (1<<4);
+}
+
+void led_set_kb(uint8_t usb_led) {
+ DDRB |= (1<<4);
+ if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
+ // Turn capslock on
+ PORTB |= (1<<4);
+ } else {
+ // Turn capslock off
+ PORTB &= ~(1<<4);
+ }
+}