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 
30 #ifndef STM3210E_INS_H_
31 #define STM3210E_INS_H_
32 
33 #include <stdbool.h>
34 
35 #if defined(PIOS_INCLUDE_DEBUG_CONSOLE)
36 #define DEBUG_LEVEL 0
37 #define DEBUG_PRINTF(level, ...) {if(level <= DEBUG_LEVEL && pios_com_debug_id > 0) { PIOS_COM_SendFormattedStringNonBlocking(pios_com_debug_id, __VA_ARGS__); }}
38 #else
39 #define DEBUG_PRINTF(level, ...)
40 #endif /* PIOS_INCLUDE_DEBUG_CONSOLE */
41 
42 //------------------------
43 // Timers and Channels Used
44 //------------------------
45 /*
46 Timer | Channel 1 | Channel 2 | Channel 3 | Channel 4
47 ------+-----------+-----------+-----------+----------
48 TIM1 | | | |
49 TIM2 | --------------- PIOS_DELAY -----------------
50 TIM3 | | | |
51 TIM4 | | | |
52 TIM5 | | | |
53 TIM6 | | | |
54 TIM7 | | | |
55 TIM8 | | | |
56 ------+-----------+-----------+-----------+----------
57 */
58 
59 //------------------------
60 // DMA Channels Used
61 //------------------------
62 /* Channel 1 - */
63 /* Channel 2 - */
64 /* Channel 3 - */
65 /* Channel 4 - */
66 /* Channel 5 - */
67 /* Channel 6 - */
68 /* Channel 7 - */
69 /* Channel 8 - */
70 /* Channel 9 - */
71 /* Channel 10 - */
72 /* Channel 11 - */
73 /* Channel 12 - */
74 
75 //------------------------
76 // BOOTLOADER_SETTINGS
77 //------------------------
78 #define BOARD_READABLE true
79 #define BOARD_WRITABLE true
80 #define MAX_DEL_RETRYS 3
81 
82 //------------------------
83 // PIOS_LED
84 //------------------------
85 #define PIOS_LED_HEARTBEAT 0
86 #define PIOS_LED_ALARM 1
87 #define PIOS_ANNUNCIATOR_BUZZER 2
88 
89 //------------------------
90 // PIOS_WDG
91 //------------------------
92 #define PIOS_WATCHDOG_TIMEOUT 250
93 #define PIOS_WDG_REGISTER RTC_BKP_DR4
94 
95 //-------------------------
96 // PIOS_COM
97 //
98 // See also pios_board.c
99 //-------------------------
100 extern uintptr_t pios_com_telem_serial_id;
101 extern uintptr_t pios_com_gps_id;
102 extern uintptr_t pios_com_telem_usb_id;
103 extern uintptr_t pios_com_bridge_id;
104 extern uintptr_t pios_com_vcp_id;
105 extern uintptr_t pios_com_mavlink_id;
106 extern uintptr_t pios_com_hott_id;
107 extern uintptr_t pios_com_frsky_sensor_hub_id;
108 extern uintptr_t pios_com_lighttelemetry_id;
109 extern uintptr_t pios_com_frsky_sport_id;
110 extern uintptr_t pios_com_openlog_logging_id;
111 extern uintptr_t pios_com_storm32bgc_id;
112 
113 #define PIOS_COM_GPS (pios_com_gps_id)
114 #define PIOS_COM_TELEM_USB (pios_com_telem_usb_id)
115 #define PIOS_COM_BRIDGE (pios_com_bridge_id)
116 #define PIOS_COM_VCP (pios_com_vcp_id)
117 #define PIOS_COM_MAVLINK (pios_com_mavlink_id)
118 #define PIOS_COM_HOTT (pios_com_hott_id)
119 #define PIOS_COM_FRSKY_SENSOR_HUB (pios_com_frsky_sensor_hub_id)
120 #define PIOS_COM_LIGHTTELEMETRY (pios_com_lighttelemetry_id)
121 #define PIOS_COM_FRSKY_SPORT (pios_com_frsky_sport_id)
122 #define PIOS_COM_OPENLOG (pios_com_openlog_logging_id)
123 #define PIOS_COM_STORM32BGC (pios_com_storm32bgc_id)
124 
125 #if defined(PIOS_INCLUDE_DEBUG_CONSOLE)
126 extern uintptr_t pios_com_debug_id;
127 #define PIOS_COM_DEBUG (pios_com_debug_id)
128 #endif /* PIOS_INCLUDE_DEBUG_CONSOLE */
129 
131 #ifdef PIOS_INCLUDE_MAX7456
132 #include <pios_max7456.h>
133 
134 extern max7456_dev_t pios_max7456_id;
135 #endif
136 
137 #if defined(PIOS_INCLUDE_WS2811)
138 #include <pios_ws2811.h>
139 
141 #endif
142 
143 #define PIOS_SYSCLK 168000000
144 // Peripherals that belongs to APB1 are:
145 // DAC |PWR |CAN1,2
146 // I2C1,2,3 |UART4,5 |USART3,2
147 // I2S3Ext |SPI3/I2S3 |SPI2/I2S2
148 // I2S2Ext |IWDG |WWDG
149 // RTC/BKP reg
150 // TIM2,3,4,5,6,7,12,13,14
151 
152 // Calculated as SYSCLK / APBPresc * (APBPre == 1 ? 1 : 2)
153 // Default APB1 Prescaler = 4
154 #define PIOS_PERIPHERAL_APB1_CLOCK (PIOS_SYSCLK / 4)
155 
156 // Peripherals belonging to APB2
157 // SDIO |EXTI |SYSCFG |SPI1
158 // ADC1,2,3
159 // USART1,6
160 // TIM1,8,9,10,11
161 //
162 // Default APB2 Prescaler = 2
163 //
164 #define PIOS_PERIPHERAL_APB2_CLOCK (PIOS_SYSCLK / 2)
165 
166 //-------------------------
167 // Interrupt Priorities
168 //-------------------------
169 #define PIOS_IRQ_PRIO_LOW 12 // lower than RTOS
170 #define PIOS_IRQ_PRIO_MID 8 // higher than RTOS
171 #define PIOS_IRQ_PRIO_HIGH 5 // for SPI, ADC, I2C etc...
172 #define PIOS_IRQ_PRIO_HIGHEST 4 // for USART etc...
173 
174 //------------------------
175 // PIOS_RCVR
176 // See also pios_board.c
177 //------------------------
178 #define PIOS_RCVR_MAX_CHANNELS 12
179 
180 //-------------------------
181 // Receiver PPM input
182 //-------------------------
183 #define PIOS_PPM_NUM_INPUTS 12
184 
185 //-------------------------
186 // Receiver PWM input
187 //-------------------------
188 #define PIOS_PWM_NUM_INPUTS 8
189 
190 //-------------------------
191 // Receiver DSM input
192 //-------------------------
193 #define PIOS_DSM_NUM_INPUTS 12
194 
195 //-------------------------
196 // Receiver HSUM input
197 //-------------------------
198 #define PIOS_HSUM_MAX_DEVS 2
199 #define PIOS_HSUM_NUM_INPUTS 32
200 
201 //-------------------------
202 // Receiver S.Bus input
203 //-------------------------
204 #define PIOS_SBUS_NUM_INPUTS (16+2)
205 
206 //-------------------------
207 // Servo outputs
208 //-------------------------
209 #define PIOS_SERVO_UPDATE_HZ 50
210 #define PIOS_SERVOS_INITIAL_POSITION 0 /* dont want to start motors, have no pulse till settings loaded */
211 
212 //--------------------------
213 // Timer controller settings
214 //--------------------------
215 #define PIOS_TIM_MAX_DEVS 8
216 
217 //-------------------------
218 // ADC
219 //-------------------------
220 #define PIOS_ADC_SUB_DRIVER_MAX_INSTANCES 3
221 #define PIOS_ADC_MAX_OVERSAMPLING 2
222 #define VREF_PLUS 3.3
223 
224 //-------------------------
225 // USB
226 //-------------------------
227 #define PIOS_USB_ENABLED 1 /* Should remove all references to this */
228 
229 #endif /* STM3210E_INS_H_ */
230 
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
struct max7456_dev_s * max7456_dev_t
Definition: pios_max7456.h:65
uintptr_t pios_com_mavlink_id
uintptr_t pios_com_lighttelemetry_id
ws2811_dev_t pios_ws2811
Definition: pios_board.c:66
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