i2c_cmd_link_create_static() function
Create and initialize an I2C commands list with a given buffer. All the allocations for data or signals (START, STOP, ACK, ...) will be performed within this buffer. This buffer must be valid during the whole transaction. After finishing the I2C transactions, it is required to call `i2c_cmd_link_delete_static()`.
Arguments
buffer
Buffer to use for commands allocations
size
Size in bytes of the buffer
Return value
Handle to the I2C command link or NULL if the buffer provided is too small, please use `I2C_LINK_RECOMMENDED_SIZE` macro to get the recommended size for the buffer.
Notes
It is **highly** advised to not allocate this buffer on the stack. The size of the data used underneath may increase in the future, resulting in a possible stack overflow as the macro `I2C_LINK_RECOMMENDED_SIZE` would also return a bigger value. A better option is to use a buffer allocated statically or dynamically (with `malloc`).
i2c_cmd_link_create_static() is called by 5 functions:
![]()
i2c_cmd_link_create_static()
i2c_cmd_link_create_static() writes 5 variables:
![]()
i2c_cmd_link_create_static()