NEORV32 - Software Framework Documentation
|
General purpose timer (GPTMR) HW driver header file. More...
Go to the source code of this file.
Data Structures | |
struct | neorv32_gptmr_t |
Functions | |
Prototypes | |
int | neorv32_gptmr_available (void) |
void | neorv32_gptmr_setup (int prsc, uint32_t threshold, int match_irq) |
void | neorv32_gptmr_capture (int rising, int falling, int filter, int capture_irq) |
void | neorv32_gptmr_disable (void) |
void | neorv32_gptmr_enable (void) |
int | neorv32_gptmr_trigger_matched (void) |
int | neorv32_gptmr_trigger_captured (void) |
void | neorv32_gptmr_restart (void) |
uint32_t | neorv32_gptmr_counter_get (void) |
uint32_t | neorv32_gptmr_capture_get (void) |
IO Device: General Purpose Timer (GPTMR) | |
#define | NEORV32_GPTMR ((neorv32_gptmr_t*) (NEORV32_GPTMR_BASE)) |
enum | NEORV32_GPTMR_CTRL_enum { GPTMR_CTRL_EN = 0 , GPTMR_CTRL_PRSC0 = 1 , GPTMR_CTRL_PRSC1 = 2 , GPTMR_CTRL_PRSC2 = 3 , GPTMR_CTRL_IRQM = 4 , GPTMR_CTRL_IRQC = 5 , GPTMR_CTRL_RISE = 6 , GPTMR_CTRL_FALL = 7 , GPTMR_CTRL_FILTER = 8 , GPTMR_CTRL_TRIGM = 30 , GPTMR_CTRL_TRIGC = 31 } |
General purpose timer (GPTMR) HW driver header file.
#define NEORV32_GPTMR ((neorv32_gptmr_t*) (NEORV32_GPTMR_BASE)) |
GPTMR module hardware access (neorv32_gptmr_t)
GPTMR control register bits
int neorv32_gptmr_available | ( | void | ) |
Check if general purpose timer unit was synthesized.
void neorv32_gptmr_capture | ( | int | rising, |
int | falling, | ||
int | filter, | ||
int | capture_irq ) |
Configure timer capture feature.
[in] | rising | Capture on rising edge. |
[in] | falling | Capture on falling edge. |
[in] | filter | Enable filtering of capture input. |
[in] | capture_irq | Fire interrupt when on capture trigger. |
uint32_t neorv32_gptmr_capture_get | ( | void | ) |
Get latest capture value.
uint32_t neorv32_gptmr_counter_get | ( | void | ) |
Get current counter value.
void neorv32_gptmr_disable | ( | void | ) |
Disable general purpose timer.
void neorv32_gptmr_enable | ( | void | ) |
Enable general purpose timer.
void neorv32_gptmr_restart | ( | void | ) |
Reset general purpose timer's counter register (timer-mode only).
void neorv32_gptmr_setup | ( | int | prsc, |
uint32_t | threshold, | ||
int | match_irq ) |
Reset, enable and configure general purpose timer.
[in] | prsc | Clock prescaler select (0..7). See NEORV32_CLOCK_PRSC_enum. |
[in] | threshold | Threshold value, counter will reset to zero when reaching this. |
[in] | match_irq | Fire interrupt when counter matches threshold value. |
int neorv32_gptmr_trigger_captured | ( | void | ) |
Check if capture input has triggered. Clear trigger flag in that case.
int neorv32_gptmr_trigger_matched | ( | void | ) |
Check if timer match has triggered. Clear trigger flag in that case.