Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
2a682aaa65 |
7
.gitignore
vendored
7
.gitignore
vendored
@@ -1,5 +1,4 @@
|
||||
build/
|
||||
install/
|
||||
|
||||
# Object files
|
||||
*.o
|
||||
@@ -21,9 +20,3 @@ package.json
|
||||
binding.gyp
|
||||
READMEFIRST
|
||||
npm-debug.log
|
||||
|
||||
# Sonar
|
||||
.scannerwork/
|
||||
|
||||
# Visual Studio Code
|
||||
.vscode/
|
||||
|
6
.gitmodules
vendored
6
.gitmodules
vendored
@@ -1,8 +1,4 @@
|
||||
[submodule "doxygen2jsdoc"]
|
||||
path = doxygen2jsdoc
|
||||
url = https://github.com/intel-iot-devkit/doxygen2jsdoc.git
|
||||
branch = master
|
||||
[submodule "doxyport"]
|
||||
path = doxyport
|
||||
url = https://github.com/intel-iot-devkit/doxyport.git
|
||||
url = https://github.com/arfoll/doxygen2jsdoc.git
|
||||
branch = master
|
||||
|
153
.travis.yml
153
.travis.yml
@@ -1,102 +1,55 @@
|
||||
dist: trusty
|
||||
sudo: required
|
||||
|
||||
language: cpp
|
||||
|
||||
services:
|
||||
- docker
|
||||
|
||||
sudo: required
|
||||
dist: trusty
|
||||
env:
|
||||
- NODE010=true
|
||||
- NODE012=true
|
||||
- NODE4=true
|
||||
- NODE5=true
|
||||
- JSONPLAT=true NODE010=true
|
||||
- JSONPLAT=true NODE012=true
|
||||
- JSONPLAT=true NODE4=true
|
||||
- JSONPLAT=true NODE5=true
|
||||
# node010 npm builds don't work in clang and anyone using npm should want to
|
||||
# use something newer
|
||||
- NPM=true NODE4=true
|
||||
- NPM=true NODE5=true
|
||||
compiler:
|
||||
- clang
|
||||
- gcc
|
||||
before_install:
|
||||
- sudo rm /usr/local/bin/docker-compose
|
||||
- curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > docker-compose
|
||||
- chmod +x docker-compose
|
||||
- sudo mv docker-compose /usr/local/bin
|
||||
|
||||
jobs:
|
||||
fast_finish: true
|
||||
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
|
||||
before_script: docker-compose pull ${TARGET}
|
||||
script:
|
||||
- export CC=clang-3.8 CXX=clang++-3.8
|
||||
- docker-compose run ${TARGET}
|
||||
- BUILDARCH=MOCK docker-compose run ${TARGET}
|
||||
- if [[ ${TARGET} != *"node"* ]]; then JSONPLAT=ON docker-compose run ${TARGET}; fi
|
||||
- <<: *run-with-clang
|
||||
env: TARGET=python3
|
||||
- <<: *run-with-clang
|
||||
env: TARGET=node4
|
||||
- <<: *run-with-clang
|
||||
env: TARGET=node5
|
||||
- <<: *run-with-clang
|
||||
env: TARGET=node6
|
||||
- <<: *run-with-clang
|
||||
env: TARGET=java
|
||||
- &run-with-gcc-5
|
||||
stage: Gcc 5
|
||||
env: TARGET=python2
|
||||
before_script: docker-compose pull ${TARGET}
|
||||
script:
|
||||
- export CC=gcc-5 CXX=g++-5
|
||||
- docker-compose run ${TARGET}
|
||||
- BUILDARCH=MOCK docker-compose run ${TARGET}
|
||||
- if [[ ${TARGET} != *"node"* ]]; then JSONPLAT=ON docker-compose run ${TARGET}; fi
|
||||
- <<: *run-with-gcc-5
|
||||
env: TARGET=python3
|
||||
- <<: *run-with-gcc-5
|
||||
env: TARGET=node4
|
||||
- <<: *run-with-gcc-5
|
||||
env: TARGET=node5
|
||||
- <<: *run-with-gcc-5
|
||||
env: TARGET=node6
|
||||
- <<: *run-with-gcc-5
|
||||
env: TARGET=java
|
||||
- &run-with-gcc-6
|
||||
stage: Gcc 6
|
||||
env: TARGET=python2
|
||||
before_script: docker-compose pull ${TARGET}
|
||||
script:
|
||||
- export CC=gcc-6 CXX=g++-6
|
||||
- docker-compose run ${TARGET}
|
||||
- BUILDARCH=MOCK docker-compose run ${TARGET}
|
||||
- if [[ ${TARGET} != *"node"* ]]; then JSONPLAT=ON docker-compose run ${TARGET}; fi
|
||||
- <<: *run-with-gcc-6
|
||||
env: TARGET=python3
|
||||
- <<: *run-with-gcc-6
|
||||
env: TARGET=node4
|
||||
- <<: *run-with-gcc-6
|
||||
env: TARGET=node5
|
||||
- <<: *run-with-gcc-6
|
||||
env: TARGET=node6
|
||||
- <<: *run-with-gcc-6
|
||||
env: TARGET=java
|
||||
- &run-additional-jobs
|
||||
stage: Additional Jobs
|
||||
env: TARGET=doc
|
||||
before_script: docker-compose pull ${TARGET}
|
||||
script:
|
||||
- export CC=clang-3.8 CXX=clang++-3.8
|
||||
- docker-compose run ${TARGET}
|
||||
- <<: *run-additional-jobs
|
||||
env: TARGET=android
|
||||
- <<: *run-additional-jobs
|
||||
env: TARGET=examples
|
||||
- <<: *run-additional-jobs
|
||||
env: TARGET=usbplat
|
||||
- <<: *run-additional-jobs
|
||||
env: TARGET=firmata
|
||||
- <<: *run-additional-jobs
|
||||
env: TARGET=imraa
|
||||
- <<: *run-additional-jobs
|
||||
env: TARGET=ftdi4442
|
||||
- <<: *run-additional-jobs
|
||||
env: TARGET=sonar-scan
|
||||
# Via https://github.com/travis-ci/travis-ci/issues/5326
|
||||
- export PATH="$(echo $PATH | tr ':' "\n" | sed '/\/opt\/python/d' | tr "\n" ":" | sed "s|::|:|g")"
|
||||
install:
|
||||
- if [ "${NODE4}" ]; then export CC=gcc-4.8 CXX=g++-4.8; fi
|
||||
before_script:
|
||||
# Turn off JAVA SWIG for clang++, use 4.8 for all g++ builds
|
||||
- if [ "$CC" == "gcc" ]; then export BUILDJAVA=ON; export CC=gcc-4.8; export CXX=g++-4.8; else export BUILDJAVA=OFF; fi
|
||||
- if [ "${JSONPLAT}" ]; then export JSONPLAT=ON; else export JSONPLAT=OFF; fi
|
||||
- if [ "${NODE010}" ]; then nvm install 0.10; fi
|
||||
- if [ "${NODE012}" ]; then nvm install 0.12; fi
|
||||
- if [ "${NODE4}" ]; then nvm install 4.1; fi
|
||||
- if [ "${NODE5}" ]; then nvm install 5; fi
|
||||
- npm install node-gyp && export NODE_GYP="/home/travis/build/intel-iot-devkit/mraa/node_modules/node-gyp/bin/node-gyp.js"
|
||||
# Handle 0.10 NODE_ROOT_DIR differently than other versions
|
||||
- wget http://prdownloads.sourceforge.net/swig/swig-3.0.10.tar.gz && tar xf swig-3.0.10.tar.gz && cd swig-3.0.10 && ./configure --prefix=/home/travis/ && make && make install && cd ..
|
||||
script:
|
||||
- echo "CC=$CC BUILDJAVA=$BUILDJAVA JSONPLAT=$JSONPLAT NODE010=$NODE010 NODE012=$NODE012 NODE4=$NODE4 NODE5=$NODE5 NODE_ROOT_DIR=$NODE_ROOT_DIR"
|
||||
- if [ -z ${NPM} ]; then mkdir build && cd build && cmake -DBUILDSWIGJAVA="$BUILDJAVA" -DJSONPLAT=$JSONPLAT -DNODE_ROOT_DIR:PATH="${NVM_BIN}/.." -DCMAKE_INSTALL_PREFIX:PATH=../install -DSWIG_EXECUTABLE=/home/travis/bin/swig -DSWIG_DIR:PATH=/home/travis/share/swig/3.0.10/ .. && make install && make test; else mkdir build && cd build && cmake -DBUILDSWIGJAVA="$BUILDJAVA" -DJSONPLAT=$JSONPLAT -DNODE_ROOT_DIR:PATH="${NVM_BIN}/.." -DCMAKE_INSTALL_PREFIX:PATH=../install -DSWIG_EXECUTABLE=/home/travis/bin/swig -DSWIG_DIR:PATH=/home/travis/share/swig/3.0.10/ .. && make npmpkg && cd .. && ${NODE_GYP} configure && ${NODE_GYP} build; fi
|
||||
# simple test to see if we can load our node module
|
||||
- if [ ${NPM} ]; then cd build/Release/obj.target/ && node -e "var m = require('./mraa.node'); m.getVersion()";fi
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- kalakris-cmake
|
||||
packages:
|
||||
- g++-4.8
|
||||
- cmake
|
||||
- python
|
||||
- python-dev
|
||||
- python3
|
||||
- python3-dev
|
||||
- git
|
||||
- libjson0
|
||||
- libjson0-dev
|
||||
|
62
Android.mk
Normal file
62
Android.mk
Normal file
@@ -0,0 +1,62 @@
|
||||
# Copyright (C) 2015 Intel Corporation
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := libmraa
|
||||
LOCAL_CFLAGS += -Wno-unused-parameter -DX86PLAT=1
|
||||
LOCAL_SHARED_LIBRARIES := libcutils libutils libdl libc
|
||||
LOCAL_SRC_FILES := \
|
||||
src/mraa.c \
|
||||
src/gpio/gpio.c \
|
||||
src/i2c/i2c.c \
|
||||
src/pwm/pwm.c \
|
||||
src/spi/spi.c \
|
||||
src/aio/aio.c \
|
||||
src/uart/uart.c \
|
||||
src/x86/x86.c \
|
||||
src/iio/iio.c \
|
||||
src/x86/intel_galileo_rev_d.c \
|
||||
src/x86/intel_galileo_rev_g.c \
|
||||
src/x86/intel_edison_fab_c.c \
|
||||
src/x86/intel_de3815.c \
|
||||
src/x86/intel_nuc5.c \
|
||||
src/x86/intel_sofia_3gr.c \
|
||||
src/x86/intel_minnow_byt_compatible.c \
|
||||
src/x86/intel_cherryhills.c \
|
||||
src/x86/up.c \
|
||||
src/x86/intel_gt_tuchuck.c
|
||||
|
||||
# glob.c pulled in from NetBSD project (BSD 3-clause License)
|
||||
LOCAL_SRC_FILES += \
|
||||
src/glob/glob.c
|
||||
|
||||
LOCAL_C_INCLUDES := \
|
||||
$(LOCAL_PATH)/include \
|
||||
$(LOCAL_PATH)/include/linux \
|
||||
$(LOCAL_PATH)/include/x86 \
|
||||
$(LOCAL_PATH)/api \
|
||||
$(LOCAL_PATH)/api/mraa \
|
||||
$(LOCAL_PATH)/src/glob
|
||||
|
||||
LOCAL_EXPORT_C_INCLUDE_DIRS := \
|
||||
$(LOCAL_PATH)/api \
|
||||
$(LOCAL_PATH)/api/mraa
|
||||
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
180
CMakeLists.txt
180
CMakeLists.txt
@@ -1,89 +1,10 @@
|
||||
cmake_minimum_required (VERSION 2.8.11)
|
||||
project (mraa C CXX)
|
||||
cmake_minimum_required (VERSION 2.8)
|
||||
project (mraa C)
|
||||
|
||||
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)
|
||||
# https://github.com/delcypher/fp-bench/blob/master/CMakeLists.txt
|
||||
###############################################################################
|
||||
# Warnings for both the C and C++ compiler
|
||||
|
||||
set (MRAA_BOTH_WARNING_FLAGS
|
||||
-Wall
|
||||
-Werror=main
|
||||
-Wformat
|
||||
-Wmain
|
||||
-Wuninitialized
|
||||
-Winit-self
|
||||
)
|
||||
|
||||
# Warning flags for the C compiler only
|
||||
set (MRAA_C_WARNING_FLAGS
|
||||
-Werror=implicit
|
||||
-Werror=missing-parameter-type
|
||||
)
|
||||
|
||||
# Warning flags for the C++ compiler only
|
||||
set (MRAA_CXX_WARNING_FLAGS
|
||||
-Wnon-virtual-dtor
|
||||
-Woverloaded-virtual
|
||||
-Wreorder
|
||||
)
|
||||
|
||||
include (CheckCCompilerFlag)
|
||||
include (CheckCXXCompilerFlag)
|
||||
function (MRAA_SANITIZE_FLAG_NAME OUTPUT_VAR FLAG)
|
||||
string (REPLACE "-" "_" SANITIZED_FLAG_NAME "${FLAG}")
|
||||
string (REPLACE "/" "_" SANITIZED_FLAG_NAME "${SANITIZED_FLAG_NAME}")
|
||||
string (REPLACE "=" "_" SANITIZED_FLAG_NAME "${SANITIZED_FLAG_NAME}")
|
||||
string (REPLACE " " "_" SANITIZED_FLAG_NAME "${SANITIZED_FLAG_NAME}")
|
||||
set (${OUTPUT_VAR} "${SANITIZED_FLAG_NAME}" PARENT_SCOPE)
|
||||
endfunction ()
|
||||
|
||||
# Globally set C compiler warning flags that are supported and emit
|
||||
# a warning about unsupported flags
|
||||
foreach (flag ${MRAA_BOTH_WARNING_FLAGS} ${MRAA_C_WARNING_FLAGS})
|
||||
MRAA_SANITIZE_FLAG_NAME(SANITIZED_FLAG_NAME "${flag}")
|
||||
CHECK_C_COMPILER_FLAG("${flag}" HAS_C_${SANITIZED_FLAG_NAME})
|
||||
if (HAS_C_${SANITIZED_FLAG_NAME})
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flag}")
|
||||
else ()
|
||||
message (WARNING "C compiler does not support flag \"${flag}\"")
|
||||
endif ()
|
||||
endforeach ()
|
||||
|
||||
# Globally set C++ compiler warning flags that are supported and emit
|
||||
# a warning about unsupported flags
|
||||
foreach (flag ${MRAA_BOTH_WARNING_FLAGS} ${MRAA_CXX_WARNING_FLAGS})
|
||||
MRAA_SANITIZE_FLAG_NAME (SANITIZED_FLAG_NAME "${flag}")
|
||||
CHECK_CXX_COMPILER_FLAG ("${flag}" HAS_CXX_${SANITIZED_FLAG_NAME})
|
||||
if (HAS_CXX_${SANITIZED_FLAG_NAME})
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
|
||||
else ()
|
||||
message (WARNING "C++ compiler does not support flag \"${flag}\"")
|
||||
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_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -fno-omit-frame-pointer ")
|
||||
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wall ")
|
||||
|
||||
# Set CMAKE_INSTALL_LIBDIR if not defined
|
||||
include(GNUInstallDirs)
|
||||
@@ -110,7 +31,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 "v2.1.0")
|
||||
set (VERSION "v1.2.3-dirty")
|
||||
endif ()
|
||||
|
||||
message (STATUS "INFO - libmraa Version ${VERSION}")
|
||||
@@ -145,7 +66,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." OFF)
|
||||
option (BUILDSWIGNODE "Build swig node modules." ON)
|
||||
option (BUILDSWIGJAVA "Build Java API." OFF)
|
||||
option (USBPLAT "Detection USB platform." OFF)
|
||||
option (FIRMATA "Add Firmata support to mraa." OFF)
|
||||
@@ -153,10 +74,12 @@ 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 (INSTALLGPIOTOOL "Install gpio tool" OFF)
|
||||
option (INSTALLTOOLS "Install all tools" OFF)
|
||||
option (BUILDTESTS "Override the addition of tests" ON)
|
||||
option (USEPYTHON3TESTS "Force tests to run with python3" ON)
|
||||
|
||||
set (BUILDARCH "" CACHE STRING "Override architecture to build for")
|
||||
|
||||
@@ -169,7 +92,8 @@ if (NOT BUILDSWIG)
|
||||
endif()
|
||||
|
||||
if (NOT BUILDARCH)
|
||||
set (DETECTED_ARCH ${CMAKE_SYSTEM_PROCESSOR})
|
||||
include (TargetArch)
|
||||
target_architecture (DETECTED_ARCH)
|
||||
message (STATUS "INFO - Target arch is ${DETECTED_ARCH}")
|
||||
else ()
|
||||
set (DETECTED_ARCH ${BUILDARCH})
|
||||
@@ -179,16 +103,12 @@ 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.*" OR DETECTED_ARCH MATCHES "aarch64")
|
||||
elseif (DETECTED_ARCH MATCHES "arm.*")
|
||||
set (ARMPLAT ON)
|
||||
elseif (DETECTED_ARCH MATCHES "mips")
|
||||
set (MIPSPLAT ON)
|
||||
elseif (DETECTED_ARCH STREQUAL "MOCK")
|
||||
set (MOCKPLAT ON)
|
||||
elseif (DETECTED_ARCH STREQUAL "PERIPHERALMAN")
|
||||
set (PERIPHERALMAN ON)
|
||||
else ()
|
||||
message (FATAL_ERROR "Only x86, arm, mips, PERIPHERALMAN and mock platforms currently supported")
|
||||
message (FATAL_ERROR "Only x86, arm and mock platforms currently supported")
|
||||
endif()
|
||||
|
||||
if (BUILDSWIGPYTHON OR BUILDTESTS)
|
||||
@@ -197,8 +117,8 @@ endif ()
|
||||
|
||||
if (BUILDDOC)
|
||||
# add a target to generate API documentation with Doxygen
|
||||
find_package (Doxygen 1.8 REQUIRED)
|
||||
if (DOXYGEN_FOUND AND DOXYGEN_VERSION VERSION_GREATER "1.8")
|
||||
find_package (Doxygen)
|
||||
if (DOXYGEN_FOUND)
|
||||
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
|
||||
if (BUILDSWIGJAVA)
|
||||
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.java.in ${CMAKE_CURRENT_BINARY_DIR}/src/java/Doxyfile @ONLY)
|
||||
@@ -208,11 +128,69 @@ if (BUILDDOC)
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
COMMENT "Generating API documentation with Doxygen" VERBATIM
|
||||
)
|
||||
else ()
|
||||
message (SEND_ERROR "ERROR - Failed to find a compatible version of Doxygen. API doc will not be generated")
|
||||
endif (DOXYGEN_FOUND AND DOXYGEN_VERSION VERSION_GREATER "1.8")
|
||||
endif (DOXYGEN_FOUND)
|
||||
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)
|
||||
@@ -226,7 +204,3 @@ if (BUILDTESTS AND PYTHON_DEFAULT_EXECUTABLE)
|
||||
enable_testing ()
|
||||
add_subdirectory (tests)
|
||||
endif ()
|
||||
|
||||
if (INSTALLTOOLS)
|
||||
add_subdirectory (tools)
|
||||
endif()
|
||||
|
@@ -1,7 +1,7 @@
|
||||
Contributing to Eclipse Mraa (libmraa) {#contributing}
|
||||
Contributing to libmraa {#contributing}
|
||||
======================
|
||||
|
||||
Eclipse Mraa is an opensource project and we are actively looking for people to help
|
||||
libmraa is an opensource project and we are actively looking for people to help
|
||||
with:
|
||||
|
||||
- Writing platform supports for all types of boards running linux
|
||||
@@ -10,8 +10,7 @@ with:
|
||||
|
||||
The recommended method to contribute is to fork on github, and then send pull
|
||||
requests to the main project. You can open issues if you find any bugs/have
|
||||
questions. If you want to work on a large feature then we suggest you file an
|
||||
issue first so we can avoid dissapointments come merging time!
|
||||
questions.
|
||||
|
||||
If you'd rather not use github you are more than welcome to send git formatted
|
||||
patches to our mailing list mraa@lists.01.org which you can register for access
|
||||
@@ -43,34 +42,45 @@ job. Few exceptions to coding styles:
|
||||
|
||||
Use common sense and don't be afraid to challenge something if it doesn't make sense!
|
||||
|
||||
Author Rules
|
||||
Code signing
|
||||
------------
|
||||
|
||||
If you create a file, then add yourself as the Author at the top. If you did a
|
||||
large contribution to it (or if you want to ;-)), then fee free to add yourself
|
||||
to the contributors list in that file. You can also add your own copyright
|
||||
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.
|
||||
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:
|
||||
|
||||
Eclipse Contributor Agreement
|
||||
------------
|
||||
Developer's Certificate of Origin 1.1
|
||||
|
||||
Your contribution cannot be accepted unless you have a signed [ECA - Eclipse Foundation Contributor Agreement](http://www.eclipse.org/legal/ECA.php) in place.
|
||||
By making a contribution to this project, I certify that:
|
||||
|
||||
Here is the checklist for contributions to be _acceptable_:
|
||||
(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
|
||||
|
||||
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.
|
||||
(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
|
||||
|
||||
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.
|
||||
(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.)
|
||||
|
||||
Where to find us
|
||||
----------------
|
||||
|
2
COPYING
2
COPYING
@@ -1,5 +1,5 @@
|
||||
The MIT License (MIT)
|
||||
Copyright © 2014-2019 Intel Corporation and others
|
||||
Copyright © 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
|
||||
|
@@ -154,7 +154,7 @@ FULL_PATH_NAMES = YES
|
||||
# will be relative from the directory where doxygen is started.
|
||||
# This tag requires that the tag FULL_PATH_NAMES is set to YES.
|
||||
|
||||
STRIP_FROM_PATH = @PROJECT_SOURCE_DIR@
|
||||
STRIP_FROM_PATH =
|
||||
|
||||
# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the
|
||||
# path mentioned in the documentation of a class, which tells the reader which
|
||||
@@ -832,7 +832,7 @@ RECURSIVE = NO
|
||||
# Note that relative paths are relative to the directory from which doxygen is
|
||||
# run.
|
||||
|
||||
EXCLUDE = @CMAKE_CURRENT_SOURCE_DIR@/docs/index.java.md
|
||||
EXCLUDE =
|
||||
|
||||
# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
|
||||
# directories that are symbolic links (a Unix file system feature) are excluded
|
||||
@@ -866,9 +866,7 @@ EXCLUDE_SYMBOLS =
|
||||
# command).
|
||||
|
||||
EXAMPLE_PATH = @CMAKE_CURRENT_SOURCE_DIR@/examples/ \
|
||||
@CMAKE_CURRENT_SOURCE_DIR@/examples/c \
|
||||
@CMAKE_CURRENT_SOURCE_DIR@/examples/c++/ \
|
||||
@CMAKE_CURRENT_SOURCE_DIR@/examples/platform/ \
|
||||
@CMAKE_CURRENT_SOURCE_DIR@/docs/
|
||||
|
||||
# If the value of the EXAMPLE_PATH tag contains directories, you can use the
|
||||
|
@@ -756,9 +756,10 @@ WARN_LOGFILE =
|
||||
INPUT = @CMAKE_CURRENT_SOURCE_DIR@/api/ \
|
||||
@CMAKE_CURRENT_SOURCE_DIR@/api/mraa/ \
|
||||
@CMAKE_CURRENT_SOURCE_DIR@/docs/ \
|
||||
@CMAKE_CURRENT_SOURCE_DIR@/CONTRIBUTING.md \
|
||||
@CMAKE_CURRENT_SOURCE_DIR@/docs/CONTRIBUTING.md \
|
||||
@CMAKE_BINARY_DIR@/src/ \
|
||||
@CMAKE_CURRENT_SOURCE_DIR@/docs/index.java.md
|
||||
@CMAKE_CURRENT_SOURCE_DIR@/docs/index.java.md \
|
||||
@CMAKE_CURRENT_SOURCE_DIR@/README.md
|
||||
|
||||
# This tag can be used to specify the character encoding of the source files
|
||||
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
|
||||
@@ -796,7 +797,7 @@ RECURSIVE = YES
|
||||
# Note that relative paths are relative to the directory from which doxygen is
|
||||
# run.
|
||||
|
||||
EXCLUDE = @CMAKE_CURRENT_SOURCE_DIR@/docs/index.md
|
||||
EXCLUDE =
|
||||
|
||||
# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
|
||||
# directories that are symbolic links (a Unix file system feature) are excluded
|
||||
@@ -1809,6 +1810,18 @@ GENERATE_XML = YES
|
||||
|
||||
XML_OUTPUT = xml
|
||||
|
||||
# The XML_SCHEMA tag can be used to specify a XML schema, which can be used by a
|
||||
# validating XML parser to check the syntax of the XML files.
|
||||
# This tag requires that the tag GENERATE_XML is set to YES.
|
||||
|
||||
XML_SCHEMA =
|
||||
|
||||
# The XML_DTD tag can be used to specify a XML DTD, which can be used by a
|
||||
# validating XML parser to check the syntax of the XML files.
|
||||
# This tag requires that the tag GENERATE_XML is set to YES.
|
||||
|
||||
XML_DTD =
|
||||
|
||||
# If the XML_PROGRAMLISTING tag is set to YES doxygen will dump the program
|
||||
# listings (including syntax highlighting and cross-referencing information) to
|
||||
# the XML output. Note that enabling this will significantly increase the size
|
||||
|
116
README.md
116
README.md
@@ -1,11 +1,10 @@
|
||||
<p align="center">
|
||||
<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
|
||||
=============================================================================
|
||||
|
||||
Eclipse Mraa (Libmraa) is a C/C++ library with bindings to Java, Python and JavaScript to
|
||||
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,10 +15,7 @@ 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.
|
||||
|
||||
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)
|
||||
[](https://travis-ci.org/intel-iot-devkit/mraa)
|
||||
|
||||
Supported Boards
|
||||
================
|
||||
@@ -30,119 +26,55 @@ X86
|
||||
* [Galileo Gen 2 - Rev H](../master/docs/galileorevh.md)
|
||||
* [Edison](../master/docs/edison.md)
|
||||
* [Intel DE3815](../master/docs/intel_de3815.md)
|
||||
* [Minnowboard](../master/docs/minnow_max.md)
|
||||
* [Minnowboard Max](../master/docs/minnow_max.md)
|
||||
* [NUC 5th generation](../master/docs/intel_nuc5.md)
|
||||
* [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)
|
||||
* [Intel Grosse Tete](../master/docs/grossetete.md)
|
||||
|
||||
ARM
|
||||
---
|
||||
* [Raspberry Pi](../master/docs/raspberry_pi.md)
|
||||
* [Banana Pi](../master/docs/banana_pi.md)
|
||||
* [Bannana Pi](../master/docs/banana_pi.md)
|
||||
* [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
|
||||
---
|
||||
* [Linkit Smart 7688](../master/docs/linkit_7688.md)
|
||||
* [Onion Omega2](../master/docs/omega2.md)
|
||||
|
||||
FPGA
|
||||
----
|
||||
* [DE10-Nano](../master/docs/de_nano_soc.md)
|
||||
|
||||
USB
|
||||
---
|
||||
* [FT4222](../master/docs/ftdi_ft4222.md)
|
||||
* [Firmata](../master/docs/firmata.md)
|
||||
|
||||
I2C
|
||||
---
|
||||
* [GrovePi](../master/docs/grovepi.md)
|
||||
|
||||
Mock
|
||||
----
|
||||
* [Generic simulated board](../master/docs/mock.md)
|
||||
|
||||
JSON platform
|
||||
----
|
||||
* [Platform loading](../master/docs/jsonplatform.md)
|
||||
|
||||
Installing on your board
|
||||
========================
|
||||
========
|
||||
|
||||
Installing on Ubuntu
|
||||
--------------------
|
||||
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!
|
||||
|
||||
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 libmraa2 libmraa-dev libmraa-java python-mraa python3-mraa node-mraa mraa-tools
|
||||
``` bash
|
||||
echo "src mraa-upm http://iotdk.intel.com/repos/3.0/intelgalactic/opkg/i586" > /etc/opkg/mraa-upm.conf
|
||||
opkg update
|
||||
opkg install mraa
|
||||
```
|
||||
|
||||
Running MRAA tools or applications on Ubuntu systems requires elevated permissions
|
||||
(e.g. run with `sudo`).
|
||||
|
||||
Install on Arch Linux
|
||||
---------------------
|
||||
|
||||
There is an AUR package for mraa here: https://aur.archlinux.org/packages/mraa
|
||||
|
||||
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:
|
||||
If you would like to get the latest & greatest builds from master HEAD you can
|
||||
use our -dev repository
|
||||
|
||||
```bash
|
||||
sudo zypper install mraa mraa-devel
|
||||
echo "src mraa-upm http://iotdk.intel.com/repos/3.0/intelgalactic-dev/opkg/i586" > /etc/opkg/mraa-upm.conf
|
||||
opkg update
|
||||
opkg install mraa
|
||||
```
|
||||
|
||||
For ARM boards use:
|
||||
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
|
||||
REPO="openSUSE_Tumbleweed"
|
||||
if test "$(arch)" == "aarch64"; then
|
||||
REPO="openSUSE_Factory_ARM"
|
||||
fi
|
||||
sudo zypper ar http://download.opensuse.org/repositories/hardware/$REPO/hardware.repo
|
||||
sudo zypper in mraa
|
||||
npm install mraa
|
||||
```
|
||||
|
||||
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
|
||||
---------------------------
|
||||
|
||||
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.
|
||||
|
||||
For testing and development purposes it may be possible to share and install
|
||||
.deb and .rpm packages across similar Linux builds.
|
||||
|
||||
Compiling
|
||||
=========
|
||||
|
||||
|
@@ -19,8 +19,6 @@
|
||||
* 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 +34,6 @@ extern "C" {
|
||||
#include "mraa/i2c.h"
|
||||
#include "mraa/uart.h"
|
||||
#include "mraa/uart_ow.h"
|
||||
#include "mraa/led.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@@ -20,8 +20,6 @@
|
||||
* 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
|
||||
@@ -33,4 +31,3 @@
|
||||
#include "mraa/i2c.hpp"
|
||||
#include "mraa/spi.hpp"
|
||||
#include "mraa/uart.hpp"
|
||||
#include "mraa/led.hpp"
|
||||
|
@@ -20,8 +20,6 @@
|
||||
* 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
|
||||
@@ -32,7 +30,7 @@
|
||||
* AIO is the anlog input & output interface to libmraa. It is used to read or
|
||||
* set the voltage applied to an AIO pin.
|
||||
*
|
||||
* @snippet aio.c Interesting
|
||||
* @snippet analogin_a0.c Interesting
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -53,9 +51,7 @@ extern "C" {
|
||||
typedef struct _aio* mraa_aio_context;
|
||||
|
||||
/**
|
||||
* Initialise an Analog input device, connected to the specified pin. Aio pins
|
||||
* are always 0 indexed reguardless of their position. Check your board mapping
|
||||
* for details. An arduino style layout will have A0 as pin14 but AIO0.
|
||||
* Initialise an Analog input device, connected to the specified pin
|
||||
*
|
||||
* @param pin Channel number to read ADC inputs
|
||||
* @returns aio context or NULL
|
||||
|
@@ -20,8 +20,6 @@
|
||||
* 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 +36,7 @@ namespace mraa
|
||||
*
|
||||
* This file defines the aio interface for libmraa
|
||||
*
|
||||
* @snippet aio.cpp Interesting
|
||||
* @snippet AioA0.cpp Interesting
|
||||
*/
|
||||
class Aio
|
||||
{
|
||||
@@ -58,11 +56,9 @@ class Aio
|
||||
}
|
||||
/**
|
||||
* Aio Constructor, takes a pointer to the AIO context and initialises
|
||||
* the AIO class. Aio pins are always 0 indexed reguardless of their
|
||||
* position. Check your board mapping for details. An arduino style layout
|
||||
* will have A0 as pin14 but AIO0.
|
||||
* the AIO class
|
||||
*
|
||||
* @param aio_context void * to an AIO context
|
||||
* @param void * to an AIO context
|
||||
*/
|
||||
Aio(void* aio_context)
|
||||
{
|
||||
|
@@ -20,8 +20,6 @@
|
||||
* 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
|
||||
@@ -29,19 +27,13 @@
|
||||
#include <stdint.h>
|
||||
#include "types.h"
|
||||
|
||||
/** Max size off Mraa Platform name */
|
||||
#define MRAA_PLATFORM_NAME_MAX_SIZE 64
|
||||
/** Size off Mraa pin name */
|
||||
#define MRAA_PIN_NAME_SIZE 12
|
||||
|
||||
/** Bit Shift for Mraa sub platform */
|
||||
#define MRAA_SUB_PLATFORM_BIT_SHIFT 9
|
||||
/** Mask for Mraa sub platform */
|
||||
#define MRAA_SUB_PLATFORM_MASK (1<<MRAA_SUB_PLATFORM_BIT_SHIFT)
|
||||
|
||||
/** Mraa main platform offset */
|
||||
#define MRAA_MAIN_PLATFORM_OFFSET 0
|
||||
/** Mraa sub platform offset */
|
||||
#define MRAA_SUB_PLATFORM_OFFSET 1
|
||||
|
||||
/** Executes function func and returns its result in case of error
|
||||
@@ -52,17 +44,6 @@
|
||||
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
|
||||
*
|
||||
@@ -104,7 +85,7 @@ mraa_result_t mraa_init() __attribute__((constructor));
|
||||
* people who like super clean code. If dynamically loading & unloading
|
||||
* libmraa you need to call this before unloading the library.
|
||||
*/
|
||||
void mraa_deinit() __attribute__((destructor));
|
||||
void mraa_deinit();
|
||||
|
||||
/**
|
||||
* Checks if a pin is able to use the passed in mode.
|
||||
@@ -125,7 +106,7 @@ unsigned int mraa_adc_raw_bits();
|
||||
/**
|
||||
* Check the specified board's bit size when reading the value
|
||||
*
|
||||
* @param platform_offset specified platform offset; 0 for main platform, 1 for sub platform
|
||||
* @param specified platform offset; 0 for main platform, 1 foor sub platform
|
||||
* @return raw bits being read from kernel module. zero if no ADC
|
||||
*/
|
||||
unsigned int mraa_get_platform_adc_raw_bits(uint8_t platform_offset);
|
||||
@@ -140,7 +121,7 @@ unsigned int mraa_adc_supported_bits();
|
||||
/**
|
||||
* Return value that the raw value should be shifted to. Zero if no ADC
|
||||
*
|
||||
* @param platform_offset specified platform offset; 0 for main platform, 1 for sub platform
|
||||
* @param specified platform offset; 0 for main platform, 1 foor sub platform
|
||||
* @return return actual bit size the adc value should be understood as.
|
||||
*/
|
||||
unsigned int mraa_get_platform_adc_supported_bits(int platform_offset);
|
||||
@@ -165,7 +146,7 @@ const char* mraa_get_platform_name();
|
||||
* platform and can be NULL. platform_offset has to be given. Do not modify
|
||||
* this pointer
|
||||
*
|
||||
* @param platform_offset specified platform offset; 0 for main platform, 1 for sub platform
|
||||
* @param specified platform offset; 0 for main platform, 1 for sub platform
|
||||
* @return platform's versioning string
|
||||
*/
|
||||
const char* mraa_get_platform_version(int platform_offset);
|
||||
@@ -220,41 +201,6 @@ int mraa_get_platform_combined_type();
|
||||
*/
|
||||
unsigned int mraa_get_pin_count();
|
||||
|
||||
/**
|
||||
* Get the number of usable UARTs, board must be initialised.
|
||||
*
|
||||
* @return number of usable UARTs on the platform, returns -1 on failure.
|
||||
*/
|
||||
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();
|
||||
|
||||
/**
|
||||
* 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();
|
||||
|
||||
/**
|
||||
* 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();
|
||||
|
||||
/**
|
||||
* 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_count();
|
||||
|
||||
/**
|
||||
* Get platform usable I2C bus count, board must be initialised.
|
||||
*
|
||||
@@ -274,7 +220,7 @@ int mraa_get_i2c_bus_id(int i2c_bus);
|
||||
/**
|
||||
* Get specified platform pincount, board must be initialised.
|
||||
*
|
||||
* @param platform_offset specified platform offset; 0 for main platform, 1 for sub platform
|
||||
* @param specified platform offset; 0 for main platform, 1 foor sub platform
|
||||
* @return uint of physical pin count on the in-use platform
|
||||
*/
|
||||
unsigned int mraa_get_platform_pin_count(uint8_t platform_offset);
|
||||
@@ -287,46 +233,6 @@ unsigned int mraa_get_platform_pin_count(uint8_t platform_offset);
|
||||
*/
|
||||
char* mraa_get_pin_name(int pin);
|
||||
|
||||
/**
|
||||
* Get GPIO index by pin name, board must be initialised.
|
||||
*
|
||||
* @param pin_name: GPIO pin name. Eg: IO0
|
||||
* @return int of MRAA index for GPIO or -1 if not found.
|
||||
*/
|
||||
int mraa_gpio_lookup(const char* pin_name);
|
||||
|
||||
/**
|
||||
* Get I2C bus index by bus name, board must be initialised.
|
||||
*
|
||||
* @param i2c_name: I2C bus name. Eg: I2C6
|
||||
* @return int of MRAA index for I2C bus or -1 if not found.
|
||||
*/
|
||||
int mraa_i2c_lookup(const char* i2c_name);
|
||||
|
||||
/**
|
||||
* Get SPI bus index by bus name, board must be initialised.
|
||||
*
|
||||
* @param spi_name: Name of SPI bus. Eg: SPI2
|
||||
* @return int of MRAA index for SPI bus or -1 if not found.
|
||||
*/
|
||||
int mraa_spi_lookup(const char* spi_name);
|
||||
|
||||
/**
|
||||
* Get PWM index by PWM name, board must be initialised.
|
||||
*
|
||||
* @param pwm_name: Name of PWM. Eg:PWM0
|
||||
* @return int of MRAA index for PWM or -1 if not found.
|
||||
*/
|
||||
int mraa_pwm_lookup(const char* pwm_name);
|
||||
|
||||
/**
|
||||
* Get UART index by name, board must be initialised.
|
||||
*
|
||||
* @param uart_name: Name of UART. Eg:UART1
|
||||
* @return int of MRAA index for UART, or -1 if not found.
|
||||
*/
|
||||
int mraa_uart_lookup(const char* uart_name);
|
||||
|
||||
/**
|
||||
* Get default i2c bus, board must be initialised.
|
||||
*
|
||||
@@ -345,7 +251,7 @@ mraa_boolean_t mraa_has_sub_platform();
|
||||
/**
|
||||
* Check if pin or bus id includes sub platform mask.
|
||||
*
|
||||
* @param pin_or_bus_id pin or bus number
|
||||
* @param int pin or bus number
|
||||
*
|
||||
* @return mraa_boolean_t 1 if pin or bus is for sub platform, 0 otherwise
|
||||
*/
|
||||
@@ -354,7 +260,7 @@ mraa_boolean_t mraa_is_sub_platform_id(int pin_or_bus_id);
|
||||
/**
|
||||
* Convert pin or bus index to corresponding sub platform id.
|
||||
*
|
||||
* @param pin_or_bus_index pin or bus index
|
||||
* @param int pin or bus index
|
||||
*
|
||||
* @return int sub platform pin or bus number
|
||||
*/
|
||||
@@ -363,7 +269,7 @@ int mraa_get_sub_platform_id(int pin_or_bus_index);
|
||||
/**
|
||||
* Convert pin or bus sub platform id to index.
|
||||
*
|
||||
* @param pin_or_bus_id sub platform pin or bus id
|
||||
* @param int sub platform pin or bus id
|
||||
*
|
||||
* @return int pin or bus index
|
||||
*/
|
||||
@@ -372,17 +278,17 @@ int mraa_get_sub_platform_index(int pin_or_bus_id);
|
||||
/**
|
||||
* Add mraa subplatform
|
||||
*
|
||||
* @param subplatformtype subplatform type
|
||||
* @param dev uart device or i2c bus subplatform is on
|
||||
* @param subplatform type
|
||||
* @param uart device subplatform is on
|
||||
*
|
||||
* @return mraa_result_t indicating success
|
||||
*/
|
||||
mraa_result_t mraa_add_subplatform(mraa_platform_t subplatformtype, const char* dev);
|
||||
mraa_result_t mraa_add_subplatform(mraa_platform_t subplatformtype, const char* uart_dev);
|
||||
|
||||
/**
|
||||
* Remove a mraa subplatform
|
||||
*
|
||||
* @param subplatformtype subplatform type
|
||||
* @param subplatform type
|
||||
*
|
||||
* @return mraa_result indicating success
|
||||
*/
|
||||
@@ -395,7 +301,7 @@ mraa_result_t mraa_remove_subplatform(mraa_platform_t subplatformtype);
|
||||
* [io]-[raw]-[id]-[pin]
|
||||
* [io]-[raw]-[path]
|
||||
*
|
||||
* @param desc IO description
|
||||
* @param IO description
|
||||
*
|
||||
* @return void* to IO context or NULL
|
||||
*/
|
||||
@@ -404,7 +310,7 @@ void* mraa_init_io(const char* desc);
|
||||
/**
|
||||
* Instantiate an unknown board using a json file
|
||||
*
|
||||
* @param path Path to the json file, relative to the folder the program
|
||||
* @param Path to the json file, relative to the folder the program
|
||||
* was initially run in or a direct path
|
||||
*
|
||||
* @return mraa_result indicating success
|
||||
|
@@ -20,8 +20,6 @@
|
||||
* 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
|
||||
@@ -29,8 +27,6 @@
|
||||
#include "common.h"
|
||||
#include "types.hpp"
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
|
||||
/**
|
||||
* @namespace mraa namespace
|
||||
@@ -101,7 +97,7 @@ getPlatformType()
|
||||
/**
|
||||
* Print a textual representation of the mraa::Result
|
||||
*
|
||||
* @param result the Result to print
|
||||
* @param Result the Result to print
|
||||
*/
|
||||
inline void
|
||||
printError(Result result)
|
||||
@@ -145,31 +141,27 @@ adcSupportedBits()
|
||||
}
|
||||
|
||||
/**
|
||||
* Return platform name.
|
||||
* Return Platform Name. Returns NULL if no platform inited.
|
||||
*
|
||||
* @return platform name or empty string if not initialised
|
||||
* @return platform name
|
||||
*/
|
||||
inline std::string
|
||||
getPlatformName()
|
||||
{
|
||||
std::string ret_val;
|
||||
const char * pn = mraa_get_platform_name();
|
||||
if (pn) ret_val = pn;
|
||||
std::string ret_val(mraa_get_platform_name());
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return platform versioning info.
|
||||
* Return platform versioning info. Returns NULL if no info present.
|
||||
*
|
||||
* @param platform_offset optional subplatform identifier
|
||||
* @return platform versioning info or empty string if no info is present
|
||||
* @param optional subplatform identifier
|
||||
* @return platform versioning info
|
||||
*/
|
||||
inline std::string
|
||||
getPlatformVersion(int platform_offset=MRAA_MAIN_PLATFORM_OFFSET)
|
||||
{
|
||||
std::string ret_val;
|
||||
const char* pv = mraa_get_platform_version(platform_offset);
|
||||
if (pv) ret_val = pv;
|
||||
std::string ret_val(mraa_get_platform_version(platform_offset));
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
@@ -184,18 +176,6 @@ getPinCount()
|
||||
return mraa_get_pin_count();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get platform usable UART count, board must be initialised.
|
||||
*
|
||||
* @return number of usable UARTs on the current platform. Function will
|
||||
* return -1 on failure
|
||||
*/
|
||||
inline int
|
||||
getUartCount()
|
||||
{
|
||||
return mraa_get_uart_count();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get platform usable I2C bus count, board must be initialised.
|
||||
*
|
||||
@@ -225,122 +205,15 @@ getI2cBusId(int i2c_bus)
|
||||
*
|
||||
* @param pin number
|
||||
*
|
||||
* @return Pin name or empty string on failure
|
||||
* @return char* of pin name
|
||||
*/
|
||||
inline std::string
|
||||
getPinName(int pin)
|
||||
{
|
||||
std::string ret_val;
|
||||
const char* pn = mraa_get_pin_name(pin);
|
||||
if (pn) ret_val = pn;
|
||||
std::string ret_val(mraa_get_pin_name(pin));
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get GPIO index by pin name, board must be initialised.
|
||||
*
|
||||
* @param pin_name: GPIO pin name. Eg: IO0
|
||||
* @throws std::invalid_argument if name is not found
|
||||
* @return int of MRAA index for GPIO
|
||||
*/
|
||||
inline int
|
||||
getGpioLookup(std::string pin_name)
|
||||
{
|
||||
int index = mraa_gpio_lookup(pin_name.c_str());
|
||||
|
||||
if (index < 0){
|
||||
std::ostringstream oss;
|
||||
oss << "Gpio name " << pin_name << " is not valid";
|
||||
throw std::invalid_argument(oss.str());
|
||||
}
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get I2C bus index by bus name, board must be initialised.
|
||||
*
|
||||
* @param i2c_name: I2C bus name. Eg: I2C6
|
||||
* @throws std::invalid_argument if name is not found
|
||||
* @return int of MRAA index for I2C bus
|
||||
*/
|
||||
inline int
|
||||
getI2cLookup(std::string i2c_name)
|
||||
{
|
||||
int index = mraa_i2c_lookup(i2c_name.c_str());
|
||||
|
||||
if (index < 0){
|
||||
std::ostringstream oss;
|
||||
oss << "i2c name " << i2c_name << " is not valid";
|
||||
throw std::invalid_argument(oss.str());
|
||||
}
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get SPI bus index by bus name, board must be initialised.
|
||||
*
|
||||
* @param spi_name: Name of SPI bus. Eg: SPI2
|
||||
* @throws std::invalid_argument if name is not found
|
||||
* @return int of MRAA index for SPI bus
|
||||
*/
|
||||
inline int
|
||||
getSpiLookup(std::string spi_name)
|
||||
{
|
||||
int index = mraa_spi_lookup(spi_name.c_str());
|
||||
|
||||
if (index < 0){
|
||||
std::ostringstream oss;
|
||||
oss << "Spi name " << spi_name << " is not valid";
|
||||
throw std::invalid_argument(oss.str());
|
||||
}
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get PWM index by PWM name, board must be initialised.
|
||||
*
|
||||
* @param pwm_name: Name of PWM. Eg:PWM0
|
||||
* @throws std::invalid_argument if name is not found
|
||||
* @return int of MRAA index for PWM
|
||||
*/
|
||||
inline int
|
||||
getPwmLookup(std::string pwm_name)
|
||||
{
|
||||
int index = mraa_pwm_lookup(pwm_name.c_str());
|
||||
|
||||
if (index < 0){
|
||||
std::ostringstream oss;
|
||||
oss << "PWM name " << pwm_name << " is not valid";
|
||||
throw std::invalid_argument(oss.str());
|
||||
}
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get UART index by UART name, board must be initialised.
|
||||
*
|
||||
* @param uart_name: Name of the UART. Eg: UART2
|
||||
* @throws std::invalid_argument if name is not found
|
||||
* @return MRAA index for the UART
|
||||
*/
|
||||
inline int
|
||||
getUartLookup(std::string uart_name)
|
||||
{
|
||||
int index = mraa_uart_lookup(uart_name.c_str());
|
||||
|
||||
if (index < 0) {
|
||||
std::ostringstream oss;
|
||||
oss << "UART name " << uart_name << " is not valid";
|
||||
throw std::invalid_argument(oss.str());
|
||||
}
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the log level to use from 0-7 where 7 is very verbose. These are the
|
||||
* syslog log levels, see syslog(3) for more information on the levels.
|
||||
@@ -368,7 +241,7 @@ hasSubPlatform()
|
||||
/**
|
||||
* Check if pin or bus id includes sub platform mask.
|
||||
*
|
||||
* @param pin_or_bus_id pin or bus number
|
||||
* @param int pin or bus number
|
||||
*
|
||||
* @return mraa_boolean_t 1 if pin or bus is for sub platform, 0 otherwise
|
||||
*/
|
||||
@@ -381,7 +254,7 @@ isSubPlatformId(int pin_or_bus_id)
|
||||
/**
|
||||
* Convert pin or bus index to corresponding sub platform id.
|
||||
*
|
||||
* @param pin_or_bus_index pin or bus index
|
||||
* @param int pin or bus index
|
||||
*
|
||||
* @return int sub platform pin or bus number
|
||||
*/
|
||||
@@ -394,7 +267,7 @@ getSubPlatformId(int pin_or_bus_index)
|
||||
/**
|
||||
* Convert pin or bus sub platform id to index.
|
||||
*
|
||||
* @param pin_or_bus_id sub platform pin or bus id
|
||||
* @param int sub platform pin or bus id
|
||||
*
|
||||
* @return int pin or bus index
|
||||
*/
|
||||
@@ -407,7 +280,7 @@ getSubPlatformIndex(int pin_or_bus_id)
|
||||
/**
|
||||
* Get default i2c bus, board must be initialised.
|
||||
*
|
||||
* @param platform_offset optional subplatform identifier
|
||||
* @param optional subplatform identifier
|
||||
* @return default i2c bus for paltform
|
||||
*/
|
||||
inline int
|
||||
@@ -420,23 +293,16 @@ getDefaultI2cBus(int platform_offset=MRAA_MAIN_PLATFORM_OFFSET)
|
||||
* Add mraa subplatform
|
||||
*
|
||||
* @param subplatformtype the type of subplatform to add
|
||||
* (e.g. MRAA_GENERIC_FIRMATA or MRAA_GROVEPI)
|
||||
* @param dev subplatform uart device string or i2c bus number (e.g. "/dev/ttyACM0" or "0")
|
||||
* (e.g. MRAA_GENERIC_FIRMATA)
|
||||
* @param uart_dev subplatform device string (e.g. "/dev/ttyACM0")
|
||||
* @return Result of operation
|
||||
*/
|
||||
inline Result
|
||||
addSubplatform(Platform subplatformtype, std::string dev)
|
||||
addSubplatform(Platform subplatformtype, std::string uart_dev)
|
||||
{
|
||||
return (Result) mraa_add_subplatform((mraa_platform_t) subplatformtype, dev.c_str());
|
||||
return (Result) mraa_add_subplatform((mraa_platform_t) subplatformtype, uart_dev.c_str());
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove mraa subplatform
|
||||
*
|
||||
* @param subplatformtype the type of subplatform to remove
|
||||
* (e.g. MRAA_GENERIC_FIRMATA)
|
||||
* @return Result of operation
|
||||
*/
|
||||
inline Result
|
||||
removeSubplatform(Platform subplatformtype)
|
||||
{
|
||||
@@ -450,7 +316,7 @@ removeSubplatform(Platform subplatformtype)
|
||||
* [io]-[raw]-[id]-[pin]
|
||||
* [io]-[raw]-[path]
|
||||
*
|
||||
* @param desc description
|
||||
* @param IO description
|
||||
*
|
||||
* @return class T initialised using pointer to IO or NULL
|
||||
*/
|
||||
@@ -464,7 +330,7 @@ initIo(std::string desc)
|
||||
/**
|
||||
* Instantiate an unknown board using a json file
|
||||
*
|
||||
* @param path Path to the json file, relative to the folder the program
|
||||
* @param Path to the json file, relative to the folder the program
|
||||
* was initially run in or a direct path
|
||||
*
|
||||
* @return Result indicating success
|
||||
|
@@ -20,8 +20,6 @@
|
||||
* 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
|
||||
@@ -54,7 +52,7 @@ typedef struct _firmata* mraa_firmata_context;
|
||||
* Initialise firmata context on a feature. This feature is what will be
|
||||
* listened on if you request a response callback
|
||||
*
|
||||
* @param feature firmata feature
|
||||
* @param firmata feature
|
||||
* @return firmata context or NULL
|
||||
*/
|
||||
mraa_firmata_context mraa_firmata_init(int feature);
|
||||
|
136
api/mraa/gpio.h
136
api/mraa/gpio.h
@@ -20,8 +20,6 @@
|
||||
* 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
|
||||
@@ -35,7 +33,7 @@
|
||||
* through sysfs), or memory mapped IO via a /dev/uio device or /dev/mem
|
||||
* depending again on the board configuration.
|
||||
*
|
||||
* @snippet gpio.c Interesting
|
||||
* @snippet gpio_read6.c Interesting
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -48,7 +46,9 @@ extern "C" {
|
||||
|
||||
#if defined(SWIGJAVA) || defined(JAVACALLBACK)
|
||||
#include <jni.h>
|
||||
void mraa_java_isr_callback(void *args);
|
||||
extern "C" {
|
||||
void mraa_java_isr_callback(void *args);
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -63,10 +63,7 @@ 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_GPIOD_ACTIVE_LOW = 4,
|
||||
MRAA_GPIOD_OPEN_DRAIN = 5,
|
||||
MRAA_GPIOD_OPEN_SOURCE = 6,
|
||||
MRAA_GPIO_HIZ = 3 /**< High Z State */
|
||||
} mraa_gpio_mode_t;
|
||||
|
||||
/**
|
||||
@@ -89,35 +86,6 @@ typedef enum {
|
||||
MRAA_GPIO_EDGE_FALLING = 3 /**< Interrupt on falling only */
|
||||
} mraa_gpio_edge_t;
|
||||
|
||||
/**
|
||||
* Gpio input modes
|
||||
*/
|
||||
typedef enum {
|
||||
MRAA_GPIO_ACTIVE_HIGH = 0, /**< Resistive High */
|
||||
MRAA_GPIO_ACTIVE_LOW = 1, /**< Resistive Low */
|
||||
} mraa_gpio_input_mode_t;
|
||||
|
||||
|
||||
/**
|
||||
* Gpio output driver modes
|
||||
*/
|
||||
typedef enum {
|
||||
MRAA_GPIO_OPEN_DRAIN = 0, /**< Open Drain Configuration */
|
||||
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
|
||||
*
|
||||
@@ -126,24 +94,6 @@ typedef mraa_gpio_event* mraa_gpio_events_t;
|
||||
*/
|
||||
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
|
||||
*
|
||||
@@ -162,10 +112,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(s).
|
||||
* Set an interrupt on pin
|
||||
*
|
||||
* @param dev The Gpio context
|
||||
* @param edge The edge mode to set the gpio(s) into
|
||||
* @param edge The edge mode to set the gpio into
|
||||
* @param fptr Function pointer to function to be called when interrupt is
|
||||
* triggered
|
||||
* @param args Arguments passed to the interrupt handler (fptr)
|
||||
@@ -173,19 +123,9 @@ 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(only for sysfs interface).
|
||||
* to MRAA_GPIO_EDGE_NONE
|
||||
*
|
||||
* @param dev The Gpio context
|
||||
* @return Result of operation
|
||||
@@ -193,36 +133,35 @@ mraa_gpio_events_t mraa_gpio_get_events(mraa_gpio_context dev);
|
||||
mraa_result_t mraa_gpio_isr_exit(mraa_gpio_context dev);
|
||||
|
||||
/**
|
||||
* Set Gpio(s) Output Mode,
|
||||
* Set Gpio Output Mode,
|
||||
*
|
||||
* @param dev The Gpio context
|
||||
* @param mode The Gpio(s) Output Mode
|
||||
* @param mode The Gpio Output Mode
|
||||
* @return Result of operation
|
||||
*/
|
||||
mraa_result_t mraa_gpio_mode(mraa_gpio_context dev, mraa_gpio_mode_t mode);
|
||||
|
||||
/**
|
||||
* Set Gpio(s) direction
|
||||
* Set Gpio direction
|
||||
*
|
||||
* @param dev The Gpio context
|
||||
* @param dir The direction of the Gpio(s)
|
||||
* @param dir The direction of the Gpio
|
||||
* @return Result of operation
|
||||
*/
|
||||
mraa_result_t mraa_gpio_dir(mraa_gpio_context dev, mraa_gpio_dir_t dir);
|
||||
|
||||
/**
|
||||
* Read Gpio(s) direction
|
||||
* Read Gpio direction
|
||||
*
|
||||
* @param dev The Gpio context
|
||||
* @param dir The address where to store the Gpio(s) direction
|
||||
* @param dir The address where to store the Gpio 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 - sysfs interface.
|
||||
* - Will free up the memory used by context and close related file descriptors - chardev interface.
|
||||
* - Will free the memory for the context and unexport the Gpio
|
||||
*
|
||||
* @param dev The Gpio context
|
||||
* @return Result of operation
|
||||
@@ -238,16 +177,6 @@ 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.
|
||||
*
|
||||
@@ -257,17 +186,6 @@ mraa_result_t mraa_gpio_read_multi(mraa_gpio_context dev, int output_values[]);
|
||||
*/
|
||||
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.
|
||||
*
|
||||
@@ -278,15 +196,13 @@ mraa_result_t mraa_gpio_write_multi(mraa_gpio_context dev, int input_values[]);
|
||||
mraa_result_t mraa_gpio_owner(mraa_gpio_context dev, mraa_boolean_t owner);
|
||||
|
||||
/**
|
||||
* Enable using memory mapped io instead of sysfs, chardev based I/O can be
|
||||
* considered memorymapped
|
||||
* Enable using memory mapped io instead of sysfs
|
||||
*
|
||||
* @deprecated
|
||||
* @param dev The Gpio context
|
||||
* @param mmap Use mmap instead of sysfs
|
||||
* @return Result of operation
|
||||
*/
|
||||
DEPRECATED mraa_result_t mraa_gpio_use_mmaped(mraa_gpio_context dev, mraa_boolean_t mmap);
|
||||
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
|
||||
@@ -304,24 +220,6 @@ int mraa_gpio_get_pin(mraa_gpio_context dev);
|
||||
*/
|
||||
int mraa_gpio_get_pin_raw(mraa_gpio_context dev);
|
||||
|
||||
/**
|
||||
* Set Gpio input mode
|
||||
*
|
||||
* @param dev The Gpio context
|
||||
* @param mode Mode to set input pin state
|
||||
* @return Result of operation
|
||||
*/
|
||||
mraa_result_t mraa_gpio_input_mode(mraa_gpio_context dev, mraa_gpio_input_mode_t mode);
|
||||
|
||||
/**
|
||||
* Set Gpio output driver mode. This is not a standard feature, it needs custom implementation for each board
|
||||
*
|
||||
* @param dev The Gpio context
|
||||
* @param mode Set output driver mode
|
||||
* @return Result of operation
|
||||
*/
|
||||
mraa_result_t mraa_gpio_out_driver_mode(mraa_gpio_context dev, mraa_gpio_out_driver_mode_t mode);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@@ -20,8 +20,6 @@
|
||||
* 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
|
||||
@@ -71,28 +69,12 @@ typedef enum {
|
||||
EDGE_FALLING = 3 /**< Interrupt on falling only */
|
||||
} Edge;
|
||||
|
||||
/**
|
||||
* Gpio Input modes
|
||||
*/
|
||||
typedef enum {
|
||||
MODE_IN_ACTIVE_HIGH = 0, /**< Resistive High */
|
||||
MODE_IN_ACTIVE_LOW = 1, /**< Resistive Low */
|
||||
} InputMode;
|
||||
|
||||
/**
|
||||
* Gpio output driver modes
|
||||
*/
|
||||
typedef enum {
|
||||
MODE_OUT_OPEN_DRAIN = 0, /**< Open Drain Configuration */
|
||||
MODE_OUT_PUSH_PULL = 1, /**< Push Pull Configuration */
|
||||
} OutputMode;
|
||||
|
||||
/**
|
||||
* @brief API to General Purpose IO
|
||||
*
|
||||
* This file defines the gpio interface for libmraa
|
||||
*
|
||||
* @snippet gpio.cpp Interesting
|
||||
* @snippet Blink-IO.cpp Interesting
|
||||
*/
|
||||
class Gpio
|
||||
{
|
||||
@@ -129,7 +111,7 @@ class Gpio
|
||||
* Gpio Constructor, takes a pointer to the GPIO context and initialises
|
||||
* the GPIO class
|
||||
*
|
||||
* @param gpio_context void * to GPIO context
|
||||
* @param void * to GPIO context
|
||||
*/
|
||||
Gpio(void* gpio_context)
|
||||
{
|
||||
@@ -334,30 +316,6 @@ class Gpio
|
||||
return mraa_gpio_get_pin(m_gpio);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change Gpio input mode
|
||||
*
|
||||
* @param mode The mode to change the gpio input
|
||||
* @return Result of operation
|
||||
*/
|
||||
Result
|
||||
inputMode(InputMode mode)
|
||||
{
|
||||
return (Result )mraa_gpio_input_mode(m_gpio, (mraa_gpio_input_mode_t) mode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change Gpio output driver mode
|
||||
*
|
||||
* @param mode Set output driver mode
|
||||
* @return Result of operation
|
||||
*/
|
||||
Result
|
||||
outputMode(OutputMode mode)
|
||||
{
|
||||
return (Result) mraa_gpio_out_driver_mode(m_gpio, (mraa_gpio_out_driver_mode_t) mode);
|
||||
}
|
||||
|
||||
private:
|
||||
mraa_gpio_context m_gpio;
|
||||
#if defined(SWIGJAVASCRIPT)
|
||||
|
@@ -20,8 +20,6 @@
|
||||
* 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
|
||||
@@ -34,7 +32,7 @@
|
||||
* communicate to multiple i2c slaves by configuring the address.
|
||||
* @htmlinclude i2c.txt
|
||||
*
|
||||
* @snippet i2c_hmc5883l.c Interesting
|
||||
* @snippet i2c_HMC5883L.c Interesting
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@@ -20,8 +20,6 @@
|
||||
* 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,14 +38,14 @@ namespace mraa
|
||||
* selecting the correct address
|
||||
* @htmlinclude i2c.txt
|
||||
*
|
||||
* @snippet i2c.cpp Interesting
|
||||
* @snippet I2c-compass.cpp Interesting
|
||||
*/
|
||||
class I2c
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Instantiates an i2c bus. Multiple instances of the same bus can
|
||||
* exist and the bus is not guaranteed to be on the correct address
|
||||
* exist and the bus is not guarranteed to be on the correct address
|
||||
* before read/write.
|
||||
*
|
||||
* @param bus The i2c bus to use
|
||||
@@ -67,7 +65,7 @@ class I2c
|
||||
/**
|
||||
* I2C constructor, takes a pointer to a I2C context and initialises the I2C class
|
||||
*
|
||||
* @param i2c_context void * to an I2C context
|
||||
* @param void * to an I2C context
|
||||
*/
|
||||
I2c(void* i2c_context)
|
||||
{
|
||||
@@ -78,7 +76,7 @@ class I2c
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes the I2c Bus used. This does not guarantee the bus will not
|
||||
* Closes the I2c Bus used. This does not guarrantee the bus will not
|
||||
* be usable by anyone else or communicates this disconnect to any
|
||||
* slaves.
|
||||
*/
|
||||
|
171
api/mraa/iio.h
171
api/mraa/iio.h
@@ -20,8 +20,6 @@
|
||||
* 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
|
||||
@@ -29,37 +27,22 @@
|
||||
#include "common.h"
|
||||
#include "iio_kernel_headers.h"
|
||||
|
||||
/** Mraa Iio Channels */
|
||||
typedef struct {
|
||||
/** Channel index */
|
||||
int index;
|
||||
/** Channel enabled/disabled */
|
||||
int enabled;
|
||||
/** Channel type */
|
||||
char* type;
|
||||
/** Channel endianes */
|
||||
mraa_boolean_t lendian;
|
||||
/** Channel signed */
|
||||
int signedd;
|
||||
/** Channel offset */
|
||||
unsigned int offset;
|
||||
/** Channel mask */
|
||||
uint64_t mask;
|
||||
/** Channel used bits */
|
||||
unsigned int bits_used;
|
||||
/** Channel bytes */
|
||||
unsigned int bytes;
|
||||
/** Channel shift */
|
||||
unsigned int shift;
|
||||
/** Channel location */
|
||||
unsigned int location;
|
||||
} mraa_iio_channel;
|
||||
|
||||
/** Mraa Iio Event */
|
||||
typedef struct {
|
||||
/** Event name */
|
||||
char* name;
|
||||
/** Event enabled/disabled */
|
||||
int enabled;
|
||||
} mraa_iio_event;
|
||||
|
||||
@@ -69,7 +52,7 @@ typedef struct {
|
||||
*
|
||||
* An iio context represents an IIO device
|
||||
*
|
||||
* @snippet iio.c Interesting
|
||||
* @snippet iio_driver.c Interesting
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -91,171 +74,44 @@ typedef struct _iio* mraa_iio_context;
|
||||
/**
|
||||
* Initialise iio context
|
||||
*
|
||||
* @param device iio device to use
|
||||
* @param bus iio device to use
|
||||
* @return i2c context or NULL
|
||||
*/
|
||||
mraa_iio_context mraa_iio_init(int device);
|
||||
|
||||
/**
|
||||
* Trigger buffer
|
||||
*
|
||||
* @param dev The iio context
|
||||
* @param fptr Callback
|
||||
* @param args Arguments
|
||||
* @return Result of operation
|
||||
*/
|
||||
mraa_result_t mraa_iio_trigger_buffer(mraa_iio_context dev, void (*fptr)(char*, void*), void* args);
|
||||
mraa_result_t mraa_iio_trigger_buffer(mraa_iio_context dev, void (*fptr)(char* data), void* args);
|
||||
|
||||
/**
|
||||
* Get device name
|
||||
*
|
||||
* @param dev The iio context
|
||||
* @return Name of the device
|
||||
*/
|
||||
const char* mraa_iio_get_device_name(mraa_iio_context dev);
|
||||
|
||||
/**
|
||||
* Get device number
|
||||
*
|
||||
* @param name Name of the device
|
||||
* @return Device Number
|
||||
*/
|
||||
int mraa_iio_get_device_num_by_name(const char* name);
|
||||
|
||||
/**
|
||||
* Read size
|
||||
*
|
||||
* @param dev The iio context
|
||||
* @return Size
|
||||
*/
|
||||
int mraa_iio_read_size(mraa_iio_context dev);
|
||||
|
||||
/**
|
||||
* Get channels
|
||||
*
|
||||
* @param dev The iio context
|
||||
* @return Channels
|
||||
*/
|
||||
mraa_iio_channel* mraa_iio_get_channels(mraa_iio_context dev);
|
||||
|
||||
/**
|
||||
* Get channels count
|
||||
*
|
||||
* @param dev The iio context
|
||||
* @return Channels count
|
||||
*/
|
||||
int mraa_iio_get_channel_count(mraa_iio_context dev);
|
||||
|
||||
/**
|
||||
* Read float from file
|
||||
*
|
||||
* @param dev The iio context
|
||||
* @param filename Filename
|
||||
* @param data Data
|
||||
* @return Result of operation
|
||||
*/
|
||||
mraa_result_t mraa_iio_read_float(mraa_iio_context dev, const char* filename, float* data);
|
||||
|
||||
/**
|
||||
* Read int from file
|
||||
*
|
||||
* @param dev The iio context
|
||||
* @param filename Filename
|
||||
* @param data Data
|
||||
* @return Result of operation
|
||||
*/
|
||||
mraa_result_t mraa_iio_read_int(mraa_iio_context dev, const char* filename, int* data);
|
||||
|
||||
/**
|
||||
* Read String from file
|
||||
*
|
||||
* @param dev The iio context
|
||||
* @param filename Filename
|
||||
* @param data Data
|
||||
* @param max_len Max lenght to read
|
||||
* @return Result of operation
|
||||
*/
|
||||
mraa_result_t mraa_iio_read_string(mraa_iio_context dev, const char* filename, char* data, int max_len);
|
||||
|
||||
/**
|
||||
* Write float
|
||||
*
|
||||
* @param dev The iio context
|
||||
* @param attr_chan Channel attributes
|
||||
* @param data Float to write
|
||||
* @return Result of operation
|
||||
*/
|
||||
mraa_result_t mraa_iio_write_float(mraa_iio_context dev, const char* attr_chan, const float data);
|
||||
|
||||
/**
|
||||
* Write int
|
||||
*
|
||||
* @param dev The iio context
|
||||
* @param attr_chan Channel attributes
|
||||
* @param data Int to write
|
||||
* @return Result of operation
|
||||
*/
|
||||
mraa_result_t mraa_iio_write_int(mraa_iio_context dev, const char* attr_chan, const int data);
|
||||
|
||||
/**
|
||||
* Write string
|
||||
*
|
||||
* @param dev The iio context
|
||||
* @param attr_chan Channel attributes
|
||||
* @param data String to write
|
||||
* @return Result of operation
|
||||
*/
|
||||
mraa_result_t mraa_iio_write_string(mraa_iio_context dev, const char* attr_chan, const char* data);
|
||||
|
||||
/**
|
||||
* Get channel data
|
||||
*
|
||||
* @param dev The iio context
|
||||
* @return Result of operation
|
||||
*/
|
||||
mraa_result_t mraa_iio_get_channel_data(mraa_iio_context dev);
|
||||
|
||||
/**
|
||||
* Get event data
|
||||
*
|
||||
* @param dev The iio context
|
||||
* @return Result of operation
|
||||
*/
|
||||
mraa_result_t mraa_iio_get_event_data(mraa_iio_context dev);
|
||||
|
||||
/**
|
||||
* Event poll
|
||||
*
|
||||
* @param dev The iio context
|
||||
* @param data Data
|
||||
* @return Result of operation
|
||||
*/
|
||||
mraa_result_t mraa_iio_event_poll(mraa_iio_context dev, struct iio_event_data* data);
|
||||
|
||||
/**
|
||||
* Setup event callback
|
||||
*
|
||||
* @param dev The iio context
|
||||
* @param fptr Callback
|
||||
* @param args Arguments
|
||||
* @return Result of operation
|
||||
*/
|
||||
mraa_result_t
|
||||
mraa_iio_event_setup_callback(mraa_iio_context dev, void (*fptr)(struct iio_event_data* data, void* args), void* args);
|
||||
|
||||
/**
|
||||
* Extract event
|
||||
*
|
||||
* @param event Event
|
||||
* @param chan_type Channel type
|
||||
* @param modifier Modifier
|
||||
* @param type Type
|
||||
* @param direction Direction
|
||||
* @param channel Channel
|
||||
* @param channel2 Channel2
|
||||
* @param different Different
|
||||
* @return Result of operation
|
||||
*/
|
||||
mraa_result_t mraa_iio_event_extract_event(struct iio_event_data* event,
|
||||
int* chan_type,
|
||||
int* modifier,
|
||||
@@ -265,32 +121,11 @@ mraa_result_t mraa_iio_event_extract_event(struct iio_event_data* event,
|
||||
int* channel2,
|
||||
int* different);
|
||||
|
||||
/**
|
||||
* Get mount matrix
|
||||
* @param dev The iio context
|
||||
* @param sysfs_name Sysfs name
|
||||
* @param mm Matrix
|
||||
* @return Result of operation
|
||||
*/
|
||||
mraa_result_t mraa_iio_get_mount_matrix(mraa_iio_context dev, const char *sysfs_name, float mm[9]);
|
||||
|
||||
/**
|
||||
* Create trigger
|
||||
*
|
||||
* @param dev The iio context
|
||||
* @param trigger Trigger name
|
||||
* @return Result of operation
|
||||
*/
|
||||
mraa_result_t mraa_iio_create_trigger(mraa_iio_context dev, const char* trigger);
|
||||
|
||||
/**
|
||||
* Update channels
|
||||
*
|
||||
* @param dev The iio context
|
||||
* @return Result of operation
|
||||
*/
|
||||
mraa_result_t mraa_iio_update_channels(mraa_iio_context dev);
|
||||
|
||||
/**
|
||||
* De-inits an mraa_iio_context device
|
||||
*
|
||||
|
@@ -20,46 +20,33 @@
|
||||
* 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 {
|
||||
/** Channel Type */
|
||||
struct IioEventData
|
||||
{
|
||||
int channelType;
|
||||
/** Modifier */
|
||||
int modifier;
|
||||
/** Type */
|
||||
int type;
|
||||
/** Direction */
|
||||
int direction;
|
||||
/** Channel */
|
||||
int channel;
|
||||
/** Channel 2 */
|
||||
int channel2;
|
||||
/** Difference */
|
||||
int diff;
|
||||
};
|
||||
|
||||
/** Iio Handler */
|
||||
class IioHandler
|
||||
{
|
||||
public:
|
||||
/** onIioEvent Handler */
|
||||
virtual void onIioEvent(const IioEventData& eventData) = 0;
|
||||
/** Destructor */
|
||||
virtual ~IioHandler(){}; // add an empty destructor to get rid of warning
|
||||
public:
|
||||
virtual void onIioEvent(const IioEventData& eventData) = 0;
|
||||
};
|
||||
|
||||
|
||||
@@ -68,7 +55,7 @@ class IioHandler
|
||||
*
|
||||
* This file defines the C++ iio interface for libmraa
|
||||
*
|
||||
* @snippet iio.cpp Interesting
|
||||
* @snippet iio_dummy_test.cpp Interesting
|
||||
*/
|
||||
class Iio
|
||||
{
|
||||
@@ -113,19 +100,6 @@ 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
|
||||
*/
|
||||
@@ -207,6 +181,7 @@ class Iio
|
||||
oss << "IIO writeInt for attibute " << attributeName << " failed";
|
||||
throw std::runtime_error(oss.str());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -226,6 +201,7 @@ class Iio
|
||||
oss << "IIO writeFloat for attibute " << attributeName << " failed";
|
||||
throw std::runtime_error(oss.str());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -245,15 +221,13 @@ 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;
|
||||
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;
|
||||
@@ -267,4 +241,5 @@ class Iio
|
||||
|
||||
mraa_iio_context m_iio;
|
||||
};
|
||||
|
||||
}
|
||||
|
@@ -20,8 +20,6 @@
|
||||
* 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+,
|
||||
@@ -117,11 +115,12 @@ enum iio_event_direction {
|
||||
|
||||
/**
|
||||
* struct iio_event_data - The actual event being pushed to userspace
|
||||
* @id: event identifier
|
||||
* @timestamp: best estimate of time of event occurrence (often from
|
||||
* the interrupt handler)
|
||||
*/
|
||||
struct iio_event_data {
|
||||
/** event identifier */
|
||||
unsigned long long int id;
|
||||
/** best estimate of time of event occurrence (often from the interrupt handler) */
|
||||
long long int timestamp;
|
||||
};
|
||||
|
||||
|
@@ -1,157 +0,0 @@
|
||||
/*
|
||||
* 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
|
@@ -1,180 +0,0 @@
|
||||
/*
|
||||
* 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;
|
||||
}
|
||||
};
|
||||
}
|
122
api/mraa/led.h
122
api/mraa/led.h
@@ -1,122 +0,0 @@
|
||||
/*
|
||||
* Author: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
|
||||
* Copyright (c) 2017 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
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief LED module
|
||||
*
|
||||
* LED is the Light Emitting Diode interface to libmraa. It is used to
|
||||
* access the on board LED's via sysfs.
|
||||
*
|
||||
* @snippet led.c Interesting
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "common.h"
|
||||
#include <stdio.h>
|
||||
|
||||
/**
|
||||
* Opaque pointer definition to the internal struct _led
|
||||
*/
|
||||
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_raw("user4");`
|
||||
*
|
||||
* @param led_dev Name of the LED device
|
||||
* @returns LED context or NULL
|
||||
*/
|
||||
mraa_led_context mraa_led_init_raw(const char* led_dev);
|
||||
|
||||
/**
|
||||
* Set LED brightness
|
||||
*
|
||||
* @param dev LED context
|
||||
* @param value Integer value to write
|
||||
* @returns Result of operation
|
||||
*/
|
||||
mraa_result_t mraa_led_set_brightness(mraa_led_context dev, int value);
|
||||
|
||||
/**
|
||||
* Read LED brightness
|
||||
*
|
||||
* @param dev LED context
|
||||
* @returns Brightness value
|
||||
*/
|
||||
int mraa_led_read_brightness(mraa_led_context dev);
|
||||
|
||||
/**
|
||||
* Read LED maximum brightness
|
||||
*
|
||||
* @param dev LED context
|
||||
* @returns Maximum brightness value
|
||||
*/
|
||||
int mraa_led_read_max_brightness(mraa_led_context dev);
|
||||
|
||||
/**
|
||||
* Set LED trigger
|
||||
*
|
||||
* @param dev LED context
|
||||
* @param trigger Type of trigger to set
|
||||
* @returns Result of operation
|
||||
*/
|
||||
mraa_result_t mraa_led_set_trigger(mraa_led_context dev, const char* trigger);
|
||||
|
||||
/**
|
||||
* Clear active LED trigger
|
||||
*
|
||||
* @param dev LED context
|
||||
* @returns Result of operation
|
||||
*/
|
||||
mraa_result_t mraa_led_clear_trigger(mraa_led_context dev);
|
||||
|
||||
/**
|
||||
* Close LED file descriptors and free the context memory
|
||||
*
|
||||
* @param dev LED context
|
||||
* @returns Result of operation
|
||||
*/
|
||||
mraa_result_t mraa_led_close(mraa_led_context dev);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
156
api/mraa/led.hpp
156
api/mraa/led.hpp
@@ -1,156 +0,0 @@
|
||||
/*
|
||||
* Author: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
|
||||
* Copyright (c) 2017 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
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "led.h"
|
||||
#include "types.hpp"
|
||||
#include <stdexcept>
|
||||
|
||||
namespace mraa
|
||||
{
|
||||
|
||||
/**
|
||||
* @brief API to Light Emitting Diode
|
||||
*
|
||||
* This file defines the LED interface for libmraa
|
||||
*
|
||||
* @snippet led.cpp Interesting
|
||||
*/
|
||||
class Led
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Instantiates an LED object
|
||||
*
|
||||
* @param led LED index to use
|
||||
*/
|
||||
Led(int led)
|
||||
{
|
||||
m_led = mraa_led_init(led);
|
||||
|
||||
if (m_led == NULL) {
|
||||
throw std::invalid_argument("Invalid LED name specified");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
* @param led_context void * to LED context
|
||||
*/
|
||||
Led(void* led_context)
|
||||
{
|
||||
m_led = (mraa_led_context) led_context;
|
||||
if (m_led == NULL) {
|
||||
throw std::invalid_argument("Invalid LED name specified");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* LED object destructor
|
||||
*/
|
||||
~Led()
|
||||
{
|
||||
mraa_led_close(m_led);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set LED brightness value
|
||||
*
|
||||
* @param value Value to set LED brightness
|
||||
* @return Result of operation
|
||||
*/
|
||||
Result
|
||||
setBrightness(int value)
|
||||
{
|
||||
return (Result) mraa_led_set_brightness(m_led, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read LED brightness value
|
||||
*
|
||||
* @return LED brightness value
|
||||
*/
|
||||
int
|
||||
readBrightness()
|
||||
{
|
||||
return mraa_led_read_brightness(m_led);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read LED maximum brightness value
|
||||
*
|
||||
* @return LED max brightness value
|
||||
*/
|
||||
int
|
||||
readMaxBrightness()
|
||||
{
|
||||
return mraa_led_read_max_brightness(m_led);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set LED trigger
|
||||
*
|
||||
* @param trigger Type of trigger to set
|
||||
* @return Result of operation
|
||||
*/
|
||||
Result
|
||||
trigger(const char* trigger)
|
||||
{
|
||||
return (Result) mraa_led_set_trigger(m_led, trigger);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear active LED trigger
|
||||
*
|
||||
* @return Result of operation
|
||||
*/
|
||||
Result
|
||||
clearTrigger()
|
||||
{
|
||||
return (Result) mraa_led_clear_trigger(m_led);
|
||||
}
|
||||
|
||||
private:
|
||||
mraa_led_context m_led;
|
||||
};
|
||||
}
|
@@ -20,8 +20,6 @@
|
||||
* 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
|
||||
@@ -35,7 +33,7 @@
|
||||
* of resolution so make sure you check the board & pin you are using before
|
||||
* hand.
|
||||
*
|
||||
* @snippet pwm.c Interesting
|
||||
* @snippet cycle-pwm3.c Interesting
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -47,7 +45,6 @@ extern "C" {
|
||||
|
||||
#include "common.h"
|
||||
|
||||
/** Mraa Pwm Context */
|
||||
typedef struct _pwm* mraa_pwm_context;
|
||||
|
||||
/**
|
||||
|
@@ -20,8 +20,6 @@
|
||||
* 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 +36,7 @@ namespace mraa
|
||||
*
|
||||
* This file defines the PWM interface for libmraa
|
||||
*
|
||||
* @snippet pwm.cpp Interesting
|
||||
* @snippet Pwm3-cycle.cpp Interesting
|
||||
*/
|
||||
class Pwm
|
||||
{
|
||||
@@ -73,7 +71,7 @@ class Pwm
|
||||
* Pwm constructor, takes a pointer to the PWM context and
|
||||
* initialises the class
|
||||
*
|
||||
* @param pwm_context void * to a PWM context
|
||||
* @param void * to a PWM context
|
||||
*/
|
||||
Pwm(void* pwm_context)
|
||||
{
|
||||
|
@@ -20,8 +20,6 @@
|
||||
* 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 +34,7 @@
|
||||
* more information on spidev devices is available
|
||||
* [here](https://www.kernel.org/doc/Documentation/spi/spidev).
|
||||
*
|
||||
* @snippet spi.c Interesting
|
||||
* @snippet spi_mcp4261.c Interesting
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@@ -20,8 +20,6 @@
|
||||
* 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
|
||||
@@ -53,7 +51,7 @@ typedef enum {
|
||||
*
|
||||
* This file defines the SPI interface for libmraa
|
||||
*
|
||||
* @snippet spi.cpp Interesting
|
||||
* @snippet Spi-pot.cpp Interesting
|
||||
*/
|
||||
class Spi
|
||||
{
|
||||
@@ -72,12 +70,6 @@ class Spi
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise SPI object using 'raw' mode. Mraa will go and grab the spidev device lablled /dev/spidev[bus].[cs]
|
||||
*
|
||||
* @param bus to use
|
||||
* @param cs to use
|
||||
*/
|
||||
Spi(int bus, int cs)
|
||||
{
|
||||
m_spi = mraa_spi_init_raw(bus, cs);
|
||||
@@ -91,7 +83,7 @@ class Spi
|
||||
* Spi Constructor, takes a pointer to a SPI context and initialises
|
||||
* the SPI class
|
||||
*
|
||||
* @param spi_context void * to SPI context
|
||||
* @param void * to SPI context
|
||||
*/
|
||||
Spi(void* spi_context)
|
||||
{
|
||||
|
@@ -19,8 +19,6 @@
|
||||
* 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
|
||||
@@ -48,46 +46,23 @@ typedef enum {
|
||||
MRAA_BEAGLEBONE = 6, /**< The different BeagleBone Black Modes B/C */
|
||||
MRAA_BANANA = 7, /**< Allwinner A20 based Banana Pi and Banana Pro */
|
||||
MRAA_INTEL_NUC5 = 8, /**< The Intel 5th generations Broadwell NUCs */
|
||||
MRAA_96BOARDS = 9, /**< Linaro 96boards */
|
||||
MRAA_96BOARDS = 9, /**< Linaro 96boards */
|
||||
MRAA_INTEL_SOFIA_3GR = 10, /**< The Intel SoFIA 3GR */
|
||||
MRAA_INTEL_CHERRYHILLS = 11, /**< The Intel Braswell Cherryhills */
|
||||
MRAA_UP = 12, /**< The UP Board */
|
||||
MRAA_INTEL_JOULE_EXPANSION = 13,/**< The Intel Joule Expansion Board */
|
||||
#if __STDC_VERSION__ >= 199901L
|
||||
MRAA_INTEL_GT_TUCHUCK = MRAA_INTEL_JOULE_EXPANSION, // deprecated
|
||||
#endif
|
||||
MRAA_PHYBOARD_WEGA = 14, /**< The phyBOARD-Wega */
|
||||
MRAA_DE_NANO_SOC = 15, /**< Terasic DE-Nano-SoC Board */
|
||||
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 */
|
||||
MRAA_INTEL_CHERRYHILLS = 11, /**< The Intel Braswell Cherryhills */
|
||||
MRAA_UP = 12, /**< The UP Board */
|
||||
MRAA_INTEL_GT_TUCHUCK = 13, /**< The Intel GT Tuchuck Board */
|
||||
|
||||
// USB platform extenders start at 256
|
||||
MRAA_FTDI_FT4222 = 256, /**< FTDI FT4222 USB to i2c bridge */
|
||||
|
||||
// contains bit 9 so is subplatform
|
||||
MRAA_GROVEPI = 1024, /**< GrovePi shield i2c bridge */
|
||||
MRAA_GENERIC_FIRMATA = 1280, /**< Firmata uart platform/bridge */
|
||||
|
||||
MRAA_ANDROID_PERIPHERALMANAGER = 95, /**< Android Things peripheral manager platform */
|
||||
MRAA_MOCK_PLATFORM = 96, /**< Mock platform, which requires no real hardware */
|
||||
MRAA_JSON_PLATFORM = 97, /**< User initialised platform from json */
|
||||
MRAA_JSON_PLATFORM = 97, /**< User initialised platform from json*/
|
||||
MRAA_NULL_PLATFORM = 98, /**< Platform with no capabilities that hosts a sub platform */
|
||||
MRAA_UNKNOWN_PLATFORM = 99 /**< An unknown platform type, typically will load INTEL_GALILEO_GEN1 */
|
||||
MRAA_UNKNOWN_PLATFORM =
|
||||
99 /**< An unknown platform type, typically will load INTEL_GALILEO_GEN1 */
|
||||
} mraa_platform_t;
|
||||
|
||||
/**
|
||||
@@ -182,39 +157,6 @@ 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
|
||||
*/
|
||||
@@ -297,15 +239,12 @@ typedef enum {
|
||||
MRAA_I2C_HIGH = 2 /**< up to 3.4Mhz */
|
||||
} mraa_i2c_mode_t;
|
||||
|
||||
/**
|
||||
* Enum representing different uart parity states
|
||||
*/
|
||||
typedef enum {
|
||||
MRAA_UART_PARITY_NONE = 0,
|
||||
MRAA_UART_PARITY_EVEN = 1,
|
||||
MRAA_UART_PARITY_ODD = 2,
|
||||
MRAA_UART_PARITY_MARK = 3,
|
||||
MRAA_UART_PARITY_SPACE = 4
|
||||
MRAA_UART_PARITY_NONE = 0,
|
||||
MRAA_UART_PARITY_EVEN = 1,
|
||||
MRAA_UART_PARITY_ODD = 2,
|
||||
MRAA_UART_PARITY_MARK = 3,
|
||||
MRAA_UART_PARITY_SPACE = 4
|
||||
} mraa_uart_parity_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@@ -19,8 +19,6 @@
|
||||
* 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
|
||||
@@ -53,25 +51,15 @@ typedef enum {
|
||||
INTEL_SOFIA_3GR = 10, /**< The Intel SoFIA 3GR */
|
||||
INTEL_CHERRYHILLS = 11, /**< The Intel Braswell Cherryhills */
|
||||
INTEL_UP = 12, /**< The UP Board */
|
||||
INTEL_JOULE_EXPANSION = 13,/**< The Intel Joule Expansion Board */
|
||||
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 */
|
||||
INTEL_GT_TUCHUCK = 13, /**< The Intel GT Board */
|
||||
|
||||
FTDI_FT4222 = 256, /**< FTDI FT4222 USB to i2c bridge */
|
||||
|
||||
GROVEPI = 1024, /**< GrovePi shield i2c bridge */
|
||||
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 */
|
||||
UNKNOWN_PLATFORM =
|
||||
99 /**< An unknown platform type, typically will load INTEL_GALILEO_GEN1 */
|
||||
} Platform;
|
||||
|
||||
/**
|
||||
@@ -202,39 +190,6 @@ 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
|
||||
*/
|
||||
@@ -273,7 +228,7 @@ typedef enum {
|
||||
} Pinmodes;
|
||||
|
||||
/**
|
||||
* Enum representing different i2c speeds/modes
|
||||
* Enum reprensenting different i2c speeds/modes
|
||||
*/
|
||||
typedef enum {
|
||||
I2C_STD = 0, /**< up to 100Khz */
|
||||
@@ -281,9 +236,6 @@ typedef enum {
|
||||
I2C_HIGH = 2 /**< up to 3.4Mhz */
|
||||
} I2cMode;
|
||||
|
||||
/**
|
||||
* Enum representing different uart parity states
|
||||
*/
|
||||
typedef enum {
|
||||
UART_PARITY_NONE = 0,
|
||||
UART_PARITY_EVEN = 1,
|
||||
|
@@ -22,8 +22,6 @@
|
||||
* 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
|
||||
@@ -47,7 +45,6 @@ extern "C" {
|
||||
|
||||
#include "common.h"
|
||||
|
||||
/** Mraa Uart Context */
|
||||
typedef struct _uart* mraa_uart_context;
|
||||
|
||||
/**
|
||||
@@ -75,18 +72,6 @@ mraa_uart_context mraa_uart_init_raw(const char* path);
|
||||
*/
|
||||
mraa_result_t mraa_uart_flush(mraa_uart_context dev);
|
||||
|
||||
/**
|
||||
* Send a break to the device.
|
||||
* Blocks until complete.
|
||||
*
|
||||
* @param dev The UART context
|
||||
* @param duration When 0, send a break lasting at least 250
|
||||
* milliseconds, and not more than 500 milliseconds. When non zero,
|
||||
* the break duration is implementation specific.
|
||||
* @return Result of operation
|
||||
*/
|
||||
mraa_result_t mraa_uart_sendbreak(mraa_uart_context dev, int duration);
|
||||
|
||||
/**
|
||||
* Set the baudrate.
|
||||
* Takes an int and will attempt to decide what baudrate is
|
||||
@@ -151,41 +136,6 @@ mraa_result_t mraa_uart_set_non_blocking(mraa_uart_context dev, mraa_boolean_t n
|
||||
*/
|
||||
const char* mraa_uart_get_dev_path(mraa_uart_context dev);
|
||||
|
||||
/**
|
||||
* Get the current settings of an UART. This is an unintrusive function. Meaning
|
||||
* it intends not to change anything, only read the values without disturbing.
|
||||
*
|
||||
* All but the first index parameter are "outparameters". That means they can
|
||||
* contain values on return. If any parameter is not interesting, a null pointer
|
||||
* can be sent instead as a placeholder.
|
||||
* The devpath parameter can be either in or out parameter. In case of a negative
|
||||
* index, the UART is identified using *devpath instead. This functionality is
|
||||
* intended for and needed by for instance USB serial adapters.
|
||||
*
|
||||
* In case of a non-success return value, the outparameters are undefined.
|
||||
*
|
||||
* @param index uart index to look up, if negative, *devpath will be used instead
|
||||
* @param devpath points to the device path of the UART, eg: /dev/ttyS0
|
||||
* @param name outparameter that on return will point to the name of the UART
|
||||
* @param baudrate pointer to an integer to contain the current baudrate (0--4M)
|
||||
* @param databits pointer to an integer to contain the number databits (5--8)
|
||||
* @param stopbits pointer to an integer to contain the number stopbits (1--2)
|
||||
* @param parity will contain the current parity mode
|
||||
* @param rtscts will point to non-zero if CTS/RTS flow control is enabled, zero otherwise
|
||||
* @param xonxoff will point to a non-zero value if xon/xoff flow control is enabled
|
||||
* @return result
|
||||
*/
|
||||
mraa_result_t
|
||||
mraa_uart_settings(int index,
|
||||
const char **devpath,
|
||||
const char **name,
|
||||
int* baudrate,
|
||||
int* databits,
|
||||
int* stopbits,
|
||||
mraa_uart_parity_t* parity,
|
||||
unsigned int* rtscts,
|
||||
unsigned int* xonxoff);
|
||||
|
||||
/**
|
||||
* Destroy a mraa_uart_context
|
||||
*
|
||||
|
@@ -22,8 +22,6 @@
|
||||
* 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
|
||||
@@ -42,7 +40,7 @@ namespace mraa
|
||||
*
|
||||
* This file defines the UART interface for libmraa
|
||||
*
|
||||
* @snippet uart.cpp Interesting
|
||||
* @snippet Uart-example.cpp Interesting
|
||||
*/
|
||||
class Uart
|
||||
{
|
||||
@@ -66,7 +64,7 @@ class Uart
|
||||
* Uart Constructor, takes a string to the path of the serial
|
||||
* interface that is needed.
|
||||
*
|
||||
* @param path the index of the uart set to use
|
||||
* @param uart the index of the uart set to use
|
||||
*/
|
||||
Uart(std::string path)
|
||||
{
|
||||
@@ -81,7 +79,7 @@ class Uart
|
||||
* Uart Constructor, takes a pointer to the UART context and initialises
|
||||
* the UART class
|
||||
*
|
||||
* @param uart_context void * to a UART context
|
||||
* @param void * to a UART context
|
||||
*/
|
||||
Uart(void* uart_context)
|
||||
{
|
||||
@@ -126,7 +124,7 @@ class Uart
|
||||
}
|
||||
|
||||
/**
|
||||
* Write bytes in char* buffer to a device
|
||||
* Write bytes in String object to a device
|
||||
*
|
||||
* @param data buffer pointer
|
||||
* @param length maximum size of buffer
|
||||
@@ -162,7 +160,7 @@ class Uart
|
||||
/**
|
||||
* Write bytes in String object to a device
|
||||
*
|
||||
* @param data string to write
|
||||
* @param string to write
|
||||
* @return the number of bytes written, or -1 if an error occurred
|
||||
*/
|
||||
int
|
||||
@@ -199,21 +197,6 @@ class Uart
|
||||
return (Result) mraa_uart_flush(m_uart);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a break to the device.
|
||||
* Blocks until complete.
|
||||
*
|
||||
* @param duration When 0, send a break lasting at least 250
|
||||
* milliseconds, and not more than 500 milliseconds. When non zero,
|
||||
* the break duration is implementation specific.
|
||||
* @return Result of operation
|
||||
*/
|
||||
Result
|
||||
sendBreak(int duration)
|
||||
{
|
||||
return (Result) mraa_uart_sendbreak(m_uart, duration);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the baudrate.
|
||||
* Takes an int and will attempt to decide what baudrate is
|
||||
@@ -275,11 +258,12 @@ class Uart
|
||||
/**
|
||||
* Set the blocking state for write operations
|
||||
*
|
||||
* @param dev The UART context
|
||||
* @param nonblock new nonblocking state
|
||||
* @return Result of operation
|
||||
*/
|
||||
Result
|
||||
setNonBlocking(bool nonblock)
|
||||
SetNonBlocking(bool nonblock)
|
||||
{
|
||||
return (Result) mraa_uart_set_non_blocking(m_uart, nonblock);
|
||||
}
|
||||
|
@@ -20,8 +20,6 @@
|
||||
* 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
|
||||
@@ -66,23 +64,19 @@ extern "C" {
|
||||
#include "common.h"
|
||||
#include "uart.h"
|
||||
|
||||
/** 8 bytes (64 bits) for a device rom code */
|
||||
#define MRAA_UART_OW_ROMCODE_SIZE 8
|
||||
|
||||
/** for now, we simply use the normal MRAA UART context */
|
||||
/* for now, we simply use the normal MRAA UART context */
|
||||
typedef struct _mraa_uart_ow {
|
||||
/** Uart Context */
|
||||
mraa_uart_context uart;
|
||||
/** search state */
|
||||
unsigned char ROM_NO[MRAA_UART_OW_ROMCODE_SIZE]; /* 8 byte (64b) rom code */
|
||||
/** Context laxt discrepancy */
|
||||
/* search state */
|
||||
unsigned char ROM_NO[8]; /* 8 byte (64b) rom code */
|
||||
int LastDiscrepancy;
|
||||
/** Context las family discrepancy */
|
||||
int LastFamilyDiscrepancy;
|
||||
/** Context las device flag */
|
||||
mraa_boolean_t LastDeviceFlag;
|
||||
} *mraa_uart_ow_context;
|
||||
|
||||
/* 8 bytes (64 bits) for a device rom code */
|
||||
static const int MRAA_UART_OW_ROMCODE_SIZE = 8;
|
||||
|
||||
/**
|
||||
* UART One Wire ROM related Command bytes
|
||||
*/
|
||||
|
@@ -20,16 +20,14 @@
|
||||
* 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 "types.hpp"
|
||||
#include "uart_ow.h"
|
||||
#include <cstring>
|
||||
#include "types.hpp"
|
||||
#include <stdexcept>
|
||||
#include <cstring>
|
||||
|
||||
namespace mraa
|
||||
{
|
||||
@@ -39,7 +37,7 @@ namespace mraa
|
||||
*
|
||||
* This file defines the UartOW (UART to Dallas 1-wire) interface for libmraa
|
||||
*
|
||||
* @snippet uart_ow.cpp Interesting
|
||||
* @snippet UartOW.cpp Interesting
|
||||
*/
|
||||
class UartOW
|
||||
{
|
||||
@@ -48,8 +46,8 @@ class UartOW
|
||||
* UartOW Constructor, takes a pin number which will map directly to the
|
||||
* linux uart number, this 'enables' the uart, nothing more
|
||||
*
|
||||
* @param uart the index of the uart to use
|
||||
* @throws std::invalid_argument in case of error
|
||||
* @param uart the index of the uart to use
|
||||
*/
|
||||
UartOW(int uart)
|
||||
{
|
||||
@@ -64,8 +62,8 @@ class UartOW
|
||||
* UartOW Constructor, takes a string to the path of the serial
|
||||
* interface that is needed.
|
||||
*
|
||||
* @param path the file path for the UART to use
|
||||
* @throws std::invalid_argument in case of error
|
||||
* @param path the file path for the UART to use
|
||||
*/
|
||||
UartOW(std::string path)
|
||||
{
|
||||
@@ -76,21 +74,6 @@ 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
|
||||
*/
|
||||
@@ -250,7 +233,7 @@ class UartOW
|
||||
mraa::Result
|
||||
command(uint8_t command, std::string id)
|
||||
{
|
||||
if (id.empty())
|
||||
if (id.empty() == 0)
|
||||
return (mraa::Result) mraa_uart_ow_command(m_uart, command, NULL);
|
||||
else {
|
||||
if (id.size() != 8) {
|
||||
@@ -258,7 +241,7 @@ class UartOW
|
||||
throw std::invalid_argument(std::string(__FUNCTION__) +
|
||||
": id must be 8 bytes only");
|
||||
}
|
||||
return (mraa::Result) mraa_uart_ow_command(m_uart, command, (uint8_t*) id.data());
|
||||
return (mraa::Result) mraa_uart_ow_command(m_uart, command, (uint8_t*) id.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -285,7 +268,7 @@ class UartOW
|
||||
uint8_t
|
||||
crc8(std::string buffer)
|
||||
{
|
||||
return mraa_uart_ow_crc8((uint8_t*) buffer.data(), buffer.size());
|
||||
return mraa_uart_ow_crc8((uint8_t*) buffer.c_str(), buffer.size());
|
||||
}
|
||||
|
||||
private:
|
||||
|
@@ -1,14 +0,0 @@
|
||||
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)
|
||||
```
|
25
cmake/Toolchains/oe-sdk_cross.cmake
Normal file
25
cmake/Toolchains/oe-sdk_cross.cmake
Normal file
@@ -0,0 +1,25 @@
|
||||
# this toolchain file comes from gnuradio project
|
||||
|
||||
set( CMAKE_SYSTEM_NAME Linux )
|
||||
#set( CMAKE_C_COMPILER $ENV{CC} )
|
||||
#set( CMAKE_CXX_COMPILER $ENV{CXX} )
|
||||
string(REGEX MATCH "sysroots/([a-zA-Z0-9]+)" CMAKE_SYSTEM_PROCESSOR $ENV{SDKTARGETSYSROOT})
|
||||
string(REGEX REPLACE "sysroots/" "" CMAKE_SYSTEM_PROCESSOR ${CMAKE_SYSTEM_PROCESSOR})
|
||||
set( CMAKE_CXX_FLAGS $ENV{CXXFLAGS} CACHE STRING "" FORCE )
|
||||
set( CMAKE_C_FLAGS $ENV{CFLAGS} CACHE STRING "" FORCE ) #same flags for C sources
|
||||
set( CMAKE_LDFLAGS_FLAGS ${CMAKE_CXX_FLAGS} CACHE STRING "" FORCE ) #same flags for C sources
|
||||
set( CMAKE_LIBRARY_PATH ${OECORE_TARGET_SYSROOT}/usr/lib )
|
||||
set( CMAKE_FIND_ROOT_PATH $ENV{OECORE_TARGET_SYSROOT} $ENV{OECORE_NATIVE_SYSROOT} )
|
||||
set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )
|
||||
set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
|
||||
set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
|
||||
set( CMAKE_INSTALL_PREFIX $ENV{OECORE_TARGET_SYSROOT}/usr CACHE STRING "" FORCE)
|
||||
set( ORC_INCLUDE_DIRS $ENV{OECORE_TARGET_SYSROOT}/usr/include/orc-0.4 )
|
||||
set( ORC_LIBRARY_DIRS $ENV{OECORE_TARGET_SYSROOT}/usr/lib )
|
||||
|
||||
# for java
|
||||
set( JAVA_AWT_INCLUDE_PATH $ENV{JAVA_HOME}/include CACHE PATH "" FORCE)
|
||||
set( JAVA_AWT_LIBRARY $ENV{JAVA_HOME}/jre/lib/amd64/libjawt.so CACHE FILEPATH "" FORCE)
|
||||
set( JAVA_INCLUDE_PATH $ENV{JAVA_HOME}/include CACHE PATH "" FORCE)
|
||||
set( JAVA_INCLUDE_PATH2 $ENV{JAVA_HOME}/include/linux CACHE PATH "" FORCE)
|
||||
set( JAVA_JVM_LIBRARY $ENV{JAVA_HOME}/jre/lib/amd64/libjvm.so CACHE FILEPATH "" FORCE)
|
222
cmake/modules/CPackDeb.cmake
Normal file
222
cmake/modules/CPackDeb.cmake
Normal file
@@ -0,0 +1,222 @@
|
||||
# - 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,8 +14,6 @@
|
||||
#
|
||||
# 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
|
||||
@@ -29,11 +27,11 @@ else (LIBFTD2XX_LIBRARIES AND LIBFTD2XX_INCLUDE_DIRS)
|
||||
/usr/local/include
|
||||
/opt/local/include
|
||||
/sw/include
|
||||
)
|
||||
)
|
||||
|
||||
SET(FTD2XX_LIBNAME ftd2xx)
|
||||
IF(WIN32)
|
||||
SET(FTD2XX_LIBNAME ftd2xx.lib)
|
||||
SET(FTD2XX_LIBNAME ftd2xx.lib)
|
||||
ENDIF(WIN32)
|
||||
|
||||
find_library(LIBFTD2XX_LIBRARY
|
||||
@@ -44,16 +42,16 @@ else (LIBFTD2XX_LIBRARIES AND LIBFTD2XX_INCLUDE_DIRS)
|
||||
/usr/local/lib
|
||||
/opt/local/lib
|
||||
/sw/lib
|
||||
)
|
||||
)
|
||||
|
||||
if(LIBFTD2XX_INCLUDE_DIR)
|
||||
set(LIBFTD2XX_INCLUDE_DIRS
|
||||
set(LIBFTD2XX_INCLUDE_DIRS
|
||||
${LIBFTD2XX_INCLUDE_DIR}
|
||||
)
|
||||
)
|
||||
endif(LIBFTD2XX_INCLUDE_DIR)
|
||||
set(LIBFTD2XX_LIBRARIES
|
||||
${LIBFTD2XX_LIBRARY}
|
||||
)
|
||||
)
|
||||
|
||||
if (LIBFTD2XX_INCLUDE_DIRS AND LIBFTD2XX_LIBRARIES)
|
||||
set(LIBFTD2XX_FOUND TRUE)
|
||||
@@ -61,17 +59,14 @@ else (LIBFTD2XX_LIBRARIES AND LIBFTD2XX_INCLUDE_DIRS)
|
||||
|
||||
if (LIBFTD2XX_FOUND)
|
||||
if (NOT libftd2xx_FIND_QUIETLY)
|
||||
message(STATUS "Found libftd2xx: ${LIBFTD2XX_LIBRARIES}")
|
||||
message(STATUS "Found libftd2xx: ${LIBFTD2XX_LIBRARIES}")
|
||||
endif (NOT libftd2xx_FIND_QUIETLY)
|
||||
else (LIBFTD2XX_FOUND)
|
||||
if (libftd2xx_FIND_REQUIRED)
|
||||
message(FATAL_ERROR "Could not find libftd2xx")
|
||||
message(FATAL_ERROR "Could not find libftd2xx")
|
||||
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,8 +15,6 @@
|
||||
#
|
||||
# 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
|
||||
@@ -30,11 +28,11 @@ else (LIBFT4222_LIBRARIES AND LIBFT4222_INCLUDE_DIRS)
|
||||
/usr/local/include
|
||||
/opt/local/include
|
||||
/sw/include
|
||||
)
|
||||
)
|
||||
|
||||
SET(FTD4222_LIBNAME ft4222)
|
||||
IF(WIN32)
|
||||
SET(FTD4222_LIBNAME LibFT4222.lib)
|
||||
SET(FTD4222_LIBNAME LibFT4222.lib)
|
||||
ENDIF(WIN32)
|
||||
|
||||
find_library(LIBFT4222_LIBRARY
|
||||
@@ -45,16 +43,16 @@ else (LIBFT4222_LIBRARIES AND LIBFT4222_INCLUDE_DIRS)
|
||||
/usr/local/lib
|
||||
/opt/local/lib
|
||||
/sw/lib
|
||||
)
|
||||
)
|
||||
|
||||
if(LIBFT4222_INCLUDE_DIR)
|
||||
set(LIBFT4222_INCLUDE_DIRS
|
||||
set(LIBFT4222_INCLUDE_DIRS
|
||||
${LIBFT4222_INCLUDE_DIR}
|
||||
)
|
||||
)
|
||||
endif(LIBFT4222_INCLUDE_DIR)
|
||||
set(LIBFT4222_LIBRARIES
|
||||
${LIBFT4222_LIBRARY}
|
||||
)
|
||||
)
|
||||
|
||||
if (LIBFT4222_INCLUDE_DIRS AND LIBFT4222_LIBRARIES)
|
||||
set(LIBFT4222_FOUND TRUE)
|
||||
@@ -62,17 +60,14 @@ else (LIBFT4222_LIBRARIES AND LIBFT4222_INCLUDE_DIRS)
|
||||
|
||||
if (LIBFT4222_FOUND)
|
||||
if (NOT LIBFT4222_FIND_QUIETLY)
|
||||
message(STATUS "Found LIBFT4222: ${LIBFT4222_LIBRARIES}")
|
||||
message(STATUS "Found LIBFT4222: ${LIBFT4222_LIBRARIES}")
|
||||
endif (NOT LIBFT4222_FIND_QUIETLY)
|
||||
else (LIBFT4222_FOUND)
|
||||
if (LIBFT4222_FIND_REQUIRED)
|
||||
message(FATAL_ERROR "Could not find LIBFT4222")
|
||||
message(FATAL_ERROR "Could not find LIBFT4222")
|
||||
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,6 +1,3 @@
|
||||
# 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,71 +1,66 @@
|
||||
# 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)
|
||||
# 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")
|
||||
set(NODEJS_INCLUDE_DIRS ${NODEJS_INCLUDE_DIRS} ${dir})
|
||||
set(NODEJS_INCLUDE_DIRS ${NODEJS_INCLUDE_DIRS} ${dir})
|
||||
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)
|
||||
|
||||
# If compat-libuv package exists, it must be at start of include path
|
||||
find_path (UV_ROOT_DIR "uv.h" PATHS /usr/include/compat-libuv010 NO_DEFAULT_PATH)
|
||||
if (UV_ROOT_DIR)
|
||||
# set (NODEJS_INCLUDE_DIRS ${UV_ROOT_DIR})
|
||||
add_include_dir(${UV_ROOT_DIR})
|
||||
# set (NODEJS_INCLUDE_DIRS ${UV_ROOT_DIR})
|
||||
add_include_dir(${UV_ROOT_DIR})
|
||||
endif()
|
||||
|
||||
# Now look for node. Flag an error if not found
|
||||
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}")
|
||||
|
||||
find_path (NODE_ROOT_DIR "include/node/node.h" "include/src/node.h"
|
||||
PATHS /usr/include/nodejs /usr/local/include/nodejs /usr/local/include)
|
||||
if (NODE_ROOT_DIR)
|
||||
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}/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)
|
||||
add_include_dir(${NODE_ROOT_DIR}/include/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}/include/deps/uv/include)
|
||||
else()
|
||||
unset(NODEJS_INCLUDE_DIRS)
|
||||
message(ERROR " - node.h not found")
|
||||
unset(NODEJS_INCLUDE_DIRS)
|
||||
message(ERROR " - node.h not found")
|
||||
endif()
|
||||
|
||||
# Check that v8.h is in NODEJS_INCLUDE_DIRS
|
||||
find_path (V8_ROOT_DIR "v8.h" PATHS ${NODEJS_INCLUDE_DIRS})
|
||||
if (NOT V8_ROOT_DIR)
|
||||
unset(NODEJS_INCLUDE_DIRS)
|
||||
message(ERROR " - v8.h not found")
|
||||
unset(NODEJS_INCLUDE_DIRS)
|
||||
message(ERROR " - v8.h not found")
|
||||
endif()
|
||||
|
||||
# Check that uv.h is in NODEJS_INCLUDE_DIRS
|
||||
find_path (UV_ROOT_DIR "uv.h" PATHS ${NODEJS_INCLUDE_DIRS})
|
||||
if (NOT UV_ROOT_DIR)
|
||||
unset(NODEJS_INCLUDE_DIRS)
|
||||
message(ERROR " - uv.h not found")
|
||||
unset(NODEJS_INCLUDE_DIRS)
|
||||
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
|
||||
RESULT_VARIABLE _NODE_VERSION_RESULT)
|
||||
OUTPUT_VARIABLE _VERSION
|
||||
RESULT_VARIABLE _NODE_VERSION_RESULT)
|
||||
execute_process(COMMAND ${NODEJS_EXECUTABLE} -e "console.log(process.versions.v8)"
|
||||
OUTPUT_VARIABLE _V8_VERSION
|
||||
RESULT_VARIABLE _V8_RESULT)
|
||||
OUTPUT_VARIABLE _V8_VERSION
|
||||
RESULT_VARIABLE _V8_RESULT)
|
||||
if (NOT _NODE_VERSION_RESULT AND NOT _V8_RESULT)
|
||||
string (REPLACE "v" "" NODE_VERSION_STRING "${_VERSION}")
|
||||
string (REPLACE "." ";" _VERSION_LIST "${NODE_VERSION_STRING}")
|
||||
@@ -88,15 +83,12 @@ if (NODEJS_EXECUTABLE)
|
||||
set (V8_VERSION_MINOR"14")
|
||||
set (V8_VERSION_PATCH "5")
|
||||
set (V8_VERSION_STRING "3.28.72")
|
||||
message (STATUS "defaulted to node 0.10.30")
|
||||
message ("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)
|
||||
|
||||
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,6 +1,3 @@
|
||||
# Copyright (c) 2014 Intel Corporation
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
find_program (SPHINX_EXECUTABLE NAMES sphinx-build
|
||||
HINTS
|
||||
$ENV{SPHINX_DIR}
|
||||
@@ -14,16 +11,4 @@ find_package_handle_standard_args (Sphinx DEFAULT_MSG
|
||||
SPHINX_EXECUTABLE
|
||||
)
|
||||
|
||||
# Get Sphinx Version
|
||||
if (SPHINX_EXECUTABLE)
|
||||
execute_process(COMMAND ${SPHINX_EXECUTABLE} --version
|
||||
OUTPUT_VARIABLE SPHINX_VERSION_STRING
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
ERROR_STRIP_TRAILING_WHITESPACE)
|
||||
if (SPHINX_VERSION_STRING)
|
||||
string(REPLACE "Sphinx (sphinx-build) " "" SPHINX_VERSION ${SPHINX_VERSION_STRING})
|
||||
message (STATUS "Sphinx version is ${SPHINX_VERSION}")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
mark_as_advanced (SPHINX_EXECUTABLE)
|
||||
|
@@ -1,6 +1,3 @@
|
||||
# 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,6 +1,3 @@
|
||||
# Copyright (c) 2015 Intel Corporation
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
find_program (YUIDOC_EXECUTABLE NAMES yuidoc
|
||||
HINTS $ENV{YUIDOC_DIR}
|
||||
PATHS usr usr/local
|
||||
@@ -17,12 +14,8 @@ find_package_handle_standard_args (Yuidoc DEFAULT_MSG
|
||||
# Get Yuidoc version
|
||||
if (YUIDOC_EXECUTABLE)
|
||||
execute_process(COMMAND ${YUIDOC_EXECUTABLE} --version
|
||||
ERROR_VARIABLE YUIDOC_VERSION
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
ERROR_STRIP_TRAILING_WHITESPACE)
|
||||
if (YUIDOC_VERSION)
|
||||
message (STATUS "Yuidoc version is ${YUIDOC_VERSION}")
|
||||
endif ()
|
||||
ERROR_VARIABLE YUIDOC_VERSION)
|
||||
message ("INFO - Yuidoc version is " ${YUIDOC_VERSION})
|
||||
endif ()
|
||||
|
||||
mark_as_advanced (YUIDOC_EXECUTABLE)
|
||||
|
@@ -29,8 +29,6 @@
|
||||
# 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,8 +12,6 @@
|
||||
# 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)
|
||||
|
||||
|
504
cmake/modules/LICENSE.LGPL
Normal file
504
cmake/modules/LICENSE.LGPL
Normal file
@@ -0,0 +1,504 @@
|
||||
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,6 +1,3 @@
|
||||
# From OpenCV Project
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
# Find specified Python version
|
||||
# Arguments:
|
||||
# preferred_version (value): Version to check for first
|
||||
|
145
cmake/modules/TargetArch.cmake
Normal file
145
cmake/modules/TargetArch.cmake
Normal file
@@ -0,0 +1,145 @@
|
||||
# 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(__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,4 +1,3 @@
|
||||
// Auto-Generated file
|
||||
#include "version.h"
|
||||
|
||||
const char* gVERSION = "@VERSION@";
|
||||
|
@@ -1,158 +0,0 @@
|
||||
version: '2.1'
|
||||
|
||||
services:
|
||||
|
||||
base:
|
||||
image: inteliotdevkit/mraa-base
|
||||
environment:
|
||||
- http_proxy
|
||||
- https_proxy
|
||||
- no_proxy
|
||||
- BUILDDOC=${BUILDDOC:-OFF}
|
||||
- BUILDSWIG=${BUILDSWIG:-OFF}
|
||||
- BUILDSWIGPYTHON=${BUILDSWIGPYTHON:-OFF}
|
||||
- BUILDTESTS=${BUILDTESTS:-ON}
|
||||
- USEPYTHON3TESTS=${USEPYTHON3TESTS:-OFF}
|
||||
- BUILDSWIGJAVA=${BUILDSWIGJAVA:-OFF}
|
||||
- BUILDSWIGNODE=${BUILDSWIGNODE:-OFF}
|
||||
- USBPLAT=${USBPLAT:-OFF}
|
||||
- FIRMATA=${FIRMATA:-OFF}
|
||||
- ONEWIRE=${ONEWIRE:-ON}
|
||||
- JSONPLAT=${JSONPLAT:-OFF}
|
||||
- IMRAA=${IMRAA:-OFF}
|
||||
- FTDI4222=${FTDI4222:-OFF}
|
||||
- ENABLEEXAMPLES=${ENABLEEXAMPLES:-OFF}
|
||||
- INSTALLTOOLS=${INSTALLTOOLS:-ON}
|
||||
- CC=${CC:-clang-3.8}
|
||||
- CXX=${CXX:-clang++-3.8}
|
||||
- BUILDARCH=${BUILDARCH}
|
||||
volumes:
|
||||
- .:${MRAA_SRC_DIR:-/usr/src/app}
|
||||
|
||||
all:
|
||||
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:
|
||||
- BUILDSWIG=ON
|
||||
- BUILDSWIGPYTHON=ON
|
||||
- BUILDSWIGNODE=ON
|
||||
- BUILDSWIGJAVA=ON
|
||||
- BUILDDOC=ON
|
||||
command: bash -c "./scripts/run-cmake.sh && ./scripts/build-doc.sh"
|
||||
|
||||
examples:
|
||||
extends: all
|
||||
environment:
|
||||
- BUILDSWIG=ON
|
||||
- BUILDSWIGPYTHON=ON
|
||||
- BUILDSWIGNODE=ON
|
||||
- BUILDSWIGJAVA=ON
|
||||
- ENABLEEXAMPLES=ON
|
||||
- USBPLAT=ON
|
||||
- FIRMATA=ON
|
||||
- ONEWIRE=ON
|
||||
- IMRAA=ON
|
||||
- FTDI4222=ON
|
||||
command: bash -c "./scripts/run-cmake.sh && make -Cbuild"
|
||||
|
||||
sonar-scan:
|
||||
extends: all
|
||||
environment:
|
||||
- BUILDSWIG=ON
|
||||
- BUILDSWIGPYTHON=ON
|
||||
- BUILDSWIGNODE=ON
|
||||
- BUILDSWIGJAVA=ON
|
||||
- ENABLEEXAMPLES=ON
|
||||
- ONEWIRE=ON
|
||||
- JSONPLAT=ON
|
||||
- SONAR_TOKEN
|
||||
- SONAR_ORG
|
||||
- SONAR_PROJ_KEY
|
||||
- TRAVIS_BRANCH
|
||||
- TRAVIS_PULL_REQUEST
|
||||
- TRAVIS_REPO_SLUG
|
||||
- TRAVIS_PULL_REQUEST_SLUG
|
||||
- GITHUB_TOKEN
|
||||
command: bash -c "./scripts/run-cmake.sh && cd build && ../scripts/sonar-scan.sh"
|
||||
|
||||
usbplat:
|
||||
extends: all
|
||||
environment:
|
||||
- USBPLAT=ON
|
||||
command: bash -c "./scripts/run-cmake.sh && make -Cbuild"
|
||||
|
||||
firmata:
|
||||
extends: all
|
||||
environment:
|
||||
- FIRMATA=ON
|
||||
command: bash -c "./scripts/run-cmake.sh && make -Cbuild"
|
||||
|
||||
imraa:
|
||||
extends: all
|
||||
environment:
|
||||
- IMRAA=ON
|
||||
- FIRMATA=ON
|
||||
command: bash -c "./scripts/run-cmake.sh && make -Cbuild"
|
||||
|
||||
ftdi4442:
|
||||
extends: all
|
||||
environment:
|
||||
- USBPLAT=ON
|
||||
- FTDI4222=ON
|
||||
command: bash -c "./scripts/run-cmake.sh && make -Cbuild"
|
||||
|
||||
python2:
|
||||
extends: base
|
||||
image: inteliotdevkit/mraa-python
|
||||
environment:
|
||||
- BUILDSWIG=ON
|
||||
- BUILDSWIGPYTHON=ON
|
||||
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 test_unit_all && ctest --output-on-failure"
|
||||
|
||||
java:
|
||||
extends: base
|
||||
image: inteliotdevkit/mraa-java
|
||||
environment:
|
||||
- BUILDSWIG=ON
|
||||
- BUILDSWIGJAVA=ON
|
||||
command: bash -c "./scripts/run-cmake.sh && cd build && make mraajava test_unit_all && ctest --output-on-failure"
|
||||
|
||||
android:
|
||||
extends: java
|
||||
image: inteliotdevkit/mraa-android
|
||||
environment:
|
||||
- BUILDARCH=PERIPHERALMAN
|
||||
command: bash -c "./scripts/build-android.sh"
|
||||
|
||||
node4:
|
||||
extends: base
|
||||
image: inteliotdevkit/mraa-node4
|
||||
environment:
|
||||
- BUILDSWIG=ON
|
||||
- BUILDSWIGNODE=ON
|
||||
command: bash -c "./scripts/run-cmake.sh && make -Cbuild npmpkg && node-gyp configure && node-gyp build && npm test"
|
||||
|
||||
node5:
|
||||
extends: node4
|
||||
image: inteliotdevkit/mraa-node5
|
||||
|
||||
node6:
|
||||
extends: node4
|
||||
image: inteliotdevkit/mraa-node6
|
@@ -1,60 +0,0 @@
|
||||
96Boards Development Platform {#_96boards}
|
||||
=============================
|
||||
|
||||
96Boards is a range of hardware specifications created by Linaro to make the latest ARM-based processors available to developers at a reasonable cost. The specifications are open and define a standard board layout for SoC-agnostic (processor independent) development platforms that can be used by software application, hardware device, kernel and other system software developers. Boards produced to the 96Boards specifications are suitable for rapid prototyping, hobbyist projects or incorporation into new systems for a wide range of applications including desktop and laptop computing, the digital home, digital signage, point of sale (POS), high-end audio, robotics and drones, artificial intelligence, virtual reality, IoT and industrial control.
|
||||
|
||||
Standardized expansion buses for peripheral I/O have led to a wide range of compatible add-on mezzanine boards that will work across a variety of 96Boards products. Users have access to a wide range of boards with different features at various price points. In addition, some SoC vendors have announced long term availability of the SoC to encourage their use in products with long life cycles.
|
||||
|
||||
Board Support
|
||||
-------------
|
||||
|
||||
- [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
|
||||
---------------
|
||||
|
||||
- **GPIO**: Pin 28 / GPIO-F is a Multi-Purpose pin
|
||||
- **UART**: UART1 can be used for serial access
|
||||
|
||||
Pin Mapping
|
||||
-----------
|
||||
|
||||
Pin mapping table shows signals pertaining to 40-pin low speed expansion header based on [96Boards Consumer Edition Specification](https://github.com/96boards/documentation/blob/master/Specifications/96Boards-CE-Specification.pdf).
|
||||
|
||||
| 96Boards Signals | PIN | PIN | 96Boards Signals |
|
||||
|:------------------|:------|------:|:-------------------|
|
||||
| GND | 1 | 2 | GND |
|
||||
| UART0_CTS | 3 | 4 | PWR_BTN_N |
|
||||
| UART0_TxD | 5 | 6 | RST_BTN_N |
|
||||
| UART0_RxD | 7 | 8 | SPI0_SCLK |
|
||||
| UART1_RTS | 9 | 10 | SPI0_DIN |
|
||||
| UART1_TxD | 11 | 12 | SPI0_CS |
|
||||
| UART1_RxD | 13 | 14 | SPI0_DOUT |
|
||||
| I2C0_SCL | 15 | 16 | PCM_FS |
|
||||
| I2C0_SDA | 17 | 18 | PCM_CLK |
|
||||
| I2C1_SCL | 19 | 20 | PCM_DO |
|
||||
| I2C1_SDA | 21 | 22 | PCM_DI |
|
||||
| GPIO-A | 23 | 24 | GPIO-B |
|
||||
| GPIO-C | 25 | 26 | GPIO-D |
|
||||
| GPIO-E | 27 | 28 | GPIO-F |
|
||||
| GPIO-G | 29 | 30 | GPIO-H |
|
||||
| GPIO-I | 31 | 32 | GPIO-J |
|
||||
| GPIO-K | 33 | 34 | GPIO-L |
|
||||
| +1V8 | 35 | 36 | SYS_DCIN |
|
||||
| +5V | 37 | 38 | SYC_DCIN |
|
||||
| GND | 39 | 40 | GND |
|
||||
|
||||
Resources
|
||||
---------
|
||||
|
||||
The following links will take you to addition 96Boards resources
|
||||
|
||||
- [Website](http://www.96boards.org/)
|
||||
- [Forums](https://discuss.96boards.org/)
|
||||
- [Documentation Repo](https://github.com/96boards/documentation)
|
@@ -1,38 +0,0 @@
|
||||
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
|
@@ -1,56 +0,0 @@
|
||||
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
|
||||
|
||||
|
||||
|
247
docs/building.md
247
docs/building.md
@@ -4,37 +4,28 @@ libmraa uses cmake in order to make compilation relatively painless. CMake runs
|
||||
build out of tree so the recommended way is to clone from git and make a `build/`
|
||||
directory inside the clone directory.
|
||||
|
||||
For building imraa check @ref buildingimraa page.
|
||||
|
||||
For building imraa check [building imraa](./imraa.md)
|
||||
## Build dependencies
|
||||
|
||||
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+ (3.0.12 recommended, on Xenial this can be installed via 3rd party PPAs)
|
||||
* [SWIG](http://swig.org) 3.0.5+
|
||||
* [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)
|
||||
* [node.js](http://nodejs.org) 0.10.x or 0.12.x (you'll need not just the interpreter but nodejs-dev)
|
||||
* [CMake](http://cmake.org) 2.8.8+ (3.1+ is recommended for node.js version 2+)
|
||||
* [json-c](https://github.com/json-c/json-c) 0.12+ (0.10+ probably works in reality)
|
||||
|
||||
For Debian-like distros the below command installs the basic set:
|
||||
|
||||
```bash
|
||||
sudo apt-get install git build-essential swig3.0 python-dev nodejs-dev cmake libjson-c-dev
|
||||
sudo apt-get install git build-essential swig3.0 python-dev nodejs-dev cmake
|
||||
```
|
||||
|
||||
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)
|
||||
* [Sphinx](http://sphinx-doc.org/) 1.1.3+ (For Python docs)
|
||||
|
||||
|
||||
## Basic build steps
|
||||
|
||||
~~~~~~~~~~~~~{.sh}
|
||||
@@ -61,9 +52,8 @@ Currently our install logic puts Python bindings into standard paths, which
|
||||
do not work on Debian due to their
|
||||
[policy](http://www.debian.org/doc/packaging-manuals/python-policy/ch-python.html#s-paths).
|
||||
|
||||
We are working on a permanent solution, in the meantime please use this command
|
||||
after `make install` to link installed modules where Debian's Python expects
|
||||
them:
|
||||
We are working on a permanent solution, in the meanwhile please use this command
|
||||
after `make install` to link installed modules where Debian's Python expects them:
|
||||
|
||||
```bash
|
||||
sudo ln -s <your install prefix, e.g. /usr>/lib/python2.7/site-packages/* /usr/lib/python2.7/dist-packages
|
||||
@@ -85,7 +75,7 @@ A few recommended options:
|
||||
Changing install path from `/usr/local` to `/usr`:
|
||||
`-DCMAKE_INSTALL_PREFIX:PATH=/usr`
|
||||
|
||||
Building debug build - adds `-g` and disables optimizations - this will force a
|
||||
Building debug build - adds `-g` and disables optimisations - this will force a
|
||||
full rebuild:
|
||||
`-DCMAKE_BUILD_TYPE=DEBUG`
|
||||
|
||||
@@ -101,66 +91,30 @@ Disabling Python module building:
|
||||
Building doc, this will require [SPHINX](http://sphinx-doc.org) &
|
||||
[Doxygen](http://doxygen.org):
|
||||
`-DBUILDDOC=ON`
|
||||
You will also require clone git submodules from your existing checkout:
|
||||
`git submodule update --init --recursive`
|
||||
Then from doxygen2jsdoc dir:
|
||||
`npm install`
|
||||
Then from doxyport dir:
|
||||
`make setup`
|
||||
|
||||
Override build architecture (this is useful because on x86 ARM code is not
|
||||
compiled so use this flag to force the target arch)
|
||||
`-DBUILDARCH=arm`
|
||||
|
||||
You can also enable -Wall for gcc before running cmake by exporting your wanted
|
||||
CC flags to the CC env var
|
||||
`export CC="gcc -Wall"`
|
||||
|
||||
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.12 to build the
|
||||
You'll need at least SWIG version 3.0.2 and we recommend 3.0.5 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
|
||||
2.x.
|
||||
|
||||
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
|
||||
version.c in build/src. If you don't build from a git tree then you will simply
|
||||
have a version which matches the latest released version of mraa.
|
||||
compile with `git` installed your version of mraa will be tagged `-dirty`. This
|
||||
simply means `git` wasn't installed or that you where building from a tarball.
|
||||
You can modify `build/src/version.c` before running `make` if this is incorrect.
|
||||
The instructions listed here all assume that `build/` is an empty dir that lives
|
||||
inside the cloned repository of mraa.
|
||||
|
||||
If you have multiple versions of Python then mraa can get confused, we
|
||||
recommend using virtualenv to select which version of Python you want. We test
|
||||
2.7 the most but SWIG will generate valid 3.x Python code but we do not
|
||||
generally support building both at once.
|
||||
|
||||
## Using a Yocto/OE toolchain
|
||||
|
||||
@@ -175,8 +129,20 @@ cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchains/oe-sdk_cross.cmake ..
|
||||
make
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
## Building Java bindings
|
||||
## Using Coverity
|
||||
|
||||
Static analysis is routinely performed using Coverity on libmraa's codebase.
|
||||
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/`
|
||||
and have a way of switching between alternatives. We support both OpenJDK and Oracle's JDK.
|
||||
On Arch Linux with OpenJDK 8 you'll have to set this yourself like this:
|
||||
@@ -191,147 +157,24 @@ javac -cp $DIR_WHERE_YOU_INSTALLED_MRAA/mraa.jar:. Example.java
|
||||
~~~~~~~~~~~~~
|
||||
To run, make sure `libmraajava.so` is in `LD_LIBRARY_PATH`
|
||||
~~~~~~~~~~~~~{.sh}
|
||||
java -cp $DIR_WHERE_YOU_INSTALLED_MRAA/mraa.jar:. Example
|
||||
jave -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>.
|
||||
If you want to add or improve Java bindings for mraa, please follow the [Creating Java Bindings Guide](https://github.com/intel-iot-devkit/upm/blob/master/docs/creating_java_bindings.md).
|
||||
|
||||
## Building for the Android Things Peripheralmanager Client
|
||||
## Building an IPK/RPM package using `cpack`
|
||||
|
||||
Requirements:
|
||||
* [Android Things Native Library](https://github.com/androidthings/native-libandroidthings) >= 0.5.1
|
||||
* [Android NDK](https://developer.android.com/ndk/downloads/index.html) >= 14b
|
||||
|
||||
The [Android NDK](https://developer.android.com/ndk/downloads/index.html) contains a CMake find_package module
|
||||
`FindAndroidThings.cmake`. Make sure the directory containing this module is
|
||||
added to the `CMAKE_MODULE_PATH`.
|
||||
|
||||
### Android NDK r14b
|
||||
You can get `cpack` to generate an IPK or RPM package fairly easily if you have
|
||||
the correct packaging tools
|
||||
|
||||
~~~~~~~~~~~~~{.sh}
|
||||
NDK_HOME="/path/to/android-ndk-r14b"
|
||||
ANDROIDTHINGS_NATIVE_LIB="/path/to/native-libandroidthings-0.5.1-devpreview"
|
||||
|
||||
cmake -DBUILDSWIG=ON \
|
||||
-DBUILDSWIGPYTHON=OFF \
|
||||
-DBUILDSWIGNODE=OFF \
|
||||
-DBUILDSWIGJAVA=ON \
|
||||
-DANDROID_COMPILER_FLAGS_CXX='-std=c++11' \
|
||||
-DANDROID_PIE=1 \
|
||||
-DANDROID_PLATFORM=android-24 \
|
||||
-DANDROID_STL_FORCE_FEATURES=ON \
|
||||
-DANDROID_STL=c++_shared \
|
||||
-DANDROID_TOOLCHAIN_NAME=x86-i686 \
|
||||
-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY \
|
||||
-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \
|
||||
-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=BOTH \
|
||||
-DCMAKE_FIND_ROOT_PATH=$NDK_HOME/platforms/android-24/arch-x86/ \
|
||||
-DCMAKE_MODULE_PATH=$ANDROIDTHINGS_NATIVE_LIB \
|
||||
-DCMAKE_TOOLCHAIN_FILE=$NDK_HOME/build/cmake/android.toolchain.cmake \
|
||||
-DBUILDARCH=PERIPHERALMAN \
|
||||
..
|
||||
cmake -DIPK=ON -DCMAKE_INSTALL_PREFIX=/usr ..
|
||||
make package
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
## Building with Docker
|
||||
To use RPM simply enable the RPM option. You'll need `rpmbuild` installed on your
|
||||
build machine.
|
||||
|
||||
You can use `docker` and `docker-compose` to generate a complete build environment
|
||||
for mraa without having to install any other tool.
|
||||
|
||||
Requirements:
|
||||
* [docker](https://www.docker.com/get-docker) >= 1.12.6
|
||||
* [docker-compose](https://docs.docker.com/compose/install/) >= 1.9.0
|
||||
|
||||
**NOTE:** docker-compose is an optional requirement. It actually make running complex
|
||||
docker build and run command easier. But you can just use docker to build and run.
|
||||
|
||||
### Using Docker Images to build Mraa
|
||||
|
||||
**tl;dr:** Just use this commands to build mraa:
|
||||
|
||||
```sh
|
||||
# Build mraa documentation
|
||||
$ docker-compose run doc
|
||||
# Build mraa python2 package and run python2 tests
|
||||
$ docker-compose run python2
|
||||
# Build mraa python3 package and run python3 tests
|
||||
$ docker-compose run python3
|
||||
# Build mraa java package and run java tests
|
||||
$ docker-compose run java
|
||||
# Build mraa node4 package
|
||||
$ docker-compose run node4
|
||||
# Build mraa node5 package
|
||||
$ docker-compose run node5
|
||||
# Build mraa node6 package
|
||||
$ docker-compose run node6
|
||||
# Build mraa for android things package
|
||||
$ docker-compose run android
|
||||
# Run Sonar Qube Scans for mraa
|
||||
$ docker-compose run sonar-scan
|
||||
```
|
||||
|
||||
**docker-compose** will take a look at the `docker-compose.yaml` file in the repository
|
||||
root directory, pull the required docker image, and run an specific command to build
|
||||
mraa for the requested target.
|
||||
Once the build is completed, you will have a `build/` folder in the repository root with all
|
||||
the compiled code. This `build/` folder is created by using a docker volume. The `build\`
|
||||
folder contents is reused each time you execute `docker-compose run [TARGET]`.
|
||||
To know more about volumes in Docker, visit the [Docker Volume Documentation](https://docs.docker.com/engine/tutorials/dockervolumes/).
|
||||
|
||||
You can also start an interactive session inside the docker container if you need to run some
|
||||
custom build commands:
|
||||
|
||||
```sh
|
||||
# Start an interactive bash shell inside the container
|
||||
$ docker-compose run python2 bash
|
||||
# From now, all the commands are executed inside the container
|
||||
$ cd build && cmake -DBUILDSWIGPYTHON=ON .. && make clean all
|
||||
```
|
||||
|
||||
If you don't want to use docker-compose, you can also use `docker run` to build mraa.
|
||||
For example, to build mraa for python2, you can do:
|
||||
|
||||
```sh
|
||||
# From the repository root folder
|
||||
$ docker run \
|
||||
--volume=$(pwd):/usr/src/app \
|
||||
--env BUILDSWIG=ON \
|
||||
--env BUILDSWIGPYTHON=ON \
|
||||
--env BUILDSWIGJAVA=OFF \
|
||||
--env BUILDSWIGNODE=OFF \
|
||||
inteliotdevkit/mraa-python \
|
||||
bash -c "./scripts/run-cmake.sh && make -Cbuild _python2-mraa"
|
||||
```
|
||||
|
||||
### Proxy considerations
|
||||
|
||||
If, for some reason, you are behind a proxy, find below a list of common problems related
|
||||
to proxy settings:
|
||||
|
||||
**docker cannot pull images from docker.io**
|
||||
|
||||
Visit [this link](https://docs.docker.com/engine/admin/systemd/#httphttps-proxy)
|
||||
to configure docker daemon behind a proxy.
|
||||
|
||||
**docker run fails to access the internet**
|
||||
|
||||
Docker-compose will automatically take `http_proxy`, `https_proxy`, and `no_proxy`
|
||||
environment variables and use it as build arguments. Be sure to properly configure
|
||||
this variables before building.
|
||||
|
||||
Docker, unlike docker-compose, does not take the proxy settings from the environment
|
||||
automatically. You need to send them as environment arguments:
|
||||
|
||||
```sh
|
||||
# From the repository root folder
|
||||
$ docker run \
|
||||
--volume=$(pwd):/usr/src/app \
|
||||
--env BUILDSWIG=ON \
|
||||
--env BUILDSWIGPYTHON=ON \
|
||||
--env BUILDSWIGJAVA=OFF \
|
||||
--env BUILDSWIGNODE=OFF \
|
||||
--env http_proxy=$http_proxy \
|
||||
--env https_proxy=$https_proxy \
|
||||
--env no_proxy=$no_proxy \
|
||||
inteliotdevkit/mraa-python \
|
||||
bash -c "./scripts/run-cmake.sh && make -Cbuild _python2-mraa"
|
||||
```
|
||||
~~~~~~~~~~~~~{.sh}
|
||||
cmake -DRPM=ON -DCMAKE_INSTALL_PREFIX=/usr ..
|
||||
~~~~~~~~~~~~~
|
||||
|
@@ -5,82 +5,6 @@ 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
|
||||
* CMake 3.8+ improvements
|
||||
* Peripheral I/O improvements
|
||||
* Json platform improvements
|
||||
* Static analysis cleanup using SonarQube
|
||||
|
||||
**1.7.0**
|
||||
* Peripheral I/O support for Android Things
|
||||
* Deprecation of node v0.10.x and 0.12.x
|
||||
* Documentation improvements
|
||||
|
||||
**1.6.1**
|
||||
* mraa-deinit bug fix
|
||||
* rpi3 fix
|
||||
* ALTERA_SOCFPGA -> DE_NANO_SOC
|
||||
|
||||
**1.6.0**
|
||||
* de-10 nano board support
|
||||
* Improved Intel Joule support & renamed from GT_TUCHUCK to Joule
|
||||
* Improved RPI3 support
|
||||
* Fixes for UP, 96boards & phyboard-wega
|
||||
* Call mraa_deinit with a gcc destructor attribute
|
||||
|
||||
**1.5.1**
|
||||
* Small memleaks plugged
|
||||
* imraa useless arp statements removed
|
||||
* NPM 1.5.0 did not 100% match real 1.5.0 tag, this resolves this
|
||||
|
||||
**1.5.0**
|
||||
* imraa now uses argp, slight option changes, you need to use -a to flash a 101
|
||||
* Joule i2c enumeration much improved, uses pci id
|
||||
* Firmata add a spinlock to remove possible race condition
|
||||
* Mock Uart functionality
|
||||
|
||||
**1.4.0**
|
||||
* Add support for Siemens SIMATIC IOT2000
|
||||
* Cmake now enables much more error detection depending on compiler support
|
||||
* Mraa Maven packages now enabled
|
||||
* Galileo Gen2 AIO fix using pincmd
|
||||
* Adding an already added firmata platform now returns MRAA_SUCCESS
|
||||
* Cmake no longer tags builds without git as '-dirty' version.c for easier
|
||||
packaging support
|
||||
|
||||
**1.3.0**
|
||||
* Fix GT GPIO bugs
|
||||
* Mock SPI and travis now uses mock and tests it
|
||||
* RPI zero support
|
||||
|
||||
**1.2.3**
|
||||
* Revert 1.2.1 binding.gyp changed that had side effect of enabling JSONPLAT in mraa.c
|
||||
* improve travis.ci to load mraa.node as compiled from make npmpkg target
|
||||
@@ -95,25 +19,25 @@ they are listed here. Anything pre 0.2.x is ignored.
|
||||
**1.2.0**
|
||||
* JSON platform support
|
||||
* mock I2c functionality
|
||||
* Intel Joule PWM fix
|
||||
* Intel Grosse Tete PWM fix
|
||||
* AIO firmata bug fix
|
||||
|
||||
**1.1.2**
|
||||
* Mock platform support
|
||||
* mraa-i2c treats i2c buses by default as linux
|
||||
* Intel Joule i2c fixes
|
||||
* grosse tete i2c fixes
|
||||
* travis now uses 14.04 instead of 12.04
|
||||
|
||||
**1.1.1**
|
||||
* IIO 4.6 kernel matrix support
|
||||
* Intel Joule radio led support
|
||||
* Intel Grosse Tete radio led support
|
||||
* mraa_init_io() examples
|
||||
* MRAAPLATFORMFORCE fixes
|
||||
* fix python documentation
|
||||
|
||||
**1.1.0**
|
||||
* build python2 & python3 bindings
|
||||
* Intel Joule support
|
||||
* Intel Grosse Tete support
|
||||
* mraa_init_io() generic funtion
|
||||
* mraa-gpio fixes
|
||||
* edison PWM 0% improvements
|
||||
|
@@ -1,153 +0,0 @@
|
||||
Terasic DE10-Nano {#de10-nano}
|
||||
=================
|
||||
|
||||
The DE10-Nano Development Kit presents a robust hardware design platform built around the Intel
|
||||
System-on-Chip (SoC) FPGA, which combines the latest dual-core Cortex-A9 embedded cores with
|
||||
industry-leading programmable logic for ultimate design flexibility. Users can now leverage the
|
||||
power of tremendous re-configurability paired with a high-performance, low-power processor system.
|
||||
Altera’s SoC integrates an ARM-based hard processor system (HPS) consisting of processor,
|
||||
peripherals and memory interfaces tied seamlessly with the FPGA fabric using a high-bandwidth
|
||||
interconnect backbone. The DE10-Nano development board is equipped with high-speed DDR3 memory,
|
||||
analog to digital capabilities, Ethernet networking, and much more that promise many exciting
|
||||
applications.
|
||||
|
||||
Board Support
|
||||
-------------
|
||||
|
||||
* Terasic DE10-Nano
|
||||
* Terasic DE0-Nano-SoC
|
||||
|
||||
Protocol Notes
|
||||
---------------
|
||||
|
||||
* **GPIO** Fully supported through sysfs (both FPGA + HPC). Mmap not yet supported. Static map.
|
||||
* **PWM** Currently not supported.
|
||||
* **I2C** Fully supported with i2cdev. Default bus 2 is exposed on Arduino header, 3 buses total.
|
||||
* **SPI** Supported with spidev on Arduino header.
|
||||
* **UART** Working, default bus is on Arduino header. Console also accessible as `ttyS0` in raw mode.
|
||||
* **ADC** Currently not supported.
|
||||
|
||||
No muxes available for multi-function pins yet (e.g. you won't be able to use D0 & D1 on Arduino
|
||||
header as GPIOs).
|
||||
|
||||
Pin Mapping
|
||||
-----------
|
||||
|
||||
**Arduino Header**
|
||||
|
||||
| MRAA Number | Arduino Name | Board Pin | Function |
|
||||
|-------------|--------------|-----------|----------|
|
||||
| 0 | D0 | JP3-8 | UART RX |
|
||||
| 1 | D1 | JP3-7 | UART TX |
|
||||
| 2 | D2 | JP3-6 | GPIO |
|
||||
| 3 | D3 | JP3-5 | GPIO |
|
||||
| 4 | D4 | JP3-4 | GPIO |
|
||||
| 5 | D5 | JP3-3 | GPIO |
|
||||
| 6 | D6 | JP3-2 | GPIO |
|
||||
| 7 | D7 | JP3-1 | GPIO |
|
||||
| 8 | D8 | JP2-10 | GPIO |
|
||||
| 9 | D9 | JP2-9 | GPIO |
|
||||
| 10 | D10 | JP2-8 | SPI SS |
|
||||
| 11 | D11 | JP2-7 | SPI MOSI |
|
||||
| 12 | D12 | JP2-6 | SPI MISO |
|
||||
| 13 | D13 | JP2-5 | SPI SCK |
|
||||
| 14 | GND | JP2-4 | - |
|
||||
| 15 | AREF | JP2-3 | - |
|
||||
| 16 | SDA | JP2-2 | I2C SDA |
|
||||
| 17 | SCL | JP2-1 | I2C SCL |
|
||||
| 18 | AREF | JP5-1 | - |
|
||||
| 19 | IOREF | JP5-2 | - |
|
||||
| 20 | RESET | JP5-3 | - |
|
||||
| 21 | 3V3 | JP5-4 | - |
|
||||
| 22 | 5V | JP5-5 | - |
|
||||
| 23 | GND | JP5-6 | - |
|
||||
| 24 | GND | JP5-7 | - |
|
||||
| 25 | VIN | JP5-8 | - |
|
||||
| 26 | A0 | JP6-1 | AIO |
|
||||
| 27 | A1 | JP6-2 | AIO |
|
||||
| 28 | A2 | JP6-3 | AIO |
|
||||
| 29 | A3 | JP6-4 | AIO |
|
||||
| 30 | A4 | JP6-5 | AIO |
|
||||
| 31 | A5 | JP6-6 | AIO |
|
||||
|
||||
**GPIO0 (JP1) Side Header**
|
||||
|
||||
| MRAA Number | Board Pin | Function |
|
||||
|-------------|-----------|----------|
|
||||
| 32 | JP1-1 | GPIO |
|
||||
| ... | ... | GPIO |
|
||||
| 41 | JP1-10 | GPIO |
|
||||
| 42 | JP1-11 | 5V |
|
||||
| 43 | JP1-12 | GND |
|
||||
| 44 | JP1-13 | GPIO |
|
||||
| ... | ... | GPIO |
|
||||
| 59 | JP1-28 | GPIO |
|
||||
| 60 | JP1-29 | 3V3 |
|
||||
| 61 | JP1-30 | GND |
|
||||
| 62 | JP1-31 | GPIO |
|
||||
| ... | ... | GPIO |
|
||||
| 71 | JP1-40 | GPIO |
|
||||
|
||||
**GPIO1 (JP7) Side Header**
|
||||
|
||||
| MRAA Number | Board Pin | Function |
|
||||
|-------------|-----------|----------|
|
||||
| 72 | JP7-1 | GPIO |
|
||||
| ... | ... | GPIO |
|
||||
| 81 | JP7-10 | GPIO |
|
||||
| 82 | JP7-11 | 5V |
|
||||
| 83 | JP7-12 | GND |
|
||||
| 84 | JP7-13 | GPIO |
|
||||
| ... | ... | GPIO |
|
||||
| 99 | JP7-28 | GPIO |
|
||||
| 100 | JP7-29 | 3V3 |
|
||||
| 101 | JP7-30 | GND |
|
||||
| 102 | JP7-31 | GPIO |
|
||||
| ... | ... | GPIO |
|
||||
| 111 | JP7-40 | GPIO |
|
||||
|
||||
**Switches, Buttons, LEDs**
|
||||
|
||||
These are already in use by kernel drivers with the default image, except for KEY0 and KEY1.
|
||||
To use them with MRAA remove them from the device tree.
|
||||
|
||||
To enable the switches temporarily (until reboot):
|
||||
|
||||
```sh
|
||||
echo ff204000.gpio >/sys/bus/platform/drivers/altera_gpio/unbind
|
||||
echo ff204000.gpio >/sys/bus/platform/drivers/altera_gpio/bind
|
||||
```
|
||||
|
||||
And for LEDs:
|
||||
|
||||
```sh
|
||||
echo ff203000.gpio >/sys/bus/platform/drivers/altera_gpio/unbind
|
||||
echo ff203000.gpio >/sys/bus/platform/drivers/altera_gpio/bind
|
||||
```
|
||||
|
||||
| MRAA Number | Board Pin | Function |
|
||||
|-------------|-----------|----------|
|
||||
| 112 | SW0 | GPIO |
|
||||
| 113 | SW1 | GPIO |
|
||||
| 114 | SW2 | GPIO |
|
||||
| 115 | SW3 | GPIO |
|
||||
| 116 | LED0 | GPIO |
|
||||
| 117 | LED1 | GPIO |
|
||||
| 118 | LED2 | GPIO |
|
||||
| 119 | LED3 | GPIO |
|
||||
| 120 | LED4 | GPIO |
|
||||
| 121 | LED5 | GPIO |
|
||||
| 122 | LED6 | GPIO |
|
||||
| 123 | LED7 | GPIO |
|
||||
| 124 | HPS_LED | GPIO |
|
||||
| 125 | HPS_KEY | GPIO |
|
||||
| 126 | KEY0 | GPIO |
|
||||
| 127 | KEY1 | GPIO |
|
||||
|
||||
**Built-in ADXL345**
|
||||
|
||||
Exposed on I2C bus 0. To use you will have to unbind the device driver first:
|
||||
|
||||
```sh
|
||||
echo 0-0053 > /sys/bus/i2c/drivers/adxl34x/unbind
|
||||
```
|
@@ -8,11 +8,8 @@ this list as it's the first thing we'll ask you to do.
|
||||
|
||||
Getting the exact version of libmraa you're running is really important to us.
|
||||
The best way to get this is to call mraa_get_version() or mraa.getVersion(). If
|
||||
you built from git then please tell us which commit hash you used. Mraa no
|
||||
longer tags itself as 'dirty' if built as a non tagged version but simply uses
|
||||
the latest version number listed in the top level CMakeLists.txt file. Note
|
||||
that you may have to wipe the build/ dir for git sha version to be absolutely
|
||||
correct.
|
||||
mraa returns x.x.x-dirty then your version was not built from a git tree or you
|
||||
built out of tree (see our building doc) - or you don't have git installed.
|
||||
|
||||
### Finding error logs
|
||||
|
||||
@@ -25,12 +22,10 @@ systemd likely your log is in /var/log/messages or a similar location.
|
||||
|
||||
### Common errors to check for
|
||||
|
||||
* Not running as a user with permissions to the physical char devices/files
|
||||
that require access. Check quickly if it works as root and you likely have
|
||||
such an issue. The log file will reflect this
|
||||
* Not running as root
|
||||
* Incorrect IO pin numbers, mraa uses physical connector pin numbering see your
|
||||
platform documentation for details
|
||||
* Your platform is unsupported or has been detected wrongly (logfile will show this)
|
||||
* Your platform is unsupported
|
||||
* Using the wrong pin, check pin capabilities either using the API or your
|
||||
platform documentation
|
||||
|
||||
|
@@ -1,6 +1,112 @@
|
||||
Grosstete {#grossetete}
|
||||
=========
|
||||
Grosse Tete {#grossetete}
|
||||
===========
|
||||
|
||||
You probably meant to go here: @ref joule.
|
||||
The Grosse Tete with the Tuchuck board is supported by Mraa
|
||||
|
||||
Note: This page will be deleted in the future, don't link to it!
|
||||
Revision Support
|
||||
----------------
|
||||
Tuchuck
|
||||
|
||||
Interface notes
|
||||
---------------
|
||||
|
||||
**SPI** Currently not working
|
||||
|
||||
**UART** Some pins are labelled as UARTs but are not configured in BIOS as UART
|
||||
so only available UART is on the FTDI header
|
||||
|
||||
Pin Mapping
|
||||
-----------
|
||||
|
||||
Tuchuck has two breakouts, breakout #1 is 1-40 whilst breakout2 is 41-80. The
|
||||
LEDs are numbered from 100-103.
|
||||
|
||||
| MRAA Number | Physical Pin | Function |
|
||||
|-------------|--------------|----------|
|
||||
| 1 | GPIO | GPIO |
|
||||
| 2 | SPP1RX | GPIO |
|
||||
| 3 | PMICRST | NONE |
|
||||
| 4 | SPP1TX | GPIO |
|
||||
| 5 | 19.2mhz | GPIO |
|
||||
| 6 | SPP1FS0 | GPIO |
|
||||
| 7 | UART0TX | GPIO |
|
||||
| 8 | SPP1FS2 | GPIO |
|
||||
| 9 | PWRGD | NONE |
|
||||
| 10 | SPP1CLK | GPIO |
|
||||
| 11 | I2C0SDA | I2C |
|
||||
| 12 | I2S1SDI | GPIO |
|
||||
| 13 | I2C0SCL | I2C |
|
||||
| 14 | I2S1SDO | GPIO |
|
||||
| 15 | I2C1SDA | I2C |
|
||||
| 16 | I2S1WS | GPIO |
|
||||
| 17 | I2C1SCL | I2C |
|
||||
| 18 | I2S1CLK | GPIO |
|
||||
| 19 | I2C2SDA | I2C |
|
||||
| 20 | I2S1MCL | GPIO |
|
||||
| 21 | I2C2SCL | I2CO |
|
||||
| 22 | UART1TX | UART |
|
||||
| 23 | I2S4SDO | NONE |
|
||||
| 24 | UART1RX | UART |
|
||||
| 25 | I2S4SDI | NONE |
|
||||
| 26 | PWM0 | GPIO PWM |
|
||||
| 27 | I2S4BLK | GPIO |
|
||||
| 28 | PWM1 | GPIO PWM |
|
||||
| 29 | I2S4WS | NONE |
|
||||
| 30 | PWM2 | GPIO PWM |
|
||||
| 31 | I2S3SDO | NONE |
|
||||
| 32 | PWM3 | GPIO PWM |
|
||||
| 33 | I2S3SDI | NONE |
|
||||
| 34 | 1.8V | NONE |
|
||||
| 35 | I2S4BLK | GPIO |
|
||||
| 36 | GND | NONE |
|
||||
| 37 | GND | NONE |
|
||||
| 38 | GND | NONE |
|
||||
| 39 | GND | NONE |
|
||||
| 40 | 3.3V | NONE |
|
||||
| 41 | GND | NONE |
|
||||
| 42 | 5V | NONE |
|
||||
| 43 | GND | NONE |
|
||||
| 44 | 5V | NONE |
|
||||
| 45 | GND | NONE |
|
||||
| 46 | 3.3V | NONE |
|
||||
| 47 | GND | NONE |
|
||||
| 48 | 3.3V | NONE |
|
||||
| 49 | GND | NONE |
|
||||
| 50 | 1.8V | NONE |
|
||||
| 51 | GPIO | GPIO |
|
||||
| 52 | 1.8V | NONE |
|
||||
| 53 | PANEL | GPIO |
|
||||
| 54 | GND | NONE |
|
||||
| 55 | PANEL | GPIO |
|
||||
| 56 | CAMERA | NONE |
|
||||
| 57 | PANEL | GPIO |
|
||||
| 58 | CAMERA | NONE |
|
||||
| 59 | SPP0FS0 | GPIO |
|
||||
| 60 | CAMERA | NONE |
|
||||
| 61 | SPP0FS1 | GPIO |
|
||||
| 62 | SPI_DAT | SPI |
|
||||
| 63 | SPP0FS2 | GPIO |
|
||||
| 64 | SPICLKB | GPIO SPI |
|
||||
| 65 | SPP0FS3 | GPIO |
|
||||
| 66 | SPICLKA | GPIO SPI |
|
||||
| 67 | SPP0TX | GPIO |
|
||||
| 68 | UART0RX | GPIO UART|
|
||||
| 69 | SPP0RX | GPIO |
|
||||
| 70 | UART0RT | GPIO UART|
|
||||
| 71 | I2C1SDA | GPIO I2C |
|
||||
| 72 | UART0CT | GPIO UART|
|
||||
| 73 | I2C1SCL | GPIO I2C |
|
||||
| 74 | UART1TX | GPIO UART|
|
||||
| 75 | I2C2SDA | GPIO I2C |
|
||||
| 76 | UART1RX | GPIO UART|
|
||||
| 77 | I2C1SCL | GPIO I2C |
|
||||
| 78 | UART1RT | GPIO UART|
|
||||
| 79 | RTC_CLK | GPIO |
|
||||
| 80 | UART1CT | GPIO UART|
|
||||
| 100 | LED100 | GPIO |
|
||||
| 101 | LED101 | GPIO |
|
||||
| 102 | LED102 | GPIO |
|
||||
| 103 | LED103 | GPIO |
|
||||
|
||||
To see a live pin mapping use the command:
|
||||
$ mraa-gpio list
|
||||
|
@@ -1,66 +0,0 @@
|
||||
GrovePi Shield {#grovepi}
|
||||
=============================
|
||||
|
||||
Mraa can use a GrovePi shield as a subplatform. This means one can utilize the
|
||||
shield IO as well as the IO on the carrier board. The GrovePi shield is meant
|
||||
for RPi boards and compatibles such as UP and UP2. It provides convenient GrovePi
|
||||
style connectors that can be used with various Grove sensors.
|
||||
|
||||
Communication with the shield is achieved over I2C using a custom firmware. It
|
||||
provides access to extra GPIO, AIO and PWM pins.
|
||||
|
||||
### Using the subplatform API ###
|
||||
|
||||
Using the subplatform API is relatively simple, simply add '512', the platform
|
||||
offset, to any IO calls.
|
||||
|
||||
Example:
|
||||
* D3 becomes GPIO 512 + 3 = 515
|
||||
* A2 becomes pin 512 + 2 = 514
|
||||
|
||||
Keep in mind that the I2C ports on the GrovePi shield are merely a level shifted
|
||||
extension of the carrier board's I2C bus, hence I2C sensors do not require an
|
||||
offset.
|
||||
|
||||
The API works from UPM or mraa in any of the supported languages and is compiled
|
||||
with mraa by default. Multiple subplatforms are not yet supported.
|
||||
|
||||
### Pinout ###
|
||||
|
||||
For a complete diagram of the pins available on these shields please refer to
|
||||
the hardware section of the [GrovePi Github repository](https://github.com/DexterInd/GrovePi).
|
||||
|
||||
### Simple code example ###
|
||||
|
||||
This piece of code fades an LED connected to D3 based on the position of a
|
||||
rotary potentiometer on A2:
|
||||
|
||||
```c
|
||||
#include <stdbool.h>
|
||||
#include "mraa.h"
|
||||
|
||||
void main (int argc, char** argv)
|
||||
{
|
||||
mraa_add_subplatform(MRAA_GROVEPI, "0");
|
||||
|
||||
mraa_aio_context aio = mraa_aio_init(514);
|
||||
mraa_pwm_context pwm = mraa_pwm_init(515);
|
||||
|
||||
while(true) {
|
||||
mraa_pwm_write(pwm, mraa_aio_read(aio)/1023.0);
|
||||
usleep(50000);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Note that the I2C bus number needs to be passed in as a string to
|
||||
`mraa_add_subplatform`.
|
||||
|
||||
### Limitations & features to be added ###
|
||||
|
||||
Currently there is no support for ISRs or the option to query the shield's
|
||||
firmware version, but these features may be added at a later point.
|
||||
|
||||
Theoretically GrovePi Zero shields are compatible too, however they were not
|
||||
tested. Obviously, only a subset of the IO pins can be used due to the reduced
|
||||
footprint of this shield.
|
@@ -1,40 +0,0 @@
|
||||
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 |
|
@@ -6,7 +6,7 @@ MRAA_GENERIC_FIRMATA subplatform to the first process that calls imraa_init
|
||||
|
||||
## Build dependencies
|
||||
To build imraa, you'll need to build mraa with -DIMRAA=ON and all the normal
|
||||
dependencies for build mraa, see @ref building page.
|
||||
dependencies for build mraa, see [Building mraa](./building.md).
|
||||
You'll also need the following:
|
||||
* [dfu-utils-cross](https://github.com/arduino/dfu-utils-cross) or dfu 0.8 (0.9
|
||||
does not work well with the 101). Precompiled binaries can be found on
|
||||
@@ -30,6 +30,7 @@ make
|
||||
After you've built mraa you can install using `make install`.
|
||||
|
||||
## Running Imraa
|
||||
|
||||
Before being able to use mraa to program the Arduino101 you will need to run
|
||||
imraa to flash the sketch file onto the board. The sketch file that imraa will
|
||||
look for is located here: [Arduino101 Sketch](http://iotdk.intel.com/misc/ConfigurableFirmataCurieImu.ino.bin).
|
||||
|
@@ -19,10 +19,9 @@ Java classes directly wrap the C/C++ API and provide a near 1:1 mapping of
|
||||
functionality.
|
||||
|
||||
<center>
|
||||
| C API Modules | Java API Classes |
|
||||
| C API Modules | Java API Classes |
|
||||
|:----------------------:|:----------------------------:|
|
||||
| @ref gpio.h "gpio" | @ref mraa::Gpio "Gpio class" |
|
||||
| @ref led.h "led" | @ref mraa::Led "Led class" |
|
||||
| @ref i2c.h "i2c" | @ref mraa::I2c "I2c class" |
|
||||
| @ref aio.h "aio" | @ref mraa::Aio "Aio class" |
|
||||
| @ref pwm.h "pwm" | @ref mraa::Pwm "Pwm class" |
|
||||
@@ -46,20 +45,17 @@ Specific platform information for supported platforms is documented here:
|
||||
- @ref rasppi
|
||||
- @ref bananapi
|
||||
- @ref beaglebone
|
||||
- @ref phyboard-wega
|
||||
- @ref nuc5
|
||||
- @ref up
|
||||
- @ref joule
|
||||
- @ref grossetete
|
||||
- @ref ft4222
|
||||
- @ref iei-tank
|
||||
- @ref up-xtreme
|
||||
|
||||
## DEBUGGING
|
||||
|
||||
Sometimes it just doesn't want to work, let us try and help you, you can file
|
||||
issues in github or join us in #mraa on freenode IRC, hang around for a little
|
||||
while because we're not necessarily on 24/7, but we'll get back to you! Have a
|
||||
glance at our @ref debugging page too
|
||||
glance at our @debugging page too
|
||||
|
||||
## COMPILING
|
||||
|
||||
|
@@ -22,7 +22,6 @@ functionality.
|
||||
| C API Modules | C++ API Classes |
|
||||
|:----------------------:|:----------------------------:|
|
||||
| @ref gpio.h "gpio" | @ref mraa::Gpio "Gpio class" |
|
||||
| @ref led.h "led" | @ref mraa::Led "Led class" |
|
||||
| @ref i2c.h "i2c" | @ref mraa::I2c "I2c class" |
|
||||
| @ref aio.h "aio" | @ref mraa::Aio "Aio class" |
|
||||
| @ref pwm.h "pwm" | @ref mraa::Pwm "Pwm class" |
|
||||
@@ -46,37 +45,22 @@ Specific platform information for supported platforms is documented here:
|
||||
- @ref rasppi
|
||||
- @ref bananapi
|
||||
- @ref beaglebone
|
||||
- @ref phyboard-wega
|
||||
- @ref nuc5
|
||||
- @ref up
|
||||
- @ref up2
|
||||
- @ref joule
|
||||
- @ref grossetete
|
||||
- @ref ft4222
|
||||
- @ref _96boards
|
||||
- @ref de10-nano
|
||||
- @ref firmata
|
||||
- @ref grovepi
|
||||
- @ref mock
|
||||
- @ref linkit_7688
|
||||
- @ref omega2
|
||||
- @ref iei-tank
|
||||
- @ref upXtreme
|
||||
|
||||
## DEBUGGING
|
||||
|
||||
Sometimes it just doesn't want to work, let us try and help you, you can file
|
||||
issues in github or join us in #mraa on freenode IRC, hang around for a little
|
||||
while because we're not necessarily on 24/7, but we'll get back to you! Have a
|
||||
glance at our @ref debugging page too
|
||||
glance at our @debugging page too
|
||||
|
||||
## COMPILING
|
||||
|
||||
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
|
||||
|
@@ -166,10 +166,6 @@ conversions and memory allocations are performed so the performance of using
|
||||
these functions compared to the C/C++ equivalent will likely be a little lower,
|
||||
however it is much more natural than using carrays.i typemap library.
|
||||
|
||||
Note that node v7.x.x is not yet supported in SWIG, however this is a patchset
|
||||
in SWIG that enables this and does enable mraa to compile and work against a
|
||||
newer nodejs version.
|
||||
|
||||
### NPM ###
|
||||
|
||||
mraa is published on NPM, there is a target to prebuild a mraa src tarball that
|
||||
|
138
docs/joule.md
138
docs/joule.md
@@ -1,138 +0,0 @@
|
||||
Intel Joule {#joule}
|
||||
===========
|
||||
|
||||
[http://www.intel.com/joule](http://www.intel.com/joule)
|
||||
|
||||
The Intel Joule expansion board is supported by Mraa
|
||||
|
||||
Revision Support
|
||||
----------------
|
||||
Intel Joule expansion board
|
||||
|
||||
Interface notes
|
||||
---------------
|
||||
|
||||
**SPI**
|
||||
|
||||
Two SPI buses are available, one with three and another one with two chipselects.
|
||||
In MRAA terms an SPI "bus" (denoted by a number) is a combination
|
||||
of an actual bus + specific chipselect on this bus. In view of that + taking
|
||||
into account that SPI1CS1 is not available on the board, in MRAA the above
|
||||
translates into five available bus numbers - from 0 to 4, covering SPI0CS0 to SPI1CS2.
|
||||
|
||||
Pins listed are MRAA numbered pins. You will need the `spidev` kernel module loaded
|
||||
with appropriate board configuration for binding, Ref-OS-IoT does not enable this by default.
|
||||
|
||||
MRAA bus # | Ref-OS-IoT bus # | Joule docs bus # | MOSI | MISO | CLK | CS
|
||||
-----------|------------------|------------------|------|------|-----|----
|
||||
0 | 32766 | SPI0 | 67 (J13-27)| 69 (J13-29) | 65 (J13-25) | 59 (J13-19)
|
||||
1 | 32766 | SPI0 | 67 (J13-27)| 69 (J13-29) | 65 (J13-25) | 61 (J13-21)
|
||||
2 | 32766 | SPI0 | 67 (J13-27)| 69 (J13-29) | 65 (J13-25) | 63 (J13-23)
|
||||
3 | 32765 | SPI1 | 4 (J12-4)| 2 (J12-2) | 10 (J12-10) | 6 (J12-6)
|
||||
4 | 32765 | SPI1 | 4 (J12-4)| 2 (J12-2) | 10 (J12-10) | 8 (J12-8)
|
||||
|
||||
**UART** Some pins are labelled as UARTs but are not configured in BIOS as UART
|
||||
so only available UART is on the FTDI header. Disable the getty on ttyS2 and
|
||||
use mraa's uart raw mode to initialise on ttyS2. The Jumper J8 can be used to
|
||||
switch between using the FTDI 6 pin header and the micro USB output.
|
||||
|
||||
Pin Mapping
|
||||
-----------
|
||||
|
||||
The Intel Joule expansion board has two breakouts, breakout #1 is 1-40 whilst breakout2 is 41-80. The
|
||||
LEDs are numbered from 100-103.
|
||||
|
||||
ISH UART are named as: IURT.
|
||||
ISH I2C are named as:IIC.
|
||||
|
||||
| MRAA Number | Physical Pin | Function |
|
||||
|-------------|--------------|----------|
|
||||
| 1 | GPIO | GPIO |
|
||||
| 2 | SPP1RX | GPIO SPI |
|
||||
| 3 | PMICRST | NONE |
|
||||
| 4 | SPP1TX | GPIO SPI |
|
||||
| 5 | 19.2mhz | GPIO |
|
||||
| 6 | SPP1FS0 | GPIO SPI |
|
||||
| 7 | UART0TX | GPIO |
|
||||
| 8 | SPP1FS2 | GPIO SPI |
|
||||
| 9 | PWRGD | NONE |
|
||||
| 10 | SPP1CLK | GPIO SPI |
|
||||
| 11 | I2C0SDA | I2C |
|
||||
| 12 | I2S1SDI | GPIO |
|
||||
| 13 | I2C0SCL | I2C |
|
||||
| 14 | I2S1SDO | GPIO |
|
||||
| 15 | IIC0SDA | I2C |
|
||||
| 16 | I2S1WS | GPIO |
|
||||
| 17 | IIC0SCL | I2C |
|
||||
| 18 | I2S1CLK | GPIO |
|
||||
| 19 | IIC1SDA | I2C |
|
||||
| 20 | I2S1MCL | GPIO |
|
||||
| 21 | IIC1SCL | I2C |
|
||||
| 22 | UART1TX | UART |
|
||||
| 23 | I2S4SDO | NONE |
|
||||
| 24 | UART1RX | UART |
|
||||
| 25 | I2S4SDI | NONE |
|
||||
| 26 | PWM0 | GPIO PWM |
|
||||
| 27 | I2S4BLK | GPIO |
|
||||
| 28 | PWM1 | GPIO PWM |
|
||||
| 29 | I2S4WS | NONE |
|
||||
| 30 | PWM2 | GPIO PWM |
|
||||
| 31 | I2S3SDO | NONE |
|
||||
| 32 | PWM3 | GPIO PWM |
|
||||
| 33 | I2S3SDI | NONE |
|
||||
| 34 | 1.8V | NONE |
|
||||
| 35 | I2S4BLK | GPIO |
|
||||
| 36 | GND | NONE |
|
||||
| 37 | GND | NONE |
|
||||
| 38 | GND | NONE |
|
||||
| 39 | GND | NONE |
|
||||
| 40 | 3.3V | NONE |
|
||||
| 41 | GND | NONE |
|
||||
| 42 | 5V | NONE |
|
||||
| 43 | GND | NONE |
|
||||
| 44 | 5V | NONE |
|
||||
| 45 | GND | NONE |
|
||||
| 46 | 3.3V | NONE |
|
||||
| 47 | GND | NONE |
|
||||
| 48 | 3.3V | NONE |
|
||||
| 49 | GND | NONE |
|
||||
| 50 | 1.8V | NONE |
|
||||
| 51 | GPIO | GPIO |
|
||||
| 52 | 1.8V | NONE |
|
||||
| 53 | PANEL | GPIO |
|
||||
| 54 | GND | NONE |
|
||||
| 55 | PANEL | GPIO |
|
||||
| 56 | CAMERA | NONE |
|
||||
| 57 | PANEL | GPIO |
|
||||
| 58 | CAMERA | NONE |
|
||||
| 59 | SPP0FS0 | GPIO SPI |
|
||||
| 60 | CAMERA | NONE |
|
||||
| 61 | SPP0FS1 | GPIO SPI |
|
||||
| 62 | SPI_DAT | SPI |
|
||||
| 63 | SPP0FS2 | GPIO SPI |
|
||||
| 64 | SPICLKB | GPIO |
|
||||
| 65 | SPI0CLK | GPIO SPI |
|
||||
| 66 | SPICLKA | GPIO |
|
||||
| 67 | SPP0TX | GPIO SPI |
|
||||
| 68 | UART0RX | GPIO UART|
|
||||
| 69 | SPP0RX | GPIO SPI |
|
||||
| 70 | UART0RT | GPIO UART|
|
||||
| 71 | I2C1SDA | I2C |
|
||||
| 72 | UART0CT | GPIO UART|
|
||||
| 73 | I2C1SCL | I2C |
|
||||
| 74 | IURT0TX | GPIO UART|
|
||||
| 75 | I2C2SDA | I2C |
|
||||
| 76 | IURT0RX | GPIO UART|
|
||||
| 77 | I2C2SCL | I2C |
|
||||
| 78 | IURT0RT | GPIO UART|
|
||||
| 79 | RTC_CLK | GPIO |
|
||||
| 80 | IURT0CT | GPIO UART|
|
||||
| 100 | LED100 | GPIO |
|
||||
| 101 | LED101 | GPIO |
|
||||
| 102 | LED102 | GPIO |
|
||||
| 103 | LED103 | GPIO |
|
||||
| 104 | LEDWIFI | GPIO |
|
||||
| 105 | LEDBT | GPIO |
|
||||
|
||||
To see a live pin mapping use the command:
|
||||
$ mraa-gpio list
|
@@ -1,127 +0,0 @@
|
||||
JSON platform {#jsonplat}
|
||||
=============
|
||||
|
||||
JSON platform loading allows libmraa users who work with **simple** and unsupported
|
||||
boards to create JSON configuration files which libmraa understands, allowing
|
||||
libmraa to just 'work' with the unsupported platform. JSON platform **does not work**
|
||||
with boards which require advanced functions which overwrite default functionality or
|
||||
boards that require the mux functionality.
|
||||
|
||||
Syntax
|
||||
------
|
||||
|
||||
The JSON file that libmraa reads needs specific values to be set by default, they
|
||||
are required in every JSON file intended to be used to load the platform.
|
||||
The keywords are case sensitive so be aware when writing the JSON file.
|
||||
Each heading is a top level key in the JSON file, each key's type is Array
|
||||
|
||||
### platform
|
||||
|Key |Type |Required |Description |
|
||||
|-------------|-------|-----------|-----------------------------------------------|
|
||||
|id |int |no | An ID that can be assigned |
|
||||
|name |string |yes | The platform name |
|
||||
|pin_count |int |yes | The total pin count |
|
||||
|gpio_count |int |no | The subset of pincount which able to do GPIO |
|
||||
|i2c_count |int |no | The number of usable I2C ports |
|
||||
|aio_count |int |no | The number of usable AIO ports |
|
||||
|spi_count |int |no | The number of usable SPI ports |
|
||||
|uart_count |int |no | The total UART ports |
|
||||
|pwmDefPeriod |int |no | The default PWM period |
|
||||
|pwmMaxPeriod |int |no | The max PWM period |
|
||||
|pwmMinPeriod |int |no | The min PWM period |
|
||||
|
||||
### layout
|
||||
|
||||
**THIS INDEX'S THE PIN ARRAY**
|
||||
Each available pin specified using pin_count requires a label. There is no need to use an
|
||||
index identifier as the json objects are indexed as they are read, starting with the first
|
||||
json object being treated as index 0.
|
||||
|
||||
The number of json objects in layout should be equal to the pin_count.
|
||||
|
||||
|Key |Type |Required |Description |
|
||||
|-----------|-------|-----------|-----------------------------------------------|
|
||||
|label |string |yes | The label used to describe the pin (11 characters max) |
|
||||
|invalid |boolean|no | Sets the labeled pin as an invalid pin |
|
||||
|
||||
### GPIO
|
||||
|
||||
**THIS INDEX'S THE PIN ARRAY**
|
||||
For the supported GPIO pins here is where we set the raw linux pin it needs to use, the
|
||||
index cannot exceed the total pin_count and the number of JSON ojects cannot exceed the
|
||||
gpio_count total. The index is also used to set the specified pin's capabilities. Each set
|
||||
of keys should be enclosed in a json object.
|
||||
|
||||
|Key |Type |Required |Description |
|
||||
|-----------|-------|-----------|-------------------------------------|
|
||||
|index |int |yes | used to index the pin array |
|
||||
|rawpin |int |yes | used to reference the actual IO pin |
|
||||
|
||||
### I2C
|
||||
|
||||
**THIS INDEX'S THE I2C ARRAY**
|
||||
This is used to setup the I2C functionality. The total number of json objects and the index
|
||||
cannot exceed the i2c_count. Each set of keys should be enclosed in a json object.
|
||||
|
||||
|Key |Type |Required |Description |
|
||||
|-----------|-------|-----------|-------------------------------------|
|
||||
|index |int |yes | Used to index the I2C array |
|
||||
|rawpin |int |yes | The sysfs pin |
|
||||
|sclpin |int |no | The clock pin |
|
||||
|sdapin |int |no | The data pin |
|
||||
|default |boolean|no | Sets the default I2C device used |
|
||||
|
||||
### AIO
|
||||
|
||||
**THIS INDEX'S THE PIN ARRAY**
|
||||
This is used to setup which pins are able to perform AIO. Each set of keys should be
|
||||
enclosed in a json object.
|
||||
|
||||
|Key |Type |Required |Description |
|
||||
|-----------|-------|-----------|-------------------------------------|
|
||||
|index |int |yes | Used to index the pin array |
|
||||
|rawpin |int |yes | The sysfs pin |
|
||||
|
||||
### PWM
|
||||
|
||||
**THIS INDEX'S THE PIN ARRAY**
|
||||
This is used to setup which IO pins can do PWM Each set of keys should be enclosed in a
|
||||
json object.
|
||||
|
||||
|Key |Type |Required |Description |
|
||||
|-----------|-------|-----------|-------------------------------|
|
||||
|index |int |yes | Used to index the pin array |
|
||||
|rawpin |int |yes | The sysfs pin |
|
||||
|chipID |int |yes | The parent ID |
|
||||
|
||||
## SPI
|
||||
|
||||
**THIS INDEX'S THE SPI ARRAY**
|
||||
This is used to setup the SPI functionality. The total number of json objects and the index
|
||||
cannot exceed the spi_count. Each set of keys should be enclosed in a json object.
|
||||
|
||||
|Key |Type |Required |Description |
|
||||
|-----------|-------|-----------|--------------------------------------------|
|
||||
|index |int |yes | The index into the SPI array |
|
||||
|chipID |int |yes | The parent ID |
|
||||
|clock |int |no | The clock used for transmissions |
|
||||
|miso |int |no | Pin used for incoming data from the slave |
|
||||
|mosi |int |no | Pin used for outgoing data from the master |
|
||||
|chipselect |int |no | Pin used to select the slave device |
|
||||
|default |boolean|no | Sets the default SPI device |
|
||||
|
||||
### UART
|
||||
|
||||
**THIS INDEX'S THE UART ARRAY**
|
||||
This is used to setup the UART functionality. The total number of json objects and the index
|
||||
cannot exceed the uart_count. Each set of keys should be enclosed in a json object.
|
||||
|
||||
|Key |Type |Required |Description |
|
||||
|-----------|-------|-----------|-----------------------------------------|
|
||||
|index |int |yes | Used to index the UART array |
|
||||
|chipID |int |yes | Parent ID |
|
||||
|rawpin |int |yes | Sysfs pin |
|
||||
|rx |int |no | Read pin |
|
||||
|tx |int |no | Transmit pin |
|
||||
|path |string |yes | Used to talk to a connected UART device |
|
||||
|default |boolean|no | Sets the default UART device |
|
@@ -1,65 +0,0 @@
|
||||
Linkit Smart 7688 {#linkit_7688}
|
||||
=================
|
||||
|
||||
The Linkit Smart 7688 is based on the MediaTek MT7688 system on a chip, which
|
||||
includes a MIPS 24KEc 580 MHz processor and 128 megabytes of RAM.
|
||||
|
||||
Features:
|
||||
* 20 GPIO pins
|
||||
* 4 PWM pins
|
||||
* 3 UART ports
|
||||
* 1 SPI master port
|
||||
* 1 SPI slave port (not supported by libmraa)
|
||||
* 1 I2C port
|
||||
* 1 I2S port (not supported by libmraa)
|
||||
|
||||

|
||||
|
||||
|
||||
Revision Support
|
||||
----------------
|
||||
* Linkit Smart 7688
|
||||
* Linkit Smart 7688 Duo
|
||||
|
||||
|
||||
Pin Mapping
|
||||
-----------
|
||||
|
||||
| MRAA Number | Physical Pin | Function |
|
||||
|-------------|--------------|------------------------|
|
||||
| --- | P0 | (Reset) |
|
||||
| 1 | P1 | GPIO43 (Eth LED) |
|
||||
| --- | P2 | (Eth RD+) |
|
||||
| --- | P3 | (Eth RD-) |
|
||||
| --- | P4 | (Eth TD+) |
|
||||
| --- | P5 | (Eth TD-) |
|
||||
| --- | P6 | (USB D+) |
|
||||
| --- | P7 | (USB D-) |
|
||||
| 8 | P8 | GPIO20, UART TX2, PWM2 |
|
||||
| 9 | P9 | GPIO21, UART RX2, PWM3 |
|
||||
| --- | GND | GND |
|
||||
| --- | 3V3 | 3V3 |
|
||||
| --- | VCC | VCC |
|
||||
| --- | 5V | 5V |
|
||||
| 10 | P10 | GPIO2, (I2S WS) |
|
||||
| 11 | P11 | GPIO3, (I2S CLK) |
|
||||
| 12 | P12 | GPIO0, (I2S SDI) |
|
||||
| 13 | P13 | GPIO1, (I2S SDO) |
|
||||
| 14 | P14 | GPIO37 (REF_CLK) |
|
||||
| 15 | P15 | GPIO44 (WiFi LED) |
|
||||
| 16 | P16 | GPIO46, UART RX1 |
|
||||
| 17 | P17 | GPIO45, UART TX1 |
|
||||
| 18 | P18 | GPIO13, UART RX0 |
|
||||
| 19 | P19 | GPIO12, UART TX0 |
|
||||
| 20 | P20 | GPIO5, I2C SDA |
|
||||
| 21 | P21 | GPIO4, I2C SCL |
|
||||
| 22 | P22 | SPI MOSI |
|
||||
| 23 | P23 | SPI MISO |
|
||||
| 24 | P24 | SPI SCK |
|
||||
| 25 | P25 | GPIO6, SPI CS |
|
||||
| 26 | P26 | GPIO18, PWM0 |
|
||||
| 27 | P27 | GPIO19, PWM1 |
|
||||
| 28 | P28 | GPIO17, (SPIS MOSI) |
|
||||
| 29 | P29 | GPIO16, (SPIS MISO) |
|
||||
| 30 | P30 | GPIO15, (SPIS SCK) |
|
||||
| 31 | P31 | GPIO14, (SPIS CS) |
|
@@ -1,34 +1,30 @@
|
||||
Intel(R) MinnowBoard Max / MinnowBoard Turbot {#minnowmax}
|
||||
=============================================
|
||||
Intel(R) Minnowboard Max {#minnowmax}
|
||||
========================
|
||||
MinnowBoard MAX is an open hardware embedded board designed with the Intel(R)
|
||||
Atom(TM) E38xx series SOC (formely Bay Trail). The MinnowBoard Turbot is a
|
||||
backward compatible revision with performance and hardware improvements.
|
||||
https://www.minnowboard.org/learn-more/minnowboard-max-compatible-with-upgrades
|
||||
Atom(TM) E38xx series SOC (Fromerly Bay Trail).
|
||||
|
||||
For product overview and faq see https://www.minnowboard.org/faq
|
||||
For product overview and faq see
|
||||
http://www.minnowboard.org/faq-minnowboard-max/
|
||||
|
||||
For technical details see https://www.minnowboard.org/board-viewer or the
|
||||
legacy board https://www.minnowboard.org/minnowboard-max
|
||||
For technical details see http://www.elinux.org/Minnowboard:MinnowMax
|
||||
|
||||
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.
|
||||
|
||||
@@ -59,17 +55,4 @@ bus #7.
|
||||
| 23 | 23 | GPIO_S5_1 | 83 | GPIO |
|
||||
| 24 | 24 | PWM1 | 249 | PWM Chip 1 Channel 0 |
|
||||
| 25 | 25 | S5_4 | 84 | GPIO |
|
||||
| 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 |
|
||||
| 26 | 26 | IBL_8254 | 208 | GPIO |
|
||||
|
17
docs/mock.md
17
docs/mock.md
@@ -19,15 +19,8 @@ Right now we simulate a single generic board with:
|
||||
which can be read or written in bytes or words (big-endian). Technically those
|
||||
registers are just an array of `uint8_t`, so you can treat them as 10 single-byte
|
||||
registers or 5 single-word ones or a mix thereof.
|
||||
* Single SPI bus with one Chip Select. All write functions are supported, received
|
||||
data items (words or bytes) are calculated from the sent ones using
|
||||
`sent_byte (or word) XOR constant` formula.
|
||||
See [SPI mock header](../include/mock/mock_board_spi.h#L38-L39) for constant values.
|
||||
* Single UART port. All functions are supported, but many are simple stubs. Write
|
||||
always succeeds, read returns 'Z' symbol as many times as `read()` requested.
|
||||
|
||||
We plan to develop it further and all contributions are more than welcome. See our
|
||||
@ref contributing page for more information.
|
||||
We plan to develop it further and all [contributions](../CONTRIBUTING.md) are more than welcome.
|
||||
|
||||
See the table below for pin layout and features
|
||||
|
||||
@@ -37,18 +30,12 @@ See the table below for pin layout and features
|
||||
| 1 | ADC0 | AIO pin, returns random value on read |
|
||||
| 2 | I2C0SDA | SDA pin for I2C0 bus |
|
||||
| 3 | I2C0SCL | SCL pin for I2C0 bus |
|
||||
| 4 | SPI0CS | CS pin for SPI0 bus |
|
||||
| 5 | SPI0MOSI | MOSI pin for SPI0 bus |
|
||||
| 6 | SPI0MISO | MISO pin for SPI0 bus |
|
||||
| 7 | SPI0SCLK | SCLK pin for SPI0 bus |
|
||||
| 8 | UART0RX | RX pin for UART0 port |
|
||||
| 9 | UART0TX | TX pin for UART0 port |
|
||||
|
||||
Building
|
||||
--------
|
||||
|
||||
Generally all the building steps are the same as listed
|
||||
in the main @ref building guide, you just need to set some specific
|
||||
in the [main building guide](./building.md), you just need to set some specific
|
||||
CMake options.
|
||||
|
||||
### Linux
|
||||
|
@@ -24,16 +24,12 @@ dir which matches the npm pkg name so we create one with a symlink and add the
|
||||
~~~~~~~~~~~~~{.sh}
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -DBUILDSWIGNODE=ON -DJSONPLAT=OFF ..
|
||||
cmake -DBUILDSWIGNODE=ON ..
|
||||
make npmpkg
|
||||
ln -s ../ mraa
|
||||
tar hczv --exclude='build*' --exclude='.gitignore' --exclude='.git' --exclude='build*/*' --exclude='.git/*' -f mraa.tar.gz mraa
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
You need to disable jsonplatform otherwise you will need to change the
|
||||
binding.gyp file to include those sources and make sure target platform has
|
||||
json-c headers & libs.
|
||||
|
||||
Building with node-gyp
|
||||
----------------------
|
||||
|
||||
|
@@ -1,67 +0,0 @@
|
||||
Onion Omega2 {#omega2}
|
||||
============
|
||||
|
||||
The Omega2 board is based on the MediaTek MT7688 system on a chip, which
|
||||
includes a MIPS 24KEc 580 MHz processor and 128 megabytes of RAM.
|
||||
|
||||
Features:
|
||||
* 15 GPIO pins
|
||||
* 2 PWM pins
|
||||
* 2 UART ports
|
||||
* 1 SPI master port
|
||||
* 1 I2C port
|
||||
* 1 I2S port (not supported by libmraa)
|
||||
|
||||

|
||||
|
||||
|
||||
Revision Support
|
||||
----------------
|
||||
* Omega2
|
||||
* Omega2+
|
||||
|
||||
|
||||
Pin Mapping
|
||||
-----------
|
||||
|
||||
Left side:
|
||||
|
||||
| MRAA Number | Function |
|
||||
|-------------|------------------------|
|
||||
| --- | GND |
|
||||
| 1 | GPIO11 |
|
||||
| 2 | GPIO3, (I2S CLK) |
|
||||
| 3 | GPIO2, (I2S WS) |
|
||||
| 4 | GPIO17 |
|
||||
| 5 | GPIO16 |
|
||||
| 6 | GPIO15 |
|
||||
| 7 | GPIO46, UART RX1 |
|
||||
| 8 | GPIO45, UART TX1 |
|
||||
| 9 | SPI MISO |
|
||||
| 10 | SPI MOSI |
|
||||
| 11 | SPI SCK |
|
||||
| 12 | GPIO6, SPI CS |
|
||||
| 13 | GPIO1, (I2S SDO) |
|
||||
| 14 | GPIO0, (I2S SDI) |
|
||||
| --- | (Reset) |
|
||||
|
||||
Right side:
|
||||
|
||||
| MRAA Number | Function |
|
||||
|-------------|------------------------|
|
||||
| --- | GND |
|
||||
| --- | VIN 3V3 |
|
||||
| --- | (USB D+) |
|
||||
| --- | (USB D-) |
|
||||
| 20 | GPIO13, UART RX0 |
|
||||
| 21 | GPIO12, UART TX0 |
|
||||
| 22 | FW RST |
|
||||
| --- | VOUT 3V3 |
|
||||
| --- | (Eth TX-) |
|
||||
| --- | (Eth TX+) |
|
||||
| --- | (Eth RX-) |
|
||||
| --- | (Eth RX+) |
|
||||
| 28 | GPIO18, PWM0 |
|
||||
| 29 | GPIO19, PWM1 |
|
||||
| 30 | GPIO4, I2C SCL |
|
||||
| 31 | GPIO5, I2C SDA |
|
@@ -1,237 +0,0 @@
|
||||
phyBOARD-Wega {#phyboard-wega}
|
||||
=============
|
||||
|
||||
The phyBOARD-Wega for phyCORE-AM335x is a low-cost, feature-rich software
|
||||
development platform supporting the Texas Instruments AM335x microcontroller.
|
||||
|
||||
Moreover, due to the numerous standard interfaces the phyBOARD-Wega AM335x can
|
||||
serve as bedrock for your application. At the core of the phyBOARD-Wega is the
|
||||
PCL-051/phyCORE-AM335x System on Module (SOM) in a direct solder form factor,
|
||||
containing the processor, DRAM, NAND Flash, power regulation, supervision,
|
||||
transceivers, and other core functions required to support the AM335x
|
||||
processor. Surrounding the SOM is the PBA-CD-02/phyBOARD-Wega carrier board,
|
||||
adding power input, buttons, connectors, signal breakout, and Ethernet
|
||||
connectivity amongst other things.
|
||||
|
||||
There are (for example) some expansion boards available for the phyBOARD-Wega:
|
||||
- Power Module (PEB-POW-01)
|
||||
- Evaluation Board (PEB-EVAL-01)
|
||||
- HDMI Adapter (PEB-AV-01)
|
||||
|
||||
For further information and instruction please visit:
|
||||
www.phytec.de/produkt/system-on-modules/single-board-computer/phyboard-wega
|
||||
|
||||
|
||||
Interface notes
|
||||
---------------
|
||||
|
||||
**SPI**
|
||||
Spi0 can be used over pins on X69 connector. There are no more spi-devices.
|
||||
Independent of the given index in mraa_phyboard_spi_init_pre() function,
|
||||
it will be always initialized spi0.
|
||||
|
||||
**I2C**
|
||||
/* TODO */
|
||||
|
||||
**UART**
|
||||
Uart0 can be used over pins on X69 connector or serial port on Evaluation Board.
|
||||
The other Uarts not have been tested yet. This is a small TODO for future.
|
||||
|
||||
|
||||
Pin Assignment of X69 Expansion Connector
|
||||
-----------------------------------------
|
||||
|
||||
| Physical Pin | Signal Name | Type | SL | Description |
|
||||
|--------------|---------------------|------|-------|-------------------------|
|
||||
| 1 | VCC3V3 | OUT | 3.3 V | 3.3V power supply |
|
||||
| 2 | VCC5V | OUT | 5.0 V | 5V power supply |
|
||||
| 3 | VDIG1_1P8V | OUT | 1.8 V | 1.8V power supply |
|
||||
| | | | | (max. 300mA) |
|
||||
| 4 | GND | - | - | Ground |
|
||||
| 5 | X_SPIO_CS0 | OUT | 3.3 V | SPI 0 chip select 0 |
|
||||
| 6 | X_SPIO_MOSI | OUT | 3.3 V | SPI 0 master output / |
|
||||
| | | | | slave input |
|
||||
| 7 | X_SPIO_MISO | IN | 3.3 V | SPI 0 master input / |
|
||||
| | | | | slave output |
|
||||
| 8 | X_SPIO_CLK | OUT | 3.3 V | SPI 0 clock output |
|
||||
| 9 | GND | - | - | Ground |
|
||||
| 10 | X_UART0_RXD | IN | 3.3 V | UART 0 receive data |
|
||||
| | | | | (std. debug iface) |
|
||||
| 11 | X_I2C0_SDA | I/O | 3.3 V | I2C0 Data |
|
||||
| 12 | X_UART0_TXD | OUT | 3.3 V | UART 0 transmit data |
|
||||
| | | | | (std. debug iface) |
|
||||
| 13 | X_I2C0_SCL | I/O | 3.3 V | I2C0 Clock |
|
||||
| 14 | GND | - | - | Ground |
|
||||
| 15 | X_JTAG_TMS | IN | 3.3 V | JTAG Chain Test |
|
||||
| | | | | Mode Select signal |
|
||||
| 16 | X_nJTAG_TRST | IN | 3.3 V | JTAG Chain Test Reset |
|
||||
| 17 | X_JTAG_TDI | IN | 3.3 V | JTAG Chain Test |
|
||||
| | | | | Data Input |
|
||||
| 18 | X_JTAG_TDO | OUT | 3.3 V | JTAG Chain Test |
|
||||
| | | | | Data Output |
|
||||
| 19 | GND | - | - | Ground |
|
||||
| 20 | X_JTAG_TCK | IN | 3.3 V | JTAG Chain Test |
|
||||
| | | | | Clock signal |
|
||||
| 21 | X_USB_DP_EXP | I/O | 3.3 V | USB data plus |
|
||||
| | | | | (for USB0 or USB1) |
|
||||
| 22 | X_USB_DM_EXP | I/O | 3.3 V | USB data minus |
|
||||
| | | | | (for USB0 or USB1) |
|
||||
| 23 | nRESET_OUT | OUT | 3.3 V | Reset |
|
||||
| 24 | GND | - | - | Ground |
|
||||
| 25 | X_MMC2_CMD | I/O | 3.3 V | MMC command |
|
||||
| 26 | X_MMC2_DATO | I/O | 3.3 V | MMC data 0 |
|
||||
| 27 | X_MMC2_CLK | I/O | 3.3 V | MMC clock |
|
||||
| 28 | X_MMC2_DAT1 | I/O | 3.3 V | MMC data 1 |
|
||||
| 29 | GND | - | - | Ground |
|
||||
| 30 | X_MMC2_DAT2 | I/O | 3.3 V | MMC data 2 |
|
||||
| 31 | X_UART2_RX_GPIO3_9 | I/O | 3.3 V | UART 2 receive data |
|
||||
| | | | | or GPIO3_9 |
|
||||
| 32 | X_MMC2_DAT3 | I/O | 3.3 V | MMC data 3 |
|
||||
| 33 | X_UART2_TX_GPIO3_10 | I/O | 3.3 V | UART 2 transmit data |
|
||||
| | | | | or GPIO3_10 |
|
||||
| 34 | GND | - | - | Ground |
|
||||
| 35 | X_UART3_RX_GPIO2_18 | I/O | 3.3 V | UART 3 receive data |
|
||||
| | | | | or GPIO2_18 |
|
||||
| 36 | X_UART3_TX_GPIO2_19 | I/O | 3.3 V | UART 3 transmit data |
|
||||
| | | | | or GPIO2_19 |
|
||||
| 37 | X_INTR1_GPIO0_20 | I/O | 3.3 V | Interrupt 1 or GPIO0_20 |
|
||||
| 38 | X_GPIO0_7 | I/O | 3.3 V | GPIO0_7 |
|
||||
| 39 | X_AM335_EXT_WAKEUP | IN | 3.3 V | External wakeup |
|
||||
| 40 | X_INT_RTCn | OUT | 3.3 V | Interrupt from the RTC |
|
||||
| 41 | GND | - | - | Ground |
|
||||
| 42 | X_GPIO3_7_nPMOD_PW | I/O | 3.3 V | GPIO3_7; Caution! Also |
|
||||
| | RFAIL | | | connected to power fail |
|
||||
| | | | | signal through R415. |
|
||||
| 43 | nRESET_IN | IN | 3.3 V | Push-button reset |
|
||||
| 44 | X_GPIO1_31 | I/O | 3.3 V | GPIO1_31 |
|
||||
| 45 | X_AM335_NMIn | IN | 3.3 V | AM335x |
|
||||
| | | | | non-maskable interrupt |
|
||||
| 46 | GND | - | - | Ground |
|
||||
| 47 | X_AIN4 | IN | 1.8 V | Analog input 4 |
|
||||
| 48 | X_AIN5 | IN | 1.8 V | Analog input 5 |
|
||||
| 49 | X_AIN6 | IN | 1.8 V | Analog input 6 |
|
||||
| 50 | X_AIN7 | IN | 1.8 V | Analog input 7 |
|
||||
| 51 | GND | - | - | Ground |
|
||||
| 52 | X_GPIO_CKSYNC | I/O | 3.3 V | GPIO Clock |
|
||||
| | | | | Synchronization |
|
||||
| 53 | X_USB_ID_EXP | IN | 1.8 V | USB port identification |
|
||||
| | | | | (for USB0 or USB1) |
|
||||
| 54 | USB_VBUS_EXP | OUT | 5.0 V | USB bus voltage |
|
||||
| | | | | (for USB0 or USB1) |
|
||||
| 55 | X_USB1_CE | OUT | 3.3 V | USB 1 charger enable |
|
||||
| 56 | GND | - | - | Ground |
|
||||
| 57 | VCC_BL | OUT | NS | Backlight power supply |
|
||||
| 58 | X_BP_POWER | IN | 5.0 V | Power On for Power |
|
||||
| | | | | Management IC for AM335x|
|
||||
| 59 | GND | - | - | Ground |
|
||||
| 60 | VCC5V_IN | IN | 5.0 V | 5 V input supply voltage|
|
||||
|
||||
|
||||
Pin Assignment of X70 A/V Connector
|
||||
-----------------------------------
|
||||
|
||||
| Physical Pin | Signal Name | Type | SL | Description |
|
||||
|--------------|---------------------|------|-------|-------------------------|
|
||||
| 1 | GND | - | - | Ground |
|
||||
| 2 | X_LCD_D21 | OUT | 3.3 V | LCD D21 |
|
||||
| 3 | X_LCD_D18 | OUT | 3.3 V | LCD D18 |
|
||||
| 4 | X_LCD_D16 | OUT | 3.3 V | LCD D16 |
|
||||
| 5 | X_LCD_D0 | OUT | 3.3 V | LCD D0 |
|
||||
| 6 | GND | - | - | Ground |
|
||||
| 7 | X_LCD_D1 | OUT | 3.3 V | LCD D1 |
|
||||
| 8 | X_LCD_D2 | OUT | 3.3 V | LCD D2 |
|
||||
| 9 | X_LCD_D3 | OUT | 3.3 V | LCD D3 |
|
||||
| 10 | X_LCD_D4 | OUT | 3.3 V | LCD D4 |
|
||||
| 11 | GND | - | - | Ground |
|
||||
| 12 | X_LCD_D22 | OUT | 3.3 V | LCD D22 |
|
||||
| 13 | X_LCD_D19 | OUT | 3.3 V | LCD D19 |
|
||||
| 14 | X_LCD_D5 | OUT | 3.3 V | LCD D5 |
|
||||
| 15 | X_LCD_D6 | OUT | 3.3 V | LCD D6 |
|
||||
| 16 | GND | - | - | Ground |
|
||||
| 17 | X_LCD_D7 | OUT | 3.3 V | LCD D7 |
|
||||
| 18 | X_LCD_D8 | OUT | 3.3 V | LCD D8 |
|
||||
| 19 | X_LCD_D9 | OUT | 3.3 V | LCD D9 |
|
||||
| 20 | X_LCD_D10 | OUT | 3.3 V | LCD D10 |
|
||||
| 21 | GND | - | - | Ground |
|
||||
| 22 | X_LCD_D23 | OUT | 3.3 V | LCD D23 |
|
||||
| 23 | X_LCD_D20 | OUT | 3.3 V | LCD D20 |
|
||||
| 24 | X_LCD_D17 | OUT | 3.3 V | LCD D17 |
|
||||
| 25 | X_LCD_D11 | OUT | 3.3 V | LCD D11 |
|
||||
| 26 | GND | - | - | Ground |
|
||||
| 27 | X_LCD_D12 | OUT | 3.3 V | LCD D12 |
|
||||
| 28 | X_LCD_D13 | OUT | 3.3 V | LCD D13 |
|
||||
| 29 | X_LCD_D14 | OUT | 3.3 V | LCD D14 |
|
||||
| 30 | X_LCD_D15 | OUT | 3.3 V | LCD D15 |
|
||||
| 31 | GND | - | - | Ground |
|
||||
| 32 | X_LCD_PCLK | OUT | 3.3 V | LCD Pixel Clock |
|
||||
| 33 | X_LCD_BIAS_EN | OUT | 3.3 V | LCD BIAS |
|
||||
| 34 | X_LCD_HSYNC | OUT | 3.3 V | LCD Horizontal |
|
||||
| | | | | Synchronization |
|
||||
| 35 | X_LCD_VSYNC | OUT | 3.3 V | LCD Vertical |
|
||||
| | | | | Synchronisation |
|
||||
| 36 | GND | - | - | Ground |
|
||||
| 37 | GND | - | - | Ground |
|
||||
| 38 | X_PWM1_OUT | OUT | 3.3 V | Pulse Width Modulation |
|
||||
| 39 | VCC_BL | OUT | NS | Backlight power supply |
|
||||
| 40 | VCC5V | OUT | 5.0 V | 5 V power supply |
|
||||
|
||||
|
||||
Pin Assignment of X71 A/V Connector
|
||||
-----------------------------------
|
||||
|
||||
| Physical Pin | Signal Name | Type | SL | Description |
|
||||
|--------------|---------------------|------|-------|-------------------------|
|
||||
| 1 | X_I2S_CLK | I/O | 3.3 V | I2S Clock |
|
||||
| 2 | X_I2S_FRM | I/O | 3.3 V | I2S Frame |
|
||||
| 3 | X_I2S_ADC | I/O | 3.3 V | I2S Analog-Digital |
|
||||
| | | | | converter (microphone) |
|
||||
| 4 | X_I2S_DAC | I/O | 3.3 V | I2S Digital-Analog |
|
||||
| | | | | converter (speaker) |
|
||||
| 5 | X_AV_INT_GPIO1_30 | I/O | 3.3 V | A/V interrupt; GPIO1_30 |
|
||||
| 6 | nUSB1_OC_GPIO3_19 or| I/O | 3.3 V | GPIO3_19 or McASP0 |
|
||||
| | X_MCASP0_AHCLKX_GPIO3_21| | | high frequency clock |
|
||||
| 7 | GND | - | - | Ground |
|
||||
| 8 | nRESET_OUT | OUT | 3.3 V | Reset |
|
||||
| 9 | TS_X+ | IN | 1.8 V | Touch X+ |
|
||||
| 10 | TS_X- | IN | 1.8 V | Touch X- |
|
||||
| 11 | TS_Y+ | IN | 1.8 V | Touch Y+ |
|
||||
| 12 | TS_Y- | IN | 1.8 V | Touch Y- |
|
||||
| 13 | VCC3V3 | OUT | 3.3 V | 3.3 V power supply |
|
||||
| 14 | GND | - | - | Ground |
|
||||
| 15 | X_I2C0_SCL | I/O | 3.3 V | I2C Clock |
|
||||
| 16 | X_I2C0_SDA | I/O | 3.3 V | I2C Data |
|
||||
|
||||
Jumper J77 connects either signal X_MCASP0_AHCLKX_GPIO3_21 or signal
|
||||
nUSB1_OC_GPIO3_19 to pin 6 of X71.
|
||||
The following table shows the available configurations:
|
||||
|
||||
A/V Jumper configuration J77
|
||||
----------------------------
|
||||
|
||||
| J77 | Description |
|
||||
|-----|--------------------------|
|
||||
| 1+2 | X_MCASP0_AHCLKX_GPIO3_21 |
|
||||
| 2+3 | nUSB1_OC_GPIO3_19 |
|
||||
|
||||
Caution: If J77 is set to 2+3 , J78 also has to be set to 2+3 !
|
||||
|
||||
|
||||
GPIO - Pin-mapping (with installed expansion board)
|
||||
---------------------------------------------------
|
||||
|
||||
| Physical Pin | Pin-Name | Pin-Map / Sysfs GPIO | Def. usage | Connector|
|
||||
|--------------|---------------|----------------------|------------|----------|
|
||||
| 31 | X_GPIO3_9 | 105 | OUT LED3 | X69 |
|
||||
| 33 | X_GPIO3_10 | 106 | IN S3 | X69 |
|
||||
| 35 | X_GPIO2_18 | 82 (busy) | OUT LED1 | X69 |
|
||||
| 36 | X_GPIO2_19 | 83 | OUT LED2 | X69 |
|
||||
| 37 | X_GPIO0_20 | 20 (busy) | IN S1 | X69 |
|
||||
| 38 | X_GPIO0_7 | 7 | IN S2 | X69 |
|
||||
| 42 | X_GPIO3_7 | 103 | IN | X69 |
|
||||
| 44 | X_GPIO1_31 | 63 | IN | X69 |
|
||||
|--------------|---------------|----------------------|------------|----------|
|
||||
| 5 (105) | X_GPIO1_30 | 62 | IN | X71 |
|
||||
| 6 (106) | X_GPIO3_19 or | 115 | IN | X71 |
|
||||
| | X_GPIO3_21 | 117 | IN | X71 |
|
||||
|
||||
Info: (busy) means, that it is used by kernel driver!
|
@@ -1,62 +0,0 @@
|
||||
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)
|
@@ -1,93 +0,0 @@
|
||||
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
|
||||
```
|
107
docs/up.md
107
docs/up.md
@@ -1,11 +1,11 @@
|
||||
UP Board {#up}
|
||||
============
|
||||
|
||||
UP Board is based on the Intel(R) Atom(TM) x5-Z8350 SoC (formerly Cherry Trail).
|
||||
It includes 1/2/4GB RAM, 16/32/64GB eMMC flash, 6 USB2.0 ports, 1 USB 3.0 OTG
|
||||
port, 1 Gigabit Ethernet, HDMI and DSI/eDP Graphics ports, RTC and a 40-pin I/O
|
||||
header. The form-factor for the board is based on the Raspberry Pi 2, and can be
|
||||
used with many of the add-on HAT boards designed for the Raspberry Pi.
|
||||
UP Board is based on the Intel(R) Atom(TM) x5-Z83xx SoC (formerly Cherry Trail).
|
||||
It includes 2GB RAM, 16/32GB eMMC flash, 6 USB2.0 ports, 1 USB 3.0 OTG port,
|
||||
1 Gigabit Ethernet, HDMI and DSI Graphics ports, RTC and a 40-pin I/O header.
|
||||
The form-factor for the board is based on the Raspberry Pi 2, and can be used
|
||||
with many of the add-on HAT boards designed for the Raspberry Pi 2.
|
||||
|
||||
Interface notes
|
||||
---------------
|
||||
@@ -25,15 +25,12 @@ granular at higher speeds. E.g. Available speeds include:
|
||||
25MHz, 12.5MHz, 8.33MHz, 6.25MHz, 5MHz, 4.167MHz, 3.571MHz, 3.125MHz, etc.
|
||||
Please be aware that speeds in between those steps will be rounded UP to the
|
||||
next nearest available speed, and capped at 25MHz.
|
||||
2 chip-selects are available, one natively (SPI CS0) and one by GPIO (SPI CS1).
|
||||
At the time of writing, only a single native chip-select is available (SPI CS0).
|
||||
|
||||
**UART** 1 high-speed UART is available, supporting baud rates between 300 and
|
||||
3686400. Hardware flow-control signals are available on pins 11/36 (RTS/CTS).
|
||||
|
||||
**ADC** 1 8-bit single-channel ADC (TI ADC081C021) is available on pin 7.
|
||||
|
||||
Please note that a kernel with UP board support is required to enable the I/O
|
||||
interfaces above. Refer to https://up-community.org for more information.
|
||||
**UART** 2 high-speed UARTs are available, supporting baud rates up to
|
||||
support baud rates between 300 and 3686400. Hardware flow-control signals are
|
||||
not exposed, so software flow-control may be needed for rates above 115200.
|
||||
A console UART is also available but is not fully supported at this time.
|
||||
|
||||
Pin Mapping
|
||||
-----------
|
||||
@@ -43,45 +40,45 @@ model 2 and B+ numbering scheme.
|
||||
|
||||
Note that there is an enum to use wiringPi style numbers.
|
||||
|
||||
| MRAA Number | Physical Pin | Function | Sysfs GPIO | mraa device |
|
||||
|-------------|--------------|-------------|------------|----------------------|
|
||||
| 1 | P1-01 | 3V3 VCC | | |
|
||||
| 2 | P1-02 | 5V VCC | | |
|
||||
| 3 | P1-03 | I2C SDA | 2 | I2C0 |
|
||||
| 4 | P1-04 | 5V VCC | | |
|
||||
| 5 | P1-05 | I2C SCL | 3 | I2C0 |
|
||||
| 6 | P1-06 | GND | | |
|
||||
| 7 | P1-07 | GPIO(4) | 4 | ADC0 (iio:device0) |
|
||||
| 8 | P1-08 | UART TX | 14 | UART0 |
|
||||
| 9 | P1-09 | GND | | |
|
||||
| 10 | P1-10 | UART RX | 15 | UART0 |
|
||||
| 11 | P1-11 | UART_RTS | 17 | UART0 |
|
||||
| 12 | P1-12 | I2S CLK | 18 | |
|
||||
| 13 | P1-13 | GPIO(27) | 27 | |
|
||||
| 14 | P1-14 | GND | | |
|
||||
| 15 | P1-15 | GPIO(22) | 22 | |
|
||||
| 16 | P1-16 | GPIO(23) | 23 | |
|
||||
| 17 | P1-17 | 3V3 VCC | | |
|
||||
| 18 | P1-18 | GPIO(24) | 24 | |
|
||||
| 19 | P1-19 | SPI MOSI | 10 | SPI0,1 |
|
||||
| 20 | P1-20 | GND | | |
|
||||
| 21 | P1-21 | SPI MISO | 9 | SPI0,1 |
|
||||
| 22 | P1-22 | GPIO(25) | 25 | |
|
||||
| 23 | P1-23 | SPI SCL | 11 | SPI0,1 |
|
||||
| 24 | P1-24 | SPI CS0 | 8 | SPI0 |
|
||||
| 25 | P1-25 | GND | | |
|
||||
| 26 | P1-26 | SPI CS1 | 7 | SPI1 |
|
||||
| 27 | P1-27 | I2C SDA0 | 0 | I2C1 |
|
||||
| 28 | P1-28 | I2C SCL0 | 1 | I2C1 |
|
||||
| 29 | P1-29 | GPIO(5) | 5 | |
|
||||
| 30 | P1-30 | GND | | |
|
||||
| 31 | P1-31 | GPIO(6) | 6 | |
|
||||
| 32 | P1-32 | PWM0 | 12 | PWM0 |
|
||||
| 33 | P1-33 | PWM1 | 13 | PWM1 |
|
||||
| 34 | P1-34 | GND | | |
|
||||
| 35 | P1-35 | I2S FRM | 19 | |
|
||||
| 36 | P1-36 | UART_CTS | 16 | UART0 |
|
||||
| 37 | P1-37 | GPIO(26) | 26 | |
|
||||
| 38 | P1-38 | I2S DIN | 20 | |
|
||||
| 39 | P1-39 | GND | | |
|
||||
| 40 | P1-40 | I2S DOUT | 21 | |
|
||||
| MRAA Number | Physical Pin | Function | Sysfs GPIO | Notes |
|
||||
|-------------|--------------|----------|------------|----------------------|
|
||||
| 1 | P1-01 | 3V3 VCC | | |
|
||||
| 2 | P1-02 | 5V VCC | | |
|
||||
| 3 | P1-03 | I2C SDA1 | 2 | I2C1 (/dev/i2c-1) |
|
||||
| 4 | P1-04 | 5V VCC | | |
|
||||
| 5 | P1-05 | I2C SCL1 | 3 | I2C1 (/dev/i2c-1) |
|
||||
| 6 | P1-06 | GND | | |
|
||||
| 7 | P1-07 | GPIO(4) | 4 | |
|
||||
| 8 | P1-08 | UART TX1 | 14 | UART1 (/dev/ttyS1) |
|
||||
| 9 | P1-09 | GND | | |
|
||||
| 10 | P1-10 | UART RX1 | 15 | UART1 (/dev/ttyS1) |
|
||||
| 11 | P1-11 | GPIO(17) | 17 | |
|
||||
| 12 | P1-12 | I2S CLK | 18 | I2S0 (PCM Audio) |
|
||||
| 13 | P1-13 | UART RX2 | 27 | UART2 (/dev/ttyS2) |
|
||||
| 14 | P1-14 | GND | | |
|
||||
| 15 | P1-15 | GPIO(22) | 22 | |
|
||||
| 16 | P1-16 | GPIO(23) | 23 | |
|
||||
| 17 | P1-17 | 3V3 VCC | | |
|
||||
| 18 | P1-18 | GPIO(24) | 24 | |
|
||||
| 19 | P1-19 | SPI MOSI | 10 | SPI2 (/dev/spidev2.x)|
|
||||
| 20 | P1-20 | GND | | |
|
||||
| 21 | P1-21 | SPI MISO | 9 | SPI2 (/dev/spidev2.x)|
|
||||
| 22 | P1-22 | UART TX2 | 25 | UART2 (/dev/ttyS2) |
|
||||
| 23 | P1-23 | SPI SCL | 11 | SPI2 (/dev/spidev2.x)|
|
||||
| 24 | P1-24 | SPI CS0 | 8 | SPI2 (/dev/spidev2.0)|
|
||||
| 25 | P1-25 | GND | | |
|
||||
| 26 | P1-26 | SPI CS1 | 7 | SPI2 (/dev/spidev2.1)|
|
||||
| 27 | P1-27 | I2C SDA0 | 0 | I2C0 (/dev/i2c-0) |
|
||||
| 28 | P1-28 | I2C SCL0 | 1 | I2C0 (/dev/i2c-0) |
|
||||
| 29 | P1-29 | GPIO(5) | 5 | |
|
||||
| 30 | P1-30 | GND | | |
|
||||
| 31 | P1-31 | GPIO(6) | 6 | |
|
||||
| 32 | P1-32 | PWM0 | 12 | PWM Chip 0 Channel 0 |
|
||||
| 33 | P1-33 | PWM1 | 13 | PWM Chip 1 Channel 0 |
|
||||
| 34 | P1-34 | GND | | |
|
||||
| 35 | P1-35 | I2S FRM | 19 | I2S0 (PCM Audio) |
|
||||
| 36 | P1-36 | GPIO(16) | 16 | |
|
||||
| 37 | P1-37 | GPIO(26) | 26 | |
|
||||
| 38 | P1-38 | I2S DIN | 20 | I2S0 (PCM Audio) |
|
||||
| 39 | P1-39 | GND | | |
|
||||
| 40 | P1-40 | I2S DOUT | 21 | I2S0 (PCM Audio) |
|
||||
|
88
docs/up2.md
88
docs/up2.md
@@ -1,88 +0,0 @@
|
||||
UP Squared Board {#up2}
|
||||
================================
|
||||
UP Squared is based on the Intel® Celeron™ N3350 or the Intel® Pentium™ N4200, formerly ApolloLake™.
|
||||
|
||||
For the full specification please refer to the main specification page here:
|
||||
|
||||
http://www.up-board.org/upsquared/specifications-up2
|
||||
|
||||
Interface notes
|
||||
-----------------------
|
||||
The Up Squared present one Raspberry Pi compatible HAT connector and a 60 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
|
||||
- 3 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)
|
||||
|
||||
**PWM**
|
||||
- Up to 3 channel of PWM
|
||||
|
||||
**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/up2.c for details.
|
||||
|
||||
| MRAA no. | Function | Rpi GPIO | Sysfs GPIO | mraa device |
|
||||
|----------|--------------|------------|------------|-----------------|
|
||||
| 1 | 3V3 VCC | | | |
|
||||
| 2 | 5V VCC | | | |
|
||||
| 3 | I2C_SDA | 2 | 462 | I2C0 |
|
||||
| 4 | 5V VCC | | | |
|
||||
| 5 | I2C_SCL | 3 | 463 | I2C0 |
|
||||
| 6 | GND | | | |
|
||||
| 7 | GPIO(4) | 4 | 433 | |
|
||||
| 8 | UART_TX | 14 | 477 | UART0 |
|
||||
| 9 | GND | | | |
|
||||
| 10 | UART_RX | 15 | 476 | UART0 |
|
||||
| 11 | UART_RTS | 17 | 478 | UART0 |
|
||||
| 12 | I2S_CLK | 18 | 326 | |
|
||||
| 13 | GPIO(27) | 27 | 432 | |
|
||||
| 14 | GND | | | |
|
||||
| 15 | GPIO(22) | 22 | 431 | |
|
||||
| 16 | PWM3 | 23 | 471 | PWM3 |
|
||||
| 17 | 3V3 VCC | | | |
|
||||
| 18 | GPIO(24) | 24 | 405 | |
|
||||
| 19 | SPI0_MOSI | 10 | 422 | SPI0 |
|
||||
| 20 | GND | | | |
|
||||
| 21 | SPI0_MISO | 9 | 421 | SPI0 |
|
||||
| 22 | GPIO(25) | 25 | 402 | |
|
||||
| 23 | SPI0_SCL | 11 | 418 | SPI0 |
|
||||
| 24 | SPI0_CS0 | 8 | 419 | SPI0 |
|
||||
| 25 | GND | | | |
|
||||
| 26 | SPI0_CS1 | 7 | 420 | SPI0 |
|
||||
| 27 | ID_SD | 0 | 464 | I2C1 |
|
||||
| 28 | ID_SC | 1 | 465 | I2C1 |
|
||||
| 29 | GPIO(5) | 5 | 430 | |
|
||||
| 30 | GND | | | |
|
||||
| 31 | GPIO(6) | 6 | 404 | |
|
||||
| 32 | PWM0 | 12 | 468 | PWM0 |
|
||||
| 33 | PWM1 | 13 | 469 | PWM1 |
|
||||
| 34 | GND | | | |
|
||||
| 35 | I2S_FRM | 19 | 327 | |
|
||||
| 36 | UART_CTS | 16 | 479 | UART0 |
|
||||
| 37 | GPIO(26) | 26 | 403 | |
|
||||
| 38 | I2S_DIN | 20 | 328 | |
|
||||
| 39 | GND | | | |
|
||||
| 40 | I2S_DOUT | 21 | 329 | |
|
@@ -1,85 +0,0 @@
|
||||
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 | |
|
Submodule doxygen2jsdoc updated: 67cad69272...9cc90b7976
1
doxyport
1
doxyport
Submodule doxyport deleted from db3e1a6eb8
@@ -1,14 +1,61 @@
|
||||
add_subdirectory (c)
|
||||
add_subdirectory (platform)
|
||||
add_executable (i2c_HMC5883L i2c_HMC5883L.c)
|
||||
add_executable (hellomraa hellomraa.c)
|
||||
add_executable (cycle-pwm3 cycle-pwm3.c)
|
||||
add_executable (blink-io blink-io.c)
|
||||
add_executable (analogin_a0 analogin_a0.c)
|
||||
add_executable (isr_pin6 isr_pin6.c)
|
||||
add_executable (gpio_read6 gpio_read6.c)
|
||||
add_executable (spi_mcp4261 spi_mcp4261.c)
|
||||
add_executable (mmap-io2 mmap-io2.c)
|
||||
add_executable (blink_onboard blink_onboard.c)
|
||||
add_executable (uart uart.c)
|
||||
add_executable (mraa-gpio mraa-gpio.c)
|
||||
add_executable (mraa-i2c mraa-i2c.c)
|
||||
add_executable (spi_max7219 spi_max7219.c)
|
||||
add_executable (iio_driver iio_driver.c)
|
||||
|
||||
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!")
|
||||
include_directories(${PROJECT_SOURCE_DIR}/api)
|
||||
# FIXME Hack to access mraa internal types used by mraa-i2c
|
||||
include_directories(${PROJECT_SOURCE_DIR}/include)
|
||||
include_directories(${PROJECT_SOURCE_DIR}/api/mraa)
|
||||
|
||||
target_link_libraries (hellomraa mraa)
|
||||
target_link_libraries (i2c_HMC5883L mraa m)
|
||||
target_link_libraries (cycle-pwm3 mraa)
|
||||
target_link_libraries (blink-io mraa)
|
||||
target_link_libraries (analogin_a0 mraa)
|
||||
target_link_libraries (isr_pin6 mraa)
|
||||
target_link_libraries (gpio_read6 mraa)
|
||||
target_link_libraries (spi_mcp4261 mraa)
|
||||
target_link_libraries (mmap-io2 mraa)
|
||||
target_link_libraries (blink_onboard mraa)
|
||||
target_link_libraries (uart mraa)
|
||||
target_link_libraries (mraa-gpio mraa)
|
||||
target_link_libraries (mraa-i2c mraa)
|
||||
target_link_libraries (spi_max7219 mraa)
|
||||
target_link_libraries (iio_driver mraa)
|
||||
|
||||
if (ONEWIRE)
|
||||
add_executable (uart_ow uart_ow.c)
|
||||
target_link_libraries (uart_ow mraa)
|
||||
endif ()
|
||||
|
||||
if (NOT ANDROID_TOOLCHAIN)
|
||||
add_subdirectory (c++)
|
||||
if (FIRMATA)
|
||||
add_executable (firmata_curie_imu firmata_curie_imu.c)
|
||||
add_executable (i2c_firmata i2c_firmata.c)
|
||||
target_link_libraries (firmata_curie_imu mraa)
|
||||
target_link_libraries (i2c_firmata mraa)
|
||||
endif ()
|
||||
|
||||
add_subdirectory (c++)
|
||||
|
||||
install (DIRECTORY ${PROJECT_SOURCE_DIR}/examples/ DESTINATION ${CMAKE_INSTALL_DATADIR}/mraa/examples)
|
||||
|
||||
if (INSTALLGPIOTOOL AND NOT INSTALLTOOLS)
|
||||
install (TARGETS mraa-gpio DESTINATION bin)
|
||||
endif()
|
||||
|
||||
if (INSTALLTOOLS)
|
||||
install (TARGETS mraa-gpio DESTINATION bin)
|
||||
install (TARGETS mraa-i2c DESTINATION bin)
|
||||
endif()
|
||||
|
52
examples/analogin_a0.c
Normal file
52
examples/analogin_a0.c
Normal file
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Author: Nandkishor Sonar
|
||||
* Copyright (c) 2014 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
//! [Interesting]
|
||||
#include "mraa/aio.h"
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
mraa_aio_context adc_a0;
|
||||
uint16_t adc_value = 0;
|
||||
float adc_value_float = 0.0;
|
||||
|
||||
adc_a0 = mraa_aio_init(0);
|
||||
if (adc_a0 == NULL) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
adc_value = mraa_aio_read(adc_a0);
|
||||
adc_value_float = mraa_aio_read_float(adc_a0);
|
||||
fprintf(stdout, "ADC A0 read %X - %d\n", adc_value, adc_value);
|
||||
fprintf(stdout, "ADC A0 read float - %.5f\n", adc_value_float);
|
||||
}
|
||||
|
||||
mraa_aio_close(adc_a0);
|
||||
|
||||
return MRAA_SUCCESS;
|
||||
}
|
||||
//! [Interesting]
|
104
examples/blink-io.c
Normal file
104
examples/blink-io.c
Normal file
@@ -0,0 +1,104 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "mraa.h"
|
||||
|
||||
#define DEFAULT_IOPIN 8
|
||||
|
||||
int running = 0;
|
||||
static int iopin;
|
||||
|
||||
void
|
||||
sig_handler(int signo)
|
||||
{
|
||||
if (signo == SIGINT) {
|
||||
printf("closing IO%d nicely\n", iopin);
|
||||
running = -1;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
mraa_result_t r = MRAA_SUCCESS;
|
||||
iopin = DEFAULT_IOPIN;
|
||||
|
||||
if (argc < 2) {
|
||||
printf("Provide an int arg if you want to flash on something other than %d\n", DEFAULT_IOPIN);
|
||||
} else {
|
||||
iopin = strtol(argv[1], NULL, 10);
|
||||
}
|
||||
|
||||
mraa_init();
|
||||
fprintf(stdout, "MRAA Version: %s\nStarting Blinking on IO%d\n", mraa_get_version(), iopin);
|
||||
|
||||
mraa_gpio_context gpio;
|
||||
gpio = mraa_gpio_init(iopin);
|
||||
if (gpio == NULL) {
|
||||
fprintf(stderr, "Are you sure that pin%d you requested is valid on your platform?", iopin);
|
||||
exit(1);
|
||||
}
|
||||
printf("Initialised pin%d\n", iopin);
|
||||
|
||||
// set direction to OUT
|
||||
r = mraa_gpio_dir(gpio, MRAA_GPIO_OUT);
|
||||
if (r != MRAA_SUCCESS) {
|
||||
mraa_result_print(r);
|
||||
}
|
||||
|
||||
signal(SIGINT, sig_handler);
|
||||
|
||||
while (running == 0) {
|
||||
r = mraa_gpio_write(gpio, 0);
|
||||
if (r != MRAA_SUCCESS) {
|
||||
mraa_result_print(r);
|
||||
} else {
|
||||
printf("off\n");
|
||||
}
|
||||
|
||||
sleep(1);
|
||||
|
||||
r = mraa_gpio_write(gpio, 1);
|
||||
if (r != MRAA_SUCCESS) {
|
||||
mraa_result_print(r);
|
||||
} else {
|
||||
printf("on\n");
|
||||
}
|
||||
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
r = mraa_gpio_close(gpio);
|
||||
if (r != MRAA_SUCCESS) {
|
||||
mraa_result_print(r);
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
83
examples/blink_onboard.c
Normal file
83
examples/blink_onboard.c
Normal file
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "mraa/gpio.h"
|
||||
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
mraa_platform_t platform = mraa_get_platform_type();
|
||||
mraa_gpio_context gpio, gpio_in = NULL;
|
||||
const char* board_name = mraa_get_platform_name();
|
||||
int ledstate = 0;
|
||||
|
||||
switch (platform) {
|
||||
case MRAA_INTEL_GALILEO_GEN1:
|
||||
gpio = mraa_gpio_init_raw(3);
|
||||
break;
|
||||
case MRAA_INTEL_MINNOWBOARD_MAX:
|
||||
// there is no onboard LED that we can flash on the minnowboard max
|
||||
// but on the calamari lure pin 21 is an LED. If you don't have the
|
||||
// lure put an LED on pin 21
|
||||
gpio = mraa_gpio_init(21);
|
||||
break;
|
||||
default:
|
||||
gpio = mraa_gpio_init(13);
|
||||
}
|
||||
|
||||
fprintf(stdout, "Welcome to libmraa\n Version: %s\n Running on %s\n", mraa_get_version(), board_name);
|
||||
|
||||
|
||||
if (gpio == NULL) {
|
||||
fprintf(stdout, "Could not initilaize gpio\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
// on platforms with physical button use gpio_in
|
||||
if (platform == MRAA_INTEL_MINNOWBOARD_MAX) {
|
||||
gpio_in = mraa_gpio_init(14);
|
||||
if (gpio_in != NULL) {
|
||||
mraa_gpio_dir(gpio_in, MRAA_GPIO_IN);
|
||||
// S1 on minnowboardmax's calamari lure maps to pin 14, SW1 != S1
|
||||
fprintf(stdout, "Press and hold S1 to stop, Press SW1 to shutdown!\n");
|
||||
}
|
||||
}
|
||||
|
||||
mraa_gpio_dir(gpio, MRAA_GPIO_OUT);
|
||||
|
||||
for (;;) {
|
||||
if (gpio_in != NULL && mraa_gpio_read(gpio_in) == 0) {
|
||||
return 0;
|
||||
}
|
||||
ledstate = !ledstate;
|
||||
mraa_gpio_write(gpio, !ledstate);
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
49
examples/c++/AioA0.cpp
Normal file
49
examples/c++/AioA0.cpp
Normal file
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
//! [Interesting]
|
||||
#include "mraa.hpp"
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
uint16_t adc_value;
|
||||
float adc_value_float;
|
||||
mraa::Aio* a0;
|
||||
|
||||
a0 = new mraa::Aio(0);
|
||||
if (a0 == NULL) {
|
||||
return MRAA_ERROR_UNSPECIFIED;
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
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\n", adc_value_float);
|
||||
}
|
||||
|
||||
return MRAA_SUCCESS;
|
||||
}
|
||||
//! [Interesting]
|
77
examples/c++/Blink-IO.cpp
Normal file
77
examples/c++/Blink-IO.cpp
Normal file
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* 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 = new mraa::Gpio(iopin);
|
||||
if (gpio == NULL) {
|
||||
return mraa::ERROR_UNSPECIFIED;
|
||||
}
|
||||
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);
|
||||
}
|
||||
delete gpio;
|
||||
return response;
|
||||
//! [Interesting]
|
||||
}
|
@@ -1,29 +1,26 @@
|
||||
enable_language(CXX)
|
||||
|
||||
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)
|
||||
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)
|
||||
|
||||
include_directories(${PROJECT_SOURCE_DIR}/api)
|
||||
include_directories(${PROJECT_SOURCE_DIR}/api/mraa)
|
||||
|
||||
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++)
|
||||
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++)
|
||||
|
||||
if (ONEWIRE)
|
||||
add_executable (uart_ow_cpp uart_ow.cpp)
|
||||
target_link_libraries (uart_ow_cpp mraa stdc++)
|
||||
add_executable (UartOW UartOW.cpp)
|
||||
target_link_libraries (UartOW mraa stdc++)
|
||||
endif ()
|
||||
|
@@ -3,23 +3,31 @@
|
||||
* Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
|
||||
* Copyright (c) 2014 Intel Corporation.
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
* 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:
|
||||
*
|
||||
* Example usage: Outputs X,Y,Z co-ordinates and direction recursively using
|
||||
* HMC5883L. Press Ctrl+C to exit.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/* standard headers */
|
||||
#include <iostream>
|
||||
#include <math.h>
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
|
||||
/* mraa headers */
|
||||
#include "mraa/common.hpp"
|
||||
#include "mraa/i2c.hpp"
|
||||
#include "mraa.hpp"
|
||||
#include "math.h"
|
||||
|
||||
#define MAX_BUFFER_LENGTH 6
|
||||
#define HMC5883L_I2C_ADDR 0x1E
|
||||
@@ -71,46 +79,48 @@
|
||||
#define SCALE_3_03_MG 3.03
|
||||
#define SCALE_4_35_MG 4.35
|
||||
|
||||
#define I2C_BUS 0
|
||||
|
||||
volatile sig_atomic_t flag = 1;
|
||||
int running = 0;
|
||||
|
||||
void
|
||||
sig_handler(int signum)
|
||||
sig_handler(int signo)
|
||||
{
|
||||
if (signum == SIGINT) {
|
||||
std::cout << "Exiting..." << std::endl;
|
||||
flag = 0;
|
||||
if (signo == SIGINT) {
|
||||
printf("closing nicely\n");
|
||||
running = -1;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main(void)
|
||||
main()
|
||||
{
|
||||
float direction;
|
||||
int16_t x, y, z;
|
||||
float direction = 0;
|
||||
int16_t x = 0, y = 0, z = 0;
|
||||
uint8_t rx_tx_buf[MAX_BUFFER_LENGTH];
|
||||
|
||||
//! [Interesting]
|
||||
mraa::I2c* i2c;
|
||||
i2c = new mraa::I2c(0);
|
||||
|
||||
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);
|
||||
|
||||
//! [Interesting]
|
||||
mraa::I2c i2c(I2C_BUS);
|
||||
while (running == 0) {
|
||||
i2c->address(HMC5883L_I2C_ADDR);
|
||||
i2c->writeByte(HMC5883L_DATA_REG);
|
||||
|
||||
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);
|
||||
|
||||
i2c.address(HMC5883L_I2C_ADDR);
|
||||
rx_tx_buf[0] = HMC5883L_MODE_REG;
|
||||
rx_tx_buf[1] = HMC5883L_CONT_MODE;
|
||||
|
||||
while (flag) {
|
||||
i2c.address(HMC5883L_I2C_ADDR);
|
||||
i2c.writeByte(HMC5883L_DATA_REG);
|
||||
|
||||
i2c.address(HMC5883L_I2C_ADDR);
|
||||
i2c.read(rx_tx_buf, DATA_REG_SIZE);
|
||||
i2c->address(HMC5883L_I2C_ADDR);
|
||||
i2c->read(rx_tx_buf, DATA_REG_SIZE);
|
||||
|
||||
x = (rx_tx_buf[HMC5883L_X_MSB_REG] << 8) | rx_tx_buf[HMC5883L_X_LSB_REG];
|
||||
z = (rx_tx_buf[HMC5883L_Z_MSB_REG] << 8) | rx_tx_buf[HMC5883L_Z_LSB_REG];
|
||||
@@ -123,13 +133,12 @@ main(void)
|
||||
if (direction < 0)
|
||||
direction += 2 * 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;
|
||||
|
||||
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);
|
||||
sleep(1);
|
||||
}
|
||||
//! [Interesting]
|
||||
delete i2c;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
return MRAA_SUCCESS;
|
||||
}
|
157
examples/c++/Iio-dummy.cpp
Normal file
157
examples/c++/Iio-dummy.cpp
Normal file
@@ -0,0 +1,157 @@
|
||||
/*
|
||||
* 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:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <iostream>
|
||||
#include <math.h>
|
||||
#include <float.h>
|
||||
#include "mraa/iio.hpp"
|
||||
|
||||
#define EXPECT_FAILURE 0
|
||||
#define EXPECT_SUCCESS 1
|
||||
|
||||
#define IIO_TRY(func) \
|
||||
{ \
|
||||
bool success = true; \
|
||||
try { \
|
||||
iio_device->func; \
|
||||
} catch (std::exception& e) { \
|
||||
success = false; \
|
||||
} \
|
||||
log_result(#func, "", true, success); \
|
||||
}
|
||||
|
||||
// Macro to run IIO method on attribute and log output
|
||||
#define IIO_RUN(func, attr, value, expect) \
|
||||
{ \
|
||||
std::string attr_name = attr; \
|
||||
bool success = true; \
|
||||
try { \
|
||||
iio_device->func(attr_name, value); \
|
||||
} catch (std::exception& e) { \
|
||||
success = false; \
|
||||
} \
|
||||
log_result(#func, attr_name, expect, success); \
|
||||
}
|
||||
|
||||
// Macro to run IIO method on attribute and check for expected result and log output
|
||||
#define IIO_TEST(func, attr, value, expect) \
|
||||
{ \
|
||||
std::string attr_name = attr; \
|
||||
bool success = false; \
|
||||
try { \
|
||||
success = fabs(iio_device->func(attr_name) - value) < FLT_EPSILON; \
|
||||
} catch (std::exception& e) { \
|
||||
success = false; \
|
||||
} \
|
||||
log_result(#func, attr_name, expect, success); \
|
||||
}
|
||||
|
||||
mraa::Iio* iio_device;
|
||||
int eventCount = 0;
|
||||
|
||||
// Log result of test. Note a "fail" (i.e. success is false) will be displayed as a pass if a fail was expected
|
||||
void log_result(std::string test_name, std::string attr_name, bool expect_success, bool success)
|
||||
{
|
||||
std::string result;
|
||||
if (expect_success)
|
||||
result = success ? "PASS" : "FAIL";
|
||||
else
|
||||
result = success ? "FAIL" : "PASS";
|
||||
if (attr_name.empty())
|
||||
fprintf(stdout, "%s: %s\n", test_name.c_str(), result.c_str());
|
||||
else
|
||||
fprintf(stdout, "%s(%s): %s\n", test_name.c_str(), attr_name.c_str(), result.c_str());
|
||||
}
|
||||
|
||||
// Generate iio_dummy driver event by writing a string to a specific sysfs node
|
||||
bool generate_event()
|
||||
{
|
||||
FILE *fp = fopen("/sys/bus/iio/devices/iio_evgen/poke_ev0", "w");
|
||||
if (fp == NULL)
|
||||
return false;
|
||||
fprintf(fp, "1\n");
|
||||
fclose(fp);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// IIO event handler that checks for event from dummy_iio_evgen driver
|
||||
class IioTestHandler : public mraa::IioHandler
|
||||
{
|
||||
protected:
|
||||
void onIioEvent(const mraa::IioEventData& eventData) {
|
||||
if (eventData.channelType == IIO_VOLTAGE && eventData.direction == IIO_EV_DIR_RISING && eventData.type == IIO_EV_TYPE_THRESH)
|
||||
eventCount++;
|
||||
}
|
||||
};
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
IioTestHandler testHandler;
|
||||
std::string deviceName;
|
||||
try {
|
||||
mraa::Iio* iio_device0 = new mraa::Iio(0);
|
||||
std::cout << "IIO device 0 found by id." << std::endl;
|
||||
deviceName = iio_device0->getDeviceName();
|
||||
delete iio_device0;
|
||||
} catch (std::exception& e) {
|
||||
std::cerr << "IIO device 0 not found." << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
try {
|
||||
mraa::Iio* iio_device1 = new mraa::Iio(1);
|
||||
delete iio_device1;
|
||||
} catch (std::exception& e) {
|
||||
std::cerr << "IIO device 1 not found. This is expected behavior." << std::endl;
|
||||
}
|
||||
|
||||
try {
|
||||
iio_device = new mraa::Iio(deviceName);
|
||||
std::cout << "IIO device 0 found by name." << std::endl;
|
||||
} catch (std::exception& e) {
|
||||
std::cerr << "IIO device 0 not found." << std::endl;
|
||||
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);
|
||||
IIO_RUN(writeInt, "out_voltage0_raw", 100, EXPECT_SUCCESS);
|
||||
IIO_TEST(readInt, "in_accel_x_raw", 34, EXPECT_SUCCESS);
|
||||
IIO_TEST(readFloat, "in_voltage0_scale", 0.001333, EXPECT_SUCCESS);
|
||||
IIO_RUN(writeInt, "events/in_voltage0_thresh_rising_en", 1, EXPECT_SUCCESS);
|
||||
IIO_TRY(registerEventHandler(&testHandler));
|
||||
eventCount = 0;
|
||||
generate_event();
|
||||
usleep(500000);
|
||||
log_result("eventReceived", "", (eventCount == 1), true);
|
||||
|
||||
delete iio_device;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
57
examples/c++/Isr-pin6.cpp
Normal file
57
examples/c++/Isr-pin6.cpp
Normal file
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#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 = new mraa::Gpio(6);
|
||||
|
||||
x->dir(mraa::DIR_IN);
|
||||
|
||||
x->isr(mraa::EDGE_BOTH, &interrupt, NULL);
|
||||
|
||||
for (;;) {
|
||||
if (counter != oldcounter) {
|
||||
fprintf(stdout, "timeout counter == %d\n", counter);
|
||||
oldcounter = counter;
|
||||
}
|
||||
// got to relieve our poor CPU!
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
68
examples/c++/Pwm3-cycle.cpp
Normal file
68
examples/c++/Pwm3-cycle.cpp
Normal file
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* 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 <unistd.h>
|
||||
#include <signal.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;
|
||||
|
||||
pwm = new mraa::Pwm(3);
|
||||
if (pwm == NULL) {
|
||||
return MRAA_ERROR_UNSPECIFIED;
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
delete pwm;
|
||||
//! [Interesting]
|
||||
|
||||
return MRAA_SUCCESS;
|
||||
}
|
80
examples/c++/Spi-pot.cpp
Normal file
80
examples/c++/Spi-pot.cpp
Normal file
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* 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 <unistd.h>
|
||||
#include <signal.h>
|
||||
#include <stdint.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;
|
||||
|
||||
spi = new mraa::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);
|
||||
}
|
||||
}
|
||||
delete spi;
|
||||
//! [Interesting]
|
||||
|
||||
return mraa::SUCCESS;
|
||||
}
|
70
examples/c++/Uart-example.cpp
Normal file
70
examples/c++/Uart-example.cpp
Normal file
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* 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 <unistd.h>
|
||||
#include <iostream>
|
||||
#include <exception>
|
||||
|
||||
#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;
|
||||
}
|
82
examples/c++/UartOW.cpp
Normal file
82
examples/c++/UartOW.cpp
Normal file
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* 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 "stdio.h"
|
||||
#include "iostream"
|
||||
//! [Interesting]
|
||||
#include "uart_ow.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
mraa::UartOW* uart = new mraa::UartOW(0);
|
||||
|
||||
// Reset the ow bus and see if anything is present
|
||||
mraa::Result rv;
|
||||
|
||||
if ((rv = uart->reset()) == mraa::SUCCESS) {
|
||||
cout << "Reset succeeded, device(s) detected!" << endl;
|
||||
} else {
|
||||
cout << "Reset failed, returned " << int(rv) << ". No devices on bus?" << endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
cout << "Looking for devices..." << endl;
|
||||
;
|
||||
|
||||
uint8_t count = 0;
|
||||
// start the search from scratch
|
||||
string id = uart->search(true);
|
||||
|
||||
if (id.empty()) {
|
||||
cout << "No devices detected." << 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.c_str();
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
cout << "Exiting..." << endl;
|
||||
|
||||
delete uart;
|
||||
|
||||
return 0;
|
||||
}
|
||||
//! [Interesting]
|
@@ -1,56 +0,0 @@
|
||||
/*
|
||||
* 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;
|
||||
}
|
@@ -1,97 +0,0 @@
|
||||
/*
|
||||
* 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;
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user