From f99b9ba2708ebf5ecbdd62f0c16846789287b24c Mon Sep 17 00:00:00 2001 From: Nick Brassel Date: Wed, 19 Oct 2022 17:17:49 +1100 Subject: [PATCH] Widen the ARM Cortex-M family support. Allow USB peripheral change. (#18767) --- data/schemas/keyboard.jsonschema | 53 +++++++++++++++++++++++++++- tmk_core/protocol/chibios/usb_main.h | 4 ++- tmk_core/protocol/chibios/usb_util.c | 7 ++-- 3 files changed, 59 insertions(+), 5 deletions(-) diff --git a/data/schemas/keyboard.jsonschema b/data/schemas/keyboard.jsonschema index 10eb288350..06ccccc160 100644 --- a/data/schemas/keyboard.jsonschema +++ b/data/schemas/keyboard.jsonschema @@ -42,7 +42,58 @@ }, "processor": { "type": "string", - "enum": ["cortex-m0", "cortex-m0plus", "cortex-m3", "cortex-m4", "MKL26Z64", "MK20DX128", "MK20DX256", "MK64FX512", "MK66FX1M0", "RP2040", "STM32F042", "STM32F072", "STM32F103", "STM32F303", "STM32F401", "STM32F405", "STM32F407", "STM32F411", "STM32F446", "STM32G431", "STM32G474", "STM32L412", "STM32L422", "STM32L432", "STM32L433", "STM32L442", "STM32L443", "GD32VF103", "WB32F3G71", "WB32FQ95", "atmega16u2", "atmega32u2", "atmega16u4", "atmega32u4", "at90usb162", "at90usb646", "at90usb647", "at90usb1286", "at90usb1287", "atmega32a", "atmega328p", "atmega328", "attiny85", "unknown"] + "enum": [ + "cortex-m0", + "cortex-m0plus", + "cortex-m3", + "cortex-m4", + "cortex-m7", + "cortex-m23", + "cortex-m33", + "cortex-m35p", + "cortex-m55", + "cortex-m85", + "MKL26Z64", + "MK20DX128", + "MK20DX256", + "MK64FX512", + "MK66FX1M0", + "RP2040", + "STM32F042", + "STM32F072", + "STM32F103", + "STM32F303", + "STM32F401", + "STM32F405", + "STM32F407", + "STM32F411", + "STM32F446", + "STM32G431", + "STM32G474", + "STM32L412", + "STM32L422", + "STM32L432", + "STM32L433", + "STM32L442", + "STM32L443", + "GD32VF103", + "WB32F3G71", + "WB32FQ95", + "atmega16u2", + "atmega32u2", + "atmega16u4", + "atmega32u4", + "at90usb162", + "at90usb646", + "at90usb647", + "at90usb1286", + "at90usb1287", + "atmega32a", + "atmega328p", + "atmega328", + "attiny85", + "unknown" + ] }, "audio": { "type": "object", 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 . */ #include +#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; }