|
|
@ -0,0 +1,110 @@ |
|
|
|
/* |
|
|
|
* This file is part of Cleanflight. |
|
|
|
* |
|
|
|
* Cleanflight is free software: you can redistribute it and/or modify |
|
|
|
* it under the terms of the GNU General Public License as published by |
|
|
|
* the Free Software Foundation, either version 3 of the License, or |
|
|
|
* (at your option) any later version. |
|
|
|
* |
|
|
|
* Cleanflight is distributed in the hope that it will be useful, |
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
|
|
* GNU General Public License for more details. |
|
|
|
* |
|
|
|
* You should have received a copy of the GNU General Public License |
|
|
|
* along with Cleanflight. If not, see <http://www.gnu.org/licenses/>. |
|
|
|
*/ |
|
|
|
|
|
|
|
#include <stdbool.h> |
|
|
|
#include <stdint.h> |
|
|
|
#include <string.h> |
|
|
|
|
|
|
|
#include "platform.h" |
|
|
|
|
|
|
|
#include "common/axis.h" |
|
|
|
#include "common/color.h" |
|
|
|
#include "common/maths.h" |
|
|
|
|
|
|
|
#include "drivers/sensor.h" |
|
|
|
#include "drivers/accgyro.h" |
|
|
|
#include "drivers/compass.h" |
|
|
|
#include "drivers/system.h" |
|
|
|
#include "drivers/gpio.h" |
|
|
|
#include "drivers/timer.h" |
|
|
|
#include "drivers/pwm_rx.h" |
|
|
|
#include "drivers/rx_nrf24l01.h" |
|
|
|
#include "drivers/serial.h" |
|
|
|
|
|
|
|
#include "sensors/sensors.h" |
|
|
|
#include "sensors/gyro.h" |
|
|
|
#include "sensors/compass.h" |
|
|
|
#include "sensors/acceleration.h" |
|
|
|
#include "sensors/barometer.h" |
|
|
|
#include "sensors/boardalignment.h" |
|
|
|
#include "sensors/battery.h" |
|
|
|
|
|
|
|
#include "io/beeper.h" |
|
|
|
#include "io/serial.h" |
|
|
|
#include "io/gimbal.h" |
|
|
|
#include "io/escservo.h" |
|
|
|
#include "fc/rc_controls.h" |
|
|
|
#include "fc/rc_curves.h" |
|
|
|
#include "io/ledstrip.h" |
|
|
|
#include "io/gps.h" |
|
|
|
|
|
|
|
#include "rx/rx.h" |
|
|
|
#include "rx/nrf24.h" |
|
|
|
|
|
|
|
#include "blackbox/blackbox_io.h" |
|
|
|
|
|
|
|
#include "telemetry/telemetry.h" |
|
|
|
|
|
|
|
#include "flight/mixer.h" |
|
|
|
#include "flight/pid.h" |
|
|
|
#include "flight/imu.h" |
|
|
|
#include "flight/failsafe.h" |
|
|
|
#include "flight/navigation_rewrite.h" |
|
|
|
|
|
|
|
#include "fc/runtime_config.h" |
|
|
|
|
|
|
|
#include "config/config.h" |
|
|
|
|
|
|
|
#include "config/config_profile.h" |
|
|
|
#include "config/config_master.h" |
|
|
|
|
|
|
|
static uint32_t activeFeaturesLatch = 0; |
|
|
|
|
|
|
|
void latchActiveFeatures() |
|
|
|
{ |
|
|
|
activeFeaturesLatch = masterConfig.enabledFeatures; |
|
|
|
} |
|
|
|
|
|
|
|
bool featureConfigured(uint32_t mask) |
|
|
|
{ |
|
|
|
return masterConfig.enabledFeatures & mask; |
|
|
|
} |
|
|
|
|
|
|
|
bool feature(uint32_t mask) |
|
|
|
{ |
|
|
|
return activeFeaturesLatch & mask; |
|
|
|
} |
|
|
|
|
|
|
|
void featureSet(uint32_t mask) |
|
|
|
{ |
|
|
|
masterConfig.enabledFeatures |= mask; |
|
|
|
} |
|
|
|
|
|
|
|
void featureClear(uint32_t mask) |
|
|
|
{ |
|
|
|
masterConfig.enabledFeatures &= ~(mask); |
|
|
|
} |
|
|
|
|
|
|
|
void featureClearAll() |
|
|
|
{ |
|
|
|
masterConfig.enabledFeatures = 0; |
|
|
|
} |
|
|
|
|
|
|
|
uint32_t featureMask(void) |
|
|
|
{ |
|
|
|
return masterConfig.enabledFeatures; |
|
|
|
} |