mirror of
https://github.com/eclipse/upm.git
synced 2025-07-03 18:31:13 +03:00
Removed old interfaces and replaced them with the new ones.
Signed-off-by: Serban Waltter <serban.waltter@rinftech.com> Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
This commit is contained in:

committed by
Mihai Tudor Panu

parent
b6e53f7da8
commit
34bb12933d
@ -27,7 +27,6 @@
|
||||
#include <stddef.h>
|
||||
|
||||
#include "ads1015.hpp"
|
||||
#include "iADC.hpp"
|
||||
#include "mraa/gpio.hpp"
|
||||
#include "upm_utilities.h"
|
||||
|
||||
@ -39,24 +38,21 @@ int
|
||||
main()
|
||||
{
|
||||
/* Create an instance of the ADS1015 sensor */
|
||||
upm::ADS1015 sensor(EDISON_I2C_BUS);
|
||||
upm::ADS1015 adc(EDISON_I2C_BUS);
|
||||
mraa::Gpio gpio(EDISON_GPIO_SI7005_CS);
|
||||
gpio.dir(mraa::DIR_OUT_HIGH);
|
||||
|
||||
/* Show usage from the IADC interface */
|
||||
upm::IADC* adc = static_cast<upm::IADC*>(&sensor);
|
||||
|
||||
if (adc == NULL) {
|
||||
std::cout << "ADC not detected" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
std::cout << "ADC " << adc->getModuleName() << " detected. ";
|
||||
std::cout << adc->getNumInputs() << " inputs available" << std::endl;
|
||||
// if (adc == NULL) {
|
||||
// std::cout << "ADC not detected" << std::endl;
|
||||
// return 1;
|
||||
// }
|
||||
std::cout << "ADC " << adc.getModuleName() << " detected. ";
|
||||
std::cout << adc.getNumInputs() << " inputs available" << std::endl;
|
||||
while (true) {
|
||||
for (unsigned int i = 0; i < adc->getNumInputs(); ++i) {
|
||||
for (unsigned int i = 0; i < adc.getNumInputs(); ++i) {
|
||||
std::cout << "Input " << i;
|
||||
try {
|
||||
float voltage = adc->getVoltage(i);
|
||||
float voltage = adc.getVoltage(i);
|
||||
std::cout << ": Voltage = " << voltage << "V" << std::endl;
|
||||
} catch (std::exception& e) {
|
||||
std::cerr << e.what() << std::endl;
|
||||
|
Reference in New Issue
Block a user