Add Winbond 25Q128 flash driver
[betaflight.git] / src / main / target / FF_PIKOBLX / config.c
blob2f945a73d03f1d504afc7328d0412885b410f587
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 <stdint.h>
22 #include <stdbool.h>
24 #include "platform.h"
26 #ifdef USE_TARGET_CONFIG
27 #include "common/axis.h"
29 #include "config/feature.h"
31 #include "drivers/pwm_esc_detect.h"
33 #include "config/config.h"
34 #include "fc/controlrate_profile.h"
36 #include "flight/pid.h"
38 #include "pg/rx.h"
39 #include "pg/motor.h"
41 #include "rx/rx.h"
43 #include "io/serial.h"
45 #include "telemetry/telemetry.h"
47 #include "sensors/battery.h"
49 #ifdef BRUSHED_MOTORS_PWM_RATE
50 #undef BRUSHED_MOTORS_PWM_RATE
51 #endif
53 #define BRUSHED_MOTORS_PWM_RATE 32000 // 32kHz
55 void targetConfiguration(void)
57 if (getDetectedMotorType() == MOTOR_BRUSHED) {
58 motorConfigMutable()->dev.motorPwmRate = BRUSHED_MOTORS_PWM_RATE;
59 motorConfigMutable()->minthrottle = 1049;
61 #if defined(FF_ACROWHOOPSP)
62 rxConfigMutable()->serialrx_provider = SERIALRX_SPEKTRUM2048;
63 rxConfigMutable()->spektrum_sat_bind = 5;
64 rxConfigMutable()->spektrum_sat_bind_autoreset = 1;
65 #else
66 serialConfigMutable()->portConfigs[findSerialPortIndexByIdentifier(SERIAL_PORT_USART2)].functionMask = FUNCTION_TELEMETRY_FRSKY_HUB;
67 rxConfigMutable()->serialrx_inverted = true;
68 featureConfigSet(FEATURE_TELEMETRY);
69 #endif
70 parseRcChannels("TAER1234", rxConfigMutable());
72 for (uint8_t pidProfileIndex = 0; pidProfileIndex < PID_PROFILE_COUNT; pidProfileIndex++) {
73 pidProfile_t *pidProfile = pidProfilesMutable(pidProfileIndex);
75 pidProfile->pid[PID_ROLL].P = 80;
76 pidProfile->pid[PID_ROLL].I = 37;
77 pidProfile->pid[PID_ROLL].D = 35;
78 pidProfile->pid[PID_PITCH].P = 100;
79 pidProfile->pid[PID_PITCH].I = 37;
80 pidProfile->pid[PID_PITCH].D = 35;
81 pidProfile->pid[PID_YAW].P = 180;
82 pidProfile->pid[PID_YAW].D = 45;
85 for (uint8_t rateProfileIndex = 0; rateProfileIndex < CONTROL_RATE_PROFILE_COUNT; rateProfileIndex++) {
86 controlRateConfig_t *controlRateConfig = controlRateProfilesMutable(rateProfileIndex);
88 controlRateConfig->rcRates[FD_ROLL] = 100;
89 controlRateConfig->rcRates[FD_PITCH] = 100;
90 controlRateConfig->rcRates[FD_YAW] = 100;
91 controlRateConfig->rcExpo[FD_ROLL] = 15;
92 controlRateConfig->rcExpo[FD_PITCH] = 15;
93 controlRateConfig->rcExpo[FD_YAW] = 15;
94 controlRateConfig->rates[PID_ROLL] = 80;
95 controlRateConfig->rates[PID_PITCH] = 80;
96 controlRateConfig->rates[PID_YAW] = 80;
100 #endif