Device interface library for multiple platforms including Mbed.

Dependents:   DeepCover Embedded Security in IoT MaximInterface MAXREFDES155#

Embed: (wiki syntax)

« Back to documentation index

I2CMaster Class Reference

I2CMaster Class Reference

I2C master interface. More...

#include <I2CMaster.hpp>

Inherited by I2CMasterDecorator, DS9400, and I2CMaster.

Public Types

enum  ErrorValue { NackError = 1 }

Public Member Functions

virtual Result< void > start (uint_least8_t address)=0
 Send start condition and address on the bus.
virtual Result< void > stop ()=0
 Send stop condition on the bus.
virtual Result< void > writeByte (uint_least8_t data)=0
 Write data byte to the bus.
virtual
MaximInterfaceCore_EXPORT
Result< void > 
writeBlock (span< const uint_least8_t > data)
 Write data block to the bus.
virtual
MaximInterfaceCore_EXPORT
Result< void > 
writePacket (uint_least8_t address, span< const uint_least8_t > data, DoStop doStop)
 Perform a complete write transaction on the bus.
virtual Result< uint_least8_t > readByte (DoAck doAck)=0
 Read data byte from the bus.
virtual
MaximInterfaceCore_EXPORT
Result< void > 
readBlock (span< uint_least8_t > data, DoAck doAck)
 Read data block from the bus.
virtual
MaximInterfaceCore_EXPORT
Result< void > 
readPacket (uint_least8_t address, span< uint_least8_t > data, DoStop doStop)
 Perform a complete read transaction on the bus.

Detailed Description

I2C master interface.

Definition at line 45 of file MaximInterfaceCore/I2CMaster.hpp.


Member Enumeration Documentation

enum ErrorValue
Enumerator:
NackError 

Transaction stopped due to a NACK from the slave device.

Definition at line 47 of file MaximInterfaceCore/I2CMaster.hpp.


Member Function Documentation

Result< void > readBlock ( span< uint_least8_t >  data,
DoAck  doAck 
) [virtual]

Read data block from the bus.

Parameters:
[out]dataData read from the bus if successful.
doAckDetermines whether an ACK or NACK is done after reading.

Definition at line 61 of file MaximInterfaceCore/I2CMaster.cpp.

Result< uint_least8_t > readByte ( DoAck  doAck ) [pure virtual]

Read data byte from the bus.

Parameters:
doAckDetermines whether an ACK or NACK is done after reading.
Returns:
data Data read from the bus if successful.

Implemented in I2CMaster.

Definition at line 67 of file MaximInterfaceMbed/I2CMaster.cpp.

Result< void > readPacket ( uint_least8_t  address,
span< uint_least8_t >  data,
DoStop  doStop 
) [virtual]

Perform a complete read transaction on the bus.

Parameters:
addressAddress in 8-bit format.
[out]dataData read from the bus if successful.
doStopDetermines whether to do a stop condition or set up a repeated start.

Reimplemented in I2CMaster.

Definition at line 69 of file MaximInterfaceCore/I2CMaster.cpp.

Result< void > start ( uint_least8_t  address ) [pure virtual]

Send start condition and address on the bus.

Parameters:
addressAddress with R/W bit.

Implemented in I2CMaster.

Definition at line 39 of file MaximInterfaceMbed/I2CMaster.cpp.

Result< void > stop (  ) [pure virtual]

Send stop condition on the bus.

Implemented in I2CMaster.

Definition at line 44 of file MaximInterfaceMbed/I2CMaster.cpp.

Result< void > writeBlock ( span< const uint_least8_t >  data ) [virtual]

Write data block to the bus.

Definition at line 38 of file MaximInterfaceCore/I2CMaster.cpp.

Result< void > writeByte ( uint_least8_t  data ) [pure virtual]

Write data byte to the bus.

Implemented in I2CMaster.

Definition at line 49 of file MaximInterfaceMbed/I2CMaster.cpp.

Result< void > writePacket ( uint_least8_t  address,
span< const uint_least8_t >  data,
DoStop  doStop 
) [virtual]

Perform a complete write transaction on the bus.

Parameters:
addressAddress in 8-bit format.
dataData to write to the bus.
doStopDetermines whether to do a stop condition or set up a repeated start.

Reimplemented in I2CMaster.

Definition at line 45 of file MaximInterfaceCore/I2CMaster.cpp.