HAL GFXTIM How to Use ¶
- group GFXTIM_How_To_Use
-
GFXTIM peripheral overview ¶
The Graphic Timer peripheral (GFXTIM) allows a smart management of graphical events for frame or line counting.
This file provides firmware functions to manage the following functionalities:
-
Initialization and de-initialization functions
-
Frame and line clock generator functions
-
Tearing-effect functions
-
Absolute timer functions
-
Relative timers functions
-
Event generators functions
-
Watchdog timer functions
How to use the GFXTIM HAL module driver ¶
The GFXTIM HAL driver can be used as follows: ¶
This module provides 10 sets of APIs that allows to:
-
Initialize and De-Initialize the logical object:
-
To initialize the GFXTIM, use the HAL_GFXTIM_Init() function to:
-
Associate physical instance to logical object.
-
Enable the GFXTIM peripheral Clock:
-
Call the HAL_RCC_GFXTIM_EnableClock() function, which directly enables the clock for the GFXTIM peripheral.
-
Set the USE_HAL_GFXTIM_CLK_ENABLE_MODEL to HAL_CLK_ENABLE_PERIPH_ONLY in the stm32tnxx_hal_conf.h module. With this configuration, the GFXTIM peripheral clock will be automatically enabled during the initialization process by HAL_GFXTIM_Init() .
-
-
-
To de-initiliaze the GFXTIM peripheral, use the HAL_GFXTIM_DeInit() function that stops any ongoing processes and sets the GFXTIM handle states to reset.
-
-
Manage the clock generator Several APIs are available to manage the clock generator (Line clock generator and/ or Frame clock generator)
-
Configure the frame and line clock generator:
-
This functionality is provided by HAL_GFXTIM_CLKGEN_SetConfigLineFrameClock() function.
-
-
Get the line clock generator configuration:
-
This functionality is provided by HAL_GFXTIM_CLKGEN_GetConfigLineClock() function.
-
-
Configure the frame clock generator:
-
This functionality is provided by HAL_GFXTIM_CLKGEN_SetConfigFrameClock() function.
-
-
Get the frame clock generator configuration:
-
This functionality is provided by HAL_GFXTIM_CLKGEN_GetConfigFrameClock() function.
-
-
Force reload counter of clock generator:
-
This functionality is provided by HAL_GFXTIM_CLKGEN_ForceReloadCounter() function.
-
-
Enable, disable and check the line-clock calibration output:
-
These functionalities are provided respectively by HAL_GFXTIM_CLKGEN_EnableLineClkCalibOutput() , HAL_GFXTIM_CLKGEN_DisableLineClkCalibOutput() and HAL_GFXTIM_CLKGEN_IsEnabledLineClkCalibOutput() .
-
-
Enable, disable and check the frame-clock calibration output:
-
These functionalities are provided respectively by HAL_GFXTIM_CLKGEN_EnableFrameClkCalibOutput() , HAL_GFXTIM_CLKGEN_DisableFrameClkCalibOutput() and HAL_GFXTIM_CLKGEN_IsEnabledFrameClkCalibOutput() .
-
-
-
Control the Tearing-effect detection:
-
The Tearing-effect detection can be used to detect the tearing-effect in order to generate an interruption.
-
Configure the tearing-effect detection:
-
This functionality is provided by HAL_GFXTIM_SetConfigTearingEffect() function.
-
-
Get the tearing-effect detection configuration:
-
This functionality is provided by HAL_GFXTIM_GetConfigTearingEffect() function.
-
-
Enable and disable and check the tearing-effect detection interruption:
-
These functionalities are provided respectively by HAL_GFXTIM_EnableTearingEffectIT() , HAL_GFXTIM_DisableTearingEffectIT() and HAL_GFXTIM_IsEnabledTearingEffectIT() .
-
-
-
Manage the absolute line and the absolute frame: After clock generator configuration, the absolute timer (absolute line and/ or absolute frame) can be used.
-
Set and get the absolute line compare value:
-
These functionalities are provided respectively by HAL_GFXTIM_ABSTIM_SetLineCompareValue() and HAL_GFXTIM_ABSTIM_GetLineCompareValue() .
-
-
Set and get the absolute line counter value:
-
These functionalities are provided by HAL_GFXTIM_ABSTIM_SetLineCounter() and HAL_GFXTIM_ABSTIM_GetLineCounter() functions.
-
-
Set and get the absolute frame compare value:
-
These functionalities are provided respectively by HAL_GFXTIM_ABSTIM_SetFrameCompareValue() and HAL_GFXTIM_ABSTIM_GetFrameCompareValue() functions.
-
-
Set and get the absolute frame counter value:
-
These functionalities are provided by HAL_GFXTIM_ABSTIM_SetFrameCounter() and HAL_GFXTIM_ABSTIM_GetFrameCounter() functions.
-
-
Use HAL_GFXTIM_ABSTIM_Start() and HAL_GFXTIM_ABSTIM_Stop() functions to start and stop the absolute counter(s)
-
Use HAL_GFXTIM_ABSTIM_Pause() and HAL_GFXTIM_ABSTIM_Resume() functions to suspend and resume the absolute counter(s).
-
Get the absolute line and frame counters value simultaneously:
-
This functionality is provided by HAL_GFXTIM_ABSTIM_GetCounter() function.
-
-
-
Manage the relative timers: After frame clock generator configuration, the relative frame can be used. Several APIs are available to manage the relative timers.
-
Start and stop the relative frame counter in continuous mode:
-
These functionalities are provided respectively by HAL_GFXTIM_RELTIM_StartContinuous() and HAL_GFXTIM_RELTIM_StopContinuous() functions.
-
-
Set and force reload value of counter:
-
These functionalities are provided respectively by HAL_GFXTIM_RELTIM_SetReloadValue() and HAL_GFXTIM_RELTIM_ForceReload() functions.
-
-
Get the relative frame counter value:
-
This functionality is provided by HAL_GFXTIM_RELTIM_GetCounter() function.
-
-
Start the relative frame counter in one shot mode:
-
This functionality is provided by HAL_GFXTIM_RELTIM_StartOneShot() function.
-
-
Poll the relative frame counter in one shot mode when the interruptions are disabled. In this case a fixed timeout can be configured by user:
-
This functionality is provided by HAL_GFXTIM_RELTIM_PollForOneShot() function.
-
-
-
Configure the event generators: This feature is used to generate a complex event.
-
Configure the event generator:
-
This functionality is provided by HAL_GFXTIM_EVENTGEN_SetConfig() function.
-
-
Get the event generator configuration:
-
This functionality is provided by HAL_GFXTIM_EVENTGEN_GetConfig() function.
-
-
Start the event generator:
-
This functionality is provided by HAL_GFXTIM_EVENTGEN_Start() function.
-
-
Stop the event generator:
-
This functionality is provided by HAL_GFXTIM_EVENTGEN_Stop() function.
-
-
-
Manage the watchdog timer: The GFXTIM watchdog timer is used to generate an alarm and pre-alarm events.
-
Configure the watchdog timer:
-
This functionality is provided by HAL_GFXTIM_WDG_SetConfig() function.
-
-
Get the watchdog timer configuration:
-
This functionality is provided by HAL_GFXTIM_WDG_GetConfig() function.
-
-
Start the watchdog timer:
-
This functionality is provided by HAL_GFXTIM_WDG_Start() function.
-
-
Stop the watchdog timer:
-
This functionality is provided by HAL_GFXTIM_WDG_Stop() function.
-
-
Refresh the watchdog timer:
-
This functionality is provided by HAL_GFXTIM_WDG_Refresh() function.
-
-
-
Peripheral state Functions:
-
Use HAL_GFXTIM_GetState() function to get the GFXTIM current global state.
-
Use HAL_GFXTIM_CLKGEN_GetState() function to get the GFXTIM clock generator state.
-
Use HAL_GFXTIM_ABSTIM_GetLineState() function to get the GFXTIM absolute line state.
-
Use HAL_GFXTIM_ABSTIM_GetFrameState() function to get the GFXTIM absolute frame state.
-
Use HAL_GFXTIM_RELTIM_GetState() function to get the GFXTIM relative frame state.
-
Use HAL_GFXTIM_WDG_GetState() function to get the GFXTIM watchdog counter state.
-
-
IRQHandler and Callbacks Functions:
-
Use HAL_GFXTIM_IRQHandler() function to handle all GFXTIM interrupts.
-
Use HAL_GFXTIM_TearingEffectIRQHandler() function to handle only the tearing-effect interrupt.
-
Use HAL_GFXTIM_ABSTIM_FrameIRQHandler() function to handle only the absolute frame interrupts.
-
Use HAL_GFXTIM_ABSTIM_LineIRQHandler() function to handle only the absolute line interrupts.
-
Use HAL_GFXTIM_RELTIM_IRQHandler() function to handle only the relative framed interrupts.
-
Use HAL_GFXTIM_EVENTGEN_IRQHandler() function to handle only the event generator interrupts.
-
Use HAL_GFXTIM_WDG_IRQHandler() function to handle only the GFXTIM watchdog interrupts.
-
By default, after the HAL_GFXTIM_Init() , all callbacks are reset to the corresponding legacy weak (surcharged) functions: When the compilation flag USE_HAL_GFXTIM_REGISTER_CALLBACKS is set to 1, use HAL_GFXTIM_RegisterXxxCallback() functions to register an interrupt callback.
-
HAL_GFXTIM_RegisterTearingEffectCallback() : A Callback when a tearing-effect interrupt has occurred
-
HAL_GFXTIM_ABSTIM_RegisterFCmpCallback() : A Callback when an absolute frame counter compare interrupt has occurred.
-
HAL_GFXTIM_ABSTIM_RegisterFCntOverFlowCallback() : A Callback when an absolute frame counter overflow interrupt has occurred.
-
HAL_GFXTIM_ABSTIM_RegisterLCmpCallback() : A Callback when an absolute line counter compare(s) interrupt has occurred.
-
HAL_GFXTIM_ABSTIM_RegisterLCntOverFlowCallback() : A Callback when an absolute line counter overflow interrupt has occurred.
-
HAL_GFXTIM_RELTIM_RegisterFCntReloadCallback() : A Callback when a relative frame counter reload interrupt has occurred.
-
HAL_GFXTIM_EVENTGEN_RegisterEventCallback() : A Callback when an abort is completed.
-
HAL_GFXTIM_WDG_RegisterAlarmCallback() : A Callback when a watchdog alarm interrupt has occurred.
-
HAL_GFXTIM_WDG_RegisterPreAlarmCallback() : A Callback when a watchdog pre-alarm interrupt has occurred.
When the compilation flag is set to 0 or not defined, the callback registration feature is not available and all callbacks are set to the corresponding weak functions.
-
-
User data Functions:
-
Use HAL_GFXTIM_SetUserData() function to set the GFXTIM user data.
-
Use HAL_GFXTIM_GetUserData() function to get the GFXTIM user data.
-
-