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
The Python Achievements Framework!

Pychievements: The Python Achievements Framework! Pychievements is a framework for creating and tracking achievements within a Python application. It

Brian 114 Jul 21, 2022
Análise do Aplicativo Prévias PSDB 2021

Análise do Aplicativo Prévias PSDB 2021 Com a recente polêmica sobre o aplicativo usado nas Prévias do PSDB de 2021, fiquei curioso para saber como er

Paulo Matias 18 Jul 31, 2022
Python library for converting Python calculations into rendered latex.

Covert art by Joshua Hoiberg handcalcs: Python calculations in Jupyter, as though you wrote them by hand. handcalcs is a library to render Python calc

Connor Ferster 5.1k Jan 07, 2023
A parser of Windows Defender's DetectionHistory forensic artifact, containing substantial info about quarantined files and executables.

A parser of Windows Defender's DetectionHistory forensic artifact, containing substantial info about quarantined files and executables.

Jordan Klepser 101 Oct 30, 2022
A program for calculating the divisor function

DivisorsFunctionCalculator A program for calculating the divisor function A script to find the "Sigma" (divisors function) of any number. To find the

1 Oct 31, 2021
The code submitted for the Analytics Vidhya Jobathon - February 2022

Introduction On February 11th, 2022, Analytics Vidhya conducted a 3-day hackathon in data science. The top candidates had the chance to be selected by

11 Nov 21, 2022
Construção de um jogo Dominó na linguagem python com base em algoritmos personalizados.

Domino (projecto-python) Construção de um jogo Dominó na linguaguem python com base em algoritmos personalizados e na: Monografia apresentada ao curso

Nuninha-GC 1 Jan 12, 2022
InverterApi - This project has been designed to take monitoring data from Voltronic, Axpert, Mppsolar PIP, Voltacon, Effekta

InverterApi - This project has been designed to take monitoring data from Voltronic, Axpert, Mppsolar PIP, Voltacon, Effekta

Josep Escobar 2 Sep 03, 2022
Telop - Encode and decode messages using an interpretation of the telegraphic code devised by José María Mathé

telop Telop (TELégrafoÓPtico) - Utilidad para codificar y descodificar mensajes de texto empleando una interpretación del código telegráfico ideado po

Ricardo F. 4 Nov 01, 2022
This Python3 script will monitor Upwork RSS feed and then email you the results.

Upwork RSS Parser This Python3 script will monitor Upwork RSS feed and then email you the results. Table of Contents General Info Technologies Used Fe

Chris 5 Nov 29, 2021
Auto check in via GitHub Actions

因为本人毕业离校,本项目交由在校的@hfut-xyc同学接手,请访问hfut-xyc/hfut_auto_check-in获得最新的脚本 本项目遵从GPLv2协定,Copyright (C) 2021, Fw[a]rd 免责声明 根据GPL协定,我、本项目的作者,不会对您使用这个脚本带来的任何后果

Fw[a]rd 3 Jun 27, 2021
Static bytecode simulator

SEA Static bytecode simulator for creating dependency/dependant based experimental bytecode format for CPython. Example a = random() if a = 5.0:

Batuhan Taskaya 23 Jun 10, 2022
A carrot-based color palette you didn't know you needed.

A package to produce a carrot-inspired color palette for python/matplotlib. Install: pip install carrotColors Update: pip install --upgrade carrotColo

10 Sep 28, 2021
Simple project to learn more about Bézier curves

Python Quadratic Bézier Simple project to learn more about Bézier curves. On this project i used some api's to graphics and gui pygame thorpy in theor

Kenned Ferreira 2 Mar 06, 2022
Show my read on kindle this year

Show my kindle status on GitHub

yihong 26 Jun 20, 2022
Repls goes to sleep due to inactivity, but to keep it awake, simply host a webserver and ping it.

Repls goes to sleep due to inactivity, but to keep it awake, simply host a webserver and ping it. This repo will help you make a webserver with a bit of console controls.

2 Mar 01, 2022
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
My solutions to Advent of Code 2021 (written in Python)

Advent of Code 2021 This repository contains my solutions for the 2021 edition of Advent of Code. Please do not expect perfectly polished solutions, m

Nils 2 May 29, 2022
A project to work with databases in 4 worksheets, insert, update, select, delete using Python and MySqI

A project to work with databases in 4 worksheets, insert, update, select, delete using Python and MySqI As a small project for school or college hope it is useful

Sina Org 1 Jan 11, 2022
Python-geoarrow - Storing geometry data in Apache Arrow format

geoarrow Storing geometry data in Apache Arrow format Installation $ pip install

Joris Van den Bossche 11 Mar 03, 2022