]> git.donarmstrong.com Git - qmk_firmware.git/blob - tmk_core/protocol/arm_atsam/usb/main_usb.c
Massdrop keyboard support (#3780)
[qmk_firmware.git] / tmk_core / protocol / arm_atsam / usb / main_usb.c
1 /*
2 Copyright 2018 Massdrop Inc.
3
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 */
17
18 #include "samd51j18a.h"
19 #include "conf_usb.h"
20 #include "udd.h"
21
22 uint8_t keyboard_protocol = 1;
23
24 void main_suspend_action(void)
25 {
26     ui_powerdown();
27 }
28
29 void main_resume_action(void)
30 {
31     ui_wakeup();
32 }
33
34 void main_sof_action(void)
35 {
36     ui_process(udd_get_frame_number());
37 }
38
39 void main_remotewakeup_enable(void)
40 {
41     ui_wakeup_enable();
42 }
43
44 void main_remotewakeup_disable(void)
45 {
46     ui_wakeup_disable();
47 }
48
49 #ifdef KBD
50 volatile bool main_b_kbd_enable = false;
51 bool main_kbd_enable(void)
52 {
53     main_b_kbd_enable = true;
54     return true;
55 }
56
57 void main_kbd_disable(void)
58 {
59     main_b_kbd_enable = false;
60 }
61 #endif
62
63 #ifdef NKRO
64 volatile bool main_b_nkro_enable = false;
65 bool main_nkro_enable(void)
66 {
67     main_b_nkro_enable = true;
68     return true;
69 }
70
71 void main_nkro_disable(void)
72 {
73     main_b_nkro_enable = false;
74 }
75 #endif
76
77 #ifdef EXK
78 volatile bool main_b_exk_enable = false;
79 bool main_exk_enable(void)
80 {
81     main_b_exk_enable = true;
82     return true;
83 }
84
85 void main_exk_disable(void)
86 {
87     main_b_exk_enable = false;
88 }
89 #endif
90
91 #ifdef MOU
92 volatile bool main_b_mou_enable = false;
93 bool main_mou_enable(void)
94 {
95     main_b_mou_enable = true;
96     return true;
97 }
98
99 void main_mou_disable(void)
100 {
101     main_b_mou_enable = false;
102 }
103 #endif
104
105 #ifdef RAW
106 volatile bool main_b_raw_enable = false;
107 bool main_raw_enable(void)
108 {
109     main_b_raw_enable = true;
110     return true;
111 }
112
113 void main_raw_disable(void)
114 {
115     main_b_raw_enable = false;
116 }
117 #endif
118