d_timer.h
Go to the documentation of this file.
1 #ifndef _D_TIMER_H_
2 #define _D_TIMER_H_
3 #ifdef __cplusplus
4 extern "C" {
5 #endif
6 
7 #ifdef NDEBUG
8 
9 // enable additional timer interrupts, release mode only, makes debugging impossible
10 #define ENABLE_TC_WAVEFORM_INTERRUPT
11 #define ENABLE_TC_CAPTURE_INTERRUPT
12 
13 #endif
14 
15 // NOTE: TC2_IRQn is the IRQ id for TC0 channel 2 not for TC2
16 // see datasheet table on "peripheral identifiers"
17 
18 #define TC_SAMPLE_SENSORS_CHANNEL 0
19 #define TC_SAMPLE_SENSORS_ID ID_TC0
20 #define TC_SAMPLE_SENSORS_HANDLER TC0_Handler
21 #define TC_SAMPLE_SENSORS_IRQn TC0_IRQn
22 #define TC_SAMPLE_SENSORS_RATE_HZ 8000
23 
24 // according to SAMS70 doc 46.5.1
25 // PA15 & PA16 (GPS# TPULSE) are on channel 1
26 #define TC_TIME_SYNC_CHANNEL 1
27 #define TC_TIME_SYNC_ID ID_TC1
28 #define TC_TIME_SYNC_HANDLER TC1_Handler
29 #define TC_TIME_SYNC_IRQn TC1_IRQn
30 #define TC_TIME_SYNC_IER_MASK TC_IER_LDRAS
31 //#define TC_TIME_SYNC_IER_MASK TC_IER_ETRGS
32 
33 //#define TC_TIME_SYNC_TICKS_TO_SEC (0.000030517578125) // 1/32768 based on SLCK
34 #define TC_TIME_SYNC_TICKS_TO_SEC (5.3333333333333333333333333333333e-8) // 8/150,000,000 based on MCK/8
35 
36 #define TC_TIME_BASE_ID ID_TC9
37 #define TC_TIME_CHANNEL 2
38 #define TC_TIME_HANDLER TC9_Handler
39 #define TC_TIME_IRQn TC9_IRQn
40 
41 // typedefs
42 typedef struct
43 {
45  uint32_t ul_intclock;
47  uint32_t us_frequency;
49  uint16_t us_dutycycle;
50 } waveconfig_t;
51 
52 // prototypes
53 void timer_waveform_init(unsigned int channel, void (*func)(void));
54 void timer_capture_init(void);
55 int timer_capture_enable(void);
56 int timer_capture_disable(void);
57 uint32_t timer_captured(void);
58 void timer_time_init(void);
59 volatile uint64_t time_cv(void);
60 
61 #ifdef __cplusplus
62 }
63 #endif
64 #endif // _D_TIMER_H_
uint32_t us_frequency
Definition: d_timer.h:47
void timer_waveform_init(unsigned int channel, void(*func)(void))
Definition: d_timer.c:105
void timer_time_init(void)
Definition: d_timer.c:322
int timer_capture_enable(void)
Definition: d_timer.c:192
uint16_t us_dutycycle
Definition: d_timer.h:49
volatile uint64_t time_cv(void)
Definition: d_timer.c:284
int timer_capture_disable(void)
Definition: d_timer.c:206
void timer_capture_init(void)
Definition: d_timer.c:220
uint32_t timer_captured(void)
Definition: d_timer.c:258
uint32_t ul_intclock
Definition: d_timer.h:45


inertial_sense_ros
Author(s):
autogenerated on Sun Feb 28 2021 03:17:57