Struct sram23x::Sram23x[][src]

pub struct Sram23x<SPI, CS, HOLD, DT> {
    pub mode: u8,
    // some fields omitted
}

Microchip SRAM 23x driver

Fields

mode: u8

The operating mode of the device

Implementations

impl<SPI, S, P, CS, HOLD, DT> Sram23x<SPI, CS, HOLD, DT> where
    SPI: Transfer<u8, Error = S> + Write<u8, Error = S>,
    CS: OutputPin<Error = P>,
    HOLD: OutputPin<Error = P>,
    DT: DeviceType, 
[src]

pub fn new(spi: SPI, cs: CS, hold: HOLD, dt: DT) -> Result<Self, Error<S, P>>[src]

Initialize the SRAM device, disable the pin's hold feature, and obtain the operating mode

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

Transfer data over the SPI bus

pub fn get_mode(&mut self) -> Result<u8, Error<S, P>>[src]

Return the operating mode/status of the device

pub fn set_mode(&mut self, mode: u8) -> Result<(), Error<S, P>>[src]

Sets the operating mode/status of the device

pub fn set_hold(&mut self, enabled: bool) -> Result<(), Error<S, P>>[src]

Enable the hold pin (bring it low), which prevents data transmission

pub fn enable_hold_feature(&mut self) -> Result<(), Error<S, P>>[src]

Enable the HOLD feature (status register bit 0) on 23x640 and 23x256 devices

pub fn disable_hold_feature(&mut self) -> Result<(), Error<S, P>>[src]

Disable the HOLD feature (status register bit 0) on 23x640 and 23x256 devices

pub fn read_byte(&mut self, address: u32) -> Result<u8, Error<S, P>>[src]

Read a single byte from an address

pub fn write_byte(&mut self, address: u32, byte: u8) -> Result<(), Error<S, P>>[src]

Write a single byte to an address

pub fn read_page(&mut self, address: u32) -> Result<[u8; 32], Error<S, P>>[src]

Read a 32-byte page starting from an address

pub fn write_page(
    &mut self,
    address: u32,
    bytes: &[u8]
) -> Result<(), Error<S, P>>
[src]

Write a 32-byte page starting from an address

pub fn read_sequential(
    &mut self,
    address: u32,
    bytes: &mut [u8]
) -> Result<(), Error<S, P>>
[src]

Read N-bytes from an array sequentially, starting from an address

pub fn write_sequential(
    &mut self,
    address: u32,
    bytes: &mut [u8]
) -> Result<(), Error<S, P>>
[src]

Write N-bytes to an array sequentially, starting from an address

Trait Implementations

impl<SPI: Debug, CS: Debug, HOLD: Debug, DT: Debug> Debug for Sram23x<SPI, CS, HOLD, DT>[src]

impl<SPI: Default, CS: Default, HOLD: Default, DT: Default> Default for Sram23x<SPI, CS, HOLD, DT>[src]

Auto Trait Implementations

impl<SPI, CS, HOLD, DT> Send for Sram23x<SPI, CS, HOLD, DT> where
    CS: Send,
    DT: Send,
    HOLD: Send,
    SPI: Send
[src]

impl<SPI, CS, HOLD, DT> Sync for Sram23x<SPI, CS, HOLD, DT> where
    CS: Sync,
    DT: Sync,
    HOLD: Sync,
    SPI: Sync
[src]

impl<SPI, CS, HOLD, DT> Unpin for Sram23x<SPI, CS, HOLD, DT> where
    CS: Unpin,
    DT: Unpin,
    HOLD: Unpin,
    SPI: Unpin
[src]

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.