Prusa MINI Firmware overview
stm32f4xx_hal_uart.h File Reference

Header file of UART HAL module. More...

Go to the source code of this file.

Classes

struct  UART_InitTypeDef
 UART Init Structure definition. More...
 
struct  UART_HandleTypeDef
 UART handle Structure definition. More...
 

Macros

#define HAL_UART_ERROR_NONE   0x00000000U
 
#define HAL_UART_ERROR_PE   0x00000001U
 
#define HAL_UART_ERROR_NE   0x00000002U
 
#define HAL_UART_ERROR_FE   0x00000004U
 
#define HAL_UART_ERROR_ORE   0x00000008U
 
#define HAL_UART_ERROR_DMA   0x00000010U
 
#define UART_WORDLENGTH_8B   0x00000000U
 
#define UART_WORDLENGTH_9B   ((uint32_t)USART_CR1_M)
 
#define UART_STOPBITS_1   0x00000000U
 
#define UART_STOPBITS_2   ((uint32_t)USART_CR2_STOP_1)
 
#define UART_PARITY_NONE   0x00000000U
 
#define UART_PARITY_EVEN   ((uint32_t)USART_CR1_PCE)
 
#define UART_PARITY_ODD   ((uint32_t)(USART_CR1_PCE | USART_CR1_PS))
 
#define UART_HWCONTROL_NONE   0x00000000U
 
#define UART_HWCONTROL_RTS   ((uint32_t)USART_CR3_RTSE)
 
#define UART_HWCONTROL_CTS   ((uint32_t)USART_CR3_CTSE)
 
#define UART_HWCONTROL_RTS_CTS   ((uint32_t)(USART_CR3_RTSE | USART_CR3_CTSE))
 
#define UART_MODE_RX   ((uint32_t)USART_CR1_RE)
 
#define UART_MODE_TX   ((uint32_t)USART_CR1_TE)
 
#define UART_MODE_TX_RX   ((uint32_t)(USART_CR1_TE |USART_CR1_RE))
 
#define UART_STATE_DISABLE   0x00000000U
 
#define UART_STATE_ENABLE   ((uint32_t)USART_CR1_UE)
 
#define UART_OVERSAMPLING_16   0x00000000U
 
#define UART_OVERSAMPLING_8   ((uint32_t)USART_CR1_OVER8)
 
#define UART_LINBREAKDETECTLENGTH_10B   0x00000000U
 
#define UART_LINBREAKDETECTLENGTH_11B   0x00000020U
 
#define UART_WAKEUPMETHOD_IDLELINE   0x00000000U
 
#define UART_WAKEUPMETHOD_ADDRESSMARK   0x00000800U
 
#define UART_FLAG_CTS   ((uint32_t)USART_SR_CTS)
 
#define UART_FLAG_LBD   ((uint32_t)USART_SR_LBD)
 
#define UART_FLAG_TXE   ((uint32_t)USART_SR_TXE)
 
#define UART_FLAG_TC   ((uint32_t)USART_SR_TC)
 
#define UART_FLAG_RXNE   ((uint32_t)USART_SR_RXNE)
 
#define UART_FLAG_IDLE   ((uint32_t)USART_SR_IDLE)
 
#define UART_FLAG_ORE   ((uint32_t)USART_SR_ORE)
 
#define UART_FLAG_NE   ((uint32_t)USART_SR_NE)
 
#define UART_FLAG_FE   ((uint32_t)USART_SR_FE)
 
#define UART_FLAG_PE   ((uint32_t)USART_SR_PE)
 
#define UART_IT_PE   ((uint32_t)(UART_CR1_REG_INDEX << 28U | USART_CR1_PEIE))
 
#define UART_IT_TXE   ((uint32_t)(UART_CR1_REG_INDEX << 28U | USART_CR1_TXEIE))
 
#define UART_IT_TC   ((uint32_t)(UART_CR1_REG_INDEX << 28U | USART_CR1_TCIE))
 
#define UART_IT_RXNE   ((uint32_t)(UART_CR1_REG_INDEX << 28U | USART_CR1_RXNEIE))
 
#define UART_IT_IDLE   ((uint32_t)(UART_CR1_REG_INDEX << 28U | USART_CR1_IDLEIE))
 
#define UART_IT_LBD   ((uint32_t)(UART_CR2_REG_INDEX << 28U | USART_CR2_LBDIE))
 
#define UART_IT_CTS   ((uint32_t)(UART_CR3_REG_INDEX << 28U | USART_CR3_CTSIE))
 
#define UART_IT_ERR   ((uint32_t)(UART_CR3_REG_INDEX << 28U | USART_CR3_EIE))
 
#define __HAL_UART_RESET_HANDLE_STATE(__HANDLE__)
 Reset UART handle gstate & RxState. More...
 
#define __HAL_UART_FLUSH_DRREGISTER(__HANDLE__)   ((__HANDLE__)->Instance->DR)
 Flushes the UART DR register. More...
 
#define __HAL_UART_GET_FLAG(__HANDLE__, __FLAG__)   (((__HANDLE__)->Instance->SR & (__FLAG__)) == (__FLAG__))
 Checks whether the specified UART flag is set or not. More...
 
#define __HAL_UART_CLEAR_FLAG(__HANDLE__, __FLAG__)   ((__HANDLE__)->Instance->SR = ~(__FLAG__))
 Clears the specified UART pending flag. More...
 
#define __HAL_UART_CLEAR_PEFLAG(__HANDLE__)
 Clear the UART PE pending flag. More...
 
#define __HAL_UART_CLEAR_FEFLAG(__HANDLE__)   __HAL_UART_CLEAR_PEFLAG(__HANDLE__)
 Clear the UART FE pending flag. More...
 
#define __HAL_UART_CLEAR_NEFLAG(__HANDLE__)   __HAL_UART_CLEAR_PEFLAG(__HANDLE__)
 Clear the UART NE pending flag. More...
 
#define __HAL_UART_CLEAR_OREFLAG(__HANDLE__)   __HAL_UART_CLEAR_PEFLAG(__HANDLE__)
 Clear the UART ORE pending flag. More...
 
#define __HAL_UART_CLEAR_IDLEFLAG(__HANDLE__)   __HAL_UART_CLEAR_PEFLAG(__HANDLE__)
 Clear the UART IDLE pending flag. More...
 
#define UART_IT_MASK   0x0000FFFFU
 Enable the specified UART interrupt. More...
 
#define __HAL_UART_ENABLE_IT(__HANDLE__, __INTERRUPT__)
 
#define __HAL_UART_DISABLE_IT(__HANDLE__, __INTERRUPT__)
 Disable the specified UART interrupt. More...
 
#define __HAL_UART_GET_IT_SOURCE(__HANDLE__, __IT__)
 Checks whether the specified UART interrupt has occurred or not. More...
 
#define __HAL_UART_HWCONTROL_CTS_ENABLE(__HANDLE__)
 Enable CTS flow control This macro allows to enable CTS hardware flow control for a given UART instance, without need to call HAL_UART_Init() function. As involving direct access to UART registers, usage of this macro should be fully endorsed by user. More...
 
#define __HAL_UART_HWCONTROL_CTS_DISABLE(__HANDLE__)
 Disable CTS flow control This macro allows to disable CTS hardware flow control for a given UART instance, without need to call HAL_UART_Init() function. As involving direct access to UART registers, usage of this macro should be fully endorsed by user. More...
 
#define __HAL_UART_HWCONTROL_RTS_ENABLE(__HANDLE__)
 Enable RTS flow control This macro allows to enable RTS hardware flow control for a given UART instance, without need to call HAL_UART_Init() function. As involving direct access to UART registers, usage of this macro should be fully endorsed by user. More...
 
#define __HAL_UART_HWCONTROL_RTS_DISABLE(__HANDLE__)
 Disable RTS flow control This macro allows to disable RTS hardware flow control for a given UART instance, without need to call HAL_UART_Init() function. As involving direct access to UART registers, usage of this macro should be fully endorsed by user. More...
 
#define __HAL_UART_ONE_BIT_SAMPLE_ENABLE(__HANDLE__)   ((__HANDLE__)->Instance->CR3|= USART_CR3_ONEBIT)
 macros to enables the UART's one bit sample method More...
 
#define __HAL_UART_ONE_BIT_SAMPLE_DISABLE(__HANDLE__)   ((__HANDLE__)->Instance->CR3 &= (uint16_t)~((uint16_t)USART_CR3_ONEBIT))
 macros to disables the UART's one bit sample method More...
 
#define __HAL_UART_ENABLE(__HANDLE__)   ((__HANDLE__)->Instance->CR1 |= USART_CR1_UE)
 Enable UART. More...
 
#define __HAL_UART_DISABLE(__HANDLE__)   ((__HANDLE__)->Instance->CR1 &= ~USART_CR1_UE)
 Disable UART. More...
 
#define UART_CR1_REG_INDEX   1U
 UART interruptions flag mask. More...
 
#define UART_CR2_REG_INDEX   2U
 
#define UART_CR3_REG_INDEX   3U
 
#define IS_UART_WORD_LENGTH(LENGTH)
 
#define IS_UART_LIN_WORD_LENGTH(LENGTH)   (((LENGTH) == UART_WORDLENGTH_8B))
 
#define IS_UART_STOPBITS(STOPBITS)
 
#define IS_UART_PARITY(PARITY)
 
#define IS_UART_HARDWARE_FLOW_CONTROL(CONTROL)
 
#define IS_UART_MODE(MODE)   ((((MODE) & 0x0000FFF3U) == 0x00U) && ((MODE) != 0x00U))
 
#define IS_UART_STATE(STATE)
 
#define IS_UART_OVERSAMPLING(SAMPLING)
 
#define IS_UART_LIN_OVERSAMPLING(SAMPLING)   (((SAMPLING) == UART_OVERSAMPLING_16))
 
#define IS_UART_LIN_BREAK_DETECT_LENGTH(LENGTH)
 
#define IS_UART_WAKEUPMETHOD(WAKEUP)
 
#define IS_UART_BAUDRATE(BAUDRATE)   ((BAUDRATE) < 10500001U)
 
#define IS_UART_ADDRESS(ADDRESS)   ((ADDRESS) <= 0x0FU)
 
#define UART_DIV_SAMPLING16(_PCLK_, _BAUD_)   (((_PCLK_)*25U)/(4U*(_BAUD_)))
 
#define UART_DIVMANT_SAMPLING16(_PCLK_, _BAUD_)   (UART_DIV_SAMPLING16((_PCLK_), (_BAUD_))/100U)
 
#define UART_DIVFRAQ_SAMPLING16(_PCLK_, _BAUD_)   (((UART_DIV_SAMPLING16((_PCLK_), (_BAUD_)) - (UART_DIVMANT_SAMPLING16((_PCLK_), (_BAUD_)) * 100U)) * 16U + 50U) / 100U)
 
#define UART_BRR_SAMPLING16(_PCLK_, _BAUD_)
 
#define UART_DIV_SAMPLING8(_PCLK_, _BAUD_)   (((_PCLK_)*25U)/(2U*(_BAUD_)))
 
#define UART_DIVMANT_SAMPLING8(_PCLK_, _BAUD_)   (UART_DIV_SAMPLING8((_PCLK_), (_BAUD_))/100U)
 
#define UART_DIVFRAQ_SAMPLING8(_PCLK_, _BAUD_)   (((UART_DIV_SAMPLING8((_PCLK_), (_BAUD_)) - (UART_DIVMANT_SAMPLING8((_PCLK_), (_BAUD_)) * 100U)) * 8U + 50U) / 100U)
 
#define UART_BRR_SAMPLING8(_PCLK_, _BAUD_)
 

Enumerations

enum  HAL_UART_StateTypeDef {
  HAL_UART_STATE_RESET = 0x00U, HAL_UART_STATE_READY = 0x20U, HAL_UART_STATE_BUSY = 0x24U, HAL_UART_STATE_BUSY_TX = 0x21U,
  HAL_UART_STATE_BUSY_RX = 0x22U, HAL_UART_STATE_BUSY_TX_RX = 0x23U, HAL_UART_STATE_TIMEOUT = 0xA0U, HAL_UART_STATE_ERROR = 0xE0U
}
 HAL UART State structures definition. More...
 

Functions

HAL_StatusTypeDef HAL_UART_Init (UART_HandleTypeDef *huart)
 
HAL_StatusTypeDef HAL_HalfDuplex_Init (UART_HandleTypeDef *huart)
 
HAL_StatusTypeDef HAL_LIN_Init (UART_HandleTypeDef *huart, uint32_t BreakDetectLength)
 
HAL_StatusTypeDef HAL_MultiProcessor_Init (UART_HandleTypeDef *huart, uint8_t Address, uint32_t WakeUpMethod)
 
HAL_StatusTypeDef HAL_UART_DeInit (UART_HandleTypeDef *huart)
 
void HAL_UART_MspInit (UART_HandleTypeDef *huart)
 UART MSP Initialization This function configures the hardware resources used in this example. More...
 
void HAL_UART_MspDeInit (UART_HandleTypeDef *huart)
 UART MSP De-Initialization This function freeze the hardware resources used in this example. More...
 
HAL_StatusTypeDef HAL_UART_Transmit (UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size, uint32_t Timeout)
 
HAL_StatusTypeDef HAL_UART_Receive (UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size, uint32_t Timeout)
 
HAL_StatusTypeDef HAL_UART_Transmit_IT (UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size)
 
HAL_StatusTypeDef HAL_UART_Receive_IT (UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size)
 
HAL_StatusTypeDef HAL_UART_Transmit_DMA (UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size)
 
HAL_StatusTypeDef HAL_UART_Receive_DMA (UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size)
 
HAL_StatusTypeDef HAL_UART_DMAPause (UART_HandleTypeDef *huart)
 
HAL_StatusTypeDef HAL_UART_DMAResume (UART_HandleTypeDef *huart)
 
HAL_StatusTypeDef HAL_UART_DMAStop (UART_HandleTypeDef *huart)
 
HAL_StatusTypeDef HAL_UART_Abort (UART_HandleTypeDef *huart)
 
HAL_StatusTypeDef HAL_UART_AbortTransmit (UART_HandleTypeDef *huart)
 
HAL_StatusTypeDef HAL_UART_AbortReceive (UART_HandleTypeDef *huart)
 
HAL_StatusTypeDef HAL_UART_Abort_IT (UART_HandleTypeDef *huart)
 
HAL_StatusTypeDef HAL_UART_AbortTransmit_IT (UART_HandleTypeDef *huart)
 
HAL_StatusTypeDef HAL_UART_AbortReceive_IT (UART_HandleTypeDef *huart)
 
void HAL_UART_IRQHandler (UART_HandleTypeDef *huart)
 
void HAL_UART_TxCpltCallback (UART_HandleTypeDef *huart)
 
void HAL_UART_TxHalfCpltCallback (UART_HandleTypeDef *huart)
 
void HAL_UART_RxCpltCallback (UART_HandleTypeDef *huart)
 
void HAL_UART_RxHalfCpltCallback (UART_HandleTypeDef *huart)
 
void HAL_UART_ErrorCallback (UART_HandleTypeDef *huart)
 
void HAL_UART_AbortCpltCallback (UART_HandleTypeDef *huart)
 
void HAL_UART_AbortTransmitCpltCallback (UART_HandleTypeDef *huart)
 
void HAL_UART_AbortReceiveCpltCallback (UART_HandleTypeDef *huart)
 
HAL_StatusTypeDef HAL_LIN_SendBreak (UART_HandleTypeDef *huart)
 
HAL_StatusTypeDef HAL_MultiProcessor_EnterMuteMode (UART_HandleTypeDef *huart)
 
HAL_StatusTypeDef HAL_MultiProcessor_ExitMuteMode (UART_HandleTypeDef *huart)
 
HAL_StatusTypeDef HAL_HalfDuplex_EnableTransmitter (UART_HandleTypeDef *huart)
 
HAL_StatusTypeDef HAL_HalfDuplex_EnableReceiver (UART_HandleTypeDef *huart)
 
HAL_UART_StateTypeDef HAL_UART_GetState (UART_HandleTypeDef *huart)
 
uint32_t HAL_UART_GetError (UART_HandleTypeDef *huart)
 

Detailed Description

Header file of UART HAL module.

Author
MCD Application Team
Attention

© COPYRIGHT(c) 2017 STMicroelectronics

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of STMicroelectronics nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.