Synopsis
unsigned ctl_i2c_lock_bus_ex(CTL_I2C_BUS_t *self,
                             CTL_TIMEOUT_t type,
                             CTL_TIME_t time);
Description

ctl_i2c_lock_bus_ex acquires the bus lock mutex of the I2C bus self using the timeout specified with type and time. If there is no mutex associated with the bus self, ctl_i2c_lock_bus_ex returns immediately indicating success.

ctl_i2c_lock_bus_ex returns a non-zero value if the mutex is acquired within the timeout specification and zero if it is not.

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

Note

Because mutexes can be locked multiple times, you can use ctl_i2c_lock_bus_ex 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