nrf: fix race in i2c
Этот коммит содержится в:
родитель
431e223803
коммит
cc1a95a489
1 изменённых файлов: 4 добавлений и 1 удалений
|
@ -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)
|
||||||
}
|
}
|
||||||
|
if i > 0 {
|
||||||
i2c.Bus.TASKS_RESUME.Set(1) // re-start transmission for reading
|
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.
|
||||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче