diff options
author | skullydazed <skullydazed@users.noreply.github.com> | 2019-02-23 17:25:25 -0800 |
---|---|---|
committer | MechMerlin <30334081+mechmerlin@users.noreply.github.com> | 2019-02-23 17:25:25 -0800 |
commit | 0f62383be57d2e3dacc79a76973295c73e805038 (patch) | |
tree | ed61dd8da62da9198c0a8268e2235a15f7014e46 /keyboards/clueboard/66_hotswap/prototype/prototype.c | |
parent | 539a6fc8255b5a9f0173dca0b9b6bd94c12a51f4 (diff) |
Clueboard 66% Hotswap Support (#5204)
* Initial Clueboard 66% arm support
* Fix LAYOUT_66_ansi
* wip
* Bring this branch up to date with led_matrix
* Get Clueboard 66% hotswap working with led_matrix
* stm32 cleanup
* Fix compiling for clueboard 66% hotswap prototype
* Reduce the size of the prototype firmware
Diffstat (limited to 'keyboards/clueboard/66_hotswap/prototype/prototype.c')
-rw-r--r-- | keyboards/clueboard/66_hotswap/prototype/prototype.c | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/keyboards/clueboard/66_hotswap/prototype/prototype.c b/keyboards/clueboard/66_hotswap/prototype/prototype.c new file mode 100644 index 0000000000..991d4b8fae --- /dev/null +++ b/keyboards/clueboard/66_hotswap/prototype/prototype.c @@ -0,0 +1,63 @@ +#include "prototype.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); + } +} |