3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 void keyboard_pre_init_kb(void) {
19 // Set the layer LED IO as outputs
20 setPinOutput(LAYER_INDICATOR_LED_0);
21 setPinOutput(LAYER_INDICATOR_LED_1);
23 keyboard_pre_init_user();
26 void shutdown_user() {
27 // Shutdown the layer LEDs
28 writePinLow(LAYER_INDICATOR_LED_0);
29 writePinLow(LAYER_INDICATOR_LED_1);
32 layer_state_t layer_state_set_kb(layer_state_t state) {
33 // Layer LEDs act as binary indication of current layer
34 uint8_t layer = biton32(state);
35 writePin(LAYER_INDICATOR_LED_0, layer & 0b1);
36 writePin(LAYER_INDICATOR_LED_1, (layer >> 1) & 0b1);
37 return layer_state_set_user(state);
40 // Optional override functions below.
41 // You can leave any or all of these undefined.
42 // These are only required if you want to perform custom actions.
44 void matrix_init_kb(void) {
45 // put your keyboard start-up code here
46 // runs once when the firmware starts up
47 for (int i = 0; i < 2; i++) {
48 writePin(LAYER_INDICATOR_LED_0, true);
49 writePin(LAYER_INDICATOR_LED_1, false);
51 writePin(LAYER_INDICATOR_LED_0, true);
52 writePin(LAYER_INDICATOR_LED_1, true);
54 writePin(LAYER_INDICATOR_LED_0, false);
55 writePin(LAYER_INDICATOR_LED_1, true);
57 writePin(LAYER_INDICATOR_LED_0, false);
58 writePin(LAYER_INDICATOR_LED_1, false);
65 void matrix_scan_kb(void) {
66 // put your looping keyboard code here
67 // runs every cycle (a lot)
72 bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
73 // put your per-action keyboard code here
74 // runs for every action, just before processing by the firmware
76 return process_record_user(keycode, record);
79 void led_set_kb(uint8_t usb_led) {
80 // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
82 led_set_user(usb_led);