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.3 2006/06/18 08:07:31 adamdunkels 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_ON 1 00054 #define BEEP_OFF 0 00055 00056 #define BEEP_ALARM1 1 00057 #define BEEP_ALARM2 2 00058 00059 #include "sys/clock.h" 00060 00061 /** 00062 * Beep for a specified time. 00063 * 00064 * This function causes the beeper to beep for the specified time. The 00065 * time is measured in the same units as for the clock_delay() 00066 * function. 00067 * 00068 * \note This function will hang the CPU during the beep. 00069 * 00070 * \note This function will stop any beep that was on previously when this 00071 * function ends. 00072 * 00073 * \note If the beeper is turned off with beep_off() this call will still 00074 * take the same time, though it will be silent. 00075 * 00076 * \param len The length of the beep. 00077 * 00078 */ 00079 void beep_beep(int len); 00080 00081 /** 00082 * Beep an alarm for a specified time. 00083 * 00084 * This function causes the beeper to beep for the specified time. The 00085 * time is measured in the same units as for the clock_delay() 00086 * function. 00087 * 00088 * \note This function will hang the CPU during the beep. 00089 * 00090 * \note This function will stop any beep that was on previously when this 00091 * function ends. 00092 * 00093 * \note If the beeper is turned off with beep_off() this call will still 00094 * take the same time, though it will be silent. 00095 * 00096 * \param alarmmode The alarm mode (BEEP_ALARM1,BEEP_ALARM2) 00097 * \param len The length of the beep. 00098 * 00099 */ 00100 void beep_alarm(int alarmmode, int len); 00101 00102 /** 00103 * Produces a quick click-like beep. 00104 * 00105 * This function produces a short beep that sounds like a click. 00106 * 00107 */ 00108 void beep(void); 00109 00110 /** 00111 * A beep with a pitch-bend down. 00112 * 00113 * This function produces a pitch-bend sound with deecreasing 00114 * frequency. 00115 * 00116 * \param len The length of the pitch-bend. 00117 * 00118 */ 00119 void beep_down(int len); 00120 00121 /** 00122 * Turn the beeper on. 00123 * 00124 * This function turns on the beeper. The beeper is turned off with 00125 * the beep_off() function. 00126 */ 00127 void beep_on(void); 00128 00129 /** 00130 * Turn the beeper off. 00131 * 00132 * This function turns the beeper off after it has been turned on with 00133 * beep_on(). 00134 */ 00135 void beep_off(void); 00136 00137 /** 00138 * Produce a sound similar to a hard-drive spinup. 00139 * 00140 * This function produces a sound that is intended to be similar to 00141 * the sound a hard-drive makes when it starts. 00142 * 00143 */ 00144 void beep_spinup(void); 00145 00146 /** 00147 * Beep for a long time (seconds) 00148 * 00149 * This function produces a beep with the specified length and will 00150 * not return until the beep is complete. The length of the beep is 00151 * specified using CLOCK_SECOND: a two second beep is CLOCK_SECOND * 00152 * 2, and a quarter second beep is CLOCK_SECOND / 4. 00153 * 00154 * \note If the beeper is turned off with beep_off() this call will still 00155 * take the same time, though it will be silent. 00156 * 00157 * \param len The length of the beep, measured in units of CLOCK_SECOND 00158 */ 00159 void beep_long(clock_time_t len); 00160 00161 void beep_quick(int num); 00162 00163 /** @} */ 00164 /** @} */ 00165 00166 #endif /* __BEEP_H__ */