AP_Notify: add support for for Buzzer on BBBMini

Use GPIO P8_31 for buzzer in BBBMini
This commit is contained in:
Vinicius Juvinski 2016-05-04 23:48:44 -03:00 committed by Lucas De Marchi
parent efc3f5058b
commit c1dd3cb921
2 changed files with 7 additions and 3 deletions

View File

@ -99,8 +99,9 @@ struct AP_Notify::notify_events_type AP_Notify::events;
ToshibaLED_I2C toshibaled;
NotifyDevice *AP_Notify::_devices[] = {&navioled, &toshibaled};
#elif CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_BBBMINI
Buzzer buzzer;
Display_SSD1306_I2C display;
NotifyDevice *AP_Notify::_devices[] = {&display};
NotifyDevice *AP_Notify::_devices[] = {&display, &buzzer};
#elif CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_RASPILOT
ToshibaLED_I2C toshibaled;
ToneAlarm_Linux tonealarm;

View File

@ -21,8 +21,10 @@
#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 10 // GPIO P8_31
#else
# define BUZZER_PIN 0 // pin undefined on other boards
# define BUZZER_PIN 0 // pin undefined on other boards
#endif
#define BUZZER_ARMING_BUZZ_MS 3000 // arming buzz length in milliseconds (i.e. 3 seconds)
@ -49,6 +51,7 @@ public:
/// on - turns the buzzer on or off
void on(bool on_off);
// Patterns - how many beeps will be played
enum BuzzerPattern {
NONE = 0,
SINGLE_BUZZ = 1,
@ -70,7 +73,7 @@ private:
uint8_t arming : 1; // 1 if we are beginning the arming process
uint8_t armed : 1; // 0 = disarmed, 1 = armed
uint8_t failsafe_battery : 1; // 1 if battery failsafe has triggered
uint8_t ekf_bad : 1; // 1 if ekf position has gone bad
uint8_t ekf_bad : 1; // 1 if ekf position has gone bad
} _flags;
uint8_t _counter; // reduces 50hz update down to 10hz for internal processing