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:
Patricio Whittingslow
2023-07-15 11:24:53 -03:00
committed by GitHub
parent c83f712c17
commit a7b205c26c
14 changed files with 69 additions and 19 deletions
+3 -1
View File
@@ -1114,7 +1114,7 @@ func (uart *UART) SetBaudRate(br uint32) {
}
// WriteByte writes a byte of data to the UART.
func (uart *UART) WriteByte(c byte) error {
func (uart *UART) writeByte(c byte) error {
// wait until ready to receive
for !uart.Bus.INTFLAG.HasBits(sam.SERCOM_USART_INT_INTFLAG_DRE) {
}
@@ -1122,6 +1122,8 @@ func (uart *UART) WriteByte(c byte) error {
return nil
}
func (uart *UART) flush() {}
func (uart *UART) handleInterrupt(interrupt.Interrupt) {
// should reset IRQ
uart.Receive(byte((uart.Bus.DATA.Get() & 0xFF)))