Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
i2c_eeprom.h
- Committer:
- HBP
- Date:
- 2011-02-21
- Revision:
- 5:a0fe74dce80d
- Parent:
- 0:cbf45dde2b49
- Child:
- 7:5ac5121bb4e0
File content as of revision 5:a0fe74dce80d:
/*H**************************************************************************** * FILENAME : i2c_eeprom.h * * * * DESCRIPTION : * * Simple library for external I2C EEEPROM. * * * * AUTHOR : Olli Vanhoja START DATE : 2011-02-17 * ******************************************************************************* * * CHANGES : * * VERSION DATE WHO DETAIL * 0.1 2011-02-21 Olli Vanhoja Initial release version * 0.2 2011-02-21 Olli Vanhoja *Added possibility change I2C speed * *Added external reset pin and autoreset * for read function. Thanks to Jon Ward. * *Documentational comments added. * *H*/ #ifndef I2C_EEPROM_H #define I2C_EEPROM_H typedef unsigned short int uint16; /** I2C EEPROM access class * * This class is used for communication with I2C EEPROM chip. */ class i2c_eeprom { private: int i_i2c_address; // I2C harware address public: /** Initialize communication * * @param hwAddr Harware address of the I2C EEPROM chip. * @param speed I2C bus speed. */ i2c_eeprom(int hwAddr, int speed); /** Write to I2C EEPROM * * Write any length of bytes to external EEPROM. * * @param *data Array of bytes. * @param iAddr Memory address. * @param n Write n bytes. */ void write(char *data, uint16 iAddr, unsigned int n); /** Read from I2C EEPROM * * Read any length of bytes from external EEPROM. * * @param iAddr Memory address. * @param n Read n bytes. * @param *out Returns array of bytes. */ void read(uint16 iAddr, uint16 n, char *out); }; #endif