Paparazzi UAS  v4.2.2_stable-4-gcc32f65
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
trig_ext_hw.c
Go to the documentation of this file.
1 
2 #include "std.h"
3 #include "mcu_periph/sys_time.hw.h"
4 #include "LPC21xx.h"
5 #include "trig_ext_hw.h"
6 #include BOARD_CONFIG
7 
10 volatile bool_t trig_ext_valid;
11 
12 
13 void TRIG_ISR() {
14  static uint32_t last;
15  uint32_t delta_t0_temp;
17  delta_t0_temp = trigger_t0 - last;
18  if (MSEC_OF_CPU_TICKS(delta_t0_temp) > 10) {
19  delta_t0 = delta_t0_temp;
20  last = trigger_t0;
22  }
23 }
24 
25 void trig_ext_init ( void ) {
26  /* select pin for capture */
28  /* enable capture 0.2 on falling or rising edge + trigger interrupt */
29 #if defined TRIG_EXT_PULSE_TYPE && TRIG_EXT_PULSE_TYPE == TRIG_EXT_PULSE_TYPE_RISING
31 #elif defined TRIG_EXT_PULSE_TYPE && TRIG_EXT_PULSE_TYPE == TRIG_EXT_PULSE_TYPE_FALLING
33 #else
34 #error "trig_ext_hw.h: Unknown PULSE_TYPE"
35 #endif
37 }
38 
#define T0CCR
Definition: LPC21xx.h:60
#define PPM_PINSEL_VAL
Definition: booz_1.0.h:64
#define PPM_PINSEL
Definition: booz_1.0.h:63
volatile bool_t trig_ext_valid
Definition: trig_ext_hw.c:10
#define PPM_CCR_CRI
Definition: booz_1.0.h:69
#define FALSE
Definition: imu_chimu.h:141
uint32_t delta_t0
Definition: trig_ext_hw.c:9
#define PPM_CR
Definition: booz_1.0.h:70
#define PPM_PINSEL_BIT
Definition: booz_1.0.h:65
unsigned long uint32_t
Definition: types.h:18
void TRIG_ISR()
Definition: trig_ext_hw.c:13
#define TRUE
Definition: imu_chimu.h:144
#define PPM_CCR_CRR
Definition: booz_1.0.h:68
void trig_ext_init(void)
Definition: trig_ext_hw.c:25
uint32_t trigger_t0
Definition: trig_ext_hw.c:8
#define MSEC_OF_CPU_TICKS(t)
Definition: sys_time_arch.h:65
#define PPM_CCR_CRF
Definition: booz_1.0.h:67