Struct stm32_hal2::serial::Serial [−][src]
pub struct Serial<USART> { /* fields omitted */ }Serial abstraction
Implementations
impl Serial<USART1>[src]
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]
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