aboutsummaryrefslogtreecommitdiff
path: root/keyboards/clueboard_66/rev2/rev2.c
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/clueboard_66/rev2/rev2.c')
-rw-r--r--keyboards/clueboard_66/rev2/rev2.c63
1 files changed, 63 insertions, 0 deletions
diff --git a/keyboards/clueboard_66/rev2/rev2.c b/keyboards/clueboard_66/rev2/rev2.c
new file mode 100644
index 000000000..1a35b87b8
--- /dev/null
+++ b/keyboards/clueboard_66/rev2/rev2.c
@@ -0,0 +1,63 @@
1#include "rev2.h"
2#include <avr/io.h>
3#include "backlight.h"
4#include "print.h"
5
6void matrix_init_kb(void) {
7 // put your keyboard start-up code here
8 // runs once when the firmware starts up
9 matrix_init_user();
10 led_init_ports();
11
12 // JTAG disable for PORT F. write JTD bit twice within four cycles.
13 MCUCR |= (1<<JTD);
14 MCUCR |= (1<<JTD);
15}
16
17
18void matrix_scan_kb(void) {
19 matrix_scan_user();
20}
21
22void backlight_init_ports(void) {
23 print("init_backlight_pin()\n");
24 // Set our LED pins as output
25 DDRD |= (1<<6); // Esc
26 DDRB |= (1<<7); // Page Up
27 DDRD |= (1<<4); // Arrows
28
29 // Set our LED pins low
30 PORTD &= ~(1<<6); // Esc
31 PORTB &= ~(1<<7); // Page Up
32 PORTD &= ~(1<<4); // Arrows
33}
34
35void backlight_set(uint8_t level) {
36 if ( level == 0 ) {
37 // Turn off light
38 PORTD |= (1<<6); // Esc
39 PORTB |= (1<<7); // Page Up
40 PORTD |= (1<<4); // Arrows
41 } else {
42 // Turn on light
43 PORTD &= ~(1<<6); // Esc
44 PORTB &= ~(1<<7); // Page Up
45 PORTD &= ~(1<<4); // Arrows
46 }
47}
48
49void led_init_ports() {
50 // * Set our LED pins as output
51 DDRB |= (1<<4);
52}
53
54void led_set_kb(uint8_t usb_led) {
55 DDRB |= (1<<4);
56 if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
57 // Turn capslock on
58 PORTB |= (1<<4);
59 } else {
60 // Turn capslock off
61 PORTB &= ~(1<<4);
62 }
63}