mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-10 14:03:39 +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
@@ -111,13 +111,16 @@ func (uart *UART) handleInterrupt(interrupt.Interrupt) {
|
||||
uart.Receive(c)
|
||||
}
|
||||
|
||||
func (uart *UART) WriteByte(c byte) {
|
||||
func (uart *UART) writeByte(c byte) error {
|
||||
for sifive.UART0.TXDATA.Get()&sifive.UART_TXDATA_FULL != 0 {
|
||||
}
|
||||
|
||||
sifive.UART0.TXDATA.Set(uint32(c))
|
||||
return nil
|
||||
}
|
||||
|
||||
func (uart *UART) flush() {}
|
||||
|
||||
// SPI on the FE310. The normal SPI0 is actually a quad-SPI meant for flash, so it is best
|
||||
// to use SPI1 or SPI2 port for most applications.
|
||||
type SPI struct {
|
||||
|
||||
Reference in New Issue
Block a user