Synopsis
unsigned ctl_spi_lock_bus_ex(CTL_SPI_BUS_t *self,
                             CTL_TIMEOUT_t type,
                             CTL_TIME_t time);
Description

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

ctl_spi_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 SPI bus by ctl_spi_lock_bus_ex must be paired with a call to ctl_spi_unlock_bus to release the lock.

Note

Because mutexes can be locked multiple times, you can use ctl_spi_lock_bus_ex to ensure exclusive use of the bus in order to issue a sequence sequence of SPI transactions without interruption.

See Also

ctl_spi_unlock_bus, ctl_spi_lock_bus