aboutsummaryrefslogtreecommitdiff
path: root/keyboards/clueboard/66/rev4/rev4.c
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/clueboard/66/rev4/rev4.c')
-rw-r--r--keyboards/clueboard/66/rev4/rev4.c76
1 files changed, 76 insertions, 0 deletions
diff --git a/keyboards/clueboard/66/rev4/rev4.c b/keyboards/clueboard/66/rev4/rev4.c
new file mode 100644
index 000000000..041c31cd3
--- /dev/null
+++ b/keyboards/clueboard/66/rev4/rev4.c
@@ -0,0 +1,76 @@
1#include "rev4.h"
2//#include "backlight.h"
3
4void matrix_init_kb(void) {
5 // put your keyboard start-up code here
6 // runs once when the firmware starts up
7 matrix_init_user();
8 led_init_ports();
9}
10
11void matrix_scan_kb(void) {
12 matrix_scan_user();
13}
14
15void backlight_init_ports(void) {
16 print("init_backlight_pin()\n");
17 // Set our LED pins as output
18 //DDRD |= (1<<6); // Esc
19 //DDRB |= (1<<7); // Page Up
20 //DDRD |= (1<<4); // Arrows
21
22 // Set our LED pins low
23 //PORTD &= ~(1<<6); // Esc
24 //PORTB &= ~(1<<7); // Page Up
25 //PORTD &= ~(1<<4); // Arrows
26}
27
28void backlight_set(uint8_t level) {
29/*
30 if ( level == 0 ) {
31 // Turn off light
32 PORTD |= (1<<6); // Esc
33 PORTB |= (1<<7); // Page Up
34 PORTD |= (1<<4); // Arrows
35 } else {
36 // Turn on light
37 PORTD &= ~(1<<6); // Esc
38 PORTB &= ~(1<<7); // Page Up
39 PORTD &= ~(1<<4); // Arrows
40 }
41*/
42}
43
44void led_init_ports() {
45 // Set our LED pins as output
46 palSetPadMode(GPIOB, 13, PAL_MODE_OUTPUT_PUSHPULL); // LED1
47 palClearPad(GPIOB, 13);
48 palSetPadMode(GPIOB, 14, PAL_MODE_OUTPUT_PUSHPULL); // LED2
49 palClearPad(GPIOB, 14);
50 palSetPadMode(GPIOA, 8, PAL_MODE_OUTPUT_PUSHPULL); // LED3
51 palClearPad(GPIOA, 8);
52 palSetPadMode(GPIOA, 0, PAL_MODE_OUTPUT_PUSHPULL); // Capslock LED
53 palClearPad(GPIOA, 0);
54}
55
56void led_set_kb(uint8_t usb_led) {
57 if (usb_led & (1<<USB_LED_NUM_LOCK)) {
58 palSetPad(GPIOB, 13); // LED1
59 } else {
60 palClearPad(GPIOB, 13); // LED1
61 }
62
63 if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
64 palSetPad(GPIOA, 0); // Capslock LED
65 palSetPad(GPIOB, 14); // LED2
66 } else {
67 palClearPad(GPIOA, 0); // Capslock LED
68 palClearPad(GPIOB, 14); // LED2
69 }
70
71 if (usb_led & (1<<USB_LED_SCROLL_LOCK)) {
72 palSetPad(GPIOA, 8); // LED3
73 } else {
74 palClearPad(GPIOA, 8); // LED3
75 }
76}