12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- #pragma once
- #include <AP_HAL/AP_HAL.h>
- #include <AP_Param/AP_Param.h>
- #define AP_BUTTON_NUM_PINS 4
- #define AP_BUTTON_REPORT_PERIOD_MS 1000
- class AP_Button {
- public:
-
- AP_Button(void);
- static const struct AP_Param::GroupInfo var_info[];
-
- void update(void);
-
- private:
- AP_Int8 enable;
- AP_Int8 pin[AP_BUTTON_NUM_PINS];
-
- AP_Int16 report_send_time;
-
- uint8_t last_mask;
-
- uint64_t last_change_time_ms;
-
- uint32_t last_report_ms;
-
- bool initialised:1;
-
-
- void timer_update(void);
-
- uint8_t get_mask(void);
-
- void send_report(void);
-
- void setup_pins();
- };
|