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
Python library for parsing Godot scene files

Godot Parser This is a python library for parsing Godot scene (.tscn) and resource (.tres) files. It's intended to make it easier to automate certain

Steven Arcangeli 30 Jan 04, 2023
Is a polybar module that will show you your progress in Hack The Box

HTB-Status for Polybar Is a polybar module that will show you your progress in Hack The Box indicating your current rank, global rank, points and resp

bitc0de 8 Jan 14, 2022
A reference implementation for processing the content.log files found at opendata.dwd.de/weather

A reference implementation for processing the content.log files found at opendata.dwd.de/weather.

Deutscher Wetterdienst (DWD) 6 Nov 26, 2022
Telegram bot for Urban Dictionary.

Urban Dictionary Bot @TheUrbanDictBot A star ⭐ from you means a lot to us! Telegram bot for Urban Dictionary. Usage Deploy to Heroku Tap on above butt

Stark Bots 17 Nov 24, 2022
Buggy script to play with GPOs

GPOwned /!\ This is a buggy PoC I made just to play with GPOs in my lab. Don't use it in production! /!\ The script uses impacket and ldap3 to update

45 Dec 15, 2022
Track testrail productivity in automated reporting to multiple teams

django_web_app_for_testrail testrail is a test case management tool which helps any organization to track all consumption and testing of manual and au

Vignesh 2 Nov 21, 2021
An unofficial python API for trading on the DeGiro platform, with the ability to get real time data and historical data.

DegiroAPI An unofficial API for the trading platform Degiro written in Python with the ability to get real time data and historical data for products.

Jorrick Sleijster 5 Dec 16, 2022
ELF file deserializer and serializer library

elfo ELF file deserializer and serializer library. import elfo elf = elfo.ELF.from_path('main') elf ELF( header=ELFHeader( e_ident=e

Filipe Laíns 3 Aug 23, 2021
A library for pattern matching on symbolic expressions in Python.

MatchPy is a library for pattern matching on symbolic expressions in Python. Work in progress Installation MatchPy is available via PyPI, and

High-Performance and Automatic Computing 151 Dec 24, 2022
Just messing around with AI for fun coding 😂

Python-AI Projects 🤖 World Clock ⏰ ⚙︎ Steps to run world-clock.py file Download and open the file in your Python IDE. Run the file a type the name of

Danish Saleem 0 Feb 10, 2022
A tool for checking if the external data used in Flatpak manifests is still up to date

Flatpak External Data Checker This is a tool for checking for outdated or broken links of external data in Flatpak manifests. Motivation Flatpak apps

Flathub 76 Dec 24, 2022
🔵Open many google dorks in a fasted way

Dorkinho 🔵 The author is not responsible for misuse of the tool, use it in good practices like Pentest and CTF OSINT challenges. Dorkinho is a script

SidHawks 2 May 02, 2022
A dashboard for your code. A build system.

NOTICE: THIS REPO IS NO LONGER UPDATED Changes Changes is a build coordinator and reporting solution written in Python. The project is primarily built

Dropbox 763 Sep 09, 2022
Python library for creating and parsing HSReplay XML files

python-hsreplay A python module for HSReplay support. https://hearthsim.info/hsreplay/ Installation The library is available on PyPI. pip install hsre

HearthSim 45 Mar 28, 2022
Unofficial package for fetching users information based on National ID Number (Tanzania)

Nida Unofficial package for fetching users information based on National ID Number made by kalebu Installation You can install it directly or using pi

Jordan Kalebu 57 Dec 28, 2022
An event-based script that is designed to improve your aim

Aim-Trainer Info: This is an event-based script that is designed to improve a user's aim. It was built using Python Turtle and the Random library. Ins

Ethan Francolla 4 Feb 17, 2022
Some basic sorting algos

Sorting-Algos Some basic sorting algos HacktoberFest 2021 This repository consists of mezzo-level projects that undertake a simple task and perform it

Manthan Ghasadiya 7 Dec 13, 2022
An app to help people apply for admissions on schools/hostels

Admission-helper About An app to help people apply for admissions on schools/hostels This app is a rewrite of Admission-helper-beta-v5.8.9 and I impor

Advik 3 Apr 24, 2022
Daily knowledge pills to get better in Python.

Python daily pills Daily knowledge pills to get better Python code. Why Does your Python code suffers of any of this symptoms? Incorrect Indentation I

Jeferson Vaz dos Santos 35 Sep 19, 2022
Ingest openldap data into bloodhound

Bloodhound for Linux Ingest a dumped OpenLDAP ldif into neo4j to be visualized in Bloodhound. Usage: ./ldif_to_neo4j.py ./sample.ldif | cypher-shell -

Guillaume Quéré 71 Nov 09, 2022