pub struct USART<'a> { /* private fields */ }
Implementations§
Source§impl<'a> USART<'a>
impl<'a> USART<'a>
pub fn new_usart0(pm: &'a PowerManager) -> Self
pub fn new_usart1(pm: &'a PowerManager) -> Self
pub fn new_usart2(pm: &'a PowerManager) -> Self
pub fn new_usart3(pm: &'a PowerManager) -> Self
pub fn set_dma(&self, rx_dma: &'a DMAChannel, tx_dma: &'a DMAChannel)
pub fn set_mode(&self, mode: UsartMode)
pub fn enable_tx(&self, usart: &USARTRegManager<'_>)
pub fn handle_interrupt(&self)
pub fn send_byte(&self, usart: &USARTRegManager<'_>, byte: u8)
pub fn tx_ready(&self, usart: &USARTRegManager<'_>) -> bool
Trait Implementations§
Source§impl DMAClient for USART<'_>
impl DMAClient for USART<'_>
fn transfer_done(&self, pid: DMAPeripheral)
Source§impl DeferredCallClient for USART<'_>
impl DeferredCallClient for USART<'_>
Source§impl<'a> Receive<'a> for USART<'a>
Implementation of kernel::uart
impl<'a> Receive<'a> for USART<'a>
Implementation of kernel::uart
Source§fn set_receive_client(&self, client: &'a dyn ReceiveClient)
fn set_receive_client(&self, client: &'a dyn ReceiveClient)
Set the receive client, which will be called when reads complete.
Source§fn receive_buffer(
&self,
rx_buffer: &'static mut [u8],
rx_len: usize,
) -> Result<(), (ErrorCode, &'static mut [u8])>
fn receive_buffer( &self, rx_buffer: &'static mut [u8], rx_len: usize, ) -> Result<(), (ErrorCode, &'static mut [u8])>
Source§impl<'a> ReceiveAdvanced<'a> for USART<'a>
impl<'a> ReceiveAdvanced<'a> for USART<'a>
Source§impl<'a> SpiMaster<'a> for USART<'a>
SPI
impl<'a> SpiMaster<'a> for USART<'a>
SPI
Source§fn specify_chip_select(&self, cs: Self::ChipSelect) -> Result<(), ErrorCode>
fn specify_chip_select(&self, cs: Self::ChipSelect) -> Result<(), ErrorCode>
Pass in a None to use the HW chip select pin on the USART (RTS).
Source§type ChipSelect = ChipSelectPolar<'a, GPIOPin<'a>>
type ChipSelect = ChipSelectPolar<'a, GPIOPin<'a>>
Chip select is an associated type because different SPI buses may have
different numbers of chip selects. This allows peripheral
implementations to define their own type.
Source§fn init(&self) -> Result<(), ErrorCode>
fn init(&self) -> Result<(), ErrorCode>
Initialize this SPI interface. Call this once before invoking any other
operations. Read more
Source§fn set_client(&self, client: &'a dyn SpiMasterClient)
fn set_client(&self, client: &'a dyn SpiMasterClient)
Change the callback handler for
SpiMaster::read_write_bytes
calls.Source§fn is_busy(&self) -> bool
fn is_busy(&self) -> bool
Return whether the SPI peripheral is busy with a
SpiMaster::read_write_bytes
operation.Source§fn read_write_bytes(
&self,
write_buffer: SubSliceMut<'static, u8>,
read_buffer: Option<SubSliceMut<'static, u8>>,
) -> Result<(), (ErrorCode, SubSliceMut<'static, u8>, Option<SubSliceMut<'static, u8>>)>
fn read_write_bytes( &self, write_buffer: SubSliceMut<'static, u8>, read_buffer: Option<SubSliceMut<'static, u8>>, ) -> Result<(), (ErrorCode, SubSliceMut<'static, u8>, Option<SubSliceMut<'static, u8>>)>
Perform an asynchronous read/write operation, whose completion is
signaled by invoking
SpiMasterClient
on the client. Write-only
operations may pass None
for read_buffer
, while read-write
operations pass Some
for read_buffer
. Read moreSource§fn write_byte(&self, val: u8) -> Result<(), ErrorCode>
fn write_byte(&self, val: u8) -> Result<(), ErrorCode>
Synchronously write a single byte on the bus. Not for general use
because it is blocking: intended for debugging. Read more
Source§fn read_byte(&self) -> Result<u8, ErrorCode>
fn read_byte(&self) -> Result<u8, ErrorCode>
Synchronously write a 0 and read a single byte from the bus. Not for
general use because it is blocking: intended for debugging. Read more
Source§fn read_write_byte(&self, val: u8) -> Result<u8, ErrorCode>
fn read_write_byte(&self, val: u8) -> Result<u8, ErrorCode>
Synchronously write and read a single byte. Not for general use because
it is blocking: intended for debugging. Read more
Source§fn set_polarity(&self, polarity: ClockPolarity) -> Result<(), ErrorCode>
fn set_polarity(&self, polarity: ClockPolarity) -> Result<(), ErrorCode>
Set the bus polarity (whether idle is high or low) for the
current chip select. Read more
Source§fn get_polarity(&self) -> ClockPolarity
fn get_polarity(&self) -> ClockPolarity
Return the current bus polarity.
Source§fn set_phase(&self, phase: ClockPhase) -> Result<(), ErrorCode>
fn set_phase(&self, phase: ClockPhase) -> Result<(), ErrorCode>
Set the bus phase for the current chip select (whether data is
sent/received on leading or trailing edges). Read more
Source§fn get_phase(&self) -> ClockPhase
fn get_phase(&self) -> ClockPhase
Get the current bus phase for the current chip select.
Source§fn hold_low(&self)
fn hold_low(&self)
Hold the chip select line low after a
SpiMaster::read_write_bytes
completes. This allows a client to make one long SPI read/write with
multiple calls to read_write_bytes
.Source§fn release_low(&self)
fn release_low(&self)
Raise the chip select line after a
SpiMaster::read_write_bytes
completes. This will complete the SPI operation.Source§impl<'a> Transmit<'a> for USART<'a>
impl<'a> Transmit<'a> for USART<'a>
Source§fn transmit_buffer(
&self,
tx_buffer: &'static mut [u8],
tx_len: usize,
) -> Result<(), (ErrorCode, &'static mut [u8])>
fn transmit_buffer( &self, tx_buffer: &'static mut [u8], tx_len: usize, ) -> Result<(), (ErrorCode, &'static mut [u8])>
Transmit a buffer of data. Read more
Source§fn set_transmit_client(&self, client: &'a dyn TransmitClient)
fn set_transmit_client(&self, client: &'a dyn TransmitClient)
Set the transmit client, which will be called when transmissions
complete.
Auto Trait Implementations§
impl<'a> !Freeze for USART<'a>
impl<'a> !RefUnwindSafe for USART<'a>
impl<'a> !Send for USART<'a>
impl<'a> !Sync for USART<'a>
impl<'a> Unpin for USART<'a>
impl<'a> !UnwindSafe for USART<'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