mirror of
https://github.com/micropython/micropython.git
synced 2025-12-15 17:30:14 +01:00
zephyr/src: Fix USB device_next driver to work with zephyr 4.0.0.
The blocklist argument is not available in zephyr 4.0.0. Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
@@ -34,12 +34,22 @@
|
||||
#include <zephyr/logging/log.h>
|
||||
LOG_MODULE_REGISTER(mp_usbd);
|
||||
|
||||
#if KERNEL_VERSION_NUMBER >= ZEPHYR_VERSION(4, 1, 0)
|
||||
|
||||
#define BLOCKLIST , blocklist
|
||||
|
||||
/* By default, do not register the USB DFU class DFU mode instance. */
|
||||
static const char *const blocklist[] = {
|
||||
"dfu_dfu",
|
||||
NULL,
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
#define BLOCKLIST
|
||||
|
||||
#endif
|
||||
|
||||
USBD_DEVICE_DEFINE(mp_usbd,
|
||||
DEVICE_DT_GET(DT_NODELABEL(zephyr_udc0)),
|
||||
CONFIG_MICROPY_USB_DEVICE_VID, CONFIG_MICROPY_USB_DEVICE_PID);
|
||||
@@ -121,7 +131,7 @@ struct usbd_context *mp_usbd_init_device(usbd_msg_cb_t msg_cb) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
err = usbd_register_all_classes(&mp_usbd, USBD_SPEED_HS, 1, blocklist);
|
||||
err = usbd_register_all_classes(&mp_usbd, USBD_SPEED_HS, 1 BLOCKLIST);
|
||||
if (err) {
|
||||
LOG_ERR("Failed to add register classes");
|
||||
return NULL;
|
||||
@@ -137,7 +147,7 @@ struct usbd_context *mp_usbd_init_device(usbd_msg_cb_t msg_cb) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
err = usbd_register_all_classes(&mp_usbd, USBD_SPEED_FS, 1, blocklist);
|
||||
err = usbd_register_all_classes(&mp_usbd, USBD_SPEED_FS, 1 BLOCKLIST);
|
||||
if (err) {
|
||||
LOG_ERR("Failed to add register classes");
|
||||
return NULL;
|
||||
|
||||
Reference in New Issue
Block a user