Struct stm32h7xx_hal::serial::Serial
source · pub struct Serial<USART> { /* private fields */ }
Expand description
Serial abstraction
Implementations§
source§impl Serial<USART1>
impl Serial<USART1>
Configures a USART peripheral to provide serial communication
pub fn usart1( usart: USART1, config: impl Into<Config>, prec: Usart1, clocks: &CoreClocks, synchronous: bool ) -> Result<Self, InvalidConfig>
sourcepub fn reconfigure(&mut self, config: impl Into<Config>, synchronous: bool)
pub fn reconfigure(&mut self, config: impl Into<Config>, synchronous: bool)
Applies the configuration to the serial port.
Ensure that the serial port is not transmitting data when calling this method.
§Panics
Panics if DMA Rx or Tx are enabled.
sourcepub fn enable_dma_rx(&mut self)
pub fn enable_dma_rx(&mut self)
Enables the Rx DMA stream.
sourcepub fn disable_dma_rx(&mut self)
pub fn disable_dma_rx(&mut self)
Disables the Rx DMA stream.
sourcepub fn dma_rx_enabled(&self) -> bool
pub fn dma_rx_enabled(&self) -> bool
Returns true
if the Rx DMA stream is enabled.
sourcepub fn enable_dma_tx(&mut self)
pub fn enable_dma_tx(&mut self)
Enables the Tx DMA stream.
sourcepub fn disable_dma_tx(&mut self)
pub fn disable_dma_tx(&mut self)
Disables the Tx DMA stream.
sourcepub fn dma_tx_enabled(&self) -> bool
pub fn dma_tx_enabled(&self) -> bool
Returns true
if the Tx DMA stream is enabled.
sourcepub fn is_idle(&self) -> bool
pub fn is_idle(&self) -> bool
Return true if the line idle status is set
The line idle status bit is set when the peripheral detects the receive line is idle.
The bit is cleared by software, by calling clear_idle()
.
sourcepub fn clear_idle(&mut self)
pub fn clear_idle(&mut self)
Clear the line idle status bit
sourcepub fn is_busy(&self) -> bool
pub fn is_busy(&self) -> bool
Return true if the line busy status is set
The busy status bit is set when there is communication active on the receive line, and reset at the end of reception.
source§impl Serial<USART2>
impl Serial<USART2>
Configures a USART peripheral to provide serial communication
pub fn usart2( usart: USART2, config: impl Into<Config>, prec: Usart2, clocks: &CoreClocks, synchronous: bool ) -> Result<Self, InvalidConfig>
sourcepub fn reconfigure(&mut self, config: impl Into<Config>, synchronous: bool)
pub fn reconfigure(&mut self, config: impl Into<Config>, synchronous: bool)
Applies the configuration to the serial port.
Ensure that the serial port is not transmitting data when calling this method.
§Panics
Panics if DMA Rx or Tx are enabled.
sourcepub fn enable_dma_rx(&mut self)
pub fn enable_dma_rx(&mut self)
Enables the Rx DMA stream.
sourcepub fn disable_dma_rx(&mut self)
pub fn disable_dma_rx(&mut self)
Disables the Rx DMA stream.
sourcepub fn dma_rx_enabled(&self) -> bool
pub fn dma_rx_enabled(&self) -> bool
Returns true
if the Rx DMA stream is enabled.
sourcepub fn enable_dma_tx(&mut self)
pub fn enable_dma_tx(&mut self)
Enables the Tx DMA stream.
sourcepub fn disable_dma_tx(&mut self)
pub fn disable_dma_tx(&mut self)
Disables the Tx DMA stream.
sourcepub fn dma_tx_enabled(&self) -> bool
pub fn dma_tx_enabled(&self) -> bool
Returns true
if the Tx DMA stream is enabled.
sourcepub fn is_idle(&self) -> bool
pub fn is_idle(&self) -> bool
Return true if the line idle status is set
The line idle status bit is set when the peripheral detects the receive line is idle.
The bit is cleared by software, by calling clear_idle()
.
sourcepub fn clear_idle(&mut self)
pub fn clear_idle(&mut self)
Clear the line idle status bit
sourcepub fn is_busy(&self) -> bool
pub fn is_busy(&self) -> bool
Return true if the line busy status is set
The busy status bit is set when there is communication active on the receive line, and reset at the end of reception.
source§impl Serial<USART3>
impl Serial<USART3>
Configures a USART peripheral to provide serial communication
pub fn usart3( usart: USART3, config: impl Into<Config>, prec: Usart3, clocks: &CoreClocks, synchronous: bool ) -> Result<Self, InvalidConfig>
sourcepub fn reconfigure(&mut self, config: impl Into<Config>, synchronous: bool)
pub fn reconfigure(&mut self, config: impl Into<Config>, synchronous: bool)
Applies the configuration to the serial port.
Ensure that the serial port is not transmitting data when calling this method.
§Panics
Panics if DMA Rx or Tx are enabled.
sourcepub fn enable_dma_rx(&mut self)
pub fn enable_dma_rx(&mut self)
Enables the Rx DMA stream.
sourcepub fn disable_dma_rx(&mut self)
pub fn disable_dma_rx(&mut self)
Disables the Rx DMA stream.
sourcepub fn dma_rx_enabled(&self) -> bool
pub fn dma_rx_enabled(&self) -> bool
Returns true
if the Rx DMA stream is enabled.
sourcepub fn enable_dma_tx(&mut self)
pub fn enable_dma_tx(&mut self)
Enables the Tx DMA stream.
sourcepub fn disable_dma_tx(&mut self)
pub fn disable_dma_tx(&mut self)
Disables the Tx DMA stream.
sourcepub fn dma_tx_enabled(&self) -> bool
pub fn dma_tx_enabled(&self) -> bool
Returns true
if the Tx DMA stream is enabled.
sourcepub fn is_idle(&self) -> bool
pub fn is_idle(&self) -> bool
Return true if the line idle status is set
The line idle status bit is set when the peripheral detects the receive line is idle.
The bit is cleared by software, by calling clear_idle()
.
sourcepub fn clear_idle(&mut self)
pub fn clear_idle(&mut self)
Clear the line idle status bit
sourcepub fn is_busy(&self) -> bool
pub fn is_busy(&self) -> bool
Return true if the line busy status is set
The busy status bit is set when there is communication active on the receive line, and reset at the end of reception.
source§impl Serial<USART6>
impl Serial<USART6>
Configures a USART peripheral to provide serial communication
pub fn usart6( usart: USART6, config: impl Into<Config>, prec: Usart6, clocks: &CoreClocks, synchronous: bool ) -> Result<Self, InvalidConfig>
sourcepub fn reconfigure(&mut self, config: impl Into<Config>, synchronous: bool)
pub fn reconfigure(&mut self, config: impl Into<Config>, synchronous: bool)
Applies the configuration to the serial port.
Ensure that the serial port is not transmitting data when calling this method.
§Panics
Panics if DMA Rx or Tx are enabled.
sourcepub fn enable_dma_rx(&mut self)
pub fn enable_dma_rx(&mut self)
Enables the Rx DMA stream.
sourcepub fn disable_dma_rx(&mut self)
pub fn disable_dma_rx(&mut self)
Disables the Rx DMA stream.
sourcepub fn dma_rx_enabled(&self) -> bool
pub fn dma_rx_enabled(&self) -> bool
Returns true
if the Rx DMA stream is enabled.
sourcepub fn enable_dma_tx(&mut self)
pub fn enable_dma_tx(&mut self)
Enables the Tx DMA stream.
sourcepub fn disable_dma_tx(&mut self)
pub fn disable_dma_tx(&mut self)
Disables the Tx DMA stream.
sourcepub fn dma_tx_enabled(&self) -> bool
pub fn dma_tx_enabled(&self) -> bool
Returns true
if the Tx DMA stream is enabled.
sourcepub fn is_idle(&self) -> bool
pub fn is_idle(&self) -> bool
Return true if the line idle status is set
The line idle status bit is set when the peripheral detects the receive line is idle.
The bit is cleared by software, by calling clear_idle()
.
sourcepub fn clear_idle(&mut self)
pub fn clear_idle(&mut self)
Clear the line idle status bit
sourcepub fn is_busy(&self) -> bool
pub fn is_busy(&self) -> bool
Return true if the line busy status is set
The busy status bit is set when there is communication active on the receive line, and reset at the end of reception.
source§impl Serial<UART4>
impl Serial<UART4>
Configures a USART peripheral to provide serial communication
pub fn uart4( usart: UART4, config: impl Into<Config>, prec: Uart4, clocks: &CoreClocks ) -> Result<Self, InvalidConfig>
sourcepub fn reconfigure(&mut self, config: impl Into<Config>)
pub fn reconfigure(&mut self, config: impl Into<Config>)
Applies the configuration to the serial port.
Ensure that the serial port is not transmitting data when calling this method.
§Panics
Panics if DMA Rx or Tx are enabled.
sourcepub fn enable_dma_rx(&mut self)
pub fn enable_dma_rx(&mut self)
Enables the Rx DMA stream.
sourcepub fn disable_dma_rx(&mut self)
pub fn disable_dma_rx(&mut self)
Disables the Rx DMA stream.
sourcepub fn dma_rx_enabled(&self) -> bool
pub fn dma_rx_enabled(&self) -> bool
Returns true
if the Rx DMA stream is enabled.
sourcepub fn enable_dma_tx(&mut self)
pub fn enable_dma_tx(&mut self)
Enables the Tx DMA stream.
sourcepub fn disable_dma_tx(&mut self)
pub fn disable_dma_tx(&mut self)
Disables the Tx DMA stream.
sourcepub fn dma_tx_enabled(&self) -> bool
pub fn dma_tx_enabled(&self) -> bool
Returns true
if the Tx DMA stream is enabled.
sourcepub fn is_idle(&self) -> bool
pub fn is_idle(&self) -> bool
Return true if the line idle status is set
The line idle status bit is set when the peripheral detects the receive line is idle.
The bit is cleared by software, by calling clear_idle()
.
sourcepub fn clear_idle(&mut self)
pub fn clear_idle(&mut self)
Clear the line idle status bit
sourcepub fn is_busy(&self) -> bool
pub fn is_busy(&self) -> bool
Return true if the line busy status is set
The busy status bit is set when there is communication active on the receive line, and reset at the end of reception.
source§impl Serial<UART5>
impl Serial<UART5>
Configures a USART peripheral to provide serial communication
pub fn uart5( usart: UART5, config: impl Into<Config>, prec: Uart5, clocks: &CoreClocks ) -> Result<Self, InvalidConfig>
sourcepub fn reconfigure(&mut self, config: impl Into<Config>)
pub fn reconfigure(&mut self, config: impl Into<Config>)
Applies the configuration to the serial port.
Ensure that the serial port is not transmitting data when calling this method.
§Panics
Panics if DMA Rx or Tx are enabled.
sourcepub fn enable_dma_rx(&mut self)
pub fn enable_dma_rx(&mut self)
Enables the Rx DMA stream.
sourcepub fn disable_dma_rx(&mut self)
pub fn disable_dma_rx(&mut self)
Disables the Rx DMA stream.
sourcepub fn dma_rx_enabled(&self) -> bool
pub fn dma_rx_enabled(&self) -> bool
Returns true
if the Rx DMA stream is enabled.
sourcepub fn enable_dma_tx(&mut self)
pub fn enable_dma_tx(&mut self)
Enables the Tx DMA stream.
sourcepub fn disable_dma_tx(&mut self)
pub fn disable_dma_tx(&mut self)
Disables the Tx DMA stream.
sourcepub fn dma_tx_enabled(&self) -> bool
pub fn dma_tx_enabled(&self) -> bool
Returns true
if the Tx DMA stream is enabled.
sourcepub fn is_idle(&self) -> bool
pub fn is_idle(&self) -> bool
Return true if the line idle status is set
The line idle status bit is set when the peripheral detects the receive line is idle.
The bit is cleared by software, by calling clear_idle()
.
sourcepub fn clear_idle(&mut self)
pub fn clear_idle(&mut self)
Clear the line idle status bit
sourcepub fn is_busy(&self) -> bool
pub fn is_busy(&self) -> bool
Return true if the line busy status is set
The busy status bit is set when there is communication active on the receive line, and reset at the end of reception.
source§impl Serial<UART7>
impl Serial<UART7>
Configures a USART peripheral to provide serial communication
pub fn uart7( usart: UART7, config: impl Into<Config>, prec: Uart7, clocks: &CoreClocks ) -> Result<Self, InvalidConfig>
sourcepub fn reconfigure(&mut self, config: impl Into<Config>)
pub fn reconfigure(&mut self, config: impl Into<Config>)
Applies the configuration to the serial port.
Ensure that the serial port is not transmitting data when calling this method.
§Panics
Panics if DMA Rx or Tx are enabled.
sourcepub fn enable_dma_rx(&mut self)
pub fn enable_dma_rx(&mut self)
Enables the Rx DMA stream.
sourcepub fn disable_dma_rx(&mut self)
pub fn disable_dma_rx(&mut self)
Disables the Rx DMA stream.
sourcepub fn dma_rx_enabled(&self) -> bool
pub fn dma_rx_enabled(&self) -> bool
Returns true
if the Rx DMA stream is enabled.
sourcepub fn enable_dma_tx(&mut self)
pub fn enable_dma_tx(&mut self)
Enables the Tx DMA stream.
sourcepub fn disable_dma_tx(&mut self)
pub fn disable_dma_tx(&mut self)
Disables the Tx DMA stream.
sourcepub fn dma_tx_enabled(&self) -> bool
pub fn dma_tx_enabled(&self) -> bool
Returns true
if the Tx DMA stream is enabled.
sourcepub fn is_idle(&self) -> bool
pub fn is_idle(&self) -> bool
Return true if the line idle status is set
The line idle status bit is set when the peripheral detects the receive line is idle.
The bit is cleared by software, by calling clear_idle()
.
sourcepub fn clear_idle(&mut self)
pub fn clear_idle(&mut self)
Clear the line idle status bit
sourcepub fn is_busy(&self) -> bool
pub fn is_busy(&self) -> bool
Return true if the line busy status is set
The busy status bit is set when there is communication active on the receive line, and reset at the end of reception.
source§impl Serial<UART8>
impl Serial<UART8>
Configures a USART peripheral to provide serial communication
pub fn uart8( usart: UART8, config: impl Into<Config>, prec: Uart8, clocks: &CoreClocks ) -> Result<Self, InvalidConfig>
sourcepub fn reconfigure(&mut self, config: impl Into<Config>)
pub fn reconfigure(&mut self, config: impl Into<Config>)
Applies the configuration to the serial port.
Ensure that the serial port is not transmitting data when calling this method.
§Panics
Panics if DMA Rx or Tx are enabled.
sourcepub fn enable_dma_rx(&mut self)
pub fn enable_dma_rx(&mut self)
Enables the Rx DMA stream.
sourcepub fn disable_dma_rx(&mut self)
pub fn disable_dma_rx(&mut self)
Disables the Rx DMA stream.
sourcepub fn dma_rx_enabled(&self) -> bool
pub fn dma_rx_enabled(&self) -> bool
Returns true
if the Rx DMA stream is enabled.
sourcepub fn enable_dma_tx(&mut self)
pub fn enable_dma_tx(&mut self)
Enables the Tx DMA stream.
sourcepub fn disable_dma_tx(&mut self)
pub fn disable_dma_tx(&mut self)
Disables the Tx DMA stream.
sourcepub fn dma_tx_enabled(&self) -> bool
pub fn dma_tx_enabled(&self) -> bool
Returns true
if the Tx DMA stream is enabled.
sourcepub fn is_idle(&self) -> bool
pub fn is_idle(&self) -> bool
Return true if the line idle status is set
The line idle status bit is set when the peripheral detects the receive line is idle.
The bit is cleared by software, by calling clear_idle()
.
sourcepub fn clear_idle(&mut self)
pub fn clear_idle(&mut self)
Clear the line idle status bit
sourcepub fn is_busy(&self) -> bool
pub fn is_busy(&self) -> bool
Return true if the line busy status is set
The busy status bit is set when there is communication active on the receive line, and reset at the end of reception.
source§impl Serial<USART1>
impl Serial<USART1>
sourcepub fn kernel_clk(clocks: &CoreClocks) -> Option<Hertz>
pub fn kernel_clk(clocks: &CoreClocks) -> Option<Hertz>
Returns the frequency of the current kernel clock for USART1
sourcepub fn kernel_clk_unwrap(clocks: &CoreClocks) -> Hertz
pub fn kernel_clk_unwrap(clocks: &CoreClocks) -> Hertz
Returns the frequency of the current kernel clock for USART1
§Panics
Panics if the kernel clock is not running
source§impl Serial<USART6>
impl Serial<USART6>
sourcepub fn kernel_clk(clocks: &CoreClocks) -> Option<Hertz>
pub fn kernel_clk(clocks: &CoreClocks) -> Option<Hertz>
Returns the frequency of the current kernel clock for USART6
sourcepub fn kernel_clk_unwrap(clocks: &CoreClocks) -> Hertz
pub fn kernel_clk_unwrap(clocks: &CoreClocks) -> Hertz
Returns the frequency of the current kernel clock for USART6
§Panics
Panics if the kernel clock is not running
source§impl Serial<USART2>
impl Serial<USART2>
sourcepub fn kernel_clk(clocks: &CoreClocks) -> Option<Hertz>
pub fn kernel_clk(clocks: &CoreClocks) -> Option<Hertz>
Returns the frequency of the current kernel clock for USART2
sourcepub fn kernel_clk_unwrap(clocks: &CoreClocks) -> Hertz
pub fn kernel_clk_unwrap(clocks: &CoreClocks) -> Hertz
Returns the frequency of the current kernel clock for USART2
§Panics
Panics if the kernel clock is not running
source§impl Serial<USART3>
impl Serial<USART3>
sourcepub fn kernel_clk(clocks: &CoreClocks) -> Option<Hertz>
pub fn kernel_clk(clocks: &CoreClocks) -> Option<Hertz>
Returns the frequency of the current kernel clock for USART3
sourcepub fn kernel_clk_unwrap(clocks: &CoreClocks) -> Hertz
pub fn kernel_clk_unwrap(clocks: &CoreClocks) -> Hertz
Returns the frequency of the current kernel clock for USART3
§Panics
Panics if the kernel clock is not running
source§impl Serial<UART4>
impl Serial<UART4>
sourcepub fn kernel_clk(clocks: &CoreClocks) -> Option<Hertz>
pub fn kernel_clk(clocks: &CoreClocks) -> Option<Hertz>
Returns the frequency of the current kernel clock for UART4
sourcepub fn kernel_clk_unwrap(clocks: &CoreClocks) -> Hertz
pub fn kernel_clk_unwrap(clocks: &CoreClocks) -> Hertz
Returns the frequency of the current kernel clock for UART4
§Panics
Panics if the kernel clock is not running
source§impl Serial<UART5>
impl Serial<UART5>
sourcepub fn kernel_clk(clocks: &CoreClocks) -> Option<Hertz>
pub fn kernel_clk(clocks: &CoreClocks) -> Option<Hertz>
Returns the frequency of the current kernel clock for UART5
sourcepub fn kernel_clk_unwrap(clocks: &CoreClocks) -> Hertz
pub fn kernel_clk_unwrap(clocks: &CoreClocks) -> Hertz
Returns the frequency of the current kernel clock for UART5
§Panics
Panics if the kernel clock is not running
source§impl Serial<UART8>
impl Serial<UART8>
sourcepub fn kernel_clk(clocks: &CoreClocks) -> Option<Hertz>
pub fn kernel_clk(clocks: &CoreClocks) -> Option<Hertz>
Returns the frequency of the current kernel clock for UART8
sourcepub fn kernel_clk_unwrap(clocks: &CoreClocks) -> Hertz
pub fn kernel_clk_unwrap(clocks: &CoreClocks) -> Hertz
Returns the frequency of the current kernel clock for UART8
§Panics
Panics if the kernel clock is not running
source§impl Serial<UART7>
impl Serial<UART7>
sourcepub fn kernel_clk(clocks: &CoreClocks) -> Option<Hertz>
pub fn kernel_clk(clocks: &CoreClocks) -> Option<Hertz>
Returns the frequency of the current kernel clock for UART7
sourcepub fn kernel_clk_unwrap(clocks: &CoreClocks) -> Hertz
pub fn kernel_clk_unwrap(clocks: &CoreClocks) -> Hertz
Returns the frequency of the current kernel clock for UART7
§Panics
Panics if the kernel clock is not running