Overview of HAL drivers
__HAL_PPP_XXXX (__HANDLE__, __PARAM__)
__HAL_PPP_GET_ IT_SOURCE (__HANDLE__, __
NVIC and SYSTICK are two ARM Cortex core features. The APIs related to these
features are located in the stm32f2xx_hal_cortex.c file.
When a status bit or a flag is read from registers, it is composed of shifted values
depending on the number of read values and of their size. In this case, the returned
status width is 32 bits. Example : STATUS = XX | (YY << 16) or STATUS = XX | (YY
<< 8) | (YY << 16) | (YY << 24)".
The PPP handles are valid before using the HAL_PPP_Init() API. The init function
performs a check before modifying the handle fields.
HAL_PPP_Init(PPP_HandleTypeDef)
if(hppp == NULL)
{
return HAL_ERROR;
}
The macros defined below are used:
#define ABS(x) (((x) > 0) ? (x) : -(x))
#define __HAL_LINKDMA(__HANDLE__, __PPP_DMA_FIELD_, __DMA_HANDLE_) \
do{ \
(__HANDLE__)->__PPP_DMA_FIELD_ = &(__DMA_HANDLE_); \
(__DMA_HANDLE_).Parent = (__HANDLE__); \
} while(0)
2.5.3
HAL interrupt handler and callback functions
Besides the APIs, HAL peripheral drivers include:
HAL_PPP_IRQHandler() peripheral interrupt handler that should be called
fromstm32f2xx_it.c
User callback functions.
The user callback functions are defined as empty functions with "weak" attribute. They
have to be defined in the user code.
There are three types of user callbacks functions:
Peripheral system level initialization/ de-Initialization callbacks: HAL_PPP_MspInit()
and HAL_PPP_MspDeInit
Process complete callbacks : HAL_PPP_ProcessCpltCallback
Error callback: HAL_PPP_ErrorCallback.
Callback functions
HAL_PPP_MspInit() / _DeInit()
38/1371
Macros
__HAL_PPP_DISABLE(__HANDLE__)
INTERRUPT __)
Conditional macro:
Pseudo-code macro (multiple instructions macro):
DocID028236 Rev 2
Table 8: Callback functions
Ex: HAL_USART_MspInit()
Called from HAL_PPP_Init() API function to perform peripheral
system level initialization (GPIOs, clock, DMA, interrupt)
Description
Disables a peripheral
Specific PPP HAL driver macro
Checks the source of specified
interrupt
Example
UM1940
Need help?
Do you have a question about the STM32F2 and is the answer not in the manual?
Questions and answers