Merge pull request #9335 from iNavFlight/MrD_Add-odometer-to-OSD
[inav.git] / src / main / config / feature.c
blob042509629d1ef4a4c7aa610d693be0794c863330
1 /*
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/>.
18 #include <stdbool.h>
19 #include <stdint.h>
21 #include "platform.h"
23 #include "config/feature.h"
25 static EXTENDED_FASTRAM uint32_t activeFeaturesLatch = 0;
27 void latchActiveFeatures(void)
29 activeFeaturesLatch = featureConfig()->enabledFeatures;
32 bool featureConfigured(uint32_t mask)
34 return (featureConfig()->enabledFeatures & mask) == mask;
37 bool feature(uint32_t mask)
39 // Check for ALL masked features
40 return (activeFeaturesLatch & mask) == mask;
43 void featureSet(uint32_t mask)
45 featureConfigMutable()->enabledFeatures |= mask;
48 void featureClear(uint32_t mask)
50 featureConfigMutable()->enabledFeatures &= ~(mask);
53 void featureClearAll(void)
55 featureConfigMutable()->enabledFeatures = 0;
58 uint32_t featureMask(void)
60 return featureConfig()->enabledFeatures;