Rev 1775 | Rev 1843 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1775 | Rev 1821 | ||
---|---|---|---|
Line 5... | Line 5... | ||
5 | * This resembles somewhat an object-oriented class definition (except that there are no virtuals). |
5 | * This resembles somewhat an object-oriented class definition (except that there are no virtuals). |
6 | * The idea is that the combination of different control inputs, of the way they superimpose upon |
6 | * The idea is that the combination of different control inputs, of the way they superimpose upon |
7 | * each other, the priorities between them and the behavior in case that one fails is simplified, |
7 | * each other, the priorities between them and the behavior in case that one fails is simplified, |
8 | * and all in one place. |
8 | * and all in one place. |
9 | */ |
9 | */ |
10 | 10 | ||
11 | /* |
11 | /* |
12 | * Signal qualities, used to determine the availability of a control. |
12 | * Signal qualities, used to determine the availability of a control. |
13 | * NO_SIGNAL means there was never a signal. SIGNAL_LOST that there was a signal, but it was lost. |
13 | * NO_SIGNAL means there was never a signal. SIGNAL_LOST that there was a signal, but it was lost. |
14 | * SIGNAL_BAD is too bad for flight. This is the hysteresis range for deciding whether to engage |
14 | * SIGNAL_BAD is too bad for flight. This is the hysteresis range for deciding whether to engage |
15 | * or disengage emergency landing. |
15 | * or disengage emergency landing. |
Line 45... | Line 45... | ||
45 | /* |
45 | /* |
46 | * This is only relevant for "abstract controls" ie. all control sources have the |
46 | * This is only relevant for "abstract controls" ie. all control sources have the |
47 | * same interface. This struct of code pointers is used like an abstract class |
47 | * same interface. This struct of code pointers is used like an abstract class |
48 | * definition from object-oriented languages, and all control input implementations |
48 | * definition from object-oriented languages, and all control input implementations |
49 | * will declare an instance of the stuct (=implementation of the abstract class). |
49 | * will declare an instance of the stuct (=implementation of the abstract class). |
50 | */ |
50 | */ |
51 | typedef struct { |
51 | typedef struct { |
52 | /* Get the pitch input in the nominal range [-STICK_RANGE, STICK_RANGE]. */ |
52 | /* Get the pitch input in the nominal range [-STICK_RANGE, STICK_RANGE]. */ |
53 | int16_t(*getPitch)(void); |
53 | int16_t(*getPitch)(void); |
Line 54... | Line 54... | ||
54 | 54 | ||
55 | /* Get the roll input in the nominal range [-STICK_RANGE, STICK_RANGE]. */ |
55 | /* Get the roll input in the nominal range [-STICK_RANGE, STICK_RANGE]. */ |
56 | int16_t(*getRoll)(void); |
56 | int16_t(*getRoll)(void); |
57 | 57 | ||
58 | /* Get the yaw input in the nominal range [-STICK_RANGE, STICK_RANGE]. */ |
58 | /* Get the yaw input in the nominal range [-STICK_RANGE, STICK_RANGE]. */ |
59 | int16_t(*getYaw)(void); |
59 | int16_t(*getYaw)(void); |
60 | 60 | ||
61 | /* Get the throttle input in the nominal range [0, THROTTLE_RANGE]. */ |
61 | /* Get the throttle input in the nominal range [0, THROTTLE_RANGE]. */ |
Line 62... | Line 62... | ||
62 | uint16_t(*getThrottle)(void); |
62 | uint16_t(*getThrottle)(void); |
63 | 63 | ||
Line 64... | Line 64... | ||
64 | /* Signal quality, by the above SIGNAL_... definitions. */ |
64 | /* Signal quality, by the above SIGNAL_... definitions. */ |
65 | uint8_t (*getSignalQuality)(void); |
65 | uint8_t (*getSignalQuality)(void); |
66 | 66 | ||
Line 67... | Line 67... | ||
67 | /* Calibrate sticks to their center positions (only relevant for R/C, really) */ |
67 | /* Calibrate sticks to their center positions (only relevant for R/C, really) */ |
68 | void (*calibrate)(void); |
68 | void (*calibrate)(void); |
69 | } t_control; |
69 | } t_control; |