mirror of
https://github.com/eclipse/upm.git
synced 2025-03-15 04:57:30 +03:00
ecs1030: remove custom exception and use a standard one
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
84f795e453
commit
66d688bc90
@ -25,22 +25,18 @@
|
||||
#include <iostream>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <string>
|
||||
#include <stdexcept>
|
||||
|
||||
#include "ecs1030.h"
|
||||
|
||||
using namespace upm;
|
||||
|
||||
struct ECS1030Exception : public std::exception {
|
||||
std::string message;
|
||||
ECS1030Exception (std::string msg) : message (msg) { }
|
||||
~ECS1030Exception () throw () { }
|
||||
const char* what() const throw () { return message.c_str(); }
|
||||
};
|
||||
|
||||
ECS1030::ECS1030 (uint8_t pinNumber) {
|
||||
m_dataPinCtx = mraa_aio_init(pinNumber);
|
||||
if (m_dataPinCtx == NULL) {
|
||||
throw ECS1030Exception ("GPIO failed to initilize");
|
||||
throw std::invalid_argument(std::string(__FUNCTION__) +
|
||||
": mraa_aio_init() failed");
|
||||
}
|
||||
|
||||
m_calibration = 111.1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user