Trait eeprom24x::Eeprom24xTrait

source ·
pub trait Eeprom24xTrait: Sealed {
    type Error;

    // Required methods
    fn write_byte(
        &mut self,
        address: u32,
        data: u8
    ) -> Result<(), Error<Self::Error>>;
    fn read_byte(&mut self, address: u32) -> Result<u8, Error<Self::Error>>;
    fn read_data(
        &mut self,
        address: u32,
        data: &mut [u8]
    ) -> Result<(), Error<Self::Error>>;
    fn read_current_address(&mut self) -> Result<u8, Error<Self::Error>>;
    fn write_page(
        &mut self,
        address: u32,
        data: &[u8]
    ) -> Result<(), Error<Self::Error>>;
    fn page_size(&self) -> usize;
}
Expand description

Eeprom24x type trait for use in generic code

Required Associated Types§

source

type Error

Inner implementation error.

Required Methods§

source

fn write_byte( &mut self, address: u32, data: u8 ) -> Result<(), Error<Self::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.

source

fn read_byte(&mut self, address: u32) -> Result<u8, Error<Self::Error>>

Read a single byte from an address.

source

fn read_data( &mut self, address: u32, data: &mut [u8] ) -> Result<(), Error<Self::Error>>

Read starting in an address as many bytes as necessary to fill the data array provided.

source

fn read_current_address(&mut self) -> Result<u8, Error<Self::Error>>

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.

source

fn write_page( &mut self, address: u32, data: &[u8] ) -> Result<(), Error<Self::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.

source

fn page_size(&self) -> usize

Return device page size

Implementors§

source§

impl<I2C, E, AS, SN> Eeprom24xTrait for Eeprom24x<I2C, B8, AS, SN>
where I2C: I2c<Error = E>, AS: MultiSizeAddr,

§

type Error = E

source§

impl<I2C, E, AS, SN> Eeprom24xTrait for Eeprom24x<I2C, B16, AS, SN>
where I2C: I2c<Error = E>, AS: MultiSizeAddr,

§

type Error = E

source§

impl<I2C, E, AS, SN> Eeprom24xTrait for Eeprom24x<I2C, B32, AS, SN>
where I2C: I2c<Error = E>, AS: MultiSizeAddr,

§

type Error = E

source§

impl<I2C, E, AS, SN> Eeprom24xTrait for Eeprom24x<I2C, B64, AS, SN>
where I2C: I2c<Error = E>, AS: MultiSizeAddr,

§

type Error = E

source§

impl<I2C, E, AS, SN> Eeprom24xTrait for Eeprom24x<I2C, B128, AS, SN>
where I2C: I2c<Error = E>, AS: MultiSizeAddr,

§

type Error = E

source§

impl<I2C, E, AS, SN> Eeprom24xTrait for Eeprom24x<I2C, B256, AS, SN>
where I2C: I2c<Error = E>, AS: MultiSizeAddr,

§

type Error = E