|ROM API functions / I2C API|
In slave mode, polled routines are intended for testing purposes. It is up to the user to decide whether to use the polled or interrupt driven mode. While operating the Slave driver in polled mode can be useful for program development and debugging, most applications will need the interrupt-driven versions of Slave Receive and Transmit in the final software.
The following routines are polled routines:
err_code i2c_slave_receive_poll(I2C_HANDLE_T*,I2C_PARAM*, I2C_RESULT*)-->
err_code i2c_slave_transmit_poll(I2C_HANDLE_T*,I2C_PARAM*, I2C_RESULT*)-->
The following routines are interrupt driven routines:
err_code i2c_slave_receive_intr(I2C_HANDLE_T*,I2C_PARAM*, I2C_RESULT*)-->
err_code i2c_slave_transmit_intr(I2C_HANDLE_T*,I2C_PARAM*, I2C_RESULT*)-->
To initiate a master-mode write/read the I2C_PARAM has to be setup. The I2C_PARAM is a structure with various variables needed by the I2C ROM Driver to operate correctly. The structure contains the following:
The RESULT structure contains the results after the function executes. The structure contains the following:
To initiate a slave mode communication, the receive function is called. This can be either the polling or interrupt driven function, i2c_slave_receive_poll() or i2c_slave_receive_intr(), respectively. The receive buffer should be as large or larger than any data or command that will be received. If the amount of data exceed the receive buffer size, an error code will be returned.
In slave-receive mode, the driver receives data until one of the following are true:
When using the interrupt function calls, the callback functions must be define. Upon the completion of a read/write as specified by the PARAM structure, the callback functions will be invoked.
© NXP N.V. 2014. All rights reserved.