1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- #pragma once
- #include <AP_HAL/AP_HAL.h>
- #include "NotifyDevice.h"
- class Buzzer: public NotifyDevice
- {
- public:
-
- Buzzer() {}
-
- bool init(void) override;
-
- void update() override;
- private:
-
- void on(bool on_off);
-
-
- static const uint32_t SINGLE_BUZZ = 0b10000000000000000000000000000000UL;
- static const uint32_t DOUBLE_BUZZ = 0b10100000000000000000000000000000UL;
- static const uint32_t ARMING_BUZZ = 0b11111111111111111111111111111100UL;
- static const uint32_t BARO_BUZZ = 0b10101010100000000000000000000000UL;
- static const uint32_t EKF_BAD = 0b11101101010000000000000000000000UL;
-
- void play_pattern(const uint32_t pattern);
-
- struct buzzer_flag_type {
- uint8_t on : 1;
- uint8_t arming : 1;
- uint8_t armed : 1;
- uint8_t failsafe_battery : 1;
- uint8_t ekf_bad : 1;
- } _flags;
- uint32_t _pattern;
- uint8_t _pin;
- uint32_t _pattern_start_time;
-
- const uint16_t _pattern_start_interval_time_ms = 32*100 + 100;
- void update_playing_pattern();
- void update_pattern_to_play();
- };
|