Subversion Repositories FlightCtrl

Rev

Rev 1645 | Blame | Last modification | View Log | RSS feed

/*********************************************************************************/
/* Stick control interface                                                       */
/*********************************************************************************/
/*
OBSOLETED BY controlMixer.h. But this is how it looked - maybe somebody will find it simpler?

#ifndef _CONTROL_H
#define _CONTROL_H

#include <inttypes.h>
#define CONTROL_SCALING 4

// defines for lookup staticParams.ChannelAssignment
#define CH_PITCH        0
#define CH_ROLL             1
#define CH_THROTTLE         2
#define CH_YAW          3
#define CH_POTS         4
#define POT_OFFSET      110

extern int16_t stickPitch, stickRoll, stickYaw, stickThrottle;
extern int16_t stickOffsetNick, stickOffsetRoll;
extern uint16_t maxStickPitch, maxStickRoll;
extern uint8_t loopingPitch, loopingRoll;

// external control
extern int16_t externalStickPitch, externalStickRoll, externalStickYaw;

// current GPS-stick values
extern int16_t GPSStickPitch, GPSStickRoll;

typedef struct {
  uint8_t       digital[2];
  uint8_t       eemoteButtons;
  int8_t        pitch;
  int8_t        roll;
  int8_t        yaw;
  uint8_t       throttle;
  int8_t        height;
  uint8_t       free;
  uint8_t       frame;
  uint8_t       config;
} __attribute__((packed)) ExternalControl_t;

extern ExternalControl_t externalControl;

//uint8_t control_getLeftStickCalibrateIndex(void);
//uint8_t control_getLeftStickMotorStartIndex(void);
//uint8_t control_getRightRCStickIndex(void);
void control_initPots(void);
void control_updatePots(void);

void setCompassCalState(void);
void updateCompass(void);

void control_setNeutral(void);
void control_update(void);

#define STICK_COMMAND_UNDEF 0
#define STICK_COMMAND_START 6
#define STICK_COMMAND_STOP  8
#define STICK_COMMAND_GYROCAL 2
#define STICK_COMMAND_ACCCAL 4

void control_senseStickCommands(void);
uint8_t control_getStickCommand(void);
uint8_t control_isStickCommandRepeated(void);

void control_performPilotCalibrationCommands(uint8_t stickCommand);

extern volatile int16_t RC_Quality;     // rc signal quality indicator (0 to 200)
extern uint8_t control_hasNewRCData(void);

#endif //_CONTROL_H
*/