17.6.3.3.3 Function i2c_master_write_packet_wait()

Writes data packet to slave.

enum status_code i2c_master_write_packet_wait( struct i2c_master_module *const module, struct i2c_master_packet *const packet)

Writes a data packet to the specified slave address on the I2C bus and sends a stop condition when finished.

Note: This will stall the device from any other operation. For interrupt-driven operation, see i2c_master_read_packet_job.
Table 17-20. Parameters
Data directionParameter nameDescription

[in, out]

module

Pointer to software module struct

[in, out]

packet

Pointer to I2C packet to transfer

Returns

Status of write packet.

Table 17-21. Return Values
Return valueDescription

STATUS_OK

If packet was write successfully

STATUS_BUSY

If master module is busy with a job

STATUS_ERR_DENIED

If error on bus

STATUS_ERR_PACKET_COLLISION

If arbitration is lost

STATUS_ERR_BAD_ADDRESS

If slave is busy, or no slave acknowledged the address

STATUS_ERR_TIMEOUT

If timeout occurred

STATUS_ERR_OVERFLOW

If slave did not acknowledge last sent data, indicating that slave does not want more data and was not able to read last data sent