diff --git a/components/tinyusb/additions/include/tinyusb.h b/components/tinyusb/additions/include/tinyusb.h index 8cf1608142..f0832c2996 100644 --- a/components/tinyusb/additions/include/tinyusb.h +++ b/components/tinyusb/additions/include/tinyusb.h @@ -18,48 +18,6 @@ extern "C" { #endif - -/* tinyusb uses buffers with type of uint8_t[] but in our driver we are reading them as a 32-bit word */ -#if (CFG_TUD_ENDPOINT0_SIZE < 4) -# define CFG_TUD_ENDPOINT0_SIZE 4 -# warning "CFG_TUD_ENDPOINT0_SIZE was too low and was set to 4" -#endif - -#if TUSB_OPT_DEVICE_ENABLED - -# if CFG_TUD_HID -# if (CFG_TUD_HID_BUFSIZE < 4) -# define CFG_TUD_HID_BUFSIZE 4 -# warning "CFG_TUD_HID_BUFSIZE was too low and was set to 4" -# endif -# endif - -# if CFG_TUD_CDC -# if (CFG_TUD_CDC_EP_BUFSIZE < 4) -# define CFG_TUD_CDC_EP_BUFSIZE 4 -# warning "CFG_TUD_CDC_EP_BUFSIZE was too low and was set to 4" -# endif -# endif - -# if CFG_TUD_MSC -# if (CFG_TUD_MSC_BUFSIZE < 4) -# define CFG_TUD_MSC_BUFSIZE 4 -# warning "CFG_TUD_MSC_BUFSIZE was too low and was set to 4" -# endif -# endif - -# if CFG_TUD_MIDI -# if (CFG_TUD_MIDI_EPSIZE < 4) -# define CFG_TUD_MIDI_EPSIZE 4 -# warning "CFG_TUD_MIDI_EPSIZE was too low and was set to 4" -# endif -# endif - -# if CFG_TUD_CUSTOM_CLASS -# warning "Please check that the buffer is more then 4 bytes" -# endif -#endif - /** * @brief Configuration structure of the tinyUSB core */ diff --git a/components/tinyusb/additions/src/tusb_cdc_acm.c b/components/tinyusb/additions/src/tusb_cdc_acm.c index 2c5d39d125..b046ce5050 100644 --- a/components/tinyusb/additions/src/tusb_cdc_acm.c +++ b/components/tinyusb/additions/src/tusb_cdc_acm.c @@ -17,6 +17,7 @@ #include "sdkconfig.h" #define RX_UNREADBUF_SZ_DEFAULT 64 // buffer storing all unread RX data +#define MIN(x, y) (((x) < (y)) ? (x) : (y)) typedef struct { @@ -283,7 +284,7 @@ size_t tinyusb_cdcacm_write_queue(tinyusb_cdcacm_itf_t itf, const uint8_t *in_bu return 0; } const uint32_t size_available = tud_cdc_n_write_available(itf); - return tud_cdc_n_write(itf, in_buf, (in_size < size_available) ? in_size : size_available); + return tud_cdc_n_write(itf, in_buf, MIN(in_size, size_available)); } static uint32_t tud_cdc_n_write_occupied(tinyusb_cdcacm_itf_t itf) diff --git a/examples/peripherals/usb/device/tusb_serial_device/main/tusb_serial_device_main.c b/examples/peripherals/usb/device/tusb_serial_device/main/tusb_serial_device_main.c index 5265f40575..3794713b3a 100644 --- a/examples/peripherals/usb/device/tusb_serial_device/main/tusb_serial_device_main.c +++ b/examples/peripherals/usb/device/tusb_serial_device/main/tusb_serial_device_main.c @@ -44,7 +44,7 @@ void tinyusb_cdc_line_state_changed_callback(int itf, cdcacm_event_t *event) void app_main(void) { ESP_LOGI(TAG, "USB initialization"); - tinyusb_config_t tusb_cfg = {}; // the configuration using default values + const tinyusb_config_t tusb_cfg = {}; // the configuration using default values ESP_ERROR_CHECK(tinyusb_driver_install(&tusb_cfg)); tinyusb_config_cdcacm_t amc_cfg = {