File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff 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).
160166func (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.
191199func (uart * UART ) WriteByte (c byte ) error {
192200 if nil == uart .txBuffer {
193201 uart .txBuffer = NewRingBuffer ()
You can’t perform that action at this time.
0 commit comments