Paparazzi UAS  v5.2.2_stable-0-gd6b9f29
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 /* red */
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 /* green */
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 #define POWER_SWITCH_GPIO GPIOB,GPIO18
62 
63 #define CAM_SWITCH_GPIO GPIOB,GPIO22
64 
65 #define GPS_RESET_GPIO GPIOB,GPIO21
66 
67 #define Configure_GPS_RESET_Pin() gpio_setup_output(GPS_RESET_GPIO)
68 #define Set_GPS_RESET_Pin_LOW() gpio_clear(GPS_RESET_GPIO)
69 #define Open_GPS_RESET_Pin() gpio_setup_input(GPS_RESET_GPIO)
70 
71 /* Default actuators driver */
72 #define DEFAULT_ACTUATORS "subsystems/actuators/actuators_4017.h"
73 #define ActuatorDefaultSet(_x,_y) Actuator4017Set(_x,_y)
74 #define ActuatorsDefaultInit() Actuators4017Init()
75 #define ActuatorsDefaultCommit() Actuators4017Commit()
76 
77 /* P0.5 aka MAT0.1 */
78 #define SERVO_CLOCK_PIN 5
79 #define SERVO_CLOCK_PINSEL PINSEL0
80 #define SERVO_CLOCK_PINSEL_VAL 0x02
81 #define SERVO_CLOCK_PINSEL_BIT 10
82 /* p1.20 */
83 #define SERVO_RESET_PIN 20
84 
85 /* PPM : rc rx on P0.6*/
86 #define PPM_PINSEL PINSEL0
87 #define PPM_PINSEL_VAL 0x02
88 #define PPM_PINSEL_BIT 12
89 #define PPM_CRI TIR_CR2I
90 #define PPM_CCR_CRF TCCR_CR2_F
91 #define PPM_CCR_CRR TCCR_CR2_R
92 #define PPM_CCR_CRI TCCR_CR2_I
93 #define PPM_CR T0CR2
94 
95 /* ADC */
96 
97 #define ADC_0 AdcBank1(6)
98 #if USE_ADC_0
99 #ifndef USE_AD1
100 #define USE_AD1
101 #endif
102 #define USE_AD1_6
103 #endif
104 
105 #define ADC_1 AdcBank1(7)
106 #if USE_ADC_1
107 #ifndef USE_AD1
108 #define USE_AD1
109 #endif
110 #define USE_AD1_7
111 #endif
112 
113 
114 #define ADC_2 AdcBank0(4)
115 #if USE_ADC_2
116 #ifndef USE_AD0
117 #define USE_AD0
118 #endif
119 #define USE_AD0_4
120 #endif
121 
122 #define ADC_3 AdcBank0(6)
123 #if USE_ADC_3
124 #ifndef USE_AD0
125 #define USE_AD0
126 #endif
127 #define USE_AD0_6
128 #endif
129 
130 #define ADC_4 AdcBank0(3)
131 #if USE_ADC_4
132 #ifndef USE_AD0
133 #define USE_AD0
134 #endif
135 #define USE_AD0_3
136 #endif
137 
138 #define ADC_5 AdcBank0(2)
139 #if USE_ADC_5
140 #ifndef USE_AD0
141 #define USE_AD0
142 #endif
143 #define USE_AD0_2
144 #endif
145 
146 #define ADC_6 AdcBank0(1)
147 #if USE_ADC_6
148 #ifndef USE_AD0
149 #define USE_AD0
150 #endif
151 #define USE_AD0_1
152 #endif
153 
154 #define ADC_7 AdcBank1(3)
155 #if USE_ADC_7
156 #ifndef USE_AD1
157 #define USE_AD1
158 #endif
159 #define USE_AD1_3
160 #endif
161 
162 /* allow to define ADC_CHANNEL_VSUPPLY in the airframe file*/
163 #ifndef ADC_CHANNEL_VSUPPLY
164 #define ADC_CHANNEL_VSUPPLY AdcBank1(5)
165 #ifndef USE_AD1
166 #define USE_AD1
167 #endif
168 #define USE_AD1_5
169 #endif
170 
171 
172 #define DefaultVoltageOfAdc(adc) (0.01787109375*adc)
173 
174 #define SPI_SELECT_SLAVE0_PORT 0
175 #define SPI_SELECT_SLAVE0_PIN 20
176 #define SPI_SELECT_SLAVE0_PINSEL PINSEL1
177 #define SPI_SELECT_SLAVE0_PINSEL_BIT 8
178 #define SPI_SELECT_SLAVE0_PINSEL_VAL 0
179 
180 #define SPI1_DRDY_PINSEL PINSEL1
181 #define SPI1_DRDY_PINSEL_BIT 0
182 #define SPI1_DRDY_PINSEL_VAL 1
183 #define SPI1_DRDY_EINT 0
184 #define SPI1_DRDY_VIC_IT VIC_EINT0
185 
186 
187 /* MAX1168 EOC pin (e.g. booz2 imu) */
188 #define MAX1168_EOC_PIN 16
189 #define MAX1168_EOC_PINSEL PINSEL1
190 #define MAX1168_EOC_PINSEL_BIT 0
191 #define MAX1168_EOC_PINSEL_VAL 1
192 #define MAX1168_EOC_EINT 0
193 #define MAX1168_EOC_VIC_IT VIC_EINT0
194 
195 #endif /* CONFIG_TINY_H */