libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
timer.c File Reference
Include dependency graph for timer.c:

Go to the source code of this file.

Functions

static void timer_setup_internal (uint32_t timer, bool timer_int_en, enum timer_operation_modes op_mode, enum timer_edge_modes edge_mode, enum timer_loop_modes loop_mode, enum timer_clk_src clk_src, enum timer_output_modes output_mode, enum timer_level output_level)
 Internal function for timer setup. More...
 
void timer_counter_setup (uint32_t timer, bool timer_int_en, enum timer_edge_modes edge_mode, enum timer_loop_modes loop_mode, enum timer_clk_src clk_src, enum timer_output_modes output_mode, enum timer_level output_level, uint32_t target)
 Setup the timer in counter mode. More...
 
void timer_pwm_setup (uint32_t timer, bool timer_int_en, enum timer_edge_modes edge_mode, enum timer_clk_src clk_src, enum timer_level output_level, uint16_t period0, uint16_t period1)
 Setup the timer in PWM mode. More...
 
void timer_pulse_capture_setup (uint32_t timer, bool timer_int_en, enum timer_edge_modes edge_mode, enum timer_loop_modes loop_mode)
 Setup the timer in pulse capture mode. More...
 
void timer_duty_cycle_capture_setup (uint32_t timer, bool timer_int_en, enum timer_edge_modes edge_mode, enum timer_loop_modes loop_mode)
 Setup the timer in duty cycle capture mode. More...
 
void timer_clock_div (uint8_t div)
 Set the timer clock divider, based off of the 18MHz oscillator. More...
 
void timer_enable (uint32_t timer, bool en)
 Enables or disables the timer. More...
 
void timer_clock_enable (uint32_t timer, bool en)
 Enables or disables the timer's internal clock. More...
 
void timer_operation_mode (uint32_t timer, enum timer_operation_modes mode)
 Selects the mode of operation. More...
 
void timer_output_mode (uint32_t timer, enum timer_output_modes mode)
 Selects the output mode. More...
 
void timer_output_level (uint32_t timer, enum timer_level level)
 Selects the initial output level. More...
 
void timer_edge_mode (uint32_t timer, enum timer_edge_modes mode)
 Selects the edge mode. More...
 
void timer_loop_mode (uint32_t timer, enum timer_loop_modes mode)
 Selects the loop mode. More...
 
void timer_clock_source (uint32_t timer, enum timer_clk_src src)
 Selects the clock source for the timer. More...
 
void timer_counter_target_value (uint32_t timer, uint32_t target)
 Sets the target values for counter mode. More...
 
void timer_pwm_target_value (uint32_t timer, uint16_t period0, uint16_t period1)
 Sets the target values for PWM mode. More...
 
void timer_int_enable (uint32_t timer, bool en)
 Enable or disable the interrupt. More...
 
void timer_int_mask (uint32_t timer, enum timer_int_masked masked)
 Sets the interrupt mask. More...
 
uint32_t timer_get_current_value (uint32_t timer)
 Gets the current counter value, and clears the interrupt/interrupt overflow. More...
 
uint32_t timer_get_cycle_width (uint32_t timer)
 Gets the cycle width. More...
 
uint32_t timer_get_pulse_width (uint32_t timer)
 Gets the pulse width in pulse capture mode, or gets the period width in duty cycle capture mode. More...
 
enum timer_pwm_period timer_get_pwm_period (uint32_t timer)
 Gets the current output period in PWM mode. More...
 
bool timer_int_status (uint32_t timer)
 Gets the interrupt status after masking. More...
 
bool timer_int_raw_status (uint32_t timer)
 Gets the interrupt status before masking. More...
 
bool timer_int_overflow_status (uint32_t timer)
 Gets the interrupt overflow status. More...