Add DFU runtime and mode "class"

With the runtime and mode portions in separate classes, a single
application should only be building with one or the other enabled.  In
some applications both might be desired at build time.

The CFG_TUD_DFU_RUNTIME_AND_MODE option creates a DFU class, which asks
the application which mode to initialize to.  This allows a runtime
change between RT and DFU mode, by just reinitializing tusb.
This commit is contained in:
Jeremiah McCarthy
2021-04-05 17:52:33 -04:00
parent bc2cb99780
commit c39b7b8177
7 changed files with 202 additions and 3 deletions

View File

@@ -241,6 +241,10 @@
#define CFG_TUD_DFU_MODE 0
#endif
#ifndef CFG_TUD_DFU_RUNTIME_AND_MODE
#define CFG_TUD_DFU_RUNTIME_AND_MODE 0
#endif
#ifndef CFG_TUD_DFU_TRANSFER_BUFFER_SIZE
#define CFG_TUD_DFU_TRANSFER_BUFFER_SIZE 64
#endif
@@ -285,6 +289,12 @@
#error Control Endpoint Max Packet Size cannot be larger than 64
#endif
#if (CFG_TUD_DFU_RUNTIME_AND_MODE && CFG_TUD_DFU_RUNTIME) \
|| (CFG_TUD_DFU_RUNTIME_AND_MODE && CFG_TUD_DFU_MODE) \
|| (CFG_TUD_DFU_RUNTIME && CFG_TUD_DFU_MODE)
#error Only one of CFG_TUD_DFU_RUNTIME_AND_MODE, CFG_TUD_DFU_RUNTIME, and CFG_TUD_DFU_MODE can be enabled in a single build
#endif
#endif /* _TUSB_OPTION_H_ */
/** @} */