[−][src]Struct gd32vf103xx_hal::serial::Serial
Serial abstraction
Implementations
impl<USART: UsartX, TX, RX> Serial<USART, TX, RX>
[src]
pub fn new<PINS>(
usart: USART,
pins: PINS,
config: Config,
afio: &mut Afio,
rcu: &mut Rcu
) -> Self where
PINS: Pins<USART, Tx = TX, Rx = RX>,
[src]
usart: USART,
pins: PINS,
config: Config,
afio: &mut Afio,
rcu: &mut Rcu
) -> Self where
PINS: Pins<USART, Tx = TX, Rx = RX>,
Configures the serial interface and creates the interface struct.
pins
is a tuple specifying transmit and receive pins. Current mode of
these pins does not matter, as they are reconfigured during USART
initialization.
config
holds UART configuration such as the baud rate of the interface.
The Serial
struct takes ownership over the USARTx
device
registers and the specified PINS
afio
and rcu
are register handles which are passed for
configuration. (afio
is used to map the USART to the
corresponding pins. rcu
is used to reset the USART.)
pub fn listen(&mut self, event: Event)
[src]
Starts listening to the USART by enabling the Received data ready to be read (RXNE) interrupt and Transmit data register empty (TXE) interrupt
pub fn unlisten(&mut self, event: Event)
[src]
Stops listening to the USART by disabling the Received data ready to be read (RXNE) interrupt and Transmit data register empty (TXE) interrupt
pub fn release(self) -> (USART, TX, RX)
[src]
Returns ownership of the borrowed register handles
pub fn split(self) -> (Tx<USART>, Rx<USART>)
[src]
Separates the serial struct into separate channel objects for sending (Tx) and receiving (Rx)
Auto Trait Implementations
impl<USART, TX, RX> Send for Serial<USART, TX, RX> where
RX: Send,
TX: Send,
USART: Send,
RX: Send,
TX: Send,
USART: Send,
impl<USART, TX, RX> Sync for Serial<USART, TX, RX> where
RX: Sync,
TX: Sync,
USART: Sync,
RX: Sync,
TX: Sync,
USART: Sync,
impl<USART, TX, RX> Unpin for Serial<USART, TX, RX> where
RX: Unpin,
TX: Unpin,
USART: Unpin,
RX: Unpin,
TX: Unpin,
USART: Unpin,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,