Struct eeprom24x::Eeprom24x

source ·
pub struct Eeprom24x<I2C, PS, AS, SN> { /* private fields */ }
Expand description

EEPROM24X driver

Implementations§

source§

impl<I2C, PS, AS, SN> Eeprom24x<I2C, PS, AS, SN>

Common methods

source

pub fn destroy(self) -> I2C

Destroy driver instance, return I²C bus instance.

source§

impl<I2C, E, PS, AS, SN> Eeprom24x<I2C, PS, AS, SN>
where I2C: I2c<Error = E>, AS: MultiSizeAddr,

Common methods

source

pub fn write_byte(&mut self, address: u32, data: u8) -> Result<(), Error<E>>

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

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

Read a single byte from an address.

source

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

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

source§

impl<I2C, E, PS, AS, SN> Eeprom24x<I2C, PS, AS, SN>
where I2C: I2c<Error = E>,

Specialization for platforms which implement embedded_hal::blocking::i2c::Read

source

pub fn read_current_address(&mut self) -> Result<u8, Error<E>>

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§

impl<I2C, E> Eeprom24x<I2C, No, OneByte, No>
where I2C: I2c<Error = E>,

Specialization for devices without page access (e.g. 24C00)

source

pub fn new_24x00(i2c: I2C, address: SlaveAddr) -> Self

Create a new instance of a 24x00 device (e.g. 24C00)

source§

impl<I2C, E> Eeprom24x<I2C, B8, OneByte, No>
where I2C: I2c<Error = E>,

source

pub fn new_24x01(i2c: I2C, address: SlaveAddr) -> Self

Create a new instance of a 24x01 device (e.g. AT24C01)

source§

impl<I2C, E> Eeprom24x<I2C, B8, OneByte, No>
where I2C: I2c<Error = E>,

source

pub fn new_24x02(i2c: I2C, address: SlaveAddr) -> Self

Create a new instance of a 24x02 device (e.g. AT24C02)

source§

impl<I2C, E> Eeprom24x<I2C, B8, OneByte, Yes>
where I2C: I2c<Error = E>,

source

pub fn new_24csx01(i2c: I2C, address: SlaveAddr) -> Self

Create a new instance of a 24CSx01 device (e.g. 24CS01)

source§

impl<I2C, E> Eeprom24x<I2C, B8, OneByte, Yes>
where I2C: I2c<Error = E>,

source

pub fn new_24csx02(i2c: I2C, address: SlaveAddr) -> Self

Create a new instance of a 24CSx02 device (e.g. 24CS02)

source§

impl<I2C, E> Eeprom24x<I2C, B8, OneByte, No>
where I2C: I2c<Error = E>,

source

pub fn new_24x02e48(i2c: I2C, address: SlaveAddr) -> Self

Create a new instance of a 24x02E48 device (e.g. 24AA02E48)

source§

impl<I2C, E> Eeprom24x<I2C, B8, OneByte, No>
where I2C: I2c<Error = E>,

source

pub fn new_24x02e64(i2c: I2C, address: SlaveAddr) -> Self

Create a new instance of a 24x02E64 device (e.g. 24AA02E64)

source§

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

source

pub fn write_page(&mut self, address: u32, data: &[u8]) -> Result<(), Error<E>>

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§

impl<I2C, E> Eeprom24x<I2C, B16, OneByte, No>
where I2C: I2c<Error = E>,

source

pub fn new_24x04(i2c: I2C, address: SlaveAddr) -> Self

Create a new instance of a 24x04 device (e.g. AT24C04)

source§

impl<I2C, E> Eeprom24x<I2C, B16, OneByte, No>
where I2C: I2c<Error = E>,

source

pub fn new_24x08(i2c: I2C, address: SlaveAddr) -> Self

Create a new instance of a 24x08 device (e.g. AT24C08)

source§

impl<I2C, E> Eeprom24x<I2C, B16, OneByte, No>
where I2C: I2c<Error = E>,

source

pub fn new_24x16(i2c: I2C, address: SlaveAddr) -> Self

Create a new instance of a 24x16 device (e.g. AT24C16)

source§

impl<I2C, E> Eeprom24x<I2C, B16, OneByte, Yes>
where I2C: I2c<Error = E>,

source

pub fn new_24csx04(i2c: I2C, address: SlaveAddr) -> Self

Create a new instance of a 24CSx04 device (e.g. AT24CS04)

source§

impl<I2C, E> Eeprom24x<I2C, B16, OneByte, Yes>
where I2C: I2c<Error = E>,

source

pub fn new_24csx08(i2c: I2C, address: SlaveAddr) -> Self

Create a new instance of a 24CSx08 device (e.g. AT24CS08)

source§

impl<I2C, E> Eeprom24x<I2C, B16, OneByte, Yes>
where I2C: I2c<Error = E>,

source

pub fn new_24csx16(i2c: I2C, address: SlaveAddr) -> Self

Create a new instance of a 24CSx16 device (e.g. AT24CS16)

source§

impl<I2C, E> Eeprom24x<I2C, B16, OneByte, No>
where I2C: I2c<Error = E>,

source

pub fn new_24x025e48(i2c: I2C, address: SlaveAddr) -> Self

Create a new instance of a 24x025E48 device (e.g. 24AA025E48)

source§

impl<I2C, E> Eeprom24x<I2C, B16, OneByte, No>
where I2C: I2c<Error = E>,

source

pub fn new_24x025e64(i2c: I2C, address: SlaveAddr) -> Self

Create a new instance of a 24x025E64 device (e.g. 24AA025E64)

source§

impl<I2C, E> Eeprom24x<I2C, B16, OneByte, No>
where I2C: I2c<Error = E>,

source

pub fn new_m24x01(i2c: I2C, address: SlaveAddr) -> Self

Create a new instance of a M24C01 device (e.g. M24C01)

source§

impl<I2C, E> Eeprom24x<I2C, B16, OneByte, No>
where I2C: I2c<Error = E>,

source

pub fn new_m24x02(i2c: I2C, address: SlaveAddr) -> Self

Create a new instance of a M24C02 device (e.g. M24C02)

source§

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

source

pub fn write_page(&mut self, address: u32, data: &[u8]) -> Result<(), Error<E>>

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§

impl<I2C, E> Eeprom24x<I2C, B32, TwoBytes, No>
where I2C: I2c<Error = E>,

source

pub fn new_24x32(i2c: I2C, address: SlaveAddr) -> Self

Create a new instance of a 24x32 device (e.g. AT24C32)

source§

impl<I2C, E> Eeprom24x<I2C, B32, TwoBytes, No>
where I2C: I2c<Error = E>,

source

pub fn new_24x64(i2c: I2C, address: SlaveAddr) -> Self

Create a new instance of a 24x64 device (e.g. AT24C64)

source§

impl<I2C, E> Eeprom24x<I2C, B32, TwoBytes, Yes>
where I2C: I2c<Error = E>,

source

pub fn new_24csx32(i2c: I2C, address: SlaveAddr) -> Self

Create a new instance of a 24CSx32 device (e.g. AT24CS32)

source§

impl<I2C, E> Eeprom24x<I2C, B32, TwoBytes, Yes>
where I2C: I2c<Error = E>,

source

pub fn new_24csx64(i2c: I2C, address: SlaveAddr) -> Self

Create a new instance of a 24CSx64 device (e.g. AT24CS64)

source§

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

source

pub fn write_page(&mut self, address: u32, data: &[u8]) -> Result<(), Error<E>>

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§

impl<I2C, E> Eeprom24x<I2C, B64, TwoBytes, No>
where I2C: I2c<Error = E>,

source

pub fn new_24x128(i2c: I2C, address: SlaveAddr) -> Self

Create a new instance of a 24x128 device (e.g. AT24C128)

source§

impl<I2C, E> Eeprom24x<I2C, B64, TwoBytes, No>
where I2C: I2c<Error = E>,

source

pub fn new_24x256(i2c: I2C, address: SlaveAddr) -> Self

Create a new instance of a 24x256 device (e.g. AT24C256)

source§

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

source

pub fn write_page(&mut self, address: u32, data: &[u8]) -> Result<(), Error<E>>

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§

impl<I2C, E> Eeprom24x<I2C, B128, TwoBytes, No>
where I2C: I2c<Error = E>,

source

pub fn new_24x512(i2c: I2C, address: SlaveAddr) -> Self

Create a new instance of a 24x512 device (e.g. AT24C512)

source§

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

source

pub fn write_page(&mut self, address: u32, data: &[u8]) -> Result<(), Error<E>>

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§

impl<I2C, E> Eeprom24x<I2C, B256, TwoBytes, No>
where I2C: I2c<Error = E>,

source

pub fn new_24xm01(i2c: I2C, address: SlaveAddr) -> Self

Create a new instance of a 24xM01 device (e.g. AT24CM01)

source§

impl<I2C, E> Eeprom24x<I2C, B256, TwoBytes, No>
where I2C: I2c<Error = E>,

source

pub fn new_24xm02(i2c: I2C, address: SlaveAddr) -> Self

Create a new instance of a 24xM02 device (e.g. AT24CM02)

source§

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

source

pub fn write_page(&mut self, address: u32, data: &[u8]) -> Result<(), Error<E>>

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§

impl<I2C, PS, E> Eeprom24x<I2C, PS, OneByte, Yes>
where I2C: I2c<Error = E>,

Methods for interacting with the factory-programmed unique serial number for devices with one byte addresses. e.g. 24CSx01, 24CSx02,24CSx04, 24CSx08, and 24CSx16.

source

pub fn read_unique_serial(&mut self) -> Result<[u8; 16], Error<E>>

Read the 128-bit unique serial number.

source§

impl<I2C, PS, E> Eeprom24x<I2C, PS, TwoBytes, Yes>
where I2C: I2c<Error = E>,

Methods for interacting with the factory-programmed unique serial number for devices with two byte addresses. e.g. 24CSx32 and 24CSx64

source

pub fn read_unique_serial(&mut self) -> Result<[u8; 16], Error<E>>

Read the 128-bit unique serial number.

Trait Implementations§

source§

impl<I2C: Debug, PS: Debug, AS: Debug, SN: Debug> Debug for Eeprom24x<I2C, PS, AS, SN>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

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

§

type Error = E

Inner implementation error.
source§

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

Write a single byte in an address. Read more
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. Read more
source§

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

Write up to a page starting in an address. Read more
source§

fn page_size(&self) -> usize

Return device page size
source§

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

§

type Error = E

Inner implementation error.
source§

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

Write a single byte in an address. Read more
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. Read more
source§

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

Write up to a page starting in an address. Read more
source§

fn page_size(&self) -> usize

Return device page size
source§

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

§

type Error = E

Inner implementation error.
source§

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

Write a single byte in an address. Read more
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. Read more
source§

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

Write up to a page starting in an address. Read more
source§

fn page_size(&self) -> usize

Return device page size
source§

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

§

type Error = E

Inner implementation error.
source§

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

Write a single byte in an address. Read more
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. Read more
source§

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

Write up to a page starting in an address. Read more
source§

fn page_size(&self) -> usize

Return device page size
source§

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

§

type Error = E

Inner implementation error.
source§

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

Write a single byte in an address. Read more
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. Read more
source§

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

Write up to a page starting in an address. Read more
source§

fn page_size(&self) -> usize

Return device page size
source§

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

§

type Error = E

Inner implementation error.
source§

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

Write a single byte in an address. Read more
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. Read more
source§

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

Write up to a page starting in an address. Read more
source§

fn page_size(&self) -> usize

Return device page size

Auto Trait Implementations§

§

impl<I2C, PS, AS, SN> Freeze for Eeprom24x<I2C, PS, AS, SN>
where I2C: Freeze,

§

impl<I2C, PS, AS, SN> RefUnwindSafe for Eeprom24x<I2C, PS, AS, SN>

§

impl<I2C, PS, AS, SN> Send for Eeprom24x<I2C, PS, AS, SN>
where I2C: Send, PS: Send, AS: Send, SN: Send,

§

impl<I2C, PS, AS, SN> Sync for Eeprom24x<I2C, PS, AS, SN>
where I2C: Sync, PS: Sync, AS: Sync, SN: Sync,

§

impl<I2C, PS, AS, SN> Unpin for Eeprom24x<I2C, PS, AS, SN>
where I2C: Unpin, PS: Unpin, AS: Unpin, SN: Unpin,

§

impl<I2C, PS, AS, SN> UnwindSafe for Eeprom24x<I2C, PS, AS, SN>
where I2C: UnwindSafe, PS: UnwindSafe, AS: UnwindSafe, SN: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.