I've been racking my brain over writing a better class to manage an I2c EEProm chip. The chip works and all of the basic commands are working, but to really implement it in a way that's legible and useful has been tricky. I'm looking for an advice on how to compose a class that will make using the EEProm chip easier to work with.
A few inputs/requirements,
- there are several data-points that needs to be stored on the chip..for example 20+ values.
- Some are single bytes some are multiple bytes.
- For each data-point in the class, there needs to be an EEProm Address, DisplayName,NumberOfBytes, RamValue, a type/category/flag..or possibly any other information about the data-point
- We need to load most/all/or a filtered set of values into RAM when the device starts up..these are "device settings" this should be done with some type of loop as to not make 20 calls to get the value
- Access to the RAM values should be as simple as
- Similarly, updating or overwriting the value on the chip would be
- Since working with a display on the deivce, each data value would have a "DisplayName".. being able to loop through displayNames for purposes of showing them on a display would be useful. Some type of collection or array?
- Based on looping through the data-points, we need to keep track of what the "current" value is in case we want to read or update.
- Bonus features: If certain data-points can only contain certain values, can we impose those as choices?.. like "Yes/No" or "On/Off"
I'm trying to create something simple and scalable..Adding additional data-points should be simple.
I've looked at type-safe enum patterns and a few other enum related code to try to accomplish this, but I'm looking for a little more guidance here. Maybe an enum with arrays linked to them?
Any advice would be appreciated!