Contiki 2.6

beep.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2005, Swedish Institute of Computer Science
00003  * All rights reserved. 
00004  *
00005  * Redistribution and use in source and binary forms, with or without 
00006  * modification, are permitted provided that the following conditions 
00007  * are met: 
00008  * 1. Redistributions of source code must retain the above copyright 
00009  *    notice, this list of conditions and the following disclaimer. 
00010  * 2. Redistributions in binary form must reproduce the above copyright 
00011  *    notice, this list of conditions and the following disclaimer in the 
00012  *    documentation and/or other materials provided with the distribution. 
00013  * 3. Neither the name of the Institute nor the names of its contributors 
00014  *    may be used to endorse or promote products derived from this software 
00015  *    without specific prior written permission. 
00016  *
00017  * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 
00018  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
00019  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
00020  * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 
00021  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 
00022  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 
00023  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
00024  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
00025  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 
00026  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 
00027  * SUCH DAMAGE. 
00028  *
00029  * This file is part of the Contiki operating system.
00030  *
00031  * @(#)$Id: beep.h,v 1.4 2006/07/07 06:36:38 nifi Exp $
00032  */
00033 /**
00034  * \addtogroup esb
00035  * @{
00036  */
00037 
00038 /**
00039  * \defgroup beeper Beeper interface 
00040  * @{
00041  */
00042 
00043 /**
00044  * \file
00045  * Interface to the beeper.
00046  * \author Adam Dunkels <adam@sics.se>
00047  *
00048  */
00049 
00050 #ifndef __BEEP_H__
00051 #define __BEEP_H__
00052 
00053 #define BEEP_ALARM1 1
00054 #define BEEP_ALARM2 2
00055 
00056 #include "sys/clock.h"
00057 
00058 /**
00059  * Beep for a specified time.
00060  *
00061  * This function causes the beeper to beep for the specified time. The
00062  * time is measured in the same units as for the clock_delay()
00063  * function.
00064  *
00065  * \note This function will hang the CPU during the beep.
00066  *
00067  * \note This function will stop any beep that was on previously when this 
00068  * function ends.
00069  *
00070  * \note If the beeper is turned off with beep_off() this call will still 
00071  * take the same time, though it will be silent.
00072  *
00073  * \param len The length of the beep.
00074  *
00075  */
00076 void beep_beep(int len);
00077 
00078 /**
00079  * Beep an alarm for a specified time.
00080  *
00081  * This function causes the beeper to beep for the specified time. The
00082  * time is measured in the same units as for the clock_delay()
00083  * function.
00084  *
00085  * \note This function will hang the CPU during the beep.
00086  *
00087  * \note This function will stop any beep that was on previously when this 
00088  * function ends.
00089  *
00090  * \note If the beeper is turned off with beep_off() this call will still 
00091  * take the same time, though it will be silent.
00092  *
00093  * \param alarmmode The alarm mode (BEEP_ALARM1,BEEP_ALARM2)
00094  * \param len The length of the beep.
00095  *
00096  */
00097 void beep_alarm(int alarmmode, int len);
00098 
00099 /**
00100  * Produces a quick click-like beep.
00101  *
00102  * This function produces a short beep that sounds like a click.
00103  *
00104  */
00105 void beep(void);
00106 
00107 /**
00108  * A beep with a pitch-bend down.
00109  *
00110  * This function produces a pitch-bend sound with deecreasing
00111  * frequency.
00112  *
00113  * \param len The length of the pitch-bend.
00114  *
00115  */
00116 void beep_down(int len);
00117 
00118 /**
00119  * Turn the beeper on.
00120  *
00121  * This function turns on the beeper. The beeper is turned off with
00122  * the beep_off() function.
00123  */
00124 void beep_on(void);
00125 
00126 /**
00127  * Turn the beeper off.
00128  *
00129  * This function turns the beeper off after it has been turned on with
00130  * beep_on().
00131  */
00132 void beep_off(void);
00133 
00134 /**
00135  * Produce a sound similar to a hard-drive spinup.
00136  *
00137  * This function produces a sound that is intended to be similar to
00138  * the sound a hard-drive makes when it starts.
00139  *
00140  */
00141 void beep_spinup(void);
00142 
00143 /**
00144  * Beep for a long time (seconds)
00145  *
00146  * This function produces a beep with the specified length and will
00147  * not return until the beep is complete. The length of the beep is
00148  * specified using CLOCK_SECOND: a two second beep is CLOCK_SECOND *
00149  * 2, and a quarter second beep is CLOCK_SECOND / 4.
00150  *
00151  * \note If the beeper is turned off with beep_off() this call will still 
00152  * take the same time, though it will be silent.
00153  *
00154  * \param len The length of the beep, measured in units of CLOCK_SECOND
00155  */
00156 void beep_long(clock_time_t len);
00157 
00158 void beep_quick(int num);
00159 
00160 /** @} */
00161 /** @} */
00162 
00163 #endif /* __BEEP_H__ */