Paparazzi UAS
v5.15_devel-230-gc96ce27
Paparazzi is a free software Unmanned Aircraft System.
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Modules
Pages
trig_ext_hw.c
Go to the documentation of this file.
1
2
#include "
std.h
"
3
#include "
mcu_periph/sys_time.h
"
4
#include "
LPC21xx.h
"
5
#include "
trig_ext_hw.h
"
6
#include BOARD_CONFIG
7
8
uint32_t
trigger_t0
;
9
uint32_t
delta_t0
;
10
volatile
bool
trig_ext_valid
;
11
12
13
void
TRIG_ISR
()
14
{
15
static
uint32_t
last
;
16
uint32_t
delta_t0_temp;
17
trigger_t0
=
PPM_CR
;
18
delta_t0_temp =
trigger_t0
-
last
;
19
if
(
msec_of_cpu_ticks
(delta_t0_temp) > 10) {
20
delta_t0
= delta_t0_temp;
21
last =
trigger_t0
;
22
trig_ext_valid
=
true
;
23
}
24
}
25
26
void
trig_ext_init
(
void
)
27
{
28
/* select pin for capture */
29
PPM_PINSEL
|=
PPM_PINSEL_VAL
<<
PPM_PINSEL_BIT
;
30
/* enable capture 0.2 on falling or rising edge + trigger interrupt */
31
#if defined TRIG_EXT_PULSE_TYPE && TRIG_EXT_PULSE_TYPE == TRIG_EXT_PULSE_TYPE_RISING
32
T0CCR
|=
PPM_CCR_CRR
|
PPM_CCR_CRI
;
33
#elif defined TRIG_EXT_PULSE_TYPE && TRIG_EXT_PULSE_TYPE == TRIG_EXT_PULSE_TYPE_FALLING
34
T0CCR
|=
PPM_CCR_CRF
|
PPM_CCR_CRI
;
35
#else
36
#error "trig_ext_hw.h: Unknown PULSE_TYPE"
37
#endif
38
trig_ext_valid
=
false
;
39
}
40
msec_of_cpu_ticks
static uint32_t msec_of_cpu_ticks(uint32_t cpu_ticks)
Definition:
sys_time.h:193
T0CCR
#define T0CCR
Definition:
LPC21xx.h:60
PPM_PINSEL_VAL
#define PPM_PINSEL_VAL
Definition:
booz_1.0.h:51
PPM_PINSEL
#define PPM_PINSEL
Definition:
booz_1.0.h:50
PPM_CCR_CRI
#define PPM_CCR_CRI
Definition:
booz_1.0.h:56
trig_ext_valid
volatile bool trig_ext_valid
Definition:
trig_ext_hw.c:10
delta_t0
uint32_t delta_t0
Definition:
trig_ext_hw.c:9
PPM_CR
#define PPM_CR
Definition:
booz_1.0.h:57
sys_time.h
Architecture independent timing functions.
PPM_PINSEL_BIT
#define PPM_PINSEL_BIT
Definition:
booz_1.0.h:52
uint32_t
unsigned long uint32_t
Definition:
types.h:18
std.h
TRIG_ISR
void TRIG_ISR()
Definition:
trig_ext_hw.c:13
last
uint32_t last
Definition:
rng_arch.c:31
PPM_CCR_CRR
#define PPM_CCR_CRR
Definition:
booz_1.0.h:55
trig_ext_init
void trig_ext_init(void)
Definition:
trig_ext_hw.c:26
LPC21xx.h
trigger_t0
uint32_t trigger_t0
Definition:
trig_ext_hw.c:8
trig_ext_hw.h
PPM_CCR_CRF
#define PPM_CCR_CRF
Definition:
booz_1.0.h:54
sw
airborne
arch
lpc21
modules
sensors
trig_ext_hw.c
Generated on Wed Feb 10 2021 04:33:54 for Paparazzi UAS by
1.8.8