Skip to content

Commit

Permalink
Fix vendor interface semantics for tinyUSB >= 0.13
Browse files Browse the repository at this point in the history
Explicit flushing of writes is now required.
  • Loading branch information
P33M committed Jan 6, 2023
1 parent fd445fd commit 42d1ff2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ void usb_thread(void *ptr)
} while (1);
}

// Workaround API change in 0.13
#if (TUSB_VERSION_MAJOR == 0) && (TUSB_VERSION_MINOR <= 12)
#define tud_vendor_flush(x) ((void)0)
#endif

void dap_thread(void *ptr)
{
uint32_t resp_len;
Expand All @@ -72,6 +77,7 @@ void dap_thread(void *ptr)
tud_vendor_read(RxDataBuffer, sizeof(RxDataBuffer));
resp_len = DAP_ProcessCommand(RxDataBuffer, TxDataBuffer);
tud_vendor_write(TxDataBuffer, resp_len);
tud_vendor_flush();
} else {
// Trivial delay to save power
vTaskDelay(2);
Expand Down

0 comments on commit 42d1ff2

Please sign in to comment.