You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

491 lines
23 KiB

  1. /**
  2. ******************************************************************************
  3. * @file stm32f4xx_hal_usart.h
  4. * @author MCD Application Team
  5. * @version V1.1.0
  6. * @date 19-June-2014
  7. * @brief Header file of USART HAL module.
  8. ******************************************************************************
  9. * @attention
  10. *
  11. * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
  12. *
  13. * Redistribution and use in source and binary forms, with or without modification,
  14. * are permitted provided that the following conditions are met:
  15. * 1. Redistributions of source code must retain the above copyright notice,
  16. * this list of conditions and the following disclaimer.
  17. * 2. Redistributions in binary form must reproduce the above copyright notice,
  18. * this list of conditions and the following disclaimer in the documentation
  19. * and/or other materials provided with the distribution.
  20. * 3. Neither the name of STMicroelectronics nor the names of its contributors
  21. * may be used to endorse or promote products derived from this software
  22. * without specific prior written permission.
  23. *
  24. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  25. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  26. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  27. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  28. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  29. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  30. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  31. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  32. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  33. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  34. *
  35. ******************************************************************************
  36. */
  37. /* Define to prevent recursive inclusion -------------------------------------*/
  38. #ifndef __STM32F4xx_HAL_USART_H
  39. #define __STM32F4xx_HAL_USART_H
  40. #ifdef __cplusplus
  41. extern "C" {
  42. #endif
  43. /* Includes ------------------------------------------------------------------*/
  44. #include "stm32f4xx_hal_def.h"
  45. /** @addtogroup STM32F4xx_HAL_Driver
  46. * @{
  47. */
  48. /** @addtogroup USART
  49. * @{
  50. */
  51. /* Exported types ------------------------------------------------------------*/
  52. /**
  53. * @brief USART Init Structure definition
  54. */
  55. typedef struct
  56. {
  57. uint32_t BaudRate; /*!< This member configures the Usart communication baud rate.
  58. The baud rate is computed using the following formula:
  59. - IntegerDivider = ((PCLKx) / (8 * (husart->Init.BaudRate)))
  60. - FractionalDivider = ((IntegerDivider - ((uint32_t) IntegerDivider)) * 8) + 0.5 */
  61. uint32_t WordLength; /*!< Specifies the number of data bits transmitted or received in a frame.
  62. This parameter can be a value of @ref USART_Word_Length */
  63. uint32_t StopBits; /*!< Specifies the number of stop bits transmitted.
  64. This parameter can be a value of @ref USART_Stop_Bits */
  65. uint32_t Parity; /*!< Specifies the parity mode.
  66. This parameter can be a value of @ref USART_Parity
  67. @note When parity is enabled, the computed parity is inserted
  68. at the MSB position of the transmitted data (9th bit when
  69. the word length is set to 9 data bits; 8th bit when the
  70. word length is set to 8 data bits). */
  71. uint32_t Mode; /*!< Specifies wether the Receive or Transmit mode is enabled or disabled.
  72. This parameter can be a value of @ref USART_Mode */
  73. uint32_t CLKPolarity; /*!< Specifies the steady state of the serial clock.
  74. This parameter can be a value of @ref USART_Clock_Polarity */
  75. uint32_t CLKPhase; /*!< Specifies the clock transition on which the bit capture is made.
  76. This parameter can be a value of @ref USART_Clock_Phase */
  77. uint32_t CLKLastBit; /*!< Specifies whether the clock pulse corresponding to the last transmitted
  78. data bit (MSB) has to be output on the SCLK pin in synchronous mode.
  79. This parameter can be a value of @ref USART_Last_Bit */
  80. }USART_InitTypeDef;
  81. /**
  82. * @brief HAL State structures definition
  83. */
  84. typedef enum
  85. {
  86. HAL_USART_STATE_RESET = 0x00, /*!< Peripheral is not yet Initialized */
  87. HAL_USART_STATE_READY = 0x01, /*!< Peripheral Initialized and ready for use */
  88. HAL_USART_STATE_BUSY = 0x02, /*!< an internal process is ongoing */
  89. HAL_USART_STATE_BUSY_TX = 0x12, /*!< Data Transmission process is ongoing */
  90. HAL_USART_STATE_BUSY_RX = 0x22, /*!< Data Reception process is ongoing */
  91. HAL_USART_STATE_BUSY_TX_RX = 0x32, /*!< Data Transmission Reception process is ongoing */
  92. HAL_USART_STATE_TIMEOUT = 0x03, /*!< Timeout state */
  93. HAL_USART_STATE_ERROR = 0x04 /*!< Error */
  94. }HAL_USART_StateTypeDef;
  95. /**
  96. * @brief HAL USART Error Code structure definition
  97. */
  98. typedef enum
  99. {
  100. HAL_USART_ERROR_NONE = 0x00, /*!< No error */
  101. HAL_USART_ERROR_PE = 0x01, /*!< Parity error */
  102. HAL_USART_ERROR_NE = 0x02, /*!< Noise error */
  103. HAL_USART_ERROR_FE = 0x04, /*!< frame error */
  104. HAL_USART_ERROR_ORE = 0x08, /*!< Overrun error */
  105. HAL_USART_ERROR_DMA = 0x10 /*!< DMA transfer error */
  106. }HAL_USART_ErrorTypeDef;
  107. /**
  108. * @brief USART handle Structure definition
  109. */
  110. typedef struct
  111. {
  112. USART_TypeDef *Instance; /* USART registers base address */
  113. USART_InitTypeDef Init; /* Usart communication parameters */
  114. uint8_t *pTxBuffPtr; /* Pointer to Usart Tx transfer Buffer */
  115. uint16_t TxXferSize; /* Usart Tx Transfer size */
  116. __IO uint16_t TxXferCount; /* Usart Tx Transfer Counter */
  117. uint8_t *pRxBuffPtr; /* Pointer to Usart Rx transfer Buffer */
  118. uint16_t RxXferSize; /* Usart Rx Transfer size */
  119. __IO uint16_t RxXferCount; /* Usart Rx Transfer Counter */
  120. DMA_HandleTypeDef *hdmatx; /* Usart Tx DMA Handle parameters */
  121. DMA_HandleTypeDef *hdmarx; /* Usart Rx DMA Handle parameters */
  122. HAL_LockTypeDef Lock; /* Locking object */
  123. __IO HAL_USART_StateTypeDef State; /* Usart communication state */
  124. __IO HAL_USART_ErrorTypeDef ErrorCode; /* USART Error code */
  125. }USART_HandleTypeDef;
  126. /* Exported constants --------------------------------------------------------*/
  127. /** @defgroup USART_Exported_Constants
  128. * @{
  129. */
  130. /** @defgroup USART_Word_Length
  131. * @{
  132. */
  133. #define USART_WORDLENGTH_8B ((uint32_t)0x00000000)
  134. #define USART_WORDLENGTH_9B ((uint32_t)USART_CR1_M)
  135. #define IS_USART_WORD_LENGTH(LENGTH) (((LENGTH) == USART_WORDLENGTH_8B) || \
  136. ((LENGTH) == USART_WORDLENGTH_9B))
  137. /**
  138. * @}
  139. */
  140. /** @defgroup USART_Stop_Bits
  141. * @{
  142. */
  143. #define USART_STOPBITS_1 ((uint32_t)0x00000000)
  144. #define USART_STOPBITS_0_5 ((uint32_t)USART_CR2_STOP_0)
  145. #define USART_STOPBITS_2 ((uint32_t)USART_CR2_STOP_1)
  146. #define USART_STOPBITS_1_5 ((uint32_t)(USART_CR2_STOP_0 | USART_CR2_STOP_1))
  147. #define IS_USART_STOPBITS(STOPBITS) (((STOPBITS) == USART_STOPBITS_1) || \
  148. ((STOPBITS) == USART_STOPBITS_0_5) || \
  149. ((STOPBITS) == USART_STOPBITS_1_5) || \
  150. ((STOPBITS) == USART_STOPBITS_2))
  151. /**
  152. * @}
  153. */
  154. /** @defgroup USART_Parity
  155. * @{
  156. */
  157. #define USART_PARITY_NONE ((uint32_t)0x00000000)
  158. #define USART_PARITY_EVEN ((uint32_t)USART_CR1_PCE)
  159. #define USART_PARITY_ODD ((uint32_t)(USART_CR1_PCE | USART_CR1_PS))
  160. #define IS_USART_PARITY(PARITY) (((PARITY) == USART_PARITY_NONE) || \
  161. ((PARITY) == USART_PARITY_EVEN) || \
  162. ((PARITY) == USART_PARITY_ODD))
  163. /**
  164. * @}
  165. */
  166. /** @defgroup USART_Mode
  167. * @{
  168. */
  169. #define USART_MODE_RX ((uint32_t)USART_CR1_RE)
  170. #define USART_MODE_TX ((uint32_t)USART_CR1_TE)
  171. #define USART_MODE_TX_RX ((uint32_t)(USART_CR1_TE |USART_CR1_RE))
  172. #define IS_USART_MODE(MODE) ((((MODE) & (uint32_t)0xFFF3) == 0x00) && ((MODE) != (uint32_t)0x00))
  173. /**
  174. * @}
  175. */
  176. /** @defgroup USART_Clock
  177. * @{
  178. */
  179. #define USART_CLOCK_DISABLED ((uint32_t)0x00000000)
  180. #define USART_CLOCK_ENABLED ((uint32_t)USART_CR2_CLKEN)
  181. #define IS_USART_CLOCK(CLOCK) (((CLOCK) == USART_CLOCK_DISABLED) || \
  182. ((CLOCK) == USART_CLOCK_ENABLED))
  183. /**
  184. * @}
  185. */
  186. /** @defgroup USART_Clock_Polarity
  187. * @{
  188. */
  189. #define USART_POLARITY_LOW ((uint32_t)0x00000000)
  190. #define USART_POLARITY_HIGH ((uint32_t)USART_CR2_CPOL)
  191. #define IS_USART_POLARITY(CPOL) (((CPOL) == USART_POLARITY_LOW) || ((CPOL) == USART_POLARITY_HIGH))
  192. /**
  193. * @}
  194. */
  195. /** @defgroup USART_Clock_Phase
  196. * @{
  197. */
  198. #define USART_PHASE_1EDGE ((uint32_t)0x00000000)
  199. #define USART_PHASE_2EDGE ((uint32_t)USART_CR2_CPHA)
  200. #define IS_USART_PHASE(CPHA) (((CPHA) == USART_PHASE_1EDGE) || ((CPHA) == USART_PHASE_2EDGE))
  201. /**
  202. * @}
  203. */
  204. /** @defgroup USART_Last_Bit
  205. * @{
  206. */
  207. #define USART_LASTBIT_DISABLE ((uint32_t)0x00000000)
  208. #define USART_LASTBIT_ENABLE ((uint32_t)USART_CR2_LBCL)
  209. #define IS_USART_LASTBIT(LASTBIT) (((LASTBIT) == USART_LASTBIT_DISABLE) || \
  210. ((LASTBIT) == USART_LASTBIT_ENABLE))
  211. /**
  212. * @}
  213. */
  214. /** @defgroup USART_NACK_State
  215. * @{
  216. */
  217. #define USARTNACK_ENABLED ((uint32_t)USART_CR3_NACK)
  218. #define USARTNACK_DISABLED ((uint32_t)0x00000000)
  219. #define IS_USART_NACK_STATE(NACK) (((NACK) == USARTNACK_ENABLED) || \
  220. ((NACK) == USARTNACK_DISABLED))
  221. /**
  222. * @}
  223. */
  224. /** @defgroup USART_Flags
  225. * Elements values convention: 0xXXXX
  226. * - 0xXXXX : Flag mask in the SR register
  227. * @{
  228. */
  229. #define USART_FLAG_TXE ((uint32_t)0x00000080)
  230. #define USART_FLAG_TC ((uint32_t)0x00000040)
  231. #define USART_FLAG_RXNE ((uint32_t)0x00000020)
  232. #define USART_FLAG_IDLE ((uint32_t)0x00000010)
  233. #define USART_FLAG_ORE ((uint32_t)0x00000008)
  234. #define USART_FLAG_NE ((uint32_t)0x00000004)
  235. #define USART_FLAG_FE ((uint32_t)0x00000002)
  236. #define USART_FLAG_PE ((uint32_t)0x00000001)
  237. /**
  238. * @}
  239. */
  240. /** @defgroup USART_Interrupt_definition
  241. * Elements values convention: 0xY000XXXX
  242. * - XXXX : Interrupt mask in the XX register
  243. * - Y : Interrupt source register (2bits)
  244. * - 01: CR1 register
  245. * - 10: CR2 register
  246. * - 11: CR3 register
  247. *
  248. * @{
  249. */
  250. #define USART_IT_PE ((uint32_t)0x10000100)
  251. #define USART_IT_TXE ((uint32_t)0x10000080)
  252. #define USART_IT_TC ((uint32_t)0x10000040)
  253. #define USART_IT_RXNE ((uint32_t)0x10000020)
  254. #define USART_IT_IDLE ((uint32_t)0x10000010)
  255. #define USART_IT_LBD ((uint32_t)0x20000040)
  256. #define USART_IT_CTS ((uint32_t)0x30000400)
  257. #define USART_IT_ERR ((uint32_t)0x30000001)
  258. /**
  259. * @}
  260. */
  261. /**
  262. * @}
  263. */
  264. /* Exported macro ------------------------------------------------------------*/
  265. /** @brief Reset USART handle state
  266. * @param __HANDLE__: specifies the USART Handle.
  267. * This parameter can be USARTx where x: 1, 2, 3 or 6 to select the USART peripheral.
  268. * @retval None
  269. */
  270. #define __HAL_USART_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_USART_STATE_RESET)
  271. /** @brief Checks whether the specified Smartcard flag is set or not.
  272. * @param __HANDLE__: specifies the USART Handle.
  273. * This parameter can be USARTx where x: 1, 2, 3 or 6 to select the USART peripheral.
  274. * @param __FLAG__: specifies the flag to check.
  275. * This parameter can be one of the following values:
  276. * @arg USART_FLAG_TXE: Transmit data register empty flag
  277. * @arg USART_FLAG_TC: Transmission Complete flag
  278. * @arg USART_FLAG_RXNE: Receive data register not empty flag
  279. * @arg USART_FLAG_IDLE: Idle Line detection flag
  280. * @arg USART_FLAG_ORE: OverRun Error flag
  281. * @arg USART_FLAG_NE: Noise Error flag
  282. * @arg USART_FLAG_FE: Framing Error flag
  283. * @arg USART_FLAG_PE: Parity Error flag
  284. * @retval The new state of __FLAG__ (TRUE or FALSE).
  285. */
  286. #define __HAL_USART_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->SR & (__FLAG__)) == (__FLAG__))
  287. /** @brief Clears the specified Smartcard pending flags.
  288. * @param __HANDLE__: specifies the USART Handle.
  289. * This parameter can be USARTx where x: 1, 2, 3 or 6 to select the USART peripheral.
  290. * @param __FLAG__: specifies the flag to check.
  291. * This parameter can be any combination of the following values:
  292. * @arg USART_FLAG_TC: Transmission Complete flag.
  293. * @arg USART_FLAG_RXNE: Receive data register not empty flag.
  294. *
  295. * @note PE (Parity error), FE (Framing error), NE (Noise error), ORE (OverRun
  296. * error) and IDLE (Idle line detected) flags are cleared by software
  297. * sequence: a read operation to USART_SR register followed by a read
  298. * operation to USART_DR register.
  299. * @note RXNE flag can be also cleared by a read to the USART_DR register.
  300. * @note TC flag can be also cleared by software sequence: a read operation to
  301. * USART_SR register followed by a write operation to USART_DR register.
  302. * @note TXE flag is cleared only by a write to the USART_DR register.
  303. *
  304. * @retval None
  305. */
  306. #define __HAL_USART_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->SR = ~(__FLAG__))
  307. /** @brief Clear the USART PE pending flag.
  308. * @param __HANDLE__: specifies the USART Handle.
  309. * This parameter can be USARTx where x: 1, 2, 3 or 6 to select the USART peripheral.
  310. * @retval None
  311. */
  312. #define __HAL_USART_CLEAR_PEFLAG(__HANDLE__) do{(__HANDLE__)->Instance->SR;\
  313. (__HANDLE__)->Instance->DR;}while(0)
  314. /** @brief Clear the USART FE pending flag.
  315. * @param __HANDLE__: specifies the USART Handle.
  316. * This parameter can be USARTx where x: 1, 2, 3 or 6 to select the USART peripheral.
  317. * @retval None
  318. */
  319. #define __HAL_USART_CLEAR_FEFLAG(__HANDLE__) __HAL_USART_CLEAR_PEFLAG(__HANDLE__)
  320. /** @brief Clear the USART NE pending flag.
  321. * @param __HANDLE__: specifies the USART Handle.
  322. * This parameter can be USARTx where x: 1, 2, 3 or 6 to select the USART peripheral.
  323. * @retval None
  324. */
  325. #define __HAL_USART_CLEAR_NEFLAG(__HANDLE__) __HAL_USART_CLEAR_PEFLAG(__HANDLE__)
  326. /** @brief Clear the UART ORE pending flag.
  327. * @param __HANDLE__: specifies the USART Handle.
  328. * This parameter can be USARTx where x: 1, 2, 3 or 6 to select the USART peripheral.
  329. * @retval None
  330. */
  331. #define __HAL_USART_CLEAR_OREFLAG(__HANDLE__) __HAL_USART_CLEAR_PEFLAG(__HANDLE__)
  332. /** @brief Clear the USART IDLE pending flag.
  333. * @param __HANDLE__: specifies the USART Handle.
  334. * This parameter can be USARTx where x: 1, 2, 3 or 6 to select the USART peripheral.
  335. * @retval None
  336. */
  337. #define __HAL_USART_CLEAR_IDLEFLAG(__HANDLE__) __HAL_USART_CLEAR_PEFLAG(__HANDLE__)
  338. /** @brief Enables or disables the specified Usart interrupts.
  339. * @param __HANDLE__: specifies the USART Handle.
  340. * This parameter can be USARTx where x: 1, 2, 3 or 6 to select the USART peripheral.
  341. * @param __INTERRUPT__: specifies the USART interrupt source to check.
  342. * This parameter can be one of the following values:
  343. * @arg USART_IT_TXE: Transmit Data Register empty interrupt
  344. * @arg USART_IT_TC: Transmission complete interrupt
  345. * @arg USART_IT_RXNE: Receive Data register not empty interrupt
  346. * @arg USART_IT_IDLE: Idle line detection interrupt
  347. * @arg USART_IT_PE: Parity Error interrupt
  348. * @arg USART_IT_ERR: Error interrupt(Frame error, noise error, overrun error)
  349. * @param NewState: new state of the specified Usart interrupt.
  350. * This parameter can be: ENABLE or DISABLE.
  351. * @retval None
  352. */
  353. #define USART_IT_MASK ((uint32_t)0x0000FFFF)
  354. #define __USART_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((((__INTERRUPT__) >> 28) == 1)? ((__HANDLE__)->Instance->CR1 |= ((__INTERRUPT__) & USART_IT_MASK)): \
  355. (((__INTERRUPT__) >> 28) == 2)? ((__HANDLE__)->Instance->CR2 |= ((__INTERRUPT__) & USART_IT_MASK)): \
  356. ((__HANDLE__)->Instance->CR3 |= ((__INTERRUPT__) & USART_IT_MASK)))
  357. #define __USART_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((((__INTERRUPT__) >> 28) == 1)? ((__HANDLE__)->Instance->CR1 &= ~((__INTERRUPT__) & USART_IT_MASK)): \
  358. (((__INTERRUPT__) >> 28) == 2)? ((__HANDLE__)->Instance->CR2 &= ~((__INTERRUPT__) & USART_IT_MASK)): \
  359. ((__HANDLE__)->Instance->CR3 &= ~ ((__INTERRUPT__) & USART_IT_MASK)))
  360. /** @brief Checks whether the specified Usart interrupt has occurred or not.
  361. * @param __HANDLE__: specifies the USART Handle.
  362. * This parameter can be USARTx where x: 1, 2, 3 or 6 to select the USART peripheral.
  363. * @param __IT__: specifies the USART interrupt source to check.
  364. * This parameter can be one of the following values:
  365. * @arg USART_IT_TXE: Transmit Data Register empty interrupt
  366. * @arg USART_IT_TC: Transmission complete interrupt
  367. * @arg USART_IT_RXNE: Receive Data register not empty interrupt
  368. * @arg USART_IT_IDLE: Idle line detection interrupt
  369. * @arg USART_IT_ERR: Error interrupt
  370. * @arg USART_IT_PE: Parity Error interrupt
  371. * @retval The new state of __IT__ (TRUE or FALSE).
  372. */
  373. #define __HAL_USART_GET_IT_SOURCE(__HANDLE__, __IT__) (((((__IT__) >> 28) == 1)? (__HANDLE__)->Instance->CR1:(((((uint32_t)(__IT__)) >> 28) == 2)? \
  374. (__HANDLE__)->Instance->CR2 : (__HANDLE__)->Instance->CR3)) & (((uint32_t)(__IT__)) & USART_IT_MASK))
  375. #define __USART_ENABLE(__HANDLE__) ( (__HANDLE__)->Instance->CR1 |= USART_CR1_UE)
  376. #define __USART_DISABLE(__HANDLE__) ( (__HANDLE__)->Instance->CR1 &= ~USART_CR1_UE)
  377. #define __DIV(_PCLK_, _BAUD_) (((_PCLK_)*25)/(4*(_BAUD_)))
  378. #define __DIVMANT(_PCLK_, _BAUD_) (__DIV((_PCLK_), (_BAUD_))/100)
  379. #define __DIVFRAQ(_PCLK_, _BAUD_) (((__DIV((_PCLK_), (_BAUD_)) - (__DIVMANT((_PCLK_), (_BAUD_)) * 100)) * 16 + 50) / 100)
  380. #define __USART_BRR(_PCLK_, _BAUD_) ((__DIVMANT((_PCLK_), (_BAUD_)) << 4)|(__DIVFRAQ((_PCLK_), (_BAUD_)) & 0x0F))
  381. #define IS_USART_BAUDRATE(BAUDRATE) ((BAUDRATE) < 10500001)
  382. /* Exported functions --------------------------------------------------------*/
  383. /* Initialization/de-initialization functions **********************************/
  384. HAL_StatusTypeDef HAL_USART_Init(USART_HandleTypeDef *husart);
  385. HAL_StatusTypeDef HAL_USART_DeInit(USART_HandleTypeDef *husart);
  386. void HAL_USART_MspInit(USART_HandleTypeDef *husart);
  387. void HAL_USART_MspDeInit(USART_HandleTypeDef *husart);
  388. /* IO operation functions *******************************************************/
  389. HAL_StatusTypeDef HAL_USART_Transmit(USART_HandleTypeDef *husart, uint8_t *pTxData, uint16_t Size, uint32_t Timeout);
  390. HAL_StatusTypeDef HAL_USART_Receive(USART_HandleTypeDef *husart, uint8_t *pRxData, uint16_t Size, uint32_t Timeout);
  391. HAL_StatusTypeDef HAL_USART_TransmitReceive(USART_HandleTypeDef *husart, uint8_t *pTxData, uint8_t *pRxData, uint16_t Size, uint32_t Timeout);
  392. HAL_StatusTypeDef HAL_USART_Transmit_IT(USART_HandleTypeDef *husart, uint8_t *pTxData, uint16_t Size);
  393. HAL_StatusTypeDef HAL_USART_Receive_IT(USART_HandleTypeDef *husart, uint8_t *pRxData, uint16_t Size);
  394. HAL_StatusTypeDef HAL_USART_TransmitReceive_IT(USART_HandleTypeDef *husart, uint8_t *pTxData, uint8_t *pRxData, uint16_t Size);
  395. HAL_StatusTypeDef HAL_USART_Transmit_DMA(USART_HandleTypeDef *husart, uint8_t *pTxData, uint16_t Size);
  396. HAL_StatusTypeDef HAL_USART_Receive_DMA(USART_HandleTypeDef *husart, uint8_t *pRxData, uint16_t Size);
  397. HAL_StatusTypeDef HAL_USART_TransmitReceive_DMA(USART_HandleTypeDef *husart, uint8_t *pTxData, uint8_t *pRxData, uint16_t Size);
  398. HAL_StatusTypeDef HAL_USART_DMAPause(USART_HandleTypeDef *husart);
  399. HAL_StatusTypeDef HAL_USART_DMAResume(USART_HandleTypeDef *husart);
  400. HAL_StatusTypeDef HAL_USART_DMAStop(USART_HandleTypeDef *husart);
  401. void HAL_USART_IRQHandler(USART_HandleTypeDef *husart);
  402. void HAL_USART_TxCpltCallback(USART_HandleTypeDef *husart);
  403. void HAL_USART_TxHalfCpltCallback(USART_HandleTypeDef *husart);
  404. void HAL_USART_RxCpltCallback(USART_HandleTypeDef *husart);
  405. void HAL_USART_RxHalfCpltCallback(USART_HandleTypeDef *husart);
  406. void HAL_USART_TxRxCpltCallback(USART_HandleTypeDef *husart);
  407. void HAL_USART_ErrorCallback(USART_HandleTypeDef *husart);
  408. /* Peripheral State functions **************************************************/
  409. HAL_USART_StateTypeDef HAL_USART_GetState(USART_HandleTypeDef *husart);
  410. uint32_t HAL_USART_GetError(USART_HandleTypeDef *husart);
  411. /**
  412. * @}
  413. */
  414. /**
  415. * @}
  416. */
  417. #ifdef __cplusplus
  418. }
  419. #endif
  420. #endif /* __STM32F4xx_HAL_USART_H */
  421. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/