CircuitPython Driver for Adafruit 24LC32 I2C EEPROM Breakout 32Kbit / 4 KB

Overview

Introduction

Documentation Status Discord Build Status Code Style: Black

CircuitPython driver for Adafruit 24LC32 I2C EEPROM Breakout

Dependencies

This driver depends on:

Please ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloading the Adafruit library and driver bundle or individual libraries can be installed using circup.

Adafruit 24LC32 I2C EEPROM Breakout

Purchase one from the Adafruit shop

Installing from PyPI

On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally from PyPI. To install for current user:

pip3 install adafruit-circuitpython-24lc32

To install system-wide (this may be required in some cases):

sudo pip3 install adafruit-circuitpython-24lc32

To install in a virtual environment in your current project:

mkdir project-name && cd project-name
python3 -m venv .env
source .env/bin/activate
pip3 install adafruit-circuitpython-24lc32

Installing to a Connected CircuitPython Device with Circup

Make sure that you have circup installed in your Python environment. Install it with the following command if necessary:

pip3 install circup

With circup installed and your CircuitPython device connected use the following command to install:

circup install adafruit_24lc32

Or the following command to update an existing version:

circup update

Usage Example

import board
import adafruit_eeprom

i2c = board.I2C()
eeprom = adafruit_eeprom.EEPROM_I2C(i2c)

print("length: {}".format(len(eeprom)))

eeprom[0] = 4
print(eeprom[0])

while True:
    pass

Contributing

Contributions are welcome! Please read our Code of Conduct before contributing to help this project stay welcoming.

Documentation

For information on building library documentation, please check out this guide.

Comments
  • Scan does, driver doesn't find chip

    Scan does, driver doesn't find chip

    I have a custom build Adafruit CircuitPython 7.3.0-alpha.0-38-g862210b3f-dirty on 2022-03-13; Adafruit Trinket M0 with samd21e18 with 24lc32 frozen.

    I can find the chip via I2C scan at the address 0x50 but the driver doesn't find it there.

    import board
    import time
    import adafruit_24lc32
    import supervisor
    
    supervisor.disable_autoreload()
    
    i2c = board.I2C()
    
    #  scan I2C
    while not i2c.try_lock():
        pass
    try:
        while True:
            print(
                "I2C addresses found:",
                [hex(device_address) for device_address in i2c.scan()],
            )
            time.sleep(1)
    finally:  # unlock the i2c bus when ctrl-c'ing out of the loop
        i2c.unlock()
    
    #  setup for EEPROM
    eeprom = adafruit_24lc32.EEPROM_I2C(i2c_bus=i2c)
    
    

    I2C addresses found: ['0x50']

    
    Traceback (most recent call last):
      File "code.py", line 24, in <module>
      File "adafruit_24lc32.py", line 240, in __init__
    ValueError: No I2C device at address: 0x50
    
    
    opened by muranyia 15
  • Add function to change EEPROM size

    Add function to change EEPROM size

    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.

    opened by b-blake 4
  • Update ValueError raised when storing non-integer in index

    Update ValueError raised when storing non-integer in index

    This fixes the issue mentioned the equivalent issue mentioned here in the FRAM library:

    Also, updates example to use correct indexes as fixed with PR #1

    opened by tekktrik 4
  • import in code example in documentation is wrong

    import in code example in documentation is wrong

    In the online docs this part of the code doesn't work:

    import adafruit_eeprom
    
    i2c = board.I2C()
    eeprom = adafruit_eeprom.EEPROM_I2C(i2c)
    

    changing it like this makes it work:

    import adafruit_24lc32
    
    i2c = board.I2C()
    eeprom = adafruit_24lc32.EEPROM_I2C(i2c)
    

    (If documentation bugs are to be submitted elsewhere, please advise me. Thanks.)

    opened by muranyia 3
  • RTD build documentation not working

    RTD build documentation not working

    Not sure what's up, but the badge on the repo doesn't bring you to documentation but instead a 404 screen. Looking into it now, but wanted to file a general issue in case anyone gets to it first.

    opened by tekktrik 2
  • Feature request: extend the library to support 01/02/04/08/16 parts

    Feature request: extend the library to support 01/02/04/08/16 parts

    It would be great if this library could also support smaller eeprom chips.

    The main difference for those is in addressing, 04 parts borrow one bit from the slave address for the memory address (9 bits to address 500 bytes), 08 parts borrow 2 and 16 parts borrow three.

    image

    Following the slave address, only one byte is used for the rest of the address.

    image

    opened by fijam 1
  • Add typing and other tweaks

    Add typing and other tweaks

    1. Adds type annotations like other libraries are getting
    2. Changes a few instances of checking whether value is True OR False to isinstance() which is more Pythonic. Happy to revert if this was done for a specific reason
    3. Updates Sphinx formatting in docstrings so things are clearer, or will display properly based on the hardships I've had with Sphinx haha. Can't confirm they help (or that anything was actually wrong yet) since documentation isn't viewable yet.
    opened by tekktrik 1
  • update docstrings. comment writes in simpletest

    update docstrings. comment writes in simpletest

    resolves #5

    Updated all references to FRAM to EEPROM tested with get grep fram and git grep FRAM

    Also comment out the write statements in simpletest so users will not unknowingly wear their device with extra writes.

    opened by FoamyGuy 0
  • A lot of reference to FRAM in docstring but also code.

    A lot of reference to FRAM in docstring but also code.

    It seems that the cleaning from FRAM to EEPROM could continue a little bit: ´´´ if self.write_protected: raise RuntimeError("FRAM currently write protected.") ´´´

    But many other in the comment/doc.

    opened by dglaude 0
  • Stores wrong value for 9, 10, 13

    Stores wrong value for 9, 10, 13

    For some reason the library is converting the 9, 10, 13 to TAB, NEW_LINE, CARRAGE_RETURN and storing the "" character, 0x53, into the EEPROM.

    eeprom[0x10] = 9 print(eeprom[0x10]) eeprom[0x10:0x16] = [9, 10, 13, 3, 8, 1] print(eeprom[0x10:0x18])

    EEPROM Dump: 0x0010 | 0x5C 0x03 0x08 0x01 0xFF 0xFF 0xFF 0xFF

    The output shows: bytearray(b'\t') bytearray(b'\t\n\r\x03\x08\x01\xff\xff')

    How do I get an output "stuff=eeprom(0x10:0x18)" other than in a bytearray?

    Bruce

    opened by b-blake 4
  • Using this library for Adafruit ST25DV16K I2C RFID EEPROM Breakout

    Using this library for Adafruit ST25DV16K I2C RFID EEPROM Breakout

    I have been able to use a modified version of this library and demo code to read the EEPROM content of ST25DV16K.

    Maybe a more generalized version of EEPROM reading where the size and I2C address can be changed would be more usefull.

    So here are the change I made are : _MAX_SIZE_I2C = const(0x800) # 16kbits and def __init__(self, i2c_bus, address=0x53, write_protect=False, wp_pin=None):

    I have used the following code:

    import board
    import adafruit_st25dv16
    
    i2c = board.I2C()
    eeprom = adafruit_st25dv16.EEPROM_I2C(i2c)
    
    print("length: {}".format(len(eeprom)))
    
    for i in range(0, 4):
        j = i * 16
        hex_string = ":".join("%02x" % b for b in eeprom[j:j+15])
        print(j, "> ", hex_string, "> ", eeprom[j:j+15])
    

    The result is a dump:

    0 >  e1:40:40:05:03:10:d1:01:0c:55:01:73:74:2e:63:6f >  bytearray(b'\xe1@@\x05\x03\x10\xd1\x01\x0cU\x01st.co')
    16 >  6d:2f:73:74:32:35:fe:2f:70:72:6f:64:75:63:74:2f >  bytearray(b'm/st25\xfe/product/')
    32 >  34:37:30:31:fe:00:00:00:00:00:00:00:00:00:00:00 >  bytearray(b'4701\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
    48 >  00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 >  bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
    

    We can clearly see the URL written by ST arduino demo code: "st.com/st25" (Hello World exemple from https://github.com/stm32duino/ST25DV )

    And part of the URL maybe set by Adafruit in factory: "/product/4701"

    So with a bit of code that properly structure the NFC TAG value in the EEPROM it should be possible to use the ST25DV16K from CircuitPython for basic usage of setting the value of the tag.

    opened by dglaude 2
Releases(1.0.8)
Owner
Adafruit Industries
Adafruit Industries
A utility control surface for Ableton Live that makes the initialization of a Mixdown quick

Automate Mixdown initialization A script that transfers all the VSTs on your MIDI tracks to a new track so you can freeze your MIDI tracks and then co

Aarnav 0 Feb 23, 2022
python DroneCAN code generation, interface and utilities

UAVCAN v0 stack in Python Python implementation of the UAVCAN v0 protocol stack. UAVCAN is a lightweight protocol designed for reliable communication

DroneCAN 11 Dec 12, 2022
Table (Finnish Taulukko) glued together to transform into hands-free living.

taulukko Table (Finnish Taulukko) glued together to transform into hands-free living. Installation Preferred way to install is as usual (for testing o

Stefan Hagen 2 Dec 14, 2022
Scrapper For Paste.pics

PrntScScrapper Scrapper for Paste.pics If you are bored you can find some random screenshots from prnt.sc Features Saving screenshots Open in Browser

Fareusz 1 Dec 29, 2021
Get a list of the top-10 rejected libraries in your WhiteSource inventory

WhiteSource Top 10 Rejected Libraries Generate a spreadsheet listing the 10 most common libraries in your WhiteSource inventory that were rejected by

WhiteSource-PS-tools 10 Mar 23, 2022
Modelling and Implementation of Cable Driven Parallel Manipulator System with Tension Control

Cable Driven Parallel Robots (CDPR) is also known as Cable-Suspended Robots are the emerging and flexible end effector manipulation system. Cable-driven parallel robots (CDPRs) are categorized as a t

Siddharth U 0 Jul 19, 2022
Packages of Example Data for The Effect

causaldata This repository will contain R, Stata, and Python packages, all called causaldata, which contain data sets that can be used to implement th

103 Dec 24, 2022
API moment - LussovAPI

LussovAPI TL;DR: py API container, pip install -r requirements.txt, example, main configuration Long version: Install Dependancies Download file requi

William Pedersen 1 Nov 30, 2021
Aesthetic NFT Generator

A E S T H E T I C Dependencies Pillow numpy OpenCV You can use pip to install any missing dependencies. Basic Usage Vaporwave artwork can be generated

Mentor Elezi 4 Mar 13, 2022
This interactive script demonstrates the Menezes-Vanstone-EC-Cryptosystem

Menezes-Vanstone-EC-Cryptosystem This interactive script demonstrates the Meneze

Nishaant Goswamy 1 Jan 02, 2022
A bot to view Dilbert comics directly from Discord and get updates of the comics automatically.

A bot to view Dilbert comics directly from Discord and get updates of the comics automatically

Raghav Sharma 3 Nov 30, 2022
Tracking stock volatility.

SP500-highlow-tracking Track stock volatility. Being a useful indicator of the stock price volatility, High-Low gap represents the price range of the

Thong Huynh 13 Sep 07, 2022
Batch Python Program Verify

Batch Python Program Verify About As a TA(teaching assistant) of Programming Class, it is very annoying to test students' homework assignments one by

Han-Wei Li 7 Dec 20, 2022
SysCFG R/W Utility written in Swift

MagicCFG SysCFG R/W Utility written in Swift MagicCFG is one of our first, successful applications that we launched last year. The app makes it possib

Jan Fabel 82 Aug 08, 2022
FCurve-Cleaner: Tries to clean your dense mocap graphs like an animator would

Tries to clean your dense mocap graphs like an animator would! So it will produce a usable artist friendly result while maintaining the original graph.

wiSHFul97 5 Aug 17, 2022
API development made easy: a smart Python 3 API framework

appkernel - API development made easy What is Appkernel? A super-easy to use API framework, enabling API creation from zero to production within minut

156 Sep 28, 2022
Nfog - Scriptable Database-Driven NFO Generator for Movies and TV

nfog Scriptable Database-Driven NFO Generator for Movies and TV. Installation pi

6 Oct 08, 2022
Feature engineering library that helps you keep track of feature dependencies, documentation and schema

Feature engineering library that helps you keep track of feature dependencies, documentation and schema

28 May 31, 2022
🍬️🦇️ Open source Trick or Treat! 🦇️🍬️

Open Source Halloween! What's an easy way to have fun, and celebrate an open source Halloween? Open source trick or treating, of course! The repositor

Research Software Engineers 3 Oct 18, 2021
Video Stream is an Advanced Telegram Bot that's allow you to play Video & Music on Telegram Group Video Chat

Video Stream is an Advanced Telegram Bot that's allow you to play Video & Music on Telegram Group Video Chat 📊 Stats 🧪 Get SESSION_NAME from below:

dark phoenix 12 May 08, 2022