]> git.donarmstrong.com Git - qmk_firmware.git/blob - keyboards/baguette/baguette.c
New keyboard: Baguette (#4047)
[qmk_firmware.git] / keyboards / baguette / baguette.c
1 /* Copyright 2018 Yiancar
2  *
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.
7  *
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.
12  *
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/>.
15  */
16 #include "baguette.h"
17
18 void bootmagic_lite(void)
19 {
20         // The lite version of TMK's bootmagic made by Wilba.
21         // 100% less potential for accidentally making the
22         // keyboard do stupid things.
23
24         // We need multiple scans because debouncing can't be turned off.
25         matrix_scan();
26         wait_ms(DEBOUNCING_DELAY);
27         matrix_scan();
28
29         // If the Esc and space bar are held down on power up,
30         // reset the EEPROM valid state and jump to bootloader.
31         // Assumes Esc is at [0,0] and spacebar is at [4,7].
32         // This isn't very generalized, but we need something that doesn't
33         // rely on user's keymaps in firmware or EEPROM.
34         if ( ( matrix_get_row(0) & (1<<0) ) &&
35                 ( matrix_get_row(4) & (1<<7) ) )
36         {
37                 // Set the TMK/QMK EEPROM state as invalid.
38                 eeconfig_disable();
39                 //eeprom_set_valid(false);
40                 // Jump to bootloader.
41                 bootloader_jump();
42         }
43 }
44
45 void matrix_init_kb(void) {
46         // put your keyboard start-up code here
47         // runs once when the firmware starts up
48         bootmagic_lite();
49
50         matrix_init_user();
51 }
52
53 void matrix_scan_kb(void) {
54         // put your looping keyboard code here
55         // runs every cycle (a lot)
56
57         matrix_scan_user();
58 }
59
60 bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
61         // put your per-action keyboard code here
62         // runs for every action, just before processing by the firmware
63
64         return process_record_user(keycode, record);
65 }
66
67 void led_set_kb(uint8_t usb_led) {
68         // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
69
70         led_set_user(usb_led);
71 }