mbed library sources

Fork of mbed-src by mbed official

Committer:
mbed_official
Date:
Fri May 30 15:30:09 2014 +0100
Revision:
218:44081b78fdc2
Parent:
205:c41fc65bcfb4
Synchronized with git revision d854859072d318241476ccc5f335965444d4c1d8

Full URL: https://github.com/mbedmicro/mbed/commit/d854859072d318241476ccc5f335965444d4c1d8/

[NUCLEO_F072RB] Update CubeF0 HAL driver

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 205:c41fc65bcfb4 1 /**
mbed_official 205:c41fc65bcfb4 2 ******************************************************************************
mbed_official 205:c41fc65bcfb4 3 * @file stm32f0xx_hal_usart.h
mbed_official 205:c41fc65bcfb4 4 * @author MCD Application Team
mbed_official 205:c41fc65bcfb4 5 * @version V1.0.0
mbed_official 218:44081b78fdc2 6 * @date 28-May-2014
mbed_official 205:c41fc65bcfb4 7 * @brief Header file of USART HAL module.
mbed_official 205:c41fc65bcfb4 8 ******************************************************************************
mbed_official 205:c41fc65bcfb4 9 * @attention
mbed_official 205:c41fc65bcfb4 10 *
mbed_official 205:c41fc65bcfb4 11 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
mbed_official 205:c41fc65bcfb4 12 *
mbed_official 205:c41fc65bcfb4 13 * Redistribution and use in source and binary forms, with or without modification,
mbed_official 205:c41fc65bcfb4 14 * are permitted provided that the following conditions are met:
mbed_official 205:c41fc65bcfb4 15 * 1. Redistributions of source code must retain the above copyright notice,
mbed_official 205:c41fc65bcfb4 16 * this list of conditions and the following disclaimer.
mbed_official 205:c41fc65bcfb4 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
mbed_official 205:c41fc65bcfb4 18 * this list of conditions and the following disclaimer in the documentation
mbed_official 205:c41fc65bcfb4 19 * and/or other materials provided with the distribution.
mbed_official 205:c41fc65bcfb4 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
mbed_official 205:c41fc65bcfb4 21 * may be used to endorse or promote products derived from this software
mbed_official 205:c41fc65bcfb4 22 * without specific prior written permission.
mbed_official 205:c41fc65bcfb4 23 *
mbed_official 205:c41fc65bcfb4 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
mbed_official 205:c41fc65bcfb4 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
mbed_official 205:c41fc65bcfb4 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
mbed_official 205:c41fc65bcfb4 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
mbed_official 205:c41fc65bcfb4 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
mbed_official 205:c41fc65bcfb4 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
mbed_official 205:c41fc65bcfb4 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
mbed_official 205:c41fc65bcfb4 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
mbed_official 205:c41fc65bcfb4 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
mbed_official 205:c41fc65bcfb4 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
mbed_official 205:c41fc65bcfb4 34 *
mbed_official 205:c41fc65bcfb4 35 ******************************************************************************
mbed_official 205:c41fc65bcfb4 36 */
mbed_official 205:c41fc65bcfb4 37
mbed_official 205:c41fc65bcfb4 38 /* Define to prevent recursive inclusion -------------------------------------*/
mbed_official 205:c41fc65bcfb4 39 #ifndef __STM32F0xx_HAL_USART_H
mbed_official 205:c41fc65bcfb4 40 #define __STM32F0xx_HAL_USART_H
mbed_official 205:c41fc65bcfb4 41
mbed_official 205:c41fc65bcfb4 42 #ifdef __cplusplus
mbed_official 205:c41fc65bcfb4 43 extern "C" {
mbed_official 205:c41fc65bcfb4 44 #endif
mbed_official 205:c41fc65bcfb4 45
mbed_official 205:c41fc65bcfb4 46 /* Includes ------------------------------------------------------------------*/
mbed_official 205:c41fc65bcfb4 47 #include "stm32f0xx_hal_def.h"
mbed_official 205:c41fc65bcfb4 48
mbed_official 205:c41fc65bcfb4 49 /** @addtogroup STM32F0xx_HAL_Driver
mbed_official 205:c41fc65bcfb4 50 * @{
mbed_official 205:c41fc65bcfb4 51 */
mbed_official 205:c41fc65bcfb4 52
mbed_official 205:c41fc65bcfb4 53 /** @addtogroup USART
mbed_official 205:c41fc65bcfb4 54 * @{
mbed_official 205:c41fc65bcfb4 55 */
mbed_official 205:c41fc65bcfb4 56
mbed_official 205:c41fc65bcfb4 57 /* Exported types ------------------------------------------------------------*/
mbed_official 205:c41fc65bcfb4 58
mbed_official 205:c41fc65bcfb4 59 /**
mbed_official 205:c41fc65bcfb4 60 * @brief USART Init Structure definition
mbed_official 205:c41fc65bcfb4 61 */
mbed_official 205:c41fc65bcfb4 62 typedef struct
mbed_official 205:c41fc65bcfb4 63 {
mbed_official 205:c41fc65bcfb4 64 uint32_t BaudRate; /*!< This member configures the Usart communication baud rate.
mbed_official 205:c41fc65bcfb4 65 The baud rate is computed using the following formula:
mbed_official 205:c41fc65bcfb4 66 Baud Rate Register = ((PCLKx) / ((huart->Init.BaudRate))) */
mbed_official 205:c41fc65bcfb4 67
mbed_official 205:c41fc65bcfb4 68 uint32_t WordLength; /*!< Specifies the number of data bits transmitted or received in a frame.
mbed_official 205:c41fc65bcfb4 69 This parameter can be a value of @ref USARTEx_Word_Length */
mbed_official 205:c41fc65bcfb4 70
mbed_official 205:c41fc65bcfb4 71 uint16_t StopBits; /*!< Specifies the number of stop bits transmitted.
mbed_official 205:c41fc65bcfb4 72 This parameter can be a value of @ref USART_Stop_Bits */
mbed_official 205:c41fc65bcfb4 73
mbed_official 205:c41fc65bcfb4 74 uint16_t Parity; /*!< Specifies the parity mode.
mbed_official 205:c41fc65bcfb4 75 This parameter can be a value of @ref USART_Parity
mbed_official 205:c41fc65bcfb4 76 @note When parity is enabled, the computed parity is inserted
mbed_official 205:c41fc65bcfb4 77 at the MSB position of the transmitted data (9th bit when
mbed_official 205:c41fc65bcfb4 78 the word length is set to 9 data bits; 8th bit when the
mbed_official 205:c41fc65bcfb4 79 word length is set to 8 data bits). */
mbed_official 205:c41fc65bcfb4 80
mbed_official 205:c41fc65bcfb4 81 uint16_t Mode; /*!< Specifies wether the Receive or Transmit mode is enabled or disabled.
mbed_official 205:c41fc65bcfb4 82 This parameter can be a value of @ref USART_Mode */
mbed_official 205:c41fc65bcfb4 83
mbed_official 205:c41fc65bcfb4 84 uint16_t CLKPolarity; /*!< Specifies the steady state of the serial clock.
mbed_official 205:c41fc65bcfb4 85 This parameter can be a value of @ref USART_Clock_Polarity */
mbed_official 205:c41fc65bcfb4 86
mbed_official 205:c41fc65bcfb4 87 uint16_t CLKPhase; /*!< Specifies the clock transition on which the bit capture is made.
mbed_official 205:c41fc65bcfb4 88 This parameter can be a value of @ref USART_Clock_Phase */
mbed_official 205:c41fc65bcfb4 89
mbed_official 205:c41fc65bcfb4 90 uint16_t CLKLastBit; /*!< Specifies whether the clock pulse corresponding to the last transmitted
mbed_official 205:c41fc65bcfb4 91 data bit (MSB) has to be output on the SCLK pin in synchronous mode.
mbed_official 205:c41fc65bcfb4 92 This parameter can be a value of @ref USART_Last_Bit */
mbed_official 205:c41fc65bcfb4 93 }USART_InitTypeDef;
mbed_official 205:c41fc65bcfb4 94
mbed_official 205:c41fc65bcfb4 95 /**
mbed_official 205:c41fc65bcfb4 96 * @brief HAL State structures definition
mbed_official 205:c41fc65bcfb4 97 */
mbed_official 205:c41fc65bcfb4 98 typedef enum
mbed_official 205:c41fc65bcfb4 99 {
mbed_official 205:c41fc65bcfb4 100 HAL_USART_STATE_RESET = 0x00, /*!< Peripheral is not initialized */
mbed_official 205:c41fc65bcfb4 101 HAL_USART_STATE_READY = 0x01, /*!< Peripheral Initialized and ready for use */
mbed_official 205:c41fc65bcfb4 102 HAL_USART_STATE_BUSY = 0x02, /*!< an internal process is ongoing */
mbed_official 205:c41fc65bcfb4 103 HAL_USART_STATE_BUSY_TX = 0x12, /*!< Data Transmission process is ongoing */
mbed_official 205:c41fc65bcfb4 104 HAL_USART_STATE_BUSY_RX = 0x22, /*!< Data Reception process is ongoing */
mbed_official 205:c41fc65bcfb4 105 HAL_USART_STATE_BUSY_TX_RX = 0x32, /*!< Data Transmission Reception process is ongoing */
mbed_official 205:c41fc65bcfb4 106 HAL_USART_STATE_TIMEOUT = 0x03, /*!< Timeout state */
mbed_official 205:c41fc65bcfb4 107 HAL_USART_STATE_ERROR = 0x04 /*!< Error */
mbed_official 205:c41fc65bcfb4 108 }HAL_USART_StateTypeDef;
mbed_official 205:c41fc65bcfb4 109
mbed_official 205:c41fc65bcfb4 110 /**
mbed_official 205:c41fc65bcfb4 111 * @brief HAL USART Error Code structure definition
mbed_official 205:c41fc65bcfb4 112 */
mbed_official 205:c41fc65bcfb4 113 typedef enum
mbed_official 205:c41fc65bcfb4 114 {
mbed_official 205:c41fc65bcfb4 115 HAL_USART_ERROR_NONE = 0x00, /*!< No error */
mbed_official 205:c41fc65bcfb4 116 HAL_USART_ERROR_PE = 0x01, /*!< Parity error */
mbed_official 205:c41fc65bcfb4 117 HAL_USART_ERROR_NE = 0x02, /*!< Noise error */
mbed_official 205:c41fc65bcfb4 118 HAL_USART_ERROR_FE = 0x04, /*!< frame error */
mbed_official 205:c41fc65bcfb4 119 HAL_USART_ERROR_ORE = 0x08, /*!< Overrun error */
mbed_official 205:c41fc65bcfb4 120 HAL_USART_ERROR_DMA = 0x10 /*!< DMA transfer error */
mbed_official 205:c41fc65bcfb4 121 }HAL_USART_ErrorTypeDef;
mbed_official 205:c41fc65bcfb4 122
mbed_official 205:c41fc65bcfb4 123 /**
mbed_official 205:c41fc65bcfb4 124 * @brief USART clock sources definitions
mbed_official 205:c41fc65bcfb4 125 */
mbed_official 205:c41fc65bcfb4 126 typedef enum
mbed_official 205:c41fc65bcfb4 127 {
mbed_official 205:c41fc65bcfb4 128 USART_CLOCKSOURCE_PCLK1 = 0x00, /*!< PCLK1 clock source */
mbed_official 205:c41fc65bcfb4 129 USART_CLOCKSOURCE_HSI = 0x02, /*!< HSI clock source */
mbed_official 205:c41fc65bcfb4 130 USART_CLOCKSOURCE_SYSCLK = 0x04, /*!< SYSCLK clock source */
mbed_official 205:c41fc65bcfb4 131 USART_CLOCKSOURCE_LSE = 0x08, /*!< LSE clock source */
mbed_official 205:c41fc65bcfb4 132 USART_CLOCKSOURCE_UNDEFINED = 0x10 /*!< undefined clock source */
mbed_official 205:c41fc65bcfb4 133 }USART_ClockSourceTypeDef;
mbed_official 205:c41fc65bcfb4 134
mbed_official 205:c41fc65bcfb4 135 /**
mbed_official 205:c41fc65bcfb4 136 * @brief USART handle Structure definition
mbed_official 205:c41fc65bcfb4 137 */
mbed_official 205:c41fc65bcfb4 138 typedef struct
mbed_official 205:c41fc65bcfb4 139 {
mbed_official 205:c41fc65bcfb4 140 USART_TypeDef *Instance; /* USART registers base address */
mbed_official 205:c41fc65bcfb4 141
mbed_official 205:c41fc65bcfb4 142 USART_InitTypeDef Init; /* USART communication parameters */
mbed_official 205:c41fc65bcfb4 143
mbed_official 205:c41fc65bcfb4 144 uint8_t *pTxBuffPtr; /* Pointer to USART Tx transfer Buffer */
mbed_official 205:c41fc65bcfb4 145
mbed_official 205:c41fc65bcfb4 146 uint16_t TxXferSize; /* USART Tx Transfer size */
mbed_official 205:c41fc65bcfb4 147
mbed_official 205:c41fc65bcfb4 148 uint16_t TxXferCount; /* USART Tx Transfer Counter */
mbed_official 205:c41fc65bcfb4 149
mbed_official 205:c41fc65bcfb4 150 uint8_t *pRxBuffPtr; /* Pointer to USART Rx transfer Buffer */
mbed_official 205:c41fc65bcfb4 151
mbed_official 205:c41fc65bcfb4 152 uint16_t RxXferSize; /* USART Rx Transfer size */
mbed_official 205:c41fc65bcfb4 153
mbed_official 205:c41fc65bcfb4 154 uint16_t RxXferCount; /* USART Rx Transfer Counter */
mbed_official 205:c41fc65bcfb4 155
mbed_official 205:c41fc65bcfb4 156 uint16_t Mask; /* USART Rx RDR register mask */
mbed_official 205:c41fc65bcfb4 157
mbed_official 205:c41fc65bcfb4 158 DMA_HandleTypeDef *hdmatx; /* USART Tx DMA Handle parameters */
mbed_official 205:c41fc65bcfb4 159
mbed_official 205:c41fc65bcfb4 160 DMA_HandleTypeDef *hdmarx; /* USART Rx DMA Handle parameters */
mbed_official 205:c41fc65bcfb4 161
mbed_official 205:c41fc65bcfb4 162 HAL_LockTypeDef Lock; /* Locking object */
mbed_official 205:c41fc65bcfb4 163
mbed_official 205:c41fc65bcfb4 164 HAL_USART_StateTypeDef State; /* USART communication state */
mbed_official 205:c41fc65bcfb4 165
mbed_official 205:c41fc65bcfb4 166 HAL_USART_ErrorTypeDef ErrorCode; /* USART Error code */
mbed_official 205:c41fc65bcfb4 167
mbed_official 205:c41fc65bcfb4 168 }USART_HandleTypeDef;
mbed_official 205:c41fc65bcfb4 169
mbed_official 205:c41fc65bcfb4 170
mbed_official 205:c41fc65bcfb4 171 /* Exported constants --------------------------------------------------------*/
mbed_official 205:c41fc65bcfb4 172
mbed_official 205:c41fc65bcfb4 173 /** @defgroup USART_Exported_Constants
mbed_official 205:c41fc65bcfb4 174 * @{
mbed_official 205:c41fc65bcfb4 175 */
mbed_official 205:c41fc65bcfb4 176
mbed_official 205:c41fc65bcfb4 177 /** @defgroup USART_Stop_Bits USART Number of Stop Bits
mbed_official 205:c41fc65bcfb4 178 * @{
mbed_official 205:c41fc65bcfb4 179 */
mbed_official 205:c41fc65bcfb4 180 #define USART_STOPBITS_1 ((uint16_t)0x0000)
mbed_official 205:c41fc65bcfb4 181 #define USART_STOPBITS_0_5 ((uint16_t)USART_CR2_STOP_0)
mbed_official 205:c41fc65bcfb4 182 #define USART_STOPBITS_2 ((uint16_t)USART_CR2_STOP_1)
mbed_official 205:c41fc65bcfb4 183 #define USART_STOPBITS_1_5 ((uint16_t)(USART_CR2_STOP_0 | USART_CR2_STOP_1))
mbed_official 205:c41fc65bcfb4 184 #define IS_USART_STOPBITS(STOPBITS) (((STOPBITS) == USART_STOPBITS_1) || \
mbed_official 205:c41fc65bcfb4 185 ((STOPBITS) == USART_STOPBITS_0_5) || \
mbed_official 205:c41fc65bcfb4 186 ((STOPBITS) == USART_STOPBITS_1_5) || \
mbed_official 205:c41fc65bcfb4 187 ((STOPBITS) == USART_STOPBITS_2))
mbed_official 205:c41fc65bcfb4 188 /**
mbed_official 205:c41fc65bcfb4 189 * @}
mbed_official 205:c41fc65bcfb4 190 */
mbed_official 205:c41fc65bcfb4 191
mbed_official 205:c41fc65bcfb4 192 /** @defgroup USART_Parity USART Parity
mbed_official 205:c41fc65bcfb4 193 * @{
mbed_official 205:c41fc65bcfb4 194 */
mbed_official 205:c41fc65bcfb4 195 #define USART_PARITY_NONE ((uint16_t)0x0000)
mbed_official 205:c41fc65bcfb4 196 #define USART_PARITY_EVEN ((uint16_t)USART_CR1_PCE)
mbed_official 205:c41fc65bcfb4 197 #define USART_PARITY_ODD ((uint16_t)(USART_CR1_PCE | USART_CR1_PS))
mbed_official 205:c41fc65bcfb4 198 #define IS_USART_PARITY(PARITY) (((PARITY) == USART_PARITY_NONE) || \
mbed_official 205:c41fc65bcfb4 199 ((PARITY) == USART_PARITY_EVEN) || \
mbed_official 205:c41fc65bcfb4 200 ((PARITY) == USART_PARITY_ODD))
mbed_official 205:c41fc65bcfb4 201 /**
mbed_official 205:c41fc65bcfb4 202 * @}
mbed_official 205:c41fc65bcfb4 203 */
mbed_official 205:c41fc65bcfb4 204
mbed_official 205:c41fc65bcfb4 205 /** @defgroup USART_Mode USART Mode
mbed_official 205:c41fc65bcfb4 206 * @{
mbed_official 205:c41fc65bcfb4 207 */
mbed_official 205:c41fc65bcfb4 208 #define USART_MODE_RX ((uint16_t)USART_CR1_RE)
mbed_official 205:c41fc65bcfb4 209 #define USART_MODE_TX ((uint16_t)USART_CR1_TE)
mbed_official 205:c41fc65bcfb4 210 #define USART_MODE_TX_RX ((uint16_t)(USART_CR1_TE |USART_CR1_RE))
mbed_official 205:c41fc65bcfb4 211 #define IS_USART_MODE(MODE) ((((MODE) & (uint16_t)0xFFF3) == 0x00) && ((MODE) != (uint16_t)0x00))
mbed_official 205:c41fc65bcfb4 212 /**
mbed_official 205:c41fc65bcfb4 213 * @}
mbed_official 205:c41fc65bcfb4 214 */
mbed_official 205:c41fc65bcfb4 215
mbed_official 205:c41fc65bcfb4 216 /** @defgroup USART_Clock USART Clock
mbed_official 205:c41fc65bcfb4 217 * @{
mbed_official 205:c41fc65bcfb4 218 */
mbed_official 205:c41fc65bcfb4 219 #define USART_CLOCK_DISABLED ((uint16_t)0x0000)
mbed_official 205:c41fc65bcfb4 220 #define USART_CLOCK_ENABLED ((uint16_t)USART_CR2_CLKEN)
mbed_official 205:c41fc65bcfb4 221 #define IS_USART_CLOCK(CLOCK) (((CLOCK) == USART_CLOCK_DISABLED) || \
mbed_official 205:c41fc65bcfb4 222 ((CLOCK) == USART_CLOCK_ENABLED))
mbed_official 205:c41fc65bcfb4 223 /**
mbed_official 205:c41fc65bcfb4 224 * @}
mbed_official 205:c41fc65bcfb4 225 */
mbed_official 205:c41fc65bcfb4 226
mbed_official 205:c41fc65bcfb4 227 /** @defgroup USART_Clock_Polarity USART Clock Polarity
mbed_official 205:c41fc65bcfb4 228 * @{
mbed_official 205:c41fc65bcfb4 229 */
mbed_official 205:c41fc65bcfb4 230 #define USART_POLARITY_LOW ((uint16_t)0x0000)
mbed_official 205:c41fc65bcfb4 231 #define USART_POLARITY_HIGH ((uint16_t)USART_CR2_CPOL)
mbed_official 205:c41fc65bcfb4 232 #define IS_USART_POLARITY(CPOL) (((CPOL) == USART_POLARITY_LOW) || ((CPOL) == USART_POLARITY_HIGH))
mbed_official 205:c41fc65bcfb4 233 /**
mbed_official 205:c41fc65bcfb4 234 * @}
mbed_official 205:c41fc65bcfb4 235 */
mbed_official 205:c41fc65bcfb4 236
mbed_official 205:c41fc65bcfb4 237 /** @defgroup USART_Clock_Phase USART Clock Phase
mbed_official 205:c41fc65bcfb4 238 * @{
mbed_official 205:c41fc65bcfb4 239 */
mbed_official 205:c41fc65bcfb4 240 #define USART_PHASE_1EDGE ((uint16_t)0x0000)
mbed_official 205:c41fc65bcfb4 241 #define USART_PHASE_2EDGE ((uint16_t)USART_CR2_CPHA)
mbed_official 205:c41fc65bcfb4 242 #define IS_USART_PHASE(CPHA) (((CPHA) == USART_PHASE_1EDGE) || ((CPHA) == USART_PHASE_2EDGE))
mbed_official 205:c41fc65bcfb4 243 /**
mbed_official 205:c41fc65bcfb4 244 * @}
mbed_official 205:c41fc65bcfb4 245 */
mbed_official 205:c41fc65bcfb4 246
mbed_official 205:c41fc65bcfb4 247 /** @defgroup USART_Last_Bit USART Last Bit
mbed_official 205:c41fc65bcfb4 248 * @{
mbed_official 205:c41fc65bcfb4 249 */
mbed_official 205:c41fc65bcfb4 250 #define USART_LASTBIT_DISABLE ((uint16_t)0x0000)
mbed_official 205:c41fc65bcfb4 251 #define USART_LASTBIT_ENABLE ((uint16_t)USART_CR2_LBCL)
mbed_official 205:c41fc65bcfb4 252 #define IS_USART_LASTBIT(LASTBIT) (((LASTBIT) == USART_LASTBIT_DISABLE) || \
mbed_official 205:c41fc65bcfb4 253 ((LASTBIT) == USART_LASTBIT_ENABLE))
mbed_official 205:c41fc65bcfb4 254 /**
mbed_official 205:c41fc65bcfb4 255 * @}
mbed_official 205:c41fc65bcfb4 256 */
mbed_official 205:c41fc65bcfb4 257
mbed_official 205:c41fc65bcfb4 258
mbed_official 205:c41fc65bcfb4 259 /** @defgroup USART_Flags USART Flags
mbed_official 205:c41fc65bcfb4 260 * Elements values convention: 0xXXXX
mbed_official 205:c41fc65bcfb4 261 * - 0xXXXX : Flag mask in the ISR register
mbed_official 205:c41fc65bcfb4 262 * @{
mbed_official 205:c41fc65bcfb4 263 */
mbed_official 205:c41fc65bcfb4 264 #define USART_FLAG_REACK ((uint32_t)0x00400000)
mbed_official 205:c41fc65bcfb4 265 #define USART_FLAG_TEACK ((uint32_t)0x00200000)
mbed_official 205:c41fc65bcfb4 266 #define USART_FLAG_BUSY ((uint32_t)0x00010000)
mbed_official 205:c41fc65bcfb4 267 #define USART_FLAG_CTS ((uint32_t)0x00000400)
mbed_official 205:c41fc65bcfb4 268 #define USART_FLAG_CTSIF ((uint32_t)0x00000200)
mbed_official 205:c41fc65bcfb4 269 #define USART_FLAG_LBDF ((uint32_t)0x00000100)
mbed_official 205:c41fc65bcfb4 270 #define USART_FLAG_TXE ((uint32_t)0x00000080)
mbed_official 205:c41fc65bcfb4 271 #define USART_FLAG_TC ((uint32_t)0x00000040)
mbed_official 205:c41fc65bcfb4 272 #define USART_FLAG_RXNE ((uint32_t)0x00000020)
mbed_official 205:c41fc65bcfb4 273 #define USART_FLAG_IDLE ((uint32_t)0x00000010)
mbed_official 205:c41fc65bcfb4 274 #define USART_FLAG_ORE ((uint32_t)0x00000008)
mbed_official 205:c41fc65bcfb4 275 #define USART_FLAG_NE ((uint32_t)0x00000004)
mbed_official 205:c41fc65bcfb4 276 #define USART_FLAG_FE ((uint32_t)0x00000002)
mbed_official 205:c41fc65bcfb4 277 #define USART_FLAG_PE ((uint32_t)0x00000001)
mbed_official 205:c41fc65bcfb4 278 /**
mbed_official 205:c41fc65bcfb4 279 * @}
mbed_official 205:c41fc65bcfb4 280 */
mbed_official 205:c41fc65bcfb4 281
mbed_official 205:c41fc65bcfb4 282 /** @defgroup USART_Interrupt_definition USART Interrupts Definition
mbed_official 205:c41fc65bcfb4 283 * Elements values convention: 0000ZZZZ0XXYYYYYb
mbed_official 205:c41fc65bcfb4 284 * - YYYYY : Interrupt source position in the XX register (5bits)
mbed_official 205:c41fc65bcfb4 285 * - XX : Interrupt source register (2bits)
mbed_official 205:c41fc65bcfb4 286 * - 01: CR1 register
mbed_official 205:c41fc65bcfb4 287 * - 10: CR2 register
mbed_official 205:c41fc65bcfb4 288 * - 11: CR3 register
mbed_official 205:c41fc65bcfb4 289 * - ZZZZ : Flag position in the ISR register(4bits)
mbed_official 205:c41fc65bcfb4 290 * @{
mbed_official 205:c41fc65bcfb4 291 */
mbed_official 205:c41fc65bcfb4 292
mbed_official 205:c41fc65bcfb4 293 #define USART_IT_PE ((uint16_t)0x0028)
mbed_official 205:c41fc65bcfb4 294 #define USART_IT_TXE ((uint16_t)0x0727)
mbed_official 205:c41fc65bcfb4 295 #define USART_IT_TC ((uint16_t)0x0626)
mbed_official 205:c41fc65bcfb4 296 #define USART_IT_RXNE ((uint16_t)0x0525)
mbed_official 205:c41fc65bcfb4 297 #define USART_IT_IDLE ((uint16_t)0x0424)
mbed_official 205:c41fc65bcfb4 298 #define USART_IT_ERR ((uint16_t)0x0060)
mbed_official 205:c41fc65bcfb4 299
mbed_official 205:c41fc65bcfb4 300 #define USART_IT_ORE ((uint16_t)0x0300)
mbed_official 205:c41fc65bcfb4 301 #define USART_IT_NE ((uint16_t)0x0200)
mbed_official 205:c41fc65bcfb4 302 #define USART_IT_FE ((uint16_t)0x0100)
mbed_official 205:c41fc65bcfb4 303 /**
mbed_official 205:c41fc65bcfb4 304 * @}
mbed_official 205:c41fc65bcfb4 305 */
mbed_official 205:c41fc65bcfb4 306
mbed_official 205:c41fc65bcfb4 307 /** @defgroup USART_IT_CLEAR_Flags USART Interruption Clear Flags
mbed_official 205:c41fc65bcfb4 308 * @{
mbed_official 205:c41fc65bcfb4 309 */
mbed_official 205:c41fc65bcfb4 310 #define USART_CLEAR_PEF USART_ICR_PECF /*!< Parity Error Clear Flag */
mbed_official 205:c41fc65bcfb4 311 #define USART_CLEAR_FEF USART_ICR_FECF /*!< Framing Error Clear Flag */
mbed_official 205:c41fc65bcfb4 312 #define USART_CLEAR_NEF USART_ICR_NCF /*!< Noise detected Clear Flag */
mbed_official 205:c41fc65bcfb4 313 #define USART_CLEAR_OREF USART_ICR_ORECF /*!< OverRun Error Clear Flag */
mbed_official 205:c41fc65bcfb4 314 #define USART_CLEAR_IDLEF USART_ICR_IDLECF /*!< IDLE line detected Clear Flag */
mbed_official 205:c41fc65bcfb4 315 #define USART_CLEAR_TCF USART_ICR_TCCF /*!< Transmission Complete Clear Flag */
mbed_official 205:c41fc65bcfb4 316 #define USART_CLEAR_CTSF USART_ICR_CTSCF /*!< CTS Interrupt Clear Flag */
mbed_official 205:c41fc65bcfb4 317 /**
mbed_official 205:c41fc65bcfb4 318 * @}
mbed_official 205:c41fc65bcfb4 319 */
mbed_official 205:c41fc65bcfb4 320
mbed_official 205:c41fc65bcfb4 321 /** @defgroup USART_Request_Parameters USART Request Parameters
mbed_official 205:c41fc65bcfb4 322 * @{
mbed_official 205:c41fc65bcfb4 323 */
mbed_official 205:c41fc65bcfb4 324 #define USART_RXDATA_FLUSH_REQUEST ((uint16_t)USART_RQR_RXFRQ) /*!< Receive Data flush Request */
mbed_official 205:c41fc65bcfb4 325 #define USART_TXDATA_FLUSH_REQUEST ((uint16_t)USART_RQR_TXFRQ) /*!< Transmit data flush Request */
mbed_official 205:c41fc65bcfb4 326 #define IS_USART_REQUEST_PARAMETER(PARAM) (((PARAM) == USART_RXDATA_FLUSH_REQUEST) || \
mbed_official 205:c41fc65bcfb4 327 ((PARAM) == USART_TXDATA_FLUSH_REQUEST))
mbed_official 205:c41fc65bcfb4 328 /**
mbed_official 205:c41fc65bcfb4 329 * @}
mbed_official 205:c41fc65bcfb4 330 */
mbed_official 205:c41fc65bcfb4 331
mbed_official 205:c41fc65bcfb4 332 /** @defgroup USART_Interruption_Mask USART interruptions flag mask
mbed_official 205:c41fc65bcfb4 333 * @{
mbed_official 205:c41fc65bcfb4 334 */
mbed_official 205:c41fc65bcfb4 335 #define USART_IT_MASK ((uint16_t)0x001F)
mbed_official 205:c41fc65bcfb4 336 /**
mbed_official 205:c41fc65bcfb4 337 * @}
mbed_official 205:c41fc65bcfb4 338 */
mbed_official 205:c41fc65bcfb4 339
mbed_official 205:c41fc65bcfb4 340 /**
mbed_official 205:c41fc65bcfb4 341 * @}
mbed_official 205:c41fc65bcfb4 342 */
mbed_official 205:c41fc65bcfb4 343
mbed_official 205:c41fc65bcfb4 344
mbed_official 205:c41fc65bcfb4 345 /* Exported macros ------------------------------------------------------------*/
mbed_official 205:c41fc65bcfb4 346
mbed_official 205:c41fc65bcfb4 347 /** @defgroup USART_Exported_Macros
mbed_official 205:c41fc65bcfb4 348 * @{
mbed_official 205:c41fc65bcfb4 349 */
mbed_official 205:c41fc65bcfb4 350
mbed_official 205:c41fc65bcfb4 351 /** @brief Reset USART handle state
mbed_official 205:c41fc65bcfb4 352 * @param __HANDLE__: USART handle.
mbed_official 205:c41fc65bcfb4 353 * @retval None
mbed_official 205:c41fc65bcfb4 354 */
mbed_official 205:c41fc65bcfb4 355 #define __HAL_USART_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_USART_STATE_RESET)
mbed_official 205:c41fc65bcfb4 356
mbed_official 205:c41fc65bcfb4 357 /** @brief Checks whether the specified USART flag is set or not.
mbed_official 205:c41fc65bcfb4 358 * @param __HANDLE__: specifies the USART Handle.
mbed_official 205:c41fc65bcfb4 359 * This parameter can be UARTx where x: 1, 2, 3 to select the USART peripheral.
mbed_official 205:c41fc65bcfb4 360 * @param __FLAG__: specifies the flag to check.
mbed_official 205:c41fc65bcfb4 361 * This parameter can be one of the following values:
mbed_official 205:c41fc65bcfb4 362 * @arg USART_FLAG_REACK: Receive enable ackowledge flag
mbed_official 205:c41fc65bcfb4 363 * @arg USART_FLAG_TEACK: Transmit enable ackowledge flag
mbed_official 205:c41fc65bcfb4 364 * @arg USART_FLAG_BUSY: Busy flag
mbed_official 205:c41fc65bcfb4 365 * @arg USART_FLAG_CTS: CTS Change flag
mbed_official 205:c41fc65bcfb4 366 * @arg USART_FLAG_TXE: Transmit data register empty flag
mbed_official 205:c41fc65bcfb4 367 * @arg USART_FLAG_TC: Transmission Complete flag
mbed_official 205:c41fc65bcfb4 368 * @arg USART_FLAG_RXNE: Receive data register not empty flag
mbed_official 205:c41fc65bcfb4 369 * @arg USART_FLAG_IDLE: Idle Line detection flag
mbed_official 205:c41fc65bcfb4 370 * @arg USART_FLAG_ORE: OverRun Error flag
mbed_official 205:c41fc65bcfb4 371 * @arg USART_FLAG_NE: Noise Error flag
mbed_official 205:c41fc65bcfb4 372 * @arg USART_FLAG_FE: Framing Error flag
mbed_official 205:c41fc65bcfb4 373 * @arg USART_FLAG_PE: Parity Error flag
mbed_official 205:c41fc65bcfb4 374 * @retval The new state of __FLAG__ (TRUE or FALSE).
mbed_official 205:c41fc65bcfb4 375 */
mbed_official 205:c41fc65bcfb4 376 #define __HAL_USART_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->ISR & (__FLAG__)) == (__FLAG__))
mbed_official 205:c41fc65bcfb4 377
mbed_official 205:c41fc65bcfb4 378
mbed_official 205:c41fc65bcfb4 379 /** @brief Enables the specified USART interrupt.
mbed_official 205:c41fc65bcfb4 380 * @param __HANDLE__: specifies the USART Handle.
mbed_official 205:c41fc65bcfb4 381 * This parameter can be UARTx where x: 1, 2, 3 to select the USART peripheral.
mbed_official 205:c41fc65bcfb4 382 * @param __INTERRUPT__: specifies the USART interrupt source to enable.
mbed_official 205:c41fc65bcfb4 383 * This parameter can be one of the following values:
mbed_official 205:c41fc65bcfb4 384 * @arg USART_IT_TXE: Transmit Data Register empty interrupt
mbed_official 205:c41fc65bcfb4 385 * @arg USART_IT_TC: Transmission complete interrupt
mbed_official 205:c41fc65bcfb4 386 * @arg USART_IT_RXNE: Receive Data register not empty interrupt
mbed_official 205:c41fc65bcfb4 387 * @arg USART_IT_IDLE: Idle line detection interrupt
mbed_official 205:c41fc65bcfb4 388 * @arg USART_IT_PE: Parity Error interrupt
mbed_official 205:c41fc65bcfb4 389 * @arg USART_IT_ERR: Error interrupt(Frame error, noise error, overrun error)
mbed_official 205:c41fc65bcfb4 390 * @retval None
mbed_official 205:c41fc65bcfb4 391 */
mbed_official 205:c41fc65bcfb4 392 #define __HAL_USART_ENABLE_IT(__HANDLE__, __INTERRUPT__) (((((uint8_t)(__INTERRUPT__)) >> 5U) == 1)? ((__HANDLE__)->Instance->CR1 |= (1U << ((__INTERRUPT__) & USART_IT_MASK))): \
mbed_official 205:c41fc65bcfb4 393 ((((uint8_t)(__INTERRUPT__)) >> 5U) == 2)? ((__HANDLE__)->Instance->CR2 |= (1U << ((__INTERRUPT__) & USART_IT_MASK))): \
mbed_official 205:c41fc65bcfb4 394 ((__HANDLE__)->Instance->CR3 |= (1U << ((__INTERRUPT__) & USART_IT_MASK))))
mbed_official 205:c41fc65bcfb4 395
mbed_official 205:c41fc65bcfb4 396 /** @brief Disables the specified USART interrupt.
mbed_official 205:c41fc65bcfb4 397 * @param __HANDLE__: specifies the USART Handle.
mbed_official 205:c41fc65bcfb4 398 * This parameter can be UARTx where x: 1, 2, 3 to select the USART peripheral.
mbed_official 205:c41fc65bcfb4 399 * @param __INTERRUPT__: specifies the USART interrupt source to disable.
mbed_official 205:c41fc65bcfb4 400 * This parameter can be one of the following values:
mbed_official 205:c41fc65bcfb4 401 * @arg USART_IT_TXE: Transmit Data Register empty interrupt
mbed_official 205:c41fc65bcfb4 402 * @arg USART_IT_TC: Transmission complete interrupt
mbed_official 205:c41fc65bcfb4 403 * @arg USART_IT_RXNE: Receive Data register not empty interrupt
mbed_official 205:c41fc65bcfb4 404 * @arg USART_IT_IDLE: Idle line detection interrupt
mbed_official 205:c41fc65bcfb4 405 * @arg USART_IT_PE: Parity Error interrupt
mbed_official 205:c41fc65bcfb4 406 * @arg USART_IT_ERR: Error interrupt(Frame error, noise error, overrun error)
mbed_official 205:c41fc65bcfb4 407 * @retval None
mbed_official 205:c41fc65bcfb4 408 */
mbed_official 205:c41fc65bcfb4 409 #define __HAL_USART_DISABLE_IT(__HANDLE__, __INTERRUPT__) (((((uint8_t)(__INTERRUPT__)) >> 5U) == 1)? ((__HANDLE__)->Instance->CR1 &= ~ (1U << ((__INTERRUPT__) & USART_IT_MASK))): \
mbed_official 205:c41fc65bcfb4 410 ((((uint8_t)(__INTERRUPT__)) >> 5U) == 2)? ((__HANDLE__)->Instance->CR2 &= ~ (1U << ((__INTERRUPT__) & USART_IT_MASK))): \
mbed_official 205:c41fc65bcfb4 411 ((__HANDLE__)->Instance->CR3 &= ~ (1U << ((__INTERRUPT__) & USART_IT_MASK))))
mbed_official 205:c41fc65bcfb4 412
mbed_official 205:c41fc65bcfb4 413
mbed_official 205:c41fc65bcfb4 414 /** @brief Checks whether the specified USART interrupt has occurred or not.
mbed_official 205:c41fc65bcfb4 415 * @param __HANDLE__: specifies the USART Handle.
mbed_official 205:c41fc65bcfb4 416 * This parameter can be USARTx where x: 1, 2 or 3
mbed_official 205:c41fc65bcfb4 417 * @param __IT__: specifies the USART interrupt source to check.
mbed_official 205:c41fc65bcfb4 418 * This parameter can be one of the following values:
mbed_official 205:c41fc65bcfb4 419 * @arg USART_IT_TXE: Transmit Data Register empty interrupt
mbed_official 205:c41fc65bcfb4 420 * @arg USART_IT_TC: Transmission complete interrupt
mbed_official 205:c41fc65bcfb4 421 * @arg USART_IT_RXNE: Receive Data register not empty interrupt
mbed_official 205:c41fc65bcfb4 422 * @arg USART_IT_IDLE: Idle line detection interrupt
mbed_official 205:c41fc65bcfb4 423 * @arg USART_IT_ORE: OverRun Error interrupt
mbed_official 205:c41fc65bcfb4 424 * @arg USART_IT_NE: Noise Error interrupt
mbed_official 205:c41fc65bcfb4 425 * @arg USART_IT_FE: Framing Error interrupt
mbed_official 205:c41fc65bcfb4 426 * @arg USART_IT_PE: Parity Error interrupt
mbed_official 205:c41fc65bcfb4 427 * @retval The new state of __IT__ (TRUE or FALSE).
mbed_official 205:c41fc65bcfb4 428 */
mbed_official 205:c41fc65bcfb4 429 #define __HAL_USART_GET_IT(__HANDLE__, __IT__) ((__HANDLE__)->Instance->ISR & ((uint32_t)1 << ((__IT__)>> 0x08)))
mbed_official 205:c41fc65bcfb4 430
mbed_official 205:c41fc65bcfb4 431 /** @brief Checks whether the specified USART interrupt source is enabled.
mbed_official 205:c41fc65bcfb4 432 * @param __HANDLE__: specifies the USART Handle.
mbed_official 205:c41fc65bcfb4 433 * This parameter can be USARTx where x: 1, 2 or 3
mbed_official 205:c41fc65bcfb4 434 * @param __IT__: specifies the USART interrupt source to check.
mbed_official 205:c41fc65bcfb4 435 * This parameter can be one of the following values:
mbed_official 205:c41fc65bcfb4 436 * @arg USART_IT_TXE: Transmit Data Register empty interrupt
mbed_official 205:c41fc65bcfb4 437 * @arg USART_IT_TC: Transmission complete interrupt
mbed_official 205:c41fc65bcfb4 438 * @arg USART_IT_RXNE: Receive Data register not empty interrupt
mbed_official 205:c41fc65bcfb4 439 * @arg USART_IT_IDLE: Idle line detection interrupt
mbed_official 205:c41fc65bcfb4 440 * @arg USART_IT_ORE: OverRun Error interrupt
mbed_official 205:c41fc65bcfb4 441 * @arg USART_IT_NE: Noise Error interrupt
mbed_official 205:c41fc65bcfb4 442 * @arg USART_IT_FE: Framing Error interrupt
mbed_official 205:c41fc65bcfb4 443 * @arg USART_IT_PE: Parity Error interrupt
mbed_official 205:c41fc65bcfb4 444 * @retval The new state of __IT__ (TRUE or FALSE).
mbed_official 205:c41fc65bcfb4 445 */
mbed_official 205:c41fc65bcfb4 446 #define __HAL_USART_GET_IT_SOURCE(__HANDLE__, __IT__) ((((((uint8_t)(__IT__)) >> 5) == 1)? (__HANDLE__)->Instance->CR1:(((((uint8_t)(__IT__)) >> 5) == 2)? \
mbed_official 205:c41fc65bcfb4 447 (__HANDLE__)->Instance->CR2 : (__HANDLE__)->Instance->CR3)) & ((uint32_t)1 << \
mbed_official 205:c41fc65bcfb4 448 (((uint16_t)(__IT__)) & USART_IT_MASK)))
mbed_official 205:c41fc65bcfb4 449
mbed_official 205:c41fc65bcfb4 450
mbed_official 205:c41fc65bcfb4 451 /** @brief Clears the specified USART ISR flag, in setting the proper ICR register flag.
mbed_official 205:c41fc65bcfb4 452 * @param __HANDLE__: specifies the USART Handle.
mbed_official 205:c41fc65bcfb4 453 * This parameter can be USARTx where x: 1, 2 or 3
mbed_official 205:c41fc65bcfb4 454 * @param __IT_CLEAR__: specifies the interrupt clear register flag that needs to be set
mbed_official 205:c41fc65bcfb4 455 * to clear the corresponding interrupt
mbed_official 205:c41fc65bcfb4 456 * This parameter can be one of the following values:
mbed_official 205:c41fc65bcfb4 457 * @arg USART_CLEAR_PEF: Parity Error Clear Flag
mbed_official 205:c41fc65bcfb4 458 * @arg USART_CLEAR_FEF: Framing Error Clear Flag
mbed_official 205:c41fc65bcfb4 459 * @arg USART_CLEAR_NEF: Noise detected Clear Flag
mbed_official 205:c41fc65bcfb4 460 * @arg USART_CLEAR_OREF: OverRun Error Clear Flag
mbed_official 205:c41fc65bcfb4 461 * @arg USART_CLEAR_IDLEF: IDLE line detected Clear Flag
mbed_official 205:c41fc65bcfb4 462 * @arg USART_CLEAR_TCF: Transmission Complete Clear Flag
mbed_official 205:c41fc65bcfb4 463 * @arg USART_CLEAR_CTSF: CTS Interrupt Clear Flag
mbed_official 205:c41fc65bcfb4 464 * @retval None
mbed_official 205:c41fc65bcfb4 465 */
mbed_official 205:c41fc65bcfb4 466 #define __HAL_USART_CLEAR_IT(__HANDLE__, __IT_CLEAR__) ((__HANDLE__)->Instance->ICR |= (uint32_t)(__IT_CLEAR__))
mbed_official 205:c41fc65bcfb4 467
mbed_official 205:c41fc65bcfb4 468 /** @brief Set a specific USART request flag.
mbed_official 205:c41fc65bcfb4 469 * @param __HANDLE__: specifies the USART Handle.
mbed_official 205:c41fc65bcfb4 470 * This parameter can be USARTx where x: 1, 2 or 3
mbed_official 205:c41fc65bcfb4 471 * @param __REQ__: specifies the request flag to set
mbed_official 205:c41fc65bcfb4 472 * This parameter can be one of the following values:
mbed_official 205:c41fc65bcfb4 473 * @arg USART_RXDATA_FLUSH_REQUEST: Receive Data flush Request
mbed_official 205:c41fc65bcfb4 474 * @arg USART_TXDATA_FLUSH_REQUEST: Transmit data flush Request
mbed_official 205:c41fc65bcfb4 475 *
mbed_official 205:c41fc65bcfb4 476 * @retval None
mbed_official 205:c41fc65bcfb4 477 */
mbed_official 205:c41fc65bcfb4 478 #define __HAL_USART_SEND_REQ(__HANDLE__, __REQ__) ((__HANDLE__)->Instance->RQR |= (uint16_t)(__REQ__))
mbed_official 205:c41fc65bcfb4 479
mbed_official 205:c41fc65bcfb4 480 /** @brief Enable USART
mbed_official 205:c41fc65bcfb4 481 * @param __HANDLE__: specifies the USART Handle.
mbed_official 205:c41fc65bcfb4 482 * The Handle Instance can be USARTx where x: 1, 2, 3 to select the USART peripheral
mbed_official 205:c41fc65bcfb4 483 * @retval None
mbed_official 205:c41fc65bcfb4 484 */
mbed_official 205:c41fc65bcfb4 485 #define __USART_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 |= USART_CR1_UE)
mbed_official 205:c41fc65bcfb4 486
mbed_official 205:c41fc65bcfb4 487 /** @brief Disable USART
mbed_official 205:c41fc65bcfb4 488 * @param __HANDLE__: specifies the USART Handle.
mbed_official 205:c41fc65bcfb4 489 * The Handle Instance can be USARTx where x: 1, 2, 3 to select the USART peripheral
mbed_official 205:c41fc65bcfb4 490 * @retval None
mbed_official 205:c41fc65bcfb4 491 */
mbed_official 205:c41fc65bcfb4 492 #define __USART_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 &= ~USART_CR1_UE)
mbed_official 205:c41fc65bcfb4 493
mbed_official 205:c41fc65bcfb4 494
mbed_official 205:c41fc65bcfb4 495 /** @brief Check USART Baud rate
mbed_official 205:c41fc65bcfb4 496 * @param BAUDRATE: Baudrate specified by the user
mbed_official 205:c41fc65bcfb4 497 * The maximum Baud Rate is derived from the maximum clock on F0 (i.e. 48 MHz)
mbed_official 205:c41fc65bcfb4 498 * divided by the smallest oversampling used on the USART (i.e. 8)
mbed_official 205:c41fc65bcfb4 499 * @retval Test result (TRUE or FALSE)
mbed_official 205:c41fc65bcfb4 500 */
mbed_official 205:c41fc65bcfb4 501 #define IS_USART_BAUDRATE(BAUDRATE) ((BAUDRATE) < 9000001)
mbed_official 205:c41fc65bcfb4 502
mbed_official 205:c41fc65bcfb4 503 /**
mbed_official 205:c41fc65bcfb4 504 * @}
mbed_official 205:c41fc65bcfb4 505 */
mbed_official 205:c41fc65bcfb4 506
mbed_official 205:c41fc65bcfb4 507 /* Include USART HAL Extension module */
mbed_official 205:c41fc65bcfb4 508 #include "stm32f0xx_hal_usart_ex.h"
mbed_official 205:c41fc65bcfb4 509
mbed_official 205:c41fc65bcfb4 510 /* Exported functions --------------------------------------------------------*/
mbed_official 205:c41fc65bcfb4 511
mbed_official 205:c41fc65bcfb4 512 /* Initialization and de-initialization functions ****************************/
mbed_official 205:c41fc65bcfb4 513 HAL_StatusTypeDef HAL_USART_Init(USART_HandleTypeDef *husart);
mbed_official 205:c41fc65bcfb4 514 HAL_StatusTypeDef HAL_USART_DeInit(USART_HandleTypeDef *husart);
mbed_official 205:c41fc65bcfb4 515 void HAL_USART_MspInit(USART_HandleTypeDef *husart);
mbed_official 205:c41fc65bcfb4 516 void HAL_USART_MspDeInit(USART_HandleTypeDef *husart);
mbed_official 205:c41fc65bcfb4 517 void HAL_USART_SetConfig(USART_HandleTypeDef *husart);
mbed_official 205:c41fc65bcfb4 518 HAL_StatusTypeDef HAL_USART_CheckIdleState(USART_HandleTypeDef *husart);
mbed_official 205:c41fc65bcfb4 519 /* IO operation functions *****************************************************/
mbed_official 205:c41fc65bcfb4 520 HAL_StatusTypeDef HAL_USART_Transmit(USART_HandleTypeDef *husart, uint8_t *pTxData, uint16_t Size, uint32_t Timeout);
mbed_official 205:c41fc65bcfb4 521 HAL_StatusTypeDef HAL_USART_Receive(USART_HandleTypeDef *husart, uint8_t *pRxData, uint16_t Size, uint32_t Timeout);
mbed_official 205:c41fc65bcfb4 522 HAL_StatusTypeDef HAL_USART_TransmitReceive(USART_HandleTypeDef *husart, uint8_t *pTxData, uint8_t *pRxData, uint16_t Size, uint32_t Timeout);
mbed_official 205:c41fc65bcfb4 523 HAL_StatusTypeDef HAL_USART_Transmit_IT(USART_HandleTypeDef *husart, uint8_t *pTxData, uint16_t Size);
mbed_official 205:c41fc65bcfb4 524 HAL_StatusTypeDef HAL_USART_Receive_IT(USART_HandleTypeDef *husart, uint8_t *pRxData, uint16_t Size);
mbed_official 205:c41fc65bcfb4 525 HAL_StatusTypeDef HAL_USART_TransmitReceive_IT(USART_HandleTypeDef *husart, uint8_t *pTxData, uint8_t *pRxData, uint16_t Size);
mbed_official 205:c41fc65bcfb4 526 HAL_StatusTypeDef HAL_USART_Transmit_DMA(USART_HandleTypeDef *husart, uint8_t *pTxData, uint16_t Size);
mbed_official 205:c41fc65bcfb4 527 HAL_StatusTypeDef HAL_USART_Receive_DMA(USART_HandleTypeDef *husart, uint8_t *pRxData, uint16_t Size);
mbed_official 205:c41fc65bcfb4 528 HAL_StatusTypeDef HAL_USART_TransmitReceive_DMA(USART_HandleTypeDef *husart, uint8_t *pTxData, uint8_t *pRxData, uint16_t Size);
mbed_official 205:c41fc65bcfb4 529 HAL_StatusTypeDef HAL_USART_DMAPause(USART_HandleTypeDef *husart);
mbed_official 205:c41fc65bcfb4 530 HAL_StatusTypeDef HAL_USART_DMAResume(USART_HandleTypeDef *husart);
mbed_official 205:c41fc65bcfb4 531 HAL_StatusTypeDef HAL_USART_DMAStop(USART_HandleTypeDef *husart);
mbed_official 205:c41fc65bcfb4 532 void HAL_USART_IRQHandler(USART_HandleTypeDef *husart);
mbed_official 205:c41fc65bcfb4 533 void HAL_USART_TxCpltCallback(USART_HandleTypeDef *husart);
mbed_official 205:c41fc65bcfb4 534 void HAL_USART_RxCpltCallback(USART_HandleTypeDef *husart);
mbed_official 205:c41fc65bcfb4 535 void HAL_USART_TxHalfCpltCallback(USART_HandleTypeDef *husart);
mbed_official 205:c41fc65bcfb4 536 void HAL_USART_RxHalfCpltCallback(USART_HandleTypeDef *husart);
mbed_official 205:c41fc65bcfb4 537 void HAL_USART_TxRxCpltCallback(USART_HandleTypeDef *husart);
mbed_official 205:c41fc65bcfb4 538 void HAL_USART_ErrorCallback(USART_HandleTypeDef *husart);
mbed_official 205:c41fc65bcfb4 539
mbed_official 205:c41fc65bcfb4 540 /* Peripheral Control functions ***********************************************/
mbed_official 205:c41fc65bcfb4 541
mbed_official 205:c41fc65bcfb4 542 /* Peripheral State and Error functions ***************************************/
mbed_official 205:c41fc65bcfb4 543 HAL_USART_StateTypeDef HAL_USART_GetState(USART_HandleTypeDef *husart);
mbed_official 205:c41fc65bcfb4 544 uint32_t HAL_USART_GetError(USART_HandleTypeDef *husart);
mbed_official 205:c41fc65bcfb4 545
mbed_official 205:c41fc65bcfb4 546 /**
mbed_official 205:c41fc65bcfb4 547 * @}
mbed_official 205:c41fc65bcfb4 548 */
mbed_official 205:c41fc65bcfb4 549
mbed_official 205:c41fc65bcfb4 550 /**
mbed_official 205:c41fc65bcfb4 551 * @}
mbed_official 205:c41fc65bcfb4 552 */
mbed_official 205:c41fc65bcfb4 553
mbed_official 205:c41fc65bcfb4 554 #ifdef __cplusplus
mbed_official 205:c41fc65bcfb4 555 }
mbed_official 205:c41fc65bcfb4 556 #endif
mbed_official 205:c41fc65bcfb4 557
mbed_official 205:c41fc65bcfb4 558 #endif /* __STM32F0xx_HAL_USART_H */
mbed_official 205:c41fc65bcfb4 559
mbed_official 205:c41fc65bcfb4 560 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/