i2csoft: add source code for each target

This commit is contained in:
sago35
2021-09-24 10:15:02 +09:00
committed by Ron Evans
parent 2c9a05a413
commit 4f82c231cb
6 changed files with 63 additions and 30 deletions
+4 -10
View File
@@ -1,5 +1,5 @@
//go:build !esp32 && !atsamd51 && !atsame5x
// +build !esp32,!atsamd51,!atsame5x
//go:build !esp32 && !atsamd51 && !atsame5x && !stm32f4 && !rp2040 && ! nrf52840
// +build !esp32,!atsamd51,!atsame5x,!stm32f4,!rp2040,!nrf52840
package i2csoft
@@ -7,15 +7,9 @@ import (
"device"
)
// wait waits for half the time of the SCL operation interval.
func (i2c *I2C) wait() {
// atsamd21 @ 48MHz
// 1 : about 360kHz
// 24 : about 96kHz
wait := 1
if i2c.baudrate < 400*1e3 {
wait = 19
}
wait := 20
for i := 0; i < wait; i++ {
device.Asm(`nop`)
}