Skip to content

Commit e76729c

Browse files
sago35deadprogram
authored andcommitted
fix
1 parent 35c8707 commit e76729c

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

src/machine/usb_nrf52840.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ func (usbcdc *USBCDC) Flush() error {
5858
usbcdc.TxIdx.Set(usbcdcTxBank1st)
5959
}
6060

61-
UART0.sent = true
61+
USB.sent = true
6262
}
6363
}
6464
return nil
@@ -72,35 +72,35 @@ func (usbcdc USBCDC) WriteByte(c byte) error {
7272
for {
7373
mask := interrupt.Disable()
7474

75-
idx := UART0.TxIdx.Get()
75+
idx := USB.TxIdx.Get()
7676
if (idx & usbcdcTxSizeMask) < usbcdcTxSizeMask {
7777
udd_ep_in_cache_buffer[usb_CDC_ENDPOINT_IN][idx] = c
78-
UART0.TxIdx.Set(idx + 1)
78+
USB.TxIdx.Set(idx + 1)
7979
ok = true
8080
}
8181

8282
interrupt.Restore(mask)
8383

8484
if ok {
8585
break
86-
} else if usbcdcTxMaxRetriesAllowed < UART0.waitTxcRetryCount {
86+
} else if usbcdcTxMaxRetriesAllowed < USB.waitTxcRetryCount {
8787
mask := interrupt.Disable()
88-
UART0.waitTxc = false
89-
UART0.waitTxcRetryCount = 0
90-
UART0.TxIdx.Set(0)
88+
USB.waitTxc = false
89+
USB.waitTxcRetryCount = 0
90+
USB.TxIdx.Set(0)
9191
usbLineInfo.lineState = 0
9292
interrupt.Restore(mask)
9393
break
9494
} else {
9595
mask := interrupt.Disable()
96-
if UART0.sent {
97-
if UART0.waitTxc {
96+
if USB.sent {
97+
if USB.waitTxc {
9898
if !easyDMABusy.HasBits(1) {
99-
UART0.waitTxc = false
100-
UART0.Flush()
99+
USB.waitTxc = false
100+
USB.Flush()
101101
}
102102
} else {
103-
UART0.Flush()
103+
USB.Flush()
104104
}
105105
}
106106
interrupt.Restore(mask)
@@ -198,7 +198,7 @@ func (usbcdc *USBCDC) Configure(config UARTConfig) {
198198
func (usbcdc *USBCDC) handleInterrupt(interrupt.Interrupt) {
199199
if nrf.USBD.EVENTS_SOF.Get() == 1 {
200200
nrf.USBD.EVENTS_SOF.Set(0)
201-
UART0.Flush()
201+
USB.Flush()
202202
}
203203

204204
// USBD ready event
@@ -291,7 +291,7 @@ func (usbcdc *USBCDC) handleInterrupt(interrupt.Interrupt) {
291291
}
292292
case usb_CDC_ENDPOINT_IN: //, usb_CDC_ENDPOINT_ACM:
293293
if inDataDone {
294-
UART0.waitTxc = false
294+
USB.waitTxc = false
295295
exitCriticalSection()
296296
}
297297
}

0 commit comments

Comments
 (0)