~ruther/qmk_firmware

f99b9ba2708ebf5ecbdd62f0c16846789287b24c — Nick Brassel 2 years ago d2bc11c
Widen the ARM Cortex-M family support. Allow USB peripheral change. (#18767)

M data/schemas/keyboard.jsonschema => data/schemas/keyboard.jsonschema +52 -1
@@ 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",

M tmk_core/protocol/chibios/usb_main.h => tmk_core/protocol/chibios/usb_main.h +3 -1
@@ 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);

M tmk_core/protocol/chibios/usb_util.c => tmk_core/protocol/chibios/usb_util.c +4 -3
@@ 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;
}