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

Wrapper for mbed::I2C. More...

#include <I2CMaster.hpp>

Inherits MaximInterfaceCore::I2CMaster.

Public Types

enum  ErrorValue { NackError = 1 }

Public Member Functions

virtual
MaximInterfaceCore::Result
< void > 
start (uint_least8_t address)
 Send start condition and address on the bus.
virtual
MaximInterfaceCore::Result
< void > 
stop ()
 Send stop condition on the bus.
virtual
MaximInterfaceCore::Result
< void > 
writeByte (uint_least8_t data)
 Write data byte to the bus.
virtual
MaximInterfaceCore::Result
< void > 
writePacket (uint_least8_t address, MaximInterfaceCore::span< const uint_least8_t > data, DoStop doStop)
 Perform a complete write transaction on the bus.
virtual
MaximInterfaceCore::Result
< uint_least8_t > 
readByte (DoAck doAck)
 Read data byte from the bus.
virtual
MaximInterfaceCore::Result
< void > 
readPacket (uint_least8_t address, MaximInterfaceCore::span< uint_least8_t > data, DoStop doStop)
 Perform a complete read transaction on 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 > 
readBlock (span< uint_least8_t > data, DoAck doAck)
 Read data block from the bus.

Detailed Description

Wrapper for mbed::I2C.

Definition at line 42 of file MaximInterfaceMbed/I2CMaster.hpp.


Member Enumeration Documentation

enum ErrorValue [inherited]
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, inherited]

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.

virtual MaximInterfaceCore::Result<uint_least8_t> readByte ( DoAck  doAck ) [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.

Implements I2CMaster.

virtual MaximInterfaceCore::Result<void> readPacket ( uint_least8_t  address,
MaximInterfaceCore::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 from I2CMaster.

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

Send start condition and address on the bus.

Parameters:
addressAddress with R/W bit.

Implements I2CMaster.

virtual MaximInterfaceCore::Result<void> stop (  ) [virtual]

Send stop condition on the bus.

Implements I2CMaster.

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

Write data block to the bus.

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

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

Write data byte to the bus.

Implements I2CMaster.

virtual MaximInterfaceCore::Result<void> writePacket ( uint_least8_t  address,
MaximInterfaceCore::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 from I2CMaster.