Struct stm32_hal2::serial::Serial [−][src]
Serial abstraction
Implementations
impl Serial<USART1>
[src]
pub fn new_usart1<C: ClockCfg>(
usart: USART1,
config: Config,
clocks: &C,
rcc: &mut RCC
) -> Self
[src]
usart: USART1,
config: Config,
clocks: &C,
rcc: &mut RCC
) -> Self
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.)
pub fn listen(&mut self, event: Event)
[src]
Starts listening for an interrupt event
pub fn check_for_error() -> Result<(), Error>
[src]
Check for, and return, any errors
See Rx::check_for_error
.
pub fn unlisten(&mut self, event: Event)
[src]
Stops listening for an interrupt event
pub fn split(self) -> (Tx<USART1>, Rx<USART1>)
[src]
Splits the Serial
abstraction into a transmitter and a receiver half
pub fn release(self) -> USART1
[src]
Frees the USART peripheral
impl Serial<USART2>
[src]
pub fn new_usart2<C: ClockCfg>(
usart: USART2,
config: Config,
clocks: &C,
rcc: &mut RCC
) -> Self
[src]
usart: USART2,
config: Config,
clocks: &C,
rcc: &mut RCC
) -> Self
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.)
pub fn listen(&mut self, event: Event)
[src]
Starts listening for an interrupt event
pub fn check_for_error() -> Result<(), Error>
[src]
Check for, and return, any errors
See Rx::check_for_error
.
pub fn unlisten(&mut self, event: Event)
[src]
Stops listening for an interrupt event
pub fn split(self) -> (Tx<USART2>, Rx<USART2>)
[src]
Splits the Serial
abstraction into a transmitter and a receiver half
pub fn release(self) -> USART2
[src]
Frees the USART peripheral
Trait Implementations
impl Read<u8> for Serial<USART1>
[src]
impl Read<u8> for Serial<USART2>
[src]
impl<USART> Write for Serial<USART> where
Serial<USART>: Write<u8>,
[src]
Serial<USART>: Write<u8>,
fn write_str(&mut self, s: &str) -> Result
[src]
pub fn write_char(&mut self, c: char) -> Result<(), Error>
1.1.0[src]
pub fn write_fmt(&mut self, args: Arguments<'_>) -> Result<(), Error>
1.0.0[src]
impl Write<u8> for Serial<USART1>
[src]
type Error = Error
Write error
fn flush(&mut self) -> Result<(), Error>
[src]
fn write(&mut self, byte: u8) -> Result<(), Error>
[src]
impl Write<u8> for Serial<USART2>
[src]
Auto Trait Implementations
impl<USART> Send for Serial<USART> where
USART: Send,
USART: Send,
impl<USART> Sync for Serial<USART> where
USART: Sync,
USART: Sync,
impl<USART> Unpin for Serial<USART> where
USART: 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> Same<T> for T
type Output = T
Should always be Self
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>,