mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-23 13:59:02 +00:00
teensy40: UART: add missing godocs, rename Flush to Sync
This commit is contained in:
@@ -157,13 +157,19 @@ func (uart *UART) Configure(config UARTConfig) {
|
|||||||
uart.configured = true
|
uart.configured = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Disable disables the UART interface.
|
||||||
|
//
|
||||||
|
// If any buffered data has not yet been transmitted, Disable waits until
|
||||||
|
// transmission completes before disabling the interface. The receiver UART's
|
||||||
|
// interrupt is also disabled, and the RX/TX pins are reconfigured for GPIO
|
||||||
|
// input (pull-up).
|
||||||
func (uart *UART) Disable() {
|
func (uart *UART) Disable() {
|
||||||
|
|
||||||
// first ensure the device is enabled
|
// first ensure the device is enabled
|
||||||
if uart.configured {
|
if uart.configured {
|
||||||
|
|
||||||
// wait for any buffered data to send
|
// wait for any buffered data to send
|
||||||
uart.Flush()
|
uart.Sync()
|
||||||
|
|
||||||
// stop trapping RX interrupts
|
// stop trapping RX interrupts
|
||||||
uart.Interrupt.Disable()
|
uart.Interrupt.Disable()
|
||||||
@@ -181,13 +187,15 @@ func (uart *UART) Disable() {
|
|||||||
uart.configured = false
|
uart.configured = false
|
||||||
}
|
}
|
||||||
|
|
||||||
// Flush blocks the calling goroutine until all data in the output buffer has
|
// Sync blocks the calling goroutine until all data in the output buffer has
|
||||||
// been written out.
|
// been transmitted.
|
||||||
func (uart *UART) Flush() {
|
func (uart *UART) Sync() error {
|
||||||
for uart.isTransmitting() {
|
for uart.isTransmitting() {
|
||||||
}
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WriteByte writes a single byte of data to the UART interface.
|
||||||
func (uart *UART) WriteByte(c byte) error {
|
func (uart *UART) WriteByte(c byte) error {
|
||||||
if nil == uart.txBuffer {
|
if nil == uart.txBuffer {
|
||||||
uart.txBuffer = NewRingBuffer()
|
uart.txBuffer = NewRingBuffer()
|
||||||
|
|||||||
Reference in New Issue
Block a user