Package: micropython-eeprom
MicroPython EEPROMMicroPython driver for AT24Cxx EEPROMGeneralMicroPython driver for AT24Cxx EEPROM📚 The latest documentation is available atMicroPython EEPROM ReadTheDocs📚InstallationInstall required toolsSetupInstall package with upipGeneralSpecific versionTest versionManuallyUpload files to boardUsageContributingUnittestsCreditsInstallationInstall required toolsPython3 must be installed on your system. Check the current Python version
with the following commandpython--version
python3--versionDepending on which commandPython 3.x.y(with x.y as some numbers) is
returned, use that command to proceed.python3-mvenv.venvsource.venv/bin/activate

pipinstall-rrequirements.txtSetupInstall package with upipConnect the MicroPython device to a network (if possible)importnetworkstation=network.WLAN(network.STA_IF)station.active(True)station.connect('SSID','PASSWORD')station.isconnected()GeneralInstall the latest package version of this lib on the MicroPython deviceimportmipmip.install("github:brainelectronics/micropython-eeprom")For MicroPython versions below 1.19.1 use theupippackage instead ofmipimportupipupip.install('micropython-eeprom')Specific versionInstall a specific, fixed package version of this lib on the MicroPython deviceimportmip# install a verions of a specific branchmip.install("github:brainelectronics/micropython-eeprom",version="feature/initial-implementation")# install a tag versionmip.install("github:brainelectronics/micropython-eeprom",version="0.1.0")For MicroPython versions below 1.19.1 use theupippackage instead ofmipimportupipupip.install('micropython-eeprom')Test versionInstall a specific release candidate version uploaded toTest Python Package Indexon every PR on the
MicroPython device. If no specific version is set, the latest stable version
will be used.importmipmip.install("github:brainelectronics/micropython-eeprom",version="0.1.0-rc1.dev1")For MicroPython versions below 1.19.1 use theupippackage instead ofmipimportupip# overwrite index_urls to only take artifacts from test.pypi.orgupip.index_urls=['https://test.pypi.org/pypi']upip.install('micropython-eeprom')See alsobrainelectronics Test PyPi Server in Dockerfor a test PyPi server running on Docker.ManuallyUpload files to boardCopy the module to the MicroPython board and import them as shown below
usingRemote MicroPython shellOpen the remote shell with the following command. Additionally use-b 115200in case no CP210x is used but a CH34x.rshell--port/dev/tty.SLAB_USBtoUART--editornanoPerform the following command inside thershellto copy all files and
folders to the devicemkdir/pyboard/lib
mkdir/pyboard/lib/eeprom

cpeeprom/*/pyboard/lib/eeprom

cpexamples/main.py/pyboard
cpexamples/boot.py/pyboardUsagefromeepromimportEEPROMfrommachineimportI2C,PinI2C_ADDR=0x50# DEC 80, HEX 0x50EEPROM_SIZE=32# AT24C32 on 0x50# define custom I2C interface, default is 'I2C(0)'# check the docs of your device for further details and pin infosi2c=I2C(0,scl=Pin(13),sda=Pin(12),freq=800000)eeprom=EEPROM(addr=I2C_ADDR,at24x=EEPROM_SIZE,i2c=i2c)# write 'micropython' to address 10eeprom.write(10,'micropython')# read 11 bytes starting at address 10eeprom.read(10,11)# update content at address 10 with 'MicroPython'# only changed values are written, here 'm' -> 'M' and 'p' -> 'P'eeprom.write(10,'MicroPython')ContributingUnittestsRun the unittests locally with the following command after installing this
package in a virtual environment# run all testsnose2--configtests/unittest.cfg# run only one specific testsnose2tests.test_eeprom.TestEEPROM.test_addrGenerate the coverage files withpythoncreate_report_dirs.py
coveragehtmlThe coverage report is placed atreports/coverage/html/index.htmlCreditsBased onMike Causer's MicroPython TinyRTC I2C moduleand thePyPa sample project