Skip to content

Commit

Permalink
Merge pull request #371 from dexter93/sn32_usb
Browse files Browse the repository at this point in the history
SN32: Fixed USB sending errors under certain conditions
  • Loading branch information
fpoussin committed Jul 17, 2023
2 parents ca25701 + 3e20119 commit 6eb8acd
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions os/hal/ports/SN32/LLD/SN32F2xx/USB/hal_usb_lld.c
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,12 @@ void usb_serve_endpoints(USBDriver* usbp, usbep_t ep, bool in) {
/* IN endpoint, transmission.*/
USBInEndpointState *isp = epcp->in_state;

if (isp->txcnt >= isp->txsize) {
/* Transfer completed, invokes the callback.*/
_usb_isr_invoke_in_cb(usbp, ep);
return;
}

isp->txcnt += isp->txlast;
n = isp->txsize - isp->txcnt;

Expand Down

0 comments on commit 6eb8acd

Please sign in to comment.