aboutsummaryrefslogtreecommitdiff
path: root/apps/position_estimator_inav/sounds.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/position_estimator_inav/sounds.c')
-rw-r--r--apps/position_estimator_inav/sounds.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/apps/position_estimator_inav/sounds.c b/apps/position_estimator_inav/sounds.c
new file mode 100644
index 000000000..4f7b05fea
--- /dev/null
+++ b/apps/position_estimator_inav/sounds.c
@@ -0,0 +1,40 @@
+/*
+ * 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);
+}