summaryrefslogtreecommitdiff
path: root/tmk_core/protocol
diff options
context:
space:
mode:
authorNick Brassel <nick@tzarc.org>2022-10-19 17:17:49 +1100
committerGitHub <noreply@github.com>2022-10-19 17:17:49 +1100
commitf99b9ba2708ebf5ecbdd62f0c16846789287b24c (patch)
tree5112e60c0fcdd69276ca3964fdd8d2c60b68dc8e /tmk_core/protocol
parentd2bc11ca67fc0734ecf815e034d97b4efc89fa79 (diff)
Widen the ARM Cortex-M family support. Allow USB peripheral change. (#18767)
Diffstat (limited to 'tmk_core/protocol')
-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;
}