guild icon
Toit
#Is it intended that i2c.close also closes the associated gpio channels ?
Thread channel in help
kaxori
kaxori 02/22/2024 04:21 PM
If I create a i2c bus device, use and close it again, then a repeated creation reports an ALREADY_IN_USE exception error.
kaxori
kaxori 02/22/2024 04:53 PM
gpioSda := gpio.Pin GPIO_I2C_SDA
gpioScl := gpio.Pin GPIO_I2C_SCL

bus := i2c.Bus
--sda=gpioSda
--scl=gpioScl
--frequency=100_000

ads1115 := bus.device Ads1115.I2C_ADDRESS

...
floitsch
floitsch 02/22/2024 06:12 PM
Typically we only close pins (or other objects) if we have allocated them. So the I2C bus is not supposed to close the pin itself.
floitsch
floitsch 02/22/2024 06:14 PM
We might not be fully consistent with that though, but closing should be idempotent and thus closing again should be fine. (Again, I think we are not 100% consistent there yet, but are working towards it)
kaxori
kaxori 02/22/2024 06:19 PM
thank you
5 messages in total