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