vtx: fix VTX_SETTINGS_POWER_COUNT and add dummy entries to saPowerNames
[inav.git] / src / main / target / SITL / target.h
blobf6d80f74971b847efb178533e16657f26e2cdb9c
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
84 #undef USE_GYRO_KALMAN // Strange behaviour under x86/x64 ?!?
85 #undef USE_VCP
86 #undef USE_PPM
87 #undef USE_PWM
88 #undef USE_LED_STRIP
89 #undef USE_MSP_OVER_TELEMETRY
90 #undef USE_TELEMETRY_FRSKY_HUB
91 #undef USE_TELEMETRY_HOTT
92 #undef USE_TELEMETRY_SMARTPORT
93 #undef USE_RESOURCE_MGMT
94 #undef USE_TELEMETRY_CRSF
95 #undef USE_TELEMETRY_IBUS
96 #undef USE_TELEMETRY_JETIEXBUS
97 #undef USE_TELEMETRY_SRXL
98 #undef USE_TELEMETRY_GHST
99 #undef USE_VTX_TRAMP
100 #undef USE_CAMERA_CONTROL
101 #undef USE_BRUSHED_ESC_AUTODETECT
102 #undef USE_SERIAL_4WAY_BLHELI_BOOTLOADER
103 #undef USE_SERIAL_4WAY_SK_BOOTLOADER
104 #undef USE_ADAPTIVE_FILTER
106 #undef USE_I2C
107 #undef USE_SPI
109 // Some dummys
110 #define TARGET_FLASH_SIZE 2048
112 #define LED_STRIP_TIMER 1
113 #define SOFTSERIAL_1_TIMER 2
114 #define SOFTSERIAL_2_TIMER 3
116 #define DEFIO_NO_PORTS
118 extern uint32_t SystemCoreClock;
120 #define U_ID_0 0
121 #define U_ID_1 1
122 #define U_ID_2 2
124 typedef struct
126 void* dummy;
127 } TIM_TypeDef;
129 typedef struct
131 void* dummy;
132 } TIM_OCInitTypeDef;
134 typedef struct {
135 void* dummy;
136 } DMA_TypeDef;
138 typedef struct {
139 void* dummy;
140 } DMA_Channel_TypeDef;
142 typedef struct
144 void* dummy;
145 } SPI_TypeDef;
147 typedef struct
149 void* dummy;
150 } I2C_TypeDef;
152 typedef enum {RESET = 0, SET = !RESET} FlagStatus, ITStatus;
153 typedef enum {DISABLE = 0, ENABLE = !DISABLE} FunctionalState;
154 typedef enum {TEST_IRQ = 0 } IRQn_Type;
155 typedef enum {
156 EXTI_Trigger_Rising = 0x08,
157 EXTI_Trigger_Falling = 0x0C,
158 EXTI_Trigger_Rising_Falling = 0x10
159 } EXTITrigger_TypeDef;
161 typedef struct
163 uint32_t IDR;
164 uint32_t ODR;
165 uint32_t BSRR;
166 uint32_t BRR;
167 } GPIO_TypeDef;
169 #define GPIOA_BASE ((intptr_t)0x0001)
171 typedef struct
173 uint32_t dummy;
174 } USART_TypeDef;
176 #define USART1 ((USART_TypeDef *)0x0001)
177 #define USART2 ((USART_TypeDef *)0x0002)
178 #define USART3 ((USART_TypeDef *)0x0003)
179 #define USART4 ((USART_TypeDef *)0x0004)
180 #define USART5 ((USART_TypeDef *)0x0005)
181 #define USART6 ((USART_TypeDef *)0x0006)
182 #define USART7 ((USART_TypeDef *)0x0007)
183 #define USART8 ((USART_TypeDef *)0x0008)
185 #define UART4 ((USART_TypeDef *)0x0004)
186 #define UART5 ((USART_TypeDef *)0x0005)
187 #define UART7 ((USART_TypeDef *)0x0007)
188 #define UART8 ((USART_TypeDef *)0x0008)
190 typedef enum
192 SITL_SIM_NONE,
193 SITL_SIM_REALFLIGHT,
194 SITL_SIM_XPLANE,
195 } SitlSim_e;
199 extern bool lockMainPID(void);
200 extern void unlockMainPID(void);
201 extern void parseArguments(int argc, char *argv[]);
202 extern char *strnstr(const char *s, const char *find, size_t slen);
203 extern int lookupAddress (char *, int, int, struct sockaddr *, socklen_t*);
205 #define IPADDRESS_PRINT_BUFLEN (INET6_ADDRSTRLEN + 16)
206 extern char *prettyPrintAddress(struct sockaddr*, char*, size_t);