Subversion Repositories FlightCtrl

Rev

Rev 2049 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2189 - 1
#ifndef _CONTROLMIXER_H
2
#define _CONTROLMIXER_H
3
 
1612 dongfang 4
#include <inttypes.h>
5
/*
6
 * An attempt to define a generic control. That could be an R/C receiver, an external control
7
 * (serial over Bluetooth, Wi232, XBee, whatever) or the NaviCtrl.
8
 * This resembles somewhat an object-oriented class definition (except that there are no virtuals).
9
 * The idea is that the combination of different control inputs, of the way they superimpose upon
1775 - 10
 * each other, the priorities between them and the behavior in case that one fails is simplified,
1612 dongfang 11
 * and all in one place.
12
 */
1821 - 13
 
1612 dongfang 14
/*
15
 * Our output.
16
 */
1908 - 17
extern int16_t controls[4];
18
extern uint16_t controlActivity;
19
//extern uint16_t maxControl[2];
1612 dongfang 20
 
21
void controlMixer_initVariables(void);
2049 - 22
//void controlMixer_updateVariables(void);
1612 dongfang 23
 
1775 - 24
void controlMixer_setNeutral(void);
1612 dongfang 25
 
26
/*
27
 * Update the exported variables. Called at every flight control cycle.
28
 */
2039 - 29
void controlMixer_periodicTask(void);
1612 dongfang 30
 
31
/*
32
 * Get the current command. See the COMMAND_.... define's
33
 */
34
uint8_t controlMixer_getCommand(void);
35
 
36
void controlMixer_performCalibrationCommands(uint8_t command);
37
 
38
uint8_t controlMixer_getSignalQuality(void);
1963 - 39
extern uint8_t controlMixer_didReceiveSignal;
1612 dongfang 40
 
1868 - 41
 
1612 dongfang 42
/*
43
 * Gets the argument for the current command (a number).
44
 *
45
 * Stick position to argument values (for stick control):
46
 * 2--3--4
47
 * |     |  +
48
 * 1  9  5  ^ 0
49
 * |     |  |  
50
 * 8--7--6
51
 *    
52
 * + <--
53
 *    0
54
 *
55
 * Not in any of these positions: 0
56
 */
57
uint8_t controlMixer_getArgument(void);
58
uint8_t controlMixer_isCommandRepeated(void);
2189 - 59
 
60
#endif