Skip to content

Commit 39b1f8b

Browse files
ardnewdeadprogram
authored andcommitted
teensy40: UART: add missing godocs, rename Flush to Sync
1 parent 9aa5085 commit 39b1f8b

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/machine/machine_mimxrt1062_uart.go

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,13 +157,19 @@ func (uart *UART) Configure(config UARTConfig) {
157157
uart.configured = true
158158
}
159159

160+
// Disable disables the UART interface.
161+
//
162+
// If any buffered data has not yet been transmitted, Disable waits until
163+
// transmission completes before disabling the interface. The receiver UART's
164+
// interrupt is also disabled, and the RX/TX pins are reconfigured for GPIO
165+
// input (pull-up).
160166
func (uart *UART) Disable() {
161167

162168
// first ensure the device is enabled
163169
if uart.configured {
164170

165171
// wait for any buffered data to send
166-
uart.Flush()
172+
uart.Sync()
167173

168174
// stop trapping RX interrupts
169175
uart.Interrupt.Disable()
@@ -181,13 +187,15 @@ func (uart *UART) Disable() {
181187
uart.configured = false
182188
}
183189

184-
// Flush blocks the calling goroutine until all data in the output buffer has
185-
// been written out.
186-
func (uart *UART) Flush() {
190+
// Sync blocks the calling goroutine until all data in the output buffer has
191+
// been transmitted.
192+
func (uart *UART) Sync() error {
187193
for uart.isTransmitting() {
188194
}
195+
return nil
189196
}
190197

198+
// WriteByte writes a single byte of data to the UART interface.
191199
func (uart *UART) WriteByte(c byte) error {
192200
if nil == uart.txBuffer {
193201
uart.txBuffer = NewRingBuffer()

0 commit comments

Comments
 (0)