mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-13 23:43:40 +00:00
Fix fe310 SPI read
This commit is contained in:
@@ -174,11 +174,13 @@ func (spi SPI) Transfer(w byte) (byte, error) {
|
|||||||
spi.Bus.TXDATA.Set(uint32(w))
|
spi.Bus.TXDATA.Set(uint32(w))
|
||||||
|
|
||||||
// wait until receive has data
|
// wait until receive has data
|
||||||
for spi.Bus.RXDATA.HasBits(sifive.QSPI_RXDATA_EMPTY) {
|
data := spi.Bus.RXDATA.Get()
|
||||||
|
for data&sifive.QSPI_RXDATA_EMPTY > 0 {
|
||||||
|
data = spi.Bus.RXDATA.Get()
|
||||||
}
|
}
|
||||||
|
|
||||||
// return data
|
// return data
|
||||||
return byte(spi.Bus.RXDATA.Get() & sifive.QSPI_RXDATA_DATA_Msk), nil
|
return byte(data), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// I2C on the FE310-G002.
|
// I2C on the FE310-G002.
|
||||||
|
|||||||
Reference in New Issue
Block a user