Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Dependents: PwmSpeaker-Example
Revision 1:10005e388826, committed 2015-11-12
- Comitter:
- asmellby
- Date:
- Thu Nov 12 21:20:23 2015 +0000
- Parent:
- 0:b7dd35e61bb1
- Child:
- 2:840bc39c112e
- Commit message:
- Update docs.
Changed in this revision
Speaker.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/Speaker.cpp Thu Nov 12 21:04:11 2015 +0000 +++ b/Speaker.cpp Thu Nov 12 21:20:23 2015 +0000 @@ -7,14 +7,29 @@ NOTE_C7, NOTE_CS7, NOTE_D7, NOTE_DS7, NOTE_E7, NOTE_F7, NOTE_FS7, NOTE_G7, NOTE_GS7, NOTE_A7, NOTE_AS7, NOTE_B7 }; +/** + * Set output frequency of the speaker. + * + * \param frequency The frequency to set + */ void Speaker::set_frequency(uint32_t frequency) { _pwm.period(1.0/frequency); } +/** + * Enable or disable speaker output. + * + * \param enable Whether to enable or disable the speaker + */ void Speaker::enable(bool enable) { *this = enable; } +/** + * Enable or disable the speaker output. + * + * \param setting 0 to disable speaker, other values to enable speaker. + */ Speaker& Speaker::operator=(int setting) { if (setting) { _pwm = 0.5; @@ -24,8 +39,10 @@ return *this; } -/* - * Plays an old-school ringtone in RTTTL language. +/** + * Play an old-school ringtone in RTTTL language. + * + * \param p Char array in RTTTL format */ void Speaker::play_rtttl(char * p) { // Absolutely no error checking in here