move stuff around wrt. USB-CDC baudrate changes

This commit is contained in:
Triss 2021-06-28 22:29:03 +02:00
parent c15648b9cc
commit b3984cfca0
4 changed files with 11 additions and 13 deletions

View File

@ -7,11 +7,6 @@ void cdc_uart_init(void) {
void cdc_uart_task(void) { void cdc_uart_task(void) {
} }
void cdc_uart_set_hwflow(bool enable) { void cdc_uart_set_hwflow(bool enable) { (void)enable; }
(void)enable; void cdc_uart_set_baud_rate(uint32_t brate) { (void)brate; }
}
/* TODO: properly dispatch to others? */
/*void tud_cdc_line_coding_cb(uint8_t itf, cdc_line_coding_t const* line_coding) {
}*/

View File

@ -70,11 +70,7 @@ void cdc_uart_set_hwflow(bool enable) {
uart_set_hw_flow(PINOUT_UART_INTERFACE, enable, enable); uart_set_hw_flow(PINOUT_UART_INTERFACE, enable, enable);
} }
/* TODO: properly dispatch to others? */ void cdc_uart_set_baud_rate(uint32_t brate) {
void tud_cdc_line_coding_cb(uint8_t itf, cdc_line_coding_t const* line_coding) {
if (itf == CDC_N_UART) {
//picoprobe_info("New baud rate %d\n", line_coding->bit_rate);
uart_init(PINOUT_UART_INTERFACE, line_coding->bit_rate); uart_init(PINOUT_UART_INTERFACE, line_coding->bit_rate);
}
} }

View File

@ -15,6 +15,7 @@ void cdc_uart_init(void);
void cdc_uart_task(void); void cdc_uart_task(void);
void cdc_uart_set_hwflow(bool enable); void cdc_uart_set_hwflow(bool enable);
void cdc_uart_set_baudrate(uint32_t brate);
#endif #endif
#ifdef DBOARD_HAS_SERPROG #ifdef DBOARD_HAS_SERPROG

View File

@ -258,3 +258,9 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid) {
return _desc_str; return _desc_str;
} }
void tud_cdc_line_coding_cb(uint8_t itf, cdc_line_coding_t const* line_coding) {
if (itf == CDC_N_UART) {
cdc_uart_set_baudrate(line_coding->bit_rate);
}
}