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)
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/>.
26 #ifdef USE_TARGET_CONFIG
28 #include "common/axis.h"
30 #include "config/feature.h"
32 #include "drivers/light_led.h"
33 #include "drivers/pwm_esc_detect.h"
34 #include "drivers/sound_beeper.h"
36 #include "flight/pid.h"
38 #include "pg/beeper_dev.h"
39 #include "pg/gyrodev.h"
45 #include "io/serial.h"
47 #include "sensors/battery.h"
48 #include "sensors/gyro.h"
50 #include "telemetry/telemetry.h"
52 #include "hardware_revision.h"
54 #ifdef BRUSHED_MOTORS_PWM_RATE
55 #undef BRUSHED_MOTORS_PWM_RATE
58 #define BRUSHED_MOTORS_PWM_RATE 32000 // 32kHz
61 // alternative defaults settings for AlienFlight targets
62 void targetConfiguration(void)
64 gyroDeviceConfigMutable(0)->extiTag
= selectMPUIntExtiConfigByHardwareRevision();
66 /* depending on revision ... depends on the LEDs to be utilised. */
67 if (hardwareRevision
== AFF3_REV_2
) {
68 statusLedConfigMutable()->inversion
= 0
69 #ifdef LED0_A_INVERTED
72 #ifdef LED1_A_INVERTED
75 #ifdef LED2_A_INVERTED
80 for (int i
= 0; i
< STATUS_LED_NUMBER
; i
++) {
81 statusLedConfigMutable()->ioTags
[i
] = IO_TAG_NONE
;
84 statusLedConfigMutable()->ioTags
[0] = IO_TAG(LED0_A
);
87 statusLedConfigMutable()->ioTags
[1] = IO_TAG(LED1_A
);
90 statusLedConfigMutable()->ioTags
[2] = IO_TAG(LED2_A
);
93 pidConfigMutable()->pid_process_denom
= 4;
97 rxConfigMutable()->serialrx_provider
= SERIALRX_SPEKTRUM2048
;
98 rxConfigMutable()->spektrum_sat_bind
= 5;
99 rxConfigMutable()->spektrum_sat_bind_autoreset
= 1;
100 parseRcChannels("TAER1234", rxConfigMutable());
102 rxConfigMutable()->serialrx_provider
= SERIALRX_SBUS
;
103 rxConfigMutable()->serialrx_inverted
= true;
104 serialConfigMutable()->portConfigs
[findSerialPortIndexByIdentifier(SERIALRX_UART
)].functionMask
= FUNCTION_TELEMETRY_FRSKY_HUB
| FUNCTION_RX_SERIAL
;
105 telemetryConfigMutable()->telemetry_inverted
= false;
106 featureConfigSet(FEATURE_TELEMETRY
);
107 beeperDevConfigMutable()->isOpenDrain
= false;
108 beeperDevConfigMutable()->isInverted
= true;
109 parseRcChannels("AETR1234", rxConfigMutable());
112 if (getDetectedMotorType() == MOTOR_BRUSHED
) {
113 motorConfigMutable()->dev
.motorPwmRate
= BRUSHED_MOTORS_PWM_RATE
;
114 pidConfigMutable()->pid_process_denom
= 1;
117 for (uint8_t pidProfileIndex
= 0; pidProfileIndex
< PID_PROFILE_COUNT
; pidProfileIndex
++) {
118 pidProfile_t
*pidProfile
= pidProfilesMutable(pidProfileIndex
);
120 pidProfile
->pid
[PID_ROLL
].P
= 90;
121 pidProfile
->pid
[PID_ROLL
].I
= 44;
122 pidProfile
->pid
[PID_ROLL
].D
= 60;
123 pidProfile
->pid
[PID_PITCH
].P
= 90;
124 pidProfile
->pid
[PID_PITCH
].I
= 44;
125 pidProfile
->pid
[PID_PITCH
].D
= 60;
128 *customMotorMixerMutable(0) = (motorMixer_t
){ 1.0f
, -0.414178f
, 1.0f
, -1.0f
}; // REAR_R
129 *customMotorMixerMutable(1) = (motorMixer_t
){ 1.0f
, -0.414178f
, -1.0f
, 1.0f
}; // FRONT_R
130 *customMotorMixerMutable(2) = (motorMixer_t
){ 1.0f
, 0.414178f
, 1.0f
, 1.0f
}; // REAR_L
131 *customMotorMixerMutable(3) = (motorMixer_t
){ 1.0f
, 0.414178f
, -1.0f
, -1.0f
}; // FRONT_L
132 *customMotorMixerMutable(4) = (motorMixer_t
){ 1.0f
, -1.0f
, -0.414178f
, -1.0f
}; // MIDFRONT_R
133 *customMotorMixerMutable(5) = (motorMixer_t
){ 1.0f
, 1.0f
, -0.414178f
, 1.0f
}; // MIDFRONT_L
134 *customMotorMixerMutable(6) = (motorMixer_t
){ 1.0f
, -1.0f
, 0.414178f
, 1.0f
}; // MIDREAR_R
135 *customMotorMixerMutable(7) = (motorMixer_t
){ 1.0f
, 1.0f
, 0.414178f
, -1.0f
}; // MIDREAR_L