HAL_UART_STATE_RESET=0x00,/*!< Peripheral is not yet Initialized */
HAL_UART_STATE_READY=0x01,/*!< Peripheral Initialized and ready for use */
HAL_UART_STATE_BUSY=0x02,/*!< an internal process is ongoing */
HAL_UART_STATE_BUSY_TX=0x12,/*!< Data Transmission process is ongoing */
HAL_UART_STATE_BUSY_RX=0x22,/*!< Data Reception process is ongoing */
HAL_UART_STATE_BUSY_TX_RX=0x32,/*!< Data Transmission and Reception process is ongoing */
HAL_UART_STATE_TIMEOUT=0x03,/*!< Timeout state */
HAL_UART_STATE_ERROR=0x04/*!< Error */
}HAL_UART_StateTypeDef;
typedefenum
{
HAL_UART_ERROR_NONE=0x00,/*!< No error */
HAL_UART_ERROR_ORE=0x01,/*!< Overrun error. A start bit is received while the previous data still lies in RXD. (Previous data is lost.) */
HAL_UART_ERROR_PE=0x02,/*!< Parity error. A character with bad parity is received, if HW parity check is enabled. */
HAL_UART_ERROR_FE=0x04,/*!< Frame error. A valid stop bit is not detected on the serial data input after all bits in a character have been received. */
HAL_UART_ERROR_BE=0x08,/*!< Break error. The serial data input is '0' for longer than the length of a data frame. (The data frame length is 10 bits without parity bit, and 11 bits with parity bit.). */
}HAL_UART_ErrorTypeDef;
typedefenum{
HAL_UART_BAUD_1K2=0,/**< 1200 baud */
HAL_UART_BAUD_2K4,/**< 2400 baud */
HAL_UART_BAUD_4K8,/**< 4800 baud */
HAL_UART_BAUD_9K6,/**< 9600 baud */
HAL_UART_BAUD_14K4,/**< 14.4 kbaud */
HAL_UART_BAUD_19K2,/**< 19.2 kbaud */
HAL_UART_BAUD_28K8,/**< 28.8 kbaud */
HAL_UART_BAUD_38K4,/**< 38.4 kbaud */
HAL_UART_BAUD_57K6,/**< 57.6 kbaud */
HAL_UART_BAUD_76K8,/**< 76.8 kbaud */
HAL_UART_BAUD_115K2,/**< 115.2 kbaud */
HAL_UART_BAUD_230K4,/**< 230.4 kbaud */
HAL_UART_BAUD_250K0,/**< 250.0 kbaud */
HAL_UART_BAUD_500K0,/**< 500.0 kbaud */
HAL_UART_BAUD_1M0/**< 1 mbaud */
}hal_uart_baudrate_t;
typedefstruct{
uint32_tbaud_rate;
uint32_tflow_control;
}UART_InitTypeDef;
typedefstruct
{
NRF_UART_Type*instance;/* UART registers base address */
UART_InitTypeDefinit;/* UART communication parameters */
uint8_t*p_tx_buff;/* Pointer to UART Tx transfer Buffer */
uint16_ttx_xfer_size;/* UART Tx Transfer size */
uint16_ttx_xfer_count;/* UART Tx Transfer Counter */
uint8_t*p_rx_buff;/* Pointer to UART Rx transfer Buffer */
uint16_trx_xfer_size;/* UART Rx Transfer size */
uint16_trx_xfer_count;/* UART Rx Transfer Counter */
__IOHAL_UART_StateTypeDefstate;/* UART communication state */