2017-04-02 23:04:04 -07:00
|
|
|
/*
|
|
|
|
* Author: Abhishek Malik <abhishek.malik@intel.com>
|
|
|
|
* Copyright (c) 2017 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.
|
2017-04-02 23:04:04 -07:00
|
|
|
*
|
2019-07-30 19:41:32 -07:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-04-02 23:04:04 -07:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
#include <signal.h>
|
2017-08-30 15:00:29 -07:00
|
|
|
|
2017-04-02 23:04:04 -07:00
|
|
|
#include "rsc.hpp"
|
2017-08-30 15:00:29 -07:00
|
|
|
#include "upm_utilities.h"
|
2017-04-02 23:04:04 -07:00
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
int shouldRun = true;
|
|
|
|
|
2017-08-30 15:00:29 -07:00
|
|
|
void
|
|
|
|
sig_handler(int signo)
|
2017-04-02 23:04:04 -07:00
|
|
|
{
|
|
|
|
if (signo == SIGINT)
|
|
|
|
shouldRun = false;
|
|
|
|
}
|
|
|
|
|
2017-08-30 15:00:29 -07:00
|
|
|
int
|
|
|
|
main()
|
2017-04-02 23:04:04 -07:00
|
|
|
{
|
|
|
|
signal(SIGINT, sig_handler);
|
|
|
|
|
2017-08-30 15:00:29 -07:00
|
|
|
//! [Interesting]
|
|
|
|
|
|
|
|
upm::RSC rsc(0, 9, 8);
|
2017-04-02 23:04:04 -07:00
|
|
|
|
2017-08-30 15:00:29 -07:00
|
|
|
cout << "Sensor Name: " << rsc.getSensorName() << endl;
|
|
|
|
rsc.setMode(NORMAL_MODE);
|
|
|
|
rsc.setDataRate(N_DR_330_SPS);
|
2017-04-02 23:04:04 -07:00
|
|
|
while (shouldRun) {
|
2017-08-30 15:00:29 -07:00
|
|
|
cout << "inH2O pressure: " << rsc.getPressure() << endl;
|
|
|
|
cout << "Temp (C): " << rsc.getTemperature() << endl;
|
2017-04-02 23:04:04 -07:00
|
|
|
|
2017-08-30 15:00:29 -07:00
|
|
|
upm_delay(1);
|
2017-04-02 23:04:04 -07:00
|
|
|
}
|
2017-08-30 15:00:29 -07:00
|
|
|
//! [Interesting]
|
2017-04-02 23:04:04 -07:00
|
|
|
|
|
|
|
cout << "Exiting..." << endl;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|