NinjaFlight
|
#include <string.h>
#include "config/config.h"
#include "../common/maths.h"
#include "rc.h"
#include "rx.h"
#include <stdio.h>
Macros | |
#define | ROL_LO (1 << (2 * ROLL)) |
#define | ROL_CE (3 << (2 * ROLL)) |
#define | ROL_HI (2 << (2 * ROLL)) |
#define | PIT_LO (1 << (2 * PITCH)) |
#define | PIT_CE (3 << (2 * PITCH)) |
#define | PIT_HI (2 << (2 * PITCH)) |
#define | YAW_LO (1 << (2 * YAW)) |
#define | YAW_CE (3 << (2 * YAW)) |
#define | YAW_HI (2 << (2 * YAW)) |
#define | THR_LO (1 << (2 * THROTTLE)) |
#define | THR_CE (3 << (2 * THROTTLE)) |
#define | THR_HI (2 << (2 * THROTTLE)) |
Functions | |
void | rc_update (struct rc *self) |
void | rc_init (struct rc *self, struct rx *rx, struct rc_event_listener *evl, const struct config *config) |
int16_t | rc_get_command (struct rc *self, uint8_t axis) |
rc_key_state_t | rc_key_state (struct rc *self, rc_key_t key) |
#define PIT_CE (3 << (2 * PITCH)) |
#define PIT_HI (2 << (2 * PITCH)) |
#define PIT_LO (1 << (2 * PITCH)) |
#define ROL_CE (3 << (2 * ROLL)) |
#define ROL_HI (2 << (2 * ROLL)) |
#define ROL_LO (1 << (2 * ROLL)) |
#define THR_CE (3 << (2 * THROTTLE)) |
#define THR_HI (2 << (2 * THROTTLE)) |
#define THR_LO (1 << (2 * THROTTLE)) |
#define YAW_CE (3 << (2 * YAW)) |
#define YAW_HI (2 << (2 * YAW)) |
#define YAW_LO (1 << (2 * YAW)) |
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.
axis | one of ROLL, PITCH, YAW, THROTTLE |
void rc_init | ( | struct rc * | self, |
struct rx * | rx, | ||
struct rc_event_listener * | evl, | ||
const struct config * | config | ||
) |
Initializes a new rc struct.
rx | instance of the underlying rx to read values from. |
evl | event listener or NULL |
rc_key_state_t rc_key_state | ( | struct rc * | rc, |
rc_key_t | key | ||
) |
key | the key for which to return state |
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.