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

Dependents:   storage_test

Revision:
9:acc133240c9d
Parent:
8:0c122f839dc9
Child:
10:3824e507953c
--- a/I2CEeprom.h	Sat Mar 28 15:45:00 2020 +0000
+++ b/I2CEeprom.h	Sat Mar 28 16:11:37 2020 +0000
@@ -1,4 +1,9 @@
-/* Simple access class for I2C EEPROM chips like Microchip 24LC
+
+/*! \file */ 
+/*! \class I2CEeprom
+/* \ brief Simple access class for I2C EEPROM chips like Microchip 24LC
+ */
+ 
  * Copyright (c) 2015 Robin Hourahane
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -19,29 +24,36 @@
 
 #include <mbed.h>
 
-/// Class to provide simple access to I2C EEPROM chips like Microchip's 24LC range
-/// or AMTELS AT24C range.
-/// 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. 
+/// Based on the original library by Robin Hourahane.
+///
+/// Class to provide simple access to I2C EEPROM chips like Microchip's 24LC 
+/// or AMTELS AT24C series. Chips up to 64Kb in size are directly supported.
+/// 
+/// The library was tested on a Microchip 24LC128. 
+///
+/// The I2CEeprom 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
-/// another device on the bus access and so corrupt the write.
+/// This allows the cuurent write chunk to proceed without unlocking, which 
+/// prevents another device on the bus access and so aborting the write.
+/// 
 /// This allocation per write fits my usecase, where eeeprom variables
 /// are written in a special menu mode at start up, but it may be better to
 /// preallocate a buffer once at startup, if writes are occurring at arbitrary
-/// times during execution to prevent surprises with out of memory issues
+/// 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.
+/// The constructor takes the I2C bus by non-const reference argument. 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/write so reads 
+/// are atomic. Writes are split into separate atomic chunks that only write 
+/// one eeprom page. After a chunk is sent, the thread is sent to sleep for
+/// writeCycleTime_ms as in the constructor arg, and is then polled at 1 ms
+/// intervals to discover whether the write has completed.
+
 class I2CEeprom {
 public:
     /// Constructor to create a new instance of the class.