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 STM32103CB_PIPXTREME_H_
31 #define STM32103CB_PIPXTREME_H_
32 
33 #define TAULINK_VERSION_STICK 0x01
34 #define TAULINK_VERSION_MODULE 0x02
35 
36 //------------------------
37 // Timers and Channels Used
38 //------------------------
39 /*
40 Timer | Channel 1 | Channel 2 | Channel 3 | Channel 4
41 ------+-----------+-----------+-----------+----------
42 TIM1 | Servo 4 | | |
43 TIM2 | RC In 5 | RC In 6 | Servo 6 |
44 TIM3 | Servo 5 | RC In 2 | RC In 3 | RC In 4
45 TIM4 | RC In 1 | Servo 3 | Servo 2 | Servo 1
46 ------+-----------+-----------+-----------+----------
47 */
48 
49 //------------------------
50 // DMA Channels Used
51 //------------------------
52 /* Channel 1 - */
53 /* Channel 2 - */
54 /* Channel 3 - */
55 /* Channel 4 - */
56 /* Channel 5 - */
57 /* Channel 6 - */
58 /* Channel 7 - */
59 /* Channel 8 - */
60 /* Channel 9 - */
61 /* Channel 10 - */
62 /* Channel 11 - */
63 /* Channel 12 - */
64 
65 
66 //------------------------
67 // BOOTLOADER_SETTINGS
68 //------------------------
69 #define BOARD_READABLE true
70 #define BOARD_WRITABLE true
71 #define MAX_DEL_RETRYS 3
72 
73 
74 //------------------------
75 // WATCHDOG_SETTINGS
76 //------------------------
77 #define PIOS_WATCHDOG_TIMEOUT 500
78 #define PIOS_WDG_REGISTER BKP_DR4
79 #define PIOS_WDG_TELEMETRY 0x0100
80 #define PIOS_WDG_RADIORX 0x0200
81 #define PIOS_WDG_RFM22B 0x0400
82 #define PIOS_WDG_SYSTEM 0x0800
83 
84 //------------------------
85 // PIOS_LED
86 //------------------------
87 #define PIOS_LED_USB 0
88 #define PIOS_LED_LINK 1
89 #define PIOS_LED_RX 2
90 #define PIOS_LED_TX 3
91 #ifdef PIOS_RFM22B_DEBUG_ON_TELEM
92 #define PIOS_LED_D1 4
93 #define PIOS_LED_D2 5
94 #define PIOS_LED_D3 6
95 #define PIOS_LED_D4 7
96 #endif
97 
98 #define PIOS_LED_HEARTBEAT PIOS_LED_USB
99 #define PIOS_LED_ALARM PIOS_LED_TX
100 
101 #define USB_LED_ON PIOS_ANNUNC_On(PIOS_LED_USB)
102 #define USB_LED_OFF PIOS_ANNUNC_Off(PIOS_LED_USB)
103 #define USB_LED_TOGGLE PIOS_ANNUNC_Toggle(PIOS_LED_USB)
104 
105 #define LINK_LED_ON PIOS_ANNUNC_On(PIOS_LED_LINK)
106 #define LINK_LED_OFF PIOS_ANNUNC_Off(PIOS_LED_LINK)
107 #define LINK_LED_TOGGLE PIOS_ANNUNC_Toggle(PIOS_LED_LINK)
108 
109 #define RX_LED_ON PIOS_ANNUNC_On(PIOS_LED_RX)
110 #define RX_LED_OFF PIOS_ANNUNC_Off(PIOS_LED_RX)
111 #define RX_LED_TOGGLE PIOS_ANNUNC_Toggle(PIOS_LED_RX)
112 
113 #define TX_LED_ON PIOS_ANNUNC_On(PIOS_LED_TX)
114 #define TX_LED_OFF PIOS_ANNUNC_Off(PIOS_LED_TX)
115 #define TX_LED_TOGGLE PIOS_ANNUNC_Toggle(PIOS_LED_TX)
116 
117 #ifdef PIOS_RFM22B_DEBUG_ON_TELEM
118 #define D1_LED_ON PIOS_ANNUNC_On(PIOS_LED_D1)
119 #define D1_LED_OFF PIOS_ANNUNC_Off(PIOS_LED_D1)
120 #define D1_LED_TOGGLE PIOS_ANNUNC_Toggle(PIOS_LED_D1)
121 
122 #define D2_LED_ON PIOS_ANNUNC_On(PIOS_LED_D2)
123 #define D2_LED_OFF PIOS_ANNUNC_Off(PIOS_LED_D2)
124 #define D2_LED_TOGGLE PIOS_ANNUNC_Toggle(PIOS_LED_D2)
125 
126 #define D3_LED_ON PIOS_ANNUNC_On(PIOS_LED_D3)
127 #define D3_LED_OFF PIOS_ANNUNC_Off(PIOS_LED_D3)
128 #define D3_LED_TOGGLE PIOS_ANNUNC_Toggle(PIOS_LED_D3)
129 
130 #define D4_LED_ON PIOS_ANNUNC_On(PIOS_LED_D4)
131 #define D4_LED_OFF PIOS_ANNUNC_Off(PIOS_LED_D4)
132 #define D4_LED_TOGGLE PIOS_ANNUNC_Toggle(PIOS_LED_D4)
133 #endif
134 
135 //-------------------------
136 // System Settings
137 //-------------------------
138 #define PIOS_SYSCLK 72000000
139 #define PIOS_PERIPHERAL_APB1_CLOCK (PIOS_SYSCLK / 2)
140 #define PIOS_PERIPHERAL_APB2_CLOCK (PIOS_SYSCLK / 1)
141 
142 //-------------------------
143 // Interrupt Priorities
144 //-------------------------
145 #define PIOS_IRQ_PRIO_LOW 12 // lower than RTOS
146 #define PIOS_IRQ_PRIO_MID 8 // higher than RTOS
147 #define PIOS_IRQ_PRIO_HIGH 5 // for SPI, ADC, I2C etc...
148 #define PIOS_IRQ_PRIO_HIGHEST 4 // for USART etc...
149 
150 //-------------------------
151 // PIOS_COM
152 //
153 // See also pios_board.c
154 //-------------------------
155 extern uintptr_t pios_com_telem_usb_id;
156 extern uintptr_t pios_com_vcp_id;
157 extern uintptr_t pios_com_radio_id;
158 extern uintptr_t pios_com_telem_serial_id;
159 extern uintptr_t pios_com_bridge_id;
160 extern uintptr_t pios_com_rf_id;
161 extern uintptr_t pios_com_telem_uart_telem_id;
162 extern uintptr_t pios_ppm_rcvr_id;
163 extern uintptr_t pios_com_debug_id;
164 extern uintptr_t pios_com_frsky_sport_id;
165 #define PIOS_COM_TELEM_USB (pios_com_telem_usb_id)
166 #define PIOS_COM_VCP (pios_com_vcp_id)
167 #define PIOS_COM_BRIDGE (pios_com_bridge_id)
168 #define PIOS_COM_RADIOBRIDGE (pios_com_rf_id)
169 #define PIOS_PPM_RECEIVER (pios_ppm_rcvr_id)
170 #define PIOS_COM_DEBUG (pios_com_debug_id)
171 #define PIOS_COM_FRSKY_SPORT (pios_com_frsky_sport_id)
172 
173 #define DEBUG_LEVEL 0
174 #define DEBUG_PRINTF(level, ...) {if(level <= DEBUG_LEVEL && PIOS_COM_DEBUG > 0) { PIOS_COM_SendFormattedStringNonBlocking(PIOS_COM_DEBUG, __VA_ARGS__); }}
175 
176 #define RFM22_DEBUG 1
177 
178 //-------------------------
179 // ADC
180 // None
181 //-------------------------
182 //#define PIOS_ADC_OVERSAMPLING_RATE 1
183 #define PIOS_ADC_MAX_OVERSAMPLING 36
184 
185 #define VREF_PLUS 3.3
186 
187 //------------------------
188 // PIOS_RCVR
189 // See also pios_board.c
190 //------------------------
191 #define PIOS_RCVR_MAX_CHANNELS 12
192 
193 //-------------------------
194 // Receiver PPM input
195 //-------------------------
196 #define PIOS_PPM_NUM_INPUTS 8
197 #define PIOS_SBUS_NUM_INPUTS (16+2)
198 //-------------------------
199 // Servo outputs
200 //-------------------------
201 #define PIOS_SERVO_UPDATE_HZ 50
202 #define PIOS_SERVOS_INITIAL_POSITION 0 /* dont want to start motors, have no pulse till settings loaded */
203 
204 //--------------------------
205 // Timer controller settings
206 //--------------------------
207 #define PIOS_TIM_MAX_DEVS 3
208 
209 //-------------------------
210 // USB
211 //-------------------------
212 #define PIOS_USB_ENABLED 1
213 #define PIOS_USB_DETECT_GPIO_PORT GPIOC
214 #define PIOS_USB_DETECT_GPIO_PIN GPIO_Pin_15
215 #define PIOS_USB_DETECT_EXTI_LINE EXTI_Line15
216 
217 //-------------------------
218 // Flash EEPROM Emulation
219 //-------------------------
220 
221 #define PIOS_FLASH_SIZE 0x20000
222 #define PIOS_FLASH_EEPROM_START_ADDR 0x08000000
223 #define PIOS_FLASH_PAGE_SIZE 1024
224 #define PIOS_FLASH_EEPROM_ADDR (PIOS_FLASH_EEPROM_START_ADDR + PIOS_FLASH_SIZE - PIOS_FLASH_PAGE_SIZE)
225 #define PIOS_FLASH_EEPROM_LEN PIOS_FLASH_PAGE_SIZE
226 
227 #endif /* STM32103CB_PIPXTREME_H_ */
228 
uintptr_t pios_com_radio_id
uintptr_t pios_com_frsky_sport_id
uintptr_t pios_com_telem_uart_telem_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_ppm_rcvr_id
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_rf_id
uintptr_t pios_com_vcp_id