Commanders
Arduino buttons/bus library
|
#include "I2CCommander.hpp"
Public Member Functions | |
I2CCommanderClass () | |
void | begin (uint8_t inI2CSlaveID) |
unsigned long | loop () |
void | printCommander () |
Static Public Member Functions | |
static I2CCommanderClass & | GetCurrent () |
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 |
|
inline |
Default constructor.
void I2CCommanderClass::begin | ( | uint8_t | inI2CSlaveID | ) |
Initialize the instance.
inI2CSlaveID | I2C Slave ID. This Id must be unique on all connected devices to the I2C master. |
|
inlinestatic |
Get the current instance of DccCommanderClass
|
virtual |
Main loop function.
Reimplemented from Commander.
void I2CCommanderClass::printCommander | ( | ) |
Print this Commander on the console.