Struct nrf52::spi::SPIM
[−]
[src]
pub struct SPIM { registers: *const SPIM, client: Cell<Option<&'static SpiMasterClient>>, chip_select: Cell<Option<&'static Pin>>, initialized: Cell<bool>, busy: Cell<bool>, tx_buf: TakeCell<'static, [u8]>, rx_buf: TakeCell<'static, [u8]>, transfer_len: Cell<usize>, }
A SPI master device.
A SPIM
instance wraps a registers::spim::SPIM
together with
addition data necessary to implement an asynchronous interface.
Fields
registers: *const SPIM
client: Cell<Option<&'static SpiMasterClient>>
chip_select: Cell<Option<&'static Pin>>
initialized: Cell<bool>
busy: Cell<bool>
tx_buf: TakeCell<'static, [u8]>
rx_buf: TakeCell<'static, [u8]>
transfer_len: Cell<usize>
Methods
impl SPIM
[src]
const fn new(instance: usize) -> SPIM
[src]
fn regs(&self) -> &SPIM
[src]
pub fn handle_interrupt(&self)
[src]
pub fn configure(&self, mosi: Pinmux, miso: Pinmux, sck: Pinmux)
[src]
Configures an already constructed SPIM
.
pub fn enable(&self)
[src]
Enables SPIM
peripheral.
pub fn disable(&self)
[src]
Disables SPIM
peripheral.
pub fn is_enabled(&self) -> bool
[src]
Trait Implementations
impl SpiMaster for SPIM
[src]
type ChipSelect = &'static Pin
fn set_client(&self, client: &'static SpiMasterClient)
[src]
fn init(&self)
[src]
fn is_busy(&self) -> bool
[src]
fn read_write_bytes(
&self,
tx_buf: &'static mut [u8],
rx_buf: Option<&'static mut [u8]>,
len: usize
) -> ReturnCode
[src]
&self,
tx_buf: &'static mut [u8],
rx_buf: Option<&'static mut [u8]>,
len: usize
) -> ReturnCode
Perform an asynchronous read/write operation, whose completion is signaled by invoking SpiMasterClient on the initialized client. write_buffer must be Some, read_buffer may be None. If read_buffer is Some, the length of the operation is the minimum of the size of the two buffers. Read more
fn write_byte(&self, _val: u8)
[src]
fn read_byte(&self) -> u8
[src]
fn read_write_byte(&self, _val: u8) -> u8
[src]
fn specify_chip_select(&self, cs: Self::ChipSelect)
[src]
Tell the SPI peripheral what to use as a chip select pin. The type of the argument is based on what makes sense for the peripheral when this trait is implemented. Read more
fn set_rate(&self, rate: u32) -> u32
[src]
Returns the actual rate set