I2CRTOS Driver by Helmut Schmücker. Removed included mbed-rtos library to prevent multiple definition. Make sure to include mbed-rtos library in your program!
Fork of I2cRtosDriver by
Diff: I2CDriver.h
- Revision:
- 14:352609d395c1
- Parent:
- 13:530968937ccb
--- a/I2CDriver.h Fri May 10 20:38:35 2013 +0000 +++ b/I2CDriver.h Sun May 19 11:21:16 2013 +0000 @@ -2,10 +2,11 @@ #define I2CDRIVER_H #include "stdint.h" +#include "I2C.h" +#include "Mutex.h" -#include "I2C.h" +#include "DigitalOut.h" -#include "Mutex.h" namespace mbed { @@ -14,6 +15,7 @@ class I2CDriver { public: + //static DigitalOut osci2; /// Status returned by the receiveSlave() function enum SlaveRxStatus { NoData = 0, @@ -154,7 +156,7 @@ * * @returns * 0 on success, - * non-0 otherwise + * non-0 otherwise */ int writeSlave(const char *data, int length); @@ -176,8 +178,8 @@ void stopSlave(void); /// Creates a stop condition on the I2C bus - /// If unsccessful because someone on the bus holds the scl line down it returns "false" after 23µs - /// In normal operation the stop shouldn't take longer than 12µs @ 100kHz and 3-4µs @ 400kHz. + /// If unsccessful because someone on the bus holds the scl line down it returns "false" after 23µs + /// In normal operation the stop shouldn't take longer than 12µs @ 100kHz and 3-4µs @ 400kHz. bool stopMaster(void); /// Wait until the i2c driver becomes available. @@ -204,18 +206,16 @@ int freq; int slaveAdr; bool modeSlave; + bool initialized; + osThreadId callerID; + osPriority callerPrio; }; - // curren i2c configuration of this driver interface + // current i2c configuration of this driver interface int m_freq; int m_slaveAdr; bool m_modeSlave; - // id and prio of current caller thread - osThreadId m_callerID; - osPriority m_callerPrio; - - // i2c driver prio static const osPriority c_drvPrio = osPriorityRealtime; // the pin names fo the i2c channels