Merged in f5soh/librepilot/update_credits (pull request #529)
[librepilot.git] / flight / targets / boards / gpsplatinum / pios_board.h
blobf3ee604ceca6d3463ef0b1e00356296fd6084900
1 /**
2 ******************************************************************************
4 * @file pios_board.h
5 * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
6 * @brief Defines board hardware for the OpenPilot Version 1.1 hardware.
7 * @see The GNU Public License (GPL) Version 3
9 *****************************************************************************/
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 3 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
18 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19 * for more details.
21 * You should have received a copy of the GNU General Public License along
22 * with this program; if not, write to the Free Software Foundation, Inc.,
23 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #ifndef PIOS_BOARD_H
27 #define PIOS_BOARD_H
28 // ------------------------
29 // Timers and Channels Used
30 // ------------------------
32 Timer | Channel 1 | Channel 2 | Channel 3 | Channel 4
33 ------+-----------+-----------+-----------+----------
34 TIM1 | Servo 4 | | |
35 TIM2 | RC In 5 | RC In 6 | Servo 6 |
36 TIM3 | Servo 5 | RC In 2 | RC In 3 | RC In 4
37 TIM4 | RC In 1 | Servo 3 | Servo 2 | Servo 1
38 ------+-----------+-----------+-----------+----------
41 // ------------------------
42 // DMA Channels Used
43 // ------------------------
44 /* Channel 1 - */
45 /* Channel 2 - */
46 /* Channel 3 - */
47 /* Channel 4 - */
48 /* Channel 5 - */
49 /* Channel 6 - */
50 /* Channel 7 - */
51 /* Channel 8 - */
52 /* Channel 9 - */
53 /* Channel 10 - */
54 /* Channel 11 - */
55 /* Channel 12 - */
57 // ------------------------
58 // BOOTLOADER_SETTINGS
59 // ------------------------
60 #define BOARD_READABLE true
61 #define BOARD_WRITABLE true
62 #define MAX_DEL_RETRYS 3
64 // ------------------------
65 // WATCHDOG_SETTINGS
66 // ------------------------
67 #define PIOS_WATCHDOG_TIMEOUT 400
68 #define PIOS_WDG_REGISTER RTC_BKP_DR4
69 #define PIOS_WDG_SYSTEM 0x0001
70 #define PIOS_WDG_GPS 0x0002
71 #define PIOS_WDG_MAG 0x0004
73 // ------------------------
74 // TELEMETRY
75 // ------------------------
76 // #define TELEM_QUEUE_SIZE 20
78 // ------------------------
79 // PIOS_LED
80 // ------------------------
81 #define PIOS_LED_HEARTBEAT 0
83 // -------------------------
84 // System Settings
85 // -------------------------
86 #define PIOS_MASTER_CLOCK 48000000
87 #define PIOS_PERIPHERAL_CLOCK (PIOS_MASTER_CLOCK / 2)
89 // -------------------------
90 // Interrupt Priorities
91 // -------------------------
92 #define PIOS_IRQ_PRIO_LOW 12 // lower than RTOS
93 #define PIOS_IRQ_PRIO_MID 8 // higher than RTOS
94 #define PIOS_IRQ_PRIO_HIGH 5 // for SPI, ADC, I2C etc...
95 #define PIOS_IRQ_PRIO_HIGHEST 4 // for USART etc...
96 // ------------------------
97 // PIOS_I2C
98 // See also pios_board.c
99 // ------------------------
100 #define PIOS_I2C_MAX_DEVS 1
101 extern uint32_t pios_i2c_gps_id;
102 #define PIOS_I2C_GPS (pios_i2c_gps_id)
104 // -------------------------
105 // SPI
107 // See also pios_board.c
108 // -------------------------
109 #define PIOS_SPI_MAX_DEVS 0
111 // -------------------------
112 // PIOS_USART
113 // -------------------------
114 #define PIOS_USART_MAX_DEVS 1
116 // -------------------------
117 // PIOS_COM
119 // See also pios_board.c
120 // -------------------------
121 #define PIOS_COM_MAX_DEVS 1
122 extern uint32_t pios_com_main_id;
123 #define PIOS_COM_TELEM_USB pios_com_main_id
124 #if defined(PIOS_INCLUDE_DEBUG_CONSOLE)
126 #define PIOS_COM_DEBUG (pios_com_main_id)
127 #endif /* PIOS_INCLUDE_DEBUG_CONSOLE */
129 // -------------------------
130 // ADC
131 // PIOS_ADC_PinGet(0) = Gyro Z
132 // PIOS_ADC_PinGet(1) = Gyro Y
133 // PIOS_ADC_PinGet(2) = Gyro X
134 // -------------------------
135 // #define PIOS_ADC_OVERSAMPLING_RATE 1
136 #if 0
137 #define PIOS_ADC_USE_TEMP_SENSOR 1
138 #define PIOS_ADC_TEMP_SENSOR_ADC ADC1
139 #define PIOS_ADC_TEMP_SENSOR_ADC_CHANNEL 1
141 #define PIOS_ADC_PIN1_GPIO_PORT GPIOA // PA4 (Gyro X)
142 #define PIOS_ADC_PIN1_GPIO_PIN GPIO_Pin_4 // ADC12_IN4
143 #define PIOS_ADC_PIN1_GPIO_CHANNEL ADC_Channel_4
144 #define PIOS_ADC_PIN1_ADC ADC2
145 #define PIOS_ADC_PIN1_ADC_NUMBER 1
147 #define PIOS_ADC_PIN2_GPIO_PORT GPIOA // PA5 (Gyro Y)
148 #define PIOS_ADC_PIN2_GPIO_PIN GPIO_Pin_5 // ADC123_IN5
149 #define PIOS_ADC_PIN2_GPIO_CHANNEL ADC_Channel_5
150 #define PIOS_ADC_PIN2_ADC ADC1
151 #define PIOS_ADC_PIN2_ADC_NUMBER 2
153 #define PIOS_ADC_PIN3_GPIO_PORT GPIOA // PA3 (Gyro Z)
154 #define PIOS_ADC_PIN3_GPIO_PIN GPIO_Pin_3 // ADC12_IN3
155 #define PIOS_ADC_PIN3_GPIO_CHANNEL ADC_Channel_3
156 #define PIOS_ADC_PIN3_ADC ADC2
157 #define PIOS_ADC_PIN3_ADC_NUMBER 2
159 #define PIOS_ADC_NUM_PINS 3
161 #define PIOS_ADC_PORTS { PIOS_ADC_PIN1_GPIO_PORT, PIOS_ADC_PIN2_GPIO_PORT, PIOS_ADC_PIN3_GPIO_PORT }
162 #define PIOS_ADC_PINS { PIOS_ADC_PIN1_GPIO_PIN, PIOS_ADC_PIN2_GPIO_PIN, PIOS_ADC_PIN3_GPIO_PIN }
163 #define PIOS_ADC_CHANNELS { PIOS_ADC_PIN1_GPIO_CHANNEL, PIOS_ADC_PIN2_GPIO_CHANNEL, PIOS_ADC_PIN3_GPIO_CHANNEL }
164 #define PIOS_ADC_MAPPING { PIOS_ADC_PIN1_ADC, PIOS_ADC_PIN2_ADC, PIOS_ADC_PIN3_ADC }
165 #define PIOS_ADC_CHANNEL_MAPPING { PIOS_ADC_PIN1_ADC_NUMBER, PIOS_ADC_PIN2_ADC_NUMBER, PIOS_ADC_PIN3_ADC_NUMBER }
166 #define PIOS_ADC_NUM_CHANNELS (PIOS_ADC_NUM_PINS + PIOS_ADC_USE_TEMP_SENSOR)
167 #define PIOS_ADC_NUM_ADC_CHANNELS 2
168 #define PIOS_ADC_USE_ADC2 1
169 #define PIOS_ADC_CLOCK_FUNCTION RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1 | RCC_APB2Periph_ADC2, ENABLE)
170 #define PIOS_ADC_ADCCLK RCC_PCLK2_Div8
171 /* RCC_PCLK2_Div2: ADC clock = PCLK2/2 */
172 /* RCC_PCLK2_Div4: ADC clock = PCLK2/4 */
173 /* RCC_PCLK2_Div6: ADC clock = PCLK2/6 */
174 /* RCC_PCLK2_Div8: ADC clock = PCLK2/8 */
175 #define PIOS_ADC_SAMPLE_TIME ADC_SampleTime_239Cycles5
176 /* Sample time: */
177 /* With an ADCCLK = 14 MHz and a sampling time of 239.5 cycles: */
178 /* Tconv = 239.5 + 12.5 = 252 cycles = 18�s */
179 /* (1 / (ADCCLK / CYCLES)) = Sample Time (�S) */
180 #define PIOS_ADC_IRQ_PRIO PIOS_IRQ_PRIO_LOW
182 // Currently analog acquistion hard coded at 480 Hz
183 // PCKL2 = HCLK / 16
184 // ADCCLK = PCLK2 / 2
185 #define PIOS_ADC_RATE (72.0e6f / 1.0f / 8.0f / 252.0f / (PIOS_ADC_NUM_CHANNELS >> PIOS_ADC_USE_ADC2))
186 #define PIOS_ADC_MAX_OVERSAMPLING 36
188 #define PIOS_ADC_TEMPERATURE_PIN 0
189 #endif // if 0
191 // --------------------------
192 // Timer controller settings
193 // --------------------------
194 #define PIOS_TIM_MAX_DEVS 3
196 // -------------------------
197 // GPIO
198 // -------------------------
199 #define PIOS_GPIO_PORTS {}
200 #define PIOS_GPIO_PINS {}
201 #define PIOS_GPIO_CLKS {}
202 #define PIOS_GPIO_NUM 0
204 #define PIOS_USB_ENABLED 0
206 #endif /* PIOS_BOARD_H */