Struct capsules::sdcard::SDCard [] [src]

pub struct SDCard<'a, A: Alarm + 'a> {
    spi: &'a SpiMasterDevice,
    state: Cell<SpiState>,
    after_state: Cell<SpiState>,
    alarm: &'a A,
    alarm_state: Cell<AlarmState>,
    alarm_count: Cell<u8>,
    is_initialized: Cell<bool>,
    card_type: Cell<SDCardType>,
    detect_pin: Cell<Option<&'static Pin>>,
    txbuffer: TakeCell<'static, [u8]>,
    rxbuffer: TakeCell<'static, [u8]>,
    client: Cell<Option<&'static SDCardClient>>,
    client_buffer: TakeCell<'static, [u8]>,
    client_offset: Cell<usize>,
}

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

Fields

Methods

impl<'a, A: Alarm + 'a> SDCard<'a, A>
[src]

Functions for initializing and accessing an SD card

[src]

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

[src]

[src]

[src]

send a command over SPI and collect the response Handles encoding of command, checksum, and padding bytes. The response still needs to be parsed out of the read_buffer when complete

[src]

wrapper for easy reading of bytes over SPI

[src]

wrapper for easy writing of bytes over SPI

[src]

parse response bytes from SPI read buffer Unfortunately there is a variable amount of delay in SD card responses, so these bytes must be searched for

[src]

updates SD card state on SPI transaction returns

[src]

updates SD card state upon timer alarm fired

[src]

[src]

[src]

[src]

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

[src]

[src]

[src]

Trait Implementations

impl<'a, A: Alarm + 'a> SpiMasterClient for SDCard<'a, A>
[src]

Handle callbacks from the SPI peripheral

[src]

Called when a read/write operation finishes

impl<'a, A: Alarm + 'a> Client for SDCard<'a, A>
[src]

Handle callbacks from the timer

[src]

Callback signaled when the alarm's clock reaches the value set in Alarm#set_alarm. Read more

impl<'a, A: Alarm + 'a> Client for SDCard<'a, A>
[src]

Handle callbacks from the card detection pin

[src]

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