AceWire  0.1.0
Unified interface for selecting different I2C implementations on Arduino platforms
Public Member Functions | List of all members
ace_wire::TwoWireInterface< T_WIRE > Class Template Reference

A thin wrapper around an I2C TwoWire class and its Wire object. More...

#include <TwoWireInterface.h>

Public Member Functions

 TwoWireInterface (T_WIRE &wire)
 Constructor. More...
 
void begin ()
 Initial the interface. More...
 
void end ()
 End the interface. More...
 
void beginTransmission (uint8_t addr)
 Start transmission at specified I2C addr.
 
void write (uint8_t data)
 Write data.
 
void endTransmission ()
 End transmission.
 

Detailed Description

template<typename T_WIRE>
class ace_wire::TwoWireInterface< T_WIRE >

A thin wrapper around an I2C TwoWire class and its Wire object.

This is a template class to avoid including the <Wire.h> header file, which increases flash memory on AVR by about 1000 byte even if the Wire object is never used.

This wrapper can also be used with alternative implementations of I2C (software or hardware) so long as they implement some basic API of the TwoWire class: specifically the beginTransmission(), write() and endTransmission() methods. SinceTwoWireInterface` is a template, the alternative implementation classes do not need to inherit from the TwoWire class.

Definition at line 45 of file TwoWireInterface.h.

Constructor & Destructor Documentation

◆ TwoWireInterface()

template<typename T_WIRE >
ace_wire::TwoWireInterface< T_WIRE >::TwoWireInterface ( T_WIRE &  wire)
inline

Constructor.

Parameters
wireinstance of T_WIRE. If the pre-installed Wire.h is used, then T_WIRE is TwoWire and wire is the precreated Wire object

Definition at line 53 of file TwoWireInterface.h.

Member Function Documentation

◆ begin()

template<typename T_WIRE >
void ace_wire::TwoWireInterface< T_WIRE >::begin ( )
inline

Initial the interface.

Currently does nothing.

Definition at line 56 of file TwoWireInterface.h.

◆ end()

template<typename T_WIRE >
void ace_wire::TwoWireInterface< T_WIRE >::end ( )
inline

End the interface.

Currently does nothing.

Definition at line 59 of file TwoWireInterface.h.


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