1 /**
2 ******************************************************************************
3 * @file stm32u5xx_hal_gfxtim.c
4 * @author MCD Application Team
5 * @brief This file provides firmware functions to manage the following
6 * functionalities of the Multi-function Digital Filter (GFXTIM)
7 * peripheral:
8 * + Initialization and de-initialization
9 * + Integrated frame and line clock generation
10 * + One absolute frame counter with one compare channel
11 * + Two auto reload relative frame counter
12 * + One line timer with two compare channel
13 * + External Tearing Effect line management & synchronization
14 * + Four programmable event generators with external trigger generation
15 * + One watchdog counter
16 ******************************************************************************
17 * @attention
18 *
19 * Copyright (c) 2021 STMicroelectronics.
20 * All rights reserved.
21 *
22 * This software is licensed under terms that can be found in the LICENSE file
23 * in the root directory of this software component.
24 * If no LICENSE file comes with this software, it is provided AS-IS.
25 *
26 ******************************************************************************
27 @verbatim
28 ==============================================================================
29 ##### How to use this driver #####
30 ==============================================================================
31 [..]
32 *** Initialization and de-initialization ***
33 ============================================
34 [..]
35 (#) User has first to initialize GFXTIM.
36 (#) As prerequisite, fill in the HAL_GFXTIM_MspInit() :
37 (++) Enable GFXTIM with __HAL_RCC_GFXTIM_CLK_ENABLE
38 (++) Enable the clocks for the used GPIOS with __HAL_RCC_GPIOx_CLK_ENABLE().
39 (++) Configure these pins in alternate mode using HAL_GPIO_Init().
40 (++) If interrupt mode is used, enable and configure GFXTIM
41 interrupt with HAL_NVIC_SetPriority() and HAL_NVIC_EnableIRQ().
42
43 [..]
44 (#) User can de-initialize GFXTIM with HAL_GFXTIM_DeInit() function.
45
46 *** generic functions ***
47 =========================
48 [..]
49 (#) HAL_GFXTIM_IRQHandler will be called when GFXTIM interrupt occurs.
50 (#) HAL_GFXTIM_ErrorCallback will be called when GFXTIM or ADF error occurs.
51 (#) Use HAL_GFXTIM_GetState() to get the current GFXTIM or ADF instance state.
52 (#) Use HAL_GFXTIM_GetErrorCode() to get the current GFXTIM or ADF instance error code.
53
54
55
56 #if defined(GENERATOR_CALLBACKS_REGISTERING_AVAILABLE)
57 *** Callback registration ***
58 =============================================
59
60 The compilation define USE_HAL_GFXTIM_REGISTER_CALLBACKS when set to 1
61 allows the user to configure dynamically the driver callbacks.
62 Use Function @ref HAL_GFXTIM_RegisterCallback() to register an interrupt callback.
63
64 Function @ref HAL_GFXTIM_RegisterCallback() registers following callbacks:
65 (+) HAL_GFXTIM_AbsoluteTimer_AFCC1Callback
66 (+) HAL_GFXTIM_AbsoluteTimer_AFCOFCallback
67 (+) HAL_GFXTIM_AbsoluteTimer_ALCC1Callback
68 (+) HAL_GFXTIM_AbsoluteTimer_ALCC2Callback
69 (+) HAL_GFXTIM_AbsoluteTimer_ALCOFCallback
70 (+) HAL_GFXTIM_RelativeTimer_RFC1RCallback
71 (+) HAL_GFXTIM_RelativeTimer_RFC2RCallback
72 (+) HAL_GFXTIM_TECallback
73 (+) HAL_GFXTIM_EventGenerator_EV1Callback
74 (+) HAL_GFXTIM_EventGenerator_EV2Callback
75 (+) HAL_GFXTIM_EventGenerator_EV3Callback
76 (+) HAL_GFXTIM_EventGenerator_EV4Callback
77 (+) HAL_GFXTIM_WatchdogTimer_AlarmCallback
78 (+) HAL_GFXTIM_WatchdogTimer_PreAlarmCallback
79 (+) MspInitCallback
80 (+) MspDeInitCallback
81 This function takes as parameters the HAL peripheral handle, the Callback ID
82 and a pointer to the user callback function.
83
84 Use function @ref HAL_GFXTIM_UnRegisterCallback() to reset a callback to the default
85 weak function.
86 @ref HAL_GFXTIM_UnRegisterCallback takes as parameters the HAL peripheral handle,
87 and the Callback ID.
88 This function resets following callbacks:
89 (+) HAL_GFXTIM_AbsoluteTimer_AFCC1Callback
90 (+) HAL_GFXTIM_AbsoluteTimer_AFCOFCallback
91 (+) HAL_GFXTIM_AbsoluteTimer_ALCC1Callback
92 (+) HAL_GFXTIM_AbsoluteTimer_ALCC2Callback
93 (+) HAL_GFXTIM_AbsoluteTimer_ALCOFCallback
94 (+) HAL_GFXTIM_RelativeTimer_RFC1RCallback
95 (+) HAL_GFXTIM_RelativeTimer_RFC2RCallback
96 (+) HAL_GFXTIM_TECallback
97 (+) HAL_GFXTIM_EventGenerator_EV1Callback
98 (+) HAL_GFXTIM_EventGenerator_EV2Callback
99 (+) HAL_GFXTIM_EventGenerator_EV3Callback
100 (+) HAL_GFXTIM_EventGenerator_EV4Callback
101 (+) HAL_GFXTIM_WatchdogTimer_AlarmCallback
102 (+) HAL_GFXTIM_WatchdogTimer_PreAlarmCallback
103 (+) MspInitCallback
104 (+) MspDeInitCallback
105
106 By default, after the HAL_GFXTIM_Init() and when the state is HAL_GFXTIM_STATE_RESET,
107 all callbacks are set to the corresponding weak functions:
108 examples @ref HAL_GFXTIM_ErrorCallback(), @ref HAL_GFXTIM_CalculateCpltCallback().
109 Exception done for MspInit and MspDeInit functions that are
110 reset to the legacy weak function in the HAL_GFXTIM_Init()/ @ref HAL_GFXTIM_DeInit() only when
111 these callbacks are null (not registered beforehand).
112 if not, MspInit or MspDeInit are not null, the HAL_GFXTIM_Init()/ @ref HAL_GFXTIM_DeInit()
113 keep and use the user MspInit/MspDeInit callbacks (registered beforehand)
114
115 Callbacks can be registered/unregistered in HAL_GFXTIM_STATE_READY state only.
116 Exception done MspInit/MspDeInit that can be registered/unregistered
117 in HAL_GFXTIM_STATE_READY or HAL_GFXTIM_STATE_RESET state,
118 thus registered (user) MspInit/DeInit callbacks can be used during the Init/DeInit.
119 In that case first register the MspInit/MspDeInit user callbacks
120 using @ref HAL_GFXTIM_RegisterCallback() before calling @ref HAL_GFXTIM_DeInit()
121 or HAL_GFXTIM_Init() function.
122
123 When The compilation define USE_HAL_GFXTIM_REGISTER_CALLBACKS is set to 0 or
124 not defined, the callback registration feature is not available and all callbacks
125 are set to the corresponding weak functions.
126 #endif
127
128 @endverbatim
129 */
130 /* Includes ------------------------------------------------------------------*/
131 #include "stm32u5xx_hal.h"
132
133 /** @addtogroup STM32U5xx_HAL_Driver
134 * @{
135 */
136 #ifdef HAL_GFXTIM_MODULE_ENABLED
137 #if defined(GFXTIM)
138 /** @defgroup GFXTIM GFXTIM
139 * @brief GFXTIM HAL module driver
140 * @{
141 */
142
143 /* Exported functions ---------------------------------------------------------*/
144 /** @defgroup GFXTIM_Exported_Functions GFXTIM Exported Functions
145 * @{
146 */
147
148 /** @defgroup GFXTIM_Exported_Functions_Group1 Initialization and de-initialization functions
149 * @brief Initialization and de-initialization functions
150 *
151 @verbatim
152 ==============================================================================
153 ##### Initialization and de-initialization functions #####
154 ==============================================================================
155 [..] This section provides functions allowing to :
156 (+) Initialize the GFXTIM instance.
157 (+) De-initialize the GFXTIM instance.
158 (+) Register and unregister callbacks.
159 @endverbatim
160 * @{
161 */
162
163 /**
164 * @brief Initialize the GFXTIM instance according to the specified parameters
165 * in the GFXTIM_InitTypeDef structure and initialize the associated handle.
166 * @param hgfxtim GFXTIM handle.
167 * @retval HAL status.
168 */
HAL_GFXTIM_Init(GFXTIM_HandleTypeDef * hgfxtim)169 HAL_StatusTypeDef HAL_GFXTIM_Init(GFXTIM_HandleTypeDef *hgfxtim)
170 {
171 HAL_StatusTypeDef status = HAL_ERROR;
172
173 if (hgfxtim != NULL)
174 {
175 /* Check parameters */
176 assert_param(IS_GFXTIM_ALL_INSTANCE(hgfxtim->Instance));
177 assert_param(IS_GFXTIM_SYNC_SRC(hgfxtim->Init.SynchroSrc));
178 assert_param(IS_GFXTIM_TE_SRC(hgfxtim->Init.TearingEffectSrc));
179 assert_param(IS_GFXTIM_TE_POLARITY(hgfxtim->Init.TearingEffectPolarity));
180 assert_param(IS_GFXTIM_INTERRUPT(hgfxtim->Init.TearingEffectInterrupt));
181
182 if (hgfxtim->State == HAL_GFXTIM_STATE_RESET)
183 {
184 #if (USE_HAL_GFXTIM_REGISTER_CALLBACKS == 1)
185 /* Reset callback pointers to the weak predefined callbacks */
186 hgfxtim->HAL_GFXTIM_AbsoluteTimer_AFCC1Callback = HAL_GFXTIM_AbsoluteTimer_AFCC1Callback;
187 hgfxtim->HAL_GFXTIM_AbsoluteTimer_AFCOFCallback = HAL_GFXTIM_AbsoluteTimer_AFCOFCallback;
188 hgfxtim->HAL_GFXTIM_AbsoluteTimer_ALCC1Callback = HAL_GFXTIM_AbsoluteTimer_ALCC1Callback;
189 hgfxtim->HAL_GFXTIM_AbsoluteTimer_ALCC2Callback = HAL_GFXTIM_AbsoluteTimer_ALCC2Callback;
190 hgfxtim->HAL_GFXTIM_AbsoluteTimer_ALCOFCallback = HAL_GFXTIM_AbsoluteTimer_ALCOFCallback;
191 hgfxtim->HAL_GFXTIM_RelativeTimer_RFC1RCallback = HAL_GFXTIM_RelativeTimer_RFC1RCallback;
192 hgfxtim->HAL_GFXTIM_RelativeTimer_RFC2RCallback = HAL_GFXTIM_RelativeTimer_RFC2RCallback;
193 hgfxtim->HAL_GFXTIM_TECallback = HAL_GFXTIM_TECallback;
194 hgfxtim->HAL_GFXTIM_EventGenerator_EV1Callback = HAL_GFXTIM_EventGenerator_EV1Callback;
195 hgfxtim->HAL_GFXTIM_EventGenerator_EV2Callback = HAL_GFXTIM_EventGenerator_EV2Callback;
196 hgfxtim->HAL_GFXTIM_EventGenerator_EV3Callback = HAL_GFXTIM_EventGenerator_EV3Callback;
197 hgfxtim->HAL_GFXTIM_EventGenerator_EV4Callback = HAL_GFXTIM_EventGenerator_EV4Callback;
198 hgfxtim->HAL_GFXTIM_WatchdogTimer_AlarmCallback = HAL_GFXTIM_WatchdogTimer_AlarmCallback;
199 hgfxtim->HAL_GFXTIM_WatchdogTimer_PreAlarmCallback = HAL_GFXTIM_WatchdogTimer_PreAlarmCallback;
200 hgfxtim->ErrorCallback = HAL_GFXTIM_ErrorCallback;
201
202 /* Call GFXTIM MSP init function */
203 if (hgfxtim->MspInitCallback == NULL)
204 {
205 hgfxtim->MspInitCallback = HAL_GFXTIM_MspInit;
206 }
207 hgfxtim->MspInitCallback(hgfxtim);
208 #else /* USE_HAL_GFXTIM_REGISTER_CALLBACKS */
209 /* Call GFXTIM MSP init function */
210 HAL_GFXTIM_MspInit(hgfxtim);
211 #endif /* USE_HAL_GFXTIM_REGISTER_CALLBACKS */
212
213 /* Set Synchronization signals sources (HSYNC and VSYNC), Tearing Effect source and polarity, */
214 MODIFY_REG(hgfxtim->Instance->CR, \
215 GFXTIM_CR_SYNCS | GFXTIM_CR_TES | GFXTIM_CR_TEPOL,
216 hgfxtim->Init.SynchroSrc | hgfxtim->Init.TearingEffectSrc | hgfxtim->Init.TearingEffectPolarity);
217
218 /* Set tearing effect interrupt */
219 MODIFY_REG(hgfxtim->Instance->IER, GFXTIM_IER_TEIE,
220 (hgfxtim->Init.TearingEffectInterrupt << GFXTIM_IER_TEIE_Pos));
221
222 /* Update error code and state */
223 hgfxtim->ErrorCode = GFXTIM_ERROR_NONE;
224 hgfxtim->State = HAL_GFXTIM_STATE_READY;
225 status = HAL_OK;
226 }
227 }
228
229 return status;
230 }
231
232 /**
233 * @brief De-initialize the GFXTIM instance.
234 * @param hgfxtim GFXTIM handle.
235 * @retval HAL status.
236 */
HAL_GFXTIM_DeInit(GFXTIM_HandleTypeDef * hgfxtim)237 HAL_StatusTypeDef HAL_GFXTIM_DeInit(GFXTIM_HandleTypeDef *hgfxtim)
238 {
239 HAL_StatusTypeDef status = HAL_ERROR;
240
241 if (hgfxtim != NULL)
242 {
243 /* Check parameters */
244 assert_param(IS_GFXTIM_ALL_INSTANCE(hgfxtim->Instance));
245
246 if (hgfxtim->State == HAL_GFXTIM_STATE_READY)
247 {
248 /* Call GFXTIM MSP deinit function */
249 #if (USE_HAL_GFXTIM_REGISTER_CALLBACKS == 1)
250 if (hgfxtim->MspDeInitCallback == NULL)
251 {
252 hgfxtim->MspDeInitCallback = HAL_GFXTIM_MspDeInit;
253 }
254 hgfxtim->MspDeInitCallback(hgfxtim);
255 #else /* USE_HAL_GFXTIM_REGISTER_CALLBACKS */
256 HAL_GFXTIM_MspDeInit(hgfxtim);
257 #endif /* USE_HAL_GFXTIM_REGISTER_CALLBACKS */
258
259 /* Update state */
260 hgfxtim->State = HAL_GFXTIM_STATE_RESET;
261 status = HAL_OK;
262 }
263 }
264
265 return status;
266 }
267
268 /**
269 * @brief Initialize the GFXTIM instance MSP.
270 * @param hgfxtim GFXTIM handle.
271 * @retval None.
272 */
HAL_GFXTIM_MspInit(GFXTIM_HandleTypeDef * hgfxtim)273 __weak void HAL_GFXTIM_MspInit(GFXTIM_HandleTypeDef *hgfxtim)
274 {
275 /* Prevent unused argument(s) compilation warning */
276 UNUSED(hgfxtim);
277
278 /* NOTE : This function should not be modified, when the function is needed,
279 the HAL_GFXTIM_MspInit could be implemented in the user file */
280 }
281
282 /**
283 * @brief De-initialize the GFXTIM instance MSP.
284 * @param hgfxtim GFXTIM handle.
285 * @retval None.
286 */
HAL_GFXTIM_MspDeInit(GFXTIM_HandleTypeDef * hgfxtim)287 __weak void HAL_GFXTIM_MspDeInit(GFXTIM_HandleTypeDef *hgfxtim)
288 {
289 /* Prevent unused argument(s) compilation warning */
290 UNUSED(hgfxtim);
291
292 /* NOTE : This function should not be modified, when the function is needed,
293 the HAL_GFXTIM_MspDeInit could be implemented in the user file */
294 }
295
296 #if (USE_HAL_GFXTIM_REGISTER_CALLBACKS == 1)
297 /**
298 * @brief Register a user GFXTIM callback to be used instead of the weak predefined callback.
299 * @param hgfxtim GFXTIM handle.
300 * @param CallbackID ID of the callback to be registered.
301 * This parameter can be one of the following values:
302 * @arg @ref HAL_GFXTIM_AFC_COMPARE1_CB_ID Absolute frame counter compare 1 callback ID
303 * @arg @ref HAL_GFXTIM_AFC_OVERFLOW_CB_ID Absolute frame counter overflow callback ID
304 * @arg @ref HAL_GFXTIM_ALC_COMPARE1_CB_ID Absolute line counter compare 1 callback ID
305 * @arg @ref HAL_GFXTIM_ALC_COMPARE2_CB_ID Absolute line counter compare 2 callback ID
306 * @arg @ref HAL_GFXTIM_ALC_OVERFLOW_CB_ID Absolute line counter overflow callback ID
307 * @arg @ref HAL_GFXTIM_RFC1_RELOAD_CB_ID Relative frame counter 1 reload callback ID
308 * @arg @ref HAL_GFXTIM_RFC2_RELOAD_CB_ID Relative frame counter 2 reload callback ID
309 * @arg @ref HAL_GFXTIM_TE_CB_ID External tearing effect callback ID
310 * @arg @ref HAL_GFXTIM_EVENT1_CB_ID Event events 1 callback ID
311 * @arg @ref HAL_GFXTIM_EVENT2_CB_ID Event events 2 callback ID
312 * @arg @ref HAL_GFXTIM_EVENT3_CB_ID Event events 3 callback ID
313 * @arg @ref HAL_GFXTIM_EVENT4_CB_ID Event events 4 callback ID
314 * @arg @ref HAL_GFXTIM_WDG_ALARM_CB_ID Watchdog alarm callback ID
315 * @arg @ref HAL_GFXTIM_WDG_PREALARM_CB_ID Watchdog pre alarm callback ID
316 * @arg @ref HAL_GFXTIM_ERROR_CB_ID error callback ID
317 * @arg @ref HAL_GFXTIM_MSP_INIT_CB_ID MSP initialization user callback ID
318 * @arg @ref HAL_GFXTIM_MSP_DEINIT_CB_ID MSP de-initialization user callback ID
319 * @param pCallback pointer to the callback function.
320 * @retval HAL status.
321 */
HAL_GFXTIM_RegisterCallback(GFXTIM_HandleTypeDef * hgfxtim,HAL_GFXTIM_CallbackIDTypeDef CallbackID,pGFXTIM_CallbackTypeDef pCallback)322 HAL_StatusTypeDef HAL_GFXTIM_RegisterCallback(GFXTIM_HandleTypeDef *hgfxtim,
323 HAL_GFXTIM_CallbackIDTypeDef CallbackID,
324 pGFXTIM_CallbackTypeDef pCallback)
325 {
326 HAL_StatusTypeDef status = HAL_OK;
327
328 if (hgfxtim == NULL)
329 {
330 status = HAL_ERROR;
331 }
332 else if (pCallback == NULL)
333 {
334 /* Update error code and status */
335 hgfxtim->ErrorCode |= GFXTIM_ERROR_INVALID_CALLBACK;
336 status = HAL_ERROR;
337 }
338 else
339 {
340 if (hgfxtim->State == HAL_GFXTIM_STATE_READY)
341 {
342 switch (CallbackID)
343 {
344 case HAL_GFXTIM_AFC_COMPARE1_CB_ID :
345 hgfxtim->HAL_GFXTIM_AbsoluteTimer_AFCC1Callback = pCallback;
346 break;
347 case HAL_GFXTIM_AFC_OVERFLOW_CB_ID :
348 hgfxtim->HAL_GFXTIM_AbsoluteTimer_AFCOFCallback = pCallback;
349 break;
350 case HAL_GFXTIM_ALC_COMPARE1_CB_ID :
351 hgfxtim->HAL_GFXTIM_AbsoluteTimer_ALCC1Callback = pCallback;
352 break;
353 case HAL_GFXTIM_ALC_COMPARE2_CB_ID :
354 hgfxtim->HAL_GFXTIM_AbsoluteTimer_ALCC2Callback = pCallback;
355 break;
356 case HAL_GFXTIM_ALC_OVERFLOW_CB_ID :
357 hgfxtim->HAL_GFXTIM_AbsoluteTimer_ALCOFCallback = pCallback;
358 break;
359 case HAL_GFXTIM_RFC1_RELOAD_CB_ID :
360 hgfxtim->HAL_GFXTIM_RelativeTimer_RFC1RCallback = pCallback;
361 break;
362 case HAL_GFXTIM_RFC2_RELOAD_CB_ID :
363 hgfxtim->HAL_GFXTIM_RelativeTimer_RFC2RCallback = pCallback;
364 break;
365 case HAL_GFXTIM_TE_CB_ID :
366 hgfxtim->HAL_GFXTIM_TECallback = pCallback;
367 break;
368 case HAL_GFXTIM_EVENT1_CB_ID :
369 hgfxtim->HAL_GFXTIM_EventGenerator_EV1Callback = pCallback;
370 break;
371 case HAL_GFXTIM_EVENT2_CB_ID :
372 hgfxtim->HAL_GFXTIM_EventGenerator_EV2Callback = pCallback;
373 break;
374 case HAL_GFXTIM_EVENT3_CB_ID :
375 hgfxtim->HAL_GFXTIM_EventGenerator_EV3Callback = pCallback;
376 break;
377 case HAL_GFXTIM_EVENT4_CB_ID :
378 hgfxtim->HAL_GFXTIM_EventGenerator_EV4Callback = pCallback;
379 break;
380 case HAL_GFXTIM_WDG_ALARM_CB_ID :
381 hgfxtim->HAL_GFXTIM_WatchdogTimer_AlarmCallback = pCallback;
382 break;
383 case HAL_GFXTIM_WDG_PREALARM_CB_ID :
384 hgfxtim->HAL_GFXTIM_WatchdogTimer_PreAlarmCallback = pCallback;
385 break;
386 case HAL_GFXTIM_ERROR_CB_ID :
387 hgfxtim->ErrorCallback = pCallback;
388 break;
389 case HAL_GFXTIM_MSP_INIT_CB_ID :
390 hgfxtim->MspInitCallback = pCallback;
391 break;
392 case HAL_GFXTIM_MSP_DEINIT_CB_ID :
393 hgfxtim->MspDeInitCallback = pCallback;
394 break;
395 default :
396 /* Update error code and status */
397 hgfxtim->ErrorCode |= GFXTIM_ERROR_INVALID_CALLBACK;
398 status = HAL_ERROR;
399 break;
400 }
401 }
402 else if (hgfxtim->State == HAL_GFXTIM_STATE_RESET)
403 {
404 switch (CallbackID)
405 {
406 case HAL_GFXTIM_MSP_INIT_CB_ID :
407 hgfxtim->MspInitCallback = pCallback;
408 break;
409 case HAL_GFXTIM_MSP_DEINIT_CB_ID :
410 hgfxtim->MspDeInitCallback = pCallback;
411 break;
412 default :
413 /* Update error code and status */
414 hgfxtim->ErrorCode |= GFXTIM_ERROR_INVALID_CALLBACK;
415 status = HAL_ERROR;
416 break;
417 }
418 }
419 else
420 {
421 /* Update error code and status */
422 hgfxtim->ErrorCode |= GFXTIM_ERROR_INVALID_CALLBACK;
423 status = HAL_ERROR;
424 }
425 }
426
427 return status;
428 }
429
430 /**
431 * @brief Unregister a user GFXTIM callback.
432 * GFXTIM callback is redirected to the weak predefined callback.
433 * @param hgfxtim GFXTIM handle.
434 * @param CallbackID ID of the callback to be unregistered.
435 * This parameter can be one of the following values:
436 * @arg @ref HAL_GFXTIM_AFC_COMPARE1_CB_ID Absolute frame counter compare 1 callback ID
437 * @arg @ref HAL_GFXTIM_AFC_OVERFLOW_CB_ID Absolute frame counter overflow callback ID
438 * @arg @ref HAL_GFXTIM_ALC_COMPARE1_CB_ID Absolute line counter compare 1 callback ID
439 * @arg @ref HAL_GFXTIM_ALC_COMPARE2_CB_ID Absolute line counter compare 2 callback ID
440 * @arg @ref HAL_GFXTIM_ALC_OVERFLOW_CB_ID Absolute line counter overflow callback ID
441 * @arg @ref HAL_GFXTIM_RFC1_RELOAD_CB_ID Relative frame counter 1 reload callback ID
442 * @arg @ref HAL_GFXTIM_RFC2_RELOAD_CB_ID Relative frame counter 2 reload callback ID
443 * @arg @ref HAL_GFXTIM_TE_CB_ID External tearing effect callback ID
444 * @arg @ref HAL_GFXTIM_EVENT1_CB_ID Event events 1 callback ID
445 * @arg @ref HAL_GFXTIM_EVENT2_CB_ID Event events 2 callback ID
446 * @arg @ref HAL_GFXTIM_EVENT3_CB_ID Event events 3 callback ID
447 * @arg @ref HAL_GFXTIM_EVENT4_CB_ID Event events 4 callback ID
448 * @arg @ref HAL_GFXTIM_WDG_ALARM_CB_ID Watchdog alarm callback ID
449 * @arg @ref HAL_GFXTIM_WDG_PREALARM_CB_ID Watchdog pre alarm callback ID
450 * @arg @ref HAL_GFXTIM_ERROR_CB_ID error callback ID
451 * @arg @ref HAL_GFXTIM_MSP_INIT_CB_ID MSP initialization user callback ID
452 * @arg @ref HAL_GFXTIM_MSP_DEINIT_CB_ID MSP de-initialization user callback ID
453 * @retval HAL status.
454 */
HAL_GFXTIM_UnRegisterCallback(GFXTIM_HandleTypeDef * hgfxtim,HAL_GFXTIM_CallbackIDTypeDef CallbackID)455 HAL_StatusTypeDef HAL_GFXTIM_UnRegisterCallback(GFXTIM_HandleTypeDef *hgfxtim,
456 HAL_GFXTIM_CallbackIDTypeDef CallbackID)
457 {
458 HAL_StatusTypeDef status = HAL_OK;
459
460 if (hgfxtim == NULL)
461 {
462 status = HAL_ERROR;
463 }
464 else
465 {
466 if (hgfxtim->State == HAL_GFXTIM_STATE_READY)
467 {
468 switch (CallbackID)
469 {
470 case HAL_GFXTIM_AFC_COMPARE1_CB_ID :
471 hgfxtim->HAL_GFXTIM_AbsoluteTimer_AFCC1Callback = HAL_GFXTIM_AbsoluteTimer_AFCC1Callback;
472 break;
473 case HAL_GFXTIM_AFC_OVERFLOW_CB_ID :
474 hgfxtim->HAL_GFXTIM_AbsoluteTimer_AFCOFCallback = HAL_GFXTIM_AbsoluteTimer_AFCOFCallback;
475 break;
476 case HAL_GFXTIM_ALC_COMPARE1_CB_ID :
477 hgfxtim->HAL_GFXTIM_AbsoluteTimer_ALCC1Callback = HAL_GFXTIM_AbsoluteTimer_ALCC1Callback;
478 break;
479 case HAL_GFXTIM_ALC_COMPARE2_CB_ID :
480 hgfxtim->HAL_GFXTIM_AbsoluteTimer_ALCC2Callback = HAL_GFXTIM_AbsoluteTimer_ALCC2Callback;
481 break;
482 case HAL_GFXTIM_ALC_OVERFLOW_CB_ID :
483 hgfxtim->HAL_GFXTIM_AbsoluteTimer_ALCOFCallback = HAL_GFXTIM_AbsoluteTimer_ALCOFCallback;
484 break;
485 case HAL_GFXTIM_RFC1_RELOAD_CB_ID :
486 hgfxtim->HAL_GFXTIM_RelativeTimer_RFC1RCallback = HAL_GFXTIM_RelativeTimer_RFC1RCallback;
487 break;
488 case HAL_GFXTIM_RFC2_RELOAD_CB_ID :
489 hgfxtim->HAL_GFXTIM_RelativeTimer_RFC2RCallback = HAL_GFXTIM_RelativeTimer_RFC2RCallback;
490 break;
491 case HAL_GFXTIM_TE_CB_ID :
492 hgfxtim->HAL_GFXTIM_TECallback = HAL_GFXTIM_TECallback;
493 break;
494 case HAL_GFXTIM_EVENT1_CB_ID :
495 hgfxtim->HAL_GFXTIM_EventGenerator_EV1Callback = HAL_GFXTIM_EventGenerator_EV1Callback;
496 break;
497 case HAL_GFXTIM_EVENT2_CB_ID :
498 hgfxtim->HAL_GFXTIM_EventGenerator_EV2Callback = HAL_GFXTIM_EventGenerator_EV2Callback;
499 break;
500 case HAL_GFXTIM_EVENT3_CB_ID :
501 hgfxtim->HAL_GFXTIM_EventGenerator_EV3Callback = HAL_GFXTIM_EventGenerator_EV3Callback;
502 break;
503 case HAL_GFXTIM_EVENT4_CB_ID :
504 hgfxtim->HAL_GFXTIM_EventGenerator_EV4Callback = HAL_GFXTIM_EventGenerator_EV4Callback;
505 break;
506 case HAL_GFXTIM_WDG_ALARM_CB_ID :
507 hgfxtim->HAL_GFXTIM_WatchdogTimer_AlarmCallback = HAL_GFXTIM_WatchdogTimer_AlarmCallback;
508 break;
509 case HAL_GFXTIM_WDG_PREALARM_CB_ID :
510 hgfxtim->HAL_GFXTIM_WatchdogTimer_PreAlarmCallback = HAL_GFXTIM_WatchdogTimer_PreAlarmCallback;
511 break;
512 case HAL_GFXTIM_ERROR_CB_ID :
513 hgfxtim->ErrorCallback = HAL_GFXTIM_ErrorCallback;
514 break;
515 case HAL_GFXTIM_MSP_INIT_CB_ID :
516 hgfxtim->MspInitCallback = HAL_GFXTIM_MspInit;
517 break;
518 case HAL_GFXTIM_MSP_DEINIT_CB_ID :
519 hgfxtim->MspDeInitCallback = HAL_GFXTIM_MspDeInit;
520 break;
521 default :
522 /* Update error code and status */
523 hgfxtim->ErrorCode |= GFXTIM_ERROR_INVALID_CALLBACK;
524 status = HAL_ERROR;
525 break;
526 }
527 }
528 else if (hgfxtim->State == HAL_GFXTIM_STATE_RESET)
529 {
530 switch (CallbackID)
531 {
532 case HAL_GFXTIM_MSP_INIT_CB_ID :
533 hgfxtim->MspInitCallback = HAL_GFXTIM_MspInit;
534 break;
535 case HAL_GFXTIM_MSP_DEINIT_CB_ID :
536 hgfxtim->MspDeInitCallback = HAL_GFXTIM_MspDeInit;
537 break;
538 default :
539 /* Update error code and status */
540 hgfxtim->ErrorCode |= GFXTIM_ERROR_INVALID_CALLBACK;
541 status = HAL_ERROR;
542 break;
543 }
544 }
545 else
546 {
547 /* Update error code and status */
548 hgfxtim->ErrorCode |= GFXTIM_ERROR_INVALID_CALLBACK;
549 status = HAL_ERROR;
550 }
551 }
552
553 return status;
554 }
555 #endif /* #if (USE_HAL_GFXTIM_REGISTER_CALLBACKS == 1) */
556
557 /**
558 * @}
559 */
560
561 /** @defgroup GFXTIM_Exported_Functions_Group2 Clock Generator functions
562 * @brief Clock Generator functions
563 *
564 @verbatim
565 ==============================================================================
566 ##### Clock Generator functions #####
567 ==============================================================================
568 [..] This section provides functions allowing to :
569 (+) Configure the clock generator.
570 (+) Force reload of FCC and LCC.
571
572 @endverbatim
573 * @{
574 */
575
576 /**
577 * @brief This function configures the clock generator.
578 * @param hgfxtim GFXTIM handle.
579 * @param pClockGeneratorConfig Clock Generator configuration parameters.
580 * @retval HAL status.
581 */
HAL_GFXTIM_ClockGenerator_Config(GFXTIM_HandleTypeDef * hgfxtim,const GFXTIM_ClockGeneratorConfigTypeDef * pClockGeneratorConfig)582 HAL_StatusTypeDef HAL_GFXTIM_ClockGenerator_Config(GFXTIM_HandleTypeDef *hgfxtim,
583 const GFXTIM_ClockGeneratorConfigTypeDef *pClockGeneratorConfig)
584 {
585 HAL_StatusTypeDef status = HAL_OK;
586
587 if ((hgfxtim == NULL) || (pClockGeneratorConfig == NULL))
588 {
589 status = HAL_ERROR;
590 }
591 else
592 {
593 /* Check parameters */
594 assert_param(IS_GFXTIM_ALL_INSTANCE(hgfxtim->Instance));
595 assert_param(IS_GFXTIM_LCC_HW_RELOAD_SRC(pClockGeneratorConfig->LCCHwReloadSrc));
596 assert_param(IS_GFXTIM_LCC_RELOAD_VALUE(pClockGeneratorConfig->LCCReloadValue));
597 assert_param(IS_GFXTIM_LCC_CLK_SRC(pClockGeneratorConfig->LCCClockSrc));
598 assert_param(IS_GFXTIM_LINE_CLK_SRC(pClockGeneratorConfig->LineClockSrc));
599 assert_param(IS_GFXTIM_FCC_HW_RELOAD_SRC(pClockGeneratorConfig->FCCHwReloadSrc));
600 assert_param(IS_GFXTIM_FCC_RELOAD_VALUE(pClockGeneratorConfig->FCCReloadValue));
601 assert_param(IS_GFXTIM_FCC_CLK_SRC(pClockGeneratorConfig->FCCClockSrc));
602 assert_param(IS_GFXTIM_FRAME_CLK_SRC(pClockGeneratorConfig->FrameClockSrc));
603 assert_param(IS_GFXTIM_LINE_CLK_CALIB(pClockGeneratorConfig->LineClockCalib));
604 assert_param(IS_GFXTIM_FRAME_CLK_CALIB(pClockGeneratorConfig->FrameClockCalib));
605
606 if (hgfxtim->State == HAL_GFXTIM_STATE_READY)
607 {
608 /* Disable FCC and LCC */
609 CLEAR_BIT(hgfxtim->Instance->CGCR,
610 GFXTIM_CGCR_LCCCS | GFXTIM_CGCR_FCCCS);
611
612 /* Set Line Clock Counter (LCC) reload value (22 bits) */
613 MODIFY_REG(hgfxtim->Instance->LCCRR, GFXTIM_LCCRR_RELOAD,
614 (pClockGeneratorConfig->LCCReloadValue << GFXTIM_LCCRR_RELOAD_Pos));
615
616 /* Set Frame Clock Counter (FCC) reload value (12 bits) */
617 MODIFY_REG(hgfxtim->Instance->FCCRR, GFXTIM_FCCRR_RELOAD,
618 (pClockGeneratorConfig->FCCReloadValue << GFXTIM_FCCRR_RELOAD_Pos));
619
620 /* Set line and frame config */
621 MODIFY_REG(hgfxtim->Instance->CGCR,
622 GFXTIM_CGCR_LCCHRS | GFXTIM_CGCR_LCCCS | GFXTIM_CGCR_LCS |
623 GFXTIM_CGCR_FCCHRS | GFXTIM_CGCR_FCCCS | GFXTIM_CGCR_FCS,
624 pClockGeneratorConfig->LCCHwReloadSrc | pClockGeneratorConfig->LCCClockSrc |
625 pClockGeneratorConfig->LineClockSrc | pClockGeneratorConfig->FCCHwReloadSrc |
626 pClockGeneratorConfig->FCCClockSrc | pClockGeneratorConfig->FrameClockSrc);
627
628 /* Set debug output config for Line and frame clocks */
629 MODIFY_REG(hgfxtim->Instance->CR,
630 GFXTIM_CR_LCCOE | GFXTIM_CR_FCCOE,
631 pClockGeneratorConfig->LineClockCalib | pClockGeneratorConfig->FrameClockCalib);
632 }
633 else
634 {
635 status = HAL_ERROR;
636 }
637 }
638
639 return status;
640 }
641
642 /**
643 * @brief This function force clock generator counter(s) reload
644 * @param hgfxtim GFXTIM handle.
645 * @param ClockGeneratorCounter Clock Generator counter
646 * This parameter can be a value of @ref GFXTIM_ClockGeneratorCounter.
647 * @retval HAL status.
648 */
HAL_GFXTIM_ClockGenerator_Reload(GFXTIM_HandleTypeDef * hgfxtim,uint32_t ClockGeneratorCounter)649 HAL_StatusTypeDef HAL_GFXTIM_ClockGenerator_Reload(GFXTIM_HandleTypeDef *hgfxtim, uint32_t ClockGeneratorCounter)
650 {
651 HAL_StatusTypeDef status = HAL_OK;
652
653 if (hgfxtim == NULL)
654 {
655 status = HAL_ERROR;
656 }
657 else
658 {
659 /* Check parameters */
660 assert_param(IS_GFXTIM_ALL_INSTANCE(hgfxtim->Instance));
661 assert_param(IS_GFXTIM_CLOCK_GENERATOR_COUNTER(ClockGeneratorCounter));
662
663
664 if (hgfxtim->State == HAL_GFXTIM_STATE_READY)
665 {
666 SET_BIT(hgfxtim->Instance->CGCR, ClockGeneratorCounter);
667 }
668 else
669 {
670 status = HAL_ERROR;
671 }
672 }
673
674 return status;
675 }
676
677
678 /**
679 * @brief GFXTIM Tearing effect callback.
680 * @param hgfxtim GFXTIM handle.
681 * @retval None.
682 */
HAL_GFXTIM_TECallback(GFXTIM_HandleTypeDef * hgfxtim)683 __weak void HAL_GFXTIM_TECallback(GFXTIM_HandleTypeDef *hgfxtim)
684 {
685 /* Prevent unused argument(s) compilation warning */
686 UNUSED(hgfxtim);
687
688 /* NOTE : This function should not be modified, when the function is needed,
689 the HAL_GFXTIM_TECallback could be implemented in the user file */
690 }
691
692 /**
693 * @}
694 */
695
696 /** @defgroup GFXTIM_Exported_Functions_Group3 Absolute Timer functions
697 * @brief Absolute Timer functions
698 *
699 @verbatim
700 ==============================================================================
701 ##### Absolute Timers functions #####
702 ==============================================================================
703 [..] This section provides functions allowing to :
704 (+) Configure the absolute timer.
705 (+) Start the absolute timer.
706 (+) Stop the absolute timer.
707 (+) Reset the absolute timer counters.
708 (+) Get the absolute time value.
709 (+) Set the absolute frame compare value.
710 (+) Set the absolute line compare value.
711 @endverbatim
712 * @{
713 */
714
715 /**
716 * @brief This function configures an absolute Timer.
717 * @param hgfxtim GFXTIM handle.
718 * @param pAbsoluteTimerConfig pointer to a GFXTIM_AbsoluteTimerConfigTypeDef structure that
719 * contains absoluite timer comparators and counters values.
720 * @retval HAL status.
721 */
HAL_GFXTIM_AbsoluteTimer_Config(GFXTIM_HandleTypeDef * hgfxtim,const GFXTIM_AbsoluteTimerConfigTypeDef * pAbsoluteTimerConfig)722 HAL_StatusTypeDef HAL_GFXTIM_AbsoluteTimer_Config(GFXTIM_HandleTypeDef *hgfxtim,
723 const GFXTIM_AbsoluteTimerConfigTypeDef *pAbsoluteTimerConfig)
724 {
725 HAL_StatusTypeDef status = HAL_OK;
726
727 if ((hgfxtim == NULL) || (pAbsoluteTimerConfig == NULL))
728 {
729 status = HAL_ERROR;
730 }
731 else
732 {
733 /* Check parameters */
734 assert_param(IS_GFXTIM_ALL_INSTANCE(hgfxtim->Instance));
735 assert_param(IS_GFXTIM_ABSOLUTE_FRAME_VALUE(pAbsoluteTimerConfig->FrameCompare1Value));
736 assert_param(IS_GFXTIM_ABSOLUTE_FRAME_VALUE(pAbsoluteTimerConfig->FrameCounterValue));
737 assert_param(IS_GFXTIM_INTERRUPT(pAbsoluteTimerConfig->FrameOverflowInterrupt));
738 assert_param(IS_GFXTIM_INTERRUPT(pAbsoluteTimerConfig->FrameCompare1Interrupt));
739 assert_param(IS_GFXTIM_ABSOLUTE_LINE_VALUE(pAbsoluteTimerConfig->LineCompare1Value));
740 assert_param(IS_GFXTIM_ABSOLUTE_LINE_VALUE(pAbsoluteTimerConfig->LineCompare2Value));
741 assert_param(IS_GFXTIM_ABSOLUTE_LINE_VALUE(pAbsoluteTimerConfig->LineCounterValue));
742 assert_param(IS_GFXTIM_INTERRUPT(pAbsoluteTimerConfig->LineOverflowInterrupt));
743 assert_param(IS_GFXTIM_INTERRUPT(pAbsoluteTimerConfig->LineCompare1Interrupt));
744 assert_param(IS_GFXTIM_INTERRUPT(pAbsoluteTimerConfig->LineCompare2Interrupt));
745
746 if (hgfxtim->State == HAL_GFXTIM_STATE_READY)
747 {
748
749 /* Set AFC compare 1 value */
750 MODIFY_REG(hgfxtim->Instance->AFCC1R, GFXTIM_AFCC1R_FRAME,
751 (pAbsoluteTimerConfig->FrameCompare1Value << GFXTIM_AFCC1R_FRAME_Pos));
752
753 /* Set AFC counter value */
754 MODIFY_REG(hgfxtim->Instance->AFCR, GFXTIM_AFCR_FRAME,
755 (pAbsoluteTimerConfig->FrameCounterValue << GFXTIM_AFCR_FRAME_Pos));
756
757 /* Set ALC compare 1 value */
758 MODIFY_REG(hgfxtim->Instance->ALCC1R, GFXTIM_ALCC1R_LINE,
759 (pAbsoluteTimerConfig->LineCompare1Value << GFXTIM_ALCC1R_LINE_Pos));
760
761 /* Set ALC compare 2 value */
762 MODIFY_REG(hgfxtim->Instance->ALCC2R, GFXTIM_ALCC2R_LINE,
763 (pAbsoluteTimerConfig->LineCompare2Value << GFXTIM_ALCC2R_LINE_Pos));
764
765 /* Set ALC counter value */
766 MODIFY_REG(hgfxtim->Instance->ALCR, GFXTIM_ALCR_LINE,
767 (pAbsoluteTimerConfig->LineCounterValue << GFXTIM_ALCR_LINE_Pos));
768
769 /* Set ALC compare 1, compare 2, overflow interrupts, AFC compare 1 and overflow interrupts */
770 MODIFY_REG(hgfxtim->Instance->IER,
771 GFXTIM_IER_ALCC1IE | GFXTIM_IER_ALCC2IE | GFXTIM_IER_ALCOIE | GFXTIM_IER_AFCC1IE | GFXTIM_IER_AFCOIE,
772 (pAbsoluteTimerConfig->FrameOverflowInterrupt << GFXTIM_IER_AFCOIE_Pos) |
773 (pAbsoluteTimerConfig->FrameCompare1Interrupt << GFXTIM_IER_AFCC1IE_Pos) |
774 (pAbsoluteTimerConfig->LineOverflowInterrupt << GFXTIM_IER_ALCOIE_Pos) |
775 (pAbsoluteTimerConfig->LineCompare1Interrupt << GFXTIM_IER_ALCC1IE_Pos) |
776 (pAbsoluteTimerConfig->LineCompare2Interrupt << GFXTIM_IER_ALCC2IE_Pos));
777 }
778 else
779 {
780 status = HAL_ERROR;
781 }
782 }
783
784 /* Return function status */
785 return status;
786 }
787
788 /**
789 * @brief This function starts absolute timer.
790 * @param hgfxtim GFXTIM handle.
791 * @retval HAL status.
792 */
HAL_GFXTIM_AbsoluteTimer_Start(GFXTIM_HandleTypeDef * hgfxtim)793 HAL_StatusTypeDef HAL_GFXTIM_AbsoluteTimer_Start(GFXTIM_HandleTypeDef *hgfxtim)
794 {
795 HAL_StatusTypeDef status = HAL_OK;
796
797 if (hgfxtim == NULL)
798 {
799 status = HAL_ERROR;
800 }
801 else
802 {
803 /* Check parameters */
804 assert_param(IS_GFXTIM_ALL_INSTANCE(hgfxtim->Instance));
805
806 if (hgfxtim->State == HAL_GFXTIM_STATE_READY)
807 {
808 /* Enable absolute Timer */
809 SET_BIT(hgfxtim->Instance->TCR, (GFXTIM_TCR_AFCEN | GFXTIM_TCR_ALCEN));
810 }
811 else
812 {
813 status = HAL_ERROR;
814 }
815 }
816
817 /* Return function status */
818 return status;
819 }
820
821 /**
822 * @brief This function stops absolute timer counter(s).
823 * @param hgfxtim GFXTIM handle.
824 * @retval HAL status.
825 */
HAL_GFXTIM_AbsoluteTimer_Stop(GFXTIM_HandleTypeDef * hgfxtim)826 HAL_StatusTypeDef HAL_GFXTIM_AbsoluteTimer_Stop(GFXTIM_HandleTypeDef *hgfxtim)
827 {
828 HAL_StatusTypeDef status = HAL_OK;
829
830 if (hgfxtim == NULL)
831 {
832 status = HAL_ERROR;
833 }
834 else
835 {
836 /* Check parameters */
837 assert_param(IS_GFXTIM_ALL_INSTANCE(hgfxtim->Instance));
838
839 if (hgfxtim->State == HAL_GFXTIM_STATE_READY)
840 {
841 /* Disable absolute counter(s) */
842 SET_BIT(hgfxtim->Instance->TDR, (GFXTIM_TDR_ALCDIS | GFXTIM_TDR_AFCDIS));
843 }
844 else
845 {
846 status = HAL_ERROR;
847 }
848 }
849
850 /* Return function status */
851 return status;
852 }
853
854 /**
855 * @brief This function resets absolute timer counters.
856 * @param hgfxtim GFXTIM handle.
857 * @retval HAL status.
858 */
HAL_GFXTIM_AbsoluteTimer_Reset(GFXTIM_HandleTypeDef * hgfxtim)859 HAL_StatusTypeDef HAL_GFXTIM_AbsoluteTimer_Reset(GFXTIM_HandleTypeDef *hgfxtim)
860 {
861 HAL_StatusTypeDef status = HAL_OK;
862
863 if (hgfxtim == NULL)
864 {
865 status = HAL_ERROR;
866 }
867 else
868 {
869 /* Check parameters */
870 assert_param(IS_GFXTIM_ALL_INSTANCE(hgfxtim->Instance));
871
872 if (hgfxtim->State == HAL_GFXTIM_STATE_READY)
873 {
874 /* Disable absolute counter(s) */
875 SET_BIT(hgfxtim->Instance->TCR, (GFXTIM_TCR_FAFCR | GFXTIM_TCR_FALCR));
876 }
877 else
878 {
879 status = HAL_ERROR;
880 }
881 }
882
883 /* Return function status */
884 return status;
885 }
886
887 /**
888 * @brief This function gets absolute timer value.
889 * @param hgfxtim GFXTIM handle.
890 * @param AbsoluteTime absolute time
891 * This parameter can be a value of @ref GFXTIM_AbsoluteTime.
892 * @param pValue Absolute time value
893 * @retval HAL status.
894 */
HAL_GFXTIM_AbsoluteTimer_GetCounter(const GFXTIM_HandleTypeDef * hgfxtim,uint32_t AbsoluteTime,uint32_t * pValue)895 HAL_StatusTypeDef HAL_GFXTIM_AbsoluteTimer_GetCounter(const GFXTIM_HandleTypeDef *hgfxtim, uint32_t AbsoluteTime,
896 uint32_t *pValue)
897 {
898 HAL_StatusTypeDef status = HAL_OK;
899
900 if ((hgfxtim == NULL) || (pValue == NULL))
901 {
902 status = HAL_ERROR;
903 }
904 else
905 {
906 /* Check parameters */
907 assert_param(IS_GFXTIM_ALL_INSTANCE(hgfxtim->Instance));
908 assert_param(IS_GFXTIM_ABSOLUTE_TIME(AbsoluteTime));
909
910 if (hgfxtim->State == HAL_GFXTIM_STATE_READY)
911 {
912 switch (AbsoluteTime)
913 {
914 case GFXTIM_ABSOLUTE_GLOBAL_TIME:
915 *pValue = READ_REG(hgfxtim->Instance->ATR);
916 break;
917 case GFXTIM_ABSOLUTE_FRAME_TIME:
918 *pValue = READ_REG(hgfxtim->Instance->AFCR);
919 break;
920 default:
921 /* GFXTIM_ABSOLUTE_LINE_TIME */
922 *pValue = READ_REG(hgfxtim->Instance->ALCR);
923 break;
924 }
925 }
926 else
927 {
928 status = HAL_ERROR;
929 }
930 }
931 return status;
932 }
933
934 /**
935 * @brief This function sets absolute frame compare value.
936 * @param hgfxtim GFXTIM handle.
937 * @param Value Absolute frame compare 1 value
938 * This parameter can be a number between Min_Data = 0x00000 and Max_Data = 0xFFFFF
939 * @retval HAL status.
940 */
HAL_GFXTIM_AbsoluteTimer_SetFrameCompare(GFXTIM_HandleTypeDef * hgfxtim,uint32_t Value)941 HAL_StatusTypeDef HAL_GFXTIM_AbsoluteTimer_SetFrameCompare(GFXTIM_HandleTypeDef *hgfxtim, uint32_t Value)
942 {
943 HAL_StatusTypeDef status = HAL_OK;
944
945 if (hgfxtim == NULL)
946 {
947 status = HAL_ERROR;
948 }
949 else
950 {
951 /* Check parameters */
952 assert_param(IS_GFXTIM_ALL_INSTANCE(hgfxtim->Instance));
953
954 if (hgfxtim->State == HAL_GFXTIM_STATE_READY)
955 {
956 /* Set absolute frame counter compare 1 register value */
957 MODIFY_REG(hgfxtim->Instance->AFCC1R, GFXTIM_AFCC1R_FRAME,
958 (Value << GFXTIM_AFCC1R_FRAME_Pos));
959 }
960 else
961 {
962 status = HAL_ERROR;
963 }
964 }
965
966 return status;
967 }
968
969 /**
970 * @brief This function sets line compare value.
971 * @param hgfxtim GFXTIM handle.
972 * @param AbsoluteLineComparator Absolute line compare value
973 * This parameter can be a value of @ref GFXTIM_AbsoluteLineComparator.
974 * @param Value Absolute line compare value
975 * This parameter can be a number between Min_Data = 0x000 and Max_Data = 0xFFF
976 * @retval HAL status.
977 */
HAL_GFXTIM_AbsoluteTimer_SetLineCompare(GFXTIM_HandleTypeDef * hgfxtim,uint32_t AbsoluteLineComparator,uint32_t Value)978 HAL_StatusTypeDef HAL_GFXTIM_AbsoluteTimer_SetLineCompare(GFXTIM_HandleTypeDef *hgfxtim,
979 uint32_t AbsoluteLineComparator, uint32_t Value)
980 {
981 HAL_StatusTypeDef status = HAL_OK;
982
983 if (hgfxtim == NULL)
984 {
985 status = HAL_ERROR;
986 }
987 else
988 {
989 /* Check parameters */
990 assert_param(IS_GFXTIM_ALL_INSTANCE(hgfxtim->Instance));
991 assert_param(IS_GFXTIM_ABSOLUTE_LINE_COMPARATOR(AbsoluteLineComparator));
992 assert_param(IS_GFXTIM_ABSOLUTE_LINE_VALUE(Value));
993
994 if (hgfxtim->State == HAL_GFXTIM_STATE_READY)
995 {
996 switch (AbsoluteLineComparator)
997 {
998 case GFXTIM_ABSOLUTE_LINE_COMPARE1:
999 WRITE_REG(hgfxtim->Instance->ALCC1R, Value);
1000 break;
1001 default:
1002 /* GFXTIM_ABSOLUTE_LINE_COMPARE2 */
1003 WRITE_REG(hgfxtim->Instance->ALCC2R, Value);
1004 break;
1005 }
1006 }
1007 else
1008 {
1009 status = HAL_ERROR;
1010 }
1011 }
1012 return status;
1013 }
1014
1015 /**
1016 * @brief GFXTIM Absolute frame counter overflow callback.
1017 * @param hgfxtim GFXTIM handle.
1018 * @retval None.
1019 */
HAL_GFXTIM_AbsoluteTimer_AFCOFCallback(GFXTIM_HandleTypeDef * hgfxtim)1020 __weak void HAL_GFXTIM_AbsoluteTimer_AFCOFCallback(GFXTIM_HandleTypeDef *hgfxtim)
1021 {
1022 /* Prevent unused argument(s) compilation warning */
1023 UNUSED(hgfxtim);
1024 /* NOTE : This function should not be modified, when the function is needed,
1025 the HAL_GFXTIM_AbsoluteTimer_AFCOFCallback could be implemented in the user file */
1026 }
1027
1028 /**
1029 * @brief GFXTIM Absolute frame counter compare 1 callback.
1030 * @param hgfxtim GFXTIM handle.
1031 * @retval None.
1032 */
HAL_GFXTIM_AbsoluteTimer_AFCC1Callback(GFXTIM_HandleTypeDef * hgfxtim)1033 __weak void HAL_GFXTIM_AbsoluteTimer_AFCC1Callback(GFXTIM_HandleTypeDef *hgfxtim)
1034 {
1035 /* Prevent unused argument(s) compilation warning */
1036 UNUSED(hgfxtim);
1037 /* NOTE : This function should not be modified, when the function is needed,
1038 the HAL_GFXTIM_AbsoluteTimer_AFCC1Callback could be implemented in the user file */
1039 }
1040
1041 /**
1042 * @brief GFXTIM Absolute line counter compare 1 callback.
1043 * @param hgfxtim GFXTIM handle.
1044 * @retval None.
1045 */
HAL_GFXTIM_AbsoluteTimer_ALCC1Callback(GFXTIM_HandleTypeDef * hgfxtim)1046 __weak void HAL_GFXTIM_AbsoluteTimer_ALCC1Callback(GFXTIM_HandleTypeDef *hgfxtim)
1047 {
1048 /* Prevent unused argument(s) compilation warning */
1049 UNUSED(hgfxtim);
1050 /* NOTE : This function should not be modified, when the function is needed,
1051 the HAL_GFXTIM_AbsoluteTimer_ALCC1Callback could be implemented in the user file */
1052 }
1053
1054 /**
1055 * @brief GFXTIM Absolute line counter compare 2 callback.
1056 * @param hgfxtim GFXTIM handle.
1057 * @retval None.
1058 */
HAL_GFXTIM_AbsoluteTimer_ALCC2Callback(GFXTIM_HandleTypeDef * hgfxtim)1059 __weak void HAL_GFXTIM_AbsoluteTimer_ALCC2Callback(GFXTIM_HandleTypeDef *hgfxtim)
1060 {
1061 /* Prevent unused argument(s) compilation warning */
1062 UNUSED(hgfxtim);
1063 /* NOTE : This function should not be modified, when the function is needed,
1064 the HAL_GFXTIM_AbsoluteTimer_ALCC2Callback could be implemented in the user file */
1065 }
1066
1067 /**
1068 * @brief GFXTIM Absolute line counter overflow callback.
1069 * @param hgfxtim GFXTIM handle.
1070 * @retval None.
1071 */
HAL_GFXTIM_AbsoluteTimer_ALCOFCallback(GFXTIM_HandleTypeDef * hgfxtim)1072 __weak void HAL_GFXTIM_AbsoluteTimer_ALCOFCallback(GFXTIM_HandleTypeDef *hgfxtim)
1073 {
1074 /* Prevent unused argument(s) compilation warning */
1075 UNUSED(hgfxtim);
1076 /* NOTE : This function should not be modified, when the function is needed,
1077 the HAL_GFXTIM_AbsoluteTimer_ALCOFCallback could be implemented in the user file */
1078 }
1079
1080 /**
1081 * @}
1082 */
1083
1084 /** @defgroup GFXTIM_Exported_Functions_Group4 Relative Timer functions
1085 * @brief Clock Generator functions
1086 *
1087 @verbatim
1088 ==============================================================================
1089 ##### Relative Timer functions #####
1090 ==============================================================================
1091 [..] This section provides functions allowing to :
1092 (+) Configure a relative timer.
1093 (+) Start a relative timer counter.
1094 (+) Stop a relative timer counter.
1095 (+) Force a relative timer counter reload.
1096 (+) Set a relative timer reload value.
1097 (+) Get a relative timer counter value.
1098
1099 @endverbatim
1100 * @{
1101 */
1102
1103 /**
1104 * @brief This function configures a Relative Timer.
1105 * @param hgfxtim GFXTIM handle.
1106 * @param pRelativeTimerConfig pointer to a GFXTIM_RelativeTimerConfigTypeDef structure that
1107 * contains relative timer comparators and counters values.
1108 * @param RelativeTimer Relative Timer identifier
1109 * This parameter can be a value of @ref GFXTIM_RelativeTimer.
1110 * @retval HAL status.
1111 */
HAL_GFXTIM_RelativeTimer_Config(GFXTIM_HandleTypeDef * hgfxtim,const GFXTIM_RelativeTimerConfigTypeDef * pRelativeTimerConfig,uint32_t RelativeTimer)1112 HAL_StatusTypeDef HAL_GFXTIM_RelativeTimer_Config(GFXTIM_HandleTypeDef *hgfxtim,
1113 const GFXTIM_RelativeTimerConfigTypeDef *pRelativeTimerConfig,
1114 uint32_t RelativeTimer)
1115 {
1116 HAL_StatusTypeDef status = HAL_OK;
1117
1118 if ((hgfxtim == NULL) || (pRelativeTimerConfig == NULL))
1119 {
1120 status = HAL_ERROR;
1121 }
1122 else
1123 {
1124 /* Check parameters */
1125 assert_param(IS_GFXTIM_ALL_INSTANCE(hgfxtim->Instance));
1126 assert_param(IS_GFXTIM_RELATIVE_FRAME_VALUE(pRelativeTimerConfig->AutoReloadValue));
1127 assert_param(IS_GFXTIM_RELATIVE_FRAME_VALUE(pRelativeTimerConfig->CounterMode));
1128 assert_param(IS_GFXTIM_INTERRUPT(pRelativeTimerConfig->ReloadInterrupt));
1129 assert_param(IS_GFXTIM_RELATIVE_TIMER(RelativeTimer));
1130
1131 if (hgfxtim->State == HAL_GFXTIM_STATE_READY)
1132 {
1133 if (RelativeTimer == GFXTIM_RELATIVE_TIMER1)
1134 {
1135 /* Set RFC1 auto reload */
1136 MODIFY_REG(hgfxtim->Instance->RFC1RR, GFXTIM_RFC1RR_FRAME,
1137 pRelativeTimerConfig->AutoReloadValue << GFXTIM_RFC1RR_FRAME_Pos);
1138
1139 /* Set relative timer mode */
1140 MODIFY_REG(hgfxtim->Instance->TCR, GFXTIM_TCR_RFC1CM,
1141 (pRelativeTimerConfig->CounterMode << GFXTIM_TCR_RFC1CM_Pos));
1142
1143 /* Set relative timer 1 interrupt */
1144 MODIFY_REG(hgfxtim->Instance->IER, GFXTIM_IER_RFC1RIE_Msk,
1145 (pRelativeTimerConfig->ReloadInterrupt << GFXTIM_IER_RFC1RIE_Pos));
1146 }
1147 else
1148 {
1149 /* Set RFC2 auto reload */
1150 MODIFY_REG(hgfxtim->Instance->RFC2RR, GFXTIM_RFC2RR_FRAME,
1151 pRelativeTimerConfig->AutoReloadValue << GFXTIM_RFC2RR_FRAME_Pos);
1152
1153 /* Set relative timer mode */
1154 MODIFY_REG(hgfxtim->Instance->TCR, GFXTIM_TCR_RFC2CM,
1155 (pRelativeTimerConfig->CounterMode << GFXTIM_TCR_RFC2CM_Pos));
1156
1157 /* Set relative timer 2 interrupt */
1158 MODIFY_REG(hgfxtim->Instance->IER, GFXTIM_IER_RFC2RIE_Msk,
1159 (pRelativeTimerConfig->ReloadInterrupt << GFXTIM_IER_RFC2RIE_Pos));
1160 }
1161 }
1162 else
1163 {
1164 status = HAL_ERROR;
1165 }
1166 }
1167
1168 return status;
1169 }
1170
1171 /**
1172 * @brief This function starts a relative Timer.
1173 * @param hgfxtim GFXTIM handle.
1174 * @param RelativeTimer Relative timer counter to Enable
1175 * This parameter can be a value of @ref GFXTIM_RelativeTimer.
1176 * @retval HAL status.
1177 */
HAL_GFXTIM_RelativeTimer_Start(GFXTIM_HandleTypeDef * hgfxtim,uint32_t RelativeTimer)1178 HAL_StatusTypeDef HAL_GFXTIM_RelativeTimer_Start(GFXTIM_HandleTypeDef *hgfxtim, uint32_t RelativeTimer)
1179 {
1180 HAL_StatusTypeDef status = HAL_OK;
1181
1182 if (hgfxtim == NULL)
1183 {
1184 status = HAL_ERROR;
1185 }
1186 else
1187 {
1188 /* Check parameters */
1189 assert_param(IS_GFXTIM_ALL_INSTANCE(hgfxtim->Instance));
1190 assert_param(IS_GFXTIM_RELATIVE_TIMER(RelativeTimer));
1191
1192 if (hgfxtim->State == HAL_GFXTIM_STATE_READY)
1193 {
1194 if (RelativeTimer == GFXTIM_RELATIVE_TIMER1)
1195 {
1196 /* Enable relative timer 1 */
1197 SET_BIT(hgfxtim->Instance->TCR, GFXTIM_TCR_RFC1EN);
1198 }
1199 else
1200 {
1201 /* Enable relative timer 2 */
1202 SET_BIT(hgfxtim->Instance->TCR, GFXTIM_TCR_RFC2EN);
1203 }
1204 }
1205 else
1206 {
1207 status = HAL_ERROR;
1208 }
1209 }
1210
1211 return status;
1212 }
1213
1214 /**
1215 * @brief This function stops a relative Timer counter.
1216 * @param hgfxtim GFXTIM handle.
1217 * @param RelativeTimer Relative timer counter to Disable
1218 * This parameter can be a value of @ref GFXTIM_RelativeTimer.
1219 * @retval HAL status.
1220 */
HAL_GFXTIM_RelativeTimer_Stop(GFXTIM_HandleTypeDef * hgfxtim,uint32_t RelativeTimer)1221 HAL_StatusTypeDef HAL_GFXTIM_RelativeTimer_Stop(GFXTIM_HandleTypeDef *hgfxtim, uint32_t RelativeTimer)
1222 {
1223 HAL_StatusTypeDef status = HAL_OK;
1224
1225 if (hgfxtim == NULL)
1226 {
1227 status = HAL_ERROR;
1228 }
1229 else
1230 {
1231 /* Check parameters */
1232 assert_param(IS_GFXTIM_ALL_INSTANCE(hgfxtim->Instance));
1233 assert_param(IS_GFXTIM_RELATIVE_TIMER(RelativeTimer));
1234
1235 if (hgfxtim->State == HAL_GFXTIM_STATE_READY)
1236 {
1237 if (RelativeTimer == GFXTIM_RELATIVE_TIMER1)
1238 {
1239 /* Disable relative timer 1 */
1240 SET_BIT(hgfxtim->Instance->TDR, GFXTIM_TDR_RFC1DIS);
1241 }
1242 else
1243 {
1244 /* Disable relative timer 2 */
1245 SET_BIT(hgfxtim->Instance->TDR, GFXTIM_TDR_RFC2DIS);
1246 }
1247 }
1248 else
1249 {
1250 status = HAL_ERROR;
1251 }
1252 }
1253
1254 return status;
1255 }
1256
1257
1258 /**
1259 * @brief This function force a relative Timer reload.
1260 * @param hgfxtim GFXTIM handle.
1261 * @param RelativeTimer Relative timer to Foce Reload
1262 * This parameter can be a value of @ref GFXTIM_RelativeTimer.
1263 * @retval HAL status.
1264 */
HAL_GFXTIM_RelativeTimer_ForceReload(GFXTIM_HandleTypeDef * hgfxtim,uint32_t RelativeTimer)1265 HAL_StatusTypeDef HAL_GFXTIM_RelativeTimer_ForceReload(GFXTIM_HandleTypeDef *hgfxtim, uint32_t RelativeTimer)
1266 {
1267 HAL_StatusTypeDef status = HAL_OK;
1268
1269 if (hgfxtim == NULL)
1270 {
1271 status = HAL_ERROR;
1272 }
1273 else
1274 {
1275 /* Check parameters */
1276 assert_param(IS_GFXTIM_ALL_INSTANCE(hgfxtim->Instance));
1277 assert_param(IS_GFXTIM_RELATIVE_TIMER(RelativeTimer));
1278
1279 if (hgfxtim->State == HAL_GFXTIM_STATE_READY)
1280 {
1281 if (RelativeTimer == GFXTIM_RELATIVE_TIMER1)
1282 {
1283 /* Force relative timer 1 reload */
1284 SET_BIT(hgfxtim->Instance->TCR, GFXTIM_TCR_FRFC1R);
1285 }
1286 else
1287 {
1288 /* Force relative timer 2 reload*/
1289 SET_BIT(hgfxtim->Instance->TCR, GFXTIM_TCR_FRFC2R);
1290 }
1291 }
1292 else
1293 {
1294 status = HAL_ERROR;
1295 }
1296 }
1297
1298 return status;
1299 }
1300
1301
1302 /**
1303 * @brief This function sets Relative frame timer reload value.
1304 * @param hgfxtim GFXTIM handle.
1305 * @param RelativeTimer specifies the Auto-reload register to be modified.
1306 * This parameter can be a value of @ref GFXTIM_RelativeTimer.
1307 * @param Value Reload value
1308 * This parameter can be a number between Min_Data = 0x000 and Max_Data = 0xFFF
1309 * @retval HAL status.
1310 */
HAL_GFXTIM_RelativeTimer_SetReload(GFXTIM_HandleTypeDef * hgfxtim,uint32_t RelativeTimer,uint32_t Value)1311 HAL_StatusTypeDef HAL_GFXTIM_RelativeTimer_SetReload(GFXTIM_HandleTypeDef *hgfxtim, uint32_t RelativeTimer,
1312 uint32_t Value)
1313 {
1314 HAL_StatusTypeDef status = HAL_OK;
1315
1316 if (hgfxtim == NULL)
1317 {
1318 status = HAL_ERROR;
1319 }
1320 else
1321 {
1322 /* Check parameters */
1323 assert_param(IS_GFXTIM_ALL_INSTANCE(hgfxtim->Instance));
1324 assert_param(IS_GFXTIM_RELATIVE_FRAME_VALUE(Value));
1325 assert_param(IS_GFXTIM_RELATIVE_TIMER(RelativeTimer));
1326
1327 if (hgfxtim->State == HAL_GFXTIM_STATE_READY)
1328 {
1329 if (RelativeTimer == GFXTIM_RELATIVE_TIMER1)
1330 {
1331 /* Set RFC1 auto reload */
1332 WRITE_REG(hgfxtim->Instance->RFC1RR, Value);
1333 }
1334 else
1335 {
1336 /* Set RFC2 auto reload */
1337 WRITE_REG(hgfxtim->Instance->RFC2RR, Value);
1338 }
1339 }
1340 else
1341 {
1342 status = HAL_ERROR;
1343 }
1344 }
1345
1346 return status;
1347 }
1348
1349 /**
1350 * @brief This function sets Relative frame timer compare value.
1351 * @param hgfxtim GFXTIM handle.
1352 * @param RelativeTimer Relative frame counter reload
1353 * This parameter can be a value of @ref GFXTIM_RelativeTimer.
1354 * @param pValue pointer to a relative frame counter value
1355 * @retval HAL status.
1356 */
HAL_GFXTIM_RelativeTimer_GetCounter(const GFXTIM_HandleTypeDef * hgfxtim,uint32_t RelativeTimer,uint32_t * pValue)1357 HAL_StatusTypeDef HAL_GFXTIM_RelativeTimer_GetCounter(const GFXTIM_HandleTypeDef *hgfxtim, uint32_t RelativeTimer,
1358 uint32_t *pValue)
1359 {
1360 HAL_StatusTypeDef status = HAL_OK;
1361
1362 if ((hgfxtim == NULL) || (pValue == NULL))
1363 {
1364 status = HAL_ERROR;
1365 }
1366 else
1367 {
1368 /* Check parameters */
1369 assert_param(IS_GFXTIM_ALL_INSTANCE(hgfxtim->Instance));
1370 assert_param(IS_GFXTIM_RELATIVE_TIMER(RelativeTimer));
1371
1372 if (hgfxtim->State == HAL_GFXTIM_STATE_READY)
1373 {
1374 if (RelativeTimer == GFXTIM_RELATIVE_TIMER1)
1375 {
1376 /* Set RFC1 auto reload */
1377 *pValue = READ_REG(hgfxtim->Instance->RFC1R);
1378 }
1379 else
1380 {
1381 /* Set RFC2 auto reload */
1382 *pValue = READ_REG(hgfxtim->Instance->RFC2R);
1383 }
1384 }
1385 else
1386 {
1387 status = HAL_ERROR;
1388 }
1389 }
1390
1391 return status;
1392 }
1393
1394
1395
1396
1397 /**
1398 * @brief GFXTIM Relative frame counter 1 reload callback.
1399 * @param hgfxtim GFXTIM handle.
1400 * @retval None.
1401 */
HAL_GFXTIM_RelativeTimer_RFC1RCallback(GFXTIM_HandleTypeDef * hgfxtim)1402 __weak void HAL_GFXTIM_RelativeTimer_RFC1RCallback(GFXTIM_HandleTypeDef *hgfxtim)
1403 {
1404 /* Prevent unused argument(s) compilation warning */
1405 UNUSED(hgfxtim);
1406 /* NOTE : This function should not be modified, when the function is needed,
1407 the HAL_GFXTIM_RelativeTimer_RFC1RCallback could be implemented in the user file */
1408 }
1409
1410 /**
1411 * @brief GFXTIM Relative frame counter 2 reload callback.
1412 * @param hgfxtim GFXTIM handle.
1413 * @retval None.
1414 */
HAL_GFXTIM_RelativeTimer_RFC2RCallback(GFXTIM_HandleTypeDef * hgfxtim)1415 __weak void HAL_GFXTIM_RelativeTimer_RFC2RCallback(GFXTIM_HandleTypeDef *hgfxtim)
1416 {
1417 /* Prevent unused argument(s) compilation warning */
1418 UNUSED(hgfxtim);
1419 /* NOTE : This function should not be modified, when the function is needed,
1420 the HAL_GFXTIM_RelativeTimer_RFC2RCallback could be implemented in the user file */
1421 }
1422
1423 /**
1424 * @}
1425 */
1426
1427 /** @defgroup GFXTIM_Exported_Functions_Group5 Event Generator functions
1428 * @brief Event Generator functions
1429 *
1430 @verbatim
1431 ==============================================================================
1432 ##### Event Generator functions #####
1433 ==============================================================================
1434 [..] This section provides functions allowing to :
1435 (+) Configure an Event Generator.
1436 (+) Enable an Event Generator.
1437 (+) Disable an Event Generator.
1438 @endverbatim
1439 * @{
1440 */
1441
1442 /**
1443 * @brief This function configures an Event Generator.
1444 * @param hgfxtim GFXTIM handle.
1445 * @param EventGenerator Event Generator
1446 * This parameter can be a value of @ref GFXTIM_EventGenerator.
1447 * @param pEventGeneratorConfig pointer to a GFXTIM_EventGeneratorConfigTypeDef structure that
1448 * contains Event Generator configuration parameters.
1449 * @retval HAL status.
1450 */
HAL_GFXTIM_EventGenerator_Config(GFXTIM_HandleTypeDef * hgfxtim,uint32_t EventGenerator,const GFXTIM_EventGeneratorConfigTypeDef * pEventGeneratorConfig)1451 HAL_StatusTypeDef HAL_GFXTIM_EventGenerator_Config(GFXTIM_HandleTypeDef *hgfxtim, uint32_t EventGenerator,
1452 const GFXTIM_EventGeneratorConfigTypeDef *pEventGeneratorConfig)
1453 {
1454 HAL_StatusTypeDef status = HAL_OK;
1455 uint32_t shift;
1456
1457 if ((hgfxtim == NULL) || (pEventGeneratorConfig == NULL))
1458 {
1459 status = HAL_ERROR;
1460 }
1461 else
1462 {
1463 /* Check parameters */
1464 assert_param(IS_GFXTIM_EVENT_GENERATOR(EventGenerator));
1465 assert_param(IS_GFXTIM_EVENT_LINE(pEventGeneratorConfig->LineEvent));
1466 assert_param(IS_GFXTIM_EVENT_FRAME(pEventGeneratorConfig->FrameEvent));
1467 assert_param(IS_GFXTIM_INTERRUPT(pEventGeneratorConfig->EventInterrupt));
1468
1469 if (hgfxtim->State == HAL_GFXTIM_STATE_READY)
1470 {
1471 /* Select frame and line events */
1472 shift = (EventGenerator) * 8U;
1473 MODIFY_REG(hgfxtim->Instance->EVSR, \
1474 ((GFXTIM_EVSR_LES1 | GFXTIM_EVSR_FES1) << shift),
1475 ((pEventGeneratorConfig->LineEvent | pEventGeneratorConfig->FrameEvent) << shift));
1476
1477 /* Event interrupt */
1478 MODIFY_REG(hgfxtim->Instance->IER, \
1479 (GFXTIM_IER_EV1IE << (EventGenerator)), \
1480 (pEventGeneratorConfig->EventInterrupt << (EventGenerator + GFXTIM_IER_EV1IE_Pos)));
1481 }
1482 else
1483 {
1484 status = HAL_ERROR;
1485 }
1486 }
1487
1488 return status;
1489 }
1490
1491 /**
1492 * @brief This function enables an Event Generator.
1493 * @param hgfxtim GFXTIM handle.
1494 * @param EventGenerator Event Generator
1495 * This parameter can be a value of @ref GFXTIM_EventGenerator.
1496 * @retval HAL status.
1497 */
HAL_GFXTIM_EventGenerator_Enable(GFXTIM_HandleTypeDef * hgfxtim,uint32_t EventGenerator)1498 HAL_StatusTypeDef HAL_GFXTIM_EventGenerator_Enable(GFXTIM_HandleTypeDef *hgfxtim, uint32_t EventGenerator)
1499 {
1500 HAL_StatusTypeDef status = HAL_OK;
1501
1502 if (hgfxtim == NULL)
1503 {
1504 status = HAL_ERROR;
1505 }
1506 else
1507 {
1508 /* Check parameters */
1509 assert_param(IS_GFXTIM_EVENT_GENERATOR(EventGenerator));
1510
1511 if (hgfxtim->State == HAL_GFXTIM_STATE_READY)
1512 {
1513 /* Enable event generator */
1514 SET_BIT(hgfxtim->Instance->EVCR, GFXTIM_EVCR_EV1EN << EventGenerator);
1515 }
1516 else
1517 {
1518 status = HAL_ERROR;
1519 }
1520 }
1521
1522 return status;
1523 }
1524
1525 /**
1526 * @brief This function disables an Event Generator.
1527 * @param hgfxtim GFXTIM handle.
1528 * @param EventGenerator Event Generator
1529 * This parameter can be a value of @ref GFXTIM_EventGenerator.
1530 * @retval HAL status.
1531 */
HAL_GFXTIM_EventGenerator_Disable(GFXTIM_HandleTypeDef * hgfxtim,uint32_t EventGenerator)1532 HAL_StatusTypeDef HAL_GFXTIM_EventGenerator_Disable(GFXTIM_HandleTypeDef *hgfxtim, uint32_t EventGenerator)
1533 {
1534 HAL_StatusTypeDef status = HAL_OK;
1535
1536 if (hgfxtim == NULL)
1537 {
1538 status = HAL_ERROR;
1539 }
1540 else
1541 {
1542 /* Check parameters */
1543 assert_param(IS_GFXTIM_EVENT_GENERATOR(EventGenerator));
1544
1545 if (hgfxtim->State == HAL_GFXTIM_STATE_READY)
1546 {
1547 /* Disable event generator */
1548 CLEAR_BIT(hgfxtim->Instance->EVCR, GFXTIM_EVCR_EV1EN << EventGenerator);
1549 }
1550 else
1551 {
1552 status = HAL_ERROR;
1553 }
1554 }
1555
1556 return status;
1557 }
1558
1559
1560
1561 /**
1562 * @brief GFXTIM Combined events 1 callback.
1563 * @param hgfxtim GFXTIM handle.
1564 * @retval None.
1565 */
HAL_GFXTIM_EventGenerator_EV1Callback(GFXTIM_HandleTypeDef * hgfxtim)1566 __weak void HAL_GFXTIM_EventGenerator_EV1Callback(GFXTIM_HandleTypeDef *hgfxtim)
1567 {
1568 /* Prevent unused argument(s) compilation warning */
1569 UNUSED(hgfxtim);
1570 /* NOTE : This function should not be modified, when the function is needed,
1571 the HAL_GFXTIM_EventGenerator_EV1Callback could be implemented in the user file */
1572 }
1573
1574 /**
1575 * @brief GFXTIM Combined events 2 callback.
1576 * @param hgfxtim GFXTIM handle.
1577 * @retval None.
1578 */
HAL_GFXTIM_EventGenerator_EV2Callback(GFXTIM_HandleTypeDef * hgfxtim)1579 __weak void HAL_GFXTIM_EventGenerator_EV2Callback(GFXTIM_HandleTypeDef *hgfxtim)
1580 {
1581 /* Prevent unused argument(s) compilation warning */
1582 UNUSED(hgfxtim);
1583 /* NOTE : This function should not be modified, when the function is needed,
1584 the HAL_GFXTIM_EventGenerator_EV2Callback could be implemented in the user file */
1585 }
1586
1587 /**
1588 * @brief GFXTIM Combined events 3 callback.
1589 * @param hgfxtim GFXTIM handle.
1590 * @retval None.
1591 */
HAL_GFXTIM_EventGenerator_EV3Callback(GFXTIM_HandleTypeDef * hgfxtim)1592 __weak void HAL_GFXTIM_EventGenerator_EV3Callback(GFXTIM_HandleTypeDef *hgfxtim)
1593 {
1594 /* Prevent unused argument(s) compilation warning */
1595 UNUSED(hgfxtim);
1596 /* NOTE : This function should not be modified, when the function is needed,
1597 the HAL_GFXTIM_EventGenerator_EV3Callback could be implemented in the user file */
1598 }
1599
1600 /**
1601 * @brief GFXTIM Combined events 4 callback.
1602 * @param hgfxtim GFXTIM handle.
1603 * @retval None.
1604 */
HAL_GFXTIM_EventGenerator_EV4Callback(GFXTIM_HandleTypeDef * hgfxtim)1605 __weak void HAL_GFXTIM_EventGenerator_EV4Callback(GFXTIM_HandleTypeDef *hgfxtim)
1606 {
1607 /* Prevent unused argument(s) compilation warning */
1608 UNUSED(hgfxtim);
1609 /* NOTE : This function should not be modified, when the function is needed,
1610 the HAL_GFXTIM_EventGenerator_EV4Callback could be implemented in the user file */
1611 }
1612
1613 /**
1614 * @}
1615 */
1616
1617 /** @defgroup GFXTIM_Exported_Functions_Group6 Watchdog functions
1618 * @brief Event Generator functions
1619 *
1620 @verbatim
1621 ==============================================================================
1622 ##### Watchdog functions #####
1623 ==============================================================================
1624 [..] This section provides functions allowing to :
1625 (+) Configure the Watchdog.
1626 (+) Enable the Watchdog
1627 (+) Disable the Watchdog.
1628 (+) Refresh the Watchdog.
1629 @endverbatim
1630 * @{
1631 */
1632
1633 /**
1634 * @brief This function configures the Watchdog.
1635 * @param hgfxtim GFXTIM handle.
1636 * @param pWatchdogConfig Watchdog configuration parameters.
1637 * @retval HAL status.
1638 */
HAL_GFXTIM_WatchdogTimer_Config(GFXTIM_HandleTypeDef * hgfxtim,const GFXTIM_WatchdogConfigTypeDef * pWatchdogConfig)1639 HAL_StatusTypeDef HAL_GFXTIM_WatchdogTimer_Config(GFXTIM_HandleTypeDef *hgfxtim,
1640 const GFXTIM_WatchdogConfigTypeDef *pWatchdogConfig)
1641 {
1642 HAL_StatusTypeDef status = HAL_OK;
1643
1644 if ((hgfxtim == NULL) || (pWatchdogConfig == NULL))
1645 {
1646 status = HAL_ERROR;
1647 }
1648 else
1649 {
1650 /* Check parameters */
1651 assert_param(IS_GFXTIM_ALL_INSTANCE(hgfxtim->Instance));
1652 assert_param(IS_GFXTIM_WATCHDOG_CLOCK_SRC(pWatchdogConfig->ClockSrc));
1653 assert_param(IS_GFXTIM_WATCHDOG_HW_RELOAD_CONFIG(pWatchdogConfig->HwReloadConfig));
1654
1655 assert_param(IS_GFXTIM_WATCHDOG_VALUE(pWatchdogConfig->AutoReloadValue));
1656 assert_param(IS_GFXTIM_WATCHDOG_VALUE(pWatchdogConfig->PreAlarmValue));
1657
1658 assert_param(IS_GFXTIM_INTERRUPT(pWatchdogConfig->AlarmInterrupt));
1659 assert_param(IS_GFXTIM_INTERRUPT(pWatchdogConfig->PreAlarmInterrupt));
1660
1661
1662 if (hgfxtim->State == HAL_GFXTIM_STATE_READY)
1663 {
1664 /* Set watchdog auto reload value */
1665 MODIFY_REG(hgfxtim->Instance->WDGRR, GFXTIM_WDGRR_RELOAD,
1666 (pWatchdogConfig->AutoReloadValue << GFXTIM_WDGRR_RELOAD_Pos));
1667
1668 /* Set watchdog pre alarm value */
1669 MODIFY_REG(hgfxtim->Instance->WDGPAR, GFXTIM_WDGPAR_PREALARM,
1670 pWatchdogConfig->PreAlarmValue << GFXTIM_WDGPAR_PREALARM_Pos);
1671
1672 /* Set watchdog clock source and hardware reload */
1673 MODIFY_REG(hgfxtim->Instance->WDGTCR, (GFXTIM_WDGTCR_WDGCS | GFXTIM_WDGTCR_WDGHRC),
1674 (pWatchdogConfig->ClockSrc | pWatchdogConfig->HwReloadConfig));
1675
1676 /* Set watchdog interrupts */
1677 MODIFY_REG(hgfxtim->Instance->IER, \
1678 (GFXTIM_IER_WDGAIE | GFXTIM_IER_WDGPIE), \
1679 ((pWatchdogConfig->AlarmInterrupt << GFXTIM_IER_WDGAIE_Pos) | \
1680 (pWatchdogConfig->PreAlarmInterrupt << GFXTIM_IER_WDGPIE_Pos)));
1681 }
1682 else
1683 {
1684 status = HAL_ERROR;
1685 }
1686 }
1687
1688 return status;
1689 }
1690
1691 /**
1692 * @brief This function Enable the Watchdog Counter.
1693 * @param hgfxtim GFXTIM handle.
1694 * @retval HAL status.
1695 */
HAL_GFXTIM_WatchdogTimer_Enable(GFXTIM_HandleTypeDef * hgfxtim)1696 HAL_StatusTypeDef HAL_GFXTIM_WatchdogTimer_Enable(GFXTIM_HandleTypeDef *hgfxtim)
1697 {
1698 HAL_StatusTypeDef status = HAL_OK;
1699
1700 if (hgfxtim == NULL)
1701 {
1702 status = HAL_ERROR;
1703 }
1704 else
1705 {
1706 /* Check parameters */
1707 assert_param(IS_GFXTIM_ALL_INSTANCE(hgfxtim->Instance));
1708
1709
1710 if (hgfxtim->State == HAL_GFXTIM_STATE_READY)
1711 {
1712 /* Set watchdog enable bit */
1713 SET_BIT(hgfxtim->Instance->WDGTCR, GFXTIM_WDGTCR_WDGEN);
1714 }
1715 else
1716 {
1717 status = HAL_ERROR;
1718 }
1719 }
1720
1721 return status;
1722 }
1723
1724 /**
1725 * @brief This function Disable the Watchdog Counter.
1726 * @param hgfxtim GFXTIM handle.
1727 * @retval HAL status.
1728 */
HAL_GFXTIM_WatchdogTimer_Disable(GFXTIM_HandleTypeDef * hgfxtim)1729 HAL_StatusTypeDef HAL_GFXTIM_WatchdogTimer_Disable(GFXTIM_HandleTypeDef *hgfxtim)
1730 {
1731 HAL_StatusTypeDef status = HAL_OK;
1732
1733 if (hgfxtim == NULL)
1734 {
1735 status = HAL_ERROR;
1736 }
1737 else
1738 {
1739 /* Check parameters */
1740 assert_param(IS_GFXTIM_ALL_INSTANCE(hgfxtim->Instance));
1741
1742
1743 if (hgfxtim->State == HAL_GFXTIM_STATE_READY)
1744 {
1745 /* Set watchdog disable bit */
1746 SET_BIT(hgfxtim->Instance->WDGTCR, GFXTIM_WDGTCR_WDGDIS);
1747 }
1748 else
1749 {
1750 status = HAL_ERROR;
1751 }
1752 }
1753
1754 return status;
1755 }
1756
1757 /**
1758 * @brief This function refresh the Watchdog counter.
1759 * @param hgfxtim GFXTIM handle.
1760 * @retval HAL status.
1761 */
HAL_GFXTIM_WatchdogTimer_Refresh(GFXTIM_HandleTypeDef * hgfxtim)1762 HAL_StatusTypeDef HAL_GFXTIM_WatchdogTimer_Refresh(GFXTIM_HandleTypeDef *hgfxtim)
1763 {
1764 HAL_StatusTypeDef status = HAL_OK;
1765
1766 if (hgfxtim == NULL)
1767 {
1768 status = HAL_ERROR;
1769 }
1770 else
1771 {
1772 /* Check parameters */
1773 assert_param(IS_GFXTIM_ALL_INSTANCE(hgfxtim->Instance));
1774
1775
1776 if (hgfxtim->State == HAL_GFXTIM_STATE_READY)
1777 {
1778 /* Set watchdog SW relaod */
1779 SET_BIT(hgfxtim->Instance->WDGTCR, GFXTIM_WDGTCR_FWDGR);
1780 }
1781 else
1782 {
1783 status = HAL_ERROR;
1784 }
1785 }
1786
1787 return status;
1788 }
1789
1790 /**
1791 * @brief GFXTIM Watchdog alarm callback.
1792 * @param hgfxtim GFXTIM handle.
1793 * @retval None.
1794 */
HAL_GFXTIM_WatchdogTimer_AlarmCallback(GFXTIM_HandleTypeDef * hgfxtim)1795 __weak void HAL_GFXTIM_WatchdogTimer_AlarmCallback(GFXTIM_HandleTypeDef *hgfxtim)
1796 {
1797 /* Prevent unused argument(s) compilation warning */
1798 UNUSED(hgfxtim);
1799 /* NOTE : This function should not be modified, when the function is needed,
1800 the HAL_GFXTIM_WatchdogTimer_AlarmCallback could be implemented in the user file */
1801 }
1802
1803 /**
1804 * @brief GFXTIM Watchdog pre alarm callback.
1805 * @param hgfxtim GFXTIM handle.
1806 * @retval None.
1807 */
HAL_GFXTIM_WatchdogTimer_PreAlarmCallback(GFXTIM_HandleTypeDef * hgfxtim)1808 __weak void HAL_GFXTIM_WatchdogTimer_PreAlarmCallback(GFXTIM_HandleTypeDef *hgfxtim)
1809 {
1810 /* Prevent unused argument(s) compilation warning */
1811 UNUSED(hgfxtim);
1812 /* NOTE : This function should not be modified, when the function is needed,
1813 the HAL_GFXTIM_WatchdogTimer_PreAlarmCallback could be implemented in the user file */
1814 }
1815
1816 /**
1817 * @}
1818 */
1819
1820 /** @defgroup GFXTIM_Exported_Functions_Group7 Generic functions
1821 * @brief Generic functions
1822 *
1823 @verbatim
1824 ==============================================================================
1825 ##### Generic functions #####
1826 ==============================================================================
1827 [..] This section provides functions allowing to :
1828 (+) Handle GFXTIM interrupt.
1829 (+) Inform user that error occurs.
1830 (+) Get the current GFXTIM instance state
1831 (+) Get the current GFXTIM instance error code.
1832 @endverbatim
1833 * @{
1834 */
1835
1836 /**
1837 * @brief This function handles the GFXTIM interrupts.
1838 * @param hgfxtim GFXTIM handle.
1839 * @retval None.
1840 */
HAL_GFXTIM_IRQHandler(GFXTIM_HandleTypeDef * hgfxtim)1841 void HAL_GFXTIM_IRQHandler(GFXTIM_HandleTypeDef *hgfxtim)
1842 {
1843 uint32_t tmp_reg1;
1844 uint32_t tmp_reg2;
1845 uint32_t interrupts;
1846
1847 /* Read all pending interrupts */
1848 tmp_reg1 = READ_REG(hgfxtim->Instance->ISR);
1849 tmp_reg2 = READ_REG(hgfxtim->Instance->IER);
1850 interrupts = tmp_reg1 & tmp_reg2;
1851
1852 if ((interrupts & GFXTIM_ISR_AFCC1F) != 0U)
1853 {
1854 #if (USE_HAL_GFXTIM_REGISTER_CALLBACKS == 1U)
1855 hgfxtim->HAL_GFXTIM_AbsoluteTimer_AFCC1Callback(hgfxtim);
1856 #else
1857 HAL_GFXTIM_AbsoluteTimer_AFCC1Callback(hgfxtim);
1858 #endif /* USE_HAL_GFXTIM_REGISTER_CALLBACKS */
1859 }
1860
1861 if ((interrupts & GFXTIM_ISR_AFCOF) != 0U)
1862 {
1863 #if (USE_HAL_GFXTIM_REGISTER_CALLBACKS == 1U)
1864 hgfxtim->HAL_GFXTIM_AbsoluteTimer_AFCOFCallback(hgfxtim);
1865 #else
1866 HAL_GFXTIM_AbsoluteTimer_AFCOFCallback(hgfxtim);
1867 #endif /* USE_HAL_GFXTIM_REGISTER_CALLBACKS */
1868 }
1869
1870 if ((interrupts & GFXTIM_ISR_ALCC1F) != 0U)
1871 {
1872 #if (USE_HAL_GFXTIM_REGISTER_CALLBACKS == 1U)
1873 hgfxtim->HAL_GFXTIM_AbsoluteTimer_ALCC1Callback(hgfxtim);
1874 #else
1875 HAL_GFXTIM_AbsoluteTimer_ALCC1Callback(hgfxtim);
1876 #endif /* USE_HAL_GFXTIM_REGISTER_CALLBACKS */
1877 }
1878
1879 if ((interrupts & GFXTIM_ISR_ALCC2F) != 0U)
1880 {
1881 #if (USE_HAL_GFXTIM_REGISTER_CALLBACKS == 1U)
1882 hgfxtim->HAL_GFXTIM_AbsoluteTimer_ALCC2Callback(hgfxtim);
1883 #else
1884 HAL_GFXTIM_AbsoluteTimer_ALCC2Callback(hgfxtim);
1885 #endif /* USE_HAL_GFXTIM_REGISTER_CALLBACKS */
1886 }
1887
1888 if ((interrupts & GFXTIM_ISR_ALCOF) != 0U)
1889 {
1890 #if (USE_HAL_GFXTIM_REGISTER_CALLBACKS == 1U)
1891 hgfxtim->HAL_GFXTIM_AbsoluteTimer_ALCOFCallback(hgfxtim);
1892 #else
1893 HAL_GFXTIM_AbsoluteTimer_ALCOFCallback(hgfxtim);
1894 #endif /* USE_HAL_GFXTIM_REGISTER_CALLBACKS */
1895 }
1896
1897 if ((interrupts & GFXTIM_ISR_TEF) != 0U)
1898 {
1899 #if (USE_HAL_GFXTIM_REGISTER_CALLBACKS == 1U)
1900 hgfxtim->HAL_GFXTIM_TECallback(hgfxtim);
1901 #else
1902 HAL_GFXTIM_TECallback(hgfxtim);
1903 #endif /* USE_HAL_GFXTIM_REGISTER_CALLBACKS */
1904 }
1905
1906 if ((interrupts & GFXTIM_ISR_RFC1RF) != 0U)
1907 {
1908 #if (USE_HAL_GFXTIM_REGISTER_CALLBACKS == 1U)
1909 hgfxtim->HAL_GFXTIM_RelativeTimer_RFC1RCallback(hgfxtim);
1910 #else
1911 HAL_GFXTIM_RelativeTimer_RFC1RCallback(hgfxtim);
1912 #endif /* USE_HAL_GFXTIM_REGISTER_CALLBACKS */
1913 }
1914
1915 if ((interrupts & GFXTIM_ISR_RFC2RF) != 0U)
1916 {
1917 #if (USE_HAL_GFXTIM_REGISTER_CALLBACKS == 1U)
1918 hgfxtim->HAL_GFXTIM_RelativeTimer_RFC2RCallback(hgfxtim);
1919 #else
1920 HAL_GFXTIM_RelativeTimer_RFC2RCallback(hgfxtim);
1921 #endif /* USE_HAL_GFXTIM_REGISTER_CALLBACKS */
1922 }
1923
1924 if ((interrupts & GFXTIM_ISR_EV1F) != 0U)
1925 {
1926 #if (USE_HAL_GFXTIM_REGISTER_CALLBACKS == 1U)
1927 hgfxtim->HAL_GFXTIM_EventGenerator_EV1Callback(hgfxtim);
1928 #else
1929 HAL_GFXTIM_EventGenerator_EV1Callback(hgfxtim);
1930 #endif /* USE_HAL_GFXTIM_REGISTER_CALLBACKS */
1931 }
1932
1933 if ((interrupts & GFXTIM_ISR_EV2F) != 0U)
1934 {
1935 #if (USE_HAL_GFXTIM_REGISTER_CALLBACKS == 1U)
1936 hgfxtim->HAL_GFXTIM_EventGenerator_EV2Callback(hgfxtim);
1937 #else
1938 HAL_GFXTIM_EventGenerator_EV2Callback(hgfxtim);
1939 #endif /* USE_HAL_GFXTIM_REGISTER_CALLBACKS */
1940 }
1941
1942 if ((interrupts & GFXTIM_ISR_EV3F) != 0U)
1943 {
1944 #if (USE_HAL_GFXTIM_REGISTER_CALLBACKS == 1U)
1945 hgfxtim->HAL_GFXTIM_EventGenerator_EV3Callback(hgfxtim);
1946 #else
1947 HAL_GFXTIM_EventGenerator_EV3Callback(hgfxtim);
1948 #endif /* USE_HAL_GFXTIM_REGISTER_CALLBACKS */
1949 }
1950
1951 if ((interrupts & GFXTIM_ISR_EV4F) != 0U)
1952 {
1953 #if (USE_HAL_GFXTIM_REGISTER_CALLBACKS == 1U)
1954 hgfxtim->HAL_GFXTIM_EventGenerator_EV4Callback(hgfxtim);
1955 #else
1956 HAL_GFXTIM_EventGenerator_EV4Callback(hgfxtim);
1957 #endif /* USE_HAL_GFXTIM_REGISTER_CALLBACKS */
1958 }
1959
1960 if ((interrupts & GFXTIM_ISR_WDGAF) != 0U)
1961 {
1962 #if (USE_HAL_GFXTIM_REGISTER_CALLBACKS == 1U)
1963 hgfxtim->HAL_GFXTIM_WatchdogTimer_AlarmCallback(hgfxtim);
1964 #else
1965 HAL_GFXTIM_WatchdogTimer_AlarmCallback(hgfxtim);
1966 #endif /* USE_HAL_GFXTIM_REGISTER_CALLBACKS */
1967 }
1968
1969 if ((interrupts & GFXTIM_ISR_WDGPF) != 0U)
1970 {
1971 #if (USE_HAL_GFXTIM_REGISTER_CALLBACKS == 1U)
1972 hgfxtim->HAL_GFXTIM_WatchdogTimer_PreAlarmCallback(hgfxtim);
1973 #else
1974 HAL_GFXTIM_WatchdogTimer_PreAlarmCallback(hgfxtim);
1975 #endif /* USE_HAL_GFXTIM_REGISTER_CALLBACKS */
1976 }
1977 /* Clear all pending interrupts */
1978 WRITE_REG(hgfxtim->Instance->ICR, interrupts);
1979 }
1980
1981 /**
1982 * @brief GFXTIM error callback.
1983 * @param hgfxtim GFXTIM handle.
1984 * @retval None.
1985 */
HAL_GFXTIM_ErrorCallback(GFXTIM_HandleTypeDef * hgfxtim)1986 __weak void HAL_GFXTIM_ErrorCallback(GFXTIM_HandleTypeDef *hgfxtim)
1987 {
1988 /* Prevent unused argument(s) compilation warning */
1989 UNUSED(hgfxtim);
1990
1991 /* NOTE : This function should not be modified, when the function is needed,
1992 the HAL_GFXTIM_ErrorCallback could be implemented in the user file. */
1993 }
1994
1995 /**
1996 * @brief This function get the current GFXTIM state.
1997 * @param hgfxtim GFXTIM handle.
1998 * @retval GFXTIM state.
1999 */
HAL_GFXTIM_GetState(const GFXTIM_HandleTypeDef * hgfxtim)2000 HAL_GFXTIM_StateTypeDef HAL_GFXTIM_GetState(const GFXTIM_HandleTypeDef *hgfxtim)
2001 {
2002 /* Return GFXTIM state */
2003 return hgfxtim->State;
2004 }
2005
2006 /**
2007 * @brief This function get the current GFXTIM error.
2008 * @param hgfxtim GFXTIM handle.
2009 * @retval GFXTIM error code.
2010 */
HAL_GFXTIM_GetError(const GFXTIM_HandleTypeDef * hgfxtim)2011 uint32_t HAL_GFXTIM_GetError(const GFXTIM_HandleTypeDef *hgfxtim)
2012 {
2013 /* Return GFXTIM error code */
2014 return hgfxtim->ErrorCode;
2015 }
2016
2017 /**
2018 * @}
2019 */
2020
2021 /**
2022 * @}
2023 */
2024
2025 /**
2026 * @}
2027 */
2028 #endif /* GFXTIM */
2029 #endif /* HAL_GFXTIM_MODULE_ENABLED */
2030 /**
2031 * @}
2032 */
2033