Paparazzi UAS  v4.0.4_stable-3-gf39211a
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
trigger_ext_hw.h
Go to the documentation of this file.
1 /*
2  * $Id$
3  *
4  * Copyright (C) 2010 Martin Mueller
5  *
6  * This file is part of paparazzi.
7  *
8  * paparazzi is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2, or (at your option)
11  * any later version.
12  *
13  * paparazzi is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with paparazzi; see the file COPYING. If not, write to
20  * the Free Software Foundation, 59 Temple Place - Suite 330,
21  * Boston, MA 02111-1307, USA.
22  *
23  */
24 
25 #ifndef TRIGGER_EXT_HW_H
26 #define TRIGGER_EXT_HW_H
27 
28 #include "core/trigger_ext.h"
29 
30 // Default trigger Pin is PPM pin (Tiny2/Twog)
31 // To use a custom trigger, you must set the flag USE_CUSTOM_TRIGGER
32 // and define:
33 // - PINSEL
34 // - PINSEL_VAL
35 // - PINSEL_BIT
36 // - input capture CHANNEL
37 #ifndef USE_CUSTOM_TRIGGER
38 #define TRIG_EXT_PINSEL PPM_PINSEL
39 #define TRIG_EXT_PINSEL_VAL PPM_PINSEL_VAL
40 #define TRIG_EXT_PINSEL_BIT PPM_PINSEL_BIT
41 #define TRIG_EXT_CHANNEL 2
42 #endif
43 
44 #define __SelectCapReg(_c) T0CR ## _c
45 #define _SelectCapReg(_c) __SelectCapReg(_c)
46 #define SelectCapReg(_c) _SelectCapReg(_c)
47 
48 #define __SetIntFlag(_c) TIR_CR ## _c ## I
49 #define _SetIntFlag(_c) __SetIntFlag(_c)
50 #define SetIntFlag(_c) _SetIntFlag(_c)
51 
52 #define __EnableRise(_c) TCCR_CR ## _c ## _R
53 #define _EnableRise(_c) __EnableRise(_c)
54 #define EnableRise(_c) _EnableRise(_c)
55 
56 #define __EnableFall(_c) TCCR_CR ## _c ## _F
57 #define _EnableFall(_c) __EnableFall(_c)
58 #define EnableFall(_c) _EnableFall(_c)
59 
60 #define __EnableInt(_c) TCCR_CR ## _c ## _I
61 #define _EnableInt(_c) __EnableInt(_c)
62 #define EnableInt(_c) _EnableInt(_c)
63 
64 #define TRIGGER_CR SelectCapReg(TRIG_EXT_CHANNEL)
65 #define TRIGGER_IT SetIntFlag(TRIG_EXT_CHANNEL)
66 #define TRIGGER_CRR EnableRise(TRIG_EXT_CHANNEL)
67 #define TRIGGER_CRF EnableFall(TRIG_EXT_CHANNEL)
68 #define TRIGGER_CRI EnableInt(TRIG_EXT_CHANNEL)
69 
70 /* Interrupt function called by sys_time_hw.c */
71 void TRIG_ISR(void);
72 
73 #endif /* TRIGGER_EXT_HW_H */
74 
void TRIG_ISR(void)