Compare commits

..

29 Commits

Author SHA1 Message Date
0223cd2b85 C++ Core: Add base class per sensor/actuator type
Adding base classes for UPM sensors and actuators.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-04-02 11:01:18 -07:00
b55501e327 kx122: Note return method change in apichanges.md
Updated the API documentation with changes to the kx122.  Removed a few
extra EOL spaces.

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

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

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

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

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

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

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

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

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

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

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

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

For now, don't flag deprecations as warnings.

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

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

    * Added header
    * Added simple unit test to verify functionality

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-02-20 14:58:05 -08:00
1298 changed files with 31744 additions and 14313 deletions

View File

@ -14,6 +14,13 @@ jobs:
allow_failures:
- env: TARGET=ipk
include:
- &run-with-clang-minimal
stage: Clang 3.8 - minimal with unit tests
env: TARGET=minimal
before_script: docker-compose pull ${TARGET}
script:
- export CC=clang-3.8 CXX=clang++-3.8
- BUILDARCH=MOCK docker-compose run ${TARGET}
- &run-with-clang
stage: Clang 3.8
env: TARGET=python
@ -68,6 +75,8 @@ jobs:
- docker-compose run ${TARGET}
- <<: *run-additional-jobs
env: TARGET=android
- <<: *run-additional-jobs
env: TARGET=cordova
- <<: *run-additional-jobs
env: TARGET=examples
- <<: *run-additional-jobs

View File

@ -8,6 +8,7 @@ option (BUILDFTI "Build Funtion Table Interface (FTI) in C sensor libraries" OFF
option (BUILDSWIGPYTHON "Build swig python modules" ON)
option (BUILDSWIGNODE "Build swig node modules" ON)
option (BUILDSWIGJAVA "Build swig java modules" OFF)
option (BUILDCORDOVA "Build cordova bindings" OFF)
option (BUILDEXAMPLES "Build C/C++/JAVA examples" OFF)
option (IPK "Generate IPK using CPack" OFF)
option (RPM "Generate RPM using CPack" OFF)
@ -91,7 +92,11 @@ endfunction ()
# Compiler flags common to both C and CXX
# Enable -Wall
# GCC-6 added -Wmisleading-indentation to -Wall, skip these for now
set (C_CXX_WARNING_FLAGS -Wall -Wno-misleading-indentation -Wno-strict-aliasing)
set (C_CXX_WARNING_FLAGS -Wall
-Wno-misleading-indentation
-Wno-strict-aliasing
-Wno-deprecated-declarations # Temp fix for MRAA deprecated methods
)
# Warnings as errors?
if (WERROR)
@ -165,6 +170,17 @@ if (BUILDSWIGJAVA)
find_library(MRAAJAVA_LIBRARY NAMES mraajava HINTS ${MRAA_LIBDIR})
endif (BUILDSWIGJAVA)
# Cordova binding
if (BUILDCORDOVA)
if (NOT BUILDSWIGJAVA)
message(FATAL_ERROR "Cordova bindings require JAVA packages, please enable BUILDSWIGJAVA (-DBUILDSWIGJAVA=on).")
endif()
find_package (Node REQUIRED)
find_package (Npm REQUIRED)
find_package (UpmCordovaGenerator 0.2.1 REQUIRED)
endif (BUILDCORDOVA)
# Find swig if any wrapper is enabled
if (BUILDSWIGPYTHON OR BUILDSWIGNODE OR BUILDSWIGJAVA)
find_package (SWIG 3.0.5 REQUIRED)
@ -275,37 +291,36 @@ else()
set (C_EXTENSIONS OFF)
endif()
# The doc target depends on each sensor target
# The doc target depends on the C/C++ source and all libraries
#
# doc
# ├──> src
# ├──> include
# ├──> libupm_sensor0
# ├──> libupm_sensor1
# ├──> libupm_sensor2
# ├──> ...
# └──> libupm_sensor_n
#
# The pydoc target builds documentation with sphinx via inspection by loading
# each python module. Those modules must include the CXX documentation via
# each python2 module. Those modules must include the CXX documentation via
# a monolithic swig file generated by doxy2swig
#
# pydoc
# └──> _pyupm_sensor0_python2
# ├──────> libupm_sensor0
# └──────> doxy2swig
# ├──> libupm_sensor0
# └──> doxy2swig
#
# The doxy2swig target is dependent upon the doc target IF BUILDDOC=ON,
# otherwise doxy2swig uses an empty file. Doxy2swig also depends on each
# sensor target
#
# doxy2swig
# ──> BUILDDOC=ON───> doc
# └──> libupm_sensor0
# ──> BUILDDOC=ON───> doc
#
# The jsdoc target builds js documentation via yuidoc and only requires
# the doc target
#
# jsdoc ─> doc
#
if (BUILDDOC)
function (CreateDocumentationTargets)
# Add a target to generate API documentation with Doxygen
find_package (Doxygen 1.8 REQUIRED)
if (DOXYGEN_FOUND AND DOXYGEN_VERSION VERSION_GREATER "1.8")
@ -317,12 +332,17 @@ if (BUILDDOC)
foreach(PNG_FILE ${PNG_FILES})
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/docs/${PNG_FILE} ${CMAKE_CURRENT_BINARY_DIR}/html/docs/${PNG_FILE} COPYONLY)
endforeach()
add_custom_target (doc
${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
# Custom command to run doxygen (note depends on ALL UPM C++ targets)
add_custom_command (
OUTPUT ${CMAKE_BINARY_DIR}/xml/index.xml
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile ${UPM_TARGETS_CXX}
COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
COMMAND tar -czf html/xml.tar.gz -C xml .
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating C/C++ API documentation with Doxygen" VERBATIM
)
COMMENT "Generating C/C++ API documentation with Doxygen"
VERBATIM)
add_custom_target(doc DEPENDS ${CMAKE_BINARY_DIR}/xml/index.xml)
else ()
message (SEND_ERROR "ERROR - Failed to find a compatible version of Doxygen. API doc will not be generated")
endif (DOXYGEN_FOUND AND DOXYGEN_VERSION VERSION_GREATER "1.8")
@ -335,11 +355,28 @@ if (BUILDDOC)
# the sphinx tools, explicitly run from the python2 interpreter (tested with the sphinx
# 1.3.6 python2 and python3 modules).
if(BUILDSWIGPYTHON)
# Generate python module documentation from doxygen collateral
#
# doxygen index.xml -> doxy2swig.py -> pyupm_doxy2swig.i
add_custom_command (
OUTPUT ${CMAKE_BINARY_DIR}/src/pyupm_doxy2swig.i
COMMAND ${PYTHON2_EXECUTABLE} ${CMAKE_SOURCE_DIR}/src/doxy2swig.py
${CMAKE_BINARY_DIR}/xml/index.xml --quiet
${CMAKE_BINARY_DIR}/src/pyupm_doxy2swig.i
COMMENT "Generating pyupm_doxy2swig.i from Doxygen output for use by SWIG"
DEPENDS doc
VERBATIM)
add_custom_target(pyupm_doxy2swig DEPENDS ${CMAKE_BINARY_DIR}/src/pyupm_doxy2swig.i)
foreach (_python2_target ${UPM_TARGETS_PYTHON2})
add_dependencies(${_python2_target} pyupm_doxy2swig)
endforeach()
find_package (Sphinx 1.3 REQUIRED)
if (SPHINX_FOUND AND SPHINX_VERSION VERSION_GREATER "1.3")
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/doxy/conf.py.in ${CMAKE_CURRENT_BINARY_DIR}/pydoc/conf.py @ONLY)
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/doxy/index.rst ${CMAKE_CURRENT_BINARY_DIR}/pydoc/index.rst COPYONLY)
add_custom_target (pydoc ALL
add_custom_command (
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/pydoc.stamp
COMMAND rm -r -f ${CMAKE_BINARY_DIR}/pyupm && mkdir -p ${CMAKE_BINARY_DIR}/pyupm
COMMAND find ${CMAKE_BINARY_DIR}/src -path "*python${MIN_VER_PYTHON2}/_pyupm_*.so" -exec cp {} ${CMAKE_BINARY_DIR}/pyupm \;
COMMAND find ${CMAKE_BINARY_DIR}/src -path "*python${MIN_VER_PYTHON2}/pyupm_*.py" -exec cp {} ${CMAKE_BINARY_DIR}/pyupm \;
@ -348,10 +385,12 @@ if (BUILDDOC)
COMMAND ${PYTHON2_EXECUTABLE} ${SPHINX_EXECUTABLE} -b html pydoc html/python
COMMAND sed -i.bak s|\">pyupm_|\">|g html/python/index.html html/python/modules.html
COMMAND sed -i.bak s|[[:space:]][mM]odule</a>|</a>|g html/python/index.html html/python/modules.html
DEPENDS doc
COMMAND cmake -E touch ${CMAKE_CURRENT_BINARY_DIR}/pydoc.stamp
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating Python API documentation with Sphinx" VERBATIM
)
COMMENT "Generating Python API documentation with Sphinx"
DEPENDS doc ${UPM_TARGETS_PYTHON2}
VERBATIM)
add_custom_target(pydoc DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/pydoc.stamp)
else ()
message (SEND_ERROR "ERROR - Failed to find a compatible version of Sphinx. Python API doc will not be generated")
endif ()
@ -361,19 +400,22 @@ if (BUILDDOC)
if(BUILDSWIGNODE)
find_package (Yuidoc 0.10 REQUIRED)
if (YUIDOC_FOUND AND YUIDOC_VERSION VERSION_GREATER "0.10")
add_custom_target (jsdoc ALL
add_custom_command (
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/jsdoc/jsdoc.stamp
COMMAND ${CMAKE_SOURCE_DIR}/doxy/doxygen2jsdoc/docgen.js -m upm -i xml -o jsdoc -t ${CMAKE_CURRENT_SOURCE_DIR}/src -g ../../
COMMAND ${YUIDOC_EXECUTABLE} -C --no-sort --helpers ${CMAKE_SOURCE_DIR}/doxy/node/generators/yuidoc/helper.js --themedir ${CMAKE_SOURCE_DIR}/doxy/node/generators/yuidoc/tmpl -o html/node jsdoc/yuidoc/upm
COMMAND ${CMAKE_SOURCE_DIR}/doxy/doxygen2jsdoc/tolower.js -i html/node
DEPENDS doc
COMMAND cmake -E touch ${CMAKE_CURRENT_BINARY_DIR}/jsdoc/jsdoc.stamp
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating Javascript API documentation with Yuidoc" VERBATIM
)
COMMENT "Generating Javascript API documentation with Yuidoc"
DEPENDS doc
VERBATIM)
add_custom_target(jsdoc DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/jsdoc/jsdoc.stamp)
else ()
message (SEND_ERROR "ERROR - Failed to find a compatible version of Yuidoc. Node.js API doc will not be generated")
endif ()
endif(BUILDSWIGNODE)
endif (BUILDDOC)
endfunction()
if (IPK)
# Get target package arch from Yocto ADT sysroot if set or host OS, mapping to Ubuntu name if necessary
@ -440,9 +482,6 @@ endif()
# UPM common headers
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
add_subdirectory (src)
@ -455,7 +494,12 @@ if (BUILDTESTS)
add_subdirectory (tests)
endif()
# Setup documentation AFTER all source targets have been added
if (BUILDDOC)
CreateDocumentationTargets()
endif()
# Install C headers
install(DIRECTORY include/ DESTINATION include/upm
COMPONENT ${CMAKE_PROJECT_NAME}-dev
FILES_MATCHING PATTERN "*.h")
FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp")

View File

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

View File

@ -1,6 +0,0 @@
#include <string>
inline std::string getVersion()
{
return "@upm_VERSION_STRING@";
}

View File

@ -13,6 +13,7 @@ services:
- BUILDFTI=${BUILDFTI:-ON}
- BUILDSWIGPYTHON=${BUILDSWIGPYTHON:-OFF}
- BUILDSWIGJAVA=${BUILDSWIGJAVA:-OFF}
- BUILDCORDOVA=${BUILDCORDOVA:-OFF}
- BUILDSWIGNODE=${BUILDSWIGNODE:-OFF}
- BUILDEXAMPLES=${BUILDEXAMPLES:-OFF}
- IPK=${IPK:-OFF}
@ -30,6 +31,12 @@ services:
extends: base
image: inteliotdevkit/upm-all
minimal:
extends: base
environment:
- BUILDFTI=OFF
command: bash -c "./scripts/run-cmake.sh && cd build && make && ctest -R unit --output-on-failure"
doc:
extends: all
environment:
@ -107,6 +114,13 @@ services:
- BUILDTESTS=OFF
command: bash -c "./scripts/build-android.sh"
cordova:
extends: all
environment:
- BUILDSWIGJAVA=ON
- BUILDCORDOVA=ON
command: bash -c "./scripts/run-cmake.sh && cd build && make -j8 && make -j8"
node4:
extends: base
image: inteliotdevkit/upm-node4

View File

@ -4,6 +4,11 @@ API Changes {#apichanges}
Here's a list of other API changes made to the library that break source/binary
compatibility between releases:
# vNext
* 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.
# v1.6.0
* Several C libraries had their init function pin type modified from uint8_t

View File

@ -259,7 +259,7 @@ We extend the sensor class with another method, _installISR\(jobject runnable\)_
Java callbacks are added at the SWIG interface level. For ease-of-use, a collection of macros are available in src/_upm.i.
src/a110x/javaupm_a110x.i:
src/a110x/a110x.i:
```c++
JAVA_ADD_INSTALLISR(upm::A110X)
```

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

View File

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

View File

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

View File

@ -120,7 +120,7 @@ if(BUILDEXAMPLES)
# Add all examples as an install component (if building examples)
install (DIRECTORY ${PROJECT_SOURCE_DIR}/examples
DESTINATION ${CMAKE_INSTALL_DATADIR}/upm/
DESTINATION ${CMAKE_INSTALL_DATADIR}/upm
COMPONENT ${CMAKE_PROJECT_NAME}-examples
FILES_MATCHING
PATTERN "*.c"

View File

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

View File

@ -43,14 +43,14 @@ main()
mraa::Gpio gpio(EDISON_GPIO_SI7005_CS);
gpio.dir(mraa::DIR_OUT_HIGH);
/* Show usage from the IADC interface */
upm::IADC* adc = static_cast<upm::IADC*>(&sensor);
/* Show usage from the iADC interface */
upm::iADC* adc = static_cast<upm::iADC*>(&sensor);
if (adc == NULL) {
std::cout << "ADC not detected" << std::endl;
return 1;
}
std::cout << "ADC " << adc->getModuleName() << " detected. ";
std::cout << "ADC " << adc->Name() << " detected. ";
std::cout << adc->getNumInputs() << " inputs available" << std::endl;
while (true) {
for (unsigned int i = 0; i < adc->getNumInputs(); ++i) {

View File

@ -38,14 +38,14 @@
#define EDISON_GPIO_SI7005_CS 20
//! [Interesting]
// Simple example of using ILightSensor to determine
// Simple example of using iHumiditySensor to determine
// which sensor is present and return its name.
// ILightSensor is then used to get readings from sensor
// iHumiditySensor is then used to get readings from sensor
upm::IHumiditySensor*
upm::iHumiditySensor*
getHumiditySensor()
{
upm::IHumiditySensor* humiditySensor = NULL;
upm::iHumiditySensor* humiditySensor = NULL;
try {
humiditySensor = new upm::BME280(mraa_get_sub_platform_id(FT4222_I2C_BUS));
@ -66,22 +66,26 @@ getHumiditySensor()
int
main()
{
upm::IHumiditySensor* humiditySensor = getHumiditySensor();
if (humiditySensor == NULL) {
upm::iHumiditySensor* sensor = getHumiditySensor();
if (sensor == NULL) {
std::cout << "Humidity sensor not detected" << std::endl;
return 1;
}
std::cout << "Humidity sensor " << humiditySensor->getModuleName() << " detected" << std::endl;
while (true) {
try {
int value = humiditySensor->getHumidityRelative();
std::cout << "Humidity = " << value << "%" << std::endl;
} catch (std::exception& e) {
std::cerr << e.what() << std::endl;
}
upm_delay(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 humiditySensor;
delete sensor;
return 0;
}

View File

@ -66,7 +66,7 @@ main(int argc, char** argv)
upm::ILightController* lightController = getLightController();
if (lightController != NULL) {
std::cout << "Detected light controller " << lightController->getModuleName() << std::endl;
//std::cout << "Detected light controller " << lightController->getModuleName() << std::endl;
} else {
std::cerr << "Error. Unsupported platform." << std::endl;
return 1;

View File

@ -36,14 +36,14 @@
#define FT4222_I2C_BUS 0
//! [Interesting]
// Simple example of using ILightSensor to determine
// Simple example of using iLightSensor to determine
// which sensor is present and return its name.
// ILightSensor is then used to get readings from sensor
// iLightSensor is then used to get readings from sensor
upm::ILightSensor*
upm::iLightSensor*
getLightSensor()
{
upm::ILightSensor* lightSensor = NULL;
upm::iLightSensor* lightSensor = NULL;
try {
lightSensor = new upm::SI1132(mraa_get_sub_platform_id(FT4222_I2C_BUS));
return lightSensor;
@ -62,22 +62,26 @@ getLightSensor()
int
main()
{
upm::ILightSensor* lightSensor = getLightSensor();
if (lightSensor == NULL) {
upm::iLightSensor* sensor = getLightSensor();
if (sensor == NULL) {
std::cout << "Light sensor not detected" << std::endl;
return 1;
}
std::cout << "Light sensor " << lightSensor->getModuleName() << " detected" << std::endl;
while (true) {
try {
float value = lightSensor->getVisibleLux();
std::cout << "Light level = " << value << " lux" << std::endl;
} catch (std::exception& e) {
std::cerr << e.what() << std::endl;
}
upm_delay(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 lightSensor;
delete sensor;
return 0;
}

View File

@ -36,14 +36,14 @@
#define FT4222_I2C_BUS 0
//! [Interesting]
// Simple example of using ILightSensor to determine
// Simple example of using iPressureSensor to determine
// which sensor is present and return its name.
// ILightSensor is then used to get readings from sensor
// iPressureSensor is then used to get readings from sensor
upm::IPressureSensor*
upm::iPressureSensor*
getPressureSensor()
{
upm::IPressureSensor* pressureSensor = NULL;
upm::iPressureSensor* pressureSensor = NULL;
try {
pressureSensor = new upm::BME280(mraa_get_sub_platform_id(FT4222_I2C_BUS));
return pressureSensor;
@ -63,22 +63,26 @@ getPressureSensor()
int
main()
{
upm::IPressureSensor* pressureSensor = getPressureSensor();
if (pressureSensor == NULL) {
upm::iPressureSensor* sensor = getPressureSensor();
if (sensor == NULL) {
std::cout << "Pressure sensor not detected" << std::endl;
return 1;
}
std::cout << "Pressure sensor " << pressureSensor->getModuleName() << " detected" << std::endl;
while (true) {
try {
int value = pressureSensor->getPressurePa();
std::cout << "Pressure = " << value << " Pa" << std::endl;
} catch (std::exception& e) {
std::cerr << e.what() << std::endl;
}
upm_delay(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 pressureSensor;
delete sensor;
return 0;
}

View File

@ -39,14 +39,14 @@
#define EDISON_GPIO_SI7005_CS 20
//! [Interesting]
// Simple example of using ITemperatureSensor to determine
// Simple example of using iTemperatureSensor to determine
// which sensor is present and return its name.
// ITemperatureSensor is then used to get readings from sensor
// iTemperatureSensor is then used to get readings from sensor
upm::ITemperatureSensor*
upm::iTemperatureSensor*
getTemperatureSensor()
{
upm::ITemperatureSensor* temperatureSensor = NULL;
upm::iTemperatureSensor* temperatureSensor = NULL;
try {
temperatureSensor = new upm::BME280(mraa_get_sub_platform_id(FT4222_I2C_BUS));
@ -73,23 +73,26 @@ getTemperatureSensor()
int
main()
{
upm::ITemperatureSensor* temperatureSensor = getTemperatureSensor();
if (temperatureSensor == NULL) {
upm::iTemperatureSensor* sensor = getTemperatureSensor();
if (sensor == NULL) {
std::cout << "Temperature sensor not detected" << std::endl;
return 1;
}
std::cout << "Temperature sensor " << temperatureSensor->getModuleName() << " detected"
<< std::endl;
while (true) {
try {
int value = temperatureSensor->getTemperatureCelsius();
std::cout << "Temperature = " << value << "C" << std::endl;
} catch (std::exception& e) {
std::cerr << e.what() << std::endl;
}
upm_delay(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 temperatureSensor;
delete sensor;
return 0;
}

View File

@ -47,7 +47,7 @@ main(int argc, char** argv)
//! [Interesting]
// Instantiate a IMS instance using i2c bus 0 and default address
upm::IMS sensor(0);
upm::IMS sensor("i:0:0x20");
int i2c_addr_cur = IMS_ADDRESS_DEFAULT + 1;
while (shouldRun) {

65
examples/c++/kx122.cxx Normal file
View File

@ -0,0 +1,65 @@
/*
* The MIT License (MIT)
*
* Author: Samuli Rissanen <samuli.rissanen@hotmail.com>
* Copyright (c) 2018 Rohm Semiconductor.
*
* 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 <iostream>
#include <signal.h>
#include <unistd.h>
#include "kx122.hpp"
#include "upm_utilities.h"
bool shouldRun = true;
void sig_handler(int signo)
{
if (signo == SIGINT){
shouldRun = false;
}
}
int main(int argc, char **argv)
{
signal(SIGINT,sig_handler);
//! [Interesting]
upm::KX122 sensor(0,-1,24);
sensor.softwareReset();
sensor.deviceInit(KX122_ODR_50,HIGH_RES,KX122_RANGE_2G);
float x,y,z;
int wait_time = sensor.getSamplePeriod() * MICRO_S;
if (wait_time < 0) wait_time = 1000;
while(shouldRun){
sensor.getAccelerationData(&x,&y,&z);
printf("%.02f | %.02f | %.02f\n",x,y,z);
upm_delay_us(wait_time);
}
//! [Interesting]
return 0;
}

View File

@ -0,0 +1,49 @@
#include <iostream>
#include <unistd.h>
#include "core/iUpmObject.hpp"
#include "noelstemplightreader.hpp"
void printMap(upm::NoelsTempLightReader &sensor, std::map<std::string, float> &data)
{
if (data.empty())
std::cout << "Empty map" << std::endl;
for (std::map<std::string, float>::const_iterator it = data.begin();
it != data.end(); ++it)
{
std::cout << "label: " << it->first << ", value: " << it->second
<< ", unit: " << sensor.Unit(it->first) << std::endl;
}
std::cout << std::endl;
}
int main ()
{
upm::NoelsTempLightReader sensor;
std::cout << "iUpmObject JsonDefinition..." << std::endl << ((upm::iUpmObject&)sensor).JsonDefinition() << std::endl << std::endl;
std::cout << "iSensorType JsonDefinition..." << std::endl << ((upm::iSensorType&)sensor).JsonDefinition() << std::endl << std::endl;
std::cout << "iMraa JsonDefinition..." << std::endl << ((upm::iMraa&)sensor).JsonDefinition() << std::endl << std::endl;
std::cout << "NoelsTempLightReader JsonDefinition..." << std::endl << sensor.JsonDefinition() << std::endl << std::endl;
std::cout << "Read all light values..." << std::endl;
std::map<std::string, float> values = sensor.LightAll();
printMap(sensor, values);
std::cout << "Read a single light value for light0..." << std::endl;
std::cout << "Single value = " << sensor.LightForSource("light0") << std::endl << std::endl;
try
{
std::cout << "Read a single light value for lightX (doesn't exist)..." << std::endl;
sensor.LightForSource("lightX");
}
catch (const std::exception& e) { std::cout << e.what() << std::endl << std::endl;}
std::cout << "Read a light value for lightX (doesn't exist)..." << std::endl;
values = sensor.LightForSources(std::vector<std::string>({"lightX"}));
printMap(sensor, values);
std::cout << "Read all values as JsonDefinition..." << std::endl << sensor.JsonValues() << std::endl;
return 0;
}

View File

@ -31,7 +31,7 @@ int
main(int argc, char** argv)
{
//! [Interesting]
upm::ES08A servo(5);
upm::ES08A servo("p:5");
// Sets the shaft to 180, then to 90, then to 0,
// then back to 90, and finally back to 180,

View File

@ -42,18 +42,18 @@ main()
/* Create an instance of the T6713 sensor */
upm::T6713 sensor(EDISON_I2C_BUS);
/* Show usage from the ICO2Sensor interface */
upm::ICO2Sensor* cO2Sensor = static_cast<upm::ICO2Sensor*>(&sensor);
/* Show usage from the iCO2Sensor interface */
upm::iCO2Sensor* cO2Sensor = static_cast<upm::iCO2Sensor*>(&sensor);
if (cO2Sensor == NULL) {
std::cout << "CO2 sensor not detected" << std::endl;
return 1;
}
std::cout << "CO2 sensor " << cO2Sensor->getModuleName() << " detected" << std::endl;
std::cout << "CO2 sensor " << cO2Sensor->Name() << " detected" << std::endl;
while (true) {
try {
uint16_t value = cO2Sensor->getPpm();
std::cout << "CO2 level = " << value << " ppm" << std::endl;
uint16_t value = cO2Sensor->CO2ForSource(cO2Sensor->Sources()[0]);
std::cout << "CO2 level = " << value << cO2Sensor->Units()[0] << std::endl;
} catch (std::exception& e) {
std::cerr << e.what() << std::endl;
}

71
examples/c/kx122.c Normal file
View File

@ -0,0 +1,71 @@
/*
* The MIT License (MIT)
*
* Author: Samuli Rissanen <samuli.rissanen@hotmail.com>
* Copyright (c) 2018 Rohm Semiconductor.
*
* 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 <stdio.h>
#include <unistd.h>
#include <signal.h>
#include "kx122.h"
#include "upm_utilities.h"
bool shouldRun = true;
void sig_handler(int signo)
{
if(signo == SIGINT){
shouldRun = false;
}
}
int main(int argc, char **argv)
{
signal(SIGINT,sig_handler);
//! [Interesting]
kx122_context sensor = kx122_init(0, -1, 24, 10000);
if (!sensor)
{
printf("kx122_init() failed.\n");
return 1;
}
kx122_sensor_software_reset(sensor);
kx122_device_init(sensor,KX122_ODR_50,HIGH_RES,KX122_RANGE_2G);
float x,y,z;
int wait_time = (kx122_get_sample_period(sensor) * MICRO_S);
if (wait_time < 0) wait_time = 1000;
while(shouldRun){
kx122_get_acceleration_data(sensor,&x,&y,&z);
printf("%.02f | %.02f | %.02f\n",x,y,z);
upm_delay_us(wait_time);
}
kx122_close(sensor);
//! [Interesting]
return 0;
}

View File

@ -22,7 +22,7 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
public class A110XSample {
public class A110X_Example {
public static void main(String[] args) throws InterruptedException {
//! [Interesting]

View File

@ -22,7 +22,7 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
public class A110X_intrSample {
public class A110X_intr_Example {
public static int counter=0;
@ -52,6 +52,6 @@ class A110XISR implements Runnable {
super();
}
public void run(){
A110X_intrSample.counter++;
A110X_intr_Example.counter++;
}
}

View File

@ -23,7 +23,7 @@
*/
//NOT TESTED!!!
public class ADC121C021Sample {
public class ADC121C021_Example {
public static void main(String[] args) throws InterruptedException {
// ! [Interesting]

View File

@ -23,7 +23,7 @@
*/
import upm_am2315.AM2315;
public class AM2315Example {
public class AM2315_Example {
static {
try {

View File

@ -22,7 +22,7 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
public class APA102Sample {
public class APA102_Example {
public static void main(String[] args) throws InterruptedException {
// ! [Interesting]

View File

@ -23,7 +23,7 @@
*/
import upm_ad8232.AD8232;
public class Ad8232Example {
public class Ad8232_Example {
public static void main(String[] args) {
// TODO Auto-generated method stub

View File

@ -31,7 +31,7 @@ import java.io.*;
import java.util.concurrent.*;
import upm_ads1x15.*;
public class Ads1015Sample
public class Ads1015_Example
{
static boolean running = true;
static int id = 0; // Sample number

View File

@ -30,7 +30,7 @@ import java.io.*;
import java.util.concurrent.*;
import upm_ads1x15.*;
public class Ads1115Sample
public class Ads1115_Example
{
static boolean running = true;
static int id = 0; // Sample number

View File

@ -23,7 +23,7 @@
*/
//NOT TESTED!!!
public class Adxl345Sample {
public class Adxl345_Example {
public static void main(String[] args) throws InterruptedException {
// ! [Interesting]

View File

@ -24,7 +24,7 @@
import upm_apds9002.APDS9002;
public class Apds9002 {
public class Apds9002_Example {
public static void main(String[] args) {
// TODO Auto-generated method stub

View File

@ -22,7 +22,7 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
public class BISS0001Sample{
public class BISS0001_Example{
public static void main(String[] args) throws InterruptedException {
//! [Interesting]

View File

@ -22,7 +22,7 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
public class BMA220Sample {
public class BMA220_Example {
public static void main(String[] args) throws InterruptedException {
// ! [Interesting]

View File

@ -24,9 +24,9 @@
*/
import upm_bmp280.*;
import upm_interfaces.*;
import upm_core.*;
public class BME280_InterfaceExample
public class BME280_Interface_Example
{
public static void main(String[] args) throws InterruptedException
{
@ -35,9 +35,9 @@ public class BME280_InterfaceExample
// Instantiate a BME280 instance using default i2c bus and address
BME280 sensor = new BME280();
ITemperatureSensor t_sensor = sensor;
IHumiditySensor h_sensor = sensor;
IPressureSensor p_sensor = sensor;
iTemperatureSensor t_sensor = sensor;
iHumiditySensor h_sensor = sensor;
iPressureSensor p_sensor = sensor;
// For SPI, bus 0, you would pass -1 as the address, and a
// valid pin for CS:
@ -51,15 +51,15 @@ public class BME280_InterfaceExample
System.out.println("Calling Interface Functions: ");
System.out.println("Compensation Temperature: "
+ t_sensor.getTemperatureCelsius()
+ t_sensor.TemperatureForSource("temperature")
+ " C / ");
System.out.println("Pressure: "
+ p_sensor.getPressurePa()
+ p_sensor.PressureForSource("pressure")
+ " Pa");
System.out.println("Humidity: "
+ h_sensor.getHumidityRelative()
+ h_sensor.HumidityForSource("humidity")
+ " %RH");
System.out.println();

View File

@ -23,7 +23,7 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
public class BMPX8XSample {
public class BMPX8X_Example {
public static void main(String[] args) throws InterruptedException {
// ! [Interesting]

View File

@ -22,7 +22,7 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
public class ButtonSample {
public class Button_Example {
public static void main(String[] args) throws InterruptedException {
// ! [Interesting]

View File

@ -22,7 +22,7 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
public class Button_intrSample {
public class Button_intr_Example {
public static int counter = 0;
@ -47,7 +47,7 @@ class ButtonISR implements Runnable {
}
public void run() {
Button_intrSample.counter++;
Button_intr_Example.counter++;
System.out.println("Button pressed!");
}
}

View File

@ -23,7 +23,7 @@
*/
import upm_buzzer.Buzzer;
public class BuzzerSample {
public class Buzzer_Example {
public static void main(String[] args) throws InterruptedException {
// ! [Interesting]

View File

@ -22,7 +22,7 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
public class CJQ4435Sample {
public class CJQ4435_Example {
public static void main(String[] args) throws InterruptedException {
// Instantiate a CJQ4435 MOSFET on a PWM capable digital pin D3

View File

@ -1,223 +1,261 @@
# The purpose of this CMakeLists.txt is to compile all listed JAVA examples
# during build time (ensuring that ALL examples compile against their
# dependency JAVA packages).
find_package(Java REQUIRED)
include(UseJava)
macro(add_example example_name jar_name)
set(example_src "${example_name}.java")
set(example_jar "${CMAKE_CURRENT_BINARY_DIR}/../../src/${jar_name}/upm_${jar_name}.jar")
# Add a JAVA example target for the provided JAVA source file which depends
# on UPM JAVA targets.
#
# Usage:
# add_example(example_class_name upm_target_dependency_list)
#
# Parameters:
# example_class_name: JAVA class name. This name MUST match the JAVA
# example file name.
# <example_class_name>.java
# upm_target_dependency_list: One or more UPM library targets. This
# function assumes a javaupm_<target> also exists.
#
# Examples:
# # Creates SensorFooExample JAVA target, depends on target: sensorfoo,
# # and will add upm_sensorfoo.jar to the javac classpath.
# add_example(SensorFooExample sensorfoo)
#
# # Creates SensorFooExample JAVA target, depends on targets: sensorfoo,
# # and core and will add both upm_sensorfoo.jar and upm_core.jar
# # to the javac classpath.
# add_example(SensorFooExample "sensorfoo;core"")
#
function(add_example example_class_name dependency_list)
set(example_file "${example_class_name}.java")
add_jar(${example_name} SOURCES ${example_src} INCLUDE_JARS ${example_jar})
add_dependencies(${example_name} javaupm_${jar_name})
endmacro()
# Build a list of all dependency jar files
set(jar_file_list "")
macro(add_example_with_path example_name jar_path jar_name)
set(example_src "${example_name}.java")
set(example_jar "${CMAKE_CURRENT_BINARY_DIR}/../../src/${jar_path}/upm_${jar_name}.jar")
# Build a list of all dependency java target names
set(java_targets_list "")
add_jar(${example_name} SOURCES ${example_src} INCLUDE_JARS ${example_jar})
add_dependencies(${example_name} javaupm_${jar_name})
endmacro()
# Iterate over the dependencies
foreach(dependency ${dependency_list})
set(java_target "javaupm_${dependency}")
macro(add_example_multiple_jars example_name example_jar_name jar_name_list)
set(example_src "${example_name}.java")
# Append to the targets list
list(APPEND java_targets_list ${java_target})
set(list_of_jars "")
foreach(jar_name ${jar_name_list})
set(example_jar "${CMAKE_CURRENT_BINARY_DIR}/../../src/${jar_name}/upm_${jar_name}.jar")
list(APPEND list_of_jars ${example_jar})
# If a dependency target does NOT exist, print a warning and skip
if (NOT TARGET ${java_target})
message(STATUS "Example ${example_file} is missing a required CMake target (${java_target}), skipping...")
return()
endif()
# Get the jar for this java_target (saved as a property)
get_target_property(jar_file ${java_target} JAR_FILE_ABSOLUTE)
# Append to the jar list
list(APPEND jar_file_list ${jar_file})
endforeach()
add_jar(${example_name} SOURCES ${example_src} INCLUDE_JARS ${list_of_jars})
add_dependencies(${example_name} javaupm_${example_jar_name})
endmacro()
# Add the jar/s
add_jar(${example_class_name} SOURCES ${example_file} INCLUDE_JARS ${jar_file_list})
add_example(A110X_intrSample a110x)
add_example(A110XSample a110x)
add_example(ADC121C021Sample adc121c021)
add_example(Adxl345Sample adxl345)
add_example(Apds9002 apds9002)
add_example(BISS0001Sample biss0001)
add_example_multiple_jars(BMPX8XSample bmpx8x "bmpx8x;interfaces")
add_example(BuzzerSample buzzer)
add_example(CJQ4435Sample cjq4435)
add_example(DS1307Sample ds1307)
add_example(ENC03RSample enc03r)
add_example(ES08ASample servo)
add_example(ButtonSample button)
add_example(GroveButtonSample grove)
add_example(Button_intrSample button)
add_example(GroveButton_intrSample grove)
add_example(Collision collision)
add_example(EHRSample ehr)
add_example(GroveEHRSample groveehr)
add_example(Emg emg)
add_example(GroveEmg groveemg)
add_example(Gsr gsr)
add_example(GroveGsr grovegsr)
add_example(LEDSample led)
add_example(LightSample light)
add_example(GroveLightSample grove)
add_example(GroveLineFinderSample grovelinefinder)
add_example(LineFinderSample linefinder)
add_example(GroveLed_multiSample grove)
add_example(GroveLEDSample grove)
add_example(GroveMDSample grovemd)
add_example(MDSample md)
add_example(MoistureSample moisture)
add_example(GroveMoistureSample grovemoisture)
add_example(GroveMQ3 gas)
add_example(GroveMQ9 gas)
add_example(O2Example o2)
add_example(GroveO2Example groveo2)
add_example(GroveQTouch at42qt1070)
add_example(RelaySample relay)
add_example(GroveRelaySample grove)
add_example(RotarySample rotary)
add_example(GroveRotarySample grove)
add_example(GROVESCAMSample grovescam)
add_example(SCAMSample scam)
add_example(SlideSample slide)
add_example(GroveSlideSample grove)
add_example(SpeakerSample speaker)
add_example(GroveSpeakerSample grovespeaker)
add_example(TemperatureSample temperature)
add_example(GroveTempSample grove)
add_example(VDivSample vdiv)
add_example(GroveVDivSample grovevdiv)
add_example(WaterSample water)
add_example(GroveWaterSample grovewater)
add_example(GroveWFSSample grovewfs)
add_example(WFSSample wfs)
add_example(GUVAS12DSample guvas12d)
add_example(H3LIS331DLSample h3lis331dl)
add_example(HCSR04Sample hcsr04)
add_example(HM11Sample hm11)
add_example(Hmc5883lSample hmc5883l)
add_example(HMTRPSample hmtrp)
add_example(HP20xExample hp20x)
add_example(HTU21DSample htu21d)
add_example(Itg3200Sample itg3200)
add_example(Joystick12Sample joystick12)
add_example(LDT0028Sample ldt0028)
add_example(LoLSample lol)
add_example(LSM303DLHSample lsm303dlh)
add_example(M24LR64ESample m24lr64e)
add_example(MAX44000Sample max44000)
add_example(MHZ16Sample mhz16)
add_example(MicrophoneSample mic)
add_example(MMA7455Sample mma7455)
add_example(MMA7660Sample mma7660)
add_example(MPL3115A2Sample mpl3115a2)
add_example(MPR121Sample mpr121)
add_example(MPU9150Sample mpu9150)
add_example(MQ2Sample gas)
add_example(MQ303ASample mq303a)
add_example(MQ5Sample gas)
add_example(GroveLEDBar my9221)
add_example(NRF24L01_receiverSample nrf24l01)
add_example(NRF24L01_transmitterSample nrf24l01)
add_example(NUNCHUCKSample nunchuck)
add_example(OTP538USample otp538u)
add_example(PPD42NSSample ppd42ns)
add_example(PulsensorSample pulsensor)
add_example(RFR359FSample rfr359f)
add_example(RotaryEncoderSample rotaryencoder)
add_example(RPR220_intrSample rpr220)
add_example(RPR220Sample rpr220)
add_example(ST7735Sample st7735)
if (NOT ANDROID)
add_example(StepMotorSample stepmotor)
endif ()
add_example(TM1637Sample tm1637)
add_example(TP401Sample gas)
add_example(TSL2561Sample tsl2561)
add_example(TTP223Sample ttp223)
add_example(ULN200XASample uln200xa)
add_example(WaterLevelSensor waterlevel)
add_example(WT5001Sample wt5001)
add_example(YG1006Sample yg1006)
add_example(ZFM20Sample zfm20)
add_example(Ad8232Example ad8232)
add_example(Gp2y0aExample gp2y0a)
add_example(Th02Example th02)
add_example(FlexSensorExample flex)
add_example(CWLSXXA_Example cwlsxxa)
add_example(TEAMS_Example teams)
add_example(APA102Sample apa102)
add_example(TEX00_Example tex00)
add_example(BMI160_Example bmi160)
add_example(Tsl2561 tsl2561)
add_example(AM2315Example am2315)
add_example(MAX31855Example max31855)
add_example(MAX5487Example max5487)
add_example(MAXds3231mExample maxds3231m)
add_example(ECS1030Example ecs1030)
add_example(SM130Example sm130)
if (MODBUS_FOUND)
add_example(H803X_Example h803x)
endif()
if (BACNET_FOUND)
add_example(E50HX_Example e50hx)
add_example(T8100_Example t8100)
add_example(TB7300_Example tb7300)
endif()
if (JPEG_FOUND)
add_example(VCAP_Example vcap)
endif()
add_example_multiple_jars(BMP280_Example bmp280 "bmp280;interfaces")
add_example(BNO055_Example bno055)
add_example(BMX055_Example bmx055)
add_example(NMEAGPS_Example nmea_gps)
add_example(MMA7361_Example mma7361)
# Add a dependency from this jar to all dependency java targets
add_dependencies(${example_class_name} ${java_targets_list})
endfunction()
add_example(A110X_Example a110x)
add_example(A110X_intr_Example a110x)
add_example(Ad8232_Example ad8232)
add_example(ADC121C021_Example adc121c021)
add_example(Ads1015_Example "ads1x15;core")
add_example(Ads1115_Example ads1x15)
add_example(Adxl345_Example adxl345)
add_example(AM2315_Example am2315)
add_example(APA102_Example apa102)
add_example(Apds9002_Example apds9002)
add_example(BH1750_Example bh1750)
add_example(HKA5_Example hka5)
add_example(DFRORP_Example dfrorp)
add_example(DFREC_Example dfrec)
add_example(SHT1X_Example sht1x)
add_example(MS5803_Example ms5803)
add_example(ECEZO_Example ecezo)
add_example(IMS_Example ims)
add_example(MB704X_Example mb704x)
add_example(MCP2515_Example mcp2515)
add_example_multiple_jars(Ads1015Sample ads1x15 "ads1x15;interfaces")
add_example(MAX30100_Example max30100)
add_example(Ads1115Sample ads1x15)
add_example(SensorTemplateSample sensortemplate)
add_example(P9813Sample p9813)
add_example(BMG160_Example bmg160)
add_example(BISS0001_Example biss0001)
add_example(BMA250E_Example bma250e)
add_example(BMC150_Example bmx055)
add_example(BME280_Example "bmp280;core")
add_example(BMG160_Example bmg160)
add_example(BMI055_Example bmx055)
add_example(BMI160_Example bmi160)
add_example(BMM150_Example bmm150)
add_example(BMP280_Example "bmp280;core")
add_example(BMPX8X_Example "bmpx8x;core")
add_example(BMX055_Example bmx055)
add_example(BNO055_Example bno055)
add_example(Button_Example button)
add_example(Button_intr_Example button)
add_example(Buzzer_Example buzzer)
add_example(CJQ4435_Example cjq4435)
add_example(Collision_Example collision)
add_example(CWLSXXA_Example cwlsxxa)
add_example(DFREC_Example dfrec)
add_example(DFRORP_Example dfrorp)
add_example(DS1307_Example ds1307)
add_example(ECEZO_Example ecezo)
add_example(ECS1030_Example ecs1030)
add_example(EHR_Example ehr)
add_example(Emg_Example emg)
add_example(ENC03R_Example enc03r)
add_example(ES08A_Example "servo;core")
add_example(FlexSensor_Example flex)
add_example(Gp2y0a_Example gp2y0a)
add_example(GroveButton_Example grove)
add_example(GroveButton_intr_Example grove)
add_example(GroveEHR_Example groveehr)
add_example(GroveEmg_Example groveemg)
add_example(GroveGsr_Example grovegsr)
add_example(GroveLEDBar_Example my9221)
add_example(GroveLED_Example grove)
add_example(GroveLed_multi_Example grove)
add_example(GroveLight_Example grove)
add_example(GroveLineFinder_Example grovelinefinder)
add_example(GroveMD_Example grovemd)
add_example(GroveMoisture_Example grovemoisture)
add_example(GroveMQ3_Example gas)
add_example(GroveMQ9_Example gas)
add_example(GroveO2_Example groveo2)
add_example(GroveQTouch_Example at42qt1070)
add_example(GroveRelay_Example grove)
add_example(GroveRotary_Example grove)
add_example(GROVESCAM_Example grovescam)
add_example(GroveSlide_Example grove)
add_example(GroveSpeaker_Example grovespeaker)
add_example(GroveTemp_Example grove)
add_example(GroveVDiv_Example grovevdiv)
add_example(GroveWater_Example grovewater)
add_example(GroveWFS_Example grovewfs)
add_example(Gsr_Example gsr)
add_example(GUVAS12D_Example guvas12d)
add_example(H3LIS331DL_Example h3lis331dl)
add_example(HCSR04_Example hcsr04)
add_example(HKA5_Example hka5)
add_example(HM11_Example hm11)
add_example(Hmc5883l_Example hmc5883l)
add_example(HMTRP_Example hmtrp)
add_example(HP20x_Example hp20x)
add_example(HTU21D_Example htu21d)
add_example(Itg3200_Example itg3200)
add_example(Jhd1313m1_Example jhd1313m1)
add_example(Jhd1313m1_lcd_Example jhd1313m1)
add_example(Joystick12_Example joystick12)
add_example(KX122_Example kx122)
add_example(Lcm1602_i2c_Example lcm1602)
add_example(Lcm1602_parallel_Example lcm1602)
add_example(LDT0028_Example ldt0028)
add_example(LE910_Example uartat)
add_example(LED_Example led)
add_example(Light_Example light)
add_example(LineFinder_Example linefinder)
add_example(LIS2DS12_Example lis2ds12)
add_example(LoL_Example lol)
add_example(LSM303AGR_Example lsm303agr)
add_example(LSM303D_Example lsm303d)
add_example(VEML6070Sample veml6070)
add_example(RN2903_Example rn2903)
add_example(LIS2DS12_Example lis2ds12)
add_example(LSM303DLH_Example lsm303dlh)
add_example(LSM6DS3H_Example lsm6ds3h)
add_example(LSM6DSL_Example lsm6dsl)
add_example_with_path(Jhd1313m1_lcdSample jhd1313m1 jhd1313m1)
add_example_with_path(Jhd1313m1Sample jhd1313m1 jhd1313m1)
add_example_with_path(Lcm1602_i2cSample lcm1602 lcm1602)
add_example_with_path(Lcm1602_parallelSample lcm1602 lcm1602)
add_example_with_path(SSD1308_oledSample lcd lcd)
add_example_with_path(SSD1327_oledSample lcd lcd)
add_example_multiple_jars(BME280_Example bmp280 "bmp280;interfaces")
add_example(M24LR64E_Example m24lr64e)
add_example(MAX30100_Example max30100)
add_example(MAX31855_Example max31855)
add_example(MAX44000_Example max44000)
add_example(MAX5487_Example max5487)
add_example(MAXds3231m_Example maxds3231m)
add_example(MB704X_Example mb704x)
add_example(MCP2515_Example mcp2515)
add_example(MCP2515_TXRX_Example mcp2515)
add_example(MD_Example md)
add_example(MHZ16_Example mhz16)
add_example(Microphone_Example mic)
add_example(MMA7361_Example mma7361)
add_example(MMA7455_Example mma7455)
add_example(MMA7660_Example mma7660)
add_example(Moisture_Example moisture)
add_example(MPL3115A2_Example mpl3115a2)
add_example(MPR121_Example mpr121)
add_example(MPU9150_Example mpu9150)
add_example(MQ2_Example gas)
add_example(MQ303A_Example mq303a)
add_example(MQ5_Example gas)
add_example(MS5803_Example ms5803)
add_example(NMEAGPS_Example nmea_gps)
add_example(NMEAGPS_I2C_Example nmea_gps)
add_example(NRF24L01_receiver_Example nrf24l01)
add_example(NRF24L01_transmitter_Example nrf24l01)
add_example(NUNCHUCK_Example nunchuck)
add_example(O2_Example o2)
add_example(OTP538U_Example otp538u)
add_example(P9813_Example p9813)
add_example(PPD42NS_Example ppd42ns)
add_example(Pulsensor_Example pulsensor)
add_example(Relay_Example relay)
add_example(RFR359F_Example rfr359f)
add_example(RN2903_Example rn2903)
add_example(RN2903_P2P_RX_Example rn2903)
add_example(RN2903_P2P_TX_Example rn2903)
add_example(RotaryEncoder_Example rotaryencoder)
add_example(Rotary_Example rotary)
add_example(RPR220_Example rpr220)
add_example(RPR220_intr_Example rpr220)
add_example(SCAM_Example scam)
add_example(SensorTemplate_Example sensortemplate)
add_example(SHT1X_Example sht1x)
add_example(Slide_Example slide)
add_example(SM130_Example sm130)
add_example(Speaker_Example speaker)
add_example(SpeakerPWM_Example speaker)
add_example(SSD1308_oled_Example lcd)
add_example(SSD1327_oled_Example lcd)
add_example(ST7735_Example st7735)
add_example(TEAMS_Example teams)
add_example(Temperature_Example temperature)
add_example(TEX00_Example tex00)
add_example(Th02_Example th02)
add_example(TM1637_Example tm1637)
add_example(TP401_Example gas)
add_example(TSL2561_Example tsl2561)
add_example(TTP223_Example ttp223)
add_example(ULN200XA_Example uln200xa)
add_example(VDiv_Example vdiv)
add_example(VEML6070_Example veml6070)
add_example(Water_Example water)
add_example(WaterLevelSensor_Example waterlevel)
add_example(WFS_Example wfs)
add_example(WT5001_Example wt5001)
add_example(YG1006_Example yg1006)
add_example(ZFM20_Example zfm20)
if(SWIG_VERSION VERSION_GREATER 3.0.8)
add_example_multiple_jars(BME280_InterfaceExample bmp280 "bmp280;interfaces")
add_example(BME280_Interface_Example "bmp280;core")
add_example(IMS_Example "ims;core")
add_example(RHUSB_Example "rhusb;core")
endif()
add_example_with_path(BMC150_Example bmx055 bmx055)
add_example_with_path(BMI055_Example bmx055 bmx055)
if (OPENZWAVE_FOUND)
add_example_with_path(AeotecSS6_Example ozw ozw)
add_example_with_path(AeotecSDG2_Example ozw ozw)
add_example_with_path(AeotecDW2E_Example ozw ozw)
add_example_with_path(AeotecDSB09104_Example ozw ozw)
add_example_with_path(TZEMT400_Example ozw ozw)
add_example(AeotecDSB09104_Example ozw)
add_example(AeotecDW2E_Example ozw)
add_example(AeotecSDG2_Example ozw)
add_example(AeotecSS6_Example ozw)
add_example(TZEMT400_Example ozw)
endif()
add_example_with_path(NMEAGPS_I2C_Example nmea_gps nmea_gps)
add_example_with_path(MCP2515_TXRX_Example mcp2515 mcp2515)
add_example_with_path(LE910_Example uartat uartat)
add_example_with_path(SpeakerPWMSample speaker speaker)
add_example_with_path(RN2903_P2P_RX_Example rn2903 rn2903)
add_example_with_path(RN2903_P2P_TX_Example rn2903 rn2903)
if (MODBUS_FOUND)
add_example(H803X_Example h803x)
endif()
if (BACNET_FOUND)
add_example(E50HX_Example e50hx)
add_example(T8100_Example t8100)
add_example(TB7300_Example tb7300)
endif()
if (JPEG_FOUND)
add_example(VCAP_Example vcap)
endif()
if (NOT ANDROID)
add_example(StepMotor_Example stepmotor)
endif ()

View File

@ -24,7 +24,7 @@
import upm_collision.*;
public class Collision {
public class Collision_Example {
public static void main(String[] args) {
// Initializing the sensor on D2 on the Base Shield

View File

@ -22,7 +22,7 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
public class DFRPHSample {
public class DFRPH_Example {
public static void main(String[] args) throws InterruptedException {
// ! [Interesting]

View File

@ -23,7 +23,7 @@
*/
//NOT TESTED!!!
public class DS1307Sample {
public class DS1307_Example {
static private void printTime(upm_ds1307.DS1307 rtc) {
System.out.print("The time is: " + rtc.getMonth() + "/" + rtc.getDayOfMonth() + "/"

View File

@ -23,7 +23,7 @@
*/
import upm_ecs1030.ECS1030;
public class ECS1030Example {
public class ECS1030_Example {
static {
try {

View File

@ -23,7 +23,7 @@
*/
//NOT TESTED!!!
public class EHRSample {
public class EHR_Example {
public static void main(String[] args) throws InterruptedException {
// ! [Interesting]

View File

@ -23,7 +23,7 @@
*/
public class ENC03RSample {
public class ENC03R_Example {
private static final long CALIBRATION_SAMPLES = 1000;
public static void main(String[] args) throws InterruptedException {

View File

@ -22,7 +22,7 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
public class ES08ASample {
public class ES08A_Example {
public static void main(String[] args) throws InterruptedException {
// ! [Interesting]
upm_servo.ES08A servo = new upm_servo.ES08A(6);
@ -50,4 +50,4 @@ public class ES08ASample {
System.out.println("Set angle to 180");
// ! [Interesting]
}
}
}

View File

@ -23,7 +23,7 @@
*/
import upm_emg.EMG;
public class Emg {
public class Emg_Example {
public static void main(String[] args) {
// TODO Auto-generated method stub

View File

@ -1,6 +1,6 @@
import upm_flex.Flex;
public class FlexSensorExample {
public class FlexSensor_Example {
static {
try {

View File

@ -23,7 +23,7 @@
*/
//NOT TESTED!!!
public class GROVESCAMSample {
public class GROVESCAM_Example {
public static void main(String[] args) throws InterruptedException {
// ! [Interesting]

View File

@ -23,7 +23,7 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
public class GUVAS12DSample {
public class GUVAS12D_Example {
// analog voltage, usually 3.3 or 5.0
private static final float GUVAS12D_AREF = 5;

View File

@ -23,7 +23,7 @@
*/
import upm_gp2y0a.GP2Y0A;
public class Gp2y0aExample {
public class Gp2y0a_Example {
public static final float GP2Y0A_AREF = 5;
public static final short SAMPLES_PER_QUERY = 20;

View File

@ -22,7 +22,7 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
public class GroveButtonSample {
public class GroveButton_Example {
public static void main(String[] args) throws InterruptedException {
// ! [Interesting]

View File

@ -22,7 +22,7 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
public class GroveButton_intrSample {
public class GroveButton_intr_Example {
public static int counter = 0;
@ -47,7 +47,7 @@ class ButtonISR implements Runnable {
}
public void run() {
GroveButton_intrSample.counter++;
GroveButton_intr_Example.counter++;
System.out.println("Button pressed!");
}
}

View File

@ -24,7 +24,7 @@
import upm_grovecollision.*;
public class GroveCollision {
public class GroveCollision_Example {
public static void main(String[] args) {
// Initializing the sensor on D2 on the Base Shield

View File

@ -23,7 +23,7 @@
*/
//NOT TESTED!!!
public class GroveEHRSample {
public class GroveEHR_Example {
public static void main(String[] args) throws InterruptedException {
// ! [Interesting]

View File

@ -23,7 +23,7 @@
*/
import upm_groveemg.GroveEMG;
public class GroveEmg {
public class GroveEmg_Example {
public static void main(String[] args) {
// TODO Auto-generated method stub

View File

@ -24,7 +24,7 @@
import upm_grovegsr.GroveGSR;
public class GroveGsr {
public class GroveGsr_Example {
public static void main(String[] args) {
// TODO Auto-generated method stub

View File

@ -22,7 +22,7 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
public class GroveLEDBar {
public class GroveLEDBar_Example {
public static void main(String[] args) throws InterruptedException {
//! [Interesting]

View File

@ -22,7 +22,7 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
public class GroveLEDSample {
public class GroveLED_Example {
public static void main (String args[]) throws InterruptedException {
//! [Interesting]
upm_grove.GroveLed led = new upm_grove.GroveLed(2);

View File

@ -23,7 +23,7 @@
*/
//NOT TESTED!!!
public class GroveLed_multiSample {
public class GroveLed_multi_Example {
public static void main(String[] args) throws InterruptedException {
// ! [Interesting]

View File

@ -22,7 +22,7 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
public class GroveLightSample {
public class GroveLight_Example {
public static void main(String args[]) throws InterruptedException {
// ! [Interesting]
upm_grove.GroveLight gl = new upm_grove.GroveLight(2);

View File

@ -22,7 +22,7 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
public class GroveLineFinderSample {
public class GroveLineFinder_Example {
public static void main(String[] args) throws InterruptedException {
// ! [Interesting]

View File

@ -22,7 +22,7 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
public class GroveMDSample {
public class GroveMD_Example {
private static final short speed50 = 127;
private static final short speed0 = 0;

View File

@ -34,7 +34,7 @@ import upm_gas.MQ9;
import upm_gas.TP401;
import upm_gas.thresholdContext;
public class GroveMQ3 {
public class GroveMQ3_Example {
public static void main(String[] args) {
// TODO Auto-generated method stub

View File

@ -34,7 +34,7 @@ import upm_gas.MQ9;
import upm_gas.TP401;
import upm_gas.thresholdContext;
public class GroveMQ9 {
public class GroveMQ9_Example {
public static void main(String[] args) {
// TODO Auto-generated method stub

View File

@ -22,7 +22,7 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
public class GroveMoistureSample {
public class GroveMoisture_Example {
public static void main(String args[]) throws InterruptedException {
// ! [Interesting]
upm_grovemoisture.GroveMoisture gm = new upm_grovemoisture.GroveMoisture(1);

View File

@ -24,7 +24,7 @@
import upm_groveo2.GroveO2;
public class GroveO2Example {
public class GroveO2_Example {
public static void main(String[] args) {
// TODO Auto-generated method stub

View File

@ -24,7 +24,7 @@
import upm_at42qt1070.AT42QT1070;
public class GroveQTouch {
public class GroveQTouch_Example {
public static void main(String[] args) {
// TODO Auto-generated method stub

View File

@ -22,7 +22,7 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
public class GroveRelaySample {
public class GroveRelay_Example {
public static void main(String[] args) throws InterruptedException {
// ! [Interesting]
// Create the button object using UART

View File

@ -22,7 +22,7 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
public class GroveRotarySample {
public class GroveRotary_Example {
public static void main(String[] args) throws InterruptedException {
// ! [Interesting]

View File

@ -22,7 +22,7 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
public class GroveSlideSample {
public class GroveSlide_Example {
public static void main (String args[]) throws InterruptedException {
//! [Interesting]
// Instantiate new grove slide potentiometer on analog pin A0

View File

@ -22,7 +22,7 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
public class GroveSpeakerSample {
public class GroveSpeaker_Example {
public static void main(String[] args) throws InterruptedException {
// ! [Interesting]

View File

@ -22,7 +22,7 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
public class GroveTempSample {
public class GroveTemp_Example {
public static void main (String args[]) throws InterruptedException {
//! [Interesting]
upm_grove.GroveTemp temp = new upm_grove.GroveTemp(3);

View File

@ -22,7 +22,7 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
public class GroveUltraSonicSample {
public class GroveUltraSonic_Example {
public static void main(String[] args) throws InterruptedException {
// ! [Interesting]

View File

@ -23,7 +23,7 @@
*/
//NOT TESTED!!!
public class GroveVDivSample {
public class GroveVDiv_Example {
private static final short gain3 = 3;
private static final short gain10 = 10;

View File

@ -23,7 +23,7 @@
*/
//NOT TESTED!!!
public class GroveWFSSample {
public class GroveWFS_Example {
public static void main(String[] args) throws InterruptedException {
// ! [Interesting]

View File

@ -22,7 +22,7 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
public class GroveWaterSample {
public class GroveWater_Example {
public static void main(String[] args) throws InterruptedException {
// ! [Interesting]

View File

@ -24,7 +24,7 @@
import upm_gsr.GSR;
public class Gsr {
public class Gsr_Example {
public static void main(String[] args) {
// TODO Auto-generated method stub

View File

@ -27,7 +27,7 @@
import java.util.AbstractList;
import java.lang.Float;
public class H3LIS331DLSample {
public class H3LIS331DL_Example {
public static void main(String[] args) throws InterruptedException {
//! [Interesting]

View File

@ -25,7 +25,7 @@
//NOT TESTED!!!
import upm_hcsr04.*;
public class HCSR04Sample {
public class HCSR04_Example {
// ! [Interesting]
public static void main(String[] args) throws InterruptedException {

View File

@ -23,12 +23,12 @@
*/
//NOT TESTED!!!
public class HM11Sample {
public class HM11_Example {
private static final int BUFSIZ = 1024;
private static void printUsage() {
System.out.println("Usage: java HM11Sample [AT command]");
System.out.println("Usage: java HM11_Example [AT command]");
System.out.println("If an argument is supplied on the command line, that argument is");
System.out.println("sent to the module and the response is printed out.");

View File

@ -23,7 +23,7 @@
*/
//NOT TESTED!!!
public class HMTRPSample {
public class HMTRP_Example {
static private final int bufferLength = 255;

View File

@ -24,7 +24,7 @@
import upm_hp20x.HP20X;
public class HP20xExample {
public class HP20x_Example {
public static void main(String[] args) {
// TODO Auto-generated method stub

View File

@ -22,7 +22,7 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
public class HTU21DSample {
public class HTU21D_Example {
public static void main(String[] args) throws InterruptedException {
// ! [Interesting]

View File

@ -22,7 +22,7 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
public class Hmc5883lSample {
public class Hmc5883l_Example {
public static void main(String[] args) throws InterruptedException {
// ! [Interesting]

View File

@ -22,8 +22,6 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
import upm_ims.IMS;
public class IMS_Example
{
public static void main(String[] args) throws InterruptedException
@ -31,18 +29,18 @@ public class IMS_Example
// ! [Interesting]
// Instantiate a IMS instance using bus 0 and default i2c address
IMS sensor = new IMS((short)0);
upm_ims.IMS sensor = new upm_ims.IMS((short)0);
while (true)
{
System.out.println("Version: "
+ sensor.get_version()
+ upm_ims.javaupm_ims.LibraryVersion()
+ " light: "
+ sensor.get_light()
+ sensor.LightForSource("light")
+ " moisture: "
+ sensor.get_moisture()
+ sensor.MoistureForSource("moisture")
+ " temp: "
+ sensor.get_temperature()
+ sensor.TemperatureForSource("temperature")
+ " C");
Thread.sleep(1000);

View File

@ -23,7 +23,7 @@
*/
//NOT TESTED!!!
public class Itg3200Sample {
public class Itg3200_Example {
public static void main(String[] args) throws InterruptedException {
// ! [Interesting]

View File

@ -22,7 +22,7 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
public class Jhd1313m1Sample {
public class Jhd1313m1_Example {
public static void main(String[] args) throws InterruptedException {
// ! [Interesting]

View File

@ -22,7 +22,7 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
public class Jhd1313m1_lcdSample{
public class Jhd1313m1_lcd_Example{
public static void main(String[] args) throws InterruptedException {
//! [Interesting]

View File

@ -22,7 +22,7 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
public class Joystick12Sample {
public class Joystick12_Example {
public static void main(String[] args) throws InterruptedException {
//! [Interesting]

View File

@ -22,7 +22,7 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
public class Joystick12_exampleSample {
public class Joystick12_example_Example {
public static void main(String[] args) throws InterruptedException {
//! [Interesting]

View File

@ -0,0 +1,50 @@
/*
* Author: Noel Eck <noel.eck@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.
*/
public class KX122_Example {
public static void main(String[] args) throws InterruptedException {
//! [Interesting]
// Instantiate a KX122
upm_kx122.KX122 kx122 = new upm_kx122.KX122(0, -1, 24);
// Reset the device
kx122.softwareReset();
// Initialize the device
kx122.deviceInit(upm_kx122.KX122_ODR_T.KX122_ODR_50,
upm_kx122.KX122_RES_T.HIGH_RES,
upm_kx122.KX122_RANGE_T.KX122_RANGE_2G);
// Print the acceleration
while(true){
upm_kx122.floatVector xyz = kx122.getAccelerationDataVector();
System.out.println("Acceleration: x = " + xyz.get(0)
+ " y = " + xyz.get(1)
+ " z = " + xyz.get(2));
Thread.sleep(1000);
}
//! [Interesting]
}
}

View File

@ -22,7 +22,7 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
public class LCD_EBOLEDSample {
public class LCD_EBOLED_Example {
public static void main(String[] args) throws InterruptedException {
// ! [Interesting]

View File

@ -22,7 +22,7 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
public class LCD_SSD1306Sample {
public class LCD_SSD1306_Example {
static private final int[] intel_logo = new int[]{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

View File

@ -23,7 +23,7 @@
*/
//NOT TESTED!!!
public class LDT0028Sample {
public class LDT0028_Example {
public static void main(String[] args) throws InterruptedException {
// ! [Interesting]

View File

@ -22,7 +22,7 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
public class LEDSample {
public class LED_Example {
public static void main (String args[]) throws InterruptedException {
//! [Interesting]
upm_led.Led led = new upm_led.Led(2);

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