Expand description
§CAT24C32 EEPROM Driver
Platform-agnostic Rust driver for the CAT24C32 EEPROM Serial 32-Kb I2C device
using the embedded-hal traits.
The CAT24C32 is an EEPROM Serial 32-Kb I2C device, internally organized as 4096 words of 8 bits each. It features a 32-byte page write buffer and supports the Standard (100 kHz), Fast (400 kHz) and Fast-Plus (1 MHz) I2C protocol.
§Features
- Platform-agnostic using embedded-hal traits
- Single byte and page write operations
- Single byte and sequential read operations
- Support for multiple devices on the same bus via address pins
- Compatible with embedded-storage traits for ecosystem integration
§Usage
use cat24c32_rs::{Cat24c32, SlaveAddr};
let mut eeprom = Cat24c32::new(dev, SlaveAddr::Default);
// Write a byte
let _ = eeprom.write_byte(0x00, 0x42);
// Read a byte
let value = eeprom.read_byte(0x00);
match value {
Ok(val) => println!("Read value: 0x{:02X}", val),
Err(_) => println!("Read error"),
}§Using with embedded-storage
The driver implements the embedded-storage traits for ecosystem compatibility:
use cat24c32_rs::{Cat24c32, SlaveAddr};
use embedded_storage::nor_flash::NorFlash;
let mut eeprom = Cat24c32::new(dev, SlaveAddr::Default);
// Using NorFlash trait (with automatic page write optimization)
let data = b"Hello, storage!";
let _ = NorFlash::write(&mut eeprom, 0x0000, data);Re-exports§
pub use embedded_storage;
Structs§
- Cat24c32
- CAT24C32 EEPROM driver