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...
 
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]fastModeFast 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]lastSet 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]addressRWI2C 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]addressRWI2C 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]dataThe 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: