AceSegment  0.7.0
A framework for rendering seven segment LED displays using the TM1637, MAX7219, HT16K33, or 74HC595 controller chips
Public Member Functions | List of all members
ace_segment::SimpleWireInterface Class Reference

A software I2C implementation for sending LED segment patterns over I2C. More...

#include <SimpleWireInterface.h>

Public Member Functions

 SimpleWireInterface (uint8_t addr, uint8_t dataPin, uint8_t clockPin, uint8_t delayMicros)
 Constructor. More...
 
void begin () const
 Initialize the clock and data pins.
 
void end () const
 Set clock and data pins to INPUT mode.
 
void beginTransmission () const
 Send start condition.
 
void endTransmission () const
 Send stop condition.
 
uint8_t write (uint8_t data) const
 Send the data byte on the data bus, with MSB first as specified by I2C. More...
 

Detailed Description

A software I2C implementation for sending LED segment patterns over I2C.

This has the same API has TwoWireInterface so it can be a drop-in replacement.

The implementation is very similar to SoftTmiInterface because the TM1637 protocol is very similar to I2C. To keep everything simple, so the beginTransmission(), write() and endTransimision() methods are blocking calls because interrupts are not used. This means that we can eliminate the send buffer, saving static memory.

Definition at line 43 of file SimpleWireInterface.h.

Constructor & Destructor Documentation

◆ SimpleWireInterface()

ace_segment::SimpleWireInterface::SimpleWireInterface ( uint8_t  addr,
uint8_t  dataPin,
uint8_t  clockPin,
uint8_t  delayMicros 
)
inline

Constructor.

Parameters
addrI2C address of slave device
dataPinSDA pin
clockPinSCL pin
delayMicrosdelay after each bit transition (full cycle = 2 * delayMicros)

Definition at line 53 of file SimpleWireInterface.h.

Member Function Documentation

◆ write()

uint8_t ace_segment::SimpleWireInterface::write ( uint8_t  data) const
inline

Send the data byte on the data bus, with MSB first as specified by I2C.

Returns
0 means ACK, 1 means NACK.

Definition at line 108 of file SimpleWireInterface.h.


The documentation for this class was generated from the following file: