2014-08-25 23:25:11 +00:00
|
|
|
/*
|
|
|
|
* Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
|
|
|
|
* Copyright (c) 2014 Intel Corporation.
|
|
|
|
*
|
2019-07-30 19:41:32 -07:00
|
|
|
* This program and the accompanying materials are made available under the
|
|
|
|
* terms of the The MIT License which is available at
|
|
|
|
* https://opensource.org/licenses/MIT.
|
2014-08-25 23:25:11 +00:00
|
|
|
*
|
2019-07-30 19:41:32 -07:00
|
|
|
* SPDX-License-Identifier: MIT
|
2014-08-25 23:25:11 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
#include <signal.h>
|
2017-08-30 15:00:29 -07:00
|
|
|
#include <stdio.h>
|
|
|
|
|
2016-04-25 14:27:51 -07:00
|
|
|
#include "ecs1030.hpp"
|
2014-08-25 23:25:11 +00:00
|
|
|
|
|
|
|
int is_running = 0;
|
|
|
|
|
|
|
|
void
|
|
|
|
sig_handler(int signo)
|
|
|
|
{
|
|
|
|
printf("got signal\n");
|
|
|
|
if (signo == SIGINT) {
|
|
|
|
is_running = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//! [Interesting]
|
|
|
|
int
|
2017-08-30 15:00:29 -07:00
|
|
|
main(int argc, char** argv)
|
2014-08-25 23:25:11 +00:00
|
|
|
{
|
2017-08-30 15:00:29 -07:00
|
|
|
upm::ECS1030 sensor(0);
|
2014-08-25 23:25:11 +00:00
|
|
|
signal(SIGINT, sig_handler);
|
|
|
|
|
|
|
|
while (!is_running) {
|
2017-08-30 15:00:29 -07:00
|
|
|
std::cout << "I = " << sensor.getCurrency_A() << ", Power = " << sensor.getPower_A()
|
|
|
|
<< std::endl;
|
|
|
|
std::cout << "I = " << sensor.getCurrency_B() << ", Power = " << sensor.getPower_B()
|
|
|
|
<< std::endl;
|
2014-08-25 23:25:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
std::cout << "exiting application" << std::endl;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
//! [Interesting]
|