]> git.donarmstrong.com Git - qmk_firmware.git/blob - keyboards/scarletbandana/scarletbandana.c
6926312ec5a6304edf64fa40f617ce1256bc89ad
[qmk_firmware.git] / keyboards / scarletbandana / scarletbandana.c
1 /* Copyright 2017 Cole Markham, WoodKeys.click
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 "scarletbandana.h"
17 #include <LUFA/Common/Common.h>
18
19 #include "quantum.h"
20
21 #ifdef AUDIO_ENABLE
22     float tone_startup[][2] = SONG(STARTUP_SOUND);
23     float tone_goodbye[][2] = SONG(GOODBYE_SOUND);
24 #endif
25
26
27 void shutdown_user(void) {
28     #ifdef AUDIO_ENABLE
29         PLAY_NOTE_ARRAY(tone_goodbye, false, 0);
30     _delay_ms(150);
31     stop_all_notes();
32     #endif
33 }
34
35
36 void matrix_init_kb(void)
37 {
38   // This is required to access the pins in the F-register
39   JTAG_DISABLE();
40     debug_enable=true;
41     print("sb matrix_init_kb\n");
42 #ifdef AUDIO_ENABLE
43     _delay_ms(20); // gets rid of tick
44     PLAY_NOTE_ARRAY(tone_startup, false, 0);
45 #endif
46
47
48     // put your keyboard start-up code here
49     // runs once when the firmware starts up
50     matrix_init_user();
51 }
52
53 void matrix_scan_kb(void)
54 {
55     matrix_scan_user();
56 }
57
58 bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
59     // Test code that turns on the switch led for the key that is pressed
60     // set_backlight_by_keymap(record->event.key.col, record->event.key.row);
61     if (keycode == RESET) {
62         reset_keyboard_kb();
63     } else {
64     }
65         return process_record_user(keycode, record);
66 }
67
68 void led_set_kb(uint8_t usb_led) {
69         // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
70         led_set_user(usb_led);
71 }
72
73 //void action_function(keyrecord_t *event, uint8_t id, uint8_t opt)
74 //{
75 //#ifdef AUDIO_ENABLE
76 //    int8_t sign = 1;
77 //#endif
78 //    if(id == LFK_ESC_TILDE){
79 //        // Send ~ on shift-esc
80 //        void (*method)(uint8_t) = (event->event.pressed) ? &add_key : &del_key;
81 //        uint8_t shifted = get_mods() & (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT));
82 //        method(shifted ? KC_GRAVE : KC_ESCAPE);
83 //        send_keyboard_report();
84 //    }else if(event->event.pressed){
85 //        switch(id){
86 //            case LFK_CLEAR:
87 //                // Go back to default layer
88 //                layer_clear();
89 //                break;
90 //#ifdef ISSI_ENABLE
91 //            case LFK_LED_TEST:
92 //                led_test();
93 //                break;
94 //#endif
95 //        }
96 //    }
97 //}
98
99 void reset_keyboard_kb(){
100     xprintf("programming!\n");
101     reset_keyboard();
102 }