teensy40: UART: add missing godocs, rename Flush to Sync
Этот коммит содержится в:
родитель
9aa50853b8
коммит
39b1f8b6f5
1 изменённых файлов: 12 добавлений и 4 удалений
|
@ -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()
|
||||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче