2 * This file is part of Cleanflight.
4 * Cleanflight is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * Cleanflight is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
20 // FIXME some of these are flight modes, some of these are general status indicators
23 PREVENT_ARMING
= (1 << 1),
25 WAS_EVER_ARMED
= (1 << 3)
28 extern uint8_t armingFlags
;
30 #define DISABLE_ARMING_FLAG(mask) (armingFlags &= ~(mask))
31 #define ENABLE_ARMING_FLAG(mask) (armingFlags |= (mask))
32 #define ARMING_FLAG(mask) (armingFlags & (mask))
35 ANGLE_MODE
= (1 << 0),
36 HORIZON_MODE
= (1 << 1),
39 GPS_HOME_MODE
= (1 << 4),
40 GPS_HOLD_MODE
= (1 << 5),
41 HEADFREE_MODE
= (1 << 6),
42 UNUSED_MODE
= (1 << 7), // old autotune
43 PASSTHRU_MODE
= (1 << 8),
44 SONAR_MODE
= (1 << 9),
45 FAILSAFE_MODE
= (1 << 10)
48 extern uint16_t flightModeFlags
;
50 #define DISABLE_FLIGHT_MODE(mask) disableFlightMode(mask)
51 #define ENABLE_FLIGHT_MODE(mask) enableFlightMode(mask)
52 #define FLIGHT_MODE(mask) (flightModeFlags & (mask))
55 GPS_FIX_HOME
= (1 << 0),
57 CALIBRATE_MAG
= (1 << 2),
58 SMALL_ANGLE
= (1 << 3),
59 FIXED_WING
= (1 << 4) // set when in flying_wing or airplane mode. currently used by althold selection code
62 #define DISABLE_STATE(mask) (stateFlags &= ~(mask))
63 #define ENABLE_STATE(mask) (stateFlags |= (mask))
64 #define STATE(mask) (stateFlags & (mask))
66 extern uint8_t stateFlags
;
68 uint16_t enableFlightMode(flightModeFlags_e mask
);
69 uint16_t disableFlightMode(flightModeFlags_e mask
);
71 bool sensors(uint32_t mask
);
72 void sensorsSet(uint32_t mask
);
73 void sensorsClear(uint32_t mask
);
74 uint32_t sensorsMask(void);