mirror of
https://github.com/tinygo-org/drivers.git
synced 2026-08-19 14:14:00 +00:00
i2csoft: add support for software I2C
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
//go:build esp32
|
||||
// +build esp32
|
||||
|
||||
package i2csoft
|
||||
|
||||
import (
|
||||
"device"
|
||||
)
|
||||
|
||||
func (i2c *I2C) wait() {
|
||||
// atsamd51
|
||||
// 10 : about 387kHz
|
||||
// 56 : about 99kHz
|
||||
|
||||
wait := 10
|
||||
if i2c.baudrate < 400*1e3 {
|
||||
wait = 56
|
||||
}
|
||||
|
||||
for i := 0; i < wait; i++ {
|
||||
device.Asm(`nop`)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user