aboutsummaryrefslogtreecommitdiff
path: root/tmk_core/protocol/lufa
diff options
context:
space:
mode:
Diffstat (limited to 'tmk_core/protocol/lufa')
-rw-r--r--tmk_core/protocol/lufa/lufa.c3
-rw-r--r--tmk_core/protocol/lufa/usb_util.c34
2 files changed, 35 insertions, 2 deletions
diff --git a/tmk_core/protocol/lufa/lufa.c b/tmk_core/protocol/lufa/lufa.c
index 85d71d083..63619fdb3 100644
--- a/tmk_core/protocol/lufa/lufa.c
+++ b/tmk_core/protocol/lufa/lufa.c
@@ -1107,8 +1107,7 @@ int main(void) {
1107#endif 1107#endif
1108 1108
1109 // Run housekeeping 1109 // Run housekeeping
1110 housekeeping_task_kb(); 1110 housekeeping_task();
1111 housekeeping_task_user();
1112 } 1111 }
1113} 1112}
1114 1113
diff --git a/tmk_core/protocol/lufa/usb_util.c b/tmk_core/protocol/lufa/usb_util.c
new file mode 100644
index 000000000..9e943a21b
--- /dev/null
+++ b/tmk_core/protocol/lufa/usb_util.c
@@ -0,0 +1,34 @@
1/* Copyright 2021 QMK
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 3 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 <LUFA/Drivers/USB/USB.h>
17#include "usb_util.h"
18#include "wait.h"
19
20void usb_disable(void) {
21 USB_Disable();
22 USB_DeviceState = DEVICE_STATE_Unattached;
23}
24
25bool usb_connected_state(void) { return USB_Device_IsAddressSet(); }
26
27#if defined(OTGPADE)
28bool usb_vbus_state(void) {
29 USB_OTGPAD_On(); // enables VBUS pad
30 wait_us(5);
31
32 return USB_VBUS_GetStatus(); // checks state of VBUS
33}
34#endif