mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-11 06:23:39 +00:00
atsamd21, atsamd51, nrf52840: unify usbcdc code
This commit is contained in:
@@ -1850,6 +1850,7 @@ func (usbcdc *USBCDC) Flush() error {
|
||||
|
||||
if usbcdc.waitTxc {
|
||||
// waiting for the next flush(), because the transmission is not complete
|
||||
usbcdc.waitTxcRetryCount++
|
||||
return nil
|
||||
}
|
||||
usbcdc.waitTxc = true
|
||||
@@ -1904,7 +1905,7 @@ func (usbcdc *USBCDC) WriteByte(c byte) error {
|
||||
mask := interrupt.Disable()
|
||||
UART0.waitTxc = false
|
||||
UART0.waitTxcRetryCount = 0
|
||||
usbcdc.TxIdx.Set(0)
|
||||
UART0.TxIdx.Set(0)
|
||||
usbLineInfo.lineState = 0
|
||||
interrupt.Restore(mask)
|
||||
break
|
||||
@@ -2074,6 +2075,7 @@ func handleUSBIRQ(interrupt.Interrupt) {
|
||||
|
||||
// Start of frame
|
||||
if (flags & sam.USB_DEVICE_INTFLAG_SOF) > 0 {
|
||||
UART0.Flush()
|
||||
// if you want to blink LED showing traffic, this would be the place...
|
||||
}
|
||||
|
||||
@@ -2137,13 +2139,7 @@ func handleUSBIRQ(interrupt.Interrupt) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if i == usb_CDC_ENDPOINT_IN && UART0.waitTxc {
|
||||
UART0.waitTxcRetryCount++
|
||||
}
|
||||
}
|
||||
|
||||
UART0.Flush()
|
||||
}
|
||||
|
||||
func initEndpoint(ep, config uint32) {
|
||||
|
||||
Reference in New Issue
Block a user