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:
- 5:315872eec0ae
- Parent:
- 4:d8f51b136dbd
- Child:
- 6:0b18a49e03b9
--- a/I2CEeprom.h Sat Mar 28 01:50:44 2020 +0000 +++ b/I2CEeprom.h Sat Mar 28 11:19:53 2020 +0000 @@ -30,18 +30,21 @@ public: /// Constructor to create a new instance of the class. /// @param i2c a reference to the i2c bus the chip is connected to. - /// @param address The 8bit I2C address of the chip in the range 0xA0 - 0xAE. + /// @param address The 8bit I2C address of the chip /// @param pageSize The size of the page used in writing to the chip. - /// @param chipSize The size of the memory in the chip to allow range checkng. Set to - /// 0 to disable checks. - /// @param The write cycle time in ms. + /// @param chipSize The size of the memory in the chip for range check. + /// Set to 0 to disable checks. + /// @param writeCycleTime_ms The write cycle time in ms. After a write + /// The thread will be put to sleep for this time before being polled + /// at 1 ms intervals to check the write has completed. /// TODO : Could use bus frequency to cap the speed of the bus + /// Would need a way to read bus frequency I2CEeprom( I2C& i2c, int address, size_t pageSize, size_t chipSize, - uint8_t write_cycle_time_ms); + uint8_t writeCycleTime_ms); /// Read a single byte from the address in memory. /// @param address Memory address to read from. @@ -72,6 +75,8 @@ size_t write(size_t address, char value); /// Write multiple bytes starting from the address in memory. + /// Note that in this implementation, a buffer is allocated on the heap + /// for the /// @param address Memory address to start writting to. /// @param buffer Pointer to buffer holding the bytes to write to memory. /// @param size Number of bytes to be written to memory.