diff --git a/src/machine/machine_atmega.go b/src/machine/machine_atmega.go index 3a73028c5d..81a47c0dfa 100644 --- a/src/machine/machine_atmega.go +++ b/src/machine/machine_atmega.go @@ -97,7 +97,7 @@ func (i2c *I2C) stop() { } // writeByte writes a single byte to the I2C bus. -func (i2c *I2C) writeByte(data byte) { +func (i2c *I2C) writeByte(data byte) error { // Write data to register. avr.TWDR.Set(data) @@ -107,6 +107,7 @@ func (i2c *I2C) writeByte(data byte) { // Wait till data is transmitted. for !avr.TWCR.HasBits(avr.TWCR_TWINT) { } + return nil } // readByte reads a single byte from the I2C bus. diff --git a/src/machine/machine_fe310.go b/src/machine/machine_fe310.go index efe94cbe47..8bd4661f4c 100644 --- a/src/machine/machine_fe310.go +++ b/src/machine/machine_fe310.go @@ -111,11 +111,12 @@ 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 } // SPI on the FE310. The normal SPI0 is actually a quad-SPI meant for flash, so it is best diff --git a/src/machine/machine_k210.go b/src/machine/machine_k210.go index 22dc2883ef..e8a304c850 100644 --- a/src/machine/machine_k210.go +++ b/src/machine/machine_k210.go @@ -392,11 +392,12 @@ func (uart *UART) handleInterrupt(interrupt.Interrupt) { uart.Receive(c) } -func (uart *UART) writeByte(c byte) { +func (uart *UART) writeByte(c byte) error { for uart.Bus.TXDATA.Get()&kendryte.UARTHS_TXDATA_FULL != 0 { } uart.Bus.TXDATA.Set(uint32(c)) + return nil } func (uart *UART) flush() {}