AP_Notify: move BUZZER_PIN into AP_HAL

This commit is contained in:
mirkix 2018-05-10 09:01:29 +02:00 committed by Francisco Ferreira
parent 34c96c80ff
commit 178b5e03c0
3 changed files with 4 additions and 17 deletions

View File

@ -84,7 +84,7 @@ const AP_Param::GroupInfo AP_Notify::var_info[] = {
// @User: Advanced
AP_GROUPINFO("OREO_THEME", 4, AP_Notify, _oreo_theme, 0),
#if !defined(BUZZER_PIN)
#if !defined(HAL_BUZZER_PIN)
// @Param: BUZZ_PIN
// @DisplayName: Buzzer pin
// @Description: Enables to connect active buzzer to arbitrary pin. Requires 3-pin buzzer or additional MOSFET!
@ -239,7 +239,7 @@ void AP_Notify::add_backends(void)
# else
ADD_BACKEND(new AP_BoardLED());
# endif
#ifdef BUZZER_PIN
#ifdef HAL_BUZZER_PIN
ADD_BACKEND(new Buzzer());
#endif
ADD_BACKEND(new ToshibaLED_I2C(TOSHIBA_LED_I2C_BUS_EXTERNAL));

View File

@ -33,8 +33,8 @@ extern const AP_HAL::HAL& hal;
bool Buzzer::init()
{
#if defined(BUZZER_PIN)
_pin = BUZZER_PIN;
#if defined(HAL_BUZZER_PIN)
_pin = HAL_BUZZER_PIN;
#else
_pin = pNotify->get_buzz_pin();
#endif

View File

@ -19,19 +19,6 @@
#include <AP_HAL/AP_HAL.h>
#ifndef BUZZER_PIN
// better to define it in hal
#if CONFIG_HAL_BOARD == HAL_BOARD_VRBRAIN
# define BUZZER_PIN 32
#elif CONFIG_HAL_BOARD == HAL_BOARD_LINUX && CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_BBBMINI
# define BUZZER_PIN 11 // GPIO P8_32
#elif CONFIG_HAL_BOARD == HAL_BOARD_LINUX && CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_POCKET
# define BUZZER_PIN 28 // GPIO P2_8
// #else
// # define BUZZER_PIN -1 // pin undefined on other boards
#endif
#endif
#define BUZZER_ARMING_BUZZ_MS 3000 // arming buzz length in milliseconds (i.e. 3 seconds)
#include "NotifyDevice.h"