adafruit / Adafruit_CircuitPython_24LC32

CircuitPython Driver for Adafruit 24LC32 I2C EEPROM Breakout 32Kbit / 4 KB
MIT License
6 stars 6 forks source link

Add function to change EEPROM size #8

Closed b-blake closed 2 years ago

b-blake commented 2 years ago

Please add something like this to the library about Line 250.

`

Added by Bruce Blake

def EEPROM_size(self, size):

    self._max_size = size

    return(self._max_size)

` Why? Gives the user the opportunity to use this library with larger EEPROMS. Scanning the EEPROM to determine it's size is an option too.

FoamyGuy commented 2 years ago

We discussed this a bit during the weekly meeting recently. The preference right now is to match libraries to individual pieces of hardware where possible. So this library is intended to work specifically with the model: 24LC32 device which I believe has a single static size which is hardcoded into this library. This approach of matching individual libraries to specific pieces of hardware makes it easier to discover the library used for any given component.

We did find that there are other EEPROM devices with the same communication protocol though and this library can theoretically read/write them.

I don't think we want to provide variable size within this library but instead produce separate libraries for other devices that have different sized storage.

If you'd like to make a more generalized solution that does allow configuration of the max size in order to support a wider range of devices you could fork this library and generalize the naming, then share it in the CircuitPython Community Bundle if you want.

b-blake commented 2 years ago

Dear FoamyGuy, (Love the handle)

I completely understand. Your priorities are Business, Supportability, Features. Additional features that do not improve B or S are not high on the to-do list.

FYI - Your library works well with the AT24Cxxx series of EEPROM chips. AT24C32/64/128/256/512 all work, although only the first 4096 Bytes can be accessed. I have not tested the 24C16 or 24C08 chips because I don't have any.

The CircuitPython Community Bundle sounds like a good idea. Can you point me at the Requirements For and How To web page? That would be appreciated.

Bruce

FoamyGuy commented 2 years ago

@b-blake Here is a guide that covers the process of creating and sharing a library: https://learn.adafruit.com/creating-and-sharing-a-circuitpython-library/sharing-in-the-community-bundle I've linked directly to the page talking about adding a library to the community bundle. But there are some other pages in that guide that will be relevant as well. Though if you start with a copy of this library you won't be starting from "scratch" so you won't need to do everything on the "Creating a Library" page, instead you'll just begin with a copy of this library.

The requirements aren't explicitly stated in that guide, but it does cover all of the things that we do for our own libraries, so it could be considered best practice even if not 100% required for the community bundle.

If you give it a try and run into any trouble feel free to ping me here, I'm happy to help out when I can. Or join us on discord, there are plenty of folks on there who are able to help folks with less experience.

tekktrik commented 2 years ago

Closing since the decision was made to keep this library focused on the 24LC32.