summaryrefslogtreecommitdiff
path: root/peripheral/libmraa
diff options
context:
space:
mode:
Diffstat (limited to 'peripheral/libmraa')
-rw-r--r--peripheral/libmraa/.clang-format50
-rw-r--r--peripheral/libmraa/.gitignore22
-rw-r--r--peripheral/libmraa/.gitmodules4
-rw-r--r--peripheral/libmraa/.travis.yml32
-rw-r--r--peripheral/libmraa/Android.mk62
-rw-r--r--peripheral/libmraa/CMakeLists.txt197
-rw-r--r--peripheral/libmraa/CONTRIBUTING.md90
-rw-r--r--peripheral/libmraa/COPYING21
-rw-r--r--peripheral/libmraa/Doxyfile.in2347
-rw-r--r--peripheral/libmraa/Doxyfile.java.in2324
-rw-r--r--peripheral/libmraa/DoxygenLayout.xml194
-rw-r--r--peripheral/libmraa/README.md106
-rw-r--r--peripheral/libmraa/api/mraa.h39
-rw-r--r--peripheral/libmraa/api/mraa.hpp33
-rw-r--r--peripheral/libmraa/api/mraa/aio.h106
-rw-r--r--peripheral/libmraa/api/mraa/aio.hpp110
-rw-r--r--peripheral/libmraa/api/mraa/common.h283
-rw-r--r--peripheral/libmraa/api/mraa/common.hpp293
-rw-r--r--peripheral/libmraa/api/mraa/gpio.h229
-rw-r--r--peripheral/libmraa/api/mraa/gpio.hpp312
-rw-r--r--peripheral/libmraa/api/mraa/i2c.h190
-rw-r--r--peripheral/libmraa/api/mraa/i2c.hpp221
-rw-r--r--peripheral/libmraa/api/mraa/iio.h139
-rw-r--r--peripheral/libmraa/api/mraa/iio.hpp245
-rw-r--r--peripheral/libmraa/api/mraa/iio_kernel_headers.h136
-rw-r--r--peripheral/libmraa/api/mraa/pwm.h205
-rw-r--r--peripheral/libmraa/api/mraa/pwm.hpp232
-rw-r--r--peripheral/libmraa/api/mraa/spi.h196
-rw-r--r--peripheral/libmraa/api/mraa/spi.hpp229
-rw-r--r--peripheral/libmraa/api/mraa/types.h246
-rw-r--r--peripheral/libmraa/api/mraa/types.hpp234
-rw-r--r--peripheral/libmraa/api/mraa/uart.h169
-rw-r--r--peripheral/libmraa/api/mraa/uart.hpp242
-rw-r--r--peripheral/libmraa/cmake/Toolchains/oe-sdk_cross.cmake25
-rw-r--r--peripheral/libmraa/cmake/modules/COPYING-CMAKE-SCRIPTS22
-rw-r--r--peripheral/libmraa/cmake/modules/CPackDeb.cmake222
-rw-r--r--peripheral/libmraa/cmake/modules/Copyright.txt57
-rw-r--r--peripheral/libmraa/cmake/modules/FindFtd2xx.cmake73
-rw-r--r--peripheral/libmraa/cmake/modules/FindFtd4222.cmake75
-rw-r--r--peripheral/libmraa/cmake/modules/FindNodejs.cmake94
-rw-r--r--peripheral/libmraa/cmake/modules/FindSphinx.cmake14
-rw-r--r--peripheral/libmraa/cmake/modules/FindYuidoc.cmake21
-rw-r--r--peripheral/libmraa/cmake/modules/GetGitRevisionDescription.cmake130
-rw-r--r--peripheral/libmraa/cmake/modules/GetGitRevisionDescription.cmake.in38
-rw-r--r--peripheral/libmraa/cmake/modules/LICENSE.LGPL504
-rw-r--r--peripheral/libmraa/cmake/modules/LICENSE_1_0.txt23
-rw-r--r--peripheral/libmraa/cmake/modules/TargetArch.cmake145
-rw-r--r--peripheral/libmraa/cmake/modules/version.c.in4
-rw-r--r--peripheral/libmraa/docs/banana_pi.md85
-rw-r--r--peripheral/libmraa/docs/beaglebone.md74
-rw-r--r--peripheral/libmraa/docs/building.md184
-rw-r--r--peripheral/libmraa/docs/changelog.md240
-rw-r--r--peripheral/libmraa/docs/debugging.md31
-rw-r--r--peripheral/libmraa/docs/edison.md112
-rw-r--r--peripheral/libmraa/docs/ftdi_ft4222.md80
-rw-r--r--peripheral/libmraa/docs/galileorevd.md14
-rw-r--r--peripheral/libmraa/docs/galileorevh.md56
-rw-r--r--peripheral/libmraa/docs/i2c.txt3
-rw-r--r--peripheral/libmraa/docs/iio.md44
-rw-r--r--peripheral/libmraa/docs/index.java.md69
-rw-r--r--peripheral/libmraa/docs/index.md70
-rw-r--r--peripheral/libmraa/docs/intel_de3815.md38
-rw-r--r--peripheral/libmraa/docs/intel_nuc5.md46
-rw-r--r--peripheral/libmraa/docs/internals.md180
-rw-r--r--peripheral/libmraa/docs/minnow_max.md58
-rw-r--r--peripheral/libmraa/docs/npm.md49
-rw-r--r--peripheral/libmraa/docs/platform-hooks.md33
-rw-r--r--peripheral/libmraa/docs/raspberry_pi.md100
-rw-r--r--peripheral/libmraa/docs/testing.md42
-rw-r--r--peripheral/libmraa/docs/up.md84
-rw-r--r--peripheral/libmraa/examples/CMakeLists.txt49
-rw-r--r--peripheral/libmraa/examples/analogin_a0.c52
-rw-r--r--peripheral/libmraa/examples/blink-io.c104
-rw-r--r--peripheral/libmraa/examples/blink_onboard.c83
-rw-r--r--peripheral/libmraa/examples/c++/AioA0.cpp49
-rw-r--r--peripheral/libmraa/examples/c++/Blink-IO.cpp77
-rw-r--r--peripheral/libmraa/examples/c++/CMakeLists.txt21
-rw-r--r--peripheral/libmraa/examples/c++/I2c-compass.cpp144
-rw-r--r--peripheral/libmraa/examples/c++/Iio-dummy.cpp157
-rw-r--r--peripheral/libmraa/examples/c++/Isr-pin6.cpp57
-rw-r--r--peripheral/libmraa/examples/c++/Pwm3-cycle.cpp68
-rw-r--r--peripheral/libmraa/examples/c++/Spi-pot.cpp80
-rw-r--r--peripheral/libmraa/examples/c++/Uart-example.cpp70
-rw-r--r--peripheral/libmraa/examples/cycle-pwm3.c55
-rw-r--r--peripheral/libmraa/examples/gpio_read6.c52
-rw-r--r--peripheral/libmraa/examples/helloedison.c69
-rw-r--r--peripheral/libmraa/examples/hellomraa.c43
-rw-r--r--peripheral/libmraa/examples/i2c_HMC5883L.c136
-rw-r--r--peripheral/libmraa/examples/iio_driver.c145
-rw-r--r--peripheral/libmraa/examples/isr_pin6.c67
-rw-r--r--peripheral/libmraa/examples/java/AioA0.java56
-rw-r--r--peripheral/libmraa/examples/java/BlinkIO.java72
-rw-r--r--peripheral/libmraa/examples/java/BlinkOnboard.java81
-rw-r--r--peripheral/libmraa/examples/java/Bmp85.java75
-rw-r--r--peripheral/libmraa/examples/java/CyclePwm3.java57
-rw-r--r--peripheral/libmraa/examples/java/Example.java49
-rw-r--r--peripheral/libmraa/examples/java/FTDITest.java62
-rw-r--r--peripheral/libmraa/examples/java/GpioMmapped.java60
-rw-r--r--peripheral/libmraa/examples/java/GpioRead6.java55
-rw-r--r--peripheral/libmraa/examples/java/HelloEdison.java73
-rw-r--r--peripheral/libmraa/examples/java/I2cCompass.java135
-rw-r--r--peripheral/libmraa/examples/java/Isr.java65
-rw-r--r--peripheral/libmraa/examples/java/SpiMAX7219.java93
-rw-r--r--peripheral/libmraa/examples/java/SpiMCP4261.java64
-rw-r--r--peripheral/libmraa/examples/java/UartExample.java56
-rw-r--r--peripheral/libmraa/examples/javascript/AioA0.js32
-rw-r--r--peripheral/libmraa/examples/javascript/Blink-IO.js40
-rw-r--r--peripheral/libmraa/examples/javascript/GPIO_DigitalRead.js38
-rw-r--r--peripheral/libmraa/examples/javascript/GPIO_DigitalWrite.js30
-rw-r--r--peripheral/libmraa/examples/javascript/bmp85.js52
-rw-r--r--peripheral/libmraa/examples/javascript/gpio-tool.js100
-rw-r--r--peripheral/libmraa/examples/javascript/isr.js10
-rw-r--r--peripheral/libmraa/examples/javascript/rgblcd.js34
-rw-r--r--peripheral/libmraa/examples/javascript/spi.js38
-rw-r--r--peripheral/libmraa/examples/javascript/uart.js54
-rw-r--r--peripheral/libmraa/examples/mmap-io2.c47
-rw-r--r--peripheral/libmraa/examples/mraa-gpio.c234
-rw-r--r--peripheral/libmraa/examples/mraa-i2c.c284
-rw-r--r--peripheral/libmraa/examples/python/aio.py34
-rw-r--r--peripheral/libmraa/examples/python/blink-io8.py35
-rw-r--r--peripheral/libmraa/examples/python/bmp85.py53
-rw-r--r--peripheral/libmraa/examples/python/cycle-pwm3.py38
-rw-r--r--peripheral/libmraa/examples/python/hello_gpio.py30
-rw-r--r--peripheral/libmraa/examples/python/hello_isr.py43
-rw-r--r--peripheral/libmraa/examples/python/rgblcd.py39
-rw-r--r--peripheral/libmraa/examples/python/spi.py43
-rw-r--r--peripheral/libmraa/examples/python/uart_receiver.py44
-rw-r--r--peripheral/libmraa/examples/python/uart_sender.py57
-rw-r--r--peripheral/libmraa/examples/samples.mapping.txt16
-rw-r--r--peripheral/libmraa/examples/spi_max7219.c88
-rw-r--r--peripheral/libmraa/examples/spi_mcp4261.c58
-rw-r--r--peripheral/libmraa/examples/uart.c50
-rw-r--r--peripheral/libmraa/include/arm/96boards.h46
-rw-r--r--peripheral/libmraa/include/arm/banana.h41
-rw-r--r--peripheral/libmraa/include/arm/beaglebone.h41
-rw-r--r--peripheral/libmraa/include/arm/raspberry_pi.h45
-rw-r--r--peripheral/libmraa/include/linux/README5
-rw-r--r--peripheral/libmraa/include/linux/compiler.h18
-rw-r--r--peripheral/libmraa/include/linux/i2c-dev.h96
-rw-r--r--peripheral/libmraa/include/linux/posix_types.h33
-rw-r--r--peripheral/libmraa/include/linux/types.h43
-rw-r--r--peripheral/libmraa/include/mraa_adv_func.h91
-rw-r--r--peripheral/libmraa/include/mraa_internal.h135
-rw-r--r--peripheral/libmraa/include/mraa_internal_types.h298
-rw-r--r--peripheral/libmraa/include/usb/ftdi_ft4222.h41
-rw-r--r--peripheral/libmraa/include/version.h36
-rw-r--r--peripheral/libmraa/include/x86/intel_cherryhills.h41
-rw-r--r--peripheral/libmraa/include/x86/intel_de3815.h40
-rw-r--r--peripheral/libmraa/include/x86/intel_edison_fab_c.h40
-rw-r--r--peripheral/libmraa/include/x86/intel_galileo_rev_d.h40
-rw-r--r--peripheral/libmraa/include/x86/intel_galileo_rev_g.h40
-rw-r--r--peripheral/libmraa/include/x86/intel_minnow_byt_compatible.h42
-rw-r--r--peripheral/libmraa/include/x86/intel_nuc5.h40
-rw-r--r--peripheral/libmraa/include/x86/intel_sofia_3gr.h39
-rw-r--r--peripheral/libmraa/include/x86/up.h43
-rw-r--r--peripheral/libmraa/src/CMakeLists.txt200
-rw-r--r--peripheral/libmraa/src/aio/aio.c226
-rw-r--r--peripheral/libmraa/src/arm/96boards.c174
-rw-r--r--peripheral/libmraa/src/arm/CMakeLists.txt3
-rw-r--r--peripheral/libmraa/src/arm/arm.c104
-rw-r--r--peripheral/libmraa/src/arm/banana.c592
-rw-r--r--peripheral/libmraa/src/arm/beaglebone.c1432
-rw-r--r--peripheral/libmraa/src/arm/raspberry_pi.c565
-rwxr-xr-xperipheral/libmraa/src/doxy2swig.py457
-rw-r--r--peripheral/libmraa/src/glob/glob.c1149
-rw-r--r--peripheral/libmraa/src/glob/glob.h113
-rw-r--r--peripheral/libmraa/src/gpio/gpio.c856
-rw-r--r--peripheral/libmraa/src/i2c/LICENSE22
-rw-r--r--peripheral/libmraa/src/i2c/i2c.c372
-rw-r--r--peripheral/libmraa/src/iio/iio.c654
-rw-r--r--peripheral/libmraa/src/java/CMakeLists.txt49
-rw-r--r--peripheral/libmraa/src/java/mraajava.i87
-rw-r--r--peripheral/libmraa/src/java/mraajava.pc.cmake11
-rw-r--r--peripheral/libmraa/src/javascript/CMakeLists.txt114
-rw-r--r--peripheral/libmraa/src/javascript/binding.gyp.cmake37
-rw-r--r--peripheral/libmraa/src/javascript/doxygen2jsdoc_custom.json77
-rw-r--r--peripheral/libmraa/src/javascript/mraajs.i139
-rw-r--r--peripheral/libmraa/src/javascript/package.json.cmake16
-rw-r--r--peripheral/libmraa/src/mraa.c806
-rw-r--r--peripheral/libmraa/src/mraa.i61
-rw-r--r--peripheral/libmraa/src/mraa.pc.cmake11
-rw-r--r--peripheral/libmraa/src/pwm/pwm.c498
-rw-r--r--peripheral/libmraa/src/python/CMakeLists.txt52
-rw-r--r--peripheral/libmraa/src/python/docs/CMakeLists.txt41
-rw-r--r--peripheral/libmraa/src/python/docs/conf.py.in332
-rw-r--r--peripheral/libmraa/src/python/docs/example.rst93
-rw-r--r--peripheral/libmraa/src/python/docs/index.rst57
-rw-r--r--peripheral/libmraa/src/python/docs/mraa.rst52
-rw-r--r--peripheral/libmraa/src/python/mraa.i154
-rw-r--r--peripheral/libmraa/src/spi/spi.c358
-rw-r--r--peripheral/libmraa/src/uart/uart.c537
-rw-r--r--peripheral/libmraa/src/usb/CMakeLists.txt12
-rw-r--r--peripheral/libmraa/src/usb/ftdi_ft4222.c1128
-rw-r--r--peripheral/libmraa/src/usb/usb.c70
-rw-r--r--peripheral/libmraa/src/x86/CMakeLists.txt3
-rw-r--r--peripheral/libmraa/src/x86/intel_cherryhills.c99
-rw-r--r--peripheral/libmraa/src/x86/intel_de3815.c160
-rw-r--r--peripheral/libmraa/src/x86/intel_edison_fab_c.c1613
-rw-r--r--peripheral/libmraa/src/x86/intel_galileo_rev_d.c446
-rw-r--r--peripheral/libmraa/src/x86/intel_galileo_rev_g.c761
-rw-r--r--peripheral/libmraa/src/x86/intel_minnow_byt_compatible.c213
-rw-r--r--peripheral/libmraa/src/x86/intel_nuc5.c142
-rw-r--r--peripheral/libmraa/src/x86/intel_sofia_3gr.c103
-rw-r--r--peripheral/libmraa/src/x86/up.c215
-rw-r--r--peripheral/libmraa/src/x86/x86.c134
-rw-r--r--peripheral/libmraa/tests/CMakeLists.txt20
-rw-r--r--peripheral/libmraa/tests/check_clean.py23
-rw-r--r--peripheral/libmraa/tests/check_samplenames.py64
-rwxr-xr-xperipheral/libmraa/tests/general_checks.py37
-rwxr-xr-xperipheral/libmraa/tests/gpio_checks.py93
-rwxr-xr-xperipheral/libmraa/tests/platform_checks.py47
211 files changed, 0 insertions, 34147 deletions
diff --git a/peripheral/libmraa/.clang-format b/peripheral/libmraa/.clang-format
deleted file mode 100644
index 6860bcf..0000000
--- a/peripheral/libmraa/.clang-format
+++ /dev/null
@@ -1,50 +0,0 @@
-AccessModifierOffset: -2
-AlignEscapedNewlinesLeft: true
-AlignTrailingComments: true
-AllowAllParametersOfDeclarationOnNextLine: false
-AllowShortFunctionsOnASingleLine: false
-AllowShortIfStatementsOnASingleLine: false
-AllowShortLoopsOnASingleLine: false
-AlwaysBreakBeforeMultilineStrings: false
-AlwaysBreakTemplateDeclarations: false
-AlwaysBreakAfterDefinitionReturnType: true
-BinPackParameters: false
-BreakBeforeBinaryOperators: false
-BreakBeforeBraces: Linux
-BreakBeforeTernaryOperators: false
-BreakConstructorInitializersBeforeComma: false
-ColumnLimit: 100
-CommentPragmas: ''
-ConstructorInitializerAllOnOneLineOrOnePerLine: false
-ConstructorInitializerIndentWidth: 0
-ContinuationIndentWidth: 0
-Cpp11BracedListStyle: false
-DerivePointerBinding: false
-IndentCaseLabels: true
-IndentFunctionDeclarationAfterType: false
-IndentWidth: 4
-Language: Cpp
-MaxEmptyLinesToKeep: 2
-NamespaceIndentation: None
-ObjCSpaceAfterProperty: true
-ObjCSpaceBeforeProtocolList: true
-PenaltyBreakBeforeFirstCallParameter: 100
-PenaltyBreakComment: 100
-PenaltyBreakFirstLessLess: 0
-PenaltyBreakString: 100
-PenaltyExcessCharacter: 1
-PenaltyReturnTypeOnItsOwnLine: 20
-PointerBindsToType: true
-PointerAlignment: Left
-SpaceBeforeAssignmentOperators: true
-SpaceBeforeParens: ControlStatements
-SpaceInEmptyParentheses: false
-SpacesBeforeTrailingComments: 1
-SpacesInAngles: false
-SpacesInCStyleCastParentheses: false
-SpaceAfterCStyleCast: true
-SpacesInContainerLiterals: false
-SpacesInParentheses: false
-Standard: Cpp11
-TabWidth: 4
-UseTab: Never
diff --git a/peripheral/libmraa/.gitignore b/peripheral/libmraa/.gitignore
deleted file mode 100644
index 41c99f7..0000000
--- a/peripheral/libmraa/.gitignore
+++ /dev/null
@@ -1,22 +0,0 @@
-build/
-
-# Object files
-*.o
-*.lib
-*.so
-*.lo
-*.la
-*.pyc
-
-# Temp files
-*.swp
-*.swo
-*~
-
-# npmpub files
-src/mraajsJAVASCRIPT_wrap.cxx
-src/version.c
-package.json
-binding.gyp
-READMEFIRST
-npm-debug.log
diff --git a/peripheral/libmraa/.gitmodules b/peripheral/libmraa/.gitmodules
deleted file mode 100644
index b2bc350..0000000
--- a/peripheral/libmraa/.gitmodules
+++ /dev/null
@@ -1,4 +0,0 @@
-[submodule "doxygen2jsdoc"]
- path = doxygen2jsdoc
- url = https://github.com/arfoll/doxygen2jsdoc.git
- branch = master
diff --git a/peripheral/libmraa/.travis.yml b/peripheral/libmraa/.travis.yml
deleted file mode 100644
index 2d22386..0000000
--- a/peripheral/libmraa/.travis.yml
+++ /dev/null
@@ -1,32 +0,0 @@
-language: cpp
-env:
- - CC=gcc CXX=gcc
- - CC=clang CXX=clang++
- - NODE4=true
- - NODE5=true
- - NODE012=true
-install:
- - if [ "${NODE4}" ]; then export CC=gcc-4.8 CXX=g++-4.8; fi
- - sudo add-apt-repository --yes ppa:kalakris/cmake
- - sudo add-apt-repository --yes ppa:fenics-packages/fenics-exp/swig
- - sudo apt-get update -qq
- - sudo apt-get install -y -qq swig3.0 python git cmake
- - sudo ln -s /usr/bin/swig3.0 /usr/bin/swig
- - sudo update-java-alternatives -s java-8-oracle
-before_script:
- - export NODE_ROOT_DIR="/home/travis/.nvm/v0.10.36/include"
- - if [ "$CC" = "gcc" ]; then export BUILDJAVA=ON; else export BUILDJAVA=OFF; fi
- - export JAVA_HOME=/usr/lib/jvm/java-8-oracle
- - if [ "${NODE4}" ]; then nvm install 4.1; export CC=gcc-4.8; export CXX=g++-4.8; export NODE_ROOT_DIR="/home/travis/.nvm/versions/node/`nvm version`/include"; fi
- - if [ "${NODE5}" ]; then nvm install 5; export CC=gcc-4.8; export CXX=g++-4.8; export NODE_ROOT_DIR="/home/travis/.nvm/versions/node/`nvm version`/include"; fi
- - if [ "${NODE012}" ]; then nvm install 0.12; export NODE_ROOT_DIR="/home/travis/.nvm/versions/node/`nvm version`/include"; fi
-script:
- - mkdir build && cd build && cmake -DBUILDSWIGJAVA=$BUILDJAVA -DNODE_ROOT_DIR:PATH="${NODE_ROOT_DIR}" .. && make && make test
-addons:
- apt:
- sources:
- - llvm-toolchain-precise-3.6
- - ubuntu-toolchain-r-test
- packages:
- - clang-3.6
- - g++-4.8
diff --git a/peripheral/libmraa/Android.mk b/peripheral/libmraa/Android.mk
deleted file mode 100644
index e6e1376..0000000
--- a/peripheral/libmraa/Android.mk
+++ /dev/null
@@ -1,62 +0,0 @@
-# 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
-
-# glob.c pulled in from NetBSD project (BSD 3-clause License)
-LOCAL_CFLAGS += '-D__UNCONST(a)=((void *)(unsigned long)(const void *)(a))'
-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)
-
diff --git a/peripheral/libmraa/CMakeLists.txt b/peripheral/libmraa/CMakeLists.txt
deleted file mode 100644
index ffd9e06..0000000
--- a/peripheral/libmraa/CMakeLists.txt
+++ /dev/null
@@ -1,197 +0,0 @@
-cmake_minimum_required (VERSION 2.8)
-project (mraa C)
-
-FIND_PACKAGE (Threads REQUIRED)
-
-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 (LIB_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}" CACHE PATH "Installation path for libraries")
-
-# Set CMAKE_LIB_INSTALL_DIR if not defined
-include(GNUInstallDirs)
-
-# By default, build shared object libraries on linux
-if (UNIX AND NOT APPLE)
- if (NOT DEFINED BUILD_SHARED_LIBS)
- set(BUILD_SHARED_LIBS ON)
- endif()
-endif()
-
-# Appends the cmake/modules path to MAKE_MODULE_PATH variable.
-set (CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH})
-
-# Make a version file containing the current version from git.
-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 "v0.9.6-dirty")
-endif ()
-
-message (INFO " - libmraa Version ${VERSION}")
-message (INFO " - cmake Version ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}")
-
-#parse the version information into pieces.
-string (REGEX REPLACE "^v([0-9]+)\\..*" "\\1" VERSION_MAJOR "${VERSION}")
-string (REGEX REPLACE "^v[0-9]+\\.([0-9]+).*" "\\1" VERSION_MINOR "${VERSION}")
-string (REGEX REPLACE "^v[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" VERSION_PATCH "${VERSION}")
-string (REGEX REPLACE "^v[0-9]+\\.[0-9]+\\.[0-9]+\\-([0-9]+).*" "\\1" VERSION_COMMIT "${VERSION}")
-string (REGEX REPLACE "^v[0-9]+\\.[0-9]+\\.[0-9]+-[0-9]+\\-(.*)" "\\1" VERSION_SHA1 "${VERSION}")
-set (VERSION_SHORT "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
-
-if ("${VERSION_COMMIT}" MATCHES "^v.*")
- set (VERSION_COMMIT "")
-endif()
-
-configure_file (${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/version.c.in
- ${CMAKE_CURRENT_BINARY_DIR}/src/version.c)
-
-# this is the library version, independant of git revision
-set (mraa_VERSION_MAJOR ${VERSION_MAJOR})
-set (mraa_VERSION_MINOR ${VERSION_MINOR})
-set (mraa_VERSION_PATCH ${VERSION_PATCH})
-set (mraa_VERSION_STRING ${mraa_VERSION_MAJOR}.${mraa_VERSION_MINOR}.${mraa_VERSION_PATCH})
-
-set (CMAKE_SWIG_FLAGS "")
-
-find_path (SYSTEM_USR_DIR "stdlib.h")
-include_directories (${SYSTEM_USR_DIR})
-
-option (BUILDDOC "Build all doc." OFF)
-option (BUILDSWIG "Build swig modules." ON)
-option (BUILDSWIGPYTHON "Build swig python modules." ON)
-option (BUILDSWIGNODE "Build swig node modules." ON)
-option (BUILDSWIGJAVA "Build Java API." OFF)
-option (USBPLAT "Detection USB platform." 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 (BUILDPYTHON3 "Use python3 for building/installing/testing" OFF)
-option (ENABLEEXAMPLES "Disable building of examples" ON)
-option (INSTALLGPIOTOOL "Install gpio tool" OFF)
-option (INSTALLTOOLS "Install all tools" OFF)
-option (BUILDARCH "Override architecture to build for - override" OFF)
-option (BUILDTESTS "Override the addition of tests" ON)
-
-set (MRAAPLATFORMFORCE "" CACHE STRING "ALL")
-
-if (NOT BUILDSWIG)
- set (BUILDSWIGPYTHON OFF)
- set (BUILDSWIGNODE OFF)
- set (BUILDSWIGJAVA OFF)
-endif()
-
-if (NOT BUILDARCH)
- include (TargetArch)
- target_architecture (DETECTED_ARCH)
- message( INFO " - Target arch is ${DETECTED_ARCH}")
-else ()
- set (DETECTED_ARCH ${BUILDARCH})
- message( INFO " - Override arch is ${DETECTED_ARCH}")
-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.*")
- set (ARMPLAT ON)
-else ()
- message(FATAL_ERROR "Only x86 and arm platforms currently supported")
-endif()
-
-if (BUILDSWIGPYTHON OR BUILDTESTS)
- if (BUILDPYTHON3)
- set (PYTHONBUILD_VERSION 3)
- else ()
- set (PYTHONBUILD_VERSION 2.7)
- endif ()
- find_package (PythonInterp ${PYTHONBUILD_VERSION} REQUIRED)
-endif ()
-
-if (BUILDDOC)
- # add a target to generate API documentation with Doxygen
- find_package (Doxygen)
- if (DOXYGEN_FOUND)
- configure_file (${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
- if (BUILDSWIGJAVA)
- configure_file (${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.java.in ${CMAKE_CURRENT_BINARY_DIR}/src/java/Doxyfile @ONLY)
- endif ()
- add_custom_target (doc
- ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
- COMMENT "Generating API documentation with Doxygen" VERBATIM
- )
- 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 (INFO " - Package arch is ${TARGET_ARCH}")
-
- set(CPACK_GENERATOR "DEB" "TGZ")
- 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 (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)
-endif ()
-
-if (BUILDTESTS)
- if (${PYTHONINTERP_FOUND})
- enable_testing ()
- add_subdirectory (tests)
- endif ()
-endif ()
diff --git a/peripheral/libmraa/CONTRIBUTING.md b/peripheral/libmraa/CONTRIBUTING.md
deleted file mode 100644
index 387475b..0000000
--- a/peripheral/libmraa/CONTRIBUTING.md
+++ /dev/null
@@ -1,90 +0,0 @@
-Contributing to libmraa {#contributing}
-======================
-
-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
-- People to extend the functionality, API with useful functions
-- Anything we haven't thought about :) Ideas always welcome!
-
-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'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
-on: https://lists.01.org/mailman/listinfo/mraa
-
-Basic rules
------------
-- Your code must build
-- Commits must have a sign-off line by at least yourself
-- Commits must be named <file/module>: Some decent description
-- Try not to break master. In any commit.
-- Try to split commits up logically, you will be asked to rebase them if they
- are not.
-- Try to stick to the established coding style regardless of your personal
- feeling for it! Use clang-format (3.6+ required)
-
-Coding Style
-------------
-
-Coding style for all code is defined by clang-format, have a look at it. Avoid
-styling fixes as they make history difficult to read. Javascript & Java can
-also be parsed through the clang-format, it complains but seems to do an ok
-job. Few exceptions to coding styles:
-- All python code is indented by 2 spaces
-- CmakeLists files are 2 space indented and a space is required before all
- brackets so endif () and if () and command (). Also use lowercase for
- everything but variables. Cmake is case insensitive but this isn't the wild
- wild west ;-)
-
-Use common sense and don't be afraid to challenge something if it doesn't make sense!
-
-Code signing
-------------
-
-The sign-off is a simple line at the end of the explanation for the
-patch, which certifies that you wrote it or otherwise have the right to pass it
-on as an open-source patch. The rules are pretty simple: if you can certify
-the below:
-
- Developer's Certificate of Origin 1.1
-
- By making a contribution to this project, I certify that:
-
- (a) The contribution was created in whole or in part by me and I
- have the right to submit it under the open source license
- indicated in the file; or
-
- (b) The contribution is based upon previous work that, to the best
- of my knowledge, is covered under an appropriate open source
- license and I have the right under that license to submit that
- work with modifications, whether created in whole or in part
- by me, under the same open source license (unless I am
- permitted to submit under a different license), as indicated
- in the file; or
-
- (c) The contribution was provided directly to me by some other
- person who certified (a), (b) or (c) and I have not modified
- it.
-
- (d) I understand and agree that this project and the contribution
- are public and that a record of the contribution (including all
- personal information I submit with it, including my sign-off) is
- maintained indefinitely and may be redistributed consistent with
- this project or the open source license(s) involved.
-
-then you just add a line 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
-----------------
-
-Hop onto the freenode network on IRC and join #mraa. Please be patient as we're
-not always online.
-
diff --git a/peripheral/libmraa/COPYING b/peripheral/libmraa/COPYING
deleted file mode 100644
index 8122e43..0000000
--- a/peripheral/libmraa/COPYING
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-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
-"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.
diff --git a/peripheral/libmraa/Doxyfile.in b/peripheral/libmraa/Doxyfile.in
deleted file mode 100644
index e702b8c..0000000
--- a/peripheral/libmraa/Doxyfile.in
+++ /dev/null
@@ -1,2347 +0,0 @@
-# Doxyfile 1.8.6
-
-# This file describes the settings to be used by the documentation system
-# doxygen (www.doxygen.org) for a project.
-#
-# All text after a double hash (##) is considered a comment and is placed in
-# front of the TAG it is preceding.
-#
-# All text after a single hash (#) is considered a comment and will be ignored.
-# The format is:
-# TAG = value [value, ...]
-# For lists, items can also be appended using:
-# TAG += value [value, ...]
-# Values that contain spaces should be placed between quotes (\" \").
-
-#---------------------------------------------------------------------------
-# Project related configuration options
-#---------------------------------------------------------------------------
-
-# This tag specifies the encoding used for all characters in the config file
-# that follow. The default is UTF-8 which is also the encoding used for all text
-# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv
-# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv
-# for the list of possible encodings.
-# The default value is: UTF-8.
-
-DOXYFILE_ENCODING = UTF-8
-
-# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by
-# double-quotes, unless you are using Doxywizard) that should identify the
-# project for which the documentation is generated. This name is used in the
-# title of most generated pages and in a few other places.
-# The default value is: My Project.
-
-PROJECT_NAME = mraa
-
-# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
-# could be handy for archiving the generated documentation or if some version
-# control system is used.
-
-PROJECT_NUMBER = @mraa_VERSION_STRING@
-
-# Using the PROJECT_BRIEF tag one can provide an optional one line description
-# for a project that appears at the top of each page and should give viewer a
-# quick idea about the purpose of the project. Keep the description short.
-
-PROJECT_BRIEF = "Low Level Skeleton Library for Communication on GNU/Linux platforms"
-
-# With the PROJECT_LOGO tag one can specify an logo or icon that is included in
-# the documentation. The maximum height of the logo should not exceed 55 pixels
-# and the maximum width should not exceed 200 pixels. Doxygen will copy the logo
-# to the output directory.
-
-PROJECT_LOGO =
-
-# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
-# into which the generated documentation will be written. If a relative path is
-# entered, it will be relative to the location where doxygen was started. If
-# left blank the current directory will be used.
-
-OUTPUT_DIRECTORY =
-
-# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 4096 sub-
-# directories (in 2 levels) under the output directory of each output format and
-# will distribute the generated files over these directories. Enabling this
-# option can be useful when feeding doxygen a huge amount of source files, where
-# putting all generated files in the same directory would otherwise causes
-# performance problems for the file system.
-# The default value is: NO.
-
-CREATE_SUBDIRS = NO
-
-# The OUTPUT_LANGUAGE tag is used to specify the language in which all
-# documentation generated by doxygen is written. Doxygen will use this
-# information to generate all constant output in the proper language.
-# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese,
-# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States),
-# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian,
-# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages),
-# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian,
-# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian,
-# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish,
-# Ukrainian and Vietnamese.
-# The default value is: English.
-
-OUTPUT_LANGUAGE = English
-
-# If the BRIEF_MEMBER_DESC tag is set to YES doxygen will include brief member
-# descriptions after the members that are listed in the file and class
-# documentation (similar to Javadoc). Set to NO to disable this.
-# The default value is: YES.
-
-BRIEF_MEMBER_DESC = YES
-
-# If the REPEAT_BRIEF tag is set to YES doxygen will prepend the brief
-# description of a member or function before the detailed description
-#
-# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
-# brief descriptions will be completely suppressed.
-# The default value is: YES.
-
-REPEAT_BRIEF = NO
-
-# This tag implements a quasi-intelligent brief description abbreviator that is
-# used to form the text in various listings. Each string in this list, if found
-# as the leading text of the brief description, will be stripped from the text
-# and the result, after processing the whole list, is used as the annotated
-# text. Otherwise, the brief description is used as-is. If left blank, the
-# following values are used ($name is automatically replaced with the name of
-# the entity):The $name class, The $name widget, The $name file, is, provides,
-# specifies, contains, represents, a, an and the.
-
-ABBREVIATE_BRIEF = "The $name class" \
- "The $name widget" \
- "The $name file" \
- is \
- provides \
- specifies \
- contains \
- represents \
- a \
- an \
- the
-
-# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
-# doxygen will generate a detailed section even if there is only a brief
-# description.
-# The default value is: NO.
-
-ALWAYS_DETAILED_SEC = NO
-
-# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
-# inherited members of a class in the documentation of that class as if those
-# members were ordinary class members. Constructors, destructors and assignment
-# operators of the base classes will not be shown.
-# The default value is: NO.
-
-INLINE_INHERITED_MEMB = NO
-
-# If the FULL_PATH_NAMES tag is set to YES doxygen will prepend the full path
-# before files name in the file list and in the header files. If set to NO the
-# shortest path that makes the file name unique will be used
-# The default value is: YES.
-
-FULL_PATH_NAMES = YES
-
-# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path.
-# Stripping is only done if one of the specified strings matches the left-hand
-# part of the path. The tag can be used to show relative paths in the file list.
-# If left blank the directory from which doxygen is run is used as the path to
-# strip.
-#
-# Note that you can specify absolute paths here, but also relative paths, which
-# 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 =
-
-# 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
-# header file to include in order to use a class. If left blank only the name of
-# the header file containing the class definition is used. Otherwise one should
-# specify the list of include paths that are normally passed to the compiler
-# using the -I flag.
-
-STRIP_FROM_INC_PATH =
-
-# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but
-# less readable) file names. This can be useful is your file systems doesn't
-# support long names like on DOS, Mac, or CD-ROM.
-# The default value is: NO.
-
-SHORT_NAMES = NO
-
-# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the
-# first line (until the first dot) of a Javadoc-style comment as the brief
-# description. If set to NO, the Javadoc-style will behave just like regular Qt-
-# style comments (thus requiring an explicit @brief command for a brief
-# description.)
-# The default value is: NO.
-
-JAVADOC_AUTOBRIEF = NO
-
-# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first
-# line (until the first dot) of a Qt-style comment as the brief description. If
-# set to NO, the Qt-style will behave just like regular Qt-style comments (thus
-# requiring an explicit \brief command for a brief description.)
-# The default value is: NO.
-
-QT_AUTOBRIEF = NO
-
-# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a
-# multi-line C++ special comment block (i.e. a block of //! or /// comments) as
-# a brief description. This used to be the default behavior. The new default is
-# to treat a multi-line C++ comment block as a detailed description. Set this
-# tag to YES if you prefer the old behavior instead.
-#
-# Note that setting this tag to YES also means that rational rose comments are
-# not recognized any more.
-# The default value is: NO.
-
-MULTILINE_CPP_IS_BRIEF = NO
-
-# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the
-# documentation from any documented member that it re-implements.
-# The default value is: YES.
-
-INHERIT_DOCS = YES
-
-# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce a
-# new page for each member. If set to NO, the documentation of a member will be
-# part of the file/class/namespace that contains it.
-# The default value is: NO.
-
-SEPARATE_MEMBER_PAGES = NO
-
-# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen
-# uses this value to replace tabs by spaces in code fragments.
-# Minimum value: 1, maximum value: 16, default value: 4.
-
-TAB_SIZE = 4
-
-# This tag can be used to specify a number of aliases that act as commands in
-# the documentation. An alias has the form:
-# name=value
-# For example adding
-# "sideeffect=@par Side Effects:\n"
-# will allow you to put the command \sideeffect (or @sideeffect) in the
-# documentation, which will result in a user-defined paragraph with heading
-# "Side Effects:". You can put \n's in the value part of an alias to insert
-# newlines.
-
-ALIASES =
-
-# This tag can be used to specify a number of word-keyword mappings (TCL only).
-# A mapping has the form "name=value". For example adding "class=itcl::class"
-# will allow you to use the command class in the itcl::class meaning.
-
-TCL_SUBST =
-
-# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
-# only. Doxygen will then generate output that is more tailored for C. For
-# instance, some of the names that are used will be different. The list of all
-# members will be omitted, etc.
-# The default value is: NO.
-
-OPTIMIZE_OUTPUT_FOR_C = YES
-
-# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or
-# Python sources only. Doxygen will then generate output that is more tailored
-# for that language. For instance, namespaces will be presented as packages,
-# qualified scopes will look different, etc.
-# The default value is: NO.
-
-OPTIMIZE_OUTPUT_JAVA = NO
-
-# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
-# sources. Doxygen will then generate output that is tailored for Fortran.
-# The default value is: NO.
-
-OPTIMIZE_FOR_FORTRAN = NO
-
-# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
-# sources. Doxygen will then generate output that is tailored for VHDL.
-# The default value is: NO.
-
-OPTIMIZE_OUTPUT_VHDL = NO
-
-# Doxygen selects the parser to use depending on the extension of the files it
-# parses. With this tag you can assign which parser to use for a given
-# extension. Doxygen has a built-in mapping, but you can override or extend it
-# using this tag. The format is ext=language, where ext is a file extension, and
-# language is one of the parsers supported by doxygen: IDL, Java, Javascript,
-# C#, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL. For instance to make
-# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C
-# (default is Fortran), use: inc=Fortran f=C.
-#
-# Note For files without extension you can use no_extension as a placeholder.
-#
-# Note that for custom extensions you also need to set FILE_PATTERNS otherwise
-# the files are not read by doxygen.
-
-EXTENSION_MAPPING =
-
-# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments
-# according to the Markdown format, which allows for more readable
-# documentation. See http://daringfireball.net/projects/markdown/ for details.
-# The output of markdown processing is further processed by doxygen, so you can
-# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in
-# case of backward compatibilities issues.
-# The default value is: YES.
-
-MARKDOWN_SUPPORT = YES
-
-# When enabled doxygen tries to link words that correspond to documented
-# classes, or namespaces to their corresponding documentation. Such a link can
-# be prevented in individual cases by by putting a % sign in front of the word
-# or globally by setting AUTOLINK_SUPPORT to NO.
-# The default value is: YES.
-
-AUTOLINK_SUPPORT = YES
-
-# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
-# to include (a tag file for) the STL sources as input, then you should set this
-# tag to YES in order to let doxygen match functions declarations and
-# definitions whose arguments contain STL classes (e.g. func(std::string);
-# versus func(std::string) {}). This also make the inheritance and collaboration
-# diagrams that involve STL classes more complete and accurate.
-# The default value is: NO.
-
-BUILTIN_STL_SUPPORT = NO
-
-# If you use Microsoft's C++/CLI language, you should set this option to YES to
-# enable parsing support.
-# The default value is: NO.
-
-CPP_CLI_SUPPORT = NO
-
-# Set the SIP_SUPPORT tag to YES if your project consists of sip (see:
-# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen
-# will parse them like normal C++ but will assume all classes use public instead
-# of private inheritance when no explicit protection keyword is present.
-# The default value is: NO.
-
-SIP_SUPPORT = NO
-
-# For Microsoft's IDL there are propget and propput attributes to indicate
-# getter and setter methods for a property. Setting this option to YES will make
-# doxygen to replace the get and set methods by a property in the documentation.
-# This will only work if the methods are indeed getting or setting a simple
-# type. If this is not the case, or you want to show the methods anyway, you
-# should set this option to NO.
-# The default value is: YES.
-
-IDL_PROPERTY_SUPPORT = YES
-
-# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
-# tag is set to YES, then doxygen will reuse the documentation of the first
-# member in the group (if any) for the other members of the group. By default
-# all members of a group must be documented explicitly.
-# The default value is: NO.
-
-DISTRIBUTE_GROUP_DOC = NO
-
-# Set the SUBGROUPING tag to YES to allow class member groups of the same type
-# (for instance a group of public functions) to be put as a subgroup of that
-# type (e.g. under the Public Functions section). Set it to NO to prevent
-# subgrouping. Alternatively, this can be done per class using the
-# \nosubgrouping command.
-# The default value is: YES.
-
-SUBGROUPING = YES
-
-# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions
-# are shown inside the group in which they are included (e.g. using \ingroup)
-# instead of on a separate page (for HTML and Man pages) or section (for LaTeX
-# and RTF).
-#
-# Note that this feature does not work in combination with
-# SEPARATE_MEMBER_PAGES.
-# The default value is: NO.
-
-INLINE_GROUPED_CLASSES = NO
-
-# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions
-# with only public data fields or simple typedef fields will be shown inline in
-# the documentation of the scope in which they are defined (i.e. file,
-# namespace, or group documentation), provided this scope is documented. If set
-# to NO, structs, classes, and unions are shown on a separate page (for HTML and
-# Man pages) or section (for LaTeX and RTF).
-# The default value is: NO.
-
-INLINE_SIMPLE_STRUCTS = NO
-
-# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or
-# enum is documented as struct, union, or enum with the name of the typedef. So
-# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
-# with name TypeT. When disabled the typedef will appear as a member of a file,
-# namespace, or class. And the struct will be named TypeS. This can typically be
-# useful for C code in case the coding convention dictates that all compound
-# types are typedef'ed and only the typedef is referenced, never the tag name.
-# The default value is: NO.
-
-TYPEDEF_HIDES_STRUCT = NO
-
-# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This
-# cache is used to resolve symbols given their name and scope. Since this can be
-# an expensive process and often the same symbol appears multiple times in the
-# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small
-# doxygen will become slower. If the cache is too large, memory is wasted. The
-# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range
-# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536
-# symbols. At the end of a run doxygen will report the cache usage and suggest
-# the optimal cache size from a speed point of view.
-# Minimum value: 0, maximum value: 9, default value: 0.
-
-LOOKUP_CACHE_SIZE = 0
-
-#---------------------------------------------------------------------------
-# Build related configuration options
-#---------------------------------------------------------------------------
-
-# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
-# documentation are documented, even if no documentation was available. Private
-# class members and static file members will be hidden unless the
-# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES.
-# Note: This will also disable the warnings about undocumented members that are
-# normally produced when WARNINGS is set to YES.
-# The default value is: NO.
-
-EXTRACT_ALL = NO
-
-# If the EXTRACT_PRIVATE tag is set to YES all private members of a class will
-# be included in the documentation.
-# The default value is: NO.
-
-EXTRACT_PRIVATE = NO
-
-# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal
-# scope will be included in the documentation.
-# The default value is: NO.
-
-EXTRACT_PACKAGE = NO
-
-# If the EXTRACT_STATIC tag is set to YES all static members of a file will be
-# included in the documentation.
-# The default value is: NO.
-
-EXTRACT_STATIC = NO
-
-# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) defined
-# locally in source files will be included in the documentation. If set to NO
-# only classes defined in header files are included. Does not have any effect
-# for Java sources.
-# The default value is: YES.
-
-EXTRACT_LOCAL_CLASSES = YES
-
-# This flag is only useful for Objective-C code. When set to YES local methods,
-# which are defined in the implementation section but not in the interface are
-# included in the documentation. If set to NO only methods in the interface are
-# included.
-# The default value is: NO.
-
-EXTRACT_LOCAL_METHODS = NO
-
-# If this flag is set to YES, the members of anonymous namespaces will be
-# extracted and appear in the documentation as a namespace called
-# 'anonymous_namespace{file}', where file will be replaced with the base name of
-# the file that contains the anonymous namespace. By default anonymous namespace
-# are hidden.
-# The default value is: NO.
-
-EXTRACT_ANON_NSPACES = NO
-
-# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all
-# undocumented members inside documented classes or files. If set to NO these
-# members will be included in the various overviews, but no documentation
-# section is generated. This option has no effect if EXTRACT_ALL is enabled.
-# The default value is: NO.
-
-HIDE_UNDOC_MEMBERS = NO
-
-# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all
-# undocumented classes that are normally visible in the class hierarchy. If set
-# to NO these classes will be included in the various overviews. This option has
-# no effect if EXTRACT_ALL is enabled.
-# The default value is: NO.
-
-HIDE_UNDOC_CLASSES = NO
-
-# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend
-# (class|struct|union) declarations. If set to NO these declarations will be
-# included in the documentation.
-# The default value is: NO.
-
-HIDE_FRIEND_COMPOUNDS = NO
-
-# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any
-# documentation blocks found inside the body of a function. If set to NO these
-# blocks will be appended to the function's detailed documentation block.
-# The default value is: NO.
-
-HIDE_IN_BODY_DOCS = NO
-
-# The INTERNAL_DOCS tag determines if documentation that is typed after a
-# \internal command is included. If the tag is set to NO then the documentation
-# will be excluded. Set it to YES to include the internal documentation.
-# The default value is: NO.
-
-INTERNAL_DOCS = NO
-
-# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file
-# names in lower-case letters. If set to YES upper-case letters are also
-# allowed. This is useful if you have classes or files whose names only differ
-# in case and if your file system supports case sensitive file names. Windows
-# and Mac users are advised to set this option to NO.
-# The default value is: system dependent.
-
-CASE_SENSE_NAMES = NO
-
-# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with
-# their full class and namespace scopes in the documentation. If set to YES the
-# scope will be hidden.
-# The default value is: NO.
-
-HIDE_SCOPE_NAMES = YES
-
-# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of
-# the files that are included by a file in the documentation of that file.
-# The default value is: YES.
-
-SHOW_INCLUDE_FILES = NO
-
-# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each
-# grouped member an include statement to the documentation, telling the reader
-# which file to include in order to use the member.
-# The default value is: NO.
-
-SHOW_GROUPED_MEMB_INC = NO
-
-# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include
-# files with double quotes in the documentation rather than with sharp brackets.
-# The default value is: NO.
-
-FORCE_LOCAL_INCLUDES = NO
-
-# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the
-# documentation for inline members.
-# The default value is: YES.
-
-INLINE_INFO = YES
-
-# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the
-# (detailed) documentation of file and class members alphabetically by member
-# name. If set to NO the members will appear in declaration order.
-# The default value is: YES.
-
-SORT_MEMBER_DOCS = NO
-
-# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief
-# descriptions of file, namespace and class members alphabetically by member
-# name. If set to NO the members will appear in declaration order. Note that
-# this will also influence the order of the classes in the class list.
-# The default value is: NO.
-
-SORT_BRIEF_DOCS = NO
-
-# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the
-# (brief and detailed) documentation of class members so that constructors and
-# destructors are listed first. If set to NO the constructors will appear in the
-# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS.
-# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief
-# member documentation.
-# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting
-# detailed member documentation.
-# The default value is: NO.
-
-SORT_MEMBERS_CTORS_1ST = NO
-
-# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy
-# of group names into alphabetical order. If set to NO the group names will
-# appear in their defined order.
-# The default value is: NO.
-
-SORT_GROUP_NAMES = NO
-
-# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by
-# fully-qualified names, including namespaces. If set to NO, the class list will
-# be sorted only by class name, not including the namespace part.
-# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
-# Note: This option applies only to the class list, not to the alphabetical
-# list.
-# The default value is: NO.
-
-SORT_BY_SCOPE_NAME = NO
-
-# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper
-# type resolution of all parameters of a function it will reject a match between
-# the prototype and the implementation of a member function even if there is
-# only one candidate or it is obvious which candidate to choose by doing a
-# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still
-# accept a match between prototype and implementation in such cases.
-# The default value is: NO.
-
-STRICT_PROTO_MATCHING = NO
-
-# The GENERATE_TODOLIST tag can be used to enable ( YES) or disable ( NO) the
-# todo list. This list is created by putting \todo commands in the
-# documentation.
-# The default value is: YES.
-
-GENERATE_TODOLIST = YES
-
-# The GENERATE_TESTLIST tag can be used to enable ( YES) or disable ( NO) the
-# test list. This list is created by putting \test commands in the
-# documentation.
-# The default value is: YES.
-
-GENERATE_TESTLIST = YES
-
-# The GENERATE_BUGLIST tag can be used to enable ( YES) or disable ( NO) the bug
-# list. This list is created by putting \bug commands in the documentation.
-# The default value is: YES.
-
-GENERATE_BUGLIST = YES
-
-# The GENERATE_DEPRECATEDLIST tag can be used to enable ( YES) or disable ( NO)
-# the deprecated list. This list is created by putting \deprecated commands in
-# the documentation.
-# The default value is: YES.
-
-GENERATE_DEPRECATEDLIST= YES
-
-# The ENABLED_SECTIONS tag can be used to enable conditional documentation
-# sections, marked by \if <section_label> ... \endif and \cond <section_label>
-# ... \endcond blocks.
-
-ENABLED_SECTIONS =
-
-# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the
-# initial value of a variable or macro / define can have for it to appear in the
-# documentation. If the initializer consists of more lines than specified here
-# it will be hidden. Use a value of 0 to hide initializers completely. The
-# appearance of the value of individual variables and macros / defines can be
-# controlled using \showinitializer or \hideinitializer command in the
-# documentation regardless of this setting.
-# Minimum value: 0, maximum value: 10000, default value: 30.
-
-MAX_INITIALIZER_LINES = 30
-
-# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at
-# the bottom of the documentation of classes and structs. If set to YES the list
-# will mention the files that were used to generate the documentation.
-# The default value is: YES.
-
-SHOW_USED_FILES = YES
-
-# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This
-# will remove the Files entry from the Quick Index and from the Folder Tree View
-# (if specified).
-# The default value is: YES.
-
-SHOW_FILES = YES
-
-# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces
-# page. This will remove the Namespaces entry from the Quick Index and from the
-# Folder Tree View (if specified).
-# The default value is: YES.
-
-SHOW_NAMESPACES = YES
-
-# The FILE_VERSION_FILTER tag can be used to specify a program or script that
-# doxygen should invoke to get the current version for each file (typically from
-# the version control system). Doxygen will invoke the program by executing (via
-# popen()) the command command input-file, where command is the value of the
-# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided
-# by doxygen. Whatever the program writes to standard output is used as the file
-# version. For an example see the documentation.
-
-FILE_VERSION_FILTER =
-
-# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
-# by doxygen. The layout file controls the global structure of the generated
-# output files in an output format independent way. To create the layout file
-# that represents doxygen's defaults, run doxygen with the -l option. You can
-# optionally specify a file name after the option, if omitted DoxygenLayout.xml
-# will be used as the name of the layout file.
-#
-# Note that if you run doxygen from a directory containing a file called
-# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE
-# tag is left empty.
-
-LAYOUT_FILE = @CMAKE_CURRENT_SOURCE_DIR@/DoxygenLayout.xml
-
-# The CITE_BIB_FILES tag can be used to specify one or more bib files containing
-# the reference definitions. This must be a list of .bib files. The .bib
-# extension is automatically appended if omitted. This requires the bibtex tool
-# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info.
-# For LaTeX the style of the bibliography can be controlled using
-# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the
-# search path. Do not use file names with spaces, bibtex cannot handle them. See
-# also \cite for info how to create references.
-
-CITE_BIB_FILES =
-
-#---------------------------------------------------------------------------
-# Configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-
-# The QUIET tag can be used to turn on/off the messages that are generated to
-# standard output by doxygen. If QUIET is set to YES this implies that the
-# messages are off.
-# The default value is: NO.
-
-QUIET = NO
-
-# The WARNINGS tag can be used to turn on/off the warning messages that are
-# generated to standard error ( stderr) by doxygen. If WARNINGS is set to YES
-# this implies that the warnings are on.
-#
-# Tip: Turn warnings on while writing the documentation.
-# The default value is: YES.
-
-WARNINGS = YES
-
-# If the WARN_IF_UNDOCUMENTED tag is set to YES, then doxygen will generate
-# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag
-# will automatically be disabled.
-# The default value is: YES.
-
-WARN_IF_UNDOCUMENTED = YES
-
-# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for
-# potential errors in the documentation, such as not documenting some parameters
-# in a documented function, or documenting parameters that don't exist or using
-# markup commands wrongly.
-# The default value is: YES.
-
-WARN_IF_DOC_ERROR = YES
-
-# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that
-# are documented, but have no documentation for their parameters or return
-# value. If set to NO doxygen will only warn about wrong or incomplete parameter
-# documentation, but not about the absence of documentation.
-# The default value is: NO.
-
-WARN_NO_PARAMDOC = NO
-
-# The WARN_FORMAT tag determines the format of the warning messages that doxygen
-# can produce. The string should contain the $file, $line, and $text tags, which
-# will be replaced by the file and line number from which the warning originated
-# and the warning text. Optionally the format may contain $version, which will
-# be replaced by the version of the file (if it could be obtained via
-# FILE_VERSION_FILTER)
-# The default value is: $file:$line: $text.
-
-WARN_FORMAT = "$file:$line: $text"
-
-# The WARN_LOGFILE tag can be used to specify a file to which warning and error
-# messages should be written. If left blank the output is written to standard
-# error (stderr).
-
-WARN_LOGFILE =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the input files
-#---------------------------------------------------------------------------
-
-# The INPUT tag is used to specify the files and/or directories that contain
-# documented source files. You may enter file names like myfile.cpp or
-# directories like /usr/src/myproject. Separate the files or directories with
-# spaces.
-# Note: If this tag is empty the current directory is searched.
-
-INPUT = @CMAKE_CURRENT_SOURCE_DIR@/api/ \
- @CMAKE_CURRENT_SOURCE_DIR@/api/mraa/ \
- @CMAKE_CURRENT_SOURCE_DIR@/docs/ \
- @CMAKE_CURRENT_SOURCE_DIR@/CONTRIBUTING.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
-# libiconv (or the iconv built into libc) for the transcoding. See the libiconv
-# documentation (see: http://www.gnu.org/software/libiconv) for the list of
-# possible encodings.
-# The default value is: UTF-8.
-
-INPUT_ENCODING = UTF-8
-
-# If the value of the INPUT tag contains directories, you can use the
-# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and
-# *.h) to filter out the source-files in the directories. If left blank the
-# following patterns are tested:*.c, *.cc, *.cxx, *.cpp, *.c++, *.java, *.ii,
-# *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp,
-# *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown,
-# *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf,
-# *.qsf, *.as and *.js.
-
-FILE_PATTERNS = *.c \
- *.cc \
- *.cxx \
- *.cpp \
- *.c++ \
- *.java \
- *.ii \
- *.ixx \
- *.ipp \
- *.i++ \
- *.inl \
- *.idl \
- *.ddl \
- *.odl \
- *.h \
- *.hh \
- *.hxx \
- *.hpp \
- *.h++ \
- *.cs \
- *.d \
- *.php \
- *.php4 \
- *.php5 \
- *.phtml \
- *.inc \
- *.m \
- *.markdown \
- *.md \
- *.mm \
- *.dox \
- *.py \
- *.f90 \
- *.f \
- *.for \
- *.tcl \
- *.vhd \
- *.vhdl \
- *.ucf \
- *.qsf \
- *.as \
- *.js
-
-# The RECURSIVE tag can be used to specify whether or not subdirectories should
-# be searched for input files as well.
-# The default value is: NO.
-
-RECURSIVE = NO
-
-# The EXCLUDE tag can be used to specify files and/or directories that should be
-# excluded from the INPUT source files. This way you can easily exclude a
-# subdirectory from a directory tree whose root is specified with the INPUT tag.
-#
-# Note that relative paths are relative to the directory from which doxygen is
-# run.
-
-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
-# from the input.
-# The default value is: NO.
-
-EXCLUDE_SYMLINKS = NO
-
-# If the value of the INPUT tag contains directories, you can use the
-# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
-# certain files from those directories.
-#
-# Note that the wildcards are matched against the file with absolute path, so to
-# exclude all test directories for example use the pattern */test/*
-
-EXCLUDE_PATTERNS =
-
-# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
-# (namespaces, classes, functions, etc.) that should be excluded from the
-# output. The symbol name can be a fully qualified name, a word, or if the
-# wildcard * is used, a substring. Examples: ANamespace, AClass,
-# AClass::ANamespace, ANamespace::*Test
-#
-# Note that the wildcards are matched against the file with absolute path, so to
-# exclude all test directories use the pattern */test/*
-
-EXCLUDE_SYMBOLS =
-
-# The EXAMPLE_PATH tag can be used to specify one or more files or directories
-# that contain example code fragments that are included (see the \include
-# command).
-
-EXAMPLE_PATH = @CMAKE_CURRENT_SOURCE_DIR@/examples/ \
- @CMAKE_CURRENT_SOURCE_DIR@/examples/c++/ \
- @CMAKE_CURRENT_SOURCE_DIR@/docs/
-
-# If the value of the EXAMPLE_PATH tag contains directories, you can use the
-# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
-# *.h) to filter out the source-files in the directories. If left blank all
-# files are included.
-
-EXAMPLE_PATTERNS = *.cpp *.c
-
-# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
-# searched for input files to be used with the \include or \dontinclude commands
-# irrespective of the value of the RECURSIVE tag.
-# The default value is: NO.
-
-EXAMPLE_RECURSIVE = NO
-
-# The IMAGE_PATH tag can be used to specify one or more files or directories
-# that contain images that are to be included in the documentation (see the
-# \image command).
-
-IMAGE_PATH =
-
-# The INPUT_FILTER tag can be used to specify a program that doxygen should
-# invoke to filter for each input file. Doxygen will invoke the filter program
-# by executing (via popen()) the command:
-#
-# <filter> <input-file>
-#
-# where <filter> is the value of the INPUT_FILTER tag, and <input-file> is the
-# name of an input file. Doxygen will then use the output that the filter
-# program writes to standard output. If FILTER_PATTERNS is specified, this tag
-# will be ignored.
-#
-# Note that the filter must not add or remove lines; it is applied before the
-# code is scanned, but not when the output code is generated. If lines are added
-# or removed, the anchors will not be placed correctly.
-
-INPUT_FILTER =
-
-# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
-# basis. Doxygen will compare the file name with each pattern and apply the
-# filter if there is a match. The filters are a list of the form: pattern=filter
-# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how
-# filters are used. If the FILTER_PATTERNS tag is empty or if none of the
-# patterns match the file name, INPUT_FILTER is applied.
-
-FILTER_PATTERNS =
-
-# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
-# INPUT_FILTER ) will also be used to filter the input files that are used for
-# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES).
-# The default value is: NO.
-
-FILTER_SOURCE_FILES = NO
-
-# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file
-# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and
-# it is also possible to disable source filtering for a specific pattern using
-# *.ext= (so without naming a filter).
-# This tag requires that the tag FILTER_SOURCE_FILES is set to YES.
-
-FILTER_SOURCE_PATTERNS =
-
-# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that
-# is part of the input, its contents will be placed on the main page
-# (index.html). This can be useful if you have a project on for instance GitHub
-# and want to reuse the introduction page also for the doxygen output.
-
-USE_MDFILE_AS_MAINPAGE = @CMAKE_CURRENT_SOURCE_DIR@/docs/index.md
-
-#---------------------------------------------------------------------------
-# Configuration options related to source browsing
-#---------------------------------------------------------------------------
-
-# If the SOURCE_BROWSER tag is set to YES then a list of source files will be
-# generated. Documented entities will be cross-referenced with these sources.
-#
-# Note: To get rid of all source code in the generated output, make sure that
-# also VERBATIM_HEADERS is set to NO.
-# The default value is: NO.
-
-SOURCE_BROWSER = NO
-
-# Setting the INLINE_SOURCES tag to YES will include the body of functions,
-# classes and enums directly into the documentation.
-# The default value is: NO.
-
-INLINE_SOURCES = NO
-
-# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any
-# special comment blocks from generated source code fragments. Normal C, C++ and
-# Fortran comments will always remain visible.
-# The default value is: YES.
-
-STRIP_CODE_COMMENTS = YES
-
-# If the REFERENCED_BY_RELATION tag is set to YES then for each documented
-# function all documented functions referencing it will be listed.
-# The default value is: NO.
-
-REFERENCED_BY_RELATION = NO
-
-# If the REFERENCES_RELATION tag is set to YES then for each documented function
-# all documented entities called/used by that function will be listed.
-# The default value is: NO.
-
-REFERENCES_RELATION = NO
-
-# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set
-# to YES, then the hyperlinks from functions in REFERENCES_RELATION and
-# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will
-# link to the documentation.
-# The default value is: YES.
-
-REFERENCES_LINK_SOURCE = YES
-
-# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the
-# source code will show a tooltip with additional information such as prototype,
-# brief description and links to the definition and documentation. Since this
-# will make the HTML file larger and loading of large files a bit slower, you
-# can opt to disable this feature.
-# The default value is: YES.
-# This tag requires that the tag SOURCE_BROWSER is set to YES.
-
-SOURCE_TOOLTIPS = YES
-
-# If the USE_HTAGS tag is set to YES then the references to source code will
-# point to the HTML generated by the htags(1) tool instead of doxygen built-in
-# source browser. The htags tool is part of GNU's global source tagging system
-# (see http://www.gnu.org/software/global/global.html). You will need version
-# 4.8.6 or higher.
-#
-# To use it do the following:
-# - Install the latest version of global
-# - Enable SOURCE_BROWSER and USE_HTAGS in the config file
-# - Make sure the INPUT points to the root of the source tree
-# - Run doxygen as normal
-#
-# Doxygen will invoke htags (and that will in turn invoke gtags), so these
-# tools must be available from the command line (i.e. in the search path).
-#
-# The result: instead of the source browser generated by doxygen, the links to
-# source code will now point to the output of htags.
-# The default value is: NO.
-# This tag requires that the tag SOURCE_BROWSER is set to YES.
-
-USE_HTAGS = NO
-
-# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a
-# verbatim copy of the header file for each class for which an include is
-# specified. Set to NO to disable this.
-# See also: Section \class.
-# The default value is: YES.
-
-VERBATIM_HEADERS = YES
-
-#---------------------------------------------------------------------------
-# Configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-
-# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all
-# compounds will be generated. Enable this if the project contains a lot of
-# classes, structs, unions or interfaces.
-# The default value is: YES.
-
-ALPHABETICAL_INDEX = YES
-
-# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in
-# which the alphabetical index list will be split.
-# Minimum value: 1, maximum value: 20, default value: 5.
-# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
-
-COLS_IN_ALPHA_INDEX = 5
-
-# In case all classes in a project start with a common prefix, all classes will
-# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag
-# can be used to specify a prefix (or a list of prefixes) that should be ignored
-# while generating the index headers.
-# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
-
-IGNORE_PREFIX =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the HTML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_HTML tag is set to YES doxygen will generate HTML output
-# The default value is: YES.
-
-GENERATE_HTML = YES
-
-# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a
-# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
-# it.
-# The default directory is: html.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_OUTPUT = html
-
-# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each
-# generated HTML page (for example: .htm, .php, .asp).
-# The default value is: .html.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_FILE_EXTENSION = .html
-
-# The HTML_HEADER tag can be used to specify a user-defined HTML header file for
-# each generated HTML page. If the tag is left blank doxygen will generate a
-# standard header.
-#
-# To get valid HTML the header file that includes any scripts and style sheets
-# that doxygen needs, which is dependent on the configuration options used (e.g.
-# the setting GENERATE_TREEVIEW). It is highly recommended to start with a
-# default header using
-# doxygen -w html new_header.html new_footer.html new_stylesheet.css
-# YourConfigFile
-# and then modify the file new_header.html. See also section "Doxygen usage"
-# for information on how to generate the default header that doxygen normally
-# uses.
-# Note: The header is subject to change so you typically have to regenerate the
-# default header when upgrading to a newer version of doxygen. For a description
-# of the possible markers and block names see the documentation.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_HEADER =
-
-# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each
-# generated HTML page. If the tag is left blank doxygen will generate a standard
-# footer. See HTML_HEADER for more information on how to generate a default
-# footer and what special commands can be used inside the footer. See also
-# section "Doxygen usage" for information on how to generate the default footer
-# that doxygen normally uses.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_FOOTER =
-
-# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style
-# sheet that is used by each HTML page. It can be used to fine-tune the look of
-# the HTML output. If left blank doxygen will generate a default style sheet.
-# See also section "Doxygen usage" for information on how to generate the style
-# sheet that doxygen normally uses.
-# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as
-# it is more robust and this tag (HTML_STYLESHEET) will in the future become
-# obsolete.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_STYLESHEET =
-
-# The HTML_EXTRA_STYLESHEET tag can be used to specify an additional user-
-# defined cascading style sheet that is included after the standard style sheets
-# created by doxygen. Using this option one can overrule certain style aspects.
-# This is preferred over using HTML_STYLESHEET since it does not replace the
-# standard style sheet and is therefor more robust against future updates.
-# Doxygen will copy the style sheet file to the output directory. For an example
-# see the documentation.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_EXTRA_STYLESHEET =
-
-# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
-# other source files which should be copied to the HTML output directory. Note
-# that these files will be copied to the base HTML output directory. Use the
-# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these
-# files. In the HTML_STYLESHEET file, use the file name only. Also note that the
-# files will be copied as-is; there are no commands or markers available.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_EXTRA_FILES =
-
-# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
-# will adjust the colors in the stylesheet and background images according to
-# this color. Hue is specified as an angle on a colorwheel, see
-# http://en.wikipedia.org/wiki/Hue for more information. For instance the value
-# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300
-# purple, and 360 is red again.
-# Minimum value: 0, maximum value: 359, default value: 220.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_COLORSTYLE_HUE = 220
-
-# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors
-# in the HTML output. For a value of 0 the output will use grayscales only. A
-# value of 255 will produce the most vivid colors.
-# Minimum value: 0, maximum value: 255, default value: 100.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_COLORSTYLE_SAT = 100
-
-# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the
-# luminance component of the colors in the HTML output. Values below 100
-# gradually make the output lighter, whereas values above 100 make the output
-# darker. The value divided by 100 is the actual gamma applied, so 80 represents
-# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not
-# change the gamma.
-# Minimum value: 40, maximum value: 240, default value: 80.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_COLORSTYLE_GAMMA = 80
-
-# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
-# page will contain the date and time when the page was generated. Setting this
-# to NO can help when comparing the output of multiple runs.
-# The default value is: YES.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_TIMESTAMP = YES
-
-# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
-# documentation will contain sections that can be hidden and shown after the
-# page has loaded.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_DYNAMIC_SECTIONS = NO
-
-# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries
-# shown in the various tree structured indices initially; the user can expand
-# and collapse entries dynamically later on. Doxygen will expand the tree to
-# such a level that at most the specified number of entries are visible (unless
-# a fully collapsed tree already exceeds this amount). So setting the number of
-# entries 1 will produce a full collapsed tree by default. 0 is a special value
-# representing an infinite number of entries and will result in a full expanded
-# tree by default.
-# Minimum value: 0, maximum value: 9999, default value: 100.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_INDEX_NUM_ENTRIES = 100
-
-# If the GENERATE_DOCSET tag is set to YES, additional index files will be
-# generated that can be used as input for Apple's Xcode 3 integrated development
-# environment (see: http://developer.apple.com/tools/xcode/), introduced with
-# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a
-# Makefile in the HTML output directory. Running make will produce the docset in
-# that directory and running make install will install the docset in
-# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at
-# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html
-# for more information.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-GENERATE_DOCSET = NO
-
-# This tag determines the name of the docset feed. A documentation feed provides
-# an umbrella under which multiple documentation sets from a single provider
-# (such as a company or product suite) can be grouped.
-# The default value is: Doxygen generated docs.
-# This tag requires that the tag GENERATE_DOCSET is set to YES.
-
-DOCSET_FEEDNAME = "Doxygen generated docs"
-
-# This tag specifies a string that should uniquely identify the documentation
-# set bundle. This should be a reverse domain-name style string, e.g.
-# com.mycompany.MyDocSet. Doxygen will append .docset to the name.
-# The default value is: org.doxygen.Project.
-# This tag requires that the tag GENERATE_DOCSET is set to YES.
-
-DOCSET_BUNDLE_ID = org.doxygen.Project
-
-# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify
-# the documentation publisher. This should be a reverse domain-name style
-# string, e.g. com.mycompany.MyDocSet.documentation.
-# The default value is: org.doxygen.Publisher.
-# This tag requires that the tag GENERATE_DOCSET is set to YES.
-
-DOCSET_PUBLISHER_ID = org.doxygen.Publisher
-
-# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher.
-# The default value is: Publisher.
-# This tag requires that the tag GENERATE_DOCSET is set to YES.
-
-DOCSET_PUBLISHER_NAME = Publisher
-
-# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three
-# additional HTML index files: index.hhp, index.hhc, and index.hhk. The
-# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop
-# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on
-# Windows.
-#
-# The HTML Help Workshop contains a compiler that can convert all HTML output
-# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML
-# files are now used as the Windows 98 help format, and will replace the old
-# Windows help format (.hlp) on all Windows platforms in the future. Compressed
-# HTML files also contain an index, a table of contents, and you can search for
-# words in the documentation. The HTML workshop also contains a viewer for
-# compressed HTML files.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-GENERATE_HTMLHELP = NO
-
-# The CHM_FILE tag can be used to specify the file name of the resulting .chm
-# file. You can add a path in front of the file if the result should not be
-# written to the html output directory.
-# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
-
-CHM_FILE =
-
-# The HHC_LOCATION tag can be used to specify the location (absolute path
-# including file name) of the HTML help compiler ( hhc.exe). If non-empty
-# doxygen will try to run the HTML help compiler on the generated index.hhp.
-# The file has to be specified with full path.
-# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
-
-HHC_LOCATION =
-
-# The GENERATE_CHI flag controls if a separate .chi index file is generated (
-# YES) or that it should be included in the master .chm file ( NO).
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
-
-GENERATE_CHI = NO
-
-# The CHM_INDEX_ENCODING is used to encode HtmlHelp index ( hhk), content ( hhc)
-# and project file content.
-# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
-
-CHM_INDEX_ENCODING =
-
-# The BINARY_TOC flag controls whether a binary table of contents is generated (
-# YES) or a normal table of contents ( NO) in the .chm file.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
-
-BINARY_TOC = NO
-
-# The TOC_EXPAND flag can be set to YES to add extra items for group members to
-# the table of contents of the HTML help documentation and to the tree view.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
-
-TOC_EXPAND = NO
-
-# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
-# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that
-# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help
-# (.qch) of the generated HTML documentation.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-GENERATE_QHP = NO
-
-# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify
-# the file name of the resulting .qch file. The path specified is relative to
-# the HTML output folder.
-# This tag requires that the tag GENERATE_QHP is set to YES.
-
-QCH_FILE =
-
-# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help
-# Project output. For more information please see Qt Help Project / Namespace
-# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace).
-# The default value is: org.doxygen.Project.
-# This tag requires that the tag GENERATE_QHP is set to YES.
-
-QHP_NAMESPACE = org.doxygen.Project
-
-# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt
-# Help Project output. For more information please see Qt Help Project / Virtual
-# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual-
-# folders).
-# The default value is: doc.
-# This tag requires that the tag GENERATE_QHP is set to YES.
-
-QHP_VIRTUAL_FOLDER = doc
-
-# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom
-# filter to add. For more information please see Qt Help Project / Custom
-# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
-# filters).
-# This tag requires that the tag GENERATE_QHP is set to YES.
-
-QHP_CUST_FILTER_NAME =
-
-# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the
-# custom filter to add. For more information please see Qt Help Project / Custom
-# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
-# filters).
-# This tag requires that the tag GENERATE_QHP is set to YES.
-
-QHP_CUST_FILTER_ATTRS =
-
-# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
-# project's filter section matches. Qt Help Project / Filter Attributes (see:
-# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes).
-# This tag requires that the tag GENERATE_QHP is set to YES.
-
-QHP_SECT_FILTER_ATTRS =
-
-# The QHG_LOCATION tag can be used to specify the location of Qt's
-# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the
-# generated .qhp file.
-# This tag requires that the tag GENERATE_QHP is set to YES.
-
-QHG_LOCATION =
-
-# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be
-# generated, together with the HTML files, they form an Eclipse help plugin. To
-# install this plugin and make it available under the help contents menu in
-# Eclipse, the contents of the directory containing the HTML and XML files needs
-# to be copied into the plugins directory of eclipse. The name of the directory
-# within the plugins directory should be the same as the ECLIPSE_DOC_ID value.
-# After copying Eclipse needs to be restarted before the help appears.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-GENERATE_ECLIPSEHELP = NO
-
-# A unique identifier for the Eclipse help plugin. When installing the plugin
-# the directory name containing the HTML and XML files should also have this
-# name. Each documentation set should have its own identifier.
-# The default value is: org.doxygen.Project.
-# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES.
-
-ECLIPSE_DOC_ID = org.doxygen.Project
-
-# If you want full control over the layout of the generated HTML pages it might
-# be necessary to disable the index and replace it with your own. The
-# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top
-# of each HTML page. A value of NO enables the index and the value YES disables
-# it. Since the tabs in the index contain the same information as the navigation
-# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-DISABLE_INDEX = NO
-
-# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
-# structure should be generated to display hierarchical information. If the tag
-# value is set to YES, a side panel will be generated containing a tree-like
-# index structure (just like the one that is generated for HTML Help). For this
-# to work a browser that supports JavaScript, DHTML, CSS and frames is required
-# (i.e. any modern browser). Windows users are probably better off using the
-# HTML help feature. Via custom stylesheets (see HTML_EXTRA_STYLESHEET) one can
-# further fine-tune the look of the index. As an example, the default style
-# sheet generated by doxygen has an example that shows how to put an image at
-# the root of the tree instead of the PROJECT_NAME. Since the tree basically has
-# the same information as the tab index, you could consider setting
-# DISABLE_INDEX to YES when enabling this option.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-GENERATE_TREEVIEW = NO
-
-# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that
-# doxygen will group on one line in the generated HTML documentation.
-#
-# Note that a value of 0 will completely suppress the enum values from appearing
-# in the overview section.
-# Minimum value: 0, maximum value: 20, default value: 4.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-ENUM_VALUES_PER_LINE = 4
-
-# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used
-# to set the initial width (in pixels) of the frame in which the tree is shown.
-# Minimum value: 0, maximum value: 1500, default value: 250.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-TREEVIEW_WIDTH = 250
-
-# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open links to
-# external symbols imported via tag files in a separate window.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-EXT_LINKS_IN_WINDOW = NO
-
-# Use this tag to change the font size of LaTeX formulas included as images in
-# the HTML documentation. When you change the font size after a successful
-# doxygen run you need to manually remove any form_*.png images from the HTML
-# output directory to force them to be regenerated.
-# Minimum value: 8, maximum value: 50, default value: 10.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-FORMULA_FONTSIZE = 10
-
-# Use the FORMULA_TRANPARENT tag to determine whether or not the images
-# generated for formulas are transparent PNGs. Transparent PNGs are not
-# supported properly for IE 6.0, but are supported on all modern browsers.
-#
-# Note that when changing this option you need to delete any form_*.png files in
-# the HTML output directory before the changes have effect.
-# The default value is: YES.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-FORMULA_TRANSPARENT = YES
-
-# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see
-# http://www.mathjax.org) which uses client side Javascript for the rendering
-# instead of using prerendered bitmaps. Use this if you do not have LaTeX
-# installed or if you want to formulas look prettier in the HTML output. When
-# enabled you may also need to install MathJax separately and configure the path
-# to it using the MATHJAX_RELPATH option.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-USE_MATHJAX = NO
-
-# When MathJax is enabled you can set the default output format to be used for
-# the MathJax output. See the MathJax site (see:
-# http://docs.mathjax.org/en/latest/output.html) for more details.
-# Possible values are: HTML-CSS (which is slower, but has the best
-# compatibility), NativeMML (i.e. MathML) and SVG.
-# The default value is: HTML-CSS.
-# This tag requires that the tag USE_MATHJAX is set to YES.
-
-MATHJAX_FORMAT = HTML-CSS
-
-# When MathJax is enabled you need to specify the location relative to the HTML
-# output directory using the MATHJAX_RELPATH option. The destination directory
-# should contain the MathJax.js script. For instance, if the mathjax directory
-# is located at the same level as the HTML output directory, then
-# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax
-# Content Delivery Network so you can quickly see the result without installing
-# MathJax. However, it is strongly recommended to install a local copy of
-# MathJax from http://www.mathjax.org before deployment.
-# The default value is: http://cdn.mathjax.org/mathjax/latest.
-# This tag requires that the tag USE_MATHJAX is set to YES.
-
-MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest
-
-# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax
-# extension names that should be enabled during MathJax rendering. For example
-# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols
-# This tag requires that the tag USE_MATHJAX is set to YES.
-
-MATHJAX_EXTENSIONS =
-
-# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces
-# of code that will be used on startup of the MathJax code. See the MathJax site
-# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an
-# example see the documentation.
-# This tag requires that the tag USE_MATHJAX is set to YES.
-
-MATHJAX_CODEFILE =
-
-# When the SEARCHENGINE tag is enabled doxygen will generate a search box for
-# the HTML output. The underlying search engine uses javascript and DHTML and
-# should work on any modern browser. Note that when using HTML help
-# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET)
-# there is already a search function so this one should typically be disabled.
-# For large projects the javascript based search engine can be slow, then
-# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to
-# search using the keyboard; to jump to the search box use <access key> + S
-# (what the <access key> is depends on the OS and browser, but it is typically
-# <CTRL>, <ALT>/<option>, or both). Inside the search box use the <cursor down
-# key> to jump into the search results window, the results can be navigated
-# using the <cursor keys>. Press <Enter> to select an item or <escape> to cancel
-# the search. The filter options can be selected when the cursor is inside the
-# search box by pressing <Shift>+<cursor down>. Also here use the <cursor keys>
-# to select a filter and <Enter> or <escape> to activate or cancel the filter
-# option.
-# The default value is: YES.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-SEARCHENGINE = YES
-
-# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
-# implemented using a web server instead of a web client using Javascript. There
-# are two flavours of web server based searching depending on the
-# EXTERNAL_SEARCH setting. When disabled, doxygen will generate a PHP script for
-# searching and an index file used by the script. When EXTERNAL_SEARCH is
-# enabled the indexing and searching needs to be provided by external tools. See
-# the section "External Indexing and Searching" for details.
-# The default value is: NO.
-# This tag requires that the tag SEARCHENGINE is set to YES.
-
-SERVER_BASED_SEARCH = NO
-
-# When EXTERNAL_SEARCH tag is enabled doxygen will no longer generate the PHP
-# script for searching. Instead the search results are written to an XML file
-# which needs to be processed by an external indexer. Doxygen will invoke an
-# external search engine pointed to by the SEARCHENGINE_URL option to obtain the
-# search results.
-#
-# Doxygen ships with an example indexer ( doxyindexer) and search engine
-# (doxysearch.cgi) which are based on the open source search engine library
-# Xapian (see: http://xapian.org/).
-#
-# See the section "External Indexing and Searching" for details.
-# The default value is: NO.
-# This tag requires that the tag SEARCHENGINE is set to YES.
-
-EXTERNAL_SEARCH = NO
-
-# The SEARCHENGINE_URL should point to a search engine hosted by a web server
-# which will return the search results when EXTERNAL_SEARCH is enabled.
-#
-# Doxygen ships with an example indexer ( doxyindexer) and search engine
-# (doxysearch.cgi) which are based on the open source search engine library
-# Xapian (see: http://xapian.org/). See the section "External Indexing and
-# Searching" for details.
-# This tag requires that the tag SEARCHENGINE is set to YES.
-
-SEARCHENGINE_URL =
-
-# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed
-# search data is written to a file for indexing by an external tool. With the
-# SEARCHDATA_FILE tag the name of this file can be specified.
-# The default file is: searchdata.xml.
-# This tag requires that the tag SEARCHENGINE is set to YES.
-
-SEARCHDATA_FILE = searchdata.xml
-
-# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the
-# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is
-# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple
-# projects and redirect the results back to the right project.
-# This tag requires that the tag SEARCHENGINE is set to YES.
-
-EXTERNAL_SEARCH_ID =
-
-# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen
-# projects other than the one defined by this configuration file, but that are
-# all added to the same external search index. Each project needs to have a
-# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id of
-# to a relative location where the documentation can be found. The format is:
-# EXTRA_SEARCH_MAPPINGS = tagname1=loc1 tagname2=loc2 ...
-# This tag requires that the tag SEARCHENGINE is set to YES.
-
-EXTRA_SEARCH_MAPPINGS =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_LATEX tag is set to YES doxygen will generate LaTeX output.
-# The default value is: YES.
-
-GENERATE_LATEX = YES
-
-# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a
-# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
-# it.
-# The default directory is: latex.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_OUTPUT = latex
-
-# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
-# invoked.
-#
-# Note that when enabling USE_PDFLATEX this option is only used for generating
-# bitmaps for formulas in the HTML output, but not in the Makefile that is
-# written to the output directory.
-# The default file is: latex.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_CMD_NAME = latex
-
-# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to generate
-# index for LaTeX.
-# The default file is: makeindex.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-MAKEINDEX_CMD_NAME = makeindex
-
-# If the COMPACT_LATEX tag is set to YES doxygen generates more compact LaTeX
-# documents. This may be useful for small projects and may help to save some
-# trees in general.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-COMPACT_LATEX = NO
-
-# The PAPER_TYPE tag can be used to set the paper type that is used by the
-# printer.
-# Possible values are: a4 (210 x 297 mm), letter (8.5 x 11 inches), legal (8.5 x
-# 14 inches) and executive (7.25 x 10.5 inches).
-# The default value is: a4.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-PAPER_TYPE = a4
-
-# The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names
-# that should be included in the LaTeX output. To get the times font for
-# instance you can specify
-# EXTRA_PACKAGES=times
-# If left blank no extra packages will be included.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-EXTRA_PACKAGES =
-
-# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the
-# generated LaTeX document. The header should contain everything until the first
-# chapter. If it is left blank doxygen will generate a standard header. See
-# section "Doxygen usage" for information on how to let doxygen write the
-# default header to a separate file.
-#
-# Note: Only use a user-defined header if you know what you are doing! The
-# following commands have a special meaning inside the header: $title,
-# $datetime, $date, $doxygenversion, $projectname, $projectnumber. Doxygen will
-# replace them by respectively the title of the page, the current date and time,
-# only the current date, the version number of doxygen, the project name (see
-# PROJECT_NAME), or the project number (see PROJECT_NUMBER).
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_HEADER =
-
-# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the
-# generated LaTeX document. The footer should contain everything after the last
-# chapter. If it is left blank doxygen will generate a standard footer.
-#
-# Note: Only use a user-defined footer if you know what you are doing!
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_FOOTER =
-
-# The LATEX_EXTRA_FILES tag can be used to specify one or more extra images or
-# other source files which should be copied to the LATEX_OUTPUT output
-# directory. Note that the files will be copied as-is; there are no commands or
-# markers available.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_EXTRA_FILES =
-
-# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated is
-# prepared for conversion to PDF (using ps2pdf or pdflatex). The PDF file will
-# contain links (just like the HTML output) instead of page references. This
-# makes the output suitable for online browsing using a PDF viewer.
-# The default value is: YES.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-PDF_HYPERLINKS = YES
-
-# If the LATEX_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate
-# the PDF file directly from the LaTeX files. Set this option to YES to get a
-# higher quality PDF documentation.
-# The default value is: YES.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-USE_PDFLATEX = YES
-
-# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode
-# command to the generated LaTeX files. This will instruct LaTeX to keep running
-# if errors occur, instead of asking the user for help. This option is also used
-# when generating formulas in HTML.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_BATCHMODE = NO
-
-# If the LATEX_HIDE_INDICES tag is set to YES then doxygen will not include the
-# index chapters (such as File Index, Compound Index, etc.) in the output.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_HIDE_INDICES = NO
-
-# If the LATEX_SOURCE_CODE tag is set to YES then doxygen will include source
-# code with syntax highlighting in the LaTeX output.
-#
-# Note that which sources are shown also depends on other settings such as
-# SOURCE_BROWSER.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_SOURCE_CODE = NO
-
-# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
-# bibliography, e.g. plainnat, or ieeetr. See
-# http://en.wikipedia.org/wiki/BibTeX and \cite for more info.
-# The default value is: plain.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_BIB_STYLE = plain
-
-#---------------------------------------------------------------------------
-# Configuration options related to the RTF output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_RTF tag is set to YES doxygen will generate RTF output. The
-# RTF output is optimized for Word 97 and may not look too pretty with other RTF
-# readers/editors.
-# The default value is: NO.
-
-GENERATE_RTF = NO
-
-# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. If a
-# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
-# it.
-# The default directory is: rtf.
-# This tag requires that the tag GENERATE_RTF is set to YES.
-
-RTF_OUTPUT = rtf
-
-# If the COMPACT_RTF tag is set to YES doxygen generates more compact RTF
-# documents. This may be useful for small projects and may help to save some
-# trees in general.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_RTF is set to YES.
-
-COMPACT_RTF = NO
-
-# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated will
-# contain hyperlink fields. The RTF file will contain links (just like the HTML
-# output) instead of page references. This makes the output suitable for online
-# browsing using Word or some other Word compatible readers that support those
-# fields.
-#
-# Note: WordPad (write) and others do not support links.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_RTF is set to YES.
-
-RTF_HYPERLINKS = NO
-
-# Load stylesheet definitions from file. Syntax is similar to doxygen's config
-# file, i.e. a series of assignments. You only have to provide replacements,
-# missing definitions are set to their default value.
-#
-# See also section "Doxygen usage" for information on how to generate the
-# default style sheet that doxygen normally uses.
-# This tag requires that the tag GENERATE_RTF is set to YES.
-
-RTF_STYLESHEET_FILE =
-
-# Set optional variables used in the generation of an RTF document. Syntax is
-# similar to doxygen's config file. A template extensions file can be generated
-# using doxygen -e rtf extensionFile.
-# This tag requires that the tag GENERATE_RTF is set to YES.
-
-RTF_EXTENSIONS_FILE =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the man page output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_MAN tag is set to YES doxygen will generate man pages for
-# classes and files.
-# The default value is: NO.
-
-GENERATE_MAN = NO
-
-# The MAN_OUTPUT tag is used to specify where the man pages will be put. If a
-# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
-# it. A directory man3 will be created inside the directory specified by
-# MAN_OUTPUT.
-# The default directory is: man.
-# This tag requires that the tag GENERATE_MAN is set to YES.
-
-MAN_OUTPUT = man
-
-# The MAN_EXTENSION tag determines the extension that is added to the generated
-# man pages. In case the manual section does not start with a number, the number
-# 3 is prepended. The dot (.) at the beginning of the MAN_EXTENSION tag is
-# optional.
-# The default value is: .3.
-# This tag requires that the tag GENERATE_MAN is set to YES.
-
-MAN_EXTENSION = .3
-
-# If the MAN_LINKS tag is set to YES and doxygen generates man output, then it
-# will generate one additional man file for each entity documented in the real
-# man page(s). These additional files only source the real man page, but without
-# them the man command would be unable to find the correct page.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_MAN is set to YES.
-
-MAN_LINKS = NO
-
-#---------------------------------------------------------------------------
-# Configuration options related to the XML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_XML tag is set to YES doxygen will generate an XML file that
-# captures the structure of the code including all documentation.
-# The default value is: NO.
-
-GENERATE_XML = YES
-
-# The XML_OUTPUT tag is used to specify where the XML pages will be put. If a
-# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
-# it.
-# The default directory is: xml.
-# This tag requires that the tag GENERATE_XML is set to YES.
-
-XML_OUTPUT = xml
-
-# 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
-# of the XML output.
-# The default value is: YES.
-# This tag requires that the tag GENERATE_XML is set to YES.
-
-XML_PROGRAMLISTING = YES
-
-#---------------------------------------------------------------------------
-# Configuration options related to the DOCBOOK output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_DOCBOOK tag is set to YES doxygen will generate Docbook files
-# that can be used to generate PDF.
-# The default value is: NO.
-
-GENERATE_DOCBOOK = NO
-
-# The DOCBOOK_OUTPUT tag is used to specify where the Docbook pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be put in
-# front of it.
-# The default directory is: docbook.
-# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
-
-DOCBOOK_OUTPUT = docbook
-
-#---------------------------------------------------------------------------
-# Configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_AUTOGEN_DEF tag is set to YES doxygen will generate an AutoGen
-# Definitions (see http://autogen.sf.net) file that captures the structure of
-# the code including all documentation. Note that this feature is still
-# experimental and incomplete at the moment.
-# The default value is: NO.
-
-GENERATE_AUTOGEN_DEF = NO
-
-#---------------------------------------------------------------------------
-# Configuration options related to the Perl module output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_PERLMOD tag is set to YES doxygen will generate a Perl module
-# file that captures the structure of the code including all documentation.
-#
-# Note that this feature is still experimental and incomplete at the moment.
-# The default value is: NO.
-
-GENERATE_PERLMOD = NO
-
-# If the PERLMOD_LATEX tag is set to YES doxygen will generate the necessary
-# Makefile rules, Perl scripts and LaTeX code to be able to generate PDF and DVI
-# output from the Perl module output.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_PERLMOD is set to YES.
-
-PERLMOD_LATEX = NO
-
-# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be nicely
-# formatted so it can be parsed by a human reader. This is useful if you want to
-# understand what is going on. On the other hand, if this tag is set to NO the
-# size of the Perl module output will be much smaller and Perl will parse it
-# just the same.
-# The default value is: YES.
-# This tag requires that the tag GENERATE_PERLMOD is set to YES.
-
-PERLMOD_PRETTY = YES
-
-# The names of the make variables in the generated doxyrules.make file are
-# prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. This is useful
-# so different doxyrules.make files included by the same Makefile don't
-# overwrite each other's variables.
-# This tag requires that the tag GENERATE_PERLMOD is set to YES.
-
-PERLMOD_MAKEVAR_PREFIX =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-
-# If the ENABLE_PREPROCESSING tag is set to YES doxygen will evaluate all
-# C-preprocessor directives found in the sources and include files.
-# The default value is: YES.
-
-ENABLE_PREPROCESSING = YES
-
-# If the MACRO_EXPANSION tag is set to YES doxygen will expand all macro names
-# in the source code. If set to NO only conditional compilation will be
-# performed. Macro expansion can be done in a controlled way by setting
-# EXPAND_ONLY_PREDEF to YES.
-# The default value is: NO.
-# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-
-MACRO_EXPANSION = NO
-
-# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then
-# the macro expansion is limited to the macros specified with the PREDEFINED and
-# EXPAND_AS_DEFINED tags.
-# The default value is: NO.
-# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-
-EXPAND_ONLY_PREDEF = NO
-
-# If the SEARCH_INCLUDES tag is set to YES the includes files in the
-# INCLUDE_PATH will be searched if a #include is found.
-# The default value is: YES.
-# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-
-SEARCH_INCLUDES = YES
-
-# The INCLUDE_PATH tag can be used to specify one or more directories that
-# contain include files that are not input files but should be processed by the
-# preprocessor.
-# This tag requires that the tag SEARCH_INCLUDES is set to YES.
-
-INCLUDE_PATH =
-
-# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
-# patterns (like *.h and *.hpp) to filter out the header-files in the
-# directories. If left blank, the patterns specified with FILE_PATTERNS will be
-# used.
-# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-
-INCLUDE_FILE_PATTERNS =
-
-# The PREDEFINED tag can be used to specify one or more macro names that are
-# defined before the preprocessor is started (similar to the -D option of e.g.
-# gcc). The argument of the tag is a list of macros of the form: name or
-# name=definition (no spaces). If the definition and the "=" are omitted, "=1"
-# is assumed. To prevent a macro definition from being undefined via #undef or
-# recursively expanded use the := operator instead of the = operator.
-# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-
-PREDEFINED =
-
-# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
-# tag can be used to specify a list of macro names that should be expanded. The
-# macro definition that is found in the sources will be used. Use the PREDEFINED
-# tag if you want to use a different macro definition that overrules the
-# definition found in the source code.
-# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-
-EXPAND_AS_DEFINED =
-
-# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
-# remove all refrences to function-like macros that are alone on a line, have an
-# all uppercase name, and do not end with a semicolon. Such function macros are
-# typically used for boiler-plate code, and will confuse the parser if not
-# removed.
-# The default value is: YES.
-# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-
-SKIP_FUNCTION_MACROS = YES
-
-#---------------------------------------------------------------------------
-# Configuration options related to external references
-#---------------------------------------------------------------------------
-
-# The TAGFILES tag can be used to specify one or more tag files. For each tag
-# file the location of the external documentation should be added. The format of
-# a tag file without this location is as follows:
-# TAGFILES = file1 file2 ...
-# Adding location for the tag files is done as follows:
-# TAGFILES = file1=loc1 "file2 = loc2" ...
-# where loc1 and loc2 can be relative or absolute paths or URLs. See the
-# section "Linking to external documentation" for more information about the use
-# of tag files.
-# Note: Each tag file must have an unique name (where the name does NOT include
-# the path). If a tag file is not located in the directory in which doxygen is
-# run, you must also specify the path to the tagfile here.
-
-TAGFILES =
-
-# When a file name is specified after GENERATE_TAGFILE, doxygen will create a
-# tag file that is based on the input files it reads. See section "Linking to
-# external documentation" for more information about the usage of tag files.
-
-GENERATE_TAGFILE =
-
-# If the ALLEXTERNALS tag is set to YES all external class will be listed in the
-# class index. If set to NO only the inherited external classes will be listed.
-# The default value is: NO.
-
-ALLEXTERNALS = NO
-
-# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed in
-# the modules index. If set to NO, only the current project's groups will be
-# listed.
-# The default value is: YES.
-
-EXTERNAL_GROUPS = YES
-
-# If the EXTERNAL_PAGES tag is set to YES all external pages will be listed in
-# the related pages index. If set to NO, only the current project's pages will
-# be listed.
-# The default value is: YES.
-
-EXTERNAL_PAGES = YES
-
-# The PERL_PATH should be the absolute path and name of the perl script
-# interpreter (i.e. the result of 'which perl').
-# The default file (with absolute path) is: /usr/bin/perl.
-
-PERL_PATH = /usr/bin/perl
-
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-
-# If the CLASS_DIAGRAMS tag is set to YES doxygen will generate a class diagram
-# (in HTML and LaTeX) for classes with base or super classes. Setting the tag to
-# NO turns the diagrams off. Note that this option also works with HAVE_DOT
-# disabled, but it is recommended to install and use dot, since it yields more
-# powerful graphs.
-# The default value is: YES.
-
-CLASS_DIAGRAMS = NO
-
-# You can define message sequence charts within doxygen comments using the \msc
-# command. Doxygen will then run the mscgen tool (see:
-# http://www.mcternan.me.uk/mscgen/)) to produce the chart and insert it in the
-# documentation. The MSCGEN_PATH tag allows you to specify the directory where
-# the mscgen tool resides. If left empty the tool is assumed to be found in the
-# default search path.
-
-MSCGEN_PATH =
-
-# You can include diagrams made with dia in doxygen documentation. Doxygen will
-# then run dia to produce the diagram and insert it in the documentation. The
-# DIA_PATH tag allows you to specify the directory where the dia binary resides.
-# If left empty dia is assumed to be found in the default search path.
-
-DIA_PATH =
-
-# If set to YES, the inheritance and collaboration graphs will hide inheritance
-# and usage relations if the target is undocumented or is not a class.
-# The default value is: YES.
-
-HIDE_UNDOC_RELATIONS = YES
-
-# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
-# available from the path. This tool is part of Graphviz (see:
-# http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent
-# Bell Labs. The other options in this section have no effect if this option is
-# set to NO
-# The default value is: NO.
-
-HAVE_DOT = YES
-
-# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed
-# to run in parallel. When set to 0 doxygen will base this on the number of
-# processors available in the system. You can set it explicitly to a value
-# larger than 0 to get control over the balance between CPU load and processing
-# speed.
-# Minimum value: 0, maximum value: 32, default value: 0.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOT_NUM_THREADS = 0
-
-# When you want a differently looking font n the dot files that doxygen
-# generates you can specify the font name using DOT_FONTNAME. You need to make
-# sure dot is able to find the font, which can be done by putting it in a
-# standard location or by setting the DOTFONTPATH environment variable or by
-# setting DOT_FONTPATH to the directory containing the font.
-# The default value is: Helvetica.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOT_FONTNAME = Helvetica
-
-# The DOT_FONTSIZE tag can be used to set the size (in points) of the font of
-# dot graphs.
-# Minimum value: 4, maximum value: 24, default value: 10.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOT_FONTSIZE = 10
-
-# By default doxygen will tell dot to use the default font as specified with
-# DOT_FONTNAME. If you specify a different font using DOT_FONTNAME you can set
-# the path where dot can find it using this tag.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOT_FONTPATH =
-
-# If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for
-# each documented class showing the direct and indirect inheritance relations.
-# Setting this tag to YES will force the CLASS_DIAGRAMS tag to NO.
-# The default value is: YES.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-CLASS_GRAPH = YES
-
-# If the COLLABORATION_GRAPH tag is set to YES then doxygen will generate a
-# graph for each documented class showing the direct and indirect implementation
-# dependencies (inheritance, containment, and class references variables) of the
-# class with other documented classes.
-# The default value is: YES.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-COLLABORATION_GRAPH = YES
-
-# If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for
-# groups, showing the direct groups dependencies.
-# The default value is: YES.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-GROUP_GRAPHS = YES
-
-# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
-# collaboration diagrams in a style similar to the OMG's Unified Modeling
-# Language.
-# The default value is: NO.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-UML_LOOK = NO
-
-# If the UML_LOOK tag is enabled, the fields and methods are shown inside the
-# class node. If there are many fields or methods and many nodes the graph may
-# become too big to be useful. The UML_LIMIT_NUM_FIELDS threshold limits the
-# number of items for each type to make the size more manageable. Set this to 0
-# for no limit. Note that the threshold may be exceeded by 50% before the limit
-# is enforced. So when you set the threshold to 10, up to 15 fields may appear,
-# but if the number exceeds 15, the total amount of fields shown is limited to
-# 10.
-# Minimum value: 0, maximum value: 100, default value: 10.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-UML_LIMIT_NUM_FIELDS = 10
-
-# If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and
-# collaboration graphs will show the relations between templates and their
-# instances.
-# The default value is: NO.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-TEMPLATE_RELATIONS = NO
-
-# If the INCLUDE_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are set to
-# YES then doxygen will generate a graph for each documented file showing the
-# direct and indirect include dependencies of the file with other documented
-# files.
-# The default value is: YES.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-INCLUDE_GRAPH = YES
-
-# If the INCLUDED_BY_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are
-# set to YES then doxygen will generate a graph for each documented file showing
-# the direct and indirect include dependencies of the file with other documented
-# files.
-# The default value is: YES.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-INCLUDED_BY_GRAPH = NO
-
-# If the CALL_GRAPH tag is set to YES then doxygen will generate a call
-# dependency graph for every global function or class method.
-#
-# Note that enabling this option will significantly increase the time of a run.
-# So in most cases it will be better to enable call graphs for selected
-# functions only using the \callgraph command.
-# The default value is: NO.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-CALL_GRAPH = YES
-
-# If the CALLER_GRAPH tag is set to YES then doxygen will generate a caller
-# dependency graph for every global function or class method.
-#
-# Note that enabling this option will significantly increase the time of a run.
-# So in most cases it will be better to enable caller graphs for selected
-# functions only using the \callergraph command.
-# The default value is: NO.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-CALLER_GRAPH = YES
-
-# If the GRAPHICAL_HIERARCHY tag is set to YES then doxygen will graphical
-# hierarchy of all classes instead of a textual one.
-# The default value is: YES.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-GRAPHICAL_HIERARCHY = YES
-
-# If the DIRECTORY_GRAPH tag is set to YES then doxygen will show the
-# dependencies a directory has on other directories in a graphical way. The
-# dependency relations are determined by the #include relations between the
-# files in the directories.
-# The default value is: YES.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DIRECTORY_GRAPH = YES
-
-# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
-# generated by dot.
-# Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order
-# to make the SVG files visible in IE 9+ (other browsers do not have this
-# requirement).
-# Possible values are: png, jpg, gif and svg.
-# The default value is: png.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOT_IMAGE_FORMAT = png
-
-# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
-# enable generation of interactive SVG images that allow zooming and panning.
-#
-# Note that this requires a modern browser other than Internet Explorer. Tested
-# and working are Firefox, Chrome, Safari, and Opera.
-# Note: For IE 9+ you need to set HTML_FILE_EXTENSION to xhtml in order to make
-# the SVG files visible. Older versions of IE do not have SVG support.
-# The default value is: NO.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-INTERACTIVE_SVG = NO
-
-# The DOT_PATH tag can be used to specify the path where the dot tool can be
-# found. If left blank, it is assumed the dot tool can be found in the path.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOT_PATH =
-
-# The DOTFILE_DIRS tag can be used to specify one or more directories that
-# contain dot files that are included in the documentation (see the \dotfile
-# command).
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOTFILE_DIRS =
-
-# The MSCFILE_DIRS tag can be used to specify one or more directories that
-# contain msc files that are included in the documentation (see the \mscfile
-# command).
-
-MSCFILE_DIRS =
-
-# The DIAFILE_DIRS tag can be used to specify one or more directories that
-# contain dia files that are included in the documentation (see the \diafile
-# command).
-
-DIAFILE_DIRS =
-
-# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of nodes
-# that will be shown in the graph. If the number of nodes in a graph becomes
-# larger than this value, doxygen will truncate the graph, which is visualized
-# by representing a node as a red box. Note that doxygen if the number of direct
-# children of the root node in a graph is already larger than
-# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note that
-# the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
-# Minimum value: 0, maximum value: 10000, default value: 50.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOT_GRAPH_MAX_NODES = 50
-
-# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the graphs
-# generated by dot. A depth value of 3 means that only nodes reachable from the
-# root by following a path via at most 3 edges will be shown. Nodes that lay
-# further from the root node will be omitted. Note that setting this option to 1
-# or 2 may greatly reduce the computation time needed for large code bases. Also
-# note that the size of a graph can be further restricted by
-# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
-# Minimum value: 0, maximum value: 1000, default value: 0.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-MAX_DOT_GRAPH_DEPTH = 0
-
-# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
-# background. This is disabled by default, because dot on Windows does not seem
-# to support this out of the box.
-#
-# Warning: Depending on the platform used, enabling this option may lead to
-# badly anti-aliased labels on the edges of a graph (i.e. they become hard to
-# read).
-# The default value is: NO.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOT_TRANSPARENT = NO
-
-# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
-# files in one run (i.e. multiple -o and -T options on the command line). This
-# makes dot run faster, but since only newer versions of dot (>1.8.10) support
-# this, this feature is disabled by default.
-# The default value is: NO.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOT_MULTI_TARGETS = NO
-
-# If the GENERATE_LEGEND tag is set to YES doxygen will generate a legend page
-# explaining the meaning of the various boxes and arrows in the dot generated
-# graphs.
-# The default value is: YES.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-GENERATE_LEGEND = YES
-
-# If the DOT_CLEANUP tag is set to YES doxygen will remove the intermediate dot
-# files that are used to generate the various graphs.
-# The default value is: YES.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOT_CLEANUP = YES
diff --git a/peripheral/libmraa/Doxyfile.java.in b/peripheral/libmraa/Doxyfile.java.in
deleted file mode 100644
index db86d33..0000000
--- a/peripheral/libmraa/Doxyfile.java.in
+++ /dev/null
@@ -1,2324 +0,0 @@
-# Doxyfile 1.8.6
-
-# This file describes the settings to be used by the documentation system
-# doxygen (www.doxygen.org) for a project.
-#
-# All text after a double hash (##) is considered a comment and is placed in
-# front of the TAG it is preceding.
-#
-# All text after a single hash (#) is considered a comment and will be ignored.
-# The format is:
-# TAG = value [value, ...]
-# For lists, items can also be appended using:
-# TAG += value [value, ...]
-# Values that contain spaces should be placed between quotes (\" \").
-
-#---------------------------------------------------------------------------
-# Project related configuration options
-#---------------------------------------------------------------------------
-
-# This tag specifies the encoding used for all characters in the config file
-# that follow. The default is UTF-8 which is also the encoding used for all text
-# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv
-# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv
-# for the list of possible encodings.
-# The default value is: UTF-8.
-
-DOXYFILE_ENCODING = UTF-8
-
-# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by
-# double-quotes, unless you are using Doxywizard) that should identify the
-# project for which the documentation is generated. This name is used in the
-# title of most generated pages and in a few other places.
-# The default value is: My Project.
-
-PROJECT_NAME = mraa
-
-# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
-# could be handy for archiving the generated documentation or if some version
-# control system is used.
-
-PROJECT_NUMBER = @mraa_VERSION_STRING@
-
-# Using the PROJECT_BRIEF tag one can provide an optional one line description
-# for a project that appears at the top of each page and should give viewer a
-# quick idea about the purpose of the project. Keep the description short.
-
-PROJECT_BRIEF = "Low Level Skeleton Library for Communication on GNU/Linux platforms"
-
-# With the PROJECT_LOGO tag one can specify an logo or icon that is included in
-# the documentation. The maximum height of the logo should not exceed 55 pixels
-# and the maximum width should not exceed 200 pixels. Doxygen will copy the logo
-# to the output directory.
-
-PROJECT_LOGO =
-
-# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
-# into which the generated documentation will be written. If a relative path is
-# entered, it will be relative to the location where doxygen was started. If
-# left blank the current directory will be used.
-
-OUTPUT_DIRECTORY =
-
-# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 4096 sub-
-# directories (in 2 levels) under the output directory of each output format and
-# will distribute the generated files over these directories. Enabling this
-# option can be useful when feeding doxygen a huge amount of source files, where
-# putting all generated files in the same directory would otherwise causes
-# performance problems for the file system.
-# The default value is: NO.
-
-CREATE_SUBDIRS = NO
-
-# The OUTPUT_LANGUAGE tag is used to specify the language in which all
-# documentation generated by doxygen is written. Doxygen will use this
-# information to generate all constant output in the proper language.
-# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese,
-# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States),
-# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian,
-# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages),
-# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian,
-# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian,
-# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish,
-# Ukrainian and Vietnamese.
-# The default value is: English.
-
-OUTPUT_LANGUAGE = English
-
-# If the BRIEF_MEMBER_DESC tag is set to YES doxygen will include brief member
-# descriptions after the members that are listed in the file and class
-# documentation (similar to Javadoc). Set to NO to disable this.
-# The default value is: YES.
-
-BRIEF_MEMBER_DESC = YES
-
-# If the REPEAT_BRIEF tag is set to YES doxygen will prepend the brief
-# description of a member or function before the detailed description
-#
-# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
-# brief descriptions will be completely suppressed.
-# The default value is: YES.
-
-REPEAT_BRIEF = NO
-
-# This tag implements a quasi-intelligent brief description abbreviator that is
-# used to form the text in various listings. Each string in this list, if found
-# as the leading text of the brief description, will be stripped from the text
-# and the result, after processing the whole list, is used as the annotated
-# text. Otherwise, the brief description is used as-is. If left blank, the
-# following values are used ($name is automatically replaced with the name of
-# the entity):The $name class, The $name widget, The $name file, is, provides,
-# specifies, contains, represents, a, an and the.
-
-ABBREVIATE_BRIEF = "The $name class" \
- "The $name widget" \
- "The $name file" \
- is \
- provides \
- specifies \
- contains \
- represents \
- a \
- an \
- the
-
-# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
-# doxygen will generate a detailed section even if there is only a brief
-# description.
-# The default value is: NO.
-
-ALWAYS_DETAILED_SEC = NO
-
-# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
-# inherited members of a class in the documentation of that class as if those
-# members were ordinary class members. Constructors, destructors and assignment
-# operators of the base classes will not be shown.
-# The default value is: NO.
-
-INLINE_INHERITED_MEMB = NO
-
-# If the FULL_PATH_NAMES tag is set to YES doxygen will prepend the full path
-# before files name in the file list and in the header files. If set to NO the
-# shortest path that makes the file name unique will be used
-# The default value is: YES.
-
-FULL_PATH_NAMES = YES
-
-# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path.
-# Stripping is only done if one of the specified strings matches the left-hand
-# part of the path. The tag can be used to show relative paths in the file list.
-# If left blank the directory from which doxygen is run is used as the path to
-# strip.
-#
-# Note that you can specify absolute paths here, but also relative paths, which
-# 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 =
-
-# 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
-# header file to include in order to use a class. If left blank only the name of
-# the header file containing the class definition is used. Otherwise one should
-# specify the list of include paths that are normally passed to the compiler
-# using the -I flag.
-
-STRIP_FROM_INC_PATH =
-
-# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but
-# less readable) file names. This can be useful is your file systems doesn't
-# support long names like on DOS, Mac, or CD-ROM.
-# The default value is: NO.
-
-SHORT_NAMES = NO
-
-# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the
-# first line (until the first dot) of a Javadoc-style comment as the brief
-# description. If set to NO, the Javadoc-style will behave just like regular Qt-
-# style comments (thus requiring an explicit @brief command for a brief
-# description.)
-# The default value is: NO.
-
-JAVADOC_AUTOBRIEF = NO
-
-# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first
-# line (until the first dot) of a Qt-style comment as the brief description. If
-# set to NO, the Qt-style will behave just like regular Qt-style comments (thus
-# requiring an explicit \brief command for a brief description.)
-# The default value is: NO.
-
-QT_AUTOBRIEF = NO
-
-# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a
-# multi-line C++ special comment block (i.e. a block of //! or /// comments) as
-# a brief description. This used to be the default behavior. The new default is
-# to treat a multi-line C++ comment block as a detailed description. Set this
-# tag to YES if you prefer the old behavior instead.
-#
-# Note that setting this tag to YES also means that rational rose comments are
-# not recognized any more.
-# The default value is: NO.
-
-MULTILINE_CPP_IS_BRIEF = NO
-
-# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the
-# documentation from any documented member that it re-implements.
-# The default value is: YES.
-
-INHERIT_DOCS = YES
-
-# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce a
-# new page for each member. If set to NO, the documentation of a member will be
-# part of the file/class/namespace that contains it.
-# The default value is: NO.
-
-SEPARATE_MEMBER_PAGES = NO
-
-# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen
-# uses this value to replace tabs by spaces in code fragments.
-# Minimum value: 1, maximum value: 16, default value: 4.
-
-TAB_SIZE = 4
-
-# This tag can be used to specify a number of aliases that act as commands in
-# the documentation. An alias has the form:
-# name=value
-# For example adding
-# "sideeffect=@par Side Effects:\n"
-# will allow you to put the command \sideeffect (or @sideeffect) in the
-# documentation, which will result in a user-defined paragraph with heading
-# "Side Effects:". You can put \n's in the value part of an alias to insert
-# newlines.
-
-ALIASES =
-
-# This tag can be used to specify a number of word-keyword mappings (TCL only).
-# A mapping has the form "name=value". For example adding "class=itcl::class"
-# will allow you to use the command class in the itcl::class meaning.
-
-TCL_SUBST =
-
-# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
-# only. Doxygen will then generate output that is more tailored for C. For
-# instance, some of the names that are used will be different. The list of all
-# members will be omitted, etc.
-# The default value is: NO.
-
-OPTIMIZE_OUTPUT_FOR_C = NO
-
-# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or
-# Python sources only. Doxygen will then generate output that is more tailored
-# for that language. For instance, namespaces will be presented as packages,
-# qualified scopes will look different, etc.
-# The default value is: NO.
-
-OPTIMIZE_OUTPUT_JAVA = YES
-
-# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
-# sources. Doxygen will then generate output that is tailored for Fortran.
-# The default value is: NO.
-
-OPTIMIZE_FOR_FORTRAN = NO
-
-# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
-# sources. Doxygen will then generate output that is tailored for VHDL.
-# The default value is: NO.
-
-OPTIMIZE_OUTPUT_VHDL = NO
-
-# Doxygen selects the parser to use depending on the extension of the files it
-# parses. With this tag you can assign which parser to use for a given
-# extension. Doxygen has a built-in mapping, but you can override or extend it
-# using this tag. The format is ext=language, where ext is a file extension, and
-# language is one of the parsers supported by doxygen: IDL, Java, Javascript,
-# C#, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL. For instance to make
-# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C
-# (default is Fortran), use: inc=Fortran f=C.
-#
-# Note For files without extension you can use no_extension as a placeholder.
-#
-# Note that for custom extensions you also need to set FILE_PATTERNS otherwise
-# the files are not read by doxygen.
-
-EXTENSION_MAPPING =
-
-# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments
-# according to the Markdown format, which allows for more readable
-# documentation. See http://daringfireball.net/projects/markdown/ for details.
-# The output of markdown processing is further processed by doxygen, so you can
-# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in
-# case of backward compatibilities issues.
-# The default value is: YES.
-
-MARKDOWN_SUPPORT = YES
-
-# When enabled doxygen tries to link words that correspond to documented
-# classes, or namespaces to their corresponding documentation. Such a link can
-# be prevented in individual cases by by putting a % sign in front of the word
-# or globally by setting AUTOLINK_SUPPORT to NO.
-# The default value is: YES.
-
-AUTOLINK_SUPPORT = YES
-
-# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
-# to include (a tag file for) the STL sources as input, then you should set this
-# tag to YES in order to let doxygen match functions declarations and
-# definitions whose arguments contain STL classes (e.g. func(std::string);
-# versus func(std::string) {}). This also make the inheritance and collaboration
-# diagrams that involve STL classes more complete and accurate.
-# The default value is: NO.
-
-BUILTIN_STL_SUPPORT = NO
-
-# If you use Microsoft's C++/CLI language, you should set this option to YES to
-# enable parsing support.
-# The default value is: NO.
-
-CPP_CLI_SUPPORT = NO
-
-# Set the SIP_SUPPORT tag to YES if your project consists of sip (see:
-# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen
-# will parse them like normal C++ but will assume all classes use public instead
-# of private inheritance when no explicit protection keyword is present.
-# The default value is: NO.
-
-SIP_SUPPORT = NO
-
-# For Microsoft's IDL there are propget and propput attributes to indicate
-# getter and setter methods for a property. Setting this option to YES will make
-# doxygen to replace the get and set methods by a property in the documentation.
-# This will only work if the methods are indeed getting or setting a simple
-# type. If this is not the case, or you want to show the methods anyway, you
-# should set this option to NO.
-# The default value is: YES.
-
-IDL_PROPERTY_SUPPORT = YES
-
-# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
-# tag is set to YES, then doxygen will reuse the documentation of the first
-# member in the group (if any) for the other members of the group. By default
-# all members of a group must be documented explicitly.
-# The default value is: NO.
-
-DISTRIBUTE_GROUP_DOC = NO
-
-# Set the SUBGROUPING tag to YES to allow class member groups of the same type
-# (for instance a group of public functions) to be put as a subgroup of that
-# type (e.g. under the Public Functions section). Set it to NO to prevent
-# subgrouping. Alternatively, this can be done per class using the
-# \nosubgrouping command.
-# The default value is: YES.
-
-SUBGROUPING = YES
-
-# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions
-# are shown inside the group in which they are included (e.g. using \ingroup)
-# instead of on a separate page (for HTML and Man pages) or section (for LaTeX
-# and RTF).
-#
-# Note that this feature does not work in combination with
-# SEPARATE_MEMBER_PAGES.
-# The default value is: NO.
-
-INLINE_GROUPED_CLASSES = NO
-
-# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions
-# with only public data fields or simple typedef fields will be shown inline in
-# the documentation of the scope in which they are defined (i.e. file,
-# namespace, or group documentation), provided this scope is documented. If set
-# to NO, structs, classes, and unions are shown on a separate page (for HTML and
-# Man pages) or section (for LaTeX and RTF).
-# The default value is: NO.
-
-INLINE_SIMPLE_STRUCTS = NO
-
-# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or
-# enum is documented as struct, union, or enum with the name of the typedef. So
-# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
-# with name TypeT. When disabled the typedef will appear as a member of a file,
-# namespace, or class. And the struct will be named TypeS. This can typically be
-# useful for C code in case the coding convention dictates that all compound
-# types are typedef'ed and only the typedef is referenced, never the tag name.
-# The default value is: NO.
-
-TYPEDEF_HIDES_STRUCT = NO
-
-# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This
-# cache is used to resolve symbols given their name and scope. Since this can be
-# an expensive process and often the same symbol appears multiple times in the
-# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small
-# doxygen will become slower. If the cache is too large, memory is wasted. The
-# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range
-# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536
-# symbols. At the end of a run doxygen will report the cache usage and suggest
-# the optimal cache size from a speed point of view.
-# Minimum value: 0, maximum value: 9, default value: 0.
-
-LOOKUP_CACHE_SIZE = 0
-
-#---------------------------------------------------------------------------
-# Build related configuration options
-#---------------------------------------------------------------------------
-
-# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
-# documentation are documented, even if no documentation was available. Private
-# class members and static file members will be hidden unless the
-# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES.
-# Note: This will also disable the warnings about undocumented members that are
-# normally produced when WARNINGS is set to YES.
-# The default value is: NO.
-
-EXTRACT_ALL = NO
-
-# If the EXTRACT_PRIVATE tag is set to YES all private members of a class will
-# be included in the documentation.
-# The default value is: NO.
-
-EXTRACT_PRIVATE = NO
-
-# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal
-# scope will be included in the documentation.
-# The default value is: NO.
-
-EXTRACT_PACKAGE = NO
-
-# If the EXTRACT_STATIC tag is set to YES all static members of a file will be
-# included in the documentation.
-# The default value is: NO.
-
-EXTRACT_STATIC = NO
-
-# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) defined
-# locally in source files will be included in the documentation. If set to NO
-# only classes defined in header files are included. Does not have any effect
-# for Java sources.
-# The default value is: YES.
-
-EXTRACT_LOCAL_CLASSES = YES
-
-# This flag is only useful for Objective-C code. When set to YES local methods,
-# which are defined in the implementation section but not in the interface are
-# included in the documentation. If set to NO only methods in the interface are
-# included.
-# The default value is: NO.
-
-EXTRACT_LOCAL_METHODS = NO
-
-# If this flag is set to YES, the members of anonymous namespaces will be
-# extracted and appear in the documentation as a namespace called
-# 'anonymous_namespace{file}', where file will be replaced with the base name of
-# the file that contains the anonymous namespace. By default anonymous namespace
-# are hidden.
-# The default value is: NO.
-
-EXTRACT_ANON_NSPACES = NO
-
-# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all
-# undocumented members inside documented classes or files. If set to NO these
-# members will be included in the various overviews, but no documentation
-# section is generated. This option has no effect if EXTRACT_ALL is enabled.
-# The default value is: NO.
-
-HIDE_UNDOC_MEMBERS = NO
-
-# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all
-# undocumented classes that are normally visible in the class hierarchy. If set
-# to NO these classes will be included in the various overviews. This option has
-# no effect if EXTRACT_ALL is enabled.
-# The default value is: NO.
-
-HIDE_UNDOC_CLASSES = NO
-
-# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend
-# (class|struct|union) declarations. If set to NO these declarations will be
-# included in the documentation.
-# The default value is: NO.
-
-HIDE_FRIEND_COMPOUNDS = NO
-
-# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any
-# documentation blocks found inside the body of a function. If set to NO these
-# blocks will be appended to the function's detailed documentation block.
-# The default value is: NO.
-
-HIDE_IN_BODY_DOCS = NO
-
-# The INTERNAL_DOCS tag determines if documentation that is typed after a
-# \internal command is included. If the tag is set to NO then the documentation
-# will be excluded. Set it to YES to include the internal documentation.
-# The default value is: NO.
-
-INTERNAL_DOCS = NO
-
-# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file
-# names in lower-case letters. If set to YES upper-case letters are also
-# allowed. This is useful if you have classes or files whose names only differ
-# in case and if your file system supports case sensitive file names. Windows
-# and Mac users are advised to set this option to NO.
-# The default value is: system dependent.
-
-CASE_SENSE_NAMES = NO
-
-# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with
-# their full class and namespace scopes in the documentation. If set to YES the
-# scope will be hidden.
-# The default value is: NO.
-
-HIDE_SCOPE_NAMES = YES
-
-# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of
-# the files that are included by a file in the documentation of that file.
-# The default value is: YES.
-
-SHOW_INCLUDE_FILES = NO
-
-# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each
-# grouped member an include statement to the documentation, telling the reader
-# which file to include in order to use the member.
-# The default value is: NO.
-
-SHOW_GROUPED_MEMB_INC = NO
-
-# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include
-# files with double quotes in the documentation rather than with sharp brackets.
-# The default value is: NO.
-
-FORCE_LOCAL_INCLUDES = NO
-
-# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the
-# documentation for inline members.
-# The default value is: YES.
-
-INLINE_INFO = YES
-
-# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the
-# (detailed) documentation of file and class members alphabetically by member
-# name. If set to NO the members will appear in declaration order.
-# The default value is: YES.
-
-SORT_MEMBER_DOCS = YES
-
-# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief
-# descriptions of file, namespace and class members alphabetically by member
-# name. If set to NO the members will appear in declaration order. Note that
-# this will also influence the order of the classes in the class list.
-# The default value is: NO.
-
-SORT_BRIEF_DOCS = NO
-
-# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the
-# (brief and detailed) documentation of class members so that constructors and
-# destructors are listed first. If set to NO the constructors will appear in the
-# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS.
-# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief
-# member documentation.
-# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting
-# detailed member documentation.
-# The default value is: NO.
-
-SORT_MEMBERS_CTORS_1ST = NO
-
-# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy
-# of group names into alphabetical order. If set to NO the group names will
-# appear in their defined order.
-# The default value is: NO.
-
-SORT_GROUP_NAMES = NO
-
-# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by
-# fully-qualified names, including namespaces. If set to NO, the class list will
-# be sorted only by class name, not including the namespace part.
-# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
-# Note: This option applies only to the class list, not to the alphabetical
-# list.
-# The default value is: NO.
-
-SORT_BY_SCOPE_NAME = NO
-
-# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper
-# type resolution of all parameters of a function it will reject a match between
-# the prototype and the implementation of a member function even if there is
-# only one candidate or it is obvious which candidate to choose by doing a
-# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still
-# accept a match between prototype and implementation in such cases.
-# The default value is: NO.
-
-STRICT_PROTO_MATCHING = NO
-
-# The GENERATE_TODOLIST tag can be used to enable ( YES) or disable ( NO) the
-# todo list. This list is created by putting \todo commands in the
-# documentation.
-# The default value is: YES.
-
-GENERATE_TODOLIST = YES
-
-# The GENERATE_TESTLIST tag can be used to enable ( YES) or disable ( NO) the
-# test list. This list is created by putting \test commands in the
-# documentation.
-# The default value is: YES.
-
-GENERATE_TESTLIST = YES
-
-# The GENERATE_BUGLIST tag can be used to enable ( YES) or disable ( NO) the bug
-# list. This list is created by putting \bug commands in the documentation.
-# The default value is: YES.
-
-GENERATE_BUGLIST = YES
-
-# The GENERATE_DEPRECATEDLIST tag can be used to enable ( YES) or disable ( NO)
-# the deprecated list. This list is created by putting \deprecated commands in
-# the documentation.
-# The default value is: YES.
-
-GENERATE_DEPRECATEDLIST= YES
-
-# The ENABLED_SECTIONS tag can be used to enable conditional documentation
-# sections, marked by \if <section_label> ... \endif and \cond <section_label>
-# ... \endcond blocks.
-
-ENABLED_SECTIONS =
-
-# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the
-# initial value of a variable or macro / define can have for it to appear in the
-# documentation. If the initializer consists of more lines than specified here
-# it will be hidden. Use a value of 0 to hide initializers completely. The
-# appearance of the value of individual variables and macros / defines can be
-# controlled using \showinitializer or \hideinitializer command in the
-# documentation regardless of this setting.
-# Minimum value: 0, maximum value: 10000, default value: 30.
-
-MAX_INITIALIZER_LINES = 30
-
-# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at
-# the bottom of the documentation of classes and structs. If set to YES the list
-# will mention the files that were used to generate the documentation.
-# The default value is: YES.
-
-SHOW_USED_FILES = YES
-
-# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This
-# will remove the Files entry from the Quick Index and from the Folder Tree View
-# (if specified).
-# The default value is: YES.
-
-SHOW_FILES = YES
-
-# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces
-# page. This will remove the Namespaces entry from the Quick Index and from the
-# Folder Tree View (if specified).
-# The default value is: YES.
-
-SHOW_NAMESPACES = YES
-
-# The FILE_VERSION_FILTER tag can be used to specify a program or script that
-# doxygen should invoke to get the current version for each file (typically from
-# the version control system). Doxygen will invoke the program by executing (via
-# popen()) the command command input-file, where command is the value of the
-# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided
-# by doxygen. Whatever the program writes to standard output is used as the file
-# version. For an example see the documentation.
-
-FILE_VERSION_FILTER =
-
-# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
-# by doxygen. The layout file controls the global structure of the generated
-# output files in an output format independent way. To create the layout file
-# that represents doxygen's defaults, run doxygen with the -l option. You can
-# optionally specify a file name after the option, if omitted DoxygenLayout.xml
-# will be used as the name of the layout file.
-#
-# Note that if you run doxygen from a directory containing a file called
-# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE
-# tag is left empty.
-
-LAYOUT_FILE = @CMAKE_CURRENT_SOURCE_DIR@/DoxygenLayout.xml
-
-# The CITE_BIB_FILES tag can be used to specify one or more bib files containing
-# the reference definitions. This must be a list of .bib files. The .bib
-# extension is automatically appended if omitted. This requires the bibtex tool
-# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info.
-# For LaTeX the style of the bibliography can be controlled using
-# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the
-# search path. Do not use file names with spaces, bibtex cannot handle them. See
-# also \cite for info how to create references.
-
-CITE_BIB_FILES =
-
-#---------------------------------------------------------------------------
-# Configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-
-# The QUIET tag can be used to turn on/off the messages that are generated to
-# standard output by doxygen. If QUIET is set to YES this implies that the
-# messages are off.
-# The default value is: NO.
-
-QUIET = NO
-
-# The WARNINGS tag can be used to turn on/off the warning messages that are
-# generated to standard error ( stderr) by doxygen. If WARNINGS is set to YES
-# this implies that the warnings are on.
-#
-# Tip: Turn warnings on while writing the documentation.
-# The default value is: YES.
-
-WARNINGS = YES
-
-# If the WARN_IF_UNDOCUMENTED tag is set to YES, then doxygen will generate
-# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag
-# will automatically be disabled.
-# The default value is: YES.
-
-WARN_IF_UNDOCUMENTED = YES
-
-# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for
-# potential errors in the documentation, such as not documenting some parameters
-# in a documented function, or documenting parameters that don't exist or using
-# markup commands wrongly.
-# The default value is: YES.
-
-WARN_IF_DOC_ERROR = YES
-
-# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that
-# are documented, but have no documentation for their parameters or return
-# value. If set to NO doxygen will only warn about wrong or incomplete parameter
-# documentation, but not about the absence of documentation.
-# The default value is: NO.
-
-WARN_NO_PARAMDOC = NO
-
-# The WARN_FORMAT tag determines the format of the warning messages that doxygen
-# can produce. The string should contain the $file, $line, and $text tags, which
-# will be replaced by the file and line number from which the warning originated
-# and the warning text. Optionally the format may contain $version, which will
-# be replaced by the version of the file (if it could be obtained via
-# FILE_VERSION_FILTER)
-# The default value is: $file:$line: $text.
-
-WARN_FORMAT = "$file:$line: $text"
-
-# The WARN_LOGFILE tag can be used to specify a file to which warning and error
-# messages should be written. If left blank the output is written to standard
-# error (stderr).
-
-WARN_LOGFILE =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the input files
-#---------------------------------------------------------------------------
-
-# The INPUT tag is used to specify the files and/or directories that contain
-# documented source files. You may enter file names like myfile.cpp or
-# directories like /usr/src/myproject. Separate the files or directories with
-# spaces.
-# Note: If this tag is empty the current directory is searched.
-
-INPUT = @CMAKE_CURRENT_SOURCE_DIR@/api/ \
- @CMAKE_CURRENT_SOURCE_DIR@/api/mraa/ \
- @CMAKE_CURRENT_SOURCE_DIR@/docs/ \
- @CMAKE_CURRENT_SOURCE_DIR@/docs/CONTRIBUTING.md \
- @CMAKE_BINARY_DIR@/src/ \
- @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
-# libiconv (or the iconv built into libc) for the transcoding. See the libiconv
-# documentation (see: http://www.gnu.org/software/libiconv) for the list of
-# possible encodings.
-# The default value is: UTF-8.
-
-INPUT_ENCODING = UTF-8
-
-# If the value of the INPUT tag contains directories, you can use the
-# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and
-# *.h) to filter out the source-files in the directories. If left blank the
-# following patterns are tested:*.c, *.cc, *.cxx, *.cpp, *.c++, *.java, *.ii,
-# *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp,
-# *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown,
-# *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf,
-# *.qsf, *.as and *.js.
-
-FILE_PATTERNS = *.java \
- *.h \
- *.md \
- *.dox
-
-# The RECURSIVE tag can be used to specify whether or not subdirectories should
-# be searched for input files as well.
-# The default value is: NO.
-
-RECURSIVE = YES
-
-# The EXCLUDE tag can be used to specify files and/or directories that should be
-# excluded from the INPUT source files. This way you can easily exclude a
-# subdirectory from a directory tree whose root is specified with the INPUT tag.
-#
-# Note that relative paths are relative to the directory from which doxygen is
-# run.
-
-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
-# from the input.
-# The default value is: NO.
-
-EXCLUDE_SYMLINKS = NO
-
-# If the value of the INPUT tag contains directories, you can use the
-# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
-# certain files from those directories.
-#
-# Note that the wildcards are matched against the file with absolute path, so to
-# exclude all test directories for example use the pattern */test/*
-
-EXCLUDE_PATTERNS =
-
-# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
-# (namespaces, classes, functions, etc.) that should be excluded from the
-# output. The symbol name can be a fully qualified name, a word, or if the
-# wildcard * is used, a substring. Examples: ANamespace, AClass,
-# AClass::ANamespace, ANamespace::*Test
-#
-# Note that the wildcards are matched against the file with absolute path, so to
-# exclude all test directories use the pattern */test/*
-
-EXCLUDE_SYMBOLS =
-
-# The EXAMPLE_PATH tag can be used to specify one or more files or directories
-# that contain example code fragments that are included (see the \include
-# command).
-
-EXAMPLE_PATH = @CMAKE_CURRENT_SOURCE_DIR@/examples/ \
- @CMAKE_CURRENT_SOURCE_DIR@/examples/java/ \
- @CMAKE_CURRENT_SOURCE_DIR@/docs/
-
-# If the value of the EXAMPLE_PATH tag contains directories, you can use the
-# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
-# *.h) to filter out the source-files in the directories. If left blank all
-# files are included.
-
-EXAMPLE_PATTERNS = *.java *.cxx
-
-# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
-# searched for input files to be used with the \include or \dontinclude commands
-# irrespective of the value of the RECURSIVE tag.
-# The default value is: NO.
-
-EXAMPLE_RECURSIVE = NO
-
-# The IMAGE_PATH tag can be used to specify one or more files or directories
-# that contain images that are to be included in the documentation (see the
-# \image command).
-
-IMAGE_PATH =
-
-# The INPUT_FILTER tag can be used to specify a program that doxygen should
-# invoke to filter for each input file. Doxygen will invoke the filter program
-# by executing (via popen()) the command:
-#
-# <filter> <input-file>
-#
-# where <filter> is the value of the INPUT_FILTER tag, and <input-file> is the
-# name of an input file. Doxygen will then use the output that the filter
-# program writes to standard output. If FILTER_PATTERNS is specified, this tag
-# will be ignored.
-#
-# Note that the filter must not add or remove lines; it is applied before the
-# code is scanned, but not when the output code is generated. If lines are added
-# or removed, the anchors will not be placed correctly.
-
-INPUT_FILTER =
-
-# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
-# basis. Doxygen will compare the file name with each pattern and apply the
-# filter if there is a match. The filters are a list of the form: pattern=filter
-# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how
-# filters are used. If the FILTER_PATTERNS tag is empty or if none of the
-# patterns match the file name, INPUT_FILTER is applied.
-
-FILTER_PATTERNS =
-
-# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
-# INPUT_FILTER ) will also be used to filter the input files that are used for
-# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES).
-# The default value is: NO.
-
-FILTER_SOURCE_FILES = NO
-
-# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file
-# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and
-# it is also possible to disable source filtering for a specific pattern using
-# *.ext= (so without naming a filter).
-# This tag requires that the tag FILTER_SOURCE_FILES is set to YES.
-
-FILTER_SOURCE_PATTERNS =
-
-# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that
-# is part of the input, its contents will be placed on the main page
-# (index.html). This can be useful if you have a project on for instance GitHub
-# and want to reuse the introduction page also for the doxygen output.
-
-USE_MDFILE_AS_MAINPAGE = @CMAKE_CURRENT_SOURCE_DIR@/docs/index.java.md
-
-#---------------------------------------------------------------------------
-# Configuration options related to source browsing
-#---------------------------------------------------------------------------
-
-# If the SOURCE_BROWSER tag is set to YES then a list of source files will be
-# generated. Documented entities will be cross-referenced with these sources.
-#
-# Note: To get rid of all source code in the generated output, make sure that
-# also VERBATIM_HEADERS is set to NO.
-# The default value is: NO.
-
-SOURCE_BROWSER = NO
-
-# Setting the INLINE_SOURCES tag to YES will include the body of functions,
-# classes and enums directly into the documentation.
-# The default value is: NO.
-
-INLINE_SOURCES = NO
-
-# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any
-# special comment blocks from generated source code fragments. Normal C, C++ and
-# Fortran comments will always remain visible.
-# The default value is: YES.
-
-STRIP_CODE_COMMENTS = YES
-
-# If the REFERENCED_BY_RELATION tag is set to YES then for each documented
-# function all documented functions referencing it will be listed.
-# The default value is: NO.
-
-REFERENCED_BY_RELATION = NO
-
-# If the REFERENCES_RELATION tag is set to YES then for each documented function
-# all documented entities called/used by that function will be listed.
-# The default value is: NO.
-
-REFERENCES_RELATION = NO
-
-# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set
-# to YES, then the hyperlinks from functions in REFERENCES_RELATION and
-# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will
-# link to the documentation.
-# The default value is: YES.
-
-REFERENCES_LINK_SOURCE = YES
-
-# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the
-# source code will show a tooltip with additional information such as prototype,
-# brief description and links to the definition and documentation. Since this
-# will make the HTML file larger and loading of large files a bit slower, you
-# can opt to disable this feature.
-# The default value is: YES.
-# This tag requires that the tag SOURCE_BROWSER is set to YES.
-
-SOURCE_TOOLTIPS = YES
-
-# If the USE_HTAGS tag is set to YES then the references to source code will
-# point to the HTML generated by the htags(1) tool instead of doxygen built-in
-# source browser. The htags tool is part of GNU's global source tagging system
-# (see http://www.gnu.org/software/global/global.html). You will need version
-# 4.8.6 or higher.
-#
-# To use it do the following:
-# - Install the latest version of global
-# - Enable SOURCE_BROWSER and USE_HTAGS in the config file
-# - Make sure the INPUT points to the root of the source tree
-# - Run doxygen as normal
-#
-# Doxygen will invoke htags (and that will in turn invoke gtags), so these
-# tools must be available from the command line (i.e. in the search path).
-#
-# The result: instead of the source browser generated by doxygen, the links to
-# source code will now point to the output of htags.
-# The default value is: NO.
-# This tag requires that the tag SOURCE_BROWSER is set to YES.
-
-USE_HTAGS = NO
-
-# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a
-# verbatim copy of the header file for each class for which an include is
-# specified. Set to NO to disable this.
-# See also: Section \class.
-# The default value is: YES.
-
-VERBATIM_HEADERS = YES
-
-#---------------------------------------------------------------------------
-# Configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-
-# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all
-# compounds will be generated. Enable this if the project contains a lot of
-# classes, structs, unions or interfaces.
-# The default value is: YES.
-
-ALPHABETICAL_INDEX = YES
-
-# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in
-# which the alphabetical index list will be split.
-# Minimum value: 1, maximum value: 20, default value: 5.
-# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
-
-COLS_IN_ALPHA_INDEX = 5
-
-# In case all classes in a project start with a common prefix, all classes will
-# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag
-# can be used to specify a prefix (or a list of prefixes) that should be ignored
-# while generating the index headers.
-# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
-
-IGNORE_PREFIX =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the HTML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_HTML tag is set to YES doxygen will generate HTML output
-# The default value is: YES.
-
-GENERATE_HTML = YES
-
-# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a
-# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
-# it.
-# The default directory is: html.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_OUTPUT = html
-
-# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each
-# generated HTML page (for example: .htm, .php, .asp).
-# The default value is: .html.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_FILE_EXTENSION = .html
-
-# The HTML_HEADER tag can be used to specify a user-defined HTML header file for
-# each generated HTML page. If the tag is left blank doxygen will generate a
-# standard header.
-#
-# To get valid HTML the header file that includes any scripts and style sheets
-# that doxygen needs, which is dependent on the configuration options used (e.g.
-# the setting GENERATE_TREEVIEW). It is highly recommended to start with a
-# default header using
-# doxygen -w html new_header.html new_footer.html new_stylesheet.css
-# YourConfigFile
-# and then modify the file new_header.html. See also section "Doxygen usage"
-# for information on how to generate the default header that doxygen normally
-# uses.
-# Note: The header is subject to change so you typically have to regenerate the
-# default header when upgrading to a newer version of doxygen. For a description
-# of the possible markers and block names see the documentation.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_HEADER =
-
-# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each
-# generated HTML page. If the tag is left blank doxygen will generate a standard
-# footer. See HTML_HEADER for more information on how to generate a default
-# footer and what special commands can be used inside the footer. See also
-# section "Doxygen usage" for information on how to generate the default footer
-# that doxygen normally uses.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_FOOTER =
-
-# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style
-# sheet that is used by each HTML page. It can be used to fine-tune the look of
-# the HTML output. If left blank doxygen will generate a default style sheet.
-# See also section "Doxygen usage" for information on how to generate the style
-# sheet that doxygen normally uses.
-# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as
-# it is more robust and this tag (HTML_STYLESHEET) will in the future become
-# obsolete.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_STYLESHEET =
-
-# The HTML_EXTRA_STYLESHEET tag can be used to specify an additional user-
-# defined cascading style sheet that is included after the standard style sheets
-# created by doxygen. Using this option one can overrule certain style aspects.
-# This is preferred over using HTML_STYLESHEET since it does not replace the
-# standard style sheet and is therefor more robust against future updates.
-# Doxygen will copy the style sheet file to the output directory. For an example
-# see the documentation.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_EXTRA_STYLESHEET =
-
-# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
-# other source files which should be copied to the HTML output directory. Note
-# that these files will be copied to the base HTML output directory. Use the
-# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these
-# files. In the HTML_STYLESHEET file, use the file name only. Also note that the
-# files will be copied as-is; there are no commands or markers available.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_EXTRA_FILES =
-
-# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
-# will adjust the colors in the stylesheet and background images according to
-# this color. Hue is specified as an angle on a colorwheel, see
-# http://en.wikipedia.org/wiki/Hue for more information. For instance the value
-# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300
-# purple, and 360 is red again.
-# Minimum value: 0, maximum value: 359, default value: 220.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_COLORSTYLE_HUE = 20
-
-# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors
-# in the HTML output. For a value of 0 the output will use grayscales only. A
-# value of 255 will produce the most vivid colors.
-# Minimum value: 0, maximum value: 255, default value: 100.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_COLORSTYLE_SAT = 150
-
-# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the
-# luminance component of the colors in the HTML output. Values below 100
-# gradually make the output lighter, whereas values above 100 make the output
-# darker. The value divided by 100 is the actual gamma applied, so 80 represents
-# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not
-# change the gamma.
-# Minimum value: 40, maximum value: 240, default value: 80.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_COLORSTYLE_GAMMA = 80
-
-# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
-# page will contain the date and time when the page was generated. Setting this
-# to NO can help when comparing the output of multiple runs.
-# The default value is: YES.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_TIMESTAMP = YES
-
-# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
-# documentation will contain sections that can be hidden and shown after the
-# page has loaded.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_DYNAMIC_SECTIONS = NO
-
-# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries
-# shown in the various tree structured indices initially; the user can expand
-# and collapse entries dynamically later on. Doxygen will expand the tree to
-# such a level that at most the specified number of entries are visible (unless
-# a fully collapsed tree already exceeds this amount). So setting the number of
-# entries 1 will produce a full collapsed tree by default. 0 is a special value
-# representing an infinite number of entries and will result in a full expanded
-# tree by default.
-# Minimum value: 0, maximum value: 9999, default value: 100.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_INDEX_NUM_ENTRIES = 100
-
-# If the GENERATE_DOCSET tag is set to YES, additional index files will be
-# generated that can be used as input for Apple's Xcode 3 integrated development
-# environment (see: http://developer.apple.com/tools/xcode/), introduced with
-# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a
-# Makefile in the HTML output directory. Running make will produce the docset in
-# that directory and running make install will install the docset in
-# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at
-# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html
-# for more information.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-GENERATE_DOCSET = NO
-
-# This tag determines the name of the docset feed. A documentation feed provides
-# an umbrella under which multiple documentation sets from a single provider
-# (such as a company or product suite) can be grouped.
-# The default value is: Doxygen generated docs.
-# This tag requires that the tag GENERATE_DOCSET is set to YES.
-
-DOCSET_FEEDNAME = "Doxygen generated docs"
-
-# This tag specifies a string that should uniquely identify the documentation
-# set bundle. This should be a reverse domain-name style string, e.g.
-# com.mycompany.MyDocSet. Doxygen will append .docset to the name.
-# The default value is: org.doxygen.Project.
-# This tag requires that the tag GENERATE_DOCSET is set to YES.
-
-DOCSET_BUNDLE_ID = org.doxygen.Project
-
-# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify
-# the documentation publisher. This should be a reverse domain-name style
-# string, e.g. com.mycompany.MyDocSet.documentation.
-# The default value is: org.doxygen.Publisher.
-# This tag requires that the tag GENERATE_DOCSET is set to YES.
-
-DOCSET_PUBLISHER_ID = org.doxygen.Publisher
-
-# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher.
-# The default value is: Publisher.
-# This tag requires that the tag GENERATE_DOCSET is set to YES.
-
-DOCSET_PUBLISHER_NAME = Publisher
-
-# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three
-# additional HTML index files: index.hhp, index.hhc, and index.hhk. The
-# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop
-# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on
-# Windows.
-#
-# The HTML Help Workshop contains a compiler that can convert all HTML output
-# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML
-# files are now used as the Windows 98 help format, and will replace the old
-# Windows help format (.hlp) on all Windows platforms in the future. Compressed
-# HTML files also contain an index, a table of contents, and you can search for
-# words in the documentation. The HTML workshop also contains a viewer for
-# compressed HTML files.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-GENERATE_HTMLHELP = NO
-
-# The CHM_FILE tag can be used to specify the file name of the resulting .chm
-# file. You can add a path in front of the file if the result should not be
-# written to the html output directory.
-# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
-
-CHM_FILE =
-
-# The HHC_LOCATION tag can be used to specify the location (absolute path
-# including file name) of the HTML help compiler ( hhc.exe). If non-empty
-# doxygen will try to run the HTML help compiler on the generated index.hhp.
-# The file has to be specified with full path.
-# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
-
-HHC_LOCATION =
-
-# The GENERATE_CHI flag controls if a separate .chi index file is generated (
-# YES) or that it should be included in the master .chm file ( NO).
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
-
-GENERATE_CHI = NO
-
-# The CHM_INDEX_ENCODING is used to encode HtmlHelp index ( hhk), content ( hhc)
-# and project file content.
-# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
-
-CHM_INDEX_ENCODING =
-
-# The BINARY_TOC flag controls whether a binary table of contents is generated (
-# YES) or a normal table of contents ( NO) in the .chm file.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
-
-BINARY_TOC = NO
-
-# The TOC_EXPAND flag can be set to YES to add extra items for group members to
-# the table of contents of the HTML help documentation and to the tree view.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
-
-TOC_EXPAND = NO
-
-# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
-# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that
-# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help
-# (.qch) of the generated HTML documentation.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-GENERATE_QHP = NO
-
-# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify
-# the file name of the resulting .qch file. The path specified is relative to
-# the HTML output folder.
-# This tag requires that the tag GENERATE_QHP is set to YES.
-
-QCH_FILE =
-
-# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help
-# Project output. For more information please see Qt Help Project / Namespace
-# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace).
-# The default value is: org.doxygen.Project.
-# This tag requires that the tag GENERATE_QHP is set to YES.
-
-QHP_NAMESPACE = org.doxygen.Project
-
-# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt
-# Help Project output. For more information please see Qt Help Project / Virtual
-# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual-
-# folders).
-# The default value is: doc.
-# This tag requires that the tag GENERATE_QHP is set to YES.
-
-QHP_VIRTUAL_FOLDER = doc
-
-# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom
-# filter to add. For more information please see Qt Help Project / Custom
-# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
-# filters).
-# This tag requires that the tag GENERATE_QHP is set to YES.
-
-QHP_CUST_FILTER_NAME =
-
-# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the
-# custom filter to add. For more information please see Qt Help Project / Custom
-# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
-# filters).
-# This tag requires that the tag GENERATE_QHP is set to YES.
-
-QHP_CUST_FILTER_ATTRS =
-
-# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
-# project's filter section matches. Qt Help Project / Filter Attributes (see:
-# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes).
-# This tag requires that the tag GENERATE_QHP is set to YES.
-
-QHP_SECT_FILTER_ATTRS =
-
-# The QHG_LOCATION tag can be used to specify the location of Qt's
-# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the
-# generated .qhp file.
-# This tag requires that the tag GENERATE_QHP is set to YES.
-
-QHG_LOCATION =
-
-# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be
-# generated, together with the HTML files, they form an Eclipse help plugin. To
-# install this plugin and make it available under the help contents menu in
-# Eclipse, the contents of the directory containing the HTML and XML files needs
-# to be copied into the plugins directory of eclipse. The name of the directory
-# within the plugins directory should be the same as the ECLIPSE_DOC_ID value.
-# After copying Eclipse needs to be restarted before the help appears.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-GENERATE_ECLIPSEHELP = NO
-
-# A unique identifier for the Eclipse help plugin. When installing the plugin
-# the directory name containing the HTML and XML files should also have this
-# name. Each documentation set should have its own identifier.
-# The default value is: org.doxygen.Project.
-# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES.
-
-ECLIPSE_DOC_ID = org.doxygen.Project
-
-# If you want full control over the layout of the generated HTML pages it might
-# be necessary to disable the index and replace it with your own. The
-# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top
-# of each HTML page. A value of NO enables the index and the value YES disables
-# it. Since the tabs in the index contain the same information as the navigation
-# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-DISABLE_INDEX = NO
-
-# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
-# structure should be generated to display hierarchical information. If the tag
-# value is set to YES, a side panel will be generated containing a tree-like
-# index structure (just like the one that is generated for HTML Help). For this
-# to work a browser that supports JavaScript, DHTML, CSS and frames is required
-# (i.e. any modern browser). Windows users are probably better off using the
-# HTML help feature. Via custom stylesheets (see HTML_EXTRA_STYLESHEET) one can
-# further fine-tune the look of the index. As an example, the default style
-# sheet generated by doxygen has an example that shows how to put an image at
-# the root of the tree instead of the PROJECT_NAME. Since the tree basically has
-# the same information as the tab index, you could consider setting
-# DISABLE_INDEX to YES when enabling this option.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-GENERATE_TREEVIEW = NO
-
-# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that
-# doxygen will group on one line in the generated HTML documentation.
-#
-# Note that a value of 0 will completely suppress the enum values from appearing
-# in the overview section.
-# Minimum value: 0, maximum value: 20, default value: 4.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-ENUM_VALUES_PER_LINE = 4
-
-# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used
-# to set the initial width (in pixels) of the frame in which the tree is shown.
-# Minimum value: 0, maximum value: 1500, default value: 250.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-TREEVIEW_WIDTH = 250
-
-# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open links to
-# external symbols imported via tag files in a separate window.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-EXT_LINKS_IN_WINDOW = NO
-
-# Use this tag to change the font size of LaTeX formulas included as images in
-# the HTML documentation. When you change the font size after a successful
-# doxygen run you need to manually remove any form_*.png images from the HTML
-# output directory to force them to be regenerated.
-# Minimum value: 8, maximum value: 50, default value: 10.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-FORMULA_FONTSIZE = 10
-
-# Use the FORMULA_TRANPARENT tag to determine whether or not the images
-# generated for formulas are transparent PNGs. Transparent PNGs are not
-# supported properly for IE 6.0, but are supported on all modern browsers.
-#
-# Note that when changing this option you need to delete any form_*.png files in
-# the HTML output directory before the changes have effect.
-# The default value is: YES.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-FORMULA_TRANSPARENT = YES
-
-# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see
-# http://www.mathjax.org) which uses client side Javascript for the rendering
-# instead of using prerendered bitmaps. Use this if you do not have LaTeX
-# installed or if you want to formulas look prettier in the HTML output. When
-# enabled you may also need to install MathJax separately and configure the path
-# to it using the MATHJAX_RELPATH option.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-USE_MATHJAX = NO
-
-# When MathJax is enabled you can set the default output format to be used for
-# the MathJax output. See the MathJax site (see:
-# http://docs.mathjax.org/en/latest/output.html) for more details.
-# Possible values are: HTML-CSS (which is slower, but has the best
-# compatibility), NativeMML (i.e. MathML) and SVG.
-# The default value is: HTML-CSS.
-# This tag requires that the tag USE_MATHJAX is set to YES.
-
-MATHJAX_FORMAT = HTML-CSS
-
-# When MathJax is enabled you need to specify the location relative to the HTML
-# output directory using the MATHJAX_RELPATH option. The destination directory
-# should contain the MathJax.js script. For instance, if the mathjax directory
-# is located at the same level as the HTML output directory, then
-# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax
-# Content Delivery Network so you can quickly see the result without installing
-# MathJax. However, it is strongly recommended to install a local copy of
-# MathJax from http://www.mathjax.org before deployment.
-# The default value is: http://cdn.mathjax.org/mathjax/latest.
-# This tag requires that the tag USE_MATHJAX is set to YES.
-
-MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest
-
-# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax
-# extension names that should be enabled during MathJax rendering. For example
-# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols
-# This tag requires that the tag USE_MATHJAX is set to YES.
-
-MATHJAX_EXTENSIONS =
-
-# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces
-# of code that will be used on startup of the MathJax code. See the MathJax site
-# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an
-# example see the documentation.
-# This tag requires that the tag USE_MATHJAX is set to YES.
-
-MATHJAX_CODEFILE =
-
-# When the SEARCHENGINE tag is enabled doxygen will generate a search box for
-# the HTML output. The underlying search engine uses javascript and DHTML and
-# should work on any modern browser. Note that when using HTML help
-# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET)
-# there is already a search function so this one should typically be disabled.
-# For large projects the javascript based search engine can be slow, then
-# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to
-# search using the keyboard; to jump to the search box use <access key> + S
-# (what the <access key> is depends on the OS and browser, but it is typically
-# <CTRL>, <ALT>/<option>, or both). Inside the search box use the <cursor down
-# key> to jump into the search results window, the results can be navigated
-# using the <cursor keys>. Press <Enter> to select an item or <escape> to cancel
-# the search. The filter options can be selected when the cursor is inside the
-# search box by pressing <Shift>+<cursor down>. Also here use the <cursor keys>
-# to select a filter and <Enter> or <escape> to activate or cancel the filter
-# option.
-# The default value is: YES.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-SEARCHENGINE = YES
-
-# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
-# implemented using a web server instead of a web client using Javascript. There
-# are two flavours of web server based searching depending on the
-# EXTERNAL_SEARCH setting. When disabled, doxygen will generate a PHP script for
-# searching and an index file used by the script. When EXTERNAL_SEARCH is
-# enabled the indexing and searching needs to be provided by external tools. See
-# the section "External Indexing and Searching" for details.
-# The default value is: NO.
-# This tag requires that the tag SEARCHENGINE is set to YES.
-
-SERVER_BASED_SEARCH = NO
-
-# When EXTERNAL_SEARCH tag is enabled doxygen will no longer generate the PHP
-# script for searching. Instead the search results are written to an XML file
-# which needs to be processed by an external indexer. Doxygen will invoke an
-# external search engine pointed to by the SEARCHENGINE_URL option to obtain the
-# search results.
-#
-# Doxygen ships with an example indexer ( doxyindexer) and search engine
-# (doxysearch.cgi) which are based on the open source search engine library
-# Xapian (see: http://xapian.org/).
-#
-# See the section "External Indexing and Searching" for details.
-# The default value is: NO.
-# This tag requires that the tag SEARCHENGINE is set to YES.
-
-EXTERNAL_SEARCH = NO
-
-# The SEARCHENGINE_URL should point to a search engine hosted by a web server
-# which will return the search results when EXTERNAL_SEARCH is enabled.
-#
-# Doxygen ships with an example indexer ( doxyindexer) and search engine
-# (doxysearch.cgi) which are based on the open source search engine library
-# Xapian (see: http://xapian.org/). See the section "External Indexing and
-# Searching" for details.
-# This tag requires that the tag SEARCHENGINE is set to YES.
-
-SEARCHENGINE_URL =
-
-# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed
-# search data is written to a file for indexing by an external tool. With the
-# SEARCHDATA_FILE tag the name of this file can be specified.
-# The default file is: searchdata.xml.
-# This tag requires that the tag SEARCHENGINE is set to YES.
-
-SEARCHDATA_FILE = searchdata.xml
-
-# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the
-# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is
-# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple
-# projects and redirect the results back to the right project.
-# This tag requires that the tag SEARCHENGINE is set to YES.
-
-EXTERNAL_SEARCH_ID =
-
-# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen
-# projects other than the one defined by this configuration file, but that are
-# all added to the same external search index. Each project needs to have a
-# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id of
-# to a relative location where the documentation can be found. The format is:
-# EXTRA_SEARCH_MAPPINGS = tagname1=loc1 tagname2=loc2 ...
-# This tag requires that the tag SEARCHENGINE is set to YES.
-
-EXTRA_SEARCH_MAPPINGS =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_LATEX tag is set to YES doxygen will generate LaTeX output.
-# The default value is: YES.
-
-GENERATE_LATEX = NO
-
-# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a
-# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
-# it.
-# The default directory is: latex.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_OUTPUT = latex
-
-# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
-# invoked.
-#
-# Note that when enabling USE_PDFLATEX this option is only used for generating
-# bitmaps for formulas in the HTML output, but not in the Makefile that is
-# written to the output directory.
-# The default file is: latex.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_CMD_NAME = latex
-
-# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to generate
-# index for LaTeX.
-# The default file is: makeindex.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-MAKEINDEX_CMD_NAME = makeindex
-
-# If the COMPACT_LATEX tag is set to YES doxygen generates more compact LaTeX
-# documents. This may be useful for small projects and may help to save some
-# trees in general.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-COMPACT_LATEX = NO
-
-# The PAPER_TYPE tag can be used to set the paper type that is used by the
-# printer.
-# Possible values are: a4 (210 x 297 mm), letter (8.5 x 11 inches), legal (8.5 x
-# 14 inches) and executive (7.25 x 10.5 inches).
-# The default value is: a4.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-PAPER_TYPE = a4
-
-# The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names
-# that should be included in the LaTeX output. To get the times font for
-# instance you can specify
-# EXTRA_PACKAGES=times
-# If left blank no extra packages will be included.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-EXTRA_PACKAGES =
-
-# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the
-# generated LaTeX document. The header should contain everything until the first
-# chapter. If it is left blank doxygen will generate a standard header. See
-# section "Doxygen usage" for information on how to let doxygen write the
-# default header to a separate file.
-#
-# Note: Only use a user-defined header if you know what you are doing! The
-# following commands have a special meaning inside the header: $title,
-# $datetime, $date, $doxygenversion, $projectname, $projectnumber. Doxygen will
-# replace them by respectively the title of the page, the current date and time,
-# only the current date, the version number of doxygen, the project name (see
-# PROJECT_NAME), or the project number (see PROJECT_NUMBER).
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_HEADER =
-
-# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the
-# generated LaTeX document. The footer should contain everything after the last
-# chapter. If it is left blank doxygen will generate a standard footer.
-#
-# Note: Only use a user-defined footer if you know what you are doing!
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_FOOTER =
-
-# The LATEX_EXTRA_FILES tag can be used to specify one or more extra images or
-# other source files which should be copied to the LATEX_OUTPUT output
-# directory. Note that the files will be copied as-is; there are no commands or
-# markers available.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_EXTRA_FILES =
-
-# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated is
-# prepared for conversion to PDF (using ps2pdf or pdflatex). The PDF file will
-# contain links (just like the HTML output) instead of page references. This
-# makes the output suitable for online browsing using a PDF viewer.
-# The default value is: YES.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-PDF_HYPERLINKS = YES
-
-# If the LATEX_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate
-# the PDF file directly from the LaTeX files. Set this option to YES to get a
-# higher quality PDF documentation.
-# The default value is: YES.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-USE_PDFLATEX = YES
-
-# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode
-# command to the generated LaTeX files. This will instruct LaTeX to keep running
-# if errors occur, instead of asking the user for help. This option is also used
-# when generating formulas in HTML.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_BATCHMODE = NO
-
-# If the LATEX_HIDE_INDICES tag is set to YES then doxygen will not include the
-# index chapters (such as File Index, Compound Index, etc.) in the output.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_HIDE_INDICES = NO
-
-# If the LATEX_SOURCE_CODE tag is set to YES then doxygen will include source
-# code with syntax highlighting in the LaTeX output.
-#
-# Note that which sources are shown also depends on other settings such as
-# SOURCE_BROWSER.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_SOURCE_CODE = NO
-
-# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
-# bibliography, e.g. plainnat, or ieeetr. See
-# http://en.wikipedia.org/wiki/BibTeX and \cite for more info.
-# The default value is: plain.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_BIB_STYLE = plain
-
-#---------------------------------------------------------------------------
-# Configuration options related to the RTF output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_RTF tag is set to YES doxygen will generate RTF output. The
-# RTF output is optimized for Word 97 and may not look too pretty with other RTF
-# readers/editors.
-# The default value is: NO.
-
-GENERATE_RTF = NO
-
-# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. If a
-# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
-# it.
-# The default directory is: rtf.
-# This tag requires that the tag GENERATE_RTF is set to YES.
-
-RTF_OUTPUT = rtf
-
-# If the COMPACT_RTF tag is set to YES doxygen generates more compact RTF
-# documents. This may be useful for small projects and may help to save some
-# trees in general.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_RTF is set to YES.
-
-COMPACT_RTF = NO
-
-# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated will
-# contain hyperlink fields. The RTF file will contain links (just like the HTML
-# output) instead of page references. This makes the output suitable for online
-# browsing using Word or some other Word compatible readers that support those
-# fields.
-#
-# Note: WordPad (write) and others do not support links.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_RTF is set to YES.
-
-RTF_HYPERLINKS = NO
-
-# Load stylesheet definitions from file. Syntax is similar to doxygen's config
-# file, i.e. a series of assignments. You only have to provide replacements,
-# missing definitions are set to their default value.
-#
-# See also section "Doxygen usage" for information on how to generate the
-# default style sheet that doxygen normally uses.
-# This tag requires that the tag GENERATE_RTF is set to YES.
-
-RTF_STYLESHEET_FILE =
-
-# Set optional variables used in the generation of an RTF document. Syntax is
-# similar to doxygen's config file. A template extensions file can be generated
-# using doxygen -e rtf extensionFile.
-# This tag requires that the tag GENERATE_RTF is set to YES.
-
-RTF_EXTENSIONS_FILE =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the man page output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_MAN tag is set to YES doxygen will generate man pages for
-# classes and files.
-# The default value is: NO.
-
-GENERATE_MAN = NO
-
-# The MAN_OUTPUT tag is used to specify where the man pages will be put. If a
-# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
-# it. A directory man3 will be created inside the directory specified by
-# MAN_OUTPUT.
-# The default directory is: man.
-# This tag requires that the tag GENERATE_MAN is set to YES.
-
-MAN_OUTPUT = man
-
-# The MAN_EXTENSION tag determines the extension that is added to the generated
-# man pages. In case the manual section does not start with a number, the number
-# 3 is prepended. The dot (.) at the beginning of the MAN_EXTENSION tag is
-# optional.
-# The default value is: .3.
-# This tag requires that the tag GENERATE_MAN is set to YES.
-
-MAN_EXTENSION = .3
-
-# If the MAN_LINKS tag is set to YES and doxygen generates man output, then it
-# will generate one additional man file for each entity documented in the real
-# man page(s). These additional files only source the real man page, but without
-# them the man command would be unable to find the correct page.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_MAN is set to YES.
-
-MAN_LINKS = NO
-
-#---------------------------------------------------------------------------
-# Configuration options related to the XML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_XML tag is set to YES doxygen will generate an XML file that
-# captures the structure of the code including all documentation.
-# The default value is: NO.
-
-GENERATE_XML = YES
-
-# The XML_OUTPUT tag is used to specify where the XML pages will be put. If a
-# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
-# it.
-# The default directory is: xml.
-# This tag requires that the tag GENERATE_XML is set to 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
-# of the XML output.
-# The default value is: YES.
-# This tag requires that the tag GENERATE_XML is set to YES.
-
-XML_PROGRAMLISTING = YES
-
-#---------------------------------------------------------------------------
-# Configuration options related to the DOCBOOK output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_DOCBOOK tag is set to YES doxygen will generate Docbook files
-# that can be used to generate PDF.
-# The default value is: NO.
-
-GENERATE_DOCBOOK = NO
-
-# The DOCBOOK_OUTPUT tag is used to specify where the Docbook pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be put in
-# front of it.
-# The default directory is: docbook.
-# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
-
-DOCBOOK_OUTPUT = docbook
-
-#---------------------------------------------------------------------------
-# Configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_AUTOGEN_DEF tag is set to YES doxygen will generate an AutoGen
-# Definitions (see http://autogen.sf.net) file that captures the structure of
-# the code including all documentation. Note that this feature is still
-# experimental and incomplete at the moment.
-# The default value is: NO.
-
-GENERATE_AUTOGEN_DEF = NO
-
-#---------------------------------------------------------------------------
-# Configuration options related to the Perl module output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_PERLMOD tag is set to YES doxygen will generate a Perl module
-# file that captures the structure of the code including all documentation.
-#
-# Note that this feature is still experimental and incomplete at the moment.
-# The default value is: NO.
-
-GENERATE_PERLMOD = NO
-
-# If the PERLMOD_LATEX tag is set to YES doxygen will generate the necessary
-# Makefile rules, Perl scripts and LaTeX code to be able to generate PDF and DVI
-# output from the Perl module output.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_PERLMOD is set to YES.
-
-PERLMOD_LATEX = NO
-
-# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be nicely
-# formatted so it can be parsed by a human reader. This is useful if you want to
-# understand what is going on. On the other hand, if this tag is set to NO the
-# size of the Perl module output will be much smaller and Perl will parse it
-# just the same.
-# The default value is: YES.
-# This tag requires that the tag GENERATE_PERLMOD is set to YES.
-
-PERLMOD_PRETTY = YES
-
-# The names of the make variables in the generated doxyrules.make file are
-# prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. This is useful
-# so different doxyrules.make files included by the same Makefile don't
-# overwrite each other's variables.
-# This tag requires that the tag GENERATE_PERLMOD is set to YES.
-
-PERLMOD_MAKEVAR_PREFIX =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-
-# If the ENABLE_PREPROCESSING tag is set to YES doxygen will evaluate all
-# C-preprocessor directives found in the sources and include files.
-# The default value is: YES.
-
-ENABLE_PREPROCESSING = YES
-
-# If the MACRO_EXPANSION tag is set to YES doxygen will expand all macro names
-# in the source code. If set to NO only conditional compilation will be
-# performed. Macro expansion can be done in a controlled way by setting
-# EXPAND_ONLY_PREDEF to YES.
-# The default value is: NO.
-# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-
-MACRO_EXPANSION = NO
-
-# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then
-# the macro expansion is limited to the macros specified with the PREDEFINED and
-# EXPAND_AS_DEFINED tags.
-# The default value is: NO.
-# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-
-EXPAND_ONLY_PREDEF = NO
-
-# If the SEARCH_INCLUDES tag is set to YES the includes files in the
-# INCLUDE_PATH will be searched if a #include is found.
-# The default value is: YES.
-# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-
-SEARCH_INCLUDES = YES
-
-# The INCLUDE_PATH tag can be used to specify one or more directories that
-# contain include files that are not input files but should be processed by the
-# preprocessor.
-# This tag requires that the tag SEARCH_INCLUDES is set to YES.
-
-INCLUDE_PATH =
-
-# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
-# patterns (like *.h and *.hpp) to filter out the header-files in the
-# directories. If left blank, the patterns specified with FILE_PATTERNS will be
-# used.
-# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-
-INCLUDE_FILE_PATTERNS =
-
-# The PREDEFINED tag can be used to specify one or more macro names that are
-# defined before the preprocessor is started (similar to the -D option of e.g.
-# gcc). The argument of the tag is a list of macros of the form: name or
-# name=definition (no spaces). If the definition and the "=" are omitted, "=1"
-# is assumed. To prevent a macro definition from being undefined via #undef or
-# recursively expanded use the := operator instead of the = operator.
-# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-
-PREDEFINED =
-
-# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
-# tag can be used to specify a list of macro names that should be expanded. The
-# macro definition that is found in the sources will be used. Use the PREDEFINED
-# tag if you want to use a different macro definition that overrules the
-# definition found in the source code.
-# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-
-EXPAND_AS_DEFINED =
-
-# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
-# remove all refrences to function-like macros that are alone on a line, have an
-# all uppercase name, and do not end with a semicolon. Such function macros are
-# typically used for boiler-plate code, and will confuse the parser if not
-# removed.
-# The default value is: YES.
-# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-
-SKIP_FUNCTION_MACROS = YES
-
-#---------------------------------------------------------------------------
-# Configuration options related to external references
-#---------------------------------------------------------------------------
-
-# The TAGFILES tag can be used to specify one or more tag files. For each tag
-# file the location of the external documentation should be added. The format of
-# a tag file without this location is as follows:
-# TAGFILES = file1 file2 ...
-# Adding location for the tag files is done as follows:
-# TAGFILES = file1=loc1 "file2 = loc2" ...
-# where loc1 and loc2 can be relative or absolute paths or URLs. See the
-# section "Linking to external documentation" for more information about the use
-# of tag files.
-# Note: Each tag file must have an unique name (where the name does NOT include
-# the path). If a tag file is not located in the directory in which doxygen is
-# run, you must also specify the path to the tagfile here.
-
-TAGFILES =
-
-# When a file name is specified after GENERATE_TAGFILE, doxygen will create a
-# tag file that is based on the input files it reads. See section "Linking to
-# external documentation" for more information about the usage of tag files.
-
-GENERATE_TAGFILE =
-
-# If the ALLEXTERNALS tag is set to YES all external class will be listed in the
-# class index. If set to NO only the inherited external classes will be listed.
-# The default value is: NO.
-
-ALLEXTERNALS = NO
-
-# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed in
-# the modules index. If set to NO, only the current project's groups will be
-# listed.
-# The default value is: YES.
-
-EXTERNAL_GROUPS = YES
-
-# If the EXTERNAL_PAGES tag is set to YES all external pages will be listed in
-# the related pages index. If set to NO, only the current project's pages will
-# be listed.
-# The default value is: YES.
-
-EXTERNAL_PAGES = YES
-
-# The PERL_PATH should be the absolute path and name of the perl script
-# interpreter (i.e. the result of 'which perl').
-# The default file (with absolute path) is: /usr/bin/perl.
-
-PERL_PATH = /usr/bin/perl
-
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-
-# If the CLASS_DIAGRAMS tag is set to YES doxygen will generate a class diagram
-# (in HTML and LaTeX) for classes with base or super classes. Setting the tag to
-# NO turns the diagrams off. Note that this option also works with HAVE_DOT
-# disabled, but it is recommended to install and use dot, since it yields more
-# powerful graphs.
-# The default value is: YES.
-
-CLASS_DIAGRAMS = NO
-
-# You can define message sequence charts within doxygen comments using the \msc
-# command. Doxygen will then run the mscgen tool (see:
-# http://www.mcternan.me.uk/mscgen/)) to produce the chart and insert it in the
-# documentation. The MSCGEN_PATH tag allows you to specify the directory where
-# the mscgen tool resides. If left empty the tool is assumed to be found in the
-# default search path.
-
-MSCGEN_PATH =
-
-# You can include diagrams made with dia in doxygen documentation. Doxygen will
-# then run dia to produce the diagram and insert it in the documentation. The
-# DIA_PATH tag allows you to specify the directory where the dia binary resides.
-# If left empty dia is assumed to be found in the default search path.
-
-DIA_PATH =
-
-# If set to YES, the inheritance and collaboration graphs will hide inheritance
-# and usage relations if the target is undocumented or is not a class.
-# The default value is: YES.
-
-HIDE_UNDOC_RELATIONS = YES
-
-# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
-# available from the path. This tool is part of Graphviz (see:
-# http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent
-# Bell Labs. The other options in this section have no effect if this option is
-# set to NO
-# The default value is: NO.
-
-HAVE_DOT = YES
-
-# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed
-# to run in parallel. When set to 0 doxygen will base this on the number of
-# processors available in the system. You can set it explicitly to a value
-# larger than 0 to get control over the balance between CPU load and processing
-# speed.
-# Minimum value: 0, maximum value: 32, default value: 0.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOT_NUM_THREADS = 0
-
-# When you want a differently looking font n the dot files that doxygen
-# generates you can specify the font name using DOT_FONTNAME. You need to make
-# sure dot is able to find the font, which can be done by putting it in a
-# standard location or by setting the DOTFONTPATH environment variable or by
-# setting DOT_FONTPATH to the directory containing the font.
-# The default value is: Helvetica.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOT_FONTNAME = Helvetica
-
-# The DOT_FONTSIZE tag can be used to set the size (in points) of the font of
-# dot graphs.
-# Minimum value: 4, maximum value: 24, default value: 10.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOT_FONTSIZE = 10
-
-# By default doxygen will tell dot to use the default font as specified with
-# DOT_FONTNAME. If you specify a different font using DOT_FONTNAME you can set
-# the path where dot can find it using this tag.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOT_FONTPATH =
-
-# If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for
-# each documented class showing the direct and indirect inheritance relations.
-# Setting this tag to YES will force the CLASS_DIAGRAMS tag to NO.
-# The default value is: YES.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-CLASS_GRAPH = YES
-
-# If the COLLABORATION_GRAPH tag is set to YES then doxygen will generate a
-# graph for each documented class showing the direct and indirect implementation
-# dependencies (inheritance, containment, and class references variables) of the
-# class with other documented classes.
-# The default value is: YES.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-COLLABORATION_GRAPH = YES
-
-# If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for
-# groups, showing the direct groups dependencies.
-# The default value is: YES.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-GROUP_GRAPHS = YES
-
-# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
-# collaboration diagrams in a style similar to the OMG's Unified Modeling
-# Language.
-# The default value is: NO.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-UML_LOOK = NO
-
-# If the UML_LOOK tag is enabled, the fields and methods are shown inside the
-# class node. If there are many fields or methods and many nodes the graph may
-# become too big to be useful. The UML_LIMIT_NUM_FIELDS threshold limits the
-# number of items for each type to make the size more manageable. Set this to 0
-# for no limit. Note that the threshold may be exceeded by 50% before the limit
-# is enforced. So when you set the threshold to 10, up to 15 fields may appear,
-# but if the number exceeds 15, the total amount of fields shown is limited to
-# 10.
-# Minimum value: 0, maximum value: 100, default value: 10.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-UML_LIMIT_NUM_FIELDS = 10
-
-# If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and
-# collaboration graphs will show the relations between templates and their
-# instances.
-# The default value is: NO.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-TEMPLATE_RELATIONS = NO
-
-# If the INCLUDE_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are set to
-# YES then doxygen will generate a graph for each documented file showing the
-# direct and indirect include dependencies of the file with other documented
-# files.
-# The default value is: YES.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-INCLUDE_GRAPH = YES
-
-# If the INCLUDED_BY_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are
-# set to YES then doxygen will generate a graph for each documented file showing
-# the direct and indirect include dependencies of the file with other documented
-# files.
-# The default value is: YES.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-INCLUDED_BY_GRAPH = NO
-
-# If the CALL_GRAPH tag is set to YES then doxygen will generate a call
-# dependency graph for every global function or class method.
-#
-# Note that enabling this option will significantly increase the time of a run.
-# So in most cases it will be better to enable call graphs for selected
-# functions only using the \callgraph command.
-# The default value is: NO.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-CALL_GRAPH = YES
-
-# If the CALLER_GRAPH tag is set to YES then doxygen will generate a caller
-# dependency graph for every global function or class method.
-#
-# Note that enabling this option will significantly increase the time of a run.
-# So in most cases it will be better to enable caller graphs for selected
-# functions only using the \callergraph command.
-# The default value is: NO.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-CALLER_GRAPH = YES
-
-# If the GRAPHICAL_HIERARCHY tag is set to YES then doxygen will graphical
-# hierarchy of all classes instead of a textual one.
-# The default value is: YES.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-GRAPHICAL_HIERARCHY = YES
-
-# If the DIRECTORY_GRAPH tag is set to YES then doxygen will show the
-# dependencies a directory has on other directories in a graphical way. The
-# dependency relations are determined by the #include relations between the
-# files in the directories.
-# The default value is: YES.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DIRECTORY_GRAPH = YES
-
-# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
-# generated by dot.
-# Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order
-# to make the SVG files visible in IE 9+ (other browsers do not have this
-# requirement).
-# Possible values are: png, jpg, gif and svg.
-# The default value is: png.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOT_IMAGE_FORMAT = png
-
-# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
-# enable generation of interactive SVG images that allow zooming and panning.
-#
-# Note that this requires a modern browser other than Internet Explorer. Tested
-# and working are Firefox, Chrome, Safari, and Opera.
-# Note: For IE 9+ you need to set HTML_FILE_EXTENSION to xhtml in order to make
-# the SVG files visible. Older versions of IE do not have SVG support.
-# The default value is: NO.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-INTERACTIVE_SVG = NO
-
-# The DOT_PATH tag can be used to specify the path where the dot tool can be
-# found. If left blank, it is assumed the dot tool can be found in the path.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOT_PATH =
-
-# The DOTFILE_DIRS tag can be used to specify one or more directories that
-# contain dot files that are included in the documentation (see the \dotfile
-# command).
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOTFILE_DIRS =
-
-# The MSCFILE_DIRS tag can be used to specify one or more directories that
-# contain msc files that are included in the documentation (see the \mscfile
-# command).
-
-MSCFILE_DIRS =
-
-# The DIAFILE_DIRS tag can be used to specify one or more directories that
-# contain dia files that are included in the documentation (see the \diafile
-# command).
-
-DIAFILE_DIRS =
-
-# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of nodes
-# that will be shown in the graph. If the number of nodes in a graph becomes
-# larger than this value, doxygen will truncate the graph, which is visualized
-# by representing a node as a red box. Note that doxygen if the number of direct
-# children of the root node in a graph is already larger than
-# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note that
-# the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
-# Minimum value: 0, maximum value: 10000, default value: 50.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOT_GRAPH_MAX_NODES = 50
-
-# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the graphs
-# generated by dot. A depth value of 3 means that only nodes reachable from the
-# root by following a path via at most 3 edges will be shown. Nodes that lay
-# further from the root node will be omitted. Note that setting this option to 1
-# or 2 may greatly reduce the computation time needed for large code bases. Also
-# note that the size of a graph can be further restricted by
-# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
-# Minimum value: 0, maximum value: 1000, default value: 0.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-MAX_DOT_GRAPH_DEPTH = 0
-
-# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
-# background. This is disabled by default, because dot on Windows does not seem
-# to support this out of the box.
-#
-# Warning: Depending on the platform used, enabling this option may lead to
-# badly anti-aliased labels on the edges of a graph (i.e. they become hard to
-# read).
-# The default value is: NO.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOT_TRANSPARENT = NO
-
-# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
-# files in one run (i.e. multiple -o and -T options on the command line). This
-# makes dot run faster, but since only newer versions of dot (>1.8.10) support
-# this, this feature is disabled by default.
-# The default value is: NO.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOT_MULTI_TARGETS = NO
-
-# If the GENERATE_LEGEND tag is set to YES doxygen will generate a legend page
-# explaining the meaning of the various boxes and arrows in the dot generated
-# graphs.
-# The default value is: YES.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-GENERATE_LEGEND = YES
-
-# If the DOT_CLEANUP tag is set to YES doxygen will remove the intermediate dot
-# files that are used to generate the various graphs.
-# The default value is: YES.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOT_CLEANUP = YES
diff --git a/peripheral/libmraa/DoxygenLayout.xml b/peripheral/libmraa/DoxygenLayout.xml
deleted file mode 100644
index 8af4aac..0000000
--- a/peripheral/libmraa/DoxygenLayout.xml
+++ /dev/null
@@ -1,194 +0,0 @@
-<doxygenlayout version="1.0">
- <!-- Generated by doxygen 1.8.7 -->
- <!-- Navigation index tabs for HTML output -->
- <navindex>
- <tab type="mainpage" visible="yes" title=""/>
- <tab type="pages" visible="yes" title="" intro=""/>
- <tab type="modules" visible="yes" title="" intro=""/>
- <tab type="namespaces" visible="yes" title="">
- <tab type="namespacelist" visible="yes" title="" intro=""/>
- <tab type="namespacemembers" visible="yes" title="" intro=""/>
- </tab>
- <tab type="classes" visible="yes" title="">
- <tab type="classlist" visible="yes" title="" intro=""/>
- <tab type="classindex" visible="$ALPHABETICAL_INDEX" title=""/>
- <tab type="hierarchy" visible="yes" title="" intro=""/>
- <tab type="classmembers" visible="yes" title="" intro=""/>
- </tab>
- <tab type="files" visible="yes" title="">
- <tab type="filelist" visible="yes" title="" intro=""/>
- <tab type="globals" visible="yes" title="" intro=""/>
- </tab>
- <tab type="examples" visible="yes" title="" intro=""/>
- </navindex>
-
- <!-- Layout definition for a class page -->
- <class>
- <briefdescription visible="no"/>
- <includes visible="$SHOW_INCLUDE_FILES"/>
- <inheritancegraph visible="$CLASS_GRAPH"/>
- <collaborationgraph visible="$COLLABORATION_GRAPH"/>
- <detaileddescription title=""/>
- <memberdecl>
- <nestedclasses visible="yes" title=""/>
- <publictypes title=""/>
- <services title=""/>
- <interfaces title=""/>
- <publicslots title=""/>
- <signals title=""/>
- <publicmethods title=""/>
- <publicstaticmethods title=""/>
- <publicattributes title=""/>
- <publicstaticattributes title=""/>
- <protectedtypes title=""/>
- <protectedslots title=""/>
- <protectedmethods title=""/>
- <protectedstaticmethods title=""/>
- <protectedattributes title=""/>
- <protectedstaticattributes title=""/>
- <packagetypes title=""/>
- <packagemethods title=""/>
- <packagestaticmethods title=""/>
- <packageattributes title=""/>
- <packagestaticattributes title=""/>
- <properties title=""/>
- <events title=""/>
- <privatetypes title=""/>
- <privateslots title=""/>
- <privatemethods title=""/>
- <privatestaticmethods title=""/>
- <privateattributes title=""/>
- <privatestaticattributes title=""/>
- <friends title=""/>
- <related title="" subtitle=""/>
- <membergroups visible="yes"/>
- </memberdecl>
- <memberdef>
- <inlineclasses title=""/>
- <typedefs title=""/>
- <enums title=""/>
- <services title=""/>
- <interfaces title=""/>
- <constructors title=""/>
- <functions title=""/>
- <related title=""/>
- <variables title=""/>
- <properties title=""/>
- <events title=""/>
- </memberdef>
- <allmemberslink visible="yes"/>
- <usedfiles visible="$SHOW_USED_FILES"/>
- <authorsection visible="yes"/>
- </class>
-
- <!-- Layout definition for a namespace page -->
- <namespace>
- <briefdescription visible="yes"/>
- <memberdecl>
- <nestednamespaces visible="yes" title=""/>
- <constantgroups visible="yes" title=""/>
- <classes visible="yes" title=""/>
- <typedefs title=""/>
- <enums title=""/>
- <functions title=""/>
- <variables title=""/>
- <membergroups visible="yes"/>
- </memberdecl>
- <detaileddescription title=""/>
- <memberdef>
- <inlineclasses title=""/>
- <typedefs title=""/>
- <enums title=""/>
- <functions title=""/>
- <variables title=""/>
- </memberdef>
- <authorsection visible="yes"/>
- </namespace>
-
- <!-- Layout definition for a file page -->
- <file>
- <briefdescription visible="no"/>
- <detaileddescription title="API Description"/>
- <sourcelink visible="yes"/>
- <memberdecl>
- <classes visible="yes" title=""/>
- <namespaces visible="yes" title=""/>
- <functions title=""/>
- <constantgroups visible="yes" title=""/>
- <defines title=""/>
- <typedefs title=""/>
- <enums title=""/>
- <variables title=""/>
- <membergroups visible="yes"/>
- </memberdecl>
- <memberdef>
- <inlineclasses title=""/>
- <functions title=""/>
- <defines title=""/>
- <typedefs title=""/>
- <enums title=""/>
- <variables title=""/>
- </memberdef>
- <includegraph visible="$INCLUDE_GRAPH"/>
- <includes visible="$SHOW_INCLUDE_FILES"/>
- <includedbygraph visible="$INCLUDED_BY_GRAPH"/>
- <authorsection/>
- </file>
-
- <!-- Layout definition for a group page -->
- <group>
- <briefdescription visible="yes"/>
- <groupgraph visible="$GROUP_GRAPHS"/>
- <memberdecl>
- <nestedgroups visible="yes" title=""/>
- <dirs visible="yes" title=""/>
- <files visible="yes" title=""/>
- <namespaces visible="yes" title=""/>
- <classes visible="yes" title=""/>
- <defines title=""/>
- <typedefs title=""/>
- <enums title=""/>
- <enumvalues title=""/>
- <functions title=""/>
- <variables title=""/>
- <signals title=""/>
- <publicslots title=""/>
- <protectedslots title=""/>
- <privateslots title=""/>
- <events title=""/>
- <properties title=""/>
- <friends title=""/>
- <membergroups visible="yes"/>
- </memberdecl>
- <detaileddescription title=""/>
- <memberdef>
- <pagedocs/>
- <inlineclasses title=""/>
- <defines title=""/>
- <typedefs title=""/>
- <enums title=""/>
- <enumvalues title=""/>
- <functions title=""/>
- <variables title=""/>
- <signals title=""/>
- <publicslots title=""/>
- <protectedslots title=""/>
- <privateslots title=""/>
- <events title=""/>
- <properties title=""/>
- <friends title=""/>
- </memberdef>
- <authorsection visible="yes"/>
- </group>
-
- <!-- Layout definition for a directory page -->
- <directory>
- <briefdescription visible="yes"/>
- <directorygraph visible="yes"/>
- <memberdecl>
- <dirs visible="yes"/>
- <files visible="yes"/>
- </memberdecl>
- <detaileddescription title=""/>
- </directory>
-</doxygenlayout>
diff --git a/peripheral/libmraa/README.md b/peripheral/libmraa/README.md
deleted file mode 100644
index c515997..0000000
--- a/peripheral/libmraa/README.md
+++ /dev/null
@@ -1,106 +0,0 @@
-libmraa - Low Level Skeleton Library for Communication on GNU/Linux platforms
-==============
-
-Libmraa is a C/C++ library with bindings to javascript & python 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
-runtime you can create portable code that will work across the supported
-platforms.
-
-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.
-
-Supported Boards
-================
-
-X86
----
-* [Galileo Gen 1 - Rev D](../master/docs/galileorevd.md)
-* [Galileo Gen 2 - Rev H](../master/docs/galileorevh.md)
-* [Edison](../master/docs/edison.md)
-* [Intel DE3815](../master/docs/intel_de3815.md)
-* [Minnowboard Max](../master/docs/minnow_max.md)
-* [NUC 5th generation](../master/docs/intel_nuc5.md)
-* [UP](../master/docs/up.md)
-
-ARM
----
-* [Raspberry Pi](../master/docs/raspberry_pi.md)
-* [Bannana Pi](../master/docs/banana_pi.md)
-* [Beaglebone Black](../master/docs/beaglebone.md)
-
-USB
----
-* [FT4222](../master/docs/ftdi_ft4222.md)
-
-Installing on your board
-========
-
-See the section below on compiling or use our repository to install on a glibc
-based yocto poky image that supports opkg. Adding this repository is as simple
-as and you'll have the latest stable tagged build of mraa installed!
-
-``` bash
-echo "src mraa-upm http://iotdk.intel.com/repos/3.0/intelgalactic/opkg/i586" > /etc/opkg/mraa-upm.conf
-opkg update
-opkg install mraa
-```
-
-If you would like to get the latest & greatest builds from master HEAD you can
-use our -dev repository
-
-```bash
-echo "src mraa-upm http://iotdk.intel.com/repos/3.0/intelgalactic-dev/opkg/i586" > /etc/opkg/mraa-upm.conf
-opkg update
-opkg install mraa
-```
-
-You can also install just the node.js mraa module by using npm. You will need a
-C++ compiler and the node development headers, however it's not required to
-have SWIG installed.
-
-```bash
-npm install mraa
-```
-
-Compiling
-=========
-
-See documentation on [building](../master/docs/building.md)
-
-Examples
-========
-
-See the [examples](../../tree/master/examples) available for various languages
-
-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 [debugging](../master/docs/debugging.md) page too.
-
-API Documentation
-=================
-
-<a href="http://c.mraa.io"><img src="http://iotdk.intel.com/misc/logos/c++.png"/></a>
-<a href="http://java.mraa.io"><img src="http://iotdk.intel.com/misc/logos/java.png"/></a>
-<a href="http://py.mraa.io"><img src="http://iotdk.intel.com/misc/logos/python.png"/></a>
-<a href="http://js.mraa.io"><img src="http://iotdk.intel.com/misc/logos/node.png"/></a>
-
-Contact Us
-==========
-
-To ask questions either file issues in github or send emails on our [mailing
-list](https://lists.01.org/mailman/listinfo/mraa). You might also catch us on
-the mraa channel on freenode IRC.
-
-See the [Contribution](CONTRIBUTING.md) documentation for more details.
-
-Changelog
-=========
-
-Version changelog [here](docs/changelog.md).
diff --git a/peripheral/libmraa/api/mraa.h b/peripheral/libmraa/api/mraa.h
deleted file mode 100644
index b3b0d59..0000000
--- a/peripheral/libmraa/api/mraa.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Author: Brendan Le Foll <brendan.le.foll@intel.com>
- * Copyright © 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.
- */
-
-#pragma once
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "mraa/pwm.h"
-#include "mraa/aio.h"
-#include "mraa/gpio.h"
-#include "mraa/spi.h"
-#include "mraa/i2c.h"
-#include "mraa/uart.h"
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/peripheral/libmraa/api/mraa.hpp b/peripheral/libmraa/api/mraa.hpp
deleted file mode 100644
index 41685a5..0000000
--- a/peripheral/libmraa/api/mraa.hpp
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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.
- */
-
-#pragma once
-
-#include "mraa/common.hpp"
-#include "mraa/pwm.hpp"
-#include "mraa/aio.hpp"
-#include "mraa/gpio.hpp"
-#include "mraa/i2c.hpp"
-#include "mraa/spi.hpp"
-#include "mraa/uart.hpp"
diff --git a/peripheral/libmraa/api/mraa/aio.h b/peripheral/libmraa/api/mraa/aio.h
deleted file mode 100644
index 753c907..0000000
--- a/peripheral/libmraa/api/mraa/aio.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * 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.
- */
-
-#pragma once
-/**
- * @file
- * @brief Analog input/output
- *
- * AIO is the anlog input & output interface to libmraa. It is used to read or
- * set the voltage applied to an AIO pin.
- *
- * @snippet analogin_a0.c Interesting
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdio.h>
-#include <unistd.h>
-#include <stdint.h>
-
-#include "common.h"
-#include "gpio.h"
-
-/**
- * Opaque pointer definition to the internal struct _aio. This context refers
- * to one single AIO pin on the board.
- */
-typedef struct _aio* mraa_aio_context;
-
-/**
- * Initialise an Analog input device, connected to the specified pin
- *
- * @param pin Channel number to read ADC inputs
- * @returns aio context or NULL
- */
-mraa_aio_context mraa_aio_init(unsigned int pin);
-
-/**
- * Read the input voltage. By default mraa will shift
- * the raw value up or down to a 10 bit value.
- *
- * @param dev The AIO context
- * @returns The current input voltage.
- */
-unsigned int mraa_aio_read(mraa_aio_context dev);
-
-/**
- * Read the input voltage and return it as a normalized float (0.0f-1.0f).
- *
- * @param dev The AIO context
- * @returns The current input voltage as a normalized float (0.0f-1.0f)
- */
-float mraa_aio_read_float(mraa_aio_context dev);
-
-/**
- * Close the analog input context, this will free the memory for the context
- *
- * @param dev The AIO context
- * @return Result of operation
- */
-mraa_result_t mraa_aio_close(mraa_aio_context dev);
-
-/**
- * Set the bit value which mraa will shift the raw reading
- * from the ADC to. I.e. 10bits
- * @param dev the analog input context
- * @param bits the bits the return from read should be i.e 10
- *
- * @return mraa result type
- */
-mraa_result_t mraa_aio_set_bit(mraa_aio_context dev, int bits);
-
-/**
- * Gets the bit value mraa is shifting the analog read to.
- * @param dev the analog input context
- *
- * @return bit value mraa is set return from the read function
- */
-int mraa_aio_get_bit(mraa_aio_context dev);
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/peripheral/libmraa/api/mraa/aio.hpp b/peripheral/libmraa/api/mraa/aio.hpp
deleted file mode 100644
index 9b07854..0000000
--- a/peripheral/libmraa/api/mraa/aio.hpp
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * 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.
- */
-
-#pragma once
-
-#include <stdexcept>
-#include "aio.h"
-#include "types.hpp"
-
-namespace mraa
-{
-
-/**
- * @brief API to Analog IO
- *
- * This file defines the aio interface for libmraa
- *
- * @snippet AioA0.cpp Interesting
- */
-class Aio
-{
- public:
- /**
- * Aio Constructor, takes a pin number which will map directly to the
- * board number
- *
- * @param pin channel number to read ADC inputs
- */
- Aio(unsigned int pin)
- {
- m_aio = mraa_aio_init(pin);
- if (m_aio == NULL) {
- throw std::invalid_argument("Invalid AIO pin specified - do you have an ADC?");
- }
- }
- /**
- * Aio destructor
- */
- ~Aio()
- {
- mraa_aio_close(m_aio);
- }
- /**
- * Read a value from the AIO pin. By default mraa will shift
- * the raw value up or down to a 10 bit value.
- *
- * @returns The current input voltage. By default, a 10bit value
- */
- int
- read()
- {
- return mraa_aio_read(m_aio);
- }
- /**
- * Read a value from the AIO pin and return it as a normalized float.
- *
- * @returns The current input voltage as a normalized float (0.0f-1.0f)
- */
- float
- readFloat()
- {
- return mraa_aio_read_float(m_aio);
- }
- /**
- * Set the bit value which mraa will shift the raw reading
- * from the ADC to. I.e. 10bits
- * @param bits the bits the return from read should be i.e 10
- * @return mraa::Result type
- */
- Result
- setBit(int bits)
- {
- return (Result) mraa_aio_set_bit(m_aio, bits);
- }
- /**
- * Gets the bit value mraa is shifting the analog read to.
- *
- * @return bit value mraa is set return from the read function
- */
- int
- getBit()
- {
- return mraa_aio_get_bit(m_aio);
- }
-
- private:
- mraa_aio_context m_aio;
-};
-}
diff --git a/peripheral/libmraa/api/mraa/common.h b/peripheral/libmraa/api/mraa/common.h
deleted file mode 100644
index 0357f0c..0000000
--- a/peripheral/libmraa/api/mraa/common.h
+++ /dev/null
@@ -1,283 +0,0 @@
-/*
- * Author: Brendan Le Foll <brendan.le.foll@intel.com>
- * Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
- * Copyright © 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.
- */
-
-#pragma once
-
-#include <stdint.h>
-#include "types.h"
-
-#define MRAA_PLATFORM_NAME_MAX_SIZE 64
-#define MRAA_PIN_NAME_SIZE 12
-
-#define MRAA_SUB_PLATFORM_BIT_SHIFT 9
-#define MRAA_SUB_PLATFORM_MASK (1<<MRAA_SUB_PLATFORM_BIT_SHIFT)
-
-#define MRAA_MAIN_PLATFORM_OFFSET 0
-#define MRAA_SUB_PLATFORM_OFFSET 1
-
-/** Executes function func and returns its result in case of error
- */
-#define MRAA_RETURN_FOR_ERROR(func) do { \
- mraa_result_t res; \
- res = func; \
- if (res != MRAA_SUCCESS) \
- return res;} while(0)
-
-/** @file
- *
- * This file defines the basic shared values for libmraa
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * MRAA boolean type
- * 1 For TRUE
- */
-typedef unsigned int mraa_boolean_t;
-
-/**
- * Initialise MRAA
- *
- * Detects running platform and attempts to use included pinmap, this is run on
- * module/library init/load but is handy to rerun to check board initialised
- * correctly. MRAA_SUCCESS inidicates correct (first time) initialisation
- * whilst MRAA_ERROR_PLATFORM_ALREADY_INITIALISED indicates the board is
- * already initialised correctly
- *
- * @return Result of operation
- */
-#if (defined SWIGPYTHON) || (defined SWIG)
-mraa_result_t mraa_init();
-#else
-// this sets a compiler attribute (supported by GCC & clang) to have mraa_init()
-// be called as a constructor make sure your libc supports this! uclibc needs
-// to be compiled with UCLIBC_CTOR_DTOR
-mraa_result_t mraa_init() __attribute__((constructor));
-#endif
-
-/**
- * De-Initilise MRAA
- *
- * This is not a strict requirement but useful to test memory leaks and for
- * people who like super clean code. If dynamically loading & unloading
- * libmraa you need to call this before unloading the library.
- */
-void mraa_deinit();
-
-/**
- * Checks if a pin is able to use the passed in mode.
- *
- * @param pin Physical Pin to be checked.
- * @param mode the mode to be tested.
- * @return boolean if the mode is supported, 0=false.
- */
-mraa_boolean_t mraa_pin_mode_test(int pin, mraa_pinmodes_t mode);
-
-/**
- * Check the board's bit size when reading the value
- *
- * @return raw bits being read from kernel module. zero if no ADC
- */
-unsigned int mraa_adc_raw_bits();
-
-/**
- * Check the specified board's bit size when reading the value
- *
- * @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);
-
-/**
- * Return value that the raw value should be shifted to. Zero if no ADC
- *
- * @return return actual bit size the adc value should be understood as.
- */
-unsigned int mraa_adc_supported_bits();
-
-/**
- * Return value that the raw value should be shifted to. Zero if no ADC
- *
- * @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);
-
-/**
- * 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.
- *
- * @return Result of operation
- */
-mraa_result_t mraa_set_log_level(int level);
-
-/**
- * Return the Platform's Name, If no platform detected return NULL
- *
- * @return platform name
- */
-const char* mraa_get_platform_name();
-
-/**
- * Return the platform's versioning info, the information given depends per
- * platform and can be NULL. platform_offset has to be given. Do not modify
- * this pointer
- *
- * @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);
-
-/**
- * This function attempts to set the mraa process to a given priority and the
- * scheduler to SCHED_RR. Highest * priority is typically 99 and minimum is 0.
- * This function * will set to MAX if * priority is > MAX. Function will return
- * -1 on failure.
- *
- * @param priority Value from typically 0 to 99
- * @return The priority value set
- */
-int mraa_set_priority(const unsigned int priority);
-
-/** Get the version string of mraa autogenerated from git tag
- *
- * The version returned may not be what is expected however it is a reliable
- * number associated with the git tag closest to that version at build time
- *
- * @return version string from version.h
- */
-const char* mraa_get_version();
-
-/**
- * Print a textual representation of the mraa_result_t
- *
- * @param result the result to print
- */
-void mraa_result_print(mraa_result_t result);
-
-/**
- * Get platform type, board must be initialised.
- *
- * @return mraa_platform_t Platform type enum
- */
-mraa_platform_t mraa_get_platform_type();
-
-/**
- * Get combined platform type, board must be initialised.
- * The combined type is represented as
- * (sub_platform_type << 8) | main_platform_type
- *
- * @return int combined platform type
- */
-int mraa_get_platform_combined_type();
-
-/**
- * Get platform pincount, board must be initialised.
- *
- * @return uint of physical pin count on the in-use platform
- */
-unsigned int mraa_get_pin_count();
-
-/**
- * Get platform usable I2C bus count, board must be initialised.
- *
- * @return number f usable I2C bus count on the current platform. Function will
- * return -1 on failure
- */
-int mraa_get_i2c_bus_count();
-
-/**
- * Get I2C adapter number in sysfs.
- *
- * @param i2c_bus the logical I2C bus number
- * @return I2C adapter number in sysfs. Function will return -1 on failure
- */
-int mraa_get_i2c_bus_id(unsigned int i2c_bus);
-
-/**
- * Get specified platform pincount, board must be initialised.
- *
- * @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);
-
-/**
-* Get name of pin, board must be initialised.
-*
-* @param pin number
-* @return char* of pin name
-*/
-char* mraa_get_pin_name(int pin);
-
-/**
- * Get default i2c bus, board must be initialised.
- *
- * @return int default i2c bus index
- */
-int mraa_get_default_i2c_bus(uint8_t platform_offset);
-
-/**
- * Detect presence of sub platform.
- *
- * @return mraa_boolean_t 1 if sub platform is present and initialized, 0 otherwise
- */
-mraa_boolean_t mraa_has_sub_platform();
-
-
-/**
- * Check if pin or bus id includes sub platform mask.
- *
- * @param int pin or bus number
- *
- * @return mraa_boolean_t 1 if pin or bus is for sub platform, 0 otherwise
- */
-mraa_boolean_t mraa_is_sub_platform_id(int pin_or_bus_id);
-
-/**
- * Convert pin or bus index to corresponding sub platform id.
- *
- * @param int pin or bus index
- *
- * @return int sub platform pin or bus number
- */
-int mraa_get_sub_platform_id(int pin_or_bus_index);
-
-/**
- * Convert pin or bus sub platform id to index.
- *
- * @param int sub platform pin or bus id
- *
- * @return int pin or bus index
- */
-int mraa_get_sub_platform_index(int pin_or_bus_id);
-
-
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/peripheral/libmraa/api/mraa/common.hpp b/peripheral/libmraa/api/mraa/common.hpp
deleted file mode 100644
index 26f4a60..0000000
--- a/peripheral/libmraa/api/mraa/common.hpp
+++ /dev/null
@@ -1,293 +0,0 @@
-/*
- * Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#pragma once
-
-#include "common.h"
-#include "types.hpp"
-#include <string>
-
-/**
- * @namespace mraa namespace
- */
-namespace mraa
-{
-
-/**
- * @file
- * @brief API to common functions of MRAA
- *
- * This file defines the interface for libmraa common functions
- */
-
-/**
- * Initialise MRAA
- *
- * Detects running platform and attempts to use included pinmap, this is run on
- * module/library init/load but is handy to rerun to check board initialised
- * correctly. MRAA_SUCCESS inidicates correct (first time) initialisation
- * whilst MRAA_ERROR_PLATFORM_ALREADY_INITIALISED indicates the board is
- * already initialised correctly
- *
- * @return Result of operation
- */
-inline Result
-init()
-{
- return (Result) mraa_init();
-}
-
-/**
- * Get libmraa version.
- *
- * @return libmraa version (e.g. v0.4.0-20-gb408207)
- */
-inline std::string
-getVersion()
-{
- std::string ret = mraa_get_version();
- return ret;
-}
-
-/**
- * This function attempts to set the mraa process to a given priority and the
- * scheduler to SCHED_RR. Highest * priority is typically 99 and minimum is 0.
- * This function * will set to MAX if * priority is > MAX. Function will return
- * -1 on failure.
- *
- * @param priority Value from typically 0 to 99
- * @return The priority value set
- */
-inline int
-setPriority(const unsigned int priority)
-{
- return mraa_set_priority(priority);
-}
-
-/**
- * Get platform type, board must be initialised.
- *
- * @return mraa::platform Platform type enum
- */
-inline Platform
-getPlatformType()
-{
- return (Platform) mraa_get_platform_type();
-}
-
-/**
- * Print a textual representation of the mraa::Result
- *
- * @param Result the Result to print
- */
-inline void
-printError(Result result)
-{
- mraa_result_print((mraa_result_t) result);
-}
-
-/**
- * Checks if a pin is able to use the passed in mode.
- *
- * @param pin Physical Pin to be checked.
- * @param mode the mode to be tested.
- * @return boolean if the mode is supported, 0=false.
- */
-inline bool
-pinModeTest(int pin, Pinmodes mode)
-{
- return (bool) mraa_pin_mode_test(pin, (mraa_pinmodes_t) mode);
-}
-
-/**
- * Check the board's bit size when reading the value
- *
- * @return raw bits being read from kernel module. Zero if no ADC
- */
-inline unsigned int
-adcRawBits()
-{
- return mraa_adc_raw_bits();
-}
-
-/**
- * Return value that the raw value should be shifted to. Zero if no ADC
- *
- * @return return actual bit size the adc value should be understood as.
- */
-inline unsigned int
-adcSupportedBits()
-{
- return mraa_adc_supported_bits();
-}
-
-/**
- * Return Platform Name. Returns NULL if no platform inited.
- *
- * @return platform name
- */
-inline std::string
-getPlatformName()
-{
- std::string ret_val(mraa_get_platform_name());
- return ret_val;
-}
-
-/**
- * Return platform versioning info. Returns NULL if no info present.
- *
- * @param optional subplatform identifier
- * @return platform versioning info
- */
-inline std::string
-getPlatformVersion(int platform_offset=MRAA_MAIN_PLATFORM_OFFSET)
-{
- std::string ret_val(mraa_get_platform_version(platform_offset));
- return ret_val;
-}
-
-/**
- * Return count of physical pins on the running platform
- *
- * @return uint of physical pins.
- */
-inline unsigned int
-getPinCount()
-{
- return mraa_get_pin_count();
-}
-
-/**
- * Get platform usable I2C bus count, board must be initialised.
- *
- * @return number f usable I2C bus count on the current platform. Function will
- * return -1 on failure
- */
-inline int
-getI2cBusCount()
-{
- return mraa_get_i2c_bus_count();
-}
-
-/**
- * Get I2C adapter number in sysfs.
- *
- * @param i2c_bus the logical I2C bus number
- * @return I2C adapter number in sysfs. Function will return -1 on failure
- */
-inline int
-getI2cBusId(unsigned int i2c_bus)
-{
- return mraa_get_i2c_bus_id(i2c_bus);
-}
-
-/**
-* Get name of pin, board must be initialised.
-*
-* @param pin number
-*
-* @return char* of pin name
-*/
-inline std::string
-getPinName(int pin)
-{
- std::string ret_val(mraa_get_pin_name(pin));
- return ret_val;
-}
-
-/**
- * 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.
- *
- * @param level
- * @return Result of operation
- */
-inline Result
-setLogLevel(int level)
-{
- return (Result) mraa_set_log_level(level);
-}
-
-/**
- * Detect presence of sub platform.
- *
- * @return bool true if sub platform is present and initialized, false otherwise
- */
-inline bool
-hasSubPlatform()
-{
- return static_cast<bool>(mraa_has_sub_platform());
-}
-
-/**
- * Check if pin or bus id includes sub platform mask.
- *
- * @param int pin or bus number
- *
- * @return mraa_boolean_t 1 if pin or bus is for sub platform, 0 otherwise
- */
-inline bool
-isSubPlatformId(int pin_or_bus_id)
-{
- return static_cast<bool>(mraa_is_sub_platform_id(pin_or_bus_id));
-}
-
-/**
- * Convert pin or bus index to corresponding sub platform id.
- *
- * @param int pin or bus index
- *
- * @return int sub platform pin or bus number
- */
-inline int
-getSubPlatformId(int pin_or_bus_index)
-{
- return mraa_get_sub_platform_id(pin_or_bus_index);
-}
-
-/**
- * Convert pin or bus sub platform id to index.
- *
- * @param int sub platform pin or bus id
- *
- * @return int pin or bus index
- */
-inline int
-getSubPlatformIndex(int pin_or_bus_id)
-{
- return mraa_get_sub_platform_index(pin_or_bus_id);
-}
-
-/**
- * Get default i2c bus, board must be initialised.
- *
- * @param optional subplatform identifier
- * @return default i2c bus for paltform
- */
-inline int
-getDefaultI2cBus(int platform_offset=MRAA_MAIN_PLATFORM_OFFSET)
-{
- return mraa_get_default_i2c_bus(platform_offset);
-}
-}
diff --git a/peripheral/libmraa/api/mraa/gpio.h b/peripheral/libmraa/api/mraa/gpio.h
deleted file mode 100644
index 2287c0c..0000000
--- a/peripheral/libmraa/api/mraa/gpio.h
+++ /dev/null
@@ -1,229 +0,0 @@
-/*
- * Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#pragma once
-
-/**
- * @file
- * @brief General Purpose IO
- *
- * Gpio is the General Purpose IO interface to libmraa. Its features depend on
- * the board type used, it can use gpiolibs (exported via a kernel module
- * through sysfs), or memory mapped IO via a /dev/uio device or /dev/mem
- * depending again on the board configuration.
- *
- * @snippet gpio_read6.c Interesting
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifdef SWIGPYTHON
-#include <Python.h>
-#endif
-
-#if defined(SWIGJAVA) || defined(JAVACALLBACK)
-#include <jni.h>
-extern JavaVM *globVM;
-extern void mraa_java_isr_callback(void *);
-#endif
-
-#include <stdio.h>
-#include <pthread.h>
-
-#include "common.h"
-
-/**
- * Opaque pointer definition to the internal struct _gpio
- */
-typedef struct _gpio* mraa_gpio_context;
-
-/**
- * Gpio Output modes
- */
-typedef enum {
- MRAA_GPIO_STRONG = 0, /**< Default. Strong high and low */
- MRAA_GPIO_PULLUP = 1, /**< Resistive High */
- MRAA_GPIO_PULLDOWN = 2, /**< Resistive Low */
- MRAA_GPIO_HIZ = 3 /**< High Z State */
-} mraa_gpio_mode_t;
-
-/**
- * Gpio Direction options
- */
-typedef enum {
- MRAA_GPIO_OUT = 0, /**< Output. A Mode can also be set */
- MRAA_GPIO_IN = 1, /**< Input */
- MRAA_GPIO_OUT_HIGH = 2, /**< Output. Init High */
- MRAA_GPIO_OUT_LOW = 3 /**< Output. Init Low */
-} mraa_gpio_dir_t;
-
-/**
- * Gpio Edge types for interupts
- */
-typedef enum {
- MRAA_GPIO_EDGE_NONE = 0, /**< No interrupt on Gpio */
- MRAA_GPIO_EDGE_BOTH = 1, /**< Interupt on rising & falling */
- MRAA_GPIO_EDGE_RISING = 2, /**< Interupt on rising only */
- MRAA_GPIO_EDGE_FALLING = 3 /**< Interupt on falling only */
-} mraa_gpio_edge_t;
-
-/**
- * Initialise gpio_context, based on board number
- *
- * @param pin Pin number read from the board, i.e IO3 is 3
- * @returns gpio context or NULL
- */
-mraa_gpio_context mraa_gpio_init(int pin);
-
-/**
- * Initialise gpio context without any mapping to a pin
- *
- * @param gpiopin gpio pin as listed in SYSFS
- * @return gpio context or NULL
- */
-mraa_gpio_context mraa_gpio_init_raw(int gpiopin);
-
-/**
- * Set the edge mode on the gpio
- *
- * @param dev The Gpio context
- * @param mode The edge mode to set the gpio into
- * @return Result of operation
- */
-mraa_result_t mraa_gpio_edge_mode(mraa_gpio_context dev, mraa_gpio_edge_t mode);
-
-/**
- * Set an interupt on pin
- *
- * @param dev The Gpio context
- * @param edge The edge mode to set the gpio into
- * @param fptr Function pointer to function to be called when interupt is
- * triggered
- * @param args Arguments passed to the interrupt handler (fptr)
- * @return Result of operation
- */
-mraa_result_t mraa_gpio_isr(mraa_gpio_context dev, mraa_gpio_edge_t edge, void (*fptr)(void*), void* args);
-
-/**
- * Stop the current interupt watcher on this Gpio, and set the Gpio edge mode
- * to MRAA_GPIO_EDGE_NONE
- *
- * @param dev The Gpio context
- * @return Result of operation
- */
-mraa_result_t mraa_gpio_isr_exit(mraa_gpio_context dev);
-
-/**
- * Set Gpio Output Mode,
- *
- * @param dev The Gpio context
- * @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 direction
- *
- * @param dev The Gpio context
- * @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 direction
- *
- * @param dev The Gpio context
- * @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
- *
- * @param dev The Gpio context
- * @return Result of operation
- */
-mraa_result_t mraa_gpio_close(mraa_gpio_context dev);
-
-/**
- * Read the Gpio value. This can be 0 or 1. A resonse of -1 means that there
- * was a fatal error.
- *
- * @param dev The Gpio context
- * @return Result of operation
- */
-int mraa_gpio_read(mraa_gpio_context dev);
-
-/**
- * Write to the Gpio Value.
- *
- * @param dev The Gpio context
- * @param value Integer value to write
- * @return Result of operation
- */
-mraa_result_t mraa_gpio_write(mraa_gpio_context dev, int value);
-
-/**
- * Change ownership of the context.
- *
- * @param dev The Gpio context
- * @param owner Does this context own the pin
- * @return Result of operation
- */
-mraa_result_t mraa_gpio_owner(mraa_gpio_context dev, mraa_boolean_t owner);
-
-/**
- * Enable using memory mapped io instead of sysfs
- *
- * @param dev The Gpio context
- * @param mmap Use mmap instead of sysfs
- * @return Result of operation
- */
-mraa_result_t mraa_gpio_use_mmaped(mraa_gpio_context dev, mraa_boolean_t mmap);
-
-/**
- * Get a pin number of the gpio, invalid will return -1
- *
- * @param dev The Gpio context
- * @return Pin number
- */
-int mraa_gpio_get_pin(mraa_gpio_context dev);
-
-/**
- * Get a gpio number as used within sysfs, invalid will return -1
- *
- * @param dev The Gpio context
- * @return gpio number
- */
-int mraa_gpio_get_pin_raw(mraa_gpio_context dev);
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/peripheral/libmraa/api/mraa/gpio.hpp b/peripheral/libmraa/api/mraa/gpio.hpp
deleted file mode 100644
index 98693ac..0000000
--- a/peripheral/libmraa/api/mraa/gpio.hpp
+++ /dev/null
@@ -1,312 +0,0 @@
-/*
- * 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.
- */
-
-#pragma once
-
-#include "gpio.h"
-#include "types.hpp"
-#include <stdexcept>
-
-#if defined(SWIGJAVASCRIPT)
-#if NODE_MODULE_VERSION >= 0x000D
-#include <uv.h>
-#endif
-#endif
-
-namespace mraa
-{
-
-// These enums must match the enums in gpio.h
-
-/**
- * Gpio Output modes
- */
-typedef enum {
- MODE_STRONG = 0, /**< Default. Strong High and Low */
- MODE_PULLUP = 1, /**< Resistive High */
- MODE_PULLDOWN = 2, /**< Resistive Low */
- MODE_HIZ = 3 /**< High Z State */
-} Mode;
-
-/**
- * Gpio Direction options
- */
-typedef enum {
- DIR_OUT = 0, /**< Output. A Mode can also be set */
- DIR_IN = 1, /**< Input */
- DIR_OUT_HIGH = 2, /**< Output. Init High */
- DIR_OUT_LOW = 3 /**< Output. Init Low */
-} Dir;
-
-/**
- * Gpio Edge types for interupts
- */
-typedef enum {
- EDGE_NONE = 0, /**< No interrupt on Gpio */
- EDGE_BOTH = 1, /**< Interupt on rising & falling */
- EDGE_RISING = 2, /**< Interupt on rising only */
- EDGE_FALLING = 3 /**< Interupt on falling only */
-} Edge;
-
-/**
- * @brief API to General Purpose IO
- *
- * This file defines the gpio interface for libmraa
- *
- * @snippet Blink-IO.cpp Interesting
- */
-class Gpio
-{
- public:
- /**
- * Instanciates a Gpio object
- *
- * @param pin pin number to use
- * @param owner (optional) Set pin owner, default behaviour is to 'own'
- * the pin if we exported it. This means we will close it on destruct.
- * Otherwise it will get left open. This is only valid in sysfs use
- * cases
- * @param raw (optional) Raw pins will use gpiolibs pin numbering from
- * the kernel module. Note that you will not get any muxers set up for
- * you so this may not always work as expected.
- */
- Gpio(int pin, bool owner = true, bool raw = false)
- {
- if (raw) {
- m_gpio = mraa_gpio_init_raw(pin);
- } else {
- m_gpio = mraa_gpio_init(pin);
- }
-
- if (m_gpio == NULL) {
- throw std::invalid_argument("Invalid GPIO pin specified");
- }
-
- if (!owner) {
- mraa_gpio_owner(m_gpio, 0);
- }
- }
- /**
- * Gpio object destructor, this will only unexport the gpio if we where
- * the owner
- */
- ~Gpio()
- {
- mraa_gpio_close(m_gpio);
- }
- /**
- * Set the edge mode for ISR
- *
- * @param mode The edge mode to set
- * @return Result of operation
- */
- Result
- edge(Edge mode)
- {
- return (Result) mraa_gpio_edge_mode(m_gpio, (mraa_gpio_edge_t) mode);
- }
-#if defined(SWIGPYTHON)
- Result
- isr(Edge mode, PyObject* pyfunc, PyObject* args)
- {
- return (Result) mraa_gpio_isr(m_gpio, (mraa_gpio_edge_t) mode, (void (*) (void*)) pyfunc, (void*) args);
- }
-#elif defined(SWIGJAVASCRIPT)
- static void
- v8isr(uv_work_t* req, int status)
- {
-#if NODE_MODULE_VERSION >= 0x000D
- v8::HandleScope scope(v8::Isolate::GetCurrent());
-#endif
- mraa::Gpio* This = (mraa::Gpio*) req->data;
- int argc = 1;
- v8::Local<v8::Value> argv[] = { SWIGV8_INTEGER_NEW(-1) };
-#if NODE_MODULE_VERSION >= 0x000D
- v8::Local<v8::Function> f = v8::Local<v8::Function>::New(v8::Isolate::GetCurrent(), This->m_v8isr);
- f->Call(SWIGV8_CURRENT_CONTEXT()->Global(), argc, argv);
-#else
- This->m_v8isr->Call(SWIGV8_CURRENT_CONTEXT()->Global(), argc, argv);
-#endif
- delete req;
- }
-
- static void
- nop(uv_work_t* req)
- {
- // Do nothing.
- }
-
- static void
- uvwork(void* ctx)
- {
- uv_work_t* req = new uv_work_t;
- req->data = ctx;
- uv_queue_work(uv_default_loop(), req, nop, v8isr);
- }
-
- Result
- isr(Edge mode, v8::Handle<v8::Function> func)
- {
-#if NODE_MODULE_VERSION >= 0x000D
- m_v8isr.Reset(v8::Isolate::GetCurrent(), func);
-#else
- m_v8isr = v8::Persistent<v8::Function>::New(func);
-#endif
- return (Result) mraa_gpio_isr(m_gpio, (mraa_gpio_edge_t) mode, &uvwork, this);
- }
-#elif defined(SWIGJAVA) || defined(JAVACALLBACK)
- Result
- isr(Edge mode, jobject runnable)
- {
- return (Result) mraa_gpio_isr(m_gpio, (mraa_gpio_edge_t) mode, mraa_java_isr_callback, runnable);
- }
-#endif
- /**
- * Sets a callback to be called when pin value changes
- *
- * @param mode The edge mode to set
- * @param fptr Function pointer to function to be called when interupt is
- * triggered
- * @param args Arguments passed to the interrupt handler (fptr)
- * @return Result of operation
- */
- Result
- isr(Edge mode, void (*fptr)(void*), void* args)
- {
- return (Result) mraa_gpio_isr(m_gpio, (mraa_gpio_edge_t) mode, fptr, args);
- }
-
- /**
- * Exits callback - this call will not kill the isr thread immediatly
- * but only when it is out of it's critical section
- *
- * @return Result of operation
- */
- Result
- isrExit()
- {
-#if defined(SWIGJAVASCRIPT)
-#if NODE_MODULE_VERSION >= 0x000D
- m_v8isr.Reset();
-#else
- m_v8isr.Dispose();
- m_v8isr.Clear();
-#endif
-#endif
- return (Result) mraa_gpio_isr_exit(m_gpio);
- }
- /**
- * Change Gpio mode
- *
- * @param mode The mode to change the gpio into
- * @return Result of operation
- */
- Result
- mode(Mode mode)
- {
- return (Result )mraa_gpio_mode(m_gpio, (mraa_gpio_mode_t) mode);
- }
- /**
- * Change Gpio direction
- *
- * @param dir The direction to change the gpio into
- * @return Result of operation
- */
- Result
- dir(Dir dir)
- {
- return (Result )mraa_gpio_dir(m_gpio, (mraa_gpio_dir_t) dir);
- }
-
- /**
- * Read Gpio direction
- *
- * @throw std::runtime_error in case of failure
- * @return Result of operation
- */
- Dir
- readDir()
- {
- mraa_gpio_dir_t dir;
- if (mraa_gpio_read_dir(m_gpio, &dir) != MRAA_SUCCESS) {
- throw std::runtime_error("Failed to read direction");
- }
- return (Dir) dir;
- }
-
- /**
- * Read value from Gpio
- *
- * @return Gpio value
- */
- int
- read()
- {
- return mraa_gpio_read(m_gpio);
- }
- /**
- * Write value to Gpio
- *
- * @param value Value to write to Gpio
- * @return Result of operation
- */
- Result
- write(int value)
- {
- return (Result) mraa_gpio_write(m_gpio, value);
- }
- /**
- * Enable use of mmap i/o if available.
- *
- * @param enable true to use mmap
- * @return Result of operation
- */
- Result
- useMmap(bool enable)
- {
- return (Result) mraa_gpio_use_mmaped(m_gpio, (mraa_boolean_t) enable);
- }
- /**
- * Get pin number of Gpio. If raw param is True will return the
- * number as used within sysfs. Invalid will return -1.
- *
- * @param raw (optional) get the raw gpio number.
- * @return Pin number
- */
- int
- getPin(bool raw = false)
- {
- if (raw) {
- return mraa_gpio_get_pin_raw(m_gpio);
- }
- return mraa_gpio_get_pin(m_gpio);
- }
-
- private:
- mraa_gpio_context m_gpio;
-#if defined(SWIGJAVASCRIPT)
- v8::Persistent<v8::Function> m_v8isr;
-#endif
-};
-}
diff --git a/peripheral/libmraa/api/mraa/i2c.h b/peripheral/libmraa/api/mraa/i2c.h
deleted file mode 100644
index d0dbde2..0000000
--- a/peripheral/libmraa/api/mraa/i2c.h
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * 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.
- */
-
-#pragma once
-
-/**
- * @file
- * @brief Inter-Integrated Circuit
- *
- * An i2c context represents a master on an i2c bus and that context can
- * communicate to multiple i2c slaves by configuring the address.
- * @htmlinclude i2c.txt
- *
- * @snippet i2c_HMC5883L.c Interesting
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <stdint.h>
-
-#include "common.h"
-#include "gpio.h"
-
-/**
- * Opaque pointer definition to the internal struct _i2c
- */
-typedef struct _i2c* mraa_i2c_context;
-
-/**
- * Initialise i2c context, using board defintions
- *
- * @param bus i2c bus to use
- * @return i2c context or NULL
- */
-mraa_i2c_context mraa_i2c_init(int bus);
-
-/**
- * Initialise i2c context, passing in the i2c bus to use.
- *
- * @param bus The i2c bus to use i.e. /dev/i2c-2 would be "2"
- * @return i2c context or NULL
- */
-mraa_i2c_context mraa_i2c_init_raw(unsigned int bus);
-
-/**
- * Sets the frequency of the i2c context. Most platforms do not support this.
- *
- * @param dev The i2c context
- * @param mode The bus mode
- * @return Result of operation
- */
-mraa_result_t mraa_i2c_frequency(mraa_i2c_context dev, mraa_i2c_mode_t mode);
-
-/**
- * Simple bulk read from an i2c context, this will always begin with the i2c
- * offset 0x0
- *
- * @param dev The i2c context
- * @param data pointer to the byte array to read data in to
- * @param length max number of bytes to read
- * @return length of the read in bytes or 0
- */
-int mraa_i2c_read(mraa_i2c_context dev, uint8_t* data, int length);
-
-/**
- * Simple read for a single byte from the i2c context, this will always begin
- * with the i2c offset 0x0
- *
- * @param dev The i2c context
- * @return The result of the read and 0 if failed
- */
-uint8_t mraa_i2c_read_byte(mraa_i2c_context dev);
-
-/**
- * Read a single byte from i2c context, from designated register
- *
- * @param dev The i2c context
- * @param command The register
- * @return The result of the read and 0 if failed
- */
-uint8_t mraa_i2c_read_byte_data(mraa_i2c_context dev, const uint8_t command);
-
-/**
- * Read a single word from i2c context, from designated register
- *
- * @param dev The i2c context
- * @param command The register
- * @return The result of the read and 0 if failed
- */
-uint16_t mraa_i2c_read_word_data(mraa_i2c_context dev, const uint8_t command);
-
-/**
- * Bulk read from i2c context, starting from designated register
- *
- * @param dev The i2c context
- * @param command The register
- * @param data pointer to the byte array to read data in to
- * @param length max number of bytes to read
- * @return The length in bytes passed to the function or -1
- */
-int mraa_i2c_read_bytes_data(mraa_i2c_context dev, uint8_t command, uint8_t* data, int length);
-
-/**
- * Write length bytes to the bus, the first byte in the array is the
- * command/register to write
- *
- * @param dev The i2c context
- * @param data pointer to the byte array to be written
- * @param length the number of bytes to transmit
- * @return Result of operation
- */
-mraa_result_t mraa_i2c_write(mraa_i2c_context dev, const uint8_t* data, int length);
-
-/**
- * Write a single byte to an i2c context, always at offset 0x0
- *
- * @param dev The i2c context
- * @param data The byte to write
- * @return Result of operation
- */
-mraa_result_t mraa_i2c_write_byte(mraa_i2c_context dev, const uint8_t data);
-
-/**
- * Write a single byte to an i2c context
- *
- * @param dev The i2c context
- * @param data The byte to write
- * @param command The register
- * @return Result of operation
- */
-mraa_result_t mraa_i2c_write_byte_data(mraa_i2c_context dev, const uint8_t data, const uint8_t command);
-
-/**
- * Write a single word to an i2c context
- *
- * @param dev The i2c context
- * @param data The word to write
- * @param command The register
- * @return Result of operation
- */
-mraa_result_t mraa_i2c_write_word_data(mraa_i2c_context dev, const uint16_t data, const uint8_t command);
-
-/**
- * Sets the i2c context address.
- *
- * @param dev The i2c context
- * @param address The address to set for the slave (ignoring the least
- * signifcant bit). If set to 0, the slave will only respond to the
- * general call address.
- * @return Result of operation
- */
-mraa_result_t mraa_i2c_address(mraa_i2c_context dev, uint8_t address);
-
-/**
- * De-inits an mraa_i2c_context device
- *
- * @param dev The i2c context
- * @return Result of operation
- */
-mraa_result_t mraa_i2c_stop(mraa_i2c_context dev);
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/peripheral/libmraa/api/mraa/i2c.hpp b/peripheral/libmraa/api/mraa/i2c.hpp
deleted file mode 100644
index cd3c31c..0000000
--- a/peripheral/libmraa/api/mraa/i2c.hpp
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * 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.
- */
-
-#pragma once
-
-#include "i2c.h"
-#include "types.hpp"
-#include <stdexcept>
-
-namespace mraa
-{
-
-/**
- * @brief API to Inter-Integrated Circuit
- *
- * An I2c object represents an i2c master and can talk multiple i2c slaves by
- * selecting the correct address
- * @htmlinclude i2c.txt
- *
- * @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 guarranteed to be on the correct address
- * before read/write.
- *
- * @param bus The i2c bus to use
- * @param raw Whether to disable pinmapper for your board
- */
- I2c(int bus, bool raw = false)
- {
- if (raw) {
- m_i2c = mraa_i2c_init_raw(bus);
- } else {
- m_i2c = mraa_i2c_init(bus);
- }
- if (m_i2c == NULL) {
- throw std::invalid_argument("Invalid i2c bus");
- }
- }
-
- /**
- * 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.
- */
- ~I2c()
- {
- mraa_i2c_stop(m_i2c);
- }
-
- /**
- * Sets the i2c Frequency for communication. Your board may not support
- * the set frequency. Anyone can change this at any time and this will
- * affect every slave on the bus
- *
- * @param mode Frequency to set the bus to
- * @return Result of operation
- */
- Result
- frequency(I2cMode mode)
- {
- return (Result) mraa_i2c_frequency(m_i2c, (mraa_i2c_mode_t) mode);
- }
-
- /**
- * Set the slave to talk to, typically called before every read/write
- * operation
- *
- * @param address Communicate to the i2c slave on this address
- * @return Result of operation
- */
- Result
- address(uint8_t address)
- {
- return (Result) mraa_i2c_address(m_i2c, address);
- }
-
- /**
- * Read exactly one byte from the bus
- *
- * @return char read from the bus
- */
- uint8_t
- readByte()
- {
- return (uint8_t) mraa_i2c_read_byte(m_i2c);
- }
-
- /**
- * Read length bytes from the bus into *data pointer
- *
- * @param data Data to read into
- * @param length Size of read in bytes to make
- * @return length of read, should match length
- */
- int
- read(uint8_t* data, int length)
- {
- return mraa_i2c_read(m_i2c, data, length);
- }
-
- /**
- * Read byte from an i2c register
- *
- * @param reg Register to read from
- * @return char read from register
- */
- uint8_t
- readReg(uint8_t reg)
- {
- return mraa_i2c_read_byte_data(m_i2c, reg);
- }
-
- /**
- * Read word from an i2c register
- *
- * @param reg Register to read from
- * @return char read from register
- */
- uint16_t
- readWordReg(uint8_t reg)
- {
- return mraa_i2c_read_word_data(m_i2c, reg);
- }
-
- /**
- * Read length bytes from the bus into *data pointer starting from
- * an i2c register
- *
- * @param reg Register to read from
- * @param data pointer to the byte array to read data in to
- * @param length max number of bytes to read
- * @return length passed to the function or -1
- */
- int
- readBytesReg(uint8_t reg, uint8_t* data, int length)
- {
- return mraa_i2c_read_bytes_data(m_i2c, reg, data, length);
- }
-
- /**
- * Write a byte on the bus
- *
- * @param data The byte to send on the bus
- * @return Result of operation
- */
- Result
- writeByte(uint8_t data)
- {
- return (Result) mraa_i2c_write_byte(m_i2c, data);
- }
-
- /**
- * Write length bytes to the bus, the first byte in the array is the
- * command/register to write
- *
- * @param data Buffer to send on the bus, first byte is i2c command
- * @param length Size of buffer to send
- * @return Result of operation
- */
- Result
- write(const uint8_t* data, int length)
- {
- return (Result) mraa_i2c_write(m_i2c, data, length);
- }
-
- /**
- * Write a byte to an i2c register
- *
- * @param reg Register to write to
- * @param data Value to write to register
- * @return Result of operation
- */
- Result
- writeReg(uint8_t reg, uint8_t data)
- {
- return (Result) mraa_i2c_write_byte_data(m_i2c, data, reg);
- }
-
- /**
- * Write a word to an i2c register
- *
- * @param reg Register to write to
- * @param data Value to write to register
- * @return Result of operation
- */
- Result
- writeWordReg(uint8_t reg, uint16_t data)
- {
- return (Result) mraa_i2c_write_word_data(m_i2c, data, reg);
- }
-
- private:
- mraa_i2c_context m_i2c;
-};
-}
diff --git a/peripheral/libmraa/api/mraa/iio.h b/peripheral/libmraa/api/mraa/iio.h
deleted file mode 100644
index eadbab9..0000000
--- a/peripheral/libmraa/api/mraa/iio.h
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Author: Brendan Le Foll <brendan.le.foll@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#pragma once
-
-#include "common.h"
-#include "iio_kernel_headers.h"
-
-typedef struct {
- int index;
- int enabled;
- char* type;
- mraa_boolean_t lendian;
- int signedd;
- unsigned int offset;
- uint64_t mask;
- unsigned int bits_used;
- unsigned int bytes;
- unsigned int shift;
- unsigned int location;
-} mraa_iio_channel;
-
-typedef struct {
- char* name;
- int enabled;
-} mraa_iio_event;
-
-/**
- * @file
- * @brief iio
- *
- * An iio context represents an IIO device
- *
- * @snippet iio_driver.c Interesting
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <stdint.h>
-
-#include "common.h"
-
-/**
- * Opaque pointer definition to the internal struct _iio
- */
-typedef struct _iio* mraa_iio_context;
-
-/**
- * Initialise iio context
- *
- * @param bus iio device to use
- * @return i2c context or NULL
- */
-mraa_iio_context mraa_iio_init(int device);
-
-mraa_result_t mraa_iio_trigger_buffer(mraa_iio_context dev, void (*fptr)(char* data), void* args);
-
-const char* mraa_iio_get_device_name(mraa_iio_context dev);
-
-int mraa_iio_get_device_num_by_name(const char* name);
-
-int mraa_iio_read_size(mraa_iio_context dev);
-
-mraa_iio_channel* mraa_iio_get_channels(mraa_iio_context dev);
-
-int mraa_iio_get_channel_count(mraa_iio_context dev);
-
-mraa_result_t mraa_iio_read_float(mraa_iio_context dev, const char* filename, float* data);
-
-mraa_result_t mraa_iio_read_int(mraa_iio_context dev, const char* filename, int* data);
-
-mraa_result_t mraa_iio_read_string(mraa_iio_context dev, const char* filename, char* data, int max_len);
-
-mraa_result_t mraa_iio_write_float(mraa_iio_context dev, const char* attr_chan, const float data);
-
-mraa_result_t mraa_iio_write_int(mraa_iio_context dev, const char* attr_chan, const int data);
-
-mraa_result_t mraa_iio_write_string(mraa_iio_context dev, const char* attr_chan, const char* data);
-
-mraa_result_t mraa_iio_get_channel_data(mraa_iio_context dev);
-
-mraa_result_t mraa_iio_get_event_data(mraa_iio_context dev);
-
-mraa_result_t mraa_iio_event_poll(mraa_iio_context dev, struct iio_event_data* data);
-
-mraa_result_t
-mraa_iio_event_setup_callback(mraa_iio_context dev, void (*fptr)(struct iio_event_data* data, void* args), void* args);
-
-mraa_result_t mraa_iio_event_extract_event(struct iio_event_data* event,
- int* chan_type,
- int* modifier,
- int* type,
- int* direction,
- int* channel,
- int* channel2,
- int* different);
-
-mraa_result_t mraa_iio_get_mounting_matrix(mraa_iio_context dev, float mm[9]);
-
-mraa_result_t mraa_iio_create_trigger(mraa_iio_context dev, const char* trigger);
-
-mraa_result_t mraa_iio_update_channels(mraa_iio_context dev);
-/**
- * De-inits an mraa_iio_context device
- *
- * @param dev The iio context
- * @return Result of operation
- */
-mraa_result_t mraa_iio_close(mraa_iio_context dev);
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/peripheral/libmraa/api/mraa/iio.hpp b/peripheral/libmraa/api/mraa/iio.hpp
deleted file mode 100644
index 9cfbb18..0000000
--- a/peripheral/libmraa/api/mraa/iio.hpp
+++ /dev/null
@@ -1,245 +0,0 @@
-/*
- * Author: Henry Bruce <henry.bruce@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.
- */
-
-#pragma once
-
-#include <stdexcept>
- #include <sstream>
-#include "iio.h"
-#include "types.hpp"
-
-namespace mraa
-{
-
-struct IioEventData
-{
- int channelType;
- int modifier;
- int type;
- int direction;
- int channel;
- int channel2;
- int diff;
-};
-
-class IioHandler
-{
-public:
- virtual void onIioEvent(const IioEventData& eventData) = 0;
-};
-
-
-/**
- * @brief API to Industrial IO
- *
- * This file defines the C++ iio interface for libmraa
- *
- * @snippet iio_dummy_test.cpp Interesting
- */
-class Iio
-{
- public:
- /**
- * Iio Constructor, takes a device number which will map directly to sysfs
- * e.g. device 0 maps to /sys/bus/iio/devices/iio:device0
- *
- * @param device IIO device number
- *
- * @throws std::invalid_argument if initialization fails
- */
- Iio(int device)
- {
- m_iio = mraa_iio_init(device);
- if (m_iio == NULL) {
- std::ostringstream oss;
- oss << "IIO device " << device << " is not valid";
- throw std::invalid_argument(oss.str());
- }
- }
-
- /**
- * Iio Constructor
- *
- * @param deviceName IIO device name
- *
- * @throws std::invalid_argument if initialization fails
- */
- Iio(const std::string& deviceName)
- {
- std::ostringstream oss;
- int id = mraa_iio_get_device_num_by_name(deviceName.c_str());
- if (id == -1) {
- oss << "IIO device name " << deviceName << " not found";
- throw std::invalid_argument(oss.str());
- }
- m_iio = mraa_iio_init(id);
- if (m_iio == NULL) {
- oss << "IIO device " << deviceName << " is not valid";
- throw std::invalid_argument(oss.str());
- }
- }
-
- /**
- * Iio destructor
- */
- ~Iio()
- {
- mraa_iio_close(m_iio);
- }
-
-
- /**
- * Get device name
- *
- * @returns The device name
- */
- std::string
- getDeviceName() const
- {
- return mraa_iio_get_device_name(m_iio);
- }
-
- /**
- * Read an int value from specified attribute.
- *
- * @param attributeName attribute mame
- *
- * @returns The int value
- *
- * @throws std::invalid_argument if read fails
- */
- int
- readInt(const std::string& attributeName) const
- {
- int value;
- mraa_result_t res = mraa_iio_read_int(m_iio, attributeName.c_str(), &value);
- if (res != MRAA_SUCCESS) {
- std::ostringstream oss;
- oss << "IIO readInt for attibute " << attributeName << " failed";
- throw std::runtime_error(oss.str());
- }
- return value;
- }
-
- /**
- * Read a float value from specified attribute.
- *
- * @param attributeName attribute mame
- *
- * @returns The float value
- *
- * @throws std::invalid_argument if read fails
- */
- float
- readFloat(const std::string& attributeName) const
- {
- float value;
- mraa_result_t res = mraa_iio_read_float(m_iio, attributeName.c_str(), &value);
- if (res != MRAA_SUCCESS) {
- std::ostringstream oss;
- oss << "IIO readFloat for attibute " << attributeName << " failed";
- throw std::runtime_error(oss.str());
- }
- return value;
- }
-
- /**
- * Write an int value to specified attribute.
- *
- * @param attributeName attribute mame
- * @param value int value
- *
- * @throws std::invalid_argument if write fails
- */
- void
- writeInt(const std::string& attributeName, int value) const
- {
- mraa_result_t res = mraa_iio_write_int(m_iio, attributeName.c_str(), value);
- if (res != MRAA_SUCCESS) {
- std::ostringstream oss;
- oss << "IIO writeInt for attibute " << attributeName << " failed";
- throw std::runtime_error(oss.str());
- }
-
- }
-
- /**
- * Write a float value to specified attribute.
- *
- * @param attributeName attribute mame
- * @param value float value
- *
- * @throws std::invalid_argument if write fails
- */
- void
- writeFloat(const std::string& attributeName, float value) const
- {
- mraa_result_t res = mraa_iio_write_float(m_iio, attributeName.c_str(), value);
- if (res != MRAA_SUCCESS) {
- std::ostringstream oss;
- oss << "IIO writeFloat for attibute " << attributeName << " failed";
- throw std::runtime_error(oss.str());
- }
-
- }
-
- /**
- * Register event handler.
- *
- * @param handler handler class that implements IioHandler
- *
- * @throws std::invalid_argument on failure
- */
- void
- registerEventHandler(IioHandler* handler) const
- {
- mraa_result_t res = mraa_iio_event_setup_callback(m_iio, private_event_handler, handler);
- if (res != MRAA_SUCCESS) {
- throw std::runtime_error("registerEventHandler failed");
- }
- }
-
- private:
- static void private_event_handler(iio_event_data* data, void *args)
- {
- if (args != NULL) {
- IioHandler* handler = (IioHandler*)args;
- IioEventData eventData;
- int chan_type, modifier, type, direction, channel, channel2, different;
- mraa_iio_event_extract_event(data, &chan_type, &modifier, &type, &direction, &channel, &channel2, &different);
- eventData.channelType = chan_type;
- eventData.modifier = modifier;
- eventData.type = type;
- eventData.direction = direction;
- eventData.channel = channel;
- eventData.channel2 = channel2;
- eventData.diff = different;
- handler->onIioEvent(eventData);
- }
- }
-
- mraa_iio_context m_iio;
-};
-
-}
diff --git a/peripheral/libmraa/api/mraa/iio_kernel_headers.h b/peripheral/libmraa/api/mraa/iio_kernel_headers.h
deleted file mode 100644
index 5fbe81f..0000000
--- a/peripheral/libmraa/api/mraa/iio_kernel_headers.h
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Author: Lay, Kuan Loon <kuan.loon.lay@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.
- */
-
-//For kernel 4.1+,
-//#include <linux/iio/types.h>
-//#include <linux/iio/events.h>
-
-//linux/iio/types.h
-enum iio_chan_type {
- IIO_VOLTAGE,
- IIO_CURRENT,
- IIO_POWER,
- IIO_ACCEL,
- IIO_ANGL_VEL,
- IIO_MAGN,
- IIO_LIGHT,
- IIO_INTENSITY,
- IIO_PROXIMITY,
- IIO_TEMP,
- IIO_INCLI,
- IIO_ROT,
- IIO_ANGL,
- IIO_TIMESTAMP,
- IIO_CAPACITANCE,
- IIO_ALTVOLTAGE,
- IIO_CCT,
- IIO_PRESSURE,
- IIO_HUMIDITYRELATIVE,
- IIO_ACTIVITY,
- IIO_STEPS,
- IIO_ENERGY,
- IIO_DISTANCE,
- IIO_VELOCITY,
-};
-
-enum iio_modifier {
- IIO_NO_MOD,
- IIO_MOD_X,
- IIO_MOD_Y,
- IIO_MOD_Z,
- IIO_MOD_X_AND_Y,
- IIO_MOD_X_AND_Z,
- IIO_MOD_Y_AND_Z,
- IIO_MOD_X_AND_Y_AND_Z,
- IIO_MOD_X_OR_Y,
- IIO_MOD_X_OR_Z,
- IIO_MOD_Y_OR_Z,
- IIO_MOD_X_OR_Y_OR_Z,
- IIO_MOD_LIGHT_BOTH,
- IIO_MOD_LIGHT_IR,
- IIO_MOD_ROOT_SUM_SQUARED_X_Y,
- IIO_MOD_SUM_SQUARED_X_Y_Z,
- IIO_MOD_LIGHT_CLEAR,
- IIO_MOD_LIGHT_RED,
- IIO_MOD_LIGHT_GREEN,
- IIO_MOD_LIGHT_BLUE,
- IIO_MOD_QUATERNION,
- IIO_MOD_TEMP_AMBIENT,
- IIO_MOD_TEMP_OBJECT,
- IIO_MOD_NORTH_MAGN,
- IIO_MOD_NORTH_TRUE,
- IIO_MOD_NORTH_MAGN_TILT_COMP,
- IIO_MOD_NORTH_TRUE_TILT_COMP,
- IIO_MOD_RUNNING,
- IIO_MOD_JOGGING,
- IIO_MOD_WALKING,
- IIO_MOD_STILL,
- IIO_MOD_ROOT_SUM_SQUARED_X_Y_Z,
-};
-
-enum iio_event_type {
- IIO_EV_TYPE_THRESH,
- IIO_EV_TYPE_MAG,
- IIO_EV_TYPE_ROC,
- IIO_EV_TYPE_THRESH_ADAPTIVE,
- IIO_EV_TYPE_MAG_ADAPTIVE,
- IIO_EV_TYPE_CHANGE,
-};
-
-enum iio_event_direction {
- IIO_EV_DIR_EITHER,
- IIO_EV_DIR_RISING,
- IIO_EV_DIR_FALLING,
- IIO_EV_DIR_NONE,
-};
-
-//linux/iio/events.h
-#include <linux/ioctl.h>
-
-/**
- * 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 {
- unsigned long long int id;
- long long int timestamp;
-};
-
-#define IIO_GET_EVENT_FD_IOCTL _IOR('i', 0x90, int)
-
-#define IIO_EVENT_CODE_EXTRACT_TYPE(mask) ((mask >> 56) & 0xFF)
-
-#define IIO_EVENT_CODE_EXTRACT_DIR(mask) ((mask >> 48) & 0x7F)
-
-#define IIO_EVENT_CODE_EXTRACT_CHAN_TYPE(mask) ((mask >> 32) & 0xFF)
-
-/* Event code number extraction depends on which type of event we have.
- * Perhaps review this function in the future*/
-#define IIO_EVENT_CODE_EXTRACT_CHAN(mask) ((short int)(mask & 0xFFFF))
-#define IIO_EVENT_CODE_EXTRACT_CHAN2(mask) ((short int)(((mask) >> 16) & 0xFFFF))
-
-#define IIO_EVENT_CODE_EXTRACT_MODIFIER(mask) ((mask >> 40) & 0xFF)
-#define IIO_EVENT_CODE_EXTRACT_DIFF(mask) (((mask) >> 55) & 0x1)
diff --git a/peripheral/libmraa/api/mraa/pwm.h b/peripheral/libmraa/api/mraa/pwm.h
deleted file mode 100644
index ef78110..0000000
--- a/peripheral/libmraa/api/mraa/pwm.h
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#pragma once
-
-/**
- * @file
- * @brief Pulse Width Modulation module
- *
- * PWM is the Pulse Width Modulation interface to libmraa. It allows the
- * generation of a signal on a pin. Some boards may have higher or lower levels
- * of resolution so make sure you check the board & pin you are using before
- * hand.
- *
- * @snippet cycle-pwm3.c Interesting
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdio.h>
-#include <fcntl.h>
-
-#include "common.h"
-
-typedef struct _pwm* mraa_pwm_context;
-
-/**
- * Initialise pwm_context, uses board mapping
- *
- * @param pin The PWM PIN
- * @return pwm context or NULL
- */
-mraa_pwm_context mraa_pwm_init(int pin);
-
-/**
- * Initialise pwm_context, raw mode
- *
- * @param chipid The chip inwhich the PWM is under in SYSFS
- * @param pin The PWM PIN.
- * @return pwm context or NULL
- */
-mraa_pwm_context mraa_pwm_init_raw(int chipid, int pin);
-
-/**
- * Set the ouput duty-cycle percentage, as a float
- *
- * @param dev The Pwm context to use
- * @param percentage A floating-point value representing percentage of output.
- * The value should lie between 0.0f (representing on 0%) and 1.0f
- * Values above or below this range will be set at either 0.0f or 1.0f
- * @return Result of operation
- */
-mraa_result_t mraa_pwm_write(mraa_pwm_context dev, float percentage);
-
-/**
- * Read the ouput duty-cycle percentage, as a float
- *
- * @param dev The Pwm context to use
- * @return percentage A floating-point value representing percentage of output.
- * The value should lie between 0.0f (representing on 0%) and 1.0f
- * Values above or below this range will be set at either 0.0f or 1.0f
- */
-float mraa_pwm_read(mraa_pwm_context dev);
-
-/**
- * Set the PWM period as seconds represented in a float
- *
- * @param dev The Pwm context to use
- * @param seconds Period represented as a float in seconds
- * @return Result of operation
- */
-mraa_result_t mraa_pwm_period(mraa_pwm_context dev, float seconds);
-
-/**
- * Set period, milliseconds.
- *
- * @param dev The Pwm context to use
- * @param ms Milliseconds for period
- * @return Result of operation
- */
-mraa_result_t mraa_pwm_period_ms(mraa_pwm_context dev, int ms);
-
-/**
- * Set period, microseconds
- *
- * @param dev The Pwm context to use
- * @param us Microseconds as period
- * @return Result of operation
- */
-mraa_result_t mraa_pwm_period_us(mraa_pwm_context dev, int us);
-
-/**
- * Set pulsewidth, As represnted by seconds in a (float)
- *
- * @param dev The Pwm context to use
- * @param seconds The duration of a pulse
- * @return Result of operation
- */
-mraa_result_t mraa_pwm_pulsewidth(mraa_pwm_context dev, float seconds);
-
-/**
- * Set pulsewidth, milliseconds
- *
- * @param dev The Pwm context to use
- * @param ms Milliseconds for pulsewidth
- * @return Result of operation
- */
-mraa_result_t mraa_pwm_pulsewidth_ms(mraa_pwm_context dev, int ms);
-
-/**
- * Set pulsewidth, microseconds
- *
- * @param dev The Pwm context to use
- * @param us Microseconds for pulsewidth
- * @return Result of operation
- */
-mraa_result_t mraa_pwm_pulsewidth_us(mraa_pwm_context dev, int us);
-
-/**
- * Set the enable status of the PWM pin. None zero will assume on with output being driven.
- * and 0 will disable the output.
- *
- * @param dev The pwm context to use
- * @param enable Toggle status of pin
- * @return Result of operation.
- */
-mraa_result_t mraa_pwm_enable(mraa_pwm_context dev, int enable);
-
-/**
- * Change ownership of context
- *
- * @param dev the context
- * @param owner Ownership boolean
- * @return Result of operation
- */
-mraa_result_t mraa_pwm_owner(mraa_pwm_context dev, mraa_boolean_t owner);
-
-/**
- * Close and unexport the PWM pin
- *
- * @param dev The pwm context to use
- * @return Result of operation
- */
-mraa_result_t mraa_pwm_close(mraa_pwm_context dev);
-
-/**
- * Set Both Period and DutyCycle on a PWM context
- *
- * @param dev The pwm context to use
- * @param period represented in ms.
- * @param duty dutycycle of the pwm signal.
- * @return Result of operation
- */
-mraa_result_t mraa_pwm_config_ms(mraa_pwm_context dev, int period, float duty);
-
-/**
- * Set Both Period and DutyCycle on a PWM context. Duty represented as percentage.
- *
- * @param dev The pwm context to use
- * @param period represented in ms.
- * @param duty duty percantage. i.e. 50% = 0.5f
- * @return Result of operation
- */
-mraa_result_t mraa_pwm_config_percent(mraa_pwm_context dev, int period, float duty);
-
-/**
- * Get the maximum pwm period in us
- *
- * @return max pwm in us
- */
-int mraa_pwm_get_max_period();
-
-/**
- * Get the minimum pwm period in us
- *
- * @return min pwm in us
- */
-int mraa_pwm_get_min_period();
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/peripheral/libmraa/api/mraa/pwm.hpp b/peripheral/libmraa/api/mraa/pwm.hpp
deleted file mode 100644
index a449a43..0000000
--- a/peripheral/libmraa/api/mraa/pwm.hpp
+++ /dev/null
@@ -1,232 +0,0 @@
-/*
- * 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.
- */
-
-#pragma once
-
-#include "pwm.h"
-#include "types.hpp"
-#include <stdexcept>
-
-namespace mraa
-{
-
-/**
- * @brief API to Pulse Width Modulation
- *
- * This file defines the PWM interface for libmraa
- *
- * @snippet Pwm3-cycle.cpp Interesting
- */
-class Pwm
-{
- public:
- /**
- * instanciates a PWM object on a pin
- *
- * @param pin the pin number used on your board
- * @param owner if you are the owner of the pin the destructor will
- * @param chipid the pwmchip to use, use only in raw mode
- * unexport the pin from sysfs, default behaviour is you are the owner
- * if the pinmapper exported it
- */
- Pwm(int pin, bool owner = true, int chipid = -1)
- {
- if (chipid == -1) {
- m_pwm = mraa_pwm_init(pin);
- } else {
- m_pwm = mraa_pwm_init_raw(chipid, pin);
- }
-
- if (m_pwm == NULL) {
- throw std::invalid_argument("Error initialising PWM on pin");
- }
-
- if (!owner) {
- mraa_pwm_owner(m_pwm, 0);
- }
- }
- /**
- * Pwm destructor
- */
- ~Pwm()
- {
- mraa_pwm_close(m_pwm);
- }
- /**
- * Set the output duty-cycle percentage, as a float
- *
- * @param percentage A floating-point value representing percentage of
- * output. The value should lie between 0.0f (representing on 0%) and
- * 1.0f Values above or below this range will be set at either 0.0f or
- * 1.0f
- * @return Result of operation
- */
- Result
- write(float percentage)
- {
- return (Result) mraa_pwm_write(m_pwm, percentage);
- }
- /**
- * Read the ouput duty-cycle percentage, as a float
- *
- * @return A floating-point value representing percentage of
- * output. The value should lie between 0.0f (representing on 0%) and
- * 1.0f Values above or below this range will be set at either 0.0f or
- * 1.0f
- */
- float
- read()
- {
- return mraa_pwm_read(m_pwm);
- }
- /**
- * Set the PWM period as seconds represented in a float
- *
- * @param period Period represented as a float in seconds
- * @return Result of operation
- */
- Result
- period(float period)
- {
- return (Result) mraa_pwm_period(m_pwm, period);
- }
- /**
- * Set period, milliseconds
- *
- * @param ms milliseconds for period
- * @return Result of operation
- */
- Result
- period_ms(int ms)
- {
- return (Result) mraa_pwm_period_ms(m_pwm, ms);
- }
- /**
- * Set period, microseconds
- *
- * @param us microseconds as period
- * @return Result of operation
- */
- Result
- period_us(int us)
- {
- return (Result) mraa_pwm_period_us(m_pwm, us);
- }
- /**
- * Set pulsewidth, As represnted by seconds in a (float)
- *
- * @param seconds The duration of a pulse
- * @return Result of operation
- */
- Result
- pulsewidth(float seconds)
- {
- return (Result) mraa_pwm_pulsewidth(m_pwm, seconds);
- }
- /**
- * Set pulsewidth, milliseconds
- *
- * @param ms milliseconds for pulsewidth
- * @return Result of operation
- */
- Result
- pulsewidth_ms(int ms)
- {
- return (Result) mraa_pwm_pulsewidth_ms(m_pwm, ms);
- }
- /**
- * The pulsewidth, microseconds
- *
- * @param us microseconds for pulsewidth
- * @return Result of operation
- */
- Result
- pulsewidth_us(int us)
- {
- return (Result) mraa_pwm_pulsewidth_us(m_pwm, us);
- }
- /**
- * Set the enable status of the PWM pin. None zero will assume on with
- * output being driven and 0 will disable the output
- *
- * @param enable enable status of pin
- * @return Result of operation
- */
- Result
- enable(bool enable)
- {
- if (enable)
- return (Result) mraa_pwm_enable(m_pwm, 1);
- else
- return (Result) mraa_pwm_enable(m_pwm, 0);
- }
- /**
- * Set the period and duty of a PWM object.
- *
- * @param period represented in ms.
- * @param duty represnted in ms as float.
- * @return Result of operation
- */
- Result
- config_ms(int period, float duty)
- {
- return (Result) mraa_pwm_config_ms(m_pwm, period, duty);
- }
- /**
- * Set the period and duty (percent) of a PWM object.
- *
- * @param period as represented in ms.
- * @param duty percentage i.e. 50% = 0.5f
- * @return Result of operation
- */
- Result
- config_percent(int period, float duty)
- {
- return (Result) mraa_pwm_config_percent(m_pwm, period, duty);
- }
- /**
- * Get the maximum pwm period in us
- *
- * @return max pwm in us
- */
- int
- max_period()
- {
- return mraa_pwm_get_max_period();
- }
- /**
- * Get the minimum pwm period in us
- *
- * @return min pwm in us
- */
- int
- min_period()
- {
- return mraa_pwm_get_min_period();
- }
-
- private:
- mraa_pwm_context m_pwm;
-};
-}
diff --git a/peripheral/libmraa/api/mraa/spi.h b/peripheral/libmraa/api/mraa/spi.h
deleted file mode 100644
index 6902a6e..0000000
--- a/peripheral/libmraa/api/mraa/spi.h
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#pragma once
-
-/**
- * @file
- * @brief Serial Peripheral Interface
- *
- * This file defines the spi interface for libmraa. A Spi object in libmraa
- * represents a spidev device. Linux spidev devices are created per spi bus and
- * every chip select available on that bus has another spidev 'file'. A lot
- * more information on spidev devices is available
- * [here](https://www.kernel.org/doc/Documentation/spi/spidev).
- *
- * @snippet spi_mcp4261.c Interesting
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdio.h>
-#include <fcntl.h>
-#include <stdint.h>
-
-#include "common.h"
-
-/**
- * MRAA SPI Modes
- */
-typedef enum {
- MRAA_SPI_MODE0 = 0, /**< CPOL = 0, CPHA = 0, Clock idle low, data is clocked in on rising edge,
- output data (change) on falling edge */
- MRAA_SPI_MODE1 = 1, /**< CPOL = 0, CPHA = 1, Clock idle low, data is clocked in on falling edge,
- output data (change) on rising edge */
- MRAA_SPI_MODE2 = 2, /**< CPOL = 1, CPHA = 0, Clock idle low, data is clocked in on falling edge,
- output data (change) on rising edge */
- MRAA_SPI_MODE3 = 3, /**< CPOL = 1, CPHA = 1, Clock idle low, data is clocked in on rising, edge
- output data (change) on falling edge */
-} mraa_spi_mode_t;
-
-/**
- * Opaque pointer definition to the internal struct _spi
- */
-typedef struct _spi* mraa_spi_context;
-
-/**
- * Initialise SPI_context, uses board mapping. Sets the muxes
- *
- * @param bus Bus to use, as listed in platform definition, normally 0
- * @return Spi context or NULL
- */
-mraa_spi_context mraa_spi_init(int bus);
-
-/**
- * Initialise SPI_context without any board configuration, selects a bus and a mux.
- *
- * @param bus Bus to use as listed by spidev
- * @param cs Chip select to use as listed in spidev
- * @return Spi context or NULL
- */
-mraa_spi_context mraa_spi_init_raw(unsigned int bus, unsigned int cs);
-
-/**
- * Set the SPI device mode. see spidev 0-3.
- *
- * @param dev The Spi context
- * @param mode The SPI mode, See Linux spidev
- * @return Result of operation
- */
-mraa_result_t mraa_spi_mode(mraa_spi_context dev, mraa_spi_mode_t mode);
-
-/**
- * Set the SPI device operating clock frequency.
- *
- * @param dev the Spi context
- * @param hz the frequency in hz
- * @return Result of operation
- */
-mraa_result_t mraa_spi_frequency(mraa_spi_context dev, int hz);
-
-/**
- * Write Single Byte to the SPI device.
- *
- * @param dev The Spi context
- * @param data Data to send
- * @return Data received on the miso line or -1 in case of error
- */
-int mraa_spi_write(mraa_spi_context dev, uint8_t data);
-
-/**
- *Write Two Bytes to the SPI device.
- *
- * @param dev The Spi context
- * @param data Data to send
- * @return Data received on the miso line
- */
-uint16_t mraa_spi_write_word(mraa_spi_context dev, uint16_t data);
-
-/**
- * Write Buffer of bytes to the SPI device. The pointer return has to be
- * free'd by the caller. It will return a NULL pointer in cases of error.
- *
- * @param dev The Spi context
- * @param data to send
- * @param length elements within buffer, Max 4096
- * @return Data received on the miso line, same length as passed in
- */
-uint8_t* mraa_spi_write_buf(mraa_spi_context dev, uint8_t* data, int length);
-
-/**
- * Write Buffer of uint16 to the SPI device. The pointer return has to be
- * free'd by the caller. It will return a NULL pointer in cases of error.
- *
- * @param dev The Spi context
- * @param data to send
- * @param length elements (in bytes) within buffer, Max 4096
- * @return Data received on the miso line, same length as passed in
- */
-uint16_t* mraa_spi_write_buf_word(mraa_spi_context dev, uint16_t* data, int length);
-
-/**
- * Transfer Buffer of bytes to the SPI device. Both send and recv buffers
- * are passed in
- *
- * @param dev The Spi context
- * @param data to send
- * @param rxbuf buffer to recv data back, may be NULL
- * @param length elements within buffer, Max 4096
- * @return Result of operation
- */
-mraa_result_t mraa_spi_transfer_buf(mraa_spi_context dev, uint8_t* data, uint8_t* rxbuf, int length);
-
-/**
- * Transfer Buffer of uint16 to the SPI device. Both send and recv buffers
- * are passed in
- *
- * @param dev The Spi context
- * @param data to send
- * @param rxbuf buffer to recv data back, may be NULL
- * @param length elements (in bytes) within buffer, Max 4096
- * @return Result of operation
- */
-mraa_result_t mraa_spi_transfer_buf_word(mraa_spi_context dev, uint16_t* data, uint16_t* rxbuf, int length);
-
-/**
- * Change the SPI lsb mode
- *
- * @param dev The Spi context
- * @param lsb Use least significant bit transmission. 0 for msbi
- * @return Result of operation
- */
-mraa_result_t mraa_spi_lsbmode(mraa_spi_context dev, mraa_boolean_t lsb);
-
-/**
- * Set bits per mode on transaction, defaults at 8
- *
- * @param dev The Spi context
- * @param bits bits per word
- * @return Result of operation
- */
-mraa_result_t mraa_spi_bit_per_word(mraa_spi_context dev, unsigned int bits);
-
-/**
- * De-inits an mraa_spi_context device
- *
- * @param dev The Spi context
- * @return Result of operation
- */
-mraa_result_t mraa_spi_stop(mraa_spi_context dev);
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/peripheral/libmraa/api/mraa/spi.hpp b/peripheral/libmraa/api/mraa/spi.hpp
deleted file mode 100644
index e5ffb09..0000000
--- a/peripheral/libmraa/api/mraa/spi.hpp
+++ /dev/null
@@ -1,229 +0,0 @@
-/*
- * 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.
- */
-
-#pragma once
-
-#include "spi.h"
-#include "types.hpp"
-#include <stdexcept>
-
-namespace mraa
-{
-
-/**
- * MRAA SPI Modes
- */
-typedef enum {
- SPI_MODE0 = 0, /**< CPOL = 0, CPHA = 0, Clock idle low, data is clocked in on rising edge,
- output data (change) on falling edge */
- SPI_MODE1 = 1, /**< CPOL = 0, CPHA = 1, Clock idle low, data is clocked in on falling edge,
- output data (change) on rising edge */
- SPI_MODE2 = 2, /**< CPOL = 1, CPHA = 0, Clock idle low, data is clocked in on falling edge,
- output data (change) on rising edge */
- SPI_MODE3 = 3, /**< CPOL = 1, CPHA = 1, Clock idle low, data is clocked in on rising, edge
- output data (change) on falling edge */
-} Spi_Mode;
-
-
-/**
-* @brief API to Serial Peripheral Interface
-*
-* This file defines the SPI interface for libmraa
-*
-* @snippet Spi-pot.cpp Interesting
-*/
-class Spi
-{
- public:
- /**
- * Initialise SPI object using the board mapping to set muxes
- *
- * @param bus to use, as listed in the platform definition, normally 0
- */
- Spi(int bus)
- {
- m_spi = mraa_spi_init(bus);
-
- if (m_spi == NULL) {
- throw std::invalid_argument("Error initialising SPI bus");
- }
- }
-
- Spi(int bus, int cs)
- {
- m_spi = mraa_spi_init_raw(bus, cs);
-
- if (m_spi == NULL) {
- throw std::invalid_argument("Error initialising SPI bus");
- }
- }
-
- /**
- * Closes spi bus
- */
- ~Spi()
- {
- mraa_spi_stop(m_spi);
- }
-
- /**
- * Set the SPI device mode. see spidev0-3
- *
- * @param mode the mode. See Linux spidev doc
- * @return Result of operation
- */
- Result
- mode(Spi_Mode mode)
- {
- return (Result) mraa_spi_mode(m_spi, (mraa_spi_mode_t) mode);
- }
-
- /**
- * Set the SPI device operating clock frequency
- *
- * @param hz the frequency to set in hz
- * @return Result of operation
- */
- Result
- frequency(int hz)
- {
- return (Result) mraa_spi_frequency(m_spi, hz);
- }
-
- /**
- * Write single byte to the SPI device
- *
- * @param data the byte to send
- * @return data received on the miso line or -1 in case of error
- */
- int
- writeByte(uint8_t data)
- {
- return mraa_spi_write(m_spi, (uint8_t) data);
- }
-
- /**
- * Write single byte to the SPI device
- *
- * @param data the byte to send
- * @return data received on the miso line
- */
- uint16_t
- write_word(uint16_t data)
- {
- return mraa_spi_write_word(m_spi, (uint16_t) data);
- }
-
- /**
- * Write buffer of bytes to SPI device The pointer return has to be
- * free'd by the caller. It will return a NULL pointer in cases of
- * error
- *
- * @param txBuf buffer to send
- * @param length size of buffer to send
- * @return uint8_t* data received on the miso line. Same length as passed in
- */
- uint8_t*
- write(uint8_t* txBuf, int length)
- {
- return mraa_spi_write_buf(m_spi, txBuf, length);
- }
-
-#ifndef SWIG
- /**
- * Write buffer of bytes to SPI device The pointer return has to be
- * free'd by the caller. It will return a NULL pointer in cases of
- * error
- *
- * @param txBuf buffer to send
- * @param length size of buffer (in bytes) to send
- * @return uint8_t* data received on the miso line. Same length as passed in
- */
- uint16_t*
- write_word(uint16_t* txBuf, int length)
- {
- return mraa_spi_write_buf_word(m_spi, txBuf, length);
- }
-#endif
-
-#ifndef SWIG
- /**
- * Transfer data to and from SPI device Receive pointer may be null if
- * return data is not needed.
- *
- * @param txBuf buffer to send
- * @param rxBuf buffer to optionally receive data from spi device
- * @param length size of buffer to send
- * @return Result of operation
- */
- Result
- transfer(uint8_t* txBuf, uint8_t* rxBuf, int length)
- {
- return (Result) mraa_spi_transfer_buf(m_spi, txBuf, rxBuf, length);
- }
-
- /**
- * Transfer data to and from SPI device Receive pointer may be null if
- * return data is not needed.
- *
- * @param txBuf buffer to send
- * @param rxBuf buffer to optionally receive data from spi device
- * @param length size of buffer to send
- * @return Result of operation
- */
- Result
- transfer_word(uint16_t* txBuf, uint16_t* rxBuf, int length)
- {
- return (Result) mraa_spi_transfer_buf_word(m_spi, txBuf, rxBuf, length);
- }
-#endif
-
- /**
- * Change the SPI lsb mode
- *
- * @param lsb Use least significant bit transmission - 0 for msbi
- * @return Result of operation
- */
- Result
- lsbmode(bool lsb)
- {
- return (Result) mraa_spi_lsbmode(m_spi, (mraa_boolean_t) lsb);
- }
-
- /**
- * Set bits per mode on transaction, default is 8
- *
- * @param bits bits per word
- * @return Result of operation
- */
- Result
- bitPerWord(unsigned int bits)
- {
- return (Result) mraa_spi_bit_per_word(m_spi, bits);
- }
-
- private:
- mraa_spi_context m_spi;
-};
-}
diff --git a/peripheral/libmraa/api/mraa/types.h b/peripheral/libmraa/api/mraa/types.h
deleted file mode 100644
index fe0daad..0000000
--- a/peripheral/libmraa/api/mraa/types.h
+++ /dev/null
@@ -1,246 +0,0 @@
-/*
- * Author: Brendan Le Foll <brendan.le.foll@intel.com>
- * Copyright © 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.
- */
-
-#pragma once
-
-/** @file
- *
- * This file defines the basic shared types for libmraa
- * this file is different to common.h in that swig takes this as an input
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * MRAA supported platform types
- */
-typedef enum {
- MRAA_INTEL_GALILEO_GEN1 = 0, /**< The Generation 1 Galileo platform (RevD) */
- MRAA_INTEL_GALILEO_GEN2 = 1, /**< The Generation 2 Galileo platform (RevG/H) */
- MRAA_INTEL_EDISON_FAB_C = 2, /**< The Intel Edison (FAB C) */
- MRAA_INTEL_DE3815 = 3, /**< The Intel DE3815 Baytrail NUC */
- MRAA_INTEL_MINNOWBOARD_MAX = 4, /**< The Intel Minnow Board Max */
- MRAA_RASPBERRY_PI = 5, /**< The different Raspberry PI Models -like A,B,A+,B+ */
- 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_INTEL_SOFIA_3GR = 10, /**< The Intel SoFIA 3GR */
- MRAA_INTEL_CHERRYHILLS = 11, /**< The Intel Braswell Cherryhills */
- MRAA_UP = 12, /**< The UP Board */
-
- // USB platform extenders start at 256
- MRAA_FTDI_FT4222 = 256, /**< FTDI FT4222 USB to i2c bridge */
-
- 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_platform_t;
-
-/**
- * Intel edison miniboard numbering enum
- */
-typedef enum {
- MRAA_INTEL_EDISON_MINIBOARD_J17_1 = 0,
- MRAA_INTEL_EDISON_MINIBOARD_J17_5 = 4,
- MRAA_INTEL_EDISON_MINIBOARD_J17_7 = 6,
- MRAA_INTEL_EDISON_MINIBOARD_J17_8 = 7,
- MRAA_INTEL_EDISON_MINIBOARD_J17_9 = 8,
- MRAA_INTEL_EDISON_MINIBOARD_J17_10 = 9,
- MRAA_INTEL_EDISON_MINIBOARD_J17_11 = 10,
- MRAA_INTEL_EDISON_MINIBOARD_J17_12 = 11,
- MRAA_INTEL_EDISON_MINIBOARD_J17_14 = 13,
- MRAA_INTEL_EDISON_MINIBOARD_J18_1 = 14,
- MRAA_INTEL_EDISON_MINIBOARD_J18_2 = 15,
- MRAA_INTEL_EDISON_MINIBOARD_J18_6 = 19,
- MRAA_INTEL_EDISON_MINIBOARD_J18_7 = 20,
- MRAA_INTEL_EDISON_MINIBOARD_J18_8 = 21,
- MRAA_INTEL_EDISON_MINIBOARD_J18_10 = 23,
- MRAA_INTEL_EDISON_MINIBOARD_J18_11 = 24,
- MRAA_INTEL_EDISON_MINIBOARD_J18_12 = 25,
- MRAA_INTEL_EDISON_MINIBOARD_J18_13 = 26,
- MRAA_INTEL_EDISON_MINIBOARD_J19_4 = 31,
- MRAA_INTEL_EDISON_MINIBOARD_J19_5 = 32,
- MRAA_INTEL_EDISON_MINIBOARD_J19_6 = 33,
- MRAA_INTEL_EDISON_MINIBOARD_J19_8 = 35,
- MRAA_INTEL_EDISON_MINIBOARD_J19_9 = 36,
- MRAA_INTEL_EDISON_MINIBOARD_J19_10 = 37,
- MRAA_INTEL_EDISON_MINIBOARD_J19_11 = 38,
- MRAA_INTEL_EDISON_MINIBOARD_J19_12 = 39,
- MRAA_INTEL_EDISON_MINIBOARD_J19_13 = 40,
- MRAA_INTEL_EDISON_MINIBOARD_J19_14 = 41,
- MRAA_INTEL_EDISON_MINIBOARD_J20_3 = 44,
- MRAA_INTEL_EDISON_MINIBOARD_J20_4 = 45,
- MRAA_INTEL_EDISON_MINIBOARD_J20_5 = 46,
- MRAA_INTEL_EDISON_MINIBOARD_J20_6 = 47,
- MRAA_INTEL_EDISON_MINIBOARD_J20_7 = 48,
- MRAA_INTEL_EDISON_MINIBOARD_J20_8 = 49,
- MRAA_INTEL_EDISON_MINIBOARD_J20_9 = 50,
- MRAA_INTEL_EDISON_MINIBOARD_J20_10 = 51,
- MRAA_INTEL_EDISON_MINIBOARD_J20_11 = 52,
- MRAA_INTEL_EDISON_MINIBOARD_J20_12 = 53,
- MRAA_INTEL_EDISON_MINIBOARD_J20_13 = 54,
- MRAA_INTEL_EDISON_MINIBOARD_J20_14 = 55
-} mraa_intel_edison_miniboard_t;
-
-/**
- * Intel Edison raw GPIO numbering enum
- */
-typedef enum {
- MRAA_INTEL_EDISON_GP182 = 0,
- MRAA_INTEL_EDISON_GP135 = 4,
- MRAA_INTEL_EDISON_GP27 = 6,
- MRAA_INTEL_EDISON_GP20 = 7,
- MRAA_INTEL_EDISON_GP28 = 8,
- MRAA_INTEL_EDISON_GP111 = 0,
- MRAA_INTEL_EDISON_GP109 = 10,
- MRAA_INTEL_EDISON_GP115 = 11,
- MRAA_INTEL_EDISON_GP128 = 13,
- MRAA_INTEL_EDISON_GP13 = 14,
- MRAA_INTEL_EDISON_GP165 = 15,
- MRAA_INTEL_EDISON_GP19 = 19,
- MRAA_INTEL_EDISON_GP12 = 20,
- MRAA_INTEL_EDISON_GP183 = 21,
- MRAA_INTEL_EDISON_GP110 = 23,
- MRAA_INTEL_EDISON_GP114 = 24,
- MRAA_INTEL_EDISON_GP129 = 25,
- MRAA_INTEL_EDISON_GP130 = 26,
- MRAA_INTEL_EDISON_GP44 = 31,
- MRAA_INTEL_EDISON_GP46 = 32,
- MRAA_INTEL_EDISON_GP48 = 33,
- MRAA_INTEL_EDISON_GP131 = 35,
- MRAA_INTEL_EDISON_GP14 = 36,
- MRAA_INTEL_EDISON_GP40 = 37,
- MRAA_INTEL_EDISON_GP43 = 38,
- MRAA_INTEL_EDISON_GP77 = 39,
- MRAA_INTEL_EDISON_GP82 = 40,
- MRAA_INTEL_EDISON_GP83 = 41,
- MRAA_INTEL_EDISON_GP134 = 44,
- MRAA_INTEL_EDISON_GP45 = 45,
- MRAA_INTEL_EDISON_GP47 = 46,
- MRAA_INTEL_EDISON_GP49 = 47,
- MRAA_INTEL_EDISON_GP15 = 48,
- MRAA_INTEL_EDISON_GP84 = 49,
- MRAA_INTEL_EDISON_GP42 = 50,
- MRAA_INTEL_EDISON_GP41 = 51,
- MRAA_INTEL_EDISON_GP78 = 52,
- MRAA_INTEL_EDISON_GP79 = 53,
- MRAA_INTEL_EDISON_GP80 = 54,
- MRAA_INTEL_EDISON_GP81 = 55
-} mraa_intel_edison_t;
-
-/**
-* Raspberry PI Wiring compatible numbering enum
-*/
-typedef enum {
- MRAA_RASPBERRY_WIRING_PIN8 = 3,
- MRAA_RASPBERRY_WIRING_PIN9 = 5,
- MRAA_RASPBERRY_WIRING_PIN7 = 7,
- MRAA_RASPBERRY_WIRING_PIN15 = 8,
- MRAA_RASPBERRY_WIRING_PIN16 = 10,
- MRAA_RASPBERRY_WIRING_PIN0 = 11,
- MRAA_RASPBERRY_WIRING_PIN1 = 12,
- MRAA_RASPBERRY_WIRING_PIN2 = 13,
- MRAA_RASPBERRY_WIRING_PIN3 = 15,
- MRAA_RASPBERRY_WIRING_PIN4 = 16,
- MRAA_RASPBERRY_WIRING_PIN5 = 18,
- MRAA_RASPBERRY_WIRING_PIN12 = 19,
- MRAA_RASPBERRY_WIRING_PIN13 = 21,
- MRAA_RASPBERRY_WIRING_PIN6 = 22,
- MRAA_RASPBERRY_WIRING_PIN14 = 23,
- MRAA_RASPBERRY_WIRING_PIN10 = 24,
- MRAA_RASPBERRY_WIRING_PIN11 = 26,
- MRAA_RASPBERRY_WIRING_PIN17 = 29, // RPi B V2
- MRAA_RASPBERRY_WIRING_PIN21 = 29,
- MRAA_RASPBERRY_WIRING_PIN18 = 30, // RPi B V2
- MRAA_RASPBERRY_WIRING_PIN19 = 31, // RPI B V2
- MRAA_RASPBERRY_WIRING_PIN22 = 31,
- MRAA_RASPBERRY_WIRING_PIN20 = 32, // RPi B V2
- MRAA_RASPBERRY_WIRING_PIN26 = 32,
- MRAA_RASPBERRY_WIRING_PIN23 = 33,
- MRAA_RASPBERRY_WIRING_PIN24 = 35,
- MRAA_RASPBERRY_WIRING_PIN27 = 36,
- MRAA_RASPBERRY_WIRING_PIN25 = 37,
- MRAA_RASPBERRY_WIRING_PIN28 = 38,
- MRAA_RASPBERRY_WIRING_PIN29 = 40
-} mraa_raspberry_wiring_t;
-
-/**
- * MRAA return codes
- */
-typedef enum {
- MRAA_SUCCESS = 0, /**< Expected response */
- MRAA_ERROR_FEATURE_NOT_IMPLEMENTED = 1, /**< Feature TODO */
- MRAA_ERROR_FEATURE_NOT_SUPPORTED = 2, /**< Feature not supported by HW */
- MRAA_ERROR_INVALID_VERBOSITY_LEVEL = 3, /**< Verbosity level wrong */
- MRAA_ERROR_INVALID_PARAMETER = 4, /**< Parameter invalid */
- MRAA_ERROR_INVALID_HANDLE = 5, /**< Handle invalid */
- MRAA_ERROR_NO_RESOURCES = 6, /**< No resource of that type avail */
- MRAA_ERROR_INVALID_RESOURCE = 7, /**< Resource invalid */
- MRAA_ERROR_INVALID_QUEUE_TYPE = 8, /**< Queue type incorrect */
- MRAA_ERROR_NO_DATA_AVAILABLE = 9, /**< No data available */
- MRAA_ERROR_INVALID_PLATFORM = 10, /**< Platform not recognised */
- MRAA_ERROR_PLATFORM_NOT_INITIALISED = 11, /**< Board information not initialised */
- MRAA_ERROR_PLATFORM_ALREADY_INITIALISED = 12, /**< Board is already initialised */
-
- MRAA_ERROR_UNSPECIFIED = 99 /**< Unknown Error */
-} mraa_result_t;
-
-/**
- * Enum representing different possible modes for a pin.
- */
-typedef enum {
- MRAA_PIN_VALID = 0, /**< Pin Valid */
- MRAA_PIN_GPIO = 1, /**< General Purpose IO */
- MRAA_PIN_PWM = 2, /**< Pulse Width Modulation */
- MRAA_PIN_FAST_GPIO = 3, /**< Faster GPIO */
- MRAA_PIN_SPI = 4, /**< SPI */
- MRAA_PIN_I2C = 5, /**< I2C */
- MRAA_PIN_AIO = 6, /**< Analog in */
- MRAA_PIN_UART = 7 /**< UART */
-} mraa_pinmodes_t;
-
-/**
- * Enum reprensenting different i2c speeds/modes
- */
-typedef enum {
- MRAA_I2C_STD = 0, /**< up to 100Khz */
- MRAA_I2C_FAST = 1, /**< up to 400Khz */
- MRAA_I2C_HIGH = 2 /**< up to 3.4Mhz */
-} mraa_i2c_mode_t;
-
-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_t;
-
-
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/peripheral/libmraa/api/mraa/types.hpp b/peripheral/libmraa/api/mraa/types.hpp
deleted file mode 100644
index cc6f53a..0000000
--- a/peripheral/libmraa/api/mraa/types.hpp
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
- * Author: Brendan Le Foll <brendan.le.foll@intel.com>
- * Copyright © 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.
- */
-
-#pragma once
-
-/** @file
- *
- * This file defines the basic shared types for libmraa
- * this file is different to common.h in that swig takes this as an input
- */
-
-namespace mraa
-{
-
-//These enums must match the enums in types.h
-
-/**
- * MRAA supported platform types
- */
-typedef enum {
- INTEL_GALILEO_GEN1 = 0, /**< The Generation 1 Galileo platform (RevD) */
- INTEL_GALILEO_GEN2 = 1, /**< The Generation 2 Galileo platform (RevG/H) */
- INTEL_EDISON_FAB_C = 2, /**< The Intel Edison (FAB C) */
- INTEL_DE3815 = 3, /**< The Intel DE3815 Baytrail NUC */
- INTEL_MINNOWBOARD_MAX = 4, /**< The Intel Minnow Board Max */
- RASPBERRY_PI = 5, /**< The different Raspberry PI Models -like A,B,A+,B+ */
- BEAGLEBONE = 6, /**< The different BeagleBone Black Modes B/C */
- BANANA = 7, /**< Allwinner A20 based Banana Pi and Banana Pro */
-
- UNKNOWN_PLATFORM =
- 99 /**< An unknown platform type, typically will load INTEL_GALILEO_GEN1 */
-} Platform;
-
-/**
- * Intel edison miniboard numbering enum
- */
-typedef enum {
- INTEL_EDISON_MINIBOARD_J17_1 = 0,
- INTEL_EDISON_MINIBOARD_J17_5 = 4,
- INTEL_EDISON_MINIBOARD_J17_7 = 6,
- INTEL_EDISON_MINIBOARD_J17_8 = 7,
- INTEL_EDISON_MINIBOARD_J17_9 = 8,
- INTEL_EDISON_MINIBOARD_J17_10 = 9,
- INTEL_EDISON_MINIBOARD_J17_11 = 10,
- INTEL_EDISON_MINIBOARD_J17_12 = 11,
- INTEL_EDISON_MINIBOARD_J17_14 = 13,
- INTEL_EDISON_MINIBOARD_J18_1 = 14,
- INTEL_EDISON_MINIBOARD_J18_2 = 15,
- INTEL_EDISON_MINIBOARD_J18_6 = 19,
- INTEL_EDISON_MINIBOARD_J18_7 = 20,
- INTEL_EDISON_MINIBOARD_J18_8 = 21,
- INTEL_EDISON_MINIBOARD_J18_10 = 23,
- INTEL_EDISON_MINIBOARD_J18_11 = 24,
- INTEL_EDISON_MINIBOARD_J18_12 = 25,
- INTEL_EDISON_MINIBOARD_J18_13 = 26,
- INTEL_EDISON_MINIBOARD_J19_4 = 31,
- INTEL_EDISON_MINIBOARD_J19_5 = 32,
- INTEL_EDISON_MINIBOARD_J19_6 = 33,
- INTEL_EDISON_MINIBOARD_J19_8 = 35,
- INTEL_EDISON_MINIBOARD_J19_9 = 36,
- INTEL_EDISON_MINIBOARD_J19_10 = 37,
- INTEL_EDISON_MINIBOARD_J19_11 = 38,
- INTEL_EDISON_MINIBOARD_J19_12 = 39,
- INTEL_EDISON_MINIBOARD_J19_13 = 40,
- INTEL_EDISON_MINIBOARD_J19_14 = 41,
- INTEL_EDISON_MINIBOARD_J20_3 = 44,
- INTEL_EDISON_MINIBOARD_J20_4 = 45,
- INTEL_EDISON_MINIBOARD_J20_5 = 46,
- INTEL_EDISON_MINIBOARD_J20_6 = 47,
- INTEL_EDISON_MINIBOARD_J20_7 = 48,
- INTEL_EDISON_MINIBOARD_J20_8 = 49,
- INTEL_EDISON_MINIBOARD_J20_9 = 50,
- INTEL_EDISON_MINIBOARD_J20_10 = 51,
- INTEL_EDISON_MINIBOARD_J20_11 = 52,
- INTEL_EDISON_MINIBOARD_J20_12 = 53,
- INTEL_EDISON_MINIBOARD_J20_13 = 54,
- INTEL_EDISON_MINIBOARD_J20_14 = 55
-} IntelEdisonMiniboard;
-
-/**
- * Intel Edison raw GPIO numbering enum
- */
-typedef enum {
- INTEL_EDISON_GP182 = 0,
- INTEL_EDISON_GP135 = 4,
- INTEL_EDISON_GP27 = 6,
- INTEL_EDISON_GP20 = 7,
- INTEL_EDISON_GP28 = 8,
- INTEL_EDISON_GP111 = 0,
- INTEL_EDISON_GP109 = 10,
- INTEL_EDISON_GP115 = 11,
- INTEL_EDISON_GP128 = 13,
- INTEL_EDISON_GP13 = 14,
- INTEL_EDISON_GP165 = 15,
- INTEL_EDISON_GP19 = 19,
- INTEL_EDISON_GP12 = 20,
- INTEL_EDISON_GP183 = 21,
- INTEL_EDISON_GP110 = 23,
- INTEL_EDISON_GP114 = 24,
- INTEL_EDISON_GP129 = 25,
- INTEL_EDISON_GP130 = 26,
- INTEL_EDISON_GP44 = 31,
- INTEL_EDISON_GP46 = 32,
- INTEL_EDISON_GP48 = 33,
- INTEL_EDISON_GP131 = 35,
- INTEL_EDISON_GP14 = 36,
- INTEL_EDISON_GP40 = 37,
- INTEL_EDISON_GP43 = 38,
- INTEL_EDISON_GP77 = 39,
- INTEL_EDISON_GP82 = 40,
- INTEL_EDISON_GP83 = 41,
- INTEL_EDISON_GP134 = 44,
- INTEL_EDISON_GP45 = 45,
- INTEL_EDISON_GP47 = 46,
- INTEL_EDISON_GP49 = 47,
- INTEL_EDISON_GP15 = 48,
- INTEL_EDISON_GP84 = 49,
- INTEL_EDISON_GP42 = 50,
- INTEL_EDISON_GP41 = 51,
- INTEL_EDISON_GP78 = 52,
- INTEL_EDISON_GP79 = 53,
- INTEL_EDISON_GP80 = 54,
- INTEL_EDISON_GP81 = 55
-} IntelEdison;
-
-/**
-* Raspberry PI Wiring compatible numbering enum
-*/
-typedef enum {
- RASPBERRY_WIRING_PIN8 = 3,
- RASPBERRY_WIRING_PIN9 = 5,
- RASPBERRY_WIRING_PIN7 = 7,
- RASPBERRY_WIRING_PIN15 = 8,
- RASPBERRY_WIRING_PIN16 = 10,
- RASPBERRY_WIRING_PIN0 = 11,
- RASPBERRY_WIRING_PIN1 = 12,
- RASPBERRY_WIRING_PIN2 = 13,
- RASPBERRY_WIRING_PIN3 = 15,
- RASPBERRY_WIRING_PIN4 = 16,
- RASPBERRY_WIRING_PIN5 = 18,
- RASPBERRY_WIRING_PIN12 = 19,
- RASPBERRY_WIRING_PIN13 = 21,
- RASPBERRY_WIRING_PIN6 = 22,
- RASPBERRY_WIRING_PIN14 = 23,
- RASPBERRY_WIRING_PIN10 = 24,
- RASPBERRY_WIRING_PIN11 = 26,
- RASPBERRY_WIRING_PIN17 = 29, // RPi B V2
- RASPBERRY_WIRING_PIN21 = 29,
- RASPBERRY_WIRING_PIN18 = 30, // RPi B V2
- RASPBERRY_WIRING_PIN19 = 31, // RPI B V2
- RASPBERRY_WIRING_PIN22 = 31,
- RASPBERRY_WIRING_PIN20 = 32, // RPi B V2
- RASPBERRY_WIRING_PIN26 = 32,
- RASPBERRY_WIRING_PIN23 = 33,
- RASPBERRY_WIRING_PIN24 = 35,
- RASPBERRY_WIRING_PIN27 = 36,
- RASPBERRY_WIRING_PIN25 = 37,
- RASPBERRY_WIRING_PIN28 = 38,
- RASPBERRY_WIRING_PIN29 = 40
-} RaspberryWiring;
-
-/**
- * MRAA return codes
- */
-typedef enum {
- SUCCESS = 0, /**< Expected response */
- ERROR_FEATURE_NOT_IMPLEMENTED = 1, /**< Feature TODO */
- ERROR_FEATURE_NOT_SUPPORTED = 2, /**< Feature not supported by HW */
- ERROR_INVALID_VERBOSITY_LEVEL = 3, /**< Verbosity level wrong */
- ERROR_INVALID_PARAMETER = 4, /**< Parameter invalid */
- ERROR_INVALID_HANDLE = 5, /**< Handle invalid */
- ERROR_NO_RESOURCES = 6, /**< No resource of that type avail */
- ERROR_INVALID_RESOURCE = 7, /**< Resource invalid */
- ERROR_INVALID_QUEUE_TYPE = 8, /**< Queue type incorrect */
- ERROR_NO_DATA_AVAILABLE = 9, /**< No data available */
- ERROR_INVALID_PLATFORM = 10, /**< Platform not recognised */
- ERROR_PLATFORM_NOT_INITIALISED = 11, /**< Board information not initialised */
- ERROR_PLATFORM_ALREADY_INITIALISED = 12, /**< Board is already initialised */
-
- ERROR_UNSPECIFIED = 99 /**< Unknown Error */
-} Result;
-
-/**
- * Enum representing different possible modes for a pin.
- */
-typedef enum {
- PIN_VALID = 0, /**< Pin Valid */
- PIN_GPIO = 1, /**< General Purpose IO */
- PIN_PWM = 2, /**< Pulse Width Modulation */
- PIN_FAST_GPIO = 3, /**< Faster GPIO */
- PIN_SPI = 4, /**< SPI */
- PIN_I2C = 5, /**< I2C */
- PIN_AIO = 6, /**< Analog in */
- PIN_UART = 7 /**< UART */
-} Pinmodes;
-
-/**
- * Enum reprensenting different i2c speeds/modes
- */
-typedef enum {
- I2C_STD = 0, /**< up to 100Khz */
- I2C_FAST = 1, /**< up to 400Khz */
- I2C_HIGH = 2 /**< up to 3.4Mhz */
-} I2cMode;
-
-typedef enum {
- UART_PARITY_NONE = 0,
- UART_PARITY_EVEN = 1,
- UART_PARITY_ODD = 2,
- UART_PARITY_MARK = 3,
- UART_PARITY_SPACE = 4
-} UartParity;
-
-}
diff --git a/peripheral/libmraa/api/mraa/uart.h b/peripheral/libmraa/api/mraa/uart.h
deleted file mode 100644
index 3ca196f..0000000
--- a/peripheral/libmraa/api/mraa/uart.h
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
- * Contributions: Jon Trulson <jtrulson@ics.com>
- * Brendan Le Foll <brendan.le.foll@intel.com>
- * Copyright (c) 2014 - 2015 Intel Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#pragma once
-
-/**
- * @file
- * @brief UART module
- *
- * UART is the Universal asynchronous receiver/transmitter interface to
- * libmraa. It allows the exposure of UART pins on supported boards.
- * With functionality to expand at a later date.
- *
- * @snippet uart.c Interesting
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdio.h>
-
-#include "common.h"
-
-typedef struct _uart* mraa_uart_context;
-
-/**
- * Initialise uart_context, uses board mapping
- *
- * @param uart the index of the uart set to use
- * @return uart context or NULL
- */
-mraa_uart_context mraa_uart_init(int uart);
-
-/**
- * Initialise a raw uart_context. No board setup.
- *
- * @param path for example "/dev/ttyS0"
- * @return uart context or NULL
- */
-mraa_uart_context mraa_uart_init_raw(const char* path);
-
-/**
- * Flush the outbound data.
- * Blocks until complete.
- *
- * @param dev The UART context
- * @return Result of operation
- */
-mraa_result_t mraa_uart_flush(mraa_uart_context dev);
-
-/**
- * Set the baudrate.
- * Takes an int and will attempt to decide what baudrate is
- * to be used on the UART hardware.
- *
- * @param dev The UART context
- * @param baud unsigned int of baudrate i.e. 9600
- * @return Result of operation
- */
-mraa_result_t mraa_uart_set_baudrate(mraa_uart_context dev, unsigned int baud);
-
-/**
- * Set the transfer mode
- * For example setting the mode to 8N1 would be
- * "mraa_uart_set_mode(dev, 8,MRAA_UART_PARITY_NONE , 1)"
- *
- * @param dev The UART context
- * @param bytesize data bits
- * @param parity Parity bit setting
- * @param stopbits stop bits
- * @return Result of operation
- */
-mraa_result_t mraa_uart_set_mode(mraa_uart_context dev, int bytesize, mraa_uart_parity_t parity, int stopbits);
-
-/**
- * Set the flowcontrol
- *
- * @param dev The UART context
- * @param xonxoff XON/XOFF Software flow control.
- * @param rtscts RTS/CTS out of band hardware flow control
- * @return Result of operation
- */
-mraa_result_t mraa_uart_set_flowcontrol(mraa_uart_context dev, mraa_boolean_t xonxoff, mraa_boolean_t rtscts);
-
-/**
- * Set the timeout for read and write operations
- * <= 0 will disable that timeout
- *
- * @param dev The UART context
- * @param read read timeout
- * @param write write timeout
- * @param interchar inbetween char timeout
- * @return Result of operation
- */
-mraa_result_t mraa_uart_set_timeout(mraa_uart_context dev, int read, int write, int interchar);
-
-/**
- * Get Char pointer with tty device path within Linux
- * For example. Could point to "/dev/ttyS0"
- *
- * @param dev uart context
- * @return char pointer of device path
- */
-const char* mraa_uart_get_dev_path(mraa_uart_context dev);
-
-/**
- * Destroy a mraa_uart_context
- *
- * @param dev uart context
- * @return mraa_result_t
- */
-mraa_result_t mraa_uart_stop(mraa_uart_context dev);
-
-/**
- * Read bytes from the device into a buffer
- *
- * @param dev uart context
- * @param buf buffer pointer
- * @param length maximum size of buffer
- * @return the number of bytes read, or -1 if an error occurred
- */
-int mraa_uart_read(mraa_uart_context dev, char* buf, size_t length);
-
-/**
- * Write bytes in buffer to a device
- *
- * @param dev uart context
- * @param buf buffer pointer
- * @param length maximum size of buffer
- * @return the number of bytes written, or -1 if an error occurred
- */
-int mraa_uart_write(mraa_uart_context dev, const char* buf, size_t length);
-
-/**
- * Check to see if data is available on the device for reading
- *
- * @param dev uart context
- * @param millis number of milliseconds to wait, or 0 to return immediately
- * @return 1 if there is data available to read, 0 otherwise
- */
-mraa_boolean_t mraa_uart_data_available(mraa_uart_context dev, unsigned int millis);
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/peripheral/libmraa/api/mraa/uart.hpp b/peripheral/libmraa/api/mraa/uart.hpp
deleted file mode 100644
index cc485a3..0000000
--- a/peripheral/libmraa/api/mraa/uart.hpp
+++ /dev/null
@@ -1,242 +0,0 @@
-/*
- * Author: Brendan Le Foll <brendan.le.foll@intel.com>
- * Contributions: Jon Trulson <jtrulson@ics.com>
- * Contributions: Thomas Ingleby <thomas.c.ingleby@intel.com>
- * Copyright (c) 2014 - 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#pragma once
-
-#include "uart.h"
-#include "types.hpp"
-#include <stdlib.h>
-#include <stdexcept>
-#include <cstring>
-
-namespace mraa
-{
-
-/**
- * @brief API to UART (enabling only)
- *
- * This file defines the UART interface for libmraa
- *
- * @snippet Uart-example.cpp Interesting
- */
-class Uart
-{
- public:
- /**
- * Uart 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 set to use
- */
- Uart(int uart)
- {
- m_uart = mraa_uart_init(uart);
-
- if (m_uart == NULL) {
- throw std::invalid_argument("Error initialising UART");
- }
- }
-
- /**
- * Uart Constructor, takes a string to the path of the serial
- * interface that is needed.
- *
- * @param uart the index of the uart set to use
- */
- Uart(std::string path)
- {
- m_uart = mraa_uart_init_raw(path.c_str());
-
- if (m_uart == NULL) {
- throw std::invalid_argument("Error initialising UART");
- }
- }
-
- /**
- * Uart destructor
- */
- ~Uart()
- {
- mraa_uart_stop(m_uart);
- }
-
- /**
- * Get string with tty device path within Linux
- * For example. Could point to "/dev/ttyS0"
- *
- * @return char pointer of device path
- */
- std::string
- getDevicePath()
- {
- std::string ret_val(mraa_uart_get_dev_path(m_uart));
- return ret_val;
- }
-
- /**
- * Read bytes from the device into char* buffer
- *
- * @param data buffer pointer
- * @param length maximum size of buffer
- * @return numbers of bytes read
- */
- int
- read(char* data, int length)
- {
- return mraa_uart_read(m_uart, data, (size_t) length);
- }
-
- /**
- * Write bytes in String object to a device
- *
- * @param data buffer pointer
- * @param length maximum size of buffer
- * @return the number of bytes written, or -1 if an error occurred
- */
- int
- write(const char* data, int length)
- {
- return mraa_uart_write(m_uart, data, (size_t) length);
- }
-
- /**
- * Read bytes from the device into a String object
- *
- * @param length to read
- * @return string of data
- */
- std::string
- readStr(int length)
- {
- char* data = (char*) malloc(sizeof(char) * length);
- int v = mraa_uart_read(m_uart, data, (size_t) length);
- std::string ret(data, v);
- free(data);
- return ret;
- }
-
- /**
- * Write bytes in String object to a device
- *
- * @param string to write
- * @return the number of bytes written, or -1 if an error occurred
- */
- int
- writeStr(std::string data)
- {
- // this is data.length() not +1 because we want to avoid the '\0' char
- return mraa_uart_write(m_uart, data.c_str(), (data.length()));
- }
-
- /**
- * Check to see if data is available on the device for reading
- *
- * @param millis number of milliseconds to wait, or 0 to return immediately
- * @return true if there is data available to read, false otherwise
- */
- bool
- dataAvailable(unsigned int millis = 0)
- {
- if (mraa_uart_data_available(m_uart, millis))
- return true;
- else
- return false;
- }
-
- /**
- * Flush the outbound data.
- * Blocks until complete.
- *
- * @return Result of operation
- */
- Result
- flush()
- {
- return (Result) mraa_uart_flush(m_uart);
- }
-
- /**
- * Set the baudrate.
- * Takes an int and will attempt to decide what baudrate is
- * to be used on the UART hardware.
- *
- * @param baud unsigned int of baudrate i.e. 9600
- * @return Result of operation
- */
- Result
- setBaudRate(unsigned int baud)
- {
- return (Result) mraa_uart_set_baudrate(m_uart, baud);
- }
-
- /**
- * Set the transfer mode
- * For example setting the mode to 8N1 would be
- * "dev.setMode(8,UART_PARITY_NONE , 1)"
- *
- * @param bytesize data bits
- * @param parity Parity bit setting
- * @param stopbits stop bits
- * @return Result of operation
- */
- Result
- setMode(int bytesize, UartParity parity, int stopbits)
- {
- return (Result) mraa_uart_set_mode(m_uart, bytesize, (mraa_uart_parity_t) parity, stopbits);
- }
-
- /**
- * Set the flowcontrol
- *
- * @param xonxoff XON/XOFF Software flow control.
- * @param rtscts RTS/CTS out of band hardware flow control
- * @return Result of operation
- */
- Result
- setFlowcontrol(bool xonxoff, bool rtscts)
- {
- return (Result) mraa_uart_set_flowcontrol(m_uart, xonxoff, rtscts);
- }
-
- /**
- * Set the timeout for read and write operations
- * <= 0 will disable that timeout
- *
- * @param read read timeout
- * @param write write timeout
- * @param interchar inbetween char timeout
- * @return Result of operation
- */
- Result
- setTimeout(int read, int write, int interchar)
- {
- return (Result) mraa_uart_set_timeout(m_uart, read, write, interchar);
- }
-
- private:
- mraa_uart_context m_uart;
-};
-}
diff --git a/peripheral/libmraa/cmake/Toolchains/oe-sdk_cross.cmake b/peripheral/libmraa/cmake/Toolchains/oe-sdk_cross.cmake
deleted file mode 100644
index 8a82c29..0000000
--- a/peripheral/libmraa/cmake/Toolchains/oe-sdk_cross.cmake
+++ /dev/null
@@ -1,25 +0,0 @@
-# this toolchain file comes from gnuradio project
-
-set( CMAKE_SYSTEM_NAME Linux )
-#set( CMAKE_C_COMPILER $ENV{CC} )
-#set( CMAKE_CXX_COMPILER $ENV{CXX} )
-string(REGEX MATCH "sysroots/([a-zA-Z0-9]+)" CMAKE_SYSTEM_PROCESSOR $ENV{SDKTARGETSYSROOT})
-string(REGEX REPLACE "sysroots/" "" CMAKE_SYSTEM_PROCESSOR ${CMAKE_SYSTEM_PROCESSOR})
-set( CMAKE_CXX_FLAGS $ENV{CXXFLAGS} CACHE STRING "" FORCE )
-set( CMAKE_C_FLAGS $ENV{CFLAGS} CACHE STRING "" FORCE ) #same flags for C sources
-set( CMAKE_LDFLAGS_FLAGS ${CMAKE_CXX_FLAGS} CACHE STRING "" FORCE ) #same flags for C sources
-set( CMAKE_LIBRARY_PATH ${OECORE_TARGET_SYSROOT}/usr/lib )
-set( CMAKE_FIND_ROOT_PATH $ENV{OECORE_TARGET_SYSROOT} $ENV{OECORE_NATIVE_SYSROOT} )
-set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )
-set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
-set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
-set( CMAKE_INSTALL_PREFIX $ENV{OECORE_TARGET_SYSROOT}/usr CACHE STRING "" FORCE)
-set( ORC_INCLUDE_DIRS $ENV{OECORE_TARGET_SYSROOT}/usr/include/orc-0.4 )
-set( ORC_LIBRARY_DIRS $ENV{OECORE_TARGET_SYSROOT}/usr/lib )
-
-# for java
-set( JAVA_AWT_INCLUDE_PATH $ENV{JAVA_HOME}/include CACHE PATH "" FORCE)
-set( JAVA_AWT_LIBRARY $ENV{JAVA_HOME}/jre/lib/amd64/libjawt.so CACHE FILEPATH "" FORCE)
-set( JAVA_INCLUDE_PATH $ENV{JAVA_HOME}/include CACHE PATH "" FORCE)
-set( JAVA_INCLUDE_PATH2 $ENV{JAVA_HOME}/include/linux CACHE PATH "" FORCE)
-set( JAVA_JVM_LIBRARY $ENV{JAVA_HOME}/jre/lib/amd64/libjvm.so CACHE FILEPATH "" FORCE)
diff --git a/peripheral/libmraa/cmake/modules/COPYING-CMAKE-SCRIPTS b/peripheral/libmraa/cmake/modules/COPYING-CMAKE-SCRIPTS
deleted file mode 100644
index 53b6b71..0000000
--- a/peripheral/libmraa/cmake/modules/COPYING-CMAKE-SCRIPTS
+++ /dev/null
@@ -1,22 +0,0 @@
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-
-1. Redistributions of source code must retain the copyright
- notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-3. The name of the author may not be used to endorse or promote products
- derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/peripheral/libmraa/cmake/modules/CPackDeb.cmake b/peripheral/libmraa/cmake/modules/CPackDeb.cmake
deleted file mode 100644
index e924f54..0000000
--- a/peripheral/libmraa/cmake/modules/CPackDeb.cmake
+++ /dev/null
@@ -1,222 +0,0 @@
-# - The builtin (binary) CPack Deb generator (Unix only)
-# CPackDeb may be used to create Deb package using CPack.
-# CPackDeb is a CPack generator thus it uses the CPACK_XXX variables
-# used by CPack : http://www.cmake.org/Wiki/CMake:CPackConfiguration
-#
-# However CPackRPM has specific features which are controlled by
-# the specifics CPACK_RPM_XXX variables.You'll find a detailed usage on
-# the wiki:
-# http://www.cmake.org/Wiki/CMake:CPackPackageGenerators#DEB_.28UNIX_only.29
-# However as a handy reminder here comes the list of specific variables:
-#
-# CPACK_DEBIAN_PACKAGE_NAME
-# Mandatory : YES
-# Default : CPACK_PACKAGE_NAME (lower case)
-# The debian package summary
-# CPACK_DEBIAN_PACKAGE_VERSION
-# Mandatory : YES
-# Default : CPACK_PACKAGE_VERSION
-# The debian package version
-# CPACK_DEBIAN_PACKAGE_ARCHITECTURE)
-# Mandatory : YES
-# Default : Output of dpkg --print-architecture or i386
-# The debian package architecture
-# CPACK_DEBIAN_PACKAGE_DEPENDS
-# Mandatory : NO
-# Default : -
-# May be used to set deb dependencies.
-# CPACK_DEBIAN_PACKAGE_MAINTAINER
-# Mandatory : YES
-# Default : CPACK_PACKAGE_CONTACT
-# The debian package maintainer
-# CPACK_DEBIAN_PACKAGE_DESCRIPTION
-# Mandatory : YES
-# Default : CPACK_PACKAGE_DESCRIPTION_SUMMARY
-# The debian package description
-# CPACK_DEBIAN_PACKAGE_SECTION
-# Mandatory : YES
-# Default : 'devel'
-# The debian package section
-# CPACK_DEBIAN_PACKAGE_PRIORITY
-# Mandatory : YES
-# Default : 'optional'
-# The debian package priority
-
-#=============================================================================
-# Copyright 2007-2009 Kitware, Inc.
-# Copyright 2007-2009 Mathieu Malaterre <mathieu.malaterre@gmail.com>
-#
-# Distributed under the OSI-approved BSD License (the "License");
-# see accompanying file Copyright.txt for details.
-#
-# This software is distributed WITHOUT ANY WARRANTY; without even the
-# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the License for more information.
-#=============================================================================
-# (To distributed this file outside of CMake, substitute the full
-# License text for the above reference.)
-
-# CPack script for creating Debian package
-# Author: Mathieu Malaterre
-#
-# http://wiki.debian.org/HowToPackageForDebian
-
-IF(CMAKE_BINARY_DIR)
- MESSAGE(FATAL_ERROR "CPackDeb.cmake may only be used by CPack internally.")
-ENDIF(CMAKE_BINARY_DIR)
-
-IF(NOT UNIX)
- MESSAGE(FATAL_ERROR "CPackDeb.cmake may only be used under UNIX.")
-ENDIF(NOT UNIX)
-
-# Let's define the control file found in debian package:
-
-# Binary package:
-# http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-binarycontrolfiles
-
-# DEBIAN/control
-# debian policy enforce lower case for package name
-# Package: (mandatory)
-IF(NOT CPACK_DEBIAN_PACKAGE_NAME)
- STRING(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_DEBIAN_PACKAGE_NAME)
-ENDIF(NOT CPACK_DEBIAN_PACKAGE_NAME)
-
-# Version: (mandatory)
-IF(NOT CPACK_DEBIAN_PACKAGE_VERSION)
- IF(NOT CPACK_PACKAGE_VERSION)
- MESSAGE(FATAL_ERROR "Debian package requires a package version")
- ENDIF(NOT CPACK_PACKAGE_VERSION)
- SET(CPACK_DEBIAN_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION})
-ENDIF(NOT CPACK_DEBIAN_PACKAGE_VERSION)
-
-# Architecture: (mandatory)
-IF(NOT CPACK_DEBIAN_PACKAGE_ARCHITECTURE)
- # There is no such thing as i686 architecture on debian, you should use i386 instead
- # $ dpkg --print-architecture
- FIND_PROGRAM(DPKG_CMD dpkg)
- IF(NOT DPKG_CMD)
- MESSAGE(STATUS "Can not find dpkg in your path, default to i386.")
- SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE i386)
- ENDIF(NOT DPKG_CMD)
- EXECUTE_PROCESS(COMMAND "${DPKG_CMD}" --print-architecture
- OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE
- OUTPUT_STRIP_TRAILING_WHITESPACE
- )
-ENDIF(NOT CPACK_DEBIAN_PACKAGE_ARCHITECTURE)
-
-# have a look at GET_PROPERTY(result GLOBAL PROPERTY ENABLED_FEATURES),
-# this returns the successful FIND_PACKAGE() calls, maybe this can help
-# Depends:
-# You should set: DEBIAN_PACKAGE_DEPENDS
-# TODO: automate 'objdump -p | grep NEEDED'
-IF(NOT CPACK_DEBIAN_PACKAGE_DEPENDS)
- MESSAGE(STATUS "CPACK_DEBIAN_PACKAGE_DEPENDS not set, the package will have no dependencies.")
-ENDIF(NOT CPACK_DEBIAN_PACKAGE_DEPENDS)
-
-# Maintainer: (mandatory)
-IF(NOT CPACK_DEBIAN_PACKAGE_MAINTAINER)
- IF(NOT CPACK_PACKAGE_CONTACT)
- MESSAGE(FATAL_ERROR "Debian package requires a maintainer for a package, set CPACK_PACKAGE_CONTACT or CPACK_DEBIAN_PACKAGE_MAINTAINER")
- ENDIF(NOT CPACK_PACKAGE_CONTACT)
- SET(CPACK_DEBIAN_PACKAGE_MAINTAINER ${CPACK_PACKAGE_CONTACT})
-ENDIF(NOT CPACK_DEBIAN_PACKAGE_MAINTAINER)
-
-# Description: (mandatory)
-IF(NOT CPACK_DEBIAN_PACKAGE_DESCRIPTION)
- IF(NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY)
- MESSAGE(FATAL_ERROR "Debian package requires a summary for a package, set CPACK_PACKAGE_DESCRIPTION_SUMMARY or CPACK_DEBIAN_PACKAGE_DESCRIPTION")
- ENDIF(NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY)
- SET(CPACK_DEBIAN_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION_SUMMARY})
-ENDIF(NOT CPACK_DEBIAN_PACKAGE_DESCRIPTION)
-
-# Section: (recommended)
-IF(NOT CPACK_DEBIAN_PACKAGE_SECTION)
- SET(CPACK_DEBIAN_PACKAGE_SECTION "devel")
-ENDIF(NOT CPACK_DEBIAN_PACKAGE_SECTION)
-
-# Priority: (recommended)
-IF(NOT CPACK_DEBIAN_PACKAGE_PRIORITY)
- SET(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
-ENDIF(NOT CPACK_DEBIAN_PACKAGE_PRIORITY )
-
-# Recommends:
-# You should set: CPACK_DEBIAN_PACKAGE_RECOMMENDS
-
-# Suggests:
-# You should set: CPACK_DEBIAN_PACKAGE_SUGGESTS
-
-# CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
-# This variable allow advanced user to add custom script to the control.tar.gz (inside the .deb archive)
-# Typical examples are:
-# - conffiles
-# - postinst
-# - postrm
-# - prerm"
-# Usage:
-# SET(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
-# "${CMAKE_CURRENT_SOURCE_DIR/prerm;${CMAKE_CURRENT_SOURCE_DIR}/postrm")
-
-
-# For debian source packages:
-# debian/control
-# http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-sourcecontrolfiles
-
-# .dsc
-# http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-debiansourcecontrolfiles
-
-# Builds-Depends:
-#IF(NOT CPACK_DEBIAN_PACKAGE_BUILDS_DEPENDS)
-# SET(CPACK_DEBIAN_PACKAGE_BUILDS_DEPENDS
-# "debhelper (>> 5.0.0), libncurses5-dev, tcl8.4"
-# )
-#ENDIF(NOT CPACK_DEBIAN_PACKAGE_BUILDS_DEPENDS)
-
-# Description: (mandatory)
-#if(NOT CPACK_SECTION)
-# message(FATAL_ERROR "opkg package requires a package section")
-#endif(NOT CPACK_SECTION)
-
-# Package for opkg
-FIND_PROGRAM(OPKG_CMD opkg-build)
-if( ${OPKG_CMD} STREQUAL "OPKG_CMD-NOTFOUND" )
- message("CPack: opkg-build not found. Skipping packaging")
-else( ${OPKG_CMD} STREQUAL "OPKG_CMD-NOTFOUND" )
- SET(CPACK_OPKG_ROOTDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}")
- FILE(MAKE_DIRECTORY ${CPACK_OPKG_ROOTDIR}/CONTROL)
- set(CPACK_OPKG_CONTROL_FILE "${CPACK_OPKG_ROOTDIR}/CONTROL/control")
- # Write controlfile
- FILE(WRITE ${CPACK_OPKG_CONTROL_FILE}
- "Package: ${CPACK_PACKAGE_NAME}
-Version: ${CPACK_PACKAGE_VERSION}
-Description: ${CPACK_PACKAGE_DESCRIPTION_SUMMARY}
-Architecture: ${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}
-Section: ${CPACK_DEBIAN_PACKAGE_SECTION}
-Priority: optional
-Maintainer: ${CPACK_DEBIAN_PACKAGE_MAINTAINER}
-Depends:
-Provides: ${CPACK_DEBIAN_PACKAGE_PROVIDES}
-Replaces: ${CPACK_DEBIAN_PACKAGE_REPLACES}
-Conflicts: ${CPACK_DEBIAN_PACKAGE_CONFLICTS}
-Source: https://github.com/intel-iot-devkit/mraa
-#Essential: no
-")
-
-set(OPKG_FILE_NAME "${CPACK_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}")
- execute_process(
- COMMAND "${OPKG_CMD}" "-o" "0" "${CPACK_PACKAGE_FILE_NAME}" "."
- RESULT_VARIABLE _result
- OUTPUT_VARIABLE _res_output
- ERROR_VARIABLE _res_error
- WORKING_DIRECTORY ${CPACK_TOPLEVEL_DIRECTORY}
- )
-
- if(${_result})
- message("Result '${_result}'")
- message("Output '${_res_output}'")
- message("Error '${_res_error}'")
- else(${_result})
- message("CPack: Package ${OPKG_FILE_NAME}.ipk generated.")
- set(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}")
- file(RENAME ${CPACK_TOPLEVEL_DIRECTORY}/${OPKG_FILE_NAME}.ipk ${CPACK_BINARY_DIR}/${OPKG_FILE_NAME}.ipk)
- endif(${_result})
-endif( ${OPKG_CMD} STREQUAL "OPKG_CMD-NOTFOUND" )
diff --git a/peripheral/libmraa/cmake/modules/Copyright.txt b/peripheral/libmraa/cmake/modules/Copyright.txt
deleted file mode 100644
index 6c9fb09..0000000
--- a/peripheral/libmraa/cmake/modules/Copyright.txt
+++ /dev/null
@@ -1,57 +0,0 @@
-CMake - Cross Platform Makefile Generator
-Copyright 2000-2015 Kitware, Inc.
-Copyright 2000-2011 Insight Software Consortium
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-
-* Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
-* Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
-* Neither the names of Kitware, Inc., the Insight Software Consortium,
- nor the names of their contributors may be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-------------------------------------------------------------------------------
-
-The above copyright and license notice applies to distributions of
-CMake in source and binary form. Some source files contain additional
-notices of original copyright by their contributors; see each source
-for details. Third-party software packages supplied with CMake under
-compatible licenses provide their own copyright notices documented in
-corresponding subdirectories.
-
-------------------------------------------------------------------------------
-
-CMake was initially developed by Kitware with the following sponsorship:
-
- * National Library of Medicine at the National Institutes of Health
- as part of the Insight Segmentation and Registration Toolkit (ITK).
-
- * US National Labs (Los Alamos, Livermore, Sandia) ASC Parallel
- Visualization Initiative.
-
- * National Alliance for Medical Image Computing (NAMIC) is funded by the
- National Institutes of Health through the NIH Roadmap for Medical Research,
- Grant U54 EB005149.
-
- * Kitware, Inc.
diff --git a/peripheral/libmraa/cmake/modules/FindFtd2xx.cmake b/peripheral/libmraa/cmake/modules/FindFtd2xx.cmake
deleted file mode 100644
index 40fedcf..0000000
--- a/peripheral/libmraa/cmake/modules/FindFtd2xx.cmake
+++ /dev/null
@@ -1,73 +0,0 @@
-# - Try to find libftd2xx
-# Once done this will define
-#
-# LIBFTD2XX_FOUND - system has libftd2xx
-# LIBFTD2XX_INCLUDE_DIRS - the libftd2xx include directory
-# LIBFTD2XX_LIBRARIES - Link these to use libftd2xx
-# LIBFTD2XX_DEFINITIONS - Compiler switches required for using libftd2xx
-#
-# Adapted from cmake-modules Google Code project
-#
-# Copyright (c) 2006 Andreas Schneider <mail@cynapses.org>
-#
-# (Changes for libftd2xx) Copyright (c) 2008 Kyle Machulis <kyle@nonpolynomial.com>
-#
-# Redistribution and use is allowed according to the terms of the New BSD license.
-# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
-
-if (LIBFTD2XX_LIBRARIES AND LIBFTD2XX_INCLUDE_DIRS)
- # in cache already
- set(LIBFTD2XX_FOUND TRUE)
-else (LIBFTD2XX_LIBRARIES AND LIBFTD2XX_INCLUDE_DIRS)
- find_path(LIBFTD2XX_INCLUDE_DIR
- NAMES
- ftd2xx.h
- PATHS
- /usr/include
- /usr/local/include
- /opt/local/include
- /sw/include
- )
-
- SET(FTD2XX_LIBNAME ftd2xx)
- IF(WIN32)
- SET(FTD2XX_LIBNAME ftd2xx.lib)
- ENDIF(WIN32)
-
- find_library(LIBFTD2XX_LIBRARY
- NAMES
- ${FTD2XX_LIBNAME}
- PATHS
- /usr/lib
- /usr/local/lib
- /opt/local/lib
- /sw/lib
- )
-
- if(LIBFTD2XX_INCLUDE_DIR)
- 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)
- endif (LIBFTD2XX_INCLUDE_DIRS AND LIBFTD2XX_LIBRARIES)
-
- if (LIBFTD2XX_FOUND)
- if (NOT libftd2xx_FIND_QUIETLY)
- 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")
- endif (libftd2xx_FIND_REQUIRED)
- endif (LIBFTD2XX_FOUND)
-
- # show the LIBFTD2XX_INCLUDE_DIRS and LIBFTD2XX_LIBRARIES variables only in the advanced view
- mark_as_advanced(LIBFTD2XX_INCLUDE_DIRS LIBFTD2XX_LIBRARIES)
-
-endif (LIBFTD2XX_LIBRARIES AND LIBFTD2XX_INCLUDE_DIRS)
diff --git a/peripheral/libmraa/cmake/modules/FindFtd4222.cmake b/peripheral/libmraa/cmake/modules/FindFtd4222.cmake
deleted file mode 100644
index ea49aac..0000000
--- a/peripheral/libmraa/cmake/modules/FindFtd4222.cmake
+++ /dev/null
@@ -1,75 +0,0 @@
-# - Try to find LIBFT4222
-# Once done this will define
-#
-# LIBFT4222_FOUND - system has LIBFT4222
-# LIBFT4222_INCLUDE_DIRS - the LIBFT4222 include directory
-# LIBFT4222_LIBRARIES - Link these to use LIBFT4222
-# LIBFT4222_DEFINITIONS - Compiler switches required for using LIBFT4222
-#
-# Adapted from cmake-modules Google Code project
-#
-# Copyright (c) 2006 Andreas Schneider <mail@cynapses.org>
-#
-# (Changes for LIBFTD2XX) Copyright (c) 2008 Kyle Machulis <kyle@nonpolynomial.com>
-# (Changes for LIBFT4222) Henry Bruce <henry.bruce@intel.com> Copyright (c) 2015 Intel Corporation.
-#
-# Redistribution and use is allowed according to the terms of the New BSD license.
-# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
-
-if (LIBFT4222_LIBRARIES AND LIBFT4222_INCLUDE_DIRS)
- # in cache already
- set(LIBFT4222_FOUND TRUE)
-else (LIBFT4222_LIBRARIES AND LIBFT4222_INCLUDE_DIRS)
- find_path(LIBFT4222_INCLUDE_DIR
- NAMES
- libft4222.h
- PATHS
- /usr/include
- /usr/local/include
- /opt/local/include
- /sw/include
- )
-
- SET(FTD4222_LIBNAME ft4222)
- IF(WIN32)
- SET(FTD4222_LIBNAME LibFT4222.lib)
- ENDIF(WIN32)
-
- find_library(LIBFT4222_LIBRARY
- NAMES
- ${FTD4222_LIBNAME}
- PATHS
- /usr/lib
- /usr/local/lib
- /opt/local/lib
- /sw/lib
- )
-
- if(LIBFT4222_INCLUDE_DIR)
- 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)
- endif (LIBFT4222_INCLUDE_DIRS AND LIBFT4222_LIBRARIES)
-
- if (LIBFT4222_FOUND)
- if (NOT LIBFT4222_FIND_QUIETLY)
- 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")
- endif (LIBFT4222_FIND_REQUIRED)
- endif (LIBFT4222_FOUND)
-
- # show the LIBFT4222_INCLUDE_DIRS and LIBFT4222_LIBRARIES variables only in the advanced view
- mark_as_advanced(LIBFT4222_INCLUDE_DIRS LIBFT4222_LIBRARIES)
-
-endif (LIBFT4222_LIBRARIES AND LIBFT4222_INCLUDE_DIRS)
-
diff --git a/peripheral/libmraa/cmake/modules/FindNodejs.cmake b/peripheral/libmraa/cmake/modules/FindNodejs.cmake
deleted file mode 100644
index 5030768..0000000
--- a/peripheral/libmraa/cmake/modules/FindNodejs.cmake
+++ /dev/null
@@ -1,94 +0,0 @@
- # 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})
- endif()
-endmacro()
-
-
-find_program (NODEJS_EXECUTABLE NAMES node nodejs
- HINTS
- $ENV{NODE_DIR}
- PATH_SUFFIXES bin
- 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})
-endif()
-
-# Now look for node. Flag an error if not found
-find_path (NODE_ROOT_DIR "node/node.h" "src/node.h"
- PATHS /usr/include/nodejs /usr/local/include/nodejs /usr/local/include)
-if (NODE_ROOT_DIR)
- add_include_dir(${NODE_ROOT_DIR}/src)
- add_include_dir(${NODE_ROOT_DIR}/node)
- add_include_dir(${NODE_ROOT_DIR}/deps/v8/include)
- add_include_dir(${NODE_ROOT_DIR}/deps/uv/include)
-else()
- 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")
-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")
-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)
- execute_process(COMMAND ${NODEJS_EXECUTABLE} -e "console.log(process.versions.v8)"
- 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}")
- list (GET _VERSION_LIST 0 NODE_VERSION_MAJOR)
- list (GET _VERSION_LIST 1 NODE_VERSION_MINOR)
- list (GET _VERSION_LIST 2 NODE_VERSION_PATCH)
- set (V8_VERSION_STRING ${_V8_VERSION})
- string (REPLACE "." ";" _V8_VERSION_LIST "${_V8_VERSION}")
- list (GET _V8_VERSION_LIST 0 V8_VERSION_MAJOR)
- list (GET _V8_VERSION_LIST 1 V8_VERSION_MINOR)
- list (GET _V8_VERSION_LIST 2 V8_VERSION_PATCH)
- # we end up with a nasty newline so strip everything that isn't a number
- string (REGEX MATCH "^[0-9]*" V8_VERSION_PATCH ${V8_VERSION_PATCH})
- else ()
- set (NODE_VERSION_STRING "0.10.30")
- set (NODE_VERSION_MAJOR "0")
- set (NODE_VERSION_MINOR "10")
- set (NODE_VERSION_PATCH "30")
- set (V8_VERSION_MAJOR "3")
- set (V8_VERSION_MINOR"14")
- set (V8_VERSION_PATCH "5")
- set (V8_VERSION_STRING "3.28.72")
- 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)
-endif ()
-
diff --git a/peripheral/libmraa/cmake/modules/FindSphinx.cmake b/peripheral/libmraa/cmake/modules/FindSphinx.cmake
deleted file mode 100644
index 4a3fb13..0000000
--- a/peripheral/libmraa/cmake/modules/FindSphinx.cmake
+++ /dev/null
@@ -1,14 +0,0 @@
-find_program (SPHINX_EXECUTABLE NAMES sphinx-build
- HINTS
- $ENV{SPHINX_DIR}
- PATH_SUFFIXES bin
- DOC "Sphinx documentation generator"
-)
-
-include (FindPackageHandleStandardArgs)
-
-find_package_handle_standard_args (Sphinx DEFAULT_MSG
- SPHINX_EXECUTABLE
-)
-
-mark_as_advanced (SPHINX_EXECUTABLE)
diff --git a/peripheral/libmraa/cmake/modules/FindYuidoc.cmake b/peripheral/libmraa/cmake/modules/FindYuidoc.cmake
deleted file mode 100644
index 23175ce..0000000
--- a/peripheral/libmraa/cmake/modules/FindYuidoc.cmake
+++ /dev/null
@@ -1,21 +0,0 @@
-find_program (YUIDOC_EXECUTABLE NAMES yuidoc
- HINTS $ENV{YUIDOC_DIR}
- PATHS usr usr/local
- PATH_SUFFIXES bin
- DOC "Yuidoc documentation generator"
-)
-
-include (FindPackageHandleStandardArgs)
-
-find_package_handle_standard_args (Yuidoc DEFAULT_MSG
- YUIDOC_EXECUTABLE
-)
-
-# Get Yuidoc version
-if (YUIDOC_EXECUTABLE)
- execute_process(COMMAND ${YUIDOC_EXECUTABLE} --version
- ERROR_VARIABLE YUIDOC_VERSION)
- message ("INFO - Yuidoc version is " ${YUIDOC_VERSION})
-endif ()
-
-mark_as_advanced (YUIDOC_EXECUTABLE)
diff --git a/peripheral/libmraa/cmake/modules/GetGitRevisionDescription.cmake b/peripheral/libmraa/cmake/modules/GetGitRevisionDescription.cmake
deleted file mode 100644
index c8d27f2..0000000
--- a/peripheral/libmraa/cmake/modules/GetGitRevisionDescription.cmake
+++ /dev/null
@@ -1,130 +0,0 @@
-# - Returns a version string from Git
-#
-# These functions force a re-configure on each git commit so that you can
-# trust the values of the variables in your build system.
-#
-# get_git_head_revision(<refspecvar> <hashvar> [<additional arguments to git describe> ...])
-#
-# Returns the refspec and sha hash of the current head revision
-#
-# git_describe(<var> [<additional arguments to git describe> ...])
-#
-# Returns the results of git describe on the source tree, and adjusting
-# the output so that it tests false if an error occurs.
-#
-# git_get_exact_tag(<var> [<additional arguments to git describe> ...])
-#
-# Returns the results of git describe --exact-match on the source tree,
-# and adjusting the output so that it tests false if there was no exact
-# matching tag.
-#
-# Requires CMake 2.6 or newer (uses the 'function' command)
-#
-# Original Author:
-# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
-# http://academic.cleardefinition.com
-# Iowa State University HCI Graduate Program/VRAC
-#
-# Copyright Iowa State University 2009-2010.
-# 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)
-
-if(__get_git_revision_description)
- return()
-endif()
-set(__get_git_revision_description YES)
-
-# We must run the following at "include" time, not at function call time,
-# to find the path to this module rather than the path to a calling list file
-get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH)
-
-function(get_git_head_revision _refspecvar _hashvar)
- set(GIT_PARENT_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
- set(GIT_DIR "${GIT_PARENT_DIR}/.git")
- while(NOT EXISTS "${GIT_DIR}") # .git dir not found, search parent directories
- set(GIT_PREVIOUS_PARENT "${GIT_PARENT_DIR}")
- get_filename_component(GIT_PARENT_DIR ${GIT_PARENT_DIR} PATH)
- if(GIT_PARENT_DIR STREQUAL GIT_PREVIOUS_PARENT)
- # We have reached the root directory, we are not in git
- set(${_refspecvar} "GITDIR-NOTFOUND" PARENT_SCOPE)
- set(${_hashvar} "GITDIR-NOTFOUND" PARENT_SCOPE)
- return()
- endif()
- set(GIT_DIR "${GIT_PARENT_DIR}/.git")
- endwhile()
- # check if this is a submodule
- if(NOT IS_DIRECTORY ${GIT_DIR})
- file(READ ${GIT_DIR} submodule)
- string(REGEX REPLACE "gitdir: (.*)\n$" "\\1" GIT_DIR_RELATIVE ${submodule})
- get_filename_component(SUBMODULE_DIR ${GIT_DIR} PATH)
- get_filename_component(GIT_DIR ${SUBMODULE_DIR}/${GIT_DIR_RELATIVE} ABSOLUTE)
- endif()
- set(GIT_DATA "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/git-data")
- if(NOT EXISTS "${GIT_DATA}")
- file(MAKE_DIRECTORY "${GIT_DATA}")
- endif()
-
- if(NOT EXISTS "${GIT_DIR}/HEAD")
- return()
- endif()
- set(HEAD_FILE "${GIT_DATA}/HEAD")
- configure_file("${GIT_DIR}/HEAD" "${HEAD_FILE}" COPYONLY)
-
- configure_file("${_gitdescmoddir}/GetGitRevisionDescription.cmake.in"
- "${GIT_DATA}/grabRef.cmake"
- @ONLY)
- include("${GIT_DATA}/grabRef.cmake")
-
- set(${_refspecvar} "${HEAD_REF}" PARENT_SCOPE)
- set(${_hashvar} "${HEAD_HASH}" PARENT_SCOPE)
-endfunction()
-
-function(git_describe _var)
- if(NOT GIT_FOUND)
- find_package(Git QUIET)
- endif()
- get_git_head_revision(refspec hash)
- if(NOT GIT_FOUND)
- set(${_var} "GIT-NOTFOUND" PARENT_SCOPE)
- return()
- endif()
- if(NOT hash)
- set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE)
- return()
- endif()
-
- # TODO sanitize
- #if((${ARGN}" MATCHES "&&") OR
- # (ARGN MATCHES "||") OR
- # (ARGN MATCHES "\\;"))
- # message("Please report the following error to the project!")
- # message(FATAL_ERROR "Looks like someone's doing something nefarious with git_describe! Passed arguments ${ARGN}")
- #endif()
-
- #message(STATUS "Arguments to execute_process: ${ARGN}")
-
- execute_process(COMMAND
- "${GIT_EXECUTABLE}"
- describe
- ${hash}
- ${ARGN}
- WORKING_DIRECTORY
- "${CMAKE_SOURCE_DIR}"
- RESULT_VARIABLE
- res
- OUTPUT_VARIABLE
- out
- ERROR_QUIET
- OUTPUT_STRIP_TRAILING_WHITESPACE)
- if(NOT res EQUAL 0)
- set(out "${out}-${res}-NOTFOUND")
- endif()
-
- set(${_var} "${out}" PARENT_SCOPE)
-endfunction()
-
-function(git_get_exact_tag _var)
- git_describe(out --exact-match ${ARGN})
- set(${_var} "${out}" PARENT_SCOPE)
-endfunction()
diff --git a/peripheral/libmraa/cmake/modules/GetGitRevisionDescription.cmake.in b/peripheral/libmraa/cmake/modules/GetGitRevisionDescription.cmake.in
deleted file mode 100644
index 888ce13..0000000
--- a/peripheral/libmraa/cmake/modules/GetGitRevisionDescription.cmake.in
+++ /dev/null
@@ -1,38 +0,0 @@
-#
-# Internal file for GetGitRevisionDescription.cmake
-#
-# Requires CMake 2.6 or newer (uses the 'function' command)
-#
-# Original Author:
-# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
-# http://academic.cleardefinition.com
-# Iowa State University HCI Graduate Program/VRAC
-#
-# Copyright Iowa State University 2009-2010.
-# 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)
-
-set(HEAD_HASH)
-
-file(READ "@HEAD_FILE@" HEAD_CONTENTS LIMIT 1024)
-
-string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS)
-if(HEAD_CONTENTS MATCHES "ref")
- # named branch
- string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}")
- if(EXISTS "@GIT_DIR@/${HEAD_REF}")
- configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY)
- elseif(EXISTS "@GIT_DIR@/logs/${HEAD_REF}")
- configure_file("@GIT_DIR@/logs/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY)
- set(HEAD_HASH "${HEAD_REF}")
- endif()
-else()
- # detached HEAD
- configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY)
-endif()
-
-if(NOT HEAD_HASH)
- file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024)
- string(STRIP "${HEAD_HASH}" HEAD_HASH)
-endif()
diff --git a/peripheral/libmraa/cmake/modules/LICENSE.LGPL b/peripheral/libmraa/cmake/modules/LICENSE.LGPL
deleted file mode 100644
index 5ab7695..0000000
--- a/peripheral/libmraa/cmake/modules/LICENSE.LGPL
+++ /dev/null
@@ -1,504 +0,0 @@
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 2.1, February 1999
-
- Copyright (C) 1991, 1999 Free Software Foundation, Inc.
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-[This is the first released version of the Lesser GPL. It also counts
- as the successor of the GNU Library Public License, version 2, hence
- the version number 2.1.]
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-Licenses are intended to guarantee your freedom to share and change
-free software--to make sure the software is free for all its users.
-
- This license, the Lesser General Public License, applies to some
-specially designated software packages--typically libraries--of the
-Free Software Foundation and other authors who decide to use it. You
-can use it too, but we suggest you first think carefully about whether
-this license or the ordinary General Public License is the better
-strategy to use in any particular case, based on the explanations below.
-
- When we speak of free software, we are referring to freedom of use,
-not price. Our General Public Licenses are designed to make sure that
-you have the freedom to distribute copies of free software (and charge
-for this service if you wish); that you receive source code or can get
-it if you want it; that you can change the software and use pieces of
-it in new free programs; and that you are informed that you can do
-these things.
-
- To protect your rights, we need to make restrictions that forbid
-distributors to deny you these rights or to ask you to surrender these
-rights. These restrictions translate to certain responsibilities for
-you if you distribute copies of the library or if you modify it.
-
- For example, if you distribute copies of the library, whether gratis
-or for a fee, you must give the recipients all the rights that we gave
-you. You must make sure that they, too, receive or can get the source
-code. If you link other code with the library, you must provide
-complete object files to the recipients, so that they can relink them
-with the library after making changes to the library and recompiling
-it. And you must show them these terms so they know their rights.
-
- We protect your rights with a two-step method: (1) we copyright the
-library, and (2) we offer you this license, which gives you legal
-permission to copy, distribute and/or modify the library.
-
- To protect each distributor, we want to make it very clear that
-there is no warranty for the free library. Also, if the library is
-modified by someone else and passed on, the recipients should know
-that what they have is not the original version, so that the original
-author's reputation will not be affected by problems that might be
-introduced by others.
-
- Finally, software patents pose a constant threat to the existence of
-any free program. We wish to make sure that a company cannot
-effectively restrict the users of a free program by obtaining a
-restrictive license from a patent holder. Therefore, we insist that
-any patent license obtained for a version of the library must be
-consistent with the full freedom of use specified in this license.
-
- Most GNU software, including some libraries, is covered by the
-ordinary GNU General Public License. This license, the GNU Lesser
-General Public License, applies to certain designated libraries, and
-is quite different from the ordinary General Public License. We use
-this license for certain libraries in order to permit linking those
-libraries into non-free programs.
-
- When a program is linked with a library, whether statically or using
-a shared library, the combination of the two is legally speaking a
-combined work, a derivative of the original library. The ordinary
-General Public License therefore permits such linking only if the
-entire combination fits its criteria of freedom. The Lesser General
-Public License permits more lax criteria for linking other code with
-the library.
-
- We call this license the "Lesser" General Public License because it
-does Less to protect the user's freedom than the ordinary General
-Public License. It also provides other free software developers Less
-of an advantage over competing non-free programs. These disadvantages
-are the reason we use the ordinary General Public License for many
-libraries. However, the Lesser license provides advantages in certain
-special circumstances.
-
- For example, on rare occasions, there may be a special need to
-encourage the widest possible use of a certain library, so that it becomes
-a de-facto standard. To achieve this, non-free programs must be
-allowed to use the library. A more frequent case is that a free
-library does the same job as widely used non-free libraries. In this
-case, there is little to gain by limiting the free library to free
-software only, so we use the Lesser General Public License.
-
- In other cases, permission to use a particular library in non-free
-programs enables a greater number of people to use a large body of
-free software. For example, permission to use the GNU C Library in
-non-free programs enables many more people to use the whole GNU
-operating system, as well as its variant, the GNU/Linux operating
-system.
-
- Although the Lesser General Public License is Less protective of the
-users' freedom, it does ensure that the user of a program that is
-linked with the Library has the freedom and the wherewithal to run
-that program using a modified version of the Library.
-
- The precise terms and conditions for copying, distribution and
-modification follow. Pay close attention to the difference between a
-"work based on the library" and a "work that uses the library". The
-former contains code derived from the library, whereas the latter must
-be combined with the library in order to run.
-
- GNU LESSER GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License Agreement applies to any software library or other
-program which contains a notice placed by the copyright holder or
-other authorized party saying it may be distributed under the terms of
-this Lesser General Public License (also called "this License").
-Each licensee is addressed as "you".
-
- A "library" means a collection of software functions and/or data
-prepared so as to be conveniently linked with application programs
-(which use some of those functions and data) to form executables.
-
- The "Library", below, refers to any such software library or work
-which has been distributed under these terms. A "work based on the
-Library" means either the Library or any derivative work under
-copyright law: that is to say, a work containing the Library or a
-portion of it, either verbatim or with modifications and/or translated
-straightforwardly into another language. (Hereinafter, translation is
-included without limitation in the term "modification".)
-
- "Source code" for a work means the preferred form of the work for
-making modifications to it. For a library, complete source code means
-all the source code for all modules it contains, plus any associated
-interface definition files, plus the scripts used to control compilation
-and installation of the library.
-
- Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running a program using the Library is not restricted, and output from
-such a program is covered only if its contents constitute a work based
-on the Library (independent of the use of the Library in a tool for
-writing it). Whether that is true depends on what the Library does
-and what the program that uses the Library does.
-
- 1. You may copy and distribute verbatim copies of the Library's
-complete source code as you receive it, in any medium, provided that
-you conspicuously and appropriately publish on each copy an
-appropriate copyright notice and disclaimer of warranty; keep intact
-all the notices that refer to this License and to the absence of any
-warranty; and distribute a copy of this License along with the
-Library.
-
- You may charge a fee for the physical act of transferring a copy,
-and you may at your option offer warranty protection in exchange for a
-fee.
-
- 2. You may modify your copy or copies of the Library or any portion
-of it, thus forming a work based on the Library, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) The modified work must itself be a software library.
-
- b) You must cause the files modified to carry prominent notices
- stating that you changed the files and the date of any change.
-
- c) You must cause the whole of the work to be licensed at no
- charge to all third parties under the terms of this License.
-
- d) If a facility in the modified Library refers to a function or a
- table of data to be supplied by an application program that uses
- the facility, other than as an argument passed when the facility
- is invoked, then you must make a good faith effort to ensure that,
- in the event an application does not supply such function or
- table, the facility still operates, and performs whatever part of
- its purpose remains meaningful.
-
- (For example, a function in a library to compute square roots has
- a purpose that is entirely well-defined independent of the
- application. Therefore, Subsection 2d requires that any
- application-supplied function or table used by this function must
- be optional: if the application does not supply it, the square
- root function must still compute square roots.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Library,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Library, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote
-it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Library.
-
-In addition, mere aggregation of another work not based on the Library
-with the Library (or with a work based on the Library) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may opt to apply the terms of the ordinary GNU General Public
-License instead of this License to a given copy of the Library. To do
-this, you must alter all the notices that refer to this License, so
-that they refer to the ordinary GNU General Public License, version 2,
-instead of to this License. (If a newer version than version 2 of the
-ordinary GNU General Public License has appeared, then you can specify
-that version instead if you wish.) Do not make any other change in
-these notices.
-
- Once this change is made in a given copy, it is irreversible for
-that copy, so the ordinary GNU General Public License applies to all
-subsequent copies and derivative works made from that copy.
-
- This option is useful when you wish to copy part of the code of
-the Library into a program that is not a library.
-
- 4. You may copy and distribute the Library (or a portion or
-derivative of it, under Section 2) in object code or executable form
-under the terms of Sections 1 and 2 above provided that you accompany
-it with the complete corresponding machine-readable source code, which
-must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange.
-
- If distribution of object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the
-source code from the same place satisfies the requirement to
-distribute the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 5. A program that contains no derivative of any portion of the
-Library, but is designed to work with the Library by being compiled or
-linked with it, is called a "work that uses the Library". Such a
-work, in isolation, is not a derivative work of the Library, and
-therefore falls outside the scope of this License.
-
- However, linking a "work that uses the Library" with the Library
-creates an executable that is a derivative of the Library (because it
-contains portions of the Library), rather than a "work that uses the
-library". The executable is therefore covered by this License.
-Section 6 states terms for distribution of such executables.
-
- When a "work that uses the Library" uses material from a header file
-that is part of the Library, the object code for the work may be a
-derivative work of the Library even though the source code is not.
-Whether this is true is especially significant if the work can be
-linked without the Library, or if the work is itself a library. The
-threshold for this to be true is not precisely defined by law.
-
- If such an object file uses only numerical parameters, data
-structure layouts and accessors, and small macros and small inline
-functions (ten lines or less in length), then the use of the object
-file is unrestricted, regardless of whether it is legally a derivative
-work. (Executables containing this object code plus portions of the
-Library will still fall under Section 6.)
-
- Otherwise, if the work is a derivative of the Library, you may
-distribute the object code for the work under the terms of Section 6.
-Any executables containing that work also fall under Section 6,
-whether or not they are linked directly with the Library itself.
-
- 6. As an exception to the Sections above, you may also combine or
-link a "work that uses the Library" with the Library to produce a
-work containing portions of the Library, and distribute that work
-under terms of your choice, provided that the terms permit
-modification of the work for the customer's own use and reverse
-engineering for debugging such modifications.
-
- You must give prominent notice with each copy of the work that the
-Library is used in it and that the Library and its use are covered by
-this License. You must supply a copy of this License. If the work
-during execution displays copyright notices, you must include the
-copyright notice for the Library among them, as well as a reference
-directing the user to the copy of this License. Also, you must do one
-of these things:
-
- a) Accompany the work with the complete corresponding
- machine-readable source code for the Library including whatever
- changes were used in the work (which must be distributed under
- Sections 1 and 2 above); and, if the work is an executable linked
- with the Library, with the complete machine-readable "work that
- uses the Library", as object code and/or source code, so that the
- user can modify the Library and then relink to produce a modified
- executable containing the modified Library. (It is understood
- that the user who changes the contents of definitions files in the
- Library will not necessarily be able to recompile the application
- to use the modified definitions.)
-
- b) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (1) uses at run time a
- copy of the library already present on the user's computer system,
- rather than copying library functions into the executable, and (2)
- will operate properly with a modified version of the library, if
- the user installs one, as long as the modified version is
- interface-compatible with the version that the work was made with.
-
- c) Accompany the work with a written offer, valid for at
- least three years, to give the same user the materials
- specified in Subsection 6a, above, for a charge no more
- than the cost of performing this distribution.
-
- d) If distribution of the work is made by offering access to copy
- from a designated place, offer equivalent access to copy the above
- specified materials from the same place.
-
- e) Verify that the user has already received a copy of these
- materials or that you have already sent this user a copy.
-
- For an executable, the required form of the "work that uses the
-Library" must include any data and utility programs needed for
-reproducing the executable from it. However, as a special exception,
-the materials to be distributed need not include anything that is
-normally distributed (in either source or binary form) with the major
-components (compiler, kernel, and so on) of the operating system on
-which the executable runs, unless that component itself accompanies
-the executable.
-
- It may happen that this requirement contradicts the license
-restrictions of other proprietary libraries that do not normally
-accompany the operating system. Such a contradiction means you cannot
-use both them and the Library together in an executable that you
-distribute.
-
- 7. You may place library facilities that are a work based on the
-Library side-by-side in a single library together with other library
-facilities not covered by this License, and distribute such a combined
-library, provided that the separate distribution of the work based on
-the Library and of the other library facilities is otherwise
-permitted, and provided that you do these two things:
-
- a) Accompany the combined library with a copy of the same work
- based on the Library, uncombined with any other library
- facilities. This must be distributed under the terms of the
- Sections above.
-
- b) Give prominent notice with the combined library of the fact
- that part of it is a work based on the Library, and explaining
- where to find the accompanying uncombined form of the same work.
-
- 8. You may not copy, modify, sublicense, link with, or distribute
-the Library except as expressly provided under this License. Any
-attempt otherwise to copy, modify, sublicense, link with, or
-distribute the Library is void, and will automatically terminate your
-rights under this License. However, parties who have received copies,
-or rights, from you under this License will not have their licenses
-terminated so long as such parties remain in full compliance.
-
- 9. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Library or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Library (or any work based on the
-Library), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Library or works based on it.
-
- 10. Each time you redistribute the Library (or any work based on the
-Library), the recipient automatically receives a license from the
-original licensor to copy, distribute, link with or modify the Library
-subject to these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties with
-this License.
-
- 11. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Library at all. For example, if a patent
-license would not permit royalty-free redistribution of the Library by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Library.
-
-If any portion of this section is held invalid or unenforceable under any
-particular circumstance, the balance of the section is intended to apply,
-and the section as a whole is intended to apply in other circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 12. If the distribution and/or use of the Library is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Library under this License may add
-an explicit geographical distribution limitation excluding those countries,
-so that distribution is permitted only in or among countries not thus
-excluded. In such case, this License incorporates the limitation as if
-written in the body of this License.
-
- 13. The Free Software Foundation may publish revised and/or new
-versions of the Lesser General Public License from time to time.
-Such new versions will be similar in spirit to the present version,
-but may differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Library
-specifies a version number of this License which applies to it and
-"any later version", you have the option of following the terms and
-conditions either of that version or of any later version published by
-the Free Software Foundation. If the Library does not specify a
-license version number, you may choose any version ever published by
-the Free Software Foundation.
-
- 14. If you wish to incorporate parts of the Library into other free
-programs whose distribution conditions are incompatible with these,
-write to the author to ask for permission. For software which is
-copyrighted by the Free Software Foundation, write to the Free
-Software Foundation; we sometimes make exceptions for this. Our
-decision will be guided by the two goals of preserving the free status
-of all derivatives of our free software and of promoting the sharing
-and reuse of software generally.
-
- NO WARRANTY
-
- 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
-EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
-OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
-KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
-AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
-FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
-LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Libraries
-
- If you develop a new library, and you want it to be of the greatest
-possible use to the public, we recommend making it free software that
-everyone can redistribute and change. You can do so by permitting
-redistribution under these terms (or, alternatively, under the terms of the
-ordinary General Public License).
-
- To apply these terms, attach the following notices to the library. It is
-safest to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least the
-"copyright" line and a pointer to where the full notice is found.
-
- <one line to give the library's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-Also add information on how to contact you by electronic and paper mail.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the library, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the
- library `Frob' (a library for tweaking knobs) written by James Random Hacker.
-
- <signature of Ty Coon>, 1 April 1990
- Ty Coon, President of Vice
-
-That's all there is to it!
-
-
diff --git a/peripheral/libmraa/cmake/modules/LICENSE_1_0.txt b/peripheral/libmraa/cmake/modules/LICENSE_1_0.txt
deleted file mode 100644
index 36b7cd9..0000000
--- a/peripheral/libmraa/cmake/modules/LICENSE_1_0.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-Boost Software License - Version 1.0 - August 17th, 2003
-
-Permission is hereby granted, free of charge, to any person or organization
-obtaining a copy of the software and accompanying documentation covered by
-this license (the "Software") to use, reproduce, display, distribute,
-execute, and transmit the Software, and to prepare derivative works of the
-Software, and to permit third-parties to whom the Software is furnished to
-do so, all subject to the following:
-
-The copyright notices in the Software and this entire statement, including
-the above license grant, this restriction and the following disclaimer,
-must be included in all copies of the Software, in whole or in part, and
-all derivative works of the Software, unless such copies or derivative
-works are solely in the form of machine-executable object code generated by
-a source language processor.
-
-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, TITLE AND NON-INFRINGEMENT. IN NO EVENT
-SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
-FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
-ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-DEALINGS IN THE SOFTWARE.
diff --git a/peripheral/libmraa/cmake/modules/TargetArch.cmake b/peripheral/libmraa/cmake/modules/TargetArch.cmake
deleted file mode 100644
index f20ee87..0000000
--- a/peripheral/libmraa/cmake/modules/TargetArch.cmake
+++ /dev/null
@@ -1,145 +0,0 @@
-# Based on the Qt 5 processor detection code, so should be very accurate
-# https://qt.gitorious.org/qt/qtbase/blobs/master/src/corelib/global/qprocessordetection.h
-# Currently handles arm (v5, v6, v7), x86 (32/64), ia64, and ppc (32/64)
-
-# This file is under the terms of the GNU Lesser General Public License version
-# 2.1 as published by the Free Software Foundation and appearing in the file
-# LICENSE.LGPL included in the packaging of this file. Please review the
-# following information to ensure the GNU Lesser General Public License version
-# 2.1 requirements will be met:
-# http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-
-# Regarding POWER/PowerPC, just as is noted in the Qt source,
-# "There are many more known variants/revisions that we do not handle/detect."
-
-set(archdetect_c_code "
-#if defined(__aarch64__)
- #error cmake_ARCH armv8
-#elif defined(__arm__) || defined(__TARGET_ARCH_ARM)
- #if defined(__ARM_ARCH_7__) \\
- || defined(__ARM_ARCH_7A__) \\
- || defined(__ARM_ARCH_7R__) \\
- || defined(__ARM_ARCH_7M__) \\
- || (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 7)
- #error cmake_ARCH armv7
- #elif defined(__ARM_ARCH_6__) \\
- || defined(__ARM_ARCH_6J__) \\
- || defined(__ARM_ARCH_6T2__) \\
- || defined(__ARM_ARCH_6Z__) \\
- || defined(__ARM_ARCH_6K__) \\
- || defined(__ARM_ARCH_6ZK__) \\
- || defined(__ARM_ARCH_6M__) \\
- || (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 6)
- #error cmake_ARCH armv6
- #elif defined(__ARM_ARCH_5TEJ__) \\
- || (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 5)
- #error cmake_ARCH armv5
- #else
- #error cmake_ARCH arm
- #endif
-#elif defined(__i586) || defined(__i586__)
- #error cmake_ARCH i586
-#elif defined(__i386) || defined(__i386__) || defined(_M_IX86)
- #error cmake_ARCH i386
-#elif defined(__x86_64) || defined(__x86_64__) || defined(__amd64) || defined(_M_X64)
- #error cmake_ARCH x86_64
-#elif defined(__ia64) || defined(__ia64__) || defined(_M_IA64)
- #error cmake_ARCH ia64
-#elif defined(__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()
diff --git a/peripheral/libmraa/cmake/modules/version.c.in b/peripheral/libmraa/cmake/modules/version.c.in
deleted file mode 100644
index 0fdf853..0000000
--- a/peripheral/libmraa/cmake/modules/version.c.in
+++ /dev/null
@@ -1,4 +0,0 @@
-#include "version.h"
-
-const char* gVERSION = "@VERSION@";
-const char* gVERSION_SHORT = "@VERSION_SHORT@";
diff --git a/peripheral/libmraa/docs/banana_pi.md b/peripheral/libmraa/docs/banana_pi.md
deleted file mode 100644
index 87e962c..0000000
--- a/peripheral/libmraa/docs/banana_pi.md
+++ /dev/null
@@ -1,85 +0,0 @@
-Banana Pi/Pro {#bananapi}
-============
-
-The Banana Pi/Pro is a clone of the well known Raspberry Pi. It has advantages
-compared to the 'old' Raspberry Pi A/B/A+/B+ devices as it is based on the
-Allwinner A20 Dual Core Cortex-A7. It also has 1G Ethernet compared to 100M
-Ethernet on the Raspberry.
-
-There is a lot of effort on Mainline Kernel to fully support the Allwinner
-Chips, for example Fedora 22 Arm will come with support for BananaPi/Pro which
-means that you will be able to have HDMI Output and a number of periperal
-modules work out of the box.
-
-Pin-wise the Banana Pi matches the Raspberry Pi, the Banana Pro has a connector
-similar to the Raspberry Pi A+/B+
-
-Revision Support
-----------------
-Banana Pi
-Banana Pro
-
-Interface notes
----------------
-
-**PWM** Whilst the Banana Pi is meant to have 1 PWM channel this is currently
-not supported.
-
-**SPI** works fine when used with old 3.4 Kernels provided by Lemaker, on
-Mainline Kernel SPI does currently not work
-
-**COM** I have created devicetree patches so that Mainline Kernel supports all
-COM-Interfaces, this is not yet visible in Kernel
-
-Mainline Kernel requires the use of Device-Trees, mraa tries it's best to guess
-which gpio/serial/i2c/spi is connected where but there is currently no support
-to manipulate the Device-Tree settings from within mraa. If a device does not
-work as expected then please check syslog, mraa usually complains with a
-meaningful message when it is unable to initialize the device.
-
-Pin Mapping
------------
-
-This pin mapping refers to the Banana Pi but gives an idea
-as to what the values are from mraa. Note that there is an emum to use wiringPi
-style numbers.
-
-| MRAA Number | Physical Pin | Function |
-|-------------|--------------|-----------|
-| 1 | P1-01 | 3V3 VCC |
-| 2 | P1-02 | 5V VCC |
-| 3 | P1-03 | I2C SDA |
-| 4 | P1-04 | 5V VCC |
-| 5 | P1-05 | I2C SCL |
-| 6 | P1-06 | GND |
-| 7 | P1-07 | GPIO(PI03)|
-| 8 | P1-08 | UART4 TX |
-| 9 | P1-09 | GND |
-| 10 | P1-10 | UART4 RX |
-| 11 | P1-11 | GPIO(PI19)|
-| 12 | P1-12 | GPIO(PH02)|
-| 13 | P1-13 | GPIO(PI18)|
-| 14 | P1-14 | GND |
-| 15 | P1-15 | GPIO(PI17)|
-| 16 | P1-16 | GPIO(PH20)|
-| 17 | P1-17 | 3V3 VCC |
-| 18 | P1-18 | GPIO(PH21)|
-| 19 | P1-19 | SPI MOSI |
-| 20 | P1-20 | GND |
-| 21 | P1-21 | SPI MISO |
-| 22 | P1-22 | GPIO(PI16)|
-| 23 | P1-23 | SPI SCL |
-| 24 | P1-24 | SPI CS0 |
-| 25 | P1-25 | GND |
-| 26 | P1-26 | SPI CS1 |
-
-There is also a second 8-pin connector on the Banana Pi, the pins are as follows:
-
-| 27 | P1-19 | 5V VCC |
-| 28 | P1-20 | 3V3 VCC |
-| 29 | P1-21 | GPIO(PH5) |
-| 30 | P1-22 | GPIO(PI22)|
-| 31 | P1-23 | GPIO(PH03)|
-| 32 | P1-24 | GPIO(PI20)|
-| 33 | P1-25 | GND |
-| 34 | P1-26 | GND |
diff --git a/peripheral/libmraa/docs/beaglebone.md b/peripheral/libmraa/docs/beaglebone.md
deleted file mode 100644
index cd23bc2..0000000
--- a/peripheral/libmraa/docs/beaglebone.md
+++ /dev/null
@@ -1,74 +0,0 @@
-Beaglebone Black {#beaglebone}
-================
-
-The Beaglebone Black is a very maker friendly Board with a huge amount of
-available I/O Pins. It consists of an Cortex-A8 single core CPU plus two
-additional microcontroller cores called 'pru' that can be used for realtime
-tasks.
-
-The official Beaglebone Black Image runs Debian on a 3.8.13 Kernel. But there
-are also mainline kernels available, either from Robert C. Nelson or also as
-part of the upcoming Fedora 22 release.
-
-The kernel releases from Robert C. Nelson have usually more complete support as
-not all code is yet commited to mainline kernel, your mileage may vary!
-
-In Kernel 3.8.13 there is a Capemanager included, a mechanism to load
-configuration data for devices and extension boards from userland.
-
-This mechanism does not (yet) exist in Mainline kernels, so for mainline
-kernels you need to either rely on the pre-delivered devicetree's or you will
-need to build your own devicetree to support hardware not available by default.
-
-Revision Support
-----------------
-Beaglebone Black Rev. B
-Beaglebone Black Rev. C
-
-Interface notes
----------------
-
-**SPI** works fine with 3.8.13 kernels, on Mainline Kernel SPI does currently
-not work. mraa will activate spi on 3.8.13 if it finds out that spi is not yet
-configured
-
-**I2C** works both on 3.8.13 and mainline. i2c is activated if missing for
-3.8.13 kernels
-
-Mainline Kernel requires the use of Device-Trees, mraa tries it's best to guess
-which gpio/serial/i2c/spi is connected where but there is currently no support
-to manipulate the Device-Tree settings from within mraa. If a device does not
-work as expected then please check syslog, mraa usually complains with a
-meaningful message when it is unable to initialize the device.
-
-It will also tell you which overlay for SPI/COM/I2C/PWM it tries to load, on
-some older Debian distributions (or heaven forbid, on Angström) you may need to
-install thoses overlays to /lib/firmware
-
-Capes and further documentation
--------------------------------
-
-Correctly configuring i2c/spi/serial can get a little challenging as some pins
-have double functionality or are not available at all because hdmi is enabled.
-When something does not work as expected make sure to first check the syslog,
-then check the Beaglebone documentation. Some pointers for good descriptions
-are:
-
-http://elinux.org/BeagleBone_Black_Enable_SPIDEV
-http://elinux.org/Interfacing_with_I2C_Devices
-
-When working with mainline kernels take every hit you have on google with a
-grain of salt, a lot of documentation is based on 3.8 and older kernels. Using
-mainline kernels can be very rewarding, but at least at time of writing also
-can have some nasty
-pitfalls.
-
-Pin Mapping
------------
-
-mraa will take into account if you have hdmi cape or mmc enabled and will show
-you the gpio's available for your given configuration.
-
-To see the pin mapping use the command:
-
-$ sudo mraa-gpio list
diff --git a/peripheral/libmraa/docs/building.md b/peripheral/libmraa/docs/building.md
deleted file mode 100644
index fbd46b8..0000000
--- a/peripheral/libmraa/docs/building.md
+++ /dev/null
@@ -1,184 +0,0 @@
-Building libmraa {#building}
-===============
-
-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.
-
-## 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+
-* [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) 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+)
-
-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
-```
-
-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}
-mkdir build
-cd build
-cmake ..
-make
-~~~~~~~~~~~~~
-
-If this goes wrong and you have all the dependencies installed, then please
-file an issue with the full output of `cmake ..` and `make` or however far you
-got.
-
-After that you can install built files (into default path) by running:
-
-
-```bash
-sudo make install
-```
-
-See flags for adjusting install paths in the section below.
-
-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 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
-```
-
-Same approach works for Python 3, you'll just need to adjust the version number
-in the path accordingly.
-
-## Configuration flags
-
-Our CMake configuration has a number of options, `cmake-gui` or `ccmake` (`cmake -i` is
-no longer with us :() can show you all the options. A few of the more common
-ones are listed below. Note that when the option starts with `CMAKE_` it's an
-option that is made available by CMake and will be similar in all CMake
-projects. You need to add them after `cmake` but before `..`
-
-A few recommended options:
-
-Changing install path from `/usr/local` to `/usr`:
- `-DCMAKE_INSTALL_PREFIX:PATH=/usr`
-
-Building debug build - adds `-g` and disables optimisations - this will force a
-full rebuild:
- `-DCMAKE_BUILD_TYPE=DEBUG`
-
-Using `clang` instead of `gcc`:
- `-DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++`
-
-Building with an older version of SWIG (< 3.0.2) requires the disabling of JavaScript:
- `-DBUILDSWIGNODE=OFF`
-
-Disabling Python module building:
- `-DBUILDSWIGPYTHON=OFF`
-
-Building doc, this will require [SPHINX](http://sphinx-doc.org) &
-[Doxygen](http://doxygen.org):
- `-DBUILDDOC=ON`
-
-Building with Python 3 (careful you need to clear CMake cache between Python
-version switches!)
- `-DBUILDPYTHON3=ON`
-
-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`
-
-## Dependencies continued
-
-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.
-
-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 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
-
-In order to compile with a Yocto/OE toolchain use the following toolchain file.
-This works well on the Edison 1.7.2 SDK. First source the environment file, then
-use our CMake toolchain file.
-
-~~~~~~~~~~~~~{.sh}
-source /opt/poky-edison/1.7.2/environment-setup-core2-32-poky-linux
-mkdir build
-cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchains/oe-sdk_cross.cmake ..
-make
-~~~~~~~~~~~~~
-
-## 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:
-~~~~~~~~~~~~~{.sh}
-export JAVA_HOME=/usr/lib/jvm/default/
-~~~~~~~~~~~~~
-Then use the CMake configuration flag:
- `-DBUILDSWIGJAVA=ON`
-To compile `Example.java`
-~~~~~~~~~~~~~{.sh}
-javac -cp $DIR_WHERE_YOU_INSTALLED_MRAA/mraa.jar:. Example.java
-~~~~~~~~~~~~~
-To run, make sure `libmraajava.so` is in `LD_LIBRARY_PATH`
- ~~~~~~~~~~~~~{.sh}
-jave -cp $DIR_WHERE_YOU_INSTALLED_MRAA/mraa.jar:. Example
-~~~~~~~~~~~~~
-
-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 an IPK/RPM package using `cpack`
-
-You can get `cpack` to generate an IPK or RPM package fairly easily if you have
-the correct packaging tools
-
-~~~~~~~~~~~~~{.sh}
-cmake -DIPK=ON -DCMAKE_INSTAL_PREFIX=/usr ..
-make package
-~~~~~~~~~~~~~
-
-To use RPM simply enable the RPM option. You'll need `rpmbuild` installed on your
-build machine.
-
-~~~~~~~~~~~~~{.sh}
-cmake -DRPM=ON -DCMAKE_INSTAL_PREFIX=/usr ..
-~~~~~~~~~~~~~
diff --git a/peripheral/libmraa/docs/changelog.md b/peripheral/libmraa/docs/changelog.md
deleted file mode 100644
index 828d8ff..0000000
--- a/peripheral/libmraa/docs/changelog.md
+++ /dev/null
@@ -1,240 +0,0 @@
-Changelog {#changelog}
-=========
-
-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.
-
-**0.9.6**
- * ftdi ft4222 now dynamically loaded
- * FT4222 improved ISR code
-
-**0.9.5**
- * Add support for the UP board (up-board.org)
- * Support OpenJDK 7 as well as OpenJDK 8
- * 96board better pin numbering
- * node v4 improvements
- * Support for PCA9555 i2c expander read/write on FT4222
-
-**0.9.4**
- * Fix issue with edison ADC initilisation
- * documentation update
-
-**0.9.3**
- * Intel edison detection much improved
- * ftdi ft4222 interupt improvement
- * small fixes to java lib
-
-**0.9.2**
- * Fix bug with mraa_init & USBPLAT
- * Add mraa_gpio_read_dir call
- * Enable cherryhill/braswell platform
- * Improved 96 board support
-
-**0.9.1**
- * Minnowboard Turbot support
- * Change to java runables for ISR support
- * New platform version call
- * Default i2c bus on edison miniboard is now i2c-1
- * More compatibility with node.js versions > 0.10
- * New C++ get i2c default bus call
- * Various bug fixes & optimisations
-
-**0.9.0**
- * Beta iio API in C & C++ (no SWIG support)
- * Added 96Board support
- * Added Brillo/Android support
- * Java ISR fixes
- * FT4222 gpio support
-
-**0.8.1**
- * Nodejs 4.1.1 support
- * Java examples fixes
- * Nodejs SPI tweaks
- * Misc fixes
-
-**0.8.0**
- * Better java support
- * Support for FT4222 subplatforms
- * New types.hpp improves C++ & SWIG APIs
- * Added support for minnowboard max compatible boards
-
-**0.7.5**
- * 5th Generation NUC i2c support
- * NPM 0.10.x ia32 fix
-
-**0.7.4**
- * Minnowboard i2c fix
- * Add NPM arm support
- * Uart initialisation improved
- * Better i2c bus detection on DE3815 & mmax
-
-**0.7.3**
- * DE3815 i2c fix when using different kernels
- * Fixed various memory leaks in SWIG wrappers
- * gpio enums all prefixed with mraa_
- * Fix SPI CS pin caps causing mux_total to be > 0
- * Improved error checking/handling
-
-**0.7.2**
- * Fix node.js npm builds with binding.gyp that didn't use --target-arch
-
-**0.7.1**
- * Uart now uses binary arrays and has optional 'Str' functions in C++/SWIG
- * Various Uart module bugfixes
- * Node.js 0.12.4 support
- * Node.js documentation support
-
-**0.7.0**
- * Uart module now contains read/write interactions and configuration
- * Python API contains more buffer checks
- * Java support
- * RPM cpack support
-
-**0.6.2**
- * Node.js 0.12 support
- * NPM support
- * Formatting done with clang-format
- * Various examples and documentation updates
- * Supported added for Beaglebone Black + Banana Pi
-
-**0.6.1**
- * 16bit spi iunctions added
- * Node.js ISR now supported
-
-**0.6.0**
- * add device path queries for uart
- * add platform configuration querying
- * gpio sample added
- * improve i2c/spi write/read API for python & nodejs
- * performance improvements on edison & galileo
-
-**0.5.4**
- * pwm read_* fix introduced in 0.5.3
- * improved npmpkg support
-
-**0.5.3**
- * OE toolchain support added to CMake
- * Various UART fixes
- * SPI add CS exposure
- * Remove functions from mraa.c into modules
- * Rework of support for mmap
- * Intel Edison MMAP support added. Read and Write
- * I2C clean up, add cleaner functions
- * MinnowBoard Max support added
- * PWM period is written before duty
- * Node GYP build supported added
- * Add Get Platform Name function
-
-**0.5.2**
- * pwm improvement & bugfix
- * spi mraa_spi_bit_per_word fix
- * new spi transfer function
- * i2c object api uses uint8_t
- * i2c readReg() calls added
- * edison i2c bus now defaults to a sensible value
- * edison uart enable support
- * edison hardware CS exposed as IO10
- * DE3815tykhe NUC support
-
-**0.5.1**
- * Intel Edison - Mini breakout board support
- * Change to use syslog throughout instead of printing to stderr.
- * Fix misc issues brought up throuh coverity scans
- * Clear up Analog call documentation
-
-**0.5.0**
- * Intel Edison - Arduino board support.
- * Boost Allowable i2c busses to 12
- * Additional platform hooks added
- * ADC is now 10bits by default on all platforms but can be changed
-
-**0.4.5**
- * if only one spidev we default to it reguardless of number
- * mraa_pwm_config_ms & mraa_pwm_config_percent functions added
- * Uart C++ class added, adds python & node support
- * galileo gen2 gpio modes supported
-
-**0.4.4**
- * prefix SPI mode with MRAA_SPI_
- * added C++ adc bitness calls
-
-**0.4.3**
- * SPI Mode function now functional, API Change in SPI
- * I2C read in swig worked on.
- * Galileo Gen 2: PWM setting period sets all channel's period
- * Galileo Gen 2: I2C setup now specific to Gen 2.
- * General commits around freeing memory at the right times.
-
-**0.4.2**
- * Barebone UART module added.
- * Hook branch merged.
- * I2C init hooks added.
- * Intel Galileo Gen 2, I2C gpio pins now go hiz input when I2C initialised.
-
-**0.4.1**
- * Rename python & nodejs modules to mraa
- * common.hpp introduced for C++
- * python & nodejs modules can now take binary strings for Spi & I2c
- * improved Aio module and clear bitness
- * Improved Galileo Gen 2 support
-
-**0.4.0**
- * Rename to mraa
- * get_platform_type function added.
-
-**0.3.1**
- * Initial Intel Galileo Gen 2 support
- * mraa_gpio_isr parameters added.
- * Detection of different supported platforms added.
-
-**0.3.0**
- * mraa_i2c_read now returns length of read
-
-**0.2.9**
- * Add global mraa.h & mraa.hpp headers
- * usage of "gpio.h" is not legal you need to use "mraa/gpio.h" unless adding
- -L/usr/include/mraa
-
-**0.2.8**
- * Added mraa_set_priority call
- * Added mmap gpio call mraa_gpio_use_mmaped
-
-**0.2.7**
- * C++ API now uses basic types and not unistd types as C
- * Clearer and consistent use of unistd tpyes in C api
-
-**0.2.6**
- * C++ examples added, using c++ headers/api.
- * moved to open instead of fopen in all modules
- * rename mraa_check functions and made them internal to mraa only.
- * removed "export" functions from api
- * Intel Galileo Gen 1 (rev d) fixes, incorrect definition of some items
- * SPI, implementation completed.
- * I2C internal function, completed.
- * PWM fix bug in period set method.
- * Swig upstream can be used for building.
- * No longer builds docs on default cmake, needs flag
- * GPIO/PWM ownership guard prevents closing on existing pins, still can be forced.
-
-**0.2.5**
- * C++/Python/Node Enums/const names now do not contain MRAA_GPIO
- * Enum type declaration for C++ changed
- * Python/Node get_version() -> GetVersion()
- * i2c read calls don't use const char* and i2c write calls do
-
-**0.2.4**
- * All mraa_ contexts now are pointers to the actual struct which is not
- delcared in the header. The only end user change is that instead of
- returning a type mraa_gpio_context pointer mraa_gpio_init() now returns a
- mraa_gpio_context (which is actually a pointer to struct _gpio internally).
- * C++ API is available, use the .hpp headers and add stdc++ to the linker
- flags.
- * Initial SPI implementation is provided
-
-**0.2.3**
- * mraa_aio_read_u16() -> mraa_aio_read()
- * mraa_aio_read() now returns a uint16_t instead of an unsigned int
-
-**0.2.2**
- * First version with API considered 'stable'
diff --git a/peripheral/libmraa/docs/debugging.md b/peripheral/libmraa/docs/debugging.md
deleted file mode 100644
index 26f5b2e..0000000
--- a/peripheral/libmraa/docs/debugging.md
+++ /dev/null
@@ -1,31 +0,0 @@
-Debugging libmraa {#debugging}
-=================
-
-This page contains a few debugging tip. When filing an issue please go through
-this list as it's the first thing we'll ask you to do.
-
-### Finding your mraa version
-
-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
-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
-
-mraa logs pretty much everything that goes wrong to syslog. These days it'll go
-to the systemd journal so check with `sudo journalctl -f` whilst running your
-app or check all libmraa messages with `journalctl -t libmraa`. Grab all the
-messages from the initialisation message right up to your last one. Using a
-pastebin is always a good idea, I like dpaste.com. If your system does not have
-systemd likely your log is in /var/log/messages or a similar location.
-
-### Common errors to check for
-
-* Not running as root
-* Incorrect IO pin numbers, mraa uses physical connector pin numbering see your
- platform documentation for details
-* Your platform is unsupported
-* Using the wrong pin, check pin capabilities either using the API or your
- platform documentation
-
diff --git a/peripheral/libmraa/docs/edison.md b/peripheral/libmraa/docs/edison.md
deleted file mode 100644
index e8d6264..0000000
--- a/peripheral/libmraa/docs/edison.md
+++ /dev/null
@@ -1,112 +0,0 @@
-Intel Edison {#edison}
-=============
-
-Intel(R) Edison is a dual-core Silvermont Atom(TM) clocked at 500MHz. The
-Edison also features 4GB of storage, 1GB ram and on-board WiFi and Bluetooth.
-
-Currently supported boards:
-- Intel Arduino board
-- Intel breakout board
-
-UART
-----
-On both the Arduino board and the breakout board, The available UART interface is on /dev/ttyMFD1
-
-Intel Arduino board
--------------------
-The Edison used with the Arduino board has the following limitations
-in libmraa:
-
-- Do not use the 'reset' button on the arduino shields, there is a hardware
- bug and the platform will likely not come back up correctly
-- I2C is exposed on i2c-6, therefore you must use bus 6 and not bus 0
-- PWM available on default swizzler positions. (3,5,6,9)
-- SPI exposed is also used for the ADC. Try not to use your own CS.
-- Max SPI speed is 25Mhz/4 ~6.25Mhz
-- SPI PM can sometimes do weird things you can disable it with:
- `echo on > /sys/devices/pci0000\:00/0000\:00\:07.1/power/control`
-- ADC kernel module will return 16bit number but the ADC itself only has an
- accuracy of maximum 12bits and in MRAA it's limited to 10bits by default.
- Use `mraa_aio_set_bit(12)` to switch to the maximum resolution mode.
- This ADC is only included on the Arduino board.
-- AIO pins are treated as 0-5 in `mraa_aio_init()` but as 14-19 for everything
- else. Therefore use `mraa_gpio_init(14)` to use A0 as a GPIO
-- Arduino pin 7 can sometimes negatively impact the WiFi capability, if using
- WiFi avoid using this pin
-- Edison's i2c-1 can be used using for example the sparkfun i2c breakout ontop
- of the Arduino breakout board, this is not supported officially so asking for
- mraa_i2c_init(1) will result in getting i2c bus 6 (the default one). However
- using raw mode (mraa_i2c_init_raw(1)) this bus is fully usable
-
-Because of the way IO is setup with the tristate on the Arduino breakout board
-IO will be flipped as it is setup. It's recommended to setup IO pins &
-direction before using them in a `setup()` method or similar. It's impossible on
-this platform to avoid some GPIOs flipping on setup.
-
-Intel(R) breakout board
------------------------
-
-- Both I2C buses are available 1 & 6
-- IO on the miniboard is 1.8V
-- Requesting GPIO 4 will break your FTDI UART console, so bear in mind when trying to use it
-
-Please see the following table on how the physical pins map to mraa pin numbers
-
-| MRAA Number | Physical Pin | Edison Pin | Notes | Pinmode0 | Pinmode1 | Pinmode2 |
-|-------------|--------------|---------------|-------------------------|----------|------------|----------|
-| 0 | J17-1 | GP182 | | GPIO-182 | PWM2 | |
-| 1 | J17-2 | NC | Nothing from mraa | | | |
-| 2 | J17-3 | NC | Nothing from mraa | | | |
-| 3 | J17-4 | VIN | Nothing from mraa | | | |
-| 4 | J17-5 | GP135 | | GPIO-135 | UART | |
-| 5 | J17-6 | RCVR_MODE | Nothing from mraa | | | |
-| 6 | J17-7 | GP27 | | GPIO-27 | I2C-6-SCL | |
-| 7 | J17-8 | GP20 | | GPIO-20 | I2C-1-SDA | |
-| 8 | J17-9 | GP28 | | GPIO-28 | I2C-6-SDA | |
-| 9 | J17-10 | GP111 | | GPIO-111 | SPI-5-CS1 | |
-| 10 | J17-11 | GP109 | | GPIO-109 | SPI-5-SCK | |
-| 11 | J17-12 | GP115 | | GPIO-115 | SPI-5-MOSI | |
-| 12 | J17-13 | OSC_CLK_OUT_0 | Nothing from mraa/check | | | |
-| 13 | J17-14 | GP128 | | GPIO-128 | UART-1-CTS | |
-| 14 | J18-1 | GP13 | | GPIO-13 | PWM1 | |
-| 15 | J18-2 | GP165 | | GPIO-165 | | |
-| 16 | J18-3 | GPI_PWRBTN_N | Nothing from mraa | | | |
-| 17 | J18-4 | MSIC_SLP_CLK2 | Nothing from mraa | | | |
-| 18 | J18-5 | V_VBAT_BKUP | Nothing from mraa | | | |
-| 19 | J18-6 | GP19 | | GPIO-19 | I2C-1-SCL | |
-| 20 | J18-7 | GP12 | PWM0 | GPIO-12 | PWM0 | |
-| 21 | J18-8 | GP183 | PWM3 | GPIO-183 | PWM3 | |
-| 22 | J18-9 | NC | Nothing from mraa | | | |
-| 23 | J18-10 | GP110 | | GPIO-110 | SPI-5-CS0 | |
-| 24 | J18-11 | GP114 | | GPIO-114 | SPI-5-MISO | |
-| 25 | J18-12 | GP129 | | GPIO-129 | UART-1-RTS | |
-| 26 | J18-13 | GP130 | | GPIO-130 | UART-1-RX | |
-| 27 | J18-14 | FW_RCVR | Nothing from mraa | | | |
-| 28 | J19-1 | NC | Nothing from mraa | | | |
-| 29 | J19-2 | V_V1P80 | Nothing from mraa | | | |
-| 30 | J19-3 | GND | Nothing from mraa | | | |
-| 31 | J19-4 | GP44 | | GPIO-44 | | |
-| 32 | J19-5 | GP46 | | GPIO-46 | | |
-| 33 | J19-6 | GP48 | | GPIO-48 | | |
-| 34 | J19-7 | RESET_OUT | Nothing from mraa | | | |
-| 35 | J19-8 | GP131 | | GPIO-131 | UART-1-TX | |
-| 36 | J19-9 | GP14 | | GPIO-14 | | |
-| 37 | J19-10 | GP40 | | GPIO-40 | SSP2_CLK | |
-| 38 | J19-11 | GP43 | | GPIO-43 | SSP2_TXD | |
-| 39 | J19-12 | GP77 | | GPIO-77 | SD | |
-| 40 | J19-13 | GP82 | | GPIO-82 | SD | |
-| 41 | J19-14 | GP83 | | GPIO-83 | SD | |
-| 42 | J20-1 | V_VSYS | Nothing from mraa | | | |
-| 43 | J20-2 | V_V3P30 | Nothing from mraa | | | |
-| 44 | J20-3 | GP134 | | | | |
-| 45 | J20-4 | GP45 | | GPIO-45 | | |
-| 46 | J20-5 | GP47 | | GPIO-47 | | |
-| 47 | J20-6 | GP49 | | GPIO-49 | | |
-| 48 | J20-7 | GP15 | | GPIO-15 | | |
-| 49 | J20-8 | GP84 | | GPIO-84 | SD | |
-| 50 | J20-9 | GP42 | | GPIO-42 | SSP2_RXD | |
-| 51 | J20-10 | GP41 | | GPIO-41 | SSP2_FS | |
-| 52 | J20-11 | GP78 | | GPIO-78 | SD | |
-| 53 | J20-12 | GP79 | | GPIO-79 | SD | |
-| 54 | J20-13 | GP80 | | GPIO-80 | SD | |
-| 55 | J20-14 | GP81 | | GPIO-81 | SD | |
diff --git a/peripheral/libmraa/docs/ftdi_ft4222.md b/peripheral/libmraa/docs/ftdi_ft4222.md
deleted file mode 100644
index ca1b980..0000000
--- a/peripheral/libmraa/docs/ftdi_ft4222.md
+++ /dev/null
@@ -1,80 +0,0 @@
-FTDI FT4222H {#ft4222}
-============
-
-The FT4222H is a High/Full Speed USB2.0-to-Quad SPI/I2C device controller. Mraa
-supports it as a USB subplatform using the libft4222 library from FTDI which
-can be found
-[here](http://www.ftdichip.com/Support/SoftwareExamples/libft4222-1.2.1.4.tgz).
-You need the latest version for the GPIO to work.
-
-The FT4222H has 4 configuration modes selected by {DCNF1, DCNF0}. The chip
-configuration mode will determine the number of USB interfaces for data streams
-and for GPIOs control. Mraa supports chip modes CNFMODE0 and CNFMODE3. In
-CNFMODE0 the chip can provide either 4 GPIOs and SPI, or 2 GPIOs and I2C
-since SCL/SDA are shared with GPIO0/GPIO1. It is possible to change this
-selection dynamically by calling the corresponding mraa init functions.
-CNFMODE3 on the other hand will only provide SPI or I2C.
-
-By default, both modes start with I2C enabled and the driver will scan for
-known GPIO expanders on the I2C bus when the FT4222H is initialized.
-
-Supported GPIO expanders:
-* PCA9672
-* PCA9555
-* PCF8575
-
-Output from 'mraa-gpio list' would be as follows:
-~~~~~~~~~~~~~
-512 IGPIO0/SCL0: GPIO I2C
-513 IGPIO1/SDA0: GPIO I2C
-514 INT-GPIO2: GPIO
-515 INT-GPIO3: GPIO
-~~~~~~~~~~~~~
-
-When an I2C GPIO expander is present, the pins on the expander will appear after
-the 4 FT4222H GPIO pins (i.e. starting at physical pin #4, logical pin #516).
-~~~~~~~~~~~~~
-512 IGPIO0/SCL0: GPIO I2C
-513 IGPIO1/SDA0: GPIO I2C
-514 INT-GPIO2: GPIO
-515 INT-GPIO3: GPIO
-516 EXP-GPIO0: GPIO
-517 EXP-GPIO1: GPIO
-518 EXP-GPIO2: GPIO
-519 EXP-GPIO3: GPIO
-520 EXP-GPIO4: GPIO
-521 EXP-GPIO5: GPIO
-522 EXP-GPIO6: GPIO
-523 EXP-GPIO7: GPIO
-~~~~~~~~~~~~~
-
-If a PCA9545 I2C switch is detected an extra four I2C busses will appear,
-representing the four downstream busses. Output from 'mraa-i2c list'
-would be as follows:
-~~~~~~~~~~~~~
-Bus 512: id=00 type=ft4222 default
-Bus 513: id=01 type=ft4222
-Bus 514: id=02 type=ft4222
-Bus 515: id=03 type=ft4222
-Bus 516: id=04 type=ft4222
-~~~~~~~~~~~~~
-
-Please note that some mraa features might not be fully implemented yet and they
-are still under development (e.g. SPI replacement functions).
-
-We tested the module using FTDI's UMFT4222EV reference board. More details on
-this board can be found
-[here](http://www.ftdichip.com/Support/Documents/DataSheets/Modules/DS_UMFT4222EV.pdf).
-
-Interface notes
----------------
-
-You will need to unload all ftdi kernel modules for libft4222 to work
-correctly. You will also have to compile mraa with FT4222 support which may not
-be enabled by default.
-
-The cmake options to build this driver are:
-~~~~~~~~~~~~~
-FTDI4222=ON
-USBPLAT=ON
-~~~~~~~~~~~~~
diff --git a/peripheral/libmraa/docs/galileorevd.md b/peripheral/libmraa/docs/galileorevd.md
deleted file mode 100644
index 42201a5..0000000
--- a/peripheral/libmraa/docs/galileorevd.md
+++ /dev/null
@@ -1,14 +0,0 @@
-Galileo Gen 1 - Rev D {#galileorevd}
-=====================
-
-Galileo is a microcontroller board based on the Intel(R) Quark(TM) SoC X1000
-Application Processor, a 32-bit Intel Pentium-class system on a chip.
-
-The rev D board has the following limitations in libmraa:
-
-- gpio 13 will not switch the LED as it's a different Gpio, use raw gpio '3' to do this
-- gpio register access via /dev/uio is limited to pin2 and 3
-- gpio interupts will only work on GPIO_EDGE_BOTH
-- adc kernel module will return 12bit number. MRAA defaults shift this to 10bits
-- AIO pins are treated as 0-5 in mraa_aio_init() but as 14-19 for everything
- else. Therefore use mraa_gpio_init(14) to use A0 as a Gpio
diff --git a/peripheral/libmraa/docs/galileorevh.md b/peripheral/libmraa/docs/galileorevh.md
deleted file mode 100644
index 4afe5fa..0000000
--- a/peripheral/libmraa/docs/galileorevh.md
+++ /dev/null
@@ -1,56 +0,0 @@
-Galileo Gen 2 - Rev H {#galileorevh}
-=====================
-
-Galileo is a microcontroller board based on the Intel(R) Quark(TM) SoC X1000
-Application Processor, a 32-bit Intel Pentium-class system on a chip.
-
-The Gen 2 board has the following limitations in libmraa:
-
-- i2c is set at 400Khz speed cannot be changed without reloading kernel module,
- the driver is intel_qrk_gip_i2c and the parameter is i2c_std_mode which must
- be set to 1 in order to set the i2c bus speed to 100Khz
-- i2c bus is shared with multiple devices in kernel space, scanning it usually
- fails
-- pwm period is set globally for all pwm channels, when changed this will halt
- all pwm channels
-- adc kernel module will return 12bit number but the ADC itself only has an
- accuracy of 10bits.
-- AIO pins are treated as 0-5 in mraa_aio_init() but as 14-19 for everything
- else. Therefore use mraa_gpio_init(14) to use A0 as a Gpio
-
-Uart 1 on gen2
---------------
-
-Uart 1 is connected to the FTDI header and the linux console. It's also
-possible to use it from A2(Rx)/A3(Tx). However mraa does not support this
-directly so you need to enable the muxing manually. Here is an example of how
-this is done, this was tested using an FTDI 3.3V TTL cable:
-
-$ systemctl stop serial-getty@ttyS1.service
-
-$ python
->>> # Configure the Muxes for Uart1 on Aio2/3
->>> import mraa as m
->>> p77 = m.Gpio(77, False, True)
->>> p76 = m.Gpio(76, False, True)
->>> p16 = m.Gpio(16, False, True)
->>> p17 = m.Gpio(17, False, True)
->>> p77.write(1)
->>> p76.write(1)
->>> p16.dir(m.DIR_OUT)
->>> p16.write(0)
->>> p17.dir(m.DIR_OUT)
->>> p17.write(1)
-
->>> # For Rx to work correctly switch the level shifter
->>> p34 = m.Gpio(34, False, True)
->>> p34.dir(m.DIR_OUT)
->>> p34.write(1)
-
->>> # Use the uart
->>> x = m.Uart(1)
->>> x.setBaudRate(115200)
->>> x.writeStr('hello')
->>> x.read(5)
-bytearray(b'dsds\n')
-
diff --git a/peripheral/libmraa/docs/i2c.txt b/peripheral/libmraa/docs/i2c.txt
deleted file mode 100644
index 19f2c61..0000000
--- a/peripheral/libmraa/docs/i2c.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-It is considered best practice to make sure the address is correct before doing
-any calls on i2c, in case another application or even thread changed the addres
-on that bus. Multiple instances of the same bus can exist.
diff --git a/peripheral/libmraa/docs/iio.md b/peripheral/libmraa/docs/iio.md
deleted file mode 100644
index 0f419a2..0000000
--- a/peripheral/libmraa/docs/iio.md
+++ /dev/null
@@ -1,44 +0,0 @@
-iio {#iio}
-===
-IIO is the kernel's framework for supporting sensors.
-## Using dummy_iio driver
-For platforms without IIO hardware the iio_dummy driver can be used. You can
-add the driver by either rebuilding the kernel with IIO component enabled or
-just building the IIO modules and load them. You must add the following config
-fragment. Known to work for kernel 3.19 and later.
-<pre><code>
-CONFIG_IIO_DUMMY_EVGEN=m
-CONFIG_IIO_SIMPLE_DUMMY=m
-CONFIG_IIO_SIMPLE_DUMMY_EVENTS=y
-CONFIG_IIO_SIMPLE_DUMMY_BUFFER=y
-</code></pre>
-### Add driver to kernel
-Boot with new kernel, then load modules
-<pre><code>
-$ modprobe iio_dummy
-$ modprobe iio_dummy_evgen
-</code></pre>
-### Load kernel modules
-Depending our your kernel config, some of these modules may already be loaded.
-<pre><code>
-$ insmod drivers/iio/industrialio.ko
-$ insmod drivers/iio/kfifo_buf.ko
-$ insmod drivers/staging/iio/iio_dummy_evgen.ko
-$ insmod drivers/staging/iio/iio_dummy.ko
-</code></pre>
-## 'RAW' access
-
-Mraa supports raw access
-
-###Channels
-
-###Attributes
-
-###Events
-
-###Triggers
-
-Activate the trigger in /sys/class/iio
-$ echo 1 > trigger0/trigger_now
-
-
diff --git a/peripheral/libmraa/docs/index.java.md b/peripheral/libmraa/docs/index.java.md
deleted file mode 100644
index 0207414..0000000
--- a/peripheral/libmraa/docs/index.java.md
+++ /dev/null
@@ -1,69 +0,0 @@
-libmraa - Low Level Skeleton Library for Communication on GNU/Linux platforms
-==============
-
-Libmraa is a C/C++ library with bindings to Java, Python and JavaScript to
-interface with the I/O 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
-runtime you can create portable code that will work across the supported
-platforms.
-
-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.
-
-## API
-
-These interfaces allow you to interact with all libmraa functionality. The
-Java classes directly wrap the C/C++ API and provide a near 1:1 mapping of
-functionality.
-
-<center>
-| C API Modules | Java API Classes |
-|:----------------------:|:----------------------------:|
-| @ref gpio.h "gpio" | @ref mraa::Gpio "Gpio 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" |
-| @ref spi.h "spi" | @ref mraa::Spi "Spi class" |
-| @ref uart.h "uart" | @ref mraa::Uart "Uart class" |
-| @ref common.h "common" | @ref mraa::mraa "mraa class" |
-</center>
-
-### Hello Mraa
-@snippet HelloEdison.java Interesting
-
-## Supported platforms
-
-Specific platform information for supported platforms is documented here:
-
-- @ref galileorevd
-- @ref galileorevh
-- @ref edison
-- @ref de3815
-- @ref minnowmax
-- @ref rasppi
-- @ref bananapi
-- @ref beaglebone
-- @ref nuc5
-- @ref ft4222
-
-## 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 @debugging page too
-
-## COMPILING
-
-More information on compiling is @ref building page.
-
-## CONTRIBUTING
-
-Please see the @ref contributing page, the @ref internals page may also be of
-use.
-
-## API Changelog
-
-Version @ref changelog here.
diff --git a/peripheral/libmraa/docs/index.md b/peripheral/libmraa/docs/index.md
deleted file mode 100644
index ec98f16..0000000
--- a/peripheral/libmraa/docs/index.md
+++ /dev/null
@@ -1,70 +0,0 @@
-libmraa - Low Level Skeleton Library for Communication on GNU/Linux platforms
-==============
-
-Libmraa is a C/C++ library with bindings to Python, Javascript and Java to
-interface with the I/O 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
-runtime you can create portable code that will work across the supported
-platforms.
-
-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.
-
-## API
-
-These interfaces allow you to interact with all libmraa functionality. The C++
-classes directly wrap the C API and provide a near 1:1 mapping of
-functionality.
-
-<center>
-| C API Modules | C++ API Classes |
-|:----------------------:|:----------------------------:|
-| @ref gpio.h "gpio" | @ref mraa::Gpio "Gpio 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" |
-| @ref spi.h "spi" | @ref mraa::Spi "Spi class" |
-| @ref uart.h "uart" | @ref mraa::Uart "Uart class" |
-| @ref common.h "common" | @ref mraa "common" |
-</center>
-
-### Hello Mraa
-@snippet hellomraa.c Interesting
-
-## Supported platforms
-
-Specific platform information for supported platforms is documented here:
-
-- @ref galileorevd
-- @ref galileorevh
-- @ref edison
-- @ref de3815
-- @ref minnowmax
-- @ref rasppi
-- @ref bananapi
-- @ref beaglebone
-- @ref nuc5
-- @ref up
-- @ref ft4222
-
-## 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 @debugging page too
-
-## COMPILING
-
-More information on compiling is @ref building page.
-
-## CONTRIBUTING
-
-Please see the @ref contributing page, the @ref internals page may also be of
-use.
-
-## API Changelog
-
-Version @ref changelog here.
diff --git a/peripheral/libmraa/docs/intel_de3815.md b/peripheral/libmraa/docs/intel_de3815.md
deleted file mode 100644
index b032d6f..0000000
--- a/peripheral/libmraa/docs/intel_de3815.md
+++ /dev/null
@@ -1,38 +0,0 @@
-Intel(R) NUC DE3815tykhe {#de3815}
-=============
-
-The DE3815 NUC Kit is a single core Atom(TM) clocked at 1.46GHz.
-http://www.intel.com/content/www/us/en/nuc/nuc-kit-de3815tykhe.html
-
-Interface notes
----------------
-**GPIO** Not yet implemented.
-
-**PWM** Functionality for the PWM is provided by the `pwm_lpss` module `CONFIG_PWM_LPSS`
-
-**I2C** Depending on your system you may need to load `i2c-dev`
-
-Custom Solutions Header mapping
--------------------------------
-Based on: http://downloadmirror.intel.com/23745/eng/DE3815TYBE_TechProdSpec06.pdf
-
-| MRAA Number | Physical Pin | Function | Notes |
-|-------------|--------------|--------------|----------------------|
-| 0 | 1 | 1.8V sby | |
-| 1 | 2 | GND | |
-| 2 | 3 | HDMI_CEC | |
-| 3 | 4 | DMIC_CLK | |
-| 4 | 5 | 3.3V sby | |
-| 5 | 6 | DMIC_DATA | |
-| 6 | 7 | Key (no pin) | |
-| 7 | 8 | SMB_ALERT# | |
-| 8 | 9 | 5V sby (2A) | |
-| 9 | 10 | SCI_SMI_GPIO | |
-| 10 | 11 | PWM[0] | PWM Chip 0 Channel 0 |
-| 11 | 12 | PWM[1] | PWM Chip 0 Channel 1 |
-| 12 | 13 | I2C0_CLK | /dev/i2c-0 SCL |
-| 13 | 14 | I2C0_DATA | /dev/i2c-0 SDA |
-| 14 | 15 | I2C1_CLK | /dev/i2c-1 SCL |
-| 15 | 16 | I2C1_DATA | /dev/i2c-1-SDA |
-| 16 | 17 | SMB_CLK | |
-| 17 | 18 | SMB_DATA | |
diff --git a/peripheral/libmraa/docs/intel_nuc5.md b/peripheral/libmraa/docs/intel_nuc5.md
deleted file mode 100644
index 6dc43fc..0000000
--- a/peripheral/libmraa/docs/intel_nuc5.md
+++ /dev/null
@@ -1,46 +0,0 @@
-Intel NUC NUC5i5MYBE {#nuc5}
-====================
-
-Pinmuxing on the 5th generation Intel NUCs is done in the BIOS. This is only
-tested on bios 0024+ (MYBDWi5v.86A). By default the custom solution header is
-disabled, currently in Linux (as of 4.2). Both i2c buses are currently
-supported.
-
-The NUCs supported are the NUC5i5MYBE & NUC5i3MYBE which also come as the
-NUC5i5MYHE and NUC5i3MYHE motherboards. It's possible that others expose the IO
-in a very similar way so could be supported, get in touch if you have one!
-
-In the BIOS you are required to enable the following:
-Devices -> Onboard Devices - GPIO Lockdown
-Select I2c under GPIO for the 12/13 14/15 pins
-
-Interface notes
----------------
-
-**I2C** Depending on your system you may need to load `i2c-dev`
-
-Custom Solutions Header mapping
--------------------------------
-
-The mapping is the same as the DE3815tykhe.
-
-| MRAA Number | Physical Pin | Function | Notes |
-|-------------|--------------|--------------|----------------------|
-| 0 | 1 | 1.8V sby | |
-| 1 | 2 | GND | |
-| 2 | 3 | HDMI_CEC | |
-| 3 | 4 | DMIC_CLK | |
-| 4 | 5 | 3.3V sby | |
-| 5 | 6 | DMIC_DATA | |
-| 6 | 7 | Key (no pin) | |
-| 7 | 8 | SMB_ALERT# | |
-| 8 | 9 | 5V sby (2A) | |
-| 9 | 10 | SCI_SMI_GPIO | |
-| 10 | 11 | PWM[0] | |
-| 11 | 12 | PWM[1] | |
-| 12 | 13 | I2C0_CLK | /dev/i2c-0 SCL |
-| 13 | 14 | I2C0_DATA | /dev/i2c-0 SDA |
-| 14 | 15 | I2C1_CLK | /dev/i2c-1 SCL |
-| 15 | 16 | I2C1_DATA | /dev/i2c-1-SDA |
-| 16 | 17 | SMB_CLK | |
-| 17 | 18 | SMB_DATA | |
diff --git a/peripheral/libmraa/docs/internals.md b/peripheral/libmraa/docs/internals.md
deleted file mode 100644
index a825375..0000000
--- a/peripheral/libmraa/docs/internals.md
+++ /dev/null
@@ -1,180 +0,0 @@
-libmraa Internals {#internals}
-=================
-
-For building see @ref building. This will describe the general internal build
-of libmraa and will be useful to developers who'd like to understand more of
-how libmraa works or who'd like to add additional platforms. The internals will
-deal with the C API as that is the low level API which libmraa is built around.
-Note that C++ is simply a header only wrapper of the C API.
-
-libmraa has the philosophy that the board mapping is what we typically use in
-the API with the execption of i2c/spi bus numbering as they are typically not
-labelled on boards and so we use the kernel numbering scheme. Whilst this can
-confuse some, it's typically not an issue as platforms rarely expose more than
-one of these for user use and so when this is the case, libmraa will always use
-the bus in the pinmapper. For example edison uses i2c #6 but since there is
-only one, libmraa will try to be helpful and everything is treated as 6 when
-doing a mraa_i2c_init(). The _raw functions will override the pinmapper and can
-be accessed without a valid board configuration. This can be helpful either in
-development of platform configurations for mraa or when modifying kernels
-etc... Internally the mechanism is used heavily.
-
-In libmraa, all code is split into 7 modules, src/{i2c, spi, gpio, uart, pwm,
-aio and common}. These should be fairly self explanatory in goals/purpose but a
-few work in different ways. Public APIs are stored in api/ and internal headers
-are in include/
-
-### Logging ###
-
-Logging is now done purely in syslog(). Note that on platforms running systemd
-journald will intercept syslog(3) calls and log to the journal instead. You can
-set the log mask by using mraa_set_log_level(). Doing a DEBUG build of libmraa
-will also cause the DEBUG macro to be defined which will cause the syslog mask
-to be unset.
-
-### Contexts ###
-
-libmraa uses contexts to store all information, this context cannot be accessed
-by the user and so it's layout can and may be changed without warning to users.
-If an init() function fails it will return NULL and further calls with this
-context will lead to undefined behaviour.
-
-### Pinmapper ###
-
-The mraa_board_t is defined in mraa/common.h. It's a mostly static structure
-initialised during mraa_init(). The pinmap file in
-src/{arch}/{manufacturer}_{boardname}_{revision}.c then fills this array. It's
-also where platform hooks can be defined, functions that will be run at various
-'hook' points in the code.
-
-The mraa_pininfo_t structure needs to be set for the board pincount (set in a
-macro in the platform configuration header. Every pin will have a
-mraa_pincapabilities_t which will define what it can do. The doxygen
-documentation explains how this works but it's essentially a bitfield which
-needs to be set for every capability the pin can have. Gpios can have multiple
-muxes which will be set at the gpio init before it can be toggled.
-
-### i2c ###
-
-I2c from userspace in GNU/Linux is handled by character devices handled by the
-kernel driver i2c-dev. For more details the i2c/dev-interface documentation
-file in the kernel is the place to go.
-
-In libmraa, we re-use part of a library - libi2c from RoadNarrows -
-i2c/smbus.c. This library simply makes it easier for us to handle the error
-conditions that can arrise when writing on i2c buses. Essentially the API is
-fairly simple consisting of writes & reads.
-
-Careful - on alot of platforms i2cdetect will often crash. To findi your i2c
-addresses please look at your sensor's datasheet! If using i2cdetect most
-platforms do not support SMBus quick write so use the '-r' flag.
-
-### spi ###
-
-Mraa deals exclusively with spidev, so when we say bus we really mean bus +
-chip select from spidev. Spi(0) could lead to spidev5.1 and Spi(1) to
-spidev5.2. Typically on a micro using a random gpio as a chip select works
-well, and on some platforms if one is careful with threads this can work well
-with mraa. However when a kernel module shares the same bus as spidev (but on a
-different CS) this behaviour is *very* dangerous. Platforms such as Galileo
-Gen2 & Edison + Arduino breakout board work this way. Mraa will not help you in
-using a non hardware chip select, do so at your own peril!
-
-### gpio ###
-
-GPIO is probably the most complicated and odd module in libmraa. It is based on
-the gpiolib kernel driver framework which uses sysfs. There is a lot of good
-documentation in gpio/sysfs.txt in the kernel docs.
-
-The main issue is that gpios on hobbyist boards typically come with a number of
-muxers or level shifters and are often mapped in crazy ways. libmraa's goal is
-to make the label on your board match the API :) We hope that pleases you.
-
-Because boards are very different we use alot of platform hooks (@ref hooks) to
-make the initialisation work on all platforms. The hope is that simple
-platforms with no level shifters or expanders will work with just the pinmap
-definition.
-
-GPIOs are typically interfaced via sysfs because that's easier for us but we
-can also work with fast gpio. This is typically preffered to do mmap gpio
-access. This is however trickier and typically relies on lots of platform
-hooks. By default we support hitting /dev/mem or another device at specific
-addresses to toggle gpios which is how mmap access works on some boards.
-
-Note that in Linux gpios are numbered from ARCH_NR_GPIOS down. This means that
-if ARCH_NR_GPIOS is changed, the gpio numbering will change. In 3.18+ the
-default changed from 256 to 512, sadly the value cannot be viewed from
-userspace so we rely on the kernel version to extrapolate the likely value.
-
-### uart ###
-
-libmraa does not support UART/serial as there are many good libraries that do
-this already. In the future we may wrap or use one. However the class exists to
-set the pinmapper correctly for uart to work on some platforms.
-
-### pwm ###
-
-Internally everything with PWM in mraa is in microseconds because that's what
-the linux kernel uses and is probably all the granularity we'll ever
-need/achieve with the kind of hardware we're targetting. Board configuration
-pwm max/min values are always set in microseconds.
-
-### aio ###
-
-AIO pins are numbered after GPIO pins. This means that on Arduino style boards
-pin 14 is A0. Typically mraa will only support an ADC if a platform ships with
-one and has a good kernel module for it. Extra i2c/spi ADCs can be supported
-via something like UPM but are unlikely to receive support in mraa at the moment.
-
-Note that giving mraa_aio_init(0) will literally query the pinmapper for
-board->gpio_count + 0 so you must place your aio pins after gpio_count. This is
-the default behaviour but can of course be overriden by advance function
-pointers. Whilst maybe not the sanest of defaults, most of the hobbyist boards
-we deal with follow a naming pattern similar to Arduino or have no ADC so for
-now we have considered this sensible.
-
-### Initialisation ###
-
-mraa_init() needs to be called in order to initialise the platform files or
-'pinmap'. Because calling this is tedious libmraa uses a C constructor to run
-mraa_init on library load. This means that it is not possible to stop this
-running and all function calls like mraa_set_log_level() will not work during
-mraa_init(). This feature is supported by most sane compilers and libcs but you
-can turn off CTORS in uclibc, though I've yet to find a configuration with
-someone doing that. mraa_init() can be called multiple times if you feel like
-being 'safe'.
-
-In the SWIG modules mraa_init() is called during the %init stage of the module
-loading. This is simply to avoid mraa_init() running 'too' early, though I've
-never seen an issue in running it in a CTOR.
-
-### SWIG ###
-
-At the time when libmraa was created (still the case?) the only - working -
-API/wrapper generation tool that supported nodejs was SWIG. For more general
-information on SWIG please see the SWIG documentation.
-
-The src/{javascript, python} & src/mraa.i folders contain all the files for the
-SWIG generation. The C++ headers in api/mraa/ are given as input sources to
-SWIG. SWIG modules do not link to libmraa (although maybe that would be a good
-idea...)
-
-Typemaps are used heavily to map uint8_t* pointers to bytearrays and
-node_buffers. These are native python & node.js types that represent uint8_t
-data the best and are very well supported in both languages. Argument
-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.
-
-### NPM ###
-
-mraa is published on NPM, there is a target to prebuild a mraa src tarball that
-can be built with node-gyp. The way this works is to use the mraa_LIB_SRCS
-array to generate a binding.gyp file from the skeleton binding.gyp.cmake in
-src/javascript. Because we don't expect most NPM users to have SWIG we
-precompile the src/mraajsJAVASCRIPT_wrap.cxx. The src/version.c is already
-known since this is a static tarball so we write that too. These files are
-placed not in a build/ directory but in the main mraa directory. You can then
-tar the directory up and send it to NPM. This is done automatically on every
-commit by our automated build system.
-
diff --git a/peripheral/libmraa/docs/minnow_max.md b/peripheral/libmraa/docs/minnow_max.md
deleted file mode 100644
index deadb4c..0000000
--- a/peripheral/libmraa/docs/minnow_max.md
+++ /dev/null
@@ -1,58 +0,0 @@
-Intel(R) Minnowboard Max {#minnowmax}
-========================
-MinnowBoard MAX is an open hardware embedded board designed with the Intel(R)
-Atom(TM) E38xx series SOC (Fromerly Bay Trail).
-
-For product overview and faq see
-http://www.minnowboard.org/faq-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.
-
-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
-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
-will not behave as expected.
-
-Documentation shows i2c on bus #5, ACPI shows it on bus #6, but driver uses
-bus #7.
-
-| MRAA Number | Physical Pin | Function | Sysfs GPIO | Notes |
-|-------------|---------------|------------|------------|----------------------|
-| 1 | 1 | GND | | |
-| 2 | 2 | GND | | |
-| 3 | 3 | 5v | | |
-| 4 | 4 | 3.3v | | |
-| 5 | 5 | SPI_CS | 220 | SPI (via low_speed) |
-| 6 | 6 | UART1_TXD | 225 | UART1 |
-| 7 | 7 | SPI_MISO | 221 | SPI (via low_speed) |
-| 8 | 8 | UART1_RXD | 224 | UART1 |
-| 9 | 9 | SPI_MOSI | 222 | SPI (via low_speed) |
-| 10 | 10 | UART1_CTS | 227 | GPIO |
-| 11 | 11 | SPI_CLK | 223 | SPI (via low_speed) |
-| 12 | 12 | UART1_RTS | 226 | GPIO |
-| 13 | 13 | I2C_SCL | 243 | /dev/i2c-7 |
-| 14 | 14 | I2S_CLK | 216 | GPIO |
-| 15 | 15 | I2C_SDA | 242 | /dev/i2c-7 |
-| 16 | 16 | I2S_FRM | 217 | GPIO |
-| 17 | 17 | UART2_TXD | 229 | UART2 |
-| 18 | 18 | I2S_DO | 219 | GPIO |
-| 19 | 19 | UART2_RXD | 228 | UART2 |
-| 20 | 20 | I2S_DI | 218 | GPIO |
-| 21 | 21 | GPIO_S5_0 | 82 | GPIO |
-| 22 | 22 | PWM0 | 248 | PWM Chip 0 Channel 0 |
-| 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 |
diff --git a/peripheral/libmraa/docs/npm.md b/peripheral/libmraa/docs/npm.md
deleted file mode 100644
index defe7ec..0000000
--- a/peripheral/libmraa/docs/npm.md
+++ /dev/null
@@ -1,49 +0,0 @@
-mraa NPM pkg {#npmpkg}
-============
-
-What you are looking at is a tarball made after 'make npmpkg' has been run on
-our build system. It contains a few prebuilt files in order to build easily
-with node-gyp on most systems. Note that this is not the preffered way of
-building libmraa and if you'd like to contribute, please learn how the build
-system works and get your sources from git.
-
-Any patches for mraajsJAVASCRIPT_wrap.cxx or version.c will be ignored as these
-are automatically generated files. When you execute a build from node-gyp/npm
-you do not generate the mraajsJAVASCRIPT_wrap.cxx file but rather use one that
-we have generated for you.
-
-Recreating tarball
-------------------
-
-You can run the following commands to 'generate' this tarball from a checkout
-of mraa. It's important to not leave a .git directory as npm will then
-consider the tarball contains a full git tree. You also you need a top level
-dir which matches the npm pkg name so we create one with a symlink and add the
-'h' flag to tar to follow symlinks.
-
-~~~~~~~~~~~~~{.sh}
-mkdir build
-cd build
-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
-~~~~~~~~~~~~~
-
-Building with node-gyp
-----------------------
-
-You can build with node-gyp using the binding.gyp file, obviously this requires
-either the prebuilt tarball from npm or to do the above to generate it with the
-npmpkg target. Note the --target='' flag will not work since binding.gyp will
-do a check for the running node v8 version, you'll also need to run that
-version (or close to) in your $PATH.
-
-~~~~~~~~~~~{.sh}
-node-gyp configure --python=/usr/bin/python2
-node-gyp build --python=/usr/bin/python2 --verbose
-~~~~~~~~~~~
-
-Note that no cross compilation is available without modifying the --arch flag
-manually. If you want to cross compile, it's recommended to use cmake.
-
diff --git a/peripheral/libmraa/docs/platform-hooks.md b/peripheral/libmraa/docs/platform-hooks.md
deleted file mode 100644
index 5499dd7..0000000
--- a/peripheral/libmraa/docs/platform-hooks.md
+++ /dev/null
@@ -1,33 +0,0 @@
-platform-hooks {#hooks}
-==============
-
-Hooks can be defined per supported platform to allow for highly custom
-operations if needed. This feature of MRAA should only be used by developers
-defining the board definitions, NOT an end user.
-
-##Types of Hooks
-
-###REPLACE
-Defining a replace function will entirely replace the associate function. This
-should only be done if your new function can handle everything the mraa
-function would normally.
-
-###PRE
-Any functionality defined here will be performed when the main function is
-called.
-
-###POST
-Any functionality perfomed here is done just before the normal function
-returns. All post functions will have passed into them the return value that
-would normally be returned.
-
-##Hooks
-### GPIO
- * init (pre-post)
- * mode (replace-pre-post)
- * dir (replace-pre-post)
- * write (pre-post)
- * use-mmaped (replace-pre-post)
-
-### I2C
- * init (pre-post) - On RAW
diff --git a/peripheral/libmraa/docs/raspberry_pi.md b/peripheral/libmraa/docs/raspberry_pi.md
deleted file mode 100644
index 353b42b..0000000
--- a/peripheral/libmraa/docs/raspberry_pi.md
+++ /dev/null
@@ -1,100 +0,0 @@
-Raspberry Pi {#rasppi}
-============
-
-The Raspberry Pi is based on the Broadcom BCM2835 system on a chip, which
-includes an ARM1176JZF-S 700 MHz processor, VideoCore IV GPU and was originally
-shipped with 256 megabytes of RAM, later upgraded (Model B & Model B+) to 512
-MB. The Raspberry Pi 2 is based on an armv7 CPU but shares a number of
-similarities with the original.
-
-Revision Support
-----------------
-Raspberry Pi A/B/A+/B+
-Raspberry Pi 2 B
-
-Interface notes
----------------
-
-**PWM** Whilst the Raspberry Pi is meant to have 1 PWM channel this is currently not supported.
-
-Pin Mapping
------------
-
-This pin mapping refers to the first generation 'B' model Pi but gives an idea
-as to what the values are from mraa. Note that there is an emum to use wiringPi
-style numbers.
-
-| MRAA Number | Physical Pin | Function |
-|-------------|--------------|----------|
-| 1 | P1-01 | 3V3 VCC |
-| 2 | P1-02 | 5V VCC |
-| 3 | P1-03 | I2C SDA |
-| 4 | P1-04 | 5V VCC |
-| 5 | P1-05 | I2C SCL |
-| 6 | P1-06 | GND |
-| 7 | P1-07 | GPIO(4) |
-| 8 | P1-08 | UART TX |
-| 9 | P1-09 | GND |
-| 10 | P1-10 | UART RX |
-| 11 | P1-11 | GPIO(17) |
-| 12 | P1-12 | GPIO(18) |
-| 13 | P1-13 | GPIO(21) |
-| 14 | P1-14 | GND |
-| 15 | P1-15 | GPIO(22) |
-| 16 | P1-16 | GPIO(23) |
-| 17 | P1-17 | 3V3 VCC |
-| 18 | P1-18 | GPIO(24) |
-| 19 | P1-19 | SPI MOSI |
-| 20 | P1-20 | GND |
-| 21 | P1-21 | SPI MISO |
-| 22 | P1-22 | GPIO(25) |
-| 23 | P1-23 | SPI SCL |
-| 24 | P1-24 | SPI CS0 |
-| 25 | P1-25 | GND |
-| 26 | P1-26 | SPI CS1 |
-
-
-The following pin mapping applies to the new Raspberry Pi model 2 and B+. Note that GPIO(21) is now GPIO(27)
-
-| MRAA Number | Physical Pin | Function |
-|-------------|--------------|----------|
-| 1 | P1-01 | 3V3 VCC |
-| 2 | P1-02 | 5V VCC |
-| 3 | P1-03 | I2C SDA |
-| 4 | P1-04 | 5V VCC |
-| 5 | P1-05 | I2C SCL |
-| 6 | P1-06 | GND |
-| 7 | P1-07 | GPIO(4) |
-| 8 | P1-08 | UART TX |
-| 9 | P1-09 | GND |
-| 10 | P1-10 | UART RX |
-| 11 | P1-11 | GPIO(17) |
-| 12 | P1-12 | GPIO(18) |
-| 13 | P1-13 | GPIO(27) |
-| 14 | P1-14 | GND |
-| 15 | P1-15 | GPIO(22) |
-| 16 | P1-16 | GPIO(23) |
-| 17 | P1-17 | 3V3 VCC |
-| 18 | P1-18 | GPIO(24) |
-| 19 | P1-19 | SPI MOSI |
-| 20 | P1-20 | GND |
-| 21 | P1-21 | SPI MISO |
-| 22 | P1-22 | GPIO(25) |
-| 23 | P1-23 | SPI SCL |
-| 24 | P1-24 | SPI CS0 |
-| 25 | P1-25 | GND |
-| 26 | P1-26 | SPI CS1 |
-| 27 | P1-27 | I2C SDA1 |
-| 28 | P1-28 | I2C SCL1 |
-| 29 | P1-29 | GPIO(5) |
-| 30 | P1-30 | GND |
-| 31 | P1-31 | GPIO(6) |
-| 32 | P1-32 | GPIO(12) |
-| 33 | P1-33 | GPIO(13) |
-| 34 | P1-34 | GND |
-| 35 | P1-35 | SPI MISO1|
-| 36 | P1-36 | GPIO(16) |
-| 37 | P1-37 | GPIO(26) |
-| 38 | P1-38 | SPI MOSI1|
-| 39 | P1-39 | GND |
-| 40 | P1-40 | SPI SCL1 |
diff --git a/peripheral/libmraa/docs/testing.md b/peripheral/libmraa/docs/testing.md
deleted file mode 100644
index 779882f..0000000
--- a/peripheral/libmraa/docs/testing.md
+++ /dev/null
@@ -1,42 +0,0 @@
-# Testing mraa
-
-Mraa has a test suite written in python which can be run by users to check
-their platform is working correctly. The aim is to have a full API coverage
-using python scripts using unittests. Currently the test suite is far from
-complete.
-
-## Supported platforms
-
-Intel Galileo v1 was used and is currently the only supported platform. Tests
-were conducted on Intel Galileo v2, but because of hardware differences, some
-failures may occur. Logic will be added to auto-select board to work on. To
-start with boards with an arduino type shield/layout should work
-
-## How to run these tests
-
-You need to compile from source with -DBUILDSWIGPYTHON=ON and then tests can be
-executed with:
-$ make test
-
-More detail can be seen by running:
-$ ctest -VV
-
-Note tests will not run on platforms which cannot initialise, checking the
-amount of 'skipped' tests can be useful
-
-## What's next?
-
-At this point tests were made to do a quick sanity check. In the future the
-followings will be implemented:
- * Create a physical layer that will emulate sensors behavior and generate I/O
- signals. This layer will be available to the community and will help replace
- the need of specific sensors. The simplest solution will be chosen allowing
- anyone to rapidly implement it.
- * Implement stress tests over long periods of time. This feature alone is
- possible only with the use of a physical layer since it will behave both as
- signals generator and interpreter.
- * Analyze a tests result collection solution (and after, interpretation). This
- is useful since tests mean nothing without a history and possibility to
- check on results.
- * Any idea welcome!
-
diff --git a/peripheral/libmraa/docs/up.md b/peripheral/libmraa/docs/up.md
deleted file mode 100644
index 066a25d..0000000
--- a/peripheral/libmraa/docs/up.md
+++ /dev/null
@@ -1,84 +0,0 @@
-UP Board {#up}
-============
-
-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
----------------
-
-**PWM** PWM frequency range is from 293 Hz to 6.4 MHz. 8-bit resolution is
-supported for duty-cycle adjustments, but this reduces for frequencies > 97.6kHz
-
-**I2C** 2 I2C channels support standard-mode (100kHz) and fast-mode (400kHz).
-Bus frequency can be selected in BIOS settings. Note that, unlike Raspberry Pi,
-the I2C controller issues Repeated-START commands for combined transactions
-(e.g. a write-then-read transaction) which may not be supported by some I2C
-slave devices. For such devices, it is advisable to use separate write and
-read transactions to ensure that Repeated-STARTs are not issued.
-
-**SPI** Bus frequencies up to 25MHz are supported, in steps which are less
-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.
-At the time of writing, only a single native chip-select is available (SPI CS0).
-
-**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
------------
-
-The GPIO numbering in the following pin mapping is based on the Raspberry Pi
-model 2 and B+ numbering scheme.
-
-Note that there is an enum to use wiringPi style numbers.
-
-| 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) |
diff --git a/peripheral/libmraa/examples/CMakeLists.txt b/peripheral/libmraa/examples/CMakeLists.txt
deleted file mode 100644
index 31d8087..0000000
--- a/peripheral/libmraa/examples/CMakeLists.txt
+++ /dev/null
@@ -1,49 +0,0 @@
-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)
-
-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)
-
-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()
diff --git a/peripheral/libmraa/examples/analogin_a0.c b/peripheral/libmraa/examples/analogin_a0.c
deleted file mode 100644
index 2fc12ae..0000000
--- a/peripheral/libmraa/examples/analogin_a0.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * 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]
diff --git a/peripheral/libmraa/examples/blink-io.c b/peripheral/libmraa/examples/blink-io.c
deleted file mode 100644
index 212c592..0000000
--- a/peripheral/libmraa/examples/blink-io.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * 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;
-}
diff --git a/peripheral/libmraa/examples/blink_onboard.c b/peripheral/libmraa/examples/blink_onboard.c
deleted file mode 100644
index b955e23..0000000
--- a/peripheral/libmraa/examples/blink_onboard.c
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * 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;
-}
diff --git a/peripheral/libmraa/examples/c++/AioA0.cpp b/peripheral/libmraa/examples/c++/AioA0.cpp
deleted file mode 100644
index dfa3a4d..0000000
--- a/peripheral/libmraa/examples/c++/AioA0.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * 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]
diff --git a/peripheral/libmraa/examples/c++/Blink-IO.cpp b/peripheral/libmraa/examples/c++/Blink-IO.cpp
deleted file mode 100644
index d362f37..0000000
--- a/peripheral/libmraa/examples/c++/Blink-IO.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Author: Brendan Le Foll <brendan.le.foll@intel.com>
- * Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-#include "mraa.hpp"
-#define DEFAULT_IOPIN 8
-
-static int iopin;
-int running = 0;
-
-void
-sig_handler(int signo)
-{
- if (signo == SIGINT) {
- printf("closing IO%d nicely\n", iopin);
- running = -1;
- }
-}
-int
-main(int argc, char** argv)
-{
- if (argc < 2) {
- printf("Provide an int arg if you want to flash on something other than %d\n", DEFAULT_IOPIN);
- iopin = DEFAULT_IOPIN;
- } else {
- iopin = strtol(argv[1], NULL, 10);
- }
-
- signal(SIGINT, sig_handler);
-
- //! [Interesting]
- mraa::Gpio* gpio = 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]
-}
diff --git a/peripheral/libmraa/examples/c++/CMakeLists.txt b/peripheral/libmraa/examples/c++/CMakeLists.txt
deleted file mode 100644
index d688d48..0000000
--- a/peripheral/libmraa/examples/c++/CMakeLists.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-enable_language(CXX)
-
-add_executable (AioA0 AioA0.cpp)
-add_executable (blink-io-cpp Blink-IO.cpp)
-add_executable (Pwm3-cycle Pwm3-cycle.cpp)
-add_executable (I2c-compass I2c-compass.cpp)
-add_executable (Spi-pot Spi-pot.cpp)
-add_executable (Uart Uart-example.cpp)
-add_executable (Isr-pin6 Isr-pin6.cpp)
-add_executable (Iio-dummy Iio-dummy.cpp)
-
-include_directories(${PROJECT_SOURCE_DIR}/api)
-
-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++)
diff --git a/peripheral/libmraa/examples/c++/I2c-compass.cpp b/peripheral/libmraa/examples/c++/I2c-compass.cpp
deleted file mode 100644
index 582ae18..0000000
--- a/peripheral/libmraa/examples/c++/I2c-compass.cpp
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Author: Brendan Le Foll <brendan.le.foll@intel.com>
- * Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <signal.h>
-
-#include "mraa.hpp"
-#include "math.h"
-
-#define MAX_BUFFER_LENGTH 6
-#define HMC5883L_I2C_ADDR 0x1E
-
-// configuration registers
-#define HMC5883L_CONF_REG_A 0x00
-#define HMC5883L_CONF_REG_B 0x01
-
-// mode register
-#define HMC5883L_MODE_REG 0x02
-
-// data register
-#define HMC5883L_X_MSB_REG 0
-#define HMC5883L_X_LSB_REG 1
-#define HMC5883L_Z_MSB_REG 2
-#define HMC5883L_Z_LSB_REG 3
-#define HMC5883L_Y_MSB_REG 4
-#define HMC5883L_Y_LSB_REG 5
-#define DATA_REG_SIZE 6
-
-// status register
-#define HMC5883L_STATUS_REG 0x09
-
-// ID registers
-#define HMC5883L_ID_A_REG 0x0A
-#define HMC5883L_ID_B_REG 0x0B
-#define HMC5883L_ID_C_REG 0x0C
-
-#define HMC5883L_CONT_MODE 0x00
-#define HMC5883L_DATA_REG 0x03
-
-// scales
-#define GA_0_88_REG 0x00 << 5
-#define GA_1_3_REG 0x01 << 5
-#define GA_1_9_REG 0x02 << 5
-#define GA_2_5_REG 0x03 << 5
-#define GA_4_0_REG 0x04 << 5
-#define GA_4_7_REG 0x05 << 5
-#define GA_5_6_REG 0x06 << 5
-#define GA_8_1_REG 0x07 << 5
-
-// digital resolutions
-#define SCALE_0_73_MG 0.73
-#define SCALE_0_92_MG 0.92
-#define SCALE_1_22_MG 1.22
-#define SCALE_1_52_MG 1.52
-#define SCALE_2_27_MG 2.27
-#define SCALE_2_56_MG 2.56
-#define SCALE_3_03_MG 3.03
-#define SCALE_4_35_MG 4.35
-
-
-int running = 0;
-
-void
-sig_handler(int signo)
-{
- if (signo == SIGINT) {
- printf("closing nicely\n");
- running = -1;
- }
-}
-
-int
-main()
-{
- 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);
-
- while (running == 0) {
- i2c->address(HMC5883L_I2C_ADDR);
- i2c->writeByte(HMC5883L_DATA_REG);
-
- 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];
- y = (rx_tx_buf[HMC5883L_Y_MSB_REG] << 8) | rx_tx_buf[HMC5883L_Y_LSB_REG];
-
- // scale and calculate direction
- direction = atan2(y * SCALE_0_92_MG, x * SCALE_0_92_MG);
-
- // check if the signs are reversed
- if (direction < 0)
- direction += 2 * M_PI;
-
- printf("Compass scaled data x : %f, y : %f, z : %f\n", x * SCALE_0_92_MG, y * SCALE_0_92_MG,
- z * SCALE_0_92_MG);
- printf("Heading : %f\n", direction * 180 / M_PI);
- sleep(1);
- }
- delete i2c;
-
- return MRAA_SUCCESS;
-}
diff --git a/peripheral/libmraa/examples/c++/Iio-dummy.cpp b/peripheral/libmraa/examples/c++/Iio-dummy.cpp
deleted file mode 100644
index 0672ec3..0000000
--- a/peripheral/libmraa/examples/c++/Iio-dummy.cpp
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * 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;
-}
-
diff --git a/peripheral/libmraa/examples/c++/Isr-pin6.cpp b/peripheral/libmraa/examples/c++/Isr-pin6.cpp
deleted file mode 100644
index 19c37fa..0000000
--- a/peripheral/libmraa/examples/c++/Isr-pin6.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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;
-}
diff --git a/peripheral/libmraa/examples/c++/Pwm3-cycle.cpp b/peripheral/libmraa/examples/c++/Pwm3-cycle.cpp
deleted file mode 100644
index 76f2328..0000000
--- a/peripheral/libmraa/examples/c++/Pwm3-cycle.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <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;
-}
diff --git a/peripheral/libmraa/examples/c++/Spi-pot.cpp b/peripheral/libmraa/examples/c++/Spi-pot.cpp
deleted file mode 100644
index 24eb5e7..0000000
--- a/peripheral/libmraa/examples/c++/Spi-pot.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <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;
-}
diff --git a/peripheral/libmraa/examples/c++/Uart-example.cpp b/peripheral/libmraa/examples/c++/Uart-example.cpp
deleted file mode 100644
index 5cdc688..0000000
--- a/peripheral/libmraa/examples/c++/Uart-example.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Author: Brendan Le Foll <brendan.le.foll@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <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;
-}
diff --git a/peripheral/libmraa/examples/cycle-pwm3.c b/peripheral/libmraa/examples/cycle-pwm3.c
deleted file mode 100644
index d11e066..0000000
--- a/peripheral/libmraa/examples/cycle-pwm3.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-
-#include "mraa.h"
-
-int
-main()
-{
- mraa_init();
- //! [Interesting]
- mraa_pwm_context pwm;
- pwm = mraa_pwm_init(3);
- if (pwm == NULL) {
- return 1;
- }
- mraa_pwm_period_us(pwm, 200);
- mraa_pwm_enable(pwm, 1);
-
- float value = 0.0f;
-
- while (1) {
- value = value + 0.01f;
- mraa_pwm_write(pwm, value);
- usleep(50000);
- if (value >= 1.0f) {
- value = 0.0f;
- }
- float output = mraa_pwm_read(pwm);
- }
- //! [Interesting]
- return 0;
-}
diff --git a/peripheral/libmraa/examples/gpio_read6.c b/peripheral/libmraa/examples/gpio_read6.c
deleted file mode 100644
index 550484b..0000000
--- a/peripheral/libmraa/examples/gpio_read6.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include "stdio.h"
-#include "unistd.h"
-
-#include "mraa.h"
-
-int
-main(int argc, char** argv)
-{
- mraa_init();
- fprintf(stdout, "MRAA Version: %s\nStarting Read on IO6\n", mraa_get_version());
-
- //! [Interesting]
- mraa_gpio_context gpio;
-
- gpio = mraa_gpio_init(6);
-
- mraa_gpio_dir(gpio, MRAA_GPIO_IN);
-
- for (;;) {
- fprintf(stdout, "Gpio is %d\n", mraa_gpio_read(gpio));
- sleep(1);
- }
-
- mraa_gpio_close(gpio);
- //! [Interesting]
-
- return 0;
-}
diff --git a/peripheral/libmraa/examples/helloedison.c b/peripheral/libmraa/examples/helloedison.c
deleted file mode 100644
index 1169496..0000000
--- a/peripheral/libmraa/examples/helloedison.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Author: Brendan Le Foll <brendan.le.foll@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <stdio.h>
-#include <syslog.h>
-#include <string.h>
-#include <stdbool.h>
-//! [Interesting]
-#include "mraa.h"
-
-int
-main(int argc, char** argv)
-{
- mraa_result_t ret = MRAA_SUCCESS;
- mraa_platform_t platform_type = mraa_get_platform_type();
-
- if (platform_type != MRAA_INTEL_EDISON_FAB_C) {
- fprintf(stderr, "Error: This program can only run on an edison\n");
- ret = MRAA_ERROR_INVALID_PLATFORM;
- goto end;
- }
-
- // MRAA_INTEL_EDISON_GP182 == 0 so this will initialise pin0 on arduino
- // which is hardware gpio 130 and not 182
- mraa_gpio_context gpio182 = mraa_gpio_init(MRAA_INTEL_EDISON_GP182);
- if (gpio182 == NULL) {
- fprintf(stderr, "Error: Failed to open gpio182\n");
- ret = MRAA_ERROR_INVALID_PLATFORM;
- goto end;
- }
- mraa_gpio_dir(gpio182, MRAA_GPIO_OUT);
-
- // we set the owner to false here, this makes sure that we do not close the
- // gpio from sysfs in mraa_gpio_close meaning it will stay as an output and
- // we will not always transition from 0->1 as gpio182 as output has the
- // default position of '0'. Note that the value could change as a result of
- // a mraa_gpio_dir however meaning we always go from 0->1 or 1->0
- mraa_gpio_owner(gpio182, false);
- int val = mraa_gpio_read(gpio182);
- printf("GPIO%d (mraa pin %d) was: %d, will set to %d\n", 182, mraa_gpio_get_pin(gpio182), val, !val);
- mraa_gpio_write(gpio182, !val);
- mraa_gpio_close(gpio182);
-
-end:
- mraa_deinit();
- return ret;
-}
-//! [Interesting]
diff --git a/peripheral/libmraa/examples/hellomraa.c b/peripheral/libmraa/examples/hellomraa.c
deleted file mode 100644
index 62a1ea1..0000000
--- a/peripheral/libmraa/examples/hellomraa.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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 <syslog.h>
-#include <string.h>
-//! [Interesting]
-#include "mraa.h"
-
-int
-main(int argc, char** argv)
-{
- const char* board_name = mraa_get_platform_name();
- int i2c_bus, i, i2c_adapter;
-
- fprintf(stdout, "hello mraa\n Version: %s\n Running on %s\n", mraa_get_version(), board_name);
-
- mraa_deinit();
-
- return MRAA_SUCCESS;
-}
-//! [Interesting]
diff --git a/peripheral/libmraa/examples/i2c_HMC5883L.c b/peripheral/libmraa/examples/i2c_HMC5883L.c
deleted file mode 100644
index cfaac17..0000000
--- a/peripheral/libmraa/examples/i2c_HMC5883L.c
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * 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 "mraa.h"
-#include "math.h"
-
-#define MAX_BUFFER_LENGTH 6
-#define HMC5883L_I2C_ADDR 0x1E
-
-// configuration registers
-#define HMC5883L_CONF_REG_A 0x00
-#define HMC5883L_CONF_REG_B 0x01
-
-// mode register
-#define HMC5883L_MODE_REG 0x02
-
-// data register
-#define HMC5883L_X_MSB_REG 0
-#define HMC5883L_X_LSB_REG 1
-#define HMC5883L_Z_MSB_REG 2
-#define HMC5883L_Z_LSB_REG 3
-#define HMC5883L_Y_MSB_REG 4
-#define HMC5883L_Y_LSB_REG 5
-#define DATA_REG_SIZE 6
-
-// status register
-#define HMC5883L_STATUS_REG 0x09
-
-// ID registers
-#define HMC5883L_ID_A_REG 0x0A
-#define HMC5883L_ID_B_REG 0x0B
-#define HMC5883L_ID_C_REG 0x0C
-
-#define HMC5883L_CONT_MODE 0x00
-#define HMC5883L_DATA_REG 0x03
-
-// scales
-#define GA_0_88_REG 0x00 << 5
-#define GA_1_3_REG 0x01 << 5
-#define GA_1_9_REG 0x02 << 5
-#define GA_2_5_REG 0x03 << 5
-#define GA_4_0_REG 0x04 << 5
-#define GA_4_7_REG 0x05 << 5
-#define GA_5_6_REG 0x06 << 5
-#define GA_8_1_REG 0x07 << 5
-
-// digital resolutions
-#define SCALE_0_73_MG 0.73
-#define SCALE_0_92_MG 0.92
-#define SCALE_1_22_MG 1.22
-#define SCALE_1_52_MG 1.52
-#define SCALE_2_27_MG 2.27
-#define SCALE_2_56_MG 2.56
-#define SCALE_3_03_MG 3.03
-#define SCALE_4_35_MG 4.35
-
-int
-main(int argc, char** argv)
-{
- mraa_init();
- float direction = 0;
- int16_t x = 0, y = 0, z = 0;
- uint8_t rx_tx_buf[MAX_BUFFER_LENGTH];
-
- //! [Interesting]
- mraa_i2c_context i2c;
- i2c = mraa_i2c_init(0);
-
- mraa_i2c_address(i2c, HMC5883L_I2C_ADDR);
- rx_tx_buf[0] = HMC5883L_CONF_REG_B;
- rx_tx_buf[1] = GA_1_3_REG;
- mraa_i2c_write(i2c, rx_tx_buf, 2);
- //! [Interesting]
-
- mraa_i2c_address(i2c, HMC5883L_I2C_ADDR);
- rx_tx_buf[0] = HMC5883L_MODE_REG;
- rx_tx_buf[1] = HMC5883L_CONT_MODE;
- mraa_i2c_write(i2c, rx_tx_buf, 2);
-
- for (;;) {
-#if 0
- int i = 0;
- //alternative, equivalent method which helps to understand exactly what
- //the below does
- mraa_i2c_address(i2c, HMC5883L_I2C_ADDR);
- for (i = 0; i < DATA_REG_SIZE; i++) {
- mraa_i2c_read_byte_data(i2c, HMC5883L_DATA_REG+i);
- }
-#endif
- // first 'select' the register we want to read from
- mraa_i2c_address(i2c, HMC5883L_I2C_ADDR);
- mraa_i2c_write_byte(i2c, HMC5883L_DATA_REG);
-
- // then we read from that register incrementing with every read the
- // chosen register
- mraa_i2c_address(i2c, HMC5883L_I2C_ADDR);
- // this call behaves very similarly to the Wire receive() call
- mraa_i2c_read(i2c, 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];
- y = (rx_tx_buf[HMC5883L_Y_MSB_REG] << 8) | rx_tx_buf[HMC5883L_Y_LSB_REG];
-
- // scale and calculate direction
- direction = atan2(y * SCALE_0_92_MG, x * SCALE_0_92_MG);
-
- // check if the signs are reversed
- if (direction < 0)
- direction += 2 * M_PI;
-
- printf("Compass scaled data x : %f, y : %f, z : %f\n", x * SCALE_0_92_MG, y * SCALE_0_92_MG,
- z * SCALE_0_92_MG);
- printf("Heading : %f\n", direction * 180 / M_PI);
- }
-}
diff --git a/peripheral/libmraa/examples/iio_driver.c b/peripheral/libmraa/examples/iio_driver.c
deleted file mode 100644
index 824e0b1..0000000
--- a/peripheral/libmraa/examples/iio_driver.c
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * 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/iio.h"
-
-static void
-printword(uint16_t input, mraa_iio_channel* chan)
-{
- int16_t res;
-
- if (!chan->lendian) {
- input = be16toh(input);
- } else {
- input = le16toh(input);
- }
-
- input >>= chan->shift;
- input &= chan->mask;
- if (chan->signedd) {
- res = (int16_t)(input << (16 - chan->bits_used)) >> (16 - chan->bits_used);
- } else {
- res = input;
- }
- printf(" value = %05f\n", (float) res);
-}
-
-mraa_iio_context iio_device0;
-mraa_iio_context iio_device6;
-
-void
-interrupt(char* data)
-{
- mraa_iio_channel* channels = mraa_iio_get_channels(iio_device0);
- int i = 0;
-
- for (i; i < mraa_iio_get_channel_count(iio_device0); i++) {
- if (channels[i].enabled) {
- printf("channel %d - bytes %d\n", channels[i].index, channels[i].bytes);
- switch (channels[i].bytes) {
- case 2:
- printword(*(uint16_t*) (data + channels[i].location), &channels[i]);
- }
- }
- }
-}
-
-void
-event_interrupt(struct iio_event_data* data)
-{
- int chan_type;
- int modifier;
- int type;
- int direction;
- int channel;
- int channel2;
- int different;
- mraa_iio_event_extract_event(data, &chan_type, &modifier, &type, &direction, &channel, &channel2, &different);
-
- printf("event time %lld id %lld extracted chan_type %d modifier %d type %d direction %d "
- "channel %d channel2 %d different %d\n",
- data->timestamp, data->id, chan_type, modifier, type, direction, channel, channel2, different);
-}
-
-int
-main()
-{
- //! [Interesting]
- iio_device0 = mraa_iio_init(0);
- if (iio_device0 == NULL) {
- return EXIT_FAILURE;
- }
-
- float iio_float;
- int iio_int;
- mraa_result_t ret;
-
- ret = mraa_iio_write_float(iio_device0, "in_accel_scale", 0.019163);
- if (ret == MRAA_SUCCESS) {
- fprintf(stdout, "IIO write success\n");
- }
-
- ret = mraa_iio_read_float(iio_device0, "in_accel_scale", &iio_float);
- if (ret == MRAA_SUCCESS) {
- fprintf(stdout, "IIO read %f\n", iio_float);
- }
-
- ret = mraa_iio_write_int(iio_device0, "scan_elements/in_accel_x_en", 1);
- if (ret == MRAA_SUCCESS) {
- fprintf(stdout, "IIO write success\n");
- }
-
- ret = mraa_iio_read_int(iio_device0, "scan_elements/in_accel_x_en", &iio_int);
- if (ret == MRAA_SUCCESS) {
- fprintf(stdout, "IIO read %d\n", iio_int);
- }
-
- if (mraa_iio_trigger_buffer(iio_device0, interrupt, NULL) == MRAA_SUCCESS) {
- sleep(100);
- return EXIT_SUCCESS;
- }
-
- /*
- struct iio_event_data event;
- iio_device6 = mraa_iio_init(6);
- if (iio_device6 == NULL) {
- return EXIT_FAILURE;
- }
- mraa_iio_write_int(iio_device6, "events/in_proximity2_thresh_either_en", 1);
-
-
- // Blocking until event fired
- if (mraa_iio_event_poll(iio_device6, &event) == MRAA_SUCCESS) {
- event_interrupt(&event); //just to show data
- }
-
- if (mraa_iio_event_setup_callback(iio_device6, event_interrupt, NULL) == MRAA_SUCCESS) {
- sleep(100);
- return EXIT_SUCCESS;
- }*/
-
- //! [Interesting]
- return EXIT_FAILURE;
-}
diff --git a/peripheral/libmraa/examples/isr_pin6.c b/peripheral/libmraa/examples/isr_pin6.c
deleted file mode 100644
index eaa54e0..0000000
--- a/peripheral/libmraa/examples/isr_pin6.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Author: Brendan Le Foll
- * 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 "mraa.h"
-
-static volatile int counter = 0;
-static volatile int oldcounter = 0;
-
-void
-interrupt(void* args)
-{
- ++counter;
-}
-
-int
-main()
-{
- mraa_init();
- mraa_gpio_context x;
-
- x = mraa_gpio_init(6);
- if (x == NULL) {
- return 1;
- }
-
- mraa_gpio_dir(x, MRAA_GPIO_IN);
-
- mraa_gpio_edge_t edge = MRAA_GPIO_EDGE_BOTH;
-
- mraa_gpio_isr(x, edge, &interrupt, NULL);
-
- for (;;) {
- if (counter != oldcounter) {
- fprintf(stdout, "timeout counter == %d\n", counter);
- oldcounter = counter;
- }
- // got to relieve our poor CPU!
- sleep(1);
- }
-
- mraa_gpio_close(x);
-
- return MRAA_SUCCESS;
-}
diff --git a/peripheral/libmraa/examples/java/AioA0.java b/peripheral/libmraa/examples/java/AioA0.java
deleted file mode 100644
index 89ef252..0000000
--- a/peripheral/libmraa/examples/java/AioA0.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Author: Nandkishor Sonar
- * Copyright (c) 2014 Intel Corporation.
- * Author: Petre Eftime <petre.p.eftime@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-//! [Interesting]
-import mraa.Aio;
-
-public class AioA0 {
-
- static {
- try {
- System.loadLibrary("mraajava");
- } catch (UnsatisfiedLinkError e) {
- System.err.println(
- "Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" +
- e);
- System.exit(1);
- }
- }
-
- public static void main(String[] args) {
- Aio a0 = new Aio(0);
-
- while (true) {
- int adc_value = a0.read();
- float adc_value_float = a0.readFloat();
- System.out.println(String.format("ADC A0 read %X - %d", adc_value, adc_value));
- System.out.println(String.format("ADC A0 read %.5f", adc_value_float));
- }
-
- }
-}
-//! [Interesting]
diff --git a/peripheral/libmraa/examples/java/BlinkIO.java b/peripheral/libmraa/examples/java/BlinkIO.java
deleted file mode 100644
index 0e9209d..0000000
--- a/peripheral/libmraa/examples/java/BlinkIO.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Author: Brendan Le Foll <brendan.le.foll@intel.com>
- * Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- * Author: Petre Eftime <petre.p.eftime@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-import mraa.Dir;
-import mraa.Gpio;
-import mraa.Result;
-import mraa.mraa;
-
-public class BlinkIO {
- static {
- try {
- System.loadLibrary("mraajava");
- } catch (UnsatisfiedLinkError e) {
- System.err.println(
- "Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" +
- e);
- System.exit(1);
- }
- }
-
- final static int DEFAULT_IOPIN = 8;
-
- public static void main(String argv[]) throws InterruptedException {
- int iopin = DEFAULT_IOPIN;
- if (argv.length == 0) {
- System.out.println("Provide an int arg if you want to flash on something other than " + DEFAULT_IOPIN);
- } else {
- iopin = Integer.valueOf(argv[0], DEFAULT_IOPIN);
- }
-
- //! [Interesting]
- Gpio gpio = new Gpio(iopin);
- Result result = gpio.dir(Dir.DIR_OUT);
- if (result != Result.SUCCESS) {
- mraa.printError(result);
- System.exit(1);
- }
-
- while (true) {
- gpio.write(1);
- Thread.sleep(1000);
- gpio.write(0);
- Thread.sleep(1000);
- }
- //! [Interesting]
- }
-} \ No newline at end of file
diff --git a/peripheral/libmraa/examples/java/BlinkOnboard.java b/peripheral/libmraa/examples/java/BlinkOnboard.java
deleted file mode 100644
index ee2bab4..0000000
--- a/peripheral/libmraa/examples/java/BlinkOnboard.java
+++ /dev/null
@@ -1,81 +0,0 @@
-import mraa.Dir;
-import mraa.Gpio;
-import mraa.Platform;
-import mraa.mraa;
-
-/*
- * Author: Brendan Le Foll <brendan.le.foll@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- * Author: Jakub Kramarz <jkramarz@virtuslab.com>
- * Copyright (c) 2015 VirtusLab
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-public class BlinkOnboard {
- static {
- try {
- System.loadLibrary("mraajava");
- } catch (UnsatisfiedLinkError e) {
- System.err.println(
- "Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" +
- e);
- System.exit(1);
- }
- }
- public static void main(String argv[]) throws InterruptedException {
- Platform platform = mraa.getPlatformType();
- Gpio gpio, gpio_in;
- if (platform == Platform.INTEL_GALILEO_GEN1) {
- gpio = new Gpio(3);
- } else if (platform == Platform.INTEL_MINNOWBOARD_MAX) {
- gpio = new Gpio(21);
- } else {
- gpio = new Gpio(13);
- }
- System.out.format("Welcome to libmraa\n Version: %s\n Running on %s\n",
- mraa.getVersion(), platform.toString());
-
- gpio.dir(Dir.DIR_OUT);
- // on platforms with physical button use gpio_in
- if (platform == Platform.INTEL_MINNOWBOARD_MAX) {
- gpio_in = new Gpio(14);
- gpio_in.dir(Dir.DIR_IN);
- System.out.println("Press and hold S1 to stop, Press SW1 to shutdown!");
- } else {
- gpio_in = null;
- }
-
- boolean state = false;
- while (true) {
- if (gpio_in != null && gpio_in.read() == 0) {
- return;
- }
- if (state) {
- state = false;
- gpio.write(1);
- } else {
- state = true;
- gpio.write(0);
- }
- Thread.sleep(1000);
- }
- }
-} \ No newline at end of file
diff --git a/peripheral/libmraa/examples/java/Bmp85.java b/peripheral/libmraa/examples/java/Bmp85.java
deleted file mode 100644
index 6cdc2a1..0000000
--- a/peripheral/libmraa/examples/java/Bmp85.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Author: Alexander Komarov <alexander.komarov@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.
- */
-
-public class Bmp85 {
- static {
- try {
- System.loadLibrary("mraajava");
- } catch (UnsatisfiedLinkError e) {
- System.err.println(
- "Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" +
- e);
- System.exit(1);
- }
- }
- public static void main(String argv[]) {
- mraa.mraa.init();
- System.out.println(mraa.mraa.getVersion());
-
- // helper function to go from hex val to dec
- // function char(x) { return parseInt(x, 16); }
-
- mraa.I2c i2c = new mraa.I2c(0);
- i2c.address((byte)0x77);
- i2c.writeByte((byte)0xd0);
- /*
- SWIGTYPE_p_unsigned_char data0 = new SWIGTYPE_p_unsigned_char();*/
- byte[] data = new byte[1];
- i2c.read(data);
- System.out.println((new Integer(data[0])).toString());
-
- i2c.writeReg((byte)0xf4, (byte)0x2e);
- // initialise device
- if (i2c.readReg((byte)0xd0) != 0x55) {
- System.out.println("error");
- }
-
- // we want to read temperature so write 0x2e into control reg
- i2c.writeReg((byte)0xf4, (byte)0x2e);
-
- // read a 16bit reg, obviously it's uncalibrated so mostly a useless value
- // :)
- System.out.println(i2c.readWordReg((byte)0xf6));
-
- byte[] buf = new byte[2];
- buf[0] = (byte)0xf4;
- buf[1] = (byte)0x2e;
- i2c.write(buf);
-
- i2c.writeByte((byte)0xf6);
- int d = i2c.readReg((byte)2);
- System.out.println((new Integer(d)).toString());
- };
-}
-;
diff --git a/peripheral/libmraa/examples/java/CyclePwm3.java b/peripheral/libmraa/examples/java/CyclePwm3.java
deleted file mode 100644
index 31bb25c..0000000
--- a/peripheral/libmraa/examples/java/CyclePwm3.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Author: Brendan Le Foll <brendan.le.foll@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- * Author: Jakub Kramarz <jkramarz@virtuslab.com>
- * Copyright (c) 2015 VirtusLab
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-import mraa.Pwm;
-
-public class CyclePwm3 {
- static {
- try {
- System.loadLibrary("mraajava");
- } catch (UnsatisfiedLinkError e) {
- System.err.println(
- "Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" +
- e);
- System.exit(1);
- }
- }
- public static void main(String argv[]) throws InterruptedException {
- //! [Interesting]
- Pwm pwm = new mraa.Pwm(3);
- pwm.period_us(200);
- pwm.enable(true);
-
- float value = 0;
- while (true) {
- value += 0.01;
- pwm.write(value);
- Thread.sleep(50);
- if (value >= 1) {
- value = 0;
- }
- }
- //! [Interesting]
- }
-}
diff --git a/peripheral/libmraa/examples/java/Example.java b/peripheral/libmraa/examples/java/Example.java
deleted file mode 100644
index e311043..0000000
--- a/peripheral/libmraa/examples/java/Example.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Author: Brendan Le Foll <brendan.le.foll@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- * Author: Petre Eftime <petre.p.eftime@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-//! [Interesting]
-import mraa.mraa;
-
-public class Example {
- static {
- try {
- System.loadLibrary("mraajava");
- } catch (UnsatisfiedLinkError e) {
- System.err.println(
- "Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" +
- e);
- System.exit(1);
- }
- }
- public static void main(String argv[]) {
- String board = mraa.getPlatformName();
- String version = mraa.getVersion();
- System.out.println("hello mraa");
- System.out.println(String.format("Version: %s", version));
- System.out.println(String.format("Running on %s", board));
- };
-}
-//! [Interesting]
diff --git a/peripheral/libmraa/examples/java/FTDITest.java b/peripheral/libmraa/examples/java/FTDITest.java
deleted file mode 100644
index f7a1c00..0000000
--- a/peripheral/libmraa/examples/java/FTDITest.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Author: Petre Eftime <petre.p.eftime@intel.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.
- */
-
-import mraa.*;
-
-public class FTDITest {
-
- public static void main(String[] args) throws InterruptedException {
- String board = mraa.getPlatformName();
- String version = mraa.getVersion();
-
- System.out.println(String.format("Version: %s", version));
- System.out.println(String.format("Running on %s", board));
-
- if (mraa.hasSubPlatform()) {
- System.out.println("Subplatform detected");
-
- /* Print when button is pressed */
- Gpio button = new Gpio(515);
- button.dir(Dir.DIR_IN);
- button.isr(Edge.EDGE_FALLING, new Runnable() {
-
- @Override
- public void run() {
- System.out.println("Button pressed");
- }
- });
-
- /* Blink FTDI board LED */
- Gpio led = new Gpio(514);
- led.dir(Dir.DIR_OUT);
- for (int i = 0;; i = (i + 1) % 2) {
- led.write(i);
- Thread.sleep(500);
- }
- } else {
- System.out.println("Subplatform not detected");
- }
- }
-}
-
diff --git a/peripheral/libmraa/examples/java/GpioMmapped.java b/peripheral/libmraa/examples/java/GpioMmapped.java
deleted file mode 100644
index c780a4e..0000000
--- a/peripheral/libmraa/examples/java/GpioMmapped.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- * Author: Petre Eftime <petre.p.eftime@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-import mraa.Gpio;
-import mraa.mraa;
-
-public class GpioMmapped {
- static {
- try {
- System.loadLibrary("mraajava");
- } catch (UnsatisfiedLinkError e) {
- System.err.println(
- "Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" +
- e);
- System.exit(1);
- }
- }
- public static void main(String argv[]) throws InterruptedException {
- //! [Interesting]
- String board = mraa.getPlatformName();
- String version = mraa.getVersion();
- System.out.println("hello mraa");
- System.out.println(String.format("Version: %s", version));
-
- Gpio gpio = new Gpio(1);
-
- gpio.useMmap(true);
-
- while (true) {
- gpio.write(1);
- Thread.sleep(50);
- gpio.write(0);
- Thread.sleep(50);
- }
- //! [Interesting]
- };
-}
diff --git a/peripheral/libmraa/examples/java/GpioRead6.java b/peripheral/libmraa/examples/java/GpioRead6.java
deleted file mode 100644
index 65854ea..0000000
--- a/peripheral/libmraa/examples/java/GpioRead6.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- * Author: Jakub Kramarz <jkramarz@virtuslab.com>
- * Copyright (c) 2015 VirtusLab
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-import mraa.Dir;
-import mraa.Gpio;
-import mraa.mraa;
-
-public class GpioRead6 {
- static {
- try {
- System.loadLibrary("mraajava");
- } catch (UnsatisfiedLinkError e) {
- System.err.println(
- "Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" +
- e);
- System.exit(1);
- }
- }
- public static void main(String argv[]) throws InterruptedException {
- System.out.println(String.format("MRAA Version: %s\nStarting Read on IO6\n", mraa.getVersion()));
- //! [Interesting]
- Gpio gpio = new Gpio(6);
-
- gpio.dir(Dir.DIR_IN);
-
- while (true) {
- System.out.format("Gpio is %d\n", gpio.read());
- Thread.sleep(1000);
- }
- //! [Interesting]
- }
-}
diff --git a/peripheral/libmraa/examples/java/HelloEdison.java b/peripheral/libmraa/examples/java/HelloEdison.java
deleted file mode 100644
index c6eec43..0000000
--- a/peripheral/libmraa/examples/java/HelloEdison.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Author: Brendan Le Foll <brendan.le.foll@intel.com>
- * Author: Petre Eftime <petre.p.eftime@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-//! [Interesting]
-import mraa.Dir;
-import mraa.Gpio;
-import mraa.IntelEdison;
-import mraa.mraa;
-import mraa.Platform;
-import mraa.Result;
-
-public class HelloEdison {
- static {
- try {
- System.loadLibrary("mraajava");
- } catch (UnsatisfiedLinkError e) {
- System.err.println(
- "Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" +
- e);
- System.exit(1);
- }
- }
- public static void main(String argv[]) {
- Platform platform = mraa.getPlatformType();
-
- if (platform != Platform.INTEL_EDISON_FAB_C) {
- System.err.println("Error: This program can only be run on edison");
- System.exit(Result.ERROR_INVALID_PLATFORM.swigValue());
- }
-
- /*
- * MRAA_INTEL_EDISON_GP182 == 0, so this will initialise pin0 on arduino,
- * which is hardware GPIO 130 and not 182
- * We set the owner to false here, this makes sure that we do not close the
- * gpio from sysfs in mraa_gpio_close meaning it will stay as an output and
- * we will not always transition from 0->1 as gpio182 as output has the
- * default position of '0'. Note that the value could change as a result of
- * a mraa_gpio_dir however meaning we always go from 0->1 or 1->0
- */
- Gpio gpio182 = new Gpio(IntelEdison.INTEL_EDISON_GP182.swigValue(), false);
- gpio182.dir(Dir.DIR_OUT);
-
- int val = gpio182.read();
-
- System.out.println(String.format("GPIO%d (mraa pin %d) was: %d, will set to %d\n", 182,
- gpio182.getPin(), val, val == 0 ? 1 : 0));
-
- gpio182.write(val == 0 ? 1 : 0);
- };
-}
-//! [Interesting]
diff --git a/peripheral/libmraa/examples/java/I2cCompass.java b/peripheral/libmraa/examples/java/I2cCompass.java
deleted file mode 100644
index 6bcebdb..0000000
--- a/peripheral/libmraa/examples/java/I2cCompass.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Author: Brendan Le Foll <brendan.le.foll@intel.com>
- * Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- * Author: Petre Eftime <petre.p.eftime@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-import mraa.I2c;
-
-public class I2cCompass {
- static {
- try {
- System.loadLibrary("mraajava");
- } catch (UnsatisfiedLinkError e) {
- System.err.println(
- "Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" +
- e);
- System.exit(1);
- }
- }
-
- final static byte MAX_BUFFER_LENGTH = 6;
- final static byte CONF_BUFFER_LENGTH = 2;
- final static short HMC5883L_I2C_ADDR = 0x1E;
-
- // configuration registers
- final static byte HMC5883L_CONF_REG_A = 0x00;
- final static byte HMC5883L_CONF_REG_B = 0x01;
-
- // mode register
- final static byte HMC5883L_MODE_REG = 0x02;
-
- // data register
- final static byte HMC5883L_X_MSB_REG = 0;
- final static byte HMC5883L_X_LSB_REG = 1;
- final static byte HMC5883L_Z_MSB_REG = 2;
- final static byte HMC5883L_Z_LSB_REG = 3;
- final static byte HMC5883L_Y_MSB_REG = 4;
- final static byte HMC5883L_Y_LSB_REG = 5;
- final static byte DATA_REG_SIZE = 6;
-
- // status register
- final static byte HMC5883L_STATUS_REG = 0x09;
-
- // ID registers
- final static byte HMC5883L_ID_A_REG = 0x0A;
- final static byte HMC5883L_ID_B_REG = 0x0B;
- final static byte HMC5883L_ID_C_REG = 0x0C;
-
- final static byte HMC5883L_CONT_MODE = 0x00;
- final static byte HMC5883L_DATA_REG = 0x03;
-
- // scales
- final static byte GA_0_88_REG = ((byte) (0x00 << 5));
- final static byte GA_1_3_REG = ((byte) (0x01 << 5));
- final static byte GA_1_9_REG = ((byte) (0x02 << 5));
- final static byte GA_2_5_REG = ((byte) (0x03 << 5));
- final static byte GA_4_0_REG = ((byte) (0x04 << 5));
- final static byte GA_4_7_REG = ((byte) (0x05 << 5));
- final static byte GA_5_6_REG = ((byte) (0x06 << 5));
- final static byte GA_8_1_REG = ((byte) (0x07 << 5));
-
- // digital resolutions
- final static float SCALE_0_73_MG = 0.73f;
- final static float SCALE_0_92_MG = 0.92f;
- final static float SCALE_1_22_MG = 1.22f;
- final static float SCALE_1_52_MG = 1.52f;
- final static float SCALE_2_27_MG = 2.27f;
- final static float SCALE_2_56_MG = 2.56f;
- final static float SCALE_3_03_MG = 3.03f;
- final static float SCALE_4_35_MG = 4.35f;
-
- public static void main(String[] args) throws InterruptedException {
- float direction = 0;
- int x, y, z;
- byte[] rx_tx_buf = new byte[MAX_BUFFER_LENGTH];
- byte[] conf_buf = new byte[CONF_BUFFER_LENGTH];
-
- //! [Interesting]
- I2c i2c = new I2c(0);
-
- i2c.address(HMC5883L_I2C_ADDR);
- conf_buf[0] = HMC5883L_CONF_REG_B;
- conf_buf[1] = GA_1_3_REG;
- i2c.write(conf_buf);
- //! [Interesting]
-
- i2c.address(HMC5883L_I2C_ADDR);
- conf_buf[0] = HMC5883L_MODE_REG;
- conf_buf[1] = HMC5883L_CONT_MODE;
- i2c.write(conf_buf);
-
- while (true) {
- i2c.address(HMC5883L_I2C_ADDR);
- i2c.writeByte(HMC5883L_DATA_REG);
-
- i2c.address(HMC5883L_I2C_ADDR);
- i2c.read(rx_tx_buf);
-
- 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];
- y = (rx_tx_buf[HMC5883L_Y_MSB_REG] << 8) | rx_tx_buf[HMC5883L_Y_LSB_REG];
-
- direction = (float) Math.atan2(y * SCALE_0_92_MG, x * SCALE_0_92_MG);
-
- if (direction < 0)
- direction += 2 * Math.PI;
-
- System.out.println(String.format("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));
- System.out.println(String.format("Heading : %f\n", direction * 180 / Math.PI));
- Thread.sleep(1000);
- }
- }
-}
diff --git a/peripheral/libmraa/examples/java/Isr.java b/peripheral/libmraa/examples/java/Isr.java
deleted file mode 100644
index a43dcc7..0000000
--- a/peripheral/libmraa/examples/java/Isr.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Author: Alexander Komarov <alexander.komarov@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.
- */
-
-import mraa.Dir;
-import mraa.Edge;
-import mraa.Gpio;
-
-public class Isr {
- static {
- try {
- System.loadLibrary("mraajava");
- } catch (UnsatisfiedLinkError e) {
- System.err.println(
- "Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" +
- e);
- System.exit(1);
- }
- }
- public static void main(String argv[]) throws InterruptedException {
- int pin = 6;
- if (argv.length == 1) {
- try {
- pin = Integer.parseInt(argv[0]);
- } catch (Exception e) {
- }
- }
- System.out.println("Starting ISR for pin " + Integer.toString(pin));
- Gpio gpio = new Gpio(pin);
-
- Runnable callback = new JavaCallback();
-
- gpio.isr(Edge.EDGE_RISING, callback);
- while (true)
- Thread.sleep(999999);
- };
-
-}
-
-class JavaCallback implements Runnable {
- @Override
- public void run() {
- System.out.println("Gpio level changed");
- }
-}
diff --git a/peripheral/libmraa/examples/java/SpiMAX7219.java b/peripheral/libmraa/examples/java/SpiMAX7219.java
deleted file mode 100644
index 0899a85..0000000
--- a/peripheral/libmraa/examples/java/SpiMAX7219.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Author: Michael Ring <mail@michael-ring.org>
- * Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- * Author: Petre Eftime <petre.p.eftime@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-import java.nio.ByteBuffer;
-import mraa.Result;
-import mraa.Spi;
-
-public class SpiMAX7219 {
- static {
- try {
- System.loadLibrary("mraajava");
- } catch (UnsatisfiedLinkError e) {
- System.err.println(
- "Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" +
- e);
- System.exit(1);
- }
- }
- public static void main(String argv[]) throws InterruptedException {
- //! [Interesting]
- Spi spi = new Spi(1);
-
- spi.frequency(400000);
- spi.lsbmode(false);
-
- if(spi.bitPerWord(16) != Result.SUCCESS) {
- System.err.println("Could not set SPI Device to 16Bit mode, exit...");
- System.exit(1);
- }
-
- spi.write_word(0x0900); //Do not decode bits
- spi.write_word(0x0a05); // Brightness of LEDs
- spi.write_word(0x0b07); // Show all Scan Lines
- spi.write_word(0x0c01); // Display on
- spi.write_word(0x0f00); // Testmode off
-
- short dataAA55[] = { 0x01aa, 0x0255, 0x03aa, 0x0455, 0x05aa, 0x0655, 0x07aa, 0x0855 };
- ByteBuffer buf = ByteBuffer.allocate(dataAA55.length * 2);
- for (int i = 0; i < dataAA55.length; i++)
- buf.putShort(dataAA55[i]);
-
- spi.write(buf.array());
- Thread.sleep(2000);
-
- short data55AA[] = { 0x0155, 0x02aa, 0x0355, 0x04aa, 0x0555, 0x06aa, 0x0755, 0x08aa };
- buf = ByteBuffer.allocate(data55AA.length * 2);
- for (int i = 0; i < data55AA.length; i++)
- buf.putShort(data55AA[i]);
-
- spi.write(buf.array());
- Thread.sleep(2000);
-
- short data[] = { 0x0100, 0x0200, 0x0300, 0x0400, 0x0500, 0x0600, 0x0700, 0x0800 };
- buf = ByteBuffer.allocate(data.length * 2);
- for (int i = 0; i < data.length; i++)
- buf.putShort(data[i]);
-
- spi.write(buf.array());
-
- for (int i = 1; i <= 8; i++) {
- for (int j = 0; j < 8; j++) {
- spi.write_word((i << 8) + (1 << j));
- Thread.sleep(1000);
- }
- spi.write_word(i << 8);
- }
- //! [Interesting]
- };
-}
diff --git a/peripheral/libmraa/examples/java/SpiMCP4261.java b/peripheral/libmraa/examples/java/SpiMCP4261.java
deleted file mode 100644
index 7ebda57..0000000
--- a/peripheral/libmraa/examples/java/SpiMCP4261.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Author: Alexander Komarov <alexander.komarov@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- * Author: Petre Eftime <petre.p.eftime@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-import mraa.Spi;
-
-public class SpiMCP4261 {
- static {
- try {
- System.loadLibrary("mraajava");
- } catch (UnsatisfiedLinkError e) {
- System.err.println(
- "Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" +
- e);
- System.exit(1);
- }
- }
- public static void main(String argv[]) throws InterruptedException {
- //! [Interesting]
- Spi spi = new Spi(0);
-
- System.out.println("Hello, SPI initialised");
- byte data[] = {0x00, 100};
- while (true) {
- for (int i = 90; i < 130; i++) {
- data[1] = (byte) i;
- byte[] recv = spi.write(data);
- System.out.println(String.format("Writing - %d", i));
- System.out.println(String.format("Received - %d - %d", recv[0], recv[1]));
- Thread.sleep(100);
- }
- for (int i = 130; i > 90; i--) {
- data[1] = (byte) i;
- byte[] recv = spi.write(data);
- System.out.println(String.format("Writing - %d", i));
- System.out.println(String.format("Received - %d - %d", recv[0], recv[1]));
- Thread.sleep(100);
- }
- }
- //! [Interesting]
- };
-}
diff --git a/peripheral/libmraa/examples/java/UartExample.java b/peripheral/libmraa/examples/java/UartExample.java
deleted file mode 100644
index 5370a82..0000000
--- a/peripheral/libmraa/examples/java/UartExample.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
- * Author: Brendan Le Foll <brendan.le.foll@intel.com>
- * Author: Petre Eftime <petre.p.eftime@intel.com>
- * Copyright (c) 2014, 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-import mraa.Result;
-import mraa.Uart;
-import mraa.UartParity;
-
-public class UartExample {
-
- public static void main(String[] args) {
- //! [Interesting]
- Uart uart = new Uart(0);
-
- if (uart.setBaudRate(115200) != Result.SUCCESS) {
- System.err.println("Error setting baud rate");
- System.exit(1);
- }
-
- if (uart.setMode(8, UartParity.UART_PARITY_NONE, 1) != Result.SUCCESS) {
- System.err.println("Error setting mode");
- System.exit(1);
- }
-
- if (uart.setFlowcontrol(false, false) != Result.SUCCESS) {
- System.err.println("Error setting flow control");
- System.exit(1);
- }
-
- uart.writeStr("Hello monkeys");
- //! [Interesting]
- }
-} \ No newline at end of file
diff --git a/peripheral/libmraa/examples/javascript/AioA0.js b/peripheral/libmraa/examples/javascript/AioA0.js
deleted file mode 100644
index 7e35311..0000000
--- a/peripheral/libmraa/examples/javascript/AioA0.js
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Author: Dan Yocom <dan.yocom@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.
- */
-
-var m = require('mraa'); //require mraa
-console.log('MRAA Version: ' + m.getVersion()); //write the mraa version to the console
-
-var analogPin0 = new m.Aio(0); //setup access analog inpuput pin 0
-var analogValue = analogPin0.read(); //read the value of the analog pin
-var analogValueFloat = analogPin0.readFloat(); //read the pin value as a float
-console.log(analogValue); //write the value of the analog pin to the console
-console.log(analogValueFloat.toFixed(5)); //write the value in the float format
diff --git a/peripheral/libmraa/examples/javascript/Blink-IO.js b/peripheral/libmraa/examples/javascript/Blink-IO.js
deleted file mode 100644
index 75f080c..0000000
--- a/peripheral/libmraa/examples/javascript/Blink-IO.js
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Author: Dan Yocom <dan.yocom@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.
- */
-
-var m = require('mraa'); //require mraa
-console.log('MRAA Version: ' + m.getVersion()); //write the mraa version to the console
-
-var myLed = new m.Gpio(13); //LED hooked up to digital pin 13 (or built in pin on Galileo Gen1 & Gen2)
-myLed.dir(m.DIR_OUT); //set the gpio direction to output
-var ledState = true; //Boolean to hold the state of Led
-
-function periodicActivity()
-{
- myLed.write(ledState?1:0); //if ledState is true then write a '1' (high) otherwise write a '0' (low)
- ledState = !ledState; //invert the ledState
- setTimeout(periodicActivity,1000); //call the indicated function after 1 second (1000 milliseconds)
-}
-
-periodicActivity(); //call the periodicActivity function
-
diff --git a/peripheral/libmraa/examples/javascript/GPIO_DigitalRead.js b/peripheral/libmraa/examples/javascript/GPIO_DigitalRead.js
deleted file mode 100644
index 0bdb3d9..0000000
--- a/peripheral/libmraa/examples/javascript/GPIO_DigitalRead.js
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Author: Dan Yocom <dan.yocom@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.
- */
-
-var m = require('mraa'); //require mraa
-console.log('MRAA Version: ' + m.getVersion()); //write the mraa version to the console
-
-var myDigitalPin = new m.Gpio(6); //setup digital read on pin 6
-myDigitalPin.dir(m.DIR_IN); //set the gpio direction to input
-
-periodicActivity(); //call the periodicActivity function
-
-function periodicActivity() //
-{
- var myDigitalValue = myDigitalPin.read(); //read the digital value of the pin
- console.log('Gpio is ' + myDigitalValue); //write the read value out to the console
- setTimeout(periodicActivity,1000); //call the indicated function after 1 second (1000 milliseconds)
-}
diff --git a/peripheral/libmraa/examples/javascript/GPIO_DigitalWrite.js b/peripheral/libmraa/examples/javascript/GPIO_DigitalWrite.js
deleted file mode 100644
index cefe03f..0000000
--- a/peripheral/libmraa/examples/javascript/GPIO_DigitalWrite.js
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Author: Dan Yocom <dan.yocom@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.
- */
-
-var m = require('mraa'); //require mraa
-console.log('MRAA Version: ' + m.getVersion()); //write the mraa version to the console
-
-var myDigitalPin = new m.Gpio(5); //setup digital read on pin 5
-myDigitalPin.dir(m.DIR_OUT); //set the gpio direction to output
-myDigitalPin.write(1); //set the digital pin to high (1)
diff --git a/peripheral/libmraa/examples/javascript/bmp85.js b/peripheral/libmraa/examples/javascript/bmp85.js
deleted file mode 100644
index 9d16b13..0000000
--- a/peripheral/libmraa/examples/javascript/bmp85.js
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/usr/bin/env node
-
-/*
- * 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.
- */
-
-var m = require('mraa'); //require mraa
-
-x = new m.I2c(0)
-x.address(0x77)
-
-// initialise device
-if (x.readReg(0xd0) != 0x55) {
- console.log("error");
-}
-
-// we want to read temperature so write 0x2e into control reg
-x.writeReg(0xf4, 0x2e)
-
-// read a 16bit reg, obviously it's uncalibrated so mostly a useless value :)
-console.log(x.readWordReg(0xf6))
-
-// and we can do the same thing with the read()/write() calls if we wished
-// thought I'd really not recommend it!
-buf = new Buffer(2)
-buf[0] = 0xf4
-buf[1] = 0x2e
-console.log(buf.toString('hex'))
-x.write(buf)
-
-x.writeByte(0xf6)
-d = x.read(2)
diff --git a/peripheral/libmraa/examples/javascript/gpio-tool.js b/peripheral/libmraa/examples/javascript/gpio-tool.js
deleted file mode 100644
index f254bf6..0000000
--- a/peripheral/libmraa/examples/javascript/gpio-tool.js
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Author: Henry Bruce <henry.bruce@intel.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.
- */
-
-var mraa = require('mraa');
-const readline = require('readline');
-
-const rl = readline.createInterface({
- input: process.stdin,
- output: process.stdout
-});
-
-function printUsage() {
- console.log("version Print version");
- console.log("get pin Get pin value");
-}
-
-function getVersion() {
- console.log('MRAA Version: ' + mraa.getVersion());
-}
-
-function setPin() {
- var pinNumber = arguments[0];
- var pinValue = arguments[1];
- var pin = new mraa.Gpio(pinNumber);
- pin.dir(mraa.DIR_OUT);
- pin.write(pinNumber, pinValue);
-}
-
-function getPin() {
- var pinNumber = arguments[0];
- var pin = new mraa.Gpio(pinNumber);
- pin.dir(mraa.DIR_IN);
- console.log('Gpio ' + pinNumber + ' = ' + pin.read());
-}
-
-function onPinLevelChange() {
- console.log('gpio change');
-}
-
-function monitorPin() {
- var pinNumber = arguments[0];
- var pin = new mraa.Gpio(pinNumber);
- pin.dir(mraa.DIR_IN);
- pin.isr(mraa.EDGE_BOTH, onPinLevelChange);
- rl.question('Press ENTER to stop', function(answer) {
- rl.close();
- });
-}
-
-const args = process.argv;
-const argc = args.length;
-if (argc >= 3) {
- const cmd = args[2];
- switch (args[2]) {
- case "version":
- getVersion();
- break;
- case "get":
- var pinNumber = parseInt(args[3]);
- getPin(pinNumber);
- break;
- case "set":
- var pinNumber = parseInt(args[3]);
- var pinValue = parseInt(args[4]);
- getPin(pinNumber, pinValue);
- break;
- case "monitor":
- var pinNumber = parseInt(args[3]);
- monitorPin(pinNumber);
- break;
- default:
- console.log("Invalid command " + args[2]);
- break;
- }
-} else {
- console.log("Command not specified");
- printUsage();
-}
-
diff --git a/peripheral/libmraa/examples/javascript/isr.js b/peripheral/libmraa/examples/javascript/isr.js
deleted file mode 100644
index d400c0d..0000000
--- a/peripheral/libmraa/examples/javascript/isr.js
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/usr/bin/env node
-
-var m = require('mraa')
-
-function h() {
- console.log("HELLO!!!!")
-}
-
-x = new m.Gpio(14)
-x.isr(m.EDGE_BOTH, h)
diff --git a/peripheral/libmraa/examples/javascript/rgblcd.js b/peripheral/libmraa/examples/javascript/rgblcd.js
deleted file mode 100644
index a92c6df..0000000
--- a/peripheral/libmraa/examples/javascript/rgblcd.js
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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.
- */
-
-var m = require('mraa'); //require mraa
-
-x = new m.I2c(0)
-x.address(0x62)
-x.writeReg(0, 0)
-x.writeReg(1, 0)
-
-x.writeReg(0x08, 0xAA)
-x.writeReg(0x04, 255)
-x.writeReg(0x02, 255)
diff --git a/peripheral/libmraa/examples/javascript/spi.js b/peripheral/libmraa/examples/javascript/spi.js
deleted file mode 100644
index 16bd3ce..0000000
--- a/peripheral/libmraa/examples/javascript/spi.js
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/usr/bin/env node
-
-/*
- * 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.
- */
-
-var m = require('mraa'); //require mraa
-
-x = new m.Spi(0)
-buf = new Buffer(4)
-buf[0] = 0xf4
-buf[1] = 0x2e
-buf[2] = 0x3e
-buf[3] = 0x4e
-buf2 = x.write(buf)
-console.log("Sent: " + buf.toString('hex') + ". Received: " + buf2.toString('hex'))
-
-
diff --git a/peripheral/libmraa/examples/javascript/uart.js b/peripheral/libmraa/examples/javascript/uart.js
deleted file mode 100644
index a3a96e5..0000000
--- a/peripheral/libmraa/examples/javascript/uart.js
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Author: Eugene Bolshakov <pub@relvarsoft.com>
- * Copyright (c) 2015 Eugene Bolshakov
- *
- * 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.
- */
-
-var m = require('mraa'); //require mraa
-console.log('MRAA Version: ' + m.getVersion());
-u = new m.Uart(0)
-
-console.log("Note: connect Rx and Tx of UART with a wire before use");
-
-function sleep(delay) {
- delay += new Date().getTime();
- while (new Date() < delay) { }
-}
-
-console.log("Set UART parameters");
-
-u.setBaudRate(115200);
-u.setMode(8, 0, 1);
-u.setFlowcontrol(false, false);
-sleep(200);
-
-console.log("First write-read circle:");
-
-u.writeStr("test\n");
-sleep(200);
-console.log(u.readStr(6));
-sleep(200);
-
-console.log("Second write-read circle:");
-
-u.writeStr("2nd test\n");
-sleep(200);
-console.log(u.readStr(10));
diff --git a/peripheral/libmraa/examples/mmap-io2.c b/peripheral/libmraa/examples/mmap-io2.c
deleted file mode 100644
index 53c2432..0000000
--- a/peripheral/libmraa/examples/mmap-io2.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include "stdio.h"
-#include <unistd.h>
-
-#include "mraa.h"
-
-int
-main(int argc, char** argv)
-{
- //! [Interesting]
- fprintf(stdout, "hello mraa\n Version: %s\n", mraa_get_version());
- mraa_gpio_context gpio;
- gpio = mraa_gpio_init(2);
-
- mraa_gpio_use_mmaped(gpio, 1);
-
- for (;;) {
- mraa_gpio_write(gpio, 1);
- usleep(50000);
- mraa_gpio_write(gpio, 0);
- usleep(50000);
- }
- //! [Interesting]
-}
diff --git a/peripheral/libmraa/examples/mraa-gpio.c b/peripheral/libmraa/examples/mraa-gpio.c
deleted file mode 100644
index e94d48f..0000000
--- a/peripheral/libmraa/examples/mraa-gpio.c
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
- * 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 <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "mraa/gpio.h"
-
-struct gpio_source {
- int pin;
- mraa_gpio_context context;
-};
-
-void
-print_version()
-{
- fprintf(stdout, "Version %s on %s\n", mraa_get_version(), mraa_get_platform_name());
-}
-
-void
-print_help()
-{
- fprintf(stdout, "list List pins\n");
- fprintf(stdout, "set pin level Set pin to level (0/1)\n");
- fprintf(stdout, "setraw pin level Set pin to level (0/1) via mmap (if available)\n");
- fprintf(stdout, "get pin Get pin level\n");
- fprintf(stdout, "getraw pin Get pin level via mmap (if available)\n");
- fprintf(stdout, "monitor pin Monitor pin level changes\n");
- fprintf(stdout, "version Get mraa version and board name\n");
-}
-
-void
-print_command_error()
-{
- fprintf(stdout, "Invalid command, options are:\n");
- print_help();
-}
-
-int
-list_platform_pins(uint8_t platform_offset)
-{
- int pin_count = mraa_get_platform_pin_count(platform_offset);
- int i;
- for (i = 0; i < pin_count; ++i) {
- int pin_id = platform_offset > 0 ? mraa_get_sub_platform_id(i) : i;
- char* pin_name = mraa_get_pin_name(pin_id);
- if (strcmp(pin_name, "INVALID") != 0) {
- fprintf(stdout, "%02d ", pin_id);
- fprintf(stdout, "%*s: ", (MRAA_PIN_NAME_SIZE - 1), pin_name);
- if (mraa_pin_mode_test(pin_id, MRAA_PIN_GPIO))
- fprintf(stdout, "GPIO ");
- if (mraa_pin_mode_test(pin_id, MRAA_PIN_I2C))
- fprintf(stdout, "I2C ");
- if (mraa_pin_mode_test(pin_id, MRAA_PIN_SPI))
- fprintf(stdout, "SPI ");
- if (mraa_pin_mode_test(pin_id, MRAA_PIN_PWM))
- fprintf(stdout, "PWM ");
- if (mraa_pin_mode_test(pin_id, MRAA_PIN_AIO))
- fprintf(stdout, "AIO ");
- if (mraa_pin_mode_test(pin_id, MRAA_PIN_UART))
- fprintf(stdout, "UART ");
- fprintf(stdout, "\n");
- }
- }
- return pin_count;
-}
-
-int
-list_pins()
-{
- int pin_count = 0;
- pin_count += list_platform_pins(MRAA_MAIN_PLATFORM_OFFSET);
- pin_count += list_platform_pins(MRAA_SUB_PLATFORM_OFFSET);
- if (pin_count == 0) {
- fprintf(stdout, "No Pins\n");
- }
-}
-
-
-mraa_result_t
-gpio_set(int pin, int level, mraa_boolean_t raw)
-{
- mraa_gpio_context gpio = mraa_gpio_init(pin);
- if (gpio != NULL) {
- mraa_gpio_dir(gpio, MRAA_GPIO_OUT);
- if (raw != 0) {
- if (mraa_gpio_use_mmaped(gpio, 1) != MRAA_SUCCESS) {
- fprintf(stdout,
- "mmapped access to gpio %d not supported, falling back to normal mode\n", pin);
- }
- }
- mraa_gpio_write(gpio, level);
- return MRAA_SUCCESS;
- }
- return MRAA_ERROR_INVALID_RESOURCE;
-}
-
-mraa_result_t
-gpio_get(int pin, int* level, mraa_boolean_t raw)
-{
- mraa_gpio_context gpio = mraa_gpio_init(pin);
- if (gpio != NULL) {
- mraa_gpio_dir(gpio, MRAA_GPIO_IN);
- if (raw != 0) {
- if (mraa_gpio_use_mmaped(gpio, 1) != MRAA_SUCCESS) {
- fprintf(stdout,
- "mmapped access to gpio %d not supported, falling back to normal mode\n", pin);
- }
- }
- *level = mraa_gpio_read(gpio);
- return MRAA_SUCCESS;
- }
- return MRAA_ERROR_INVALID_RESOURCE;
-}
-
-
-void
-gpio_isr_handler(void* args)
-{
- struct gpio_source* gpio_info = (struct gpio_source*) args;
- int level = mraa_gpio_read(gpio_info->context);
- fprintf(stdout, "Pin %d = %d\n", gpio_info->pin, level);
-}
-
-mraa_result_t
-gpio_isr_start(struct gpio_source* gpio_info)
-{
- gpio_info->context = mraa_gpio_init(gpio_info->pin);
- if (gpio_info->context != NULL) {
- mraa_result_t status = mraa_gpio_dir(gpio_info->context, MRAA_GPIO_IN);
- if (status == MRAA_SUCCESS) {
- status = mraa_gpio_isr(gpio_info->context, MRAA_GPIO_EDGE_BOTH, &gpio_isr_handler, gpio_info);
- }
- return status;
- } else {
- return MRAA_ERROR_INVALID_RESOURCE;
- }
-}
-
-
-mraa_result_t
-gpio_isr_stop(struct gpio_source* gpio_info)
-{
- mraa_gpio_isr_exit(gpio_info->context);
- mraa_gpio_close(gpio_info->context);
- return MRAA_SUCCESS;
-}
-
-
-int
-main(int argc, char** argv)
-{
- if (argc == 1) {
- print_command_error();
- }
-
- if (argc > 1) {
- if (strcmp(argv[1], "list") == 0) {
- list_pins();
- } else if (strcmp(argv[1], "help") == 0) {
- print_help();
- } else if (strcmp(argv[1], "version") == 0) {
- print_version();
- } else if ((strcmp(argv[1], "set") == 0) || (strcmp(argv[1], "setraw") == 0)) {
- if (argc == 4) {
- int pin = atoi(argv[2]);
- mraa_boolean_t rawmode = strcmp(argv[1], "setraw") == 0;
- if (gpio_set(pin, atoi(argv[3]), rawmode) != MRAA_SUCCESS)
- fprintf(stdout, "Could not initialize gpio %d\n", pin);
- } else {
- print_command_error();
- }
- } else if ((strcmp(argv[1], "get") == 0) || (strcmp(argv[1], "getraw") == 0)) {
- if (argc == 3) {
- int pin = atoi(argv[2]);
- int level;
- mraa_boolean_t rawmode = strcmp(argv[1], "getraw") == 0;
- if (gpio_get(pin, &level, rawmode) == MRAA_SUCCESS) {
- fprintf(stdout, "Pin %d = %d\n", pin, level);
- } else {
- fprintf(stdout, "Could not initialize gpio %d\n", pin);
- }
- } else {
- print_command_error();
- }
- } else if (strcmp(argv[1], "monitor") == 0) {
- if (argc == 3) {
- int pin = atoi(argv[2]);
- struct gpio_source gpio_info;
- gpio_info.pin = pin;
- if (gpio_isr_start(&gpio_info) == MRAA_SUCCESS) {
- fprintf(stdout, "Monitoring level changes to pin %d. Press RETURN to exit.\n", pin);
- gpio_isr_handler(&gpio_info);
- char aux = 0;
- do {
- fflush(stdin);
- fscanf(stdin, "%c", &aux);
- } while (aux != '\n');
- gpio_isr_stop(&gpio_info);
- } else {
- fprintf(stdout, "Failed to register ISR for pin %d\n", pin);
- }
- } else {
- print_command_error();
- }
- } else {
- print_command_error();
- }
- }
- return 0;
-}
diff --git a/peripheral/libmraa/examples/mraa-i2c.c b/peripheral/libmraa/examples/mraa-i2c.c
deleted file mode 100644
index e8a0494..0000000
--- a/peripheral/libmraa/examples/mraa-i2c.c
+++ /dev/null
@@ -1,284 +0,0 @@
-/*
- * Author: Henry Bruce <henry.bruce@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 <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include "mraa/i2c.h"
-
-#include "mraa_internal_types.h"
-
-extern mraa_board_t* plat;
-
-void
-print_version()
-{
- fprintf(stdout, "Version %s on %s", mraa_get_version(), mraa_get_platform_name());
- if (plat != NULL && plat->sub_platform != NULL)
- fprintf(stdout, " with %s", plat->sub_platform->platform_name);
- fprintf(stdout, "\n");
-}
-
-void
-print_help()
-{
- fprintf(stdout, "version Get mraa version and board name\n");
- fprintf(stdout, "list List available busses\n");
- fprintf(stdout, "detect bus List detected devices on specified bus\n");
- fprintf(stdout, "get bus device reg Get value from specified device register\n");
- fprintf(stdout, "set bus device reg value Set specified device register to value\n");
-}
-
-void
-print_command_error()
-{
- fprintf(stdout, "Invalid command, options are:\n");
- print_help();
-}
-
-void
-print_bus(mraa_board_t* board)
-{
- int i, bus;
- for (i = 0; i < board->i2c_bus_count; ++i) {
- char* busType;
- switch (board->platform_type) {
- case MRAA_INTEL_GALILEO_GEN1:
- case MRAA_INTEL_GALILEO_GEN2:
- case MRAA_INTEL_EDISON_FAB_C:
- case MRAA_INTEL_DE3815:
- case MRAA_INTEL_MINNOWBOARD_MAX:
- case MRAA_RASPBERRY_PI:
- case MRAA_BEAGLEBONE:
- case MRAA_BANANA:
- case MRAA_UP:
- bus = i;
- busType = "linux";
- break;
- case MRAA_FTDI_FT4222:
- busType = "ft4222";
- bus = mraa_get_sub_platform_id(i);
- break;
- default:
- busType = "unknown";
- break;
- }
- int id = board->i2c_bus[i].bus_id;
- fprintf(stdout, "Bus %3d: id=%02d type=%s ", bus, id, busType);
- if (i == board->def_i2c_bus)
- fprintf(stdout, " default");
- if (id == -1)
- fprintf(stdout, " disabled");
-
- fprintf(stdout, "\n");
- }
-}
-
-void
-print_busses()
-{
- print_bus(plat);
- if (mraa_has_sub_platform())
- print_bus(plat->sub_platform);
-}
-
-mraa_result_t
-i2c_get(int bus, uint8_t device_address, uint8_t register_address, uint8_t* data)
-{
- mraa_result_t status = MRAA_SUCCESS;
- mraa_i2c_context i2c = mraa_i2c_init(bus);
- if (i2c == NULL) {
- return MRAA_ERROR_NO_RESOURCES;
- }
- status = mraa_i2c_address(i2c, device_address);
- if (status != MRAA_SUCCESS) {
- goto i2c_get_exit;
- }
- status = mraa_i2c_write_byte(i2c, register_address);
- if (status != MRAA_SUCCESS) {
- goto i2c_get_exit;
- }
- status = mraa_i2c_read(i2c, data, 1) == 1 ? MRAA_SUCCESS : MRAA_ERROR_UNSPECIFIED;
- if (status != MRAA_SUCCESS) {
- goto i2c_get_exit;
- }
-i2c_get_exit:
- mraa_i2c_stop(i2c);
- return status;
-}
-
-mraa_result_t
-i2c_set(int bus, uint8_t device_address, uint8_t register_address, uint8_t data)
-{
- mraa_result_t status = MRAA_SUCCESS;
- mraa_i2c_context i2c = mraa_i2c_init(bus);
- if (i2c == NULL) {
- return MRAA_ERROR_NO_RESOURCES;
- }
- status = mraa_i2c_address(i2c, device_address);
- if (status != MRAA_SUCCESS) {
- fprintf(stderr, "Could not set i2c device address\n");
- goto i2c_set_exit;
- }
- status = mraa_i2c_write_byte_data(i2c, data, register_address);
- if (status != MRAA_SUCCESS) {
- fprintf(stderr, "Could not write to i2c register. Status = %d\n", status);
- goto i2c_set_exit;
- }
-i2c_set_exit:
- mraa_i2c_stop(i2c);
- return status;
-}
-
-void
-i2c_detect_devices(int bus)
-{
- mraa_result_t status = MRAA_SUCCESS;
- mraa_i2c_context i2c = mraa_i2c_init(bus);
- if (i2c == NULL) {
- return;
- }
- int addr;
- for (addr = 0x0; addr < 0x80; ++addr) {
- uint8_t value;
- if ((addr) % 16 == 0)
- printf("%02x: ", addr);
- if (i2c_get(bus, addr, 0, &value) == MRAA_SUCCESS)
- printf("%02x ", addr);
- else
- printf("-- ");
- if ((addr + 1) % 16 == 0)
- printf("\n");
- }
-}
-
-int
-process_command(int argc, char** argv)
-{
- int status = 0;
- if (strcmp(argv[1], "help") == 0) {
- print_help();
- return 0;
- } else if (strcmp(argv[1], "version") == 0) {
- print_version();
- return 0;
- } else if (strcmp(argv[1], "list") == 0) {
- print_busses();
- return 0;
- } else if (strcmp(argv[1], "detect") == 0) {
- if (argc == 3) {
- int bus = strtol(argv[2], NULL, 0);
- i2c_detect_devices(bus);
- return 0;
- } else {
- print_command_error();
- return 1;
- }
- } else if ((strcmp(argv[1], "get") == 0) || (strcmp(argv[1], "getrpt") == 0)) {
- if (argc == 5) {
- int interation = 0;
- mraa_boolean_t should_repeat = strcmp(argv[1], "getrpt") == 0;
- int bus = strtol(argv[2], NULL, 0);
- uint8_t device_address = strtol(argv[3], NULL, 0);
- uint8_t register_address = strtol(argv[4], NULL, 0);
- // fprintf(stdout, "Device %02X, Register = %02X\n", device_address, register_address);
- uint8_t data;
- do {
- if (i2c_get(bus, device_address, register_address, &data) == MRAA_SUCCESS) {
- if (should_repeat)
- fprintf(stdout, "%4d: ", interation);
- fprintf(stdout, "Register %#02X = %#02X\n", register_address, data);
- status = 0;
- } else {
- fprintf(stdout, "i2c get failed\n");
- status = 1;
- }
- interation++;
- usleep(10000);
- } while (should_repeat && status == 0);
- } else {
- print_command_error();
- status = 1;
- }
- return status;
- } else if ((strcmp(argv[1], "set") == 0)) {
- if (argc == 6) {
- int bus = strtol(argv[2], NULL, 0);
- uint8_t device_address = strtol(argv[3], NULL, 0);
- uint8_t register_address = strtol(argv[4], NULL, 0);
- uint8_t value = strtol(argv[5], NULL, 0);
- fprintf(stdout, "Device %02X, Register = %02X, Value = %02X\n", device_address,
- register_address, value);
- if (i2c_set(bus, device_address, register_address, value) != MRAA_SUCCESS) {
- fprintf(stdout, "i2c set failed\n");
- return 0;
- }
- return 1;
- } else {
- print_command_error();
- return 1;
- }
- } else {
- print_command_error();
- return 1;
- }
-}
-
-void
-run_interactive_mode()
-{
- char command[80];
- while (1) {
- int i, argc = 1;
- char* argv[32];
- char* arg;
- argv[0] = "mraa-i2c";
- fprintf(stdout, "Command: ");
- fgets(command, 80, stdin);
- command[strlen(command) - 1] = 0;
- if (strcmp(command, "q") == 0)
- return;
- char* str = strtok(command, " ");
- while (str != NULL) {
- arg = malloc(strlen(str) + 1);
- argv[argc++] = strcpy(arg, str);
- str = strtok(NULL, " ");
- }
- process_command(argc, argv);
- for (i = 1; i < argc; ++i)
- free(argv[i]);
- }
-}
-
-int
-main(int argc, char** argv)
-{
- mraa_set_log_level(7);
- if (argc == 1) {
- run_interactive_mode();
- return 0;
- } else
- return process_command(argc, argv);
-}
diff --git a/peripheral/libmraa/examples/python/aio.py b/peripheral/libmraa/examples/python/aio.py
deleted file mode 100644
index 7478e1b..0000000
--- a/peripheral/libmraa/examples/python/aio.py
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/usr/bin/env python
-
-# 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.
-
-import mraa
-
-print (mraa.getVersion())
-
-try:
- x = mraa.Aio(0)
- print (x.read())
- print ("%.5f" % x.readFloat())
-except:
- print ("Are you sure you have an ADC?")
diff --git a/peripheral/libmraa/examples/python/blink-io8.py b/peripheral/libmraa/examples/python/blink-io8.py
deleted file mode 100644
index 0e56ae9..0000000
--- a/peripheral/libmraa/examples/python/blink-io8.py
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/usr/bin/env python
-
-# 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.
-
-import mraa
-import time
-
-x = mraa.Gpio(8)
-x.dir(mraa.DIR_OUT)
-
-while True:
- x.write(1)
- time.sleep(0.2)
- x.write(0)
- time.sleep(0.2)
diff --git a/peripheral/libmraa/examples/python/bmp85.py b/peripheral/libmraa/examples/python/bmp85.py
deleted file mode 100644
index 9156744..0000000
--- a/peripheral/libmraa/examples/python/bmp85.py
+++ /dev/null
@@ -1,53 +0,0 @@
-#!/usr/bin/env python
-
-# 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
-
-import mraa as m
-
-# this example will show the 'advanced' i2c functionality from python i2c
-# read/write
-
-x = m.I2c(0)
-x.address(0x77)
-
-# initialise device
-if x.readReg(0xd0) != 0x55:
- print("error")
-
-# we want to read temperature so write 0x2e into control reg
-x.writeReg(0xf4, 0x2e)
-
-# read a 16bit reg, obviously it's uncalibrated so mostly a useless value :)
-print(str(x.readWordReg(0xf6)))
-
-# and we can do the same thing with the read()/write() calls if we wished
-# thought I'd really not recommend it!
-
-x.write(bytearray(b'0xf40x2e'))
-
-x.writeByte(0xf6)
-d = x.read(2)
-
-# WARNING: python 3.2+ call
-print(str(d))
-print(int.from_bytes(d, byteorder='little'))
diff --git a/peripheral/libmraa/examples/python/cycle-pwm3.py b/peripheral/libmraa/examples/python/cycle-pwm3.py
deleted file mode 100644
index 8f2b636..0000000
--- a/peripheral/libmraa/examples/python/cycle-pwm3.py
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/usr/bin/env python
-
-# 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.
-
-import mraa
-import time
-
-x = mraa.Pwm(3)
-x.period_us(700)
-x.enable(True)
-value= 0.0
-
-while True:
- x.write(value)
- time.sleep(0.05)
- value = value + 0.01
- if value >= 1:
- value = 0.0
diff --git a/peripheral/libmraa/examples/python/hello_gpio.py b/peripheral/libmraa/examples/python/hello_gpio.py
deleted file mode 100644
index 69ec0c7..0000000
--- a/peripheral/libmraa/examples/python/hello_gpio.py
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/usr/bin/env python
-
-# 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.
-
-import mraa
-
-print (mraa.getVersion())
-x = mraa.Gpio(13)
-x.dir(mraa.DIR_OUT)
-x.write(1)
diff --git a/peripheral/libmraa/examples/python/hello_isr.py b/peripheral/libmraa/examples/python/hello_isr.py
deleted file mode 100644
index cb02488..0000000
--- a/peripheral/libmraa/examples/python/hello_isr.py
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/usr/bin/env python
-
-# 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
-
-import mraa
-import time
-
-class Counter:
- count = 0
-
-c = Counter()
-
-# inside a python interupt you cannot use 'basic' types so you'll need to use
-# objects
-def test(args):
- print("wooo")
- c.count+=1
-
-x = mraa.Gpio(6)
-x.dir(mraa.DIR_IN)
-x.isr(mraa.EDGE_BOTH, test, test)
-
-time.sleep(500)
diff --git a/peripheral/libmraa/examples/python/rgblcd.py b/peripheral/libmraa/examples/python/rgblcd.py
deleted file mode 100644
index a686b2f..0000000
--- a/peripheral/libmraa/examples/python/rgblcd.py
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/usr/bin/env python
-
-# 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
-
-import mraa
-
-# This example will change the LCD backlight on the Grove-LCD RGB backlight
-# to a nice shade of purple
-x = mraa.I2c(0)
-x.address(0x62)
-
-# initialise device
-x.writeReg(0, 0)
-x.writeReg(1, 0)
-
-# sent RGB color data
-x.writeReg(0x08, 0xAA)
-x.writeReg(0x04, 255)
-x.writeReg(0x02, 255)
diff --git a/peripheral/libmraa/examples/python/spi.py b/peripheral/libmraa/examples/python/spi.py
deleted file mode 100644
index f8ee7ff..0000000
--- a/peripheral/libmraa/examples/python/spi.py
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/usr/bin/env python
-
-# 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
-
-import mraa as m
-import random as rand
-
-# Excuse the super boring example, I was out of fun devices to play with, this
-# will write and read the same data back to itself, a few 100 times, just short
-# MISO & MOSI on your board
-
-dev = m.Spi(0)
-
-for x in range(0,100):
- txbuf = bytearray(4)
- for y in range(0,4):
- txbuf[y] = rand.randrange(0, 256)
- rxbuf = dev.write(txbuf)
- if rxbuf != txbuf:
- print("We have an error captain!")
- break
- exit(1)
-
diff --git a/peripheral/libmraa/examples/python/uart_receiver.py b/peripheral/libmraa/examples/python/uart_receiver.py
deleted file mode 100644
index 950be32..0000000
--- a/peripheral/libmraa/examples/python/uart_receiver.py
+++ /dev/null
@@ -1,44 +0,0 @@
-#!/usr/bin/env python
-
-# Author: Alex Tereschenko <alext.mkrs@gmail.com>
-# Copyright (c) 2015 Alex Tereschenko
-#
-# 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
-
-import mraa
-
-# Initialize UART
-u=mraa.Uart(0)
-
-# Set UART parameters
-u.setBaudRate(115200)
-u.setMode(8, mraa.UART_PARITY_NONE, 1)
-u.setFlowcontrol(False, False)
-
-# Start a neverending loop waiting for data to arrive.
-# Press Ctrl+C to get out of it.
-while True:
- if u.dataAvailable():
- # We are doing 1-byte reads here
- data_byte = u.readStr(1)
- print(data_byte)
- # Just a two-way half-duplex communication example, "X" is a flag
- if data_byte == "X":
- u.writeStr("Yes, master!")
diff --git a/peripheral/libmraa/examples/python/uart_sender.py b/peripheral/libmraa/examples/python/uart_sender.py
deleted file mode 100644
index 4940a03..0000000
--- a/peripheral/libmraa/examples/python/uart_sender.py
+++ /dev/null
@@ -1,57 +0,0 @@
-#!/usr/bin/env python
-
-# Author: Alex Tereschenko <alext.mkrs@gmail.com>
-# Copyright (c) 2015 Alex Tereschenko
-#
-# 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
-
-import mraa
-import sys
-
-sys.stdout.write("Initializing UART...")
-u=mraa.Uart(0)
-print("...done")
-
-print("Setting UART parameters: baudrate 115200, 8N1, no flow control")
-u.setBaudRate(115200)
-u.setMode(8, mraa.UART_PARITY_NONE, 1)
-u.setFlowcontrol(False, False)
-
-msg_b = bytearray("Hello, mraa byte array!", "ascii")
-print("Sending message as a byte array: '{0}'".format(msg_b))
-u.write(msg_b)
-# Make sure the message gets out to the line.
-# It's generally unnecessary (and performance-degrading) to do this explicitly,
-# UART driver normally takes care of that, but it may be useful with specific
-# half-duplex endpoints, like Dynamixel servos.
-u.flush()
-
-msg_s = "Hello, mraa string!"
-print("Sending message as a string: '{0}'".format(msg_s))
-u.writeStr(msg_s)
-
-sys.stdout.write("Two-way, half-duplex communication, sending a flag...")
-u.writeStr("X")
-print("...sent, awaiting response...")
-# Checking for data in the RX buffer, giving it a 100ms timeout
-if u.dataAvailable(100):
- print("We've got a response: '{0}', says the other side".format(u.readStr(20)))
-else:
- print("No data received, do you have anything at the other end?")
diff --git a/peripheral/libmraa/examples/samples.mapping.txt b/peripheral/libmraa/examples/samples.mapping.txt
deleted file mode 100644
index 1f70e40..0000000
--- a/peripheral/libmraa/examples/samples.mapping.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-analogin_a0.c java/AioA0.java
-cycle-pwm3.c java/CyclePwm3.java
-gpio_read6.c java/GpioRead6.java
-helloedison.c java/HelloEdison.java
-hellomraa.c java/Example.java
-i2c_HMC5883L.c java/I2cCompass.java
-mmap-io2.c java/GpioMmapped.java
-spi_max7219.c java/SpiMAX7219.java
-spi_mcp4261.c java/SpiMCP4261.java
-uart.c java/UartExample.java
-AioA0.cpp java/AioA0.java
-Blink-IO.cpp java/BlinkIO.java
-I2c-compass.cpp java/I2cCompass.java
-Pwm3-cycle.cpp java/CyclePwm3.java
-Spi-pot.cpp java/SpiMCP4261.java
-Uart-example.cpp java/UartExample.java
diff --git a/peripheral/libmraa/examples/spi_max7219.c b/peripheral/libmraa/examples/spi_max7219.c
deleted file mode 100644
index 4c1ad06..0000000
--- a/peripheral/libmraa/examples/spi_max7219.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Author: Michael Ring <mail@michael-ring.org>
- * 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 "mraa.h"
-#include <unistd.h>
-#include <stdint.h>
-
-int
-main(int argc, char** argv)
-{
- //! [Interesting]
- mraa_spi_context spi;
- spi = mraa_spi_init(1);
- if (spi == NULL) {
- printf("Initialization of spi failed, check syslog for details, exit...\n");
- exit(1);
- }
-
- printf("SPI initialised successfully\n");
-
- mraa_spi_frequency(spi, 400000);
- mraa_spi_lsbmode(spi, 0);
-
- // The MAX7219/21 Chip needs the data in word size
- if (mraa_spi_bit_per_word(spi, 16) != MRAA_SUCCESS) {
- printf("Could not set SPI Device to 16Bit mode, exit...\n");
- exit(1);
- };
-
- mraa_spi_write_word(spi, 0x0900); // Do not decode bits
- mraa_spi_write_word(spi, 0x0a05); // Brightness of LEDs
- mraa_spi_write_word(spi, 0x0b07); // Show all Scan Lines
- mraa_spi_write_word(spi, 0x0c01); // Display on
- mraa_spi_write_word(spi, 0x0f00); // Testmode off
-
- // Display Pattern on the display
- uint16_t dataAA55[] = { 0x01aa, 0x0255, 0x03aa, 0x0455, 0x05aa, 0x0655, 0x07aa, 0x0855 };
- mraa_spi_write_buf_word(spi, dataAA55, 16);
-
- sleep(2);
-
- // Display inverted Pattern
- uint16_t data55AA[] = { 0x0155, 0x02aa, 0x0355, 0x04aa, 0x0555, 0x06aa, 0x0755, 0x08aa };
- mraa_spi_write_buf_word(spi, data55AA, 16);
-
- sleep(2);
-
- // Clear the display
- uint16_t data[] = { 0x0100, 0x0200, 0x0300, 0x0400, 0x0500, 0x0600, 0x0700, 0x0800 };
- mraa_spi_write_buf_word(spi, data, 16);
-
- int i;
- int j;
- // cycle through all LED's
- for (i = 1; i <= 8; i++) {
- for (j = 0; j < 8; j++) {
- mraa_spi_write_word(spi, (i << 8) + (1 << j));
- sleep(1);
- }
- mraa_spi_write_word(spi, i << 8);
- }
-
- mraa_spi_stop(spi);
-
- //! [Interesting]
-}
diff --git a/peripheral/libmraa/examples/spi_mcp4261.c b/peripheral/libmraa/examples/spi_mcp4261.c
deleted file mode 100644
index 1acd121..0000000
--- a/peripheral/libmraa/examples/spi_mcp4261.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include "mraa.h"
-#include <unistd.h>
-#include <stdint.h>
-
-int
-main(int argc, char** argv)
-{
- mraa_init();
- //! [Interesting]
- mraa_spi_context spi;
- spi = mraa_spi_init(0);
- unsigned int response = 0;
- printf("Hello, SPI initialised\n");
- uint8_t data[] = { 0x00, 100 };
- uint8_t* recv;
- while (1) {
- int i;
- for (i = 90; i < 130; i++) {
- data[1] = i;
- recv = mraa_spi_write_buf(spi, data, 2);
- printf("Writing -%i", i);
- printf("RECIVED-%i-%i\n", recv[0], recv[1]);
- usleep(100000);
- }
- for (i = 130; i > 90; i--) {
- data[1] = i;
- recv = mraa_spi_write_buf(spi, data, 2);
- printf("Writing -%i", i);
- printf("RECIVED-%i-%i\n", recv[0], recv[1]);
- usleep(100000);
- }
- }
- //! [Interesting]
-}
diff --git a/peripheral/libmraa/examples/uart.c b/peripheral/libmraa/examples/uart.c
deleted file mode 100644
index 51268aa..0000000
--- a/peripheral/libmraa/examples/uart.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
- * Author: Brendan Le Foll <brendan.le.foll@intel.com>
- * Copyright (c) 2014, 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include "stdio.h"
-//! [Interesting]
-#include "mraa.h"
-
-int
-main(int argc, char** argv)
-{
- mraa_uart_context uart;
- uart = mraa_uart_init(0);
-
- if (uart == NULL) {
- fprintf(stderr, "UART failed to setup\n");
- return EXIT_FAILURE;
- }
-
- char buffer[] = "Hello Mraa!";
- mraa_uart_write(uart, buffer, sizeof(buffer));
-
- mraa_uart_stop(uart);
-
- mraa_deinit();
-
- return EXIT_SUCCESS;
-}
-//! [Interesting]
diff --git a/peripheral/libmraa/include/arm/96boards.h b/peripheral/libmraa/include/arm/96boards.h
deleted file mode 100644
index 04d052b..0000000
--- a/peripheral/libmraa/include/arm/96boards.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Author: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
- * Copyright (c) 2015 Linaro Limited.
- * Copyright (c) 2014 Intel Corporation.
- *
- * Copied from include/arm/banana.h
- *
- * 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.
- */
-
-#pragma once
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "mraa_internal.h"
-
-#define MRAA_96BOARDS_LS_GPIO_COUNT 12
-#define MRAA_96BOARDS_LS_I2C_COUNT 2
-#define MRAA_96BOARDS_LS_SPI_COUNT 1
-#define MRAA_96BOARDS_LS_UART_COUNT 2
-#define MRAA_96BOARDS_LS_PIN_COUNT 40
-
-mraa_board_t* mraa_96boards();
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/peripheral/libmraa/include/arm/banana.h b/peripheral/libmraa/include/arm/banana.h
deleted file mode 100644
index 3c25cfa..0000000
--- a/peripheral/libmraa/include/arm/banana.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
- * Author: Michael Ring <mail@michael-ring.org>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#pragma once
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "mraa_internal.h"
-
-#define MRAA_BANANA_PI_PINCOUNT 35
-#define MRAA_BANANA_PRO_PINCOUNT 41
-
-mraa_board_t* mraa_banana();
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/peripheral/libmraa/include/arm/beaglebone.h b/peripheral/libmraa/include/arm/beaglebone.h
deleted file mode 100644
index edd3ae8..0000000
--- a/peripheral/libmraa/include/arm/beaglebone.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
- * Author: Michael Ring <mail@michael-ring.org>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#pragma once
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "mraa_internal.h"
-
-#define MRAA_BEAGLEBONE_BLACK_PINCOUNT 93
-
-mraa_board_t *
- mraa_beaglebone();
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/peripheral/libmraa/include/arm/raspberry_pi.h b/peripheral/libmraa/include/arm/raspberry_pi.h
deleted file mode 100644
index 32e3f50..0000000
--- a/peripheral/libmraa/include/arm/raspberry_pi.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
- * Author: Michael Ring <mail@michael-ring.org>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#pragma once
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "mraa_internal.h"
-
-#define MRAA_RASPBERRY_PI_B_REV_1_PINCOUNT 27
-#define MRAA_RASPBERRY_PI_AB_REV_2_PINCOUNT 35
-#define MRAA_RASPBERRY_PI2_B_REV_1_PINCOUNT 41
-#define MRAA_RASPBERRY_PI_AB_PLUS_PINCOUNT 41
-#define MRAA_RASPBERRY_PI_COMPUTE_MODULE_PINCOUNT 41
-
-mraa_board_t *
- mraa_raspberry_pi();
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/peripheral/libmraa/include/linux/README b/peripheral/libmraa/include/linux/README
deleted file mode 100644
index 8d0a432..0000000
--- a/peripheral/libmraa/include/linux/README
+++ /dev/null
@@ -1,5 +0,0 @@
-These headers was automatically generated from a Linux kernel header
-of the same name, to make information necessary for userspace to
-call into the kernel available to libc. It contains only constants,
-structures, and macros generated from the original header, and thus,
-contains no copyrightable information.
diff --git a/peripheral/libmraa/include/linux/compiler.h b/peripheral/libmraa/include/linux/compiler.h
deleted file mode 100644
index 8e89655..0000000
--- a/peripheral/libmraa/include/linux/compiler.h
+++ /dev/null
@@ -1,18 +0,0 @@
-#ifndef _UAPI_LINUX_COMPILER_H
-#define _UAPI_LINUX_COMPILER_H
-
-/*
- * This file is not currently in the Linux kernel tree.
- * Upstream uapi headers refer to <linux/compiler.h> but there is
- * no such uapi file. We've sent this upstream, and are optimistically
- * adding it to bionic in the meantime. This should be replaced by
- * a scrubbed header from external/kernel-headers when possible.
- *
- * An alternative to this file is to check in a symbolic link to the
- * non-uapi <linux/compiler.h>. That's fine for building bionic too.
- */
-
-#define __user
-#define __force
-
-#endif /* _UAPI_LINUX_COMPILER_H */
diff --git a/peripheral/libmraa/include/linux/i2c-dev.h b/peripheral/libmraa/include/linux/i2c-dev.h
deleted file mode 100644
index d35e393..0000000
--- a/peripheral/libmraa/include/linux/i2c-dev.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- *** This header was automatically generated from a Linux kernel header
- *** of the same name, to make information necessary for userspace to
- *** call into the kernel available to libc. It contains only constants,
- *** structures, and macros generated from the original header, and thus,
- *** contains no copyrightable information.
- ***
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _UAPI_LINUX_I2C_DEV_H
-#define _UAPI_LINUX_I2C_DEV_H
-#include <linux/types.h>
-#include "compiler.h"
-
-#define I2C_RETRIES 0x0701
-#define I2C_TIMEOUT 0x0702
-#define I2C_SLAVE 0x0703
-#define I2C_SLAVE_FORCE 0x0706
-
-#define I2C_TENBIT 0x0704
-#define I2C_FUNCS 0x0705
-#define I2C_RDWR 0x0707
-#define I2C_PEC 0x0708
-
-#define I2C_SMBUS 0x0720
-
-struct i2c_smbus_ioctl_data {
- char read_write;
- __u8 command;
- int size;
- union i2c_smbus_data __user *data;
-};
-struct i2c_rdwr_ioctl_data {
- struct i2c_msg __user *msgs;
- int nmsgs;
-};
-
-#define I2C_SMBUS_BLOCK_MAX 32
-#define I2C_SMBUS_I2C_BLOCK_MAX 32
-union i2c_smbus_data {
- __u8 byte;
- __u16 word;
- __u8 block[I2C_SMBUS_BLOCK_MAX + 2];
-};
-
-#define I2C_RDRW_IOCTL_MAX_MSGS 42
-
-struct i2c_msg {
- __u16 addr;
- unsigned short flags;
-#define I2C_M_TEN 0x10
-#define I2C_M_RD 0x01
-#define I2C_M_NOSTART 0x4000
-#define I2C_M_REV_DIR_ADDR 0x2000
-#define I2C_M_IGNORE_NAK 0x1000
-#define I2C_M_NO_RD_ACK 0x0800
- short len;
- char *buf;
-};
-
-#define I2C_NOCMD 0
-#define I2C_SMBUS_READ 1
-#define I2C_SMBUS_WRITE 0
-
-#define I2C_SMBUS_QUICK 0
-#define I2C_SMBUS_BYTE 1
-#define I2C_SMBUS_BYTE_DATA 2
-#define I2C_SMBUS_WORD_DATA 3
-#define I2C_SMBUS_PROC_CALL 4
-#define I2C_SMBUS_BLOCK_DATA 5
-#define I2C_SMBUS_I2C_BLOCK_BROKEN 6
-#define I2C_SMBUS_BLOCK_PROC_CALL 7
-#define I2C_SMBUS_I2C_BLOCK_DATA 8
-
-#define I2C_FUNC_I2C 0x00000001
-#define I2C_FUNC_10BIT_ADDR 0x00000002
-#define I2C_FUNC_PROTOCOL_MANGLING 0x00000004
-#define I2C_FUNC_SMBUS_PEC 0x00000008
-#define I2C_FUNC_SMBUS_BLOCK_PROC_CALL 0x00008000
-#define I2C_FUNC_SMBUS_QUICK 0x00010000
-#define I2C_FUNC_SMBUS_READ_BYTE 0x00020000
-#define I2C_FUNC_SMBUS_WRITE_BYTE 0x00040000
-#define I2C_FUNC_SMBUS_READ_BYTE_DATA 0x00080000
-#define I2C_FUNC_SMBUS_WRITE_BYTE_DATA 0x00100000
-#define I2C_FUNC_SMBUS_READ_WORD_DATA 0x00200000
-#define I2C_FUNC_SMBUS_WRITE_WORD_DATA 0x00400000
-#define I2C_FUNC_SMBUS_PROC_CALL 0x00800000
-#define I2C_FUNC_SMBUS_READ_BLOCK_DATA 0x01000000
-#define I2C_FUNC_SMBUS_WRITE_BLOCK_DATA 0x02000000
-#define I2C_FUNC_SMBUS_READ_I2C_BLOCK 0x04000000
-#define I2C_FUNC_SMBUS_WRITE_I2C_BLOCK 0x08000000
-
-#endif
diff --git a/peripheral/libmraa/include/linux/posix_types.h b/peripheral/libmraa/include/linux/posix_types.h
deleted file mode 100644
index 33b0fa2..0000000
--- a/peripheral/libmraa/include/linux/posix_types.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- *** This header was automatically generated from a Linux kernel header
- *** of the same name, to make information necessary for userspace to
- *** call into the kernel available to libc. It contains only constants,
- *** structures, and macros generated from the original header, and thus,
- *** contains no copyrightable information.
- ***
- *** To edit the content of this header, modify the corresponding
- *** source file (e.g. under external/kernel-headers/original/) then
- *** run bionic/libc/kernel/tools/update_all.py
- ***
- *** Any manual change here will be lost the next time this script will
- *** be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _LINUX_POSIX_TYPES_H
-#define _LINUX_POSIX_TYPES_H
-#undef __FD_SETSIZE
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define __FD_SETSIZE 1024
-typedef struct {
- unsigned long fds_bits[__FD_SETSIZE / (8 * sizeof(long))];
-} __kernel_fd_set;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-typedef void (*__kernel_sighandler_t)(int);
-typedef int __kernel_key_t;
-typedef int __kernel_mqd_t;
-#include <asm/posix_types.h>
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#endif
diff --git a/peripheral/libmraa/include/linux/types.h b/peripheral/libmraa/include/linux/types.h
deleted file mode 100644
index 4fdfe10..0000000
--- a/peripheral/libmraa/include/linux/types.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- *** This header was automatically generated from a Linux kernel header
- *** of the same name, to make information necessary for userspace to
- *** call into the kernel available to libc. It contains only constants,
- *** structures, and macros generated from the original header, and thus,
- *** contains no copyrightable information.
- ***
- *** To edit the content of this header, modify the corresponding
- *** source file (e.g. under external/kernel-headers/original/) then
- *** run bionic/libc/kernel/tools/update_all.py
- ***
- *** Any manual change here will be lost the next time this script will
- *** be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _UAPI_LINUX_TYPES_H
-#define _UAPI_LINUX_TYPES_H
-#include <asm/types.h>
-#ifndef __ASSEMBLY__
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#include <linux/posix_types.h>
-#define __bitwise__
-#define __bitwise
-typedef __u16 __bitwise __le16;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-typedef __u16 __bitwise __be16;
-typedef __u32 __bitwise __le32;
-typedef __u32 __bitwise __be32;
-typedef __u64 __bitwise __le64;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-typedef __u64 __bitwise __be64;
-typedef __u16 __bitwise __sum16;
-typedef __u32 __bitwise __wsum;
-#define __aligned_u64 __u64 __attribute__((aligned(8)))
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define __aligned_be64 __be64 __attribute__((aligned(8)))
-#define __aligned_le64 __le64 __attribute__((aligned(8)))
-#endif
-#endif
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/peripheral/libmraa/include/mraa_adv_func.h b/peripheral/libmraa/include/mraa_adv_func.h
deleted file mode 100644
index b33fc36..0000000
--- a/peripheral/libmraa/include/mraa_adv_func.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#pragma once
-
-#include "common.h"
-#include "mraa.h"
-#include "types.h"
-
-// FIXME: Nasty macro to test for presence of function in context structure function table
-#define IS_FUNC_DEFINED(dev, func) (dev != NULL && dev->advance_func != NULL && dev->advance_func->func != NULL)
-
-typedef struct {
- mraa_result_t (*gpio_init_internal_replace) (mraa_gpio_context dev, int pin);
- mraa_result_t (*gpio_init_pre) (int pin);
- mraa_result_t (*gpio_init_post) (mraa_gpio_context dev);
-
- mraa_result_t (*gpio_close_pre) (mraa_gpio_context dev);
-
- mraa_result_t (*gpio_mode_replace) (mraa_gpio_context dev, mraa_gpio_mode_t mode);
- mraa_result_t (*gpio_mode_pre) (mraa_gpio_context dev, mraa_gpio_mode_t mode);
- mraa_result_t (*gpio_mode_post) (mraa_gpio_context dev, mraa_gpio_mode_t mode);
-
- mraa_result_t (*gpio_edge_mode_replace) (mraa_gpio_context dev, mraa_gpio_edge_t mode);
-
- mraa_result_t (*gpio_dir_replace) (mraa_gpio_context dev, mraa_gpio_dir_t dir);
- mraa_result_t (*gpio_dir_pre) (mraa_gpio_context dev, mraa_gpio_dir_t dir);
- mraa_result_t (*gpio_dir_post) (mraa_gpio_context dev, mraa_gpio_dir_t dir);
-
- int (*gpio_read_replace) (mraa_gpio_context dev);
- mraa_result_t (*gpio_write_replace) (mraa_gpio_context dev, int value);
- mraa_result_t (*gpio_write_pre) (mraa_gpio_context dev, int value);
- mraa_result_t (*gpio_write_post) (mraa_gpio_context dev, int value);
- mraa_result_t (*gpio_mmap_setup) (mraa_gpio_context dev, mraa_boolean_t en);
- mraa_result_t (*gpio_interrupt_handler_init_replace) (mraa_gpio_context dev);
- mraa_result_t (*gpio_wait_interrupt_replace) (mraa_gpio_context dev);
-
- mraa_result_t (*i2c_init_pre) (unsigned int bus);
- mraa_result_t (*i2c_init_bus_replace) (mraa_i2c_context dev);
- mraa_i2c_context (*i2c_init_raw_replace) (unsigned int bus);
- mraa_result_t (*i2c_init_post) (mraa_i2c_context dev);
- mraa_result_t (*i2c_set_frequency_replace) (mraa_i2c_context dev, mraa_i2c_mode_t mode);
- mraa_result_t (*i2c_address_replace) (mraa_i2c_context dev, uint8_t addr);
- int (*i2c_read_replace) (mraa_i2c_context dev, uint8_t* data, int length);
- uint8_t (*i2c_read_byte_replace) (mraa_i2c_context dev);
- uint8_t (*i2c_read_byte_data_replace) (mraa_i2c_context dev, const uint8_t command);
- uint16_t (*i2c_read_word_data_replace) (mraa_i2c_context dev, const uint8_t command);
- int (*i2c_read_bytes_data_replace) (mraa_i2c_context dev, uint8_t command, uint8_t* data, int length);
- mraa_result_t (*i2c_write_replace) (mraa_i2c_context dev, const uint8_t* data, int length);
- mraa_result_t (*i2c_write_byte_replace) (mraa_i2c_context dev, uint8_t data);
- mraa_result_t (*i2c_write_byte_data_replace) (mraa_i2c_context dev, const uint8_t data, const uint8_t command);
- mraa_result_t (*i2c_write_word_data_replace) (mraa_i2c_context dev, const uint16_t data, const uint8_t command);
- mraa_result_t (*i2c_stop_replace) (mraa_i2c_context dev);
-
- mraa_result_t (*aio_get_valid_fp) (mraa_aio_context dev);
- mraa_result_t (*aio_init_pre) (unsigned int aio);
- mraa_result_t (*aio_init_post) (mraa_aio_context dev);
-
- mraa_pwm_context (*pwm_init_replace) (int pin);
- mraa_result_t (*pwm_init_pre) (int pin);
- mraa_result_t (*pwm_init_post) (mraa_pwm_context pwm);
- mraa_result_t (*pwm_period_replace) (mraa_pwm_context dev, int period);
-
- mraa_result_t (*spi_init_pre) (int bus);
- mraa_result_t (*spi_init_post) (mraa_spi_context spi);
- mraa_result_t (*spi_lsbmode_replace) (mraa_spi_context dev, mraa_boolean_t lsb);
-
- mraa_result_t (*uart_init_pre) (int index);
- mraa_result_t (*uart_init_post) (mraa_uart_context uart);
-} mraa_adv_func_t;
diff --git a/peripheral/libmraa/include/mraa_internal.h b/peripheral/libmraa/include/mraa_internal.h
deleted file mode 100644
index 428876d..0000000
--- a/peripheral/libmraa/include/mraa_internal.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#pragma once
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <syslog.h>
-#include <fnmatch.h>
-
-#include "common.h"
-#include "mraa_internal_types.h"
-#include "mraa_adv_func.h"
-
-extern mraa_board_t* plat;
-extern mraa_iio_info_t* plat_iio;
-
-/**
- * Takes in pin information and sets up the multiplexors.
- *
- * @param meta
- * @return mraa result type indicating success of actions.
- */
-mraa_result_t mraa_setup_mux_mapped(mraa_pin_t meta);
-
-/**
- * runtime detect running x86 platform
- *
- * @return mraa_platform_t of the init'ed platform
- */
-mraa_platform_t mraa_x86_platform();
-
-/**
- * runtime detect running arm platforms
- *
- * @return mraa_platform_t of the init'ed platform
- */
-mraa_platform_t mraa_arm_platform();
-
-/**
- * runtime detect running usb platform extender
- *
- * @return mraa_platform_t of the detected platform extender
- */
-mraa_platform_t mraa_usb_platform_extender(mraa_board_t* board);
-
-/**
- * runtime detect iio subsystem
- *
- * @return mraa_result_t indicating success of iio detection
- */
-mraa_result_t mraa_iio_detect();
-
-/**
- * helper function to check if file exists
- *
- * @param filename to check
- * @return mraa_boolean_t boolean result.
- */
-mraa_boolean_t mraa_file_exist(const char* filename);
-
-/**
- * helper function to unglob filenames
- *
- * @param filename to unglob
- * @return char * with the existing filename matching the pattern of input. NULL if there is no
- *match. Caller must free result
- */
-char* mraa_file_unglob(const char* filename);
-
-/**
- * helper function to check if file contains a given text
- *
- * @param filename to check
- * @param content to check in file
- * @return mraa_boolean_t boolean result.
- */
-mraa_boolean_t mraa_file_contains(const char* filename, const char* content);
-
-/**
- * helper function to check if file contains a given text
- *
- * @param filename to check
- * @param content to check in file
- * @param content2 to check in same line of file
- * @return mraa_boolean_t boolean result.
- */
-mraa_boolean_t mraa_file_contains_both(const char* filename, const char* content, const char* content2);
-
-/**
- * helper function to find out if file that is targeted by a softlink
- * (partially) matches the given name
- *
- * @param filename of the softlink
- * @param (partial) filename that is matched with the filename of the link-targeted file
- * @return mraa_boolean_t true when targetname (partially) matches
- */
-mraa_boolean_t mraa_link_targets(const char* filename, const char* targetname);
-
-/**
- * helper function to find the first i2c bus containing devname starting from
- * i2c-n where n is startfrom
- *
- * @param device name to match
- * @param i2c-dev number to start search from
- * @return the matching i2c-dev bus id or -1
- */
-int mraa_find_i2c_bus(const char* devname, int startfrom);
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/peripheral/libmraa/include/mraa_internal_types.h b/peripheral/libmraa/include/mraa_internal_types.h
deleted file mode 100644
index de91e7c..0000000
--- a/peripheral/libmraa/include/mraa_internal_types.h
+++ /dev/null
@@ -1,298 +0,0 @@
-/*
- * Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
- * 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.
- */
-
-#pragma once
-
-#include "common.h"
-#include "mraa.h"
-#include "mraa_adv_func.h"
-#include "iio.h"
-
-// Bionic does not implement pthread cancellation API
-#ifndef __BIONIC__
-#define HAVE_PTHREAD_CANCEL
-#endif
-
-// general status failures for internal functions
-#define MRAA_PLATFORM_NO_INIT -3
-#define MRAA_IO_SETUP_FAILURE -2
-#define MRAA_NO_SUCH_IO -1
-
-/**
- * A structure representing a gpio pin.
- */
-struct _gpio {
- /*@{*/
- int pin; /**< the pin number, as known to the os. */
- int phy_pin; /**< pin passed to clean init. -1 none and raw*/
- int value_fp; /**< the file pointer to the value of the gpio */
- void (* isr)(void *); /**< the interupt service request */
- void *isr_args; /**< args return when interupt service request triggered */
- pthread_t thread_id; /**< the isr handler thread id */
- int isr_value_fp; /**< the isr file pointer on the value */
-#ifndef HAVE_PTHREAD_CANCEL
- int isr_control_pipe[2]; /**< a pipe used to interrupt the isr from polling the value fd*/
-#endif
- mraa_boolean_t isr_thread_terminating; /**< is the isr thread being terminated? */
- mraa_boolean_t owner; /**< If this context originally exported the pin */
- mraa_result_t (*mmap_write) (mraa_gpio_context dev, int value);
- int (*mmap_read) (mraa_gpio_context dev);
- mraa_adv_func_t* advance_func; /**< override function table */
- /*@}*/
-};
-
-/**
- * A structure representing a I2C bus
- */
-struct _i2c {
- /*@{*/
- int busnum; /**< the bus number of the /dev/i2c-* device */
- int fh; /**< the file handle to the /dev/i2c-* device */
- int addr; /**< the address of the i2c slave */
- unsigned long funcs; /**< /dev/i2c-* device capabilities as per https://www.kernel.org/doc/Documentation/i2c/functionality */
- void *handle; /**< generic handle for non-standard drivers that don't use file descriptors */
- mraa_adv_func_t* advance_func; /**< override function table */
- /*@}*/
-};
-
-/**
- * A structure representing the SPI device
- */
-struct _spi {
- /*@{*/
- int devfd; /**< File descriptor to SPI Device */
- uint32_t mode; /**< Spi mode see spidev.h */
- int clock; /**< clock to run transactions at */
- mraa_boolean_t lsb; /**< least significant bit mode */
- unsigned int bpw; /**< Bits per word */
- mraa_adv_func_t* advance_func; /**< override function table */
- /*@}*/
-};
-
-/**
- * A structure representing a PWM pin
- */
-struct _pwm {
- /*@{*/
- int pin; /**< the pin number, as known to the os. */
- int chipid; /**< the chip id, which the pwm resides */
- int duty_fp; /**< File pointer to duty file */
- int period; /**< Cache the period to speed up setting duty */
- mraa_boolean_t owner; /**< Owner of pwm context*/
- mraa_adv_func_t* advance_func; /**< override function table */
- /*@}*/
-};
-
-/**
- * A structure representing a Analog Input Channel
- */
-struct _aio {
- /*@{*/
- unsigned int channel; /**< the channel as on board and ADC module */
- int adc_in_fp; /**< File Pointer to raw sysfs */
- int value_bit; /**< 10 bits by default. Can be increased if board */
- mraa_adv_func_t* advance_func; /**< override function table */
- /*@}*/
-};
-
-/**
- * A structure representing a UART device
- */
-struct _uart {
- /*@{*/
- int index; /**< the uart index, as known to the os. */
- const char* path; /**< the uart device path. */
- int fd; /**< file descriptor for device. */
- mraa_adv_func_t* advance_func; /**< override function table */
- /*@}*/
-};
-
-/**
- * A structure representing an IIO device
- */
-struct _iio {
- int num; /**< IIO device number */
- char* name; /**< IIO device name */
- int fp; /**< IIO device in /dev */
- int fp_event; /**< event file descriptor for IIO device */
- void (* isr)(char* data); /**< the interupt service request */
- void *isr_args; /**< args return when interupt service request triggered */
- void (* isr_event)(struct iio_event_data* data, void* args); /**< the event interupt service request */
- int chan_num;
- pthread_t thread_id; /**< the isr handler thread id */
- mraa_iio_channel* channels;
- int event_num;
- mraa_iio_event* events;
- int datasize;
-};
-
-/**
- * A bitfield representing the capabilities of a pin.
- */
-typedef struct {
- /*@{*/
- mraa_boolean_t valid:1; /**< Is the pin valid at all */
- mraa_boolean_t gpio:1; /**< Is the pin gpio capable */
- mraa_boolean_t pwm:1; /**< Is the pin pwm capable */
- mraa_boolean_t fast_gpio:1; /**< Is the pin fast gpio capable */
- mraa_boolean_t spi:1; /**< Is the pin spi capable */
- mraa_boolean_t i2c:1; /**< Is the pin i2c capable */
- mraa_boolean_t aio:1; /**< Is the pin analog input capable */
- mraa_boolean_t uart:1; /**< Is the pin uart capable */
- /*@}*/
-} mraa_pincapabilities_t;
-
-/**
- * A Structure representing a multiplexer and the required value
- */
-typedef struct {
- /*@{*/
- unsigned int pin; /**< Raw GPIO pin id */
- unsigned int value; /**< Raw GPIO value */
- /*@}*/
-} mraa_mux_t;
-
-typedef struct {
- mraa_boolean_t complex_pin:1;
- mraa_boolean_t output_en:1;
- mraa_boolean_t output_en_high:1;
- mraa_boolean_t pullup_en:1;
- mraa_boolean_t pullup_en_hiz:1;
-} mraa_pin_cap_complex_t;
-
-typedef struct {
- /*@{*/
- unsigned int pinmap; /**< sysfs pin */
- unsigned int parent_id; /** parent chip id */
- unsigned int mux_total; /** Numfer of muxes needed for operation of pin */
- mraa_mux_t mux[6]; /** Array holding information about mux */
- unsigned int output_enable; /** Output Enable GPIO, for level shifting */
- unsigned int pullup_enable; /** Pull-Up enable GPIO, inputs */
- mraa_pin_cap_complex_t complex_cap;
- /*@}*/
-} mraa_pin_t;
-
-typedef struct {
- /*@{*/
- char mem_dev[32]; /**< Memory device to use /dev/uio0 etc */
- unsigned int mem_sz; /** Size of memory to map */
- unsigned int bit_pos; /** Position of value bit */
- mraa_pin_t gpio; /** GPio context containing none mmap info */
- /*@}*/
-} mraa_mmap_pin_t;
-
-/**
- * A Structure representing a physical Pin.
- */
-typedef struct {
- /*@{*/
- char name[MRAA_PIN_NAME_SIZE]; /**< Pin's real world name */
- mraa_pincapabilities_t capabilites; /**< Pin Capabiliites */
- mraa_pin_t gpio; /**< GPIO structure */
- mraa_pin_t pwm; /**< PWM structure */
- mraa_pin_t aio; /**< Anaglog Pin */
- mraa_mmap_pin_t mmap; /**< GPIO through memory */
- mraa_pin_t i2c; /**< i2c bus/pin */
- mraa_pin_t spi; /**< spi bus/pin */
- mraa_pin_t uart; /**< uart module/pin */
- /*@}*/
-} mraa_pininfo_t;
-
-/**
- * A Structure representing the physical properties of a i2c bus.
- */
-typedef struct {
- /*@{*/
- unsigned int bus_id; /**< ID as exposed in the system */
- unsigned int scl; /**< i2c SCL */
- unsigned int sda; /**< i2c SDA */
- // mraa_drv_api_t drv_type; /**< Driver type */
- /*@}*/
-} mraa_i2c_bus_t;
-
-/**
- * A Structure representing the physical properties of a spi bus.
- */
-typedef struct {
- /*@{*/
- unsigned int bus_id; /**< The Bus ID as exposed to the system. */
- unsigned int slave_s; /**< Slave select */
- mraa_boolean_t three_wire; /**< Is the bus only a three wire system */
- unsigned int sclk; /**< Serial Clock */
- unsigned int mosi; /**< Master Out, Slave In. */
- unsigned int miso; /**< Master In, Slave Out. */
- unsigned int cs; /**< Chip Select, used when the board is a spi slave */
- /*@}*/
-} mraa_spi_bus_t;
-
-/**
- * A Structure representing a uart device.
- */
-typedef struct {
- /*@{*/
- unsigned int index; /**< ID as exposed in the system */
- int rx; /**< uart rx */
- int tx; /**< uart tx */
- const char* device_path; /**< To store "/dev/ttyS1" for example */
- /*@}*/
-} mraa_uart_dev_t;
-
-/**
- * A Structure representing a platform/board.
- */
-
-typedef struct _board_t {
- /*@{*/
- unsigned int phy_pin_count; /**< The Total IO pins on board */
- unsigned int gpio_count; /**< GPIO Count */
- unsigned int aio_count; /**< Analog side Count */
- unsigned int i2c_bus_count; /**< Usable i2c Count */
- mraa_i2c_bus_t i2c_bus[12]; /**< Array of i2c */
- unsigned int def_i2c_bus; /**< Position in array of default i2c bus */
- unsigned int spi_bus_count; /**< Usable spi Count */
- mraa_spi_bus_t spi_bus[12]; /**< Array of spi */
- unsigned int def_spi_bus; /**< Position in array of defult spi bus */
- unsigned int adc_raw; /**< ADC raw bit value */
- unsigned int adc_supported; /**< ADC supported bit value */
- unsigned int def_uart_dev; /**< Position in array of defult uart */
- unsigned int uart_dev_count; /**< Usable spi Count */
- mraa_uart_dev_t uart_dev[6]; /**< Array of UARTs */
- mraa_boolean_t no_bus_mux; /**< i2c/spi/adc/pwm/uart bus muxing setup not required */
- int pwm_default_period; /**< The default PWM period is US */
- int pwm_max_period; /**< Maximum period in us */
- int pwm_min_period; /**< Minimum period in us */
- mraa_platform_t platform_type; /**< Platform type */
- const char* platform_name; /**< Platform Name pointer */
- const char* platform_version; /**< Platform versioning info */
- mraa_pininfo_t* pins; /**< Pointer to pin array */
- mraa_adv_func_t* adv_func; /**< Pointer to advanced function disptach table */
- struct _board_t* sub_platform; /**< Pointer to sub platform */
- /*@}*/
-} mraa_board_t;
-
-typedef struct {
- struct _iio* iio_devices; /**< Pointer to IIO devices */
- uint8_t iio_device_count; /**< IIO device count */
-} mraa_iio_info_t;
diff --git a/peripheral/libmraa/include/usb/ftdi_ft4222.h b/peripheral/libmraa/include/usb/ftdi_ft4222.h
deleted file mode 100644
index f7db914..0000000
--- a/peripheral/libmraa/include/usb/ftdi_ft4222.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Author: Henry Bruce <henry.bruce@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.
- */
-
-#pragma once
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <dlfcn.h>
-#include "mraa_internal.h"
-
-mraa_result_t mraa_ftdi_ft4222_init();
-mraa_result_t mraa_ftdi_ft4222_get_version(unsigned int* versionChip, unsigned int* versionLib);
-mraa_board_t* mraa_ftdi_ft4222();
-void *libft4222_lib;
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/peripheral/libmraa/include/version.h b/peripheral/libmraa/include/version.h
deleted file mode 100644
index d60f189..0000000
--- a/peripheral/libmraa/include/version.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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.
- */
-
-#pragma once
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-const char* gVERSION;
-const char* gVERSION_SHORT;
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/peripheral/libmraa/include/x86/intel_cherryhills.h b/peripheral/libmraa/include/x86/intel_cherryhills.h
deleted file mode 100644
index 09bddcf..0000000
--- a/peripheral/libmraa/include/x86/intel_cherryhills.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Author: Karena Anum Kamaruzaman <karena.anum.kamaruzaman@intel.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.
- */
-
-#pragma once
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "mraa_internal.h"
-
-// +1 as pins are "1 indexed"
-#define MRAA_INTEL_CHERRYHILLS_PINCOUNT (5 + 1)
-
-mraa_board_t*
-mraa_intel_cherryhills();
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/peripheral/libmraa/include/x86/intel_de3815.h b/peripheral/libmraa/include/x86/intel_de3815.h
deleted file mode 100644
index cff4c0a..0000000
--- a/peripheral/libmraa/include/x86/intel_de3815.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#pragma once
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "mraa_internal.h"
-
-#define MRAA_INTEL_DE3815_PINCOUNT 18
-
-mraa_board_t*
-mraa_intel_de3815();
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/peripheral/libmraa/include/x86/intel_edison_fab_c.h b/peripheral/libmraa/include/x86/intel_edison_fab_c.h
deleted file mode 100644
index dc59576..0000000
--- a/peripheral/libmraa/include/x86/intel_edison_fab_c.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#pragma once
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "mraa_internal.h"
-
-#define MRAA_INTEL_EDISON_PINCOUNT 25
-
-mraa_board_t*
-mraa_intel_edison_fab_c();
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/peripheral/libmraa/include/x86/intel_galileo_rev_d.h b/peripheral/libmraa/include/x86/intel_galileo_rev_d.h
deleted file mode 100644
index 30391ff..0000000
--- a/peripheral/libmraa/include/x86/intel_galileo_rev_d.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#pragma once
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "mraa_internal.h"
-
-#define MRAA_INTEL_GALILEO_REV_D_PINCOUNT 25
-
-mraa_board_t*
-mraa_intel_galileo_rev_d();
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/peripheral/libmraa/include/x86/intel_galileo_rev_g.h b/peripheral/libmraa/include/x86/intel_galileo_rev_g.h
deleted file mode 100644
index e69175a..0000000
--- a/peripheral/libmraa/include/x86/intel_galileo_rev_g.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.
- */
-
-#pragma once
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "mraa_internal.h"
-
-#define MRAA_INTEL_GALILEO_GEN_2_PINCOUNT 25
-
-mraa_board_t*
-mraa_intel_galileo_gen2();
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/peripheral/libmraa/include/x86/intel_minnow_byt_compatible.h b/peripheral/libmraa/include/x86/intel_minnow_byt_compatible.h
deleted file mode 100644
index 4316df5..0000000
--- a/peripheral/libmraa/include/x86/intel_minnow_byt_compatible.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#pragma once
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "mraa_internal.h"
-
-// +1 as pins are "1 indexed"
-#define MRAA_INTEL_MINNOW_MAX_PINCOUNT (26 + 1)
-#define MRAA_INTEL_MINNOW_TURBOT_PINCOUNT (27 + 1)
-
-mraa_board_t*
-mraa_intel_minnowboard_byt_compatible(mraa_boolean_t);
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/peripheral/libmraa/include/x86/intel_nuc5.h b/peripheral/libmraa/include/x86/intel_nuc5.h
deleted file mode 100644
index d857099..0000000
--- a/peripheral/libmraa/include/x86/intel_nuc5.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Author: Brendan Le Foll <brendan.le.foll@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#pragma once
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "mraa_internal.h"
-
-#define MRAA_INTEL_NUC5_PINCOUNT 18
-
-mraa_board_t*
-mraa_intel_nuc5();
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/peripheral/libmraa/include/x86/intel_sofia_3gr.h b/peripheral/libmraa/include/x86/intel_sofia_3gr.h
deleted file mode 100644
index 163fdbb..0000000
--- a/peripheral/libmraa/include/x86/intel_sofia_3gr.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Author: Lay, Kuan Loon <kuan.loon.lay@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.
- */
-
-#pragma once
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "mraa_internal.h"
-
-#define MRAA_INTEL_SOFIA_3GR_PINCOUNT 8
-
-mraa_board_t* mraa_intel_sofia_3gr();
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/peripheral/libmraa/include/x86/up.h b/peripheral/libmraa/include/x86/up.h
deleted file mode 100644
index 9cf02e9..0000000
--- a/peripheral/libmraa/include/x86/up.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Author: Dan O'Donovan <dan@emutex.com>
- * Copyright (c) 2015 Emutex Ltd.
- * 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.
- */
-
-#pragma once
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "mraa_internal.h"
-
-// +1 as pins are "1 indexed"
-#define MRAA_UP_PINCOUNT (40 + 1)
-#define MRAA_UP_GPIOCOUNT (28)
-
-mraa_board_t*
-mraa_up_board();
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/peripheral/libmraa/src/CMakeLists.txt b/peripheral/libmraa/src/CMakeLists.txt
deleted file mode 100644
index a37b7f0..0000000
--- a/peripheral/libmraa/src/CMakeLists.txt
+++ /dev/null
@@ -1,200 +0,0 @@
-set (mraa_LIB_INCLUDE_DIRS
- ${PROJECT_SOURCE_DIR}/api
- ${PROJECT_SOURCE_DIR}/api/mraa
- ${PROJECT_SOURCE_DIR}/include
-)
-
-include_directories(
- ${mraa_LIB_INCLUDE_DIRS}
-)
-
-set (mraa_LIB_SRCS_NOAUTO
- ${PROJECT_SOURCE_DIR}/src/mraa.c
- ${PROJECT_SOURCE_DIR}/src/gpio/gpio.c
- ${PROJECT_SOURCE_DIR}/src/i2c/i2c.c
- ${PROJECT_SOURCE_DIR}/src/pwm/pwm.c
- ${PROJECT_SOURCE_DIR}/src/spi/spi.c
- ${PROJECT_SOURCE_DIR}/src/aio/aio.c
- ${PROJECT_SOURCE_DIR}/src/uart/uart.c
- ${PROJECT_SOURCE_DIR}/src/iio/iio.c
-)
-
-set (mraa_LIB_X86_SRCS_NOAUTO
- ${PROJECT_SOURCE_DIR}/src/x86/x86.c
- ${PROJECT_SOURCE_DIR}/src/x86/intel_galileo_rev_d.c
- ${PROJECT_SOURCE_DIR}/src/x86/intel_galileo_rev_g.c
- ${PROJECT_SOURCE_DIR}/src/x86/intel_edison_fab_c.c
- ${PROJECT_SOURCE_DIR}/src/x86/intel_de3815.c
- ${PROJECT_SOURCE_DIR}/src/x86/intel_nuc5.c
- ${PROJECT_SOURCE_DIR}/src/x86/intel_minnow_byt_compatible.c
- ${PROJECT_SOURCE_DIR}/src/x86/intel_sofia_3gr.c
- ${PROJECT_SOURCE_DIR}/src/x86/intel_cherryhills.c
- ${PROJECT_SOURCE_DIR}/src/x86/up.c
-)
-
-message (INFO " - Adding support for platform ${MRAAPLATFORMFORCE}")
-
-#keywords in if statements are case sensitive
-if (NOT ${MRAAPLATFORMFORCE} STREQUAL "ALL")
- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Dx${MRAAPLATFORMFORCE} -DMRAA_PLATFORM_FORCE=${MRAAPLATFORMFORCE}")
- if (${MRAAPLATFORMFORCE} STREQUAL "MRAA_INTEL_GALILEO_GEN2")
- set (mraa_LIB_X86_SRCS_NOAUTO ${PROJECT_SOURCE_DIR}/src/x86/x86.c ${PROJECT_SOURCE_DIR}/src/x86/intel_galileo_rev_g.c)
- elseif (${MRAAPLATFORMFORCE} STREQUAL "MRAA_INTEL_GALILEO_GEN1")
- set (mraa_LIB_X86_SRCS_NOAUTO ${PROJECT_SOURCE_DIR}/src/x86/x86.c ${PROJECT_SOURCE_DIR}/src/x86/intel_galileo_rev_d.c)
- elseif (${MRAAPLATFORMFORCE} STREQUAL "MRAA_INTEL_DE3815")
- set (mraa_LIB_X86_SRCS_NOAUTO ${PROJECT_SOURCE_DIR}/src/x86/x86.c ${PROJECT_SOURCE_DIR}/src/x86/intel_de3815.c)
- elseif (${MRAAPLATFORMFORCE} STREQUAL "MRAA_INTEL_EDISON_FAB_C")
- set (mraa_LIB_X86_SRCS_NOAUTO ${PROJECT_SOURCE_DIR}/src/x86/x86.c ${PROJECT_SOURCE_DIR}/src/x86/intel_edison_fab_c.c)
- elseif (${MRAAPLATFORMFORCE} STREQUAL "MRAA_INTEL_MINNOWBOARD_MAX")
- set (mraa_LIB_X86_SRCS_NOAUTO ${PROJECT_SOURCE_DIR}/src/x86/x86.c ${PROJECT_SOURCE_DIR}/src/x86/intel_minnow_byt_compatible.c)
- elseif (${MRAAPLATFORMFORCE} STREQUAL "MRAA_INTEL_NUC5")
- set (mraa_LIB_X86_SRCS_NOAUTO ${PROJECT_SOURCE_DIR}/src/x86/x86.c ${PROJECT_SOURCE_DIR}/src/x86/intel_nuc5.c)
- elseif (${MRAAPLATFORMFORCE} STREQUAL "MRAA_INTEL_SOFIA_3GR")
- set (mraa_LIB_X86_SRCS_NOAUTO ${PROJECT_SOURCE_DIR}/src/x86/x86.c ${PROJECT_SOURCE_DIR}/src/x86/intel_sofia_3gr.c)
- elseif (${MRAAPLATFORMFORCE} STREQUAL "MRAA_INTEL_CHERRYHILLS")
- set (mraa_LIB_X86_SRCS_NOAUTO ${PROJECT_SOURCE_DIR}/src/x86/x86.c ${PROJECT_SOURCE_DIR}/src/x86/intel_cherryhills.c)
- elseif (${MRAAPLATFORMFORCE} STREQUAL "MRAA_UP")
- set (mraa_LIB_X86_SRCS_NOAUTO ${PROJECT_SOURCE_DIR}/src/x86/x86.c ${PROJECT_SOURCE_DIR}/src/x86/up.c)
- else ()
- message (ERROR " - Unknown x86 platform enabled!")
- endif ()
-else ()
- message (INFO " - Adding support for all platforms")
-endif ()
-
-set (mraa_LIB_ARM_SRCS_NOAUTO
- ${PROJECT_SOURCE_DIR}/src/arm/arm.c
- ${PROJECT_SOURCE_DIR}/src/arm/96boards.c
- ${PROJECT_SOURCE_DIR}/src/arm/raspberry_pi.c
- ${PROJECT_SOURCE_DIR}/src/arm/beaglebone.c
- ${PROJECT_SOURCE_DIR}/src/arm/banana.c
-)
-
-set (mraa_LIBS ${CMAKE_THREAD_LIBS_INIT})
-
-if (X86PLAT)
- add_subdirectory(x86)
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DX86PLAT=1")
-endif()
-
-if (ARMPLAT)
- add_subdirectory(arm)
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DARMPLAT=1")
-endif()
-
-if (USBPLAT)
- message (INFO " - Adding USB platforms")
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSBPLAT=1")
- if (FTDID2xx)
- find_package (Ftd2xx)
- if (${LIBFTD2XX_FOUND})
- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DFTDID2XX=1")
- set (mraa_LIBS ${mraa_LIBS} ${LIBFTD2XX_LIBRARIES})
- else ()
- message (WARNING " - Enabled FTDID2xx support but library not found")
- endif ()
- endif ()
- if (FTDI4222)
- find_package (Ftd4222)
- if (${LIBFT4222_FOUND})
- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DFTDI4222=1")
- set (mraa_LIBS ${mraa_LIBS} dl)
- else ()
- message (WARNING " - Enabled FTDI4222 support but library not found")
- endif ()
- endif ()
- add_subdirectory(usb)
-endif ()
-
-set (mraa_LIB_SRCS
- ${mraa_LIB_PLAT_SRCS_NOAUTO}
-# autogenerated version file
- ${CMAKE_CURRENT_BINARY_DIR}/version.c
-)
-
-set (mraa_LIB_GLOB_HEADERS
- ${PROJECT_SOURCE_DIR}/api/mraa.h
- ${PROJECT_SOURCE_DIR}/api/mraa.hpp
-)
-
-add_library (mraa ${mraa_LIB_SRCS})
-
-
-target_link_libraries (mraa ${mraa_LIBS})
-
-set_target_properties(
- mraa
- PROPERTIES
- SOVERSION ${mraa_VERSION_MAJOR}
- VERSION ${mraa_VERSION_STRING}
-)
-install (FILES ${mraa_LIB_GLOB_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
-install (DIRECTORY ${PROJECT_SOURCE_DIR}/api/mraa/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/mraa)
-
-macro (mraa_CREATE_INSTALL_PKGCONFIG generated_file install_location)
- configure_file (${generated_file}.cmake ${CMAKE_CURRENT_BINARY_DIR}/${generated_file} @ONLY)
- install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${generated_file} DESTINATION ${install_location})
-endmacro (mraa_CREATE_INSTALL_PKGCONFIG)
-mraa_create_install_pkgconfig (mraa.pc ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
-
-install(TARGETS mraa DESTINATION ${CMAKE_INSTALL_LIBDIR})
-
-if (DOXYGEN_FOUND)
- set (CMAKE_SWIG_FLAGS -DDOXYGEN=${DOXYGEN_FOUND})
- set (DOCCLASSES aio gpio i2c pwm spi uart)
- # CPP class headers
- foreach (_file ${DOCCLASSES})
- add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_file}_class_doc.i
- COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/doxy2swig.py -n
- ${CMAKE_BINARY_DIR}/xml/classmraa_1_1_${_file}.xml
- ${CMAKE_CURRENT_BINARY_DIR}/${_file}_class_doc.i
- DEPENDS ${CMAKE_BINARY_DIR}/xml/classmraa_1_1_${_file}.xml
- )
- add_custom_target (${_file}class_doc_i DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${_file}_class_doc.i)
- add_dependencies (${_file}class_doc_i doc)
- endforeach ()
- # C header files
- set (DOCFILES common ${DOCCLASSES})
- foreach (_file ${DOCFILES})
- add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_file}_doc.i
- COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/doxy2swig.py -n
- ${CMAKE_BINARY_DIR}/xml/${_file}_8h.xml
- ${CMAKE_CURRENT_BINARY_DIR}/${_file}_doc.i
- DEPENDS ${CMAKE_BINARY_DIR}/xml/${_file}_8h.xml
- )
- add_custom_target (${_file}doc_i DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${_file}_doc.i)
- add_dependencies (${_file}doc_i doc)
- endforeach ()
- # CPP common header
- add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/common_hpp_doc.i
- COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/doxy2swig.py -n
- ${CMAKE_BINARY_DIR}/xml/common_8hpp.xml
- ${CMAKE_CURRENT_BINARY_DIR}//common_hpp_doc.i
- DEPENDS ${CMAKE_BINARY_DIR}/xml/common_8hpp.xml
- )
- add_custom_target (common_hpp_doc_i DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/common_hpp_doc.i)
- add_dependencies (common_hpp_doc_i doc)
-endif ()
-
-if (BUILDSWIG)
- enable_language(CXX)
- find_package (SWIG)
- if (SWIG_FOUND)
- include (${SWIG_USE_FILE})
- set_source_files_properties (mraa.i PROPERTIES SWIG_FLAGS "-I${CMAKE_BINARY_DIR}/src")
-
- if (BUILDSWIGPYTHON)
- add_subdirectory (python)
- endif ()
- if (BUILDSWIGJAVA)
- add_subdirectory (java)
- endif ()
- if (BUILDSWIGNODE)
- if (SWIG_VERSION VERSION_GREATER 3.0.4)
- add_subdirectory (javascript)
- else ()
- message ("WARN - SWIG is ${SWIG_VERSION}. Please upgrade to 3.0.5+ to build nodejs addon")
- endif ()
- endif ()
- endif ()
-endif ()
diff --git a/peripheral/libmraa/src/aio/aio.c b/peripheral/libmraa/src/aio/aio.c
deleted file mode 100644
index 13119a7..0000000
--- a/peripheral/libmraa/src/aio/aio.c
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * Author: Nandkishor Sonar
- * Author: Brendan Le Foll <brendan.le.foll@intel.com>
- * Copyright (c) 2014, 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <stdlib.h>
-#include <fcntl.h>
-#include <errno.h>
-
-#include "aio.h"
-#include "mraa_internal.h"
-
-#define DEFAULT_BITS 10
-
-static int raw_bits;
-
-static mraa_result_t
-aio_get_valid_fp(mraa_aio_context dev)
-{
- if (IS_FUNC_DEFINED(dev, aio_get_valid_fp)) {
- return dev->advance_func->aio_get_valid_fp(dev);
- }
-
- char file_path[64] = "";
-
- // Open file Analog device input channel raw voltage file for reading.
- snprintf(file_path, 64, "/sys/bus/iio/devices/iio:device0/in_voltage%d_raw", dev->channel);
-
- dev->adc_in_fp = open(file_path, O_RDONLY);
- if (dev->adc_in_fp == -1) {
- syslog(LOG_ERR, "aio: Failed to open input raw file %s for reading!", file_path);
- return MRAA_ERROR_INVALID_RESOURCE;
- }
-
- return MRAA_SUCCESS;
-}
-
-static mraa_aio_context
-mraa_aio_init_internal(mraa_adv_func_t* func_table)
-{
- mraa_aio_context dev = calloc(1, sizeof(struct _aio));
- if (dev == NULL) {
- return NULL;
- }
- dev->advance_func = func_table;
-
- return dev;
-}
-
-mraa_aio_context
-mraa_aio_init(unsigned int aio)
-{
- if (plat == NULL) {
- syslog(LOG_ERR, "aio: Platform not initialised");
- return NULL;
- }
- if (mraa_is_sub_platform_id(aio)) {
- syslog(LOG_NOTICE, "aio: Using sub platform is not supported");
- return NULL;
- }
-
- // Create ADC device connected to specified channel
- mraa_aio_context dev = mraa_aio_init_internal(plat->adv_func);
- if (dev == NULL) {
- syslog(LOG_ERR, "aio: Insufficient memory for specified input channel %d", aio);
- return NULL;
- }
- int pin = aio + plat->gpio_count;
- dev->channel = plat->pins[pin].aio.pinmap;
- dev->value_bit = DEFAULT_BITS;
-
- if (IS_FUNC_DEFINED(dev, aio_init_pre)) {
- mraa_result_t pre_ret = (dev->advance_func->aio_init_pre(aio));
- if (pre_ret != MRAA_SUCCESS) {
- free(dev);
- return NULL;
- }
- }
- if (aio > plat->aio_count) {
- syslog(LOG_ERR, "aio: requested channel out of range");
- free(dev);
- return NULL;
- }
-
- if (plat->pins[pin].capabilites.aio != 1) {
- syslog(LOG_ERR, "aio: pin uncapable of aio");
- free(dev);
- return NULL;
- }
-
- if (plat->pins[pin].aio.mux_total > 0) {
- if (mraa_setup_mux_mapped(plat->pins[pin].aio) != MRAA_SUCCESS) {
- free(dev);
- syslog(LOG_ERR, "aio: unable to setup multiplexers for pin");
- return NULL;
- }
- }
-
- // Open valid analog input file and get the pointer.
- if (MRAA_SUCCESS != aio_get_valid_fp(dev)) {
- free(dev);
- return NULL;
- }
- raw_bits = mraa_adc_raw_bits();
-
- if (IS_FUNC_DEFINED(dev, aio_init_post)) {
- mraa_result_t ret = dev->advance_func->aio_init_post(dev);
- if (ret != MRAA_SUCCESS) {
- free(dev);
- return NULL;
- }
- }
-
- return dev;
-}
-
-unsigned int
-mraa_aio_read(mraa_aio_context dev)
-{
- char buffer[17];
- unsigned int shifter_value = 0;
-
- if (dev->adc_in_fp == -1) {
- if (aio_get_valid_fp(dev) != MRAA_SUCCESS) {
- syslog(LOG_ERR, "aio: Failed to get to the device");
- return 0;
- }
- }
-
- lseek(dev->adc_in_fp, 0, SEEK_SET);
- if (read(dev->adc_in_fp, buffer, sizeof(buffer)) < 1) {
- syslog(LOG_ERR, "aio: Failed to read a sensible value");
- }
- // force NULL termination of string
- buffer[16] = '\0';
- lseek(dev->adc_in_fp, 0, SEEK_SET);
-
- errno = 0;
- char* end;
- unsigned int analog_value = (unsigned int) strtoul(buffer, &end, 10);
- if (end == &buffer[0]) {
- syslog(LOG_ERR, "aio: Value is not a decimal number");
- } else if (errno != 0) {
- syslog(LOG_ERR, "aio: Errno was set");
- }
-
- if (dev->value_bit != raw_bits) {
- /* Adjust the raw analog input reading to supported resolution value*/
- if (raw_bits > dev->value_bit) {
- shifter_value = raw_bits - dev->value_bit;
- analog_value = analog_value >> shifter_value;
- } else {
- shifter_value = dev->value_bit - raw_bits;
- analog_value = analog_value << shifter_value;
- }
- }
-
- return analog_value;
-}
-
-float
-mraa_aio_read_float(mraa_aio_context dev)
-{
- if (dev == NULL) {
- syslog(LOG_ERR, "aio: Device not valid");
- return 0.0;
- }
-
- float max_analog_value = (1 << dev->value_bit) - 1;
- unsigned int analog_value_int = mraa_aio_read(dev);
-
- return analog_value_int / max_analog_value;
-}
-
-mraa_result_t
-mraa_aio_close(mraa_aio_context dev)
-{
- if (NULL != dev) {
- if (dev->adc_in_fp != -1)
- close(dev->adc_in_fp);
- free(dev);
- }
-
- return (MRAA_SUCCESS);
-}
-
-mraa_result_t
-mraa_aio_set_bit(mraa_aio_context dev, int bits)
-{
- if (dev == NULL || bits < 1) {
- syslog(LOG_ERR, "aio: Device not valid");
- return MRAA_ERROR_INVALID_RESOURCE;
- }
- dev->value_bit = bits;
- return MRAA_SUCCESS;
-}
-
-int
-mraa_aio_get_bit(mraa_aio_context dev)
-{
- if (dev == NULL) {
- syslog(LOG_ERR, "aio: Device not valid");
- return 0;
- }
- return dev->value_bit;
-}
diff --git a/peripheral/libmraa/src/arm/96boards.c b/peripheral/libmraa/src/arm/96boards.c
deleted file mode 100644
index a23721f..0000000
--- a/peripheral/libmraa/src/arm/96boards.c
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * Author: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
- * Copyright (c) 2014 Intel Corporation.
- * Copyright (c) 2015 Linaro Limited.
- *
- * Copied from src/arm/banana.c
- *
- * 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 <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <sys/mman.h>
-#include <mraa/common.h>
-
-#include "common.h"
-#include "arm/96boards.h"
-
-#define DT_BASE "/sys/firmware/devicetree/base"
-
-#define PLATFORM_NAME_DB410C "DB410C"
-#define PLATFORM_NAME_HIKEY "HIKEY"
-
-int db410c_ls_gpio_pins[MRAA_96BOARDS_LS_GPIO_COUNT] = {
- 36, 12, 13, 69, 115, 4, 24, 25, 35, 34, 28, 33,
-};
-
-const char* db410c_serialdev[MRAA_96BOARDS_LS_UART_COUNT] = { "/dev/ttyMSM0", "/dev/ttyMSM1"};
-
-int hikey_ls_gpio_pins[MRAA_96BOARDS_LS_GPIO_COUNT] = {
- 488, 489, 490, 491, 492, 415, 463, 495, 426, 433, 427, 434,
-};
-
-const char* hikey_serialdev[MRAA_96BOARDS_LS_UART_COUNT] = { "/dev/ttyAMA2", "/dev/ttyAMA3"};
-
-void mraa_96boards_pininfo(mraa_board_t* board, int index, int sysfs_pin,
- char *fmt, ...)
-{
- va_list arg_ptr;
- if (index > board->phy_pin_count)
- return;
-
- mraa_pininfo_t* pininfo = &board->pins[index];
- va_start(arg_ptr, fmt);
- vsnprintf(pininfo->name, MRAA_PIN_NAME_SIZE, fmt, arg_ptr);
- va_end(arg_ptr);
- if (sysfs_pin >= 0)
- pininfo->capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- else
- pininfo->capabilites = (mraa_pincapabilities_t){ 0, 0, 0, 0, 0, 0, 0, 0 };
- pininfo->gpio.pinmap = sysfs_pin;
- pininfo->gpio.mux_total = 0;
-}
-
-mraa_board_t* mraa_96boards()
-{
- int i, pin;
- int *ls_gpio_pins = NULL;
- char ch;
-
- mraa_board_t* b = (mraa_board_t*) calloc(1, sizeof(mraa_board_t));
- if (b == NULL) {
- return NULL;
- }
-
- // pin mux for buses are setup by default by kernel so tell mraa to ignore them
- b->no_bus_mux = 1;
- b->phy_pin_count = MRAA_96BOARDS_LS_PIN_COUNT + 1;
-
- if (mraa_file_exist(DT_BASE "/model")) {
- // We are on a modern kernel, great!!!!
- if (mraa_file_contains(DT_BASE "/model", "Qualcomm Technologies, Inc. APQ 8016 SBC")) {
- b->platform_name = PLATFORM_NAME_DB410C;
- ls_gpio_pins = db410c_ls_gpio_pins;
- b->uart_dev[0].device_path = db410c_serialdev[0];
- b->uart_dev[1].device_path = db410c_serialdev[1];
- } else if (mraa_file_contains(DT_BASE "/model", "HiKey Development Board")) {
- b->platform_name = PLATFORM_NAME_HIKEY;
- ls_gpio_pins = hikey_ls_gpio_pins;
- b->uart_dev[0].device_path = hikey_serialdev[0];
- b->uart_dev[1].device_path = hikey_serialdev[1];
- }
- }
-
- //UART
- b->uart_dev_count = MRAA_96BOARDS_LS_UART_COUNT;
- b->def_uart_dev = 0;
-
- //I2C
- b->i2c_bus_count = MRAA_96BOARDS_LS_I2C_COUNT;
- b->def_i2c_bus = 0;
- b->i2c_bus[0].bus_id = 0;
- b->i2c_bus[1].bus_id= 1;
-
- //SPI
- b->spi_bus_count = MRAA_96BOARDS_LS_SPI_COUNT;
- b->spi_bus[0].bus_id = 0;
- b->def_spi_bus = 0;
-
- b->adv_func = (mraa_adv_func_t*) calloc(1, sizeof(mraa_adv_func_t));
- if (b->adv_func == NULL) {
- free(b);
- return NULL;
- }
-
- b->pins = (mraa_pininfo_t*) malloc(sizeof(mraa_pininfo_t) * b->phy_pin_count);
- if (b->pins == NULL) {
- free(b->adv_func);
- free(b);
- return NULL;
- }
-
- mraa_96boards_pininfo(b, 0, -1, "INVALID");
- mraa_96boards_pininfo(b, 1, -1, "GND");
- mraa_96boards_pininfo(b, 2, -1, "GND");
- mraa_96boards_pininfo(b, 3, -1, "UART0_CTS");
- mraa_96boards_pininfo(b, 4, -1, "PWR_BTN_N");
- mraa_96boards_pininfo(b, 5, -1, "UART0_TXD");
- mraa_96boards_pininfo(b, 6, -1, "RST_BTN_N");
- mraa_96boards_pininfo(b, 7, -1, "UART0_RXD");
- mraa_96boards_pininfo(b, 8, -1, "SPI0_SCLK");
- mraa_96boards_pininfo(b, 9, -1, "UART0_RTS");
- mraa_96boards_pininfo(b, 10, -1, "SPI0_DIN");
- mraa_96boards_pininfo(b, 11, -1, "UART1_TXD");
- mraa_96boards_pininfo(b, 12, -1, "SPI0_CS");
- mraa_96boards_pininfo(b, 13, -1, "UART1_RXD");
- mraa_96boards_pininfo(b, 14, -1, "SPI0_DOUT");
- mraa_96boards_pininfo(b, 15, -1, "I2C0_SCL");
- mraa_96boards_pininfo(b, 16, -1, "PCM_FS");
- mraa_96boards_pininfo(b, 17, -1, "I2C0_SDA");
- mraa_96boards_pininfo(b, 18, -1, "PCM_CLK");
- mraa_96boards_pininfo(b, 19, -1, "I2C1_SCL");
- mraa_96boards_pininfo(b, 20, -1, "PCM_DO");
- mraa_96boards_pininfo(b, 21, -1, "I2C1_SDA");
- mraa_96boards_pininfo(b, 22, -1, "PCM_DI");
- // GPIOs are labelled "GPIO-A" through "GPIO-L"
- for (i = 0; i < MRAA_96BOARDS_LS_GPIO_COUNT; i++)
- {
- mraa_96boards_pininfo(b, 23 + i, ls_gpio_pins ? ls_gpio_pins[i] : -1,
- "GPIO-%c", 'A'+i);
- }
- mraa_96boards_pininfo(b, 35, -1, "1.8v");
- mraa_96boards_pininfo(b, 36, -1, "SYS_DCIN");
- mraa_96boards_pininfo(b, 37, -1, "5v");
- mraa_96boards_pininfo(b, 38, -1, "SYS_DCIN");
- mraa_96boards_pininfo(b, 39, -1, "GND");
- mraa_96boards_pininfo(b, 40, -1, "GND");
-
- b->gpio_count = MRAA_96BOARDS_LS_GPIO_COUNT;
-
- b->aio_count = 0;
- b->adc_raw = 0;
- b->adc_supported = 0;
-
- return b;
-}
diff --git a/peripheral/libmraa/src/arm/CMakeLists.txt b/peripheral/libmraa/src/arm/CMakeLists.txt
deleted file mode 100644
index 4d3c247..0000000
--- a/peripheral/libmraa/src/arm/CMakeLists.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-message (INFO " - Adding ARM platforms")
-set (mraa_LIB_PLAT_SRCS_NOAUTO ${mraa_LIB_SRCS_NOAUTO}
- ${mraa_LIB_ARM_SRCS_NOAUTO} PARENT_SCOPE)
diff --git a/peripheral/libmraa/src/arm/arm.c b/peripheral/libmraa/src/arm/arm.c
deleted file mode 100644
index 768b77f..0000000
--- a/peripheral/libmraa/src/arm/arm.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
- * Author: Michael Ring <mail@michael-ring.org>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <stdlib.h>
-#include <string.h>
-
-#include "mraa_internal.h"
-#include "arm/raspberry_pi.h"
-#include "arm/beaglebone.h"
-#include "arm/banana.h"
-#include "arm/96boards.h"
-
-
-mraa_platform_t
-mraa_arm_platform()
-{
- mraa_platform_t platform_type = MRAA_UNKNOWN_PLATFORM;
- size_t len = 100;
- char* line = malloc(len);
- FILE* fh = fopen("/proc/cpuinfo", "r");
-
- if (fh != NULL) {
- while (getline(&line, &len, fh) != -1) {
- if (strncmp(line, "Hardware", 8) == 0) {
- if (strstr(line, "BCM2708")) {
- platform_type = MRAA_RASPBERRY_PI;
- }
- else if (strstr(line, "BCM2709")) {
- platform_type = MRAA_RASPBERRY_PI;
- }
- else if (strstr(line, "Generic AM33XX")) {
- platform_type = MRAA_BEAGLEBONE;
- }
- else if (strstr(line, "HiKey Development Board")) {
- platform_type = MRAA_96BOARDS;
- }
- else if (strstr(line, "sun7i")) {
- if (mraa_file_contains("/sys/firmware/devicetree/base/model", "Banana Pro")) {
- platform_type = MRAA_BANANA;
- }
- else if (mraa_file_contains("/sys/firmware/devicetree/base/model", "Banana Pi")) {
- platform_type = MRAA_BANANA;
- }
- // For old kernels
- else if (mraa_file_exist("/sys/class/leds/green:ph24:led1")) {
- platform_type = MRAA_BANANA;
- }
- }
- }
-
- }
- fclose(fh);
- }
- free(line);
-
- /* Get compatible string from Device tree for boards that dont have enough info in /proc/cpuinfo */
- if (platform_type == MRAA_UNKNOWN_PLATFORM) {
- if (mraa_file_contains("/sys/firmware/devicetree/base/compatible", "qcom,apq8016-sbc"))
- platform_type = MRAA_96BOARDS;
- else if (mraa_file_contains("/sys/firmware/devicetree/base/model", "HiKey Development Board"))
- platform_type = MRAA_96BOARDS;
- }
-
- switch (platform_type) {
- case MRAA_RASPBERRY_PI:
- plat = mraa_raspberry_pi();
- break;
- case MRAA_BEAGLEBONE:
- plat = mraa_beaglebone();
- break;
- case MRAA_BANANA:
- plat = mraa_banana();
- break;
- case MRAA_96BOARDS:
- plat = mraa_96boards();
- break;
- default:
- plat = NULL;
- syslog(LOG_ERR, "Unknown Platform, currently not supported by MRAA");
- }
- return platform_type;
-}
diff --git a/peripheral/libmraa/src/arm/banana.c b/peripheral/libmraa/src/arm/banana.c
deleted file mode 100644
index 72918d5..0000000
--- a/peripheral/libmraa/src/arm/banana.c
+++ /dev/null
@@ -1,592 +0,0 @@
-/*
- * Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
- * Author: Michael Ring <mail@michael-ring.org>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <sys/mman.h>
-#include <mraa/common.h>
-#include <mraa_internal_types.h>
-
-#include "common.h"
-#include "arm/banana.h"
-
-#define PLATFORM_NAME_BANANA_PI "Banana Pi"
-#define PLATFORM_BANANA_PI 1
-#define PLATFORM_NAME_BANANA_PRO "Banana Pro"
-#define PLATFORM_BANANA_PRO 2
-#define MMAP_PATH "/dev/mem"
-#define DT_BASE "/sys/firmware/devicetree/base"
-
-#define SUNXI_BASE (0x01C20000)
-#define SUNXI_BLOCK_SIZE (4 * 1024)
-#define SUNXI_GPIO_DAT 0x0810
-#define SUNXI_GPIO_PORT_OFFSET 0x0024
-#define MAX_SIZE 64
-
-// MMAP
-static uint8_t* mmap_reg = NULL;
-static int mmap_fd = 0;
-static int mmap_size;
-static unsigned int mmap_count = 0;
-static int platform_detected = 0;
-
-const char* serialdev[] = { "/dev/ttyS0", "/dev/ttyS1", "/dev/ttyS2", "/dev/ttyS3",
- "/dev/ttyS4", "/dev/ttyS5", "/dev/ttyS6", "/dev/ttyS7" };
-const char* seriallink[] = { "/sys/class/tty/ttyS0", "/sys/class/tty/ttyS1", "/sys/class/tty/ttyS2",
- "/sys/class/tty/ttyS3", "/sys/class/tty/ttyS4", "/sys/class/tty/ttyS5",
- "/sys/class/tty/ttyS6", "/sys/class/tty/ttyS7" };
-const char* i2clink[] = {
- "/sys/class/i2c-dev/i2c-0", "/sys/class/i2c-dev/i2c-1", "/sys/class/i2c-dev/i2c-2",
- "/sys/class/i2c-dev/i2c-3", "/sys/class/i2c-dev/i2c-4",
-};
-const char* spilink[] = { "/sys/class/spidev/spidev0.0",
- "/sys/class/spidev/spidev1.0",
- "/sys/class/spidev/spidev2.0",
- "/sys/class/spidev/spidev3.0" };
-
-mraa_result_t
-mraa_banana_spi_init_pre(int index)
-{
- char devpath[MAX_SIZE];
- sprintf(devpath, "/dev/spidev%u.0", plat->spi_bus[index].bus_id);
- if (!mraa_file_exist(devpath)) {
- syslog(LOG_INFO, "spi: trying modprobe for spi-sun4i");
- system("modprobe spi-sun4i >/dev/null 2>&1");
- syslog(LOG_INFO, "spi: trying modprobe for spidev");
- system("modprobe spidev >/dev/null 2>&1");
- }
- if (!mraa_file_exist(devpath)) {
- syslog(LOG_ERR, "spi: Device not initialized");
- syslog(LOG_ERR, "spi: If you run a kernel >=3.18 then most likely spi support does not yet "
- "fully work.");
- return MRAA_ERROR_NO_RESOURCES;
- }
- return MRAA_SUCCESS;
-}
-
-mraa_result_t
-mraa_banana_i2c_init_pre(unsigned int bus)
-{
- char devpath[MAX_SIZE];
- sprintf(devpath, "/dev/i2c-%u", bus);
- if (!mraa_file_exist(devpath)) {
- syslog(LOG_INFO, "i2c: trying modprobe for i2c-dev");
- system("modprobe i2c-dev >/dev/null 2>&1");
- }
- if (!mraa_file_exist(devpath)) {
- syslog(LOG_ERR, "i2c: Device not initialized");
- return MRAA_ERROR_NO_RESOURCES;
- }
- return MRAA_SUCCESS;
-}
-
-mraa_result_t
-mraa_banana_mmap_write(mraa_gpio_context dev, int value)
-{
- uint32_t readvalue =
- *(volatile uint32_t*) (mmap_reg + SUNXI_GPIO_DAT + (dev->pin / 32) * SUNXI_GPIO_PORT_OFFSET);
- volatile uint32_t* addr;
- if (value) {
- *(volatile uint32_t*) (mmap_reg + SUNXI_GPIO_DAT + (dev->pin / 32) * SUNXI_GPIO_PORT_OFFSET) =
- (uint32_t)((1 << (dev->pin % 32)) | readvalue);
- } else {
- *(volatile uint32_t*) (mmap_reg + SUNXI_GPIO_DAT + (dev->pin / 32) * SUNXI_GPIO_PORT_OFFSET) =
- (uint32_t)(~(1 << (dev->pin % 32)) & readvalue);
- }
- return MRAA_SUCCESS;
-}
-
-int
-mraa_banana_mmap_read(mraa_gpio_context dev)
-{
- uint32_t value =
- *(volatile uint32_t*) (mmap_reg + SUNXI_GPIO_DAT + (dev->pin / 32) * SUNXI_GPIO_PORT_OFFSET);
- if (value & (uint32_t)(1 << (dev->pin % 32))) {
- return 1;
- }
- return 0;
-}
-
-static mraa_result_t
-mraa_banana_mmap_unsetup()
-{
- if (mmap_reg == NULL) {
- syslog(LOG_ERR, "banana mmap: cannot unsetup NULLed mmap");
- return MRAA_ERROR_INVALID_RESOURCE;
- }
- munmap(mmap_reg, mmap_size);
- mmap_reg = NULL;
- if (close(mmap_fd) != 0) {
- return MRAA_ERROR_INVALID_RESOURCE;
- }
- return MRAA_SUCCESS;
-}
-
-mraa_result_t
-mraa_banana_mmap_setup(mraa_gpio_context dev, mraa_boolean_t en)
-{
- if (dev == NULL) {
- syslog(LOG_ERR, "Banana mmap: context not valid");
- return MRAA_ERROR_INVALID_HANDLE;
- }
-
- if (en == 0) {
- if (dev->mmap_write == NULL && dev->mmap_read == NULL) {
- syslog(LOG_ERR, "Banana mmap: can't disable disabled mmap gpio");
- return MRAA_ERROR_INVALID_PARAMETER;
- }
- dev->mmap_write = NULL;
- dev->mmap_read = NULL;
- mmap_count--;
- if (mmap_count == 0) {
- return mraa_banana_mmap_unsetup();
- }
- return MRAA_SUCCESS;
- }
-
- if (dev->mmap_write != NULL && dev->mmap_read != NULL) {
- syslog(LOG_ERR, "Banana mmap: can't enable enabled mmap gpio");
- return MRAA_ERROR_INVALID_PARAMETER;
- }
-
- // Might need to make some elements of this thread safe.
- // For example only allow one thread to enter the following block
- // to prevent mmap'ing twice.
- if (mmap_reg == NULL) {
- if ((mmap_fd = open(MMAP_PATH, O_RDWR)) < 0) {
- syslog(LOG_ERR, "Banana mmap: unable to open /dev/mem file");
- return MRAA_ERROR_INVALID_HANDLE;
- }
-
- mmap_reg = (uint8_t*) mmap(NULL, SUNXI_BLOCK_SIZE, PROT_READ | PROT_WRITE,
- MAP_FILE | MAP_SHARED, mmap_fd, SUNXI_BASE);
- if (mmap_reg == MAP_FAILED) {
- syslog(LOG_ERR, "Banana mmap: failed to mmap");
- mmap_reg = NULL;
- close(mmap_fd);
- return MRAA_ERROR_NO_RESOURCES;
- }
- }
- dev->mmap_write = &mraa_banana_mmap_write;
- dev->mmap_read = &mraa_banana_mmap_read;
- mmap_count++;
-
- return MRAA_SUCCESS;
-}
-
-mraa_board_t*
-mraa_banana()
-{
- mraa_board_t* b = (mraa_board_t*) calloc(1, sizeof(mraa_board_t));
- if (b == NULL) {
- return NULL;
- }
-
- platform_detected = 0;
- int i2c2 = -1;
- int spi0 = -1;
- int uart2 = -1;
- int uart3 = -1;
- int uart4 = -1;
- int uart7 = -1;
-
- if (mraa_file_exist(DT_BASE "/model")) {
- // We are on a modern kernel, great!!!!
- if (mraa_file_contains(DT_BASE "/model", "Banana Pro")) {
- b->platform_name = PLATFORM_NAME_BANANA_PRO;
- platform_detected = PLATFORM_BANANA_PRO;
- b->phy_pin_count = MRAA_BANANA_PRO_PINCOUNT;
- }
-
- if (mraa_file_contains(DT_BASE "/model", "Banana Pi")) {
- b->platform_name = PLATFORM_NAME_BANANA_PI;
- platform_detected = PLATFORM_BANANA_PI;
- b->phy_pin_count = MRAA_BANANA_PI_PINCOUNT;
- }
- if (mraa_file_contains(DT_BASE "/soc@01c00000/i2c@01c2b400/status", "okay")) {
- i2c2 = 1;
- }
- if (mraa_file_contains(DT_BASE "/soc@01c00000/spi@01c05000/status", "okay")) {
- spi0 = 1;
- }
- } else {
- if (mraa_file_exist("/sys/class/leds/green:ph24:led1")) {
- if (mraa_file_exist("/sys/class/leds/blue:pg02:led2")) {
- b->platform_name = PLATFORM_NAME_BANANA_PRO;
- platform_detected = PLATFORM_BANANA_PRO;
- b->phy_pin_count = MRAA_BANANA_PRO_PINCOUNT;
- } else {
- b->platform_name = PLATFORM_NAME_BANANA_PI;
- platform_detected = PLATFORM_BANANA_PI;
- b->phy_pin_count = MRAA_BANANA_PI_PINCOUNT;
- }
- if (mraa_file_exist("/sys/class/i2c-dev/i2c-2")) {
- i2c2 = 1;
- }
-
-
- if (mraa_file_exist("/sys/class/spi_master/spi0")) {
- spi0 = 1;
- }
- }
- }
-
- if (platform_detected == 0) {
- free(b);
- syslog(LOG_ERR, "mraa: Could not detect Banana Pi or Banana Pro");
- return NULL;
- }
-
- int devnum;
- for (devnum = 0; devnum < 8; devnum++) {
- if (mraa_link_targets(seriallink[devnum], "1c28800")) {
- uart2 = devnum;
- }
- if (mraa_link_targets(seriallink[devnum], "1c28c00")) {
- uart3 = devnum;
- }
- if (mraa_link_targets(seriallink[devnum], "1c29000")) {
- uart4 = devnum;
- }
- if (mraa_link_targets(seriallink[devnum], "1c29c00")) {
- uart7 = devnum;
- }
- }
-
- for (devnum = 0; devnum < 5; devnum++) {
- if (mraa_link_targets(i2clink[devnum], "1c2b400")) {
- i2c2 = devnum;
- }
- }
-
- for (devnum = 0; devnum < 4; devnum++) {
- if (mraa_link_targets(spilink[devnum], "1c05000")) {
- spi0 = devnum;
- }
- }
-
- b->adv_func = (mraa_adv_func_t*) calloc(1, sizeof(mraa_adv_func_t));
- if (b->adv_func == NULL) {
- free(b);
- return NULL;
- }
-
- b->pins = (mraa_pininfo_t*) calloc(b->phy_pin_count, sizeof(mraa_pininfo_t));
- if (b->pins == NULL) {
- free(b->adv_func);
- free(b);
- return NULL;
- }
-
- b->adv_func->spi_init_pre = &mraa_banana_spi_init_pre;
- b->adv_func->i2c_init_pre = &mraa_banana_i2c_init_pre;
- b->adv_func->gpio_mmap_setup = &mraa_banana_mmap_setup;
-
- strncpy(b->pins[0].name, "INVALID", MRAA_PIN_NAME_SIZE);
- b->pins[0].capabilites = (mraa_pincapabilities_t){ 0, 0, 0, 0, 0, 0, 0, 0 };
-
- strncpy(b->pins[1].name, "3V3", MRAA_PIN_NAME_SIZE);
- b->pins[1].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
-
- strncpy(b->pins[2].name, "5V", MRAA_PIN_NAME_SIZE);
- b->pins[2].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
-
- if (i2c2 == 1) {
- strncpy(b->pins[3].name, "TWI2-SDA", MRAA_PIN_NAME_SIZE); // PB21 Pin53 TWI2-SDA
- b->pins[3].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 1, 0, 0 };
- } else {
- strncpy(b->pins[3].name, "PB21", MRAA_PIN_NAME_SIZE); // PB21 Pin53 TWI2-SDA
- b->pins[3].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- }
- b->pins[3].gpio.pinmap = 53;
-
- strncpy(b->pins[4].name, "5V", MRAA_PIN_NAME_SIZE);
- b->pins[4].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
-
- if (i2c2 == 1) {
- strncpy(b->pins[5].name, "TWI2-SCK", MRAA_PIN_NAME_SIZE); // PB20 Pin52 TWI2-SCK
- b->pins[5].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 1, 0, 0 };
- } else {
- strncpy(b->pins[5].name, "PB20", MRAA_PIN_NAME_SIZE); // PB20 Pin52 TWI2-SCK
- b->pins[5].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- }
- b->pins[5].gpio.pinmap = 52;
-
- strncpy(b->pins[6].name, "GND", MRAA_PIN_NAME_SIZE);
- b->pins[6].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
-
- if (platform_detected == PLATFORM_BANANA_PRO) {
- strncpy(b->pins[7].name, "PH02", MRAA_PIN_NAME_SIZE); // PH2 Pin226
- b->pins[7].gpio.pinmap = 226;
- } else {
- strncpy(b->pins[7].name, "PI03", MRAA_PIN_NAME_SIZE); // PI3 Pin259 PWM
- b->pins[7].gpio.pinmap = 259;
- }
- b->pins[7].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
-
- if (platform_detected == PLATFORM_BANANA_PRO) {
- strncpy(b->pins[8].name, "UART4_TX", MRAA_PIN_NAME_SIZE); // PH4 Pin228 UART4_TX
- b->pins[8].gpio.pinmap = 228;
- } else {
- strncpy(b->pins[8].name, "UART3_TX", MRAA_PIN_NAME_SIZE); // PH0 Pin224 UART3_TX
- b->pins[8].gpio.pinmap = 224;
- }
- b->pins[8].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 1 };
-
- strncpy(b->pins[9].name, "GND", MRAA_PIN_NAME_SIZE);
- b->pins[9].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
-
- if (platform_detected == PLATFORM_BANANA_PRO) {
- strncpy(b->pins[10].name, "UART4_RX", MRAA_PIN_NAME_SIZE); // PH5 Pin229 UART4_RX
- b->pins[10].gpio.pinmap = 229;
- } else {
- strncpy(b->pins[10].name, "UART3_RX", MRAA_PIN_NAME_SIZE); // PH1 Pin225 UART3_RX
- b->pins[10].gpio.pinmap = 225;
- }
- b->pins[10].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 1 };
-
- strncpy(b->pins[11].name, "PI19", MRAA_PIN_NAME_SIZE); // PI19 Pin275 IO+UART2_RX
- b->pins[11].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 1 };
- b->pins[11].gpio.pinmap = 275;
-
- if (platform_detected == PLATFORM_BANANA_PRO) {
- strncpy(b->pins[12].name, "PI03", MRAA_PIN_NAME_SIZE); // PI3 Pin259 PWM
- b->pins[12].gpio.pinmap = 259;
- } else {
- strncpy(b->pins[12].name, "PH02", MRAA_PIN_NAME_SIZE); // PH2 Pin226
- b->pins[12].gpio.pinmap = 226;
- }
- b->pins[12].capabilites = (mraa_pincapabilities_t){ 1, 1, 1, 0, 0, 0, 0, 0 };
-
- strncpy(b->pins[13].name, "PI18", MRAA_PIN_NAME_SIZE); // PI18 Pin274 UART2_TX
- b->pins[13].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 1 };
- b->pins[13].gpio.pinmap = 274;
-
- strncpy(b->pins[14].name, "GND", MRAA_PIN_NAME_SIZE);
- b->pins[14].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
-
- strncpy(b->pins[15].name, "PI17", MRAA_PIN_NAME_SIZE); // PI17 Pin273 UART2_CTS
- b->pins[15].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[15].gpio.pinmap = 273;
-
- strncpy(b->pins[16].name, "PH20", MRAA_PIN_NAME_SIZE); // PH20 Pin 244 CAN_TX
- b->pins[16].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[16].gpio.pinmap = 244;
-
- strncpy(b->pins[17].name, "3V3", MRAA_PIN_NAME_SIZE);
- b->pins[17].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
-
- strncpy(b->pins[18].name, "PH21", MRAA_PIN_NAME_SIZE); // PH21 Pin245 CAN_RX
- b->pins[18].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[18].gpio.pinmap = 245;
-
- strncpy(b->pins[19].name, "SPI0MOSI", MRAA_PIN_NAME_SIZE); // PI12 SPI0
- b->pins[19].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 1, 0, 0, 0 };
- b->pins[19].gpio.pinmap = 268;
-
- strncpy(b->pins[20].name, "GND", MRAA_PIN_NAME_SIZE);
- b->pins[20].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
-
- strncpy(b->pins[21].name, "SPI0MISO", MRAA_PIN_NAME_SIZE); // PI13 SPI0
- b->pins[21].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 1, 0, 0, 0 };
- b->pins[21].gpio.pinmap = 269;
-
- strncpy(b->pins[22].name, "PI16", MRAA_PIN_NAME_SIZE); // PI16 UART2_RTS
- b->pins[22].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 1 };
- b->pins[22].gpio.pinmap = 272;
-
- strncpy(b->pins[23].name, "SPI0CLK", MRAA_PIN_NAME_SIZE); // PI11 SPI0
- b->pins[23].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 1, 0, 0, 0 };
- b->pins[23].gpio.pinmap = 267;
-
- strncpy(b->pins[24].name, "SPI0CS0", MRAA_PIN_NAME_SIZE); // PI10 SPI0
- b->pins[24].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 1, 0, 0, 0 };
- b->pins[24].gpio.pinmap = 266;
-
- strncpy(b->pins[25].name, "GND", MRAA_PIN_NAME_SIZE);
- b->pins[25].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
-
- strncpy(b->pins[26].name, "SPI0CS1", MRAA_PIN_NAME_SIZE); // PI14 SPI0
- b->pins[26].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 1, 0, 0, 0 };
- b->pins[26].gpio.pinmap = 270;
-
- if (platform_detected == PLATFORM_BANANA_PI) {
- strncpy(b->pins[27].name, "5V", MRAA_PIN_NAME_SIZE);
- b->pins[27].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
-
- strncpy(b->pins[28].name, "3V3", MRAA_PIN_NAME_SIZE);
- b->pins[28].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
-
- strncpy(b->pins[29].name, "PH05", MRAA_PIN_NAME_SIZE); // PH5
- b->pins[29].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[29].gpio.pinmap = 229;
-
- strncpy(b->pins[30].name, "PI21", MRAA_PIN_NAME_SIZE); // PI21 UART7_RX
- b->pins[30].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 1 };
- b->pins[30].gpio.pinmap = 277;
-
- strncpy(b->pins[31].name, "PH03", MRAA_PIN_NAME_SIZE); // PH3
- b->pins[31].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[31].gpio.pinmap = 227;
-
- strncpy(b->pins[32].name, "PI20", MRAA_PIN_NAME_SIZE); // PI20 UART7_TX
- b->pins[32].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 1 };
- b->pins[32].gpio.pinmap = 276;
-
- strncpy(b->pins[33].name, "GND", MRAA_PIN_NAME_SIZE);
- b->pins[33].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
-
- strncpy(b->pins[34].name, "GND", MRAA_PIN_NAME_SIZE);
- b->pins[34].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- }
-
- if (platform_detected == PLATFORM_BANANA_PRO) {
-
- strncpy(b->pins[27].name, "HAT_SDA", MRAA_PIN_NAME_SIZE); // PI1 TWI3-SDA i2c3
- b->pins[27].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- b->pins[27].gpio.pinmap = 257;
-
- strncpy(b->pins[28].name, "HAT_SCK", MRAA_PIN_NAME_SIZE); // PI0 TWI3-SCK i2c3
- b->pins[28].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- b->pins[28].gpio.pinmap = 256;
-
- strncpy(b->pins[29].name, "PB03", MRAA_PIN_NAME_SIZE); // PB3 IR0_TX/SPDIF_MCLK
- b->pins[29].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[29].gpio.pinmap = 35;
-
- strncpy(b->pins[30].name, "GND", MRAA_PIN_NAME_SIZE);
- b->pins[30].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
-
- strncpy(b->pins[31].name, "PI21", MRAA_PIN_NAME_SIZE); // PI21 UART7_RX
- b->pins[31].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 1 };
- b->pins[31].gpio.pinmap = 277;
-
- strncpy(b->pins[32].name, "PI20", MRAA_PIN_NAME_SIZE); // PI20 UART7_TX
- b->pins[32].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 1 };
- b->pins[32].gpio.pinmap = 276;
-
- strncpy(b->pins[33].name, "PB13", MRAA_PIN_NAME_SIZE); // PB13 SPDIF_D0
- b->pins[33].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[33].gpio.pinmap = 45;
-
- strncpy(b->pins[34].name, "GND", MRAA_PIN_NAME_SIZE);
- b->pins[34].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
-
- strncpy(b->pins[35].name, "PB07", MRAA_PIN_NAME_SIZE); // PB07 I2S0_LRCK
- b->pins[35].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[35].gpio.pinmap = 39;
-
- strncpy(b->pins[36].name, "PB06", MRAA_PIN_NAME_SIZE); // PB06 I2S0BCLK
- b->pins[36].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[36].gpio.pinmap = 38;
-
- strncpy(b->pins[37].name, "PB05", MRAA_PIN_NAME_SIZE); // PB05 I2S0MCK
- b->pins[37].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[37].gpio.pinmap = 37;
-
- strncpy(b->pins[38].name, "PB12", MRAA_PIN_NAME_SIZE); // PB12 I2S0_DI
- b->pins[38].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[38].gpio.pinmap = 44;
-
- strncpy(b->pins[39].name, "GND", MRAA_PIN_NAME_SIZE);
- b->pins[39].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
-
- strncpy(b->pins[40].name, "PB08", MRAA_PIN_NAME_SIZE); // PB08 I2S0_DO0
- b->pins[40].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[40].gpio.pinmap = 40;
- }
-
- b->aio_count = 0;
- b->adc_raw = 0;
- b->adc_supported = 0;
- b->pwm_default_period = 500;
- b->pwm_max_period = 2147483;
- b->pwm_min_period = 1;
-
- b->gpio_count = 0;
- int i;
- for (i = 0; i < b->phy_pin_count; i++) {
- if (b->pins[i].capabilites.gpio) {
- b->gpio_count++;
- }
- }
-
- // BUS DEFINITIONS
- b->i2c_bus_count = 0;
- b->def_i2c_bus = 0;
- if (i2c2 >= 0) {
- b->i2c_bus[b->i2c_bus_count].bus_id = i2c2;
- b->i2c_bus[b->i2c_bus_count].sda = 3;
- b->i2c_bus[b->i2c_bus_count].scl = 5;
- b->i2c_bus_count++;
- }
-
- b->spi_bus_count = 0;
- b->def_spi_bus = 0;
- if (spi0 >= 0) {
- b->spi_bus[b->spi_bus_count].bus_id = spi0;
- b->spi_bus[b->spi_bus_count].slave_s = 0;
- b->spi_bus[b->spi_bus_count].cs = 24;
- b->spi_bus[b->spi_bus_count].mosi = 19;
- b->spi_bus[b->spi_bus_count].miso = 21;
- b->spi_bus[b->spi_bus_count].sclk = 23;
- b->spi_bus_count++;
- }
-
- b->uart_dev_count = 0;
- b->def_uart_dev = 0;
- if ((uart3 >= 0) && (platform_detected == PLATFORM_BANANA_PI)) {
- b->def_uart_dev = b->uart_dev_count;
- b->uart_dev[b->uart_dev_count].device_path = serialdev[uart3];
- b->uart_dev[b->uart_dev_count].rx = 11;
- b->uart_dev[b->uart_dev_count].tx = 13;
- b->uart_dev_count++;
- }
- if ((uart4 >= 0) && (platform_detected == PLATFORM_BANANA_PRO)) {
- b->def_uart_dev = b->uart_dev_count;
- b->uart_dev[b->uart_dev_count].device_path = serialdev[uart4];
- b->uart_dev[b->uart_dev_count].rx = 10;
- b->uart_dev[b->uart_dev_count].tx = 8;
- b->uart_dev_count++;
- }
- if (uart7 >= 0) {
- b->uart_dev[b->uart_dev_count].device_path = serialdev[uart7];
- if (platform_detected == PLATFORM_BANANA_PRO) {
- b->uart_dev[b->uart_dev_count].rx = 31;
- b->uart_dev[b->uart_dev_count].tx = 32;
- } else {
- b->uart_dev[b->uart_dev_count].rx = 30;
- b->uart_dev[b->uart_dev_count].tx = 32;
- }
- b->uart_dev_count++;
- }
- if (uart2 >= 0) {
- b->uart_dev[b->uart_dev_count].device_path = serialdev[uart2];
- b->uart_dev[b->uart_dev_count].rx = 11;
- b->uart_dev[b->uart_dev_count].tx = 13;
- b->uart_dev_count++;
- }
- return b;
-}
diff --git a/peripheral/libmraa/src/arm/beaglebone.c b/peripheral/libmraa/src/arm/beaglebone.c
deleted file mode 100644
index 34652d8..0000000
--- a/peripheral/libmraa/src/arm/beaglebone.c
+++ /dev/null
@@ -1,1432 +0,0 @@
-/*
- * Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
- * Author: Michael Ring <mail@michael-ring.org>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <sys/mman.h>
-#include <mraa/types.h>
-
-#include "common.h"
-#include "arm/beaglebone.h"
-
-#define NUM2STR(x) #x
-
-#define PLATFORM_NAME_BEAGLEBONE_BLACK_REV_B "Beaglebone Black Rev. B"
-#define PLATFORM_NAME_BEAGLEBONE_BLACK_REV_C "Beaglebone Black Rev. C"
-
-#define SYSFS_DEVICES_CAPEMGR_SLOTS "/sys/devices/bone_capemgr.*/slots"
-#define SYSFS_CLASS_PWM "/sys/class/pwm/"
-#define SYSFS_CLASS_MMC "/sys/class/mmc_host/"
-#define SYSFS_PWM_OVERLAY "am33xx_pwm"
-#define UART_OVERLAY(x) "ADAFRUIT-UART" NUM2STR(x)
-//#define ADAFRUIT_SPI_OVERLAY "ADAFRUIT-SPI%d"
-#define SPI_OVERLAY(x) "BB-SPI" NUM2STR(x) "-01"
-#define I2C_OVERLAY(x) "ADAFRUIT-I2C" NUM2STR(x)
-#define MAX_SIZE 64
-
-#define MMAP_PATH "/dev/mem"
-#define AM335X_GPIO0_BASE 0x44e07000
-#define AM335X_GPIO1_BASE 0x4804c000
-#define AM335X_GPIO2_BASE 0x481AC000
-#define AM335X_GPIO3_BASE 0x481AE000
-#define AM335X_GPIO_SIZE (4 * 1024)
-#define AM335X_IN 0x138
-#define AM335X_CLR 0x190
-#define AM335X_SET 0x194
-
-// MMAP
-static uint8_t* mmap_gpio[4] = { NULL, NULL, NULL, NULL };
-static int mmap_fd = 0;
-static unsigned int mmap_count = 0;
-
-mraa_result_t
-mraa_beaglebone_mmap_write(mraa_gpio_context dev, int value)
-{
- volatile uint32_t* addr;
- if (value) {
- *(volatile uint32_t*) (mmap_gpio[dev->pin / 32] + AM335X_SET) = (uint32_t)(1 << (dev->pin % 32));
- } else {
- *(volatile uint32_t*) (mmap_gpio[dev->pin / 32] + AM335X_CLR) = (uint32_t)(1 << (dev->pin % 32));
- }
- return MRAA_SUCCESS;
-}
-
-static mraa_result_t
-mraa_beaglebone_mmap_unsetup()
-{
- if (mmap_gpio[0] == NULL) {
- syslog(LOG_ERR, "beaglebone mmap: null register cant unsetup");
- return MRAA_ERROR_INVALID_RESOURCE;
- }
- munmap(mmap_gpio[0], AM335X_GPIO_SIZE);
- mmap_gpio[0] = NULL;
- munmap(mmap_gpio[1], AM335X_GPIO_SIZE);
- mmap_gpio[1] = NULL;
- munmap(mmap_gpio[2], AM335X_GPIO_SIZE);
- mmap_gpio[2] = NULL;
- munmap(mmap_gpio[3], AM335X_GPIO_SIZE);
- mmap_gpio[3] = NULL;
- if (close(mmap_fd) != 0) {
- return MRAA_ERROR_INVALID_RESOURCE;
- }
- return MRAA_SUCCESS;
-}
-
-int
-mraa_beaglebone_mmap_read(mraa_gpio_context dev)
-{
- uint32_t value = *(volatile uint32_t*) (mmap_gpio[dev->pin / 32] + AM335X_IN);
- if (value & (uint32_t)(1 << (dev->pin % 32))) {
- return 1;
- }
- return 0;
-}
-
-mraa_result_t
-mraa_beaglebone_mmap_setup(mraa_gpio_context dev, mraa_boolean_t en)
-{
- if (dev == NULL) {
- syslog(LOG_ERR, "beaglebone mmap: context not valid");
- return MRAA_ERROR_INVALID_HANDLE;
- }
-
- if (en == 0) {
- if (dev->mmap_write == NULL && dev->mmap_read == NULL) {
- syslog(LOG_ERR, "beaglebone mmap: can't disable disabled mmap gpio");
- return MRAA_ERROR_INVALID_PARAMETER;
- }
- dev->mmap_write = NULL;
- dev->mmap_read = NULL;
- mmap_count--;
- if (mmap_count == 0) {
- return mraa_beaglebone_mmap_unsetup();
- }
- return MRAA_SUCCESS;
- }
-
- if (dev->mmap_write != NULL && dev->mmap_read != NULL) {
- syslog(LOG_ERR, "beaglebone mmap: can't enable enabled mmap gpio");
- return MRAA_ERROR_INVALID_PARAMETER;
- }
-
- // Might need to make some elements of this thread safe.
- // For example only allow one thread to enter the following block
- // to prevent mmap'ing twice.
- if (mmap_gpio[0] == NULL) {
- if ((mmap_fd = open(MMAP_PATH, O_RDWR)) < 0) {
- syslog(LOG_ERR, "beaglebone map: unable to open resource0 file");
- return MRAA_ERROR_INVALID_HANDLE;
- }
-
- mmap_gpio[0] = (uint8_t*) mmap(NULL, AM335X_GPIO_SIZE, PROT_READ | PROT_WRITE,
- MAP_FILE | MAP_SHARED, mmap_fd, AM335X_GPIO0_BASE);
- if (mmap_gpio[0] == MAP_FAILED) {
- syslog(LOG_ERR, "beaglebone mmap: failed to mmap");
- mmap_gpio[0] = NULL;
- close(mmap_fd);
- return MRAA_ERROR_NO_RESOURCES;
- }
- mmap_gpio[1] = (uint8_t*) mmap(NULL, AM335X_GPIO_SIZE, PROT_READ | PROT_WRITE,
- MAP_FILE | MAP_SHARED, mmap_fd, AM335X_GPIO1_BASE);
- if (mmap_gpio[1] == MAP_FAILED) {
- syslog(LOG_ERR, "beaglebone mmap: failed to mmap");
- mmap_gpio[1] = NULL;
- close(mmap_fd);
- return MRAA_ERROR_NO_RESOURCES;
- }
- mmap_gpio[2] = (uint8_t*) mmap(NULL, AM335X_GPIO_SIZE, PROT_READ | PROT_WRITE,
- MAP_FILE | MAP_SHARED, mmap_fd, AM335X_GPIO2_BASE);
- if (mmap_gpio[2] == MAP_FAILED) {
- syslog(LOG_ERR, "beaglebone mmap: failed to mmap");
- mmap_gpio[2] = NULL;
- close(mmap_fd);
- return MRAA_ERROR_NO_RESOURCES;
- }
- mmap_gpio[3] = (uint8_t*) mmap(NULL, AM335X_GPIO_SIZE, PROT_READ | PROT_WRITE,
- MAP_FILE | MAP_SHARED, mmap_fd, AM335X_GPIO3_BASE);
- if (mmap_gpio[3] == MAP_FAILED) {
- syslog(LOG_ERR, "beaglebone mmap: failed to mmap");
- mmap_gpio[3] = NULL;
- close(mmap_fd);
- return MRAA_ERROR_NO_RESOURCES;
- }
- }
- dev->mmap_write = &mraa_beaglebone_mmap_write;
- dev->mmap_read = &mraa_beaglebone_mmap_read;
- mmap_count++;
-
- return MRAA_SUCCESS;
-}
-
-mraa_result_t
-mraa_beaglebone_uart_init_pre(int index)
-{
- mraa_result_t ret = MRAA_ERROR_NO_RESOURCES;
- char devpath[MAX_SIZE];
- char overlay[MAX_SIZE];
- char* capepath = NULL;
- sprintf(devpath, "/dev/ttyO%u", index + 1);
- if (!mraa_file_exist(devpath)) {
- capepath = mraa_file_unglob(SYSFS_DEVICES_CAPEMGR_SLOTS);
- if (capepath == NULL) {
- syslog(LOG_ERR, "uart: Could not find CapeManager");
- return ret;
- }
- FILE* fh;
- fh = fopen(capepath, "w");
- free(capepath);
- if (fh == NULL) {
- syslog(LOG_ERR, "uart: Failed to open capepath for writing, check access rights for user");
- return ret;
- }
- if (fprintf(fh, UART_OVERLAY(index + 1)) < 0) {
- syslog(LOG_ERR, "uart: Failed to write to CapeManager");
- }
- fclose(fh);
- }
- if (mraa_file_exist(devpath))
- ret = MRAA_SUCCESS;
- else
- syslog(LOG_ERR, "uart: Device not initialized");
- return ret;
-}
-
-mraa_result_t
-mraa_beaglebone_spi_init_pre(int index)
-{
- mraa_result_t ret = MRAA_ERROR_NO_RESOURCES;
- char devpath[MAX_SIZE];
- char overlay[MAX_SIZE];
- char* capepath = NULL;
- int deviceindex = 0;
-
- // The first initialized SPI devices always gets the bus id 1
- // So we need to track down correct mapping and adjust the bus_id field
- if ((index == 0) && mraa_link_targets("/sys/class/spidev/spidev1.0", "48030000"))
- deviceindex = 1;
- if ((index == 0) && mraa_link_targets("/sys/class/spidev/spidev2.0", "48030000"))
- deviceindex = 2;
- if ((index == 1) && mraa_link_targets("/sys/class/spidev/spidev1.0", "481a0000"))
- deviceindex = 1;
- if ((index == 1) && mraa_link_targets("/sys/class/spidev/spidev2.0", "481a0000"))
- deviceindex = 2;
- if ((deviceindex == 0) && mraa_file_exist("/sys/class/spidev/spidev1.0"))
- deviceindex = 2;
- if (deviceindex == 0)
- deviceindex = 1;
-
- sprintf(devpath, "/dev/spidev%u.0", deviceindex);
- if (!mraa_file_exist(devpath)) {
- capepath = mraa_file_unglob(SYSFS_DEVICES_CAPEMGR_SLOTS);
- if (capepath == NULL) {
- syslog(LOG_ERR, "spi: Could not find CapeManager");
- return ret;
- }
- FILE* fh;
- fh = fopen(capepath, "w");
- free(capepath);
- if (fh == NULL) {
- syslog(LOG_ERR, "spi: Failed to open capepath for writing, check access rights for user");
- return ret;
- }
- if (fprintf(fh, SPI_OVERLAY(index)) < 0) {
- syslog(LOG_ERR,
- "spi: Failed to write to CapeManager, check that /lib/firmware/%s exists",
- SPI_OVERLAY(index));
- }
- fclose(fh);
- }
- if (mraa_file_exist(devpath)) {
- plat->spi_bus[index].bus_id = deviceindex;
- ret = MRAA_SUCCESS;
- } else {
- syslog(LOG_ERR, "spi: Device not initialized, check that /lib/firmware/%s exists", SPI_OVERLAY(index));
- syslog(LOG_ERR, "spi: Check http://elinux.org/BeagleBone_Black_Enable_SPIDEV for details");
- }
- return ret;
-}
-
-mraa_result_t
-mraa_beaglebone_i2c_init_pre(unsigned int bus)
-{
- mraa_result_t ret = MRAA_ERROR_NO_RESOURCES;
- char devpath[MAX_SIZE];
- char overlay[MAX_SIZE];
- char* capepath = NULL;
- sprintf(devpath, "/dev/i2c-%u", plat->i2c_bus[bus].bus_id);
- if (!mraa_file_exist(devpath)) {
- capepath = mraa_file_unglob(SYSFS_DEVICES_CAPEMGR_SLOTS);
- if (capepath == NULL) {
- syslog(LOG_ERR, "i2c: Could not find CapeManager");
- return ret;
- }
- FILE* fh;
- fh = fopen(capepath, "w");
- free(capepath);
- if (fh == NULL) {
- syslog(LOG_ERR, "i2c: Failed to open capepath for writing, check access rights for user");
- return ret;
- }
- if (fprintf(fh, "ADAFRUIT-I2C%d", bus) < 0) {
- syslog(LOG_ERR,
- "i2c: Failed to write to CapeManager, check that /lib/firmware/%s exists",
- I2C_OVERLAY(index));
- }
- fclose(fh);
- }
- if (mraa_file_exist(devpath))
- ret = MRAA_SUCCESS;
- else {
- syslog(LOG_ERR,
- "i2c: Device not initialized, check that /lib/firmware/%s exists",
- I2C_OVERLAY(index));
- }
- return ret;
-}
-
-mraa_pwm_context
-mraa_beaglebone_pwm_init_replace(int pin)
-{
- char devpath[MAX_SIZE];
- char overlay[MAX_SIZE];
- char* capepath = NULL;
- if (plat == NULL) {
- syslog(LOG_ERR, "pwm: Platform Not Initialised");
- return NULL;
- }
- if (plat->pins[pin].capabilites.pwm != 1) {
- syslog(LOG_ERR, "pwm: pin not capable of pwm");
- return NULL;
- }
- if (!mraa_file_exist(SYSFS_CLASS_PWM "pwmchip0")) {
- FILE* fh;
- capepath = mraa_file_unglob(SYSFS_DEVICES_CAPEMGR_SLOTS);
- if (capepath == NULL) {
- syslog(LOG_ERR, "pwm: Could not find CapeManager");
- return NULL;
- }
- fh = fopen(capepath, "w");
- free(capepath);
- if (fh == NULL) {
- syslog(LOG_ERR, "pwm: Failed to open %s for writing, check access rights for user");
- return NULL;
- }
- if (fprintf(fh, SYSFS_PWM_OVERLAY) < 0) {
- syslog(LOG_ERR,
- "pwm: Failed to write to CapeManager, check that /lib/firmware/%s exists", SYSFS_PWM_OVERLAY);
- }
- fclose(fh);
- }
-
- sprintf(devpath, SYSFS_CLASS_PWM "pwm%u", plat->pins[pin].pwm.pinmap);
- if (!mraa_file_exist(devpath)) {
- FILE* fh;
- fh = fopen(SYSFS_CLASS_PWM "export", "w");
- if (fh == NULL) {
- syslog(LOG_ERR, "pwm: Failed to open /sys/class/pwm/export for writing, check access "
- "rights for user");
- return NULL;
- }
- if (fprintf(fh, "%d", plat->pins[pin].pwm.pinmap) < 0) {
- syslog(LOG_ERR, "pwm: Failed to write to CapeManager");
- }
- fclose(fh);
- }
-
- if (mraa_file_exist(devpath)) {
- mraa_pwm_context dev = (mraa_pwm_context) calloc(1, sizeof(struct _pwm));
- if (dev == NULL)
- return NULL;
- dev->duty_fp = -1;
- dev->chipid = -1;
- dev->pin = plat->pins[pin].pwm.pinmap;
- dev->period = -1;
- return dev;
- } else
- syslog(LOG_ERR, "pwm: pin not initialized, check that /lib/firmware/%s exists", SYSFS_PWM_OVERLAY);
- return NULL;
-}
-
-mraa_board_t*
-mraa_beaglebone()
-{
- unsigned int emmc_enabled = 1;
- unsigned int hdmi_enabled = 1;
- unsigned int i2c0_enabled = 1;
- unsigned int i2c1_enabled = 1;
- unsigned int spi0_enabled = 0;
- unsigned int spi1_enabled = 0;
- unsigned int uart1_enabled = 0;
- unsigned int uart2_enabled = 0;
- unsigned int uart3_enabled = 0;
- unsigned int uart4_enabled = 0;
- unsigned int uart5_enabled = 0;
- unsigned int ehrpwm0a_enabled = 0;
- unsigned int ehrpwm0b_enabled = 0;
- unsigned int ehrpwm1a_enabled = 0;
- unsigned int ehrpwm1b_enabled = 0;
- unsigned int ehrpwm2a_enabled = 0;
- unsigned int ehrpwm2b_enabled = 0;
- unsigned int is_rev_c = 0;
- size_t len = 0;
- char* line = NULL;
-
- FILE* fh;
- fh = fopen(SYSFS_CLASS_MMC "mmc1/mmc1:0001/name", "r");
- if (fh != NULL) {
- emmc_enabled = 1;
- if (getline(&line, &len, fh) != -1) {
- if (strstr(line, "MMC04G")) {
- is_rev_c = 1;
- }
- }
- fclose(fh);
- free(line);
- } else
- emmc_enabled = 0;
-
-
- if (mraa_file_exist("/sys/devices/ocp.*/hdmi.*"))
- hdmi_enabled = 1;
- else
- hdmi_enabled = 0;
-
- if (mraa_file_exist("/sys/class/i2c-dev/i2c-0"))
- i2c0_enabled = 1;
- else
- i2c0_enabled = 0;
-
- if (mraa_file_exist("/sys/class/i2c-dev/i2c-1"))
- i2c1_enabled = 1;
- else
- i2c1_enabled = 0;
-
- if (mraa_file_exist("/sys/class/spidev/spidev1.0"))
- spi0_enabled = 1;
- else
- spi0_enabled = 0;
-
- if (mraa_file_exist("/sys/class/spidev/spidev2.0"))
- spi1_enabled = 1;
- else
- spi1_enabled = 0;
-
- if (mraa_file_exist("/sys/class/tty/ttyO1"))
- uart1_enabled = 1;
- else
- uart1_enabled = 0;
-
- if (mraa_file_exist("/sys/class/tty/ttyO2"))
- uart2_enabled = 1;
- else
- uart2_enabled = 0;
-
- if (mraa_file_exist("/sys/class/tty/ttyO3"))
- uart3_enabled = 1;
- else
- uart3_enabled = 0;
-
- if (mraa_file_exist("/sys/class/tty/ttyO4"))
- uart4_enabled = 1;
- else
- uart4_enabled = 0;
-
- if (mraa_file_exist("/sys/class/tty/ttyO5"))
- uart5_enabled = 1;
- else
- uart5_enabled = 0;
-
- if (mraa_file_exist("/sys/class/pwm/pwm0"))
- ehrpwm0a_enabled = 1;
- else
- ehrpwm0a_enabled = 0;
-
- if (mraa_file_exist("/sys/class/pwm/pwm1"))
- ehrpwm0b_enabled = 1;
- else
- ehrpwm0b_enabled = 0;
-
- if (mraa_file_exist("/sys/class/pwm/pwm3"))
- ehrpwm1a_enabled = 1;
- else
- ehrpwm1a_enabled = 0;
-
- if (mraa_file_exist("/sys/class/pwm/pwm4"))
- ehrpwm1b_enabled = 1;
- else
- ehrpwm1b_enabled = 0;
-
- if (mraa_file_exist("/sys/class/pwm/pwm5"))
- ehrpwm2a_enabled = 1;
- else
- ehrpwm2a_enabled = 0;
-
- if (mraa_file_exist("/sys/class/pwm/pwm6"))
- ehrpwm2b_enabled = 1;
- else
- ehrpwm2b_enabled = 0;
-
- mraa_board_t* b = (mraa_board_t*) calloc(1, sizeof(mraa_board_t));
- if (b == NULL)
- return NULL;
- // TODO: Detect Beaglebone Black Revisions, for now always TYPE B
- if (is_rev_c == 0) {
- b->platform_name = PLATFORM_NAME_BEAGLEBONE_BLACK_REV_B;
- b->phy_pin_count = MRAA_BEAGLEBONE_BLACK_PINCOUNT;
- }
- if (is_rev_c == 1) {
- b->platform_name = PLATFORM_NAME_BEAGLEBONE_BLACK_REV_C;
- b->phy_pin_count = MRAA_BEAGLEBONE_BLACK_PINCOUNT;
- }
-
- if (b->platform_name == NULL) {
- goto error;
- }
-
- b->aio_count = 7;
- b->adc_raw = 12;
- b->adc_supported = 12;
- b->pwm_default_period = 500;
- b->pwm_max_period = 2147483;
- b->pwm_min_period = 1;
-
- b->pins = (mraa_pininfo_t*) calloc(b->phy_pin_count,sizeof(mraa_pininfo_t));
- if (b->pins == NULL) {
- goto error;
- }
-
- b->adv_func = (mraa_adv_func_t*) calloc(1, sizeof(mraa_adv_func_t));
- if (b->adv_func == NULL) {
- free(b->pins);
- goto error;
- }
-
- b->adv_func->uart_init_pre = &mraa_beaglebone_uart_init_pre;
- b->adv_func->spi_init_pre = &mraa_beaglebone_spi_init_pre;
- b->adv_func->i2c_init_pre = &mraa_beaglebone_i2c_init_pre;
- b->adv_func->pwm_init_replace = &mraa_beaglebone_pwm_init_replace;
-
- strncpy(b->pins[0].name, "INVALID", MRAA_PIN_NAME_SIZE);
- b->pins[0].capabilites = (mraa_pincapabilities_t){ 0, 0, 0, 0, 0, 0, 0, 0 };
-
- strncpy(b->pins[1].name, "GND", MRAA_PIN_NAME_SIZE);
- b->pins[1].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
-
- strncpy(b->pins[2].name, "GND", MRAA_PIN_NAME_SIZE);
- b->pins[2].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
-
- if (emmc_enabled == 1) {
- strncpy(b->pins[3].name, "MMC1_D6", MRAA_PIN_NAME_SIZE);
- b->pins[3].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- } else {
- strncpy(b->pins[3].name, "GPIO38", MRAA_PIN_NAME_SIZE);
- b->pins[3].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- }
- b->pins[3].gpio.pinmap = 38;
- b->pins[3].gpio.parent_id = 0;
- b->pins[3].gpio.mux_total = 0;
-
- if (emmc_enabled == 1) {
- strncpy(b->pins[4].name, "MMC1_D7", MRAA_PIN_NAME_SIZE);
- b->pins[4].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- } else {
- strncpy(b->pins[4].name, "GPIO39", MRAA_PIN_NAME_SIZE);
- b->pins[4].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- }
- b->pins[4].gpio.pinmap = 39;
- b->pins[4].gpio.parent_id = 0;
- b->pins[4].gpio.mux_total = 0;
-
- if (emmc_enabled == 1) {
- strncpy(b->pins[5].name, "MMC1_D2", MRAA_PIN_NAME_SIZE);
- b->pins[5].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- } else {
- strncpy(b->pins[5].name, "GPIO34", MRAA_PIN_NAME_SIZE);
- b->pins[5].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- }
- b->pins[5].gpio.pinmap = 34;
- b->pins[5].gpio.parent_id = 0;
- b->pins[5].gpio.mux_total = 0;
-
- if (emmc_enabled == 1) {
- strncpy(b->pins[6].name, "MMC1_D3", MRAA_PIN_NAME_SIZE);
- b->pins[6].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- } else {
- strncpy(b->pins[6].name, "GPIO35", MRAA_PIN_NAME_SIZE);
- b->pins[6].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- }
- b->pins[6].gpio.pinmap = 35;
- b->pins[6].gpio.parent_id = 0;
- b->pins[6].gpio.mux_total = 0;
-
- // TODO TIMER4
- strncpy(b->pins[7].name, "GPIO66", MRAA_PIN_NAME_SIZE);
- b->pins[7].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[7].gpio.pinmap = 66;
- b->pins[7].gpio.parent_id = 0;
- b->pins[7].gpio.mux_total = 0;
-
- // TODO TIMER7
- strncpy(b->pins[8].name, "GPIO67", MRAA_PIN_NAME_SIZE);
- b->pins[8].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[8].gpio.pinmap = 67;
- b->pins[8].gpio.parent_id = 0;
- b->pins[8].gpio.mux_total = 0;
-
- // TODO TIMER5
- strncpy(b->pins[9].name, "GPIO69", MRAA_PIN_NAME_SIZE);
- b->pins[9].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[9].gpio.pinmap = 69;
- b->pins[9].gpio.parent_id = 0;
- b->pins[9].gpio.mux_total = 0;
-
- // TODO TIMER6
- strncpy(b->pins[10].name, "GPIO68", MRAA_PIN_NAME_SIZE);
- b->pins[10].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[10].gpio.pinmap = 68;
- b->pins[10].gpio.parent_id = 0;
- b->pins[10].gpio.mux_total = 0;
-
- strncpy(b->pins[11].name, "GPIO45", MRAA_PIN_NAME_SIZE);
- b->pins[11].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[11].gpio.pinmap = 45;
- b->pins[11].gpio.parent_id = 0;
- b->pins[11].gpio.mux_total = 0;
-
- strncpy(b->pins[12].name, "GPIO44", MRAA_PIN_NAME_SIZE);
- b->pins[12].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[12].gpio.pinmap = 44;
- b->pins[12].gpio.parent_id = 0;
- b->pins[12].gpio.mux_total = 0;
-
- if (ehrpwm2b_enabled == 1) {
- strncpy(b->pins[13].name, "EHRPWM2B", MRAA_PIN_NAME_SIZE);
- b->pins[13].capabilites = (mraa_pincapabilities_t){ 1, 0, 1, 0, 0, 0, 0, 0 };
- } else {
- strncpy(b->pins[13].name, "GPIO23", MRAA_PIN_NAME_SIZE);
- b->pins[13].capabilites = (mraa_pincapabilities_t){ 1, 1, 1, 0, 0, 0, 0, 0 };
- }
- b->pins[13].gpio.pinmap = 23;
- b->pins[13].gpio.parent_id = 0;
- b->pins[13].gpio.mux_total = 0;
- b->pins[13].pwm.pinmap = 6;
- b->pins[13].pwm.mux_total = 0;
-
- strncpy(b->pins[14].name, "GPIO26", MRAA_PIN_NAME_SIZE);
- b->pins[14].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[14].gpio.pinmap = 26;
- b->pins[14].gpio.parent_id = 0;
- b->pins[14].gpio.mux_total = 0;
-
- strncpy(b->pins[15].name, "GPIO47", MRAA_PIN_NAME_SIZE);
- b->pins[15].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[15].gpio.pinmap = 47;
- b->pins[15].gpio.parent_id = 0;
- b->pins[15].gpio.mux_total = 0;
-
- strncpy(b->pins[16].name, "GPIO46", MRAA_PIN_NAME_SIZE);
- b->pins[16].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[16].gpio.pinmap = 46;
- b->pins[16].gpio.parent_id = 0;
- b->pins[16].gpio.mux_total = 0;
-
- // TODO PWM0_SYNCO
- strncpy(b->pins[17].name, "GPIO27", MRAA_PIN_NAME_SIZE);
- b->pins[17].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[17].gpio.pinmap = 27;
- b->pins[17].gpio.parent_id = 0;
- b->pins[17].gpio.mux_total = 0;
-
- strncpy(b->pins[18].name, "GPIO65", MRAA_PIN_NAME_SIZE);
- b->pins[18].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[18].gpio.pinmap = 65;
- b->pins[18].gpio.parent_id = 0;
- b->pins[18].gpio.mux_total = 0;
-
- if (ehrpwm2a_enabled == 1) {
- strncpy(b->pins[19].name, "EHRPWM2A", MRAA_PIN_NAME_SIZE);
- b->pins[19].capabilites = (mraa_pincapabilities_t){ 1, 0, 1, 0, 0, 0, 0, 0 };
- } else {
- strncpy(b->pins[19].name, "GPIO22", MRAA_PIN_NAME_SIZE);
- b->pins[19].capabilites = (mraa_pincapabilities_t){ 1, 1, 1, 0, 0, 0, 0, 0 };
- }
- b->pins[19].gpio.pinmap = 22;
- b->pins[19].gpio.parent_id = 0;
- b->pins[19].gpio.mux_total = 0;
- b->pins[19].pwm.pinmap = 5;
- b->pins[19].pwm.mux_total = 0;
-
- if (emmc_enabled == 1) {
- strncpy(b->pins[20].name, "MMC1_CMD", MRAA_PIN_NAME_SIZE);
- b->pins[20].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- } else {
- strncpy(b->pins[20].name, "GPIO63", MRAA_PIN_NAME_SIZE);
- b->pins[20].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- }
- b->pins[20].gpio.pinmap = 63;
- b->pins[20].gpio.parent_id = 0;
- b->pins[20].gpio.mux_total = 0;
-
- if (emmc_enabled == 1) {
- strncpy(b->pins[21].name, "MMC1_CLK", MRAA_PIN_NAME_SIZE);
- b->pins[21].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- } else {
- strncpy(b->pins[21].name, "GPIO62", MRAA_PIN_NAME_SIZE);
- b->pins[21].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- }
- b->pins[21].gpio.pinmap = 62;
- b->pins[21].gpio.parent_id = 0;
- b->pins[21].gpio.mux_total = 0;
-
- if (emmc_enabled == 1) {
- strncpy(b->pins[22].name, "MMC1_D5", MRAA_PIN_NAME_SIZE);
- b->pins[22].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- } else {
- strncpy(b->pins[22].name, "GPIO37", MRAA_PIN_NAME_SIZE);
- b->pins[22].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- }
- b->pins[22].gpio.pinmap = 37;
- b->pins[22].gpio.parent_id = 0;
- b->pins[22].gpio.mux_total = 0;
-
- if (emmc_enabled == 1) {
- strncpy(b->pins[23].name, "MMC_D4", MRAA_PIN_NAME_SIZE);
- b->pins[23].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- } else {
- strncpy(b->pins[23].name, "GPIO36", MRAA_PIN_NAME_SIZE);
- b->pins[23].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- }
- b->pins[23].gpio.pinmap = 36;
- b->pins[23].gpio.parent_id = 0;
- b->pins[23].gpio.mux_total = 0;
-
- if (emmc_enabled == 1) {
- strncpy(b->pins[24].name, "MMC_D1", MRAA_PIN_NAME_SIZE);
- b->pins[24].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- } else {
- strncpy(b->pins[24].name, "GPIO33", MRAA_PIN_NAME_SIZE);
- b->pins[24].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- }
- b->pins[24].gpio.pinmap = 33;
- b->pins[24].gpio.parent_id = 0;
- b->pins[24].gpio.mux_total = 0;
-
- if (emmc_enabled == 1) {
- strncpy(b->pins[25].name, "MMC1_D0", MRAA_PIN_NAME_SIZE);
- b->pins[25].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- } else {
- strncpy(b->pins[25].name, "GPIO32", MRAA_PIN_NAME_SIZE);
- b->pins[25].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- }
- b->pins[25].gpio.pinmap = 32;
- b->pins[25].gpio.parent_id = 0;
- b->pins[25].gpio.mux_total = 0;
-
- strncpy(b->pins[26].name, "GPIO61", MRAA_PIN_NAME_SIZE);
- b->pins[26].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[26].gpio.pinmap = 61;
- b->pins[26].gpio.parent_id = 0;
- b->pins[26].gpio.mux_total = 0;
-
- if (hdmi_enabled == 1) {
- strncpy(b->pins[27].name, "LCD_VSYNC", MRAA_PIN_NAME_SIZE);
- b->pins[27].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- } else {
- strncpy(b->pins[27].name, "GPIO86", MRAA_PIN_NAME_SIZE);
- b->pins[27].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- }
- b->pins[27].gpio.pinmap = 86;
- b->pins[27].gpio.parent_id = 0;
- b->pins[27].gpio.mux_total = 0;
-
- if (hdmi_enabled == 1) {
- strncpy(b->pins[28].name, "LCD_PCLK", MRAA_PIN_NAME_SIZE);
- b->pins[28].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- } else {
- strncpy(b->pins[28].name, "GPIO88", MRAA_PIN_NAME_SIZE);
- b->pins[28].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- }
- b->pins[28].gpio.pinmap = 88;
- b->pins[28].gpio.parent_id = 0;
- b->pins[28].gpio.mux_total = 0;
-
- if (hdmi_enabled == 1) {
- strncpy(b->pins[29].name, "LCD_HSYNC", MRAA_PIN_NAME_SIZE);
- b->pins[29].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- } else {
- strncpy(b->pins[29].name, "GPIO87", MRAA_PIN_NAME_SIZE);
- b->pins[29].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- }
- b->pins[29].gpio.pinmap = 87;
- b->pins[29].gpio.parent_id = 0;
- b->pins[29].gpio.mux_total = 0;
-
- if (hdmi_enabled == 1) {
- strncpy(b->pins[30].name, "LCD_AC_BIAS", MRAA_PIN_NAME_SIZE);
- b->pins[30].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- } else {
- strncpy(b->pins[30].name, "GPIO89", MRAA_PIN_NAME_SIZE);
- b->pins[30].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- }
- b->pins[30].gpio.pinmap = 89;
- b->pins[30].gpio.parent_id = 0;
- b->pins[30].gpio.mux_total = 0;
-
- if (hdmi_enabled == 1) {
- strncpy(b->pins[31].name, "LCD_D14", MRAA_PIN_NAME_SIZE);
- b->pins[31].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- } else {
- // TODO UART5_CTS this is ignored when using ADAFRUIT
- strncpy(b->pins[31].name, "GPIO10", MRAA_PIN_NAME_SIZE);
- b->pins[31].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- }
- b->pins[31].gpio.pinmap = 10;
- b->pins[31].gpio.parent_id = 0;
- b->pins[31].gpio.mux_total = 0;
- b->pins[31].uart.mux_total = 0;
-
- if (hdmi_enabled == 1) {
- strncpy(b->pins[32].name, "LCD_D15", MRAA_PIN_NAME_SIZE);
- b->pins[32].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- } else {
- // TODO UART5_RTS this is ignored when using ADAFRUIT
- strncpy(b->pins[32].name, "GPIO11", MRAA_PIN_NAME_SIZE);
- b->pins[32].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- }
- b->pins[32].gpio.pinmap = 11;
- b->pins[32].gpio.parent_id = 0;
- b->pins[32].gpio.mux_total = 0;
- b->pins[32].uart.mux_total = 0;
-
- if (hdmi_enabled == 1) {
- strncpy(b->pins[33].name, "LCD_D13", MRAA_PIN_NAME_SIZE);
- b->pins[33].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- } else {
- // TODO UART4_RTS this is ignored when using ADAFRUIT
- strncpy(b->pins[33].name, "GPIO9", MRAA_PIN_NAME_SIZE);
- b->pins[33].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- }
- b->pins[33].gpio.pinmap = 9;
- b->pins[33].gpio.parent_id = 0;
- b->pins[33].gpio.mux_total = 0;
- b->pins[33].uart.mux_total = 0;
-
- // TODO PWM_1B
- if (hdmi_enabled == 1) {
- strncpy(b->pins[34].name, "LCD_D11", MRAA_PIN_NAME_SIZE);
- b->pins[34].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- } else {
- strncpy(b->pins[34].name, "GPIO81", MRAA_PIN_NAME_SIZE);
- b->pins[34].capabilites = (mraa_pincapabilities_t){ 1, 1, 1, 0, 0, 0, 0, 0 };
- }
- b->pins[34].gpio.pinmap = 81;
- b->pins[34].gpio.parent_id = 0;
- b->pins[34].gpio.mux_total = 0;
-
- if (hdmi_enabled == 1) {
- strncpy(b->pins[35].name, "LCD_D12", MRAA_PIN_NAME_SIZE);
- b->pins[35].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- } else {
- // TODO UART4_CTS this is ignored when using ADAFRUIT
- strncpy(b->pins[35].name, "GPIO8", MRAA_PIN_NAME_SIZE);
- b->pins[35].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- }
- b->pins[35].gpio.pinmap = 8;
- b->pins[35].gpio.parent_id = 0;
- b->pins[35].gpio.mux_total = 0;
- b->pins[35].uart.mux_total = 0;
-
- // TODO PWM_1A
- if (hdmi_enabled == 1) {
- strncpy(b->pins[36].name, "LCD_D10", MRAA_PIN_NAME_SIZE);
- b->pins[36].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- } else {
- strncpy(b->pins[36].name, "GPIO80", MRAA_PIN_NAME_SIZE);
- b->pins[36].capabilites = (mraa_pincapabilities_t){ 1, 1, 1, 0, 0, 0, 0, 0 };
- }
- b->pins[36].gpio.pinmap = 80;
- b->pins[36].gpio.parent_id = 0;
- b->pins[36].gpio.mux_total = 0;
-
- if (hdmi_enabled == 1) {
- strncpy(b->pins[37].name, "LCD_D8", MRAA_PIN_NAME_SIZE);
- b->pins[37].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- } else {
- if (uart5_enabled == 1) {
- strncpy(b->pins[37].name, "UART5TX", MRAA_PIN_NAME_SIZE);
- b->pins[37].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 1 };
- } else {
- strncpy(b->pins[37].name, "GPIO78", MRAA_PIN_NAME_SIZE);
- b->pins[37].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 1 };
- }
- }
- b->pins[37].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 1 };
- b->pins[37].gpio.pinmap = 78;
- b->pins[37].gpio.parent_id = 0;
- b->pins[37].gpio.mux_total = 0;
- b->pins[37].uart.mux_total = 0;
-
- if (hdmi_enabled == 1) {
- strncpy(b->pins[38].name, "LCD_D9", MRAA_PIN_NAME_SIZE);
- b->pins[38].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- } else {
- // TODO UART5_RX
- if (uart5_enabled == 1) {
- strncpy(b->pins[38].name, "UART5RX", MRAA_PIN_NAME_SIZE);
- b->pins[38].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 1 };
- } else {
- strncpy(b->pins[38].name, "GPIO79", MRAA_PIN_NAME_SIZE);
- b->pins[38].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 1 };
- }
- }
- b->pins[38].gpio.pinmap = 79;
- b->pins[38].gpio.parent_id = 0;
- b->pins[38].gpio.mux_total = 0;
- b->pins[38].uart.mux_total = 0;
-
- if (hdmi_enabled == 1) {
- strncpy(b->pins[39].name, "LCD_D6", MRAA_PIN_NAME_SIZE);
- b->pins[39].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- } else {
- strncpy(b->pins[39].name, "GPIO76", MRAA_PIN_NAME_SIZE);
- b->pins[39].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- }
- b->pins[39].gpio.pinmap = 76;
- b->pins[39].gpio.parent_id = 0;
- b->pins[39].gpio.mux_total = 0;
-
- if (hdmi_enabled == 1) {
- strncpy(b->pins[40].name, "LCD_D7", MRAA_PIN_NAME_SIZE);
- b->pins[40].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- } else {
- strncpy(b->pins[40].name, "GPIO77", MRAA_PIN_NAME_SIZE);
- b->pins[40].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- }
- b->pins[40].gpio.pinmap = 77;
- b->pins[40].gpio.parent_id = 0;
- b->pins[40].gpio.mux_total = 0;
-
- if (hdmi_enabled == 1) {
- strncpy(b->pins[41].name, "LCD_D4", MRAA_PIN_NAME_SIZE);
- b->pins[41].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- } else {
- strncpy(b->pins[41].name, "GPIO74", MRAA_PIN_NAME_SIZE);
- b->pins[41].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- }
- b->pins[41].gpio.pinmap = 74;
- b->pins[41].gpio.parent_id = 0;
- b->pins[41].gpio.mux_total = 0;
-
- if (hdmi_enabled == 1) {
- strncpy(b->pins[42].name, "LCD_D5", MRAA_PIN_NAME_SIZE);
- b->pins[42].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- } else {
- strncpy(b->pins[42].name, "GPIO75", MRAA_PIN_NAME_SIZE);
- b->pins[42].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- }
- b->pins[42].gpio.pinmap = 75;
- b->pins[42].gpio.parent_id = 0;
- b->pins[42].gpio.mux_total = 0;
-
- if (hdmi_enabled == 1) {
- strncpy(b->pins[43].name, "LCD_D2", MRAA_PIN_NAME_SIZE);
- b->pins[43].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- } else {
- strncpy(b->pins[43].name, "GPIO72", MRAA_PIN_NAME_SIZE);
- b->pins[43].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- }
- b->pins[43].gpio.pinmap = 72;
- b->pins[43].gpio.parent_id = 0;
- b->pins[43].gpio.mux_total = 0;
-
- if (hdmi_enabled == 1) {
- strncpy(b->pins[44].name, "LCD_D3", MRAA_PIN_NAME_SIZE);
- b->pins[44].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- } else {
- strncpy(b->pins[44].name, "GPIO73", MRAA_PIN_NAME_SIZE);
- b->pins[44].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- }
- b->pins[44].gpio.pinmap = 73;
- b->pins[44].gpio.parent_id = 0;
- b->pins[44].gpio.mux_total = 0;
-
- // TODO PWM_2A
- if (hdmi_enabled == 1) {
- strncpy(b->pins[45].name, "LCD_D0", MRAA_PIN_NAME_SIZE);
- b->pins[45].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- } else {
- strncpy(b->pins[45].name, "GPIO70", MRAA_PIN_NAME_SIZE);
- b->pins[45].capabilites = (mraa_pincapabilities_t){ 1, 1, 1, 0, 0, 0, 0, 0 };
- }
- b->pins[45].gpio.pinmap = 70;
- b->pins[45].gpio.parent_id = 0;
- b->pins[45].gpio.mux_total = 0;
-
- // TODO PWM_2B
- if (hdmi_enabled == 1) {
- strncpy(b->pins[46].name, "LCD_D1", MRAA_PIN_NAME_SIZE);
- b->pins[46].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- } else {
- strncpy(b->pins[46].name, "GPIO71", MRAA_PIN_NAME_SIZE);
- b->pins[46].capabilites = (mraa_pincapabilities_t){ 1, 1, 1, 0, 0, 0, 0, 0 };
- }
- b->pins[46].gpio.pinmap = 71;
- b->pins[46].gpio.parent_id = 0;
- b->pins[46].gpio.mux_total = 0;
-
- strncpy(b->pins[47].name, "GND", MRAA_PIN_NAME_SIZE);
- b->pins[47].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
-
- strncpy(b->pins[48].name, "GND", MRAA_PIN_NAME_SIZE);
- b->pins[48].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
-
- strncpy(b->pins[49].name, "3.3V", MRAA_PIN_NAME_SIZE);
- b->pins[49].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
-
- strncpy(b->pins[50].name, "3.3V", MRAA_PIN_NAME_SIZE);
- b->pins[50].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
-
- strncpy(b->pins[51].name, "5V", MRAA_PIN_NAME_SIZE);
- b->pins[51].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
-
- strncpy(b->pins[52].name, "5V", MRAA_PIN_NAME_SIZE);
- b->pins[52].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
-
- strncpy(b->pins[53].name, "5V", MRAA_PIN_NAME_SIZE);
- b->pins[53].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
-
- strncpy(b->pins[54].name, "5V", MRAA_PIN_NAME_SIZE);
- b->pins[54].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
-
- strncpy(b->pins[55].name, "PWR", MRAA_PIN_NAME_SIZE);
- b->pins[55].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
-
- strncpy(b->pins[56].name, "RESET", MRAA_PIN_NAME_SIZE);
- b->pins[56].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
-
- if (uart4_enabled == 1) {
- strncpy(b->pins[57].name, "UART4_RX", MRAA_PIN_NAME_SIZE);
- b->pins[57].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 1 };
- } else {
- strncpy(b->pins[57].name, "GPIO30", MRAA_PIN_NAME_SIZE);
- b->pins[57].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 1 };
- }
- b->pins[57].gpio.pinmap = 30;
- b->pins[57].gpio.parent_id = 0;
- b->pins[57].gpio.mux_total = 0;
- b->pins[57].uart.mux_total = 0;
-
- strncpy(b->pins[58].name, "GPIO60", MRAA_PIN_NAME_SIZE);
- b->pins[58].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[58].gpio.pinmap = 60;
- b->pins[58].gpio.parent_id = 0;
- b->pins[58].gpio.mux_total = 0;
-
- if (uart4_enabled == 1) {
- strncpy(b->pins[59].name, "UART4_TX", MRAA_PIN_NAME_SIZE);
- b->pins[59].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 1 };
- } else {
- strncpy(b->pins[59].name, "GPIO31", MRAA_PIN_NAME_SIZE);
- b->pins[59].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 1 };
- }
- b->pins[59].gpio.pinmap = 31;
- b->pins[59].gpio.parent_id = 0;
- b->pins[59].gpio.mux_total = 0;
- b->pins[59].uart.mux_total = 0;
-
- if (ehrpwm1a_enabled == 1) {
- strncpy(b->pins[60].name, "EHRPWM1A", MRAA_PIN_NAME_SIZE);
- b->pins[60].capabilites = (mraa_pincapabilities_t){ 1, 0, 1, 0, 0, 0, 0, 0 };
- } else {
- strncpy(b->pins[60].name, "GPIO50", MRAA_PIN_NAME_SIZE);
- b->pins[60].capabilites = (mraa_pincapabilities_t){ 1, 1, 1, 0, 0, 0, 0, 0 };
- }
- b->pins[60].gpio.pinmap = 50;
- b->pins[60].gpio.parent_id = 0;
- b->pins[60].gpio.mux_total = 0;
- b->pins[60].pwm.pinmap = 3;
- b->pins[60].pwm.mux_total = 0;
-
- // TODO PWM_TRIP2_IN (not a PWM output, but used for sync cf ref. manual)
- strncpy(b->pins[61].name, "GPIO48", MRAA_PIN_NAME_SIZE);
- b->pins[61].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[61].gpio.pinmap = 48;
- b->pins[61].gpio.parent_id = 0;
- b->pins[61].gpio.mux_total = 0;
-
- if (ehrpwm1b_enabled == 1) {
- strncpy(b->pins[62].name, "EHRPWM1B", MRAA_PIN_NAME_SIZE);
- b->pins[62].capabilites = (mraa_pincapabilities_t){ 1, 0, 1, 0, 0, 0, 0, 0 };
- } else {
- strncpy(b->pins[62].name, "GPIO51", MRAA_PIN_NAME_SIZE);
- b->pins[62].capabilites = (mraa_pincapabilities_t){ 1, 1, 1, 0, 0, 0, 0, 0 };
- }
- b->pins[62].gpio.pinmap = 51;
- b->pins[62].gpio.parent_id = 0;
- b->pins[62].gpio.mux_total = 0;
- b->pins[62].pwm.pinmap = 4;
- b->pins[62].pwm.mux_total = 0;
-
- if ((i2c0_enabled == 1) || (spi0_enabled == 1)) {
- if (i2c0_enabled == 1) {
- strncpy(b->pins[63].name, "I2C1SCL", MRAA_PIN_NAME_SIZE);
- b->pins[63].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 1, 1, 0, 0 };
- }
- if (spi0_enabled == 1) {
- strncpy(b->pins[63].name, "SPI0CS0", MRAA_PIN_NAME_SIZE);
- b->pins[63].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 1, 0, 0, 0 };
- }
- } else {
- strncpy(b->pins[63].name, "GPIO4", MRAA_PIN_NAME_SIZE);
- b->pins[63].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 1, 1, 0, 0 };
- }
- b->pins[63].gpio.pinmap = 4;
- b->pins[63].gpio.parent_id = 0;
- b->pins[63].gpio.mux_total = 0;
- b->pins[63].i2c.mux_total = 0;
- b->pins[63].spi.mux_total = 0;
-
- if ((i2c0_enabled == 1) || (spi0_enabled == 1)) {
- if (i2c0_enabled == 1) {
- strncpy(b->pins[64].name, "I2C1SDA", MRAA_PIN_NAME_SIZE);
- b->pins[64].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 1, 1, 0, 0 };
- }
- if (spi0_enabled == 1) {
- strncpy(b->pins[64].name, "SPI0D1", MRAA_PIN_NAME_SIZE);
- b->pins[64].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 1, 0, 0, 0 };
- }
- } else {
- strncpy(b->pins[64].name, "GPIO5", MRAA_PIN_NAME_SIZE);
- b->pins[64].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 1, 1, 0, 0 };
- }
- b->pins[64].gpio.pinmap = 5;
- b->pins[64].gpio.parent_id = 0;
- b->pins[64].gpio.mux_total = 0;
- b->pins[64].i2c.mux_total = 0;
- b->pins[64].spi.mux_total = 0;
-
- if (i2c0_enabled == 1) {
- strncpy(b->pins[65].name, "I2C2SCL", MRAA_PIN_NAME_SIZE);
- b->pins[65].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 1, 0, 0 };
- b->pins[65].i2c.mux_total = 0;
- } else {
- strncpy(b->pins[65].name, "GPIO13", MRAA_PIN_NAME_SIZE);
- b->pins[65].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 1, 0, 0 };
- }
- b->pins[65].gpio.pinmap = 13;
- b->pins[65].gpio.parent_id = 0;
- b->pins[65].gpio.mux_total = 0;
- b->pins[65].i2c.mux_total = 0;
-
- if (i2c0_enabled == 1) {
- strncpy(b->pins[66].name, "I2C2SDA", MRAA_PIN_NAME_SIZE);
- b->pins[66].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 1, 0, 0 };
- b->pins[66].i2c.mux_total = 0;
- } else {
- strncpy(b->pins[66].name, "GPIO12", MRAA_PIN_NAME_SIZE);
- b->pins[66].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 1, 0, 0 };
- }
- b->pins[66].gpio.pinmap = 12;
- b->pins[66].gpio.parent_id = 0;
- b->pins[66].gpio.mux_total = 0;
- b->pins[66].i2c.mux_total = 0;
-
- if ((spi0_enabled == 1) || uart2_enabled == 1 || ehrpwm0b_enabled == 1) {
- if (uart2_enabled == 1) {
- strncpy(b->pins[67].name, "UART2_TX", MRAA_PIN_NAME_SIZE);
- b->pins[67].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 1 };
- }
- if (spi0_enabled == 1) {
- strncpy(b->pins[67].name, "SPI0D0", MRAA_PIN_NAME_SIZE);
- b->pins[67].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 1, 0, 0, 0 };
- }
- if (ehrpwm0b_enabled == 1) {
- strncpy(b->pins[67].name, "EHRPWM0B", MRAA_PIN_NAME_SIZE);
- b->pins[67].capabilites = (mraa_pincapabilities_t){ 1, 0, 1, 0, 0, 0, 0, 0 };
- }
- } else {
- strncpy(b->pins[67].name, "GPIO3", MRAA_PIN_NAME_SIZE);
- b->pins[67].capabilites = (mraa_pincapabilities_t){ 1, 1, 1, 0, 1, 0, 0, 1 };
- }
- b->pins[67].gpio.pinmap = 3;
- b->pins[67].gpio.parent_id = 0;
- b->pins[67].gpio.mux_total = 0;
- b->pins[67].spi.mux_total = 0;
- b->pins[67].uart.mux_total = 0;
- b->pins[67].pwm.pinmap = 1;
- b->pins[67].pwm.mux_total = 0;
-
- if ((spi0_enabled == 1) || uart2_enabled == 1 || ehrpwm0a_enabled == 1) {
- if (uart2_enabled == 1) {
- strncpy(b->pins[68].name, "UART2_RX", MRAA_PIN_NAME_SIZE);
- b->pins[68].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 1, 0, 0, 1 };
- }
- if (spi0_enabled == 1) {
- strncpy(b->pins[68].name, "SPI0CLK", MRAA_PIN_NAME_SIZE);
- b->pins[68].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 1, 0, 0, 0 };
- }
- if (ehrpwm0a_enabled == 1) {
- strncpy(b->pins[68].name, "EHRPWM0A", MRAA_PIN_NAME_SIZE);
- b->pins[68].capabilites = (mraa_pincapabilities_t){ 1, 0, 1, 0, 0, 0, 0, 0 };
- }
- } else {
- strncpy(b->pins[68].name, "GPIO2", MRAA_PIN_NAME_SIZE);
- b->pins[68].capabilites = (mraa_pincapabilities_t){ 1, 1, 1, 0, 1, 0, 0, 1 };
- }
- b->pins[68].gpio.pinmap = 2;
- b->pins[68].gpio.parent_id = 0;
- b->pins[68].gpio.mux_total = 0;
- b->pins[68].spi.mux_total = 0;
- b->pins[68].uart.mux_total = 0;
- b->pins[68].pwm.pinmap = 0;
- b->pins[68].pwm.mux_total = 0;
-
- // TODO PWM0_SYNCO ?? PWM
- strncpy(b->pins[69].name, "GPIO49", MRAA_PIN_NAME_SIZE);
- b->pins[69].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[69].gpio.pinmap = 49;
- b->pins[69].gpio.parent_id = 0;
- b->pins[69].gpio.mux_total = 0;
-
- if (uart1_enabled == 1) {
- strncpy(b->pins[70].name, "UART1_RX", MRAA_PIN_NAME_SIZE);
- b->pins[70].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 1 };
- } else {
- strncpy(b->pins[70].name, "GPIO15", MRAA_PIN_NAME_SIZE);
- b->pins[70].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 1 };
- }
- b->pins[70].gpio.pinmap = 15;
- b->pins[70].gpio.parent_id = 0;
- b->pins[70].gpio.mux_total = 0;
- b->pins[70].uart.mux_total = 0;
-
- strncpy(b->pins[71].name, "GPIO117", MRAA_PIN_NAME_SIZE);
- b->pins[71].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[71].gpio.pinmap = 117;
- b->pins[71].gpio.parent_id = 0;
- b->pins[71].gpio.mux_total = 0;
-
- if (uart1_enabled == 1) {
- strncpy(b->pins[72].name, "UART1_RX", MRAA_PIN_NAME_SIZE);
- b->pins[72].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 1 };
- } else {
- strncpy(b->pins[72].name, "GPIO14", MRAA_PIN_NAME_SIZE);
- b->pins[72].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 1 };
- }
- b->pins[72].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 1 };
- b->pins[72].gpio.pinmap = 14;
- b->pins[72].gpio.parent_id = 0;
- b->pins[72].gpio.mux_total = 0;
- b->pins[72].uart.mux_total = 0;
-
- strncpy(b->pins[73].name, "GPIO115", MRAA_PIN_NAME_SIZE);
- b->pins[73].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[73].gpio.pinmap = 115;
- b->pins[73].gpio.parent_id = 0;
- b->pins[73].gpio.mux_total = 0;
-
- if (emmc_enabled != 1) {
- if (spi1_enabled == 1) {
- strncpy(b->pins[74].name, "SPI1CS0", MRAA_PIN_NAME_SIZE);
- b->pins[74].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 1, 0, 0, 0 };
- } else {
- strncpy(b->pins[74].name, "GPIO113", MRAA_PIN_NAME_SIZE);
- b->pins[74].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 1, 0, 0, 0 };
- }
- } else {
- strncpy(b->pins[74].name, "MCASP0XX", MRAA_PIN_NAME_SIZE);
- b->pins[74].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 1, 0, 0, 0 };
- }
- b->pins[74].gpio.pinmap = 113;
- b->pins[74].gpio.parent_id = 0;
- b->pins[74].gpio.mux_total = 0;
- b->pins[74].spi.mux_total = 0;
-
- if (emmc_enabled != 1) {
- if (spi1_enabled == 1) {
- strncpy(b->pins[75].name, "SPI1D0", MRAA_PIN_NAME_SIZE);
- b->pins[75].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 1, 0, 0, 0 };
- } else {
- strncpy(b->pins[75].name, "GPIO111", MRAA_PIN_NAME_SIZE);
- b->pins[75].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 1, 0, 0, 0 };
- }
- } else {
- strncpy(b->pins[75].name, "MMC1_SD", MRAA_PIN_NAME_SIZE);
- b->pins[75].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- }
- b->pins[75].gpio.pinmap = 111;
- b->pins[75].gpio.parent_id = 0;
- b->pins[75].gpio.mux_total = 0;
- b->pins[75].spi.mux_total = 0;
-
- if (emmc_enabled != 1) {
- if (spi1_enabled == 1) {
- strncpy(b->pins[76].name, "SPI1D1", MRAA_PIN_NAME_SIZE);
- b->pins[76].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 1, 0, 0, 0 };
- } else {
- strncpy(b->pins[76].name, "GPIO112", MRAA_PIN_NAME_SIZE);
- b->pins[76].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 1, 0, 0, 0 };
- }
- } else {
- strncpy(b->pins[76].name, "MMC2_SD", MRAA_PIN_NAME_SIZE);
- b->pins[76].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- }
- b->pins[76].gpio.pinmap = 112;
- b->pins[76].gpio.parent_id = 0;
- b->pins[76].gpio.mux_total = 0;
- b->pins[76].spi.mux_total = 0;
-
- if (emmc_enabled != 1) {
- if (spi1_enabled == 1) {
- strncpy(b->pins[77].name, "SPI1CLK", MRAA_PIN_NAME_SIZE);
- b->pins[77].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 1, 0, 0, 0 };
- } else {
- strncpy(b->pins[77].name, "GPIO110", MRAA_PIN_NAME_SIZE);
- b->pins[77].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 1, 0, 0, 0 };
- }
- } else {
- strncpy(b->pins[77].name, "MMC0_SD", MRAA_PIN_NAME_SIZE);
- b->pins[77].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- }
- b->pins[77].gpio.pinmap = 110;
- b->pins[77].gpio.parent_id = 0;
- b->pins[77].gpio.mux_total = 0;
- b->pins[77].spi.mux_total = 0;
-
-
- strncpy(b->pins[78].name, "VDD_ADC", MRAA_PIN_NAME_SIZE);
- b->pins[78].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
-
- // TODO AIN4
- strncpy(b->pins[79].name, "AIN4", MRAA_PIN_NAME_SIZE);
- b->pins[79].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 1, 0 };
-
- strncpy(b->pins[80].name, "GND_ADC", MRAA_PIN_NAME_SIZE);
- b->pins[80].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- // TODO AIN6
- strncpy(b->pins[81].name, "AIN6", MRAA_PIN_NAME_SIZE);
- b->pins[81].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 1, 0 };
- // TODO AIN5
- strncpy(b->pins[82].name, "AIN5", MRAA_PIN_NAME_SIZE);
- b->pins[82].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 1, 0 };
- // TODO AIN2
- strncpy(b->pins[83].name, "AIN2", MRAA_PIN_NAME_SIZE);
- b->pins[83].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 1, 0 };
- // TODO AIN3
- strncpy(b->pins[84].name, "AIN3", MRAA_PIN_NAME_SIZE);
- b->pins[84].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 1, 0 };
- // TODO AIN0
- strncpy(b->pins[85].name, "AIN0", MRAA_PIN_NAME_SIZE);
- b->pins[85].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 1, 0 };
- // TODO AIN1
- strncpy(b->pins[86].name, "AIN1", MRAA_PIN_NAME_SIZE);
- b->pins[86].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 1, 0 };
-
- strncpy(b->pins[87].name, "GPIO20", MRAA_PIN_NAME_SIZE);
- b->pins[87].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[87].gpio.pinmap = 20;
- b->pins[87].gpio.parent_id = 0;
- b->pins[87].gpio.mux_total = 0;
-
- strncpy(b->pins[88].name, "GPIO7", MRAA_PIN_NAME_SIZE);
- b->pins[88].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[88].gpio.pinmap = 7;
- b->pins[88].gpio.parent_id = 0;
- b->pins[88].gpio.mux_total = 0;
-
- // GND
- strncpy(b->pins[89].name, "GND", MRAA_PIN_NAME_SIZE);
- b->pins[89].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
-
- // GND
- strncpy(b->pins[90].name, "GND", MRAA_PIN_NAME_SIZE);
- b->pins[90].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
-
- // GND
- strncpy(b->pins[91].name, "GND", MRAA_PIN_NAME_SIZE);
- b->pins[91].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
-
- // GND
- strncpy(b->pins[92].name, "GND", MRAA_PIN_NAME_SIZE);
- b->pins[92].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
-
- // BUS DEFINITIONS
- b->i2c_bus_count = 2;
- b->def_i2c_bus = 0;
-
- b->i2c_bus[0].bus_id = 0;
- b->i2c_bus[0].sda = 46 + 18;
- b->i2c_bus[0].scl = 46 + 17;
-
- b->i2c_bus[1].bus_id = 1;
- b->i2c_bus[1].sda = 46 + 20;
- b->i2c_bus[1].scl = 46 + 19;
-
- if (emmc_enabled == 1)
- b->spi_bus_count = 1;
- else
- b->spi_bus_count = 2;
- b->def_spi_bus = 0;
- b->spi_bus[0].bus_id = 1;
- b->spi_bus[0].slave_s = 0;
- b->spi_bus[0].cs = 46 + 17;
- b->spi_bus[0].mosi = 46 + 18;
- b->spi_bus[0].miso = 46 + 21;
- b->spi_bus[0].sclk = 46 + 22;
-
- b->spi_bus[1].bus_id = 2;
- b->spi_bus[1].slave_s = 0;
- b->spi_bus[1].cs = 46 + 28;
- b->spi_bus[1].mosi = 46 + 29;
- b->spi_bus[1].miso = 46 + 30;
- b->spi_bus[1].sclk = 46 + 31;
-
- b->uart_dev_count = 5;
- b->def_uart_dev = 0;
- b->uart_dev[0].rx = 46 + 26;
- b->uart_dev[0].tx = 46 + 24;
- b->uart_dev[1].rx = 46 + 22;
- b->uart_dev[1].tx = 46 + 21;
- // TODO
- b->uart_dev[2].rx = 0;
- b->uart_dev[2].tx = 42;
-
- b->uart_dev[3].rx = 46 + 11;
- b->uart_dev[3].tx = 46 + 13;
- b->uart_dev[4].rx = 38;
- b->uart_dev[4].tx = 37;
-
- b->gpio_count = 0;
- int i;
- for (i = 0; i < b->phy_pin_count; i++)
- if (b->pins[i].capabilites.gpio)
- b->gpio_count++;
-
- return b;
-error:
- syslog(LOG_CRIT, "Beaglebone: failed to initialize");
- free(b);
- return NULL;
-};
diff --git a/peripheral/libmraa/src/arm/raspberry_pi.c b/peripheral/libmraa/src/arm/raspberry_pi.c
deleted file mode 100644
index ad8b6ed..0000000
--- a/peripheral/libmraa/src/arm/raspberry_pi.c
+++ /dev/null
@@ -1,565 +0,0 @@
-/*
- * Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
- * Author: Michael Ring <mail@michael-ring.org>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <sys/mman.h>
-#include <mraa/common.h>
-
-#include "common.h"
-#include "arm/raspberry_pi.h"
-
-#define PLATFORM_NAME_RASPBERRY_PI_B_REV_1 "Raspberry Pi Model B Rev 1"
-#define PLATFORM_NAME_RASPBERRY_PI_A_REV_2 "Raspberry Pi Model A Rev 2"
-#define PLATFORM_NAME_RASPBERRY_PI_B_REV_2 "Raspberry Pi Model B Rev 2"
-#define PLATFORM_NAME_RASPBERRY_PI_B_PLUS_REV_1 "Raspberry Pi Model B+ Rev 1"
-#define PLATFORM_NAME_RASPBERRY_PI_COMPUTE_MODULE_REV_1 "Raspberry Pi Compute Module Rev 1"
-#define PLATFORM_NAME_RASPBERRY_PI_A_PLUS_REV_1 "Raspberry Pi Model A+ Rev 1"
-#define PLATFORM_NAME_RASPBERRY_PI2_B_REV_1 "Raspberry Pi 2 Model B Rev 1"
-#define PLATFORM_RASPBERRY_PI_B_REV_1 1
-#define PLATFORM_RASPBERRY_PI_A_REV_2 2
-#define PLATFORM_RASPBERRY_PI_B_REV_2 3
-#define PLATFORM_RASPBERRY_PI_B_PLUS_REV_1 4
-#define PLATFORM_RASPBERRY_PI_COMPUTE_MODULE_REV_1 5
-#define PLATFORM_RASPBERRY_PI_A_PLUS_REV_1 6
-#define PLATFORM_RASPBERRY_PI2_B_REV_1 7
-#define MMAP_PATH "/dev/mem"
-#define BCM2835_PERI_BASE 0x20000000
-#define BCM2835_GPIO_BASE (BCM2835_PERI_BASE + 0x200000)
-#define BCM2836_PERI_BASE 0x3f000000
-#define BCM2836_GPIO_BASE (BCM2836_PERI_BASE + 0x200000)
-#define BCM2835_BLOCK_SIZE (4 * 1024)
-#define BCM2836_BLOCK_SIZE (4 * 1024)
-#define BCM283X_GPSET0 0x001c
-#define BCM283X_GPCLR0 0x0028
-#define BCM2835_GPLEV0 0x0034
-#define MAX_SIZE 64
-
-// MMAP
-static uint8_t* mmap_reg = NULL;
-static int mmap_fd = 0;
-static int mmap_size;
-static unsigned int mmap_count = 0;
-static int platform_detected = 0;
-
-mraa_result_t
-mraa_raspberry_pi_spi_init_pre(int index)
-{
- char devpath[MAX_SIZE];
- sprintf(devpath, "/dev/spidev%u.0", plat->spi_bus[index].bus_id);
- if (!mraa_file_exist(devpath)) {
- syslog(LOG_ERR, "spi: Device not initialized");
- syslog(LOG_ERR, "spi: If you run a kernel >=3.18 then you will have to add dtparam=spi=on "
- "to /boot/config.txt and reboot");
- syslog(LOG_INFO, "spi: trying modprobe for spi-bcm2708");
- system("modprobe spi-bcm2708 >/dev/null 2>&1");
- system("modprobe spi_bcm2708 >/dev/null 2>&1");
- if (!mraa_file_exist(devpath)) {
- return MRAA_ERROR_NO_RESOURCES;
- }
- }
- return MRAA_SUCCESS;
-}
-
-mraa_result_t
-mraa_raspberry_pi_i2c_init_pre(unsigned int bus)
-{
- char devpath[MAX_SIZE];
- sprintf(devpath, "/dev/i2c-%u", bus);
- if (!mraa_file_exist(devpath)) {
- syslog(LOG_INFO, "spi: trying modprobe for i2c-bcm2708 & i2c-dev");
- system("modprobe i2c-bcm2708 >/dev/null 2>&1");
- system("modprobe i2c-dev >/dev/null 2>&1");
- system("modprobe i2c_bcm2708 >/dev/null 2>&1");
- system("modprobe i2c_dev >/dev/null 2>&1");
- }
- if (!mraa_file_exist(devpath)) {
- syslog(LOG_ERR, "i2c: Device not initialized");
- if (platform_detected == PLATFORM_RASPBERRY_PI_B_REV_1) {
- syslog(LOG_ERR, "i2c: If you run a kernel >=3.18 then you will have to add "
- "dtparam=i2c0=on to /boot/config.txt and reboot");
- } else {
- syslog(LOG_ERR, "i2c: If you run a kernel >=3.18 then you will have to add "
- "dtparam=i2c1=on to /boot/config.txt and reboot");
- }
- return MRAA_ERROR_NO_RESOURCES;
- }
- return MRAA_SUCCESS;
-}
-
-mraa_result_t
-mraa_raspberry_pi_mmap_write(mraa_gpio_context dev, int value)
-{
- volatile uint32_t* addr;
- if (value) {
- *(volatile uint32_t*) (mmap_reg + BCM283X_GPSET0 + (dev->pin / 32) * 4) =
- (uint32_t)(1 << (dev->pin % 32));
- } else {
- *(volatile uint32_t*) (mmap_reg + BCM283X_GPCLR0 + (dev->pin / 32) * 4) =
- (uint32_t)(1 << (dev->pin % 32));
- }
- return MRAA_SUCCESS;
-}
-
-static mraa_result_t
-mraa_raspberry_pi_mmap_unsetup()
-{
- if (mmap_reg == NULL) {
- syslog(LOG_ERR, "raspberry mmap: null register cant unsetup");
- return MRAA_ERROR_INVALID_RESOURCE;
- }
- munmap(mmap_reg, mmap_size);
- mmap_reg = NULL;
- if (close(mmap_fd) != 0) {
- return MRAA_ERROR_INVALID_RESOURCE;
- }
- return MRAA_SUCCESS;
-}
-
-int
-mraa_raspberry_pi_mmap_read(mraa_gpio_context dev)
-{
- uint32_t value = *(volatile uint32_t*) (mmap_reg + BCM2835_GPLEV0 + (dev->pin / 32) * 4);
- if (value & (uint32_t)(1 << (dev->pin % 32))) {
- return 1;
- }
- return 0;
-}
-
-mraa_result_t
-mraa_raspberry_pi_mmap_setup(mraa_gpio_context dev, mraa_boolean_t en)
-{
- if (dev == NULL) {
- syslog(LOG_ERR, "raspberry mmap: context not valid");
- return MRAA_ERROR_INVALID_HANDLE;
- }
-
- if (en == 0) {
- if (dev->mmap_write == NULL && dev->mmap_read == NULL) {
- syslog(LOG_ERR, "raspberry mmap: can't disable disabled mmap gpio");
- return MRAA_ERROR_INVALID_PARAMETER;
- }
- dev->mmap_write = NULL;
- dev->mmap_read = NULL;
- mmap_count--;
- if (mmap_count == 0) {
- return mraa_raspberry_pi_mmap_unsetup();
- }
- return MRAA_SUCCESS;
- }
-
- if (dev->mmap_write != NULL && dev->mmap_read != NULL) {
- syslog(LOG_ERR, "raspberry mmap: can't enable enabled mmap gpio");
- return MRAA_ERROR_INVALID_PARAMETER;
- }
-
- // Might need to make some elements of this thread safe.
- // For example only allow one thread to enter the following block
- // to prevent mmap'ing twice.
- if (mmap_reg == NULL) {
- if ((mmap_fd = open(MMAP_PATH, O_RDWR)) < 0) {
- syslog(LOG_ERR, "raspberry map: unable to open resource0 file");
- return MRAA_ERROR_INVALID_HANDLE;
- }
-
- if (platform_detected == PLATFORM_RASPBERRY_PI2_B_REV_1) {
- mmap_reg = (uint8_t*) mmap(NULL, BCM2836_BLOCK_SIZE, PROT_READ | PROT_WRITE,
- MAP_FILE | MAP_SHARED, mmap_fd, BCM2836_GPIO_BASE);
- } else {
- mmap_reg = (uint8_t*) mmap(NULL, BCM2835_BLOCK_SIZE, PROT_READ | PROT_WRITE,
- MAP_FILE | MAP_SHARED, mmap_fd, BCM2835_GPIO_BASE);
- }
- if (mmap_reg == MAP_FAILED) {
- syslog(LOG_ERR, "raspberry mmap: failed to mmap");
- mmap_reg = NULL;
- close(mmap_fd);
- return MRAA_ERROR_NO_RESOURCES;
- }
- }
- dev->mmap_write = &mraa_raspberry_pi_mmap_write;
- dev->mmap_read = &mraa_raspberry_pi_mmap_read;
- mmap_count++;
-
- return MRAA_SUCCESS;
-}
-
-mraa_board_t*
-mraa_raspberry_pi()
-{
- mraa_board_t* b = (mraa_board_t*) calloc(1, sizeof(mraa_board_t));
- if (b == NULL) {
- return NULL;
- }
- b->phy_pin_count = 0;
-
- size_t len = 100;
- char* line = calloc(len, sizeof(char));
-
- FILE* fh = fopen("/proc/cpuinfo", "r");
- if (fh != NULL) {
- while (getline(&line, &len, fh) != -1) {
- if (strncmp(line, "Revision", 8) == 0) {
- if (strstr(line, "0002") || strstr(line, "0003")) {
- b->platform_name = PLATFORM_NAME_RASPBERRY_PI_B_REV_1;
- platform_detected = PLATFORM_RASPBERRY_PI_B_REV_1;
- b->phy_pin_count = MRAA_RASPBERRY_PI_B_REV_1_PINCOUNT;
- } else if (strstr(line, "0004") || strstr(line, "0005") || strstr(line, "0006") ||
- strstr(line, "000d") || strstr(line, "000e") || strstr(line, "000f")) {
- b->platform_name = PLATFORM_NAME_RASPBERRY_PI_B_REV_2;
- platform_detected = PLATFORM_RASPBERRY_PI_B_REV_2;
- b->phy_pin_count = MRAA_RASPBERRY_PI_AB_REV_2_PINCOUNT;
- } else if (strstr(line, "0007") || strstr(line, "0008") || strstr(line, "0009")) {
- b->platform_name = PLATFORM_NAME_RASPBERRY_PI_A_REV_2;
- platform_detected = PLATFORM_RASPBERRY_PI_A_REV_2;
- b->phy_pin_count = MRAA_RASPBERRY_PI_AB_REV_2_PINCOUNT;
- } else if (strstr(line, "0010")) {
- b->platform_name = PLATFORM_NAME_RASPBERRY_PI_B_PLUS_REV_1;
- platform_detected = PLATFORM_RASPBERRY_PI_B_PLUS_REV_1;
- b->phy_pin_count = MRAA_RASPBERRY_PI_AB_PLUS_PINCOUNT;
- } else if (strstr(line, "0011")) {
- b->platform_name = PLATFORM_NAME_RASPBERRY_PI_COMPUTE_MODULE_REV_1;
- platform_detected = PLATFORM_RASPBERRY_PI_COMPUTE_MODULE_REV_1;
- b->phy_pin_count = MRAA_RASPBERRY_PI_COMPUTE_MODULE_PINCOUNT;
- } else if (strstr(line, "0012")) {
- b->platform_name = PLATFORM_NAME_RASPBERRY_PI_A_PLUS_REV_1;
- platform_detected = PLATFORM_RASPBERRY_PI_A_PLUS_REV_1;
- b->phy_pin_count = MRAA_RASPBERRY_PI_AB_PLUS_PINCOUNT;
- } else if (strstr(line, "a01041") || strstr(line, "a21041")) {
- b->platform_name = PLATFORM_NAME_RASPBERRY_PI2_B_REV_1;
- platform_detected = PLATFORM_RASPBERRY_PI2_B_REV_1;
- b->phy_pin_count = MRAA_RASPBERRY_PI2_B_REV_1_PINCOUNT;
- } else {
- b->platform_name = PLATFORM_NAME_RASPBERRY_PI_B_REV_1;
- platform_detected = PLATFORM_RASPBERRY_PI_B_REV_1;
- b->phy_pin_count = MRAA_RASPBERRY_PI_B_REV_1_PINCOUNT;
- }
- }
- }
- fclose(fh);
- }
- free(line);
-
- b->aio_count = 0;
- b->adc_raw = 0;
- b->adc_supported = 0;
- b->pwm_default_period = 500;
- b->pwm_max_period = 2147483;
- b->pwm_min_period = 1;
-
- if (b->phy_pin_count == 0) {
- free(b);
- syslog(LOG_ERR, "raspberrypi: Failed to detect platform revision");
- return NULL;
- }
-
- b->adv_func = (mraa_adv_func_t*) calloc(1, sizeof(mraa_adv_func_t));
- if (b->adv_func == NULL) {
- free(b);
- return NULL;
- }
-
- b->pins = (mraa_pininfo_t*) calloc(b->phy_pin_count, sizeof(mraa_pininfo_t));
- if (b->pins == NULL) {
- free(b->adv_func);
- free(b);
- return NULL;
- }
-
- b->adv_func->spi_init_pre = &mraa_raspberry_pi_spi_init_pre;
- b->adv_func->i2c_init_pre = &mraa_raspberry_pi_i2c_init_pre;
- b->adv_func->gpio_mmap_setup = &mraa_raspberry_pi_mmap_setup;
-
- strncpy(b->pins[0].name, "INVALID", MRAA_PIN_NAME_SIZE);
- b->pins[0].capabilites = (mraa_pincapabilities_t){ 0, 0, 0, 0, 0, 0, 0, 0 };
-
- strncpy(b->pins[1].name, "3V3", MRAA_PIN_NAME_SIZE);
- b->pins[1].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
-
- strncpy(b->pins[2].name, "5V", MRAA_PIN_NAME_SIZE);
- b->pins[2].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
-
- strncpy(b->pins[3].name, "SDA0", MRAA_PIN_NAME_SIZE);
- b->pins[3].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 1, 0, 0 };
- b->pins[3].gpio.pinmap = 2;
- b->pins[3].gpio.mux_total = 0;
- b->pins[3].i2c.pinmap = 0;
- b->pins[3].i2c.mux_total = 0;
-
- strncpy(b->pins[4].name, "5V", MRAA_PIN_NAME_SIZE);
- b->pins[4].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
-
- strncpy(b->pins[5].name, "SCL0", MRAA_PIN_NAME_SIZE);
- b->pins[5].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 1, 0, 0 };
- b->pins[5].gpio.pinmap = 3;
- b->pins[5].gpio.mux_total = 0;
- b->pins[5].i2c.pinmap = 0;
- b->pins[5].i2c.mux_total = 0;
-
- strncpy(b->pins[6].name, "GND", MRAA_PIN_NAME_SIZE);
- b->pins[6].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
-
- strncpy(b->pins[7].name, "GPIO4", MRAA_PIN_NAME_SIZE);
- b->pins[7].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[7].gpio.pinmap = 4;
- b->pins[7].gpio.mux_total = 0;
-
- strncpy(b->pins[8].name, "UART_TX", MRAA_PIN_NAME_SIZE);
- b->pins[8].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 1 };
- b->pins[8].gpio.pinmap = 14;
- b->pins[8].gpio.mux_total = 0;
- b->pins[8].uart.parent_id = 0;
- b->pins[8].uart.mux_total = 0;
-
- strncpy(b->pins[9].name, "GND", MRAA_PIN_NAME_SIZE);
- b->pins[9].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
-
- strncpy(b->pins[10].name, "UART_RX", MRAA_PIN_NAME_SIZE);
- b->pins[10].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 1 };
- b->pins[10].gpio.pinmap = 15;
- b->pins[10].gpio.mux_total = 0;
- b->pins[10].uart.parent_id = 0;
- b->pins[10].uart.mux_total = 0;
-
- strncpy(b->pins[11].name, "GPIO17", MRAA_PIN_NAME_SIZE);
- b->pins[11].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[11].gpio.pinmap = 17;
- b->pins[11].gpio.mux_total = 0;
-
- strncpy(b->pins[12].name, "GPIO18", MRAA_PIN_NAME_SIZE);
- b->pins[12].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[12].gpio.pinmap = 18;
- b->pins[12].gpio.mux_total = 0;
-
- if (platform_detected == PLATFORM_RASPBERRY_PI_B_REV_1) {
- strncpy(b->pins[13].name, "GPIO21", MRAA_PIN_NAME_SIZE);
- b->pins[13].gpio.pinmap = 21;
- } else {
- strncpy(b->pins[13].name, "GPIO27", MRAA_PIN_NAME_SIZE);
- b->pins[13].gpio.pinmap = 27;
- }
- b->pins[13].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[13].gpio.mux_total = 0;
-
- strncpy(b->pins[14].name, "GND", MRAA_PIN_NAME_SIZE);
- b->pins[14].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
-
- strncpy(b->pins[15].name, "GPIO22", MRAA_PIN_NAME_SIZE);
- b->pins[15].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[15].gpio.pinmap = 22;
- b->pins[15].gpio.mux_total = 0;
-
- strncpy(b->pins[16].name, "GPIO23", MRAA_PIN_NAME_SIZE);
- b->pins[16].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[16].gpio.pinmap = 23;
- b->pins[16].gpio.mux_total = 0;
-
- strncpy(b->pins[17].name, "3V3", MRAA_PIN_NAME_SIZE);
- b->pins[17].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
-
- strncpy(b->pins[18].name, "GPIO24", MRAA_PIN_NAME_SIZE);
- b->pins[18].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[18].gpio.pinmap = 24;
- b->pins[18].gpio.mux_total = 0;
-
- strncpy(b->pins[19].name, "SPI_MOSI", MRAA_PIN_NAME_SIZE);
- b->pins[19].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 1, 0, 0, 0 };
- b->pins[19].gpio.pinmap = 10;
- b->pins[19].gpio.mux_total = 0;
- b->pins[19].spi.pinmap = 0;
- b->pins[19].spi.mux_total = 0;
-
- strncpy(b->pins[20].name, "GND", MRAA_PIN_NAME_SIZE);
- b->pins[20].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
-
- strncpy(b->pins[21].name, "SPI_MISO", MRAA_PIN_NAME_SIZE);
- b->pins[21].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 1, 0, 0, 0 };
- b->pins[21].gpio.pinmap = 9;
- b->pins[21].gpio.mux_total = 0;
- b->pins[21].spi.pinmap = 0;
- b->pins[21].spi.mux_total = 0;
-
- strncpy(b->pins[22].name, "GPIO25", MRAA_PIN_NAME_SIZE);
- b->pins[22].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[22].gpio.pinmap = 25;
- b->pins[22].gpio.mux_total = 0;
-
- strncpy(b->pins[23].name, "SPI_CLK", MRAA_PIN_NAME_SIZE);
- b->pins[23].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 1, 0, 0, 0 };
- b->pins[23].gpio.pinmap = 11;
- b->pins[23].gpio.mux_total = 0;
- b->pins[23].spi.pinmap = 0;
- b->pins[23].spi.mux_total = 0;
-
- strncpy(b->pins[24].name, "SPI_CS0", MRAA_PIN_NAME_SIZE);
- b->pins[24].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 1, 0, 0, 0 };
- b->pins[24].gpio.pinmap = 8;
- b->pins[24].gpio.mux_total = 0;
- b->pins[24].spi.pinmap = 0;
- b->pins[24].spi.mux_total = 0;
-
- strncpy(b->pins[25].name, "GND", MRAA_PIN_NAME_SIZE);
- b->pins[25].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
-
- strncpy(b->pins[26].name, "SPI_CS1", MRAA_PIN_NAME_SIZE);
- b->pins[26].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 1, 0, 0, 0 };
- b->pins[26].gpio.pinmap = 7;
- b->pins[26].gpio.mux_total = 0;
- b->pins[26].spi.pinmap = 0;
- b->pins[26].spi.mux_total = 0;
-
- if ((platform_detected == PLATFORM_RASPBERRY_PI_A_REV_2) ||
- (platform_detected == PLATFORM_RASPBERRY_PI_B_REV_2)) {
- strncpy(b->pins[27].name, "5V", MRAA_PIN_NAME_SIZE);
- b->pins[27].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
-
- strncpy(b->pins[28].name, "3V3", MRAA_PIN_NAME_SIZE);
- b->pins[28].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
-
- strncpy(b->pins[29].name, "GPIO8", MRAA_PIN_NAME_SIZE);
- b->pins[29].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[29].gpio.pinmap = 8;
- b->pins[29].gpio.mux_total = 0;
-
- strncpy(b->pins[30].name, "GPIO9", MRAA_PIN_NAME_SIZE);
- b->pins[30].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[30].gpio.pinmap = 9;
- b->pins[30].gpio.mux_total = 0;
-
- strncpy(b->pins[31].name, "GPIO10", MRAA_PIN_NAME_SIZE);
- b->pins[31].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[31].gpio.pinmap = 10;
- b->pins[31].gpio.mux_total = 0;
-
- strncpy(b->pins[32].name, "GPIO11", MRAA_PIN_NAME_SIZE);
- b->pins[32].gpio.pinmap = 11;
- b->pins[32].gpio.mux_total = 0;
- b->pins[32].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
-
- strncpy(b->pins[33].name, "GND", MRAA_PIN_NAME_SIZE);
- b->pins[33].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
-
- strncpy(b->pins[34].name, "GND", MRAA_PIN_NAME_SIZE);
- b->pins[34].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- }
-
- // BUS DEFINITIONS
- b->i2c_bus_count = 1;
- b->def_i2c_bus = 0;
- if (platform_detected == PLATFORM_RASPBERRY_PI_B_REV_1)
- b->i2c_bus[0].bus_id = 0;
- else
- b->i2c_bus[0].bus_id = 1;
- b->i2c_bus[0].sda = 3;
- b->i2c_bus[0].scl = 5;
-
- b->spi_bus_count = 1;
- b->def_spi_bus = 0;
- b->spi_bus[0].bus_id = 0;
- b->spi_bus[0].slave_s = 0;
- b->spi_bus[0].cs = 24;
- b->spi_bus[0].mosi = 19;
- b->spi_bus[0].miso = 21;
- b->spi_bus[0].sclk = 23;
-
- b->uart_dev_count = 1;
- b->def_uart_dev = 0;
- b->uart_dev[0].rx = 10;
- b->uart_dev[0].tx = 8;
-
- if ((platform_detected == PLATFORM_RASPBERRY_PI_A_PLUS_REV_1) ||
- (platform_detected == PLATFORM_RASPBERRY_PI_B_PLUS_REV_1) ||
- (platform_detected == PLATFORM_RASPBERRY_PI2_B_REV_1)) {
-
- strncpy(b->pins[27].name, "ID_SD", MRAA_PIN_NAME_SIZE);
- b->pins[27].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
-
- strncpy(b->pins[28].name, "ID_SC", MRAA_PIN_NAME_SIZE);
- b->pins[28].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
-
- strncpy(b->pins[29].name, "GPIO05", MRAA_PIN_NAME_SIZE);
- b->pins[29].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[29].gpio.pinmap = 5;
- b->pins[29].gpio.mux_total = 0;
-
- strncpy(b->pins[30].name, "GND", MRAA_PIN_NAME_SIZE);
- b->pins[30].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
-
- strncpy(b->pins[31].name, "GPIO06", MRAA_PIN_NAME_SIZE);
- b->pins[31].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[31].gpio.pinmap = 6;
- b->pins[31].gpio.mux_total = 0;
-
- strncpy(b->pins[32].name, "GPIO12", MRAA_PIN_NAME_SIZE);
- b->pins[32].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[32].gpio.pinmap = 12;
- b->pins[32].gpio.mux_total = 0;
-
- strncpy(b->pins[33].name, "GPIO13", MRAA_PIN_NAME_SIZE);
- b->pins[33].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[33].gpio.pinmap = 13;
- b->pins[33].gpio.mux_total = 0;
-
- strncpy(b->pins[34].name, "GND", MRAA_PIN_NAME_SIZE);
- b->pins[34].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
-
- strncpy(b->pins[35].name, "GPIO19", MRAA_PIN_NAME_SIZE);
- b->pins[35].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[35].gpio.pinmap = 19;
- b->pins[35].gpio.mux_total = 0;
-
- strncpy(b->pins[36].name, "GPIO16", MRAA_PIN_NAME_SIZE);
- b->pins[36].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[36].gpio.pinmap = 16;
- b->pins[36].gpio.mux_total = 0;
-
- strncpy(b->pins[37].name, "GPIO26", MRAA_PIN_NAME_SIZE);
- b->pins[37].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[37].gpio.pinmap = 26;
- b->pins[37].gpio.mux_total = 0;
-
- strncpy(b->pins[38].name, "GPIO20", MRAA_PIN_NAME_SIZE);
- b->pins[38].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[38].gpio.pinmap = 20;
- b->pins[38].gpio.mux_total = 0;
-
- strncpy(b->pins[39].name, "GND", MRAA_PIN_NAME_SIZE);
- b->pins[39].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
-
- strncpy(b->pins[40].name, "GPIO21", MRAA_PIN_NAME_SIZE);
- b->pins[40].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[40].gpio.pinmap = 21;
- b->pins[40].gpio.mux_total = 0;
- }
-
- b->gpio_count = 0;
- int i;
- for (i = 0; i < b->phy_pin_count; i++) {
- if (b->pins[i].capabilites.gpio) {
- b->gpio_count++;
- }
- }
-
- return b;
-}
diff --git a/peripheral/libmraa/src/doxy2swig.py b/peripheral/libmraa/src/doxy2swig.py
deleted file mode 100755
index b3bb3d6..0000000
--- a/peripheral/libmraa/src/doxy2swig.py
+++ /dev/null
@@ -1,457 +0,0 @@
-#!/usr/bin/env python2
-"""Doxygen XML to SWIG docstring converter.
-
-Usage:
-
- doxy2swig.py [options] input.xml output.i
-
-Converts Doxygen generated XML files into a file containing docstrings
-that can be used by SWIG-1.3.x. Note that you need to get SWIG
-version > 1.3.23 or use Robin Dunn's docstring patch to be able to use
-the resulting output.
-
-input.xml is your doxygen generated XML file and output.i is where the
-output will be written (the file will be clobbered).
-
-"""
-#
-#
-# This code is implemented using Mark Pilgrim's code as a guideline:
-# http://www.faqs.org/docs/diveintopython/kgp_divein.html
-#
-# Author: Prabhu Ramachandran
-# License: BSD style
-#
-# Thanks:
-# Johan Hake: the include_function_definition feature
-# Bill Spotz: bug reports and testing.
-# Sebastian Henschel: Misc. enhancements.
-#
-#
-
-from xml.dom import minidom
-import re
-import textwrap
-import sys
-import os.path
-import optparse
-
-
-def my_open_read(source):
- if hasattr(source, "read"):
- return source
- else:
- return open(source)
-
-
-def my_open_write(dest):
- if hasattr(dest, "write"):
- return dest
- else:
- return open(dest, 'w')
-
-
-class Doxy2SWIG:
-
- """Converts Doxygen generated XML files into a file containing
- docstrings that can be used by SWIG-1.3.x that have support for
- feature("docstring"). Once the data is parsed it is stored in
- self.pieces.
-
- """
-
- def __init__(self, src, include_function_definition=True, quiet=False):
- """Initialize the instance given a source object. `src` can
- be a file or filename. If you do not want to include function
- definitions from doxygen then set
- `include_function_definition` to `False`. This is handy since
- this allows you to use the swig generated function definition
- using %feature("autodoc", [0,1]).
-
- """
- f = my_open_read(src)
- self.my_dir = os.path.dirname(f.name)
- self.xmldoc = minidom.parse(f).documentElement
- f.close()
-
- self.pieces = []
- self.pieces.append('\n// File: %s\n' %
- os.path.basename(f.name))
-
- self.space_re = re.compile(r'\s+')
- self.lead_spc = re.compile(r'^(%feature\S+\s+\S+\s*?)"\s+(\S)')
- self.multi = 0
- self.ignores = ['inheritancegraph', 'param', 'listofallmembers',
- 'innerclass', 'name', 'declname', 'incdepgraph',
- 'invincdepgraph', 'programlisting', 'type',
- 'references', 'referencedby', 'location',
- 'collaborationgraph', 'reimplements',
- 'reimplementedby', 'derivedcompoundref',
- 'basecompoundref']
- #self.generics = []
- self.include_function_definition = include_function_definition
- if not include_function_definition:
- self.ignores.append('argsstring')
-
- self.quiet = quiet
-
- def generate(self):
- """Parses the file set in the initialization. The resulting
- data is stored in `self.pieces`.
-
- """
- self.parse(self.xmldoc)
-
- def parse(self, node):
- """Parse a given node. This function in turn calls the
- `parse_<nodeType>` functions which handle the respective
- nodes.
-
- """
- pm = getattr(self, "parse_%s" % node.__class__.__name__)
- pm(node)
-
- def parse_Document(self, node):
- self.parse(node.documentElement)
-
- def parse_Text(self, node):
- txt = node.data
- txt = txt.replace('\\', r'\\\\')
- txt = txt.replace('"', r'\"')
- # ignore pure whitespace
- m = self.space_re.match(txt)
- if m and len(m.group()) == len(txt):
- pass
- else:
- self.add_text(textwrap.fill(txt, break_long_words=False))
-
- def parse_Element(self, node):
- """Parse an `ELEMENT_NODE`. This calls specific
- `do_<tagName>` handers for different elements. If no handler
- is available the `generic_parse` method is called. All
- tagNames specified in `self.ignores` are simply ignored.
-
- """
- name = node.tagName
- ignores = self.ignores
- if name in ignores:
- return
- attr = "do_%s" % name
- if hasattr(self, attr):
- handlerMethod = getattr(self, attr)
- handlerMethod(node)
- else:
- self.generic_parse(node)
- #if name not in self.generics: self.generics.append(name)
-
- def parse_Comment(self, node):
- """Parse a `COMMENT_NODE`. This does nothing for now."""
- return
-
- def add_text(self, value):
- """Adds text corresponding to `value` into `self.pieces`."""
- if isinstance(value, (list, tuple)):
- self.pieces.extend(value)
- else:
- self.pieces.append(value)
-
- def get_specific_nodes(self, node, names):
- """Given a node and a sequence of strings in `names`, return a
- dictionary containing the names as keys and child
- `ELEMENT_NODEs`, that have a `tagName` equal to the name.
-
- """
- nodes = [(x.tagName, x) for x in node.childNodes
- if x.nodeType == x.ELEMENT_NODE and
- x.tagName in names]
- return dict(nodes)
-
- def generic_parse(self, node, pad=0):
- """A Generic parser for arbitrary tags in a node.
-
- Parameters:
-
- - node: A node in the DOM.
- - pad: `int` (default: 0)
-
- If 0 the node data is not padded with newlines. If 1 it
- appends a newline after parsing the childNodes. If 2 it
- pads before and after the nodes are processed. Defaults to
- 0.
-
- """
- npiece = 0
- if pad:
- npiece = len(self.pieces)
- if pad == 2:
- self.add_text('\n')
- for n in node.childNodes:
- self.parse(n)
- if pad:
- if len(self.pieces) > npiece:
- self.add_text('\n')
-
- def space_parse(self, node):
- self.add_text(' ')
- self.generic_parse(node)
-
- do_ref = space_parse
- do_emphasis = space_parse
- do_bold = space_parse
- do_computeroutput = space_parse
- do_formula = space_parse
-
- def do_compoundname(self, node):
- self.add_text('\n\n')
- data = node.firstChild.data
- self.add_text('%%feature("docstring") %s "\n' % data)
-
- def do_compounddef(self, node):
- kind = node.attributes['kind'].value
- if kind in ('class', 'struct'):
- prot = node.attributes['prot'].value
- if prot != 'public':
- return
- names = ('compoundname', 'briefdescription',
- 'detaileddescription', 'includes')
- first = self.get_specific_nodes(node, names)
- for n in names:
- if first.has_key(n):
- self.parse(first[n])
- self.add_text(['";', '\n'])
- for n in node.childNodes:
- if n not in first.values():
- self.parse(n)
- elif kind in ('file', 'namespace'):
- nodes = node.getElementsByTagName('sectiondef')
- for n in nodes:
- self.parse(n)
-
- def do_includes(self, node):
- self.add_text('C++ includes: ')
- self.generic_parse(node, pad=1)
-
- def do_parameterlist(self, node):
- text = 'unknown'
- for key, val in node.attributes.items():
- if key == 'kind':
- if val == 'param':
- text = 'Parameters'
- elif val == 'exception':
- text = 'Exceptions'
- elif val == 'retval':
- text = 'Returns'
- else:
- text = val
- break
- self.add_text(['\n', '\n', text, ':', '\n'])
- self.generic_parse(node, pad=1)
-
- def do_para(self, node):
- self.add_text('\n')
- self.generic_parse(node, pad=1)
-
- def do_parametername(self, node):
- self.add_text('\n')
- try:
- data = node.firstChild.data
- except AttributeError: # perhaps a <ref> tag in it
- data = node.firstChild.firstChild.data
- if data.find('Exception') != -1:
- self.add_text(data)
- else:
- self.add_text("%s: " % data)
-
- def do_parameterdefinition(self, node):
- self.generic_parse(node, pad=1)
-
- def do_detaileddescription(self, node):
- self.generic_parse(node, pad=1)
-
- def do_briefdescription(self, node):
- self.generic_parse(node, pad=1)
-
- def do_memberdef(self, node):
- prot = node.attributes['prot'].value
- id = node.attributes['id'].value
- kind = node.attributes['kind'].value
- tmp = node.parentNode.parentNode.parentNode
- compdef = tmp.getElementsByTagName('compounddef')[0]
- cdef_kind = compdef.attributes['kind'].value
-
- if prot == 'public':
- first = self.get_specific_nodes(node, ('definition', 'name'))
- name = first['name'].firstChild.data
- if name[:8] == 'operator': # Don't handle operators yet.
- return
-
- if not 'definition' in first or \
- kind in ['variable', 'typedef']:
- return
-
- if self.include_function_definition:
- defn = first['definition'].firstChild.data
- else:
- defn = ""
- self.add_text('\n')
- self.add_text('%feature("docstring") ')
-
- anc = node.parentNode.parentNode
- if cdef_kind in ('file', 'namespace'):
- ns_node = anc.getElementsByTagName('innernamespace')
- if not ns_node and cdef_kind == 'namespace':
- ns_node = anc.getElementsByTagName('compoundname')
- if ns_node:
- ns = ns_node[0].firstChild.data
- self.add_text(' %s::%s "\n%s' % (ns, name, defn))
- else:
- self.add_text(' %s "\n%s' % (name, defn))
- elif cdef_kind in ('class', 'struct'):
- # Get the full function name.
- anc_node = anc.getElementsByTagName('compoundname')
- cname = anc_node[0].firstChild.data
- self.add_text(' %s::%s "\n%s' % (cname, name, defn))
-
- for n in node.childNodes:
- if n not in first.values():
- self.parse(n)
- self.add_text(['";', '\n'])
-
- def do_definition(self, node):
- data = node.firstChild.data
- self.add_text('%s "\n%s' % (data, data))
-
- def do_sectiondef(self, node):
- kind = node.attributes['kind'].value
- if kind in ('public-func', 'func', 'user-defined', ''):
- self.generic_parse(node)
-
- def do_header(self, node):
- """For a user defined section def a header field is present
- which should not be printed as such, so we comment it in the
- output."""
- data = node.firstChild.data
- self.add_text('\n/*\n %s \n*/\n' % data)
- # If our immediate sibling is a 'description' node then we
- # should comment that out also and remove it from the parent
- # node's children.
- parent = node.parentNode
- idx = parent.childNodes.index(node)
- if len(parent.childNodes) >= idx + 2:
- nd = parent.childNodes[idx + 2]
- if nd.nodeName == 'description':
- nd = parent.removeChild(nd)
- self.add_text('\n/*')
- self.generic_parse(nd)
- self.add_text('\n*/\n')
-
- def do_simplesect(self, node):
- kind = node.attributes['kind'].value
- if kind in ('date', 'rcs', 'version'):
- pass
- elif kind == 'warning':
- self.add_text(['\n', 'WARNING: '])
- self.generic_parse(node)
- elif kind == 'see':
- self.add_text('\n')
- self.add_text('See: ')
- self.generic_parse(node)
- else:
- self.generic_parse(node)
-
- def do_argsstring(self, node):
- self.generic_parse(node, pad=1)
-
- def do_member(self, node):
- kind = node.attributes['kind'].value
- refid = node.attributes['refid'].value
- if kind == 'function' and refid[:9] == 'namespace':
- self.generic_parse(node)
-
- def do_doxygenindex(self, node):
- self.multi = 1
- comps = node.getElementsByTagName('compound')
- for c in comps:
- refid = c.attributes['refid'].value
- fname = refid + '.xml'
- if not os.path.exists(fname):
- fname = os.path.join(self.my_dir, fname)
- if not self.quiet:
- print("parsing file: %s" % fname)
- p = Doxy2SWIG(fname, self.include_function_definition, self.quiet)
- p.generate()
- self.pieces.extend(self.clean_pieces(p.pieces))
-
- def write(self, fname):
- o = my_open_write(fname)
- if self.multi:
- o.write("".join(x.encode('utf-8') for x in self.pieces))
- else:
- o.write("".join(self.clean_pieces(self.pieces)))
- o.close()
-
- def clean_pieces(self, pieces):
- """Cleans the list of strings given as `pieces`. It replaces
- multiple newlines by a maximum of 2 and returns a new list.
- It also wraps the paragraphs nicely.
-
- """
- ret = []
- count = 0
- for i in pieces:
- if i == '\n':
- count = count + 1
- else:
- if i == '";':
- if count:
- ret.append('\n')
- elif count > 2:
- ret.append('\n\n')
- elif count:
- ret.append('\n' * count)
- count = 0
- ret.append(i)
-
- _data = "".join(ret)
- ret = []
- for i in _data.split('\n\n'):
- if i == 'Parameters:' or i == 'Exceptions:' or i == 'Returns:':
- ret.extend([i, '\n' + '-' * len(i), '\n\n'])
- elif i.find('// File:') > -1: # leave comments alone.
- ret.extend([i, '\n'])
- else:
- _tmp = textwrap.fill(i.strip(), break_long_words=False)
- _tmp = self.lead_spc.sub(r'\1"\2', _tmp)
- ret.extend([_tmp, '\n\n'])
- return ret
-
-
-def convert(input, output, include_function_definition=True, quiet=False):
- p = Doxy2SWIG(input, include_function_definition, quiet)
- p.generate()
- p.write(output)
-
-
-def main():
- usage = __doc__
- parser = optparse.OptionParser(usage)
- parser.add_option("-n", '--no-function-definition',
- action='store_true',
- default=False,
- dest='func_def',
- help='do not include doxygen function definitions')
- parser.add_option("-q", '--quiet',
- action='store_true',
- default=False,
- dest='quiet',
- help='be quiet and minimize output')
-
- options, args = parser.parse_args()
- if len(args) != 2:
- parser.error("error: no input and output specified")
-
- convert(args[0], args[1], not options.func_def, options.quiet)
-
-
-if __name__ == '__main__':
- main()
diff --git a/peripheral/libmraa/src/glob/glob.c b/peripheral/libmraa/src/glob/glob.c
deleted file mode 100644
index 9108270..0000000
--- a/peripheral/libmraa/src/glob/glob.c
+++ /dev/null
@@ -1,1149 +0,0 @@
-/* $NetBSD: glob.c,v 1.35 2013/03/20 23:44:47 lukem Exp $ */
-
-/*
- * Copyright (c) 1989, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Guido van Rossum.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)glob.c 8.3 (Berkeley) 10/13/93";
-#else
-__RCSID("$NetBSD: glob.c,v 1.35 2013/03/20 23:44:47 lukem Exp $");
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-/*
- * glob(3) -- a superset of the one defined in POSIX 1003.2.
- *
- * The [!...] convention to negate a range is supported (SysV, Posix, ksh).
- *
- * Optional extra services, controlled by flags not defined by POSIX:
- *
- * GLOB_MAGCHAR:
- * Set in gl_flags if pattern contained a globbing character.
- * GLOB_NOMAGIC:
- * Same as GLOB_NOCHECK, but it will only append pattern if it did
- * not contain any magic characters. [Used in csh style globbing]
- * GLOB_ALTDIRFUNC:
- * Use alternately specified directory access functions.
- * GLOB_TILDE:
- * expand ~user/foo to the /home/dir/of/user/foo
- * GLOB_BRACE:
- * expand {1,2}{a,b} to 1a 1b 2a 2b
- * GLOB_PERIOD:
- * allow metacharacters to match leading dots in filenames.
- * GLOB_NO_DOTDIRS:
- * . and .. are hidden from wildcards, even if GLOB_PERIOD is set.
- * gl_matchc:
- * Number of matches in the current invocation of glob.
- */
-
-//#include "namespace.h"
-#include <sys/param.h>
-#include <sys/stat.h>
-
-#include <assert.h>
-#include <ctype.h>
-#include <dirent.h>
-#include <errno.h>
-#include <glob.h>
-#include <pwd.h>
-#include <stdio.h>
-#include <stddef.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#ifdef HAVE_NBTOOL_CONFIG_H
-#define NO_GETPW_R
-#endif
-
-#define GLOB_LIMIT_STRING 65536 /* number of readdirs */
-#define GLOB_LIMIT_STAT 128 /* number of stat system calls */
-#define GLOB_LIMIT_READDIR 16384 /* total buffer size of path strings */
-#define GLOB_LIMIT_PATH 1024 /* number of path elements */
-#define GLOB_LIMIT_BRACE 128 /* Number of brace calls */
-
-struct glob_limit {
- size_t l_string;
- size_t l_stat;
- size_t l_readdir;
- size_t l_brace;
-};
-
-/*
- * XXX: For NetBSD 1.4.x compatibility. (kill me l8r)
- */
-#ifndef _DIAGASSERT
-#define _DIAGASSERT(a)
-#endif
-
-#define DOLLAR '$'
-#define DOT '.'
-#define EOS '\0'
-#define LBRACKET '['
-#define NOT '!'
-#define QUESTION '?'
-#define QUOTE '\\'
-#define RANGE '-'
-#define RBRACKET ']'
-#define SEP '/'
-#define STAR '*'
-#define TILDE '~'
-#define UNDERSCORE '_'
-#define LBRACE '{'
-#define RBRACE '}'
-#define SLASH '/'
-#define COMMA ','
-
-#ifndef USE_8BIT_CHARS
-
-#define M_QUOTE 0x8000
-#define M_PROTECT 0x4000
-#define M_MASK 0xffff
-#define M_ASCII 0x00ff
-
-typedef unsigned short Char;
-
-#else
-
-#define M_QUOTE (Char)0x80
-#define M_PROTECT (Char)0x40
-#define M_MASK (Char)0xff
-#define M_ASCII (Char)0x7f
-
-typedef char Char;
-
-#endif
-
-
-#define CHAR(c) ((Char)((c)&M_ASCII))
-#define META(c) ((Char)((c)|M_QUOTE))
-#define M_ALL META('*')
-#define M_END META(']')
-#define M_NOT META('!')
-#define M_ONE META('?')
-#define M_RNG META('-')
-#define M_SET META('[')
-#define ismeta(c) (((c)&M_QUOTE) != 0)
-
-
-static int compare(const void *, const void *);
-static int g_Ctoc(const Char *, char *, size_t);
-static int g_lstat(Char *, __gl_stat_t *, glob_t *);
-static DIR *g_opendir(Char *, glob_t *);
-static Char *g_strchr(const Char *, int);
-static int g_stat(Char *, __gl_stat_t *, glob_t *);
-static int glob0(const Char *, glob_t *, struct glob_limit *);
-static int glob1(Char *, glob_t *, struct glob_limit *);
-static int glob2(Char *, Char *, Char *, const Char *, glob_t *,
- struct glob_limit *);
-static int glob3(Char *, Char *, Char *, const Char *, const Char *,
- const Char *, glob_t *, struct glob_limit *);
-static int globextend(const Char *, glob_t *, struct glob_limit *);
-static const Char *globtilde(const Char *, Char *, size_t, glob_t *);
-static int globexp1(const Char *, glob_t *, struct glob_limit *);
-static int globexp2(const Char *, const Char *, glob_t *, int *,
- struct glob_limit *);
-static int match(const Char *, const Char *, const Char *);
-#ifdef DEBUG
-static void qprintf(const char *, Char *);
-#endif
-
-int
-glob(const char * __restrict pattern, int flags, int (*errfunc)(const char *,
- int), glob_t * __restrict pglob)
-{
- const unsigned char *patnext;
- int c;
- Char *bufnext, *bufend, patbuf[MAXPATHLEN+1];
- struct glob_limit limit = { 0, 0, 0, 0 };
-
- _DIAGASSERT(pattern != NULL);
-
- patnext = (const unsigned char *) pattern;
- if (!(flags & GLOB_APPEND)) {
- pglob->gl_pathc = 0;
- pglob->gl_pathv = NULL;
- if (!(flags & GLOB_DOOFFS))
- pglob->gl_offs = 0;
- }
- pglob->gl_flags = flags & ~GLOB_MAGCHAR;
- pglob->gl_errfunc = errfunc;
- pglob->gl_matchc = 0;
-
- bufnext = patbuf;
- bufend = bufnext + MAXPATHLEN;
- if (flags & GLOB_NOESCAPE) {
- while (bufnext < bufend && (c = *patnext++) != EOS)
- *bufnext++ = c;
- } else {
- /* Protect the quoted characters. */
- while (bufnext < bufend && (c = *patnext++) != EOS)
- if (c == QUOTE) {
- if ((c = *patnext++) == EOS) {
- c = QUOTE;
- --patnext;
- }
- *bufnext++ = c | M_PROTECT;
- }
- else
- *bufnext++ = c;
- }
- *bufnext = EOS;
-
- if (flags & GLOB_BRACE)
- return globexp1(patbuf, pglob, &limit);
- else
- return glob0(patbuf, pglob, &limit);
-}
-
-/*
- * Expand recursively a glob {} pattern. When there is no more expansion
- * invoke the standard globbing routine to glob the rest of the magic
- * characters
- */
-static int
-globexp1(const Char *pattern, glob_t *pglob, struct glob_limit *limit)
-{
- const Char* ptr = pattern;
- int rv;
-
- _DIAGASSERT(pattern != NULL);
- _DIAGASSERT(pglob != NULL);
-
- if ((pglob->gl_flags & GLOB_LIMIT) &&
- limit->l_brace++ >= GLOB_LIMIT_BRACE) {
- errno = 0;
- return GLOB_NOSPACE;
- }
-
- /* Protect a single {}, for find(1), like csh */
- if (pattern[0] == LBRACE && pattern[1] == RBRACE && pattern[2] == EOS)
- return glob0(pattern, pglob, limit);
-
- while ((ptr = (const Char *) g_strchr(ptr, LBRACE)) != NULL)
- if (!globexp2(ptr, pattern, pglob, &rv, limit))
- return rv;
-
- return glob0(pattern, pglob, limit);
-}
-
-
-/*
- * Recursive brace globbing helper. Tries to expand a single brace.
- * If it succeeds then it invokes globexp1 with the new pattern.
- * If it fails then it tries to glob the rest of the pattern and returns.
- */
-static int
-globexp2(const Char *ptr, const Char *pattern, glob_t *pglob, int *rv,
- struct glob_limit *limit)
-{
- int i;
- Char *lm, *ls;
- const Char *pe, *pm, *pl;
- Char patbuf[MAXPATHLEN + 1];
-
- _DIAGASSERT(ptr != NULL);
- _DIAGASSERT(pattern != NULL);
- _DIAGASSERT(pglob != NULL);
- _DIAGASSERT(rv != NULL);
-
- /* copy part up to the brace */
- for (lm = patbuf, pm = pattern; pm != ptr; *lm++ = *pm++)
- continue;
- ls = lm;
-
- /* Find the balanced brace */
- for (i = 0, pe = ++ptr; *pe; pe++)
- if (*pe == LBRACKET) {
- /* Ignore everything between [] */
- for (pm = pe++; *pe != RBRACKET && *pe != EOS; pe++)
- continue;
- if (*pe == EOS) {
- /*
- * We could not find a matching RBRACKET.
- * Ignore and just look for RBRACE
- */
- pe = pm;
- }
- }
- else if (*pe == LBRACE)
- i++;
- else if (*pe == RBRACE) {
- if (i == 0)
- break;
- i--;
- }
-
- /* Non matching braces; just glob the pattern */
- if (i != 0 || *pe == EOS) {
- /*
- * we use `pattern', not `patbuf' here so that that
- * unbalanced braces are passed to the match
- */
- *rv = glob0(pattern, pglob, limit);
- return 0;
- }
-
- for (i = 0, pl = pm = ptr; pm <= pe; pm++) {
- switch (*pm) {
- case LBRACKET:
- /* Ignore everything between [] */
- for (pl = pm++; *pm != RBRACKET && *pm != EOS; pm++)
- continue;
- if (*pm == EOS) {
- /*
- * We could not find a matching RBRACKET.
- * Ignore and just look for RBRACE
- */
- pm = pl;
- }
- break;
-
- case LBRACE:
- i++;
- break;
-
- case RBRACE:
- if (i) {
- i--;
- break;
- }
- /* FALLTHROUGH */
- case COMMA:
- if (i && *pm == COMMA)
- break;
- else {
- /* Append the current string */
- for (lm = ls; (pl < pm); *lm++ = *pl++)
- continue;
- /*
- * Append the rest of the pattern after the
- * closing brace
- */
- for (pl = pe + 1; (*lm++ = *pl++) != EOS;)
- continue;
-
- /* Expand the current pattern */
-#ifdef DEBUG
- qprintf("globexp2", patbuf);
-#endif
- *rv = globexp1(patbuf, pglob, limit);
-
- /* move after the comma, to the next string */
- pl = pm + 1;
- }
- break;
-
- default:
- break;
- }
- }
- *rv = 0;
- return 0;
-}
-
-
-
-/*
- * expand tilde from the passwd file.
- */
-static const Char *
-globtilde(const Char *pattern, Char *patbuf, size_t patsize, glob_t *pglob)
-{
- struct passwd *pwd;
- const char *h;
- const Char *p;
- Char *b;
- char *d;
- Char *pend = &patbuf[patsize / sizeof(Char)];
-#ifndef NO_GETPW_R
- struct passwd pwres;
- char pwbuf[1024];
-#endif
-
- pend--;
-
- _DIAGASSERT(pattern != NULL);
- _DIAGASSERT(patbuf != NULL);
- _DIAGASSERT(pglob != NULL);
-
- if (*pattern != TILDE || !(pglob->gl_flags & GLOB_TILDE))
- return pattern;
-
- /* Copy up to the end of the string or / */
- for (p = pattern + 1, d = (char *)(void *)patbuf;
- d < (char *)(void *)pend && *p && *p != SLASH;
- *d++ = *p++)
- continue;
-
- if (d == (char *)(void *)pend)
- return NULL;
-
- *d = EOS;
- d = (char *)(void *)patbuf;
-
- if (*d == EOS) {
- /*
- * handle a plain ~ or ~/ by expanding $HOME
- * first and then trying the password file
- */
- if ((h = getenv("HOME")) == NULL) {
-#ifdef NO_GETPW_R
- if ((pwd = getpwuid(getuid())) == NULL)
-#else
- if (getpwuid_r(getuid(), &pwres, pwbuf, sizeof(pwbuf),
- &pwd) != 0 || pwd == NULL)
-#endif
- return pattern;
- else
- h = pwd->pw_dir;
- }
- }
- else {
- /*
- * Expand a ~user
- */
-#ifdef NO_GETPW_R
- if ((pwd = getpwnam(d)) == NULL)
-#else
- if (getpwnam_r(d, &pwres, pwbuf, sizeof(pwbuf), &pwd) != 0 ||
- pwd == NULL)
-#endif
- return pattern;
- else
- h = pwd->pw_dir;
- }
-
- /* Copy the home directory */
- for (b = patbuf; b < pend && *h; *b++ = *h++)
- continue;
-
- if (b == pend)
- return NULL;
-
- /* Append the rest of the pattern */
- while (b < pend && (*b++ = *p++) != EOS)
- continue;
-
- if (b == pend)
- return NULL;
-
- return patbuf;
-}
-
-
-/*
- * The main glob() routine: compiles the pattern (optionally processing
- * quotes), calls glob1() to do the real pattern matching, and finally
- * sorts the list (unless unsorted operation is requested). Returns 0
- * if things went well, nonzero if errors occurred. It is not an error
- * to find no matches.
- */
-static int
-glob0(const Char *pattern, glob_t *pglob, struct glob_limit *limit)
-{
- const Char *qpatnext;
- int c, error;
- __gl_size_t oldpathc;
- Char *bufnext, patbuf[MAXPATHLEN+1];
-
- _DIAGASSERT(pattern != NULL);
- _DIAGASSERT(pglob != NULL);
-
- if ((qpatnext = globtilde(pattern, patbuf, sizeof(patbuf),
- pglob)) == NULL)
- return GLOB_ABEND;
- oldpathc = pglob->gl_pathc;
- bufnext = patbuf;
-
- /* We don't need to check for buffer overflow any more. */
- while ((c = *qpatnext++) != EOS) {
- switch (c) {
- case LBRACKET:
- c = *qpatnext;
- if (c == NOT)
- ++qpatnext;
- if (*qpatnext == EOS ||
- g_strchr(qpatnext+1, RBRACKET) == NULL) {
- *bufnext++ = LBRACKET;
- if (c == NOT)
- --qpatnext;
- break;
- }
- *bufnext++ = M_SET;
- if (c == NOT)
- *bufnext++ = M_NOT;
- c = *qpatnext++;
- do {
- *bufnext++ = CHAR(c);
- if (*qpatnext == RANGE &&
- (c = qpatnext[1]) != RBRACKET) {
- *bufnext++ = M_RNG;
- *bufnext++ = CHAR(c);
- qpatnext += 2;
- }
- } while ((c = *qpatnext++) != RBRACKET);
- pglob->gl_flags |= GLOB_MAGCHAR;
- *bufnext++ = M_END;
- break;
- case QUESTION:
- pglob->gl_flags |= GLOB_MAGCHAR;
- *bufnext++ = M_ONE;
- break;
- case STAR:
- pglob->gl_flags |= GLOB_MAGCHAR;
- /* collapse adjacent stars to one [or three if globstar]
- * to avoid exponential behavior
- */
- if (bufnext == patbuf || bufnext[-1] != M_ALL ||
- ((pglob->gl_flags & GLOB_STAR) != 0 &&
- (bufnext - 1 == patbuf || bufnext[-2] != M_ALL ||
- bufnext - 2 == patbuf || bufnext[-3] != M_ALL)))
- *bufnext++ = M_ALL;
- break;
- default:
- *bufnext++ = CHAR(c);
- break;
- }
- }
- *bufnext = EOS;
-#ifdef DEBUG
- qprintf("glob0", patbuf);
-#endif
-
- if ((error = glob1(patbuf, pglob, limit)) != 0)
- return error;
-
- if (pglob->gl_pathc == oldpathc) {
- /*
- * If there was no match we are going to append the pattern
- * if GLOB_NOCHECK was specified or if GLOB_NOMAGIC was
- * specified and the pattern did not contain any magic
- * characters GLOB_NOMAGIC is there just for compatibility
- * with csh.
- */
- if ((pglob->gl_flags & GLOB_NOCHECK) ||
- ((pglob->gl_flags & (GLOB_NOMAGIC|GLOB_MAGCHAR))
- == GLOB_NOMAGIC)) {
- return globextend(pattern, pglob, limit);
- } else {
- return GLOB_NOMATCH;
- }
- } else if (!(pglob->gl_flags & GLOB_NOSORT)) {
- qsort(pglob->gl_pathv + pglob->gl_offs + oldpathc,
- (size_t)pglob->gl_pathc - oldpathc, sizeof(char *),
- compare);
- }
-
- return 0;
-}
-
-static int
-compare(const void *p, const void *q)
-{
-
- _DIAGASSERT(p != NULL);
- _DIAGASSERT(q != NULL);
-
- return strcoll(*(const char * const *)p, *(const char * const *)q);
-}
-
-static int
-glob1(Char *pattern, glob_t *pglob, struct glob_limit *limit)
-{
- Char pathbuf[MAXPATHLEN+1];
-
- _DIAGASSERT(pattern != NULL);
- _DIAGASSERT(pglob != NULL);
-
- /* A null pathname is invalid -- POSIX 1003.1 sect. 2.4. */
- if (*pattern == EOS)
- return 0;
- /*
- * we save one character so that we can use ptr >= limit,
- * in the general case when we are appending non nul chars only.
- */
- return glob2(pathbuf, pathbuf,
- pathbuf + (sizeof(pathbuf) / sizeof(*pathbuf)) - 1, pattern,
- pglob, limit);
-}
-
-/*
- * The functions glob2 and glob3 are mutually recursive; there is one level
- * of recursion for each segment in the pattern that contains one or more
- * meta characters.
- */
-static int
-glob2(Char *pathbuf, Char *pathend, Char *pathlim, const Char *pattern,
- glob_t *pglob, struct glob_limit *limit)
-{
- __gl_stat_t sb;
- const Char *p;
- Char *q;
- int anymeta;
-
- _DIAGASSERT(pathbuf != NULL);
- _DIAGASSERT(pathend != NULL);
- _DIAGASSERT(pattern != NULL);
- _DIAGASSERT(pglob != NULL);
-
-#ifdef DEBUG
- qprintf("glob2", pathbuf);
-#endif
- /*
- * Loop over pattern segments until end of pattern or until
- * segment with meta character found.
- */
- for (anymeta = 0;;) {
- if (*pattern == EOS) { /* End of pattern? */
- *pathend = EOS;
- if (g_lstat(pathbuf, &sb, pglob))
- return 0;
-
- if ((pglob->gl_flags & GLOB_LIMIT) &&
- limit->l_stat++ >= GLOB_LIMIT_STAT) {
- errno = 0;
- *pathend++ = SEP;
- *pathend = EOS;
- return GLOB_NOSPACE;
- }
- if (((pglob->gl_flags & GLOB_MARK) &&
- pathend[-1] != SEP) && (S_ISDIR(sb.st_mode) ||
- (S_ISLNK(sb.st_mode) &&
- (g_stat(pathbuf, &sb, pglob) == 0) &&
- S_ISDIR(sb.st_mode)))) {
- if (pathend >= pathlim)
- return GLOB_ABORTED;
- *pathend++ = SEP;
- *pathend = EOS;
- }
- ++pglob->gl_matchc;
- return globextend(pathbuf, pglob, limit);
- }
-
- /* Find end of next segment, copy tentatively to pathend. */
- q = pathend;
- p = pattern;
- while (*p != EOS && *p != SEP) {
- if (ismeta(*p))
- anymeta = 1;
- if (q >= pathlim)
- return GLOB_ABORTED;
- *q++ = *p++;
- }
-
- if (!anymeta) {
- pathend = q;
- pattern = p;
- while (*pattern == SEP) {
- if (pathend >= pathlim)
- return GLOB_ABORTED;
- *pathend++ = *pattern++;
- }
- } else /* Need expansion, recurse. */
- return glob3(pathbuf, pathend, pathlim, pattern, p,
- pattern, pglob, limit);
- }
- /* NOTREACHED */
-}
-
-static int
-glob3(Char *pathbuf, Char *pathend, Char *pathlim, const Char *pattern,
- const Char *restpattern, const Char *pglobstar, glob_t *pglob,
- struct glob_limit *limit)
-{
- struct dirent *dp;
- DIR *dirp;
- __gl_stat_t sbuf;
- int error;
- char buf[MAXPATHLEN];
- int globstar = 0;
- int chase_symlinks = 0;
- const Char *termstar = NULL;
-
- /*
- * The readdirfunc declaration can't be prototyped, because it is
- * assigned, below, to two functions which are prototyped in glob.h
- * and dirent.h as taking pointers to differently typed opaque
- * structures.
- */
- struct dirent *(*readdirfunc)(void *);
-
- _DIAGASSERT(pathbuf != NULL);
- _DIAGASSERT(pathend != NULL);
- _DIAGASSERT(pattern != NULL);
- _DIAGASSERT(restpattern != NULL);
- _DIAGASSERT(pglob != NULL);
-
- *pathend = EOS;
- errno = 0;
-
- while (pglobstar < restpattern) {
- if ((pglobstar[0] & M_MASK) == M_ALL &&
- (pglobstar[1] & M_MASK) == M_ALL) {
- globstar = 1;
- chase_symlinks = (pglobstar[2] & M_MASK) == M_ALL;
- termstar = pglobstar + (2 + chase_symlinks);
- break;
- }
- pglobstar++;
- }
-
- if (globstar) {
- error = pglobstar == pattern && termstar == restpattern ?
- *restpattern == EOS ?
- glob2(pathbuf, pathend, pathlim, restpattern - 1, pglob,
- limit) :
- glob2(pathbuf, pathend, pathlim, restpattern + 1, pglob,
- limit) :
- glob3(pathbuf, pathend, pathlim, pattern, restpattern,
- termstar, pglob, limit);
- if (error)
- return error;
- *pathend = EOS;
- }
-
- if (*pathbuf && (g_lstat(pathbuf, &sbuf, pglob) ||
- !S_ISDIR(sbuf.st_mode)
-#ifdef S_IFLINK
- && ((globstar && !chase_symlinks) || !S_ISLNK(sbuf.st_mode))
-#endif
- ))
- return 0;
-
- if ((dirp = g_opendir(pathbuf, pglob)) == NULL) {
- if (pglob->gl_errfunc) {
- if (g_Ctoc(pathbuf, buf, sizeof(buf)))
- return GLOB_ABORTED;
- if (pglob->gl_errfunc(buf, errno) ||
- pglob->gl_flags & GLOB_ERR)
- return GLOB_ABORTED;
- }
- /*
- * Posix/XOpen: glob should return when it encounters a
- * directory that it cannot open or read
- * XXX: Should we ignore ENOTDIR and ENOENT though?
- * I think that Posix had in mind EPERM...
- */
- if (pglob->gl_flags & GLOB_ERR)
- return GLOB_ABORTED;
-
- return 0;
- }
-
- error = 0;
-
- /* Search directory for matching names. */
- if (pglob->gl_flags & GLOB_ALTDIRFUNC)
- readdirfunc = pglob->gl_readdir;
- else
- readdirfunc = (struct dirent *(*)(void *)) readdir;
- while ((dp = (*readdirfunc)(dirp)) != NULL) {
- unsigned char *sc;
- Char *dc;
-
- if ((pglob->gl_flags & GLOB_LIMIT) &&
- limit->l_readdir++ >= GLOB_LIMIT_READDIR) {
- errno = 0;
- *pathend++ = SEP;
- *pathend = EOS;
- error = GLOB_NOSPACE;
- break;
- }
-
- /*
- * Initial DOT must be matched literally, unless we have
- * GLOB_PERIOD set.
- */
- if ((pglob->gl_flags & GLOB_PERIOD) == 0)
- if (dp->d_name[0] == DOT && *pattern != DOT)
- continue;
- /*
- * If GLOB_NO_DOTDIRS is set, . and .. vanish.
- */
- if ((pglob->gl_flags & GLOB_NO_DOTDIRS) &&
- (dp->d_name[0] == DOT) &&
- ((dp->d_name[1] == EOS) ||
- ((dp->d_name[1] == DOT) && (dp->d_name[2] == EOS))))
- continue;
- /*
- * The resulting string contains EOS, so we can
- * use the pathlim character, if it is the nul
- */
- for (sc = (unsigned char *) dp->d_name, dc = pathend;
- dc <= pathlim && (*dc++ = *sc++) != EOS;)
- continue;
-
- /*
- * Have we filled the buffer without seeing EOS?
- */
- if (dc > pathlim && *pathlim != EOS) {
- /*
- * Abort when requested by caller, otherwise
- * reset pathend back to last SEP and continue
- * with next dir entry.
- */
- if (pglob->gl_flags & GLOB_ERR) {
- error = GLOB_ABORTED;
- break;
- }
- else {
- *pathend = EOS;
- continue;
- }
- }
-
- if (globstar) {
-#ifdef S_IFLNK
- if (!chase_symlinks &&
- (g_lstat(pathbuf, &sbuf, pglob) ||
- S_ISLNK(sbuf.st_mode)))
- continue;
-#endif
-
- if (!match(pathend, pattern, termstar))
- continue;
-
- if (--dc < pathlim - 2)
- *dc++ = SEP;
- *dc = EOS;
- error = glob2(pathbuf, dc, pathlim, pglobstar,
- pglob, limit);
- if (error)
- break;
- *pathend = EOS;
- } else {
- if (!match(pathend, pattern, restpattern)) {
- *pathend = EOS;
- continue;
- }
- error = glob2(pathbuf, --dc, pathlim, restpattern,
- pglob, limit);
- if (error)
- break;
- }
- }
- if (pglob->gl_flags & GLOB_ALTDIRFUNC)
- (*pglob->gl_closedir)(dirp);
- else
- closedir(dirp);
-
- /*
- * Again Posix X/Open issue with regards to error handling.
- */
- if ((error || errno) && (pglob->gl_flags & GLOB_ERR))
- return GLOB_ABORTED;
-
- return error;
-}
-
-
-/*
- * Extend the gl_pathv member of a glob_t structure to accommodate a new item,
- * add the new item, and update gl_pathc.
- *
- * This assumes the BSD realloc, which only copies the block when its size
- * crosses a power-of-two boundary; for v7 realloc, this would cause quadratic
- * behavior.
- *
- * Return 0 if new item added, error code if memory couldn't be allocated.
- *
- * Invariant of the glob_t structure:
- * Either gl_pathc is zero and gl_pathv is NULL; or gl_pathc > 0 and
- * gl_pathv points to (gl_offs + gl_pathc + 1) items.
- */
-static int
-globextend(const Char *path, glob_t *pglob, struct glob_limit *limit)
-{
- char **pathv;
- size_t i, newsize, len;
- char *copy;
- const Char *p;
-
- _DIAGASSERT(path != NULL);
- _DIAGASSERT(pglob != NULL);
-
- newsize = sizeof(*pathv) * (2 + pglob->gl_pathc + pglob->gl_offs);
- if ((pglob->gl_flags & GLOB_LIMIT) &&
- newsize > GLOB_LIMIT_PATH * sizeof(*pathv))
- goto nospace;
- pathv = pglob->gl_pathv ? realloc(pglob->gl_pathv, newsize) :
- malloc(newsize);
- if (pathv == NULL)
- return GLOB_NOSPACE;
-
- if (pglob->gl_pathv == NULL && pglob->gl_offs > 0) {
- /* first time around -- clear initial gl_offs items */
- pathv += pglob->gl_offs;
- for (i = pglob->gl_offs + 1; --i > 0; )
- *--pathv = NULL;
- }
- pglob->gl_pathv = pathv;
-
- for (p = path; *p++;)
- continue;
- len = (size_t)(p - path);
- limit->l_string += len;
- if ((copy = malloc(len)) != NULL) {
- if (g_Ctoc(path, copy, len)) {
- free(copy);
- return GLOB_ABORTED;
- }
- pathv[pglob->gl_offs + pglob->gl_pathc++] = copy;
- }
- pathv[pglob->gl_offs + pglob->gl_pathc] = NULL;
-
- if ((pglob->gl_flags & GLOB_LIMIT) &&
- (newsize + limit->l_string) >= GLOB_LIMIT_STRING)
- goto nospace;
-
- return copy == NULL ? GLOB_NOSPACE : 0;
-nospace:
- errno = 0;
- return GLOB_NOSPACE;
-}
-
-
-/*
- * pattern matching function for filenames. Each occurrence of the *
- * pattern causes a recursion level.
- */
-static int
-match(const Char *name, const Char *pat, const Char *patend)
-{
- int ok, negate_range;
- Char c, k;
-
- _DIAGASSERT(name != NULL);
- _DIAGASSERT(pat != NULL);
- _DIAGASSERT(patend != NULL);
-
- while (pat < patend) {
- c = *pat++;
- switch (c & M_MASK) {
- case M_ALL:
- while (pat < patend && (*pat & M_MASK) == M_ALL)
- pat++; /* eat consecutive '*' */
- if (pat == patend)
- return 1;
- for (; !match(name, pat, patend); name++)
- if (*name == EOS)
- return 0;
- return 1;
- case M_ONE:
- if (*name++ == EOS)
- return 0;
- break;
- case M_SET:
- ok = 0;
- if ((k = *name++) == EOS)
- return 0;
- if ((negate_range = ((*pat & M_MASK) == M_NOT)) != EOS)
- ++pat;
- while (((c = *pat++) & M_MASK) != M_END)
- if ((*pat & M_MASK) == M_RNG) {
- if (c <= k && k <= pat[1])
- ok = 1;
- pat += 2;
- } else if (c == k)
- ok = 1;
- if (ok == negate_range)
- return 0;
- break;
- default:
- if (*name++ != c)
- return 0;
- break;
- }
- }
- return *name == EOS;
-}
-
-/* Free allocated data belonging to a glob_t structure. */
-void
-globfree(glob_t *pglob)
-{
- size_t i;
- char **pp;
-
- _DIAGASSERT(pglob != NULL);
-
- if (pglob->gl_pathv != NULL) {
- pp = pglob->gl_pathv + pglob->gl_offs;
- for (i = pglob->gl_pathc; i--; ++pp)
- if (*pp)
- free(*pp);
- free(pglob->gl_pathv);
- pglob->gl_pathv = NULL;
- pglob->gl_pathc = 0;
- }
-}
-
-#ifndef __LIBC12_SOURCE__
-int
-glob_pattern_p(const char *pattern, int quote)
-{
- int range = 0;
-
- for (; *pattern; pattern++)
- switch (*pattern) {
- case QUESTION:
- case STAR:
- return 1;
-
- case QUOTE:
- if (quote && pattern[1] != EOS)
- ++pattern;
- break;
-
- case LBRACKET:
- range = 1;
- break;
-
- case RBRACKET:
- if (range)
- return 1;
- break;
- default:
- break;
- }
-
- return 0;
-}
-#endif
-
-static DIR *
-g_opendir(Char *str, glob_t *pglob)
-{
- char buf[MAXPATHLEN];
-
- _DIAGASSERT(str != NULL);
- _DIAGASSERT(pglob != NULL);
-
- if (!*str)
- (void)strlcpy(buf, ".", sizeof(buf));
- else {
- if (g_Ctoc(str, buf, sizeof(buf)))
- return NULL;
- }
-
- if (pglob->gl_flags & GLOB_ALTDIRFUNC)
- return (*pglob->gl_opendir)(buf);
-
- return opendir(buf);
-}
-
-static int
-g_lstat(Char *fn, __gl_stat_t *sb, glob_t *pglob)
-{
- char buf[MAXPATHLEN];
-
- _DIAGASSERT(fn != NULL);
- _DIAGASSERT(sb != NULL);
- _DIAGASSERT(pglob != NULL);
-
- if (g_Ctoc(fn, buf, sizeof(buf)))
- return -1;
- if (pglob->gl_flags & GLOB_ALTDIRFUNC)
- return (*pglob->gl_lstat)(buf, sb);
- return lstat(buf, sb);
-}
-
-static int
-g_stat(Char *fn, __gl_stat_t *sb, glob_t *pglob)
-{
- char buf[MAXPATHLEN];
-
- _DIAGASSERT(fn != NULL);
- _DIAGASSERT(sb != NULL);
- _DIAGASSERT(pglob != NULL);
-
- if (g_Ctoc(fn, buf, sizeof(buf)))
- return -1;
- if (pglob->gl_flags & GLOB_ALTDIRFUNC)
- return (*pglob->gl_stat)(buf, sb);
- return stat(buf, sb);
-}
-
-static Char *
-g_strchr(const Char *str, int ch)
-{
-
- _DIAGASSERT(str != NULL);
-
- do {
- if (*str == ch)
- return __UNCONST(str);
- } while (*str++);
- return NULL;
-}
-
-static int
-g_Ctoc(const Char *str, char *buf, size_t len)
-{
- char *dc;
-
- _DIAGASSERT(str != NULL);
- _DIAGASSERT(buf != NULL);
-
- if (len == 0)
- return 1;
-
- for (dc = buf; len && (*dc++ = *str++) != EOS; len--)
- continue;
-
- return len == 0;
-}
-
-#ifdef DEBUG
-static void
-qprintf(const char *str, Char *s)
-{
- Char *p;
-
- _DIAGASSERT(str != NULL);
- _DIAGASSERT(s != NULL);
-
- (void)printf("%s:\n", str);
- for (p = s; *p; p++)
- (void)printf("%c", CHAR(*p));
- (void)printf("\n");
- for (p = s; *p; p++)
- (void)printf("%c", *p & M_PROTECT ? '"' : ' ');
- (void)printf("\n");
- for (p = s; *p; p++)
- (void)printf("%c", ismeta(*p) ? '_' : ' ');
- (void)printf("\n");
-}
-#endif
diff --git a/peripheral/libmraa/src/glob/glob.h b/peripheral/libmraa/src/glob/glob.h
deleted file mode 100644
index d8e13c4..0000000
--- a/peripheral/libmraa/src/glob/glob.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/* $NetBSD: glob.h,v 1.26 2010/09/06 14:38:56 christos Exp $ */
-
-/*
- * Copyright (c) 1989, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Guido van Rossum.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)glob.h 8.1 (Berkeley) 6/2/93
- */
-
-#ifndef _GLOB_H_
-#define _GLOB_H_
-
-#include <sys/cdefs.h>
-//#include <sys/featuretest.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#ifndef __gl_size_t
-#define __gl_size_t size_t
-#endif
-#ifndef __gl_stat_t
-#define __gl_stat_t struct stat
-#endif
-
-typedef struct {
- __gl_size_t gl_pathc; /* Count of total paths so far. */
- __gl_size_t gl_matchc; /* Count of paths matching pattern. */
- __gl_size_t gl_offs; /* Reserved at beginning of gl_pathv. */
- int gl_flags; /* Copy of flags parameter to glob. */
- char **gl_pathv; /* List of paths matching pattern. */
- /* Copy of errfunc parameter to glob. */
- int (*gl_errfunc)(const char *, int);
-
- /*
- * Alternate filesystem access methods for glob; replacement
- * versions of closedir(3), readdir(3), opendir(3), stat(2)
- * and lstat(2).
- */
- void (*gl_closedir)(void *);
- struct dirent *(*gl_readdir)(void *);
- void *(*gl_opendir)(const char *);
- int (*gl_lstat)(const char *, __gl_stat_t *);
- int (*gl_stat)(const char *, __gl_stat_t *);
-} glob_t;
-
-#define GLOB_APPEND 0x0001 /* Append to output from previous call. */
-#define GLOB_DOOFFS 0x0002 /* Use gl_offs. */
-#define GLOB_ERR 0x0004 /* Return on error. */
-#define GLOB_MARK 0x0008 /* Append / to matching directories. */
-#define GLOB_NOCHECK 0x0010 /* Return pattern itself if nothing matches. */
-#define GLOB_NOSORT 0x0020 /* Don't sort. */
-#define GLOB_NOESCAPE 0x1000 /* Disable backslash escaping. */
-
-#define GLOB_NOSPACE (-1) /* Malloc call failed. */
-#define GLOB_ABORTED (-2) /* Unignored error. */
-#define GLOB_NOMATCH (-3) /* No match, and GLOB_NOCHECK was not set. */
-#define GLOB_NOSYS (-4) /* Implementation does not support function. */
-
-#if defined(_NETBSD_SOURCE) || defined(HAVE_NBTOOL_CONFIG_H) || defined(__BIONIC__)
-#define GLOB_ALTDIRFUNC 0x0040 /* Use alternately specified directory funcs. */
-#define GLOB_BRACE 0x0080 /* Expand braces ala csh. */
-#define GLOB_MAGCHAR 0x0100 /* Pattern had globbing characters. */
-#define GLOB_NOMAGIC 0x0200 /* GLOB_NOCHECK without magic chars (csh). */
-#define GLOB_LIMIT 0x0400 /* Limit memory used by matches to ARG_MAX */
-#define GLOB_TILDE 0x0800 /* Expand tilde names from the passwd file. */
-/* GLOB_NOESCAPE 0x1000 above */
-#define GLOB_PERIOD 0x2000 /* Allow metachars to match leading periods. */
-#define GLOB_NO_DOTDIRS 0x4000 /* Make . and .. vanish from wildcards. */
-#define GLOB_STAR 0x8000 /* Use glob ** to recurse directories */
-#define GLOB_QUOTE 0 /* source compatibility */
-
-#define GLOB_ABEND GLOB_ABORTED /* source compatibility */
-#endif
-
-__BEGIN_DECLS
-#ifndef __LIBC12_SOURCE__
-int glob(const char * __restrict, int,
- int (*)(const char *, int), glob_t * __restrict) __RENAME(__glob30);
-void globfree(glob_t *) __RENAME(__globfree30);
-#endif
-#ifdef _NETBSD_SOURCE
-int glob_pattern_p(const char *, int);
-#endif
-__END_DECLS
-
-#endif /* !_GLOB_H_ */
diff --git a/peripheral/libmraa/src/gpio/gpio.c b/peripheral/libmraa/src/gpio/gpio.c
deleted file mode 100644
index 3b41612..0000000
--- a/peripheral/libmraa/src/gpio/gpio.c
+++ /dev/null
@@ -1,856 +0,0 @@
-/*
- * Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
- * Author: Brendan Le Foll <brendan.le.foll@intel.com>
- * Copyright (c) 2014, 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#include "gpio.h"
-#include "mraa_internal.h"
-
-#include <stdlib.h>
-#include <fcntl.h>
-#include <string.h>
-#include <unistd.h>
-#include <poll.h>
-#include <pthread.h>
-#include <signal.h>
-#include <sys/stat.h>
-#include <sys/mman.h>
-
-#define SYSFS_CLASS_GPIO "/sys/class/gpio"
-#define MAX_SIZE 64
-#define POLL_TIMEOUT
-
-static mraa_result_t
-mraa_gpio_get_valfp(mraa_gpio_context dev)
-{
- char bu[MAX_SIZE];
- sprintf(bu, SYSFS_CLASS_GPIO "/gpio%d/value", dev->pin);
- dev->value_fp = open(bu, O_RDWR);
- if (dev->value_fp == -1) {
- return MRAA_ERROR_INVALID_RESOURCE;
- }
-
- return MRAA_SUCCESS;
-}
-
-static mraa_gpio_context
-mraa_gpio_init_internal(mraa_adv_func_t* func_table, int pin)
-{
- if (pin < 0)
- return NULL;
-
- mraa_result_t status = MRAA_SUCCESS;
- char bu[MAX_SIZE];
- int length;
-
- mraa_gpio_context dev = (mraa_gpio_context) calloc(1, sizeof(struct _gpio));
- if (dev == NULL) {
- syslog(LOG_CRIT, "gpio: Failed to allocate memory for context");
- return NULL;
- }
-
- dev->advance_func = func_table;
- dev->pin = pin;
-
- if (IS_FUNC_DEFINED(dev, gpio_init_internal_replace)) {
- status = dev->advance_func->gpio_init_internal_replace(dev, pin);
- if (status == MRAA_SUCCESS)
- return dev;
- else
- goto init_internal_cleanup;
- }
-
- if (IS_FUNC_DEFINED(dev, gpio_init_pre)) {
- status = dev->advance_func->gpio_init_pre(pin);
- if (status != MRAA_SUCCESS)
- goto init_internal_cleanup;
- }
-
- dev->value_fp = -1;
- dev->isr_value_fp = -1;
-#ifndef HAVE_PTHREAD_CANCEL
- dev->isr_control_pipe[0] = dev->isr_control_pipe[1] = -1;
-#endif
- dev->isr_thread_terminating = 0;
- dev->phy_pin = -1;
-
- // then check to make sure the pin is exported.
- char directory[MAX_SIZE];
- snprintf(directory, MAX_SIZE, SYSFS_CLASS_GPIO "/gpio%d/", dev->pin);
- struct stat dir;
- if (stat(directory, &dir) == 0 && S_ISDIR(dir.st_mode)) {
- dev->owner = 0; // Not Owner
- } else {
- int export = open(SYSFS_CLASS_GPIO "/export", O_WRONLY);
- if (export == -1) {
- syslog(LOG_ERR, "gpio: Failed to open export for writing");
- status = MRAA_ERROR_NO_RESOURCES;
- goto init_internal_cleanup;
- }
- length = snprintf(bu, sizeof(bu), "%d", dev->pin);
- if (write(export, bu, length * sizeof(char)) == -1) {
- syslog(LOG_ERR, "gpio: Failed to write %d to export", dev->pin);
- close(export);
- status = MRAA_ERROR_NO_RESOURCES;
- goto init_internal_cleanup;
- }
- dev->owner = 1;
- close(export);
- }
-
-init_internal_cleanup:
- if (status != MRAA_SUCCESS) {
- if (dev != NULL)
- free(dev);
- return NULL;
- }
- return dev;
-}
-
-mraa_gpio_context
-mraa_gpio_init(int pin)
-{
- mraa_board_t* board = plat;
- if (board == NULL) {
- syslog(LOG_ERR, "gpio: platform not initialised");
- return NULL;
- }
-
- if (mraa_is_sub_platform_id(pin)) {
- syslog(LOG_NOTICE, "gpio: Using sub platform");
- board = board->sub_platform;
- if (board == NULL) {
- syslog(LOG_ERR, "gpio: Sub platform Not Initialised");
- return NULL;
- }
- pin = mraa_get_sub_platform_index(pin);
- }
-
- if (pin < 0 || pin > board->phy_pin_count) {
- syslog(LOG_ERR, "gpio: pin %i beyond platform definition", pin);
- return NULL;
- }
- if (board->pins[pin].capabilites.gpio != 1) {
- syslog(LOG_ERR, "gpio: pin %i not capable of gpio", pin);
- return NULL;
- }
- if (board->pins[pin].gpio.mux_total > 0) {
- if (mraa_setup_mux_mapped(board->pins[pin].gpio) != MRAA_SUCCESS) {
- syslog(LOG_ERR, "gpio: unable to setup muxes");
- return NULL;
- }
- }
-
- mraa_gpio_context r = mraa_gpio_init_internal(board->adv_func, board->pins[pin].gpio.pinmap);
- if (r == NULL) {
- syslog(LOG_CRIT, "gpio: mraa_gpio_init_raw(%d) returned error", pin);
- return NULL;
- }
- if (r->phy_pin == -1)
- r->phy_pin = pin;
-
- if (IS_FUNC_DEFINED(r, gpio_init_post)) {
- mraa_result_t ret = r->advance_func->gpio_init_post(r);
- if (ret != MRAA_SUCCESS) {
- free(r);
- return NULL;
- }
- }
- return r;
-}
-
-mraa_gpio_context
-mraa_gpio_init_raw(int pin)
-{
- return mraa_gpio_init_internal(plat == NULL ? NULL : plat->adv_func , pin);
-}
-
-
-static mraa_result_t
-mraa_gpio_wait_interrupt(int fd
-#ifndef HAVE_PTHREAD_CANCEL
- , int control_fd
-#endif
- )
-{
- unsigned char c;
-#ifdef HAVE_PTHREAD_CANCEL
- struct pollfd pfd[1];
-#else
- struct pollfd pfd[2];
-
- if (control_fd < 0) {
- return MRAA_ERROR_INVALID_RESOURCE;
- }
-#endif
-
- if (fd < 0) {
- return MRAA_ERROR_INVALID_RESOURCE;
- }
-
- // setup poll on POLLPRI
- pfd[0].fd = fd;
- pfd[0].events = POLLPRI;
-
- // do an initial read to clear interrupt
- lseek(fd, 0, SEEK_SET);
- read(fd, &c, 1);
-
-#ifdef HAVE_PTHREAD_CANCEL
- // Wait for it forever or until pthread_cancel
- // poll is a cancelable point like sleep()
- int x = poll(pfd, 1, -1);
-#else
- // setup poll on the controling fd
- pfd[1].fd = control_fd;
- pfd[1].events = 0; // POLLHUP, POLLERR, and POLLNVAL
-
- // Wait for it forever or until control fd is closed
- int x = poll(pfd, 2, -1);
-#endif
-
- // do a final read to clear interrupt
- read(fd, &c, 1);
-
- return MRAA_SUCCESS;
-}
-
-#if defined(SWIGJAVA) || defined(JAVACALLBACK)
-pthread_key_t env_key;
-
-extern JavaVM *globVM;
-static pthread_once_t env_key_init = PTHREAD_ONCE_INIT;
-
-jmethodID runGlobal;
-
-static void make_env_key(void)
-{
-
- JNIEnv *jenv;
- (*globVM)->GetEnv(globVM, (void **)&jenv, JNI_VERSION_1_6);
-
- jclass rcls = (*jenv)->FindClass(jenv, "java/lang/Runnable");
- jmethodID runm = (*jenv)->GetMethodID(jenv, rcls, "run", "()V");
-
- runGlobal = (jmethodID)(*jenv)->NewGlobalRef(jenv, (jobject)runm);
-
- pthread_key_create(&env_key, NULL);
-}
-
-void mraa_java_isr_callback(void* data)
-{
- JNIEnv *jenv = (JNIEnv *) pthread_getspecific(env_key);
- (*jenv)->CallVoidMethod(jenv, (jobject)data, runGlobal);
-}
-
-#endif
-
-static void*
-mraa_gpio_interrupt_handler(void* arg)
-{
- mraa_gpio_context dev = (mraa_gpio_context) arg;
- int fp = -1;
- mraa_result_t ret;
-
- if (IS_FUNC_DEFINED(dev, gpio_interrupt_handler_init_replace)) {
- if (dev->advance_func->gpio_interrupt_handler_init_replace(dev) != MRAA_SUCCESS)
- return NULL;
- } else {
- // open gpio value with open(3)
- char bu[MAX_SIZE];
- sprintf(bu, SYSFS_CLASS_GPIO "/gpio%d/value", dev->pin);
- fp = open(bu, O_RDONLY);
- if (fp < 0) {
- syslog(LOG_ERR, "gpio: failed to open gpio%d/value", dev->pin);
- return NULL;
- }
- }
-
-#ifndef HAVE_PTHREAD_CANCEL
- if (pipe(dev->isr_control_pipe)) {
- syslog(LOG_ERR, "gpio: failed to create isr control pipe");
- close(fp);
- return NULL;
- }
-#endif
-
- dev->isr_value_fp = fp;
-
-#if defined(SWIGJAVA) || defined(JAVACALLBACK)
- JNIEnv *jenv;
- if(dev->isr == mraa_java_isr_callback) {
- jint err = (*globVM)->AttachCurrentThreadAsDaemon(globVM, (void **)&jenv, NULL);
-
- if (err != JNI_OK) {
- close(dev->isr_value_fp);
- dev->isr_value_fp = -1;
- return NULL;
- }
-
- pthread_once(&env_key_init, make_env_key);
- pthread_setspecific(env_key, jenv);
- }
-#endif
-
- for (;;) {
- if (IS_FUNC_DEFINED(dev, gpio_wait_interrupt_replace)) {
- ret = dev->advance_func->gpio_wait_interrupt_replace(dev);
- } else {
- ret = mraa_gpio_wait_interrupt(dev->isr_value_fp
-#ifndef HAVE_PTHREAD_CANCEL
- , dev->isr_control_pipe[0]
-#endif
- );
- }
- if (ret == MRAA_SUCCESS && !dev->isr_thread_terminating) {
-#ifdef HAVE_PTHREAD_CANCEL
- pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
-#endif
-#ifdef SWIGPYTHON
- // In order to call a python object (all python functions are objects) we
- // need to aquire the GIL (Global Interpreter Lock). This may not always be
- // necessary but especially if doing IO (like print()) python will segfault
- // if we do not hold a lock on the GIL
- PyGILState_STATE gilstate = PyGILState_Ensure();
- PyObject* arglist;
- PyObject* ret;
- arglist = Py_BuildValue("(O)", dev->isr_args);
- if (arglist == NULL) {
- syslog(LOG_ERR, "gpio: Py_BuildValue NULL");
- } else {
- ret = PyEval_CallObject((PyObject*) dev->isr, arglist);
- if (ret == NULL) {
- syslog(LOG_ERR, "gpio: PyEval_CallObject failed");
- PyObject *pvalue, *ptype, *ptraceback;
- PyObject *pvalue_pystr, *ptype_pystr, *ptraceback_pystr;
- char *pvalue_cstr, *ptype_cstr, *ptraceback_cstr;
- PyErr_Fetch(&pvalue, &ptype, &ptraceback);
- pvalue_pystr = PyObject_Str(pvalue);
- ptype_pystr = PyObject_Str(ptype);
- ptraceback_pystr = PyObject_Str(ptraceback);
-// Python2
-#if PY_VERSION_HEX < 0x03000000
- pvalue_cstr = PyString_AsString(pvalue_pystr);
- ptype_cstr = PyString_AsString(ptype_pystr);
- ptraceback_cstr = PyString_AsString(ptraceback_pystr);
-// Python 3 and up
-#elif PY_VERSION_HEX >= 0x03000000
- // In Python 3 we need one extra conversion
- PyObject *pvalue_ustr, *ptype_ustr, *ptraceback_ustr;
- pvalue_ustr = PyUnicode_AsUTF8String(pvalue_pystr);
- pvalue_cstr = PyBytes_AsString(pvalue_ustr);
- ptype_ustr = PyUnicode_AsUTF8String(ptype_pystr);
- ptype_cstr = PyBytes_AsString(ptype_ustr);
- ptraceback_ustr = PyUnicode_AsUTF8String(ptraceback_pystr);
- ptraceback_cstr = PyBytes_AsString(ptraceback_ustr);
-#endif // PY_VERSION_HEX
- syslog(LOG_ERR, "gpio: the error was %s:%s:%s",
- pvalue_cstr,
- ptype_cstr,
- ptraceback_cstr
- );
- Py_XDECREF(pvalue);
- Py_XDECREF(ptype);
- Py_XDECREF(ptraceback);
- Py_XDECREF(pvalue_pystr);
- Py_XDECREF(ptype_pystr);
- Py_XDECREF(ptraceback_pystr);
-// Python 3 and up
-#if PY_VERSION_HEX >= 0x03000000
- Py_XDECREF(pvalue_ustr);
- Py_XDECREF(ptype_ustr);
- Py_XDECREF(ptraceback_ustr);
-#endif // PY_VERSION_HEX
- } else {
- Py_DECREF(ret);
- }
- Py_DECREF(arglist);
- }
-
- PyGILState_Release(gilstate);
-#else
- dev->isr(dev->isr_args);
-#endif
-#ifdef HAVE_PTHREAD_CANCEL
- pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
-#endif
- } else {
- // we must have got an error code or exit request so die nicely
-#ifdef HAVE_PTHREAD_CANCEL
- pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
-#endif
- if (fp != -1) {
- close(dev->isr_value_fp);
- dev->isr_value_fp = -1;
- }
-#if defined(SWIGJAVA) || defined(JAVACALLBACK)
-
- if(dev->isr == mraa_java_isr_callback) {
- (*jenv)->DeleteGlobalRef(jenv, (jobject)dev->isr_args);
- (*globVM)->DetachCurrentThread(globVM);
- }
-#endif
- return NULL;
- }
- }
-}
-
-mraa_result_t
-mraa_gpio_edge_mode(mraa_gpio_context dev, mraa_gpio_edge_t mode)
-{
- if (IS_FUNC_DEFINED(dev, gpio_edge_mode_replace))
- return dev->advance_func->gpio_edge_mode_replace(dev, mode);
-
- if (dev->value_fp != -1) {
- close(dev->value_fp);
- dev->value_fp = -1;
- }
-
- char filepath[MAX_SIZE];
- snprintf(filepath, MAX_SIZE, SYSFS_CLASS_GPIO "/gpio%d/edge", dev->pin);
-
- int edge = open(filepath, O_RDWR);
- if (edge == -1) {
- syslog(LOG_ERR, "gpio: Failed to open edge for writing");
- return MRAA_ERROR_INVALID_RESOURCE;
- }
-
- char bu[MAX_SIZE];
- int length;
- switch (mode) {
- case MRAA_GPIO_EDGE_NONE:
- length = snprintf(bu, sizeof(bu), "none");
- break;
- case MRAA_GPIO_EDGE_BOTH:
- length = snprintf(bu, sizeof(bu), "both");
- break;
- case MRAA_GPIO_EDGE_RISING:
- length = snprintf(bu, sizeof(bu), "rising");
- break;
- case MRAA_GPIO_EDGE_FALLING:
- length = snprintf(bu, sizeof(bu), "falling");
- break;
- default:
- close(edge);
- return MRAA_ERROR_FEATURE_NOT_IMPLEMENTED;
- }
- if (write(edge, bu, length * sizeof(char)) == -1) {
- syslog(LOG_ERR, "gpio: Failed to write to edge");
- close(edge);
- return MRAA_ERROR_INVALID_RESOURCE;
- }
-
- close(edge);
- return MRAA_SUCCESS;
-}
-
-mraa_result_t
-mraa_gpio_isr(mraa_gpio_context dev, mraa_gpio_edge_t mode, void (*fptr)(void*), void* args)
-{
- // we only allow one isr per mraa_gpio_context
- if (dev->thread_id != 0) {
- return MRAA_ERROR_NO_RESOURCES;
- }
-
- if (MRAA_SUCCESS != mraa_gpio_edge_mode(dev, mode)) {
- return MRAA_ERROR_UNSPECIFIED;
- }
-
- dev->isr = fptr;
-#if defined(SWIGJAVA) || defined(JAVACALLBACK)
- JNIEnv *jenv;
- /* Most UPM sensors use the C API, the global ref must be created here. */
- /* The reason for checking the callback function is internal callbacks. */
- if (fptr == mraa_java_isr_callback) {
- (*globVM)->GetEnv(globVM, (void **)&jenv, JNI_VERSION_1_6);
- jobject grunnable = (*jenv)->NewGlobalRef(jenv, (jobject) args);
- args = (void *) grunnable;
- }
-#endif
- dev->isr_args = args;
- pthread_create(&dev->thread_id, NULL, mraa_gpio_interrupt_handler, (void*) dev);
-
- return MRAA_SUCCESS;
-}
-
-mraa_result_t
-mraa_gpio_isr_exit(mraa_gpio_context dev)
-{
- mraa_result_t ret = MRAA_SUCCESS;
-
- // wasting our time, there is no isr to exit from
- if (dev->thread_id == 0 && dev->isr_value_fp == -1) {
- return ret;
- }
- // mark the beginning of the thread termination process for interested parties
- dev->isr_thread_terminating = 1;
-
- // stop isr being useful
- ret = mraa_gpio_edge_mode(dev, MRAA_GPIO_EDGE_NONE);
-
- if ((dev->thread_id != 0)) {
-#ifdef HAVE_PTHREAD_CANCEL
- if ((pthread_cancel(dev->thread_id) != 0) || (pthread_join(dev->thread_id, NULL) != 0)) {
- ret = MRAA_ERROR_INVALID_HANDLE;
- }
-#else
- close(dev->isr_control_pipe[1]);
- if (pthread_join(dev->thread_id, NULL) != 0)
- ret = MRAA_ERROR_INVALID_HANDLE;
-
- close(dev->isr_control_pipe[0]);
- dev->isr_control_pipe[0] = dev->isr_control_pipe[1] = -1;
-#endif
- }
-
- // close the filehandle in case it's still open
- if (dev->isr_value_fp != -1) {
- if (close(dev->isr_value_fp) != 0) {
- ret = MRAA_ERROR_INVALID_PARAMETER;
- }
- }
-
- // assume our thread will exit either way we just lost it's handle
- dev->thread_id = 0;
- dev->isr_value_fp = -1;
- dev->isr_thread_terminating = 0;
- return ret;
-}
-
-mraa_result_t
-mraa_gpio_mode(mraa_gpio_context dev, mraa_gpio_mode_t mode)
-{
- if (IS_FUNC_DEFINED(dev, gpio_mode_replace))
- return dev->advance_func->gpio_mode_replace(dev, mode);
-
- if (IS_FUNC_DEFINED(dev, gpio_mode_pre)) {
- mraa_result_t pre_ret = (dev->advance_func->gpio_mode_pre(dev, mode));
- if (pre_ret != MRAA_SUCCESS)
- return pre_ret;
- }
-
- if (dev->value_fp != -1) {
- close(dev->value_fp);
- dev->value_fp = -1;
- }
-
- char filepath[MAX_SIZE];
- snprintf(filepath, MAX_SIZE, SYSFS_CLASS_GPIO "/gpio%d/drive", dev->pin);
-
- int drive = open(filepath, O_WRONLY);
- if (drive == -1) {
- syslog(LOG_ERR, "gpio: Failed to open drive for writing");
- return MRAA_ERROR_INVALID_RESOURCE;
- }
-
- char bu[MAX_SIZE];
- int length;
- switch (mode) {
- case MRAA_GPIO_STRONG:
- length = snprintf(bu, sizeof(bu), "strong");
- break;
- case MRAA_GPIO_PULLUP:
- length = snprintf(bu, sizeof(bu), "pullup");
- break;
- case MRAA_GPIO_PULLDOWN:
- length = snprintf(bu, sizeof(bu), "pulldown");
- break;
- case MRAA_GPIO_HIZ:
- length = snprintf(bu, sizeof(bu), "hiz");
- break;
- default:
- close(drive);
- return MRAA_ERROR_FEATURE_NOT_IMPLEMENTED;
- }
- if (write(drive, bu, length * sizeof(char)) == -1) {
- syslog(LOG_ERR, "gpio: Failed to write to drive mode");
- close(drive);
- return MRAA_ERROR_INVALID_RESOURCE;
- }
-
- close(drive);
- if (IS_FUNC_DEFINED(dev, gpio_mode_post))
- return dev->advance_func->gpio_mode_post(dev, mode);
- return MRAA_SUCCESS;
-}
-
-mraa_result_t
-mraa_gpio_dir(mraa_gpio_context dev, mraa_gpio_dir_t dir)
-{
- if (IS_FUNC_DEFINED(dev, gpio_dir_replace)) {
- return dev->advance_func->gpio_dir_replace(dev, dir);
- }
-
- if (IS_FUNC_DEFINED(dev, gpio_dir_pre)) {
- mraa_result_t pre_ret = (dev->advance_func->gpio_dir_pre(dev, dir));
- if (pre_ret != MRAA_SUCCESS) {
- return pre_ret;
- }
- }
-
- if (dev == NULL) {
- return MRAA_ERROR_INVALID_HANDLE;
- }
- if (dev->value_fp != -1) {
- close(dev->value_fp);
- dev->value_fp = -1;
- }
- char filepath[MAX_SIZE];
- snprintf(filepath, MAX_SIZE, SYSFS_CLASS_GPIO "/gpio%d/direction", dev->pin);
-
- int direction = open(filepath, O_RDWR);
-
- if (direction == -1) {
- // Direction Failed to Open. If HIGH or LOW was passed will try and set
- // If not fail as usual.
- switch (dir) {
- case MRAA_GPIO_OUT_HIGH:
- return mraa_gpio_write(dev, 1);
- case MRAA_GPIO_OUT_LOW:
- return mraa_gpio_write(dev, 0);
- default:
- return MRAA_ERROR_INVALID_RESOURCE;
- }
- }
-
- char bu[MAX_SIZE];
- int length;
- switch (dir) {
- case MRAA_GPIO_OUT:
- length = snprintf(bu, sizeof(bu), "out");
- break;
- case MRAA_GPIO_IN:
- length = snprintf(bu, sizeof(bu), "in");
- break;
- case MRAA_GPIO_OUT_HIGH:
- length = snprintf(bu, sizeof(bu), "high");
- break;
- case MRAA_GPIO_OUT_LOW:
- length = snprintf(bu, sizeof(bu), "low");
- break;
- default:
- close(direction);
- return MRAA_ERROR_FEATURE_NOT_IMPLEMENTED;
- }
-
- if (write(direction, bu, length * sizeof(char)) == -1) {
- close(direction);
- return MRAA_ERROR_INVALID_RESOURCE;
- }
-
- close(direction);
- if (IS_FUNC_DEFINED(dev, gpio_dir_post))
- return dev->advance_func->gpio_dir_post(dev, dir);
- return MRAA_SUCCESS;
-}
-
-mraa_result_t
-mraa_gpio_read_dir(mraa_gpio_context dev, mraa_gpio_dir_t *dir)
-{
- char value[5];
- char filepath[MAX_SIZE];
- int fd, rc;
- mraa_result_t result = MRAA_SUCCESS;
-
- snprintf(filepath, MAX_SIZE, SYSFS_CLASS_GPIO "/gpio%d/direction", dev->pin);
- fd = open(filepath, O_RDONLY);
- if (fd == -1) {
- return MRAA_ERROR_INVALID_RESOURCE;
- }
-
- memset(value, '\0', sizeof(value));
- rc = read(fd, value, sizeof(value));
- close(fd);
- if (rc <= 0) {
- return MRAA_ERROR_INVALID_RESOURCE;
- }
-
- if (strcmp(value, "out\n") == 0) {
- *dir = MRAA_GPIO_OUT;
- } else if (strcmp(value, "in\n") == 0) {
- *dir = MRAA_GPIO_IN;
- } else {
- result = MRAA_ERROR_INVALID_RESOURCE;
- }
-
- return result;
-}
-
-int
-mraa_gpio_read(mraa_gpio_context dev)
-{
- if (dev == NULL)
- return -1;
-
- if (IS_FUNC_DEFINED(dev, gpio_read_replace))
- return dev->advance_func->gpio_read_replace(dev);
-
- if (dev->mmap_read != NULL)
- return dev->mmap_read(dev);
-
- if (dev->value_fp == -1) {
- if (mraa_gpio_get_valfp(dev) != MRAA_SUCCESS) {
- syslog(LOG_ERR, "gpio: Failed to get value file pointer");
- return -1;
- }
- } else {
- // if value_fp is new this is pointless
- lseek(dev->value_fp, 0, SEEK_SET);
- }
- char bu[2];
- if (read(dev->value_fp, bu, 2 * sizeof(char)) != 2) {
- syslog(LOG_ERR, "gpio: Failed to read a sensible value from sysfs");
- return -1;
- }
- lseek(dev->value_fp, 0, SEEK_SET);
-
- return (int) strtol(bu, NULL, 10);
-}
-
-mraa_result_t
-mraa_gpio_write(mraa_gpio_context dev, int value)
-{
- if (dev == NULL)
- return MRAA_ERROR_INVALID_HANDLE;
-
- if (dev->mmap_write != NULL)
- return dev->mmap_write(dev, value);
-
- if (IS_FUNC_DEFINED(dev, gpio_write_pre)) {
- mraa_result_t pre_ret = (dev->advance_func->gpio_write_pre(dev, value));
- if (pre_ret != MRAA_SUCCESS)
- return pre_ret;
- }
-
- if (IS_FUNC_DEFINED(dev, gpio_write_replace)) {
- return dev->advance_func->gpio_write_replace(dev, value);
- }
-
- if (dev->value_fp == -1) {
- if (mraa_gpio_get_valfp(dev) != MRAA_SUCCESS) {
- return MRAA_ERROR_INVALID_RESOURCE;
- }
- }
-
- if (lseek(dev->value_fp, 0, SEEK_SET) == -1) {
- return MRAA_ERROR_INVALID_RESOURCE;
- }
-
- char bu[MAX_SIZE];
- int length = snprintf(bu, sizeof(bu), "%d", value);
- if (write(dev->value_fp, bu, length * sizeof(char)) == -1) {
- return MRAA_ERROR_INVALID_HANDLE;
- }
-
- if (IS_FUNC_DEFINED(dev, gpio_write_post))
- return dev->advance_func->gpio_write_post(dev, value);
- return MRAA_SUCCESS;
-}
-
-static mraa_result_t
-mraa_gpio_unexport_force(mraa_gpio_context dev)
-{
- int unexport = open(SYSFS_CLASS_GPIO "/unexport", O_WRONLY);
- if (unexport == -1) {
- syslog(LOG_ERR, "gpio: Failed to open unexport for writing");
- return MRAA_ERROR_INVALID_RESOURCE;
- }
-
- char bu[MAX_SIZE];
- int length = snprintf(bu, sizeof(bu), "%d", dev->pin);
- if (write(unexport, bu, length * sizeof(char)) == -1) {
- syslog(LOG_ERR, "gpio: Failed to write to unexport");
- close(unexport);
- return MRAA_ERROR_INVALID_RESOURCE;
- }
-
- close(unexport);
- mraa_gpio_isr_exit(dev);
- return MRAA_SUCCESS;
-}
-static mraa_result_t
-mraa_gpio_unexport(mraa_gpio_context dev)
-{
- if (dev->owner) {
- return mraa_gpio_unexport_force(dev);
- }
- return MRAA_ERROR_INVALID_RESOURCE;
-}
-
-mraa_result_t
-mraa_gpio_close(mraa_gpio_context dev)
-{
- mraa_result_t result = MRAA_SUCCESS;
-
- if (IS_FUNC_DEFINED(dev, gpio_close_pre)) {
- result = dev->advance_func->gpio_close_pre(dev);
- }
-
- if (dev->value_fp != -1) {
- close(dev->value_fp);
- }
- mraa_gpio_unexport(dev);
- free(dev);
- return result;
-}
-
-mraa_result_t
-mraa_gpio_owner(mraa_gpio_context dev, mraa_boolean_t own)
-{
- if (dev == NULL) {
- return MRAA_ERROR_INVALID_RESOURCE;
- }
- syslog(LOG_DEBUG, "gpio: Set owner to %d", (int) own);
- dev->owner = own;
- return MRAA_SUCCESS;
-}
-
-mraa_result_t
-mraa_gpio_use_mmaped(mraa_gpio_context dev, mraa_boolean_t mmap_en)
-{
- if (IS_FUNC_DEFINED(dev, gpio_mmap_setup)) {
- return dev->advance_func->gpio_mmap_setup(dev, mmap_en);
- }
-
- syslog(LOG_ERR, "gpio: mmap not implemented on this platform");
- return MRAA_ERROR_FEATURE_NOT_IMPLEMENTED;
-}
-
-int
-mraa_gpio_get_pin(mraa_gpio_context dev)
-{
- if (dev == NULL) {
- syslog(LOG_ERR, "gpio: context is invalid");
- return -1;
- }
- return dev->phy_pin;
-}
-
-int
-mraa_gpio_get_pin_raw(mraa_gpio_context dev)
-{
- if (dev == NULL) {
- syslog(LOG_ERR, "gpio: context is invalid");
- return -1;
- }
- return dev->pin;
-}
diff --git a/peripheral/libmraa/src/i2c/LICENSE b/peripheral/libmraa/src/i2c/LICENSE
deleted file mode 100644
index 765b6f4..0000000
--- a/peripheral/libmraa/src/i2c/LICENSE
+++ /dev/null
@@ -1,22 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2005-2014 RoadNarrows LLC.
-http://roadnarrows.com
-All Rights Reserved
-
-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.
diff --git a/peripheral/libmraa/src/i2c/i2c.c b/peripheral/libmraa/src/i2c/i2c.c
deleted file mode 100644
index e196ab7..0000000
--- a/peripheral/libmraa/src/i2c/i2c.c
+++ /dev/null
@@ -1,372 +0,0 @@
-/*
- * Author: Brendan Le Foll <brendan.le.foll@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Code is modified from the RoadNarrows-robotics i2c library (distributed under
- * the MIT license, license is included verbatim under src/i2c/LICENSE)
- *
- * 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 "i2c.h"
-#include "mraa_internal.h"
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <inttypes.h>
-#include <sys/types.h>
-#include <sys/errno.h>
-#include <sys/ioctl.h>
-#include "linux/i2c-dev.h"
-
-
-typedef union i2c_smbus_data_union {
- uint8_t byte; ///< data byte
- unsigned short word; ///< data short word
- uint8_t block[I2C_SMBUS_BLOCK_MAX + 2];
- ///< block[0] is used for length and one more for PEC
-} i2c_smbus_data_t;
-
-typedef struct i2c_smbus_ioctl_data_struct {
- uint8_t read_write; ///< operation direction
- uint8_t command; ///< ioctl command
- int size; ///< data size
- i2c_smbus_data_t* data; ///< data
-} i2c_smbus_ioctl_data_t;
-
-
-// static mraa_adv_func_t* func_table;
-
-int
-mraa_i2c_smbus_access(int fh, uint8_t read_write, uint8_t command, int size, i2c_smbus_data_t* data)
-{
- i2c_smbus_ioctl_data_t args;
-
- args.read_write = read_write;
- args.command = command;
- args.size = size;
- args.data = data;
-
- return ioctl(fh, I2C_SMBUS, &args);
-}
-
-static mraa_i2c_context
-mraa_i2c_init_internal(mraa_adv_func_t* advance_func, unsigned int bus)
-{
- mraa_result_t status = MRAA_SUCCESS;
-
- if (advance_func == NULL)
- return NULL;
-
- mraa_i2c_context dev = (mraa_i2c_context) calloc(1, sizeof(struct _i2c));
- if (dev == NULL) {
- syslog(LOG_CRIT, "i2c: Failed to allocate memory for context");
- return NULL;
- }
-
- dev->advance_func = advance_func;
- dev->busnum = bus;
-
- if (IS_FUNC_DEFINED(dev, i2c_init_pre)) {
- status = advance_func->i2c_init_pre(bus);
- if (status != MRAA_SUCCESS)
- goto init_internal_cleanup;
- }
-
- if (IS_FUNC_DEFINED(dev, i2c_init_bus_replace)) {
- status = dev->advance_func->i2c_init_bus_replace(dev);
- if (status != MRAA_SUCCESS)
- goto init_internal_cleanup;
- } else {
- char filepath[32];
- snprintf(filepath, 32, "/dev/i2c-%u", bus);
- if ((dev->fh = open(filepath, O_RDWR)) < 1) {
- syslog(LOG_ERR, "i2c: Failed to open requested i2c port %s", filepath);
- status = MRAA_ERROR_NO_RESOURCES;
- goto init_internal_cleanup;
- }
-
- if (ioctl(dev->fh, I2C_FUNCS, &dev->funcs) < 0) {
- syslog(LOG_CRIT, "i2c: Failed to get I2C_FUNC map from device");
- dev->funcs = 0;
- }
- }
-
- if (IS_FUNC_DEFINED(dev, i2c_init_post)) {
- status = dev->advance_func->i2c_init_post(dev);
- if (status != MRAA_SUCCESS)
- goto init_internal_cleanup;
- }
-
-
-init_internal_cleanup:
- if (status == MRAA_SUCCESS) {
- return dev;
- } else {
- if (dev != NULL)
- free(dev);
- return NULL;
- }
-}
-
-
-mraa_i2c_context
-mraa_i2c_init(int bus)
-{
- mraa_board_t* board = plat;
- if (board == NULL) {
- syslog(LOG_ERR, "i2c: Platform Not Initialised");
- return NULL;
- }
-
- if (mraa_is_sub_platform_id(bus)) {
- syslog(LOG_NOTICE, "i2c: Using sub platform");
- board = board->sub_platform;
- if (board == NULL) {
- syslog(LOG_ERR, "i2c: Sub platform Not Initialised");
- return NULL;
- }
- bus = mraa_get_sub_platform_index(bus);
- }
- syslog(LOG_NOTICE, "i2c: Selected bus %d", bus);
-
- if (board->i2c_bus_count == 0) {
- syslog(LOG_ERR, "No i2c buses defined in platform");
- return NULL;
- }
- if (bus >= board->i2c_bus_count) {
- syslog(LOG_ERR, "Above i2c bus count");
- return NULL;
- }
-
- if (board->i2c_bus[bus].bus_id == -1) {
- syslog(LOG_ERR, "Invalid i2c bus, moving to default i2c bus");
- bus = board->def_i2c_bus;
- }
- if (!board->no_bus_mux) {
- int pos = board->i2c_bus[bus].sda;
- if (board->pins[pos].i2c.mux_total > 0) {
- if (mraa_setup_mux_mapped(board->pins[pos].i2c) != MRAA_SUCCESS) {
- syslog(LOG_ERR, "i2c: Failed to set-up i2c sda multiplexer");
- return NULL;
- }
- }
-
- pos = board->i2c_bus[bus].scl;
- if (board->pins[pos].i2c.mux_total > 0) {
- if (mraa_setup_mux_mapped(board->pins[pos].i2c) != MRAA_SUCCESS) {
- syslog(LOG_ERR, "i2c: Failed to set-up i2c scl multiplexer");
- return NULL;
- }
- }
- }
-
- return mraa_i2c_init_internal(board->adv_func, (unsigned int) board->i2c_bus[bus].bus_id);
-}
-
-
-mraa_i2c_context
-mraa_i2c_init_raw(unsigned int bus)
-{
- return mraa_i2c_init_internal(plat == NULL ? NULL : plat->adv_func, bus);
-}
-
-
-mraa_result_t
-mraa_i2c_frequency(mraa_i2c_context dev, mraa_i2c_mode_t mode)
-{
- if (IS_FUNC_DEFINED(dev, i2c_set_frequency_replace)) {
- return dev->advance_func->i2c_set_frequency_replace(dev, mode);
- }
- return MRAA_ERROR_FEATURE_NOT_SUPPORTED;
-}
-
-int
-mraa_i2c_read(mraa_i2c_context dev, uint8_t* data, int length)
-{
- int bytes_read = 0;
- if (IS_FUNC_DEFINED(dev, i2c_read_replace)) {
- bytes_read = dev->advance_func->i2c_read_replace(dev, data, length);
- }
- else {
- bytes_read = read(dev->fh, data, length);
- }
- if (bytes_read == length) {
- return length;
- }
-
- return 0;
-}
-
-uint8_t
-mraa_i2c_read_byte(mraa_i2c_context dev)
-{
- if (IS_FUNC_DEFINED(dev, i2c_read_byte_replace))
- return dev->advance_func->i2c_read_byte_replace(dev);
- i2c_smbus_data_t d;
- if (mraa_i2c_smbus_access(dev->fh, I2C_SMBUS_READ, I2C_NOCMD, I2C_SMBUS_BYTE, &d) < 0) {
- syslog(LOG_ERR, "i2c: Failed to write");
- return 0;
- }
- return 0x0FF & d.byte;
-}
-
-uint8_t
-mraa_i2c_read_byte_data(mraa_i2c_context dev, uint8_t command)
-{
- if (IS_FUNC_DEFINED(dev, i2c_read_byte_data_replace))
- return dev->advance_func->i2c_read_byte_data_replace(dev, command);
- i2c_smbus_data_t d;
- if (mraa_i2c_smbus_access(dev->fh, I2C_SMBUS_READ, command, I2C_SMBUS_BYTE_DATA, &d) < 0) {
- syslog(LOG_ERR, "i2c: Failed to write");
- return 0;
- }
- return 0x0FF & d.byte;
-}
-
-uint16_t
-mraa_i2c_read_word_data(mraa_i2c_context dev, uint8_t command)
-{
- if (IS_FUNC_DEFINED(dev, i2c_read_word_data_replace))
- return dev->advance_func->i2c_read_word_data_replace(dev, command);
- i2c_smbus_data_t d;
- if (mraa_i2c_smbus_access(dev->fh, I2C_SMBUS_READ, command, I2C_SMBUS_WORD_DATA, &d) < 0) {
- syslog(LOG_ERR, "i2c: Failed to write");
- return 0;
- }
- return 0xFFFF & d.word;
-}
-
-int
-mraa_i2c_read_bytes_data(mraa_i2c_context dev, uint8_t command, uint8_t* data, int length)
-{
- if (IS_FUNC_DEFINED(dev, i2c_read_bytes_data_replace))
- return dev->advance_func->i2c_read_bytes_data_replace(dev, command, data, length);
- struct i2c_rdwr_ioctl_data d;
- struct i2c_msg m[2];
-
- m[0].addr = dev->addr;
- m[0].flags = 0x00;
- m[0].len = 1;
- m[0].buf = &command;
- m[1].addr = dev->addr;
- m[1].flags = I2C_M_RD;
- m[1].len = length;
- m[1].buf = data;
-
- d.msgs = m;
- d.nmsgs = 2;
-
- return ioctl(dev->fh, I2C_RDWR, &d) < 0 ? -1 : length;
-}
-
-mraa_result_t
-mraa_i2c_write(mraa_i2c_context dev, const uint8_t* data, int length)
-{
- if (IS_FUNC_DEFINED(dev, i2c_write_replace))
- return dev->advance_func->i2c_write_replace(dev, data, length);
- i2c_smbus_data_t d;
- int i;
- uint8_t command = data[0];
-
- data = &data[1];
- length = length - 1;
- if (length > I2C_SMBUS_I2C_BLOCK_MAX) {
- length = I2C_SMBUS_I2C_BLOCK_MAX;
- }
-
- for (i = 1; i <= length; i++) {
- d.block[i] = data[i - 1];
- }
- d.block[0] = length;
-
- return mraa_i2c_smbus_access(dev->fh, I2C_SMBUS_WRITE, command, I2C_SMBUS_I2C_BLOCK_DATA, &d);
-}
-
-mraa_result_t
-mraa_i2c_write_byte(mraa_i2c_context dev, const uint8_t data)
-{
- if (IS_FUNC_DEFINED(dev, i2c_write_byte_replace)) {
- return dev->advance_func->i2c_write_byte_replace(dev, data);
- } else {
- if (mraa_i2c_smbus_access(dev->fh, I2C_SMBUS_WRITE, data, I2C_SMBUS_BYTE, NULL) < 0) {
- syslog(LOG_ERR, "i2c: Failed to write");
- return MRAA_ERROR_INVALID_HANDLE;
- }
- return MRAA_SUCCESS;
- }
-}
-
-mraa_result_t
-mraa_i2c_write_byte_data(mraa_i2c_context dev, const uint8_t data, const uint8_t command)
-{
- if (IS_FUNC_DEFINED(dev, i2c_write_byte_data_replace))
- return dev->advance_func->i2c_write_byte_data_replace(dev, data, command);
- i2c_smbus_data_t d;
- d.byte = data;
- if (mraa_i2c_smbus_access(dev->fh, I2C_SMBUS_WRITE, command, I2C_SMBUS_BYTE_DATA, &d) < 0) {
- syslog(LOG_ERR, "i2c: Failed to write");
- return MRAA_ERROR_INVALID_HANDLE;
- }
- return MRAA_SUCCESS;
-}
-
-mraa_result_t
-mraa_i2c_write_word_data(mraa_i2c_context dev, const uint16_t data, const uint8_t command)
-{
- if (IS_FUNC_DEFINED(dev, i2c_write_word_data_replace))
- return dev->advance_func->i2c_write_word_data_replace(dev, data, command);
- i2c_smbus_data_t d;
- d.word = data;
- if (mraa_i2c_smbus_access(dev->fh, I2C_SMBUS_WRITE, command, I2C_SMBUS_WORD_DATA, &d) < 0) {
- syslog(LOG_ERR, "i2c: Failed to write");
- return MRAA_ERROR_INVALID_HANDLE;
- }
- return MRAA_SUCCESS;
-}
-
-mraa_result_t
-mraa_i2c_address(mraa_i2c_context dev, uint8_t addr)
-{
- if (dev == NULL) {
- return MRAA_ERROR_INVALID_HANDLE;
- }
-
- dev->addr = (int) addr;
- if (IS_FUNC_DEFINED(dev, i2c_address_replace)) {
- return dev->advance_func->i2c_address_replace(dev, addr);
- } else {
- if (ioctl(dev->fh, I2C_SLAVE_FORCE, addr) < 0) {
- syslog(LOG_ERR, "i2c: Failed to set slave address %d", addr);
- return MRAA_ERROR_INVALID_HANDLE;
- }
- return MRAA_SUCCESS;
- }
-}
-
-
-mraa_result_t
-mraa_i2c_stop(mraa_i2c_context dev)
-{
- free(dev);
- return MRAA_SUCCESS;
-}
-
diff --git a/peripheral/libmraa/src/iio/iio.c b/peripheral/libmraa/src/iio/iio.c
deleted file mode 100644
index fd2c7f6..0000000
--- a/peripheral/libmraa/src/iio/iio.c
+++ /dev/null
@@ -1,654 +0,0 @@
-/*
- * Author: Brendan Le Foll <brendan.le.foll@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include "iio.h"
-#include "mraa_internal.h"
-#include "dirent.h"
-#include <string.h>
-#include <poll.h>
-#include <sys/ioctl.h>
-#include <sys/stat.h>
-
-#define MAX_SIZE 128
-#define IIO_DEVICE "iio:device"
-#define IIO_SCAN_ELEM "scan_elements"
-#define IIO_MOUNTING_MATRIX "mounting_matrix"
-#define IIO_SLASH_DEV "/dev/" IIO_DEVICE
-#define IIO_SYSFS_DEVICE "/sys/bus/iio/devices/" IIO_DEVICE
-#define IIO_EVENTS "events"
-#define IIO_CONFIGFS_TRIGGER "/sys/kernel/config/iio/triggers/"
-
-mraa_iio_context
-mraa_iio_init(int device)
-{
- if (plat_iio->iio_device_count == 0 || device >= plat_iio->iio_device_count) {
- return NULL;
- }
-
- mraa_iio_get_channel_data(&plat_iio->iio_devices[device]);
- mraa_iio_get_event_data(&plat_iio->iio_devices[device]);
-
- return &plat_iio->iio_devices[device];
-}
-
-int
-mraa_iio_read_size(mraa_iio_context dev)
-{
- return dev->datasize;
-}
-
-mraa_iio_channel*
-mraa_iio_get_channels(mraa_iio_context dev)
-{
- return dev->channels;
-}
-
-int
-mraa_iio_get_channel_count(mraa_iio_context dev)
-{
- return dev->chan_num;
-}
-
-mraa_result_t
-mraa_iio_get_channel_data(mraa_iio_context dev)
-{
- const struct dirent* ent;
- DIR* dir;
- int chan_num = 0;
- char buf[MAX_SIZE];
- char readbuf[32];
- int fd;
- int ret = 0;
- int padint = 0;
- int curr_bytes = 0;
- char shortbuf, signchar;
-
- dev->datasize = 0;
-
- memset(buf, 0, MAX_SIZE);
- snprintf(buf, MAX_SIZE, IIO_SYSFS_DEVICE "%d/" IIO_SCAN_ELEM, dev->num);
- dir = opendir(buf);
- if (dir != NULL) {
- while ((ent = readdir(dir)) != NULL) {
- if (strcmp(ent->d_name + strlen(ent->d_name) - strlen("_en"), "_en") == 0) {
- chan_num++;
- }
- }
- }
- dev->chan_num = chan_num;
- // no need proceed if no channel found
- if (chan_num == 0) {
- closedir(dir);
- return MRAA_SUCCESS;
- }
- mraa_iio_channel* chan;
- dev->channels = calloc(chan_num, sizeof(mraa_iio_channel));
- seekdir(dir, 0);
- while ((ent = readdir(dir)) != NULL) {
- if (strcmp(ent->d_name + strlen(ent->d_name) - strlen("_index"), "_index") == 0) {
- snprintf(buf, MAX_SIZE, IIO_SYSFS_DEVICE "%d/" IIO_SCAN_ELEM "/%s", dev->num, ent->d_name);
- fd = open(buf, O_RDONLY);
- if (fd != -1) {
- if (read(fd, readbuf, 2 * sizeof(char)) != 2) {
- close(fd);
- break;
- }
- chan_num = ((int) strtol(readbuf, NULL, 10));
- chan = &dev->channels[chan_num];
- chan->index = chan_num;
- close(fd);
-
- buf[(strlen(buf) - 5)] = '\0';
- char* str = strdup(buf);
- // grab the type of the buffer
- snprintf(buf, MAX_SIZE, "%stype", str);
- fd = open(buf, O_RDONLY);
- if (fd != -1) {
- read(fd, readbuf, 31 * sizeof(char));
- ret = sscanf(readbuf, "%ce:%c%u/%u>>%u", &shortbuf, &signchar, &chan->bits_used,
- &padint, &chan->shift);
- chan->bytes = padint / 8;
- if (curr_bytes % chan->bytes == 0) {
- chan->location = curr_bytes;
- } else {
- chan->location = curr_bytes - curr_bytes % chan->bytes + chan->bytes;
- }
- curr_bytes = chan->location + chan->bytes;
- // probably should be 5?
- if (ret < 0) {
- // cleanup
- free(str);
- close(fd);
- return MRAA_IO_SETUP_FAILURE;
- }
- chan->signedd = (signchar == 's');
- chan->lendian = (shortbuf == 'l');
- if (chan->bits_used == 64) {
- chan->mask = ~0;
- } else {
- chan->mask = (1 << chan->bits_used) - 1;
- }
- close(fd);
- }
- // grab the enable flag of channel
- snprintf(buf, MAX_SIZE, "%sen", str);
- fd = open(buf, O_RDONLY);
- if (fd != -1) {
- if (read(fd, readbuf, 2 * sizeof(char)) != 2) {
- syslog(LOG_ERR, "iio: Failed to read a sensible value from sysfs");
- free(str);
- close(fd);
- return -1;
- }
- chan->enabled = (int) strtol(readbuf, NULL, 10);
- // only calculate enable buffer size for trigger buffer extract data
- if (chan->enabled) {
- dev->datasize += chan->bytes;
- }
- close(fd);
- }
- // clean up str var
- free(str);
- }
- }
- }
- closedir(dir);
-
- return MRAA_SUCCESS;
-}
-
-const char*
-mraa_iio_get_device_name(mraa_iio_context dev)
-{
- return dev->name;
-}
-
-int
-mraa_iio_get_device_num_by_name(const char* name)
-{
- int i;
-
- if (plat_iio == NULL) {
- syslog(LOG_ERR, "iio: platform IIO structure is not initialized");
- return -1;
- }
-
- if (name == NULL) {
- syslog(LOG_ERR, "iio: device name is NULL, unable to find its number");
- return -1;
- }
-
- for (i = 0; i < plat_iio->iio_device_count; i++) {
- struct _iio* device;
- device = &plat_iio->iio_devices[i];
- // we want to check for exact match
- if (strncmp(device->name, name, strlen(device->name) + 1) == 0) {
- return device->num;
- }
- }
-
- return -1;
-}
-
-mraa_result_t
-mraa_iio_read_float(mraa_iio_context dev, const char* attr_name, float* data)
-{
- char buf[MAX_SIZE];
- mraa_result_t result = mraa_iio_read_string(dev, attr_name, buf, MAX_SIZE-1);
- if (result != MRAA_SUCCESS)
- return result;
- int status = sscanf(buf, "%f", data);
- result = status == 1 ? MRAA_SUCCESS : MRAA_ERROR_UNSPECIFIED;
- return result;
-}
-
-
-mraa_result_t
-mraa_iio_read_int(mraa_iio_context dev, const char* attr_name, int* data)
-{
- char buf[MAX_SIZE];
- mraa_result_t result = mraa_iio_read_string(dev, attr_name, buf, MAX_SIZE-1);
- if (result != MRAA_SUCCESS)
- return result;
- int status = sscanf(buf, "%d", data);
- result = status == 1 ? MRAA_SUCCESS : MRAA_ERROR_UNSPECIFIED;
- return result;
-}
-
-mraa_result_t
-mraa_iio_read_string(mraa_iio_context dev, const char* attr_name, char* data, int max_len)
-{
- char buf[MAX_SIZE];
- mraa_result_t result = MRAA_ERROR_UNSPECIFIED;
- snprintf(buf, MAX_SIZE, IIO_SYSFS_DEVICE "%d/%s", dev->num, attr_name);
- int fd = open(buf, O_RDONLY);
- if (fd != -1) {
- ssize_t len = read(fd, data, max_len);
- if (len > 0)
- result = MRAA_SUCCESS;
- close(fd);
- }
- return result;
-
-}
-
-mraa_result_t
-mraa_iio_write_float(mraa_iio_context dev, const char* attr_name, const float data)
-{
- char buf[MAX_SIZE];
- snprintf(buf, MAX_SIZE, "%f", data);
- return mraa_iio_write_string(dev, attr_name, buf);
-}
-
-mraa_result_t
-mraa_iio_write_int(mraa_iio_context dev, const char* attr_name, const int data)
-{
- char buf[MAX_SIZE];
- snprintf(buf, MAX_SIZE, "%d", data);
- return mraa_iio_write_string(dev, attr_name, buf);
-}
-
-mraa_result_t
-mraa_iio_write_string(mraa_iio_context dev, const char* attr_name, const char* data)
-{
- char buf[MAX_SIZE];
- mraa_result_t result = MRAA_ERROR_UNSPECIFIED;
- snprintf(buf, MAX_SIZE, IIO_SYSFS_DEVICE "%d/%s", dev->num, attr_name);
- int fd = open(buf, O_WRONLY);
- if (fd != -1) {
- size_t len = strlen(data);
- ssize_t status = write(fd, data, len);
- if (status == len)
- result = MRAA_SUCCESS;
- close(fd);
- }
- return result;
-}
-
-static mraa_result_t
-mraa_iio_wait_event(int fd, char* data, int* read_size)
-{
- struct pollfd pfd;
-
- if (fd < 0) {
- return MRAA_ERROR_INVALID_RESOURCE;
- }
-
- pfd.fd = fd;
- pfd.events = POLLIN;
-
- // Wait for it forever or until pthread_cancel
- // poll is a cancelable point like sleep()
- int x = poll(&pfd, 1, -1);
-
- memset(data, 0, 100);
- *read_size = read(fd, data, 100);
-
- return MRAA_SUCCESS;
-}
-
-static void*
-mraa_iio_trigger_handler(void* arg)
-{
- mraa_iio_context dev = (mraa_iio_context) arg;
- int i;
- char data[MAX_SIZE * 100];
- int read_size;
-
- for (;;) {
- if (mraa_iio_wait_event(dev->fp, &data[0], &read_size) == MRAA_SUCCESS) {
-#ifdef HAVE_PTHREAD_CANCEL
- pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
-#endif
- // only can process if readsize >= enabled channel's datasize
- for (i = 0; i < (read_size / dev->datasize); i++) {
- dev->isr((void*)&data);
- }
-#ifdef HAVE_PTHREAD_CANCEL
- pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
-#endif
- } else {
- // we must have got an error code so die nicely
-#ifdef HAVE_PTHREAD_CANCEL
- pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
-#endif
- return NULL;
- }
- }
-}
-
-mraa_result_t
-mraa_iio_trigger_buffer(mraa_iio_context dev, void (*fptr)(char* data), void* args)
-{
- char bu[MAX_SIZE];
- if (dev->thread_id != 0) {
- return MRAA_ERROR_NO_RESOURCES;
- }
-
- sprintf(bu, IIO_SLASH_DEV "%d", dev->num);
- dev->fp = open(bu, O_RDONLY | O_NONBLOCK);
- if (dev->fp == -1) {
- return MRAA_ERROR_INVALID_RESOURCE;
- }
-
- dev->isr = fptr;
- pthread_create(&dev->thread_id, NULL, mraa_iio_trigger_handler, (void*) dev);
-
- return MRAA_SUCCESS;
-}
-
-mraa_result_t
-mraa_iio_get_event_data(mraa_iio_context dev)
-{
- const struct dirent* ent;
- DIR* dir;
- int event_num = 0;
- char buf[MAX_SIZE];
- char readbuf[32];
- int fd;
- int ret = 0;
- int padint = 0;
- int curr_bytes = 0;
- char shortbuf, signchar;
- memset(buf, 0, MAX_SIZE);
- memset(readbuf, 0, 32);
- snprintf(buf, MAX_SIZE, IIO_SYSFS_DEVICE "%d/" IIO_EVENTS, dev->num);
- dir = opendir(buf);
- if (dir != NULL) {
- while ((ent = readdir(dir)) != NULL) {
- if (strcmp(ent->d_name + strlen(ent->d_name) - strlen("_en"), "_en") == 0) {
- event_num++;
- }
- }
- dev->event_num = event_num;
- // no need proceed if no event found
- if (event_num == 0) {
- closedir(dir);
- return MRAA_SUCCESS;
- }
- mraa_iio_event* event;
- dev->events = calloc(event_num, sizeof(mraa_iio_event));
- if (dev->events == NULL) {
- closedir(dir);
- return MRAA_ERROR_UNSPECIFIED;
- }
- rewinddir(dir);
- event_num = 0;
- while ((ent = readdir(dir)) != NULL) {
- if (strcmp(ent->d_name + strlen(ent->d_name) - strlen("_en"), "_en") == 0) {
- event = &dev->events[event_num];
- event->name = strdup(ent->d_name);
- snprintf(buf, MAX_SIZE, IIO_SYSFS_DEVICE "%d/" IIO_EVENTS "/%s", dev->num, ent->d_name);
- fd = open(buf, O_RDONLY);
- if (fd != -1) {
- if (read(fd, readbuf, 2 * sizeof(char)) != 2) {
- close(fd);
- break;
- }
- close(fd);
- }
- event->enabled = ((int) strtol(readbuf, NULL, 10));
- // Todo, read other event info.
- event_num++;
- }
- }
- closedir(dir);
- }
- return MRAA_SUCCESS;
-}
-
-static mraa_result_t
-mraa_iio_event_poll_nonblock(int fd, struct iio_event_data* data)
-{
- struct pollfd pfd;
-
- if (fd < 0) {
- return MRAA_ERROR_INVALID_RESOURCE;
- }
-
- pfd.fd = fd;
- pfd.events = POLLIN;
-
- // Wait for it forever or until pthread_cancel
- // poll is a cancelable point like sleep()
- int x = poll(&pfd, 1, -1);
-
- read(fd, data, sizeof(struct iio_event_data));
-
- return MRAA_SUCCESS;
-}
-
-mraa_result_t
-mraa_iio_event_poll(mraa_iio_context dev, struct iio_event_data* data)
-{
- char bu[MAX_SIZE];
- int ret;
- int event_fd;
- int fd;
-
- snprintf(bu, MAX_SIZE, IIO_SLASH_DEV "%d", dev->num);
- fd = open(bu, 0);
- if (fd != -1) {
- ret = ioctl(fd, IIO_GET_EVENT_FD_IOCTL, &event_fd);
- close(fd);
- } else {
- return MRAA_ERROR_UNSPECIFIED;
- }
-
- if (ret == -1 || event_fd == -1)
- return MRAA_ERROR_UNSPECIFIED;
-
- ret = read(event_fd, data, sizeof(struct iio_event_data));
-
- close(event_fd);
- return MRAA_SUCCESS;
-}
-
-static void*
-mraa_iio_event_handler(void* arg)
-{
- struct iio_event_data data;
- mraa_iio_context dev = (mraa_iio_context) arg;
-
- for (;;) {
- if (mraa_iio_event_poll_nonblock(dev->fp_event, &data) == MRAA_SUCCESS) {
-#ifdef HAVE_PTHREAD_CANCEL
- pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
-#endif
- dev->isr_event(&data, dev->isr_args);
-#ifdef HAVE_PTHREAD_CANCEL
- pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
-#endif
- } else {
- // we must have got an error code so die nicely
-#ifdef HAVE_PTHREAD_CANCEL
- pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
-#endif
- return NULL;
- }
- }
-}
-
-mraa_result_t
-mraa_iio_event_setup_callback(mraa_iio_context dev, void (*fptr)(struct iio_event_data* data, void* args), void* args)
-{
- int ret;
- char bu[MAX_SIZE];
- if (dev->thread_id != 0) {
- return MRAA_ERROR_NO_RESOURCES;
- }
-
- sprintf(bu, IIO_SLASH_DEV "%d", dev->num);
- dev->fp = open(bu, O_RDONLY | O_NONBLOCK);
- if (dev->fp == -1) {
- return MRAA_ERROR_INVALID_RESOURCE;
- }
- ret = ioctl(dev->fp, IIO_GET_EVENT_FD_IOCTL, &dev->fp_event);
- close(dev->fp);
-
- if (ret == -1 || dev->fp_event == -1) {
- return MRAA_ERROR_UNSPECIFIED;
- }
-
- dev->isr_event = fptr;
- dev->isr_args = args;
- pthread_create(&dev->thread_id, NULL, mraa_iio_event_handler, (void*) dev);
-
- return MRAA_SUCCESS;
-}
-
-mraa_result_t
-mraa_iio_event_extract_event(struct iio_event_data* event,
- int* chan_type,
- int* modifier,
- int* type,
- int* direction,
- int* channel,
- int* channel2,
- int* different)
-{
- *chan_type = IIO_EVENT_CODE_EXTRACT_CHAN_TYPE(event->id);
- *modifier = IIO_EVENT_CODE_EXTRACT_MODIFIER(event->id);
- *type = IIO_EVENT_CODE_EXTRACT_TYPE(event->id);
- *direction = IIO_EVENT_CODE_EXTRACT_DIR(event->id);
- *channel = IIO_EVENT_CODE_EXTRACT_CHAN(event->id);
- *channel2 = IIO_EVENT_CODE_EXTRACT_CHAN2(event->id);
- *different = IIO_EVENT_CODE_EXTRACT_DIFF(event->id);
- return MRAA_SUCCESS;
-}
-
-mraa_result_t
-mraa_iio_get_mounting_matrix(mraa_iio_context dev, float mm[9])
-{
- char buf[MAX_SIZE];
- FILE* fp;
- int ret;
-
- memset(buf, 0, MAX_SIZE);
- snprintf(buf, MAX_SIZE, IIO_SYSFS_DEVICE "%d/" IIO_MOUNTING_MATRIX, dev->num);
- fp = fopen(buf, "r");
- if (fp != NULL) {
- ret = fscanf(fp, "%f %f %f\n%f %f %f\n%f %f %f\n", &mm[0], &mm[1], &mm[2], &mm[3], &mm[4], &mm[5],
- &mm[6], &mm[7], &mm[8]);
- fclose(fp);
- if (ret != 9) {
- return MRAA_ERROR_UNSPECIFIED;
- }
- return MRAA_SUCCESS;
- }
- return MRAA_ERROR_UNSPECIFIED;
-}
-
-mraa_result_t
-mraa_iio_create_trigger(mraa_iio_context dev, const char* trigger)
-{
- struct stat configfs_status;
- struct stat trigger_status;
- char buf[MAX_SIZE];
- int ret;
-
- if (stat(IIO_CONFIGFS_TRIGGER, &configfs_status) == 0) {
- memset(buf, 0, MAX_SIZE);
- snprintf(buf, MAX_SIZE, IIO_CONFIGFS_TRIGGER "%s", trigger);
- // we actually don't care if this doesn't succeed, as it just means
- // it's already been initialised
- mkdir(buf, configfs_status.st_mode);
- }
-
- return MRAA_ERROR_UNSPECIFIED;
-}
-
-mraa_result_t
-mraa_iio_update_channels(mraa_iio_context dev)
-{
- const struct dirent* ent;
- DIR* dir;
- int chan_num = 0;
- char buf[MAX_SIZE];
- char readbuf[32];
- int fd;
- mraa_iio_channel* chan;
-
- dev->datasize = 0;
- memset(buf, 0, MAX_SIZE);
- snprintf(buf, MAX_SIZE, IIO_SYSFS_DEVICE "%d/" IIO_SCAN_ELEM, dev->num);
- dir = opendir(buf);
- if (dir != NULL) {
- while ((ent = readdir(dir)) != NULL) {
- if (strcmp(ent->d_name + strlen(ent->d_name) - strlen("_index"), "_index") == 0) {
- snprintf(buf, MAX_SIZE, IIO_SYSFS_DEVICE "%d/" IIO_SCAN_ELEM "/%s", dev->num, ent->d_name);
- fd = open(buf, O_RDONLY);
- if (fd != -1) {
- if (read(fd, readbuf, 2 * sizeof(char)) != 2) {
- close(fd);
- break;
- }
- chan_num = ((int) strtol(readbuf, NULL, 10));
- if (chan_num >= 0 && chan_num < dev->chan_num) {
- chan = &dev->channels[chan_num];
- chan->index = chan_num;
- close(fd);
-
- buf[(strlen(buf) - 5)] = '\0';
- char* str = strdup(buf);
- // grab the enable flag of channel
- snprintf(buf, MAX_SIZE, "%sen", str);
- fd = open(buf, O_RDONLY);
- if (fd != -1) {
- if (read(fd, readbuf, 2 * sizeof(char)) != 2) {
- syslog(LOG_ERR, "iio: Failed to read a sensible value from sysfs");
- free(str);
- close(fd);
- closedir(dir);
- return -1;
- }
- chan->enabled = (int) strtol(readbuf, NULL, 10);
- // only calculate enable buffer size for trigger buffer extract data
- if (chan->enabled) {
- dev->datasize += chan->bytes;
- }
- close(fd);
- }
- // clean up str var
- free(str);
- }
- else {
- close(fd);
- }
- }
- }
- }
- closedir(dir);
- return MRAA_SUCCESS;
- }
-
- return MRAA_ERROR_INVALID_HANDLE;
-}
-
-mraa_result_t
-mraa_iio_close(mraa_iio_context dev)
-{
- free(dev->channels);
- return MRAA_SUCCESS;
-}
diff --git a/peripheral/libmraa/src/java/CMakeLists.txt b/peripheral/libmraa/src/java/CMakeLists.txt
deleted file mode 100644
index 33ec6af..0000000
--- a/peripheral/libmraa/src/java/CMakeLists.txt
+++ /dev/null
@@ -1,49 +0,0 @@
-FIND_PACKAGE (JNI REQUIRED)
-
-include_directories (
- ${JAVA_INCLUDE_PATH}
- ${JAVA_INCLUDE_PATH2}
- ${CMAKE_CURRENT_SOURCE_DIR}/..
-)
-
-# SWIG treats SWIG_FLAGS as a list and not a string so semicolon seperation is required
-set_source_files_properties (mraajava.i PROPERTIES SWIG_FLAGS ";-package;mraa;-I${CMAKE_BINARY_DIR}/src")
-set_source_files_properties (mraajava.i PROPERTIES CPLUSPLUS ON)
-
-set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive -DJAVACALLBACK")
-set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DJAVACALLBACK")
-
-if (NOT DEFINED ENV{JAVA_HOME_NATIVE})
- if (NOT DEFINED ENV{JAVA_HOME})
- message (FATAL_ERROR " - Neither JAVA_HOME nor JAVA_HOME_NATIVE are set")
- endif()
- set (JAVA_HOME_NATIVE $ENV{JAVA_HOME})
- set (JAVAC $ENV{JAVA_HOME}/bin/javac)
- set (JAR $ENV{JAVA_HOME}/bin/jar)
-else ()
- set (JAVAC $ENV{JAVA_HOME_NATIVE}/bin/javac)
- set (JAR $ENV{JAVA_HOME_NATIVE}/bin/jar)
-endif ()
-
-swig_add_module (mraajava java mraajava.i ${mraa_LIB_SRCS})
-swig_link_libraries (mraajava ${JAVA_LIBRARIES} ${mraa_LIBS})
-
-add_custom_command (TARGET mraajava
- POST_BUILD
- COMMAND cmake -E echo "Compiling java.."
- COMMAND cmake -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/mraa
- COMMAND ${JAVAC} *.java -d ${CMAKE_CURRENT_BINARY_DIR}
- COMMAND cmake -E echo "Creating jar"
- COMMAND ${JAR} cvf mraa.jar mraa
-)
-
-if (DOXYGEN_FOUND)
- foreach (_file ${DOCFILES})
- add_dependencies (${SWIG_MODULE_mraajava_REAL_NAME} ${_file}doc_i)
- endforeach ()
-endif ()
-
-mraa_create_install_pkgconfig (mraajava.pc ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
-
-install (TARGETS mraajava LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
-install (FILES ${CMAKE_CURRENT_BINARY_DIR}/mraa.jar DESTINATION ${CMAKE_INSTALL_LIBDIR}/../lib/java)
diff --git a/peripheral/libmraa/src/java/mraajava.i b/peripheral/libmraa/src/java/mraajava.i
deleted file mode 100644
index 9dc7142..0000000
--- a/peripheral/libmraa/src/java/mraajava.i
+++ /dev/null
@@ -1,87 +0,0 @@
-%module (directors="1",docstring="Java interface to libmraa") mraa
-
-%feature("autodoc", "3");
-
-%typemap(jtype) (uint8_t *txBuf, int length) "byte[]"
-%typemap(jstype) (uint8_t *txBuf, int length) "byte[]"
-%typemap(jni) (uint8_t *txBuf, int length) "jbyteArray"
-%typemap(javain) (uint8_t *txBuf, int length) "$javainput"
-
-%typemap(in,numinputs=1) (uint8_t *txBuf, int length) {
- $1 = JCALL2(GetByteArrayElements, jenv, $input, NULL);
- $2 = JCALL1(GetArrayLength, jenv, $input);
-}
-
-%typemap(jtype) (uint8_t *data, int length) "byte[]"
-%typemap(jstype) (uint8_t *data, int length) "byte[]"
-%typemap(jni) (uint8_t *data, int length) "jbyteArray"
-%typemap(javain) (uint8_t *data, int length) "$javainput"
-
-%typemap(in,numinputs=1) (uint8_t *data, int length) {
- $1 = JCALL2(GetByteArrayElements, jenv, $input, NULL);
- $2 = JCALL1(GetArrayLength, jenv, $input);
-}
-
-%typemap(argout) (uint8_t *data, int length) {
- JCALL3(ReleaseByteArrayElements, jenv, $input, $1, JNI_COMMIT);
-}
-
-%typemap(jtype) (const uint8_t *data, int length) "byte[]"
-%typemap(jstype) (const uint8_t *data, int length) "byte[]"
-%typemap(jni) (const uint8_t *data, int length) "jbyteArray"
-%typemap(javain) (const uint8_t *data, int length) "$javainput"
-%typemap(in) (const uint8_t *data, int length) {
- $1 = JCALL2(GetByteArrayElements, jenv, $input, NULL);
- $2 = JCALL1(GetArrayLength, jenv, $input);
-}
-
-%typemap(jtype) uint8_t * "byte[]"
-%typemap(jstype) uint8_t * "byte[]"
-%typemap(jni) uint8_t * "jbyteArray"
-%typemap(javaout) uint8_t * {
- return $jnicall;
-}
-
-%typemap(jtype) jobject runnable "java.lang.Runnable"
-%typemap(jstype) jobject runnable "java.lang.Runnable"
-
-namespace mraa {
-class Spi;
-%typemap(out) uint8_t*
-{
- /* need to loop over length */
- $result = JCALL1(NewByteArray, jenv, arg3);
- JCALL4(SetByteArrayRegion, jenv, $result, 0, arg3, (jbyte *) $1);
- free($1);
-}
-}
-
-%ignore write(const char* data, int length);
-%ignore read(char* data, int length);
-%ignore globVM;
-%ignore env_key;
-%ignore mraa_java_isr_callback;
-
-%include ../mraa.i
-
-%wrapper %{
- JavaVM *globVM;
-
- jint JNI_OnLoad(JavaVM *vm, void *reserved) {
- /* initialize mraa */
- globVM = vm;
- mraa_init();
- return JNI_VERSION_1_6;
- }
-%}
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("mraajava");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%}
diff --git a/peripheral/libmraa/src/java/mraajava.pc.cmake b/peripheral/libmraa/src/java/mraajava.pc.cmake
deleted file mode 100644
index e234153..0000000
--- a/peripheral/libmraa/src/java/mraajava.pc.cmake
+++ /dev/null
@@ -1,11 +0,0 @@
-prefix=@CMAKE_INSTALL_PREFIX@
-exec_prefix=${prefix}
-libdir=${exec_prefix}/lib@LIB_SUFFIX@
-includedir=${prefix}/include
-
-Name: mraa
-Description: Low Level Skeleton Library for Communication
-Version: @mraa_VERSION_STRING@
-
-Libs: -L${libdir} -lmraajava
-Cflags: -I${includedir}
diff --git a/peripheral/libmraa/src/javascript/CMakeLists.txt b/peripheral/libmraa/src/javascript/CMakeLists.txt
deleted file mode 100644
index 7885dad..0000000
--- a/peripheral/libmraa/src/javascript/CMakeLists.txt
+++ /dev/null
@@ -1,114 +0,0 @@
-find_package (Nodejs REQUIRED)
-
-include_directories (
- ${NODEJS_INCLUDE_DIRS}
- ${CMAKE_CURRENT_SOURCE_DIR}/..
-)
-
-# SWIG treats SWIG_FLAGS as a list and not a string so semicolon seperation is
-# required. This hardcodes V8_VERSION to be <10 but I assume that's not going
-# to be a problem for a little while! SWIG uses a padded SWIG_V8 version which
-# we hack together from our findnode module.
-set (V8_VERSION_HEX 0x0${V8_VERSION_MAJOR}${V8_VERSION_MINOR}${V8_VERSION_PATCH})
-string (LENGTH "${V8_VERSION_HEX}" V8_VERSION_HEX_length)
-while (V8_VERSION_HEX_length LESS 8)
- set (V8_VERSION_HEX "${V8_VERSION_HEX}0")
- message (DEBUG " - Padded V8 version to match SWIG format")
- string (LENGTH "${V8_VERSION_HEX}" V8_VERSION_HEX_length)
-endwhile ()
-
-set_property (SOURCE mraajs.i PROPERTY SWIG_FLAGS "-node"
- "-I${CMAKE_BINARY_DIR}/src" "-DV8_VERSION=${V8_VERSION_HEX}")
-set_source_files_properties (mraajs.i PROPERTIES CPLUSPLUS ON)
-
-swig_add_module (mraajs javascript mraajs.i ${mraa_LIB_SRCS})
-swig_link_libraries (mraajs ${mraa_LIBS})
-
-set_target_properties (mraajs PROPERTIES
- COMPILE_FLAGS " -DBUILDING_NODE_EXTENSION -DSWIGJAVASCRIPT=${SWIG_FOUND}"
- PREFIX ""
- OUTPUT_NAME mraa
- SUFFIX ".node"
-)
-
-message (INFO " - swig Version ${SWIG_VERSION}")
-message (INFO " - CXX compiler Version ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}")
-
-if (${V8_VERSION_MAJOR} GREATER 3)
- message (INFO " - Using V8 version > 3 so requiring C++11 compiler")
- # Node 0.12.x V8 engine major version is '3'.
- # Node 2.1.0 V8 engine major version is '4'.
- set_property (TARGET mraajs PROPERTY CXX_STANDARD 11)
- set_property (TARGET mraajs PROPERTY CXX_STANDARD_REQUIRED ON)
- if(CMAKE_VERSION VERSION_LESS "3.1")
- message(INFO " - **WARNING** Need to use CMAKE version 3.1+, but it is ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}")
- message(INFO " - So a workaround will be used.")
- if(CMAKE_COMPILER_IS_GNUCXX)
- if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.7")
- message(FATAL_ERROR " FATAL ERROR: GNU gcc compiler is also too old (need 4.7+, but ${CMAKE_CXX_COMPILER_VERSION}) and does not support C++11 standard.")
- endif()
- set(MRAA_CXX11_WORKAROUND_OPTION "-std=gnu++11")
- else()
- set(MRAA_CXX11_WORKAROUND_OPTION "-std=c++11")
- endif()
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MRAA_CXX11_WORKAROUND_OPTION} ")
- endif()
-endif ()
-
-macro (mraa_CREATE_INSTALL_PACKAGE_JSON generated_file install_location)
- configure_file (${generated_file}.cmake ${CMAKE_CURRENT_BINARY_DIR}/${generated_file} @ONLY)
- install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${generated_file} DESTINATION ${install_location})
-endmacro (mraa_CREATE_INSTALL_PACKAGE_JSON)
-mraa_create_install_package_json (package.json lib/node_modules/mraa)
-
-macro (mraa_CREATE_BINDING_GYP generated_file)
- set (mraa_LIB_SRCS_GYP "")
- set (mraa_NPM_SRCS ${mraa_LIB_SRCS_NOAUTO}
- ${mraa_LIB_ARM_SRCS_NOAUTO}
- ${mraa_LIB_X86_SRCS_NOAUTO}
- )
- foreach (srcfile ${mraa_NPM_SRCS})
- file (RELATIVE_PATH rel ${CMAKE_SOURCE_DIR} ${srcfile})
- set (mraa_LIB_SRCS_GYP "'${rel}',\n${mraa_LIB_SRCS_GYP}")
- endforeach (srcfile)
- foreach (includedir ${mraa_LIB_INCLUDE_DIRS})
- file (RELATIVE_PATH rel ${CMAKE_SOURCE_DIR} ${includedir})
- set (mraa_LIB_INCLUDE_DIRS_GYP "'${rel}',\n${mraa_LIB_INCLUDE_DIRS_GYP}")
- endforeach (includedir)
- configure_file (${generated_file}.cmake ${CMAKE_CURRENT_BINARY_DIR}/${generated_file} @ONLY)
-endmacro (mraa_CREATE_BINDING_GYP)
-mraa_create_binding_gyp (binding.gyp)
-
-add_custom_target (npmpkg)
-add_custom_command (TARGET npmpkg POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy
- ${CMAKE_CURRENT_BINARY_DIR}/mraajsJAVASCRIPT_wrap.cxx ${CMAKE_SOURCE_DIR}/src
- COMMAND ${CMAKE_COMMAND} -E copy
- ${CMAKE_BINARY_DIR}/src/version.c ${CMAKE_SOURCE_DIR}/src
- COMMAND ${CMAKE_COMMAND} -E copy
- ${CMAKE_CURRENT_BINARY_DIR}/package.json ${CMAKE_SOURCE_DIR}
- COMMAND sed -i "'s/mraa.node/build\\/Release\\/mraa.node/'"
- ${CMAKE_SOURCE_DIR}/package.json
- COMMAND ${CMAKE_COMMAND} -E copy
- ${CMAKE_CURRENT_BINARY_DIR}/binding.gyp ${CMAKE_SOURCE_DIR}
- COMMAND ${CMAKE_COMMAND} -E copy
- ${CMAKE_SOURCE_DIR}/docs/npm.md ${CMAKE_SOURCE_DIR}/READMEFIRST)
-add_dependencies (npmpkg mraajs)
-
-if (BUILDDOC)
- find_package(Yuidoc)
- if (YUIDOC_FOUND)
- add_custom_target(jsdoc ALL
- COMMAND ${CMAKE_SOURCE_DIR}/doxygen2jsdoc/docgen.js -m mraa i xml/ -o jsdoc -c ${CMAKE_CURRENT_SOURCE_DIR}/doxygen2jsdoc_custom.json --strict -h
- COMMAND ${YUIDOC_EXECUTABLE} -C --no-sort --helpers ${CMAKE_SOURCE_DIR}/doxygen2jsdoc/generators/yuidoc/tmpl/mraa/helper.js --themedir ${CMAKE_SOURCE_DIR}/doxygen2jsdoc/generators/yuidoc/tmpl/mraa -o html/node jsdoc/yuidoc/mraa
- COMMAND ${CMAKE_SOURCE_DIR}/doxygen2jsdoc/tolower.js -i html/node
- WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
- DEPENDS doc
- COMMENT "Generating API documentation with Yuidoc" VERBATIM
- )
- else ()
- message (INFO " - Failed to find Yuidoc. node.js API doc will not be generated")
- endif ()
-endif ()
-
-install (FILES ${CMAKE_CURRENT_BINARY_DIR}/mraa.node
- DESTINATION lib/node_modules/mraa)
diff --git a/peripheral/libmraa/src/javascript/binding.gyp.cmake b/peripheral/libmraa/src/javascript/binding.gyp.cmake
deleted file mode 100644
index 4675e26..0000000
--- a/peripheral/libmraa/src/javascript/binding.gyp.cmake
+++ /dev/null
@@ -1,37 +0,0 @@
-{
- 'targets': [
- {
- 'target_name': 'mraa',
- 'sources': [
-@mraa_LIB_SRCS_GYP@
-'src/version.c',
-'src/mraajsJAVASCRIPT_wrap.cxx' ],
- 'include_dirs': [
-@mraa_LIB_INCLUDE_DIRS_GYP@
- ],
- 'variables': {
- "v8_version%": "<!(node -e 'console.log(process.versions.v8)' | sed 's/\.//g' | cut -c 1-5)",
- "arch%": "<!(node -e 'console.log(process.arch)')"
- },
- 'cflags_cc!': [ '-fno-rtti', '-fno-exceptions' ],
- 'cflags!': [ '-fno-exceptions' ],
- 'conditions' : [
- [ 'arch=="x64"',
- { 'defines' : [ 'X86PLAT=ON' ], },
- ],
- [ 'arch=="ia32"',
- { 'defines' : [ 'X86PLAT=ON'], },
- ],
- [ 'arch=="arm"',
- { 'defines' : [ 'ARMPLAT=ON'], },
- ],
- ],
- 'defines' : [ 'SWIG',
- 'SWIGJAVASCRIPT',
- 'BUILDING_NODE_EXTENSION=1',
- 'SWIG_V8_VERSION=0x0<(v8_version)',
- 'V8_VERSION=0x0<(v8_version)'
- ]
- }
- ]
-}
diff --git a/peripheral/libmraa/src/javascript/doxygen2jsdoc_custom.json b/peripheral/libmraa/src/javascript/doxygen2jsdoc_custom.json
deleted file mode 100644
index e5a2af6..0000000
--- a/peripheral/libmraa/src/javascript/doxygen2jsdoc_custom.json
+++ /dev/null
@@ -1,77 +0,0 @@
-{
- "Uart": {
- "read": {
- "description": "Read length bytes from the device",
- "params": {
- "length": {
- "type": "Number",
- "description": "Size of read in bytes to make"
- }
- },
- "return": {
- "type": "Buffer",
- "description": "Data read"
- }
- },
- "write": {
- "description": "Write length bytes to the device",
- "params": {
- "length": {
- "type": "Number",
- "description": "Size of buffer to send"
- }
- },
- "return": {
- "type": "mraa_result_t",
- "description": "Result of operation"
- }
- }
- },
- "I2c": {
- "read": {
- "description": "Read length bytes from the bus",
- "params": {
- "length": {
- "type": "Number",
- "description": "Size of read in bytes to make"
- }
- },
- "return": {
- "type": "Buffer",
- "description": "Data read"
- }
- },
- "write": {
- "description": "Write length bytes to the bus, the first byte in the Buffer is the command/register to write",
- "params": {
- "length": {
- "type": "Number",
- "description": "Size of buffer to send"
- }
- },
- "return": {
- "type": "mraa_result_t",
- "description": "Result of operation"
- }
- }
- },
- "Gpio": {
- "isr": {
- "description": "Sets a callback to be called when pin value changes",
- "params": {
- "mode": {
- "type": "Edge",
- "description": "The edge mode to set"
- },
- "func": {
- "type": "Function",
- "description": "Function to be called when interupt is triggered"
- }
- },
- "return": {
- "type": "mraa_result_t",
- "description": "Result of operation"
- }
- }
- }
-}
diff --git a/peripheral/libmraa/src/javascript/mraajs.i b/peripheral/libmraa/src/javascript/mraajs.i
deleted file mode 100644
index 7ff07fa..0000000
--- a/peripheral/libmraa/src/javascript/mraajs.i
+++ /dev/null
@@ -1,139 +0,0 @@
-%module (docstring="Javascript interface to libmraa") mraa
-
-%feature("autodoc", "3");
-
-%include carrays.i
-%include cpointer.i
-%array_class(uint8_t, uint8Array);
-
-%inline %{
- #include <node_buffer.h>
-%}
-
-%typemap(in) (const char* data, int length) {
- if (!node::Buffer::HasInstance($input)) {
- SWIG_exception_fail(SWIG_ERROR, "Expected a node Buffer");
- }
- $1 = (char*) node::Buffer::Data($input);
- $2 = node::Buffer::Length($input);
-}
-
-%typemap(in) (const uint8_t *data, int length) {
- if (!node::Buffer::HasInstance($input)) {
- SWIG_exception_fail(SWIG_ERROR, "Expected a node Buffer");
- }
- $1 = (uint8_t*) node::Buffer::Data($input);
- $2 = node::Buffer::Length($input);
-}
-
-%typemap(in) (uint8_t *txBuf, int length) {
- if (!node::Buffer::HasInstance($input)) {
- SWIG_exception_fail(SWIG_ERROR, "Expected a node Buffer");
- }
- $1 = (uint8_t*) node::Buffer::Data($input);
- $2 = node::Buffer::Length($input);
-}
-
-%typemap(in) (v8::Handle<v8::Function> func) {
- $1 = v8::Local<v8::Function>::Cast($input);
-}
-
-namespace mraa {
-class Spi;
-%typemap(out) uint8_t*
-{
-%#if SWIG_V8_VERSION > 0x040000
- v8::MaybeLocal<v8::Object> objret = node::Buffer::Copy(v8::Isolate::GetCurrent(), (char*) result, arg3);
- free(result);
- if(!objret.ToLocal(&$result)){
- SWIG_exception_fail(SWIG_ERROR, "Spi buffer failed");
- }
-%#elif SWIG_V8_VERSION > 0x032870
- $result = node::Buffer::New((char*) result, arg3);
- free(result);
-%#else
- $result = node::Buffer::New((char*) result, arg3)->handle_;
- free(result);
-%#endif
-}
-}
-
-%newobject Uart::read(char* data, int length);
-%newobject I2c::read(uint8_t *data, int length);
-%newobject Spi::write(uint8_t *data, int length);
-
-//Uart::read()
-%typemap(in) (char* data, int length) {
- int x;
- int ecode = SWIG_AsVal_int($input, &x);
- if (!SWIG_IsOK(ecode)) {
- SWIG_exception_fail(SWIG_ArgError(ecode), "Expected an int");
- }
- $2 = x;
- if ($2 < 0) {
- SWIG_exception_fail(SWIG_ERROR, "Positive integer expected");
- }
- $1 = (char*) malloc($2 * sizeof(uint8_t));
-}
-
-%typemap(argout) (char* data, int length) {
- if (result < 0) { /* Check for I/O error */
- free($1);
- SWIG_exception_fail(SWIG_ERROR, "Uart write failed");
- }
-%#if SWIG_V8_VERSION > 0x040000
- v8::MaybeLocal<v8::Object> objret = node::Buffer::Copy(v8::Isolate::GetCurrent(), (char*) $1, result);
- free($1);
- if(!objret.ToLocal(&$result)) {
- SWIG_exception_fail(SWIG_ERROR, "Uart buffer failed");
- }
-%#elif SWIG_V8_VERSION > 0x032870
- $result = node::Buffer::New((char*) $1, result);
- free($1);
-%#else
- $result = node::Buffer::New((char*) $1, result)->handle_;
- free($1);
-%#endif
-
-}
-
-//I2c::read()
-%typemap(in) (uint8_t *data, int length) {
- int x;
- int ecode = SWIG_AsVal_int($input, &x);
- if (!SWIG_IsOK(ecode)) {
- SWIG_exception_fail(SWIG_ArgError(ecode), "Expected an int");
- }
- $2 = x;
- if ($2 < 0) {
- SWIG_exception_fail(SWIG_ERROR, "Positive integer expected");
- }
- $1 = (uint8_t*) malloc($2 * sizeof(uint8_t));
-}
-
-%typemap(argout) (uint8_t *data, int length) {
- if (result < 0) { /* Check for I/O error */
- free($1);
- SWIG_exception_fail(SWIG_ERROR, "I2c write failed");
- }
-%#if SWIG_V8_VERSION > 0x040000
- v8::MaybeLocal<v8::Object> objret = node::Buffer::Copy(v8::Isolate::GetCurrent(), (char*) $1, result);
- free($1);
- if(!objret.ToLocal(&$result)) {
- SWIG_exception_fail(SWIG_ERROR, "I2c buffer failed");
- }
-%#elif SWIG_V8_VERSION > 0x032870
- $result = node::Buffer::New((char*) $1, result);
- free($1);
-%#else
- $result = node::Buffer::New((char*) $1, result)->handle_;
- free($1);
-%#endif
-}
-
-%include ../mraa.i
-
-%init %{
- //Adding mraa_init() to the module initialisation process
- mraa_init();
-%}
diff --git a/peripheral/libmraa/src/javascript/package.json.cmake b/peripheral/libmraa/src/javascript/package.json.cmake
deleted file mode 100644
index 49dd744..0000000
--- a/peripheral/libmraa/src/javascript/package.json.cmake
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- "name" : "mraa",
- "description": "IO library that helps you use I2c, SPI, gpio, uart, pwm, analog inputs (aio) and more on a number of platforms such as the Intel galileo, the Intel edison and others",
- "keywords":["gpio", "edison","galileo","io", "mraajs", "spi", "i2c", "minnow", "intel"],
- "homepage": "http://github.com/intel-iot-devkit/mraa",
- "main" : "./mraa.node",
- "engines": {
- "node": ">= 0.10.x"
- },
- "bugs": {
- "url" : "http://github.com/intel-iot-devkit/mraa/issues"
- },
- "license": "MIT",
- "version": "@VERSION@",
- "authors": "See github.com/intel-iot-devkit/mraa/graphs/contributors"
-}
diff --git a/peripheral/libmraa/src/mraa.c b/peripheral/libmraa/src/mraa.c
deleted file mode 100644
index b8bc236..0000000
--- a/peripheral/libmraa/src/mraa.c
+++ /dev/null
@@ -1,806 +0,0 @@
-/*
- * Author: Brendan Le Foll <brendan.le.foll@intel.com>
- * Author: Thomas Ingleby <thomas.c.ingleby@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.
- */
-
-#define _GNU_SOURCE
-#if !defined(_XOPEN_SOURCE) || _XOPEN_SOURCE < 600
-#define _XOPEN_SOURCE 600 /* Get nftw() and S_IFSOCK declarations */
-#endif
-
-#include <stddef.h>
-#include <stdlib.h>
-#include <sched.h>
-#include <string.h>
-#include <pwd.h>
-#include <glob.h>
-#include <ftw.h>
-#include <dirent.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <string.h>
-#include <stdio.h>
-
-#include "mraa_internal.h"
-#include "gpio.h"
-#include "version.h"
-
-#define IIO_DEVICE_WILDCARD "iio:device*"
-mraa_board_t* plat = NULL;
-mraa_iio_info_t* plat_iio = NULL;
-
-static char* platform_name = NULL;
-static char* platform_long_name = NULL;
-
-static int num_i2c_devices = 0;
-static int num_iio_devices = 0;
-
-const char*
-mraa_get_version()
-{
- return gVERSION;
-}
-
-mraa_result_t
-mraa_set_log_level(int level)
-{
- if (level <= 7 && level >= 0) {
- setlogmask(LOG_UPTO(level));
- syslog(LOG_DEBUG, "Loglevel %d is set", level);
- return MRAA_SUCCESS;
- }
- syslog(LOG_NOTICE, "Invalid loglevel %d requested", level);
- return MRAA_ERROR_INVALID_PARAMETER;
-}
-
-
-#if (defined SWIGPYTHON) || (defined SWIG)
-mraa_result_t
-#else
-mraa_result_t __attribute__((constructor))
-#endif
-mraa_init()
-{
- if (plat != NULL) {
- return MRAA_ERROR_PLATFORM_ALREADY_INITIALISED;
- }
-
- uid_t proc_euid = geteuid();
- struct passwd* proc_user = getpwuid(proc_euid);
-
-#ifdef DEBUG
- setlogmask(LOG_UPTO(LOG_DEBUG));
-#else
- setlogmask(LOG_UPTO(LOG_NOTICE));
-#endif
-
- openlog("libmraa", LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL1);
- syslog(LOG_NOTICE, "libmraa version %s initialised by user '%s' with EUID %d",
- mraa_get_version(), (proc_user != NULL) ? proc_user->pw_name : "<unknown>", proc_euid);
-
-#ifdef SWIGPYTHON
- // Initialise python threads, this allows use to grab the GIL when we are
- // required to do so
- Py_InitializeEx(0);
- PyEval_InitThreads();
-#endif
-
- mraa_platform_t platform_type;
-#if defined(X86PLAT)
- // Use runtime x86 platform detection
- platform_type = mraa_x86_platform();
-#elif defined(ARMPLAT)
- // Use runtime ARM platform detection
- platform_type = mraa_arm_platform();
-#else
-#error mraa_ARCH NOTHING
-#endif
-
- if (plat != NULL) {
- plat->platform_type = platform_type;
- } else {
- platform_name = NULL;
- }
-
-#if defined(USBPLAT)
- // This is a platform extender so create null base platform if one doesn't already exist
- if (plat == NULL) {
- plat = (mraa_board_t*) calloc(1, sizeof(mraa_board_t));
- if (plat != NULL) {
- plat->platform_type = MRAA_NULL_PLATFORM;
- plat->platform_name = "Unknown platform";
- }
- }
- // Now detect sub platform, note this is not an else since we could be in
- // an error case and fall through to MRAA_ERROR_PLATFORM_NOT_INITIALISED
- if (plat != NULL) {
- mraa_platform_t usb_platform_type = mraa_usb_platform_extender(plat);
- // if we have no known platform just replace usb platform with platform
- if (plat->platform_type == MRAA_UNKNOWN_PLATFORM && usb_platform_type != MRAA_UNKNOWN_PLATFORM) {
- plat->platform_type = usb_platform_type;
- }
- }
- if (plat == NULL) {
- printf("mraa: FATAL error, failed to initialise platform\n");
- return MRAA_ERROR_PLATFORM_NOT_INITIALISED;
- }
-#endif
-
- // Look for IIO devices
- mraa_iio_detect();
-
- if (plat != NULL) {
- int length = strlen(plat->platform_name) + 1;
- if (mraa_has_sub_platform()) {
- // Account for ' + ' chars
- length += strlen(plat->sub_platform->platform_name) + 3;
- }
- platform_name = calloc(length, sizeof(char));
- if (mraa_has_sub_platform()) {
- snprintf(platform_name, length, "%s + %s", plat->platform_name, plat->sub_platform->platform_name);
- } else {
- strncpy(platform_name, plat->platform_name, length);
- }
- }
-
- syslog(LOG_NOTICE, "libmraa initialised for platform '%s' of type %d", mraa_get_platform_name(), mraa_get_platform_type());
- return MRAA_SUCCESS;
-}
-
-void
-mraa_deinit()
-{
- if (plat != NULL) {
- if (plat->pins != NULL) {
- free(plat->pins);
- }
- mraa_board_t* sub_plat = plat->sub_platform;
- if (sub_plat != NULL) {
- if (sub_plat->pins != NULL) {
- free(sub_plat->pins);
- }
- free(sub_plat);
- }
- free(plat);
-
- }
- if (plat_iio != NULL) {
- free(plat_iio);
- }
- closelog();
-}
-
-int
-mraa_set_priority(const unsigned int priority)
-{
- struct sched_param sched_s;
-
- memset(&sched_s, 0, sizeof(struct sched_param));
- if (priority > sched_get_priority_max(SCHED_RR)) {
- sched_s.sched_priority = sched_get_priority_max(SCHED_RR);
- } else {
- sched_s.sched_priority = priority;
- }
-
- return sched_setscheduler(0, SCHED_RR, &sched_s);
-}
-
-static int
-mraa_count_iio_devices(const char* path, const struct stat* sb, int flag, struct FTW* ftwb)
-{
- // we are only interested in files with specific names
- if (fnmatch(IIO_DEVICE_WILDCARD, basename(path), 0) == 0) {
- num_iio_devices++;
- }
- return 0;
-}
-
-mraa_result_t
-mraa_iio_detect()
-{
- plat_iio = (mraa_iio_info_t*) calloc(1, sizeof(mraa_iio_info_t));
- plat_iio->iio_device_count = num_iio_devices;
- // Now detect IIO devices, linux only
- // find how many iio devices we have if we haven't already
- if (num_iio_devices == 0) {
- if (nftw("/sys/bus/iio/devices", &mraa_count_iio_devices, 20, FTW_PHYS) == -1) {
- return MRAA_ERROR_UNSPECIFIED;
- }
- }
- char name[64], filepath[64];
- int fd, len, i;
- plat_iio->iio_device_count = num_iio_devices;
- plat_iio->iio_devices = calloc(num_iio_devices, sizeof(struct _iio));
- struct _iio* device;
- for (i=0; i < num_iio_devices; i++) {
- device = &plat_iio->iio_devices[i];
- device->num = i;
- snprintf(filepath, 64, "/sys/bus/iio/devices/iio:device%d/name", i);
- fd = open(filepath, O_RDONLY);
- if (fd != -1) {
- len = read(fd, &name, 64);
- if (len > 1) {
- // remove any trailing CR/LF symbols
- name[strcspn(name, "\r\n")] = '\0';
- len = strlen(name);
- // use strndup
- device->name = malloc((sizeof(char) * len) + sizeof(char));
- strncpy(device->name, name, len+1);
- }
- close(fd);
- }
- }
- return MRAA_SUCCESS;
-}
-
-
-mraa_result_t
-mraa_setup_mux_mapped(mraa_pin_t meta)
-{
- int mi;
-
- for (mi = 0; mi < meta.mux_total; mi++) {
- mraa_gpio_context mux_i;
- mux_i = mraa_gpio_init_raw(meta.mux[mi].pin);
- if (mux_i == NULL) {
- return MRAA_ERROR_INVALID_HANDLE;
- }
- // this function will sometimes fail, however this is not critical as
- // long as the write succeeds - Test case galileo gen2 pin2
- mraa_gpio_dir(mux_i, MRAA_GPIO_OUT);
- mraa_gpio_owner(mux_i, 0);
-
- if (mraa_gpio_write(mux_i, meta.mux[mi].value) != MRAA_SUCCESS) {
- mraa_gpio_close(mux_i);
- return MRAA_ERROR_INVALID_RESOURCE;
- }
- mraa_gpio_close(mux_i);
- }
-
- return MRAA_SUCCESS;
-}
-
-void
-mraa_result_print(mraa_result_t result)
-{
- switch (result) {
- case MRAA_SUCCESS:
- fprintf(stdout, "MRAA: SUCCESS\n");
- break;
- case MRAA_ERROR_FEATURE_NOT_IMPLEMENTED:
- fprintf(stdout, "MRAA: Feature not implemented.\n");
- break;
- case MRAA_ERROR_FEATURE_NOT_SUPPORTED:
- fprintf(stdout, "MRAA: Feature not supported by Hardware.\n");
- break;
- case MRAA_ERROR_INVALID_VERBOSITY_LEVEL:
- fprintf(stdout, "MRAA: Invalid verbosity level.\n");
- break;
- case MRAA_ERROR_INVALID_PARAMETER:
- fprintf(stdout, "MRAA: Invalid parameter.\n");
- break;
- case MRAA_ERROR_INVALID_HANDLE:
- fprintf(stdout, "MRAA: Invalid Handle.\n");
- break;
- case MRAA_ERROR_NO_RESOURCES:
- fprintf(stdout, "MRAA: No resources.\n");
- break;
- case MRAA_ERROR_INVALID_RESOURCE:
- fprintf(stdout, "MRAA: Invalid resource.\n");
- break;
- case MRAA_ERROR_INVALID_QUEUE_TYPE:
- fprintf(stdout, "MRAA: Invalid Queue Type.\n");
- break;
- case MRAA_ERROR_NO_DATA_AVAILABLE:
- fprintf(stdout, "MRAA: No Data available.\n");
- break;
- case MRAA_ERROR_INVALID_PLATFORM:
- fprintf(stdout, "MRAA: Platform not recognised.\n");
- break;
- case MRAA_ERROR_PLATFORM_NOT_INITIALISED:
- fprintf(stdout, "MRAA: Platform not initialised.\n");
- break;
- case MRAA_ERROR_PLATFORM_ALREADY_INITIALISED:
- fprintf(stdout, "MRAA: Platform already initialised.\n");
- break;
- case MRAA_ERROR_UNSPECIFIED:
- fprintf(stdout, "MRAA: Unspecified Error.\n");
- break;
- default:
- fprintf(stdout, "MRAA: Unrecognised error.\n");
- break;
- }
-}
-
-
-mraa_boolean_t
-mraa_has_sub_platform()
-{
- return (plat != NULL) && (plat->sub_platform != NULL);
-}
-
-mraa_boolean_t
-mraa_pin_mode_test(int pin, mraa_pinmodes_t mode)
-{
- if (plat == NULL)
- return 0;
-
- mraa_board_t* current_plat = plat;
- if (mraa_is_sub_platform_id(pin)) {
- current_plat = plat->sub_platform;
- if (current_plat == NULL) {
- syslog(LOG_ERR, "mraa_pin_mode_test: Sub platform Not Initialised");
- return 0;
- }
- pin = mraa_get_sub_platform_index(pin);
- }
-
- if (current_plat == NULL || current_plat->platform_type == MRAA_UNKNOWN_PLATFORM) {
- return 0;
- }
- if (pin > (current_plat->phy_pin_count - 1) || pin < 0)
- return 0;
-
- switch (mode) {
- case MRAA_PIN_VALID:
- if (current_plat->pins[pin].capabilites.valid == 1)
- return 1;
- break;
- case MRAA_PIN_GPIO:
- if (current_plat->pins[pin].capabilites.gpio == 1)
- return 1;
- break;
- case MRAA_PIN_PWM:
- if (current_plat->pins[pin].capabilites.pwm == 1)
- return 1;
- break;
- case MRAA_PIN_FAST_GPIO:
- if (current_plat->pins[pin].capabilites.fast_gpio == 1)
- return 1;
- break;
- case MRAA_PIN_SPI:
- if (current_plat->pins[pin].capabilites.spi == 1)
- return 1;
- break;
- case MRAA_PIN_I2C:
- if (current_plat->pins[pin].capabilites.i2c == 1)
- return 1;
- break;
- case MRAA_PIN_AIO:
- if (current_plat->pins[pin].capabilites.aio == 1)
- return 1;
- break;
- case MRAA_PIN_UART:
- if (current_plat->pins[pin].capabilites.uart == 1)
- return 1;
- break;
- default:
- syslog(LOG_NOTICE, "requested pinmode invalid");
- break;
- }
- return 0;
-}
-
-mraa_platform_t
-mraa_get_platform_type()
-{
- if (plat == NULL)
- return MRAA_UNKNOWN_PLATFORM;
- return plat->platform_type;
-}
-
-int
-mraa_get_platform_combined_type()
-{
- int type = mraa_get_platform_type();
- int sub_type = mraa_has_sub_platform() ? plat->sub_platform->platform_type : MRAA_UNKNOWN_PLATFORM;
- return type | (sub_type << 8);
-}
-
-unsigned int
-mraa_adc_raw_bits()
-{
- if (plat == NULL)
- return 0;
-
- if (plat->aio_count == 0)
- return 0;
-
- return plat->adc_raw;
-}
-
-unsigned int
-mraa_get_platform_adc_raw_bits(uint8_t platform_offset)
-{
- if (platform_offset == MRAA_MAIN_PLATFORM_OFFSET)
- return mraa_adc_raw_bits();
- else {
- if (!mraa_has_sub_platform())
- return 0;
-
- if (plat->sub_platform->aio_count == 0)
- return 0;
-
- return plat->sub_platform->adc_raw;
- }
-}
-
-
-unsigned int
-mraa_adc_supported_bits()
-{
- if (plat == NULL)
- return 0;
-
- if (plat->aio_count == 0)
- return 0;
-
- return plat->adc_supported;
-}
-
-unsigned int
-mraa_get_platform_adc_supported_bits(int platform_offset)
-{
- if (platform_offset == MRAA_MAIN_PLATFORM_OFFSET)
- return mraa_adc_supported_bits();
- else {
- if (!mraa_has_sub_platform())
- return 0;
-
- if (plat->sub_platform->aio_count == 0)
- return 0;
-
- return plat->sub_platform->adc_supported;
- }
-}
-
-const char*
-mraa_get_platform_name()
-{
- return platform_name;
-}
-
-const char*
-mraa_get_platform_version(int platform_offset)
-{
- if (plat == NULL) {
- return NULL;
- }
- if (platform_offset == MRAA_MAIN_PLATFORM_OFFSET) {
- return plat->platform_version;
- } else {
- return plat->sub_platform->platform_version;
- }
-}
-
-int
-mraa_get_i2c_bus_count()
-{
- if (plat == NULL) {
- return -1;
- }
- return plat->i2c_bus_count;
-}
-
-int
-mraa_get_i2c_bus_id(unsigned i2c_bus)
-{
- if (plat == NULL) {
- return -1;
- }
-
- if (i2c_bus >= plat->i2c_bus_count) {
- return -1;
- }
-
- return plat->i2c_bus[i2c_bus].bus_id;
-}
-
-unsigned int
-mraa_get_pin_count()
-{
- if (plat == NULL) {
- return 0;
- }
- return plat->phy_pin_count;
-}
-
-unsigned int
-mraa_get_platform_pin_count(uint8_t platform_offset)
-{
- if (platform_offset == MRAA_MAIN_PLATFORM_OFFSET)
- return mraa_get_pin_count();
- else {
- if (mraa_has_sub_platform())
- return plat->sub_platform->phy_pin_count;
- else
- return 0;
- }
-}
-
-
-char*
-mraa_get_pin_name(int pin)
-{
- if (plat == NULL)
- return 0;
-
- mraa_board_t* current_plat = plat;
- if (mraa_is_sub_platform_id(pin)) {
- current_plat = plat->sub_platform;
- if (current_plat == NULL) {
- syslog(LOG_ERR, "mraa_get_pin_name: Sub platform Not Initialised");
- return 0;
- }
- pin = mraa_get_sub_platform_index(pin);
- }
-
- if (pin > (current_plat->phy_pin_count - 1) || pin < 0)
- return NULL;
- return (char*) current_plat->pins[pin].name;
-}
-
-int
-mraa_get_default_i2c_bus(uint8_t platform_offset)
-{
- if (plat == NULL)
- return -1;
- if (platform_offset == MRAA_MAIN_PLATFORM_OFFSET) {
- return plat->def_i2c_bus;
- } else {
- if (mraa_has_sub_platform())
- return plat->sub_platform->def_i2c_bus;
- else
- return -1;
- }
-}
-
-
-mraa_boolean_t
-mraa_file_exist(const char* filename)
-{
- glob_t results;
- results.gl_pathc = 0;
- glob(filename, 0, NULL, &results);
- int file_found = results.gl_pathc == 1;
- globfree(&results);
- return file_found;
-}
-
-mraa_boolean_t
-mraa_file_contains(const char* filename, const char* content)
-{
- mraa_boolean_t found = 0;
- if ((filename == NULL) || (content == NULL)) {
- return 0;
- }
-
- char* file = mraa_file_unglob(filename);
- if (file != NULL) {
- size_t len = 1024;
- char* line = calloc(len, sizeof(char));
- if (line == NULL) {
- free(file);
- return 0;
- }
- FILE* fh = fopen(file, "r");
- if (fh == NULL) {
- free(file);
- free(line);
- return 0;
- }
- while ((getline(&line, &len, fh) != -1) && (found == 0)) {
- if (strstr(line, content)) {
- found = 1;
- break;
- }
- }
- fclose(fh);
- free(file);
- free(line);
- }
- return found;
-}
-
-mraa_boolean_t
-mraa_file_contains_both(const char* filename, const char* content, const char* content2)
-{
- mraa_boolean_t found = 0;
- if ((filename == NULL) || (content == NULL)) {
- return 0;
- }
-
- char* file = mraa_file_unglob(filename);
- if (file != NULL) {
- size_t len = 1024;
- char* line = calloc(len, sizeof(char));
- if (line == NULL) {
- free(file);
- return 0;
- }
- FILE* fh = fopen(file, "r");
- if (fh == NULL) {
- free(file);
- free(line);
- return 0;
- }
- while ((getline(&line, &len, fh) != -1) && (found == 0)) {
- if (strstr(line, content) && strstr(line, content2)) {
- found = 1;
- break;
- }
- }
- fclose(fh);
- free(file);
- free(line);
- }
- return found;
-}
-
-char*
-mraa_file_unglob(const char* filename)
-{
- glob_t results;
- char* res = NULL;
- results.gl_pathc = 0;
- glob(filename, 0, NULL, &results);
- if (results.gl_pathc == 1)
- res = strdup(results.gl_pathv[0]);
- globfree(&results);
- return res;
-}
-
-mraa_boolean_t
-mraa_link_targets(const char* filename, const char* targetname)
-{
- int size = 100;
- int nchars = 0;
- char* buffer = NULL;
- while (nchars == 0) {
- buffer = (char*) realloc(buffer, size);
- if (buffer == NULL)
- return 0;
- nchars = readlink(filename, buffer, size);
- if (nchars < 0) {
- free(buffer);
- return 0;
- } else {
- buffer[nchars] = '\0';
- }
- if (nchars >= size) {
- size *= 2;
- nchars = 0;
- }
- }
- if (strstr(buffer, targetname)) {
- free(buffer);
- return 1;
- } else {
- free(buffer);
- return 0;
- }
-}
-
-static int
-mraa_count_i2c_files(const char* path, const struct stat* sb, int flag, struct FTW* ftwb)
-{
- switch (sb->st_mode & S_IFMT) {
- case S_IFLNK:
- num_i2c_devices++;
- break;
- }
- return 0;
-}
-
-int
-mraa_find_i2c_bus(const char* devname, int startfrom)
-{
- char path[64];
- int fd;
- int i = startfrom;
- int ret = -1;
-
- // because feeding mraa_find_i2c_bus result back into the function is
- // useful treat -1 as 0
- if (startfrom < 0) {
- startfrom = 0;
- }
-
- // find how many i2c buses we have if we haven't already
- if (num_i2c_devices == 0) {
- if (nftw("/sys/class/i2c-dev/", &mraa_count_i2c_files, 20, FTW_PHYS) == -1) {
- return -1;
- }
- }
-
- // i2c devices are numbered numerically so 0 must exist otherwise there is
- // no i2c-dev loaded
- if (mraa_file_exist("/sys/class/i2c-dev/i2c-0")) {
- for (i; i < num_i2c_devices; i++) {
- off_t size, err;
- snprintf(path, 64, "/sys/class/i2c-dev/i2c-%u/name", i);
- fd = open(path, O_RDONLY);
- if (fd < 0) {
- break;
- }
- size = lseek(fd, 0, SEEK_END);
- if (size < 0) {
- syslog(LOG_WARNING, "mraa: failed to seek i2c filename file");
- close(fd);
- break;
- }
- err = lseek(fd, 0, SEEK_SET);
- if (err < 0) {
- syslog(LOG_WARNING, "mraa: failed to seek i2c filename file");
- close(fd);
- break;
- }
- char* value = malloc(size);
- if (value == NULL) {
- syslog(LOG_ERR, "mraa: failed to allocate memory for i2c file");
- close(fd);
- break;
- }
- ssize_t r = read(fd, value, size);
- if (r > 0) {
- if (strcasestr(value, devname) != NULL) {
- free(value);
- close(fd);
- return i;
- }
- } else {
- syslog(LOG_ERR, "mraa: sysfs i2cdev failed");
- }
- free(value);
- close(fd);
- }
- } else {
- syslog(LOG_WARNING, "mraa: no i2c-dev detected, load i2c-dev");
- }
-
- return ret;
-}
-
-mraa_boolean_t
-mraa_is_sub_platform_id(int pin_or_bus)
-{
- return (pin_or_bus & MRAA_SUB_PLATFORM_MASK) != 0;
-}
-
-int
-mraa_get_sub_platform_id(int pin_or_bus)
-{
- return pin_or_bus | MRAA_SUB_PLATFORM_MASK;
-}
-
-int
-mraa_get_sub_platform_index(int pin_or_bus)
-{
- return pin_or_bus & (~MRAA_SUB_PLATFORM_MASK);
-}
-
-int
-mraa_get_iio_device_count()
-{
- return plat_iio->iio_device_count;
-}
diff --git a/peripheral/libmraa/src/mraa.i b/peripheral/libmraa/src/mraa.i
deleted file mode 100644
index 5259951..0000000
--- a/peripheral/libmraa/src/mraa.i
+++ /dev/null
@@ -1,61 +0,0 @@
-%rename("%(strip:[MRAA_])s", %$isenumitem) "";
-
-%include stdint.i
-%include std_string.i
-%include exception.i
-
-#ifdef DOXYGEN
- //and doesn't seem to work correctly in SWIG's preprocessor
- #ifdef SWIGPYTHON
- %include common_hpp_doc.i
- %include gpio_class_doc.i
- %include i2c_class_doc.i
- %include pwm_class_doc.i
- %include aio_class_doc.i
- %include spi_class_doc.i
- %include uart_class_doc.i
- #endif
-#endif
-
-%{
- #include "common.hpp"
- #include "types.hpp"
- #include "gpio.hpp"
- #include "pwm.hpp"
- #include "i2c.hpp"
- #include "spi.hpp"
- #include "aio.hpp"
- #include "uart.hpp"
-%}
-
-%exception {
- try {
- $action
- } catch(const std::invalid_argument& e) {
- SWIG_exception(SWIG_ValueError, e.what());
- } catch(...) {
- SWIG_exception(SWIG_RuntimeError, "Unknown exception");
- }
-}
-
-%include "types.hpp"
-
-%include "common.hpp"
-
-%ignore Gpio::nop(uv_work_t* req);
-%ignore Gpio::v8isr(uv_work_t* req);
-%ignore Gpio::v8isr(uv_work_t* req, int status);
-%ignore Gpio::uvwork(void *ctx);
-%ignore isr(Edge mode, void (*fptr)(void*), void* args);
-
-%include "gpio.hpp"
-
-%include "i2c.hpp"
-
-%include "pwm.hpp"
-
-%include "spi.hpp"
-
-%include "aio.hpp"
-
-%include "uart.hpp"
diff --git a/peripheral/libmraa/src/mraa.pc.cmake b/peripheral/libmraa/src/mraa.pc.cmake
deleted file mode 100644
index fb5c0b1..0000000
--- a/peripheral/libmraa/src/mraa.pc.cmake
+++ /dev/null
@@ -1,11 +0,0 @@
-prefix=@CMAKE_INSTALL_PREFIX@
-exec_prefix=${prefix}
-libdir=${exec_prefix}/lib@LIB_SUFFIX@
-includedir=${prefix}/include
-
-Name: mraa
-Description: Low Level Skeleton Library for Communication
-Version: @mraa_VERSION_STRING@
-
-Libs: -L${libdir} -lmraa
-Cflags: -I${includedir}
diff --git a/peripheral/libmraa/src/pwm/pwm.c b/peripheral/libmraa/src/pwm/pwm.c
deleted file mode 100644
index f8decce..0000000
--- a/peripheral/libmraa/src/pwm/pwm.c
+++ /dev/null
@@ -1,498 +0,0 @@
-/*
- * Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
- * Author: Brendan Le Foll <brendan.le.foll@intel.com>
- * Copyright (c) 2014, 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <stdlib.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <limits.h>
-
-#include "pwm.h"
-#include "mraa_internal.h"
-
-#define MAX_SIZE 64
-#define SYSFS_PWM "/sys/class/pwm"
-
-static int
-mraa_pwm_setup_duty_fp(mraa_pwm_context dev)
-{
- char bu[MAX_SIZE];
- snprintf(bu, MAX_SIZE, "/sys/class/pwm/pwmchip%d/pwm%d/duty_cycle", dev->chipid, dev->pin);
-
- dev->duty_fp = open(bu, O_RDWR);
- if (dev->duty_fp == -1) {
- return 1;
- }
- return 0;
-}
-
-static mraa_result_t
-mraa_pwm_write_period(mraa_pwm_context dev, int period)
-{
- if (IS_FUNC_DEFINED(dev, pwm_period_replace)) {
- mraa_result_t result = dev->advance_func->pwm_period_replace(dev, period);
- if (result == MRAA_SUCCESS) {
- dev->period = period;
- }
- return result;
- }
- char bu[MAX_SIZE];
- snprintf(bu, MAX_SIZE, "/sys/class/pwm/pwmchip%d/pwm%d/period", dev->chipid, dev->pin);
-
- int period_f = open(bu, O_RDWR);
- if (period_f == -1) {
- syslog(LOG_ERR, "pwm: Failed to open period for writing");
- return MRAA_ERROR_INVALID_RESOURCE;
- }
- char out[MAX_SIZE];
- int length = snprintf(out, MAX_SIZE, "%d", period);
- if (write(period_f, out, length * sizeof(char)) == -1) {
- close(period_f);
- return MRAA_ERROR_INVALID_RESOURCE;
- }
-
- close(period_f);
- dev->period = period;
- return MRAA_SUCCESS;
-}
-
-static mraa_result_t
-mraa_pwm_write_duty(mraa_pwm_context dev, int duty)
-{
- if (dev->duty_fp == -1) {
- if (mraa_pwm_setup_duty_fp(dev) == 1) {
- return MRAA_ERROR_INVALID_HANDLE;
- }
- }
- char bu[64];
- int length = sprintf(bu, "%d", duty);
- if (write(dev->duty_fp, bu, length * sizeof(char)) == -1)
- return MRAA_ERROR_INVALID_RESOURCE;
- return MRAA_SUCCESS;
-}
-
-static int
-mraa_pwm_read_period(mraa_pwm_context dev)
-{
- char bu[MAX_SIZE];
- char output[MAX_SIZE];
- snprintf(bu, MAX_SIZE, "/sys/class/pwm/pwmchip%d/pwm%d/period", dev->chipid, dev->pin);
-
- int period_f = open(bu, O_RDWR);
- if (period_f == -1) {
- syslog(LOG_ERR, "pwm: Failed to open period for reading");
- return 0;
- }
- off_t size = lseek(period_f, 0, SEEK_END);
- lseek(period_f, 0, SEEK_SET);
-
- ssize_t rb = read(period_f, output, size + 1);
- close(period_f);
-
- if (rb < 0) {
- syslog(LOG_ERR, "pwm: Error in reading period");
- return -1;
- }
-
- char* endptr;
- long int ret = strtol(output, &endptr, 10);
- if ('\0' != *endptr && '\n' != *endptr) {
- syslog(LOG_ERR, "pwm: Error in string conversion");
- return -1;
- } else if (ret > INT_MAX || ret < INT_MIN) {
- syslog(LOG_ERR, "pwm: Number is invalid");
- return -1;
- }
- dev->period = (int) ret;
- return (int) ret;
-}
-
-static int
-mraa_pwm_read_duty(mraa_pwm_context dev)
-{
- if (dev->duty_fp == -1) {
- if (mraa_pwm_setup_duty_fp(dev) == 1) {
- return MRAA_ERROR_INVALID_HANDLE;
- }
- } else {
- lseek(dev->duty_fp, 0, SEEK_SET);
- }
- off_t size = lseek(dev->duty_fp, 0, SEEK_END);
- lseek(dev->duty_fp, 0, SEEK_SET);
- char output[MAX_SIZE];
- ssize_t rb = read(dev->duty_fp, output, size + 1);
- if (rb < 0) {
- syslog(LOG_ERR, "pwm: Error in reading duty");
- return -1;
- }
-
- char* endptr;
- long int ret = strtol(output, &endptr, 10);
- if ('\0' != *endptr && '\n' != *endptr) {
- syslog(LOG_ERR, "pwm: Error in string converstion");
- return -1;
- } else if (ret > INT_MAX || ret < INT_MIN) {
- syslog(LOG_ERR, "pwm: Number is invalid");
- return -1;
- }
- return (int) ret;
-}
-
-static mraa_pwm_context
-mraa_pwm_init_internal(mraa_adv_func_t* func_table, int chipin, int pin)
-{
- mraa_pwm_context dev = (mraa_pwm_context) calloc(1,sizeof(struct _pwm));
- if (dev == NULL) {
- return NULL;
- }
- dev->duty_fp = -1;
- dev->chipid = chipin;
- dev->pin = pin;
- dev->period = -1;
- dev->advance_func = func_table;
-
- return dev;
-}
-
-mraa_pwm_context
-mraa_pwm_init(int pin)
-{
- if (plat == NULL) {
- syslog(LOG_ERR, "pwm: Platform Not Initialised");
- return NULL;
- }
- if (mraa_is_sub_platform_id(pin)) {
- syslog(LOG_NOTICE, "pwm: Using sub platform is not supported");
- return NULL;
- }
- if (pin < 0 || pin > plat->phy_pin_count) {
- syslog(LOG_ERR, "pwm: pin %i beyond platform definition", pin);
- return NULL;
- }
- if (plat->pins[pin].capabilites.pwm != 1) {
- syslog(LOG_ERR, "pwm: pin not capable of pwm");
- return NULL;
- }
-
- if (plat->adv_func->pwm_init_replace != NULL) {
- return plat->adv_func->pwm_init_replace(pin);
- }
- if (plat->adv_func->pwm_init_pre != NULL) {
- if (plat->adv_func->pwm_init_pre(pin) != MRAA_SUCCESS)
- return NULL;
- }
-
- if (plat->pins[pin].capabilites.gpio == 1) {
- // This deserves more investigation
- mraa_gpio_context mux_i;
- mux_i = mraa_gpio_init_raw(plat->pins[pin].gpio.pinmap);
- if (mux_i == NULL) {
- syslog(LOG_ERR, "pwm: error in gpio->pwm transition");
- return NULL;
- }
- if (mraa_gpio_dir(mux_i, MRAA_GPIO_OUT) != MRAA_SUCCESS) {
- syslog(LOG_ERR, "pwm: error in gpio->pwm transition");
- return NULL;
- }
- if (mraa_gpio_write(mux_i, 1) != MRAA_SUCCESS) {
- syslog(LOG_ERR, "pwm: error in gpio->pwm transition");
- return NULL;
- }
- if (mraa_gpio_close(mux_i) != MRAA_SUCCESS) {
- syslog(LOG_ERR, "pwm: error in gpio->pwm transition");
- return NULL;
- }
- }
-
- if (plat->pins[pin].pwm.mux_total > 0) {
- if (mraa_setup_mux_mapped(plat->pins[pin].pwm) != MRAA_SUCCESS) {
- syslog(LOG_ERR, "pwm: Failed to set-up multiplexer");
- return NULL;
- }
- }
-
- int chip = plat->pins[pin].pwm.parent_id;
- int pinn = plat->pins[pin].pwm.pinmap;
-
- if (plat->adv_func->pwm_init_post != NULL) {
- mraa_pwm_context pret = mraa_pwm_init_raw(chip, pinn);
- mraa_result_t ret = plat->adv_func->pwm_init_post(pret);
- if (ret != MRAA_SUCCESS) {
- free(pret);
- return NULL;
- }
- return pret;
- }
- return mraa_pwm_init_raw(chip, pinn);
-}
-
-mraa_pwm_context
-mraa_pwm_init_raw(int chipin, int pin)
-{
- mraa_pwm_context dev = mraa_pwm_init_internal(plat == NULL ? NULL : plat->adv_func , chipin, pin);
- if (dev == NULL)
- return NULL;
-
- char directory[MAX_SIZE];
- snprintf(directory, MAX_SIZE, SYSFS_PWM "/pwmchip%d/pwm%d", dev->chipid, dev->pin);
- struct stat dir;
- if (stat(directory, &dir) == 0 && S_ISDIR(dir.st_mode)) {
- syslog(LOG_NOTICE, "pwm: Pin already exported, continuing");
- dev->owner = 0; // Not Owner
- } else {
- char buffer[MAX_SIZE];
- snprintf(buffer, MAX_SIZE, "/sys/class/pwm/pwmchip%d/export", dev->chipid);
- int export_f = open(buffer, O_WRONLY);
- if (export_f == -1) {
- syslog(LOG_ERR, "pwm: Failed to open export for writing");
- free(dev);
- return NULL;
- }
-
- char out[MAX_SIZE];
- int size = snprintf(out, MAX_SIZE, "%d", dev->pin);
- if (write(export_f, out, size * sizeof(char)) == -1) {
- syslog(LOG_WARNING, "pwm: Failed to write to export! Potentially already enabled");
- close(export_f);
- free(dev);
- return NULL;
- }
- dev->owner = 1;
- mraa_pwm_period_us(dev, plat->pwm_default_period);
- close(export_f);
- }
- mraa_pwm_setup_duty_fp(dev);
- return dev;
-}
-
-mraa_result_t
-mraa_pwm_write(mraa_pwm_context dev, float percentage)
-{
- if (dev->period == -1) {
- if (mraa_pwm_read_period(dev) <= 0)
- return MRAA_ERROR_NO_DATA_AVAILABLE;
- }
-
- if (percentage > 1.0f) {
- syslog(LOG_WARNING, "pwm: number greater than 1 entered, defaulting to 100%%");
- return mraa_pwm_write_duty(dev, dev->period);
- }
- return mraa_pwm_write_duty(dev, percentage * dev->period);
-}
-
-float
-mraa_pwm_read(mraa_pwm_context dev)
-{
- int period = mraa_pwm_read_period(dev);
- if (period > 0) {
- return (mraa_pwm_read_duty(dev) / (float) period);
- }
- return 0.0f;
-}
-
-mraa_result_t
-mraa_pwm_period(mraa_pwm_context dev, float seconds)
-{
- return mraa_pwm_period_ms(dev, seconds * 1000);
-}
-
-mraa_result_t
-mraa_pwm_period_ms(mraa_pwm_context dev, int ms)
-{
- return mraa_pwm_period_us(dev, ms * 1000);
-}
-
-mraa_result_t
-mraa_pwm_period_us(mraa_pwm_context dev, int us)
-{
- if (us < plat->pwm_min_period || us > plat->pwm_max_period) {
- syslog(LOG_ERR, "pwm: period value outside platform range");
- return MRAA_ERROR_INVALID_PARAMETER;
- }
- return mraa_pwm_write_period(dev, us * 1000);
-}
-
-mraa_result_t
-mraa_pwm_pulsewidth(mraa_pwm_context dev, float seconds)
-{
- return mraa_pwm_pulsewidth_ms(dev, seconds * 1000);
-}
-
-mraa_result_t
-mraa_pwm_pulsewidth_ms(mraa_pwm_context dev, int ms)
-{
- return mraa_pwm_pulsewidth_us(dev, ms * 1000);
-}
-
-mraa_result_t
-mraa_pwm_pulsewidth_us(mraa_pwm_context dev, int us)
-{
- return mraa_pwm_write_duty(dev, us * 1000);
-}
-
-mraa_result_t
-mraa_pwm_enable(mraa_pwm_context dev, int enable)
-{
- int status;
- if (enable != 0) {
- status = 1;
- } else {
- status = enable;
- }
- char bu[MAX_SIZE];
- snprintf(bu, MAX_SIZE, "/sys/class/pwm/pwmchip%d/pwm%d/enable", dev->chipid, dev->pin);
-
- int enable_f = open(bu, O_RDWR);
-
- if (enable_f == -1) {
- syslog(LOG_ERR, "pwm: Failed to open enable for writing");
- return MRAA_ERROR_INVALID_RESOURCE;
- }
- char out[2];
- int size = snprintf(out, sizeof(out), "%d", enable);
- if (write(enable_f, out, size * sizeof(char)) == -1) {
- syslog(LOG_ERR, "pwm: Failed to write to enable");
- close(enable_f);
- return MRAA_ERROR_INVALID_RESOURCE;
- }
- close(enable_f);
- return MRAA_SUCCESS;
-}
-
-mraa_result_t
-mraa_pwm_unexport_force(mraa_pwm_context dev)
-{
- char filepath[MAX_SIZE];
- snprintf(filepath, MAX_SIZE, "/sys/class/pwm/pwmchip%d/unexport", dev->chipid);
-
- int unexport_f = open(filepath, O_WRONLY);
- if (unexport_f == -1) {
- syslog(LOG_ERR, "pwm: Failed to open unexport for writing");
- return MRAA_ERROR_INVALID_RESOURCE;
- }
-
- char out[MAX_SIZE];
- int size = snprintf(out, MAX_SIZE, "%d", dev->pin);
- if (write(unexport_f, out, size * sizeof(char)) == -1) {
- syslog(LOG_ERR, "pwm: Failed to write to unexport");
- close(unexport_f);
- return MRAA_ERROR_INVALID_RESOURCE;
- }
-
- close(unexport_f);
- return MRAA_SUCCESS;
-}
-
-mraa_result_t
-mraa_pwm_unexport(mraa_pwm_context dev)
-{
- mraa_pwm_enable(dev, 0);
- if (dev->owner) {
- return mraa_pwm_unexport_force(dev);
- }
- return MRAA_ERROR_INVALID_RESOURCE;
-}
-
-mraa_result_t
-mraa_pwm_close(mraa_pwm_context dev)
-{
- mraa_pwm_unexport(dev);
- free(dev);
- return MRAA_SUCCESS;
-}
-
-mraa_result_t
-mraa_pwm_owner(mraa_pwm_context dev, mraa_boolean_t owner_new)
-{
- if (dev == NULL)
- return MRAA_ERROR_INVALID_RESOURCE;
- dev->owner = owner_new;
- return MRAA_SUCCESS;
-}
-
-mraa_result_t
-mraa_pwm_config_ms(mraa_pwm_context dev, int ms, float ms_float)
-{
- int old_dutycycle, old_period, status;
- old_dutycycle = mraa_pwm_read_duty(dev);
- old_period = mraa_pwm_read_period(dev);
- status = mraa_pwm_period_us(dev, ms * 1000);
- if (status != MRAA_SUCCESS) {
- mraa_pwm_write_duty(dev, old_dutycycle);
- return status;
- }
- status = mraa_pwm_write_duty(dev, 0);
- if (status != MRAA_SUCCESS) {
- return status;
- }
- status = mraa_pwm_pulsewidth_us(dev, ms_float * 1000);
- if (status != MRAA_SUCCESS) {
- mraa_pwm_write_duty(dev, old_dutycycle);
- mraa_pwm_write_period(dev, old_period);
- return status;
- }
- return MRAA_SUCCESS;
-}
-
-mraa_result_t
-mraa_pwm_config_percent(mraa_pwm_context dev, int ms, float percentage)
-{
- int old_dutycycle, old_period, status;
- old_dutycycle = mraa_pwm_read_duty(dev);
- old_period = mraa_pwm_read_period(dev);
- status = mraa_pwm_period_us(dev, ms * 1000);
- if (status != MRAA_SUCCESS) {
- mraa_pwm_write_duty(dev, old_dutycycle);
- return status;
- }
- status = mraa_pwm_write_duty(dev, 0);
- if (status != MRAA_SUCCESS) {
- return status;
- }
- status = mraa_pwm_pulsewidth_us(dev, (ms * 1000) * percentage);
- if (status != MRAA_SUCCESS) {
- mraa_pwm_write_duty(dev, old_dutycycle);
- mraa_pwm_write_period(dev, old_period);
- return status;
- }
- return MRAA_SUCCESS;
-}
-
-int
-mraa_pwm_get_max_period()
-{
- if (plat == NULL) {
- return -1;
- }
- return plat->pwm_max_period;
-}
-
-int
-mraa_pwm_get_min_period()
-{
- if (plat == NULL) {
- return -1;
- }
- return plat->pwm_min_period;
-}
diff --git a/peripheral/libmraa/src/python/CMakeLists.txt b/peripheral/libmraa/src/python/CMakeLists.txt
deleted file mode 100644
index 1d06b82..0000000
--- a/peripheral/libmraa/src/python/CMakeLists.txt
+++ /dev/null
@@ -1,52 +0,0 @@
-find_package (PythonLibs ${PYTHONBUILD_VERSION} REQUIRED)
-
-INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH})
-
-include_directories(
- ${CMAKE_CURRENT_SOURCE_DIR}/..
- ${PYTHON_INCLUDE_DIRS}
-)
-
-set_source_files_properties (mraa.i PROPERTIES CPLUSPLUS ON)
-set_source_files_properties (mraa.i PROPERTIES SWIG_FLAGS "-I${CMAKE_BINARY_DIR}/src")
-swig_add_module (python-mraa python mraa.i ${mraa_LIB_SRCS})
-swig_link_libraries (python-mraa ${PYTHON_LIBRARIES} ${mraa_LIBS})
-
-if (DOXYGEN_FOUND)
- foreach (_file ${DOCCLASSES})
- add_dependencies (${SWIG_MODULE_python-mraa_REAL_NAME} ${_file}class_doc_i)
- endforeach ()
- add_dependencies (${SWIG_MODULE_python-mraa_REAL_NAME} common_hpp_doc_i)
-
- add_custom_target (pydoc
- pydoc -w ${CMAKE_CURRENT_BINARY_DIR}/mraa.py ${CMAKE_CURRENT_BINARY_DIR}/
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
- COMMENT "Generating API documentation with pydoc" VERBATIM
- )
-endif ()
-
-set_target_properties (${SWIG_MODULE_python-mraa_REAL_NAME} PROPERTIES
- OUTPUT_NAME _mraa
- COMPILE_FLAGS "${CMAKE_C_FLAGS} -DSWIGPYTHON=${SWIG_FOUND}"
-)
-
-execute_process (
- COMMAND ${PYTHON_EXECUTABLE} -c
- "import site, sys; sys.stdout.write(site.PREFIXES[-1])"
- OUTPUT_VARIABLE PYTHON_PREFIX
-)
-file (TO_CMAKE_PATH "${PYTHON_PREFIX}" PYTHON_PREFIX)
-execute_process (
- COMMAND ${PYTHON_EXECUTABLE} -c
- "import site, sys; sys.stdout.write(site.getusersitepackages().replace(site.getuserbase(), site.PREFIXES[-1]))"
- OUTPUT_VARIABLE PYTHON_SITE_DIR
-)
-file (TO_CMAKE_PATH "${PYTHON_SITE_DIR}" PYTHON_SITE_DIR)
-string (REGEX REPLACE "^${PYTHON_PREFIX}/" ""
- PYTHON_SITE_DIR "${PYTHON_SITE_DIR}")
-
-install (FILES ${CMAKE_CURRENT_BINARY_DIR}/_mraa.so
- ${CMAKE_CURRENT_BINARY_DIR}/mraa.py
- DESTINATION ${PYTHON_SITE_DIR})
-
-add_subdirectory (docs)
diff --git a/peripheral/libmraa/src/python/docs/CMakeLists.txt b/peripheral/libmraa/src/python/docs/CMakeLists.txt
deleted file mode 100644
index 9ce7880..0000000
--- a/peripheral/libmraa/src/python/docs/CMakeLists.txt
+++ /dev/null
@@ -1,41 +0,0 @@
-if (DOXYGEN_FOUND)
- find_package (Sphinx)
- if (SPHINX_FOUND)
- if (NOT DEFINED SPHINX_THEME)
- set (SPHINX_THEME default)
- endif ()
-
- if (NOT DEFINED SPHINX_THEME_DIR)
- set (SPHINX_THEME_DIR)
- endif ()
-
- # configured documentation tools and intermediate build results
- set (BINARY_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}")
-
- # Sphinx cache with pickled ReST documents
- set (SPHINX_CACHE_DIR "${CMAKE_CURRENT_BINARY_DIR}/doctrees")
-
- # HTML output directory
- set (SPHINX_HTML_DIR "${CMAKE_CURRENT_BINARY_DIR}/html")
-
- # doc .rst locations
- set (SPHINX_DOC_LOATION "${CMAKE_CURRENT_SOURCE_DIR}")
-
- configure_file(
- "${CMAKE_CURRENT_SOURCE_DIR}/conf.py.in"
- "${BINARY_BUILD_DIR}/conf.py"
- @ONLY
- )
-
- add_custom_target(sphinx ALL
- ${SPHINX_EXECUTABLE} -b html
- -c "${BINARY_BUILD_DIR}"
- -d "${SPHINX_CACHE_DIR}"
- "${SPHINX_DOC_LOATION}"
- "${SPHINX_HTML_DIR}"
- COMMENT "Building HTML documentation with Sphinx"
- )
-
- add_dependencies (sphinx ${SWIG_MODULE_python-mraa_REAL_NAME})
- endif ()
-endif ()
diff --git a/peripheral/libmraa/src/python/docs/conf.py.in b/peripheral/libmraa/src/python/docs/conf.py.in
deleted file mode 100644
index 344abe1..0000000
--- a/peripheral/libmraa/src/python/docs/conf.py.in
+++ /dev/null
@@ -1,332 +0,0 @@
-#!/usr/bin/env python3
-# -*- coding: utf-8 -*-
-#
-# . documentation build configuration file, created by
-# sphinx-quickstart on Thu May 1 18:34:23 2014.
-#
-# This file is execfile()d with the current directory set to its
-# containing dir.
-#
-# Note that not all possible configuration values are present in this
-# autogenerated file.
-#
-# All configuration values have a default; values that are commented out
-# serve to show the default.
-
-import sys
-import os
-
-# If extensions (or modules to document with autodoc) are in another directory,
-# add these directories to sys.path here. If the directory is relative to the
-# documentation root, use os.path.abspath to make it absolute, like shown here.
-sys.path.insert(0, "@CMAKE_BINARY_DIR@/src/python")
-
-# -- General configuration ------------------------------------------------
-
-# If your documentation needs a minimal Sphinx version, state it here.
-#needs_sphinx = '1.0'
-
-# Add any Sphinx extension module names here, as strings. They can be
-# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
-# ones.
-extensions = [
- 'sphinx.ext.autodoc',
- 'sphinx.ext.viewcode',
-]
-
-# Add any paths that contain templates here, relative to this directory.
-templates_path = ['_templates']
-
-# The suffix of source filenames.
-source_suffix = '.rst'
-
-# The encoding of source files.
-#source_encoding = 'utf-8-sig'
-
-# The master toctree document.
-master_doc = 'index'
-
-# General information about the project.
-project = 'mraa'
-copyright = '2014, Intel Corporation'
-
-# The version info for the project you're documenting, acts as replacement for
-# |version| and |release|, also used in various other places throughout the
-# built documents.
-#
-# The short X.Y version.
-version = '@mraa_VERSION_STRING@'
-# The full version, including alpha/beta/rc tags.
-release = '@VERSION@'
-
-# The language for content autogenerated by Sphinx. Refer to documentation
-# for a list of supported languages.
-#language = None
-
-# There are two options for replacing |today|: either, you set today to some
-# non-false value, then it is used:
-#today = ''
-# Else, today_fmt is used as the format for a strftime call.
-#today_fmt = '%B %d, %Y'
-
-# List of patterns, relative to source directory, that match files and
-# directories to ignore when looking for source files.
-exclude_patterns = ['_build', '**/.git', '**/CMakeFiles/**', '**/CMakeLists.txt']
-
-# The reST default role (used for this markup: `text`) to use for all
-# documents.
-#default_role = None
-
-# If true, '()' will be appended to :func: etc. cross-reference text.
-#add_function_parentheses = True
-
-# If true, the current module name will be prepended to all description
-# unit titles (such as .. function::).
-#add_module_names = True
-
-# If true, sectionauthor and moduleauthor directives will be shown in the
-# output. They are ignored by default.
-#show_authors = False
-
-# The name of the Pygments (syntax highlighting) style to use.
-pygments_style = 'sphinx'
-
-# A list of ignored prefixes for module index sorting.
-#modindex_common_prefix = []
-
-# If true, keep warnings as "system message" paragraphs in the built documents.
-#keep_warnings = False
-
-
-# -- Options for HTML output ----------------------------------------------
-
-# The theme to use for HTML and HTML Help pages. See the documentation for
-# a list of builtin themes.
-html_theme = '@SPHINX_THEME@'
-
-# Theme options are theme-specific and customize the look and feel of a theme
-# further. For a list of options available for each theme, see the
-# documentation.
-#html_theme_options = {}
-
-# Add any paths that contain custom themes here, relative to this directory.
-html_theme_path = ['@SPHINX_THEME_DIR@']
-
-# The name for this set of Sphinx documents. If None, it defaults to
-# "<project> v<release> documentation".
-#html_title = None
-
-# A shorter title for the navigation bar. Default is the same as html_title.
-#html_short_title = None
-
-# The name of an image file (relative to this directory) to place at the top
-# of the sidebar.
-#html_logo = None
-
-# The name of an image file (within the static path) to use as favicon of the
-# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
-# pixels large.
-#html_favicon = None
-
-# Add any paths that contain custom static files (such as style sheets) here,
-# relative to this directory. They are copied after the builtin static files,
-# so a file named "default.css" will overwrite the builtin "default.css".
-html_static_path = ['_static']
-
-# Add any extra paths that contain custom files (such as robots.txt or
-# .htaccess) here, relative to this directory. These files are copied
-# directly to the root of the documentation.
-#html_extra_path = []
-
-# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
-# using the given strftime format.
-#html_last_updated_fmt = '%b %d, %Y'
-
-# If true, SmartyPants will be used to convert quotes and dashes to
-# typographically correct entities.
-#html_use_smartypants = True
-
-# Custom sidebar templates, maps document names to template names.
-#html_sidebars = {}
-
-# Additional templates that should be rendered to pages, maps page names to
-# template names.
-#html_additional_pages = {}
-
-# If false, no module index is generated.
-#html_domain_indices = True
-
-# If false, no index is generated.
-#html_use_index = True
-
-# If true, the index is split into individual pages for each letter.
-#html_split_index = False
-
-# If true, links to the reST sources are added to the pages.
-#html_show_sourcelink = True
-
-# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
-#html_show_sphinx = True
-
-# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
-#html_show_copyright = True
-
-# If true, an OpenSearch description file will be output, and all pages will
-# contain a <link> tag referring to it. The value of this option must be the
-# base URL from which the finished HTML is served.
-#html_use_opensearch = ''
-
-# This is the file name suffix for HTML files (e.g. ".xhtml").
-#html_file_suffix = None
-
-# Output file base name for HTML help builder.
-htmlhelp_basename = 'mraadoc'
-
-
-# -- Options for LaTeX output ---------------------------------------------
-
-latex_elements = {
-# The paper size ('letterpaper' or 'a4paper').
-#'papersize': 'letterpaper',
-
-# The font size ('10pt', '11pt' or '12pt').
-#'pointsize': '10pt',
-
-# Additional stuff for the LaTeX preamble.
-#'preamble': '',
-}
-
-# Grouping the document tree into LaTeX files. List of tuples
-# (source start file, target name, title,
-# author, documentclass [howto, manual, or own class]).
-latex_documents = [
- ('index', 'sphinx.tex', '. Documentation',
- 'Author', 'manual'),
-]
-
-# The name of an image file (relative to this directory) to place at the top of
-# the title page.
-#latex_logo = None
-
-# For "manual" documents, if this is true, then toplevel headings are parts,
-# not chapters.
-#latex_use_parts = False
-
-# If true, show page references after internal links.
-#latex_show_pagerefs = False
-
-# If true, show URL addresses after external links.
-#latex_show_urls = False
-
-# Documents to append as an appendix to all manuals.
-#latex_appendices = []
-
-# If false, no module index is generated.
-#latex_domain_indices = True
-
-
-# -- Options for manual page output ---------------------------------------
-
-# One entry per manual page. List of tuples
-# (source start file, name, description, authors, manual section).
-man_pages = [
- ('index', 'sphinx', '. Documentation',
- ['Author'], 1)
-]
-
-# If true, show URL addresses after external links.
-#man_show_urls = False
-
-
-# -- Options for Texinfo output -------------------------------------------
-
-# Grouping the document tree into Texinfo files. List of tuples
-# (source start file, target name, title, author,
-# dir menu entry, description, category)
-texinfo_documents = [
- ('index', 'sphinx', '. Documentation',
- 'Author', 'sphinx', 'One line description of project.',
- 'Miscellaneous'),
-]
-
-# Documents to append as an appendix to all manuals.
-#texinfo_appendices = []
-
-# If false, no module index is generated.
-#texinfo_domain_indices = True
-
-# How to display URL addresses: 'footnote', 'no', or 'inline'.
-#texinfo_show_urls = 'footnote'
-
-# If true, do not generate a @detailmenu in the "Top" node's menu.
-#texinfo_no_detailmenu = False
-
-
-# -- Options for Epub output ----------------------------------------------
-
-# Bibliographic Dublin Core info.
-epub_title = '.'
-epub_author = 'Author'
-epub_publisher = 'Author'
-epub_copyright = '2014, Author'
-
-# The basename for the epub file. It defaults to the project name.
-#epub_basename = '.'
-
-# The HTML theme for the epub output. Since the default themes are not optimized
-# for small screen space, using the same theme for HTML and epub output is
-# usually not wise. This defaults to 'epub', a theme designed to save visual
-# space.
-#epub_theme = 'epub'
-
-# The language of the text. It defaults to the language option
-# or en if the language is not set.
-#epub_language = ''
-
-# The scheme of the identifier. Typical schemes are ISBN or URL.
-#epub_scheme = ''
-
-# The unique identifier of the text. This can be a ISBN number
-# or the project homepage.
-#epub_identifier = ''
-
-# A unique identification for the text.
-#epub_uid = ''
-
-# A tuple containing the cover image and cover page html template filenames.
-#epub_cover = ()
-
-# A sequence of (type, uri, title) tuples for the guide element of content.opf.
-#epub_guide = ()
-
-# HTML files that should be inserted before the pages created by sphinx.
-# The format is a list of tuples containing the path and title.
-#epub_pre_files = []
-
-# HTML files shat should be inserted after the pages created by sphinx.
-# The format is a list of tuples containing the path and title.
-#epub_post_files = []
-
-# A list of files that should not be packed into the epub file.
-epub_exclude_files = ['search.html']
-
-# The depth of the table of contents in toc.ncx.
-#epub_tocdepth = 3
-
-# Allow duplicate toc entries.
-#epub_tocdup = True
-
-# Choose between 'default' and 'includehidden'.
-#epub_tocscope = 'default'
-
-# Fix unsupported image types using the PIL.
-#epub_fix_images = False
-
-# Scale large images.
-#epub_max_image_width = 0
-
-# How to display URL addresses: 'footnote', 'no', or 'inline'.
-#epub_show_urls = 'inline'
-
-# If false, no index is generated.
-#epub_use_index = True
diff --git a/peripheral/libmraa/src/python/docs/example.rst b/peripheral/libmraa/src/python/docs/example.rst
deleted file mode 100644
index 4daf98c..0000000
--- a/peripheral/libmraa/src/python/docs/example.rst
+++ /dev/null
@@ -1,93 +0,0 @@
-#######
-Example
-#######
-Here are some examples of how to use mraa, common convention is to import mraa
-as mraa to keep it short but feel free to import it globally! As a general rule
-the API is very similar to the C++ API so there are only basic examples to show
-quick usage. The mraa module can be built with python3 or python2. All examples
-may not run on python3 as this is not tested.
-
-Hello GPIO
-==========
-
-Here is the simplest Gpio program in mraa.
-
-.. literalinclude:: ../../../examples/python/hello_gpio.py
- :prepend: import mraa
- :start-after: import mraa
-
-GPIO Interupt (isr)
-===================
-
-The GPIO module allows you to set an interupt on a GPIO. This interupt is
-controlled by the mode that the 'edge' is in. Before setting another isr please
-remove the first one, multiple isrs on one pin are not supported. Some
-platforms will not support interupts on all pins so please check your return
-values.
-
-**Note:** Galileo Gen1 only supports EDGE_BOTH
-
-.. literalinclude:: ../../../examples/python/hello_isr.py
- :prepend: import mraa
- :start-after: import mraa
-
-**Note:** If the python script is ended the destructors will run meaning that
-the ISR will not run. The sleep call is there for that function.
-
-**Note:** The python isr module treats only objects. This means that int
-counters will not work inside your isr. Please use the different edge modes.
-
-I2c
-===
-
-The I2c module module has a number of different ways of interacting with the
-i2c bus, including a number of overloaded read() calls and the writeReg()
-helper function.
-
-.. literalinclude:: ../../../examples/python/bmp85.py
- :prepend: x = m.I2c(0)
- :start-after: x = m.I2c(0)
-
-.. literalinclude:: ../../../docs/i2c.txt
-
-Pwm
-===
-
-The PWM module is rather simple, note that different hardware support PWM
-generation is various different ways so results may vary.
-
-.. literalinclude:: ../../../examples/python/cycle-pwm3.py
- :prepend: import mraa
- :start-after: import mraa
-
-Aio
-===
-
-The ADC is typically provided on a dedicated or shared SPI bus, this is
-abstracted by the Linux kernel as spidev and abstracted again by mraa. It is
-fairly simple in use.
-
-.. literalinclude:: ../../../examples/python/aio.py
- :prepend: import mraa
- :start-after: import mraa
-
-Uart
-====
-
-Uart is the Universal asynchronous receiver/transmitter interface in mraa.
-It allows the exposure of UART pins on supported boards, with basic
-configuration operations supported.
-
-Here's a simple pair of programs comprising a sender and receiver pair.
-
-Sender:
-
-.. literalinclude:: ../../../examples/python/uart_sender.py
- :prepend: import mraa
- :start-after: import mraa
-
-Receiver:
-
-.. literalinclude:: ../../../examples/python/uart_receiver.py
- :prepend: import mraa
- :start-after: import mraa
diff --git a/peripheral/libmraa/src/python/docs/index.rst b/peripheral/libmraa/src/python/docs/index.rst
deleted file mode 100644
index cbdbab0..0000000
--- a/peripheral/libmraa/src/python/docs/index.rst
+++ /dev/null
@@ -1,57 +0,0 @@
-.. . documentation master file, created by
- sphinx-quickstart on Thu May 1 18:34:23 2014.
- You can adapt this file completely to your liking, but it should at least
- contain the root `toctree` directive.
-
-Welcome to mraa's documentation!
-================================
-
-.. include:: ../../../docs/index.md
- :start-after: ==============
- :end-before: ## API
-
-.. toctree::
- :maxdepth: 2
-
- mraa
- example
-
-Supported Platforms
-===================
-
- * `Galileo Gen 1 - Rev D <../galileorevd.html>`_
- * `Galileo Gen 2 - Rev H <../galileorevh.html>`_
- * `Intel Edison <../edison.html>`_
- * `Intel(R) NUC DE3815tykhe <../de3815.html>`_
- * `Intel(R) Minnowboard Max <../minnowmax.html>`_
- * `Raspberry Pi <../rasppi.html>`_
- * `Banana Pi/Pro <../bananapi.html>`_
- * `Beaglebone Black <../beaglebone.html>`_
- * `Intel NUC NUC5i5MYBE <../nuc5.html>`_
- * `UP <../up.html>`_
- * `FTDI FT4222H <../ft4222.html>`_
-
-Compiling & Debugging libmraa
-=============================
-
-Libmraa is a C library and SWIG is used to generate bindings therefore to
-debug, you very quickly need to use the same methods as you would for debugging
-a C library. Generally attaching gdb to python works well, build mraa with
-debug symbols and set breakpoints either in the SWIG _wrap functions, the C++
-method/functions or the underlying C function. More info can be found on the
-C/C++ documentation:
- * `Debugging <../debugging.html>`_
- * `Building from source <../building.html>`_
-
-API Changelog
-=============
-.. include:: ../../../docs/index.md
- :start-after: API Changelog
-
-Indices and tables
-==================
-
-* :ref:`genindex`
-* :ref:`modindex`
-* :ref:`search`
-
diff --git a/peripheral/libmraa/src/python/docs/mraa.rst b/peripheral/libmraa/src/python/docs/mraa.rst
deleted file mode 100644
index 04e7c1e..0000000
--- a/peripheral/libmraa/src/python/docs/mraa.rst
+++ /dev/null
@@ -1,52 +0,0 @@
-###
-API
-###
-
-Aio
-===
-.. autoclass:: mraa.Aio
- :members:
- :undoc-members:
- :show-inheritance:
-
-I2c
-===
-.. autoclass:: mraa.I2c
- :members:
- :undoc-members:
- :show-inheritance:
-
-Gpio
-====
-.. autoclass:: mraa.Gpio
- :members:
- :undoc-members:
- :show-inheritance:
-
-Pwm
-===
-.. autoclass:: mraa.Pwm
- :members:
- :undoc-members:
- :show-inheritance:
-
-Spi
-===
-.. autoclass:: mraa.Spi
- :members:
- :undoc-members:
- :show-inheritance:
-
-Uart
-====
-.. autoclass:: mraa.Uart
- :members:
- :undoc-members:
- :show-inheritance:
-
-Common
-======
-
-.. automodule:: mraa
- :members:
- :exclude-members: Gpio, Aio, Uart, Spi, I2c, Pwm, uint8Array, uint8Array_frompointer
diff --git a/peripheral/libmraa/src/python/mraa.i b/peripheral/libmraa/src/python/mraa.i
deleted file mode 100644
index 64d086e..0000000
--- a/peripheral/libmraa/src/python/mraa.i
+++ /dev/null
@@ -1,154 +0,0 @@
-%module(docstring="Python interface to libmraa") mraa
-
-%feature("autodoc", "3");
-
-%include typemaps.i
-%include carrays.i
-
-%array_class(uint8_t, uint8Array);
-
-// uart write()
-%typemap(in) (const char* data, int length) {
- if (PyByteArray_Check($input)) {
- // whilst this may seem 'hopeful' it turns out this is safe
- $1 = (char*) PyByteArray_AsString($input);
- $2 = PyByteArray_Size($input);
- } else {
- PyErr_SetString(PyExc_ValueError, "bytearray expected");
- return NULL;
- }
-}
-
-// i2c write()
-%typemap(in) (const uint8_t *data, int length) {
- if (PyByteArray_Check($input)) {
- // whilst this may seem 'hopeful' it turns out this is safe
- $1 = (uint8_t*) PyByteArray_AsString($input);
- $2 = PyByteArray_Size($input);
- } else {
- PyErr_SetString(PyExc_ValueError, "bytearray expected");
- return NULL;
- }
-}
-
-// Spi write()
-%typemap(in) (uint8_t *txBuf, int length) {
- if (PyByteArray_Check($input)) {
- // whilst this may seem 'hopeful' it turns out this is safe
- $1 = (uint8_t*) PyByteArray_AsString($input);
- $2 = PyByteArray_Size($input);
- } else {
- PyErr_SetString(PyExc_ValueError, "bytearray expected");
- return NULL;
- }
-}
-
-namespace mraa {
-class I2c;
-%typemap(out) uint8_t*
-{
- // need to loop over length
- $result = PyByteArray_FromStringAndSize((char*) $1, arg2);
- free($1);
-}
-
-class Spi;
-%typemap(out) uint8_t*
-{
- // need to loop over length
- $result = PyByteArray_FromStringAndSize((char*) $1, arg3);
- free($1);
-}
-}
-
-%newobject I2c::read(uint8_t *data, int length);
-%newobject Spi::write(uint8_t *data, int length);
-%newobject Uart::read(char* data, int length);
-%newobject Spi::transfer(uint8_t *txBuf, uint8_t *rxBuf, int length);
-
-// Uart::read()
-
-%typemap(in) (char* data, int length) {
- if (!PyInt_Check($input)) {
- PyErr_SetString(PyExc_ValueError, "Expecting an integer");
- return NULL;
- }
- $2 = PyInt_AsLong($input);
- if ($2 < 0) {
- PyErr_SetString(PyExc_ValueError, "Positive integer expected");
- return NULL;
- }
- $1 = (char*) malloc($2 * sizeof(char));
-}
-
-%typemap(argout) (char* data, int length) {
- Py_XDECREF($result); /* Blow away any previous result */
- if (result < 0) { /* Check for I/O error */
- free($1);
- PyErr_SetFromErrno(PyExc_IOError);
- return NULL;
- }
- // Append output value $1 to $result
- $result = PyByteArray_FromStringAndSize((char*) $1, result);
- free($1);
-}
-
-// I2c::read()
-
-%typemap(in) (uint8_t *data, int length) {
- if (!PyInt_Check($input)) {
- PyErr_SetString(PyExc_ValueError, "Expecting an integer");
- return NULL;
- }
- $2 = PyInt_AsLong($input);
- if ($2 < 0) {
- PyErr_SetString(PyExc_ValueError, "Positive integer expected");
- return NULL;
- }
- $1 = (uint8_t*) malloc($2 * sizeof(uint8_t));
-}
-
-%typemap(argout) (uint8_t *data, int length) {
- Py_XDECREF($result); /* Blow away any previous result */
- if (result < 0) { /* Check for I/O error */
- free($1);
- PyErr_SetFromErrno(PyExc_IOError);
- return NULL;
- }
- // Append output value $1 to $result
- $result = PyByteArray_FromStringAndSize((char*) $1, result);
- free($1);
-}
-
-// Spi::transfer()
-
-%typemap(in) (uint8_t* txBuf, uint8_t* rxBuf, int length) {
- if (!PyInt_Check($input)) {
- PyErr_SetString(PyExc_ValueError, "Expecting an integer");
- return NULL;
- }
- $3 = PyInt_AsLong($input);
- if ($3 < 0) {
- PyErr_SetString(PyExc_ValueError, "Positive integer expected");
- return NULL;
- }
- $2 = (uint8_t*) malloc($3 * sizeof(uint8_t));
-}
-
-%typemap(argout) (uint8_t* txBuf, uint8_t* rxBuf, int length) {
- Py_XDECREF($result); /* Blow away any previous result */
- if (result != MRAA_SUCCESS) { /* Check for I/O error */
- free($2);
- PyErr_SetFromErrno(PyExc_IOError);
- return NULL;
- }
- $result = PyByteArray_FromStringAndSize((char*) $2, $3);
- free($2);
-}
-
-%include ../mraa.i
-
-%init %{
- //Adding mraa_init() to the module initialisation process
- mraa_init();
-%}
diff --git a/peripheral/libmraa/src/spi/spi.c b/peripheral/libmraa/src/spi/spi.c
deleted file mode 100644
index 384cc20..0000000
--- a/peripheral/libmraa/src/spi/spi.c
+++ /dev/null
@@ -1,358 +0,0 @@
-/*
- * Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
- * Author: Brendan Le Foll <brendan.le.foll@intel.com>
- * Copyright (c) 2014, 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <sys/ioctl.h>
-#include <linux/spi/spidev.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <unistd.h>
-
-#include "spi.h"
-#include "mraa_internal.h"
-
-#define MAX_SIZE 64
-#define SPI_MAX_LENGTH 4096
-
-static mraa_spi_context
-mraa_spi_init_internal(mraa_adv_func_t* func_table)
-{
- mraa_spi_context dev = (mraa_spi_context) calloc(1, sizeof(struct _spi));
- if (dev == NULL) {
- return NULL;
- }
- dev->advance_func = func_table;
-
- return dev;
-}
-
-mraa_spi_context
-mraa_spi_init(int bus)
-{
- if (plat == NULL) {
- syslog(LOG_ERR, "spi: Platform Not Initialised");
- return NULL;
- }
- if (mraa_is_sub_platform_id(bus)) {
- syslog(LOG_ERR, "spi: Spi module doesn't support subplatforms");
- return NULL;
- }
- if (plat->spi_bus_count == 0) {
- syslog(LOG_ERR, "spi: no spi buses defined in platform");
- return NULL;
- }
- if (plat->spi_bus_count == 1) {
- bus = plat->def_spi_bus;
- }
- if (bus >= plat->spi_bus_count) {
- syslog(LOG_ERR, "spi: requested bus above spi bus count");
- return NULL;
- }
- if (plat->adv_func->spi_init_pre != NULL) {
- if (plat->adv_func->spi_init_pre(bus) != MRAA_SUCCESS) {
- return NULL;
- }
- }
-
- if (!plat->no_bus_mux) {
- int pos = plat->spi_bus[bus].sclk;
- if (plat->pins[pos].spi.mux_total > 0) {
- if (mraa_setup_mux_mapped(plat->pins[pos].spi) != MRAA_SUCCESS) {
- syslog(LOG_ERR, "spi: failed to set-up spi sclk multiplexer");
- return NULL;
- }
- }
-
- pos = plat->spi_bus[bus].mosi;
- if (plat->pins[pos].spi.mux_total > 0) {
- if (mraa_setup_mux_mapped(plat->pins[pos].spi) != MRAA_SUCCESS) {
- syslog(LOG_ERR, "spi: failed to set-up spi mosi multiplexer");
- return NULL;
- }
- }
-
- pos = plat->spi_bus[bus].miso;
- if (plat->pins[pos].spi.mux_total > 0) {
- if (mraa_setup_mux_mapped(plat->pins[pos].spi) != MRAA_SUCCESS) {
- syslog(LOG_ERR, "spi: failed to set-up spi miso multiplexer");
- return NULL;
- }
- }
-
- pos = plat->spi_bus[bus].cs;
- if (plat->pins[pos].spi.mux_total > 0) {
- if (mraa_setup_mux_mapped(plat->pins[pos].spi) != MRAA_SUCCESS) {
- syslog(LOG_ERR, "spi: failed to set-up spi cs multiplexer");
- return NULL;
- }
- }
- }
- mraa_spi_context dev = mraa_spi_init_raw(plat->spi_bus[bus].bus_id, plat->spi_bus[bus].slave_s);
-
- if (plat->adv_func->spi_init_post != NULL) {
- mraa_result_t ret = plat->adv_func->spi_init_post(dev);
- if (ret != MRAA_SUCCESS) {
- free(dev);
- return NULL;
- }
- }
-
- return dev;
-}
-
-mraa_spi_context
-mraa_spi_init_raw(unsigned int bus, unsigned int cs)
-{
- mraa_spi_context dev = mraa_spi_init_internal(plat == NULL ? NULL : plat->adv_func);
- if (dev == NULL) {
- syslog(LOG_CRIT, "spi: Failed to allocate memory for context");
- return NULL;
- }
-
- char path[MAX_SIZE];
- sprintf(path, "/dev/spidev%u.%u", bus, cs);
-
- dev->devfd = open(path, O_RDWR);
- if (dev->devfd < 0) {
- syslog(LOG_ERR, "spi: Failed opening SPI Device. bus:%s", path);
- free(dev);
- return NULL;
- }
-
- int speed = 0;
- if ((ioctl(dev->devfd, SPI_IOC_RD_MAX_SPEED_HZ, &speed) != -1) && (speed < 4000000)) {
- dev->clock = speed;
- } else {
- dev->clock = 4000000;
- }
-
- if (mraa_spi_mode(dev, MRAA_SPI_MODE0) != MRAA_SUCCESS) {
- free(dev);
- return NULL;
- }
-
- if (mraa_spi_lsbmode(dev, 0) != MRAA_SUCCESS) {
- free(dev);
- return NULL;
- }
-
- if (mraa_spi_bit_per_word(dev, 8) != MRAA_SUCCESS) {
- free(dev);
- return NULL;
- }
-
- return dev;
-}
-
-mraa_result_t
-mraa_spi_mode(mraa_spi_context dev, mraa_spi_mode_t mode)
-{
- uint8_t spi_mode = 0;
- switch (mode) {
- case MRAA_SPI_MODE0:
- spi_mode = SPI_MODE_0;
- break;
- case MRAA_SPI_MODE1:
- spi_mode = SPI_MODE_1;
- break;
- case MRAA_SPI_MODE2:
- spi_mode = SPI_MODE_2;
- break;
- case MRAA_SPI_MODE3:
- spi_mode = SPI_MODE_3;
- break;
- default:
- spi_mode = SPI_MODE_0;
- break;
- }
-
- if (ioctl(dev->devfd, SPI_IOC_WR_MODE, &spi_mode) < 0) {
- syslog(LOG_ERR, "spi: Failed to set spi mode");
- return MRAA_ERROR_INVALID_RESOURCE;
- }
-
- dev->mode = spi_mode;
- return MRAA_SUCCESS;
-}
-
-mraa_result_t
-mraa_spi_frequency(mraa_spi_context dev, int hz)
-{
- int speed = 0;
- dev->clock = hz;
- if (ioctl(dev->devfd, SPI_IOC_RD_MAX_SPEED_HZ, &speed) != -1) {
- if (speed < hz) {
- dev->clock = speed;
- syslog(LOG_WARNING, "spi: Selected speed reduced to max allowed speed");
- }
- }
- return MRAA_SUCCESS;
-}
-
-mraa_result_t
-mraa_spi_lsbmode(mraa_spi_context dev, mraa_boolean_t lsb)
-{
- if (IS_FUNC_DEFINED(dev, spi_lsbmode_replace)) {
- return dev->advance_func->spi_lsbmode_replace(dev, lsb);
- }
-
- uint8_t lsb_mode = (uint8_t) lsb;
- if (ioctl(dev->devfd, SPI_IOC_WR_LSB_FIRST, &lsb_mode) < 0) {
- syslog(LOG_ERR, "spi: Failed to set bit order");
- return MRAA_ERROR_INVALID_RESOURCE;
- }
- if (ioctl(dev->devfd, SPI_IOC_RD_LSB_FIRST, &lsb_mode) < 0) {
- syslog(LOG_ERR, "spi: Failed to set bit order");
- return MRAA_ERROR_INVALID_RESOURCE;
- }
- dev->lsb = lsb;
- return MRAA_SUCCESS;
-}
-
-mraa_result_t
-mraa_spi_bit_per_word(mraa_spi_context dev, unsigned int bits)
-{
- if (ioctl(dev->devfd, SPI_IOC_WR_BITS_PER_WORD, &bits) < 0) {
- syslog(LOG_ERR, "spi: Failed to set bit per word");
- return MRAA_ERROR_INVALID_RESOURCE;
- }
- dev->bpw = bits;
- return MRAA_SUCCESS;
-}
-
-int
-mraa_spi_write(mraa_spi_context dev, uint8_t data)
-{
- struct spi_ioc_transfer msg;
- memset(&msg, 0, sizeof(msg));
-
- uint16_t length = 1;
-
- unsigned long recv = 0;
- msg.tx_buf = (unsigned long) &data;
- msg.rx_buf = (unsigned long) &recv;
- msg.speed_hz = dev->clock;
- msg.bits_per_word = dev->bpw;
- msg.delay_usecs = 0;
- msg.len = length;
- if (ioctl(dev->devfd, SPI_IOC_MESSAGE(1), &msg) < 0) {
- syslog(LOG_ERR, "spi: Failed to perform dev transfer");
- return -1;
- }
- return (int) recv;
-}
-
-uint16_t
-mraa_spi_write_word(mraa_spi_context dev, uint16_t data)
-{
- struct spi_ioc_transfer msg;
- memset(&msg, 0, sizeof(msg));
-
- uint16_t length = 2;
-
- uint16_t recv = 0;
- msg.tx_buf = (unsigned long) &data;
- msg.rx_buf = (unsigned long) &recv;
- msg.speed_hz = dev->clock;
- msg.bits_per_word = dev->bpw;
- msg.delay_usecs = 0;
- msg.len = length;
- if (ioctl(dev->devfd, SPI_IOC_MESSAGE(1), &msg) < 0) {
- syslog(LOG_ERR, "spi: Failed to perform dev transfer");
- return -1;
- }
- return recv;
-}
-
-mraa_result_t
-mraa_spi_transfer_buf(mraa_spi_context dev, uint8_t* data, uint8_t* rxbuf, int length)
-{
- struct spi_ioc_transfer msg;
- memset(&msg, 0, sizeof(msg));
-
- msg.tx_buf = (unsigned long) data;
- msg.rx_buf = (unsigned long) rxbuf;
- msg.speed_hz = dev->clock;
- msg.bits_per_word = dev->bpw;
- msg.delay_usecs = 0;
- msg.len = length;
- if (ioctl(dev->devfd, SPI_IOC_MESSAGE(1), &msg) < 0) {
- syslog(LOG_ERR, "spi: Failed to perform dev transfer");
- return MRAA_ERROR_INVALID_RESOURCE;
- }
- return MRAA_SUCCESS;
-}
-
-mraa_result_t
-mraa_spi_transfer_buf_word(mraa_spi_context dev, uint16_t* data, uint16_t* rxbuf, int length)
-{
- struct spi_ioc_transfer msg;
- memset(&msg, 0, sizeof(msg));
-
- msg.tx_buf = (unsigned long) data;
- msg.rx_buf = (unsigned long) rxbuf;
- msg.speed_hz = dev->clock;
- msg.bits_per_word = dev->bpw;
- msg.delay_usecs = 0;
- msg.len = length;
- if (ioctl(dev->devfd, SPI_IOC_MESSAGE(1), &msg) < 0) {
- syslog(LOG_ERR, "spi: Failed to perform dev transfer");
- return MRAA_ERROR_INVALID_RESOURCE;
- }
- return MRAA_SUCCESS;
-}
-
-uint8_t*
-mraa_spi_write_buf(mraa_spi_context dev, uint8_t* data, int length)
-{
- uint8_t* recv = malloc(sizeof(uint8_t) * length);
-
- if (mraa_spi_transfer_buf(dev, data, recv, length) != MRAA_SUCCESS) {
- free(recv);
- return NULL;
- }
- return recv;
-}
-
-uint16_t*
-mraa_spi_write_buf_word(mraa_spi_context dev, uint16_t* data, int length)
-{
- uint16_t* recv = malloc(sizeof(uint16_t) * length);
-
- if (mraa_spi_transfer_buf_word(dev, data, recv, length) != MRAA_SUCCESS) {
- free(recv);
- return NULL;
- }
- return recv;
-}
-
-mraa_result_t
-mraa_spi_stop(mraa_spi_context dev)
-{
- close(dev->devfd);
- free(dev);
- return MRAA_SUCCESS;
-}
diff --git a/peripheral/libmraa/src/uart/uart.c b/peripheral/libmraa/src/uart/uart.c
deleted file mode 100644
index 0f8a2e3..0000000
--- a/peripheral/libmraa/src/uart/uart.c
+++ /dev/null
@@ -1,537 +0,0 @@
-/*
- * Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
- * Contributions: Jon Trulson <jtrulson@ics.com>
- * Brendan le Foll <brendan.le.foll@intel.com>
- * Copyright (c) 2014 - 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <stdlib.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <string.h>
-#include <termios.h>
-#include <sys/select.h>
-
-#include "uart.h"
-#include "mraa_internal.h"
-
-#ifndef CMSPAR
-#define CMSPAR 010000000000
-#endif
-
-// This function takes an unsigned int and converts it to a B* speed_t
-// that can be used with linux/posix termios
-static speed_t
-uint2speed(unsigned int speed)
-{
- switch (speed) {
- case 0:
- return B0; // hangup, not too useful otherwise
- case 50:
- return B50;
- case 75:
- return B75;
- case 110:
- return B110;
- case 150:
- return B150;
- case 200:
- return B200;
- case 300:
- return B300;
- case 600:
- return B600;
- case 1200:
- return B1200;
- case 1800:
- return B1800;
- case 2400:
- return B2400;
- case 4800:
- return B4800;
- case 9600:
- return B9600;
- case 19200:
- return B19200;
- case 38400:
- return B38400;
- case 57600:
- return B57600;
- case 115200:
- return B115200;
- case 230400:
- return B230400;
- case 460800:
- return B460800;
- case 500000:
- return B500000;
- case 576000:
- return B576000;
- case 921600:
- return B921600;
- case 1000000:
- return B1000000;
- case 1152000:
- return B1152000;
- case 1500000:
- return B1500000;
- case 2000000:
- return B2000000;
- case 2500000:
- return B2500000;
- case 3000000:
- return B3000000;
- case 3500000:
- return B3500000;
- case 4000000:
- return B4000000;
- default:
- // if we are here, then an unsupported baudrate was selected.
- // Report it via syslog and return B9600, a common default.
- syslog(LOG_ERR, "uart: unsupported baud rate, defaulting to 9600.");
- return B9600;
- }
-}
-
-static mraa_uart_context
-mraa_uart_init_internal(mraa_adv_func_t* func_table)
-{
- mraa_uart_context dev = (mraa_uart_context) calloc(1, sizeof(struct _uart));
- if (dev == NULL) {
- syslog(LOG_CRIT, "uart: Failed to allocate memory for context");
- return NULL;
- }
- dev->index = -1;
- dev->fd = -1;
- dev->advance_func = func_table;
-
- return dev;
-}
-
-mraa_uart_context
-mraa_uart_init(int index)
-{
- if (plat == NULL) {
- syslog(LOG_ERR, "uart: platform not initialised");
- return NULL;
- }
-
- if (mraa_is_sub_platform_id(index)) {
- syslog(LOG_NOTICE, "uart: Using sub platform is not supported");
- return NULL;
- }
-
- if (plat->adv_func->uart_init_pre != NULL) {
- if (plat->adv_func->uart_init_pre(index) != MRAA_SUCCESS) {
- syslog(LOG_ERR, "uart: failure in pre-init platform hook");
- return NULL;
- }
- }
-
- if (plat->uart_dev_count == 0) {
- syslog(LOG_ERR, "uart: platform has no UARTs defined");
- return NULL;
- }
-
- if (plat->uart_dev_count <= index) {
- syslog(LOG_ERR, "uart: platform has only %i", plat->uart_dev_count);
- return NULL;
- }
-
- if (!plat->no_bus_mux) {
- int pos = plat->uart_dev[index].rx;
- if (pos >= 0) {
- if (plat->pins[pos].uart.mux_total > 0) {
- if (mraa_setup_mux_mapped(plat->pins[pos].uart) != MRAA_SUCCESS) {
- syslog(LOG_ERR, "uart: failed to setup muxes for RX pin");
- return NULL;
- }
- }
- }
-
- pos = plat->uart_dev[index].tx;
- if (pos >= 0) {
- if (plat->pins[pos].uart.mux_total > 0) {
- if (mraa_setup_mux_mapped(plat->pins[pos].uart) != MRAA_SUCCESS) {
- syslog(LOG_ERR, "uart: failed to setup muxes for TX pin");
- return NULL;
- }
- }
- }
- }
-
- mraa_uart_context dev = mraa_uart_init_raw((char*)plat->uart_dev[index].device_path);
- if (dev == NULL) {
- return NULL;
- }
- dev->index = index; //Set the board Index.
-
- if (IS_FUNC_DEFINED(dev, uart_init_post)) {
- mraa_result_t ret = dev->advance_func->uart_init_post(dev);
- if (ret != MRAA_SUCCESS) {
- free(dev);
- return NULL;
- }
- }
-
- return dev;
-}
-
-mraa_uart_context
-mraa_uart_init_raw(const char* path)
-{
- mraa_uart_context dev = mraa_uart_init_internal(plat == NULL ? NULL : plat->adv_func);
- if (dev == NULL) {
- syslog(LOG_ERR, "uart: Failed to allocate memory for context");
- return NULL;
- }
- dev->path = path;
-
- if (!dev->path) {
- syslog(LOG_ERR, "uart: device path undefined, open failed");
- free(dev);
- return NULL;
- }
-
- // now open the device
- if ((dev->fd = open(dev->path, O_RDWR)) == -1) {
- syslog(LOG_ERR, "uart: open() failed");
- free(dev);
- return NULL;
- }
-
- // now setup the tty and the selected baud rate
- struct termios termio;
-
- // get current modes
- if (tcgetattr(dev->fd, &termio)) {
- syslog(LOG_ERR, "uart: tcgetattr() failed");
- close(dev->fd);
- free(dev);
- return NULL;
- }
-
- // setup for a 'raw' mode. 8N1, no echo or special character
- // handling, such as flow control or line editing semantics.
- // cfmakeraw is not POSIX!
- cfmakeraw(&termio);
- if (tcsetattr(dev->fd, TCSAFLUSH, &termio) < 0) {
- syslog(LOG_ERR, "uart: tcsetattr() failed after cfmakeraw()");
- close(dev->fd);
- free(dev);
- return NULL;
- }
-
- if (mraa_uart_set_baudrate(dev, 9600) != MRAA_SUCCESS) {
- close(dev->fd);
- free(dev);
- return NULL;
- }
-
- return dev;
-}
-
-mraa_result_t
-mraa_uart_stop(mraa_uart_context dev)
-{
- if (!dev) {
- syslog(LOG_ERR, "uart: stop: context is NULL");
- return MRAA_ERROR_INVALID_HANDLE;
- }
-
- // just close the device and reset our fd.
- if (dev->fd >= 0) {
- close(dev->fd);
- }
-
- free(dev);
-
- return MRAA_SUCCESS;
-}
-
-mraa_result_t
-mraa_uart_flush(mraa_uart_context dev)
-{
- if (!dev) {
- syslog(LOG_ERR, "uart: stop: context is NULL");
- return MRAA_ERROR_INVALID_HANDLE;
- }
-
- if (tcdrain(dev->fd) == -1) {
- return MRAA_ERROR_FEATURE_NOT_SUPPORTED;
- }
-
- return MRAA_SUCCESS;
-}
-
-mraa_result_t
-mraa_uart_set_baudrate(mraa_uart_context dev, unsigned int baud)
-{
- if (!dev) {
- syslog(LOG_ERR, "uart: stop: context is NULL");
- return MRAA_ERROR_INVALID_HANDLE;
- }
-
- struct termios termio;
- if (tcgetattr(dev->fd, &termio)) {
- syslog(LOG_ERR, "uart: tcgetattr() failed");
- return MRAA_ERROR_INVALID_HANDLE;
- }
-
- // set our baud rates
- speed_t speed = uint2speed(baud);
- cfsetispeed(&termio, speed);
- cfsetospeed(&termio, speed);
-
- // make it so
- if (tcsetattr(dev->fd, TCSAFLUSH, &termio) < 0) {
- syslog(LOG_ERR, "uart: tcsetattr() failed");
- return MRAA_ERROR_FEATURE_NOT_SUPPORTED;
- }
- return MRAA_SUCCESS;
-}
-
-mraa_result_t
-mraa_uart_set_mode(mraa_uart_context dev, int bytesize, mraa_uart_parity_t parity, int stopbits)
-{
- if (!dev) {
- syslog(LOG_ERR, "uart: stop: context is NULL");
- return MRAA_ERROR_INVALID_HANDLE;
- }
-
- struct termios termio;
- if (tcgetattr(dev->fd, &termio)) {
- syslog(LOG_ERR, "uart: tcgetattr() failed");
- return MRAA_ERROR_INVALID_HANDLE;
- }
-
- termio.c_cflag &= ~CSIZE;
- switch (bytesize) {
- case 8:
- termio.c_cflag |= CS8;
- break;
- case 7:
- termio.c_cflag |= CS7;
- break;
- case 6:
- termio.c_cflag |= CS6;
- break;
- case 5:
- termio.c_cflag |= CS5;
- break;
- default:
- termio.c_cflag |= CS8;
- break;
- }
-
- // POSIX & linux doesn't support 1.5 and I've got bigger fish to fry
- switch (stopbits) {
- case 1:
- termio.c_cflag &= ~CSTOPB;
- break;
- case 2:
- termio.c_cflag |= CSTOPB;
- default:
- break;
- }
-
- switch (parity) {
- case MRAA_UART_PARITY_NONE:
- termio.c_cflag &= ~(PARENB | PARODD);
- break;
- case MRAA_UART_PARITY_EVEN:
- termio.c_cflag |= PARENB;
- termio.c_cflag &= ~PARODD;
- break;
- case MRAA_UART_PARITY_ODD:
- termio.c_cflag |= PARENB | PARODD;
- break;
- case MRAA_UART_PARITY_MARK: // not POSIX
- termio.c_cflag |= PARENB | CMSPAR | PARODD;
- break;
- case MRAA_UART_PARITY_SPACE: // not POSIX
- termio.c_cflag |= PARENB | CMSPAR;
- termio.c_cflag &= ~PARODD;
- break;
- }
-
- if (tcsetattr(dev->fd, TCSAFLUSH, &termio) < 0) {
- syslog(LOG_ERR, "uart: tcsetattr() failed");
- return MRAA_ERROR_FEATURE_NOT_SUPPORTED;
- }
-
- return MRAA_SUCCESS;
-}
-
-mraa_result_t
-mraa_uart_set_flowcontrol(mraa_uart_context dev, mraa_boolean_t xonxoff, mraa_boolean_t rtscts)
-{
- if (!dev) {
- syslog(LOG_ERR, "uart: stop: context is NULL");
- return MRAA_ERROR_INVALID_HANDLE;
- }
-
- // hardware flow control
- int action = TCIOFF;
- if (xonxoff) {
- action = TCION;
- }
- if (tcflow(dev->fd, action)) {
- return MRAA_ERROR_FEATURE_NOT_SUPPORTED;
- }
-
- // rtscts
- struct termios termio;
-
- // get current modes
- if (tcgetattr(dev->fd, &termio)) {
- syslog(LOG_ERR, "uart: tcgetattr() failed");
- return MRAA_ERROR_INVALID_HANDLE;
- }
-
- if (rtscts) {
- termio.c_cflag |= CRTSCTS;
- } else {
- termio.c_cflag &= ~CRTSCTS;
- }
-
- if (tcsetattr(dev->fd, TCSAFLUSH, &termio) < 0) {
- syslog(LOG_ERR, "uart: tcsetattr() failed");
- return MRAA_ERROR_FEATURE_NOT_SUPPORTED;
- }
-
- return MRAA_SUCCESS;
-}
-
-mraa_result_t
-mraa_uart_set_timeout(mraa_uart_context dev, int read, int write, int interchar)
-{
- if (!dev) {
- syslog(LOG_ERR, "uart: stop: context is NULL");
- return MRAA_ERROR_INVALID_HANDLE;
- }
-
- struct termios termio;
- // get current modes
- if (tcgetattr(dev->fd, &termio)) {
- syslog(LOG_ERR, "uart: tcgetattr() failed");
- return MRAA_ERROR_FEATURE_NOT_SUPPORTED;
- }
- if (read > 0) {
- read = read / 100;
- if (read == 0)
- read = 1;
- }
- termio.c_lflag &= ~ICANON; /* Set non-canonical mode */
- termio.c_cc[VTIME] = read; /* Set timeout in tenth seconds */
- if (tcsetattr(dev->fd, TCSANOW, &termio) < 0) {
- syslog(LOG_ERR, "uart: tcsetattr() failed");
- return MRAA_ERROR_FEATURE_NOT_SUPPORTED;
- }
-
- return MRAA_SUCCESS;
-}
-
-const char*
-mraa_uart_get_dev_path(mraa_uart_context dev)
-{
- if (!dev) {
- syslog(LOG_ERR, "uart: get_device_path failed, context is NULL");
- return NULL;
- }
- if (dev->path == NULL) {
- syslog(LOG_ERR, "uart: device path undefined");
- return NULL;
- }
-
- return dev->path;
-}
-
-int
-mraa_uart_read(mraa_uart_context dev, char* buf, size_t len)
-{
- if (!dev) {
- syslog(LOG_ERR, "uart: read: context is NULL");
- return MRAA_ERROR_INVALID_HANDLE;
- }
-
- if (dev->fd < 0) {
- syslog(LOG_ERR, "uart: port is not open");
- return MRAA_ERROR_INVALID_RESOURCE;
- }
-
- return read(dev->fd, buf, len);
-}
-
-int
-mraa_uart_write(mraa_uart_context dev, const char* buf, size_t len)
-{
- if (!dev) {
- syslog(LOG_ERR, "uart: write: context is NULL");
- return MRAA_ERROR_INVALID_HANDLE;
- }
-
- if (dev->fd < 0) {
- syslog(LOG_ERR, "uart: port is not open");
- return MRAA_ERROR_INVALID_RESOURCE;
- }
-
- return write(dev->fd, buf, len);
-}
-
-mraa_boolean_t
-mraa_uart_data_available(mraa_uart_context dev, unsigned int millis)
-{
- if (!dev) {
- syslog(LOG_ERR, "uart: data_available: write context is NULL");
- return 0;
- }
-
- if (dev->fd < 0) {
- syslog(LOG_ERR, "uart: port is not open");
- return 0;
- }
-
- struct timeval timeout;
-
- if (millis == 0) {
- // no waiting
- timeout.tv_sec = 0;
- timeout.tv_usec = 0;
- } else {
- timeout.tv_sec = millis / 1000;
- timeout.tv_usec = (millis % 1000) * 1000;
- }
-
- fd_set readfds;
-
- FD_ZERO(&readfds);
- FD_SET(dev->fd, &readfds);
-
- if (select(dev->fd + 1, &readfds, NULL, NULL, &timeout) > 0) {
- return 1; // data is ready
- } else {
- return 0;
- }
-}
-
-
diff --git a/peripheral/libmraa/src/usb/CMakeLists.txt b/peripheral/libmraa/src/usb/CMakeLists.txt
deleted file mode 100644
index e021c5d..0000000
--- a/peripheral/libmraa/src/usb/CMakeLists.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-set (mraa_LIB_USB_SRCS_NOAUTO ${PROJECT_SOURCE_DIR}/src/usb/usb.c)
-
-if (FTDI4222)
- message (INFO " - FTDI4222")
- set (mraa_LIB_USB_SRCS_NOAUTO ${mraa_LIB_USB_SRCS_NOAUTO}
- ${PROJECT_SOURCE_DIR}/src/usb/ftdi_ft4222.c
- )
-endif ()
-
-set (mraa_LIB_PLAT_SRCS_NOAUTO ${mraa_LIB_PLAT_SRCS_NOAUTO}
- ${mraa_LIB_USB_SRCS_NOAUTO} PARENT_SCOPE)
-
diff --git a/peripheral/libmraa/src/usb/ftdi_ft4222.c b/peripheral/libmraa/src/usb/ftdi_ft4222.c
deleted file mode 100644
index 5c6167e..0000000
--- a/peripheral/libmraa/src/usb/ftdi_ft4222.c
+++ /dev/null
@@ -1,1128 +0,0 @@
-/*
- * Author: Henry Bruce <henry.bruce@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 <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include <sys/time.h>
-#include <errno.h>
-#include "linux/i2c-dev.h"
-#include "common.h"
-#include "ftd2xx.h"
-#include "libft4222.h"
-#include "usb/ftdi_ft4222.h"
-
-#define PLATFORM_NAME "FTDI FT4222"
-#define I2CM_ERROR(status) (((status) &0x02) != 0)
-#define PCA9672_ADDR 0x20
-#define PCA9555_ADDR 0x27
-#define PCA9555_INPUT_REG 0
-#define PCA9555_OUTPUT_REG 2
-#define PCA9555_POLARITY_REG 4
-#define PCA9555_DIRECTION_REG 6
-#define PCA9545_ADDR 0x70
-#define PCA9672_PINS 8
-#define PCA9555_PINS 16
-#define PCA9545_BUSSES 4
-#define GPIO_PORT_IO_RESET GPIO_PORT2
-#define GPIO_PORT_IO_INT GPIO_PORT3
-#define MAX_IO_EXPANDER_PINS PCA9555_PINS
-
-typedef enum {IO_EXP_NONE, IO_EXP_PCA9672, IO_EXP_PCA9555} ft4222_io_exp_type;
-typedef enum {GPIO_TYPE_BUILTIN, GPIO_TYPE_PCA9672, GPIO_TYPE_PCA9555, GPIO_TYPE_UNKNOWN=99} ft4222_gpio_type;
-
-static pthread_mutex_t ft4222_lock;
-static FT_HANDLE ftHandleGpio = (FT_HANDLE) NULL; //GPIO Handle
-static FT_HANDLE ftHandleI2c = (FT_HANDLE) NULL; //I2C/SPI Handle
-static FT_HANDLE ftHandleSpi = (FT_HANDLE) NULL; //I2C/SPI Handle
-static GPIO_Dir pinDirection[] = {GPIO_OUTPUT, GPIO_OUTPUT, GPIO_OUTPUT, GPIO_OUTPUT};
-static uint8_t pca9672DirectionMask = 0;
-static uint16_t pca9555OutputValue = 0;
-static uint16_t pca9555DirectionValue = 0;
-static int bus_speed = 400;
-static int numFt4222GpioPins = 4;
-static int numI2cGpioExpanderPins = 8;
-static int numI2cSwitchBusses = 4;
-static int currentI2cBus = 0;
-static ft4222_io_exp_type gpio_expander_chip;
-static mraa_boolean_t libft4222_load_success = TRUE;
-
-FT_STATUS (*dl_FT_GetDeviceInfoList)(FT_DEVICE_LIST_INFO_NODE*, LPDWORD);
-FT_STATUS (*dl_FT_CreateDeviceInfoList)(LPDWORD);
-FT_STATUS (*dl_FT_OpenEx)(PVOID, DWORD, FT_HANDLE*);
-FT4222_STATUS (*dl_FT4222_GetVersion)(FT_HANDLE, FT4222_Version*);
-FT4222_STATUS (*dl_FT4222_I2CMaster_Write)(FT_HANDLE, uint16, uint8*, uint16, uint16*);
-FT4222_STATUS (*dl_FT4222_I2CMaster_Reset)(FT_HANDLE);
-FT4222_STATUS (*dl_FT4222_I2CMaster_Read)(FT_HANDLE, uint16, uint8*, uint16, uint16*);
-FT4222_STATUS (*dl_FT4222_I2CMaster_Init)(FT_HANDLE, uint32);
-FT4222_STATUS (*dl_FT4222_I2CMaster_GetStatus)(FT_HANDLE, uint8*);
-FT4222_STATUS (*dl_FT4222_GPIO_Init)(FT_HANDLE, GPIO_Dir[4]);
-FT4222_STATUS (*dl_FT4222_GPIO_GetTriggerStatus)(FT_HANDLE, GPIO_Port, uint16*);
-FT4222_STATUS (*dl_FT4222_GPIO_ReadTriggerQueue)(FT_HANDLE, GPIO_Port, GPIO_Trigger*, uint16, uint16*);
-FT4222_STATUS (*dl_FT4222_GPIO_Read)(FT_HANDLE, GPIO_Port, BOOL*);
-FT4222_STATUS (*dl_FT4222_GPIO_SetInputTrigger)(FT_HANDLE, GPIO_Port, GPIO_Trigger);
-FT4222_STATUS (*dl_FT4222_GPIO_Write)(FT_HANDLE, GPIO_Port, BOOL);
-FT4222_STATUS (*dl_FT4222_SetWakeUpInterrupt)(FT_HANDLE, BOOL);
-FT4222_STATUS (*dl_FT4222_SetSuspendOut)(FT_HANDLE, BOOL);
-FT4222_STATUS (*dl_FT4222_SPIMaster_Init)(FT_HANDLE, FT4222_SPIMode, FT4222_SPIClock, FT4222_SPICPOL, FT4222_SPICPHA, uint8);
-
-static void
-mraa_ftdi_ft4222_sleep_ms(unsigned long mseconds)
-{
- struct timespec sleepTime;
-
- sleepTime.tv_sec = mseconds / 1000; // Number of seconds
- sleepTime.tv_nsec = (mseconds % 1000) * 1000000; // Convert fractional seconds to nanoseconds
-
- // Iterate nanosleep in a loop until the total sleep time is the original
- // value of the seconds parameter
- while ((nanosleep(&sleepTime, &sleepTime) != 0) && (errno == EINTR))
- ;
-}
-
-static unsigned int
-mraa_ftdi_ft4222_get_tick_count_ms()
-{
- static unsigned int startTick = 0;
- unsigned int ticks;
- struct timeval now;
- gettimeofday(&now, NULL);
- ticks = now.tv_sec * 1000;
- ticks += now.tv_usec / 1000;
- if (startTick == 0)
- startTick = ticks;
- return ticks - startTick;
-}
-
-void *
-mraa_ftdi_ft4222_dlsym(const char *symbol)
-{
- void *func = dlsym(libft4222_lib, symbol);
- if (func == NULL) {
- syslog(LOG_ERR, "%s", dlerror());
- libft4222_load_success = FALSE;
- }
- return func;
-}
-
-
-mraa_result_t
-mraa_ftdi_ft4222_init()
-{
- mraa_result_t mraaStatus = MRAA_ERROR_NO_RESOURCES;
- FT_DEVICE_LIST_INFO_NODE* devInfo = NULL;
- FT_STATUS ftStatus;
- DWORD numDevs = 0;
- int i;
- int retCode = 0;
-
- dl_FT_GetDeviceInfoList = mraa_ftdi_ft4222_dlsym("FT_GetDeviceInfoList");
- dl_FT_CreateDeviceInfoList = mraa_ftdi_ft4222_dlsym("FT_CreateDeviceInfoList");
- dl_FT4222_GetVersion = mraa_ftdi_ft4222_dlsym("FT4222_GetVersion");
- dl_FT4222_I2CMaster_Write = mraa_ftdi_ft4222_dlsym("FT4222_I2CMaster_Write");
- dl_FT4222_I2CMaster_Reset = mraa_ftdi_ft4222_dlsym("FT4222_I2CMaster_Reset");
- dl_FT4222_I2CMaster_Read = mraa_ftdi_ft4222_dlsym("FT4222_I2CMaster_Read");
- dl_FT4222_I2CMaster_Init = mraa_ftdi_ft4222_dlsym("FT4222_I2CMaster_Init");
- dl_FT4222_I2CMaster_GetStatus = mraa_ftdi_ft4222_dlsym("FT4222_I2CMaster_GetStatus");
- dl_FT4222_GPIO_Init = mraa_ftdi_ft4222_dlsym("FT4222_GPIO_Init");
- dl_FT4222_GPIO_GetTriggerStatus = mraa_ftdi_ft4222_dlsym("FT4222_GPIO_GetTriggerStatus");
- dl_FT4222_GPIO_ReadTriggerQueue = mraa_ftdi_ft4222_dlsym("FT4222_GPIO_ReadTriggerQueue");
- dl_FT4222_GPIO_Read = mraa_ftdi_ft4222_dlsym("FT4222_GPIO_Read");
- dl_FT4222_GPIO_SetInputTrigger = mraa_ftdi_ft4222_dlsym("FT4222_GPIO_SetInputTrigger");
- dl_FT4222_GPIO_Write = mraa_ftdi_ft4222_dlsym("FT4222_GPIO_Write");
- dl_FT4222_SetWakeUpInterrupt = mraa_ftdi_ft4222_dlsym("FT4222_SetWakeUpInterrupt");
- dl_FT4222_SetSuspendOut = mraa_ftdi_ft4222_dlsym("FT4222_SetSuspendOut");
- dl_FT4222_SPIMaster_Init = mraa_ftdi_ft4222_dlsym("FT4222_SPIMaster_Init");
- dl_FT_OpenEx = mraa_ftdi_ft4222_dlsym("FT_OpenEx");
-
- if (!libft4222_load_success) {
- syslog(LOG_ERR, "Failed to find all symbols for FTDI4222 support");
- goto init_exit;
- }
-
- ftStatus = dl_FT_CreateDeviceInfoList(&numDevs);
- if (ftStatus != FT_OK) {
- syslog(LOG_ERR, "FT_CreateDeviceInfoList failed: error code %d\n", ftStatus);
- goto init_exit;
- }
-
- devInfo = calloc((size_t) numDevs, sizeof(FT_DEVICE_LIST_INFO_NODE));
- if (devInfo == NULL) {
- syslog(LOG_ERR, "FT4222 allocation failure.\n");
- goto init_exit;
- }
-
- ftStatus = dl_FT_GetDeviceInfoList(devInfo, &numDevs);
- syslog(LOG_NOTICE, "FT_GetDeviceInfoList returned %d devices\n", numDevs);
- if (ftStatus != FT_OK) {
- syslog(LOG_ERR, "FT_GetDeviceInfoList failed (error code %d)\n", (int) ftStatus);
- goto init_exit;
- }
- if (numDevs < 2) {
- syslog(LOG_ERR, "No FT4222 devices connected.\n");
- goto init_exit;
- }
- if(numDevs > 2) {
- syslog(LOG_ERR, "CNFMODE not supported. Valid modes are 0 or 3.\n");
- goto init_exit;
- }
-
- // FIXME: Assumes just one physical FTDI device present
- DWORD locationIdI2c = 0;
- DWORD locationIdGpio = 0;
- if (devInfo[0].Type == FT_DEVICE_4222H_0)
- locationIdI2c = devInfo[0].LocId;
- if (devInfo[1].Type == FT_DEVICE_4222H_0)
- locationIdGpio = devInfo[1].LocId;
-
- if (locationIdI2c == 0) {
- syslog(LOG_ERR, "FT_GetDeviceInfoList contains no I2C controllers\n");
- goto init_exit;
- }
-
- if (locationIdGpio == 0) {
- syslog(LOG_ERR, "FT_GetDeviceInfoList contains no GPIO controllers\n");
- goto init_exit;
- }
-
- ftStatus = dl_FT_OpenEx((PVOID)(uintptr_t) locationIdI2c, FT_OPEN_BY_LOCATION, &ftHandleI2c);
- if (ftStatus != FT_OK) {
- syslog(LOG_ERR, "FT_OpenEx failed (error %d)\n", (int) ftStatus);
- goto init_exit;
- }
-
- ftStatus = dl_FT_OpenEx((PVOID)(uintptr_t) locationIdGpio, FT_OPEN_BY_LOCATION, &ftHandleGpio);
- if (ftStatus != FT_OK) {
- syslog(LOG_ERR, "FT_OpenEx failed (error %d)\n", (int) ftStatus);
- goto init_exit;
- }
-
- dl_FT4222_SetSuspendOut(ftHandleGpio, 0);
- dl_FT4222_SetWakeUpInterrupt(ftHandleGpio, 0);
- ftStatus = dl_FT4222_GPIO_Init(ftHandleGpio, pinDirection);
- if (ftStatus != FT_OK) {
- syslog(LOG_ERR, "FT4222_GPIO_Init failed (error %d)\n", (int) ftStatus);
- mraaStatus = MRAA_ERROR_NO_RESOURCES;
- goto init_exit;
- }
-
- // Tell the FT4222 to be an I2C Master by default on init.
- FT4222_STATUS ft4222Status = dl_FT4222_I2CMaster_Init(ftHandleI2c, bus_speed);
- if (FT4222_OK != ft4222Status) {
- syslog(LOG_ERR, "FT4222_I2CMaster_Init failed (error %d)!\n", ft4222Status);
- goto init_exit;
- }
-
- ft4222Status = dl_FT4222_I2CMaster_Reset(ftHandleI2c);
- if (FT4222_OK != ft4222Status) {
- syslog(LOG_ERR, "FT4222_I2CMaster_Reset failed (error %d)!\n", ft4222Status);
- goto init_exit;
- }
-
- mraaStatus = MRAA_SUCCESS;
-
-init_exit:
- if (devInfo != NULL)
- free(devInfo);
- if (mraaStatus == MRAA_SUCCESS)
- syslog(LOG_NOTICE, "mraa_ftdi_ft4222_init completed successfully\n");
- return mraaStatus;
-}
-
-
-mraa_result_t
-mraa_ftdi_ft4222_get_version(unsigned int* versionChip, unsigned int* versionLib)
-{
- if (ftHandleI2c != NULL) {
- FT4222_Version ft4222Version;
- FT4222_STATUS ft4222Status = dl_FT4222_GetVersion(ftHandleI2c, &ft4222Version);
- if (FT4222_OK == ft4222Status) {
- *versionChip = (unsigned int) ft4222Version.chipVersion;
- *versionLib = (unsigned int) ft4222Version.dllVersion;
- syslog(LOG_NOTICE, "FT4222_GetVersion %08X %08X\n", *versionChip, *versionLib);
- return MRAA_SUCCESS;
- } else {
- syslog(LOG_ERR, "FT4222_GetVersion failed (error %d)\n", (int) ft4222Status);
- return MRAA_ERROR_NO_RESOURCES;
- }
- } else {
- syslog(LOG_ERR, "Bad FT4222 handle\n");
- return MRAA_ERROR_INVALID_HANDLE;
- }
-}
-
-
-/******************* Private I2C functions *******************/
-
-static void
-mraa_ftdi_ft4222_i2c_log(char* msg, uint8_t addr, const uint8_t* data, int length)
-{
- char buf[256];
- int pos = sprintf(buf, "%s: %#02x ", msg, addr);
- int i = 0;
- pos += sprintf(&buf[pos], "{");
- for (i = 0; i < length; ++i)
- pos += sprintf(&buf[pos], "%#02x ", data[i]);
- pos += sprintf(&buf[pos], "}");
- syslog(LOG_NOTICE, "%s", buf);
-}
-
-
-static int
-mraa_ftdi_ft4222_i2c_read_internal(FT_HANDLE handle, uint8_t addr, uint8_t* data, int length)
-{
- uint16 bytesRead = 0;
- uint8 controllerStatus;
- FT4222_STATUS ft4222Status = dl_FT4222_I2CMaster_Read(handle, addr, data, length, &bytesRead);
- // mraa_ftdi_ft4222_i2c_log("FT4222_I2CMaster_Read", addr, data, length);
- ft4222Status = dl_FT4222_I2CMaster_GetStatus(ftHandleI2c, &controllerStatus);
- if (FT4222_OK != ft4222Status || I2CM_ERROR(controllerStatus)) {
- syslog(LOG_ERR, "FT4222_I2CMaster_Read failed for address %#02x. Code %d", addr, controllerStatus);
- dl_FT4222_I2CMaster_Reset(handle);
- return 0;
- }
- // syslog(LOG_NOTICE, "FT4222_I2CMaster_Read completed");
- return bytesRead;
-}
-
-static int
-mraa_ftdi_ft4222_i2c_write_internal(FT_HANDLE handle, uint8_t addr, const uint8_t* data, int bytesToWrite)
-{
- uint16 bytesWritten = 0;
- uint8 controllerStatus;
- // mraa_ftdi_ft4222_i2c_log("FT4222_I2CMaster_Write", addr, data, bytesToWrite);
- FT4222_STATUS ft4222Status = dl_FT4222_I2CMaster_Write(handle, addr, (uint8_t*) data, bytesToWrite, &bytesWritten);
- ft4222Status = dl_FT4222_I2CMaster_GetStatus(ftHandleI2c, &controllerStatus);
- if (FT4222_OK != ft4222Status || I2CM_ERROR(controllerStatus)) {
- syslog(LOG_ERR, "FT4222_I2CMaster_Write failed address %#02x\n", addr);
- dl_FT4222_I2CMaster_Reset(handle);
- return 0;
- }
- if (bytesWritten != bytesToWrite)
- syslog(LOG_ERR, "FT4222_I2CMaster_Write wrote %u of %u bytes.\n", bytesWritten, bytesToWrite);
-
- // syslog(LOG_NOTICE, "FT4222_I2CMaster_Write completed");
- return bytesWritten;
-}
-
-
-// Function detects known I2C I/O expanders and returns the number of GPIO pins on expander
-static int
-mraa_ftdi_ft4222_detect_io_expander()
-{
- uint8_t data;
- if (mraa_ftdi_ft4222_i2c_read_internal(ftHandleI2c, PCA9672_ADDR, &data, 1) == 1) {
- gpio_expander_chip = IO_EXP_PCA9672;
- return PCA9672_PINS;
- } else if (mraa_ftdi_ft4222_i2c_read_internal(ftHandleI2c, PCA9555_ADDR, &data, 1) == 1) {
- gpio_expander_chip = IO_EXP_PCA9555;
- uint8_t reg = PCA9555_OUTPUT_REG;
- mraa_ftdi_ft4222_i2c_write_internal(ftHandleI2c, PCA9555_ADDR, &reg, 1);
- mraa_ftdi_ft4222_i2c_read_internal(ftHandleI2c, PCA9555_ADDR, (uint8_t*)&pca9555OutputValue, 2);
- reg = PCA9555_DIRECTION_REG;
- mraa_ftdi_ft4222_i2c_write_internal(ftHandleI2c, PCA9555_ADDR, &reg, 1);
- mraa_ftdi_ft4222_i2c_read_internal(ftHandleI2c, PCA9555_ADDR, (uint8_t*)&pca9555DirectionValue, 2);
- return PCA9555_PINS;
- } else {
- gpio_expander_chip = IO_EXP_NONE;
- return 0;
- }
-}
-
-
-static ft4222_gpio_type
-mraa_ftdi_ft4222_get_gpio_type(int pin)
-{
- if (pin < numFt4222GpioPins) {
- return GPIO_TYPE_BUILTIN;
- } else switch (gpio_expander_chip) {
- case IO_EXP_PCA9672:
- return GPIO_TYPE_PCA9672;
- case GPIO_TYPE_PCA9555:
- return GPIO_TYPE_PCA9555;
- default:
- return GPIO_TYPE_UNKNOWN;
- }
-}
-
-
-static mraa_result_t
-ftdi_ft4222_set_internal_gpio_dir(int pin, GPIO_Dir direction)
-{
- pinDirection[pin] = direction;
- if (dl_FT4222_GPIO_Init(ftHandleGpio, pinDirection) != FT4222_OK)
- return MRAA_ERROR_UNSPECIFIED;
- else
- return MRAA_SUCCESS;
-}
-
-
-static mraa_result_t
-mraa_ftdi_ft4222_gpio_set_pca9672_dir(int pin, mraa_gpio_dir_t dir)
-{
- uint8_t mask = 1 << pin;
- switch (dir) {
- case MRAA_GPIO_IN:
- pca9672DirectionMask |= mask;
- int bytes_written = mraa_ftdi_ft4222_i2c_write_internal(ftHandleI2c, PCA9672_ADDR, &pca9672DirectionMask, 1);
- return bytes_written == 1 ? MRAA_SUCCESS : MRAA_ERROR_UNSPECIFIED;
- case MRAA_GPIO_OUT:
- pca9672DirectionMask &= (~mask);
- return MRAA_SUCCESS;
- default:
- return MRAA_ERROR_UNSPECIFIED;
- }
-}
-
-
-static mraa_result_t
-mraa_ftdi_ft4222_gpio_set_pca9555_dir(int pin, mraa_gpio_dir_t dir)
-{
- uint16_t mask = 1 << pin;
- switch (dir) {
- case MRAA_GPIO_IN:
- pca9555DirectionValue |= mask;
- break;
- case MRAA_GPIO_OUT:
- pca9555DirectionValue &= (~mask);
- break;
- default:
- return MRAA_ERROR_UNSPECIFIED;
- }
- uint8_t buf[3];
- buf[0] = PCA9555_DIRECTION_REG;
- buf[1] = (uint8_t)(pca9555DirectionValue & 0xFF);
- buf[2] = (uint8_t)(pca9555DirectionValue >> 8);
- pthread_mutex_lock(&ft4222_lock);
- int bytes_written = mraa_ftdi_ft4222_i2c_write_internal(ftHandleI2c, PCA9555_ADDR, buf, sizeof(buf));
- pthread_mutex_unlock(&ft4222_lock);
- return bytes_written == sizeof(buf) ? MRAA_SUCCESS : MRAA_ERROR_UNSPECIFIED;
-}
-
-
-
-static mraa_result_t
-ftdi_ft4222_set_internal_gpio_trigger(int pin, GPIO_Trigger trigger)
-{
- FT4222_STATUS ft4222Status = dl_FT4222_GPIO_SetInputTrigger(ftHandleGpio, pin, trigger);
- if (ft4222Status == FT4222_OK)
- return MRAA_SUCCESS;
- else
- return MRAA_ERROR_UNSPECIFIED;
-}
-
-
-
-
-// Function detects known I2C switches and returns the number of busses.
-// On startup switch is disabled so default bus will be integrated i2c bus.
-static int
-mraa_ftdi_ft4222_detect_i2c_switch()
-{
- uint8_t data;
- if(mraa_ftdi_ft4222_i2c_read_internal(ftHandleI2c, PCA9545_ADDR, &data, 1) == 1) {
- data = 0;
- return mraa_ftdi_ft4222_i2c_write_internal(ftHandleI2c, PCA9545_ADDR, &data, 1) == 1 ? PCA9545_BUSSES : 0;
- }
- return 0;
-}
-
-
-static mraa_result_t
-mraa_ftdi_ft4222_i2c_select_bus(int bus)
-{
- if (bus > 0 && bus != currentI2cBus) {
- syslog(LOG_NOTICE, "mraa_ftdi_ft4222_i2c_select_bus switching to bus %d", bus);
- uint8_t data;
- if (bus == 0)
- data = 0;
- else
- data = 1 << (bus-1);
- if (mraa_ftdi_ft4222_i2c_write_internal(ftHandleI2c, PCA9545_ADDR, &data, 1) == 1)
- currentI2cBus = bus;
- else
- return MRAA_ERROR_UNSPECIFIED;
- }
- return MRAA_SUCCESS;
-}
-
-static int
-mraa_ftdi_ft4222_i2c_context_read(mraa_i2c_context dev, uint8_t* data, int length)
-{
- int bytes_read = 0;
- if (mraa_ftdi_ft4222_i2c_select_bus(dev->busnum) == MRAA_SUCCESS)
- bytes_read = mraa_ftdi_ft4222_i2c_read_internal(dev->handle, dev->addr, data, length);
- return bytes_read;
-}
-
-static int
-mraa_ftdi_ft4222_i2c_context_write(mraa_i2c_context dev, uint8_t* data, int length)
-{
- int bytes_written = 0;
- if (mraa_ftdi_ft4222_i2c_select_bus(dev->busnum) == MRAA_SUCCESS)
- bytes_written = mraa_ftdi_ft4222_i2c_write_internal(dev->handle, dev->addr, data, length);
- return bytes_written;
-}
-
-
-
-/******************* I2C functions *******************/
-
-static mraa_result_t
-mraa_ftdi_ft4222_i2c_init_bus_replace(mraa_i2c_context dev)
-{
- // Tell the FT4222 to be an I2C Master.
- FT4222_STATUS ft4222Status = dl_FT4222_I2CMaster_Init(ftHandleI2c, bus_speed);
- if (FT4222_OK != ft4222Status) {
- syslog(LOG_ERR, "FT4222_I2CMaster_Init failed (error %d)!\n", ft4222Status);
- return MRAA_ERROR_NO_RESOURCES;
- }
-
- // Reset the I2CM registers to a known state.
- ft4222Status = dl_FT4222_I2CMaster_Reset(ftHandleI2c);
- if (FT4222_OK != ft4222Status) {
- syslog(LOG_ERR, "FT4222_I2CMaster_Reset failed (error %d)!\n", ft4222Status);
- return MRAA_ERROR_NO_RESOURCES;
- }
-
- syslog(LOG_NOTICE, "I2C interface enabled GPIO0 and GPIO1 will be unavailable.\n");
- dev->handle = ftHandleI2c;
- dev->fh = -1; // We don't use file descriptors
- dev->funcs = I2C_FUNC_I2C; // Advertise minimal i2c support as per
- // https://www.kernel.org/doc/Documentation/i2c/functionality
- return MRAA_SUCCESS;
-}
-
-
-static mraa_result_t
-mraa_ftdi_ft4222_i2c_frequency(mraa_i2c_context dev, mraa_i2c_mode_t mode)
-{
- switch (mode) {
- case MRAA_I2C_STD: /**< up to 100Khz */
- bus_speed = 100;
- break;
- MRAA_I2C_FAST: /**< up to 400Khz */
- bus_speed = 400;
- break;
- MRAA_I2C_HIGH: /**< up to 3.4Mhz */
- bus_speed = 3400;
- break;
- }
- return dl_FT4222_I2CMaster_Init(ftHandleI2c, bus_speed) == FT4222_OK ? MRAA_SUCCESS : MRAA_ERROR_NO_RESOURCES;
-}
-
-
-static mraa_result_t
-mraa_ftdi_ft4222_i2c_address(mraa_i2c_context dev, uint8_t addr)
-{
- dev->addr = (int) addr;
- return MRAA_SUCCESS;
-}
-
-
-static int
-mraa_ftdi_ft4222_i2c_read(mraa_i2c_context dev, uint8_t* data, int length)
-{
- pthread_mutex_lock(&ft4222_lock);
- int bytes_read = mraa_ftdi_ft4222_i2c_read_internal(dev->handle, dev->addr, data, length);
- pthread_mutex_unlock(&ft4222_lock);
- return bytes_read;
-}
-
-static uint8_t
-mraa_ftdi_ft4222_i2c_read_byte(mraa_i2c_context dev)
-{
- uint8_t data;
- pthread_mutex_lock(&ft4222_lock);
- int bytes_read = mraa_ftdi_ft4222_i2c_context_read(dev, &data, 1);
- pthread_mutex_unlock(&ft4222_lock);
- return bytes_read == 1 ? data : 0;
-}
-
-static uint8_t
-mraa_ftdi_ft4222_i2c_read_byte_data(mraa_i2c_context dev, uint8_t command)
-{
- uint8_t data;
- int bytes_read = 0;
- pthread_mutex_lock(&ft4222_lock);
- uint16 bytesWritten = mraa_ftdi_ft4222_i2c_context_write(dev, &command, 1);
- if (bytesWritten == 1)
- bytes_read = mraa_ftdi_ft4222_i2c_context_read(dev, &data, 1);
- pthread_mutex_unlock(&ft4222_lock);
- return (bytes_read == 1) ? data : 0;
-}
-
-static uint16_t
-mraa_ftdi_ft4222_i2c_read_word_data(mraa_i2c_context dev, uint8_t command)
-{
- uint8_t buf[2];
- uint16_t data;
- int bytes_read = 0;
- pthread_mutex_lock(&ft4222_lock);
- int bytes_written = mraa_ftdi_ft4222_i2c_context_write(dev, &command, 1);
- if (bytes_written == 1)
- bytes_read = mraa_ftdi_ft4222_i2c_context_read(dev, buf, 2);
- pthread_mutex_unlock(&ft4222_lock);
- data = (bytes_read == 2) ? *(uint16_t*)buf : 0;
- return data;
-}
-
-static int
-mraa_ftdi_ft4222_i2c_read_bytes_data(mraa_i2c_context dev, uint8_t command, uint8_t* data, int length)
-{
- int bytes_read = 0;
- pthread_mutex_lock(&ft4222_lock);
- int bytes_written = mraa_ftdi_ft4222_i2c_context_write(dev, &command, 1);
- if (bytes_written == 1)
- bytes_read = mraa_ftdi_ft4222_i2c_context_read(dev, data, length);
- pthread_mutex_unlock(&ft4222_lock);
- return bytes_read;
-}
-
-
-static mraa_result_t
-mraa_ftdi_ft4222_i2c_write(mraa_i2c_context dev, const uint8_t* data, int bytesToWrite)
-{
- pthread_mutex_lock(&ft4222_lock);
- uint16 bytesWritten = mraa_ftdi_ft4222_i2c_context_write(dev, (uint8_t*)data, bytesToWrite);
- pthread_mutex_unlock(&ft4222_lock);
- return bytesToWrite == bytesWritten ? MRAA_SUCCESS : MRAA_ERROR_INVALID_HANDLE;
-}
-
-
-static mraa_result_t
-mraa_ftdi_ft4222_i2c_write_byte(mraa_i2c_context dev, uint8_t data)
-{
- mraa_result_t status = mraa_ftdi_ft4222_i2c_write(dev, &data, 1);
- return status;
-}
-
-
-static mraa_result_t
-mraa_ftdi_ft4222_i2c_write_byte_data(mraa_i2c_context dev, const uint8_t data, const uint8_t command)
-{
- uint8_t buf[2];
- buf[0] = command;
- buf[1] = data;
- mraa_result_t status = mraa_ftdi_ft4222_i2c_write(dev, buf, 2);
- return status;
-}
-
-static mraa_result_t
-mraa_ftdi_ft4222_i2c_write_word_data(mraa_i2c_context dev, const uint16_t data, const uint8_t command)
-{
- uint8_t buf[3];
- buf[0] = command;
- buf[1] = (uint8_t) data;
- buf[2] = (uint8_t)(data >> 8);
- mraa_result_t status = mraa_ftdi_ft4222_i2c_write(dev, buf, 3);
- return status;
-}
-
-static mraa_result_t
-mraa_ftdi_ft4222_i2c_stop(mraa_i2c_context dev)
-{
- return MRAA_SUCCESS;
-}
-
-/******************* GPIO functions *******************/
-
-static mraa_result_t
-mraa_ftdi_ft4222_gpio_init_internal_replace(mraa_gpio_context dev, int pin)
-{
- dev->phy_pin = (pin < numFt4222GpioPins) ? pin : pin - numFt4222GpioPins;
- if (pin < 2) {
- syslog(LOG_NOTICE, "Closing I2C interface to enable GPIO%d\n", pin);
-
- /* Replace with call to SPI init when SPI is fully implemented */
- FT4222_STATUS ft4222Status = dl_FT4222_SPIMaster_Init(ftHandleSpi, SPI_IO_SINGLE, CLK_DIV_4, CLK_IDLE_HIGH, CLK_LEADING, 0x01);
- if (FT4222_OK != ft4222Status){
- syslog(LOG_ERR, "Failed to close I2C interface and start SPI (error %d)!\n", ft4222Status);
- return MRAA_ERROR_NO_RESOURCES;
- }
- }
- return MRAA_SUCCESS;
-}
-
-static mraa_result_t
-mraa_ftdi_ft4222_gpio_mode_replace(mraa_gpio_context dev, mraa_gpio_mode_t mode)
-{
- return MRAA_ERROR_FEATURE_NOT_IMPLEMENTED;
-}
-
-static mraa_result_t
-mraa_ftdi_ft4222_gpio_edge_mode_replace(mraa_gpio_context dev, mraa_gpio_edge_t mode)
-{
- switch (mraa_ftdi_ft4222_get_gpio_type(dev->pin)) {
- case GPIO_TYPE_BUILTIN:
- switch (mode) {
- case MRAA_GPIO_EDGE_NONE:
- return ftdi_ft4222_set_internal_gpio_trigger(dev->pin, 0);
- case MRAA_GPIO_EDGE_BOTH:
- return ftdi_ft4222_set_internal_gpio_trigger(dev->pin, GPIO_TRIGGER_RISING | GPIO_TRIGGER_FALLING);
- case MRAA_GPIO_EDGE_RISING:
- return ftdi_ft4222_set_internal_gpio_trigger(dev->pin, GPIO_TRIGGER_RISING);
- case MRAA_GPIO_EDGE_FALLING:
- return ftdi_ft4222_set_internal_gpio_trigger(dev->pin, GPIO_TRIGGER_FALLING);
- default:
- return MRAA_ERROR_FEATURE_NOT_IMPLEMENTED;
- }
- break;
- case GPIO_TYPE_PCA9672:
- case GPIO_TYPE_PCA9555:
- return MRAA_SUCCESS;
- default:
- return MRAA_ERROR_INVALID_RESOURCE;
- }
-
-}
-
-static mraa_result_t
-mraa_ftdi_ft4222_i2c_read_io_expander(uint16_t* value)
-{
- int bytes_read = 0;
- uint8_t reg = PCA9555_INPUT_REG;
- pthread_mutex_lock(&ft4222_lock);
- switch (gpio_expander_chip) {
- case IO_EXP_PCA9672:
- bytes_read = mraa_ftdi_ft4222_i2c_read_internal(ftHandleI2c, PCA9672_ADDR, (uint8_t*)value, 1);
- break;
- case GPIO_TYPE_PCA9555:
- if (mraa_ftdi_ft4222_i2c_write_internal(ftHandleI2c, PCA9555_ADDR, &reg, 1) == 1)
- bytes_read = mraa_ftdi_ft4222_i2c_read_internal(ftHandleI2c, PCA9555_ADDR, (uint8_t*)value, 2);
- break;
- default:;
- }
- pthread_mutex_unlock(&ft4222_lock);
- return bytes_read > 0 ? MRAA_SUCCESS : MRAA_ERROR_UNSPECIFIED;
-}
-
-static int
-mraa_ftdi_ft4222_gpio_read_replace(mraa_gpio_context dev)
-{
- switch (mraa_ftdi_ft4222_get_gpio_type(dev->pin)) {
- case GPIO_TYPE_BUILTIN:
- {
- BOOL value;
- FT4222_STATUS ft4222Status = dl_FT4222_GPIO_Read(ftHandleGpio, dev->phy_pin, &value);
- if (FT4222_OK != ft4222Status) {
- syslog(LOG_ERR, "FT4222_GPIO_Read failed (error %d)!\n", ft4222Status);
- return -1;
- }
- return value;
- }
- case GPIO_TYPE_PCA9672:
- case GPIO_TYPE_PCA9555:
- {
- uint16_t mask = 1 << dev->phy_pin;
- uint16_t value;
- mraa_result_t res = mraa_ftdi_ft4222_i2c_read_io_expander(&value);
- return res == MRAA_SUCCESS ? (value & mask) == mask : -1;
- }
- default:
- return -1;
- }
-}
-
-
-static mraa_result_t
-mraa_ftdi_ft4222_gpio_write_replace(mraa_gpio_context dev, int write_value)
-{
- switch (mraa_ftdi_ft4222_get_gpio_type(dev->pin)) {
- case GPIO_TYPE_BUILTIN:
- {
- FT4222_STATUS ft4222Status = dl_FT4222_GPIO_Write(ftHandleGpio, dev->phy_pin, write_value);
- if (FT4222_OK != ft4222Status) {
- syslog(LOG_ERR, "FT4222_GPIO_Write failed (error %d)!\n", ft4222Status);
- return MRAA_ERROR_UNSPECIFIED;
- }
- return MRAA_SUCCESS;
- }
- case GPIO_TYPE_PCA9672:
- {
- uint8_t mask = 1 << dev->phy_pin;
- uint8_t value;
- int bytes_written = 0;
- pthread_mutex_lock(&ft4222_lock);
- int bytes_read = mraa_ftdi_ft4222_i2c_read_internal(ftHandleI2c, PCA9672_ADDR, &value, 1);
- if (bytes_read == 1) {
- if (write_value == 1)
- value = value | mask | pca9672DirectionMask;
- else
- value &= (~mask);
- bytes_written = mraa_ftdi_ft4222_i2c_write_internal(ftHandleI2c, PCA9672_ADDR, &value, 1);
- }
- pthread_mutex_unlock(&ft4222_lock);
- return bytes_written == 1 ? MRAA_SUCCESS : MRAA_ERROR_UNSPECIFIED;
- }
- case GPIO_TYPE_PCA9555:
- {
- uint16_t mask = 1 << dev->phy_pin;
- if (write_value)
- pca9555OutputValue |= mask;
- else
- pca9555OutputValue &= (~mask);
- uint8_t buf[3];
- buf[0] = PCA9555_OUTPUT_REG;
- buf[1] = (uint8_t)(pca9555OutputValue & 0xFF);
- buf[2] = (uint8_t)(pca9555OutputValue >> 8);
- pthread_mutex_lock(&ft4222_lock);
- int bytes_written = mraa_ftdi_ft4222_i2c_write_internal(ftHandleI2c, PCA9555_ADDR, buf, sizeof(buf));
- pthread_mutex_unlock(&ft4222_lock);
- return bytes_written == sizeof(buf) ? MRAA_SUCCESS : MRAA_ERROR_UNSPECIFIED;
- }
- default:
- return MRAA_ERROR_INVALID_RESOURCE;
- }
-}
-
-
-static mraa_result_t
-mraa_ftdi_ft4222_gpio_dir_replace(mraa_gpio_context dev, mraa_gpio_dir_t dir)
-{
- switch (mraa_ftdi_ft4222_get_gpio_type(dev->pin)) {
- case GPIO_TYPE_BUILTIN:
- switch (dir) {
- case MRAA_GPIO_IN:
- return ftdi_ft4222_set_internal_gpio_dir(dev->phy_pin, GPIO_INPUT);
- case MRAA_GPIO_OUT:
- return ftdi_ft4222_set_internal_gpio_dir(dev->phy_pin, GPIO_OUTPUT);
- case MRAA_GPIO_OUT_HIGH:
- if (ftdi_ft4222_set_internal_gpio_dir(dev->phy_pin, GPIO_OUTPUT) != MRAA_SUCCESS)
- return MRAA_ERROR_UNSPECIFIED;
- return mraa_ftdi_ft4222_gpio_write_replace(dev, 1);
- case MRAA_GPIO_OUT_LOW:
- if (ftdi_ft4222_set_internal_gpio_dir(dev->phy_pin, GPIO_OUTPUT) != MRAA_SUCCESS)
- return MRAA_ERROR_UNSPECIFIED;
- return mraa_ftdi_ft4222_gpio_write_replace(dev, 0);
- default:
- return MRAA_ERROR_INVALID_PARAMETER;
- }
- case GPIO_TYPE_PCA9672:
- switch (dir) {
- case MRAA_GPIO_IN:
- case MRAA_GPIO_OUT:
- return mraa_ftdi_ft4222_gpio_set_pca9672_dir(dev->phy_pin, dir);
- case MRAA_GPIO_OUT_HIGH:
- if (mraa_ftdi_ft4222_gpio_set_pca9672_dir(dev->phy_pin, dir) != MRAA_SUCCESS)
- return MRAA_ERROR_UNSPECIFIED;
- return mraa_ftdi_ft4222_gpio_write_replace(dev, 1);
- case MRAA_GPIO_OUT_LOW:
- if (mraa_ftdi_ft4222_gpio_set_pca9672_dir(dev->phy_pin, dir) != MRAA_SUCCESS)
- return MRAA_ERROR_UNSPECIFIED;
- return mraa_ftdi_ft4222_gpio_write_replace(dev, 0);
- default:
- return MRAA_ERROR_INVALID_PARAMETER;
- }
- case GPIO_TYPE_PCA9555:
- switch (dir) {
- case MRAA_GPIO_IN:
- case MRAA_GPIO_OUT:
- return mraa_ftdi_ft4222_gpio_set_pca9555_dir(dev->phy_pin, dir);
- case MRAA_GPIO_OUT_HIGH:
- if (mraa_ftdi_ft4222_gpio_set_pca9555_dir(dev->phy_pin, dir) != MRAA_SUCCESS)
- return MRAA_ERROR_UNSPECIFIED;
- return mraa_ftdi_ft4222_gpio_write_replace(dev, 1);
- case MRAA_GPIO_OUT_LOW:
- if (mraa_ftdi_ft4222_gpio_set_pca9555_dir(dev->phy_pin, dir) != MRAA_SUCCESS)
- return MRAA_ERROR_UNSPECIFIED;
- return mraa_ftdi_ft4222_gpio_write_replace(dev, 0);
- default:
- return MRAA_ERROR_INVALID_PARAMETER;
- }
- default:
- return MRAA_ERROR_INVALID_RESOURCE;
- }
-}
-
-static mraa_boolean_t
-mraa_ftdi_ft4222_has_internal_gpio_triggered(int pin)
-{
- uint16 num_events = 0;
- FT4222_STATUS ft4222Status = dl_FT4222_GPIO_GetTriggerStatus(ftHandleGpio, pin, &num_events);
- if (num_events > 0) {
- int i;
- uint16 num_events_read;
- GPIO_Trigger event;
- for (i = 0; i < num_events; ++i)
- dl_FT4222_GPIO_ReadTriggerQueue(ftHandleGpio, pin, &event, 1, &num_events_read);
- return TRUE;
- } else
- return FALSE;
-}
-
-static struct {
- pthread_t thread;
- pthread_mutex_t mutex;
- mraa_boolean_t should_stop;
- mraa_boolean_t is_interrupt_detected[MAX_IO_EXPANDER_PINS];
- int num_active_pins;
-} gpio_monitor = {0};
-
-// INT pin of i2c PCA9672 GPIO expander is connected to FT4222 GPIO #3
-// We use INT to detect any expander GPIO level change
-static void*
-mraa_ftdi_ft4222_gpio_monitor(void *arg)
-{
- uint16_t prev_value = 0;
- mraa_ftdi_ft4222_i2c_read_io_expander(&prev_value);
- while (!gpio_monitor.should_stop) {
- mraa_boolean_t gpio_activity_detected = mraa_ftdi_ft4222_has_internal_gpio_triggered(GPIO_PORT_IO_INT);
- if (gpio_activity_detected) {
- uint16_t value;
- if (mraa_ftdi_ft4222_i2c_read_io_expander(&value) == MRAA_SUCCESS) {
- uint16_t change_value = prev_value ^ value;
- int i;
- pthread_mutex_lock(&gpio_monitor.mutex);
- for (i = 0; i < MAX_IO_EXPANDER_PINS; ++i) {
- uint16_t mask = 1 << i;
- gpio_monitor.is_interrupt_detected[i] = change_value & mask ? 1 : 0;
- }
- pthread_mutex_unlock(&gpio_monitor.mutex);
- prev_value = value;
- }
- }
- mraa_ftdi_ft4222_sleep_ms(20);
- }
-}
-
-
-static void
-mraa_ftdi_ft4222_gpio_monitor_add_pin(int pin)
-{
- if (gpio_monitor.num_active_pins == 0) {
- pthread_mutex_init(&gpio_monitor.mutex, NULL);
- pthread_create(&gpio_monitor.thread, NULL, mraa_ftdi_ft4222_gpio_monitor, NULL);
- }
- pthread_mutex_lock(&gpio_monitor.mutex);
- gpio_monitor.num_active_pins++;
- pthread_mutex_unlock(&gpio_monitor.mutex);
-}
-
-
-static void
-mraa_ftdi_ft4222_gpio_monitor_remove_pin(int pin)
-{
- pthread_mutex_lock(&gpio_monitor.mutex);
- gpio_monitor.num_active_pins--;
- if (gpio_monitor.num_active_pins == 0) {
- pthread_mutex_unlock(&gpio_monitor.mutex);
- gpio_monitor.should_stop = TRUE;
- pthread_join(gpio_monitor.thread, NULL);
- pthread_mutex_destroy(&gpio_monitor.mutex);
- } else
- pthread_mutex_unlock(&gpio_monitor.mutex);
-}
-
-
-static mraa_boolean_t
-mraa_ftdi_ft4222_gpio_monitor_is_interrupt_detected(int pin)
-{
- mraa_boolean_t is_interrupt_detected = FALSE;
- pthread_mutex_lock(&gpio_monitor.mutex);
- if (gpio_monitor.is_interrupt_detected[pin]) {
- gpio_monitor.is_interrupt_detected[pin] = FALSE;
- is_interrupt_detected = TRUE;
- }
- pthread_mutex_unlock(&gpio_monitor.mutex);
- return is_interrupt_detected;
-}
-
-static mraa_result_t
-mraa_ftdi_ft4222_gpio_interrupt_handler_init_replace(mraa_gpio_context dev)
-{
- switch (mraa_ftdi_ft4222_get_gpio_type(dev->pin)) {
- case GPIO_TYPE_BUILTIN:
- mraa_ftdi_ft4222_has_internal_gpio_triggered(dev->phy_pin);
- break;
- case GPIO_TYPE_PCA9672:
- case GPIO_TYPE_PCA9555:
- ftdi_ft4222_set_internal_gpio_dir(GPIO_PORT_IO_INT, GPIO_INPUT);
- ftdi_ft4222_set_internal_gpio_trigger(GPIO_PORT_IO_INT, GPIO_TRIGGER_FALLING);
- mraa_ftdi_ft4222_has_internal_gpio_triggered(GPIO_PORT_IO_INT);
- mraa_ftdi_ft4222_gpio_monitor_add_pin(dev->phy_pin);
- break;
- }
- return MRAA_SUCCESS;
-}
-
-static mraa_result_t
-mraa_ftdi_ft4222_gpio_wait_interrupt_replace(mraa_gpio_context dev)
-{
- int prev_level = mraa_ftdi_ft4222_gpio_read_replace(dev);
- ft4222_gpio_type gpio_type = mraa_ftdi_ft4222_get_gpio_type(dev->pin);
- mraa_boolean_t interrupt_detected = FALSE;
-
- while (!dev->isr_thread_terminating && !interrupt_detected) {
- switch (gpio_type) {
- case GPIO_TYPE_BUILTIN:
- interrupt_detected = mraa_ftdi_ft4222_has_internal_gpio_triggered(dev->phy_pin);
- break;
- case GPIO_TYPE_PCA9672:
- case GPIO_TYPE_PCA9555:
- interrupt_detected = mraa_ftdi_ft4222_gpio_monitor_is_interrupt_detected(dev->phy_pin);
- break;
- default:;
- }
- if (!interrupt_detected)
- mraa_ftdi_ft4222_sleep_ms(20);
- }
- if (dev->isr_thread_terminating)
- mraa_ftdi_ft4222_gpio_monitor_remove_pin(dev->phy_pin);
- return MRAA_SUCCESS;
-}
-
-static void
-mraa_ftdi_ft4222_populate_i2c_func_table(mraa_adv_func_t* func_table)
-{
- func_table->i2c_init_bus_replace = &mraa_ftdi_ft4222_i2c_init_bus_replace;
- func_table->i2c_set_frequency_replace = &mraa_ftdi_ft4222_i2c_frequency;
- func_table->i2c_address_replace = &mraa_ftdi_ft4222_i2c_address;
- func_table->i2c_read_replace = &mraa_ftdi_ft4222_i2c_read;
- func_table->i2c_read_byte_replace = &mraa_ftdi_ft4222_i2c_read_byte;
- func_table->i2c_read_byte_data_replace = &mraa_ftdi_ft4222_i2c_read_byte_data;
- func_table->i2c_read_word_data_replace = &mraa_ftdi_ft4222_i2c_read_word_data;
- func_table->i2c_read_bytes_data_replace = &mraa_ftdi_ft4222_i2c_read_bytes_data;
- func_table->i2c_write_replace = &mraa_ftdi_ft4222_i2c_write;
- func_table->i2c_write_byte_replace = &mraa_ftdi_ft4222_i2c_write_byte;
- func_table->i2c_write_byte_data_replace = &mraa_ftdi_ft4222_i2c_write_byte_data;
- func_table->i2c_write_word_data_replace = &mraa_ftdi_ft4222_i2c_write_word_data;
- func_table->i2c_stop_replace = &mraa_ftdi_ft4222_i2c_stop;
-}
-
-static void
-mraa_ftdi_ft4222_populate_gpio_func_table(mraa_adv_func_t* func_table)
-{
- func_table->gpio_init_internal_replace = &mraa_ftdi_ft4222_gpio_init_internal_replace;
- func_table->gpio_mode_replace = &mraa_ftdi_ft4222_gpio_mode_replace;
- func_table->gpio_edge_mode_replace = &mraa_ftdi_ft4222_gpio_edge_mode_replace;
- func_table->gpio_dir_replace = &mraa_ftdi_ft4222_gpio_dir_replace;
- func_table->gpio_read_replace = &mraa_ftdi_ft4222_gpio_read_replace;
- func_table->gpio_write_replace = &mraa_ftdi_ft4222_gpio_write_replace;
- func_table->gpio_interrupt_handler_init_replace = &mraa_ftdi_ft4222_gpio_interrupt_handler_init_replace;
- func_table->gpio_wait_interrupt_replace = &mraa_ftdi_ft4222_gpio_wait_interrupt_replace;
-}
-
-
-mraa_board_t*
-mraa_ftdi_ft4222()
-{
- mraa_board_t* sub_plat = (mraa_board_t*) calloc(1, sizeof(mraa_board_t));
- if (sub_plat == NULL)
- return NULL;
- numI2cGpioExpanderPins = mraa_ftdi_ft4222_detect_io_expander();
- int pinIndex = 0;
- int numUsbGpio = numFt4222GpioPins + numI2cGpioExpanderPins;
- int numI2cBusses = 1 + mraa_ftdi_ft4222_detect_i2c_switch();
- int numUsbPins = numUsbGpio + 2 * (numI2cBusses-1); // Add SDA and SCL for each i2c switch bus
- mraa_pincapabilities_t pinCapsI2c = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 1, 0, 0 };
- mraa_pincapabilities_t pinCapsI2cGpio = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 1, 0, 0 };
- mraa_pincapabilities_t pinCapsGpio = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
-
- sub_plat->platform_name = PLATFORM_NAME;
- sub_plat->phy_pin_count = numUsbPins;
- sub_plat->gpio_count = numUsbGpio;
- mraa_pininfo_t* pins = (mraa_pininfo_t*) calloc(numUsbPins,sizeof(mraa_pininfo_t));
- if (pins == NULL) {
- return NULL;
- }
- sub_plat->pins = pins;
-
- int bus = 0;
- sub_plat->i2c_bus_count = numI2cBusses;
- sub_plat->def_i2c_bus = bus;
- sub_plat->i2c_bus[bus].bus_id = bus;
-
- // I2c pins (these are virtual, entries are required to configure i2c layer)
- // We currently assume that GPIO 0/1 are reserved for i2c operation
- strncpy(sub_plat->pins[pinIndex].name, "IGPIO0/SCL0", MRAA_PIN_NAME_SIZE);
- sub_plat->pins[pinIndex].capabilites = pinCapsI2cGpio;
- sub_plat->pins[pinIndex].gpio.pinmap = pinIndex;
- sub_plat->pins[pinIndex].gpio.mux_total = 0;
- sub_plat->pins[pinIndex].i2c.mux_total = 0;
- sub_plat->i2c_bus[bus].scl = pinIndex;
- pinIndex++;
- strncpy(sub_plat->pins[pinIndex].name, "IGPIO1/SDA0", MRAA_PIN_NAME_SIZE);
- sub_plat->pins[pinIndex].capabilites = pinCapsI2cGpio;
- sub_plat->pins[pinIndex].gpio.pinmap = pinIndex;
- sub_plat->pins[pinIndex].gpio.mux_total = 0;
- sub_plat->pins[pinIndex].i2c.mux_total = 0;
- sub_plat->i2c_bus[bus].sda = pinIndex;
- pinIndex++;
-
- // FTDI4222 gpio
- strncpy(sub_plat->pins[pinIndex].name, "INT-GPIO2", MRAA_PIN_NAME_SIZE);
- sub_plat->pins[pinIndex].capabilites = pinCapsGpio;
- sub_plat->pins[pinIndex].gpio.pinmap = pinIndex;
- sub_plat->pins[pinIndex].gpio.mux_total = 0;
- pinIndex++;
- strncpy(sub_plat->pins[pinIndex].name, "INT-GPIO3", MRAA_PIN_NAME_SIZE);
- sub_plat->pins[pinIndex].capabilites = pinCapsGpio;
- sub_plat->pins[pinIndex].gpio.pinmap = pinIndex;
- sub_plat->pins[pinIndex].gpio.mux_total = 0;
- pinIndex++;
-
- // Virtual gpio pins on i2c I/O expander.
- int i;
- for (i = 0; i < numI2cGpioExpanderPins; ++i) {
- snprintf(sub_plat->pins[pinIndex].name, MRAA_PIN_NAME_SIZE, "EXP-GPIO%d", i);
- sub_plat->pins[pinIndex].capabilites = pinCapsGpio;
- sub_plat->pins[pinIndex].gpio.pinmap = pinIndex;
- sub_plat->pins[pinIndex].gpio.mux_total = 0;
- pinIndex++;
- }
-
- // Now add any extra i2c busses behind i2c switch
- for (bus = 1; bus < numI2cBusses; ++bus) {
- sub_plat->i2c_bus[bus].bus_id = bus;
- sub_plat->pins[pinIndex].i2c.mux_total = 0;
- snprintf(sub_plat->pins[pinIndex].name, MRAA_PIN_NAME_SIZE, "SDA%d", bus);
- sub_plat->pins[pinIndex].capabilites = pinCapsI2c;
- sub_plat->i2c_bus[bus].sda = pinIndex;
- pinIndex++;
- snprintf(sub_plat->pins[pinIndex].name, MRAA_PIN_NAME_SIZE, "SCL%d", bus);
- sub_plat->pins[pinIndex].capabilites = pinCapsI2c;
- sub_plat->pins[pinIndex].i2c.mux_total = 0;
- sub_plat->i2c_bus[bus].scl = pinIndex;
- pinIndex++;
- }
-
- // Set override functions
- mraa_adv_func_t* func_table = (mraa_adv_func_t*) calloc(1, sizeof(mraa_adv_func_t));
- if (func_table == NULL) {
- return NULL;
- }
- mraa_ftdi_ft4222_populate_i2c_func_table(func_table);
- mraa_ftdi_ft4222_populate_gpio_func_table(func_table);
-
- sub_plat->adv_func = func_table;
-
- if (pthread_mutex_init(&ft4222_lock, NULL) != 0) {
- syslog(LOG_ERR, "Could not create mutex for FT4222 access");
- return NULL;
- }
-
- return sub_plat;
-}
-
diff --git a/peripheral/libmraa/src/usb/usb.c b/peripheral/libmraa/src/usb/usb.c
deleted file mode 100644
index 363bfd1..0000000
--- a/peripheral/libmraa/src/usb/usb.c
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Author: Henry Bruce <henry.bruce@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 <stdlib.h>
-#include <string.h>
-
-#include "mraa_internal.h"
-#ifdef FTDI4222
-#include "usb/ftdi_ft4222.h"
-#endif
-
-
-mraa_platform_t
-mraa_usb_platform_extender(mraa_board_t* board)
-{
- mraa_board_t* sub_plat = NULL;
- mraa_platform_t platform_type = MRAA_UNKNOWN_PLATFORM;
-
-#ifdef FTDI4222
- libft4222_lib = dlopen("libft4222.so", RTLD_LAZY);
- if (!libft4222_lib) {
- syslog(LOG_WARNING, "libft4222.so not found, skipping");
- } else {
- if (mraa_ftdi_ft4222_init() == MRAA_SUCCESS) {
- unsigned int versionChip, versionLib;
- if (mraa_ftdi_ft4222_get_version(&versionChip, &versionLib) == MRAA_SUCCESS) {
- // TODO: Add ft4222 version checks
- platform_type = MRAA_FTDI_FT4222;
- }
- }
- }
-#endif
- switch (platform_type) {
-#ifdef FTDI4222
- case MRAA_FTDI_FT4222:
- sub_plat = mraa_ftdi_ft4222();
- break;
-#endif
- default:
- // this is not an error but more that we didn't find a USB platform extender we recognise
- syslog(LOG_DEBUG, "Unknown USB Platform Extender, currently not supported by MRAA");
- }
-
- if (sub_plat != NULL) {
- sub_plat->platform_type = platform_type;
- board->sub_platform = sub_plat;
- }
- return platform_type;
-}
diff --git a/peripheral/libmraa/src/x86/CMakeLists.txt b/peripheral/libmraa/src/x86/CMakeLists.txt
deleted file mode 100644
index c0f8c50..0000000
--- a/peripheral/libmraa/src/x86/CMakeLists.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-message (INFO " - Adding x86 platforms")
-set (mraa_LIB_PLAT_SRCS_NOAUTO ${mraa_LIB_SRCS_NOAUTO}
- ${mraa_LIB_X86_SRCS_NOAUTO} PARENT_SCOPE)
diff --git a/peripheral/libmraa/src/x86/intel_cherryhills.c b/peripheral/libmraa/src/x86/intel_cherryhills.c
deleted file mode 100644
index b797c94..0000000
--- a/peripheral/libmraa/src/x86/intel_cherryhills.c
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Author: Karena Anum Kamaruzaman <karena.anum.kamaruzaman@intel.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 <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-#include "common.h"
-#include "x86/intel_cherryhills.h"
-
-#define PLATFORM_NAME "Braswell Cherry Hill"
-
-mraa_board_t*
-mraa_intel_cherryhills()
-{
- mraa_board_t* b = (mraa_board_t*) calloc(1, sizeof(mraa_board_t));
- if (b == NULL) {
- return NULL;
- }
-
- b->platform_name = PLATFORM_NAME;
- b->phy_pin_count = MRAA_INTEL_CHERRYHILLS_PINCOUNT;
- b->aio_count = 0;
- b->adc_raw = 0;
- b->adc_supported = 0;
-
- b->pins = (mraa_pininfo_t*) malloc(sizeof(mraa_pininfo_t) * MRAA_INTEL_CHERRYHILLS_PINCOUNT);
- if (b->pins == NULL) {
- goto error;
- }
-
- b->adv_func = (mraa_adv_func_t*) calloc(1, sizeof(mraa_adv_func_t));
- if (b->adv_func == NULL) {
- free(b->pins);
- goto error;
- }
-
- int pos = 0;
- //Physical header where these pins are: J3E5
- strncpy(b->pins[pos].name, "GSUS6", 8);
- b->pins[pos].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[pos].gpio.pinmap = 416;
- b->pins[pos].gpio.mux_total = 0;
- pos++;
-
- strncpy(b->pins[pos].name, "GSUS8", 8);
- b->pins[pos].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[pos].gpio.pinmap = 409;
- b->pins[pos].gpio.mux_total = 0;
- pos++;
-
- strncpy(b->pins[pos].name, "GSUS7", 8);
- b->pins[pos].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[pos].gpio.pinmap = 414;
- b->pins[pos].gpio.mux_total = 0;
- pos++;
-
- //Physical header where these pins are: J3E3
- strncpy(b->pins[pos].name, "GSUS0", 8);
- b->pins[pos].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[pos].gpio.pinmap = 406;
- b->pins[pos].gpio.mux_total = 0;
- pos++;
-
- strncpy(b->pins[pos].name, "GSUS1", 8);
- b->pins[pos].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[pos].gpio.pinmap = 410;
- b->pins[pos].gpio.mux_total = 0;
- pos++;
-
- return b;
-error:
- syslog(LOG_CRIT, "Cherryhills(Braswell): Platform failed to initialise");
- free(b);
- return NULL;
-}
diff --git a/peripheral/libmraa/src/x86/intel_de3815.c b/peripheral/libmraa/src/x86/intel_de3815.c
deleted file mode 100644
index ad7c7d3..0000000
--- a/peripheral/libmraa/src/x86/intel_de3815.c
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-#include "common.h"
-#include "x86/intel_de3815.h"
-
-#define PLATFORM_NAME "Intel DE3815"
-#define SYSFS_CLASS_GPIO "/sys/class/gpio"
-#define I2CNAME "designware"
-
-mraa_board_t*
-mraa_intel_de3815()
-{
- mraa_board_t* b = (mraa_board_t*) calloc(1, sizeof(mraa_board_t));
- if (b == NULL) {
- return NULL;
- }
-
- b->platform_name = PLATFORM_NAME;
- b->phy_pin_count = MRAA_INTEL_DE3815_PINCOUNT;
- b->aio_count = 0;
- b->adc_raw = 0;
- b->adc_supported = 0;
- b->pwm_default_period = 500;
- b->pwm_max_period = 2147483;
- b->pwm_min_period = 1;
-
- b->pins = (mraa_pininfo_t*) calloc(MRAA_INTEL_DE3815_PINCOUNT,sizeof(mraa_pininfo_t));
- if (b->pins == NULL) {
- goto error;
- }
-
- b->adv_func = (mraa_adv_func_t*) calloc(1, sizeof(mraa_adv_func_t));
- if (b->adv_func == NULL) {
- free(b->pins);
- goto error;
- }
-
- strncpy(b->pins[0].name, "1.8v", 8);
- b->pins[0].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
-
- strncpy(b->pins[1].name, "GND", 8);
- b->pins[1].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- strncpy(b->pins[2].name, "HDMIcec", 8);
- b->pins[2].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- strncpy(b->pins[3].name, "DMICclk", 8);
- b->pins[3].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- strncpy(b->pins[4].name, "3.3v", 8);
- b->pins[4].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- strncpy(b->pins[5].name, "DMICda", 8);
- b->pins[5].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- strncpy(b->pins[6].name, "Key", 8);
- b->pins[6].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- strncpy(b->pins[7].name, "SMB-A", 8);
- b->pins[7].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- strncpy(b->pins[8].name, "5v", 8);
- b->pins[8].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- strncpy(b->pins[9].name, "SCI", 8);
- b->pins[9].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
-
- strncpy(b->pins[10].name, "PWM0", 8);
- b->pins[10].capabilites = (mraa_pincapabilities_t){ 1, 0, 1, 0, 0, 0, 0, 0 };
- b->pins[10].pwm.pinmap = 0;
- b->pins[10].pwm.parent_id = 0;
- b->pins[10].pwm.mux_total = 0;
-
- strncpy(b->pins[11].name, "PWM1", 8);
- b->pins[11].capabilites = (mraa_pincapabilities_t){ 1, 0, 1, 0, 0, 0, 0, 0 };
- b->pins[11].pwm.pinmap = 0;
- b->pins[11].pwm.parent_id = 1;
- b->pins[11].pwm.mux_total = 0;
-
- strncpy(b->pins[12].name, "I2C0SCL", 8);
- b->pins[12].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 1, 0, 0 };
- b->pins[12].i2c.pinmap = 1;
- b->pins[12].i2c.mux_total = 0;
-
- strncpy(b->pins[13].name, "I2C0SDA", 8);
- b->pins[13].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 1, 0, 0 };
- b->pins[13].i2c.pinmap = 1;
- b->pins[13].i2c.mux_total = 0;
-
- strncpy(b->pins[14].name, "I2C1SCL", 8);
- b->pins[14].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 1, 0, 0 };
- b->pins[14].i2c.pinmap = 1;
- b->pins[14].i2c.mux_total = 0;
-
- strncpy(b->pins[15].name, "I2C1SDA", 8);
- b->pins[15].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 1, 0, 0 };
- b->pins[15].i2c.pinmap = 1;
- b->pins[15].i2c.mux_total = 0;
-
- strncpy(b->pins[16].name, "SMB_CLK", 8);
- b->pins[16].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- strncpy(b->pins[17].name, "SMB_SDA", 8);
- b->pins[17].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
-
- b->i2c_bus_count = 0;
- int i2c_num = -1;
- int i;
- for (i = 0; i < 2; i++) {
- i2c_num = mraa_find_i2c_bus(I2CNAME, i2c_num + 1);
- if (i2c_num == -1) {
- break;
- }
- b->i2c_bus_count++;
- b->i2c_bus[i].bus_id = i2c_num;
- b->i2c_bus[i].sda = 12 + i;
- b->i2c_bus[i].scl = 13 + i;
- }
-
- if (b->i2c_bus_count > 0) {
- b->def_i2c_bus = b->i2c_bus[0].bus_id;
- }
-
-
- b->spi_bus_count = 1;
- b->def_spi_bus = 0;
- b->spi_bus[0].bus_id = 1;
- b->spi_bus[0].slave_s = 0;
- b->spi_bus[0].cs = 10;
- b->spi_bus[0].mosi = 11;
- b->spi_bus[0].miso = 12;
- b->spi_bus[0].sclk = 13;
-
- b->uart_dev_count = 0;
-
- return b;
-error:
- syslog(LOG_CRIT, "de3815: Platform failed to initialise");
- free(b);
- return NULL;
-}
diff --git a/peripheral/libmraa/src/x86/intel_edison_fab_c.c b/peripheral/libmraa/src/x86/intel_edison_fab_c.c
deleted file mode 100644
index 643616b..0000000
--- a/peripheral/libmraa/src/x86/intel_edison_fab_c.c
+++ /dev/null
@@ -1,1613 +0,0 @@
-/*
- * Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
- * Brendan Le Foll <brendan.le.foll@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.
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <sys/mman.h>
-#include <sys/ioctl.h>
-#include <linux/spi/spidev.h>
-#include <errno.h>
-
-#include "common.h"
-#include "x86/intel_edison_fab_c.h"
-
-#define PLATFORM_NAME "Intel Edison"
-#define SYSFS_CLASS_GPIO "/sys/class/gpio"
-#define DEBUGFS_PINMODE_PATH "/sys/kernel/debug/gpio_debug/gpio"
-#define MAX_SIZE 64
-#define MAX_MODE_SIZE 8
-
-// This is an absolute path to a resource file found within sysfs.
-// Might not always be correct. First thing to check if mmap stops
-// working. Check the device for 0x1199 and Intel Vendor (0x8086)
-#define MMAP_PATH "/sys/devices/pci0000:00/0000:00:0c.0/resource0"
-#define UART_DEV_PATH "/dev/ttyMFD1"
-
-typedef struct {
- int sysfs;
- int mode;
-} mraa_intel_edision_pindef_t;
-
-typedef struct {
- mraa_intel_edision_pindef_t gpio;
- mraa_intel_edision_pindef_t pwm;
- mraa_intel_edision_pindef_t i2c;
- mraa_intel_edision_pindef_t spi;
- mraa_intel_edision_pindef_t uart;
-} mraa_intel_edison_pinmodes_t;
-
-static mraa_gpio_context tristate;
-
-static mraa_intel_edison_pinmodes_t pinmodes[MRAA_INTEL_EDISON_PINCOUNT];
-static unsigned int outputen[] = { 248, 249, 250, 251, 252, 253, 254, 255, 256, 257,
- 258, 259, 260, 261, 232, 233, 234, 235, 236, 237 };
-static mraa_gpio_context agpioOutputen[sizeof(outputen) / sizeof(outputen[0])];
-
-static unsigned int pullup_map[] = { 216, 217, 218, 219, 220, 221, 222, 223, 224, 225,
- 226, 227, 228, 229, 208, 209, 210, 211, 212, 213 };
-static int miniboard = 0;
-
-// MMAP
-static uint8_t* mmap_reg = NULL;
-static int mmap_fd = 0;
-static int mmap_size;
-static unsigned int mmap_count = 0;
-
-mraa_result_t
-mraa_intel_edison_spi_lsbmode_replace(mraa_spi_context dev, mraa_boolean_t lsb)
-{
- uint8_t lsb_mode = (uint8_t) lsb;
-
- // Edison doesn't support LSB_FIRST, we need to react appropriately
- if (!lsb) {
- if (ioctl(dev->devfd, SPI_IOC_WR_LSB_FIRST, &lsb_mode) < 0) {
- syslog(LOG_ERR, "spi: Failed to set bit order");
- return MRAA_ERROR_INVALID_RESOURCE;
- }
- if (ioctl(dev->devfd, SPI_IOC_RD_LSB_FIRST, &lsb_mode) < 0) {
- syslog(LOG_ERR, "spi: Failed to set bit order");
- return MRAA_ERROR_INVALID_RESOURCE;
- }
- } else {
- return MRAA_ERROR_FEATURE_NOT_SUPPORTED;
- }
-
- dev->lsb = lsb;
- return MRAA_SUCCESS;
-}
-
-static mraa_result_t
-mraa_intel_edison_pinmode_change(int sysfs, int mode)
-{
- if (mode < 0) {
- return MRAA_SUCCESS;
- }
-
- char buffer[MAX_SIZE];
- int useDebugFS = 0;
-
- mraa_gpio_context mode_gpio = mraa_gpio_init_raw(sysfs);
- if (mode_gpio == NULL) {
- return MRAA_ERROR_NO_RESOURCES;
- }
-
- // first try SYSFS_CLASS_GPIO path
- snprintf(buffer, MAX_SIZE, SYSFS_CLASS_GPIO "/gpio%i/pinmux", sysfs);
- int modef = open(buffer, O_WRONLY);
- if (modef == -1) {
- snprintf(buffer, MAX_SIZE, DEBUGFS_PINMODE_PATH "%i/current_pinmux", sysfs);
- modef = open(buffer, O_WRONLY);
- useDebugFS = 1;
- }
-
- if (modef == -1) {
- syslog(LOG_ERR, "edison: Failed to open SoC pinmode for opening");
- mraa_gpio_close(mode_gpio);
- return MRAA_ERROR_INVALID_RESOURCE;
- }
-
- mraa_result_t ret = MRAA_SUCCESS;
- char mode_buf[MAX_MODE_SIZE];
- int length = snprintf(mode_buf, MAX_MODE_SIZE, "%s%u", useDebugFS ? "mode" : "", mode);
- if (write(modef, mode_buf, length * sizeof(char)) == -1) {
- ret = MRAA_ERROR_INVALID_RESOURCE;
- }
- close(modef);
- mraa_gpio_close(mode_gpio);
-
- return ret;
-}
-
-mraa_result_t
-mraa_intel_edison_gpio_dir_pre(mraa_gpio_context dev, mraa_gpio_dir_t dir)
-{
-
- if (dev->phy_pin >= 0) {
- if (mraa_gpio_write(tristate, 0) != MRAA_SUCCESS) {
- // call can sometimes fail, this does not actually mean much except
- // that the kernel drivers don't always behave very well
- syslog(LOG_NOTICE, "edison: Failed to write to tristate");
- }
- int pin = dev->phy_pin;
-
- if (!agpioOutputen[pin]) {
- agpioOutputen[pin] = mraa_gpio_init_raw(outputen[pin]);
- if (agpioOutputen[pin] == NULL) {
- return MRAA_ERROR_INVALID_RESOURCE;
- }
- if (mraa_gpio_dir(agpioOutputen[pin], MRAA_GPIO_OUT) != MRAA_SUCCESS) {
- return MRAA_ERROR_INVALID_RESOURCE;
- }
- }
- int output_val = 0;
- if (dir == MRAA_GPIO_OUT) {
- output_val = 1;
- }
- if (mraa_gpio_write(agpioOutputen[pin], output_val) != MRAA_SUCCESS) {
- return MRAA_ERROR_INVALID_RESOURCE;
- }
- }
-
- return MRAA_SUCCESS;
-}
-
-mraa_result_t
-mraa_intel_edison_gpio_dir_post(mraa_gpio_context dev, mraa_gpio_dir_t dir)
-{
- if (dev->phy_pin >= 0) {
- return mraa_gpio_write(tristate, 1);
- }
- return MRAA_SUCCESS;
-}
-
-mraa_result_t
-mraa_intel_edison_gpio_init_post(mraa_gpio_context dev)
-{
- if (dev == NULL) {
- return MRAA_ERROR_INVALID_RESOURCE;
- }
-
- int sysfs, mode;
- if (miniboard == 1) {
- sysfs = dev->pin;
- mode = 0;
- } else {
- sysfs = pinmodes[dev->phy_pin].gpio.sysfs;
- mode = pinmodes[dev->phy_pin].gpio.mode;
- }
-
- return mraa_intel_edison_pinmode_change(sysfs, mode);
-}
-
-mraa_result_t
-mraa_intel_edison_gpio_close_pre(mraa_gpio_context dev)
-{
- if (dev->phy_pin >= 0) {
- int pin = dev->phy_pin;
- if (agpioOutputen[pin]) {
- mraa_gpio_close(agpioOutputen[pin]);
- agpioOutputen[pin] = NULL;
- }
- }
- return MRAA_SUCCESS;
-}
-
-mraa_result_t
-mraa_intel_edison_i2c_init_pre(unsigned int bus)
-{
- if (miniboard == 0) {
- if (bus != 6) {
- syslog(LOG_ERR, "edison: You can't use that bus, switching to bus 6");
- bus = 6;
- }
- mraa_gpio_write(tristate, 0);
- mraa_gpio_context io18_gpio = mraa_gpio_init_raw(14);
- mraa_gpio_context io19_gpio = mraa_gpio_init_raw(165);
- mraa_gpio_dir(io18_gpio, MRAA_GPIO_IN);
- mraa_gpio_dir(io19_gpio, MRAA_GPIO_IN);
- mraa_gpio_close(io18_gpio);
- mraa_gpio_close(io19_gpio);
-
- mraa_gpio_context io18_enable = mraa_gpio_init_raw(236);
- mraa_gpio_context io19_enable = mraa_gpio_init_raw(237);
- mraa_gpio_dir(io18_enable, MRAA_GPIO_OUT);
- mraa_gpio_dir(io19_enable, MRAA_GPIO_OUT);
- mraa_gpio_write(io18_enable, 0);
- mraa_gpio_write(io19_enable, 0);
- mraa_gpio_close(io18_enable);
- mraa_gpio_close(io19_enable);
-
- mraa_gpio_context io18_pullup = mraa_gpio_init_raw(212);
- mraa_gpio_context io19_pullup = mraa_gpio_init_raw(213);
- mraa_gpio_dir(io18_pullup, MRAA_GPIO_IN);
- mraa_gpio_dir(io19_pullup, MRAA_GPIO_IN);
- mraa_gpio_close(io18_pullup);
- mraa_gpio_close(io19_pullup);
-
- mraa_intel_edison_pinmode_change(28, 1);
- mraa_intel_edison_pinmode_change(27, 1);
-
- mraa_gpio_write(tristate, 1);
- } else {
- if (bus != 6 && bus != 1) {
- syslog(LOG_ERR, "edison: You can't use that bus, switching to bus 6");
- bus = 6;
- }
- int scl = plat->pins[plat->i2c_bus[bus].scl].gpio.pinmap;
- int sda = plat->pins[plat->i2c_bus[bus].sda].gpio.pinmap;
- mraa_intel_edison_pinmode_change(sda, 1);
- mraa_intel_edison_pinmode_change(scl, 1);
- }
-
- return MRAA_SUCCESS;
-}
-
-static mraa_result_t
-mraa_intel_edison_misc_spi()
-{
- // These arrays must have same length
- static const int gpio_pin_list[] = {263, 240, 262, 241, 242, 243};
- static int pin_num = sizeof(gpio_pin_list) / sizeof(int);
- static const int gpio_val_list[] = {1, 0, 1, 0, 0, 0};
- static const int gpio_dir_list[] = {MRAA_GPIO_OUT, MRAA_GPIO_OUT,
- MRAA_GPIO_OUT, MRAA_GPIO_OUT,
- MRAA_GPIO_OUT, MRAA_GPIO_OUT};
- int i;
- mraa_result_t ret;
-
- MRAA_RETURN_FOR_ERROR(mraa_gpio_write(tristate, 0));
-
- for (i = 0; i < pin_num; i++) {
- mraa_gpio_context io = mraa_gpio_init_raw(gpio_pin_list[i]);
- if (io != NULL) {
- ret = mraa_gpio_dir(io, gpio_dir_list[i]);
- if (ret == MRAA_SUCCESS) {
- ret = mraa_gpio_write(io, gpio_val_list[i]);
- }
-
- //Don't care return value of close()
- mraa_gpio_close(io);
- MRAA_RETURN_FOR_ERROR(ret);
- } else {
- syslog(LOG_ERR, "edison: Failed to init raw gpio %d!",gpio_pin_list[i]);
- return MRAA_ERROR_NO_RESOURCES;
- }
- }
-
- MRAA_RETURN_FOR_ERROR(mraa_intel_edison_pinmode_change(115, 1));
- MRAA_RETURN_FOR_ERROR(mraa_intel_edison_pinmode_change(114, 1));
- MRAA_RETURN_FOR_ERROR(mraa_intel_edison_pinmode_change(109, 1));
- MRAA_RETURN_FOR_ERROR(mraa_gpio_write(tristate, 1));
-
- return MRAA_SUCCESS;
-}
-
-mraa_result_t
-mraa_intel_edison_aio_get_fp(mraa_aio_context dev)
-{
- char file_path[64] = "";
-
- snprintf(file_path, 64, "/sys/bus/iio/devices/iio:device1/in_voltage%d_raw", dev->channel);
-
- dev->adc_in_fp = open(file_path, O_RDONLY);
- if (dev->adc_in_fp == -1) {
- syslog(LOG_ERR, "edison: Failed to open Analog input raw file %s for "
- "reading!",
- file_path);
- return MRAA_ERROR_INVALID_RESOURCE;
- }
-
- return MRAA_SUCCESS;
-}
-
-mraa_result_t
-mraa_intel_edison_aio_init_pre(unsigned int aio)
-{
- if (aio > plat->aio_count) {
- syslog(LOG_ERR, "edison: Invalid analog input channel");
- return MRAA_ERROR_INVALID_RESOURCE;
- }
-
- int pin = 14 + aio;
- mraa_gpio_context output_e;
- output_e = mraa_gpio_init_raw(outputen[pin]);
- if (output_e == NULL) {
- return MRAA_ERROR_INVALID_RESOURCE;
- }
- if (mraa_gpio_dir(output_e, MRAA_GPIO_OUT) != MRAA_SUCCESS) {
- mraa_gpio_close(output_e);
- return MRAA_ERROR_INVALID_RESOURCE;
- }
- if (mraa_gpio_write(output_e, 0) != MRAA_SUCCESS) {
- mraa_gpio_close(output_e);
- return MRAA_ERROR_INVALID_RESOURCE;
- }
- mraa_gpio_close(output_e);
-
- mraa_gpio_context pullup_pin;
- pullup_pin = mraa_gpio_init_raw(pullup_map[pin]);
- if (pullup_pin == NULL) {
- return MRAA_ERROR_INVALID_RESOURCE;
- }
- if (mraa_gpio_dir(pullup_pin, MRAA_GPIO_IN) != MRAA_SUCCESS) {
- mraa_gpio_close(pullup_pin);
- return MRAA_ERROR_INVALID_RESOURCE;
- }
- mraa_gpio_close(pullup_pin);
-
- return MRAA_SUCCESS;
-}
-
-mraa_result_t
-mraa_intel_edison_aio_init_post(mraa_aio_context dev)
-{
- return mraa_gpio_write(tristate, 1);
-}
-
-mraa_result_t
-mraa_intel_edison_pwm_init_pre(int pin)
-{
- if (miniboard == 1) {
- return mraa_intel_edison_pinmode_change(plat->pins[pin].gpio.pinmap, 1);
- }
- if (pin < 0 || pin > 19) {
- return MRAA_ERROR_INVALID_RESOURCE;
- }
-
- if (!plat->pins[pin].capabilites.pwm) {
- return MRAA_ERROR_INVALID_RESOURCE;
- }
-
- mraa_gpio_context output_e;
- output_e = mraa_gpio_init_raw(outputen[pin]);
- if (output_e == NULL) {
- return MRAA_ERROR_INVALID_RESOURCE;
- }
- if (mraa_gpio_dir(output_e, MRAA_GPIO_OUT) != MRAA_SUCCESS) {
- mraa_gpio_close(output_e);
- return MRAA_ERROR_INVALID_RESOURCE;
- }
- if (mraa_gpio_write(output_e, 1) != MRAA_SUCCESS) {
- mraa_gpio_close(output_e);
- return MRAA_ERROR_INVALID_RESOURCE;
- }
- mraa_gpio_close(output_e);
-
- mraa_gpio_context pullup_pin;
- pullup_pin = mraa_gpio_init_raw(pullup_map[pin]);
- if (pullup_pin == NULL) {
- return MRAA_ERROR_INVALID_RESOURCE;
- }
- if (mraa_gpio_dir(pullup_pin, MRAA_GPIO_IN) != MRAA_SUCCESS) {
- mraa_gpio_close(pullup_pin);
- return MRAA_ERROR_INVALID_RESOURCE;
- }
- mraa_gpio_close(pullup_pin);
- mraa_intel_edison_pinmode_change(plat->pins[pin].gpio.pinmap, 1);
-
- return MRAA_SUCCESS;
-}
-
-mraa_result_t
-mraa_intel_edison_pwm_init_post(mraa_pwm_context pwm)
-{
- return mraa_gpio_write(tristate, 1);
-}
-
-mraa_result_t
-mraa_intel_edison_spi_init_pre(int bus)
-{
- if (miniboard == 1) {
- mraa_intel_edison_pinmode_change(115, 1);
- mraa_intel_edison_pinmode_change(114, 1);
- mraa_intel_edison_pinmode_change(109, 1);
- return MRAA_SUCCESS;
- }
-
- mraa_gpio_write(tristate, 0);
-
- mraa_gpio_context io10_out = mraa_gpio_init_raw(258);
- mraa_gpio_context io11_out = mraa_gpio_init_raw(259);
- mraa_gpio_context io12_out = mraa_gpio_init_raw(260);
- mraa_gpio_context io13_out = mraa_gpio_init_raw(261);
- mraa_gpio_dir(io10_out, MRAA_GPIO_OUT);
- mraa_gpio_dir(io11_out, MRAA_GPIO_OUT);
- mraa_gpio_dir(io12_out, MRAA_GPIO_OUT);
- mraa_gpio_dir(io13_out, MRAA_GPIO_OUT);
-
- mraa_gpio_write(io10_out, 1);
- mraa_gpio_write(io11_out, 1);
- mraa_gpio_write(io12_out, 0);
- mraa_gpio_write(io13_out, 1);
-
- mraa_gpio_close(io10_out);
- mraa_gpio_close(io11_out);
- mraa_gpio_close(io12_out);
- mraa_gpio_close(io13_out);
-
- mraa_gpio_context io10_pull = mraa_gpio_init_raw(226);
- mraa_gpio_context io11_pull = mraa_gpio_init_raw(227);
- mraa_gpio_context io12_pull = mraa_gpio_init_raw(228);
- mraa_gpio_context io13_pull = mraa_gpio_init_raw(229);
-
- mraa_gpio_dir(io10_pull, MRAA_GPIO_IN);
- mraa_gpio_dir(io11_pull, MRAA_GPIO_IN);
- mraa_gpio_dir(io12_pull, MRAA_GPIO_IN);
- mraa_gpio_dir(io13_pull, MRAA_GPIO_IN);
-
- mraa_gpio_close(io10_pull);
- mraa_gpio_close(io11_pull);
- mraa_gpio_close(io12_pull);
- mraa_gpio_close(io13_pull);
-
- return MRAA_SUCCESS;
-}
-
-mraa_result_t
-mraa_intel_edison_spi_init_post(mraa_spi_context spi)
-{
- return mraa_gpio_write(tristate, 1);
-}
-
-mraa_result_t
-mraa_intel_edison_gpio_mode_replace(mraa_gpio_context dev, mraa_gpio_mode_t mode)
-{
- if (dev->value_fp != -1) {
- if (close(dev->value_fp) != 0) {
- return MRAA_ERROR_INVALID_RESOURCE;
- }
- dev->value_fp = -1;
- }
-
- mraa_gpio_context pullup_e;
- pullup_e = mraa_gpio_init_raw(pullup_map[dev->phy_pin]);
- if (pullup_e == NULL) {
- return MRAA_ERROR_INVALID_RESOURCE;
- }
- if (mraa_gpio_dir(pullup_e, MRAA_GPIO_IN) != MRAA_SUCCESS) {
- syslog(LOG_ERR, "edison: Failed to set gpio mode-pullup");
- mraa_gpio_close(pullup_e);
- return MRAA_ERROR_INVALID_RESOURCE;
- }
-
- int value = -1;
- switch (mode) {
- case MRAA_GPIO_STRONG:
- break;
- case MRAA_GPIO_PULLUP:
- value = 1;
- break;
- case MRAA_GPIO_PULLDOWN:
- value = 0;
- break;
- case MRAA_GPIO_HIZ:
- return MRAA_SUCCESS;
- break;
- default:
- return MRAA_ERROR_FEATURE_NOT_IMPLEMENTED;
- }
- if (value != -1) {
- if (mraa_gpio_dir(pullup_e, MRAA_GPIO_OUT) != MRAA_SUCCESS) {
- syslog(LOG_ERR, "edison: Error setting pullup");
- mraa_gpio_close(pullup_e);
- return MRAA_ERROR_INVALID_RESOURCE;
- }
- if (mraa_gpio_write(pullup_e, value) != MRAA_SUCCESS) {
- syslog(LOG_ERR, "edison: Error setting pullup");
- mraa_gpio_close(pullup_e);
- return MRAA_ERROR_INVALID_RESOURCE;
- }
- }
-
- return mraa_gpio_close(pullup_e);
-}
-
-mraa_result_t
-mraa_intel_edsion_mb_gpio_mode(mraa_gpio_context dev, mraa_gpio_mode_t mode)
-{
- if (dev->value_fp != -1) {
- if (close(dev->value_fp) != 0) {
- return MRAA_ERROR_INVALID_RESOURCE;
- }
- dev->value_fp = -1;
- }
-
- char filepath[MAX_SIZE];
-
- mraa_gpio_context mode_gpio = mraa_gpio_init_raw(dev->pin);
- if (mode_gpio == NULL) {
- return MRAA_ERROR_NO_RESOURCES;
- }
-
- // first try SYSFS_CLASS_GPIO path
- snprintf(filepath, MAX_SIZE, SYSFS_CLASS_GPIO "/gpio%d/pullmode", dev->pin);
- int drive = open(filepath, O_WRONLY);
-
- if (drive == -1) {
- snprintf(filepath, MAX_SIZE, DEBUGFS_PINMODE_PATH "%d/current_pullmode", dev->pin);
- drive = open(filepath, O_WRONLY);
- }
-
- if (drive == -1) {
- syslog(LOG_ERR, "edison: Failed to open drive for writing");
- mraa_gpio_close(mode_gpio);
- return MRAA_ERROR_INVALID_RESOURCE;
- }
-
- char bu[MAX_SIZE];
- int length;
- switch (mode) {
- case MRAA_GPIO_STRONG:
- mraa_gpio_close(mode_gpio);
- close(drive);
- return MRAA_SUCCESS;
- case MRAA_GPIO_PULLUP:
- length = snprintf(bu, sizeof(bu), "pullup");
- break;
- case MRAA_GPIO_PULLDOWN:
- length = snprintf(bu, sizeof(bu), "pulldown");
- break;
- case MRAA_GPIO_HIZ:
- length = snprintf(bu, sizeof(bu), "nopull");
- break;
- default:
- mraa_gpio_close(mode_gpio);
- close(drive);
- return MRAA_ERROR_FEATURE_NOT_IMPLEMENTED;
- }
- if (write(drive, bu, length * sizeof(char)) == -1) {
- syslog(LOG_ERR, "edison: Failed to write to drive mode");
- mraa_gpio_close(mode_gpio);
- close(drive);
- return MRAA_ERROR_INVALID_RESOURCE;
- }
-
- mraa_gpio_close(mode_gpio);
- if (close(drive) != 0) {
- return MRAA_ERROR_INVALID_RESOURCE;
- }
- return MRAA_SUCCESS;
-}
-
-mraa_result_t
-mraa_intel_edison_uart_init_pre(int index)
-{
- if (index != 0) {
- syslog(LOG_ERR, "edison: Failed to write to drive mode");
- return MRAA_ERROR_INVALID_RESOURCE;
- }
- if (miniboard == 0) {
- mraa_gpio_write(tristate, 0);
- mraa_gpio_context io0_output = mraa_gpio_init_raw(248);
- mraa_gpio_context io0_pullup = mraa_gpio_init_raw(216);
- mraa_gpio_context io1_output = mraa_gpio_init_raw(249);
- mraa_gpio_context io1_pullup = mraa_gpio_init_raw(217);
- mraa_gpio_dir(io0_output, MRAA_GPIO_OUT);
- mraa_gpio_dir(io0_pullup, MRAA_GPIO_OUT);
- mraa_gpio_dir(io1_output, MRAA_GPIO_OUT);
- mraa_gpio_dir(io1_pullup, MRAA_GPIO_IN);
-
- mraa_gpio_write(io0_output, 0);
- mraa_gpio_write(io0_pullup, 0);
- mraa_gpio_write(io1_output, 1);
-
- mraa_gpio_close(io0_output);
- mraa_gpio_close(io0_pullup);
- mraa_gpio_close(io1_output);
- mraa_gpio_close(io1_pullup);
- }
- mraa_result_t ret;
- ret = mraa_intel_edison_pinmode_change(130, 1); // IO0 RX
- ret = mraa_intel_edison_pinmode_change(131, 1); // IO1 TX
- return ret;
-}
-
-mraa_result_t
-mraa_intel_edison_uart_init_post(mraa_uart_context uart)
-{
- return mraa_gpio_write(tristate, 1);
-}
-
-static mraa_result_t
-mraa_intel_edsion_mmap_unsetup()
-{
- if (mmap_reg == NULL) {
- syslog(LOG_ERR, "edison mmap: null register cant unsetup");
- return MRAA_ERROR_INVALID_RESOURCE;
- }
- munmap(mmap_reg, mmap_size);
- mmap_reg = NULL;
- if (close(mmap_fd) != 0) {
- return MRAA_ERROR_INVALID_RESOURCE;
- }
- return MRAA_SUCCESS;
-}
-
-mraa_result_t
-mraa_intel_edison_mmap_write(mraa_gpio_context dev, int value)
-{
- uint8_t offset = ((dev->pin / 32) * sizeof(uint32_t));
- uint8_t valoff;
-
- if (value) {
- valoff = 0x34;
- } else {
- valoff = 0x4c;
- }
-
- *(volatile uint32_t*) (mmap_reg + offset + valoff) = (uint32_t)(1 << (dev->pin % 32));
-
- return MRAA_SUCCESS;
-}
-
-int
-mraa_intel_edison_mmap_read(mraa_gpio_context dev)
-{
- uint8_t offset = ((dev->pin / 32) * sizeof(uint32_t));
- uint32_t value;
-
- value = *(volatile uint32_t*) (mmap_reg + 0x04 + offset);
- if (value & (uint32_t)(1 << (dev->pin % 32))) {
- return 1;
- }
- return 0;
-}
-
-mraa_result_t
-mraa_intel_edison_mmap_setup(mraa_gpio_context dev, mraa_boolean_t en)
-{
- if (dev == NULL) {
- syslog(LOG_ERR, "edison mmap: context not valid");
- return MRAA_ERROR_INVALID_HANDLE;
- }
-
- if (en == 0) {
- if (dev->mmap_write == NULL && dev->mmap_read == NULL) {
- syslog(LOG_ERR, "edison mmap: can't disable disabled mmap gpio");
- return MRAA_ERROR_INVALID_PARAMETER;
- }
- dev->mmap_write = NULL;
- dev->mmap_read = NULL;
- mmap_count--;
- if (mmap_count == 0) {
- return mraa_intel_edsion_mmap_unsetup();
- }
- return MRAA_SUCCESS;
- }
-
- if (dev->mmap_write != NULL && dev->mmap_read != NULL) {
- syslog(LOG_ERR, "edison mmap: can't enable enabled mmap gpio");
- return MRAA_ERROR_INVALID_PARAMETER;
- }
-
- // Might need to make some elements of this thread safe.
- // For example only allow one thread to enter the following block
- // to prevent mmap'ing twice.
- if (mmap_reg == NULL) {
- if ((mmap_fd = open(MMAP_PATH, O_RDWR)) < 0) {
- syslog(LOG_ERR, "edison map: unable to open resource0 file");
- return MRAA_ERROR_INVALID_HANDLE;
- }
-
- struct stat fd_stat;
- if (fstat(mmap_fd, &fd_stat) != 0) {
- syslog(LOG_ERR, "edison map: unable to access resource0 file");
- return MRAA_ERROR_INVALID_HANDLE;
- }
- mmap_size = fd_stat.st_size;
-
- mmap_reg =
- (uint8_t*) mmap(NULL, fd_stat.st_size, PROT_READ | PROT_WRITE, MAP_FILE | MAP_SHARED, mmap_fd, 0);
- if (mmap_reg == MAP_FAILED) {
- syslog(LOG_ERR, "edison mmap: failed to mmap");
- mmap_reg = NULL;
- close(mmap_fd);
- return MRAA_ERROR_NO_RESOURCES;
- }
- }
- dev->mmap_write = &mraa_intel_edison_mmap_write;
- dev->mmap_read = &mraa_intel_edison_mmap_read;
- mmap_count++;
-
- return MRAA_SUCCESS;
-}
-
-mraa_result_t
-mraa_intel_edison_i2c_freq(mraa_i2c_context dev, mraa_i2c_mode_t mode)
-{
- int sysnode = -1;
-
- switch (dev->busnum) {
- case 1:
- sysnode = open("/sys/devices/pci0000:00/0000:00:08.0/i2c_dw_sysnode/mode", O_RDWR);
- break;
- case 6:
- sysnode = open("/sys/devices/pci0000:00/0000:00:09.1/i2c_dw_sysnode/mode", O_RDWR);
- break;
- default:
- syslog(LOG_NOTICE, "i2c bus selected does not support frequency changes");
- return MRAA_ERROR_FEATURE_NOT_SUPPORTED;
- }
- if (sysnode == -1) {
- return MRAA_ERROR_INVALID_RESOURCE;
- }
-
- char bu[5];
- int length;
- switch (mode) {
- case MRAA_I2C_STD:
- length = snprintf(bu, sizeof(bu), "std");
- break;
- case MRAA_I2C_FAST:
- length = snprintf(bu, sizeof(bu), "fast");
- break;
- case MRAA_I2C_HIGH:
- length = snprintf(bu, sizeof(bu), "high");
- break;
- default:
- syslog(LOG_ERR, "Invalid i2c mode selected");
- close(sysnode);
- return MRAA_ERROR_INVALID_PARAMETER;
- }
- if (write(sysnode, bu, length * sizeof(char)) == -1) {
- close(sysnode);
- return MRAA_ERROR_INVALID_RESOURCE;
- }
- close(sysnode);
- return MRAA_SUCCESS;
-}
-
-mraa_result_t
-mraa_intel_edison_miniboard(mraa_board_t* b)
-{
- miniboard = 1;
- b->phy_pin_count = 56;
- b->gpio_count = 56; // A bit of a hack I suppose
- b->aio_count = 0;
- b->pwm_default_period = 5000;
- b->pwm_max_period = 218453;
- b->pwm_min_period = 1;
-
- b->pins = (mraa_pininfo_t*) calloc(b->phy_pin_count, sizeof(mraa_pininfo_t));
- if (b->pins == NULL) {
- return MRAA_ERROR_UNSPECIFIED;
- }
-
- b->adv_func = (mraa_adv_func_t*) calloc(1, sizeof(mraa_adv_func_t));
- if (b->adv_func == NULL) {
- free(b->pins);
- return MRAA_ERROR_UNSPECIFIED;
- }
- b->adv_func->gpio_init_post = &mraa_intel_edison_gpio_init_post;
- b->adv_func->pwm_init_pre = &mraa_intel_edison_pwm_init_pre;
- b->adv_func->i2c_init_pre = &mraa_intel_edison_i2c_init_pre;
- b->adv_func->i2c_set_frequency_replace = &mraa_intel_edison_i2c_freq;
- b->adv_func->spi_init_pre = &mraa_intel_edison_spi_init_pre;
- b->adv_func->gpio_mode_replace = &mraa_intel_edsion_mb_gpio_mode;
- b->adv_func->uart_init_pre = &mraa_intel_edison_uart_init_pre;
- b->adv_func->gpio_mmap_setup = &mraa_intel_edison_mmap_setup;
-
- int pos = 0;
- strncpy(b->pins[pos].name, "J17-1", 8);
- b->pins[pos].capabilites = (mraa_pincapabilities_t){ 1, 1, 1, 0, 0, 0, 0 };
- b->pins[pos].gpio.pinmap = 182;
- b->pins[pos].gpio.mux_total = 0;
- b->pins[pos].pwm.pinmap = 2;
- b->pins[pos].pwm.parent_id = 0;
- b->pins[pos].pwm.mux_total = 0;
- pos++;
-
- strncpy(b->pins[pos].name, "J17-2", 8);
- b->pins[pos].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- pos++;
- strncpy(b->pins[pos].name, "J17-3", 8);
- b->pins[pos].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- pos++;
- strncpy(b->pins[pos].name, "J17-4", 8);
- b->pins[pos].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- pos++;
-
- strncpy(b->pins[pos].name, "J17-5", 8);
- b->pins[pos].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[pos].gpio.pinmap = 135;
- b->pins[pos].gpio.mux_total = 0;
- pos++;
-
- strncpy(b->pins[pos].name, "J17-6", 8);
- b->pins[pos].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- pos++;
-
- strncpy(b->pins[pos].name, "J17-7", 8);
- b->pins[pos].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 1, 0, 0 };
- b->pins[pos].gpio.pinmap = 27;
- b->pins[pos].gpio.mux_total = 0;
- b->pins[pos].i2c.pinmap = 1;
- b->pins[pos].i2c.mux_total = 0;
- pos++;
-
- strncpy(b->pins[pos].name, "J17-8", 8);
- b->pins[pos].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 1, 0, 0 };
- b->pins[pos].gpio.pinmap = 20;
- b->pins[pos].gpio.mux_total = 0;
- b->pins[pos].i2c.pinmap = 1;
- b->pins[pos].i2c.mux_total = 0;
- pos++;
-
- strncpy(b->pins[pos].name, "J17-9", 8);
- b->pins[pos].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 1, 0, 0 };
- b->pins[pos].gpio.pinmap = 28;
- b->pins[pos].gpio.mux_total = 0;
- b->pins[pos].i2c.pinmap = 1;
- b->pins[pos].i2c.mux_total = 0;
- pos++;
-
- strncpy(b->pins[pos].name, "J17-10", 8);
- b->pins[pos].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 1, 0, 0, 0 };
- b->pins[pos].gpio.pinmap = 111;
- b->pins[pos].gpio.mux_total = 0;
- b->pins[pos].spi.pinmap = 5;
- b->pins[pos].spi.mux_total = 0;
- pos++;
-
- strncpy(b->pins[pos].name, "J17-11", 8);
- b->pins[pos].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 1, 0, 0, 0 };
- b->pins[pos].gpio.pinmap = 109;
- b->pins[pos].gpio.mux_total = 0;
- b->pins[pos].spi.pinmap = 5;
- b->pins[pos].spi.mux_total = 0;
- pos++;
-
- strncpy(b->pins[pos].name, "J17-12", 8);
- b->pins[pos].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 1, 0, 0, 0 };
- b->pins[pos].gpio.pinmap = 115;
- b->pins[pos].gpio.mux_total = 0;
- b->pins[pos].spi.pinmap = 5;
- b->pins[pos].spi.mux_total = 0;
- pos++;
- strncpy(b->pins[pos].name, "J17-13", 8);
- b->pins[pos].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- pos++;
-
- strncpy(b->pins[pos].name, "J17-14", 8);
- b->pins[pos].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[pos].gpio.pinmap = 128;
- b->pins[pos].gpio.parent_id = 0;
- b->pins[pos].gpio.mux_total = 0;
- pos++;
-
- strncpy(b->pins[pos].name, "J18-1", 8);
- b->pins[pos].capabilites = (mraa_pincapabilities_t){ 1, 1, 1, 0, 0, 0, 0 };
- b->pins[pos].gpio.pinmap = 13;
- b->pins[pos].gpio.mux_total = 0;
- b->pins[pos].pwm.pinmap = 1;
- b->pins[pos].pwm.parent_id = 0;
- b->pins[pos].pwm.mux_total = 0;
- pos++;
-
- strncpy(b->pins[pos].name, "J18-2", 8);
- b->pins[pos].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0 };
- b->pins[pos].gpio.pinmap = 165;
- b->pins[pos].gpio.mux_total = 0;
- pos++;
- strncpy(b->pins[pos].name, "J18-3", 8);
- b->pins[pos].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- pos++;
- strncpy(b->pins[pos].name, "J18-4", 8);
- b->pins[pos].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- pos++;
- strncpy(b->pins[pos].name, "J18-5", 8);
- b->pins[pos].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- pos++;
-
- strncpy(b->pins[pos].name, "J18-6", 8);
- b->pins[pos].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 1, 0, 0 };
- b->pins[pos].gpio.pinmap = 19;
- b->pins[pos].gpio.mux_total = 0;
- b->pins[pos].i2c.pinmap = 1;
- b->pins[pos].i2c.mux_total = 0;
- pos++;
-
- strncpy(b->pins[pos].name, "J18-7", 8);
- b->pins[pos].capabilites = (mraa_pincapabilities_t){ 1, 1, 1, 0, 0, 0, 0 };
- b->pins[pos].gpio.pinmap = 12;
- b->pins[pos].gpio.mux_total = 0;
- b->pins[pos].pwm.pinmap = 0;
- b->pins[pos].pwm.parent_id = 0;
- b->pins[pos].pwm.mux_total = 0;
- pos++;
-
- strncpy(b->pins[pos].name, "J18-8", 8);
- b->pins[pos].capabilites = (mraa_pincapabilities_t){ 1, 1, 1, 0, 0, 0, 0 };
- b->pins[pos].gpio.pinmap = 183;
- b->pins[pos].gpio.mux_total = 0;
- b->pins[pos].pwm.pinmap = 3;
- b->pins[pos].pwm.parent_id = 0;
- b->pins[pos].pwm.mux_total = 0;
- pos++;
- strncpy(b->pins[pos].name, "J18-9", 8);
- b->pins[pos].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- pos++;
-
- strncpy(b->pins[pos].name, "J18-10", 8);
- b->pins[pos].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 1, 0, 0, 0 };
- b->pins[pos].gpio.pinmap = 110;
- b->pins[pos].gpio.mux_total = 0;
- b->pins[pos].spi.pinmap = 5;
- b->pins[pos].spi.mux_total = 0;
- pos++;
- strncpy(b->pins[pos].name, "J18-11", 8);
- b->pins[pos].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 1, 0, 0, 0 };
- b->pins[pos].gpio.pinmap = 114;
- b->pins[pos].gpio.mux_total = 0;
- b->pins[pos].spi.pinmap = 5;
- b->pins[pos].spi.mux_total = 0;
- pos++;
-
- strncpy(b->pins[pos].name, "J18-12", 8);
- b->pins[pos].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[pos].gpio.pinmap = 129;
- b->pins[pos].gpio.mux_total = 0;
- pos++;
- strncpy(b->pins[pos].name, "J18-13", 8);
- b->pins[pos].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 1 };
- b->pins[pos].gpio.pinmap = 130;
- b->pins[pos].gpio.mux_total = 0;
- b->pins[pos].uart.pinmap = 0;
- b->pins[pos].uart.parent_id = 0;
- b->pins[pos].uart.mux_total = 0;
-
- pos++;
- strncpy(b->pins[pos].name, "J18-14", 8);
- b->pins[pos].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- pos++;
-
- strncpy(b->pins[pos].name, "J19-1", 8);
- b->pins[pos].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- pos++;
- strncpy(b->pins[pos].name, "J19-2", 8);
- b->pins[pos].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- pos++;
- strncpy(b->pins[pos].name, "J19-3", 8);
- b->pins[pos].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- pos++;
-
- strncpy(b->pins[pos].name, "J19-4", 8);
- b->pins[pos].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[pos].gpio.pinmap = 44;
- b->pins[pos].gpio.mux_total = 0;
- pos++;
- strncpy(b->pins[pos].name, "J19-5", 8);
- b->pins[pos].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[pos].gpio.pinmap = 46;
- b->pins[pos].gpio.mux_total = 0;
- pos++;
- strncpy(b->pins[pos].name, "J19-6", 8);
- b->pins[pos].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[pos].gpio.pinmap = 48;
- b->pins[pos].gpio.mux_total = 0;
- pos++;
-
- strncpy(b->pins[pos].name, "J19-7", 8);
- b->pins[pos].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- pos++;
-
- strncpy(b->pins[pos].name, "J19-8", 8);
- b->pins[pos].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 1 };
- b->pins[pos].gpio.pinmap = 131;
- b->pins[pos].gpio.mux_total = 0;
- b->pins[pos].uart.pinmap = 0;
- b->pins[pos].uart.parent_id = 0;
- b->pins[pos].uart.mux_total = 0;
- pos++;
-
- strncpy(b->pins[pos].name, "J19-9", 8);
- b->pins[pos].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[pos].gpio.pinmap = 14;
- b->pins[pos].gpio.mux_total = 0;
- pos++;
-
- strncpy(b->pins[pos].name, "J19-10", 8);
- b->pins[pos].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[pos].gpio.pinmap = 40;
- b->pins[pos].gpio.mux_total = 0;
- pos++;
- strncpy(b->pins[pos].name, "J19-11", 8);
- b->pins[pos].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[pos].gpio.pinmap = 43;
- b->pins[pos].gpio.mux_total = 0;
- pos++;
- strncpy(b->pins[pos].name, "J19-12", 8);
- b->pins[pos].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[pos].gpio.pinmap = 77;
- b->pins[pos].gpio.mux_total = 0;
- pos++;
- strncpy(b->pins[pos].name, "J19-13", 8);
- b->pins[pos].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[pos].gpio.pinmap = 82;
- b->pins[pos].gpio.mux_total = 0;
- pos++;
- strncpy(b->pins[pos].name, "J19-14", 8);
- b->pins[pos].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[pos].gpio.pinmap = 83;
- b->pins[pos].gpio.mux_total = 0;
- pos++;
-
- strncpy(b->pins[pos].name, "J20-1", 8);
- b->pins[pos].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- pos++;
- strncpy(b->pins[pos].name, "J20-2", 8);
- b->pins[pos].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- pos++;
- strncpy(b->pins[pos].name, "J20-3", 8);
- b->pins[pos].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- pos++;
- strncpy(b->pins[pos].name, "J20-4", 8);
- b->pins[pos].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[pos].gpio.pinmap = 45;
- b->pins[pos].gpio.mux_total = 0;
- pos++;
- strncpy(b->pins[pos].name, "J20-5", 8);
- b->pins[pos].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[pos].gpio.pinmap = 47;
- b->pins[pos].gpio.mux_total = 0;
- pos++;
- strncpy(b->pins[pos].name, "J20-6", 8);
- b->pins[pos].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[pos].gpio.pinmap = 49;
- b->pins[pos].gpio.mux_total = 0;
- pos++;
- strncpy(b->pins[pos].name, "J20-7", 8);
- b->pins[pos].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[pos].gpio.pinmap = 15;
- b->pins[pos].gpio.mux_total = 0;
- pos++;
- strncpy(b->pins[pos].name, "J20-8", 8);
- b->pins[pos].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[pos].gpio.pinmap = 84;
- b->pins[pos].gpio.mux_total = 0;
- pos++;
- strncpy(b->pins[pos].name, "J20-9", 8);
- b->pins[pos].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[pos].gpio.pinmap = 42;
- b->pins[pos].gpio.mux_total = 0;
- pos++;
- strncpy(b->pins[pos].name, "J20-10", 8);
- b->pins[pos].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[pos].gpio.pinmap = 41;
- b->pins[pos].gpio.mux_total = 0;
- pos++;
- strncpy(b->pins[pos].name, "J20-11", 8);
- b->pins[pos].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[pos].gpio.pinmap = 78;
- b->pins[pos].gpio.mux_total = 0;
- pos++;
- strncpy(b->pins[pos].name, "J20-12", 8);
- b->pins[pos].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[pos].gpio.pinmap = 79;
- b->pins[pos].gpio.mux_total = 0;
- pos++;
- strncpy(b->pins[pos].name, "J20-13", 8);
- b->pins[pos].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[pos].gpio.pinmap = 80;
- b->pins[pos].gpio.mux_total = 0;
- pos++;
- strncpy(b->pins[pos].name, "J20-14", 8);
- b->pins[pos].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[pos].gpio.pinmap = 81;
- b->pins[pos].gpio.mux_total = 0;
- pos++;
-
- // BUS DEFINITIONS
- b->i2c_bus_count = 9;
- b->def_i2c_bus = 1;
- int ici;
- for (ici = 0; ici < 9; ici++) {
- b->i2c_bus[ici].bus_id = -1;
- }
- b->i2c_bus[1].bus_id = 1;
- b->i2c_bus[1].sda = 7;
- b->i2c_bus[1].scl = 19;
-
- b->i2c_bus[6].bus_id = 6;
- b->i2c_bus[6].sda = 8;
- b->i2c_bus[6].scl = 6;
-
- b->spi_bus_count = 1;
- b->def_spi_bus = 0;
- b->spi_bus[0].bus_id = 5;
- b->spi_bus[0].slave_s = 1;
- b->spi_bus[0].cs = 23;
- b->spi_bus[0].mosi = 11;
- b->spi_bus[0].miso = 24;
- b->spi_bus[0].sclk = 10;
-
- b->uart_dev_count = 1;
- b->def_uart_dev = 0;
- b->uart_dev[0].rx = 26;
- b->uart_dev[0].tx = 35;
- b->uart_dev[0].device_path = UART_DEV_PATH;
-
- return MRAA_SUCCESS;
-}
-
-mraa_boolean_t
-is_arduino_board()
-{
- // We check for two things to determine if that's an Arduino expansion board
- // 1) is tristate GPIO available, by trying to initialize it
- // 2) are there four specific GPIO expanders, by reading device labels
- // /sys/class/gpio/gpiochip{200,216,232,248}/label == "pcal9555a"
- char gpiochip_path[MAX_SIZE];
- char gpiochip_label[MAX_SIZE];
- const char gpiochip_label_arduino[] = "pcal9555a";
- const int gpiochip_idx[4] = { 200, 216, 232, 248 };
-
- // prepare format string for fscanf, based on MAX_SIZE
- char format_str[MAX_SIZE];
- snprintf(format_str, MAX_SIZE, "%%%ds", MAX_SIZE - 1);
- int i, ret, errno_saved;
-
- // check tristate first
- tristate = mraa_gpio_init_raw(214);
- if (tristate == NULL) {
- syslog(LOG_INFO, "edison: tristate not detected");
- return 0;
- }
-
- // GPIO expanders second
- for (i=0; i<(sizeof(gpiochip_idx)/sizeof(gpiochip_idx[0])); i++) {
- memset(gpiochip_path, 0, MAX_SIZE);
- snprintf(gpiochip_path,
- MAX_SIZE,
- SYSFS_CLASS_GPIO "/gpiochip%d/label",
- gpiochip_idx[i]);
- FILE *fp;
- fp = fopen(gpiochip_path, "r");
- if (fp == NULL) {
- syslog(LOG_INFO,
- "edison: could not open '%s', errno %d",
- gpiochip_path,
- errno);
- return 0;
- }
-
- memset(gpiochip_label, 0, MAX_SIZE);
- ret = fscanf(fp, format_str, &gpiochip_label);
- errno_saved = errno;
- fclose(fp);
- if (ret != 1) {
- syslog(LOG_INFO,
- "edison: could not read from '%s', errno %d",
- gpiochip_path,
- errno_saved);
- return 0;
- }
-
- // we want to check for exact match
- if (strncmp(gpiochip_label, gpiochip_label_arduino, strlen(gpiochip_label) + 1) != 0) {
- syslog(LOG_INFO,
- "edison: gpiochip label (%s) is not what we expect (%s)\n",
- gpiochip_label,
- gpiochip_label_arduino);
- return 0;
- }
- }
-
- syslog(LOG_NOTICE, "edison: Arduino board detected");
- return 1;
-}
-
-mraa_board_t*
-mraa_intel_edison_fab_c()
-{
- mraa_gpio_dir_t tristate_dir;
- mraa_board_t* b = (mraa_board_t*) calloc(1, sizeof(mraa_board_t));
- if (b == NULL) {
- return NULL;
- }
-
- b->platform_name = PLATFORM_NAME;
-
- if (is_arduino_board() == 0) {
- syslog(LOG_NOTICE,
- "edison: Arduino board not detected, assuming Intel Edison Miniboard");
- if (mraa_intel_edison_miniboard(b) != MRAA_SUCCESS) {
- goto error;
- }
- return b;
- }
- // Now Assuming the edison is attached to the Arduino board.
- b->phy_pin_count = 20;
- b->gpio_count = 14;
- b->aio_count = 6;
- b->platform_version = "arduino";
-
- b->adv_func = (mraa_adv_func_t*) calloc(1, sizeof(mraa_adv_func_t));
- if (b->adv_func == NULL) {
- goto error;
- }
- b->adv_func->gpio_dir_pre = &mraa_intel_edison_gpio_dir_pre;
- b->adv_func->gpio_init_post = &mraa_intel_edison_gpio_init_post;
- b->adv_func->gpio_close_pre = &mraa_intel_edison_gpio_close_pre;
- b->adv_func->gpio_dir_post = &mraa_intel_edison_gpio_dir_post;
- b->adv_func->i2c_init_pre = &mraa_intel_edison_i2c_init_pre;
- b->adv_func->i2c_set_frequency_replace = &mraa_intel_edison_i2c_freq;
- b->adv_func->aio_get_valid_fp = &mraa_intel_edison_aio_get_fp;
- b->adv_func->aio_init_pre = &mraa_intel_edison_aio_init_pre;
- b->adv_func->aio_init_post = &mraa_intel_edison_aio_init_post;
- b->adv_func->pwm_init_pre = &mraa_intel_edison_pwm_init_pre;
- b->adv_func->pwm_init_post = &mraa_intel_edison_pwm_init_post;
- b->adv_func->spi_init_pre = &mraa_intel_edison_spi_init_pre;
- b->adv_func->spi_init_post = &mraa_intel_edison_spi_init_post;
- b->adv_func->gpio_mode_replace = &mraa_intel_edison_gpio_mode_replace;
- b->adv_func->uart_init_pre = &mraa_intel_edison_uart_init_pre;
- b->adv_func->uart_init_post = &mraa_intel_edison_uart_init_post;
- b->adv_func->gpio_mmap_setup = &mraa_intel_edison_mmap_setup;
- b->adv_func->spi_lsbmode_replace = &mraa_intel_edison_spi_lsbmode_replace;
-
- b->pins = (mraa_pininfo_t*) calloc(MRAA_INTEL_EDISON_PINCOUNT, sizeof(mraa_pininfo_t));
- if (b->pins == NULL) {
- free(b->adv_func);
- goto error;
- }
-
- if (mraa_gpio_read_dir(tristate, &tristate_dir) != MRAA_SUCCESS) {
- free(b->adv_func);
- goto error;
- }
-
- if (tristate_dir != MRAA_GPIO_OUT) {
- mraa_gpio_dir(tristate, MRAA_GPIO_OUT);
- }
-
- // this is required to initialise not just SPI but also the ADC channels
- mraa_intel_edison_misc_spi();
-
- b->adc_raw = 12;
- b->adc_supported = 10;
- b->pwm_default_period = 5000;
- b->pwm_max_period = 218453;
- b->pwm_min_period = 1;
-
- strncpy(b->pins[0].name, "IO0", 8);
- b->pins[0].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 1 };
- b->pins[0].gpio.pinmap = 130;
- b->pins[0].gpio.parent_id = 0;
- b->pins[0].gpio.mux_total = 0;
- b->pins[0].uart.pinmap = 0;
- b->pins[0].uart.parent_id = 0;
- b->pins[0].uart.mux_total = 0;
-
- strncpy(b->pins[1].name, "IO1", 8);
- b->pins[1].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 1 };
- b->pins[1].gpio.pinmap = 131;
- b->pins[1].gpio.parent_id = 0;
- b->pins[1].gpio.mux_total = 0;
- b->pins[1].uart.pinmap = 0;
- b->pins[1].uart.parent_id = 0;
- b->pins[1].uart.mux_total = 0;
-
- strncpy(b->pins[2].name, "IO2", 8);
- b->pins[2].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0 };
- b->pins[2].gpio.pinmap = 128;
- b->pins[2].gpio.parent_id = 0;
- b->pins[2].gpio.mux_total = 0;
-
- strncpy(b->pins[3].name, "IO3", 8);
- b->pins[3].capabilites = (mraa_pincapabilities_t){ 1, 1, 1, 0, 0, 0, 0 };
- b->pins[3].gpio.pinmap = 12;
- b->pins[3].gpio.parent_id = 0;
- b->pins[3].gpio.mux_total = 0;
- b->pins[3].pwm.pinmap = 0;
- b->pins[3].pwm.parent_id = 0;
- b->pins[3].pwm.mux_total = 0;
-
- strncpy(b->pins[4].name, "IO4", 8);
- b->pins[4].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0 };
- b->pins[4].gpio.pinmap = 129;
- b->pins[4].gpio.parent_id = 0;
- b->pins[4].gpio.mux_total = 0;
-
- strncpy(b->pins[5].name, "IO5", 8);
- b->pins[5].capabilites = (mraa_pincapabilities_t){ 1, 1, 1, 0, 0, 0, 0, 0 };
- b->pins[5].gpio.pinmap = 13;
- b->pins[5].gpio.parent_id = 0;
- b->pins[5].gpio.mux_total = 0;
- b->pins[5].pwm.pinmap = 1;
- b->pins[5].pwm.parent_id = 0;
- b->pins[5].pwm.mux_total = 0;
-
- strncpy(b->pins[6].name, "IO6", 8);
- b->pins[6].capabilites = (mraa_pincapabilities_t){ 1, 1, 1, 0, 0, 0, 0, 0 };
- b->pins[6].gpio.pinmap = 182;
- b->pins[6].gpio.parent_id = 0;
- b->pins[6].gpio.mux_total = 0;
- b->pins[6].pwm.pinmap = 2;
- b->pins[6].pwm.parent_id = 0;
- b->pins[6].pwm.mux_total = 0;
-
- strncpy(b->pins[7].name, "IO7", 8);
- b->pins[7].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0 };
- b->pins[7].gpio.pinmap = 48;
- b->pins[7].gpio.parent_id = 0;
- b->pins[7].gpio.mux_total = 0;
-
- strncpy(b->pins[8].name, "IO8", 8);
- b->pins[8].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0 };
- b->pins[8].gpio.pinmap = 49;
- b->pins[8].gpio.parent_id = 0;
- b->pins[8].gpio.mux_total = 0;
-
- strncpy(b->pins[9].name, "IO9", 8);
- b->pins[9].capabilites = (mraa_pincapabilities_t){ 1, 1, 1, 0, 0, 0, 0, 0 };
- b->pins[9].gpio.pinmap = 183;
- b->pins[9].gpio.parent_id = 0;
- b->pins[9].gpio.mux_total = 0;
- b->pins[9].pwm.pinmap = 3;
- b->pins[9].pwm.parent_id = 0;
- b->pins[9].pwm.mux_total = 0;
-
- strncpy(b->pins[10].name, "IO10", 8);
- b->pins[10].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 1, 0, 0, 0 };
- b->pins[10].gpio.pinmap = 41;
- b->pins[10].gpio.parent_id = 0;
- b->pins[10].gpio.mux_total = 2;
- b->pins[10].gpio.mux[0].pin = 263;
- b->pins[10].gpio.mux[0].value = 1;
- b->pins[10].gpio.mux[1].pin = 240;
- b->pins[10].gpio.mux[1].value = 0;
- b->pins[10].spi.pinmap = 5;
- b->pins[10].spi.mux_total = 2;
- b->pins[10].spi.mux[0].pin = 263;
- b->pins[10].spi.mux[0].value = 1;
- b->pins[10].spi.mux[1].pin = 240;
- b->pins[10].spi.mux[1].value = 1;
-
- strncpy(b->pins[11].name, "IO11", 8);
- b->pins[11].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 1, 0, 0, 0 };
- b->pins[11].gpio.pinmap = 43;
- b->pins[11].gpio.parent_id = 0;
- b->pins[11].gpio.mux_total = 2;
- b->pins[11].gpio.mux[0].pin = 262;
- b->pins[11].gpio.mux[0].value = 1;
- b->pins[11].gpio.mux[1].pin = 241;
- b->pins[11].gpio.mux[1].value = 0;
- b->pins[11].spi.pinmap = 5;
- b->pins[11].spi.mux_total = 2;
- b->pins[11].spi.mux[0].pin = 262;
- b->pins[11].spi.mux[0].value = 1;
- b->pins[11].spi.mux[1].pin = 241;
- b->pins[11].spi.mux[1].value = 1;
-
- strncpy(b->pins[12].name, "IO12", 8);
- b->pins[12].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 1, 0, 0, 0 };
- b->pins[12].gpio.pinmap = 42;
- b->pins[12].gpio.parent_id = 0;
- b->pins[12].gpio.mux_total = 1;
- b->pins[12].gpio.mux[0].pin = 242;
- b->pins[12].gpio.mux[0].value = 0;
- b->pins[12].spi.pinmap = 5;
- b->pins[12].spi.mux_total = 1;
- b->pins[12].spi.mux[0].pin = 242;
- b->pins[12].spi.mux[0].value = 1;
-
- strncpy(b->pins[13].name, "IO13", 8);
- b->pins[13].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 1, 0, 0, 0 };
- b->pins[13].gpio.pinmap = 40;
- b->pins[13].gpio.parent_id = 0;
- b->pins[13].gpio.mux_total = 1;
- b->pins[13].gpio.mux[0].pin = 243;
- b->pins[13].gpio.mux[0].value = 0;
- b->pins[13].spi.pinmap = 5;
- b->pins[13].spi.mux_total = 1;
- b->pins[13].spi.mux[0].pin = 243;
- b->pins[13].spi.mux[0].value = 1;
-
- strncpy(b->pins[14].name, "A0", 8);
- b->pins[14].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 1, 0 };
- b->pins[14].aio.pinmap = 0;
- b->pins[14].aio.mux_total = 1;
- b->pins[14].aio.mux[0].pin = 200;
- b->pins[14].aio.mux[0].value = 1;
- b->pins[14].gpio.pinmap = 44;
- b->pins[14].gpio.mux_total = 1;
- b->pins[14].gpio.mux[0].pin = 200;
- b->pins[14].gpio.mux[0].value = 0;
-
- strncpy(b->pins[15].name, "A1", 8);
- b->pins[15].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 1, 0 };
- b->pins[15].aio.pinmap = 1;
- b->pins[15].aio.mux_total = 1;
- b->pins[15].aio.mux[0].pin = 201;
- b->pins[15].aio.mux[0].value = 1;
- b->pins[15].gpio.pinmap = 45;
- b->pins[15].gpio.mux_total = 1;
- b->pins[15].gpio.mux[0].pin = 201;
- b->pins[15].gpio.mux[0].value = 0;
-
- strncpy(b->pins[16].name, "A2", 8);
- b->pins[16].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 1, 0 };
- b->pins[16].aio.pinmap = 2;
- b->pins[16].aio.mux_total = 1;
- b->pins[16].aio.mux[0].pin = 202;
- b->pins[16].aio.mux[0].value = 1;
- b->pins[16].gpio.pinmap = 46;
- b->pins[16].gpio.mux_total = 1;
- b->pins[16].gpio.mux[0].pin = 202;
- b->pins[16].gpio.mux[0].value = 0;
-
- strncpy(b->pins[17].name, "A3", 8);
- b->pins[17].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 1, 0 };
- b->pins[17].aio.pinmap = 3;
- b->pins[17].aio.mux_total = 1;
- b->pins[17].aio.mux[0].pin = 203;
- b->pins[17].aio.mux[0].value = 1;
- b->pins[17].gpio.pinmap = 47;
- b->pins[17].gpio.mux_total = 1;
- b->pins[17].gpio.mux[0].pin = 203;
- b->pins[17].gpio.mux[0].value = 0;
-
- strncpy(b->pins[18].name, "A4", 8);
- b->pins[18].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 1, 1, 0 };
- b->pins[18].i2c.pinmap = 1;
- b->pins[18].i2c.mux_total = 1;
- b->pins[18].i2c.mux[0].pin = 204;
- b->pins[18].i2c.mux[0].value = 0;
- b->pins[18].aio.pinmap = 4;
- b->pins[18].aio.mux_total = 1;
- b->pins[18].aio.mux[0].pin = 204;
- b->pins[18].aio.mux[0].value = 1;
- b->pins[18].gpio.pinmap = 14;
- b->pins[18].gpio.mux_total = 1;
- b->pins[18].gpio.mux[0].pin = 204;
- b->pins[18].gpio.mux[0].value = 0;
-
- strncpy(b->pins[19].name, "A5", 8);
- b->pins[19].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 1, 1, 0 };
- b->pins[19].i2c.pinmap = 1;
- b->pins[19].i2c.mux_total = 1;
- b->pins[19].i2c.mux[0].pin = 205;
- b->pins[19].i2c.mux[0].value = 0;
- b->pins[19].aio.pinmap = 5;
- b->pins[19].aio.mux_total = 1;
- b->pins[19].aio.mux[0].pin = 205;
- b->pins[19].aio.mux[0].value = 1;
- b->pins[19].gpio.pinmap = 165;
- b->pins[19].gpio.mux_total = 1;
- b->pins[19].gpio.mux[0].pin = 205;
- b->pins[19].gpio.mux[0].value = 0;
-
- // BUS DEFINITIONS
- b->i2c_bus_count = 9;
- b->def_i2c_bus = 6;
- int ici;
- for (ici = 0; ici < 9; ici++) {
- b->i2c_bus[ici].bus_id = -1;
- }
- b->i2c_bus[6].bus_id = 6;
- b->i2c_bus[6].sda = 18;
- b->i2c_bus[6].scl = 19;
-
- b->spi_bus_count = 1;
- b->def_spi_bus = 0;
- b->spi_bus[0].bus_id = 5;
- b->spi_bus[0].slave_s = 1;
- b->spi_bus[0].cs = 10;
- b->spi_bus[0].mosi = 11;
- b->spi_bus[0].miso = 12;
- b->spi_bus[0].sclk = 13;
-
- b->uart_dev_count = 1;
- b->def_uart_dev = 0;
- b->uart_dev[0].rx = 0;
- b->uart_dev[0].tx = 1;
- b->uart_dev[0].device_path = UART_DEV_PATH;
-
- int il;
- for (il = 0; il < MRAA_INTEL_EDISON_PINCOUNT; il++) {
- pinmodes[il].gpio.sysfs = -1;
- pinmodes[il].gpio.mode = -1;
- pinmodes[il].pwm.sysfs = -1;
- pinmodes[il].pwm.mode = -1;
- pinmodes[il].i2c.sysfs = -1;
- pinmodes[il].i2c.mode = -1;
- pinmodes[il].spi.sysfs = -1;
- pinmodes[il].spi.mode = -1;
- pinmodes[il].uart.sysfs = -1;
- pinmodes[il].uart.mode = -1;
- }
- pinmodes[0].gpio.sysfs = 130;
- pinmodes[0].gpio.mode = 0;
- pinmodes[0].uart.sysfs = 130;
- pinmodes[0].uart.mode = 1;
- pinmodes[1].gpio.sysfs = 131;
- pinmodes[1].gpio.mode = 0;
- pinmodes[1].uart.sysfs = 131;
- pinmodes[1].uart.mode = 1;
- pinmodes[2].gpio.sysfs = 128;
- pinmodes[2].gpio.mode = 0;
- pinmodes[2].uart.sysfs = 128;
- pinmodes[2].uart.mode = 1;
- pinmodes[3].gpio.sysfs = 12;
- pinmodes[3].gpio.mode = 0;
- pinmodes[3].pwm.sysfs = 12;
- pinmodes[3].pwm.mode = 1;
-
- pinmodes[4].gpio.sysfs = 129;
- pinmodes[4].gpio.mode = 0;
- pinmodes[4].uart.sysfs = 129;
- pinmodes[4].uart.mode = 1;
- pinmodes[5].gpio.sysfs = 13;
- pinmodes[5].gpio.mode = 0;
- pinmodes[5].pwm.sysfs = 13;
- pinmodes[5].pwm.mode = 1;
- pinmodes[6].gpio.sysfs = 182;
- pinmodes[6].gpio.mode = 0;
- pinmodes[6].pwm.sysfs = 182;
- pinmodes[6].pwm.mode = 1;
-
- // 7 and 8 are provided by something on i2c, very simplepinmodes[3].gpio.sysfs = 12;
- pinmodes[9].gpio.sysfs = 183;
- pinmodes[9].gpio.mode = 0;
- pinmodes[9].pwm.sysfs = 183;
- pinmodes[9].pwm.mode = 1;
-
- pinmodes[10].gpio.sysfs = 41;
- pinmodes[10].gpio.mode = 0;
- pinmodes[10].spi.sysfs = 111; // Different pin provides, switched at mux level.
- pinmodes[10].spi.mode = 1;
-
- pinmodes[11].gpio.sysfs = 43;
- pinmodes[11].gpio.mode = 0;
- pinmodes[11].spi.sysfs = 115; // Different pin provides, switched at mux level.
- pinmodes[11].spi.mode = 1;
-
- pinmodes[12].gpio.sysfs = 42;
- pinmodes[12].gpio.mode = 0;
- pinmodes[12].spi.sysfs = 114; // Different pin provides, switched at mux level.
- pinmodes[12].spi.mode = 1;
-
- pinmodes[13].gpio.sysfs = 40;
- pinmodes[13].gpio.mode = 0;
- pinmodes[13].spi.sysfs = 109; // Different pin provides, switched at mux level.
- pinmodes[13].spi.mode = 1;
- // Everything else but A4 A5 LEAVE
- pinmodes[18].gpio.sysfs = 14;
- pinmodes[18].gpio.mode = 0;
- pinmodes[18].i2c.sysfs = 28;
- pinmodes[18].i2c.mode = 1;
-
- pinmodes[19].gpio.sysfs = 165;
- pinmodes[19].gpio.mode = 0;
- pinmodes[19].i2c.sysfs = 27;
- pinmodes[19].i2c.mode = 1;
-
- return b;
-error:
- syslog(LOG_CRIT, "edison: Arduino board failed to initialise");
- free(b);
- return NULL;
-}
diff --git a/peripheral/libmraa/src/x86/intel_galileo_rev_d.c b/peripheral/libmraa/src/x86/intel_galileo_rev_d.c
deleted file mode 100644
index 36335f1..0000000
--- a/peripheral/libmraa/src/x86/intel_galileo_rev_d.c
+++ /dev/null
@@ -1,446 +0,0 @@
-/*
- * Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <sys/mman.h>
-#include <sys/ioctl.h>
-#include <linux/spi/spidev.h>
-
-#include "common.h"
-#include "x86/intel_galileo_rev_d.h"
-
-#define UIO_PATH "/dev/uio0"
-#define PLATFORM_NAME "Intel Galileo Gen 1"
-
-static uint8_t* mmap_reg = NULL;
-static int mmap_fd = 0;
-static int mmap_size = 0x1000;
-static unsigned int mmap_count = 0;
-
-static mraa_result_t
-mraa_intel_galileo_g1_mmap_unsetup()
-{
- if (mmap_reg == NULL) {
- syslog(LOG_WARNING, "galileo1: Mmap null register nothing to unsetup");
- return MRAA_ERROR_INVALID_RESOURCE;
- }
- munmap(mmap_reg, mmap_size);
- mmap_reg = NULL;
- close(mmap_fd);
- return MRAA_SUCCESS;
-}
-
-mraa_result_t
-mraa_intel_galileo_g1_mmap_write(mraa_gpio_context dev, int value)
-{
- int bitpos = plat->pins[dev->phy_pin].mmap.bit_pos;
- if (value) {
- *((unsigned*) mmap_reg) |= (1 << bitpos);
- return MRAA_SUCCESS;
- }
- *((unsigned*) mmap_reg) &= ~(1 << bitpos);
-
- return MRAA_SUCCESS;
-}
-
-mraa_result_t
-mraa_intel_galileo_g1_mmap_setup(mraa_gpio_context dev, mraa_boolean_t en)
-{
- if (dev == NULL) {
- syslog(LOG_ERR, "galileo1: Gpio context not valid");
- return MRAA_ERROR_INVALID_HANDLE;
- }
-
- if (mraa_pin_mode_test(dev->phy_pin, MRAA_PIN_FAST_GPIO) == 0) {
- syslog(LOG_WARNING, "galileo1: Mmap not available on this pin");
- return MRAA_ERROR_NO_RESOURCES;
- }
- if (en == 0) {
- if (dev->mmap_write == NULL) {
- syslog(LOG_NOTICE, "galileo1: Can't disable disabled mmap gpio");
- return MRAA_ERROR_INVALID_PARAMETER;
- }
- dev->mmap_write = NULL;
- mmap_count--;
- if (mmap_count == 0) {
- return mraa_intel_galileo_g1_mmap_unsetup();
- }
- return MRAA_SUCCESS;
- }
-
- if (dev->mmap_write != NULL) {
- syslog(LOG_ERR, "galileo1: Can't enable enabled mmap gpio");
- return MRAA_ERROR_INVALID_PARAMETER;
- }
- if (mmap_reg == NULL) {
- if ((mmap_fd = open(UIO_PATH, O_RDWR)) < 0) {
- syslog(LOG_ERR, "galileo1: Unable to open UIO device");
- return MRAA_ERROR_INVALID_RESOURCE;
- }
- mmap_reg = mmap(NULL, mmap_size, PROT_READ | PROT_WRITE, MAP_SHARED, mmap_fd, 0);
-
- if (mmap_reg == MAP_FAILED) {
- syslog(LOG_ERR, "galileo1: Mmap failed to mmap");
- mmap_reg = NULL;
- close(mmap_fd);
- return MRAA_ERROR_NO_RESOURCES;
- }
- }
- if (mraa_setup_mux_mapped(plat->pins[dev->phy_pin].mmap.gpio) != MRAA_SUCCESS) {
- syslog(LOG_ERR, "galileo1: Unable to setup required multiplexers for mmap");
- return MRAA_ERROR_INVALID_RESOURCE;
- }
- dev->mmap_write = &mraa_intel_galileo_g1_mmap_write;
-
- return MRAA_SUCCESS;
-}
-
-mraa_result_t
-mraa_intel_galileo_g1_spi_lsbmode_replace(mraa_spi_context dev, mraa_boolean_t lsb)
-{
- uint8_t lsb_mode = (uint8_t) lsb;
-
- // Galileo Gen1 doesn't support LSB_FIRST, we need to react appropriately
- if (!lsb) {
- if (ioctl(dev->devfd, SPI_IOC_WR_LSB_FIRST, &lsb_mode) < 0) {
- syslog(LOG_ERR, "spi: Failed to set bit order");
- return MRAA_ERROR_INVALID_RESOURCE;
- }
- if (ioctl(dev->devfd, SPI_IOC_RD_LSB_FIRST, &lsb_mode) < 0) {
- syslog(LOG_ERR, "spi: Failed to set bit order");
- return MRAA_ERROR_INVALID_RESOURCE;
- }
- } else {
- return MRAA_ERROR_FEATURE_NOT_SUPPORTED;
- }
-
- dev->lsb = lsb;
- return MRAA_SUCCESS;
-}
-
-mraa_board_t*
-mraa_intel_galileo_rev_d()
-{
- mraa_board_t* b = (mraa_board_t*) calloc(1, sizeof(mraa_board_t));
- if (b == NULL) {
- return NULL;
- }
-
- b->platform_name = PLATFORM_NAME;
- b->phy_pin_count = 20;
- b->gpio_count = 14;
- b->aio_count = 6;
- b->uart_dev_count = 2;
-
- b->adc_raw = 12;
- b->adc_supported = 10;
- b->pwm_default_period = 500;
- b->pwm_max_period = 7968;
- b->pwm_min_period = 1;
-
- b->adv_func = (mraa_adv_func_t*) calloc(1, sizeof(mraa_adv_func_t));
- if (b->adv_func == NULL) {
- goto error;
- }
- b->adv_func->gpio_mmap_setup = &mraa_intel_galileo_g1_mmap_setup;
- b->adv_func->spi_lsbmode_replace = &mraa_intel_galileo_g1_spi_lsbmode_replace;
-
- b->pins = (mraa_pininfo_t*) calloc(MRAA_INTEL_GALILEO_REV_D_PINCOUNT, sizeof(mraa_pininfo_t));
- if (b->pins == NULL) {
- free(b->adv_func);
- goto error;
- }
-
- // GPIO IO0 - IO10
- strncpy(b->pins[0].name, "IO0", 8);
- b->pins[0].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 1 };
- b->pins[0].gpio.pinmap = 50;
- b->pins[0].gpio.parent_id = 0;
- b->pins[0].gpio.mux_total = 1;
- b->pins[0].gpio.mux[0].pin = 40;
- b->pins[0].gpio.mux[0].value = 1;
- b->pins[0].uart.pinmap = 0;
- b->pins[0].uart.parent_id = 0;
- b->pins[0].uart.mux_total = 1;
- b->pins[0].uart.mux[0].pin = 40;
- b->pins[0].uart.mux[0].value = 0;
-
- strncpy(b->pins[1].name, "IO1", 8);
- b->pins[1].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 1 };
- b->pins[1].gpio.pinmap = 51;
- b->pins[1].gpio.mux_total = 1;
- b->pins[1].gpio.mux[0].pin = 41;
- b->pins[1].gpio.mux[0].value = 1;
- b->pins[1].uart.pinmap = 0;
- b->pins[1].uart.parent_id = 0;
- b->pins[1].uart.mux_total = 1;
- b->pins[1].uart.mux[0].pin = 41;
- b->pins[1].uart.mux[0].value = 0;
-
- strncpy(b->pins[2].name, "IO2", 8);
- b->pins[2].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 1, 0, 0, 0, 0 };
- b->pins[2].gpio.pinmap = 32;
- b->pins[2].gpio.mux_total = 1;
- b->pins[2].gpio.mux[0].pin = 31;
- b->pins[2].gpio.mux[0].value = 1;
- b->pins[2].mmap.gpio.pinmap = 14;
- strncpy(b->pins[2].mmap.mem_dev, "/dev/uio0", 12);
- b->pins[2].mmap.gpio.mux_total = 2;
- b->pins[2].mmap.gpio.mux[0].pin = 31;
- b->pins[2].mmap.gpio.mux[0].value = 0;
- b->pins[2].mmap.gpio.mux[1].pin = 14;
- b->pins[2].mmap.gpio.mux[1].value = 0;
- b->pins[2].mmap.mem_sz = 0x1000;
- b->pins[2].mmap.bit_pos = 6;
-
- strncpy(b->pins[3].name, "IO3", 8);
- b->pins[3].capabilites = (mraa_pincapabilities_t){ 1, 1, 1, 1, 0, 0, 0, 0 };
- b->pins[3].gpio.pinmap = 18;
- b->pins[3].gpio.mux_total = 1;
- b->pins[3].gpio.mux[0].pin = 30;
- b->pins[3].gpio.mux[0].value = 1;
- b->pins[3].mmap.gpio.pinmap = 15;
- strncpy(b->pins[3].mmap.mem_dev, "/dev/uio0", 12);
- b->pins[3].mmap.gpio.mux_total = 2;
- b->pins[3].mmap.gpio.mux[0].pin = 30;
- b->pins[3].mmap.gpio.mux[0].value = 0;
- b->pins[3].mmap.gpio.mux[1].pin = 15;
- b->pins[3].mmap.gpio.mux[1].value = 0;
- b->pins[3].mmap.mem_sz = 0x1000;
- b->pins[3].mmap.bit_pos = 7;
- b->pins[3].pwm.pinmap = 3;
- b->pins[3].pwm.parent_id = 0;
- b->pins[3].pwm.mux_total = 1;
- b->pins[3].pwm.mux[0].pin = 30;
- b->pins[3].pwm.mux[0].value = 1;
-
-
- strncpy(b->pins[4].name, "IO4", 8);
- b->pins[4].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[4].gpio.pinmap = 28;
- b->pins[4].gpio.mux_total = 0;
-
- strncpy(b->pins[5].name, "IO5", 8);
- b->pins[5].capabilites = (mraa_pincapabilities_t){ 1, 1, 1, 0, 0, 0, 0, 0 };
- b->pins[5].gpio.pinmap = 17;
- b->pins[5].gpio.mux_total = 0;
- b->pins[5].pwm.pinmap = 5;
- b->pins[5].pwm.parent_id = 0;
- b->pins[5].pwm.mux_total = 0;
-
- strncpy(b->pins[6].name, "IO6", 8);
- b->pins[6].gpio.pinmap = 24;
- b->pins[6].capabilites = (mraa_pincapabilities_t){ 1, 1, 1, 0, 0, 0, 0, 0 };
- b->pins[6].gpio.mux_total = 0;
- b->pins[6].pwm.pinmap = 6;
- b->pins[6].pwm.parent_id = 0;
- b->pins[6].pwm.mux_total = 0;
-
- strncpy(b->pins[7].name, "IO7", 8);
- b->pins[7].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[7].gpio.pinmap = 27;
- b->pins[7].gpio.mux_total = 0;
-
- strncpy(b->pins[8].name, "IO8", 8);
- b->pins[8].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
- b->pins[8].gpio.pinmap = 26;
- b->pins[8].gpio.mux_total = 0;
-
- strncpy(b->pins[9].name, "IO9", 8);
- b->pins[9].capabilites = (mraa_pincapabilities_t){ 1, 1, 1, 0, 0, 0, 0, 0 };
- b->pins[9].gpio.pinmap = 19;
- b->pins[9].gpio.mux_total = 0;
- b->pins[9].pwm.pinmap = 1;
- b->pins[9].pwm.parent_id = 0;
- b->pins[9].pwm.mux_total = 0;
-
- strncpy(b->pins[10].name, "IO10", 8);
- b->pins[10].capabilites = (mraa_pincapabilities_t){ 1, 1, 1, 0, 1, 0, 0, 0 };
- b->pins[10].gpio.pinmap = 16;
- b->pins[10].gpio.mux_total = 1;
- b->pins[10].gpio.mux[0].pin = 42;
- b->pins[10].gpio.mux[0].value = 1;
- b->pins[10].pwm.pinmap = 7;
- b->pins[10].pwm.parent_id = 0;
- b->pins[10].pwm.mux_total = 1;
- b->pins[10].pwm.mux[0].pin = 42;
- b->pins[10].pwm.mux[0].value = 1;
- b->pins[10].spi.pinmap = 1;
- b->pins[10].spi.mux_total = 1;
- b->pins[10].spi.mux[0].pin = 42;
- b->pins[10].spi.mux[0].value = 0;
-
- strncpy(b->pins[11].name, "IO11", 8);
- b->pins[11].capabilites = (mraa_pincapabilities_t){ 1, 1, 1, 0, 1, 0, 0, 0 };
- b->pins[11].gpio.pinmap = 25;
- b->pins[11].gpio.mux_total = 1;
- b->pins[11].gpio.mux[0].pin = 43;
- b->pins[11].gpio.mux[0].value = 1;
- b->pins[11].pwm.pinmap = 4;
- b->pins[11].pwm.parent_id = 0;
- b->pins[11].pwm.mux_total = 1;
- b->pins[11].pwm.mux[0].pin = 43;
- b->pins[11].pwm.mux[0].value = 1;
- b->pins[11].spi.pinmap = 1;
- b->pins[11].spi.mux_total = 1;
- b->pins[11].spi.mux[0].pin = 43;
- b->pins[11].spi.mux[0].value = 0;
-
- strncpy(b->pins[12].name, "IO12", 8);
- b->pins[12].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 1, 0, 0, 0 };
- b->pins[12].gpio.pinmap = 38;
- b->pins[12].gpio.mux_total = 1;
- b->pins[12].gpio.mux[0].pin = 54;
- b->pins[12].gpio.mux[0].value = 1;
- b->pins[12].spi.pinmap = 1;
- b->pins[12].spi.mux_total = 1;
- b->pins[12].spi.mux[0].pin = 54;
- b->pins[12].spi.mux[0].value = 0;
-
- strncpy(b->pins[13].name, "IO13", 8);
- b->pins[13].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 1, 0, 0, 0 };
- b->pins[13].gpio.pinmap = 39;
- b->pins[13].gpio.mux_total = 1;
- b->pins[13].gpio.mux[0].pin = 55;
- b->pins[13].gpio.mux[0].value = 1;
- b->pins[13].spi.pinmap = 1;
- b->pins[13].spi.mux_total = 1;
- b->pins[13].spi.mux[0].pin = 55;
- b->pins[13].spi.mux[0].value = 0;
-
- strncpy(b->pins[14].name, "A0", 8);
- b->pins[14].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 1, 0 };
- b->pins[14].gpio.pinmap = 44;
- b->pins[14].gpio.mux_total = 1;
- b->pins[14].gpio.mux[0].pin = 37;
- b->pins[14].gpio.mux[0].value = 1;
- b->pins[14].aio.pinmap = 0;
- b->pins[14].aio.mux_total = 1;
- b->pins[14].aio.mux[0].pin = 37;
- b->pins[14].aio.mux[0].value = 0;
-
- strncpy(b->pins[15].name, "A1", 8);
- b->pins[15].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 1, 0 };
- b->pins[15].gpio.pinmap = 45;
- b->pins[15].gpio.mux_total = 1;
- b->pins[15].gpio.mux[0].pin = 36;
- b->pins[15].gpio.mux[0].value = 1;
- b->pins[15].aio.pinmap = 1;
- b->pins[15].aio.mux_total = 1;
- b->pins[15].aio.mux[0].pin = 36;
- b->pins[15].aio.mux[0].value = 0;
-
- strncpy(b->pins[16].name, "A2", 8);
- b->pins[16].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 1, 0 };
- b->pins[16].gpio.pinmap = 46;
- b->pins[16].gpio.mux_total = 1;
- b->pins[16].gpio.mux[0].pin = 23;
- b->pins[16].gpio.mux[0].value = 1;
- b->pins[16].aio.pinmap = 2;
- b->pins[16].aio.mux_total = 1;
- b->pins[16].aio.mux[0].pin = 23;
- b->pins[16].aio.mux[0].value = 0;
-
- strncpy(b->pins[17].name, "A3", 8);
- b->pins[17].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 1, 0 };
- b->pins[17].gpio.pinmap = 47;
- b->pins[17].gpio.mux_total = 1;
- b->pins[17].gpio.mux[0].pin = 22;
- b->pins[17].gpio.mux[0].value = 1;
- b->pins[17].aio.pinmap = 3;
- b->pins[17].aio.mux_total = 1;
- b->pins[17].aio.mux[0].pin = 22;
- b->pins[17].aio.mux[0].value = 0;
-
- strncpy(b->pins[18].name, "A4", 8);
- b->pins[18].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 1, 1, 0 };
- b->pins[18].gpio.pinmap = 48;
- b->pins[18].gpio.mux_total = 2;
- b->pins[18].gpio.mux[0].pin = 29;
- b->pins[18].gpio.mux[0].value = 1;
- b->pins[18].gpio.mux[1].pin = 21;
- b->pins[18].gpio.mux[1].value = 1;
- b->pins[18].i2c.pinmap = 1;
- b->pins[18].i2c.mux_total = 1;
- b->pins[18].i2c.mux[0].pin = 29;
- b->pins[18].i2c.mux[0].value = 0;
- b->pins[18].aio.pinmap = 4;
- b->pins[18].aio.mux_total = 2;
- b->pins[18].aio.mux[0].pin = 29;
- b->pins[18].aio.mux[0].value = 1;
- b->pins[18].aio.mux[1].pin = 21;
- b->pins[18].aio.mux[1].value = 0;
-
- strncpy(b->pins[19].name, "A5", 8);
- b->pins[19].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 1, 1, 0 };
- b->pins[19].gpio.pinmap = 49;
- b->pins[19].gpio.mux_total = 2;
- b->pins[19].gpio.mux[0].pin = 29;
- b->pins[19].gpio.mux[0].value = 1;
- b->pins[19].gpio.mux[1].pin = 20;
- b->pins[19].gpio.mux[1].value = 1;
- b->pins[19].i2c.pinmap = 1;
- b->pins[19].i2c.mux_total = 1;
- b->pins[19].i2c.mux[0].pin = 29;
- b->pins[19].i2c.mux[0].value = 0;
- b->pins[19].aio.pinmap = 5;
- b->pins[19].aio.mux_total = 2;
- b->pins[19].aio.mux[0].pin = 29;
- b->pins[19].aio.mux[0].value = 1;
- b->pins[19].aio.mux[1].pin = 20;
- b->pins[19].aio.mux[1].value = 0;
-
- // BUS DEFINITIONS
- b->i2c_bus_count = 1;
- b->def_i2c_bus = 0;
- b->i2c_bus[0].bus_id = 0;
- b->i2c_bus[0].sda = 18;
- b->i2c_bus[0].scl = 19;
-
- b->spi_bus_count = 1;
- b->def_spi_bus = 0;
- b->spi_bus[0].bus_id = 1;
- b->spi_bus[0].slave_s = 0;
- b->spi_bus[0].cs = 10;
- b->spi_bus[0].mosi = 11;
- b->spi_bus[0].miso = 12;
- b->spi_bus[0].sclk = 13;
-
- b->uart_dev_count = 2;
- b->def_uart_dev = 0;
- b->uart_dev[0].rx = 0;
- b->uart_dev[0].tx = 1;
- b->uart_dev[0].device_path = "/dev/ttyS0";
-
- b->uart_dev[1].rx = -1;
- b->uart_dev[1].tx = -1;
- b->uart_dev[1].device_path = "/dev/ttyS1";
-
- return b;
-error:
- syslog(LOG_CRIT, "galileo1: Platform failed to initialise");
- free(b);
- return NULL;
-}
diff --git a/peripheral/libmraa/src/x86/intel_galileo_rev_g.c b/peripheral/libmraa/src/x86/intel_galileo_rev_g.c
deleted file mode 100644
index 9c6583c..0000000
--- a/peripheral/libmraa/src/x86/intel_galileo_rev_g.c
+++ /dev/null
@@ -1,761 +0,0 @@
-/*
- * Author: Brendan Le Foll <brendan.le.foll@intel.com>
- * Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <sys/mman.h>
-
-#include "common.h"
-#include "x86/intel_galileo_rev_g.h"
-
-#define MAX_SIZE 64
-#define SYSFS_CLASS_GPIO "/sys/class/gpio"
-#define PLATFORM_NAME "Intel Galileo Gen 2"
-
-#define UIO_PATH "/dev/uio0"
-
-static uint8_t* mmap_reg = NULL;
-static int mmap_fd = 0;
-static int mmap_size = 0x1000;
-static unsigned int mmap_count = 0;
-
-static unsigned int pullup_map[] = { 33, 29, 35, 17, 37, 19, 21, 39, 41, 23,
- 27, 25, 43, 31, 49, 51, 53, 55, 57, 59 };
-
-static mraa_gpio_context agpioOutputen[MRAA_INTEL_GALILEO_GEN_2_PINCOUNT];
-
-mraa_result_t
-mraa_intel_galileo_gen2_dir_pre(mraa_gpio_context dev, mraa_gpio_dir_t dir)
-{
- if (dev->phy_pin >= 0) {
- int pin = dev->phy_pin;
- if (plat->pins[pin].gpio.complex_cap.complex_pin != 1)
- return MRAA_SUCCESS;
-
- if (plat->pins[pin].gpio.complex_cap.output_en == 1) {
- if (!agpioOutputen[pin]) {
- agpioOutputen[pin] = mraa_gpio_init_raw(plat->pins[pin].gpio.output_enable);
- if (agpioOutputen[pin] == NULL) {
- return MRAA_ERROR_INVALID_RESOURCE;
- }
- if (mraa_gpio_dir(agpioOutputen[pin], MRAA_GPIO_OUT) != MRAA_SUCCESS) {
- return MRAA_ERROR_INVALID_RESOURCE;
- }
- }
-
- int output_val = 1;
- if (dir == MRAA_GPIO_OUT) {
- output_val = 0;
- }
- if (mraa_gpio_write(agpioOutputen[pin], output_val) != MRAA_SUCCESS) {
- return MRAA_ERROR_INVALID_RESOURCE;
- }
- }
- }
- return MRAA_SUCCESS;
-}
-
-mraa_result_t
-mraa_intel_galileo_gen2_gpio_close_pre(mraa_gpio_context dev)
-{
- if (dev->phy_pin >= 0) {
- int pin = dev->phy_pin;
- if (agpioOutputen[pin]) {
- mraa_gpio_close(agpioOutputen[pin]);
- agpioOutputen[pin] = NULL;
- }
- }
- return MRAA_SUCCESS;
-}
-
-mraa_result_t
-mraa_intel_galileo_gen2_i2c_init_pre(unsigned int bus)
-{
- mraa_gpio_context io18 = mraa_gpio_init_raw(57);
- int status = 0;
-
- if (io18 == NULL) {
- return MRAA_ERROR_UNSPECIFIED;
- }
- status += mraa_gpio_dir(io18, MRAA_GPIO_IN);
- status += mraa_gpio_mode(io18, MRAA_GPIO_HIZ);
- mraa_gpio_close(io18);
-
- mraa_gpio_context io19 = mraa_gpio_init_raw(59);
- if (io19 == NULL) {
- return MRAA_ERROR_UNSPECIFIED;
- }
- status += mraa_gpio_dir(io19, MRAA_GPIO_IN);
- status += mraa_gpio_mode(io19, MRAA_GPIO_HIZ);
- mraa_gpio_close(io19);
-
- if (status > 0) {
- return MRAA_ERROR_UNSPECIFIED;
- }
- return MRAA_SUCCESS;
-}
-
-mraa_result_t
-mraa_intel_galileo_gen2_pwm_period_replace(mraa_pwm_context dev, int period)
-{
- char bu[MAX_SIZE];
- snprintf(bu, MAX_SIZE, "/sys/class/pwm/pwmchip%d/device/pwm_period", dev->chipid);
-
- int period_f = open(bu, O_RDWR);
- if (period_f == -1) {
- syslog(LOG_ERR, "galileo2: Failed to open period for writing!");
- return MRAA_ERROR_INVALID_RESOURCE;
- }
- char out[MAX_SIZE];
- int length = snprintf(out, MAX_SIZE, "%d", period);
- if (write(period_f, out, length * sizeof(char)) == -1) {
- close(period_f);
- return MRAA_ERROR_INVALID_RESOURCE;
- }
-
- close(period_f);
- return MRAA_SUCCESS;
-}
-
-mraa_result_t
-mraa_intel_galileo_gen2_gpio_mode_replace(mraa_gpio_context dev, mraa_gpio_mode_t mode)
-{
- if (dev->value_fp != -1) {
- close(dev->value_fp);
- dev->value_fp = -1;
- }
-
- mraa_gpio_context pullup_e;
- pullup_e = mraa_gpio_init_raw(pullup_map[dev->phy_pin]);
- if (pullup_e == NULL) {
- return MRAA_ERROR_INVALID_RESOURCE;
- }
- if (mraa_gpio_dir(pullup_e, MRAA_GPIO_IN) != MRAA_SUCCESS) {
- mraa_gpio_close(pullup_e);
- syslog(LOG_ERR, "galileo2: Failed to set gpio pullup");
- return MRAA_ERROR_INVALID_RESOURCE;
- }
-
- char filepath[MAX_SIZE];
- snprintf(filepath, MAX_SIZE, SYSFS_CLASS_GPIO "/gpio%d/drive", pullup_map[dev->phy_pin]);
-
- int drive = open(filepath, O_WRONLY);
- if (drive == -1) {
- syslog(LOG_ERR, "galileo2: Failed to open drive for writing");
- return MRAA_ERROR_INVALID_RESOURCE;
- }
-
- char bu[MAX_SIZE];
- int length;
- int value = -1;
- switch (mode) {
- case MRAA_GPIO_STRONG:
- length = snprintf(bu, sizeof(bu), "hiz");
- break;
- case MRAA_GPIO_PULLUP:
- length = snprintf(bu, sizeof(bu), "strong");
- value = 1;
- break;
- case MRAA_GPIO_PULLDOWN:
- length = snprintf(bu, sizeof(bu), "pulldown");
- value = 0;
- break;
- case MRAA_GPIO_HIZ:
- close(drive);
- return MRAA_SUCCESS;
- break;
- default:
- close(drive);
- return MRAA_ERROR_FEATURE_NOT_IMPLEMENTED;
- }
- if (write(drive, bu, length * sizeof(char)) == -1) {
- syslog(LOG_ERR, "galileo2: Failed to write to drive mode");
- close(drive);
- mraa_gpio_close(pullup_e);
- return MRAA_ERROR_INVALID_RESOURCE;
- }
- if (value != -1) {
- mraa_result_t ret = mraa_gpio_dir(pullup_e, MRAA_GPIO_OUT);
- ret += mraa_gpio_write(pullup_e, value);
- if (ret != MRAA_SUCCESS) {
- syslog(LOG_ERR, "galileo2: Error Setting pullup");
- close(drive);
- return MRAA_ERROR_INVALID_RESOURCE;
- }
- }
-
- mraa_gpio_close(pullup_e);
- close(drive);
- return MRAA_SUCCESS;
-}
-
-mraa_result_t
-mraa_intel_galileo_gen2_uart_init_pre(int index)
-{
- mraa_gpio_context io0_output = mraa_gpio_init_raw(32);
- if (io0_output == NULL) {
- return MRAA_ERROR_INVALID_RESOURCE;
- }
- mraa_gpio_context io1_output = mraa_gpio_init_raw(28);
- if (io1_output == NULL) {
- mraa_gpio_close(io0_output);
- return MRAA_ERROR_INVALID_RESOURCE;
- }
-
- int status = 0;
- status += mraa_gpio_dir(io0_output, MRAA_GPIO_OUT);
- status += mraa_gpio_dir(io1_output, MRAA_GPIO_OUT);
-
- status += mraa_gpio_write(io0_output, 1);
- status += mraa_gpio_write(io1_output, 0);
-
- mraa_gpio_close(io0_output);
- mraa_gpio_close(io1_output);
-
- if (status > 0) {
- return MRAA_ERROR_UNSPECIFIED;
- }
- return MRAA_SUCCESS;
-}
-
-static mraa_result_t
-mraa_intel_galileo_g2_mmap_unsetup()
-{
- if (mmap_reg == NULL) {
- syslog(LOG_ERR, "mmap: null register cant unsetup");
- return MRAA_ERROR_INVALID_RESOURCE;
- }
- munmap(mmap_reg, mmap_size);
- mmap_reg = NULL;
- close(mmap_fd);
- return MRAA_SUCCESS;
-}
-
-mraa_result_t
-mraa_intel_galileo_g2_mmap_write(mraa_gpio_context dev, int value)
-{
- int bitpos = plat->pins[dev->phy_pin].mmap.bit_pos;
- if (value) {
- *((unsigned*) mmap_reg) |= (1 << bitpos);
- return MRAA_SUCCESS;
- }
- *((unsigned*) mmap_reg) &= ~(1 << bitpos);
-
- return MRAA_SUCCESS;
-}
-
-mraa_result_t
-mraa_intel_galileo_g2_mmap_setup(mraa_gpio_context dev, mraa_boolean_t en)
-{
- if (dev == NULL) {
- syslog(LOG_ERR, "Galileo mmap: context not valid");
- return MRAA_ERROR_INVALID_HANDLE;
- }
-
- if (mraa_pin_mode_test(dev->phy_pin, MRAA_PIN_FAST_GPIO) == 0) {
- syslog(LOG_ERR, "Galileo mmap: mmap not on this pin");
- return MRAA_ERROR_NO_RESOURCES;
- }
- if (en == 0) {
- if (dev->mmap_write == NULL) {
- syslog(LOG_ERR, "mmap: can't disable disabled mmap gpio");
- return MRAA_ERROR_INVALID_PARAMETER;
- }
- dev->mmap_write = NULL;
- mmap_count--;
- if (mmap_count == 0) {
- return mraa_intel_galileo_g2_mmap_unsetup();
- }
- return MRAA_SUCCESS;
- }
-
- if (dev->mmap_write != NULL) {
- syslog(LOG_ERR, "mmap: can't enable enabled mmap gpio");
- return MRAA_ERROR_INVALID_PARAMETER;
- }
- if (mmap_reg == NULL) {
- if ((mmap_fd = open(UIO_PATH, O_RDWR)) < 0) {
- syslog(LOG_ERR, "mmap: Unable to open UIO device");
- return MRAA_ERROR_INVALID_RESOURCE;
- }
- mmap_reg = mmap(NULL, mmap_size, PROT_READ | PROT_WRITE, MAP_SHARED, mmap_fd, 0);
-
- if (mmap_reg == MAP_FAILED) {
- syslog(LOG_ERR, "mmap: failed to mmap");
- mmap_reg = NULL;
- close(mmap_fd);
- return MRAA_ERROR_NO_RESOURCES;
- }
- }
- if (mraa_setup_mux_mapped(plat->pins[dev->phy_pin].mmap.gpio) != MRAA_SUCCESS) {
- syslog(LOG_ERR, "mmap: unable to setup required multiplexers");
- return MRAA_ERROR_INVALID_RESOURCE;
- }
- dev->mmap_write = &mraa_intel_galileo_g2_mmap_write;
- return MRAA_SUCCESS;
-}
-
-mraa_board_t*
-mraa_intel_galileo_gen2()
-{
- mraa_board_t* b = (mraa_board_t*) calloc(1, sizeof(mraa_board_t));
- if (b == NULL) {
- return NULL;
- }
-
- b->platform_name = PLATFORM_NAME;
- b->phy_pin_count = 20;
- b->gpio_count = 14;
- b->aio_count = 6;
- b->adc_raw = 12;
- b->adc_supported = 10;
- b->pwm_default_period = 5000;
- b->pwm_max_period = 41666;
- b->pwm_min_period = 666;
-
- b->adv_func = (mraa_adv_func_t*) calloc(1, sizeof(mraa_adv_func_t));
- if (b->adv_func == NULL) {
- goto error;
- }
- b->adv_func->gpio_close_pre = &mraa_intel_galileo_gen2_gpio_close_pre;
- b->adv_func->gpio_dir_pre = &mraa_intel_galileo_gen2_dir_pre;
- b->adv_func->i2c_init_pre = &mraa_intel_galileo_gen2_i2c_init_pre;
- b->adv_func->pwm_period_replace = &mraa_intel_galileo_gen2_pwm_period_replace;
- b->adv_func->gpio_mode_replace = &mraa_intel_galileo_gen2_gpio_mode_replace;
- b->adv_func->uart_init_pre = &mraa_intel_galileo_gen2_uart_init_pre;
- b->adv_func->gpio_mmap_setup = &mraa_intel_galileo_g2_mmap_setup;
-
- b->pins = (mraa_pininfo_t*) calloc(MRAA_INTEL_GALILEO_GEN_2_PINCOUNT, sizeof(mraa_pininfo_t));
- if (b->pins == NULL) {
- free(b->adv_func);
- goto error;
- }
-
- strncpy(b->pins[0].name, "IO0", 8);
- b->pins[0].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 1, 0, 0, 0, 1 };
- b->pins[0].gpio.pinmap = 11;
- b->pins[0].gpio.parent_id = 0;
- b->pins[0].gpio.mux_total = 0;
- b->pins[0].gpio.complex_cap = (mraa_pin_cap_complex_t){ 1, 1, 0, 1, 1 };
- b->pins[0].gpio.output_enable = 32;
- b->pins[0].gpio.pullup_enable = 33;
- b->pins[0].mmap.gpio.pinmap = 11;
- strncpy(b->pins[0].mmap.mem_dev, "/dev/uio0", 12);
- b->pins[0].mmap.gpio.mux_total = 2;
- b->pins[0].mmap.gpio.mux[0].pin = 32;
- b->pins[0].mmap.gpio.mux[0].value = 0;
- b->pins[0].mmap.gpio.mux[1].pin = 11;
- b->pins[0].mmap.gpio.mux[1].value = 0;
- b->pins[0].mmap.mem_sz = 0x1000;
- b->pins[0].mmap.bit_pos = 3;
- b->pins[0].uart.parent_id = 0;
- b->pins[0].uart.mux_total = 0;
-
- strncpy(b->pins[1].name, "IO1", 8);
- b->pins[1].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 1, 0, 0, 0, 1 };
- b->pins[1].gpio.pinmap = 12;
- b->pins[1].gpio.parent_id = 0;
- b->pins[1].gpio.mux_total = 1;
- b->pins[1].gpio.mux[0].pin = 45;
- b->pins[1].gpio.mux[0].value = 0;
- b->pins[1].gpio.complex_cap = (mraa_pin_cap_complex_t){ 1, 1, 0, 1, 1 };
- b->pins[1].gpio.output_enable = 28;
- b->pins[1].gpio.pullup_enable = 29;
- b->pins[1].mmap.gpio.pinmap = 12;
- strncpy(b->pins[1].mmap.mem_dev, "/dev/uio0", 12);
- b->pins[1].mmap.gpio.mux_total = 3;
- b->pins[1].mmap.gpio.mux[0].pin = 45;
- b->pins[1].mmap.gpio.mux[0].value = 0;
- b->pins[1].mmap.gpio.mux[1].pin = 28;
- b->pins[1].mmap.gpio.mux[1].value = 0;
- b->pins[1].mmap.gpio.mux[2].pin = 12;
- b->pins[1].mmap.gpio.mux[2].value = 0;
- b->pins[1].mmap.mem_sz = 0x1000;
- b->pins[1].mmap.bit_pos = 4;
- b->pins[1].uart.parent_id = 0;
- b->pins[1].uart.mux_total = 1;
- b->pins[1].uart.mux[0].pin = 45;
- b->pins[1].uart.mux[0].value = 1;
-
- strncpy(b->pins[2].name, "IO2", 8);
- b->pins[2].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 1, 0, 0, 0 };
- b->pins[2].gpio.pinmap = 13;
- b->pins[2].gpio.parent_id = 0;
- b->pins[2].gpio.mux_total = 1;
- b->pins[2].gpio.mux[0].pin = 77;
- b->pins[2].gpio.mux[0].value = 0;
- b->pins[2].gpio.complex_cap = (mraa_pin_cap_complex_t){ 1, 1, 0, 1, 1 };
- b->pins[2].gpio.output_enable = 34;
- b->pins[2].gpio.pullup_enable = 35;
- b->pins[2].mmap.gpio.pinmap = 13;
- strncpy(b->pins[2].mmap.mem_dev, "/dev/uio0", 12);
- b->pins[2].mmap.gpio.mux_total = 3;
- b->pins[2].mmap.gpio.mux[0].pin = 77;
- b->pins[2].mmap.gpio.mux[0].value = 0;
- b->pins[2].mmap.gpio.mux[1].pin = 34;
- b->pins[2].mmap.gpio.mux[1].value = 0;
- b->pins[2].mmap.gpio.mux[2].pin = 13;
- b->pins[2].mmap.gpio.mux[2].value = 0;
- b->pins[2].mmap.mem_sz = 0x1000;
- b->pins[2].mmap.bit_pos = 5;
-
- strncpy(b->pins[3].name, "IO3", 8);
- b->pins[3].capabilites = (mraa_pincapabilities_t){ 1, 1, 1, 1, 0, 0, 0 };
- b->pins[3].gpio.pinmap = 14;
- b->pins[3].gpio.parent_id = 0;
- b->pins[3].gpio.mux_total = 2;
- b->pins[3].gpio.mux[0].pin = 76;
- b->pins[3].gpio.mux[0].value = 0;
- b->pins[3].gpio.mux[1].pin = 64;
- b->pins[3].gpio.mux[1].value = 0;
- b->pins[3].gpio.complex_cap = (mraa_pin_cap_complex_t){ 1, 1, 0, 1, 1 };
- b->pins[3].gpio.output_enable = 16;
- b->pins[3].gpio.pullup_enable = 17;
- b->pins[3].pwm.pinmap = 1;
- b->pins[3].pwm.parent_id = 0;
- b->pins[3].pwm.mux_total = 3;
- b->pins[3].pwm.mux[0].pin = 76;
- b->pins[3].pwm.mux[0].value = 0;
- b->pins[3].pwm.mux[1].pin = 64;
- b->pins[3].pwm.mux[1].value = 1;
- b->pins[3].pwm.mux[2].pin = 16;
- b->pins[3].pwm.mux[2].value = 0;
- b->pins[3].mmap.gpio.pinmap = 14;
- strncpy(b->pins[3].mmap.mem_dev, "/dev/uio0", 12);
- b->pins[3].mmap.gpio.mux_total = 4;
- b->pins[3].mmap.gpio.mux[0].pin = 76;
- b->pins[3].mmap.gpio.mux[0].value = 0;
- b->pins[3].mmap.gpio.mux[1].pin = 64;
- b->pins[3].mmap.gpio.mux[1].value = 0;
- b->pins[3].mmap.gpio.mux[2].pin = 16;
- b->pins[3].mmap.gpio.mux[2].value = 0;
- b->pins[3].mmap.gpio.mux[3].pin = 14;
- b->pins[3].mmap.gpio.mux[3].value = 0;
- b->pins[3].mmap.mem_sz = 0x1000;
- b->pins[3].mmap.bit_pos = 6;
-
- strncpy(b->pins[4].name, "IO4", 8);
- b->pins[4].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0 };
- b->pins[4].gpio.pinmap = 6;
- b->pins[4].gpio.parent_id = 0;
- b->pins[4].gpio.mux_total = 0;
- b->pins[4].gpio.complex_cap = (mraa_pin_cap_complex_t){ 1, 1, 0, 1, 1 };
- b->pins[4].gpio.output_enable = 36;
- b->pins[4].gpio.pullup_enable = 37;
-
- strncpy(b->pins[5].name, "IO5", 8);
- b->pins[5].capabilites = (mraa_pincapabilities_t){ 1, 1, 1, 0, 0, 0, 0 };
- b->pins[5].gpio.pinmap = 0;
- b->pins[5].gpio.parent_id = 0;
- b->pins[5].gpio.mux_total = 1;
- b->pins[5].gpio.mux[0].pin = 66;
- b->pins[5].gpio.mux[0].value = 0;
- b->pins[5].gpio.complex_cap = (mraa_pin_cap_complex_t){ 1, 1, 0, 1, 1 };
- b->pins[5].gpio.output_enable = 18;
- b->pins[5].gpio.pullup_enable = 19;
- b->pins[5].pwm.pinmap = 3;
- b->pins[5].pwm.parent_id = 0;
- b->pins[5].pwm.mux_total = 2;
- b->pins[5].pwm.mux[0].pin = 66;
- b->pins[5].pwm.mux[0].value = 1;
- b->pins[5].pwm.mux[1].pin = 18;
- b->pins[5].pwm.mux[1].value = 0;
-
- strncpy(b->pins[6].name, "IO6", 8);
- b->pins[6].capabilites = (mraa_pincapabilities_t){ 1, 1, 1, 0, 0, 0, 0 };
- b->pins[6].gpio.pinmap = 1;
- b->pins[6].gpio.parent_id = 0;
- b->pins[6].gpio.mux_total = 1;
- b->pins[6].gpio.mux[0].pin = 68;
- b->pins[6].gpio.mux[0].value = 0;
- b->pins[6].gpio.complex_cap = (mraa_pin_cap_complex_t){ 1, 1, 0, 1, 1 };
- b->pins[6].gpio.output_enable = 20;
- b->pins[6].gpio.pullup_enable = 21;
- b->pins[6].pwm.pinmap = 5;
- b->pins[6].pwm.parent_id = 0;
- b->pins[6].pwm.mux_total = 2;
- b->pins[6].pwm.mux[0].pin = 68;
- b->pins[6].pwm.mux[0].value = 1;
- b->pins[6].pwm.mux[1].pin = 20;
- b->pins[6].pwm.mux[1].value = 0;
-
- strncpy(b->pins[7].name, "IO7", 8);
- b->pins[7].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0 };
- b->pins[7].gpio.pinmap = 38;
- b->pins[7].gpio.parent_id = 0;
- b->pins[7].gpio.mux_total = 0;
- b->pins[7].gpio.complex_cap = (mraa_pin_cap_complex_t){ 1, 0, 0, 1, 1 };
- b->pins[7].gpio.pullup_enable = 39;
-
- strncpy(b->pins[8].name, "IO8", 8);
- b->pins[8].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0 };
- b->pins[8].gpio.pinmap = 40;
- b->pins[8].gpio.parent_id = 0;
- b->pins[8].gpio.mux_total = 0;
- b->pins[8].gpio.complex_cap = (mraa_pin_cap_complex_t){ 1, 0, 0, 1, 1 };
- b->pins[8].gpio.pullup_enable = 41;
-
- strncpy(b->pins[9].name, "IO9", 8);
- b->pins[9].capabilites = (mraa_pincapabilities_t){ 1, 1, 1, 0, 0, 0, 0 };
- b->pins[9].gpio.pinmap = 4;
- b->pins[9].gpio.parent_id = 0;
- b->pins[9].gpio.mux_total = 1;
- b->pins[9].gpio.mux[0].pin = 70;
- b->pins[9].gpio.mux[0].value = 0;
- b->pins[9].gpio.complex_cap = (mraa_pin_cap_complex_t){ 1, 1, 0, 1, 1 };
- b->pins[9].gpio.output_enable = 22;
- b->pins[9].gpio.pullup_enable = 23;
- b->pins[9].pwm.pinmap = 7;
- b->pins[9].pwm.parent_id = 0;
- b->pins[9].pwm.mux_total = 2;
- b->pins[9].pwm.mux[0].pin = 70;
- b->pins[9].pwm.mux[0].value = 1;
- b->pins[9].pwm.mux[1].pin = 22;
- b->pins[9].pwm.mux[1].value = 0;
-
- strncpy(b->pins[10].name, "IO10", 8);
- b->pins[10].capabilites = (mraa_pincapabilities_t){ 1, 1, 1, 1, 1, 0, 0 };
- b->pins[10].gpio.pinmap = 10;
- b->pins[10].gpio.parent_id = 0;
- b->pins[10].gpio.mux_total = 1;
- b->pins[10].gpio.mux[0].pin = 74;
- b->pins[10].gpio.mux[0].value = 0;
- b->pins[10].gpio.complex_cap = (mraa_pin_cap_complex_t){ 1, 1, 0, 1, 1 };
- b->pins[10].gpio.output_enable = 26;
- b->pins[10].gpio.pullup_enable = 27;
- b->pins[10].pwm.pinmap = 11;
- b->pins[10].pwm.parent_id = 0;
- b->pins[10].pwm.mux_total = 2;
- b->pins[10].pwm.mux[0].pin = 74;
- b->pins[10].pwm.mux[0].value = 1;
- b->pins[10].pwm.mux[1].pin = 26;
- b->pins[10].pwm.mux[1].value = 0;
- b->pins[10].mmap.gpio.pinmap = 10;
- strncpy(b->pins[10].mmap.mem_dev, "/dev/uio0", 12);
- b->pins[10].mmap.gpio.mux_total = 3;
- b->pins[10].mmap.gpio.mux[0].pin = 74;
- b->pins[10].mmap.gpio.mux[0].value = 0;
- b->pins[10].mmap.gpio.mux[1].pin = 26;
- b->pins[10].mmap.gpio.mux[1].value = 0;
- b->pins[10].mmap.gpio.mux[2].pin = 10;
- b->pins[10].mmap.gpio.mux[2].value = 0;
- b->pins[10].mmap.mem_sz = 0x1000;
- b->pins[10].mmap.bit_pos = 2;
- b->pins[10].spi.parent_id = 1;
- b->pins[10].spi.mux_total = 1;
- b->pins[10].spi.mux[0].pin = 74;
- b->pins[10].spi.mux[0].value = 0;
-
- strncpy(b->pins[11].name, "IO11", 8);
- b->pins[11].capabilites = (mraa_pincapabilities_t){ 1, 1, 1, 0, 1, 0, 0 };
- b->pins[11].gpio.pinmap = 5;
- b->pins[11].gpio.parent_id = 0;
- b->pins[11].gpio.mux_total = 2;
- b->pins[11].gpio.mux[0].pin = 72;
- b->pins[11].gpio.mux[0].value = 0;
- b->pins[11].gpio.mux[1].pin = 44;
- b->pins[11].gpio.mux[1].value = 0;
- b->pins[11].gpio.complex_cap = (mraa_pin_cap_complex_t){ 1, 1, 0, 1, 1 };
- b->pins[11].gpio.output_enable = 24;
- b->pins[11].gpio.pullup_enable = 25;
- b->pins[11].pwm.pinmap = 9;
- b->pins[11].pwm.parent_id = 0;
- b->pins[11].pwm.mux_total = 3;
- b->pins[11].pwm.mux[0].pin = 72;
- b->pins[11].pwm.mux[0].value = 1;
- b->pins[11].pwm.mux[1].pin = 44;
- b->pins[11].pwm.mux[1].value = 0;
- b->pins[11].pwm.mux[2].pin = 24;
- b->pins[11].pwm.mux[2].value = 0;
- b->pins[11].spi.pinmap = 1;
- b->pins[11].spi.mux_total = 3;
- b->pins[11].spi.mux[0].pin = 72;
- b->pins[11].spi.mux[0].value = 0;
- b->pins[11].spi.mux[1].pin = 44;
- b->pins[11].spi.mux[1].value = 1;
- b->pins[11].spi.mux[2].pin = 24;
- b->pins[11].spi.mux[2].value = 0;
-
- strncpy(b->pins[12].name, "IO12", 8);
- b->pins[12].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 1, 1, 0, 0 };
- b->pins[12].gpio.pinmap = 15;
- b->pins[12].gpio.parent_id = 0;
- b->pins[12].gpio.mux_total = 0;
- b->pins[12].gpio.complex_cap = (mraa_pin_cap_complex_t){ 1, 1, 0, 1, 1 };
- b->pins[12].gpio.output_enable = 42;
- b->pins[12].gpio.pullup_enable = 43;
- b->pins[12].spi.pinmap = 1;
- b->pins[12].spi.mux_total = 1;
- b->pins[12].spi.mux[0].pin = 42;
- b->pins[12].spi.mux[0].value = 1;
- b->pins[12].mmap.gpio.pinmap = 15;
- strncpy(b->pins[12].mmap.mem_dev, "/dev/uio0", 12);
- b->pins[12].mmap.gpio.mux_total = 2;
- b->pins[12].mmap.gpio.mux[0].pin = 42;
- b->pins[12].mmap.gpio.mux[0].value = 0;
- b->pins[12].mmap.gpio.mux[1].pin = 15;
- b->pins[12].mmap.gpio.mux[1].value = 0;
- b->pins[12].mmap.mem_sz = 0x1000;
- b->pins[12].mmap.bit_pos = 7;
-
- strncpy(b->pins[13].name, "IO13", 8);
- b->pins[13].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 1, 0, 0 };
- b->pins[13].gpio.pinmap = 7;
- b->pins[13].gpio.parent_id = 0;
- b->pins[13].gpio.mux_total = 1;
- b->pins[13].gpio.mux[0].pin = 46;
- b->pins[13].gpio.mux[0].value = 0;
- b->pins[13].gpio.complex_cap = (mraa_pin_cap_complex_t){ 1, 1, 0, 1, 1 };
- b->pins[13].gpio.output_enable = 30;
- b->pins[13].gpio.pullup_enable = 31;
- b->pins[13].spi.pinmap = 1;
- b->pins[13].spi.mux_total = 2;
- b->pins[13].spi.mux[0].pin = 46;
- b->pins[13].spi.mux[0].value = 1;
- b->pins[13].spi.mux[1].pin = 30;
- b->pins[13].spi.mux[1].value = 0;
-
- // ANALOG
- strncpy(b->pins[14].name, "A0", 8);
- b->pins[14].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 1 };
- b->pins[14].gpio.complex_cap = (mraa_pin_cap_complex_t){ 1, 0, 0, 1, 1 };
- b->pins[14].gpio.pullup_enable = 49;
- b->pins[14].aio.pinmap = 0;
- b->pins[14].aio.mux_total = 1;
- b->pins[14].aio.mux[0].pin = 49;
- b->pins[14].aio.mux[0].value = 1;
- b->pins[14].gpio.pinmap = 48;
- b->pins[14].gpio.mux_total = 0;
-
- strncpy(b->pins[15].name, "A1", 8);
- b->pins[15].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 1 };
- b->pins[15].gpio.complex_cap = (mraa_pin_cap_complex_t){ 1, 0, 0, 1, 1 };
- b->pins[15].gpio.pullup_enable = 51;
- b->pins[15].aio.pinmap = 1;
- b->pins[15].aio.mux[0].pin = 51;
- b->pins[15].aio.mux[0].value = 1;
- b->pins[15].aio.mux_total = 0;
- b->pins[15].gpio.pinmap = 50;
- b->pins[15].gpio.mux_total = 0;
-
- strncpy(b->pins[16].name, "A2", 8);
- b->pins[16].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 1 };
- b->pins[16].gpio.complex_cap = (mraa_pin_cap_complex_t){ 1, 0, 0, 1, 1 };
- b->pins[16].gpio.pullup_enable = 53;
- b->pins[16].aio.pinmap = 2;
- b->pins[16].aio.mux_total = 1;
- b->pins[16].aio.mux[0].pin = 53;
- b->pins[16].aio.mux[0].value = 1;
- b->pins[16].gpio.pinmap = 52;
- b->pins[16].gpio.mux_total = 0;
-
- strncpy(b->pins[17].name, "A3", 8);
- b->pins[17].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 1 };
- b->pins[17].gpio.complex_cap = (mraa_pin_cap_complex_t){ 1, 0, 0, 1, 1 };
- b->pins[17].gpio.pullup_enable = 55;
- b->pins[17].aio.pinmap = 3;
- b->pins[17].aio.mux_total = 1;
- b->pins[17].aio.mux[0].pin = 55;
- b->pins[17].aio.mux[0].value = 1;
- b->pins[17].gpio.pinmap = 54;
- b->pins[17].gpio.mux_total = 0;
-
- strncpy(b->pins[18].name, "A4", 8);
- b->pins[18].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 1, 1 };
- b->pins[18].gpio.complex_cap = (mraa_pin_cap_complex_t){ 1, 0, 0, 1, 1 };
- b->pins[18].gpio.pullup_enable = 57;
- b->pins[18].i2c.pinmap = 1;
- b->pins[18].i2c.mux_total = 1;
- b->pins[18].i2c.mux[0].pin = 60;
- b->pins[18].i2c.mux[0].value = 0;
- b->pins[18].aio.pinmap = 4;
- b->pins[18].aio.mux_total = 3;
- b->pins[18].aio.mux[0].pin = 60;
- b->pins[18].aio.mux[0].value = 1;
- b->pins[18].aio.mux[1].pin = 78;
- b->pins[18].aio.mux[1].value = 0;
- b->pins[18].aio.mux[2].pin = 57;
- b->pins[18].aio.mux[2].value = 0;
- b->pins[18].gpio.pinmap = 56;
- b->pins[18].gpio.mux_total = 2;
- b->pins[18].gpio.mux[0].pin = 60;
- b->pins[18].gpio.mux[0].value = 1;
- b->pins[18].gpio.mux[1].pin = 78;
- b->pins[18].gpio.mux[1].value = 1;
-
- strncpy(b->pins[19].name, "A5", 8);
- b->pins[19].capabilites = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 1, 1 };
- b->pins[19].gpio.complex_cap = (mraa_pin_cap_complex_t){ 1, 0, 0, 1, 1 };
- b->pins[19].gpio.pullup_enable = 59;
- b->pins[19].i2c.pinmap = 1;
- b->pins[19].i2c.mux_total = 1;
- b->pins[19].i2c.mux[0].pin = 60;
- b->pins[19].i2c.mux[0].value = 0;
- b->pins[19].aio.pinmap = 5;
- b->pins[19].aio.mux_total = 3;
- b->pins[19].aio.mux[0].pin = 60;
- b->pins[19].aio.mux[0].value = 1;
- b->pins[19].aio.mux[1].pin = 79;
- b->pins[19].aio.mux[1].value = 0;
- b->pins[19].aio.mux[2].pin = 59;
- b->pins[19].aio.mux[2].value = 1;
- b->pins[19].gpio.pinmap = 58;
- b->pins[19].gpio.mux_total = 2;
- b->pins[19].gpio.mux[0].pin = 60;
- b->pins[19].gpio.mux[0].value = 1;
- b->pins[19].gpio.mux[1].pin = 79;
- b->pins[19].gpio.mux[1].value = 1;
-
- // BUS DEFINITIONS
- b->i2c_bus_count = 1;
- b->def_i2c_bus = 0;
- b->i2c_bus[0].bus_id = 0;
- b->i2c_bus[0].sda = 18;
- b->i2c_bus[0].scl = 19;
-
- b->spi_bus_count = 1;
- b->def_spi_bus = 0;
- b->spi_bus[0].bus_id = 1;
- b->spi_bus[0].slave_s = 0;
- b->spi_bus[0].cs = 10;
- b->spi_bus[0].mosi = 11;
- b->spi_bus[0].miso = 12;
- b->spi_bus[0].sclk = 13;
-
- b->uart_dev_count = 2;
- b->def_uart_dev = 0;
- b->uart_dev[0].rx = 0;
- b->uart_dev[0].tx = 1;
- b->uart_dev[0].device_path = "/dev/ttyS0";
- b->uart_dev[1].rx = -1;
- b->uart_dev[1].tx = -1;
- b->uart_dev[1].device_path = "/dev/ttyS1";
-
- return b;
-error:
- syslog(LOG_CRIT, "galileo2: Platform failed to initialise");
- free(b);
- return NULL;
-}
diff --git a/peripheral/libmraa/src/x86/intel_minnow_byt_compatible.c b/peripheral/libmraa/src/x86/intel_minnow_byt_compatible.c
deleted file mode 100644
index a53cca8..0000000
--- a/peripheral/libmraa/src/x86/intel_minnow_byt_compatible.c
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
- * Author: Henry Bruce <henry.bruce@intel.com>
- * Evan Steele <evan.steele@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 <stdlib.h>
-#include <string.h>
-#include <sys/utsname.h>
-#include <ctype.h>
-
-#include "common.h"
-#include "x86/intel_minnow_byt_compatible.h"
-
-#define PLATFORM_NAME "MinnowBoard MAX"
-#define I2C_BUS_DEFAULT 7
-#define MAX_LENGTH 8
-#define I2CNAME "designware"
-
-int arch_nr_gpios_adjust = 0x100;
-
-mraa_result_t
-mraa_set_pininfo(mraa_board_t* board, int mraa_index, char* name, mraa_pincapabilities_t caps, int sysfs_pin)
-{
- if (mraa_index < board->phy_pin_count) {
- // adjust mraa_index for ARCH_NR_GPIOS value
- mraa_pininfo_t* pin_info = &board->pins[mraa_index];
- strncpy(pin_info->name, name, MAX_LENGTH);
- pin_info->capabilites = caps;
- if (caps.gpio) {
- pin_info->gpio.pinmap = sysfs_pin | arch_nr_gpios_adjust;
- pin_info->gpio.mux_total = 0;
- }
- if (caps.i2c) {
- pin_info->i2c.pinmap = 1;
- pin_info->i2c.mux_total = 0;
- }
- if (caps.pwm) {
- int controller = 0;
- if (strncmp(name, "PWM", 3) == 0 && strlen(name) > 3 && isdigit(name[3]))
- controller = name[3] - '0';
- pin_info->pwm.parent_id = controller;
- pin_info->pwm.pinmap = 0;
- pin_info->pwm.mux_total = 0;
- }
- if (caps.spi) {
- pin_info->spi.mux_total = 0;
- }
- return MRAA_SUCCESS;
- }
- return MRAA_ERROR_INVALID_RESOURCE;
-}
-
-mraa_result_t
-mraa_get_pin_index(mraa_board_t* board, char* name, int* pin_index)
-{
- int i;
- for (i = 0; i < board->phy_pin_count; ++i) {
- if (strncmp(name, board->pins[i].name, MAX_LENGTH) == 0) {
- *pin_index = i;
- return MRAA_SUCCESS;
- }
- }
- return MRAA_ERROR_INVALID_RESOURCE;
-}
-
-mraa_board_t*
-mraa_intel_minnowboard_byt_compatible(mraa_boolean_t turbot)
-{
- mraa_board_t* b = (mraa_board_t*) calloc(1, sizeof(mraa_board_t));
-
- struct utsname running_uname;
- int uname_major, uname_minor, max_pins[28];
-
- if (b == NULL) {
- return NULL;
- }
-
- b->platform_name = PLATFORM_NAME;
- if (turbot) {
- b->platform_version = "Turbot";
- b->gpio_count = b->phy_pin_count = MRAA_INTEL_MINNOW_TURBOT_PINCOUNT;
- } else {
- b->platform_version = "Ax";
- b->gpio_count = b->phy_pin_count = MRAA_INTEL_MINNOW_MAX_PINCOUNT;
- }
-
- b->pins = (mraa_pininfo_t*) calloc(b->phy_pin_count, sizeof(mraa_pininfo_t));
- if (b->pins == NULL) {
- goto error;
- }
-
- b->adv_func = (mraa_adv_func_t*) calloc(1, sizeof(mraa_adv_func_t));
- if (b->adv_func == NULL) {
- free(b->pins);
- goto error;
- }
-
- if (uname(&running_uname) != 0) {
- free(b->pins);
- free(b->adv_func);
- goto error;
- }
-
- sscanf(running_uname.release, "%d.%d", &uname_major, &uname_minor);
-
- /* if we are on Linux 3.17 or lower they use a 256 max and number the GPIOs down
- * if we are on 3.18 or higher (ea584595fc85e65796335033dfca25ed655cd0ed) (for now)
- * they start at 512 and number down, at some point this is going to change again when
- * GPIO moves to a radix.
- */
- if (uname_major <= 3 && uname_minor <= 17) {
- arch_nr_gpios_adjust = 0;
- }
-
- mraa_set_pininfo(b, 0, "INVALID", (mraa_pincapabilities_t){ 0, 0, 0, 0, 0, 0, 0, 0 }, -1);
- mraa_set_pininfo(b, 1, "GND", (mraa_pincapabilities_t){ 0, 0, 0, 0, 0, 0, 0, 0 }, -1);
- mraa_set_pininfo(b, 2, "GND", (mraa_pincapabilities_t){ 0, 0, 0, 0, 0, 0, 0, 0 }, -1);
- mraa_set_pininfo(b, 3, "5v", (mraa_pincapabilities_t){ 0, 0, 0, 0, 0, 0, 0, 0 }, -1);
- mraa_set_pininfo(b, 4, "3.3v", (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 }, -1);
- mraa_set_pininfo(b, 5, "SPI_CS", (mraa_pincapabilities_t){ 1, 0, 0, 0, 1, 0, 0, 0 }, 220);
- mraa_set_pininfo(b, 6, "UART1TX", (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 1 }, 225);
- mraa_set_pininfo(b, 7, "SPIMISO", (mraa_pincapabilities_t){ 1, 0, 0, 0, 1, 0, 0, 0 }, 221);
- mraa_set_pininfo(b, 8, "UART1RX", (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 1 }, 224);
- mraa_set_pininfo(b, 9, "SPIMOSI", (mraa_pincapabilities_t){ 1, 0, 0, 0, 1, 0, 0, 0 }, 222);
- mraa_set_pininfo(b, 10, "UART1CT", (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 }, 227);
- mraa_set_pininfo(b, 11, "SPI_CLK", (mraa_pincapabilities_t){ 1, 0, 0, 0, 1, 0, 0, 0 }, 223);
- mraa_set_pininfo(b, 12, "UART1RT", (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 }, 226);
- mraa_set_pininfo(b, 13, "I2C_SCL", (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 1, 0, 0 }, 243);
- mraa_set_pininfo(b, 14, "I2S_CLK", (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 }, 216);
- mraa_set_pininfo(b, 15, "I2C_SDA", (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 1, 0, 0 }, 242);
- mraa_set_pininfo(b, 16, "I2S_FRM", (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 }, 217);
- mraa_set_pininfo(b, 17, "UART2TX", (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 1 }, 229);
- mraa_set_pininfo(b, 18, "I2S_DO", (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 }, 219);
- mraa_set_pininfo(b, 19, "UART2RX", (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 1 }, 228);
- mraa_set_pininfo(b, 20, "I2S_DI", (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 }, 218);
- mraa_set_pininfo(b, 21, "S5_0", (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 }, 82);
- mraa_set_pininfo(b, 22, "PWM0", (mraa_pincapabilities_t){ 1, 0, 1, 0, 0, 0, 0, 0 },
- 248); // Assume BIOS configured for PWM
- mraa_set_pininfo(b, 23, "S5_1", (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 }, 83);
- mraa_set_pininfo(b, 24, "PWM1", (mraa_pincapabilities_t){ 1, 0, 1, 0, 0, 0, 0, 0 },
- 249); // Assume BIOS configured for PWM
- mraa_set_pininfo(b, 25, "S5_4", (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 }, 84);
- if (turbot) {
- mraa_set_pininfo(b, 26, "I2S_MCLK", (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 }, 253);
- mraa_set_pininfo(b, 27, "S5_22", (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 }, 104);
- } else {
- mraa_set_pininfo(b, 26, "IBL8254", (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 }, 208);
- }
-
- // Set number of i2c adaptors usable from userspace
- b->i2c_bus_count = 1;
-
- // Configure i2c adaptor #7 and make it the default
- int pin_index_sda, pin_index_scl;
- if (mraa_get_pin_index(b, "I2C_SDA", &pin_index_sda) == MRAA_SUCCESS &&
- mraa_get_pin_index(b, "I2C_SCL", &pin_index_scl) == MRAA_SUCCESS) {
- int bus = mraa_find_i2c_bus(I2CNAME, 0);
- if (bus == -1) {
- b->i2c_bus_count = 0;
- } else {
- b->def_i2c_bus = bus;
- b->i2c_bus[0].bus_id = b->def_i2c_bus;
- b->i2c_bus[0].sda = pin_index_sda;
- b->i2c_bus[0].scl = pin_index_scl;
- }
- }
-
- // Configure PWM
- b->pwm_default_period = 500;
- b->pwm_max_period = 1000000000;
- b->pwm_min_period = 1;
-
- b->spi_bus_count = 1;
- b->def_spi_bus = 0;
- b->spi_bus[0].bus_id = 0;
- b->spi_bus[0].slave_s = 0;
- b->spi_bus[0].cs = 5;
- b->spi_bus[0].mosi = 9;
- b->spi_bus[0].miso = 7;
- b->spi_bus[0].sclk = 11;
-
- b->uart_dev_count = 1;
- b->def_uart_dev = 0;
- b->uart_dev[0].rx = -1;
- b->uart_dev[0].tx = -1;
- b->uart_dev[0].device_path = "/dev/ttyS0";
-
- return b;
-error:
- syslog(LOG_CRIT, "minnowmax: Platform failed to initialise");
- free(b);
- return NULL;
-}
diff --git a/peripheral/libmraa/src/x86/intel_nuc5.c b/peripheral/libmraa/src/x86/intel_nuc5.c
deleted file mode 100644
index 840dd98..0000000
--- a/peripheral/libmraa/src/x86/intel_nuc5.c
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Author: Brendan Le Foll <brendan.le.foll@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-#include "common.h"
-#include "x86/intel_nuc5.h"
-
-#define PLATFORM_NAME "Intel NUC5"
-#define SYSFS_CLASS_GPIO "/sys/class/gpio"
-#define I2CNAME "designware"
-
-mraa_board_t*
-mraa_intel_nuc5()
-{
- mraa_board_t* b = (mraa_board_t*) calloc(1, sizeof(mraa_board_t));
- if (b == NULL) {
- return NULL;
- }
-
- b->platform_name = PLATFORM_NAME;
- b->phy_pin_count = MRAA_INTEL_NUC5_PINCOUNT;
-
- b->adv_func = (mraa_adv_func_t*) calloc(1, sizeof(mraa_adv_func_t));
- if (b->adv_func == NULL) {
- goto error;
- }
-
- b->pins = (mraa_pininfo_t*) calloc(MRAA_INTEL_NUC5_PINCOUNT,sizeof(mraa_pininfo_t));
- if (b->pins == NULL) {
- free(b->adv_func);
- goto error;
- }
-
- strncpy(b->pins[0].name, "1.8v", 8);
- b->pins[0].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
-
- strncpy(b->pins[1].name, "GND", 8);
- b->pins[1].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- strncpy(b->pins[2].name, "HDMIcec", 8);
- b->pins[2].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- strncpy(b->pins[3].name, "DMICclk", 8);
- b->pins[3].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- strncpy(b->pins[4].name, "3.3v", 8);
- b->pins[4].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- strncpy(b->pins[5].name, "DMICda", 8);
- b->pins[5].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- strncpy(b->pins[6].name, "Key", 8);
- b->pins[6].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- strncpy(b->pins[7].name, "SMB-A", 8);
- b->pins[7].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- strncpy(b->pins[8].name, "5v", 8);
- b->pins[8].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- strncpy(b->pins[9].name, "SCI", 8);
- b->pins[9].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
-
- strncpy(b->pins[10].name, "PWM0", 8);
- b->pins[10].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- b->pins[10].pwm.pinmap = 0;
- b->pins[10].pwm.parent_id = 0;
- b->pins[10].pwm.mux_total = 0;
-
- strncpy(b->pins[11].name, "PWM1", 8);
- b->pins[11].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- b->pins[11].pwm.pinmap = 0;
- b->pins[11].pwm.parent_id = 1;
- b->pins[11].pwm.mux_total = 0;
-
- strncpy(b->pins[12].name, "I2C0SCL", 8);
- b->pins[12].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 1, 0, 0 };
- b->pins[12].i2c.pinmap = 1;
- b->pins[12].i2c.mux_total = 0;
-
- strncpy(b->pins[13].name, "I2C0SDA", 8);
- b->pins[13].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 1, 0, 0 };
- b->pins[13].i2c.pinmap = 1;
- b->pins[13].i2c.mux_total = 0;
-
- strncpy(b->pins[14].name, "I2C1SCL", 8);
- b->pins[14].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 1, 0, 0 };
- b->pins[14].i2c.pinmap = 1;
- b->pins[14].i2c.mux_total = 0;
-
- strncpy(b->pins[15].name, "I2C1SDA", 8);
- b->pins[15].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 1, 0, 0 };
- b->pins[15].i2c.pinmap = 1;
- b->pins[15].i2c.mux_total = 0;
-
- strncpy(b->pins[16].name, "SMB_CLK", 8);
- b->pins[16].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
- strncpy(b->pins[17].name, "SMB_SDA", 8);
- b->pins[17].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
-
- b->i2c_bus_count = 0;
- int i2c_num = -1;
- int i;
- for (i = 0; i < 2; i++) {
- i2c_num = mraa_find_i2c_bus(I2CNAME, i2c_num + 1);
- if (i2c_num == -1) {
- break;
- }
- b->i2c_bus_count++;
- b->i2c_bus[i].bus_id = i2c_num;
- b->i2c_bus[i].sda = 12 + i;
- b->i2c_bus[i].scl = 13 + i;
- }
-
- if (b->i2c_bus_count > 0) {
- b->def_i2c_bus = b->i2c_bus[0].bus_id;
- }
-
- return b;
-error:
- syslog(LOG_CRIT, "nuc5: Platform failed to initialise");
- free(b);
- return NULL;
-}
diff --git a/peripheral/libmraa/src/x86/intel_sofia_3gr.c b/peripheral/libmraa/src/x86/intel_sofia_3gr.c
deleted file mode 100644
index cc8a54d..0000000
--- a/peripheral/libmraa/src/x86/intel_sofia_3gr.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Author: Lay, Kuan Loon <kuan.loon.lay@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 <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-#include "common.h"
-#include "x86/intel_sofia_3gr.h"
-
-#define PLATFORM_NAME "SoFIA 3GR"
-
-mraa_board_t*
-mraa_intel_sofia_3gr()
-{
- mraa_board_t* b = (mraa_board_t*) calloc(1, sizeof(mraa_board_t));
- if (b == NULL) {
- return NULL;
- }
-
- b->platform_name = PLATFORM_NAME;
- b->phy_pin_count = MRAA_INTEL_SOFIA_3GR_PINCOUNT;
-
- b->adv_func = (mraa_adv_func_t*) calloc(1, sizeof(mraa_adv_func_t));
- if (b->adv_func == NULL) {
- goto error;
- }
-
- b->pins = (mraa_pininfo_t*) calloc(MRAA_INTEL_SOFIA_3GR_PINCOUNT, sizeof(mraa_pininfo_t));
- if (b->pins == NULL) {
- free(b->adv_func);
- goto error;
- }
-
- strncpy(b->pins[0].name, "I2C1SCL", 8);
- b->pins[0].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 1, 0, 0 };
- b->pins[0].i2c.pinmap = 1;
- b->pins[0].i2c.mux_total = 0;
-
- strncpy(b->pins[1].name, "I2C1SDA", 8);
- b->pins[1].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 1, 0, 0 };
- b->pins[1].i2c.pinmap = 1;
- b->pins[1].i2c.mux_total = 0;
-
- strncpy(b->pins[2].name, "I2C2SCL", 8);
- b->pins[2].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 1, 0, 0 };
- b->pins[2].i2c.pinmap = 1;
- b->pins[2].i2c.mux_total = 0;
-
- strncpy(b->pins[3].name, "I2C2SDA", 8);
- b->pins[3].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 1, 0, 0 };
- b->pins[3].i2c.pinmap = 1;
- b->pins[3].i2c.mux_total = 0;
-
- strncpy(b->pins[4].name, "I2C3SCL", 8);
- b->pins[4].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 1, 0, 0 };
- b->pins[4].i2c.pinmap = 1;
- b->pins[4].i2c.mux_total = 0;
-
- strncpy(b->pins[5].name, "I2C3SDA", 8);
- b->pins[5].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 1, 0, 0 };
- b->pins[5].i2c.pinmap = 1;
- b->pins[5].i2c.mux_total = 0;
-
- strncpy(b->pins[6].name, "I2C4SCL", 8);
- b->pins[6].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 1, 0, 0 };
- b->pins[6].i2c.pinmap = 1;
- b->pins[6].i2c.mux_total = 0;
-
- strncpy(b->pins[7].name, "I2C4SDA", 8);
- b->pins[7].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 1, 0, 0 };
- b->pins[7].i2c.pinmap = 1;
- b->pins[7].i2c.mux_total = 0;
-
- return b;
-error:
- syslog(LOG_CRIT, "SoFIA 3GR: Platform failed to initialise");
- free(b);
- return NULL;
-}
diff --git a/peripheral/libmraa/src/x86/up.c b/peripheral/libmraa/src/x86/up.c
deleted file mode 100644
index 24b269d..0000000
--- a/peripheral/libmraa/src/x86/up.c
+++ /dev/null
@@ -1,215 +0,0 @@
-
-/*
- * Author: Dan O'Donovan <dan@emutex.com>
- * Copyright (c) 2015 Emutex Ltd.
- * 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 <stdlib.h>
-#include <string.h>
-#include <sys/utsname.h>
-#include <ctype.h>
-
-#include "common.h"
-#include "x86/up.h"
-
-#define PLATFORM_NAME "UP"
-#define I2C_BUS_DEFAULT 1
-#define MAX_LENGTH 8
-#define I2CNAME "designware"
-
-static mraa_result_t
-set_pininfo(mraa_board_t* board, int mraa_index, char* name, mraa_pincapabilities_t caps, int sysfs_pin)
-{
- if (mraa_index < board->phy_pin_count) {
- mraa_pininfo_t* pin_info = &board->pins[mraa_index];
- strncpy(pin_info->name, name, MAX_LENGTH);
- pin_info->capabilites = caps;
- if (caps.gpio) {
- pin_info->gpio.pinmap = sysfs_pin;
- pin_info->gpio.mux_total = 0;
- }
- if (caps.i2c) {
- pin_info->i2c.pinmap = 1;
- pin_info->i2c.mux_total = 0;
- }
- if (caps.pwm) {
- int controller = 0;
- if (strncmp(name, "PWM", 3) == 0 && strlen(name) > 3 && isdigit(name[3]))
- controller = name[3] - '0';
- pin_info->pwm.parent_id = controller;
- pin_info->pwm.pinmap = 0;
- pin_info->pwm.mux_total = 0;
- }
- if (caps.spi) {
- pin_info->spi.mux_total = 0;
- }
- return MRAA_SUCCESS;
- }
- return MRAA_ERROR_INVALID_RESOURCE;
-}
-
-static mraa_result_t
-get_pin_index(mraa_board_t* board, char* name, int* pin_index)
-{
- int i;
- for (i = 0; i < board->phy_pin_count; ++i) {
- if (strncmp(name, board->pins[i].name, MAX_LENGTH) == 0) {
- *pin_index = i;
- return MRAA_SUCCESS;
- }
- }
- return MRAA_ERROR_INVALID_RESOURCE;
-}
-
-mraa_board_t*
-mraa_up_board()
-{
- mraa_board_t* b = (mraa_board_t*) calloc(1, sizeof(mraa_board_t));
-
- struct utsname running_uname;
- int uname_major, uname_minor, max_pins[27];
-
- if (b == NULL) {
- return NULL;
- }
-
- b->platform_name = PLATFORM_NAME;
- b->phy_pin_count = MRAA_UP_PINCOUNT;
- b->gpio_count = MRAA_UP_GPIOCOUNT;
-
- b->pins = (mraa_pininfo_t*) malloc(sizeof(mraa_pininfo_t) * MRAA_UP_PINCOUNT);
- if (b->pins == NULL) {
- goto error;
- }
-
- b->adv_func = (mraa_adv_func_t*) calloc(1, sizeof(mraa_adv_func_t));
- if (b->adv_func == NULL) {
- free(b->pins);
- goto error;
- }
-
- if (uname(&running_uname) != 0) {
- free(b->pins);
- free(b->adv_func);
- goto error;
- }
-
- sscanf(running_uname.release, "%d.%d", &uname_major, &uname_minor);
-
- set_pininfo(b, 0, "INVALID", (mraa_pincapabilities_t){ 0, 0, 0, 0, 0, 0, 0, 0 }, -1);
- set_pininfo(b, 1, "3.3v", (mraa_pincapabilities_t){ 0, 0, 0, 0, 0, 0, 0, 0 }, -1);
- set_pininfo(b, 2, "5v", (mraa_pincapabilities_t){ 0, 0, 0, 0, 0, 0, 0, 0 }, -1);
- set_pininfo(b, 3, "I2C1_SDA", (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 1, 0, 0 }, 2);
- set_pininfo(b, 4, "5v", (mraa_pincapabilities_t){ 0, 0, 0, 0, 0, 0, 0, 0 }, -1);
- set_pininfo(b, 5, "I2C1_SCL", (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 1, 0, 0 }, 3);
- set_pininfo(b, 6, "GND", (mraa_pincapabilities_t){ 0, 0, 0, 0, 0, 0, 0, 0 }, -1);
- set_pininfo(b, 7, "GPIO4", (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 }, 4);
- set_pininfo(b, 8, "UART1_TX", (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 1 }, 14);
- set_pininfo(b, 9, "GND", (mraa_pincapabilities_t){ 0, 0, 0, 0, 0, 0, 0, 0 }, -1);
- set_pininfo(b, 10, "UART1_RX", (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 1 }, 15);
- set_pininfo(b, 11, "GPIO17", (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 }, 17);
- set_pininfo(b, 12, "I2S_CLK", (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 }, 18);
- set_pininfo(b, 13, "UART2_RX", (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 1, 0, 1 }, 27);
- set_pininfo(b, 14, "GND", (mraa_pincapabilities_t){ 0, 0, 0, 0, 0, 0, 0, 0 }, -1);
- set_pininfo(b, 15, "GPIO22", (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 1, 0, 0 }, 22);
- set_pininfo(b, 16, "GPIO23", (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 }, 23);
- set_pininfo(b, 17, "3.3v", (mraa_pincapabilities_t){ 0, 0, 0, 0, 0, 0, 0, 0 }, -1);
- set_pininfo(b, 18, "GPIO24", (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 }, 24);
- set_pininfo(b, 19, "SPI_MOSI", (mraa_pincapabilities_t){ 1, 1, 0, 0, 1, 0, 0, 0 }, 10);
- set_pininfo(b, 20, "GND", (mraa_pincapabilities_t){ 0, 0, 0, 0, 0, 0, 0, 0 }, -1);
- set_pininfo(b, 21, "SPI_MISO", (mraa_pincapabilities_t){ 1, 1, 0, 0, 1, 0, 0, 0 }, 9);
- set_pininfo(b, 22, "UART2_TX", (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 1 }, 25);
- set_pininfo(b, 23, "SPI_CLK", (mraa_pincapabilities_t){ 1, 1, 0, 0, 1, 0, 0, 0 }, 11);
- set_pininfo(b, 24, "SPI_CS0", (mraa_pincapabilities_t){ 1, 1, 0, 0, 1, 0, 0, 0 }, 8);
- set_pininfo(b, 25, "GND", (mraa_pincapabilities_t){ 0, 0, 0, 0, 0, 0, 0, 0 }, -1);
- set_pininfo(b, 26, "SPI_CS1", (mraa_pincapabilities_t){ 1, 1, 0, 0, 1, 0, 0, 0 }, 7);
- set_pininfo(b, 27, "ID_SD", (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 1, 0, 0 }, 0);
- set_pininfo(b, 28, "ID_SC", (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 1, 0, 0 }, 1);
- set_pininfo(b, 29, "GPIO5", (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 }, 5);
- set_pininfo(b, 30, "GND", (mraa_pincapabilities_t){ 0, 0, 0, 0, 0, 0, 0, 0 }, -1);
- set_pininfo(b, 31, "GPIO6", (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 }, 6);
- set_pininfo(b, 32, "PWM0", (mraa_pincapabilities_t){ 1, 1, 1, 0, 0, 0, 0, 0 }, 12);
- set_pininfo(b, 33, "PWM1", (mraa_pincapabilities_t){ 1, 1, 1, 0, 0, 0, 0, 0 }, 13);
- set_pininfo(b, 34, "GND", (mraa_pincapabilities_t){ 0, 0, 0, 0, 0, 0, 0, 0 }, -1);
- set_pininfo(b, 35, "I2S_FRM", (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 }, 19);
- set_pininfo(b, 36, "GPIO16", (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 }, 16);
- set_pininfo(b, 37, "GPIO26", (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 }, 26);
- set_pininfo(b, 38, "I2S_DIN", (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 }, 20);
- set_pininfo(b, 39, "GND", (mraa_pincapabilities_t){ 0, 0, 0, 0, 0, 0, 0, 0 }, -1);
- set_pininfo(b, 40, "I2S_DOUT", (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 }, 21);
-
- // Set number of i2c adaptors usable from userspace
- b->i2c_bus_count = 2;
-
- // Configure i2c adaptor #0 (default)
- // (For consistency with Raspberry Pi 2, use I2C1 as our primary I2C bus)
- b->i2c_bus[0].bus_id = 1;
- get_pin_index(b, "I2C1_SDA", &(b->i2c_bus[0].sda));
- get_pin_index(b, "I2C1_SCL", &(b->i2c_bus[0].scl));
-
- // Configure i2c adaptor #1
- // (normally reserved for accessing HAT EEPROM)
- b->i2c_bus[1].bus_id = 0;
- get_pin_index(b, "I2C0_SDA", &(b->i2c_bus[1].sda));
- get_pin_index(b, "I2C0_SCL", &(b->i2c_bus[1].scl));
- b->def_i2c_bus = 0;
-
- // Configure PWM
- b->pwm_default_period = 500;
- b->pwm_max_period = 3413;
- b->pwm_min_period = 1;
-
- // Configure SPI #0 CS0 (default)
- b->spi_bus_count = 2;
- b->spi_bus[0].bus_id = 2;
- b->spi_bus[0].slave_s = 0;
- get_pin_index(b, "SPI_CS0", &(b->spi_bus[0].cs));
- get_pin_index(b, "SPI_MOSI", &(b->spi_bus[0].mosi));
- get_pin_index(b, "SPI_MISO", &(b->spi_bus[0].miso));
- get_pin_index(b, "SPI_CLK", &(b->spi_bus[0].sclk));
- b->def_spi_bus = 0;
- // Configure SPI #0 CS1
- b->spi_bus[1].bus_id = 2;
- b->spi_bus[1].slave_s = 1;
- get_pin_index(b, "SPI_CS1", &(b->spi_bus[1].cs));
- get_pin_index(b, "SPI_MOSI", &(b->spi_bus[1].mosi));
- get_pin_index(b, "SPI_MISO", &(b->spi_bus[1].miso));
- get_pin_index(b, "SPI_CLK", &(b->spi_bus[1].sclk));
-
- // Configure UART #1 (default)
- b->uart_dev_count = 2;
- get_pin_index(b, "UART1_RX", &(b->uart_dev[0].rx));
- get_pin_index(b, "UART1_TX", &(b->uart_dev[0].tx));
- b->uart_dev[0].device_path = "/dev/ttyS1";
- b->def_uart_dev = 0;
- // Configure UART #2
- get_pin_index(b, "UART2_RX", &(b->uart_dev[1].rx));
- get_pin_index(b, "UART2_TX", &(b->uart_dev[1].tx));
- b->uart_dev[1].device_path = "/dev/ttyS2";
-
- return b;
-error:
- syslog(LOG_CRIT, "up: Platform failed to initialise");
- free(b);
- return NULL;
-}
diff --git a/peripheral/libmraa/src/x86/x86.c b/peripheral/libmraa/src/x86/x86.c
deleted file mode 100644
index 2f1be3a..0000000
--- a/peripheral/libmraa/src/x86/x86.c
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
- * Brendan Le Foll <brendan.le.foll@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.
- */
-
-#include <stdlib.h>
-#include <string.h>
-
-#include "mraa_internal.h"
-
-#include "x86/intel_galileo_rev_d.h"
-#include "x86/intel_galileo_rev_g.h"
-#include "x86/intel_edison_fab_c.h"
-#include "x86/intel_de3815.h"
-#include "x86/intel_nuc5.h"
-#include "x86/intel_minnow_byt_compatible.h"
-#include "x86/intel_sofia_3gr.h"
-#include "x86/intel_cherryhills.h"
-#include "x86/up.h"
-
-mraa_platform_t
-mraa_x86_platform()
-{
-#ifndef MRAA_PLATFORM_FORCE
- mraa_platform_t platform_type = MRAA_UNKNOWN_PLATFORM;
-
- char* line = NULL;
- // let getline allocate memory for *line
- size_t len = 0;
- FILE* fh = fopen("/sys/devices/virtual/dmi/id/board_name", "r");
- if (fh != NULL) {
- if (getline(&line, &len, fh) != -1) {
- if (strncmp(line, "GalileoGen2", 11) == 0) {
- platform_type = MRAA_INTEL_GALILEO_GEN2;
- plat = mraa_intel_galileo_gen2();
- } else if (strncmp(line, "BODEGA BAY", 10) == 0) {
- platform_type = MRAA_INTEL_EDISON_FAB_C;
- plat = mraa_intel_edison_fab_c();
- } else if (strncmp(line, "SALT BAY", 8) == 0) {
- platform_type = MRAA_INTEL_EDISON_FAB_C;
- plat = mraa_intel_edison_fab_c();
- } else if (strncmp(line, "DE3815", 6) == 0) {
- platform_type = MRAA_INTEL_DE3815;
- plat = mraa_intel_de3815();
- } else if (strncmp(line, "NUC5i5MYBE", 10) == 0 || strncmp(line, "NUC5i3MYBE", 10) == 0) {
- platform_type = MRAA_INTEL_NUC5;
- plat = mraa_intel_nuc5();
- } else if (strncmp(line, "NOTEBOOK", 8) == 0) {
- platform_type = MRAA_INTEL_MINNOWBOARD_MAX;
- plat = mraa_intel_minnowboard_byt_compatible(0);
- } else if (strncasecmp(line, "MinnowBoard MAX", 15) == 0) {
- platform_type = MRAA_INTEL_MINNOWBOARD_MAX;
- plat = mraa_intel_minnowboard_byt_compatible(0);
- } else if (strncasecmp(line, "Galileo", 7) == 0) {
- platform_type = MRAA_INTEL_GALILEO_GEN1;
- plat = mraa_intel_galileo_rev_d();
- } else if (strncasecmp(line, "MinnowBoard Compatible", 22) == 0) {
- platform_type = MRAA_INTEL_MINNOWBOARD_MAX;
- plat = mraa_intel_minnowboard_byt_compatible(1);
- } else if (strncasecmp(line, "MinnowBoard Turbot", 18) == 0) {
- platform_type = MRAA_INTEL_MINNOWBOARD_MAX;
- plat = mraa_intel_minnowboard_byt_compatible(1);
- } else if (strncasecmp(line, "Braswell Cherry Hill", 20) == 0) {
- platform_type = MRAA_INTEL_CHERRYHILLS;
- plat = mraa_intel_cherryhills();
- } else if (strncasecmp(line, "UP-CHT01", 8) == 0) {
- platform_type = MRAA_UP;
- plat = mraa_up_board();
- } else {
- syslog(LOG_ERR, "Platform not supported, not initialising");
- platform_type = MRAA_UNKNOWN_PLATFORM;
- }
- free(line);
- }
- fclose(fh);
- } else {
- fh = fopen("/proc/cmdline", "r");
- if (fh != NULL) {
- if (getline(&line, &len, fh) != -1) {
- if (strstr(line, "sf3gr_mrd_version=P2.0")) {
- platform_type = MRAA_INTEL_SOFIA_3GR;
- plat = mraa_intel_sofia_3gr();
- }
- free(line);
- }
- fclose(fh);
- }
- }
- return platform_type;
-#else
- #if defined(xMRAA_INTEL_GALILEO_GEN2)
- plat = mraa_intel_galileo_gen2();
- #elif defined(xMRAA_INTEL_EDISON_FAB_C)
- plat = mraa_intel_edison_fab_c();
- #elif defined(xMRAA_INTEL_DE3815)
- plat = mraa_intel_de3815();
- #elif defined(xMRAA_INTEL_MINNOWBOARD_MAX)
- plat = mraa_intel_minnowboard_byt_compatible();
- #elif defined(xMRAA_INTEL_GALILEO_GEN1)
- plat = mraa_intel_galileo_rev_d();
- #elif defined(xMRAA_INTEL_NUC5)
- plat = mraa_intel_nuc5();
- #elif defined(xMRAA_INTEL_SOFIA_3GR)
- plat = mraa_intel_sofia_3gr();
- #elif defined(xMRAA_INTEL_CHERRYHILLS)
- plat = mraa_intel_cherryhills();
- #elif defined(xMRAA_UP)
- plat = mraa_up_board();
- #else
- #error "Not using a valid platform value from mraa_platform_t - cannot compile"
- #endif
- return MRAA_PLATFORM_FORCE;
-#endif
-}
diff --git a/peripheral/libmraa/tests/CMakeLists.txt b/peripheral/libmraa/tests/CMakeLists.txt
deleted file mode 100644
index 6ebb8bd..0000000
--- a/peripheral/libmraa/tests/CMakeLists.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-if (BUILDSWIGJAVA)
- add_test (NAME check_clean COMMAND ${PYTHON_EXECUTABLE}
- ${CMAKE_CURRENT_SOURCE_DIR}/check_clean.py
- WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
-
- add_test (NAME check_samplenames COMMAND ${PYTHON_EXECUTABLE}
- ${CMAKE_CURRENT_SOURCE_DIR}/check_samplenames.py
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
-endif()
-
-if (BUILDSWIGPYTHON)
- add_test (NAME py_general COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/general_checks.py)
- set_tests_properties(py_general PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_BINARY_DIR}/src/python/")
-
- add_test (NAME py_platform COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/platform_checks.py)
- set_tests_properties(py_platform PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_BINARY_DIR}/src/python/")
-
- add_test (NAME py_gpio COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/gpio_checks.py)
- set_tests_properties(py_gpio PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_BINARY_DIR}/src/python/")
-endif()
diff --git a/peripheral/libmraa/tests/check_clean.py b/peripheral/libmraa/tests/check_clean.py
deleted file mode 100644
index 7b47dc6..0000000
--- a/peripheral/libmraa/tests/check_clean.py
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/usr/bin/python
-
-import unittest as u
-import re, fnmatch, os
-
-rootDir = 'src/java'
-swigtypeStr = 'SWIGTYPE'
-
-class Clean(u.TestCase):
-
- def test_existing_swigtype(self):
- unclean = []
-
- for fileName in os.listdir(rootDir):
- if swigtypeStr in fileName:
- unclean.append(fileName)
-
- self.assertEqual( len(unclean), 0,
- "\nmraa contains unclean Java bindings:\n" + \
- "\n".join(unclean) + "\n\n")
-
-if __name__ == '__main__':
- u.main()
diff --git a/peripheral/libmraa/tests/check_samplenames.py b/peripheral/libmraa/tests/check_samplenames.py
deleted file mode 100644
index 75df165..0000000
--- a/peripheral/libmraa/tests/check_samplenames.py
+++ /dev/null
@@ -1,64 +0,0 @@
-#!/usr/bin/python
-
-import unittest as u
-import re, fnmatch, os, sys
-
-sampleMappingFile = '../examples/samples.mapping.txt'
-cSamplesDir = '../examples/'
-javaSamplesDir = '../examples/java/'
-cppSamplesDir = '../examples/c++/'
-
-class SampleNames(u.TestCase):
-
- def test_existing_samples(self):
- missing_c_files = []
- missing_cpp_files = []
- missing_java_files = []
-
- with open (sampleMappingFile, "r") as f:
- for line in f:
- sampleNames = line.split();
-
- cSampleName = sampleNames[0]
- javaSampleName = sampleNames[1]
-
- #check for C files
- if cSampleName.endswith('.c'):
- ok = False
- for file in os.listdir(cSamplesDir):
- if file == cSampleName:
- ok = True
- break
- if not ok:
- missing_c_files.append(cSampleName)
-
- #check for Cpp files
- if cSampleName.endswith('.cpp'):
- ok = False
- for file in os.listdir(cppSamplesDir):
- if file == cSampleName:
- ok = True
- break
- if not ok:
- missing_cpp_files.append(cSampleName)
-
- #check for java files
- javaSampleName = javaSampleName.lstrip("java/")
- if javaSampleName.endswith('.java'):
- ok = False
- for file in os.listdir(javaSamplesDir):
- if file == javaSampleName:
- ok = True
- break
- if not ok:
- missing_java_files.append(javaSampleName)
-
- self.assertEqual( len(missing_java_files) + len(missing_c_files) + len(missing_cpp_files), 0,
- "\nThe following files are missing from samples:\n" + \
- "\n".join(missing_c_files) + "\n" + \
- "\n".join(missing_cpp_files) + "\n" + \
- "\n".join(missing_java_files))
-
-if __name__ == '__main__':
- u.main()
-
diff --git a/peripheral/libmraa/tests/general_checks.py b/peripheral/libmraa/tests/general_checks.py
deleted file mode 100755
index ae1521e..0000000
--- a/peripheral/libmraa/tests/general_checks.py
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/usr/bin/env python
-
-# Author: Costin Constantin <costin.c.constantin@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.
-
-from __future__ import print_function
-
-import mraa as m
-import unittest as u
-
-class GeneralChecks(u.TestCase):
- def test_mraa_version(self):
- self.version = m.getVersion()
- print("Version is: " + self.version)
- self.assertIsNotNone(self.version)
-
-if __name__ == "__main__":
- u.main()
diff --git a/peripheral/libmraa/tests/gpio_checks.py b/peripheral/libmraa/tests/gpio_checks.py
deleted file mode 100755
index 506697c..0000000
--- a/peripheral/libmraa/tests/gpio_checks.py
+++ /dev/null
@@ -1,93 +0,0 @@
-#!/usr/bin/env python
-
-# Author: Costin Constantin <costin.c.constantin@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.
-
-from __future__ import print_function
-
-import mraa as m
-import unittest as u
-import os, re, sys
-from time import sleep
-
-MRAA_GPIO = 3
-
-@u.skipIf(m.pinModeTest(MRAA_GPIO, m.PIN_GPIO) != True, str(MRAA_GPIO) + "is not a valid Gpio on this platform")
-class GpioChecks(u.TestCase):
-
- def setUp(self):
- self.pin = m.Gpio(MRAA_GPIO)
- self.gpio_path = "/sys/class/gpio/gpio" + str(self.pin.getPin(True))
-
- def tearDown(self):
- # dereference pin to force cleanup
- self.pin = ""
-
- def test_returning_pin_no(self):
- self.pin_no = self.pin.getPin() # i should have the pin no. here as set when initing Gpio class
- self.assertEqual(self.pin_no, MRAA_GPIO, "Something wrong happened ... set pin doesn't correspond to retrieved one")
-
- def test_returning_pin_as_on_sys(self):
- self.assertTrue(os.path.exists(self.gpio_path))
-
- def test_set_GPIO_as_output(self):
- self.pin.dir(m.DIR_OUT)
- dir_file = open(self.gpio_path + "/direction")
- dir_file_content = dir_file.readline()[:-1]
- dir_file.close()
- self.assertMultiLineEqual(dir_file_content, "out")
-
- def test_set_GPIO_as_input(self):
- self.pin.dir(m.DIR_IN)
- dir_file = open(self.gpio_path + "/direction")
- dir_file_content = dir_file.readline()[:-1]
- dir_file.close()
- self.assertMultiLineEqual(dir_file_content, "in")
-
- def test_GPIO_as_output_write_HIGH_level(self):
- self.pin.dir(m.DIR_OUT)
- self.pin.write(1)
- val_file = open(self.gpio_path + "/value")
- sysfs_pin_value = val_file.readline()[:-1]
- val_file.close()
- self.assertEqual(int(sysfs_pin_value),1, "Value doesn't match the HIGH state")
-
- def test_GPIO_as_output_write_LOW_level(self):
- self.pin.dir(m.DIR_OUT)
- self.pin.write(0)
- val_file = open(self.gpio_path + "/value")
- sysfs_pin_value = val_file.readline()[:-1]
- val_file.close()
- self.assertEqual(int(sysfs_pin_value), 0, "Value doesn't match the LOW state")
-
- def test_GPIO_as_input_and_write_HIGH_on_it(self):
- self.pin.dir(m.DIR_IN)
- res = self.pin.write(1)
- self.assertNotEqual(res, m.SUCCESS, "The command should fail")
-
- def test_GPIO_as_input_and_write_LOW_on_it(self):
- self.pin.dir(m.DIR_IN)
- res = self.pin.write(0)
- self.assertGreater(res, 0, "The command should have returned value greater than 0")
-
-if __name__ == '__main__':
- u.main()
diff --git a/peripheral/libmraa/tests/platform_checks.py b/peripheral/libmraa/tests/platform_checks.py
deleted file mode 100755
index fffa7fa..0000000
--- a/peripheral/libmraa/tests/platform_checks.py
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/usr/bin/env python
-
-# Author: Costin Constantin <costin.c.constantin@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.
-
-from __future__ import print_function
-
-import mraa as m
-import unittest as u
-
-@u.skipIf(m.init() != m.ERROR_PLATFORM_ALREADY_INITIALISED, "mraa_init() not valid")
-class PlatformChecks(u.TestCase):
- def test_mraa_check_platform_no_of_pins(self):
- pinCount = m.getPinCount()
- self.assertEqual(pinCount, 20, "Wrong number. of pins. Check platform ...")
-
- def test_mraa_check_platform_ADC_max_resolution(self):
- self.p_ADC_mres = m.adcRawBits()
- print("Platform ADC max. resolution is: " + str(self.p_ADC_mres) + " bits")
- self.assertEqual(self.p_ADC_mres, 12, "Wrong ADC max. resolution. Check platform ...")
-
- def test_mraa_check_platform_ADC_resolution(self):
- self.p_ADC_res = m.adcSupportedBits()
- print("Platform ADC resolution is: " + str(self.p_ADC_res) + " bits")
- self.assertEqual(self.p_ADC_res, 10, "Wrong ADC suported resolution. Check platform ...")
-
-if __name__ == "__main__":
- u.main()