Private
Public Access
2
0

mraa: Remove trailing whitespace/tabs from various parts

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
Brendan Le Foll
2015-12-21 15:27:15 +00:00
parent 79609ba359
commit 8862ebd9f2
5 changed files with 31 additions and 29 deletions

View File

@@ -43,13 +43,13 @@ struct IioEventData
int diff; int diff;
}; };
class IioHandler class IioHandler
{ {
public: public:
virtual void onIioEvent(const IioEventData& eventData) = 0; virtual void onIioEvent(const IioEventData& eventData) = 0;
}; };
/** /**
* @brief API to Industrial IO * @brief API to Industrial IO
* *
@@ -108,9 +108,9 @@ class Iio
mraa_iio_close(m_iio); mraa_iio_close(m_iio);
} }
/** /**
* Get device name * Get device name
* *
* @returns The 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 * @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 attributeName attribute mame
* @param value int value * @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 attributeName attribute mame
* @param value float value * @param value float value
@@ -205,7 +205,7 @@ class Iio
} }
/** /**
* Register event handler. * Register event handler.
* *
* @param handler handler class that implements IioHandler * @param handler handler class that implements IioHandler
* *
@@ -237,7 +237,7 @@ class Iio
eventData.diff = different; eventData.diff = different;
handler->onIioEvent(eventData); handler->onIioEvent(eventData);
} }
} }
mraa_iio_context m_iio; mraa_iio_context m_iio;
}; };

View File

@@ -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 ## 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. For platforms without IIO hardware the iio_dummy driver can be used. You can
You must add the following config fragment. Known to work for kernel 3.19 and later. 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> <pre><code>
CONFIG_IIO_DUMMY_EVGEN=m CONFIG_IIO_DUMMY_EVGEN=m
CONFIG_IIO_SIMPLE_DUMMY=m CONFIG_IIO_SIMPLE_DUMMY=m

View File

@@ -23,7 +23,7 @@
*/ */
#include <unistd.h> #include <unistd.h>
#include <iostream> #include <iostream>
#include <math.h> #include <math.h>
#include <float.h> #include <float.h>
#include "mraa/iio.hpp" #include "mraa/iio.hpp"
@@ -80,7 +80,7 @@ void log_result(std::string test_name, std::string attr_name, bool expect_succes
else else
result = success ? "FAIL" : "PASS"; result = success ? "FAIL" : "PASS";
if (attr_name.empty()) 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 else
fprintf(stdout, "%s(%s): %s\n", test_name.c_str(), attr_name.c_str(), result.c_str()); fprintf(stdout, "%s(%s): %s\n", test_name.c_str(), attr_name.c_str(), result.c_str());
} }
@@ -113,39 +113,39 @@ main()
IioTestHandler testHandler; IioTestHandler testHandler;
std::string deviceName; std::string deviceName;
try { 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; std::cout << "IIO device 0 found by id." << std::endl;
deviceName = iio_device0->getDeviceName(); deviceName = iio_device0->getDeviceName();
delete iio_device0; delete iio_device0;
} catch (std::exception& e) { } catch (std::exception& e) {
std::cerr << "IIO device 0 not found." << std::endl; std::cerr << "IIO device 0 not found." << std::endl;
return EXIT_FAILURE; return EXIT_FAILURE;
} }
try { try {
mraa::Iio* iio_device1 = new mraa::Iio(1); mraa::Iio* iio_device1 = new mraa::Iio(1);
delete iio_device1; delete iio_device1;
} catch (std::exception& e) { } catch (std::exception& e) {
std::cerr << "IIO device 1 not found. This is expected behavior." << std::endl; std::cerr << "IIO device 1 not found. This is expected behavior." << std::endl;
} }
try { try {
iio_device = new mraa::Iio(deviceName); iio_device = new mraa::Iio(deviceName);
std::cout << "IIO device 0 found by name." << std::endl; std::cout << "IIO device 0 found by name." << std::endl;
} catch (std::exception& e) { } catch (std::exception& e) {
std::cerr << "IIO device 0 not found." << std::endl; std::cerr << "IIO device 0 not found." << std::endl;
return EXIT_FAILURE; 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_accel_x_raw", 100, EXPECT_FAILURE);
IIO_RUN(writeFloat, "in_voltage0_scale", 100, EXPECT_FAILURE); IIO_RUN(writeFloat, "in_voltage0_scale", 100, EXPECT_FAILURE);
IIO_RUN(writeInt, "out_voltage0_raw", 100, EXPECT_SUCCESS); IIO_RUN(writeInt, "out_voltage0_raw", 100, EXPECT_SUCCESS);
IIO_TEST(readInt, "in_accel_x_raw", 34, EXPECT_SUCCESS); IIO_TEST(readInt, "in_accel_x_raw", 34, EXPECT_SUCCESS);
IIO_TEST(readFloat, "in_voltage0_scale", 0.001333, 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_RUN(writeInt, "events/in_voltage0_thresh_rising_en", 1, EXPECT_SUCCESS);
IIO_TRY(registerEventHandler(&testHandler)); IIO_TRY(registerEventHandler(&testHandler));
eventCount = 0; eventCount = 0;
generate_event(); generate_event();
usleep(500000); usleep(500000);

View File

@@ -550,9 +550,9 @@ mraa_iio_create_trigger(mraa_iio_context dev, const char* trigger)
if (stat(IIO_CONFIGFS_TRIGGER, &configfs_status) == 0) { if (stat(IIO_CONFIGFS_TRIGGER, &configfs_status) == 0) {
memset(buf, 0, MAX_SIZE); memset(buf, 0, MAX_SIZE);
snprintf(buf, MAX_SIZE, IIO_CONFIGFS_TRIGGER "%s", trigger); snprintf(buf, MAX_SIZE, IIO_CONFIGFS_TRIGGER "%s", trigger);
// we actually don't care if this doesn't succeed, as it just means // we actually don't care if this doesn't succeed, as it just means
// it's already been initialised // it's already been initialised
mkdir(buf, configfs_status.st_mode); mkdir(buf, configfs_status.st_mode);
} }
return MRAA_ERROR_UNSPECIFIED; return MRAA_ERROR_UNSPECIFIED;

View File

@@ -202,7 +202,7 @@ mraa_result_t
mraa_iio_detect() mraa_iio_detect()
{ {
plat_iio = (mraa_iio_info_t*) calloc(1, sizeof(mraa_iio_info_t)); 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 // Now detect IIO devices, linux only
// find how many iio devices we have if we haven't already // find how many iio devices we have if we haven't already
if (num_iio_devices == 0) { if (num_iio_devices == 0) {