summaryrefslogtreecommitdiffstats
path: root/tmk_core/protocol/chibios
diff options
context:
space:
mode:
Diffstat (limited to 'tmk_core/protocol/chibios')
-rw-r--r--tmk_core/protocol/chibios/usb_main.h4
-rw-r--r--tmk_core/protocol/chibios/usb_util.c7
2 files changed, 7 insertions, 4 deletions
diff --git a/tmk_core/protocol/chibios/usb_main.h b/tmk_core/protocol/chibios/usb_main.h
index dd105e7b5e..07186f76b8 100644
--- a/tmk_core/protocol/chibios/usb_main.h
+++ b/tmk_core/protocol/chibios/usb_main.h
@@ -26,7 +26,9 @@
*/
/* The USB driver to use */
-#define USB_DRIVER USBD1
+#ifndef USB_DRIVER
+# define USB_DRIVER USBD1
+#endif // USB_DRIVER
/* Initialize the USB driver and bus */
void init_usb_driver(USBDriver *usbp);
diff --git a/tmk_core/protocol/chibios/usb_util.c b/tmk_core/protocol/chibios/usb_util.c
index a8c7d9a228..9d8b2c4007 100644
--- a/tmk_core/protocol/chibios/usb_util.c
+++ b/tmk_core/protocol/chibios/usb_util.c
@@ -14,13 +14,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <hal.h>
+#include "usb_main.h"
#include "usb_util.h"
void usb_disconnect(void) {
- usbDisconnectBus(&USBD1);
- usbStop(&USBD1);
+ usbDisconnectBus(&USB_DRIVER);
+ usbStop(&USB_DRIVER);
}
bool usb_connected_state(void) {
- return usbGetDriverStateI(&USBD1) == USB_ACTIVE;
+ return usbGetDriverStateI(&USB_DRIVER) == USB_ACTIVE;
}