Contiki-Inga 3.x
beep.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2005, Swedish Institute of Computer Science
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * 3. Neither the name of the Institute nor the names of its contributors
14  * may be used to endorse or promote products derived from this software
15  * without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
18  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
21  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27  * SUCH DAMAGE.
28  *
29  * This file is part of the Contiki operating system.
30  *
31  */
32 /**
33  * \addtogroup esb
34  * @{
35  */
36 
37 /**
38  * \defgroup beeper Beeper interface
39  * @{
40  */
41 
42 /**
43  * \file
44  * Interface to the beeper.
45  * \author Adam Dunkels <adam@sics.se>
46  *
47  */
48 
49 #ifndef BEEP_H_
50 #define BEEP_H_
51 
52 #define BEEP_ALARM1 1
53 #define BEEP_ALARM2 2
54 
55 #include "sys/clock.h"
56 
57 /**
58  * Beep for a specified time.
59  *
60  * This function causes the beeper to beep for the specified time. The
61  * time is measured in the same units as for the clock_delay()
62  * function.
63  *
64  * \note This function will hang the CPU during the beep.
65  *
66  * \note This function will stop any beep that was on previously when this
67  * function ends.
68  *
69  * \note If the beeper is turned off with beep_off() this call will still
70  * take the same time, though it will be silent.
71  *
72  * \param len The length of the beep.
73  *
74  */
75 void beep_beep(int len);
76 
77 /**
78  * Beep an alarm for a specified time.
79  *
80  * This function causes the beeper to beep for the specified time. The
81  * time is measured in the same units as for the clock_delay()
82  * function.
83  *
84  * \note This function will hang the CPU during the beep.
85  *
86  * \note This function will stop any beep that was on previously when this
87  * function ends.
88  *
89  * \note If the beeper is turned off with beep_off() this call will still
90  * take the same time, though it will be silent.
91  *
92  * \param alarmmode The alarm mode (BEEP_ALARM1,BEEP_ALARM2)
93  * \param len The length of the beep.
94  *
95  */
96 void beep_alarm(int alarmmode, int len);
97 
98 /**
99  * Produces a quick click-like beep.
100  *
101  * This function produces a short beep that sounds like a click.
102  *
103  */
104 void beep(void);
105 
106 /**
107  * A beep with a pitch-bend down.
108  *
109  * This function produces a pitch-bend sound with deecreasing
110  * frequency.
111  *
112  * \param len The length of the pitch-bend.
113  *
114  */
115 void beep_down(int len);
116 
117 /**
118  * Turn the beeper on.
119  *
120  * This function turns on the beeper. The beeper is turned off with
121  * the beep_off() function.
122  */
123 void beep_on(void);
124 
125 /**
126  * Turn the beeper off.
127  *
128  * This function turns the beeper off after it has been turned on with
129  * beep_on().
130  */
131 void beep_off(void);
132 
133 /**
134  * Produce a sound similar to a hard-drive spinup.
135  *
136  * This function produces a sound that is intended to be similar to
137  * the sound a hard-drive makes when it starts.
138  *
139  */
140 void beep_spinup(void);
141 
142 /**
143  * Beep for a long time (seconds)
144  *
145  * This function produces a beep with the specified length and will
146  * not return until the beep is complete. The length of the beep is
147  * specified using CLOCK_SECOND: a two second beep is CLOCK_SECOND *
148  * 2, and a quarter second beep is CLOCK_SECOND / 4.
149  *
150  * \note If the beeper is turned off with beep_off() this call will still
151  * take the same time, though it will be silent.
152  *
153  * \param len The length of the beep, measured in units of CLOCK_SECOND
154  */
155 void beep_long(clock_time_t len);
156 
157 void beep_quick(int num);
158 
159 /** @} */
160 /** @} */
161 
162 #endif /* BEEP_H_ */