Go to the documentation of this file.
62 #if defined (TIMER0) || defined (TIMER1)
170 #define TIMER_DEFAULT_CONFIG \
172 .auto_reload = SystemCoreClock - 1, \
183 #define LL_TIMER_INTSTAT_COUNTDONE TIMER_COUNTDONE_INT_STAT
184 #define LL_TIMER_INTSTAT_CH0 TIMER_CH0_INT_STAT
185 #define LL_TIMER_INTSTAT_CH1 TIMER_CH1_INT_STAT
186 #define LL_TIMER_INTSTAT_CH2 TIMER_CH2_INT_STAT
187 #define LL_TIMER_INTSTAT_CH3 TIMER_CH3_INT_STAT
188 #define LL_TIMER_INTSTAT_BLEPULSE1 TIMER_BLEPULSE1_INT_STAT
189 #define LL_TIMER_INTSTAT_BLEPULSE2 TIMER_BLEPULSE2_INT_STAT
210 #define LL_TIMER_WriteReg(__instance__, __REG__, __VALUE__) WRITE_REG(__instance__->__REG__, (__VALUE__))
218 #define LL_TIMER_ReadReg(__instance__, __REG__) READ_REG(__instance__->__REG__)
247 SET_BITS(TIMERx->CTRL, TIMER_CTRL_EN);
262 CLEAR_BITS(TIMERx->CTRL, TIMER_CTRL_EN);
277 return (READ_BITS(TIMERx->CTRL, TIMER_CTRL_EN) == (TIMER_CTRL_EN));
293 WRITE_REG(TIMERx->VALUE, counter);
308 return (uint32_t)(READ_REG(TIMERx->VALUE));
325 WRITE_REG(TIMERx->RELOAD, auto_reload);
340 return (uint32_t)(READ_REG(TIMERx->RELOAD));
361 SET_BITS(TIMERx->INTEN, TIMER_COUNTDONE_INT_EN | \
380 CLEAR_BITS(TIMERx->INTEN, TIMER_COUNTDONE_INT_EN | \
399 SET_BITS(TIMERx->INTEN, TIMER_COUNTDONE_INT_EN);
414 CLEAR_BITS(TIMERx->INTEN, TIMER_COUNTDONE_INT_EN);
429 SET_BITS(TIMERx->INTEN, TIMER_CH0_INT_EN);
444 CLEAR_BITS(TIMERx->INTEN, TIMER_CH0_INT_EN);
459 SET_BITS(TIMERx->INTEN, TIMER_CH1_INT_EN);
474 CLEAR_BITS(TIMERx->INTEN, TIMER_CH1_INT_EN);
489 SET_BITS(TIMERx->INTEN, TIMER_CH2_INT_EN);
504 CLEAR_BITS(TIMERx->INTEN, TIMER_CH2_INT_EN);
519 SET_BITS(TIMERx->INTEN, TIMER_CH3_INT_EN);
534 CLEAR_BITS(TIMERx->INTEN, TIMER_CH3_INT_EN);
549 SET_BITS(TIMERx->INTEN, TIMER_BLEPULSE1_INT_EN);
564 CLEAR_BITS(TIMERx->INTEN, TIMER_BLEPULSE1_INT_EN);
579 SET_BITS(TIMERx->INTEN, TIMER_BLEPULSE2_INT_EN);
594 CLEAR_BITS(TIMERx->INTEN, TIMER_BLEPULSE2_INT_EN);
609 return (READ_BITS(TIMERx->INTEN, TIMER_COUNTDONE_INT_EN) >> TIMER_COUNTDONE_INT_EN_Pos | \
610 READ_BITS(TIMERx->INTEN, TIMER_CH0_INT_EN) >> TIMER_CH0_INT_EN_Pos | \
611 READ_BITS(TIMERx->INTEN, TIMER_CH1_INT_EN) >> TIMER_CH1_INT_EN_Pos | \
612 READ_BITS(TIMERx->INTEN, TIMER_CH2_INT_EN) >> TIMER_CH2_INT_EN_Pos | \
613 READ_BITS(TIMERx->INTEN, TIMER_CH3_INT_EN) >> TIMER_CH3_INT_EN_Pos);
633 WRITE_REG(TIMERx->INTSTAT, TIMER_COUNTDONE_INT_STAT);
648 WRITE_REG(TIMERx->INTSTAT, TIMER_CH0_INT_STAT);
663 WRITE_REG(TIMERx->INTSTAT, TIMER_CH1_INT_STAT);
678 WRITE_REG(TIMERx->INTSTAT, TIMER_CH2_INT_STAT);
693 WRITE_REG(TIMERx->INTSTAT, TIMER_CH3_INT_STAT);
708 WRITE_REG(TIMERx->INTSTAT, TIMER_BLEPULSE1_INT_STAT);
723 WRITE_REG(TIMERx->INTSTAT, TIMER_BLEPULSE2_INT_STAT);
738 WRITE_REG(TIMERx->INTSTAT, TIMER_INT_STAT);
753 return (READ_BITS(TIMERx->INTSTAT, TIMER_INT_STAT) != TIMER_INT_STAT_Pos);
782 MODIFY_REG(TIMERx->CTRL, TIMER_CH0_EDGE_DET, ll_edge_capture << TIMER_CH0_EDGE_DET_Pos);
813 MODIFY_REG(TIMERx->CTRL, TIMER_CH1_EDGE_DET, ll_edge_capture << TIMER_CH1_EDGE_DET_Pos);
844 MODIFY_REG(TIMERx->CTRL, TIMER_CH2_EDGE_DET, ll_edge_capture << TIMER_CH2_EDGE_DET_Pos);
875 MODIFY_REG(TIMERx->CTRL, TIMER_CH3_EDGE_DET, ll_edge_capture << TIMER_CH3_EDGE_DET_Pos);
906 MODIFY_REG(TIMERx->CTRL, TIMER_CH0_PIN_SELECT, ll_capture_pin << TIMER_CH0_PIN_SELECT_Pos);
921 return (
ll_timer_capture_pin_t )(READ_BITS(TIMERx->CTRL, TIMER_CH0_PIN_SELECT) >> TIMER_CH0_PIN_SELECT_Pos);
937 MODIFY_REG(TIMERx->CTRL, TIMER_CH1_PIN_SELECT, ll_capture_pin << TIMER_CH1_PIN_SELECT_Pos);
952 return (
ll_timer_capture_pin_t )(READ_BITS(TIMERx->CTRL, TIMER_CH1_PIN_SELECT) >> TIMER_CH1_PIN_SELECT_Pos);
968 MODIFY_REG(TIMERx->CTRL, TIMER_CH2_PIN_SELECT, ll_capture_pin << TIMER_CH2_PIN_SELECT_Pos);
983 return (
ll_timer_capture_pin_t )(READ_BITS(TIMERx->CTRL, TIMER_CH2_PIN_SELECT) >> TIMER_CH2_PIN_SELECT_Pos);
999 MODIFY_REG(TIMERx->CTRL, TIMER_CH3_PIN_SELECT, ll_capture_pin << TIMER_CH3_PIN_SELECT_Pos);
1014 return (
ll_timer_capture_pin_t )(READ_BITS(TIMERx->CTRL, TIMER_CH3_PIN_SELECT) >> TIMER_CH3_PIN_SELECT_Pos);
1029 return (uint32_t )(READ_BITS(TIMERx->INTSTAT, TIMER_INT_STAT));
1044 return (uint32_t )(READ_REG(TIMERx->CHANNEL0_VAL));
1059 return (uint32_t )(READ_REG(TIMERx->CHANNEL1_VAL));
1074 return (uint32_t )(READ_REG(TIMERx->CHANNEL2_VAL));
1089 return (uint32_t )(READ_REG(TIMERx->CHANNEL3_VAL));
1104 SET_BITS(TIMERx->CTRL, TIMER_BLE_PULSE_CTRL);
1119 CLEAR_BITS(TIMERx->CTRL, TIMER_BLE_PULSE_CTRL);
1134 return (READ_BITS(TIMERx->CTRL, TIMER_BLE_PULSE_CTRL) == (TIMER_BLE_PULSE_CTRL));
1150 WRITE_REG(TIMERx->BLE_COUNTVAL1, value);
1165 return (uint32_t)(READ_REG(TIMERx->BLE_COUNTVAL1));
1181 WRITE_REG(TIMERx->BLE_COUNTVAL2, value);
1196 return (uint32_t)(READ_REG(TIMERx->BLE_COUNTVAL2));
1212 MODIFY_REG(TIMERx->BLE_PULSEWIDTH, TIMER_BLE_PLS, width << TIMER_BLE_PLS_Pos);
1227 return (uint32_t)(READ_BITS(TIMERx->BLE_PULSEWIDTH, TIMER_BLE_PLS) >> TIMER_BLE_PLS_Pos);
__STATIC_INLINE void ll_timer_set_channel3_capture_type(timer_regs_t *TIMERx, uint8_t ll_edge_capture)
Set timer channel3 capture type.
__STATIC_INLINE void ll_timer_set_channel0_capture_pin(timer_regs_t *TIMERx, uint8_t ll_capture_pin)
Set timer channel0 capture pin.
__STATIC_INLINE void ll_timer_disable_ble_pulse(timer_regs_t *TIMERx)
Disable timer BLE pulse.
__STATIC_INLINE void ll_timer_enable_blepulse1_it(timer_regs_t *TIMERx)
Enable timer ble pulse 1 interrupt.
__STATIC_INLINE void ll_timer_enable_counter(timer_regs_t *TIMERx)
Enable timer counter.
__STATIC_INLINE void ll_timer_set_channel0_capture_type(timer_regs_t *TIMERx, uint8_t ll_edge_capture)
Set timer channel0 capture type.
__STATIC_INLINE void ll_timer_set_BLE_pulse_width(timer_regs_t *TIMERx, uint32_t width)
Set the BLE pulse width.
__STATIC_INLINE ll_timer_capture_pin_t ll_timer_get_channel3_capture_pin(timer_regs_t *TIMERx)
Get timer channel3 capture pin.
__STATIC_INLINE void ll_timer_disable_channel2_it(timer_regs_t *TIMERx)
Disable timer channel2 interrput.
ll_timer_capture_channel_init_t ll_capture_channel1
ll_timer_capture_pin_t
LL TIMER capture pin Enumerations definition.
__STATIC_INLINE void ll_timer_disable_channel3_it(timer_regs_t *TIMERx)
Disable timer channel3 interrput.
__STATIC_INLINE void ll_timer_enable_all_it(timer_regs_t *TIMERx)
Enable timer all interrupt.
__STATIC_INLINE void ll_timer_enable_channel1_it(timer_regs_t *TIMERx)
Enable timer channel1 interrupt.
__STATIC_INLINE uint32_t ll_timer_get_pulse_width(timer_regs_t *TIMERx)
Get the BLE pulse width.
__STATIC_INLINE void ll_timer_disable_counter(timer_regs_t *TIMERx)
Disable timer counter.
__STATIC_INLINE void ll_timer_set_BLE_val1(timer_regs_t *TIMERx, uint32_t value)
Set the BLE count value1.
__STATIC_INLINE void ll_timer_set_counter(timer_regs_t *TIMERx, uint32_t counter)
Set the counter value.
__STATIC_INLINE ll_timer_capture_type_t ll_timer_get_channel2_capture_type(timer_regs_t *TIMERx)
Get timer channel2 capture type.
__STATIC_INLINE uint32_t ll_timer_is_enabled_counter(timer_regs_t *TIMERx)
Indicate whether the timer counter is enabled.
__STATIC_INLINE uint32_t ll_timer_get_BLE_val2(timer_regs_t *TIMERx)
Get the BLE count value2.
__STATIC_INLINE void ll_timer_clear_channel0_flag_it(timer_regs_t *TIMERx)
Clear the CHANNEL0 interrupt flag.
LL TIMER init Structure definition.
__STATIC_INLINE void ll_timer_disable_blepulse2_it(timer_regs_t *TIMERx)
Disable timer ble pulse 2 interrput.
__STATIC_INLINE void ll_timer_disable_channel0_it(timer_regs_t *TIMERx)
Disable timer channel0 interrput.
__STATIC_INLINE void ll_timer_enable_channel2_it(timer_regs_t *TIMERx)
Enable timer channel2 interrupt.
__STATIC_INLINE void ll_timer_clear_blepulse1_flag_it(timer_regs_t *TIMERx)
Clear the ble pulse 1 interrupt flag.
__STATIC_INLINE void ll_timer_enable_channel0_it(timer_regs_t *TIMERx)
Enable timer channel0 interrupt.
CMSIS Cortex-M# Core Peripheral Access Layer Header File for Device GR5405.
__STATIC_INLINE void ll_timer_set_BLE_val2(timer_regs_t *TIMERx, uint32_t value)
Set the BLE count value2.
__STATIC_INLINE uint32_t ll_timer_get_channel2_val(timer_regs_t *TIMERx)
Get current value of channel2.
ll_timer_capture_type_t
LL TIMER capture type Enumerations definition.
__STATIC_INLINE ll_timer_capture_pin_t ll_timer_get_channel2_capture_pin(timer_regs_t *TIMERx)
Get timer channel2 capture pin.
__STATIC_INLINE void ll_timer_disable_blepulse1_it(timer_regs_t *TIMERx)
Disable timer ble pulse 1 interrput.
__STATIC_INLINE void ll_timer_enable_ble_pulse(timer_regs_t *TIMERx)
Enable timer BLE pulse.
__STATIC_INLINE void ll_timer_disable_all_it(timer_regs_t *TIMERx)
Disable timer all interrput.
__STATIC_INLINE ll_timer_capture_type_t ll_timer_get_channel0_capture_type(timer_regs_t *TIMERx)
Get timer channel0 capture type.
__STATIC_INLINE void ll_timer_clear_channel1_flag_it(timer_regs_t *TIMERx)
Clear the CHANNEL1 interrupt flag.
__STATIC_INLINE void ll_timer_set_channel3_capture_pin(timer_regs_t *TIMERx, uint8_t ll_capture_pin)
Set timer channel3 capture pin.
LL TIMER capture channel Structure definition.
@ LL_TIMER_CAPTURE_RISING
ll_timer_capture_channel_init_t ll_capture_channel2
__STATIC_INLINE uint32_t ll_timer_get_it_flag(timer_regs_t *TIMERx)
Get timer interrupt flag.
__STATIC_INLINE void ll_timer_set_channel2_capture_type(timer_regs_t *TIMERx, uint8_t ll_edge_capture)
Set timer channel2 capture type.
__STATIC_INLINE uint32_t ll_timer_get_counter(timer_regs_t *TIMERx)
Get the counter value.
__STATIC_INLINE ll_timer_capture_type_t ll_timer_get_channel1_capture_type(timer_regs_t *TIMERx)
Get timer channel1 capture type.
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 ll_timer_capture_pin_t ll_timer_get_channel1_capture_pin(timer_regs_t *TIMERx)
Get timer channel1 capture pin.
__STATIC_INLINE uint32_t ll_timer_get_channel1_val(timer_regs_t *TIMERx)
Get current value of channel1.
__STATIC_INLINE uint32_t ll_timer_is_enabled_ble_pulse(timer_regs_t *TIMERx)
Indicate whether the timer BLE pulse is enabled.
__STATIC_INLINE void ll_timer_clear_channel3_flag_it(timer_regs_t *TIMERx)
Clear the CHANNEL3 interrupt flag.
__STATIC_INLINE void ll_timer_set_channel1_capture_type(timer_regs_t *TIMERx, uint8_t ll_edge_capture)
Set timer channel1 capture type.
__STATIC_INLINE void ll_timer_clear_countdone_flag_it(timer_regs_t *TIMERx)
Clear the COUNTDONE interrupt flag.
@ LL_TIMER_CAPTURE_FALLING
__STATIC_INLINE void ll_timer_set_channel1_capture_pin(timer_regs_t *TIMERx, uint8_t ll_capture_pin)
Set timer channel1 capture pin.
struct _ll_timer_capture_channel_init ll_timer_capture_channel_init_t
LL TIMER capture channel Structure definition.
ll_timer_capture_channel_init_t ll_capture_channel3
__STATIC_INLINE void ll_timer_set_auto_reload(timer_regs_t *TIMERx, uint32_t auto_reload)
Set the auto-reload value.
__STATIC_INLINE void ll_timer_enable_blepulse2_it(timer_regs_t *TIMERx)
Enable timer ble pulse 2 interrupt.
__STATIC_INLINE uint32_t ll_timer_get_channel3_val(timer_regs_t *TIMERx)
Get current value of channel3.
__STATIC_INLINE uint32_t ll_timer_get_auto_reload(timer_regs_t *TIMERx)
Get the auto-reload value.
__STATIC_INLINE void ll_timer_disable_channel1_it(timer_regs_t *TIMERx)
Disable timer channel1 interrput.
__STATIC_INLINE void ll_timer_enable_countdone_it(timer_regs_t *TIMERx)
Enable timer countdone interrupt.
__STATIC_INLINE void ll_timer_disable_countdone_it(timer_regs_t *TIMERx)
Disable timer countdone interrput.
__STATIC_INLINE uint32_t ll_timer_get_channel0_val(timer_regs_t *TIMERx)
Get current value of channel0.
ll_timer_capture_channel_init_t ll_capture_channel0
__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 ll_timer_capture_pin_t ll_timer_get_channel0_capture_pin(timer_regs_t *TIMERx)
Get timer channel0 capture pin.
__STATIC_INLINE void ll_timer_set_channel2_capture_pin(timer_regs_t *TIMERx, uint8_t ll_capture_pin)
Set timer channel2 capture pin.
__STATIC_INLINE void ll_timer_enable_channel3_it(timer_regs_t *TIMERx)
Enable timer channel3 interrupt.
__STATIC_INLINE void ll_timer_clear_channel2_flag_it(timer_regs_t *TIMERx)
Clear the CHANNEL2 interrupt flag.
__STATIC_INLINE void ll_timer_clear_blepulse2_flag_it(timer_regs_t *TIMERx)
Clear the ble pulse 2 interrupt flag.
__STATIC_INLINE void ll_timer_clear_all_flag_it(timer_regs_t *TIMERx)
Clear the all interrupt flag.
__STATIC_INLINE ll_timer_capture_type_t ll_timer_get_channel3_capture_type(timer_regs_t *TIMERx)
Get timer channel3 capture type.
__STATIC_INLINE uint32_t ll_timer_get_BLE_val1(timer_regs_t *TIMERx)
Get the BLE count value1.