Simple tool for PWM piezo speaker
Diff: Piezo.h
- Revision:
- 3:df1e38c2c57b
- Parent:
- 2:fa6d9a0b66fc
--- a/Piezo.h Sat Oct 01 21:15:45 2016 +0000 +++ b/Piezo.h Sat Oct 01 21:24:26 2016 +0000 @@ -50,15 +50,24 @@ class Piezo { - public: + + /** Constructor, Pin must be PWM capable*/ Piezo(PinName Pwmout); - + + /** Blocking function for playing sound of given frequency and + * duration in ms + */ void play(float, int); + + /** Nonblocking function for playing sound of given frequency and + * duration in ms + */ void playAsync(float, int); - + + /** Function for stopping all sounds */ void stop(); - + private: PwmOut _pwm; Ticker _timer;