summaryrefslogtreecommitdiff
path: root/keyboards/clueboard/17/17.c
diff options
context:
space:
mode:
authorskullY <skullydazed@gmail.com>2017-10-21 13:51:02 -0700
committerskullY <skullydazed@gmail.com>2017-10-21 13:51:18 -0700
commit9bb259b660925c7a5cd64b3a0a4484cdf757b504 (patch)
treed430ed0cad5c3eff211359603a968868356b9cb8 /keyboards/clueboard/17/17.c
parentab3dbd8daad0554104862f97e33291973bbef7ed (diff)
Fix the naming for clueboard files
Diffstat (limited to 'keyboards/clueboard/17/17.c')
-rw-r--r--keyboards/clueboard/17/17.c60
1 files changed, 60 insertions, 0 deletions
diff --git a/keyboards/clueboard/17/17.c b/keyboards/clueboard/17/17.c
new file mode 100644
index 0000000000..f84e3253e9
--- /dev/null
+++ b/keyboards/clueboard/17/17.c
@@ -0,0 +1,60 @@
+#include "17.h"
+
+int pwm_level;
+
+void matrix_init_kb(void) {
+ // put your keyboard start-up code here
+ // runs once when the firmware starts up
+ matrix_init_user();
+
+ // JTAG disable for PORT F. write JTD bit twice within four cycles.
+ MCUCR |= (1<<JTD);
+ MCUCR |= (1<<JTD);
+};
+
+void led_set_kb(uint8_t usb_led)
+{
+ print("led_set\n");
+}
+
+void backlight_init_ports(void)
+{
+ // Set C7 to output
+ DDRC |= (1<<7);
+
+ // Initialize the timer
+ TC4H = 0x03;
+ OCR4C = 0xFF;
+ TCCR4A = 0b10000010;
+ TCCR4B = 0b00000001;
+}
+
+void backlight_set(uint8_t level)
+{
+ // Determine the PWM level
+ switch (level)
+ {
+ case 0:
+ // 33%
+ pwm_level = 0x54;
+ break;
+ case 1:
+ // 66%
+ pwm_level = 0xA8;
+ break;
+ case 2:
+ // 100%
+ pwm_level = 0xFF;
+ break;
+ case 3:
+ // 0%
+ pwm_level = 0x00;
+ break;
+ default:
+ xprintf("Unknown level: %d\n", level);
+ }
+
+ // Write the PWM level to the timer
+ TC4H = pwm_level >> 8;
+ OCR4A = 0xFF & pwm_level;
+}