mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-30 01:03:33 +08:00
41 lines
502 B
C
41 lines
502 B
C
/*
|
|
* sounds.c
|
|
*
|
|
* Created on: Feb 26, 2013
|
|
* Author: samuezih
|
|
*/
|
|
|
|
#include <sys/types.h>
|
|
#include <fcntl.h>
|
|
#include <drivers/drv_tone_alarm.h>
|
|
|
|
|
|
static int buzzer;
|
|
|
|
int sounds_init(void)
|
|
{
|
|
buzzer = open("/dev/tone_alarm", O_WRONLY);
|
|
|
|
if (buzzer < 0) {
|
|
warnx("Buzzer: open fail\n");
|
|
return ERROR;
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
void sounds_deinit(void)
|
|
{
|
|
close(buzzer);
|
|
}
|
|
|
|
void tune_tetris(void)
|
|
{
|
|
ioctl(buzzer, TONE_SET_ALARM, 6);
|
|
}
|
|
|
|
void tune_sonar(void)
|
|
{
|
|
ioctl(buzzer, TONE_SET_ALARM, 7);
|
|
}
|