Subversion Repositories FlightCtrl

Rev

Rev 2109 | Rev 2118 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

#ifndef _RC_H
#define _RC_H

#include <inttypes.h>
#include "configuration.h"

// Number of cycles a command must be repeated before commit.
#define COMMAND_TIMER 200

extern void RC_Init(void);
// the RC-Signal. todo: Not export any more.
extern volatile int16_t PPM_in[MAX_CHANNELS];
// extern volatile int16_t PPM_diff[MAX_CHANNELS];      // the differentiated RC-Signal. Should that be exported??
extern volatile uint8_t NewPpmData; // 0 indicates a new recieved PPM Frame
extern volatile uint8_t RCQuality;  // rc signal quality indicator (0 to 200)

// defines for lookup staticParams.ChannelAssignment
#define CH_ELEVATOR     0
#define CH_AILERONS         1
#define CH_THROTTLE         2
#define CH_RUDDER       3
#define CH_MODESWITCH   4
#define CH_POTS         4

// These are a little individual for differnt R/C systems... trim for zero channel readings at zero
// stick, and trim VARIABLE_OFFSET for full variable range 0..255.
#define VARIABLE_OFFSET      128
#define RC_TRIM              23
// Set this for a full stick range of about -1024..1024.
#define RC_SCALING           2

// void RC_periodicTask(void);
void RC_periodicTaskAndPRYT(int16_t* PRYT);
uint8_t RC_getArgument(void);
uint8_t RC_getCommand(void);
int16_t RC_getVariable(uint8_t varNum);
void RC_calibrate(void);
uint8_t RC_getSignalQuality(void);
uint8_t RC_getLooping(uint8_t looping);
#ifdef USE_MK3MAG
uint8_t RC_testCompassCalState(void);
#endif
#endif //_RC_H