Compare commits

...

251 Commits

Author SHA1 Message Date
Propanu
d6f76ff8c2
naming.md: remove personal info
Project's community can be engaged via Github to provide help and comments on new contributions.
2021-07-23 13:02:23 -07:00
Propanu
8ae7f89e03
porting.md: remove personal information
Contributions can only be made via github.
2021-07-23 12:58:00 -07:00
Mihai Tudor Panu
3f7dcc6e0b installing: provide instructions for rhel and other linux distributions
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2020-09-01 13:11:26 -07:00
Mihai Tudor Panu
0a0c352614 tests: add missing license block on project python and node tests
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2020-03-05 15:14:11 -08:00
Mihai Tudor Panu
89d5de43e0 license: update to SPDX style license text throughout
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2020-03-05 15:13:36 -08:00
Mihai Tudor Panu
dc843c0bd7 doxy: fix sparkfun image license version in template
Sparkfun provided images are covered under CC BY 2.0, update license on documentation template to reflect correct license.

Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2020-03-05 15:13:08 -08:00
Mihai Tudor Panu
c37a48255e contributing: update project contribution guides
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2020-03-05 15:12:53 -08:00
Mihai Tudor Panu
ab25e56212 readme: additional cleanup to readme
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2020-03-05 15:12:39 -08:00
Mihai Tudor Panu
f5a66936be eclipse: update readme and contributing.md to reflect Eclipse changes
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2020-03-05 15:12:29 -08:00
Mihai Tudor Panu
5cf20df96c upm: version 2.0.0
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-05-08 08:06:25 -07:00
Mihai Tudor Panu
33d0aee280 grove: remove deprecated classes and examples
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-05-08 08:06:21 -07:00
Mihai Tudor Panu
7d0600df1c 2jciebu01_usb: remove unused device path variable
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-05-05 17:56:14 -07:00
Mihai Tudor Panu
b454862649 2jciebu01: rename examples to build during CI job
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-05-05 15:56:27 -07:00
Mihai Tudor Panu
9501488709 targetarch: remove arch detection logic as it is not needed at upm level
This removes the DETECTED_ARCH cmake variable and device arch detection module as this is irrelevant for UPM. Also removing toolchain files since they are not really needed by this project.

Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-05-04 18:34:27 -07:00
Mihai Tudor Panu
8f3f2a7de2 cmake: remove ipk and rpm generation as handled through recipes
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-05-03 23:18:05 -07:00
Mihai Tudor Panu
4c6fde84f4 iio: switch to safer use of snprintf for a couple of iio sensors
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-30 19:38:42 -07:00
Mihai Tudor Panu
2c7fff24c7 docker-compose: map sonar scan job to new sonar docker image
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-16 18:16:10 -07:00
Mihai Tudor Panu
e3d054086b tests: reenable java blacklist until tinyb.java is formally integrated
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-11 12:04:28 -07:00
Mihai Tudor Panu
2b6f2c5b53 2jciebu01: fix base class and build dependencies
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-11 04:57:12 +00:00
Mihai Tudor Panu
2a948ca687 cmake: handle tinyb dependency through upm_init_module macro
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-11 04:36:13 +00:00
Mihai Tudor Panu
d282d479bb cmake: check compiler version before adding -Wno-misleading-indentation flag
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-10 23:02:44 +00:00
Mihai Tudor Panu
d256a225bf 2jciebu01: remove attribute specifier from common header and update swig interfaces
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-10 23:02:43 +00:00
Mihai Tudor Panu
9cddd4a8b1 cmake: add check for tinyb and set as dependency for 2jciebu01-ble
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-10 23:02:39 +00:00
Mihai Tudor Panu
223b6028bf 2jciebu01: update documentation tags, dependencies, library names
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-05 16:20:41 -07:00
Mihai Tudor Panu
b08eef0197 2jciebu01: put new sources in right location
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-05 16:20:40 -07:00
Hiroyuki Mino
e0be90589b 2jciebu01: initial implementation of Omron's Environment Sensor using BLE interface
Signed-off-by: Hiroyuki Mino <Hank.Mino@omron.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-05 16:20:39 -07:00
Hiroyuki Mino
bf315ee5c6 2jciebu01: initial implementation of Omron's USB type Environment Sensor
Signed-off-by: Hiroyuki Mino <Hank.Mino@omron.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-05 16:20:38 -07:00
Mihai Tudor Panu
066385d9ac travis: allow failure of android things job as no longer actively supported
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-05 08:33:24 -07:00
Mihai Tudor Panu
934d571964 bmpx8x: library implements new iTemperature interface
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-05 08:33:12 -07:00
Adelin Dobre
ef92026253 BNO055: Change parameter in example file
Signed-off-by: Adelin Dobre <adelin.dobre@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:24:14 -07:00
Adelin Dobre
a106345527 BH1749: Fix inconsistences inside string init constructor
Signed-off-by: Adelin Dobre <adelin.dobre@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:24:05 -07:00
Adelin Dobre
3044bc6b49 Remove unnecessary logs from upm_string_parser
Signed-off-by: Adelin Dobre <adelin.dobre@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:23:56 -07:00
Adelin Dobre
d2428ca5da BH1792: Add string based constructor
Signed-off-by: Adelin Dobre <adelin.dobre@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:23:47 -07:00
Adelin Dobre
bd445385a7 EHR: Add string based constructor
Signed-off-by: Adelin Dobre <adelin.dobre@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:23:38 -07:00
Adelin Dobre
402739fa74 ECS1030: Add string based constructor
Signed-off-by: Adelin Dobre <adelin.dobre@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:23:28 -07:00
Adelin Dobre
5b97b0a98e BH1749: Add string based constructor
Signed-off-by: Adelin Dobre <adelin.dobre@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:23:20 -07:00
Adelin Dobre
d3ce509334 DS2413: Add string based constructor for Switch
Signed-off-by: Adelin Dobre <adelin.dobre@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:23:11 -07:00
Adelin Dobre
f608b0fa98 DS1808LC: Add string based cons for Controller
Signed-off-by: Adelin Dobre <adelin.dobre@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:23:02 -07:00
Adelin Dobre
6cbfa60729 DS1307: Add string based constructor for Clock
Signed-off-by: Adelin Dobre <adelin.dobre@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:22:54 -07:00
Adelin Dobre
8a2ef9a648 DFRPH: Add string based constructor
Signed-off-by: Adelin Dobre <adelin.dobre@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:22:45 -07:00
Adelin Dobre
1c0ed9c9bd DFRORP: Add string based constructor
Signed-off-by: Adelin Dobre <adelin.dobre@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:22:36 -07:00
Adelin Dobre
fe3dcc01b2 ADXL345: Make some changes in cpp interface
Signed-off-by: Adelin Dobre <adelin.dobre@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:22:27 -07:00
Adelin Dobre
1111a830c9 AD8232: Make some changes in cpp interface
Signed-off-by: Adelin Dobre <adelin.dobre@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:22:18 -07:00
Adelin Dobre
660b34c2ce Remove initio directory from upm/src
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:22:09 -07:00
Adelin Dobre
9869b31a3e Make static allocation for mraaIo variable
Signed-off-by: Adelin Dobre <adelin.dobre@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:22:01 -07:00
Adelin Dobre
90167f6ac1 BNO055 9DOF: Add string based cons for Fusion Hub
Signed-off-by: Adelin Dobre <adelin.dobre@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:21:51 -07:00
Adelin Dobre
03bc2ae26e BMX055/BMI055/BMC150: Add string based cons
Signed-off-by: Adelin Dobre <adelin.dobre@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:21:42 -07:00
Adelin Dobre
a8cd0f72ec Add changes getting values for upm parameters
Signed-off-by: Adelin Dobre <adelin.dobre@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:21:32 -07:00
Adelin Dobre
cb27acbc04 APA102: Add string based constructor for LED Strip
Signed-off-by: Adelin Dobre <adelin.dobre@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:21:23 -07:00
Adelin Dobre
2975bae075 Fix some issues for string based constructors
Signed-off-by: Adelin Dobre <adelin.dobre@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:21:14 -07:00
Adelin Dobre
8f11061de3 CWLSXXA CO2: Add string based constructor
Signed-off-by: Adelin Dobre <adelin.dobre@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:21:06 -07:00
Adelin Dobre
a3bf6d76a9 Collision Sensor: Add string based constructor
Signed-off-by: Adelin Dobre <adelin.dobre@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:20:57 -07:00
Adelin Dobre
582decd4f7 CJQ4435 MOSFET: Add string based constructor
Signed-off-by: Adelin Dobre <adelin.dobre@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:20:48 -07:00
Adelin Dobre
d38339ab9f Button: Add string based constructor
Signed-off-by: Adelin Dobre <adelin.dobre@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:20:39 -07:00
Adelin Dobre
fc0c0fdbaa BMP: Add string based constructor
Signed-off-by: Adelin Dobre <adelin.dobre@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:20:31 -07:00
Adelin Dobre
b675b89e1b BME280: Add string based constructor
Signed-off-by: Adelin Dobre <adelin.dobre@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:20:22 -07:00
Adelin Dobre
ebe84f96b2 BMP280: Add string based constructor for Pressure Sensor
Signed-off-by: Adelin Dobre <adelin.dobre@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:20:12 -07:00
Adelin Dobre
c5287adf36 BMM150: Add string based constructor for Magnetometer
Signed-off-by: Adelin Dobre <adelin.dobre@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:20:04 -07:00
Adelin Dobre
9f545f10af BMG160: Add string based cons for 3-axis Gyroscope
Signed-off-by: Adelin Dobre <adelin.dobre@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:19:55 -07:00
Adelin Dobre
40f6bd9c6c BMA250E: Add string based constructor
Signed-off-by: Adelin Dobre <adelin.dobre@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:19:46 -07:00
Adelin Dobre
71cb3606ee BM220: Add string parser for upm parameters
Signed-off-by: Adelin Dobre <adelin.dobre@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:19:37 -07:00
Adelin Dobre
6103516884 BISS0001: Add string based constructor
Signed-off-by: Adelin Dobre <adelin.dobre@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:19:29 -07:00
Adelin Dobre
55f749529f BMA220: Add string based cons for Accelerometer
Signed-off-by: Adelin Dobre <adelin.dobre@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:19:20 -07:00
Adelin Dobre
742150feea BH1750: Add string based constructor
Signed-off-by: Adelin Dobre <adelin.dobre@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:19:11 -07:00
Adelin Dobre
87dc660bd6 ADXRS610Gyroscope: Add string based constructor
Signed-off-by: Adelin Dobre <adelin.dobre@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:19:02 -07:00
Adelin Dobre
48ecaeaea9 ADXL345: Add string based constructor
Signed-off-by: Adelin Dobre <adelin.dobre@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:18:53 -07:00
Adelin Dobre
56f4dd9a92 AT42QT1070: Add string based constructor for QTouch
Signed-off-by: Adelin Dobre <adelin.dobre@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:18:45 -07:00
Adelin Dobre
93196d62cb APDS9930: Add string based constructor for Digital Proximity and Ambient Light Sensor
Signed-off-by: Adelin Dobre <adelin.dobre@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:18:36 -07:00
Adelin Dobre
cca6a86268 APDS-9002: Add string based constructor for Luminance Sensor
Signed-off-by: Adelin Dobre <adelin.dobre@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:18:28 -07:00
Adelin Dobre
4faf4ee816 AM2315: Add string based constructor for Temperature & Humidity Sensor
Signed-off-by: Adelin Dobre <adelin.dobre@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:18:20 -07:00
Adelin Dobre
d00dc3e332 ADXL335: Add string based constructor for Accelerometer
Signed-off-by: Adelin Dobre <adelin.dobre@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:18:11 -07:00
Adelin Dobre
50961c6020 ADS1X15: Add string based constructor
Signed-off-by: Adelin Dobre <adelin.dobre@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:18:02 -07:00
Adelin Dobre
82edcec766 AD8232: Fix some issues in sensor constructor
Signed-off-by: Adelin Dobre <adelin.dobre1994@gmail.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:17:53 -07:00
Adelin Dobre
db3b99a792 ADIS16448: Add string based constructor for Accelerometer
Signed-off-by: Adelin Dobre <adelin.dobre1994@gmail.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:17:44 -07:00
Adelin Dobre
aa87b14126 ADC121C021: Add string based constructor
Signed-off-by: Adelin Dobre <adelin.dobre1994@gmail.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:17:36 -07:00
Adelin Dobre
550e48e806 LDT0-028: Add string based constructor for Piezo Vibration Sensor
Signed-off-by: Adelin Dobre <adelin.dobre1994@gmail.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:17:28 -07:00
Adelin Dobre
d7fe4e717b Fix some inconsistences for the following sensors:
- a110x
 - abp
 - ad8232
 - adafruitms1438
 - adafruitss

Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:17:18 -07:00
Adelin Dobre
7352aab3b0 Adafruit ServoShield: Add string based constructor
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:17:09 -07:00
Adelin Dobre
7b5b02d859 Adafruitms1438: Add string based constructor
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:16:58 -07:00
Adelin Dobre
9db28cd4fc PCA9685: Add string based constructor for PWM Controller
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:16:48 -07:00
Adelin Dobre
dfdc362c2c AD8232: Add string based constructor for Heart Rate Monitor
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:16:37 -07:00
Adelin Dobre
d23183897d ABP: Add string based constructor for Pressure Sensor
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:16:27 -07:00
Adelin Dobre
9ba309bc48 A110X: Add string based contsructor
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:16:16 -07:00
mihais
32b73a1d25 Add string based constructor for Buzzer and an example to initialize it
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:16:06 -07:00
mihais
58ee51c767 Add string based constructors for UPM sensors
Signed-off-by: Mihai Stefanescu <mihai.stefanescu@rinftech.com>
Signed-off-by: Stefan Andritoiu <stefan.andritoiu@gmail.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:15:56 -07:00
Serban Waltter
e4f106a0c7 Added iGas interface
Signed-off-by: Serban Waltter <serban.waltter@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:15:45 -07:00
Serban Waltter
f28a6d2561 Added iMagnetometer interface
Signed-off-by: Serban Waltter <serban.waltter@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:15:35 -07:00
Serban Waltter
aa966946d5 Added iGyroscope interface
Signed-off-by: Serban Waltter <serban.waltter@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:15:24 -07:00
Serban Waltter
34bb12933d Removed old interfaces and replaced them with the new ones.
Signed-off-by: Serban Waltter <serban.waltter@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:15:13 -07:00
Serban Waltter
b6e53f7da8 Added bindings for iAcceleration sensors
Signed-off-by: Serban Waltter <serban.waltter@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:15:01 -07:00
Serban Waltter
f992876461 Initial implementation of iAcceleration
Signed-off-by: Serban Waltter <serban.waltter@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:14:52 -07:00
Serban Waltter
90524273ec Updated interfaces and sensors
Signed-off-by: Serban Waltter <serban.waltter@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:14:43 -07:00
Serban Waltter
bfdd2c37c0 Update interface documentation
Signed-off-by: Serban Waltter <serban.waltter@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:14:34 -07:00
Serban Waltter
57c0c8c235 Removed commented code
Ran clang-format on modified files

Signed-off-by: Serban Waltter <serban.waltter@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:14:26 -07:00
Serban Waltter
664c6dd8c6 Added bindings for iElectromagnet interface.
Signed-off-by: Serban Waltter <serban.waltter@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:14:17 -07:00
Serban Waltter
1f1510f38d Added getVolts() to iEMG interface and its sensors.
Signed-off-by: Serban Waltter <serban.waltter@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:14:08 -07:00
Serban Waltter
c642e02a18 Added documentation to interfaces
Signed-off-by: Serban Waltter <serban.waltter@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:13:59 -07:00
Serban Waltter
864e1eb073 Modified all iDistance sensors to return float.
Signed-off-by: Serban Waltter <serban.waltter@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:13:50 -07:00
Serban Waltter
ddcc4f467e Removed using namespaces from interface examples
Signed-off-by: Serban Waltter <serban.waltter@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:13:41 -07:00
Serban Waltter
c16b33ae31 Updated Java CMake and examples to comply with the new interfaces.
Signed-off-by: Serban Waltter <serban.waltter@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:13:32 -07:00
Serban Waltter
9669f226b9 Updated CMake interface examples.
Signed-off-by: Serban Waltter <serban.waltter@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:13:23 -07:00
Serban Waltter
2abfd3f1ba Updated rule for ABP sensor.
Signed-off-by: Serban Waltter <serban.waltter@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:13:14 -07:00
Serban Waltter
2f0ae1cc49 Added bindings for iMotion and iPressure sensors.
Signed-off-by: Serban Waltter <serban.waltter@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:13:06 -07:00
Serban Waltter
079e444fce Added bindings for iMoisture sensors.
Signed-off-by: Serban Waltter <serban.waltter@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:12:57 -07:00
Serban Waltter
2405f933de Added bindings for iLight sensors.
Removed old interfaces C++ examples.

Signed-off-by: Serban Waltter <serban.waltter@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:12:49 -07:00
Serban Waltter
c3d5d951e1 dded bindings for iHumidity sensors.
Signed-off-by: Serban Waltter <serban.waltter@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:12:40 -07:00
Serban Waltter
bbcee52880 Added bindings for iHeartRate sensors.
Signed-off-by: Serban Waltter <serban.waltter@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:12:31 -07:00
Serban Waltter
87fc11adbe Added bindings for iHallEffect sensors.
Signed-off-by: Serban Waltter <serban.waltter@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:12:22 -07:00
Serban Waltter
4addac7e01 Added bindings for iDistanceInterrupter sensors.
Signed-off-by: Serban Waltter <serban.waltter@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:12:13 -07:00
Serban Waltter
57f03b79aa Added bindings for iDistance sensors.
Signed-off-by: Serban Waltter <serban.waltter@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:12:04 -07:00
Serban Waltter
52b3087de9 Added new interfaces bindings
Signed-off-by: Serban Waltter <serban.waltter@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:11:55 -07:00
Serban Waltter
efd36e57b0 Added modifications to cmake to create a separate lib for the new interfaces using SWIG.
Signed-off-by: Serban Waltter <serban.waltter@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:11:47 -07:00
Serban Waltter
8312e1d18f Added interface installing to cmake.
You can use it by setting IFACE_HDR with the names of the required interfaces or set module_iface in the sensor's CMakeLists.txt file.
Example files: src/abp/CMakeLists.txt src/lm35/CMakeLists.txt

Signed-off-by: Serban Waltter <serban.waltter@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:11:38 -07:00
Stefan Andritoiu
b917f0ca54 Added iElectromagnet interface
Signed-off-by: Stefan Andritoiu <stefan.andritoiu@gmail.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:11:29 -07:00
Stefan Andritoiu
b058d341c0 Added iGps interface
Signed-off-by: Stefan Andritoiu <stefan.andritoiu@gmail.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:11:20 -07:00
Stefan Andritoiu
1949916a8e Added iWater interface
Signed-off-by: Stefan Andritoiu <stefan.andritoiu@gmail.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:11:12 -07:00
Stefan Andritoiu
f5f2920c70 Added iVDiv interface
Signed-off-by: Stefan Andritoiu <stefan.andritoiu@gmail.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:11:03 -07:00
Stefan Andritoiu
fd34b9669d Added interface iButton
Signed-off-by: Stefan Andritoiu <stefan.andritoiu@gmail.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:10:54 -07:00
Stefan Andritoiu
8693a72ed6 Added interface iRotaryAngle
Signed-off-by: Stefan Andritoiu <stefan.andritoiu@gmail.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:10:46 -07:00
Stefan Andritoiu
75c7bd8d12 Added iProximity interface
Signed-off-by: Stefan Andritoiu <stefan.andritoiu@gmail.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:10:37 -07:00
Stefan Andritoiu
6d8e6d8a9f Added interface iPH
Signed-off-by: Stefan Andritoiu <stefan.andritoiu@gmail.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:10:29 -07:00
Stefan Andritoiu
2b36d30243 Added iOrp interface
Signed-off-by: Stefan Andritoiu <stefan.andritoiu@gmail.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:10:20 -07:00
Stefan Andritoiu
a589f92cec Added interfaces iEC,iEmg,iClock,iHeartRate,iLineFinder
Signed-off-by: Stefan Andritoiu <stefan.andritoiu@gmail.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:10:11 -07:00
Mihai Stefanescu
f035470822 Added initial interfaces and some sensors implementing them
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-04-04 22:10:03 -07:00
Mihai Tudor Panu
6bf21a23e7 kx122: fixed description string in sensor JSON
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2018-10-18 15:43:21 -07:00
Mihai Tudor Panu
16e72d2ff7 upm: version 1.7.1
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2018-10-11 21:47:41 -07:00
Mihai Tudor Panu
94be00a63d java-examples: fix reported minor vulnerabilities
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2018-10-11 20:06:13 -07:00
Mihai Tudor Panu
d5cb613ad0 sonar: ignore infinite loops in Java examples
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2018-10-11 15:33:59 -07:00
Mihai Tudor Panu
c0c37028e4 tests: use print function instead of statement
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2018-10-11 15:14:55 -07:00
Mihai Tudor Panu
eb8d64f52b bh17xx: use snprintf over sprintf
Fixes potential unsafe usage of sprintf

Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2018-10-11 14:53:48 -07:00
Peter Robinson
1ddf969020 kxtj3: initialise all variables used in kxtj3 to 0
Newer compilers when used with security hardening options such as
-Werror=maybe-uninitialized so iniitial the variables to 0.

Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2018-10-11 12:20:06 -07:00
Manivannan Sadhasivam
85608a9f61 led: Update LED init API
mraa_led_init API expects led number. So, replace it with
mraa_led_init_raw for initializing an LED based on label.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2018-09-28 22:45:57 -07:00
Mihai Tudor Panu
4927311a0c upm: bump minimum MRAA required to 2.0
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2018-09-28 15:38:22 -07:00
Peter Robinson
b50b93272d Add initial details of Fedora packages
Fedora now ships upm 1.7.0 for Fedora 28 and later so include these
details to enable easier consumption by Fedora mraa/upm.

Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2018-09-28 14:58:16 -07:00
Peter Robinson
ed4fe56ef8 Use IdleNotificationDeadline as deprecated IdleNotification has been removed
In v8 API 6.5 the long deprecated IdleNotification has been removed so we
need to use IdleNotificationDeadline as nodejs 10.x uses newer v8.

Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-09-09 11:26:28 -07:00
Mihai Tudor Panu
67b77b78aa upm: version 1.7.0
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2018-09-06 08:00:22 -07:00
Mihai Tudor Panu
bc01f710ea docs: remove images and references to obsolete IDEs
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2018-09-06 07:55:48 -07:00
Mihai Tudor Panu
1af38e060e images: update Sparkfun license for images to CC BY 2.0
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2018-09-06 07:46:33 -07:00
Mihai Tudor Panu
62f84dcc47 mmap-gpio: remove deprecated mmapped gpio function calls
The memory mapped GPIO function calls have been deprecated and in turn removed from the UPM libraries. MRAA now provides the best/fastest GPIO access possible based on the selected platform/pin automatically.

Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2018-09-04 07:53:16 -07:00
Sumit Garg
6ae7e9125b examples: gcc8 fixes for -Werror=format-truncation
Fixes below issues:
tm1637.cxx:69:29: error: "%2d%02d" directive output may be truncated writing between 5 and 15 bytes into a destination of size 5 [-Werror=format-truncation=]
          snprintf(myTime, 5, "%2d%02d", (hour + timezone + 24) % 24, min);

jhd1313m1.c:65:49: error: '%d' directive output may be truncated writing between 1 and 10 bytes into a region of size 8 [-Werror=format-truncation=]
          snprintf(str, sizeof(str), "Hello World %d", ndx);

Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2018-09-04 07:27:53 -07:00
Mihai Tudor Panu
07a9af07fe upm-c: remove uint8_t limit from pin/bus variables in structs
This removes unnecessary uint8 types from C driver structs that prevented some sensors from being initialized when connected to a MRAA subplatform.

Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2018-09-04 06:32:12 -07:00
Mihai Tudor Panu
89e2ec870a bh17xx: minor documentation and formatting updates, added rohm to vendor groups
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2018-08-10 10:24:50 -07:00
Assam Boudjelthia
4935a16530 BH1749: Add library blocks to headers, JSON format, and change SWIG JAVA vector type
- Add library blocks to header files
- Removed unneccessay new lines in JSON file
- Change SWIG Java floatVector to uint16Vector

Signed-off-by: Assam Boudjelthia <assam.boudjelthia@fi.rohmeurope.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2018-08-09 12:03:40 -07:00
Assam Boudjelthia
9ef90ccb81 bh1749: Add examples for all languages
* Examples for C/C++/Python/Java/JavaScript
* Add Java example to CMakeLists

Signed-off-by: Assam Boudjelthia <assam.boudjelthia@fi.rohmeurope.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2018-08-09 12:03:35 -07:00
Assam Boudjelthia
5f2557b159 bh1749: C/C++ driver implementation for BH1749 color sensor
* Main C implementation
* C++ wrapper on C implementation

Signed-off-by: Assam Boudjelthia <assam.boudjelthia@fi.rohmeurope.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2018-08-09 12:03:29 -07:00
Assam Boudjelthia
09208e90d0 BH1792: Add examples for all languages
- Examples for C/C++/Python/Java/JavaScript
- Add build line for java BH1792_Example

Signed-off-by: Assam Boudjelthia <assam.boudjelthia@fi.rohmeurope.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2018-08-09 12:03:24 -07:00
Assam Boudjelthia
e0105cb601 BH1792: C/C++ driver for ROHM heart rate sensor
- Base C implementation, with all features and measurement modes (interrupts uses ISR)
- C++ wrapper around C implementation

Signed-off-by: Assam Boudjelthia <assam.boudjelthia@fi.rohmeurope.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2018-08-09 12:03:19 -07:00
Noel Eck
c2ce3e8222 gtest: Bump up to 3ms min-delay for CI
Much less stringent unit test for min timing delay.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-07-31 15:46:21 -07:00
Noel Eck
db3c73cbd1 utilities: Update time/r methods for LINUX
Default to MONOTONIC clock for timer methods to avoid falling victim to
clock corrections.  Changed signatures from accepting pointers since
this is not needed an complicates calls and Java/JS/Python bindings.

    * Switched from nanosleep to clock_nanosleep to allow developers to
      provide a clock for LINUX
    * Default upm_clock_init to CLOCK_MONOTONIC
    * Updated logic to calculating delay and elapsed to be more readable
    * Added ns flavors for completeness
    * Refactored all upm_* delay/timer methods
    * Added #else for preprocessor cases w/o an #else
    * Added test for AQI
    * Added test fixture with logic to identify a minimum delay time
      which is used as a metric for testing all delay methods
    * Much more lenient unit testing of delays to minimize false CI
      failures

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-07-31 14:20:30 -07:00
Noel Eck
be46240b8c gtest: Qualify nmea_gps test with nmea_gps target
Change the unit test CMakeLists to only build the nmea_gps unit test if
the nmea_gps target exists.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-07-30 10:05:07 -07:00
Noel Eck
ef81a20140 gtest: Added headers to unit tests
Added missing headers for the C++ unit tests.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-07-18 13:51:01 -07:00
Khem Raj
8a617aa904 upm: musl and gcc8 fixes
gcc8 detects that strncpy is overwiritng the null terminating character
the source strings are already initialized to 0 so memcpy would do the same
job

Fixes
rn2903.c:153:5: error: 'strncpy' output may be truncated copying 16 bytes from a string of length 511 [-Werror=stringop-truncation]
     strncpy(dev->hardware_eui, dev->resp_data, RN2903_MAX_HEX_EUI64);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

include sys/types.h for uint definition

uint is defined in sys/types.h, therefore this
header needs to be included, it gets exposed with
musl where this header is not getting included indirectly
as it is happening when building on glibc

Fixes build errors on musl e.g.
upm/src/kx122/kx122.hpp:456:31: error: 'uint' has not been declared
|        void setBufferThreshold(uint samples);
|                                ^~~~

Signed-off-by: Khem Raj <raj.khem@gmail.com>
2018-07-13 13:36:39 -07:00
Noel Eck
a16d279b6f bma220: Added std_vector to SWIG interface file
Updated the bma220 SWIG interface file to use std_vector.i for JS and
Python.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-07-02 15:14:47 -07:00
Noel Eck
3e84b74bdf kxtj3: A few last-minute changes to the kxtj3 src
* Removed trailing whitespace
    * Fixed a few spelling errors
    * Switched to upm_delay_us for C source

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-06-21 10:33:38 -07:00
Assam Boudjelthia
186bbfab76 kxtj3: Add java/python/javascript examples
* Java/Python/Javascript examples
* change usleep to upm_delay_us in C++ example
* Add Java example to CMakeLists

Signed-off-by: Assam Boudjelthia <assam.boudjelthia@fi.rohmeurope.com>
Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-06-21 10:04:36 -07:00
Assam Boudjelthia
01cc3a0734 kxtj3: fixed requested issues
* Virtual destructor
* Add header guards
* Constructor default values
* Remove methods with pointer parameters in C++ code

Signed-off-by: Assam Boudjelthia <assam.boudjelthia@fi.rohmeurope.com>
Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-06-21 10:04:24 -07:00
Assam Boudjelthia
09e536b4ff kxtj3: C/C++ driver implementation with examples
Kionix tri-axis accelerometer sensor driver
* C implementation
* C++ wrapper
* C/C++ examples

Signed-off-by: Assam Boudjelthia <assam.boudjelthia@fi.rohmeurope.com>
Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-06-21 09:59:37 -07:00
Noel Eck
dc45cd7859 kx122: Adding missing header guards
Added pragma once to both headers.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-06-14 14:17:47 -07:00
Noel Eck
3790c0bbc1 rsc.py: Added snippet to test rsc_regs.h types
Since UPM Travis-CI runs ctests (one of which loads python examples),
the added lines would fail if the RSC_DATA_RATE and RSC_MODE have not
been included in the python rsc module.)

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-06-08 14:14:47 -07:00
Noel Eck
7a2332fa7d nrf8001: Updated to the mixed module init method
A few small changes to the nrf8001 which exposes a bit more via SWIG.
Also removed a method which had no implementation.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-06-08 14:14:47 -07:00
Noel Eck
330c94f1e2 CMake: Expose *_regs.h to SWIG wrappers
Some of the UPM libraries have a common C header with types used in both
the C and C++ source.  This commit adds these common header files to the
SWIG modules.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-06-08 14:14:47 -07:00
Noel Eck
9a959b578c nmea_gps: Added str method for coordinate struct
Provide a method to print out a coordinate structure which can be
dropped into online mapping pages.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-06-01 10:20:00 -07:00
Noel Eck
cdfb68c381 nmea_gps: Handle different GGA structure
Testing against ublox - handle null age of differential GPS.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-06-01 09:59:55 -07:00
Noel Eck
6228498147 nmea_gps: Added parsing TXT and bw calculations
Added code to parse GPTXT nmea sentences.  Added methods to calculate
sentences/second and raw bytes/second.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-05-25 15:51:13 -07:00
Noel Eck
8b4e1020f4 nmea_gps: Fix iterator
Small fixes for new nmea_gps code.  Fixed an iterator which could get
dereferenced incorrectly, and changed an auto to an explicit type.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-05-23 20:52:57 -07:00
Noel Eck
3a077df5f6 nmea_gps: Update to handle parsing into structures
NMEA GPS class now uses threads to handle parsing NMEA sentences.
Currently only handles GGA, GSV, and GLL types.  Added queues for
holding parsed data.

    * Parsing thread
    * Parse GPS Fix from GGA and GLL
    * Parse satellite info from GSV
    * Provide a queue for GPS fix data as well as raw sentences
      (for debugging)
    * Target structures and NMEAGPS class have a __str__() method
      which summarizes the objects into a std::string.  These are
      tied to the __str__ method in python
    * Added google unit test for the above functionality

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-05-23 08:30:22 -07:00
Noel Eck
1b5087105b docker-compose.yaml: Default to empty build type
Allow targets to specify a CMake build type but do not set a default
(removed 'Release').  The CXX flags for Release slow the builds down
significantly on Travis-CI (which can hit the time limit for jobs).

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-05-14 14:30:49 -07:00
Noel Eck
ec9143e976 debug/release: Add minimal debug/release CI builds
This commit enables both a minimal DEBUG and minimal RELEASE build on
Travis-CI.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-05-14 10:08:22 -07:00
Mihai Tudor Panu
37642f3b01 bmx055: fix typo in cmakelists causing bmc150 header not to install
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2018-05-03 11:37:59 -07:00
Noel Eck
17110d41d0 mhz16: Remove post-throw returns + small fixes
Removed the 'return false;' lines after throws since these are not
needed and are generally flagged by static analysis tools.  Also removed
a EOL spaces and added initializers for member variables at declaration
(since more than one constructor exists).

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-04-27 11:34:49 -07:00
g-vidal
dd73c4aa45 mhz16: Adding raw path constructor for UART
This commit adds an additional constructor to the MHZ16 which takes a
path (string reference) to a UART device on the filesystem.

    Example: MHZ16("/dev/ttyS0");

    * Added constructor for device path w/default
    * Removed unused global consts from header

Signed-off-by: g-vidal <gerard.vidal@ens-lyon.fr>
Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-04-27 11:17:47 -07:00
Noel Eck
8f63914d76 docs: Clarification for lib-level 'make-install'
While a 'make install' under a target library directory (build/src/lcd)
will build all dependencies required to make the target, it will NOT
install those dependencies.  This can cause confusion for developers.
Adding a note to the build docs to clarify this case.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-04-17 15:37:12 -07:00
Noel Eck
306872619a examples: Remove double-backslash from install path
This commit removes the double-backslash when installing the examples.

Before:
   .../upm//examples/...

Before:
   .../upm/examples/...

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-04-16 10:42:23 -07:00
Noel Eck
ad15b27cb1 kx122: Fix for uninitialized variable w/release
Fix so a release build doesn't flag reg_val as uninitialized.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-04-06 16:03:08 -07:00
Antoine W. Campagna
b55501e327 kx122: Note return method change in apichanges.md
Updated the API documentation with changes to the kx122.  Removed a few
extra EOL spaces.

Signed-off-by: Antoine W. Campagna <AntoineW@Campagna.org>
Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-04-02 10:38:03 -07:00
Antoine W. Campagna
e99f1d73fd kx122: Return values instead of receiving pointers
For better compatibility with Python

Signed-off-by: Antoine W. Campagna <AntoineW@Campagna.org>
Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-04-02 09:56:27 -07:00
Noel Eck
fc56e56048 SWIGPYTHON: Apply unsigned int to uints for python
To handle uint data types in python bindings, apply unsigned int
globally.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-04-02 09:56:27 -07:00
Noel Eck
757683b2ca Cordova: Renamed cmake Find module for bindings
Renamed find module from FindCordova to FindUpmCordovaGenerator to be
more descriptive with the intent of the find module.  Updated the find
module to use find_package_handle_standard_args so a version can be
specified and handle REQUIRED keyword.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-04-02 09:45:48 -07:00
Noel Eck
b09944f4b8 Cordova: Added cordova job to travis matrix
The UPM Travis-CI will now attempt to build the Cordova bindings for
UPM as a separate target.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-04-02 09:45:24 -07:00
Lin Sun
f45429e1f0 cordova: Add UPM cordova binding via Java packages
The UPM Cordova binding generator creates Cordova plugs for each Java
package when BUILDCORDOVA=ON and BUILDSWIGJAVA=ON.  This requires an NPM
install of the UPM Cordova plugin generator.  Cordova bindings are built
under <build-dir>/cordova.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-04-02 09:42:12 -07:00
Antoine W. Campagna
54c6d294af kx122: Allow faster SPI bus frequency
The hardcoded frequency of 10kHz was much slower than the capacity of the device

Signed-off-by: Antoine W. Campagna <AntoineW@Campagna.org>
Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-03-30 09:58:06 -07:00
Noel Eck
83f541a5db Tsl2561_Example: Removed duplicate Tsl2561_Example
It appears that an additional tsl2561 Java example existed.
Removed the *newer* Tsl2561_Example.java in favor of the original
example.  Updated all corresponding collateral which references the
Tsl2561_Example.java file (CMake and library descriptor file).

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-03-19 10:39:26 -07:00
Noel Eck
090ce2040e ctest: Add module path to sys path
Updated the pythonloader test module to always append the module's path
to the system path.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-03-15 11:10:00 -07:00
Noel Eck
76dd42a47d utilities_tests: Update us range for gtest
Be a bit more lenient with the acceptable range for the microsecond
flavor of upm_delay (+/- 150us instead of +/- 100us).

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-03-13 15:25:24 -07:00
Noel Eck
63c3b4bc69 travis-ci: Added minimal travis job
Added an additional job to the CI matrix which does a minimal UPM
build (only C, C++, and unit tests) which can run and pass/fail quickly.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-03-13 15:08:51 -07:00
Noel Eck
7254d5f75e gtest: Added custom target for all unit tests
Create a target which depends on all unit test executables for ease of
building/running.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-03-13 15:08:15 -07:00
Noel Eck
f907ebcf2e mraa: Temporarily turn off deprecated warnings
MRAA deprecated mraa_gpio_use_mmaped which gets flagged as a warning
in UPM and then fails since -Werror is set.

For now, don't flag deprecations as warnings.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-03-13 14:48:53 -07:00
Alex Tereschenko
334f7365f0 sonar-scan.sh: correct SonarCloud URL
According to SonarCloud's email notification,
they're dropping sonarqube.com in favor of sonarcloud.io.

Signed-off-by: Alex Tereschenko <alext.mkrs@gmail.com>
Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-03-05 11:37:50 -08:00
Noel Eck
41e80d611e json: Added nlohmann's JSON C++ header
Adding JSON header for serializing/deserializing library descriptor JSON
files.

    * Added header
    * Added simple unit test to verify functionality

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-03-02 16:19:04 -08:00
Noel Eck
92b0919f56 gtest: Added Google Test
Added Google Test for unit testing.  Currently NOT required by UPM
CMake.

    * Added a test fixture for the utilities library.
    * Fixed bug in delay methods provided by utilities library.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-03-02 12:03:24 -08:00
Noel Eck
c54d6de054 JAVA: Unified Java Example names
Unified all Java examples to *match* <LIBRARY>[_otherstuf]_Example.java.
Note, a handful of the examples have a pseudo-random string for the
first component (see FlexSensor_Example.java, ideally this would be
Flex_Example.java).

This commit allows for quick development on a single sensor library
since a -DMODULE_LIST=mysensorlib now works with Java examples
(previously Java examples would fail generation when using
MODULE_LIST).

    * Renamed examples
    * Updated class names
    * Updated library descriptor .json files
    * Updated sample mapping file

TODO: Make this work like the C/C++ examples - grab the target library
name from the filename and grab all dependencies from that target
library.  Fix the handful of example names which don't conform.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-02-27 15:28:48 -08:00
Noel Eck
86e8471cad kx122: Disable implicit copy/assignment operators
Don't let a KX122 instance be copied since copies would share the C
device pointer.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-02-27 09:42:09 -08:00
Noel Eck
2c17998ac9 android: Fix for java file check
Skip library build directories which don't have any java files.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-02-26 15:20:31 -08:00
Noel Eck
a43bcfe8d2 kx122: Add Java/Javascript/Python examples
Implemented a swig interface file for the kx122 and added corresponding
swig language examples.  Also added an STL vector flavor for getting
acceleration values from the kx122.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-02-26 14:36:06 -08:00
Noel Eck
1be36ec1df kx122: Small fix-ups for kx122 addition
A few small changes for the kx122 library.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-02-26 10:34:35 -08:00
Samuli Rissanen
e4dd6457bb kx122: Added missing function implementation
Signed-off-by: Samuli Rissanen samuli.rissanen@hotmail.com
Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-02-23 20:21:43 +02:00
Samuli Rissanen
ad36f83857 kx122: Moved definitions, documentation tweaks
Signed-off-by: Samuli Rissanen <samuli.rissanen@hotmail.com>
Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-02-23 13:17:37 +02:00
Samuli Rissanen
2a17fe094e kx122: Added C and C++ examples
Signed-off-by: Samuli Rissanen <samuli.rissanen@hotmail.com>
Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-02-22 13:21:01 +02:00
Samuli Rissanen
8f99289a48 kx122: Added driver files to src
Signed-off-by: Samuli Rissanen <samuli.rissanen@hotmail.com>
Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-02-22 13:04:31 +02:00
Noel Eck
829da899fc docs: Updated doc dependencies for all languages
This commit changes how the UPM doc targets build.  The doc targets no
longer rebuild each time.

    * doc (doxygen) target depends only on C/C++ source
    * jsdoc (yuidoc) depends on doc and a stamp file
    * pydoc (sphinx) depends on the output index.xml from doc
    * pyupm_doxy2swig depends on python2 python extensions

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-02-21 15:08:03 -08:00
Noel Eck
20aa4962f0 SWIG: Moved common SWIG syntax to ${libname}.i
This commit moves common SWIG syntax to a ${libname}.i for sensor
libraries.  Much of the swig content was originally duplicated for
each wrapper language which has lead to inconsistencies between wrappers
over time.  This commit moves all swig syntax to a common file.  Language
specific swig syntax can be added with #ifdef SWIG<LANGUAGE>.

The src/CMakeLists.txt will look first for a language-specific .i file,
then fall back to ${libname}.i.  In this way, it's possible to override
the common ${libname}.i file.  If a fallback .i file does NOT exist,
UPM CMake will generate a simple interface file for all languages.

Example:
    If no src/abp/pyupm_abp.i and no src/abp/abp.i then
    generate ${CMAKE_CURRENT_BINARY_DIR}/abp.i

When src/CMakeLists.txt uses a common ${libname}.i, it adds a -module
<language>upm_${libname} to the swig command line.

In the example below, a -module argument is provided for both Java and
Javascript, while the python module takes all syntax from pyupm_abp.i.

    SWIG FILE              Language       CMake added SWIG args
    ---------------        ----------     ---------------------
    src/abp/abp.i          java           -module javaupm_abp
    src/abp/abp.i          javascript     -module jsupm_abp
    src/abp/pyupm_abp.i    python

This commit removes ~4500 redundant lines for the UPM repository and
helps promote uniformity for the SWIG'ed languages.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-02-21 10:51:44 -08:00
Noel Eck
3d674efb51 CTest: Removed failing JSON lint test
Currently failing since a dependency has been deprecated.  Will enable
once a solution is in place.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-02-20 14:58:05 -08:00
Mihai Tudor Panu
cc7fec9ae0 upm: version 1.6.0
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2018-02-20 07:45:15 -08:00
Mihai Tudor Panu
4a1eb99d6d doxygen: updated library brief description tags
Touched on all library brief descriptions for better integration with ISS and fixed a few typos and connection tags in the process.

Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2018-02-14 11:33:09 -08:00
Mihai Tudor Panu
a12baf379f doxygen: updated descriptions to clean up @con tags for xml generation
This ensures the generated xml paragraphs for the connection field won't have nested children and hence should be readable by the ISS parser properly

Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2018-02-13 11:37:08 -08:00
Noel Eck
38817b72dc pydoc: Fixed mix of python2/3 modules with pydoc
The pydoc target copies python binaries and modules to pyupm.  Since the
find command didn't make a distinction between python2/3 modules, a mix
of each could end up in pyupm.  If sphinx runs under a mismatching
interpreter (mismatching against the python binaries) the build would
fail with load errors

    * Only copy python2 modules (and binaries) to pyupm directory
    * Explicitly run the sphinx tools w/python2
    * Removed doc dependency to each library target (not needed).

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-02-12 16:15:59 -08:00
Noel Eck
fe7bd75c91 C: Fixes for sign compares in C libraries
Added explicit error for sign compares to CMake.  Updated a handful of C
source which compared unsigned vs signed.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-02-07 14:29:35 -08:00
Noel Eck
460fdc2eb5 Travis-ci: Switch from curl to wget for automation
Currently ~2/5 UPM travis-ci jobs are failing with an SSL error from curl
when grabbing the 1.9.0 version of docker-compose.  This commit is a
brute-force attempt to make this go away.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-02-07 14:11:10 -08:00
Mihai Tudor Panu
9d51454290 FindNodejs: extend search path to detect ubuntu provided nodejs
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2018-02-07 10:36:42 -05:00
Noel Eck
6f72c52a44 CMake: Update FindNpm module and usage
FindNpm REQUIRE functionality was not provided by FindNpm.cmake.
UpdatedUpdated FindNpm to extract version, global node_modules
directory, and to fail if REQUIRE was set and npm was not found.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-02-06 14:11:28 -08:00
Noel Eck
7d83e8c569 FindNodejs: Updated to find node<version>
Updates to the FindNodejs.cmake module to find newer installs of nodejs
across other distros.  For example openSUSE: /usr/include/node6/node.h

    * Added PATH_SUFFIX to find_path for node.h.
    * Standardized usage of message() (added STATUS)
    * Call find_package_handle_standard_args with version
    * Reformatted to look uniform.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-02-06 09:35:57 -08:00
Alex Tereschenko
96bcfc9128 lis2ds12: remove surplus accFactor coefficient
As we've established in PR #623 (adding lis3dh support), this coefficient
is not needed and actually is cancelled out in calculations, so remove it.

Signed-off-by: Alex Tereschenko <alext.mkrs@gmail.com>
2018-01-28 11:00:27 +01:00
Noel Eck
6be656d5b0 Java: Added loadLibrary macro for packages
These four libaries were previously blacklisted for building Java
packages.  Updating to include loadLibrary macro.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-01-24 14:55:44 -08:00
Noel Eck
3cfea676e2 lcd: Renamed 'i2clcd' library to 'lcd'
All other upm library directories match their corresponding library
name, the i2clcd was an outlier which caused problems for CMake and
testing.

    * Replaced usage of i2clcd with lcd
    * Renamed source files and examples
    * Updated examples to use correct class
    * Updated documentation where necessary (left changelog sections)

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-01-24 13:00:53 -08:00
Noel Eck
f64060b9d2 pydoc: Removed include for sensor specific _doc.i files
There is a single monolithic .i file which provides documentation for
the python methods.  The per-sensor flow is not used.  Removing for now,
may investigate implementing a per-sensor doc.i file again in the future.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-01-24 11:55:54 -08:00
Noel Eck
36ebd15abc java_blacklist: Enable Java blacklisted modules
Enable building java wrappers for a few that were previously
blacklisted.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-01-24 11:55:54 -08:00
Noel Eck
23a57b8c90 nrf24l01: Initialize member variable
Initialize a member variable pointer to NULL.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-01-24 10:42:05 -08:00
Noel Eck
666452e873 SWIGJAVA: Remove the last JAVA ifdefs from src
Removed all references to #ifdef SWIGJAVA and JAVACALLBACK from the
library source.  All java-specific source code has been moved to the
corresponding library's .i file for java.

    * Update library source
    * Update examples where necessary
    * The function pointer methodology has been remove from libraries
      which provided callbacks as both a class and a function pointer
      implementation.  Examples were updated to use the class version
      of callbacks.
    * Updated documentation for SWIGJAVA

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-01-24 09:31:05 -08:00
Noel Eck
d49ab2ac95 SWIG: Added documentation to _upm.i
Includes documentation on the macros provided as well as a top-level
description of the file.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-01-24 09:31:05 -08:00
Noel Eck
d06e632f3b SWIG: Move from include->import
Do no expose _upm.i in the wrapper code.  Also updated syntax to use a
relative path to _upm.i.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-01-24 09:31:05 -08:00
Serban Waltter
e192a125f3 Added new macros for installISR and applied where possible. 2018-01-24 09:31:05 -08:00
Serban Waltter
63b2b33df7 Moved SWIG code from C++ files (hpp and cxx) to SWIG interface files (.i). Added getter/setter methods for classes with protected or private vars. 2018-01-24 09:31:05 -08:00
Serban Waltter
2551596309 Added the JAVA_JNI_LOADLIBRARY macro for the jniclasscode pragma included in _upm.i for all java SWIG interface files. 2018-01-24 09:31:05 -08:00
Noel Eck
6725559669 JAVA: Remove library source compile from JAVA packages
Previously the JAVA packages re-compile UPM library source files.  This
was a work-around for compiling JAVA-specific functionality from the UPM
source into the SWIG'ed JAVA pacakges.

This commit removes the source from the JAVA SWIG compile and provides
an example on how to add the JAVA-specific code with a swig extend call.

    * Added _upm.i file for %import (not %include)
    * Added macros to _upm.i; 1 which performs the loadLibrary, and one
      which adds the java installISR runnable.
    * Updated the src/CMakeLists.txt file to NOT build library src into
      pacakges.
    * Updated the a110x library with examples on how to use the macros.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-01-24 09:30:23 -08:00
Noel Eck
680649ba6f zfm20: Use mraa::Uart instead of tty
Updated the ZFM20 class to use UART functionality provided through the
mraa::Uart class instead of using the UART directly.

    * Switch to mraa::Uart
    * Added raw uart string constructor, closes #621
    * Updated examples
    * Added a common.i to minimize interface duplication
    * Removed pointers from C++ functions where references are
      preferable
    * Removed dependency on termios
    * Added typedefs to handle pass-by-reference
    * Removed flushes
    * Removed code after throws

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-01-23 15:51:54 -08:00
Noel Eck
74b5ec00dc Java: Added an unresolved symbol check for Java packages
Tell the linker to error on unresolved symbols.  This enables future
Java work (removing library source from Java packages) by flagging
missing reference.s

TODO: Move this up one level to all libraries.  The reason this was not
done in the same commit is that the NodeJs libraries contain unresolved
references which must come from node but remain unresolved in the NodeJs
packages.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-01-22 16:47:42 -08:00
Noel Eck
abefdfc756 CMake: Moved swig macros to functions
Switched these macros to functions so changes at the
upm_swig_<extension> level don't propogate further than necessary.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-01-22 16:47:42 -08:00
Noel Eck
f97a62b055 Threading: Scrubbed usage of threading in libraries
Removed include for pthreads from libraries where it appears NOT to be
used.  Added ${CMAKE_THREAD_LIBS_INIT} to CMakeLists.txt for libraries
which appear to require threading.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-01-22 16:47:42 -08:00
Abhishek Malik
7422ec937c JSON: Fixing Sensor Name field
Signed-off-by: Abhishek Malik <abhishek.malik@intel.com>
2018-01-18 13:26:34 -05:00
Alex Tereschenko
a842898bd5 lis3dh: add sensor support based on lis2ds12 module
Adding STMicro LIS3DH sensor support. This module is based on
the one for lis2ds12 (thanks, jontrulson!), but as sensors are
noticeably different, the contents underwent major rework.

Examples and basic API are left the same.

Tested on Intel Edison with Arduino board using both I2C and SPI.

Signed-off-by: Alex Tereschenko <alext.mkrs@gmail.com>
2018-01-16 20:30:34 -08:00
malikabh
76949d9358 JSON: Correcting the Sensor Class field
Signed-off-by: Abhishek Malik <abhishek.malik@intel.com>
2018-01-16 15:23:33 -05:00
Mihai Tudor Panu
b244fe45d1 led: update to use gpioled if desired, better C code wrapper
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2018-01-12 08:19:44 -08:00
Mihai Tudor Panu
b367a63010 upm: fix pin and bus types to allow subplatform usage in C libs
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2018-01-12 08:15:36 -08:00
Noel Eck
a5680d9b9a Doxygen: Turn off messages
Turn off non-warning/error doxygen messages to clean up the build log.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-01-11 11:53:50 -08:00
malikabh
a6111a83b5 JSON: Correcting bad sensor names
Signed-off-by: malikabh <abhishek.malik@intel.com>
2018-01-10 13:47:57 -05:00
malikabh
450f071f7d JSON: Correcting the Sensor Class tag BMX055
Signed-off-by: malikabh <abhishek.malik@intel.com>
2018-01-10 11:48:18 -05:00
Alex Tereschenko
82c8acf0fe examples/lis2ds12.py: fix comment typo
Signed-off-by: Alex Tereschenko <alext.mkrs@gmail.com>
2018-01-07 19:46:05 +01:00
Alex Tereschenko
a65cd2e59b lis2ds12.{h,hpp}: add missing parameter description
Signed-off-by: Alex Tereschenko <alext.mkrs@gmail.com>
2018-01-04 16:29:06 -08:00
Noel Eck
c154ec6cb8 ad8232: Removed C example (doesn't exist)
Previous commit failed because the C examples doesn't exist.  The
version BEFORE that passes even though the C example filename pointed to
a test for a different sensor library.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2017-12-05 16:31:18 -08:00
Noel Eck
d9d48e939f ad8232: Fixed copy/paste error in json
bmp280.c -> ad8232.c

Also converted to unix line endings.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2017-12-05 16:09:06 -08:00
Noel Eck
b1a49f0d3c rhusb: Memory leak fix in sendCommand
Fix for case where dataAvailable always returns true.  Previously, if
this ever happened (eg mock platform), string resp is resized until the
system is out of memory.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2017-11-27 15:40:03 -08:00
Noel Eck
ac89a4a130 examples: Add install component for all examples
Provide the functionality to install all UPM examples to
DATADIR/upm/examples.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2017-11-16 12:07:00 -08:00
Noel Eck
f848deb35b components: Refactor UPM install components
Removed the per-target install component in favor of a limited set of
insinstall components.

Available install components are: "upm" "upm-dev" "upm-java"
"upm-nodejs" "upm-python2" "upm-python3"

Signed-off-by: Noel Eck <noel.eck@intel.com>
2017-11-16 12:00:42 -08:00
Noel Eck
71b2b9b1fc JSON: Install JSON library descriptor files
Install the provided json files to DATADIR.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2017-11-10 16:17:18 -08:00
Noel Eck
18b8ca2633 examples/python: Add/update shebang line
Added/updated the shebang line on all python examples with:

Also chmod +x a few of the python examples.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2017-11-02 15:39:45 -07:00
Noel Eck
a96c607fb5 pyupm_led: Fixed example for led
This commit fixes issue 614.  Updated the example to use pyupm_led as
the module name (and skip the local module rename).

Signed-off-by: Noel Eck <noel.eck@intel.com>
2017-11-02 14:52:41 -07:00
Noel Eck
bc4f124d54 sensortemplate: Use SensorTemplate as class name in json
Replace TemplateItem with SensorTemplate in the sensortemplate.json and
json ctest.  Change to contributions.md which removes all objects
with a key starting with "//" from the generated sensor .json file.
This allows the json ctest to pass OOTB for new sensor libraries
generated from the make_new_sensor function.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2017-11-02 13:21:27 -07:00
Nicolas Oliver
35e4fc012e travis: build examples in additional jobs
Signed-off-by: Nicolas Oliver <dario.n.oliver@intel.com>
2017-10-19 13:57:41 -07:00
Noel Eck
4037ec517c curieimu.hpp: Add pthread include to lib header
CurieIMU example includes curieimu.hpp, which uses pthread symbols but
does not include pthreads.h, and thus fails building.  The library
builds successfully because the source file includes the pthread
header before including curieimu.hpp.

    * Moved pthread.h include from src to header.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2017-10-12 10:51:09 -07:00
Nicolas Oliver
40084ea651 docs: improve android things docs
* Add documentation on how to build android packages
* Check env vars before running build-android.sh
* Add doc strings to build-android.sh

Signed-off-by: Nicolas Oliver <dario.n.oliver@intel.com>
2017-10-11 14:59:55 -07:00
Nicolas Oliver
91876d48ed travis: use images from inteliotdevkit
Signed-off-by: Nicolas Oliver <dario.n.oliver@intel.com>
2017-10-11 14:46:02 -07:00
3298 changed files with 60360 additions and 60343 deletions

View File

@ -7,16 +7,26 @@ services:
- docker
before_install:
- sudo rm /usr/local/bin/docker-compose
- curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > docker-compose
- chmod +x docker-compose
- sudo mv docker-compose /usr/local/bin
- sudo wget -q https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` -O /usr/local/bin/docker-compose
jobs:
fast_finish: true
allow_failures:
- env: TARGET=ipk
- env: TARGET=android
include:
- &run-with-clang-minimal
stage: Clang 3.8 - minimal with unit tests
env:
- TARGET=minimal
- CMAKE_BUILD_TYPE=Debug
before_script: docker-compose pull ${TARGET}
script:
- export CC=clang-3.8 CXX=clang++-3.8
- docker-compose run ${TARGET}
- <<: *run-with-clang-minimal
env:
- TARGET=minimal
- CMAKE_BUILD_TYPE=Release
- &run-with-clang
stage: Clang 3.8
env: TARGET=python
@ -71,11 +81,11 @@ jobs:
- docker-compose run ${TARGET}
- <<: *run-additional-jobs
env: TARGET=android
- <<: *run-additional-jobs
env: TARGET=cordova
- <<: *run-additional-jobs
env: TARGET=examples
- <<: *run-additional-jobs
env: TARGET=sonar-scan
- <<: *run-additional-jobs
env: TARGET=ipk
- <<: *run-additional-jobs
env: TARGET=rpm
- <<: *run-additional-jobs
env: TARGET=npm

View File

@ -8,9 +8,8 @@ option (BUILDFTI "Build Funtion Table Interface (FTI) in C sensor libraries" OFF
option (BUILDSWIGPYTHON "Build swig python modules" ON)
option (BUILDSWIGNODE "Build swig node modules" ON)
option (BUILDSWIGJAVA "Build swig java modules" OFF)
option (BUILDCORDOVA "Build cordova bindings" OFF)
option (BUILDEXAMPLES "Build C/C++/JAVA examples" OFF)
option (IPK "Generate IPK using CPack" OFF)
option (RPM "Generate RPM using CPack" OFF)
option (NPM "Generate NPM/GYP tarballs" OFF)
option (BUILDTESTS "Generate check-ups for upm" OFF)
option (WERROR "Make all warnings into errors." ON)
@ -90,8 +89,15 @@ endfunction ()
# Compiler flags common to both C and CXX
# Enable -Wall
set (C_CXX_WARNING_FLAGS -Wall
-Wno-strict-aliasing
-Wno-deprecated-declarations # Temp fix for MRAA deprecated methods
)
# GCC-6 added -Wmisleading-indentation to -Wall, skip these for now
set (C_CXX_WARNING_FLAGS -Wall -Wno-misleading-indentation -Wno-strict-aliasing)
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "6")
list (APPEND C_CXX_WARNING_FLAGS -Wno-misleading-indentation)
endif ()
# Warnings as errors?
if (WERROR)
@ -104,6 +110,7 @@ endif (WERROR)
upm_add_compile_flags(C ${C_CXX_WARNING_FLAGS}
-Winit-self
-Wimplicit
-Wsign-compare
-Wmissing-parameter-type)
# Set CXX compiler warning flags at top-level scope and emit a warning about
@ -111,6 +118,7 @@ upm_add_compile_flags(C ${C_CXX_WARNING_FLAGS}
upm_add_compile_flags(CXX ${C_CXX_WARNING_FLAGS}
-Wnon-virtual-dtor
-Woverloaded-virtual
-Wsign-compare
-Wreorder)
# Allow exception error handling for Android C++
@ -123,7 +131,7 @@ find_package (PkgConfig REQUIRED)
# Force a libmraa search and minimum required version every time a config is generated
unset(MRAA_FOUND CACHE)
set(MRAA_MINIMUM 1.8.0)
set(MRAA_MINIMUM 2.0.0)
pkg_check_modules (MRAA REQUIRED mraa>=${MRAA_MINIMUM})
# Also, get full path to the mraa library
find_library(MRAA_LIBRARY NAMES mraa HINTS ${MRAA_LIBDIR})
@ -143,6 +151,11 @@ pkg_check_modules (MODBUS libmodbus>=3.1.2)
# Check for OPENZWAVE
pkg_check_modules (OPENZWAVE libopenzwave)
# Check for TinyB
pkg_check_modules (TINYB tinyb>=0.5.1)
# And get full path to the tinyb library
find_library(TINYB_LIBRARY NAMES tinyb HINTS ${TINYB_LIBDIR})
# Find JPEG
find_package (JPEG)
@ -151,11 +164,6 @@ if (BUILDSWIGNODE)
find_package (Node REQUIRED)
if (BUILDTESTS)
find_package (Npm REQUIRED)
if(NPM_EXECUTABLE)
message(STATUS "NPM Executable found at: ${NPM_EXECUTABLE}")
else()
message(FATAL_ERROR "Please install NPM first, you can't run tests without it")
endif()
endif (BUILDTESTS)
endif (BUILDSWIGNODE)
@ -168,6 +176,17 @@ if (BUILDSWIGJAVA)
find_library(MRAAJAVA_LIBRARY NAMES mraajava HINTS ${MRAA_LIBDIR})
endif (BUILDSWIGJAVA)
# Cordova binding
if (BUILDCORDOVA)
if (NOT BUILDSWIGJAVA)
message(FATAL_ERROR "Cordova bindings require JAVA packages, please enable BUILDSWIGJAVA (-DBUILDSWIGJAVA=on).")
endif()
find_package (Node REQUIRED)
find_package (Npm REQUIRED)
find_package (UpmCordovaGenerator 0.2.1 REQUIRED)
endif (BUILDCORDOVA)
# Find swig if any wrapper is enabled
if (BUILDSWIGPYTHON OR BUILDSWIGNODE OR BUILDSWIGJAVA)
find_package (SWIG 3.0.5 REQUIRED)
@ -216,7 +235,7 @@ include (GetGitRevisionDescription)
git_describe (VERSION "--tags")
# If git_describe fails, use a dirty version
if (${VERSION} MATCHES -NOTFOUND)
set (VERSION "v1.5.0")
set (VERSION "v1.7.1")
message (WARNING "Failed to retrieve UPM version with 'git describe' (using "
"${VERSION}). Check that git is installed and this is a valid git repo.")
endif ()
@ -239,11 +258,6 @@ set (upm_VERSION_MINOR ${VERSION_MINOR})
set (upm_VERSION_PATCH ${VERSION_PATCH})
set (upm_VERSION_STRING ${upm_VERSION_MAJOR}.${upm_VERSION_MINOR}.${upm_VERSION_PATCH})
# Detect arch
include (TargetArch)
target_architecture (DETECTED_ARCH)
message (STATUS "Target arch is ${DETECTED_ARCH}")
# enable c++11 standards support unconditionally
include(CheckCXXCompilerFlag)
if (CMAKE_VERSION VERSION_LESS "3.1")
@ -278,37 +292,36 @@ else()
set (C_EXTENSIONS OFF)
endif()
# The doc target depends on each sensor target
# The doc target depends on the C/C++ source and all libraries
#
# doc
# > src
# > include
# > libupm_sensor0
# > libupm_sensor1
# > libupm_sensor2
# > ...
# > libupm_sensor_n
#
# The pydoc target builds documentation with sphinx via inspection by loading
# each python module. Those modules must include the CXX documentation via
# each python2 module. Those modules must include the CXX documentation via
# a monolithic swig file generated by doxy2swig
#
# pydoc
# > _pyupm_sensor0_python2
# > libupm_sensor0
# > doxy2swig
# > libupm_sensor0
# > doxy2swig
#
# The doxy2swig target is dependent upon the doc target IF BUILDDOC=ON,
# otherwise doxy2swig uses an empty file. Doxy2swig also depends on each
# sensor target
#
# doxy2swig
# > BUILDDOC=ON> doc
# > libupm_sensor0
# > BUILDDOC=ON> doc
#
# The jsdoc target builds js documentation via yuidoc and only requires
# the doc target
#
# jsdoc > doc
#
if (BUILDDOC)
function (CreateDocumentationTargets)
# Add a target to generate API documentation with Doxygen
find_package (Doxygen 1.8 REQUIRED)
if (DOXYGEN_FOUND AND DOXYGEN_VERSION VERSION_GREATER "1.8")
@ -320,12 +333,17 @@ if (BUILDDOC)
foreach(PNG_FILE ${PNG_FILES})
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/docs/${PNG_FILE} ${CMAKE_CURRENT_BINARY_DIR}/html/docs/${PNG_FILE} COPYONLY)
endforeach()
add_custom_target (doc
${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
# Custom command to run doxygen (note depends on ALL UPM C++ targets)
add_custom_command (
OUTPUT ${CMAKE_BINARY_DIR}/xml/index.xml
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile ${UPM_TARGETS_CXX}
COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
COMMAND tar -czf html/xml.tar.gz -C xml .
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating API documentation with Doxygen" VERBATIM
)
COMMENT "Generating C/C++ API documentation with Doxygen"
VERBATIM)
add_custom_target(doc DEPENDS ${CMAKE_BINARY_DIR}/xml/index.xml)
else ()
message (SEND_ERROR "ERROR - Failed to find a compatible version of Doxygen. API doc will not be generated")
endif (DOXYGEN_FOUND AND DOXYGEN_VERSION VERSION_GREATER "1.8")
@ -333,24 +351,47 @@ if (BUILDDOC)
# Check if Sphinx is installed and add target to generate API documentation
# Currently, the per-module documentation for python is generated from the
# python2 modules.
# Since python2 is required for documentation, only copy from python2 paths, this
# ensures that sphinx doesn't run across python2 and python3 binaries. When running
# the sphinx tools, explicitly run from the python2 interpreter (tested with the sphinx
# 1.3.6 python2 and python3 modules).
if(BUILDSWIGPYTHON)
# Generate python module documentation from doxygen collateral
#
# doxygen index.xml -> doxy2swig.py -> pyupm_doxy2swig.i
add_custom_command (
OUTPUT ${CMAKE_BINARY_DIR}/src/pyupm_doxy2swig.i
COMMAND ${PYTHON2_EXECUTABLE} ${CMAKE_SOURCE_DIR}/src/doxy2swig.py
${CMAKE_BINARY_DIR}/xml/index.xml --quiet
${CMAKE_BINARY_DIR}/src/pyupm_doxy2swig.i
COMMENT "Generating pyupm_doxy2swig.i from Doxygen output for use by SWIG"
DEPENDS doc
VERBATIM)
add_custom_target(pyupm_doxy2swig DEPENDS ${CMAKE_BINARY_DIR}/src/pyupm_doxy2swig.i)
foreach (_python2_target ${UPM_TARGETS_PYTHON2})
add_dependencies(${_python2_target} pyupm_doxy2swig)
endforeach()
find_package (Sphinx 1.3 REQUIRED)
if (SPHINX_FOUND AND SPHINX_VERSION VERSION_GREATER "1.3")
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/doxy/conf.py.in ${CMAKE_CURRENT_BINARY_DIR}/pydoc/conf.py @ONLY)
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/doxy/index.rst ${CMAKE_CURRENT_BINARY_DIR}/pydoc/index.rst COPYONLY)
add_custom_target (pydoc ALL
add_custom_command (
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/pydoc.stamp
COMMAND rm -r -f ${CMAKE_BINARY_DIR}/pyupm && mkdir -p ${CMAKE_BINARY_DIR}/pyupm
COMMAND find ${CMAKE_BINARY_DIR}/src -name "_pyupm_*.so" -exec cp {} ${CMAKE_BINARY_DIR}/pyupm \;
COMMAND find ${CMAKE_BINARY_DIR}/src -name "pyupm_*.py" -exec cp {} ${CMAKE_BINARY_DIR}/pyupm \;
COMMAND ${SPHINX_API_EXECUTABLE} -f -o pydoc ${CMAKE_BINARY_DIR}/pyupm
COMMAND find ${CMAKE_BINARY_DIR}/src -path "*python${MIN_VER_PYTHON2}/_pyupm_*.so" -exec cp {} ${CMAKE_BINARY_DIR}/pyupm \;
COMMAND find ${CMAKE_BINARY_DIR}/src -path "*python${MIN_VER_PYTHON2}/pyupm_*.py" -exec cp {} ${CMAKE_BINARY_DIR}/pyupm \;
COMMAND ${PYTHON2_EXECUTABLE} ${SPHINX_API_EXECUTABLE} -f -o pydoc ${CMAKE_BINARY_DIR}/pyupm
# TODO: use a separate cmake FILE module for string replacement instead
COMMAND ${SPHINX_EXECUTABLE} -b html pydoc html/python
COMMAND ${PYTHON2_EXECUTABLE} ${SPHINX_EXECUTABLE} -b html pydoc html/python
COMMAND sed -i.bak s|\">pyupm_|\">|g html/python/index.html html/python/modules.html
COMMAND sed -i.bak s|[[:space:]][mM]odule</a>|</a>|g html/python/index.html html/python/modules.html
DEPENDS doc
COMMAND cmake -E touch ${CMAKE_CURRENT_BINARY_DIR}/pydoc.stamp
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating API documentation with Sphinx" VERBATIM
)
COMMENT "Generating Python API documentation with Sphinx"
DEPENDS doc ${UPM_TARGETS_PYTHON2}
VERBATIM)
add_custom_target(pydoc DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/pydoc.stamp)
else ()
message (SEND_ERROR "ERROR - Failed to find a compatible version of Sphinx. Python API doc will not be generated")
endif ()
@ -360,81 +401,22 @@ if (BUILDDOC)
if(BUILDSWIGNODE)
find_package (Yuidoc 0.10 REQUIRED)
if (YUIDOC_FOUND AND YUIDOC_VERSION VERSION_GREATER "0.10")
add_custom_target (jsdoc ALL
add_custom_command (
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/jsdoc/jsdoc.stamp
COMMAND ${CMAKE_SOURCE_DIR}/doxy/doxygen2jsdoc/docgen.js -m upm -i xml -o jsdoc -t ${CMAKE_CURRENT_SOURCE_DIR}/src -g ../../
COMMAND ${YUIDOC_EXECUTABLE} -C --no-sort --helpers ${CMAKE_SOURCE_DIR}/doxy/node/generators/yuidoc/helper.js --themedir ${CMAKE_SOURCE_DIR}/doxy/node/generators/yuidoc/tmpl -o html/node jsdoc/yuidoc/upm
COMMAND ${CMAKE_SOURCE_DIR}/doxy/doxygen2jsdoc/tolower.js -i html/node
DEPENDS doc
COMMAND cmake -E touch ${CMAKE_CURRENT_BINARY_DIR}/jsdoc/jsdoc.stamp
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating API documentation with Yuidoc" VERBATIM
)
COMMENT "Generating Javascript API documentation with Yuidoc"
DEPENDS doc
VERBATIM)
add_custom_target(jsdoc DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/jsdoc/jsdoc.stamp)
else ()
message (SEND_ERROR "ERROR - Failed to find a compatible version of Yuidoc. Node.js API doc will not be generated")
endif ()
endif(BUILDSWIGNODE)
endif (BUILDDOC)
if (IPK)
# Get target package arch from Yocto ADT sysroot if set or host OS, mapping to Ubuntu name if necessary
if (DEFINED ENV{OECORE_TARGET_SYSROOT})
GET_FILENAME_COMPONENT (DETECTED_SYSROOT $ENV{OECORE_TARGET_SYSROOT} NAME)
string (REGEX REPLACE "-poky-linux" "" TARGET_ARCH "${DETECTED_SYSROOT}")
else ()
# Debian uses amd64 to denote x86_64
if (DETECTED_ARCH STREQUAL "x86_64")
set (TARGET_ARCH "amd64")
else ()
set (TARGET_ARCH ${DETECTED_ARCH})
endif ()
endif ()
message (STATUS "Package arch is ${TARGET_ARCH}")
set(CPACK_GENERATOR "DEB")
set(OPKG_ARCH ${TARGET_ARCH})
set(CPACK_BINARY_DIR ${CMAKE_BINARY_DIR})
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Intel IoT-Devkit") #required
set(upm_PACKAGE_ON_TAG ".")
if ("${VERSION_COMMIT}" STREQUAL "")
set(upm_PACKAGE_ON_TAG "")
endif()
set(CPACK_PACKAGE_VERSION
"${upm_VERSION_MAJOR}.${upm_VERSION_MINOR}.${upm_VERSION_PATCH}${upm_PACKAGE_ON_TAG}${VERSION_COMMIT}")
set(CPACK_PACKAGE_NAME "upm")
set(CPACK_DEBIAN_PACKAGE_SECTION "libs")
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE ${TARGET_ARCH})
set(CPACK_SYSTEM_NAME ${TARGET_ARCH})
set(CPACK_DEBIAN_PACKAGE_DEPENDS "mraa (>= ${MRAA_VERSION})")
set(CPACK_DEBIAN_PACKAGE_PROVIDES "upm-dev, upm-dbg, upm-doc")
set(CPACK_DEBIAN_PACKAGE_REPLACES ${CPACK_DEBIAN_PACKAGE_PROVIDES})
set(CPACK_DEBIAN_PACKAGE_CONFLICTS ${CPACK_DEBIAN_PACKAGE_PROVIDES})
set(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}")
include (CPack)
endif()
if (RPM)
message (STATUS "RPM packaging enabled for ${DETECTED_ARCH}")
set(CPACK_GENERATOR "RPM")
set(CPACK_PACKAGE_NAME "upm")
set(upm_PACKAGE_ON_TAG ".")
if ("${VERSION_COMMIT}" STREQUAL "")
set(upm_PACKAGE_ON_TAG "")
endif()
set(CPACK_PACKAGE_VERSION
"${upm_VERSION_MAJOR}.${upm_VERSION_MINOR}.${upm_VERSION_PATCH}${upm_PACKAGE_ON_TAG}${VERSION_COMMIT}")
set(CPACK_PACKAGE_CONTACT "Intel IoT-Devkit")
set(CPACK_PACKAGE_VENDOR "Intel IoT-Devkit")
set(CPACK_RPM_PACKAGE_REQUIRES "mraa >= ${MRAA_VERSION}")
set(CPACK_RPM_PACKAGE_PROVIDES "${CPACK_PACKAGE_NAME}-devel")
set(CPACK_RPM_PACKAGE_LICENSE "MIT")
EXECUTE_PROCESS(COMMAND rpm --showrc
COMMAND grep -E "dist[[:space:]]*\\."
COMMAND sed -e "s/^.*dist\\s*\\.//"
COMMAND tr \\n \\t
COMMAND sed -e s/\\t//
OUTPUT_VARIABLE DIST_TAG)
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}.${DIST_TAG}.${DETECTED_ARCH}")
include(CPack)
endif()
endfunction()
# UPM common headers
set (UPM_COMMON_HEADER_DIRS ${CMAKE_HOME_DIRECTORY}/include)
@ -454,6 +436,12 @@ if (BUILDTESTS)
add_subdirectory (tests)
endif()
# Setup documentation AFTER all source targets have been added
if (BUILDDOC)
CreateDocumentationTargets()
endif()
# Install C headers
install(DIRECTORY include/ DESTINATION include/upm
FILES_MATCHING PATTERN "*.h")
COMPONENT ${CMAKE_PROJECT_NAME}-dev
FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp")

44
CONTRIBUTING Normal file
View File

@ -0,0 +1,44 @@
# Contributing to Eclipse UPM
Thanks for your interest in this project.
## Project description
The Eclipse 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 Eclipse MRAA APIs.
* https://projects.eclipse.org/projects/iot.upm
## Developer resources
Information regarding source code management, builds, coding standards, and
more.
* https://projects.eclipse.org/projects/iot.upm/developer
The project maintains the following source code repositories
## Eclipse Contributor Agreement
Before your contribution can be accepted by the project team contributors must
electronically sign the Eclipse Contributor Agreement (ECA).
* http://www.eclipse.org/legal/ECA.php
Commits that are provided by non-committers must have a Signed-off-by field in
the footer indicating that the author is aware of the terms by which the
contribution has been provided to the project. The non-committer must
additionally have an Eclipse Foundation account and must have a signed Eclipse
Contributor Agreement (ECA) on file.
For more information, please see the Eclipse Committer Handbook:
https://www.eclipse.org/projects/handbook/#resources-commit
## Contact
Contact the project developers via the project's "dev" list.
*

View File

@ -1,5 +1,5 @@
The MIT License (MIT)
Copyright © 2014-2016 Intel Corporation
Copyright © 2014-2019 Intel Corporation and others
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the

View File

@ -1,34 +1,36 @@
<p align="center">
<img src="https://github.com/intel-iot-devkit/upm/blob/master/docs/icons/upm_logo.png" height="150px" width="auto" algt="UPM Logo"/>
<img src="https://github.com/eclipse/upm/blob/master/docs/icons/upm_logo.png" height="150px" width="auto" algt="UPM Logo"/>
</p>
UPM (Useful Packages & Modules) Sensor/Actuator repository for MRAA
Eclipse UPM Sensor and Actuator Repository
==============
The UPM repository provides software drivers for a wide variety of commonly
used sensors and actuators. These software drivers interact with the
The Eclipse 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.
sensors, through calls to [Eclipse MRAA](https://github.com/eclipse/mraa) APIs.
Programmers can access the interfaces for each sensor by including the sensors
Programmers can access the interfaces for each sensor by including the sensor's
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.
As of UPM 2.0, sensor initialization can also be done, in most cases, via
overloaded constructors that accept string identifiers.
We endorse additions that implement the generic C and C++ interfaces provided
with the libraries. Multiple sensor and actuator types have been defined, for
instance:
with the libraries. With the 2.0 release, UPM introduces the following sensor
interfaces:
```
iAcceleration, iAngle, iButton, iClock, iCollision, iDistance,
iDistanceInterrupter, iEC, iElectromagnet, iEmg, iGas, iGps, iGyroscope,
iHallEffect, iHeartRate, iHumidity, iLight, iLineFinder, iMagnetometer,
iMoisture, iMotion, iOrp, iPH, iPressure, iProximity, iTemperature, iVDiv,
iWater.
```
The developer community is invited to propose new interfaces for actuator types.
* Light controller
* Light sensor
* Temperature sensor
* Humidity sensor
* Pressure sensor
* Gas sensor
* Analog to digital converter
The developer community is welcome to submit feedback on existing categories or
suggest new ones.
The UPM project is joining the Eclipse Foundation as an Eclipse IoT project.
You can read more about this [here](https://projects.eclipse.org/proposals/eclipse-upm).
### Example
@ -61,27 +63,21 @@ A sensor/actuator is expected to work as such (here is the MMA7660 accelerometer
}
```
Browse through the list of all [examples](https://github.com/intel-iot-devkit/upm/tree/master/examples).
Browse through the list of all [examples](https://github.com/eclipse/upm/tree/master/examples).
Multi-sensor samples for the starter and specialized kits can be found in the
Multi-sensor samples for starter and specialized kits can be found in the
[iot-devkit-samples](https://github.com/intel-iot-devkit/iot-devkit-samples) repository.
### Supported Sensors
Supported [sensor list](http://iotdk.intel.com/docs/master/upm/modules.html) from API documentation.
You can also refer to the [Intel® IoT Developer Zone](https://software.intel.com/iot/hardware/sensors).
### IDE Support and More
### IDE Support
The UPM sensor libraries are directly supported by the IDEs listed on the Intel®
Developer Zone Tools & IDEs page.
<a href="https://software.intel.com/iot/tools"><img src="docs/icons/iss.png"/></a>
Intel® System Studio integration offers IoT specific features such as a sensor explorer,
library sync tools and the ability to easily import existing projects and samples that
use the UPM libraries. For further details please refer to the IoT User Guides on IDZ.
The UPM project includes support for multiple industrial-grade sensors, actuators, radios,
protocols and standards in use today. It is also highly integrated with the Eclipse IDE
through the help of the Foundation's partners.
Learn more about [tools](https://software.intel.com/en-us/tools-by-segment/systems-iot).
### Installing UPM
@ -92,33 +88,24 @@ Find notes on how to install UPM on various OS'es on this [page](docs/installing
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
A quick way to add a new sensor driver is to port existing code from another
platform (e.g. Arduino) and swap the IO calls to the MRAA API. This of course
assumes either ownership of the original code or licensing that allows
unrestricted redistribution.
The [porting](docs/porting.md) section has more information on this process,
and there is an example available based on the max31855 [sensor](docs/max31855.md).
Read more on creating Java [bindings](docs/creating_java_bindings.md) for your
new driver.
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=upm-master&metric=alert_status)](https://sonarcloud.io/dashboard?id=upm-master)
### Guidelines and rules for new UPM contributions
Before you begin development, take a look at our naming [conventions](docs/naming.md).
The name you pick for a newly added sensor needs to be unique in the UPM library.
Then, please go over this short set of rules for new [contributions](docs/contributions.md).
Next, review the project's [contribution guide](docs/contributions.md).
Make sure you add yourself as an author on every new code file submitted.
If you are providing a fix with significant changes, feel free to add yourself
as a contributor. Signing-off your commits is mandatory.
as a contributor. Signing-off your commits and accepting the ECA is mandatory
for making new contributions to this project.
Documenting your code is also a big part of the task. We have a strict set of
tags used to classify our sensors and their capabilities. You can find out more
about this in our [section](docs/documentation.md) on documenting a sensor API.
Finally, if you really want to ensure consistency with the rest of the library,
and the intel-iot-devkit repositories in general, take a look at our extensive
[author guide](docs/guidelines.md).
@ -137,9 +124,6 @@ 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** - Several important API changes are currently underway for some of our
widely used libraries including `libupm-grove` and `libupm-i2clcd`!
### Changelog
Version changelog [here](docs/changelog.md).

View File

@ -1,25 +0,0 @@
# this toolchain file comes from gnuradio project
set( CMAKE_SYSTEM_NAME Linux )
#set( CMAKE_C_COMPILER $ENV{CC} )
#set( CMAKE_CXX_COMPILER $ENV{CXX} )
string(REGEX MATCH "sysroots/([a-zA-Z0-9]+)" CMAKE_SYSTEM_PROCESSOR $ENV{SDKTARGETSYSROOT})
string(REGEX REPLACE "sysroots/" "" CMAKE_SYSTEM_PROCESSOR ${CMAKE_SYSTEM_PROCESSOR})
set( CMAKE_CXX_FLAGS $ENV{CXXFLAGS} CACHE STRING "" FORCE )
set( CMAKE_C_FLAGS $ENV{CFLAGS} CACHE STRING "" FORCE ) #same flags for C sources
set( CMAKE_LDFLAGS_FLAGS ${CMAKE_CXX_FLAGS} CACHE STRING "" FORCE ) #same flags for C sources
set( CMAKE_LIBRARY_PATH ${OECORE_TARGET_SYSROOT}/usr/lib )
set( CMAKE_FIND_ROOT_PATH $ENV{OECORE_TARGET_SYSROOT} $ENV{OECORE_NATIVE_SYSROOT} )
set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )
set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
set( CMAKE_INSTALL_PREFIX $ENV{OECORE_TARGET_SYSROOT}/usr CACHE STRING "" FORCE)
set( ORC_INCLUDE_DIRS $ENV{OECORE_TARGET_SYSROOT}/usr/include/orc-0.4 )
set( ORC_LIBRARY_DIRS $ENV{OECORE_TARGET_SYSROOT}/usr/lib )
# for java
set( JAVA_AWT_INCLUDE_PATH $ENV{JAVA_HOME}/include CACHE PATH "" FORCE)
set( JAVA_AWT_LIBRARY $ENV{JAVA_HOME}/jre/lib/amd64/libjawt.so CACHE FILEPATH "" FORCE)
set( JAVA_INCLUDE_PATH $ENV{JAVA_HOME}/include CACHE PATH "" FORCE)
set( JAVA_INCLUDE_PATH2 $ENV{JAVA_HOME}/include/linux CACHE PATH "" FORCE)
set( JAVA_JVM_LIBRARY $ENV{JAVA_HOME}/jre/lib/amd64/libjvm.so CACHE FILEPATH "" FORCE)

View File

@ -1,69 +1,66 @@
# Macro to add directory to NODEJS_INCLUDE_DIRS if it exists and is not /usr/include
macro(add_include_dir dir)
# Macro to add directory to NODEJS_INCLUDE_DIRS if it exists and is not /usr/include
macro(add_include_dir dir)
if (IS_DIRECTORY ${dir} AND NOT ${dir} STREQUAL "/usr/include")
set(NODEJS_INCLUDE_DIRS ${NODEJS_INCLUDE_DIRS} ${dir})
set(NODEJS_INCLUDE_DIRS ${NODEJS_INCLUDE_DIRS} ${dir})
endif()
endmacro()
find_program (NODEJS_EXECUTABLE NAMES node nodejs
HINTS
$ENV{NODE_DIR}
PATH_SUFFIXES bin
DOC "Node.js interpreter"
)
DOC "Node.js interpreter")
include (FindPackageHandleStandardArgs)
# If compat-libuv package exists, it must be at start of include path
find_path (UV_ROOT_DIR "uv.h" PATHS /usr/include/compat-libuv010 NO_DEFAULT_PATH)
if (UV_ROOT_DIR)
# set (NODEJS_INCLUDE_DIRS ${UV_ROOT_DIR})
add_include_dir(${UV_ROOT_DIR})
# set (NODEJS_INCLUDE_DIRS ${UV_ROOT_DIR})
add_include_dir(${UV_ROOT_DIR})
endif()
# Now look for node. Flag an error if not found
find_path (NODE_ROOT_DIR "include/node/node.h" "include/src/node.h" "src/node.h"
PATHS /usr/include/nodejs /usr/local/include/nodejs /usr/local/include)
find_path (NODE_ROOT_DIR
NAMES node.h src/node.h
PATH_SUFFIXES node node4 node5 node6 node7 node8 nodejs
PATHS /usr/include /usr/local/include)
if (NODE_ROOT_DIR)
add_include_dir(${NODE_ROOT_DIR}/include/src)
add_include_dir(${NODE_ROOT_DIR}/src)
add_include_dir(${NODE_ROOT_DIR}/include/node)
add_include_dir(${NODE_ROOT_DIR}/include/deps/v8/include)
add_include_dir(${NODE_ROOT_DIR}/deps/v8/include)
add_include_dir(${NODE_ROOT_DIR}/include/deps/uv/include)
add_include_dir(${NODE_ROOT_DIR}/deps/uv/include)
add_include_dir(${NODE_ROOT_DIR})
add_include_dir(${NODE_ROOT_DIR}/deps/uv/include)
add_include_dir(${NODE_ROOT_DIR}/deps/v8/include)
add_include_dir(${NODE_ROOT_DIR}/include/deps/uv/include)
add_include_dir(${NODE_ROOT_DIR}/include/deps/v8/include)
add_include_dir(${NODE_ROOT_DIR}/include/node)
add_include_dir(${NODE_ROOT_DIR}/include/src)
add_include_dir(${NODE_ROOT_DIR}/src)
else()
unset(NODEJS_INCLUDE_DIRS)
message(ERROR " - node.h not found")
unset(NODEJS_INCLUDE_DIRS)
message(ERROR " - node.h not found")
endif()
# Check that v8.h is in NODEJS_INCLUDE_DIRS
find_path (V8_ROOT_DIR "v8.h" PATHS ${NODEJS_INCLUDE_DIRS})
if (NOT V8_ROOT_DIR)
unset(NODEJS_INCLUDE_DIRS)
message(ERROR " - v8.h not found")
unset(NODEJS_INCLUDE_DIRS)
message(ERROR " - v8.h not found")
endif()
# Check that uv.h is in NODEJS_INCLUDE_DIRS
find_path (UV_ROOT_DIR "uv.h" PATHS ${NODEJS_INCLUDE_DIRS})
if (NOT UV_ROOT_DIR)
unset(NODEJS_INCLUDE_DIRS)
message(ERROR " - uv.h not found")
unset(NODEJS_INCLUDE_DIRS)
message(ERROR " - uv.h not found")
endif()
find_package_handle_standard_args (Nodejs DEFAULT_MSG
NODEJS_EXECUTABLE
NODEJS_INCLUDE_DIRS
)
if (NODEJS_EXECUTABLE)
execute_process(COMMAND ${NODEJS_EXECUTABLE} --version
OUTPUT_VARIABLE _VERSION
RESULT_VARIABLE _NODE_VERSION_RESULT)
OUTPUT_VARIABLE _VERSION
RESULT_VARIABLE _NODE_VERSION_RESULT)
execute_process(COMMAND ${NODEJS_EXECUTABLE} -e "console.log(process.versions.v8)"
OUTPUT_VARIABLE _V8_VERSION
RESULT_VARIABLE _V8_RESULT)
OUTPUT_VARIABLE _V8_VERSION
RESULT_VARIABLE _V8_RESULT)
if (NOT _NODE_VERSION_RESULT AND NOT _V8_RESULT)
string (REPLACE "v" "" NODE_VERSION_STRING "${_VERSION}")
string (REPLACE "." ";" _VERSION_LIST "${NODE_VERSION_STRING}")
@ -88,13 +85,15 @@ if (NODEJS_EXECUTABLE)
set (V8_VERSION_MINOR "28")
set (V8_VERSION_PATCH "72")
set (V8_VERSION_STRING "3.28.72")
message ("defaulted to node 0.10.30")
message (STATUS "defaulted to node 0.10.30")
endif ()
string (REGEX REPLACE "\n" "" NODE_VERSION_STRING ${NODE_VERSION_STRING})
string (REGEX REPLACE "\n" "" V8_VERSION_STRING ${V8_VERSION_STRING})
message (STATUS "Node version is ${NODE_VERSION_STRING}")
message (STATUS "Node using v8 ${V8_VERSION_STRING}")
mark_as_advanced (NODEJS_EXECUTABLE)
endif ()
mark_as_advanced (NODEJS_EXECUTABLE)
mark_as_advanced (NODEJS_EXECUTABLE)
find_package_handle_standard_args (Nodejs
REQUIRED_VARS NODEJS_EXECUTABLE NODEJS_INCLUDE_DIRS
VERSION_VAR NODE_VERSION_STRING)
message(STATUS "Found v8: ${V8_ROOT_DIR}/v8.h (found version \"${V8_VERSION_STRING}\")")
endif ()

View File

@ -1,13 +1,71 @@
# Finding and pointing a variable to the npm executable if found
# Only works on Linux systems as of now
# FindNpm
# --------
#
# Find npm
#
# This module finds an installed npm. It sets the following variables:
#
# NPM_FOUND - Set to true if npm is found
# NPM_DIR - The directory where npm is installed
# NPM_GLOBAL_NODE_MODULE_DIR - The global node_modules directory
# NPM_EXECUTABLE - The path to the npm executable
# NPM_VERSION - The version number of the npm executable
find_program(NPM_EXECUTABLE NAMES npm
HINTS
/usr
)
find_program(NPM_EXECUTABLE NAMES npm HINTS /usr)
if(NPM_EXECUTABLE)
message(STATUS "NPM Executable found at ${NPM_EXECUTABLE}")
# If npm was found, fill in the rest
if (NPM_EXECUTABLE)
# Set the global node_modules location
execute_process(COMMAND ${NPM_EXECUTABLE} root -g
OUTPUT_VARIABLE NPM_GLOBAL_NODE_MODULE_DIR
ERROR_VARIABLE NPM_root_g_error
RESULT_VARIABLE NPM_root_g_result_code)
# Remove and newlines
string (STRIP ${NPM_GLOBAL_NODE_MODULE_DIR} NPM_GLOBAL_NODE_MODULE_DIR)
if(NPM_root_g_result_code)
if(NPM_FIND_REQUIRED)
message(SEND_ERROR "Command \"${NPM_EXECUTABLE} root -g\" failed with output:\n${NPM_root_g_error}")
else ()
message(STATUS "Command \"${NPM_EXECUTABLE} root -g\" failed with output:\n${NPM_root_g_error}")
endif ()
endif()
unset(NPM_root_g_error)
unset(NPM_root_g_result_code)
# Set the NPM dir
if (EXISTS "${NPM_GLOBAL_NODE_MODULE_DIR}/npm")
set(NPM_DIR "${NPM_GLOBAL_NODE_MODULE_DIR}/npm")
endif()
# Set the VERSION
execute_process(COMMAND ${NPM_EXECUTABLE} -v
OUTPUT_VARIABLE NPM_VERSION
ERROR_VARIABLE NPM_version_error
RESULT_VARIABLE NPM_version_result_code)
if(NPM_version_result_code)
if(NPM_FIND_REQUIRED)
message(SEND_ERROR "Command \"${NPM_EXECUTABLE} -v\" failed with output:\n${NPM_version_error}")
else()
message(STATUS "Command \"${NPM_EXECUTABLE} -v\" failed with output:\n${NPM_version_error}")
endif ()
endif ()
unset(NPM_version_error)
unset(NPM_version_result_code)
# Remove and newlines
string (STRIP ${NPM_VERSION} NPM_VERSION)
set (NPM_FOUND TRUE)
else()
message(ERROR "Unable to find NPM installation, please install NPM")
endif()
# Fail on REQUIRED
if (Npm_FIND_REQUIRED)
message(SEND_ERROR "Failed to find npm executable")
endif()
endif ()
find_package_handle_standard_args(NPM
REQUIRED_VARS NPM_EXECUTABLE NPM_DIR
VERSION_VAR NPM_VERSION )
mark_as_advanced(NPM_DIR NPM_GLOBAL_NODE_MODULE_DIR NPM_EXECUTABLE NPM_VERSION)

View File

@ -0,0 +1,20 @@
find_program (UPM_CORDOVA_BINDING NAMES upm-cordova-binding
DOC "UPM Cordova binding generator")
include (FindPackageHandleStandardArgs)
# Get version
if (UPM_CORDOVA_BINDING)
execute_process(COMMAND ${NPM_EXECUTABLE} info upm-cordova-binding version
OUTPUT_VARIABLE UPM_CORDOVA_BINDING_VERSION
ERROR_VARIABLE UPM_CORDOVA_BINDING_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_STRIP_TRAILING_WHITESPACE)
endif()
find_package_handle_standard_args(UpmCordovaGenerator
REQUIRED_VARS UPM_CORDOVA_BINDING
VERSION_VAR UPM_CORDOVA_BINDING_VERSION
FAIL_MESSAGE "Unable to find the npm package for generating UPM Cordova bindings. The generator can be installed via: 'npm install -g upm-cordova-binding'")
mark_as_advanced (UPM_CORDOVA_BINDING UPM_CORDOVA_BINDING_VERSION)

View File

@ -1,136 +0,0 @@
# Based on the Qt 5 processor detection code, so should be very accurate
# https://qt.gitorious.org/qt/qtbase/blobs/master/src/corelib/global/qprocessordetection.h
# Currently handles arm (v5, v6, v7), x86 (32/64), ia64, and ppc (32/64)
# Regarding POWER/PowerPC, just as is noted in the Qt source,
# "There are many more known variants/revisions that we do not handle/detect."
set(archdetect_c_code "
#if defined(__arm__) || defined(__TARGET_ARCH_ARM)
#if defined(__ARM_ARCH_7__) \\
|| defined(__ARM_ARCH_7A__) \\
|| defined(__ARM_ARCH_7R__) \\
|| defined(__ARM_ARCH_7M__) \\
|| (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 7)
#error cmake_ARCH armv7
#elif defined(__ARM_ARCH_6__) \\
|| defined(__ARM_ARCH_6J__) \\
|| defined(__ARM_ARCH_6T2__) \\
|| defined(__ARM_ARCH_6Z__) \\
|| defined(__ARM_ARCH_6K__) \\
|| defined(__ARM_ARCH_6ZK__) \\
|| defined(__ARM_ARCH_6M__) \\
|| (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 6)
#error cmake_ARCH armv6
#elif defined(__ARM_ARCH_5TEJ__) \\
|| (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 5)
#error cmake_ARCH armv5
#else
#error cmake_ARCH arm
#endif
#elif defined(__i586) || defined(__i586__)
#error cmake_ARCH i586
#elif defined(__i386) || defined(__i386__) || defined(_M_IX86)
#error cmake_ARCH i386
#elif defined(__x86_64) || defined(__x86_64__) || defined(__amd64) || defined(_M_X64)
#error cmake_ARCH x86_64
#elif defined(__ia64) || defined(__ia64__) || defined(_M_IA64)
#error cmake_ARCH ia64
#elif defined(__ppc__) || defined(__ppc) || defined(__powerpc__) \\
|| defined(_ARCH_COM) || defined(_ARCH_PWR) || defined(_ARCH_PPC) \\
|| defined(_M_MPPC) || defined(_M_PPC)
#if defined(__ppc64__) || defined(__powerpc64__) || defined(__64BIT__)
#error cmake_ARCH ppc64
#else
#error cmake_ARCH ppc
#endif
#endif
#error cmake_ARCH unknown
")
# Set ppc_support to TRUE before including this file or ppc and ppc64
# will be treated as invalid architectures since they are no longer supported by Apple
function(target_architecture output_var)
if(APPLE AND CMAKE_OSX_ARCHITECTURES)
# On OS X we use CMAKE_OSX_ARCHITECTURES *if* it was set
# First let's normalize the order of the values
# Note that it's not possible to compile PowerPC applications if you are using
# the OS X SDK version 10.6 or later - you'll need 10.4/10.5 for that, so we
# disable it by default
# See this page for more information:
# http://stackoverflow.com/questions/5333490/how-can-we-restore-ppc-ppc64-as-well-as-full-10-4-10-5-sdk-support-to-xcode-4
# Architecture defaults to i386 or ppc on OS X 10.5 and earlier, depending on the CPU type detected at runtime.
# On OS X 10.6+ the default is x86_64 if the CPU supports it, i386 otherwise.
foreach(osx_arch ${CMAKE_OSX_ARCHITECTURES})
if("${osx_arch}" STREQUAL "ppc" AND ppc_support)
set(osx_arch_ppc TRUE)
elseif("${osx_arch}" STREQUAL "i386")
set(osx_arch_i386 TRUE)
elseif("${osx_arch}" STREQUAL "x86_64")
set(osx_arch_x86_64 TRUE)
elseif("${osx_arch}" STREQUAL "ppc64" AND ppc_support)
set(osx_arch_ppc64 TRUE)
else()
message(FATAL_ERROR "Invalid OS X arch name: ${osx_arch}")
endif()
endforeach()
# Now add all the architectures in our normalized order
if(osx_arch_ppc)
list(APPEND ARCH ppc)
endif()
if(osx_arch_i386)
list(APPEND ARCH i386)
endif()
if(osx_arch_x86_64)
list(APPEND ARCH x86_64)
endif()
if(osx_arch_ppc64)
list(APPEND ARCH ppc64)
endif()
else()
file(WRITE "${CMAKE_BINARY_DIR}/arch.c" "${archdetect_c_code}")
enable_language(C)
# Detect the architecture in a rather creative way...
# This compiles a small C program which is a series of ifdefs that selects a
# particular #error preprocessor directive whose message string contains the
# target architecture. The program will always fail to compile (both because
# file is not a valid C program, and obviously because of the presence of the
# #error preprocessor directives... but by exploiting the preprocessor in this
# way, we can detect the correct target architecture even when cross-compiling,
# since the program itself never needs to be run (only the compiler/preprocessor)
try_run(
run_result_unused
compile_result_unused
"${CMAKE_BINARY_DIR}"
"${CMAKE_BINARY_DIR}/arch.c"
COMPILE_OUTPUT_VARIABLE ARCH
CMAKE_FLAGS CMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}
)
# Parse the architecture name from the compiler output
string(REGEX MATCH "cmake_ARCH ([a-zA-Z0-9_]+)" ARCH "${ARCH}")
# Get rid of the value marker leaving just the architecture name
string(REPLACE "cmake_ARCH " "" ARCH "${ARCH}")
# If we are compiling with an unknown architecture this variable should
# already be set to "unknown" but in the case that it's empty (i.e. due
# to a typo in the code), then set it to unknown
if (NOT ARCH)
set(ARCH unknown)
endif()
endif()
set(${output_var} "${ARCH}" PARENT_SCOPE)
endfunction()

View File

@ -3,7 +3,7 @@ version: '2.1'
services:
base:
image: dnoliver/upm-base
image: inteliotdevkit/upm-base
environment:
- http_proxy
- https_proxy
@ -13,8 +13,10 @@ services:
- BUILDFTI=${BUILDFTI:-ON}
- BUILDSWIGPYTHON=${BUILDSWIGPYTHON:-OFF}
- BUILDSWIGJAVA=${BUILDSWIGJAVA:-OFF}
- BUILDCORDOVA=${BUILDCORDOVA:-OFF}
- BUILDSWIGNODE=${BUILDSWIGNODE:-OFF}
- BUILDEXAMPLES=${BUILDEXAMPLES:-ON}
- BUILDEXAMPLES=${BUILDEXAMPLES:-OFF}
- CMAKE_BUILD_TYPE
- IPK=${IPK:-OFF}
- RPM=${RPM:-OFF}
- NPM=${NPM:-OFF}
@ -26,9 +28,18 @@ services:
volumes:
- .:${UPM_SRC_DIR:-/usr/src/app}
doc:
all:
extends: base
image: dnoliver/upm-all
image: inteliotdevkit/upm-all
minimal:
extends: base
environment:
- BUILDFTI=OFF
command: bash -c "./scripts/run-cmake.sh && cd build && make && ctest -R unit --output-on-failure"
doc:
extends: all
environment:
- BUILDSWIGPYTHON=ON
- BUILDSWIGJAVA=ON
@ -36,22 +47,17 @@ services:
- BUILDDOC=ON
command: bash -c "./scripts/run-cmake.sh && ./scripts/build-doc.sh"
ipk:
extends: base
examples:
extends: all
environment:
- IPK=ON
- BUILDDOC=OFF
command: bash -c "./scripts/run-cmake.sh && make -Cbuild -j8 package"
rpm:
extends: doc
environment:
- RPM=ON
- BUILDDOC=OFF
command: bash -c "./scripts/run-cmake.sh && make -Cbuild -j8 package"
- BUILDSWIGPYTHON=ON
- BUILDSWIGJAVA=ON
- BUILDSWIGNODE=ON
- BUILDEXAMPLES=ON
command: bash -c "./scripts/run-cmake.sh && cd build && make -j8"
npm:
extends: doc
extends: all
environment:
- NPM=ON
- BUILDDOC=OFF
@ -59,12 +65,9 @@ services:
sonar-scan:
extends: base
image: dnoliver/upm-all
image: inteliotdevkit/upm-sonar
environment:
- BUILDSWIGPYTHON=ON
- BUILDSWIGNODE=ON
- BUILDSWIGJAVA=ON
- BUILDSWIGEXAMPLES=ON
- BUILDTESTS=OFF
- SONAR_TOKEN
- SONAR_ORG
- SONAR_PROJ_KEY
@ -77,36 +80,43 @@ services:
python:
extends: base
image: dnoliver/upm-python
image: inteliotdevkit/upm-python
environment:
- BUILDSWIGPYTHON=ON
command: bash -c "./scripts/run-cmake.sh && cd build && make -j8 && make -j8 install && ldconfig && ctest --output-on-failure"
java:
extends: base
image: dnoliver/upm-java
image: inteliotdevkit/upm-java
environment:
- BUILDSWIGJAVA=ON
command: bash -c "./scripts/run-cmake.sh && cd build && make -j8 && make -j8 install && ldconfig && ctest --output-on-failure"
android:
extends: java
image: dnoliver/upm-android
image: inteliotdevkit/upm-android
environment:
- BUILDTESTS=OFF
command: bash -c "./scripts/build-android.sh"
cordova:
extends: all
environment:
- BUILDSWIGJAVA=ON
- BUILDCORDOVA=ON
command: bash -c "./scripts/run-cmake.sh && cd build && make -j8 && make -j8"
node4:
extends: base
image: dnoliver/upm-node4
image: inteliotdevkit/upm-node4
environment:
- BUILDSWIGNODE=ON
command: bash -c "./scripts/run-cmake.sh && cd build && make -j8 && make -j8 install && ldconfig && ctest --output-on-failure -E examplenames_js"
node5:
extends: node4
image: dnoliver/upm-node5
image: inteliotdevkit/upm-node5
node6:
extends: node4
image: dnoliver/upm-node6
image: inteliotdevkit/upm-node6

View File

@ -4,6 +4,36 @@ API Changes {#apichanges}
Here's a list of other API changes made to the library that break source/binary
compatibility between releases:
# v2.0.0
* Sensors implementing the old interfaces (bme280, bmpx8x, si7005, si1132,
max44009, lp8860, ds1808lc, hlg150h) have been updated to use the new ones,
hence some function names and parameters will be different.
* Removed deprecated basic grove classes from project, see API changes for
v1.1.0 and prior for a complete list
# v1.7.0
* The interface of **kx122** has been modified to return values instead
of receiving pointers. This applies to member functions: getWhoAmI,
getInterruptSource, getBufferStatus, getRawBufferSamples, and
getBufferSamples.
* The **tm1637** constructor has been updated and the fast GPIO parameter
has been removed with the deprecation of supporting MRAA functions. The
GPIO lines will initialize by default in fast mode when available.
* The generic **nmea_gps** library for GPS devices has been greatly enhanced
with new APIs to offer better control over acquisition intervals and simplify
parsing of the returned data.
# v1.6.0
* Several C libraries had their init function pin type modified from uint8_t
to int allowing usage with subplatforms
* Our **led** class constructor has been overloaded with a string based
variant that uses the new MRAA LED APIs
* The **i2clcd** library has finally been renamed to **lcd** and is now
mostly considered a bundle for ssd lcd display controllers only
* The **zfm20** class constructor has been overloaded with a string variant
that allows initialization using any UART device
# v1.5.0
* **VEML6070** This sensor class no longer needs an I2C address when
@ -138,13 +168,13 @@ compatibility between releases:
* **lcm1602/jhd1313m1** These drivers had been rewritten in C, with
C++ wrappers and placed into their own libraries in the previous
version of UPM, however, the original C++ implementation was kept in
the lcd/i2clcd library for compatibility reasons with existing code.
the lcd library for compatibility reasons with existing code.
To avoid collisions with the header files, the new *lcm1602* and
*jhd1313m1* drivers had their C++ headers renamed to use a **.hxx**
suffix.
In this version of UPM, the *lcm1602* and *jhd1313m1* drivers have
been removed from the lcd/i2clcd library. In addition, the header
been removed from the lcd library. In addition, the header
files for the new implementation have been renamed from their
**.hxx** suffix to the normal **.hpp** suffix.

View File

@ -96,32 +96,35 @@ You can also generate the include and lib directories containing all the sensor
headers and library files respectively with *make install*. Further, you may
choose to generate these only for a specific sensor you modified, and this can
be achieved by building from the individual makefile of the sensor. Assuming
you're in the build directory, to make the lcd module you would:
you're in the build directory, to build/install the lcd module you would:
~~~~~~~~~~~~~
cd src/lcd
make install
~~~~~~~~~~~~~
Note: 'make install' under src/lcd will build all targets (and dependencies)
for the lcd but will NOT install dependencies.
Often developers are only interested in building one module or even just the
python/node module to do some quick testing using scripting. In order to do
this you need to use the target name for the python or node module you want to
rebuild. For example the lcd module target name is i2clcd. Therefore the python
module target name will be prefixed by _pyupm_. Just do the following to build
only that module. Modules not using the UPM cmake macros may have different
naming.
rebuild. For example, the lcd module target will have a python2 target prefixed
by _pyupm_ (_pyupm_lcd-python2). Modules not using the UPM cmake macros may
have different naming. To build the python2 lcd module (and all dependencies),
use the following make target:
~~~~~~~~~~~~~
make _pyupm_i2clcd
make _pyupm_lcd-python2
~~~~~~~~~~~~~
Sometimes you want to build a small C++ example against an installed library.
This is fairly easy if installed system-wide. Just link against the correct
library (in this case libupm-i2clcd) and then add /usr/include/upm to the
library (in this case libupm-lcd) and then add /usr/include/upm to the
loader path:
~~~~~~~~~~~~
g++ test.cxx -lupm-i2clcd -I/usr/include/upm
g++ test.cxx -lupm-lcd -I/usr/include/upm
~~~~~~~~~~~~
You can also use pkg-config to return the information to you, which is
@ -129,9 +132,37 @@ considered the correct way if including UPM in a build system like cmake or
autotools on linux.
~~~~~~~~~~~
pkg-config --cflags --libs upm-i2clcd
pkg-config --cflags --libs upm-lcd
~~~~~~~~~~~
## Building for Android Things
Requirements:
* [io.mraa.at](https://search.maven.org/#artifactdetails%7Cio.mraa.at%7Cmraa%7C1.8.0%7Caar)
* [io.mraa.at.upm](https://search.maven.org/#artifactdetails%7Cio.mraa.at.upm%7Cupm_zfm20%7C1.3.0%7Caar)
* [Android NDK](https://developer.android.com/ndk/downloads/index.html) >= 14b
### Android NDK r14b
~~~~~~~~~~~~~{.sh}
NDK_HOME="/path/to/android-ndk-r14b"
MRAA_INSTALL_DIR="/path/to/mraa/install"
cmake -DBUILDSWIG=ON \
-DBUILDSWIGPYTHON=OFF \
-DBUILDSWIGNODE=OFF \
-DBUILDSWIGJAVA=ON \
-DANDROID_COMPILER_FLAGS_CXX='-std=c++11' \
-DANDROID_PIE=1 \
-DANDROID_PLATFORM=android-24 \
-DANDROID_STL_FORCE_FEATURES=ON \
-DANDROID_STL=c++_shared \
-DANDROID_TOOLCHAIN_NAME=x86-i686 \
-DCMAKE_TOOLCHAIN_FILE=$NDK_HOME/build/cmake/android.toolchain.cmake \
-DCMAKE_FIND_ROOT_PATH=$MRAA_INSTALL_DIR \
..
~~~~~~~~~~~~~
## Building with Docker
You can use `docker` and `docker-compose` to generate a complete build environment
@ -192,7 +223,7 @@ $ docker run \
--env BUILDSWIGPYTHON=ON \
--env BUILDSWIGJAVA=OFF \
--env BUILDSWIGNODE=OFF \
dnoliver/upm-python \
inteliotdevkit/upm-python \
bash -c "./scripts/run-cmake.sh && make -Cbuild"
```
@ -226,6 +257,6 @@ $ docker run \
--env http_proxy=$http_proxy \
--env https_proxy=$https_proxy \
--env no_proxy=$no_proxy \
dnoliver/upm-python \
inteliotdevkit/upm-python \
bash -c "./scripts/run-cmake.sh && make -Cbuild"
```

View File

@ -4,6 +4,47 @@ Changelog {#changelog}
Here's a list summarizing some of the key undergoing changes to our library
from earlier versions:
### v2.0.0
* Reworked existing interfaces and extended the list to include iAcceleration,
iAngle, iButton, iClock, iCollision, iDistance, iDistanceInterrupter, iEC,
iElectromagnet, iEmg, iGas, iGps, iGyroscope, iHallEffect, iHeartRate, iHumidity,
iLight, iLineFinder, iMagnetometer, iMoisture, iMotion, iOrp, iPH, iPressure,
iProximity, iTemperature, iVDiv, iWater
* Provided overloaded string based constructors for a good number of sensors,
allowing initialization from external frameworks without type knowledge
* Removed deprecated basic grove classes from project
* Replaced 6 unsafe occurrences of sprintf() usage
* Cleaned-up build system around target arch detection and cpack usage, added
detection and resolution of tinyb library when used as a dependency
* New sensors: 2jciebu01_ble, 2jciebu01_usb
### v1.7.1
* Bumped library compatibility to new MRAA 2.0 APIs
* Added installation details for Fedora
* Minor fixes based on static analysis vulnerability report
### v1.7.0
* Added Cordova bindings based on Java packages
* Complete rework of the nmea_gps library giving more control over data
acquisition and parsing
* Added GTest support for unit tests
* Removed calls to deprecated MRAA fast GPIO functions
* Several bug fixes and improvements around SWIG type maps and gcc8 support
* New sensors: kx122, kxtj3, bh1792, bh1749
### v1.6.0
* Extended LED library to support the new MRAA gpio-leds APIs
* Many CMake changes around SWIG wrapper generation and improved FindNodejs
detection module
* Several code fixes based on static code analysis
* Improved documentation generation and Travis CI builds
* Cleaned-up doxygen tags in headers and class names in JSON library files
* New sensor: lis3dh
### v1.5.0
* Introduced a flexible JSON format for technical sensor specifications, notes

View File

@ -1,100 +1,53 @@
Contributing a module {#contributions}
=====================
Here are the rules of contribution:
- Your new module must have an example that builds against your UPM library.
- Each commit must have a sign-off line by everyone who authored or reviewed
them.
- Commits must be named `<file/module>: Some decent description`.
- You must license your module under a FOSS license. The recommended license
is MIT but any permissive license is fine. Please consider that people using
UPM may want to write proprietary programs with your sensors so we like to
avoid GPL. If your license is not MIT please include a LICENSE file in
src/mymodule/.
In order to contribute to the project:
- The top of each source file must contain a comment block containing the
license information.
- Please test your module builds before contributing and make sure it works on
the latest version of libmraa. If you tested on a specific board/platform
please tell us what this was in your PR.
- Try not to break master. In any commit.
- Commits must be named `<file/module>: Some decent description`.
- Each commit must have a sign-off line by everyone who authored or reviewed
them.
- Your new module must have an example that builds against your UPM library.
- Attempt to have some decent API documentation as described in the the @ref
documentation [guide](documentation.md).
Including the MIT license
=========================
Choosing the [MIT license](http://opensource.org/licenses/MIT) is preferred for
the UPM repository. Below is the comment block needed at the top each source
the UPM repository. Below is the comment block needed at the top each source
file:
/*
* The MIT License (MIT)
*
* Author: <your full name>
* Author: <your full name>
* Copyright (c) <year> <copyright holder>
*
* Author: <contributing author full name - if applicable>
* Author: <contributing author full name - if applicable>
* Copyright (c) <year> <copyright holder>
*
* 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:
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at https://opensource.org/licenses/MIT.
*
* 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.
* SPDX-License-Identifier: MIT
*/
Code signing
Eclipse Contributor Agreement
============
The sign-off is a simple line at the end of the explanation for the
patch, which certifies that you wrote it or otherwise have the right to pass it
on as an open-source patch. The rules are pretty simple: if you can certify
the below:
Your contribution cannot be accepted unless you have a signed [ECA - Eclipse Foundation Contributor Agreement](http://www.eclipse.org/legal/ECA.php) in place.
Developer's Certificate of Origin 1.1
Here is the checklist for contributions to be considered _acceptable_:
By making a contribution to this project, I certify that:
(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or
(b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or
(c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.
(d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.
then you just add a line to each of your commits with `--signoff` saying
Signed-off-by: Random J Developer <random@developer.example.org>
using your real name (sorry, no pseudonyms or anonymous contributions.)
Unsigned commits will not be accepted.
1. [Create an account at Eclipse](https://dev.eclipse.org/site_login/createaccount.php).
2. Add your GitHub user name in your account settings.
3. [Log into the project's portal](https://projects.eclipse.org/) and sign the ["Eclipse ECA"](https://projects.eclipse.org/user/sign/cla).
4. Ensure that you [_sign-off_](https://wiki.eclipse.org/Development_Resources/Contributing_via_Git#Signing_off_on_a_commit) your Git commits.
5. Ensure that you use the _same_ email address as your Eclipse account in commits.
6. Include the appropriate copyright notice and license at the top of each file.
Your signing of the ECA will be verified by a webservice called 'ip-validation'
that checks the email address that signed-off on your commits has signed the
ECA. **Note**: This service is case-sensitive, so ensure the email that signed
the ECA and that signed-off on your commits is the same, down to the case.
Creating a new sensor library using the sensortemplate
=======================================
@ -125,6 +78,8 @@ function make_new_sensor {
# Search/replace the new files, replacing all instances of sensortemplate
perl -p -i -e "s/SensorTemplate/${SensorName}/g" src/${sensorname}/* examples/*/*${sensorname}* examples/*/*${SensorName}*
perl -p -i -e "s/sensortemplate/${sensorname}/g" src/${sensorname}/* examples/*/*${sensorname}* examples/*/*${SensorName}*
# Remove objects starting with "//" from the new library descriptor .json file
perl -p -i -e 'BEGIN{undef $/;} s/\s+"\/\/.*?},//smg' src/${sensorname}/${sensorname}.json
# Add mynewmodule example target for java
perl -p -i -e "s/^((.*)SensorTemplateSample sensortemplate(.*))/\1\n\2${SensorName}Sample ${sensorname}\3/g" examples/java/CMakeLists.txt
# Add mynewmodule example mappings for doxygen

View File

@ -33,66 +33,66 @@ As much as possible, avoid passing values/returning values through pointers give
#### Alternatives:
1. Functions that read data from a driver, return it through a pointer given as argument, and return a bool value, should be __replaced by__ functions that return the value directly and throw a std::runtime_error if a read error occurs. E.g.:
```c++
/*
* Function reads from sensor, places read value in variable bar and
* returns true if succesful. Function returns false if read failed.
*/
bool func(int *bar);
/*
* Function reads from sensor, places read value in variable bar and
* returns true if succesful. Function returns false if read failed.
*/
bool func(int *bar);
```
__Replaced by:__
```c++
/*
* Function reads from sensor and returns read value.
* Or throws std::runtime_error if a read error occurs
*/
int func();
/*
* Function reads from sensor and returns read value.
* Or throws std::runtime_error if a read error occurs
*/
int func();
```
2. Functions that return multiple values through pointers, that make sense to be grouped together into an array<sup>1</sup> (e.g. speed values, acceleration values), should be __replaced by__ functions that return a pointer to an array in which the elements are the returned values. Afterwards, [wrap the C array with a Java array](#wrapping-unbound-c-arrays-with-java-arrays-if-array-is-output). E.g.:
```c++
/*
* Function returns the acceleration on the three
* axis in the given variables.
*/
void getAccel(int *accelX, int *accelY, int *accelZ);
/*
* Function returns the acceleration on the three
* axis in the given variables.
*/
void getAccel(int *accelX, int *accelY, int *accelZ);
```
__Replaced by:__
__Replaced by:__
```c++
/*
* Function returns the acceleration on the three
* axis as elements of a 3-element array.
*/
int *getAccel();
/*
* Function returns the acceleration on the three
* axis as elements of a 3-element array.
*/
int *getAccel();
```
3. Functions that return N values through pointers, that do not make sense to grouped together (e.g. a general purpose function that returns both the light intensity and air pollution), should be __replaced by__ N functions (one for each value) that read only one specific value. E.g.:
```c++
/*
* Function returns the light intensity and air pollution
*/
void getData(int *light, int *air);
/*
* Function returns the light intensity and air pollution
*/
void getData(int *light, int *air);
```
__Replaced by:__
__Replaced by:__
```c++
int getLight();
int getAir();
int getLight();
int getAir();
```
4. Functions that return N values through pointers; values that do not make sense to be grouped together, but are time dependent, and make sense to be read at the same time. For example, a sensor that reads air humidity and temperature. A user may want to know the temperature value _temp_ read at the exact moment the humidity value _humid_ was read. These should be __replaced by__ N+1 functions: a _getData()_ function that reads all values at the same time and stores them in global variables; and N getter functions, one for each value. E.g.
```c++
/*
* Function returns the light intensity and air pollution
*/
void getData(int *temp, int *humid);
/*
* Function returns the light intensity and air pollution
*/
void getData(int *temp, int *humid);
```
__Replaced by:__
__Replaced by:__
```c++
void getData();
int getTemp();
int getHumid();
void getData();
int getTemp();
int getHumid();
```
<sup>1</sup>this depends on the interpretation of the returned data. For example, arguments that return the temperature and light intensity, don't make sense to be grouped into an array of size 2. But acceleration on the three axis can be grouped together in an array of size 3. where accelX is accel[0], accelY is accel[1], accelZ is accel[2].
@ -124,18 +124,18 @@ The exception.i library file provides support for creating language independent
```c++
// Language independent exception handler
%include exception.i
// Language independent exception handler
%include exception.i
%exception {
try {
$action
} catch(OutOfMemory) {
SWIG_exception(SWIG_MemoryError, "Out of memory");
} catch(...) {
SWIG_exception(SWIG_RuntimeError,"Unknown exception");
}
}
%exception {
try {
$action
} catch(OutOfMemory) {
SWIG_exception(SWIG_MemoryError, "Out of memory");
} catch(...) {
SWIG_exception(SWIG_RuntimeError,"Unknown exception");
}
}
```
In the upm library, the upm_exception.i interface file provides the functionality to catch common exceptions and propagate them through SWIG. It uses the exception.i library file and is language independent.
@ -157,15 +157,15 @@ The upm_exception.i interface file is included in the upm.i file, therefor SWIG
To throw a specific Java exception:
```c++
%exception {
try {
$action
} catch (std::out_of_range &e) {
jclass clazz = jenv->FindClass("java/lang/Exception");
jenv->ThrowNew(clazz, "Range error");
return $null;
}
}
%exception {
try {
$action
} catch (std::out_of_range &e) {
jclass clazz = jenv->FindClass("java/lang/Exception");
jenv->ThrowNew(clazz, "Range error");
return $null;
}
}
```
Where FindClass and ThrowNew are [JNI functions](http://docs.oracle.com/javase/8/docs/technotes/guides/jni/spec/functions.html).
@ -177,21 +177,21 @@ The C++ compiler does not force the code to catch any exception.
The %exception directive does not specify if a method throws a checked exception (does not add classes to the throws clause). For this, the %javaexception(classes) directive is used; where classes is a string containing one or more comma separated Java classes.
```c++
%javaexception("java.lang.Exception") {
try {
$action
} catch (std::out_of_range &e) {
jclass clazz = jenv->FindClass("java/lang/Exception");
jenv->ThrowNew(clazz, "Range error");
return $null;
}
}
%javaexception("java.lang.Exception") {
try {
$action
} catch (std::out_of_range &e) {
jclass clazz = jenv->FindClass("java/lang/Exception");
jenv->ThrowNew(clazz, "Range error");
return $null;
}
}
```
In the upm library, the java_exceptions.i library file provides the functionality to catch exceptions and propagate them through SWIG as Java checked exceptions. The file provides SWIG wrappers, in the form of macros, that can be applied to methods.E.g. use the __READDATA_EXCEPTION(function)__ macro for functions that read data from a sensor and throw a std::runtime_error in case of a read failure. This will result in:
```java
void function throws IOException ();
void function throws IOException ();
```
## Caveats & Challenges
@ -203,84 +203,73 @@ SWIG can wrap arrays in a more natural Java manner than the default by using the
Functions that return arrays, return a pointer to that array. E.g.:
```c++
/*
* Function returns the acceleration on the three
* axis as elements of a 3-element array.
*/
/*
* Function returns the acceleration on the three
* axis as elements of a 3-element array.
*/
int *getAccel();
int *getAccel();
```
__SWIG:__
__SWIG:__
```c++
%typemap(jni) int* "jintArray"
%typemap(jstype) int* "int[]"
%typemap(jtype) int* "int[]"
%typemap(jni) int* "jintArray"
%typemap(jstype) int* "int[]"
%typemap(jtype) int* "int[]"
%typemap(javaout) int* {
return $jnicall;
}
%typemap(javaout) int* {
return $jnicall;
}
%typemap(out) int *getAccel {
$result = JCALL1(NewIntArray, jenv, 3);
JCALL4(SetIntArrayRegion, jenv, $result, 0, 3, (const signed int*)$1);
}
%typemap(out) int *getAccel {
$result = JCALL1(NewIntArray, jenv, 3);
JCALL4(SetIntArrayRegion, jenv, $result, 0, 3, (const signed int*)$1);
}
```
### Wrapping unbound C arrays with Java arrays if array is input
In C, arrays are tipically passed as pointers, with an integer value representig the length of the array. In Java, the length of an array is always known, so the length argument is redundant. This example shows how to wrap the C array and also get rid the length argument. E.g.:
```c++
void func(uint8_t *buffer, int length);
void func(uint8_t *buffer, int length);
```
__SWIG:__
__SWIG:__
```c++
%typemap(jtype) (uint8_t *buffer, int length) "byte[]"
%typemap(jstype) (uint8_t *buffer, int length) "byte[]"
%typemap(jni) (uint8_t *buffer, int length) "jbyteArray"
%typemap(javain) (uint8_t *buffer, int length) "$javainput"
%typemap(jtype) (uint8_t *buffer, int length) "byte[]"
%typemap(jstype) (uint8_t *buffer, int length) "byte[]"
%typemap(jni) (uint8_t *buffer, int length) "jbyteArray"
%typemap(javain) (uint8_t *buffer, int length) "$javainput"
%typemap(in,numinputs=1) (uint8_t *buffer, int length) {
$1 = JCALL2(GetByteArrayElements, jenv, $input, NULL);
$2 = JCALL1(GetArrayLength, jenv, $input);
}
%typemap(in,numinputs=1) (uint8_t *buffer, int length) {
$1 = JCALL2(GetByteArrayElements, jenv, $input, NULL);
$2 = JCALL1(GetArrayLength, jenv, $input);
}
```
!!!! There is a difference between TYPE *name and TYPE * name in typemaps!!!!!
### Implementing callbacks in Java
Callbacks in the UPM Java library (as well as the MRAA Java library) make use of the _void mraa\_java\_isr\_callback(void\* data\)_ method from MRAA.
Callbacks in the UPM Java library (as well as the MRAA Java library) make use of the _void mraa\_java\_isr\_callback(void\* data\)_ method from MRAA.
__Callbacks in the UPM Java library are implemented as follows (we use the a110x Hall Effect sensors as example):__
We extend the sensor class with another method, _installISR\(jobject runnable\)_, which is a wrapper over the original _installISR\(void \(\*isr\)\(void \*\), void \*arg\)_ method. This will install the _mraa\_java\_isr\_callback\(\)_ method as the interrupt service routine \(ISR\) to be called, with _jobject runnable_ as argument.
SWIGJAVA is a symbol that is always defined by SWIG when using Java. We enclose the _installISR\(jobject runnable\)_ method in a _\#if defined(SWIGJAVA)_ check, to ensure the code only exists when creating a wrapper for Java.
Java callbacks are added at the SWIG interface level. For ease-of-use, a collection of macros are available in src/_upm.i.
src/a110x/a110x.i:
```c++
#if defined(SWIGJAVA)
void A110X::installISR(jobject runnable)
{
installISR(mraa_java_isr_callback, runnable);
}
#endif
JAVA_ADD_INSTALLISR(upm::A110X)
```
We hide the underlying method, _installISR\(void \(\*isr\)\(void \*\), void \*arg\)_ , and expose only the _installISR\(jobject runnable\)_ to SWIG, through the use of the SWIGJAVA symbol. When SWIGJAVA is defined, we change the access modifier of the underlying method to private.
Will expand to the following SWIG wrapper code:
```c++
public:
#if defined(SWIGJAVA)
void installISR(jobject runnable);
#else
void installISR(void (*isr)(void *), void *arg);
#endif
private:
#if defined(SWIGJAVA)
void installISR(void (*isr)(void *), void *arg);
#endif
SWIGINTERN void upm_A110X_installISR__SWIG_1(upm::A110X *self,jobject runnable){
self->installISR(mraa_java_isr_callback, runnable);
}
```
To use callback in java, we create a ISR class, which implements the Java Runnable interface, and we override the _run\(\)_ method with the code to be executed when the interrupt is received. An example for the a110x Hall sensor that increments a counter each time an interrupt is received:
@ -288,13 +277,13 @@ To use callback in java, we create a ISR class, which implements the Java Runnab
```java
public class A110X_intrSample {
public static int counter=0;
public static void main(String[] args) throws InterruptedException {
upm_a110x.A110X hall = new upm_a110x.A110X(2);
A110XISR callback = new A110XISR();
hall.installISR(callback);
while(true){
System.out.println("Counter: " + counter);
Thread.sleep(1000);
@ -311,39 +300,3 @@ class A110XISR implements Runnable {
}
}
```
#### Issues with java callbacks and workarounds
__SWIGJAVA not defined at compile time__
Consider the following files:
* example.h - Header file for our source file
* example.cxx - Source file containing the class Example, for which we build java bindings
* example.i - The SWIG interface, that includes the example.h header file
The build process of a java module using SWIG is split into two steps:
1. Generating the intermediate files, from the SWIG interface file. This will produce the java class file (Example.java), the JNI file (exampleJNI.java) and wrapper file (example_wrap.cxx). The source file (example.cxx) is not needed in the first step.
```
swig -c++ -java example.i
```
2. Generating the shared library from the C++ sources and wrapper file
```
g++ -fPIC -c example.cxx example_wrap.cxx -I/usr/lib/jvm/java-1.8.0/include -I/usr/lib/jvm/java-1.8.0/include/linux
g++ -shared example_wrap.o sensor.o -o libexample.so
```
SWIGJAVA is always defined when SWIG parses the interface file, meaning it will be defined when it parses the header file (example.h) that is included in the interface file (example.i).
SWIG also adds the "#define SWIGJAVA" directive in the wrapper file (example_wrap.cxx).
However, in generating the shared library the SWIGJAVA symbol is only defined in the example_wrap.cxx file, because of the added "#define SWIGJAVA" directive. But we have also used the "#if defined(SWIGJAVA)" check in the source file (example.cxx), and thus need to define SWIGJAVA for it too. If we define the SWIGJAVA symbol as a compile flag, when compiling the source code to object code, the SWIGJAVA compile flag and #define SWIGJAVA" directive will clash and give a double definition warning (only a warning).
In this example it is simple to compile the two source codes separately, one with the compile flag, the other without, and then create the shared library (libexample.so).
But in a big automatic build like the java upm libraries, this may prove too hard or too complicated to do. A workaround to this would be to define a custom symbol (e.q. JAVACALLBACK in the upm library) and also test for it. In short, replace:
```c++
#if defined(SWIGJAVA)
```
by
```c++
#if defined(SWIGJAVA) || defined(JAVACALLBACK)
```

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

View File

@ -1,361 +0,0 @@
Creative Commons Legal Code
Attribution-NonCommercial-ShareAlike 3.0 Unported
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
LEGAL SERVICES. DISTRIBUTION OF THIS LICENSE DOES NOT CREATE AN
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
REGARDING THE INFORMATION PROVIDED, AND DISCLAIMS LIABILITY FOR
DAMAGES RESULTING FROM ITS USE.
License
THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE
COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS PROTECTED BY
COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS
AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED.
BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE
TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS LICENSE MAY
BE CONSIDERED TO BE A CONTRACT, THE LICENSOR GRANTS YOU THE RIGHTS
CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND
CONDITIONS.
1. Definitions
a. "Adaptation" means a work based upon the Work, or upon the Work and
other pre-existing works, such as a translation, adaptation,
derivative work, arrangement of music or other alterations of a
literary or artistic work, or phonogram or performance and includes
cinematographic adaptations or any other form in which the Work may be
recast, transformed, or adapted including in any form recognizably
derived from the original, except that a work that constitutes a
Collection will not be considered an Adaptation for the purpose of
this License. For the avoidance of doubt, where the Work is a musical
work, performance or phonogram, the synchronization of the Work in
timed-relation with a moving image ("synching") will be considered an
Adaptation for the purpose of this License.
b. "Collection" means a collection of literary or artistic works, such as
encyclopedias and anthologies, or performances, phonograms or
broadcasts, or other works or subject matter other than works listed
in Section 1(g) below, which, by reason of the selection and
arrangement of their contents, constitute intellectual creations, in
which the Work is included in its entirety in unmodified form along
with one or more other contributions, each constituting separate and
independent works in themselves, which together are assembled into a
collective whole. A work that constitutes a Collection will not be
considered an Adaptation (as defined above) for the purposes of this
License.
c. "Distribute" means to make available to the public the original and
copies of the Work or Adaptation, as appropriate, through sale or
other transfer of ownership.
d. "License Elements" means the following high-level license attributes
as selected by Licensor and indicated in the title of this License:
Attribution, Noncommercial, ShareAlike.
e. "Licensor" means the individual, individuals, entity or entities that
offer(s) the Work under the terms of this License.
f. "Original Author" means, in the case of a literary or artistic work,
the individual, individuals, entity or entities who created the Work
or if no individual or entity can be identified, the publisher; and in
addition (i) in the case of a performance the actors, singers,
musicians, dancers, and other persons who act, sing, deliver, declaim,
play in, interpret or otherwise perform literary or artistic works or
expressions of folklore; (ii) in the case of a phonogram the producer
being the person or legal entity who first fixes the sounds of a
performance or other sounds; and, (iii) in the case of broadcasts, the
organization that transmits the broadcast.
g. "Work" means the literary and/or artistic work offered under the terms
of this License including without limitation any production in the
literary, scientific and artistic domain, whatever may be the mode or
form of its expression including digital form, such as a book,
pamphlet and other writing; a lecture, address, sermon or other work
of the same nature; a dramatic or dramatico-musical work; a
choreographic work or entertainment in dumb show; a musical
composition with or without words; a cinematographic work to which are
assimilated works expressed by a process analogous to cinematography;
a work of drawing, painting, architecture, sculpture, engraving or
lithography; a photographic work to which are assimilated works
expressed by a process analogous to photography; a work of applied
art; an illustration, map, plan, sketch or three-dimensional work
relative to geography, topography, architecture or science; a
performance; a broadcast; a phonogram; a compilation of data to the
extent it is protected as a copyrightable work; or a work performed by
a variety or circus performer to the extent it is not otherwise
considered a literary or artistic work.
h. "You" means an individual or entity exercising rights under this
License who has not previously violated the terms of this License with
respect to the Work, or who has received express permission from the
Licensor to exercise rights under this License despite a previous
violation.
i. "Publicly Perform" means to perform public recitations of the Work and
to communicate to the public those public recitations, by any means or
process, including by wire or wireless means or public digital
performances; to make available to the public Works in such a way that
members of the public may access these Works from a place and at a
place individually chosen by them; to perform the Work to the public
by any means or process and the communication to the public of the
performances of the Work, including by public digital performance; to
broadcast and rebroadcast the Work by any means including signs,
sounds or images.
j. "Reproduce" means to make copies of the Work by any means including
without limitation by sound or visual recordings and the right of
fixation and reproducing fixations of the Work, including storage of a
protected performance or phonogram in digital form or other electronic
medium.
2. Fair Dealing Rights. Nothing in this License is intended to reduce,
limit, or restrict any uses free from copyright or rights arising from
limitations or exceptions that are provided for in connection with the
copyright protection under copyright law or other applicable laws.
3. License Grant. Subject to the terms and conditions of this License,
Licensor hereby grants You a worldwide, royalty-free, non-exclusive,
perpetual (for the duration of the applicable copyright) license to
exercise the rights in the Work as stated below:
a. to Reproduce the Work, to incorporate the Work into one or more
Collections, and to Reproduce the Work as incorporated in the
Collections;
b. to create and Reproduce Adaptations provided that any such Adaptation,
including any translation in any medium, takes reasonable steps to
clearly label, demarcate or otherwise identify that changes were made
to the original Work. For example, a translation could be marked "The
original work was translated from English to Spanish," or a
modification could indicate "The original work has been modified.";
c. to Distribute and Publicly Perform the Work including as incorporated
in Collections; and,
d. to Distribute and Publicly Perform Adaptations.
The above rights may be exercised in all media and formats whether now
known or hereafter devised. The above rights include the right to make
such modifications as are technically necessary to exercise the rights in
other media and formats. Subject to Section 8(f), all rights not expressly
granted by Licensor are hereby reserved, including but not limited to the
rights described in Section 4(e).
4. Restrictions. The license granted in Section 3 above is expressly made
subject to and limited by the following restrictions:
a. You may Distribute or Publicly Perform the Work only under the terms
of this License. You must include a copy of, or the Uniform Resource
Identifier (URI) for, this License with every copy of the Work You
Distribute or Publicly Perform. You may not offer or impose any terms
on the Work that restrict the terms of this License or the ability of
the recipient of the Work to exercise the rights granted to that
recipient under the terms of the License. You may not sublicense the
Work. You must keep intact all notices that refer to this License and
to the disclaimer of warranties with every copy of the Work You
Distribute or Publicly Perform. When You Distribute or Publicly
Perform the Work, You may not impose any effective technological
measures on the Work that restrict the ability of a recipient of the
Work from You to exercise the rights granted to that recipient under
the terms of the License. This Section 4(a) applies to the Work as
incorporated in a Collection, but this does not require the Collection
apart from the Work itself to be made subject to the terms of this
License. If You create a Collection, upon notice from any Licensor You
must, to the extent practicable, remove from the Collection any credit
as required by Section 4(d), as requested. If You create an
Adaptation, upon notice from any Licensor You must, to the extent
practicable, remove from the Adaptation any credit as required by
Section 4(d), as requested.
b. You may Distribute or Publicly Perform an Adaptation only under: (i)
the terms of this License; (ii) a later version of this License with
the same License Elements as this License; (iii) a Creative Commons
jurisdiction license (either this or a later license version) that
contains the same License Elements as this License (e.g.,
Attribution-NonCommercial-ShareAlike 3.0 US) ("Applicable License").
You must include a copy of, or the URI, for Applicable License with
every copy of each Adaptation You Distribute or Publicly Perform. You
may not offer or impose any terms on the Adaptation that restrict the
terms of the Applicable License or the ability of the recipient of the
Adaptation to exercise the rights granted to that recipient under the
terms of the Applicable License. You must keep intact all notices that
refer to the Applicable License and to the disclaimer of warranties
with every copy of the Work as included in the Adaptation You
Distribute or Publicly Perform. When You Distribute or Publicly
Perform the Adaptation, You may not impose any effective technological
measures on the Adaptation that restrict the ability of a recipient of
the Adaptation from You to exercise the rights granted to that
recipient under the terms of the Applicable License. This Section 4(b)
applies to the Adaptation as incorporated in a Collection, but this
does not require the Collection apart from the Adaptation itself to be
made subject to the terms of the Applicable License.
c. You may not exercise any of the rights granted to You in Section 3
above in any manner that is primarily intended for or directed toward
commercial advantage or private monetary compensation. The exchange of
the Work for other copyrighted works by means of digital file-sharing
or otherwise shall not be considered to be intended for or directed
toward commercial advantage or private monetary compensation, provided
there is no payment of any monetary compensation in con-nection with
the exchange of copyrighted works.
d. If You Distribute, or Publicly Perform the Work or any Adaptations or
Collections, You must, unless a request has been made pursuant to
Section 4(a), keep intact all copyright notices for the Work and
provide, reasonable to the medium or means You are utilizing: (i) the
name of the Original Author (or pseudonym, if applicable) if supplied,
and/or if the Original Author and/or Licensor designate another party
or parties (e.g., a sponsor institute, publishing entity, journal) for
attribution ("Attribution Parties") in Licensor's copyright notice,
terms of service or by other reasonable means, the name of such party
or parties; (ii) the title of the Work if supplied; (iii) to the
extent reasonably practicable, the URI, if any, that Licensor
specifies to be associated with the Work, unless such URI does not
refer to the copyright notice or licensing information for the Work;
and, (iv) consistent with Section 3(b), in the case of an Adaptation,
a credit identifying the use of the Work in the Adaptation (e.g.,
"French translation of the Work by Original Author," or "Screenplay
based on original Work by Original Author"). The credit required by
this Section 4(d) may be implemented in any reasonable manner;
provided, however, that in the case of a Adaptation or Collection, at
a minimum such credit will appear, if a credit for all contributing
authors of the Adaptation or Collection appears, then as part of these
credits and in a manner at least as prominent as the credits for the
other contributing authors. For the avoidance of doubt, You may only
use the credit required by this Section for the purpose of attribution
in the manner set out above and, by exercising Your rights under this
License, You may not implicitly or explicitly assert or imply any
connection with, sponsorship or endorsement by the Original Author,
Licensor and/or Attribution Parties, as appropriate, of You or Your
use of the Work, without the separate, express prior written
permission of the Original Author, Licensor and/or Attribution
Parties.
e. For the avoidance of doubt:
i. Non-waivable Compulsory License Schemes. In those jurisdictions in
which the right to collect royalties through any statutory or
compulsory licensing scheme cannot be waived, the Licensor
reserves the exclusive right to collect such royalties for any
exercise by You of the rights granted under this License;
ii. Waivable Compulsory License Schemes. In those jurisdictions in
which the right to collect royalties through any statutory or
compulsory licensing scheme can be waived, the Licensor reserves
the exclusive right to collect such royalties for any exercise by
You of the rights granted under this License if Your exercise of
such rights is for a purpose or use which is otherwise than
noncommercial as permitted under Section 4(c) and otherwise waives
the right to collect royalties through any statutory or compulsory
licensing scheme; and,
iii. Voluntary License Schemes. The Licensor reserves the right to
collect royalties, whether individually or, in the event that the
Licensor is a member of a collecting society that administers
voluntary licensing schemes, via that society, from any exercise
by You of the rights granted under this License that is for a
purpose or use which is otherwise than noncommercial as permitted
under Section 4(c).
f. Except as otherwise agreed in writing by the Licensor or as may be
otherwise permitted by applicable law, if You Reproduce, Distribute or
Publicly Perform the Work either by itself or as part of any
Adaptations or Collections, You must not distort, mutilate, modify or
take other derogatory action in relation to the Work which would be
prejudicial to the Original Author's honor or reputation. Licensor
agrees that in those jurisdictions (e.g. Japan), in which any exercise
of the right granted in Section 3(b) of this License (the right to
make Adaptations) would be deemed to be a distortion, mutilation,
modification or other derogatory action prejudicial to the Original
Author's honor and reputation, the Licensor will waive or not assert,
as appropriate, this Section, to the fullest extent permitted by the
applicable national law, to enable You to reasonably exercise Your
right under Section 3(b) of this License (right to make Adaptations)
but not otherwise.
5. Representations, Warranties and Disclaimer
UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN WRITING AND TO THE
FULLEST EXTENT PERMITTED BY APPLICABLE LAW, LICENSOR OFFERS THE WORK AS-IS
AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE
WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, INCLUDING, WITHOUT
LIMITATION, WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF LATENT OR OTHER DEFECTS,
ACCURACY, OR THE PRESENCE OF ABSENCE OF ERRORS, WHETHER OR NOT
DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED
WARRANTIES, SO THIS EXCLUSION MAY NOT APPLY TO YOU.
6. Limitation on Liability. EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE
LAW, IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR
ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES
ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR HAS
BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
7. Termination
a. This License and the rights granted hereunder will terminate
automatically upon any breach by You of the terms of this License.
Individuals or entities who have received Adaptations or Collections
from You under this License, however, will not have their licenses
terminated provided such individuals or entities remain in full
compliance with those licenses. Sections 1, 2, 5, 6, 7, and 8 will
survive any termination of this License.
b. Subject to the above terms and conditions, the license granted here is
perpetual (for the duration of the applicable copyright in the Work).
Notwithstanding the above, Licensor reserves the right to release the
Work under different license terms or to stop distributing the Work at
any time; provided, however that any such election will not serve to
withdraw this License (or any other license that has been, or is
required to be, granted under the terms of this License), and this
License will continue in full force and effect unless terminated as
stated above.
8. Miscellaneous
a. Each time You Distribute or Publicly Perform the Work or a Collection,
the Licensor offers to the recipient a license to the Work on the same
terms and conditions as the license granted to You under this License.
b. Each time You Distribute or Publicly Perform an Adaptation, Licensor
offers to the recipient a license to the original Work on the same
terms and conditions as the license granted to You under this License.
c. If any provision of this License is invalid or unenforceable under
applicable law, it shall not affect the validity or enforceability of
the remainder of the terms of this License, and without further action
by the parties to this agreement, such provision shall be reformed to
the minimum extent necessary to make such provision valid and
enforceable.
d. No term or provision of this License shall be deemed waived and no
breach consented to unless such waiver or consent shall be in writing
and signed by the party to be charged with such waiver or consent.
e. This License constitutes the entire agreement between the parties with
respect to the Work licensed here. There are no understandings,
agreements or representations with respect to the Work not specified
here. Licensor shall not be bound by any additional provisions that
may appear in any communication from You. This License may not be
modified without the mutual written agreement of the Licensor and You.
f. The rights granted under, and the subject matter referenced, in this
License were drafted utilizing the terminology of the Berne Convention
for the Protection of Literary and Artistic Works (as amended on
September 28, 1979), the Rome Convention of 1961, the WIPO Copyright
Treaty of 1996, the WIPO Performances and Phonograms Treaty of 1996
and the Universal Copyright Convention (as revised on July 24, 1971).
These rights and subject matter take effect in the relevant
jurisdiction in which the License terms are sought to be enforced
according to the corresponding provisions of the implementation of
those treaty provisions in the applicable national law. If the
standard suite of rights granted under applicable copyright law
includes additional rights not granted under this License, such
additional rights are deemed to be included in the License; this
License is not intended to restrict the license of any rights under
applicable law.
Creative Commons Notice
Creative Commons is not a party to this License, and makes no warranty
whatsoever in connection with the Work. Creative Commons will not be
liable to You or any party on any legal theory for any damages
whatsoever, including without limitation any general, special,
incidental or consequential damages arising in connection to this
license. Notwithstanding the foregoing two (2) sentences, if Creative
Commons has expressly identified itself as the Licensor hereunder, it
shall have all rights and obligations of Licensor.
Except for the limited purpose of indicating to the public that the
Work is licensed under the CCPL, Creative Commons does not authorize
the use by either party of the trademark "Creative Commons" or any
related trademark or logo of Creative Commons without the prior
written consent of Creative Commons. Any permitted use will be in
compliance with Creative Commons' then-current trademark usage
guidelines, as may be published on its website or otherwise made
available upon request from time to time. For the avoidance of doubt,
this trademark restriction does not form part of this License.
Creative Commons may be contacted at https://creativecommons.org/.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 164 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 159 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 138 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 167 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 135 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 97 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 105 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 90 KiB

BIN
docs/images/kxtj3.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

View File

@ -54,6 +54,27 @@ sudo apt-get install libupm-dev libupm-java python-upm python3-upm node-upm upm-
Running UPM applications on Ubuntu systems requires elevated permissions
(e.g. run with `sudo`).
### Fedora Linux
MRAA and UPM are available through the default package repositories on Fedora and can be
installed in the standard method using dnf.
To install:
```bash
sudo dnf install upm
sudo dnf install paython3-upm nodejs-upm upm-examples
```
### Installing for Red Hat Enterprise Linux, CentOS and Other Linux Distributions
The UPM project does not currently distribute official binaries for RHEL
or CentOS so developers will have to compile the project from sources as
described [here](./building.md).
For testing and development purposes it may be possible to share and install
.deb and .rpm packages across similar Linux builds.
### Node.js bindings only (NPM)
This option allows compiling MRAA/UPM on any system with npm and node-gyp.

View File

@ -14,8 +14,7 @@ First thing to do is to create a tree structure like this in upm/src/max31855:
* max31855.cxx
* max31855.hpp
* jsupm_max31855.i
* pyupm_max31855.i
* max31855.i
* CMakeLists.txt
And then an example file to use & test our lib with in upm/examples/max31855.cxx.

View File

@ -25,6 +25,4 @@ sensor can inherit your class if they only have minor changes.
### Doubt
If ever, give either of us a ping via email:
mihai.tudor.panu@intel.com or brendan.le.foll@intel.com
and we'll try suggest decent names for your module.
If ever, open a new issue and ask for naming help from the project's community.

View File

@ -59,7 +59,6 @@ the UPM build system.
The last step is when you're happy with your module and it works send us a pull
request! We'd love to include your sensor in our repository.
If you don't like github you can also send mihai.tudor.panu@intel.com a git
formatted patch of your sensor. More details are on @ref contributions and on
More details on @ref contributions and on
https://help.github.com/articles/creating-a-pull-request

View File

@ -702,7 +702,7 @@ CITE_BIB_FILES =
# messages are off.
# The default value is: NO.
QUIET = NO
QUIET = YES
# The WARNINGS tag can be used to turn on/off the warning messages that are
# generated to standard error ( stderr) by doxygen. If WARNINGS is set to YES

View File

@ -702,7 +702,7 @@ CITE_BIB_FILES =
# messages are off.
# The default value is: NO.
QUIET = NO
QUIET = YES
# The WARNINGS tag can be used to turn on/off the warning messages that are
# generated to standard error ( stderr) by doxygen. If WARNINGS is set to YES

View File

@ -34,13 +34,6 @@ var lib = require('jsupm_<module-name>');
### Supported Sensors
The full list is available on [Intel® IoT Developer Zone](https://software.intel.com/en-us/iot/hardware/sensors).
### IDE Integration
Intel® XDK IoT Edition is the recommended IDE for Node.js development. Visit
the Intel® Developer Zone [IDE page](https://software.intel.com/iot/software/ide)
for more information on how to get started.
![Intel XDK](http://iotdk.intel.com/docs/master/upm/docs/icons/xdk.png)
### Building UPM
See building documentation [here](https://github.com/intel-iot-devkit/upm/blob/master/docs/building.md).

View File

@ -23,15 +23,6 @@ repository.
Individual sensor usage examples for Python are available `here <https://github.com/intel-iot-devkit/upm/tree/master/examples/python>`_.
``IDE Compatibility``
################
While there is no official IDE provided with our Python libraries, we do recommend the web-based IDE Wyliodrin. It can be used with multiple programming
languages, including Python. More information can be found on the Intel Developer Zone IDE page.
.. image:: ../docs/icons/wyliodrin.png
:target: https://software.intel.com/iot/software/ide
``Making your own UPM Module``
##############################

View File

@ -18,7 +18,7 @@
<p>
The UPM API is a high level sensor library for IoT devices using MRAA. See examples <a href="https://github.com/intel-iot-devkit/upm/tree/master/examples/javascript">here</a>.
Back to <a href="http://iotdk.intel.com/docs/master/upm/node/"> index </a> page.
<br><em>SparkFun sensor images provided under <a href=https://creativecommons.org/licenses/by-nc-sa/3.0/>CC BY-NC-SA-3.0</a>.</em>
<br><em>SparkFun sensor images provided under <a href=https://creativecommons.org/licenses/by/2.0/>CC BY 2.0</a>.</em>
</p>
</div>
</div>

View File

@ -36,19 +36,6 @@
href="https://github.com/intel-iot-devkit/upm/tree/master/examples/javascript">here</a>.</p>
</div>
<div class="section" id="ide">
<h3><tt class="docutils literal"><span class="pre">IDE Compatibility</span>
<span class="pre">UPM</span></tt><a class="headerlink"
href="#ide"
title="Permalink to this headline">*</a></h3>
<p>Intel&reg; XDK IoT Edition is the recommended IDE for Node.js development.
Visit the Intel&reg; Developer Zone IDE page for more information on how to get
started.<br>
<a href="https://software.intel.com/iot/software/ide"><img src="../docs/icons/xdk.png"/></a>
</p>
</div>
<div class="section" id="building-upm">
<h3><tt class="docutils literal"><span class="pre">Building</span>
<span class="pre">UPM</span></tt><a class="headerlink"

View File

@ -1,79 +1,82 @@
# Mapping examples across provided languages
a110x.cxx A110XSample.java a110x.js a110x.py
a110x-intr.cxx A110X_intrSample.java a110x-intr.js a110x-intr.py
adc121c021.cxx ADC121C021Sample.java adc121c021.js adc121c021.py
adxl345.cxx Adxl345Sample.java adxl345.js adxl345.py
biss0001.cxx BISS0001Sample.java biss0001.js biss0001.py
bmpx8x.cxx BMPX8XSample.java bmpx8x.js bmpx8x.py
bno055.cxx BNO055_Example.java bno055.js bno055.py
button.cxx ButtonSample.java button.js button.py
buzzer.cxx BuzzerSample.java buzzer.js buzzer.py
cjq4435.cxx CJQ4435Sample.java cjq4435.js cjq4435.py
ds1307.cxx DS1307Sample.java ds1307.js ds1307.py
enc03r.cxx ENC03RSample.java enc03r.js enc03r.py
servo-es08a.cxx ES08ASample.java es08a.js es08a.py
groveehr.cxx GroveEHRSample.java groveehr.js groveehr.py
my9221-groveledbar.cxx GroveLEDBar.java groveledbar.js groveledbar.py
grove-groveled.cxx GroveLEDSample.java groveled.js groveled.py
grovelinefinder.cxx GroveLineFinderSample.java grovelinefinder.js grovelinefinder.py
grovemoisture.cxx GroveMoistureSample.java grovemoisture.js grovemoisture.py
grovescam.cxx GROVESCAMSample.java grovescam.js grovescam.py
grovewfs.cxx GroveWFSSample.java grovewfs.js grovewfs.py
guvas12d.cxx GUVAS12DSample.java guvas12d.js guvas12d.py
h3lis331dl.cxx H3LIS331DLSample.java h3lis331dl.js h3lis331dl.py
hcsr04.cxx HCSR04Sample.java hcsr04.js hcsr04.py
hm11.cxx HM11Sample.java hm11.js hm11.py
hmc5883l.cxx Hmc5883lSample.java hmc5883l.js hmc5883l.py
htu21d.cxx HTU21DSample.java htu21d.js htu21d.py
ims.cxx IMS_Example.java ims.js ims.py
itg3200.cxx Itg3200Sample.java itg3200.js itg3200.py
jhd1313m1-lcd.cxx Jhd1313m1_lcdSample.java jhd1313m1-lcd.js jhd1313m1-lcd.py
joystick12.cxx Joystick12Sample.java joystick12.js joystick12.py
lcm1602-i2c.cxx Lcm1602_i2cSample.java lcm1602-i2c.js lcm1602-i2c.py
ldt0028.cxx LDT0028Sample.java ldt0028.js ldt0028.py
light.cxx LightSample.java light.js light.py
lol.cxx LoLSample.java lol.js lol.py
lsm303dlh.cxx LSM303DLHSample.java lsm303dlh.js lsm303dlh.py
m24lr64e.cxx M24LR64ESample.java m24lr64e.js m24lr64e.py
max44000.cxx MAX44000Sample.java max44000.js max44000.py
mic.cxx MicrophoneSample.java mic.js mic.py
mma7455.cxx MMA7455Sample.java mma7455.js mma7455.py
mma7660.cxx MMA7660Sample.java mma7660.js mma7660.py
mpl3115a2.cxx MPL3115A2Sample.java mpl3115a2.js mpl3115a2.py
mpr121.cxx MPR121Sample.java mpr121.js mpr121.py
mpu9150.cxx MPU9150Sample.java mpu9150.js mpu9150.py
gas-mq2.cxx MQ2Sample.java mq2.js mq2.py
mq303a.cxx MQ303ASample.java mq303a.js mq303a.py
gas-mq5.cxx MQ5Sample.java mq5.js mq5.py
nrf24l01-receiver.cxx NRF24L01_receiverSample.java nrf24l01-receiver.js nrf24l01-receiver.py
nrf24l01-transmitter.cxx NRF24L01_transmitterSample.java nrf24l01-transmitter.js nrf24l01-transmitter.py
nunchuck.cxx NUNCHUCKSample.java nunchuck.js nunchuck.py
otp538u.cxx OTP538USample.java otp538u.js otp538u.py
ppd42ns.cxx PPD42NSSample.java ppd42ns.js ppd42ns.py
pulsensor.cxx PulsensorSample.java pulsensor.js pulsensor.py
relay.cxx RelaySample.java relay.js relay.py
rfr359f.cxx RFR359FSample.java rfr359f.js rfr359f.py
rotary.cxx RotarySample.java rotary.js rotary.py
rotaryencoder.cxx RotaryEncoderSample.java rotaryencoder.js rotaryencoder.py
rpr220.cxx RPR220Sample.java rpr220.js rpr220.py
rpr220-intr.cxx RPR220_intrSample.java rpr220-intr.js rpr220-intr.py
slide.cxx SlideSample.java slide.js slide.py
speaker.cxx SpeakerSample.java speaker.js speaker.py
i2clcd-ssd1308-oled.cxx SSD1308_oledSample.java ssd1308-oled.js ssd1308-oled.py
i2clcd-ssd1327-oled.cxx SSD1327_oledSample.java ssd1327-oled.js ssd1327-oled.py
st7735.cxx ST7735Sample.java st7735.js st7735.py
stepmotor.cxx StepMotorSample.java stepmotor.js stepmotor.py
tm1637.cxx TM1637Sample.java tm1637.js tm1637.py
gas-tp401.cxx TP401Sample.java tp401.js tp401.py
tsl2561.cxx TSL2561Sample.java tsl2561.js tsl2561.py
ttp223.cxx TTP223Sample.java ttp223.js ttp223.py
uln200xa.cxx ULN200XASample.java uln200xa.js uln200xa.py
vdiv.cxx VDivSample.java vdiv.js vdiv.py
water.cxx WaterSample.java water.js water.py
wt5001.cxx WT5001Sample.java wt5001.js wt5001.py
yg1006.cxx YG1006Sample.java yg1006.js yg1006.py
sensortemplate.cxx SensorTemplateSample.java sensortemplate.js sensortemplate.py
p9813.cxx P9813Sample.java p9813.js p9813.py
a110x.cxx A110X_Example.java a110x.js a110x.py
a110x-intr.cxx A110X_intr_Example.java a110x-intr.js a110x-intr.py
adc121c021.cxx ADC121C021_Example.java adc121c021.js adc121c021.py
adxl345.cxx Adxl345_Example.java adxl345.js adxl345.py
bh1749.cxx BH1749_Example.java bh1749.js bh1749.py
bh1750.cxx BH1750_Example.java bh1750.js bh1750.py
bh1792.cxx BH1792_Example.java bh1792.js bh1792.py
biss0001.cxx BISS0001_Example.java biss0001.js biss0001.py
bmpx8x.cxx BMPX8X_Example.java bmpx8x.js bmpx8x.py
bno055.cxx BNO055_Example.java bno055.js bno055.py
button.cxx Button_Example.java button.js button.py
buzzer.cxx Buzzer_Example.java buzzer.js buzzer.py
cjq4435.cxx CJQ4435_Example.java cjq4435.js cjq4435.py
ds1307.cxx DS1307_Example.java ds1307.js ds1307.py
enc03r.cxx ENC03R_Example.java enc03r.js enc03r.py
servo-es08a.cxx ES08A_Example.java es08a.js es08a.py
groveehr.cxx GroveEHR_Example.java groveehr.js groveehr.py
my9221-groveledbar.cxx GroveLEDBar_Example.java groveledbar.js groveledbar.py
grove-groveled.cxx GroveLED_Example.java groveled.js groveled.py
grovelinefinder.cxx GroveLineFinder_Example.java grovelinefinder.js grovelinefinder.py
grovemoisture.cxx GroveMoisture_Example.java grovemoisture.js grovemoisture.py
grovescam.cxx GROVESCAM_Example.java grovescam.js grovescam.py
grovewfs.cxx GroveWFS_Example.java grovewfs.js grovewfs.py
guvas12d.cxx GUVAS12D_Example.java guvas12d.js guvas12d.py
h3lis331dl.cxx H3LIS331DL_Example.java h3lis331dl.js h3lis331dl.py
hcsr04.cxx HCSR04_Example.java hcsr04.js hcsr04.py
hm11.cxx HM11_Example.java hm11.js hm11.py
hmc5883l.cxx Hmc5883l_Example.java hmc5883l.js hmc5883l.py
htu21d.cxx HTU21D_Example.java htu21d.js htu21d.py
ims.cxx IMS_Example.java ims.js ims.py
itg3200.cxx Itg3200_Example.java itg3200.js itg3200.py
jhd1313m1-lcd.cxx Jhd1313m1_lcd_Example.java jhd1313m1-lcd.js jhd1313m1-lcd.py
joystick12.cxx Joystick12_Example.java joystick12.js joystick12.py
lcm1602-i2c.cxx Lcm1602_i2c_Example.java lcm1602-i2c.js lcm1602-i2c.py
ldt0028.cxx LDT0028_Example.java ldt0028.js ldt0028.py
light.cxx Light_Example.java light.js light.py
lol.cxx LoL_Example.java lol.js lol.py
lsm303dlh.cxx LSM303DLH_Example.java lsm303dlh.js lsm303dlh.py
m24lr64e.cxx M24LR64E_Example.java m24lr64e.js m24lr64e.py
max44000.cxx MAX44000_Example.java max44000.js max44000.py
mic.cxx Microphone_Example.java mic.js mic.py
mma7455.cxx MMA7455_Example.java mma7455.js mma7455.py
mma7660.cxx MMA7660_Example.java mma7660.js mma7660.py
mpl3115a2.cxx MPL3115A2_Example.java mpl3115a2.js mpl3115a2.py
mpr121.cxx MPR121_Example.java mpr121.js mpr121.py
mpu9150.cxx MPU9150_Example.java mpu9150.js mpu9150.py
gas-mq2.cxx MQ2_Example.java mq2.js mq2.py
mq303a.cxx MQ303A_Example.java mq303a.js mq303a.py
gas-mq5.cxx MQ5_Example.java mq5.js mq5.py
nrf24l01-receiver.cxx NRF24L01_receiver_Example.java nrf24l01-receiver.js nrf24l01-receiver.py
nrf24l01-transmitter.cxx NRF24L01_transmitter_Example.java nrf24l01-transmitter.js nrf24l01-transmitter.py
nunchuck.cxx NUNCHUCK_Example.java nunchuck.js nunchuck.py
otp538u.cxx OTP538U_Example.java otp538u.js otp538u.py
ppd42ns.cxx PPD42NS_Example.java ppd42ns.js ppd42ns.py
pulsensor.cxx Pulsensor_Example.java pulsensor.js pulsensor.py
relay.cxx Relay_Example.java relay.js relay.py
rfr359f.cxx RFR359F_Example.java rfr359f.js rfr359f.py
rotary.cxx Rotary_Example.java rotary.js rotary.py
rotaryencoder.cxx RotaryEncoder_Example.java rotaryencoder.js rotaryencoder.py
rpr220.cxx RPR220_Example.java rpr220.js rpr220.py
rpr220-intr.cxx RPR220_intr_Example.java rpr220-intr.js rpr220-intr.py
slide.cxx Slide_Example.java slide.js slide.py
speaker.cxx Speaker_Example.java speaker.js speaker.py
lcd-ssd1308-oled.cxx SSD1308_oled_Example.java ssd1308-oled.js ssd1308-oled.py
lcd-ssd1327-oled.cxx SSD1327_oled_Example.java ssd1327-oled.js ssd1327-oled.py
st7735.cxx ST7735_Example.java st7735.js st7735.py
stepmotor.cxx StepMotor_Example.java stepmotor.js stepmotor.py
tm1637.cxx TM1637_Example.java tm1637.js tm1637.py
gas-tp401.cxx TP401_Example.java tp401.js tp401.py
tsl2561.cxx TSL2561_Example.java tsl2561.js tsl2561.py
ttp223.cxx TTP223_Example.java ttp223.js ttp223.py
uln200xa.cxx ULN200XA_Example.java uln200xa.js uln200xa.py
vdiv.cxx VDiv_Example.java vdiv.js vdiv.py
water.cxx Water_Example.java water.js water.py
wt5001.cxx WT5001_Example.java wt5001.js wt5001.py
yg1006.cxx YG1006_Example.java yg1006.js yg1006.py
sensortemplate.cxx SensorTemplate_Example.java sensortemplate.js sensortemplate.py
p9813.cxx P9813_Example.java p9813.js p9813.py
tcs37727.cxx tcs37727.py
tmp006.cxx tmp006.py
mma8x5x.cxx mma8x5x.py

View File

@ -41,7 +41,7 @@
# a110x.c Requires libupmc-a110x
# lcm1602-i2c.c Requires libupmc-lcm1602
# bmp280-bme280.c Requires libupmc-bmp280
# i2clcd-eboled.cxx Requires libupm-i2clcd
# lcd-eboled.cxx Requires libupm-lcd
#
#
function (add_example example_src)
@ -117,4 +117,16 @@ if(BUILDEXAMPLES)
if(BUILDSWIGJAVA)
add_subdirectory (java)
endif()
# Add all examples as an install component (if building examples)
install (DIRECTORY ${PROJECT_SOURCE_DIR}/examples
DESTINATION ${CMAKE_INSTALL_DATADIR}/upm
COMPONENT ${CMAKE_PROJECT_NAME}-examples
FILES_MATCHING
PATTERN "*.c"
PATTERN "*.cxx"
PATTERN "*.hpp"
PATTERN "*.java"
PATTERN "*.js"
PATTERN "*.py")
endif()

View File

@ -0,0 +1,528 @@
/*
* Author: Hiroyuki Mino <omronsupportupm@omron.com>
* Copyright (c) 2019 Omron Electronic Components - Americas
*
* This program and the accompanying materials are made available under the
* terms of the The MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
*/
/* standard headers */
#include <iostream>
#include <signal.h>
#include <stdlib.h>
#include <unistd.h>
/* omron sensor headers */
#include "2jciebu01_ble.hpp"
using namespace std;
using namespace upm;
#define PREVIOUS_MENU_CHOICE 8
volatile sig_atomic_t flag = 1;
upm::OM2JCIEBU_BLE::om2jciebuData_t om2jciebuSensorData;
void
sig_handler(int signum)
{
if(signum == SIGABRT) {
std::cout << "Exiting..." << std::endl;
}
if(signum == SIGINT) {
flag = 0;
}
}
void getSensorData(OM2JCIEBU_BLE *p_om2jcieble)
{
if(p_om2jcieble == NULL) {
std::cout << "Null pointer received..." << std::endl;
return;
}
uint16_t parameterChoice = 0;
int displayDelay = 0;
uint16_t sensorParamData = 0;
uint32_t pressureData = 0;
bool seconds_validate = false;
p_om2jcieble->getDiscoveredServices(OM2JCIEBU_BLE::ALL_PARAM);
while(true) {
printf("************************************************************\r\n");
printf("Please select sensor attribute for display\r\n");
printf("0) All parameter\r\n");
printf("1) Temperature data\r\n");
printf("2) Relative humidity data\r\n");
printf("3) Ambient light data\r\n");
printf("4) Barometric pressure data\r\n");
printf("5) Sound noise data\r\n");
printf("6) eTVOC data\r\n");
printf("7) eCO2 data\r\n");
printf("8) Return to main menu\r\n");
printf("Note :: Press Ctrl+C for sensor attribute display menu\r\n");
printf("************************************************************\r\n");
while(!(std::cin >> parameterChoice)) {
std::cin.clear(); //clear bad input flag
std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n'); //discard input
std::cout << "Invalid input; please re-enter.\n";
}
if(parameterChoice >= OM2JCIEBU_BLE::ALL_PARAM && parameterChoice <= OM2JCIEBU_BLE::ECO2) {
flag = 1;
printf("Please enter time interval (in Seconds), for display sensor data\r\n");
while(!seconds_validate) {
cin >> displayDelay;
if(!cin.fail() && (cin.peek() == EOF || cin.peek() == '\n') && (displayDelay >= 1 && displayDelay <= 10)) {
seconds_validate = true;
} else {
cin.clear();
cin.ignore();
cout << "Error, enter an second between 1 to 10!" << endl;
}
}
while(flag) {
switch(parameterChoice) {
case OM2JCIEBU_BLE::ALL_PARAM:
if(p_om2jcieble->getSensorData(OM2JCIEBU_BLE::ALL_PARAM, &om2jciebuSensorData) == OM2JCIEBU_BLE::SUCCESS) {
printf("************** Sensor Attribute Values ***************\r\n");
printf("Sequence Number :: %d \r\n", om2jciebuSensorData.sequence_number);
printf("Temperature :: %d degC\r\n", om2jciebuSensorData.temperature);
printf("Relative humidity :: %d RH\r\n", om2jciebuSensorData.relative_humidity);
printf("Ambient light :: %d lx\r\n", om2jciebuSensorData.ambient_light);
printf("Barometric pressure :: %d hPa\r\n", om2jciebuSensorData.pressure);
printf("Sound noise :: %d dB\r\n", om2jciebuSensorData.noise);
printf("eTVOC :: %d ppb\r\n", om2jciebuSensorData.eTVOC);
printf("eCO2 :: %d ppm\r\n", om2jciebuSensorData.eCO2);
printf("**********************************************************\r\n");
memset(&om2jciebuSensorData, 0, sizeof(om2jciebuSensorData));
} else {
flag = 0;
}
break;
case OM2JCIEBU_BLE::TEMP:
if(p_om2jcieble->getSensorData(OM2JCIEBU_BLE::TEMP, &sensorParamData) == OM2JCIEBU_BLE::SUCCESS) {
printf("************** Temperature Attribute Values ***************\r\n");
printf("Temperature :: %d degC\r\n", sensorParamData);
printf("************************************************************\r\n");
} else {
flag = 0;
}
break;
case OM2JCIEBU_BLE::HUMIDITY:
if(p_om2jcieble->getSensorData(OM2JCIEBU_BLE::HUMIDITY, &sensorParamData) == OM2JCIEBU_BLE::SUCCESS) {
printf("************** Relative humidity Attribute Values ***************\r\n");
printf("Relative humidity :: %d RH\r\n", sensorParamData);
printf("******************************************************************\r\n");
} else {
flag = 0;
}
break;
case OM2JCIEBU_BLE::AMBIENT_LIGHT:
if(p_om2jcieble->getSensorData(OM2JCIEBU_BLE::AMBIENT_LIGHT, &sensorParamData) == OM2JCIEBU_BLE::SUCCESS) {
printf("************** Ambient light Attribute Values ***************\r\n");
printf("Ambient light :: %d lx\r\n", sensorParamData);
printf("***************************************************************\r\n");
} else {
flag = 0;
}
break;
case OM2JCIEBU_BLE::PRESSURE:
if(p_om2jcieble->getSensorData(OM2JCIEBU_BLE::PRESSURE, &pressureData) == OM2JCIEBU_BLE::SUCCESS) {
printf("************** Barometric pressure Attribute Values ***************\r\n");
printf("Barometric pressure :: %d hPa\r\n", pressureData);
printf("********************************************************************\r\n");
}
break;
case OM2JCIEBU_BLE::NOISE:
if(p_om2jcieble->getSensorData(OM2JCIEBU_BLE::NOISE, &sensorParamData) == OM2JCIEBU_BLE::SUCCESS) {
printf("************** Sound noise Attribute Values ***************\r\n");
printf("Sound noise :: %d dB\r\n", sensorParamData);
printf("*************************************************************\r\n");
} else {
flag = 0;
}
break;
case OM2JCIEBU_BLE::ETVOC:
if(p_om2jcieble->getSensorData(OM2JCIEBU_BLE::ETVOC, &sensorParamData) == OM2JCIEBU_BLE::SUCCESS) {
printf("************** eTVOC Attribute Values ***************\r\n");
printf("eTVOC :: %d ppb\r\n", sensorParamData);
printf("*******************************************************\r\n");
} else {
flag = 0;
}
break;
case OM2JCIEBU_BLE::ECO2:
if(p_om2jcieble->getSensorData(OM2JCIEBU_BLE::ECO2, &sensorParamData) == OM2JCIEBU_BLE::SUCCESS) {
printf("************** eCO2 Attribute Values ***************\r\n");
printf("eCO2 :: %d ppm\r\n\r\n", sensorParamData);
printf("******************************************************\r\n");
} else {
flag = 0;
}
break;
}
printf("\r\n");
p_om2jcieble->delay(displayDelay);
}
} else if(parameterChoice == PREVIOUS_MENU_CHOICE) {
break;
} else {
printf("Invalid choice\r\n");
}
seconds_validate = false;
}
}
void getAdvSensorData(OM2JCIEBU_BLE *p_om2jcieble)
{
if(p_om2jcieble == NULL) {
std::cout << "Null pointer received..." << std::endl;
return;
}
uint16_t parameterChoice = 0, sensorParamData = 0;
int displayDelay = 0;
uint32_t pressureData = 0;
bool seconds_validate = false;
while(true) {
printf("************************************************************\r\n");
printf("Please select sensor attribute for display\r\n");
printf("0) All parameter\r\n");
printf("1) Temperature data\r\n");
printf("2) Relative humidity data\r\n");
printf("3) Ambient light data\r\n");
printf("4) Barometric pressure data\r\n");
printf("5) Sound noise data\r\n");
printf("6) eTVOC data\r\n");
printf("7) eCO2 data\r\n");
printf("8) Return to main menu\r\n");
printf("Note :: Press Ctrl+C for sensor attribute display menu\r\n");
printf("************************************************************\r\n");
while(!(std::cin >> parameterChoice)) {
std::cin.clear(); //clear bad input flag
std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n'); //discard input
std::cout << "Invalid input; please re-enter.\n";
}
if(parameterChoice >= OM2JCIEBU_BLE::ALL_PARAM && parameterChoice <= OM2JCIEBU_BLE::ECO2) {
flag = 1;
printf("Please enter time interval (in Seconds), for display sensor data\r\n");
while(!seconds_validate) {
cin >> displayDelay;
if(!cin.fail() && (cin.peek() == EOF || cin.peek() == '\n') && (displayDelay >= 1 && displayDelay <= 10)) {
seconds_validate = true;
} else {
cin.clear();
cin.ignore();
cout << "Error, enter an second between 1 and 10!" << endl;
}
}
while(flag) {
switch(parameterChoice) {
case OM2JCIEBU_BLE::ALL_PARAM:
if(p_om2jcieble->getAdvSensorData(OM2JCIEBU_BLE::ALL_PARAM, &om2jciebuSensorData) == OM2JCIEBU_BLE::SUCCESS) {
printf("************** Advertisement Sensor Attribute Values ***************\r\n");
printf("Sequence Number :: %d \r\n", om2jciebuSensorData.sequence_number);
printf("Temperature :: %d degC\r\n", om2jciebuSensorData.temperature);
printf("Relative humidity :: %d RH\r\n", om2jciebuSensorData.relative_humidity);
printf("Ambient light :: %d lx\r\n", om2jciebuSensorData.ambient_light);
printf("Barometric pressure :: %d hPa\r\n", om2jciebuSensorData.pressure);
printf("Sound noise :: %d dB\r\n", om2jciebuSensorData.noise);
printf("eTVOC :: %d ppb\r\n", om2jciebuSensorData.eTVOC);
printf("eCO2 :: %d ppm\r\n", om2jciebuSensorData.eCO2);
printf("*********************************************************************\r\n");
memset(&om2jciebuSensorData, 0, sizeof(om2jciebuSensorData));
} else {
flag = 0;
}
break;
case OM2JCIEBU_BLE::TEMP:
if(p_om2jcieble->getAdvSensorData(OM2JCIEBU_BLE::TEMP, &sensorParamData) == OM2JCIEBU_BLE::SUCCESS) {
printf("************** Advertisement Temperature Attribute Values ***************\r\n");
printf("Temperature :: %d degC\r\n", sensorParamData);
printf("**************************************************************************\r\n");
} else {
flag = 0;
}
break;
case OM2JCIEBU_BLE::HUMIDITY:
if(p_om2jcieble->getAdvSensorData(OM2JCIEBU_BLE::HUMIDITY, &sensorParamData) == OM2JCIEBU_BLE::SUCCESS) {
printf("************** Advertisement Relative humidity Attribute Values ***************\r\n");
printf("Relative humidity :: %d RH\r\n", sensorParamData);
printf("********************************************************************************\r\n");
} else {
flag = 0;
}
break;
case OM2JCIEBU_BLE::AMBIENT_LIGHT:
if(p_om2jcieble->getAdvSensorData(OM2JCIEBU_BLE::AMBIENT_LIGHT, &sensorParamData) == OM2JCIEBU_BLE::SUCCESS) {
printf("************** Advertisement Ambient light Attribute Values ***************\r\n");
printf("Ambient light :: %d lx\r\n", sensorParamData);
printf("***************************************************************************\r\n");
} else {
flag = 0;
}
break;
case OM2JCIEBU_BLE::PRESSURE:
if(p_om2jcieble->getAdvSensorData(OM2JCIEBU_BLE::PRESSURE, &pressureData) == OM2JCIEBU_BLE::SUCCESS) {
printf("************** Advertisement Barometric pressure Attribute Values ***************\r\n");
printf("Barometric pressure :: %d hPa\r\n", pressureData);
printf("*********************************************************************************\r\n");
} else {
flag = 0;
}
break;
case OM2JCIEBU_BLE::NOISE:
if(p_om2jcieble->getAdvSensorData(OM2JCIEBU_BLE::NOISE, &sensorParamData) == OM2JCIEBU_BLE::SUCCESS) {
printf("************** Advertisement Sound noise Attribute Values ***************\r\n");
printf("Sound noise :: %d dB\r\n", sensorParamData);
printf("*************************************************************************\r\n");
} else {
flag = 0;
}
break;
case OM2JCIEBU_BLE::ETVOC:
if(p_om2jcieble->getAdvSensorData(OM2JCIEBU_BLE::ETVOC, &sensorParamData) == OM2JCIEBU_BLE::SUCCESS) {
printf("**************** Advertisement eTVOC Attribute Values ******************\r\n");
printf("eTVOC :: %d ppb\r\n", sensorParamData);
printf("************************************************************************\r\n");
} else {
flag = 0;
}
break;
case OM2JCIEBU_BLE::ECO2:
if(p_om2jcieble->getAdvSensorData(OM2JCIEBU_BLE::ECO2, &sensorParamData) == OM2JCIEBU_BLE::SUCCESS) {
printf("************** Advertisement eCO2 Attribute Values ***************\r\n");
printf("eCO2 :: %d ppm\r\n\r\n", sensorParamData);
printf("******************************************************************\r\n");
} else {
flag = 0;
}
break;
}
printf("\r\n");
p_om2jcieble->delay(displayDelay);
}
} else if(parameterChoice == PREVIOUS_MENU_CHOICE) {
break;
} else {
printf("Invalid choice\r\n");
}
seconds_validate = false;
}
}
void configureLEDSetting(OM2JCIEBU_BLE *p_om2jcieble)
{
if(p_om2jcieble == NULL) {
std::cout << "Null pointer received..." << std::endl;
return;
}
int led_choice = 0;
unsigned short int red_scale = 0, green_scale = 0, blue_scale = 0;
bool red_scale_validate = false, green_scale_validate = false, blue_scale_validate = false;
printf("************** Sensor LED Configuration ***************\r\n");
printf("Please select a operation for LED\r\n");
printf("0) Normally OFF\r\n");
printf("1) Normally ON\r\n");
printf("2) Temperature value scales\r\n");
printf("3) Relative humidity value scales\r\n");
printf("4) Ambient light value scales\r\n");
printf("5) Barometric pressure value scales\r\n");
printf("6) Sound noise value scales\r\n");
printf("7) eTVOC value scales\r\n");
printf("8) SI vale scales\r\n");
printf("9) PGA value scales\r\n");
printf("**********************************************************\r\n");
while(!(std::cin >> led_choice)) {
std::cin.clear(); //clear bad input flag
std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n'); //discard input
std::cout << "Invalid input; please re-enter.\n";
}
if(led_choice == OM2JCIEBU_BLE::NORMALLY_ON) {
printf("Please select a LED color scale\r\n");
printf("Please enter Red Color scale (scale range 0 to 255)\r\n");
while(!red_scale_validate) {
cin >> red_scale;
if(!cin.fail() && (cin.peek() == EOF || cin.peek() == '\n') && (red_scale >= 0 && red_scale <= 255)) {
red_scale_validate = true;
} else {
cin.clear();
cin.ignore();
cout << "Error, enter an red color scale between 0 and 255!" << endl;
}
}
printf("Please enter Green Color scale(scale range 0 to 255)\r\n");
while(!green_scale_validate) {
cin >> green_scale;
if(!cin.fail() && (cin.peek() == EOF || cin.peek() == '\n') && (green_scale >= 0 && green_scale <= 255)) {
green_scale_validate = true;
} else {
cin.clear();
cin.ignore();
cout << "Error, enter an green color scale between 0 and 255!" << endl;
}
}
printf("Please enter Blue Color scale(scale range 0 to 255)\r\n");
while(!blue_scale_validate) {
cin >> blue_scale;
if(!cin.fail() && (cin.peek() == EOF || cin.peek() == '\n') && (blue_scale >= 0 && blue_scale <= 255)) {
blue_scale_validate = true;
} else {
cin.clear();
cin.ignore();
cout << "Error, enter an blue color scale between 0 and 255!" << endl;
}
}
p_om2jcieble->configureSensorLedState(OM2JCIEBU_BLE::NORMALLY_ON, red_scale, green_scale, blue_scale);
} else {
switch(led_choice) {
case OM2JCIEBU_BLE::NORMALLY_OFF:
p_om2jcieble->configureSensorLedState(OM2JCIEBU_BLE::NORMALLY_OFF, 0, 0, 0);
break;
case OM2JCIEBU_BLE::TEMP_SACLE:
p_om2jcieble->configureSensorLedState(OM2JCIEBU_BLE::TEMP_SACLE, 0, 0, 0);
break;
case OM2JCIEBU_BLE::HUMIDITY_SCALE:
p_om2jcieble->configureSensorLedState(OM2JCIEBU_BLE::HUMIDITY_SCALE, 0, 0, 0);
break;
case OM2JCIEBU_BLE::AMBIENT_LIGHT_SCALE:
p_om2jcieble->configureSensorLedState(OM2JCIEBU_BLE::AMBIENT_LIGHT_SCALE, 0, 0, 0);
break;
case OM2JCIEBU_BLE::PRESSURE_SCALE:
p_om2jcieble->configureSensorLedState(OM2JCIEBU_BLE::PRESSURE_SCALE, 0, 0, 0);
break;
case OM2JCIEBU_BLE::NOISE_SCALE:
p_om2jcieble->configureSensorLedState(OM2JCIEBU_BLE::NOISE_SCALE, 0, 0, 0);
break;
case OM2JCIEBU_BLE::ETVOC_SCALE:
p_om2jcieble->configureSensorLedState(OM2JCIEBU_BLE::ETVOC_SCALE, 0, 0, 0);
break;
case OM2JCIEBU_BLE::SI_SCALE:
p_om2jcieble->configureSensorLedState(OM2JCIEBU_BLE::SI_SCALE, 0, 0, 0);
break;
case OM2JCIEBU_BLE::PGA_SCALE:
p_om2jcieble->configureSensorLedState(OM2JCIEBU_BLE::PGA_SCALE, 0, 0, 0);
break;
default:
std::cout << "Wrong LED scale choice please try again" << std::endl;
}
}
}
void configureAdvInterval(OM2JCIEBU_BLE *p_om2jcieble)
{
if(p_om2jcieble == NULL) {
std::cout << "Null pointer received..." << std::endl;
return;
}
uint16_t millisecond = 0;
bool milisecond_validate = false;
int advertising_mode = 0;
printf("************** Sensor Advertise Configuration ***************\r\n");
printf("Please enter time interval (in Milliseconds), for changing Advertise interval, between 100 to 10240 milliseconds\r\n");
while(!milisecond_validate) {
cin >> millisecond;
if(!cin.fail() && (cin.peek() == EOF || cin.peek() == '\n') && (millisecond >= 100 && millisecond <= 10240)) {
milisecond_validate = true;
} else {
cin.clear();
cin.ignore();
cout << "Error, enter an millisecond between 100 and 10240!" << endl;
}
}
printf("Please select an Advertise mode with the selected Advertise interval \r\n");
printf("1) Sensor data\r\n");
printf("2) Calculation data\r\n");
printf("3) Sensor data and Calculation data\r\n");
printf("4) Sensor flag and Calculation flag\r\n");
printf("5) Serial number\r\n");
while(!(std::cin >> advertising_mode)) {
std::cin.clear(); //clear bad input flag
std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n'); //discard input
std::cout << "Invalid input; please re-enter.\n";
}
switch(advertising_mode) {
case OM2JCIEBU_BLE::SENSOR_DATA:
p_om2jcieble->configureSensorAdvSetting(millisecond, OM2JCIEBU_BLE::SENSOR_DATA);
break;
case OM2JCIEBU_BLE::ACCELERATION_DATA:
p_om2jcieble->configureSensorAdvSetting(millisecond, OM2JCIEBU_BLE::ACCELERATION_DATA);
break;
case OM2JCIEBU_BLE::ACCELERATION_SENSOR_DATA:
p_om2jcieble->configureSensorAdvSetting(millisecond, OM2JCIEBU_BLE::ACCELERATION_SENSOR_DATA);
break;
case OM2JCIEBU_BLE::ACCELERATION_SENSOR_FLAG:
p_om2jcieble->configureSensorAdvSetting(millisecond, OM2JCIEBU_BLE::ACCELERATION_SENSOR_FLAG);
break;
case OM2JCIEBU_BLE::SERIAL_NUMBER:
p_om2jcieble->configureSensorAdvSetting(millisecond, OM2JCIEBU_BLE::SERIAL_NUMBER);
break;
default:
std::cout << "Invalid choice\n";
}
printf("**************************************************************\r\n");
}
int
main(int argc, char *argv[])
{
int operation_choice = 0;
if(argc <= 1) {
std::cout << "usage ./a.out xx:xx:xx:xx:xx:xx" << std::endl;
return 0;
}
signal(SIGABRT, sig_handler);
signal(SIGINT, sig_handler);
upm::OM2JCIEBU_BLE om2jciebu_ble(argv[1]);
while(true) {
std::cout << "*************************************************************" << std::endl;
std::cout << "Please choose one option for Omron sensor operation" << std::endl;
std::cout << "1) Display Advertisement Sensor attriutes" << std::endl;
std::cout << "2) Display Sensor attriutes" << std::endl;
std::cout << "3) Configure LED setting " << std::endl;
std::cout << "4) Configure advertise setting" << std::endl;
std::cout << "5) Exit" << std::endl;
std::cout << "*************************************************************" << std::endl;
while(!(std::cin >> operation_choice)) {
std::cin.clear(); //clear bad input flag
std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n'); //discard input
std::cout << "Invalid input; please re-enter.\n";
}
switch(operation_choice) {
case 1:
getAdvSensorData(&om2jciebu_ble);
break;
case 2:
getSensorData(&om2jciebu_ble);
break;
case 3:
configureLEDSetting(&om2jciebu_ble);
break;
case 4:
configureAdvInterval(&om2jciebu_ble);
break;
case 5:
std::cout << "Application Exited" << std::endl;
om2jciebu_ble.removeBleDevice();
exit(0);
break;
default:
std::cout << "Invalid choice" << std::endl;
break;
}
}
}

View File

@ -0,0 +1,403 @@
/*
* Author: Hiroyuki Mino <omronsupportupm@omron.com>
* Copyright (c) 2019 Omron Electronic Components - Americas
*
* This program and the accompanying materials are made available under the
* terms of the The MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
*/
/* standard headers */
#include <iostream>
#include <signal.h>
#include <stdlib.h>
#include <unistd.h>
/* omron sensor headers */
#include "2jciebu01_usb.hpp"
using namespace std;
using namespace upm;
volatile sig_atomic_t flag = 1;
#define PREVIOUS_MENU_CHOICE 10
upm::OM2JCIEBU_UART::om2jciebuData_t om2jciebuSensorData;
void
sig_handler(int signum)
{
if(signum == SIGABRT) { //check for Abort signal
std::cout << "Exiting..." << std::endl;
}
if(signum == SIGINT) { //check for Interrupt signal
std::cout << "Exiting..." << std::endl;
flag = 0;
}
}
void getSensorData(OM2JCIEBU_UART *p_om2jcieuart)
{
if(p_om2jcieuart == NULL) {
std::cout << "Null pointer received..." << std::endl;
return;
}
uint16_t parameterChoice = 0;
int displayDelay = 0;
bool seconds_validate = false;
uint16_t sensorParamData = 0;
uint32_t pressureData = 0;
while(true) {
printf("************************************************************\r\n");
printf("Please select sensor attribute for display\r\n");
printf("0) All parameter\r\n");
printf("1) Temperature data\r\n");
printf("2) Relative humidity data\r\n");
printf("3) Ambient light data\r\n");
printf("4) Barometric pressure data\r\n");
printf("5) Sound noise data\r\n");
printf("6) eTVOC data\r\n");
printf("7) eCO2 data\r\n");
printf("8) Discomfort index data\r\n");
printf("9) Heat stroke data\r\n");
printf("10) Return to main menu\r\n");
printf("Note :: Press Ctrl+C for sensor attribute display menu\r\n");
printf("************************************************************\r\n");
while(!(std::cin >> parameterChoice)) {
std::cin.clear(); //clear bad input flag
std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n'); //discard input
std::cout << "Invalid input; please re-enter.\n";
}
if(parameterChoice >= OM2JCIEBU_UART::ALL_PARAM && parameterChoice <= OM2JCIEBU_UART::HEAT_STROKE) {
flag = 1;
printf("Please enter time interval (in Seconds), for display sensor data\r\n");
while(!seconds_validate) { //validate user input values
cin >> displayDelay;
if(!cin.fail() && (cin.peek() == EOF || cin.peek() == '\n') && (displayDelay >= 1 && displayDelay <= 10)) {
seconds_validate = true;
} else {
cin.clear();
cin.ignore();
cout << "Error, enter an second between 1 to 10!" << endl;
}
}
while(flag) {
switch(parameterChoice) {
case OM2JCIEBU_UART::ALL_PARAM:
if(p_om2jcieuart->getSensorData(OM2JCIEBU_UART::ALL_PARAM, &om2jciebuSensorData) == OM2JCIEBU_UART::SUCCESS) {
printf("************** Sensor Attribute Values ***************\r\n");
printf("Sequence Number :: %d \r\n", om2jciebuSensorData.sequence_number);
printf("Temperature :: %d degC\r\n", om2jciebuSensorData.temperature);
printf("Relative humidity :: %d RH\r\n", om2jciebuSensorData.relative_humidity);
printf("Ambient light :: %d lx\r\n", om2jciebuSensorData.ambient_light);
printf("Barometric pressure :: %d hPa\r\n", om2jciebuSensorData.pressure);
printf("Sound noise :: %d dB\r\n", om2jciebuSensorData.noise);
printf("eTVOC :: %d ppb\r\n", om2jciebuSensorData.eTVOC);
printf("eCO2 :: %d ppm\r\n", om2jciebuSensorData.eCO2);
printf("Discomfort index :: %d \r\n", om2jciebuSensorData.discomfort_index);
printf("Heat stroke :: %d degC\r\n", om2jciebuSensorData.heat_stroke);
printf("**********************************************************\r\n");
memset(&om2jciebuSensorData, 0, sizeof(om2jciebuSensorData));
} else {
flag = 0;
}
break;
case OM2JCIEBU_UART::TEMP:
if(p_om2jcieuart->getSensorData(OM2JCIEBU_UART::TEMP, &sensorParamData) == OM2JCIEBU_UART::SUCCESS) {
printf("************** Temperature Attribute Values ***************\r\n");
printf("Temperature :: %d degC\r\n", sensorParamData);
printf("************************************************************\r\n");
} else {
flag = 0;
}
break;
case OM2JCIEBU_UART::HUMIDITY:
if(p_om2jcieuart->getSensorData(OM2JCIEBU_UART::HUMIDITY, &sensorParamData) == OM2JCIEBU_UART::SUCCESS) {
printf("************** Relative humidity Attribute Values ***************\r\n");
printf("Relative humidity :: %d RH\r\n", sensorParamData);
printf("******************************************************************\r\n");
} else {
flag = 0;
}
break;
case OM2JCIEBU_UART::AMBIENT_LIGHT:
if(p_om2jcieuart->getSensorData(OM2JCIEBU_UART::AMBIENT_LIGHT, &sensorParamData) == OM2JCIEBU_UART::SUCCESS) {
printf("************** Ambient light Attribute Values ***************\r\n");
printf("Ambient light :: %d lx\r\n", sensorParamData);
printf("**************************************************************\r\n");
} else {
flag = 0;
}
break;
case OM2JCIEBU_UART::PRESSURE:
if(p_om2jcieuart->getSensorData(OM2JCIEBU_UART::PRESSURE, &pressureData) == OM2JCIEBU_UART::SUCCESS) {
printf("************** Barometric pressure Attribute Values ***************\r\n");
printf("Barometric pressure :: %d hPa\r\n", pressureData);
printf("********************************************************************\r\n");
} else {
flag = 0;
}
break;
case OM2JCIEBU_UART::NOISE:
if(p_om2jcieuart->getSensorData(OM2JCIEBU_UART::NOISE, &sensorParamData) == OM2JCIEBU_UART::SUCCESS) {
printf("************** Sound noise Attribute Values ***************\r\n");
printf("Sound noise :: %d dB\r\n", sensorParamData);
printf("************************************************************\r\n");
} else {
flag = 0;
}
break;
case OM2JCIEBU_UART::ETVOC:
if(p_om2jcieuart->getSensorData(OM2JCIEBU_UART::ETVOC, &sensorParamData) == OM2JCIEBU_UART::SUCCESS) {
printf("************** eTVOC Attribute Values ***************\r\n");
printf("eTVOC :: %d ppb\r\n", sensorParamData);
printf("******************************************************\r\n");
} else {
flag = 0;
}
break;
case OM2JCIEBU_UART::ECO2:
if(p_om2jcieuart->getSensorData(OM2JCIEBU_UART::ECO2, &sensorParamData) == OM2JCIEBU_UART::SUCCESS) {
printf("************** eCO2 Attribute Values ***************\r\n");
printf("eCO2 :: %d ppm\r\n\r\n", sensorParamData);
printf("******************************************************\r\n");
} else {
flag = 0;
}
break;
case OM2JCIEBU_UART::DISCOMFORT_INDEX:
if(p_om2jcieuart->getSensorData(OM2JCIEBU_UART::DISCOMFORT_INDEX, &sensorParamData) == OM2JCIEBU_UART::SUCCESS) {
printf("************** eCO2 Attribute Values ***************\r\n");
printf("Discomfort index :: %d \r\n\r\n", sensorParamData);
printf("******************************************************\r\n");
} else {
flag = 0;
}
break;
case OM2JCIEBU_UART::HEAT_STROKE:
if(p_om2jcieuart->getSensorData(OM2JCIEBU_UART::HEAT_STROKE, &sensorParamData) == OM2JCIEBU_UART::SUCCESS) {
printf("************** eCO2 Attribute Values ***************\r\n");
printf("Heat stroke :: %d degC\r\n\r\n", sensorParamData);
printf("******************************************************\r\n");
} else {
flag = 0;
}
break;
}
printf("\r\n");
p_om2jcieuart->delay(displayDelay);
}
} else if(parameterChoice == PREVIOUS_MENU_CHOICE) {
break;
} else {
printf("Invalid choice\r\n");
}
seconds_validate = false;
}
}
void configureLEDSetting(OM2JCIEBU_UART *p_om2jcieuart)
{
if(p_om2jcieuart == NULL) {
std::cout << "Null pointer received..." << std::endl;
return;
}
int led_choice = 0;
bool red_scale_validate = false, green_scale_validate = false, blue_scale_validate = false;
unsigned short int red_scale = 0, green_scale = 0, blue_scale = 0;
printf("************** Sensor LED Configuration ***************\r\n");
printf("Please select a operation for LED\r\n");
printf("0) Normally OFF\r\n");
printf("1) Normally ON\r\n");
printf("2) Temperature value scales\r\n");
printf("3) Relative humidity value scales\r\n");
printf("4) Ambient light value scales\r\n");
printf("5) Barometric pressure value scales\r\n");
printf("6) Sound noise value scales\r\n");
printf("7) eTVOC value scales\r\n");
printf("8) SI vale scales\r\n");
printf("9) PGA value scales\r\n");
printf("**********************************************************\r\n");
while(!(std::cin >> led_choice)) {
std::cin.clear(); //clear bad input flag
std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n'); //discard input
std::cout << "Invalid input; please re-enter.\n";
}
if(led_choice == OM2JCIEBU_UART::NORMALLY_ON) {
printf("Please Select a LED color scale\r\n");
printf("Please enter Red Color scale (scale range 0 to 255)\r\n");
while(!red_scale_validate) {
cin >> red_scale;
if(!cin.fail() && (cin.peek() == EOF || cin.peek() == '\n') && (red_scale >= 0 && red_scale <= 255)) {
red_scale_validate = true;
} else {
cin.clear();
cin.ignore();
cout << "Error, enter an red color scale between 0 and 255!" << endl;
}
}
printf("Please enter Green Color scale(scale range 0 to 255)\r\n");
while(!green_scale_validate) {
cin >> green_scale;
if(!cin.fail() && (cin.peek() == EOF || cin.peek() == '\n') && (green_scale >= 0 && green_scale <= 255)) {
green_scale_validate = true;
} else {
cin.clear();
cin.ignore();
cout << "Error, enter an green color scale between 0 and 255!" << endl;
}
}
printf("Please enter Blue Color scale(scale range 0 to 255)\r\n");
while(!blue_scale_validate) {
cin >> blue_scale;
if(!cin.fail() && (cin.peek() == EOF || cin.peek() == '\n') && (blue_scale >= 0 && blue_scale <= 255)) {
blue_scale_validate = true;
} else {
cin.clear();
cin.ignore();
cout << "Error, enter an blue color scale between 0 and 255!" << endl;
}
}
p_om2jcieuart->configureSensorLedState(OM2JCIEBU_UART::NORMALLY_ON, red_scale, green_scale, blue_scale);
} else {
switch(led_choice) {
case OM2JCIEBU_UART::NORMALLY_OFF:
p_om2jcieuart->configureSensorLedState(OM2JCIEBU_UART::NORMALLY_OFF, 0, 0, 0);
break;
case OM2JCIEBU_UART::TEMP_SACLE:
p_om2jcieuart->configureSensorLedState(OM2JCIEBU_UART::TEMP_SACLE, 0, 0, 0);
break;
case OM2JCIEBU_UART::HUMIDITY_SCALE:
p_om2jcieuart->configureSensorLedState(OM2JCIEBU_UART::HUMIDITY_SCALE, 0, 0, 0);
break;
case OM2JCIEBU_UART::AMBIENT_LIGHT_SCALE:
p_om2jcieuart->configureSensorLedState(OM2JCIEBU_UART::AMBIENT_LIGHT_SCALE, 0, 0, 0);
break;
case OM2JCIEBU_UART::PRESSURE_SCALE:
p_om2jcieuart->configureSensorLedState(OM2JCIEBU_UART::PRESSURE_SCALE, 0, 0, 0);
break;
case OM2JCIEBU_UART::NOISE_SCALE:
p_om2jcieuart->configureSensorLedState(OM2JCIEBU_UART::NOISE_SCALE, 0, 0, 0);
break;
case OM2JCIEBU_UART::ETVOC_SCALE:
p_om2jcieuart->configureSensorLedState(OM2JCIEBU_UART::ETVOC_SCALE, 0, 0, 0);
break;
case OM2JCIEBU_UART::SI_SCALE:
p_om2jcieuart->configureSensorLedState(OM2JCIEBU_UART::SI_SCALE, 0, 0, 0);
break;
case OM2JCIEBU_UART::PGA_SCALE:
p_om2jcieuart->configureSensorLedState(OM2JCIEBU_UART::PGA_SCALE, 0, 0, 0);
break;
default:
std::cout << "Wrong LED scale choice please try again" << std::endl;
}
}
}
void configureAdvInterval(OM2JCIEBU_UART *p_om2jcieuart)
{
if(p_om2jcieuart == NULL) {
std::cout << "Null pointer received..." << std::endl;
return;
}
bool millisecond_validate = false;
uint16_t millisecond = 0;
int advertising_mode = 0;
printf("************** Sensor Advertise Configuration ***************\r\n");
printf("Please enter time interval (in Milliseconds), for changing Advertise interval, between 100 to 10240 milliseconds\r\n");
while(!millisecond_validate) {//validate millisecond
cin >> millisecond;
if(!cin.fail() && (cin.peek() == EOF || cin.peek() == '\n') && (millisecond >= 100 && millisecond <= 10240)) {
millisecond_validate = true;
} else {
cin.clear();
cin.ignore();
cout << "Error, enter an milisecond between 100 and 10240!" << endl;
}
}
printf("Please select an Advertise mode with the selected Advertise interval \r\n");
printf("1) Sensor data\r\n");
printf("2) Calculation data\r\n");
printf("3) Sensor data and Calculation data\r\n");
printf("4) Sensor flag and Calculation flag\r\n");
printf("5) Serial number\r\n");
while(!(std::cin >> advertising_mode)) {
std::cin.clear(); //clear bad input flag
std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n'); //discard input
std::cout << "Invalid input; please re-enter.\n";
}
switch(advertising_mode) {
case OM2JCIEBU_UART::SENSOR_DATA:
p_om2jcieuart->configureSensorAdvSetting(millisecond, OM2JCIEBU_UART::SENSOR_DATA);
break;
case OM2JCIEBU_UART::ACCELERATION_DATA:
p_om2jcieuart->configureSensorAdvSetting(millisecond, OM2JCIEBU_UART::ACCELERATION_DATA);
break;
case OM2JCIEBU_UART::ACCELERATION_SENSOR_DATA:
p_om2jcieuart->configureSensorAdvSetting(millisecond, OM2JCIEBU_UART::ACCELERATION_SENSOR_DATA);
break;
case OM2JCIEBU_UART::ACCELERATION_SENSOR_FLAG:
p_om2jcieuart->configureSensorAdvSetting(millisecond, OM2JCIEBU_UART::ACCELERATION_SENSOR_FLAG);
break;
case OM2JCIEBU_UART::SERIAL_NUMBER:
p_om2jcieuart->configureSensorAdvSetting(millisecond, OM2JCIEBU_UART::SERIAL_NUMBER);
break;
default:
std::cout << "Invalid choice\n";
}
printf("**************************************************************\r\n");
}
int
main(int argc, char *argv[])
{
int operation_choice = 0;
if(argc <= 1) {
std::cout << "usage ./a.out /dev/ttyUSB*" << std::endl;
return 0;
}
signal(SIGABRT, sig_handler);
signal(SIGINT, sig_handler);
upm::OM2JCIEBU_UART om2jciebu_uart(argv[1], 115200);
om2jciebu_uart.setMode(8, mraa::UART_PARITY_NONE, 1);
om2jciebu_uart.setFlowControl(false, false);
while(true) {
std::cout << "*************************************************************" << std::endl;
std::cout << "Please choose one option for Omron sensor operation" << std::endl;
std::cout << "1) Display Sensor attriutes" << std::endl;
std::cout << "2) Configure LED setting " << std::endl;
std::cout << "3) Configure advertise setting" << std::endl;
std::cout << "4) Exit" << std::endl;
std::cout << "*************************************************************" << std::endl;
while(!(std::cin >> operation_choice)) { //validate operation choice from user input
std::cin.clear(); //clear bad input flag
std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n'); //discard input
std::cout << "Invalid input; please re-enter.\n";
}
switch(operation_choice) {
case 1:
getSensorData(&om2jciebu_uart);
break;
case 2:
configureLEDSetting(&om2jciebu_uart);
break;
case 3:
configureAdvInterval(&om2jciebu_uart);
break;
case 4:
std::cout << "Application Exited" << std::endl;
exit(0);
break;
default:
std::cout << "Invalid choice" << std::endl;
}
}
}

View File

@ -3,16 +3,10 @@ file (GLOB example_src_list RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.cxx")
# - Handle special cases here --------------------------------------------------
# Test humidity interface for 2 sensor libraries
add_example(interfaces-humiditysensor.cxx TARGETS si7005 bmp280)
# Test pressure interface for 2 sensor libraries
add_example(interfaces-pressuresensor.cxx TARGETS bmp280 bmpx8x)
# Test temperature interface for 3 sensor libraries
add_example(interfaces-temperaturesensor.cxx TARGETS bmp280 bmpx8x si7005)
# Test light interface for 2 sensor libraries
add_example(interfaces-lightsensor.cxx TARGETS si1132 max44009)
# Test light controller interface for 3 sensor libraries
add_example(interfaces-lightcontroller.cxx TARGETS lp8860 ds1808lc hlg150h)
# Test temperature interface for 2 sensor libraries
add_example(iTemperature_sample.cxx TARGETS interfaces lm35 abp)
# Test light interface for 3 sensor libraries
add_example(iLight_sample.cxx TARGETS interfaces apds9002 bh1750 max44009)
# - Create an executable for all other src files in this directory -------------
foreach (_example_src ${example_src_list})

View File

@ -2,24 +2,11 @@
* Author: Jon Trulson <jtrulson@ics.com>
* Copyright (c) 2015 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:
* This program and the accompanying materials are made available under the
* terms of the The MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* 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.
* SPDX-License-Identifier: MIT
*/
#include <iostream>

View File

@ -2,24 +2,11 @@
* Author: Jon Trulson <jtrulson@ics.com>
* Copyright (c) 2014 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:
* This program and the accompanying materials are made available under the
* terms of the The MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* 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.
* SPDX-License-Identifier: MIT
*/
#include <iostream>

View File

@ -2,24 +2,11 @@
* Author: Abhishek Malik <abhishek.malik@intel.com>
* Copyright (c) 2017 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:
* This program and the accompanying materials are made available under the
* terms of the The MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* 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.
* SPDX-License-Identifier: MIT
*/
#include <iostream>

View File

@ -2,24 +2,11 @@
* Author: Jon Trulson <jtrulson@ics.com>
* Copyright (c) 2015 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:
* This program and the accompanying materials are made available under the
* terms of the The MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* 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.
* SPDX-License-Identifier: MIT
*/
#include <iostream>

View File

@ -2,24 +2,11 @@
* Author: Jon Trulson <jtrulson@ics.com>
* Copyright (c) 2015 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:
* This program and the accompanying materials are made available under the
* terms of the The MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* 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.
* SPDX-License-Identifier: MIT
*/
#include <iostream>

View File

@ -2,24 +2,11 @@
* Author: Jon Trulson <jtrulson@ics.com>
* Copyright (c) 2015 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:
* This program and the accompanying materials are made available under the
* terms of the The MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* 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.
* SPDX-License-Identifier: MIT
*/
#include <iostream>

View File

@ -2,24 +2,11 @@
* Author: Stan Gifford <stan@gifford.id.au>
* Copyright (c) 2015 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:
* This program and the accompanying materials are made available under the
* terms of the The MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* 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.
* SPDX-License-Identifier: MIT
*/
/**

View File

@ -2,24 +2,11 @@
* Author: Jon Trulson <jtrulson@ics.com>
* Copyright (c) 2014 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:
* This program and the accompanying materials are made available under the
* terms of the The MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* 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.
* SPDX-License-Identifier: MIT
*/
#include <iostream>

View File

@ -2,24 +2,11 @@
* Author: Henry Bruce <henry.bruce@intel.com>
* Copyright (c) 2015 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:
* This program and the accompanying materials are made available under the
* terms of the The MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* 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.
* SPDX-License-Identifier: MIT
*/
#include <exception>
@ -27,7 +14,6 @@
#include <stddef.h>
#include "ads1015.hpp"
#include "iADC.hpp"
#include "mraa/gpio.hpp"
#include "upm_utilities.h"
@ -39,24 +25,21 @@ int
main()
{
/* Create an instance of the ADS1015 sensor */
upm::ADS1015 sensor(EDISON_I2C_BUS);
upm::ADS1015 adc(EDISON_I2C_BUS);
mraa::Gpio gpio(EDISON_GPIO_SI7005_CS);
gpio.dir(mraa::DIR_OUT_HIGH);
/* Show usage from the IADC interface */
upm::IADC* adc = static_cast<upm::IADC*>(&sensor);
if (adc == NULL) {
std::cout << "ADC not detected" << std::endl;
return 1;
}
std::cout << "ADC " << adc->getModuleName() << " detected. ";
std::cout << adc->getNumInputs() << " inputs available" << std::endl;
// if (adc == NULL) {
// std::cout << "ADC not detected" << std::endl;
// return 1;
// }
std::cout << "ADC " << adc.getModuleName() << " detected. ";
std::cout << adc.getNumInputs() << " inputs available" << std::endl;
while (true) {
for (unsigned int i = 0; i < adc->getNumInputs(); ++i) {
for (unsigned int i = 0; i < adc.getNumInputs(); ++i) {
std::cout << "Input " << i;
try {
float voltage = adc->getVoltage(i);
float voltage = adc.getVoltage(i);
std::cout << ": Voltage = " << voltage << "V" << std::endl;
} catch (std::exception& e) {
std::cerr << e.what() << std::endl;

View File

@ -2,24 +2,11 @@
* Author: Mihai Tudor Panu <mihai.tudor.panu@intel.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:
* This program and the accompanying materials are made available under the
* terms of the The MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* 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.
* SPDX-License-Identifier: MIT
*/
/* This example demonstrates how to use one the ADS1015 ADC on the Grove Joule

View File

@ -2,24 +2,11 @@
* Author: Mihai Tudor Panu <mihai.tudor.panu@intel.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:
* This program and the accompanying materials are made available under the
* terms of the The MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* 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.
* SPDX-License-Identifier: MIT
*/
/* This example demonstrates how to use one of the ADS1115 ADCs on the

View File

@ -2,24 +2,11 @@
* Author: Marc Graham <marc@m2ag.net>
* Copyright (c) 2015 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:
* This program and the accompanying materials are made available under the
* terms of the The MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* 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.
* SPDX-License-Identifier: MIT
*/
#include <iostream>

View File

@ -2,24 +2,11 @@
* Author: Jon Trulson <jtrulson@ics.com>
* Copyright (c) 2015 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:
* This program and the accompanying materials are made available under the
* terms of the The MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* 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.
* SPDX-License-Identifier: MIT
*/
#include <iostream>

View File

@ -2,24 +2,11 @@
* Author: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
* Copyright (c) 2014 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:
* This program and the accompanying materials are made available under the
* terms of the The MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* 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.
* SPDX-License-Identifier: MIT
*/
#include <stdio.h>

View File

@ -2,24 +2,11 @@
* Author: Jon Trulson <jtrulson@ics.com>
* Copyright (c) 2015 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:
* This program and the accompanying materials are made available under the
* terms of the The MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* 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.
* SPDX-License-Identifier: MIT
*/
#include <iostream>

View File

@ -2,24 +2,11 @@
* Author: William Penner <william.penner@intel.com>
* Copyright (c) 2014 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:
* This program and the accompanying materials are made available under the
* terms of the The MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* 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.
* SPDX-License-Identifier: MIT
*/
#include <iostream>

View File

@ -2,24 +2,11 @@
* Author: Yannick Adam <yannick.adam@gmail.com>
* Copyright (c) 2016 Yannick Adam
*
* 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:
* This program and the accompanying materials are made available under the
* terms of the The MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* 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.
* SPDX-License-Identifier: MIT
*/
#include "apa102.hpp"

View File

@ -2,24 +2,11 @@
* Author: Zion Orent <zorent@ics.com>
* Copyright (c) 2015 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:
* This program and the accompanying materials are made available under the
* terms of the The MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* 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.
* SPDX-License-Identifier: MIT
*/
#include <iostream>

View File

@ -2,24 +2,11 @@
* Author: Lay, Kuan Loon <kuan.loon.lay@intel.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:
* This program and the accompanying materials are made available under the
* terms of the The MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* 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.
* SPDX-License-Identifier: MIT
*/
#include <iostream>

View File

@ -2,24 +2,11 @@
* Author: Jon Trulson <jtrulson@ics.com>
* Copyright (c) 2015 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:
* This program and the accompanying materials are made available under the
* terms of the The MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* 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.
* SPDX-License-Identifier: MIT
*/
#include <iostream>

60
examples/c++/bh1749.cxx Executable file
View File

@ -0,0 +1,60 @@
/*
* The MIT License (MIT)
*
* Author: Assam Boudjelthia
* Copyright (c) 2018 Rohm Semiconductor.
*
* This program and the accompanying materials are made available under the
* terms of the The MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
*/
#include <iostream>
#include <unistd.h>
#include <stdexcept>
#include <signal.h>
#include <vector>
#include "bh1749.hpp"
#include "upm_utilities.h"
bool isStopped;
upm::BH1749 dev;
void signal_int_handler(int signo)
{
if (signo == SIGINT)
isStopped = true;
}
//! [Interesting]
void PrintData(void *args)
{
std::vector<uint16_t> result = dev.GetMeasurements();
std::cout << "R: " << result.at(0) <<
", G: " << result.at(1) <<
", B: " << result.at(2) <<
", IR: " << result.at(3) <<
", G2: " << result.at(4) << std::endl;
dev.ResetInterrupt();
}
int main(int argc, char **argv)
{
signal(SIGINT, signal_int_handler);
dev.SoftReset();
dev.SensorInit(INT_JUDGE_1, MEAS_240MS, RGB_GAIN_1X, IR_GAIN_1X, RED);
dev.SetThresholdHigh(511);
std::cout << "Installing ISR" << std::endl;
dev.InstallISR(MRAA_GPIO_EDGE_FALLING, 33, &PrintData, NULL);
dev.EnableInterrupt();
dev.Enable();
while(!isStopped) {
upm_delay_ms(1000);
}
return 0;
}
//! [Interesting]

View File

@ -2,24 +2,11 @@
* Author: Jon Trulson <jtrulson@ics.com>
* Copyright (c) 2015 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:
* This program and the accompanying materials are made available under the
* terms of the The MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* 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.
* SPDX-License-Identifier: MIT
*/
#include <iostream>

70
examples/c++/bh1792.cxx Executable file
View File

@ -0,0 +1,70 @@
/*
* The MIT License (MIT)
*
* Author: Assam Boudjelthia
* Copyright (c) 2018 Rohm Semiconductor.
*
* This program and the accompanying materials are made available under the
* terms of the The MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
*/
#include <iostream>
#include <signal.h>
#include <sys/time.h>
#include "bh1792.hpp"
#include "upm_utilities.h"
bool isStopped;
upm::BH1792 dev;
void signal_int_handler(int signo)
{
if (signo == SIGINT)
isStopped = true;
}
//! [Interesting]
void PrintData(void *args)
{
std::vector<std::vector<int>> fifo;
struct timespec now;
clock_gettime(CLOCK_MONOTONIC_RAW, &now);
try {
fifo = dev.GetFifoData();
std::cout << "\nHeart beat sensor FIFO data:" << std::endl;
for(int i = 0; i < 32; i++)
std::cout << i << ": off: " << fifo.at(i).at(0) << ", on: " <<
fifo.at(i).at(1) << std::endl;
std::cout << "timestamp " << now.tv_sec << " sec, " << now.tv_nsec <<
" nsec" << std::endl;
} catch (std::exception& e) {
std::cout << "Failed to read FIFO data" << std::endl;
throw;
}
}
int main(int argc, char **argv)
{
float measTime;
signal(SIGINT, signal_int_handler);
dev.SoftReset();
dev.EnableSyncMode(256, 32);
std::cout << "Installing ISR" << std::endl;
dev.InstallISR(MRAA_GPIO_EDGE_FALLING, 33, &PrintData, NULL);
measTime = dev.GetMeasurementTimeMS();
dev.StartMeasurement();
while(!isStopped) {
usleep(measTime * 1000);
}
return 0;
}
//! [Interesting]

View File

@ -2,24 +2,11 @@
* Author: Zion Orent <zorent@ics.com>
* Copyright (c) 2014 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:
* This program and the accompanying materials are made available under the
* terms of the The MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* 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.
* SPDX-License-Identifier: MIT
*/
#include <iostream>

View File

@ -2,24 +2,11 @@
* Author: Jon Trulson <jtrulson@ics.com>
* Copyright (c) 2015 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:
* This program and the accompanying materials are made available under the
* terms of the The MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* 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.
* SPDX-License-Identifier: MIT
*/
#include <iostream>

View File

@ -2,24 +2,11 @@
* 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:
* This program and the accompanying materials are made available under the
* terms of the The MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* 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.
* SPDX-License-Identifier: MIT
*/
#include <iostream>

View File

@ -2,24 +2,11 @@
* 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:
* This program and the accompanying materials are made available under the
* terms of the The MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* 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.
* SPDX-License-Identifier: MIT
*/
#include <iostream>

View File

@ -2,24 +2,11 @@
* 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:
* This program and the accompanying materials are made available under the
* terms of the The MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* 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.
* SPDX-License-Identifier: MIT
*/
#include <iostream>

View File

@ -2,24 +2,11 @@
* 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:
* This program and the accompanying materials are made available under the
* terms of the The MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* 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.
* SPDX-License-Identifier: MIT
*/
#include <iostream>

View File

@ -2,24 +2,11 @@
* 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:
* This program and the accompanying materials are made available under the
* terms of the The MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* 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.
* SPDX-License-Identifier: MIT
*/
#include <iostream>

View File

@ -4,24 +4,11 @@
*
* The MIT License
*
* 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:
* This program and the accompanying materials are made available under the
* terms of the The MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* 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.
* SPDX-License-Identifier: MIT
*/
#include <iostream>

View File

@ -7,24 +7,11 @@
*
* The MIT License
*
* 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:
* This program and the accompanying materials are made available under the
* terms of the The MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* 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.
* SPDX-License-Identifier: MIT
*/
#include <iostream>

View File

@ -2,24 +2,11 @@
* 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:
* This program and the accompanying materials are made available under the
* terms of the The MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* 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.
* SPDX-License-Identifier: MIT
*/
#include <iostream>

View File

@ -2,24 +2,11 @@
* 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:
* This program and the accompanying materials are made available under the
* terms of the The MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* 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.
* SPDX-License-Identifier: MIT
*/
#include <iostream>

View File

@ -2,24 +2,11 @@
* 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:
* This program and the accompanying materials are made available under the
* terms of the The MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* 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.
* SPDX-License-Identifier: MIT
*/
#include <iostream>

View File

@ -2,24 +2,11 @@
* 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:
* This program and the accompanying materials are made available under the
* terms of the The MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* 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.
* SPDX-License-Identifier: MIT
*/
#include <iostream>

View File

@ -2,24 +2,11 @@
* Author: Sarah Knepper <sarah.knepper@intel.com>
* Copyright (c) 2014 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:
* This program and the accompanying materials are made available under the
* terms of the The MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* 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.
* SPDX-License-Identifier: MIT
*/
#include <iostream>

View File

@ -0,0 +1,12 @@
#include <iostream>
#include "buzzer.hpp"
#include "buzzer_tones.h"
#include "upm_utilities.h"
int
main(int argc, char** argv)
{
upm::Buzzer buzzer("p:32,vol:0.01,play:3800:500000");
return 0;
}

View File

@ -2,24 +2,11 @@
* Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
* Copyright (c) 2014 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:
* This program and the accompanying materials are made available under the
* terms of the The MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* 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.
* SPDX-License-Identifier: MIT
*/
#include <iostream>
@ -35,7 +22,7 @@ main(int argc, char** argv)
int chord[] = { BUZZER_DO, BUZZER_RE, BUZZER_MI, BUZZER_FA, BUZZER_SOL, BUZZER_LA, BUZZER_SI };
// create Buzzer instance
upm::Buzzer sound(5);
upm::Buzzer sound(32);
// print sensor name
std::cout << sound.name() << std::endl;

View File

@ -2,24 +2,11 @@
* Author: Jon Trulson <jtrulson@ics.com>
* Copyright (c) 2015 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:
* This program and the accompanying materials are made available under the
* terms of the The MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* 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.
* SPDX-License-Identifier: MIT
*/
#include <iostream>

View File

@ -2,24 +2,11 @@
* Author: Zion Orent <zorent@ics.com>
* Copyright (c) 2015 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:
* This program and the accompanying materials are made available under the
* terms of the The MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* 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.
* SPDX-License-Identifier: MIT
*/
#include <iostream>
#include <signal.h>

View File

@ -4,24 +4,11 @@
* Author: Justin Zemlyansky (@JustInDevelopment)
* 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:
* This program and the accompanying materials are made available under the
* terms of the The MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* 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.
* SPDX-License-Identifier: MIT
*/
#include "curieimu.hpp"

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