Paparazzi UAS  v5.0.5_stable-7-g4b8bbb7
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules 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 /* Default actuators driver */
90 #define DEFAULT_ACTUATORS "subsystems/actuators/actuators_4017.h"
91 #define ActuatorDefaultSet(_x,_y) Actuator4017Set(_x,_y)
92 #define ActuatorsDefaultInit() Actuators4017Init()
93 #define ActuatorsDefaultCommit() Actuators4017Commit()
94 
95 /* P0.5 aka MAT0.1 */
96 #define SERVO_CLOCK_PIN 5
97 #define SERVO_CLOCK_PINSEL PINSEL0
98 #define SERVO_CLOCK_PINSEL_VAL 0x02
99 #define SERVO_CLOCK_PINSEL_BIT 10
100 /* p1.20 */
101 #define SERVO_RESET_PIN 20
102 
103 /* PPM : rc rx on P0.6*/
104 #define PPM_PINSEL PINSEL0
105 #define PPM_PINSEL_VAL 0x02
106 #define PPM_PINSEL_BIT 12
107 #define PPM_CRI TIR_CR2I
108 #define PPM_CCR_CRF TCCR_CR2_F
109 #define PPM_CCR_CRR TCCR_CR2_R
110 #define PPM_CCR_CRI TCCR_CR2_I
111 #define PPM_CR T0CR2
112 
113 /* ADC */
114 
115 #define ADC_0 AdcBank1(6)
116 #ifdef USE_ADC_0
117 #ifndef USE_AD1
118 #define USE_AD1
119 #endif
120 #define USE_AD1_6
121 #endif
122 
123 #define ADC_1 AdcBank1(7)
124 #ifdef USE_ADC_1
125 #ifndef USE_AD1
126 #define USE_AD1
127 #endif
128 #define USE_AD1_7
129 #endif
130 
131 
132 #define ADC_2 AdcBank0(4)
133 #ifdef USE_ADC_2
134 #ifndef USE_AD0
135 #define USE_AD0
136 #endif
137 #define USE_AD0_4
138 #endif
139 
140 #define ADC_3 AdcBank0(6)
141 #ifdef USE_ADC_3
142 #ifndef USE_AD0
143 #define USE_AD0
144 #endif
145 #define USE_AD0_6
146 #endif
147 
148 #define ADC_4 AdcBank0(3)
149 #ifdef USE_ADC_4
150 #ifndef USE_AD0
151 #define USE_AD0
152 #endif
153 #define USE_AD0_3
154 #endif
155 
156 #define ADC_5 AdcBank0(2)
157 #ifdef USE_ADC_5
158 #ifndef USE_AD0
159 #define USE_AD0
160 #endif
161 #define USE_AD0_2
162 #endif
163 
164 #define ADC_6 AdcBank0(1)
165 #ifdef USE_ADC_6
166 #ifndef USE_AD0
167 #define USE_AD0
168 #endif
169 #define USE_AD0_1
170 #endif
171 
172 #define ADC_7 AdcBank1(3)
173 #ifdef USE_ADC_7
174 #ifndef USE_AD1
175 #define USE_AD1
176 #endif
177 #define USE_AD1_3
178 #endif
179 
180 /* allow to define ADC_CHANNEL_VSUPPLY in the airframe file*/
181 #ifndef ADC_CHANNEL_VSUPPLY
182 #define ADC_CHANNEL_VSUPPLY AdcBank1(5)
183 #ifndef USE_AD1
184 #define USE_AD1
185 #endif
186 #define USE_AD1_5
187 #endif
188 
189 
190 #define DefaultVoltageOfAdc(adc) (0.01787109375*adc)
191 
192 #define SPI_SELECT_SLAVE0_PORT 0
193 #define SPI_SELECT_SLAVE0_PIN 20
194 #define SPI_SELECT_SLAVE0_PINSEL PINSEL1
195 #define SPI_SELECT_SLAVE0_PINSEL_BIT 8
196 #define SPI_SELECT_SLAVE0_PINSEL_VAL 0
197 
198 #define SPI1_DRDY_PINSEL PINSEL1
199 #define SPI1_DRDY_PINSEL_BIT 0
200 #define SPI1_DRDY_PINSEL_VAL 1
201 #define SPI1_DRDY_EINT 0
202 #define SPI1_DRDY_VIC_IT VIC_EINT0
203 
204 
205 /* MAX1168 EOC pin (e.g. booz2 imu) */
206 #define MAX1168_EOC_PIN 16
207 #define MAX1168_EOC_PINSEL PINSEL1
208 #define MAX1168_EOC_PINSEL_BIT 0
209 #define MAX1168_EOC_PINSEL_VAL 1
210 #define MAX1168_EOC_EINT 0
211 #define MAX1168_EOC_VIC_IT VIC_EINT0
212 
213 #endif /* CONFIG_TINY_H */