Compare commits
430 Commits
Author | SHA1 | Date | |
---|---|---|---|
74691914fb | |||
9bf184129e | |||
1667569560 | |||
01119436a9 | |||
344a52ae97 | |||
1accafa145 | |||
e54f5e21c3 | |||
01700b0d49 | |||
a96a2ff44c | |||
cc7930caf3 | |||
ac21c9336b | |||
fd509c7d79 | |||
287250b32d | |||
758b49f51d | |||
2a1af1399a | |||
4de9734f0a | |||
9bfda4219d | |||
dddba3e8a4 | |||
500e14663b | |||
fcb36276b7 | |||
7f7fdb8441 | |||
f8a105adbf | |||
ba43986f82 | |||
6e2355ce9a | |||
4a90e2c4be | |||
1adea8ecf1 | |||
011013e800 | |||
b4d4a215a2 | |||
2eb6ebd3bd | |||
dc97adf578 | |||
181b5f17ea | |||
90bf469245 | |||
85b5c8a64e | |||
422592f993 | |||
fa1c1f3aa4 | |||
b11ad2d170 | |||
d62d9f22cd | |||
dec976e971 | |||
fcf2278553 | |||
b3300d5724 | |||
003ca2169f | |||
0586775ffc | |||
053cf15495 | |||
3d8b732158 | |||
db3b0c39bf | |||
d2c4747251 | |||
8b5cdae4ca | |||
2384fbb218 | |||
212c67fdd0 | |||
ca15860cc3 | |||
cce8ab43e6 | |||
255d6cbe86 | |||
db721845db | |||
53bc249b75 | |||
639f99691b | |||
6e095826d3 | |||
0d2541270e | |||
e34863f223 | |||
27f34face1 | |||
563c72be2c | |||
9bd5e78472 | |||
81c5962220 | |||
bf856c5fca | |||
1040b4e51f | |||
1713d44a4b | |||
5ff625eaf4 | |||
9d63545d44 | |||
06b9e7b6f2 | |||
45773fac80 | |||
ee4efb3d6a | |||
abced2fdbb | |||
537f7e111d | |||
8b49943025 | |||
a6f517d2c1 | |||
d26bde1825 | |||
ef30ab6fb2 | |||
9206480b9c | |||
d81639d715 | |||
08451d98cd | |||
ad81ea55e1 | |||
bd8e22f125 | |||
04dc6df429 | |||
453a6eae0e | |||
d325ae1fda | |||
98ea1c615a | |||
511d796fc2 | |||
58888fc49b | |||
19bf570561 | |||
922c8f628c | |||
3b6812ff36 | |||
e3dde0e390 | |||
68f54d1c59 | |||
5f4e8b18e5 | |||
5d356917cc | |||
1ceb784252 | |||
e9679e0982 | |||
c6386269ef | |||
f03f967a38 | |||
5fda514544 | |||
9fe9d4aec2 | |||
cd7815aa07 | |||
1563c71c5f | |||
3b7eb9afc2 | |||
d7bc084565 | |||
3d702a6e64 | |||
cd30c7d71f | |||
ed71aa029d | |||
7ffe895374 | |||
a427d6ebe5 | |||
83e62aabba | |||
d94a6d00fb | |||
14a3924fb2 | |||
7935ef1622 | |||
a0af1c01bd | |||
7ce8dc3434 | |||
33c123420a | |||
21eb2de086 | |||
5e72c4febd | |||
428bac360b | |||
a0518976c6 | |||
bdacb6c640 | |||
ce6a095079 | |||
701a25261f | |||
6719168a20 | |||
2002904faa | |||
7d0dccf9ed | |||
bfe548ac45 | |||
3c36aa1624 | |||
64777bd0ef | |||
1fefdcbdf1 | |||
8765416016 | |||
26317cbd2a | |||
f358b2e16d | |||
619da95553 | |||
3585761ecf | |||
ca04996524 | |||
6b19482ceb | |||
d3bfebeca0 | |||
60a3f6cd7e | |||
5e9d9f4e66 | |||
a56485f288 | |||
d0b5a98952 | |||
36cbca05bb | |||
f6ab1fb451 | |||
9c4a4d0ff0 | |||
5cc8c90251 | |||
a24f8209bc | |||
e8823dd74e | |||
b8ee0cf22d | |||
14fc909400 | |||
0db47c7528 | |||
aeb120c284 | |||
ab20e34c59 | |||
d0d89b579d | |||
6db7dfd3d9 | |||
36237ae596 | |||
9e20268bb8 | |||
77abd94682 | |||
7323b58b61 | |||
cb6427b22e | |||
fe133d7454 | |||
52274d8b10 | |||
0af62a6992 | |||
6a6eaa1b71 | |||
3fc672a19f | |||
69bd77dd30 | |||
9421cdaf30 | |||
fb779ecd6a | |||
3cd61b56f8 | |||
56ddb441d4 | |||
8d38bd0bcc | |||
1f1c303937 | |||
f567f282ae | |||
5ab01e5a65 | |||
b56095a3ff | |||
b20a5f1d68 | |||
c3297bcc55 | |||
4513a8ad09 | |||
ae60a92963 | |||
eba82a1c73 | |||
b7dda9021f | |||
d7b8fac41b | |||
1079baf2fd | |||
b925f13bac | |||
78d940aaf5 | |||
3d837284fd | |||
b8af35a797 | |||
1eb9e7b9dc | |||
1617b03d3d | |||
da49741527 | |||
f86e812f13 | |||
f84973b0e4 | |||
b0ac4b5da2 | |||
0566b4f995 | |||
a1db1b423b | |||
f29141087e | |||
fbbc0de6fb | |||
427dd6e851 | |||
4f5b4d5886 | |||
8345687ab9 | |||
bea94a70b2 | |||
a4db81c15f | |||
c7aa1b1f8a | |||
8e54381216 | |||
9081c35f53 | |||
88c11fb1cf | |||
9e3c72a547 | |||
2f2b502813 | |||
6b4a3e1fd0 | |||
c50dd16d82 | |||
7866e54e8d | |||
b00e81dfce | |||
cc6ba3be6d | |||
a564258fb0 | |||
03cb2ec362 | |||
f4e5a5109f | |||
dc49f36e83 | |||
5516faca38 | |||
74cbc25f21 | |||
1ea36c6f89 | |||
38351cbe6e | |||
d4d29307a2 | |||
b4e4e9ae89 | |||
a2855c5e72 | |||
667a8fdb49 | |||
04e91db166 | |||
6c8f82901c | |||
5f27c5515f | |||
48e6d4bcfa | |||
4e70ed4973 | |||
3159005aa3 | |||
5a62602a11 | |||
0bc1930cf5 | |||
ef74a7b137 | |||
f991bcf915 | |||
6cbddff31a | |||
ff42bd390f | |||
b4d2a2e1f2 | |||
b44995da74 | |||
3af7cccb93 | |||
021c003ca8 | |||
2e5fbd0d54 | |||
2cab79b4c2 | |||
ab730038fd | |||
b8835958e2 | |||
ea1df1b178 | |||
85c602d524 | |||
8147a89cb7 | |||
20d5c50725 | |||
138c5af5f8 | |||
6793c892ed | |||
76f7abb112 | |||
1e5b755b99 | |||
a79d8abfcd | |||
4b8b75b19b | |||
2bae3931b9 | |||
5fd2d9c439 | |||
c45e493b1b | |||
4985cf4b00 | |||
7afd1f3fc1 | |||
83cb6dc2fd | |||
dc7e33558e | |||
0406258466 | |||
2ceb6a9d8d | |||
fbf68d1dd8 | |||
a5a66e9e17 | |||
07f6ffb0a4 | |||
ebdb4f10d1 | |||
3d74ea9820 | |||
f6c56be5e4 | |||
cfe63bf7b6 | |||
1f82757c64 | |||
be2e8d7c76 | |||
3aad8e367f | |||
45b83502a1 | |||
9cfd1a9679 | |||
fb6627083b | |||
42c59e98ab | |||
ea669ddfc6 | |||
4f30959a43 | |||
2455938691 | |||
5e3263e2e2 | |||
58846ba68a | |||
a21db7ca78 | |||
40fb6f5d75 | |||
2595c0b623 | |||
c7185739dc | |||
945a6d4828 | |||
19bcbc7c42 | |||
323905a215 | |||
3e59323abb | |||
59c6b28cdd | |||
b17a3b34b7 | |||
8b9267c253 | |||
78a159594b | |||
8eed56fda0 | |||
647d9b44a9 | |||
749952f7e3 | |||
d3e0ae5771 | |||
a81b1836a3 | |||
c7389d0cb6 | |||
fb86dc5cec | |||
98f400e326 | |||
b0625e11f1 | |||
60cfe88e37 | |||
ad1cc81c0d | |||
4a6492af0a | |||
488ea234d5 | |||
fba8139416 | |||
45738d0b93 | |||
52810cef77 | |||
f02fa1fdf1 | |||
f8766cccdc | |||
4bea93163d | |||
8b0d1b2b3d | |||
7e2ae96c1f | |||
181823cb20 | |||
11f9154ce0 | |||
018e09e5b2 | |||
984391eb64 | |||
9bf954071b | |||
448ee39c7f | |||
8dac9f7356 | |||
fcca8ada45 | |||
2e0efd6690 | |||
c878283c44 | |||
b81be93411 | |||
3ad25f65c8 | |||
97e7f74a8f | |||
66d688bc90 | |||
84f795e453 | |||
58c800e246 | |||
48a8d3e0cc | |||
1fe9b9eb1d | |||
04edb9be04 | |||
55e8076988 | |||
9db2d57de3 | |||
de49bb0e42 | |||
93595bcd35 | |||
7260c78c33 | |||
197b56003c | |||
f133b6eb4c | |||
cb62f06197 | |||
a2e4fb5d7a | |||
36b0e1dce0 | |||
03e72e02f8 | |||
6613dea552 | |||
ef173ebeaf | |||
5a6fb122ec | |||
8462e8ce52 | |||
1647f572ff | |||
56f7e97536 | |||
3aaafdcecf | |||
99651d2239 | |||
c586cd5177 | |||
fc3a884024 | |||
a91f1e5095 | |||
2314bc2f59 | |||
af2281057a | |||
e85c98062b | |||
c1cde01424 | |||
54cda32a94 | |||
2e36b8dc21 | |||
f4a5c9a391 | |||
08ff50067a | |||
cff584d8b9 | |||
abb9c91320 | |||
a03d0c7e95 | |||
231a1f1b43 | |||
c313e3ae69 | |||
f2503c6167 | |||
7a7b8324b4 | |||
057fa03723 | |||
f64c710c12 | |||
32921ff2b1 | |||
6c7928fc92 | |||
fd29a7409e | |||
61c95088af | |||
24bda4741c | |||
172124f20a | |||
17dbadfe9f | |||
e71ae67b4e | |||
e00ee9b777 | |||
0f015354ef | |||
3ed6e09f20 | |||
0dbfa06359 | |||
2fda38f7b1 | |||
ec1828f2bc | |||
3e6ec5087b | |||
a3b4d466d7 | |||
1ddd325e18 | |||
3d453811fb | |||
67b0b9b219 | |||
502b928aff | |||
a9cb0718fe | |||
a1dac4228a | |||
6e2587576d | |||
f8179328cf | |||
dae5c67c02 | |||
eb2ff59fe5 | |||
b36eb487eb | |||
bc61e9f86b | |||
61175740f6 | |||
a41f59984f | |||
0bab36a95a | |||
ff88313462 | |||
3f5c357971 | |||
d2e11d6f11 | |||
3e82dd8d0a | |||
4f5030ecf7 | |||
784e8a3eb8 | |||
7fbe71102a | |||
6f34162ac5 | |||
46ab65a344 | |||
d8cf4c82a5 | |||
ab14f4f82e | |||
56cbeb6183 | |||
6efe6916ba | |||
ea544e8391 | |||
0c46dd28be | |||
d493c015fd | |||
1e3797ec48 | |||
6effb25bd6 | |||
796f188cb3 | |||
e0bc9573d4 | |||
5733918a2f | |||
6740932c47 | |||
9fb0ca3466 | |||
d6ce082274 | |||
3587162611 |
21
.travis.yml
Normal file
@ -0,0 +1,21 @@
|
||||
language: cpp
|
||||
compiler:
|
||||
- gcc
|
||||
- clang
|
||||
install:
|
||||
- sudo add-apt-repository --yes ppa:kalakris/cmake
|
||||
- sudo add-apt-repository --yes ppa:fenics-packages/fenics-exp/swig
|
||||
- sudo apt-get update -qq
|
||||
- sudo apt-get install -y -qq swig3.0 python git cmake
|
||||
- sudo ln -s /usr/bin/swig3.0 /usr/bin/swig
|
||||
- sudo update-java-alternatives -s java-8-oracle
|
||||
before_script:
|
||||
- if [ "$CC" = "gcc" ]; then export BUILDJAVA=ON; else export BUILDJAVA=OFF; fi
|
||||
- export JAVA_HOME=/usr/lib/jvm/java-8-oracle
|
||||
script:
|
||||
- git clone --branch=master https://github.com/intel-iot-devkit/mraa.git
|
||||
- cd mraa && mkdir build && cd build && cmake -DBUILDSWIGJAVA=$BUILDJAVA -DENABLEEXAMPLES=OFF -DCMAKE_INSTALL_PREFIX:PATH=. -DNODE_ROOT_DIR:PATH=/home/travis/.nvm/v0.10.36/include .. && make && make install
|
||||
- export PKG_CONFIG_PATH=$PWD/lib/pkgconfig:$PWD/lib/x86_64-linux-gnu/pkgconfig
|
||||
- export CPLUS_INCLUDE_PATH=$PWD/include
|
||||
- export LIBRARY_PATH=$PWD/lib:$PWD/lib/x86_64-linux-gnu
|
||||
- cd ../.. && mkdir build && cd build && cmake -DBUILDSWIGJAVA=$BUILDJAVA -DNODE_ROOT_DIR:PATH=/home/travis/.nvm/v0.10.36/include -DBUILDEXAMPLES=ON .. && make
|
113
CMakeLists.txt
@ -5,22 +5,17 @@ if ("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
|
||||
message("WARNING: building into sources dir can be risky, prefer other directory")
|
||||
endif ()
|
||||
|
||||
find_package (SWIG)
|
||||
if (SWIG_FOUND)
|
||||
include (${SWIG_USE_FILE})
|
||||
endif ()
|
||||
|
||||
find_package (Threads REQUIRED)
|
||||
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)
|
||||
pkg_check_modules (MRAA REQUIRED mraa>=0.6.0)
|
||||
message (INFO " found libmraa version: ${MRAA_VERSION}")
|
||||
pkg_check_modules (MRAA REQUIRED mraa>=0.8.0)
|
||||
message (INFO " found mraa version: ${MRAA_VERSION}")
|
||||
|
||||
# Appends the cmake/modules path to MAKE_MODULE_PATH variable.
|
||||
set (CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH})
|
||||
set (LIB_INSTALL_DIR "lib${LIB_SUFFIX}" CACHE PATH "Installation path for libraries")
|
||||
set (LIB_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}" CACHE PATH "Installation path for libraries")
|
||||
|
||||
# Set CMAKE_LIB_INSTALL_DIR if not defined
|
||||
include(GNUInstallDirs)
|
||||
@ -28,14 +23,14 @@ include(GNUInstallDirs)
|
||||
# Make a version file containing the current version from git.
|
||||
include (GetGitRevisionDescription)
|
||||
git_describe (VERSION "--tags")
|
||||
if ("x_${VERSION}" STREQUAL "x_GIT-NOTFOUND")
|
||||
message (WARNING " - Install git to compile a production libmraa!")
|
||||
set (VERSION "v0.3.0-dirty")
|
||||
if ("x_${VERSION}" STREQUAL "x_GIT-NOTFOUND" OR "x_${VERSION}" STREQUAL "x_-128-NOTFOUND")
|
||||
message (WARNING " - Install git to compile a production UPM!")
|
||||
set (VERSION "v0.4.1-dirty")
|
||||
endif ()
|
||||
|
||||
message (INFO " - UPM Version ${VERSION}")
|
||||
|
||||
#parse the version information into pieces.
|
||||
# Parse the version information into pieces.
|
||||
string (REGEX REPLACE "^v([0-9]+)\\..*" "\\1" VERSION_MAJOR "${VERSION}")
|
||||
string (REGEX REPLACE "^v[0-9]+\\.([0-9]+).*" "\\1" VERSION_MINOR "${VERSION}")
|
||||
string (REGEX REPLACE "^v[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" VERSION_PATCH "${VERSION}")
|
||||
@ -53,28 +48,55 @@ set (upm_VERSION_STRING ${upm_VERSION_MAJOR}.${upm_VERSION_MINOR}.${upm_VERSION_
|
||||
|
||||
set (CMAKE_SWIG_FLAGS "")
|
||||
|
||||
option (IPK "Generate IPK using CPack" OFF)
|
||||
option (BUILDDOC "Build all doc." OFF)
|
||||
option (BUILDSWIG "Build swig modules." ON)
|
||||
option (BUILDSWIGPYTHON "Build swig python modules." ON)
|
||||
option (BUILDSWIGNODE "Build swig node modules." ON)
|
||||
option (BUILDEXAMPLES "Build C++ example binaries" OFF)
|
||||
option (BUILDSWIGJAVA "Build swig java modules" OFF)
|
||||
option (IPK "Generate IPK using CPack" OFF)
|
||||
option (RPM "Generate RPM using CPack" OFF)
|
||||
|
||||
# Find swig
|
||||
if (BUILDSWIG)
|
||||
if (BUILDSWIGNODE)
|
||||
find_package (SWIG 3.0.5 REQUIRED)
|
||||
else ()
|
||||
find_package (SWIG REQUIRED)
|
||||
endif ()
|
||||
if (SWIG_FOUND)
|
||||
include (${SWIG_USE_FILE})
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# Detect arch
|
||||
include (TargetArch)
|
||||
target_architecture (DETECTED_ARCH)
|
||||
message( INFO " - Target arch is ${DETECTED_ARCH}")
|
||||
|
||||
if (BUILDDOC)
|
||||
# add a target to generate API documentation with Doxygen
|
||||
# Add a target to generate API documentation with Doxygen
|
||||
find_package (Doxygen)
|
||||
if (DOXYGEN_FOUND)
|
||||
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/doxy/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
|
||||
if (BUILDSWIGJAVA)
|
||||
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/doxy/Doxyfile.java.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile-java @ONLY)
|
||||
endif()
|
||||
file(GLOB PNG_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/docs docs/icons/*.png)
|
||||
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
|
||||
COMMAND tar -czf html/xml.tar.gz -C xml .
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
COMMENT "Generating API documentation with Doxygen" VERBATIM
|
||||
)
|
||||
endif (DOXYGEN_FOUND)
|
||||
# check if Sphinx is installed and add target to generate API documentation
|
||||
# Check if Sphinx is installed and add target to generate API documentation
|
||||
find_package (Sphinx)
|
||||
if(SPHINX_FOUND AND BUILDSWIG AND BUILDSWIGPYTHON)
|
||||
# python required for Sphinx build
|
||||
# Python required for Sphinx build
|
||||
find_package (PythonLibs)
|
||||
string (REPLACE "." ";" PYTHON_VERSION_LIST ${PYTHONLIBS_VERSION_STRING})
|
||||
list (GET PYTHON_VERSION_LIST 0 PYTHON_VERSION_MAJOR)
|
||||
@ -87,26 +109,26 @@ if (BUILDDOC)
|
||||
COMMAND find ${CMAKE_BINARY_DIR}/src -name "_pyupm_*.so" -exec cp {} ${CMAKE_BINARY_DIR}/pyupm \;
|
||||
COMMAND find ${CMAKE_BINARY_DIR}/src -name "pyupm_*.py" -exec cp {} ${CMAKE_BINARY_DIR}/pyupm \;
|
||||
COMMAND ${SPHINX_API_EXECUTABLE} -f -o pydoc ${CMAKE_BINARY_DIR}/pyupm
|
||||
# todo: use a separate cmake FILE module for string replacement instead
|
||||
# TODO: use a separate cmake FILE module for string replacement instead
|
||||
COMMAND ${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:]]module</a>|</a>|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
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
COMMENT "Generating API documentation with Sphinx" VERBATIM
|
||||
)
|
||||
endif ()
|
||||
# check if Yuidoc is installed and add target for API documentation
|
||||
# Check if Yuidoc is installed and add target for API documentation
|
||||
find_package(Yuidoc)
|
||||
if(YUIDOC_FOUND AND BUILDSWIGNODE)
|
||||
# node required for Yuidoc documentation
|
||||
# Node required for Yuidoc documentation
|
||||
find_package(Node)
|
||||
file(GLOB_RECURSE JSDOC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/doxy/node doxy/node/*)
|
||||
foreach(JSDOC_FILE ${JSDOC_FILES})
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/doxy/node/${JSDOC_FILE} ${CMAKE_CURRENT_BINARY_DIR}/${JSDOC_FILE} COPYONLY)
|
||||
endforeach()
|
||||
add_custom_target(jsdoc ALL
|
||||
COMMAND ${NODE_EXECUTABLE} docgen -m upm -i xml -t ${CMAKE_CURRENT_SOURCE_DIR}/src -g ../../../../docs/images/
|
||||
COMMAND ${NODE_EXECUTABLE} docgen -m upm -i xml -t ${CMAKE_CURRENT_SOURCE_DIR}/src -g ../../
|
||||
COMMAND ${YUIDOC_EXECUTABLE} -C --no-sort --helpers generators/yuidoc/helper.js --themedir generators/yuidoc/tmpl -o html/node jsdoc/yuidoc/upm
|
||||
COMMAND ${NODE_EXECUTABLE} tolower -i html/node
|
||||
DEPENDS doc
|
||||
@ -117,12 +139,23 @@ if (BUILDDOC)
|
||||
endif()
|
||||
|
||||
if (IPK)
|
||||
include (TargetArch)
|
||||
target_architecture (DETECTED_ARCH)
|
||||
message( INFO " - Target arch is ${DETECTED_ARCH}")
|
||||
|
||||
# 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 (INFO " - Package arch is ${TARGET_ARCH}")
|
||||
|
||||
set(CPACK_GENERATOR "DEB" "TGZ")
|
||||
set(OPKG_ARCH ${DETECTED_ARCH})
|
||||
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 ".")
|
||||
@ -133,9 +166,9 @@ if (IPK)
|
||||
"${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 ${DETECTED_ARCH})
|
||||
set(CPACK_SYSTEM_NAME ${DETECTED_ARCH})
|
||||
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libmraa0 (>= ${MRAA_VERSION})")
|
||||
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})
|
||||
@ -143,6 +176,28 @@ if (IPK)
|
||||
include (CPack)
|
||||
endif()
|
||||
|
||||
if (RPM)
|
||||
message (INFO " - RPM packaging enabled for ${DETECTED_ARCH}")
|
||||
set(CPACK_PACKAGE_VERSION ${VERSION})
|
||||
set(CPACK_GENERATOR "RPM")
|
||||
set(CPACK_PACKAGE_NAME "libupm${upm_VERSION_MAJOR}")
|
||||
set(CPACK_PACKAGE_RELEASE 1)
|
||||
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")
|
||||
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}-${CPACK_PACKAGE_RELEASE}.${DIST_TAG}.${DETECTED_ARCH}")
|
||||
include(CPack)
|
||||
endif()
|
||||
|
||||
add_subdirectory (src)
|
||||
|
||||
if(BUILDEXAMPLES)
|
||||
|
2
LICENSE
@ -1,4 +1,4 @@
|
||||
Copyright © 2014 Intel Corporation
|
||||
Copyright © 2014-2015 Intel Corporation
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
|
79
README.md
@ -1,8 +1,8 @@
|
||||
UPM - Sensor/Actuator repository for libmraa
|
||||
UPM (Useful Packages & Modules) Sensor/Actuator repository for MRAA
|
||||
==============
|
||||
|
||||
UPM is a high level repository for sensors that use libmraa. Each sensor links
|
||||
to libmraa and are not meant to be interlinked although some groups of sensors
|
||||
UPM is a high level repository for sensors that use MRAA. Each sensor links
|
||||
to MRAA and are not meant to be interlinked although some groups of sensors
|
||||
may be. Each sensor contains a header which allows to interface with it.
|
||||
Typically a sensor is represented as a class and instantiated.
|
||||
|
||||
@ -14,8 +14,42 @@ sensor in order to reduce load when doing multiple reads to sensor data.
|
||||
|
||||
### Example
|
||||
|
||||
A sensor/actuator is expected to work as such (here is the servo ES08A API):
|
||||
@snippet es08a.cxx Interesting
|
||||
A sensor/actuator is expected to work as such (here is the MMA7660 accelerometer API):
|
||||
```C++
|
||||
// Instantiate an MMA7660 on I2C bus 0
|
||||
upm::MMA7660 *accel = new upm::MMA7660(MMA7660_I2C_BUS,
|
||||
MMA7660_DEFAULT_I2C_ADDR);
|
||||
|
||||
// place device in standby mode so we can write registers
|
||||
accel->setModeStandby();
|
||||
|
||||
// enable 64 samples per second
|
||||
accel->setSampleRate(upm::MMA7660::AUTOSLEEP_64);
|
||||
|
||||
// place device into active mode
|
||||
accel->setModeActive();
|
||||
|
||||
while (shouldRun)
|
||||
{
|
||||
int x, y, z;
|
||||
|
||||
accel->getRawValues(&x, &y, &z);
|
||||
cout << "Raw values: x = " << x
|
||||
<< " y = " << y
|
||||
<< " z = " << z
|
||||
<< endl;
|
||||
|
||||
float ax, ay, az;
|
||||
|
||||
accel->getAcceleration(&ax, &ay, &az);
|
||||
cout << "Acceleration: x = " << ax
|
||||
<< "g y = " << ay
|
||||
<< "g z = " << az
|
||||
<< "g" << endl;
|
||||
|
||||
usleep(500000);
|
||||
}
|
||||
```
|
||||
|
||||
However implementation and API design is completely up to the developer, some
|
||||
enumerable sensors for example may provide much clever instantiation. Displays
|
||||
@ -23,6 +57,9 @@ may also create more complex structures in order to interface with them.
|
||||
|
||||
Browse through the list of all [examples](https://github.com/intel-iot-devkit/upm/tree/master/examples).
|
||||
|
||||
Multi-sensor samples for the starter and specialized kits can be found in the
|
||||
[iot-devkit-samples](https://github.com/intel-iot-devkit/iot-devkit-samples) repository.
|
||||
|
||||
### Supported Sensors
|
||||
|
||||
Supported [sensor list](http://iotdk.intel.com/docs/master/upm/modules.html) from API documentation.
|
||||
@ -31,37 +68,43 @@ You can also refer to the [Intel® IoT Developer Zone](https://software.intel.co
|
||||
|
||||
### IDE Integration
|
||||
|
||||
If you would like to create Eclipse IDE projects using the UPM C++ samples,
|
||||
please follow the instructions posted [here](https://software.intel.com/en-us/node/551014).
|
||||
This will show you how to import the code and configure your project.
|
||||
If you would like to create projects and run the UPM samples using an Intel recommended IDE,
|
||||
please refer to the Intel Developer Zone IDE page.
|
||||
|
||||
<a href="https://software.intel.com/iot/software/ide"><img src="docs/icons/allides.png"/></a>
|
||||
|
||||
### Building UPM
|
||||
|
||||
See @ref building [here](docs/building.md).
|
||||
See building documentation [here](docs/building.md).
|
||||
|
||||
### Making your own UPM module
|
||||
|
||||
@ref porting [link](docs/porting.md) has more information on making new UPM modules.
|
||||
Porting [link](docs/porting.md) has more information on making new UPM modules.
|
||||
|
||||
There is also an example available for @ref max31855 [sensor](docs/max31855.md).
|
||||
There is also an example available for max31855 [sensor](docs/max31855.md).
|
||||
|
||||
### Naming conventions and rules for new UPM contributions
|
||||
|
||||
Before you begin development, take a look at our @ref naming [conventions](docs/naming.md).
|
||||
Before you begin development, take a look at our naming [conventions](docs/naming.md).
|
||||
|
||||
Also, please read the guidelines for @ref contributions [to UPM](docs/contributions.md).
|
||||
Also, please read the guidelines for contributions [to UPM](docs/contributions.md).
|
||||
|
||||
Don't forget to check the @ref documentation [section](docs/documentation.md).
|
||||
Don't forget to check the documentation [section](docs/documentation.md).
|
||||
|
||||
Make sure you add yourself as an author on every new code file submitted.
|
||||
If you are providing a fix with significant changes, feel free to add yourself
|
||||
as a contributor. Signing-off your commits is mandatory.
|
||||
|
||||
C/C++ API Documentation
|
||||
API Documentation
|
||||
==============
|
||||
|
||||
The C/C++ documentation is available [here](http://iotdk.intel.com/docs/master/upm/).
|
||||
<a href="http://iotdk.intel.com/docs/master/upm"><img src="docs/icons/c++.png"/></a>
|
||||
<a href="http://iotdk.intel.com/docs/master/upm/java"><img src="docs/icons/java.png"/></a>
|
||||
<a href="http://iotdk.intel.com/docs/master/upm/python"><img src="docs/icons/python.png"/></a>
|
||||
<a href="http://iotdk.intel.com/docs/master/upm/node"><img src="docs/icons/node.png"/></a>
|
||||
|
||||
Version @ref changelog [here](docs/changelog.md).
|
||||
### Changelog
|
||||
Version changelog [here](docs/changelog.md).
|
||||
|
||||
List of @ref knownlimitations [here](docs/knownlimitations.md).
|
||||
### Known Limitations
|
||||
List of known limitations [here](docs/knownlimitations.md).
|
||||
|
25
cmake/Toolchains/oe-sdk_cross.cmake
Normal file
@ -0,0 +1,25 @@
|
||||
# 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)
|
@ -38,6 +38,7 @@ if (NODE_EXECUTABLE)
|
||||
set (V8_VERSION_STRING ${_V8_VERSION})
|
||||
string (REPLACE "." ";" _V8_VERSION_LIST "${_V8_VERSION}")
|
||||
string (REPLACE "." "" V8_DEFINE_STRING "${_V8_VERSION}")
|
||||
string (STRIP ${V8_DEFINE_STRING} V8_DEFINE_STRING)
|
||||
list (GET _V8_VERSION_LIST 0 V8_VERSION_MAJOR)
|
||||
list (GET _V8_VERSION_LIST 1 V8_VERSION_MINOR)
|
||||
list (GET _V8_VERSION_LIST 2 V8_VERSION_PATCH)
|
||||
@ -49,8 +50,8 @@ if (NODE_EXECUTABLE)
|
||||
set (NODE_VERSION_MINOR "10")
|
||||
set (NODE_VERSION_PATCH "30")
|
||||
set (V8_VERSION_MAJOR "3")
|
||||
set (V8_VERSION_MAJOR "14")
|
||||
set (V8_VERSION_MAJOR "5")
|
||||
set (V8_VERSION_MINOR "28")
|
||||
set (V8_VERSION_PATCH "72")
|
||||
set (V8_VERSION_STRING "3.28.72")
|
||||
message ("defaulted to node 0.10.30")
|
||||
endif ()
|
||||
|
@ -3,8 +3,7 @@ Building UPM {#building}
|
||||
|
||||
UPM uses cmake in order to make compilation relatively painless. Cmake runs
|
||||
build out of tree so the recommended way is to clone from git and make a build/
|
||||
directory. Failure to do an out-of-source build may cause issues when
|
||||
rebuilding later on.
|
||||
directory.
|
||||
|
||||
This project depends on libmraa, so that needs to be installed first. Use the
|
||||
following environment variables to configure the paths:
|
||||
@ -25,7 +24,8 @@ make install
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
The last command will create the include/ and lib/ directories with a copy of
|
||||
the headers and library objects respectively in your build location.
|
||||
the headers and library objects respectively in your build location. Note that
|
||||
doing an out-of-source build may cause issues when rebuilding later on.
|
||||
|
||||
Our cmake configure has a number of options, *cmake-gui* or *ccmake* can show
|
||||
you all the options. The interesting ones are detailed below:
|
||||
@ -61,7 +61,11 @@ Setting the python library to use:
|
||||
~~~~~~~~~~~~~
|
||||
Building doxygen doc
|
||||
~~~~~~~~~~~~~
|
||||
-BUILDDOC=ON
|
||||
-DBUILDDOC=ON
|
||||
~~~~~~~~~~~~~
|
||||
Build C++ example binaries
|
||||
~~~~~~~~~~~~~
|
||||
-DBUILDEXAMPLES=ON
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
If you intend to turn on all the options and build everything at once (C++,
|
||||
|
@ -4,15 +4,67 @@ Changelog {#changelog}
|
||||
Here's a list summarizing some of the key undergoing changes to our library
|
||||
from earlier versions:
|
||||
|
||||
### v0.4.1
|
||||
|
||||
* Over 150 supported sensor drivers including some industrial grade devices
|
||||
* Improved the JAVA bindings, added a large number of examples for sensors,
|
||||
enabled JAVA builds in Travis CI, and introduced automatic loading for the
|
||||
JAVA shared libraries
|
||||
* Continued to improve existing sensor drivers and to enhance them with the
|
||||
new C++ coding style and exception types
|
||||
* Several cmake improvements to allow building on various Linux distributions
|
||||
and with a newer version of Node.JS
|
||||
* Simplified adding and building of C++ sensor examples via cmake
|
||||
* New sensors: micsv89, xbee, urm37, adxrs610, bma220, dfrph, mcp9808, sx1276,
|
||||
groveultrasonic, ozw
|
||||
|
||||
### v0.4.0
|
||||
|
||||
* Fully functional and documented JAVA language bindings for sensors with
|
||||
several examples also available
|
||||
* Added standardized exception handling support across all language bindings
|
||||
and updated sensors to use this feature
|
||||
* Sensor drivers are now available and can be installed individually using NPM
|
||||
for Node.js users
|
||||
* Continuous Integration with Travis CI ensures new contributions are built
|
||||
automatically once they are received
|
||||
* API rewrite and improvements for hcsr04, sm130, eboled, loudness
|
||||
* Documentation improvements and code style changes from C to C++
|
||||
* New sensors: hyld9767, mg811, wheelencoder, grovegprs, mpu9250, ssd1306,
|
||||
es9257, lm35, mq4, mq6, mq7, mq8
|
||||
|
||||
### v0.3.2
|
||||
|
||||
* Introduced RPM package generation feature from cmake via cpack
|
||||
* Performed a thorough documentation review and merged resulting changes,
|
||||
includes last remaining images and grouping sensors by kits
|
||||
* Added support for Sparkfun Sensor Blocks (OLED & IMU)
|
||||
* Fully reworked API for at42qt1070, mpu9150 and lcd classes, while
|
||||
maintaining backwards compatibility for existing lcd displays.
|
||||
* Extended doxygen tags for better integration with automated documentation
|
||||
generators
|
||||
* New sensors: rgbringcoder, hp20x, pn532, sainsmartks, lsm9ds0, eboled
|
||||
|
||||
### v0.3.1
|
||||
|
||||
* Updated index pages for API documentation and cross-linked them
|
||||
* More images were added for Grove, Adafruit and Sparkfun sensors along with
|
||||
licensing information
|
||||
* Applied a set of patches to improve code robustness
|
||||
* Added support for Grove NFC Tag sensor
|
||||
* Fixed several typos in library and sensor names
|
||||
* New sensor: m24lr64e
|
||||
|
||||
### v0.3.0
|
||||
|
||||
* New CMake targets to build python and node documentation with Sphinx and
|
||||
Yuidoc
|
||||
* Provided automated, updated and comprehensive sensor API documentation for
|
||||
C++, Python and JavaScript
|
||||
* Edited sensor names, library descriptions and doxygen tags for consistency
|
||||
* Added support for several new sensors
|
||||
* Fixed the TH02 sensor driver and made major improvements to i2clcd driver
|
||||
* Updated and added new images for a lot of the existing sensors
|
||||
* Added this changelog
|
||||
* Added new and updated images for numerous new and existing sensors
|
||||
* Started this changelog
|
||||
* New sensors: sx6119, si114x, maxsonarez, hm11, ht9170, h3lis331dl, ad8232,
|
||||
grovescam
|
||||
|
||||
### v0.2.0
|
||||
|
||||
@ -23,6 +75,10 @@ from earlier versions:
|
||||
* Fixed the buzzer and servo drivers for the Intel Edison
|
||||
* Renamed bmp and gp2y sensor classes to be more generic
|
||||
* Completely revamped implementation for tm1637
|
||||
* New sensors: mma7660, cjq4435, adxl335, hmtrp, nunchuck, otp538u, l298,
|
||||
groveelectromagnet, grovecollision, adis16448, at42qt1070, grovemd, ina132,
|
||||
grovegsr, groveo2, groveemg, pca9685, pca9685ss, adafruitms1438, hx711, flex,
|
||||
groveeldriver, mhz16, apds9002, waterlevel, zfm20, uln200xa, grovewfs, isd1820
|
||||
|
||||
### v0.1.9
|
||||
|
||||
@ -31,6 +87,12 @@ from earlier versions:
|
||||
* Several examples and documentation updates submitted
|
||||
* Wrote new proper SWIG typemaps for arrays
|
||||
* Fixed the i2clcd write function, improved several other sensors
|
||||
* New sensors: rpr220, rotaryencoder, biss0001, rfr359f, grovespeaker, mq303a,
|
||||
ppd42ns, wt5001, yg1006, ublox6, mpr121, groveloudness, guvas12d, grovewater,
|
||||
grovevdiv, grovelinefinder, ta12200, groveehr, grovemoisture, gp2y0a, a110x,
|
||||
ds1307, adc121c021, enc03r, ttp223, itg3200, am2315, tp401, ldt0028, htu21d,
|
||||
mpl3115a2, lsm303, joystick12, tsl2561, groverotary, groveslider, adxl345,
|
||||
grovebutton, lol, groverelay
|
||||
|
||||
### v0.1.8
|
||||
|
||||
|
@ -28,6 +28,7 @@ Here's an example (disregard the "@verbatim" tags in your actual code):
|
||||
* @sensor <chip-id>
|
||||
* @comname <component-name>
|
||||
* @altname <alt-name>
|
||||
* @altid <alt-id>
|
||||
* @type <component-category>
|
||||
* @man <component-manufacturer>
|
||||
* @web <component-weblinks>
|
||||
@ -52,8 +53,8 @@ Here's an example (disregard the "@verbatim" tags in your actual code):
|
||||
available or relevant, use a unique descriptor that makes sense. *Mandatory*
|
||||
- `<component-name>` A short name for your sensor, can include manufacturer
|
||||
name. *Mandatory*
|
||||
- `<alt-name>` Alternative names or chip-ids that your sensor driver might
|
||||
have or support respectively. *Optional*
|
||||
- `<alt-name>` Alternative names that your sensor driver might have. *Optional*
|
||||
- `<alt-id>` Alternative chip-ids that your sensor driver supports. *Optional*
|
||||
- `<component-category>` Mention one or more categories the sensor fits in. Can
|
||||
be 'other'. *Mandatory*
|
||||
- `<component-manufacturer>` Sensor manufacturer. Can be 'generic'. *Mandatory*
|
||||
|
BIN
docs/icons/allides.png
Normal file
After Width: | Height: | Size: 37 KiB |
BIN
docs/icons/c++.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
docs/icons/eclipse.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
docs/icons/java.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
docs/icons/node.png
Normal file
After Width: | Height: | Size: 3.0 KiB |
BIN
docs/icons/python.png
Normal file
After Width: | Height: | Size: 2.5 KiB |
BIN
docs/icons/wyliodrin.png
Normal file
After Width: | Height: | Size: 23 KiB |
BIN
docs/icons/xdk.png
Normal file
After Width: | Height: | Size: 5.1 KiB |
361
docs/images/LICENSE_CC_3_0.txt
Normal file
@ -0,0 +1,361 @@
|
||||
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/.
|
||||
|
BIN
docs/images/ad8232.jpg
Executable file
After Width: | Height: | Size: 222 KiB |
BIN
docs/images/adxl335.jpg
Normal file
After Width: | Height: | Size: 29 KiB |
BIN
docs/images/apds9002.jpg
Executable file
After Width: | Height: | Size: 22 KiB |
BIN
docs/images/at42qt1070.jpg
Executable file
After Width: | Height: | Size: 178 KiB |
BIN
docs/images/ecs1030.jpg
Executable file
After Width: | Height: | Size: 69 KiB |
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 12 KiB |
BIN
docs/images/grovebutton.jpg
Executable file
After Width: | Height: | Size: 164 KiB |
BIN
docs/images/grovecircularled.jpg
Executable file
After Width: | Height: | Size: 52 KiB |
BIN
docs/images/groveled.jpg
Executable file
After Width: | Height: | Size: 138 KiB |
BIN
docs/images/grovelight.jpg
Executable file
After Width: | Height: | Size: 22 KiB |
BIN
docs/images/groverelay.jpg
Executable file
After Width: | Height: | Size: 18 KiB |
BIN
docs/images/grovescam.jpg
Executable file
After Width: | Height: | Size: 135 KiB |
BIN
docs/images/grovetemp.jpg
Executable file
After Width: | Height: | Size: 21 KiB |
BIN
docs/images/guvas12d.jpg
Executable file
After Width: | Height: | Size: 100 KiB |
BIN
docs/images/hp20x.jpg
Executable file
After Width: | Height: | Size: 929 KiB |
BIN
docs/images/ht9170.jpg
Normal file
After Width: | Height: | Size: 32 KiB |
BIN
docs/images/l298.jpg
Executable file
After Width: | Height: | Size: 169 KiB |
BIN
docs/images/lolshield.jpg
Normal file
After Width: | Height: | Size: 140 KiB |
BIN
docs/images/m24lr64e.jpg
Executable file
After Width: | Height: | Size: 24 KiB |
BIN
docs/images/maxsonarez.jpg
Executable file
After Width: | Height: | Size: 60 KiB |
BIN
docs/images/mcp9808.jpg
Normal file
After Width: | Height: | Size: 49 KiB |
BIN
docs/images/micsv89.jpg
Normal file
After Width: | Height: | Size: 44 KiB |
BIN
docs/images/rgbringcoder.jpg
Executable file
After Width: | Height: | Size: 87 KiB |
BIN
docs/images/sm130.jpg
Executable file
After Width: | Height: | Size: 114 KiB |
BIN
docs/images/ssd1306.jpeg
Normal file
After Width: | Height: | Size: 72 KiB |
@ -7,21 +7,28 @@ such sensors and known workarounds if they exist.
|
||||
|
||||
#### Grove Sensors
|
||||
|
||||
* **Grove I2C Touch Sensor** v1.3 is incompatible with the Intel Edison using
|
||||
the Arduino board, but will work with the Mini-breakout if supplied with at
|
||||
least 4V. Revision v1.2 works well on all Intel boards.
|
||||
* **Grove I2C Touch Sensor** (MPR121) v1.3 is incompatible with the Intel
|
||||
Edison using the Arduino board, but will work with the Mini-breakout if
|
||||
supplied with at least 4V. Revision v1.2 works well on all Intel boards.
|
||||
* **Grove Nunchuck** only works with the Intel Galileo boards and is unusable
|
||||
on the Intel Edison boards.
|
||||
* **Grove 3-Axis Digital Gyroscope** (ITG-3200) is not compatible with the
|
||||
Intel Edison Arduino board but will work with the Mini-breakout.
|
||||
* **Grove 3-Axis Digital Accelerometer** (ADXL345) only works with the Intel
|
||||
Edison Arduino board when powered from the 3.3V line.
|
||||
* **Grove 3-Axis Digital Compass** (HMC5883L) reports inaccurate values at 5V
|
||||
on the Intel Edison Arduino board and newer revisions might not work at all.
|
||||
Use 3.3V or the Mini-breakout.
|
||||
* **Grove 96x96 OLED Display** will not work on the Intel Edison with Arduino
|
||||
breakout.
|
||||
* **Grove 128x64 OLED Display** will not work on the Intel Edison with Arduino
|
||||
breakout.
|
||||
* **Grove Barometer** (BMP085) has an unstable connection on the Intel Edison
|
||||
using the Arduino breakout and does not run properly.
|
||||
using the Arduino breakout and may drop read data. The Xadow version of this
|
||||
sensor (BMP180) is also dropping data packets occasionally.
|
||||
* **Grove Digital Light Sensor** (TSL2561) occasionally drops I2C reads on the
|
||||
Intel Edison with the Arduino breakout. This might cause the sensor not to
|
||||
initialize properly. Works as expected with the Mini-breakout.
|
||||
* **Grove 6-Axis Accelerometer & Compass** (LSM303) fails to write to the
|
||||
configuration register properly and returns invalid data.
|
||||
* **Grove I2C ADC Converter** does not show up on the I2C bus on the Intel
|
||||
@ -30,7 +37,10 @@ such sensors and known workarounds if they exist.
|
||||
the inability to change the I2C bus speed to 100 KHz.
|
||||
* **Grove CO2 Sensor** will return zeroed data and is unusable on the Intel
|
||||
Galileo.
|
||||
* **Grove BLE** (HM-11) does not return data on the Intel Galileo board.
|
||||
* **Grove BLE** (HM-11) does not return data on the Intel Galileo board due to
|
||||
known UART limitation.
|
||||
* **Grove Hall Sensor** (A11X), if the base shield is set to 3V on Intel Edison,
|
||||
it will trigger continous callbacks when the sensor is not reading anything.
|
||||
|
||||
#### Adafruit Sensors
|
||||
|
||||
@ -39,13 +49,27 @@ such sensors and known workarounds if they exist.
|
||||
|
||||
#### Other Sensors
|
||||
|
||||
* **MPU9150** might return inaccurate data.
|
||||
* **NRF24L01** corrupted data packets are sent to the device due to the Intel
|
||||
Edison SPI bus limitation. Sensor works as expected with the Intel Galileo
|
||||
boards.
|
||||
* **NRF8001** based devices do not initialize properly with provided examples
|
||||
on Intel Edison boards also due to SPI bus limitation and data corruption.
|
||||
Works on Intel Galileo.
|
||||
|
||||
#### General
|
||||
|
||||
Some I2C sensors add too much capacitance to the SDA line of the Intel Edison
|
||||
Some *I2C* sensors add too much capacitance to the SDA line of the Intel Edison
|
||||
Arduino breakout board, thus the signal sticks to a logic 1. When this happens,
|
||||
other sensors connected to the I2C bus are unusable. While there is no generic
|
||||
solution for this limitation, in most cases the sensor works on the Intel
|
||||
Edison Mini-breakout. When this board is not an option, the sensor can be
|
||||
sometimes replaced with the same model from a different vendor.
|
||||
|
||||
The Intel Edison *SPI* bus can corrupt data being sent across when certain
|
||||
sensors are connected to it. Based on the sensor, this can affect functionality
|
||||
slightly or make the sensor entirely unusable. Unlike the I2C bus limitation,
|
||||
different boards are not likely to resolve this. A kernel update on the other
|
||||
hand might help alleviate this.
|
||||
|
||||
On the Intel Galileo boards, the *UART* bus might drop data if several bytes
|
||||
are read at once.
|
||||
|
@ -80,7 +80,7 @@ useful to us and converting it to a double.
|
||||
|
||||
Our final example, very easy to use API!
|
||||
|
||||
@snippet examples/max31855.cxx Interesting
|
||||
@snippet examples/c++/max31855.cxx Interesting
|
||||
|
||||
### Building
|
||||
|
||||
|
@ -26,8 +26,5 @@ sensor can inherit your class if they only have minor changes.
|
||||
### Doubt
|
||||
|
||||
If ever, give either of us a ping via email:
|
||||
mihai.tudor.panu@intel.com
|
||||
john.r.van.drasek@intel.com
|
||||
brendan.le.foll@intel.com
|
||||
mihai.tudor.panu@intel.com or brendan.le.foll@intel.com
|
||||
and we'll try suggest decent names for your module.
|
||||
|
||||
|
@ -236,6 +236,7 @@ ALIASES = library="@ingroup " \
|
||||
sensor="@li **ID:** " \
|
||||
comname="@li **Name:** " \
|
||||
altname="@li **Other Names:** " \
|
||||
altid="@li **Other Chips:** " \
|
||||
type="@li **Category:** " \
|
||||
man="@li **Manufacturer:** " \
|
||||
web="@li **Link:** " \
|
||||
@ -766,7 +767,7 @@ WARN_LOGFILE =
|
||||
INPUT = @CMAKE_CURRENT_SOURCE_DIR@/src/upm.h \
|
||||
@CMAKE_CURRENT_SOURCE_DIR@/src \
|
||||
@CMAKE_CURRENT_SOURCE_DIR@/docs \
|
||||
@CMAKE_CURRENT_SOURCE_DIR@/README.md
|
||||
@CMAKE_CURRENT_SOURCE_DIR@/doxy/README.cpp.md
|
||||
|
||||
# This tag can be used to specify the character encoding of the source files
|
||||
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
|
||||
@ -945,7 +946,7 @@ FILTER_SOURCE_PATTERNS =
|
||||
# (index.html). This can be useful if you have a project on for instance GitHub
|
||||
# and want to reuse the introduction page also for the doxygen output.
|
||||
|
||||
USE_MDFILE_AS_MAINPAGE = @CMAKE_CURRENT_SOURCE_DIR@/README.md
|
||||
USE_MDFILE_AS_MAINPAGE = @CMAKE_CURRENT_SOURCE_DIR@/doxy/README.cpp.md
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to source browsing
|
||||
|
2332
doxy/Doxyfile.java.in
Normal file
82
doxy/README.cpp.md
Normal file
@ -0,0 +1,82 @@
|
||||
UPM (Useful Packages & Modules) Sensor/Actuator repository for MRAA
|
||||
==============
|
||||
|
||||
UPM is a high level repository for sensors that use MRAA. Each sensor links
|
||||
to MRAA and are not meant to be interlinked although some groups of sensors
|
||||
may be. Each sensor contains a header which allows to interface with it.
|
||||
Typically a sensor is represented as a class and instantiated.
|
||||
|
||||
The constructor is expected to initialise the sensor and parameters may be used
|
||||
to provide identification/pin location on the board.
|
||||
|
||||
Typically an update() function will be called in order to get new data from the
|
||||
sensor in order to reduce load when doing multiple reads to sensor data.
|
||||
|
||||
### Example
|
||||
|
||||
A sensor/actuator is expected to work as such (here is the servo ES08A API):
|
||||
@snippet es08a.cxx Interesting
|
||||
|
||||
However implementation and API design is completely up to the developer, some
|
||||
enumerable sensors for example may provide much clever instantiation. Displays
|
||||
may also create more complex structures in order to interface with them.
|
||||
|
||||
Browse through the list of all [examples](https://github.com/intel-iot-devkit/upm/tree/master/examples/c%2B%2B).
|
||||
|
||||
Multi-sensor samples for the starter and specialized kits can be found in the
|
||||
[iot-devkit-samples](https://github.com/intel-iot-devkit/iot-devkit-samples) repository.
|
||||
|
||||
### Supported Sensors
|
||||
|
||||
Supported [sensor list](http://iotdk.intel.com/docs/master/upm/modules.html) from API documentation.
|
||||
|
||||
You can also refer to the [Intel® IoT Developer Zone](https://software.intel.com/iot/sensors).
|
||||
|
||||
### IDE Compatibility
|
||||
|
||||
If you would like to create Eclipse IDE projects using the UPM C++ samples,
|
||||
please follow the instructions provided on the Intel Developer Zone IDE page.
|
||||
|
||||
@htmlonly
|
||||
<a href="https://software.intel.com/iot/software/ide"><img src="docs/icons/eclipse.png"/></a>
|
||||
@endhtmlonly
|
||||
|
||||
### Building UPM
|
||||
|
||||
See @ref building here.
|
||||
|
||||
### Making your own UPM module
|
||||
|
||||
@ref porting link has more information on making new UPM modules.
|
||||
|
||||
There is also an example available for @ref max31855 sensor.
|
||||
|
||||
### Naming conventions and rules for new UPM contributions
|
||||
|
||||
Before you begin development, take a look at our @ref naming conventions.
|
||||
|
||||
Also, please read the guidelines for @ref contributions to UPM.
|
||||
|
||||
Don't forget to check the @ref documentation section.
|
||||
|
||||
Make sure you add yourself as an author on every new code file submitted.
|
||||
If you are providing a fix with significant changes, feel free to add yourself
|
||||
as a contributor. Signing-off your commits is mandatory.
|
||||
|
||||
API Documentation
|
||||
==============
|
||||
|
||||
@htmlonly
|
||||
|
||||
<a href="http://iotdk.intel.com/docs/master/upm"><img src="docs/icons/c++.png"/></a>
|
||||
<a href="http://iotdk.intel.com/docs/master/upm/java"><img src="docs/icons/java.png"/></a>
|
||||
<a href="http://iotdk.intel.com/docs/master/upm/python"><img src="docs/icons/python.png"/></a>
|
||||
<a href="http://iotdk.intel.com/docs/master/upm/node"><img src="docs/icons/node.png"/></a>
|
||||
|
||||
@endhtmlonly
|
||||
|
||||
### Changelog
|
||||
Version @ref changelog here.
|
||||
|
||||
### Known Limitations
|
||||
List of @ref knownlimitations here.
|
81
doxy/README.java.md
Normal file
@ -0,0 +1,81 @@
|
||||
UPM (Useful Packages & Modules) Sensor/Actuator repository for MRAA
|
||||
|
||||
UPM is a high level repository for sensors that use MRAA. Each sensor links
|
||||
to MRAA and are not meant to be interlinked although some groups of sensors
|
||||
may be. Each sensor contains a header which allows to interface with it.
|
||||
Typically a sensor is represented as a class and instantiated.
|
||||
|
||||
The constructor is expected to initialise the sensor and parameters may be used
|
||||
to provide identification/pin location on the board.
|
||||
|
||||
Typically an update() function will be called in order to get new data from the
|
||||
sensor in order to reduce load when doing multiple reads to sensor data.
|
||||
|
||||
### Example
|
||||
|
||||
A sensor/actuator is expected to work as such (here is the servo ES08A API):
|
||||
@snippet ES08ASample.java Interesting
|
||||
|
||||
However implementation and API design is completely up to the developer, some
|
||||
enumerable sensors for example may provide much clever instantiation. Displays
|
||||
may also create more complex structures in order to interface with them.
|
||||
|
||||
Browse through the list of all [examples](https://github.com/intel-iot-devkit/upm/tree/master/examples/java).
|
||||
|
||||
Multi-sensor samples for the starter and specialized kits can be found in the
|
||||
[iot-devkit-samples](https://github.com/intel-iot-devkit/iot-devkit-samples) repository.
|
||||
|
||||
### Supported Sensors
|
||||
|
||||
Supported [sensor list](http://iotdk.intel.com/docs/master/upm/java/modules.html) from API documentation.
|
||||
|
||||
You can also refer to the [Intel® IoT Developer Zone](https://software.intel.com/iot/sensors).
|
||||
|
||||
### IDE Compatibility
|
||||
|
||||
If you would like to create Eclipse IDE projects using the UPM Java samples,
|
||||
please follow the instructions provided on the Intel Developer Zone IDE page.
|
||||
|
||||
@htmlonly
|
||||
<a href="https://software.intel.com/iot/software/ide"><img src="../docs/icons/eclipse.png"/></a>
|
||||
@endhtmlonly
|
||||
|
||||
### Building UPM
|
||||
|
||||
See @ref building here.
|
||||
|
||||
### Making your own UPM module
|
||||
|
||||
@ref porting link has more information on making new UPM modules.
|
||||
|
||||
There is also an example available for @ref max31855 sensor.
|
||||
|
||||
### Naming conventions and rules for new UPM contributions
|
||||
|
||||
Before you begin development, take a look at our @ref naming conventions.
|
||||
|
||||
Also, please read the guidelines for @ref contributions to UPM.
|
||||
|
||||
Don't forget to check the @ref documentation section.
|
||||
|
||||
Make sure you add yourself as an author on every new code file submitted.
|
||||
If you are providing a fix with significant changes, feel free to add yourself
|
||||
as a contributor. Signing-off your commits is mandatory.
|
||||
|
||||
API Documentation
|
||||
==============
|
||||
|
||||
@htmlonly
|
||||
|
||||
<a href="http://iotdk.intel.com/docs/master/upm"><img src="../docs/icons/c++.png"/></a>
|
||||
<a href="http://iotdk.intel.com/docs/master/upm/java"><img src="../docs/icons/java.png"/></a>
|
||||
<a href="http://iotdk.intel.com/docs/master/upm/python"><img src="../docs/icons/python.png"/></a>
|
||||
<a href="http://iotdk.intel.com/docs/master/upm/node"><img src="../docs/icons/node.png"/></a>
|
||||
|
||||
@endhtmlonly
|
||||
|
||||
### Changelog
|
||||
Version @ref changelog here.
|
||||
|
||||
### Known Limitations
|
||||
List of @ref knownlimitations here.
|
@ -3,7 +3,7 @@
|
||||
You can adapt this file completely to your liking, but it should at least
|
||||
contain the root `toctree` directive.
|
||||
|
||||
**Welcome to UPM Python documentation!**
|
||||
**Welcome to UPM Python Documentation!**
|
||||
=========================================
|
||||
|
||||
.. include:: ../../README.md
|
||||
@ -14,7 +14,24 @@
|
||||
################
|
||||
|
||||
For building UPM, please follow this `link <https://github.com/intel-iot-devkit/upm/blob/master/docs/building.md>`_.
|
||||
|
||||
|
||||
``Examples``
|
||||
############
|
||||
|
||||
Multi-sensor samples for the starter and specialized kits can be found in the `iot-devkit-samples <https://github.com/intel-iot-devkit/iot-devkit-samples>`_
|
||||
repository.
|
||||
|
||||
Individual sensor usage examples for Python are available `here <https://github.com/intel-iot-devkit/upm/tree/master/examples/python>`_.
|
||||
|
||||
``IDE Compatibility``
|
||||
################
|
||||
|
||||
While there is no official IDE provided with our Python libraries, we do recommend the web-based IDE Wyliodrin. It can be used with multiple programming
|
||||
languages, including Python. More information can be found on the Intel Developer Zone IDE page.
|
||||
|
||||
.. image:: ../docs/icons/wyliodrin.png
|
||||
:target: https://software.intel.com/iot/software/ide
|
||||
|
||||
``Making your own UPM Module``
|
||||
##############################
|
||||
|
||||
@ -22,7 +39,7 @@ This `link <https://github.com/intel-iot-devkit/upm/blob/master/docs/porting.md
|
||||
|
||||
There is also an example available for max31855 `sensor <https://github.com/intel-iot-devkit/upm/blob/master/docs/max31855.md>`_.
|
||||
|
||||
``Naming Conventions and rules for new UPM Contributions``
|
||||
``Naming Conventions and Rules for New UPM Contributions``
|
||||
##########################################################
|
||||
|
||||
Before you begin development, please take a look at our naming `conventions <https://github.com/intel-iot-devkit/upm/blob/master/docs/naming.md>`_.
|
||||
@ -33,32 +50,41 @@ Don't forget to check the documentation `section <https://github.com/intel-iot-d
|
||||
|
||||
.. note::
|
||||
|
||||
* Make sure you add yourself as an author on every new code file submitted.
|
||||
* If you are providing a fix with significant changes, feel free to add yourself as a contributor.
|
||||
* Make sure you add yourself as an author on every new code file submitted.
|
||||
* If you are providing a fix with significant changes, feel free to add yourself as a contributor.
|
||||
* Signing-off your commits is mandatory.
|
||||
|
||||
``List of available sensors drivers``
|
||||
``List of Available Sensors Drivers``
|
||||
######################################
|
||||
|
||||
Click on the library prefix below to expand the full list of sensors:
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
:maxdepth: 1
|
||||
|
||||
modules
|
||||
|
||||
``C/C++ API Documentation``
|
||||
``Other API Documentation``
|
||||
###########################
|
||||
|
||||
The C/C++ API documentation is available `here <http://iotdk.intel.com/docs/master/upm/>`_.
|
||||
.. image:: ../docs/icons/c++.png
|
||||
:target: http://iotdk.intel.com/docs/master/upm
|
||||
.. image:: ../docs/icons/java.png
|
||||
:target: http://iotdk.intel.com/docs/master/upm/java
|
||||
.. image:: ../docs/icons/python.png
|
||||
:target: http://iotdk.intel.com/docs/master/upm/python
|
||||
.. image:: ../docs/icons/node.png
|
||||
:target: http://iotdk.intel.com/docs/master/upm/node
|
||||
|
||||
``Version``
|
||||
###########
|
||||
``Version Changelog``
|
||||
#####################
|
||||
|
||||
For Version Changelog, please see `here <https://github.com/intel-iot-devkit/upm/blob/master/docs/changelog.md>`_.
|
||||
For our Version Changelog, please see `here <https://github.com/intel-iot-devkit/upm/blob/master/docs/changelog.md>`_.
|
||||
|
||||
``Limitations and List of Changes``
|
||||
``Known Limitations``
|
||||
###################################
|
||||
|
||||
For List of Known Limitations, please see `here <https://github.com/intel-iot-devkit/upm/blob/master/docs/knownlimitations.md>`_.
|
||||
For the List of Known Limitations, please see `here <https://github.com/intel-iot-devkit/upm/blob/master/docs/knownlimitations.md>`_.
|
||||
|
||||
``Indices and tables``
|
||||
######################
|
||||
|
@ -43,20 +43,17 @@ opts
|
||||
|
||||
// use promise-style programming rather than spaghetti callbacks
|
||||
Promise.promisifyAll(fs);
|
||||
|
||||
|
||||
// TODO: create directory structure if doesn't exist
|
||||
var formats = opts.formats.split(',');
|
||||
formats.forEach(function(format){
|
||||
mkdirp('jsdoc/' + format + '/' + opts.module);
|
||||
});
|
||||
Promise.promisifyAll(mkdirp);
|
||||
|
||||
|
||||
// main
|
||||
xml2js.parse().then(function(specjs) {
|
||||
var formats = opts.formats.split(',');
|
||||
Promise.all(_.map(formats, function(format) {
|
||||
var generateDocs = require(__dirname + '/generators/' + format + '/generator');
|
||||
var outFile = opts.outdir + '/' + format + '/' + specjs.MODULE + '/doc.js';
|
||||
return fs.writeFileAsync(outFile, generateDocs(specjs));
|
||||
var dir = opts.outdir + '/' + format + '/' + specjs.MODULE;
|
||||
return mkdirp.mkdirpAsync(dir).then(function() {
|
||||
return fs.writeFileAsync(dir + '/doc.js', generateDocs(specjs));
|
||||
});
|
||||
}));
|
||||
});
|
||||
|
@ -58,6 +58,7 @@ function GENERATE_MODULE(module) {
|
||||
|
||||
// generate method spec with parent module/class
|
||||
function GENERATE_METHOD(name, spec, parent) {
|
||||
name = name.replace(/!+$/, '');
|
||||
return GENERATE_DOC(spec.description + '\n'
|
||||
+ '@method ' + name + '\n'
|
||||
+ '@instance\n'
|
||||
|
@ -28,44 +28,66 @@ var _ = require('lodash');
|
||||
|
||||
// generate json for ternjs input
|
||||
function generateDocs(specjs) {
|
||||
var docs = GENERATE_MODULE(specjs.MODULE);
|
||||
GENERATE_TYPE = (function(enums) {
|
||||
return function(type) {
|
||||
return (_.contains(enums, type) ? ('Enum ' + type) : type);
|
||||
}
|
||||
})(_.keys(specjs.ENUMS_BY_GROUP));
|
||||
var docs = { '!name': specjs.MODULE + 'library' };
|
||||
_.extend(docs, GENERATE_MODULE(specjs.MODULE));
|
||||
_.each(specjs.ENUMS, function(enumSpec, enumName) {
|
||||
_.extend(docs[specjs.MODULE], GENERATE_ENUM(enumName, enumSpec));
|
||||
});
|
||||
_.each(specjs.METHODS, function(methodSpec, methodName) {
|
||||
_.extend(docs[specjs.MODULE], GENERATE_METHOD(methodName, methodSpec));
|
||||
});
|
||||
_.each(specjs.CLASSES, function(classSpec, parentClass) {
|
||||
var constructor = classSpec.methods[parentClass];
|
||||
_.extend(docs[specjs.MODULE], GENERATE_METHOD(parentClass, constructor ? constructor : { params: {}, return: {}, description: '' } ));
|
||||
_.each(classSpec.enums, function(enumSpec, enumName) {
|
||||
_.extend(docs[specjs.MODULE][parentClass], GENERATE_ENUM(enumName, enumSpec));
|
||||
|
||||
if (_.isEmpty(specjs.CLASSGROUPS)) {
|
||||
_.extend(docs[specjs.MODULE], GENERATE_CLASSES(specjs.CLASSES));
|
||||
} else {
|
||||
var grouped = _.flatten(_.pluck(_.values(specjs.CLASSGROUPS), 'classes'));
|
||||
var ungrouped = _.difference(_.keys(specjs.CLASSES), grouped);
|
||||
_.extend(docs[specjs.MODULE], GENERATE_CLASSES(_.pick(specjs.CLASSES, ungrouped)));
|
||||
_.each(specjs.CLASSGROUPS, function(groupSpec, groupName) {
|
||||
_.extend(docs, GENERATE_MODULE(groupName));
|
||||
_.extend(docs[groupName], GENERATE_CLASSES(_.pick(specjs.CLASSES, groupSpec.classes), groupName));
|
||||
});
|
||||
docs[specjs.MODULE][parentClass].prototype = {};
|
||||
_.each(_.omit(classSpec.methods, parentClass), function(methodSpec, methodName) {
|
||||
_.extend(docs[specjs.MODULE][parentClass].prototype, GENERATE_METHOD(methodName, methodSpec));
|
||||
});
|
||||
_.each(classSpec.variables, function(variableSpec, variableName) {
|
||||
_.extend(docs[specjs.MODULE][parentClass].prototype, GENERATE_VARIABLE(variableName, variableSpec));
|
||||
});
|
||||
});
|
||||
}
|
||||
return JSON.stringify(docs, null, 2);
|
||||
}
|
||||
|
||||
|
||||
// generate module spec
|
||||
function GENERATE_MODULE(module) {
|
||||
var docs = { '!name': module + 'library' };
|
||||
var docs = {};
|
||||
docs[module] = {};
|
||||
return docs;
|
||||
}
|
||||
|
||||
|
||||
// generate the spec for the given list of classes
|
||||
function GENERATE_CLASSES(classes) {
|
||||
var docs = {};
|
||||
_.each(classes, function(classSpec, parentClass) {
|
||||
var constructor = classSpec.methods[parentClass];
|
||||
_.extend(docs, GENERATE_METHOD(parentClass, constructor ? constructor : { params: {}, return: {}, description: '' } ));
|
||||
if (_.has(docs, parentClass)) {
|
||||
_.each(classSpec.enums, function(enumSpec, enumName) {
|
||||
_.extend(docs[parentClass], GENERATE_ENUM(enumName, enumSpec));
|
||||
});
|
||||
docs[parentClass].prototype = {};
|
||||
_.each(_.omit(classSpec.methods, parentClass), function(methodSpec, methodName) {
|
||||
_.extend(docs[parentClass].prototype, GENERATE_METHOD(methodName, methodSpec));
|
||||
});
|
||||
_.each(classSpec.variables, function(variableSpec, variableName) {
|
||||
_.extend(docs[parentClass].prototype, GENERATE_VARIABLE(variableName, variableSpec));
|
||||
});
|
||||
}
|
||||
});
|
||||
return docs;
|
||||
}
|
||||
|
||||
|
||||
// generate method spec
|
||||
function GENERATE_METHOD(name, spec) {
|
||||
var doc = {};
|
||||
|
14
doxy/node/generators/yuidoc/generator.js
vendored
@ -46,7 +46,7 @@ function generateDocs(specjs) {
|
||||
docs += GENERATE_MODULE('common', '');
|
||||
var grouped = _.flatten(_.pluck(_.values(specjs.CLASSGROUPS), 'classes'));
|
||||
var ungrouped = _.difference(_.keys(specjs.CLASSES), grouped);
|
||||
docs += GENERATE_CLASSES(_.pick(specjs.CLASSES, ungrouped), 'common');
|
||||
docs += GENERATE_CLASSES(_.pick(specjs.CLASSES, ungrouped), 'common');
|
||||
_.each(specjs.CLASSGROUPS, function(groupSpec, groupName) {
|
||||
docs += GENERATE_CLASSES(_.pick(specjs.CLASSES, groupSpec.classes), groupName);
|
||||
});
|
||||
@ -76,7 +76,7 @@ function GENERATE_MODULE(name, description) {
|
||||
function GENERATE_CLASSES(classes, parent) {
|
||||
return _.reduce(classes, function(memo, classSpec, className) {
|
||||
return memo
|
||||
+ GENERATE_CLASS(className, classSpec.description, parent)
|
||||
+ GENERATE_CLASS(className, classSpec.description, parent, classSpec.parent)
|
||||
+ _.reduce(classSpec.methods, function(memo, methodSpec, methodName) {
|
||||
return memo += GENERATE_METHOD(methodName, methodSpec, className);
|
||||
}, '')
|
||||
@ -91,15 +91,21 @@ function GENERATE_CLASSES(classes, parent) {
|
||||
|
||||
|
||||
// generate class spec
|
||||
function GENERATE_CLASS(name, description, parent) {
|
||||
function GENERATE_CLASS(name, description, namespace, parent) {
|
||||
return GENERATE_DOC(description + '\n'
|
||||
+ '@class ' + name + '\n'
|
||||
+ (parent ? ('@module ' + parent + '\n') : ''));
|
||||
+ (namespace ? ('@module ' + namespace + '\n') : '')
|
||||
/*
|
||||
TODO: leave out until figure out what swig does with inheritance
|
||||
+ (parent ? ('@extends ' + parent + '\n') : '')
|
||||
*/
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// generate method spec with parent module/class
|
||||
function GENERATE_METHOD(name, spec, parent) {
|
||||
name = name.replace(/!+$/, '');
|
||||
return GENERATE_DOC(spec.description + '\n'
|
||||
+ '@method ' + name + '\n'
|
||||
+ (parent ? ('@for ' + parent + '\n') : '@for common\n')
|
||||
|
10
doxy/node/generators/yuidoc/helper.js
vendored
@ -77,17 +77,15 @@ function listByGroup(modules, classes, field, projectRoot) {
|
||||
var groups = Object.keys(modulesByGroup).sort();
|
||||
var html = '';
|
||||
var pfx = projectRoot + 'modules/';
|
||||
var first = true;
|
||||
for (i = 0; i < groups.length; i++) {
|
||||
var group = groups[i];
|
||||
html += (first ? '' : '</span>');
|
||||
html += '<div class="upmGroup"><div class="right-arrow"></div>' + group + '</div><span class="upmModules" style="display:none">';
|
||||
var moduleNames = modulesByGroup[group];
|
||||
for (j = 0; j < moduleNames.length; j++) {
|
||||
var moduleName = moduleNames[j];
|
||||
html += '<a href="' + pfx + moduleName + '.html">' + moduleName + '</a>';
|
||||
}
|
||||
first = false;
|
||||
html += '</span>';
|
||||
}
|
||||
return html;
|
||||
}
|
||||
@ -117,7 +115,7 @@ var insertStyles = "Y.one(document.head).append('<style> \
|
||||
font-size: 0; \
|
||||
margin-right: 5px; \
|
||||
vertical-align: 5px; \
|
||||
display: inline; \
|
||||
float: left; \
|
||||
} \
|
||||
div.down-arrow { \
|
||||
width: 0; \
|
||||
@ -127,7 +125,7 @@ var insertStyles = "Y.one(document.head).append('<style> \
|
||||
border-top: 5px solid #356de4; \
|
||||
font-size: 0; \
|
||||
margin-right: 5px; \
|
||||
display: inline; \
|
||||
float: left; \
|
||||
} \
|
||||
div.upmGroup { \
|
||||
font-weight: bold; \
|
||||
@ -137,7 +135,7 @@ var insertStyles = "Y.one(document.head).append('<style> \
|
||||
|
||||
var scripts = "YUI().use('node', 'event', function (Y) {"
|
||||
+ onClickHandler
|
||||
+ insertStyles
|
||||
// + insertStyles
|
||||
+ "});";
|
||||
|
||||
|
||||
|
@ -311,13 +311,13 @@ abbr {
|
||||
cursor: help;
|
||||
}
|
||||
|
||||
.prettyprint li.L0,
|
||||
.prettyprint li.L1,
|
||||
.prettyprint li.L2,
|
||||
.prettyprint li.L3,
|
||||
.prettyprint li.L5,
|
||||
.prettyprint li.L6,
|
||||
.prettyprint li.L7,
|
||||
.prettyprint li.L0,
|
||||
.prettyprint li.L1,
|
||||
.prettyprint li.L2,
|
||||
.prettyprint li.L3,
|
||||
.prettyprint li.L5,
|
||||
.prettyprint li.L6,
|
||||
.prettyprint li.L7,
|
||||
.prettyprint li.L8 {
|
||||
list-style: decimal;
|
||||
}
|
||||
@ -357,7 +357,7 @@ ul li p {
|
||||
#hd img {
|
||||
margin-right: 10px;
|
||||
vertical-align: middle;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -787,3 +787,28 @@ kbd .cmd { font-family: Monaco, Helvetica; }
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
div.right-arrow {
|
||||
width: 0;
|
||||
height: 0;
|
||||
border-bottom: 5px solid transparent;
|
||||
border-top: 5px solid transparent;
|
||||
border-left: 5px solid #356de4;
|
||||
font-size: 0;
|
||||
margin-right: 5px;
|
||||
float: left;
|
||||
}
|
||||
|
||||
div.down-arrow {
|
||||
width: 0;
|
||||
height: 0;
|
||||
border-left: 5px solid transparent;
|
||||
border-right: 5px solid transparent;
|
||||
border-top: 5px solid #356de4;
|
||||
font-size: 0;
|
||||
margin-right: 5px;
|
||||
float: left;
|
||||
}
|
||||
|
||||
div.upmGroup {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
@ -17,6 +17,8 @@
|
||||
<h1>UPM</h1>
|
||||
<p>
|
||||
The UPM API is a high level sensor library for IoT devices using MRAA. See examples <a href="https://github.com/intel-iot-devkit/upm/tree/master/examples/javascript">here</a>.
|
||||
Back to <a href="http://iotdk.intel.com/docs/master/upm/node/"> index </a> page.
|
||||
<br><em>SparkFun sensor images provided under <a href=https://creativecommons.org/licenses/by-nc-sa/3.0/>CC BY-NC-SA-3.0</a>.</em>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
180
doxy/node/generators/yuidoc/tmpl/partials/index.handlebars
Normal file
@ -0,0 +1,180 @@
|
||||
<div class="apidocs">
|
||||
<div class="content" id="docs-main">
|
||||
<h1><strong>Welcome to UPM Node.JS Documentation!</strong><a class="headerlink"
|
||||
href="#welcome-to-upm-python-documentation"></a></h1>
|
||||
|
||||
|
||||
<p>Browse to a module or class using the sidebar to view its API
|
||||
documentation.</p>
|
||||
|
||||
<p>UPM is a high level repository for sensors that use MRAA. Each
|
||||
sensor links to MRAA and are not meant to be interlinked although
|
||||
some groups of sensors may be. Each sensor contains a header which
|
||||
allows to interface with it. Typically a sensor is represented as a
|
||||
class and instantiated.</p>
|
||||
|
||||
<p>The constructor is expected to initialise the sensor and parameters
|
||||
may be used to provide identification/pin location on the board.</p>
|
||||
|
||||
<p>Typically an update() function will be called in order to get new
|
||||
data from the sensor in order to reduce load when doing multiple reads
|
||||
to sensor data.</p>
|
||||
<div class="section" id="examples">
|
||||
<h3><code class="docutils literal"><span class="pre">Examples</span></code><a class="headerlink"
|
||||
href="#examples"
|
||||
title="Permalink to this headline">*</a></h3>
|
||||
|
||||
|
||||
<p>Multi-sensor samples for the starter and specialized kits can be
|
||||
found in the
|
||||
<a class="reference external"
|
||||
href="https://github.com/intel-iot-devkit/iot-devkit-samples">iot-devkit-samples</a>
|
||||
repository.</p>
|
||||
|
||||
<p>Individual sensor usage examples for node.js are available
|
||||
<a class="reference external"
|
||||
href="https://github.com/intel-iot-devkit/upm/tree/master/examples/javascript">here</a>.</p>
|
||||
|
||||
</div>
|
||||
<div class="section" id="ide">
|
||||
<h3><tt class="docutils literal"><span class="pre">IDE Compatibility</span>
|
||||
<span class="pre">UPM</span></tt><a class="headerlink"
|
||||
href="#ide"
|
||||
title="Permalink to this headline">*</a></h3>
|
||||
|
||||
|
||||
<p>Intel® 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">
|
||||
<h3><tt class="docutils literal"><span class="pre">Building</span>
|
||||
<span class="pre">UPM</span></tt><a class="headerlink"
|
||||
href="#building-upm"
|
||||
title="Permalink to this headline">*</a></h3>
|
||||
|
||||
|
||||
<p>For building UPM, please follow this
|
||||
<a class="reference external"
|
||||
href="https://github.com/intel-iot-devkit/upm/blob/master/docs/building.md">link</a>.</p>
|
||||
|
||||
</div>
|
||||
<div class="section" id="making-your-own-upm-module">
|
||||
<h3><tt class="docutils literal"><span class="pre">Making</span>
|
||||
<span class="pre">your</span> <span class="pre">own</span>
|
||||
<span class="pre">UPM</span> <span class="pre">Module</span></tt><a class="headerlink"
|
||||
href="#making-your-own-upm-module"
|
||||
title="Permalink to this headline">*</a></h3>
|
||||
|
||||
|
||||
<p>This
|
||||
<a class="reference external"
|
||||
href="https://github.com/intel-iot-devkit/upm/blob/master/docs/porting.md">link</a>
|
||||
has more information on making a new UPM module.</p>
|
||||
|
||||
<p>There is also an example available for max31855
|
||||
<a class="reference external"
|
||||
href="https://github.com/intel-iot-devkit/upm/blob/master/docs/max31855.md">sensor</a>.</p>
|
||||
|
||||
</div>
|
||||
<div class="section"
|
||||
id="naming-conventions-and-rules-for-new-upm-contributions">
|
||||
<h3><tt class="docutils literal"><span class="pre">Naming</span>
|
||||
<span class="pre">Conventions</span> <span class="pre">and</span>
|
||||
<span class="pre">Rules</span> <span class="pre">for</span>
|
||||
<span class="pre">New</span> <span class="pre">UPM</span>
|
||||
<span class="pre">Contributions</span></tt><a class="headerlink"
|
||||
href="#naming-conventions-and-rules-for-new-upm-contributions"
|
||||
title="Permalink to this headline">*</a></h3>
|
||||
|
||||
|
||||
<p>Before you begin development, please take a look at our naming
|
||||
<a class="reference external"
|
||||
href="https://github.com/intel-iot-devkit/upm/blob/master/docs/naming.md">conventions</a>.</p>
|
||||
|
||||
|
||||
<p>Also, please read the guidelines for contributions to
|
||||
<a class="reference external"
|
||||
href="https://github.com/intel-iot-devkit/upm/blob/master/docs/contributions.md">UPM</a>.</p>
|
||||
|
||||
|
||||
<p>Don’t forget to check the documentation
|
||||
<a class="reference external"
|
||||
href="https://github.com/intel-iot-devkit/upm/blob/master/docs/documentation.md">section</a>.</p>
|
||||
|
||||
<div class="admonition note">
|
||||
|
||||
<p class="first admonition-title">Note</p>
|
||||
<ul class="last simple">
|
||||
<li>Make sure you add yourself as an author on every new code
|
||||
file submitted.</li>
|
||||
<li>If you are providing a fix with significant changes, feel
|
||||
free to add yourself as a contributor.</li>
|
||||
<li>Signing-off your commits is mandatory.</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="api-documentation">
|
||||
<h1><strong>Other API Documentation</strong><a class="headerlink"
|
||||
href="#api-documentation"
|
||||
title="Permalink to this headline"></a></h1>
|
||||
|
||||
|
||||
<p><a href="http://iotdk.intel.com/docs/master/upm"><img src="../docs/icons/c++.png" /></a>
|
||||
<a href="http://iotdk.intel.com/docs/master/upm/java"><img src="../docs/icons/java.png" /></a>
|
||||
<a href="http://iotdk.intel.com/docs/master/upm/python"><img src="../docs/icons/python.png" /></a>
|
||||
<a href="http://iotdk.intel.com/docs/master/upm/node"><img src="../docs/icons/node.png" /></a>
|
||||
</p>
|
||||
</div>
|
||||
<div class="section" id="version-changelog">
|
||||
<h3><tt class="docutils literal"><span class="pre">Version</span>
|
||||
<span class="pre">Changelog</span></tt><a class="headerlink"
|
||||
href="#version-changelog"
|
||||
title="Permalink to this headline">*</a></h3>
|
||||
|
||||
|
||||
<p>For our Version Changelog, please see
|
||||
<a class="reference external"
|
||||
href="https://github.com/intel-iot-devkit/upm/blob/master/docs/changelog.md">here</a>.</p>
|
||||
|
||||
</div>
|
||||
<div class="section" id="known-limitations">
|
||||
<h3><tt class="docutils literal"><span class="pre">Known</span>
|
||||
<span class="pre">Limitations</span></tt><a class="headerlink"
|
||||
href="#known-limitations"
|
||||
title="Permalink to this headline">*</a></h3>
|
||||
|
||||
|
||||
<p>For the List of Known Limitations, please see
|
||||
<a class="reference external"
|
||||
href="https://github.com/intel-iot-devkit/upm/blob/master/docs/knownlimitations.md">here</a>.</p>
|
||||
|
||||
</div>
|
||||
<div class="section" id="keyboard-shortcuts">
|
||||
<h3><tt class="docutils literal"><span class="pre">Keyboard</span>
|
||||
<span class="pre">Shortcuts</span></tt><a class="headerlink"
|
||||
href="#keyboard-shortcuts"
|
||||
title="Permalink to this headline">*</a></h3>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
<p>Press <kbd>s</kbd> to focus the API search box.</p> </li>
|
||||
<li>
|
||||
|
||||
<p>Use <kbd>Up</kbd> and <kbd>Down</kbd> to select classes,
|
||||
modules, and search results.</p> </li>
|
||||
<li class="mac-only">
|
||||
|
||||
<p>With the API search box or sidebar focused, use <kbd><span class="cmd">⌘</span>-Left</kbd>
|
||||
or <kbd><span class="cmd">⌘</span>-Right</kbd> to switch
|
||||
sidebar tabs.</p> </li>
|
||||
<li class="pc-only">
|
||||
|
||||
<p>With the API search box or sidebar focused, use <kbd>Ctrl+Left</kbd>
|
||||
and <kbd>Ctrl+Right</kbd> to switch sidebar tabs.</p> </li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
@ -69,6 +69,8 @@ var xml2js = {
|
||||
// CLASSES: {
|
||||
// <class name>: {
|
||||
// description: <class description>,
|
||||
// parent: <parent class name>,
|
||||
// group: <group name>,
|
||||
// methods: { ... },
|
||||
// variables: {
|
||||
// <variable name>: {
|
||||
@ -83,7 +85,9 @@ var xml2js = {
|
||||
// CLASSGROUPS: {
|
||||
// <group name>: {
|
||||
// description: <group description>,
|
||||
// classes: [ <class name>, ... ]
|
||||
// classes: [ <class name>, ... ],
|
||||
// enums: { ... },
|
||||
// enums_by_group: { ... }
|
||||
// }, ...
|
||||
// }
|
||||
MODULE: '',
|
||||
@ -98,7 +102,8 @@ var xml2js = {
|
||||
TYPEMAPS: {
|
||||
'^(const)?\\s*(unsigned|signed)?\\s*(int|short|long|float|double|size_t|u?int\\d{1,2}_t)?$': 'Number',
|
||||
'^bool$': 'Boolean',
|
||||
'^(const)?\\s*(unsigned|signed)?\\s*(char|char\\s*\\*|std::string)$': 'String' // TODO: verify that swig does this mapping
|
||||
'^(const)?\\s*(unsigned|signed)?\\s*(char|char\\s*\\*|std::string)$': 'String', // TODO: verify that swig does this mapping
|
||||
'^void\\s*\\(\\s*\\*\\s*\\)\\s*\\(\\s*void\\s*\\*\\)\\s*$': 'Function'
|
||||
},
|
||||
|
||||
|
||||
@ -157,13 +162,14 @@ var xml2js = {
|
||||
try {
|
||||
var spec_c = xmlparser.parse(xml)[0];
|
||||
var className = getName(spec_c);
|
||||
xml2js.CLASSES[className] = {
|
||||
_.extend(xml2js.CLASSES[className], {
|
||||
description: getDescription(spec_c),
|
||||
parent: getParent(spec_c, className),
|
||||
enums: getEnums(spec_c, false, className),
|
||||
enums_by_group: getEnums(spec_c, true, className),
|
||||
variables: getVariables(spec_c, className),
|
||||
methods: getMethods(spec_c, className)
|
||||
};
|
||||
});
|
||||
} catch(e) {
|
||||
console.log(e.toString() + ': class ' + className + ' was not parsed correctly.');
|
||||
}
|
||||
@ -177,15 +183,48 @@ var xml2js = {
|
||||
return fs.readFileAsync(xml2js.opts.inputdir + '/' + fn, 'utf8').then(function(xml) {
|
||||
var spec_c = xmlparser.parse(xml)[0];
|
||||
if (_.isEmpty(getSubmodules(spec_c))) {
|
||||
xml2js.CLASSGROUPS[getName(spec_c)] = {
|
||||
var group = getName(spec_c);
|
||||
var classes = getSubclassNames(spec_c);
|
||||
xml2js.CLASSGROUPS[group] = {
|
||||
description: getDescription(spec_c),
|
||||
classes: getSubclassNames(spec_c)
|
||||
}
|
||||
classes: classes
|
||||
};
|
||||
_.each(classes, function(c) {
|
||||
if (_.has(xml2js.CLASSES, c)) {
|
||||
xml2js.CLASSES[c].group = group;
|
||||
} else {
|
||||
console.log('Warning: Group ' + group + ' has unknown class ' + c);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}));
|
||||
});
|
||||
return Promise.all(parseClasses.concat(parseGroups));
|
||||
}).then(function() {
|
||||
if (!_.isEmpty(xml2js.CLASSGROUPS)) {
|
||||
// try to categorize ungrouped classes, if any
|
||||
var grouped = _.flatten(_.pluck(_.values(xml2js.CLASSGROUPS), 'classes'));
|
||||
var ungrouped = _.difference(_.keys(xml2js.CLASSES), grouped);
|
||||
_.each(ungrouped, function(c) {
|
||||
_.each(findUsage(c), function(group) {
|
||||
xml2js.CLASSGROUPS[group].classes.push(c);
|
||||
});
|
||||
});
|
||||
grouped = _.flatten(_.pluck(_.values(xml2js.CLASSGROUPS), 'classes'));
|
||||
ungrouped = _.difference(_.keys(xml2js.CLASSES), grouped);
|
||||
// try to categorize ungrouped enums, if any
|
||||
_.each(xml2js.ENUMS_BY_GROUP, function(enumGroupSpec, enumGroupName) {
|
||||
_.each(findUsage(enumGroupName, true), function(c) {
|
||||
xml2js.CLASSES[c].enums_by_group[enumGroupName] = enumGroupSpec;
|
||||
_.each(enumGroupSpec.members, function(enumName) {
|
||||
xml2js.CLASSES[c].enums[enumName] = xml2js.ENUMS[enumName];
|
||||
delete xml2js.ENUMS[enumName];
|
||||
});
|
||||
delete xml2js.ENUMS_BY_GROUP[enumGroupName];
|
||||
});
|
||||
});
|
||||
}
|
||||
}).then(function() {
|
||||
if (xml2js.opts.custom && fs.existsSync(xml2js.opts.custom)) {
|
||||
return fs.readFileAsync(xml2js.opts.custom, 'utf8').then(function(custom) {
|
||||
@ -199,9 +238,9 @@ var xml2js = {
|
||||
console.log(xml2js.opts.custom ? ('Error: No such customization file exists: ' + xml2js.opts.custom) : 'No customizations given.');
|
||||
}
|
||||
}).then(function() {
|
||||
generateCustomPointerClasses();
|
||||
validateMethods();
|
||||
validateVars();
|
||||
generateCustomPointerClasses();
|
||||
return _.pick(xml2js, 'MODULE', 'ENUMS', 'ENUMS_BY_GROUP', 'METHODS', 'CLASSES', 'CLASSGROUPS');
|
||||
});
|
||||
}
|
||||
@ -391,7 +430,30 @@ function generateCustomPointerClasses() {
|
||||
}
|
||||
|
||||
|
||||
// override autogenerated methods with custom configuration
|
||||
// search for usage of a type
|
||||
function findUsage(type, classOnly) {
|
||||
var filterClasses = function(fn) { return _.without(_.map(xml2js.CLASSES, fn), undefined); };
|
||||
var usesType = function(classSpec, className) {
|
||||
var methodsOfType = (_.find(classSpec.methods, function(methodSpec, methodName) {
|
||||
return ((!_.isEmpty(methodSpec.return) && methodSpec.return.type == type) ||
|
||||
(_.contains(_.pluck(methodSpec.params, 'type'), type)));
|
||||
}) != undefined);
|
||||
var variablesOfType = _.contains(_.pluck(classSpec.variable, 'type'), type);
|
||||
return ((methodsOfType || variablesOfType) ? className : undefined);
|
||||
};
|
||||
var extendsType = function(classSpec, className) {
|
||||
return ((classSpec.parent == type) ? className : undefined);
|
||||
};
|
||||
var classes = _.union(filterClasses(usesType), filterClasses(extendsType));
|
||||
if (classOnly) {
|
||||
return classes;
|
||||
} else {
|
||||
return _.without(_.uniq(_.pluck(_.pick(xml2js.CLASSES, classes), 'group')), undefined);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// override autogenerated methods with custom configuration
|
||||
function customizeMethods(custom) {
|
||||
_.each(custom, function(classMethods, className) {
|
||||
_.extend(xml2js.CLASSES[className].methods, _.pick(classMethods, function(methodSpec, methodName) {
|
||||
@ -527,6 +589,19 @@ function getSubmodules(spec_c) {
|
||||
}
|
||||
|
||||
|
||||
// get parent class, if any
|
||||
function getParent(spec_c, className) {
|
||||
var parent = getChild(spec_c, 'basecompoundref');
|
||||
if (parent) {
|
||||
parent = getText(parent);
|
||||
if (!_.has(xml2js.CLASSES, parent)) {
|
||||
console.log('WARNING: Class ' + className + ' has unknown parent class ' + parent);
|
||||
}
|
||||
}
|
||||
return parent;
|
||||
}
|
||||
|
||||
|
||||
function hasParams(paramsSpec) {
|
||||
return !(_.isEmpty(paramsSpec) ||
|
||||
((_.size(paramsSpec) == 1) && getText(getChild(paramsSpec[0], 'type')) == 'void'));
|
||||
@ -559,6 +634,7 @@ function getMethods(spec_c, parent) {
|
||||
if (!_.isEmpty(returnSpec)) {
|
||||
retval = getReturn(returnSpec, getReturnDetails(description), methodName, parent);
|
||||
}
|
||||
methodName = getUniqueMethodName(methodName, spec_js, parent);
|
||||
spec_js[methodName] = {
|
||||
description: methodDescription,
|
||||
params: params,
|
||||
@ -575,6 +651,17 @@ function getMethods(spec_c, parent) {
|
||||
}
|
||||
|
||||
|
||||
// get a unique string to represent the name of an overloaded method
|
||||
function getUniqueMethodName(methodName, module, parent) {
|
||||
if (methodName in module) {
|
||||
do {
|
||||
methodName += '!';
|
||||
} while (methodName in module);
|
||||
}
|
||||
return methodName;
|
||||
}
|
||||
|
||||
|
||||
// get variable specifications for a class
|
||||
function getVariables(spec_c, parent) {
|
||||
var spec_js = {};
|
||||
|
122
doxy/samples.mapping.txt
Normal file
@ -0,0 +1,122 @@
|
||||
# Mapping C++ sample files to Java sample files
|
||||
a110x-intr.cxx A110X_intrSample.java
|
||||
a110x.cxx A110XSample.java
|
||||
ad8232.cxx AD8232Sample.java
|
||||
adc121c021.cxx ADC121C021Sample.java
|
||||
adis16448.cxx ADIS16448Sample.java
|
||||
adxl335.cxx ADXL335Sample.java
|
||||
adxl345.cxx Adxl345Sample.java
|
||||
ak8975.cxx AK8975Sample.java
|
||||
am2315.cxx AM2315Sample.java
|
||||
apds9002.cxx APDS9002Sample.java
|
||||
biss0001.cxx BISS0001Sample.java
|
||||
bmpx8x.cxx BMPX8XSample.java
|
||||
buzzer-sound.cxx Buzzer_soundSample.java
|
||||
cjq4435.cxx CJQ4435Sample.java
|
||||
ds1307.cxx DS1307Sample.java
|
||||
eboled.cxx EBOLEDSample.java
|
||||
ecs1030.cxx ECS1030Sample.java
|
||||
enc03r.cxx ENC03RSample.java
|
||||
es08a.cxx ES08ASample.java
|
||||
flex.cxx FlexSample.java
|
||||
gp2y0a.cxx GP2Y0ASample.java
|
||||
grovebutton.cxx GroveButtonSample.java
|
||||
grovecircularled.cxx GroveCircularLEDSample.java
|
||||
grovecollision.cxx GroveCollisionSample.java
|
||||
groveehr.cxx GroveEHRSample.java
|
||||
groveeldriver.cxx GroveElDriverSample.java
|
||||
groveelectromagnet.cxx GroveElectromagnetSample.java
|
||||
groveemg.cxx GroveEMGSample.java
|
||||
grovegprs.cxx GroveGPRSSample.java
|
||||
grovegsr.cxx GroveGSRSample.java
|
||||
groveled.cxx GroveLEDSample.java
|
||||
grovelinefinder.cxx GroveLineFinderSample.java
|
||||
grovelight.cxx GroveLightSample.java
|
||||
groveloudness.cxx GroveLoudnessSample.java
|
||||
grovemoisture.cxx GroveMoistureSample.java
|
||||
groveo2.cxx GroveO2Sample.java
|
||||
groverelay.cxx GroveRelaySample.java
|
||||
groverotary.cxx GroveRotarySample.java
|
||||
grovescam.cxx GROVESCAMSample.java
|
||||
groveslide.cxx GroveSlideSample.java
|
||||
grovespeaker.cxx GroveSpeakerSample.java
|
||||
grovevdiv.cxx GroveVDivSample.java
|
||||
grovewater.cxx GroveWaterSample.java
|
||||
grovewfs.cxx GroveWFSSample.java
|
||||
guvas12d.cxx GUVAS12DSample.java
|
||||
h3lis331dl.cxx H3LIS331DLSample.java
|
||||
hcsr04.cxx HCSR04Sample.java
|
||||
hm11.cxx HM11Sample.java
|
||||
hmc5883l.cxx Hmc5883lSample.java
|
||||
hp20x.cxx HP20XSample.java
|
||||
ht9170.cxx HT9170Sample.java
|
||||
htu21d.cxx HTU21DSample.java
|
||||
hx711.cxx HX711Sample.java
|
||||
hyld9767.cxx HYLD9767Sample.java
|
||||
ina132.cxx INA132Sample.java
|
||||
itg3200.cxx Itg3200Sample.java
|
||||
jhd1313m1-lcd.cxx Jhd1313m1_lcdSample.java
|
||||
joystick12-example.cxx Joystick12_exampleSample.java
|
||||
l298-stepper.cxx L298_stepperSample.java
|
||||
l298.cxx L298Sample.java
|
||||
lcm1602-lcd.cxx Lcm1602_lcdSample.java
|
||||
ldt0028.cxx LDT0028Sample.java
|
||||
lol-example.cxx LoL_exampleSample.java
|
||||
lpd8806.cxx LPD8806Sample.java
|
||||
lsm303.cxx LSM303Sample.java
|
||||
lsm9ds0.cxx LSM9DS0Sample.java
|
||||
m24lr64e.cxx M24LR64ESample.java
|
||||
max31723.cxx MAX31723Sample.java
|
||||
max31855.cxx MAX31855Sample.java
|
||||
max44000.cxx MAX44000Sample.java
|
||||
max5487.cxx MAX5487Sample.java
|
||||
maxds3231m.cxx MAXDS3231MSample.java
|
||||
mg811.cxx MG811Sample.java
|
||||
mic.cxx MicrophoneSample.java
|
||||
mlx90614.cxx MLX90614Sample.java
|
||||
mma7455.cxx MMA7455Sample.java
|
||||
mma7660.cxx MMA7660Sample.java
|
||||
mpl3115a2.cxx MPL3115A2Sample.java
|
||||
mpr121.cxx MPR121Sample.java
|
||||
mpu60x0.cxx MPU60X0Sample.java
|
||||
mpu9150.cxx MPU9150Sample.java
|
||||
mpu9250.cxx MPU9250Sample.java
|
||||
mq2.cxx MQ2Sample.java
|
||||
mq3.cxx MQ3Sample.java
|
||||
mq303a.cxx MQ303ASample.java
|
||||
mq5.cxx MQ5Sample.java
|
||||
mq9.cxx MQ9Sample.java
|
||||
my9221-ledbar.cxx MY9221_ledbarSample.java
|
||||
my9221-updown.cxx MY9221_updownSample.java
|
||||
nrf24l01-broadcast.cxx NRF24L01_broadcastSample.java
|
||||
nrf24l01-receiver.cxx NRF24L01_receiverSample.java
|
||||
nrf24l01-transmitter.cxx NRF24L01_transmitterSample.java
|
||||
nunchuck.cxx NUNCHUCKSample.java
|
||||
otp538u.cxx OTP538USample.java
|
||||
pca9685.cxx PCA9685Sample.java
|
||||
pn532-writeurl.cxx PN532_writeurlSample.java
|
||||
pn532.cxx PN532Sample.java
|
||||
ppd42ns.cxx PPD42NSSample.java
|
||||
pulsensor.cxx PulsensorSample.java
|
||||
rfr359f.cxx RFR359FSample.java
|
||||
rgbringcoder.cxx RGBRingCoderSample.java
|
||||
rotaryencoder.cxx RotaryEncoderSample.java
|
||||
rpr220-intr.cxx RPR220_intrSample.java
|
||||
rpr220.cxx RPR220Sample.java
|
||||
sainsmartks.cxx SAINSMARTKSSample.java
|
||||
sm130.cxx SM130Sample.java
|
||||
ssd1306-oled.cxx SSD1306_oledSample.java
|
||||
ssd1308-oled.cxx SSD1308_oledSample.java
|
||||
ssd1327-oled.cxx SSD1327_oledSample.java
|
||||
st7735.cxx ST7735Sample.java
|
||||
stepmotor.cxx StepMotorSample.java
|
||||
ta12200.cxx TA12200Sample.java
|
||||
tm1637.cxx TM1637Sample.java
|
||||
tp401.cxx TP401Sample.java
|
||||
tsl2561.cxx TSL2561Sample.java
|
||||
ttp223.cxx TTP223Sample.java
|
||||
ublox6.cxx Ublox6Sample.java
|
||||
uln200xa.cxx ULN200XASample.java
|
||||
waterlevel.cxx WaterLevelSample.java
|
||||
wt5001.cxx WT5001Sample.java
|
||||
yg1006.cxx YG1006Sample.java
|
@ -1,347 +1,245 @@
|
||||
# Extract module name from non-standard example name
|
||||
macro(get_module_name example_name module_name)
|
||||
string(LENGTH ${example_name} length)
|
||||
string(FIND ${example_name} "-" index)
|
||||
if (${index} GREATER 1)
|
||||
string(SUBSTRING ${example_name} 0 ${index} substr)
|
||||
set(${module_name} ${substr})
|
||||
elseif (${example_name} MATCHES "^grove")
|
||||
set (${module_name} "grove")
|
||||
elseif ((${example_name} MATCHES "^mq" AND ${length} EQUAL 3) OR ${example_name} STREQUAL "tp401")
|
||||
set (${module_name} "gas")
|
||||
else()
|
||||
set(${module_name} ${example_name})
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
|
||||
# Set source file, include and linker settings for an example
|
||||
# If example cannot be built, example_bin is cleared
|
||||
macro(add_custom_example example_bin example_src example_module_list)
|
||||
set(found_all_modules TRUE)
|
||||
foreach (module ${example_module_list})
|
||||
if (NOT EXISTS "${PROJECT_SOURCE_DIR}/src/${module}")
|
||||
set(found_all_modules FALSE)
|
||||
endif()
|
||||
if (MODULE_LIST)
|
||||
list(FIND MODULE_LIST ${module} index)
|
||||
if (${index} EQUAL -1)
|
||||
set(found_all_modules FALSE)
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
if (found_all_modules)
|
||||
add_executable (${example_bin} ${example_src})
|
||||
target_link_libraries (${example_bin} ${CMAKE_THREAD_LIBS_INIT})
|
||||
foreach (module ${example_module_list})
|
||||
set(module_dir "${PROJECT_SOURCE_DIR}/src/${module}")
|
||||
include_directories (${module_dir})
|
||||
if (${module} STREQUAL "lcd")
|
||||
set(module "i2clcd")
|
||||
endif()
|
||||
target_link_libraries (${example_bin} ${module})
|
||||
endforeach()
|
||||
else()
|
||||
MESSAGE(INFO " Ignored ${example_bin}")
|
||||
set (example_bin "")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
|
||||
# Add specified example by name
|
||||
# Note special case for grove based examples
|
||||
macro(add_example example_name)
|
||||
set(example_src "${example_name}.cxx")
|
||||
set(example_bin "${example_name}-example")
|
||||
get_module_name(${example_name} module_name)
|
||||
set(module_dir "${PROJECT_SOURCE_DIR}/src/${module_name}")
|
||||
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${example_src}"
|
||||
AND EXISTS ${module_dir}
|
||||
AND IS_DIRECTORY ${module_dir})
|
||||
add_custom_example(${example_bin} ${example_src} ${module_name})
|
||||
if ((NOT ${example_bin} STREQUAL "") AND (${module_name} STREQUAL "grove"))
|
||||
set(grove_module_path "${PROJECT_SOURCE_DIR}/src/${example_name}")
|
||||
if (EXISTS ${grove_module_path})
|
||||
include_directories(${grove_module_path})
|
||||
target_link_libraries (${example_bin} ${example_name})
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
MESSAGE(INFO " Ignored ${example_bin}")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/examples)
|
||||
|
||||
add_executable (hmc5883l-example hmc5883l.cxx)
|
||||
add_executable (groveled-example groveled.cxx)
|
||||
add_executable (groveled-multi-example groveled-multi.cxx)
|
||||
add_executable (groverelay-example groverelay.cxx)
|
||||
add_executable (grovelight-example grovelight.cxx)
|
||||
add_executable (grovetemp-example grovetemp.cxx)
|
||||
add_executable (grovebutton-example grovebutton.cxx)
|
||||
add_executable (groverotary-example groverotary.cxx)
|
||||
add_executable (groveslide-example groveslide.cxx)
|
||||
add_executable (lcm1602-lcd-example lcm1602-lcd.cxx)
|
||||
add_executable (jhd1313m1-lcd-example jhd1313m1-lcd.cxx)
|
||||
add_executable (buzzer-sound-example buzzer-sound.cxx)
|
||||
add_executable (my9221-ledbar-example my9221-ledbar.cxx)
|
||||
add_executable (my9221-updown-example my9221-updown.cxx)
|
||||
add_executable (nrf24l01-transmitter-example nrf24l01-transmitter.cxx)
|
||||
add_executable (nrf24l01-receiver-example nrf24l01-receiver.cxx)
|
||||
add_executable (nrf24l01-broadcast-example nrf24l01-broadcast.cxx)
|
||||
add_executable (es08a-example es08a.cxx)
|
||||
add_executable (son-hcsr04-example hcsr04.cxx)
|
||||
add_executable (ssd1308-oled-example ssd1308-oled.cxx)
|
||||
add_executable (ssd1327-oled-example ssd1327-oled.cxx)
|
||||
add_executable (max44000-example max44000.cxx)
|
||||
add_executable (mma7455-example mma7455.cxx)
|
||||
add_executable (st7735-example st7735.cxx)
|
||||
add_executable (max31855-example max31855.cxx)
|
||||
add_executable (bmpx8x-example bmpx8x.cxx)
|
||||
add_executable (stepmotor-example stepmotor.cxx)
|
||||
add_executable (pulsensor-example pulsensor.cxx)
|
||||
add_executable (mic-example mic.cxx)
|
||||
add_executable (mpu9150-example mpu9150.cxx)
|
||||
add_executable (maxds3231m-example maxds3231m.cxx)
|
||||
add_executable (max31723-example max31723.cxx)
|
||||
add_executable (max5487-example max5487.cxx)
|
||||
add_executable (nrf8001-broadcast-example nrf8001-broadcast.cxx)
|
||||
add_executable (nrf8001-helloworld-example nrf8001-helloworld.cxx)
|
||||
add_executable (lpd8806-example lpd8806.cxx)
|
||||
add_executable (mlx90614-example mlx90614.cxx)
|
||||
add_executable (ecs1030-example ecs1030.cxx)
|
||||
add_executable (mq2-example mq2.cxx)
|
||||
add_executable (mq3-example mq3.cxx)
|
||||
add_executable (mq5-example mq5.cxx)
|
||||
add_executable (mq9-example mq9.cxx)
|
||||
add_executable (tp401-example tp401.cxx)
|
||||
add_executable (tcs3414cs-example tcs3414cs.cxx)
|
||||
add_executable (th02-example th02.cxx)
|
||||
add_executable (ttp223-example ttp223.cxx)
|
||||
add_executable (lsm303-example lsm303.cxx)
|
||||
add_executable (joystick12-example joystick12-example.cxx)
|
||||
add_executable (lol-example lol-example.cxx)
|
||||
add_executable (tsl2561-example tsl2561.cxx)
|
||||
add_executable (htu21d-example htu21d.cxx)
|
||||
add_executable (mpl3115a2-example mpl3115a2.cxx)
|
||||
add_executable (ldt0028-example ldt0028.cxx)
|
||||
add_executable (am2315-example am2315.cxx)
|
||||
add_executable (itg3200-example itg3200.cxx)
|
||||
add_executable (enc03r-example enc03r.cxx)
|
||||
add_executable (adc121c021-example adc121c021.cxx)
|
||||
add_executable (ds1307-example ds1307.cxx)
|
||||
add_executable (a110x-example a110x.cxx)
|
||||
add_executable (gp2y0a-example gp2y0a.cxx)
|
||||
add_executable (grovemoisture-example grovemoisture.cxx)
|
||||
add_executable (groveehr-example groveehr.cxx)
|
||||
add_executable (ta12200-example ta12200.cxx)
|
||||
add_executable (grovelinefinder-example grovelinefinder.cxx)
|
||||
add_executable (grovevdiv-example grovevdiv.cxx)
|
||||
add_executable (grovewater-example grovewater.cxx)
|
||||
add_executable (guvas12d-example guvas12d.cxx)
|
||||
add_executable (groveloudness-example groveloudness.cxx)
|
||||
add_executable (mpr121-example mpr121.cxx)
|
||||
add_executable (ublox6-example ublox6.cxx)
|
||||
add_executable (yg1006-example yg1006.cxx)
|
||||
add_executable (wt5001-example wt5001.cxx)
|
||||
add_executable (ppd42ns-example ppd42ns.cxx)
|
||||
add_executable (mq303a-example mq303a.cxx)
|
||||
add_executable (grovespeaker-example grovespeaker.cxx)
|
||||
add_executable (rfr359f-example rfr359f.cxx)
|
||||
add_executable (biss0001-example biss0001.cxx)
|
||||
add_executable (rotaryencoder-example rotaryencoder.cxx)
|
||||
add_executable (adxl345-example adxl345.cxx)
|
||||
add_executable (rpr220-example rpr220.cxx)
|
||||
add_executable (rpr220-intr-example rpr220-intr.cxx)
|
||||
add_executable (mma7660-example mma7660.cxx)
|
||||
add_executable (cjq4435-example cjq4435.cxx)
|
||||
add_executable (adxl335-example adxl335.cxx)
|
||||
add_executable (hmtrp-example hmtrp.cxx)
|
||||
add_executable (nunchuck-example nunchuck.cxx)
|
||||
add_executable (otp538u-example otp538u.cxx)
|
||||
add_executable (grovecollision-example grovecollision.cxx)
|
||||
add_executable (groveelectromagnet-example groveelectromagnet.cxx)
|
||||
add_executable (groveemg-example groveemg.cxx)
|
||||
add_executable (groveo2-example groveo2.cxx)
|
||||
add_executable (grovegsr-example grovegsr.cxx)
|
||||
add_executable (ina132-example ina132.cxx)
|
||||
add_executable (l298-example l298.cxx)
|
||||
add_executable (l298-stepper-example l298-stepper.cxx)
|
||||
add_executable (at42qt1070-example at42qt1070.cxx)
|
||||
add_executable (grovemd-example grovemd.cxx)
|
||||
add_executable (pca9685-example pca9685.cxx)
|
||||
add_executable (groveeldriver-example groveeldriver.cxx)
|
||||
add_executable (adafruitss-example adafruitss.cxx)
|
||||
add_executable (adafruitms1438-example adafruitms1438.cxx)
|
||||
add_executable (adafruitms1438-stepper-example adafruitms1438-stepper.cxx)
|
||||
add_executable (hx711-example hx711.cxx)
|
||||
add_executable (flex-example flex.cxx)
|
||||
add_executable (a110x-intr-example a110x-intr.cxx)
|
||||
add_executable (mhz16-example mhz16.cxx)
|
||||
add_executable (apds9002-example apds9002.cxx)
|
||||
add_executable (waterlevel-example waterlevel.cxx)
|
||||
add_executable (tm1637-example tm1637.cxx)
|
||||
add_executable (zfm20-example zfm20.cxx)
|
||||
add_executable (zfm20-register-example zfm20-register.cxx)
|
||||
add_executable (uln200xa-example uln200xa.cxx)
|
||||
add_executable (grovewfs-example grovewfs.cxx)
|
||||
add_executable (isd1820-example isd1820.cxx)
|
||||
add_executable (sx6119-example sx6119.cxx)
|
||||
add_executable (si114x-example si114x.cxx)
|
||||
add_executable (maxsonarez-example maxsonarez.cxx)
|
||||
add_executable (hm11-example hm11.cxx)
|
||||
add_executable (ht9170-example ht9170.cxx)
|
||||
add_executable (h3lis331dl-example h3lis331dl.cxx)
|
||||
add_executable (ad8232-example ad8232.cxx)
|
||||
add_executable (grovescam-example grovescam.cxx)
|
||||
# If your sample source file matches the name of the module it tests, add it here
|
||||
# Exceptions are as follows:
|
||||
# string after first '-' is ignored (e.g. nrf24l01-transmitter maps to nrf24l01)
|
||||
# mq? will use module gas
|
||||
# grove* will use module grove
|
||||
add_example (hmc5883l)
|
||||
add_example (groveled)
|
||||
add_example (groverelay)
|
||||
add_example (grovelight)
|
||||
add_example (grovetemp)
|
||||
add_example (grovebutton)
|
||||
add_example (groverotary)
|
||||
add_example (groveslide)
|
||||
add_example (buzzer-sound)
|
||||
add_example (my9221-ledbar)
|
||||
add_example (my9221-updown)
|
||||
add_example (nrf24l01-transmitter)
|
||||
add_example (nrf24l01-receiver)
|
||||
add_example (nrf24l01-broadcast)
|
||||
add_example (hcsr04)
|
||||
add_example (max44000)
|
||||
add_example (mma7455)
|
||||
add_example (st7735)
|
||||
add_example (max31855)
|
||||
add_example (bmpx8x)
|
||||
add_example (stepmotor)
|
||||
add_example (pulsensor)
|
||||
add_example (mic)
|
||||
add_example (mpu9150)
|
||||
add_example (maxds3231m)
|
||||
add_example (max31723)
|
||||
add_example (max5487)
|
||||
add_example (nrf8001-broadcast)
|
||||
add_example (nrf8001-helloworld)
|
||||
add_example (lpd8806)
|
||||
add_example (mlx90614)
|
||||
add_example (ecs1030)
|
||||
add_example (mq2)
|
||||
add_example (mq3)
|
||||
add_example (mq4)
|
||||
add_example (mq5)
|
||||
add_example (mq6)
|
||||
add_example (mq7)
|
||||
add_example (mq8)
|
||||
add_example (mq9)
|
||||
add_example (tp401)
|
||||
add_example (tcs3414cs)
|
||||
add_example (th02)
|
||||
add_example (ttp223)
|
||||
add_example (lsm303)
|
||||
add_example (joystick12)
|
||||
add_example (lol)
|
||||
add_example (tsl2561)
|
||||
add_example (htu21d)
|
||||
add_example (mpl3115a2)
|
||||
add_example (ldt0028)
|
||||
add_example (am2315)
|
||||
add_example (itg3200)
|
||||
add_example (enc03r)
|
||||
add_example (adc121c021)
|
||||
add_example (ds1307)
|
||||
add_example (a110x)
|
||||
add_example (gp2y0a)
|
||||
add_example (grovemoisture)
|
||||
add_example (groveehr)
|
||||
add_example (ta12200)
|
||||
add_example (grovelinefinder)
|
||||
add_example (grovevdiv)
|
||||
add_example (grovewater)
|
||||
add_example (guvas12d)
|
||||
add_example (mpr121)
|
||||
add_example (ublox6)
|
||||
add_example (yg1006)
|
||||
add_example (wt5001)
|
||||
add_example (ppd42ns)
|
||||
add_example (mq303a)
|
||||
add_example (grovespeaker)
|
||||
add_example (rfr359f)
|
||||
add_example (biss0001)
|
||||
add_example (rotaryencoder)
|
||||
add_example (adxl345)
|
||||
add_example (rpr220)
|
||||
add_example (rpr220-intr)
|
||||
add_example (mma7660)
|
||||
add_example (cjq4435)
|
||||
add_example (adxl335)
|
||||
add_example (hmtrp)
|
||||
add_example (nunchuck)
|
||||
add_example (otp538u)
|
||||
add_example (grovecollision)
|
||||
add_example (groveelectromagnet)
|
||||
add_example (groveemg)
|
||||
add_example (groveo2)
|
||||
add_example (grovegsr)
|
||||
add_example (ina132)
|
||||
add_example (l298)
|
||||
add_example (l298-stepper)
|
||||
add_example (at42qt1070)
|
||||
add_example (grovemd)
|
||||
add_example (grovemd-stepper)
|
||||
add_example (pca9685)
|
||||
add_example (groveeldriver)
|
||||
add_example (adafruitss)
|
||||
add_example (adafruitms1438)
|
||||
add_example (adafruitms1438-stepper)
|
||||
add_example (hx711)
|
||||
add_example (flex)
|
||||
add_example (a110x-intr)
|
||||
add_example (mhz16)
|
||||
add_example (apds9002)
|
||||
add_example (waterlevel)
|
||||
add_example (tm1637)
|
||||
add_example (zfm20)
|
||||
add_example (zfm20-register)
|
||||
add_example (uln200xa)
|
||||
add_example (grovewfs)
|
||||
add_example (isd1820)
|
||||
add_example (sx6119)
|
||||
add_example (si114x)
|
||||
add_example (maxsonarez)
|
||||
add_example (hm11)
|
||||
add_example (ht9170)
|
||||
add_example (h3lis331dl)
|
||||
add_example (ad8232)
|
||||
add_example (grovescam)
|
||||
add_example (m24lr64e)
|
||||
add_example (grovecircularled)
|
||||
add_example (rgbringcoder)
|
||||
add_example (hp20x)
|
||||
add_example (pn532)
|
||||
add_example (pn532-writeurl)
|
||||
add_example (lsm9ds0)
|
||||
add_example (loudness)
|
||||
add_example (mg811)
|
||||
add_example (wheelencoder)
|
||||
add_example (sm130)
|
||||
add_example (grovegprs)
|
||||
add_example (lm35)
|
||||
add_example (micsv89)
|
||||
add_example (xbee)
|
||||
add_example (urm37)
|
||||
add_example (urm37-uart)
|
||||
add_example (adxrs610)
|
||||
add_example (bma220)
|
||||
add_example (dfrph)
|
||||
add_example (mcp9808)
|
||||
add_example (groveultrasonic)
|
||||
add_example (sx1276-lora)
|
||||
add_example (sx1276-fsk)
|
||||
if (OPENZWAVE_FOUND)
|
||||
include_directories(${OPENZWAVE_INCLUDE_DIRS})
|
||||
add_example (ozw)
|
||||
endif()
|
||||
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/hmc5883l)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/grove)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/lcd)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/buzzer)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/my9221)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/nrf24l01)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/servo)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/hcsr04)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/max44000)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/mma7455)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/st7735)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/max31855)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/bmpx8x)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/stepmotor)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/pulsensor)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/mic)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/mpu9150)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/maxds3231m)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/max31723)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/max5487)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/nrf8001)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/lpd8806)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/mlx90614)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/ecs1030)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/gas)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/tcs3414cs)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/th02)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/ttp223)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/lsm303)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/joystick12)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/lol)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/tsl2561)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/htu21d)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/mpl3115a2)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/ldt0028)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/am2315)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/itg3200)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/enc03r)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/adc121c021)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/ds1307)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/a110x)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/gp2y0a)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/grovemoisture)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/groveehr)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/ta12200)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/grovelinefinder)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/grovevdiv)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/grovewater)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/guvas12d)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/groveloudness)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/mpr121)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/ublox6)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/yg1006)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/wt5001)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/ppd42ns)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/mq303a)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/grovespeaker)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/rfr359f)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/biss0001)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/rotaryencoder)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/adxl345)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/rpr220)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/mma7660)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/cjq4435)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/adxl335)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/hmtrp)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/nunchuck)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/otp538u)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/grovecollision)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/groveelectromagnet)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/groveemg)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/groveo2)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/grovegsr)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/ina132)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/l298)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/at42qt1070)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/grovemd)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/pca9685)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/groveeldriver)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/adafruitss)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/adafruitms1438)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/hx711)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/flex)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/mhz16)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/apds9002)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/waterlevel)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/tm1637)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/zfm20)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/uln200xa)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/grovewfs)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/isd1820)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/sx6119)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/si114x)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/maxsonarez)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/hm11)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/ht9170)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/h3lis331dl)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/ad8232)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/grovescam)
|
||||
|
||||
target_link_libraries (hmc5883l-example hmc5883l ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (groveled-example grove ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (groveled-multi-example grove ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (groverelay-example grove ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (grovelight-example grove ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (grovetemp-example grove ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (grovebutton-example grove ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (groverotary-example grove ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (groveslide-example grove ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (lcm1602-lcd-example i2clcd ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (jhd1313m1-lcd-example i2clcd ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (buzzer-sound-example buzzer ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (my9221-ledbar-example my9221 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (my9221-updown-example my9221 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (nrf24l01-transmitter-example nrf24l01 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (nrf24l01-receiver-example nrf24l01 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (nrf24l01-broadcast-example nrf24l01 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (es08a-example servo ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (son-hcsr04-example hcsr04 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (ssd1308-oled-example i2clcd ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (ssd1327-oled-example i2clcd ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (max44000-example max44000 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (mma7455-example mma7455 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (st7735-example st7735 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (max31855-example max31855 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (bmpx8x-example bmpx8x ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (stepmotor-example stepmotor ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (pulsensor-example pulsensor ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (mic-example mic ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (mpu9150-example mpu9150 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (maxds3231m-example maxds3231m ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (max31723-example max31723 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (max5487-example max5487 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (nrf8001-broadcast-example nrf8001 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (nrf8001-helloworld-example nrf8001 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (lpd8806-example lpd8806 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (mlx90614-example mlx90614 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (ecs1030-example ecs1030 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (mq2-example gas ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (mq3-example gas ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (mq5-example gas ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (mq9-example gas ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (tp401-example gas ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (tcs3414cs-example tcs3414cs ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (th02-example th02 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (ttp223-example ttp223 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (lsm303-example lsm303 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (joystick12-example joystick12 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (lol-example lol ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (tsl2561-example tsl2561 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (htu21d-example htu21d ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (mpl3115a2-example mpl3115a2 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (ldt0028-example ldt0028 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (am2315-example am2315 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (itg3200-example itg3200 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (enc03r-example enc03r ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (adc121c021-example adc121c021 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (ds1307-example ds1307 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (a110x-example a110x ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (gp2y0a-example gp2y0a ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (grovemoisture-example grovemoisture ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (groveehr-example groveehr ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (ta12200-example ta12200 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (grovelinefinder-example grovelinefinder ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (grovevdiv-example grovevdiv ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (grovewater-example grovewater ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (guvas12d-example guvas12d ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (groveloudness-example groveloudness ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (mpr121-example mpr121 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (ublox6-example ublox6 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (yg1006-example yg1006 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (wt5001-example wt5001 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (ppd42ns-example ppd42ns ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (mq303a-example mq303a ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (grovespeaker-example grovespeaker ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (rfr359f-example rfr359f ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (biss0001-example biss0001 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (rotaryencoder-example rotaryencoder ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (adxl345-example adxl345 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (rpr220-example rpr220 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (rpr220-intr-example rpr220 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (mma7660-example mma7660 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (cjq4435-example cjq4435 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (adxl335-example adxl335 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (hmtrp-example hmtrp ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (nunchuck-example nunchuck ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (otp538u-example otp538u ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (grovecollision-example grovecollision ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (groveelectromagnet-example groveelectromagnet ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (groveemg-example groveemg ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (groveo2-example groveo2 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (grovegsr-example grovegsr ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (ina132-example ina132 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (l298-example l298 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (l298-stepper-example l298 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (at42qt1070-example at42qt1070 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (grovemd-example grovemd ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (pca9685-example pca9685 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (groveeldriver-example groveeldriver ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (adafruitss-example adafruitss ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (adafruitms1438-example adafruitms1438 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (adafruitms1438-stepper-example adafruitms1438 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (hx711-example hx711 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (flex-example flex ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (a110x-intr-example a110x ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (mhz16-example mhz16 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (apds9002-example apds9002 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (waterlevel-example waterlevel ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (tm1637-example tm1637 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (zfm20-example zfm20 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (zfm20-register-example zfm20 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (uln200xa-example uln200xa ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (grovewfs-example grovewfs ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (isd1820-example isd1820 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (sx6119-example sx6119 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (si114x-example si114x ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (maxsonarez-example maxsonarez ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (hm11-example hm11 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (ht9170-example ht9170 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (h3lis331dl-example h3lis331dl ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (ad8232-example ad8232 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (grovescam-example grovescam ${CMAKE_THREAD_LIBS_INIT})
|
||||
# These are special cases where you specify example binary, source file and module(s)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src)
|
||||
add_custom_example (groveled-multi-example groveled-multi.cxx grove)
|
||||
add_custom_example (lcm1602-i2c-example lcm1602-i2c.cxx lcd)
|
||||
add_custom_example (lcm1602-parallel-example lcm1602-parallel.cxx lcd)
|
||||
add_custom_example (jhd1313m1-lcd-example jhd1313m1-lcd.cxx lcd)
|
||||
add_custom_example (es08a-example es08a.cxx servo)
|
||||
add_custom_example (ssd1306-oled-example ssd1306-oled.cxx lcd)
|
||||
add_custom_example (ssd1308-oled-example ssd1308-oled.cxx lcd)
|
||||
add_custom_example (ssd1327-oled-example ssd1327-oled.cxx lcd)
|
||||
add_custom_example (sainsmartks-example sainsmartks.cxx lcd)
|
||||
add_custom_example (eboled-example eboled.cxx lcd)
|
||||
add_custom_example (mpu60x0-example mpu60x0.cxx mpu9150)
|
||||
add_custom_example (ak8975-example ak8975.cxx mpu9150)
|
||||
add_custom_example (mpu9250-example mpu9250.cxx mpu9150)
|
||||
|
71
examples/c++/adxrs610.cxx
Normal file
@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Author: Jon Trulson <jtrulson@ics.com>
|
||||
* Copyright (c) 2015 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <iostream>
|
||||
#include <signal.h>
|
||||
#include "adxrs610.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
bool shouldRun = true;
|
||||
|
||||
void sig_handler(int signo)
|
||||
{
|
||||
if (signo == SIGINT)
|
||||
shouldRun = false;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
signal(SIGINT, sig_handler);
|
||||
|
||||
//! [Interesting]
|
||||
|
||||
// Instantiate a ADXRS610 sensor on analog pin A0 (dataout), and
|
||||
// analog A1 (temp out) with an analog reference voltage of
|
||||
// 5.0
|
||||
upm::ADXRS610 *sensor = new upm::ADXRS610(0, 1, 5.0);
|
||||
|
||||
// set a deadband region around the zero point to report 0.0 (optional)
|
||||
sensor->setDeadband(0.015);
|
||||
|
||||
// Every tenth of a second, sample the ADXRS610 and output it's
|
||||
// corresponding temperature and angular velocity
|
||||
|
||||
while (shouldRun)
|
||||
{
|
||||
cout << "Vel (deg/s): " << sensor->getAngularVelocity() << endl;
|
||||
cout << "Temp (C): " << sensor->getTemperature() << endl;
|
||||
|
||||
usleep(100000);
|
||||
}
|
||||
|
||||
//! [Interesting]
|
||||
|
||||
cout << "Exiting" << endl;
|
||||
|
||||
delete sensor;
|
||||
return 0;
|
||||
}
|
72
examples/c++/ak8975.cxx
Normal file
@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Author: Jon Trulson <jtrulson@ics.com>
|
||||
* Copyright (c) 2015 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <iostream>
|
||||
#include <signal.h>
|
||||
#include "mpu9150.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
int shouldRun = true;
|
||||
|
||||
void sig_handler(int signo)
|
||||
{
|
||||
if (signo == SIGINT)
|
||||
shouldRun = false;
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
signal(SIGINT, sig_handler);
|
||||
//! [Interesting]
|
||||
|
||||
upm::AK8975 *sensor = new upm::AK8975();
|
||||
|
||||
sensor->init();
|
||||
|
||||
while (shouldRun)
|
||||
{
|
||||
sensor->update();
|
||||
|
||||
float x, y, z;
|
||||
|
||||
sensor->getMagnetometer(&x, &y, &z);
|
||||
cout << "Magnetometer: ";
|
||||
cout << "MX = " << x << " MY = " << y << " MZ = " << z << endl;
|
||||
|
||||
cout << endl;
|
||||
|
||||
usleep(500000);
|
||||
}
|
||||
|
||||
//! [Interesting]
|
||||
|
||||
cout << "Exiting..." << endl;
|
||||
|
||||
delete sensor;
|
||||
|
||||
return 0;
|
||||
}
|
70
examples/c++/bma220.cxx
Normal file
@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Author: Jon Trulson <jtrulson@ics.com>
|
||||
* Copyright (c) 2015 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <iostream>
|
||||
#include <signal.h>
|
||||
#include "bma220.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
int shouldRun = true;
|
||||
|
||||
void sig_handler(int signo)
|
||||
{
|
||||
if (signo == SIGINT)
|
||||
shouldRun = false;
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
signal(SIGINT, sig_handler);
|
||||
//! [Interesting]
|
||||
|
||||
// Instantiate an BMA220 using default parameters (bus 0, addr 0x0a)
|
||||
upm::BMA220 *sensor = new upm::BMA220();
|
||||
|
||||
// Output data every half second until interrupted
|
||||
while (shouldRun)
|
||||
{
|
||||
sensor->update();
|
||||
|
||||
float x, y, z;
|
||||
|
||||
sensor->getAccelerometer(&x, &y, &z);
|
||||
cout << "Accelerometer: ";
|
||||
cout << "AX: " << x << " AY: " << y << " AZ: " << z << endl;
|
||||
|
||||
usleep(500000);
|
||||
}
|
||||
|
||||
//! [Interesting]
|
||||
|
||||
cout << "Exiting..." << endl;
|
||||
|
||||
delete sensor;
|
||||
|
||||
return 0;
|
||||
}
|
76
examples/c++/dfrph.cxx
Normal file
@ -0,0 +1,76 @@
|
||||
/*
|
||||
* Author: Jon Trulson <jtrulson@ics.com>
|
||||
* Copyright (c) 2015 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <iostream>
|
||||
#include <signal.h>
|
||||
#include "dfrph.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
bool shouldRun = true;
|
||||
|
||||
#define DFRPH_AREF 5.0
|
||||
|
||||
void sig_handler(int signo)
|
||||
{
|
||||
if (signo == SIGINT)
|
||||
shouldRun = false;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
signal(SIGINT, sig_handler);
|
||||
|
||||
//! [Interesting]
|
||||
|
||||
// Instantiate a DFRPH sensor on analog pin A0, with an analog
|
||||
// reference voltage of DFRPH_AREF
|
||||
upm::DFRPH *sensor = new upm::DFRPH(0, DFRPH_AREF);
|
||||
|
||||
|
||||
// After calibration, set the offset (based on calibration with a pH
|
||||
// 7.0 buffer solution). See the UPM sensor documentation for
|
||||
// calibrations instructions.
|
||||
sensor->setOffset(0.065);
|
||||
|
||||
// Every second, sample the pH and output it's corresponding
|
||||
// analog voltage.
|
||||
|
||||
while (shouldRun)
|
||||
{
|
||||
cout << "Detected volts: " << sensor->volts() << endl;
|
||||
cout << "pH value: " << sensor->pH() << endl;
|
||||
cout << endl;
|
||||
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
//! [Interesting]
|
||||
|
||||
cout << "Exiting" << endl;
|
||||
|
||||
delete sensor;
|
||||
return 0;
|
||||
}
|
49
examples/c++/eboled.cxx
Normal file
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Author: Jon Trulson <jtrulson@ics.com>
|
||||
* Copyright (c) 2015 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* 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 "eboled.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
//! [Interesting]
|
||||
// Instantiate an Edison Block OLED using default values
|
||||
upm::EBOLED *lcd = new upm::EBOLED();
|
||||
|
||||
lcd->clear();
|
||||
lcd->setCursor(10, 15);
|
||||
lcd->write("Hello");
|
||||
lcd->setCursor(30, 15);
|
||||
lcd->write("World!");
|
||||
lcd->refresh();
|
||||
|
||||
cout << "Sleeping for 5 seconds..." << endl;
|
||||
sleep(5);
|
||||
|
||||
delete lcd;
|
||||
//! [Interesting]
|
||||
return 0;
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Author: Jon Trulson <jtrulson@ics.com>
|
||||
* Copyright (c) 2014 Intel Corporation.
|
||||
* 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
|
||||
@ -25,11 +25,11 @@
|
||||
#include <unistd.h>
|
||||
#include <iostream>
|
||||
#include <signal.h>
|
||||
#include "groveloudness.h"
|
||||
#include "grovecircularled.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
int shouldRun = true;
|
||||
bool shouldRun = true;
|
||||
|
||||
void sig_handler(int signo)
|
||||
{
|
||||
@ -37,27 +37,27 @@ void sig_handler(int signo)
|
||||
shouldRun = false;
|
||||
}
|
||||
|
||||
|
||||
int main ()
|
||||
int main()
|
||||
{
|
||||
signal(SIGINT, sig_handler);
|
||||
|
||||
|
||||
//! [Interesting]
|
||||
// Instantiate a Grove Loudness sensor on analog pin A0
|
||||
upm::GroveLoudness* loudness = new upm::GroveLoudness(0);
|
||||
|
||||
// Print the loudness value every 0.1 seconds
|
||||
|
||||
// Instantiate a Grove Circular LED on gpio pins 5 and 4
|
||||
|
||||
upm::GroveCircularLED *circle = new upm::GroveCircularLED(5, 4);
|
||||
|
||||
int level = 0;
|
||||
while (shouldRun)
|
||||
{
|
||||
int val = loudness->value();
|
||||
cout << "Loudness value (higher is louder): " << val << endl;
|
||||
|
||||
circle->setSpinner(level);
|
||||
level = (level + 1) % 24;
|
||||
usleep(100000);
|
||||
}
|
||||
//! [Interesting]
|
||||
|
||||
cout << "Exiting" << endl;
|
||||
|
||||
delete loudness;
|
||||
delete circle;
|
||||
return 0;
|
||||
}
|
111
examples/c++/grovegprs.cxx
Normal file
@ -0,0 +1,111 @@
|
||||
/*
|
||||
* Author: Jon Trulson <jtrulson@ics.com>
|
||||
* Copyright (c) 2015 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <iostream>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include "grovegprs.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace upm;
|
||||
|
||||
void printUsage(char *progname)
|
||||
{
|
||||
cout << "Usage: " << progname << " [AT command]" << endl;
|
||||
cout << endl;
|
||||
|
||||
cout << "If an argument is supplied on the command line, that argument is"
|
||||
<< endl;
|
||||
cout << "sent to the module and the response is printed out." << endl;
|
||||
cout << endl;
|
||||
cout << "If no argument is used, then the manufacturer and the current"
|
||||
<< endl;
|
||||
cout << "saved profiles are queried and the results printed out." << endl;
|
||||
cout << endl;
|
||||
cout << endl;
|
||||
}
|
||||
|
||||
// simple helper function to send a command and wait for a response
|
||||
void sendCommand(upm::GroveGPRS* sensor, string cmd)
|
||||
{
|
||||
// commands need to be terminated with a carriage return
|
||||
cmd += "\r";
|
||||
|
||||
sensor->writeDataStr(cmd);
|
||||
|
||||
// wait up to 1 second
|
||||
if (sensor->dataAvailable(1000))
|
||||
{
|
||||
cout << "Returned: " << sensor->readDataStr(1024) << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
cerr << "Timed out waiting for response" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
//! [Interesting]
|
||||
|
||||
// Instantiate a GroveGPRS Module on UART 0
|
||||
upm::GroveGPRS* sensor = new upm::GroveGPRS(0);
|
||||
|
||||
// Set the baud rate, 19200 baud is the default.
|
||||
if (sensor->setBaudRate(19200) != mraa::SUCCESS)
|
||||
{
|
||||
cerr << "Failed to set tty baud rate" << endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
printUsage(argv[0]);
|
||||
|
||||
if (argc > 1)
|
||||
{
|
||||
cout << "Sending command line argument (" << argv[1] << ")..." << endl;
|
||||
sendCommand(sensor, argv[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
// query the module manufacturer
|
||||
cout << "Querying module manufacturer (AT+CGMI)..." << endl;
|
||||
sendCommand(sensor, "AT+CGMI");
|
||||
|
||||
sleep(1);
|
||||
|
||||
// query the saved profiles
|
||||
cout << "Querying the saved profiles (AT&V)..." << endl;
|
||||
sendCommand(sensor, "AT&V");
|
||||
|
||||
// A comprehensive list is available from the datasheet at:
|
||||
// http://www.seeedstudio.com/wiki/images/7/72/AT_Commands_v1.11.pdf
|
||||
}
|
||||
|
||||
//! [Interesting]
|
||||
|
||||
delete sensor;
|
||||
return 0;
|
||||
}
|
66
examples/c++/grovemd-stepper.cxx
Normal file
@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Author: Jon Trulson <jtrulson@ics.com>
|
||||
* Copyright (c) 2015 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include <iostream>
|
||||
#include "grovemd.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
//! [Interesting]
|
||||
// Instantiate an I2C Grove Motor Driver on I2C bus 0
|
||||
|
||||
upm::GroveMD *motors = new upm::GroveMD(GROVEMD_I2C_BUS,
|
||||
GROVEMD_DEFAULT_I2C_ADDR);
|
||||
|
||||
// This example demonstrates using the GroveMD to drive a stepper motor
|
||||
|
||||
// configure it, for this example, we'll assume 200 steps per rev
|
||||
motors->configStepper(200);
|
||||
|
||||
// set for half a rotation
|
||||
motors->setStepperSteps(100);
|
||||
|
||||
// let it go - clockwise rotation, 10 RPM speed
|
||||
motors->enableStepper(upm::GroveMD::STEP_DIR_CW, 10);
|
||||
|
||||
sleep(3);
|
||||
|
||||
// Now do it backwards...
|
||||
motors->setStepperSteps(100);
|
||||
motors->enableStepper(upm::GroveMD::STEP_DIR_CCW, 10);
|
||||
|
||||
// now disable
|
||||
motors->disableStepper();
|
||||
|
||||
//! [Interesting]
|
||||
|
||||
cout << "Exiting..." << endl;
|
||||
|
||||
delete motors;
|
||||
return 0;
|
||||
}
|
62
examples/c++/groveultrasonic.cxx
Normal file
@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Author: Jun Kato <i@junkato.jp>
|
||||
* Copyright (c) 2015 Jun Kato.
|
||||
*
|
||||
* Thanks to Seeed Studio for a working arduino sketch
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <iostream>
|
||||
#include "groveultrasonic.h"
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
upm::GroveUltraSonic *sonar = NULL;
|
||||
bool running = true;
|
||||
|
||||
void
|
||||
sig_handler(int signo)
|
||||
{
|
||||
if (signo == SIGINT) {
|
||||
running = false;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
signal(SIGINT, sig_handler);
|
||||
//! [Interesting]
|
||||
// upm::GroveUltraSonic *sonar = NULL;
|
||||
sonar = new upm::GroveUltraSonic(2);
|
||||
while(running) {
|
||||
int width = sonar->getDistance();
|
||||
printf("Echo width = %d\n", width);
|
||||
printf("Distance inches = %f.2\n\n", width/148.0);
|
||||
sleep(3);
|
||||
}
|
||||
//! [Interesting]
|
||||
printf("exiting application\n");
|
||||
delete sonar;
|
||||
return 0;
|
||||
}
|
@ -42,19 +42,20 @@ sig_handler(int signo)
|
||||
}
|
||||
|
||||
//! [Interesting]
|
||||
void
|
||||
interrupt (void * args) {
|
||||
sonar->ackEdgeDetected ();
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
sonar = new upm::HCSR04(5, 7, &interrupt);
|
||||
sonar = new upm::HCSR04(5, 6);
|
||||
signal(SIGINT, sig_handler);
|
||||
|
||||
printf ("width = %d\n", sonar->getDistance());
|
||||
std::cout << "exiting application" << std::endl;
|
||||
sleep(1);
|
||||
|
||||
for(;;){
|
||||
std::cout << "get distance" << std::endl;
|
||||
double distance = sonar->getDistance(CM);
|
||||
std::cout << "distance " << distance << std::endl;
|
||||
sleep(5);
|
||||
}
|
||||
|
||||
delete sonar;
|
||||
|
||||
|
@ -58,7 +58,7 @@ void sendCommand(upm::HM11* ble, char *cmd)
|
||||
{
|
||||
memset(buffer, 0, BUFSIZ);
|
||||
|
||||
ble->readData(buffer, BUFSIZ);
|
||||
ble->readData(buffer, BUFSIZ - 1);
|
||||
cout << "Returned: " << buffer << endl;
|
||||
}
|
||||
else
|
||||
|
@ -23,6 +23,7 @@
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <iostream>
|
||||
#include <signal.h>
|
||||
#include "hmtrp.h"
|
||||
@ -128,7 +129,8 @@ int main (int argc, char **argv)
|
||||
// check to see if data is available first.
|
||||
if (radio->dataAvailable())
|
||||
{
|
||||
int rv = radio->readData(radioBuffer, bufferLength);
|
||||
memset(radioBuffer, 0, bufferLength);
|
||||
int rv = radio->readData(radioBuffer, bufferLength - 1);
|
||||
|
||||
if (rv > 0)
|
||||
cout << "Received: " << radioBuffer << endl;
|
||||
|
70
examples/c++/hp20x.cxx
Normal file
@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Author: Jon Trulson <jtrulson@ics.com>
|
||||
* Copyright (c) 2015 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include <iostream>
|
||||
#include "hp20x.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace upm;
|
||||
|
||||
int shouldRun = true;
|
||||
|
||||
void sig_handler(int signo)
|
||||
{
|
||||
if (signo == SIGINT)
|
||||
shouldRun = false;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
signal(SIGINT, sig_handler);
|
||||
|
||||
//! [Interesting]
|
||||
// Instantiate an HP20X on default I2C bus and address
|
||||
|
||||
upm::HP20X *bar = new upm::HP20X();
|
||||
|
||||
// Initialize the device with default values
|
||||
bar->init();
|
||||
|
||||
// Output data every second until interrupted
|
||||
while (shouldRun)
|
||||
{
|
||||
printf("Temperature: %f Celcius\n", bar->getTemperature());
|
||||
printf("Pressure: %f Millibars\n", bar->getPressure());
|
||||
printf("Altitude: %f Meters\n", bar->getAltitude());
|
||||
|
||||
printf("\n");
|
||||
|
||||
sleep(1);
|
||||
}
|
||||
//! [Interesting]
|
||||
|
||||
cout << "Exiting..." << endl;
|
||||
|
||||
delete bar;
|
||||
return 0;
|
||||
}
|
@ -34,6 +34,10 @@ main(int argc, char **argv)
|
||||
lcd->write("Hello World");
|
||||
lcd->setCursor(1,2);
|
||||
lcd->write("Hello World");
|
||||
|
||||
printf("Sleeping for 5 seconds\n");
|
||||
sleep(5);
|
||||
delete lcd;
|
||||
//! [Interesting]
|
||||
return 0;
|
||||
}
|
||||
|
@ -32,11 +32,17 @@ main(int argc, char **argv)
|
||||
lcd->setCursor(0,0);
|
||||
lcd->write("Hello World");
|
||||
//! [Interesting]
|
||||
sleep(3);
|
||||
lcd->setCursor(1,2);
|
||||
lcd->write("Hello World");
|
||||
sleep(3);
|
||||
lcd->setCursor(2,4);
|
||||
lcd->write("Hello World");
|
||||
sleep(3);
|
||||
lcd->setCursor(3,6);
|
||||
lcd->write("Hello World");
|
||||
sleep(3);
|
||||
delete lcd;
|
||||
|
||||
return 0;
|
||||
}
|
54
examples/c++/lcm1602-parallel.cxx
Normal file
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Author: Sergey Kiselev <sergey.kiselev@intel.com>
|
||||
* Author: Yevgeniy Kiveish <yevgeniy.kiveisha@intel.com>
|
||||
* Copyright (c) 2014 - 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 <lcm1602.h>
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
//! [Interesting]
|
||||
// LCD connection:
|
||||
// LCD RS pin to digital pin 8
|
||||
// LCD Enable pin to digital pin 13
|
||||
// LCD D4 pin to digital pin 2
|
||||
// LCD D5 pin to digital pin 3
|
||||
// LCD D6 pin to digital pin 4
|
||||
// LCD D7 pin to digital pin 5
|
||||
// LCD R/W pin to ground
|
||||
// 10K trimmer potentiometer:
|
||||
// ends to +5V and ground
|
||||
// wiper to LCD VO pin (pin 3)
|
||||
upm::Lcm1602 *lcd = new upm::Lcm1602(8, 13, 2, 3, 4, 5, 20, 2);
|
||||
lcd->setCursor(0,0);
|
||||
lcd->write("Hello World");
|
||||
lcd->setCursor(1,2);
|
||||
lcd->write("Hello World");
|
||||
|
||||
printf("Sleeping for 5 seconds\n");
|
||||
sleep(5);
|
||||
delete lcd;
|
||||
//! [Interesting]
|
||||
return 0;
|
||||
}
|
65
examples/c++/lm35.cxx
Normal file
@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Author: Jon Trulson <jtrulson@ics.com>
|
||||
* Copyright (c) 2015 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <iostream>
|
||||
#include <signal.h>
|
||||
#include "lm35.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
bool shouldRun = true;
|
||||
|
||||
void sig_handler(int signo)
|
||||
{
|
||||
if (signo == SIGINT)
|
||||
shouldRun = false;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
signal(SIGINT, sig_handler);
|
||||
|
||||
//! [Interesting]
|
||||
|
||||
// Instantiate a LM35 on analog pin A0, with a default analog
|
||||
// reference voltage of 5.0
|
||||
upm::LM35 *sensor = new upm::LM35(0);
|
||||
|
||||
// Every half second, sample the sensor and output the temperature
|
||||
|
||||
while (shouldRun)
|
||||
{
|
||||
cout << "Temperature: " << sensor->getTemperature() << " C" << endl;
|
||||
|
||||
usleep(500000);
|
||||
}
|
||||
|
||||
//! [Interesting]
|
||||
|
||||
cout << "Exiting" << endl;
|
||||
|
||||
delete sensor;
|
||||
return 0;
|
||||
}
|
68
examples/c++/loudness.cxx
Normal file
@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Author: Jon Trulson <jtrulson@ics.com>
|
||||
* Copyright (c) 2015 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <iostream>
|
||||
#include <signal.h>
|
||||
#include "loudness.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
bool shouldRun = true;
|
||||
|
||||
#define LOUDNESS_AREF 5.0
|
||||
|
||||
void sig_handler(int signo)
|
||||
{
|
||||
if (signo == SIGINT)
|
||||
shouldRun = false;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
signal(SIGINT, sig_handler);
|
||||
|
||||
//! [Interesting]
|
||||
|
||||
// Instantiate a Loudness sensor on analog pin A0, with an analog
|
||||
// reference voltage of LOUDNESS_AREF
|
||||
upm::Loudness *loud = new upm::Loudness(0, LOUDNESS_AREF);
|
||||
|
||||
// Every tenth of a second, sample the loudness and output it's
|
||||
// corresponding analog voltage.
|
||||
|
||||
while (shouldRun)
|
||||
{
|
||||
cout << "Detected loudness (volts): " << loud->loudness() << endl;
|
||||
|
||||
usleep(100000);
|
||||
}
|
||||
|
||||
//! [Interesting]
|
||||
|
||||
cout << "Exiting" << endl;
|
||||
|
||||
delete loud;
|
||||
return 0;
|
||||
}
|
83
examples/c++/lsm9ds0.cxx
Normal file
@ -0,0 +1,83 @@
|
||||
/*
|
||||
* Author: Jon Trulson <jtrulson@ics.com>
|
||||
* Copyright (c) 2015 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <iostream>
|
||||
#include <signal.h>
|
||||
#include "lsm9ds0.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
int shouldRun = true;
|
||||
|
||||
void sig_handler(int signo)
|
||||
{
|
||||
if (signo == SIGINT)
|
||||
shouldRun = false;
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
signal(SIGINT, sig_handler);
|
||||
//! [Interesting]
|
||||
|
||||
// Instantiate an LSM9DS0 using default parameters (bus 1, gyro addr 6b,
|
||||
// xm addr 1d)
|
||||
upm::LSM9DS0 *sensor = new upm::LSM9DS0();
|
||||
|
||||
sensor->init();
|
||||
|
||||
while (shouldRun)
|
||||
{
|
||||
sensor->update();
|
||||
|
||||
float x, y, z;
|
||||
|
||||
sensor->getAccelerometer(&x, &y, &z);
|
||||
cout << "Accelerometer: ";
|
||||
cout << "AX: " << x << " AY: " << y << " AZ: " << z << endl;
|
||||
|
||||
sensor->getGyroscope(&x, &y, &z);
|
||||
cout << "Gryoscope: ";
|
||||
cout << "GX: " << x << " GY: " << y << " GZ: " << z << endl;
|
||||
|
||||
sensor->getMagnetometer(&x, &y, &z);
|
||||
cout << "Magnetometer: ";
|
||||
cout << "MX = " << x << " MY = " << y << " MZ = " << z << endl;
|
||||
|
||||
cout << "Temperature: " << sensor->getTemperature() << endl;
|
||||
cout << endl;
|
||||
|
||||
usleep(500000);
|
||||
}
|
||||
|
||||
//! [Interesting]
|
||||
|
||||
cout << "Exiting..." << endl;
|
||||
|
||||
delete sensor;
|
||||
|
||||
return 0;
|
||||
}
|
65
examples/c++/m24lr64e.cxx
Normal file
@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Author: Jon Trulson <jtrulson@ics.com>
|
||||
* Copyright (c) 2015 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <iostream>
|
||||
#include "m24lr64e.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace upm;
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
//! [Interesting]
|
||||
// Instantiate an M24LR64E on I2C bus 0
|
||||
|
||||
upm::M24LR64E *nfcTag = new upm::M24LR64E(M24LR64E_I2C_BUS);
|
||||
|
||||
// This example accesses the device in the 'user' (default) mode,
|
||||
// reads the last byte of data in the EEPROM, inverts it, writes
|
||||
// it back, and then re-reads it.
|
||||
|
||||
// Read the last byte of the EEPROM area
|
||||
|
||||
int addr = M24LR64E::EEPROM_I2C_LENGTH - 1;
|
||||
printf("Address: %d\n", addr);
|
||||
uint8_t byte = nfcTag->readByte(addr);
|
||||
printf("Read byte: %02x\n", byte);
|
||||
|
||||
// Now change it to it's opposite and write it
|
||||
byte = ~byte;
|
||||
nfcTag->writeByte(addr, byte);
|
||||
printf("Wrote inverted byte: %02x\n", byte);
|
||||
|
||||
// Now read it back.
|
||||
byte = nfcTag->readByte(addr);
|
||||
printf("Read byte: %02x\n", byte);
|
||||
|
||||
//! [Interesting]
|
||||
|
||||
cout << "Exiting..." << endl;
|
||||
|
||||
delete nfcTag;
|
||||
return 0;
|
||||
}
|
163
examples/c++/mcp9808.cxx
Normal file
@ -0,0 +1,163 @@
|
||||
#include <iostream>
|
||||
#include <unistd.h>
|
||||
#include "mcp9808.h"
|
||||
|
||||
#include "mraa.hpp"
|
||||
|
||||
int main()
|
||||
{
|
||||
using namespace std;
|
||||
|
||||
//! [Interesting]
|
||||
int command;
|
||||
upm::MCP9808 *temp = new upm::MCP9808(6);
|
||||
|
||||
do
|
||||
{
|
||||
cout << endl;
|
||||
cout << "1 - read temp \t" ;
|
||||
cout << "2 - sleep mode \t";
|
||||
cout << "3 - wake up" << endl;
|
||||
cout << "4 - set mode to " << (temp->isCelsius() == true ? "Fahrenheit" : "Celcius") << endl;
|
||||
cout << "5 - show status bits" << endl;
|
||||
cout << "6 - Set Tcrit \t" ;
|
||||
cout << "7 - Set Tupper \t" ;
|
||||
cout << "8 - Set Tlower " << endl;
|
||||
cout << "9 - Display monitor temps " << endl;
|
||||
cout << "10 - Enable alert default\t";
|
||||
cout << "11 - Enable alert interrupt" << endl;
|
||||
cout << "12 - Clear interrupt \t" ;
|
||||
cout << "13 - Clear alert mode" << endl;
|
||||
cout << "14 - Get Hysteresis\t";
|
||||
cout << "15 - Set Hysteresis" << endl;
|
||||
cout << "16 - Get Resolution\t";
|
||||
cout << "17 - Set Resolution" << endl;
|
||||
cout << "18 - Get Manufacturer ID"<< endl;
|
||||
cout << "19 - Get Device ID" << endl;
|
||||
cout << "-1 - exit" << endl;
|
||||
cout << "Enter a command: ";
|
||||
cin >> command;
|
||||
|
||||
switch(command)
|
||||
{
|
||||
float t;
|
||||
case 1:
|
||||
std::cout << "Temp: " << temp->getTemp() << "° " << (temp->isCelsius()? "Celsius" : "Fahrenheit")<< std::endl;
|
||||
break;
|
||||
case 2:
|
||||
cout << "shutdown sensor (sleep mode)" << endl;
|
||||
temp->shutDown();
|
||||
break;
|
||||
case 3:
|
||||
cout << "wake up sensor" << endl;
|
||||
temp->shutDown(false);
|
||||
break;
|
||||
case 4:
|
||||
cout << "set mode to " << (temp->isCelsius() ? "Fahrenheit" : "Celcius") << endl;
|
||||
temp->setMode(!temp->isCelsius());
|
||||
break;
|
||||
case 5:
|
||||
cout << "Tcrit = " << temp->isTcrit();
|
||||
cout << " Tupper = " << temp->isTupper();
|
||||
cout << " Tlower = " << temp->isTlower();
|
||||
break;
|
||||
case 6:
|
||||
cout << "enter a value";
|
||||
cin >> t;
|
||||
temp->setMonitorReg(temp->CRIT_TEMP, t);
|
||||
break;
|
||||
case 7:
|
||||
cout << "enter a value";
|
||||
cin >> t;
|
||||
temp->setMonitorReg(temp->UPPER_TEMP, t);
|
||||
break;
|
||||
case 8:
|
||||
cout << "enter a value";
|
||||
cin >> t;
|
||||
temp->setMonitorReg(temp->LOWER_TEMP, t);
|
||||
break;
|
||||
case 9:
|
||||
cout << "tcrit = " << temp->getMonitorReg(temp->CRIT_TEMP) << endl;
|
||||
cout << "tupper = " << temp->getMonitorReg(temp->UPPER_TEMP) << endl;
|
||||
cout << "tlower = " << temp->getMonitorReg(temp->LOWER_TEMP) << endl;
|
||||
break;
|
||||
case 10:
|
||||
cout << "set alert mode default" ;
|
||||
temp->setAlertMode(temp->ALERTCTRL);
|
||||
break;
|
||||
case 11:
|
||||
cout << "set alert mode interrupt";
|
||||
temp->setAlertMode(temp->ALERTMODE | temp->ALERTCTRL );
|
||||
break;
|
||||
case 12:
|
||||
temp->clearInterrupt();
|
||||
break;
|
||||
case 13:
|
||||
cout << "Clear alerts" << endl;
|
||||
temp->clearAlertMode();
|
||||
break;
|
||||
case 14:
|
||||
cout << "Hysteresis: " << temp->getHysteresis() << endl;
|
||||
break;
|
||||
case 15:
|
||||
int u;
|
||||
cout << "enter 1 to 4";
|
||||
cin >> u ;
|
||||
switch(u)
|
||||
{
|
||||
case 1:
|
||||
temp->setHysteresis(temp->HYST_0);
|
||||
break;
|
||||
case 2:
|
||||
temp->setHysteresis(temp->HYST_1_5);
|
||||
break;
|
||||
case 3:
|
||||
temp->setHysteresis(temp->HYST_3_0);
|
||||
break;
|
||||
case 4:
|
||||
default:
|
||||
temp->setHysteresis(temp->HYST_6_0);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 16:
|
||||
cout << "Resolution: " << temp->getResolution() << endl;
|
||||
break;
|
||||
case 17:
|
||||
int v;
|
||||
cout << "enter 1 to 4";
|
||||
cin >> v ;
|
||||
switch(v)
|
||||
{
|
||||
case 1:
|
||||
temp->setResolution(temp->RES_LOW);
|
||||
break;
|
||||
case 2:
|
||||
temp->setResolution(temp->RES_MEDIUM);
|
||||
break;
|
||||
case 3:
|
||||
temp->setResolution(temp->RES_HIGH);
|
||||
break;
|
||||
case 4:
|
||||
default:
|
||||
temp->setResolution(temp->RES_PRECISION);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 18:
|
||||
cout << "Manufacturer ID: " << std::hex << temp->getManufacturer() << endl;
|
||||
break;
|
||||
case 19:
|
||||
cout << "Get device ID: " << std::hex << temp->getDevicedId() << endl;
|
||||
break;
|
||||
case -1:
|
||||
break;
|
||||
default:
|
||||
cout << endl << "That option is not available. Try again" << endl;
|
||||
break;
|
||||
}
|
||||
|
||||
}while (command != -1 );
|
||||
//! [Interesting]
|
||||
return MRAA_SUCCESS;
|
||||
}
|
68
examples/c++/mg811.cxx
Normal file
@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Author: Jon Trulson <jtrulson@ics.com>
|
||||
* Copyright (c) 2015 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <iostream>
|
||||
#include <signal.h>
|
||||
#include "mg811.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
bool shouldRun = true;
|
||||
|
||||
#define MG811_AREF 5.0
|
||||
|
||||
void sig_handler(int signo)
|
||||
{
|
||||
if (signo == SIGINT)
|
||||
shouldRun = false;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
signal(SIGINT, sig_handler);
|
||||
|
||||
//! [Interesting]
|
||||
|
||||
// Instantiate an MG811 on analog pin A0, and digital pin D2 with an
|
||||
// analog reference voltage of MG811_AREF (5.0)
|
||||
upm::MG811 *sensor = new upm::MG811(0, 2, MG811_AREF);
|
||||
|
||||
// Every tenth of a second, sample the sensor and output it's
|
||||
// detected CO2 concentration in parts per million (ppm)
|
||||
|
||||
while (shouldRun)
|
||||
{
|
||||
cout << "CO2 concentration in PPM: " << sensor->ppm() << endl;
|
||||
|
||||
usleep(100000);
|
||||
}
|
||||
|
||||
//! [Interesting]
|
||||
|
||||
cout << "Exiting" << endl;
|
||||
|
||||
delete sensor;
|
||||
return 0;
|
||||
}
|
@ -62,14 +62,15 @@ int main (int argc, char **argv)
|
||||
|
||||
sleep(1);
|
||||
|
||||
int gas;
|
||||
int temp;
|
||||
|
||||
while (shouldRun)
|
||||
{
|
||||
co2->getData(&gas, &temp);
|
||||
cout << "CO2 concentration: " << gas << " PPM, "
|
||||
<< "Temperature (in C): " << temp <<endl;
|
||||
if(!co2->getData()){
|
||||
cerr << "Failed to retrieve data" << endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
cout << "CO2 concentration: " << co2->getGas() << " PPM, "
|
||||
<< "Temperature (in C): " << co2->getTemperature() <<endl;
|
||||
|
||||
sleep(2);
|
||||
}
|
||||
|
78
examples/c++/micsv89.cxx
Normal file
@ -0,0 +1,78 @@
|
||||
/*
|
||||
* Author: Marc Graham <marc@m2ag.net>
|
||||
* Copyright (c) 2015 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* 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 <unistd.h>
|
||||
#include <signal.h>
|
||||
#include "micsv89.h"
|
||||
|
||||
/*
|
||||
* An example for using the MICSV89 sensor library.
|
||||
* The MICSV89 comes in 4 variants, PWM and I2c
|
||||
* in 3.3 volts and 5 volts. This library only implements
|
||||
* the I2c version of the device.
|
||||
*
|
||||
* Device output is not valid until a warm up of 15 minutes
|
||||
* of operation.
|
||||
*
|
||||
* Additional linker flags: -lupm-micsv89
|
||||
*/
|
||||
|
||||
using namespace std;
|
||||
|
||||
volatile int running = 1;
|
||||
|
||||
void
|
||||
sig_handler(int signo)
|
||||
{
|
||||
if (signo == SIGINT) {
|
||||
cout << "Exiting program." << endl;
|
||||
running = 0;
|
||||
}
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
signal(SIGINT, sig_handler);
|
||||
|
||||
//! [Interesting]
|
||||
upm::MICSV89 *sensor = new upm::MICSV89(6);
|
||||
|
||||
while(running)
|
||||
{
|
||||
sensor->update();
|
||||
while(!sensor->valid());
|
||||
cout << "co2: " << sensor->co2equ() << endl;
|
||||
cout << "short: " << sensor->vocshort() << endl;
|
||||
cout << "tvoc: " << sensor->tvoc() << endl;
|
||||
cout << "resistor: " << sensor->resistor() << endl;
|
||||
cout << "****************************" << endl;
|
||||
sleep(5);
|
||||
}
|
||||
|
||||
delete sensor;
|
||||
//! [Interesting]
|
||||
|
||||
return MRAA_SUCCESS;
|
||||
}
|
77
examples/c++/mpu60x0.cxx
Normal file
@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Author: Jon Trulson <jtrulson@ics.com>
|
||||
* Copyright (c) 2015 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <iostream>
|
||||
#include <signal.h>
|
||||
#include "mpu9150.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
int shouldRun = true;
|
||||
|
||||
void sig_handler(int signo)
|
||||
{
|
||||
if (signo == SIGINT)
|
||||
shouldRun = false;
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
signal(SIGINT, sig_handler);
|
||||
//! [Interesting]
|
||||
|
||||
upm::MPU60X0 *sensor = new upm::MPU60X0();
|
||||
|
||||
sensor->init();
|
||||
|
||||
while (shouldRun)
|
||||
{
|
||||
sensor->update();
|
||||
|
||||
float x, y, z;
|
||||
|
||||
sensor->getAccelerometer(&x, &y, &z);
|
||||
cout << "Accelerometer: ";
|
||||
cout << "AX: " << x << " AY: " << y << " AZ: " << z << endl;
|
||||
|
||||
sensor->getGyroscope(&x, &y, &z);
|
||||
cout << "Gryoscope: ";
|
||||
cout << "GX: " << x << " GY: " << y << " GZ: " << z << endl;
|
||||
|
||||
cout << "Temperature: " << sensor->getTemperature() << endl;
|
||||
cout << endl;
|
||||
|
||||
usleep(500000);
|
||||
}
|
||||
|
||||
//! [Interesting]
|
||||
|
||||
cout << "Exiting..." << endl;
|
||||
|
||||
delete sensor;
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
|
||||
* Copyright (c) 2014 Intel Corporation.
|
||||
* Author: Jon Trulson <jtrulson@ics.com>
|
||||
* Copyright (c) 2015 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
@ -24,36 +24,58 @@
|
||||
|
||||
#include <unistd.h>
|
||||
#include <iostream>
|
||||
#include <signal.h>
|
||||
#include "mpu9150.h"
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
using namespace std;
|
||||
|
||||
int shouldRun = true;
|
||||
|
||||
void sig_handler(int signo)
|
||||
{
|
||||
//! [Interesting]
|
||||
upm::Vector3D data;
|
||||
upm::MPU9150 *sensor = new upm::MPU9150(0, ADDR);
|
||||
sensor->getData ();
|
||||
sensor->getAcceleromter (&data);
|
||||
std::cout << "*************************************************" << std::endl;
|
||||
std::cout << "DEVICE ID (" << (int) sensor->getDeviceID () << ")" << std::endl;
|
||||
std::cout << "*************************************************" << std::endl;
|
||||
std::cout << "ACCELEROMETER :: X (" << data.axisX << ")" << " Y (" << data.axisY << ")"
|
||||
<< " Z (" << data.axisZ << ")" << std::endl;
|
||||
|
||||
sensor->getGyro (&data);
|
||||
std::cout << "GYRO :: X (" << data.axisX << ")" << " Y (" << data.axisY << ")"
|
||||
<< " Z (" << data.axisZ << ")" << std::endl;
|
||||
|
||||
sensor->getMagnometer (&data);
|
||||
std::cout << "MAGNOMETER :: X (" << data.axisX << ")" << " Y (" << data.axisY << ")"
|
||||
<< " Z (" << data.axisZ << ")" << std::endl;
|
||||
std::cout << "TEMPERATURE (" << sensor->getTemperature () << ")" << std::endl;
|
||||
std::cout << "*************************************************" << std::endl;
|
||||
//! [Interesting]
|
||||
|
||||
std::cout << "exiting application" << std::endl;
|
||||
|
||||
delete sensor;
|
||||
|
||||
return 0;
|
||||
if (signo == SIGINT)
|
||||
shouldRun = false;
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
signal(SIGINT, sig_handler);
|
||||
//! [Interesting]
|
||||
|
||||
upm::MPU9150 *sensor = new upm::MPU9150();
|
||||
|
||||
sensor->init();
|
||||
|
||||
while (shouldRun)
|
||||
{
|
||||
sensor->update();
|
||||
|
||||
float x, y, z;
|
||||
|
||||
sensor->getAccelerometer(&x, &y, &z);
|
||||
cout << "Accelerometer: ";
|
||||
cout << "AX: " << x << " AY: " << y << " AZ: " << z << endl;
|
||||
|
||||
sensor->getGyroscope(&x, &y, &z);
|
||||
cout << "Gryoscope: ";
|
||||
cout << "GX: " << x << " GY: " << y << " GZ: " << z << endl;
|
||||
|
||||
sensor->getMagnetometer(&x, &y, &z);
|
||||
cout << "Magnetometer: ";
|
||||
cout << "MX = " << x << " MY = " << y << " MZ = " << z << endl;
|
||||
|
||||
cout << "Temperature: " << sensor->getTemperature() << endl;
|
||||
cout << endl;
|
||||
|
||||
usleep(500000);
|
||||
}
|
||||
|
||||
//! [Interesting]
|
||||
|
||||
cout << "Exiting..." << endl;
|
||||
|
||||
delete sensor;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
81
examples/c++/mpu9250.cxx
Normal file
@ -0,0 +1,81 @@
|
||||
/*
|
||||
* Author: Jon Trulson <jtrulson@ics.com>
|
||||
* Copyright (c) 2015 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <iostream>
|
||||
#include <signal.h>
|
||||
#include "mpu9250.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
int shouldRun = true;
|
||||
|
||||
void sig_handler(int signo)
|
||||
{
|
||||
if (signo == SIGINT)
|
||||
shouldRun = false;
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
signal(SIGINT, sig_handler);
|
||||
//! [Interesting]
|
||||
|
||||
upm::MPU9250 *sensor = new upm::MPU9250();
|
||||
|
||||
sensor->init();
|
||||
|
||||
while (shouldRun)
|
||||
{
|
||||
sensor->update();
|
||||
|
||||
float x, y, z;
|
||||
|
||||
sensor->getAccelerometer(&x, &y, &z);
|
||||
cout << "Accelerometer: ";
|
||||
cout << "AX: " << x << " AY: " << y << " AZ: " << z << endl;
|
||||
|
||||
sensor->getGyroscope(&x, &y, &z);
|
||||
cout << "Gryoscope: ";
|
||||
cout << "GX: " << x << " GY: " << y << " GZ: " << z << endl;
|
||||
|
||||
sensor->getMagnetometer(&x, &y, &z);
|
||||
cout << "Magnetometer: ";
|
||||
cout << "MX = " << x << " MY = " << y << " MZ = " << z << endl;
|
||||
|
||||
cout << "Temperature: " << sensor->getTemperature() << endl;
|
||||
cout << endl;
|
||||
|
||||
usleep(500000);
|
||||
}
|
||||
|
||||
//! [Interesting]
|
||||
|
||||
cout << "Exiting..." << endl;
|
||||
|
||||
delete sensor;
|
||||
|
||||
return 0;
|
||||
}
|
81
examples/c++/mq4.cxx
Normal file
@ -0,0 +1,81 @@
|
||||
/*
|
||||
* Author: Jon Trulson <jtrulson@ics.com>
|
||||
* Copyright (c) 2015 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <iostream>
|
||||
#include "mq4.h"
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
bool shouldRun = true;
|
||||
|
||||
using namespace std;
|
||||
|
||||
void
|
||||
sig_handler(int signo)
|
||||
{
|
||||
if (signo == SIGINT)
|
||||
{
|
||||
shouldRun = false;
|
||||
}
|
||||
}
|
||||
|
||||
//! [Interesting]
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
// Attach gas sensor to Analog A0
|
||||
upm::MQ4 *sensor = new upm::MQ4(0);
|
||||
signal(SIGINT, sig_handler);
|
||||
|
||||
uint16_t buffer [128];
|
||||
|
||||
thresholdContext ctx;
|
||||
ctx.averageReading = 0;
|
||||
ctx.runningAverage = 0;
|
||||
ctx.averagedOver = 2;
|
||||
|
||||
// Infinite loop, ends when script is cancelled
|
||||
// Repeatedly, take a sample every 2 microseconds;
|
||||
// find the average of 128 samples; and
|
||||
// print a running graph of asteriskss as averages
|
||||
while (shouldRun)
|
||||
{
|
||||
int len = sensor->getSampledWindow (2, 128, buffer);
|
||||
if (len) {
|
||||
int thresh = sensor->findThreshold (&ctx, 30, buffer, len);
|
||||
sensor->printGraph(&ctx, 5);
|
||||
if (thresh) {
|
||||
// do something ....
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cout << "Exiting" << endl;
|
||||
|
||||
delete sensor;
|
||||
|
||||
return 0;
|
||||
}
|
||||
//! [Interesting]
|
81
examples/c++/mq6.cxx
Normal file
@ -0,0 +1,81 @@
|
||||
/*
|
||||
* Author: Jon Trulson <jtrulson@ics.com>
|
||||
* Copyright (c) 2015 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <iostream>
|
||||
#include "mq6.h"
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
bool shouldRun = true;
|
||||
|
||||
using namespace std;
|
||||
|
||||
void
|
||||
sig_handler(int signo)
|
||||
{
|
||||
if (signo == SIGINT)
|
||||
{
|
||||
shouldRun = false;
|
||||
}
|
||||
}
|
||||
|
||||
//! [Interesting]
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
// Attach gas sensor to Analog A0
|
||||
upm::MQ6 *sensor = new upm::MQ6(0);
|
||||
signal(SIGINT, sig_handler);
|
||||
|
||||
uint16_t buffer [128];
|
||||
|
||||
thresholdContext ctx;
|
||||
ctx.averageReading = 0;
|
||||
ctx.runningAverage = 0;
|
||||
ctx.averagedOver = 2;
|
||||
|
||||
// Infinite loop, ends when script is cancelled
|
||||
// Repeatedly, take a sample every 2 microseconds;
|
||||
// find the average of 128 samples; and
|
||||
// print a running graph of asteriskss as averages
|
||||
while (shouldRun)
|
||||
{
|
||||
int len = sensor->getSampledWindow (2, 128, buffer);
|
||||
if (len) {
|
||||
int thresh = sensor->findThreshold (&ctx, 30, buffer, len);
|
||||
sensor->printGraph(&ctx, 5);
|
||||
if (thresh) {
|
||||
// do something ....
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cout << "Exiting" << endl;
|
||||
|
||||
delete sensor;
|
||||
|
||||
return 0;
|
||||
}
|
||||
//! [Interesting]
|
81
examples/c++/mq7.cxx
Normal file
@ -0,0 +1,81 @@
|
||||
/*
|
||||
* Author: Jon Trulson <jtrulson@ics.com>
|
||||
* Copyright (c) 2015 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <iostream>
|
||||
#include "mq7.h"
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
bool shouldRun = true;
|
||||
|
||||
using namespace std;
|
||||
|
||||
void
|
||||
sig_handler(int signo)
|
||||
{
|
||||
if (signo == SIGINT)
|
||||
{
|
||||
shouldRun = false;
|
||||
}
|
||||
}
|
||||
|
||||
//! [Interesting]
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
// Attach gas sensor to Analog A0
|
||||
upm::MQ7 *sensor = new upm::MQ7(0);
|
||||
signal(SIGINT, sig_handler);
|
||||
|
||||
uint16_t buffer [128];
|
||||
|
||||
thresholdContext ctx;
|
||||
ctx.averageReading = 0;
|
||||
ctx.runningAverage = 0;
|
||||
ctx.averagedOver = 2;
|
||||
|
||||
// Infinite loop, ends when script is cancelled
|
||||
// Repeatedly, take a sample every 2 microseconds;
|
||||
// find the average of 128 samples; and
|
||||
// print a running graph of asteriskss as averages
|
||||
while (shouldRun)
|
||||
{
|
||||
int len = sensor->getSampledWindow (2, 128, buffer);
|
||||
if (len) {
|
||||
int thresh = sensor->findThreshold (&ctx, 30, buffer, len);
|
||||
sensor->printGraph(&ctx, 5);
|
||||
if (thresh) {
|
||||
// do something ....
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cout << "Exiting" << endl;
|
||||
|
||||
delete sensor;
|
||||
|
||||
return 0;
|
||||
}
|
||||
//! [Interesting]
|
81
examples/c++/mq8.cxx
Normal file
@ -0,0 +1,81 @@
|
||||
/*
|
||||
* Author: Jon Trulson <jtrulson@ics.com>
|
||||
* Copyright (c) 2015 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <iostream>
|
||||
#include "mq8.h"
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
bool shouldRun = true;
|
||||
|
||||
using namespace std;
|
||||
|
||||
void
|
||||
sig_handler(int signo)
|
||||
{
|
||||
if (signo == SIGINT)
|
||||
{
|
||||
shouldRun = false;
|
||||
}
|
||||
}
|
||||
|
||||
//! [Interesting]
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
// Attach gas sensor to Analog A0
|
||||
upm::MQ8 *sensor = new upm::MQ8(0);
|
||||
signal(SIGINT, sig_handler);
|
||||
|
||||
uint16_t buffer [128];
|
||||
|
||||
thresholdContext ctx;
|
||||
ctx.averageReading = 0;
|
||||
ctx.runningAverage = 0;
|
||||
ctx.averagedOver = 2;
|
||||
|
||||
// Infinite loop, ends when script is cancelled
|
||||
// Repeatedly, take a sample every 2 microseconds;
|
||||
// find the average of 128 samples; and
|
||||
// print a running graph of asteriskss as averages
|
||||
while (shouldRun)
|
||||
{
|
||||
int len = sensor->getSampledWindow (2, 128, buffer);
|
||||
if (len) {
|
||||
int thresh = sensor->findThreshold (&ctx, 30, buffer, len);
|
||||
sensor->printGraph(&ctx, 5);
|
||||
if (thresh) {
|
||||
// do something ....
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cout << "Exiting" << endl;
|
||||
|
||||
delete sensor;
|
||||
|
||||
return 0;
|
||||
}
|
||||
//! [Interesting]
|
@ -60,7 +60,7 @@ main(int argc, char **argv)
|
||||
comm->configure ();
|
||||
comm->setSpeedRate (upm::NRF_250KBPS);
|
||||
comm->setChannel (99);
|
||||
comm->dataRecievedHandler = nrf_handler;
|
||||
comm->setDataReceivedHandler (nrf_handler);
|
||||
|
||||
signal(SIGINT, sig_handler);
|
||||
|
||||
|
@ -58,7 +58,7 @@ main(int argc, char **argv)
|
||||
comm->setPayload (MAX_BUFFER);
|
||||
comm->setChannel (99);
|
||||
comm->configure ();
|
||||
comm->dataRecievedHandler = nrf_handler;
|
||||
comm->setDataReceivedHandler (nrf_handler);
|
||||
|
||||
signal(SIGINT, sig_handler);
|
||||
|
||||
|
@ -49,7 +49,7 @@ int main()
|
||||
|
||||
// Instantiate a OTP538U on analog pins A0 and A1
|
||||
// A0 is used for the Ambient Temperature and A1 is used for the
|
||||
// Object tempewrature.
|
||||
// Object temperature.
|
||||
upm::OTP538U *temps = new upm::OTP538U(0, 1, OTP538U_AREF);
|
||||
|
||||
// Output ambient and object temperatures
|
||||
|
141
examples/c++/ozw.cxx
Normal file
@ -0,0 +1,141 @@
|
||||
/*
|
||||
* Author: Jon Trulson <jtrulson@ics.com>
|
||||
* Copyright (c) 2015 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <iostream>
|
||||
|
||||
#include "ozw.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
//! [Interesting]
|
||||
|
||||
string defaultDev = "/dev/ttyACM0";
|
||||
|
||||
// if an argument was specified, use it as the device instead
|
||||
if (argc > 1)
|
||||
defaultDev = string(argv[1]);
|
||||
|
||||
// Instantiate an OZW instance
|
||||
upm::OZW *sensor = new upm::OZW();
|
||||
|
||||
// The first thing to do is create options, then lock them when done.
|
||||
sensor->optionsCreate();
|
||||
sensor->optionsLock();
|
||||
|
||||
// Next, initialize it.
|
||||
cout << "Initializing, this may take awhile depending on your ZWave network"
|
||||
<< endl;
|
||||
|
||||
if (!sensor->init(defaultDev))
|
||||
{
|
||||
cerr << "Init failed." << endl;
|
||||
return 0;
|
||||
}
|
||||
cout << "Initialization complete" << endl;
|
||||
|
||||
cout << "Dumping nodes..." << endl;
|
||||
|
||||
sensor->dumpNodes();
|
||||
|
||||
// The following is example output of dumpNodes:
|
||||
//
|
||||
// Dumping nodes...
|
||||
// Node 1: Z-Stick Gen5
|
||||
// Node 2: Smart Switch 6
|
||||
// Index: 0, Type: bool, Label: Switch, Value: False
|
||||
// Index: 2, Type: float, Label: Energy, Value: 1.190 kWh
|
||||
// Index: 3, Type: float, Label: Previous Reading, Value: 1.190 kWh
|
||||
// Index: 4, Type: int32, Label: Interval, Value: 1521 seconds
|
||||
// Index: 5, Type: float, Label: Power, Value: 0.000 W
|
||||
// Index: 6, Type: float, Label: Voltage, Value: 121.256 V
|
||||
// Index: 7, Type: float, Label: Current, Value: 0.000 A
|
||||
// Index: 8, Type: bool, Label: Exporting, Value: False
|
||||
// Index: 45, Type: list, Label: Day, Value: Friday
|
||||
// Index: 46, Type: byte, Label: Hour, Value: 5
|
||||
// Index: 47, Type: byte, Label: Minute, Value: 53
|
||||
// Node 3: Multi Sensor
|
||||
// Index: 0, Type: bool, Label: Sensor, Value: True
|
||||
// Index: 1, Type: float, Label: Temperature, Value: 72.8 F
|
||||
// Index: 2, Type: float, Label: Luminance, Value: 4 lux
|
||||
// Index: 3, Type: float, Label: Relative Humidity, Value: 22 %
|
||||
// Index: 17, Type: byte, Label: Battery Level, Value: 98 %
|
||||
// Node 5: Minimote
|
||||
// Node 6: Smart Energy Switch
|
||||
// Index: 0, Type: bool, Label: Switch, Value: False
|
||||
// Index: 2, Type: float, Label: Power, Value: 0.000 W
|
||||
// Index: 3, Type: float, Label: Energy, Value: 1.609 kWh
|
||||
// Index: 4, Type: float, Label: Previous Reading, Value: 1.609 kWh
|
||||
// Index: 5, Type: int32, Label: Interval, Value: 1521 seconds
|
||||
// Index: 6, Type: float, Label: Power, Value: 0.000 W
|
||||
// Index: 7, Type: float, Label: Previous Reading, Value: 1.609 W
|
||||
// Index: 8, Type: int32, Label: Interval, Value: 1521 seconds
|
||||
// Index: 9, Type: bool, Label: Exporting, Value: False
|
||||
// Node 7: Smart Energy Switch
|
||||
// Index: 0, Type: bool, Label: Switch, Value: False
|
||||
// Index: 2, Type: float, Label: Power, Value: 0.000 W
|
||||
// Index: 3, Type: float, Label: Energy, Value: 0.000 kWh
|
||||
// Index: 4, Type: float, Label: Previous Reading, Value: 0.000 kWh
|
||||
// Index: 5, Type: int32, Label: Interval, Value: 1521 seconds
|
||||
// Index: 6, Type: float, Label: Power, Value: 0.000 W
|
||||
// Index: 7, Type: float, Label: Previous Reading, Value: 0.000 W
|
||||
// Index: 8, Type: int32, Label: Interval, Value: 1521 seconds
|
||||
// Index: 9, Type: bool, Label: Exporting, Value: False
|
||||
//
|
||||
// So, with the above in mind:
|
||||
//
|
||||
// 1. Query the temperature on node 3 and print it out (as a
|
||||
// string), along with the units of measure:
|
||||
//
|
||||
// cout << "Temperature: " << sensor->getValueAsString(3, 1)
|
||||
// << " " << sensor->getValueUnits(3, 1) << endl;
|
||||
//
|
||||
// 2. query the same temperature as a float:
|
||||
//
|
||||
// float temperature = sensor->getValueAsFloat(3, 1);
|
||||
//
|
||||
// 3. Turn on the light plugged into the switch on Node 7, wait 5
|
||||
// seconds, then turn it back off again:
|
||||
//
|
||||
// cout << "Turning ON node 7" << endl;
|
||||
// sensor->setValueAsBool(7, 0, true);
|
||||
//
|
||||
// cout << "Sleeping for 5 seconds" << endl;
|
||||
// sleep(5);
|
||||
//
|
||||
// cout << "Turning OFF node 7" << endl;
|
||||
// sensor->setValueAsBool(7, 0, false);
|
||||
|
||||
|
||||
//! [Interesting]
|
||||
|
||||
|
||||
cout << "Exiting..." << endl;
|
||||
|
||||
delete sensor;
|
||||
|
||||
return 0;
|
||||
}
|
115
examples/c++/pn532-writeurl.cxx
Normal file
@ -0,0 +1,115 @@
|
||||
/*
|
||||
* Author: Jon Trulson <jtrulson@ics.com>
|
||||
* Copyright (c) 2015 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <iostream>
|
||||
#include "pn532.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
// the URL we want to add as an NDEF record
|
||||
// NOTE: this cannot exceed 34 characters.
|
||||
static char url[] = "iotdk.intel.com";
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
//! [Interesting]
|
||||
// Instantiate an PN532 on I2C bus 0 (default) using gpio 3 for the
|
||||
// IRQ, and gpio 2 for the reset pin.
|
||||
|
||||
upm::PN532 *nfc = new upm::PN532(3, 2);
|
||||
|
||||
if (!nfc->init())
|
||||
cerr << "init() failed" << endl;
|
||||
|
||||
uint32_t vers = nfc->getFirmwareVersion();
|
||||
|
||||
if (vers)
|
||||
printf("Got firmware version: 0x%08x\n", vers);
|
||||
else
|
||||
{
|
||||
printf("Could not identify PN532\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Now scan and identify any cards that come in range (1 for now)
|
||||
|
||||
// Retry forever
|
||||
nfc->setPassiveActivationRetries(0xff);
|
||||
|
||||
nfc->SAMConfig();
|
||||
|
||||
uint8_t uidSize;
|
||||
uint8_t uid[7];
|
||||
|
||||
bool foundCard = false;
|
||||
while (!foundCard)
|
||||
{
|
||||
memset(uid, 0, 7);
|
||||
if (nfc->readPassiveTargetID(nfc->BAUD_MIFARE_ISO14443A,
|
||||
uid, &uidSize, 2000))
|
||||
{
|
||||
// found a card
|
||||
printf("Found a card: UID len %d\n", uidSize);
|
||||
printf("UID: ");
|
||||
for (int i = 0; i < uidSize; i++)
|
||||
printf("%02x ", uid[i]);
|
||||
printf("\n");
|
||||
printf("SAK: 0x%02x\n", nfc->getSAK());
|
||||
printf("ATQA: 0x%04x\n\n", nfc->getATQA());
|
||||
foundCard = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Waiting for a card...\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (uidSize != 7)
|
||||
{
|
||||
printf("This example will only write an NDEF URI to preformatted\n");
|
||||
printf("Mifare Ultralight or NTAG2XX tags\n");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
// 48 bytes is maximum data area on ultralight cards, so we use that
|
||||
// as the maximum datasize here. Obviously if you have a bigger
|
||||
// card, you can write more data.
|
||||
if (!nfc->ntag2xx_WriteNDEFURI(nfc->NDEF_URIPREFIX_HTTP, url, 48))
|
||||
{
|
||||
// failure
|
||||
printf("Failed to write NDEF record tag.\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
printf("Success, URL record written to tag.\n");
|
||||
|
||||
|
||||
//! [Interesting]
|
||||
|
||||
delete nfc;
|
||||
return 0;
|
||||
}
|