sound.c

gehe zur Dokumentation dieser Datei
00001 /****************************************************************************/
00030 /*****************************************************************************
00031 *                                                                            *
00032 *   This program is free software; you can redistribute it and/or modify     *
00033 *   it under the terms of the GNU General Public License as published by     *
00034 *   the Free Software Foundation; either version 2 of the License, or        *
00035 *   any later version.                                                       *
00036 *                                                                            *
00037 *****************************************************************************/
00038 #include "asuro.h"
00039 
00040 
00041 
00042 /****************************************************************************/
00065 void Sound (
00066   uint16_t freq,
00067   uint16_t duration_msec,
00068   uint8_t  amplitude)
00069 {
00070   uint16_t wait_tics;
00071   uint32_t n,k,period_usec,dauer_usec;
00072 
00073   period_usec = 1000000L / freq;
00074   dauer_usec = 1000 * (uint32_t) duration_msec;
00075   k = dauer_usec / period_usec;
00076 
00077   //IR Interuptfreq=36KHz
00078   //Wavefreq=18KHz
00079 
00080   wait_tics = 18000 / freq;
00081 
00082   MotorSpeed (amplitude, amplitude);
00083 
00084   for (n = 0; n < k; n++)
00085   {
00086     MotorDir (FWD, FWD);
00087     Sleep (wait_tics);
00088     MotorDir (RWD, RWD);
00089     Sleep (wait_tics);
00090   }
00091   MotorSpeed (0, 0);
00092 }
00093 
00094 #define BEEP sound (1000, 100, 255)

Erzeugt am Sun Nov 18 18:24:52 2007 für ASURO Library von  doxygen 1.5.1-p1