mirror of
https://github.com/eclipse/upm.git
synced 2025-03-24 01:10:22 +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 <iostream>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <string>
|
||||||
|
#include <stdexcept>
|
||||||
|
|
||||||
#include "ecs1030.h"
|
#include "ecs1030.h"
|
||||||
|
|
||||||
using namespace upm;
|
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) {
|
ECS1030::ECS1030 (uint8_t pinNumber) {
|
||||||
m_dataPinCtx = mraa_aio_init(pinNumber);
|
m_dataPinCtx = mraa_aio_init(pinNumber);
|
||||||
if (m_dataPinCtx == NULL) {
|
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;
|
m_calibration = 111.1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user