Class to provide simple access to I2C EEPROM chiles like Microchip's 24LC range or AMTELS AT24C range. Chips up to 64Kb in size are directly supported. Updated to Mbed OS v 5.1
Diff: I2CEeprom.h
- Revision:
- 8:0c122f839dc9
- Parent:
- 7:29e505d37158
- Child:
- 9:acc133240c9d
--- a/I2CEeprom.h Sat Mar 28 13:42:18 2020 +0000 +++ b/I2CEeprom.h Sat Mar 28 15:45:00 2020 +0000 @@ -24,6 +24,8 @@ /// Chips up to 64Kb in size are directly supported. /// The class handles multiple page writes so any amount of data can be written in /// a single call to write. +/// The code is modified from the original to better support RTOS. +/// /// At start of a write(addr,buffer,size), a buffer of up to pageSize + 2 /// is allocated on the heap, and the data and address are copied to it. /// This allows the write to proceed without unlocking, which might allow @@ -33,6 +35,11 @@ /// preallocate a buffer once at startup, if writes are occurring at arbitrary /// times during execution to prevent surprises with out of memory issues /// when trying to write during normal execution. +/// +/// The constructor takes the I2C bus by non-const reference. This enables +/// a single I2C bus to be shared among many i2c devices. +/// Mbed OS enforces a lock on the bus during a bus read or write +/// so that locks are atomic /// /// Tested on a Microchip 24LC128. class I2CEeprom {