Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Writing a better class to Manage EEPROM Chip - Guidance/Advice Wanted

eeprom i2c class-design visualstudio

  • Please log in to reply
No replies to this topic

#1 gismo

gismo

    Advanced Member

  • Members
  • PipPipPip
  • 110 posts

Posted 30 June 2015 - 04:21 PM

Hey Everyone,

 

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 
    EEPROM.MyData1.Value
  • Similarly, updating or overwriting the value on the chip would be 
    EEPROM.MyData2.Update(newValue)
  • 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?
    EEPROM.MyData3.DisplayName
    
  • 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!

 

 







Also tagged with one or more of these keywords: eeprom, i2c, class-design, visualstudio

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.