Struct stm32l4xx_hal::serial::Serial
source · [−]pub struct Serial<USART, PINS> { /* private fields */ }
Expand description
Serial abstraction
Implementations
sourceimpl<PINS> Serial<USART1, PINS>
impl<PINS> Serial<USART1, PINS>
sourcepub fn usart1(
usart: USART1,
pins: PINS,
config: impl Into<Config>,
clocks: Clocks,
apb: &mut <USART1 as RccBus>::Bus
) -> Self where
PINS: Pins<USART1>,
pub fn usart1(
usart: USART1,
pins: PINS,
config: impl Into<Config>,
clocks: Clocks,
apb: &mut <USART1 as RccBus>::Bus
) -> Self where
PINS: Pins<USART1>,
Configures the serial interface and creates the interface struct.
Config
is a config struct that configures baud rate, stop bits and parity.
Clocks
passes information about the current frequencies of
the clocks. The existence of the struct ensures that the
clock settings are fixed.
The serial
struct takes ownership over the USARTX
device
registers and the specified PINS
MAPR
and APBX
are register handles which are passed for
configuration. (MAPR
is used to map the USART to the
corresponding pins. APBX
is used to reset the USART.)
sourcepub fn check_for_error() -> Result<(), Error>
pub fn check_for_error() -> Result<(), Error>
Check for, and return, any errors
See Rx::check_for_error
.
sourceimpl<PINS> Serial<USART2, PINS>
impl<PINS> Serial<USART2, PINS>
sourcepub fn usart2(
usart: USART2,
pins: PINS,
config: impl Into<Config>,
clocks: Clocks,
apb: &mut <USART2 as RccBus>::Bus
) -> Self where
PINS: Pins<USART2>,
pub fn usart2(
usart: USART2,
pins: PINS,
config: impl Into<Config>,
clocks: Clocks,
apb: &mut <USART2 as RccBus>::Bus
) -> Self where
PINS: Pins<USART2>,
Configures the serial interface and creates the interface struct.
Config
is a config struct that configures baud rate, stop bits and parity.
Clocks
passes information about the current frequencies of
the clocks. The existence of the struct ensures that the
clock settings are fixed.
The serial
struct takes ownership over the USARTX
device
registers and the specified PINS
MAPR
and APBX
are register handles which are passed for
configuration. (MAPR
is used to map the USART to the
corresponding pins. APBX
is used to reset the USART.)
sourcepub fn check_for_error() -> Result<(), Error>
pub fn check_for_error() -> Result<(), Error>
Check for, and return, any errors
See Rx::check_for_error
.
Trait Implementations
sourceimpl<USART, PINS> Write for Serial<USART, PINS> where
Serial<USART, PINS>: Write<u8>,
impl<USART, PINS> Write for Serial<USART, PINS> where
Serial<USART, PINS>: Write<u8>,
Auto Trait Implementations
impl<USART, PINS> RefUnwindSafe for Serial<USART, PINS> where
PINS: RefUnwindSafe,
USART: RefUnwindSafe,
impl<USART, PINS> Send for Serial<USART, PINS> where
PINS: Send,
USART: Send,
impl<USART, PINS> Sync for Serial<USART, PINS> where
PINS: Sync,
USART: Sync,
impl<USART, PINS> Unpin for Serial<USART, PINS> where
PINS: Unpin,
USART: Unpin,
impl<USART, PINS> UnwindSafe for Serial<USART, PINS> where
PINS: UnwindSafe,
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