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>
impl<'a, A: Alarm<'a>> SDCard<'a, A>
Functions for initializing and accessing an SD card
sourcepub 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>
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
pub fn set_client<C: SDCardClient>(&self, client: &'static C)
pub fn is_installed(&self) -> bool
pub fn is_initialized(&self) -> bool
sourcepub fn detect_changes(&self)
pub fn detect_changes(&self)
watches SD card detect pin for changes, sends callback on change
pub fn initialize(&self) -> Result<(), ErrorCode>
pub fn read_blocks( &self, buffer: &'static mut [u8], sector: u32, count: u32, ) -> Result<(), ErrorCode>
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>
impl<'a, A: Alarm<'a>> AlarmClient for SDCard<'a, A>
Handle callbacks from the timer
source§impl<'a, A: Alarm<'a>> SpiMasterClient for SDCard<'a, A>
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>,
)
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more