Hardware I2C master class for AVR.
More...
#include <AvrI2c.h>
|
void | begin (bool fastMode=true) |
| Initialize prescalar and SLC clock rate. More...
|
|
uint8_t | read (bool last) |
| Read a byte and send Ack if more reads follow else Nak to terminate read. More...
|
|
bool | repeatedStart (uint8_t addressRW) |
| Issue a repeated start condition. More...
|
|
bool | start (uint8_t addressRW) |
| Issue a start condition. More...
|
|
uint8_t | status (void) |
|
void | stop (void) |
|
bool | write (uint8_t data) |
| Write a byte. More...
|
|
Hardware I2C master class for AVR.
Uses ATmega TWI hardware port
◆ begin()
void AvrI2c::begin |
( |
bool |
fastMode = true | ) |
|
|
inline |
Initialize prescalar and SLC clock rate.
- Parameters
-
[in] | fastMode | Fast 400 kHz mode if true else standard 100 kHz mode. |
◆ read()
uint8_t AvrI2c::read |
( |
bool |
last | ) |
|
|
inline |
Read a byte and send Ack if more reads follow else Nak to terminate read.
- Parameters
-
[in] | last | Set true to terminate the read else false. |
- Returns
- The byte read from the I2C bus.
◆ repeatedStart()
bool AvrI2c::repeatedStart |
( |
uint8_t |
addressRW | ) |
|
|
inline |
Issue a repeated start condition.
same as start with no stop. Included to document intention.
- Parameters
-
[in] | addressRW | I2C address with read/write bit. |
- Returns
- The value true, 1, for success or false, 0, for failure.
◆ start()
bool AvrI2c::start |
( |
uint8_t |
addressRW | ) |
|
|
inline |
Issue a start condition.
- Parameters
-
[in] | addressRW | I2C address with read/write bit. |
- Returns
- The value true for success or false for failure.
◆ status()
uint8_t AvrI2c::status |
( |
void |
| ) |
|
|
inline |
- Returns
- status from last TWI command - useful for library debug
◆ stop()
void AvrI2c::stop |
( |
void |
| ) |
|
|
inline |
◆ write()
bool AvrI2c::write |
( |
uint8_t |
data | ) |
|
|
inline |
Write a byte.
- Parameters
-
[in] | data | The byte to send. |
- Returns
- The value true, 1, if the slave returned an Ack or false for Nak.
The documentation for this class was generated from the following file:
- Arduino/libraries/SSD1306Ascii/src/utility/AvrI2c.h