mirror of
https://github.com/eclipse/upm.git
synced 2025-03-15 04:57:30 +03:00
buzzer: throw exception(s) on fatal errors
Signed-off-by: Jon Trulson <jtrulson@ics.com> Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
This commit is contained in:
parent
bea94a70b2
commit
8345687ab9
@ -23,6 +23,8 @@
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <stdexcept>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "buzzer.h"
|
||||
@ -34,7 +36,8 @@ Buzzer::Buzzer(int pinNumber) {
|
||||
m_pwm_context = mraa_pwm_init(pinNumber);
|
||||
if(m_pwm_context == 0)
|
||||
{
|
||||
cerr << __FUNCTION__ << ": Error initializing PWM on pin " << pinNumber << endl;
|
||||
throw std::invalid_argument(std::string(__FUNCTION__) +
|
||||
": mraa_pwm_init() failed, invalid pin?");
|
||||
return;
|
||||
}
|
||||
m_name = "Buzzer";
|
||||
|
Loading…
x
Reference in New Issue
Block a user