Create release.yml
[betaflight.git] / src / main / target / NUCLEOF103RG / config.c
bloba30e7c9e0b0186aaa95fa47ce6055ef28d7bcc6b
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 #include <stdbool.h>
22 #include <stdint.h>
24 #include "platform.h"
26 #ifdef USE_TARGET_CONFIG
28 #include "common/axis.h"
29 #include "common/utils.h"
31 #include "drivers/io.h"
33 #include "config/config.h"
34 #include "fc/rc_controls.h"
35 #include "fc/controlrate_profile.h"
37 #include "flight/failsafe.h"
38 #include "flight/pid.h"
40 #include "pg/rx.h"
42 #include "rx/rx.h"
44 #include "sensors/acceleration.h"
45 #include "sensors/compass.h"
46 #include "sensors/gyro.h"
48 #include "pg/beeper_dev.h"
49 #include "pg/flash.h"
50 #include "pg/motor.h"
52 #include "hardware_revision.h"
54 void targetConfiguration(void)
56 if (hardwareRevision >= NAZE32_REV5) {
57 // naze rev4 and below used opendrain to PNP for buzzer. Rev5 and above use PP to NPN.
58 beeperDevConfigMutable()->isOpenDrain = false;
59 beeperDevConfigMutable()->isInverted = true;
60 } else {
61 beeperDevConfigMutable()->isOpenDrain = true;
62 beeperDevConfigMutable()->isInverted = false;
63 flashConfigMutable()->csTag = IO_TAG_NONE;
66 #ifdef MAG_INT_EXTI
67 if (hardwareRevision < NAZE32_REV5) {
68 compassConfigMutable()->interruptTag = IO_TAG(PB12);
70 #endif
73 void targetValidateConfiguration(void)
75 if (hardwareRevision < NAZE32_REV5 && accelerometerConfig()->acc_hardware == ACC_ADXL345) {
76 accelerometerConfigMutable()->acc_hardware = ACC_NONE;
79 #endif