dRonin  adbada4
dRonin firmware
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
pios_board.h
Go to the documentation of this file.
1 
15 /*
16  * This program is free software; you can redistribute it and/or modify
17  * it under the terms of the GNU General Public License as published by
18  * the Free Software Foundation; either version 3 of the License, or
19  * (at your option) any later version.
20  *
21  * This program is distributed in the hope that it will be useful, but
22  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
23  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24  * for more details.
25  *
26  * You should have received a copy of the GNU General Public License along
27  * with this program; if not, see <http://www.gnu.org/licenses/>
28  *
29  * Additional note on redistribution: The copyright and license notices above
30  * must be maintained in each individual source file that is a derivative work
31  * of this source file; otherwise redistribution is prohibited.
32  */
33 
34 
35 #ifndef STM32F30X_DTFc_H_
36 #define STM32F30X_DTFc_H_
37 
38 #include <stdbool.h>
39 
40 #if defined(PIOS_INCLUDE_DEBUG_CONSOLE)
41 #define DEBUG_LEVEL 0
42 #define DEBUG_PRINTF(level, ...) {if(level <= DEBUG_LEVEL && pios_com_aux_id > 0) { PIOS_COM_SendFormattedStringNonBlocking(pios_com_aux_id, __VA_ARGS__); }}
43 #else
44 #define DEBUG_PRINTF(level, ...)
45 #endif /* PIOS_INCLUDE_DEBUG_CONSOLE */
46 
47 //------------------------
48 // Timers and Channels Used
49 //------------------------
50 /*
51 Timer | Channel 1 | Channel 2 | Channel 3 | Channel 4
52 ------+-----------+-----------+-----------+----------
53 TIM1 | PPM | | |
54 TIM2 | PWM5 | PWM6 | PWM4 | PWM3
55 TIM3 | | | PWM7 | PWM8
56 TIM4 | | | PWM1 | PWM2
57 TIM6 | |xxxxxxxxxxx|xxxxxxxxxxx|xxxxxxxxxx
58 TIM7 | |xxxxxxxxxxx|xxxxxxxxxxx|xxxxxxxxxx
59 TIM8 | | | |
60 TIM15 | | |xxxxxxxxxxx|xxxxxxxxxx
61 TIM16 | |xxxxxxxxxxx|xxxxxxxxxxx|xxxxxxxxxx
62 TIM17 | |xxxxxxxxxxx|xxxxxxxxxxx|xxxxxxxxxx
63 ------+-----------+-----------+-----------+----------
64 */
65 
66 //------------------------
67 // DMA 1 Channels Used
68 //------------------------
69 /* Channel 1 - */
70 /* Channel 2 - */
71 /* Channel 3 - */
72 /* Channel 4 - */
73 /* Channel 5 - */
74 /* Channel 6 - */
75 /* Channel 7 - */
76 
77 //------------------------
78 // DMA 2 Channels Used
79 //------------------------
80 /* Channel 1 - ADC2 */
81 /* Channel 2 - */
82 /* Channel 3 - */
83 /* Channel 4 - */
84 /* Channel 5 - */
85 
86 //------------------------
87 // BOOTLOADER_SETTINGS
88 //------------------------
89 #define BOARD_READABLE true
90 #define BOARD_WRITABLE true
91 #define MAX_DEL_RETRYS 3
92 
93 
94 //------------------------
95 // PIOS_LED
96 //------------------------
97 #define PIOS_LED_ALARM 0
98 #define PIOS_LED_HEARTBEAT 1
99 #define PIOS_LED_USB 2
100 #define PIOS_ANNUNCIATOR_BUZZER 3
101 
102 #define USB_LED_ON PIOS_ANNUNC_On(PIOS_LED_USB)
103 #define USB_LED_OFF PIOS_ANNUNC_Off(PIOS_LED_USB)
104 #define USB_LED_TOGGLE PIOS_ANNUNC_Toggle(PIOS_LED_USB)
105 
106 //------------------------
107 // PIOS_WDG
108 //------------------------
109 #define PIOS_WATCHDOG_TIMEOUT 250
110 #define PIOS_WDG_REGISTER RTC_BKP_DR4
111 
112 //-------------------------
113 // PIOS_COM
114 //
115 // See also pios_board.c
116 //-------------------------
117 extern uintptr_t pios_com_gps_id;
118 extern uintptr_t pios_com_telem_usb_id;
119 extern uintptr_t pios_com_telem_serial_id;
120 extern uintptr_t pios_com_bridge_id;
121 extern uintptr_t pios_com_vcp_id;
122 extern uintptr_t pios_com_mavlink_id;
123 extern uintptr_t pios_com_hott_id;
124 extern uintptr_t pios_com_frsky_sensor_hub_id;
125 extern uintptr_t pios_com_lighttelemetry_id;
126 extern uintptr_t pios_com_frsky_sport_id;
127 extern uintptr_t pios_com_openlog_logging_id;
128 extern uintptr_t pios_com_storm32bgc_id;
129 
130 
131 #define PIOS_COM_GPS (pios_com_gps_id)
132 #define PIOS_COM_TELEM_USB (pios_com_telem_usb_id)
133 #define PIOS_COM_BRIDGE (pios_com_bridge_id)
134 #define PIOS_COM_VCP (pios_com_vcp_id)
135 #define PIOS_COM_MAVLINK (pios_com_mavlink_id)
136 #define PIOS_COM_HOTT (pios_com_hott_id)
137 #define PIOS_COM_FRSKY_SENSOR_HUB (pios_com_frsky_sensor_hub_id)
138 #define PIOS_COM_LIGHTTELEMETRY (pios_com_lighttelemetry_id)
139 #define PIOS_COM_FRSKY_SPORT (pios_com_frsky_sport_id)
140 #define PIOS_COM_OPENLOG (pios_com_openlog_logging_id)
141 #define PIOS_COM_STORM32BGC (pios_com_storm32bgc_id)
142 
143 
144 #if defined(PIOS_INCLUDE_DEBUG_CONSOLE)
145 extern uintptr_t pios_com_debug_id;
146 #define PIOS_COM_DEBUG (pios_com_debug_id)
147 #endif /* PIOS_INCLUDE_DEBUG_CONSOLE */
148 
149 //-------------------------
150 // System Settings
151 //
152 // See also system_stm32f30x.c
153 //-------------------------
154 //These macros are deprecated
155 
156 #define PIOS_SYSCLK 72000000
157 #define PIOS_PERIPHERAL_APB1_CLOCK (PIOS_SYSCLK / 2)
158 #define PIOS_PERIPHERAL_APB2_CLOCK (PIOS_SYSCLK / 1)
159 
160 
161 //-------------------------
162 // Interrupt Priorities
163 //-------------------------
164 #define PIOS_IRQ_PRIO_LOW 12 // lower than RTOS
165 #define PIOS_IRQ_PRIO_MID 8 // higher than RTOS
166 #define PIOS_IRQ_PRIO_HIGH 5 // for SPI, ADC, I2C etc...
167 #define PIOS_IRQ_PRIO_HIGHEST 4 // for USART etc...
168 
169 
170 //------------------------
171 // PIOS_RCVR
172 // See also pios_board.c
173 //------------------------
174 #define PIOS_RCVR_MAX_CHANNELS 12
175 
176 //-------------------------
177 // Receiver PPM input
178 //-------------------------
179 #define PIOS_PPM_NUM_INPUTS 12
180 
181 //-------------------------
182 // Receiver PWM input
183 //-------------------------
184 #define PIOS_PWM_NUM_INPUTS 1
185 
186 //-------------------------
187 // Receiver DSM input
188 //-------------------------
189 #define PIOS_DSM_NUM_INPUTS 12
190 
191 //-------------------------
192 // Receiver HSUM input
193 //-------------------------
194 #define PIOS_HSUM_MAX_DEVS 2
195 #define PIOS_HSUM_NUM_INPUTS 32
196 
197 //-------------------------
198 // Receiver S.Bus input
199 //-------------------------
200 #define PIOS_SBUS_NUM_INPUTS (16+2)
201 
202 //-------------------------
203 // Servo outputs
204 //-------------------------
205 #define PIOS_SERVO_UPDATE_HZ 50
206 #define PIOS_SERVOS_INITIAL_POSITION 0 /* dont want to start motors, have no pulse till settings loaded */
207 
208 //--------------------------
209 // Timer controller settings
210 //--------------------------
211 #define PIOS_TIM_MAX_DEVS 8
212 
213 //-------------------------
214 // ADC
215 // ADC0 : PA4 ADC2_IN1 Voltage sense
216 // ADC1 : PA5 ADC2_IN2 Current sense
217 //-------------------------
218 #define VREF_PLUS 3.3
219 
220 //-------------------------
221 // DMA
222 //-------------------------
223 #define PIOS_DMA_MAX_CHANNELS 12
224 #define PIOS_DMA_MAX_HANDLERS_PER_CHANNEL 3
225 #define PIOS_DMA_CHANNELS {DMA1_Channel1, DMA1_Channel2, DMA1_Channel3, DMA1_Channel4, DMA1_Channel5, DMA1_Channel6, DMA1_Channel7, DMA2_Channel1, DMA2_Channel2, DMA2_Channel3, DMA2_Channel4, DMA2_Channel5}
226 
227 //-------------------------
228 // USB
229 //-------------------------
230 #define PIOS_USB_ENABLED 1 /* Should remove all references to this */
231 
232 #endif /* STM32F30X_DTFc_H_ */
233 
uintptr_t pios_com_frsky_sport_id
uintptr_t pios_com_frsky_sensor_hub_id
uintptr_t pios_com_telem_serial_id
Definition: pios_hal.c:127
uintptr_t pios_com_debug_id
Definition: pios_board.c:76
uintptr_t pios_com_hott_id
uintptr_t pios_com_mavlink_id
uintptr_t pios_com_lighttelemetry_id
uintptr_t pios_com_openlog_logging_id
Definition: pios_board.c:49
uintptr_t pios_com_telem_usb_id
Definition: pios_board.c:42
uintptr_t pios_com_bridge_id
Definition: pios_hal.c:81
uintptr_t pios_com_storm32bgc_id
uintptr_t pios_com_gps_id
Definition: pios_hal.c:80
uintptr_t pios_com_vcp_id