Update cloud build defines (#14080)
[betaflight.git] / src / main / config / config.h
blob94118a86116cb48b8cd16de739573062a83ef120
1 /*
2 * This file is part of Cleanflight and Betaflight.
4 * Cleanflight and Betaflight are free software. You can redistribute
5 * this software and/or modify this software under the terms of the
6 * GNU General Public License as published by the Free Software
7 * Foundation, either version 3 of the License, or (at your option)
8 * any later version.
10 * Cleanflight and Betaflight are distributed in the hope that they
11 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
12 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * See the GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this software.
18 * If not, see <http://www.gnu.org/licenses/>.
21 #pragma once
23 #include <stdint.h>
24 #include <stdbool.h>
26 #include "pg/pg.h"
28 #define MAX_NAME_LENGTH 16u
30 typedef enum {
31 CONFIGURATION_STATE_UNCONFIGURED = 0,
32 CONFIGURATION_STATE_CONFIGURED,
33 } configurationState_e;
35 typedef struct pilotConfig_s {
36 char craftName[MAX_NAME_LENGTH + 1];
37 char pilotName[MAX_NAME_LENGTH + 1];
38 } pilotConfig_t;
40 PG_DECLARE(pilotConfig_t, pilotConfig);
42 typedef struct systemConfig_s {
43 uint8_t pidProfileIndex;
44 uint8_t activeRateProfile;
45 uint8_t debug_mode;
46 uint8_t task_statistics;
47 uint8_t rateProfile6PosSwitch;
48 uint8_t cpu_overclock;
49 uint8_t powerOnArmingGraceTime; // in seconds
50 char boardIdentifier[sizeof(TARGET_BOARD_IDENTIFIER) + 1];
51 uint8_t hseMhz; // Only used for F4 and G4 targets
52 uint8_t configurationState; // The state of the configuration (defaults / configured)
53 uint8_t enableStickArming; // boolean that determines whether stick arming can be used
54 } systemConfig_t;
56 PG_DECLARE(systemConfig_t, systemConfig);
58 struct pidProfile_s;
59 extern struct pidProfile_s *currentPidProfile;
61 void initEEPROM(void);
62 bool resetEEPROM(void);
63 bool readEEPROM(void);
64 void writeEEPROM(void);
65 void writeUnmodifiedConfigToEEPROM(void);
66 void ensureEEPROMStructureIsValid(void);
68 void saveConfigAndNotify(void);
69 void validateAndFixGyroConfig(void);
70 #ifdef USE_BLACKBOX
71 void validateAndFixBlackBox(void);
72 #endif
74 void setConfigDirty(void);
75 bool isConfigDirty(void);
77 uint8_t getCurrentPidProfileIndex(void);
78 void changePidProfile(uint8_t pidProfileIndex);
79 void changePidProfileFromCellCount(uint8_t cellCount);
81 uint8_t getCurrentControlRateProfileIndex(void);
82 void changeControlRateProfile(uint8_t profileIndex);
84 bool canSoftwareSerialBeUsed(void);
86 void resetConfig(void);
87 void targetConfiguration(void);
88 void targetValidateConfiguration(void);
90 bool isSystemConfigured(void);
91 void setRebootRequired(void);
92 bool getRebootRequired(void);
93 bool isEepromWriteInProgress(void);