eldruin/eeprom24x-rs

Rust 24x EEPROM Driver

This driver allows you to:

Rust 24x EEPROM Driver

This is a platform agnostic Rust driver for the 24x series serial EEPROM, based on the embedded-hal traits.

This driver allows you to:

  • Read a single byte from a memory address. See: read_byte().
  • Read a byte array starting on a memory address. See: read_data().
  • Read the current memory address (please read notes). See: read_current_address().
  • Write a byte to a memory address. See: write_byte().
  • Write a byte array (up to a memory page) to a memory address. See: write_page().

Can be used at least with the devices listed below.

Introductory blog post

The devices

These devices provides a number of bits of serial electrically erasable and programmable read only memory (EEPROM) organized as a number of words of 8 bits each. The devices' cascadable feature allows up to 8 devices to share a common 2-wire bus. The devices are optimized for use in many industrial and commercial applications where low power and low voltage operation are essential.

Device Memory bits 8-bit words Page size Datasheet
24x00 128 bits 16 N/A 24C00
24x01 1 Kbit 128 8 bytes AT24C01
M24x01 1 Kbit 128 16 bytes M24C01
24x02 2 Kbit 256 8 bytes M24C02
M24x02 2 Kbit 256 16 bytes AT24C02
24x04 4 Kbit 512 16 bytes AT24C04
24x08 8 Kbit 1,024 16 bytes AT24C08
24x16 16 Kbit 2,048 16 bytes AT24C16
24x32 32 Kbit 4,096 32 bytes AT24C32
24x64 64 Kbit 8,192 32 bytes AT24C64
24x128 128 Kbit 16,384 64 bytes AT24C128
24x256 256 Kbit 32,768 64 bytes AT24C256
24x512 512 Kbit 65,536 128 bytes AT24C512
24xM01 1 Mbit 131,072 256 bytes AT24CM01
24xM02 2 Mbit 262,144 256 bytes AT24CM02

Usage

To use this driver, import this crate and an embedded_hal implementation, then instantiate the appropriate device. In the following examples an instance of the device AT24C256 will be created as an example. Other devices can be created with similar methods like: Eeprom24x::new_24x64(...).

Please find additional examples using hardware in this repository: driver-examples

Support

For questions, issues, feature requests, and other changes, please file an issue in the github project.

License

Licensed under either of

  • Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
  • MIT license (LICENSE-MIT or #404)

at your option.

Contributing

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Versions

Find the latest versions by id

v0.5.0 - Jan 20, 2022

Added

  • Add support for STM M24C01 and M24C02.
  • Implement embedded_storage::ReadStorage and embedded_storage::Storage traits.

Changed

  • [breaking-change] Increase MSRV to version 1.51.0.

v0.4.0 - Sep 04, 2021

Added

  • PartialEq implementation for SlaveAddr.

Changed

  • [breaking-change] Remove Default derive for Eeprom24x. Technically a breaking change but it should not affect anybody.

v0.3.0 - Jan 20, 2019

Changed

  • [breaking-change] The addresses are now passed as a single u32. User code should be easy to adapt: eeprom.read_byte([0x12, 0x34]) now becomes: eeprom.read_byte(0x1234).

Fixed

  • High memory addressing in devices using some device address bits for memory addressing: 24x04, 24x08, 24x16, 24xM01, 24xM02.
  • Protect against memory address rollover.
  • Protect against page address rollover.

v0.2.1 - Jan 20, 2019

Removed

  • [breaking-change] Removed support for devices that use some device address bits for memory addressing: 24x04, 24x08, 24x16, 24xM01, 24xM02 as the addressing was erroneous. Please upgrade to version 0.3.0 to use them.

v0.2.0 - Nov 23, 2018

Added

  • Add support for many more devices.

Changed

  • [breaking-change] The addresses are now passed to the methods per value for efficiency reasons. i.e. address: &[u8; 2] has now become address: [u8; 2] in all methods. User code should be easy to adapt: eeprom.read_byte(&[0x12, 0x34]) now becomes: eeprom.read_byte([0x12, 0x34]).

  • [breaking-change] Changed type of parameter of the Eeprom24x struct. Now it is a marker type for the page size instead of the device name.

v0.1.1 - Nov 23, 2018

Fixed

  • Disallow setting a different slave address through SlaveAddr::Default.

v0.1.0 - Nov 23, 2018

This is the initial release to crates.io of the feature-complete driver. There may be some API changes in the future, in case I decide that something can be further improved. All changes will be documented in this CHANGELOG.

Information - Updated Sep 10, 2022

Stars: 23
Forks: 8
Issues: 1

rust_embedded_starter

Boilerplate für Embedded Entwicklung mit Rust mit Flash und Debug automatik

rust_embedded_starter

Embedded rust HAL (hardware abstraction layer) for the STM32WL

This is a work in progress, it is unstable, incomplete, and (mostly) untested

Embedded rust HAL (hardware abstraction layer) for the STM32WL

Embedded Rust Template

This template is based on stm32f4xx-hal

Embedded Rust Template

A Rust embedded-hal HAL for all MCUs in the STM32 F7 family

This crate is largely inspired by the awesome work done here:

A Rust embedded-hal HAL for all MCUs in the STM32 F7 family

embedded-rust-H2AL

Hardware abstraction layer - abstraction layer

embedded-rust-H2AL

cargo-pio = Cargo + PlatformIO

Build Rust embedded projects with PlatformIO!

cargo-pio = Cargo + PlatformIO

Embedded rust HAL (hardware abstraction layer) for the STM32WL series

This is still in development, the code that exists today covers basic usage of:

Embedded rust HAL (hardware abstraction layer) for the STM32WL series

Microchip MCP4725 DAC Driver for Rust Embedded HAL

This is a driver crate for embedded Rust

Microchip MCP4725 DAC Driver for Rust Embedded HAL

Rust Embedded HAL for Apache NuttX RTOS

This crate provides Rust Embedded HAL interfaces (GPIO, I2C, SPI and Delay) for Apache NuttX RTOS

Rust Embedded HAL for Apache NuttX RTOS

Using Rust to turn on an LED on the NUCLEO-F446RE by pressing a button

This example is mainly copied from the great Rust Embedded Embedded Rust: From Zero to Blinky

Using Rust to turn on an LED on the NUCLEO-F446RE by pressing a button
Facebook Instagram Twitter GitHub Dribbble
Privacy