grapple-m24c64

Crates.iograpple-m24c64
lib.rsgrapple-m24c64
version0.1.1
sourcesrc
created_at2023-11-19 04:43:23.567654
updated_at2023-11-19 04:47:27.719688
descriptionA Rust embedded-hal driver for the M24C64 I2C EEPROM
homepage
repositoryhttps://github.com/GrappleRobotics/m24c64
max_upload_size
id1040912
size6,992
Jaci Brunning (JaciBrunning)

documentation

https://docs.rs/grapple-m24c64

README

grapple-m24c64

crates.io Documentation

A Rust embedded-hal driver for the M24C64 I2C EEPROM, featuring arbitrary-length read/writes and timeout behaviour.

Add to your project

cargo add grapple-m24c64

Examples

use grapple_m24c64::M24C64;

let eeprom = M24C64::new(i2c, 0b000);
eeprom.write(0xA0, &[0x00, 0x01, 0x02, 0x03], &delay);

let mut my_buf = [0u8; 4];
eeprom.read(0xA0, &mut my_buf);
// my_buf = [0x00, 0x01, 0x02, 0x03]

Note the use of [embedded_hal::blocking::delay::DelayMs], which is used to retry the write every 1ms until it either succeeds, or 10ms has passed (2*t_w in the M24C64 datasheet).

Commit count: 6

cargo fmt