Cleanup of UPM C++ examples. Switched from heap allocation to
stack allocation when possible. This simplifies the samples since it
removes the need for explicit memory management. A script was used to
identify and replace pointer use. To simplify the replace script, I
re-formatted the C++ examples using the UPM .clang-format file.
Unfortuantely this changes the look of the UPM C++ examples to a large
degree. However, examples will now have a standard look/feel and
uniform formatting.
* Ran clang-format w/provided UPM .clang-format file
* Removed new's/delete's whenever possible (left those in interface
examples)
* Added IIO sensor library implementation of callback void* arg
* Converted all sleeps to upm defined delays (added header when
necessary)
* Scrubbed CXX example includes
Signed-off-by: Noel Eck <noel.eck@intel.com>
There are some issues using this device on the 101 with Firmata:
1. You cannot use any other ADC resolution than 1024. By default the
driver would try to set 12b resolution for improved accuracy. Doing
this on the 101 yielded nonsensical readings causing the driver to
fail. Using 10b resolution will yield less accuracy, but at least the
driver will function.
2. After the first ADC read, and for some time period after, the MRAA
aio_read() calls will always return 0. This would cause an exception
to be thrown by the driver since this is an invalid reading. Now, we
do an analog read on each channel and sleep for .5 seconds in the ctor
to get around this problem. It is a hack and should be properly fixed
somewhere else (firmata? MRAA?).
Some code was reworked/renamed to make it more clear what is actually
going on. In addition a setDebug() method was added to enable some
debugging output.
Signed-off-by: Jon Trulson <jtrulson@ics.com>
To make room for UPM C and C++ sensor code to coexist, all UPM
C++ headers have been renamed from h -> hpp. This commit contains
updates to documentation, includes, cmake collateral, examples, and
swig interface files.
* Renamed all cxx/cpp header files which contain the string
'copyright intel' from .h -> .hpp (if not already hpp).
* Replaced all references to .h with .hpp in documentation,
source files, cmake collateral, example code, and swig interface
files.
* Replaced cmake variable module_h with module_hpp.
* Intentionally left upm.h since this file currently does not
contain code (documentation only).
Signed-off-by: Noel Eck <noel.eck@intel.com>