attempt to restart USB communication

This commit is contained in:
Jan Käberich 2022-10-31 22:14:59 +01:00
parent f3eb560d61
commit 22542a81b6

View File

@ -235,7 +235,9 @@ void usb_init(usbd_recv_callback_t receive_callback) {
} }
bool usb_transmit(const uint8_t *data, uint16_t length) { bool usb_transmit(const uint8_t *data, uint16_t length) {
if(!connection_okay()) { if(!connection_okay()) {
return false; // clear buffer and attempt to restart the transfer
data_transmission_active = false;
usb_transmit_fifo_level = 0;
} }
// attempt to add data to fifo // attempt to add data to fifo
if(length > usb_available_buffer()) { if(length > usb_available_buffer()) {