mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-16 10:43:29 +00:00
i2c: implement target mode for rp2040 and nrf
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user