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
sdlog_1.0.h
Go to the documentation of this file.
1 /* board definition file for Paparazzi SD-Logger v1.0 */
2 
3 #ifndef CONFIG_SD_LOGGER_PPRZ_H
4 #define CONFIG_SD_LOGGER_PPRZ_H
5 
6 #ifdef SITL
7 /* Dummy definitions: adc are unused anyway */
8 #define AdcBank0(x) (x)
9 #define AdcBank1(x) (x)
10 #endif /* SITL */
11 
12 /* Master oscillator freq. */
13 #define FOSC (12000000)
14 
15 /* PLL multiplier */
16 #define PLL_MUL (5)
17 
18 /* CPU clock freq. */
19 #define CCLK (FOSC * PLL_MUL)
20 
21 /* current @7V, Tiny2.11, Funjet4, no LED
22  PCLK max min
23  15MHz 99mA 92mA
24  30MHz 105mA 98mA
25  60MHz 116mA 108mA
26 */
27 
28 #ifdef USE_USB_HIGH_PCLK
29 /* Peripheral bus speed mask 0x00-> 4, 0x01-> 1, 0x02-> 2 */
30 /* change both PBSD_BITS/VAL 15MHz, 60MHz, 30MHz */
31 #define PBSD_BITS 0x02
32 #define PBSD_VAL 2
33 #else
34 /* Peripheral bus speed mask 0x00->4, 0x01-> 1, 0x02 -> 2 */
35 #define PBSD_BITS 0x00
36 #define PBSD_VAL 4
37 #endif
38 
39 /* Peripheral bus clock freq. */
40 #define PCLK (CCLK / PBSD_VAL)
41 
42 #ifndef USE_LED_1
43 #define USE_LED_1 1
44 #endif
45 #define LED_1_BANK 1
46 #define LED_1_PIN 17
47 
48 #ifndef USE_LED_2
49 #define USE_LED_2 1
50 #endif
51 #define LED_2_BANK 1
52 #define LED_2_PIN 16
53 
54 #ifndef USE_LED_3
55 #define USE_LED_3 1
56 #endif
57 #define LED_3_BANK 1
58 #define LED_3_PIN 23
59 
60 #ifndef USE_LED_4
61 #define USE_LED_4 1
62 #endif
63 #define LED_4_BANK 1
64 #define LED_4_PIN 18
65 
66 #define POWER_SWITCH_LED 4
67 
68 #ifndef USE_LED_5
69 #define USE_LED_5 1
70 #endif
71 #define LED_5_BANK 1
72 #define LED_5_PIN 22
73 
74 #define CAM_SWITCH_LED 5
75 
76 #ifndef USE_LED_6
77 #define USE_LED_6 1
78 #endif
79 #define LED_6_BANK 1
80 #define LED_6_PIN 21
81 
82 #define GPS_RESET 6
83 
84 #define Configure_GPS_RESET_Pin() LED_INIT(GPS_RESET)
85 #define Set_GPS_RESET_Pin_LOW() LED_ON(GPS_RESET)
86 #define Open_GPS_RESET_Pin() ClearBit(LED_DIR(GPS_RESET), LED_PIN(GPS_RESET))
87 
88 /* P0.5 aka MAT0.1 */
89 #define SERVO_CLOCK_PIN 5
90 #define SERVO_CLOCK_PINSEL PINSEL0
91 #define SERVO_CLOCK_PINSEL_VAL 0x02
92 #define SERVO_CLOCK_PINSEL_BIT 10
93 /* p1.20 */
94 #define SERVO_RESET_PIN 20
95 
96 /* PPM : rc rx on P0.6*/
97 #define PPM_PINSEL PINSEL0
98 #define PPM_PINSEL_VAL 0x02
99 #define PPM_PINSEL_BIT 12
100 #define PPM_CRI TIR_CR2I
101 #define PPM_CCR_CRF TCCR_CR2_F
102 #define PPM_CCR_CRR TCCR_CR2_R
103 #define PPM_CCR_CRI TCCR_CR2_I
104 #define PPM_CR T0CR2
105 
106 /* ADC */
107 
108 #define ADC_0 AdcBank1(6)
109 #ifdef USE_ADC_0
110 #ifndef USE_AD1
111 #define USE_AD1
112 #endif
113 #define USE_AD1_6
114 #endif
115 
116 #define ADC_1 AdcBank1(7)
117 #ifdef USE_ADC_1
118 #ifndef USE_AD1
119 #define USE_AD1
120 #endif
121 #define USE_AD1_7
122 #endif
123 
124 
125 #define ADC_2 AdcBank0(4)
126 #ifdef USE_ADC_2
127 #ifndef USE_AD0
128 #define USE_AD0
129 #endif
130 #define USE_AD0_4
131 #endif
132 
133 #define ADC_3 AdcBank0(6)
134 #ifdef USE_ADC_3
135 #ifndef USE_AD0
136 #define USE_AD0
137 #endif
138 #define USE_AD0_6
139 #endif
140 
141 #define ADC_4 AdcBank0(3)
142 #ifdef USE_ADC_4
143 #ifndef USE_AD0
144 #define USE_AD0
145 #endif
146 #define USE_AD0_3
147 #endif
148 
149 #define ADC_5 AdcBank0(2)
150 #ifdef USE_ADC_5
151 #ifndef USE_AD0
152 #define USE_AD0
153 #endif
154 #define USE_AD0_2
155 #endif
156 
157 #define ADC_6 AdcBank0(1)
158 #ifdef USE_ADC_6
159 #ifndef USE_AD0
160 #define USE_AD0
161 #endif
162 #define USE_AD0_1
163 #endif
164 
165 #define ADC_7 AdcBank1(3)
166 #ifdef USE_ADC_7
167 #ifndef USE_AD1
168 #define USE_AD1
169 #endif
170 #define USE_AD1_3
171 #endif
172 
173 /* allow to define ADC_CHANNEL_VSUPPLY in the airframe file*/
174 #ifndef ADC_CHANNEL_VSUPPLY
175 #define ADC_CHANNEL_VSUPPLY AdcBank1(5)
176 #ifndef USE_AD1
177 #define USE_AD1
178 #endif
179 #define USE_AD1_5
180 #endif
181 
182 
183 #define DefaultVoltageOfAdc(adc) (0.01787109375*adc)
184 
185 #define SPI_SELECT_SLAVE0_PORT 0
186 #define SPI_SELECT_SLAVE0_PIN 20
187 
188 #define SPI1_DRDY_PINSEL PINSEL1
189 #define SPI1_DRDY_PINSEL_BIT 0
190 #define SPI1_DRDY_PINSEL_VAL 1
191 #define SPI1_DRDY_EINT 0
192 #define SPI1_DRDY_VIC_IT VIC_EINT0
193 
194 /* micro SD connected to SPI0 */
195 #define SPI_CHANNEL 0
196 
197 /************ BANK 0 *************/
198 
199 /* STOP button P0.3 */
200 #define LOG_STOP_KEY 29
201 
202 /* POWER DETECT 5V P0.10 */
203 #define POWER_DETECT_PIN 10
204 
205 /************ BANK 1 *************/
206 
207 /* STOP button P1.20 */
208 #define CARD_DETECT_PIN 20
209 
210 
211 #define LED_GREEN 3
212 #define LED_YELLOW 2
213 #define LED_RED 1
214 
215 
216 #endif /* CONFIG_SD_LOGGER_PPRZ_H */