Go to the documentation of this file.
52 #ifndef __GR55XX_LL_TIMER_H__
53 #define __GR55XX_LL_TIMER_H__
62 #if defined (TIMER0) || defined (TIMER1)
105 #define TIMER_DEFAULT_CONFIG \
107 .auto_reload = SystemCoreClock - 1, \
129 #define LL_TIMER_WriteReg(__instance__, __REG__, __VALUE__) WRITE_REG(__instance__->__REG__, (__VALUE__))
137 #define LL_TIMER_ReadReg(__instance__, __REG__) READ_REG(__instance__->__REG__)
166 SET_BITS(TIMERx->CTRL, TIMER_CTRL_EN);
181 CLEAR_BITS(TIMERx->CTRL, TIMER_CTRL_EN);
196 return (READ_BITS(TIMERx->CTRL, TIMER_CTRL_EN) == (TIMER_CTRL_EN));
212 WRITE_REG(TIMERx->VALUE, counter);
227 return (uint32_t)(READ_REG(TIMERx->VALUE));
244 WRITE_REG(TIMERx->RELOAD, auto_reload);
259 return (uint32_t)(READ_REG(TIMERx->RELOAD));
280 SET_BITS(TIMERx->CTRL, TIMER_CTRL_INTEN);
295 CLEAR_BITS(TIMERx->CTRL, TIMER_CTRL_INTEN);
310 return (READ_BITS(TIMERx->CTRL, TIMER_CTRL_INTEN) == (TIMER_CTRL_INTEN));
331 WRITE_REG(TIMERx->INTSTAT, TIMER_INT_STAT);
346 return (READ_BITS(TIMERx->INTSTAT, TIMER_INT_STAT) == (TIMER_INT_STAT));
__STATIC_INLINE void ll_timer_enable_counter(timer_regs_t *TIMERx)
Enable timer counter.
error_status_t ll_timer_init(timer_regs_t *TIMERx, ll_timer_init_t *p_timer_init)
Initialize TIMER registers according to the specified parameters in TIMER_InitStruct.
__STATIC_INLINE void ll_timer_disable_counter(timer_regs_t *TIMERx)
Disable timer counter.
__STATIC_INLINE void ll_timer_set_counter(timer_regs_t *TIMERx, uint32_t counter)
Set the counter value.
__STATIC_INLINE void ll_timer_enable_it(timer_regs_t *TIMERx)
Enable timer interrupt.
__STATIC_INLINE void ll_timer_clear_flag_it(timer_regs_t *TIMERx)
Clear the interrupt flag (INTSTAT).
__STATIC_INLINE uint32_t ll_timer_is_enabled_counter(timer_regs_t *TIMERx)
Indicate whether the timer counter is enabled.
error_status_t ll_timer_deinit(timer_regs_t *TIMERx)
De-initialize TIMER registers (Registers restored to their default values).
LL TIMER init Structure definition.
__STATIC_INLINE uint32_t ll_timer_get_counter(timer_regs_t *TIMERx)
Get the counter value.
void ll_timer_struct_init(ll_timer_init_t *p_timer_init)
Set each field of a ll_timer_init_t type structure to default value.
__STATIC_INLINE void ll_timer_set_auto_reload(timer_regs_t *TIMERx, uint32_t auto_reload)
Set the auto-reload value.
__STATIC_INLINE uint32_t ll_timer_get_auto_reload(timer_regs_t *TIMERx)
Get the auto-reload value.
__STATIC_INLINE uint32_t ll_timer_is_active_flag_it(timer_regs_t *TIMERx)
Indicate whether interrupt flag (INTSTAT) is set (interrupt is pending).
struct _ll_timer_init_t ll_timer_init_t
LL TIMER init Structure definition.
__STATIC_INLINE uint32_t ll_timer_is_enabled_it(timer_regs_t *TIMERx)
Indicate whether the timer interrput is enabled.
__STATIC_INLINE void ll_timer_disable_it(timer_regs_t *TIMERx)
Disable timer interrput.