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