fix cdc driver for connected state.

This commit is contained in:
hathach
2018-04-09 18:48:38 +07:00
parent fb27ae96b0
commit a74b2d34e5
3 changed files with 25 additions and 37 deletions

View File

@@ -53,12 +53,13 @@
* @{ */
//--------------------------------------------------------------------+
// APPLICATION API (Multiple Ports)
// APPLICATION API (Multiple Root Ports)
// Should be used only with MCU that support more than 1 ports
//--------------------------------------------------------------------+
bool tud_n_cdc_connected (uint8_t rhport);
uint32_t tud_n_cdc_available (uint8_t rhport);
int tud_n_cdc_read_char (uint8_t rhport);
int8_t tud_n_cdc_read_char (uint8_t rhport);
uint32_t tud_n_cdc_read (uint8_t rhport, void* buffer, uint32_t bufsize);
uint32_t tud_n_cdc_write_char (uint8_t rhport, char ch);
@@ -67,11 +68,12 @@ bool tud_n_cdc_flush (uint8_t rhport);
//--------------------------------------------------------------------+
// APPLICATION API (Single Port)
// Should be used with MCU supporting only 1 USB port for code simplicity
//--------------------------------------------------------------------+
static inline bool tud_cdc_connected (void) { return tud_n_cdc_connected(0); }
static inline uint32_t tud_cdc_available (void) { return tud_n_cdc_available(0); }
static inline int tud_cdc_read_char (void) { return tud_n_cdc_read_char(0); }
static inline int8_t tud_cdc_read_char (void) { return tud_n_cdc_read_char(0); }
static inline uint32_t tud_cdc_read (void* buffer, uint32_t bufsize) { return tud_n_cdc_read(0, buffer, bufsize); }
static inline uint32_t tud_cdc_write_char (char ch) { return tud_n_cdc_write_char(0, ch); }