forked from Rhoban/Metabot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuzzer.h
More file actions
57 lines (47 loc) · 1016 Bytes
/
buzzer.h
File metadata and controls
57 lines (47 loc) · 1016 Bytes
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#ifndef _BUZZER_H
#define _BUZZER_H
#define BUZZER_PIN 11
// When the robot starts
#define MELODY_BOOT 0
// When the battery is low
#define MELODY_ALERT 1
#define MELODY_ALERT_FAST 2
// When there is a warning
#define MELODY_WARNING 3
// When we start the ID of the motors
#define MELODY_BEGIN 4
// A custom melody used by beep
#define MELODY_CUSTOM 5
/**
* Initializes the buzzer
*/
void buzzer_init();
/**
* Plays a melody
* @param melody The melody id (MELODY_*)
* @param repeat Does the melody repeats continuously?
*/
void buzzer_play(unsigned int melody, bool repeat=false);
/**
* Stops playing any sound
*/
void buzzer_stop();
/**
* Ticking the buzzer
*/
void buzzer_tick();
/**
* Is the buzzer plaing?
*/
bool buzzer_is_playing();
/**
* Wait the end of the play
*/
void buzzer_wait_play();
/**
* Plays a beep
* @param freq The frequency (Hz)
* @param duration The duration (ms)
*/
void buzzer_beep(unsigned int freq, unsigned int duration);
#endif