libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
|
#include <libopencm3/cm3/common.h>
#include <libopencm3/nrf/memorymap.h>
#include <libopencm3/nrf/periph.h>
Go to the source code of this file.
Macros | |
#define | TIMER0 TIMER0_BASE |
#define | TIMER1 TIMER1_BASE |
#define | TIMER2 TIMER2_BASE |
#define | TIMER_TASK_START(T) MMIO32((T) + 0x000) |
#define | TIMER_TASK_STOP(T) MMIO32((T) + 0x004) |
#define | TIMER_TASK_COUNT(T) MMIO32((T) + 0x008) |
#define | TIMER_TASK_CLEAR(T) MMIO32((T) + 0x00C) |
#define | TIMER_TASK_SHUTDOWN(T) MMIO32((T) + 0x010) |
#define | TIMER_TASK_CAPTURE(T, C) MMIO32((T) + 0x040 + (uint32_t)(0x4 * (C))) |
#define | TIMER_EVENT_COMPARE(T, C) MMIO32((T) + 0x140 + (uint32_t)(0x4 * (C))) |
#define | TIMER_SHORTS(T) _PERIPH_SHORTS(T) |
#define | TIMER_INTENSET(T) _PERIPH_INTENSET(T) |
#define | TIMER_INTENCLR(T) _PERIPH_INTENCLR(T) |
#define | TIMER_MODE(T) MMIO32((T) + 0x504) |
#define | TIMER_BITMODE(T) MMIO32((T) + 0x508) |
#define | TIMER_PRESCALER(T) MMIO32((T) + 0x510) |
#define | TIMER_PRESCALER_MASK (0xf) |
#define | TIMER_CC(T, C) MMIO32((T) + 0x540 + 0x4 * (C)) |
#define | TIMER_SHORTS_COMPARE_CLEAR(C) (1 << (C)) |
#define | TIMER_SHORTS_COMPARE_STOP(C) (1 << (8 + (C))) |
#define | TIMER_INTEN_COMPARE(C) (1 << (16 + (C))) |
#define | TIMER_MODE_SELECT (1 << 0) |
Enumerations | |
enum | timer_mode { TIMER_MODE_TIMER , TIMER_MODE_COUNTER } |
enum | timer_bitmode { TIMER_BITMODE_16BIT , TIMER_BITMODE_08BIT , TIMER_BITMODE_24BIT , TIMER_BITMODE_32BIT } |
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_cc (uint32_t timer, uint8_t compare_num) |
Get compare register. More... | |
uint32_t | timer_get_freq (uint32_t timer) |
Get the timer tick frequency. More... | |