sound.c

gehe zur Dokumentation dieser Datei
00001 /***************************************************************************/
00016 /***************************************************************************
00017  *                                                                         *
00018  *   This program is free software; you can redistribute it and/or modify  *
00019  *   it under the terms of the GNU General Public License as published by  *
00020  *   the Free Software Foundation; either version 2 of the License, or     *
00021  *   any later version.                                                    *
00022  ***************************************************************************/
00023 
00024 #include "asuro.h"
00025 
00046 void Sound(uint16_t freq, uint16_t duration_msec, uint8_t amplitude)
00047 {
00048   uint16_t n,k,wait_tics;
00049   uint32_t period_usec,dauer_usec;
00050 
00051   period_usec=1000000L/freq;
00052   dauer_usec=1000*duration_msec;
00053   k=dauer_usec/period_usec;
00054 
00055 //IR Interuptfreq=36KHz
00056 //Wavefreq=18KHz
00057 
00058   wait_tics=18000/freq;
00059 
00060   MotorSpeed(amplitude,amplitude);
00061 
00062   for (n=0;n<k;n++)
00063   {
00064     MotorDir(FWD,FWD);
00065     Sleep(wait_tics);
00066     MotorDir(RWD,RWD);
00067     Sleep(wait_tics);
00068   }
00069   MotorSpeed(0,0);
00070 }
00071 
00072 #define BEEP sound(1000, 100, 255)
00073 

Erzeugt am Wed Feb 14 16:10:02 2007 für ASURO Library von  doxygen 1.5.1-p1