summaryrefslogtreecommitdiff
path: root/src/class/cdc/cdc_device.h
diff options
context:
space:
mode:
authorhathach <[email protected]>2026-03-12 15:22:52 +0700
committerhathach <[email protected]>2026-03-12 15:22:52 +0700
commit222af862aa2b3898980e3ed8f28e70fe6c9a7ee9 (patch)
treeae908c320d7c3b750de17c06337314c08e59b9eb /src/class/cdc/cdc_device.h
parentac61a5b176b44db503d8bcc287a622463b65e48e (diff)
refactor(cdc): remove runtime CDC driver configuration in favor of compile-time macros for simplicity and reduced complexity
Diffstat (limited to 'src/class/cdc/cdc_device.h')
-rw-r--r--src/class/cdc/cdc_device.h32
1 files changed, 11 insertions, 21 deletions
diff --git a/src/class/cdc/cdc_device.h b/src/class/cdc/cdc_device.h
index 0348bd2ec..e44d425b9 100644
--- a/src/class/cdc/cdc_device.h
+++ b/src/class/cdc/cdc_device.h
@@ -70,30 +70,20 @@
#define CFG_TUD_CDC_RX_NEED_ZLP 0
#endif
-#ifndef CFG_TUD_CDC_CONFIGURE_DEFAULT
- #define CFG_TUD_CDC_CONFIGURE_DEFAULT() \
- { \
- .rx_persistent = false, \
- .tx_persistent = false, \
- .tx_overwritabe_if_not_connected = true, \
- }
+// Keep rx fifo data even with bus reset or disconnect
+#ifndef CFG_TUD_CDC_RX_PERSISTENT
+ #define CFG_TUD_CDC_RX_PERSISTENT 0
#endif
-//--------------------------------------------------------------------+
-// Driver Configuration
-//--------------------------------------------------------------------+
-typedef struct {
- bool rx_persistent; // keep rx fifo data even with bus reset or disconnect
- bool tx_persistent; // keep tx fifo data even with reset or disconnect
- bool tx_overwritabe_if_not_connected; // if not connected, tx fifo can be overwritten
-} tud_cdc_configure_t;
-
-// Configure CDC driver behavior
-bool tud_cdc_configure(const tud_cdc_configure_t* driver_cfg);
+// Keep tx fifo data even with bus reset or disconnect
+#ifndef CFG_TUD_CDC_TX_PERSISTENT
+ #define CFG_TUD_CDC_TX_PERSISTENT 0
+#endif
-// Backward compatible
-#define tud_cdc_configure_fifo_t tud_cdc_configure_t
-#define tud_cdc_configure_fifo tud_cdc_configure
+// If not connected, tx fifo can be overwritten
+#ifndef CFG_TUD_CDC_TX_OVERWRITABLE_IF_NOT_CONNECTED
+ #define CFG_TUD_CDC_TX_OVERWRITABLE_IF_NOT_CONNECTED 1
+#endif
//--------------------------------------------------------------------+
// Application API (Multiple Ports) i.e. CFG_TUD_CDC > 1