Compare commits

..

98 Commits

Author SHA1 Message Date
d866b25f85 upm: v0.8.0
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2016-09-14 13:45:04 -07:00
2583d0852d examples: removed jslint, jshint and global from javascript example files
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2016-08-31 13:25:09 -07:00
2de319c254 docs: removed superfluous UPM API reference from sensor names
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2016-08-30 16:51:10 -07:00
77fbf49f93 htu21d: fixed 16-bit i2c reads and added extra functionality
Fixed 16-bit read code to use the correct mraa function to align with
the datasheet.  Added code for dew point calculation and single function
to retreive temp, humidity, and dewpoint.  Other clean up as well.

Signed-off-by: Bill Penner <william.penner@intel.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2016-08-30 16:15:28 -07:00
372d3e980f docs: added MPL3115A2 to list of known limitations
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2016-08-30 16:01:58 -07:00
dd014c718f si7005: fixed sensor description and added example link
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2016-08-30 15:54:28 -07:00
5304192813 jhd1313m1: added backlight control functions
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2016-08-30 15:16:07 -07:00
8d524b8744 docs: updated build documentation with dependencies and added Travis build status
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2016-08-30 12:44:30 -07:00
deff852839 docs: updated list of known limitations
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2016-08-26 17:03:17 -07:00
2d2ee8d1f0 apa102: added extra functionality
Exposed call to MRAA SPI frequency for those super long strips where the clock signal will degrade and introduce glitches. Slowing down will fix it without the need for extra filtering or redrivers. Batch mode also helps since only one write per frame will be required.

Added functions that control brightness only for fade effects without the need to keep an extra copy of the pixel color map.

Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2016-08-25 17:33:41 -07:00
9a83bb7530 ads1x15: changed error types to runtime errors on failed i2c ops
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2016-08-23 10:41:14 -07:00
2b642ab7a4 ssd1306: failed i2c frequency change should be non-fatal for this device
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2016-08-23 10:40:59 -07:00
bde7259ee8 mcp9808: failed i2c frequency change should be non-fatal for this device
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2016-08-23 10:40:45 -07:00
dc93fb11ff otp538u: some fixes to get working on the Arduino 101 with Firmata
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>
2016-08-16 11:22:43 -06:00
19d1af6a48 ads1x15: failed i2c frequency change should be non-fatal for this device
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2016-08-12 11:59:47 -07:00
e689dc175c l3gd20: add l3gd20h chipid to ctor check as well
Signed-off-by: Jon Trulson <jtrulson@ics.com>
2016-08-10 13:01:33 -06:00
06ecae7212 l3gd20: Add support for I2C connections
The existing driver only supported IIO.  This change adds support for
controlling the device via an I2C connection. In addition, there is a
new C++ example for it (l3gd20-i2c.cxx).

Note: Only basic functionality is supported, though a full register
map and access functions are available to fill in any desired
functionality.

Note, that some methods are only usable with specific connection
types.  See the documentation.

Signed-off-by: Jon Trulson <jtrulson@ics.com>
2016-08-09 16:03:42 -06:00
4faa71d239 upm: v0.7.3
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2016-08-04 17:19:04 -07:00
5265bada9c ms5611: description and some doxygen tags updated
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2016-08-04 17:12:45 -07:00
84067826eb upm.h: Added manufacturwer entry for Measurement Specialties
Signed-off-by: Henry Bruce <henry.bruce@intel.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2016-08-04 17:12:28 -07:00
98e3621c93 ms5611: Initial implementation
Signed-off-by: Henry Bruce <henry.bruce@intel.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2016-08-04 17:12:10 -07:00
d79799bab9 docs: updated doxygen tags for some sensors
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2016-08-04 17:11:52 -07:00
49e04593d8 build: remove unnecessary BUILDSWIG option
Signed-off-by: Jon Trulson <jtrulson@ics.com>
2016-08-03 11:54:36 -06:00
bda66a3d06 grovetemp: updated conversion formula for v1.2 compatibility
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2016-08-02 10:16:46 -07:00
84a77730be examples: updated module names for some C++ examples
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2016-08-01 18:33:00 -07:00
b08fc8d48d grove: split code base for grove sensors into individual files
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2016-08-01 18:25:36 -07:00
e64f192fb7 apds9930: enable sensor before read out sensor data
Changes in library:
- enableProximity() function is to enable or disable proximity sensor
- enableIlluminance() function is to enable or disable illuminance sensor
- run clang-format

Changes in example:
- proximity and illuminance kernel IIO-based driver init state is power off,
  require enable before read out sensor data. Sleep time is needed after
  enable, the sleep time may vary on different platform.
- run clang-format

Signed-off-by: Lay, Kuan Loon <kuan.loon.lay@intel.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2016-07-22 16:30:25 -07:00
40fe6654eb ublox6: Add most popular baud rates to GPS enums
Signed-off-by: deadprogram <ron@hybridgroup.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2016-07-22 15:33:05 -07:00
e740335701 travis.yml: force install of swig3.0 even if not authenticated
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2016-07-19 15:17:57 -07:00
b257d91702 mpr121: fixed default value for filter configuration register
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2016-07-19 10:08:52 -07:00
e7394217b1 mlx90614: set i2c bus speed to 100 kHz on init to match sensor specs
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2016-07-14 14:41:03 -07:00
baec9966f0 spelling: correct many misspellings of celsius
Signed-off-by: Jon Trulson <jtrulson@ics.com>
2016-07-12 17:42:01 -06:00
0fb56356fb bmx055: fix up some issues reported by static analysis
Signed-off-by: Jon Trulson <jtrulson@ics.com>
2016-07-12 16:05:22 -06:00
e0ef6eea64 ozw: fix up some issues reported by static analysis
Signed-off-by: Jon Trulson <jtrulson@ics.com>
2016-07-12 16:05:13 -06:00
743730550c CMakeLists.txt: move example subdir adds after add_subdirectory(src) is called
This will ensure that all src modules are scanned first before
examples (c++/java).

In certain cases when doing parallel builds with many cores (8), the
examples for MODBUS, BACNET, and OPENZWAVE would not be built, since
their dependant libraries had not yet been located (in the src/
dir(s) via pkg_check_modules()), by the time the examples were being
compiled.

Signed-off-by: Jon Trulson <jtrulson@ics.com>
2016-07-06 16:49:55 -06:00
9ab9e2c403 ozw: Rework and add some device specific drivers and examples.
This commit reworks ozw somewhat and adds some device specific drivers
with examples.  All of these drivers are kept in the UPM ozw library.

The OZW class has been reworked to make it a proper singleton, since
the OpenZWave::Manager() it depends on is already a singleton.  This
avoids issues such as opening and initializing OpenZWave multiple
times.

A new, relatively thin base class, ozwInterface is also now present.
This class wraps some basic functionality, and handles initialization
of the OZW base class.  It is intended to be inherited by device
driver classes.  It operates on a node id for a device.  Each OZW
device is referenced by a node id, which does not change unless the
device is removed (and possibly re-added) to a Z-Wave network.

Finally, a series of device specific drivers have been implemented.
These provide basic functionality to monitor and in some cases control
the operation of a Z-Wave device.  They are the following:

ozwdump - This is a fake 'device' driver that initializes an OZW
network and dumps information on all of the nodes (devices) present.
Along with each node, available information on each valueid associated
with that node is also printed.  This fake device and it's examples
replace the original ozw example.

aeotecss6 - Aeotec Smart Switch 6.  This device allows control of the
switch, as well as reporting of information the switch makes
available, such as current consumption, volts, watts, and accumulated
energy use (kWh).

aeotecsdg2 - Aeotec Smart Dimmer Gen 2.  This device is similar to the
Smart Switch 6, but also provides dimming functionality.  It also
provides information on energy use.

aeotecdw2e - Aeotec Door/Window Sensor 2nd Edition.  This device is a
magnetic switch with an embedded tamper switch used to detect the
opening/closing of windows and doors.  This is a battery powered
device.

aeotecdsb09104 - Aeotec Home Energy Monitor.  This device is intended
to be installed at the MAINS or Breaker box.  It reports current and
cumulative energy consumption.

tzemt400 - Trane TZEMT400 Thermostat.  This device is a thermostat
with Z-Wave functionality.  The variant tested was the
TZEMT400BB32MAA.  The driver reports various information on the status
of the thermostat, as well as the current measured temperature.

Signed-off-by: Jon Trulson <jtrulson@ics.com>
2016-07-06 15:13:00 -06:00
8da6095c35 travis: Updated ppa for swig3.0
UPM requires swig 3.0.5 which *was* offered in fenics-exp, but is
no longer available there.  Switched to fenics-dev.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2016-07-01 10:18:01 -07:00
1849e22154 upm: v0.7.2
Signed-off-by: Noel Eck <noel.eck@intel.com>
2016-06-30 16:28:44 -07:00
dec9b2096e mraa: Updated mraa dependecy to 1.1.1
There were api changes for iio kernel support on mraa which cascade to
UPM - setting the minimum version of mraa required.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2016-06-30 15:15:50 -07:00
e1df8b5bf6 iio_core: Patches for IIO core kernel standard
Applying patches from Kuan Loon Lay.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2016-06-30 14:57:19 -07:00
634208e3dc upm: v0.7.1
Signed-off-by: Noel Eck <noel.eck@intel.com>
2016-06-28 11:37:42 -07:00
05ca452831 python: Removed exact from find_package
Failing on exact match for minor version.  Reverting back to
non-exact match.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2016-06-24 23:01:25 -07:00
19b0b0c2f1 python: Fixes for building python modules
Moved src include AFTER setter for PYTHONBUILD_VERSION.  In this way,
the src CMakeLists has a valid PYTHONBUILD_VERSION str.
Call find_package on PythonInterp prior to finding the libs (recommended).

Signed-off-by: Noel Eck <noel.eck@intel.com>
2016-06-24 17:11:28 -07:00
9a74a3b4f5 LCD:jhd1313m1:HD44780 Setting number of rows and font size
Signed-off-by: Akira Tsukamoto <akira.tsukamoto@linaro.org>
Signed-off-by: Abhishek Malik <abhishek.malik@intel.com>
2016-06-17 14:24:36 -07:00
25c0f8ebb1 LCD:jhd1313m1:HD44780 Adding workaround of errata on init
HD44780 fails to initialize unsuccessfully without the workaround.

Adding workaround based on HD77480 datasheet for initialization
and software reset.

Signed-off-by: Akira Tsukamoto <akira.tsukamoto@linaro.org>
Signed-off-by: Abhishek Malik <abhishek.malik@intel.com>
2016-06-17 14:23:53 -07:00
33e2c03b48 tb7300: Initial implementation
This module implements support for the Honeywell TB7300 Communicating
Fan Coil Thermostat.  It may also support the TB7200, though only the
TB7300 was available for development of this driver.

The TB7200 Series PI thermostats are designed for zoning applications,
and the TB7300 Series PI thermostats are designed for fan coil
control. Both Series are communicating thermostats with models
available in BACnet® MS/TP protocol and can be easily integrated into
a WEBs-AX building automation system based on the NiagaraAX® platform.

TB7200 and TB7300 Series thermostats are compatible with the Honeywell
Occupancy Sensor Cover. Thermostats equipped with an occupancy sensor
cover provide advanced active occupancy logic, which will
automatically switch occupancy levels from Occupied to Stand-By and
Unoccupied as required by local activity being present or not. This
advanced occupancy functionality provides advantageous energy savings
during occupied hours without sacrificing occupant comfort. All
thermostats can be ordered with or without a factory installed PIR
cover.

Signed-off-by: Jon Trulson <jtrulson@ics.com>
2016-06-14 17:12:32 -06:00
3c5d498ae5 t8100: Initial implementation
This module implements support for the Amphenol Telaire Ventostat
T8100 Ventilation Controller with BACnet interface.  It may also
support the T8200 and T8300 models, but they have not been tested.

The Telaire Ventostat T8100 reports Temperature, Humidity and CO2
concentrations.  It supports an optional relay with a settable trigger
point.  The unit this driver was tested under did not support the
optional relay.  The temperature range supported is 0-50C, humidity is
0-100% non-condensing, and CO2 range is appoximately 0-2000 PPM for
the T8100.  Other sensors in this family support wider ranges.

Signed-off-by: Jon Trulson <jtrulson@ics.com>
2016-06-14 17:04:17 -06:00
93fea877e3 e50hx: use the new bacnetutil class
This commit removes functionality that is now present in the
bacnetutil class.  This simplifies the driver considerably.  The
examples were modified to reflect the renaming of some utility
functions in bacnetutil.

Signed-off-by: Jon Trulson <jtrulson@ics.com>
2016-06-14 17:00:00 -06:00
b7f038de3d bacnetmstp: add new bacnetutil class to bacnetmstp UPM library
There is some functionality that will always be needed for BACnet
drivers.  Here we create a new bacnetutil class, built as part of the
bacnetmstp library that can handle much of the data handling and setup
a BACnet driver will need.

The idea is that any BACnet functionality needed, that is not
device-specific, should be added to this class for all drivers to use.

The intent is that all BACnet drivers will inherit from this class.

Signed-off-by: Jon Trulson <jtrulson@ics.com>
2016-06-14 16:53:17 -06:00
f03696b7a5 bacnetmstp: Add array support and the ability to create BACnet enums
This reworks the data handling portion of bacnetmstp.  Instead of just
handling a single data element returned from a device, we can handle
more, as in the case of BACnet arrays.

Added the ability to create BACnet enum data elements.  This is needed
in order to set binary value objects.

Signed-off-by: Jon Trulson <jtrulson@ics.com>
2016-06-14 16:53:17 -06:00
8fb7907a4e bmx055, bmi055, bmc160, bma250e, bmg150, bmm150: Initial implementation
This module (bmx055) implements support for the following core Bosch
chipsets:

bma250e - accelerometer, 3 variants (chip id's 0x03, 0xf9, and 0xfa)
bmm150 - magnetometer
bmg160 - gyroscope

The other 3 devices are combinations of the above:

bmx055 - accel/gyro/mag
bmc160 - accel/mag
bmi055 - accel/gyro

...for 6 devices total.

For the combination devices, all of the sub-devices appear as
individual independent devices on the I2C/SPI bus.

The combination drivers provide basic configuration and data output.
For more detailed control as well as interrupt support, you should use
the core device drivers (accel/gyro/mag) directly.

These devices support both I2C and SPI communications.  They must be
powered at 3.3vdc.

Signed-off-by: Jon Trulson <jtrulson@ics.com>
2016-06-14 16:40:21 -06:00
66bd4ee8c8 readme: fixed broken link to MRAA in Readme.md
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2016-05-13 17:25:15 -07:00
fd707242a9 node: bumped dependency for node modules to v4.4.x
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2016-05-13 17:24:19 -07:00
29bfa7ef79 upm: v0.7.0
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2016-05-12 17:09:17 -07:00
a5e3cc89f3 cmake: Change from search to check for TPV modules.
Switch the calls from pkg_search_module to pkg_check_modules
for ozw, bacnet, and modbus.  Check prints out the version when
found.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2016-05-12 16:24:40 -07:00
1eafab7932 lsm9ds0: added constructor option to allow raw i2c bus init
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2016-05-12 14:01:45 -07:00
de986764d4 lcm1602: added backlight control and default bus/address for I2C variants
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2016-05-12 13:48:06 -07:00
3eda1bce16 cmake: set -march=native for ARM platforms
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2016-05-12 11:56:19 -07:00
72b975b6cc vcap: conditionally add target based on findJPEG result
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2016-05-11 15:50:56 -07:00
f850f5b7d8 buzzer: updated delay values for notes to match listed frequencies
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2016-05-11 14:09:53 -07:00
8e8b35273b SWIG: Added uint8array typemap for zfm20 driver
Signed-off-by: Abhishek Malik <abhishek.malik@intel.com>
2016-05-09 22:35:13 -07:00
dbb4f1749d [ST7735] Free pointers from spi.write
Docs for MRAA say ` The pointer return has to be free'd by the caller`

Signed-off-by: Noel Eck <noel.eck@intel.com>
2016-05-09 17:43:48 -07:00
05730dba68 cmake: add dependency on mraa v1.0.0
Merged conflict in grove.cxx GroveTemp::value where new
scale factor was added.  Changed to apply scale factor
post error-check.

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
Signed-off-by: Noel Eck <noel.eck@intel.com>
2016-05-09 17:31:38 -07:00
48d5426350 i2c: use mraa 1.0 types for i2c sensors
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
Signed-off-by: Noel Eck <noel.eck@intel.com>
2016-05-09 17:13:36 -07:00
e51c5f3018 This is a combination of 2 commits.
aio: mraa_aio_read (v1.0.0) can now return -1, treat that in sensors using it

Adds alot of exceptions if the aio read goes wrong

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
Signed-off-by: Noel Eck <noel.eck@intel.com>
2016-05-09 17:13:35 -07:00
f6816797bb bmp280: CMakeLists header variable name.
Missed one instance of module_h for the recent bmp changes.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2016-05-09 16:47:32 -07:00
cc5e3b2634 L3GD20: Enable L3GD20 3-axis digital gyroscope library and example
L3GD20 is tri-axis gyroscope from STMicroelectronics.
This sensor can measure angular velocity in degree per second.

The library provided is libupm-l3gd20.so.0.4.0.
The example provided is l3gd20-example where it will print x,y,z axis when
trigger buffer data is ready.

This sensor requires calibration to be done for 2 seconds. Please place the
sensor on level surface.

As the sensor data is noisy, we have implemented denoise algorithm within the
sensor library.

Signed-off-by: Lay, Kuan Loon <kuan.loon.lay@intel.com>
Signed-off-by: Noel Eck <noel.eck@intel.com>
2016-05-09 16:34:26 -07:00
c3285ea523 kxcjk1013: code cleanup and update sensor description
Code cleanup and proper close iio device in destructor.

KXCJK-1013 is tri-axis accelerometer from Kionix.
This sensor can measure acceleration in metre per second squared or in
G-forces.

The library provided is libupm-kxcjk1013.so.0.4.0.
The example provided is kxcjk1013-example where it will print x,y,z axis when
trigger buffer data is ready.

Signed-off-by: Lay, Kuan Loon <kuan.loon.lay@intel.com>
2016-05-09 16:32:05 -07:00
456bde0726 bno055: Initial implementation
This driver implements support for the Bosch BNO055 Absolute
Orientation 9DOF Fusion Hub.   It was implemented on the Adafruit
variant at https://www.adafruit.com/products/2472.

The BNO055 is a System in Package (SiP), integrating a triaxial 14-bit
accelerometer, a triaxial 16-bit gyroscope with a range of ±2000
degrees per second, a triaxial geomagnetic sensor and a 32-bit cortex
M0+ microcontroller running Bosch Sensortec sensor fusion software, in
a single package.

This sensor handles the hard problem of combining various sensor
information into a reliable measurement of sensor orientation (refered
to as 'sensor fusion').  The onboard MCU runs this software and can
provide fusion output in the form of Euler Angles, Quaternions, Linear
Acceleration, and Gravity Vectors in 3 axes.

The focus on this driver has been on supporting the fusion components.
Less support is available for use of this device as a generic
accelerometer, gyroscope and magnetometer, however enough
infrastructure is available to add any missing functionality.

Signed-off-by: Jon Trulson <jtrulson@ics.com>
Signed-off-by: Noel Eck <noel.eck@intel.com>
2016-05-09 13:33:11 -07:00
d045dded7c java: add mraa to the java swig link line so mraa symbols can be found
Previously in MRAA, the libmraa library was statically linked into the
libmraajava library.  This was changed recently in MRAA, causing most
java examples to fail due to missing mraa symbols.  This patch
specifically adds libmraa to the link in addition to libmraajava.

In addition, use *_LIBRARIES in the java specific swig_link_libraries
call rather than *_LDFLAGS.

Signed-off-by: Jon Trulson <jtrulson@ics.com>
Signed-off-by: Noel Eck <noel.eck@intel.com>
2016-05-09 13:24:53 -07:00
89d5ce152f adafruitms1438: remove extraneous libraries from swig_link_libraries() calls
Signed-off-by: Jon Trulson <jtrulson@ics.com>
Signed-off-by: Noel Eck <noel.eck@intel.com>
2016-05-09 13:24:52 -07:00
dbbb30c3d2 vcap: remove extraneous libraries from swig_link_libraries() calls
Signed-off-by: Jon Trulson <jtrulson@ics.com>
Signed-off-by: Noel Eck <noel.eck@intel.com>
2016-05-09 13:24:52 -07:00
8df446958a ozw: remove extraneous libraries from swig_link_libraries() calls
Signed-off-by: Jon Trulson <jtrulson@ics.com>
Signed-off-by: Noel Eck <noel.eck@intel.com>
2016-05-09 13:24:52 -07:00
411b4abcb7 e50hx: remove extraneous libraries from swig_link_libraries() calls
Signed-off-by: Jon Trulson <jtrulson@ics.com>
Signed-off-by: Noel Eck <noel.eck@intel.com>
2016-05-09 13:24:52 -07:00
7d64a67670 bacnetmstp: remove extraneous libraries from swig_link_libraries() calls
Signed-off-by: Jon Trulson <jtrulson@ics.com>
Signed-off-by: Noel Eck <noel.eck@intel.com>
2016-05-09 13:24:52 -07:00
6b0a9c5272 hwxpxx: remove extraneous libraries from swig_link_libraries() calls
Signed-off-by: Jon Trulson <jtrulson@ics.com>
Signed-off-by: Noel Eck <noel.eck@intel.com>
2016-05-09 13:24:52 -07:00
12e1e6309e t3311: remove extraneous libraries from swig_link_libraries() calls
Signed-off-by: Jon Trulson <jtrulson@ics.com>
Signed-off-by: Noel Eck <noel.eck@intel.com>
2016-05-09 13:24:51 -07:00
c833c75cd3 h803x: remove extraneous libraries from swig_link_libraries() calls
Signed-off-by: Jon Trulson <jtrulson@ics.com>
Signed-off-by: Noel Eck <noel.eck@intel.com>
2016-05-09 13:24:51 -07:00
03354ccf9a interface examples: re-add bme280 support removed when old bme280 was removed
Signed-off-by: Jon Trulson <jtrulson@ics.com>
Signed-off-by: Noel Eck <noel.eck@intel.com>
2016-05-09 13:24:51 -07:00
6241e20dda bmp280, bme280: Initial implementation
This library adds support for both the BMP280 and BME280 sesnors from
Bosch.  The BME is virtually identical to the BMP280 aside from some
slight register changes and adding support for a humidity sensor.

The BMP280 is an absolute barometric pressure sensor especially
designed for mobile applications. The sensor module is housed in an
extremely compact 8-pin metal-lid LGA package with a footprint of only
2.0 × 2.5 mm2 and 0.95 mm package height. Its small dimensions and its
low power consumption of 2.7 μA @1Hz allow the implementation in
battery driven devices such as mobile phones, GPS modules or watches.

The BME280 is as combined digital humidity, pressure and temperature
sensor based on proven sensing principles. The sensor module is housed
in an extremely compact metal-lid LGA package with a footprint of only
2.5 × 2.5 mm2 with a height of 0.93 mm. Its small dimensions and its
low power consumption allow the implementation in battery driven
devices such as handsets, GPS modules or watches. The BME280 is
register and performance compatible to the Bosch Sensortec BMP280
digital pressure sensor

These drivers support both I2C and SPI operation.

When using SPI on an Edison with the arduino breakout board, you
must specify a CS of -1 to the constructor, and connect the chip's
CS pin to arduino pin 10.

Signed-off-by: Jon Trulson <jtrulson@ics.com>
Signed-off-by: Noel Eck <noel.eck@intel.com>
2016-05-09 13:16:30 -07:00
84144d0c8f bosch bme280: Remove old driver in favor of new driver to be added soon
This driver, based on bosch code is being removed in favor of a new
driver to be added soon that is more fully functional and includes SPI
support.

The new driver will be included along with a BMP280 implementation in
a new bmp280 library.

Signed-off-by: Jon Trulson <jtrulson@ics.com>
Signed-off-by: Noel Eck <noel.eck@intel.com>
2016-05-09 13:16:30 -07:00
dd2bca97b9 bmp180/bmpx0x: Remove old bmp180 driver
This commit removes the old bmp180 driver that was erroneously
re-added when the interface examples and headers were introduced.

It then switches the users of bmp180 to the existing bmpx8x driver,
which already supports the bmp180.

Signed-off-by: Jon Trulson <jtrulson@ics.com>
Signed-off-by: Noel Eck <noel.eck@intel.com>
2016-05-09 13:13:42 -07:00
cf74a260a3 readme: updated introduction paragraph
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2016-05-06 14:18:10 -07:00
61f7803d92 grovetemp: added a scaling factor to allow adjusting ADC values
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2016-05-06 14:15:10 -07:00
e3b59eb05b apds9930: proper close iio device in destructor and update sensor description
Proper close iio device in destructor.

APDS-9930 is light and proximity sensor from Avago Technologies.
This sensor can measure ambient light in lux and proximity distance in 100mm.

The library provided is libupm-apds9930.so.0.4.0.
The example provided is apds9930-example where this app will print the value of
ambient light and proximity in every 1 second.

Signed-off-by: Lay, Kuan Loon <kuan.loon.lay@intel.com>
Signed-off-by: Noel Eck <noel.eck@intel.com>
2016-05-05 11:37:56 -07:00
398d50de2e kxcjk1013: code cleanup and update sensor description
Code cleanup and proper close iio device in destructor.

KXCJK-1013 is tri-axis accelerometer from Kionix.
This sensor can measure acceleration in metre per second squared or in
G-forces.

The library provided is libupm-kxcjk1013.so.0.4.0.
The example provided is kxcjk1013-example where it will print x,y,z axis when
trigger buffer data is ready.

Signed-off-by: Lay, Kuan Loon <kuan.loon.lay@intel.com>
Signed-off-by: Noel Eck <noel.eck@intel.com>
2016-05-05 11:06:36 -07:00
bbb31fcab2 travis-ci: Fix for non-sticky clang env setting.
The env CC=clang builds were previously getting overridden for each build since
the language: cpp defaults gcc/g++ (travis-ci was not building UPM w/clang).
This commit explicitly adds the clang compiler to the build matrix.

    * Specify gcc/clang in the compiler directive

    * Add a node.js 0.10 entry

    * Add a few debug messages

    * General cleanup of .travis.yml

    * Add the upm make install step for completeness

Signed-off-by: Noel Eck <noel.eck@intel.com>
2016-05-04 13:05:19 -07:00
5467620bf7 cpp_headers: Rename ds18b20 header .h -> .hpp
Renamed header file, updated header filename in interface files,
sources, and CMakeLists file.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2016-05-02 16:05:20 -07:00
e679d40d44 ds18b20: Initial implementation
This driver supports, and was tested with, a DS18B20 1-wire
Temperature Sensor using external power.

This device requires the use of a UART to provide access to a Dallas
1-wire bus, via a new facility supported by MRAA (once the relevant PR
is accepted), using the UartOW access class.  It is important to
realize that the UART is only being used to access and control a
Dallas 1-wire compliant bus, it is not actually a UART device.

Multiple DS18B20 devices can be connected to this bus.  This module
will identify all such devices connected, and allow you to access them
using an index starting at 0.

Parasitic power is not currently supported due to the very tight 10us
limit on switching a GPIO properly to supply power during certain
operations.  For this reason, you should use external power for your
sensors.

Setting the alarm values (Tl, Th) is also not supported, since this is
only useful when doing a 1-wire device search looking for devices in
an alarm state, a capability not yet supported in MRAA.  In reality,
this is trivial to handle yourself in your application.

Signed-off-by: Jon Trulson <jtrulson@ics.com>
Signed-off-by: Noel Eck <noel.eck@intel.com>
2016-05-02 16:04:56 -07:00
bf9059c846 cpp_headers: Rename ds2413 header .h -> .hpp
Renamed header file, updated header filename in interface files,
sources, and CmakeLists file.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2016-04-29 16:46:03 -07:00
e1bda1f44b ds2413: Initial implementation
This adds initial support for the DS2413 Dual Channel Addressable
Switch.  This is a Dallas Semiconductor 1-wire compliant device
providing access to 2 open-drain GPIOs.

https://learn.adafruit.com/adafruit-1-wire-gpio-breakout-ds2413/overview

This driver requires One-Wire over UART support in MRAA (PR #415)
which is not yet merged.

Signed-off-by: Jon Trulson <jtrulson@ics.com>
2016-04-29 16:37:30 -07:00
893b35f77b Java: Added Examples for Sensors
max31855, max5487, maxds3231m, ecs1030 and sm130

Signed-off-by: Abhishek Malik <abhishek.malik@intel.com>
2016-04-29 11:07:10 -07:00
a7e803873f docs: Updated porting documentation to reflect c++ header change.
Replaced module_h with module_hpp for example CMakeLists.txt
file.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2016-04-28 17:21:20 -07:00
612f53ee40 examples: More header file renames
Missed 4 header file renames in C++ examples.  Fixing that
here.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2016-04-28 16:40:18 -07:00
922e0cc26b cpp_headers: Renamed C++ headers from .h -> .hpp
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>
2016-04-28 14:00:54 -07:00
b3a8fd7172 eboled: change write_word to writeWord for MRAA 1.0 API change.
Signed-off-by: Jon Trulson <jtrulson@ics.com>
Signed-off-by: Noel Eck <noel.eck@intel.com>
2016-04-28 13:17:20 -07:00
4455c81866 mic: fixed web link
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2016-04-25 10:54:16 -07:00
6b273a1b49 docs: Added exclude to Doxyfile for boschdriver src.
The boschdriver.h file contains tags which are picked up by
doxygen and cause incorrect results.  For example, the
\mainpage and \license cause the Bosch header collateral to
be placed on the index.html page of the UPM docs.

Added an entry to EXCLUDE_PATTERNS which handles this.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2016-04-21 15:21:04 -07:00
1502 changed files with 28861 additions and 9787 deletions

View File

@ -1,38 +1,46 @@
language: cpp
env:
- CC=gcc CXX=gcc
- CC=clang CXX=clang++
- NODE4=true
- NODE5=true
- NODE012=true
global:
- MRAA_ROOT=/tmp/mraa
- MRAA_BUILD=$MRAA_ROOT/build
- MRAA_INSTALL=$MRAA_ROOT/install
- UPM_ROOT=$TRAVIS_BUILD_DIR
- UPM_BUILD=$UPM_ROOT/build
- UPM_INSTALL=$UPM_ROOT/install
- JAVA_HOME=/usr/lib/jvm/java-8-oracle
matrix:
- NODE010=true
- NODE012=true
- NODE4=true
- NODE5=true
compiler:
- clang
- gcc
install:
- sudo add-apt-repository --yes ppa:fenics-packages/fenics-exp/swig
- sudo add-apt-repository --yes ppa:fenics-packages/fenics-dev/swig
- sudo apt-get update -qq
- sudo apt-get install -y -qq swig3.0 git
- sudo apt-get install -y --force-yes -qq swig3.0 git
- sudo ln -s /usr/bin/swig3.0 /usr/bin/swig
- sudo update-java-alternatives -s java-8-oracle
before_script:
- export NODE_ROOT_DIR="/home/travis/.nvm/v0.10.36"
- if [ "$CC" = "gcc" ]; then export BUILDJAVA=ON; else export BUILDJAVA=OFF; fi
- export JAVA_HOME=/usr/lib/jvm/java-8-oracle
- if [ "${NODE4}" ]; then nvm install 4.1; export CC=gcc-4.8; export CXX=g++-4.8; export NODE_ROOT_DIR="/home/travis/.nvm/versions/node/`nvm version`"; fi
- if [ "${NODE5}" ]; then nvm install 5; export CC=gcc-4.8; export CXX=g++-4.8; export NODE_ROOT_DIR="/home/travis/.nvm/versions/node/`nvm version`"; fi
- if [ "${NODE012}" ]; then nvm install 0.12; export NODE_ROOT_DIR="/home/travis/.nvm/versions/node/`nvm version`"; fi
# Turn off JAVA SWIG for clang++, use 4.8 for all g++ builds
- if [ "$CC" == "gcc" ]; then export BUILDJAVA=ON; export CC=gcc-4.8; export CXX=g++-4.8; else export BUILDJAVA=OFF; fi
- if [ "${NODE012}" ]; then nvm install 0.12; fi
- if [ "${NODE4}" ]; then nvm install 4.1; fi
- if [ "${NODE5}" ]; then nvm install 5; fi
# Handle 0.10 NODE_ROOT_DIR differently than other versions
- if [ -z ${NODE010} ]; then export NODE_ROOT_DIR="/home/travis/.nvm/versions/node/`nvm version`"; else export NODE_ROOT_DIR=/home/travis/.nvm/v0.10.36; fi
script:
- git clone https://github.com/intel-iot-devkit/mraa.git
- cd mraa && mkdir build && cd build && cmake -DBUILDSWIGJAVA=$BUILDJAVA -DBUILDSWIGNODE=OFF -DBUILDSWIGPYTHON=OFF -DFIRMATA=ON -DENABLEEXAMPLES=OFF -DCMAKE_INSTALL_PREFIX:PATH=. .. && make && make install
- export PKG_CONFIG_PATH=$PWD/lib/pkgconfig:$PWD/lib/x86_64-linux-gnu/pkgconfig
- export CPLUS_INCLUDE_PATH=$PWD/include
- export LIBRARY_PATH=$PWD/lib:$PWD/lib/x86_64-linux-gnu
- cd ../.. && mkdir build && cd build && cmake -DNODE_ROOT_DIR:PATH="${NODE_ROOT_DIR}" -DBUILDSWIGJAVA=$BUILDJAVA -DBUILDEXAMPLES=ON -DBUILDJAVAEXAMPLES=$BUILDJAVA .. && make
- echo "CC=$CC BUILDJAVA=$BUILDJAVA NODE010=$NODE010 NODE012=$NODE012 NODE4=$NODE4 NODE5=$NODE5 NODE_ROOT_DIR=$NODE_ROOT_DIR"
- git clone https://github.com/intel-iot-devkit/mraa.git $MRAA_ROOT
- mkdir -p $MRAA_BUILD && cd $_ && cmake -DBUILDSWIGJAVA=$BUILDJAVA -DBUILDSWIGNODE=OFF -DBUILDSWIGPYTHON=OFF -DFIRMATA=ON -DENABLEEXAMPLES=OFF -DCMAKE_INSTALL_PREFIX:PATH=$MRAA_INSTALL $MRAA_ROOT && make install
- cd $UPM_ROOT && mkdir $UPM_BUILD && cd $_ && PKG_CONFIG_PATH=$MRAA_INSTALL/lib/pkgconfig cmake -DNODE_ROOT_DIR:PATH="${NODE_ROOT_DIR}" -DBUILDSWIGJAVA=$BUILDJAVA -DBUILDEXAMPLES=ON -DBUILDJAVAEXAMPLES=$BUILDJAVA -DCMAKE_INSTALL_PREFIX:PATH=$UPM_INSTALL .. && make install
addons:
apt:
sources:
- llvm-toolchain-precise-3.6
- ubuntu-toolchain-r-test
- george-edison55-precise-backports
packages:
- clang-3.6
- g++-4.8
- cmake
- cmake-data
- g++-4.8

View File

@ -10,7 +10,7 @@ find_package (PkgConfig REQUIRED)
# Force a libmraa search and minimum required version every time a config is generated
unset(MRAA_FOUND CACHE)
pkg_check_modules (MRAA REQUIRED mraa>=0.9.1)
pkg_check_modules (MRAA REQUIRED mraa>=1.1.1)
message (INFO " found mraa version: ${MRAA_VERSION}")
# Appends the cmake/modules path to MAKE_MODULE_PATH variable.
@ -25,7 +25,7 @@ include (GetGitRevisionDescription)
git_describe (VERSION "--tags")
if ("x_${VERSION}" STREQUAL "x_GIT-NOTFOUND" OR "x_${VERSION}" STREQUAL "x_-128-NOTFOUND")
message (WARNING " - Install git to compile a production UPM!")
set (VERSION "v0.6.2-dirty")
set (VERSION "v0.8.0-dirty")
endif ()
message (INFO " - UPM Version ${VERSION}")
@ -49,20 +49,19 @@ set (upm_VERSION_STRING ${upm_VERSION_MAJOR}.${upm_VERSION_MINOR}.${upm_VERSION_
set (CMAKE_SWIG_FLAGS "")
option (BUILDDOC "Build all doc." OFF)
option (BUILDSWIG "Build swig modules." ON)
option (BUILDSWIGPYTHON "Build swig python modules." ON)
option (BUILDPYTHON3 "Use python3 for building/installing/testing" OFF)
option (BUILDSWIGNODE "Build swig node modules." ON)
option (BUILDSWIGJAVA "Build swig java modules" OFF)
option (BUILDPYTHON3 "Use python3 for building/installing/testing" OFF)
option (BUILDEXAMPLES "Build C++ example binaries" OFF)
option (BUILDJAVAEXAMPLES "Build java example jars" OFF)
option (BUILDSWIGJAVA "Build swig java modules" OFF)
option (IPK "Generate IPK using CPack" OFF)
option (RPM "Generate RPM using CPack" OFF)
option (BUILDTESTS "Generate check-ups for upm" ON)
option (ENABLECXX11 "Enable C++11 standards support" ON)
# Find swig
if (BUILDSWIG)
if (BUILDSWIGPYTHON OR BUILDSWIGNODE OR BUILDSWIGJAVA)
if (BUILDSWIGNODE)
find_package (SWIG 3.0.5 REQUIRED)
else ()
@ -78,6 +77,11 @@ include (TargetArch)
target_architecture (DETECTED_ARCH)
message( INFO " - Target arch is ${DETECTED_ARCH}")
#-march=native for ARM when not defined/forced
if (DETECTED_ARCH MATCHES "arm.*" AND NOT CMAKE_CXX_FLAGS MATCHES "-march")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
endif()
# enable c++11 standards support
if (ENABLECXX11)
include(CheckCXXCompilerFlag)
@ -120,7 +124,7 @@ if (BUILDDOC)
endif (DOXYGEN_FOUND)
# Check if Sphinx is installed and add target to generate API documentation
find_package (Sphinx)
if(SPHINX_FOUND AND BUILDSWIG AND BUILDSWIGPYTHON)
if(SPHINX_FOUND AND BUILDSWIGPYTHON)
# Python required for Sphinx build
find_package (PythonLibs ${PYTHONBUILD_VERSION} REQUIRED)
string (REPLACE "." ";" PYTHON_VERSION_LIST ${PYTHONLIBS_VERSION_STRING})
@ -226,16 +230,6 @@ if (RPM)
include(CPack)
endif()
add_subdirectory (src)
if(BUILDEXAMPLES)
add_subdirectory (examples/c++)
endif()
if(BUILDJAVAEXAMPLES)
add_subdirectory (examples/java)
endif()
if (BUILDSWIGPYTHON OR BUILDTESTS)
if (BUILDPYTHON3)
set (PYTHONBUILD_VERSION 3)
@ -244,6 +238,16 @@ if (BUILDSWIGPYTHON OR BUILDTESTS)
endif ()
endif ()
add_subdirectory (src)
if(BUILDEXAMPLES)
add_subdirectory (examples/c++)
endif()
if(BUILDJAVAEXAMPLES)
add_subdirectory (examples/java)
endif()
if (BUILDTESTS)
find_package (PythonInterp ${PYTHONBUILD_VERSION} REQUIRED)
enable_testing ()

View File

@ -1,29 +1,29 @@
UPM (Useful Packages & Modules) Sensor/Actuator repository for MRAA
==============
UPM is a high level repository for sensors that use MRAA. Each sensor links
to MRAA and are not meant to be interlinked although some groups of sensors
may be. Each sensor contains a header which allows to interface with it.
Typically a sensor is represented as a class and instantiated.
The UPM repository provides software drivers for a wide variety of commonly
used sensors and actuators. These software drivers interact with the
underlying hardware platform (or microcontroller), as well as with the attached
sensors, through calls to [MRAA](https://github.com/intel-iot-devkit/mraa) APIs.
The constructor is expected to initialise the sensor and parameters may be used
to provide identification/pin location on the board.
Programmers can access the interfaces for each sensor by including the sensors
corresponding header file and instantiating the associated sensor class. In the
typical use case, a constructor initializes the sensor based on parameters that
identify the sensor, the I/O protocol used and the pin location of the sensor.
Typically an update() function will be called in order to get new data from the
sensor in order to reduce load when doing multiple reads to sensor data.
Although implementation and API design is up to the developer, C++ interfaces have
been defined for the following sensor/actuator types and developers are encouraged to
implement them. Interface header files are in the src/upm folder.
C++ interfaces have been defined for the following sensor/actuator types, but
they are subject to change:
* Light controller
* Light sensor
* Temperature sensor
* Humidity sensor
* Pressure sensor
* Gas sensor
* Analog to digital converter
Feedback on interface design and additions for new types are welcome
The developer community is encouraged to help expand the list of supported
sensors and actuators and provide feedback on interface design.
### Example
@ -86,6 +86,8 @@ please refer to the Intel Developer Zone IDE page.
See building documentation [here](docs/building.md).
[![Build Status](https://travis-ci.org/intel-iot-devkit/upm.svg?branch=master)](https://travis-ci.org/intel-iot-devkit/upm)
### Making your own UPM module
Porting [link](docs/porting.md) has more information on making new UPM modules.
@ -120,8 +122,7 @@ our API in a way that will break backwards compatibility. If you find yourself
unable to compile code that was working fine before a library update, make sure
you check the [API changes](docs/apichanges.md) section first.
**NOTE** - Our **C++ header files** will change their extension from *.h* to
*.hpp* in the upcoming version.
**NOTE** - Our **C++ header files** changed extension from *.h* to *.hpp*!
### Changelog
Version changelog [here](docs/changelog.md).

View File

@ -1,20 +1,18 @@
API Changes {#apichanges}
===============
**IMPORTANT NOTICE**
Our **C++ header files** will change their extension from *.h* to *.hpp*. This
change is anticipated in the upcoming version and unfortunately will break
source compatibility with previous versions of UPM for every library. You will
need to update your code and change to the new extension format in your
`#include` directives.
Here's a list of other API changes made to the library that break source/binary
compatibility between releases:
* There were frequent misspellings of the word *Celsius* in the UPM
code. In some cases, these were in method names, which will cause
some API compatibility issues. These have all been corrected for UPM
versions after v.0.7.2.
* Our **C++ header files** changed their extension from *.h* to *.hpp* in
version 0.7.0, Intel provided examples and code samples also reflect this
change but you will need to modify your `#include` directives in existing code
* **my9221**, **groveledbar** and **grovecircularled** are now all part of the
same library (my9221) and new functionality was added going to v.0.5.1
* **stepmotor** driver API was changed significantly from v.0.4.1 to v.0.5.0
* **eboled** library was greatly improved in version 0.4.0 and the `draw()`
function was removed in favor of a more complete GFX library implementation

View File

@ -5,10 +5,21 @@ UPM uses cmake in order to make compilation relatively painless. Cmake runs
build out of tree so the recommended way is to clone from git and make a build/
directory.
**Dependencies**
* basic: libmraa, cmake, swig, pkgconfig, pthreads, librt
* bindings: python-dev, nodejs-dev, openjdk
* documentation: doxygen, graphviz, sphinx, yuidoc
* sensor specific: bacnet-mstp, modbus, openzwave, jpeg
This project depends on libmraa, so that needs to be installed first. Append
the install location of mraa pkgconfig to the following environment variable:
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:.../mraa/build/lib/pkgconfig
~~~~~~~~~~~~~
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:.../mraa/build/lib/pkgconfig
~~~~~~~~~~~~~
If you are building the Java or Node.js bindings make sure you set the
`JAVA_HOME` and `NODE_PATH` environment variables respectively.
UPM will attempt to build all directories inside src/ and they must contain
individual CMakeLists.txt files.
@ -45,10 +56,18 @@ Cross-compiling on a different system:
-DCMAKE_CXX_FLAGS:STRING=-m32 -march=i586
-DCMAKE_C_FLAGS:STRING=-m32 -march=i586
~~~~~~~~~~~~~
Enabling Java module building
~~~~~~~~~~~~~
-DBUILDSWIGJAVA=ON
~~~~~~~~~~~~~
Building with an older version of swig (swig 2.0+) requires the disabling of javascript:
~~~~~~~~~~~~~
-DBUILDSWIGNODE=OFF
~~~~~~~~~~~~~
Generating python3 modules instead of python2.7
~~~~~~~~~~~~~
-DBUILDPYTHON3=ON
~~~~~~~~~~~~~
Disabling python module building
~~~~~~~~~~~~~
-DBUILDSWIGPYTHON=OFF
@ -57,7 +76,7 @@ Setting the python library to use:
~~~~~~~~~~~~~
-DPYTHON_LIBRARY:FILEPATH=/usr/lib/libpython2.7.so.1.0
~~~~~~~~~~~~~
Building doxygen doc
Building documentation
~~~~~~~~~~~~~
-DBUILDDOC=ON
~~~~~~~~~~~~~
@ -65,12 +84,16 @@ Build C++ example binaries
~~~~~~~~~~~~~
-DBUILDEXAMPLES=ON
~~~~~~~~~~~~~
Build Java examples
~~~~~~~~~~~~~
-DBUILDJAVAEXAMPLES=ON
~~~~~~~~~~~~~
If you intend to turn on all the options and build everything at once (C++,
Node, Python and Documentation) you will have to edit the src/doxy2swig.py file
and change the line endings from Windows style to Linux format. This has to be
repeated every time to sync with the master branch since our Github repository
stores files using CR LF line breaks.
If you intend to turn on all the options and build everything at once
(C++, Java, Node, Python and Documentation) you will have to edit the
src/doxy2swig.py file and change the line endings from Windows style to Linux
format. This has to be repeated every time to sync with the master branch since
our Github repository stores files using CR LF line breaks.
You can also generate the include and lib directories containing all the sensor
headers and library files respectively with *make install*. Further, you may

View File

@ -4,6 +4,50 @@ Changelog {#changelog}
Here's a list summarizing some of the key undergoing changes to our library
from earlier versions:
### v0.8.0
* Extended l3gd20 driver to support I2C connections in addition to IIO
* Updated ads1x15, mcp9808 and ssd1306 I2C drivers to not throw a fatal
exception if they fail to set a different I2C speed
* Added extra functionality to apa102 driver, backlight control to jhd1313m1
LCDs and fixed htu21d
* Improved documentation with build dependencies, refreshed the list of known
limitations and simplified the component name for a few sensors
### v0.7.3
* Fixed several existing drivers and updated Grove Temperature sensor to use
new formula for v1.1+ by default
* Separated codebase for upm_grove module that bundles some of the starter kit
sensors into individual source files
* Documentation and doxygen tag updates with correct spelling for Celsius in
several places, this also affects API compatibility
* Removed superfluous BUILDSWIG option, some build recipes might be impacted
* New sensor: ms5611
### v0.7.2
* Mraa 1.1.1 required changes to UPM drivers and examples for IIO core
kernel support
* Rev'ed libmraa requirement to 1.1.1
### v0.7.1
* Fix for building python2 vs python3 bindings
* Fixes for jhd1313m1 row/font size and reset
* Added bacnet utility class
* New sensors: bmx055, bmi055, bmc160, bma250e, bmg150, bmm150, t8100, tb7300
### v0.7.0
* C++ header files have been renamed from *.h to *.hpp along with all Intel
provided examples and code samples to allow for native C drivers
* Updated driver compatibility to new MRAA 1.0 API
* First sensor implementations for our newly added Dallas One Wire support
* Several fixes based on issues reported on Github
* Changed SWIG linking strategy, more robust Travis CI build checks
* New sensors: ds2413, ds18b20, bmp280, bno055, l3gd20
### v0.6.2
* Added a generic driver for taking snapshots from an USB camera device

View File

@ -12,6 +12,10 @@ such sensors and known workarounds if they exist.
some high powered USB ports might be enough, in most cases you will encounter
dropped characters, washed out text and/or failed I2C writes while using USB
power alone.
* **Grove Servo** (ES08A) requires an external power supply connected to the
board to work. We highly recommend using a separate circuit when powering any
sort of motor. Trying to use this servo off USB power alone can lead to damage
to the servo and/or board!
* **Grove I2C Touch Sensor** (MPR121) v1.3 is incompatible with the Intel
Edison using the Arduino board, but will work with the Mini-breakout if
supplied with at least 4V. Revision v1.2 works well on all Intel boards.
@ -49,6 +53,8 @@ such sensors and known workarounds if they exist.
it will trigger continous callbacks when the sensor is not reading anything.
* **Grove RTC** (DS1307) is not compatible with the Intel Edison Arduino board
but will work with the Mini-breakout.
* **Grove Tempture & Humidity (High-Accuracy & Mini) Sensor** (TH02) only works
with the Intel Edison Arduino board when powered from the 3.3V rail.
#### Adafruit Sensors
@ -57,12 +63,15 @@ such sensors and known workarounds if they exist.
#### Other Sensors
* **NRF24L01** corrupted data packets are sent to the device due to the Intel
Edison SPI bus limitation. Sensor works as expected with the Intel Galileo
boards.
* **NRF8001** based devices do not initialize properly with provided examples
on Intel Edison boards also due to SPI bus limitation and data corruption.
Works on Intel Galileo.
* **MLX90614** is not compatible with the Intel Galileo due to the inability
to change the I2C bus speed to 100 KHz.
* **MICSV89** is not compatible with the Intel Galileo due to the inability to
change the I2C bus speed to 100 KHz.
* **MPL3115A2** uses repeated starts for I2C communication and may not work as
expected especially when other I2C sensors are present on the same bus.
* **InvenSense MPU9150 & MPU9250** will be unable to report magnetometer data
when used on the Intel Edison Arduino board because the integrated compass
chips are not detected on the I2C bus.
#### General
@ -74,10 +83,8 @@ Edison Mini-breakout. When this board is not an option, the sensor can be
sometimes replaced with the same model from a different vendor.
The Intel Edison *SPI* bus can corrupt data being sent across when certain
sensors are connected to it. Based on the sensor, this can affect functionality
slightly or make the sensor entirely unusable. Unlike the I2C bus limitation,
different boards are not likely to resolve this. A kernel update on the other
hand might help alleviate this.
sensors are connected to it, if using an old image. This has been resolved with
the latest releases.
On the Intel Galileo boards, the *UART* bus might drop data if several bytes
are read at once.

View File

@ -13,7 +13,7 @@ This is a spi module so we will use the mraa spi functions to build our module.
First thing to do is to create a tree structure like this in upm/src/max31855:
* max31855.cxx
* max31855.h
* max31855.hpp
* jsupm_max31855.i
* pyupm_max31855.i
* CMakeLists.txt
@ -36,11 +36,11 @@ used swig wrappers for UPM sensors, it's not obligatory but recommended.
### API
Then we create the header (max31855.h) , a very simple header in our case we
Then we create the header (max31855.hpp) , a very simple header in our case we
will have only a very basic api. We provide a getTemp() function which will
return the same type as in the arduino library, a double.
@snippet max31855.h Interesting
@snippet max31855.hpp Interesting
Note that the header contains both the io that we will use, the gpio is in this
case used as the chip select pin.

View File

@ -14,16 +14,16 @@ example is explained in detail on @ref max31855
### CmakeLists.txt
By default you need a header called modulename.h and a C++ file called
By default you need a header called modulename.hpp and a C++ file called
modulename.cxx. You can have multiple headers and source files. Only public
headers need to be added to module_h and all source files need to be in
headers need to be added to module_hpp and all source files need to be in
module_src.
~~~~~~~~~~~
set (libname "modulename")
set (libdescription "Module Description")
set (module_src ${libname}.cxx)
set (module_h ${libname}.h)
set (module_hpp ${libname}.hpp)
upm_module_init()
~~~~~~~~~~~

View File

@ -859,6 +859,9 @@ EXCLUDE_SYMLINKS = NO
# Note that the wildcards are matched against the file with absolute path, so to
# exclude all test directories for example use the pattern */test/*
# bmi160 driver contains code provided by bosch. This source contains
# tags which are picked up by doxygen (namely \mainpage) and
# incorrectly get added to docs.
EXCLUDE_PATTERNS = bosch_*
# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names

View File

@ -224,10 +224,6 @@ add_example (groveultrasonic)
add_example (sx1276-lora)
add_example (sx1276-fsk)
add_example (ili9341)
if (OPENZWAVE_FOUND)
include_directories(${OPENZWAVE_INCLUDE_DIRS})
add_example (ozw)
endif()
add_example (nlgpio16)
add_example (ads1x15)
if (MODBUS_FOUND)
@ -241,7 +237,6 @@ add_example (rhusb)
add_example (apds9930)
add_example (kxcjk1013)
add_example (ssd1351)
add_example (bme280)
add_example (ds1808lc)
add_example (hlg150h)
add_example (lp8860)
@ -263,8 +258,18 @@ if (BACNET_FOUND)
# we need access to bacnetmstp headers too
include_directories(${PROJECT_SOURCE_DIR}/src/bacnetmstp)
add_example (e50hx)
add_example (t8100)
add_example (tb7300)
endif()
add_example (vcap)
add_example (ds2413)
add_example (ds18b20)
add_example (bmp280)
add_example (bno055)
add_example (l3gd20)
add_example (l3gd20-i2c)
add_example (bmx055)
add_example (ms5611)
# These are special cases where you specify example binary, source file and module(s)
include_directories (${PROJECT_SOURCE_DIR}/src)
@ -283,10 +288,26 @@ add_custom_example (ak8975-example ak8975.cxx mpu9150)
add_custom_example (mpu9250-example mpu9250.cxx mpu9150)
add_custom_example (groveledbar-example groveledbar.cxx my9221)
add_custom_example (grovecircularled-example grovecircularled.cxx my9221)
add_custom_example (temperature-sensor-example temperature-sensor.cxx "si7005;bmp180;bme280")
add_custom_example (humidity-sensor-example humidity-sensor.cxx "si7005;bme280")
add_custom_example (pressure-sensor-example pressure-sensor.cxx "bmp180;bme280")
add_custom_example (temperature-sensor-example temperature-sensor.cxx "si7005;bmpx8x;bmp280")
add_custom_example (humidity-sensor-example humidity-sensor.cxx "si7005;bmp280")
add_custom_example (pressure-sensor-example pressure-sensor.cxx "bmpx8x;bmp280")
add_custom_example (co2-sensor-example co2-sensor.cxx "t6713")
add_custom_example (adc-example adc-sensor.cxx "ads1x15")
add_custom_example (light-sensor-example light-sensor.cxx "si1132;max44009")
add_custom_example (light-controller-example light-controller.cxx "lp8860;ds1808lc;hlg150h")
add_custom_example (bme280-example bme280.cxx bmp280)
add_custom_example (bma250e-example bma250e.cxx bmx055)
add_custom_example (bmg160-example bmg160.cxx bmx055)
add_custom_example (bmm150-example bmm150.cxx bmx055)
add_custom_example (bmc150-example bmc150.cxx bmx055)
add_custom_example (bmi055-example bmi055.cxx bmx055)
if (OPENZWAVE_FOUND)
include_directories(${OPENZWAVE_INCLUDE_DIRS})
add_custom_example (ozwdump-example ozwdump.cxx ozw)
add_custom_example (aeotecss6-example aeotecss6.cxx ozw)
add_custom_example (aeotecsdg2-example aeotecsdg2.cxx ozw)
add_custom_example (aeotecdw2e-example aeotecdw2e.cxx ozw)
add_custom_example (aeotecdsb09104-example aeotecdsb09104.cxx ozw)
add_custom_example (tzemt400-example tzemt400.cxx ozw)
endif()

View File

@ -25,7 +25,7 @@
#include <unistd.h>
#include <iostream>
#include <signal.h>
#include "a110x.h"
#include "a110x.hpp"
using namespace std;

View File

@ -25,7 +25,7 @@
#include <unistd.h>
#include <iostream>
#include <signal.h>
#include "a110x.h"
#include "a110x.hpp"
using namespace std;

View File

@ -25,7 +25,7 @@
#include <unistd.h>
#include <iostream>
#include <signal.h>
#include "ad8232.h"
#include "ad8232.hpp"
using namespace std;

View File

@ -25,7 +25,7 @@
#include <unistd.h>
#include <signal.h>
#include <iostream>
#include "adafruitms1438.h"
#include "adafruitms1438.hpp"
using namespace std;
using namespace upm;

View File

@ -25,7 +25,7 @@
#include <unistd.h>
#include <signal.h>
#include <iostream>
#include "adafruitms1438.h"
#include "adafruitms1438.hpp"
using namespace std;
using namespace upm;

View File

@ -33,7 +33,7 @@
*/
#include <iostream>
#include "adafruitss.h"
#include "adafruitss.hpp"
#include <unistd.h>
using namespace std;

View File

@ -24,7 +24,7 @@
#include <unistd.h>
#include <iostream>
#include "ads1015.h"
#include "ads1015.hpp"
#include "mraa/gpio.hpp"
#define EDISON_I2C_BUS 1

View File

@ -25,7 +25,7 @@
#include <unistd.h>
#include <signal.h>
#include <iostream>
#include "adc121c021.h"
#include "adc121c021.hpp"
using namespace std;

View File

@ -26,8 +26,8 @@
#include <iostream>
#include <unistd.h>
#include "ads1015.h"
#include "ads1115.h"
#include "ads1015.hpp"
#include "ads1115.hpp"

View File

@ -25,7 +25,7 @@
#include <unistd.h>
#include <iostream>
#include <signal.h>
#include "adxl335.h"
#include "adxl335.hpp"
using namespace std;

View File

@ -23,7 +23,7 @@
*/
#include <unistd.h>
#include "adxl345.h"
#include "adxl345.hpp"
int
main(int argc, char **argv)

View File

@ -25,7 +25,7 @@
#include <unistd.h>
#include <iostream>
#include <signal.h>
#include "adxrs610.h"
#include "adxrs610.hpp"
using namespace std;

View File

@ -0,0 +1,123 @@
/*
* Author: Jon Trulson <jtrulson@ics.com>
* Copyright (c) 2016 Intel Corporation.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <unistd.h>
#include <iostream>
#include <signal.h>
#include "aeotecdsb09104.hpp"
using namespace std;
bool shouldRun = true;
void sig_handler(int signo)
{
if (signo == SIGINT)
shouldRun = false;
}
int main(int argc, char **argv)
{
signal(SIGINT, sig_handler);
//! [Interesting]
string defaultDev = "/dev/ttyACM0";
// if an argument was specified, use it as the device instead
if (argc > 1)
defaultDev = string(argv[1]);
// Instantiate an Aeotec DSB09104 instance, on device node 12. You
// will almost certainly need to change this to reflect your own
// network. Use the ozwdump example to see what nodes are
// available.
upm::AeotecDSB09104 *sensor = new upm::AeotecDSB09104(12);
// The first thing to do is create options, then lock them when done.
sensor->optionsCreate();
sensor->optionsLock();
// Next, initialize it.
cout << "Initializing, this may take awhile depending on your ZWave network"
<< endl;
sensor->init(defaultDev);
cout << "Initialization complete" << endl;
cout << "Querying data..." << endl;
while (shouldRun)
{
sensor->update();
cout << "Watts, Channel 1: "
<< sensor->getWattsC1()
<< " W"
<< endl;
cout << "Watts, Channel 2: "
<< sensor->getWattsC2()
<< " W"
<< endl;
cout << "Watts, Channel 3: "
<< sensor->getWattsC3()
<< " W"
<< endl;
cout << "Energy, Channel 1: "
<< sensor->getEnergyC1()
<< " kWh"
<< endl;
cout << "Energy, Channel 2: "
<< sensor->getEnergyC2()
<< " kWh"
<< endl;
cout << "Energy, Channel 3: "
<< sensor->getEnergyC3()
<< " kWh"
<< endl;
cout << "Battery Level: "
<< sensor->getBatteryLevel()
<< "%"
<< endl;
cout << endl;
sleep(3);
}
// sensor->dumpNodes(true);
cout << "Exiting..." << endl;
delete sensor;
return 0;
}

109
examples/c++/aeotecdw2e.cxx Normal file
View File

@ -0,0 +1,109 @@
/*
* Author: Jon Trulson <jtrulson@ics.com>
* Copyright (c) 2016 Intel Corporation.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <unistd.h>
#include <iostream>
#include <signal.h>
#include "aeotecdw2e.hpp"
using namespace std;
bool shouldRun = true;
void sig_handler(int signo)
{
if (signo == SIGINT)
shouldRun = false;
}
int main(int argc, char **argv)
{
signal(SIGINT, sig_handler);
//! [Interesting]
string defaultDev = "/dev/ttyACM0";
// if an argument was specified, use it as the device instead
if (argc > 1)
defaultDev = string(argv[1]);
// Instantiate an Aeotec Door/Window 2nd Edition sensor instance, on
// device node 10. You will almost certainly need to change this to
// reflect your own network. Use the ozwdump example to see what
// nodes are available.
upm::AeotecDW2E *sensor = new upm::AeotecDW2E(10);
// The first thing to do is create options, then lock them when done.
sensor->optionsCreate();
sensor->optionsLock();
// Next, initialize it.
cout << "Initializing, this may take awhile depending on your ZWave network"
<< endl;
sensor->init(defaultDev);
cout << "Initialization complete" << endl;
cout << "Querying data..." << endl;
while (shouldRun)
{
if (sensor->isDeviceAvailable())
{
cout << "Alarm status: "
<< sensor->isAlarmTripped()
<< endl;
cout << "Tamper Switch status: "
<< sensor->isTamperTripped()
<< endl;
cout << "Battery Level: "
<< sensor->getBatteryLevel()
<< "%"
<< endl;
cout << endl;
}
else
{
cout << "Device has not yet responded to probe."
<< endl;
cout << "Try waking it, or wait until it wakes itself if configured"
<< " to do so."
<< endl;
cout << endl;
}
sleep(1);
}
cout << "Exiting..." << endl;
delete sensor;
return 0;
}

127
examples/c++/aeotecsdg2.cxx Normal file
View File

@ -0,0 +1,127 @@
/*
* Author: Jon Trulson <jtrulson@ics.com>
* Copyright (c) 2016 Intel Corporation.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <unistd.h>
#include <iostream>
#include <signal.h>
#include "aeotecsdg2.hpp"
using namespace std;
bool shouldRun = true;
void sig_handler(int signo)
{
if (signo == SIGINT)
shouldRun = false;
}
int main(int argc, char **argv)
{
signal(SIGINT, sig_handler);
//! [Interesting]
string defaultDev = "/dev/ttyACM0";
// if an argument was specified, use it as the device instead
if (argc > 1)
defaultDev = string(argv[1]);
// Instantiate an Aeotec Smart Dimmer Gen2 instance, on device node
// 9. You will almost certainly need to change this to reflect your
// own network. Use the ozwdump example to see what nodes are
// available.
upm::AeotecSDG2 *sensor = new upm::AeotecSDG2(9);
// The first thing to do is create options, then lock them when done.
sensor->optionsCreate();
sensor->optionsLock();
// Next, initialize it.
cout << "Initializing, this may take awhile depending on your ZWave network"
<< endl;
sensor->init(defaultDev);
cout << "Initialization complete" << endl;
// turn light on
cout << "Turning switch on, then sleeping for 5 secs" << endl;
sensor->on();
sleep(5);
cout << "Querying data..." << endl;
bool dim = false;
while (shouldRun)
{
// put on a light show...
if (dim)
sensor->setLevel(25);
else
sensor->on();
dim = !dim;
sensor->update();
cout << "Current Level: "
<< sensor->getLevel()
<< endl;
cout << "Volts: "
<< sensor->getVolts()
<< " volts"
<< endl;
cout << "Energy Consumption: "
<< sensor->getEnergy()
<< " kWh"
<< endl;
cout << "Watts: "
<< sensor->getWatts()
<< endl;
cout << "Current: "
<< sensor->getCurrent()
<< " amps"
<< endl;
cout << endl;
sleep(5);
}
cout << "Turning switch off and sleeping for 5 seconds..." << endl;
sensor->off();
sleep(5);
cout << "Exiting..." << endl;
delete sensor;
return 0;
}

117
examples/c++/aeotecss6.cxx Normal file
View File

@ -0,0 +1,117 @@
/*
* Author: Jon Trulson <jtrulson@ics.com>
* Copyright (c) 2016 Intel Corporation.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <unistd.h>
#include <iostream>
#include <signal.h>
#include "aeotecss6.hpp"
using namespace std;
bool shouldRun = true;
void sig_handler(int signo)
{
if (signo == SIGINT)
shouldRun = false;
}
int main(int argc, char **argv)
{
signal(SIGINT, sig_handler);
//! [Interesting]
string defaultDev = "/dev/ttyACM0";
// if an argument was specified, use it as the device instead
if (argc > 1)
defaultDev = string(argv[1]);
// Instantiate an Aeotec SS6 instance, on device node 11. You will
// almost certainly need to change this to reflect your own network.
// Use the ozwdump example to see what nodes are available.
upm::AeotecSS6 *sensor = new upm::AeotecSS6(11);
// The first thing to do is create options, then lock them when done.
sensor->optionsCreate();
sensor->optionsLock();
// Next, initialize it.
cout << "Initializing, this may take awhile depending on your ZWave network"
<< endl;
sensor->init(defaultDev);
cout << "Initialization complete" << endl;
// turn light on
cout << "Turning switch on, then sleeping for 5 secs" << endl;
sensor->on();
sleep(5);
cout << "Querying data..." << endl;
while (shouldRun)
{
sensor->update();
cout << "Switch status: "
<< sensor->isOn()
<< endl;
cout << "Volts: "
<< sensor->getVolts()
<< " volts"
<< endl;
cout << "Energy Consumption: "
<< sensor->getEnergy()
<< " kWh"
<< endl;
cout << "Watts: "
<< sensor->getWatts()
<< endl;
cout << "Current: "
<< sensor->getCurrent()
<< " amps"
<< endl;
cout << endl;
sleep(3);
}
cout << "Turning switch off and sleeping for 5 seconds..." << endl;
sensor->off();
sleep(5);
cout << "Exiting..." << endl;
delete sensor;
return 0;
}

View File

@ -25,7 +25,7 @@
#include <unistd.h>
#include <iostream>
#include <signal.h>
#include "mpu9150.h"
#include "mpu9150.hpp"
using namespace std;

View File

@ -26,7 +26,7 @@
#include <iostream>
#include <signal.h>
#include "am2315.h"
#include "am2315.hpp"
volatile int doWork = 0;

View File

@ -22,7 +22,7 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "apa102.h"
#include "apa102.hpp"
#include <iostream>
#include <signal.h>
#include <unistd.h>

View File

@ -25,7 +25,7 @@
#include <unistd.h>
#include <iostream>
#include <signal.h>
#include "apds9002.h"
#include "apds9002.hpp"
using namespace std;

View File

@ -1,6 +1,6 @@
/*
* Author: Lay, Kuan Loon <kuan.loon.lay@intel.com>
* Copyright (c) 2015 Intel Corporation.
* Copyright (c) 2016 Intel Corporation.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@ -25,7 +25,7 @@
#include <unistd.h>
#include <iostream>
#include <signal.h>
#include "apds9930.h"
#include "apds9930.hpp"
using namespace std;
@ -46,6 +46,15 @@ main()
// Instantiate a Digital Proximity and Ambient Light sensor on iio device 4
upm::APDS9930* light_proximity = new upm::APDS9930(4);
// Kernel driver implement sleep 5000-5100us after enable illuminance sensor
light_proximity->enableIlluminance(true);
// Kernel driver implement sleep 5000-5100us after enable proximity sensor
light_proximity->enableProximity(true);
// Tested this value works. Please change it on your platform
usleep(120000);
while (shouldRun) {
float lux = light_proximity->getAmbient();
cout << "Luminance value is " << lux << endl;
@ -53,6 +62,8 @@ main()
cout << "Proximity value is " << proximity << endl;
sleep(1);
}
light_proximity->enableProximity(false);
light_proximity->enableIlluminance(false);
//! [Interesting]
cout << "Exiting" << endl;

View File

@ -25,7 +25,7 @@
#include <unistd.h>
#include <signal.h>
#include <iostream>
#include "at42qt1070.h"
#include "at42qt1070.hpp"
using namespace std;

View File

@ -25,7 +25,7 @@
#include <unistd.h>
#include <iostream>
#include <signal.h>
#include "biss0001.h"
#include "biss0001.hpp"
using namespace std;

View File

@ -25,7 +25,7 @@
#include <unistd.h>
#include <iostream>
#include <signal.h>
#include "bma220.h"
#include "bma220.hpp"
using namespace std;

83
examples/c++/bma250e.cxx Normal file
View File

@ -0,0 +1,83 @@
/*
* Author: Jon Trulson <jtrulson@ics.com>
* Copyright (c) 2016 Intel Corporation.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <unistd.h>
#include <iostream>
#include <signal.h>
#include "bma250e.hpp"
using namespace std;
int shouldRun = true;
void sig_handler(int signo)
{
if (signo == SIGINT)
shouldRun = false;
}
int main(int argc, char **argv)
{
signal(SIGINT, sig_handler);
//! [Interesting]
// Instantiate an BMA250E using default I2C parameters
upm::BMA250E *sensor = new upm::BMA250E();
// For SPI, bus 0, you would pass -1 as the address, and a valid pin
// for CS: BMA250E(0, -1, 10);
// now output data every 250 milliseconds
while (shouldRun)
{
float x, y, z;
sensor->update();
sensor->getAccelerometer(&x, &y, &z);
cout << "Accelerometer x: " << x
<< " y: " << y
<< " z: " << z
<< " g"
<< endl;
// we show both C and F for temperature
cout << "Compensation Temperature: " << sensor->getTemperature()
<< " C / " << sensor->getTemperature(true) << " F"
<< endl;
cout << endl;
usleep(250000);
}
//! [Interesting]
cout << "Exiting..." << endl;
delete sensor;
return 0;
}

82
examples/c++/bmc150.cxx Normal file
View File

@ -0,0 +1,82 @@
/*
* Author: Jon Trulson <jtrulson@ics.com>
* Copyright (c) 2016 Intel Corporation.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <unistd.h>
#include <iostream>
#include <signal.h>
#include "bmc150.hpp"
using namespace std;
int shouldRun = true;
void sig_handler(int signo)
{
if (signo == SIGINT)
shouldRun = false;
}
int main(int argc, char **argv)
{
signal(SIGINT, sig_handler);
//! [Interesting]
// Instantiate an BMC150 using default I2C parameters
upm::BMC150 *sensor = new upm::BMC150();
// now output data every 250 milliseconds
while (shouldRun)
{
float x, y, z;
sensor->update();
sensor->getAccelerometer(&x, &y, &z);
cout << "Accelerometer x: " << x
<< " y: " << y
<< " z: " << z
<< " g"
<< endl;
sensor->getMagnetometer(&x, &y, &z);
cout << "Magnetometer x: " << x
<< " y: " << y
<< " z: " << z
<< " uT"
<< endl;
cout << endl;
usleep(250000);
}
//! [Interesting]
cout << "Exiting..." << endl;
delete sensor;
return 0;
}

View File

@ -1,6 +1,6 @@
/*
* Author: Henry Bruce <henry.bruce@intel.com>
* Copyright (c) 2015 Intel Corporation.
* Author: Jon Trulson <jtrulson@ics.com>
* Copyright (c) 2016 Intel Corporation.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@ -24,28 +24,55 @@
#include <unistd.h>
#include <iostream>
#include "bme280.h"
#include <signal.h>
#define FT4222_I2C_BUS 0
#include "bme280.hpp"
int main ()
using namespace std;
using namespace upm;
int shouldRun = true;
void sig_handler(int signo)
{
try {
upm::BME280* bme280 = new upm::BME280 (mraa_get_sub_platform_id(FT4222_I2C_BUS));
while (true) {
int temperature = bme280->getTemperatureCelcius();
int humidity = bme280->getHumidityRelative();
int pressure = bme280->getPressurePa();
std::cout << "Temperature = " << temperature << "C" << std::endl;
std::cout << "Humidity = " << humidity << "%" << std::endl;
std::cout << "Pressure = " << pressure << "Pa" << std::endl;
sleep(1);
}
delete bme280;
} catch (std::exception& e) {
std::cerr << e.what() << std::endl;
}
return 0;
if (signo == SIGINT)
shouldRun = false;
}
int main(int argc, char **argv)
{
signal(SIGINT, sig_handler);
//! [Interesting]
// Instantiate a BME280 instance using default i2c bus and address
upm::BME280 *sensor = new upm::BME280();
// For SPI, bus 0, you would pass -1 as the address, and a valid pin for CS:
// BME280(0, -1, 10);
while (shouldRun)
{
// update our values from the sensor
sensor->update();
// we show both C and F for temperature
cout << "Compensation Temperature: " << sensor->getTemperature()
<< " C / " << sensor->getTemperature(true) << " F"
<< endl;
cout << "Pressure: " << sensor->getPressure() << " Pa" << endl;
cout << "Computed Altitude: " << sensor->getAltitude() << " m" << endl;
cout << "Humidity: " << sensor->getHumidity() << " %RH" << endl;
cout << endl;
sleep(1);
}
//! [Interesting]
cout << "Exiting..." << endl;
delete sensor;
return 0;
}

83
examples/c++/bmg160.cxx Normal file
View File

@ -0,0 +1,83 @@
/*
* Author: Jon Trulson <jtrulson@ics.com>
* Copyright (c) 2016 Intel Corporation.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <unistd.h>
#include <iostream>
#include <signal.h>
#include "bmg160.hpp"
using namespace std;
int shouldRun = true;
void sig_handler(int signo)
{
if (signo == SIGINT)
shouldRun = false;
}
int main(int argc, char **argv)
{
signal(SIGINT, sig_handler);
//! [Interesting]
// Instantiate an BMG160 using default I2C parameters
upm::BMG160 *sensor = new upm::BMG160();
// For SPI, bus 0, you would pass -1 as the address, and a valid pin
// for CS: BMG160(0, -1, 10);
// now output data every 250 milliseconds
while (shouldRun)
{
float x, y, z;
sensor->update();
sensor->getGyroscope(&x, &y, &z);
cout << "Gyroscope x: " << x
<< " y: " << y
<< " z: " << z
<< " degrees/s"
<< endl;
// we show both C and F for temperature
cout << "Compensation Temperature: " << sensor->getTemperature()
<< " C / " << sensor->getTemperature(true) << " F"
<< endl;
cout << endl;
usleep(250000);
}
//! [Interesting]
cout << "Exiting..." << endl;
delete sensor;
return 0;
}

82
examples/c++/bmi055.cxx Normal file
View File

@ -0,0 +1,82 @@
/*
* Author: Jon Trulson <jtrulson@ics.com>
* Copyright (c) 2016 Intel Corporation.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <unistd.h>
#include <iostream>
#include <signal.h>
#include "bmi055.hpp"
using namespace std;
int shouldRun = true;
void sig_handler(int signo)
{
if (signo == SIGINT)
shouldRun = false;
}
int main(int argc, char **argv)
{
signal(SIGINT, sig_handler);
//! [Interesting]
// Instantiate an BMI055 using default I2C parameters
upm::BMI055 *sensor = new upm::BMI055();
// now output data every 250 milliseconds
while (shouldRun)
{
float x, y, z;
sensor->update();
sensor->getAccelerometer(&x, &y, &z);
cout << "Accelerometer x: " << x
<< " y: " << y
<< " z: " << z
<< " g"
<< endl;
sensor->getGyroscope(&x, &y, &z);
cout << "Gyroscope x: " << x
<< " y: " << y
<< " z: " << z
<< " degrees/s"
<< endl;
cout << endl;
usleep(250000);
}
//! [Interesting]
cout << "Exiting..." << endl;
delete sensor;
return 0;
}

View File

@ -25,7 +25,7 @@
#include <unistd.h>
#include <iostream>
#include <signal.h>
#include "bmi160.h"
#include "bmi160.hpp"
using namespace std;

78
examples/c++/bmm150.cxx Normal file
View File

@ -0,0 +1,78 @@
/*
* Author: Jon Trulson <jtrulson@ics.com>
* Copyright (c) 2016 Intel Corporation.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <unistd.h>
#include <iostream>
#include <signal.h>
#include "bmm150.hpp"
using namespace std;
int shouldRun = true;
void sig_handler(int signo)
{
if (signo == SIGINT)
shouldRun = false;
}
int main(int argc, char **argv)
{
signal(SIGINT, sig_handler);
//! [Interesting]
// Instantiate an BMM150 using default I2C parameters
upm::BMM150 *sensor = new upm::BMM150();
// For SPI, bus 0, you would pass -1 as the address, and a valid pin
// for CS: BMM150(0, -1, 10);
// now output data every 250 milliseconds
while (shouldRun)
{
float x, y, z;
sensor->update();
sensor->getMagnetometer(&x, &y, &z);
cout << "Magnetometer x: " << x
<< " y: " << y
<< " z: " << z
<< " uT"
<< endl;
cout << endl;
usleep(250000);
}
//! [Interesting]
cout << "Exiting..." << endl;
delete sensor;
return 0;
}

77
examples/c++/bmp280.cxx Normal file
View File

@ -0,0 +1,77 @@
/*
* Author: Jon Trulson <jtrulson@ics.com>
* Copyright (c) 2016 Intel Corporation.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <unistd.h>
#include <iostream>
#include <signal.h>
#include "bmp280.hpp"
using namespace std;
using namespace upm;
int shouldRun = true;
void sig_handler(int signo)
{
if (signo == SIGINT)
shouldRun = false;
}
int main(int argc, char **argv)
{
signal(SIGINT, sig_handler);
//! [Interesting]
// Instantiate a BMP280 instance using default i2c bus and address
upm::BMP280 *sensor = new upm::BMP280();
// For SPI, bus 0, you would pass -1 as the address, and a valid pin for CS:
// BMP280(0, -1, 10);
while (shouldRun)
{
// update our values from the sensor
sensor->update();
// we show both C and F for temperature
cout << "Compensation Temperature: " << sensor->getTemperature()
<< " C / " << sensor->getTemperature(true) << " F"
<< endl;
cout << "Pressure: " << sensor->getPressure() << " Pa" << endl;
cout << "Computed Altitude: " << sensor->getAltitude() << " m" << endl;
cout << endl;
sleep(1);
}
//! [Interesting]
cout << "Exiting..." << endl;
delete sensor;
return 0;
}

View File

@ -24,7 +24,7 @@
#include <unistd.h>
#include <iostream>
#include "bmpx8x.h"
#include "bmpx8x.hpp"
#include <signal.h>
int doWork = 0;

89
examples/c++/bmx055.cxx Normal file
View File

@ -0,0 +1,89 @@
/*
* Author: Jon Trulson <jtrulson@ics.com>
* Copyright (c) 2016 Intel Corporation.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <unistd.h>
#include <iostream>
#include <signal.h>
#include "bmx055.hpp"
using namespace std;
int shouldRun = true;
void sig_handler(int signo)
{
if (signo == SIGINT)
shouldRun = false;
}
int main(int argc, char **argv)
{
signal(SIGINT, sig_handler);
//! [Interesting]
// Instantiate an BMX055 using default I2C parameters
upm::BMX055 *sensor = new upm::BMX055();
// now output data every 250 milliseconds
while (shouldRun)
{
float x, y, z;
sensor->update();
sensor->getAccelerometer(&x, &y, &z);
cout << "Accelerometer x: " << x
<< " y: " << y
<< " z: " << z
<< " g"
<< endl;
sensor->getGyroscope(&x, &y, &z);
cout << "Gyroscope x: " << x
<< " y: " << y
<< " z: " << z
<< " degrees/s"
<< endl;
sensor->getMagnetometer(&x, &y, &z);
cout << "Magnetometer x: " << x
<< " y: " << y
<< " z: " << z
<< " uT"
<< endl;
cout << endl;
usleep(250000);
}
//! [Interesting]
cout << "Exiting..." << endl;
delete sensor;
return 0;
}

129
examples/c++/bno055.cxx Normal file
View File

@ -0,0 +1,129 @@
/*
* Author: Jon Trulson <jtrulson@ics.com>
* Copyright (c) 2016 Intel Corporation.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <unistd.h>
#include <iostream>
#include <signal.h>
#include "bno055.hpp"
using namespace std;
int shouldRun = true;
void sig_handler(int signo)
{
if (signo == SIGINT)
shouldRun = false;
}
int main(int argc, char **argv)
{
signal(SIGINT, sig_handler);
//! [Interesting]
// Instantiate an BNO055 using default parameters (bus 0, addr
// 0x28). The default running mode is NDOF absolute orientation
// mode.
upm::BNO055 *sensor = new upm::BNO055();
// First we need to calibrate....
cout << "First we need to calibrate. 4 numbers will be output every"
<< endl;
cout << "second for each sensor. 0 means uncalibrated, and 3 means"
<< endl;
cout << "fully calibrated."
<< endl;
cout << "See the UPM documentation on this sensor for instructions on"
<< endl;
cout << "what actions are required to calibrate."
<< endl;
cout << endl;
// do the calibration...
while (shouldRun && !sensor->isFullyCalibrated())
{
int mag, acc, gyr, sys;
sensor->getCalibrationStatus(&mag, &acc, &gyr, &sys);
cout << "Magnetometer: " << mag
<< " Accelerometer: " << acc
<< " Gyroscope: " << gyr
<< " System: " << sys
<< endl;
sleep(1);
}
cout << endl;
cout << "Calibration complete." << endl;
cout << endl;
// now output various fusion data every 250 milliseconds
while (shouldRun)
{
float w, x, y, z;
sensor->update();
sensor->getEulerAngles(&x, &y, &z);
cout << "Euler: Heading: " << x
<< " Roll: " << y
<< " Pitch: " << z
<< " degrees"
<< endl;
sensor->getQuaternions(&w, &x, &y, &z);
cout << "Quaternion: W: " << w
<< " X: " << x
<< " Y: " << y
<< " Z: " << z
<< endl;
sensor->getLinearAcceleration(&x, &y, &z);
cout << "Linear Acceleration: X: " << x
<< " Y: " << y
<< " Z: " << z
<< " m/s^2"
<< endl;
sensor->getGravityVectors(&x, &y, &z);
cout << "Gravity Vector: X: " << x
<< " Y: " << y
<< " Z: " << z
<< " m/s^2"
<< endl;
cout << endl;
usleep(250000);
}
//! [Interesting]
cout << "Exiting..." << endl;
delete sensor;
return 0;
}

View File

@ -25,7 +25,7 @@
#include <unistd.h>
#include <iostream>
#include <signal.h>
#include "buzzer.h"
#include "buzzer.hpp"
int

View File

@ -25,7 +25,7 @@
#include <unistd.h>
#include <iostream>
#include <signal.h>
#include "cjq4435.h"
#include "cjq4435.hpp"
using namespace std;

View File

@ -24,7 +24,7 @@
#include <unistd.h>
#include <iostream>
#include "t6713.h"
#include "t6713.hpp"
#define EDISON_I2C_BUS 1
#define FT4222_I2C_BUS 0

View File

@ -26,7 +26,7 @@
#include <iostream>
#include <signal.h>
#include "cwlsxxa.h"
#include "cwlsxxa.hpp"
using namespace std;

View File

@ -25,7 +25,7 @@
#include <unistd.h>
#include <iostream>
#include <signal.h>
#include "dfrph.h"
#include "dfrph.hpp"
using namespace std;

View File

@ -24,7 +24,7 @@
#include <unistd.h>
#include <iostream>
#include "ds1307.h"
#include "ds1307.hpp"
using namespace std;

View File

@ -3,7 +3,7 @@
#include <unistd.h>
#include <iostream>
#include <string>
#include "ds1808lc.h"
#include "ds1808lc.hpp"
#define EDISON_I2C_BUS 1 // Edison I2C-1
#define DS1808_GPIO_PWR 15 // Edison GP165

81
examples/c++/ds18b20.cxx Normal file
View File

@ -0,0 +1,81 @@
/*
* Author: Jon Trulson <jtrulson@ics.com>
* Copyright (c) 2016 Intel Corporation.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <unistd.h>
#include <iostream>
#include <signal.h>
#include "ds18b20.hpp"
using namespace std;
bool shouldRun = true;
void sig_handler(int signo)
{
if (signo == SIGINT)
shouldRun = false;
}
int main(int argc, char **argv)
{
signal(SIGINT, sig_handler);
//! [Interesting]
cout << "Initializing..." << endl;
// Instantiate an DS18B20 instance using the default values (uart 0)
upm::DS18B20 sensor;
// locate and setup our devices
sensor.init();
cout << "Found " << sensor.devicesFound() << " device(s)" << endl;
cout << endl;
// bail if we didn't find anything
if (!sensor.devicesFound())
return 1;
// update and print available values every second
while (shouldRun)
{
// update our values for the first sensor
sensor.update(0);
// we show both C and F for temperature for the first sensor
cout << "Temperature: " << sensor.getTemperature(0)
<< " C / " << sensor.getTemperature(0, true) << " F"
<< endl;
sleep(1);
}
cout << "Exiting..." << endl;
//! [Interesting]
return 0;
}

59
examples/c++/ds2413.cxx Normal file
View File

@ -0,0 +1,59 @@
/*
* Author: Jon Trulson <jtrulson@ics.com>
* Copyright (c) 2016 Intel Corporation.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <unistd.h>
#include <iostream>
#include <stdio.h>
#include "ds2413.hpp"
using namespace std;
using namespace upm;
int main(int argc, char **argv)
{
//! [Interesting]
// Instantiate a DS2413 Module on a Dallas 1-wire bus connected to UART 0
upm::DS2413* sensor = new upm::DS2413(0);
// find all of the DS2413 devices present on the bus
sensor->init();
// how many devices were found?
cout << "Found "<< sensor->devicesFound() << " device(s)" << endl;
// read the gpio and latch values from the first device
// the lower 4 bits are of the form:
// <gpioB latch> <gpioB value> <gpioA latch> <gpioA value>
cout << "GPIO device 0 values: " << sensor->readGpios(0) << endl;
// set the gpio latch values of the first device
cout << "Setting GPIO latches to on" << endl;
sensor->writeGpios(0, 0x03);
cout << "Exiting..." << endl;
delete sensor;
//! [Interesting]
return 0;
}

View File

@ -26,7 +26,7 @@
#include <iostream>
#include <signal.h>
#include "e50hx.h"
#include "e50hx.hpp"
using namespace std;
using namespace upm;
@ -74,8 +74,8 @@ int main(int argc, char **argv)
// sensor->setDebug(true);
cout << endl;
cout << "Device Description: " << sensor->getDescription() << endl;
cout << "Device Location: " << sensor->getLocation() << endl;
cout << "Device Description: " << sensor->getDeviceDescription() << endl;
cout << "Device Location: " << sensor->getDeviceLocation() << endl;
cout << endl;
// update and print a few values every 5 seconds

View File

@ -23,7 +23,7 @@
*/
#include <iostream>
#include "eboled.h"
#include "eboled.hpp"
using namespace std;

View File

@ -26,7 +26,7 @@
#include <iostream>
#include <signal.h>
#include <stdlib.h>
#include "ecs1030.h"
#include "ecs1030.hpp"
int is_running = 0;
upm::ECS1030 *sensor = NULL;

View File

@ -25,7 +25,7 @@
#include <unistd.h>
#include <iostream>
#include <signal.h>
#include "enc03r.h"
#include "enc03r.hpp"
using namespace std;

View File

@ -24,7 +24,7 @@
#include <unistd.h>
#include <iostream>
#include "es08a.h"
#include "es08a.hpp"
#include <signal.h>
#include <stdlib.h>

View File

@ -25,7 +25,7 @@
#include <unistd.h>
#include <iostream>
#include <signal.h>
#include "flex.h"
#include "flex.hpp"
using namespace std;

View File

@ -25,7 +25,7 @@
#include <unistd.h>
#include <iostream>
#include <signal.h>
#include "gp2y0a.h"
#include "gp2y0a.hpp"
using namespace std;

View File

@ -24,7 +24,7 @@
#include <unistd.h>
#include <iostream>
#include "grove.h"
#include "grove.hpp"
int
main(int argc, char **argv)

View File

@ -25,7 +25,7 @@
#include <unistd.h>
#include <iostream>
#include <signal.h>
#include "grovecircularled.h"
#include "grovecircularled.hpp"
using namespace std;

View File

@ -24,7 +24,7 @@
#include <iostream>
#include <unistd.h>
#include <signal.h>
#include "grovecollision.h"
#include "grovecollision.hpp"
using namespace std;

View File

@ -25,7 +25,7 @@
#include <unistd.h>
#include <iostream>
#include <signal.h>
#include "groveehr.h"
#include "groveehr.hpp"
using namespace std;

View File

@ -24,7 +24,7 @@
#include <iostream>
#include <unistd.h>
#include <signal.h>
#include "groveeldriver.h"
#include "groveeldriver.hpp"
using namespace std;

View File

@ -24,7 +24,7 @@
#include <iostream>
#include <time.h>
#include <signal.h>
#include "groveelectromagnet.h"
#include "groveelectromagnet.hpp"
using namespace std;

View File

@ -24,7 +24,7 @@
#include <unistd.h>
#include <iostream>
#include <signal.h>
#include "groveemg.h"
#include "groveemg.hpp"
using namespace std;

View File

@ -26,7 +26,7 @@
#include <iostream>
#include <signal.h>
#include <stdio.h>
#include "grovegprs.h"
#include "grovegprs.hpp"
using namespace std;
using namespace upm;

View File

@ -25,7 +25,7 @@
#include <unistd.h>
#include <iostream>
#include <signal.h>
#include "grovegsr.h"
#include "grovegsr.hpp"
using namespace std;

View File

@ -25,7 +25,7 @@
#include <unistd.h>
#include <iostream>
#include <signal.h>
#include "grove.h"
#include "grove.hpp"
using namespace std;

View File

@ -25,7 +25,7 @@
#include <unistd.h>
#include <iostream>
#include "grove.h"
#include "grove.hpp"
int
main(int argc, char **argv)

View File

@ -25,7 +25,7 @@
#include <unistd.h>
#include <iostream>
#include <signal.h>
#include "groveledbar.h"
#include "groveledbar.hpp"
using namespace std;

View File

@ -25,7 +25,7 @@
#include <unistd.h>
#include <iostream>
#include "grove.h"
#include "grove.hpp"
int
main(int argc, char **argv)

View File

@ -25,7 +25,7 @@
#include <unistd.h>
#include <iostream>
#include <signal.h>
#include "grovelinefinder.h"
#include "grovelinefinder.hpp"
using namespace std;

View File

@ -25,7 +25,7 @@
#include <unistd.h>
#include <signal.h>
#include <iostream>
#include "grovemd.h"
#include "grovemd.hpp"
using namespace std;

View File

@ -25,7 +25,7 @@
#include <unistd.h>
#include <signal.h>
#include <iostream>
#include "grovemd.h"
#include "grovemd.hpp"
using namespace std;

View File

@ -25,7 +25,7 @@
#include <unistd.h>
#include <iostream>
#include <signal.h>
#include "grovemoisture.h"
#include "grovemoisture.hpp"
using namespace std;

View File

@ -24,7 +24,7 @@
#include <unistd.h>
#include <iostream>
#include <signal.h>
#include "groveo2.h"
#include "groveo2.hpp"
using namespace std;

View File

@ -24,7 +24,7 @@
#include <unistd.h>
#include <iostream>
#include "grove.h"
#include "grove.hpp"
int
main(int argc, char **argv)

View File

@ -25,7 +25,7 @@
#include <unistd.h>
#include <iostream>
#include <iomanip>
#include "grove.h"
#include "grove.hpp"
using namespace std;

View File

@ -26,7 +26,7 @@
#include <iostream>
#include <signal.h>
#include <stdio.h>
#include "grovescam.h"
#include "grovescam.hpp"
using namespace std;
using namespace upm;

View File

@ -26,7 +26,7 @@
#include <unistd.h>
#include <iostream>
#include <iomanip>
#include "grove.h"
#include "grove.hpp"
using namespace std;

View File

@ -25,7 +25,7 @@
#include <unistd.h>
#include <iostream>
#include <signal.h>
#include "grovespeaker.h"
#include "grovespeaker.hpp"
using namespace std;

View File

@ -26,7 +26,7 @@
#include <unistd.h>
#include <iostream>
#include <iomanip>
#include "grove.h"
#include "grove.hpp"
int
main(int argc, char **argv)

View File

@ -26,7 +26,7 @@
#include <unistd.h>
#include <iostream>
#include "groveultrasonic.h"
#include "groveultrasonic.hpp"
#include <signal.h>
#include <stdlib.h>
#include <sys/time.h>

View File

@ -25,7 +25,7 @@
#include <unistd.h>
#include <iostream>
#include <signal.h>
#include "grovevdiv.h"
#include "grovevdiv.hpp"
using namespace std;

View File

@ -25,7 +25,7 @@
#include <unistd.h>
#include <iostream>
#include <signal.h>
#include "grovewater.h"
#include "grovewater.hpp"
using namespace std;

View File

@ -25,7 +25,7 @@
#include <unistd.h>
#include <iostream>
#include <signal.h>
#include "grovewfs.h"
#include "grovewfs.hpp"
using namespace std;

View File

@ -25,7 +25,7 @@
#include <unistd.h>
#include <iostream>
#include <signal.h>
#include "guvas12d.h"
#include "guvas12d.hpp"
using namespace std;

View File

@ -25,7 +25,7 @@
#include <unistd.h>
#include <signal.h>
#include <iostream>
#include "h3lis331dl.h"
#include "h3lis331dl.hpp"
using namespace std;
using namespace upm;

View File

@ -26,7 +26,7 @@
#include <iostream>
#include <signal.h>
#include "h803x.h"
#include "h803x.hpp"
using namespace std;

View File

@ -24,7 +24,7 @@
#include <unistd.h>
#include <iostream>
#include "hcsr04.h"
#include "hcsr04.hpp"
#include <signal.h>
#include <stdlib.h>
#include <sys/time.h>

View File

@ -26,7 +26,7 @@
#include <iostream>
#include <signal.h>
#include "hdxxvxta.h"
#include "hdxxvxta.hpp"
using namespace std;

View File

@ -3,7 +3,7 @@
#include <unistd.h>
#include <iostream>
#include <string>
#include "hlg150h.h"
#include "hlg150h.hpp"
#define HLG150H_GPIO_RELAY 21
#define HLG150H_GPIO_PWM 22

View File

@ -26,7 +26,7 @@
#include <iostream>
#include <signal.h>
#include <stdio.h>
#include "hm11.h"
#include "hm11.hpp"
using namespace std;
using namespace upm;

View File

@ -24,7 +24,7 @@
*/
#include <unistd.h>
#include "hmc5883l.h"
#include "hmc5883l.hpp"
int
main(int argc, char **argv)

View File

@ -26,7 +26,7 @@
#include <string.h>
#include <iostream>
#include <signal.h>
#include "hmtrp.h"
#include "hmtrp.hpp"
using namespace std;

View File

@ -25,7 +25,7 @@
#include <unistd.h>
#include <signal.h>
#include <iostream>
#include "hp20x.h"
#include "hp20x.hpp"
using namespace std;
using namespace upm;
@ -53,7 +53,7 @@ int main(int argc, char **argv)
// Output data every second until interrupted
while (shouldRun)
{
printf("Temperature: %f Celcius\n", bar->getTemperature());
printf("Temperature: %f Celsius\n", bar->getTemperature());
printf("Pressure: %f Millibars\n", bar->getPressure());
printf("Altitude: %f Meters\n", bar->getAltitude());

Some files were not shown because too many files have changed in this diff Show More