mraa: Remove trailing whitespace/tabs from various parts
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
@@ -43,13 +43,13 @@ struct IioEventData
|
||||
int diff;
|
||||
};
|
||||
|
||||
class IioHandler
|
||||
class IioHandler
|
||||
{
|
||||
public:
|
||||
virtual void onIioEvent(const IioEventData& eventData) = 0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief API to Industrial IO
|
||||
*
|
||||
@@ -108,9 +108,9 @@ class Iio
|
||||
mraa_iio_close(m_iio);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get device name
|
||||
* Get device name
|
||||
*
|
||||
* @returns The device name
|
||||
*/
|
||||
@@ -143,7 +143,7 @@ class Iio
|
||||
}
|
||||
|
||||
/**
|
||||
* Read a float value from specified attribute.
|
||||
* Read a float value from specified attribute.
|
||||
*
|
||||
* @param attributeName attribute mame
|
||||
*
|
||||
@@ -165,7 +165,7 @@ class Iio
|
||||
}
|
||||
|
||||
/**
|
||||
* Write an int value to specified attribute.
|
||||
* Write an int value to specified attribute.
|
||||
*
|
||||
* @param attributeName attribute mame
|
||||
* @param value int value
|
||||
@@ -185,7 +185,7 @@ class Iio
|
||||
}
|
||||
|
||||
/**
|
||||
* Write a float value to specified attribute.
|
||||
* Write a float value to specified attribute.
|
||||
*
|
||||
* @param attributeName attribute mame
|
||||
* @param value float value
|
||||
@@ -205,7 +205,7 @@ class Iio
|
||||
}
|
||||
|
||||
/**
|
||||
* Register event handler.
|
||||
* Register event handler.
|
||||
*
|
||||
* @param handler handler class that implements IioHandler
|
||||
*
|
||||
@@ -237,7 +237,7 @@ class Iio
|
||||
eventData.diff = different;
|
||||
handler->onIioEvent(eventData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mraa_iio_context m_iio;
|
||||
};
|
||||
|
||||
10
docs/iio.md
10
docs/iio.md
@@ -1,9 +1,11 @@
|
||||
iio {#iio}
|
||||
iio {#iio}
|
||||
===
|
||||
IIO is the kernel's framework for supporting sensors.
|
||||
IIO is the kernel's framework for supporting sensors.
|
||||
## Using dummy_iio driver
|
||||
For platforms without IIO hardware the iio_dummy driver can be used. You can add the driver by either rebuilding the kernel with IIO component enabled or just building the IIO modules and load them.
|
||||
You must add the following config fragment. Known to work for kernel 3.19 and later.
|
||||
For platforms without IIO hardware the iio_dummy driver can be used. You can
|
||||
add the driver by either rebuilding the kernel with IIO component enabled or
|
||||
just building the IIO modules and load them. You must add the following config
|
||||
fragment. Known to work for kernel 3.19 and later.
|
||||
<pre><code>
|
||||
CONFIG_IIO_DUMMY_EVGEN=m
|
||||
CONFIG_IIO_SIMPLE_DUMMY=m
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <iostream>
|
||||
#include <iostream>
|
||||
#include <math.h>
|
||||
#include <float.h>
|
||||
#include "mraa/iio.hpp"
|
||||
@@ -80,7 +80,7 @@ void log_result(std::string test_name, std::string attr_name, bool expect_succes
|
||||
else
|
||||
result = success ? "FAIL" : "PASS";
|
||||
if (attr_name.empty())
|
||||
fprintf(stdout, "%s: %s\n", test_name.c_str(), result.c_str());
|
||||
fprintf(stdout, "%s: %s\n", test_name.c_str(), result.c_str());
|
||||
else
|
||||
fprintf(stdout, "%s(%s): %s\n", test_name.c_str(), attr_name.c_str(), result.c_str());
|
||||
}
|
||||
@@ -113,39 +113,39 @@ main()
|
||||
IioTestHandler testHandler;
|
||||
std::string deviceName;
|
||||
try {
|
||||
mraa::Iio* iio_device0 = new mraa::Iio(0);
|
||||
mraa::Iio* iio_device0 = new mraa::Iio(0);
|
||||
std::cout << "IIO device 0 found by id." << std::endl;
|
||||
deviceName = iio_device0->getDeviceName();
|
||||
delete iio_device0;
|
||||
deviceName = iio_device0->getDeviceName();
|
||||
delete iio_device0;
|
||||
} catch (std::exception& e) {
|
||||
std::cerr << "IIO device 0 not found." << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
try {
|
||||
mraa::Iio* iio_device1 = new mraa::Iio(1);
|
||||
mraa::Iio* iio_device1 = new mraa::Iio(1);
|
||||
delete iio_device1;
|
||||
} catch (std::exception& e) {
|
||||
std::cerr << "IIO device 1 not found. This is expected behavior." << std::endl;
|
||||
}
|
||||
|
||||
try {
|
||||
iio_device = new mraa::Iio(deviceName);
|
||||
std::cout << "IIO device 0 found by name." << std::endl;
|
||||
iio_device = new mraa::Iio(deviceName);
|
||||
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;
|
||||
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_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);
|
||||
IIO_TRY(registerEventHandler(&testHandler));
|
||||
IIO_TRY(registerEventHandler(&testHandler));
|
||||
eventCount = 0;
|
||||
generate_event();
|
||||
usleep(500000);
|
||||
|
||||
@@ -550,9 +550,9 @@ mraa_iio_create_trigger(mraa_iio_context dev, const char* trigger)
|
||||
if (stat(IIO_CONFIGFS_TRIGGER, &configfs_status) == 0) {
|
||||
memset(buf, 0, MAX_SIZE);
|
||||
snprintf(buf, MAX_SIZE, IIO_CONFIGFS_TRIGGER "%s", trigger);
|
||||
// we actually don't care if this doesn't succeed, as it just means
|
||||
// it's already been initialised
|
||||
mkdir(buf, configfs_status.st_mode);
|
||||
// we actually don't care if this doesn't succeed, as it just means
|
||||
// it's already been initialised
|
||||
mkdir(buf, configfs_status.st_mode);
|
||||
}
|
||||
|
||||
return MRAA_ERROR_UNSPECIFIED;
|
||||
|
||||
@@ -202,7 +202,7 @@ mraa_result_t
|
||||
mraa_iio_detect()
|
||||
{
|
||||
plat_iio = (mraa_iio_info_t*) calloc(1, sizeof(mraa_iio_info_t));
|
||||
plat_iio->iio_device_count = num_iio_devices;
|
||||
plat_iio->iio_device_count = num_iio_devices;
|
||||
// Now detect IIO devices, linux only
|
||||
// find how many iio devices we have if we haven't already
|
||||
if (num_iio_devices == 0) {
|
||||
|
||||
Reference in New Issue
Block a user