modm API documentation
modm::i2cMultiplexer< I2cMaster, I2cMultiplexerDevice > Class Template Reference
Inheritance diagram for modm::i2cMultiplexer< I2cMaster, I2cMultiplexerDevice >:
modm::I2c

Public Typedefs

using ConfigurationHandler = void (*)()
 The signature of the configuration function.
 
template<auto & object>
using Ch0 = I2cMultiplexerChannel< object, Channel::Ch0 >
 
template<auto & object>
using Ch1 = I2cMultiplexerChannel< object, Channel::Ch1 >
 
template<auto & object>
using Ch2 = I2cMultiplexerChannel< object, Channel::Ch2 >
 
template<auto & object>
using Ch3 = I2cMultiplexerChannel< object, Channel::Ch3 >
 
template<auto & object>
using Ch4 = I2cMultiplexerChannel< object, Channel::Ch4 >
 
template<auto & object>
using Ch5 = I2cMultiplexerChannel< object, Channel::Ch5 >
 
template<auto & object>
using Ch6 = I2cMultiplexerChannel< object, Channel::Ch6 >
 
template<auto & object>
using Ch7 = I2cMultiplexerChannel< object, Channel::Ch7 >
 

Public Types

enum  Channel : uint8_t {
  Ch0 = 0, Ch1 = 1, Ch2 = 2, Ch3 = 3,
  Ch4 = 4, Ch5 = 5, Ch6 = 6, Ch7 = 7
}
 
enum  DetachCause : uint8_t { DetachCause::NormalStop, DetachCause::ErrorCondition, DetachCause::FailedToAttach }
 
enum  TransactionState : uint8_t { TransactionState::Idle, TransactionState::Busy, TransactionState::Error }
 State of a I2c Transaction. More...
 
enum  Operation : uint8_t { Operation::Stop = 0, Operation::Restart = 1, Operation::Write = 2, Operation::Read = 3 }
 All possible I2C Operations. More...
 
enum  OperationAfterRead : uint8_t { OperationAfterRead::Stop = uint8_t(Operation::Stop), OperationAfterRead::Restart = uint8_t(Operation::Restart) }
 Further operations after read operation. More...
 
enum  OperationAfterStart : uint8_t { OperationAfterStart::Stop = uint8_t(Operation::Stop), OperationAfterStart::Write = uint8_t(Operation::Write), OperationAfterStart::Read = uint8_t(Operation::Read) }
 Further operations after start operation. More...
 
enum  OperationAfterWrite : uint8_t { OperationAfterWrite::Stop = uint8_t(Operation::Stop), OperationAfterWrite::Restart = uint8_t(Operation::Restart), OperationAfterWrite::Write = uint8_t(Operation::Write) }
 Further operations after write operation. More...
 

Static Public Member Functions

static bool start (I2cTransaction *transaction, ConfigurationHandler handler=nullptr)
 
template<class Scl >
static void resetDevices (uint32_t baudrate=100'000)
 

Public Attributes

I2cMultiplexerDevice multiplexerDevice
 

Static Public Attributes

static constexpr uint8_t Read = 0x01
 Add the Read bit to the slave address.
 
static constexpr uint8_t Write = 0x00
 Add the Write bit to the slave address.
 

Member Typedef Documentation

template<class I2cMaster , class I2cMultiplexerDevice >
template<auto & object>
using modm::i2cMultiplexer< I2cMaster, I2cMultiplexerDevice >::Ch0 = I2cMultiplexerChannel< object, Channel::Ch0 >

Alias-templates for simpler use of the Channels

Member Enumeration Documentation

enum modm::I2c::DetachCause : uint8_t
inheritedstrong

This tells the I2cTransaction why it was detached

See also
I2cTransaction
Enum ValuesDocumentation
NormalStop 

All operations finished normally.

ErrorCondition 

A bus error occurred and the bus was reset.

FailedToAttach 

The I2cTransaction failed to attach to the I2cMaster.

enum modm::I2c::Operation : uint8_t
inheritedstrong

All possible I2C Operations.

I2C Operations that the I2cTransaction can give the master on callback

See also
I2cTransaction
Enum ValuesDocumentation
Stop 

Generate a Stop Condition.

Restart 

Generate a Restart.

Write 

Write data to the slave.

Read 

Read data from the slave.

enum modm::I2c::OperationAfterRead : uint8_t
inheritedstrong

Further operations after read operation.

Enum ValuesDocumentation
Stop 

Generate a Stop Condition.

Restart 

Generate a Restart.

enum modm::I2c::OperationAfterStart : uint8_t
inheritedstrong

Further operations after start operation.

Enum ValuesDocumentation
Stop 

Generate a Stop Condition.

Write 

Write data to the slave.

Read 

Read data from the slave.

enum modm::I2c::OperationAfterWrite : uint8_t
inheritedstrong

Further operations after write operation.

Enum ValuesDocumentation
Stop 

Generate a Stop Condition.

Restart 

Generate a Restart.

Write 

Write data to the slave.

enum modm::I2c::TransactionState : uint8_t
inheritedstrong

State of a I2c Transaction.

Enum ValuesDocumentation
Idle 

No error occurred, detached normally.

Busy 

The transaction object is busy with data transfer.

Error 

An error occurred, check the masters getErrorCode()

Member Function Documentation

template<class Scl >
static void modm::I2c::resetDevices ( uint32_t  baudrate = 100'000)
inheritedinlinestatic

Reset all slave devices connected to an I2C bus.

During normal operation, I2C slave device may pull the SDA line low. However, if the master is reset during a transaction, the I2C clock may stop while the slave is outputting a low data bit and the slave will continue to hold this bit (forever, and ever and ever). The I2C master is then unable to generate a I2C start condition, since SDA is still held low by the slave device, resulting in a deadlock.

"You can always get it back to standby mode by allowing the SDA line to float high and give it 9 clocks. This assures that the device will not receive the acknowledge bit at the end the current byte and will abort the command and go to standby."

See also
Application Note AN572 by Microchip
Warning
Must be called before connecting SDA and SCL to I2cMaster!
Template Parameters
SclThe clock pin of the bus to be reset.

The documentation for this class was generated from the following file: