Struct sram23x::Sram23x [−][src]
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]
SPI: Transfer<u8, Error = S> + Write<u8, Error = S>,
CS: OutputPin<Error = P>,
HOLD: OutputPin<Error = P>,
DT: DeviceType,
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]
&mut self,
address: u32,
bytes: &[u8]
) -> Result<(), Error<S, P>>
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]
&mut self,
address: u32,
bytes: &mut [u8]
) -> Result<(), Error<S, P>>
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]
&mut self,
address: u32,
bytes: &mut [u8]
) -> Result<(), Error<S, P>>
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]
CS: Send,
DT: Send,
HOLD: Send,
SPI: Send,
impl<SPI, CS, HOLD, DT> Sync for Sram23x<SPI, CS, HOLD, DT> where
CS: Sync,
DT: Sync,
HOLD: Sync,
SPI: Sync,
[src]
CS: Sync,
DT: Sync,
HOLD: Sync,
SPI: Sync,
impl<SPI, CS, HOLD, DT> Unpin for Sram23x<SPI, CS, HOLD, DT> where
CS: Unpin,
DT: Unpin,
HOLD: Unpin,
SPI: Unpin,
[src]
CS: Unpin,
DT: Unpin,
HOLD: Unpin,
SPI: Unpin,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,