An I2C master transaction can contain up to MAX_NR_OF_DATAOPERATIONS read/write operations.
More...
#include <Imt.Base.Dff.ActiveParts.AM3354/I2C/I2CMasterTransactionProtocol.h>
|
void | setReadOperationData (const uint8_t position, const uint8_t readData) |
| Set the read data of a read operation at the passed position. More...
|
|
An I2C master transaction can contain up to MAX_NR_OF_DATAOPERATIONS read/write operations.
◆ I2CMasterTransactionProtocol()
Default constructor.
- Parameters
-
slaveAddress | Address of the I2C slave (valid range = 0x00...0x7F). |
transactionId | Identifier of the transaction (use RuntimeIdGenerator to generate unique id's). |
◆ addReadOperation()
void imt::base::dff::activeparts::am3354::I2CMasterTransactionProtocol::addReadOperation |
( |
void |
| ) |
|
Add a read operation to this transaction.
If maximum of operations are already added the operation will be ignored.
◆ addWriteOperation()
void imt::base::dff::activeparts::am3354::I2CMasterTransactionProtocol::addWriteOperation |
( |
const uint8_t |
dataToWrite | ) |
|
Add a write operation to this transaction.
If maximum of operations are already added the operation will be ignored.
- Parameters
-
dataToWrite | Data to write. |
◆ deserialize()
◆ getNumberOfDataOperations()
uint8_t imt::base::dff::activeparts::am3354::I2CMasterTransactionProtocol::getNumberOfDataOperations |
( |
void |
| ) |
const |
Returns the number of data operation associated to this transaction.
- Returns
- Number of data operation.
◆ getNumberOfRemainingBytesWithSameDirection()
uint8_t imt::base::dff::activeparts::am3354::I2CMasterTransactionProtocol::getNumberOfRemainingBytesWithSameDirection |
( |
const uint8_t |
startPosition | ) |
const |
Returns the number of remaining bytes with the same direction from the given position (read and write operations can be mixed which will generated a repeated start).
- Parameters
-
startPosition | Start position. |
- Returns
- Number of bytes with same same r/w flag.
◆ getOperationData()
uint8_t imt::base::dff::activeparts::am3354::I2CMasterTransactionProtocol::getOperationData |
( |
const uint8_t |
position | ) |
const |
Get the data of the operation at the given position.
If an invalid position is passed 0 will be returned.
- Parameters
-
position | Position of the operation within the transaction. |
- Returns
- Data of the operation at the desired position.
◆ getSlaveAddress()
uint8_t imt::base::dff::activeparts::am3354::I2CMasterTransactionProtocol::getSlaveAddress |
( |
void |
| ) |
const |
Get the 7-Bit address of I2C slave for this master transaction.
- Returns
- 7-Bit I2C address.
◆ getTransactionId()
uint32_t imt::base::dff::activeparts::am3354::I2CMasterTransactionProtocol::getTransactionId |
( |
void |
| ) |
const |
Get the transaction id which is used to identify the transaction (similar to a tracking number in mail-order).
- Returns
- Transaction id which identifies the transaction.
◆ getWriteTransactionFlags()
uint16_t imt::base::dff::activeparts::am3354::I2CMasterTransactionProtocol::getWriteTransactionFlags |
( |
void |
| ) |
const |
Get the bit flag for each data operation.
The bit value of the bit position indicates a write(bit value ==1) or read operation (bit value = 0). The bits are only valid for the associated number of data operations for this transaction. Example: bit0 is 1 -> First operation is a write operation, getOperationData(0) returns the data to write. bit0 is 0 -> First operation is a read operation, getOperationData(1) returns the read data.
- Returns
- r/w flag for each data operation.
◆ isWriteOperation()
bool imt::base::dff::activeparts::am3354::I2CMasterTransactionProtocol::isWriteOperation |
( |
const uint8_t |
position | ) |
const |
Returns true if the data operation at the given position is a write operation.
If position is out of range, the return value is always false.
- Parameters
-
position | Valid range from 0 .. (MAX_NR_OF_DATAOPERATIONS-1). |
- Returns
- True if is a write operation.
◆ serialize()
◆ setReadOperationData()
void imt::base::dff::activeparts::am3354::I2CMasterTransactionProtocol::setReadOperationData |
( |
const uint8_t |
position, |
|
|
const uint8_t |
readData |
|
) |
| |
|
protected |
Set the read data of a read operation at the passed position.
If an invalid position is passed or the position indicates no read operation the date will be ignored. Remark: getWriteTransactionFlags() must indicate a read operation on this position else the data will not be set.
The documentation for this class was generated from the following file:
- D:/_Work/10/s/Imt.Base/Imt.Base.Dff.ActiveParts.AM3354/I2C/I2CMasterTransactionProtocol.h