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§
Required Methods§
sourcefn write_byte(
&mut self,
address: u32,
data: u8
) -> Result<(), Error<Self::Error>>
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.
sourcefn read_byte(&mut self, address: u32) -> Result<u8, Error<Self::Error>>
fn read_byte(&mut self, address: u32) -> Result<u8, Error<Self::Error>>
Read a single byte from an address.
sourcefn read_data(
&mut self,
address: u32,
data: &mut [u8]
) -> Result<(), Error<Self::Error>>
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.
sourcefn read_current_address(&mut self) -> Result<u8, Error<Self::Error>>
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.
sourcefn write_page(
&mut self,
address: u32,
data: &[u8]
) -> Result<(), Error<Self::Error>>
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.