SSD1306Ascii

Public Member Functions | List of all members
AvrI2c Class Reference

Hardware I2C master class for AVR. More...

`#include <AvrI2c.h>`

## Public Member Functions
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...
void | setClock (uint32_t frequency)
| Set the I2C bit rate. 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...

## Detailed Description

Hardware I2C master class for AVR.

Uses ATmega TWI hardware port

## Member Function Documentation

## ◆ 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.

## ◆ setClock()

void AvrI2c::setClock | ( | uint32_t | frequency | ) |
| inline

Set the I2C bit rate.

Parameters

  [in] | frequency | Desired frequency in Hz. Valid range for a 16 MHz board is about 40 kHz to 444,000 kHz.

## ◆ 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

Issue a stop condition.

## ◆ 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