|
|
|
@ -20,6 +20,8 @@
@@ -20,6 +20,8 @@
|
|
|
|
|
|
|
|
|
|
extern const AP_HAL::HAL& hal; |
|
|
|
|
|
|
|
|
|
AP_Button *AP_Button::_singleton; |
|
|
|
|
|
|
|
|
|
const AP_Param::GroupInfo AP_Button::var_info[] = { |
|
|
|
|
|
|
|
|
|
// @Param: ENABLE
|
|
|
|
@ -72,6 +74,11 @@ const AP_Param::GroupInfo AP_Button::var_info[] = {
@@ -72,6 +74,11 @@ const AP_Param::GroupInfo AP_Button::var_info[] = {
|
|
|
|
|
AP_Button::AP_Button(void) |
|
|
|
|
{ |
|
|
|
|
AP_Param::setup_object_defaults(this, var_info); |
|
|
|
|
|
|
|
|
|
if (_singleton != nullptr) { |
|
|
|
|
AP_HAL::panic("AP_Button must be singleton"); |
|
|
|
|
} |
|
|
|
|
_singleton = this; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
@ -166,3 +173,12 @@ void AP_Button::setup_pins(void)
@@ -166,3 +173,12 @@ void AP_Button::setup_pins(void)
|
|
|
|
|
hal.gpio->write(pin[i], 1); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
namespace AP { |
|
|
|
|
|
|
|
|
|
AP_Button &button() |
|
|
|
|
{ |
|
|
|
|
return *AP_Button::get_singleton(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|