[][src]Struct microchip_eeprom_25x::Eeprom25x

pub struct Eeprom25x<SPI, CS, WP, HOLD> { /* fields omitted */ }

Implementations

impl<SPI, CS, WP, HOLD, SpiError, PinError> Eeprom25x<SPI, CS, WP, HOLD> where
    SPI: Transfer<u8, Error = SpiError> + Write<u8, Error = SpiError>,
    CS: OutputPin<Error = PinError>,
    WP: OutputPin<Error = PinError>,
    HOLD: OutputPin<Error = PinError>, 
[src]

pub fn new(
    spi: SPI,
    cs: CS,
    wp: WP,
    hold: HOLD
) -> Result<Self, Error<SpiError, PinError>>
[src]

Initializes the EEPROM device

Checks if the manufacturer ID is correct otherwise returns an error. Makes sure that you can't write to the status register and also that the device is in deep sleep mode. Also the chip hold is removed

pub fn status(&mut self) -> Result<Status, Error<SpiError, PinError>>[src]

Returns the status of the chip

pub fn set_array_write_protection(
    &mut self,
    level: WriteProtection
) -> Result<(), Error<SpiError, PinError>>
[src]

Set the array write protection level It can be the first 1/4, 1/2 or whole chip length Will return the chip in writing to status register disabled

pub fn error_on_writing(&mut self) -> Result<Status, Error<SpiError, PinError>>[src]

Returns the status of the chip or an error if it is busy writing

pub fn erase(
    &mut self,
    address: u32,
    erase: Erase
) -> Result<(), Error<SpiError, PinError>>
[src]

Erase parts of the chip. Can be a page, a sector or the whole chip

pub fn hold_transfer(
    &mut self,
    enabled: bool
) -> Result<(), Error<SpiError, PinError>>
[src]

Keep the device from clocking out data, or enable it to do so

pub fn release_from_deep_sleep_and_get_manufacturer_id(
    &mut self
) -> Result<u8, Error<SpiError, PinError>>
[src]

Wake up the chip and also return the manufacturer ID

pub fn deep_sleep(&mut self) -> Result<(), Error<SpiError, PinError>>[src]

Put the device in deep sleep mode

pub fn disable_write_to_status(
    &mut self
) -> Result<(), Error<SpiError, PinError>>
[src]

Disable writing to the status register

pub fn enable_write_to_status(
    &mut self
) -> Result<(), Error<SpiError, PinError>>
[src]

Enable writing to the status register

pub fn write_enable(&mut self) -> Result<(), Error<SpiError, PinError>>[src]

Put the write protection down

pub fn write_disable(&mut self) -> Result<(), Error<SpiError, PinError>>[src]

Enable write protection

pub fn transfer(
    &mut self,
    bytes: &mut [u8]
) -> Result<(), Error<SpiError, PinError>>
[src]

Transfer over the SPI

Auto Trait Implementations

impl<SPI, CS, WP, HOLD> Send for Eeprom25x<SPI, CS, WP, HOLD> where
    CS: Send,
    HOLD: Send,
    SPI: Send,
    WP: Send

impl<SPI, CS, WP, HOLD> Sync for Eeprom25x<SPI, CS, WP, HOLD> where
    CS: Sync,
    HOLD: Sync,
    SPI: Sync,
    WP: Sync

impl<SPI, CS, WP, HOLD> Unpin for Eeprom25x<SPI, CS, WP, HOLD> where
    CS: Unpin,
    HOLD: Unpin,
    SPI: Unpin,
    WP: Unpin

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.