### Get EEPROM page size Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/trait.Eeprom24xTrait.html Returns the page size of the EEPROM device. ```rust fn page_size(&self) -> usize; ``` -------------------------------- ### Get Page Size (128B) Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/struct.Eeprom24x.html Returns the page size of the 128-byte addressable EEPROM device. ```rust fn page_size(&self) -> usize ``` -------------------------------- ### Get Storage Capacity Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/struct.Storage.html Returns the total capacity of the storage peripheral in bytes. ```rust fn capacity(&self) -> usize> ``` -------------------------------- ### Write Page to EEPROM (128B) Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/struct.Eeprom24x.html Writes a page of data starting at a specified address in a 128-byte addressable EEPROM. Returns an error if the write fails. ```rust fn write_page( &mut self, address: u32, data: &[u8], ) -> Result<(), Error> ``` -------------------------------- ### Write a page of data to EEPROM Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/trait.Eeprom24xTrait.html Writes up to a full page of data starting at a given address. Exceeding the page size will result in an error. The EEPROM will be busy during the internal write cycle. ```rust fn write_page( &mut self, address: u32, data: &[u8], ) -> Result<(), Error>; ``` -------------------------------- ### Write Page to EEPROM Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/struct.Eeprom24x.html Write up to a page of data starting at a specific address. The EEPROM enters a write cycle after writing, during which it is unresponsive. Returns `Error::TooMuchData` if the data exceeds the page size or device capacity. ```rust pub fn write_page(&mut self, address: u32, data: &[u8]) -> Result<(), Error> ``` -------------------------------- ### Read multiple bytes into a buffer Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/trait.Eeprom24xTrait.html Reads data from a starting address to fill the provided data buffer. ```rust fn read_data( &mut self, address: u32, data: &mut [u8], ) -> Result<(), Error>; ``` -------------------------------- ### Read Data from EEPROM (128B) Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/struct.Eeprom24x.html Reads multiple bytes starting from a specified address into a provided data buffer for a 128-byte addressable EEPROM. Returns an error if the read fails. ```rust fn read_data( &mut self, address: u32, data: &mut [u8], ) -> Result<(), Error> ``` -------------------------------- ### Read Data from Storage Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/struct.Storage.html Reads a slice of data from the storage peripheral starting at a specified offset. Requires the I2C bus to be available and a DelayNs implementation. ```rust fn read(&mut self, offset: u32, bytes: &mut [u8]) -> Result<(), Self::Error> ``` -------------------------------- ### Implement Any for T Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/page_size/struct.B256.html Provides a method to get the TypeId of a type T. This is a blanket implementation for any type T that is 'static and ?Sized. ```rust impl Any for T where T: 'static + ?Sized, Source #### fn type_id(&self) -> TypeId Gets the `TypeId` of `self`. Read more ``` -------------------------------- ### ReadStorage Trait Implementation Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/struct.Storage.html Implements the `ReadStorage` trait for the Storage struct, providing methods to read data and get the storage capacity. ```APIDOC ### impl ReadStorage for Storage #### type Error = Error An enumeration of storage errors. #### fn read(&mut self, offset: u32, bytes: &mut [u8]) -> Result<(), Self::Error> Read a slice of data from the storage peripheral, starting the read operation at the given address offset, and reading `bytes.len()` bytes. #### fn capacity(&self) -> usize The capacity of the storage peripheral in bytes. ``` -------------------------------- ### Device Initialization Methods Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/struct.Eeprom24x.html Constructors for specific EEPROM device models. ```rust pub fn new_24x00(i2c: I2C, address: SlaveAddr) -> Self ``` ```rust pub fn new_24x01(i2c: I2C, address: SlaveAddr) -> Self ``` ```rust pub fn new_24x02(i2c: I2C, address: SlaveAddr) -> Self ``` ```rust pub fn new_24csx01(i2c: I2C, address: SlaveAddr) -> Self ``` ```rust pub fn new_24csx02(i2c: I2C, address: SlaveAddr) -> Self ``` ```rust pub fn new_24x02e48(i2c: I2C, address: SlaveAddr) -> Self ``` ```rust pub fn new_24x02e64(i2c: I2C, address: SlaveAddr) -> Self ``` ```rust pub fn new_24x04(i2c: I2C, address: SlaveAddr) -> Self ``` ```rust pub fn new_24x08(i2c: I2C, address: SlaveAddr) -> Self ``` ```rust pub fn new_24x16(i2c: I2C, address: SlaveAddr) -> Self ``` ```rust pub fn new_24csx04(i2c: I2C, address: SlaveAddr) -> Self ``` ```rust pub fn new_24csx08(i2c: I2C, address: SlaveAddr) -> Self ``` -------------------------------- ### Device Initialization Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/struct.Eeprom24x.html Methods to create new instances for specific 24x series EEPROM devices. ```APIDOC ## new_24xm01 ### Description Create a new instance of a 24xM01 device (e.g. AT24CM01). ### Parameters #### Request Body - **i2c** (I2C) - Required - The I2C bus instance. - **address** (SlaveAddr) - Required - The slave address of the device. ``` ```APIDOC ## new_24xm02 ### Description Create a new instance of a 24xM02 device (e.g. AT24CM02). ### Parameters #### Request Body - **i2c** (I2C) - Required - The I2C bus instance. - **address** (SlaveAddr) - Required - The slave address of the device. ``` -------------------------------- ### Using EEPROM24X with embedded-storage Traits Source: https://docs.rs/eeprom24x Demonstrates how to initialize and use the EEPROM24X driver with the `embedded-storage` traits. Requires `linux-embedded-hal` for I2C communication and delay. Note that EEPROM writes can take time, especially when writing across page boundaries. ```rust use linux_embedded_hal::{I2cdev, Delay}; use eeprom24x::{ Eeprom24x, SlaveAddr, Storage }; use embedded_storage::{ReadStorage, Storage as _}; let dev = I2cdev::new("/dev/i2c-1").unwrap(); let eeprom = Eeprom24x::new_24x256(dev, SlaveAddr::default()); let mut storage = Storage::new(eeprom, Delay {}); let _capacity = storage.capacity(); let address = 0x1234; let data = [0xAB; 256]; storage.write(address, &data); // EEPROM writes four pages. This introduces a delay of at least 20 ms, 5 ms per page. ``` -------------------------------- ### Eeprom24x Device Initialization Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/struct.Eeprom24x.html Constructor methods for initializing specific EEPROM device models. ```APIDOC ## Device Constructors ### Description Methods to create a new instance of the driver for specific hardware models. ### Methods - **new_24x00(i2c, address)**: Initialize 24C00 device. - **new_24x01(i2c, address)**: Initialize 24C01 device. - **new_24x02(i2c, address)**: Initialize 24C02 device. - **new_24x04(i2c, address)**: Initialize 24C04 device. - **new_24x08(i2c, address)**: Initialize 24C08 device. - **new_24x16(i2c, address)**: Initialize 24C16 device. - **new_24csx01(i2c, address)**: Initialize 24CS01 device. - **new_24csx02(i2c, address)**: Initialize 24CS02 device. - **new_24csx04(i2c, address)**: Initialize 24CS04 device. - **new_24csx08(i2c, address)**: Initialize 24CS08 device. ``` -------------------------------- ### Get Type ID of SlaveAddr Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/enum.SlaveAddr.html Retrieves the unique `TypeId` of the SlaveAddr type. This is part of the `Any` trait implementation. ```rust fn type_id(&self) -> TypeId ``` -------------------------------- ### Device Initialization Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/struct.Eeprom24x.html Functions to create new instances of various EEPROM 24xX devices. ```APIDOC ## Device Initialization Functions ### `new_24csx16` #### Description Create a new instance of a 24CSx16 device (e.g. AT24CS16). ### `new_24x025e48` #### Description Create a new instance of a 24x025E48 device (e.g. 24AA025E48). ### `new_24x025e64` #### Description Create a new instance of a 24x025E64 device (e.g. 24AA025E64). ### `new_m24x01` #### Description Create a new instance of a M24C01 device (e.g. M24C01). ### `new_m24x02` #### Description Create a new instance of a M24C02 device (e.g. M24C02). ### `new_24x32` #### Description Create a new instance of a 24x32 device (e.g. AT24C32). ### `new_24x64` #### Description Create a new instance of a 24x64 device (e.g. AT24C64). ### `new_24csx32` #### Description Create a new instance of a 24CSx32 device (e.g. AT24CS32). ### `new_24csx64` #### Description Create a new instance of a 24CSx64 device (e.g. AT24CS64). ### `new_24x128` #### Description Create a new instance of a 24x128 device (e.g. AT24C128). ### `new_24x256` #### Description Create a new instance of a 24x256 device (e.g. AT24C256). ### `new_24x512` #### Description Create a new instance of a 24x512 device (e.g. AT24C512). ### Parameters #### `i2c` - **Type**: `I2C` - **Description**: The I2C peripheral to use. #### `address` - **Type**: `SlaveAddr` - **Description**: The I2C slave address of the device. ``` -------------------------------- ### Create 24x64 EEPROM Instance Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/struct.Eeprom24x.html Instantiate a 24x64 EEPROM device. Requires an I2C peripheral and a slave address. ```rust pub fn new_24x64(i2c: I2C, address: SlaveAddr) -> Self ``` -------------------------------- ### Create 24CSx64 EEPROM Instance Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/struct.Eeprom24x.html Instantiate a 24CSx64 EEPROM device. Requires an I2C peripheral and a slave address. ```rust pub fn new_24csx64(i2c: I2C, address: SlaveAddr) -> Self ``` -------------------------------- ### Create New Storage Instance Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/struct.Storage.html Instantiates a new Storage object, requiring an Eeprom24x driver and a delay provider. ```rust pub fn new(eeprom: Eeprom24x, delay: D) -> Self> ``` -------------------------------- ### Create AT24CM02 Instance Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/struct.Eeprom24x.html Instantiates a new Eeprom24x device for AT24CM02. Requires an I2C peripheral and the device's slave address. ```rust pub fn new_24xm02(i2c: I2C, address: SlaveAddr) -> Self ``` -------------------------------- ### Create AT24CM01 Instance Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/struct.Eeprom24x.html Instantiates a new Eeprom24x device for AT24CM01. Requires an I2C peripheral and the device's slave address. ```rust pub fn new_24xm01(i2c: I2C, address: SlaveAddr) -> Self ``` -------------------------------- ### Create 24x32 EEPROM Instance Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/struct.Eeprom24x.html Instantiate a 24x32 EEPROM device. Requires an I2C peripheral and a slave address. ```rust pub fn new_24x32(i2c: I2C, address: SlaveAddr) -> Self ``` -------------------------------- ### Create 24x025E64 EEPROM Instance Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/struct.Eeprom24x.html Instantiate a 24x025E64 EEPROM device. Requires an I2C peripheral and a slave address. ```rust pub fn new_24x025e64(i2c: I2C, address: SlaveAddr) -> Self ``` -------------------------------- ### Create 24CSx32 EEPROM Instance Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/struct.Eeprom24x.html Instantiate a 24CSx32 EEPROM device. Requires an I2C peripheral and a slave address. ```rust pub fn new_24csx32(i2c: I2C, address: SlaveAddr) -> Self ``` -------------------------------- ### Create 24CSx16 EEPROM Instance Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/struct.Eeprom24x.html Instantiate a 24CSx16 EEPROM device. Requires an I2C peripheral and a slave address. ```rust pub fn new_24csx16(i2c: I2C, address: SlaveAddr) -> Self ``` -------------------------------- ### Create 24x512 EEPROM Instance Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/struct.Eeprom24x.html Instantiate a 24x512 EEPROM device. Requires an I2C peripheral and a slave address. ```rust pub fn new_24x512(i2c: I2C, address: SlaveAddr) -> Self ``` -------------------------------- ### Create M24x01 EEPROM Instance Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/struct.Eeprom24x.html Instantiate an M24C01 EEPROM device. Requires an I2C peripheral and a slave address. ```rust pub fn new_m24x01(i2c: I2C, address: SlaveAddr) -> Self ``` -------------------------------- ### Create 24x128 EEPROM Instance Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/struct.Eeprom24x.html Instantiate a 24x128 EEPROM device. Requires an I2C peripheral and a slave address. ```rust pub fn new_24x128(i2c: I2C, address: SlaveAddr) -> Self ``` -------------------------------- ### Create 24x256 EEPROM Instance Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/struct.Eeprom24x.html Instantiate a 24x256 EEPROM device. Requires an I2C peripheral and a slave address. ```rust pub fn new_24x256(i2c: I2C, address: SlaveAddr) -> Self ``` -------------------------------- ### Create 24x025E48 EEPROM Instance Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/struct.Eeprom24x.html Instantiate a 24x025E48 EEPROM device. Requires an I2C peripheral and a slave address. ```rust pub fn new_24x025e48(i2c: I2C, address: SlaveAddr) -> Self ``` -------------------------------- ### Create M24x02 EEPROM Instance Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/struct.Eeprom24x.html Instantiate an M24C02 EEPROM device. Requires an I2C peripheral and a slave address. ```rust pub fn new_m24x02(i2c: I2C, address: SlaveAddr) -> Self ``` -------------------------------- ### TryInto Implementation Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/struct.Eeprom24x.html Details the `try_into` function for performing conversions. ```APIDOC ## impl TryInto for T ### Description Provides the `try_into` method for types that implement `TryFrom`. ### Type Parameters - **T**: The source type. - **U**: The target type, which must implement `TryFrom`. ### Associated Types #### type Error = >::Error ### Description The type returned in the event of a conversion error. ### Methods #### fn try_into(self) -> Result>::Error> ### Description Performs the conversion from type `T` to type `U`. ### Parameters #### Path Parameters - **self** (T) - Required - The value to convert. ### Response #### Success Response (Result) - **U** (type) - The successfully converted value. - **E** (type) - The error type if conversion fails. ### Source `### impl TryInto for T where U: TryFrom, Source§ #### type Error = >::Error The type returned in the event of a conversion error. Source§ #### fn try_into(self) -> Result>::Error> Performs the conversion. Source§` ``` -------------------------------- ### Instantiate with default address Source: https://docs.rs/eeprom24x Create a new EEPROM device instance using the default I2C slave address. ```rust use linux_embedded_hal::I2cdev; use eeprom24x::{ Eeprom24x, SlaveAddr }; let dev = I2cdev::new("/dev/i2c-1").unwrap(); let address = SlaveAddr::default(); // using the AT24C256 let mut eeprom = Eeprom24x::new_24x256(dev, address); ``` -------------------------------- ### Write a page Source: https://docs.rs/eeprom24x Write a buffer of data to the EEPROM. Ensure the data size does not exceed the device's page size. ```rust use linux_embedded_hal::I2cdev; use eeprom24x::{ Eeprom24x, SlaveAddr }; let dev = I2cdev::new("/dev/i2c-1").unwrap(); let mut eeprom = Eeprom24x::new_24x256(dev, SlaveAddr::default()); let address = 0x1234; let data = [0xAB; 64]; eeprom.write_page(address, &data); // EEPROM enters internally-timed write cycle. Will not respond for some time. ``` -------------------------------- ### TryFrom Implementation Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/struct.Eeprom24x.html Details the `try_from` function for performing conversions. ```APIDOC ## fn try_from(value: U) -> Result>::Error> ### Description Performs the conversion from type `U` to type `T`. ### Parameters #### Path Parameters - **value** (U) - Required - The value to convert from. ### Response #### Success Response (Result) - **T** (type) - The successfully converted value. - **E** (type) - The error type if conversion fails. ### Source `#### fn try_from(value: U) -> Result>::Error>` ``` -------------------------------- ### Eeprom24x Core Operations Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/struct.Eeprom24x.html Common methods for interacting with an initialized EEPROM driver instance. ```APIDOC ## write_byte ### Description Writes a single byte to the specified address. The device enters an internally-timed write cycle after this operation. ### Parameters - **address** (u32) - Required - The memory address to write to. - **data** (u8) - Required - The byte to write. ## read_byte ### Description Reads a single byte from the specified address. ### Parameters - **address** (u32) - Required - The memory address to read from. ## read_data ### Description Reads multiple bytes starting from the specified address into a provided buffer. ### Parameters - **address** (u32) - Required - The starting memory address. - **data** (&mut [u8]) - Required - The buffer to fill with read data. ## write_page ### Description Writes a page of data starting at the specified address. The amount of data must not exceed the device's page size. ### Parameters - **address** (u32) - Required - The starting memory address. - **data** (&[u8]) - Required - The data slice to write. ``` -------------------------------- ### EEPROM Driver Methods Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/struct.Eeprom24x.html Common methods for reading and writing data to the EEPROM. ```rust pub fn destroy(self) -> I2C ``` ```rust pub fn write_byte(&mut self, address: u32, data: u8) -> Result<(), Error> ``` ```rust pub fn read_byte(&mut self, address: u32) -> Result> ``` ```rust pub fn read_data( &mut self, address: u32, data: &mut [u8], ) -> Result<(), Error> ``` ```rust pub fn read_current_address(&mut self) -> Result> ``` ```rust pub fn write_page(&mut self, address: u32, data: &[u8]) -> Result<(), Error> ``` -------------------------------- ### Instantiate with alternative address Source: https://docs.rs/eeprom24x Configure a custom I2C slave address using the Alternative variant. ```rust use linux_embedded_hal::I2cdev; use eeprom24x::{ Eeprom24x, SlaveAddr }; let dev = I2cdev::new("/dev/i2c-1").unwrap(); let (a2, a1, a0) = (false, false, true); let address = SlaveAddr::Alternative(a2, a1, a0); let mut eeprom = Eeprom24x::new_24x256(dev, address); ``` -------------------------------- ### Implementations of Eeprom24xTrait Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/trait.Eeprom24xTrait.html Details the implementations of the Eeprom24xTrait for various EEPROM configurations, specifying the associated error type. ```APIDOC ### impl Eeprom24xTrait for Eeprom24x where I2C: I2c, AS: MultiSizeAddr, #### type Error = E ### impl Eeprom24xTrait for Eeprom24x where I2C: I2c, AS: MultiSizeAddr, #### type Error = E ### impl Eeprom24xTrait for Eeprom24x where I2C: I2c, AS: MultiSizeAddr, #### type Error = E ### impl Eeprom24xTrait for Eeprom24x where I2C: I2c, AS: MultiSizeAddr, #### type Error = E ### impl Eeprom24xTrait for Eeprom24x where I2C: I2c, AS: MultiSizeAddr, #### type Error = E ### impl Eeprom24xTrait for Eeprom24x where I2C: I2c, AS: MultiSizeAddr, #### type Error = E ``` -------------------------------- ### No Struct Documentation Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/page_size/struct.No.html Details about the 'No' struct, which indicates no page write support, typically for devices like AT24x00. ```APIDOC ## Struct No ### Description No page write supported. e.g. for AT24x00 ### Source ```rust pub struct No(/* private fields */); ``` ### Trait Implementations #### Debug for No ```rust impl Debug for No ``` #### Freeze for No ```rust impl Freeze for No ``` #### RefUnwindSafe for No ```rust impl RefUnwindSafe for No ``` #### Send for No ```rust impl Send for No ``` #### Sync for No ```rust impl Sync for No ``` #### Unpin for No ```rust impl Unpin for No ``` #### UnwindSafe for No ```rust impl UnwindSafe for No ``` ### Blanket Implementations #### Any for T ```rust impl Any for T where T: 'static + ?Sized ``` #### Borrow for T ```rust impl Borrow for T where T: ?Sized ``` #### BorrowMut for T ```rust impl BorrowMut for T where T: ?Sized ``` #### From for T ```rust impl From for T ``` #### Into for T ```rust impl Into for T where U: From ``` #### TryFrom for T ```rust impl TryFrom for T where U: Into ``` #### TryInto for T ```rust impl TryInto for T where U: TryFrom ``` ``` -------------------------------- ### Enable defmt support Source: https://docs.rs/eeprom24x Add the defmt-03 feature to your Cargo.toml dependencies to enable logging support. ```toml [dependencies] eeprom24x = { version = "0.7.2", features = ["defmt-03"] } ``` -------------------------------- ### B32 Trait Implementations Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/page_size/struct.B32.html Details on the various traits implemented for the B32 struct. ```APIDOC ## Trait Implementations ### impl Debug for B32 #### fn fmt(&self, f: &mut Formatter<'_>) -> Result Formats the value using the given formatter. Read more ### impl Freeze for B32 ### impl RefUnwindSafe for B32 ### impl Send for B32 ### impl Sync for B32 ### impl Unpin for B32 ### impl UnwindSafe for B32 ### impl Any for T where T: 'static + ?Sized, #### fn type_id(&self) -> TypeId Gets the `TypeId` of `self`. Read more ### impl Borrow for T where T: ?Sized, #### fn borrow(&self) -> &T Immutably borrows from an owned value. Read more ### impl BorrowMut for T where T: ?Sized, #### fn borrow_mut(&mut self) -> &mut T Mutably borrows from an owned value. Read more ### impl From for T #### fn from(t: T) -> T Returns the argument unchanged. ### impl Into for T where U: From, #### fn into(self) -> U Calls `U::from(self)`. That is, this conversion is whatever the implementation of `From for U` chooses to do. ### impl TryFrom for T where U: Into, #### type Error = Infallible The type returned in the event of a conversion error. #### fn try_from(value: U) -> Result>::Error> Performs the conversion. ### impl TryInto for T where U: TryFrom, #### type Error = >::Error The type returned in the event of a conversion error. #### fn try_into(self) -> Result>::Error> Performs the conversion. ``` -------------------------------- ### B32 Struct Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/page_size/struct.B32.html Represents 32-byte pages, suitable for EEPROMs like AT24x32 and AT24x64. ```APIDOC ## Struct B32 ### Description 32-byte pages. e.g. for AT24x32, AT24x64 ### Source ```rust pub struct B32(/* private fields */); ``` ``` -------------------------------- ### B16 Struct Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/page_size/struct.B16.html Represents 16-byte pages, suitable for EEPROMs like AT24x04 and AT24x08. ```APIDOC ## Struct B16 ### Description 16-byte pages. e.g. for AT24x04, AT24x08, AT24x16 ### Source ```rust pub struct B16(/* private fields */); ``` ``` -------------------------------- ### No Struct Documentation Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/unique_serial/struct.No.html Documentation for the `No` struct, which represents the absence of a factory-supplied unique serial number. ```APIDOC ## Struct No ### Description No factory-supplied unique serial number. ### Source ```rust pub struct No(/* private fields */); ``` ### Trait Implementations #### Debug for No ##### fn fmt(&self, f: &mut Formatter<'_>) -> Result Formats the value using the given formatter. #### Auto Trait Implementations - Freeze - RefUnwindSafe - Send - Sync - Unpin - UnwindSafe #### Blanket Implementations - **Any for T** - fn type_id(&self) -> TypeId - **Borrow for T** - fn borrow(&self) -> &T - **BorrowMut for T** - fn borrow_mut(&mut self) -> &mut T - **From for T** - fn from(t: T) -> T - **Into for T** - fn into(self) -> U - **TryFrom for T** - type Error = Infallible - fn try_from(value: U) -> Result>::Error> - **TryInto for T** - type Error = >::Error - fn try_into(self) -> Result>::Error> ``` -------------------------------- ### Write Data to Storage Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/struct.Storage.html Writes a slice of data to the storage peripheral at a specified offset. This operation requires the Eeprom24x driver to implement PageWrite and a DelayNs implementation for handling page boundary writes. ```rust fn write(&mut self, offset: u32, bytes: &[u8]) -> Result<(), Self::Error> ``` -------------------------------- ### Write and read a byte Source: https://docs.rs/eeprom24x Perform a single byte write and read operation. Note that the device will be busy during the internally-timed write cycle. ```rust use linux_embedded_hal::I2cdev; use eeprom24x::{ Eeprom24x, SlaveAddr }; let dev = I2cdev::new("/dev/i2c-1").unwrap(); let mut eeprom = Eeprom24x::new_24x256(dev, SlaveAddr::default()); let address = 0x1234; let data = 0xAB; eeprom.write_byte(address, data); // EEPROM enters internally-timed write cycle. Will not respond for some time. let retrieved_data = eeprom.read_byte(address); ``` -------------------------------- ### Clone SlaveAddr to Uninit (Nightly) Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/enum.SlaveAddr.html Performs copy-assignment from a SlaveAddr value to an uninitialized memory location. This is a nightly-only experimental API. ```rust unsafe fn clone_to_uninit(&self, dest: *mut u8) ``` -------------------------------- ### Eeprom24xTrait Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/trait.Eeprom24xTrait.html The Eeprom24xTrait defines the interface for EEPROM devices, enabling generic programming for different EEPROM sizes and configurations. ```APIDOC ## Trait Eeprom24xTrait ### Description `Eeprom24x` type trait for use in generic code. ### Associated Types #### type Error Inner implementation error. ### Methods #### fn write_byte( &mut self, address: u32, data: u8, ) -> Result<(), Error> Write a single byte in an address. After writing a byte, the EEPROM enters an internally-timed write cycle to the nonvolatile memory. During this time all inputs are disabled and the EEPROM will not respond until the write is complete. #### fn read_byte(&mut self, address: u32) -> Result> Read a single byte from an address. #### fn read_data( &mut self, address: u32, data: &mut [u8], ) -> Result<(), Error> Read starting in an address as many bytes as necessary to fill the data array provided. #### fn read_current_address(&mut self) -> Result> Read the contents of the last address accessed during the last read or write operation, _incremented by one_. Note: This may not be available on your platform. #### fn write_page( &mut self, address: u32, data: &[u8], ) -> Result<(), Error> Write up to a page starting in an address. The maximum amount of data that can be written depends on the page size of the device and its overall capacity. If too much data is passed, the error `Error::TooMuchData` will be returned. After writing a byte, the EEPROM enters an internally-timed write cycle to the nonvolatile memory. During this time all inputs are disabled and the EEPROM will not respond until the write is complete. #### fn page_size(&self) -> usize Return device page size. ``` -------------------------------- ### Implement TryInto for T Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/page_size/struct.B256.html Provides a method to attempt a conversion from type T into type U, where U implements TryFrom. The conversion can fail, returning the error type defined by U's TryFrom implementation. ```rust impl TryInto for T where U: TryFrom, Source #### type Error = >::Error The type returned in the event of a conversion error. Source #### fn try_into(self) -> Result>::Error> Performs the conversion. ``` -------------------------------- ### Struct B256 Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/page_size/struct.B256.html Represents a 256-byte page configuration for EEPROM devices. ```APIDOC ## Struct B256 ### Description Represents 256-byte pages, used for devices such as the AT24xM01 and AT24xM02. ### Definition ```rust pub struct B256(/* private fields */); ``` ``` -------------------------------- ### Eeprom24x Struct Definition Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/struct.Eeprom24x.html The primary driver structure for EEPROM devices. ```rust pub struct Eeprom24x { /* private fields */ } ``` -------------------------------- ### Debug Implementation for B16 Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/page_size/struct.B16.html Provides a way to format the B16 struct for debugging purposes. ```APIDOC ## Trait Implementations ### impl Debug for B16 #### fn fmt(&self, f: &mut Formatter<'_>) -> Result Formats the value using the given formatter. Read more ``` -------------------------------- ### Eeprom24x Operations Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/struct.Eeprom24x.html Core methods for reading and writing data to the EEPROM device. ```APIDOC ## write_page ### Description Write up to a page starting in an address. ### Parameters #### Path Parameters - **address** (u32) - Required - The starting address for the write operation. - **data** (&[u8]) - Required - The data buffer to write. ### Response #### Success Response (200) - **Result<(), Error>** - Returns Ok if successful, or an Error. ## write_byte ### Description Write a single byte in an address. ### Parameters #### Path Parameters - **address** (u32) - Required - The address to write to. - **data** (u8) - Required - The byte to write. ### Response #### Success Response (200) - **Result<(), Error>** - Returns Ok if successful, or an Error. ## read_byte ### Description Read a single byte from an address. ### Parameters #### Path Parameters - **address** (u32) - Required - The address to read from. ### Response #### Success Response (200) - **Result>** - Returns the byte read or an Error. ## read_data ### Description Read starting in an address as many bytes as necessary to fill the data array provided. ### Parameters #### Path Parameters - **address** (u32) - Required - The starting address to read from. - **data** (&mut [u8]) - Required - The buffer to fill with read data. ### Response #### Success Response (200) - **Result<(), Error>** - Returns Ok if successful, or an Error. ## read_current_address ### Description Read the contents of the last address accessed during the last read or write operation, incremented by one. ### Response #### Success Response (200) - **Result>** - Returns the byte read or an Error. ## page_size ### Description Return device page size. ### Response #### Success Response (200) - **usize** - The page size of the device. ``` -------------------------------- ### B128 Struct Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/page_size/struct.B128.html Represents 128-byte pages, suitable for devices like AT24x512. ```APIDOC ## Struct B128 ### Description 128-byte pages. e.g. for AT24x512 ### Source ```rust pub struct B128(/* private fields */); ``` ``` -------------------------------- ### B64 Struct Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/page_size/struct.B64.html Represents 64-byte pages, commonly used with EEPROM devices such as AT24x128 and AT24x256. ```APIDOC ## Struct B64 ### Description 64-byte pages. e.g. for AT24x128, AT24x256 ### Source ```rust pub struct B64(/* private fields */); ``` ``` -------------------------------- ### Blanket Implementations for B16 Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/page_size/struct.B16.html Details blanket trait implementations applicable to the B16 struct, such as Any, Borrow, From, Into, TryFrom, and TryInto. ```APIDOC ## Blanket Implementations ### impl Any for T #### fn type_id(&self) -> TypeId Gets the `TypeId` of `self`. Read more ### impl Borrow for T #### fn borrow(&self) -> &T Immutably borrows from an owned value. Read more ### impl BorrowMut for T #### fn borrow_mut(&mut self) -> &mut T Mutably borrows from an owned value. Read more ### impl From for T #### fn from(t: T) -> T Returns the argument unchanged. ### impl Into for T #### fn into(self) -> U Calls `U::from(self)`. That is, this conversion is whatever the implementation of `From for U` chooses to do. ### impl TryFrom for T #### type Error = Infallible The type returned in the event of a conversion error. #### fn try_from(value: U) -> Result>::Error> Performs the conversion. ### impl TryInto for T #### type Error = >::Error The type returned in the event of a conversion error. #### fn try_into(self) -> Result>::Error> Performs the conversion. ``` -------------------------------- ### Auto Trait Implementations for B64 Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/page_size/struct.B64.html Lists the automatic trait implementations for the B64 struct, indicating thread safety and memory management characteristics. ```APIDOC ## Auto Trait Implementations ### impl Freeze for B64 ### impl RefUnwindSafe for B64 ### impl Send for B64 ### impl Sync for B64 ### impl Unpin for B64 ### impl UnwindSafe for B64 ``` -------------------------------- ### Auto Trait Implementations for B16 Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/page_size/struct.B16.html Lists the automatic trait implementations for the B16 struct, including Send, Sync, Unpin, etc. ```APIDOC ## Auto Trait Implementations ### impl Freeze for B16 ### impl RefUnwindSafe for B16 ### impl Send for B16 ### impl Sync for B16 ### impl Unpin for B16 ### impl UnwindSafe for B16 ``` -------------------------------- ### Define Eeprom24xTrait Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/trait.Eeprom24xTrait.html This trait defines the interface for EEPROM devices. Implementors must provide methods for byte and page read/write operations, and report their page size. ```rust pub trait Eeprom24xTrait: Sealed { type Error; // Required methods fn write_byte( &mut self, address: u32, data: u8, ) -> Result<(), Error>; fn read_byte(&mut self, address: u32) -> Result>; fn read_data( &mut self, address: u32, data: &mut [u8], ) -> Result<(), Error>; fn read_current_address(&mut self) -> Result>; fn write_page( &mut self, address: u32, data: &[u8], ) -> Result<(), Error>; fn page_size(&self) -> usize; } ``` -------------------------------- ### Write Byte to EEPROM (128B) Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/struct.Eeprom24x.html Writes a single byte to a specified address in a 128-byte addressable EEPROM. Returns an error if the write fails. ```rust fn write_byte( &mut self, address: u32, data: u8, ) -> Result<(), Error> ``` -------------------------------- ### EEPROM Data Operations Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/struct.Eeprom24x.html Core methods for reading and writing data to the EEPROM memory. ```APIDOC ## write_page ### Description Write up to a page starting at a specific address. If too much data is passed, the error `Error::TooMuchData` will be returned. ### Parameters #### Request Body - **address** (u32) - Required - The starting memory address. - **data** (&[u8]) - Required - The data buffer to write. ### Response #### Success Response (200) - **Result** (()) - Returns empty result on success or Error. ``` ```APIDOC ## read_byte ### Description Read a single byte from a specific address. ### Parameters #### Request Body - **address** (u32) - Required - The memory address to read from. ### Response #### Success Response (200) - **byte** (u8) - The byte read from the address. ``` ```APIDOC ## read_unique_serial ### Description Read the 128-bit unique serial number from factory-programmed devices. ### Response #### Success Response (200) - **serial** ([u8; 16]) - The 128-bit unique serial number. ``` -------------------------------- ### Debug Implementation for Storage Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/struct.Storage.html Provides a Debug implementation for the Storage struct, allowing it to be formatted for debugging purposes. ```rust fn fmt(&self, f: &mut Formatter<'_>) -> Result> ``` -------------------------------- ### Blanket Implementations Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/enum.Error.html Blanket implementations for generic traits. ```APIDOC ## Blanket Implementations ### impl Any for T where T: 'static + ?Sized #### fn type_id(&self) -> TypeId Gets the `TypeId` of `self`. ### impl Borrow for T where T: ?Sized #### fn borrow(&self) -> &T Immutably borrows from an owned value. ### impl BorrowMut for T where T: ?Sized #### fn borrow_mut(&mut self) -> &mut T Mutably borrows from an owned value. ### impl From for T #### fn from(t: T) -> T Returns the argument unchanged. ### impl Into for T where U: From #### fn into(self) -> U Calls `U::from(self)`. ### impl TryFrom for T where U: Into #### type Error = Infallible #### fn try_from(value: U) -> Result>::Error> Performs the conversion. ### impl TryInto for T where U: TryFrom #### type Error = >::Error #### fn try_into(self) -> Result>::Error> Performs the conversion. ``` -------------------------------- ### Implement Sync for TwoBytes Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/addr_size/struct.TwoBytes.html Indicates that the TwoBytes struct can be shared between threads. ```rust impl Sync for TwoBytes ``` -------------------------------- ### Define B32 struct Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/page_size/struct.B32.html The B32 struct definition for 32-byte page sizes. ```rust pub struct B32(/* private fields */); ``` -------------------------------- ### No Struct Definition Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/page_size/struct.No.html Defines a struct 'No' that signifies no page write support, typically used for devices like AT24x00. ```rust pub struct No(/* private fields */); ``` -------------------------------- ### Debug Trait Implementation for B64 Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/page_size/struct.B64.html Provides a way to format the B64 struct for debugging purposes. ```APIDOC ## Trait Implementations ### impl Debug for B64 #### fn fmt(&self, f: &mut Formatter<'_>) -> Result Formats the value using the given formatter. Read more ``` -------------------------------- ### Define B16 Struct for 16-byte Pages Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/page_size/struct.B16.html Defines the B16 struct, representing 16-byte pages. This is suitable for EEPROM devices like AT24x04, AT24x08, and AT24x16. ```rust pub struct B16(/* private fields */); ``` -------------------------------- ### Implement Sync for B16 Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/page_size/struct.B16.html Marks the B16 struct as Sync, indicating it can be safely shared between threads. ```rust impl Sync for B16 ``` -------------------------------- ### Implement TryFrom for T Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/page_size/struct.B256.html Provides a method to attempt a conversion from type U into type T, where U implements Into. The conversion can fail, returning an Infallible error type. ```rust impl TryFrom for T where U: Into, Source #### type Error = Infallible The type returned in the event of a conversion error. Source #### fn try_from(value: U) -> Result>::Error> Performs the conversion. ``` -------------------------------- ### Blanket Implementations for B8 Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/page_size/struct.B8.html Details blanket trait implementations applied to the B8 struct, enabling various conversion and borrowing functionalities. ```APIDOC ## Blanket Implementations ### impl Any for T #### fn type_id(&self) -> TypeId Gets the `TypeId` of `self`. Read more ### impl Borrow for T #### fn borrow(&self) -> &T Immutably borrows from an owned value. Read more ### impl BorrowMut for T #### fn borrow_mut(&mut self) -> &mut T Mutably borrows from an owned value. Read more ### impl From for T #### fn from(t: T) -> T Returns the argument unchanged. ### impl Into for T #### fn into(self) -> U Calls `U::from(self)`. That is, this conversion is whatever the implementation of `From for U` chooses to do. ### impl TryFrom for T #### type Error = Infallible The type returned in the event of a conversion error. #### fn try_from(value: U) -> Result>::Error> Performs the conversion. ### impl TryInto for T #### type Error = >::Error The type returned in the event of a conversion error. #### fn try_into(self) -> Result>::Error> Performs the conversion. ``` -------------------------------- ### Implement Into for T Source: https://docs.rs/eeprom24x/0.7.2/eeprom24x/page_size/struct.B256.html Provides a method to convert a value of type T into type U, where U implements From. This conversion is handled by the From for U implementation. ```rust impl Into for T where U: From, Source #### fn into(self) -> U Calls `U::from(self)`. That is, this conversion is whatever the implementation of `From for U` chooses to do. ```