void ctl_i2c_lock_bus(CTL_I2C_BUS_t *self);

ctl_i2c_lock_bus acquires the bus lock mutex of the I2C bus self. If there is no mutex associated with the bus self, ctl_i2c_lock_bus returns immediately indicating success.

All locks of the I2C bus by ctl_i2c_lock_bus must be paired with a call to ctl_i2c_unlock_bus to release the lock.


Because mutexes can be locked multiple times, you can use ctl_i2c_lock_bus to acquire the bus to issue a sequence of I2C transactions to the bus that cannot be interrupted by another task. However, locking the bus this way does not guarantee that other masters, in a multi-master system, are excluded from issuing transactions on the bus.

See Also

ctl_i2c_unlock_bus, ctl_i2c_lock_bus_ex