mFS file system library for EEPROM memory chips.
Diff: i2c_eeprom.h
- Revision:
- 5:a0fe74dce80d
- Parent:
- 0:cbf45dde2b49
- Child:
- 7:5ac5121bb4e0
--- a/i2c_eeprom.h Mon Feb 21 09:53:32 2011 +0000 +++ b/i2c_eeprom.h Mon Feb 21 18:26:27 2011 +0000 @@ -9,8 +9,12 @@ * * CHANGES : * -* VERSION DATE WHO DETAIL -* 0.1 2011-02-21 Olli Vanhoja Initial release version +* 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*/ @@ -19,14 +23,40 @@ 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: - i2c_eeprom(); - i2c_eeprom(int); - void write(char *, uint16, unsigned int n); // Write any length of bytes to external EEPROM - void read(uint16, uint16, char *); // Read any length of bytes from external EEPROM + /** 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