blob: 4f7b05fea5d114b23e5aef810a4376f955338b55 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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);
}
|