40 #include <px4_platform_common/time.h> 44 ScheduledWorkItem(MODULE_NAME,
px4::wq_configurations::hp_default)
85 unsigned int frequency = 0;
86 unsigned int duration = 0;
97 if (parse_ret_val > 0) {
119 ScheduleDelayed(duration);
187 const char *argv1 = argv[1];
189 if (!strcmp(argv1,
"start")) {
190 if (
g_dev ==
nullptr) {
193 if (
g_dev ==
nullptr) {
194 PX4_ERR(
"could not allocate the driver.");
200 PX4_ERR(
"driver init failed.");
204 PX4_INFO(
"already started");
210 if (!strcmp(argv1,
"stop")) {
216 if (!strcmp(argv1,
"status")) {
217 if (
g_dev !=
nullptr) {
221 PX4_INFO(
"driver stopped");
228 PX4_INFO(
"missing command, try 'start', status, 'stop'");
int init() override
Initializes the character device and hardware registers.
int get_next_note(unsigned &frequency, unsigned &duration, unsigned &silence)
Get next note in the current tune, which has been provided by either set_control or play_string...
void status()
Prints the driver status to the console.
bool circuit_breaker_enabled(const char *breaker, int32_t magic)
void stop_note()
Stops playing the current note and makes the player 'safe'.
volatile bool _should_run
volatile bool _running
Flag to indicate the current driver status.
void next_note()
Parses the next note out of the string and plays it.
Low Level Driver for the PX4 audio alarm port.
void init()
Activates/configures the hardware registers.
void start_note(unsigned frequency)
Starts playing the note.
uORB::Subscription _tune_control_sub
int set_control(const tune_control_s &tune_control)
Set tune to be played using the message.
#define TONE_ALARM0_DEVICE_PATH
void start_note(unsigned frequency)
Starts playing the note.
bool updated()
Check if there is a new update.
void Run() override
Trampoline for the work queue.
__EXPORT int tone_alarm_main(int argc, char *argv[])
Tone alarm Driver 'main' command.
int _cbrk
If true, no audio output.
void stop_note()
Stops playing the current note and makes the player 'safe'.
void orb_update()
Updates the uORB topics for local subscribers.
unsigned int _silence_length
If nonzero, silence before next note.
bool copy(void *dst)
Copy the struct.
unsigned int get_maximum_update_interval()