Data Fields
I2C_Transaction Struct Reference

Defines a transaction to be used with I2C_transfer() or I2C_transferTimeout() More...

#include <I2C.h>

Data Fields

void * writeBuf
 
size_t writeCount
 
void * readBuf
 
size_t readCount
 
void * arg
 
volatile int_fast16_t status
 
uint_least8_t slaveAddress
 

Detailed Description

Defines a transaction to be used with I2C_transfer() or I2C_transferTimeout()

After a call to I2C_transfer(), the I2C_Transaction.status reflects the current transfer status.

See also
I2C_transfer(), I2C_transferTimeout()

Field Documentation

§ writeBuf

void* I2C_Transaction::writeBuf

Pointer to a buffer of at least I2C_Transaction.writeCount bytes. If I2C_Transaction.writeCount is 0, this pointer is not used.

§ writeCount

size_t I2C_Transaction::writeCount

Number of bytes to write to the I2C slave device. A value of 0 indicates no data will be written to the slave device and only a read will occur. If this value is not 0, the driver will always perform the write transfer first. The data written to the I2C bus is preceded by the I2C_Transaction.slaveAddress with the write bit set. If writeCount bytes are successfully sent and acknowledged, the transfer will complete or perform a read–depending on I2C_Transaction.readCount.

Note
Both I2C_Transaction.writeCount and I2C_Transaction.readCount can not be 0.

§ readBuf

void* I2C_Transaction::readBuf

Pointer to a buffer of at least I2C_Transaction.readCount bytes. If I2C_Transaction.readCount is 0, this pointer is not used.

§ readCount

size_t I2C_Transaction::readCount

Number of bytes to read from the I2C slave device. A value of 0 indicates no data will be read and only a write will occur. If I2C_Transaction.writeCount is not 0, this driver will perform the write first, followed by the read. The data read from the bus is preceded by the I2C_Transaction.slaveAddress with the read bit set. After readCount bytes are successfully read, the transfer will complete.

Note
Both I2C_Transaction.writeCount and I2C_Transaction.readCount can not be 0.

§ arg

void* I2C_Transaction::arg

Pointer to a custom argument to be passed to the I2C_CallbackFxn function via the I2C_Transaction structure.

Note
The I2C_CallbackFxn function is only called when operating in I2C_MODE_CALLBACK.
See also
I2C_MODE_CALLBACK
I2C_CallbackFxn

§ status

volatile int_fast16_t I2C_Transaction::status

I2C status of the current transaction. The status may be used to determine why a transaction failed. Potential codes are:

This status may also be used to determine if a transaction is queued (I2C_STATUS_QUEUED) or in progress (I2C_STATUS_INCOMPLETE).

§ slaveAddress

uint_least8_t I2C_Transaction::slaveAddress

I2C slave address used for the transaction. The slave address is the first byte transmitted during an I2C transfer. The read/write bit is automatically set based upon the I2C_Transaction.writeCount and I2C_Transaction.readCount.


The documentation for this struct was generated from the following file:
© Copyright 1995-2022, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale