Added custom (switch) box naming.
[betaflight.git] / src / main / config / config.h
blob7c94486ff7a65d3bd9f7c90b561f6248dff25fd1
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_DEFAULTS_BARE = 0,
32 CONFIGURATION_STATE_DEFAULTS_CUSTOM,
33 CONFIGURATION_STATE_CONFIGURED,
34 } configurationState_e;
36 typedef enum {
37 SCHEDULER_OPTIMIZE_RATE_OFF = 0,
38 SCHEDULER_OPTIMIZE_RATE_ON,
39 SCHEDULER_OPTIMIZE_RATE_AUTO,
40 } schedulerOptimizeRate_e;
42 typedef struct pilotConfig_s {
43 char name[MAX_NAME_LENGTH + 1];
44 char displayName[MAX_NAME_LENGTH + 1];
45 } pilotConfig_t;
47 PG_DECLARE(pilotConfig_t, pilotConfig);
49 typedef struct systemConfig_s {
50 uint8_t pidProfileIndex;
51 uint8_t activeRateProfile;
52 uint8_t debug_mode;
53 uint8_t task_statistics;
54 uint8_t rateProfile6PosSwitch;
55 uint8_t cpu_overclock;
56 uint8_t powerOnArmingGraceTime; // in seconds
57 char boardIdentifier[sizeof(TARGET_BOARD_IDENTIFIER) + 1];
58 uint8_t hseMhz; // Not used for non-F4 targets
59 uint8_t configurationState; // The state of the configuration (defaults / configured)
60 uint8_t schedulerOptimizeRate;
61 uint8_t enableStickArming; // boolean that determines whether stick arming can be used
62 } systemConfig_t;
64 PG_DECLARE(systemConfig_t, systemConfig);
66 struct pidProfile_s;
67 extern struct pidProfile_s *currentPidProfile;
69 void initEEPROM(void);
70 bool resetEEPROM(bool useCustomDefaults);
71 bool readEEPROM(void);
72 void writeEEPROM(void);
73 void writeUnmodifiedConfigToEEPROM(void);
74 void ensureEEPROMStructureIsValid(void);
76 void saveConfigAndNotify(void);
77 void validateAndFixGyroConfig(void);
79 void setConfigDirty(void);
80 bool isConfigDirty(void);
82 uint8_t getCurrentPidProfileIndex(void);
83 void changePidProfile(uint8_t pidProfileIndex);
84 void changePidProfileFromCellCount(uint8_t cellCount);
85 struct pidProfile_s;
86 void resetPidProfile(struct pidProfile_s *profile);
88 uint8_t getCurrentControlRateProfileIndex(void);
89 void changeControlRateProfile(uint8_t profileIndex);
91 bool canSoftwareSerialBeUsed(void);
93 uint16_t getCurrentMinthrottle(void);
95 void resetConfig(void);
96 void targetConfiguration(void);
97 void targetValidateConfiguration(void);
99 bool isSystemConfigured(void);
100 void setRebootRequired(void);
101 bool getRebootRequired(void);