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.
Fork of I2CEeprom by
Diff: I2CEeprom.h
- Revision:
- 2:b7877755371e
- Parent:
- 1:b23f5561266c
--- a/I2CEeprom.h Sun Jul 19 09:34:04 2015 +0000 +++ b/I2CEeprom.h Wed Jan 31 11:54:02 2018 +0000 @@ -30,14 +30,13 @@ class I2CEeprom { public: /// Constructor to create a new instance of the class. - /// @param sda The pin name for the sda line of the I2C bus. - /// @param scl The pin name for the scl line of the I2C bus. + /// @param i2c_inst The I2C bus instance. Pass a reference. /// @param address The 8bit I2C address of the chip in the range 0xA0 - 0xAE. /// @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 busSpeed The frequency of the I2C bus defaults to 400K. - I2CEeprom(PinName sda, PinName scl, int address, size_t pageSize, size_t chipSize, int busSpeed = 400000); + I2CEeprom(I2C *i2c_inst, int address, size_t pageSize, size_t chipSize, int busSpeed = 400000); /// Read a single byte from the address in memory. /// @param address Memory address to read from. @@ -99,7 +98,7 @@ bool checkSpace(size_t address, size_t size); private: - I2C m_i2c; + I2C *m_i2c; int m_i2cAddress; size_t m_chipSize; size_t m_pageSize;