Classes | Macros | Typedefs | Enumerations | Functions
gr55xx_hal_uart.h File Reference

Header file containing functions prototypes of UART HAL library. More...

`#include "gr55xx_ll_uart.h"`
`#include "gr55xx_hal_def.h"`
Include dependency graph for gr55xx_hal_uart.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Classes
struct | _uart_init
| UART init structure definition. More...
struct | _uart_handle
| UART handle Structure definition. More...
struct | _hal_uart_callback
| HAL_UART Callback function definition. More...

## Macros
#define | HAL_UART_ERROR_NONE (0x00000000U)
| No error More...
#define | HAL_UART_ERROR_PE LL_UART_LSR_PE
| Parity error More...
#define | HAL_UART_ERROR_FE LL_UART_LSR_FE
| frame error More...
#define | HAL_UART_ERROR_OE LL_UART_LSR_OE
| Overrun error More...
#define | HAL_UART_ERROR_BI LL_UART_LSR_BI
| Break dection error. More...
#define | HAL_UART_ERROR_DMA (0x00000100U)
| DMA transfer error More...
#define | HAL_UART_ERROR_BUSY (0x00000200U)
| Busy Error More...
#define | UART_DATABITS_5 LL_UART_DATABITS_5B
| UART frame with 5 data bits. More...
#define | UART_DATABITS_6 LL_UART_DATABITS_6B
| UART frame with 6 data bits. More...
#define | UART_DATABITS_7 LL_UART_DATABITS_7B
| UART frame with 7 data bits. More...
#define | UART_DATABITS_8 LL_UART_DATABITS_8B
| UART frame with 8 data bits. More...
#define | UART_STOPBITS_1 LL_UART_STOPBITS_1
| UART frame with 1 stop bit More...
#define | UART_STOPBITS_1_5 LL_UART_STOPBITS_1_5
| UART frame with 1.5 stop bits. More...
#define | UART_STOPBITS_2 LL_UART_STOPBITS_2
| UART frame with 2 stop bits More...
#define | UART_PARITY_NONE LL_UART_PARITY_NONE
| No parity More...
#define | UART_PARITY_ODD LL_UART_PARITY_ODD
| Odd parity. More...
#define | UART_PARITY_EVEN LL_UART_PARITY_EVEN
| Even parity More...
#define | UART_PARITY_SP0 LL_UART_PARITY_SP0
| Stick Parity 0 More...
#define | UART_PARITY_SP1 LL_UART_PARITY_SP1
| Stick Parity 1 More...
#define | UART_HWCONTROL_NONE LL_UART_HWCONTROL_NONE
| No hardware control More...
#define | UART_HWCONTROL_RTS_CTS LL_UART_HWCONTROL_RTS_CTS
| Auto RTS and CTS hardware flow control More...
#define | UART_RECEIVER_TIMEOUT_DISABLE (0x00000000U)
| UART receiver timeout disable. More...
#define | UART_RECEIVER_TIMEOUT_ENABLE (0x00000001U)
| UART receiver timeout enable More...
#define | UART_IT_MS LL_UART_IER_MS
| Enable Modem Status Interrupt. More...
#define | UART_IT_RLS LL_UART_IER_RLS
| Enable Receiver Line Status Interrupt. More...
#define | UART_IT_THRE LL_UART_IER_THRE
| Enable Transmit Holding Register Empty Interrupt. More...
#define | UART_IT_RDA LL_UART_IER_RDA
| Enable Received Data Available Interrupt and Character Timeout Interrupt. More...
#define | UART_RXDATA_FLUSH_REQUEST UART_SRR_RFR
| RX FIFO flush Request More...
#define | UART_TXDATA_FLUSH_REQUEST UART_SRR_XFR
| TX FIFO flush Request. More...
#define | UART_TXRXDATA_FLUSH_REQUEST (UART_SRR_XFR | UART_SRR_RFR)
| TX FIFO and RX FIFO flush Request More...
#define | UART_IT_MASK (0x008FU)
| UART interruptions flags mask. More...
#define | UART_LINE_ERROR_MASK (LL_UART_LSR_PE | LL_UART_LSR_OE | LL_UART_LSR_FE | LL_UART_LSR_BI)
| UART interruptions flags mask. More...
#define | UART_RETENTION_LENGTH ((uint32_t)8)
| the number of retention registers More...
#define | HAL_UART_TIMEOUT_DEFAULT_VALUE ((uint32_t)5000)
| 5s More...
#define | __HAL_UART_RESET_HANDLE_STATE(__HANDLE__)
| Reset UART handle states. More...
#define | __HAL_UART_ENABLE_IT(__HANDLE__, __INTERRUPT__)
| Enable the specified UART interrupt. More...
#define | __HAL_UART_DISABLE_IT(__HANDLE__, __INTERRUPT__)
| Disable the specified UART interrupt. More...
#define | __HAL_UART_SEND_REQ(__HANDLE__, __REQ__) ((__HANDLE__)->p_instance->SRR = (__REQ__))
| Flush the UART FIFO and treat FIFO as empty. More...
#define | IS_UART_BAUDRATE(__BAUDRATE__) ((__BAUDRATE__) < 921600U)
| Check if UART Baudrate is valid. More...
#define | IS_UART_STOPBITS(__STOPBITS__)
| Check if UART frame number of stop bits is valid. More...
#define | IS_UART_DATABITS(__DATABITS__)
| Check if UART frame number of data bits is valid. More...
#define | IS_UART_PARITY(__PARITY__)
| Check if UART frame parity is valid. More...
#define | IS_UART_HARDWARE_FLOW_CONTROL(__CONTROL__)
| Check if UART hardware flow control is valid. More...
#define | UART_DEFAULT_CONFIG
| Default configuartion for initializing structure. More...

## Typedefs
typedef struct _uart_init | uart_init_t
| UART init structure definition. More...
typedef struct _uart_handle | uart_handle_t
| UART handle Structure definition. More...
typedef struct _hal_uart_callback | hal_uart_callback_t
| HAL_UART Callback function definition. More...

## Enumerations
enum | hal_uart_state_t { HAL_UART_STATE_RESET = 0x00U, HAL_UART_STATE_READY = 0x10U, HAL_UART_STATE_BUSY = 0x14U, HAL_UART_STATE_BUSY_TX = 0x11U, HAL_UART_STATE_BUSY_RX = 0x12U, HAL_UART_STATE_BUSY_TXRX = 0x13U, HAL_UART_STATE_TIMEOUT = 0x30U, HAL_UART_STATE_ERROR = 0x70U }
| HAL UART State enumerations definition. More...

## Functions
hal_status_t | hal_uart_init (uart_handle_t *p_uart)
| Initialize the UART according to the specified parameters in the uart_init_t and initialize the associated handle. More...
hal_status_t | hal_uart_deinit (uart_handle_t *p_uart)
| De-initialize the UART peripheral. More...
void | hal_uart_msp_init (uart_handle_t *p_uart)
| Initialize the UART MSP. More...
void | hal_uart_msp_deinit (uart_handle_t *p_uart)
| De-initialize the UART MSP. More...
hal_status_t | hal_uart_transmit (uart_handle_t *p_uart, uint8_t *p_data, uint16_t size, uint32_t timeout)
| Send an amount of data in blocking mode. More...
hal_status_t | hal_uart_receive (uart_handle_t *p_uart, uint8_t *p_data, uint16_t size, uint32_t timeout)
| Receive an amount of data in blocking mode. More...
hal_status_t | hal_uart_transmit_it (uart_handle_t *p_uart, uint8_t *p_data, uint16_t size)
| Send an amount of data in interrupt mode. More...
hal_status_t | hal_uart_receive_it (uart_handle_t *p_uart, uint8_t *p_data, uint16_t size)
| Receive an amount of data in interrupt mode. More...
hal_status_t | hal_uart_transmit_dma (uart_handle_t *p_uart, uint8_t *p_data, uint16_t size)
| Send an amount of data in DMA mode. More...
hal_status_t | hal_uart_receive_dma (uart_handle_t *p_uart, uint8_t *p_data, uint16_t size)
| Receive an amount of data in DMA mode. More...
hal_status_t | hal_uart_dma_pause (uart_handle_t *p_uart)
| Pause the DMA Transfer. More...
hal_status_t | hal_uart_dma_resume (uart_handle_t *p_uart)
| Resume the DMA Transfer. More...
hal_status_t | hal_uart_dma_stop (uart_handle_t *p_uart)
| Stop the DMA Transfer. More...
hal_status_t | hal_uart_abort (uart_handle_t *p_uart)
| Abort ongoing transfers (blocking mode). More...
hal_status_t | hal_uart_abort_transmit (uart_handle_t *p_uart)
| Abort ongoing Transmit transfer (blocking mode). More...
hal_status_t | hal_uart_abort_receive (uart_handle_t *p_uart)
| Abort ongoing Receive transfer (blocking mode). More...
hal_status_t | hal_uart_abort_it (uart_handle_t *p_uart)
| Abort ongoing transfers (Interrupt mode). More...
hal_status_t | hal_uart_abort_transmit_it (uart_handle_t *p_uart)
| Abort ongoing Transmit transfer (Interrupt mode). More...
hal_status_t | hal_uart_abort_receive_it (uart_handle_t *p_uart)
| Abort ongoing Receive transfer (Interrupt mode). More...
void | hal_uart_irq_handler (uart_handle_t *p_uart)
| Handle UART interrupt request. More...
void | hal_uart_tx_cplt_callback (uart_handle_t *p_uart)
| Tx Transfer completed callback. More...
void | hal_uart_rx_cplt_callback (uart_handle_t *p_uart)
| Rx Transfer completed callback. More...
void | hal_uart_error_callback (uart_handle_t *p_uart)
| UART error callback. More...
void | hal_uart_abort_cplt_callback (uart_handle_t *p_uart)
| UART Abort Complete callback. More...
void | hal_uart_abort_tx_cplt_callback (uart_handle_t *p_uart)
| UART Abort Tansmit Complete callback. More...
void | hal_uart_abort_rx_cplt_callback (uart_handle_t *p_uart)
| UART Abort Receive Complete callback. More...
hal_uart_state_t | hal_uart_get_state (uart_handle_t *p_uart)
| Return the UART handle state. More...
uint32_t | hal_uart_get_error (uart_handle_t *p_uart)
| Return the UART handle error code. More...
hal_status_t | hal_uart_suspend_reg (uart_handle_t *p_uart)
| Suspend some registers related to UART configuration before sleep. More...
hal_status_t | hal_uart_resume_reg (uart_handle_t *p_uart)
| Restore some registers related to UART configuration after sleep. More...

## Detailed Description

Header file containing functions prototypes of UART HAL library.

Author
  BLE Driver Team

Attention

  ##### Copyright (c) 2019 GOODIX

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of GOODIX nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

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

Definition in file gr55xx_hal_uart.h.