Hal Generic Apis; Table 9: Hal Generic Apis - ST STM32F2 User Manual

Description of stm32f2 hal and low layer drivers
Hide thumbs Also See for STM32F2:
Table of Contents

Advertisement

UM1940
Callback functions
HAL_PPP_ProcessCpltCallback
HAL_PPP_ErrorCallback
2.6

HAL generic APIs

The generic APIs provide common generic functions applying to all STM32 devices. They
are composed of four APIs groups:
Initialization and de-initialization functions:HAL_PPP_Init(), HAL_PPP_DeInit()
IO operation functions: HAL_PPP_Read(), HAL_PPP_Write(),HAL_PPP_Transmit(),
HAL_PPP_Receive()
Control functions: HAL_PPP_Set (), HAL_PPP_Get ().
State and Errors functions: HAL_PPP_GetState (), HAL_PPP_GetError ().
For some peripheral/module drivers, these groups are modified depending on the
peripheral/module implementation.
Example: in the timer driver, the API grouping is based on timer features (PWM, OC, IC...).
The initialization and de-initialization functions allow initializing a peripheral and configuring
the low-level resources, mainly clocks, GPIO, alternate functions (AF) and possibly DMA
and interrupts. The HAL_DeInit()function restores the peripheral default state, frees the
low-level resources and removes any direct dependency with the hardware.
The IO operation functions perform a row access to the peripheral payload data in write
and read modes.
The control functions are used to change dynamically the peripheral configuration and set
another operating mode.
The peripheral state and errors functions allow retrieving in runtime the peripheral and data
flow states, and identifying the type of errors that occurred. The example below is based on
the ADC peripheral. The list of generic APIs is not exhaustive. It is only given as an
example.
Function
group
Initialization
group
IO operation
group
Ex: HAL_USART_TxCpltCallback
Called by peripheral or DMA interrupt handler when the process
completes
Ex: HAL_USART_ErrorCallback
Called by peripheral or DMA interrupt handler when an error
occurs

Table 9: HAL generic APIs

Common API name
HAL_ADC_Init()
HAL_ADC_DeInit()
HAL_ADC_Start ()
HAL_ADC_Stop ()
DocID028236 Rev 2
Overview of HAL drivers
Example
Description
This function initializes the peripheral and
configures the low -level resources (clocks,
GPIO, AF..)
This function restores the peripheral default state,
frees the low-level resources and removes any
direct dependency with the hardware.
This function starts ADC conversions when the
polling method is used
This function stops ADC conversions when the
polling method is used
39/1371

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the STM32F2 and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Table of Contents

Save PDF