Statistics
| Revision:

root / demos / hunter_prey / lib / src / libdragonfly / buzzer.h @ 1828

History | View | Annotate | Download (2.37 KB)

1
/**
2
 * Copyright (c) 2007 Colony Project
3
 * 
4
 * Permission is hereby granted, free of charge, to any person
5
 * obtaining a copy of this software and associated documentation
6
 * files (the "Software"), to deal in the Software without
7
 * restriction, including without limitation the rights to use,
8
 * copy, modify, merge, publish, distribute, sublicense, and/or sell
9
 * copies of the Software, and to permit persons to whom the
10
 * Software is furnished to do so, subject to the following
11
 * conditions:
12
 * 
13
 * The above copyright notice and this permission notice shall be
14
 * included in all copies or substantial portions of the Software.
15
 * 
16
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18
 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20
 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21
 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23
 * OTHER DEALINGS IN THE SOFTWARE.
24
 **/
25

    
26

    
27
/**
28
 * @file buzzer.h
29
 * @brief Contains definitions for using the buzzer.
30
 *
31
 * Contains definitions for using the buzzer built into
32
 * the colony robots.
33
 *
34
 * @author Colony Project, CMU Robotics Club
35
 **/
36

    
37
#ifndef _BUZZER_H_
38
#define _BUZZER_H_
39

    
40
/**
41
 * @addtogroup buzzer
42
 * @{
43
 **/
44

    
45
//Musical note definitions
46
//Source: http://www.answers.com/topic/piano-key-frequencies
47
/** @brief Middle C **/
48
#define        C4        260 //Middle C
49
/** @brief C# **/
50
#define        C4s        277 //C sharp
51
/** @brief D **/
52
#define        D4        294
53
/** @brief D# **/
54
#define        D4s        311
55
/** @brief E **/
56
#define        E4        330
57
/** @brief F **/
58
#define        F4        349
59
/** @brief F# **/
60
#define        F4s        370
61
/** @brief G **/
62
#define        G4        392
63
/** @brief G# **/
64
#define        G4s        415
65
/** @brief A **/
66
#define        A4        440
67
/** @brief A# **/
68
#define        A4s        466
69
/** @brief B **/
70
#define        B4        494
71
/** @brief C **/
72
#define        C5        523
73

    
74
/** @brief Initialize the buzzer. **/
75
void buzzer_init(void);
76
/** @brief Set the value the buzzer plays. **/
77
void buzzer_set_val(unsigned int buzz_value);
78
/** @brief Set the frequency the buzzer plays. **/
79
void buzzer_set_freq(unsigned int buzz_freq);
80
/** @brief Play a frequency for a specified time. **/
81
void buzzer_chirp(unsigned int ms, unsigned int buzz_freq);
82
/** @brief Turn the buzzer off. **/
83
void buzzer_off(void); 
84

    
85
/** @} **/ //end addtogroup
86

    
87
#endif
88