quasar_timer_ext.h
Typedefs
-
typedef enum quasar_timer_selection quasar_timer_selection_t
List of all available timers.
-
typedef enum quasar_timer_time_base quasar_timer_time_base_t
Available time base for a timer.
-
typedef struct quasar_timer_config quasar_timer_config_t
Configuration settings for a timer.
Enums
-
enum quasar_timer_selection
List of all available timers.
Values:
-
enumerator QUASAR_TIMER_SELECTION_TIMER1
Select the 16-bits timer 1.
-
enumerator QUASAR_TIMER_SELECTION_TIMER2
Select the 32-bits timer 2.
-
enumerator QUASAR_TIMER_SELECTION_TIMER3
Select the 32-bits timer 3.
-
enumerator QUASAR_TIMER_SELECTION_TIMER4
Select the 32-bits timer 4.
-
enumerator QUASAR_TIMER_SELECTION_TIMER5
Select the 32-bits timer 5.
-
enumerator QUASAR_TIMER_SELECTION_TIMER6
Select the 16-bits timer 6.
-
enumerator QUASAR_TIMER_SELECTION_TIMER7
Select the 16-bits timer 7.
-
enumerator QUASAR_TIMER_SELECTION_TIMER8
Select the 16-bits timer 8.
-
enumerator QUASAR_TIMER_SELECTION_TIMER15
Select the 16-bits timer 15.
-
enumerator QUASAR_TIMER_SELECTION_TIMER16
Select the 16-bits timer 16.
-
enumerator QUASAR_TIMER_SELECTION_TIMER17
Select the 16-bits timer 17.
-
enumerator QUASAR_TIMER_SELECTION_TIMER1
Functions
-
void quasar_timer_init(quasar_timer_config_t *timer_config)
Initialize the timer as a basic timer.
- Parameters:
timer_config – [in] Configuration of the timer.
-
void quasar_timer_deinit(quasar_timer_config_t timer_config)
Deinitialize the timer.
- Parameters:
timer_config – [in] Configuration of the timer.
-
void quasar_timer_enable_interrupt(quasar_timer_selection_t timer_selection)
Enable the selected timer interrupt.
Note
The interrupt are enabled by default in the timer initialization.
- Parameters:
timer_selection – [in] Available timer selection.
-
void quasar_timer_disable_interrupt(quasar_timer_selection_t timer_selection)
Disable the selected timer interrupt.
Note
The interrupt are enabled by default in the timer initialization.
- Parameters:
timer_selection – [in] Available timer selection.
-
void quasar_timer_start(quasar_timer_selection_t timer_selection)
Start the selected timer.
- Parameters:
timer_selection – [in] Selected timer to start.
-
void quasar_timer_stop(quasar_timer_selection_t timer_selection)
Stop the selected timer.
- Parameters:
timer_selection – [in] Selected timer to stop.
-
TIM_TypeDef *quasar_timer_get_instance(quasar_timer_selection_t timer_selection)
Return the instance to the selected timer instance.
- Parameters:
timer_selection – [in] Selected timer to get associated instance.
- Returns:
Selected timer instance.
-
void quasar_timer_set_period(quasar_timer_selection_t timer_selection, uint16_t period)
Manually set the period (Auto-Reload Register) register value.
Note
This function is used when the timer needs to be fine tuned. This function automatically adds the -1 to the period value.
- Parameters:
timer_selection – [in] Available timer selection.
period – [in] Period (Auto-Reload Register) value.
-
uint32_t quasar_timer_get_period(quasar_timer_selection_t timer_selection)
Get the selected timer period (Auto-Reload Register) register value.
Note
This function automatically adds the +1 to the period value.
- Parameters:
timer_selection – [in] Available timer selection.
- Returns:
Period register value.
-
void quasar_timer_set_prescaler(quasar_timer_selection_t timer_selection, uint16_t prescaler)
Manually set the prescaler register value.
Note
This function is used when the timer needs to be fine tuned. This function automatically adds the -1 to the prescaler value.
- Parameters:
timer_selection – [in] Available timer selection.
prescaler – [in] Prescaler register value.
-
uint32_t quasar_timer_get_prescaler(quasar_timer_selection_t timer_selection)
Get the selected timer prescaler register value.
Note
This function automatically adds the +1 to the prescaler value.
- Parameters:
timer_selection – [in] Available timer selection.
- Returns:
Prescaler register value.
-
void quasar_timer_reset_count(quasar_timer_selection_t timer_selection)
Reset the selected timer count value.
- Parameters:
timer_selection – [in] Available timer selection.
-
uint32_t quasar_timer_get_count(quasar_timer_selection_t timer_selection)
Get the selected timer count value.
- Parameters:
timer_selection – [in] Available timer selection.
- Returns:
Timer count value.
-
void quasar_timer_generate_event(quasar_timer_selection_t timer_selection)
Generate an update event on a timer to trigger an IRQ and reset the timer.
- Parameters:
timer_selection – [in] Available timer selection.
-
struct quasar_timer_config
- #include <quasar_timer_ext.h>
Configuration settings for a timer.
Public Members
-
quasar_timer_selection_t timer_selection
Available timers.
-
quasar_timer_time_base_t time_base
Select the time base for the time period.
-
uint16_t time_period
Select the time period based on the selected time base.
-
quasar_irq_priority_t irq_priority
Available IRQ priority.
-
quasar_timer_selection_t timer_selection