Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Platform agnostic Rust driver for 24x series serial EEPROM devices using embedded-hal

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
NotificationsYou must be signed in to change notification settings

eldruin/eeprom24x-rs

Repository files navigation

crates.ioDocsMinimum Supported Rust VersionBuild StatusCoverage Status

This is a platform agnostic Rust driver for the 24x series serial EEPROM,based on theembedded-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().
  • ReadCSx-variant devices' factory-programmed unique serial. See:read_unique_serial().
  • Use the device in generic code via theEeprom24xTrait.

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 andprogrammable read only memory (EEPROM) organized as a number of words of 8 bitseach. The devices' cascadable feature allows up to 8 devices to share a common2-wire bus. The devices are optimized for use in many industrial and commercialapplications where low power and low voltage operation are essential.

DeviceMemory bits8-bit wordsPage sizeDatasheet
24x00128 bits16N/A24C00
24x011 Kbit1288 bytesAT24C01
M24x011 Kbit12816 bytesM24C01
24x022 Kbit2568 bytesAT24C02
M24x022 Kbit25616 bytesM24C02
24x044 Kbit51216 bytesAT24C04
24x088 Kbit1,02416 bytesAT24C08
24x1616 Kbit2,04816 bytesAT24C16
24x3232 Kbit4,09632 bytesAT24C32
24x6464 Kbit8,19232 bytesAT24C64
24x128128 Kbit16,38464 bytesAT24C128
24x256256 Kbit32,76864 bytesAT24C256
24x512512 Kbit65,536128 bytesAT24C512
24xM011 Mbit131,072256 bytesAT24CM01
24xM022 Mbit262,144256 bytesAT24CM02

Usage

To use this driver, import this crate and anembedded_hal implementation,then instantiate the appropriate device.In the following examples an instance of the device AT24C256 will be createdas 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

use eeprom24x::{Eeprom24x,SlaveAddr};use embedded_hal::blocking::delay::DelayMs;use linux_embedded_hal::{Delay,I2cdev};fnmain(){let dev =I2cdev::new("/dev/i2c-1").unwrap();let address =SlaveAddr::default();letmut eeprom =Eeprom24x::new_24x256(dev, address);let memory_address =0x1234;let data =0xAB;    eeprom.write_byte(memory_address, data).unwrap();Delay.delay_ms(5u16);let read_data = eeprom.read_byte(memory_address).unwrap();println!("Read memory address: {}, retrieved content: {}",        memory_address,&read_data);let _dev = eeprom.destroy();// Get the I2C device back}

Features

defmt-03

To enabledefmt (version0.3.x) support, when specifying the dependency oneeprom24x, add the feature "defmt-03".

[dependencies]eeprom24x = {version ="0.7.2",features = ["defmt-03"] }

Support

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

License

Licensed under either of

at your option.

Contributing

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

About

Platform agnostic Rust driver for 24x series serial EEPROM devices using embedded-hal

Topics

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

No packages published

Contributors6

Languages


[8]ページ先頭

©2009-2025 Movatter.jp