mirror of
https://github.com/0xFEEDC0DE64/arduino-esp32.git
synced 2025-07-24 07:47:14 +02:00
Add initial support for USB MSC (#5466)
* Add initial support for USB MSC * Add Firmware Upload/Download With MSC Current running firmware is available as file inside the MSC Disk. To update the firmware on the ESP, just copy a regular firmware bin into the drive * Support overwriting of the firmware file Overwriting a file is done totally differently on MacOS, Windows and Linux. This change supports it on all of them. * Allow CDC, FirmwareMSC and DFU to be enabled on boot * Add example ESP32-S2 USB-ONLY board * Various device code optimizations Added `end()` methods to MSC classes Made begin() methods safe to be called multiple times Optimized CDC class * Fix CDC Connect/Disconnect detection in Arduino IDE on Windows * Rework cdc_write * Update ESP32-S2 board configs
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
#include "USB.h"
|
||||
|
||||
#if ARDUINO_SERIAL_PORT
|
||||
#if ARDUINO_USB_CDC_ON_BOOT
|
||||
#define HWSerial Serial0
|
||||
#define USBSerial Serial
|
||||
#else
|
||||
@ -66,14 +66,8 @@ void setup() {
|
||||
USB.onEvent(usbEventCallback);
|
||||
USBSerial.onEvent(usbEventCallback);
|
||||
|
||||
#if !ARDUINO_SERIAL_PORT
|
||||
USB.enableDFU();
|
||||
USB.webUSB(true);
|
||||
USB.webUSBURL("http://localhost/webusb");
|
||||
USB.productName("ESP32S2-USB");
|
||||
USB.begin();
|
||||
USBSerial.begin();
|
||||
#endif
|
||||
USB.begin();
|
||||
}
|
||||
|
||||
void loop() {
|
||||
|
Reference in New Issue
Block a user