MSS_I2C_register_transfer_completion_handler

Function MSS_I2C_register_transfer_completion_handler 

Source
pub unsafe extern "C" fn MSS_I2C_register_transfer_completion_handler(
    this_i2c: *mut mss_i2c_instance_t,
    completion_handler: mss_i2c_transfer_completion_t,
)
Expand description

§The MSS_I2C_register_transfer_completion_handler() function is used register transfer completion call back function. This mechanism is used to notify the completion of the previously initiated I2C transfer when MSS I2C instance is operating as I2C Master. This call back function will be called when the transfer is completed. It will also inform the transfer status as a parameter of the completion handler function. This function must be called after I2C initialization and before starting any transmit or receive operations.

@param this_i2c: The this_i2c parameter is a pointer to an mss_i2c_instance_t structure identifying the MSS I2C hardware block to be initialized. There are four such data structures, g_mss_i2c0_lo and g_mss_i2c1_lo, associated with MSS I2C 0 and MSS I2C 1 when they are connected on the AXI switch slave 5 (main APB bus) and g_mss_i2c0_hi and g_mss_i2c1_hi, associated with MSS I2C 0 to MSS I2C 1 when they are connected on the AXI switch slave 6 (AMP APB bus). This parameter must point to one of these four global data structure defined within I2C driver.

@param completion_handler: The completion_handler parameter pointers to the function that informs to application previously initiated I2C transfer is completed along with transfer status.

@return This function does not return a value.

Example @code void i2c0_completion_handler(mss_i2c_instance_t * instance, mss_i2c_status_t status) { if (status == MSS_I2C_SUCCESS) { MSS_UART_polled_tx_string(gp_my_uart, (const uint8_t*)“\rI2C0
Transfer completed.\n\r”); } }

void main() { MSS_I2C_init(I2C_MASTER, MASTER_SER_ADDR, MSS_I2C_BCLK_DIV_8); MSS_I2C_register_transfer_completion_handler(I2C_MASTER, i2c0_completion_handler); } @endcode