]> git.donarmstrong.com Git - qmk_firmware.git/blob - keyboards/retro_refit/retro_refit.c
Renames keyboard folder to keyboards, adds couple of tmk's fixes (#432)
[qmk_firmware.git] / keyboards / retro_refit / retro_refit.c
1 #include "retro_refit.h"
2
3 __attribute__ ((weak))
4 void matrix_init_user(void) {
5     // leave this function blank - it can be defined in a keymap file
6 };
7
8 __attribute__ ((weak))
9 void matrix_scan_user(void) {
10     // leave this function blank - it can be defined in a keymap file
11 };
12
13 __attribute__ ((weak))
14 void led_set_user(uint8_t usb_led) {
15     // leave this function blank - it can be defined in a keymap file
16 };
17
18 void matrix_init_kb(void) {
19     // put your keyboard start-up code here
20     // runs once when the firmware starts up
21
22     // Disable status LED on KB, enable status LED on Teensy (KB_STATUS = !TEENSY_STATUS)
23     DDRD |= (1<<6);
24     PORTD |= (1<<6);
25
26     matrix_init_user();
27 };
28
29 void amatrix_scan_kb(void) {
30     // put your looping keyboard code here
31     // runs every cycle (a lot)
32
33     matrix_scan_user();
34 };
35
36 void led_set_kb(uint8_t usb_led) {
37     // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
38
39     if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
40         // output low
41         DDRD |= (1<<0);
42         PORTD &= ~(1<<0);
43     } else {
44         // Hi-Z
45         DDRD &= ~(1<<0);
46         PORTD &= ~(1<<0);
47     }
48     if (usb_led & (1<<USB_LED_NUM_LOCK)) {
49         // output low
50         DDRD |= (1<<1);
51         PORTD &= ~(1<<1);
52     } else {
53         // Hi-Z
54         DDRD &= ~(1<<1);
55         PORTD &= ~(1<<1);
56     }
57     if (usb_led & (1<<USB_LED_SCROLL_LOCK)) {
58         // output low
59         DDRC |= (1<<6);
60         PORTC &= ~(1<<6);
61     } else {
62         // Hi-Z
63         DDRC &= ~(1<<6);
64         PORTC &= ~(1<<6);
65     }
66
67     led_set_user(usb_led);
68 };