|
enum | DetachCause : uint8_t { DetachCause::NormalStop,
DetachCause::ErrorCondition,
DetachCause::FailedToAttach
} |
|
enum | Error : uint8_t {
Error::NoError,
Error::SoftwareReset,
Error::AddressNack,
Error::DataNack,
Error::ArbitrationLost,
Error::BusCondition,
Error::BusBusy,
Error::Unknown
} |
| Errors that can happen during master operation. More...
|
|
enum | PullUps { PullUps::External,
PullUps::Internal
} |
|
enum | ResetDevices : uint32_t { ResetDevices::NoReset = 0,
ResetDevices::LowSpeed = 10'000,
ResetDevices::Standard = 100'000,
ResetDevices::Fast = 400'000
} |
|
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...
|
|
|
template<class... Signals> |
static void | connect (PullUps pullups=PullUps::External, ResetDevices reset=ResetDevices::Standard) |
|
template<class SystemClock , baudrate_t baudrate = kBd(100), percent_t tolerance = pct(5)> |
static void | initialize (uint8_t isrPriority=10u) |
|
static bool | start (I2cTransaction *transaction, ConfigurationHandler handler=nullptr) |
|
static Error | getErrorState () |
|
static void | reset () |
|
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
|
|
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.
|
|
template<class Scl > |
static void | resetDevices (uint32_t baudrate=100'000) |
|
static void | setParameter () |
| sets a parameter
|
|
I2cMaster implementation of I2C3 module.
Interrupts must be enabled.
- Author
- Georgi Grinshpun
-
Niklas Hauser
-
Sascha Schade (strongly-typed)
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
-
Scl | The clock pin of the bus to be reset. |