Fork of 24LCxx_I2C. Works for Renesas EEPROMs. Fixes problems with PageWrites over page boundaries.
Fork of 24LCxx_I2C by
Diff: 24LCxx_I2C.cpp
- Revision:
- 1:bdf87ab4cdb8
- Parent:
- 0:21c698aa86f6
- Child:
- 2:16ce7dae9019
--- a/24LCxx_I2C.cpp Wed Oct 17 07:15:33 2012 +0000
+++ b/24LCxx_I2C.cpp Fri Jan 25 09:24:05 2013 +0000
@@ -23,23 +23,23 @@
namespace _24LCXX_I2C {
- unsigned char C24LCXX_I2C::I2CMouduleRefCounter = 0;
+ unsigned char C24LCXX_I2C::I2CModuleRefCounter = 0;
C24LCXX_I2C::C24LCXX_I2C(const PinName p_sda, const PinName p_scl, const unsigned char p_address, const PinName p_wp, const int p_frequency) : _internalId("") {
DEBUG_ENTER("C24LCXX_I2C")
- if (C24LCXX_I2C::I2CMouduleRefCounter != 0) {
+ if (C24LCXX_I2C::I2CModuleRefCounter != 0) {
error("C24LCXX_I2C: Wrong params");
}
#ifdef __DEBUG
std::ostringstream out(std::ostringstream::out);
- out << "C24LCXX_I2C #" << C24LCXX_I2C::I2CMouduleRefCounter;
+ out << "C24LCXX_I2C #" << C24LCXX_I2C::I2CModuleRefCounter;
_internalId.assign(out.str());
DEBUG("C24LCXX_I2C: _internalId='%s'", _internalId.c_str())
#endif // __DEBUG
_i2cInstance = new I2C(p_sda, p_scl, "24LCxx_I2C");
- C24LCXX_I2C::I2CMouduleRefCounter += 1;
- DEBUG_ENTER("C24LCXX_I2C: refCounter=%d", C24LCXX_I2C::I2CMouduleRefCounter)
+ C24LCXX_I2C::I2CModuleRefCounter += 1;
+ DEBUG_ENTER("C24LCXX_I2C: refCounter=%d", C24LCXX_I2C::I2CModuleRefCounter)
_slaveAddress = (p_address << 1) | 0xa0; // Slave address format is: 1 0 1 0 A3 A2 A1 R/W
DEBUG("C24LCXX_I2C: I2C slave adress: 0x%02x", _slaveAddress)
@@ -60,9 +60,9 @@
DEBUG_ENTER("~C24LCXX_I2C")
// Release I2C instance
- DEBUG_ENTER("~C24LCXX_I2C: refCounter=%d", C24LCXX_I2C::I2CMouduleRefCounter)
- C24LCXX_I2C::I2CMouduleRefCounter -= 1;
- if (C24LCXX_I2C::I2CMouduleRefCounter == 0) {
+ DEBUG_ENTER("~C24LCXX_I2C: refCounter=%d", C24LCXX_I2C::I2CModuleRefCounter)
+ C24LCXX_I2C::I2CModuleRefCounter -= 1;
+ if (C24LCXX_I2C::I2CModuleRefCounter == 0) {
delete _i2cInstance;
_i2cInstance = NULL;
}
