APM:Libraries
AP_JSButton.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <AP_Param/AP_Param.h>
4 
5 class JSButton {
6 public:
7  JSButton();
8 
9  // Button functions
10  typedef enum {
11  k_none = 0,
12  k_shift = 1,
14  k_arm = 3,
15  k_disarm = 4,
16 
24  k_mode_acro = 12,
25 
26  // 12-20 reserved for future mode functions
34  // 26-30 reserved for future camera functions
41  // 37-40 reserved for future light functions
43  k_gain_inc = 42,
44  k_gain_dec = 43,
51 
52  // 50 reserved for future function
53 
54  k_relay_1_on = 51,
57  k_relay_2_on = 54,
60  k_relay_3_on = 57,
63 
64  // 60 reserved for future function
70 
76 
82 
87 
92 
97 
98  // 88-90 reserved for future functions
99  k_custom_1 = 91,
100  k_custom_2 = 92,
101  k_custom_3 = 93,
102  k_custom_4 = 94,
103  k_custom_5 = 95,
104  k_custom_6 = 96,
105  // 97-100 reserved for future functions
106  k_relay_4_on = 101,
109 
114 
115  // 108+ reserved for future functions
118 
119  // If shift is false, returns the function assigned to this button
120  // If shift is true, returns the shift function assigned to this button
121  uint8_t function(bool shift = false) const;
122 
123  // Sets the default function and shift function parameter values for this button
124  void set_default(button_function_t f, button_function_t sf);
125 
126  static const struct AP_Param::GroupInfo var_info[];
127 
128 private:
129  // Button mappings
130  AP_Int8 _function;
131  AP_Int8 _sfunction;
132 };
This must be the last enum value (only add new values before this one)
Definition: AP_JSButton.h:116
trigger relay on
Definition: AP_JSButton.h:57
trigger relay off
Definition: AP_JSButton.h:107
custom user button 4
Definition: AP_JSButton.h:102
AP_Int8 _sfunction
Definition: AP_JSButton.h:131
move mount to center
Definition: AP_JSButton.h:27
increase roll trim
Definition: AP_JSButton.h:45
toggle input hold (trim to current controls)
Definition: AP_JSButton.h:49
trigger relay toggle
Definition: AP_JSButton.h:108
enter auto mode
Definition: AP_JSButton.h:21
custom user button 6
Definition: AP_JSButton.h:104
enter circle mode
Definition: AP_JSButton.h:22
trigger relay off
Definition: AP_JSButton.h:58
arm vehicle
Definition: AP_JSButton.h:14
set servo output to minimum (SERVOn_MAX) until released
Definition: AP_JSButton.h:84
A system for managing and storing variables that are of general interest to the system.
button_function_t
Definition: AP_JSButton.h:10
increase servo output
Definition: AP_JSButton.h:65
trigger camera shutter
Definition: AP_JSButton.h:30
toggle servo output btwn trim (SERVOn_TRIM) and max (SERVOn_MAX)
Definition: AP_JSButton.h:86
custom user button 3
Definition: AP_JSButton.h:101
trigger relay on
Definition: AP_JSButton.h:106
toggle servo output btwn trim (SERVOn_TRIM) and min (SERVOn_MIN)
Definition: AP_JSButton.h:85
#define f(i)
trigger relay off
Definition: AP_JSButton.h:55
trigger relay toggle
Definition: AP_JSButton.h:56
trigger relay off
Definition: AP_JSButton.h:61
increase control gain
Definition: AP_JSButton.h:43
adjust roll/pitch input instead of forward/lateral
Definition: AP_JSButton.h:50
enter acro mode
Definition: AP_JSButton.h:24
trigger relay on
Definition: AP_JSButton.h:60
void set_default(button_function_t f, button_function_t sf)
Definition: AP_JSButton.cpp:35
custom user button 1
Definition: AP_JSButton.h:99
toggle different gain settings
Definition: AP_JSButton.h:42
enter poshold mode
Definition: AP_JSButton.h:20
enter enter manual mode
Definition: AP_JSButton.h:17
trigger relay toggle
Definition: AP_JSButton.h:59
disarm vehicle
Definition: AP_JSButton.h:15
set servo output to maximum (SERVOn_MAX)
Definition: AP_JSButton.h:69
enter stabilize mode
Definition: AP_JSButton.h:18
trigger relay toggle
Definition: AP_JSButton.h:62
static const struct AP_Param::GroupInfo var_info[]
Definition: AP_JSButton.h:126
set servo output to minimum (SERVOn_MIN)
Definition: AP_JSButton.h:68
increase pitch trim
Definition: AP_JSButton.h:47
toggle camera source
Definition: AP_JSButton.h:31
enter guided mode
Definition: AP_JSButton.h:23
AP_Int8 _function
Definition: AP_JSButton.h:130
decrease roll trim
Definition: AP_JSButton.h:46
decrease pitch trim
Definition: AP_JSButton.h:48
decrease control gain
Definition: AP_JSButton.h:44
custom user button 2
Definition: AP_JSButton.h:100
"shift" buttons to allow more functions
Definition: AP_JSButton.h:12
custom user button 5
Definition: AP_JSButton.h:103
enter depth hold mode
Definition: AP_JSButton.h:19
set servo output to minimum (SERVOn_MIN) until released
Definition: AP_JSButton.h:83
arm/disarm vehicle toggle
Definition: AP_JSButton.h:13
decrease servo output
Definition: AP_JSButton.h:66
trigger relay on
Definition: AP_JSButton.h:54
relay toggle when button is pushed, and again when released
Definition: AP_JSButton.h:110