Skip to content

Commit c5bcf6d

Browse files
authored
arduino_tinyusb: compile support for DFU mode (#116)
1 parent 8c244e1 commit c5bcf6d

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

Diff for: components/arduino_tinyusb/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ if(CONFIG_TINYUSB_ENABLED)
4343
"${COMPONENT_DIR}/tinyusb/src/class/msc/msc_device.c"
4444
"${COMPONENT_DIR}/tinyusb/src/class/video/video_device.c"
4545
"${COMPONENT_DIR}/tinyusb/src/class/dfu/dfu_rt_device.c"
46+
"${COMPONENT_DIR}/tinyusb/src/class/dfu/dfu_device.c"
4647
"${COMPONENT_DIR}/tinyusb/src/class/vendor/vendor_device.c"
4748
"${COMPONENT_DIR}/tinyusb/src/common/tusb_fifo.c"
4849
"${COMPONENT_DIR}/tinyusb/src/device/usbd_control.c"

Diff for: components/arduino_tinyusb/Kconfig.projbuild

+25
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,31 @@ menu "Arduino TinyUSB"
175175

176176
endmenu
177177

178+
menu "DFU driver"
179+
depends on TINYUSB_ENABLED
180+
181+
config TINYUSB_DFU_ENABLED
182+
bool "Enable USB DFU TinyUSB driver"
183+
default y
184+
help
185+
Enable USB DFU TinyUSB driver.
186+
187+
config TINYUSB_DESC_DFU_STRING
188+
string "DFU Device String"
189+
default "Espressif DFU Device"
190+
depends on TINYUSB_DFU_ENABLED
191+
help
192+
Specify name of the DFU device
193+
194+
config TINYUSB_DFU_BUFSIZE
195+
int "DFU buffer size"
196+
default 4096
197+
depends on TINYUSB_DFU_ENABLED
198+
help
199+
DFU buffer size
200+
201+
endmenu
202+
178203
menu "VENDOR driver"
179204
depends on TINYUSB_ENABLED
180205

Diff for: components/arduino_tinyusb/include/tusb_config.h

+8
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ extern "C" {
6464
# define CONFIG_TINYUSB_DFU_RT_ENABLED 0
6565
#endif
6666

67+
#ifndef CONFIG_TINYUSB_DFU_ENABLED
68+
# define CONFIG_TINYUSB_DFU_ENABLED 0
69+
#endif
70+
6771
#ifndef CONFIG_TINYUSB_VENDOR_ENABLED
6872
# define CONFIG_TINYUSB_VENDOR_ENABLED 0
6973
#endif
@@ -106,6 +110,7 @@ extern "C" {
106110
#define CFG_TUD_VIDEO CONFIG_TINYUSB_VIDEO_ENABLED
107111
#define CFG_TUD_CUSTOM_CLASS CONFIG_TINYUSB_CUSTOM_CLASS_ENABLED
108112
#define CFG_TUD_DFU_RUNTIME CONFIG_TINYUSB_DFU_RT_ENABLED
113+
#define CFG_TUD_DFU CONFIG_TINYUSB_DFU_ENABLED
109114
#define CFG_TUD_VENDOR CONFIG_TINYUSB_VENDOR_ENABLED
110115

111116
// CDC FIFO size of TX and RX
@@ -126,6 +131,9 @@ extern "C" {
126131
#define CFG_TUD_VIDEO_STREAMING CONFIG_TINYUSB_VIDEO_STREAMING_IFS
127132
#define CFG_TUD_VIDEO_STREAMING_EP_BUFSIZE CONFIG_TINYUSB_VIDEO_STREAMING_BUFSIZE
128133

134+
// DFU buffer size
135+
#define CFG_TUD_DFU_XFER_BUFSIZE CONFIG_TINYUSB_DFU_BUFSIZE
136+
129137
// VENDOR FIFO size of TX and RX
130138
#define CFG_TUD_VENDOR_RX_BUFSIZE CONFIG_TINYUSB_VENDOR_RX_BUFSIZE
131139
#define CFG_TUD_VENDOR_TX_BUFSIZE CONFIG_TINYUSB_VENDOR_TX_BUFSIZE

0 commit comments

Comments
 (0)