Paparazzi UAS  v5.15_devel-230-gc96ce27
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules 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 #define POWER_SWITCH_GPIO GPIOB,GPIO18
61 
62 #define CAM_SWITCH_GPIO GPIOB,GPIO22
63 
64 #define GPS_RESET_GPIO GPIOB,GPIO21
65 
66 #define Configure_GPS_RESET_Pin() gpio_setup_output(GPS_RESET_GPIO)
67 #define Set_GPS_RESET_Pin_LOW() gpio_clear(GPS_RESET_GPIO)
68 #define Open_GPS_RESET_Pin() gpio_setup_input(GPS_RESET_GPIO)
69 
70 /* P0.5 aka MAT0.1 */
71 #define SERVO_CLOCK_PIN 5
72 #define SERVO_CLOCK_PINSEL PINSEL0
73 #define SERVO_CLOCK_PINSEL_VAL 0x02
74 #define SERVO_CLOCK_PINSEL_BIT 10
75 /* p1.20 */
76 #define SERVO_RESET_PIN 20
77 
78 /* PPM : rc rx on P0.6*/
79 #define PPM_PINSEL PINSEL0
80 #define PPM_PINSEL_VAL 0x02
81 #define PPM_PINSEL_BIT 12
82 #define PPM_CRI TIR_CR2I
83 #define PPM_CCR_CRF TCCR_CR2_F
84 #define PPM_CCR_CRR TCCR_CR2_R
85 #define PPM_CCR_CRI TCCR_CR2_I
86 #define PPM_CR T0CR2
87 
88 /* ADC */
89 
90 #define ADC_0 AdcBank1(6)
91 #if USE_ADC_0
92 #ifndef USE_AD1
93 #define USE_AD1
94 #endif
95 #define USE_AD1_6
96 #endif
97 
98 #define ADC_1 AdcBank1(7)
99 #if USE_ADC_1
100 #ifndef USE_AD1
101 #define USE_AD1
102 #endif
103 #define USE_AD1_7
104 #endif
105 
106 
107 #define ADC_2 AdcBank0(4)
108 #if USE_ADC_2
109 #ifndef USE_AD0
110 #define USE_AD0
111 #endif
112 #define USE_AD0_4
113 #endif
114 
115 #define ADC_3 AdcBank0(6)
116 #if USE_ADC_3
117 #ifndef USE_AD0
118 #define USE_AD0
119 #endif
120 #define USE_AD0_6
121 #endif
122 
123 #define ADC_4 AdcBank0(3)
124 #if USE_ADC_4
125 #ifndef USE_AD0
126 #define USE_AD0
127 #endif
128 #define USE_AD0_3
129 #endif
130 
131 #define ADC_5 AdcBank0(2)
132 #if USE_ADC_5
133 #ifndef USE_AD0
134 #define USE_AD0
135 #endif
136 #define USE_AD0_2
137 #endif
138 
139 #define ADC_6 AdcBank0(1)
140 #if USE_ADC_6
141 #ifndef USE_AD0
142 #define USE_AD0
143 #endif
144 #define USE_AD0_1
145 #endif
146 
147 #define ADC_7 AdcBank1(3)
148 #if USE_ADC_7
149 #ifndef USE_AD1
150 #define USE_AD1
151 #endif
152 #define USE_AD1_3
153 #endif
154 
155 /* allow to define ADC_CHANNEL_VSUPPLY in the airframe file*/
156 #ifndef ADC_CHANNEL_VSUPPLY
157 #define ADC_CHANNEL_VSUPPLY AdcBank1(5)
158 #ifndef USE_AD1
159 #define USE_AD1
160 #endif
161 #define USE_AD1_5
162 #endif
163 
164 
165 #define DefaultVoltageOfAdc(adc) (0.01787109375*adc)
166 
167 #define SPI_SELECT_SLAVE0_PORT 0
168 #define SPI_SELECT_SLAVE0_PIN 20
169 
170 #define SPI1_DRDY_PINSEL PINSEL1
171 #define SPI1_DRDY_PINSEL_BIT 0
172 #define SPI1_DRDY_PINSEL_VAL 1
173 #define SPI1_DRDY_EINT 0
174 #define SPI1_DRDY_VIC_IT VIC_EINT0
175 
176 /* micro SD connected to SPI0 */
177 #define SPI_CHANNEL 0
178 
179 /************ BANK 0 *************/
180 
181 /* STOP button P0.3 */
182 #define LOG_STOP_KEY 29
183 
184 /* POWER DETECT 5V P0.10 */
185 #define POWER_DETECT_PIN 10
186 
187 /************ BANK 1 *************/
188 
189 /* STOP button P1.20 */
190 #define CARD_DETECT_PIN 20
191 
192 
193 #define LED_GREEN 3
194 #define LED_YELLOW 2
195 #define LED_RED 1
196 
197 
198 #endif /* CONFIG_SD_LOGGER_PPRZ_H */