Commanders
Arduino buttons/bus library
I2CCommanderClass Class Reference

#include "I2CCommander.hpp"

Inheritance diagram for I2CCommanderClass:
Commander

Public Member Functions

 I2CCommanderClass ()
 
void begin (uint8_t inI2CSlaveID)
 
unsigned long loop ()
 
void printCommander ()
 

Static Public Member Functions

static I2CCommanderClass & GetCurrent ()
 

Detailed Description

This Commanders receive orders from I2C bus, and translate it into Commanders events.

On an I2C bus, there is one and only one master, and one or more slaves. In Commanders implementation, only one slave can be defined. The master send messages to a specific slave, defined by a number: the slave ID.

A sample of the library give a master, sender of events to Commanders.

To work, the master must send a message with the form of

IIIIEDD

where IIII is an unsigned long (four bytes) for the event id, E is the event type (see values of COMMANDERS_EVENT_TYPE), and DD the associated data.

Events thrown:

reason id type data
message received id type data

Definition at line 37 of file I2CCommander.hpp.

Constructor & Destructor Documentation

I2CCommanderClass::I2CCommanderClass ( )
inline

Default constructor.

Definition at line 45 of file I2CCommander.hpp.

Member Function Documentation

void I2CCommanderClass::begin ( uint8_t  inI2CSlaveID)

Initialize the instance.

Parameters
inI2CSlaveIDI2C Slave ID. This Id must be unique on all connected devices to the I2C master.

Definition at line 55 of file I2CCommander.cpp.

static I2CCommanderClass& I2CCommanderClass::GetCurrent ( )
inlinestatic

Get the current instance of DccCommanderClass

Remarks
This is an internal function.

Definition at line 59 of file I2CCommander.hpp.

unsigned long I2CCommanderClass::loop ( )
virtual

Main loop function.

Reimplemented from Commander.

Definition at line 63 of file I2CCommander.cpp.

void I2CCommanderClass::printCommander ( )

Print this Commander on the console.

Remarks
Only available if COMMANDERS_PRINT_COMMANDERS is defined.

Definition at line 76 of file I2CCommander.cpp.


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