mirror of
https://github.com/eclipse/upm.git
synced 2025-03-24 01:10:22 +03:00
biss0001: 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
03cb2ec362
commit
a564258fb0
@ -23,6 +23,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <string>
|
||||||
|
#include <stdexcept>
|
||||||
|
|
||||||
#include "biss0001.h"
|
#include "biss0001.h"
|
||||||
|
|
||||||
@ -30,7 +32,12 @@ using namespace upm;
|
|||||||
|
|
||||||
BISS0001::BISS0001(int pin)
|
BISS0001::BISS0001(int pin)
|
||||||
{
|
{
|
||||||
m_gpio = mraa_gpio_init(pin);
|
if ( !(m_gpio = mraa_gpio_init(pin)) )
|
||||||
|
{
|
||||||
|
throw std::invalid_argument(std::string(__FUNCTION__) +
|
||||||
|
": mraa_gpio_init() failed, invalid pin?");
|
||||||
|
return;
|
||||||
|
}
|
||||||
mraa_gpio_dir(m_gpio, MRAA_GPIO_IN);
|
mraa_gpio_dir(m_gpio, MRAA_GPIO_IN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user