Struct USART

Source
pub struct USART<'a> { /* private fields */ }

Implementations§

Source§

impl<'a> USART<'a>

Source

pub fn new_usart0(pm: &'a PowerManager) -> Self

Source

pub fn new_usart1(pm: &'a PowerManager) -> Self

Source

pub fn new_usart2(pm: &'a PowerManager) -> Self

Source

pub fn new_usart3(pm: &'a PowerManager) -> Self

Source

pub fn set_dma(&self, rx_dma: &'a DMAChannel, tx_dma: &'a DMAChannel)

Source

pub fn set_mode(&self, mode: UsartMode)

Source

pub fn enable_tx(&self, usart: &USARTRegManager<'_>)

Source

pub fn handle_interrupt(&self)

Source

pub fn send_byte(&self, usart: &USARTRegManager<'_>, byte: u8)

Source

pub fn tx_ready(&self, usart: &USARTRegManager<'_>) -> bool

Trait Implementations§

Source§

impl Configure for USART<'_>

Source§

fn configure(&self, parameters: Parameters) -> Result<(), ErrorCode>

Set the configuration parameters for the UART bus. Read more
Source§

impl DMAClient for USART<'_>

Source§

impl DeferredCallClient for USART<'_>

Source§

fn handle_deferred_call(&self)

Software interrupt function that is called when the deferred call is triggered.
Source§

fn register(&'static self)

Source§

impl<'a> Receive<'a> for USART<'a>

Implementation of kernel::uart

Source§

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])>

Receive rx_len bytes into rx_buffer. Read more
Source§

fn receive_abort(&self) -> Result<(), ErrorCode>

Abort any ongoing receive transfers and return what has been received. Read more
Source§

fn receive_word(&self) -> Result<(), ErrorCode>

Receive a single word of data. Read more
Source§

impl<'a> ReceiveAdvanced<'a> for USART<'a>

Source§

fn receive_automatic( &self, rx_buffer: &'static mut [u8], len: usize, interbyte_timeout: u8, ) -> Result<(), (ErrorCode, &'static mut [u8])>

Receive data until interbyte_timeout bit periods have passed since the last byte or buffer is full. Read more
Source§

impl<'a> SpiMaster<'a> for USART<'a>

SPI

Source§

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§

fn set_rate(&self, rate: u32) -> Result<u32, ErrorCode>

Returns the actual rate set

Source§

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>

Initialize this SPI interface. Call this once before invoking any other operations. Read more
Source§

fn set_client(&self, client: &'a dyn SpiMasterClient)

Change the callback handler for SpiMaster::read_write_bytes calls.
Source§

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>>)>

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 more
Source§

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>

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>

Synchronously write and read a single byte. Not for general use because it is blocking: intended for debugging. Read more
Source§

fn get_rate(&self) -> u32

Return the current chip select’s clock rate.
Source§

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

Return the current bus polarity.
Source§

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

Get the current bus phase for the current chip select.
Source§

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)

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>

Source§

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 transmit_abort(&self) -> Result<(), ErrorCode>

Abort an outstanding call to transmit_word or transmit_buffer. Read more
Source§

fn set_transmit_client(&self, client: &'a dyn TransmitClient)

Set the transmit client, which will be called when transmissions complete.
Source§

fn transmit_word(&self, _word: u32) -> Result<(), ErrorCode>

Transmit a single word of data asynchronously. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<'a, T> Uart<'a> for T
where T: Configure + Transmit<'a> + Receive<'a>,

Source§

impl<'a, T> UartAdvanced<'a> for T
where T: Configure + Transmit<'a> + ReceiveAdvanced<'a>,

Source§

impl<'a, T> UartData<'a> for T
where T: Transmit<'a> + Receive<'a>,