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_sim.h
Go to the documentation of this file.
1 #ifndef CONFIG_TINY_H
2 #define CONFIG_TINY_H
3 
4 /* Master oscillator freq. */
5 #define FOSC (12000000)
6 
7 /* PLL multiplier */
8 #define PLL_MUL (5)
9 
10 /* CPU clock freq. */
11 #define CCLK (FOSC * PLL_MUL)
12 
13 /* Peripheral bus speed mask 0x00->4, 0x01-> 1, 0x02 -> 2 */
14 #define PBSD_BITS 0x00
15 #define PBSD_VAL 4
16 
17 /* Peripheral bus clock freq. */
18 #define PCLK (CCLK / PBSD_VAL)
19 
20 #ifndef USE_LED_1
21 #define USE_LED_1 1
22 #endif
23 #define LED_1_BANK 1
24 #define LED_1_PIN 28
25 
26 #ifndef USE_LED_2
27 #define USE_LED_2 1
28 #endif
29 #define LED_2_BANK 1
30 #define LED_2_PIN 19
31 
32 /* p0.21 aka PWM5 */
33 #define SERV0_CLOCK_PIN 21
34 #define SERV0_CLOCK_PINSEL PINSEL1
35 #define SERV0_CLOCK_PINSEL_VAL 0x01
36 #define SERV0_CLOCK_PINSEL_BIT 10
37 /* p1.20 */
38 #define SERV0_DATA_PIN 20
39 /* p1.21 */
40 #define SERV0_RESET_PIN 21
41 
42 /* P0.7 aka PWM2 */
43 #define SERV1_CLOCK_PIN 7
44 #define SERV1_CLOCK_PINSEL PINSEL0
45 #define SERV1_CLOCK_PINSEL_VAL 0x02
46 #define SERV1_CLOCK_PINSEL_BIT 14
47 /* p1.30 */
48 #define SERV1_DATA_PIN 30
49 /* p1.29 */
50 #define SERV1_RESET_PIN 29
51 
52 /* PPM : rc rx on P0.6*/
53 #define PPM_PINSEL PINSEL0
54 #define PPM_PINSEL_VAL 0x02
55 #define PPM_PINSEL_BIT 12
56 #define PPM_CRI TIR_CR2I
57 #define PPM_CCR_CRF TCCR_CR2_F
58 #define PPM_CCR_CRR TCCR_CR2_R
59 #define PPM_CCR_CRI TCCR_CR2_I
60 #define PPM_CR T0CR2
61 
62 /* ADC */
63 
64 #define ADC_0 AdcBank0(3)
65 #ifdef USE_ADC_0
66 #ifndef USE_AD0
67 #define USE_AD0
68 #endif
69 #define USE_AD0_3
70 #endif
71 
72 #define ADC_1 AdcBank0(2)
73 #ifdef USE_ADC_1
74 #ifndef USE_AD0
75 #define USE_AD0
76 #endif
77 #define USE_AD0_2
78 #endif
79 
80 
81 #define ADC_2 AdcBank0(1)
82 #ifdef USE_ADC_2
83 #ifndef USE_AD0
84 #define USE_AD0
85 #endif
86 #define USE_AD0_1
87 #endif
88 
89 #define ADC_3 AdcBank0(6)
90 #ifdef USE_ADC_3
91 #ifndef USE_AD0
92 #define USE_AD0
93 #endif
94 #define USE_AD0_6
95 #endif
96 
97 
98 #define ADC_4 AdcBank1(3)
99 #ifdef USE_ADC_4
100 #ifndef USE_AD1
101 #define USE_AD1
102 #endif
103 #define USE_AD1_3
104 #endif
105 
106 #define ADC_5 AdcBank1(4)
107 #ifdef USE_ADC_5
108 #ifndef USE_AD1
109 #define USE_AD1
110 #endif
111 #define USE_AD1_4
112 #endif
113 
114 #define ADC_6 AdcBank1(5)
115 #ifdef USE_ADC_6
116 #ifndef USE_AD1
117 #define USE_AD1
118 #endif
119 #define USE_AD1_5
120 #endif
121 
122 #define ADC_7 AdcBank1(2)
123 #ifdef USE_ADC_7
124 #ifndef USE_AD1
125 #define USE_AD1
126 #endif
127 #define USE_AD1_2
128 #endif
129 
130 /* #define ADC_3 AdcBank1(7) Used for VSUPPLY */
131 /* allow to define ADC_CHANNEL_VSUPPLY in the airframe file*/
132 #ifndef ADC_CHANNEL_VSUPPLY
133 #define ADC_CHANNEL_VSUPPLY AdcBank1(7)
134 #ifndef USE_AD1
135 #define USE_AD1
136 #endif
137 #define USE_AD1_7
138 #endif
139 
140 
141 #define DefaultVoltageOfAdc(adc) (0.01787109375*adc)
142 
143 
144 #endif /* CONFIG_TINY_H */