Compare commits
529 Commits
Author | SHA1 | Date | |
---|---|---|---|
78182278cc | |||
3998cdfb1e | |||
969a25cf0d | |||
a2864d3559 | |||
4ab6873a42 | |||
7b0dce0992 | |||
57bab4f9df | |||
4f4bd2937a | |||
8c55b54969 | |||
4f53c9c43a | |||
94fe1174c6 | |||
f9d0e4621b | |||
3d535b5dec | |||
97204cfc31 | |||
d8dc267fef | |||
13704fffe0 | |||
2ceee8bf26 | |||
6c93816a77 | |||
20890aa2fb | |||
c95af93490 | |||
60815f034d | |||
357018109f | |||
de96a3d327 | |||
78482791c1 | |||
2168b404bd | |||
ff897e84eb | |||
f0cd7843c7 | |||
aedd3fa4e3 | |||
e4ac7c4a13 | |||
aba51d10c7 | |||
999eca4598 | |||
44d31a3dfd | |||
66913cdb20 | |||
424ff42b29 | |||
afc4e508d5 | |||
f5cd50f7ba | |||
018b731fab | |||
6592cf58d3 | |||
28aacaade6 | |||
fffcc2970e | |||
b5d3ab895b | |||
950f4bf4ad | |||
544d76e6ff | |||
99c59361a7 | |||
92039921b1 | |||
bbd8483b65 | |||
5ed438bc6b | |||
2daed538b4 | |||
14d45b89af | |||
08c116947a | |||
2854302757 | |||
51830a0953 | |||
22779337c8 | |||
8d40ca6f10 | |||
a2e80fcc29 | |||
7d1976e819 | |||
c6e87d8c16 | |||
d3471816ba | |||
65fd9804ea | |||
8c7065ed09 | |||
9a024f1aa1 | |||
475a4aa48a | |||
666d7c8459 | |||
d1258797b0 | |||
3f09b4ee0c | |||
72eebf5b6d | |||
aa94a8bd06 | |||
a48bd35893 | |||
b9090753db | |||
76867d8db3 | |||
343bfa2148 | |||
999702e6be | |||
045782b202 | |||
90feee05aa | |||
9c164b8b9e | |||
ecba83edc5 | |||
5dcdc2f9cc | |||
c3fbdb9e33 | |||
55bf019411 | |||
2ace28a75f | |||
d26b9a03d6 | |||
b3eb36ee47 | |||
4cc8adbec5 | |||
bba42e748c | |||
fa77863b13 | |||
f0d9ac8fd6 | |||
f9dc9cc4e8 | |||
ab5fc3f203 | |||
6c45773b36 | |||
be1c21c3f0 | |||
04b9e19eeb | |||
b937f1ae3e | |||
ca29e0a307 | |||
30c8efa3b6 | |||
b1421659c5 | |||
2a7e9d9cb9 | |||
47eaf93e4d | |||
ce1e2fd606 | |||
2a3485cf98 | |||
8bf92be1ab | |||
bdaf952e91 | |||
1d2b85418e | |||
cbd9dd7a2c | |||
c7aec0b291 | |||
2ac8f8f6ef | |||
897b0a48c6 | |||
6da2d5047d | |||
3567e079f9 | |||
a3354dca0d | |||
a327872241 | |||
68fcd45873 | |||
2555aec888 | |||
e9192d14c2 | |||
08a81356da | |||
234d166c84 | |||
5e6fdb5c30 | |||
a6a405be31 | |||
0866fb880a | |||
2376d853e7 | |||
bc65345cf3 | |||
f071ebe0ca | |||
78f25b0157 | |||
dfac49ede0 | |||
6abf66ddbc | |||
1ffbcd59ad | |||
c2b42842e4 | |||
7be414fa5b | |||
b10e108977 | |||
28e5f1ca6e | |||
3707e359f4 | |||
3b4e9da7c6 | |||
6a315f817d | |||
d70eef06ac | |||
34a55d7eae | |||
83344a63c5 | |||
6dd8358d2f | |||
a5048d20fd | |||
d2bdb8836c | |||
35df0fa9d7 | |||
4b47f6e84b | |||
f47bc7e5a7 | |||
edcedae0e4 | |||
9ebe68ec0c | |||
18c21f0bc7 | |||
d7a389a358 | |||
44f866f924 | |||
17ecaf522a | |||
6428f43599 | |||
e714b0eb24 | |||
0963b5e140 | |||
76a81c09f2 | |||
a2e7609263 | |||
1e45d8e712 | |||
d932fa606f | |||
c5b86d3637 | |||
1e49c43e7a | |||
82a0d4b6b0 | |||
687f0188ca | |||
3a989a5ed3 | |||
728e01c582 | |||
f98a257ed5 | |||
d827e58997 | |||
8d931fbf74 | |||
5b4edc8631 | |||
90019cdc62 | |||
cdfdbc3678 | |||
b218d01248 | |||
dec2e8eacc | |||
9b3befd6f2 | |||
b243290a36 | |||
1cf3f43db0 | |||
090035bf1d | |||
77be6adf6d | |||
828d3b928e | |||
1d0284abaf | |||
8f2238835e | |||
ca506f9fab | |||
56a01322b5 | |||
4bb077e70b | |||
317ad35180 | |||
e3ba0d7b0a | |||
c46dc401d4 | |||
78baaa9dc1 | |||
4a80a216c7 | |||
b1fa94f1e3 | |||
4e89284a37 | |||
72c957e700 | |||
df302ff5db | |||
bffecdae89 | |||
07b904e8f1 | |||
dcccf2d0c8 | |||
ae83074f6f | |||
5fac6e9811 | |||
8ece990ce9 | |||
8ba8890887 | |||
02147dfe4b | |||
9544b7789d | |||
6ee89da4ba | |||
2203d0b906 | |||
ec067857c5 | |||
5b6b7c479a | |||
49d5c2de34 | |||
7f30553a51 | |||
1e7f1f7cf2 | |||
af1acd6be7 | |||
8388a2867a | |||
55c8ec0395 | |||
7bb661d31b | |||
816a3055f4 | |||
fa4dabf173 | |||
5c16dd44a7 | |||
9f12002d7a | |||
e54d48f407 | |||
f53d8e79cc | |||
2725342c19 | |||
ff55f641a2 | |||
e1648d7ec7 | |||
fd028e2f05 | |||
3834b92c51 | |||
1792eb9cfe | |||
fbbf56a49d | |||
da0071ae71 | |||
2aa24162c3 | |||
970d6a083f | |||
d380658b40 | |||
de66c8de56 | |||
518d80cdcd | |||
925260a234 | |||
276ba67583 | |||
eeb370556f | |||
db021fa970 | |||
2bffccf839 | |||
ce6cd0a19f | |||
ae10518a0f | |||
5f3b88b00a | |||
49ce602808 | |||
e2b3cbc0f1 | |||
dc932b61e7 | |||
577894851b | |||
6fe96b2195 | |||
8f969d42f4 | |||
10d1975bc2 | |||
0aa3d59487 | |||
3810e7f2cb | |||
92615f0637 | |||
23e47fa3b9 | |||
f0dd5f9530 | |||
afd560ccdc | |||
74f00c8a55 | |||
f50ab24bb3 | |||
7bd7e80b2e | |||
27a3a90d1f | |||
b4c265005f | |||
9dcef6d7bb | |||
2ff5dc16aa | |||
15ee2dd0ff | |||
f13216752e | |||
1f3d074261 | |||
780500ac0a | |||
fab4c26238 | |||
fad4accfcc | |||
b03676222c | |||
db7d6d7f5f | |||
6a0a7b6159 | |||
0ebb7e0417 | |||
44b9ce2bdf | |||
12c290de70 | |||
e0e9405634 | |||
73be07df74 | |||
b25cecd315 | |||
0b9407356d | |||
d5cccba5d1 | |||
cb353600ec | |||
995734642e | |||
aaaee7e422 | |||
025ce478be | |||
da321e43f5 | |||
ae7b2ad04f | |||
06b48d8e07 | |||
328b7638ad | |||
809292630f | |||
fec3f22765 | |||
a665b5d6f1 | |||
ba33366d45 | |||
c9792b4e62 | |||
de342a5502 | |||
a4e590ae3a | |||
6aef5868af | |||
a8b85ff93b | |||
e0bdba5478 | |||
09659c62f3 | |||
de70ed8694 | |||
2fce7369f4 | |||
47c79086f2 | |||
951f0e0866 | |||
d9cc2812c4 | |||
2886e6946f | |||
02829cf43d | |||
ddf32f9cb7 | |||
063abf7163 | |||
6f19f28add | |||
90079b8d10 | |||
5832f4e3b7 | |||
12ecd6fa14 | |||
092a455172 | |||
d307376abc | |||
6135e932e4 | |||
a853733f61 | |||
e005ec4624 | |||
11d5d6f424 | |||
5448e72975 | |||
9cda72b077 | |||
30989d9b7c | |||
93e0100049 | |||
d269b3200d | |||
7c41db4c83 | |||
6642ee9eef | |||
db1ca3d08a | |||
1ac1760691 | |||
4bae8bfa20 | |||
121caf0829 | |||
3494bd2008 | |||
509cc3a6d3 | |||
7d40425391 | |||
df390358f2 | |||
40e0595892 | |||
f53fab80fd | |||
0c63500b36 | |||
2eb0047643 | |||
38a14eb068 | |||
9784f6e6ab | |||
8d3e29a695 | |||
fb2fbbd95e | |||
2aa6610645 | |||
69754c283f | |||
99700d7d1f | |||
29adee8435 | |||
1812e214df | |||
d9130671d7 | |||
6c6c16256b | |||
07c3bf5f25 | |||
19caf37088 | |||
405dab1725 | |||
9d48301402 | |||
83e2b3f800 | |||
86cd7771cd | |||
ee59c17081 | |||
3544e4b2ad | |||
4dc4461004 | |||
fb8dd8ad85 | |||
f00de88f97 | |||
496cd1c632 | |||
6a4c27841d | |||
8ed6dc60a5 | |||
a70ca3b70d | |||
4333869b7b | |||
ed15b1042d | |||
6e8b0dd038 | |||
2a8bbb0b8c | |||
0ef81a3b1c | |||
2d1ff0e318 | |||
0b7547231f | |||
02156d11c8 | |||
66d39af6c5 | |||
98f26235db | |||
878ca55385 | |||
27ccb57987 | |||
eca9ed95c8 | |||
a1620271f2 | |||
df4706e3b1 | |||
811b33936b | |||
09248d4dc4 | |||
535230084e | |||
49d25b1791 | |||
42cde580bf | |||
c170b01fc2 | |||
0a8f46a506 | |||
be8336d0e8 | |||
03cca53d2a | |||
da50225566 | |||
c3d5b95576 | |||
39e6065046 | |||
237f9cc36d | |||
40172142b3 | |||
5bbdc148c6 | |||
751b0f1fe0 | |||
a1abab8909 | |||
0ff9c7afcc | |||
6fa68db79f | |||
8504830c52 | |||
cb37c87467 | |||
e04a6fbcaa | |||
2a743df91d | |||
fc8374fe5e | |||
0bc2f04b4e | |||
7bb5fd8ec7 | |||
801209678b | |||
c5369315e9 | |||
931c8e8814 | |||
c34939cfb4 | |||
ce928907eb | |||
b53881a8d6 | |||
9ab215b6fd | |||
ea7b7a23fa | |||
03318b3c4d | |||
726e40d6c5 | |||
e3bdef0ef0 | |||
8174b6c59b | |||
474a6f82a3 | |||
cebc339d91 | |||
b2ffcdd9ea | |||
e91b69230c | |||
5477321ce7 | |||
ac9cd1afa3 | |||
96a8bf7e06 | |||
2ea12da8b8 | |||
685adc561b | |||
fd54745cc0 | |||
4bf30df933 | |||
44b1ff7f75 | |||
e9da4719fb | |||
fc776ba3a3 | |||
8e11768a51 | |||
3bea0233bc | |||
b1da85f437 | |||
875c39ab85 | |||
397af51d7c | |||
79e8a261ba | |||
da59216663 | |||
13814f78d8 | |||
c211f4ba1a | |||
a6b7522b18 | |||
30ae8070c6 | |||
67d2cb6428 | |||
a07663045b | |||
befba8c18d | |||
e7a32b9882 | |||
d0999cf778 | |||
81e1fd281c | |||
4aa51c0edb | |||
bbb7aa5a39 | |||
d97ce2378b | |||
d44eb0b751 | |||
5f2b525ee4 | |||
af6272941a | |||
97bc6bbc20 | |||
47c332bf6f | |||
1d49b4c3f4 | |||
c1ec85ee81 | |||
b347f47406 | |||
d15bf86157 | |||
93a8603686 | |||
0ef50b8be2 | |||
88bf6956fe | |||
961c33ad48 | |||
7580465f6b | |||
88eaced5a2 | |||
b8e1b5850c | |||
e3177c260c | |||
3ed11d7c37 | |||
52198840b8 | |||
cb9d8e2339 | |||
02fb40f058 | |||
cbe211c8cf | |||
94a49a8f36 | |||
2aeb9ddea3 | |||
6d239b9f63 | |||
ee2d398bfa | |||
50fd1d7478 | |||
e7d811e4df | |||
03fa37b130 | |||
b5066c3d55 | |||
30187ba5f9 | |||
4eb6c4e19d | |||
0ea310ac71 | |||
5c4de1b926 | |||
59a66b41bb | |||
d878a5cf1a | |||
428f4e5bfc | |||
050c134664 | |||
ffdd6d2f00 | |||
044037b892 | |||
ad87704c19 | |||
00114f69d2 | |||
c99821ad26 | |||
a9939d6352 | |||
5ed36a37f9 | |||
03b9cf89a0 | |||
9c9b273b5a | |||
586acf7502 | |||
d0e83d7076 | |||
1747fbbe19 | |||
45f85e9944 | |||
b31e88c233 | |||
58b80f6b58 | |||
574a39d3c1 | |||
bb38b35b32 | |||
d15bf22536 | |||
731704eaac | |||
00170bea97 | |||
8cfb3d3dab | |||
d2e2682f0e | |||
22ad93956c | |||
86a3be4517 | |||
8a67c143bf | |||
7dc8ec6244 | |||
0d544dadeb | |||
9f66c10b26 | |||
2822d63c9c | |||
0954617a4b | |||
36be22cb90 | |||
8d25ecacdd | |||
739d4e23e8 | |||
81c8baa071 | |||
2fa9b7b6c9 | |||
b1e548ae8a | |||
d00500ba12 | |||
2c0e83e406 | |||
b03cbf4f36 | |||
b291f372d7 | |||
8d8485be82 | |||
b4f25c84a5 | |||
4c7fa11bb2 | |||
c18a9433fc | |||
8fe679494c | |||
2c1baf66b5 | |||
3e12ed6719 | |||
e24df89ebd | |||
186dd03b79 |
@ -1,6 +1,10 @@
|
||||
cmake_minimum_required (VERSION 2.8.11)
|
||||
project (upm)
|
||||
|
||||
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})
|
||||
@ -8,19 +12,23 @@ endif ()
|
||||
|
||||
find_package (Threads REQUIRED)
|
||||
find_package (PkgConfig REQUIRED)
|
||||
# force the libmaa version to be the required version
|
||||
pkg_check_modules (MAA REQUIRED maa>=0.2.6)
|
||||
message (INFO " found libmaa version: ${MAA_VERSION}")
|
||||
# force the libmraa version to be the required version
|
||||
pkg_check_modules (MRAA REQUIRED mraa>=0.6.0)
|
||||
message (INFO " found libmraa 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 CMAKE_LIB_INSTALL_DIR if not defined
|
||||
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 libmaa!")
|
||||
set (VERSION "v0.1.2-dirty")
|
||||
message (WARNING " - Install git to compile a production libmraa!")
|
||||
set (VERSION "v0.2.0-dirty")
|
||||
endif ()
|
||||
|
||||
message (INFO " - UPM Version ${VERSION}")
|
||||
@ -53,7 +61,7 @@ if (BUILDDOC)
|
||||
# add a target to generate API documentation with Doxygen
|
||||
find_package (Doxygen)
|
||||
if (DOXYGEN_FOUND)
|
||||
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
|
||||
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/doxy/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
|
||||
add_custom_target (doc
|
||||
${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
@ -67,7 +75,7 @@ if (IPK)
|
||||
target_architecture (DETECTED_ARCH)
|
||||
message( INFO " - Target arch is ${DETECTED_ARCH}")
|
||||
|
||||
set(CPACK_GENERATOR "DEB")
|
||||
set(CPACK_GENERATOR "DEB" "TGZ")
|
||||
set(OPKG_ARCH ${DETECTED_ARCH})
|
||||
set(CPACK_BINARY_DIR ${CMAKE_BINARY_DIR})
|
||||
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Intel IoT-Devkit") #required
|
||||
@ -81,7 +89,7 @@ if (IPK)
|
||||
set(CPACK_DEBIAN_PACKAGE_SECTION "libs")
|
||||
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE ${DETECTED_ARCH})
|
||||
set(CPACK_SYSTEM_NAME ${DETECTED_ARCH})
|
||||
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libmaa0 (>= ${MAA_VERSION})")
|
||||
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libmraa0 (>= ${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})
|
||||
@ -90,4 +98,4 @@ if (IPK)
|
||||
endif()
|
||||
|
||||
add_subdirectory (src)
|
||||
add_subdirectory (examples)
|
||||
add_subdirectory (examples/c++)
|
||||
|
61
README.md
@ -1,26 +1,57 @@
|
||||
UPM - Sensor/Actuator repository for Maa
|
||||
UPM - Sensor/Actuator repository for libmraa
|
||||
==============
|
||||
|
||||
UPM is a high level repository for sensors that use maa. Each sensor links to
|
||||
libmaa 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 instanciated.
|
||||
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
|
||||
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 paramters may be used
|
||||
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.
|
||||
|
||||
A basic sensor is expected to work as such:
|
||||
s = new sensor();
|
||||
print(sensor->read());
|
||||
sleep(1);
|
||||
s->update();
|
||||
print(sensor->read();
|
||||
### Example
|
||||
|
||||
However implementation and API design is compeltely up to the developer, some
|
||||
enumerable sensors for example may provide much clever instanciation. Displays
|
||||
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.
|
||||
|
||||
For more information on maa, see the maa documentation
|
||||
Browse through the list of all [examples](https://github.com/intel-iot-devkit/upm/tree/master/examples).
|
||||
|
||||
### 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).
|
||||
|
||||
### Building UPM
|
||||
|
||||
See @ref building [here](docs/building.md).
|
||||
|
||||
### Making your own UPM module
|
||||
|
||||
@ref 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).
|
||||
|
||||
### Naming conventions and rules for new UPM contributions
|
||||
|
||||
Before you begin development, take a look at our @ref naming [conventions](docs/naming.md).
|
||||
|
||||
Also, please read the guidelines for @ref contributions [to UPM](docs/contributions.md).
|
||||
|
||||
Don't forget to check the @ref 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
|
||||
==============
|
||||
|
||||
The C/C++ documentation is available [here](http://iotdk.intel.com/docs/master/upm/).
|
||||
|
107
docs/building.md
Normal file
@ -0,0 +1,107 @@
|
||||
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.
|
||||
|
||||
This project depends on libmraa, so that needs to be installed first. Use the
|
||||
following environment variables to configure the paths:
|
||||
|
||||
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:.../mraa/build/lib/pkgconfig
|
||||
CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:.../mraa/build/include
|
||||
LIBRARY_PATH=$LIBRARY_PATH:.../mraa/build/lib
|
||||
|
||||
UPM will attempt to build all directories inside src/ and they must contain
|
||||
individual CMakeLists.txt files.
|
||||
|
||||
~~~~~~~~~~~~~{.sh}
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ..
|
||||
make
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
Our cmake configure has a number of options, *cmake-gui* or *ccmake* can show
|
||||
you all the options. The interesting ones are detailed below:
|
||||
|
||||
Changing install path from /usr/local to /usr
|
||||
~~~~~~~~~~~~~
|
||||
-DCMAKE_INSTALL_PREFIX:PATH=/usr
|
||||
~~~~~~~~~~~~~
|
||||
Building debug build:
|
||||
~~~~~~~~~~~~~
|
||||
-DCMAKE_BUILD_TYPE=DEBUG
|
||||
~~~~~~~~~~~~~
|
||||
Using clang instead of gcc:
|
||||
~~~~~~~~~~~~~
|
||||
-DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++
|
||||
~~~~~~~~~~~~~
|
||||
Cross-compiling on a different system:
|
||||
~~~~~~~~~~~~~
|
||||
-DCMAKE_CXX_FLAGS:STRING=-m32 -march=i586
|
||||
-DCMAKE_C_FLAGS:STRING=-m32 -march=i586
|
||||
~~~~~~~~~~~~~
|
||||
Building with an older version of swig (swig 2.0+) requires the disabling of javascript:
|
||||
~~~~~~~~~~~~~
|
||||
-DBUILDSWIGNODE=OFF
|
||||
~~~~~~~~~~~~~
|
||||
Disabling python module building
|
||||
~~~~~~~~~~~~~
|
||||
-DBUILDSWIGPYTHON=OFF
|
||||
~~~~~~~~~~~~~
|
||||
Setting the python library to use:
|
||||
~~~~~~~~~~~~~
|
||||
-DPYTHON_LIBRARY:FILEPATH=/usr/lib/libpython2.7.so.1.0
|
||||
~~~~~~~~~~~~~
|
||||
Building doxygen doc
|
||||
~~~~~~~~~~~~~
|
||||
-BUILDDOC=ON
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
If you intend to turn on all the options and build everything at once (C++,
|
||||
Node, Python and Documentation) you will have to edit the src/doxy2swig.py file
|
||||
and change the line endings from Windows style to Linux format. This has to be
|
||||
repeated every time to sync with the master branch since our Github repository
|
||||
stores files using CR LF line breaks.
|
||||
|
||||
You can also generate the include and lib directories containing all the sensor
|
||||
headers and library files respectively with *make install*. Further, you may
|
||||
choose to generate these only for a specific sensor you modified, and this can
|
||||
be achieved by building from the individual makefile of the sensor. Assuming
|
||||
you're in the build directory, to make the lcd module you would:
|
||||
|
||||
~~~~~~~~~~~~~
|
||||
cd src/lcd
|
||||
make install
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
Often developers are only interested in building one module or even just the
|
||||
python/node module to do some quick testing using scripting. In order to do
|
||||
this you need to use the target name for the python or node module you want to
|
||||
rebuild. For example the lcd module target name is i2clcd. Therefore the python
|
||||
module target name will be prefixed by _pyupm_. Just do the following to build
|
||||
only that module. Modules not using the UPM cmake macros may have different
|
||||
naming.
|
||||
|
||||
~~~~~~~~~~~~~
|
||||
make _pyupm_i2clcd
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
Sometimes you want to build a small C++ example against an installed library.
|
||||
This is fairly easy if installed system-wide. Just link against the correct
|
||||
library (in this case libupm-i2clcd) and then add /usr/include/upm to the
|
||||
loader path:
|
||||
|
||||
~~~~~~~~~~~~
|
||||
g++ test.cxx -lupm-i2clcd -I/usr/include/upm
|
||||
~~~~~~~~~~~~
|
||||
|
||||
You can also use pkg-config to return the information to you, which is
|
||||
considered the correct way if including UPM in a build system like cmake or
|
||||
autotools on linux.
|
||||
|
||||
~~~~~~~~~~~
|
||||
pkg-config --cflags --libs upm-i2clcd
|
||||
~~~~~~~~~~~
|
96
docs/contributions.md
Normal file
@ -0,0 +1,96 @@
|
||||
Contributing a module {#contributions}
|
||||
=====================
|
||||
|
||||
Here are the rules of contribution:
|
||||
- Your new module must have an example that builds against your UPM library.
|
||||
- Each commit must have a sign-off line by everyone who authored or reviewed
|
||||
them.
|
||||
- Commits must be named `<file/module>: Some decent description`.
|
||||
- You must license your module under a FOSS license. The recommended license
|
||||
is MIT but any permissive license is fine. Please consider that people using
|
||||
UPM may want to write proprietary programs with your sensors so we like to
|
||||
avoid GPL. If your license is not MIT please include a LICENSE file in
|
||||
src/mymodule/.
|
||||
- The top of each source file must contain a comment block containing the
|
||||
license information.
|
||||
- Please test your module builds before contributing and make sure it works on
|
||||
the latest version of libmraa. If you tested on a specific board/platform
|
||||
please tell us what this was in your PR.
|
||||
- Try not to break master. In any commit.
|
||||
- Attempt to have some decent API documentation as described in the the @ref
|
||||
documentation [guide](documentation.md).
|
||||
|
||||
Including the MIT license
|
||||
=========================
|
||||
Choosing the [MIT license](http://opensource.org/licenses/MIT) is preferred for
|
||||
the UPM repository. Below is the comment block needed at the top each source
|
||||
file:
|
||||
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Author: <your full name>
|
||||
* Copyright (c) <year> <copyright holder>
|
||||
*
|
||||
* Author: <contributing author full name - if applicable>
|
||||
* Copyright (c) <year> <copyright holder>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
||||
Code signing
|
||||
============
|
||||
|
||||
The sign-off is a simple line at the end of the explanation for the
|
||||
patch, which certifies that you wrote it or otherwise have the right to pass it
|
||||
on as an open-source patch. The rules are pretty simple: if you can certify
|
||||
the below:
|
||||
|
||||
Developer's Certificate of Origin 1.1
|
||||
|
||||
By making a contribution to this project, I certify that:
|
||||
|
||||
(a) The contribution was created in whole or in part by me and I
|
||||
have the right to submit it under the open source license
|
||||
indicated in the file; or
|
||||
|
||||
(b) The contribution is based upon previous work that, to the best
|
||||
of my knowledge, is covered under an appropriate open source
|
||||
license and I have the right under that license to submit that
|
||||
work with modifications, whether created in whole or in part
|
||||
by me, under the same open source license (unless I am
|
||||
permitted to submit under a different license), as indicated
|
||||
in the file; or
|
||||
|
||||
(c) The contribution was provided directly to me by some other
|
||||
person who certified (a), (b) or (c) and I have not modified
|
||||
it.
|
||||
|
||||
(d) I understand and agree that this project and the contribution
|
||||
are public and that a record of the contribution (including all
|
||||
personal information I submit with it, including my sign-off) is
|
||||
maintained indefinitely and may be redistributed consistent with
|
||||
this project or the open source license(s) involved.
|
||||
|
||||
then you just add a line to each of your commits with `--signoff` saying
|
||||
|
||||
Signed-off-by: Random J Developer <random@developer.example.org>
|
||||
|
||||
using your real name (sorry, no pseudonyms or anonymous contributions.)
|
||||
Unsigned commits will not be accepted.
|
114
docs/documentation.md
Normal file
@ -0,0 +1,114 @@
|
||||
Writing sensor documentation {#documentation}
|
||||
=====================
|
||||
|
||||
It is highly encouraged to provide at least some basic documentation for the
|
||||
sensors that you want to add to UPM:
|
||||
|
||||
- If you don't add documentation, the code review will take very long and
|
||||
your contribution could be rejected.
|
||||
- Try to have no warnings in doxygen, this is generally fairly easy.
|
||||
- Have the specific sensor manufacturer/model & version that you used, if you
|
||||
support multiple versions please list.
|
||||
- Simple comments do not need full stops.
|
||||
- Stick to <80 chars per line even in comments.
|
||||
- No text is allowed on the same line as the start or end of a comment /** */.
|
||||
|
||||
####The sensor block
|
||||
|
||||
This is added just before the class declaration in your header(.h) file and has
|
||||
mandatory fields. For single sensor libraries, this block will actually
|
||||
follow immediately after the library block. If you have multiple physical
|
||||
sensors, add this to every one.
|
||||
Here's an example (disregard the "@verbatim" tags in your actual code):
|
||||
|
||||
```
|
||||
@verbatim
|
||||
/**
|
||||
* @library <lib-name>
|
||||
* @sensor <chip-id>
|
||||
* @comname <component-name>
|
||||
* @altname <alt-name>
|
||||
* @type <component-category>
|
||||
* @man <component-manufacturer>
|
||||
* @web <component-weblinks>
|
||||
* @con <connection-type>
|
||||
* @kit <component-kit>
|
||||
*
|
||||
* @brief Short class/sensor description
|
||||
*
|
||||
* Then add a longer
|
||||
* description here.
|
||||
*
|
||||
* @image html <component-img.jpeg>
|
||||
* @snippet <example-name.cxx> Interesting
|
||||
*/
|
||||
@endverbatim
|
||||
```
|
||||
|
||||
- `<lib-name>` When adding to an existing library this needs to match that
|
||||
library's "@defgroup", otherwise this is a new library name, generally the
|
||||
same as chip id. *Mandatory*
|
||||
- `<chip-id>` Usually the chip number used by the sensor. When this is not
|
||||
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*
|
||||
- `<component-category>` Mention one or more categories the sensor fits in. Can
|
||||
be 'other'. *Mandatory*
|
||||
- `<component-manufacturer>` Sensor manufacturer. Can be 'generic'. *Mandatory*
|
||||
- `<component-weblinks>` Links to vendors or data-sheets. *Optional*
|
||||
- `<connection-type>` Specifies how does the sensor connect to the board
|
||||
*Mandatory*
|
||||
- `<component-kit>` Specifies if the sensor is part of a kit. *Optional*
|
||||
|
||||
Existing groups that can be used for the manufacturer, connection, category and
|
||||
kit tags are found in the src/upm.h file.
|
||||
|
||||
Optionally, a small representative image can be placed in the "docs/images"
|
||||
subfolder and linked with the "@image" tag.
|
||||
**Please do not use existing, copyrighted images with your sensors!**
|
||||
|
||||
The example should have an 'Interesting' section which will be highlighted as
|
||||
a code sample in doxygen. Everything in between such tags will show up in the
|
||||
class documentation when "@snippet" is added at the end of a class docstring.
|
||||
Tags use this format (in "example-name.cxx"):
|
||||
|
||||
```
|
||||
@verbatim
|
||||
//! [Interesting]
|
||||
|
||||
...example code here...
|
||||
|
||||
//! [Interesting]
|
||||
@endverbatim
|
||||
```
|
||||
|
||||
For more examples take a look at the existing headers in our github repository.
|
||||
|
||||
####The library block
|
||||
|
||||
New libraries must have the "@brief", "@defgroup" and "@ingroup" tags in one
|
||||
block. This usually follows the namespace and it is common to have one sensor
|
||||
per library.
|
||||
|
||||
You should end up with something like this:
|
||||
|
||||
```
|
||||
@verbatim
|
||||
/**
|
||||
* @brief Short description for entire library
|
||||
*
|
||||
* Optional longer description.
|
||||
*
|
||||
* @defgroup <lib-name> libupm-<lib-name>
|
||||
* @ingroup <manufacturer> <connection> <category> (<kit>)
|
||||
*/
|
||||
@endverbatim
|
||||
```
|
||||
|
||||
In "@defgroup" use the same `<lib-name>` used in the sensor block. Multiple
|
||||
sensors can be added to the same library this way.
|
||||
For "@ingroup" add the same values as in the sensor block for manufacturer,
|
||||
category, connection type and kit. If you have multiple classes or sensors
|
||||
per library, only use the "@ingroup" tags that are common for all of them.
|
BIN
docs/images/adxl345.jpeg
Normal file
After Width: | Height: | Size: 21 KiB |
BIN
docs/images/am2315.jpeg
Normal file
After Width: | Height: | Size: 19 KiB |
BIN
docs/images/bmp085.jpeg
Normal file
After Width: | Height: | Size: 44 KiB |
BIN
docs/images/es0a.jpg
Normal file
After Width: | Height: | Size: 166 KiB |
BIN
docs/images/grovergblcd.jpg
Normal file
After Width: | Height: | Size: 2.4 MiB |
BIN
docs/images/groverotary.jpeg
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
docs/images/groveslide.jpeg
Normal file
After Width: | Height: | Size: 8.7 KiB |
BIN
docs/images/grovetsl2561.jpeg
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
docs/images/hmc5883l.jpeg
Normal file
After Width: | Height: | Size: 32 KiB |
BIN
docs/images/htu21d.jpeg
Normal file
After Width: | Height: | Size: 134 KiB |
BIN
docs/images/hx711.jpeg
Normal file
After Width: | Height: | Size: 42 KiB |
BIN
docs/images/itg3200.jpeg
Normal file
After Width: | Height: | Size: 36 KiB |
BIN
docs/images/lsm303.jpeg
Normal file
After Width: | Height: | Size: 29 KiB |
BIN
docs/images/mic.jpg
Normal file
After Width: | Height: | Size: 46 KiB |
BIN
docs/images/mpl3115a2.jpeg
Normal file
After Width: | Height: | Size: 142 KiB |
BIN
docs/images/mpr121.jpg
Normal file
After Width: | Height: | Size: 95 KiB |
BIN
docs/images/mpu9150.jpg
Normal file
After Width: | Height: | Size: 124 KiB |
BIN
docs/images/mq2-5.jpeg
Normal file
After Width: | Height: | Size: 33 KiB |
BIN
docs/images/mq3-9.jpeg
Normal file
After Width: | Height: | Size: 34 KiB |
BIN
docs/images/mq303a.jpg
Normal file
After Width: | Height: | Size: 185 KiB |
BIN
docs/images/my9221.jpg
Normal file
After Width: | Height: | Size: 92 KiB |
BIN
docs/images/nrf24l01.jpg
Normal file
After Width: | Height: | Size: 105 KiB |
BIN
docs/images/nrf8001.jpg
Normal file
After Width: | Height: | Size: 206 KiB |
BIN
docs/images/pca9685.jpg
Normal file
After Width: | Height: | Size: 432 KiB |
BIN
docs/images/ppd42ns.JPG
Normal file
After Width: | Height: | Size: 165 KiB |
BIN
docs/images/pulsensor.jpg
Normal file
After Width: | Height: | Size: 219 KiB |
BIN
docs/images/rfr359f.jpg
Normal file
After Width: | Height: | Size: 61 KiB |
BIN
docs/images/rotaryencoder.jpg
Normal file
After Width: | Height: | Size: 136 KiB |
BIN
docs/images/rpr220.JPG
Normal file
After Width: | Height: | Size: 35 KiB |
BIN
docs/images/ssd1308.jpeg
Normal file
After Width: | Height: | Size: 19 KiB |
BIN
docs/images/ssd1327.jpeg
Normal file
After Width: | Height: | Size: 62 KiB |
BIN
docs/images/tm1637.jpeg
Normal file
After Width: | Height: | Size: 24 KiB |
BIN
docs/images/tp401.jpeg
Normal file
After Width: | Height: | Size: 14 KiB |
97
docs/max31855.md
Normal file
@ -0,0 +1,97 @@
|
||||
Making a UPM module for MAX31855 {#max31855}
|
||||
================================
|
||||
|
||||
The Maxim Integrated MAX31855 is a thermocouple amplifier allowing you to read
|
||||
from a K type thermocouple. My board comes from the Pmod kit form Maxim
|
||||
(MAX31855PMB1) but you can get this from many different sources. The adafruit
|
||||
people made arduino code already so we'll use that as a
|
||||
[reference](https://github.com/adafruit/Adafruit-MAX31855-library/blob/master/Adafruit_MAX31855.cpp).
|
||||
|
||||
### Basics
|
||||
|
||||
This is a spi module so we will use the mraa spi functions to build our module.
|
||||
First thing to do is to create a tree structure like this in upm/src/max31855:
|
||||
|
||||
* max31855.cxx
|
||||
* max31855.h
|
||||
* jsupm_max31855.i
|
||||
* pyupm_max31855.i
|
||||
* CMakeLists.txt
|
||||
|
||||
And then an example file to use & test our lib with in upm/examples/max31855.cxx.
|
||||
|
||||
### Swig
|
||||
|
||||
The .i files are used by swig, there is one for each python & javascript. They
|
||||
contain essentially the same thing and are very simple. The only thing to
|
||||
change between the javascript & node.js one is the argument to %module.
|
||||
|
||||
@snippet jsupm_max31855.i Interesting
|
||||
|
||||
The %include parameter defines which functions will be available to the
|
||||
node/python module created, Whilst the headers inside %{} will be explicitly
|
||||
required during compilation. Typically only the top level header is required in
|
||||
either of those args. The upm.i is just a shortcut to include some commonly
|
||||
used swig wrappers for UPM sensors, it's not obligatory but recommended.
|
||||
|
||||
### API
|
||||
|
||||
Then we create the header (max31855.h) , a very simple header in our case we
|
||||
will have only a very basic api. We provide a getTemp() function which will
|
||||
return the same type as in the arduino library, a double.
|
||||
|
||||
@snippet max31855.h Interesting
|
||||
|
||||
Note that the header contains both the io that we will use, the gpio is in this
|
||||
case used as the chip select pin.
|
||||
|
||||
### Implementing our API
|
||||
|
||||
In the adafruit library the read function (our chip is a 3pin SPI so only read
|
||||
is possible), the spiread32() does all the work. It starts by setting up the io
|
||||
so we will do the same in our constructor.
|
||||
|
||||
Note unlike on Arduino, we'll just set a 2Mhz clock and let the chip do the
|
||||
work.
|
||||
|
||||
@snippet src/max31855/max31855.cxx Constructor
|
||||
|
||||
Then we also need to implement a nice cleanup in our destructor.
|
||||
|
||||
@snippet src/max31855/max31855.cxx Destructor
|
||||
|
||||
Then to read data, we will use spi_write_buf which will allow us to write a
|
||||
whole uint32_t in order to get one back, which is what the arduino code does in
|
||||
spiread32. Obviously we set our chip select to low first. Here is the start of
|
||||
the implementation of MAX31855::getTemp()
|
||||
|
||||
@snippet src/max31855/max31855.cxx spi
|
||||
|
||||
Then using the arduino code as reference we simply reconstruct form the 4
|
||||
uint8_t values a 32bit int value and select only the valuable parts of
|
||||
information from that. The MAX31855 datasheet explains exactly which bits are
|
||||
useful, we will just do the same as the adafruit code, first checking the error
|
||||
bit and then scrapping everything but the 14bit of thermocouple data that are
|
||||
useful to us and converting it to a double.
|
||||
|
||||
@snippet src/max31855/max31855.cxx conversion
|
||||
|
||||
### Finalizing
|
||||
|
||||
Our final example, very easy to use API!
|
||||
|
||||
@snippet examples/max31855.cxx Interesting
|
||||
|
||||
### Building
|
||||
|
||||
The we need to add it to the examples/CMakeLists.txt. Only three lines are required
|
||||
|
||||
~~~~~~~~~~~
|
||||
add_executable (max31855-example max31855.cxx)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/max31855)
|
||||
target_link_libraries (max31855-example max31855 ${CMAKE_THREAD_LIBS_INIT})
|
||||
~~~~~~~~~~~
|
||||
|
||||
Note you don't have to rebuild everything, cmake keeps target lists so if you
|
||||
named your example target modulename-example you can simply do make
|
||||
max31855-example and both the library & example will build.
|
33
docs/naming.md
Normal file
@ -0,0 +1,33 @@
|
||||
Naming a module {#naming}
|
||||
===============
|
||||
|
||||
UPM attempts to follow a clear naming pattern. Modules should be sensibly named
|
||||
and then placed in ${libdir}/upm and headers in ${includedir}/upm, all modules
|
||||
should be prefixed with libupm-<modulename>. The upm_module_init will
|
||||
automatically name python UPM modules as pyupm_<modulename> and javascript
|
||||
modules as jsupm_<modulename>. For example for src/grove/ the library built
|
||||
will be libupm-grove.so, the python module pyupm_grove and the js module
|
||||
jsupm_grove.
|
||||
|
||||
### Choosing a name for a new module
|
||||
|
||||
1. Pick a name, typically the chip name is the most sensible
|
||||
2. Use it & stick to it
|
||||
|
||||
### Rules for name picking
|
||||
|
||||
1. Your lib must belong to the UPM namespace
|
||||
2. Usually picking the name of the chip of your sensor/actuator makes sense.
|
||||
Other times this does not. Try to pick a generic name so people with a similar
|
||||
sensor can inherit your class if they only have minor changes.
|
||||
3. Avoid brand names, often your module can be very generic with little effort
|
||||
4. Use only lowercase characters in your file names and folder names.
|
||||
|
||||
### 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
|
||||
and we'll try suggest decent names for your module.
|
||||
|
65
docs/porting.md
Normal file
@ -0,0 +1,65 @@
|
||||
Porting a module from Arduino {#porting}
|
||||
=============================
|
||||
|
||||
Porting arduino libraries to libmraa as UPM libraries is usually fairly easy.
|
||||
The issues typically come from misunderstanding of how a non real time OS deals
|
||||
with interrupts and timers. It also highly depends on the sensor. A concrete
|
||||
example is explained in detail on @ref max31855
|
||||
|
||||
### Adding a new module to UPM
|
||||
|
||||
1. Choose a name for your module (see @ref naming)
|
||||
2. Make a new folder in src/modulename
|
||||
3. Create a CMakeLists.txt file inside src/modulename
|
||||
|
||||
### CmakeLists.txt
|
||||
|
||||
By default you need a header called modulename.h and a C++ file called
|
||||
modulename.cxx. You can have multiple headers and source files. Only public
|
||||
headers need to be added to module_h and all source files need to be in
|
||||
module_src.
|
||||
|
||||
~~~~~~~~~~~
|
||||
set (libname "modulename")
|
||||
set (libdescription "Module Description")
|
||||
set (module_src ${libname}.cxx)
|
||||
set (module_h ${libname}.h)
|
||||
upm_module_init()
|
||||
~~~~~~~~~~~
|
||||
|
||||
### Making your API
|
||||
|
||||
The easiest way to do this is to have a look at a similar sensor to yours.
|
||||
Typically create a class for your sensor with a constructor that defines the
|
||||
pins it is on. This constructor will create the mraa_*_context structs that are
|
||||
required to talk to the board's IO. An I2c sensor will create a
|
||||
mraa_i2c_context, keep it as a private member and require a bus number and slave
|
||||
address in it's constructor.
|
||||
|
||||
Typically in sensors a simple object->read() function is preferred, depending on
|
||||
your sensor/actuator this may or may not be easy or not even make sense. Most
|
||||
UPM APIs have a simple set of functions.
|
||||
|
||||
### Mapping arduino API to libmraa
|
||||
|
||||
Your constructor is similar to the setup() function in arduino, you should
|
||||
initialise your IO the way you want it. This means initialising contexts
|
||||
(private members) and setting the correct modes for them.
|
||||
|
||||
See the mraa API documentation for exact API.
|
||||
|
||||
### Building
|
||||
|
||||
To build your module just follow @ref building. By creating a folder and the
|
||||
CMakelists.txt file you have done all that is required to add your sensor to
|
||||
the UPM build system.
|
||||
|
||||
### Sending your module to us for inclusion in UPM
|
||||
|
||||
The last step is when you're happy with your module and it works send us a pull
|
||||
request! We'd love to include your sensor in our repository.
|
||||
|
||||
If you don't like github you can also send mihai.tudor.panu@intel.com a git
|
||||
formatted patch of your sensor. More details are on @ref contributions and on
|
||||
https://help.github.com/articles/creating-a-pull-request
|
||||
|
@ -44,21 +44,21 @@ PROJECT_NUMBER = @upm_VERSION_STRING@
|
||||
# for a project that appears at the top of each page and should give viewer a
|
||||
# quick idea about the purpose of the project. Keep the description short.
|
||||
|
||||
PROJECT_BRIEF = "Sensor/Actuator repository for libmaa (v@MAA_VERSION@)"
|
||||
PROJECT_BRIEF = "Sensor/Actuator repository for libmraa (v@MRAA_VERSION@)"
|
||||
|
||||
# With the PROJECT_LOGO tag one can specify an logo or icon that is included in
|
||||
# the documentation. The maximum height of the logo should not exceed 55 pixels
|
||||
# and the maximum width should not exceed 200 pixels. Doxygen will copy the logo
|
||||
# to the output directory.
|
||||
|
||||
PROJECT_LOGO =
|
||||
PROJECT_LOGO =
|
||||
|
||||
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
|
||||
# into which the generated documentation will be written. If a relative path is
|
||||
# entered, it will be relative to the location where doxygen was started. If
|
||||
# left blank the current directory will be used.
|
||||
|
||||
OUTPUT_DIRECTORY =
|
||||
OUTPUT_DIRECTORY =
|
||||
|
||||
# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 4096 sub-
|
||||
# directories (in 2 levels) under the output directory of each output format and
|
||||
@ -99,7 +99,7 @@ BRIEF_MEMBER_DESC = YES
|
||||
# brief descriptions will be completely suppressed.
|
||||
# The default value is: YES.
|
||||
|
||||
REPEAT_BRIEF = YES
|
||||
REPEAT_BRIEF = NO
|
||||
|
||||
# This tag implements a quasi-intelligent brief description abbreviator that is
|
||||
# used to form the text in various listings. Each string in this list, if found
|
||||
@ -129,6 +129,8 @@ ABBREVIATE_BRIEF = "The $name class" \
|
||||
|
||||
ALWAYS_DETAILED_SEC = NO
|
||||
|
||||
DETAILS_AT_TOP = YES
|
||||
|
||||
# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
|
||||
# inherited members of a class in the documentation of that class as if those
|
||||
# members were ordinary class members. Constructors, destructors and assignment
|
||||
@ -154,7 +156,7 @@ FULL_PATH_NAMES = YES
|
||||
# will be relative from the directory where doxygen is started.
|
||||
# This tag requires that the tag FULL_PATH_NAMES is set to YES.
|
||||
|
||||
STRIP_FROM_PATH =
|
||||
STRIP_FROM_PATH =
|
||||
|
||||
# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the
|
||||
# path mentioned in the documentation of a class, which tells the reader which
|
||||
@ -163,7 +165,7 @@ STRIP_FROM_PATH =
|
||||
# specify the list of include paths that are normally passed to the compiler
|
||||
# using the -I flag.
|
||||
|
||||
STRIP_FROM_INC_PATH =
|
||||
STRIP_FROM_INC_PATH =
|
||||
|
||||
# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but
|
||||
# less readable) file names. This can be useful is your file systems doesn't
|
||||
@ -230,13 +232,21 @@ TAB_SIZE = 4
|
||||
# "Side Effects:". You can put \n's in the value part of an alias to insert
|
||||
# newlines.
|
||||
|
||||
ALIASES =
|
||||
ALIASES = library="@ingroup " \
|
||||
sensor="@li **ID:** " \
|
||||
comname="@li **Name:** " \
|
||||
altname="@li **Other Names:** " \
|
||||
type="@li **Category:** " \
|
||||
man="@li **Manufacturer:** " \
|
||||
web="@li **Link:** " \
|
||||
con="@li **Connection:** " \
|
||||
kit="@li **Kit:** " \
|
||||
|
||||
# This tag can be used to specify a number of word-keyword mappings (TCL only).
|
||||
# A mapping has the form "name=value". For example adding "class=itcl::class"
|
||||
# will allow you to use the command class in the itcl::class meaning.
|
||||
|
||||
TCL_SUBST =
|
||||
TCL_SUBST =
|
||||
|
||||
# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
|
||||
# only. Doxygen will then generate output that is more tailored for C. For
|
||||
@ -280,7 +290,7 @@ OPTIMIZE_OUTPUT_VHDL = NO
|
||||
# Note that for custom extensions you also need to set FILE_PATTERNS otherwise
|
||||
# the files are not read by doxygen.
|
||||
|
||||
EXTENSION_MAPPING =
|
||||
EXTENSION_MAPPING =
|
||||
|
||||
# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments
|
||||
# according to the Markdown format, which allows for more readable
|
||||
@ -510,7 +520,7 @@ HIDE_SCOPE_NAMES = YES
|
||||
# the files that are included by a file in the documentation of that file.
|
||||
# The default value is: YES.
|
||||
|
||||
SHOW_INCLUDE_FILES = YES
|
||||
SHOW_INCLUDE_FILES = NO
|
||||
|
||||
# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each
|
||||
# grouped member an include statement to the documentation, telling the reader
|
||||
@ -536,7 +546,7 @@ INLINE_INFO = YES
|
||||
# name. If set to NO the members will appear in declaration order.
|
||||
# The default value is: YES.
|
||||
|
||||
SORT_MEMBER_DOCS = YES
|
||||
SORT_MEMBER_DOCS = NO
|
||||
|
||||
# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief
|
||||
# descriptions of file, namespace and class members alphabetically by member
|
||||
@ -616,7 +626,7 @@ GENERATE_DEPRECATEDLIST= YES
|
||||
# sections, marked by \if <section_label> ... \endif and \cond <section_label>
|
||||
# ... \endcond blocks.
|
||||
|
||||
ENABLED_SECTIONS =
|
||||
ENABLED_SECTIONS =
|
||||
|
||||
# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the
|
||||
# initial value of a variable or macro / define can have for it to appear in the
|
||||
@ -658,7 +668,7 @@ SHOW_NAMESPACES = YES
|
||||
# by doxygen. Whatever the program writes to standard output is used as the file
|
||||
# version. For an example see the documentation.
|
||||
|
||||
FILE_VERSION_FILTER =
|
||||
FILE_VERSION_FILTER =
|
||||
|
||||
# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
|
||||
# by doxygen. The layout file controls the global structure of the generated
|
||||
@ -671,7 +681,7 @@ FILE_VERSION_FILTER =
|
||||
# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE
|
||||
# tag is left empty.
|
||||
|
||||
LAYOUT_FILE =
|
||||
LAYOUT_FILE = @CMAKE_CURRENT_SOURCE_DIR@/doxy/DoxygenLayout.xml
|
||||
|
||||
# The CITE_BIB_FILES tag can be used to specify one or more bib files containing
|
||||
# the reference definitions. This must be a list of .bib files. The .bib
|
||||
@ -682,7 +692,7 @@ LAYOUT_FILE =
|
||||
# search path. Do not use file names with spaces, bibtex cannot handle them. See
|
||||
# also \cite for info how to create references.
|
||||
|
||||
CITE_BIB_FILES =
|
||||
CITE_BIB_FILES =
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to warning and progress messages
|
||||
@ -741,7 +751,7 @@ WARN_FORMAT = "$file:$line: $text"
|
||||
# messages should be written. If left blank the output is written to standard
|
||||
# error (stderr).
|
||||
|
||||
WARN_LOGFILE =
|
||||
WARN_LOGFILE =
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the input files
|
||||
@ -753,7 +763,9 @@ WARN_LOGFILE =
|
||||
# spaces.
|
||||
# Note: If this tag is empty the current directory is searched.
|
||||
|
||||
INPUT = @CMAKE_CURRENT_SOURCE_DIR@/src \
|
||||
INPUT = @CMAKE_CURRENT_SOURCE_DIR@/src/upm.h \
|
||||
@CMAKE_CURRENT_SOURCE_DIR@/src \
|
||||
@CMAKE_CURRENT_SOURCE_DIR@/docs \
|
||||
@CMAKE_CURRENT_SOURCE_DIR@/README.md
|
||||
|
||||
# This tag can be used to specify the character encoding of the source files
|
||||
@ -846,7 +858,7 @@ EXCLUDE_SYMLINKS = NO
|
||||
# Note that the wildcards are matched against the file with absolute path, so to
|
||||
# exclude all test directories for example use the pattern */test/*
|
||||
|
||||
EXCLUDE_PATTERNS =
|
||||
EXCLUDE_PATTERNS =
|
||||
|
||||
# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
|
||||
# (namespaces, classes, functions, etc.) that should be excluded from the
|
||||
@ -857,13 +869,15 @@ EXCLUDE_PATTERNS =
|
||||
# Note that the wildcards are matched against the file with absolute path, so to
|
||||
# exclude all test directories use the pattern */test/*
|
||||
|
||||
EXCLUDE_SYMBOLS =
|
||||
EXCLUDE_SYMBOLS = aci_*
|
||||
|
||||
# The EXAMPLE_PATH tag can be used to specify one or more files or directories
|
||||
# that contain example code fragments that are included (see the \include
|
||||
# command).
|
||||
|
||||
EXAMPLE_PATH = @CMAKE_CURRENT_SOURCE_DIR@/examples/
|
||||
EXAMPLE_PATH = @CMAKE_CURRENT_SOURCE_DIR@/examples/c++ \
|
||||
@CMAKE_CURRENT_SOURCE_DIR@/docs/ \
|
||||
@CMAKE_CURRENT_SOURCE_DIR@/src/max31855/
|
||||
|
||||
# If the value of the EXAMPLE_PATH tag contains directories, you can use the
|
||||
# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
|
||||
@ -883,7 +897,7 @@ EXAMPLE_RECURSIVE = NO
|
||||
# that contain images that are to be included in the documentation (see the
|
||||
# \image command).
|
||||
|
||||
IMAGE_PATH =
|
||||
IMAGE_PATH = @CMAKE_CURRENT_SOURCE_DIR@/docs/images/
|
||||
|
||||
# The INPUT_FILTER tag can be used to specify a program that doxygen should
|
||||
# invoke to filter for each input file. Doxygen will invoke the filter program
|
||||
@ -900,7 +914,7 @@ IMAGE_PATH =
|
||||
# code is scanned, but not when the output code is generated. If lines are added
|
||||
# or removed, the anchors will not be placed correctly.
|
||||
|
||||
INPUT_FILTER =
|
||||
INPUT_FILTER =
|
||||
|
||||
# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
|
||||
# basis. Doxygen will compare the file name with each pattern and apply the
|
||||
@ -909,7 +923,7 @@ INPUT_FILTER =
|
||||
# filters are used. If the FILTER_PATTERNS tag is empty or if none of the
|
||||
# patterns match the file name, INPUT_FILTER is applied.
|
||||
|
||||
FILTER_PATTERNS =
|
||||
FILTER_PATTERNS =
|
||||
|
||||
# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
|
||||
# INPUT_FILTER ) will also be used to filter the input files that are used for
|
||||
@ -924,7 +938,7 @@ FILTER_SOURCE_FILES = NO
|
||||
# *.ext= (so without naming a filter).
|
||||
# This tag requires that the tag FILTER_SOURCE_FILES is set to YES.
|
||||
|
||||
FILTER_SOURCE_PATTERNS =
|
||||
FILTER_SOURCE_PATTERNS =
|
||||
|
||||
# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that
|
||||
# is part of the input, its contents will be placed on the main page
|
||||
@ -1043,7 +1057,7 @@ COLS_IN_ALPHA_INDEX = 5
|
||||
# while generating the index headers.
|
||||
# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
|
||||
|
||||
IGNORE_PREFIX =
|
||||
IGNORE_PREFIX =
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the HTML output
|
||||
@ -1087,7 +1101,7 @@ HTML_FILE_EXTENSION = .html
|
||||
# of the possible markers and block names see the documentation.
|
||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||
|
||||
HTML_HEADER =
|
||||
HTML_HEADER =
|
||||
|
||||
# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each
|
||||
# generated HTML page. If the tag is left blank doxygen will generate a standard
|
||||
@ -1097,7 +1111,7 @@ HTML_HEADER =
|
||||
# that doxygen normally uses.
|
||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||
|
||||
HTML_FOOTER =
|
||||
HTML_FOOTER =
|
||||
|
||||
# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style
|
||||
# sheet that is used by each HTML page. It can be used to fine-tune the look of
|
||||
@ -1109,7 +1123,7 @@ HTML_FOOTER =
|
||||
# obsolete.
|
||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||
|
||||
HTML_STYLESHEET =
|
||||
HTML_STYLESHEET =
|
||||
|
||||
# The HTML_EXTRA_STYLESHEET tag can be used to specify an additional user-
|
||||
# defined cascading style sheet that is included after the standard style sheets
|
||||
@ -1120,7 +1134,7 @@ HTML_STYLESHEET =
|
||||
# see the documentation.
|
||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||
|
||||
HTML_EXTRA_STYLESHEET =
|
||||
HTML_EXTRA_STYLESHEET =
|
||||
|
||||
# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
|
||||
# other source files which should be copied to the HTML output directory. Note
|
||||
@ -1130,7 +1144,7 @@ HTML_EXTRA_STYLESHEET =
|
||||
# files will be copied as-is; there are no commands or markers available.
|
||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||
|
||||
HTML_EXTRA_FILES =
|
||||
HTML_EXTRA_FILES =
|
||||
|
||||
# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
|
||||
# will adjust the colors in the stylesheet and background images according to
|
||||
@ -1258,7 +1272,7 @@ GENERATE_HTMLHELP = NO
|
||||
# written to the html output directory.
|
||||
# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
|
||||
|
||||
CHM_FILE =
|
||||
CHM_FILE =
|
||||
|
||||
# The HHC_LOCATION tag can be used to specify the location (absolute path
|
||||
# including file name) of the HTML help compiler ( hhc.exe). If non-empty
|
||||
@ -1266,7 +1280,7 @@ CHM_FILE =
|
||||
# The file has to be specified with full path.
|
||||
# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
|
||||
|
||||
HHC_LOCATION =
|
||||
HHC_LOCATION =
|
||||
|
||||
# The GENERATE_CHI flag controls if a separate .chi index file is generated (
|
||||
# YES) or that it should be included in the master .chm file ( NO).
|
||||
@ -1279,7 +1293,7 @@ GENERATE_CHI = NO
|
||||
# and project file content.
|
||||
# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
|
||||
|
||||
CHM_INDEX_ENCODING =
|
||||
CHM_INDEX_ENCODING =
|
||||
|
||||
# The BINARY_TOC flag controls whether a binary table of contents is generated (
|
||||
# YES) or a normal table of contents ( NO) in the .chm file.
|
||||
@ -1309,7 +1323,7 @@ GENERATE_QHP = NO
|
||||
# the HTML output folder.
|
||||
# This tag requires that the tag GENERATE_QHP is set to YES.
|
||||
|
||||
QCH_FILE =
|
||||
QCH_FILE =
|
||||
|
||||
# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help
|
||||
# Project output. For more information please see Qt Help Project / Namespace
|
||||
@ -1334,7 +1348,7 @@ QHP_VIRTUAL_FOLDER = doc
|
||||
# filters).
|
||||
# This tag requires that the tag GENERATE_QHP is set to YES.
|
||||
|
||||
QHP_CUST_FILTER_NAME =
|
||||
QHP_CUST_FILTER_NAME =
|
||||
|
||||
# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the
|
||||
# custom filter to add. For more information please see Qt Help Project / Custom
|
||||
@ -1342,21 +1356,21 @@ QHP_CUST_FILTER_NAME =
|
||||
# filters).
|
||||
# This tag requires that the tag GENERATE_QHP is set to YES.
|
||||
|
||||
QHP_CUST_FILTER_ATTRS =
|
||||
QHP_CUST_FILTER_ATTRS =
|
||||
|
||||
# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
|
||||
# project's filter section matches. Qt Help Project / Filter Attributes (see:
|
||||
# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes).
|
||||
# This tag requires that the tag GENERATE_QHP is set to YES.
|
||||
|
||||
QHP_SECT_FILTER_ATTRS =
|
||||
QHP_SECT_FILTER_ATTRS =
|
||||
|
||||
# The QHG_LOCATION tag can be used to specify the location of Qt's
|
||||
# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the
|
||||
# generated .qhp file.
|
||||
# This tag requires that the tag GENERATE_QHP is set to YES.
|
||||
|
||||
QHG_LOCATION =
|
||||
QHG_LOCATION =
|
||||
|
||||
# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be
|
||||
# generated, together with the HTML files, they form an Eclipse help plugin. To
|
||||
@ -1489,7 +1503,7 @@ MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest
|
||||
# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols
|
||||
# This tag requires that the tag USE_MATHJAX is set to YES.
|
||||
|
||||
MATHJAX_EXTENSIONS =
|
||||
MATHJAX_EXTENSIONS =
|
||||
|
||||
# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces
|
||||
# of code that will be used on startup of the MathJax code. See the MathJax site
|
||||
@ -1497,7 +1511,7 @@ MATHJAX_EXTENSIONS =
|
||||
# example see the documentation.
|
||||
# This tag requires that the tag USE_MATHJAX is set to YES.
|
||||
|
||||
MATHJAX_CODEFILE =
|
||||
MATHJAX_CODEFILE =
|
||||
|
||||
# When the SEARCHENGINE tag is enabled doxygen will generate a search box for
|
||||
# the HTML output. The underlying search engine uses javascript and DHTML and
|
||||
@ -1557,7 +1571,7 @@ EXTERNAL_SEARCH = NO
|
||||
# Searching" for details.
|
||||
# This tag requires that the tag SEARCHENGINE is set to YES.
|
||||
|
||||
SEARCHENGINE_URL =
|
||||
SEARCHENGINE_URL =
|
||||
|
||||
# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed
|
||||
# search data is written to a file for indexing by an external tool. With the
|
||||
@ -1573,7 +1587,7 @@ SEARCHDATA_FILE = searchdata.xml
|
||||
# projects and redirect the results back to the right project.
|
||||
# This tag requires that the tag SEARCHENGINE is set to YES.
|
||||
|
||||
EXTERNAL_SEARCH_ID =
|
||||
EXTERNAL_SEARCH_ID =
|
||||
|
||||
# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen
|
||||
# projects other than the one defined by this configuration file, but that are
|
||||
@ -1583,7 +1597,7 @@ EXTERNAL_SEARCH_ID =
|
||||
# EXTRA_SEARCH_MAPPINGS = tagname1=loc1 tagname2=loc2 ...
|
||||
# This tag requires that the tag SEARCHENGINE is set to YES.
|
||||
|
||||
EXTRA_SEARCH_MAPPINGS =
|
||||
EXTRA_SEARCH_MAPPINGS =
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the LaTeX output
|
||||
@ -1644,7 +1658,7 @@ PAPER_TYPE = a4
|
||||
# If left blank no extra packages will be included.
|
||||
# This tag requires that the tag GENERATE_LATEX is set to YES.
|
||||
|
||||
EXTRA_PACKAGES =
|
||||
EXTRA_PACKAGES =
|
||||
|
||||
# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the
|
||||
# generated LaTeX document. The header should contain everything until the first
|
||||
@ -1660,7 +1674,7 @@ EXTRA_PACKAGES =
|
||||
# PROJECT_NAME), or the project number (see PROJECT_NUMBER).
|
||||
# This tag requires that the tag GENERATE_LATEX is set to YES.
|
||||
|
||||
LATEX_HEADER =
|
||||
LATEX_HEADER =
|
||||
|
||||
# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the
|
||||
# generated LaTeX document. The footer should contain everything after the last
|
||||
@ -1669,7 +1683,7 @@ LATEX_HEADER =
|
||||
# Note: Only use a user-defined footer if you know what you are doing!
|
||||
# This tag requires that the tag GENERATE_LATEX is set to YES.
|
||||
|
||||
LATEX_FOOTER =
|
||||
LATEX_FOOTER =
|
||||
|
||||
# The LATEX_EXTRA_FILES tag can be used to specify one or more extra images or
|
||||
# other source files which should be copied to the LATEX_OUTPUT output
|
||||
@ -1677,7 +1691,7 @@ LATEX_FOOTER =
|
||||
# markers available.
|
||||
# This tag requires that the tag GENERATE_LATEX is set to YES.
|
||||
|
||||
LATEX_EXTRA_FILES =
|
||||
LATEX_EXTRA_FILES =
|
||||
|
||||
# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated is
|
||||
# prepared for conversion to PDF (using ps2pdf or pdflatex). The PDF file will
|
||||
@ -1777,14 +1791,14 @@ RTF_HYPERLINKS = NO
|
||||
# default style sheet that doxygen normally uses.
|
||||
# This tag requires that the tag GENERATE_RTF is set to YES.
|
||||
|
||||
RTF_STYLESHEET_FILE =
|
||||
RTF_STYLESHEET_FILE =
|
||||
|
||||
# Set optional variables used in the generation of an RTF document. Syntax is
|
||||
# similar to doxygen's config file. A template extensions file can be generated
|
||||
# using doxygen -e rtf extensionFile.
|
||||
# This tag requires that the tag GENERATE_RTF is set to YES.
|
||||
|
||||
RTF_EXTENSIONS_FILE =
|
||||
RTF_EXTENSIONS_FILE =
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the man page output
|
||||
@ -1845,13 +1859,13 @@ XML_OUTPUT = xml
|
||||
# validating XML parser to check the syntax of the XML files.
|
||||
# This tag requires that the tag GENERATE_XML is set to YES.
|
||||
|
||||
XML_SCHEMA =
|
||||
XML_SCHEMA =
|
||||
|
||||
# The XML_DTD tag can be used to specify a XML DTD, which can be used by a
|
||||
# validating XML parser to check the syntax of the XML files.
|
||||
# This tag requires that the tag GENERATE_XML is set to YES.
|
||||
|
||||
XML_DTD =
|
||||
XML_DTD =
|
||||
|
||||
# If the XML_PROGRAMLISTING tag is set to YES doxygen will dump the program
|
||||
# listings (including syntax highlighting and cross-referencing information) to
|
||||
@ -1928,7 +1942,7 @@ PERLMOD_PRETTY = YES
|
||||
# overwrite each other's variables.
|
||||
# This tag requires that the tag GENERATE_PERLMOD is set to YES.
|
||||
|
||||
PERLMOD_MAKEVAR_PREFIX =
|
||||
PERLMOD_MAKEVAR_PREFIX =
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the preprocessor
|
||||
@ -1969,7 +1983,7 @@ SEARCH_INCLUDES = YES
|
||||
# preprocessor.
|
||||
# This tag requires that the tag SEARCH_INCLUDES is set to YES.
|
||||
|
||||
INCLUDE_PATH =
|
||||
INCLUDE_PATH =
|
||||
|
||||
# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
|
||||
# patterns (like *.h and *.hpp) to filter out the header-files in the
|
||||
@ -1977,7 +1991,7 @@ INCLUDE_PATH =
|
||||
# used.
|
||||
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
|
||||
|
||||
INCLUDE_FILE_PATTERNS =
|
||||
INCLUDE_FILE_PATTERNS =
|
||||
|
||||
# The PREDEFINED tag can be used to specify one or more macro names that are
|
||||
# defined before the preprocessor is started (similar to the -D option of e.g.
|
||||
@ -1987,7 +2001,7 @@ INCLUDE_FILE_PATTERNS =
|
||||
# recursively expanded use the := operator instead of the = operator.
|
||||
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
|
||||
|
||||
PREDEFINED =
|
||||
PREDEFINED =
|
||||
|
||||
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
|
||||
# tag can be used to specify a list of macro names that should be expanded. The
|
||||
@ -1996,7 +2010,7 @@ PREDEFINED =
|
||||
# definition found in the source code.
|
||||
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
|
||||
|
||||
EXPAND_AS_DEFINED =
|
||||
EXPAND_AS_DEFINED =
|
||||
|
||||
# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
|
||||
# remove all refrences to function-like macros that are alone on a line, have an
|
||||
@ -2025,13 +2039,13 @@ SKIP_FUNCTION_MACROS = YES
|
||||
# the path). If a tag file is not located in the directory in which doxygen is
|
||||
# run, you must also specify the path to the tagfile here.
|
||||
|
||||
TAGFILES =
|
||||
TAGFILES =
|
||||
|
||||
# When a file name is specified after GENERATE_TAGFILE, doxygen will create a
|
||||
# tag file that is based on the input files it reads. See section "Linking to
|
||||
# external documentation" for more information about the usage of tag files.
|
||||
|
||||
GENERATE_TAGFILE =
|
||||
GENERATE_TAGFILE =
|
||||
|
||||
# If the ALLEXTERNALS tag is set to YES all external class will be listed in the
|
||||
# class index. If set to NO only the inherited external classes will be listed.
|
||||
@ -2079,14 +2093,14 @@ CLASS_DIAGRAMS = NO
|
||||
# the mscgen tool resides. If left empty the tool is assumed to be found in the
|
||||
# default search path.
|
||||
|
||||
MSCGEN_PATH =
|
||||
MSCGEN_PATH =
|
||||
|
||||
# You can include diagrams made with dia in doxygen documentation. Doxygen will
|
||||
# then run dia to produce the diagram and insert it in the documentation. The
|
||||
# DIA_PATH tag allows you to specify the directory where the dia binary resides.
|
||||
# If left empty dia is assumed to be found in the default search path.
|
||||
|
||||
DIA_PATH =
|
||||
DIA_PATH =
|
||||
|
||||
# If set to YES, the inheritance and collaboration graphs will hide inheritance
|
||||
# and usage relations if the target is undocumented or is not a class.
|
||||
@ -2135,7 +2149,7 @@ DOT_FONTSIZE = 10
|
||||
# the path where dot can find it using this tag.
|
||||
# This tag requires that the tag HAVE_DOT is set to YES.
|
||||
|
||||
DOT_FONTPATH =
|
||||
DOT_FONTPATH =
|
||||
|
||||
# If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for
|
||||
# each documented class showing the direct and indirect inheritance relations.
|
||||
@ -2206,7 +2220,7 @@ INCLUDE_GRAPH = YES
|
||||
# The default value is: YES.
|
||||
# This tag requires that the tag HAVE_DOT is set to YES.
|
||||
|
||||
INCLUDED_BY_GRAPH = YES
|
||||
INCLUDED_BY_GRAPH = NO
|
||||
|
||||
# If the CALL_GRAPH tag is set to YES then doxygen will generate a call
|
||||
# dependency graph for every global function or class method.
|
||||
@ -2273,26 +2287,26 @@ INTERACTIVE_SVG = NO
|
||||
# found. If left blank, it is assumed the dot tool can be found in the path.
|
||||
# This tag requires that the tag HAVE_DOT is set to YES.
|
||||
|
||||
DOT_PATH =
|
||||
DOT_PATH =
|
||||
|
||||
# The DOTFILE_DIRS tag can be used to specify one or more directories that
|
||||
# contain dot files that are included in the documentation (see the \dotfile
|
||||
# command).
|
||||
# This tag requires that the tag HAVE_DOT is set to YES.
|
||||
|
||||
DOTFILE_DIRS =
|
||||
DOTFILE_DIRS =
|
||||
|
||||
# The MSCFILE_DIRS tag can be used to specify one or more directories that
|
||||
# contain msc files that are included in the documentation (see the \mscfile
|
||||
# command).
|
||||
|
||||
MSCFILE_DIRS =
|
||||
MSCFILE_DIRS =
|
||||
|
||||
# The DIAFILE_DIRS tag can be used to specify one or more directories that
|
||||
# contain dia files that are included in the documentation (see the \diafile
|
||||
# command).
|
||||
|
||||
DIAFILE_DIRS =
|
||||
DIAFILE_DIRS =
|
||||
|
||||
# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of nodes
|
||||
# that will be shown in the graph. If the number of nodes in a graph becomes
|
198
doxy/DoxygenLayout.xml
Normal file
@ -0,0 +1,198 @@
|
||||
<doxygenlayout version="1.0">
|
||||
<!-- Generated by doxygen 1.8.7 -->
|
||||
<!-- Navigation index tabs for HTML output -->
|
||||
<navindex>
|
||||
<tab type="mainpage" visible="yes" title=""/>
|
||||
<tab type="pages" visible="yes" title="" intro=""/>
|
||||
<tab type="modules" visible="yes" title="UPM Libraries" intro="Here is a
|
||||
list of UPM libraries that can be used. Note that each of the classes
|
||||
listed in these libraries are completely separate so you will need to link
|
||||
against all those that you have used in your program. Use the hierarchical
|
||||
tree to filter between different types of sensors."/> <tab
|
||||
type="namespaces" visible="yes" title="">
|
||||
<tab type="namespacelist" visible="yes" title="" intro=""/>
|
||||
<tab type="namespacemembers" visible="yes" title="" intro=""/>
|
||||
</tab>
|
||||
<tab type="classes" visible="yes" title="">
|
||||
<tab type="classlist" visible="yes" title="" intro=""/>
|
||||
<tab type="classindex" visible="$ALPHABETICAL_INDEX" title=""/>
|
||||
<tab type="hierarchy" visible="yes" title="" intro=""/>
|
||||
<tab type="classmembers" visible="yes" title="" intro=""/>
|
||||
</tab>
|
||||
<tab type="files" visible="yes" title="">
|
||||
<tab type="filelist" visible="yes" title="" intro=""/>
|
||||
<tab type="globals" visible="yes" title="" intro=""/>
|
||||
</tab>
|
||||
<tab type="examples" visible="yes" title="" intro=""/>
|
||||
</navindex>
|
||||
|
||||
<!-- Layout definition for a class page -->
|
||||
<class>
|
||||
<briefdescription visible="yes"/>
|
||||
<detaileddescription title=""/>
|
||||
<includes visible="$SHOW_INCLUDE_FILES"/>
|
||||
<memberdecl>
|
||||
<nestedclasses visible="yes" title=""/>
|
||||
<publictypes title=""/>
|
||||
<services title=""/>
|
||||
<interfaces title=""/>
|
||||
<publicslots title=""/>
|
||||
<signals title=""/>
|
||||
<publicmethods title=""/>
|
||||
<publicstaticmethods title=""/>
|
||||
<publicattributes title=""/>
|
||||
<publicstaticattributes title=""/>
|
||||
<protectedtypes title=""/>
|
||||
<protectedslots title=""/>
|
||||
<protectedmethods title=""/>
|
||||
<protectedstaticmethods title=""/>
|
||||
<protectedattributes title=""/>
|
||||
<protectedstaticattributes title=""/>
|
||||
<packagetypes title=""/>
|
||||
<packagemethods title=""/>
|
||||
<packagestaticmethods title=""/>
|
||||
<packageattributes title=""/>
|
||||
<packagestaticattributes title=""/>
|
||||
<properties title=""/>
|
||||
<events title=""/>
|
||||
<privatetypes title=""/>
|
||||
<privateslots title=""/>
|
||||
<privatemethods title=""/>
|
||||
<privatestaticmethods title=""/>
|
||||
<privateattributes title=""/>
|
||||
<privatestaticattributes title=""/>
|
||||
<friends title=""/>
|
||||
<related title="" subtitle=""/>
|
||||
<membergroups visible="yes"/>
|
||||
</memberdecl>
|
||||
<memberdef>
|
||||
<inlineclasses title=""/>
|
||||
<typedefs title=""/>
|
||||
<enums title=""/>
|
||||
<services title=""/>
|
||||
<interfaces title=""/>
|
||||
<constructors title=""/>
|
||||
<functions title=""/>
|
||||
<related title=""/>
|
||||
<variables title=""/>
|
||||
<properties title=""/>
|
||||
<events title=""/>
|
||||
</memberdef>
|
||||
<allmemberslink visible="yes"/>
|
||||
<inheritancegraph visible="$CLASS_GRAPH"/>
|
||||
<collaborationgraph visible="$COLLABORATION_GRAPH"/>
|
||||
<usedfiles visible="$SHOW_USED_FILES"/>
|
||||
<authorsection visible="yes"/>
|
||||
</class>
|
||||
|
||||
<!-- Layout definition for a namespace page -->
|
||||
<namespace>
|
||||
<briefdescription visible="yes"/>
|
||||
<memberdecl>
|
||||
<nestednamespaces visible="yes" title=""/>
|
||||
<constantgroups visible="yes" title=""/>
|
||||
<classes visible="yes" title=""/>
|
||||
<typedefs title=""/>
|
||||
<enums title=""/>
|
||||
<functions title=""/>
|
||||
<variables title=""/>
|
||||
<membergroups visible="yes"/>
|
||||
</memberdecl>
|
||||
<detaileddescription title=""/>
|
||||
<memberdef>
|
||||
<inlineclasses title=""/>
|
||||
<typedefs title=""/>
|
||||
<enums title=""/>
|
||||
<functions title=""/>
|
||||
<variables title=""/>
|
||||
</memberdef>
|
||||
<authorsection visible="yes"/>
|
||||
</namespace>
|
||||
|
||||
<!-- Layout definition for a file page -->
|
||||
<file>
|
||||
<briefdescription visible="no"/>
|
||||
<includegraph visible="$INCLUDE_GRAPH"/>
|
||||
<includes visible="$SHOW_INCLUDE_FILES"/>
|
||||
<detaileddescription title="API Description"/>
|
||||
<sourcelink visible="yes"/>
|
||||
<memberdecl>
|
||||
<classes visible="yes" title=""/>
|
||||
<namespaces visible="yes" title=""/>
|
||||
<functions title=""/>
|
||||
<constantgroups visible="yes" title=""/>
|
||||
<defines title=""/>
|
||||
<typedefs title=""/>
|
||||
<enums title=""/>
|
||||
<variables title=""/>
|
||||
<membergroups visible="yes"/>
|
||||
</memberdecl>
|
||||
<memberdef>
|
||||
<inlineclasses title=""/>
|
||||
<functions title=""/>
|
||||
<defines title=""/>
|
||||
<typedefs title=""/>
|
||||
<enums title=""/>
|
||||
<variables title=""/>
|
||||
</memberdef>
|
||||
<includedbygraph visible="$INCLUDED_BY_GRAPH"/>
|
||||
<authorsection/>
|
||||
</file>
|
||||
|
||||
<!-- Layout definition for a group page -->
|
||||
<group>
|
||||
<briefdescription visible="yes"/>
|
||||
<groupgraph visible="$GROUP_GRAPHS"/>
|
||||
<memberdecl>
|
||||
<nestedgroups visible="yes" title="Libraries"/>
|
||||
<dirs visible="yes" title=""/>
|
||||
<files visible="yes" title=""/>
|
||||
<namespaces visible="yes" title=""/>
|
||||
<classes visible="yes" title=""/>
|
||||
<defines title=""/>
|
||||
<typedefs title=""/>
|
||||
<enums title=""/>
|
||||
<enumvalues title=""/>
|
||||
<functions title=""/>
|
||||
<variables title=""/>
|
||||
<signals title=""/>
|
||||
<publicslots title=""/>
|
||||
<protectedslots title=""/>
|
||||
<privateslots title=""/>
|
||||
<events title=""/>
|
||||
<properties title=""/>
|
||||
<friends title=""/>
|
||||
<membergroups visible="yes"/>
|
||||
</memberdecl>
|
||||
<detaileddescription title=""/>
|
||||
<memberdef>
|
||||
<pagedocs/>
|
||||
<inlineclasses title=""/>
|
||||
<defines title=""/>
|
||||
<typedefs title=""/>
|
||||
<enums title=""/>
|
||||
<enumvalues title=""/>
|
||||
<functions title=""/>
|
||||
<variables title=""/>
|
||||
<signals title=""/>
|
||||
<publicslots title=""/>
|
||||
<protectedslots title=""/>
|
||||
<privateslots title=""/>
|
||||
<events title=""/>
|
||||
<properties title=""/>
|
||||
<friends title=""/>
|
||||
</memberdef>
|
||||
<authorsection visible="yes"/>
|
||||
</group>
|
||||
|
||||
<!-- Layout definition for a directory page -->
|
||||
<directory>
|
||||
<briefdescription visible="yes"/>
|
||||
<directorygraph visible="yes"/>
|
||||
<memberdecl>
|
||||
<dirs visible="yes"/>
|
||||
<files visible="yes"/>
|
||||
</memberdecl>
|
||||
<detaileddescription title=""/>
|
||||
</directory>
|
||||
</doxygenlayout>
|
@ -1,45 +0,0 @@
|
||||
add_executable (compass compass.cxx)
|
||||
add_executable (groveled groveled.cxx)
|
||||
add_executable (grovetemp grovetemp.cxx)
|
||||
add_executable (lcm-lcd lcm-lcd.cxx)
|
||||
add_executable (rgb-lcd rgb-lcd.cxx)
|
||||
add_executable (buzzer-sound buzzer-sound.cxx)
|
||||
add_executable (led-bar led-bar.cxx)
|
||||
add_executable (seg-lcd 4digitdisplay.cxx)
|
||||
add_executable (nrf_transmitter nrf_transmitter.cxx)
|
||||
add_executable (nrf_receiver nrf_receiver.cxx)
|
||||
add_executable (es08a es08a.cxx)
|
||||
add_executable (son-hcsr04 hcsr04.cxx)
|
||||
add_executable (oled-1308 oled-1308.cxx)
|
||||
add_executable (oled-1327 oled-1327.cxx)
|
||||
add_executable (proximity max44000.cxx)
|
||||
add_executable (accelerometer mma7455.cxx)
|
||||
|
||||
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/tm1637)
|
||||
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)
|
||||
|
||||
target_link_libraries (compass hmc5883l ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (groveled grove ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (grovetemp grove ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (lcm-lcd i2clcd ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (rgb-lcd i2clcd ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (buzzer-sound buzzer ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (led-bar my9221 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (seg-lcd tm1637 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (nrf_transmitter nrf24l01 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (nrf_receiver nrf24l01 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (es08a servo ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (son-hcsr04 hcsr04 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (oled-1308 i2clcd ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (oled-1327 i2clcd ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (proximity max44000 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (accelerometer mma7455 ${CMAKE_THREAD_LIBS_INIT})
|
323
examples/c++/CMakeLists.txt
Normal file
@ -0,0 +1,323 @@
|
||||
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)
|
||||
|
||||
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)
|
||||
|
||||
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})
|
76
examples/c++/a110x-intr.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 "a110x.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
int shouldRun = true;
|
||||
|
||||
void sig_handler(int signo)
|
||||
{
|
||||
if (signo == SIGINT)
|
||||
shouldRun = false;
|
||||
}
|
||||
|
||||
// Our pulse counter
|
||||
volatile unsigned int counter = 0;
|
||||
|
||||
// Our interrupt handler
|
||||
void hallISR(void *arg)
|
||||
{
|
||||
counter++;
|
||||
}
|
||||
|
||||
int main ()
|
||||
{
|
||||
signal(SIGINT, sig_handler);
|
||||
|
||||
//! [Interesting]
|
||||
// Instantiate an A110X sensor on digital pin D2
|
||||
upm::A110X* hall = new upm::A110X(2);
|
||||
|
||||
// This example uses a user-supplied interrupt handler to count
|
||||
// pulses that occur when a magnetic field of the correct polarity
|
||||
// is detected. This could be used to measure the rotations per
|
||||
// minute (RPM) of a rotor for example.
|
||||
|
||||
hall->installISR(hallISR, NULL);
|
||||
|
||||
while (shouldRun)
|
||||
{
|
||||
cout << "Pulses detected: " << counter << endl;
|
||||
|
||||
sleep(1);
|
||||
}
|
||||
//! [Interesting]
|
||||
|
||||
cout << "Exiting..." << endl;
|
||||
|
||||
delete hall;
|
||||
return 0;
|
||||
}
|
67
examples/c++/a110x.cxx
Normal file
@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Author: Jon Trulson <jtrulson@ics.com>
|
||||
* Copyright (c) 2014 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* 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 "a110x.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
int shouldRun = true;
|
||||
|
||||
void sig_handler(int signo)
|
||||
{
|
||||
if (signo == SIGINT)
|
||||
shouldRun = false;
|
||||
}
|
||||
|
||||
|
||||
int main ()
|
||||
{
|
||||
signal(SIGINT, sig_handler);
|
||||
|
||||
//! [Interesting]
|
||||
// Instantiate an A110X sensor on digital pin D2
|
||||
upm::A110X* hall = new upm::A110X(2);
|
||||
|
||||
// check every second for the presence of a magnetic field (south
|
||||
// polarity)
|
||||
while (shouldRun)
|
||||
{
|
||||
bool val = hall->magnetDetected();
|
||||
if (val)
|
||||
cout << "Magnet (south polarity) detected." << endl;
|
||||
else
|
||||
cout << "No magnet detected." << endl;
|
||||
|
||||
sleep(1);
|
||||
}
|
||||
//! [Interesting]
|
||||
|
||||
cout << "Exiting..." << endl;
|
||||
|
||||
delete hall;
|
||||
return 0;
|
||||
}
|
82
examples/c++/adafruitms1438-stepper.cxx
Normal file
@ -0,0 +1,82 @@
|
||||
/*
|
||||
* 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 "adafruitms1438.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace upm;
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
//! [Interesting]
|
||||
// Instantiate an Adafruit MS 1438 on I2C bus 0
|
||||
|
||||
upm::AdafruitMS1438 *ms =
|
||||
new upm::AdafruitMS1438(ADAFRUITMS1438_I2C_BUS,
|
||||
ADAFRUITMS1438_DEFAULT_I2C_ADDR);
|
||||
|
||||
// Setup for use with a stepper motor connected to the M1 & M2 ports
|
||||
|
||||
// set a PWM period of 50Hz
|
||||
|
||||
// disable first, to be safe
|
||||
ms->disableStepper(AdafruitMS1438::STEPMOTOR_M12);
|
||||
|
||||
// configure for a NEMA-17, 200 steps per revolution
|
||||
ms->stepConfig(AdafruitMS1438::STEPMOTOR_M12, 200);
|
||||
|
||||
// set speed at 10 RPM's
|
||||
ms->setStepperSpeed(AdafruitMS1438::STEPMOTOR_M12, 10);
|
||||
ms->setStepperDirection(AdafruitMS1438::STEPMOTOR_M12,
|
||||
AdafruitMS1438::DIR_CW);
|
||||
|
||||
// enable
|
||||
cout << "Enabling..." << endl;
|
||||
ms->enableStepper(AdafruitMS1438::STEPMOTOR_M12);
|
||||
|
||||
cout << "Rotating 1 full revolution at 10 RPM speed." << endl;
|
||||
ms->stepperSteps(AdafruitMS1438::STEPMOTOR_M12, 200);
|
||||
|
||||
cout << "Sleeping for 2 seconds..." << endl;
|
||||
sleep(2);
|
||||
cout << "Rotating 1/2 revolution in opposite direction at 10 RPM speed."
|
||||
<< endl;
|
||||
|
||||
ms->setStepperDirection(AdafruitMS1438::STEPMOTOR_M12,
|
||||
AdafruitMS1438::DIR_CCW);
|
||||
ms->stepperSteps(AdafruitMS1438::STEPMOTOR_M12, 100);
|
||||
|
||||
cout << "Disabling..." << endl;
|
||||
ms->disableStepper(AdafruitMS1438::STEPMOTOR_M12);
|
||||
|
||||
cout << "Exiting" << endl;
|
||||
|
||||
//! [Interesting]
|
||||
|
||||
delete ms;
|
||||
return 0;
|
||||
}
|
75
examples/c++/adafruitms1438.cxx
Normal file
@ -0,0 +1,75 @@
|
||||
/*
|
||||
* 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 "adafruitms1438.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace upm;
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
//! [Interesting]
|
||||
// Instantiate an Adafruit MS 1438 on I2C bus 0
|
||||
|
||||
upm::AdafruitMS1438 *ms =
|
||||
new upm::AdafruitMS1438(ADAFRUITMS1438_I2C_BUS,
|
||||
ADAFRUITMS1438_DEFAULT_I2C_ADDR);
|
||||
|
||||
// Setup for use with a DC motor connected to the M3 port
|
||||
|
||||
// set a PWM period of 50Hz
|
||||
ms->setPWMPeriod(50);
|
||||
|
||||
// disable first, to be safe
|
||||
ms->disableMotor(AdafruitMS1438::MOTOR_M3);
|
||||
|
||||
// set speed at 50%
|
||||
ms->setMotorSpeed(AdafruitMS1438::MOTOR_M3, 50);
|
||||
ms->setMotorDirection(AdafruitMS1438::MOTOR_M3, AdafruitMS1438::DIR_CW);
|
||||
|
||||
cout << "Spin M3 at half speed for 3 seconds, then reverse for 3 seconds."
|
||||
<< endl;
|
||||
|
||||
ms->enableMotor(AdafruitMS1438::MOTOR_M3);
|
||||
|
||||
sleep(3);
|
||||
|
||||
cout << "Reversing M3" << endl;
|
||||
ms->setMotorDirection(AdafruitMS1438::MOTOR_M3, AdafruitMS1438::DIR_CCW);
|
||||
|
||||
sleep(3);
|
||||
|
||||
cout << "Stopping M3" << endl;
|
||||
ms->disableMotor(AdafruitMS1438::MOTOR_M3);
|
||||
|
||||
cout << "Exiting" << endl;
|
||||
|
||||
//! [Interesting]
|
||||
|
||||
delete ms;
|
||||
return 0;
|
||||
}
|
77
examples/c++/adafruitss.cxx
Normal file
@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Author: Stan Gifford <stan@gifford.id.au>
|
||||
* Copyright (c) 2015 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Description
|
||||
* Demo program for Adafruit 16 channel servo shield/controller
|
||||
* Physical setup for tests is a single servo attached to one channel.
|
||||
* Note - when 3 or more GWS servos attached results unpredictable.
|
||||
* Adafruit do recommend a Cap be installed on the board which should alleviate the issue.
|
||||
* I (and Adafruit) are unable to give any Capacitor sizing data.
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include "adafruitss.h"
|
||||
#include <unistd.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
|
||||
int n;
|
||||
|
||||
//! [Interesting]
|
||||
upm::adafruitss* servos = new upm::adafruitss(6,0x40);
|
||||
|
||||
for (;;)
|
||||
{
|
||||
cout << "Setting all to 0" << endl;
|
||||
for (n = 0; n < 16; n++)
|
||||
servos->servo(n, 1, 0); // GWS Mini Servo = Type 1.
|
||||
usleep(1000000); // Wait 1 second
|
||||
|
||||
cout << "Setting all to 45" << endl;
|
||||
for (n = 0; n < 16; n++)
|
||||
servos->servo(n, 1, 45);
|
||||
usleep(1000000); // Wait 1 second
|
||||
|
||||
cout << "Setting all to 90" << endl;
|
||||
for (n = 0; n < 16; n++)
|
||||
servos->servo(n, 1, 90);
|
||||
usleep(1000000); // Wait 1 second
|
||||
|
||||
cout << "Setting all to 135" << endl;
|
||||
for (n = 0; n < 16; n++)
|
||||
servos->servo(n, 1, 135);
|
||||
usleep(1000000); // Wait 1 second
|
||||
|
||||
cout << "Setting all to 180" << endl;
|
||||
for (n = 0; n < 16; n++)
|
||||
servos->servo(n, 1, 160);
|
||||
usleep(2000000); // Wait 1 second
|
||||
}
|
||||
//! [Interesting]
|
||||
return 0;
|
||||
}
|
66
examples/c++/adc121c021.cxx
Normal file
@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Author: Jon Trulson <jtrulson@ics.com>
|
||||
* Copyright (c) 2014 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* 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 "adc121c021.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 ADC121C021 on I2C bus 0
|
||||
|
||||
upm::ADC121C021 *adc = new upm::ADC121C021(ADC121C021_I2C_BUS,
|
||||
ADC121C021_DEFAULT_I2C_ADDR);
|
||||
|
||||
// An analog sensor, such as a Grove light sensor,
|
||||
// must be attached to the adc
|
||||
// Prints the value and corresponding voltage every 50 milliseconds
|
||||
while (shouldRun)
|
||||
{
|
||||
uint16_t val = adc->value();
|
||||
cout << "ADC value: " << val << " Volts = "
|
||||
<< adc->valueToVolts(val) << endl;
|
||||
usleep(50000);
|
||||
}
|
||||
//! [Interesting]
|
||||
|
||||
cout << "Exiting..." << endl;
|
||||
|
||||
delete adc;
|
||||
return 0;
|
||||
}
|
66
examples/c++/adis16448.cxx
Normal file
@ -0,0 +1,66 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Submit Date: 03/09/2015
|
||||
// Author: Juan Jose Chong <juanjchong@gmail.com>
|
||||
// Copyright (c) 2015 Juan Jose Chong
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
// adis16448.cxx
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// This example code runs on an Intel Edison and uses mraa to acquire data
|
||||
// from an ADIS16448. This data is then scaled and printed onto the terminal.
|
||||
//
|
||||
// This software has been tested to connect to an ADIS16448 through a level shifter
|
||||
// such as the TI TXB0104. The SPI lines (DIN, DOUT, SCLK, /CS) are all wired through
|
||||
// the level shifter and the ADIS16448 is also being powered by the Intel Edison.
|
||||
//
|
||||
// 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 "adis16448.h"
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
while(true)
|
||||
{
|
||||
//! [Interesting]
|
||||
upm::ADIS16448* imu = new upm::ADIS16448(0,3); //upm::ADIS16448(SPI,RST)
|
||||
|
||||
//Read the specified register, scale it, and display it on the screen
|
||||
std::cout << "XGYRO_OUT:" << imu->gyroScale(imu->regRead(XGYRO_OUT)) << std::endl;
|
||||
std::cout << "YGYRO_OUT:" << imu->gyroScale(imu->regRead(YGYRO_OUT)) << std::endl;
|
||||
std::cout << "ZGYRO_OUT:" << imu->gyroScale(imu->regRead(ZGYRO_OUT)) << std::endl;
|
||||
std::cout << " " << std::endl;
|
||||
std::cout << "XACCL_OUT:" << imu->accelScale(imu->regRead(XACCL_OUT)) << std::endl;
|
||||
std::cout << "YACCL_OUT:" << imu->accelScale(imu->regRead(YACCL_OUT)) << std::endl;
|
||||
std::cout << "ZACCL_OUT:" << imu->accelScale(imu->regRead(ZACCL_OUT)) << std::endl;
|
||||
std::cout << " " << std::endl;
|
||||
//! [Interesting]
|
||||
sleep(1);
|
||||
}
|
||||
return (0);
|
||||
}
|
78
examples/c++/adxl335.cxx
Normal file
@ -0,0 +1,78 @@
|
||||
/*
|
||||
* 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 "adxl335.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
int shouldRun = true;
|
||||
|
||||
void sig_handler(int signo)
|
||||
{
|
||||
if (signo == SIGINT)
|
||||
shouldRun = false;
|
||||
}
|
||||
|
||||
|
||||
int main ()
|
||||
{
|
||||
signal(SIGINT, sig_handler);
|
||||
|
||||
//! [Interesting]
|
||||
// Instantiate an ADXL335 accelerometer on analog pins A0, A1, and A2
|
||||
upm::ADXL335* accel = new upm::ADXL335(0, 1, 2);
|
||||
|
||||
cout << "Please make sure the sensor is completely still. Sleeping for"
|
||||
<< " 2 seconds." << endl;
|
||||
sleep(2);
|
||||
cout << "Calibrating..." << endl;
|
||||
|
||||
accel->calibrate();
|
||||
|
||||
while (shouldRun)
|
||||
{
|
||||
int x, y, z;
|
||||
float aX, aY, aZ;
|
||||
|
||||
accel->values(&x, &y, &z);
|
||||
cout << "Raw Values: X: " << x << " Y: " << y << " Z: " << z << endl;
|
||||
|
||||
accel->acceleration(&aX, &aY, &aZ);
|
||||
cout << "Acceleration: X: " << aX << "g" << endl;
|
||||
cout << "Acceleration: Y: " << aY << "g" << endl;
|
||||
cout << "Acceleration: Z: " << aZ << "g" << endl;
|
||||
cout << endl;
|
||||
|
||||
usleep(200000);
|
||||
}
|
||||
//! [Interesting]
|
||||
|
||||
cout << "Exiting" << endl;
|
||||
|
||||
delete accel;
|
||||
return 0;
|
||||
}
|
51
examples/c++/adxl345.cxx
Normal file
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Author: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
|
||||
* Copyright (c) 2014 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* 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 "adxl345.h"
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
//! [Interesting]
|
||||
int16_t *raw;
|
||||
float *acc;
|
||||
|
||||
// Note: Sensor only works at 3.3V on the Intel Edison with Arduino breakout
|
||||
upm::Adxl345* accel = new upm::Adxl345(0);
|
||||
|
||||
while(true){
|
||||
accel->update(); // Update the data
|
||||
raw = accel->getRawValues(); // Read raw sensor data
|
||||
acc = accel->getAcceleration(); // Read acceleration (g)
|
||||
fprintf(stdout, "Current scale: 0x%2xg\n", accel->getScale());
|
||||
fprintf(stdout, "Raw: %6d %6d %6d\n", raw[0], raw[1], raw[2]);
|
||||
fprintf(stdout, "AccX: %5.2f g\n", acc[0]);
|
||||
fprintf(stdout, "AccY: %5.2f g\n", acc[1]);
|
||||
fprintf(stdout, "AccZ: %5.2f g\n", acc[2]);
|
||||
sleep(1);
|
||||
}
|
||||
//! [Interesting]
|
||||
return 0;
|
||||
}
|
75
examples/c++/am2315.cxx
Normal file
@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Author: William Penner <william.penner@intel.com>
|
||||
* Copyright (c) 2014 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* 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 "am2315.h"
|
||||
|
||||
volatile int doWork = 0;
|
||||
|
||||
upm::AM2315 *sensor = NULL;
|
||||
|
||||
void
|
||||
sig_handler(int signo)
|
||||
{
|
||||
if (signo == SIGINT) {
|
||||
printf("\nCtrl-C received.\n");
|
||||
doWork = 1;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
// Register signal handler
|
||||
signal(SIGINT, sig_handler);
|
||||
|
||||
//! [Interesting]
|
||||
float humidity = 0.0;
|
||||
float temperature = 0.0;
|
||||
|
||||
sensor = new upm::AM2315(0, AM2315_I2C_ADDRESS);
|
||||
|
||||
sensor->testSensor();
|
||||
|
||||
while (!doWork) {
|
||||
humidity = sensor->getHumidity();
|
||||
temperature = sensor->getTemperature();
|
||||
|
||||
std::cout << "humidity value = " <<
|
||||
humidity <<
|
||||
", temperature value = " <<
|
||||
temperature << std::endl;
|
||||
usleep (500000);
|
||||
}
|
||||
//! [Interesting]
|
||||
|
||||
std::cout << "exiting application" << std::endl;
|
||||
|
||||
delete sensor;
|
||||
|
||||
return 0;
|
||||
}
|
62
examples/c++/apds9002.cxx
Normal file
@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Author: Zion Orent <zorent@ics.com>
|
||||
* Copyright (c) 2015 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* 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 "apds9002.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
int shouldRun = true;
|
||||
|
||||
void sig_handler(int signo)
|
||||
{
|
||||
if (signo == SIGINT)
|
||||
shouldRun = false;
|
||||
}
|
||||
|
||||
|
||||
int main ()
|
||||
{
|
||||
signal(SIGINT, sig_handler);
|
||||
|
||||
//! [Interesting]
|
||||
// Instantiate a Grove Luminance sensor on analog pin A0
|
||||
upm::APDS9002* luminance = new upm::APDS9002(0);
|
||||
|
||||
while (shouldRun)
|
||||
{
|
||||
int val = luminance->value();
|
||||
cout << "Luminance value is " << val << endl;
|
||||
|
||||
sleep(1);
|
||||
}
|
||||
//! [Interesting]
|
||||
|
||||
cout << "Exiting" << endl;
|
||||
|
||||
delete luminance;
|
||||
return 0;
|
||||
}
|
90
examples/c++/at42qt1070.cxx
Normal file
@ -0,0 +1,90 @@
|
||||
/*
|
||||
* 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 "at42qt1070.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
int shouldRun = true;
|
||||
|
||||
void sig_handler(int signo)
|
||||
{
|
||||
if (signo == SIGINT)
|
||||
shouldRun = false;
|
||||
}
|
||||
|
||||
void printButtons(upm::AT42QT1070 *touch)
|
||||
{
|
||||
bool buttonPressed = false;
|
||||
uint8_t buttons = touch->getButtons();
|
||||
|
||||
cout << "Buttons Pressed: ";
|
||||
for (int i=0; i<7; i++)
|
||||
{
|
||||
if (buttons & (1 << i))
|
||||
{
|
||||
cout << i << " ";
|
||||
buttonPressed = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!buttonPressed)
|
||||
cout << "None";
|
||||
|
||||
cout << endl;
|
||||
|
||||
if (touch->isCalibrating())
|
||||
cout << "Calibration is occurring." << endl;
|
||||
|
||||
if (touch->isOverflowed())
|
||||
cout << "Overflow was detected." << endl;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
signal(SIGINT, sig_handler);
|
||||
|
||||
//! [Interesting]
|
||||
// Instantiate an AT42QT1070 on I2C bus 0
|
||||
|
||||
upm::AT42QT1070 *touch = new upm::AT42QT1070(AT42QT1070_I2C_BUS,
|
||||
AT42QT1070_DEFAULT_I2C_ADDR);
|
||||
|
||||
while (shouldRun)
|
||||
{
|
||||
touch->updateState();
|
||||
printButtons(touch);
|
||||
usleep(100000);
|
||||
}
|
||||
|
||||
//! [Interesting]
|
||||
|
||||
cout << "Exiting..." << endl;
|
||||
|
||||
delete touch;
|
||||
return 0;
|
||||
}
|
68
examples/c++/biss0001.cxx
Normal file
@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Author: Zion Orent <zorent@ics.com>
|
||||
* Copyright (c) 2014 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* 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 "biss0001.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
int shouldRun = true;
|
||||
|
||||
void sig_handler(int signo)
|
||||
{
|
||||
if (signo == SIGINT)
|
||||
shouldRun = false;
|
||||
}
|
||||
|
||||
|
||||
int main ()
|
||||
{
|
||||
signal(SIGINT, sig_handler);
|
||||
|
||||
//! [Interesting]
|
||||
// Instantiate a Grove Motion sensor on GPIO pin D2
|
||||
upm::BISS0001* motion = new upm::BISS0001(2);
|
||||
|
||||
while (shouldRun)
|
||||
{
|
||||
bool val = motion->value();
|
||||
|
||||
if (val)
|
||||
cout << "Detecting moving object";
|
||||
else
|
||||
cout << "No moving objects detected";
|
||||
|
||||
cout << endl;
|
||||
|
||||
sleep(1);
|
||||
}
|
||||
//! [Interesting]
|
||||
|
||||
cout << "Exiting" << endl;
|
||||
|
||||
delete motion;
|
||||
return 0;
|
||||
}
|
80
examples/c++/bmpx8x.cxx
Normal file
@ -0,0 +1,80 @@
|
||||
/*
|
||||
* Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
|
||||
* Copyright (c) 2014 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* 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 "bmpx8x.h"
|
||||
#include <signal.h>
|
||||
|
||||
int doWork = 0;
|
||||
upm::BMPX8X *sensor = NULL;
|
||||
|
||||
void
|
||||
sig_handler(int signo)
|
||||
{
|
||||
printf("got signal\n");
|
||||
if (signo == SIGINT) {
|
||||
printf("exiting application\n");
|
||||
doWork = 1;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
//! [Interesting]
|
||||
uint32_t presure = 0;
|
||||
float temperature = 0;
|
||||
float altitude = 0;
|
||||
uint32_t sealevel = 0;
|
||||
|
||||
// Instantiate a BMPX8X sensor on I2C
|
||||
sensor = new upm::BMPX8X(0, ADDR);
|
||||
|
||||
// Print the pressure, altitude, sea level, and
|
||||
// temperature values every 0.1 seconds
|
||||
while (!doWork) {
|
||||
presure = sensor->getPressure ();
|
||||
temperature = sensor->getTemperature ();
|
||||
altitude = sensor->getAltitude ();
|
||||
sealevel = sensor->getSealevelPressure ();
|
||||
|
||||
std::cout << "pressure value = " <<
|
||||
presure <<
|
||||
", altitude value = " <<
|
||||
altitude <<
|
||||
", sealevel value = " <<
|
||||
sealevel <<
|
||||
", temperature = " <<
|
||||
temperature << std::endl;
|
||||
usleep (100000);
|
||||
}
|
||||
//! [Interesting]
|
||||
|
||||
std::cout << "exiting application" << std::endl;
|
||||
|
||||
delete sensor;
|
||||
|
||||
return 0;
|
||||
}
|
@ -25,39 +25,24 @@
|
||||
#include <unistd.h>
|
||||
#include <iostream>
|
||||
#include <signal.h>
|
||||
|
||||
#include "buzzer.h"
|
||||
|
||||
int running = 0;
|
||||
|
||||
void
|
||||
sig_handler(int signo)
|
||||
{
|
||||
printf("got signal\n");
|
||||
if (signo == SIGINT) {
|
||||
printf("exiting application\n");
|
||||
running = 1;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv) {
|
||||
//! [Interesting]
|
||||
int chord[] = { DO, RE, MI, FA, SOL, LA, SI, DO, SI };
|
||||
|
||||
//! [Interesting]
|
||||
// create Buzzer instance
|
||||
upm::Buzzer* sound = new upm::Buzzer(5);
|
||||
// print sensor name
|
||||
std::cout << sound->name() << std::endl;
|
||||
// play sound (DO, RE, ME, etc...)
|
||||
|
||||
signal(SIGINT, sig_handler);
|
||||
|
||||
while (!running) {
|
||||
for (int chord_ind = 0; chord_ind < 9; chord_ind++) {
|
||||
std::cout << sound->playSound(chord[chord_ind]) << std::endl;
|
||||
usleep(1000);
|
||||
}
|
||||
// play sound (DO, RE, MI, etc...), pausing for 0.1 seconds between notes
|
||||
for (int chord_ind = 0; chord_ind < 7; chord_ind++) {
|
||||
// play each note for one second
|
||||
std::cout << sound->playSound(chord[chord_ind], 1000000) << std::endl;
|
||||
usleep(100000);
|
||||
}
|
||||
//! [Interesting]
|
||||
|
77
examples/c++/cjq4435.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 "cjq4435.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
int shouldRun = true;
|
||||
|
||||
void sig_handler(int signo)
|
||||
{
|
||||
if (signo == SIGINT)
|
||||
shouldRun = false;
|
||||
}
|
||||
|
||||
|
||||
int main ()
|
||||
{
|
||||
signal(SIGINT, sig_handler);
|
||||
|
||||
//! [Interesting]
|
||||
// Instantiate a CJQ4435 MOSFET on a PWM capable digital pin D3
|
||||
upm::CJQ4435* mosfet = new upm::CJQ4435(3);
|
||||
|
||||
mosfet->setPeriodMS(10);
|
||||
mosfet->enable(true);
|
||||
|
||||
while (shouldRun)
|
||||
{
|
||||
// start with a duty cycle of 0.0 (off) and increment to 1.0 (on)
|
||||
for (float i=0.0; i <= 1.0; i+=0.1)
|
||||
{
|
||||
mosfet->setDutyCycle(i);
|
||||
usleep(100000);
|
||||
}
|
||||
sleep(1);
|
||||
// Now take it back down
|
||||
// start with a duty cycle of 1.0 (on) and decrement to 0.0 (off)
|
||||
for (float i=1.0; i >= 0.0; i-=0.1)
|
||||
{
|
||||
mosfet->setDutyCycle(i);
|
||||
usleep(100000);
|
||||
}
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
//! [Interesting]
|
||||
|
||||
cout << "Exiting..." << endl;
|
||||
|
||||
delete mosfet;
|
||||
return 0;
|
||||
}
|
77
examples/c++/ds1307.cxx
Normal file
@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Author: Jon Trulson <jtrulson@ics.com>
|
||||
* Copyright (c) 2014 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* 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 "ds1307.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
void printTime(upm::DS1307 *rtc)
|
||||
{
|
||||
cout << "The time is: " <<
|
||||
rtc->month << "/" << rtc->dayOfMonth << "/" << rtc->year << " "
|
||||
<< rtc->hours << ":" << rtc->minutes << ":" << rtc->seconds;
|
||||
|
||||
if (rtc->amPmMode)
|
||||
cout << (rtc->pm) ? " PM " : " AM ";
|
||||
|
||||
cout << endl;
|
||||
|
||||
cout << "Clock is in " << ((rtc->amPmMode) ? "AM/PM mode" : "24hr mode")
|
||||
<< endl;
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
//! [Interesting]
|
||||
// Instantiate a DS1037 on I2C bus 0
|
||||
upm::DS1307 *rtc = new upm::DS1307(0);
|
||||
|
||||
// always do this first
|
||||
cout << "Loading the current time... " << endl;
|
||||
if (!rtc->loadTime())
|
||||
{
|
||||
cerr << "rtc->loadTime() failed." << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
printTime(rtc);
|
||||
|
||||
// set the year as an example
|
||||
cout << "setting the year to 50" << endl;
|
||||
rtc->year = 50;
|
||||
|
||||
rtc->setTime();
|
||||
|
||||
// reload the time and print it
|
||||
rtc->loadTime();
|
||||
printTime(rtc);
|
||||
|
||||
//! [Interesting]
|
||||
|
||||
delete rtc;
|
||||
return 0;
|
||||
}
|
61
examples/c++/ecs1030.cxx
Normal file
@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
|
||||
* Copyright (c) 2014 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* 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 <stdlib.h>
|
||||
#include "ecs1030.h"
|
||||
|
||||
int is_running = 0;
|
||||
upm::ECS1030 *sensor = NULL;
|
||||
|
||||
void
|
||||
sig_handler(int signo)
|
||||
{
|
||||
printf("got signal\n");
|
||||
if (signo == SIGINT) {
|
||||
is_running = 1;
|
||||
}
|
||||
}
|
||||
|
||||
//! [Interesting]
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
sensor = new upm::ECS1030(0);
|
||||
signal(SIGINT, sig_handler);
|
||||
|
||||
while (!is_running) {
|
||||
std::cout << "I = " << sensor->getCurrency_A () << ", Power = " << sensor->getPower_A () << std::endl;
|
||||
std::cout << "I = " << sensor->getCurrency_B () << ", Power = " << sensor->getPower_B () << std::endl;
|
||||
}
|
||||
|
||||
std::cout << "exiting application" << std::endl;
|
||||
|
||||
delete sensor;
|
||||
|
||||
return 0;
|
||||
}
|
||||
//! [Interesting]
|
79
examples/c++/enc03r.cxx
Normal file
@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Author: Jon Trulson <jtrulson@ics.com>
|
||||
* Copyright (c) 2014 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* 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 "enc03r.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
bool shouldRun = true;
|
||||
|
||||
// analog voltage, usually 3.3 or 5.0
|
||||
#define CALIBRATION_SAMPLES 1000
|
||||
|
||||
void sig_handler(int signo)
|
||||
{
|
||||
if (signo == SIGINT)
|
||||
shouldRun = false;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
signal(SIGINT, sig_handler);
|
||||
|
||||
//! [Interesting]
|
||||
|
||||
// Instantiate a ENC03R on analog pin A0
|
||||
upm::ENC03R *gyro = new upm::ENC03R(0);
|
||||
|
||||
// The first thing we need to do is calibrate the sensor.
|
||||
cout << "Please place the sensor in a stable location, and do not" << endl;
|
||||
cout << "move it while calibration takes place." << endl;
|
||||
cout << "This may take a couple of minutes." << endl;
|
||||
|
||||
gyro->calibrate(CALIBRATION_SAMPLES);
|
||||
cout << "Calibration complete. Reference value: "
|
||||
<< gyro->calibrationValue() << endl;
|
||||
|
||||
// Read the input and print both the raw value and the angular velocity,
|
||||
// waiting 0.1 seconds between readings
|
||||
while (shouldRun)
|
||||
{
|
||||
unsigned int val = gyro->value();
|
||||
double av = gyro->angularVelocity(val);
|
||||
|
||||
cout << "Raw value: " << val << ", "
|
||||
<< "angular velocity: " << av << " deg/s" << endl;
|
||||
|
||||
usleep(100000);
|
||||
}
|
||||
//! [Interesting]
|
||||
|
||||
cout << "Exiting" << endl;
|
||||
|
||||
delete gyro;
|
||||
return 0;
|
||||
}
|
61
examples/c++/es08a.cxx
Normal file
@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
|
||||
* Copyright (c) 2014 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* 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 "es08a.h"
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
//! [Interesting]
|
||||
upm::ES08A *servo = new upm::ES08A(5);
|
||||
|
||||
// Sets the shaft to 180, then to 90, then to 0,
|
||||
// then back to 90, and finally back to 180,
|
||||
// pausing for a second in between each angle
|
||||
servo->setAngle (180);
|
||||
std::cout << "Set angle to 180" << std::endl;
|
||||
sleep(1);
|
||||
servo->setAngle (90);
|
||||
std::cout << "Set angle to 90" << std::endl;
|
||||
sleep(1);
|
||||
servo->setAngle (0);
|
||||
std::cout << "Set angle to 0" << std::endl;
|
||||
sleep(1);
|
||||
servo->setAngle (90);
|
||||
std::cout << "Set angle to 90" << std::endl;
|
||||
sleep(1);
|
||||
servo->setAngle (180);
|
||||
std::cout << "Set angle to 180" << std::endl;
|
||||
//! [Interesting]
|
||||
|
||||
std::cout << "exiting application" << std::endl;
|
||||
|
||||
delete servo;
|
||||
|
||||
return 0;
|
||||
}
|
66
examples/c++/flex.cxx
Normal file
@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Author: Zion Orent <zorent@ics.com>
|
||||
* Copyright (c) 2015 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* 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 "flex.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
bool shouldRun = true;
|
||||
|
||||
void sig_handler(int signo)
|
||||
{
|
||||
if (signo == SIGINT)
|
||||
shouldRun = false;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
signal(SIGINT, sig_handler);
|
||||
|
||||
//! [Interesting]
|
||||
// The was tested with a Spectra Symbol flex sensor.
|
||||
// We attached a 22K resistor to a breadboard,
|
||||
// with 1 end attached to GND and the other connected to
|
||||
// both the flex sensor and A0.
|
||||
// The flex sensor was connected on 1 pin to the 22K resistor and A0
|
||||
// and on the other pin to 5V.
|
||||
|
||||
// Instantiate a Flex sensor on analog pin A0
|
||||
upm::Flex *flex = new upm::Flex(0);
|
||||
|
||||
while (shouldRun)
|
||||
{
|
||||
cout << "Flex value: " << flex->value() << endl;
|
||||
sleep(1);
|
||||
}
|
||||
//! [Interesting]
|
||||
|
||||
cout << "Exiting" << endl;
|
||||
|
||||
delete flex;
|
||||
return 0;
|
||||
}
|
73
examples/c++/gp2y0a.cxx
Normal file
@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Author: Jon Trulson <jtrulson@ics.com>
|
||||
* Copyright (c) 2014 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* 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 "gp2y0a.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
bool shouldRun = true;
|
||||
|
||||
// analog voltage, usually 3.3 or 5.0
|
||||
#define GP2Y0A_AREF 5.0
|
||||
#define SAMPLES_PER_QUERY 20
|
||||
|
||||
void sig_handler(int signo)
|
||||
{
|
||||
if (signo == SIGINT)
|
||||
shouldRun = false;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
signal(SIGINT, sig_handler);
|
||||
|
||||
//! [Interesting]
|
||||
// Note, for the Grove 80cm version of this sensor, due to the way
|
||||
// it is wired, you need to plug this into the A0 port, where it
|
||||
// will use the available A1 pin for data.
|
||||
|
||||
// Instantiate a GP2Y0A on analog pin A1
|
||||
upm::GP2Y0A *volts = new upm::GP2Y0A(1);
|
||||
|
||||
// The higher the voltage (closer to AREF) the closer the object is. NOTE:
|
||||
// the measured voltage will probably not exceed 3.3 volts.
|
||||
// Every second, print the averaged voltage value (averaged over 20 samples).
|
||||
while (shouldRun)
|
||||
{
|
||||
cout << "AREF: " << GP2Y0A_AREF
|
||||
<< ", Voltage value (higher means closer): "
|
||||
<< volts->value(GP2Y0A_AREF, SAMPLES_PER_QUERY) << endl;
|
||||
|
||||
sleep(1);
|
||||
}
|
||||
//! [Interesting]
|
||||
|
||||
cout << "Exiting" << endl;
|
||||
|
||||
delete volts;
|
||||
return 0;
|
||||
}
|
49
examples/c++/grovebutton.cxx
Normal file
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Author: Sarah Knepper <sarah.knepper@intel.com>
|
||||
* Copyright (c) 2014 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* 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 "grove.h"
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
// This example uses GPIO 0
|
||||
//! [Interesting]
|
||||
|
||||
// Create the button object using GPIO pin 0
|
||||
upm::GroveButton* button = new upm::GroveButton(0);
|
||||
|
||||
// Read the input and print, waiting one second between readings
|
||||
while( 1 ) {
|
||||
std::cout << button->name() << " value is " << button->value() << std::endl;
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
// Delete the button object
|
||||
delete button;
|
||||
//! [Interesting]
|
||||
|
||||
return 0;
|
||||
}
|
69
examples/c++/grovecollision.cxx
Normal file
@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Author: Zion Orent <zorent@ics.com>
|
||||
* Copyright (c) 2015 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* 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 "grovecollision.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]
|
||||
// The was tested with the Grove Collision Sensor
|
||||
// Instantiate a Grove Collision on digital pin D2
|
||||
upm::GroveCollision* collision = new upm::GroveCollision(2);
|
||||
|
||||
bool collisionState = false;
|
||||
cout << "No collision" << endl;
|
||||
while (shouldRun)
|
||||
{
|
||||
if (collision->isColliding() && !collisionState)
|
||||
{
|
||||
cout << "Collision!" << endl;
|
||||
collisionState = true;
|
||||
}
|
||||
else if (collisionState)
|
||||
{
|
||||
cout << "No collision" << endl;
|
||||
collisionState = false;
|
||||
}
|
||||
}
|
||||
|
||||
//! [Interesting]
|
||||
cout << "Exiting" << endl;
|
||||
|
||||
delete collision;
|
||||
return 0;
|
||||
}
|
78
examples/c++/groveehr.cxx
Normal file
@ -0,0 +1,78 @@
|
||||
/*
|
||||
* Author: Jon Trulson <jtrulson@ics.com>
|
||||
* Copyright (c) 2014 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* 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 "groveehr.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
int shouldRun = true;
|
||||
|
||||
void sig_handler(int signo)
|
||||
{
|
||||
if (signo == SIGINT)
|
||||
shouldRun = false;
|
||||
}
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
signal(SIGINT, sig_handler);
|
||||
|
||||
//! [Interesting]
|
||||
// Instantiate a Grove Ear-clip Heart Rate sensor on digital pin D2
|
||||
upm::GroveEHR* heart = new upm::GroveEHR(2);
|
||||
|
||||
// set the beat counter to 0, init the clock and start counting beats
|
||||
heart->clearBeatCounter();
|
||||
heart->initClock();
|
||||
heart->startBeatCounter();
|
||||
|
||||
while (shouldRun)
|
||||
{
|
||||
// we grab these just for display purposes in this example
|
||||
uint32_t millis = heart->getMillis();
|
||||
uint32_t beats = heart->beatCounter();
|
||||
|
||||
// heartRate() requires that at least 5 seconds pass before
|
||||
// returning anything other than 0
|
||||
int hr = heart->heartRate();
|
||||
|
||||
// output milliseconds passed, beat count, and computed heart rate
|
||||
cout << "Millis: " << millis << " Beats: " << beats;
|
||||
cout << " Heart Rate: " << hr << endl;
|
||||
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
heart->stopBeatCounter();
|
||||
//! [Interesting]
|
||||
|
||||
cout << "Exiting..." << endl;
|
||||
|
||||
delete heart;
|
||||
return 0;
|
||||
}
|
66
examples/c++/groveeldriver.cxx
Normal file
@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Author: Zion Orent <zorent@ics.com>
|
||||
* Copyright (c) 2015 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* 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 "groveeldriver.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]
|
||||
// The was tested with the Grove El Driver Module
|
||||
// Instantiate a Grove El Driver on digital pin D2
|
||||
upm::GroveElDriver* eldriver = new upm::GroveElDriver(2);
|
||||
|
||||
bool lightState = true;
|
||||
|
||||
while (shouldRun)
|
||||
{
|
||||
if (lightState)
|
||||
eldriver->on();
|
||||
else
|
||||
eldriver->off();
|
||||
lightState = !lightState;
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
//! [Interesting]
|
||||
eldriver->off();
|
||||
cout << "Exiting" << endl;
|
||||
|
||||
delete eldriver;
|
||||
return 0;
|
||||
}
|
79
examples/c++/groveelectromagnet.cxx
Normal file
@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Author: Zion Orent <zorent@ics.com>
|
||||
* Copyright (c) 2015 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* 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 <time.h>
|
||||
#include <signal.h>
|
||||
#include "groveelectromagnet.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
int shouldRun = true;
|
||||
|
||||
void sig_handler(int signo)
|
||||
{
|
||||
if (signo == SIGINT)
|
||||
shouldRun = false;
|
||||
}
|
||||
|
||||
float get_time()
|
||||
{
|
||||
return ((float)(clock()))/CLOCKS_PER_SEC;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
signal(SIGINT, sig_handler);
|
||||
|
||||
//! [Interesting]
|
||||
// The was tested with the Grove Electromagnetic Module
|
||||
// Instantiate a Grove Electromagnet on digital pin D2
|
||||
upm::GroveElectromagnet* magnet = new upm::GroveElectromagnet(2);
|
||||
cout << "Starting up magnet...." << endl;
|
||||
magnet->off();
|
||||
|
||||
bool magnetState = false;
|
||||
float time_passed = get_time();
|
||||
|
||||
// Turn magnet on and off every 5 seconds
|
||||
while (shouldRun)
|
||||
{
|
||||
if ((get_time() - time_passed) > 5.0)
|
||||
{
|
||||
magnetState = !magnetState;
|
||||
if (magnetState)
|
||||
magnet->on();
|
||||
else
|
||||
magnet->off();
|
||||
cout << "Turning magnet " << ((magnetState) ? "on" : "off") << endl;
|
||||
time_passed = get_time();
|
||||
}
|
||||
}
|
||||
|
||||
//! [Interesting]
|
||||
magnet->off();
|
||||
cout << "Exiting" << endl;
|
||||
|
||||
delete magnet;
|
||||
return 0;
|
||||
}
|
60
examples/c++/groveemg.cxx
Normal file
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Author: Zion Orent <zorent@ics.com>
|
||||
* Copyright (c) 2015 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* 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 "groveemg.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]
|
||||
// The was tested with the GroveEMG Muscle Signal Reader Sensor Module
|
||||
// Instantiate a GroveEMG on analog pin A0
|
||||
upm::GroveEMG *emg = new upm::GroveEMG(0);
|
||||
cout << "Calibrating...." << endl;
|
||||
emg->calibrate();
|
||||
|
||||
while (shouldRun)
|
||||
{
|
||||
cout << emg->value() << endl;
|
||||
usleep(100000);
|
||||
}
|
||||
|
||||
//! [Interesting]
|
||||
cout << "Exiting" << endl;
|
||||
delete emg;
|
||||
return 0;
|
||||
}
|
63
examples/c++/grovegsr.cxx
Normal file
@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Author: Zion Orent <zorent@ics.com>
|
||||
* Copyright (c) 2015 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* 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 "grovegsr.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
bool shouldRun = true;
|
||||
|
||||
void sig_handler(int signo)
|
||||
{
|
||||
if (signo == SIGINT)
|
||||
shouldRun = false;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
signal(SIGINT, sig_handler);
|
||||
|
||||
//! [Interesting]
|
||||
// The was tested with the GroveGSR Galvanic Skin Response Sensor module.
|
||||
|
||||
// Instantiate a GroveGSR on analog pin A0
|
||||
upm::GroveGSR *gsr = new upm::GroveGSR(0);
|
||||
cout << "Calibrating...." << endl;
|
||||
gsr->calibrate();
|
||||
|
||||
while (shouldRun)
|
||||
{
|
||||
cout << gsr->value() << endl;
|
||||
usleep(500000);
|
||||
}
|
||||
//! [Interesting]
|
||||
|
||||
cout << "Exiting" << endl;
|
||||
|
||||
delete gsr;
|
||||
return 0;
|
||||
}
|
68
examples/c++/groveled-multi.cxx
Normal file
@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Author: Jon Trulson <jtrulson@ics.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 <unistd.h>
|
||||
#include <iostream>
|
||||
#include <signal.h>
|
||||
#include "grove.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
int shouldRun = true;
|
||||
|
||||
void sig_handler(int signo)
|
||||
{
|
||||
if (signo == SIGINT)
|
||||
shouldRun = false;
|
||||
}
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
signal(SIGINT, sig_handler);
|
||||
|
||||
//! [Interesting]
|
||||
|
||||
// Instantiate a grove LED on D2. Here we are controlling a Grove
|
||||
// Multi-color flash LED. We just just need to turn it on - it will
|
||||
// then cycle through various colors (red, green, blue, purple) on it's
|
||||
// own until turned off.
|
||||
upm::GroveLed* led = new upm::GroveLed(2);
|
||||
|
||||
// start the light show
|
||||
led->on();
|
||||
|
||||
// just sleep until interrupted
|
||||
while (shouldRun)
|
||||
sleep(1);
|
||||
|
||||
//! [Interesting]
|
||||
|
||||
led->off();
|
||||
cout << "Exiting..." << endl;
|
||||
|
||||
delete led;
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Author: Brendan Le Foll <brendan.le.foll@intel.com>
|
||||
* Contributions: Sarah Knepper <sarah.knepper@intel.com>
|
||||
* Copyright (c) 2014 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
@ -29,9 +30,16 @@
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
// Use i2c device 0 all the time
|
||||
//! [Interesting]
|
||||
|
||||
// Create the Grove LED object using GPIO pin 2
|
||||
upm::GroveLed* led = new upm::GroveLed(2);
|
||||
|
||||
// Print the name
|
||||
std::cout << led->name() << std::endl;
|
||||
|
||||
// Turn the LED on and off 10 times, pausing one second
|
||||
// between transitions
|
||||
for (int i=0; i < 10; i++) {
|
||||
led->on();
|
||||
sleep(1);
|
||||
@ -39,5 +47,9 @@ main(int argc, char **argv)
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
// Delete the Grove LED object
|
||||
delete led;
|
||||
//! [Interesting]
|
||||
|
||||
return 0;
|
||||
}
|
49
examples/c++/grovelight.cxx
Normal file
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Author: Brendan Le Foll <brendan.le.foll@intel.com>
|
||||
* Contributions: Sarah Knepper <sarah.knepper@intel.com>
|
||||
* Copyright (c) 2014 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* 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 "grove.h"
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
//! [Interesting]
|
||||
// Create the light sensor object using AIO pin 0
|
||||
upm::GroveLight* light = new upm::GroveLight(0);
|
||||
|
||||
// Read the input and print both the raw value and a rough lux value,
|
||||
// waiting one second between readings
|
||||
while( 1 ) {
|
||||
std::cout << light->name() << " raw value is " << light->raw_value() <<
|
||||
", which is roughly " << light->value() << " lux" << std::endl;
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
// Delete the light sensor object
|
||||
delete light;
|
||||
//! [Interesting]
|
||||
return 0;
|
||||
}
|
66
examples/c++/grovelinefinder.cxx
Normal file
@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Author: Jon Trulson <jtrulson@ics.com>
|
||||
* Copyright (c) 2014 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* 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 "grovelinefinder.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
int shouldRun = true;
|
||||
|
||||
void sig_handler(int signo)
|
||||
{
|
||||
if (signo == SIGINT)
|
||||
shouldRun = false;
|
||||
}
|
||||
|
||||
|
||||
int main ()
|
||||
{
|
||||
signal(SIGINT, sig_handler);
|
||||
|
||||
//! [Interesting]
|
||||
// Instantiate a Grove Line Finder sensor on digital pin D2
|
||||
upm::GroveLineFinder* finder = new upm::GroveLineFinder(2);
|
||||
|
||||
// check every second for the presence of white detection
|
||||
while (shouldRun)
|
||||
{
|
||||
bool val = finder->whiteDetected();
|
||||
if (val)
|
||||
cout << "White detected." << endl;
|
||||
else
|
||||
cout << "Black detected." << endl;
|
||||
|
||||
sleep(1);
|
||||
}
|
||||
//! [Interesting]
|
||||
|
||||
cout << "Exiting..." << endl;
|
||||
|
||||
delete finder;
|
||||
return 0;
|
||||
}
|
63
examples/c++/groveloudness.cxx
Normal file
@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Author: Jon Trulson <jtrulson@ics.com>
|
||||
* Copyright (c) 2014 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* 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 "groveloudness.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
int shouldRun = true;
|
||||
|
||||
void sig_handler(int signo)
|
||||
{
|
||||
if (signo == SIGINT)
|
||||
shouldRun = false;
|
||||
}
|
||||
|
||||
|
||||
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
|
||||
while (shouldRun)
|
||||
{
|
||||
int val = loudness->value();
|
||||
cout << "Loudness value (higher is louder): " << val << endl;
|
||||
|
||||
usleep(100000);
|
||||
}
|
||||
//! [Interesting]
|
||||
|
||||
cout << "Exiting" << endl;
|
||||
|
||||
delete loudness;
|
||||
return 0;
|
||||
}
|
60
examples/c++/grovemd.cxx
Normal file
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Author: Jon Trulson <jtrulson@ics.com>
|
||||
* Copyright (c) 2014 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* 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);
|
||||
|
||||
// set direction to CW and set speed to 50%
|
||||
cout << "Spin M1 and M2 at half speed for 3 seconds" << endl;
|
||||
motors->setMotorDirections(upm::GroveMD::DIR_CW, upm::GroveMD::DIR_CW);
|
||||
motors->setMotorSpeeds(127, 127);
|
||||
|
||||
sleep(3);
|
||||
// counter clockwise
|
||||
cout << "Reversing M1 and M2 for 3 seconds" << endl;
|
||||
motors->setMotorDirections(upm::GroveMD::DIR_CCW, upm::GroveMD::DIR_CCW);
|
||||
sleep(3);
|
||||
|
||||
//! [Interesting]
|
||||
|
||||
cout << "Stopping motors" << endl;
|
||||
motors->setMotorSpeeds(0, 0);
|
||||
|
||||
cout << "Exiting..." << endl;
|
||||
|
||||
delete motors;
|
||||
return 0;
|
||||
}
|
75
examples/c++/grovemoisture.cxx
Normal file
@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Author: Jon Trulson <jtrulson@ics.com>
|
||||
* Copyright (c) 2014 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* 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 "grovemoisture.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
int shouldRun = true;
|
||||
|
||||
void sig_handler(int signo)
|
||||
{
|
||||
if (signo == SIGINT)
|
||||
shouldRun = false;
|
||||
}
|
||||
|
||||
|
||||
int main ()
|
||||
{
|
||||
signal(SIGINT, sig_handler);
|
||||
|
||||
//! [Interesting]
|
||||
// Instantiate a Grove Moisture sensor on analog pin A0
|
||||
upm::GroveMoisture* moisture = new upm::GroveMoisture(0);
|
||||
|
||||
// Values (approximate):
|
||||
// 0-300, sensor in air or dry soil
|
||||
// 300-600, sensor in humid soil
|
||||
// 600+, sensor in wet soil or submerged in water.
|
||||
// Read the value every second and print the corresponding moisture level
|
||||
while (shouldRun)
|
||||
{
|
||||
int val = moisture->value();
|
||||
cout << "Moisture value: " << val << ", ";
|
||||
if (val >= 0 && val < 300)
|
||||
cout << "dry";
|
||||
else if (val >= 300 && val < 600)
|
||||
cout << "moist";
|
||||
else
|
||||
cout << "wet";
|
||||
|
||||
cout << endl;
|
||||
|
||||
sleep(1);
|
||||
}
|
||||
//! [Interesting]
|
||||
|
||||
cout << "Exiting" << endl;
|
||||
|
||||
delete moisture;
|
||||
return 0;
|
||||
}
|
57
examples/c++/groveo2.cxx
Normal file
@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Author: Zion Orent <zorent@ics.com>
|
||||
* Copyright (c) 2015 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* 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 "groveo2.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]
|
||||
// The was tested with the O2 Oxygen Concentration Sensor Module
|
||||
// Instantiate a GroveO2 on analog pin A0
|
||||
upm::GroveO2 *O2 = new upm::GroveO2(0);
|
||||
while (shouldRun)
|
||||
{
|
||||
cout << "The output voltage is: " << O2->voltageValue() << "mV" << endl;
|
||||
usleep(100000);
|
||||
}
|
||||
|
||||
//! [Interesting]
|
||||
cout << "Exiting" << endl;
|
||||
delete O2;
|
||||
return 0;
|
||||
}
|
58
examples/c++/groverelay.cxx
Normal file
@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Author: Sarah Knepper <sarah.knepper@intel.com>
|
||||
* Copyright (c) 2015 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <iostream>
|
||||
#include "grove.h"
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
// This example uses GPIO 0
|
||||
//! [Interesting]
|
||||
|
||||
// Create the relay switch object using GPIO pin 0
|
||||
upm::GroveRelay* relay = new upm::GroveRelay(0);
|
||||
|
||||
// Close and then open the relay switch 3 times,
|
||||
// waiting one second each time. The LED on the relay switch
|
||||
// will light up when the switch is on (closed).
|
||||
// The switch will also make a noise between transitions.
|
||||
for ( int i = 0; i < 3; i++ ) {
|
||||
relay->on();
|
||||
if ( relay->isOn() )
|
||||
std::cout << relay->name() << " is on" << std::endl;
|
||||
sleep(1);
|
||||
relay->off();
|
||||
if ( relay->isOff() )
|
||||
std::cout << relay->name() << " is off" << std::endl;
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
// Delete the relay switch object
|
||||
delete relay;
|
||||
//! [Interesting]
|
||||
|
||||
return 0;
|
||||
}
|
57
examples/c++/groverotary.cxx
Normal file
@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Author: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
|
||||
* Copyright (c) 2014 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* 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 <iomanip>
|
||||
#include "grove.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main ()
|
||||
{
|
||||
//! [Interesting]
|
||||
// Instantiate a rotary sensor on analog pin A0
|
||||
upm::GroveRotary* knob = new upm::GroveRotary(0);
|
||||
|
||||
// Print sensor name to confirm it initialized properly
|
||||
cout << knob->name() << endl;
|
||||
|
||||
while(true) {
|
||||
float abs_value = knob->abs_value(); // Absolute raw value
|
||||
float abs_deg = knob->abs_deg(); // Absolute degrees
|
||||
float abs_rad = knob->abs_rad(); // Absolute radians
|
||||
float rel_value = knob->rel_value(); // Relative raw value
|
||||
float rel_deg = knob->rel_deg(); // Relative degrees
|
||||
float rel_rad = knob->rel_rad(); // Relative radians
|
||||
|
||||
fprintf(stdout, "Absolute: %4d raw %5.2f deg = %3.2f rad Relative: %4d raw %5.2f deg %3.2f rad\n",
|
||||
(int16_t)abs_value, abs_deg, abs_rad, (int16_t)rel_value, rel_deg, rel_rad);
|
||||
|
||||
usleep(2500000); // Sleep for 2.5s
|
||||
}
|
||||
//! [Interesting]
|
||||
delete knob;
|
||||
return 0;
|
||||
}
|
50
examples/c++/groveslide.cxx
Normal file
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Author: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
|
||||
* Copyright (c) 2014 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* 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 <iomanip>
|
||||
#include "grove.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main ()
|
||||
{
|
||||
//! [Interesting]
|
||||
upm::GroveSlide* slide = new upm::GroveSlide(0); // Instantiate new grove slide potentiometer on analog pin A0
|
||||
|
||||
cout << slide->name() << endl;
|
||||
|
||||
while(true) {
|
||||
float adc_value = slide->raw_value(); // Read raw value
|
||||
float volts = slide->voltage_value(); // Read voltage, board reference set at 5.0V
|
||||
fprintf(stdout, "%4d = %.2f V\n", (uint16_t)adc_value, volts);
|
||||
|
||||
usleep(2500000); // Sleep for 2.5s
|
||||
}
|
||||
//! [Interesting]
|
||||
delete slide;
|
||||
return 0;
|
||||
}
|
49
examples/c++/grovespeaker.cxx
Normal file
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Author: Jon Trulson <jtrulson@ics.com>
|
||||
* Copyright (c) 2014 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* 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 "grovespeaker.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main ()
|
||||
{
|
||||
//! [Interesting]
|
||||
// Instantiate a Grove Speaker on digital pin D2
|
||||
upm::GroveSpeaker* speaker = new upm::GroveSpeaker(2);
|
||||
|
||||
// Play all 7 of the lowest notes
|
||||
speaker->playAll();
|
||||
|
||||
// Play a medium C-sharp
|
||||
speaker->playSound('c', true, "med");
|
||||
//! [Interesting]
|
||||
|
||||
cout << "Exiting" << endl;
|
||||
|
||||
delete speaker;
|
||||
return 0;
|
||||
}
|
55
examples/c++/grovetemp.cxx
Normal file
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Author: Brendan Le Foll <brendan.le.foll@intel.com>
|
||||
* Contributions: Sarah Knepper <sarah.knepper@intel.com>
|
||||
* Copyright (c) 2014 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* 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 <iomanip>
|
||||
#include "grove.h"
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
//! [Interesting]
|
||||
|
||||
// Create the temperature sensor object using AIO pin 0
|
||||
upm::GroveTemp* temp = new upm::GroveTemp(0);
|
||||
std::cout << temp->name() << std::endl;
|
||||
|
||||
// Read the temperature ten times, printing both the Celsius and
|
||||
// equivalent Fahrenheit temperature, waiting one second between readings
|
||||
for (int i=0; i < 10; i++) {
|
||||
int celsius = temp->value();
|
||||
int fahrenheit = (int) (celsius * 9.0/5.0 + 32.0);
|
||||
printf("%d degrees Celsius, or %d degrees Fahrenheit\n",
|
||||
celsius, fahrenheit);
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
// Delete the temperature sensor object
|
||||
delete temp;
|
||||
//! [Interesting]
|
||||
|
||||
return 0;
|
||||
}
|
67
examples/c++/grovevdiv.cxx
Normal file
@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Author: Jon Trulson <jtrulson@ics.com>
|
||||
* Copyright (c) 2014 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* 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 "grovevdiv.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 Grove Voltage Divider sensor on analog pin A0
|
||||
upm::GroveVDiv* vDiv = new upm::GroveVDiv(0);
|
||||
|
||||
// collect data and output measured voltage according to the setting
|
||||
// of the scaling switch (3 or 10)
|
||||
while (shouldRun)
|
||||
{
|
||||
unsigned int val = vDiv->value(100);
|
||||
float gain3val = vDiv->computedValue(3, val);
|
||||
float gain10val = vDiv->computedValue(10, val);
|
||||
cout << "ADC value: " << val << " Gain 3: " << gain3val
|
||||
<< "v Gain 10: " << gain10val << "v" << endl;
|
||||
|
||||
sleep(1);
|
||||
}
|
||||
//! [Interesting]
|
||||
|
||||
cout << "Exiting..." << endl;
|
||||
|
||||
delete vDiv;
|
||||
return 0;
|
||||
}
|
65
examples/c++/grovewater.cxx
Normal file
@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Author: Jon Trulson <jtrulson@ics.com>
|
||||
* Copyright (c) 2014 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* 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 "grovewater.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
int shouldRun = true;
|
||||
|
||||
void sig_handler(int signo)
|
||||
{
|
||||
if (signo == SIGINT)
|
||||
shouldRun = false;
|
||||
}
|
||||
|
||||
|
||||
int main ()
|
||||
{
|
||||
signal(SIGINT, sig_handler);
|
||||
|
||||
//! [Interesting]
|
||||
// Instantiate a Grove Water sensor on digital pin D2
|
||||
upm::GroveWater* water = new upm::GroveWater(2);
|
||||
|
||||
while (shouldRun)
|
||||
{
|
||||
bool val = water->isWet();
|
||||
if (val)
|
||||
cout << "Sensor is wet." << endl;
|
||||
else
|
||||
cout << "Sensor is dry." << endl;
|
||||
|
||||
sleep(1);
|
||||
}
|
||||
//! [Interesting]
|
||||
|
||||
cout << "Exiting..." << endl;
|
||||
|
||||
delete water;
|
||||
return 0;
|
||||
}
|
78
examples/c++/grovewfs.cxx
Normal file
@ -0,0 +1,78 @@
|
||||
/*
|
||||
* Author: Jon Trulson <jtrulson@ics.com>
|
||||
* Copyright (c) 2014 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* 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 "grovewfs.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
int shouldRun = true;
|
||||
|
||||
void sig_handler(int signo)
|
||||
{
|
||||
if (signo == SIGINT)
|
||||
shouldRun = false;
|
||||
}
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
signal(SIGINT, sig_handler);
|
||||
|
||||
//! [Interesting]
|
||||
// Instantiate a Grove Water Flow Sensor on digital pin D2
|
||||
upm::GroveWFS* flow = new upm::GroveWFS(2);
|
||||
|
||||
// set the flow counter to 0 and start counting
|
||||
flow->clearFlowCounter();
|
||||
flow->startFlowCounter();
|
||||
|
||||
while (shouldRun)
|
||||
{
|
||||
// we grab these (,illis and flowCount) just for display
|
||||
// purposes in this example
|
||||
uint32_t millis = flow->getMillis();
|
||||
uint32_t flowCount = flow->flowCounter();
|
||||
|
||||
float fr = flow->flowRate();
|
||||
|
||||
// output milliseconds passed, flow count, and computed flow rate
|
||||
cout << "Millis: " << millis << " Flow Count: " << flowCount;
|
||||
cout << " Flow Rate: " << fr << " LPM" << endl;
|
||||
|
||||
// best to gather data for at least one second for reasonable
|
||||
// results.
|
||||
sleep(2);
|
||||
}
|
||||
|
||||
flow->stopFlowCounter();
|
||||
//! [Interesting]
|
||||
|
||||
cout << "Exiting..." << endl;
|
||||
|
||||
delete flow;
|
||||
return 0;
|
||||
}
|
72
examples/c++/guvas12d.cxx
Normal file
@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Author: Jon Trulson <jtrulson@ics.com>
|
||||
* Copyright (c) 2014 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* 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 "guvas12d.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
bool shouldRun = true;
|
||||
|
||||
// analog voltage, usually 3.3 or 5.0
|
||||
#define GUVAS12D_AREF 5.0
|
||||
#define SAMPLES_PER_QUERY 1024
|
||||
|
||||
void sig_handler(int signo)
|
||||
{
|
||||
if (signo == SIGINT)
|
||||
shouldRun = false;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
signal(SIGINT, sig_handler);
|
||||
|
||||
//! [Interesting]
|
||||
// The was tested with the Grove UV Sensor module.
|
||||
// It has a sensing range from between 200-400nm. It's strongest
|
||||
// response is around 320-360nm.
|
||||
|
||||
// Instantiate a GUVAS12D on analog pin A0
|
||||
upm::GUVAS12D *volts = new upm::GUVAS12D(0);
|
||||
|
||||
// The higher the voltage the more intense the UV radiation.
|
||||
|
||||
while (shouldRun)
|
||||
{
|
||||
cout << "AREF: " << GUVAS12D_AREF
|
||||
<< ", Voltage value (higher means more UV): "
|
||||
<< volts->value(GUVAS12D_AREF, SAMPLES_PER_QUERY) << endl;
|
||||
|
||||
sleep(1);
|
||||
}
|
||||
//! [Interesting]
|
||||
|
||||
cout << "Exiting" << endl;
|
||||
|
||||
delete volts;
|
||||
return 0;
|
||||
}
|
@ -43,7 +43,7 @@ sig_handler(int signo)
|
||||
|
||||
//! [Interesting]
|
||||
void
|
||||
interrupt (void) {
|
||||
interrupt (void * args) {
|
||||
sonar->ackEdgeDetected ();
|
||||
}
|
||||
|
50
examples/c++/hmc5883l.cxx
Normal file
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Author: Brendan Le Foll <brendan.le.foll@intel.com>
|
||||
* Contributions: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
|
||||
* Copyright (c) 2014 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* 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 "hmc5883l.h"
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
//! [Interesting]
|
||||
// Instantiate on I2C
|
||||
upm::Hmc5883l* compass = new upm::Hmc5883l(0);
|
||||
int16_t *pos;
|
||||
|
||||
compass->set_declination(0.2749); // Set your declination from true north in radians
|
||||
|
||||
// Print out the coordinates, heading, and direction every second
|
||||
while(true){
|
||||
compass->update(); // Update the coordinates
|
||||
pos = compass->coordinates();
|
||||
fprintf(stdout, "coor: %5d %5d %5d ", pos[0], pos[1], pos[2]);
|
||||
fprintf(stdout, "heading: %5.2f direction: %3.2f\n", compass->heading(), compass->direction());
|
||||
sleep(1);
|
||||
}
|
||||
//! [Interesting]
|
||||
|
||||
return 0;
|
||||
}
|
164
examples/c++/hmtrp.cxx
Normal file
@ -0,0 +1,164 @@
|
||||
/*
|
||||
* 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 "hmtrp.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
bool shouldRun = true;
|
||||
|
||||
void sig_handler(int signo)
|
||||
{
|
||||
if (signo == SIGINT)
|
||||
shouldRun = false;
|
||||
}
|
||||
|
||||
void printUsage()
|
||||
{
|
||||
cout << "Usage:" << endl;
|
||||
cout << "Pass a commandline argument (any argument) to this program"
|
||||
<< endl;
|
||||
cout << "to query the radio configuration and output it. NOTE: the"
|
||||
<< endl;
|
||||
cout << "radio must be in CONFIG mode for this to work."
|
||||
<< endl;
|
||||
cout << endl;
|
||||
cout << "Running this program without arguments will simply transmit"
|
||||
<< endl;
|
||||
cout << "'Hello World!' every second, and output any data received from"
|
||||
<< endl;
|
||||
cout << "another radio."
|
||||
<< endl;
|
||||
cout << endl;
|
||||
}
|
||||
|
||||
const size_t bufferLength = 256;
|
||||
|
||||
int main (int argc, char **argv)
|
||||
{
|
||||
signal(SIGINT, sig_handler);
|
||||
|
||||
//! [Interesting]
|
||||
// Instantiate a HMTRP radio device on uart 0
|
||||
|
||||
upm::HMTRP* radio = new upm::HMTRP(0);
|
||||
|
||||
// make sure port is initialized properly. 9600 baud is the default.
|
||||
if (!radio->setupTty(B9600))
|
||||
{
|
||||
cerr << "Failed to setup tty port parameters" << endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
printUsage();
|
||||
|
||||
// By default, this radio simply transmits data sent via writeData()
|
||||
// and reads any available data via readData().
|
||||
|
||||
// It can be placed into a configuration mode by grounding the
|
||||
// CONFIG pin on the module. When this is done, the various
|
||||
// configuration query and config methods can be used. In this
|
||||
// example, by default, we just read any data available fom the
|
||||
// device, and periodically transmit "Hello World".
|
||||
|
||||
// If any argument was specified on the command line, do a simple
|
||||
// configuration query and output the results. The radio must be in
|
||||
// CONFIG mode for this to work.
|
||||
|
||||
if (argc > 1)
|
||||
{
|
||||
// config mode
|
||||
uint32_t freq;
|
||||
uint32_t dataRate;
|
||||
uint16_t rxBandwidth;
|
||||
uint8_t modulation;
|
||||
uint8_t txPower;
|
||||
uint32_t uartBaud;
|
||||
|
||||
if (radio->getConfig(&freq, &dataRate, &rxBandwidth, &modulation,
|
||||
&txPower, &uartBaud))
|
||||
{
|
||||
cout << "Radio configuration:" << endl;
|
||||
cout << "freq: " << freq << " dataRate: " << dataRate
|
||||
<< " rxBandwidth: " << rxBandwidth << "Khz" << endl;
|
||||
|
||||
cout << "modulation: " << int(modulation) << "Khz txPower: "
|
||||
<< int(txPower) << " uartBaud: " << uartBaud << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
cerr << "getConfig() failed. Make sure the radio is in "
|
||||
<< "CONFIG mode." << endl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// normal read/write mode
|
||||
char radioBuffer[bufferLength];
|
||||
int counter = 0;
|
||||
cout << "Running in normal read/write mode." << endl;
|
||||
|
||||
while (shouldRun)
|
||||
{
|
||||
// we don't want the read to block in this example, so always
|
||||
// check to see if data is available first.
|
||||
if (radio->dataAvailable())
|
||||
{
|
||||
int rv = radio->readData(radioBuffer, bufferLength);
|
||||
|
||||
if (rv > 0)
|
||||
cout << "Received: " << radioBuffer << endl;
|
||||
|
||||
if (rv < 0) // some sort of read error occured
|
||||
{
|
||||
cerr << "Port read error." << endl;
|
||||
break;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
usleep(100000); // 100ms
|
||||
counter++;
|
||||
// every second, transmit "Hello World"
|
||||
if (counter > 10)
|
||||
{
|
||||
static const char *hello = "Hello World!";
|
||||
cout << "Transmitting hello world..." << endl;
|
||||
radio->writeData((char *)hello, strlen(hello) + 1);
|
||||
counter = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//! [Interesting]
|
||||
|
||||
cout << "Exiting..." << endl;
|
||||
|
||||
delete radio;
|
||||
return 0;
|
||||
}
|
79
examples/c++/htu21d.cxx
Normal file
@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Author: William Penner <william.penner@intel.com>
|
||||
* Copyright (c) 2014 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* 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 "htu21d.h"
|
||||
|
||||
volatile int doWork = 0;
|
||||
|
||||
upm::HTU21D *sensor = NULL;
|
||||
|
||||
void
|
||||
sig_handler(int signo)
|
||||
{
|
||||
if (signo == SIGINT) {
|
||||
printf("\nCtrl-C received.\n");
|
||||
doWork = 1;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
// Register signal handler
|
||||
signal(SIGINT, sig_handler);
|
||||
|
||||
//! [Interesting]
|
||||
float humidity = 0.0;
|
||||
float temperature = 0.0;
|
||||
float compRH = 0.0;
|
||||
|
||||
sensor = new upm::HTU21D(0, HTU21D_I2C_ADDRESS);
|
||||
|
||||
sensor->testSensor();
|
||||
|
||||
while (!doWork) {
|
||||
compRH = sensor->getCompRH(true);
|
||||
humidity = sensor->getHumidity(false);
|
||||
temperature = sensor->getTemperature(false);
|
||||
|
||||
std::cout << "humidity value = " <<
|
||||
humidity <<
|
||||
", temperature value = " <<
|
||||
temperature <<
|
||||
", compensated RH value = " <<
|
||||
compRH << std::endl;
|
||||
usleep (500000);
|
||||
}
|
||||
//! [Interesting]
|
||||
|
||||
std::cout << "exiting application" << std::endl;
|
||||
|
||||
delete sensor;
|
||||
|
||||
return 0;
|
||||
}
|
43
examples/c++/hx711.cxx
Normal file
@ -0,0 +1,43 @@
|
||||
/*
|
||||
*
|
||||
* Author: Rafael da Mata Neri <rafael.neri@gmail.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>
|
||||
|
||||
//! [Interesting]
|
||||
#include "hx711.h"
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
upm::HX711 *scale = new upm::HX711(3, 2);
|
||||
|
||||
// 2837: value obtained via calibration
|
||||
scale->setScale(2837);
|
||||
scale->tare();
|
||||
std::cout << scale->getUnits() << std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
//! [Interesting]
|
61
examples/c++/ina132.cxx
Normal file
@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Author: Zion Orent <zorent@ics.com>
|
||||
* Copyright (c) 2015 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* 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 "ina132.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
bool shouldRun = true;
|
||||
|
||||
void sig_handler(int signo)
|
||||
{
|
||||
if (signo == SIGINT)
|
||||
shouldRun = false;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
signal(SIGINT, sig_handler);
|
||||
|
||||
//! [Interesting]
|
||||
// The was tested with the INA132 Differential Amplifier Sensor module.
|
||||
|
||||
// Instantiate an INA132 on analog pin A0
|
||||
upm::INA132 *amplifier = new upm::INA132(0);
|
||||
|
||||
while (shouldRun)
|
||||
{
|
||||
cout << amplifier->value() << endl;
|
||||
sleep(1);
|
||||
}
|
||||
//! [Interesting]
|
||||
|
||||
cout << "Exiting" << endl;
|
||||
|
||||
delete amplifier;
|
||||
return 0;
|
||||
}
|
80
examples/c++/isd1820.cxx
Normal file
@ -0,0 +1,80 @@
|
||||
/*
|
||||
* 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 "isd1820.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main (int argc, char **argv)
|
||||
{
|
||||
//! [Interesting]
|
||||
// Instantiate a ISD1820 on digital pins 2 (play) and 3 (record)
|
||||
// This example was tested on the Grove Recorder.
|
||||
|
||||
upm::ISD1820* recorder = new upm::ISD1820(2, 3);
|
||||
|
||||
// if an argument was specified (any argument), go into record mode,
|
||||
// else playback a previously recorded sample
|
||||
|
||||
cout << "Supply any argument to the command line to record." << endl;
|
||||
cout << "Running this example without arguments will play back any " << endl;
|
||||
cout << "previously recorded sound." << endl;
|
||||
cout << "There is approximately 10 seconds of recording time." << endl;
|
||||
|
||||
cout << endl;
|
||||
|
||||
bool doRecord = false;
|
||||
|
||||
if (argc > 1)
|
||||
doRecord = true;
|
||||
|
||||
// depending on what was selected, do it, and sleep for 15 seconds
|
||||
|
||||
if (doRecord)
|
||||
recorder->record(true);
|
||||
else
|
||||
recorder->play(true);
|
||||
|
||||
// There are about 10 seconds of recording/playback time, so we will
|
||||
// sleep for a little extra time.
|
||||
cout << "Sleeping for 15 seconds..." << endl;
|
||||
sleep(15);
|
||||
|
||||
// now, turn off whatever we were doing.
|
||||
|
||||
if (doRecord)
|
||||
recorder->record(false);
|
||||
else
|
||||
recorder->play(false);
|
||||
|
||||
//! [Interesting]
|
||||
|
||||
cout << "Exiting..." << endl;
|
||||
|
||||
delete recorder;
|
||||
return 0;
|
||||
}
|
51
examples/c++/itg3200.cxx
Normal file
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Author: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
|
||||
* Copyright (c) 2014 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* 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 "itg3200.h"
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
//! [Interesting]
|
||||
int16_t *rot;
|
||||
float *ang;
|
||||
|
||||
// Note: Sensor not supported on Intel Edison with Arduino breakout
|
||||
upm::Itg3200* gyro = new upm::Itg3200(0);
|
||||
|
||||
while(true){
|
||||
gyro->update(); // Update the data
|
||||
rot = gyro->getRawValues(); // Read raw sensor data
|
||||
ang = gyro->getRotation(); // Read rotational speed (deg/sec)
|
||||
fprintf(stdout, "Raw: %6d %6d %6d\n", rot[0], rot[1], rot[2]);
|
||||
fprintf(stdout, "AngX: %5.2f\n", ang[0]);
|
||||
fprintf(stdout, "AngY: %5.2f\n", ang[1]);
|
||||
fprintf(stdout, "AngZ: %5.2f\n", ang[2]);
|
||||
fprintf(stdout, "Temp: %5.2f Raw: %6d\n", gyro->getTemperature(), gyro->getRawTemp());
|
||||
sleep(1);
|
||||
}
|
||||
//! [Interesting]
|
||||
return 0;
|
||||
}
|