HAL GFXTIM Use Cases

Prerequisite

This diagram illustrates the prerequisite steps for initializing the system

@startuml

' To add a number by line

'autonumber



' Fix order of each column

participant "User Application" as user

participant "System Driver" as system



==================================== Prerequisite ==

user->system : HAL_Init()

system --> user

user->system : Configure system clock

system --> user

@enduml

Called functions:

User application Absolute Line

@startuml

' To add a number by line

'autonumber



' Fix order of each column

participant "User Application" as user

participant "GFXTIM Driver" as GFXTIM

participant "RCC" as RCC

participant "NVIC" as nvic

participant "HW" as HW



== GFXTIM HAL Initilaization ==



user->GFXTIM : HAL_GFXTIM_Init()

alt#grey #lightgrey If USE_HAL_GFXTIM_CLK_ENABLE_MODEL > HAL_CLK_ENABLE_NO

GFXTIM->RCC : Enable the GFXTIM clock

end



GFXTIM --> user: HAL_OK

user -> nvic : HAL_CORTEX_NVIC_SetPriority()

user -> nvic : HAL_CORTEX_NVIC_EnableIRQ()



alt#grey #lightgrey If USE_HAL_GFXTIM_CLK_ENABLE_MODEL == HAL_CLK_ENABLE_NO

user->RCC : Enable the GFXTIM clock

end



Note right of nvic: Clock enabling : 2 alternative \n\

- Either enable the GFXTIM clock at user code,\n\

- Either set the define USE_HAL_GFXTIM_CLK_ENABLE_MODEL \n\

to  HAL_CLK_ENABLE_PERIPH_ONLY  and \n\

the clock will be enabled within the HAL_GFXTIM_Init()



== GFXTIM Line Clock Generator ==

group #FFAA90 Line clock generator

user->GFXTIM : HAL_GFXTIM_CLKGEN_SetConfigLineFrameClock()

note right : Configure the Frame and Line clock generator

user<--GFXTIM: HAL_OK 

end



== GFXTIM Absolute line ==

group #FFCAA0 GFXTIM Absolute line

user->GFXTIM : HAL_GFXTIM_ABSTIM_SetLineCounter()

user<--GFXTIM: HAL_OK

user->GFXTIM : HAL_GFXTIM_ABSTIM_SetLineCompareValue()

user<--GFXTIM: HAL_OK

user->GFXTIM : HAL_GFXTIM_ABSTIM_Start()

note right : - Only the Absolute Line to be started \n- Start the absolute line interrupt(s)

user<--GFXTIM: HAL_OK



group #FFFFFF If interrupt is enabled

HW -> nvic : interrupt

nvic->GFXTIM : HAL_GFXTIM_IRQHandler()

GFXTIM-> GFXTIM: Clear flags

user<--GFXTIM: HAL_GFXTIM_ABSTIM_LCntOverFlowCallback()

note right : If the absolute line counter overflow event is raised and the corresponding interrupt is enabled

user<--GFXTIM: HAL_GFXTIM_ABSTIM_LCmpCallback()

note right : If the absolute line comparator event is raised and the corresponding interrupt is enabled

end



group #DFEAA0 Optional

user->GFXTIM : HAL_GFXTIM_ABSTIM_Pause()

user<--GFXTIM: HAL_OK

user->GFXTIM : HAL_GFXTIM_ABSTIM_Resume()

user<--GFXTIM: HAL_OK

user->GFXTIM : HAL_GFXTIM_ABSTIM_Stop()

user<--GFXTIM: HAL_OK

end

end

@enduml

Called functions:

User application Absolute Frame

@startuml

' To add a number by line

'autonumber



' Fix order of each column

participant "User Application" as user

participant "GFXTIM Driver" as GFXTIM

participant "RCC" as RCC

participant "NVIC" as nvic

participant "HW" as HW



== GFXTIM HAL Initilaization ==

user->GFXTIM : HAL_GFXTIM_Init()

alt#grey #lightgrey If USE_HAL_GFXTIM_CLK_ENABLE_MODEL > HAL_CLK_ENABLE_NO

GFXTIM->RCC : Enable the GFXTIM clock

end



GFXTIM --> user: HAL_OK

user -> nvic : HAL_CORTEX_NVIC_SetPriority()

user -> nvic : HAL_CORTEX_NVIC_EnableIRQ()



alt#grey #lightgrey If USE_HAL_GFXTIM_CLK_ENABLE_MODEL == HAL_CLK_ENABLE_NO

user->RCC : Enable the GFXTIM clock

end



Note right of nvic: Clock enabling : 2 alternative \n\

- Either enable the GFXTIM clock at user code,\n\

- Either set the define USE_HAL_GFXTIM_CLK_ENABLE_MODEL \n\

to  HAL_CLK_ENABLE_PERIPH_ONLY  and \n\

the clock will be enabled within the HAL_GFXTIM_Init()

== GFXTIM Frame Clock Generator ==

alt#grey #FFAA90 If configure the Frame and Line clock generator

user->GFXTIM : HAL_GFXTIM_CLKGEN_SetConfigFrameLineClock()

note right : Configure the frame and line clock generator

user<--GFXTIM: HAL_OK 

end



alt#grey #C0FFC0 If configure the Frame clock generator

user->GFXTIM : HAL_GFXTIM_CLKGEN_SetConfigFrameClock()

note right : Configure the frame clock generator

user<--GFXTIM: HAL_OK 

end



== GFXTIM Absolute frame ==

group #F0FFF0 GFXTIM Absolute Frame

user->GFXTIM : HAL_GFXTIM_ABSTIM_SetFrameCounter()

user<--GFXTIM : HAL_OK

user->GFXTIM : HAL_GFXTIM_ABSTIM_SetFrameCompareValue()

user<--GFXTIM: HAL_OK 

user->GFXTIM : HAL_GFXTIM_ABSTIM_Start()

note right : - Only the Absolute frame to be started \n- Start the absolute frame interrupt(s)

user<--GFXTIM: HAL_OK

group #FFFFFF If interrupt is enabled

HW -> nvic : interrupt

nvic->GFXTIM : HAL_GFXTIM_IRQHandler()

GFXTIM-> GFXTIM: Clear flags

user<--GFXTIM: HAL_GFXTIM_ABSTIM_FrmCntOverFlowCallback()

note right : If the absolute frame counter overflow event is raised and the corresponding interrupt is enabled

user<--GFXTIM: HAL_GFXTIM_ABSTIM_FrmCmpCallback()

note right : If the absolute frame counter comparator 1 event is raised and the corresponding interrupt is enabled

end



group #D0FFD0 Optional

user->GFXTIM : HAL_GFXTIM_ABSTIM_Pause()

user<--GFXTIM : HAL_OK

user->GFXTIM : HAL_GFXTIM_ABSTIM_Resume()

user<--GFXTIM : HAL_OK

user->GFXTIM : HAL_GFXTIM_ABSTIM_Stop()

user<--GFXTIM: HAL_OK

end

end

@enduml

Called functions:

User application Absolute Line and Frame

@startuml

' To add a number by line

'autonumber



' Fix order of each column

participant "User Application" as user

participant "GFXTIM Driver" as GFXTIM

participant "RCC" as RCC

participant "NVIC" as nvic

participant "HW" as HW



== GFXTIM HAL Initilaization ==

user->GFXTIM : HAL_GFXTIM_Init()

alt#grey #lightgrey If USE_HAL_GFXTIM_CLK_ENABLE_MODEL > HAL_CLK_ENABLE_NO

GFXTIM->RCC : Enable the GFXTIM clock

end



GFXTIM --> user: HAL_OK

user -> nvic : HAL_CORTEX_NVIC_SetPriority()

user -> nvic : HAL_CORTEX_NVIC_EnableIRQ()



alt#grey #lightgrey If USE_HAL_GFXTIM_CLK_ENABLE_MODEL == HAL_CLK_ENABLE_NO

user->RCC : Enable the GFXTIM clock

end



Note right of nvic: Clock enabling : 2 alternative \n\

- Either enable the GFXTIM clock at user code,\n\

- Either set the define USE_HAL_GFXTIM_CLK_ENABLE_MODEL \n\

to  HAL_CLK_ENABLE_PERIPH_ONLY  and \n\

the clock will be enabled within the HAL_GFXTIM_Init()



== GFXTIM Frame and Line Clock Generator ==

group #A0FFA9 Frame and Line clock generator

user->GFXTIM : HAL_GFXTIM_CLKGEN_SetConfigLineFrameClock()

note right : Configure the Frame and Line clock generator

user<--GFXTIM: HAL_OK 

end



group #FFFFFF GFXTIM Absolute Line and Frame

user->GFXTIM : HAL_GFXTIM_ABSTIM_SetLineCounter()

user<--GFXTIM 

user->GFXTIM : HAL_GFXTIM_ABSTIM_SetLineCompareValue()

user<--GFXTIM: HAL_OK 

user->GFXTIM : HAL_GFXTIM_ABSTIM_SetFrameCounter()

user<--GFXTIM : HAL_OK

user->GFXTIM : HAL_GFXTIM_ABSTIM_SetFrameCompareValue()

user<--GFXTIM: HAL_OK 

user->GFXTIM : HAL_GFXTIM_ABSTIM_Start()

note right : - Start the Absolute Line and the Absolute Frame\n- Start the absolute Line and the absolute Frame interrupt(s)

user<--GFXTIM: HAL_OK



group #FFFFFF If interrupt is enabled

HW -> nvic : interrupt

nvic->GFXTIM : HAL_GFXTIM_IRQHandler()

GFXTIM-> GFXTIM: Clear flags

user<--GFXTIM: HAL_GFXTIM_ABSTIM_LCntOverFlowCallback()

note right : If the absolute line counter overflow event is raised and the corresponding interrupt is enabled

user<--GFXTIM: HAL_GFXTIM_ABSTIM_LCmpCallback()

note right : If the absolute line counter overflow event is raised and the corresponding interrupt is enabled

user<--GFXTIM: HAL_GFXTIM_ABSTIM_FCntOverFlowCallback()

note right : If the absolute frame counter overflow event is raised and the corresponding interrupt is enabled

user<--GFXTIM: HAL_GFXTIM_ABSTIM_FCmpCallback()

note right : If the absolute frame counter comparator 1 event is raised and the corresponding interrupt is enabled

end



group #FFFFFF Optional

user->GFXTIM : HAL_GFXTIM_ABSTIM_Pause()

user<--GFXTIM: HAL_OK

user->GFXTIM : HAL_GFXTIM_ABSTIM_Resume()

user<--GFXTIM: HAL_OK 

user->GFXTIM : HAL_GFXTIM_ABSTIM_Stop()

user<--GFXTIM: HAL_OK 

end

end

@enduml

Called functions:

User application Relative Frame in continuous mode

@startuml

' To add a number by line

'autonumber



' Fix order of each column

participant "User Application" as user

participant "GFXTIM Driver" as GFXTIM

participant "RCC" as RCC

participant "NVIC" as nvic

participant "HW" as HW



== GFXTIM HAL Initilaization ==

user->GFXTIM : HAL_GFXTIM_Init()

alt#grey #lightgrey If USE_HAL_GFXTIM_CLK_ENABLE_MODEL > HAL_CLK_ENABLE_NO

GFXTIM->RCC : Enable the GFXTIM clock

end



GFXTIM --> user: HAL_OK

user -> nvic : HAL_CORTEX_NVIC_SetPriority()

user -> nvic : HAL_CORTEX_NVIC_EnableIRQ()



alt#grey #lightgrey If USE_HAL_GFXTIM_CLK_ENABLE_MODEL == HAL_CLK_ENABLE_NO

user->RCC : Enable the GFXTIM clock

RCC --> user

end

Note right of nvic: Clock enabling : 2 alternative \n\

- Either enable the GFXTIM clock at user code,\n\

- Either set the define USE_HAL_GFXTIM_CLK_ENABLE_MODEL \n\

to  HAL_CLK_ENABLE_PERIPH_ONLY  and \n\

the clock will be enabled within the HAL_GFXTIM_Init



== GFXTIM Frame Clock Generator ==

alt#grey #FFAA90 If configure the frame and line clock generator

user->GFXTIM : HAL_GFXTIM_CLKGEN_SetConfigLineFrameClock()

note right : Configure the frame and line clock generator

user<--GFXTIM: HAL_OK 

end



alt#grey #C0FFC0 If configure the Frame clock generator

user->GFXTIM : HAL_GFXTIM_CLKGEN_SetConfigFrameClock()

note right : Configure the frame clock generator

user<--GFXTIM: HAL_OK 

end



== GFXTIM Relative frame ==

group #F0FFF0 GFXTIM Relative Frame in continuous mode

user->GFXTIM : HAL_GFXTIM_RELTIM_StartContinuous()

note right : - Start the Relative Frame counter (counter 1 Or counter 2)\n- Set the autoreload value\n- Enable the interrupt(s) for the given timer

user<--GFXTIM: HAL_OK

user->GFXTIM : HAL_GFXTIM_RELTIM_GetCounter()

user<--GFXTIM: HAL_OK 



group #FFFFFF If interrupt is enabled

HW -> nvic : interrupt

nvic->GFXTIM : HAL_GFXTIM_IRQHandler()

GFXTIM-> GFXTIM: Clear flags

user<--GFXTIM: HAL_GFXTIM_RELTIM_FCntReloadCallback()

note right : If the relative frame counter event is raised and the corresponding interrupt is enabled

end



group #AFF9F0 Optional

user->GFXTIM : HAL_GFXTIM_RELTIM_SetReloadValue()

user<--GFXTIM: HAL_OK 

user->GFXTIM : HAL_GFXTIM_RELTIM_ForceReload()

user<--GFXTIM: HAL_OK 

user->GFXTIM : HAL_GFXTIM_RELTIM_StopContinuous()

user<--GFXTIM: HAL_OK 

end 

end

@enduml

Called functions:

User application Relative Frame in one shot mode

@startuml

' To add a number by line

'autonumber

' Fix order of each column

participant "User Application" as user

participant "GFXTIM Driver" as GFXTIM

participant "RCC" as RCC

participant "NVIC" as nvic

participant "HW" as HW



== GFXTIM HAL Initilaization ==

user->GFXTIM : HAL_GFXTIM_Init()

alt#grey #lightgrey If USE_HAL_GFXTIM_CLK_ENABLE_MODEL > HAL_CLK_ENABLE_NO

GFXTIM->RCC : Enable the GFXTIM clock

end



GFXTIM --> user: HAL_OK

user -> nvic : HAL_CORTEX_NVIC_SetPriority()

user -> nvic : HAL_CORTEX_NVIC_EnableIRQ()



alt#grey #lightgrey If USE_HAL_GFXTIM_CLK_ENABLE_MODEL == HAL_CLK_ENABLE_NO

user->RCC : Enable the GFXTIM clock

end

Note right of nvic: Clock enabling : 2 alternative \n\

- Either enable the GFXTIM clock at user code,\n\

- Either set the define USE_HAL_GFXTIM_CLK_ENABLE_MODEL \n\

to  HAL_CLK_ENABLE_PERIPH_ONLY  and \n\

the clock will be enabled within the HAL_GFXTIM_Init



== GFXTIM Frame Clock Generator ==

alt#grey #FFAA90 If configure the frame and line clock generator

user->GFXTIM : HAL_GFXTIM_CLKGEN_SetConfigLineFrameClock()

note right : Configure the frame and line clock generator

user<--GFXTIM: HAL_OK 

end



alt#grey #C0FFC0 If configure the Frame clock generator

user->GFXTIM : HAL_GFXTIM_CLKGEN_SetConfigFrameClock()

note right : Configure the frame clock generator

user<--GFXTIM: HAL_OK 

end



== GFXTIM Relative frame ==

group #F0FFF0 GFXTIM Relative Frame in one shot mode

user->GFXTIM : HAL_GFXTIM_RELTIM_StartOneShot()

note right : - Start the Relative Frame counter (counter 1 Or counter 2)\n- Set the autoreload value\n- Enable the interrupt(s) for the given timer

user<--GFXTIM: HAL_OK 



group #FFFFFF If interrupt is disabled 

user->GFXTIM : HAL_GFXTIM_RELTIM_PollForOneShot()

note right : - To be used to update the relative timer(s) state when interrupt is disabled \n- Select the Relative Frame counter (counter 1 Or counter 2)\n- Set the Timeout

user<--GFXTIM: HAL_OK

user<--GFXTIM: timeout_ms

end



group #FFFFFF If interrupt is enabled 

HW -> nvic : interrupt

nvic->GFXTIM : HAL_GFXTIM_IRQHandler()

GFXTIM-> GFXTIM: Clear flags

user<--GFXTIM: HAL_GFXTIM_RELTIM_FCntReloadCallback()

note right : If the relative frame counter event is raised and the corresponding interrupt is enabled

end



group #AFF9F0 Optional

user->GFXTIM : HAL_GFXTIM_RELTIM_SetReload()

user<--GFXTIM: HAL_OK 

user->GFXTIM : HAL_GFXTIM_RELTIM_ForceReload()

user<--GFXTIM: HAL_OK 

user->GFXTIM : HAL_GFXTIM_RELTIM_GetCounter()

user<--GFXTIM: HAL_OK

end 



end

@enduml

Called functions:

User application Watchdog Timer

@startuml

' To add a number by line

'autonumber

' Fix order of each column

participant "User Application" as user

participant "GFXTIM Driver" as GFXTIM

participant "RCC" as RCC

participant "NVIC" as nvic

participant "HW" as HW



== GFXTIM HAL Initilaization ==

user->GFXTIM : HAL_GFXTIM_Init()

alt#grey #lightgrey If USE_HAL_GFXTIM_CLK_ENABLE_MODEL > HAL_CLK_ENABLE_NO

GFXTIM->RCC : Enable the GFXTIM clock

end



GFXTIM --> user: HAL_OK

user -> nvic : HAL_CORTEX_NVIC_SetPriority()

user -> nvic : HAL_CORTEX_NVIC_EnableIRQ()



alt#grey #lightgrey If USE_HAL_GFXTIM_CLK_ENABLE_MODEL == HAL_CLK_ENABLE_NO

user->RCC : Enable the GFXTIM clock

end



Note right of nvic: Clock enabling : 2 alternative \n\

- Either enable the GFXTIM clock at user code,\n\

- Either set the define USE_HAL_GFXTIM_CLK_ENABLE_MODEL \n\

to  HAL_CLK_ENABLE_PERIPH_ONLY  and \n\

the clock will be enabled within the HAL_GFXTIM_Init()



== GFXTIM Watchdog Timer Configuration==



alt#grey If WDG source is the GFXTIM HSYNC_VSYNC or TE

note right of user: Nothing to do

end



alt#grey #C0FFC0 If WDG source is the GFXTIM Frame clock generator

user->GFXTIM : HAL_GFXTIM_CLKGEN_SetConfigLineFrameClock()

note right : Configure the frame clock generator

user<--GFXTIM: HAL_OK 

end

alt#grey #FFCAA0 If WDG source is the GFXTIM Line clock generator

user->GFXTIM : HAL_GFXTIM_CLKGEN_SetConfigFrameLineClock()

note right : Configure the frame and line clock generator

user<--GFXTIM: HAL_OK 

end



user->GFXTIM :<b> HAL_GFXTIM_WDG_SetConfig()

note right : if the watchdog source is from Tearing-effect or VSYNC_HSYNC

user<--GFXTIM: <b>HAL_OK 



== GFXTIM Watchdog Timer ==

group #F0FFF0 GFXTIM Watchdog Timer

user->GFXTIM : HAL_GFXTIM_WDG_Start()

user<--GFXTIM: HAL_OK 



group #FFFFFF If interrupt is enabled 

HW -> nvic : interrupt

nvic->GFXTIM : HAL_GFXTIM_IRQHandler()

GFXTIM-> GFXTIM: Clear flags

user<--GFXTIM: HAL_GFXTIM_WDG_AlarmCallback()

note right : If the watchdog alarm interrupt is enabled

user<--GFXTIM: HAL_GFXTIM_WDG_PreAlarmCallback()

note right : If the watchdog pre-alarm interrupt is enabled

end



group #AFF9F0 Optional

user->GFXTIM : HAL_GFXTIM_WDG_Refresh()

user<--GFXTIM: HAL_OK 

user->GFXTIM : HAL_GFXTIM_WDG_Stop()

user<--GFXTIM: HAL_OK 

end 



end

@enduml

Called functions: