pub struct SpiDriver<'a> {
regs: *mut RegisterBlock,
_callback: Option<Box<dyn FnMut(Event) + 'a>>,
config: Config,
data_count: u32,
}Expand description
A polling-based SPI driver for STM32F407.
Fields§
§regs: *mut RegisterBlock§_callback: Option<Box<dyn FnMut(Event) + 'a>>§config: Config§data_count: u32Implementations§
Source§impl<'a> SpiDriver<'a>
impl<'a> SpiDriver<'a>
pub fn new(spi_base_addr: u32, config: Config) -> Self
fn regs(&self) -> &mut RegisterBlock
fn is_on_apb2(&self) -> bool
fn get_flag_status(&self, flag_bit: u32) -> bool
fn wait_txe(&self)
fn wait_rxne(&self)
fn wait_not_busy(&self)
fn clear_ovr_flag(&mut self)
fn configure_cr1(&mut self) -> u32
fn configure_cr2(&mut self) -> u32
Trait Implementations§
Source§impl<'a> Spi<'a> for SpiDriver<'a>
impl<'a> Spi<'a> for SpiDriver<'a>
Source§fn initialize(&mut self, callback: impl FnMut(Event) + 'a) -> Result<(), i32>
fn initialize(&mut self, callback: impl FnMut(Event) + 'a) -> Result<(), i32>
Initializes the SPI peripheral.
Source§fn transfer(&mut self, data_out: &[u8], data_in: &mut [u8]) -> Result<(), i32>
fn transfer(&mut self, data_out: &[u8], data_in: &mut [u8]) -> Result<(), i32>
Simultaneously sends and receives data.
Source§fn get_data_count(&self) -> u32
fn get_data_count(&self) -> u32
Gets the number of bytes transferred in the last transaction.
Source§fn get_status(&self) -> Status
fn get_status(&self) -> Status
Gets the current status of the SPI peripheral.
Auto Trait Implementations§
impl<'a> Freeze for SpiDriver<'a>
impl<'a> !RefUnwindSafe for SpiDriver<'a>
impl<'a> !Send for SpiDriver<'a>
impl<'a> !Sync for SpiDriver<'a>
impl<'a> Unpin for SpiDriver<'a>
impl<'a> !UnwindSafe for SpiDriver<'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