Class for representing and controlling entire I2C transactions (the master side). This class allows one to separate in code the configuration of I2C transactions from their use. This property simplifies the process of executing transactions in, for example, the body of a real-time control loop.
Diff: I2CTransaction.h
- Revision:
- 5:ad382f9f43ca
- Parent:
- 3:a9d61e73fe97
- Child:
- 6:4775131da69b
diff -r 73de554a67ff -r ad382f9f43ca I2CTransaction.h --- a/I2CTransaction.h Fri May 23 19:26:11 2014 +0000 +++ b/I2CTransaction.h Mon May 26 20:06:44 2014 +0000 @@ -7,6 +7,7 @@ public: I2CTransaction(int address, char* writePacket, int writePacketLength, char* readPacket = NULL, int readPacketLength = 0); static void setFrequency(int frequency); + static void setMaxRetry(int maxRetry); bool completed(); int getStatus(int i); bool initiateTransaction(); @@ -14,6 +15,8 @@ void displayStatus(Serial *pc, char * strg); bool success(); bool transmissionError(); + bool checkTransaction(); + static int getI2CQueueLength(); private: static MODI2C *i2c; @@ -24,6 +27,8 @@ int writePacketLength; char* readPacket; int readPacketLength; + int retryCount; + static int maxRetryCount; };