Widen the ARM Cortex-M family support. Allow USB peripheral change. (#18767)

This commit is contained in:
Nick Brassel 2022-10-19 17:17:49 +11:00 committed by GitHub
parent d2bc11ca67
commit f99b9ba270
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 59 additions and 5 deletions

View File

@ -42,7 +42,58 @@
}, },
"processor": { "processor": {
"type": "string", "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": { "audio": {
"type": "object", "type": "object",

View File

@ -26,7 +26,9 @@
*/ */
/* The USB driver to use */ /* 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 */ /* Initialize the USB driver and bus */
void init_usb_driver(USBDriver *usbp); void init_usb_driver(USBDriver *usbp);

View File

@ -14,13 +14,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <hal.h> #include <hal.h>
#include "usb_main.h"
#include "usb_util.h" #include "usb_util.h"
void usb_disconnect(void) { void usb_disconnect(void) {
usbDisconnectBus(&USBD1); usbDisconnectBus(&USB_DRIVER);
usbStop(&USBD1); usbStop(&USB_DRIVER);
} }
bool usb_connected_state(void) { bool usb_connected_state(void) {
return usbGetDriverStateI(&USBD1) == USB_ACTIVE; return usbGetDriverStateI(&USB_DRIVER) == USB_ACTIVE;
} }