send function

Updated: October 26, 2022

The send function initiates a master send. An optional event is sent when the transaction is complete (and the data buffer can be released). If this function fails, no transaction has been initiated.

The prototype for this function is:

i2c_status_t send(
               void *hdl,
               void *buf,
               unsigned int len,
               unsigned int stop );

The arguments are:

hdl
The handle returned by the init function.
buf
A pointer to the buffer of data to send.
len
The length, in bytes, of the data to send.
stop
If this is nonzero, the function sets the stop condition when the send completes.

The function returns one of the following:

I2C_STATUS_DONE
The transaction completed (with or without an error).
I2C_STATUS_ERROR
An unknown error occurred.
I2C_STATUS_NACK
Slave no-acknowledgement.
I2C_STATUS_ARBL
Lost arbitration.
I2C_STATUS_BUSY
The transaction timed out.
I2C_STATUS_ABORT
The transaction was aborted.