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
Polypheny Connector for Python

Polypheny Connector for Python This enables Python programs to access Polypheny databases, using an API that is compliant with the Python Database API

Polypheny 3 Jan 03, 2022
Python implementation of an automatic parallel parking system in a virtual environment, including path planning, path tracking, and parallel parking

Automatic Parallel Parking: Path Planning, Path Tracking & Control This repository contains a python implementation of an automatic parallel parking s

134 Jan 09, 2023
BestBuy Script Designed to purchase any item when it becomes available.

prerequisites: Selnium; undetected-chromedriver. This Script is designed to order an Item provided a link from BestBuy.com only.

Bransen Smith 0 Jan 12, 2022
This is a simple analogue clock made with turtle in python...

Analogue-Clock This is a simple analogue clock made with turtle in python... Requirements None, only you need to have windows 😉 ...Enjoy! Installatio

Abhyush 3 Jan 14, 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
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 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
My collection of mini-projects in various languages

Mini-Projects My collection of mini-projects in various languages About: This repository consists of a number of small projects. Most of these "mini-p

Siddhant Attavar 1 Jul 11, 2022
Wordle-solve - Attempting to solve wordle

Wordle Solver Run with python wordle_beater.py. This hardmode wordle solver take

Tom Lockwood 42 Oct 11, 2022
IEEE ITU bunyesinde komitelere verilen Python3 egitiminin dokumanlastirilmis versiyonlari bu repository altinda tutulmaktadir.

IEEE ITU Python Egitimi Nasil Faydalanmaliyim? Dersleri izledikten sonra dokumanlardaki kodlari yorum satirlari isaretlerini kaldirarak deneyebilirsin

İTÜ IEEE Student Branch 47 Sep 04, 2022
Kolibri: the offline app for universal education

Kolibri This repository is for software developers wishing to contribute to Kolibri. If you are looking for help installing, configuring and using Kol

Learning Equality 564 Jan 02, 2023
An implementation of an interpreter for the Brainfuck esoteric language in Python

Brainfuck Interpreter in Python An implementation of an interpreter for the Brainfuck esoteric language in Python. 🧠 The Brainfuck Language Created i

Carlos Santos 0 Feb 01, 2022
WinBoost: Boost your windows system.

Winboost runs a complete checkup of your entire system locating junk files, speed-reducing issues and causes of any system or application glitches or crashes. Through a lot of research and testing, w

Smit Parmar 4 Oct 01, 2021
JurjenLang, an interpreted programming language

JurjenLang An interpreted programming language Getting started Follow these three steps on your computer to get started git clone https://github.com/J

JVerbruggen 5 May 03, 2022
python's memory-saving dictionary data structure

ConstDict python代替的Dict数据结构 若字典不会增加字段,只读/原字段修改 使用ConstDict可节省内存 Dict()内存主要消耗的地方: 1、Dict扩容机制,预留内存空间 2、Dict也是一个对象,内部会动态维护__dict__,增加slot类属性可以节省内容 节省内存大小

Grenter 1 Nov 03, 2021
Slientruss3d : Python for stable truss analysis tool

slientruss3d : Python for stable truss analysis tool Desciption slientruss3d is a python package which can solve the resistances, internal forces and

3 Dec 26, 2022
Create standalone, installable R Shiny apps using Electron

WARNING This is still very much a work in progress and nothing can be assumed stable in any way Temp notes: Two types of created installer, based on w

Chase Clark 5 Dec 24, 2021
Compile Binary Ninja's HLIL IR to LLVM, for purposes of compiling it back to a binary again.

Compiles BinaryNinja's HLIL to LLVM Approach Sweep binary for global variables, create them Sweep binary for (used?) external functions, declare those

Kyle Martin 31 Nov 10, 2022
0xFalcon - 0xFalcon Tool For Python

0xFalcone Installation Install 0xFalcone Tool: apt install git git clone https:/

Alharb7 6 Sep 24, 2022
Superset custom path for python

It is a common requirement to have superset running under a base url, (https://mydomain.at/analytics/ instead of https://mydomain.at/). I created the

9 Dec 14, 2022