Appiko
Macros | Enumerations | Functions

Hardware abstraction layer of the UART peripheral. This is compatible with both nrf51 and nRF52 SoCs. More...

Macros

#define UART_USED   HAL_UART_PERIPH_USED
 
#define LINE_END   '\n'
 

Enumerations

enum  hal_uart_baud_t {
  HAL_UART_BAUD_1200 = (0x0004F000UL), HAL_UART_BAUD_2400 = (0x0009D000UL), HAL_UART_BAUD_4800 = (0x0013B000UL), HAL_UART_BAUD_9600 = (0x00275000UL),
  HAL_UART_BAUD_14400 = (0x003AF000UL), HAL_UART_BAUD_19200 = (0x004EA000UL), HAL_UART_BAUD_28800 = (0x0075C000UL), HAL_UART_BAUD_38400 = (0x009D0000UL),
  HAL_UART_BAUD_57600 = (0x00EB0000UL), HAL_UART_BAUD_76800 = (0x013A9000UL), HAL_UART_BAUD_115200 = (0x01D60000UL), HAL_UART_BAUD_230400 = (0x03B00000UL),
  HAL_UART_BAUD_250000 = (0x04000000UL), HAL_UART_BAUD_460800 = (0x07400000UL), HAL_UART_BAUD_921600 = (0x0F000000UL), HAL_UART_BAUD_1M = (0x10000000UL)
}
 

Functions

void hal_uart_init (hal_uart_baud_t baud, void(*handler)(uint8_t *ptr))
 
void hal_uart_putchar (uint8_t cr)
 Send a single character through UART This function is used by printf_callback so that printf can be used. More...
 

Detailed Description

Macro Definition Documentation

◆ LINE_END

#define LINE_END   '\n'

The character that is checked by rx_collect to determine if a line of characters is received

Definition at line 47 of file hal_uart.h.

◆ UART_USED

#define UART_USED   HAL_UART_PERIPH_USED

Specify which TWIM peripheral is used for this HAL module

Definition at line 44 of file hal_uart.h.

Enumeration Type Documentation

◆ hal_uart_baud_t

Defines to specify the baudrate options for the uart data transfer

Enumerator
HAL_UART_BAUD_1200 

Uart baud rate of 1200.

HAL_UART_BAUD_2400 

Uart baud rate of 2400.

HAL_UART_BAUD_4800 

Uart baud rate of 4800.

HAL_UART_BAUD_9600 

Uart baud rate of 9600.

HAL_UART_BAUD_14400 

Uart baud rate of 14400.

HAL_UART_BAUD_19200 

Uart baud rate of 19200.

HAL_UART_BAUD_28800 

Uart baud rate of 28800.

HAL_UART_BAUD_38400 

Uart baud rate of 38400.

HAL_UART_BAUD_57600 

Uart baud rate of 57600.

HAL_UART_BAUD_76800 

Uart baud rate of 76800.

HAL_UART_BAUD_115200 

Uart baud rate of 115200.

HAL_UART_BAUD_230400 

Uart baud rate of 230400.

HAL_UART_BAUD_250000 

Uart baud rate of 250000.

HAL_UART_BAUD_460800 

Uart baud rate of 460800.

HAL_UART_BAUD_921600 

Uart baud rate of 921600.

HAL_UART_BAUD_1M 

Uart baud rate of 1M.

Definition at line 52 of file hal_uart.h.

Function Documentation

◆ hal_uart_init()

void hal_uart_init ( hal_uart_baud_t  baud,
void(*)(uint8_t *ptr)  handler 
)

Function to initialize the parameters of UART based on the configurations in boards.h

Parameters
baudThe baud rate of operation for the UART module
handlerThe handler which is called with a pointer to the data received on UART reception. If NULL, the UART reception is disabled

(UARTE_CONFIG_HWFC_Disabled << UARTE_CONFIG_HWFC_Pos) | (UARTE_CONFIG_PARITY_Excluded << UARTE_CONFIG_PARITY_Pos)

Definition at line 145 of file hal_uart.c.

Referenced by main().

◆ hal_uart_putchar()

void hal_uart_putchar ( uint8_t  cr)
Parameters
crThe character to be sent

Definition at line 115 of file hal_uart.c.