Merge pull request #10558 from iNavFlight/MrD_Correct-comments-on-OSD-symbols
[inav.git] / src / main / target / SITL / target.h
blobf7963dfdd95f218820478e5d30ef999bc0bd51bf
1 /*
2 * This file is part of INAV Project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
6 * You can obtain one at http://mozilla.org/MPL/2.0/.
8 * Alternatively, the contents of this file may be used under the terms
9 * of the GNU General Public License Version 3, as described below:
11 * This file is free software: you may copy, redistribute and/or modify
12 * it under the terms of the GNU General Public License as published by the
13 * Free Software Foundation, either version 3 of the License, or (at your
14 * option) any later version.
16 * This file is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
19 * Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program. If not, see http://www.gnu.org/licenses/.
25 #pragma once
27 #include <stdint.h>
28 #include <stdbool.h>
29 #include <stddef.h>
30 #include <sys/socket.h>
32 #include <platform.h>
34 #define TARGET_BOARD_IDENTIFIER "SITL"
35 #define USBD_PRODUCT_STRING "SITL"
37 #define REQUIRE_PRINTF_LONG_SUPPORT
39 // file name to save config
40 #define EEPROM_FILENAME "eeprom.bin"
41 #define CONFIG_IN_FILE
42 #define EEPROM_SIZE 32768
44 #undef SCHEDULER_DELAY_LIMIT
45 #define SCHEDULER_DELAY_LIMIT 1
47 #define USE_UART1
48 #define USE_UART2
49 #define USE_UART3
50 #define USE_UART4
51 #define USE_UART5
52 #define USE_UART6
53 #define USE_UART7
54 #define USE_UART8
56 #define SERIAL_PORT_COUNT 8
57 #define SITL_SERIAL_TASK_US (500)
59 #define DEFAULT_RX_FEATURE FEATURE_RX_MSP
60 #define DEFAULT_FEATURES (FEATURE_GPS | FEATURE_OSD | FEATURE_CURRENT_METER | FEATURE_VBAT)
62 #define USE_ADC
63 #define USE_MAG
64 #define USE_BARO
65 #define USE_PITOT_FAKE
66 #define USE_IMU_FAKE
67 #define USE_FAKE_BARO
68 #define USE_FAKE_MAG
69 #define USE_GPS_FAKE
70 #define USE_RANGEFINDER_FAKE
71 #define USE_RX_SIM
72 #undef MAX_MIXER_PROFILE_COUNT
73 #define MAX_MIXER_PROFILE_COUNT 2
75 #define USE_MSP_OSD
76 #define USE_OSD
77 #define USE_SERIAL_GIMBAL
78 #define USE_HEADTRACKER
79 #define USE_HEADTRACKER_SERIAL
80 #define USE_HEADTRACKER_MSP
82 #undef USE_DASHBOARD
83 #define USE_GEOZONE
84 #define MAX_GEOZONES_IN_CONFIG 63
85 #define MAX_VERTICES_IN_CONFIG 126
87 #undef USE_GYRO_KALMAN // Strange behaviour under x86/x64 ?!?
88 #undef USE_VCP
89 #undef USE_PPM
90 #undef USE_PWM
91 #undef USE_LED_STRIP
92 #undef USE_MSP_OVER_TELEMETRY
93 #undef USE_TELEMETRY_FRSKY_HUB
94 #undef USE_TELEMETRY_HOTT
95 #undef USE_TELEMETRY_SMARTPORT
96 #undef USE_RESOURCE_MGMT
97 #undef USE_TELEMETRY_CRSF
98 #undef USE_TELEMETRY_IBUS
99 #undef USE_TELEMETRY_JETIEXBUS
100 #undef USE_TELEMETRY_SRXL
101 #undef USE_TELEMETRY_GHST
102 #undef USE_VTX_TRAMP
103 #undef USE_CAMERA_CONTROL
104 #undef USE_BRUSHED_ESC_AUTODETECT
105 #undef USE_SERIAL_4WAY_BLHELI_BOOTLOADER
106 #undef USE_SERIAL_4WAY_SK_BOOTLOADER
107 #undef USE_ADAPTIVE_FILTER
109 #undef USE_I2C
110 #undef USE_SPI
112 // Some dummys
113 #define TARGET_FLASH_SIZE 2048
115 #define LED_STRIP_TIMER 1
116 #define SOFTSERIAL_1_TIMER 2
117 #define SOFTSERIAL_2_TIMER 3
119 #define DEFIO_NO_PORTS
121 extern uint32_t SystemCoreClock;
123 #define U_ID_0 0
124 #define U_ID_1 1
125 #define U_ID_2 2
127 typedef struct
129 void* dummy;
130 } TIM_TypeDef;
132 typedef struct
134 void* dummy;
135 } TIM_OCInitTypeDef;
137 typedef struct {
138 void* dummy;
139 } DMA_TypeDef;
141 typedef struct {
142 void* dummy;
143 } DMA_Channel_TypeDef;
145 typedef struct
147 void* dummy;
148 } SPI_TypeDef;
150 typedef struct
152 void* dummy;
153 } I2C_TypeDef;
155 typedef enum {RESET = 0, SET = !RESET} FlagStatus, ITStatus;
156 typedef enum {DISABLE = 0, ENABLE = !DISABLE} FunctionalState;
157 typedef enum {TEST_IRQ = 0 } IRQn_Type;
158 typedef enum {
159 EXTI_Trigger_Rising = 0x08,
160 EXTI_Trigger_Falling = 0x0C,
161 EXTI_Trigger_Rising_Falling = 0x10
162 } EXTITrigger_TypeDef;
164 typedef struct
166 uint32_t IDR;
167 uint32_t ODR;
168 uint32_t BSRR;
169 uint32_t BRR;
170 } GPIO_TypeDef;
172 #define GPIOA_BASE ((intptr_t)0x0001)
174 typedef struct
176 uint32_t dummy;
177 } USART_TypeDef;
179 #define USART1 ((USART_TypeDef *)0x0001)
180 #define USART2 ((USART_TypeDef *)0x0002)
181 #define USART3 ((USART_TypeDef *)0x0003)
182 #define USART4 ((USART_TypeDef *)0x0004)
183 #define USART5 ((USART_TypeDef *)0x0005)
184 #define USART6 ((USART_TypeDef *)0x0006)
185 #define USART7 ((USART_TypeDef *)0x0007)
186 #define USART8 ((USART_TypeDef *)0x0008)
188 #define UART4 ((USART_TypeDef *)0x0004)
189 #define UART5 ((USART_TypeDef *)0x0005)
190 #define UART7 ((USART_TypeDef *)0x0007)
191 #define UART8 ((USART_TypeDef *)0x0008)
193 typedef enum
195 SITL_SIM_NONE,
196 SITL_SIM_REALFLIGHT,
197 SITL_SIM_XPLANE,
198 } SitlSim_e;
202 extern bool lockMainPID(void);
203 extern void unlockMainPID(void);
204 extern void parseArguments(int argc, char *argv[]);
205 extern char *strnstr(const char *s, const char *find, size_t slen);
206 extern int lookupAddress (char *, int, int, struct sockaddr *, socklen_t*);
208 #define IPADDRESS_PRINT_BUFLEN (INET6_ADDRSTRLEN + 16)
209 extern char *prettyPrintAddress(struct sockaddr*, char*, size_t);