gr55xx_ll_dual_tim.h
Go to the documentation of this file.
1 /**
2 ****************************************************************************************
3 *
4 * @file gr55xx_ll_dual_tim.h
5 * @author BLE Driver Team
6 * @brief Header file containing functions prototypes of DUAL TIMER LL library.
7 *
8 ****************************************************************************************
9 * @attention
10 #####Copyright (c) 2019 GOODIX
11 All rights reserved.
12
13 Redistribution and use in source and binary forms, with or without
14 modification, are permitted provided that the following conditions are met:
15 * Redistributions of source code must retain the above copyright
16 notice, this list of conditions and the following disclaimer.
17 * Redistributions in binary form must reproduce the above copyright
18 notice, this list of conditions and the following disclaimer in the
19 documentation and/or other materials provided with the distribution.
20 * Neither the name of GOODIX nor the names of its contributors may be used
21 to endorse or promote products derived from this software without
22 specific prior written permission.
23
24 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
28 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 POSSIBILITY OF SUCH DAMAGE.
35 ****************************************************************************************
36 */
37
38 /** @addtogroup PERIPHERAL Peripheral Driver
39 * @{
40 */
41
42 /** @addtogroup LL_DRIVER LL Driver
43 * @{
44 */
45
46 /** @defgroup LL_DUAL_TIMER DUAL_TIMER
47 * @brief DUAL TIM LL module driver.
48 * @{
49 */
50
51 /* Define to prevent recursive inclusion -------------------------------------*/
52 #ifndef __GR55XX_LL_DUAL_TIMER_H__
53 #define __GR55XX_LL_DUAL_TIMER_H__
54
55 #ifdef __cplusplus
56 extern "C" {
57 #endif
58
59 /* Includes ------------------------------------------------------------------*/
60 #include "gr55xx.h"
61
62 #if defined (DUAL_TIMER0) || defined (DUAL_TIMER1)
63
64 /** @defgroup DUAL_TIMER_LL_STRUCTURES Structures
65 * @{
66 */
67
68 /* Exported types ------------------------------------------------------------*/
69 /** @defgroup DUAL_TIMER_LL_ES_INIT DUAL_TIM Exported init structures
70 * @{
71 */
72
73 /**
74 * @brief LL DUAL TIMER init Structure definition
75 */
76 typedef struct _ll_dual_timer_init
77 {
78 uint32_t prescaler; /**< Specifies the prescaler value used to divide the TIMER clock.
79 This parameter can be a value of @ref DUAL_TIMER_EC_LL_PRESCALER.
80
81 This feature can be modified afterwards using unitary function @ref ll_dual_timer_set_prescaler().*/
82
83 uint32_t counter_size; /**< Specifies the prescaler value used to divide the DUAL_TIMER clock.
84 This parameter can be a value of @ref DUAL_TIMER_EC_LL_COUNTERSIZE.
85
86 This feature can be modified afterwards using unitary function @ref ll_dual_timer_set_counter_size().*/
87
88 uint32_t counter_mode; /**< Specifies the counter mode.
89 This parameter can be a value of @ref DUAL_TIMER_LL_EC_COUNTERMODE.
90
91 This feature can be modified afterwards using unitary function @ref ll_dual_timer_set_counter_mode().*/
92
93 uint32_t auto_reload; /**< Specifies the auto reload value to be loaded into the active
94 Auto-Reload Register at the next update event.
95 This parameter must be a number between Min_Data=0x00000000 and Max_Data=0xFFFFFFFF.
96 Some timer instances may support 16 bits counters. In that case this parameter must be a number between 0x0000 and 0xFFFF.
97
98 This feature can be modified afterwards using unitary function @ref ll_dual_timer_set_auto_reload().*/
99 } ll_dual_timer_init_t;
100
101 /** @} */
102
103 /** @} */
104
105 /**
106 * @defgroup DUAL_TIMER_LL_MACRO Defines
107 * @{
108 */
109
110 /* Exported constants --------------------------------------------------------*/
111 /** @defgroup DUAL_TIMER_LL_Exported_Constants DUAL_TIM Exported Constants
112 * @{
113 */
114
115 /** @defgroup DUAL_TIMER_LL_EC_COUNTERMODE DUAL_TIM counter mode
116 * @{
117 */
118 #define LL_DUAL_TIMER_FREERUNNING_MODE 0x00000000U /**< Free running mode */
119 #define LL_DUAL_TIMER_PERIODIC_MODE DUAL_TIMER_CTRL_MODE /**< Periodic mode */
120 /** @} */
121
122 /** @defgroup DUAL_TIMER_EC_LL_PRESCALER DUAL_TIM prescaler
123 * @{
124 */
125 #define LL_DUAL_TIMER_PRESCALER_DIV0 0x00000000U /**< 0 stage of prescale, clock is divided by 1. */
126 #define LL_DUAL_TIMER_PRESCALER_DIV16 (1UL << DUAL_TIMER_CTRL_PRE_Pos) /**< 4 stages of prescale, clock is divided by 16. */
127 #define LL_DUAL_TIMER_PRESCALER_DIV256 (2UL << DUAL_TIMER_CTRL_PRE_Pos) /**< 8 stages of prescale, clock is divided by 256. */
128 /** @} */
129
130 /** @defgroup DUAL_TIMER_EC_LL_COUNTERSIZE DUAL_TIM counter size
131 * @{
132 */
133 #define LL_DUAL_TIMER_COUNTERSIZE_16 0x00000000U /**< Counter size 16 bits */
134 #define LL_DUAL_TIMER_COUNTERSIZE_32 DUAL_TIMER_CTRL_SIZE /**< Counter size 32 bits */
135 /** @} */
136
137 /** @defgroup DUAL_TIMER_LL_EC_DEFAULT_CONFIG InitStrcut default configuartion
138 * @{
139 */
140
141 /**
142 * @brief LL DUAL_TIMER InitStrcut default configuartion
143 */
144 #define DUAL_TIMER_DEFAULT_CONFIG \
145 { \
146 .prescaler = LL_DUAL_TIMER_PRESCALER_DIV0, \
147 .counter_size = LL_DUAL_TIMER_COUNTERSIZE_32, \
148 .counter_mode = LL_DUAL_TIMER_PERIODIC_MODE, \
149 .auto_reload = SystemCoreClock - 1, \
150 }
151 /** @} */
152
153 /** @} */
154
155 /* Exported macro ------------------------------------------------------------*/
156 /** @defgroup DUAL_TIMER_LL_Exported_Macros DUAL_TIM Exported Macros
157 * @{
158 */
159
160 /** @defgroup DUAL_TIMER_LL_EM_WRITE_READ Common Write and read registers Macros
161 * @{
162 */
163
164 /**
165 * @brief Write a value in DUAL_TIMER register
166 * @param __instance__ DUAL_TIMER instance
167 * @param __REG__ Register to be written
168 * @param __VALUE__ Value to be written in the register
169 * @retval None
170 */
171 #define LL_DUAL_TIMER_WriteReg(__instance__, __REG__, __VALUE__) WRITE_REG(__instance__->__REG__, (__VALUE__))
172
173 /**
174 * @brief Read a value in DUAL_TIMER register
175 * @param __instance__ DUAL_TIMER instance
176 * @param __REG__ Register to be read
177 * @retval Register value
178 */
179 #define LL_DUAL_TIMER_ReadReg(__instance__, __REG__) READ_REG(__instance__->__REG__)
180
181 /** @} */
182
183 /** @} */
184
185 /** @} */
186
187 /* Exported functions --------------------------------------------------------*/
188 /** @defgroup DUAL_TIMER_LL_DRIVER_FUNCTIONS Functions
189 * @{
190 */
191
192 /** @defgroup DUAL_TIMER_LL_EF_Configuration Configuration functions
193 * @{
194 */
195
196
197 /**
198 * @brief Enable dual_timer counter.
199 *
200 * \rst
201 * +----------------------+-----------------------------------+
202 * | Register | BitsName |
203 * +======================+===================================+
204 * | CTRL | EN |
205 * +----------------------+-----------------------------------+
206 * \endrst
207 *
208 * @param DUAL_TIMERx Timer instance
209 * @retval None
210 */
211 __STATIC_INLINE void ll_dual_timer_enable_counter(dual_timer_regs_t *DUAL_TIMERx)
212 {
213 SET_BITS(DUAL_TIMERx->CTRL, DUAL_TIMER_CTRL_EN);
214 }
215
216 /**
217 * @brief Disable dual_timer counter.
218 *
219 * \rst
220 * +----------------------+-----------------------------------+
221 * | Register | BitsName |
222 * +======================+===================================+
223 * | CTRL | EN |
224 * +----------------------+-----------------------------------+
225 * \endrst
226 *
227 * @param DUAL_TIMERx Timer instance
228 * @retval None
229 */
230 __STATIC_INLINE void ll_dual_timer_disable_counter(dual_timer_regs_t *DUAL_TIMERx)
231 {
232 CLEAR_BITS(DUAL_TIMERx->CTRL, DUAL_TIMER_CTRL_EN);
233 }
234
235 /**
236 * @brief Indicate whether the dual_timer counter is enabled.
237 *
238 * \rst
239 * +----------------------+-----------------------------------+
240 * | Register | BitsName |
241 * +======================+===================================+
242 * | CTRL | EN |
243 * +----------------------+-----------------------------------+
244 * \endrst
245 *
246 * @param DUAL_TIMERx Timer instance
247 * @retval State of bit (1 or 0).
248 */
249 __STATIC_INLINE uint32_t ll_dual_timer_is_enabled_counter(dual_timer_regs_t *DUAL_TIMERx)
250 {
251 return (READ_BITS(DUAL_TIMERx->CTRL, DUAL_TIMER_CTRL_EN) == (DUAL_TIMER_CTRL_EN));
252 }
253
254 /**
255 * @brief Set the counter mode.
256 *
257 * \rst
258 * +----------------------+-----------------------------------+
259 * | Register | BitsName |
260 * +======================+===================================+
261 * | CTRL | MODE |
262 * +----------------------+-----------------------------------+
263 * \endrst
264 *
265 * @param DUAL_TIMERx Timer instance
266 * @param counter_mode This parameter can be one of the following values:
267 * @arg @ref LL_DUAL_TIMER_FREERUNNING_MODE
268 * @arg @ref LL_DUAL_TIMER_PERIODIC_MODE
269 * @retval None
270 */
271 __STATIC_INLINE void ll_dual_timer_set_counter_mode(dual_timer_regs_t *DUAL_TIMERx, uint32_t counter_mode)
272 {
273 MODIFY_REG(DUAL_TIMERx->CTRL, DUAL_TIMER_CTRL_MODE, counter_mode);
274 }
275
276 /**
277 * @brief Get the counter mode.
278 *
279 * \rst
280 * +----------------------+-----------------------------------+
281 * | Register | BitsName |
282 * +======================+===================================+
283 * | CTRL | MODE |
284 * +----------------------+-----------------------------------+
285 * \endrst
286 *
287 * @param DUAL_TIMERx Timer instance
288 * @retval Return value can be one of the following values:
289 * @arg @ref LL_DUAL_TIMER_FREERUNNING_MODE
290 * @arg @ref LL_DUAL_TIMER_PERIODIC_MODE
291 */
292 __STATIC_INLINE uint32_t ll_dual_timer_get_counter_mode(dual_timer_regs_t *DUAL_TIMERx)
293 {
294 return (READ_BITS(DUAL_TIMERx->CTRL, DUAL_TIMER_CTRL_MODE));
295 }
296
297 /**
298 * @brief Set the prescaler.
299 *
300 * \rst
301 * +----------------------+-----------------------------------+
302 * | Register | BitsName |
303 * +======================+===================================+
304 * | CTRL | PRE |
305 * +----------------------+-----------------------------------+
306 * \endrst
307 *
308 * @param DUAL_TIMERx Timer instance
309 * @param prescaler This parameter can be one of the following values:
310 * @arg @ref LL_DUAL_TIMER_PRESCALER_DIV0
311 * @arg @ref LL_DUAL_TIMER_PRESCALER_DIV16
312 * @arg @ref LL_DUAL_TIMER_PRESCALER_DIV256
313 * @retval None
314 */
315 __STATIC_INLINE void ll_dual_timer_set_prescaler(dual_timer_regs_t *DUAL_TIMERx, uint32_t prescaler)
316 {
317 MODIFY_REG(DUAL_TIMERx->CTRL, DUAL_TIMER_CTRL_PRE, prescaler);
318 }
319
320 /**
321 * @brief Get the prescaler.
322 *
323 * \rst
324 * +----------------------+-----------------------------------+
325 * | Register | BitsName |
326 * +======================+===================================+
327 * | CTRL | PRE |
328 * +----------------------+-----------------------------------+
329 * \endrst
330 *
331 * @param DUAL_TIMERx Timer instance
332 * @retval Return value can be one of the following values:
333 * @arg @ref LL_DUAL_TIMER_PRESCALER_DIV0
334 * @arg @ref LL_DUAL_TIMER_PRESCALER_DIV16
335 * @arg @ref LL_DUAL_TIMER_PRESCALER_DIV256
336 */
337 __STATIC_INLINE uint32_t ll_dual_timer_get_prescaler(dual_timer_regs_t *DUAL_TIMERx)
338 {
339 return (READ_BITS(DUAL_TIMERx->CTRL, DUAL_TIMER_CTRL_PRE));
340 }
341
342 /**
343 * @brief Set the counter size.
344 *
345 * \rst
346 * +----------------------+-----------------------------------+
347 * | Register | BitsName |
348 * +======================+===================================+
349 * | CTRL | SIZE |
350 * +----------------------+-----------------------------------+
351 * \endrst
352 *
353 * @param DUAL_TIMERx Timer instance
354 * @param counter_size This parameter can be one of the following values:
355 * @arg @ref LL_DUAL_TIMER_COUNTERSIZE_16
356 * @arg @ref LL_DUAL_TIMER_COUNTERSIZE_32
357 * @retval None
358 */
359 __STATIC_INLINE void ll_dual_timer_set_counter_size(dual_timer_regs_t *DUAL_TIMERx, uint32_t counter_size)
360 {
361 MODIFY_REG(DUAL_TIMERx->CTRL, DUAL_TIMER_CTRL_SIZE, counter_size);
362 }
363
364 /**
365 * @brief Get the counter size.
366 *
367 * \rst
368 * +----------------------+-----------------------------------+
369 * | Register | BitsName |
370 * +======================+===================================+
371 * | CTRL | SIZE |
372 * +----------------------+-----------------------------------+
373 * \endrst
374 *
375 * @param DUAL_TIMERx Timer instance
376 * @retval Return value can be one of the following values:
377 * @arg @ref LL_DUAL_TIMER_COUNTERSIZE_16
378 * @arg @ref LL_DUAL_TIMER_COUNTERSIZE_32
379 */
380 __STATIC_INLINE uint32_t ll_dual_timer_get_counter_size(dual_timer_regs_t *DUAL_TIMERx)
381 {
382 return (READ_BITS(DUAL_TIMERx->CTRL, DUAL_TIMER_CTRL_SIZE));
383 }
384
385 /**
386 * @brief Enable one-shot mode.
387 *
388 * \rst
389 * +----------------------+-----------------------------------+
390 * | Register | BitsName |
391 * +======================+===================================+
392 * | CTRL | ONESHOT |
393 * +----------------------+-----------------------------------+
394 * \endrst
395 *
396 * @param DUAL_TIMERx Timer instance
397 * @retval None
398 */
399 __STATIC_INLINE void ll_dual_timer_enable_oneshot(dual_timer_regs_t *DUAL_TIMERx)
400 {
401 SET_BITS(DUAL_TIMERx->CTRL, DUAL_TIMER_CTRL_ONESHOT);
402 }
403
404 /**
405 * @brief Disable one-shot mode.
406 *
407 * \rst
408 * +----------------------+-----------------------------------+
409 * | Register | BitsName |
410 * +======================+===================================+
411 * | CTRL | ONESHOT |
412 * +----------------------+-----------------------------------+
413 * \endrst
414 *
415 * @param DUAL_TIMERx Timer instance
416 * @retval None
417 */
418 __STATIC_INLINE void ll_dual_timer_disable_oneshot(dual_timer_regs_t *DUAL_TIMERx)
419 {
420 CLEAR_BITS(DUAL_TIMERx->CTRL, DUAL_TIMER_CTRL_ONESHOT);
421 }
422
423 /**
424 * @brief Indicate whether the one-shot mode is enabled.
425 *
426 * \rst
427 * +----------------------+-----------------------------------+
428 * | Register | BitsName |
429 * +======================+===================================+
430 * | CTRL | ONESHOT |
431 * +----------------------+-----------------------------------+
432 * \endrst
433 *
434 * @param DUAL_TIMERx Timer instance
435 * @retval State of bit (1 or 0).
436 */
437 __STATIC_INLINE uint32_t ll_dual_timer_is_enabled_oneshot(dual_timer_regs_t *DUAL_TIMERx)
438 {
439 return (READ_BITS(DUAL_TIMERx->CTRL, DUAL_TIMER_CTRL_ONESHOT) == (DUAL_TIMER_CTRL_ONESHOT));
440 }
441
442 /**
443 * @brief Get the counter value.
444 *
445 * \rst
446 * +----------------------+-----------------------------------+
447 * | Register | BitsName |
448 * +======================+===================================+
449 * | VALUE | VALUE |
450 * +----------------------+-----------------------------------+
451 * \endrst
452 *
453 * @param DUAL_TIMERx Timer instance
454 * @retval Counter value (between Min_Data=0 and Max_Data=0xFFFFFFFF)
455 */
456 __STATIC_INLINE uint32_t ll_dual_timer_get_counter(dual_timer_regs_t *DUAL_TIMERx)
457 {
458 return (uint32_t)(READ_REG(DUAL_TIMERx->VALUE));
459 }
460
461 /**
462 * @brief Set the auto-reload value.
463 * @note The counter is blocked while the auto-reload value is null.
464 *
465 * \rst
466 * +----------------------+-----------------------------------+
467 * | Register | BitsName |
468 * +======================+===================================+
469 * | RELOAD | RELOAD |
470 * +----------------------+-----------------------------------+
471 * \endrst
472 *
473 * @param DUAL_TIMERx Timer instance
474 * @param auto_reload between Min_Data=0 and Max_Data=0xFFFFFFFF
475 * @retval None
476 */
477 __STATIC_INLINE void ll_dual_timer_set_auto_reload(dual_timer_regs_t *DUAL_TIMERx, uint32_t auto_reload)
478 {
479 WRITE_REG(DUAL_TIMERx->RELOAD, auto_reload);
480 }
481
482 /**
483 * @brief Get the auto-reload value.
484 *
485 * \rst
486 * +----------------------+-----------------------------------+
487 * | Register | BitsName |
488 * +======================+===================================+
489 * | RELOAD | RELOAD |
490 * +----------------------+-----------------------------------+
491 * \endrst
492 *
493 * @param DUAL_TIMERx Timer instance
494 * @retval Auto-reload value
495 */
496 __STATIC_INLINE uint32_t ll_dual_timer_get_auto_reload(dual_timer_regs_t *DUAL_TIMERx)
497 {
498 return (uint32_t)(READ_REG(DUAL_TIMERx->RELOAD));
499 }
500
501 /**
502 * @brief Set the backgroud-reload value.
503 *
504 * \rst
505 * +----------------------+-----------------------------------+
506 * | Register | BitsName |
507 * +======================+===================================+
508 * | BG_LOAD | BG_LOAD |
509 * +----------------------+-----------------------------------+
510 * \endrst
511 *
512 * @param DUAL_TIMERx Timer instance
513 * @param background_reload between Min_Data=0 and Max_Data=0xFFFFFFFF
514 * @retval None
515 */
516 __STATIC_INLINE void ll_dual_timer_set_background_reload(dual_timer_regs_t *DUAL_TIMERx, uint32_t background_reload)
517 {
518 WRITE_REG(DUAL_TIMERx->BG_LOAD, background_reload);
519 }
520
521 /**
522 * @brief Get the backgroud-reload value.
523 *
524 * \rst
525 * +----------------------+-----------------------------------+
526 * | Register | BitsName |
527 * +======================+===================================+
528 * | BG_LOAD | BG_LOAD |
529 * +----------------------+-----------------------------------+
530 * \endrst
531 *
532 * @param DUAL_TIMERx Timer instance
533 * @retval Return value between Min_Data=0 and Max_Data=0xFFFFFFFF
534 */
535 __STATIC_INLINE uint32_t ll_dual_timer_get_background_reload(dual_timer_regs_t *DUAL_TIMERx)
536 {
537 return (uint32_t)(READ_REG(DUAL_TIMERx->BG_LOAD));
538 }
539
540 /** @} */
541
542 /** @defgroup DUAL_TIM_LL_EF_IT_Management IT_Management
543 * @{
544 */
545
546 /**
547 * @brief Enable dual_timer interrupt.
548 *
549 * \rst
550 * +----------------------+-----------------------------------+
551 * | Register | BitsName |
552 * +======================+===================================+
553 * | CTRL | INTEN |
554 * +----------------------+-----------------------------------+
555 * \endrst
556 *
557 * @param DUAL_TIMERx Timer instance
558 * @retval None
559 */
560 __STATIC_INLINE void ll_dual_timer_enable_it(dual_timer_regs_t *DUAL_TIMERx)
561 {
562 SET_BITS(DUAL_TIMERx->CTRL, DUAL_TIMER_CTRL_INTEN);
563 }
564
565 /**
566 * @brief Disable dual_timer interrput.
567 *
568 * \rst
569 * +----------------------+-----------------------------------+
570 * | Register | BitsName |
571 * +======================+===================================+
572 * | CTRL | INTEN |
573 * +----------------------+-----------------------------------+
574 * \endrst
575 *
576 * @param DUAL_TIMERx Timer instance
577 * @retval None
578 */
579 __STATIC_INLINE void ll_dual_timer_disable_it(dual_timer_regs_t *DUAL_TIMERx)
580 {
581 CLEAR_BITS(DUAL_TIMERx->CTRL, DUAL_TIMER_CTRL_INTEN);
582 }
583
584 /**
585 * @brief Indicate whether the dual_timer interrput is enabled.
586 *
587 * \rst
588 * +----------------------+-----------------------------------+
589 * | Register | BitsName |
590 * +======================+===================================+
591 * | CTRL | INTEN |
592 * +----------------------+-----------------------------------+
593 * \endrst
594 *
595 * @param DUAL_TIMERx Timer instance
596 * @retval State of bit (1 or 0).
597 */
598 __STATIC_INLINE uint32_t ll_dual_timer_is_enabled_it(dual_timer_regs_t *DUAL_TIMERx)
599 {
600 return (READ_BITS(DUAL_TIMERx->CTRL, DUAL_TIMER_CTRL_INTEN) == (DUAL_TIMER_CTRL_INTEN));
601 }
602
603 /** @} */
604
605 /** @defgroup DUAL_TIMER_LL_EF_FLAG_Management FLAG_Management
606 * @{
607 */
608
609 /**
610 * @brief Clear the interrupt flag (INTSTAT).
611 *
612
613 * \rst
614 * +----------------------+-----------------------------------+
615 * | Register | BitsName |
616 * +======================+===================================+
617 * | INTCLR | INTCLR |
618 * +----------------------+-----------------------------------+
619 * \endrst
620 *
621 * @param DUAL_TIMERx Timer instance
622 * @retval None
623 */
624 __STATIC_INLINE void ll_dual_timer_clear_flag_it(dual_timer_regs_t *DUAL_TIMERx)
625 {
626 WRITE_REG(DUAL_TIMERx->INTCLR, DUAL_TIMER_INT_CLR);
627 }
628
629 /**
630 * @brief Indicate whether interrupt flag (INTSTAT) is set (interrupt is pending).
631 *
632 * \rst
633 * +----------------------+-----------------------------------+
634 * | Register | BitsName |
635 * +======================+===================================+
636 * | INTSTAT | INTSTAT |
637 * +----------------------+-----------------------------------+
638 * \endrst
639 *
640 * @param DUAL_TIMERx Timer instance
641 * @retval State of bit (1 or 0).
642 */
643 __STATIC_INLINE uint32_t ll_dual_timer_is_active_flag_it(dual_timer_regs_t *DUAL_TIMERx)
644 {
645 return (READ_BITS(DUAL_TIMERx->INTSTAT, DUAL_TIMER_ISR_TI) == (DUAL_TIMER_ISR_TI));
646 }
647
648 /**
649 * @brief Get Dual_timer raw interrupt flags
650 *
651 * \rst
652 * +----------------------+-----------------------------------+
653 * | Register | BitsName |
654 * +======================+===================================+
655 * | RAW_INTSTAT | RAW_INTSTAT |
656 * +----------------------+-----------------------------------+
657 * \endrst
658 *
659 * @param DUAL_TIMERx Timer instance
660 * @retval State of bit (1 or 0).
661 */
662 __STATIC_INLINE uint32_t ll_dual_timer_get_raw_it_flag(dual_timer_regs_t *DUAL_TIMERx)
663 {
664 return (READ_REG(DUAL_TIMERx->RAW_INTSTAT));
665 }
666
667 /** @} */
668
669 /** @defgroup DUAL_TIMER_LL_EF_Init Initialization and de-initialization functions
670 * @{
671 */
672
673 /**
674 * @brief De-initialize DUAL_TIMER registers (Registers restored to their default values).
675 * @param DUAL_TIMERx DUAL_TIM instance
676 * @retval An error_status_t enumeration value:
677 * - SUCCESS: DUAL_TIMER registers are de-initialized
678 * - ERROR: DUAL_TIMER registers are not de-initialized
679 */
680 error_status_t ll_dual_timer_deinit(dual_timer_regs_t *DUAL_TIMERx);
681
682 /**
683 * @brief Initialize DUAL_TIMER registers according to the specified
684 * parameters in p_dual_timer_init.
685 * @param DUAL_TIMERx DUAL_TIMER instance
686 * @param p_dual_timer_init Pointer to a ll_dual_timer_init_t structure that contains the configuration
687 * information for the specified DUAL_TIMER peripheral.
688 * @retval An error_status_t enumeration value:
689 * - SUCCESS: DUAL_TIMER registers are initialized according to p_dual_timer_init content
690 * - ERROR: Problem occurred during DUAL_TIM Registers initialization
691 */
692 error_status_t ll_dual_timer_init(dual_timer_regs_t *DUAL_TIMERx, ll_dual_timer_init_t *p_dual_timer_init);
693
694 /**
695 * @brief Set each field of a @ref ll_dual_timer_init_t type structure to default value.
696 * @param p_dual_timer_init Pointer to a @ref ll_dual_timer_init_t structure
697 * whose fields will be set to default values.
698 * @retval None
699 */
700 void ll_dual_timer_struct_init(ll_dual_timer_init_t *p_dual_timer_init);
701
702 /** @} */
703
704 /** @} */
705
706
707 #endif /* DUAL_TIMER0 || DUAL_TIMER1 */
708
709 #ifdef __cplusplus
710 }
711 #endif
712
713 #endif /* __GR55XX_LL_DUAL_TIMER_H__ */
714
715 /** @} */
716
717 /** @} */
718
719 /** @} */
ll_dual_timer_enable_it
__STATIC_INLINE void ll_dual_timer_enable_it(dual_timer_regs_t *DUAL_TIMERx)
Enable dual_timer interrupt.
Definition: gr55xx_ll_dual_tim.h:560
ll_dual_timer_init_t
struct _ll_dual_timer_init ll_dual_timer_init_t
LL DUAL TIMER init Structure definition.
ll_dual_timer_get_raw_it_flag
__STATIC_INLINE uint32_t ll_dual_timer_get_raw_it_flag(dual_timer_regs_t *DUAL_TIMERx)
Get Dual_timer raw interrupt flags.
Definition: gr55xx_ll_dual_tim.h:662
ll_dual_timer_get_counter_mode
__STATIC_INLINE uint32_t ll_dual_timer_get_counter_mode(dual_timer_regs_t *DUAL_TIMERx)
Get the counter mode.
Definition: gr55xx_ll_dual_tim.h:292
ll_dual_timer_is_active_flag_it
__STATIC_INLINE uint32_t ll_dual_timer_is_active_flag_it(dual_timer_regs_t *DUAL_TIMERx)
Indicate whether interrupt flag (INTSTAT) is set (interrupt is pending).
Definition: gr55xx_ll_dual_tim.h:643
ll_dual_timer_disable_it
__STATIC_INLINE void ll_dual_timer_disable_it(dual_timer_regs_t *DUAL_TIMERx)
Disable dual_timer interrput.
Definition: gr55xx_ll_dual_tim.h:579
ll_dual_timer_set_prescaler
__STATIC_INLINE void ll_dual_timer_set_prescaler(dual_timer_regs_t *DUAL_TIMERx, uint32_t prescaler)
Set the prescaler.
Definition: gr55xx_ll_dual_tim.h:315
_ll_dual_timer_init::prescaler
uint32_t prescaler
Specifies the prescaler value used to divide the TIMER clock.
Definition: gr55xx_ll_dual_tim.h:78
ll_dual_timer_set_auto_reload
__STATIC_INLINE void ll_dual_timer_set_auto_reload(dual_timer_regs_t *DUAL_TIMERx, uint32_t auto_reload)
Set the auto-reload value.
Definition: gr55xx_ll_dual_tim.h:477
ll_dual_timer_enable_counter
__STATIC_INLINE void ll_dual_timer_enable_counter(dual_timer_regs_t *DUAL_TIMERx)
Enable dual_timer counter.
Definition: gr55xx_ll_dual_tim.h:211
ll_dual_timer_get_prescaler
__STATIC_INLINE uint32_t ll_dual_timer_get_prescaler(dual_timer_regs_t *DUAL_TIMERx)
Get the prescaler.
Definition: gr55xx_ll_dual_tim.h:337
ll_dual_timer_init
error_status_t ll_dual_timer_init(dual_timer_regs_t *DUAL_TIMERx, ll_dual_timer_init_t *p_dual_timer_init)
Initialize DUAL_TIMER registers according to the specified parameters in p_dual_timer_init.
ll_dual_timer_clear_flag_it
__STATIC_INLINE void ll_dual_timer_clear_flag_it(dual_timer_regs_t *DUAL_TIMERx)
Clear the interrupt flag (INTSTAT).
Definition: gr55xx_ll_dual_tim.h:624
ll_dual_timer_disable_oneshot
__STATIC_INLINE void ll_dual_timer_disable_oneshot(dual_timer_regs_t *DUAL_TIMERx)
Disable one-shot mode.
Definition: gr55xx_ll_dual_tim.h:418
ll_dual_timer_set_counter_mode
__STATIC_INLINE void ll_dual_timer_set_counter_mode(dual_timer_regs_t *DUAL_TIMERx, uint32_t counter_mode)
Set the counter mode.
Definition: gr55xx_ll_dual_tim.h:271
ll_dual_timer_set_background_reload
__STATIC_INLINE void ll_dual_timer_set_background_reload(dual_timer_regs_t *DUAL_TIMERx, uint32_t background_reload)
Set the backgroud-reload value.
Definition: gr55xx_ll_dual_tim.h:516
ll_dual_timer_enable_oneshot
__STATIC_INLINE void ll_dual_timer_enable_oneshot(dual_timer_regs_t *DUAL_TIMERx)
Enable one-shot mode.
Definition: gr55xx_ll_dual_tim.h:399
ll_dual_timer_is_enabled_it
__STATIC_INLINE uint32_t ll_dual_timer_is_enabled_it(dual_timer_regs_t *DUAL_TIMERx)
Indicate whether the dual_timer interrput is enabled.
Definition: gr55xx_ll_dual_tim.h:598
_ll_dual_timer_init::auto_reload
uint32_t auto_reload
Specifies the auto reload value to be loaded into the active Auto-Reload Register at the next update ...
Definition: gr55xx_ll_dual_tim.h:93
ll_dual_timer_get_background_reload
__STATIC_INLINE uint32_t ll_dual_timer_get_background_reload(dual_timer_regs_t *DUAL_TIMERx)
Get the backgroud-reload value.
Definition: gr55xx_ll_dual_tim.h:535
ll_dual_timer_get_counter
__STATIC_INLINE uint32_t ll_dual_timer_get_counter(dual_timer_regs_t *DUAL_TIMERx)
Get the counter value.
Definition: gr55xx_ll_dual_tim.h:456
ll_dual_timer_is_enabled_oneshot
__STATIC_INLINE uint32_t ll_dual_timer_is_enabled_oneshot(dual_timer_regs_t *DUAL_TIMERx)
Indicate whether the one-shot mode is enabled.
Definition: gr55xx_ll_dual_tim.h:437
_ll_dual_timer_init
LL DUAL TIMER init Structure definition.
Definition: gr55xx_ll_dual_tim.h:77
ll_dual_timer_struct_init
void ll_dual_timer_struct_init(ll_dual_timer_init_t *p_dual_timer_init)
Set each field of a ll_dual_timer_init_t type structure to default value.
_ll_dual_timer_init::counter_size
uint32_t counter_size
Specifies the prescaler value used to divide the DUAL_TIMER clock.
Definition: gr55xx_ll_dual_tim.h:83
_ll_dual_timer_init::counter_mode
uint32_t counter_mode
Specifies the counter mode.
Definition: gr55xx_ll_dual_tim.h:88
ll_dual_timer_is_enabled_counter
__STATIC_INLINE uint32_t ll_dual_timer_is_enabled_counter(dual_timer_regs_t *DUAL_TIMERx)
Indicate whether the dual_timer counter is enabled.
Definition: gr55xx_ll_dual_tim.h:249
ll_dual_timer_disable_counter
__STATIC_INLINE void ll_dual_timer_disable_counter(dual_timer_regs_t *DUAL_TIMERx)
Disable dual_timer counter.
Definition: gr55xx_ll_dual_tim.h:230
ll_dual_timer_get_auto_reload
__STATIC_INLINE uint32_t ll_dual_timer_get_auto_reload(dual_timer_regs_t *DUAL_TIMERx)
Get the auto-reload value.
Definition: gr55xx_ll_dual_tim.h:496
ll_dual_timer_set_counter_size
__STATIC_INLINE void ll_dual_timer_set_counter_size(dual_timer_regs_t *DUAL_TIMERx, uint32_t counter_size)
Set the counter size.
Definition: gr55xx_ll_dual_tim.h:359
ll_dual_timer_get_counter_size
__STATIC_INLINE uint32_t ll_dual_timer_get_counter_size(dual_timer_regs_t *DUAL_TIMERx)
Get the counter size.
Definition: gr55xx_ll_dual_tim.h:380
ll_dual_timer_deinit
error_status_t ll_dual_timer_deinit(dual_timer_regs_t *DUAL_TIMERx)
De-initialize DUAL_TIMER registers (Registers restored to their default values).