cdc: add uart status notification support.

This commit is contained in:
HiFiPhile
2024-04-12 01:15:46 +02:00
parent 8b4ca69e56
commit 67f32da1b9
3 changed files with 61 additions and 1 deletions

View File

@@ -64,6 +64,9 @@ uint8_t tud_cdc_n_get_line_state (uint8_t itf);
// Get current line encoding: bit rate, stop bits parity etc ..
void tud_cdc_n_get_line_coding (uint8_t itf, cdc_line_coding_t* coding);
// Send UART status notification: DCD, DSR etc ..
bool tud_cdc_n_send_uart_state (uint8_t itf, cdc_uart_state_t state);
// Set special character that will trigger tud_cdc_rx_wanted_cb() callback on receiving
void tud_cdc_n_set_wanted_char (uint8_t itf, char wanted);
@@ -109,6 +112,7 @@ bool tud_cdc_n_write_clear (uint8_t itf);
static inline bool tud_cdc_connected (void);
static inline uint8_t tud_cdc_get_line_state (void);
static inline void tud_cdc_get_line_coding (cdc_line_coding_t* coding);
static inline bool tud_cdc_send_uart_state (cdc_uart_state_t state);
static inline void tud_cdc_set_wanted_char (char wanted);
static inline uint32_t tud_cdc_available (void);
@@ -180,6 +184,11 @@ static inline void tud_cdc_get_line_coding (cdc_line_coding_t* coding)
tud_cdc_n_get_line_coding(0, coding);
}
static inline bool tud_cdc_send_uart_state (cdc_uart_state_t state)
{
return tud_cdc_n_send_uart_state(0, state);
}
static inline void tud_cdc_set_wanted_char (char wanted)
{
tud_cdc_n_set_wanted_char(0, wanted);