Struct stm32l0xx_hal::serial::Serial
source · [−]pub struct Serial<USART> { /* private fields */ }
Expand description
Serial abstraction
Implementations
sourceimpl Serial<LPUART1>
impl Serial<LPUART1>
pub fn lpuart1<TX, RX>(
usart: LPUART1,
tx: TX,
rx: RX,
config: Config,
rcc: &mut Rcc
) -> Result<Self, InvalidConfig> where
TX: TxPin<LPUART1>,
RX: RxPin<LPUART1>,
sourcepub fn pending_event(&self) -> Option<Event>
pub fn pending_event(&self) -> Option<Event>
Returns a pending and enabled Event
.
Multiple Event
s can be signaled at the same time. In that case, an arbitrary
pending event will be returned. Clearing the event condition will cause this
method to return the other pending event(s).
For an event to be returned by this method, it must first be enabled by calling
listen
.
This method will never clear a pending event. If the event condition is not
resolved by the user, it will be returned again by the next call to
pending_event
.
sourcepub fn check_errors(&mut self) -> Result<(), Error>
pub fn check_errors(&mut self) -> Result<(), Error>
Checks for reception errors that may have occurred.
Note that multiple errors can be signaled at the same time. In that case, calling this function repeatedly will return the remaining errors.
sourcepub fn clear_errors(&mut self)
pub fn clear_errors(&mut self)
Clears any signaled errors without returning them.
pub fn split(self) -> (Tx<LPUART1>, Rx<LPUART1>)
pub fn release(self) -> LPUART1
sourceimpl Serial<USART2>
impl Serial<USART2>
pub fn usart2<TX, RX>(
usart: USART2,
tx: TX,
rx: RX,
config: Config,
rcc: &mut Rcc
) -> Result<Self, InvalidConfig> where
TX: TxPin<USART2>,
RX: RxPin<USART2>,
sourcepub fn pending_event(&self) -> Option<Event>
pub fn pending_event(&self) -> Option<Event>
Returns a pending and enabled Event
.
Multiple Event
s can be signaled at the same time. In that case, an arbitrary
pending event will be returned. Clearing the event condition will cause this
method to return the other pending event(s).
For an event to be returned by this method, it must first be enabled by calling
listen
.
This method will never clear a pending event. If the event condition is not
resolved by the user, it will be returned again by the next call to
pending_event
.
sourcepub fn check_errors(&mut self) -> Result<(), Error>
pub fn check_errors(&mut self) -> Result<(), Error>
Checks for reception errors that may have occurred.
Note that multiple errors can be signaled at the same time. In that case, calling this function repeatedly will return the remaining errors.
sourcepub fn clear_errors(&mut self)
pub fn clear_errors(&mut self)
Clears any signaled errors without returning them.
pub fn split(self) -> (Tx<USART2>, Rx<USART2>)
pub fn release(self) -> USART2
sourceimpl Serial<USART1>
impl Serial<USART1>
pub fn usart1<TX, RX>(
usart: USART1,
tx: TX,
rx: RX,
config: Config,
rcc: &mut Rcc
) -> Result<Self, InvalidConfig> where
TX: TxPin<USART1>,
RX: RxPin<USART1>,
sourcepub fn pending_event(&self) -> Option<Event>
pub fn pending_event(&self) -> Option<Event>
Returns a pending and enabled Event
.
Multiple Event
s can be signaled at the same time. In that case, an arbitrary
pending event will be returned. Clearing the event condition will cause this
method to return the other pending event(s).
For an event to be returned by this method, it must first be enabled by calling
listen
.
This method will never clear a pending event. If the event condition is not
resolved by the user, it will be returned again by the next call to
pending_event
.
sourcepub fn check_errors(&mut self) -> Result<(), Error>
pub fn check_errors(&mut self) -> Result<(), Error>
Checks for reception errors that may have occurred.
Note that multiple errors can be signaled at the same time. In that case, calling this function repeatedly will return the remaining errors.
sourcepub fn clear_errors(&mut self)
pub fn clear_errors(&mut self)
Clears any signaled errors without returning them.
pub fn split(self) -> (Tx<USART1>, Rx<USART1>)
pub fn release(self) -> USART1
sourceimpl Serial<USART4>
impl Serial<USART4>
pub fn usart4<TX, RX>(
usart: USART4,
tx: TX,
rx: RX,
config: Config,
rcc: &mut Rcc
) -> Result<Self, InvalidConfig> where
TX: TxPin<USART4>,
RX: RxPin<USART4>,
sourcepub fn pending_event(&self) -> Option<Event>
pub fn pending_event(&self) -> Option<Event>
Returns a pending and enabled Event
.
Multiple Event
s can be signaled at the same time. In that case, an arbitrary
pending event will be returned. Clearing the event condition will cause this
method to return the other pending event(s).
For an event to be returned by this method, it must first be enabled by calling
listen
.
This method will never clear a pending event. If the event condition is not
resolved by the user, it will be returned again by the next call to
pending_event
.
sourcepub fn check_errors(&mut self) -> Result<(), Error>
pub fn check_errors(&mut self) -> Result<(), Error>
Checks for reception errors that may have occurred.
Note that multiple errors can be signaled at the same time. In that case, calling this function repeatedly will return the remaining errors.
sourcepub fn clear_errors(&mut self)
pub fn clear_errors(&mut self)
Clears any signaled errors without returning them.
pub fn split(self) -> (Tx<USART4>, Rx<USART4>)
pub fn release(self) -> USART4
sourceimpl Serial<USART5>
impl Serial<USART5>
pub fn usart5<TX, RX>(
usart: USART5,
tx: TX,
rx: RX,
config: Config,
rcc: &mut Rcc
) -> Result<Self, InvalidConfig> where
TX: TxPin<USART5>,
RX: RxPin<USART5>,
sourcepub fn pending_event(&self) -> Option<Event>
pub fn pending_event(&self) -> Option<Event>
Returns a pending and enabled Event
.
Multiple Event
s can be signaled at the same time. In that case, an arbitrary
pending event will be returned. Clearing the event condition will cause this
method to return the other pending event(s).
For an event to be returned by this method, it must first be enabled by calling
listen
.
This method will never clear a pending event. If the event condition is not
resolved by the user, it will be returned again by the next call to
pending_event
.
sourcepub fn check_errors(&mut self) -> Result<(), Error>
pub fn check_errors(&mut self) -> Result<(), Error>
Checks for reception errors that may have occurred.
Note that multiple errors can be signaled at the same time. In that case, calling this function repeatedly will return the remaining errors.
sourcepub fn clear_errors(&mut self)
pub fn clear_errors(&mut self)
Clears any signaled errors without returning them.
pub fn split(self) -> (Tx<USART5>, Rx<USART5>)
pub fn release(self) -> USART5
sourceimpl Serial<LPUART1>
impl Serial<LPUART1>
sourcepub fn use_lse(&mut self, rcc: &mut Rcc, _: &LSE)
pub fn use_lse(&mut self, rcc: &mut Rcc, _: &LSE)
Switches LPUART1 clock course to LSE
Consumes LSE token, to get guarantee that LSE clocks are configured.
At the moment configured baudrate is ignored and LPUART1 is forced to 9600 when clocked by LSE, assuming that LSE is 32768 (and it must be so according to RM).
Trait Implementations
Auto Trait Implementations
impl<USART> RefUnwindSafe for Serial<USART> where
USART: RefUnwindSafe,
impl<USART> Send for Serial<USART> where
USART: Send,
impl<USART> Sync for Serial<USART> where
USART: Sync,
impl<USART> Unpin for Serial<USART> where
USART: Unpin,
impl<USART> UnwindSafe for Serial<USART> where
USART: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more