Commanders
Arduino buttons/bus library
I2CCommander.hpp
1 //-------------------------------------------------------------------
2 #ifndef __i2cCommander_H__
3 #define __i2cCommander_H__
4 //-------------------------------------------------------------------
5 
6 #include <Commanders.h>
7 
8 #ifndef NO_I2CCOMMANDER
9 #ifdef VISUALSTUDIO
10  #include "Wire.hpp"
11 #else
12  #include <Wire.h>
13 #endif
14 
15 #define I2CCommander I2CCommanderClass::GetCurrent()
16 
38 {
39  private:
40  uint8_t I2CSlaveId;
41  static I2CCommanderClass *pI2cCommander;
42 
43  public:
45  inline I2CCommanderClass() : Commander() {}
46 
50  void begin(uint8_t inI2CSlaveID);
51 
53  unsigned long loop();
54 
55  public:
59  static inline I2CCommanderClass &GetCurrent()
60  {
61  if (pI2cCommander == NULL)
62  pI2cCommander = new I2CCommanderClass();
63 
64  return *(I2CCommanderClass::pI2cCommander);
65  }
66 #ifdef COMMANDERS_PRINT_COMMANDERS
67 
70  void printCommander();
71 #endif
72 };
73 
74 //-------------------------------------------------------------------
75 #endif
76 #endif
77 //-------------------------------------------------------------------
static I2CCommanderClass & GetCurrent()
unsigned long loop()
void begin(uint8_t inI2CSlaveID)