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 
12 /*
13  * This program is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License as published by
15  * the Free Software Foundation; either version 3 of the License, or
16  * (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful, but
19  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
20  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  * for more details.
22  *
23  * You should have received a copy of the GNU General Public License along
24  * with this program; if not, see <http://www.gnu.org/licenses/>
25  *
26  * Additional note on redistribution: The copyright and license notices above
27  * must be maintained in each individual source file that is a derivative work
28  * of this source file; otherwise redistribution is prohibited.
29  */
30 
31 #include <stdbool.h>
32 
33 //------------------------
34 // Timers and Channels Used
35 //------------------------
36 /*
37 Timer | Channel 1 | Channel 2 | Channel 3 | Channel 4
38 ------+-----------+-----------+-----------+----------
39 TIM1 | | | |
40 TIM2 | --------------- PIOS_DELAY -----------------
41 TIM3 | | | |
42 TIM4 | | | |
43 TIM5 | | | |
44 TIM6 | | | |
45 TIM7 | | | |
46 TIM8 | | | |
47 ------+-----------+-----------+-----------+----------
48 */
49 
50 //------------------------
51 // DMA Channels Used
52 //------------------------
53 /* Channel 1 - */
54 /* Channel 2 - */
55 /* Channel 3 - */
56 /* Channel 4 - */
57 /* Channel 5 - */
58 /* Channel 6 - */
59 /* Channel 7 - */
60 /* Channel 8 - */
61 /* Channel 9 - */
62 /* Channel 10 - */
63 /* Channel 11 - */
64 /* Channel 12 - */
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 // PIOS_LED
76 //------------------------
77 #define PIOS_LED_HEARTBEAT 0
78 #define PIOS_LED_ALARM 1
79 
80 //------------------------
81 // PIOS_WDG
82 //------------------------
83 #define PIOS_WATCHDOG_TIMEOUT 250
84 #define PIOS_WDG_REGISTER RTC_BKP_DR4
85 
86 //-------------------------
87 // PIOS_COM
88 //
89 // See also pios_board.c
90 //-------------------------
91 extern uintptr_t pios_com_telem_serial_id;
92 extern uintptr_t pios_com_gps_id;
93 extern uintptr_t pios_com_telem_usb_id;
94 extern uintptr_t pios_com_bridge_id;
95 extern uintptr_t pios_com_vcp_id;
96 extern uintptr_t pios_com_mavlink_id;
97 extern uintptr_t pios_com_hott_id;
98 extern uintptr_t pios_com_frsky_sensor_hub_id;
99 extern uintptr_t pios_com_lighttelemetry_id;
100 extern uintptr_t pios_com_debug_id;
101 extern uintptr_t pios_com_frsky_sport_id;
102 extern uintptr_t pios_com_openlog_logging_id;
103 
104 #define PIOS_COM_GPS (pios_com_gps_id)
105 #define PIOS_COM_TELEM_USB (pios_com_telem_usb_id)
106 #define PIOS_COM_BRIDGE (pios_com_bridge_id)
107 #define PIOS_COM_VCP (pios_com_vcp_id)
108 #define PIOS_COM_MAVLINK (pios_com_mavlink_id)
109 #define PIOS_COM_HOTT (pios_com_hott_id)
110 #define PIOS_COM_FRSKY_SENSOR_HUB (pios_com_frsky_sensor_hub_id)
111 #define PIOS_COM_LIGHTTELEMETRY (pios_com_lighttelemetry_id)
112 #define PIOS_COM_DEBUG (pios_com_debug_id)
113 
114 #define DEBUG_LEVEL 0
115 #define DEBUG_PRINTF(level, ...) {if(level <= DEBUG_LEVEL && pios_com_debug_id > 0) { PIOS_COM_SendFormattedStringNonBlocking(pios_com_debug_id, __VA_ARGS__); }}
116 
117 #define PIOS_SYSCLK 168000000
118 // Peripherals that belongs to APB1 are:
119 // DAC |PWR |CAN1,2
120 // I2C1,2,3 |UART4,5 |USART3,2
121 // I2S3Ext |SPI3/I2S3 |SPI2/I2S2
122 // I2S2Ext |IWDG |WWDG
123 // RTC/BKP reg
124 // TIM2,3,4,5,6,7,12,13,14
125 
126 // Calculated as SYSCLK / APBPresc * (APBPre == 1 ? 1 : 2)
127 // Default APB1 Prescaler = 4
128 #define PIOS_PERIPHERAL_APB1_CLOCK (PIOS_SYSCLK / 4)
129 
130 // Peripherals belonging to APB2
131 // SDIO |EXTI |SYSCFG |SPI1
132 // ADC1,2,3
133 // USART1,6
134 // TIM1,8,9,10,11
135 //
136 // Default APB2 Prescaler = 2
137 //
138 #define PIOS_PERIPHERAL_APB2_CLOCK (PIOS_SYSCLK / 2)
139 
140 
141 //-------------------------
142 // Interrupt Priorities
143 //-------------------------
144 #define PIOS_IRQ_PRIO_LOW 12 // lower than RTOS
145 #define PIOS_IRQ_PRIO_MID 8 // higher than RTOS
146 #define PIOS_IRQ_PRIO_HIGH 5 // for SPI, ADC, I2C etc...
147 #define PIOS_IRQ_PRIO_HIGHEST 4 // for USART etc...
148 
149 //--------------------------
150 // Timer controller settings
151 //--------------------------
152 #define PIOS_TIM_MAX_DEVS 6
153 
154 //-------------------------
155 // USB
156 //-------------------------
157 #define PIOS_USB_ENABLED 1 /* Should remove all references to this */
158 
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_gps_id
Definition: pios_hal.c:80
uintptr_t pios_com_vcp_id