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/>.
25 #include "common/time.h"
27 #include "drivers/io_types.h"
28 #include "drivers/pwm_output.h"
30 #define QUAD_MOTOR_COUNT 4
32 // Note: this is called MultiType/MULTITYPE_* in baseflight.
33 typedef enum mixerMode
42 MIXER_FLYING_WING
= 8,
48 MIXER_AIRPLANE
= 14, // airplane / singlecopter / dualcopter (not yet properly supported)
49 MIXER_HELI_120_CCPM
= 15,
50 MIXER_HELI_90_DEG
= 16,
53 MIXER_PPM_TO_SERVO
= 19, // PPM -> servo relay
54 MIXER_DUALCOPTER
= 20,
55 MIXER_SINGLECOPTER
= 21,
58 MIXER_CUSTOM_AIRPLANE
= 24,
59 MIXER_CUSTOM_TRI
= 25,
63 typedef enum mixerType
70 // Custom mixer data per motor
71 typedef struct motorMixer_s
{
78 PG_DECLARE_ARRAY(motorMixer_t
, MAX_SUPPORTED_MOTORS
, customMotorMixer
);
80 // Custom mixer configuration
81 typedef struct mixer_s
{
84 const motorMixer_t
*motor
;
87 typedef struct mixerConfig_s
{
89 bool yaw_motors_reversed
;
90 uint8_t crashflip_motor_percent
;
91 uint8_t crashflip_expo
;
95 PG_DECLARE(mixerConfig_t
, mixerConfig
);
97 #define CHANNEL_FORWARDING_DISABLED (uint8_t)0xFF
99 extern const mixer_t mixers
[];
100 extern float motor
[MAX_SUPPORTED_MOTORS
];
101 extern float motor_disarmed
[MAX_SUPPORTED_MOTORS
];
104 uint8_t getMotorCount(void);
105 float getMotorMixRange(void);
106 bool areMotorsRunning(void);
108 void mixerLoadMix(int index
, motorMixer_t
*customMixers
);
109 void initEscEndpoints(void);
110 void mixerInit(mixerMode_e mixerMode
);
111 void mixerInitProfile(void);
113 void mixerResetDisarmedMotors(void);
114 void mixTable(timeUs_t currentTimeUs
);
115 void stopMotors(void);
116 void writeMotors(void);
118 bool mixerIsTricopter(void);
120 void mixerSetThrottleAngleCorrection(int correctionValue
);
121 float mixerGetThrottle(void);
122 mixerMode_e
getMixerMode(void);
123 bool mixerModeIsFixedWing(mixerMode_e mixerMode
);
124 bool isFixedWing(void);
126 float getMotorOutputLow(void);
127 float getMotorOutputHigh(void);