/** @see https:developer.mbed.org/users/justinkim/code/PiezoBuzzer_HelloWorld_WIZwiki-W7500 */
Fork of PWM_Tone_Library by
Revision 1:55441ef38cc1, committed 2016-05-05
- Comitter:
- el14bz
- Date:
- Thu May 05 11:28:56 2016 +0000
- Parent:
- 0:d06af372d384
- Commit message:
- I commit
Changed in this revision
pwm_tone.cpp | Show diff for this revision Revisions of this file |
pwm_tone.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/pwm_tone.cpp Fri Jul 24 05:01:45 2015 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* Includes ------------------------------------------------------------------*/ -#include "pwm_tone.h" - -/* Private typedef -----------------------------------------------------------*/ -/* Private define ------------------------------------------------------------*/ -/* Private variables ---------------------------------------------------------*/ -/* Private function prototypes -----------------------------------------------*/ -/* Private functions ---------------------------------------------------------*/ - -/** - * @brief Tune Function - * @param name : Choose the PwmOut - period : this param is tune value. (C_3...B_5) - beat : this param is beat value. (1..16) 1 means 1/16 beat - * @retval None - */ -void Tune(PwmOut name, int period, int beat) -{ - int delay; - - delay = beat*63; - name.period_us(period); - name.write(0.50f); // 50% duty cycle - wait_ms(delay); // 1 beat - name.period_us(0); // Sound off -} - -/** - * @brief Auto tunes Function - * @param name : Choose the PwmOut - period : this param is tune value. (C_3...B_5) - beat : this param is beat value. (1..16) 1 means 1/16 beat - * @retval None - */ -void Auto_tunes(PwmOut name, int period, int beat) -{ - int delay; - - delay = beat*63; - name.period_us(period); - name.write(0.50f); // 50% duty cycle - wait_ms(delay); -} - -/** - * @brief Stop tunes Function - * @param name : Choose the PwmOut - * @retval None - */ -void Stop_tunes(PwmOut name) -{ - name.period_us(0); -}
--- a/pwm_tone.h Fri Jul 24 05:01:45 2015 +0000 +++ b/pwm_tone.h Thu May 05 11:28:56 2016 +0000 @@ -1,3 +1,7 @@ +/** + @see https:developer.mbed.org/users/justinkim/code/PiezoBuzzer_HelloWorld_WIZwiki-W7500 + */ + /* Includes ------------------------------------------------------------------*/ #include "mbed.h"