17.6.3.1.1 Function i2c_master_lock()

Attempt to get lock on driver instance.

enum status_code i2c_master_lock( struct i2c_master_module *const module)

This function checks the instance's lock, which indicates whether or not it is currently in use, and sets the lock if it was not already set.

The purpose of this is to enable exclusive access to driver instances, so that, e.g., transactions by different services will not interfere with each other.

Table 17-4. Parameters
Data directionParameter nameDescription

[in, out]

module

Pointer to the driver instance to lock

Table 17-5. Return Values
Return valueDescription

STATUS_OK

If the module was locked

STATUS_BUSY

If the module was already locked