mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-11 14:33:41 +00:00
machine.UART refactor (#3832)
* add gosched calls to UART * add UART.flush() stubs for all supported architectures * add comment un uart.go on flush functionality * uart.writeByte as base of UART usage * fix NXP having duplicate WriteByte * fix writeByte not returning error on some platforms * add flush method for fe310 device * check for error in WriteByte call to writeByte
This commit is contained in:
committed by
GitHub
parent
c83f712c17
commit
a7b205c26c
@@ -181,12 +181,14 @@ func (uart *UART) Configure(config UARTConfig) {
|
||||
esp.UART0.UART_CLKDIV.Set(CPUFrequency() / config.BaudRate)
|
||||
}
|
||||
|
||||
// WriteByte writes a single byte to the output buffer. Note that the hardware
|
||||
// writeByte writes a single byte to the output buffer. Note that the hardware
|
||||
// includes a buffer of 128 bytes which will be used first.
|
||||
func (uart *UART) WriteByte(c byte) error {
|
||||
func (uart *UART) writeByte(c byte) error {
|
||||
for (esp.UART0.UART_STATUS.Get()>>16)&0xff >= 128 {
|
||||
// Wait until the TX buffer has room.
|
||||
}
|
||||
esp.UART0.UART_FIFO.Set(uint32(c))
|
||||
return nil
|
||||
}
|
||||
|
||||
func (uart *UART) flush() {}
|
||||
|
||||
Reference in New Issue
Block a user