AP_Notify: add parameter for logic level buzzer sounds at

This commit is contained in:
Peter Barker 2018-10-16 15:27:02 +11:00 committed by Peter Barker
parent a97c9bdd5b
commit f8ac5a5419
3 changed files with 18 additions and 2 deletions

View File

@ -147,6 +147,15 @@ const AP_Param::GroupInfo AP_Notify::var_info[] = {
// @User: Advanced
AP_GROUPINFO("LED_TYPES", 6, AP_Notify, _led_type, BUILD_DEFAULT_LED_TYPE),
#if !defined(HAL_BUZZER_PIN)
// @Param: BUZZ_ON_LVL
// @DisplayName: Buzzer-on pin logic level
// @Description: Specifies pin level that indicates buzzer should play
// @Values: 0:LowIsOn,1:HighIsOn
// @User: Advanced
AP_GROUPINFO("BUZZ_ON_LVL", 7, AP_Notify, _buzzer_level, 1),
#endif
AP_GROUPEND
};

View File

@ -151,6 +151,7 @@ public:
static const struct AP_Param::GroupInfo var_info[];
uint8_t get_buzz_pin() const { return _buzzer_pin; }
uint8_t get_buzz_level() const { return _buzzer_level; }
private:
@ -169,6 +170,7 @@ private:
AP_Int8 _oreo_theme;
AP_Int8 _buzzer_pin;
AP_Int32 _led_type;
AP_Int8 _buzzer_level;
char _send_text[NOTIFY_TEXT_BUFFER_SIZE];
uint32_t _send_text_updated_millis; // last time text changed

View File

@ -22,8 +22,13 @@
#include "AP_Notify.h"
#ifndef HAL_BUZZER_ON
#define HAL_BUZZER_ON 1
#define HAL_BUZZER_OFF 0
#if !defined(HAL_BUZZER_PIN)
#define HAL_BUZZER_ON (pNotify->get_buzz_level())
#define HAL_BUZZER_OFF (!pNotify->get_buzz_level())
#else
#define HAL_BUZZER_ON 1
#define HAL_BUZZER_OFF 0
#endif
#endif