|
modm API documentation
|
#include <modm/architecture/interface/i2c_multiplexer.hpp>
Public Typedefs | |
| using | ConfigurationHandler = void (*)() |
| The signature of the configuration function. | |
Static Public Member Functions | |
| static bool | start (I2cTransaction *transaction, ConfigurationHandler handler=nullptr) |
| static void | acknowledgeInterruptFlag () |
| template<uint64_t available, uint64_t requested, percent_t tolerance> | |
| static void | assertBaudrateInTolerance () |
| template<double available, double requested, percent_t tolerance> | |
| static void | assertDurationInTolerance () |
| static void | configurePurpose () |
| configures a peripheral for a specific purpose | |
| template<class... Signals> | |
| static void | connect (PullUps pullups=PullUps::External, ResetDevices reset=ResetDevices::Standard) |
| static Error | getErrorState () |
| static bool | getInterruptFlag () |
| Read an interrupt flag. | |
| static void | getParameter () |
| returns a parameter | |
| template<class SystemClock , baudrate_t baudrate = 100_kBd, percent_t tolerance = 5_pct> | |
| static void | initialize () |
| static void | initialize () |
| initializes the peripheral, must be called before use. | |
| static void | reset () |
| template<class Scl > | |
| static void | resetDevices (uint32_t baudrate=100'000) |
| static void | setParameter () |
| sets a parameter | |
Static Public Attributes | |
| static constexpr auto & | i2cMultiplexer = multiplexer |
| static constexpr uint8_t | Read = 0x01 |
| Add the Read bit to the slave address. | |
| static constexpr size_t | TransactionBufferSize = 8 |
| Number of transactions which can be queued in this driver. | |
| static constexpr uint8_t | Write = 0x00 |
| Add the Write bit to the slave address. | |
Interface of an I2C Multiplexer.
All I2C multiplexer driver should implement this interface.
|
inheritedstrong |
This tells the I2cTransaction why it was detached
| Enum Values | Documentation |
|---|---|
| NormalStop | All operations finished normally. |
| ErrorCondition | A bus error occurred and the bus was reset. |
| FailedToAttach | The I2cTransaction failed to attach to the I2cMaster. |
|
inheritedstrong |
Errors that can happen during master operation.
| Enum Values | Documentation |
|---|---|
| NoError | No Error occurred. |
| SoftwareReset | The master was reset in software. |
| AddressNack | Address was transmitted and NACK received. |
| DataNack | Data was transmitted and NACK received. |
| ArbitrationLost | Arbitration was lost during writing or reading. |
| BusCondition | Misplaced Start or Stop condition. |
| BusBusy | Bus is busy during Start condition. |
| Unknown | Unknown error condition. |
|
inheritedstrong |
All possible I2C Operations.
I2C Operations that the I2cTransaction can give the master on callback
| Enum Values | Documentation |
|---|---|
| Stop | Generate a Stop Condition. |
| Restart | Generate a Restart. |
| Write | Write data to the slave. |
| Read | Read data from the slave. |
|
inheritedstrong |
|
inheritedstrong |
|
inheritedstrong |
Further operations after write operation.
| Enum Values | Documentation |
|---|---|
| Stop | Generate a Stop Condition. |
| Restart | Generate a Restart. |
| Write | Write data to the slave. |
|
inheritedstrong |
|
inheritedstrong |
|
inheritedstrong |
State of a I2c Transaction.
| Enum Values | Documentation |
|---|---|
| Idle | No error occurred, detached normally. |
| Busy | The transaction object is busy with data transfer. |
| Error | An error occurred, check the masters |
|
inheritedstatic |
Acknowledge an interrupt flag.
We use acknowledge here, since it describes the intention rather than the actual implementation.
|
inheritedinlinestatic |
Since baudrates are usually generated by prescaling a system clock, only several distinct values can be generated. This method checks if the user requested baudrate is within error tolerance of the system achievable baudrate.
|
inheritedstatic |
Configures the Scl and Sda signals and connects them.
This configures the Scl and Sda signals as open-drain outputs with optional weak internal pullups and optionally resets all slave devices on the bus.
| Signals | One Scl and one Sda signal are required and can be passed out-of-order. |
|
inheritedstatic |
Check the error state of the driver.
The error states are hardware and implementation specific.
|
inheritedstatic |
Initializes the hardware and sets the datarate.
| SystemClock | the currently active system clock |
| baudrate | the desired baudrate in Hz |
| tolerance | the allowed absolute tolerance for the resulting baudrate |
|
inheritedstatic |
Perform a software reset of the driver in case of an error and detach the transaction object.
It is strongly recommended to reset the slave devices on the bus after a master reset. You can use the connect() method for that.
|
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."
| Scl | The clock pin of the bus to be reset. |