#include "../config/rx.h"
#include "../config/rc_controls.h"
#include "rc_command.h"
#include <stdbool.h>
Go to the source code of this file.
|
enum | rc_key_t {
RC_KEY_IDLE,
RC_KEY_GYROCAL,
RC_KEY_ACCCAL,
RC_KEY_MAGCAL,
RC_KEY_ACC_INFLIGHT_CALIB,
RC_KEY_PROFILE1,
RC_KEY_PROFILE2,
RC_KEY_PROFILE3,
RC_KEY_SAVE,
RC_KEY_STICK_ARM,
RC_KEY_STICK_DISARM,
RC_KEY_ACC_TRIM_PITCH_INC,
RC_KEY_ACC_TRIM_PITCH_DEC,
RC_KEY_ACC_TRIM_ROLL_INC,
RC_KEY_ACC_TRIM_ROLL_DEC,
RC_KEY_DISPLAY_OFF,
RC_KEY_DISPLAY_ON,
RC_KEY_FUNC_LEVEL,
RC_KEY_FUNC_ARM,
RC_KEY_FUNC_BLEND,
RC_KEY_FUNC_ALTSTAB,
RC_KEY_FUNC_HEADSTAB,
RC_KEY_FUNC_HEADFIX,
RC_KEY_FUNC_CALIBRATE,
RC_KEY_FUNC_BEEPER,
RC_NUM_KEYS
} |
|
enum | rc_key_state_t { RC_KEY_DISABLED,
RC_KEY_PRESSED,
RC_KEY_RELEASED
} |
|
enum | throttleStatus_e { THROTTLE_LOW = 0,
THROTTLE_HIGH
} |
|
enum | rollPitchStatus_e { NOT_CENTERED = 0,
CENTERED
} |
|
#define CHANNEL_RANGE_MAX 2100 |
#define CHANNEL_RANGE_MIN 900 |
#define CONTROL_RATE_CONFIG_ROLL_PITCH_RATE_MAX 100 |
#define CONTROL_RATE_CONFIG_TPA_MAX 100 |
#define CONTROL_RATE_CONFIG_YAW_RATE_MAX 255 |
#define MIN_MODE_RANGE_STEP 0 |
#define RC_KEY_REPEAT_MS 200 |
This enum defines key state. To support cases where an rc range is not configured (ie you can't really tell if the key is pressed or released) the third option has been added which is returned by rc_key_state() if the key does not exist.
Enumerator |
---|
RC_KEY_DISABLED |
returned by rc_key_state() if the key does not exist (not configured etc.)
|
RC_KEY_PRESSED |
returned by rc_key_state() when the key is pressed
|
RC_KEY_RELEASED |
returned by rc_key_state() when the key is not pressed
|
Defines supported virtual keys. Certain stick combinations may trigger these keys. Most of these keys specify a kind of virtual rc keyboard. How they are actually interpreted is up to the current state of the flight controller.
Enumerator |
---|
RC_KEY_IDLE |
|
RC_KEY_GYROCAL |
|
RC_KEY_ACCCAL |
|
RC_KEY_MAGCAL |
|
RC_KEY_ACC_INFLIGHT_CALIB |
|
RC_KEY_PROFILE1 |
|
RC_KEY_PROFILE2 |
|
RC_KEY_PROFILE3 |
|
RC_KEY_SAVE |
|
RC_KEY_STICK_ARM |
|
RC_KEY_STICK_DISARM |
|
RC_KEY_ACC_TRIM_PITCH_INC |
|
RC_KEY_ACC_TRIM_PITCH_DEC |
|
RC_KEY_ACC_TRIM_ROLL_INC |
|
RC_KEY_ACC_TRIM_ROLL_DEC |
|
RC_KEY_DISPLAY_OFF |
|
RC_KEY_DISPLAY_ON |
|
RC_KEY_FUNC_LEVEL |
|
RC_KEY_FUNC_ARM |
arming through box range
|
RC_KEY_FUNC_BLEND |
|
RC_KEY_FUNC_ALTSTAB |
|
RC_KEY_FUNC_HEADSTAB |
|
RC_KEY_FUNC_HEADFIX |
|
RC_KEY_FUNC_CALIBRATE |
|
RC_KEY_FUNC_BEEPER |
|
RC_NUM_KEYS |
|
Enumerator |
---|
NOT_CENTERED |
|
CENTERED |
|
Enumerator |
---|
THROTTLE_LOW |
|
THROTTLE_HIGH |
|
int16_t rc_get_command |
( |
struct rc * |
self, |
|
|
uint8_t |
axis |
|
) |
| |
This function is used to get stick commands after exponential curves have been applied to the rx input.
- Parameters
-
axis | one of ROLL, PITCH, YAW, THROTTLE |
- Returns
- a value between -500 and 500.
Initializes a new rc struct.
- Parameters
-
rx | instance of the underlying rx to read values from. |
evl | event listener or NULL |
- Parameters
-
key | the key for which to return state |
- Returns
- current state of the key (PRESSED, RELEASED, DISABLED)
void rc_update |
( |
struct rc * |
self | ) |
|
Runs an iteration of the rc calculations. This function does not call update on the underlying receiver object - user is expected to update the receiver object outside of rc object (and possibly at a different rate). The responsibility of this function is mainly taking care of repeat logic and firing new events for keys that are pressed for a while.