PX4 Firmware
PX4 Autopilot Software http://px4.io
drv_tone_alarm.h File Reference

Driver for the PX4 audio alarm port, /dev/tone_alarm. More...

Include dependency graph for drv_tone_alarm.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 ToneAlarmInterface
 

Macros

#define CBRK_BUZZER_KEY   782097
 
#define CBRK_OFF   0
 
#define CBRK_ON   1
 
#define CBRK_UNINIT   2
 
#define _TONE_ALARM_BASE   0x7400
 
#define TONE_SET_ALARM   _PX4_IOC(_TONE_ALARM_BASE, 1)
 
#define TONE_ALARM0_DEVICE_PATH   "/dev/tone_alarm0"
 

Enumerations

enum  {
  TONE_STOP_TUNE = 0, TONE_STARTUP_TUNE, TONE_ERROR_TUNE, TONE_NOTIFY_POSITIVE_TUNE,
  TONE_NOTIFY_NEUTRAL_TUNE, TONE_NOTIFY_NEGATIVE_TUNE, TONE_ARMING_WARNING_TUNE, TONE_BATTERY_WARNING_SLOW_TUNE,
  TONE_BATTERY_WARNING_FAST_TUNE, TONE_GPS_WARNING_TUNE, TONE_ARMING_FAILURE_TUNE, TONE_PARACHUTE_RELEASE_TUNE,
  TONE_EKF_WARNING_TUNE, TONE_BARO_WARNING_TUNE, TONE_SINGLE_BEEP_TUNE, TONE_HOME_SET,
  TONE_NUMBER_OF_TUNES
}
 

Functions

void ToneAlarmInterface::init ()
 Activates/configures the hardware registers. More...
 
void ToneAlarmInterface::start_note (unsigned frequency)
 Starts playing the note. More...
 
void ToneAlarmInterface::stop_note ()
 Stops playing the current note and makes the player 'safe'. More...
 

Detailed Description

Driver for the PX4 audio alarm port, /dev/tone_alarm.

The tone_alarm driver supports a set of predefined "alarm" patterns and one user-supplied pattern. Patterns are ordered by priority, with a higher-priority pattern interrupting any lower-priority pattern that might be playing.

The TONE_SET_ALARM ioctl can be used to select a predefined alarm pattern, from 1 - <TBD>. Selecting pattern zero silences the alarm.

To supply a custom pattern, write an array of 1 - <TBD> tone_note structures to /dev/tone_alarm. The custom pattern has a priority of zero.

Patterns will normally play once and then silence (if a pattern was overridden it will not resume). A pattern may be made to repeat by inserting a note with the duration set to DURATION_REPEAT. This pattern will loop until either a higher-priority pattern is started or pattern zero is requested via the ioctl.

Definition in file drv_tone_alarm.h.

Macro Definition Documentation

◆ _TONE_ALARM_BASE

#define _TONE_ALARM_BASE   0x7400

Definition at line 70 of file drv_tone_alarm.h.

◆ CBRK_BUZZER_KEY

#define CBRK_BUZZER_KEY   782097

Definition at line 65 of file drv_tone_alarm.h.

Referenced by ToneAlarm::start_note().

◆ CBRK_OFF

#define CBRK_OFF   0

Definition at line 66 of file drv_tone_alarm.h.

Referenced by ToneAlarm::start_note().

◆ CBRK_ON

#define CBRK_ON   1

Definition at line 67 of file drv_tone_alarm.h.

◆ CBRK_UNINIT

#define CBRK_UNINIT   2

Definition at line 68 of file drv_tone_alarm.h.

Referenced by ToneAlarm::start_note().

◆ TONE_ALARM0_DEVICE_PATH

#define TONE_ALARM0_DEVICE_PATH   "/dev/tone_alarm0"

Definition at line 72 of file drv_tone_alarm.h.

Referenced by MavlinkReceiver::handle_message_play_tune().

◆ TONE_SET_ALARM

#define TONE_SET_ALARM   _PX4_IOC(_TONE_ALARM_BASE, 1)

Definition at line 71 of file drv_tone_alarm.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
TONE_STOP_TUNE 
TONE_STARTUP_TUNE 
TONE_ERROR_TUNE 
TONE_NOTIFY_POSITIVE_TUNE 
TONE_NOTIFY_NEUTRAL_TUNE 
TONE_NOTIFY_NEGATIVE_TUNE 
TONE_ARMING_WARNING_TUNE 
TONE_BATTERY_WARNING_SLOW_TUNE 
TONE_BATTERY_WARNING_FAST_TUNE 
TONE_GPS_WARNING_TUNE 
TONE_ARMING_FAILURE_TUNE 
TONE_PARACHUTE_RELEASE_TUNE 
TONE_EKF_WARNING_TUNE 
TONE_BARO_WARNING_TUNE 
TONE_SINGLE_BEEP_TUNE 
TONE_HOME_SET 
TONE_NUMBER_OF_TUNES 

Definition at line 75 of file drv_tone_alarm.h.