usb_cdcacm: add flush method to wait for empty buffer

This commit is contained in:
King Kévin 2020-06-14 18:57:05 +02:00
parent 86ad8ea7ef
commit 60a1859008
2 changed files with 10 additions and 1 deletions

View File

@ -479,7 +479,13 @@ void usb_cdcacm_putchar(char c)
usb_cdcacm_data_tx_cb(NULL, 0); // send data over USB when possible
}
void usb_cdcacm_flush(void)
{
while (tx_used);
}
/** USB interrupt service routine called when data is received */
void usb_lp_can_rx0_isr(void) {
void usb_lp_can_rx0_isr(void)
{
usbd_poll(usb_device);
}

View File

@ -16,3 +16,6 @@ void usb_cdcacm_setup(void);
* @note blocks if transmit buffer is full, else puts in buffer and returns
*/
void usb_cdcacm_putchar(char c);
/** wait until all is transmitted (blocking)
*/
void usb_cdcacm_flush(void);