27#ifndef _TUSB_CDC_DEVICE_H_
28#define _TUSB_CDC_DEVICE_H_
35#if !defined(CFG_TUD_CDC_EP_BUFSIZE) && defined(CFG_TUD_CDC_EPSIZE)
36 #warning CFG_TUD_CDC_EPSIZE is renamed to CFG_TUD_CDC_EP_BUFSIZE, please update to use the new name
37 #define CFG_TUD_CDC_EP_BUFSIZE CFG_TUD_CDC_EPSIZE
40#ifndef CFG_TUD_CDC_EP_BUFSIZE
41 #define CFG_TUD_CDC_EP_BUFSIZE (TUD_OPT_HIGH_SPEED ? 512 : 64)
59bool tud_cdc_n_connected (uint8_t itf);
62uint8_t tud_cdc_n_get_line_state (uint8_t itf);
68void tud_cdc_n_set_wanted_char (uint8_t itf,
char wanted);
71uint32_t tud_cdc_n_available (uint8_t itf);
74uint32_t tud_cdc_n_read (uint8_t itf,
void* buffer, uint32_t bufsize);
78int32_t tud_cdc_n_read_char (uint8_t itf);
81void tud_cdc_n_read_flush (uint8_t itf);
84bool tud_cdc_n_peek (uint8_t itf, uint8_t* ui8);
87uint32_t tud_cdc_n_write (uint8_t itf,
void const* buffer, uint32_t bufsize);
91uint32_t tud_cdc_n_write_char (uint8_t itf,
char ch);
95uint32_t tud_cdc_n_write_str (uint8_t itf,
char const* str);
98uint32_t tud_cdc_n_write_flush (uint8_t itf);
101uint32_t tud_cdc_n_write_available (uint8_t itf);
104bool tud_cdc_n_write_clear (uint8_t itf);
109static inline bool tud_cdc_connected (
void);
110static inline uint8_t tud_cdc_get_line_state (
void);
112static inline void tud_cdc_set_wanted_char (
char wanted);
114static inline uint32_t tud_cdc_available (
void);
115static inline int32_t tud_cdc_read_char (
void);
116static inline uint32_t tud_cdc_read (
void* buffer, uint32_t bufsize);
117static inline void tud_cdc_read_flush (
void);
118static inline bool tud_cdc_peek (uint8_t* ui8);
120static inline uint32_t tud_cdc_write_char (
char ch);
121static inline uint32_t tud_cdc_write (
void const* buffer, uint32_t bufsize);
122static inline uint32_t tud_cdc_write_str (
char const* str);
123static inline uint32_t tud_cdc_write_flush (
void);
124static inline uint32_t tud_cdc_write_available (
void);
125static inline bool tud_cdc_write_clear (
void);
132TU_ATTR_WEAK
void tud_cdc_rx_cb(uint8_t itf);
135TU_ATTR_WEAK
void tud_cdc_rx_wanted_cb(uint8_t itf,
char wanted_char);
138TU_ATTR_WEAK
void tud_cdc_tx_complete_cb(uint8_t itf);
141TU_ATTR_WEAK
void tud_cdc_line_state_cb(uint8_t itf,
bool dtr,
bool rts);
144TU_ATTR_WEAK
void tud_cdc_line_coding_cb(uint8_t itf,
cdc_line_coding_t const* p_line_coding);
147TU_ATTR_WEAK
void tud_cdc_send_break_cb(uint8_t itf, uint16_t duration_ms);
152static inline int32_t tud_cdc_n_read_char (uint8_t itf)
155 return tud_cdc_n_read(itf, &ch, 1) ? (int32_t) ch : -1;
158static inline uint32_t tud_cdc_n_write_char(uint8_t itf,
char ch)
160 return tud_cdc_n_write(itf, &ch, 1);
163static inline uint32_t tud_cdc_n_write_str (uint8_t itf,
char const* str)
165 return tud_cdc_n_write(itf, str, strlen(str));
168static inline bool tud_cdc_connected (
void)
170 return tud_cdc_n_connected(0);
173static inline uint8_t tud_cdc_get_line_state (
void)
175 return tud_cdc_n_get_line_state(0);
180 tud_cdc_n_get_line_coding(0, coding);
183static inline void tud_cdc_set_wanted_char (
char wanted)
185 tud_cdc_n_set_wanted_char(0, wanted);
188static inline uint32_t tud_cdc_available (
void)
190 return tud_cdc_n_available(0);
193static inline int32_t tud_cdc_read_char (
void)
195 return tud_cdc_n_read_char(0);
198static inline uint32_t tud_cdc_read (
void* buffer, uint32_t bufsize)
200 return tud_cdc_n_read(0, buffer, bufsize);
203static inline void tud_cdc_read_flush (
void)
205 tud_cdc_n_read_flush(0);
208static inline bool tud_cdc_peek (uint8_t* ui8)
210 return tud_cdc_n_peek(0, ui8);
213static inline uint32_t tud_cdc_write_char (
char ch)
215 return tud_cdc_n_write_char(0, ch);
218static inline uint32_t tud_cdc_write (
void const* buffer, uint32_t bufsize)
220 return tud_cdc_n_write(0, buffer, bufsize);
223static inline uint32_t tud_cdc_write_str (
char const* str)
225 return tud_cdc_n_write_str(0, str);
228static inline uint32_t tud_cdc_write_flush (
void)
230 return tud_cdc_n_write_flush(0);
233static inline uint32_t tud_cdc_write_available(
void)
235 return tud_cdc_n_write_available(0);
238static inline bool tud_cdc_write_clear(
void)
240 return tud_cdc_n_write_clear(0);
249void cdcd_init (
void);
250void cdcd_reset (uint8_t rhport);
253bool cdcd_xfer_cb (uint8_t rhport, uint8_t ep_addr, xfer_result_t result, uint32_t xferred_bytes);
AUDIO Channel Cluster Descriptor (4.1)
Definition audio.h:647