Compare commits
165 Commits
Author | SHA1 | Date | |
---|---|---|---|
e79ddf0c7a | |||
5439d73032 | |||
|
d59936ffd4 | ||
|
f854463c34 | ||
|
45c4aa7cee | ||
|
fc8c9061a6 | ||
|
b34cd50d31 | ||
|
700eece628 | ||
|
9ea5a29b6f | ||
|
40791fa309 | ||
|
ad0cb85903 | ||
|
10adedc0e6 | ||
|
9aa7ac1f65 | ||
|
03d305998b | ||
|
dbf1b29382 | ||
|
7eca0c738d | ||
|
9c6df90550 | ||
|
06b2be27c7 | ||
|
587866260b | ||
|
12d13ab9e6 | ||
|
f9673ea531 | ||
|
803b486f42 | ||
|
a99dce5140 | ||
|
f9da60fda1 | ||
|
85d6279228 | ||
|
e52c5bb7c3 | ||
|
e70198f659 | ||
|
c10e72b494 | ||
|
e15ce6fbc7 | ||
|
f58cdc9da4 | ||
|
bb736e762b | ||
|
276868185d | ||
|
ef8c0fb541 | ||
|
eb9b55bd99 | ||
|
63de2c4c3a | ||
|
1d18da9a22 | ||
|
3d781603f3 | ||
|
d954599045 | ||
|
79043568dd | ||
|
5b8ec38440 | ||
|
4ba5da1144 | ||
|
3b2f80b6e2 | ||
|
c1eeb8ab87 | ||
|
170bdd104f | ||
|
6d2ca4b97a | ||
|
c4d8dd2524 | ||
|
0a12c5a017 | ||
|
111e6be8f7 | ||
|
ffa3dcdfc0 | ||
|
47643bffdd | ||
|
cad3a03d0d | ||
|
8d65c2c72b | ||
|
b8349c0ffe | ||
|
8942117b2e | ||
|
7f8d3876e3 | ||
|
41fc378099 | ||
|
c821c19899 | ||
|
89473e5ba4 | ||
|
d60bab2082 | ||
|
18b4ac5663 | ||
|
4ec830fcc6 | ||
|
6e85bcd902 | ||
|
5d6f0ef296 | ||
|
1278089e84 | ||
|
ba201fcad2 | ||
|
8ded6f1f6d | ||
|
88a8bb22b6 | ||
|
9fe2883e6a | ||
|
5169021afd | ||
|
6252d25729 | ||
|
b75731d9d3 | ||
|
9cb508f5d2 | ||
|
2bb200aa04 | ||
|
b425c99030 | ||
|
08b2cefebe | ||
|
d0c884e67d | ||
|
678e540291 | ||
|
eae4a0cfbf | ||
|
7a1db249fe | ||
|
d3207769e7 | ||
|
66c2478183 | ||
|
156fea550c | ||
|
3e7a468a8a | ||
|
967585c9ea | ||
|
b07633c38a | ||
|
806c17f664 | ||
|
6fcd882d58 | ||
|
6c0ec10ba1 | ||
|
77d4676616 | ||
|
d24457f9a1 | ||
|
9056556b7a | ||
|
71b87904a0 | ||
|
9a44283a93 | ||
|
b3c1c5ac3c | ||
|
e772aec69d | ||
|
6fe510a27f | ||
|
4487c98b6f | ||
|
ae391fe9fe | ||
|
4b2279704b | ||
|
b90c0efcb8 | ||
|
c563e4fb4d | ||
|
fc4b2a554d | ||
|
47728b4c1d | ||
|
a2f01bee5f | ||
|
17342cbbbb | ||
|
4c4845b101 | ||
|
b06172b05a | ||
|
8a22f18152 | ||
|
9c5f940dad | ||
|
7d58d4c6d0 | ||
|
0712b9ea63 | ||
|
ed79502efc | ||
|
46b3a3ef88 | ||
|
3fa1237255 | ||
|
5faa2b93ca | ||
|
b04e728957 | ||
|
b59fc8f076 | ||
|
bdd00e10ed | ||
|
72f1ffca31 | ||
|
6258bd5fdd | ||
|
284d882b9d | ||
|
7ea32cf1ec | ||
|
b48baf01bc | ||
|
be9cd0138a | ||
|
dee7b80f06 | ||
|
cfda9c99d7 | ||
|
acff725d93 | ||
|
ac58754756 | ||
|
bbcdb1e087 | ||
|
d9c54e1d31 | ||
|
cf2e69a8ea | ||
|
7021096fd7 | ||
|
fa40262d89 | ||
|
467cf5132d | ||
|
76c8b9a76e | ||
|
4be5d915af | ||
|
ea6d771c2b | ||
|
2b98fc7869 | ||
|
fbc2ad6045 | ||
|
32ab283c2b | ||
|
9f7caf1561 | ||
|
12c1904fba | ||
|
1665e09928 | ||
|
aa7006cce9 | ||
|
9bc3ffe815 | ||
|
7840710d1b | ||
|
ae2371c804 | ||
|
2deaa73ebf | ||
|
fbb7d92320 | ||
|
2d210621cc | ||
|
568c077061 | ||
|
616ffc0b94 | ||
|
60b77d5da9 | ||
|
cb03cab04a | ||
|
c9566bdc6f | ||
|
eda9d03547 | ||
|
c7faa20c14 | ||
|
2c9d9aaf80 | ||
|
fd937e69ef | ||
|
6e13268301 | ||
|
9b08a97d46 | ||
|
25b951dd6a | ||
|
9f44dc45d8 | ||
|
d7490d87f2 | ||
|
83a67b96fd |
13
.travis.yml
13
.travis.yml
@@ -14,9 +14,14 @@ before_install:
|
||||
|
||||
jobs:
|
||||
fast_finish: true
|
||||
allow_failures:
|
||||
- env: TARGET=ipk
|
||||
include:
|
||||
- &run-with-clang-minimal
|
||||
stage: Clang 3.8 - minimal mock platform
|
||||
env: TARGET=minimal
|
||||
before_script: docker-compose pull ${TARGET}
|
||||
script:
|
||||
- export CC=clang-3.8 CXX=clang++-3.8
|
||||
- BUILDARCH=MOCK docker-compose run ${TARGET}
|
||||
- &run-with-clang
|
||||
stage: Clang 3.8
|
||||
env: TARGET=python2
|
||||
@@ -93,9 +98,5 @@ jobs:
|
||||
env: TARGET=imraa
|
||||
- <<: *run-additional-jobs
|
||||
env: TARGET=ftdi4442
|
||||
- <<: *run-additional-jobs
|
||||
env: TARGET=ipk
|
||||
- <<: *run-additional-jobs
|
||||
env: TARGET=rpm
|
||||
- <<: *run-additional-jobs
|
||||
env: TARGET=sonar-scan
|
||||
|
@@ -1,8 +1,16 @@
|
||||
cmake_minimum_required (VERSION 2.8)
|
||||
cmake_minimum_required (VERSION 2.8.11)
|
||||
project (mraa C CXX)
|
||||
|
||||
FIND_PACKAGE (Threads REQUIRED)
|
||||
|
||||
if (CMAKE_VERSION VERSION_LESS "3.1")
|
||||
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
||||
set (CMAKE_C_FLAGS "-std=gnu99 ${CMAKE_C_FLAGS}")
|
||||
endif ()
|
||||
else ()
|
||||
set (CMAKE_C_STANDARD 99)
|
||||
endif ()
|
||||
|
||||
###############################################################################
|
||||
# Detect supported warning flags
|
||||
# Modified from work By Dan Liew (fpbench - MIT)
|
||||
@@ -66,6 +74,17 @@ foreach (flag ${MRAA_BOTH_WARNING_FLAGS} ${MRAA_CXX_WARNING_FLAGS})
|
||||
endif ()
|
||||
endforeach ()
|
||||
|
||||
# This function adds the c++11 flag to a c++ target (if supported)
|
||||
function(use_cxx_11 targetname)
|
||||
include(CheckCXXCompilerFlag)
|
||||
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
|
||||
if (COMPILER_SUPPORTS_CXX11)
|
||||
set_target_properties(${targetname} PROPERTIES COMPILE_FLAGS "-std=c++11")
|
||||
else()
|
||||
message(FATAL_ERROR "Target '${targetname}' requires c++11 which is not supported by this compiler")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# Set CMAKE_INSTALL_LIBDIR if not defined
|
||||
include(GNUInstallDirs)
|
||||
|
||||
@@ -91,7 +110,7 @@ include (GetGitRevisionDescription)
|
||||
git_describe (VERSION "--tags")
|
||||
if ("x_${VERSION}" STREQUAL "x_GIT-NOTFOUND" OR "x_${VERSION}" STREQUAL "x_HEAD-HASH-NOTFOUND" OR "x_${VERSION}" STREQUAL "x_-128-NOTFOUND")
|
||||
message (WARNING " - Install git to compile a production libmraa!")
|
||||
set (VERSION "v1.8.0")
|
||||
set (VERSION "v2.1.0")
|
||||
endif ()
|
||||
|
||||
message (STATUS "INFO - libmraa Version ${VERSION}")
|
||||
@@ -126,7 +145,7 @@ include_directories (${SYSTEM_USR_DIR})
|
||||
option (BUILDDOC "Build all doc." OFF)
|
||||
option (BUILDSWIG "Build swig modules." ON)
|
||||
option (BUILDSWIGPYTHON "Build swig python modules." ON)
|
||||
option (BUILDSWIGNODE "Build swig node modules." ON)
|
||||
option (BUILDSWIGNODE "Build swig node modules." OFF)
|
||||
option (BUILDSWIGJAVA "Build Java API." OFF)
|
||||
option (USBPLAT "Detection USB platform." OFF)
|
||||
option (FIRMATA "Add Firmata support to mraa." OFF)
|
||||
@@ -134,12 +153,10 @@ option (ONEWIRE "Add Onewire support to mraa." ON)
|
||||
option (JSONPLAT "Add Platform loading via a json file." ON)
|
||||
option (IMRAA "Add Imraa support to mraa." OFF)
|
||||
option (FTDI4222 "Build with FTDI FT4222 subplatform support." OFF)
|
||||
option (IPK "Generate IPK using CPack" OFF)
|
||||
option (RPM "Generate RPM using CPack" OFF)
|
||||
option (ENABLEEXAMPLES "Disable building of examples" ON)
|
||||
option (INSTALLTOOLS "Install all tools" ON)
|
||||
option (BUILDTESTS "Override the addition of tests" ON)
|
||||
option (USEPYTHON3TESTS "Force tests to run with python3" OFF)
|
||||
option (USEPYTHON3TESTS "Force tests to run with python3" ON)
|
||||
|
||||
set (BUILDARCH "" CACHE STRING "Override architecture to build for")
|
||||
|
||||
@@ -152,8 +169,7 @@ if (NOT BUILDSWIG)
|
||||
endif()
|
||||
|
||||
if (NOT BUILDARCH)
|
||||
include (TargetArch)
|
||||
target_architecture (DETECTED_ARCH)
|
||||
set (DETECTED_ARCH ${CMAKE_SYSTEM_PROCESSOR})
|
||||
message (STATUS "INFO - Target arch is ${DETECTED_ARCH}")
|
||||
else ()
|
||||
set (DETECTED_ARCH ${BUILDARCH})
|
||||
@@ -163,7 +179,7 @@ endif()
|
||||
if (DETECTED_ARCH STREQUAL "i586" OR DETECTED_ARCH STREQUAL "x86_64"
|
||||
OR DETECTED_ARCH STREQUAL "i386")
|
||||
set (X86PLAT ON)
|
||||
elseif (DETECTED_ARCH MATCHES "arm.*")
|
||||
elseif (DETECTED_ARCH MATCHES "arm.*" OR DETECTED_ARCH MATCHES "aarch64")
|
||||
set (ARMPLAT ON)
|
||||
elseif (DETECTED_ARCH MATCHES "mips")
|
||||
set (MIPSPLAT ON)
|
||||
@@ -197,66 +213,6 @@ if (BUILDDOC)
|
||||
endif (DOXYGEN_FOUND AND DOXYGEN_VERSION VERSION_GREATER "1.8")
|
||||
endif ()
|
||||
|
||||
if (IPK)
|
||||
# Get target package arch from Yocto ADT sysroot if set or host OS, mapping to Ubuntu name if necessary
|
||||
if (DEFINED ENV{OECORE_TARGET_SYSROOT})
|
||||
GET_FILENAME_COMPONENT (DETECTED_SYSROOT $ENV{OECORE_TARGET_SYSROOT} NAME)
|
||||
string (REGEX REPLACE "-poky-linux" "" TARGET_ARCH "${DETECTED_SYSROOT}")
|
||||
else ()
|
||||
# debian uses amd64 to denote x86_64
|
||||
if (DETECTED_ARCH STREQUAL "x86_64")
|
||||
set (TARGET_ARCH "amd64")
|
||||
else ()
|
||||
set (TARGET_ARCH ${DETECTED_ARCH})
|
||||
endif ()
|
||||
endif ()
|
||||
message (STATUS "INFO - Package arch is ${TARGET_ARCH}")
|
||||
|
||||
set(CPACK_GENERATOR "DEB")
|
||||
set(OPKG_ARCH ${TARGET_ARCH})
|
||||
set(CPACK_BINARY_DIR ${CMAKE_BINARY_DIR})
|
||||
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Intel IoT-Devkit") #required
|
||||
set(mraa_PACKAGE_ON_TAG ".")
|
||||
if ("${VERSION_COMMIT}" STREQUAL "")
|
||||
set(mraa_PACKAGE_ON_TAG "")
|
||||
endif()
|
||||
set(CPACK_PACKAGE_VERSION
|
||||
"${mraa_VERSION_MAJOR}.${mraa_VERSION_MINOR}.${mraa_VERSION_PATCH}${mraa_PACKAGE_ON_TAG}${VERSION_COMMIT}")
|
||||
set(CPACK_PACKAGE_NAME "mraa")
|
||||
set(CPACK_DEBIAN_PACKAGE_SECTION "libs")
|
||||
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE ${TARGET_ARCH})
|
||||
set(CPACK_SYSTEM_NAME ${TARGET_ARCH})
|
||||
set(CPACK_DEBIAN_PACKAGE_PROVIDES "mraa-dev, mraa-dbg, mraa-doc")
|
||||
set(CPACK_DEBIAN_PACKAGE_REPLACES "${CPACK_DEBIAN_PACKAGE_PROVIDES}, libmraa, libmraa-dev, libmraa-doc")
|
||||
set(CPACK_DEBIAN_PACKAGE_CONFLICTS ${CPACK_DEBIAN_PACKAGE_PROVIDES})
|
||||
set(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}")
|
||||
include (CPack)
|
||||
endif()
|
||||
|
||||
if (RPM)
|
||||
message (STATUS "INFO - Enabled RPM packaging for ${DETECTED_ARCH}")
|
||||
set(CMAKE_INSTALL_PREFIX "/usr")
|
||||
set(CPACK_PACKAGE_VERSION ${VERSION})
|
||||
set(CPACK_GENERATOR "RPM")
|
||||
set(CPACK_PACKAGE_NAME "libmraa${mraa_VERSION_MAJOR}")
|
||||
set(CPACK_PACKAGE_RELEASE 1)
|
||||
set(CPACK_PACKAGE_VERSION
|
||||
"${mraa_VERSION_MAJOR}.${mraa_VERSION_MINOR}.${mraa_VERSION_PATCH}${mraa_PACKAGE_ON_TAG}${VERSION_COMMIT}")
|
||||
set(CPACK_PACKAGE_CONTACT "Intel IoT-Devkit")
|
||||
set(CPACK_PACKAGE_VENDOR "Intel IoT-Devkit")
|
||||
set(CPACK_RPM_PACKAGE_PROVIDES "${CPACK_PACKAGE_NAME}-devel")
|
||||
# Get distro tag (e.g. 'fc20') by parsing output of rpm --showrc
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND rpm --showrc
|
||||
COMMAND grep -w dist
|
||||
COMMAND sed -e "s/\\t./ /"
|
||||
COMMAND awk "{printf \"%s\", \$NF}"
|
||||
OUTPUT_VARIABLE DIST_TAG
|
||||
)
|
||||
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_PACKAGE_RELEASE}.${DIST_TAG}.${DETECTED_ARCH}")
|
||||
include(CPack)
|
||||
endif()
|
||||
|
||||
add_subdirectory (src)
|
||||
if (ENABLEEXAMPLES)
|
||||
add_subdirectory (examples)
|
||||
|
@@ -1,7 +1,7 @@
|
||||
Contributing to libmraa {#contributing}
|
||||
Contributing to Eclipse Mraa (libmraa) {#contributing}
|
||||
======================
|
||||
|
||||
libmraa is an opensource project and we are actively looking for people to help
|
||||
Eclipse Mraa is an opensource project and we are actively looking for people to help
|
||||
with:
|
||||
|
||||
- Writing platform supports for all types of boards running linux
|
||||
@@ -53,45 +53,24 @@ statement to the file but cannot add a license of your own. If you're borrowing
|
||||
code that comes from a project with another license, make sure to explicitly
|
||||
note this in your PR.
|
||||
|
||||
Code signing
|
||||
Eclipse Contributor Agreement
|
||||
------------
|
||||
|
||||
The sign-off is a simple line at the end of the explanation for the
|
||||
patch, which certifies that you wrote it or otherwise have the right to pass it
|
||||
on as an open-source patch. The rules are pretty simple: if you can certify
|
||||
the below:
|
||||
Your contribution cannot be accepted unless you have a signed [ECA - Eclipse Foundation Contributor Agreement](http://www.eclipse.org/legal/ECA.php) in place.
|
||||
|
||||
Developer's Certificate of Origin 1.1
|
||||
Here is the checklist for contributions to be _acceptable_:
|
||||
|
||||
By making a contribution to this project, I certify that:
|
||||
1. [Create an account at Eclipse](https://dev.eclipse.org/site_login/createaccount.php).
|
||||
2. Add your GitHub user name in your account settings.
|
||||
3. [Log into the project's portal](https://projects.eclipse.org/) and sign the ["Eclipse ECA"](https://projects.eclipse.org/user/sign/cla).
|
||||
4. Ensure that you [_sign-off_](https://wiki.eclipse.org/Development_Resources/Contributing_via_Git#Signing_off_on_a_commit) your Git commits.
|
||||
5. Ensure that you use the _same_ email address as your Eclipse account in commits.
|
||||
6. Include the appropriate copyright notice and license at the top of each file.
|
||||
|
||||
(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 saying
|
||||
|
||||
Signed-off-by: Random J Developer <random@developer.example.org>
|
||||
|
||||
Using your real name (sorry, no pseudonyms or anonymous contributions.)
|
||||
Your signing of the ECA will be verified by a webservice called 'ip-validation'
|
||||
that checks the email address that signed-off on your commits has signed the
|
||||
ECA. **Note**: This service is case-sensitive, so ensure the email that signed
|
||||
the ECA and that signed-off on your commits is the same, down to the case.
|
||||
|
||||
Where to find us
|
||||
----------------
|
||||
|
2
COPYING
2
COPYING
@@ -1,5 +1,5 @@
|
||||
The MIT License (MIT)
|
||||
Copyright © 2014-2018 Intel Corporation
|
||||
Copyright © 2014-2019 Intel Corporation and others
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
|
90
README.md
90
README.md
@@ -2,10 +2,10 @@
|
||||
<img src="http://iotdk.intel.com/misc/logos/mraa.png" height="150px" width="auto" algt="Mraa Logo"/>
|
||||
</p>
|
||||
|
||||
libmraa - Low Level Skeleton Library for Communication on GNU/Linux platforms
|
||||
Eclipse Mraa - Low Level Skeleton Library for Communication on GNU/Linux platforms
|
||||
=============================================================================
|
||||
|
||||
Libmraa is a C/C++ library with bindings to Java, Python and JavaScript to
|
||||
Eclipse Mraa (Libmraa) is a C/C++ library with bindings to Java, Python and JavaScript to
|
||||
interface with the IO on Galileo, Edison & other platforms, with a structured
|
||||
and sane API where port names/numbering matches the board that you are on. Use
|
||||
of libmraa does not tie you to specific hardware with board detection done at
|
||||
@@ -16,7 +16,10 @@ The intent is to make it easier for developers and sensor manufacturers to map
|
||||
their sensors & actuators on top of supported hardware and to allow control of
|
||||
low level communication protocol by high level languages & constructs.
|
||||
|
||||
[](https://travis-ci.org/intel-iot-devkit/mraa)
|
||||
The MRAA project is joining the Eclipse Foundation as an Eclipse IoT project.
|
||||
You can read more about this [here](https://projects.eclipse.org/proposals/eclipse-mraa).
|
||||
|
||||
[](https://travis-ci.org/intel-iot-devkit/mraa) [](https://sonarcloud.io/dashboard?id=mraa-master)
|
||||
|
||||
Supported Boards
|
||||
================
|
||||
@@ -32,6 +35,9 @@ X86
|
||||
* [UP](../master/docs/up.md)
|
||||
* [UP Squared](../master/docs/up2.md)
|
||||
* [Intel Joule](../master/docs/joule.md)
|
||||
* [IEI Tank](../master/docs/iei-tank.md)
|
||||
* [ADLINK IPi-SMARC X86](../master/docs/adlink_ipi_x86.md)
|
||||
* [UP Xtreme](../master/docs/up_xtreme.md)
|
||||
|
||||
ARM
|
||||
---
|
||||
@@ -40,6 +46,8 @@ ARM
|
||||
* [Beaglebone Black](../master/docs/beaglebone.md)
|
||||
* [phyBOARD-Wega](../master/docs/phyboard-wega.md)
|
||||
* [96Boards](../master/docs/96boards.md)
|
||||
* [ADLINK IPi-SMARC ARM](../master/docs/adlink_ipi_arm.md)
|
||||
* [Rock Pi 4](../master/docs/rockpi4.md)
|
||||
|
||||
MIPS
|
||||
---
|
||||
@@ -73,13 +81,13 @@ Installing on your board
|
||||
Installing on Ubuntu
|
||||
--------------------
|
||||
|
||||
Here is a PPA for installing on ubuntu:
|
||||
Here is a PPA for installing on Ubuntu Xenial or Bionic:
|
||||
https://launchpad.net/~mraa/+archive/ubuntu/mraa
|
||||
|
||||
```bash
|
||||
sudo add-apt-repository ppa:mraa/mraa
|
||||
sudo apt-get update
|
||||
sudo apt-get install libmraa1 libmraa-dev libmraa-java python-mraa python3-mraa node-mraa mraa-tools
|
||||
sudo apt-get install libmraa2 libmraa-dev libmraa-java python-mraa python3-mraa node-mraa mraa-tools
|
||||
```
|
||||
|
||||
Running MRAA tools or applications on Ubuntu systems requires elevated permissions
|
||||
@@ -90,8 +98,17 @@ Install on Arch Linux
|
||||
|
||||
There is an AUR package for mraa here: https://aur.archlinux.org/packages/mraa
|
||||
|
||||
Install on openSUSE
|
||||
-------------------
|
||||
Install on openSUSE or SLE
|
||||
---------------------------
|
||||
|
||||
For the latest versions of openSUSE and SLE the project is distributed via
|
||||
native repositories and can be installed by developers with:
|
||||
|
||||
```bash
|
||||
sudo zypper install mraa mraa-devel
|
||||
```
|
||||
|
||||
For ARM boards use:
|
||||
|
||||
```bash
|
||||
REPO="openSUSE_Tumbleweed"
|
||||
@@ -102,48 +119,29 @@ sudo zypper ar http://download.opensuse.org/repositories/hardware/$REPO/hardware
|
||||
sudo zypper in mraa
|
||||
```
|
||||
|
||||
Installing for Node.js only
|
||||
A full list of packages and instructions for installing MRAA for various openSUSE releases
|
||||
can be found [here](https://software.opensuse.org/package/mraa).
|
||||
|
||||
Install on Fedora Linux
|
||||
-----------------------
|
||||
|
||||
There is an mraa package in the main Fedora repository so it can be dnf installed
|
||||
in all recent Fedora releases. The Node.js and Python 3 bindings are packaged as
|
||||
separate packages.
|
||||
|
||||
```bash
|
||||
sudo dnf install mraa nodejs-mraa python3-mraa
|
||||
```
|
||||
|
||||
Installing for Red Hat Enterprise Linux, CentOS and Other Linux Distributions
|
||||
---------------------------
|
||||
|
||||
> Note: Node.js 7.0.0+ is not currently supported. You'll have to downgrade to 6.x.x.
|
||||
The MRAA project does not currently distribute official binaries for RHEL
|
||||
or CentOS so developers will have to compile the project from sources as
|
||||
described in the next section.
|
||||
|
||||
You can also install just the node.js mraa module by using npm. You will need a
|
||||
C++ compiler and the node development headers, however it's not required to
|
||||
have SWIG installed.
|
||||
|
||||
```bash
|
||||
npm install mraa
|
||||
```
|
||||
|
||||
Note that installing mraa in this way builds mraa without json-c so you cannot
|
||||
use mraa_init_json_platform(). Also building this way means the mraa.node
|
||||
includes a static version of libmraa rather than relying on a dynamic library
|
||||
in /usr/lib.
|
||||
|
||||
Subplatforms (i.e. Firmata) have to be added manually with this kind of install
|
||||
from your application, as shown in [this example](examples/javascript/firmata.js).
|
||||
|
||||
Installing on Intel 32bit Yocto based opkg image
|
||||
------------------------------------------------
|
||||
|
||||
See the section below on compiling or use our repository to install on a glibc
|
||||
based yocto poky image that supports opkg. Adding this repository is as simple
|
||||
as and you'll have the latest stable tagged build of mraa installed!
|
||||
|
||||
``` bash
|
||||
echo "src mraa-upm http://iotdk.intel.com/repos/3.5/intelgalactic/opkg/i586" > /etc/opkg/mraa-upm.conf
|
||||
opkg update
|
||||
opkg install mraa
|
||||
```
|
||||
|
||||
If you would like to get the latest & greatest builds from master HEAD you can
|
||||
use our -dev repository
|
||||
|
||||
```bash
|
||||
echo "src mraa-upm http://iotdk.intel.com/repos/3.5/intelgalactic-dev/opkg/i586" > /etc/opkg/mraa-upm.conf
|
||||
opkg update
|
||||
opkg install mraa
|
||||
```
|
||||
For testing and development purposes it may be possible to share and install
|
||||
.deb and .rpm packages across similar Linux builds.
|
||||
|
||||
Compiling
|
||||
=========
|
||||
|
@@ -19,6 +19,8 @@
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@@ -20,6 +20,8 @@
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@@ -20,6 +20,8 @@
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@@ -20,6 +20,8 @@
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
@@ -36,7 +38,7 @@ namespace mraa
|
||||
*
|
||||
* This file defines the aio interface for libmraa
|
||||
*
|
||||
* @snippet AioA0.cpp Interesting
|
||||
* @snippet aio.cpp Interesting
|
||||
*/
|
||||
class Aio
|
||||
{
|
||||
|
@@ -20,6 +20,8 @@
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
@@ -50,6 +52,17 @@
|
||||
if (res != MRAA_SUCCESS) \
|
||||
return res;} while(0)
|
||||
|
||||
/**
|
||||
* Simple deprecated macro
|
||||
*/
|
||||
#ifdef __GNUC__
|
||||
#define DEPRECATED __attribute__((deprecated))
|
||||
#elif defined(_MSC_VER)
|
||||
#define DEPRECATED __declspec(deprecated)
|
||||
#else
|
||||
#pragma message("WARNING: You need to implement DEPRECATED for this compiler")
|
||||
#define DEPRECATED
|
||||
#endif
|
||||
|
||||
/** @file
|
||||
*
|
||||
@@ -212,35 +225,35 @@ unsigned int mraa_get_pin_count();
|
||||
*
|
||||
* @return number of usable UARTs on the platform, returns -1 on failure.
|
||||
*/
|
||||
int mraa_get_uart_count(void);
|
||||
int mraa_get_uart_count();
|
||||
|
||||
/**
|
||||
* Get the number of usable SPI buses, board must be initialised.
|
||||
*
|
||||
* @return number of usable SPI buses on the platform, returns -1 on failure.
|
||||
*/
|
||||
int mraa_get_spi_bus_count(void);
|
||||
int mraa_get_spi_bus_count();
|
||||
|
||||
/**
|
||||
* Get the number of usable PWM pins, board must be initialised.
|
||||
*
|
||||
* @return number of PWMs on the current platform, -1 on failure.
|
||||
*/
|
||||
int mraa_get_pwm_count(void);
|
||||
int mraa_get_pwm_count();
|
||||
|
||||
/**
|
||||
* Get the number of usable GPIOs, board must be initialised.
|
||||
*
|
||||
* @return number of usable external GPIO pins on the board, -1 on failure.
|
||||
*/
|
||||
int mraa_get_gpio_count(void);
|
||||
int mraa_get_gpio_count();
|
||||
|
||||
/**
|
||||
* Get the number of usable analog pins, board must be initialised.
|
||||
*
|
||||
* @return number of usable ADC inputs on the platform and -1 on failure.
|
||||
*/
|
||||
int mraa_get_aio_bus_count(void);
|
||||
int mraa_get_aio_count();
|
||||
|
||||
/**
|
||||
* Get platform usable I2C bus count, board must be initialised.
|
||||
|
@@ -20,6 +20,8 @@
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
@@ -143,27 +145,31 @@ adcSupportedBits()
|
||||
}
|
||||
|
||||
/**
|
||||
* Return Platform Name. Returns NULL if no platform inited.
|
||||
* Return platform name.
|
||||
*
|
||||
* @return platform name
|
||||
* @return platform name or empty string if not initialised
|
||||
*/
|
||||
inline std::string
|
||||
getPlatformName()
|
||||
{
|
||||
std::string ret_val(mraa_get_platform_name());
|
||||
std::string ret_val;
|
||||
const char * pn = mraa_get_platform_name();
|
||||
if (pn) ret_val = pn;
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return platform versioning info. Returns NULL if no info present.
|
||||
* Return platform versioning info.
|
||||
*
|
||||
* @param platform_offset optional subplatform identifier
|
||||
* @return platform versioning info
|
||||
* @return platform versioning info or empty string if no info is present
|
||||
*/
|
||||
inline std::string
|
||||
getPlatformVersion(int platform_offset=MRAA_MAIN_PLATFORM_OFFSET)
|
||||
{
|
||||
std::string ret_val(mraa_get_platform_version(platform_offset));
|
||||
std::string ret_val;
|
||||
const char* pv = mraa_get_platform_version(platform_offset);
|
||||
if (pv) ret_val = pv;
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
@@ -219,12 +225,14 @@ getI2cBusId(int i2c_bus)
|
||||
*
|
||||
* @param pin number
|
||||
*
|
||||
* @return char* of pin name
|
||||
* @return Pin name or empty string on failure
|
||||
*/
|
||||
inline std::string
|
||||
getPinName(int pin)
|
||||
{
|
||||
std::string ret_val(mraa_get_pin_name(pin));
|
||||
std::string ret_val;
|
||||
const char* pn = mraa_get_pin_name(pin);
|
||||
if (pn) ret_val = pn;
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
|
@@ -20,6 +20,8 @@
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@@ -20,6 +20,8 @@
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
@@ -61,7 +63,10 @@ typedef enum {
|
||||
MRAA_GPIO_STRONG = 0, /**< Default. Strong high and low */
|
||||
MRAA_GPIO_PULLUP = 1, /**< Resistive High */
|
||||
MRAA_GPIO_PULLDOWN = 2, /**< Resistive Low */
|
||||
MRAA_GPIO_HIZ = 3 /**< High Z State */
|
||||
MRAA_GPIO_HIZ = 3, /**< High Z State */
|
||||
MRAA_GPIOD_ACTIVE_LOW = 4,
|
||||
MRAA_GPIOD_OPEN_DRAIN = 5,
|
||||
MRAA_GPIOD_OPEN_SOURCE = 6,
|
||||
} mraa_gpio_mode_t;
|
||||
|
||||
/**
|
||||
@@ -101,6 +106,18 @@ typedef enum {
|
||||
MRAA_GPIO_PUSH_PULL = 1, /**< Push Pull Configuration */
|
||||
} mraa_gpio_out_driver_mode_t;
|
||||
|
||||
typedef long long unsigned int mraa_timestamp_t;
|
||||
|
||||
/**
|
||||
* Gpio event object
|
||||
*/
|
||||
typedef struct {
|
||||
int id; /**< id of event */
|
||||
mraa_timestamp_t timestamp; /**< timestamp */
|
||||
} mraa_gpio_event;
|
||||
|
||||
typedef mraa_gpio_event* mraa_gpio_events_t;
|
||||
|
||||
/**
|
||||
* Initialise gpio_context, based on board number
|
||||
*
|
||||
@@ -109,6 +126,24 @@ typedef enum {
|
||||
*/
|
||||
mraa_gpio_context mraa_gpio_init(int pin);
|
||||
|
||||
/**
|
||||
* Initialise gpio_context, based on gpio line name
|
||||
*
|
||||
* @param name GPIO line name, i.e GPIO-A
|
||||
* @returns gpio context or NULL
|
||||
*/
|
||||
mraa_gpio_context mraa_gpio_init_by_name(char* name);
|
||||
|
||||
/**
|
||||
* Initialise gpio_context, based on board number, for multiple pins (can be one).
|
||||
*
|
||||
* @param pins Pin array read from the board
|
||||
* @param num_pins Number of pins - must be the same as the pins array length provided
|
||||
* as the first argument.
|
||||
* @returns gpio context or NULL
|
||||
*/
|
||||
mraa_gpio_context mraa_gpio_init_multi(int pins[], int num_pins);
|
||||
|
||||
/**
|
||||
* Initialise gpio context without any mapping to a pin
|
||||
*
|
||||
@@ -127,10 +162,10 @@ mraa_gpio_context mraa_gpio_init_raw(int gpiopin);
|
||||
mraa_result_t mraa_gpio_edge_mode(mraa_gpio_context dev, mraa_gpio_edge_t mode);
|
||||
|
||||
/**
|
||||
* Set an interrupt on pin
|
||||
* Set an interrupt on pin(s).
|
||||
*
|
||||
* @param dev The Gpio context
|
||||
* @param edge The edge mode to set the gpio into
|
||||
* @param edge The edge mode to set the gpio(s) into
|
||||
* @param fptr Function pointer to function to be called when interrupt is
|
||||
* triggered
|
||||
* @param args Arguments passed to the interrupt handler (fptr)
|
||||
@@ -138,9 +173,19 @@ mraa_result_t mraa_gpio_edge_mode(mraa_gpio_context dev, mraa_gpio_edge_t mode);
|
||||
*/
|
||||
mraa_result_t mraa_gpio_isr(mraa_gpio_context dev, mraa_gpio_edge_t edge, void (*fptr)(void*), void* args);
|
||||
|
||||
/**
|
||||
* Get an array of structures describing triggered events.
|
||||
*
|
||||
* @param dev The Gpio context
|
||||
* @return Array of structures containing pairs of pin id's and the associated timestamp.
|
||||
* An event with negative id value indicates that no event was triggered for the respective pin.
|
||||
* The array length is that of the number of pins provided in mraa_gpio_init_multi().
|
||||
*/
|
||||
mraa_gpio_events_t mraa_gpio_get_events(mraa_gpio_context dev);
|
||||
|
||||
/**
|
||||
* Stop the current interrupt watcher on this Gpio, and set the Gpio edge mode
|
||||
* to MRAA_GPIO_EDGE_NONE
|
||||
* to MRAA_GPIO_EDGE_NONE(only for sysfs interface).
|
||||
*
|
||||
* @param dev The Gpio context
|
||||
* @return Result of operation
|
||||
@@ -148,35 +193,36 @@ mraa_result_t mraa_gpio_isr(mraa_gpio_context dev, mraa_gpio_edge_t edge, void (
|
||||
mraa_result_t mraa_gpio_isr_exit(mraa_gpio_context dev);
|
||||
|
||||
/**
|
||||
* Set Gpio Output Mode,
|
||||
* Set Gpio(s) Output Mode,
|
||||
*
|
||||
* @param dev The Gpio context
|
||||
* @param mode The Gpio Output Mode
|
||||
* @param mode The Gpio(s) Output Mode
|
||||
* @return Result of operation
|
||||
*/
|
||||
mraa_result_t mraa_gpio_mode(mraa_gpio_context dev, mraa_gpio_mode_t mode);
|
||||
|
||||
/**
|
||||
* Set Gpio direction
|
||||
* Set Gpio(s) direction
|
||||
*
|
||||
* @param dev The Gpio context
|
||||
* @param dir The direction of the Gpio
|
||||
* @param dir The direction of the Gpio(s)
|
||||
* @return Result of operation
|
||||
*/
|
||||
mraa_result_t mraa_gpio_dir(mraa_gpio_context dev, mraa_gpio_dir_t dir);
|
||||
|
||||
/**
|
||||
* Read Gpio direction
|
||||
* Read Gpio(s) direction
|
||||
*
|
||||
* @param dev The Gpio context
|
||||
* @param dir The address where to store the Gpio direction
|
||||
* @param dir The address where to store the Gpio(s) direction
|
||||
* @return Result of operation
|
||||
*/
|
||||
mraa_result_t mraa_gpio_read_dir(mraa_gpio_context dev, mraa_gpio_dir_t *dir);
|
||||
|
||||
/**
|
||||
* Close the Gpio context
|
||||
* - Will free the memory for the context and unexport the Gpio
|
||||
* - Will free the memory for the context and unexport the Gpio - sysfs interface.
|
||||
* - Will free up the memory used by context and close related file descriptors - chardev interface.
|
||||
*
|
||||
* @param dev The Gpio context
|
||||
* @return Result of operation
|
||||
@@ -192,6 +238,16 @@ mraa_result_t mraa_gpio_close(mraa_gpio_context dev);
|
||||
*/
|
||||
int mraa_gpio_read(mraa_gpio_context dev);
|
||||
|
||||
/**
|
||||
* Read the Gpio(s) value. The user must provide an integer array with a length equal to the
|
||||
* number of pins provided to mraa_gpio_init_multi() function.
|
||||
*
|
||||
* @param dev The Gpio context
|
||||
* @param output_values The array provided by the user. Existing values will be overwritten with the newly read ones.
|
||||
* @return Result of operation
|
||||
*/
|
||||
mraa_result_t mraa_gpio_read_multi(mraa_gpio_context dev, int output_values[]);
|
||||
|
||||
/**
|
||||
* Write to the Gpio Value.
|
||||
*
|
||||
@@ -201,6 +257,17 @@ int mraa_gpio_read(mraa_gpio_context dev);
|
||||
*/
|
||||
mraa_result_t mraa_gpio_write(mraa_gpio_context dev, int value);
|
||||
|
||||
/**
|
||||
* Write to the Gpio(s) Value. The user must provide an integer array with a length equal to the
|
||||
* number of pins provided to mraa_gpio_init_multi() function.
|
||||
*
|
||||
* @param dev The Gpio context
|
||||
* @param output_values The array provided by the user. It must contain the values intended to be written
|
||||
* to the gpio pins, in the same order as the init function.
|
||||
* @return Result of operation
|
||||
*/
|
||||
mraa_result_t mraa_gpio_write_multi(mraa_gpio_context dev, int input_values[]);
|
||||
|
||||
/**
|
||||
* Change ownership of the context.
|
||||
*
|
||||
@@ -211,13 +278,15 @@ mraa_result_t mraa_gpio_write(mraa_gpio_context dev, int value);
|
||||
mraa_result_t mraa_gpio_owner(mraa_gpio_context dev, mraa_boolean_t owner);
|
||||
|
||||
/**
|
||||
* Enable using memory mapped io instead of sysfs
|
||||
* Enable using memory mapped io instead of sysfs, chardev based I/O can be
|
||||
* considered memorymapped
|
||||
*
|
||||
* @deprecated
|
||||
* @param dev The Gpio context
|
||||
* @param mmap Use mmap instead of sysfs
|
||||
* @return Result of operation
|
||||
*/
|
||||
mraa_result_t mraa_gpio_use_mmaped(mraa_gpio_context dev, mraa_boolean_t mmap);
|
||||
DEPRECATED mraa_result_t mraa_gpio_use_mmaped(mraa_gpio_context dev, mraa_boolean_t mmap);
|
||||
|
||||
/**
|
||||
* Get a pin number of the gpio, invalid will return -1
|
||||
|
@@ -20,6 +20,8 @@
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
@@ -90,7 +92,7 @@ typedef enum {
|
||||
*
|
||||
* This file defines the gpio interface for libmraa
|
||||
*
|
||||
* @snippet Blink-IO.cpp Interesting
|
||||
* @snippet gpio.cpp Interesting
|
||||
*/
|
||||
class Gpio
|
||||
{
|
||||
@@ -347,7 +349,7 @@ class Gpio
|
||||
/**
|
||||
* Change Gpio output driver mode
|
||||
*
|
||||
* @param mode @param mode Set output driver mode
|
||||
* @param mode Set output driver mode
|
||||
* @return Result of operation
|
||||
*/
|
||||
Result
|
||||
|
@@ -20,6 +20,8 @@
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@@ -20,6 +20,8 @@
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
@@ -38,7 +40,7 @@ namespace mraa
|
||||
* selecting the correct address
|
||||
* @htmlinclude i2c.txt
|
||||
*
|
||||
* @snippet I2c-compass.cpp Interesting
|
||||
* @snippet i2c.cpp Interesting
|
||||
*/
|
||||
class I2c
|
||||
{
|
||||
|
@@ -20,6 +20,8 @@
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@@ -20,21 +20,22 @@
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdexcept>
|
||||
#include <sstream>
|
||||
#include "iio.h"
|
||||
#include "types.hpp"
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
|
||||
namespace mraa
|
||||
{
|
||||
|
||||
/** Iio Event Data */
|
||||
struct IioEventData
|
||||
{
|
||||
struct IioEventData {
|
||||
/** Channel Type */
|
||||
int channelType;
|
||||
/** Modifier */
|
||||
@@ -67,7 +68,7 @@ public:
|
||||
*
|
||||
* This file defines the C++ iio interface for libmraa
|
||||
*
|
||||
* @snippet Iio-dummy.cpp Interesting
|
||||
* @snippet iio.cpp Interesting
|
||||
*/
|
||||
class Iio
|
||||
{
|
||||
@@ -112,6 +113,19 @@ class Iio
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* IIO constructor, takes a pointer to a IIO context and initialises the IIO class
|
||||
*
|
||||
* @param iio_context void * to an IIO context
|
||||
*/
|
||||
Iio(void* iio_context)
|
||||
{
|
||||
m_iio = (mraa_iio_context) iio_context;
|
||||
if (m_iio == NULL) {
|
||||
throw std::invalid_argument("Invalid IIO context");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Iio destructor
|
||||
*/
|
||||
@@ -193,7 +207,6 @@ class Iio
|
||||
oss << "IIO writeInt for attibute " << attributeName << " failed";
|
||||
throw std::runtime_error(oss.str());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -213,7 +226,6 @@ class Iio
|
||||
oss << "IIO writeFloat for attibute " << attributeName << " failed";
|
||||
throw std::runtime_error(oss.str());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -233,13 +245,15 @@ class Iio
|
||||
}
|
||||
|
||||
private:
|
||||
static void private_event_handler(iio_event_data* data, void *args)
|
||||
static void
|
||||
private_event_handler(iio_event_data* data, void* args)
|
||||
{
|
||||
if (args != NULL) {
|
||||
IioHandler* handler = (IioHandler*) args;
|
||||
IioEventData eventData;
|
||||
int chan_type, modifier, type, direction, channel, channel2, different;
|
||||
mraa_iio_event_extract_event(data, &chan_type, &modifier, &type, &direction, &channel, &channel2, &different);
|
||||
mraa_iio_event_extract_event(data, &chan_type, &modifier, &type, &direction, &channel,
|
||||
&channel2, &different);
|
||||
eventData.channelType = chan_type;
|
||||
eventData.modifier = modifier;
|
||||
eventData.type = type;
|
||||
@@ -253,5 +267,4 @@ class Iio
|
||||
|
||||
mraa_iio_context m_iio;
|
||||
};
|
||||
|
||||
}
|
||||
|
@@ -20,6 +20,8 @@
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
//For kernel 4.1+,
|
||||
|
157
api/mraa/initio.h
Normal file
157
api/mraa/initio.h
Normal file
@@ -0,0 +1,157 @@
|
||||
/*
|
||||
* Author: Noel Eck <noel.eck@intel.com>
|
||||
* Copyright (c) 2014-2016 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
/**
|
||||
* @file
|
||||
* @brief I/O initializer
|
||||
*
|
||||
* initio allows for string initialization of mraa resources.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "aio.h"
|
||||
#include "gpio.h"
|
||||
#include "i2c.h"
|
||||
|
||||
#if !defined(PERIPHERALMAN)
|
||||
#include "iio.h"
|
||||
#endif
|
||||
|
||||
#include "pwm.h"
|
||||
#include "spi.h"
|
||||
#include "uart.h"
|
||||
#include "uart_ow.h"
|
||||
|
||||
typedef struct _mraa_io_descriptor {
|
||||
int n_aio;
|
||||
mraa_aio_context* aios;
|
||||
int n_gpio;
|
||||
mraa_gpio_context* gpios;
|
||||
int n_i2c;
|
||||
mraa_i2c_context* i2cs;
|
||||
#if !defined(PERIPHERALMAN)
|
||||
int n_iio;
|
||||
mraa_iio_context* iios;
|
||||
#endif
|
||||
int n_pwm;
|
||||
mraa_pwm_context* pwms;
|
||||
int n_spi;
|
||||
mraa_spi_context* spis;
|
||||
int n_uart;
|
||||
mraa_uart_context* uarts;
|
||||
int n_uart_ow;
|
||||
mraa_uart_ow_context* uart_ows;
|
||||
|
||||
char* leftover_str;
|
||||
} mraa_io_descriptor;
|
||||
|
||||
/**
|
||||
* Initialize a structure of MRAA context elements given a description string.
|
||||
*
|
||||
* @param strdesc of one or more MRAA IO
|
||||
* io:io_ndx[:option_0:option_1:option_2:option_n][,io:io_ndx]
|
||||
*
|
||||
* AIO
|
||||
* AIO_KEY:aio pin[:num_bits]
|
||||
*
|
||||
* examples:
|
||||
* a:13 # aio 13
|
||||
* a:13:10 # aio 13, 10 bits
|
||||
*
|
||||
* GPIO
|
||||
* GPIO_KEY:gpio pin[:dir:value:mode:edge:input:driver]
|
||||
*
|
||||
* examples:
|
||||
* g:13:input # gpio 13, input
|
||||
* g:13:0:output # gpio 13, value 0, output
|
||||
*
|
||||
* I2C
|
||||
* I2C_KEY:i2c bus[:address:mode]
|
||||
*
|
||||
* examples:
|
||||
* i:1:std # i2c bus 1, STD speed (100 KHz)
|
||||
* i:1:16 # i2c bus 1, address 16
|
||||
* i:0x1:0x10 # i2c bus 1, address 16
|
||||
*
|
||||
* IIO
|
||||
* IIO_KEY:iio device
|
||||
*
|
||||
* examples:
|
||||
* ii:1 # iio device 1
|
||||
* ii:0x1 # iio device 1
|
||||
*
|
||||
* PWM
|
||||
* PWM_KEY:pwm pin
|
||||
*
|
||||
* examples:
|
||||
* p:1 # pwm pin 1
|
||||
* p:0x1 # pwm pin 1
|
||||
*
|
||||
* SPI
|
||||
* SPI_KEY:spi bus[:mode:frequency]
|
||||
*
|
||||
* examples:
|
||||
* s:1 # spi bus 1
|
||||
* s:0x1:mode2:400000 # spi bus 1, mode2 (CPOL = 1, CPHA = 0), 400 KHz
|
||||
*
|
||||
* UART
|
||||
* UART_KEY:uart ndx[:baud:mode]
|
||||
*
|
||||
* examples:
|
||||
* u:1 # uart bus 1
|
||||
* u:0x1:9600:8N1 # uart bus 1, 9600 baud, 8 bit byte, no parity, 1 stop bit
|
||||
*
|
||||
* UART_OW
|
||||
* UART_OW_KEY:uart_ow ndx
|
||||
*
|
||||
* examples:
|
||||
* ow:1 # uart_ow bus 1
|
||||
* ow:0x1 # uart_ow bus 1
|
||||
*
|
||||
*
|
||||
* @param desc Pointer to structure containing number/pointer collections for initialized IO.
|
||||
* @return Result of operation
|
||||
*/
|
||||
mraa_result_t mraa_io_init(const char* strdesc, mraa_io_descriptor** desc);
|
||||
|
||||
/**
|
||||
* Free and close resources used by mraa_io_descriptor structure.
|
||||
*
|
||||
* @param desc mraa_io_descriptor structure
|
||||
* @return Result of operation
|
||||
*/
|
||||
mraa_result_t mraa_io_close(mraa_io_descriptor* desc);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
180
api/mraa/initio.hpp
Normal file
180
api/mraa/initio.hpp
Normal file
@@ -0,0 +1,180 @@
|
||||
/*
|
||||
* Author: Mihai Stefanescu <mihai.stefanescu@rinftech.com>
|
||||
* Copyright (c) 2018 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.
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "initio.h"
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "aio.hpp"
|
||||
#include "gpio.hpp"
|
||||
#include "i2c.hpp"
|
||||
|
||||
#if !defined(PERIPHERALMAN)
|
||||
#include "iio.hpp"
|
||||
#endif
|
||||
|
||||
#include "pwm.hpp"
|
||||
#include "spi.hpp"
|
||||
#include "uart.hpp"
|
||||
#include "uart_ow.hpp"
|
||||
|
||||
namespace mraa
|
||||
{
|
||||
class MraaIo
|
||||
{
|
||||
private:
|
||||
mraa_io_descriptor* descs = nullptr;
|
||||
|
||||
public:
|
||||
MraaIo(const std::string& initStr) : descs()
|
||||
{
|
||||
if (mraa_io_init(initStr.c_str(), &descs) != MRAA_SUCCESS) {
|
||||
throw std::runtime_error("mraa_io_init error");
|
||||
}
|
||||
|
||||
aios.reserve(descs->n_aio);
|
||||
for (int i = 0; i < descs->n_aio; ++i) {
|
||||
aios.emplace_back(descs->aios[i]);
|
||||
}
|
||||
|
||||
gpios.reserve(descs->n_gpio);
|
||||
for (int i = 0; i < descs->n_gpio; ++i) {
|
||||
gpios.emplace_back(descs->gpios[i]);
|
||||
}
|
||||
|
||||
i2cs.reserve(descs->n_i2c);
|
||||
for (int i = 0; i < descs->n_i2c; ++i) {
|
||||
i2cs.emplace_back(descs->i2cs[i]);
|
||||
}
|
||||
|
||||
#if !defined(PERIPHERALMAN)
|
||||
iios.reserve(descs->n_iio);
|
||||
for (int i = 0; i < descs->n_iio; ++i) {
|
||||
iios.emplace_back(descs->iios[i]);
|
||||
}
|
||||
#endif
|
||||
|
||||
pwms.reserve(descs->n_pwm);
|
||||
for (int i = 0; i < descs->n_pwm; ++i) {
|
||||
pwms.emplace_back(descs->pwms[i]);
|
||||
}
|
||||
|
||||
spis.reserve(descs->n_spi);
|
||||
for (int i = 0; i < descs->n_spi; ++i) {
|
||||
spis.emplace_back(descs->spis[i]);
|
||||
}
|
||||
|
||||
uarts.reserve(descs->n_uart);
|
||||
for (int i = 0; i < descs->n_uart; ++i) {
|
||||
uarts.emplace_back(descs->uarts[i]);
|
||||
}
|
||||
|
||||
uart_ows.reserve(descs->n_uart_ow);
|
||||
for (int i = 0; i < descs->n_uart_ow; ++i) {
|
||||
uart_ows.emplace_back(descs->uart_ows[i]);
|
||||
}
|
||||
|
||||
if (descs->leftover_str) {
|
||||
leftoverStr = std::string(descs->leftover_str);
|
||||
} else {
|
||||
leftoverStr = std::string("");
|
||||
}
|
||||
}
|
||||
|
||||
MraaIo() : descs() {}
|
||||
|
||||
~MraaIo()
|
||||
{
|
||||
if (descs != nullptr) {
|
||||
if (descs->leftover_str) {
|
||||
free(descs->leftover_str);
|
||||
}
|
||||
if (descs->n_aio) {
|
||||
free(descs->aios);
|
||||
}
|
||||
if (descs->n_gpio) {
|
||||
free(descs->gpios);
|
||||
}
|
||||
if (descs->n_i2c) {
|
||||
free(descs->i2cs);
|
||||
}
|
||||
#if !defined(PERIPHERALMAN)
|
||||
if (descs->n_iio) {
|
||||
free(descs->iios);
|
||||
}
|
||||
#endif
|
||||
if (descs->n_pwm) {
|
||||
free(descs->pwms);
|
||||
}
|
||||
if (descs->n_spi) {
|
||||
free(descs->spis);
|
||||
}
|
||||
if (descs->n_uart) {
|
||||
free(descs->uarts);
|
||||
}
|
||||
if (descs->n_uart_ow) {
|
||||
free(descs->uart_ows);
|
||||
}
|
||||
|
||||
/* Finally free the mraa_io_descriptor structure. */
|
||||
free(descs);
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
std::vector<Aio> aios;
|
||||
std::vector<Gpio> gpios;
|
||||
std::vector<I2c> i2cs;
|
||||
#if !defined(PERIPHERALMAN)
|
||||
std::vector<Iio> iios;
|
||||
#endif
|
||||
std::vector<Pwm> pwms;
|
||||
std::vector<Spi> spis;
|
||||
std::vector<Uart> uarts;
|
||||
std::vector<UartOW> uart_ows;
|
||||
|
||||
private:
|
||||
/* Used exclusively by the UPM library. */
|
||||
std::string leftoverStr;
|
||||
|
||||
public:
|
||||
/* This is used mainly by sensors that use C structs/functions in C++ code. */
|
||||
mraa_io_descriptor*
|
||||
getMraaDescriptors()
|
||||
{
|
||||
return descs;
|
||||
}
|
||||
|
||||
std::string
|
||||
getLeftoverStr()
|
||||
{
|
||||
return leftoverStr;
|
||||
}
|
||||
};
|
||||
}
|
@@ -20,6 +20,8 @@
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
@@ -46,16 +48,24 @@ extern "C" {
|
||||
*/
|
||||
typedef struct _led* mraa_led_context;
|
||||
|
||||
/**
|
||||
* Initialise led_context, based on led index.
|
||||
*
|
||||
* @param led ID of the LED
|
||||
* @returns LED context or NULL
|
||||
*/
|
||||
mraa_led_context mraa_led_init(int led);
|
||||
|
||||
/**
|
||||
* Initialise led_context, based on led function name.
|
||||
* The structure of LED entry in sysfs is "devicename:colour:function"
|
||||
* This api expects only one unique LED identifier which would be
|
||||
* "function" name most often. For instance, `mraa_led_init("user4");`
|
||||
* "function" name most often. For instance, `mraa_led_init_raw("user4");`
|
||||
*
|
||||
* @param led Name of the LED
|
||||
* @param led_dev Name of the LED device
|
||||
* @returns LED context or NULL
|
||||
*/
|
||||
mraa_led_context mraa_led_init(const char* led);
|
||||
mraa_led_context mraa_led_init_raw(const char* led_dev);
|
||||
|
||||
/**
|
||||
* Set LED brightness
|
||||
|
@@ -20,6 +20,8 @@
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
@@ -36,6 +38,7 @@ namespace mraa
|
||||
*
|
||||
* This file defines the LED interface for libmraa
|
||||
*
|
||||
* @snippet led.cpp Interesting
|
||||
*/
|
||||
class Led
|
||||
{
|
||||
@@ -43,9 +46,9 @@ class Led
|
||||
/**
|
||||
* Instantiates an LED object
|
||||
*
|
||||
* @param led LED fuction name to use
|
||||
* @param led LED index to use
|
||||
*/
|
||||
Led(const char* led)
|
||||
Led(int led)
|
||||
{
|
||||
m_led = mraa_led_init(led);
|
||||
|
||||
@@ -54,6 +57,20 @@ class Led
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates an LED object
|
||||
*
|
||||
* @param led_dev LED function name to use
|
||||
*/
|
||||
Led(std::string led_dev)
|
||||
{
|
||||
m_led = mraa_led_init_raw(led_dev.c_str());
|
||||
|
||||
if (m_led == NULL) {
|
||||
throw std::invalid_argument("Invalid LED name specified");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* LED Constructor, takes a pointer to a LED context and initialises
|
||||
* the LED class
|
||||
|
@@ -20,6 +20,8 @@
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@@ -20,6 +20,8 @@
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
@@ -36,7 +38,7 @@ namespace mraa
|
||||
*
|
||||
* This file defines the PWM interface for libmraa
|
||||
*
|
||||
* @snippet Pwm3-cycle.cpp Interesting
|
||||
* @snippet pwm.cpp Interesting
|
||||
*/
|
||||
class Pwm
|
||||
{
|
||||
|
@@ -20,6 +20,8 @@
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@@ -20,6 +20,8 @@
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
@@ -51,7 +53,7 @@ typedef enum {
|
||||
*
|
||||
* This file defines the SPI interface for libmraa
|
||||
*
|
||||
* @snippet Spi-pot.cpp Interesting
|
||||
* @snippet spi.cpp Interesting
|
||||
*/
|
||||
class Spi
|
||||
{
|
||||
|
@@ -19,6 +19,8 @@
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
@@ -59,7 +61,21 @@ typedef enum {
|
||||
MRAA_UP2 = 16, /**< The UP^2 Board */
|
||||
MRAA_MTK_LINKIT = 17, /**< Mediatek MT7688 based Linkit boards */
|
||||
MRAA_MTK_OMEGA2 = 18, /**< MT7688 based Onion Omega2 board */
|
||||
|
||||
MRAA_IEI_TANK = 19, /**< IEI Tank System*/
|
||||
MRAA_ROCKPI4 = 20, /**< Radxa ROCK PI 4 Models A/B/C */
|
||||
MRAA_ADLINK_IPI = 21, /**< Adlink Industrial PI */
|
||||
MRAA_ADLINK_LEC_AL = 22, /**< Adlink LEC-AL*/
|
||||
MRAA_ADLINK_LEC_AL_AI = 23, /**< Adlink LEC-AL*/
|
||||
MRAA_UPXTREME = 24, /**< The UPXTREME Board */
|
||||
MRAA_ROCKPIS = 25, /**< Radxa ROCK PI S Board */
|
||||
MRAA_ROCKPIN10 = 26, /**< Radxa ROCK PI N 10 Board */
|
||||
MRAA_ROCKPIE = 27, /**< Radxa ROCK PI E V1.2 */
|
||||
MRAA_ROCKPIE_V11 = 28, /**< Radxa ROCK PI E V1.1 */
|
||||
MRAA_ROCKPIX = 29, /**< Radxa ROCK PI X V1.4 */
|
||||
MRAA_RADXA_ZERO = 30, /**< Radxa Zero V1.3 */
|
||||
MRAA_RADXA_ROCK_3_MODEL_A = 31, /**< Radxa ROCK3A V1.3 */
|
||||
MRAA_RADXA_CM3_IO = 32, /**< Radxa CM3 V1.3 */
|
||||
MRAA_RADXA_ROCK_3_MODEL_C = 33, /**< Radxa ROCK 3C */
|
||||
// USB platform extenders start at 256
|
||||
MRAA_FTDI_FT4222 = 256, /**< FTDI FT4222 USB to i2c bridge */
|
||||
|
||||
@@ -166,6 +182,39 @@ typedef enum {
|
||||
MRAA_INTEL_EDISON_GP81 = 55
|
||||
} mraa_intel_edison_t;
|
||||
|
||||
/**
|
||||
* ROCKPI4 GPIO numbering enum
|
||||
*/
|
||||
typedef enum {
|
||||
MRAA_ROCKPI4_GPIO71 = 3,
|
||||
MRAA_ROCKPI4_GPIO72 = 5,
|
||||
MRAA_ROCKPI4_GPIO75 = 7,
|
||||
MRAA_ROCKPI4_GPIO148 = 8,
|
||||
MRAA_ROCKPI4_GPIO147 = 10,
|
||||
MRAA_ROCKPI4_GPIO146 = 11,
|
||||
MRAA_ROCKPI4_GPIO131 = 12,
|
||||
MRAA_ROCKPI4_GPIO150 = 13,
|
||||
MRAA_ROCKPI4_GPIO149 = 15,
|
||||
MRAA_ROCKPI4_GPIO154 = 16,
|
||||
MRAA_ROCKPI4_GPIO156 = 18,
|
||||
MRAA_ROCKPI4_GPIO40 = 19,
|
||||
MRAA_ROCKPI4_GPIO39 = 21,
|
||||
MRAA_ROCKPI4_GPIO157 = 22,
|
||||
MRAA_ROCKPI4_GPIO41 = 23,
|
||||
MRAA_ROCKPI4_GPIO42 = 24,
|
||||
MRAA_ROCKPI4_GPIO64 = 27,
|
||||
MRAA_ROCKPI4_GPIO65 = 28,
|
||||
MRAA_ROCKPI4_GPIO74 = 29,
|
||||
MRAA_ROCKPI4_GPIO73 = 31,
|
||||
MRAA_ROCKPI4_GPIO112 = 32,
|
||||
MRAA_ROCKPI4_GPIO76 = 33,
|
||||
MRAA_ROCKPI4_GPIO133 = 35,
|
||||
MRAA_ROCKPI4_GPIO132 = 36,
|
||||
MRAA_ROCKPI4_GPIO158 = 37,
|
||||
MRAA_ROCKPI4_GPIO134 = 38,
|
||||
MRAA_ROCKPI4_GPIO135 = 40
|
||||
} mraa_rockpi4_t;
|
||||
|
||||
/**
|
||||
* Raspberry PI Wiring compatible numbering enum
|
||||
*/
|
||||
|
@@ -19,6 +19,8 @@
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
@@ -55,6 +57,11 @@ typedef enum {
|
||||
PHYBOARD_WEGA = 14, /**< The phyBOARD-Wega */
|
||||
DE_NANO_SOC = 15, /**< Terasic DE-Nano-SoC Board */
|
||||
INTEL_UP2 = 16, /**< The UP^2 Board */
|
||||
MTK_LINKIT = 17, /**< Mediatek MT7688 based Linkit boards */
|
||||
MTK_OMEGA2 = 18, /**< MT7688 based Onion Omega2 board */
|
||||
IEI_TANK = 19, /**< IEI Tank System*/
|
||||
ROCKPI4 = 20, /**< Radxa ROCK PI 4 Models A/B/C */
|
||||
INTEL_UPXTREME = 24, /**< The UPXTREME Board */
|
||||
|
||||
FTDI_FT4222 = 256, /**< FTDI FT4222 USB to i2c bridge */
|
||||
|
||||
@@ -62,6 +69,7 @@ typedef enum {
|
||||
GENERIC_FIRMATA = 1280, /**< Firmata uart platform/bridge */
|
||||
|
||||
ANDROID_PERIPHERALMANAGER = 95, /**< Android Things peripheral manager platform */
|
||||
MOCK_PLATFORM = 96, /**< Mock platform, which requires no real hardware */
|
||||
NULL_PLATFORM = 98,
|
||||
UNKNOWN_PLATFORM = 99 /**< An unknown platform type, typically will load INTEL_GALILEO_GEN1 */
|
||||
} Platform;
|
||||
@@ -194,6 +202,39 @@ typedef enum {
|
||||
RASPBERRY_WIRING_PIN29 = 40
|
||||
} RaspberryWiring;
|
||||
|
||||
/**
|
||||
* ROCKPI4 GPIO numbering enum
|
||||
*/
|
||||
typedef enum {
|
||||
ROCKPI4_GPIO71 = 3,
|
||||
ROCKPI4_GPIO72 = 5,
|
||||
ROCKPI4_GPIO75 = 7,
|
||||
ROCKPI4_GPIO148 = 8,
|
||||
ROCKPI4_GPIO147 = 10,
|
||||
ROCKPI4_GPIO146 = 11,
|
||||
ROCKPI4_GPIO131 = 12,
|
||||
ROCKPI4_GPIO150 = 13,
|
||||
ROCKPI4_GPIO149 = 15,
|
||||
ROCKPI4_GPIO154 = 16,
|
||||
ROCKPI4_GPIO156 = 18,
|
||||
ROCKPI4_GPIO40 = 19,
|
||||
ROCKPI4_GPIO39 = 21,
|
||||
ROCKPI4_GPIO157 = 22,
|
||||
ROCKPI4_GPIO41 = 23,
|
||||
ROCKPI4_GPIO42 = 24,
|
||||
ROCKPI4_GPIO64 = 27,
|
||||
ROCKPI4_GPIO65 = 28,
|
||||
ROCKPI4_GPIO74 = 29,
|
||||
ROCKPI4_GPIO73 = 31,
|
||||
ROCKPI4_GPIO112 = 32,
|
||||
ROCKPI4_GPIO76 = 33,
|
||||
ROCKPI4_GPIO133 = 35,
|
||||
ROCKPI4_GPIO132 = 36,
|
||||
ROCKPI4_GPIO158 = 37,
|
||||
ROCKPI4_GPIO134 = 38,
|
||||
ROCKPI4_GPIO135 = 40
|
||||
} RockPi4;
|
||||
|
||||
/**
|
||||
* MRAA return codes
|
||||
*/
|
||||
|
@@ -22,6 +22,8 @@
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@@ -22,6 +22,8 @@
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
@@ -40,7 +42,7 @@ namespace mraa
|
||||
*
|
||||
* This file defines the UART interface for libmraa
|
||||
*
|
||||
* @snippet Uart-example.cpp Interesting
|
||||
* @snippet uart.cpp Interesting
|
||||
*/
|
||||
class Uart
|
||||
{
|
||||
|
@@ -20,6 +20,8 @@
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@@ -20,14 +20,16 @@
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "uart_ow.h"
|
||||
#include "types.hpp"
|
||||
#include <stdexcept>
|
||||
#include "uart_ow.h"
|
||||
#include <cstring>
|
||||
#include <stdexcept>
|
||||
|
||||
namespace mraa
|
||||
{
|
||||
@@ -37,7 +39,7 @@ namespace mraa
|
||||
*
|
||||
* This file defines the UartOW (UART to Dallas 1-wire) interface for libmraa
|
||||
*
|
||||
* @snippet UartOW.cpp Interesting
|
||||
* @snippet uart_ow.cpp Interesting
|
||||
*/
|
||||
class UartOW
|
||||
{
|
||||
@@ -74,6 +76,21 @@ class UartOW
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* UartOW Constructor, takes a pointer to the UartOW context and initialises
|
||||
* the UartOW class
|
||||
*
|
||||
* @param uart_ow_context void * to a UartOW context
|
||||
*/
|
||||
UartOW(void* uart_ow_context)
|
||||
{
|
||||
m_uart = (mraa_uart_ow_context) uart_ow_context;
|
||||
|
||||
if (m_uart == NULL) {
|
||||
throw std::invalid_argument("Invalid UART_OW context");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Uart destructor
|
||||
*/
|
||||
|
14
cmake/Toolchains/README.md
Normal file
14
cmake/Toolchains/README.md
Normal file
@@ -0,0 +1,14 @@
|
||||
This directory used to contain an OE-Toolchain file. A far better one is now included
|
||||
with Devtool/OE-SDK.
|
||||
|
||||
https://git.yoctoproject.org/cgit.cgi/poky/plain/meta/recipes-devtools/cmake/cmake/OEToolchainConfig.cmake
|
||||
|
||||
The following may be interesting for certain Java/Cross-compilation reasons:
|
||||
```
|
||||
# for Cmake java
|
||||
set( JAVA_AWT_INCLUDE_PATH $ENV{JAVA_HOME}/include CACHE PATH "" FORCE)
|
||||
set( JAVA_AWT_LIBRARY $ENV{JAVA_HOME}/jre/lib/amd64/libjawt.so CACHE FILEPATH "" FORCE)
|
||||
set( JAVA_INCLUDE_PATH $ENV{JAVA_HOME}/include CACHE PATH "" FORCE)
|
||||
set( JAVA_INCLUDE_PATH2 $ENV{JAVA_HOME}/include/linux CACHE PATH "" FORCE)
|
||||
set( JAVA_JVM_LIBRARY $ENV{JAVA_HOME}/jre/lib/amd64/libjvm.so CACHE FILEPATH "" FORCE)
|
||||
```
|
@@ -1,25 +0,0 @@
|
||||
# this toolchain file comes from gnuradio project
|
||||
|
||||
set( CMAKE_SYSTEM_NAME Linux )
|
||||
#set( CMAKE_C_COMPILER $ENV{CC} )
|
||||
#set( CMAKE_CXX_COMPILER $ENV{CXX} )
|
||||
string(REGEX MATCH "sysroots/([a-zA-Z0-9]+)" CMAKE_SYSTEM_PROCESSOR $ENV{SDKTARGETSYSROOT})
|
||||
string(REGEX REPLACE "sysroots/" "" CMAKE_SYSTEM_PROCESSOR ${CMAKE_SYSTEM_PROCESSOR})
|
||||
set( CMAKE_CXX_FLAGS $ENV{CXXFLAGS} CACHE STRING "" FORCE )
|
||||
set( CMAKE_C_FLAGS $ENV{CFLAGS} CACHE STRING "" FORCE ) #same flags for C sources
|
||||
set( CMAKE_LDFLAGS_FLAGS ${CMAKE_CXX_FLAGS} CACHE STRING "" FORCE ) #same flags for C sources
|
||||
set( CMAKE_LIBRARY_PATH ${OECORE_TARGET_SYSROOT}/usr/lib )
|
||||
set( CMAKE_FIND_ROOT_PATH $ENV{OECORE_TARGET_SYSROOT} $ENV{OECORE_NATIVE_SYSROOT} )
|
||||
set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )
|
||||
set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
|
||||
set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
|
||||
set( CMAKE_INSTALL_PREFIX $ENV{OECORE_TARGET_SYSROOT}/usr CACHE STRING "" FORCE)
|
||||
set( ORC_INCLUDE_DIRS $ENV{OECORE_TARGET_SYSROOT}/usr/include/orc-0.4 )
|
||||
set( ORC_LIBRARY_DIRS $ENV{OECORE_TARGET_SYSROOT}/usr/lib )
|
||||
|
||||
# for java
|
||||
set( JAVA_AWT_INCLUDE_PATH $ENV{JAVA_HOME}/include CACHE PATH "" FORCE)
|
||||
set( JAVA_AWT_LIBRARY $ENV{JAVA_HOME}/jre/lib/amd64/libjawt.so CACHE FILEPATH "" FORCE)
|
||||
set( JAVA_INCLUDE_PATH $ENV{JAVA_HOME}/include CACHE PATH "" FORCE)
|
||||
set( JAVA_INCLUDE_PATH2 $ENV{JAVA_HOME}/include/linux CACHE PATH "" FORCE)
|
||||
set( JAVA_JVM_LIBRARY $ENV{JAVA_HOME}/jre/lib/amd64/libjvm.so CACHE FILEPATH "" FORCE)
|
@@ -1,222 +0,0 @@
|
||||
# - The builtin (binary) CPack Deb generator (Unix only)
|
||||
# CPackDeb may be used to create Deb package using CPack.
|
||||
# CPackDeb is a CPack generator thus it uses the CPACK_XXX variables
|
||||
# used by CPack : http://www.cmake.org/Wiki/CMake:CPackConfiguration
|
||||
#
|
||||
# However CPackRPM has specific features which are controlled by
|
||||
# the specifics CPACK_RPM_XXX variables.You'll find a detailed usage on
|
||||
# the wiki:
|
||||
# http://www.cmake.org/Wiki/CMake:CPackPackageGenerators#DEB_.28UNIX_only.29
|
||||
# However as a handy reminder here comes the list of specific variables:
|
||||
#
|
||||
# CPACK_DEBIAN_PACKAGE_NAME
|
||||
# Mandatory : YES
|
||||
# Default : CPACK_PACKAGE_NAME (lower case)
|
||||
# The debian package summary
|
||||
# CPACK_DEBIAN_PACKAGE_VERSION
|
||||
# Mandatory : YES
|
||||
# Default : CPACK_PACKAGE_VERSION
|
||||
# The debian package version
|
||||
# CPACK_DEBIAN_PACKAGE_ARCHITECTURE)
|
||||
# Mandatory : YES
|
||||
# Default : Output of dpkg --print-architecture or i386
|
||||
# The debian package architecture
|
||||
# CPACK_DEBIAN_PACKAGE_DEPENDS
|
||||
# Mandatory : NO
|
||||
# Default : -
|
||||
# May be used to set deb dependencies.
|
||||
# CPACK_DEBIAN_PACKAGE_MAINTAINER
|
||||
# Mandatory : YES
|
||||
# Default : CPACK_PACKAGE_CONTACT
|
||||
# The debian package maintainer
|
||||
# CPACK_DEBIAN_PACKAGE_DESCRIPTION
|
||||
# Mandatory : YES
|
||||
# Default : CPACK_PACKAGE_DESCRIPTION_SUMMARY
|
||||
# The debian package description
|
||||
# CPACK_DEBIAN_PACKAGE_SECTION
|
||||
# Mandatory : YES
|
||||
# Default : 'devel'
|
||||
# The debian package section
|
||||
# CPACK_DEBIAN_PACKAGE_PRIORITY
|
||||
# Mandatory : YES
|
||||
# Default : 'optional'
|
||||
# The debian package priority
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2007-2009 Kitware, Inc.
|
||||
# Copyright 2007-2009 Mathieu Malaterre <mathieu.malaterre@gmail.com>
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
# (To distributed this file outside of CMake, substitute the full
|
||||
# License text for the above reference.)
|
||||
|
||||
# CPack script for creating Debian package
|
||||
# Author: Mathieu Malaterre
|
||||
#
|
||||
# http://wiki.debian.org/HowToPackageForDebian
|
||||
|
||||
IF(CMAKE_BINARY_DIR)
|
||||
MESSAGE(FATAL_ERROR "CPackDeb.cmake may only be used by CPack internally.")
|
||||
ENDIF(CMAKE_BINARY_DIR)
|
||||
|
||||
IF(NOT UNIX)
|
||||
MESSAGE(FATAL_ERROR "CPackDeb.cmake may only be used under UNIX.")
|
||||
ENDIF(NOT UNIX)
|
||||
|
||||
# Let's define the control file found in debian package:
|
||||
|
||||
# Binary package:
|
||||
# http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-binarycontrolfiles
|
||||
|
||||
# DEBIAN/control
|
||||
# debian policy enforce lower case for package name
|
||||
# Package: (mandatory)
|
||||
IF(NOT CPACK_DEBIAN_PACKAGE_NAME)
|
||||
STRING(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_DEBIAN_PACKAGE_NAME)
|
||||
ENDIF(NOT CPACK_DEBIAN_PACKAGE_NAME)
|
||||
|
||||
# Version: (mandatory)
|
||||
IF(NOT CPACK_DEBIAN_PACKAGE_VERSION)
|
||||
IF(NOT CPACK_PACKAGE_VERSION)
|
||||
MESSAGE(FATAL_ERROR "Debian package requires a package version")
|
||||
ENDIF(NOT CPACK_PACKAGE_VERSION)
|
||||
SET(CPACK_DEBIAN_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION})
|
||||
ENDIF(NOT CPACK_DEBIAN_PACKAGE_VERSION)
|
||||
|
||||
# Architecture: (mandatory)
|
||||
IF(NOT CPACK_DEBIAN_PACKAGE_ARCHITECTURE)
|
||||
# There is no such thing as i686 architecture on debian, you should use i386 instead
|
||||
# $ dpkg --print-architecture
|
||||
FIND_PROGRAM(DPKG_CMD dpkg)
|
||||
IF(NOT DPKG_CMD)
|
||||
MESSAGE(STATUS "Can not find dpkg in your path, default to i386.")
|
||||
SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE i386)
|
||||
ENDIF(NOT DPKG_CMD)
|
||||
EXECUTE_PROCESS(COMMAND "${DPKG_CMD}" --print-architecture
|
||||
OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
ENDIF(NOT CPACK_DEBIAN_PACKAGE_ARCHITECTURE)
|
||||
|
||||
# have a look at GET_PROPERTY(result GLOBAL PROPERTY ENABLED_FEATURES),
|
||||
# this returns the successful FIND_PACKAGE() calls, maybe this can help
|
||||
# Depends:
|
||||
# You should set: DEBIAN_PACKAGE_DEPENDS
|
||||
# TODO: automate 'objdump -p | grep NEEDED'
|
||||
IF(NOT CPACK_DEBIAN_PACKAGE_DEPENDS)
|
||||
MESSAGE(STATUS "CPACK_DEBIAN_PACKAGE_DEPENDS not set, the package will have no dependencies.")
|
||||
ENDIF(NOT CPACK_DEBIAN_PACKAGE_DEPENDS)
|
||||
|
||||
# Maintainer: (mandatory)
|
||||
IF(NOT CPACK_DEBIAN_PACKAGE_MAINTAINER)
|
||||
IF(NOT CPACK_PACKAGE_CONTACT)
|
||||
MESSAGE(FATAL_ERROR "Debian package requires a maintainer for a package, set CPACK_PACKAGE_CONTACT or CPACK_DEBIAN_PACKAGE_MAINTAINER")
|
||||
ENDIF(NOT CPACK_PACKAGE_CONTACT)
|
||||
SET(CPACK_DEBIAN_PACKAGE_MAINTAINER ${CPACK_PACKAGE_CONTACT})
|
||||
ENDIF(NOT CPACK_DEBIAN_PACKAGE_MAINTAINER)
|
||||
|
||||
# Description: (mandatory)
|
||||
IF(NOT CPACK_DEBIAN_PACKAGE_DESCRIPTION)
|
||||
IF(NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY)
|
||||
MESSAGE(FATAL_ERROR "Debian package requires a summary for a package, set CPACK_PACKAGE_DESCRIPTION_SUMMARY or CPACK_DEBIAN_PACKAGE_DESCRIPTION")
|
||||
ENDIF(NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY)
|
||||
SET(CPACK_DEBIAN_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION_SUMMARY})
|
||||
ENDIF(NOT CPACK_DEBIAN_PACKAGE_DESCRIPTION)
|
||||
|
||||
# Section: (recommended)
|
||||
IF(NOT CPACK_DEBIAN_PACKAGE_SECTION)
|
||||
SET(CPACK_DEBIAN_PACKAGE_SECTION "devel")
|
||||
ENDIF(NOT CPACK_DEBIAN_PACKAGE_SECTION)
|
||||
|
||||
# Priority: (recommended)
|
||||
IF(NOT CPACK_DEBIAN_PACKAGE_PRIORITY)
|
||||
SET(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
|
||||
ENDIF(NOT CPACK_DEBIAN_PACKAGE_PRIORITY )
|
||||
|
||||
# Recommends:
|
||||
# You should set: CPACK_DEBIAN_PACKAGE_RECOMMENDS
|
||||
|
||||
# Suggests:
|
||||
# You should set: CPACK_DEBIAN_PACKAGE_SUGGESTS
|
||||
|
||||
# CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
|
||||
# This variable allow advanced user to add custom script to the control.tar.gz (inside the .deb archive)
|
||||
# Typical examples are:
|
||||
# - conffiles
|
||||
# - postinst
|
||||
# - postrm
|
||||
# - prerm"
|
||||
# Usage:
|
||||
# SET(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR/prerm;${CMAKE_CURRENT_SOURCE_DIR}/postrm")
|
||||
|
||||
|
||||
# For debian source packages:
|
||||
# debian/control
|
||||
# http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-sourcecontrolfiles
|
||||
|
||||
# .dsc
|
||||
# http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-debiansourcecontrolfiles
|
||||
|
||||
# Builds-Depends:
|
||||
#IF(NOT CPACK_DEBIAN_PACKAGE_BUILDS_DEPENDS)
|
||||
# SET(CPACK_DEBIAN_PACKAGE_BUILDS_DEPENDS
|
||||
# "debhelper (>> 5.0.0), libncurses5-dev, tcl8.4"
|
||||
# )
|
||||
#ENDIF(NOT CPACK_DEBIAN_PACKAGE_BUILDS_DEPENDS)
|
||||
|
||||
# Description: (mandatory)
|
||||
#if(NOT CPACK_SECTION)
|
||||
# message(FATAL_ERROR "opkg package requires a package section")
|
||||
#endif(NOT CPACK_SECTION)
|
||||
|
||||
# Package for opkg
|
||||
FIND_PROGRAM(OPKG_CMD opkg-build)
|
||||
if( ${OPKG_CMD} STREQUAL "OPKG_CMD-NOTFOUND" )
|
||||
message("CPack: opkg-build not found. Skipping packaging")
|
||||
else( ${OPKG_CMD} STREQUAL "OPKG_CMD-NOTFOUND" )
|
||||
SET(CPACK_OPKG_ROOTDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}")
|
||||
FILE(MAKE_DIRECTORY ${CPACK_OPKG_ROOTDIR}/CONTROL)
|
||||
set(CPACK_OPKG_CONTROL_FILE "${CPACK_OPKG_ROOTDIR}/CONTROL/control")
|
||||
# Write controlfile
|
||||
FILE(WRITE ${CPACK_OPKG_CONTROL_FILE}
|
||||
"Package: ${CPACK_PACKAGE_NAME}
|
||||
Version: ${CPACK_PACKAGE_VERSION}
|
||||
Description: ${CPACK_PACKAGE_DESCRIPTION_SUMMARY}
|
||||
Architecture: ${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}
|
||||
Section: ${CPACK_DEBIAN_PACKAGE_SECTION}
|
||||
Priority: optional
|
||||
Maintainer: ${CPACK_DEBIAN_PACKAGE_MAINTAINER}
|
||||
Depends:
|
||||
Provides: ${CPACK_DEBIAN_PACKAGE_PROVIDES}
|
||||
Replaces: ${CPACK_DEBIAN_PACKAGE_REPLACES}
|
||||
Conflicts: ${CPACK_DEBIAN_PACKAGE_CONFLICTS}
|
||||
Source: https://github.com/intel-iot-devkit/mraa
|
||||
#Essential: no
|
||||
")
|
||||
|
||||
set(OPKG_FILE_NAME "${CPACK_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}")
|
||||
execute_process(
|
||||
COMMAND "${OPKG_CMD}" "-o" "0" "${CPACK_PACKAGE_FILE_NAME}" "."
|
||||
RESULT_VARIABLE _result
|
||||
OUTPUT_VARIABLE _res_output
|
||||
ERROR_VARIABLE _res_error
|
||||
WORKING_DIRECTORY ${CPACK_TOPLEVEL_DIRECTORY}
|
||||
)
|
||||
|
||||
if(${_result})
|
||||
message("Result '${_result}'")
|
||||
message("Output '${_res_output}'")
|
||||
message("Error '${_res_error}'")
|
||||
else(${_result})
|
||||
message("CPack: Package ${OPKG_FILE_NAME}.ipk generated.")
|
||||
set(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}")
|
||||
file(RENAME ${CPACK_TOPLEVEL_DIRECTORY}/${OPKG_FILE_NAME}.ipk ${CPACK_BINARY_DIR}/${OPKG_FILE_NAME}.ipk)
|
||||
endif(${_result})
|
||||
endif( ${OPKG_CMD} STREQUAL "OPKG_CMD-NOTFOUND" )
|
@@ -14,6 +14,8 @@
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the New BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
if (LIBFTD2XX_LIBRARIES AND LIBFTD2XX_INCLUDE_DIRS)
|
||||
# in cache already
|
||||
@@ -67,6 +69,9 @@ else (LIBFTD2XX_LIBRARIES AND LIBFTD2XX_INCLUDE_DIRS)
|
||||
endif (libftd2xx_FIND_REQUIRED)
|
||||
endif (LIBFTD2XX_FOUND)
|
||||
|
||||
find_package_handle_standard_args(Ftd2xx
|
||||
REQUIRED_VARS LIBFTD2XX_INCLUDE_DIRS)
|
||||
|
||||
# show the LIBFTD2XX_INCLUDE_DIRS and LIBFTD2XX_LIBRARIES variables only in the advanced view
|
||||
mark_as_advanced(LIBFTD2XX_INCLUDE_DIRS LIBFTD2XX_LIBRARIES)
|
||||
|
||||
|
@@ -15,6 +15,8 @@
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the New BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
if (LIBFT4222_LIBRARIES AND LIBFT4222_INCLUDE_DIRS)
|
||||
# in cache already
|
||||
@@ -68,6 +70,9 @@ else (LIBFT4222_LIBRARIES AND LIBFT4222_INCLUDE_DIRS)
|
||||
endif (LIBFT4222_FIND_REQUIRED)
|
||||
endif (LIBFT4222_FOUND)
|
||||
|
||||
find_package_handle_standard_args(Ftd4222
|
||||
REQUIRED_VARS LIBFT4222_INCLUDE_DIRS LIBFT4222_LIBRARIES)
|
||||
|
||||
# show the LIBFT4222_INCLUDE_DIRS and LIBFT4222_LIBRARIES variables only in the advanced view
|
||||
mark_as_advanced(LIBFT4222_INCLUDE_DIRS LIBFT4222_LIBRARIES)
|
||||
|
||||
|
@@ -1,3 +1,6 @@
|
||||
# Copyright (c) 2016 Intel Corporation
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
# JSON-C_FOUND - true if library and headers were found
|
||||
# JSON-C_INCLUDE_DIRS - include directories
|
||||
# JSON-C_LIBRARIES - library directories
|
||||
|
@@ -1,3 +1,6 @@
|
||||
# Copyright (c) 2015 Intel Corporation
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
# Macro to add directory to NODEJS_INCLUDE_DIRS if it exists and is not /usr/include
|
||||
macro(add_include_dir dir)
|
||||
if (IS_DIRECTORY ${dir} AND NOT ${dir} STREQUAL "/usr/include")
|
||||
@@ -5,13 +8,11 @@
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
|
||||
find_program (NODEJS_EXECUTABLE NAMES node nodejs
|
||||
HINTS
|
||||
$ENV{NODE_DIR}
|
||||
PATH_SUFFIXES bin
|
||||
DOC "Node.js interpreter"
|
||||
)
|
||||
DOC "Node.js interpreter")
|
||||
|
||||
include (FindPackageHandleStandardArgs)
|
||||
|
||||
@@ -23,16 +24,22 @@ if (UV_ROOT_DIR)
|
||||
endif()
|
||||
|
||||
# Now look for node. Flag an error if not found
|
||||
find_path (NODE_ROOT_DIR "include/node/node.h" "include/src/node.h" "src/node.h"
|
||||
PATHS /usr/include/nodejs /usr/local/include/nodejs /usr/local/include)
|
||||
find_path (NODE_ROOT_DIR
|
||||
NAMES node.h src/node.h
|
||||
PATH_SUFFIXES node node4 node5 node6 node7 node8 nodejs
|
||||
PATHS /usr/include /usr/local/include)
|
||||
|
||||
message(STATUS "INFO - NODE_ROOT_DIR is ${NODE_ROOT_DIR}")
|
||||
|
||||
if (NODE_ROOT_DIR)
|
||||
add_include_dir(${NODE_ROOT_DIR}/include/src)
|
||||
add_include_dir(${NODE_ROOT_DIR}/src)
|
||||
add_include_dir(${NODE_ROOT_DIR}/include/node)
|
||||
add_include_dir(${NODE_ROOT_DIR}/include/deps/v8/include)
|
||||
add_include_dir(${NODE_ROOT_DIR})
|
||||
add_include_dir(${NODE_ROOT_DIR}/deps/uv/include)
|
||||
add_include_dir(${NODE_ROOT_DIR}/deps/v8/include)
|
||||
add_include_dir(${NODE_ROOT_DIR}/include/deps/uv/include)
|
||||
add_include_dir(${NODE_ROOT_DIR}/deps/uv/include)
|
||||
add_include_dir(${NODE_ROOT_DIR}/include/deps/v8/include)
|
||||
add_include_dir(${NODE_ROOT_DIR}/include/node)
|
||||
add_include_dir(${NODE_ROOT_DIR}/include/src)
|
||||
add_include_dir(${NODE_ROOT_DIR}/src)
|
||||
else()
|
||||
unset(NODEJS_INCLUDE_DIRS)
|
||||
message(ERROR " - node.h not found")
|
||||
@@ -52,11 +59,6 @@ if (NOT UV_ROOT_DIR)
|
||||
message(ERROR " - uv.h not found")
|
||||
endif()
|
||||
|
||||
find_package_handle_standard_args (Nodejs DEFAULT_MSG
|
||||
NODEJS_EXECUTABLE
|
||||
NODEJS_INCLUDE_DIRS
|
||||
)
|
||||
|
||||
if (NODEJS_EXECUTABLE)
|
||||
execute_process(COMMAND ${NODEJS_EXECUTABLE} --version
|
||||
OUTPUT_VARIABLE _VERSION
|
||||
@@ -86,12 +88,15 @@ if (NODEJS_EXECUTABLE)
|
||||
set (V8_VERSION_MINOR"14")
|
||||
set (V8_VERSION_PATCH "5")
|
||||
set (V8_VERSION_STRING "3.28.72")
|
||||
message ("defaulted to node 0.10.30")
|
||||
message (STATUS "defaulted to node 0.10.30")
|
||||
endif ()
|
||||
string (REGEX REPLACE "\n" "" NODE_VERSION_STRING ${NODE_VERSION_STRING})
|
||||
string (REGEX REPLACE "\n" "" V8_VERSION_STRING ${V8_VERSION_STRING})
|
||||
message ("INFO - Node version is " ${NODE_VERSION_STRING})
|
||||
message ("INFO - Node using v8 " ${V8_VERSION_STRING})
|
||||
mark_as_advanced (NODEJS_EXECUTABLE)
|
||||
endif ()
|
||||
|
||||
mark_as_advanced (NODEJS_EXECUTABLE)
|
||||
|
||||
find_package_handle_standard_args (Nodejs
|
||||
REQUIRED_VARS NODEJS_EXECUTABLE NODEJS_INCLUDE_DIRS
|
||||
VERSION_VAR NODE_VERSION_STRING)
|
||||
message(STATUS "Found v8: ${V8_ROOT_DIR}/v8.h (found version \"${V8_VERSION_STRING}\")")
|
||||
endif ()
|
||||
|
@@ -1,3 +1,6 @@
|
||||
# Copyright (c) 2014 Intel Corporation
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
find_program (SPHINX_EXECUTABLE NAMES sphinx-build
|
||||
HINTS
|
||||
$ENV{SPHINX_DIR}
|
||||
|
@@ -1,3 +1,6 @@
|
||||
# Copyright (c) 2016 Intel Corporation
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
# UDEV_FOUND - true if library and headers were found
|
||||
# UDEV_INCLUDE_DIRS - include directories
|
||||
# UDEV_LIBRARIES - library directories
|
||||
|
@@ -1,3 +1,6 @@
|
||||
# Copyright (c) 2015 Intel Corporation
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
find_program (YUIDOC_EXECUTABLE NAMES yuidoc
|
||||
HINTS $ENV{YUIDOC_DIR}
|
||||
PATHS usr usr/local
|
||||
|
@@ -29,6 +29,8 @@
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE_1_0.txt or copy at
|
||||
# http://www.boost.org/LICENSE_1_0.txt)
|
||||
#
|
||||
# SPDX-License-Identifier: BSL-1.0
|
||||
|
||||
if(__get_git_revision_description)
|
||||
return()
|
||||
|
@@ -12,6 +12,8 @@
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE_1_0.txt or copy at
|
||||
# http://www.boost.org/LICENSE_1_0.txt)
|
||||
#
|
||||
# SPDX-License-Identifier: BSL-1.0
|
||||
|
||||
set(HEAD_HASH)
|
||||
|
||||
|
@@ -1,504 +0,0 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
|
||||
|
@@ -1,3 +1,6 @@
|
||||
# From OpenCV Project
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
# Find specified Python version
|
||||
# Arguments:
|
||||
# preferred_version (value): Version to check for first
|
||||
|
@@ -1,147 +0,0 @@
|
||||
# Based on the Qt 5 processor detection code, so should be very accurate
|
||||
# https://qt.gitorious.org/qt/qtbase/blobs/master/src/corelib/global/qprocessordetection.h
|
||||
# Currently handles arm (v5, v6, v7), x86 (32/64), ia64, and ppc (32/64)
|
||||
|
||||
# This file is under the terms of the GNU Lesser General Public License version
|
||||
# 2.1 as published by the Free Software Foundation and appearing in the file
|
||||
# LICENSE.LGPL included in the packaging of this file. Please review the
|
||||
# following information to ensure the GNU Lesser General Public License version
|
||||
# 2.1 requirements will be met:
|
||||
# http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
|
||||
# Regarding POWER/PowerPC, just as is noted in the Qt source,
|
||||
# "There are many more known variants/revisions that we do not handle/detect."
|
||||
|
||||
set(archdetect_c_code "
|
||||
#if defined(__aarch64__)
|
||||
#error cmake_ARCH armv8
|
||||
#elif defined(__arm__) || defined(__TARGET_ARCH_ARM)
|
||||
#if defined(__ARM_ARCH_7__) \\
|
||||
|| defined(__ARM_ARCH_7A__) \\
|
||||
|| defined(__ARM_ARCH_7R__) \\
|
||||
|| defined(__ARM_ARCH_7M__) \\
|
||||
|| (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 7)
|
||||
#error cmake_ARCH armv7
|
||||
#elif defined(__ARM_ARCH_6__) \\
|
||||
|| defined(__ARM_ARCH_6J__) \\
|
||||
|| defined(__ARM_ARCH_6T2__) \\
|
||||
|| defined(__ARM_ARCH_6Z__) \\
|
||||
|| defined(__ARM_ARCH_6K__) \\
|
||||
|| defined(__ARM_ARCH_6ZK__) \\
|
||||
|| defined(__ARM_ARCH_6M__) \\
|
||||
|| (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 6)
|
||||
#error cmake_ARCH armv6
|
||||
#elif defined(__ARM_ARCH_5TEJ__) \\
|
||||
|| (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 5)
|
||||
#error cmake_ARCH armv5
|
||||
#else
|
||||
#error cmake_ARCH arm
|
||||
#endif
|
||||
#elif defined(__i586) || defined(__i586__)
|
||||
#error cmake_ARCH i586
|
||||
#elif defined(__i386) || defined(__i386__) || defined(_M_IX86)
|
||||
#error cmake_ARCH i386
|
||||
#elif defined(__x86_64) || defined(__x86_64__) || defined(__amd64) || defined(_M_X64)
|
||||
#error cmake_ARCH x86_64
|
||||
#elif defined(__ia64) || defined(__ia64__) || defined(_M_IA64)
|
||||
#error cmake_ARCH ia64
|
||||
#elif defined(__mips) || defined(__mips__) || defined(_M_MRX000)
|
||||
#error cmake_ARCH mips
|
||||
#elif defined(__ppc__) || defined(__ppc) || defined(__powerpc__) \\
|
||||
|| defined(_ARCH_COM) || defined(_ARCH_PWR) || defined(_ARCH_PPC) \\
|
||||
|| defined(_M_MPPC) || defined(_M_PPC)
|
||||
#if defined(__ppc64__) || defined(__powerpc64__) || defined(__64BIT__)
|
||||
#error cmake_ARCH ppc64
|
||||
#else
|
||||
#error cmake_ARCH ppc
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#error cmake_ARCH unknown
|
||||
")
|
||||
|
||||
# Set ppc_support to TRUE before including this file or ppc and ppc64
|
||||
# will be treated as invalid architectures since they are no longer supported by Apple
|
||||
|
||||
function(target_architecture output_var)
|
||||
if(APPLE AND CMAKE_OSX_ARCHITECTURES)
|
||||
# On OS X we use CMAKE_OSX_ARCHITECTURES *if* it was set
|
||||
# First let's normalize the order of the values
|
||||
|
||||
# Note that it's not possible to compile PowerPC applications if you are using
|
||||
# the OS X SDK version 10.6 or later - you'll need 10.4/10.5 for that, so we
|
||||
# disable it by default
|
||||
# See this page for more information:
|
||||
# http://stackoverflow.com/questions/5333490/how-can-we-restore-ppc-ppc64-as-well-as-full-10-4-10-5-sdk-support-to-xcode-4
|
||||
|
||||
# Architecture defaults to i386 or ppc on OS X 10.5 and earlier, depending on the CPU type detected at runtime.
|
||||
# On OS X 10.6+ the default is x86_64 if the CPU supports it, i386 otherwise.
|
||||
|
||||
foreach(osx_arch ${CMAKE_OSX_ARCHITECTURES})
|
||||
if("${osx_arch}" STREQUAL "ppc" AND ppc_support)
|
||||
set(osx_arch_ppc TRUE)
|
||||
elseif("${osx_arch}" STREQUAL "i386")
|
||||
set(osx_arch_i386 TRUE)
|
||||
elseif("${osx_arch}" STREQUAL "x86_64")
|
||||
set(osx_arch_x86_64 TRUE)
|
||||
elseif("${osx_arch}" STREQUAL "ppc64" AND ppc_support)
|
||||
set(osx_arch_ppc64 TRUE)
|
||||
else()
|
||||
message(FATAL_ERROR "Invalid OS X arch name: ${osx_arch}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# Now add all the architectures in our normalized order
|
||||
if(osx_arch_ppc)
|
||||
list(APPEND ARCH ppc)
|
||||
endif()
|
||||
|
||||
if(osx_arch_i386)
|
||||
list(APPEND ARCH i386)
|
||||
endif()
|
||||
|
||||
if(osx_arch_x86_64)
|
||||
list(APPEND ARCH x86_64)
|
||||
endif()
|
||||
|
||||
if(osx_arch_ppc64)
|
||||
list(APPEND ARCH ppc64)
|
||||
endif()
|
||||
else()
|
||||
file(WRITE "${CMAKE_BINARY_DIR}/arch.c" "${archdetect_c_code}")
|
||||
|
||||
enable_language(C)
|
||||
|
||||
# Detect the architecture in a rather creative way...
|
||||
# This compiles a small C program which is a series of ifdefs that selects a
|
||||
# particular #error preprocessor directive whose message string contains the
|
||||
# target architecture. The program will always fail to compile (both because
|
||||
# file is not a valid C program, and obviously because of the presence of the
|
||||
# #error preprocessor directives... but by exploiting the preprocessor in this
|
||||
# way, we can detect the correct target architecture even when cross-compiling,
|
||||
# since the program itself never needs to be run (only the compiler/preprocessor)
|
||||
try_run(
|
||||
run_result_unused
|
||||
compile_result_unused
|
||||
"${CMAKE_BINARY_DIR}"
|
||||
"${CMAKE_BINARY_DIR}/arch.c"
|
||||
COMPILE_OUTPUT_VARIABLE ARCH
|
||||
CMAKE_FLAGS CMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}
|
||||
)
|
||||
|
||||
# Parse the architecture name from the compiler output
|
||||
string(REGEX MATCH "cmake_ARCH ([a-zA-Z0-9_]+)" ARCH "${ARCH}")
|
||||
|
||||
# Get rid of the value marker leaving just the architecture name
|
||||
string(REPLACE "cmake_ARCH " "" ARCH "${ARCH}")
|
||||
|
||||
# If we are compiling with an unknown architecture this variable should
|
||||
# already be set to "unknown" but in the case that it's empty (i.e. due
|
||||
# to a typo in the code), then set it to unknown
|
||||
if (NOT ARCH)
|
||||
set(ARCH unknown)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(${output_var} "${ARCH}" PARENT_SCOPE)
|
||||
endfunction()
|
@@ -1,3 +1,4 @@
|
||||
// Auto-Generated file
|
||||
#include "version.h"
|
||||
|
||||
const char* gVERSION = "@VERSION@";
|
||||
|
@@ -21,8 +21,6 @@ services:
|
||||
- JSONPLAT=${JSONPLAT:-OFF}
|
||||
- IMRAA=${IMRAA:-OFF}
|
||||
- FTDI4222=${FTDI4222:-OFF}
|
||||
- IPK=${IPK:-OFF}
|
||||
- RPM=${RPM:-OFF}
|
||||
- ENABLEEXAMPLES=${ENABLEEXAMPLES:-OFF}
|
||||
- INSTALLTOOLS=${INSTALLTOOLS:-ON}
|
||||
- CC=${CC:-clang-3.8}
|
||||
@@ -35,6 +33,14 @@ services:
|
||||
extends: base
|
||||
image: inteliotdevkit/mraa-all
|
||||
|
||||
minimal:
|
||||
extends: base
|
||||
environment:
|
||||
- BUILDSWIG=OFF
|
||||
- INSTALLTOOLS=OFF
|
||||
- JSONPLAT=OFF
|
||||
command: bash -c "./scripts/run-cmake.sh && cd build && make && ctest -R unit --output-on-failure"
|
||||
|
||||
doc:
|
||||
extends: all
|
||||
environment:
|
||||
@@ -102,36 +108,23 @@ services:
|
||||
ftdi4442:
|
||||
extends: all
|
||||
environment:
|
||||
- USBPLAT=ON
|
||||
- FTDI4222=ON
|
||||
command: bash -c "./scripts/run-cmake.sh && make -Cbuild"
|
||||
|
||||
ipk:
|
||||
extends: all
|
||||
environment:
|
||||
- IPK=ON
|
||||
- ENABLEEXAMPLES=ON
|
||||
command: bash -c "./scripts/run-cmake.sh && make -Cbuild package"
|
||||
|
||||
rpm:
|
||||
extends: all
|
||||
environment:
|
||||
- RPM=ON
|
||||
- ENABLEEXAMPLES=ON
|
||||
command: bash -c "./scripts/run-cmake.sh && make -Cbuild package"
|
||||
|
||||
python2:
|
||||
extends: base
|
||||
image: inteliotdevkit/mraa-python
|
||||
environment:
|
||||
- BUILDSWIG=ON
|
||||
- BUILDSWIGPYTHON=ON
|
||||
command: bash -c "./scripts/run-cmake.sh && cd build && make _python2-mraa && ctest --output-on-failure"
|
||||
command: bash -c "./scripts/run-cmake.sh && cd build && make _python2-mraa test_unit_all && ctest --output-on-failure"
|
||||
|
||||
python3:
|
||||
extends: python2
|
||||
environment:
|
||||
- USEPYTHON3TESTS=ON
|
||||
command: bash -c "./scripts/run-cmake.sh && cd build && make _python3-mraa && ctest --output-on-failure"
|
||||
command: bash -c "./scripts/run-cmake.sh && cd build && make _python3-mraa test_unit_all && ctest --output-on-failure"
|
||||
|
||||
java:
|
||||
extends: base
|
||||
@@ -139,7 +132,7 @@ services:
|
||||
environment:
|
||||
- BUILDSWIG=ON
|
||||
- BUILDSWIGJAVA=ON
|
||||
command: bash -c "./scripts/run-cmake.sh && cd build && make mraajava && ctest --output-on-failure"
|
||||
command: bash -c "./scripts/run-cmake.sh && cd build && make mraajava test_unit_all && ctest --output-on-failure"
|
||||
|
||||
android:
|
||||
extends: java
|
||||
|
@@ -8,9 +8,13 @@ Standardized expansion buses for peripheral I/O have led to a wide range of comp
|
||||
Board Support
|
||||
-------------
|
||||
|
||||
- [DragonBoard 410c](http://www.96boards.org/product/dragonboard410c/)
|
||||
- [HiKey](http://www.96boards.org/product/hikey/)
|
||||
- [Bubblegum-96](http://www.96boards.org/product/bubblegum-96/)
|
||||
- [DragonBoard 410c](http://www.96boards.org/product/dragonboard410c/)
|
||||
- [DragonBoard 820c](http://www.96boards.org/product/dragonboard820c/)
|
||||
- [HiKey](http://www.96boards.org/product/hikey/)
|
||||
- [HiKey960](http://www.96boards.org/product/hikey960/)
|
||||
- [Rock960](http://www.96boards.org/product/rock960/)
|
||||
- [Ultra96](https://www.96boards.org/product/ultra96/)
|
||||
|
||||
Interface notes
|
||||
---------------
|
||||
|
38
docs/adlink_ipi_arm.md
Executable file
38
docs/adlink_ipi_arm.md
Executable file
@@ -0,0 +1,38 @@
|
||||
ADLINK IPi-SMARC ARM
|
||||
============
|
||||
|
||||
Based on Rockchip PX30 with Quad-core ARM Cortex-A35 CPU
|
||||
|
||||
Up to 4GB DDR3L at 1066/1333 MHz, 32 GB eMMC
|
||||
|
||||
4x USB 2.0, 1x USB 2.0 OTG port, 2x 10/100M Ethernet Ports, DSI to HDMI converter board, RTC and a 40-pin I/O header
|
||||
|
||||
|
||||
|
||||
|
||||
## Pin Mapping
|
||||
|
||||
| Linux GPIO (/sys/class/gpio) | Function | MRAA number | MRAA number | Function | Linux GPIO (/sys/class/gpio) |
|
||||
| :--------------------------: | :-------: | :---------: | :---------: | :-------: | :--------------------------: |
|
||||
| | 3V3 | 1 | 2 | 5V | |
|
||||
| | I2C_0 SDA | 3 | 4 | 5V | |
|
||||
| | I2C_0 SCL | 5 | 6 | GND | |
|
||||
| 116 | GPIO | 7 | 8 | UART TX | |
|
||||
| | GND | 9 | 10 | UART RX | |
|
||||
| 118 | GPIO | 11 | 12 | GPIO | 117 |
|
||||
| 107 | GPIO | 13 | 14 | GND | |
|
||||
| 104 | GPIO | 15 | 16 | GPIO | 109 |
|
||||
| | 3V3 | 17 | 18 | GPIO | 121 |
|
||||
| | SPI MOSI | 19 | 20 | GND | |
|
||||
| | SPI MISO | 21 | 22 | GPIO | 122 |
|
||||
| | SPI SCLK | 23 | 24 | SPI CS0 | |
|
||||
| | GND | 25 | 26 | N/A | |
|
||||
| | I2C_1 SDA | 27 | 28 | I2C_1 SCL | |
|
||||
| 496 | GPIO/PWM | 29 | 30 | GND | |
|
||||
| 497 | GPIO/PWM | 31 | 32 | GPIO/PWM | 498 |
|
||||
| 499 | GPIO/PWM | 33 | 34 | GND | |
|
||||
| 500 | GPIO/PWM | 35 | 36 | GPIO/PWM | 501 |
|
||||
| 502 | GPIO/PWM | 37 | 38 | GPIO/PWM | 503 |
|
||||
| | GND | 39 | 40 | GPIO/PWM | 504 |
|
||||
|
||||
**Note**: N/A: Funciton is not supported
|
56
docs/adlink_ipi_x86.md
Executable file
56
docs/adlink_ipi_x86.md
Executable file
@@ -0,0 +1,56 @@
|
||||
ADLINK IPi-SMARC x86
|
||||
============
|
||||
|
||||
* ADLINK IPi-SMARC x86
|
||||
|
||||
Based on Intel(R) Atom® E3900 Series(codename: Apollo Lake) with Movidius chip
|
||||
|
||||
up to 8GB RAM, 64GB eMMC
|
||||
|
||||
2x USB 2.0, 2x USB 3.0, 1x USB 2.0 OTG port, 1x Gigabit Ethernet port, HDMI display, RTC and a 40-pin I/O header
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Pin Mapping
|
||||
|
||||
|
||||
| Linux GPIO (/sys/class/gpio) | Function | MRAA number | MRAA number | Function | Linux GPIO (/sys/class/gpio) |
|
||||
| :--------------------------: | :-------: | :---------: | :---------: | :-------: | :--------------------------: |
|
||||
| | 3V3 | 1 | 2 | 5V | |
|
||||
| | I2C_0 SDA | 3 | 4 | 5V | |
|
||||
| | I2C_0 SCL | 5 | 6 | GND | |
|
||||
| 255 | GPIO | 7 | 8 | UART TX | |
|
||||
| | GND | 9 | 10 | UART RX | |
|
||||
| 256 | GPIO | 11 | 12 | GPIO | 257 |
|
||||
| 258 | GPIO | 13 | 14 | GND | |
|
||||
| 259 | GPIO | 15 | 16 | GPIO | 260 |
|
||||
| | 3V3 | 17 | 18 | GPIO | 261 |
|
||||
| | n/a | 19 | 20 | GND | |
|
||||
| | n/a | 21 | 22 | GPIO | 262 |
|
||||
| | n/a | 23 | 24 | n/a | |
|
||||
| | GND | 25 | 26 | n/a | |
|
||||
| | I2C_1 SDA | 27 | 28 | I2C_1 SCL | |
|
||||
| 234 | GPIO/PWM | 29 | 30 | GND | |
|
||||
| 235 | GPIO/PWM | 31 | 32 | GPIO/PWM | 236 |
|
||||
| 237 | GPIO/PWM | 33 | 34 | GND | |
|
||||
| 238 | GPIO/PWM | 35 | 36 | GPIO/PWM | 239 |
|
||||
| 240 | GPIO/PWM | 37 | 38 | GPIO/PWM | 241 |
|
||||
| | GND | 39 | 40 | GPIO/PWM | 242 |
|
||||
|
||||
**Note:**
|
||||
|
||||
* Before installing MRAA on Ubuntu 18.04, please follow up the below instructions to insert the following drivers first and configure I2C devices:
|
||||
|
||||
```
|
||||
$ sudo modprobe i2c_i801
|
||||
$ sudo modprobe gpio-pca953x
|
||||
$ echo "pca9535 0x20" > /sys/bus/i2c/devices/i2c-13/new_device
|
||||
$ echo "sx1509q 0x3e" > /sys/bus/i2c/devices/i2c-1/new_device
|
||||
```
|
||||
|
||||
* Not support SPI interface
|
||||
|
||||
|
||||
|
@@ -10,7 +10,7 @@ For building imraa check @ref buildingimraa page.
|
||||
|
||||
Not all these are required but if you're unsure of what you're doing this is
|
||||
what you'll need:
|
||||
* [SWIG](http://swig.org) 3.0.5+
|
||||
* [SWIG](http://swig.org) 3.0.5+ (3.0.12 recommended, on Xenial this can be installed via 3rd party PPAs)
|
||||
* [git](http://git-scm.com)
|
||||
* [python](http://python.org) 2.7 or 3.4+ (you'll need not just the interpreter but python-dev)
|
||||
* [node.js](http://nodejs.org) 4.x recommended (you'll need not just the interpreter but nodejs-dev)
|
||||
@@ -23,6 +23,13 @@ For Debian-like distros the below command installs the basic set:
|
||||
sudo apt-get install git build-essential swig3.0 python-dev nodejs-dev cmake libjson-c-dev
|
||||
```
|
||||
|
||||
Adjust as needed, for instance Python 3 builds will require `python3-dev`.
|
||||
On Ubuntu Bionic you'll need to downgrade node.js (see [nodesource](https://github.com/nodesource/distributions)
|
||||
for some handy install scripts) or patch SWIG. This is explained more in the
|
||||
advanced dependencies list below.
|
||||
|
||||
### Documentation dependencies
|
||||
|
||||
To build the documentation you'll also need:
|
||||
* [Doxygen](http://www.stack.nl/~dimitri/doxygen/) 1.8.9.1+
|
||||
* [Graphviz](http://graphviz.org/) 2+ (For Doxygen graph generation)
|
||||
@@ -111,15 +118,44 @@ CC flags to the CC env var
|
||||
|
||||
Sometimes it's nice to build a static library, on Linux systems just set
|
||||
`-DBUILD_SHARED_LIBS=OFF`
|
||||
Note that for static builds the python bindings will not build as they would
|
||||
require a static python etc... You can try to link mraa statically to the
|
||||
python binding module by adding -fPIC with `-DCMAKE_C_FLAGS=-fPIC`. You can
|
||||
also use the node.js gyp build system to get node.js static bindings.
|
||||
|
||||
## Dependencies continued
|
||||
|
||||
You'll need at least SWIG version 3.0.2 and we recommend 3.0.5 to build the
|
||||
You'll need at least SWIG version 3.0.2 and we recommend 3.0.12 to build the
|
||||
JavaScript & Python modules. If your version of SWIG is older than this then
|
||||
please see above for disabling `SWIGNODE`. Otherwise you will get a weird build
|
||||
failure when building the JavaScript module. The Python module builds with SWIG
|
||||
2.x but we don't test it.
|
||||
|
||||
### JavaScript bindings for node.js 7.0.0+
|
||||
|
||||
Building the JavaScript bindings using the latest versions of node.js does
|
||||
involve additional steps due to our dependency on SWIG. In short, a patch is
|
||||
needed to compile correctly with node.js 7.0.0 or newer. We found the install
|
||||
scripts from nodesource to be very handy for switching versions and they
|
||||
support all versions of Ubuntu.
|
||||
|
||||
The patch applies cleanly on SWIG 3.0.12, available by default on Ubuntu Bionic
|
||||
and through 3rd party PPAs for older distributions. For example, with Xenial or
|
||||
Zesty you could use [this](https://launchpad.net/~timsc/+archive/ubuntu/swig-3.0.12).
|
||||
|
||||
To patch SWIG on Ubuntu (assumes you start in the home folder):
|
||||
|
||||
```
|
||||
wget https://git.yoctoproject.org/cgit.cgi/poky/plain/meta/recipes-devtools/swig/swig/0001-Add-Node-7.x-aka-V8-5.2-support.patch
|
||||
cd /usr/share/swig3.0
|
||||
sudo patch -p2 <~/0001-Add-Node-7.x-aka-V8-5.2-support.patch
|
||||
```
|
||||
|
||||
Keep in mind that Ubuntu Bionic ships with node.js version 8. You'll need to
|
||||
either use the patch or downgrade node.js.
|
||||
|
||||
### Build version
|
||||
|
||||
During the build, we'll assume you're building from git, note that if you
|
||||
compile with `git` installed your version of mraa will be versioned with `git
|
||||
describe --tag` to make it easy for identification. You can easily modify
|
||||
@@ -139,18 +175,6 @@ cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchains/oe-sdk_cross.cmake ..
|
||||
make
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
## Using Coverity
|
||||
|
||||
This is the procedure to submit a build to Coverity. You'll need to install
|
||||
`coverity-submit` for your OS.
|
||||
|
||||
~~~~~~~~~~~~~{.sh}
|
||||
mkdir covbuild/ && cd covbuild
|
||||
cmake -DBUILDDOC=OFF -DBUILDSWIG=OFF ..
|
||||
cov-build --dir cov-int make
|
||||
tar caf mraa.tar.bz2 cov-int
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
## Building Java bindings
|
||||
|
||||
Have JAVA_HOME set to JDK install directory. Most distributions set this from `/etc/profile.d/`
|
||||
@@ -172,23 +196,6 @@ java -cp $DIR_WHERE_YOU_INSTALLED_MRAA/mraa.jar:. Example
|
||||
|
||||
If you want to add or improve Java bindings for mraa, please follow the <a href="https://github.com/intel-iot-devkit/upm/blob/master/docs/creating_java_bindings.md">Creating Java Bindings Guide</a>.
|
||||
|
||||
## Building an IPK/RPM package using `cpack`
|
||||
|
||||
You can get `cpack` to generate an IPK or RPM package fairly easily if you have
|
||||
the correct packaging tools
|
||||
|
||||
~~~~~~~~~~~~~{.sh}
|
||||
cmake -DIPK=ON -DCMAKE_INSTALL_PREFIX=/usr ..
|
||||
make package
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
To use RPM simply enable the RPM option. You'll need `rpmbuild` installed on your
|
||||
build machine.
|
||||
|
||||
~~~~~~~~~~~~~{.sh}
|
||||
cmake -DRPM=ON -DCMAKE_INSTALL_PREFIX=/usr ..
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
## Building for the Android Things Peripheralmanager Client
|
||||
|
||||
Requirements:
|
||||
|
@@ -5,6 +5,32 @@ This changelog is meant as a quick & rough guide to what has changed between
|
||||
versions. The API is now fairly stable but when new calls/features are added
|
||||
they are listed here. Anything pre 0.2.x is ignored.
|
||||
|
||||
**2.1.0**
|
||||
* New platforms UP Xtreme, IPi SMARC, ROCK PI 4, Raspberry Pi 4, Ultra96
|
||||
* Added support for chardev GPIO devices on Rock960
|
||||
* Introduced APIs to initialize GPIOs by name
|
||||
* Multiple fixes to address static tool scans and user submitted bug reports
|
||||
* Revised documentation to reflect project transfer to the Eclipse Foundation
|
||||
* Updated installation instructions for multiple distribution channels
|
||||
|
||||
**2.0.0**
|
||||
* New platforms IEI Tank, Ultra-96, Rock960, Hikey960, Dragonboard 820c
|
||||
* Added support for chardev GPIO devices with implementation on several boards
|
||||
* Added string based I/O initialization for simpler integration with other frameworks
|
||||
* Added GTest support for unit testing
|
||||
* Extended named LED device APIs allowing them to be listed during board definition
|
||||
* Removed packaging and CI for obsolete devkits
|
||||
* Multiple bug fixes and cmake improvements
|
||||
|
||||
**1.9.0**
|
||||
* Added support for RPi Zero W
|
||||
* Added support for MIPS based Omega2 and Linkit Smart 7688
|
||||
* New APIs for sysfs onboard LED control using the gpio-leds driver
|
||||
* Restructured and cleaned-up examples
|
||||
* Improved documentation generation and CI integration
|
||||
* Static analysis fixes, added SonarQube badge
|
||||
* Enhanced Node.js detection on some Linux distros (OpenSUSE)
|
||||
|
||||
**1.8.0**
|
||||
* Added Up2 support & grovePi subplatform support
|
||||
* Various improvements on 96board, rpi, beaglebone & Up boards
|
||||
|
40
docs/iei-tank.md
Normal file
40
docs/iei-tank.md
Normal file
@@ -0,0 +1,40 @@
|
||||
IEI TANK AIoT Dev. Kit {#iei-tank}
|
||||
================================
|
||||
TANK AIoT Dev. Kit features rich I/O and dual PCIe by 16 slots with by 8 signal
|
||||
for add-on card installation such as PoE (IPCEI-4POE) card or acceleration card
|
||||
(Mustang-F100-A10 & Mustang-V100-RX8) to enhance function and performance for
|
||||
various applications.
|
||||
|
||||
For the full specifications please visit the product page:
|
||||
|
||||
https://www.ieiworld.com/tank-aiot-development-kit
|
||||
|
||||
Interface notes
|
||||
-----------------------
|
||||
The MRAA platform file was developed using an IEI TANK-870-Q170 and may not
|
||||
be compatible with other TANK systems. 6 serial ports and 8 digital pins are
|
||||
available and can be controlled using MRAA on this system.
|
||||
|
||||
**UART**
|
||||
* 4 x RS-232 (2 x RJ-45, 2 x DB-9 w/2.5KV isolation protection)
|
||||
* 2 x RS-232/422/485 (DB-9)
|
||||
|
||||
**GPIO**
|
||||
* 8-bit digital I/O , 4-bit input / 4-bit output (DB9)
|
||||
|
||||
Pin Mapping
|
||||
--------------------
|
||||
The GPIO numbering in MRAA is explained in the table below. To use the pins
|
||||
the *gpio_f7188x* Linux kernel module must be available and loaded.
|
||||
|
||||
| MRAA Pin | DB9 Pin | Sysfs GPIO | Function |
|
||||
|----------|--------------|------------|-----------------|
|
||||
| 0 | 1 | 4 | DIN0 |
|
||||
| 1 | 2 | 0 | DOUT0 |
|
||||
| 2 | 3 | 11 | DIN1 |
|
||||
| 3 | 4 | 1 | DOUT1 |
|
||||
| 4 | 5 | 12 | DIN2 |
|
||||
| 5 | 6 | 2 | DOUT2 |
|
||||
| 6 | 7 | 13 | DIN3 |
|
||||
| 7 | 8 | 3 | DOUT3 |
|
||||
| 8 | 9 | | +5V |
|
@@ -51,6 +51,8 @@ Specific platform information for supported platforms is documented here:
|
||||
- @ref up
|
||||
- @ref joule
|
||||
- @ref ft4222
|
||||
- @ref iei-tank
|
||||
- @ref up-xtreme
|
||||
|
||||
## DEBUGGING
|
||||
|
||||
|
@@ -59,6 +59,8 @@ Specific platform information for supported platforms is documented here:
|
||||
- @ref mock
|
||||
- @ref linkit_7688
|
||||
- @ref omega2
|
||||
- @ref iei-tank
|
||||
- @ref upXtreme
|
||||
|
||||
## DEBUGGING
|
||||
|
||||
@@ -71,6 +73,10 @@ glance at our @ref debugging page too
|
||||
|
||||
More information on compiling is @ref building page.
|
||||
|
||||
## STATIC CODE ANALYSIS
|
||||
|
||||
See @ref static_code_analysis page.
|
||||
|
||||
## CONTRIBUTING
|
||||
|
||||
Please see the @ref contributing page, the @ref internals page may also be of
|
||||
|
@@ -12,21 +12,23 @@ legacy board https://www.minnowboard.org/minnowboard-max
|
||||
|
||||
Supported Firmware
|
||||
------------------
|
||||
mraa has only been tested with 64 bit firmware version 0.73 or later.
|
||||
MRAA has only been tested with 64 bit firmware version 0.73 or later.
|
||||
|
||||
SPI
|
||||
---
|
||||
For SPI support you need to load the low_speed_spidev kernel module and that
|
||||
will create the /dev/spidev0.0 device node. Mraa only knows about this one SPI
|
||||
will create the /dev/spidev0.0 device node. MRAA only knows about this one SPI
|
||||
bus and no other.
|
||||
|
||||
Interface notes
|
||||
---------------
|
||||
The low speed I/O connector supported as per table below. This assumes default
|
||||
BIOS settings, as they are not dynamcially detected If any changes are mode
|
||||
(Device Manager -> System Setup -> South Cluster -> LPSS & CSS) them mraa calls
|
||||
(Device Manager -> System Setup -> South Cluster -> LPSS & CSS) them MRAA calls
|
||||
will not behave as expected.
|
||||
|
||||
The platform is chardev capable on newer kernels.
|
||||
|
||||
Documentation shows i2c on bus #5, ACPI shows it on bus #6, but driver uses
|
||||
bus #7.
|
||||
|
||||
@@ -60,3 +62,14 @@ bus #7.
|
||||
| 26 | 26 | IBL_8254 | 208 | GPIO / I2S MCLK (tb) |
|
||||
|
||||
*(tb) New assignment on the MinnowBoard Turbot
|
||||
** On 3.18+ kernels, sysfs GPIO numbers are computed using:
|
||||
`new_value = old_value | 0x100`
|
||||
|
||||
User LED
|
||||
---------------
|
||||
The MinnowBoard Turbot has one user programmable built-in LED. This is exposed
|
||||
as a GPIO from MRAA.
|
||||
|
||||
| MRAA Number | Physical Pin | Function | Sysfs GPIO | Notes |
|
||||
|-------------|---------------|------------|------------|----------------------|
|
||||
| 27 | N/A | D2_LED | 104 | Active low |
|
||||
|
62
docs/rockpi4.md
Normal file
62
docs/rockpi4.md
Normal file
@@ -0,0 +1,62 @@
|
||||
Rock Pi 4 A/B Single Board Computer {#_rockpi}
|
||||
=============================
|
||||
|
||||
ROCK Pi 4 is a Rockchip RK3399 based SBC(Single Board Computer) by Radxa. It can run android or some Linux distributions. ROCK Pi 4 features a six core ARM processor, 64bit dual channel 3200Mb/s LPDDR4, up to 4K@60 HDMI, MIPI DSI, MIPI CSI, 3.5mm jack with mic, 802.11 ac WIFI, Bluetooth 5.0, USB Port, GbE LAN, 40-pin color expansion header, RTC. Also, ROCK Pi 4 supports USB PD and QC powering.
|
||||
|
||||
ROCK Pi 4 comes in three models, Model A and Model B has 1GB, 2GB or 4GB ram options, Model C has 4GB ram only. For detailed difference of three models, please check Specifications.
|
||||
|
||||
Board Support
|
||||
-------------
|
||||
|
||||
- [ROCK Pi 4](https://wiki.radxa.com/Rockpi4)
|
||||
|
||||
Interface notes
|
||||
---------------
|
||||
|
||||
- **UART**: ttyS0 not usable, use ttyS2 and ttyS4
|
||||
- UART2 is enabled as U-boot and Linux serial console by default. Check Rockpi4/dev/serial-console to use. Check Rockpi4/hardware/devtree_overlays to disable serial console on UART2.
|
||||
- UART2 & UART4 support a wide range of baud rate. It includes but not is not limited to the following baud rates. For instance, 115200bps. 500000bps, 1500000bps and so on.
|
||||
- Function marked with color orange is the default function of this pin.
|
||||
- Except Pins for power supply, all pins are laid out directly to Soc RK3399.
|
||||
- For pin 3, 5, 27, 28, 29 and 31, each pin is connected to the 3.0V supply through a 4.7K pull-up resistor.
|
||||
- Pin 19, 21, 23, 24 are laid out directly to the pins of SPI device on board.
|
||||
- Pin 7 is laid out directly to the pin of MIPI CSI on board.
|
||||
- For I2C-2 and I2C-7
|
||||
- We have do the test using the i2c device e2prom. We need to open the i2c device file, and then do the read or write operation.
|
||||
|
||||
Pin Mapping
|
||||
-----------
|
||||
|
||||
PROCK Pi 4 has a 40-pin expansion header. Each pin is distinguished by color.
|
||||
|
||||
|Additional Function | Primary Function| PIN | PIN | Primary Function | Additional Function |
|
||||
|--------------------|------------------|:------|------:|--------------------|---------------------|
|
||||
| | +3.3V | 1 | 2 | +5.0V | |
|
||||
| | I2C7_SDA | 3 | 4 | +5.0V | |
|
||||
| | I2C7_SCL | 5 | 6 | GND | |
|
||||
| | SPI2_CLK | 7 | 8 | UART2_TXD | |
|
||||
| | GND | 9 | 10 | UART2_RXD | |
|
||||
| | PWM0 | 11 | 12 | I2S1_SCLK | |
|
||||
| | PWM1 | 13 | 14 | GND | |
|
||||
| | SPDIF_TX | 15 | 16 | GPIO4_D2 | |
|
||||
| | +3.3V | 17 | 18 | GPIO4_D4 | |
|
||||
| UART4_TXD | SPI1_TXD | 19 | 20 | GND | |
|
||||
| UART4_RXD | SPI1_RXD | 21 | 22 | GPIO4_D5 | |
|
||||
| | SPI1_CLK | 23 | 24 | SPI1_CSn | |
|
||||
| | GND | 25 | 26 | ADC_IN0 | |
|
||||
| | I2C2_SDA | 27 | 28 | I2C2_CLK | |
|
||||
| I2C6_SCL | SPI2_TXD | 29 | 30 | GND | |
|
||||
| I2C6_SDA | SPI2_RXD | 31 | 32 | SPDIF_TX | UART3_CTSn |
|
||||
| | SPI2_CSn | 33 | 34 | GND | |
|
||||
| | I2S1_LRCK_TX| 35 | 36 | I2S1_LRCK_RX | |
|
||||
| | GPIO4_D6 | 37 | 38 | I2S1_SDI | |
|
||||
| | GND | 39 | 40 | I2S1_SDO | |
|
||||
|
||||
Resources
|
||||
---------
|
||||
|
||||
The following links will take you to additional Rock Pi 4 resources
|
||||
|
||||
- [Armbian for Rock Pi 4](https://www.armbian.com/rock-pi-4/)
|
||||
- [Forums](https://forum.radxa.com/c/rockpi4)
|
||||
- [Github Repo](https://github.com/radxa)
|
93
docs/static_code_analysis.md
Normal file
93
docs/static_code_analysis.md
Normal file
@@ -0,0 +1,93 @@
|
||||
Static code analysis {#static_code_analysis}
|
||||
====================
|
||||
|
||||
We use [SonarQube](https://www.sonarqube.org/) for static code analysis scans.
|
||||
These are automated via Travis, same as our usual builds.
|
||||
|
||||
Automated scans
|
||||
---------------
|
||||
|
||||
We don't use the Travis' plugin for Sonar due to the fact we use Docker
|
||||
and not the bare Travis, and these two are not compatible.
|
||||
|
||||
We have a dedicated `docker-compose` target for scans, `sonar-scan`. Necessary
|
||||
values are passed to Sonar scanner as command-line parameters.
|
||||
|
||||
For the whole config to work, the following one-time configuration steps are necessary:
|
||||
* Create organization and project in SonarQube - done already,
|
||||
https://sonarcloud.io/organizations/mraa-github (key: mraa-github)
|
||||
and https://sonarcloud.io/dashboard?id=mraa-master (key: mraa-master);
|
||||
* Create technical account on GitHub with push permissions for mraa repo.
|
||||
It is used for reporting pull request statuses in the "checks" area.
|
||||
We have `intel-iot-devkit-helperbot` for this, shared with UPM.
|
||||
* Add several environment variables in Travis:
|
||||
* `GITHUB_TOKEN` (secure) - GH OAuth token for the technical user,
|
||||
with `public_repo` privileges only;
|
||||
* `SONAR_TOKEN` (secure) - this one comes from the SonarQube org properties;
|
||||
* `SONAR_ORG`, `SONAR_PROJ_KEY` (may be public) - project and org keys (names)
|
||||
from SonarQube org, see above;
|
||||
|
||||
These scans are executed each time there's an internal pull request (from a branch
|
||||
local to main mraa repo) or a `master` branch push.
|
||||
Upon the former the so called "preview" scan is executed, which doesn't
|
||||
upload anything to SonarQube organization and only reports the result within the PR.
|
||||
Upon `master` branch push a normal scan is executed and results are uploaded to
|
||||
SonarQube.
|
||||
|
||||
When there's a so called "external" pull request (originating somewhere else
|
||||
than mraa's main repo, e.g. from a fork), no scan is done for
|
||||
security reasons, as code within such PR would have access to tokens listed above.
|
||||
|
||||
In view of such setup, it's beneficial to create internal pull requests as much
|
||||
as possible, because you'll catch problems right away - in the preview scan,
|
||||
before PR is merged.
|
||||
|
||||
Manual scans
|
||||
------------
|
||||
|
||||
It's a good practice to run the scan manually before actually submitting a PR.
|
||||
There may also be a need to run the scan manually out-of-cycle, so here's how.
|
||||
|
||||
Just use the command line from [the scanner script](../master/scripts/sonar-scan.sh).
|
||||
See `sonar_cmd_base` variable specifically and just replace various tokens
|
||||
listed there with proper ones. Please also don't forget that you need to run the
|
||||
build wrapper first, so that the scanner knows what to scan.
|
||||
|
||||
The set of commands for the main mraa repo and SonarQube project would look like
|
||||
the below. Note that it will upload results to the SonarQube by default,
|
||||
if you don't want that, setup a throwaway "project" in SonarQube, or create a
|
||||
separate "organization" dedicated to your mraa repo fork:
|
||||
|
||||
```bash
|
||||
$> export PATH=~/bin/sonar/sonar-scanner-3.0.3.778-linux/bin/:~/bin/sonar/build-wrapper-linux-x86/:$PATH
|
||||
$> build-wrapper-linux-x86-64 --out-dir bw-output make clean all
|
||||
$> sonar-scanner \
|
||||
-Dsonar.projectKey=mraa-master \
|
||||
-Dsonar.projectBaseDir=/PATH/TO/YOUR/MRAA/REPO/CLONE \
|
||||
-Dsonar.sources=/PATH/TO/YOUR/MRAA/REPO/CLONE \
|
||||
-Dsonar.inclusions='api/**/*,CMakeLists.txt,examples/**/*,imraa/**/*,include/**/*,src/*,src/**/*,tests/**/*' \
|
||||
-Dsonar.cfamily.build-wrapper-output=/PATH/TO/YOUR/MRAA/REPO/CLONE/YOUR_BUILD_DIR/bw-output \
|
||||
-Dsonar.host.url=https://sonarcloud.io \
|
||||
-Dsonar.organization=mraa-github \
|
||||
-Dsonar.login=YOUR_SONAR_LOGIN_TOKEN_HERE
|
||||
```
|
||||
|
||||
Notice that we first set the `PATH` to point to our downloaded copy of Sonar tools.
|
||||
You can find more information on setting these up in SonarQube's nice
|
||||
[Getting Started tutorial](https://about.sonarcloud.io/get-started/).
|
||||
|
||||
Using Coverity
|
||||
--------------
|
||||
|
||||
In the past we've used Coverity to do static code analysis scans. Below is the
|
||||
documentation on that setup - for archiving purposes.
|
||||
|
||||
This is the procedure to submit a build to Coverity. You'll need to install
|
||||
`coverity-submit` for your OS.
|
||||
|
||||
```bash
|
||||
mkdir covbuild/ && cd covbuild
|
||||
cmake -DBUILDDOC=OFF -DBUILDSWIG=OFF ..
|
||||
cov-build --dir cov-int make
|
||||
tar caf mraa.tar.bz2 cov-int
|
||||
```
|
@@ -20,7 +20,7 @@ The Up Squared present one Raspberry Pi compatible HAT connector and a 60 pin e
|
||||
**SPI**
|
||||
- Bus frequencies up to 10MHz are supported
|
||||
- 3 chip-selects
|
||||
- To enable SPI device nodes the ACPI tables need to be overwritten as explained [here](https://up-community.org/wiki/Pinout_UP2#SPI_Ports)
|
||||
- To enable SPI device nodes the ACPI tables need to be overwritten as explained [here](https://wiki.up-community.org/Pinout_UP2#SPI_Ports)
|
||||
|
||||
**PWM**
|
||||
- Up to 3 channel of PWM
|
||||
|
85
docs/up_xtreme.md
Normal file
85
docs/up_xtreme.md
Normal file
@@ -0,0 +1,85 @@
|
||||
UP Xtreme Board {#up_xtreme}
|
||||
================================
|
||||
UP Xtreme is based on the Intel® Core™ i3/i5/i7 Whiskey Lake SoCs.
|
||||
|
||||
For the full specification please refer to the main specification page here:
|
||||
|
||||
https://up-board.org/wp-content/uploads/up-xtreme/Datasheet-UP-xtreme.pdf
|
||||
|
||||
Interface notes
|
||||
-----------------------
|
||||
The UP Xtreme present one Raspberry Pi compatible HAT connector and a 100 pin exHAT connector. Currently this implementation only support the interfaces through the HAT connector.
|
||||
|
||||
**I2C**
|
||||
- 2 channels
|
||||
- Support: standard-mode (100kHz), fast-mode (400kHz), Fast-mode plus (1MHz), High-speed mode (3.4MHz)
|
||||
- Bus frequency can be selected in BIOS settings
|
||||
- The default i2c channel is the one connected to the pin 3,5 of the hat
|
||||
- On some OSes the i2c-dev kernel module may need to be loaded manually to export the i2c device nodes
|
||||
|
||||
**SPI**
|
||||
- Bus frequencies up to 10MHz are supported
|
||||
- 2 chip-selects
|
||||
- To enable SPI device nodes the ACPI tables need to be overwritten as explained [here](https://wiki.up-community.org/Pinout_UP2#SPI_Ports)
|
||||
|
||||
**UART**
|
||||
- 1 high-speed UART is available
|
||||
- Supporting baud rates up to 3686400 baud
|
||||
- Hardware flow-control signals are available on pins 11/36 (RTS/CTS)
|
||||
|
||||
Please note that a kernel with UP board support is required to enable the I/O
|
||||
interfaces above.
|
||||
|
||||
Refer to http://www.up-community.org for more information.
|
||||
|
||||
Pin Mapping
|
||||
--------------------
|
||||
The GPIO numbering in the following pin mapping is based on the Raspberry Pi
|
||||
model 2 and B+ numbering scheme.
|
||||
|
||||
NOTE: the i2c device numbering depend on various factor and cannot be trusted:
|
||||
the right way of determining i2c (and other devices) numbering is through PCI
|
||||
physical device names. See the source code in src/x86/up_xtreme.c for details.
|
||||
|
||||
| MRAA no. | Function | Rpi GPIO | Sysfs GPIO | mraa device |
|
||||
|----------|--------------|------------|------------|-----------------|
|
||||
| 1 | 3V3 VCC | | | |
|
||||
| 2 | 5V VCC | | | |
|
||||
| 3 | I2C_SDA | 2 | 368 | I2C0 |
|
||||
| 4 | 5V VCC | | | |
|
||||
| 5 | I2C_SCL | 3 | 369 | I2C0 |
|
||||
| 6 | GND | | | |
|
||||
| 7 | GPIO(4) | 4 | 296 | |
|
||||
| 8 | UART_TX | 14 | 469 | UART0 |
|
||||
| 9 | GND | | | |
|
||||
| 10 | UART_RX | 15 | 468 | UART0 |
|
||||
| 11 | UART_RTS | 17 | 470 | UART0 |
|
||||
| 12 | I2S_CLK | 18 | 360 | |
|
||||
| 13 | GPIO(27) | 27 | 268 | |
|
||||
| 14 | GND | | | |
|
||||
| 15 | GPIO(22) | 22 | 270 | |
|
||||
| 16 | GPIO(23) | 23 | 264 | |
|
||||
| 17 | 3V3 VCC | | | |
|
||||
| 18 | GPIO(24) | 24 | 265 | |
|
||||
| 19 | SPI0_MOSI | 10 | 308 | SPI0 |
|
||||
| 20 | GND | | | |
|
||||
| 21 | SPI0_MISO | 9 | 307 | SPI0 |
|
||||
| 22 | GPIO(25) | 25 | 266 | |
|
||||
| 23 | SPI0_SCL | 11 | 306 | SPI0 |
|
||||
| 24 | SPI0_CS0 | 8 | 305 | SPI0 |
|
||||
| 25 | GND | | | |
|
||||
| 26 | SPI0_CS1 | 7 | 311 | SPI0 |
|
||||
| 27 | ID_SD | 0 | 366 | I2C1 |
|
||||
| 28 | ID_SC | 1 | 367 | I2C1 |
|
||||
| 29 | GPIO(5) | 5 | 317 | |
|
||||
| 30 | GND | | | |
|
||||
| 31 | GPIO(6) | 6 | 318 | |
|
||||
| 32 | GPIO(12) | 12 | 298 | |
|
||||
| 33 | GPIO(13) | 13 | 299 | |
|
||||
| 34 | GND | | | |
|
||||
| 35 | I2S_FRM | 19 | 261 | |
|
||||
| 36 | UART_CTS | 16 | 471 | UART0 |
|
||||
| 37 | GPIO(26) | 26 | 267 | |
|
||||
| 38 | I2S_DIN | 20 | 363 | |
|
||||
| 39 | GND | | | |
|
||||
| 40 | I2S_DOUT | 21 | 362 | |
|
@@ -1,6 +1,12 @@
|
||||
add_subdirectory (c)
|
||||
add_subdirectory (platform)
|
||||
|
||||
if ( (DEFINED ENV{JAVA_HOME_NATIVE}) OR (DEFINED ENV{JAVA_HOME}) )
|
||||
#add_subdirectory (java)
|
||||
else ()
|
||||
#message ( WARNING "You haven't configured the Java environment variables yet!")
|
||||
endif ()
|
||||
|
||||
if (NOT ANDROID_TOOLCHAIN)
|
||||
add_subdirectory (c++)
|
||||
endif ()
|
||||
|
@@ -1,60 +0,0 @@
|
||||
/*
|
||||
* Author: Brendan Le Foll <brendan.le.foll@intel.com>
|
||||
* Contributors: Alex Tereschenko <alex.mkrs@gmail.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 <signal.h>
|
||||
|
||||
#include "mraa.hpp"
|
||||
|
||||
int running = 0;
|
||||
|
||||
void
|
||||
sig_handler(int signo)
|
||||
{
|
||||
if (signo == SIGINT) {
|
||||
printf("closing down nicely\n");
|
||||
running = -1;
|
||||
}
|
||||
}
|
||||
|
||||
//! [Interesting]
|
||||
int
|
||||
main()
|
||||
{
|
||||
uint16_t adc_value;
|
||||
float adc_value_float;
|
||||
mraa::Aio a0(0);
|
||||
|
||||
signal(SIGINT, sig_handler);
|
||||
|
||||
while (running == 0) {
|
||||
adc_value = a0.read();
|
||||
adc_value_float = a0.readFloat();
|
||||
fprintf(stdout, "ADC A0 read %X - %d\n", adc_value, adc_value);
|
||||
fprintf(stdout, "ADC A0 read float - %.5f (Ctrl+C to exit)\n", adc_value_float);
|
||||
}
|
||||
|
||||
return MRAA_SUCCESS;
|
||||
}
|
||||
//! [Interesting]
|
@@ -1,73 +0,0 @@
|
||||
/*
|
||||
* Author: Brendan Le Foll <brendan.le.foll@intel.com>
|
||||
* Author: Thomas Ingleby <thomas.c.ingleby@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 <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "mraa.hpp"
|
||||
#define DEFAULT_IOPIN 8
|
||||
|
||||
static int iopin;
|
||||
int running = 0;
|
||||
|
||||
void
|
||||
sig_handler(int signo)
|
||||
{
|
||||
if (signo == SIGINT) {
|
||||
printf("closing IO%d nicely\n", iopin);
|
||||
running = -1;
|
||||
}
|
||||
}
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
if (argc < 2) {
|
||||
printf("Provide an int arg if you want to flash on something other than %d\n", DEFAULT_IOPIN);
|
||||
iopin = DEFAULT_IOPIN;
|
||||
} else {
|
||||
iopin = strtol(argv[1], NULL, 10);
|
||||
}
|
||||
|
||||
signal(SIGINT, sig_handler);
|
||||
|
||||
//! [Interesting]
|
||||
mraa::Gpio gpio(iopin);
|
||||
mraa::Result response = gpio.dir(mraa::DIR_OUT);
|
||||
if (response != mraa::SUCCESS) {
|
||||
mraa::printError(response);
|
||||
return 1;
|
||||
}
|
||||
|
||||
while (running == 0) {
|
||||
response = gpio.write(1);
|
||||
sleep(1);
|
||||
response = gpio.write(0);
|
||||
sleep(1);
|
||||
}
|
||||
return response;
|
||||
//! [Interesting]
|
||||
}
|
@@ -1,27 +1,29 @@
|
||||
enable_language(CXX)
|
||||
|
||||
add_executable (AioA0 AioA0.cpp)
|
||||
add_executable (blink-io-cpp Blink-IO.cpp)
|
||||
add_executable (Pwm3-cycle Pwm3-cycle.cpp)
|
||||
add_executable (I2c-compass I2c-compass.cpp)
|
||||
add_executable (Spi-pot Spi-pot.cpp)
|
||||
add_executable (Uart Uart-example.cpp)
|
||||
add_executable (Isr-pin6 Isr-pin6.cpp)
|
||||
add_executable (Iio-dummy Iio-dummy.cpp)
|
||||
add_executable (aio_cpp aio.cpp)
|
||||
add_executable (gpio_advanced_cpp gpio_advanced.cpp)
|
||||
add_executable (gpio_cpp gpio.cpp)
|
||||
add_executable (pwm_cpp pwm.cpp)
|
||||
add_executable (i2c_cpp i2c.cpp)
|
||||
add_executable (spi_cpp spi.cpp)
|
||||
add_executable (uart_cpp uart.cpp)
|
||||
add_executable (iio_cpp iio.cpp)
|
||||
add_executable (led_cpp led.cpp)
|
||||
|
||||
include_directories(${PROJECT_SOURCE_DIR}/api)
|
||||
include_directories(${PROJECT_SOURCE_DIR}/api/mraa)
|
||||
|
||||
target_link_libraries (AioA0 mraa stdc++)
|
||||
target_link_libraries (blink-io-cpp mraa stdc++)
|
||||
target_link_libraries (Pwm3-cycle mraa stdc++)
|
||||
target_link_libraries (I2c-compass mraa stdc++ m)
|
||||
target_link_libraries (Spi-pot mraa stdc++)
|
||||
target_link_libraries (Uart mraa stdc++)
|
||||
target_link_libraries (Isr-pin6 mraa stdc++)
|
||||
target_link_libraries (Iio-dummy mraa stdc++)
|
||||
target_link_libraries (aio_cpp mraa stdc++)
|
||||
target_link_libraries (gpio_advanced_cpp mraa stdc++)
|
||||
target_link_libraries (gpio_cpp mraa stdc++)
|
||||
target_link_libraries (pwm_cpp mraa stdc++)
|
||||
target_link_libraries (i2c_cpp mraa stdc++ m)
|
||||
target_link_libraries (spi_cpp mraa stdc++)
|
||||
target_link_libraries (uart_cpp mraa stdc++)
|
||||
target_link_libraries (iio_cpp mraa stdc++)
|
||||
target_link_libraries (led_cpp mraa stdc++)
|
||||
|
||||
if (ONEWIRE)
|
||||
add_executable (UartOW UartOW.cpp)
|
||||
target_link_libraries (UartOW mraa stdc++)
|
||||
add_executable (uart_ow_cpp uart_ow.cpp)
|
||||
target_link_libraries (uart_ow_cpp mraa stdc++)
|
||||
endif ()
|
||||
|
@@ -1,59 +0,0 @@
|
||||
/*
|
||||
* Author: Brendan Le Foll
|
||||
* Contributors: Alex Tereschenko <alext.mkrs@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 "mraa.hpp"
|
||||
|
||||
static volatile int counter = 0;
|
||||
static volatile int oldcounter = 0;
|
||||
|
||||
void
|
||||
interrupt(void* args)
|
||||
{
|
||||
++counter;
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
mraa::Gpio x(6);
|
||||
|
||||
x.dir(mraa::DIR_IN);
|
||||
|
||||
x.isr(mraa::EDGE_BOTH, &interrupt, NULL);
|
||||
|
||||
int i = 100;
|
||||
for (; i > 0; --i) {
|
||||
if (counter != oldcounter) {
|
||||
fprintf(stdout, "timeout counter == %d\n", counter);
|
||||
oldcounter = counter;
|
||||
}
|
||||
// got to relieve our poor CPU!
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
return MRAA_SUCCESS;
|
||||
}
|
@@ -1,62 +0,0 @@
|
||||
/*
|
||||
* Author: Thomas Ingleby <thomas.c.ingleby@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 <signal.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "mraa.hpp"
|
||||
|
||||
int running = 0;
|
||||
|
||||
void
|
||||
sig_handler(int signo)
|
||||
{
|
||||
if (signo == SIGINT) {
|
||||
printf("closing PWM nicely\n");
|
||||
running = -1;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
signal(SIGINT, sig_handler);
|
||||
//! [Interesting]
|
||||
mraa::Pwm pwm(3);
|
||||
fprintf(stdout, "Cycling PWM on IO3 (pwm3) \n");
|
||||
pwm.enable(true);
|
||||
|
||||
float value = 0.0f;
|
||||
while (running == 0) {
|
||||
value = value + 0.01f;
|
||||
pwm.write(value);
|
||||
usleep(50000);
|
||||
if (value >= 1.0f) {
|
||||
value = 0.0f;
|
||||
}
|
||||
}
|
||||
//! [Interesting]
|
||||
|
||||
return MRAA_SUCCESS;
|
||||
}
|
@@ -1,77 +0,0 @@
|
||||
/*
|
||||
* Author: Thomas Ingleby <thomas.c.ingleby@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 <signal.h>
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "mraa.hpp"
|
||||
|
||||
int running = 0;
|
||||
|
||||
void
|
||||
sig_handler(int signo)
|
||||
{
|
||||
if (signo == SIGINT) {
|
||||
printf("closing spi nicely\n");
|
||||
running = -1;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
signal(SIGINT, sig_handler);
|
||||
|
||||
//! [Interesting]
|
||||
mraa::Spi spi(0);
|
||||
|
||||
uint8_t data[] = { 0x00, 100 };
|
||||
uint8_t rxBuf[2];
|
||||
uint8_t* recv;
|
||||
while (running == 0) {
|
||||
int i;
|
||||
for (i = 90; i < 130; i++) {
|
||||
data[1] = i;
|
||||
recv = spi.write(data, 2);
|
||||
printf("Writing -%i", i);
|
||||
if (recv) {
|
||||
printf("RECIVED-%i-%i\n", recv[0], recv[1]);
|
||||
free(recv);
|
||||
}
|
||||
usleep(100000);
|
||||
}
|
||||
for (i = 130; i > 90; i--) {
|
||||
data[1] = i;
|
||||
if (spi.transfer(data, rxBuf, 2) == mraa::SUCCESS) {
|
||||
printf("Writing -%i", i);
|
||||
printf("RECIVED-%i-%i\n", rxBuf[0], rxBuf[1]);
|
||||
}
|
||||
usleep(100000);
|
||||
}
|
||||
}
|
||||
//! [Interesting]
|
||||
|
||||
return mraa::SUCCESS;
|
||||
}
|
@@ -1,70 +0,0 @@
|
||||
/*
|
||||
* Author: Brendan Le Foll <brendan.le.foll@intel.com>
|
||||
* Copyright (c) 2015 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <exception>
|
||||
#include <iostream>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "mraa.hpp"
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
//! [Interesting]
|
||||
// If you have a valid platform configuration use numbers to represent uart
|
||||
// device. If not use raw mode where std::string is taken as a constructor
|
||||
// parameter
|
||||
mraa::Uart* dev;
|
||||
try {
|
||||
dev = new mraa::Uart(0);
|
||||
} catch (std::exception& e) {
|
||||
std::cout << e.what() << ", likely invalid platform config" << std::endl;
|
||||
}
|
||||
|
||||
try {
|
||||
dev = new mraa::Uart("/dev/ttyACM0");
|
||||
} catch (std::exception& e) {
|
||||
std::cout << "Error while setting up raw UART, do you have a uart?" << std::endl;
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
if (dev->setBaudRate(115200) != mraa::SUCCESS) {
|
||||
std::cout << "Error setting parity on UART" << std::endl;
|
||||
}
|
||||
|
||||
if (dev->setMode(8, mraa::UART_PARITY_NONE, 1) != mraa::SUCCESS) {
|
||||
std::cout << "Error setting parity on UART" << std::endl;
|
||||
}
|
||||
|
||||
if (dev->setFlowcontrol(false, false) != mraa::SUCCESS) {
|
||||
std::cout << "Error setting flow control UART" << std::endl;
|
||||
}
|
||||
|
||||
dev->writeStr("Hello monkeys");
|
||||
//! [Interesting]
|
||||
|
||||
delete dev;
|
||||
|
||||
return mraa::SUCCESS;
|
||||
}
|
@@ -1,78 +0,0 @@
|
||||
/*
|
||||
* Author: Jon Trulson <jtrulson@ics.com>
|
||||
* Copyright (c) 2016 Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* 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 "stdio.h"
|
||||
//! [Interesting]
|
||||
#include "uart_ow.hpp"
|
||||
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
mraa::UartOW uart(0);
|
||||
|
||||
// Reset the ow bus and see if anything is present
|
||||
mraa::Result rv;
|
||||
|
||||
if ((rv = uart.reset()) == mraa::SUCCESS) {
|
||||
std::cout << "Reset succeeded, device(s) detected!" << std::endl;
|
||||
} else {
|
||||
std::cout << "Reset failed, returned " << int(rv) << ". No devices on bus?" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
std::cout << "Looking for devices..." << std::endl;
|
||||
;
|
||||
|
||||
uint8_t count = 0;
|
||||
// start the search from scratch
|
||||
std::string id = uart.search(true);
|
||||
|
||||
if (id.empty()) {
|
||||
std::cout << "No devices detected." << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
while (!id.empty()) {
|
||||
// hack so we don't need to cast each element of the romcode
|
||||
// for printf purposes
|
||||
uint8_t* ptr = (uint8_t*) id.data();
|
||||
|
||||
// The first byte (0) is the device type (family) code.
|
||||
// The last byte (7) is the rom code CRC value. The
|
||||
// intervening bytes are the unique 48 bit device ID.
|
||||
|
||||
printf("Device %02d Type 0x%02x ID %02x%02x%02x%02x%02x%02x CRC 0x%02x\n", count, ptr[0],
|
||||
ptr[6], ptr[5], ptr[4], ptr[3], ptr[2], ptr[1], ptr[7]);
|
||||
count++;
|
||||
|
||||
// continue the search with start argument set to false
|
||||
id = uart.search(false);
|
||||
}
|
||||
|
||||
std::cout << "Exiting..." << std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
//! [Interesting]
|
56
examples/c++/aio.cpp
Normal file
56
examples/c++/aio.cpp
Normal file
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Author: Brendan Le Foll <brendan.le.foll@intel.com>
|
||||
* Contributors: Alex Tereschenko <alex.mkrs@gmail.com>
|
||||
* Contributors: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
|
||||
* Copyright (c) 2014 Intel Corporation.
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* Example usage: Reads ADC A0 value continuously. Press Ctrl+C to exit.
|
||||
*/
|
||||
|
||||
/* standard headers */
|
||||
#include <iostream>
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/* mraa headers */
|
||||
#include "mraa/aio.hpp"
|
||||
#include "mraa/common.hpp"
|
||||
|
||||
/* AIO port */
|
||||
#define AIO_PORT 0
|
||||
|
||||
volatile sig_atomic_t flag = 1;
|
||||
|
||||
void
|
||||
sig_handler(int signum)
|
||||
{
|
||||
if (signum == SIGINT) {
|
||||
std::cout << "Exiting..." << std::endl;
|
||||
flag = 0;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
uint16_t value;
|
||||
float float_value;
|
||||
|
||||
signal(SIGINT, sig_handler);
|
||||
|
||||
//! [Interesting]
|
||||
/* initialize AIO */
|
||||
mraa::Aio aio(AIO_PORT);
|
||||
|
||||
while (flag) {
|
||||
value = aio.read();
|
||||
float_value = aio.readFloat();
|
||||
std::cout << "ADC A0 read %X - %d" << value << value << std::endl;
|
||||
std::cout << "ADC A0 read float - %.5f" << float_value << std::endl;
|
||||
}
|
||||
//! [Interesting]
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
97
examples/c++/gpio.cpp
Normal file
97
examples/c++/gpio.cpp
Normal file
@@ -0,0 +1,97 @@
|
||||
/*
|
||||
* Author: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
|
||||
* Copyright (c) 2018 Linaro Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* Example usage: Toggles GPIO's 23 and 24 recursively. Press Ctrl+C to exit
|
||||
*
|
||||
*/
|
||||
|
||||
/* standard headers */
|
||||
#include <iostream>
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/* mraa headers */
|
||||
#include "mraa/common.hpp"
|
||||
#include "mraa/gpio.hpp"
|
||||
|
||||
/* gpio declaration */
|
||||
#define GPIO_PIN_1 23
|
||||
#define GPIO_PIN_2 24
|
||||
|
||||
volatile sig_atomic_t flag = 1;
|
||||
|
||||
void
|
||||
sig_handler(int signum)
|
||||
{
|
||||
if (signum == SIGINT) {
|
||||
std::cout << "Exiting..." << std::endl;
|
||||
flag = 0;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
mraa::Result status;
|
||||
|
||||
/* install signal handler */
|
||||
signal(SIGINT, sig_handler);
|
||||
|
||||
//! [Interesting]
|
||||
/* initialize GPIO pin */
|
||||
mraa::Gpio gpio_1(GPIO_PIN_1);
|
||||
|
||||
/* initialize GPIO pin */
|
||||
mraa::Gpio gpio_2(GPIO_PIN_2);
|
||||
|
||||
/* set GPIO to output */
|
||||
status = gpio_1.dir(mraa::DIR_OUT);
|
||||
if (status != mraa::SUCCESS) {
|
||||
printError(status);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
/* set gpio 24 to output */
|
||||
status = gpio_2.dir(mraa::DIR_OUT);
|
||||
if (status != mraa::SUCCESS) {
|
||||
printError(status);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
/* toggle both GPIO's */
|
||||
while (flag) {
|
||||
status = gpio_1.write(1);
|
||||
if (status != mraa::SUCCESS) {
|
||||
printError(status);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
status = gpio_2.write(0);
|
||||
if (status != mraa::SUCCESS) {
|
||||
printError(status);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
sleep(1);
|
||||
|
||||
status = gpio_1.write(0);
|
||||
if (status != mraa::SUCCESS) {
|
||||
printError(status);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
status = gpio_2.write(1);
|
||||
if (status != mraa::SUCCESS) {
|
||||
printError(status);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
sleep(1);
|
||||
}
|
||||
//! [Interesting]
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
56
examples/c++/gpio_advanced.cpp
Normal file
56
examples/c++/gpio_advanced.cpp
Normal file
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Author: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
|
||||
* Copyright (c) 2018 Linaro Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* Example usage: Configures GPIO pin for interrupt and waits 30 seconds for the isr to trigger
|
||||
*
|
||||
*/
|
||||
|
||||
/* standard headers */
|
||||
#include <iostream>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/* mraa headers */
|
||||
#include "mraa/common.hpp"
|
||||
#include "mraa/gpio.hpp"
|
||||
|
||||
#define GPIO_PIN 6
|
||||
|
||||
void
|
||||
int_handler(void* args)
|
||||
{
|
||||
std::cout << "ISR triggered" << std::endl;
|
||||
}
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
mraa::Result status;
|
||||
|
||||
//! [Interesting]
|
||||
/* initialize GPIO */
|
||||
mraa::Gpio gpio(GPIO_PIN);
|
||||
|
||||
/* set GPIO to input */
|
||||
status = gpio.dir(mraa::DIR_IN);
|
||||
if (status != mraa::SUCCESS) {
|
||||
printError(status);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
/* configure ISR for GPIO */
|
||||
status = gpio.isr(mraa::EDGE_BOTH, &int_handler, NULL);
|
||||
if (status != mraa::SUCCESS) {
|
||||
printError(status);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
/* wait 30 seconds isr trigger */
|
||||
sleep(30);
|
||||
//! [Interesting]
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
@@ -3,31 +3,23 @@
|
||||
* Author: Thomas Ingleby <thomas.c.ingleby@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:
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
* Example usage: Outputs X,Y,Z co-ordinates and direction recursively using
|
||||
* HMC5883L. Press Ctrl+C to exit.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/* standard headers */
|
||||
#include <iostream>
|
||||
#include <math.h>
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "math.h"
|
||||
#include "mraa.hpp"
|
||||
/* mraa headers */
|
||||
#include "mraa/common.hpp"
|
||||
#include "mraa/i2c.hpp"
|
||||
|
||||
#define MAX_BUFFER_LENGTH 6
|
||||
#define HMC5883L_I2C_ADDR 0x1E
|
||||
@@ -79,42 +71,41 @@
|
||||
#define SCALE_3_03_MG 3.03
|
||||
#define SCALE_4_35_MG 4.35
|
||||
|
||||
#define I2C_BUS 0
|
||||
|
||||
int running = 0;
|
||||
volatile sig_atomic_t flag = 1;
|
||||
|
||||
void
|
||||
sig_handler(int signo)
|
||||
sig_handler(int signum)
|
||||
{
|
||||
if (signo == SIGINT) {
|
||||
printf("closing nicely\n");
|
||||
running = -1;
|
||||
if (signum == SIGINT) {
|
||||
std::cout << "Exiting..." << std::endl;
|
||||
flag = 0;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
main(void)
|
||||
{
|
||||
float direction = 0;
|
||||
int16_t x = 0, y = 0, z = 0;
|
||||
float direction;
|
||||
int16_t x, y, z;
|
||||
uint8_t rx_tx_buf[MAX_BUFFER_LENGTH];
|
||||
|
||||
signal(SIGINT, sig_handler);
|
||||
|
||||
//! [Interesting]
|
||||
mraa::I2c i2c(0);
|
||||
mraa::I2c i2c(I2C_BUS);
|
||||
|
||||
i2c.address(HMC5883L_I2C_ADDR);
|
||||
rx_tx_buf[0] = HMC5883L_CONF_REG_B;
|
||||
rx_tx_buf[1] = GA_1_3_REG;
|
||||
i2c.write(rx_tx_buf, 2);
|
||||
//! [Interesting]
|
||||
|
||||
i2c.address(HMC5883L_I2C_ADDR);
|
||||
rx_tx_buf[0] = HMC5883L_MODE_REG;
|
||||
rx_tx_buf[1] = HMC5883L_CONT_MODE;
|
||||
i2c.write(rx_tx_buf, 2);
|
||||
|
||||
signal(SIGINT, sig_handler);
|
||||
|
||||
while (running == 0) {
|
||||
while (flag) {
|
||||
i2c.address(HMC5883L_I2C_ADDR);
|
||||
i2c.writeByte(HMC5883L_DATA_REG);
|
||||
|
||||
@@ -132,11 +123,13 @@ main()
|
||||
if (direction < 0)
|
||||
direction += 2 * M_PI;
|
||||
|
||||
printf("Compass scaled data x : %f, y : %f, z : %f\n", x * SCALE_0_92_MG, y * SCALE_0_92_MG,
|
||||
z * SCALE_0_92_MG);
|
||||
printf("Heading : %f\n", direction * 180 / M_PI);
|
||||
std::cout << "Compass scaled data x : %f, y : %f, z : %f" << x * SCALE_0_92_MG
|
||||
<< y * SCALE_0_92_MG << z * SCALE_0_92_MG << std::endl;
|
||||
std::cout << "Heading : %f" << direction * 180 / M_PI << std::endl;
|
||||
|
||||
sleep(1);
|
||||
}
|
||||
//! [Interesting]
|
||||
|
||||
return MRAA_SUCCESS;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
@@ -2,32 +2,24 @@
|
||||
* Author: Henry Bruce
|
||||
* 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:
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
* Example usage: Sets accelerometer scale and registers for the threshold event
|
||||
*
|
||||
* 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 "mraa/iio.hpp"
|
||||
/* standard headers */
|
||||
#include <float.h>
|
||||
#include <iostream>
|
||||
#include <math.h>
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/* mraa headers */
|
||||
#include "mraa/common.hpp"
|
||||
#include "mraa/iio.hpp"
|
||||
|
||||
#define EXPECT_FAILURE 0
|
||||
#define EXPECT_SUCCESS 1
|
||||
|
||||
@@ -82,9 +74,9 @@ log_result(std::string test_name, std::string attr_name, bool expect_success, bo
|
||||
else
|
||||
result = success ? "FAIL" : "PASS";
|
||||
if (attr_name.empty())
|
||||
fprintf(stdout, "%s: %s\n", test_name.c_str(), result.c_str());
|
||||
std::cout << "%s: %s" << test_name.c_str() << result.c_str() << std::endl;
|
||||
else
|
||||
fprintf(stdout, "%s(%s): %s\n", test_name.c_str(), attr_name.c_str(), result.c_str());
|
||||
std::cout << "%s(%s): %s" << test_name.c_str() << attr_name.c_str() << result.c_str() << std::endl;
|
||||
}
|
||||
|
||||
// Generate iio_dummy driver event by writing a string to a specific sysfs node
|
||||
@@ -113,10 +105,10 @@ class IioTestHandler : public mraa::IioHandler
|
||||
}
|
||||
};
|
||||
|
||||
//! [Interesting]
|
||||
int
|
||||
main()
|
||||
main(void)
|
||||
{
|
||||
//! [Interesting]
|
||||
IioTestHandler testHandler;
|
||||
std::string deviceName;
|
||||
try {
|
||||
@@ -144,7 +136,6 @@ main()
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
std::cout << "Using IIO device0. Name is " << iio_device->getDeviceName() << std::endl;
|
||||
IIO_RUN(writeFloat, "in_accel_x_raw", 100, EXPECT_FAILURE);
|
||||
IIO_RUN(writeFloat, "in_voltage0_scale", 100, EXPECT_FAILURE);
|
||||
@@ -157,8 +148,9 @@ main()
|
||||
generate_event();
|
||||
usleep(500000);
|
||||
log_result("eventReceived", "", (eventCount == 1), true);
|
||||
//! [Interesting]
|
||||
|
||||
delete iio_device;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
//! [Interesting]
|
69
examples/c++/led.cpp
Normal file
69
examples/c++/led.cpp
Normal file
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Author: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
|
||||
* Copyright (c) 2018, Linaro Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* Example usage: Reads maximum brightness value for user led and turns it
|
||||
* on/off depending on current state. Then sets led trigger
|
||||
* to heartbeat.
|
||||
*
|
||||
*/
|
||||
|
||||
/* standard headers */
|
||||
#include <iostream>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/* mraa headers */
|
||||
#include "mraa/common.hpp"
|
||||
#include "mraa/led.hpp"
|
||||
|
||||
/* LED name */
|
||||
#define USER_LED "user1"
|
||||
|
||||
/* trigger type */
|
||||
#define LED_TRIGGER "heartbeat"
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
mraa::Result status;
|
||||
int val;
|
||||
|
||||
//! [Interesting]
|
||||
/* initialize user1 led */
|
||||
mraa::Led led(USER_LED);
|
||||
|
||||
/* read maximum brightness */
|
||||
val = led.readMaxBrightness();
|
||||
std::cout << "maximum brightness value for user1 led is: %d" << val << std::endl;
|
||||
if (val >= 1) {
|
||||
val = 0;
|
||||
} else {
|
||||
/* never reached mostly */
|
||||
val = 1;
|
||||
}
|
||||
|
||||
/* turn led on/off depending on max_brightness value */
|
||||
status = led.setBrightness(val);
|
||||
if (status != mraa::SUCCESS) {
|
||||
printError(status);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
/* sleep for 5 seconds */
|
||||
usleep(5000000);
|
||||
|
||||
/* set led trigger to heartbeat */
|
||||
status = led.trigger(LED_TRIGGER);
|
||||
if (status != mraa::SUCCESS) {
|
||||
printError(status);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
std::cout << "led trigger set to: heartbeat" << std::endl;
|
||||
//! [Interesting]
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
57
examples/c++/pwm.cpp
Normal file
57
examples/c++/pwm.cpp
Normal file
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
|
||||
* Copyright (c) 2014 Intel Corporation.
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* Example usage: Generates PWM at a step rate of 0.01 continuously.
|
||||
* Press Ctrl+C to exit
|
||||
*/
|
||||
|
||||
/* standard headers */
|
||||
#include <iostream>
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/* mraa headers */
|
||||
#include "mraa/common.hpp"
|
||||
#include "mraa/pwm.hpp"
|
||||
|
||||
#define PWM_PORT 3
|
||||
|
||||
volatile sig_atomic_t flag = 1;
|
||||
|
||||
void
|
||||
sig_handler(int signum)
|
||||
{
|
||||
if (signum == SIGINT) {
|
||||
std::cout << "Exiting..." << std::endl;
|
||||
flag = 0;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
float value = 0.0f;
|
||||
|
||||
signal(SIGINT, sig_handler);
|
||||
|
||||
//! [Interesting]
|
||||
mraa::Pwm pwm(PWM_PORT);
|
||||
std::cout << "Cycling PWM on IO3 (pwm3)" << std::endl;
|
||||
pwm.enable(true);
|
||||
|
||||
while (flag) {
|
||||
value = value + 0.01f;
|
||||
pwm.write(value);
|
||||
usleep(50000);
|
||||
if (value >= 1.0f) {
|
||||
value = 0.0f;
|
||||
}
|
||||
}
|
||||
//! [Interesting]
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
72
examples/c++/spi.cpp
Normal file
72
examples/c++/spi.cpp
Normal file
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
|
||||
* Contributors: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
|
||||
* Copyright (c) 2014 Intel Corporation.
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* Example usage: Sends data continuously to a Spi device. Press Ctrl+C to exit
|
||||
*
|
||||
*/
|
||||
|
||||
/* standard headers */
|
||||
#include <iostream>
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/* mraa headers */
|
||||
#include "mraa/common.hpp"
|
||||
#include "mraa/spi.hpp"
|
||||
|
||||
#define SPI_PORT 0
|
||||
|
||||
volatile sig_atomic_t flag = 1;
|
||||
|
||||
void
|
||||
sig_handler(int signum)
|
||||
{
|
||||
if (signum == SIGINT) {
|
||||
std::cout << "Exiting..." << std::endl;
|
||||
flag = 0;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
uint8_t data[] = { 0x00, 100 };
|
||||
uint8_t rxBuf[2];
|
||||
uint8_t* recv;
|
||||
int i;
|
||||
|
||||
signal(SIGINT, sig_handler);
|
||||
|
||||
//! [Interesting]
|
||||
mraa::Spi spi(SPI_PORT);
|
||||
|
||||
while (flag) {
|
||||
for (i = 90; i < 130; i++) {
|
||||
data[1] = i;
|
||||
recv = spi.write(data, 2);
|
||||
std::cout << "Writing -%i" << i << std::endl;
|
||||
if (recv) {
|
||||
std::cout << "RECIVED-%i-%i" << recv[0] << recv[1] << std::endl;
|
||||
free(recv);
|
||||
}
|
||||
usleep(100000);
|
||||
}
|
||||
|
||||
for (i = 130; i > 90; i--) {
|
||||
data[1] = i;
|
||||
if (spi.transfer(data, rxBuf, 2) == mraa::SUCCESS) {
|
||||
std::cout << "Writing -%i" << i << std::endl;
|
||||
std::cout << "RECIVED-%i-%i" << rxBuf[0] << rxBuf[1] << std::endl;
|
||||
}
|
||||
usleep(100000);
|
||||
}
|
||||
}
|
||||
//! [Interesting]
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
86
examples/c++/uart.cpp
Normal file
86
examples/c++/uart.cpp
Normal file
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Author: Brendan Le Foll <brendan.le.foll@intel.com>
|
||||
* Contributors: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
|
||||
* Copyright (c) 2015 Intel Corporation.
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* Example usage: Prints "Hello Mraa!" recursively. Press Ctrl+C to exit
|
||||
*
|
||||
*/
|
||||
|
||||
/* standard headers */
|
||||
#include <iostream>
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/* mraa headers */
|
||||
#include "mraa/common.hpp"
|
||||
#include "mraa/uart.hpp"
|
||||
|
||||
/* UART port */
|
||||
#define UART_PORT 0
|
||||
|
||||
const char* dev_path = "/dev/ttyS0";
|
||||
|
||||
volatile sig_atomic_t flag = 1;
|
||||
|
||||
void
|
||||
sig_handler(int signum)
|
||||
{
|
||||
if (signum == SIGINT) {
|
||||
std::cout << "Exiting..." << std::endl;
|
||||
flag = 0;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
signal(SIGINT, sig_handler);
|
||||
|
||||
//! [Interesting]
|
||||
// If you have a valid platform configuration use numbers to represent uart
|
||||
// device. If not use raw mode where std::string is taken as a constructor
|
||||
// parameter
|
||||
mraa::Uart* uart, *temp;
|
||||
try {
|
||||
uart = new mraa::Uart(UART_PORT);
|
||||
temp = uart;
|
||||
} catch (std::exception& e) {
|
||||
std::cerr << e.what() << ", likely invalid platform config" << std::endl;
|
||||
}
|
||||
|
||||
try {
|
||||
uart = new mraa::Uart(dev_path);
|
||||
} catch (std::exception& e) {
|
||||
std::cerr << "Error while setting up raw UART, do you have a uart?" << std::endl;
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
if (uart->setBaudRate(115200) != mraa::SUCCESS) {
|
||||
std::cerr << "Error setting parity on UART" << std::endl;
|
||||
}
|
||||
|
||||
if (uart->setMode(8, mraa::UART_PARITY_NONE, 1) != mraa::SUCCESS) {
|
||||
std::cerr << "Error setting parity on UART" << std::endl;
|
||||
}
|
||||
|
||||
if (uart->setFlowcontrol(false, false) != mraa::SUCCESS) {
|
||||
std::cerr << "Error setting flow control UART" << std::endl;
|
||||
}
|
||||
|
||||
while (flag) {
|
||||
/* send data through uart */
|
||||
uart->writeStr("Hello Mraa!");
|
||||
|
||||
sleep(1);
|
||||
}
|
||||
//! [Interesting]
|
||||
|
||||
delete uart;
|
||||
delete temp;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
69
examples/c++/uart_ow.cpp
Normal file
69
examples/c++/uart_ow.cpp
Normal file
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Author: Jon Trulson <jtrulson@ics.com>
|
||||
* Copyright (c) 2016 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* Example usage: Search and print the found OW device ID recursively.
|
||||
*
|
||||
*/
|
||||
|
||||
/* standard headers */
|
||||
#include <iostream>
|
||||
#include <stdlib.h>
|
||||
|
||||
/* mraa headers */
|
||||
#include "mraa/common.hpp"
|
||||
#include "mraa/uart_ow.hpp"
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
mraa::Result status;
|
||||
std::string id;
|
||||
uint8_t count = 0;
|
||||
uint8_t* ptr;
|
||||
|
||||
//! [Interesting]
|
||||
mraa::UartOW uart(0);
|
||||
|
||||
// Reset the ow bus and see if anything is present
|
||||
if ((status = uart.reset()) == mraa::SUCCESS) {
|
||||
std::cout << "Reset succeeded, device(s) detected!" << std::endl;
|
||||
} else {
|
||||
std::cout << "Reset failed, returned " << int(status) << ". No devices on bus?" << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
std::cout << "Looking for devices..." << std::endl;
|
||||
|
||||
// start the search from scratch
|
||||
id = uart.search(true);
|
||||
|
||||
if (id.empty()) {
|
||||
std::cout << "No devices detected." << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
while (!id.empty()) {
|
||||
// hack so we don't need to cast each element of the romcode
|
||||
// for printf purposes
|
||||
ptr = (uint8_t*) id.data();
|
||||
|
||||
// The first byte (0) is the device type (family) code.
|
||||
// The last byte (7) is the rom code CRC value. The
|
||||
// intervening bytes are the unique 48 bit device ID.
|
||||
|
||||
std::cout << "Device %02d Type 0x%02x ID %02x%02x%02x%02x%02x%02x CRC 0x%02x" << count << ptr[0]
|
||||
<< ptr[6] << ptr[5] << ptr[4] << ptr[3] << ptr[2] << ptr[1] << ptr[7] << std::endl;
|
||||
count++;
|
||||
|
||||
// continue the search with start argument set to false
|
||||
id = uart.search(false);
|
||||
}
|
||||
|
||||
std::cout << "Exiting..." << std::endl;
|
||||
//! [Interesting]
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
@@ -4,24 +4,7 @@
|
||||
* Contributors: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
|
||||
* 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.
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* Example usage: Reads ADC A0 value continuously. Press Ctrl+C to exit.
|
||||
*/
|
||||
|
@@ -4,24 +4,7 @@
|
||||
* Contributors: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
|
||||
* 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.
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* Example usage: Toggles GPIO's 23 and 24 recursively. Press Ctrl+C to exit
|
||||
*
|
||||
|
@@ -4,24 +4,7 @@
|
||||
* Contributors: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
|
||||
* 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.
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* Example usage: Configures GPIO pin for interrupt and waits 30 seconds for the isr to trigger
|
||||
*
|
||||
|
108
examples/c/gpio_multiple_rw.c
Normal file
108
examples/c/gpio_multiple_rw.c
Normal file
@@ -0,0 +1,108 @@
|
||||
/*
|
||||
* Copyright (c) 2017 Mihai Stefanescu
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* This currently works only on Intel Joule Platform.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "mraa/gpio.h"
|
||||
|
||||
int running = 0;
|
||||
|
||||
void
|
||||
sig_handler(int signo)
|
||||
{
|
||||
if (signo == SIGINT) {
|
||||
printf("Closing down nicely\n");
|
||||
running = -1;
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
mraa_result_t r = MRAA_SUCCESS;
|
||||
/* These are Joule's onboard LED's. */
|
||||
int default_joule_leds[] = {100, 101, 102, 103};
|
||||
int *gpio_pins;
|
||||
int num_pins;
|
||||
int *input_values, *output_values;
|
||||
|
||||
printf("Provide int arg(s) if you want to toggle gpio pins other than Joule's onboard LED's\n");
|
||||
|
||||
if (argc < 2) {
|
||||
gpio_pins = default_joule_leds;
|
||||
num_pins = 4;
|
||||
} else {
|
||||
num_pins = argc - 1;
|
||||
gpio_pins = malloc(num_pins * sizeof(int));
|
||||
|
||||
for (int i = 0; i < num_pins; ++i) {
|
||||
gpio_pins[i] = strtol(argv[i+1], NULL, 10);
|
||||
}
|
||||
}
|
||||
|
||||
/* Allocate input and output values arrays. */
|
||||
input_values = malloc(num_pins * sizeof(int));
|
||||
output_values = malloc(num_pins * sizeof(int));
|
||||
|
||||
mraa_init();
|
||||
fprintf(stdout, "MRAA Version: %s\nStarting program...\n", mraa_get_version());
|
||||
|
||||
mraa_gpio_context gpio = mraa_gpio_init_multi(gpio_pins, num_pins);
|
||||
if (gpio == NULL) {
|
||||
fprintf(stderr, "Error during gpio initialization\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
r = mraa_gpio_dir(gpio, MRAA_GPIO_OUT);
|
||||
if (r != MRAA_SUCCESS) {
|
||||
mraa_result_print(r);
|
||||
}
|
||||
|
||||
signal(SIGINT, sig_handler);
|
||||
|
||||
/* Set input values first. */
|
||||
memset(input_values, 0, num_pins * sizeof(int));
|
||||
|
||||
while (running == 0) {
|
||||
r = mraa_gpio_write_multi(gpio, input_values);
|
||||
|
||||
sleep(1);
|
||||
|
||||
if (r != MRAA_SUCCESS) {
|
||||
mraa_result_print(r);
|
||||
} else {
|
||||
r = mraa_gpio_read_multi(gpio, output_values);
|
||||
if (r != MRAA_SUCCESS) {
|
||||
mraa_result_print(r);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < num_pins; ++i) {
|
||||
input_values[i] = (input_values[i] + 1) % 2;
|
||||
}
|
||||
}
|
||||
|
||||
memset(input_values, 0, num_pins * sizeof(int));
|
||||
mraa_gpio_write_multi(gpio, input_values);
|
||||
|
||||
r = mraa_gpio_close(gpio);
|
||||
if (r != MRAA_SUCCESS) {
|
||||
mraa_result_print(r);
|
||||
}
|
||||
|
||||
/* Cleanup. */
|
||||
if (argc >= 2) {
|
||||
free(gpio_pins);
|
||||
}
|
||||
free(input_values);
|
||||
free(output_values);
|
||||
|
||||
return r;
|
||||
}
|
@@ -2,24 +2,7 @@
|
||||
* Author: Brendan Le Foll <brendan.le.foll@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.
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
@@ -2,24 +2,7 @@
|
||||
* Author: Brendan Le Foll <brendan.le.foll@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.
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* Example usage: Outputs X,Y,Z co-ordinates and direction recursively using
|
||||
* HMC5883L. Press Ctrl+C to exit.
|
||||
@@ -123,7 +106,7 @@ main(void)
|
||||
}
|
||||
|
||||
/* set slave address */
|
||||
mraa_i2c_address(i2c, HMC5883L_I2C_ADDR);
|
||||
status = mraa_i2c_address(i2c, HMC5883L_I2C_ADDR);
|
||||
if (status != MRAA_SUCCESS) {
|
||||
goto err_exit;
|
||||
}
|
||||
|
@@ -2,24 +2,7 @@
|
||||
* Author: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
|
||||
* Copyright (c) 2018, Linaro Ltd.
|
||||
*
|
||||
* 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.
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* Example usage: Outputs Accelerometer and Gyroscope value from MPU6050 recursively.
|
||||
* Press Ctrl+C to exit.
|
||||
@@ -27,6 +10,7 @@
|
||||
*/
|
||||
|
||||
/* standard headers */
|
||||
#include <endian.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
@@ -2,24 +2,7 @@
|
||||
* Author: Brendan Le Foll
|
||||
* 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.
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* Example usage: Sets accelerometer scale, enables the x axis measurement and sets the trigger.
|
||||
* Waits 100 seconds for the buffer trigger to happen.
|
||||
@@ -28,6 +11,7 @@
|
||||
/* standard headers */
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <endian.h>
|
||||
|
||||
/* mraa header */
|
||||
#include "mraa/iio.h"
|
||||
|
32
examples/c/initio.c
Normal file
32
examples/c/initio.c
Normal file
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Author: Mihai Stefanescu <mihai.stefanescu@rinftech.com>
|
||||
* Copyright (c) 2018 Intel Corporation.
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "mraa/initio.h"
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
printf("Starting example\n");
|
||||
|
||||
mraa_io_descriptor* desc;
|
||||
if (mraa_io_init("g:3:1-upm_stuff", &desc) != MRAA_SUCCESS) {
|
||||
printf("Error in mraa_io_init()\n");
|
||||
}
|
||||
|
||||
printf("Leftover string = %s\n", desc->leftover_str);
|
||||
|
||||
/* Check value set in mraa_io_init. */
|
||||
printf("Gpio value = %d\n", mraa_gpio_read(desc->gpios[0]));
|
||||
|
||||
if (mraa_io_close(desc) != MRAA_SUCCESS) {
|
||||
printf("failed to close mraa io descriptor\n");
|
||||
}
|
||||
|
||||
printf("Done\n");
|
||||
}
|
@@ -2,24 +2,7 @@
|
||||
* Author: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
|
||||
* Copyright (c) 2018, Linaro Ltd.
|
||||
*
|
||||
* 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.
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* Example usage: Reads maximum brightness value for user led and turns it
|
||||
* on/off depending on current state. Then sets led trigger
|
||||
@@ -36,7 +19,7 @@
|
||||
#include "mraa/led.h"
|
||||
|
||||
/* LED name */
|
||||
#define USER_LED "user1"
|
||||
#define USER_LED 0
|
||||
|
||||
/* trigger type */
|
||||
#define LED_TRIGGER "heartbeat"
|
||||
|
@@ -3,24 +3,7 @@
|
||||
* Contributors: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
|
||||
* 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.
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* Example usage: Generates PWM signal of period 200us with variable dutycyle
|
||||
* repeately. Press Ctrl+C to exit
|
||||
|
@@ -4,24 +4,7 @@
|
||||
* Contributors: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
|
||||
* 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.
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* Example usage: Display set of patterns on MAX7219 repeately.
|
||||
* Press Ctrl+C to exit
|
||||
|
@@ -4,24 +4,7 @@
|
||||
* Contributors: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
|
||||
* 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.
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* Example usage: Prints "Hello Mraa!" recursively. Press Ctrl+C to exit
|
||||
*
|
||||
|
@@ -2,24 +2,7 @@
|
||||
* Author: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
|
||||
* Copyright (c) 2018, Linaro Ltd.
|
||||
*
|
||||
* 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.
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* Example usage: Prints "Hello Mraa!" recursively. Press Ctrl+C to exit
|
||||
*
|
||||
|
@@ -2,24 +2,7 @@
|
||||
* Author: Jon Trulson <jtrulson@ics.com>
|
||||
* Copyright (c) 2016 Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* Example usage: Search and print the found OW device ID recursively.
|
||||
*
|
||||
|
@@ -4,24 +4,7 @@
|
||||
* Author: Petre Eftime <petre.p.eftime@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.
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
|
||||
|
@@ -5,24 +5,7 @@
|
||||
* Author: Petre Eftime <petre.p.eftime@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.
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
|
||||
|
@@ -9,24 +9,7 @@ import mraa.mraa;
|
||||
* Author: Jakub Kramarz <jkramarz@virtuslab.com>
|
||||
* Copyright (c) 2015 VirtusLab
|
||||
*
|
||||
* 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.
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
public class BlinkOnboard {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user