Access function

This function is used by higher-level code (such as the resource manager interface) to access the hardware-specific functions. It must be implemented.

int i2c_master_getfuncs(i2c_master_funcs_t *funcs, int tabsize);

This function must fill in the given table with the hardware-specific functions.

The arguments are:

funcs
The function table to fill in. The library initializes this table before calling this function. If you haven't implemented a function in the table, leave its entry unchanged; don't set it to NULL.
tabsize
The size of the structure that funcs points to, in bytes.
Note: Don't change the size member of the structure.

To set an entry in the table, use the I2C_ADD_FUNC() macro:

#define I2C_ADD_FUNC(tabletype, table, entry, func, tabsize) …

For example:

I2C_ADD_FUNC( i2c_master_funcs_t, funcs, init, my_init, tabsize);

The function must return:

0
Success.
-1
Failure.