NinjaFlight
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
mixer.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  motor_3d_config
 3d mode mixer settings (used when mixer_enable_3d_mode is called with true) More...
 
struct  pwm_output_config
 
struct  servo_config
 Configuration for each servo which is editable by the user. More...
 
struct  servo_profile
 
struct  mixer_rule_def
 mixer rule definition in new format More...
 
struct  mixer_config
 general mixer settings More...
 

Macros

#define MAX_SUPPORTED_MOTORS   12
 
#define MAX_SUPPORTED_SERVOS   8
 
#define MAX_SERVO_RULES   (2 * MAX_SUPPORTED_SERVOS)
 
#define MAX_SERVO_SPEED   UINT8_MAX
 
#define MAX_SERVO_BOXES   3
 
#define DEFAULT_SERVO_MIN   1000
 
#define DEFAULT_SERVO_MIDDLE   1500
 
#define DEFAULT_SERVO_MAX   2000
 
#define DEFAULT_SERVO_MIN_ANGLE   45
 
#define DEFAULT_SERVO_MAX_ANGLE   45
 
#define CHANNEL_FORWARDING_DISABLED   (uint8_t)0xff
 
#define MIXER_MAX_RULES   48
 

Enumerations

enum  mixer_input_t {
  MIXER_INPUT_GROUP_FC = 0, MIXER_INPUT_G0_ROLL = 0, MIXER_INPUT_G0_PITCH, MIXER_INPUT_G0_YAW,
  MIXER_INPUT_G0_THROTTLE, MIXER_INPUT_G0_TILT_PITCH, MIXER_INPUT_G0_SPOILERS, MIXER_INPUT_G0_AIRBREAKS,
  MIXER_INPUT_G0_LANDINGGEAR, MIXER_INPUT_GROUP_1 = (1 << 3), MIXER_INPUT_G1_ROLL = MIXER_INPUT_GROUP_1, MIXER_INPUT_G1_PITCH,
  MIXER_INPUT_G1_YAW, MIXER_INPUT_GROUP_GIMBAL = (2 << 3), MIXER_INPUT_G2_GIMBAL_ROLL = MIXER_INPUT_GROUP_GIMBAL, MIXER_INPUT_G2_GIMBAL_PITCH,
  MIXER_INPUT_G2_GIMBAL_YAW, MIXER_INPUT_G2_GIMBAL_SHUTTER, MIXER_INPUT_GROUP_RC = (3 << 3), MIXER_INPUT_G3_RC_ROLL = MIXER_INPUT_GROUP_RC,
  MIXER_INPUT_G3_RC_PITCH, MIXER_INPUT_G3_RC_YAW, MIXER_INPUT_G3_RC_THROTTLE, MIXER_INPUT_G3_RC_MODE,
  MIXER_INPUT_G3_RC_AUX1, MIXER_INPUT_G3_RC_AUX2, MIXER_INPUT_G3_RC_AUX3, MIXER_INPUT_GROUP_MOTOR_PASSTHROUGH = (4 << 3),
  MIXER_INPUT_G4_M1 = MIXER_INPUT_GROUP_MOTOR_PASSTHROUGH, MIXER_INPUT_G4_M2, MIXER_INPUT_G4_M3, MIXER_INPUT_G4_M4,
  MIXER_INPUT_G4_M5, MIXER_INPUT_G4_M6, MIXER_INPUT_G4_M7, MIXER_INPUT_G4_M8,
  MIXER_INPUT_COUNT
}
 
enum  mixer_output_t {
  MIXER_OUTPUT_MOTORS = 0, MIXER_OUTPUT_M1 = MIXER_OUTPUT_MOTORS, MIXER_OUTPUT_M2, MIXER_OUTPUT_M3,
  MIXER_OUTPUT_M4, MIXER_OUTPUT_M5, MIXER_OUTPUT_M6, MIXER_OUTPUT_M7,
  MIXER_OUTPUT_M8, MIXER_MAX_MOTORS = MIXER_OUTPUT_M8 - MIXER_OUTPUT_MOTORS + 1, MIXER_OUTPUT_SERVOS = MIXER_OUTPUT_M8 + 1, MIXER_OUTPUT_S1 = MIXER_OUTPUT_SERVOS,
  MIXER_OUTPUT_S2, MIXER_OUTPUT_S3, MIXER_OUTPUT_S4, MIXER_OUTPUT_S5,
  MIXER_OUTPUT_S6, MIXER_OUTPUT_S7, MIXER_OUTPUT_S8, MIXER_MAX_SERVOS = MIXER_OUTPUT_S8 - MIXER_OUTPUT_SERVOS + 1,
  MIXER_OUTPUT_COUNT = MIXER_OUTPUT_S8 + 1
}
 Mixer output channels. More...
 
enum  mixer_mode_t {
  MIXER_TRI = 1, MIXER_QUADP = 2, MIXER_QUADX = 3, MIXER_BICOPTER = 4,
  MIXER_GIMBAL = 5, MIXER_Y6 = 6, MIXER_HEX6 = 7, MIXER_FLYING_WING = 8,
  MIXER_Y4 = 9, MIXER_HEX6X = 10, MIXER_OCTOX8 = 11, MIXER_OCTOFLATP = 12,
  MIXER_OCTOFLATX = 13, MIXER_AIRPLANE = 14, MIXER_HELI_120_CCPM = 15, MIXER_HELI_90_DEG = 16,
  MIXER_VTAIL4 = 17, MIXER_HEX6H = 18, MIXER_PPM_TO_SERVO = 19, MIXER_DUALCOPTER = 20,
  MIXER_SINGLECOPTER = 21, MIXER_ATAIL4 = 22, MIXER_QUADX_TILT1 = 23, MIXER_QUADX_TILT2 = 24,
  MIXER_CUSTOM, MIXER_CUSTOM_AIRPLANE, MIXER_CUSTOM_TRI, MIXER_MODE_COUNT
}
 sets mixer frame configuration More...
 

Functions

struct motor_3d_config __attribute__ ((packed))
 
struct servo_config __attribute__ ((__packed__))
 

Variables

typedef __attribute__
 
uint16_t deadband3d_low
 
uint16_t deadband3d_high
 
uint16_t neutral3d
 
uint16_t minthrottle
 
uint16_t maxthrottle
 
uint16_t mincommand
 
uint16_t servoCenterPulse
 
uint16_t motor_pwm_rate
 
uint16_t servo_pwm_rate
 
int16_t min
 Minimum pwm value that is sent to the servo. More...
 
int16_t max
 Maximum pwm value that is sent to the servo. More...
 
int16_t middle
 PWM value that is sent to center the servo (usually 1500) More...
 
int8_t rate
 range [-125;+125] ; can be used to adjust a rate 0-125% and a direction More...
 
uint8_t angleAtMin
 range [0;180] the measured angle in degrees from the middle when the servo is at the 'min' value. More...
 
uint8_t angleAtMax
 range [0;180] the measured angle in degrees from the middle when the servo is at the 'max' value. More...
 
int8_t forwardFromChannel
 RX channel index, 0 based. See CHANNEL_FORWARDING_DISABLED. More...
 
uint32_t reversedSources
 the direction of servo movement for each input source of the servo mixer, bit set=inverted More...
 
struct servo_config servoConf [MAX_SUPPORTED_SERVOS]
 
uint8_t output
 
uint8_t input
 
int16_t scale
 
uint8_t mixerMode
 one of the mixer_mode_t values More...
 
uint8_t pid_at_min_throttle
 when enabled pids are used at minimum throttle (valid values 0 or 1) More...
 
int8_t yaw_motor_direction
 allows reversing yaw direction (values -1 or 1) More...
 
uint16_t yaw_jump_prevention_limit
 make limit configurable (original fixed value was 100) More...
 
uint8_t tri_unarmed_servo
 send tail servo correction pulses even when unarmed More...
 
float servo_lowpass_freq
 lowpass servo filter frequency selection; 1/1000ths of loop freq More...
 
int8_t servo_lowpass_enable
 enable/disable lowpass filter for servo output More...
 
struct mixer_rule_def custom_rules [MIXER_MAX_RULES]
 

Macro Definition Documentation

#define CHANNEL_FORWARDING_DISABLED   (uint8_t)0xff
#define DEFAULT_SERVO_MAX   2000
#define DEFAULT_SERVO_MAX_ANGLE   45
#define DEFAULT_SERVO_MIDDLE   1500
#define DEFAULT_SERVO_MIN   1000
#define DEFAULT_SERVO_MIN_ANGLE   45
#define MAX_SERVO_BOXES   3
#define MAX_SERVO_RULES   (2 * MAX_SUPPORTED_SERVOS)
#define MAX_SERVO_SPEED   UINT8_MAX
#define MAX_SUPPORTED_MOTORS   12
#define MAX_SUPPORTED_SERVOS   8
#define MIXER_MAX_RULES   48

Enumeration Type Documentation

Mixer input commands that command the mixer to either spin or translate the frame in specific direction. All movement is in body frame and movements that are not physically supported by the frame will be ignored.

Enumerator
MIXER_INPUT_GROUP_FC 
MIXER_INPUT_G0_ROLL 

flight control angular rate for x axis

MIXER_INPUT_G0_PITCH 

flight control angular rate for y axis

MIXER_INPUT_G0_YAW 

flight control angular rate for z axis

MIXER_INPUT_G0_THROTTLE 

flight control throttle

MIXER_INPUT_G0_TILT_PITCH 

flight control tilt pitch

MIXER_INPUT_G0_SPOILERS 

flight control spoilers

MIXER_INPUT_G0_AIRBREAKS 

flight control airbreaks

MIXER_INPUT_G0_LANDINGGEAR 

flight control landing gear

MIXER_INPUT_GROUP_1 
MIXER_INPUT_G1_ROLL 
MIXER_INPUT_G1_PITCH 
MIXER_INPUT_G1_YAW 
MIXER_INPUT_GROUP_GIMBAL 
MIXER_INPUT_G2_GIMBAL_ROLL 

gimbal roll

MIXER_INPUT_G2_GIMBAL_PITCH 

gimbal pitch

MIXER_INPUT_G2_GIMBAL_YAW 

gimbal yaw

MIXER_INPUT_G2_GIMBAL_SHUTTER 

gimbal shutter

MIXER_INPUT_GROUP_RC 
MIXER_INPUT_G3_RC_ROLL 

rc roll input

MIXER_INPUT_G3_RC_PITCH 
MIXER_INPUT_G3_RC_YAW 
MIXER_INPUT_G3_RC_THROTTLE 
MIXER_INPUT_G3_RC_MODE 
MIXER_INPUT_G3_RC_AUX1 
MIXER_INPUT_G3_RC_AUX2 
MIXER_INPUT_G3_RC_AUX3 
MIXER_INPUT_GROUP_MOTOR_PASSTHROUGH 
MIXER_INPUT_G4_M1 
MIXER_INPUT_G4_M2 
MIXER_INPUT_G4_M3 
MIXER_INPUT_G4_M4 
MIXER_INPUT_G4_M5 
MIXER_INPUT_G4_M6 
MIXER_INPUT_G4_M7 
MIXER_INPUT_G4_M8 
MIXER_INPUT_COUNT 

sets mixer frame configuration

Enumerator
MIXER_TRI 
MIXER_QUADP 
MIXER_QUADX 
MIXER_BICOPTER 
MIXER_GIMBAL 
MIXER_Y6 
MIXER_HEX6 
MIXER_FLYING_WING 
MIXER_Y4 
MIXER_HEX6X 
MIXER_OCTOX8 
MIXER_OCTOFLATP 
MIXER_OCTOFLATX 
MIXER_AIRPLANE 
MIXER_HELI_120_CCPM 
MIXER_HELI_90_DEG 
MIXER_VTAIL4 
MIXER_HEX6H 
MIXER_PPM_TO_SERVO 
MIXER_DUALCOPTER 
MIXER_SINGLECOPTER 
MIXER_ATAIL4 
MIXER_QUADX_TILT1 
MIXER_QUADX_TILT2 
MIXER_CUSTOM 
MIXER_CUSTOM_AIRPLANE 
MIXER_CUSTOM_TRI 
MIXER_MODE_COUNT 

Mixer output channels.

Enumerator
MIXER_OUTPUT_MOTORS 
MIXER_OUTPUT_M1 
MIXER_OUTPUT_M2 
MIXER_OUTPUT_M3 
MIXER_OUTPUT_M4 
MIXER_OUTPUT_M5 
MIXER_OUTPUT_M6 
MIXER_OUTPUT_M7 
MIXER_OUTPUT_M8 
MIXER_MAX_MOTORS 
MIXER_OUTPUT_SERVOS 
MIXER_OUTPUT_S1 
MIXER_OUTPUT_S2 
MIXER_OUTPUT_S3 
MIXER_OUTPUT_S4 
MIXER_OUTPUT_S5 
MIXER_OUTPUT_S6 
MIXER_OUTPUT_S7 
MIXER_OUTPUT_S8 
MIXER_MAX_SERVOS 
MIXER_OUTPUT_COUNT 

Function Documentation

struct motor_3d_config __attribute__ ( (packed)  )
struct servo_config __attribute__ ( (__packed__)  )

Variable Documentation

typedef __attribute__
uint8_t angleAtMax

range [0;180] the measured angle in degrees from the middle when the servo is at the 'max' value.

uint8_t angleAtMin

range [0;180] the measured angle in degrees from the middle when the servo is at the 'min' value.

struct mixer_rule_def custom_rules[MIXER_MAX_RULES]
uint16_t deadband3d_high
uint16_t deadband3d_low
int8_t forwardFromChannel

RX channel index, 0 based. See CHANNEL_FORWARDING_DISABLED.

uint8_t input
int16_t max

Maximum pwm value that is sent to the servo.

uint16_t maxthrottle
int16_t middle

PWM value that is sent to center the servo (usually 1500)

int16_t min

Minimum pwm value that is sent to the servo.

uint16_t mincommand
uint16_t minthrottle
uint8_t mixerMode

one of the mixer_mode_t values

uint16_t motor_pwm_rate
uint16_t neutral3d
uint8_t output
uint8_t pid_at_min_throttle

when enabled pids are used at minimum throttle (valid values 0 or 1)

int8_t rate

range [-125;+125] ; can be used to adjust a rate 0-125% and a direction

uint32_t reversedSources

the direction of servo movement for each input source of the servo mixer, bit set=inverted

int16_t scale
int8_t servo_lowpass_enable

enable/disable lowpass filter for servo output

float servo_lowpass_freq

lowpass servo filter frequency selection; 1/1000ths of loop freq

uint16_t servo_pwm_rate
uint16_t servoCenterPulse
uint8_t tri_unarmed_servo

send tail servo correction pulses even when unarmed

uint16_t yaw_jump_prevention_limit

make limit configurable (original fixed value was 100)

int8_t yaw_motor_direction

allows reversing yaw direction (values -1 or 1)