Firmware
|
Abstract class defining a mixer mixing zero or more inputs to one or more outputs. More...
#include <mixer.h>
Public Types | |
enum | Airmode : int32_t { disabled = 0, roll_pitch = 1, roll_pitch_yaw = 2 } |
typedef int(* | ControlCallback) (uintptr_t handle, uint8_t control_group, uint8_t control_index, float &control) |
Fetch a control value. More... | |
Public Member Functions | |
Mixer (ControlCallback control_cb, uintptr_t cb_handle) | |
Constructor. More... | |
virtual unsigned | mix (float *outputs, unsigned space)=0 |
Perform the mixing function. More... | |
virtual uint16_t | get_saturation_status (void)=0 |
Get the saturation status. More... | |
virtual void | groups_required (uint32_t &groups)=0 |
Analyses the mix configuration and updates a bitmask of groups that are required. More... | |
virtual void | set_max_delta_out_once (float delta_out_max) |
Empty method, only implemented for MultirotorMixer and MixerGroup class. More... | |
virtual unsigned | set_trim (float trim)=0 |
Set trim offset for this mixer. More... | |
virtual unsigned | get_trim (float *trim)=0 |
Get trim offset for this mixer. More... | |
virtual void | set_thrust_factor (float val) |
virtual void | set_airmode (Airmode airmode) |
Set airmode. More... | |
Public Attributes | |
Mixer * | _next |
next mixer in a list | |
Protected Member Functions | |
float | get_control (uint8_t group, uint8_t index) |
Invoke the client callback to fetch a control value. More... | |
Static Protected Member Functions | |
static float | scale (const mixer_scaler_s &scaler, float input) |
Perform simpler linear scaling. More... | |
static int | scale_check (struct mixer_scaler_s &scaler) |
Validate a scaler. More... | |
static const char * | findtag (const char *buf, unsigned &buflen, char tag) |
Find a tag. More... | |
static char | findnexttag (const char *buf, unsigned buflen) |
Find next tag and return it (0 is returned if no tag is found) More... | |
static const char * | skipline (const char *buf, unsigned &buflen) |
Skip a line. More... | |
static bool | string_well_formed (const char *buf, unsigned &buflen) |
Check wether the string is well formed and suitable for parsing. | |
Protected Attributes | |
ControlCallback | _control_cb |
client-supplied callback used when fetching control values | |
uintptr_t | _cb_handle |
Abstract class defining a mixer mixing zero or more inputs to one or more outputs.
typedef int(* Mixer::ControlCallback) (uintptr_t handle, uint8_t control_group, uint8_t control_index, float &control) |
Fetch a control value.
handle | Token passed when the callback is registered. |
control_group | The group to fetch the control from. |
control_index | The group-relative index to fetch the control from. |
control | The returned control |
Mixer::Mixer | ( | ControlCallback | control_cb, |
uintptr_t | cb_handle | ||
) |
Constructor.
control_cb | Callback invoked when reading controls. |
|
staticprotected |
Find next tag and return it (0 is returned if no tag is found)
buf | The buffer to operate on. |
buflen | length of the buffer. |
|
staticprotected |
Find a tag.
buf | The buffer to operate on. |
buflen | length of the buffer. |
tag | character to search for. |
|
protected |
Invoke the client callback to fetch a control value.
group | Control group to fetch from. |
index | Control index to fetch. |
|
pure virtual |
Get the saturation status.
Implemented in HelicopterMixer, MultirotorMixer, SimpleMixer, NullMixer, and MixerGroup.
|
pure virtual |
Get trim offset for this mixer.
Implemented in HelicopterMixer, MultirotorMixer, SimpleMixer, NullMixer, and MixerGroup.
|
pure virtual |
Analyses the mix configuration and updates a bitmask of groups that are required.
groups | A bitmask of groups (0-31) that the mixer requires. |
Implemented in HelicopterMixer, MultirotorMixer, SimpleMixer, NullMixer, and MixerGroup.
|
pure virtual |
Perform the mixing function.
outputs | Array into which mixed output(s) should be placed. |
space | The number of available entries in the output array; |
Implemented in HelicopterMixer, MultirotorMixer, SimpleMixer, NullMixer, and MixerGroup.
|
staticprotected |
Perform simpler linear scaling.
scaler | The scaler configuration. |
input | The value to be scaled. |
|
staticprotected |
Validate a scaler.
scaler | The scaler to be validated. |
|
inlinevirtual |
Set airmode.
Airmode allows the mixer to increase the total thrust in order to unsaturate the motors.
[in] | airmode | Select airmode type (0 = disabled, 1 = roll/pitch, 2 = roll/pitch/yaw) |
Reimplemented in MultirotorMixer, and MixerGroup.
|
inlinevirtual |
Empty method, only implemented for MultirotorMixer and MixerGroup class.
[in] | delta_out_max | Maximum delta output. |
Reimplemented in MultirotorMixer, and MixerGroup.
|
pure virtual |
Set trim offset for this mixer.
Implemented in HelicopterMixer, MultirotorMixer, SimpleMixer, NullMixer, and MixerGroup.
|
staticprotected |
Skip a line.
buf | The buffer to operate on. |
buflen | length of the buffer. |