mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-21 21:09:02 +00:00
nrf: fix race in i2c
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
//go:build nrf
|
||||||
// +build nrf
|
// +build nrf
|
||||||
|
|
||||||
package machine
|
package machine
|
||||||
@@ -284,7 +285,9 @@ func (i2c *I2C) Tx(addr uint16, w, r []byte) (err error) {
|
|||||||
// To trigger stop task when last byte is received, set before resume task.
|
// To trigger stop task when last byte is received, set before resume task.
|
||||||
i2c.Bus.SHORTS.Set(nrf.TWI_SHORTS_BB_STOP)
|
i2c.Bus.SHORTS.Set(nrf.TWI_SHORTS_BB_STOP)
|
||||||
}
|
}
|
||||||
i2c.Bus.TASKS_RESUME.Set(1) // re-start transmission for reading
|
if i > 0 {
|
||||||
|
i2c.Bus.TASKS_RESUME.Set(1) // re-start transmission for reading
|
||||||
|
}
|
||||||
if r[i], err = i2c.readByte(); err != nil {
|
if r[i], err = i2c.readByte(); err != nil {
|
||||||
// goto/break are practically equivalent here,
|
// goto/break are practically equivalent here,
|
||||||
// but goto makes this more easily understandable for maintenance.
|
// but goto makes this more easily understandable for maintenance.
|
||||||
|
|||||||
Reference in New Issue
Block a user