buzzer: fix for PWM frequencies

Signed-off-by: Kiveisha Yevgeniy <yevgeniy.kiveisha@intel.com>
This commit is contained in:
Kiveisha Yevgeniy
2014-06-20 11:04:25 +00:00
parent d00500ba12
commit b1e548ae8a
3 changed files with 18 additions and 32 deletions

View File

@ -34,14 +34,14 @@ Buzzer::Buzzer (int pinNumber) {
m_name = "Buzzer";
}
int Buzzer::playSound (int note) {
int Buzzer::playSound (int note, int delay) {
maa_pwm_enable (m_pwm_context, 1);
maa_pwm_period_us (m_pwm_context, note);
maa_pwm_write (m_pwm_context, 50.0);
usleep (10000);
maa_pwm_pulsewidth_us (m_pwm_context, note / 2);
usleep (delay);
maa_pwm_enable (m_pwm_context, 0);
return 0;
return note;
}
Buzzer::~Buzzer() {