HAL UART migration: List of applicable concepts ¶
This section provides information about the HAL UART applicable architecture concepts.
Concepts for UART ¶
|
Concept |
Description |
|---|---|
|
The initialization has been split into separate init and config functions:
|
|
|
Removal and conversion of init structure to configuration structure |
The init structure
|
|
The handle structure has been renamed to
|
|
|
The structure
|
|
|
|
|
|
New APIs are available to get and set UART features |
|
|
The
|
|
|
Two functions to set and get user data are available:
|
|
|
Individual callback registration APIs replace global register and unregister functions |
The callback registration is handled by specific functions for each UART event. These functions are used to register callback functions for different UART events. |
|
HAL UART APIs now rely on LL APIs rather than performing direct register access. |
|
|
Define statements and enumerations redirected to LL equivalents |
HAL UART define statements and enumerations are based on LL define statements. |
|
All hardware macros have been removed from the HAL UART driver, and equivalent services are ensured through the LL APIs. |
|
|
The UART is now managed by three state machines:
|
|
|
The HAL UART functions were updated to return:
|
|
|
Redesign the error handling mechanisms within the HAL to improve the detection, reporting, and handling of errors. This rework aims to provide more detailed and consistent error information such as
|
|
|
New APIs for filtering optional asynchronous process interrupts |
New HAL UART Transmit APIs with interrupt filtering capability are provided, such as
|
|
All TypeDef parts of the HAL UART driver have been removed and replaced by
|
|
|
For the HAL UART driver, large macros have been replaced by inline functions to maintain code consistency, improve readability, and benefit from compiler optimization. Inline functions also offer better support for debugging and strict type management, reducing the risk of errors. |
|
|
Const keywords have been added to non-modifiable pointers to ensure that either the pointer itself or the data it points to cannot be modified. This enhances code safety and readability, prevents unintended modifications, and renders code more robust and maintainable. |
|
|
The parameters and state are checked using
|
|
|
Merge HAL extension files with common ones and remove the EX prefix from APIs. |
Only one HAL UART header file remains and all macros, define statements, and functions from
|
|
Provide RTOS-compatible acquire/release bus services for communication peripheral drivers. |
New functions,
|
|
Add HAL PPP Services for Drivers with Handle to Retrieve Corresponding Peripheral Clock Frequency. |
HAL UART Driver provides a new API to retrieve clock frequency:
|
|
Replace Finite Parameter Defines (Including PPP Instances) with Enum Types at HAL Levels. |
Finite parameters (including UART instances) have been converted into enumerated types (enums) at HAL level. This improves code readability, maintainability, and type safety. |
|
Add HAL_PPP Prefix to All HAL Peripheral APIs (Defines, Macros, Types, and Functions). |
All HAL UART functions start with
|
Other HAL UART changes ¶
|
Concept |
Consideration |
|---|---|
|
Introduce Reception until timeout API |
Provide an API to manage reception flow until the expected data length is received or a reception timeout
|
|
Introduce Reception until character match API |
Provide an API to manage reception flow until the expected data length is received or a specific character value is detected. |
|
Add DMA
|
Provide new services to
|
|
Remove
|
This function’s functionality is already covered by
|
|
Rework Advanced feature APIs |
Advanced feature APIs are no more handled by the init function and structure. Instead dedicated advanced features APIs are provided individually for each feature. |
|
Merge RxComplete callback with RxEvent callback |
The
|