Skip to content

Latest commit

 

History

History
38 lines (22 loc) · 1.34 KB

File metadata and controls

38 lines (22 loc) · 1.34 KB

Universal asynchronous receiver / transmitter (UART) HAL

The usage of hal_uart driver is self documented in hal_uart.h header file. Please refer to it for details.

Typically, you need to work with the following functions:

int8_t uartInitRx(UartInstance_t instance, UartType_t, uint8_t buffer[], uint16_t size);
size_t uartGetLastReceivedIndex(UartInstance_t instance);

int8_t uartTransmit(UartInstance_t instance, const uint8_t buffer[], size_t size);

stm32 usage

If you want to use stm32 platform, you should specify LIBPERIPH_PLATFORM=stm32.

It is expected to configure the periphery in STM32CubeMX.

You should enable UART as shown below:

drawing

Ubuntu usage

If you want to use Ubuntu platform, you should specify LIBPERIPH_PLATFORM=ubuntu.

Ubuntu platform might used either for unit tests or for SITL mode.

For unit tests example based on Ubuntu implementation please check tests/periphery/test_uart.cpp.

In SITL mode it is expected to use the following functions:

void uartSetLastReceivedIndex(UartInstance_t instance, size_t last_recv_idx);

GNSS SITL example: gnss_sitl