]> git.donarmstrong.com Git - qmk_firmware.git/blob - quantum/template/template.c
Adding LED function pointers
[qmk_firmware.git] / quantum / template / template.c
1 #include "%KEYBOARD%.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         return NULL;
7 };
8
9 __attribute__ ((weak))
10 void * matrix_scan_user(void) {
11         // leave this function blank - it can be defined in a keymap file
12         return NULL;
13 };
14
15 __attribute__ ((weak))
16 void * led_set_user(uint8_t usb_led) {
17         // leave this function blank - it can be defined in a keymap file
18         return NULL;
19 };
20
21 void * matrix_init_kb(void) {
22         // put your keyboard start-up code here
23         // runs once when the firmware starts up
24         
25         if (matrix_init_user) {
26                 (*matrix_init_user)();
27         }
28         return NULL;
29 };
30
31 void * matrix_scan_kb(void) {
32     // put your looping keyboard code here
33     // runs every cycle (a lot)
34
35         if (matrix_scan_user) {
36                 (*matrix_scan_user)();
37         }
38         return NULL;
39 };
40
41 void * led_set_kb(uint8_t usb_led) {
42         // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
43
44         if (led_set_user) {
45                 (*led_set_user)(usb_led);
46         }
47         return NULL;
48 };