libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
|
Access functions for the Timer/Counter More...
Functions | |
uint32_t | timer_get_ticks (uint32_t timer) |
Get timer ticks. More... | |
void | timer_set_mode (uint32_t timer, enum timer_mode mode) |
Set timer mode (counter/timer) More... | |
void | timer_set_bitmode (uint32_t timer, enum timer_bitmode bitmode) |
Set timer bit mode (width) More... | |
void | timer_start (uint32_t timer) |
Start the timer. More... | |
void | timer_stop (uint32_t timer) |
Stop the timer. More... | |
void | timer_clear (uint32_t timer) |
Clear the timer. More... | |
void | timer_set_prescaler (uint32_t timer, uint8_t presc) |
Set prescaler value. More... | |
void | timer_set_compare (uint32_t timer, uint8_t compare_num, uint32_t compare_val) |
Set compare register. More... | |
uint32_t | timer_get_freq (uint32_t timer) |
Get the timer tick frequency. More... | |
uint32_t | timer_get_cc (uint32_t timer, uint8_t compare_num) |
Get compare register. More... | |
Access functions for the Timer/Counter
LGPL License Terms libopencm3 License
void timer_clear | ( | uint32_t | timer | ) |
Clear the timer.
[in] | timer | uint32_t timer base |
Definition at line 96 of file timer.c.
References PERIPH_TRIGGER_TASK, and TIMER_TASK_CLEAR.
uint32_t timer_get_cc | ( | uint32_t | timer, |
uint8_t | compare_num | ||
) |
uint32_t timer_get_freq | ( | uint32_t | timer | ) |
Get the timer tick frequency.
[in] | timer | uint32_t timer base |
Definition at line 131 of file timer.c.
References CLOCK_PCLK, and TIMER_PRESCALER.
uint32_t timer_get_ticks | ( | uint32_t | timer | ) |
Get timer ticks.
[in] | timer | uint32_t timer base |
Definition at line 41 of file timer.c.
References TIMER_CC, and TIMER_TASK_CAPTURE.
void timer_set_bitmode | ( | uint32_t | timer, |
enum timer_bitmode | bitmode | ||
) |
Set timer bit mode (width)
[in] | timer | uint32_t timer base |
[in] | bitmode | enum timer_bitmode |
Definition at line 69 of file timer.c.
References TIMER_BITMODE.
void timer_set_compare | ( | uint32_t | timer, |
uint8_t | compare_num, | ||
uint32_t | compare_val | ||
) |
void timer_set_mode | ( | uint32_t | timer, |
enum timer_mode | mode | ||
) |
Set timer mode (counter/timer)
[in] | timer | uint32_t timer base |
[in] | mode | enum timer_mode |
Definition at line 59 of file timer.c.
References TIMER_MODE.
void timer_set_prescaler | ( | uint32_t | timer, |
uint8_t | presc | ||
) |
Set prescaler value.
[in] | timer | uint32_t timer base |
[in] | presc | uint8_t prescaler value |
Definition at line 106 of file timer.c.
References TIMER_PRESCALER, and TIMER_PRESCALER_MASK.
void timer_start | ( | uint32_t | timer | ) |
Start the timer.
[in] | timer | uint32_t timer base |
Definition at line 78 of file timer.c.
References PERIPH_TRIGGER_TASK, and TIMER_TASK_START.
void timer_stop | ( | uint32_t | timer | ) |
Stop the timer.
[in] | timer | uint32_t timer base |
Definition at line 87 of file timer.c.
References PERIPH_TRIGGER_TASK, and TIMER_TASK_STOP.