i2c: implement target mode for rp2040 and nrf

This commit is contained in:
Kenneth Bell
2023-03-25 16:27:54 +00:00
committed by Ron Evans
parent e0385e48d0
commit ad3e9e1a77
9 changed files with 479 additions and 27 deletions
+6 -1
View File
@@ -6,7 +6,8 @@ import "device/nrf"
// I2C on the NRF51 and NRF52.
type I2C struct {
Bus *nrf.TWI_Type
Bus *nrf.TWI_Type
mode I2CMode
}
// There are 2 I2C interfaces on the NRF.
@@ -19,6 +20,10 @@ func (i2c *I2C) enableAsController() {
i2c.Bus.ENABLE.Set(nrf.TWI_ENABLE_ENABLE_Enabled)
}
func (i2c *I2C) enableAsTarget() {
// Not supported on this hardware
}
func (i2c *I2C) disable() {
i2c.Bus.ENABLE.Set(0)
}