Compare commits
174 Commits
cxx-interf
...
master
Author | SHA1 | Date | |
---|---|---|---|
d6f76ff8c2 | |||
8ae7f89e03 | |||
3f7dcc6e0b | |||
0a0c352614 | |||
89d5de43e0 | |||
dc843c0bd7 | |||
c37a48255e | |||
ab25e56212 | |||
f5a66936be | |||
5cf20df96c | |||
33d0aee280 | |||
7d0600df1c | |||
b454862649 | |||
9501488709 | |||
8f3f2a7de2 | |||
4c6fde84f4 | |||
2c7fff24c7 | |||
e3d054086b | |||
2b6f2c5b53 | |||
2a948ca687 | |||
d282d479bb | |||
d256a225bf | |||
9cddd4a8b1 | |||
223b6028bf | |||
b08eef0197 | |||
e0be90589b | |||
bf315ee5c6 | |||
066385d9ac | |||
934d571964 | |||
ef92026253 | |||
a106345527 | |||
3044bc6b49 | |||
d2428ca5da | |||
bd445385a7 | |||
402739fa74 | |||
5b97b0a98e | |||
d3ce509334 | |||
f608b0fa98 | |||
6cbfa60729 | |||
8a2ef9a648 | |||
1c0ed9c9bd | |||
fe3dcc01b2 | |||
1111a830c9 | |||
660b34c2ce | |||
9869b31a3e | |||
90167f6ac1 | |||
03bc2ae26e | |||
a8cd0f72ec | |||
cb27acbc04 | |||
2975bae075 | |||
8f11061de3 | |||
a3bf6d76a9 | |||
582decd4f7 | |||
d38339ab9f | |||
fc0c0fdbaa | |||
b675b89e1b | |||
ebe84f96b2 | |||
c5287adf36 | |||
9f545f10af | |||
40f6bd9c6c | |||
71cb3606ee | |||
6103516884 | |||
55f749529f | |||
742150feea | |||
87dc660bd6 | |||
48ecaeaea9 | |||
56f4dd9a92 | |||
93196d62cb | |||
cca6a86268 | |||
4faf4ee816 | |||
d00dc3e332 | |||
50961c6020 | |||
82edcec766 | |||
db3b99a792 | |||
aa87b14126 | |||
550e48e806 | |||
d7fe4e717b | |||
7352aab3b0 | |||
7b5b02d859 | |||
9db28cd4fc | |||
dfdc362c2c | |||
d23183897d | |||
9ba309bc48 | |||
32b73a1d25 | |||
58ee51c767 | |||
e4f106a0c7 | |||
f28a6d2561 | |||
aa966946d5 | |||
34bb12933d | |||
b6e53f7da8 | |||
f992876461 | |||
90524273ec | |||
bfdd2c37c0 | |||
57c0c8c235 | |||
664c6dd8c6 | |||
1f1510f38d | |||
c642e02a18 | |||
864e1eb073 | |||
ddcc4f467e | |||
c16b33ae31 | |||
9669f226b9 | |||
2abfd3f1ba | |||
2f0ae1cc49 | |||
079e444fce | |||
2405f933de | |||
c3d5d951e1 | |||
bbcee52880 | |||
87fc11adbe | |||
4addac7e01 | |||
57f03b79aa | |||
52b3087de9 | |||
efd36e57b0 | |||
8312e1d18f | |||
b917f0ca54 | |||
b058d341c0 | |||
1949916a8e | |||
f5f2920c70 | |||
fd34b9669d | |||
8693a72ed6 | |||
75c7bd8d12 | |||
6d8e6d8a9f | |||
2b36d30243 | |||
a589f92cec | |||
f035470822 | |||
6bf21a23e7 | |||
16e72d2ff7 | |||
94be00a63d | |||
d5cb613ad0 | |||
c0c37028e4 | |||
eb8d64f52b | |||
1ddf969020 | |||
85608a9f61 | |||
4927311a0c | |||
b50b93272d | |||
ed4fe56ef8 | |||
67b77b78aa | |||
bc01f710ea | |||
1af38e060e | |||
62f84dcc47 | |||
6ae7e9125b | |||
07a9af07fe | |||
89e2ec870a | |||
4935a16530 | |||
9ef90ccb81 | |||
5f2557b159 | |||
09208e90d0 | |||
e0105cb601 | |||
c2ce3e8222 | |||
db3c73cbd1 | |||
be46240b8c | |||
ef81a20140 | |||
8a617aa904 | |||
a16d279b6f | |||
3e84b74bdf | |||
186bbfab76 | |||
01cc3a0734 | |||
09e536b4ff | |||
dc45cd7859 | |||
3790c0bbc1 | |||
7a2332fa7d | |||
330c94f1e2 | |||
9a959b578c | |||
cdfb68c381 | |||
6228498147 | |||
8b4e1020f4 | |||
3a077df5f6 | |||
1b5087105b | |||
ec9143e976 | |||
37642f3b01 | |||
17110d41d0 | |||
dd73c4aa45 | |||
8f63914d76 | |||
306872619a | |||
ad15b27cb1 |
16
.travis.yml
@ -12,15 +12,21 @@ before_install:
|
|||||||
jobs:
|
jobs:
|
||||||
fast_finish: true
|
fast_finish: true
|
||||||
allow_failures:
|
allow_failures:
|
||||||
- env: TARGET=ipk
|
- env: TARGET=android
|
||||||
include:
|
include:
|
||||||
- &run-with-clang-minimal
|
- &run-with-clang-minimal
|
||||||
stage: Clang 3.8 - minimal with unit tests
|
stage: Clang 3.8 - minimal with unit tests
|
||||||
env: TARGET=minimal
|
env:
|
||||||
|
- TARGET=minimal
|
||||||
|
- CMAKE_BUILD_TYPE=Debug
|
||||||
before_script: docker-compose pull ${TARGET}
|
before_script: docker-compose pull ${TARGET}
|
||||||
script:
|
script:
|
||||||
- export CC=clang-3.8 CXX=clang++-3.8
|
- export CC=clang-3.8 CXX=clang++-3.8
|
||||||
- BUILDARCH=MOCK docker-compose run ${TARGET}
|
- docker-compose run ${TARGET}
|
||||||
|
- <<: *run-with-clang-minimal
|
||||||
|
env:
|
||||||
|
- TARGET=minimal
|
||||||
|
- CMAKE_BUILD_TYPE=Release
|
||||||
- &run-with-clang
|
- &run-with-clang
|
||||||
stage: Clang 3.8
|
stage: Clang 3.8
|
||||||
env: TARGET=python
|
env: TARGET=python
|
||||||
@ -81,9 +87,5 @@ jobs:
|
|||||||
env: TARGET=examples
|
env: TARGET=examples
|
||||||
- <<: *run-additional-jobs
|
- <<: *run-additional-jobs
|
||||||
env: TARGET=sonar-scan
|
env: TARGET=sonar-scan
|
||||||
- <<: *run-additional-jobs
|
|
||||||
env: TARGET=ipk
|
|
||||||
- <<: *run-additional-jobs
|
|
||||||
env: TARGET=rpm
|
|
||||||
- <<: *run-additional-jobs
|
- <<: *run-additional-jobs
|
||||||
env: TARGET=npm
|
env: TARGET=npm
|
||||||
|
@ -10,8 +10,6 @@ option (BUILDSWIGNODE "Build swig node modules" ON)
|
|||||||
option (BUILDSWIGJAVA "Build swig java modules" OFF)
|
option (BUILDSWIGJAVA "Build swig java modules" OFF)
|
||||||
option (BUILDCORDOVA "Build cordova bindings" OFF)
|
option (BUILDCORDOVA "Build cordova bindings" OFF)
|
||||||
option (BUILDEXAMPLES "Build C/C++/JAVA examples" 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 (NPM "Generate NPM/GYP tarballs" OFF)
|
||||||
option (BUILDTESTS "Generate check-ups for upm" OFF)
|
option (BUILDTESTS "Generate check-ups for upm" OFF)
|
||||||
option (WERROR "Make all warnings into errors." ON)
|
option (WERROR "Make all warnings into errors." ON)
|
||||||
@ -91,13 +89,16 @@ endfunction ()
|
|||||||
|
|
||||||
# Compiler flags common to both C and CXX
|
# Compiler flags common to both C and CXX
|
||||||
# Enable -Wall
|
# Enable -Wall
|
||||||
# GCC-6 added -Wmisleading-indentation to -Wall, skip these for now
|
|
||||||
set (C_CXX_WARNING_FLAGS -Wall
|
set (C_CXX_WARNING_FLAGS -Wall
|
||||||
-Wno-misleading-indentation
|
|
||||||
-Wno-strict-aliasing
|
-Wno-strict-aliasing
|
||||||
-Wno-deprecated-declarations # Temp fix for MRAA deprecated methods
|
-Wno-deprecated-declarations # Temp fix for MRAA deprecated methods
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# GCC-6 added -Wmisleading-indentation to -Wall, skip these for now
|
||||||
|
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?
|
# Warnings as errors?
|
||||||
if (WERROR)
|
if (WERROR)
|
||||||
list (APPEND C_CXX_WARNING_FLAGS -Werror)
|
list (APPEND C_CXX_WARNING_FLAGS -Werror)
|
||||||
@ -130,7 +131,7 @@ find_package (PkgConfig REQUIRED)
|
|||||||
|
|
||||||
# Force a libmraa search and minimum required version every time a config is generated
|
# Force a libmraa search and minimum required version every time a config is generated
|
||||||
unset(MRAA_FOUND CACHE)
|
unset(MRAA_FOUND CACHE)
|
||||||
set(MRAA_MINIMUM 1.9.0)
|
set(MRAA_MINIMUM 2.0.0)
|
||||||
pkg_check_modules (MRAA REQUIRED mraa>=${MRAA_MINIMUM})
|
pkg_check_modules (MRAA REQUIRED mraa>=${MRAA_MINIMUM})
|
||||||
# Also, get full path to the mraa library
|
# Also, get full path to the mraa library
|
||||||
find_library(MRAA_LIBRARY NAMES mraa HINTS ${MRAA_LIBDIR})
|
find_library(MRAA_LIBRARY NAMES mraa HINTS ${MRAA_LIBDIR})
|
||||||
@ -150,6 +151,11 @@ pkg_check_modules (MODBUS libmodbus>=3.1.2)
|
|||||||
# Check for OPENZWAVE
|
# Check for OPENZWAVE
|
||||||
pkg_check_modules (OPENZWAVE libopenzwave)
|
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 JPEG
|
||||||
find_package (JPEG)
|
find_package (JPEG)
|
||||||
|
|
||||||
@ -229,7 +235,7 @@ include (GetGitRevisionDescription)
|
|||||||
git_describe (VERSION "--tags")
|
git_describe (VERSION "--tags")
|
||||||
# If git_describe fails, use a dirty version
|
# If git_describe fails, use a dirty version
|
||||||
if (${VERSION} MATCHES -NOTFOUND)
|
if (${VERSION} MATCHES -NOTFOUND)
|
||||||
set (VERSION "v1.6.0")
|
set (VERSION "v1.7.1")
|
||||||
message (WARNING "Failed to retrieve UPM version with 'git describe' (using "
|
message (WARNING "Failed to retrieve UPM version with 'git describe' (using "
|
||||||
"${VERSION}). Check that git is installed and this is a valid git repo.")
|
"${VERSION}). Check that git is installed and this is a valid git repo.")
|
||||||
endif ()
|
endif ()
|
||||||
@ -252,11 +258,6 @@ set (upm_VERSION_MINOR ${VERSION_MINOR})
|
|||||||
set (upm_VERSION_PATCH ${VERSION_PATCH})
|
set (upm_VERSION_PATCH ${VERSION_PATCH})
|
||||||
set (upm_VERSION_STRING ${upm_VERSION_MAJOR}.${upm_VERSION_MINOR}.${upm_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
|
# enable c++11 standards support unconditionally
|
||||||
include(CheckCXXCompilerFlag)
|
include(CheckCXXCompilerFlag)
|
||||||
if (CMAKE_VERSION VERSION_LESS "3.1")
|
if (CMAKE_VERSION VERSION_LESS "3.1")
|
||||||
@ -417,71 +418,12 @@ function (CreateDocumentationTargets)
|
|||||||
endif(BUILDSWIGNODE)
|
endif(BUILDSWIGNODE)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
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()
|
|
||||||
|
|
||||||
# UPM common headers
|
# UPM common headers
|
||||||
set (UPM_COMMON_HEADER_DIRS ${CMAKE_HOME_DIRECTORY}/include)
|
set (UPM_COMMON_HEADER_DIRS ${CMAKE_HOME_DIRECTORY}/include)
|
||||||
|
|
||||||
|
# Generate a build-only C++ header to add functionality to SWIG'ed modules
|
||||||
|
configure_file (${PROJECT_SOURCE_DIR}/cmake/modules/version.hpp.in ${PROJECT_BINARY_DIR}/src/version.hpp @ONLY)
|
||||||
|
|
||||||
# UPM source
|
# UPM source
|
||||||
add_subdirectory (src)
|
add_subdirectory (src)
|
||||||
|
|
||||||
|
44
CONTRIBUTING
Normal 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.
|
||||||
|
|
||||||
|
*
|
2
LICENSE
@ -1,5 +1,5 @@
|
|||||||
The MIT License (MIT)
|
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
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
a copy of this software and associated documentation files (the
|
a copy of this software and associated documentation files (the
|
||||||
|
82
README.md
@ -1,34 +1,36 @@
|
|||||||
<p align="center">
|
<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>
|
</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
|
The Eclipse UPM repository provides software drivers for a wide variety of
|
||||||
used sensors and actuators. These software drivers interact with the
|
commonly used sensors and actuators. These software drivers interact with the
|
||||||
underlying hardware platform (or microcontroller), as well as with the attached
|
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 sensor’s
|
Programmers can access the interfaces for each sensor by including the sensor's
|
||||||
corresponding header file and instantiating the associated sensor class. In the
|
corresponding header file and instantiating the associated sensor class. In the
|
||||||
typical use case, a constructor initializes the sensor based on parameters that
|
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.
|
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
|
We endorse additions that implement the generic C and C++ interfaces provided
|
||||||
with the libraries. Multiple sensor and actuator types have been defined, for
|
with the libraries. With the 2.0 release, UPM introduces the following sensor
|
||||||
instance:
|
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
|
The UPM project is joining the Eclipse Foundation as an Eclipse IoT project.
|
||||||
* Light sensor
|
You can read more about this [here](https://projects.eclipse.org/proposals/eclipse-upm).
|
||||||
* 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.
|
|
||||||
|
|
||||||
### Example
|
### 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.
|
[iot-devkit-samples](https://github.com/intel-iot-devkit/iot-devkit-samples) repository.
|
||||||
|
|
||||||
### Supported Sensors
|
### Supported Sensors
|
||||||
|
|
||||||
Supported [sensor list](http://iotdk.intel.com/docs/master/upm/modules.html) from API documentation.
|
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 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
|
||||||
The UPM sensor libraries are directly supported by the IDEs listed on the Intel®
|
through the help of the Foundation's partners.
|
||||||
Developer Zone Tools & IDEs page.
|
Learn more about [tools](https://software.intel.com/en-us/tools-by-segment/systems-iot).
|
||||||
|
|
||||||
<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.
|
|
||||||
|
|
||||||
### Installing UPM
|
### 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).
|
See building documentation [here](docs/building.md).
|
||||||
|
|
||||||
[](https://travis-ci.org/intel-iot-devkit/upm)
|
[](https://travis-ci.org/intel-iot-devkit/upm)
|
||||||
|
[](https://sonarcloud.io/dashboard?id=upm-master)
|
||||||
### 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.
|
|
||||||
|
|
||||||
### Guidelines and rules for new UPM contributions
|
### Guidelines and rules for new UPM contributions
|
||||||
|
|
||||||
Before you begin development, take a look at our naming [conventions](docs/naming.md).
|
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.
|
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.
|
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
|
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
|
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
|
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.
|
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,
|
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
|
and the intel-iot-devkit repositories in general, take a look at our extensive
|
||||||
[author guide](docs/guidelines.md).
|
[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
|
unable to compile code that was working fine before a library update, make sure
|
||||||
you check the [API changes](docs/apichanges.md) section first.
|
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`
|
|
||||||
|
|
||||||
### Changelog
|
### Changelog
|
||||||
Version changelog [here](docs/changelog.md).
|
Version changelog [here](docs/changelog.md).
|
||||||
|
|
||||||
|
@ -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)
|
|
@ -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()
|
|
6
cmake/modules/version.hpp.in
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#include <string>
|
||||||
|
|
||||||
|
inline std::string getVersion()
|
||||||
|
{
|
||||||
|
return "@upm_VERSION_STRING@";
|
||||||
|
}
|
@ -16,6 +16,7 @@ services:
|
|||||||
- BUILDCORDOVA=${BUILDCORDOVA:-OFF}
|
- BUILDCORDOVA=${BUILDCORDOVA:-OFF}
|
||||||
- BUILDSWIGNODE=${BUILDSWIGNODE:-OFF}
|
- BUILDSWIGNODE=${BUILDSWIGNODE:-OFF}
|
||||||
- BUILDEXAMPLES=${BUILDEXAMPLES:-OFF}
|
- BUILDEXAMPLES=${BUILDEXAMPLES:-OFF}
|
||||||
|
- CMAKE_BUILD_TYPE
|
||||||
- IPK=${IPK:-OFF}
|
- IPK=${IPK:-OFF}
|
||||||
- RPM=${RPM:-OFF}
|
- RPM=${RPM:-OFF}
|
||||||
- NPM=${NPM:-OFF}
|
- NPM=${NPM:-OFF}
|
||||||
@ -55,20 +56,6 @@ services:
|
|||||||
- BUILDEXAMPLES=ON
|
- BUILDEXAMPLES=ON
|
||||||
command: bash -c "./scripts/run-cmake.sh && cd build && make -j8"
|
command: bash -c "./scripts/run-cmake.sh && cd build && make -j8"
|
||||||
|
|
||||||
ipk:
|
|
||||||
extends: all
|
|
||||||
environment:
|
|
||||||
- IPK=ON
|
|
||||||
- BUILDDOC=OFF
|
|
||||||
command: bash -c "./scripts/run-cmake.sh && make -Cbuild -j8 package"
|
|
||||||
|
|
||||||
rpm:
|
|
||||||
extends: all
|
|
||||||
environment:
|
|
||||||
- RPM=ON
|
|
||||||
- BUILDDOC=OFF
|
|
||||||
command: bash -c "./scripts/run-cmake.sh && make -Cbuild -j8 package"
|
|
||||||
|
|
||||||
npm:
|
npm:
|
||||||
extends: all
|
extends: all
|
||||||
environment:
|
environment:
|
||||||
@ -77,12 +64,10 @@ services:
|
|||||||
command: bash -c "./scripts/run-cmake.sh && make -Cbuild -j8 npmpkg"
|
command: bash -c "./scripts/run-cmake.sh && make -Cbuild -j8 npmpkg"
|
||||||
|
|
||||||
sonar-scan:
|
sonar-scan:
|
||||||
extends: all
|
extends: base
|
||||||
|
image: inteliotdevkit/upm-sonar
|
||||||
environment:
|
environment:
|
||||||
- BUILDSWIGPYTHON=ON
|
- BUILDTESTS=OFF
|
||||||
- BUILDSWIGNODE=ON
|
|
||||||
- BUILDSWIGJAVA=ON
|
|
||||||
- BUILDEXAMPLES=ON
|
|
||||||
- SONAR_TOKEN
|
- SONAR_TOKEN
|
||||||
- SONAR_ORG
|
- SONAR_ORG
|
||||||
- SONAR_PROJ_KEY
|
- SONAR_PROJ_KEY
|
||||||
|
@ -4,10 +4,24 @@ API Changes {#apichanges}
|
|||||||
Here's a list of other API changes made to the library that break source/binary
|
Here's a list of other API changes made to the library that break source/binary
|
||||||
compatibility between releases:
|
compatibility between releases:
|
||||||
|
|
||||||
# vNext
|
# v2.0.0
|
||||||
* The interface of **kx122** has been modified to return values instead of
|
* Sensors implementing the old interfaces (bme280, bmpx8x, si7005, si1132,
|
||||||
receiving pointers. This applies to member functions: getWhoAmI,
|
max44009, lp8860, ds1808lc, hlg150h) have been updated to use the new ones,
|
||||||
getInterruptSource, getBufferStatus, getRawBufferSamples, and getBufferSamples.
|
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
|
# v1.6.0
|
||||||
|
|
||||||
|
@ -96,13 +96,16 @@ You can also generate the include and lib directories containing all the sensor
|
|||||||
headers and library files respectively with *make install*. Further, you may
|
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
|
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
|
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
|
cd src/lcd
|
||||||
make install
|
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
|
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
|
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
|
this you need to use the target name for the python or node module you want to
|
||||||
|
@ -4,6 +4,37 @@ Changelog {#changelog}
|
|||||||
Here's a list summarizing some of the key undergoing changes to our library
|
Here's a list summarizing some of the key undergoing changes to our library
|
||||||
from earlier versions:
|
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
|
### v1.6.0
|
||||||
|
|
||||||
* Extended LED library to support the new MRAA gpio-leds APIs
|
* Extended LED library to support the new MRAA gpio-leds APIs
|
||||||
|
@ -1,22 +1,13 @@
|
|||||||
Contributing a module {#contributions}
|
Contributing a module {#contributions}
|
||||||
=====================
|
=====================
|
||||||
|
|
||||||
Here are the rules of contribution:
|
In order to contribute to the project:
|
||||||
- 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/.
|
|
||||||
- The top of each source file must contain a comment block containing the
|
- The top of each source file must contain a comment block containing the
|
||||||
license information.
|
license information.
|
||||||
- Please test your module builds before contributing and make sure it works on
|
- Commits must be named `<file/module>: Some decent description`.
|
||||||
the latest version of libmraa. If you tested on a specific board/platform
|
- Each commit must have a sign-off line by everyone who authored or reviewed
|
||||||
please tell us what this was in your PR.
|
them.
|
||||||
- Try not to break master. In any commit.
|
- 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
|
- Attempt to have some decent API documentation as described in the the @ref
|
||||||
documentation [guide](documentation.md).
|
documentation [guide](documentation.md).
|
||||||
|
|
||||||
@ -27,74 +18,36 @@ the UPM repository. Below is the comment block needed at the top each source
|
|||||||
file:
|
file:
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The MIT License (MIT)
|
|
||||||
*
|
|
||||||
* Author: <your full name>
|
* Author: <your full name>
|
||||||
* Copyright (c) <year> <copyright holder>
|
* Copyright (c) <year> <copyright holder>
|
||||||
*
|
*
|
||||||
* Author: <contributing author full name - if applicable>
|
* Author: <contributing author full name - if applicable>
|
||||||
* Copyright (c) <year> <copyright holder>
|
* Copyright (c) <year> <copyright holder>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
* This program and the accompanying materials are made available under the
|
||||||
* this software and associated documentation files (the "Software"), to deal in
|
* terms of the MIT License which is available at https://opensource.org/licenses/MIT.
|
||||||
* the Software without restriction, including without limitation the rights to
|
|
||||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
||||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
|
||||||
* subject to the following conditions:
|
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice shall be included in all
|
* SPDX-License-Identifier: MIT
|
||||||
* 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.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
Eclipse Contributor Agreement
|
||||||
Code signing
|
|
||||||
============
|
============
|
||||||
|
|
||||||
The sign-off is a simple line at the end of the explanation for the
|
Your contribution cannot be accepted unless you have a signed [ECA - Eclipse Foundation Contributor Agreement](http://www.eclipse.org/legal/ECA.php) in place.
|
||||||
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:
|
|
||||||
|
|
||||||
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:
|
1. [Create an account at Eclipse](https://dev.eclipse.org/site_login/createaccount.php).
|
||||||
|
2. Add your GitHub user name in your account settings.
|
||||||
(a) The contribution was created in whole or in part by me and I
|
3. [Log into the project's portal](https://projects.eclipse.org/) and sign the ["Eclipse ECA"](https://projects.eclipse.org/user/sign/cla).
|
||||||
have the right to submit it under the open source license
|
4. Ensure that you [_sign-off_](https://wiki.eclipse.org/Development_Resources/Contributing_via_Git#Signing_off_on_a_commit) your Git commits.
|
||||||
indicated in the file; or
|
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.
|
||||||
(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.
|
|
||||||
|
|
||||||
|
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
|
Creating a new sensor library using the sensortemplate
|
||||||
=======================================
|
=======================================
|
||||||
|
Before Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 5.1 KiB |
@ -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/.
|
|
||||||
|
|
Before Width: | Height: | Size: 164 KiB |
Before Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 83 KiB |
Before Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 6.6 KiB |
Before Width: | Height: | Size: 159 KiB |
Before Width: | Height: | Size: 138 KiB |
Before Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 77 KiB |
Before Width: | Height: | Size: 9.4 KiB |
Before Width: | Height: | Size: 167 KiB |
Before Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 79 KiB |
Before Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 64 KiB |
Before Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 135 KiB |
Before Width: | Height: | Size: 97 KiB |
Before Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 33 KiB |
Before Width: | Height: | Size: 105 KiB |
Before Width: | Height: | Size: 90 KiB |
BIN
docs/images/kxtj3.png
Executable file
After Width: | Height: | Size: 52 KiB |
Before Width: | Height: | Size: 23 KiB |
@ -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
|
Running UPM applications on Ubuntu systems requires elevated permissions
|
||||||
(e.g. run with `sudo`).
|
(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)
|
### Node.js bindings only (NPM)
|
||||||
|
|
||||||
This option allows compiling MRAA/UPM on any system with npm and node-gyp.
|
This option allows compiling MRAA/UPM on any system with npm and node-gyp.
|
||||||
|
@ -25,6 +25,4 @@ sensor can inherit your class if they only have minor changes.
|
|||||||
|
|
||||||
### Doubt
|
### Doubt
|
||||||
|
|
||||||
If ever, give either of us a ping via email:
|
If ever, open a new issue and ask for naming help from the project's community.
|
||||||
mihai.tudor.panu@intel.com or brendan.le.foll@intel.com
|
|
||||||
and we'll try suggest decent names for your module.
|
|
||||||
|
@ -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
|
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.
|
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
|
More details on @ref contributions and on
|
||||||
formatted patch of your sensor. More details are on @ref contributions and on
|
|
||||||
https://help.github.com/articles/creating-a-pull-request
|
https://help.github.com/articles/creating-a-pull-request
|
||||||
|
|
||||||
|
@ -34,13 +34,6 @@ var lib = require('jsupm_<module-name>');
|
|||||||
### Supported Sensors
|
### Supported Sensors
|
||||||
The full list is available on [Intel® IoT Developer Zone](https://software.intel.com/en-us/iot/hardware/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.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
### Building UPM
|
### Building UPM
|
||||||
See building documentation [here](https://github.com/intel-iot-devkit/upm/blob/master/docs/building.md).
|
See building documentation [here](https://github.com/intel-iot-devkit/upm/blob/master/docs/building.md).
|
||||||
|
|
||||||
|
@ -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>`_.
|
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``
|
``Making your own UPM Module``
|
||||||
##############################
|
##############################
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
<p>
|
<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>.
|
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.
|
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>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -36,19 +36,6 @@
|
|||||||
href="https://github.com/intel-iot-devkit/upm/tree/master/examples/javascript">here</a>.</p>
|
href="https://github.com/intel-iot-devkit/upm/tree/master/examples/javascript">here</a>.</p>
|
||||||
|
|
||||||
</div>
|
</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® XDK IoT Edition is the recommended IDE for Node.js development.
|
|
||||||
Visit the Intel® 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">
|
<div class="section" id="building-upm">
|
||||||
<h3><tt class="docutils literal"><span class="pre">Building</span>
|
<h3><tt class="docutils literal"><span class="pre">Building</span>
|
||||||
<span class="pre">UPM</span></tt><a class="headerlink"
|
<span class="pre">UPM</span></tt><a class="headerlink"
|
||||||
|
@ -3,6 +3,9 @@ a110x.cxx A110X_Example.java a110x.js a110x.py
|
|||||||
a110x-intr.cxx A110X_intr_Example.java a110x-intr.js a110x-intr.py
|
a110x-intr.cxx A110X_intr_Example.java a110x-intr.js a110x-intr.py
|
||||||
adc121c021.cxx ADC121C021_Example.java adc121c021.js adc121c021.py
|
adc121c021.cxx ADC121C021_Example.java adc121c021.js adc121c021.py
|
||||||
adxl345.cxx Adxl345_Example.java adxl345.js adxl345.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
|
biss0001.cxx BISS0001_Example.java biss0001.js biss0001.py
|
||||||
bmpx8x.cxx BMPX8X_Example.java bmpx8x.js bmpx8x.py
|
bmpx8x.cxx BMPX8X_Example.java bmpx8x.js bmpx8x.py
|
||||||
bno055.cxx BNO055_Example.java bno055.js bno055.py
|
bno055.cxx BNO055_Example.java bno055.js bno055.py
|
||||||
|
528
examples/c++/2jciebu01_ble.cxx
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
403
examples/c++/2jciebu01_usb.cxx
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -3,16 +3,10 @@ file (GLOB example_src_list RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.cxx")
|
|||||||
|
|
||||||
# - Handle special cases here --------------------------------------------------
|
# - Handle special cases here --------------------------------------------------
|
||||||
|
|
||||||
# Test humidity interface for 2 sensor libraries
|
# Test temperature interface for 2 sensor libraries
|
||||||
add_example(core-humiditysensor.cxx TARGETS si7005 bmp280)
|
add_example(iTemperature_sample.cxx TARGETS interfaces lm35 abp)
|
||||||
# Test pressure interface for 2 sensor libraries
|
# Test light interface for 3 sensor libraries
|
||||||
add_example(core-pressuresensor.cxx TARGETS bmp280 bmpx8x)
|
add_example(iLight_sample.cxx TARGETS interfaces apds9002 bh1750 max44009)
|
||||||
# Test temperature interface for 3 sensor libraries
|
|
||||||
add_example(core-temperaturesensor.cxx TARGETS bmp280 bmpx8x si7005)
|
|
||||||
# Test light interface for 2 sensor libraries
|
|
||||||
add_example(core-lightsensor.cxx TARGETS si1132 max44009)
|
|
||||||
# Test light controller interface for 3 sensor libraries
|
|
||||||
add_example(core-lightcontroller.cxx TARGETS lp8860 ds1808lc hlg150h)
|
|
||||||
|
|
||||||
# - Create an executable for all other src files in this directory -------------
|
# - Create an executable for all other src files in this directory -------------
|
||||||
foreach (_example_src ${example_src_list})
|
foreach (_example_src ${example_src_list})
|
||||||
|
@ -2,24 +2,11 @@
|
|||||||
* Author: Jon Trulson <jtrulson@ics.com>
|
* Author: Jon Trulson <jtrulson@ics.com>
|
||||||
* Copyright (c) 2015 Intel Corporation.
|
* Copyright (c) 2015 Intel Corporation.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining
|
* This program and the accompanying materials are made available under the
|
||||||
* a copy of this software and associated documentation files (the
|
* terms of the The MIT License which is available at
|
||||||
* "Software"), to deal in the Software without restriction, including
|
* https://opensource.org/licenses/MIT.
|
||||||
* without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
* permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
* the following conditions:
|
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice shall be
|
* SPDX-License-Identifier: MIT
|
||||||
* included in all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
||||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
||||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
@ -2,24 +2,11 @@
|
|||||||
* Author: Jon Trulson <jtrulson@ics.com>
|
* Author: Jon Trulson <jtrulson@ics.com>
|
||||||
* Copyright (c) 2014 Intel Corporation.
|
* Copyright (c) 2014 Intel Corporation.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining
|
* This program and the accompanying materials are made available under the
|
||||||
* a copy of this software and associated documentation files (the
|
* terms of the The MIT License which is available at
|
||||||
* "Software"), to deal in the Software without restriction, including
|
* https://opensource.org/licenses/MIT.
|
||||||
* without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
* permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
* the following conditions:
|
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice shall be
|
* SPDX-License-Identifier: MIT
|
||||||
* included in all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
||||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
||||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
@ -2,24 +2,11 @@
|
|||||||
* Author: Abhishek Malik <abhishek.malik@intel.com>
|
* Author: Abhishek Malik <abhishek.malik@intel.com>
|
||||||
* Copyright (c) 2017 Intel Corporation.
|
* Copyright (c) 2017 Intel Corporation.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining
|
* This program and the accompanying materials are made available under the
|
||||||
* a copy of this software and associated documentation files (the
|
* terms of the The MIT License which is available at
|
||||||
* "Software"), to deal in the Software without restriction, including
|
* https://opensource.org/licenses/MIT.
|
||||||
* without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
* permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
* the following conditions:
|
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice shall be
|
* SPDX-License-Identifier: MIT
|
||||||
* included in all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
||||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
||||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
@ -2,24 +2,11 @@
|
|||||||
* Author: Jon Trulson <jtrulson@ics.com>
|
* Author: Jon Trulson <jtrulson@ics.com>
|
||||||
* Copyright (c) 2015 Intel Corporation.
|
* Copyright (c) 2015 Intel Corporation.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining
|
* This program and the accompanying materials are made available under the
|
||||||
* a copy of this software and associated documentation files (the
|
* terms of the The MIT License which is available at
|
||||||
* "Software"), to deal in the Software without restriction, including
|
* https://opensource.org/licenses/MIT.
|
||||||
* without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
* permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
* the following conditions:
|
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice shall be
|
* SPDX-License-Identifier: MIT
|
||||||
* included in all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
||||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
||||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
@ -2,24 +2,11 @@
|
|||||||
* Author: Jon Trulson <jtrulson@ics.com>
|
* Author: Jon Trulson <jtrulson@ics.com>
|
||||||
* Copyright (c) 2015 Intel Corporation.
|
* Copyright (c) 2015 Intel Corporation.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining
|
* This program and the accompanying materials are made available under the
|
||||||
* a copy of this software and associated documentation files (the
|
* terms of the The MIT License which is available at
|
||||||
* "Software"), to deal in the Software without restriction, including
|
* https://opensource.org/licenses/MIT.
|
||||||
* without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
* permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
* the following conditions:
|
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice shall be
|
* SPDX-License-Identifier: MIT
|
||||||
* included in all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
||||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
||||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
@ -2,24 +2,11 @@
|
|||||||
* Author: Jon Trulson <jtrulson@ics.com>
|
* Author: Jon Trulson <jtrulson@ics.com>
|
||||||
* Copyright (c) 2015 Intel Corporation.
|
* Copyright (c) 2015 Intel Corporation.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining
|
* This program and the accompanying materials are made available under the
|
||||||
* a copy of this software and associated documentation files (the
|
* terms of the The MIT License which is available at
|
||||||
* "Software"), to deal in the Software without restriction, including
|
* https://opensource.org/licenses/MIT.
|
||||||
* without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
* permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
* the following conditions:
|
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice shall be
|
* SPDX-License-Identifier: MIT
|
||||||
* included in all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
||||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
||||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
@ -2,24 +2,11 @@
|
|||||||
* Author: Stan Gifford <stan@gifford.id.au>
|
* Author: Stan Gifford <stan@gifford.id.au>
|
||||||
* Copyright (c) 2015 Intel Corporation.
|
* Copyright (c) 2015 Intel Corporation.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining
|
* This program and the accompanying materials are made available under the
|
||||||
* a copy of this software and associated documentation files (the
|
* terms of the The MIT License which is available at
|
||||||
* "Software"), to deal in the Software without restriction, including
|
* https://opensource.org/licenses/MIT.
|
||||||
* without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
* permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
* the following conditions:
|
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice shall be
|
* SPDX-License-Identifier: MIT
|
||||||
* 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.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2,24 +2,11 @@
|
|||||||
* Author: Jon Trulson <jtrulson@ics.com>
|
* Author: Jon Trulson <jtrulson@ics.com>
|
||||||
* Copyright (c) 2014 Intel Corporation.
|
* Copyright (c) 2014 Intel Corporation.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining
|
* This program and the accompanying materials are made available under the
|
||||||
* a copy of this software and associated documentation files (the
|
* terms of the The MIT License which is available at
|
||||||
* "Software"), to deal in the Software without restriction, including
|
* https://opensource.org/licenses/MIT.
|
||||||
* without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
* permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
* the following conditions:
|
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice shall be
|
* SPDX-License-Identifier: MIT
|
||||||
* included in all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
||||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
||||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
@ -2,24 +2,11 @@
|
|||||||
* Author: Henry Bruce <henry.bruce@intel.com>
|
* Author: Henry Bruce <henry.bruce@intel.com>
|
||||||
* Copyright (c) 2015 Intel Corporation.
|
* Copyright (c) 2015 Intel Corporation.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining
|
* This program and the accompanying materials are made available under the
|
||||||
* a copy of this software and associated documentation files (the
|
* terms of the The MIT License which is available at
|
||||||
* "Software"), to deal in the Software without restriction, including
|
* https://opensource.org/licenses/MIT.
|
||||||
* without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
* permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
* the following conditions:
|
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice shall be
|
* SPDX-License-Identifier: MIT
|
||||||
* included in all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
||||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
||||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <exception>
|
#include <exception>
|
||||||
@ -27,7 +14,6 @@
|
|||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
#include "ads1015.hpp"
|
#include "ads1015.hpp"
|
||||||
#include "iADC.hpp"
|
|
||||||
#include "mraa/gpio.hpp"
|
#include "mraa/gpio.hpp"
|
||||||
#include "upm_utilities.h"
|
#include "upm_utilities.h"
|
||||||
|
|
||||||
@ -39,24 +25,21 @@ int
|
|||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
/* Create an instance of the ADS1015 sensor */
|
/* 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);
|
mraa::Gpio gpio(EDISON_GPIO_SI7005_CS);
|
||||||
gpio.dir(mraa::DIR_OUT_HIGH);
|
gpio.dir(mraa::DIR_OUT_HIGH);
|
||||||
|
|
||||||
/* Show usage from the iADC interface */
|
// if (adc == NULL) {
|
||||||
upm::iADC* adc = static_cast<upm::iADC*>(&sensor);
|
// std::cout << "ADC not detected" << std::endl;
|
||||||
|
// return 1;
|
||||||
if (adc == NULL) {
|
// }
|
||||||
std::cout << "ADC not detected" << std::endl;
|
std::cout << "ADC " << adc.getModuleName() << " detected. ";
|
||||||
return 1;
|
std::cout << adc.getNumInputs() << " inputs available" << std::endl;
|
||||||
}
|
|
||||||
std::cout << "ADC " << adc->Name() << " detected. ";
|
|
||||||
std::cout << adc->getNumInputs() << " inputs available" << std::endl;
|
|
||||||
while (true) {
|
while (true) {
|
||||||
for (unsigned int i = 0; i < adc->getNumInputs(); ++i) {
|
for (unsigned int i = 0; i < adc.getNumInputs(); ++i) {
|
||||||
std::cout << "Input " << i;
|
std::cout << "Input " << i;
|
||||||
try {
|
try {
|
||||||
float voltage = adc->getVoltage(i);
|
float voltage = adc.getVoltage(i);
|
||||||
std::cout << ": Voltage = " << voltage << "V" << std::endl;
|
std::cout << ": Voltage = " << voltage << "V" << std::endl;
|
||||||
} catch (std::exception& e) {
|
} catch (std::exception& e) {
|
||||||
std::cerr << e.what() << std::endl;
|
std::cerr << e.what() << std::endl;
|
||||||
|
@ -2,24 +2,11 @@
|
|||||||
* Author: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
|
* Author: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
|
||||||
* Copyright (c) 2016 Intel Corporation.
|
* Copyright (c) 2016 Intel Corporation.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining
|
* This program and the accompanying materials are made available under the
|
||||||
* a copy of this software and associated documentation files (the
|
* terms of the The MIT License which is available at
|
||||||
* "Software"), to deal in the Software without restriction, including
|
* https://opensource.org/licenses/MIT.
|
||||||
* without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
* permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
* the following conditions:
|
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice shall be
|
* SPDX-License-Identifier: MIT
|
||||||
* 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.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* This example demonstrates how to use one the ADS1015 ADC on the Grove Joule
|
/* This example demonstrates how to use one the ADS1015 ADC on the Grove Joule
|
||||||
|
@ -2,24 +2,11 @@
|
|||||||
* Author: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
|
* Author: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
|
||||||
* Copyright (c) 2016 Intel Corporation.
|
* Copyright (c) 2016 Intel Corporation.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining
|
* This program and the accompanying materials are made available under the
|
||||||
* a copy of this software and associated documentation files (the
|
* terms of the The MIT License which is available at
|
||||||
* "Software"), to deal in the Software without restriction, including
|
* https://opensource.org/licenses/MIT.
|
||||||
* without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
* permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
* the following conditions:
|
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice shall be
|
* SPDX-License-Identifier: MIT
|
||||||
* 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.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* This example demonstrates how to use one of the ADS1115 ADCs on the
|
/* This example demonstrates how to use one of the ADS1115 ADCs on the
|
||||||
|
@ -2,24 +2,11 @@
|
|||||||
* Author: Marc Graham <marc@m2ag.net>
|
* Author: Marc Graham <marc@m2ag.net>
|
||||||
* Copyright (c) 2015 Intel Corporation.
|
* Copyright (c) 2015 Intel Corporation.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining
|
* This program and the accompanying materials are made available under the
|
||||||
* a copy of this software and associated documentation files (the
|
* terms of the The MIT License which is available at
|
||||||
* "Software"), to deal in the Software without restriction, including
|
* https://opensource.org/licenses/MIT.
|
||||||
* without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
* permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
* the following conditions:
|
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice shall be
|
* SPDX-License-Identifier: MIT
|
||||||
* included in all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
||||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
||||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
@ -2,24 +2,11 @@
|
|||||||
* Author: Jon Trulson <jtrulson@ics.com>
|
* Author: Jon Trulson <jtrulson@ics.com>
|
||||||
* Copyright (c) 2015 Intel Corporation.
|
* Copyright (c) 2015 Intel Corporation.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining
|
* This program and the accompanying materials are made available under the
|
||||||
* a copy of this software and associated documentation files (the
|
* terms of the The MIT License which is available at
|
||||||
* "Software"), to deal in the Software without restriction, including
|
* https://opensource.org/licenses/MIT.
|
||||||
* without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
* permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
* the following conditions:
|
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice shall be
|
* SPDX-License-Identifier: MIT
|
||||||
* included in all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
||||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
||||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
@ -2,24 +2,11 @@
|
|||||||
* Author: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
|
* Author: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
|
||||||
* Copyright (c) 2014 Intel Corporation.
|
* Copyright (c) 2014 Intel Corporation.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining
|
* This program and the accompanying materials are made available under the
|
||||||
* a copy of this software and associated documentation files (the
|
* terms of the The MIT License which is available at
|
||||||
* "Software"), to deal in the Software without restriction, including
|
* https://opensource.org/licenses/MIT.
|
||||||
* without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
* permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
* the following conditions:
|
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice shall be
|
* SPDX-License-Identifier: MIT
|
||||||
* included in all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
||||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
||||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -2,24 +2,11 @@
|
|||||||
* Author: Jon Trulson <jtrulson@ics.com>
|
* Author: Jon Trulson <jtrulson@ics.com>
|
||||||
* Copyright (c) 2015 Intel Corporation.
|
* Copyright (c) 2015 Intel Corporation.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining
|
* This program and the accompanying materials are made available under the
|
||||||
* a copy of this software and associated documentation files (the
|
* terms of the The MIT License which is available at
|
||||||
* "Software"), to deal in the Software without restriction, including
|
* https://opensource.org/licenses/MIT.
|
||||||
* without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
* permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
* the following conditions:
|
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice shall be
|
* SPDX-License-Identifier: MIT
|
||||||
* included in all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
||||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
||||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
@ -2,24 +2,11 @@
|
|||||||
* Author: William Penner <william.penner@intel.com>
|
* Author: William Penner <william.penner@intel.com>
|
||||||
* Copyright (c) 2014 Intel Corporation.
|
* Copyright (c) 2014 Intel Corporation.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining
|
* This program and the accompanying materials are made available under the
|
||||||
* a copy of this software and associated documentation files (the
|
* terms of the The MIT License which is available at
|
||||||
* "Software"), to deal in the Software without restriction, including
|
* https://opensource.org/licenses/MIT.
|
||||||
* without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
* permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
* the following conditions:
|
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice shall be
|
* SPDX-License-Identifier: MIT
|
||||||
* included in all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
||||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
||||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
@ -2,24 +2,11 @@
|
|||||||
* Author: Yannick Adam <yannick.adam@gmail.com>
|
* Author: Yannick Adam <yannick.adam@gmail.com>
|
||||||
* Copyright (c) 2016 Yannick Adam
|
* Copyright (c) 2016 Yannick Adam
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining
|
* This program and the accompanying materials are made available under the
|
||||||
* a copy of this software and associated documentation files (the
|
* terms of the The MIT License which is available at
|
||||||
* "Software"), to deal in the Software without restriction, including
|
* https://opensource.org/licenses/MIT.
|
||||||
* without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
* permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
* the following conditions:
|
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice shall be
|
* SPDX-License-Identifier: MIT
|
||||||
* included in all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
||||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
||||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "apa102.hpp"
|
#include "apa102.hpp"
|
||||||
|
@ -2,24 +2,11 @@
|
|||||||
* Author: Zion Orent <zorent@ics.com>
|
* Author: Zion Orent <zorent@ics.com>
|
||||||
* Copyright (c) 2015 Intel Corporation.
|
* Copyright (c) 2015 Intel Corporation.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining
|
* This program and the accompanying materials are made available under the
|
||||||
* a copy of this software and associated documentation files (the
|
* terms of the The MIT License which is available at
|
||||||
* "Software"), to deal in the Software without restriction, including
|
* https://opensource.org/licenses/MIT.
|
||||||
* without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
* permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
* the following conditions:
|
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice shall be
|
* SPDX-License-Identifier: MIT
|
||||||
* included in all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
||||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
||||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
@ -2,24 +2,11 @@
|
|||||||
* Author: Lay, Kuan Loon <kuan.loon.lay@intel.com>
|
* Author: Lay, Kuan Loon <kuan.loon.lay@intel.com>
|
||||||
* Copyright (c) 2016 Intel Corporation.
|
* Copyright (c) 2016 Intel Corporation.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining
|
* This program and the accompanying materials are made available under the
|
||||||
* a copy of this software and associated documentation files (the
|
* terms of the The MIT License which is available at
|
||||||
* "Software"), to deal in the Software without restriction, including
|
* https://opensource.org/licenses/MIT.
|
||||||
* without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
* permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
* the following conditions:
|
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice shall be
|
* SPDX-License-Identifier: MIT
|
||||||
* included in all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
||||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
||||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
@ -2,24 +2,11 @@
|
|||||||
* Author: Jon Trulson <jtrulson@ics.com>
|
* Author: Jon Trulson <jtrulson@ics.com>
|
||||||
* Copyright (c) 2015 Intel Corporation.
|
* Copyright (c) 2015 Intel Corporation.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining
|
* This program and the accompanying materials are made available under the
|
||||||
* a copy of this software and associated documentation files (the
|
* terms of the The MIT License which is available at
|
||||||
* "Software"), to deal in the Software without restriction, including
|
* https://opensource.org/licenses/MIT.
|
||||||
* without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
* permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
* the following conditions:
|
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice shall be
|
* SPDX-License-Identifier: MIT
|
||||||
* included in all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
||||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
||||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
60
examples/c++/bh1749.cxx
Executable 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]
|
@ -2,24 +2,11 @@
|
|||||||
* Author: Jon Trulson <jtrulson@ics.com>
|
* Author: Jon Trulson <jtrulson@ics.com>
|
||||||
* Copyright (c) 2015 Intel Corporation.
|
* Copyright (c) 2015 Intel Corporation.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining
|
* This program and the accompanying materials are made available under the
|
||||||
* a copy of this software and associated documentation files (the
|
* terms of the The MIT License which is available at
|
||||||
* "Software"), to deal in the Software without restriction, including
|
* https://opensource.org/licenses/MIT.
|
||||||
* without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
* permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
* the following conditions:
|
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice shall be
|
* SPDX-License-Identifier: MIT
|
||||||
* included in all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
||||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
||||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
70
examples/c++/bh1792.cxx
Executable 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]
|
@ -2,24 +2,11 @@
|
|||||||
* Author: Zion Orent <zorent@ics.com>
|
* Author: Zion Orent <zorent@ics.com>
|
||||||
* Copyright (c) 2014 Intel Corporation.
|
* Copyright (c) 2014 Intel Corporation.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining
|
* This program and the accompanying materials are made available under the
|
||||||
* a copy of this software and associated documentation files (the
|
* terms of the The MIT License which is available at
|
||||||
* "Software"), to deal in the Software without restriction, including
|
* https://opensource.org/licenses/MIT.
|
||||||
* without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
* permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
* the following conditions:
|
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice shall be
|
* SPDX-License-Identifier: MIT
|
||||||
* included in all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
||||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
||||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
@ -2,24 +2,11 @@
|
|||||||
* Author: Jon Trulson <jtrulson@ics.com>
|
* Author: Jon Trulson <jtrulson@ics.com>
|
||||||
* Copyright (c) 2015 Intel Corporation.
|
* Copyright (c) 2015 Intel Corporation.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining
|
* This program and the accompanying materials are made available under the
|
||||||
* a copy of this software and associated documentation files (the
|
* terms of the The MIT License which is available at
|
||||||
* "Software"), to deal in the Software without restriction, including
|
* https://opensource.org/licenses/MIT.
|
||||||
* without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
* permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
* the following conditions:
|
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice shall be
|
* SPDX-License-Identifier: MIT
|
||||||
* included in all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
||||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
||||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
@ -2,24 +2,11 @@
|
|||||||
* Author: Jon Trulson <jtrulson@ics.com>
|
* Author: Jon Trulson <jtrulson@ics.com>
|
||||||
* Copyright (c) 2016 Intel Corporation.
|
* Copyright (c) 2016 Intel Corporation.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining
|
* This program and the accompanying materials are made available under the
|
||||||
* a copy of this software and associated documentation files (the
|
* terms of the The MIT License which is available at
|
||||||
* "Software"), to deal in the Software without restriction, including
|
* https://opensource.org/licenses/MIT.
|
||||||
* without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
* permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
* the following conditions:
|
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice shall be
|
* SPDX-License-Identifier: MIT
|
||||||
* included in all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
||||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
||||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
@ -2,24 +2,11 @@
|
|||||||
* Author: Jon Trulson <jtrulson@ics.com>
|
* Author: Jon Trulson <jtrulson@ics.com>
|
||||||
* Copyright (c) 2016 Intel Corporation.
|
* Copyright (c) 2016 Intel Corporation.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining
|
* This program and the accompanying materials are made available under the
|
||||||
* a copy of this software and associated documentation files (the
|
* terms of the The MIT License which is available at
|
||||||
* "Software"), to deal in the Software without restriction, including
|
* https://opensource.org/licenses/MIT.
|
||||||
* without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
* permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
* the following conditions:
|
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice shall be
|
* SPDX-License-Identifier: MIT
|
||||||
* included in all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
||||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
||||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
@ -2,24 +2,11 @@
|
|||||||
* Author: Jon Trulson <jtrulson@ics.com>
|
* Author: Jon Trulson <jtrulson@ics.com>
|
||||||
* Copyright (c) 2016 Intel Corporation.
|
* Copyright (c) 2016 Intel Corporation.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining
|
* This program and the accompanying materials are made available under the
|
||||||
* a copy of this software and associated documentation files (the
|
* terms of the The MIT License which is available at
|
||||||
* "Software"), to deal in the Software without restriction, including
|
* https://opensource.org/licenses/MIT.
|
||||||
* without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
* permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
* the following conditions:
|
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice shall be
|
* SPDX-License-Identifier: MIT
|
||||||
* included in all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
||||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
||||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
@ -2,24 +2,11 @@
|
|||||||
* Author: Jon Trulson <jtrulson@ics.com>
|
* Author: Jon Trulson <jtrulson@ics.com>
|
||||||
* Copyright (c) 2016 Intel Corporation.
|
* Copyright (c) 2016 Intel Corporation.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining
|
* This program and the accompanying materials are made available under the
|
||||||
* a copy of this software and associated documentation files (the
|
* terms of the The MIT License which is available at
|
||||||
* "Software"), to deal in the Software without restriction, including
|
* https://opensource.org/licenses/MIT.
|
||||||
* without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
* permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
* the following conditions:
|
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice shall be
|
* SPDX-License-Identifier: MIT
|
||||||
* included in all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
||||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
||||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
@ -2,24 +2,11 @@
|
|||||||
* Author: Jon Trulson <jtrulson@ics.com>
|
* Author: Jon Trulson <jtrulson@ics.com>
|
||||||
* Copyright (c) 2016 Intel Corporation.
|
* Copyright (c) 2016 Intel Corporation.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining
|
* This program and the accompanying materials are made available under the
|
||||||
* a copy of this software and associated documentation files (the
|
* terms of the The MIT License which is available at
|
||||||
* "Software"), to deal in the Software without restriction, including
|
* https://opensource.org/licenses/MIT.
|
||||||
* without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
* permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
* the following conditions:
|
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice shall be
|
* SPDX-License-Identifier: MIT
|
||||||
* included in all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
||||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
||||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
@ -4,24 +4,11 @@
|
|||||||
*
|
*
|
||||||
* The MIT License
|
* The MIT License
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining
|
* This program and the accompanying materials are made available under the
|
||||||
* a copy of this software and associated documentation files (the
|
* terms of the The MIT License which is available at
|
||||||
* "Software"), to deal in the Software without restriction, including
|
* https://opensource.org/licenses/MIT.
|
||||||
* without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
* permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
* the following conditions:
|
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice shall be
|
* SPDX-License-Identifier: MIT
|
||||||
* included in all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
||||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
||||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
@ -7,24 +7,11 @@
|
|||||||
*
|
*
|
||||||
* The MIT License
|
* The MIT License
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining
|
* This program and the accompanying materials are made available under the
|
||||||
* a copy of this software and associated documentation files (the
|
* terms of the The MIT License which is available at
|
||||||
* "Software"), to deal in the Software without restriction, including
|
* https://opensource.org/licenses/MIT.
|
||||||
* without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
* permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
* the following conditions:
|
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice shall be
|
* SPDX-License-Identifier: MIT
|
||||||
* included in all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
||||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
||||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
@ -2,24 +2,11 @@
|
|||||||
* Author: Jon Trulson <jtrulson@ics.com>
|
* Author: Jon Trulson <jtrulson@ics.com>
|
||||||
* Copyright (c) 2016 Intel Corporation.
|
* Copyright (c) 2016 Intel Corporation.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining
|
* This program and the accompanying materials are made available under the
|
||||||
* a copy of this software and associated documentation files (the
|
* terms of the The MIT License which is available at
|
||||||
* "Software"), to deal in the Software without restriction, including
|
* https://opensource.org/licenses/MIT.
|
||||||
* without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
* permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
* the following conditions:
|
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice shall be
|
* SPDX-License-Identifier: MIT
|
||||||
* included in all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
||||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
||||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
@ -2,24 +2,11 @@
|
|||||||
* Author: Jon Trulson <jtrulson@ics.com>
|
* Author: Jon Trulson <jtrulson@ics.com>
|
||||||
* Copyright (c) 2016 Intel Corporation.
|
* Copyright (c) 2016 Intel Corporation.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining
|
* This program and the accompanying materials are made available under the
|
||||||
* a copy of this software and associated documentation files (the
|
* terms of the The MIT License which is available at
|
||||||
* "Software"), to deal in the Software without restriction, including
|
* https://opensource.org/licenses/MIT.
|
||||||
* without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
* permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
* the following conditions:
|
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice shall be
|
* SPDX-License-Identifier: MIT
|
||||||
* included in all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
||||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
||||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
@ -2,24 +2,11 @@
|
|||||||
* Author: Jon Trulson <jtrulson@ics.com>
|
* Author: Jon Trulson <jtrulson@ics.com>
|
||||||
* Copyright (c) 2016 Intel Corporation.
|
* Copyright (c) 2016 Intel Corporation.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining
|
* This program and the accompanying materials are made available under the
|
||||||
* a copy of this software and associated documentation files (the
|
* terms of the The MIT License which is available at
|
||||||
* "Software"), to deal in the Software without restriction, including
|
* https://opensource.org/licenses/MIT.
|
||||||
* without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
* permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
* the following conditions:
|
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice shall be
|
* SPDX-License-Identifier: MIT
|
||||||
* included in all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
||||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
||||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
@ -2,24 +2,11 @@
|
|||||||
* Author: Jon Trulson <jtrulson@ics.com>
|
* Author: Jon Trulson <jtrulson@ics.com>
|
||||||
* Copyright (c) 2016 Intel Corporation.
|
* Copyright (c) 2016 Intel Corporation.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining
|
* This program and the accompanying materials are made available under the
|
||||||
* a copy of this software and associated documentation files (the
|
* terms of the The MIT License which is available at
|
||||||
* "Software"), to deal in the Software without restriction, including
|
* https://opensource.org/licenses/MIT.
|
||||||
* without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
* permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
* the following conditions:
|
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice shall be
|
* SPDX-License-Identifier: MIT
|
||||||
* included in all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
||||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
||||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
@ -2,24 +2,11 @@
|
|||||||
* Author: Sarah Knepper <sarah.knepper@intel.com>
|
* Author: Sarah Knepper <sarah.knepper@intel.com>
|
||||||
* Copyright (c) 2014 Intel Corporation.
|
* Copyright (c) 2014 Intel Corporation.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining
|
* This program and the accompanying materials are made available under the
|
||||||
* a copy of this software and associated documentation files (the
|
* terms of the The MIT License which is available at
|
||||||
* "Software"), to deal in the Software without restriction, including
|
* https://opensource.org/licenses/MIT.
|
||||||
* without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
* permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
* the following conditions:
|
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice shall be
|
* SPDX-License-Identifier: MIT
|
||||||
* included in all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
||||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
||||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
12
examples/c++/buzzer-initio.cxx
Normal 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;
|
||||||
|
}
|
@ -2,24 +2,11 @@
|
|||||||
* Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
|
* Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
|
||||||
* Copyright (c) 2014 Intel Corporation.
|
* Copyright (c) 2014 Intel Corporation.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining
|
* This program and the accompanying materials are made available under the
|
||||||
* a copy of this software and associated documentation files (the
|
* terms of the The MIT License which is available at
|
||||||
* "Software"), to deal in the Software without restriction, including
|
* https://opensource.org/licenses/MIT.
|
||||||
* without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
* permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
* the following conditions:
|
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice shall be
|
* SPDX-License-Identifier: MIT
|
||||||
* included in all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
||||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
||||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <iostream>
|
#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 };
|
int chord[] = { BUZZER_DO, BUZZER_RE, BUZZER_MI, BUZZER_FA, BUZZER_SOL, BUZZER_LA, BUZZER_SI };
|
||||||
|
|
||||||
// create Buzzer instance
|
// create Buzzer instance
|
||||||
upm::Buzzer sound(5);
|
upm::Buzzer sound(32);
|
||||||
// print sensor name
|
// print sensor name
|
||||||
std::cout << sound.name() << std::endl;
|
std::cout << sound.name() << std::endl;
|
||||||
|
|
||||||
|
@ -2,24 +2,11 @@
|
|||||||
* Author: Jon Trulson <jtrulson@ics.com>
|
* Author: Jon Trulson <jtrulson@ics.com>
|
||||||
* Copyright (c) 2015 Intel Corporation.
|
* Copyright (c) 2015 Intel Corporation.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining
|
* This program and the accompanying materials are made available under the
|
||||||
* a copy of this software and associated documentation files (the
|
* terms of the The MIT License which is available at
|
||||||
* "Software"), to deal in the Software without restriction, including
|
* https://opensource.org/licenses/MIT.
|
||||||
* without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
* permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
* the following conditions:
|
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice shall be
|
* SPDX-License-Identifier: MIT
|
||||||
* included in all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
||||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
||||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
@ -2,24 +2,11 @@
|
|||||||
* Author: Zion Orent <zorent@ics.com>
|
* Author: Zion Orent <zorent@ics.com>
|
||||||
* Copyright (c) 2015 Intel Corporation.
|
* Copyright (c) 2015 Intel Corporation.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining
|
* This program and the accompanying materials are made available under the
|
||||||
* a copy of this software and associated documentation files (the
|
* terms of the The MIT License which is available at
|
||||||
* "Software"), to deal in the Software without restriction, including
|
* https://opensource.org/licenses/MIT.
|
||||||
* without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
* permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
* the following conditions:
|
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice shall be
|
* SPDX-License-Identifier: MIT
|
||||||
* included in all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
||||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
||||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
*/
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
@ -1,92 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be
|
|
||||||
* included in all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
||||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
||||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <exception>
|
|
||||||
#include <iostream>
|
|
||||||
#include <stddef.h>
|
|
||||||
|
|
||||||
#include "bme280.hpp"
|
|
||||||
#include "iHumiditySensor.hpp"
|
|
||||||
#include "mraa/common.h"
|
|
||||||
#include "si7005.hpp"
|
|
||||||
#include "upm_utilities.h"
|
|
||||||
|
|
||||||
#define EDISON_I2C_BUS 1
|
|
||||||
#define FT4222_I2C_BUS 0
|
|
||||||
|
|
||||||
#define EDISON_GPIO_SI7005_CS 20
|
|
||||||
|
|
||||||
//! [Interesting]
|
|
||||||
// Simple example of using iHumiditySensor to determine
|
|
||||||
// which sensor is present and return its name.
|
|
||||||
// iHumiditySensor is then used to get readings from sensor
|
|
||||||
|
|
||||||
upm::iHumiditySensor*
|
|
||||||
getHumiditySensor()
|
|
||||||
{
|
|
||||||
upm::iHumiditySensor* humiditySensor = NULL;
|
|
||||||
|
|
||||||
try {
|
|
||||||
humiditySensor = new upm::BME280(mraa_get_sub_platform_id(FT4222_I2C_BUS));
|
|
||||||
return humiditySensor;
|
|
||||||
} catch (std::exception& e) {
|
|
||||||
std::cerr << "BME280: " << e.what() << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
humiditySensor = new upm::SI7005(EDISON_I2C_BUS, EDISON_GPIO_SI7005_CS);
|
|
||||||
return humiditySensor;
|
|
||||||
} catch (std::exception& e) {
|
|
||||||
std::cerr << "SI7005: " << e.what() << std::endl;
|
|
||||||
}
|
|
||||||
return humiditySensor;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
main()
|
|
||||||
{
|
|
||||||
upm::iHumiditySensor* sensor = getHumiditySensor();
|
|
||||||
|
|
||||||
if (sensor == NULL) {
|
|
||||||
std::cout << "Humidity sensor not detected" << std::endl;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::cout << "Humidity sensor " << sensor->Name() << " detected" << std::endl;
|
|
||||||
|
|
||||||
try {
|
|
||||||
std::map<std::string, float> values = sensor->HumidityAll();
|
|
||||||
for (std::map<std::string, float>::const_iterator it = values.begin();
|
|
||||||
it != values.end(); ++it)
|
|
||||||
std::cout << it->first << " = " << it->second
|
|
||||||
<< sensor->Unit(it->first) << std::endl;
|
|
||||||
} catch (std::exception& e) {
|
|
||||||
std::cerr << e.what() << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
delete sensor;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! [Interesting]
|
|
@ -1,98 +0,0 @@
|
|||||||
#include <exception>
|
|
||||||
#include <iostream>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
#include "ds1808lc.hpp"
|
|
||||||
#include "hlg150h.hpp"
|
|
||||||
#include "iLightController.hpp"
|
|
||||||
#include "lp8860.hpp"
|
|
||||||
|
|
||||||
#define EDISON_I2C_BUS 1 // Edison I2C-1
|
|
||||||
#define GPIO_SI7005_CS 20 // Edison GP12
|
|
||||||
#define HLG150H_GPIO_RELAY 21
|
|
||||||
#define HLG150H_GPIO_PWM 22
|
|
||||||
#define LP8860_GPIO_PWR 45 // Edison GP45
|
|
||||||
#define DS1808_GPIO_PWR 15 // Edison GP165
|
|
||||||
#define DS1808_GPIO_EDISON_LIVE 36 // Edison GP14
|
|
||||||
|
|
||||||
//! [Interesting]
|
|
||||||
// Simple example of using ILightController to determine
|
|
||||||
// which controller is present and return its name.
|
|
||||||
// ILightController is then used to get readings from sensor
|
|
||||||
|
|
||||||
upm::ILightController*
|
|
||||||
getLightController()
|
|
||||||
{
|
|
||||||
upm::ILightController* lightController = NULL;
|
|
||||||
try {
|
|
||||||
lightController = new upm::LP8860(LP8860_GPIO_PWR, EDISON_I2C_BUS);
|
|
||||||
return lightController;
|
|
||||||
} catch (std::exception& e) {
|
|
||||||
std::cerr << "LP8860: " << e.what() << std::endl;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
lightController = new upm::DS1808LC(DS1808_GPIO_PWR, EDISON_I2C_BUS);
|
|
||||||
return lightController;
|
|
||||||
} catch (std::exception& e) {
|
|
||||||
std::cerr << "DS1808LC: " << e.what() << std::endl;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
lightController = new upm::HLG150H(HLG150H_GPIO_RELAY, HLG150H_GPIO_PWM);
|
|
||||||
return lightController;
|
|
||||||
} catch (std::exception& e) {
|
|
||||||
std::cerr << "HLG150H: " << e.what() << std::endl;
|
|
||||||
}
|
|
||||||
return lightController;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
printState(upm::ILightController* lightController)
|
|
||||||
{
|
|
||||||
if (lightController->isPowered()) {
|
|
||||||
std::cout << "Light is powered, brightness = " << lightController->getBrightness()
|
|
||||||
<< std::endl;
|
|
||||||
} else {
|
|
||||||
std::cout << "Light is not powered." << std::endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
main(int argc, char** argv)
|
|
||||||
{
|
|
||||||
int status = 0;
|
|
||||||
// MraaUtils::setGpio(GPIO_SI7005_CS, 1);
|
|
||||||
|
|
||||||
upm::ILightController* lightController = getLightController();
|
|
||||||
if (lightController != NULL) {
|
|
||||||
//std::cout << "Detected light controller " << lightController->getModuleName() << std::endl;
|
|
||||||
} else {
|
|
||||||
std::cerr << "Error. Unsupported platform." << std::endl;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
std::cout << "Existing state: ";
|
|
||||||
printState(lightController);
|
|
||||||
if (argc == 2) {
|
|
||||||
std::string arg = argv[1];
|
|
||||||
int brightness = ::atoi(argv[1]);
|
|
||||||
if (brightness > 0) {
|
|
||||||
lightController->setPowerOn();
|
|
||||||
lightController->setBrightness(brightness);
|
|
||||||
} else
|
|
||||||
lightController->setPowerOff();
|
|
||||||
}
|
|
||||||
std::cout << "Now: ";
|
|
||||||
printState(lightController);
|
|
||||||
} catch (std::exception& e) {
|
|
||||||
std::cout << "Error: " << e.what() << std::endl;
|
|
||||||
status = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
delete lightController;
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! [Interesting]
|
|
@ -1,88 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be
|
|
||||||
* included in all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
||||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
||||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <exception>
|
|
||||||
#include <iostream>
|
|
||||||
#include <stddef.h>
|
|
||||||
|
|
||||||
#include "iLightSensor.hpp"
|
|
||||||
#include "max44009.hpp"
|
|
||||||
#include "mraa/common.h"
|
|
||||||
#include "si1132.hpp"
|
|
||||||
#include "upm_utilities.h"
|
|
||||||
|
|
||||||
#define EDISON_I2C_BUS 1
|
|
||||||
#define FT4222_I2C_BUS 0
|
|
||||||
|
|
||||||
//! [Interesting]
|
|
||||||
// Simple example of using iLightSensor to determine
|
|
||||||
// which sensor is present and return its name.
|
|
||||||
// iLightSensor is then used to get readings from sensor
|
|
||||||
|
|
||||||
upm::iLightSensor*
|
|
||||||
getLightSensor()
|
|
||||||
{
|
|
||||||
upm::iLightSensor* lightSensor = NULL;
|
|
||||||
try {
|
|
||||||
lightSensor = new upm::SI1132(mraa_get_sub_platform_id(FT4222_I2C_BUS));
|
|
||||||
return lightSensor;
|
|
||||||
} catch (std::exception& e) {
|
|
||||||
std::cerr << "SI1132: " << e.what() << std::endl;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
lightSensor = new upm::MAX44009(EDISON_I2C_BUS);
|
|
||||||
return lightSensor;
|
|
||||||
} catch (std::exception& e) {
|
|
||||||
std::cerr << "MAX44009: " << e.what() << std::endl;
|
|
||||||
}
|
|
||||||
return lightSensor;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
main()
|
|
||||||
{
|
|
||||||
upm::iLightSensor* sensor = getLightSensor();
|
|
||||||
|
|
||||||
if (sensor == NULL) {
|
|
||||||
std::cout << "Light sensor not detected" << std::endl;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::cout << "Light sensor " << sensor->Name() << " detected" << std::endl;
|
|
||||||
|
|
||||||
try {
|
|
||||||
std::map<std::string, float> values = sensor->LightAll();
|
|
||||||
for (std::map<std::string, float>::const_iterator it = values.begin();
|
|
||||||
it != values.end(); ++it)
|
|
||||||
std::cout << it->first << " = " << it->second
|
|
||||||
<< sensor->Unit(it->first) << std::endl;
|
|
||||||
} catch (std::exception& e) {
|
|
||||||
std::cerr << e.what() << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
delete sensor;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! [Interesting]
|
|
@ -1,89 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be
|
|
||||||
* included in all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
||||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
||||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <exception>
|
|
||||||
#include <iostream>
|
|
||||||
#include <stddef.h>
|
|
||||||
|
|
||||||
#include "bme280.hpp"
|
|
||||||
#include "bmpx8x.hpp"
|
|
||||||
#include "iPressureSensor.hpp"
|
|
||||||
#include "mraa/common.h"
|
|
||||||
#include "upm_utilities.h"
|
|
||||||
|
|
||||||
#define EDISON_I2C_BUS 1
|
|
||||||
#define FT4222_I2C_BUS 0
|
|
||||||
|
|
||||||
//! [Interesting]
|
|
||||||
// Simple example of using iPressureSensor to determine
|
|
||||||
// which sensor is present and return its name.
|
|
||||||
// iPressureSensor is then used to get readings from sensor
|
|
||||||
|
|
||||||
upm::iPressureSensor*
|
|
||||||
getPressureSensor()
|
|
||||||
{
|
|
||||||
upm::iPressureSensor* pressureSensor = NULL;
|
|
||||||
try {
|
|
||||||
pressureSensor = new upm::BME280(mraa_get_sub_platform_id(FT4222_I2C_BUS));
|
|
||||||
return pressureSensor;
|
|
||||||
} catch (std::exception& e) {
|
|
||||||
std::cerr << "BME280: " << e.what() << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
pressureSensor = new upm::BMPX8X(EDISON_I2C_BUS);
|
|
||||||
return pressureSensor;
|
|
||||||
} catch (std::exception& e) {
|
|
||||||
std::cerr << "BMPX8X: " << e.what() << std::endl;
|
|
||||||
}
|
|
||||||
return pressureSensor;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
main()
|
|
||||||
{
|
|
||||||
upm::iPressureSensor* sensor = getPressureSensor();
|
|
||||||
|
|
||||||
if (sensor == NULL) {
|
|
||||||
std::cout << "Pressure sensor not detected" << std::endl;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::cout << "Pressure sensor " << sensor->Name() << " detected" << std::endl;
|
|
||||||
|
|
||||||
try {
|
|
||||||
std::map<std::string, float> values = sensor->PressureAll();
|
|
||||||
for (std::map<std::string, float>::const_iterator it = values.begin();
|
|
||||||
it != values.end(); ++it)
|
|
||||||
std::cout << it->first << " = " << it->second
|
|
||||||
<< sensor->Unit(it->first) << std::endl;
|
|
||||||
} catch (std::exception& e) {
|
|
||||||
std::cerr << e.what() << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
delete sensor;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! [Interesting]
|
|
@ -1,99 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be
|
|
||||||
* included in all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
||||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
||||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <exception>
|
|
||||||
#include <iostream>
|
|
||||||
#include <stddef.h>
|
|
||||||
|
|
||||||
#include "bme280.hpp"
|
|
||||||
#include "bmpx8x.hpp"
|
|
||||||
#include "iTemperatureSensor.hpp"
|
|
||||||
#include "mraa/common.h"
|
|
||||||
#include "si7005.hpp"
|
|
||||||
#include "upm_utilities.h"
|
|
||||||
|
|
||||||
#define EDISON_I2C_BUS 1
|
|
||||||
#define FT4222_I2C_BUS 0
|
|
||||||
|
|
||||||
#define EDISON_GPIO_SI7005_CS 20
|
|
||||||
|
|
||||||
//! [Interesting]
|
|
||||||
// Simple example of using iTemperatureSensor to determine
|
|
||||||
// which sensor is present and return its name.
|
|
||||||
// iTemperatureSensor is then used to get readings from sensor
|
|
||||||
|
|
||||||
upm::iTemperatureSensor*
|
|
||||||
getTemperatureSensor()
|
|
||||||
{
|
|
||||||
upm::iTemperatureSensor* temperatureSensor = NULL;
|
|
||||||
|
|
||||||
try {
|
|
||||||
temperatureSensor = new upm::BME280(mraa_get_sub_platform_id(FT4222_I2C_BUS));
|
|
||||||
return temperatureSensor;
|
|
||||||
} catch (std::exception& e) {
|
|
||||||
std::cerr << "BME280: " << e.what() << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
temperatureSensor = new upm::SI7005(EDISON_I2C_BUS, EDISON_GPIO_SI7005_CS);
|
|
||||||
return temperatureSensor;
|
|
||||||
} catch (std::exception& e) {
|
|
||||||
std::cerr << "SI7005: " << e.what() << std::endl;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
temperatureSensor = new upm::BMPX8X(EDISON_I2C_BUS);
|
|
||||||
return temperatureSensor;
|
|
||||||
} catch (std::exception& e) {
|
|
||||||
std::cerr << "BMPX8X: " << e.what() << std::endl;
|
|
||||||
}
|
|
||||||
return temperatureSensor;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
main()
|
|
||||||
{
|
|
||||||
upm::iTemperatureSensor* sensor = getTemperatureSensor();
|
|
||||||
|
|
||||||
if (sensor == NULL) {
|
|
||||||
std::cout << "Temperature sensor not detected" << std::endl;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::cout << "Temperature sensor " << sensor->Name() << " detected" << std::endl;
|
|
||||||
|
|
||||||
try {
|
|
||||||
std::map<std::string, float> values = sensor->TemperatureAll();
|
|
||||||
for (std::map<std::string, float>::const_iterator it = values.begin();
|
|
||||||
it != values.end(); ++it)
|
|
||||||
std::cout << it->first << " = " << it->second
|
|
||||||
<< sensor->Unit(it->first) << std::endl;
|
|
||||||
} catch (std::exception& e) {
|
|
||||||
std::cerr << e.what() << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
delete sensor;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! [Interesting]
|
|
@ -4,24 +4,11 @@
|
|||||||
* Author: Justin Zemlyansky (@JustInDevelopment)
|
* Author: Justin Zemlyansky (@JustInDevelopment)
|
||||||
* Copyright (c) 2016 Intel Corporation.
|
* Copyright (c) 2016 Intel Corporation.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining
|
* This program and the accompanying materials are made available under the
|
||||||
* a copy of this software and associated documentation files (the
|
* terms of the The MIT License which is available at
|
||||||
* "Software"), to deal in the Software without restriction, including
|
* https://opensource.org/licenses/MIT.
|
||||||
* without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
* permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
* the following conditions:
|
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice shall be
|
* SPDX-License-Identifier: MIT
|
||||||
* included in all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
||||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
||||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "curieimu.hpp"
|
#include "curieimu.hpp"
|
||||||
|
@ -2,24 +2,11 @@
|
|||||||
* Author: Jon Trulson <jtrulson@ics.com>
|
* Author: Jon Trulson <jtrulson@ics.com>
|
||||||
* Copyright (c) 2016 Intel Corporation.
|
* Copyright (c) 2016 Intel Corporation.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining
|
* This program and the accompanying materials are made available under the
|
||||||
* a copy of this software and associated documentation files (the
|
* terms of the The MIT License which is available at
|
||||||
* "Software"), to deal in the Software without restriction, including
|
* https://opensource.org/licenses/MIT.
|
||||||
* without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
* permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
* the following conditions:
|
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice shall be
|
* SPDX-License-Identifier: MIT
|
||||||
* included in all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
||||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
||||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|