mbed library sources

Dependents:   Encrypted my_mbed lklk CyaSSL_DTLS_Cellular ... more

Superseded

This library was superseded by mbed-dev - https://os.mbed.com/users/mbed_official/code/mbed-dev/.

Development branch of the mbed library sources. This library is kept in synch with the latest changes from the mbed SDK and it is not guaranteed to work.

If you are looking for a stable and tested release, please import one of the official mbed library releases:

Import librarymbed

The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Committer:
mbed_official
Date:
Wed Jul 01 09:45:11 2015 +0100
Revision:
579:53297373a894
Parent:
394:83f921546702
Synchronized with git revision d5b4d2ab9c47edb4dc5776e7177b0c2263459081

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

Initial version of drivers for SAMR21

Who changed what in which revision?

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