Struct capsules_extra::sdcard::SDCard

source ·
pub struct SDCard<'a, A: Alarm<'a>> { /* private fields */ }
Expand description

SD Card capsule, capable of being built on top of by other kernel capsules

Implementations§

source§

impl<'a, A: Alarm<'a>> SDCard<'a, A>

Functions for initializing and accessing an SD card

source

pub fn new( spi: &'a dyn SpiMasterDevice<'_>, alarm: &'a A, detect_pin: Option<&'static dyn InterruptPin<'a>>, txbuffer: &'static mut [u8; 515], rxbuffer: &'static mut [u8; 515], ) -> SDCard<'a, A>

Create a new SD card interface

spi - virtualized SPI to use for communication with SD card alarm - virtualized Timer with a granularity of at least 1 ms detect_pin - active low GPIO pin used to detect if an SD card is installed txbuffer - buffer for holding SPI write data, at least 515 bytes in length rxbuffer - buffer for holding SPI read data, at least 515 bytes in length

source

pub fn set_client<C: SDCardClient>(&self, client: &'static C)

source

pub fn is_installed(&self) -> bool

source

pub fn is_initialized(&self) -> bool

source

pub fn detect_changes(&self)

watches SD card detect pin for changes, sends callback on change

source

pub fn initialize(&self) -> Result<(), ErrorCode>

source

pub fn read_blocks( &self, buffer: &'static mut [u8], sector: u32, count: u32, ) -> Result<(), ErrorCode>

source

pub fn write_blocks( &self, buffer: &'static mut [u8], sector: u32, count: u32, ) -> Result<(), ErrorCode>

Trait Implementations§

source§

impl<'a, A: Alarm<'a>> AlarmClient for SDCard<'a, A>

Handle callbacks from the timer

source§

fn alarm(&self)

Callback indicating the alarm time has been reached. The alarm MUST be disabled when this is called. If a new alarm is needed, the client can call Alarm::set_alarm.
source§

impl<'a, A: Alarm<'a>> Client for SDCard<'a, A>

Handle callbacks from the card detection pin

source§

fn fired(&self)

Called when an interrupt occurs. The identifier will be the same value that was passed to enable_interrupt() when the interrupt was configured.
source§

impl<'a, A: Alarm<'a>> SpiMasterClient for SDCard<'a, A>

Handle callbacks from the SPI peripheral

source§

fn read_write_done( &self, write_buffer: SubSliceMut<'static, u8>, read_buffer: Option<SubSliceMut<'static, u8>>, status: Result<usize, ErrorCode>, )

Callback issued when a read/write operation finishes. Read more

Auto Trait Implementations§

§

impl<'a, A> !Freeze for SDCard<'a, A>

§

impl<'a, A> !RefUnwindSafe for SDCard<'a, A>

§

impl<'a, A> !Send for SDCard<'a, A>

§

impl<'a, A> !Sync for SDCard<'a, A>

§

impl<'a, A> Unpin for SDCard<'a, A>

§

impl<'a, A> !UnwindSafe for SDCard<'a, A>

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.