Contiki 2.5
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  * @(#)$Id: beep.h,v 1.4 2006/07/07 06:36:38 nifi Exp $
32  */
33 /**
34  * \addtogroup esb
35  * @{
36  */
37 
38 /**
39  * \defgroup beeper Beeper interface
40  * @{
41  */
42 
43 /**
44  * \file
45  * Interface to the beeper.
46  * \author Adam Dunkels <adam@sics.se>
47  *
48  */
49 
50 #ifndef __BEEP_H__
51 #define __BEEP_H__
52 
53 #define BEEP_ALARM1 1
54 #define BEEP_ALARM2 2
55 
56 #include "sys/clock.h"
57 
58 /**
59  * Beep for a specified time.
60  *
61  * This function causes the beeper to beep for the specified time. The
62  * time is measured in the same units as for the clock_delay()
63  * function.
64  *
65  * \note This function will hang the CPU during the beep.
66  *
67  * \note This function will stop any beep that was on previously when this
68  * function ends.
69  *
70  * \note If the beeper is turned off with beep_off() this call will still
71  * take the same time, though it will be silent.
72  *
73  * \param len The length of the beep.
74  *
75  */
76 void beep_beep(int len);
77 
78 /**
79  * Beep an alarm for a specified time.
80  *
81  * This function causes the beeper to beep for the specified time. The
82  * time is measured in the same units as for the clock_delay()
83  * function.
84  *
85  * \note This function will hang the CPU during the beep.
86  *
87  * \note This function will stop any beep that was on previously when this
88  * function ends.
89  *
90  * \note If the beeper is turned off with beep_off() this call will still
91  * take the same time, though it will be silent.
92  *
93  * \param alarmmode The alarm mode (BEEP_ALARM1,BEEP_ALARM2)
94  * \param len The length of the beep.
95  *
96  */
97 void beep_alarm(int alarmmode, int len);
98 
99 /**
100  * Produces a quick click-like beep.
101  *
102  * This function produces a short beep that sounds like a click.
103  *
104  */
105 void beep(void);
106 
107 /**
108  * A beep with a pitch-bend down.
109  *
110  * This function produces a pitch-bend sound with deecreasing
111  * frequency.
112  *
113  * \param len The length of the pitch-bend.
114  *
115  */
116 void beep_down(int len);
117 
118 /**
119  * Turn the beeper on.
120  *
121  * This function turns on the beeper. The beeper is turned off with
122  * the beep_off() function.
123  */
124 void beep_on(void);
125 
126 /**
127  * Turn the beeper off.
128  *
129  * This function turns the beeper off after it has been turned on with
130  * beep_on().
131  */
132 void beep_off(void);
133 
134 /**
135  * Produce a sound similar to a hard-drive spinup.
136  *
137  * This function produces a sound that is intended to be similar to
138  * the sound a hard-drive makes when it starts.
139  *
140  */
141 void beep_spinup(void);
142 
143 /**
144  * Beep for a long time (seconds)
145  *
146  * This function produces a beep with the specified length and will
147  * not return until the beep is complete. The length of the beep is
148  * specified using CLOCK_SECOND: a two second beep is CLOCK_SECOND *
149  * 2, and a quarter second beep is CLOCK_SECOND / 4.
150  *
151  * \note If the beeper is turned off with beep_off() this call will still
152  * take the same time, though it will be silent.
153  *
154  * \param len The length of the beep, measured in units of CLOCK_SECOND
155  */
156 void beep_long(clock_time_t len);
157 
158 void beep_quick(int num);
159 
160 /** @} */
161 /** @} */
162 
163 #endif /* __BEEP_H__ */