mirror of
https://github.com/eclipse/upm.git
synced 2025-03-15 04:57:30 +03:00
rotaryencoder: 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
b4e4e9ae89
commit
d4d29307a2
@ -23,6 +23,8 @@
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <stdexcept>
|
||||
|
||||
#include "rotaryencoder.h"
|
||||
|
||||
@ -33,7 +35,8 @@ RotaryEncoder::RotaryEncoder(int pinA, int pinB)
|
||||
{
|
||||
if ( !(m_gpioA = mraa_gpio_init(pinA)) )
|
||||
{
|
||||
cerr << __FUNCTION__ << ": mraa_gpio_init() failed" << endl;
|
||||
throw std::invalid_argument(std::string(__FUNCTION__) +
|
||||
": mraa_gpio_init(pinA) failed, invalid pin?");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -41,7 +44,8 @@ RotaryEncoder::RotaryEncoder(int pinA, int pinB)
|
||||
|
||||
if ( !(m_gpioB = mraa_gpio_init(pinB)) )
|
||||
{
|
||||
cerr << __FUNCTION__ << ": mraa_gpio_init() failed" << endl;
|
||||
throw std::invalid_argument(std::string(__FUNCTION__) +
|
||||
": mraa_gpio_init(pinB) failed, invalid pin?");
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user