#pragma once12#if AP_SCRIPTING_ENABLED34#include <AP_Common/AP_Common.h>56// Joystick button object for use in Lua scripts.7//8// Provide 2 ways to use a joystick button:9// is_pressed() returns true if the button is currently (as of the most recent MANUAL_CONTROL msg) pressed10// get_and_clear_count() returns the number of times the button was pressed since the last call11//12class ScriptButton {13public:14ScriptButton(): pressed(false), count(0) {}1516void press();1718void release();1920bool is_pressed() const WARN_IF_UNUSED;2122uint8_t get_count() const WARN_IF_UNUSED;2324void clear_count();2526uint8_t get_and_clear_count();2728private:29bool pressed;30uint8_t count;31};3233#endif // AP_SCRIPTING_ENABLED343536