This file defines the C++ iio interface for libmraa
IioTestHandler testHandler;
std::string deviceName;
try {
std::cout << "IIO device 0 found by id." << std::endl;
delete iio_device0;
} catch (std::exception& e) {
std::cerr << "IIO device 0 not found." << std::endl;
return EXIT_FAILURE;
}
try {
delete iio_device1;
} catch (std::exception& e) {
std::cerr << "IIO device 1 not found. This is expected behavior." << std::endl;
}
try {
std::cout << "IIO device 0 found by name." << std::endl;
} catch (std::exception& e) {
std::cerr << "IIO device 0 not found." << std::endl;
return EXIT_FAILURE;
}
std::cout << "Using IIO device0. Name is " << iio_device->getDeviceName() << std::endl;
IIO_RUN(
writeFloat,
"in_accel_x_raw", 100, EXPECT_FAILURE);
IIO_RUN(
writeFloat,
"in_voltage0_scale", 100, EXPECT_FAILURE);
IIO_RUN(
writeInt,
"out_voltage0_raw", 100, EXPECT_SUCCESS);
IIO_TEST(
readInt,
"in_accel_x_raw", 34, EXPECT_SUCCESS);
IIO_TEST(
readFloat,
"in_voltage0_scale", 0.001333, EXPECT_SUCCESS);
IIO_RUN(
writeInt,
"events/in_voltage0_thresh_rising_en", 1, EXPECT_SUCCESS);
eventCount = 0;
generate_event();
usleep(500000);
log_result("eventReceived", "", (eventCount == 1), true);