Fork of beep lib. Enables play of continous tones and changing of frequency on the fly

Fork of beep by Peter Drescher

Committer:
dreschpe
Date:
Tue Feb 01 18:44:45 2011 +0000
Revision:
0:18e4a9c978ec
Child:
1:ddccf0a4a414

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dreschpe 0:18e4a9c978ec 1 #ifndef MBED_BEEP_H
dreschpe 0:18e4a9c978ec 2 #define MBED_BEEP_H
dreschpe 0:18e4a9c978ec 3
dreschpe 0:18e4a9c978ec 4 #include "mbed.h"
dreschpe 0:18e4a9c978ec 5
dreschpe 0:18e4a9c978ec 6 namespace mbed {
dreschpe 0:18e4a9c978ec 7
dreschpe 0:18e4a9c978ec 8 /* Class: Beep
dreschpe 0:18e4a9c978ec 9 * A class witch uses pwm to controle a beeper to generate sounds.
dreschpe 0:18e4a9c978ec 10 */
dreschpe 0:18e4a9c978ec 11 class Beep {
dreschpe 0:18e4a9c978ec 12
dreschpe 0:18e4a9c978ec 13 public:
dreschpe 0:18e4a9c978ec 14
dreschpe 0:18e4a9c978ec 15 /* Constructor: Beep
dreschpe 0:18e4a9c978ec 16 * Creates a new beeper object.
dreschpe 0:18e4a9c978ec 17 *
dreschpe 0:18e4a9c978ec 18 * Variables:
dreschpe 0:18e4a9c978ec 19 * pin - The pin which is connected to the beeper.
dreschpe 0:18e4a9c978ec 20 */
dreschpe 0:18e4a9c978ec 21 Beep (PinName pin);
dreschpe 0:18e4a9c978ec 22
dreschpe 0:18e4a9c978ec 23 /* Function: beep
dreschpe 0:18e4a9c978ec 24 * Beep with given frequency and duration.
dreschpe 0:18e4a9c978ec 25 *
dreschpe 0:18e4a9c978ec 26 * Variables:
dreschpe 0:18e4a9c978ec 27 * frequency - The frequency to use.
dreschpe 0:18e4a9c978ec 28 * time - The turation to beep.
dreschpe 0:18e4a9c978ec 29 */
dreschpe 0:18e4a9c978ec 30 void beep (float frequency, float time);
dreschpe 0:18e4a9c978ec 31
dreschpe 0:18e4a9c978ec 32 void nobeep();
dreschpe 0:18e4a9c978ec 33
dreschpe 0:18e4a9c978ec 34 private :
dreschpe 0:18e4a9c978ec 35 PwmOut _pwm;
dreschpe 0:18e4a9c978ec 36 Timeout toff;
dreschpe 0:18e4a9c978ec 37 };
dreschpe 0:18e4a9c978ec 38
dreschpe 0:18e4a9c978ec 39 }
dreschpe 0:18e4a9c978ec 40 #endif