1 /* Copyright 2017 Cole Markham, WoodKeys.click
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/>.
21 #define BACKLIGHT_BREATHING
23 extern void backlight_set(uint8_t level);
25 void matrix_init_kb(void)
28 print("meira matrix_init_kb\n");
34 #ifdef WATCHDOG_ENABLE
35 // This is done after turning the layer LED red, if we're caught in a loop
36 // we should get a flashing red light
37 wdt_enable(WDTO_500MS);
40 // put your keyboard start-up code here
41 // runs once when the firmware starts up
45 void matrix_scan_kb(void)
47 #ifdef WATCHDOG_ENABLE
51 // switch/underglow lighting update
52 static uint32_t issi_device = 0;
53 static uint32_t twi_last_ready = 0;
54 if(twi_last_ready > 1000){
55 // Its been way too long since the last ISSI update, reset the I2C bus and start again
56 xprintf("TWI failed to recover, TWI re-init\n");
63 // If the i2c bus is available, kick off the issi update, alternate between devices
64 update_issi(issi_device, issi_device);
77 bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
78 // Test code that turns on the switch led for the key that is pressed
79 // set_backlight_by_keymap(record->event.key.col, record->event.key.row);
80 if (keycode == RESET) {
84 return process_record_user(keycode, record);
87 void led_set_kb(uint8_t usb_led) {
88 // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
89 led_set_user(usb_led);
92 //void action_function(keyrecord_t *event, uint8_t id, uint8_t opt)
97 // if(id == LFK_ESC_TILDE){
98 // // Send ~ on shift-esc
99 // void (*method)(uint8_t) = (event->event.pressed) ? &add_key : &del_key;
100 // uint8_t shifted = get_mods() & (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT));
101 // method(shifted ? KC_GRAVE : KC_ESCAPE);
102 // send_keyboard_report();
103 // }else if(event->event.pressed){
106 // // Go back to default layer
110 // case LFK_LED_TEST:
118 void reset_keyboard_kb(){
119 #ifdef WATCHDOG_ENABLE
124 xprintf("programming!\n");