annotate Common/Drivers/STM32F4xx_HAL_DRIVER_v120/Inc/stm32f4xx_hal_uart.h @ 55:a7683f9765da

Italian activated (needs some fine tuning), special characters (?,?,?,?,? and others) currently not working...
author heinrichsweikamp
date Tue, 07 Aug 2018 00:24:05 +0200
parents 5f11787b4f42
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3 * @file stm32f4xx_hal_uart.h
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4 * @author MCD Application Team
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
5 * @version V1.2.0
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
6 * @date 26-December-2014
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
7 * @brief Header file of UART HAL module.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
8 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
9 * @attention
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
10 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
11 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
12 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
13 * Redistribution and use in source and binary forms, with or without modification,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
14 * are permitted provided that the following conditions are met:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
15 * 1. Redistributions of source code must retain the above copyright notice,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
16 * this list of conditions and the following disclaimer.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
17 * 2. Redistributions in binary form must reproduce the above copyright notice,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
18 * this list of conditions and the following disclaimer in the documentation
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
19 * and/or other materials provided with the distribution.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
21 * may be used to endorse or promote products derived from this software
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
22 * without specific prior written permission.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
23 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
34 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
35 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
36 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
37
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
38 /* Define to prevent recursive inclusion -------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
39 #ifndef __STM32F4xx_HAL_UART_H
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
40 #define __STM32F4xx_HAL_UART_H
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
41
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
42 #ifdef __cplusplus
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
43 extern "C" {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
44 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
45
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
46 /* Includes ------------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
47 #include "stm32f4xx_hal_def.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
48
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
49 /** @addtogroup STM32F4xx_HAL_Driver
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
50 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
51 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
52
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
53 /** @addtogroup UART
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
54 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
55 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
56
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
57 /* Exported types ------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
58 /** @defgroup UART_Exported_Types UART Exported Types
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
59 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
60 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
61
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
62 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
63 * @brief UART Init Structure definition
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
64 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
65 typedef struct
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
66 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
67 uint32_t BaudRate; /*!< This member configures the UART communication baud rate.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
68 The baud rate is computed using the following formula:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
69 - IntegerDivider = ((PCLKx) / (8 * (OVR8+1) * (huart->Init.BaudRate)))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
70 - FractionalDivider = ((IntegerDivider - ((uint32_t) IntegerDivider)) * 8 * (OVR8+1)) + 0.5
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
71 Where OVR8 is the "oversampling by 8 mode" configuration bit in the CR1 register. */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
72
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
73 uint32_t WordLength; /*!< Specifies the number of data bits transmitted or received in a frame.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
74 This parameter can be a value of @ref UART_Word_Length */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
75
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
76 uint32_t StopBits; /*!< Specifies the number of stop bits transmitted.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
77 This parameter can be a value of @ref UART_Stop_Bits */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
78
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
79 uint32_t Parity; /*!< Specifies the parity mode.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
80 This parameter can be a value of @ref UART_Parity
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
81 @note When parity is enabled, the computed parity is inserted
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
82 at the MSB position of the transmitted data (9th bit when
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
83 the word length is set to 9 data bits; 8th bit when the
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
84 word length is set to 8 data bits). */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
85
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
86 uint32_t Mode; /*!< Specifies whether the Receive or Transmit mode is enabled or disabled.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
87 This parameter can be a value of @ref UART_Mode */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
88
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
89 uint32_t HwFlowCtl; /*!< Specifies whether the hardware flow control mode is enabled
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
90 or disabled.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
91 This parameter can be a value of @ref UART_Hardware_Flow_Control */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
92
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
93 uint32_t OverSampling; /*!< Specifies whether the Over sampling 8 is enabled or disabled, to achieve higher speed (up to fPCLK/8).
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
94 This parameter can be a value of @ref UART_Over_Sampling */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
95 }UART_InitTypeDef;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
96
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
97 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
98 * @brief HAL UART State structures definition
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
99 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
100 typedef enum
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
101 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
102 HAL_UART_STATE_RESET = 0x00, /*!< Peripheral is not yet Initialized */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
103 HAL_UART_STATE_READY = 0x01, /*!< Peripheral Initialized and ready for use */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
104 HAL_UART_STATE_BUSY = 0x02, /*!< an internal process is ongoing */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
105 HAL_UART_STATE_BUSY_TX = 0x12, /*!< Data Transmission process is ongoing */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
106 HAL_UART_STATE_BUSY_RX = 0x22, /*!< Data Reception process is ongoing */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
107 HAL_UART_STATE_BUSY_TX_RX = 0x32, /*!< Data Transmission and Reception process is ongoing */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
108 HAL_UART_STATE_TIMEOUT = 0x03, /*!< Timeout state */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
109 HAL_UART_STATE_ERROR = 0x04 /*!< Error */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
110 }HAL_UART_StateTypeDef;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
111
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
112 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
113 * @brief UART handle Structure definition
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
114 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
115 typedef struct
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
116 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
117 USART_TypeDef *Instance; /*!< UART registers base address */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
118
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
119 UART_InitTypeDef Init; /*!< UART communication parameters */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
120
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
121 uint8_t *pTxBuffPtr; /*!< Pointer to UART Tx transfer Buffer */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
122
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
123 uint16_t TxXferSize; /*!< UART Tx Transfer size */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
124
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
125 uint16_t TxXferCount; /*!< UART Tx Transfer Counter */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
126
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
127 uint8_t *pRxBuffPtr; /*!< Pointer to UART Rx transfer Buffer */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
128
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
129 uint16_t RxXferSize; /*!< UART Rx Transfer size */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
130
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
131 uint16_t RxXferCount; /*!< UART Rx Transfer Counter */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
132
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
133 DMA_HandleTypeDef *hdmatx; /*!< UART Tx DMA Handle parameters */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
134
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
135 DMA_HandleTypeDef *hdmarx; /*!< UART Rx DMA Handle parameters */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
136
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
137 HAL_LockTypeDef Lock; /*!< Locking object */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
138
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
139 __IO HAL_UART_StateTypeDef State; /*!< UART communication state */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
140
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
141 __IO uint32_t ErrorCode; /*!< UART Error code */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
142
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
143 }UART_HandleTypeDef;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
144 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
145 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
146 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
147
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
148 /* Exported constants --------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
149 /** @defgroup UART_Exported_Constants UART Exported constants
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
150 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
151 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
152
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
153 /** @defgroup UART_Error_Code UART Error Code
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
154 * @brief UART Error Code
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
155 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
156 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
157 #define HAL_UART_ERROR_NONE ((uint32_t)0x00000000) /*!< No error */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
158 #define HAL_UART_ERROR_PE ((uint32_t)0x00000001) /*!< Parity error */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
159 #define HAL_UART_ERROR_NE ((uint32_t)0x00000002) /*!< Noise error */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
160 #define HAL_UART_ERROR_FE ((uint32_t)0x00000004) /*!< Frame error */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
161 #define HAL_UART_ERROR_ORE ((uint32_t)0x00000008) /*!< Overrun error */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
162 #define HAL_UART_ERROR_DMA ((uint32_t)0x00000010) /*!< DMA transfer error */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
163 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
164 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
165 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
166
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
167 /** @defgroup UART_Word_Length UART Word Length
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
168 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
169 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
170 #define UART_WORDLENGTH_8B ((uint32_t)0x00000000)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
171 #define UART_WORDLENGTH_9B ((uint32_t)USART_CR1_M)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
172 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
173 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
174 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
175
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
176 /** @defgroup UART_Stop_Bits UART Number of Stop Bits
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
177 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
178 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
179 #define UART_STOPBITS_1 ((uint32_t)0x00000000)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
180 #define UART_STOPBITS_2 ((uint32_t)USART_CR2_STOP_1)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
181 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
182 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
183 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
184
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
185 /** @defgroup UART_Parity UART Parity
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
186 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
187 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
188 #define UART_PARITY_NONE ((uint32_t)0x00000000)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
189 #define UART_PARITY_EVEN ((uint32_t)USART_CR1_PCE)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
190 #define UART_PARITY_ODD ((uint32_t)(USART_CR1_PCE | USART_CR1_PS))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
191 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
192 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
193 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
194
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
195 /** @defgroup UART_Hardware_Flow_Control UART Hardware Flow Control
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
196 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
197 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
198 #define UART_HWCONTROL_NONE ((uint32_t)0x00000000)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
199 #define UART_HWCONTROL_RTS ((uint32_t)USART_CR3_RTSE)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
200 #define UART_HWCONTROL_CTS ((uint32_t)USART_CR3_CTSE)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
201 #define UART_HWCONTROL_RTS_CTS ((uint32_t)(USART_CR3_RTSE | USART_CR3_CTSE))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
202 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
203 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
204 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
205
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
206 /** @defgroup UART_Mode UART Transfer Mode
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
207 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
208 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
209 #define UART_MODE_RX ((uint32_t)USART_CR1_RE)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
210 #define UART_MODE_TX ((uint32_t)USART_CR1_TE)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
211 #define UART_MODE_TX_RX ((uint32_t)(USART_CR1_TE |USART_CR1_RE))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
212 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
213 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
214 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
215
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
216 /** @defgroup UART_State UART State
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
217 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
218 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
219 #define UART_STATE_DISABLE ((uint32_t)0x00000000)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
220 #define UART_STATE_ENABLE ((uint32_t)USART_CR1_UE)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
221 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
222 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
223 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
224
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
225 /** @defgroup UART_Over_Sampling UART Over Sampling
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
226 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
227 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
228 #define UART_OVERSAMPLING_16 ((uint32_t)0x00000000)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
229 #define UART_OVERSAMPLING_8 ((uint32_t)USART_CR1_OVER8)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
230 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
231 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
232 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
233
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
234 /** @defgroup UART_LIN_Break_Detection_Length UART LIN Break Detection Length
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
235 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
236 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
237 #define UART_LINBREAKDETECTLENGTH_10B ((uint32_t)0x00000000)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
238 #define UART_LINBREAKDETECTLENGTH_11B ((uint32_t)0x00000020)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
239 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
240 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
241 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
242
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
243 /** @defgroup UART_WakeUp_functions UART Wakeup Functions
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
244 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
245 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
246 #define UART_WAKEUPMETHOD_IDLELINE ((uint32_t)0x00000000)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
247 #define UART_WAKEUPMETHOD_ADDRESSMARK ((uint32_t)0x00000800)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
248 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
249 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
250 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
251
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
252 /** @defgroup UART_Flags UART FLags
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
253 * Elements values convention: 0xXXXX
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
254 * - 0xXXXX : Flag mask in the SR register
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
255 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
256 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
257 #define UART_FLAG_CTS ((uint32_t)USART_SR_CTS)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
258 #define UART_FLAG_LBD ((uint32_t)USART_SR_LBD)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
259 #define UART_FLAG_TXE ((uint32_t)USART_SR_TXE)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
260 #define UART_FLAG_TC ((uint32_t)USART_SR_TC)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
261 #define UART_FLAG_RXNE ((uint32_t)USART_SR_RXNE)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
262 #define UART_FLAG_IDLE ((uint32_t)USART_SR_IDLE)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
263 #define UART_FLAG_ORE ((uint32_t)USART_SR_ORE)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
264 #define UART_FLAG_NE ((uint32_t)USART_SR_NE)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
265 #define UART_FLAG_FE ((uint32_t)USART_SR_FE)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
266 #define UART_FLAG_PE ((uint32_t)USART_SR_PE)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
267 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
268 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
269 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
270
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
271 /** @defgroup UART_Interrupt_definition UART Interrupt Definitions
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
272 * Elements values convention: 0xY000XXXX
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
273 * - XXXX : Interrupt mask (16 bits) in the Y register
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
274 * - Y : Interrupt source register (2bits)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
275 * - 0001: CR1 register
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
276 * - 0010: CR2 register
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
277 * - 0011: CR3 register
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
278 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
279 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
280 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
281
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
282 #define UART_IT_PE ((uint32_t)(UART_CR1_REG_INDEX << 28 | USART_CR1_PEIE))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
283 #define UART_IT_TXE ((uint32_t)(UART_CR1_REG_INDEX << 28 | USART_CR1_TXEIE))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
284 #define UART_IT_TC ((uint32_t)(UART_CR1_REG_INDEX << 28 | USART_CR1_TCIE))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
285 #define UART_IT_RXNE ((uint32_t)(UART_CR1_REG_INDEX << 28 | USART_CR1_RXNEIE))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
286 #define UART_IT_IDLE ((uint32_t)(UART_CR1_REG_INDEX << 28 | USART_CR1_IDLEIE))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
287
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
288 #define UART_IT_LBD ((uint32_t)(UART_CR2_REG_INDEX << 28 | USART_CR2_LBDIE))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
289
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
290 #define UART_IT_CTS ((uint32_t)(UART_CR3_REG_INDEX << 28 | USART_CR3_CTSIE))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
291 #define UART_IT_ERR ((uint32_t)(UART_CR3_REG_INDEX << 28 | USART_CR3_EIE))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
292 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
293 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
294 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
295
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
296 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
297 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
298 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
299
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
300 /* Exported macro ------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
301 /** @defgroup UART_Exported_Macros UART Exported Macros
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
302 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
303 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
304
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
305 /** @brief Reset UART handle state
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
306 * @param __HANDLE__: specifies the UART Handle.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
307 * This parameter can be UARTx where x: 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
308 * UART peripheral.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
309 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
310 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
311 #define __HAL_UART_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_UART_STATE_RESET)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
312
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
313 /** @brief Flushes the UART DR register
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
314 * @param __HANDLE__: specifies the UART Handle.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
315 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
316 #define __HAL_UART_FLUSH_DRREGISTER(__HANDLE__) ((__HANDLE__)->Instance->DR)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
317
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
318 /** @brief Checks whether the specified UART flag is set or not.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
319 * @param __HANDLE__: specifies the UART Handle.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
320 * This parameter can be UARTx where x: 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
321 * UART peripheral.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
322 * @param __FLAG__: specifies the flag to check.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
323 * This parameter can be one of the following values:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
324 * @arg UART_FLAG_CTS: CTS Change flag (not available for UART4 and UART5)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
325 * @arg UART_FLAG_LBD: LIN Break detection flag
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
326 * @arg UART_FLAG_TXE: Transmit data register empty flag
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
327 * @arg UART_FLAG_TC: Transmission Complete flag
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
328 * @arg UART_FLAG_RXNE: Receive data register not empty flag
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
329 * @arg UART_FLAG_IDLE: Idle Line detection flag
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
330 * @arg UART_FLAG_ORE: Overrun Error flag
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
331 * @arg UART_FLAG_NE: Noise Error flag
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
332 * @arg UART_FLAG_FE: Framing Error flag
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
333 * @arg UART_FLAG_PE: Parity Error flag
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
334 * @retval The new state of __FLAG__ (TRUE or FALSE).
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
335 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
336
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
337 #define __HAL_UART_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->SR & (__FLAG__)) == (__FLAG__))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
338
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
339 /** @brief Clears the specified UART pending flag.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
340 * @param __HANDLE__: specifies the UART Handle.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
341 * This parameter can be UARTx where x: 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
342 * UART peripheral.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
343 * @param __FLAG__: specifies the flag to check.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
344 * This parameter can be any combination of the following values:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
345 * @arg UART_FLAG_CTS: CTS Change flag (not available for UART4 and UART5).
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
346 * @arg UART_FLAG_LBD: LIN Break detection flag.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
347 * @arg UART_FLAG_TC: Transmission Complete flag.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
348 * @arg UART_FLAG_RXNE: Receive data register not empty flag.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
349 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
350 * @note PE (Parity error), FE (Framing error), NE (Noise error), ORE (Overrun
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
351 * error) and IDLE (Idle line detected) flags are cleared by software
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
352 * sequence: a read operation to USART_SR register followed by a read
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
353 * operation to USART_DR register.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
354 * @note RXNE flag can be also cleared by a read to the USART_DR register.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
355 * @note TC flag can be also cleared by software sequence: a read operation to
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
356 * USART_SR register followed by a write operation to USART_DR register.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
357 * @note TXE flag is cleared only by a write to the USART_DR register.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
358 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
359 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
360 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
361 #define __HAL_UART_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->SR = ~(__FLAG__))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
362
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
363 /** @brief Clear the UART PE pending flag.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
364 * @param __HANDLE__: specifies the UART Handle.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
365 * This parameter can be UARTx where x: 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
366 * UART peripheral.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
367 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
368 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
369 #define __HAL_UART_CLEAR_PEFLAG(__HANDLE__) \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
370 do{ \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
371 __IO uint32_t tmpreg; \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
372 tmpreg = (__HANDLE__)->Instance->SR; \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
373 tmpreg = (__HANDLE__)->Instance->DR; \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
374 UNUSED(tmpreg); \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
375 } while(0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
376
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
377 /** @brief Clear the UART FE pending flag.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
378 * @param __HANDLE__: specifies the UART Handle.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
379 * This parameter can be UARTx where x: 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
380 * UART peripheral.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
381 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
382 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
383 #define __HAL_UART_CLEAR_FEFLAG(__HANDLE__) __HAL_UART_CLEAR_PEFLAG(__HANDLE__)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
384
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
385 /** @brief Clear the UART NE pending flag.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
386 * @param __HANDLE__: specifies the UART Handle.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
387 * This parameter can be UARTx where x: 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
388 * UART peripheral.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
389 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
390 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
391 #define __HAL_UART_CLEAR_NEFLAG(__HANDLE__) __HAL_UART_CLEAR_PEFLAG(__HANDLE__)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
392
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
393 /** @brief Clear the UART ORE pending flag.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
394 * @param __HANDLE__: specifies the UART Handle.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
395 * This parameter can be UARTx where x: 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
396 * UART peripheral.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
397 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
398 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
399 #define __HAL_UART_CLEAR_OREFLAG(__HANDLE__) __HAL_UART_CLEAR_PEFLAG(__HANDLE__)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
400
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
401 /** @brief Clear the UART IDLE pending flag.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
402 * @param __HANDLE__: specifies the UART Handle.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
403 * This parameter can be UARTx where x: 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
404 * UART peripheral.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
405 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
406 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
407 #define __HAL_UART_CLEAR_IDLEFLAG(__HANDLE__) __HAL_UART_CLEAR_PEFLAG(__HANDLE__)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
408
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
409 /** @brief Enable the specified UART interrupt.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
410 * @param __HANDLE__: specifies the UART Handle.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
411 * This parameter can be UARTx where x: 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
412 * UART peripheral.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
413 * @param __INTERRUPT__: specifies the UART interrupt source to enable.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
414 * This parameter can be one of the following values:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
415 * @arg UART_IT_CTS: CTS change interrupt
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
416 * @arg UART_IT_LBD: LIN Break detection interrupt
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
417 * @arg UART_IT_TXE: Transmit Data Register empty interrupt
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
418 * @arg UART_IT_TC: Transmission complete interrupt
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
419 * @arg UART_IT_RXNE: Receive Data register not empty interrupt
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
420 * @arg UART_IT_IDLE: Idle line detection interrupt
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
421 * @arg UART_IT_PE: Parity Error interrupt
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
422 * @arg UART_IT_ERR: Error interrupt(Frame error, noise error, overrun error)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
423 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
424 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
425 #define UART_IT_MASK ((uint32_t)0x0000FFFF)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
426 #define __HAL_UART_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((((__INTERRUPT__) >> 28) == 1)? ((__HANDLE__)->Instance->CR1 |= ((__INTERRUPT__) & UART_IT_MASK)): \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
427 (((__INTERRUPT__) >> 28) == 2)? ((__HANDLE__)->Instance->CR2 |= ((__INTERRUPT__) & UART_IT_MASK)): \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
428 ((__HANDLE__)->Instance->CR3 |= ((__INTERRUPT__) & UART_IT_MASK)))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
429 /** @brief Disable the specified UART interrupt.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
430 * @param __HANDLE__: specifies the UART Handle.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
431 * This parameter can be UARTx where x: 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
432 * UART peripheral.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
433 * @param __INTERRUPT__: specifies the UART interrupt source to disable.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
434 * This parameter can be one of the following values:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
435 * @arg UART_IT_CTS: CTS change interrupt
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
436 * @arg UART_IT_LBD: LIN Break detection interrupt
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
437 * @arg UART_IT_TXE: Transmit Data Register empty interrupt
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
438 * @arg UART_IT_TC: Transmission complete interrupt
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
439 * @arg UART_IT_RXNE: Receive Data register not empty interrupt
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
440 * @arg UART_IT_IDLE: Idle line detection interrupt
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
441 * @arg UART_IT_PE: Parity Error interrupt
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
442 * @arg UART_IT_ERR: Error interrupt(Frame error, noise error, overrun error)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
443 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
444 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
445 #define __HAL_UART_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((((__INTERRUPT__) >> 28) == 1)? ((__HANDLE__)->Instance->CR1 &= ~((__INTERRUPT__) & UART_IT_MASK)): \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
446 (((__INTERRUPT__) >> 28) == 2)? ((__HANDLE__)->Instance->CR2 &= ~((__INTERRUPT__) & UART_IT_MASK)): \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
447 ((__HANDLE__)->Instance->CR3 &= ~ ((__INTERRUPT__) & UART_IT_MASK)))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
448
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
449 /** @brief Checks whether the specified UART interrupt has occurred or not.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
450 * @param __HANDLE__: specifies the UART Handle.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
451 * This parameter can be UARTx where x: 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
452 * UART peripheral.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
453 * @param __IT__: specifies the UART interrupt source to check.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
454 * This parameter can be one of the following values:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
455 * @arg UART_IT_CTS: CTS change interrupt (not available for UART4 and UART5)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
456 * @arg UART_IT_LBD: LIN Break detection interrupt
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
457 * @arg UART_IT_TXE: Transmit Data Register empty interrupt
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
458 * @arg UART_IT_TC: Transmission complete interrupt
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
459 * @arg UART_IT_RXNE: Receive Data register not empty interrupt
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
460 * @arg UART_IT_IDLE: Idle line detection interrupt
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
461 * @arg USART_IT_ERR: Error interrupt
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
462 * @retval The new state of __IT__ (TRUE or FALSE).
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
463 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
464 #define __HAL_UART_GET_IT_SOURCE(__HANDLE__, __IT__) (((((__IT__) >> 28) == 1)? (__HANDLE__)->Instance->CR1:(((((uint32_t)(__IT__)) >> 28) == 2)? \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
465 (__HANDLE__)->Instance->CR2 : (__HANDLE__)->Instance->CR3)) & (((uint32_t)(__IT__)) & UART_IT_MASK))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
466
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
467 /** @brief Enable CTS flow control
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
468 * This macro allows to enable CTS hardware flow control for a given UART instance,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
469 * without need to call HAL_UART_Init() function.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
470 * As involving direct access to UART registers, usage of this macro should be fully endorsed by user.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
471 * @note As macro is expected to be used for modifying CTS Hw flow control feature activation, without need
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
472 * for USART instance Deinit/Init, following conditions for macro call should be fulfilled :
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
473 * - UART instance should have already been initialised (through call of HAL_UART_Init() )
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
474 * - macro could only be called when corresponding UART instance is disabled (i.e __HAL_UART_DISABLE(__HANDLE__))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
475 * and should be followed by an Enable macro (i.e __HAL_UART_ENABLE(__HANDLE__)).
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
476 * @param __HANDLE__: specifies the UART Handle.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
477 * The Handle Instance can be USART1, USART2 or LPUART.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
478 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
479 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
480 #define __HAL_UART_HWCONTROL_CTS_ENABLE(__HANDLE__) \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
481 do{ \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
482 SET_BIT((__HANDLE__)->Instance->CR3, USART_CR3_CTSE); \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
483 (__HANDLE__)->Init.HwFlowCtl |= USART_CR3_CTSE; \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
484 } while(0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
485
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
486 /** @brief Disable CTS flow control
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
487 * This macro allows to disable CTS hardware flow control for a given UART instance,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
488 * without need to call HAL_UART_Init() function.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
489 * As involving direct access to UART registers, usage of this macro should be fully endorsed by user.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
490 * @note As macro is expected to be used for modifying CTS Hw flow control feature activation, without need
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
491 * for USART instance Deinit/Init, following conditions for macro call should be fulfilled :
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
492 * - UART instance should have already been initialised (through call of HAL_UART_Init() )
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
493 * - macro could only be called when corresponding UART instance is disabled (i.e __HAL_UART_DISABLE(__HANDLE__))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
494 * and should be followed by an Enable macro (i.e __HAL_UART_ENABLE(__HANDLE__)).
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
495 * @param __HANDLE__: specifies the UART Handle.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
496 * The Handle Instance can be USART1, USART2 or LPUART.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
497 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
498 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
499 #define __HAL_UART_HWCONTROL_CTS_DISABLE(__HANDLE__) \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
500 do{ \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
501 CLEAR_BIT((__HANDLE__)->Instance->CR3, USART_CR3_CTSE); \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
502 (__HANDLE__)->Init.HwFlowCtl &= ~(USART_CR3_CTSE); \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
503 } while(0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
504
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
505 /** @brief Enable RTS flow control
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
506 * This macro allows to enable RTS hardware flow control for a given UART instance,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
507 * without need to call HAL_UART_Init() function.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
508 * As involving direct access to UART registers, usage of this macro should be fully endorsed by user.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
509 * @note As macro is expected to be used for modifying RTS Hw flow control feature activation, without need
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
510 * for USART instance Deinit/Init, following conditions for macro call should be fulfilled :
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
511 * - UART instance should have already been initialised (through call of HAL_UART_Init() )
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
512 * - macro could only be called when corresponding UART instance is disabled (i.e __HAL_UART_DISABLE(__HANDLE__))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
513 * and should be followed by an Enable macro (i.e __HAL_UART_ENABLE(__HANDLE__)).
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
514 * @param __HANDLE__: specifies the UART Handle.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
515 * The Handle Instance can be USART1, USART2 or LPUART.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
516 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
517 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
518 #define __HAL_UART_HWCONTROL_RTS_ENABLE(__HANDLE__) \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
519 do{ \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
520 SET_BIT((__HANDLE__)->Instance->CR3, USART_CR3_RTSE); \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
521 (__HANDLE__)->Init.HwFlowCtl |= USART_CR3_RTSE; \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
522 } while(0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
523
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
524 /** @brief Disable RTS flow control
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
525 * This macro allows to disable RTS hardware flow control for a given UART instance,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
526 * without need to call HAL_UART_Init() function.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
527 * As involving direct access to UART registers, usage of this macro should be fully endorsed by user.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
528 * @note As macro is expected to be used for modifying RTS Hw flow control feature activation, without need
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
529 * for USART instance Deinit/Init, following conditions for macro call should be fulfilled :
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
530 * - UART instance should have already been initialised (through call of HAL_UART_Init() )
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
531 * - macro could only be called when corresponding UART instance is disabled (i.e __HAL_UART_DISABLE(__HANDLE__))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
532 * and should be followed by an Enable macro (i.e __HAL_UART_ENABLE(__HANDLE__)).
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
533 * @param __HANDLE__: specifies the UART Handle.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
534 * The Handle Instance can be USART1, USART2 or LPUART.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
535 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
536 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
537 #define __HAL_UART_HWCONTROL_RTS_DISABLE(__HANDLE__) \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
538 do{ \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
539 CLEAR_BIT((__HANDLE__)->Instance->CR3, USART_CR3_RTSE);\
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
540 (__HANDLE__)->Init.HwFlowCtl &= ~(USART_CR3_RTSE); \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
541 } while(0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
542
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
543 /** @brief macros to enables the UART's one bit sample method
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
544 * @param __HANDLE__: specifies the UART Handle.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
545 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
546 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
547 #define __HAL_UART_ONE_BIT_SAMPLE_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR3|= USART_CR3_ONEBIT)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
548
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
549 /** @brief macros to disables the UART's one bit sample method
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
550 * @param __HANDLE__: specifies the UART Handle.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
551 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
552 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
553 #define __HAL_UART_ONE_BIT_SAMPLE_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR3 &= (uint16_t)~((uint16_t)USART_CR3_ONEBIT))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
554
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
555 /** @brief Enable UART
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
556 * @param __HANDLE__: specifies the UART Handle.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
557 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
558 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
559 #define __HAL_UART_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 |= USART_CR1_UE)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
560
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
561 /** @brief Disable UART
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
562 * @param __HANDLE__: specifies the UART Handle.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
563 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
564 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
565 #define __HAL_UART_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 &= ~USART_CR1_UE)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
566 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
567 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
568 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
569
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
570 /* Exported functions --------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
571 /** @addtogroup UART_Exported_Functions
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
572 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
573 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
574
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
575 /** @addtogroup UART_Exported_Functions_Group1
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
576 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
577 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
578 /* Initialization/de-initialization functions **********************************/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
579 HAL_StatusTypeDef HAL_UART_Init(UART_HandleTypeDef *huart);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
580 HAL_StatusTypeDef HAL_HalfDuplex_Init(UART_HandleTypeDef *huart);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
581 HAL_StatusTypeDef HAL_LIN_Init(UART_HandleTypeDef *huart, uint32_t BreakDetectLength);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
582 HAL_StatusTypeDef HAL_MultiProcessor_Init(UART_HandleTypeDef *huart, uint8_t Address, uint32_t WakeUpMethod);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
583 HAL_StatusTypeDef HAL_UART_DeInit (UART_HandleTypeDef *huart);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
584 void HAL_UART_MspInit(UART_HandleTypeDef *huart);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
585 void HAL_UART_MspDeInit(UART_HandleTypeDef *huart);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
586 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
587 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
588 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
589
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
590 /** @addtogroup UART_Exported_Functions_Group2
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
591 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
592 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
593 /* IO operation functions *******************************************************/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
594 HAL_StatusTypeDef HAL_UART_Transmit(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size, uint32_t Timeout);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
595 HAL_StatusTypeDef HAL_UART_Receive(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size, uint32_t Timeout);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
596 HAL_StatusTypeDef HAL_UART_Transmit_IT(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
597 HAL_StatusTypeDef HAL_UART_Receive_IT(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
598 HAL_StatusTypeDef HAL_UART_Transmit_DMA(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
599 HAL_StatusTypeDef HAL_UART_Receive_DMA(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
600 HAL_StatusTypeDef HAL_UART_DMAPause(UART_HandleTypeDef *huart);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
601 HAL_StatusTypeDef HAL_UART_DMAResume(UART_HandleTypeDef *huart);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
602 HAL_StatusTypeDef HAL_UART_DMAStop(UART_HandleTypeDef *huart);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
603 void HAL_UART_IRQHandler(UART_HandleTypeDef *huart);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
604 void HAL_UART_TxCpltCallback(UART_HandleTypeDef *huart);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
605 void HAL_UART_TxHalfCpltCallback(UART_HandleTypeDef *huart);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
606 void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
607 void HAL_UART_RxHalfCpltCallback(UART_HandleTypeDef *huart);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
608 void HAL_UART_ErrorCallback(UART_HandleTypeDef *huart);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
609 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
610 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
611 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
612
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
613 /** @addtogroup UART_Exported_Functions_Group3
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
614 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
615 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
616 /* Peripheral Control functions ************************************************/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
617 HAL_StatusTypeDef HAL_LIN_SendBreak(UART_HandleTypeDef *huart);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
618 HAL_StatusTypeDef HAL_MultiProcessor_EnterMuteMode(UART_HandleTypeDef *huart);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
619 HAL_StatusTypeDef HAL_MultiProcessor_ExitMuteMode(UART_HandleTypeDef *huart);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
620 HAL_StatusTypeDef HAL_HalfDuplex_EnableTransmitter(UART_HandleTypeDef *huart);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
621 HAL_StatusTypeDef HAL_HalfDuplex_EnableReceiver(UART_HandleTypeDef *huart);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
622 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
623 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
624 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
625
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
626 /** @addtogroup UART_Exported_Functions_Group4
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
627 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
628 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
629 /* Peripheral State functions **************************************************/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
630 HAL_UART_StateTypeDef HAL_UART_GetState(UART_HandleTypeDef *huart);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
631 uint32_t HAL_UART_GetError(UART_HandleTypeDef *huart);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
632 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
633 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
634 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
635
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
636 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
637 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
638 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
639 /* Private types -------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
640 /* Private variables ---------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
641 /* Private constants ---------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
642 /** @defgroup UART_Private_Constants UART Private Constants
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
643 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
644 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
645 /** @brief UART interruptions flag mask
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
646 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
647 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
648 #define UART_CR1_REG_INDEX 1
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
649 #define UART_CR2_REG_INDEX 2
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
650 #define UART_CR3_REG_INDEX 3
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
651 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
652 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
653 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
654
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
655 /* Private macros ------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
656 /** @defgroup UART_Private_Macros UART Private Macros
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
657 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
658 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
659 #define IS_UART_WORD_LENGTH(LENGTH) (((LENGTH) == UART_WORDLENGTH_8B) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
660 ((LENGTH) == UART_WORDLENGTH_9B))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
661 #define IS_UART_LIN_WORD_LENGTH(LENGTH) (((LENGTH) == UART_WORDLENGTH_8B))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
662 #define IS_UART_STOPBITS(STOPBITS) (((STOPBITS) == UART_STOPBITS_1) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
663 ((STOPBITS) == UART_STOPBITS_2))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
664 #define IS_UART_PARITY(PARITY) (((PARITY) == UART_PARITY_NONE) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
665 ((PARITY) == UART_PARITY_EVEN) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
666 ((PARITY) == UART_PARITY_ODD))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
667 #define IS_UART_HARDWARE_FLOW_CONTROL(CONTROL)\
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
668 (((CONTROL) == UART_HWCONTROL_NONE) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
669 ((CONTROL) == UART_HWCONTROL_RTS) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
670 ((CONTROL) == UART_HWCONTROL_CTS) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
671 ((CONTROL) == UART_HWCONTROL_RTS_CTS))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
672 #define IS_UART_MODE(MODE) ((((MODE) & (uint32_t)0x0000FFF3) == 0x00) && ((MODE) != (uint32_t)0x000000))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
673 #define IS_UART_STATE(STATE) (((STATE) == UART_STATE_DISABLE) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
674 ((STATE) == UART_STATE_ENABLE))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
675 #define IS_UART_OVERSAMPLING(SAMPLING) (((SAMPLING) == UART_OVERSAMPLING_16) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
676 ((SAMPLING) == UART_OVERSAMPLING_8))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
677 #define IS_UART_LIN_OVERSAMPLING(SAMPLING) (((SAMPLING) == UART_OVERSAMPLING_16))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
678 #define IS_UART_LIN_BREAK_DETECT_LENGTH(LENGTH) (((LENGTH) == UART_LINBREAKDETECTLENGTH_10B) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
679 ((LENGTH) == UART_LINBREAKDETECTLENGTH_11B))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
680 #define IS_UART_WAKEUPMETHOD(WAKEUP) (((WAKEUP) == UART_WAKEUPMETHOD_IDLELINE) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
681 ((WAKEUP) == UART_WAKEUPMETHOD_ADDRESSMARK))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
682 #define IS_UART_BAUDRATE(BAUDRATE) ((BAUDRATE) < 10500001)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
683 #define IS_UART_ADDRESS(ADDRESS) ((ADDRESS) <= 0xF)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
684
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
685 #define UART_DIV_SAMPLING16(_PCLK_, _BAUD_) (((_PCLK_)*25)/(4*(_BAUD_)))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
686 #define UART_DIVMANT_SAMPLING16(_PCLK_, _BAUD_) (UART_DIV_SAMPLING16((_PCLK_), (_BAUD_))/100)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
687 #define UART_DIVFRAQ_SAMPLING16(_PCLK_, _BAUD_) (((UART_DIV_SAMPLING16((_PCLK_), (_BAUD_)) - (UART_DIVMANT_SAMPLING16((_PCLK_), (_BAUD_)) * 100)) * 16 + 50) / 100)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
688 #define UART_BRR_SAMPLING16(_PCLK_, _BAUD_) ((UART_DIVMANT_SAMPLING16((_PCLK_), (_BAUD_)) << 4)|(UART_DIVFRAQ_SAMPLING16((_PCLK_), (_BAUD_)) & 0x0F))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
689
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
690 #define UART_DIV_SAMPLING8(_PCLK_, _BAUD_) (((_PCLK_)*25)/(2*(_BAUD_)))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
691 #define UART_DIVMANT_SAMPLING8(_PCLK_, _BAUD_) (UART_DIV_SAMPLING8((_PCLK_), (_BAUD_))/100)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
692 #define UART_DIVFRAQ_SAMPLING8(_PCLK_, _BAUD_) (((UART_DIV_SAMPLING8((_PCLK_), (_BAUD_)) - (UART_DIVMANT_SAMPLING8((_PCLK_), (_BAUD_)) * 100)) * 16 + 50) / 100)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
693 #define UART_BRR_SAMPLING8(_PCLK_, _BAUD_) ((UART_DIVMANT_SAMPLING8((_PCLK_), (_BAUD_)) << 4)|(UART_DIVFRAQ_SAMPLING8((_PCLK_), (_BAUD_)) & 0x0F))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
694
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
695 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
696 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
697 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
698
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
699 /* Private functions ---------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
700 /** @defgroup UART_Private_Functions UART Private Functions
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
701 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
702 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
703
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
704 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
705 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
706 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
707
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
708 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
709 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
710 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
711
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
712 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
713 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
714 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
715
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
716 #ifdef __cplusplus
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
717 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
718 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
719
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
720 #endif /* __STM32F4xx_HAL_UART_H */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
721
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
722 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/