summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLee Campbell <leecam@google.com>2016-07-26 19:32:41 +0000
committerandroid-build-merger <android-build-merger@google.com>2016-07-26 19:32:41 +0000
commit431fae07a89bad8be2e0f5c7dfe5d9179f906007 (patch)
tree5d685088717c99f0fb93fca39027ca5b3ac3d81c
parent892fe7e667dbb4c86967c79ed524082b9f4662f1 (diff)
parentc05c4bf2de0aa0c665474f9b7cc9ceac3d9d331a (diff)
downloadintel-master.tar.gz
Remove sensors, lights, examples, mraa and upmHEADmastermain
am: c05c4bf2de Change-Id: I57a011fd270bd16911780ed6aaefe5e7cf4f0621
-rw-r--r--peripheral/displays/Grove_LCD_RGB/Android.mk31
-rw-r--r--peripheral/displays/Grove_LCD_RGB/groveLCD.cpp123
-rw-r--r--peripheral/displays/SparkFun_OLED/Android.mk29
-rw-r--r--peripheral/displays/SparkFun_OLED/SparkFunOLED.cpp111
-rw-r--r--peripheral/examples/mraa/gpio_output/Android.mk42
-rw-r--r--peripheral/examples/mraa/gpio_output/OutputGPIO.cpp127
-rw-r--r--peripheral/examples/mraa/gpio_output/ledflasher_mraa.cpp57
-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
-rw-r--r--peripheral/libupm/.clang-format122
-rw-r--r--peripheral/libupm/.gitignore13
-rw-r--r--peripheral/libupm/.travis.yml21
-rw-r--r--peripheral/libupm/Android.mk52
-rw-r--r--peripheral/libupm/CMakeLists.txt219
-rw-r--r--peripheral/libupm/LICENSE20
-rw-r--r--peripheral/libupm/README.md112
-rw-r--r--peripheral/libupm/cmake/Toolchains/oe-sdk_cross.cmake25
-rw-r--r--peripheral/libupm/cmake/modules/CPackDeb.cmake222
-rw-r--r--peripheral/libupm/cmake/modules/FindNode.cmake61
-rw-r--r--peripheral/libupm/cmake/modules/FindSphinx.cmake31
-rw-r--r--peripheral/libupm/cmake/modules/FindYuidoc.cmake23
-rw-r--r--peripheral/libupm/cmake/modules/GetGitRevisionDescription.cmake130
-rw-r--r--peripheral/libupm/cmake/modules/GetGitRevisionDescription.cmake.in38
-rw-r--r--peripheral/libupm/cmake/modules/LICENSE_1_0.txt23
-rw-r--r--peripheral/libupm/cmake/modules/TargetArch.cmake136
-rw-r--r--peripheral/libupm/cmake/modules/version.c.in4
-rw-r--r--peripheral/libupm/docs/building.md113
-rw-r--r--peripheral/libupm/docs/changelog.md171
-rw-r--r--peripheral/libupm/docs/contributions.md96
-rw-r--r--peripheral/libupm/docs/creating_java_bindings.md353
-rw-r--r--peripheral/libupm/docs/documentation.md117
-rw-r--r--peripheral/libupm/docs/icons/allides.pngbin37901 -> 0 bytes
-rw-r--r--peripheral/libupm/docs/icons/c++.pngbin1833 -> 0 bytes
-rw-r--r--peripheral/libupm/docs/icons/eclipse.pngbin17618 -> 0 bytes
-rw-r--r--peripheral/libupm/docs/icons/java.pngbin1519 -> 0 bytes
-rw-r--r--peripheral/libupm/docs/icons/node.pngbin3115 -> 0 bytes
-rw-r--r--peripheral/libupm/docs/icons/python.pngbin2596 -> 0 bytes
-rw-r--r--peripheral/libupm/docs/icons/wyliodrin.pngbin23688 -> 0 bytes
-rw-r--r--peripheral/libupm/docs/icons/xdk.pngbin5243 -> 0 bytes
-rw-r--r--peripheral/libupm/docs/images/LICENSE_CC_3_0.txt361
-rwxr-xr-xperipheral/libupm/docs/images/a110x.jpgbin22841 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/ad8232.jpgbin227285 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/adafruitms1438.jpgbin171993 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/adafruitss.jpgbin177545 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/adc121c021.jpgbin15326 -> 0 bytes
-rw-r--r--peripheral/libupm/docs/images/adxl335.jpgbin29288 -> 0 bytes
-rw-r--r--peripheral/libupm/docs/images/adxl345.jpegbin21440 -> 0 bytes
-rw-r--r--peripheral/libupm/docs/images/am2315.jpegbin19517 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/apds9002.jpgbin22490 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/at42qt1070.jpgbin182039 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/biss0001.jpgbin31546 -> 0 bytes
-rw-r--r--peripheral/libupm/docs/images/bmp085.jpegbin44943 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/buzzer.jpgbin9948 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/cjq4435.jpgbin112720 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/ds1307.jpgbin29064 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/ecs1030.jpgbin70514 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/enc03r.jpgbin23400 -> 0 bytes
-rw-r--r--peripheral/libupm/docs/images/es08a.jpgbin170440 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/flex.jpgbin12186 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/gp2y0a.jpgbin45246 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/grovebutton.jpgbin168303 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/grovecircularled.jpgbin53530 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/grovecollision.jpgbin27670 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/groveehr.jpgbin84816 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/groveeldriver.jpgbin10529 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/groveelectromagnet.jpgbin6788 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/groveemg.jpgbin41677 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/grovegsr.jpgbin15716 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/groveled.jpgbin141452 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/grovelight.jpgbin22773 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/grovelinefinder.jpgbin78791 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/groveloudness.jpgbin9630 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/grovemd.jpgbin170901 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/grovemoisture.jpgbin3378 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/groveo2.jpgbin80556 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/groverelay.jpgbin18142 -> 0 bytes
-rw-r--r--peripheral/libupm/docs/images/grovergblcd.jpgbin65506 -> 0 bytes
-rw-r--r--peripheral/libupm/docs/images/groverotary.jpegbin20514 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/grovescam.jpgbin138409 -> 0 bytes
-rw-r--r--peripheral/libupm/docs/images/groveslide.jpegbin8936 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/grovespeaker.jpgbin99558 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/grovetemp.jpgbin21782 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/grovevdiv.jpgbin107099 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/grovewater.jpgbin11049 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/grovewfs.jpgbin92097 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/guvas12d.jpgbin102225 -> 0 bytes
-rw-r--r--peripheral/libupm/docs/images/h3lis331dl.jpgbin28102 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/hm11.jpgbin33003 -> 0 bytes
-rw-r--r--peripheral/libupm/docs/images/hmc5883l.jpegbin42306 -> 0 bytes
-rw-r--r--peripheral/libupm/docs/images/hmtrp.jpgbin13085 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/hp20x.jpgbin951020 -> 0 bytes
-rw-r--r--peripheral/libupm/docs/images/ht9170.jpgbin33179 -> 0 bytes
-rw-r--r--peripheral/libupm/docs/images/htu21d.jpegbin137600 -> 0 bytes
-rw-r--r--peripheral/libupm/docs/images/hx711.jpegbin42639 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/ina132.jpgbin13779 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/isd1820.jpgbin10291 -> 0 bytes
-rw-r--r--peripheral/libupm/docs/images/itg3200.jpegbin37383 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/joystick12.jpgbin22830 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/l298.jpgbin173107 -> 0 bytes
-rw-r--r--peripheral/libupm/docs/images/lcm1602.jpegbin198795 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/ldt0028.jpgbin110401 -> 0 bytes
-rw-r--r--peripheral/libupm/docs/images/lolshield.jpgbin143549 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/lpd8806.jpgbin52788 -> 0 bytes
-rw-r--r--peripheral/libupm/docs/images/lsm303.jpegbin30131 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/m24lr64e.jpgbin24928 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/max31855.jpgbin201221 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/maxsonarez.jpgbin61510 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/mhz16.jpgbin16677 -> 0 bytes
-rw-r--r--peripheral/libupm/docs/images/mic.jpgbin47512 -> 0 bytes
-rw-r--r--peripheral/libupm/docs/images/micsv89.jpgbin45498 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/mlx90614.jpgbin173955 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/mma7455.jpgbin68485 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/mma7660.jpgbin12515 -> 0 bytes
-rw-r--r--peripheral/libupm/docs/images/mpl3115a2.jpgbin145029 -> 0 bytes
-rw-r--r--peripheral/libupm/docs/images/mpr121.jpgbin96858 -> 0 bytes
-rw-r--r--peripheral/libupm/docs/images/mpu9150.jpgbin126781 -> 0 bytes
-rw-r--r--peripheral/libupm/docs/images/mq2-5.jpegbin33834 -> 0 bytes
-rw-r--r--peripheral/libupm/docs/images/mq3-9.jpegbin34872 -> 0 bytes
-rw-r--r--peripheral/libupm/docs/images/mq303a.jpgbin189196 -> 0 bytes
-rw-r--r--peripheral/libupm/docs/images/my9221.jpgbin94197 -> 0 bytes
-rw-r--r--peripheral/libupm/docs/images/nrf24l01.jpgbin107122 -> 0 bytes
-rw-r--r--peripheral/libupm/docs/images/nrf8001.jpgbin210742 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/nunchuck.jpgbin16754 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/otp538u.jpgbin19197 -> 0 bytes
-rw-r--r--peripheral/libupm/docs/images/pca9685.jpgbin238443 -> 0 bytes
-rw-r--r--peripheral/libupm/docs/images/ppd42ns.jpgbin168820 -> 0 bytes
-rw-r--r--peripheral/libupm/docs/images/pulsensor.jpgbin134570 -> 0 bytes
-rw-r--r--peripheral/libupm/docs/images/rfr359f.jpgbin62595 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/rgbringcoder.jpgbin89340 -> 0 bytes
-rw-r--r--peripheral/libupm/docs/images/rotaryencoder.jpgbin139075 -> 0 bytes
-rw-r--r--peripheral/libupm/docs/images/rpr220.jpgbin35658 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/si114x.jpgbin195431 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/sm130.jpgbin116396 -> 0 bytes
-rw-r--r--peripheral/libupm/docs/images/ssd1306.jpegbin73623 -> 0 bytes
-rw-r--r--peripheral/libupm/docs/images/ssd1308.jpegbin19579 -> 0 bytes
-rw-r--r--peripheral/libupm/docs/images/ssd1327.jpegbin62983 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/st7735.jpgbin152757 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/stepmotor.jpgbin52854 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/sx6119.jpgbin32998 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/ta12200.jpgbin19342 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/tcs3414cs.jpgbin30124 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/th02.jpgbin14977 -> 0 bytes
-rw-r--r--peripheral/libupm/docs/images/tm1637.jpegbin24423 -> 0 bytes
-rw-r--r--peripheral/libupm/docs/images/tp401.jpegbin14438 -> 0 bytes
-rw-r--r--peripheral/libupm/docs/images/tsl2561.jpgbin22834 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/ttp223.jpgbin11595 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/ublox6.jpgbin22990 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/uln200xa.jpgbin22136 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/waterlevel.jpgbin15279 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/wt5001.jpgbin37938 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/yg1006.jpgbin97312 -> 0 bytes
-rwxr-xr-xperipheral/libupm/docs/images/zfm20.jpgbin2788 -> 0 bytes
-rw-r--r--peripheral/libupm/docs/knownlimitations.md83
-rw-r--r--peripheral/libupm/docs/max31855.md97
-rw-r--r--peripheral/libupm/docs/naming.md30
-rw-r--r--peripheral/libupm/docs/porting.md65
-rw-r--r--peripheral/libupm/doxy/Doxyfile.in2370
-rw-r--r--peripheral/libupm/doxy/Doxyfile.java.in2332
-rw-r--r--peripheral/libupm/doxy/DoxygenLayout.xml198
-rw-r--r--peripheral/libupm/doxy/README.cpp.md82
-rw-r--r--peripheral/libupm/doxy/README.java.md81
-rw-r--r--peripheral/libupm/doxy/conf.py.in352
-rw-r--r--peripheral/libupm/doxy/index.rst94
-rw-r--r--peripheral/libupm/doxy/node/docgen.js59
-rw-r--r--peripheral/libupm/doxy/node/generators/jsdoc/conf.json7
-rw-r--r--peripheral/libupm/doxy/node/generators/jsdoc/generator.js89
-rw-r--r--peripheral/libupm/doxy/node/generators/ternjs/generator.js132
-rw-r--r--peripheral/libupm/doxy/node/generators/yuidoc/conf.json8
-rw-r--r--peripheral/libupm/doxy/node/generators/yuidoc/generator.js144
-rw-r--r--peripheral/libupm/doxy/node/generators/yuidoc/helper.js194
-rw-r--r--peripheral/libupm/doxy/node/generators/yuidoc/tmpl/LICENSE27
-rw-r--r--peripheral/libupm/doxy/node/generators/yuidoc/tmpl/assets/css/main.css814
-rw-r--r--peripheral/libupm/doxy/node/generators/yuidoc/tmpl/layouts/main.handlebars53
-rw-r--r--peripheral/libupm/doxy/node/generators/yuidoc/tmpl/partials/classes.handlebars205
-rw-r--r--peripheral/libupm/doxy/node/generators/yuidoc/tmpl/partials/index.handlebars180
-rw-r--r--peripheral/libupm/doxy/node/generators/yuidoc/tmpl/partials/method.handlebars212
-rw-r--r--peripheral/libupm/doxy/node/generators/yuidoc/tmpl/partials/module.handlebars92
-rw-r--r--peripheral/libupm/doxy/node/generators/yuidoc/tmpl/partials/options.handlebars22
-rw-r--r--peripheral/libupm/doxy/node/generators/yuidoc/tmpl/partials/props.handlebars119
-rw-r--r--peripheral/libupm/doxy/node/generators/yuidoc/tmpl/partials/sidebar.handlebars27
-rw-r--r--peripheral/libupm/doxy/node/grammars/xml.peg45
-rw-r--r--peripheral/libupm/doxy/node/tolower.js125
-rw-r--r--peripheral/libupm/doxy/node/xml2js.js935
-rw-r--r--peripheral/libupm/doxy/samples.mapping.txt73
-rw-r--r--peripheral/libupm/examples/c++/CMakeLists.txt260
-rw-r--r--peripheral/libupm/examples/c++/a110x-intr.cxx76
-rw-r--r--peripheral/libupm/examples/c++/a110x.cxx67
-rw-r--r--peripheral/libupm/examples/c++/ad8232.cxx65
-rw-r--r--peripheral/libupm/examples/c++/adafruitms1438-stepper.cxx82
-rw-r--r--peripheral/libupm/examples/c++/adafruitms1438.cxx75
-rw-r--r--peripheral/libupm/examples/c++/adafruitss.cxx77
-rw-r--r--peripheral/libupm/examples/c++/adc121c021.cxx66
-rw-r--r--peripheral/libupm/examples/c++/adis16448.cxx66
-rw-r--r--peripheral/libupm/examples/c++/ads1x15.cxx320
-rw-r--r--peripheral/libupm/examples/c++/adxl335.cxx78
-rw-r--r--peripheral/libupm/examples/c++/adxl345.cxx51
-rw-r--r--peripheral/libupm/examples/c++/adxrs610.cxx71
-rw-r--r--peripheral/libupm/examples/c++/ak8975.cxx72
-rw-r--r--peripheral/libupm/examples/c++/am2315.cxx75
-rw-r--r--peripheral/libupm/examples/c++/apds9002.cxx62
-rw-r--r--peripheral/libupm/examples/c++/apds9930.cxx63
-rw-r--r--peripheral/libupm/examples/c++/at42qt1070.cxx90
-rw-r--r--peripheral/libupm/examples/c++/biss0001.cxx68
-rw-r--r--peripheral/libupm/examples/c++/bma220.cxx70
-rw-r--r--peripheral/libupm/examples/c++/bmpx8x.cxx80
-rw-r--r--peripheral/libupm/examples/c++/buzzer-sound.cxx54
-rw-r--r--peripheral/libupm/examples/c++/cjq4435.cxx77
-rw-r--r--peripheral/libupm/examples/c++/dfrph.cxx76
-rw-r--r--peripheral/libupm/examples/c++/ds1307.cxx77
-rw-r--r--peripheral/libupm/examples/c++/eboled.cxx49
-rw-r--r--peripheral/libupm/examples/c++/ecs1030.cxx61
-rw-r--r--peripheral/libupm/examples/c++/enc03r.cxx79
-rw-r--r--peripheral/libupm/examples/c++/es08a.cxx61
-rw-r--r--peripheral/libupm/examples/c++/flex.cxx66
-rw-r--r--peripheral/libupm/examples/c++/gp2y0a.cxx73
-rw-r--r--peripheral/libupm/examples/c++/grovebutton.cxx49
-rw-r--r--peripheral/libupm/examples/c++/grovecircularled.cxx64
-rw-r--r--peripheral/libupm/examples/c++/grovecollision.cxx69
-rw-r--r--peripheral/libupm/examples/c++/groveehr.cxx78
-rw-r--r--peripheral/libupm/examples/c++/groveeldriver.cxx66
-rw-r--r--peripheral/libupm/examples/c++/groveelectromagnet.cxx79
-rw-r--r--peripheral/libupm/examples/c++/groveemg.cxx60
-rw-r--r--peripheral/libupm/examples/c++/grovegprs.cxx111
-rw-r--r--peripheral/libupm/examples/c++/grovegsr.cxx63
-rw-r--r--peripheral/libupm/examples/c++/groveled-multi.cxx68
-rw-r--r--peripheral/libupm/examples/c++/groveled.cxx55
-rw-r--r--peripheral/libupm/examples/c++/groveledbar.cxx77
-rw-r--r--peripheral/libupm/examples/c++/grovelight.cxx49
-rw-r--r--peripheral/libupm/examples/c++/grovelinefinder.cxx66
-rw-r--r--peripheral/libupm/examples/c++/grovemd-stepper.cxx66
-rw-r--r--peripheral/libupm/examples/c++/grovemd.cxx60
-rw-r--r--peripheral/libupm/examples/c++/grovemoisture.cxx75
-rw-r--r--peripheral/libupm/examples/c++/groveo2.cxx57
-rw-r--r--peripheral/libupm/examples/c++/groverelay.cxx58
-rw-r--r--peripheral/libupm/examples/c++/groverotary.cxx57
-rw-r--r--peripheral/libupm/examples/c++/grovescam.cxx77
-rw-r--r--peripheral/libupm/examples/c++/groveslide.cxx50
-rw-r--r--peripheral/libupm/examples/c++/grovespeaker.cxx49
-rw-r--r--peripheral/libupm/examples/c++/grovetemp.cxx55
-rw-r--r--peripheral/libupm/examples/c++/groveultrasonic.cxx62
-rw-r--r--peripheral/libupm/examples/c++/grovevdiv.cxx67
-rw-r--r--peripheral/libupm/examples/c++/grovewater.cxx65
-rw-r--r--peripheral/libupm/examples/c++/grovewfs.cxx78
-rw-r--r--peripheral/libupm/examples/c++/guvas12d.cxx72
-rw-r--r--peripheral/libupm/examples/c++/h3lis331dl.cxx80
-rw-r--r--peripheral/libupm/examples/c++/hcsr04.cxx64
-rw-r--r--peripheral/libupm/examples/c++/hdxxvxta.cxx79
-rw-r--r--peripheral/libupm/examples/c++/hm11.cxx123
-rw-r--r--peripheral/libupm/examples/c++/hmc5883l.cxx50
-rw-r--r--peripheral/libupm/examples/c++/hmtrp.cxx166
-rw-r--r--peripheral/libupm/examples/c++/hp20x.cxx70
-rw-r--r--peripheral/libupm/examples/c++/ht9170.cxx72
-rw-r--r--peripheral/libupm/examples/c++/htu21d.cxx79
-rw-r--r--peripheral/libupm/examples/c++/hwxpxx.cxx102
-rw-r--r--peripheral/libupm/examples/c++/hx711.cxx43
-rw-r--r--peripheral/libupm/examples/c++/ili9341.cxx84
-rw-r--r--peripheral/libupm/examples/c++/ina132.cxx61
-rw-r--r--peripheral/libupm/examples/c++/isd1820.cxx80
-rw-r--r--peripheral/libupm/examples/c++/itg3200.cxx51
-rw-r--r--peripheral/libupm/examples/c++/jhd1313m1-lcd.cxx43
-rw-r--r--peripheral/libupm/examples/c++/joystick12.cxx66
-rw-r--r--peripheral/libupm/examples/c++/kxcjk1013.cxx75
-rw-r--r--peripheral/libupm/examples/c++/l298-stepper.cxx61
-rw-r--r--peripheral/libupm/examples/c++/l298.cxx61
-rw-r--r--peripheral/libupm/examples/c++/lcm1602-i2c.cxx48
-rw-r--r--peripheral/libupm/examples/c++/lcm1602-parallel.cxx54
-rw-r--r--peripheral/libupm/examples/c++/ldt0028.cxx90
-rw-r--r--peripheral/libupm/examples/c++/lm35.cxx65
-rw-r--r--peripheral/libupm/examples/c++/lol.cxx67
-rw-r--r--peripheral/libupm/examples/c++/loudness.cxx68
-rw-r--r--peripheral/libupm/examples/c++/lpd8806.cxx104
-rw-r--r--peripheral/libupm/examples/c++/lsm303.cxx71
-rw-r--r--peripheral/libupm/examples/c++/lsm9ds0.cxx83
-rw-r--r--peripheral/libupm/examples/c++/m24lr64e.cxx65
-rw-r--r--peripheral/libupm/examples/c++/max31723.cxx61
-rw-r--r--peripheral/libupm/examples/c++/max31855.cxx41
-rw-r--r--peripheral/libupm/examples/c++/max44000.cxx42
-rw-r--r--peripheral/libupm/examples/c++/max5487.cxx66
-rw-r--r--peripheral/libupm/examples/c++/maxds3231m.cxx75
-rw-r--r--peripheral/libupm/examples/c++/maxsonarez.cxx72
-rw-r--r--peripheral/libupm/examples/c++/mcp9808.cxx163
-rw-r--r--peripheral/libupm/examples/c++/mg811.cxx68
-rw-r--r--peripheral/libupm/examples/c++/mhz16.cxx84
-rw-r--r--peripheral/libupm/examples/c++/mic.cxx79
-rw-r--r--peripheral/libupm/examples/c++/micsv89.cxx78
-rw-r--r--peripheral/libupm/examples/c++/mlx90614.cxx60
-rw-r--r--peripheral/libupm/examples/c++/mma7455.cxx64
-rw-r--r--peripheral/libupm/examples/c++/mma7660.cxx86
-rw-r--r--peripheral/libupm/examples/c++/mpl3115a2.cxx83
-rw-r--r--peripheral/libupm/examples/c++/mpr121.cxx88
-rw-r--r--peripheral/libupm/examples/c++/mpu60x0.cxx77
-rw-r--r--peripheral/libupm/examples/c++/mpu9150.cxx81
-rw-r--r--peripheral/libupm/examples/c++/mpu9250.cxx81
-rw-r--r--peripheral/libupm/examples/c++/mq2.cxx79
-rw-r--r--peripheral/libupm/examples/c++/mq3.cxx79
-rw-r--r--peripheral/libupm/examples/c++/mq303a.cxx78
-rw-r--r--peripheral/libupm/examples/c++/mq4.cxx81
-rw-r--r--peripheral/libupm/examples/c++/mq5.cxx74
-rw-r--r--peripheral/libupm/examples/c++/mq6.cxx81
-rw-r--r--peripheral/libupm/examples/c++/mq7.cxx81
-rw-r--r--peripheral/libupm/examples/c++/mq8.cxx81
-rw-r--r--peripheral/libupm/examples/c++/mq9.cxx74
-rw-r--r--peripheral/libupm/examples/c++/nlgpio16.cxx52
-rw-r--r--peripheral/libupm/examples/c++/nrf24l01-broadcast.cxx86
-rw-r--r--peripheral/libupm/examples/c++/nrf24l01-receiver.cxx76
-rw-r--r--peripheral/libupm/examples/c++/nrf24l01-transmitter.cxx78
-rw-r--r--peripheral/libupm/examples/c++/nrf8001-broadcast.cxx177
-rw-r--r--peripheral/libupm/examples/c++/nrf8001-broadcast.h93
-rw-r--r--peripheral/libupm/examples/c++/nrf8001-helloworld.cxx362
-rw-r--r--peripheral/libupm/examples/c++/nrf8001-helloworld.h254
-rw-r--r--peripheral/libupm/examples/c++/nunchuck.cxx79
-rw-r--r--peripheral/libupm/examples/c++/otp538u.cxx71
-rw-r--r--peripheral/libupm/examples/c++/ozw.cxx141
-rw-r--r--peripheral/libupm/examples/c++/pca9685.cxx78
-rw-r--r--peripheral/libupm/examples/c++/pn532-writeurl.cxx115
-rw-r--r--peripheral/libupm/examples/c++/pn532.cxx101
-rw-r--r--peripheral/libupm/examples/c++/ppd42ns.cxx63
-rw-r--r--peripheral/libupm/examples/c++/pulsensor.cxx62
-rw-r--r--peripheral/libupm/examples/c++/rfr359f.cxx67
-rw-r--r--peripheral/libupm/examples/c++/rgbringcoder.cxx110
-rw-r--r--peripheral/libupm/examples/c++/rhusb.cxx88
-rw-r--r--peripheral/libupm/examples/c++/rotaryencoder.cxx61
-rw-r--r--peripheral/libupm/examples/c++/rpr220-intr.cxx78
-rw-r--r--peripheral/libupm/examples/c++/rpr220.cxx68
-rw-r--r--peripheral/libupm/examples/c++/sainsmartks.cxx66
-rw-r--r--peripheral/libupm/examples/c++/si114x.cxx78
-rw-r--r--peripheral/libupm/examples/c++/sm130.cxx74
-rw-r--r--peripheral/libupm/examples/c++/ssd1306-oled.cxx149
-rw-r--r--peripheral/libupm/examples/c++/ssd1308-oled.cxx99
-rw-r--r--peripheral/libupm/examples/c++/ssd1327-oled.cxx127
-rw-r--r--peripheral/libupm/examples/c++/ssd1351.cxx61
-rw-r--r--peripheral/libupm/examples/c++/st7735.cxx79
-rw-r--r--peripheral/libupm/examples/c++/stepmotor.cxx78
-rw-r--r--peripheral/libupm/examples/c++/sx1276-fsk.cxx121
-rw-r--r--peripheral/libupm/examples/c++/sx1276-lora.cxx119
-rw-r--r--peripheral/libupm/examples/c++/sx6119.cxx69
-rw-r--r--peripheral/libupm/examples/c++/t3311.cxx115
-rw-r--r--peripheral/libupm/examples/c++/ta12200.cxx65
-rw-r--r--peripheral/libupm/examples/c++/tcs3414cs.cxx65
-rw-r--r--peripheral/libupm/examples/c++/th02.cxx64
-rw-r--r--peripheral/libupm/examples/c++/tm1637.cxx79
-rw-r--r--peripheral/libupm/examples/c++/tp401.cxx70
-rw-r--r--peripheral/libupm/examples/c++/tsl2561.cxx54
-rw-r--r--peripheral/libupm/examples/c++/ttp223.cxx54
-rw-r--r--peripheral/libupm/examples/c++/ublox6.cxx97
-rw-r--r--peripheral/libupm/examples/c++/uln200xa.cxx62
-rw-r--r--peripheral/libupm/examples/c++/urm37-uart.cxx66
-rw-r--r--peripheral/libupm/examples/c++/urm37.cxx65
-rw-r--r--peripheral/libupm/examples/c++/waterlevel.cxx62
-rw-r--r--peripheral/libupm/examples/c++/wheelencoder.cxx69
-rw-r--r--peripheral/libupm/examples/c++/wt5001.cxx130
-rw-r--r--peripheral/libupm/examples/c++/xbee.cxx145
-rw-r--r--peripheral/libupm/examples/c++/yg1006.cxx66
-rw-r--r--peripheral/libupm/examples/c++/zfm20-register.cxx140
-rw-r--r--peripheral/libupm/examples/c++/zfm20.cxx112
-rw-r--r--peripheral/libupm/examples/java/A110XSample.java43
-rw-r--r--peripheral/libupm/examples/java/A110X_intrSample.java57
-rw-r--r--peripheral/libupm/examples/java/ADC121C021Sample.java46
-rw-r--r--peripheral/libupm/examples/java/Ad8232Example.java62
-rw-r--r--peripheral/libupm/examples/java/Adxl345Sample.java51
-rw-r--r--peripheral/libupm/examples/java/Apds9002.java47
-rw-r--r--peripheral/libupm/examples/java/BISS0001Sample.java45
-rw-r--r--peripheral/libupm/examples/java/BMPX8XSample.java48
-rw-r--r--peripheral/libupm/examples/java/BuzzerSample.java55
-rw-r--r--peripheral/libupm/examples/java/Buzzer_soundSample.java57
-rw-r--r--peripheral/libupm/examples/java/CJQ4435Sample.java52
-rw-r--r--peripheral/libupm/examples/java/CMakeLists.txt116
-rw-r--r--peripheral/libupm/examples/java/DS1307Sample.java74
-rw-r--r--peripheral/libupm/examples/java/ENC03RSample.java55
-rw-r--r--peripheral/libupm/examples/java/ES08ASample.java53
-rw-r--r--peripheral/libupm/examples/java/FlexSensorExample.java41
-rw-r--r--peripheral/libupm/examples/java/GROVESCAMSample.java66
-rw-r--r--peripheral/libupm/examples/java/GUVAS12DSample.java46
-rw-r--r--peripheral/libupm/examples/java/Gp2y0aExample.java68
-rw-r--r--peripheral/libupm/examples/java/GroveButtonSample.java40
-rw-r--r--peripheral/libupm/examples/java/GroveButton_intrSample.java53
-rw-r--r--peripheral/libupm/examples/java/GroveCollision.java48
-rw-r--r--peripheral/libupm/examples/java/GroveEHRSample.java53
-rw-r--r--peripheral/libupm/examples/java/GroveEmg.java47
-rw-r--r--peripheral/libupm/examples/java/GroveGsr.java50
-rw-r--r--peripheral/libupm/examples/java/GroveLEDBar.java41
-rw-r--r--peripheral/libupm/examples/java/GroveLEDSample.java39
-rw-r--r--peripheral/libupm/examples/java/GroveLed_multiSample.java45
-rw-r--r--peripheral/libupm/examples/java/GroveLightSample.java41
-rw-r--r--peripheral/libupm/examples/java/GroveLineFinderSample.java45
-rw-r--r--peripheral/libupm/examples/java/GroveMDSample.java53
-rw-r--r--peripheral/libupm/examples/java/GroveMQ3.java70
-rw-r--r--peripheral/libupm/examples/java/GroveMQ9.java70
-rw-r--r--peripheral/libupm/examples/java/GroveMoistureSample.java47
-rw-r--r--peripheral/libupm/examples/java/GroveO2Example.java46
-rw-r--r--peripheral/libupm/examples/java/GroveQTouch.java69
-rw-r--r--peripheral/libupm/examples/java/GroveRelaySample.java44
-rw-r--r--peripheral/libupm/examples/java/GroveRotarySample.java49
-rw-r--r--peripheral/libupm/examples/java/GroveSlideSample.java42
-rw-r--r--peripheral/libupm/examples/java/GroveSpeakerSample.java40
-rw-r--r--peripheral/libupm/examples/java/GroveTempSample.java43
-rw-r--r--peripheral/libupm/examples/java/GroveVDivSample.java50
-rw-r--r--peripheral/libupm/examples/java/GroveWFSSample.java44
-rw-r--r--peripheral/libupm/examples/java/GroveWaterSample.java45
-rw-r--r--peripheral/libupm/examples/java/H3LIS331DLSample.java52
-rw-r--r--peripheral/libupm/examples/java/HCSR04Sample.java43
-rw-r--r--peripheral/libupm/examples/java/HM11Sample.java96
-rw-r--r--peripheral/libupm/examples/java/HMTRPSample.java122
-rw-r--r--peripheral/libupm/examples/java/HP20xExample.java50
-rw-r--r--peripheral/libupm/examples/java/HTU21DSample.java50
-rw-r--r--peripheral/libupm/examples/java/Hmc5883lSample.java50
-rw-r--r--peripheral/libupm/examples/java/Itg3200Sample.java51
-rw-r--r--peripheral/libupm/examples/java/Jhd1313m1Sample.java42
-rw-r--r--peripheral/libupm/examples/java/Jhd1313m1_lcdSample.java42
-rw-r--r--peripheral/libupm/examples/java/Joystick12Sample.java44
-rw-r--r--peripheral/libupm/examples/java/Joystick12_exampleSample.java44
-rw-r--r--peripheral/libupm/examples/java/LDT0028Sample.java42
-rw-r--r--peripheral/libupm/examples/java/LSM303Sample.java59
-rw-r--r--peripheral/libupm/examples/java/Lcm1602_i2cSample.java49
-rw-r--r--peripheral/libupm/examples/java/Lcm1602_parallelSample.java52
-rw-r--r--peripheral/libupm/examples/java/LoLSample.java47
-rw-r--r--peripheral/libupm/examples/java/LoL_exampleSample.java47
-rw-r--r--peripheral/libupm/examples/java/M24LR64ESample.java55
-rw-r--r--peripheral/libupm/examples/java/MAX44000Sample.java38
-rw-r--r--peripheral/libupm/examples/java/MHZ16Sample.java50
-rw-r--r--peripheral/libupm/examples/java/MMA7455Sample.java42
-rw-r--r--peripheral/libupm/examples/java/MMA7660Sample.java55
-rw-r--r--peripheral/libupm/examples/java/MPL3115A2Sample.java45
-rw-r--r--peripheral/libupm/examples/java/MPR121Sample.java34
-rw-r--r--peripheral/libupm/examples/java/MPU9150Sample.java53
-rw-r--r--peripheral/libupm/examples/java/MQ2Sample.java56
-rw-r--r--peripheral/libupm/examples/java/MQ303ASample.java53
-rw-r--r--peripheral/libupm/examples/java/MQ5Sample.java55
-rw-r--r--peripheral/libupm/examples/java/MicrophoneSample.java56
-rw-r--r--peripheral/libupm/examples/java/NRF24L01_receiverSample.java75
-rw-r--r--peripheral/libupm/examples/java/NRF24L01_transmitterSample.java66
-rw-r--r--peripheral/libupm/examples/java/NUNCHUCKSample.java61
-rw-r--r--peripheral/libupm/examples/java/OTP538USample.java43
-rw-r--r--peripheral/libupm/examples/java/PPD42NSSample.java45
-rw-r--r--peripheral/libupm/examples/java/PulsensorSample.java46
-rw-r--r--peripheral/libupm/examples/java/RFR359FSample.java44
-rw-r--r--peripheral/libupm/examples/java/RPR220Sample.java44
-rw-r--r--peripheral/libupm/examples/java/RPR220_intrSample.java54
-rw-r--r--peripheral/libupm/examples/java/RotaryEncoderSample.java40
-rw-r--r--peripheral/libupm/examples/java/SSD1308_oledSample.java89
-rw-r--r--peripheral/libupm/examples/java/SSD1327_oledSample.java135
-rw-r--r--peripheral/libupm/examples/java/ST7735Sample.java77
-rw-r--r--peripheral/libupm/examples/java/StepMotorSample.java56
-rw-r--r--peripheral/libupm/examples/java/TM1637Sample.java58
-rw-r--r--peripheral/libupm/examples/java/TP401Sample.java66
-rw-r--r--peripheral/libupm/examples/java/TSL2561Sample.java40
-rw-r--r--peripheral/libupm/examples/java/TTP223Sample.java42
-rw-r--r--peripheral/libupm/examples/java/Th02Example.java59
-rw-r--r--peripheral/libupm/examples/java/ULN200XASample.java54
-rw-r--r--peripheral/libupm/examples/java/Ublox6Sample.java73
-rw-r--r--peripheral/libupm/examples/java/WT5001Sample.java130
-rw-r--r--peripheral/libupm/examples/java/WaterLevelSensor.java52
-rw-r--r--peripheral/libupm/examples/java/YG1006Sample.java45
-rw-r--r--peripheral/libupm/examples/java/ZFM20Sample.java88
-rw-r--r--peripheral/libupm/examples/javascript/a110x.js47
-rw-r--r--peripheral/libupm/examples/javascript/ad8232.js51
-rw-r--r--peripheral/libupm/examples/javascript/adafruitms1438-stepper.js92
-rw-r--r--peripheral/libupm/examples/javascript/adafruitms1438.js89
-rw-r--r--peripheral/libupm/examples/javascript/adc121c021.js53
-rw-r--r--peripheral/libupm/examples/javascript/adis16448.js67
-rw-r--r--peripheral/libupm/examples/javascript/ads1x15.js46
-rw-r--r--peripheral/libupm/examples/javascript/adxl335.js89
-rw-r--r--peripheral/libupm/examples/javascript/adxl345.js41
-rw-r--r--peripheral/libupm/examples/javascript/adxrs610.js57
-rw-r--r--peripheral/libupm/examples/javascript/ak8975.js64
-rw-r--r--peripheral/libupm/examples/javascript/apds9002.js47
-rw-r--r--peripheral/libupm/examples/javascript/at42qt1070.js81
-rw-r--r--peripheral/libupm/examples/javascript/biss0001.js45
-rw-r--r--peripheral/libupm/examples/javascript/bma220.js59
-rw-r--r--peripheral/libupm/examples/javascript/bmpx8x.js55
-rw-r--r--peripheral/libupm/examples/javascript/buzzer.js65
-rw-r--r--peripheral/libupm/examples/javascript/cjq4435.js87
-rw-r--r--peripheral/libupm/examples/javascript/dfrph.js59
-rw-r--r--peripheral/libupm/examples/javascript/ds1307.js68
-rw-r--r--peripheral/libupm/examples/javascript/eboled.js150
-rw-r--r--peripheral/libupm/examples/javascript/enc03r.js66
-rw-r--r--peripheral/libupm/examples/javascript/es08a.js69
-rw-r--r--peripheral/libupm/examples/javascript/flex.js53
-rw-r--r--peripheral/libupm/examples/javascript/gp2y0a.js60
-rw-r--r--peripheral/libupm/examples/javascript/grove_mcfled.js46
-rw-r--r--peripheral/libupm/examples/javascript/grovebutton.js35
-rw-r--r--peripheral/libupm/examples/javascript/grovecircularled.js49
-rw-r--r--peripheral/libupm/examples/javascript/grovecollision.js62
-rw-r--r--peripheral/libupm/examples/javascript/groveehr.js64
-rw-r--r--peripheral/libupm/examples/javascript/groveeldriver.js54
-rw-r--r--peripheral/libupm/examples/javascript/groveelectromagnet.js57
-rw-r--r--peripheral/libupm/examples/javascript/groveemg.js48
-rw-r--r--peripheral/libupm/examples/javascript/grovegprs.js114
-rw-r--r--peripheral/libupm/examples/javascript/grovegsr.js51
-rw-r--r--peripheral/libupm/examples/javascript/groveled.js46
-rw-r--r--peripheral/libupm/examples/javascript/groveledbar.js73
-rw-r--r--peripheral/libupm/examples/javascript/grovelight.js37
-rw-r--r--peripheral/libupm/examples/javascript/grovelinefinder.js47
-rw-r--r--peripheral/libupm/examples/javascript/grovemd-stepper.js95
-rw-r--r--peripheral/libupm/examples/javascript/grovemd.js94
-rw-r--r--peripheral/libupm/examples/javascript/grovemoisture.js57
-rw-r--r--peripheral/libupm/examples/javascript/groveo2.js52
-rw-r--r--peripheral/libupm/examples/javascript/groverelay.js49
-rw-r--r--peripheral/libupm/examples/javascript/groverotary.js49
-rw-r--r--peripheral/libupm/examples/javascript/grovescam.js72
-rw-r--r--peripheral/libupm/examples/javascript/groveslide.js42
-rw-r--r--peripheral/libupm/examples/javascript/grovespeaker.js44
-rw-r--r--peripheral/libupm/examples/javascript/grovetemp.js42
-rw-r--r--peripheral/libupm/examples/javascript/groveultrasonic.js45
-rw-r--r--peripheral/libupm/examples/javascript/grovevdiv.js53
-rw-r--r--peripheral/libupm/examples/javascript/grovewater.js49
-rw-r--r--peripheral/libupm/examples/javascript/grovewfs.js69
-rw-r--r--peripheral/libupm/examples/javascript/guvas12d.js56
-rw-r--r--peripheral/libupm/examples/javascript/h3lis331dl.js91
-rw-r--r--peripheral/libupm/examples/javascript/hdxxvxta.js64
-rw-r--r--peripheral/libupm/examples/javascript/hm11.js136
-rw-r--r--peripheral/libupm/examples/javascript/hmc5883l.js61
-rw-r--r--peripheral/libupm/examples/javascript/hmtrp.js161
-rw-r--r--peripheral/libupm/examples/javascript/hp20x.js55
-rw-r--r--peripheral/libupm/examples/javascript/ht9170.js54
-rw-r--r--peripheral/libupm/examples/javascript/hwxpxx.js86
-rw-r--r--peripheral/libupm/examples/javascript/hx711.js36
-rw-r--r--peripheral/libupm/examples/javascript/ili9341.js79
-rw-r--r--peripheral/libupm/examples/javascript/ina132.js54
-rw-r--r--peripheral/libupm/examples/javascript/isd1820.js68
-rw-r--r--peripheral/libupm/examples/javascript/itg3200.js64
-rw-r--r--peripheral/libupm/examples/javascript/jhd1313m1-lcd.js41
-rw-r--r--peripheral/libupm/examples/javascript/joystick12.js54
-rw-r--r--peripheral/libupm/examples/javascript/l298-stepper.js77
-rw-r--r--peripheral/libupm/examples/javascript/l298.js77
-rw-r--r--peripheral/libupm/examples/javascript/ldt0028.js82
-rw-r--r--peripheral/libupm/examples/javascript/lm35.js51
-rw-r--r--peripheral/libupm/examples/javascript/loudness.js52
-rw-r--r--peripheral/libupm/examples/javascript/lsm303.js78
-rw-r--r--peripheral/libupm/examples/javascript/lsm9ds0.js77
-rw-r--r--peripheral/libupm/examples/javascript/m24lr64e.js59
-rw-r--r--peripheral/libupm/examples/javascript/maxsonarez.js59
-rw-r--r--peripheral/libupm/examples/javascript/mcp9808.js70
-rw-r--r--peripheral/libupm/examples/javascript/mg811.js53
-rw-r--r--peripheral/libupm/examples/javascript/mhz16.js78
-rw-r--r--peripheral/libupm/examples/javascript/mic.js61
-rw-r--r--peripheral/libupm/examples/javascript/micsv89.js26
-rw-r--r--peripheral/libupm/examples/javascript/mma7660.js98
-rw-r--r--peripheral/libupm/examples/javascript/mpr121.js69
-rw-r--r--peripheral/libupm/examples/javascript/mpu60x0.js71
-rw-r--r--peripheral/libupm/examples/javascript/mpu9150.js76
-rw-r--r--peripheral/libupm/examples/javascript/mpu9250.js76
-rw-r--r--peripheral/libupm/examples/javascript/mq2.js59
-rw-r--r--peripheral/libupm/examples/javascript/mq3.js60
-rw-r--r--peripheral/libupm/examples/javascript/mq303a.js78
-rw-r--r--peripheral/libupm/examples/javascript/mq4.js60
-rw-r--r--peripheral/libupm/examples/javascript/mq5.js57
-rw-r--r--peripheral/libupm/examples/javascript/mq6.js60
-rw-r--r--peripheral/libupm/examples/javascript/mq7.js60
-rw-r--r--peripheral/libupm/examples/javascript/mq8.js60
-rw-r--r--peripheral/libupm/examples/javascript/mq9.js56
-rw-r--r--peripheral/libupm/examples/javascript/nlgpio16.js51
-rw-r--r--peripheral/libupm/examples/javascript/nunchuck.js66
-rw-r--r--peripheral/libupm/examples/javascript/oled_ssd1306.js151
-rw-r--r--peripheral/libupm/examples/javascript/oled_ssd1308.js99
-rw-r--r--peripheral/libupm/examples/javascript/oled_ssd1327.js194
-rw-r--r--peripheral/libupm/examples/javascript/otp538u.js64
-rw-r--r--peripheral/libupm/examples/javascript/ozw.js128
-rw-r--r--peripheral/libupm/examples/javascript/pca9685.js85
-rw-r--r--peripheral/libupm/examples/javascript/pn532-writeurl.js136
-rw-r--r--peripheral/libupm/examples/javascript/pn532.js102
-rw-r--r--peripheral/libupm/examples/javascript/ppd42ns.js52
-rw-r--r--peripheral/libupm/examples/javascript/rfr359f.js48
-rw-r--r--peripheral/libupm/examples/javascript/rgbringcoder.js98
-rw-r--r--peripheral/libupm/examples/javascript/rhusb.js76
-rw-r--r--peripheral/libupm/examples/javascript/rotaryencoder.js43
-rw-r--r--peripheral/libupm/examples/javascript/rpr220.js49
-rw-r--r--peripheral/libupm/examples/javascript/sainsmartks.js53
-rw-r--r--peripheral/libupm/examples/javascript/si114x.js66
-rw-r--r--peripheral/libupm/examples/javascript/sm130.js70
-rw-r--r--peripheral/libupm/examples/javascript/st7735.js65
-rw-r--r--peripheral/libupm/examples/javascript/stepmotor.js68
-rw-r--r--peripheral/libupm/examples/javascript/sx1276-fsk.js112
-rw-r--r--peripheral/libupm/examples/javascript/sx1276-lora.js110
-rw-r--r--peripheral/libupm/examples/javascript/sx6119.js53
-rw-r--r--peripheral/libupm/examples/javascript/t3311.js101
-rw-r--r--peripheral/libupm/examples/javascript/ta12200.js51
-rw-r--r--peripheral/libupm/examples/javascript/tcs3414cs.js47
-rw-r--r--peripheral/libupm/examples/javascript/tm1637.js66
-rw-r--r--peripheral/libupm/examples/javascript/tp401.js68
-rw-r--r--peripheral/libupm/examples/javascript/tsl2561.js44
-rw-r--r--peripheral/libupm/examples/javascript/ttp223.js40
-rw-r--r--peripheral/libupm/examples/javascript/ublox6.js84
-rw-r--r--peripheral/libupm/examples/javascript/uln200xa.js71
-rw-r--r--peripheral/libupm/examples/javascript/urm37-uart.js52
-rw-r--r--peripheral/libupm/examples/javascript/urm37.js52
-rw-r--r--peripheral/libupm/examples/javascript/waterlevel.js50
-rw-r--r--peripheral/libupm/examples/javascript/wheelencoder.js54
-rw-r--r--peripheral/libupm/examples/javascript/wt5001.js130
-rw-r--r--peripheral/libupm/examples/javascript/xbee.js140
-rw-r--r--peripheral/libupm/examples/javascript/yg1006.js47
-rw-r--r--peripheral/libupm/examples/javascript/zfm20-register.js137
-rw-r--r--peripheral/libupm/examples/javascript/zfm20.js97
-rw-r--r--peripheral/libupm/examples/python/a110x.py51
-rw-r--r--peripheral/libupm/examples/python/ad8232.py54
-rw-r--r--peripheral/libupm/examples/python/adafruitms1438-stepper.py88
-rw-r--r--peripheral/libupm/examples/python/adafruitms1438.py83
-rw-r--r--peripheral/libupm/examples/python/adc121c021.py55
-rw-r--r--peripheral/libupm/examples/python/adxl335.py78
-rw-r--r--peripheral/libupm/examples/python/adxl345.py41
-rw-r--r--peripheral/libupm/examples/python/adxrs610.py55
-rw-r--r--peripheral/libupm/examples/python/ak8975.py59
-rw-r--r--peripheral/libupm/examples/python/apds9002.py50
-rw-r--r--peripheral/libupm/examples/python/at42qt1070.py79
-rw-r--r--peripheral/libupm/examples/python/biss0001.py52
-rw-r--r--peripheral/libupm/examples/python/bma220.py55
-rw-r--r--peripheral/libupm/examples/python/bmpx8x.py59
-rw-r--r--peripheral/libupm/examples/python/buzzer.py45
-rw-r--r--peripheral/libupm/examples/python/cjq4435.py46
-rw-r--r--peripheral/libupm/examples/python/dfrph.py56
-rw-r--r--peripheral/libupm/examples/python/ds1307.py60
-rw-r--r--peripheral/libupm/examples/python/eboled.py41
-rw-r--r--peripheral/libupm/examples/python/enc03r.py64
-rw-r--r--peripheral/libupm/examples/python/es08a.py46
-rw-r--r--peripheral/libupm/examples/python/gp2y0a.py62
-rw-r--r--peripheral/libupm/examples/python/grovebutton.py35
-rw-r--r--peripheral/libupm/examples/python/grovecircularled.py50
-rw-r--r--peripheral/libupm/examples/python/grovecollision.py57
-rw-r--r--peripheral/libupm/examples/python/groveehr.py68
-rw-r--r--peripheral/libupm/examples/python/groveeldriver.py57
-rw-r--r--peripheral/libupm/examples/python/groveelectromagnet.py60
-rw-r--r--peripheral/libupm/examples/python/groveemg.py52
-rw-r--r--peripheral/libupm/examples/python/grovegprs.py86
-rw-r--r--peripheral/libupm/examples/python/grovegsr.py53
-rw-r--r--peripheral/libupm/examples/python/groveled.py41
-rw-r--r--peripheral/libupm/examples/python/groveledbar.py64
-rw-r--r--peripheral/libupm/examples/python/grovelight.py37
-rw-r--r--peripheral/libupm/examples/python/grovelinefinder.py51
-rw-r--r--peripheral/libupm/examples/python/grovemd-stepper.py52
-rw-r--r--peripheral/libupm/examples/python/grovemd.py47
-rw-r--r--peripheral/libupm/examples/python/grovemoisture.py61
-rw-r--r--peripheral/libupm/examples/python/groveo2.py51
-rw-r--r--peripheral/libupm/examples/python/groverelay.py44
-rw-r--r--peripheral/libupm/examples/python/groverotary.py45
-rw-r--r--peripheral/libupm/examples/python/grovescam.py61
-rw-r--r--peripheral/libupm/examples/python/groveslide.py39
-rw-r--r--peripheral/libupm/examples/python/grovespeaker.py34
-rw-r--r--peripheral/libupm/examples/python/grovetemp.py41
-rw-r--r--peripheral/libupm/examples/python/grovevdiv.py54
-rw-r--r--peripheral/libupm/examples/python/grovewater.py51
-rw-r--r--peripheral/libupm/examples/python/grovewfs.py64
-rw-r--r--peripheral/libupm/examples/python/guvas12d.py56
-rw-r--r--peripheral/libupm/examples/python/h3lis331dl.py76
-rw-r--r--peripheral/libupm/examples/python/hdxxvxta.py59
-rw-r--r--peripheral/libupm/examples/python/hm11.py110
-rw-r--r--peripheral/libupm/examples/python/hmc5883l.py44
-rw-r--r--peripheral/libupm/examples/python/hmtrp.py143
-rw-r--r--peripheral/libupm/examples/python/hp20x.py54
-rw-r--r--peripheral/libupm/examples/python/ht9170.py54
-rw-r--r--peripheral/libupm/examples/python/hwxpxx.py79
-rw-r--r--peripheral/libupm/examples/python/ili9341.py75
-rw-r--r--peripheral/libupm/examples/python/ina132.py51
-rw-r--r--peripheral/libupm/examples/python/isd1820.py74
-rw-r--r--peripheral/libupm/examples/python/itg3200.py42
-rw-r--r--peripheral/libupm/examples/python/jhd1313m1-lcd.py38
-rw-r--r--peripheral/libupm/examples/python/joystick12.py52
-rw-r--r--peripheral/libupm/examples/python/l298-stepper.py67
-rw-r--r--peripheral/libupm/examples/python/l298.py65
-rw-r--r--peripheral/libupm/examples/python/ldt0028.py66
-rw-r--r--peripheral/libupm/examples/python/lm35.py49
-rw-r--r--peripheral/libupm/examples/python/loudness.py50
-rw-r--r--peripheral/libupm/examples/python/lsm303.py87
-rw-r--r--peripheral/libupm/examples/python/lsm9ds0.py71
-rw-r--r--peripheral/libupm/examples/python/m24lr64e.py49
-rwxr-xr-xperipheral/libupm/examples/python/make_oled_pic.py74
-rw-r--r--peripheral/libupm/examples/python/maxsonarez.py60
-rw-r--r--peripheral/libupm/examples/python/mg811.py51
-rw-r--r--peripheral/libupm/examples/python/mhz16.py70
-rw-r--r--peripheral/libupm/examples/python/mic.py47
-rw-r--r--peripheral/libupm/examples/python/mma7660.py81
-rw-r--r--peripheral/libupm/examples/python/mpr121.py73
-rw-r--r--peripheral/libupm/examples/python/mpu60x0.py65
-rw-r--r--peripheral/libupm/examples/python/mpu9150.py70
-rw-r--r--peripheral/libupm/examples/python/mpu9250.py70
-rw-r--r--peripheral/libupm/examples/python/mq2.py62
-rw-r--r--peripheral/libupm/examples/python/mq3.py62
-rw-r--r--peripheral/libupm/examples/python/mq303a.py75
-rw-r--r--peripheral/libupm/examples/python/mq4.py62
-rw-r--r--peripheral/libupm/examples/python/mq5.py62
-rw-r--r--peripheral/libupm/examples/python/mq6.py62
-rw-r--r--peripheral/libupm/examples/python/mq7.py62
-rw-r--r--peripheral/libupm/examples/python/mq8.py62
-rw-r--r--peripheral/libupm/examples/python/mq9.py62
-rw-r--r--peripheral/libupm/examples/python/nlgpio16.py51
-rw-r--r--peripheral/libupm/examples/python/nunchuck.py73
-rw-r--r--peripheral/libupm/examples/python/oled_ssd1308.py95
-rw-r--r--peripheral/libupm/examples/python/oled_ssd1327.py189
-rw-r--r--peripheral/libupm/examples/python/otp538u.py58
-rw-r--r--peripheral/libupm/examples/python/ozw.py126
-rw-r--r--peripheral/libupm/examples/python/pn532-writeurl.py105
-rw-r--r--peripheral/libupm/examples/python/pn532.py85
-rw-r--r--peripheral/libupm/examples/python/ppd42ns.py56
-rw-r--r--peripheral/libupm/examples/python/rfr359f.py52
-rw-r--r--peripheral/libupm/examples/python/rgbringcoder.py90
-rw-r--r--peripheral/libupm/examples/python/rhusb.py69
-rw-r--r--peripheral/libupm/examples/python/rotaryencoder.py49
-rw-r--r--peripheral/libupm/examples/python/rpr220.py56
-rw-r--r--peripheral/libupm/examples/python/sainsmartks.py54
-rw-r--r--peripheral/libupm/examples/python/si114x.py66
-rw-r--r--peripheral/libupm/examples/python/sm130.py63
-rw-r--r--peripheral/libupm/examples/python/stepmotor.py64
-rw-r--r--peripheral/libupm/examples/python/sx1276-fsk.py89
-rw-r--r--peripheral/libupm/examples/python/sx1276-lora.py88
-rw-r--r--peripheral/libupm/examples/python/sx6119.py50
-rw-r--r--peripheral/libupm/examples/python/t3311.py90
-rw-r--r--peripheral/libupm/examples/python/ta12200.py54
-rw-r--r--peripheral/libupm/examples/python/tcs3414cs.py55
-rw-r--r--peripheral/libupm/examples/python/tm1637.py54
-rw-r--r--peripheral/libupm/examples/python/tp401.py54
-rw-r--r--peripheral/libupm/examples/python/tsl2561.py48
-rw-r--r--peripheral/libupm/examples/python/ttp223.py39
-rw-r--r--peripheral/libupm/examples/python/ublox6.py82
-rw-r--r--peripheral/libupm/examples/python/uln200xa.py66
-rw-r--r--peripheral/libupm/examples/python/urm37-uart.py50
-rw-r--r--peripheral/libupm/examples/python/urm37.py50
-rw-r--r--peripheral/libupm/examples/python/using_carrays.py31
-rw-r--r--peripheral/libupm/examples/python/waterlevel.py54
-rw-r--r--peripheral/libupm/examples/python/wheelencoder.py50
-rw-r--r--peripheral/libupm/examples/python/wt5001.py107
-rw-r--r--peripheral/libupm/examples/python/xbee.py117
-rw-r--r--peripheral/libupm/examples/python/yg1006.py52
-rw-r--r--peripheral/libupm/examples/python/zfm20-register.py132
-rw-r--r--peripheral/libupm/examples/python/zfm20.py90
-rw-r--r--peripheral/libupm/src/CMakeLists.txt238
-rw-r--r--peripheral/libupm/src/a110x/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/a110x/a110x.cxx82
-rw-r--r--peripheral/libupm/src/a110x/a110x.h109
-rw-r--r--peripheral/libupm/src/a110x/javaupm_a110x.i20
-rw-r--r--peripheral/libupm/src/a110x/jsupm_a110x.i8
-rw-r--r--peripheral/libupm/src/a110x/pyupm_a110x.i11
-rw-r--r--peripheral/libupm/src/ad8232/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/ad8232/ad8232.cxx52
-rw-r--r--peripheral/libupm/src/ad8232/ad8232.h110
-rw-r--r--peripheral/libupm/src/ad8232/javaupm_ad8232.i19
-rw-r--r--peripheral/libupm/src/ad8232/jsupm_ad8232.i8
-rw-r--r--peripheral/libupm/src/ad8232/pyupm_ad8232.i11
-rw-r--r--peripheral/libupm/src/adafruitms1438/CMakeLists.txt19
-rw-r--r--peripheral/libupm/src/adafruitms1438/adafruitms1438.cxx310
-rw-r--r--peripheral/libupm/src/adafruitms1438/adafruitms1438.h251
-rw-r--r--peripheral/libupm/src/adafruitms1438/javaupm_adafruitms1438.i19
-rw-r--r--peripheral/libupm/src/adafruitms1438/jsupm_adafruitms1438.i8
-rw-r--r--peripheral/libupm/src/adafruitms1438/pyupm_adafruitms1438.i15
-rw-r--r--peripheral/libupm/src/adafruitss/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/adafruitss/adafruitss.cxx161
-rw-r--r--peripheral/libupm/src/adafruitss/adafruitss.h117
-rw-r--r--peripheral/libupm/src/adafruitss/javaupm_adafruitss.i18
-rw-r--r--peripheral/libupm/src/adafruitss/jsupm_adafruitss.i7
-rw-r--r--peripheral/libupm/src/adafruitss/pyupm_adafruitss.i11
-rw-r--r--peripheral/libupm/src/adc121c021/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/adc121c021/adc121c021.cxx261
-rw-r--r--peripheral/libupm/src/adc121c021/adc121c021.h314
-rw-r--r--peripheral/libupm/src/adc121c021/javaupm_adc121c021.i20
-rw-r--r--peripheral/libupm/src/adc121c021/jsupm_adc121c021.i9
-rw-r--r--peripheral/libupm/src/adc121c021/pyupm_adc121c021.i15
-rw-r--r--peripheral/libupm/src/adis16448/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/adis16448/adis16448.cxx247
-rw-r--r--peripheral/libupm/src/adis16448/adis16448.h173
-rw-r--r--peripheral/libupm/src/adis16448/javaupm_adis16448.i19
-rw-r--r--peripheral/libupm/src/adis16448/jsupm_adis16448.i8
-rw-r--r--peripheral/libupm/src/adis16448/pyupm_adis16448.i10
-rw-r--r--peripheral/libupm/src/ads1x15/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/ads1x15/ads1015.cxx102
-rw-r--r--peripheral/libupm/src/ads1x15/ads1015.h140
-rw-r--r--peripheral/libupm/src/ads1x15/ads1115.cxx103
-rw-r--r--peripheral/libupm/src/ads1x15/ads1115.h145
-rw-r--r--peripheral/libupm/src/ads1x15/ads1x15.cxx187
-rw-r--r--peripheral/libupm/src/ads1x15/ads1x15.h424
-rw-r--r--peripheral/libupm/src/ads1x15/javaupm_ads1x15.i26
-rw-r--r--peripheral/libupm/src/ads1x15/jsupm_ads1x15.i17
-rw-r--r--peripheral/libupm/src/ads1x15/pyupm_ads1x15.i21
-rw-r--r--peripheral/libupm/src/adxl335/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/adxl335/adxl335.cxx125
-rw-r--r--peripheral/libupm/src/adxl335/adxl335.h150
-rw-r--r--peripheral/libupm/src/adxl335/javaupm_adxl335.i54
-rw-r--r--peripheral/libupm/src/adxl335/jsupm_adxl335.i12
-rw-r--r--peripheral/libupm/src/adxl335/pyupm_adxl335.i15
-rw-r--r--peripheral/libupm/src/adxl345/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/adxl345/adxl345.cxx177
-rw-r--r--peripheral/libupm/src/adxl345/adxl345.h110
-rw-r--r--peripheral/libupm/src/adxl345/javaupm_adxl345.i47
-rw-r--r--peripheral/libupm/src/adxl345/jsupm_adxl345.i20
-rw-r--r--peripheral/libupm/src/adxl345/pyupm_adxl345.i25
-rw-r--r--peripheral/libupm/src/adxrs610/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/adxrs610/adxrs610.cxx99
-rw-r--r--peripheral/libupm/src/adxrs610/adxrs610.h175
-rw-r--r--peripheral/libupm/src/adxrs610/javaupm_adxrs610.i19
-rw-r--r--peripheral/libupm/src/adxrs610/jsupm_adxrs610.i8
-rw-r--r--peripheral/libupm/src/adxrs610/pyupm_adxrs610.i11
-rw-r--r--peripheral/libupm/src/am2315/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/am2315/am2315.cpp319
-rw-r--r--peripheral/libupm/src/am2315/am2315.h203
-rw-r--r--peripheral/libupm/src/am2315/javaupm_am2315.i19
-rw-r--r--peripheral/libupm/src/am2315/jsupm_am2315.i8
-rw-r--r--peripheral/libupm/src/am2315/pyupm_am2315.i15
-rw-r--r--peripheral/libupm/src/apds9002/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/apds9002/apds9002.cxx51
-rw-r--r--peripheral/libupm/src/apds9002/apds9002.h78
-rw-r--r--peripheral/libupm/src/apds9002/javaupm_apds9002.i19
-rw-r--r--peripheral/libupm/src/apds9002/jsupm_apds9002.i8
-rw-r--r--peripheral/libupm/src/apds9002/pyupm_apds9002.i11
-rw-r--r--peripheral/libupm/src/apds9930/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/apds9930/apds9930.cxx61
-rw-r--r--peripheral/libupm/src/apds9930/apds9930.h82
-rw-r--r--peripheral/libupm/src/apds9930/javaupm_apds9930.i18
-rw-r--r--peripheral/libupm/src/apds9930/jsupm_apds9930.i8
-rw-r--r--peripheral/libupm/src/apds9930/pyupm_apds9930.i9
-rw-r--r--peripheral/libupm/src/at42qt1070/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/at42qt1070/at42qt1070.cxx252
-rw-r--r--peripheral/libupm/src/at42qt1070/at42qt1070.h313
-rw-r--r--peripheral/libupm/src/at42qt1070/javaupm_at42qt1070.i19
-rw-r--r--peripheral/libupm/src/at42qt1070/jsupm_at42qt1070.i8
-rw-r--r--peripheral/libupm/src/at42qt1070/pyupm_at42qt1070.i15
-rw-r--r--peripheral/libupm/src/biss0001/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/biss0001/biss0001.cxx52
-rw-r--r--peripheral/libupm/src/biss0001/biss0001.h78
-rw-r--r--peripheral/libupm/src/biss0001/javaupm_biss0001.i19
-rw-r--r--peripheral/libupm/src/biss0001/jsupm_biss0001.i8
-rw-r--r--peripheral/libupm/src/biss0001/pyupm_biss0001.i11
-rw-r--r--peripheral/libupm/src/bma220/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/bma220/bma220.cxx531
-rw-r--r--peripheral/libupm/src/bma220/bma220.h831
-rw-r--r--peripheral/libupm/src/bma220/javaupm_bma220.i42
-rw-r--r--peripheral/libupm/src/bma220/jsupm_bma220.i11
-rw-r--r--peripheral/libupm/src/bma220/pyupm_bma220.i17
-rw-r--r--peripheral/libupm/src/bmpx8x/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/bmpx8x/bmpx8x.cxx219
-rw-r--r--peripheral/libupm/src/bmpx8x/bmpx8x.h185
-rw-r--r--peripheral/libupm/src/bmpx8x/javaupm_bmpx8x.i19
-rw-r--r--peripheral/libupm/src/bmpx8x/jsupm_bmpx8x.i8
-rw-r--r--peripheral/libupm/src/bmpx8x/pyupm_bmpx8x.i12
-rw-r--r--peripheral/libupm/src/buzzer/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/buzzer/buzzer.cxx77
-rw-r--r--peripheral/libupm/src/buzzer/buzzer.h127
-rw-r--r--peripheral/libupm/src/buzzer/javaupm_buzzer.i19
-rw-r--r--peripheral/libupm/src/buzzer/jsupm_buzzer.i8
-rw-r--r--peripheral/libupm/src/buzzer/pyupm_buzzer.i11
-rw-r--r--peripheral/libupm/src/carrays_float.i8
-rw-r--r--peripheral/libupm/src/carrays_int16_t.i8
-rw-r--r--peripheral/libupm/src/carrays_uint16_t.i35
-rw-r--r--peripheral/libupm/src/carrays_uint32_t.i56
-rw-r--r--peripheral/libupm/src/carrays_uint8_t.i35
-rw-r--r--peripheral/libupm/src/cjq4435/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/cjq4435/cjq4435.cxx111
-rw-r--r--peripheral/libupm/src/cjq4435/cjq4435.h125
-rw-r--r--peripheral/libupm/src/cjq4435/javaupm_cjq4435.i19
-rw-r--r--peripheral/libupm/src/cjq4435/jsupm_cjq4435.i8
-rw-r--r--peripheral/libupm/src/cjq4435/pyupm_cjq4435.i11
-rw-r--r--peripheral/libupm/src/dfrph/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/dfrph/dfrph.cxx74
-rw-r--r--peripheral/libupm/src/dfrph/dfrph.h143
-rw-r--r--peripheral/libupm/src/dfrph/javaupm_dfrph.i19
-rw-r--r--peripheral/libupm/src/dfrph/jsupm_dfrph.i8
-rw-r--r--peripheral/libupm/src/dfrph/pyupm_dfrph.i11
-rwxr-xr-xperipheral/libupm/src/doxy2swig.py457
-rw-r--r--peripheral/libupm/src/ds1307/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/ds1307/ds1307.cxx213
-rw-r--r--peripheral/libupm/src/ds1307/ds1307.h193
-rw-r--r--peripheral/libupm/src/ds1307/javaupm_ds1307.i21
-rw-r--r--peripheral/libupm/src/ds1307/jsupm_ds1307.i8
-rw-r--r--peripheral/libupm/src/ds1307/pyupm_ds1307.i15
-rw-r--r--peripheral/libupm/src/ecs1030/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/ecs1030/ecs1030.cxx97
-rw-r--r--peripheral/libupm/src/ecs1030/ecs1030.h129
-rw-r--r--peripheral/libupm/src/ecs1030/javaupm_ecs1030.i19
-rw-r--r--peripheral/libupm/src/ecs1030/jsupm_ecs1030.i8
-rw-r--r--peripheral/libupm/src/ecs1030/pyupm_ecs1030.i13
-rw-r--r--peripheral/libupm/src/enc03r/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/enc03r/enc03r.cxx77
-rw-r--r--peripheral/libupm/src/enc03r/enc03r.h115
-rw-r--r--peripheral/libupm/src/enc03r/javaupm_enc03r.i19
-rw-r--r--peripheral/libupm/src/enc03r/jsupm_enc03r.i8
-rw-r--r--peripheral/libupm/src/enc03r/pyupm_enc03r.i11
-rw-r--r--peripheral/libupm/src/flex/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/flex/flex.cxx52
-rw-r--r--peripheral/libupm/src/flex/flex.h81
-rw-r--r--peripheral/libupm/src/flex/javaupm_flex.i19
-rw-r--r--peripheral/libupm/src/flex/jsupm_flex.i8
-rw-r--r--peripheral/libupm/src/flex/pyupm_flex.i11
-rw-r--r--peripheral/libupm/src/gas/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/gas/README.txt8
-rw-r--r--peripheral/libupm/src/gas/gas.cxx98
-rw-r--r--peripheral/libupm/src/gas/gas.h104
-rw-r--r--peripheral/libupm/src/gas/javaupm_gas.i68
-rw-r--r--peripheral/libupm/src/gas/jsupm_gas.i53
-rw-r--r--peripheral/libupm/src/gas/mq2.cxx33
-rw-r--r--peripheral/libupm/src/gas/mq2.h74
-rw-r--r--peripheral/libupm/src/gas/mq3.cxx33
-rw-r--r--peripheral/libupm/src/gas/mq3.h73
-rw-r--r--peripheral/libupm/src/gas/mq4.cxx35
-rw-r--r--peripheral/libupm/src/gas/mq4.h75
-rw-r--r--peripheral/libupm/src/gas/mq5.cxx33
-rw-r--r--peripheral/libupm/src/gas/mq5.h74
-rw-r--r--peripheral/libupm/src/gas/mq6.cxx35
-rw-r--r--peripheral/libupm/src/gas/mq6.h75
-rw-r--r--peripheral/libupm/src/gas/mq7.cxx35
-rw-r--r--peripheral/libupm/src/gas/mq7.h75
-rw-r--r--peripheral/libupm/src/gas/mq8.cxx35
-rw-r--r--peripheral/libupm/src/gas/mq8.h75
-rw-r--r--peripheral/libupm/src/gas/mq9.cxx33
-rw-r--r--peripheral/libupm/src/gas/mq9.h72
-rw-r--r--peripheral/libupm/src/gas/pyupm_gas.i57
-rw-r--r--peripheral/libupm/src/gas/tp401.cxx39
-rw-r--r--peripheral/libupm/src/gas/tp401.h89
-rw-r--r--peripheral/libupm/src/gp2y0a/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/gp2y0a/gp2y0a.cxx67
-rw-r--r--peripheral/libupm/src/gp2y0a/gp2y0a.h87
-rw-r--r--peripheral/libupm/src/gp2y0a/javaupm_gp2y0a.i19
-rw-r--r--peripheral/libupm/src/gp2y0a/jsupm_gp2y0a.i8
-rw-r--r--peripheral/libupm/src/gp2y0a/pyupm_gp2y0a.i11
-rw-r--r--peripheral/libupm/src/grove/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/grove/grove.cxx302
-rw-r--r--peripheral/libupm/src/grove/grove.h410
-rw-r--r--peripheral/libupm/src/grove/grovebutton.h42
-rw-r--r--peripheral/libupm/src/grove/groveled.h48
-rw-r--r--peripheral/libupm/src/grove/grovelight.h46
-rw-r--r--peripheral/libupm/src/grove/groverelay.h45
-rw-r--r--peripheral/libupm/src/grove/groverotary.h45
-rw-r--r--peripheral/libupm/src/grove/groveslide.h42
-rw-r--r--peripheral/libupm/src/grove/grovetemp.h42
-rw-r--r--peripheral/libupm/src/grove/javaupm_grove.i23
-rw-r--r--peripheral/libupm/src/grove/jsupm_grove.i8
-rw-r--r--peripheral/libupm/src/grove/pyupm_grove.i15
-rw-r--r--peripheral/libupm/src/grovecollision/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/grovecollision/grovecollision.cxx53
-rw-r--r--peripheral/libupm/src/grovecollision/grovecollision.h72
-rw-r--r--peripheral/libupm/src/grovecollision/javaupm_grovecollision.i19
-rw-r--r--peripheral/libupm/src/grovecollision/jsupm_grovecollision.i8
-rw-r--r--peripheral/libupm/src/grovecollision/pyupm_grovecollision.i11
-rw-r--r--peripheral/libupm/src/groveehr/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/groveehr/groveehr.cxx130
-rw-r--r--peripheral/libupm/src/groveehr/groveehr.h126
-rw-r--r--peripheral/libupm/src/groveehr/javaupm_groveehr.i21
-rw-r--r--peripheral/libupm/src/groveehr/jsupm_groveehr.i8
-rw-r--r--peripheral/libupm/src/groveehr/pyupm_groveehr.i11
-rw-r--r--peripheral/libupm/src/groveeldriver/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/groveeldriver/groveeldriver.cxx62
-rw-r--r--peripheral/libupm/src/groveeldriver/groveeldriver.h78
-rw-r--r--peripheral/libupm/src/groveeldriver/javaupm_groveeldriver.i19
-rw-r--r--peripheral/libupm/src/groveeldriver/jsupm_groveeldriver.i8
-rw-r--r--peripheral/libupm/src/groveeldriver/pyupm_groveeldriver.i11
-rw-r--r--peripheral/libupm/src/groveelectromagnet/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/groveelectromagnet/groveelectromagnet.cxx62
-rw-r--r--peripheral/libupm/src/groveelectromagnet/groveelectromagnet.h77
-rw-r--r--peripheral/libupm/src/groveelectromagnet/javaupm_groveelectromagnet.i19
-rw-r--r--peripheral/libupm/src/groveelectromagnet/jsupm_groveelectromagnet.i8
-rw-r--r--peripheral/libupm/src/groveelectromagnet/pyupm_groveelectromagnet.i11
-rw-r--r--peripheral/libupm/src/groveemg/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/groveemg/groveemg.cxx67
-rw-r--r--peripheral/libupm/src/groveemg/groveemg.h82
-rw-r--r--peripheral/libupm/src/groveemg/javaupm_groveemg.i19
-rw-r--r--peripheral/libupm/src/groveemg/jsupm_groveemg.i8
-rw-r--r--peripheral/libupm/src/groveemg/pyupm_groveemg.i11
-rw-r--r--peripheral/libupm/src/grovegprs/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/grovegprs/grovegprs.cxx74
-rw-r--r--peripheral/libupm/src/grovegprs/grovegprs.h154
-rw-r--r--peripheral/libupm/src/grovegprs/javaupm_grovegprs.i22
-rw-r--r--peripheral/libupm/src/grovegprs/jsupm_grovegprs.i11
-rw-r--r--peripheral/libupm/src/grovegprs/pyupm_grovegprs.i14
-rw-r--r--peripheral/libupm/src/grovegsr/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/grovegsr/grovegsr.cxx68
-rw-r--r--peripheral/libupm/src/grovegsr/grovegsr.h84
-rw-r--r--peripheral/libupm/src/grovegsr/javaupm_grovegsr.i19
-rw-r--r--peripheral/libupm/src/grovegsr/jsupm_grovegsr.i8
-rw-r--r--peripheral/libupm/src/grovegsr/pyupm_grovegsr.i11
-rw-r--r--peripheral/libupm/src/grovelinefinder/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/grovelinefinder/grovelinefinder.cxx59
-rw-r--r--peripheral/libupm/src/grovelinefinder/grovelinefinder.h84
-rw-r--r--peripheral/libupm/src/grovelinefinder/javaupm_grovelinefinder.i19
-rw-r--r--peripheral/libupm/src/grovelinefinder/jsupm_grovelinefinder.i8
-rw-r--r--peripheral/libupm/src/grovelinefinder/pyupm_grovelinefinder.i11
-rw-r--r--peripheral/libupm/src/groveloudness/groveloudness.cxx51
-rw-r--r--peripheral/libupm/src/grovemd/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/grovemd/grovemd.cxx244
-rw-r--r--peripheral/libupm/src/grovemd/grovemd.h255
-rw-r--r--peripheral/libupm/src/grovemd/javaupm_grovemd.i19
-rw-r--r--peripheral/libupm/src/grovemd/jsupm_grovemd.i8
-rw-r--r--peripheral/libupm/src/grovemd/pyupm_grovemd.i15
-rw-r--r--peripheral/libupm/src/grovemoisture/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/grovemoisture/grovemoisture.cxx48
-rw-r--r--peripheral/libupm/src/grovemoisture/grovemoisture.h81
-rw-r--r--peripheral/libupm/src/grovemoisture/javaupm_grovemoisture.i19
-rw-r--r--peripheral/libupm/src/grovemoisture/jsupm_grovemoisture.i8
-rw-r--r--peripheral/libupm/src/grovemoisture/pyupm_grovemoisture.i11
-rw-r--r--peripheral/libupm/src/groveo2/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/groveo2/groveo2.cxx55
-rw-r--r--peripheral/libupm/src/groveo2/groveo2.h73
-rw-r--r--peripheral/libupm/src/groveo2/javaupm_groveo2.i19
-rw-r--r--peripheral/libupm/src/groveo2/jsupm_groveo2.i8
-rw-r--r--peripheral/libupm/src/groveo2/pyupm_groveo2.i11
-rw-r--r--peripheral/libupm/src/grovescam/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/grovescam/grovescam.cxx489
-rw-r--r--peripheral/libupm/src/grovescam/grovescam.h194
-rw-r--r--peripheral/libupm/src/grovescam/javaupm_grovescam.i20
-rw-r--r--peripheral/libupm/src/grovescam/jsupm_grovescam.i8
-rw-r--r--peripheral/libupm/src/grovescam/pyupm_grovescam.i11
-rw-r--r--peripheral/libupm/src/grovespeaker/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/grovespeaker/grovespeaker.cxx150
-rw-r--r--peripheral/libupm/src/grovespeaker/grovespeaker.h103
-rw-r--r--peripheral/libupm/src/grovespeaker/javaupm_grovespeaker.i19
-rw-r--r--peripheral/libupm/src/grovespeaker/jsupm_grovespeaker.i8
-rw-r--r--peripheral/libupm/src/grovespeaker/pyupm_grovespeaker.i11
-rw-r--r--peripheral/libupm/src/groveultrasonic/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/groveultrasonic/groveultrasonic.cxx104
-rw-r--r--peripheral/libupm/src/groveultrasonic/groveultrasonic.h121
-rw-r--r--peripheral/libupm/src/groveultrasonic/javaupm_groveultrasonic.i21
-rw-r--r--peripheral/libupm/src/groveultrasonic/jsupm_groveultrasonic.i8
-rw-r--r--peripheral/libupm/src/groveultrasonic/pyupm_groveultrasonic.i11
-rw-r--r--peripheral/libupm/src/grovevdiv/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/grovevdiv/grovevdiv.cxx67
-rw-r--r--peripheral/libupm/src/grovevdiv/grovevdiv.h98
-rw-r--r--peripheral/libupm/src/grovevdiv/javaupm_grovevdiv.i19
-rw-r--r--peripheral/libupm/src/grovevdiv/jsupm_grovevdiv.i8
-rw-r--r--peripheral/libupm/src/grovevdiv/pyupm_grovevdiv.i11
-rw-r--r--peripheral/libupm/src/grovewater/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/grovewater/grovewater.cxx54
-rw-r--r--peripheral/libupm/src/grovewater/grovewater.h74
-rw-r--r--peripheral/libupm/src/grovewater/javaupm_grovewater.i19
-rw-r--r--peripheral/libupm/src/grovewater/jsupm_grovewater.i8
-rw-r--r--peripheral/libupm/src/grovewater/pyupm_grovewater.i11
-rw-r--r--peripheral/libupm/src/grovewfs/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/grovewfs/grovewfs.cxx124
-rw-r--r--peripheral/libupm/src/grovewfs/grovewfs.h140
-rw-r--r--peripheral/libupm/src/grovewfs/javaupm_grovewfs.i21
-rw-r--r--peripheral/libupm/src/grovewfs/jsupm_grovewfs.i8
-rw-r--r--peripheral/libupm/src/grovewfs/pyupm_grovewfs.i11
-rw-r--r--peripheral/libupm/src/guvas12d/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/guvas12d/guvas12d.cxx65
-rw-r--r--peripheral/libupm/src/guvas12d/guvas12d.h77
-rw-r--r--peripheral/libupm/src/guvas12d/javaupm_guvas12d.i19
-rw-r--r--peripheral/libupm/src/guvas12d/jsupm_guvas12d.i8
-rw-r--r--peripheral/libupm/src/guvas12d/pyupm_guvas12d.i11
-rw-r--r--peripheral/libupm/src/h3lis331dl/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/h3lis331dl/h3lis331dl.cxx624
-rw-r--r--peripheral/libupm/src/h3lis331dl/h3lis331dl.h640
-rw-r--r--peripheral/libupm/src/h3lis331dl/javaupm_h3lis331dl.i62
-rw-r--r--peripheral/libupm/src/h3lis331dl/jsupm_h3lis331dl.i13
-rw-r--r--peripheral/libupm/src/h3lis331dl/pyupm_h3lis331dl.i20
-rw-r--r--peripheral/libupm/src/hcsr04/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/hcsr04/hcsr04.cxx120
-rw-r--r--peripheral/libupm/src/hcsr04/hcsr04.h108
-rw-r--r--peripheral/libupm/src/hcsr04/javaupm_hcsr04.i20
-rw-r--r--peripheral/libupm/src/hcsr04/jsupm_hcsr04.i8
-rw-r--r--peripheral/libupm/src/hcsr04/pyupm_hcsr04.i11
-rw-r--r--peripheral/libupm/src/hdxxvxta/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/hdxxvxta/hdxxvxta.cxx122
-rw-r--r--peripheral/libupm/src/hdxxvxta/hdxxvxta.h166
-rw-r--r--peripheral/libupm/src/hdxxvxta/javaupm_hdxxvxta.i21
-rw-r--r--peripheral/libupm/src/hdxxvxta/jsupm_hdxxvxta.i10
-rw-r--r--peripheral/libupm/src/hdxxvxta/pyupm_hdxxvxta.i13
-rw-r--r--peripheral/libupm/src/hm11/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/hm11/hm11.cxx169
-rw-r--r--peripheral/libupm/src/hm11/hm11.h144
-rw-r--r--peripheral/libupm/src/hm11/javaupm_hm11.i24
-rw-r--r--peripheral/libupm/src/hm11/jsupm_hm11.i12
-rw-r--r--peripheral/libupm/src/hm11/pyupm_hm11.i15
-rw-r--r--peripheral/libupm/src/hmc5883l/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/hmc5883l/hmc5883l.cxx171
-rw-r--r--peripheral/libupm/src/hmc5883l/hmc5883l.h111
-rw-r--r--peripheral/libupm/src/hmc5883l/javaupm_hmc5883l.i32
-rw-r--r--peripheral/libupm/src/hmc5883l/jsupm_hmc5883l.i14
-rw-r--r--peripheral/libupm/src/hmc5883l/pyupm_hmc5883l.i20
-rw-r--r--peripheral/libupm/src/hmtrp/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/hmtrp/hmtrp.cxx504
-rw-r--r--peripheral/libupm/src/hmtrp/hmtrp.h269
-rw-r--r--peripheral/libupm/src/hmtrp/javaupm_hmtrp.i37
-rw-r--r--peripheral/libupm/src/hmtrp/jsupm_hmtrp.i14
-rw-r--r--peripheral/libupm/src/hmtrp/pyupm_hmtrp.i20
-rw-r--r--peripheral/libupm/src/hp20x/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/hp20x/hp20x.cxx287
-rw-r--r--peripheral/libupm/src/hp20x/hp20x.h385
-rw-r--r--peripheral/libupm/src/hp20x/javaupm_hp20x.i19
-rw-r--r--peripheral/libupm/src/hp20x/jsupm_hp20x.i8
-rw-r--r--peripheral/libupm/src/hp20x/pyupm_hp20x.i15
-rw-r--r--peripheral/libupm/src/ht9170/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/ht9170/ht9170.cxx124
-rw-r--r--peripheral/libupm/src/ht9170/ht9170.h97
-rw-r--r--peripheral/libupm/src/ht9170/javaupm_ht9170.i19
-rw-r--r--peripheral/libupm/src/ht9170/jsupm_ht9170.i8
-rw-r--r--peripheral/libupm/src/ht9170/pyupm_ht9170.i11
-rw-r--r--peripheral/libupm/src/htu21d/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/htu21d/htu21d.cpp236
-rw-r--r--peripheral/libupm/src/htu21d/htu21d.h185
-rw-r--r--peripheral/libupm/src/htu21d/javaupm_htu21d.i19
-rw-r--r--peripheral/libupm/src/htu21d/jsupm_htu21d.i8
-rw-r--r--peripheral/libupm/src/htu21d/pyupm_htu21d.i15
-rw-r--r--peripheral/libupm/src/hwxpxx/CMakeLists.txt21
-rw-r--r--peripheral/libupm/src/hwxpxx/hwxpxx.cxx379
-rw-r--r--peripheral/libupm/src/hwxpxx/hwxpxx.h283
-rw-r--r--peripheral/libupm/src/hwxpxx/javaupm_hwxpxx.i20
-rw-r--r--peripheral/libupm/src/hwxpxx/jsupm_hwxpxx.i8
-rw-r--r--peripheral/libupm/src/hwxpxx/pyupm_hwxpxx.i12
-rw-r--r--peripheral/libupm/src/hx711/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/hx711/hx711.cxx144
-rw-r--r--peripheral/libupm/src/hx711/hx711.h138
-rw-r--r--peripheral/libupm/src/hx711/javaupm_hx711.i19
-rw-r--r--peripheral/libupm/src/hx711/jsupm_hx711.i8
-rw-r--r--peripheral/libupm/src/hx711/pyupm_hx711.i12
-rw-r--r--peripheral/libupm/src/ili9341/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/ili9341/gfx.cxx749
-rw-r--r--peripheral/libupm/src/ili9341/gfx.h406
-rw-r--r--peripheral/libupm/src/ili9341/ili9341.cxx487
-rw-r--r--peripheral/libupm/src/ili9341/ili9341.h344
-rw-r--r--peripheral/libupm/src/ili9341/javaupm_ili9341.i28
-rw-r--r--peripheral/libupm/src/ili9341/jsupm_ili9341.i12
-rw-r--r--peripheral/libupm/src/ili9341/pyupm_ili9341.i17
-rw-r--r--peripheral/libupm/src/ina132/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/ina132/ina132.cxx64
-rw-r--r--peripheral/libupm/src/ina132/ina132.h80
-rw-r--r--peripheral/libupm/src/ina132/javaupm_ina132.i19
-rw-r--r--peripheral/libupm/src/ina132/jsupm_ina132.i8
-rw-r--r--peripheral/libupm/src/ina132/pyupm_ina132.i11
-rw-r--r--peripheral/libupm/src/isd1820/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/isd1820/isd1820.cxx91
-rw-r--r--peripheral/libupm/src/isd1820/isd1820.h91
-rw-r--r--peripheral/libupm/src/isd1820/javaupm_isd1820.i20
-rw-r--r--peripheral/libupm/src/isd1820/jsupm_isd1820.i9
-rw-r--r--peripheral/libupm/src/isd1820/pyupm_isd1820.i13
-rw-r--r--peripheral/libupm/src/itg3200/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/itg3200/itg3200.cxx149
-rw-r--r--peripheral/libupm/src/itg3200/itg3200.h117
-rw-r--r--peripheral/libupm/src/itg3200/javaupm_itg3200.i46
-rw-r--r--peripheral/libupm/src/itg3200/jsupm_itg3200.i20
-rw-r--r--peripheral/libupm/src/itg3200/pyupm_itg3200.i25
-rw-r--r--peripheral/libupm/src/java_buffer.i45
-rw-r--r--peripheral/libupm/src/java_exceptions.i21
-rw-r--r--peripheral/libupm/src/javaswig_blacklist1
-rw-r--r--peripheral/libupm/src/joystick12/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/joystick12/javaupm_joystick12.i19
-rw-r--r--peripheral/libupm/src/joystick12/joystick12.cxx98
-rw-r--r--peripheral/libupm/src/joystick12/joystick12.h97
-rw-r--r--peripheral/libupm/src/joystick12/jsupm_joystick12.i8
-rw-r--r--peripheral/libupm/src/joystick12/pyupm_joystick12.i13
-rw-r--r--peripheral/libupm/src/kxcjk1013/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/kxcjk1013/javaupm_kxcjk1013.i20
-rw-r--r--peripheral/libupm/src/kxcjk1013/jsupm_kxcjk1013.i8
-rw-r--r--peripheral/libupm/src/kxcjk1013/kxcjk1013.cxx199
-rw-r--r--peripheral/libupm/src/kxcjk1013/kxcjk1013.h127
-rw-r--r--peripheral/libupm/src/kxcjk1013/pyupm_kxcjk1013.i9
-rw-r--r--peripheral/libupm/src/l298/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/l298/javaupm_l298.i19
-rw-r--r--peripheral/libupm/src/l298/jsupm_l298.i8
-rw-r--r--peripheral/libupm/src/l298/l298.cxx345
-rw-r--r--peripheral/libupm/src/l298/l298.h194
-rw-r--r--peripheral/libupm/src/l298/pyupm_l298.i11
-rwxr-xr-xperipheral/libupm/src/lcd/CMakeLists.txt6
-rw-r--r--peripheral/libupm/src/lcd/eboled.cxx567
-rw-r--r--peripheral/libupm/src/lcd/eboled.h378
-rw-r--r--peripheral/libupm/src/lcd/hd44780_bits.h86
-rw-r--r--peripheral/libupm/src/lcd/javaupm_i2clcd.i56
-rw-r--r--peripheral/libupm/src/lcd/jhd1313m1.cxx131
-rw-r--r--peripheral/libupm/src/lcd/jhd1313m1.h95
-rwxr-xr-xperipheral/libupm/src/lcd/jsupm_i2clcd.i44
-rw-r--r--peripheral/libupm/src/lcd/lcd.cxx52
-rw-r--r--peripheral/libupm/src/lcd/lcd.h54
-rw-r--r--peripheral/libupm/src/lcd/lcd_private.h34
-rw-r--r--peripheral/libupm/src/lcd/lcm1602.cxx462
-rw-r--r--peripheral/libupm/src/lcd/lcm1602.h263
-rw-r--r--peripheral/libupm/src/lcd/license.txt24
-rwxr-xr-xperipheral/libupm/src/lcd/pyupm_i2clcd.i48
-rw-r--r--peripheral/libupm/src/lcd/sainsmartks.cxx48
-rw-r--r--peripheral/libupm/src/lcd/sainsmartks.h92
-rw-r--r--peripheral/libupm/src/lcd/ssd.h135
-rw-r--r--peripheral/libupm/src/lcd/ssd1306.cxx313
-rw-r--r--peripheral/libupm/src/lcd/ssd1306.h230
-rw-r--r--peripheral/libupm/src/lcd/ssd1308.cxx170
-rw-r--r--peripheral/libupm/src/lcd/ssd1308.h116
-rw-r--r--peripheral/libupm/src/lcd/ssd1327.cxx319
-rw-r--r--peripheral/libupm/src/lcd/ssd1327.h127
-rw-r--r--peripheral/libupm/src/ldt0028/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/ldt0028/javaupm_ldt0028.i19
-rw-r--r--peripheral/libupm/src/ldt0028/jsupm_ldt0028.i8
-rw-r--r--peripheral/libupm/src/ldt0028/ldt0028.cxx54
-rw-r--r--peripheral/libupm/src/ldt0028/ldt0028.h87
-rw-r--r--peripheral/libupm/src/ldt0028/pyupm_ldt0028.i12
-rw-r--r--peripheral/libupm/src/lm35/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/lm35/javaupm_lm35.i19
-rw-r--r--peripheral/libupm/src/lm35/jsupm_lm35.i8
-rw-r--r--peripheral/libupm/src/lm35/lm35.cxx51
-rw-r--r--peripheral/libupm/src/lm35/lm35.h94
-rw-r--r--peripheral/libupm/src/lm35/pyupm_lm35.i11
-rw-r--r--peripheral/libupm/src/lol/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/lol/javaupm_lol.i36
-rw-r--r--peripheral/libupm/src/lol/jsupm_lol.i8
-rw-r--r--peripheral/libupm/src/lol/lol.cxx189
-rw-r--r--peripheral/libupm/src/lol/lol.h100
-rw-r--r--peripheral/libupm/src/lol/pyupm_lol.i13
-rw-r--r--peripheral/libupm/src/loudness/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/loudness/javaupm_loudness.i19
-rw-r--r--peripheral/libupm/src/loudness/jsupm_loudness.i8
-rw-r--r--peripheral/libupm/src/loudness/loudness.cxx48
-rw-r--r--peripheral/libupm/src/loudness/loudness.h96
-rw-r--r--peripheral/libupm/src/loudness/pyupm_loudness.i11
-rw-r--r--peripheral/libupm/src/lpd8806/.DS_Storebin6148 -> 0 bytes
-rw-r--r--peripheral/libupm/src/lpd8806/._.DS_Storebin4096 -> 0 bytes
-rw-r--r--peripheral/libupm/src/lpd8806/._CMakeLists.txtbin4096 -> 0 bytes
-rw-r--r--peripheral/libupm/src/lpd8806/._jsupm_lpd8806.ibin4096 -> 0 bytes
-rw-r--r--peripheral/libupm/src/lpd8806/._pyupm_lpd8806.ibin4096 -> 0 bytes
-rw-r--r--peripheral/libupm/src/lpd8806/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/lpd8806/javaupm_lpd8806.i19
-rw-r--r--peripheral/libupm/src/lpd8806/jsupm_lpd8806.i8
-rw-r--r--peripheral/libupm/src/lpd8806/lpd8806.cxx120
-rw-r--r--peripheral/libupm/src/lpd8806/lpd8806.h123
-rw-r--r--peripheral/libupm/src/lpd8806/pyupm_lpd8806.i11
-rw-r--r--peripheral/libupm/src/lsm303/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/lsm303/javaupm_lsm303.i32
-rw-r--r--peripheral/libupm/src/lsm303/jsupm_lsm303.i15
-rw-r--r--peripheral/libupm/src/lsm303/lsm303.cxx205
-rw-r--r--peripheral/libupm/src/lsm303/lsm303.h180
-rw-r--r--peripheral/libupm/src/lsm303/pyupm_lsm303.i18
-rw-r--r--peripheral/libupm/src/lsm303d/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/lsm303d/javaupm_lsm303d.i22
-rw-r--r--peripheral/libupm/src/lsm303d/jsupm_lsm303d.i15
-rw-r--r--peripheral/libupm/src/lsm303d/lsm303d.cxx213
-rw-r--r--peripheral/libupm/src/lsm303d/lsm303d.h226
-rw-r--r--peripheral/libupm/src/lsm303d/pyupm_lsm303d.i16
-rw-r--r--peripheral/libupm/src/lsm9ds0/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/lsm9ds0/javaupm_lsm9ds0.i56
-rw-r--r--peripheral/libupm/src/lsm9ds0/jsupm_lsm9ds0.i11
-rw-r--r--peripheral/libupm/src/lsm9ds0/lsm9ds0.cxx804
-rw-r--r--peripheral/libupm/src/lsm9ds0/lsm9ds0.h1486
-rw-r--r--peripheral/libupm/src/lsm9ds0/pyupm_lsm9ds0.i17
-rw-r--r--peripheral/libupm/src/m24lr64e/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/m24lr64e/javaupm_m24lr64e.i37
-rw-r--r--peripheral/libupm/src/m24lr64e/jsupm_m24lr64e.i10
-rw-r--r--peripheral/libupm/src/m24lr64e/m24lr64e.cxx306
-rw-r--r--peripheral/libupm/src/m24lr64e/m24lr64e.h285
-rw-r--r--peripheral/libupm/src/m24lr64e/pyupm_m24lr64e.i17
-rw-r--r--peripheral/libupm/src/max31723/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/max31723/javaupm_max31723.i19
-rw-r--r--peripheral/libupm/src/max31723/jsupm_max31723.i8
-rw-r--r--peripheral/libupm/src/max31723/max31723.cxx111
-rw-r--r--peripheral/libupm/src/max31723/max31723.h117
-rw-r--r--peripheral/libupm/src/max31723/pyupm_max31723.i11
-rw-r--r--peripheral/libupm/src/max31855/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/max31855/javaupm_max31855.i21
-rw-r--r--peripheral/libupm/src/max31855/jsupm_max31855.i10
-rw-r--r--peripheral/libupm/src/max31855/max31855.cxx110
-rw-r--r--peripheral/libupm/src/max31855/max31855.h87
-rw-r--r--peripheral/libupm/src/max31855/pyupm_max31855.i13
-rw-r--r--peripheral/libupm/src/max44000/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/max44000/javaupm_max44000.i19
-rw-r--r--peripheral/libupm/src/max44000/jsupm_max44000.i8
-rw-r--r--peripheral/libupm/src/max44000/max44000.cxx111
-rw-r--r--peripheral/libupm/src/max44000/max44000.h144
-rw-r--r--peripheral/libupm/src/max44000/pyupm_max44000.i13
-rw-r--r--peripheral/libupm/src/max5487/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/max5487/javaupm_max5487.i19
-rw-r--r--peripheral/libupm/src/max5487/jsupm_max5487.i8
-rw-r--r--peripheral/libupm/src/max5487/max5487.cxx93
-rw-r--r--peripheral/libupm/src/max5487/max5487.h113
-rw-r--r--peripheral/libupm/src/max5487/pyupm_max5487.i11
-rw-r--r--peripheral/libupm/src/maxds3231m/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/maxds3231m/javaupm_maxds3231m.i19
-rw-r--r--peripheral/libupm/src/maxds3231m/jsupm_maxds3231m.i8
-rw-r--r--peripheral/libupm/src/maxds3231m/maxds3231m.cxx127
-rw-r--r--peripheral/libupm/src/maxds3231m/maxds3231m.h133
-rw-r--r--peripheral/libupm/src/maxds3231m/pyupm_maxds3231m.i11
-rw-r--r--peripheral/libupm/src/maxsonarez/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/maxsonarez/javaupm_maxsonarez.i19
-rw-r--r--peripheral/libupm/src/maxsonarez/jsupm_maxsonarez.i8
-rw-r--r--peripheral/libupm/src/maxsonarez/maxsonarez.cxx61
-rw-r--r--peripheral/libupm/src/maxsonarez/maxsonarez.h103
-rw-r--r--peripheral/libupm/src/maxsonarez/pyupm_maxsonarez.i11
-rw-r--r--peripheral/libupm/src/mcp9808/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/mcp9808/javaupm_mcp9808.i19
-rw-r--r--peripheral/libupm/src/mcp9808/jsupm_mcp9808.i8
-rw-r--r--peripheral/libupm/src/mcp9808/mcp9808.cxx191
-rw-r--r--peripheral/libupm/src/mcp9808/mcp9808.h329
-rw-r--r--peripheral/libupm/src/mcp9808/pyupm_mcp9808.i11
-rw-r--r--peripheral/libupm/src/mg811/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/mg811/javaupm_mg811.i19
-rw-r--r--peripheral/libupm/src/mg811/jsupm_mg811.i8
-rw-r--r--peripheral/libupm/src/mg811/mg811.cxx94
-rw-r--r--peripheral/libupm/src/mg811/mg811.h147
-rw-r--r--peripheral/libupm/src/mg811/pyupm_mg811.i11
-rw-r--r--peripheral/libupm/src/mhz16/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/mhz16/javaupm_mhz16.i27
-rw-r--r--peripheral/libupm/src/mhz16/jsupm_mhz16.i13
-rw-r--r--peripheral/libupm/src/mhz16/mhz16.cxx243
-rw-r--r--peripheral/libupm/src/mhz16/mhz16.h177
-rw-r--r--peripheral/libupm/src/mhz16/pyupm_mhz16.i16
-rw-r--r--peripheral/libupm/src/mic/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/mic/javaupm_mic.i51
-rw-r--r--peripheral/libupm/src/mic/jsupm_mic.i9
-rw-r--r--peripheral/libupm/src/mic/mic.cxx102
-rw-r--r--peripheral/libupm/src/mic/mic.h108
-rw-r--r--peripheral/libupm/src/mic/pyupm_mic.i10
-rw-r--r--peripheral/libupm/src/micsv89/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/micsv89/javaupm_micsv89.i19
-rw-r--r--peripheral/libupm/src/micsv89/jsupm_micsv89.i8
-rw-r--r--peripheral/libupm/src/micsv89/micsv89.cxx79
-rw-r--r--peripheral/libupm/src/micsv89/micsv89.h127
-rw-r--r--peripheral/libupm/src/micsv89/pyupm_micsv89.i11
-rw-r--r--peripheral/libupm/src/mlx90614/.DS_Storebin6148 -> 0 bytes
-rw-r--r--peripheral/libupm/src/mlx90614/._.DS_Storebin4096 -> 0 bytes
-rw-r--r--peripheral/libupm/src/mlx90614/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/mlx90614/javaupm_mlx90614.i19
-rw-r--r--peripheral/libupm/src/mlx90614/jsupm_mlx90614.i8
-rw-r--r--peripheral/libupm/src/mlx90614/mlx90614.cxx110
-rw-r--r--peripheral/libupm/src/mlx90614/mlx90614.h124
-rw-r--r--peripheral/libupm/src/mlx90614/pyupm_mlx90614.i11
-rw-r--r--peripheral/libupm/src/mma7455/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/mma7455/javaupm_mma7455.i40
-rw-r--r--peripheral/libupm/src/mma7455/jsupm_mma7455.i8
-rw-r--r--peripheral/libupm/src/mma7455/mma7455.cxx186
-rw-r--r--peripheral/libupm/src/mma7455/mma7455.h243
-rw-r--r--peripheral/libupm/src/mma7455/pyupm_mma7455.i11
-rw-r--r--peripheral/libupm/src/mma7660/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/mma7660/javaupm_mma7660.i56
-rw-r--r--peripheral/libupm/src/mma7660/jsupm_mma7660.i13
-rw-r--r--peripheral/libupm/src/mma7660/mma7660.cxx275
-rw-r--r--peripheral/libupm/src/mma7660/mma7660.cxx.orig275
-rw-r--r--peripheral/libupm/src/mma7660/mma7660.h311
-rw-r--r--peripheral/libupm/src/mma7660/pyupm_mma7660.i20
-rw-r--r--peripheral/libupm/src/mpl3115a2/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/mpl3115a2/javaupm_mpl3115a2.i19
-rw-r--r--peripheral/libupm/src/mpl3115a2/jsupm_mpl3115a2.i8
-rw-r--r--peripheral/libupm/src/mpl3115a2/mpl3115a2.cpp327
-rw-r--r--peripheral/libupm/src/mpl3115a2/mpl3115a2.h256
-rw-r--r--peripheral/libupm/src/mpl3115a2/pyupm_mpl3115a2.i15
-rw-r--r--peripheral/libupm/src/mpr121/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/mpr121/javaupm_mpr121.i21
-rw-r--r--peripheral/libupm/src/mpr121/jsupm_mpr121.i8
-rw-r--r--peripheral/libupm/src/mpr121/mpr121.cxx208
-rw-r--r--peripheral/libupm/src/mpr121/mpr121.h123
-rw-r--r--peripheral/libupm/src/mpr121/pyupm_mpr121.i15
-rw-r--r--peripheral/libupm/src/mpu9150/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/mpu9150/ak8975.cxx239
-rw-r--r--peripheral/libupm/src/mpu9150/ak8975.h234
-rw-r--r--peripheral/libupm/src/mpu9150/javaupm_mpu9150.i45
-rw-r--r--peripheral/libupm/src/mpu9150/jsupm_mpu9150.i30
-rw-r--r--peripheral/libupm/src/mpu9150/mpu60x0.cxx424
-rw-r--r--peripheral/libupm/src/mpu9150/mpu60x0.h958
-rw-r--r--peripheral/libupm/src/mpu9150/mpu9150.cxx119
-rw-r--r--peripheral/libupm/src/mpu9150/mpu9150.h132
-rw-r--r--peripheral/libupm/src/mpu9150/mpu9250.cxx50
-rw-r--r--peripheral/libupm/src/mpu9150/mpu9250.h85
-rw-r--r--peripheral/libupm/src/mpu9150/pyupm_mpu9150.i32
-rw-r--r--peripheral/libupm/src/mq303a/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/mq303a/javaupm_mq303a.i19
-rw-r--r--peripheral/libupm/src/mq303a/jsupm_mq303a.i8
-rw-r--r--peripheral/libupm/src/mq303a/mq303a.cxx69
-rw-r--r--peripheral/libupm/src/mq303a/mq303a.h94
-rw-r--r--peripheral/libupm/src/mq303a/pyupm_mq303a.i11
-rw-r--r--peripheral/libupm/src/my9221/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/my9221/grovecircularled.cxx94
-rw-r--r--peripheral/libupm/src/my9221/grovecircularled.h96
-rw-r--r--peripheral/libupm/src/my9221/groveledbar.cxx88
-rw-r--r--peripheral/libupm/src/my9221/groveledbar.h99
-rw-r--r--peripheral/libupm/src/my9221/javaupm_my9221.i28
-rw-r--r--peripheral/libupm/src/my9221/jsupm_my9221.i18
-rw-r--r--peripheral/libupm/src/my9221/my9221.cxx191
-rw-r--r--peripheral/libupm/src/my9221/my9221.h152
-rw-r--r--peripheral/libupm/src/my9221/pyupm_my9221.i21
-rw-r--r--peripheral/libupm/src/nlgpio16/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/nlgpio16/javaupm_nlgpio16.i22
-rw-r--r--peripheral/libupm/src/nlgpio16/jsupm_nlgpio16.i11
-rw-r--r--peripheral/libupm/src/nlgpio16/nlgpio16.cxx344
-rw-r--r--peripheral/libupm/src/nlgpio16/nlgpio16.h239
-rw-r--r--peripheral/libupm/src/nlgpio16/pyupm_nlgpio16.i14
-rw-r--r--peripheral/libupm/src/nodeswig_blacklist0
-rw-r--r--peripheral/libupm/src/nrf24l01/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/nrf24l01/Callback.h22
-rw-r--r--peripheral/libupm/src/nrf24l01/javaupm_nrf24l01.i26
-rw-r--r--peripheral/libupm/src/nrf24l01/jsupm_nrf24l01.i8
-rw-r--r--peripheral/libupm/src/nrf24l01/nrf24l01.cxx535
-rw-r--r--peripheral/libupm/src/nrf24l01/nrf24l01.h431
-rw-r--r--peripheral/libupm/src/nrf24l01/pyupm_nrf24l01.i11
-rw-r--r--peripheral/libupm/src/nrf8001/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/nrf8001/aci.h672
-rw-r--r--peripheral/libupm/src/nrf8001/aci_cmds.h433
-rw-r--r--peripheral/libupm/src/nrf8001/aci_evts.h397
-rw-r--r--peripheral/libupm/src/nrf8001/aci_protocol_defines.h192
-rw-r--r--peripheral/libupm/src/nrf8001/aci_queue.cxx201
-rw-r--r--peripheral/libupm/src/nrf8001/aci_queue.h76
-rw-r--r--peripheral/libupm/src/nrf8001/aci_setup.cxx177
-rw-r--r--peripheral/libupm/src/nrf8001/aci_setup.h50
-rw-r--r--peripheral/libupm/src/nrf8001/acilib.cxx610
-rw-r--r--peripheral/libupm/src/nrf8001/acilib.h61
-rw-r--r--peripheral/libupm/src/nrf8001/acilib_defs.h37
-rw-r--r--peripheral/libupm/src/nrf8001/acilib_if.h471
-rw-r--r--peripheral/libupm/src/nrf8001/acilib_types.h33
-rw-r--r--peripheral/libupm/src/nrf8001/boards.h36
-rw-r--r--peripheral/libupm/src/nrf8001/dtm.h63
-rw-r--r--peripheral/libupm/src/nrf8001/hal_aci_tl.cxx459
-rw-r--r--peripheral/libupm/src/nrf8001/hal_aci_tl.h189
-rw-r--r--peripheral/libupm/src/nrf8001/hal_platform.h78
-rw-r--r--peripheral/libupm/src/nrf8001/javaupm_nrf8001.i19
-rw-r--r--peripheral/libupm/src/nrf8001/jsupm_nrf8001.i8
-rw-r--r--peripheral/libupm/src/nrf8001/lib_aci.cxx742
-rw-r--r--peripheral/libupm/src/nrf8001/lib_aci.h569
-rw-r--r--peripheral/libupm/src/nrf8001/nrf8001.cxx77
-rw-r--r--peripheral/libupm/src/nrf8001/nrf8001.h62
-rw-r--r--peripheral/libupm/src/nrf8001/pyupm_nrf8001.i11
-rw-r--r--peripheral/libupm/src/nrf8001/uart_over_ble.h79
-rw-r--r--peripheral/libupm/src/nunchuck/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/nunchuck/javaupm_nunchuck.i20
-rw-r--r--peripheral/libupm/src/nunchuck/jsupm_nunchuck.i8
-rw-r--r--peripheral/libupm/src/nunchuck/nunchuck.cxx149
-rw-r--r--peripheral/libupm/src/nunchuck/nunchuck.h161
-rw-r--r--peripheral/libupm/src/nunchuck/pyupm_nunchuck.i11
-rw-r--r--peripheral/libupm/src/otp538u/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/otp538u/javaupm_otp538u.i19
-rw-r--r--peripheral/libupm/src/otp538u/jsupm_otp538u.i8
-rw-r--r--peripheral/libupm/src/otp538u/otp538u.cxx196
-rw-r--r--peripheral/libupm/src/otp538u/otp538u.h154
-rw-r--r--peripheral/libupm/src/otp538u/pyupm_otp538u.i11
-rw-r--r--peripheral/libupm/src/otp538u/thermister_rt_table.h46
-rw-r--r--peripheral/libupm/src/otp538u/thermopile_vt_table.h104
-rw-r--r--peripheral/libupm/src/ozw/CMakeLists.txt21
-rw-r--r--peripheral/libupm/src/ozw/javaupm_ozw.i23
-rw-r--r--peripheral/libupm/src/ozw/jsupm_ozw.i12
-rw-r--r--peripheral/libupm/src/ozw/ozw.cxx909
-rw-r--r--peripheral/libupm/src/ozw/ozw.h574
-rw-r--r--peripheral/libupm/src/ozw/pyupm_ozw.i17
-rw-r--r--peripheral/libupm/src/ozw/zwNode.cxx168
-rw-r--r--peripheral/libupm/src/ozw/zwNode.h105
-rw-r--r--peripheral/libupm/src/package.json.in23
-rw-r--r--peripheral/libupm/src/pca9685/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/pca9685/javaupm_pca9685.i20
-rw-r--r--peripheral/libupm/src/pca9685/jsupm_pca9685.i9
-rw-r--r--peripheral/libupm/src/pca9685/pca9685.cxx294
-rw-r--r--peripheral/libupm/src/pca9685/pca9685.h320
-rw-r--r--peripheral/libupm/src/pca9685/pyupm_pca9685.i15
-rw-r--r--peripheral/libupm/src/pkgconfig.in14
-rw-r--r--peripheral/libupm/src/pn532/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/pn532/javaupm_pn532.i27
-rw-r--r--peripheral/libupm/src/pn532/jsupm_pn532.i9
-rw-r--r--peripheral/libupm/src/pn532/license.txt26
-rw-r--r--peripheral/libupm/src/pn532/pn532.cxx1595
-rw-r--r--peripheral/libupm/src/pn532/pn532.h505
-rw-r--r--peripheral/libupm/src/pn532/pyupm_pn532.i16
-rw-r--r--peripheral/libupm/src/ppd42ns/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/ppd42ns/javaupm_ppd42ns.i19
-rw-r--r--peripheral/libupm/src/ppd42ns/jsupm_ppd42ns.i8
-rw-r--r--peripheral/libupm/src/ppd42ns/ppd42ns.cxx137
-rw-r--r--peripheral/libupm/src/ppd42ns/ppd42ns.h93
-rw-r--r--peripheral/libupm/src/ppd42ns/pyupm_ppd42ns.i11
-rw-r--r--peripheral/libupm/src/pulsensor/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/pulsensor/Callback.h15
-rw-r--r--peripheral/libupm/src/pulsensor/javaupm_pulsensor.i29
-rw-r--r--peripheral/libupm/src/pulsensor/jsupm_pulsensor.i8
-rw-r--r--peripheral/libupm/src/pulsensor/pulsensor.cxx184
-rw-r--r--peripheral/libupm/src/pulsensor/pulsensor.h117
-rw-r--r--peripheral/libupm/src/pulsensor/pyupm_pulsensor.i13
-rw-r--r--peripheral/libupm/src/pythonswig_blacklist0
-rw-r--r--peripheral/libupm/src/rfr359f/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/rfr359f/javaupm_rfr359f.i19
-rw-r--r--peripheral/libupm/src/rfr359f/jsupm_rfr359f.i8
-rw-r--r--peripheral/libupm/src/rfr359f/pyupm_rfr359f.i11
-rw-r--r--peripheral/libupm/src/rfr359f/rfr359f.cxx54
-rw-r--r--peripheral/libupm/src/rfr359f/rfr359f.h82
-rw-r--r--peripheral/libupm/src/rgbringcoder/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/rgbringcoder/javaupm_rgbringcoder.i19
-rw-r--r--peripheral/libupm/src/rgbringcoder/jsupm_rgbringcoder.i9
-rw-r--r--peripheral/libupm/src/rgbringcoder/pyupm_rgbringcoder.i11
-rw-r--r--peripheral/libupm/src/rgbringcoder/rgbringcoder.cxx190
-rw-r--r--peripheral/libupm/src/rgbringcoder/rgbringcoder.h154
-rw-r--r--peripheral/libupm/src/rhusb/CMakeLists.txt6
-rw-r--r--peripheral/libupm/src/rhusb/javaupm_rhusb.i23
-rw-r--r--peripheral/libupm/src/rhusb/jsupm_rhusb.i8
-rw-r--r--peripheral/libupm/src/rhusb/pyupm_rhusb.i12
-rw-r--r--peripheral/libupm/src/rhusb/rhusb.cxx179
-rw-r--r--peripheral/libupm/src/rhusb/rhusb.h118
-rw-r--r--peripheral/libupm/src/rotaryencoder/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/rotaryencoder/javaupm_rotaryencoder.i21
-rw-r--r--peripheral/libupm/src/rotaryencoder/jsupm_rotaryencoder.i8
-rw-r--r--peripheral/libupm/src/rotaryencoder/pyupm_rotaryencoder.i11
-rw-r--r--peripheral/libupm/src/rotaryencoder/rotaryencoder.cxx95
-rw-r--r--peripheral/libupm/src/rotaryencoder/rotaryencoder.h105
-rw-r--r--peripheral/libupm/src/rpr220/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/rpr220/javaupm_rpr220.i19
-rw-r--r--peripheral/libupm/src/rpr220/jsupm_rpr220.i8
-rw-r--r--peripheral/libupm/src/rpr220/pyupm_rpr220.i11
-rw-r--r--peripheral/libupm/src/rpr220/rpr220.cxx84
-rw-r--r--peripheral/libupm/src/rpr220/rpr220.h115
-rw-r--r--peripheral/libupm/src/servo/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/servo/es08a.cxx41
-rw-r--r--peripheral/libupm/src/servo/es08a.h68
-rw-r--r--peripheral/libupm/src/servo/es9257.cxx41
-rw-r--r--peripheral/libupm/src/servo/es9257.h65
-rw-r--r--peripheral/libupm/src/servo/javaupm_servo.i28
-rw-r--r--peripheral/libupm/src/servo/jsupm_servo.i17
-rw-r--r--peripheral/libupm/src/servo/pyupm_servo.i19
-rw-r--r--peripheral/libupm/src/servo/servo.cxx164
-rw-r--r--peripheral/libupm/src/servo/servo.h168
-rw-r--r--peripheral/libupm/src/si114x/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/si114x/javaupm_si114x.i20
-rw-r--r--peripheral/libupm/src/si114x/jsupm_si114x.i9
-rw-r--r--peripheral/libupm/src/si114x/pyupm_si114x.i15
-rw-r--r--peripheral/libupm/src/si114x/si114x.cxx192
-rw-r--r--peripheral/libupm/src/si114x/si114x.h323
-rw-r--r--peripheral/libupm/src/sm130/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/sm130/javaupm_sm130.i19
-rw-r--r--peripheral/libupm/src/sm130/jsupm_sm130.i8
-rw-r--r--peripheral/libupm/src/sm130/pyupm_sm130.i11
-rw-r--r--peripheral/libupm/src/sm130/sm130.cxx878
-rw-r--r--peripheral/libupm/src/sm130/sm130.h467
-rw-r--r--peripheral/libupm/src/ssd1351/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/ssd1351/gfx.cxx218
-rw-r--r--peripheral/libupm/src/ssd1351/gfx.h453
-rw-r--r--peripheral/libupm/src/ssd1351/javaupm_ssd1351.i28
-rw-r--r--peripheral/libupm/src/ssd1351/jsupm_ssd1351.i12
-rw-r--r--peripheral/libupm/src/ssd1351/pyupm_ssd1351.i17
-rw-r--r--peripheral/libupm/src/ssd1351/ssd1351.cxx225
-rw-r--r--peripheral/libupm/src/ssd1351/ssd1351.h188
-rw-r--r--peripheral/libupm/src/st7735/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/st7735/gfx.cxx231
-rw-r--r--peripheral/libupm/src/st7735/gfx.h219
-rw-r--r--peripheral/libupm/src/st7735/javaupm_st7735.i57
-rw-r--r--peripheral/libupm/src/st7735/jsupm_st7735.i12
-rw-r--r--peripheral/libupm/src/st7735/license.txt24
-rw-r--r--peripheral/libupm/src/st7735/pyupm_st7735.i17
-rw-r--r--peripheral/libupm/src/st7735/st7735.cxx270
-rw-r--r--peripheral/libupm/src/st7735/st7735.h639
-rw-r--r--peripheral/libupm/src/stepmotor/CMakeLists.txt6
-rw-r--r--peripheral/libupm/src/stepmotor/javaupm_stepmotor.i19
-rw-r--r--peripheral/libupm/src/stepmotor/jsupm_stepmotor.i8
-rw-r--r--peripheral/libupm/src/stepmotor/pyupm_stepmotor.i13
-rw-r--r--peripheral/libupm/src/stepmotor/stepmotor.cxx185
-rw-r--r--peripheral/libupm/src/stepmotor/stepmotor.h172
-rw-r--r--peripheral/libupm/src/sx1276/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/sx1276/LICENSE.txt25
-rw-r--r--peripheral/libupm/src/sx1276/javaupm_sx1276.i26
-rw-r--r--peripheral/libupm/src/sx1276/jsupm_sx1276.i9
-rw-r--r--peripheral/libupm/src/sx1276/pyupm_sx1276.i17
-rw-r--r--peripheral/libupm/src/sx1276/sx1276.cxx2164
-rw-r--r--peripheral/libupm/src/sx1276/sx1276.h2036
-rw-r--r--peripheral/libupm/src/sx6119/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/sx6119/javaupm_sx6119.i20
-rw-r--r--peripheral/libupm/src/sx6119/jsupm_sx6119.i9
-rw-r--r--peripheral/libupm/src/sx6119/pyupm_sx6119.i13
-rw-r--r--peripheral/libupm/src/sx6119/sx6119.cxx80
-rw-r--r--peripheral/libupm/src/sx6119/sx6119.h89
-rw-r--r--peripheral/libupm/src/t3311/CMakeLists.txt24
-rw-r--r--peripheral/libupm/src/t3311/javaupm_t3311.i23
-rw-r--r--peripheral/libupm/src/t3311/jsupm_t3311.i11
-rw-r--r--peripheral/libupm/src/t3311/pyupm_t3311.i15
-rw-r--r--peripheral/libupm/src/t3311/t3311.cxx309
-rw-r--r--peripheral/libupm/src/t3311/t3311.h310
-rw-r--r--peripheral/libupm/src/ta12200/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/ta12200/javaupm_ta12200.i19
-rw-r--r--peripheral/libupm/src/ta12200/jsupm_ta12200.i8
-rw-r--r--peripheral/libupm/src/ta12200/pyupm_ta12200.i11
-rw-r--r--peripheral/libupm/src/ta12200/ta12200.cxx115
-rw-r--r--peripheral/libupm/src/ta12200/ta12200.h112
-rw-r--r--peripheral/libupm/src/tcs3414cs/.DS_Storebin6148 -> 0 bytes
-rw-r--r--peripheral/libupm/src/tcs3414cs/._.DS_Storebin4096 -> 0 bytes
-rw-r--r--peripheral/libupm/src/tcs3414cs/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/tcs3414cs/javaupm_tcs3414cs.i19
-rw-r--r--peripheral/libupm/src/tcs3414cs/jsupm_tcs3414cs.i8
-rw-r--r--peripheral/libupm/src/tcs3414cs/pyupm_tcs3414cs.i11
-rw-r--r--peripheral/libupm/src/tcs3414cs/tcs3414cs.cxx131
-rw-r--r--peripheral/libupm/src/tcs3414cs/tcs3414cs.h166
-rw-r--r--peripheral/libupm/src/th02/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/th02/javaupm_th02.i19
-rw-r--r--peripheral/libupm/src/th02/jsupm_th02.i8
-rw-r--r--peripheral/libupm/src/th02/pyupm_th02.i11
-rw-r--r--peripheral/libupm/src/th02/th02.cxx103
-rw-r--r--peripheral/libupm/src/th02/th02.h113
-rw-r--r--peripheral/libupm/src/tm1637/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/tm1637/javaupm_tm1637.i29
-rw-r--r--peripheral/libupm/src/tm1637/jsupm_tm1637.i15
-rw-r--r--peripheral/libupm/src/tm1637/pyupm_tm1637.i12
-rw-r--r--peripheral/libupm/src/tm1637/tm1637.cxx209
-rw-r--r--peripheral/libupm/src/tm1637/tm1637.h150
-rw-r--r--peripheral/libupm/src/tsl2561/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/tsl2561/javaupm_tsl2561.i19
-rw-r--r--peripheral/libupm/src/tsl2561/jsupm_tsl2561.i8
-rw-r--r--peripheral/libupm/src/tsl2561/pyupm_tsl2561.i15
-rw-r--r--peripheral/libupm/src/tsl2561/tsl2561.cxx248
-rw-r--r--peripheral/libupm/src/tsl2561/tsl2561.h171
-rw-r--r--peripheral/libupm/src/ttp223/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/ttp223/javaupm_ttp223.i23
-rw-r--r--peripheral/libupm/src/ttp223/jsupm_ttp223.i8
-rw-r--r--peripheral/libupm/src/ttp223/pyupm_ttp223.i12
-rw-r--r--peripheral/libupm/src/ttp223/ttp223.cxx83
-rw-r--r--peripheral/libupm/src/ttp223/ttp223.h118
-rw-r--r--peripheral/libupm/src/ublox6/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/ublox6/javaupm_ublox6.i22
-rw-r--r--peripheral/libupm/src/ublox6/jsupm_ublox6.i13
-rw-r--r--peripheral/libupm/src/ublox6/pyupm_ublox6.i17
-rw-r--r--peripheral/libupm/src/ublox6/ublox6.cxx167
-rw-r--r--peripheral/libupm/src/ublox6/ublox6.h130
-rw-r--r--peripheral/libupm/src/uln200xa/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/uln200xa/javaupm_uln200xa.i19
-rw-r--r--peripheral/libupm/src/uln200xa/jsupm_uln200xa.i8
-rw-r--r--peripheral/libupm/src/uln200xa/pyupm_uln200xa.i11
-rw-r--r--peripheral/libupm/src/uln200xa/uln200xa.cxx248
-rw-r--r--peripheral/libupm/src/uln200xa/uln200xa.h158
-rw-r--r--peripheral/libupm/src/upm.h391
-rw-r--r--peripheral/libupm/src/upm.i31
-rw-r--r--peripheral/libupm/src/upm_exception.i65
-rw-r--r--peripheral/libupm/src/urm37/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/urm37/javaupm_urm37.i21
-rw-r--r--peripheral/libupm/src/urm37/jsupm_urm37.i10
-rw-r--r--peripheral/libupm/src/urm37/pyupm_urm37.i13
-rw-r--r--peripheral/libupm/src/urm37/urm37.cxx318
-rw-r--r--peripheral/libupm/src/urm37/urm37.h205
-rw-r--r--peripheral/libupm/src/waterlevel/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/waterlevel/javaupm_waterlevel.i19
-rw-r--r--peripheral/libupm/src/waterlevel/jsupm_waterlevel.i8
-rw-r--r--peripheral/libupm/src/waterlevel/pyupm_waterlevel.i11
-rw-r--r--peripheral/libupm/src/waterlevel/waterlevel.cxx51
-rw-r--r--peripheral/libupm/src/waterlevel/waterlevel.h70
-rw-r--r--peripheral/libupm/src/wheelencoder/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/wheelencoder/javaupm_wheelencoder.i19
-rw-r--r--peripheral/libupm/src/wheelencoder/jsupm_wheelencoder.i8
-rw-r--r--peripheral/libupm/src/wheelencoder/pyupm_wheelencoder.i11
-rw-r--r--peripheral/libupm/src/wheelencoder/wheelencoder.cxx109
-rw-r--r--peripheral/libupm/src/wheelencoder/wheelencoder.h132
-rw-r--r--peripheral/libupm/src/wt5001/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/wt5001/javaupm_wt5001.i45
-rw-r--r--peripheral/libupm/src/wt5001/jsupm_wt5001.i12
-rw-r--r--peripheral/libupm/src/wt5001/pyupm_wt5001.i20
-rw-r--r--peripheral/libupm/src/wt5001/wt5001.cxx633
-rw-r--r--peripheral/libupm/src/wt5001/wt5001.h383
-rw-r--r--peripheral/libupm/src/xbee/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/xbee/javaupm_xbee.i22
-rw-r--r--peripheral/libupm/src/xbee/jsupm_xbee.i11
-rw-r--r--peripheral/libupm/src/xbee/pyupm_xbee.i14
-rw-r--r--peripheral/libupm/src/xbee/xbee.cxx102
-rw-r--r--peripheral/libupm/src/xbee/xbee.h193
-rw-r--r--peripheral/libupm/src/yg1006/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/yg1006/javaupm_yg1006.i19
-rw-r--r--peripheral/libupm/src/yg1006/jsupm_yg1006.i8
-rw-r--r--peripheral/libupm/src/yg1006/pyupm_yg1006.i11
-rw-r--r--peripheral/libupm/src/yg1006/yg1006.cxx54
-rw-r--r--peripheral/libupm/src/yg1006/yg1006.h78
-rw-r--r--peripheral/libupm/src/zfm20/CMakeLists.txt5
-rw-r--r--peripheral/libupm/src/zfm20/javaupm_zfm20.i28
-rw-r--r--peripheral/libupm/src/zfm20/jsupm_zfm20.i15
-rw-r--r--peripheral/libupm/src/zfm20/pyupm_zfm20.i18
-rw-r--r--peripheral/libupm/src/zfm20/zfm20.cxx604
-rw-r--r--peripheral/libupm/src/zfm20/zfm20.h379
-rw-r--r--peripheral/libupm/tests/CMakeLists.txt17
-rw-r--r--peripheral/libupm/tests/check_autoloadlibrary.py44
-rw-r--r--peripheral/libupm/tests/check_clean.py35
-rw-r--r--peripheral/libupm/tests/check_consistency.py60
-rw-r--r--peripheral/libupm/tests/check_samplenames.py53
-rw-r--r--peripheral/light/mraa/hal.mk24
-rw-r--r--peripheral/light/mraa/lights.c543
-rw-r--r--peripheral/light/mraa/peripheral.mk18
-rw-r--r--peripheral/sensors/mraa/AcquisitionThread.cpp223
-rw-r--r--peripheral/sensors/mraa/AcquisitionThread.hpp100
-rw-r--r--peripheral/sensors/mraa/Sensor.cpp128
-rw-r--r--peripheral/sensors/mraa/Sensor.hpp137
-rw-r--r--peripheral/sensors/mraa/SensorUtils.cpp22
-rw-r--r--peripheral/sensors/mraa/SensorUtils.hpp34
-rw-r--r--peripheral/sensors/mraa/SensorsHAL.cpp322
-rw-r--r--peripheral/sensors/mraa/SensorsHAL.hpp117
-rw-r--r--peripheral/sensors/mraa/Utils.cpp38
-rw-r--r--peripheral/sensors/mraa/Utils.hpp35
-rw-r--r--peripheral/sensors/mraa/doc/Doxyfile2354
-rw-r--r--peripheral/sensors/mraa/hal.mk64
-rw-r--r--peripheral/sensors/mraa/peripheral.mk18
-rw-r--r--peripheral/sensors/mraa/sensors/GroveLight.cpp63
-rw-r--r--peripheral/sensors/mraa/sensors/GroveLight.hpp70
-rw-r--r--peripheral/sensors/mraa/sensors/GroveTemperature.cpp63
-rw-r--r--peripheral/sensors/mraa/sensors/GroveTemperature.hpp70
-rw-r--r--peripheral/sensors/mraa/sensors/H3LIS331DLAccelerometer.cpp75
-rw-r--r--peripheral/sensors/mraa/sensors/H3LIS331DLAccelerometer.hpp71
-rw-r--r--peripheral/sensors/mraa/sensors/LSM303dAccelerometer.cpp78
-rw-r--r--peripheral/sensors/mraa/sensors/LSM303dAccelerometer.hpp76
-rw-r--r--peripheral/sensors/mraa/sensors/LSM303dOrientation.cpp70
-rw-r--r--peripheral/sensors/mraa/sensors/LSM303dOrientation.hpp72
-rw-r--r--peripheral/sensors/mraa/sensors/LSM9DS0Accelerometer.cpp76
-rw-r--r--peripheral/sensors/mraa/sensors/LSM9DS0Accelerometer.hpp72
-rw-r--r--peripheral/sensors/mraa/sensors/MMA7660Accelerometer.cpp83
-rw-r--r--peripheral/sensors/mraa/sensors/MMA7660Accelerometer.hpp78
-rw-r--r--peripheral/sensors/mraa/sensors/MPU9150Accelerometer.cpp80
-rw-r--r--peripheral/sensors/mraa/sensors/MPU9150Accelerometer.hpp74
-rw-r--r--peripheral/sensors/mraa/sensors/ProximityGPIO.cpp84
-rw-r--r--peripheral/sensors/mraa/sensors/ProximityGPIO.hpp70
1883 files changed, 0 insertions, 169583 deletions
diff --git a/peripheral/displays/Grove_LCD_RGB/Android.mk b/peripheral/displays/Grove_LCD_RGB/Android.mk
deleted file mode 100644
index 5432ac0..0000000
--- a/peripheral/displays/Grove_LCD_RGB/Android.mk
+++ /dev/null
@@ -1,31 +0,0 @@
-#
-# Copyright (C) 2015 The Android Open Source Project
-#
-# 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)
-
-# Example app to drive the Grove LCD RGB Backlight display
-# This will work for any display sufficiently similar to the JHD1313m1
-
-include $(CLEAR_VARS)
-LOCAL_CPPFLAGS:= -Wno-unused-parameter -fexceptions
-LOCAL_CFLAGS += -DLOG_TAG=\"groveLCD\" -Wno-unused-parameter
-LOCAL_SHARED_LIBRARIES := libcutils libupm libmraa
-
-LOCAL_MODULE := example-display-grove-lcd
-LOCAL_MODULE_TAGS := optional
-LOCAL_SRC_FILES := groveLCD.cpp
-include $(BUILD_EXECUTABLE)
-
diff --git a/peripheral/displays/Grove_LCD_RGB/groveLCD.cpp b/peripheral/displays/Grove_LCD_RGB/groveLCD.cpp
deleted file mode 100644
index 3eb1c25..0000000
--- a/peripheral/displays/Grove_LCD_RGB/groveLCD.cpp
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- *
- * 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.
- */
-
-/*
- * This is an example to display text on the Grove
- * LCD RGB Display panel.
- */
-
-#include <jhd1313m1.h>
-#include <mraa.hpp>
-
-#include <getopt.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <string>
-
-#define DEFAULT_COLOR_RED 255
-#define DEFAULT_COLOR_GREEN 255
-#define DEFAULT_COLOR_BLUE 255
-#define DEFAULT_DISPLAY_TEXT "hello world"
-
-// Structure to hold the decoded command line options
-struct pgm_options {
- uint8_t red, blue, green;
- std::string display_text;
-};
-
-// Be sure to keep the options for longopts and shortopts in the same order
-// so that Usage() is correct.
-static struct option longopts[] = {
- {"help", no_argument, NULL, '?'},
- {"text", required_argument, NULL, 't'},
- {"red", no_argument, NULL, 'r'},
- {"green", no_argument, NULL, 'g'},
- {"blue", no_argument, NULL, 'b'},
- {NULL, 0, NULL, 0 }
-};
-static char shortopts[] = "?t:rgb";
-
-// Describes the options for this program.
-void Usage(char *pgm_name) {
- printf("Usage: %s [options...]\n", pgm_name);
- printf("Prints a message on the Grove LCD RGB Display\n");
- printf("Options:\n");
- for (int i = 0, j = 0; longopts[i].name; i++, j++) {
- if (shortopts[j] == ':')
- j++;
- printf(" --%-6s or -%c\n", longopts[i].name, shortopts[j]);
- }
- return;
-}
-
-// Processes all command line options.
-// sets the options members for commnd line options
-// returns (0) on success, -1 otherwise.
-int ReadOpts(int argc, char **argv, struct pgm_options *options) {
- int ch = 0;
- bool color_specified = false;
-
- while ((ch = getopt_long(argc, argv, shortopts, longopts, NULL)) != -1) {
- switch (ch) {
- case 'r':
- options->red = 255;
- color_specified = true;
- break;
- case 'g':
- options->green = 255;
- color_specified = true;
- break;
- case 'b':
- options->blue = 255;
- color_specified = true;
- break;
- case 't':
- options->display_text = optarg;
- break;
- default:
- Usage(argv[0]);
- return -1;
- }
- }
- argc -= optind;
- argv += optind;
-
- if (!color_specified) {
- options->red = DEFAULT_COLOR_RED;
- options->green = DEFAULT_COLOR_GREEN;
- options->blue = DEFAULT_COLOR_BLUE;
- }
- if (options->display_text.length() == 0)
- options->display_text = DEFAULT_DISPLAY_TEXT;
-
- return 0;
-}
-
-int main(int argc, char* argv[]) {
- pgm_options options = {0, 0, 0, ""};
-
- if (ReadOpts(argc, argv, &options) < 0)
- return 1;
-
- upm::Jhd1313m1 display(mraa_get_default_i2c_bus(MRAA_MAIN_PLATFORM_OFFSET));
- display.write(options.display_text.c_str());
- display.setColor(options.red, options.green, options.blue);
- sleep(5);
-
- display.displayOff();
- return 0;
-}
diff --git a/peripheral/displays/SparkFun_OLED/Android.mk b/peripheral/displays/SparkFun_OLED/Android.mk
deleted file mode 100644
index 7f10d0f..0000000
--- a/peripheral/displays/SparkFun_OLED/Android.mk
+++ /dev/null
@@ -1,29 +0,0 @@
-#
-# Copyright (C) 2015 The Android Open Source Project
-#
-# 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)
-
-# Example app to drive the SparkFun OLED Display
-
-include $(CLEAR_VARS)
-LOCAL_CPPFLAGS:= -fexceptions
-LOCAL_CFLAGS += -DLOG_TAG=\"sparkFunOLED\"
-LOCAL_SHARED_LIBRARIES := libcutils libupm libmraa
-
-LOCAL_MODULE := example-display-sparkfun-oled
-LOCAL_MODULE_TAGS := optional
-LOCAL_SRC_FILES := SparkFunOLED.cpp
-include $(BUILD_EXECUTABLE)
diff --git a/peripheral/displays/SparkFun_OLED/SparkFunOLED.cpp b/peripheral/displays/SparkFun_OLED/SparkFunOLED.cpp
deleted file mode 100644
index b0cc2dc..0000000
--- a/peripheral/displays/SparkFun_OLED/SparkFunOLED.cpp
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- *
- * 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.
- */
-
-/*
- * This is an example to display text on the SparkFun OLED
- * Display panel.
- */
-
-#include <eboled.h>
-#include <mraa.hpp>
-
-#include <getopt.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <string>
-
-#define DEFAULT_DISPLAY_TEXT "hello world"
-
-// Structure to hold the decoded command line options
-struct pgm_options {
- uint8_t invert_color;
- std::string display_text;
-};
-
-// Be sure to keep the options for longopts and shortopts in the same order
-// so that Usage() is correct.
-static struct option longopts[] = {
- {"help", no_argument, NULL, '?'},
- {"text", required_argument, NULL, 't'},
- {"invert",no_argument, NULL, 'i'},
- {NULL, 0, NULL, 0 }
-};
-static char shortopts[] = "?t:i";
-
-// Describes the options for this program.
-void Usage(char *pgm_name) {
- printf("Usage: %s [options...]\n", pgm_name);
- printf("Prints a message on the SparkFun OLED Display\n");
- printf("Options:\n");
- for (int i = 0, j = 0; longopts[i].name; i++, j++) {
- if (shortopts[j] == ':')
- j++;
- printf(" --%-6s or -%c\n", longopts[i].name, shortopts[j]);
- }
- return;
-}
-
-// Processes all command line options.
-// sets the options members for commnd line options
-// returns (0) on success, -1 otherwise.
-int ReadOpts(int argc, char **argv, struct pgm_options *options) {
- int ch = 0;
-
- while ((ch = getopt_long(argc, argv, shortopts, longopts, NULL)) != -1) {
- switch (ch) {
- case 'i':
- options->invert_color = true;
- break;
- case 't':
- options->display_text = optarg;
- break;
- default:
- Usage(argv[0]);
- return -1;
- }
- }
- argc -= optind;
- argv += optind;
-
- if (options->display_text.length() == 0)
- options->display_text = DEFAULT_DISPLAY_TEXT;
-
- return 0;
-}
-
-int main(int argc, char* argv[]) {
- pgm_options options = {false, ""};
-
- if (ReadOpts(argc, argv, &options) < 0)
- return 1;
-
- upm::EBOLED *display = new upm::EBOLED(
- mraa_get_default_i2c_bus(MRAA_MAIN_PLATFORM_OFFSET),
- EBOLED_DEFAULT_CD, EBOLED_DEFAULT_RESET);
-
- if (options.invert_color) {
- display->setTextColor(upm::COLOR_BLACK);
- display->fillScreen(upm::COLOR_WHITE);
- }
-
- display->write(options.display_text);
- display->refresh();
- sleep(5);
- delete display;
-
- return 0;
-}
diff --git a/peripheral/examples/mraa/gpio_output/Android.mk b/peripheral/examples/mraa/gpio_output/Android.mk
deleted file mode 100644
index 3733403..0000000
--- a/peripheral/examples/mraa/gpio_output/Android.mk
+++ /dev/null
@@ -1,42 +0,0 @@
-#
-# Copyright (C) 2015 The Android Open Source Project
-#
-# 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)
-
-# Example app to drive a GPIO pin via mraa
-include $(CLEAR_VARS)
-LOCAL_CPPFLAGS:= -Wno-unused-parameter -fexceptions
-LOCAL_CFLAGS += -DLOG_TAG=\"OutputGPIO\" -Wno-unused-parameter
-LOCAL_SHARED_LIBRARIES := libcutils libupm libmraa
-
-LOCAL_MODULE := example-gpio-output-mraa
-LOCAL_MODULE_TAGS := optional
-LOCAL_SRC_FILES := OutputGPIO.cpp
-include $(BUILD_EXECUTABLE)
-
-
-# MRAA based ledflasher example application
-include $(CLEAR_VARS)
-LOCAL_CPPFLAGS:= -Wno-unused-parameter -fexceptions
-LOCAL_CFLAGS += -DLOG_TAG=\"ledflasher-mraa\" -Wno-unused-parameter
-LOCAL_SHARED_LIBRARIES := libcutils libupm libmraa
-
-LOCAL_MODULE := ledflasher-mraa
-LOCAL_MODULE_TAGS := optional
-LOCAL_SRC_FILES := ledflasher_mraa.cpp
-include $(BUILD_EXECUTABLE)
-
-
diff --git a/peripheral/examples/mraa/gpio_output/OutputGPIO.cpp b/peripheral/examples/mraa/gpio_output/OutputGPIO.cpp
deleted file mode 100644
index 1012a2c..0000000
--- a/peripheral/examples/mraa/gpio_output/OutputGPIO.cpp
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- *
- * 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.
- */
-
-/*
- * This is an example to set/clear a GPIO pin using the MRAA library.
- * This may be tested with any of many GPIO devices such as an LED
- * directly connected to the GPIO pin and ground,
- * the Grove buzzer or Grove LED board.
- *
- * The on-board LED on the Edison Arudino expansion board may be
- * accessed with Digital I/O 13 (mapped from Linux GPIO 243):
- * example-gpio-output -p 13 -s
- *
- * See the following link for a table to map from the numbers on the
- * board silk screen to the libmraa GPIO numbers:
- * https://learn.sparkfun.com/tutorials/installing-libmraa-on-ubilinux-for-edison
- */
-#include <getopt.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <mraa.h>
-
-// Structure to hold the decoded command line options
-struct pgm_options {
- int pin;
- bool set;
- bool clear;
-};
-
-// Be sure to keep the options for longopts and shortopts in the same order
-// so that Usage() is correct.
-static struct option longopts[] = {
- {"help", no_argument, NULL, '?'},
- {"pin", required_argument, NULL, 'p'},
- {"set", no_argument, NULL, 's'},
- {"clear", no_argument, NULL, 'c'},
- {NULL, 0, NULL, 0 }
-};
-static char shortopts[] = "?p:sc";
-
-// Describes the options for this program.
-void Usage(char *pgm_name) {
- printf("Usage: %s [options...]\n", pgm_name);
- printf("Manipulate a GPIO pin\n");
- printf("Options:\n");
- for (int i = 0, j = 0; longopts[i].name; i++, j++) {
- if (shortopts[j] == ':')
- j++;
- printf(" --%-6s%s or -%c%s""\n",
- longopts[i].name,
- (shortopts[j+1] == ':') ? " <arg> " : "",
- shortopts[j],
- (shortopts[j+1] == ':') ? " <arg> " : "");
- }
- return;
-}
-
-// Processes all command line options.
-// sets the options members for commnd line options
-// returns (0) on success, -1 otherwise.
-int ReadOpts(int argc, char **argv, struct pgm_options *options) {
- int ch = 0;
-
- while ((ch = getopt_long(argc, argv, shortopts, longopts, NULL)) != -1) {
- switch (ch) {
- case 'p':
- options->pin = atoi(optarg);
- break;
- case 's':
- options->set = true;
- break;
- case 'c':
- options->clear = true;
- break;
- default:
- Usage(argv[0]);
- return -1;
- }
- }
- argc -= optind;
- argv += optind;
-
- return 0;
-}
-
-int main(int argc, char* argv[]) {
- const unsigned kDefaultPinGPIO = 7;
- pgm_options options = {kDefaultPinGPIO, false, false};
-
- if (ReadOpts(argc, argv, &options) < 0)
- return 1;
-
- mraa_init();
- mraa_gpio_context m_gpio = mraa_gpio_init(options.pin);
- if (!m_gpio) {
- fprintf(stderr, "Unable to initialize GPIO, invalid pin number?\n");
- return 1;
- }
- mraa_gpio_dir(m_gpio, MRAA_GPIO_OUT);
-
- if (options.set)
- mraa_gpio_write(m_gpio, 1);
-
- // If both options were specified, wait a few seconds before clearing
- if (options.clear && options.set)
- sleep(5);
-
- if (options.clear)
- mraa_gpio_write(m_gpio, 0);
-
- mraa_gpio_close(m_gpio);
- return 0;
-}
diff --git a/peripheral/examples/mraa/gpio_output/ledflasher_mraa.cpp b/peripheral/examples/mraa/gpio_output/ledflasher_mraa.cpp
deleted file mode 100644
index 39005f6..0000000
--- a/peripheral/examples/mraa/gpio_output/ledflasher_mraa.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- *
- * 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.
- */
-
-/*
- * This is an example to flash a number of LED lights in a pattern.
- * Connect your LEDs to appropriate GPIOs (as many as you like)
- * then modify gpio[] and m_gpio[] to specify the pins.
- */
-#include <unistd.h>
-#include <stdio.h>
-
-#include <mraa.h>
-
-int main(int argc, char* argv[]) {
- const unsigned gpio[] = {0, 1, 2};
- const int gpio_count = sizeof(gpio)/sizeof(*gpio);
- mraa_gpio_context m_gpio[] = {NULL, NULL, NULL};
-
- mraa_init();
- for (int i = 0; i < gpio_count; i++) {
- m_gpio[i] = mraa_gpio_init(gpio[i]);
- if (!m_gpio[i]) {
- fprintf(stderr, "Unable to initialize GPIO %d, invalid pin number?\n",
- gpio[i]);
- return 1;
- }
- mraa_gpio_dir(m_gpio[i], MRAA_GPIO_OUT);
- }
-
- for (int iterations = 0; iterations < 3; iterations++) {
- for (int i = 0; i < gpio_count; i++) {
- mraa_gpio_write(m_gpio[i], 1);
- sleep(1);
- }
- for (int i = gpio_count-1; i >= 0; i--) {
- mraa_gpio_write(m_gpio[i], 0);
- sleep(1);
- }
- }
-
- for (int i = 0; i < gpio_count; i++)
- mraa_gpio_close(m_gpio[i]);
- return 0;
-}
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()
diff --git a/peripheral/libupm/.clang-format b/peripheral/libupm/.clang-format
deleted file mode 100644
index 200b12a..0000000
--- a/peripheral/libupm/.clang-format
+++ /dev/null
@@ -1,122 +0,0 @@
-Language: Cpp
-
-# Access modifiers in the middle
-AccessModifierOffset: -2
-
-# Align escaped newlines as far left as possible
-AlignEscapedNewlinesLeft: true
-
-# Align all trailing comments
-AlignTrailingComments: true
-
-# Don't allow parameters to be placed on the next line, even though BinPackParameters is false
-AllowAllParametersOfDeclarationOnNextLine: false
-
-# Do not allow short functions/if statements/loops on a single line
-AllowShortFunctionsOnASingleLine: false
-AllowShortIfStatementsOnASingleLine: false
-AllowShortLoopsOnASingleLine: false
-
-# Don't force breaks before multiline strings
-AlwaysBreakBeforeMultilineStrings: false
-
-# Don't force breaks before template declarations
-AlwaysBreakTemplateDeclarations: false
-
-# Force breaks after definition return type
-AlwaysBreakAfterDefinitionReturnType: true
-
-# Arguments and parameters are either on one line or on one line each
-BinPackArguments: false
-BinPackParameters: false
-
-# Do not break before binary operators
-BreakBeforeBinaryOperators: None
-
-# Use the linux brace breaking style: Attach braces to context except for braces on functions,
-# namespaces and class definitions
-BreakBeforeBraces: Linux
-
-# Do not place ternary operators after line breaks
-BreakBeforeTernaryOperators: false
-
-# In the constructor initializers do not align the comma with the colon
-BreakConstructorInitializersBeforeComma: false
-
-# Force columns to be less than 100 characters
-ColumnLimit: 100
-
-# Constructor initializer all in one line or all on their own line
-ConstructorInitializerAllOnOneLineOrOnePerLine: true
-
-# Indent constructor initializers
-ConstructorInitializerIndentWidth: 8
-
-# Do not indent continuations
-ContinuationIndentWidth: 0
-
-# Do not use braced lists in c++11 style
-Cpp11BracedListStyle: false
-
-# Do not derive pointer alignment
-DerivePointerAlignment: false
-
-# Case labes are indented
-IndentCaseLabels: true
-
-# Do not indent function declarations
-IndentFunctionDeclarationAfterType: false
-
-# Indentation is 4 characters
-IndentWidth: 4
-
-# Do not keep empty lines at start of blocks
-KeepEmptyLinesAtTheStartOfBlocks: false
-
-# Keep at most 2 consecutive empty lines
-MaxEmptyLinesToKeep: 2
-
-# Do not indent namespaces
-NamespaceIndentation: None
-
-# Spaces for ObjC properties and protocol lists
-ObjCSpaceAfterProperty: true
-ObjCSpaceBeforeProtocolList: true
-
-# Penalties
-PenaltyBreakBeforeFirstCallParameter: 100
-PenaltyBreakComment: 10
-PenaltyBreakFirstLessLess: 0
-PenaltyBreakString: 100
-PenaltyExcessCharacter: 20
-PenaltyReturnTypeOnItsOwnLine: 20
-
-# Force pointers to typename (i.e. char* a instead of char *a)
-PointerAlignment: Left
-
-# Spaces after C-style casts and before assignments
-SpaceAfterCStyleCast: true
-SpaceBeforeAssignmentOperators: true
-
-# Only space before parentheses if they are control statements
-SpaceBeforeParens: ControlStatements
-
-# Single space before trailing comments
-SpacesBeforeTrailingComments: 1
-
-# No spaces in parentheses, angles, or square brackets
-SpaceInEmptyParentheses: false
-SpacesInAngles: false
-SpacesInCStyleCastParentheses: false
-SpacesInParentheses: false
-SpacesInSquareBrackets: false
-
-# Use c++11 as the language standard
-Standard: Cpp11
-
-# Tabs are 4 characters wide
-TabWidth: 4
-
-# Don't use tabs for indentation :-(
-UseTab: Never
-
diff --git a/peripheral/libupm/.gitignore b/peripheral/libupm/.gitignore
deleted file mode 100644
index 05fbd26..0000000
--- a/peripheral/libupm/.gitignore
+++ /dev/null
@@ -1,13 +0,0 @@
-build/
-
-# Object files
-*.o
-*.lib
-*.so
-*.lo
-*.la
-*.pyc
-
-# Temp files
-*.swp
-*~
diff --git a/peripheral/libupm/.travis.yml b/peripheral/libupm/.travis.yml
deleted file mode 100644
index 6075524..0000000
--- a/peripheral/libupm/.travis.yml
+++ /dev/null
@@ -1,21 +0,0 @@
-language: cpp
-compiler:
- - gcc
- - clang
-install:
- - sudo add-apt-repository --yes ppa:kalakris/cmake
- - sudo add-apt-repository --yes ppa:fenics-packages/fenics-exp/swig
- - sudo apt-get update -qq
- - sudo apt-get install -y -qq swig3.0 python git cmake
- - sudo ln -s /usr/bin/swig3.0 /usr/bin/swig
- - sudo update-java-alternatives -s java-8-oracle
-before_script:
- - if [ "$CC" = "gcc" ]; then export BUILDJAVA=ON; else export BUILDJAVA=OFF; fi
- - export JAVA_HOME=/usr/lib/jvm/java-8-oracle
-script:
- - git clone --branch=master https://github.com/intel-iot-devkit/mraa.git
- - cd mraa && mkdir build && cd build && cmake -DBUILDSWIGJAVA=$BUILDJAVA -DENABLEEXAMPLES=OFF -DCMAKE_INSTALL_PREFIX:PATH=. -DNODE_ROOT_DIR:PATH=/home/travis/.nvm/v0.10.36/include .. && make && make install
- - export PKG_CONFIG_PATH=$PWD/lib/pkgconfig:$PWD/lib/x86_64-linux-gnu/pkgconfig
- - export CPLUS_INCLUDE_PATH=$PWD/include
- - export LIBRARY_PATH=$PWD/lib:$PWD/lib/x86_64-linux-gnu
- - cd ../.. && mkdir build && cd build && cmake -DBUILDSWIGJAVA=$BUILDJAVA -DNODE_ROOT_DIR:PATH=/home/travis/.nvm/v0.10.36/include -DBUILDEXAMPLES=ON -DBUILDJAVAEXAMPLES=$BUILDJAVA .. && make
diff --git a/peripheral/libupm/Android.mk b/peripheral/libupm/Android.mk
deleted file mode 100644
index 2e73037..0000000
--- a/peripheral/libupm/Android.mk
+++ /dev/null
@@ -1,52 +0,0 @@
-# Copyright (C) 2015 The Android Open Source Project
-#
-# 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)
-
-# Still keep Wswitch and other warnings...
-LOCAL_CPPFLAGS:= -std=c++11 -Wno-unused-parameter -Wno-error=non-virtual-dtor -fexceptions -I$(LOCAL_PATH)/src/nrf8001/
-LOCAL_CPP_EXTENSION := .cxx
-LOCAL_SHARED_LIBRARIES := libcutils libmraa
-
-# NOTE: Build system cannot handle c++ files in different extension in a single
-# module. We compile all cxx file (the majority) this time and don't compile
-# cpp files to avoid renaming files until there is a need of these cpp files
-# shows up.
-
-LIBUPM_CXX_FILE_LIST := $(call all-named-files-under,*.cxx,src)
-
-# groveloudness module requires a header file missed in imported tip of libupm
-# filter it out...
-LIBUPM_CXX_FILE_LIST := $(filter-out %groveloudness.cxx, $(LIBUPM_CXX_FILE_LIST))
-LIBUPM_CXX_FILE_LIST := $(filter-out %hwxpxx.cxx, $(LIBUPM_CXX_FILE_LIST))
-LIBUPM_CXX_FILE_LIST := $(filter-out %zwNode.cxx, $(LIBUPM_CXX_FILE_LIST))
-LIBUPM_CXX_FILE_LIST := $(filter-out %ozw.cxx, $(LIBUPM_CXX_FILE_LIST))
-LIBUPM_CXX_FILE_LIST := $(filter-out %t3311.cxx, $(LIBUPM_CXX_FILE_LIST))
-LIBUPM_CXX_FILE_LIST := $(filter-out %sx1276.cxx, $(LIBUPM_CXX_FILE_LIST))
-LIBUPM_CXX_FILE_LIST := $(filter-out %ssd1351.cxx, $(LIBUPM_CXX_FILE_LIST))
-LIBUPM_CXX_FILE_LIST := $(filter-out %st7735.cxx, $(LIBUPM_CXX_FILE_LIST))
-LIBUPM_CXX_FILE_LIST := $(filter-out %ili9341.cxx, $(LIBUPM_CXX_FILE_LIST))
-LIBUPM_CXX_FILE_LIST := $(filter-out %gfx.cxx, $(LIBUPM_CXX_FILE_LIST))
-LOCAL_SRC_FILES := $(LIBUPM_CXX_FILE_LIST)
-
-LOCAL_C_INCLUDES := $(sort $(dir $(wildcard $(LOCAL_PATH)/src/*/)))
-
-LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_C_INCLUDES)
-
-LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE := libupm
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/peripheral/libupm/CMakeLists.txt b/peripheral/libupm/CMakeLists.txt
deleted file mode 100644
index 0a6f4fc..0000000
--- a/peripheral/libupm/CMakeLists.txt
+++ /dev/null
@@ -1,219 +0,0 @@
-cmake_minimum_required (VERSION 2.8.11)
-project (upm)
-
-if ("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
-message("WARNING: building into sources dir can be risky, prefer other directory")
-endif ()
-
-find_package (Threads REQUIRED)
-find_package (PkgConfig REQUIRED)
-
-# Force a libmraa search and minimum required version every time a config is generated
-unset(MRAA_FOUND CACHE)
-pkg_check_modules (MRAA REQUIRED mraa>=0.9.1)
-message (INFO " found mraa version: ${MRAA_VERSION}")
-
-# Appends the cmake/modules path to MAKE_MODULE_PATH variable.
-set (CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH})
-set (LIB_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}" CACHE PATH "Installation path for libraries")
-
-# Set CMAKE_LIB_INSTALL_DIR if not defined
-include(GNUInstallDirs)
-
-# Make a version file containing the current version from git.
-include (GetGitRevisionDescription)
-git_describe (VERSION "--tags")
-if ("x_${VERSION}" STREQUAL "x_GIT-NOTFOUND" OR "x_${VERSION}" STREQUAL "x_-128-NOTFOUND")
- message (WARNING " - Install git to compile a production UPM!")
- set (VERSION "v0.5.1-dirty")
-endif ()
-
-message (INFO " - UPM Version ${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}")
-
-if ("${VERSION_COMMIT}" MATCHES "^v.*")
- set (VERSION_COMMIT "")
-endif()
-
-set (upm_VERSION_MAJOR ${VERSION_MAJOR})
-set (upm_VERSION_MINOR ${VERSION_MINOR})
-set (upm_VERSION_PATCH ${VERSION_PATCH})
-set (upm_VERSION_STRING ${upm_VERSION_MAJOR}.${upm_VERSION_MINOR}.${upm_VERSION_PATCH})
-
-set (CMAKE_SWIG_FLAGS "")
-
-option (BUILDDOC "Build all doc." OFF)
-option (BUILDSWIG "Build swig modules." ON)
-option (BUILDSWIGPYTHON "Build swig python modules." ON)
-option (BUILDSWIGNODE "Build swig node modules." ON)
-option (BUILDEXAMPLES "Build C++ example binaries" OFF)
-option (BUILDJAVAEXAMPLES "Build java example jars" OFF)
-option (BUILDSWIGJAVA "Build swig java modules" OFF)
-option (IPK "Generate IPK using CPack" OFF)
-option (RPM "Generate RPM using CPack" OFF)
-option (BUILDTESTS "Generate check-ups for upm" OFF)
-
-# Find swig
-if (BUILDSWIG)
- if (BUILDSWIGNODE)
- find_package (SWIG 3.0.5 REQUIRED)
- else ()
- find_package (SWIG REQUIRED)
- endif ()
- if (SWIG_FOUND)
- include (${SWIG_USE_FILE})
- endif ()
-endif ()
-
-# Detect arch
-include (TargetArch)
-target_architecture (DETECTED_ARCH)
-message( INFO " - Target arch is ${DETECTED_ARCH}")
-
-if (BUILDDOC)
- # Add a target to generate API documentation with Doxygen
- find_package (Doxygen)
- if (DOXYGEN_FOUND)
- configure_file (${CMAKE_CURRENT_SOURCE_DIR}/doxy/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
- if (BUILDSWIGJAVA)
- configure_file (${CMAKE_CURRENT_SOURCE_DIR}/doxy/Doxyfile.java.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile-java @ONLY)
- endif()
- file(GLOB PNG_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/docs docs/icons/*.png)
- foreach(PNG_FILE ${PNG_FILES})
- configure_file(${CMAKE_CURRENT_SOURCE_DIR}/docs/${PNG_FILE} ${CMAKE_CURRENT_BINARY_DIR}/html/docs/${PNG_FILE} COPYONLY)
- endforeach()
- add_custom_target (doc
- ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
- COMMAND tar -czf html/xml.tar.gz -C xml .
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
- COMMENT "Generating API documentation with Doxygen" VERBATIM
- )
- endif (DOXYGEN_FOUND)
- # Check if Sphinx is installed and add target to generate API documentation
- find_package (Sphinx)
- if(SPHINX_FOUND AND BUILDSWIG AND BUILDSWIGPYTHON)
- # Python required for Sphinx build
- find_package (PythonLibs)
- string (REPLACE "." ";" PYTHON_VERSION_LIST ${PYTHONLIBS_VERSION_STRING})
- list (GET PYTHON_VERSION_LIST 0 PYTHON_VERSION_MAJOR)
- list (GET PYTHON_VERSION_LIST 1 PYTHON_VERSION_MINOR)
- set (SITE_PACKAGES ${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages)
- configure_file (${CMAKE_CURRENT_SOURCE_DIR}/doxy/conf.py.in ${CMAKE_CURRENT_BINARY_DIR}/pydoc/conf.py @ONLY)
- configure_file (${CMAKE_CURRENT_SOURCE_DIR}/doxy/index.rst ${CMAKE_CURRENT_BINARY_DIR}/pydoc/index.rst COPYONLY)
- add_custom_target (pydoc ALL
- COMMAND rm -r -f ${CMAKE_BINARY_DIR}/pyupm && mkdir -p ${CMAKE_BINARY_DIR}/pyupm
- COMMAND find ${CMAKE_BINARY_DIR}/src -name "_pyupm_*.so" -exec cp {} ${CMAKE_BINARY_DIR}/pyupm \;
- COMMAND find ${CMAKE_BINARY_DIR}/src -name "pyupm_*.py" -exec cp {} ${CMAKE_BINARY_DIR}/pyupm \;
- COMMAND ${SPHINX_API_EXECUTABLE} -f -o pydoc ${CMAKE_BINARY_DIR}/pyupm
- # TODO: use a separate cmake FILE module for string replacement instead
- COMMAND ${SPHINX_EXECUTABLE} -b html pydoc html/python
- COMMAND sed -i.bak s|\">pyupm_|\">|g html/python/index.html html/python/modules.html
- COMMAND sed -i.bak s|[[:space:]][mM]odule</a>|</a>|g html/python/index.html html/python/modules.html
- DEPENDS doc
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
- COMMENT "Generating API documentation with Sphinx" VERBATIM
- )
- endif ()
- # Check if Yuidoc is installed and add target for API documentation
- find_package(Yuidoc)
- if(YUIDOC_FOUND AND BUILDSWIGNODE)
- # Node required for Yuidoc documentation
- find_package(Node)
- file(GLOB_RECURSE JSDOC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/doxy/node doxy/node/*)
- foreach(JSDOC_FILE ${JSDOC_FILES})
- configure_file(${CMAKE_CURRENT_SOURCE_DIR}/doxy/node/${JSDOC_FILE} ${CMAKE_CURRENT_BINARY_DIR}/${JSDOC_FILE} COPYONLY)
- endforeach()
- add_custom_target(jsdoc ALL
- COMMAND ${NODE_EXECUTABLE} docgen -m upm -i xml -t ${CMAKE_CURRENT_SOURCE_DIR}/src -g ../../
- COMMAND ${YUIDOC_EXECUTABLE} -C --no-sort --helpers generators/yuidoc/helper.js --themedir generators/yuidoc/tmpl -o html/node jsdoc/yuidoc/upm
- COMMAND ${NODE_EXECUTABLE} tolower -i html/node
- DEPENDS doc
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
- COMMENT "Generating API documentation with Yuidoc" VERBATIM
- )
- endif()
-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(upm_PACKAGE_ON_TAG ".")
- if ("${VERSION_COMMIT}" STREQUAL "")
- set(upm_PACKAGE_ON_TAG "")
- endif()
- set(CPACK_PACKAGE_VERSION
- "${upm_VERSION_MAJOR}.${upm_VERSION_MINOR}.${upm_VERSION_PATCH}${upm_PACKAGE_ON_TAG}${VERSION_COMMIT}")
- set(CPACK_PACKAGE_NAME "upm")
- set(CPACK_DEBIAN_PACKAGE_SECTION "libs")
- set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE ${TARGET_ARCH})
- set(CPACK_SYSTEM_NAME ${TARGET_ARCH})
- set(CPACK_DEBIAN_PACKAGE_DEPENDS "mraa (>= ${MRAA_VERSION})")
- set(CPACK_DEBIAN_PACKAGE_PROVIDES "upm-dev, upm-dbg, upm-doc")
- set(CPACK_DEBIAN_PACKAGE_REPLACES ${CPACK_DEBIAN_PACKAGE_PROVIDES})
- set(CPACK_DEBIAN_PACKAGE_CONFLICTS ${CPACK_DEBIAN_PACKAGE_PROVIDES})
- set(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}")
- include (CPack)
-endif()
-
-if (RPM)
- message (INFO " - RPM packaging enabled for ${DETECTED_ARCH}")
- set(CPACK_PACKAGE_VERSION ${VERSION})
- set(CPACK_GENERATOR "RPM")
- set(CPACK_PACKAGE_NAME "libupm${upm_VERSION_MAJOR}")
- set(CPACK_PACKAGE_RELEASE 1)
- set(CPACK_PACKAGE_VERSION
- "${upm_VERSION_MAJOR}.${upm_VERSION_MINOR}.${upm_VERSION_PATCH}-${upm_PACKAGE_ON_TAG}${VERSION_COMMIT}")
- set(CPACK_PACKAGE_CONTACT "Intel IoT-Devkit")
- set(CPACK_PACKAGE_VENDOR "Intel IoT-Devkit")
- set(CPACK_RPM_PACKAGE_REQUIRES "mraa >= ${MRAA_VERSION}")
- set(CPACK_RPM_PACKAGE_PROVIDES "${CPACK_PACKAGE_NAME}-devel")
- EXECUTE_PROCESS(COMMAND rpm --showrc
- COMMAND grep -E "dist[[:space:]]*\\."
- COMMAND sed -e "s/^.*dist\\s*\\.//"
- COMMAND tr \\n \\t
- COMMAND sed -e s/\\t//
- OUTPUT_VARIABLE DIST_TAG)
- set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_PACKAGE_RELEASE}.${DIST_TAG}.${DETECTED_ARCH}")
- include(CPack)
-endif()
-
-add_subdirectory (src)
-
-if(BUILDEXAMPLES)
- add_subdirectory (examples/c++)
-endif()
-
-if(BUILDJAVAEXAMPLES)
- add_subdirectory (examples/java)
-endif()
-
-if(BUILDTESTS)
- find_package (PythonInterp REQUIRED)
- if (${PYTHONINTERP_FOUND})
- enable_testing ()
- add_subdirectory (tests)
- endif ()
-endif()
diff --git a/peripheral/libupm/LICENSE b/peripheral/libupm/LICENSE
deleted file mode 100644
index a67fc9d..0000000
--- a/peripheral/libupm/LICENSE
+++ /dev/null
@@ -1,20 +0,0 @@
-Copyright © 2014-2015 Intel Corporation
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"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/libupm/README.md b/peripheral/libupm/README.md
deleted file mode 100644
index e7ccd02..0000000
--- a/peripheral/libupm/README.md
+++ /dev/null
@@ -1,112 +0,0 @@
-UPM (Useful Packages & Modules) Sensor/Actuator repository for MRAA
-==============
-
-UPM is a high level repository for sensors that use MRAA. Each sensor links
-to MRAA and are not meant to be interlinked although some groups of sensors
-may be. Each sensor contains a header which allows to interface with it.
-Typically a sensor is represented as a class and instantiated.
-
-The constructor is expected to initialise the sensor and parameters may be used
-to provide identification/pin location on the board.
-
-Typically an update() function will be called in order to get new data from the
-sensor in order to reduce load when doing multiple reads to sensor data.
-
-### Example
-
-A sensor/actuator is expected to work as such (here is the MMA7660 accelerometer API):
-```C++
- // Instantiate an MMA7660 on I2C bus 0
- upm::MMA7660 *accel = new upm::MMA7660(MMA7660_I2C_BUS,
- MMA7660_DEFAULT_I2C_ADDR);
-
- // place device in standby mode so we can write registers
- accel->setModeStandby();
-
- // enable 64 samples per second
- accel->setSampleRate(upm::MMA7660::AUTOSLEEP_64);
-
- // place device into active mode
- accel->setModeActive();
-
- while (shouldRun)
- {
- int x, y, z;
-
- accel->getRawValues(&x, &y, &z);
- cout << "Raw values: x = " << x
- << " y = " << y
- << " z = " << z
- << endl;
-
- float ax, ay, az;
-
- accel->getAcceleration(&ax, &ay, &az);
- cout << "Acceleration: x = " << ax
- << "g y = " << ay
- << "g z = " << az
- << "g" << endl;
-
- usleep(500000);
- }
-```
-
-However implementation and API design is completely up to the developer, some
-enumerable sensors for example may provide much clever instantiation. Displays
-may also create more complex structures in order to interface with them.
-
-Browse through the list of all [examples](https://github.com/intel-iot-devkit/upm/tree/master/examples).
-
-Multi-sensor samples for the starter and specialized kits can be found in the
-[iot-devkit-samples](https://github.com/intel-iot-devkit/iot-devkit-samples) repository.
-
-### Supported Sensors
-
-Supported [sensor list](http://iotdk.intel.com/docs/master/upm/modules.html) from API documentation.
-
-You can also refer to the [Intel® IoT Developer Zone](https://software.intel.com/iot/sensors).
-
-### IDE Integration
-
-If you would like to create projects and run the UPM samples using an Intel recommended IDE,
-please refer to the Intel Developer Zone IDE page.
-
-<a href="https://software.intel.com/iot/software/ide"><img src="docs/icons/allides.png"/></a>
-
-### Building UPM
-
-See building documentation [here](docs/building.md).
-
-### Making your own UPM module
-
-Porting [link](docs/porting.md) has more information on making new UPM modules.
-
-There is also an example available for max31855 [sensor](docs/max31855.md).
-
-Guide on creating Java [bindings](docs/creating_java_bindings.md).
-
-### Naming conventions and rules for new UPM contributions
-
-Before you begin development, take a look at our naming [conventions](docs/naming.md).
-
-Also, please read the guidelines for contributions [to UPM](docs/contributions.md).
-
-Don't forget to check the documentation [section](docs/documentation.md).
-
-Make sure you add yourself as an author on every new code file submitted.
-If you are providing a fix with significant changes, feel free to add yourself
-as a contributor. Signing-off your commits is mandatory.
-
-API Documentation
-==============
-
-<a href="http://iotdk.intel.com/docs/master/upm"><img src="docs/icons/c++.png"/></a>
-<a href="http://iotdk.intel.com/docs/master/upm/java"><img src="docs/icons/java.png"/></a>
-<a href="http://iotdk.intel.com/docs/master/upm/python"><img src="docs/icons/python.png"/></a>
-<a href="http://iotdk.intel.com/docs/master/upm/node"><img src="docs/icons/node.png"/></a>
-
-### Changelog
-Version changelog [here](docs/changelog.md).
-
-### Known Limitations
-List of known limitations [here](docs/knownlimitations.md).
diff --git a/peripheral/libupm/cmake/Toolchains/oe-sdk_cross.cmake b/peripheral/libupm/cmake/Toolchains/oe-sdk_cross.cmake
deleted file mode 100644
index 8a82c29..0000000
--- a/peripheral/libupm/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/libupm/cmake/modules/CPackDeb.cmake b/peripheral/libupm/cmake/modules/CPackDeb.cmake
deleted file mode 100644
index 87868bd..0000000
--- a/peripheral/libupm/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: ${CPACK_DEBIAN_PACKAGE_DEPENDS}
-Provides: ${CPACK_DEBIAN_PACKAGE_PROVIDES}
-Replaces: ${CPACK_DEBIAN_PACKAGE_REPLACES}
-Conflicts: ${CPACK_DEBIAN_PACKAGE_CONFLICTS}
-Source: https://github.com/intel-iot-devkit/upm
-#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/libupm/cmake/modules/FindNode.cmake b/peripheral/libupm/cmake/modules/FindNode.cmake
deleted file mode 100644
index 7501a16..0000000
--- a/peripheral/libupm/cmake/modules/FindNode.cmake
+++ /dev/null
@@ -1,61 +0,0 @@
-find_program (NODE_EXECUTABLE NAMES node
- HINTS
- $ENV{NODE_DIR}
- PATH_SUFFIXES bin
- DOC "Node.js interpreter"
-)
-
-include (FindPackageHandleStandardArgs)
-
-find_path (NODE_ROOT_DIR "node/node.h" "src/node.h"
- PATHS /usr/include/nodejs /usr/local/include/nodejs)
-
-set (NODE_INCLUDE_DIRS
- ${NODE_ROOT_DIR}/src
- ${NODE_ROOT_DIR}/node
- ${NODE_ROOT_DIR}/deps/v8/include
- ${NODE_ROOT_DIR}/deps/uv/include
-)
-
-find_package_handle_standard_args (Node DEFAULT_MSG
- NODE_EXECUTABLE
- NODE_INCLUDE_DIRS
-)
-
-if (NODE_EXECUTABLE)
- execute_process(COMMAND ${NODE_EXECUTABLE} --version
- OUTPUT_VARIABLE _VERSION
- RESULT_VARIABLE _NODE_VERSION_RESULT)
- execute_process(COMMAND ${NODE_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}")
- string (REPLACE "." "" V8_DEFINE_STRING "${_V8_VERSION}")
- string (STRIP ${V8_DEFINE_STRING} V8_DEFINE_STRING)
- list (GET _V8_VERSION_LIST 0 V8_VERSION_MAJOR)
- list (GET _V8_VERSION_LIST 1 V8_VERSION_MINOR)
- list (GET _V8_VERSION_LIST 2 V8_VERSION_PATCH)
- # 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 "28")
- set (V8_VERSION_PATCH "72")
- set (V8_VERSION_STRING "3.28.72")
- message ("defaulted to node 0.10.30")
- endif ()
- message ("INFO - Node version is " ${NODE_VERSION_STRING} "INFO - Node using v8 " ${V8_VERSION_STRING})
-endif ()
-
-mark_as_advanced (NODE_EXECUTABLE)
diff --git a/peripheral/libupm/cmake/modules/FindSphinx.cmake b/peripheral/libupm/cmake/modules/FindSphinx.cmake
deleted file mode 100644
index 5afcd94..0000000
--- a/peripheral/libupm/cmake/modules/FindSphinx.cmake
+++ /dev/null
@@ -1,31 +0,0 @@
-find_program (SPHINX_EXECUTABLE NAMES sphinx-build
- HINTS $ENV{SPHINX_DIR}
- PATH_SUFFIXES bin
- DOC "Sphinx documentation html generator"
-)
-
-find_program (SPHINX_API_EXECUTABLE NAMES sphinx-apidoc
- HINTS $ENV{SPHINX_DIR}
- PATH_SUFFIXES bin
- DOC "Sphinx documentation rst generator"
-)
-
-include (FindPackageHandleStandardArgs)
-
-find_package_handle_standard_args (Sphinx DEFAULT_MSG
- SPHINX_EXECUTABLE
- SPHINX_API_EXECUTABLE
-)
-
-# Get Sphinx version
-if (SPHINX_EXECUTABLE)
- execute_process(COMMAND ${SPHINX_EXECUTABLE} --version
- OUTPUT_VARIABLE SPHINX_VERSION)
- if(SPHINX_VERSION)
- string(REGEX MATCH "([0-9]\\.[0-9]\\.[0-9])" SPHINX_VERSION_STR ${SPHINX_VERSION})
- message ("INFO - Sphinx version is " ${SPHINX_VERSION_STR})
- endif()
-endif ()
-
-mark_as_advanced (SPHINX_EXECUTABLE)
-mark_as_advanced (SPHINX_API_EXECUTABLE)
diff --git a/peripheral/libupm/cmake/modules/FindYuidoc.cmake b/peripheral/libupm/cmake/modules/FindYuidoc.cmake
deleted file mode 100644
index 554a22f..0000000
--- a/peripheral/libupm/cmake/modules/FindYuidoc.cmake
+++ /dev/null
@@ -1,23 +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)
- if(YUIDOC_VERSION)
- message ("INFO - Yuidoc version is " ${YUIDOC_VERSION})
- endif()
-endif ()
-
-mark_as_advanced (YUIDOC_EXECUTABLE)
diff --git a/peripheral/libupm/cmake/modules/GetGitRevisionDescription.cmake b/peripheral/libupm/cmake/modules/GetGitRevisionDescription.cmake
deleted file mode 100644
index c8d27f2..0000000
--- a/peripheral/libupm/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/libupm/cmake/modules/GetGitRevisionDescription.cmake.in b/peripheral/libupm/cmake/modules/GetGitRevisionDescription.cmake.in
deleted file mode 100644
index 888ce13..0000000
--- a/peripheral/libupm/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/libupm/cmake/modules/LICENSE_1_0.txt b/peripheral/libupm/cmake/modules/LICENSE_1_0.txt
deleted file mode 100644
index 36b7cd9..0000000
--- a/peripheral/libupm/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/libupm/cmake/modules/TargetArch.cmake b/peripheral/libupm/cmake/modules/TargetArch.cmake
deleted file mode 100644
index f9db1e6..0000000
--- a/peripheral/libupm/cmake/modules/TargetArch.cmake
+++ /dev/null
@@ -1,136 +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)
-
-# 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(__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/libupm/cmake/modules/version.c.in b/peripheral/libupm/cmake/modules/version.c.in
deleted file mode 100644
index 0fdf853..0000000
--- a/peripheral/libupm/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/libupm/docs/building.md b/peripheral/libupm/docs/building.md
deleted file mode 100644
index 7f6613d..0000000
--- a/peripheral/libupm/docs/building.md
+++ /dev/null
@@ -1,113 +0,0 @@
-Building UPM {#building}
-============
-
-UPM uses cmake in order to make compilation relatively painless. Cmake runs
-build out of tree so the recommended way is to clone from git and make a build/
-directory.
-
-This project depends on libmraa, so that needs to be installed first. Append
-the install location of mraa pkgconfig to the following environment variable:
-
- PKG_CONFIG_PATH=$PKG_CONFIG_PATH:.../mraa/build/lib/pkgconfig
-
-UPM will attempt to build all directories inside src/ and they must contain
-individual CMakeLists.txt files.
-
-~~~~~~~~~~~~~{.sh}
-mkdir build
-cd build
-cmake ..
-make
-make install
-~~~~~~~~~~~~~
-
-The last command will create the include/ and lib/ directories with a copy of
-the headers and library objects respectively in your build location. Note that
-doing an out-of-source build may cause issues when rebuilding later on.
-
-Our cmake configure has a number of options, *cmake-gui* or *ccmake* can show
-you all the options. The interesting ones are detailed below:
-
-Changing install path from /usr/local to /usr
-~~~~~~~~~~~~~
--DCMAKE_INSTALL_PREFIX:PATH=/usr
-~~~~~~~~~~~~~
-Building debug build:
-~~~~~~~~~~~~~
--DCMAKE_BUILD_TYPE=DEBUG
-~~~~~~~~~~~~~
-Using clang instead of gcc:
-~~~~~~~~~~~~~
--DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++
-~~~~~~~~~~~~~
-Cross-compiling on a different system:
-~~~~~~~~~~~~~
--DCMAKE_CXX_FLAGS:STRING=-m32 -march=i586
--DCMAKE_C_FLAGS:STRING=-m32 -march=i586
-~~~~~~~~~~~~~
-Building with an older version of swig (swig 2.0+) requires the disabling of javascript:
-~~~~~~~~~~~~~
--DBUILDSWIGNODE=OFF
-~~~~~~~~~~~~~
-Disabling python module building
-~~~~~~~~~~~~~
--DBUILDSWIGPYTHON=OFF
-~~~~~~~~~~~~~
-Setting the python library to use:
-~~~~~~~~~~~~~
--DPYTHON_LIBRARY:FILEPATH=/usr/lib/libpython2.7.so.1.0
-~~~~~~~~~~~~~
-Building doxygen doc
-~~~~~~~~~~~~~
--DBUILDDOC=ON
-~~~~~~~~~~~~~
-Build C++ example binaries
-~~~~~~~~~~~~~
--DBUILDEXAMPLES=ON
-~~~~~~~~~~~~~
-
-If you intend to turn on all the options and build everything at once (C++,
-Node, Python and Documentation) you will have to edit the src/doxy2swig.py file
-and change the line endings from Windows style to Linux format. This has to be
-repeated every time to sync with the master branch since our Github repository
-stores files using CR LF line breaks.
-
-You can also generate the include and lib directories containing all the sensor
-headers and library files respectively with *make install*. Further, you may
-choose to generate these only for a specific sensor you modified, and this can
-be achieved by building from the individual makefile of the sensor. Assuming
-you're in the build directory, to make the lcd module you would:
-
-~~~~~~~~~~~~~
-cd src/lcd
-make install
-~~~~~~~~~~~~~
-
-Often developers are only interested in building one module or even just the
-python/node module to do some quick testing using scripting. In order to do
-this you need to use the target name for the python or node module you want to
-rebuild. For example the lcd module target name is i2clcd. Therefore the python
-module target name will be prefixed by _pyupm_. Just do the following to build
-only that module. Modules not using the UPM cmake macros may have different
-naming.
-
-~~~~~~~~~~~~~
-make _pyupm_i2clcd
-~~~~~~~~~~~~~
-
-Sometimes you want to build a small C++ example against an installed library.
-This is fairly easy if installed system-wide. Just link against the correct
-library (in this case libupm-i2clcd) and then add /usr/include/upm to the
-loader path:
-
-~~~~~~~~~~~~
-g++ test.cxx -lupm-i2clcd -I/usr/include/upm
-~~~~~~~~~~~~
-
-You can also use pkg-config to return the information to you, which is
-considered the correct way if including UPM in a build system like cmake or
-autotools on linux.
-
-~~~~~~~~~~~
-pkg-config --cflags --libs upm-i2clcd
-~~~~~~~~~~~
diff --git a/peripheral/libupm/docs/changelog.md b/peripheral/libupm/docs/changelog.md
deleted file mode 100644
index 40630a6..0000000
--- a/peripheral/libupm/docs/changelog.md
+++ /dev/null
@@ -1,171 +0,0 @@
-Changelog {#changelog}
-===============
-
-Here's a list summarizing some of the key undergoing changes to our library
-from earlier versions:
-
-### v0.5.1
-
- * Updated the API and added new functionality for the MY9221 class and derived
- sensors: grovecircularled and groveledbar, along with new code samples that
- show these changes
- * Provided a fix for one JAVA example that uses interrupts and updated library
- install paths
- * Several documentation improvements and pictures were added for new sensors
- * A few other sensors received minor patches
-
-### v0.5.0
-
- * First implementations for industrial grade Modbus sensors, along with first
- sensor examples that use the new iio system driver in MRAA
- * Significant improvements to the stepmotor driver that will now allow precise
- control using any GPIO pin and extended the API with new functionality
- * Further improved JAVA bindings and sensor ISRs have been modified to
- implement Runnable objects
- * Improved Python typemaps and error checking, documentation now includes
- detailed function descriptions
- * Simplified the build process by eliminating the need to define redundant
- MRAA related environment variables
- * New sensors: nlgpio16, ads1x15, t3311, hdxxvxta, hwxpxx, rhusb, ili9341,
- apds9930, kxcjk1013
-
-### v0.4.1
-
- * Over 150 supported sensor drivers including some industrial grade devices
- * Improved the JAVA bindings, added a large number of examples for sensors,
- enabled JAVA builds in Travis CI, and introduced automatic loading for the
- JAVA shared libraries
- * Continued to improve existing sensor drivers and to enhance them with the
- new C++ coding style and exception types
- * Several cmake improvements to allow building on various Linux distributions
- and with a newer version of Node.JS
- * Simplified adding and building of C++ sensor examples via cmake
- * New sensors: micsv89, xbee, urm37, adxrs610, bma220, dfrph, mcp9808, sx1276,
- groveultrasonic, ozw
-
-### v0.4.0
-
- * Fully functional and documented JAVA language bindings for sensors with
- several examples also available
- * Added standardized exception handling support across all language bindings
- and updated sensors to use this feature
- * Sensor drivers are now available and can be installed individually using NPM
- for Node.js users
- * Continuous Integration with Travis CI ensures new contributions are built
- automatically once they are received
- * API rewrite and improvements for hcsr04, sm130, eboled, loudness
- * Documentation improvements and code style changes from C to C++
- * New sensors: hyld9767, mg811, wheelencoder, grovegprs, mpu9250, ssd1306,
- es9257, lm35, mq4, mq6, mq7, mq8
-
-### v0.3.2
-
- * Introduced RPM package generation feature from cmake via cpack
- * Performed a thorough documentation review and merged resulting changes,
- includes last remaining images and grouping sensors by kits
- * Added support for Sparkfun Sensor Blocks (OLED & IMU)
- * Fully reworked API for at42qt1070, mpu9150 and lcd classes, while
- maintaining backwards compatibility for existing lcd displays
- * Extended doxygen tags for better integration with automated documentation
- generators
- * New sensors: rgbringcoder, hp20x, pn532, sainsmartks, lsm9ds0, eboled
-
-### v0.3.1
-
- * Updated index pages for API documentation and cross-linked them
- * More images were added for Grove, Adafruit and Sparkfun sensors along with
- licensing information
- * Applied a set of patches to improve code robustness
- * Added support for Grove NFC Tag sensor
- * Fixed several typos in library and sensor names
- * New sensor: m24lr64e
-
-### v0.3.0
-
- * Provided automated, updated and comprehensive sensor API documentation for
- C++, Python and JavaScript
- * Edited sensor names, library descriptions and doxygen tags for consistency
- * Fixed the TH02 sensor driver and made major improvements to i2clcd driver
- * Added new and updated images for numerous new and existing sensors
- * Started this changelog
- * New sensors: sx6119, si114x, maxsonarez, hm11, ht9170, h3lis331dl, ad8232,
- grovescam
-
-### v0.2.0
-
- * Passed 100 supported sensor drivers
- * Updated header files with new doxygen tags for improved API documentation
- generation
- * Added python examples for sensors
- * Fixed the buzzer and servo drivers for the Intel Edison
- * Renamed bmp and gp2y sensor classes to be more generic
- * Completely revamped implementation for tm1637
- * New sensors: mma7660, cjq4435, adxl335, hmtrp, nunchuck, otp538u, l298,
- groveelectromagnet, grovecollision, adis16448, at42qt1070, grovemd, ina132,
- grovegsr, groveo2, groveemg, pca9685, pca9685ss, adafruitms1438, hx711, flex,
- groveeldriver, mhz16, apds9002, waterlevel, zfm20, uln200xa, grovewfs, isd1820
-
-### v0.1.9
-
- * Passed 50 supported sensor drivers
- * Starter Kit and Additional Roadshow and Hackaton sensors added
- * Several examples and documentation updates submitted
- * Wrote new proper SWIG typemaps for arrays
- * Fixed the i2clcd write function, improved several other sensors
- * New sensors: rpr220, rotaryencoder, biss0001, rfr359f, grovespeaker, mq303a,
- ppd42ns, wt5001, yg1006, ublox6, mpr121, groveloudness, guvas12d, grovewater,
- grovevdiv, grovelinefinder, ta12200, groveehr, grovemoisture, gp2y0a, a110x,
- ds1307, adc121c021, enc03r, ttp223, itg3200, am2315, tp401, ldt0028, htu21d,
- mpl3115a2, lsm303, joystick12, tsl2561, groverotary, groveslider, adxl345,
- grovebutton, lol, groverelay
-
-### v0.1.8
-
- * Added MQ series gas sensors and a few others
- * Generated Doxygen layout file to improve API look and feel
- * Several sensor documentation updates
-
-### v0.1.7
-
- * Fixed SWIG node build issues
- * Added lpd8806 digital led strip
-
-### v0.1.6
-
- * Fixed SWIG python builds
- * Extended i2clcd devices with new functions
- * Made SWIG interface improvements and added extra types
- * Added nrf8001 BLE support
- * Few other sensor additions and fixes
-
-### v0.1.5
-
- * New drivers for microphone and mpu9150
- * Added generic driver for stepper motors
- * Updated all code to use MRAA and version dependency
-
-### v0.1.4
-
- * Added new bmp/gy pressure sensor and updated servo
- * Started UPM documentation and related pages
- * Updated MRAA dependencies
-
-### v0.1.3
-
- * Updated SWIG support for some sensors
- * New sensor support for mma7455 accelerometer
-
-### v0.1.2
-
- * Several new sensors added
- * Documentation fixes
- * IPK generation
-
-### v0.1.1
-
- * Updated MRAA dependency
-
-### v0.1.0
-
- * Initial release with some basic grove sensors and hmc5883
- * Doxygen and SWIG support implemented
diff --git a/peripheral/libupm/docs/contributions.md b/peripheral/libupm/docs/contributions.md
deleted file mode 100644
index d362c9a..0000000
--- a/peripheral/libupm/docs/contributions.md
+++ /dev/null
@@ -1,96 +0,0 @@
-Contributing a module {#contributions}
-=====================
-
-Here are the rules of contribution:
-- Your new module must have an example that builds against your UPM library.
-- Each commit must have a sign-off line by everyone who authored or reviewed
- them.
-- Commits must be named `<file/module>: Some decent description`.
-- You must license your module under a FOSS license. The recommended license
- is MIT but any permissive license is fine. Please consider that people using
- UPM may want to write proprietary programs with your sensors so we like to
- avoid GPL. If your license is not MIT please include a LICENSE file in
- src/mymodule/.
-- The top of each source file must contain a comment block containing the
- license information.
-- Please test your module builds before contributing and make sure it works on
- the latest version of libmraa. If you tested on a specific board/platform
- please tell us what this was in your PR.
-- Try not to break master. In any commit.
-- Attempt to have some decent API documentation as described in the the @ref
- documentation [guide](documentation.md).
-
-Including the MIT license
-=========================
-Choosing the [MIT license](http://opensource.org/licenses/MIT) is preferred for
-the UPM repository. Below is the comment block needed at the top each source
-file:
-
- /*
- * The MIT License (MIT)
- *
- * Author: <your full name>
- * Copyright (c) <year> <copyright holder>
- *
- * Author: <contributing author full name - if applicable>
- * Copyright (c) <year> <copyright holder>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- * the Software, and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-Code signing
-============
-
-The sign-off is a simple line at the end of the explanation for the
-patch, which certifies that you wrote it or otherwise have the right to pass it
-on as an open-source patch. The rules are pretty simple: if you can certify
-the below:
-
- Developer's Certificate of Origin 1.1
-
- By making a contribution to this project, I certify that:
-
- (a) The contribution was created in whole or in part by me and I
- have the right to submit it under the open source license
- indicated in the file; or
-
- (b) The contribution is based upon previous work that, to the best
- of my knowledge, is covered under an appropriate open source
- license and I have the right under that license to submit that
- work with modifications, whether created in whole or in part
- by me, under the same open source license (unless I am
- permitted to submit under a different license), as indicated
- in the file; or
-
- (c) The contribution was provided directly to me by some other
- person who certified (a), (b) or (c) and I have not modified
- it.
-
- (d) I understand and agree that this project and the contribution
- are public and that a record of the contribution (including all
- personal information I submit with it, including my sign-off) is
- maintained indefinitely and may be redistributed consistent with
- this project or the open source license(s) involved.
-
-then you just add a line to each of your commits with `--signoff` saying
-
- Signed-off-by: Random J Developer <random@developer.example.org>
-
-using your real name (sorry, no pseudonyms or anonymous contributions.)
-Unsigned commits will not be accepted.
diff --git a/peripheral/libupm/docs/creating_java_bindings.md b/peripheral/libupm/docs/creating_java_bindings.md
deleted file mode 100644
index 3ac82c3..0000000
--- a/peripheral/libupm/docs/creating_java_bindings.md
+++ /dev/null
@@ -1,353 +0,0 @@
-Creating Java Bindings Guide
-==============
-* [Overview](#overview)
-* [Tools of trade](#tools-of-trade)
-* [Recommendations for the native API](#recommendations-for-the-native-api)
- * [Pointers](#pointers)
- * [Throwing Exceptions in Java](#throwing-exceptions-in-java)
-* [Caveats & Challenges](#caveats--challenges)
- * [Wrapping C arrays with Java arrays](#wrapping-c-arrays-with-java-arrays)
- * [Wrapping unbound C arrays with Java arrays if array is output](#wrapping-unbound-c-arrays-with-java-arrays-if-array-is-output)
- * [Wrapping unbound C arrays with Java arrays if array is input](#wrapping-unbound-c-arrays-with-java-arrays-if-array-is-input)
- * [Implementing callbacks in Java](#implementing-callbacks-in-java)
-
-
-##Overview
-
-The "Creating Java Bindings Guide" serves as a basic tutorial for using the SWIG software development tool to create 'glue code' required for Java to call into C/C++ code. It contains: guides for dealing with type conversions, exception handling, callbacks; recommendations on how to write/modify the native API to avoid issues on the Java side, and also workarounds for those issues that can't be avoided.
-
-This guide was created with the [upm](https://github.com/intel-iot-devkit/upm/) and [mraa](https://github.com/intel-iot-devkit/mraa) libraries in mind, and uses examples taken from these sources, but its usage can be extended to any project of creating Java bindings for C/C++ libraries.
-
-##Tools of trade
-
-[SWIG General Documentation](http://www.swig.org/Doc3.0/SWIGDocumentation.html)
-
-[SWIG Java-specific Documentation](http://www.swig.org/Doc3.0/Java.html)
-
-
-##Recommendations for the native API
-
-###Pointers
-As much as possible, avoid passing values/returning values through pointers given as as arguments to methods. As the Java language does not have pointers, SWIG provides a [workaround](http://www.swig.org/Doc3.0/Java.html#Java_tips_techniques) in the typemaps.i library.
-
-####Alternatives:
-1. Functions that read data from a driver, return it through a pointer given as argument, and return a bool value, should be __replaced by__ functions that return the value directly and throw a std::runtime_error if a read error occurs. E.g.:
- ```c++
- /*
- * Function reads from sensor, places read value in variable bar and
- * returns true if succesful. Function returns false if read failed.
- */
- bool func(int *bar);
- ```
- __Replaced by:__
- ```c++
- /*
- * Function reads from sensor and returns read value.
- * Or throws std::runtime_error if a read error occurs
- */
- int func();
- ```
-
-2. Functions that return multiple values through pointers, that make sense to be grouped together into an array<sup>1</sup> (e.g. speed values, acceleration values), should be __replaced by__ functions that return a pointer to an array in which the elements are the returned values. Afterwards, [wrap the C array with a Java array](#wrapping-unbound-c-arrays-with-java-arrays-if-array-is-output). E.g.:
- ```c++
- /*
- * Function returns the acceleration on the three
- * axis in the given variables.
- */
- void getAccel(int *accelX, int *accelY, int *accelZ);
- ```
-
- __Replaced by:__
- ```c++
- /*
- * Function returns the acceleration on the three
- * axis as elements of a 3-element array.
- */
- int *getAccel();
- ```
-
-3. Functions that return N values through pointers, that do not make sense to grouped together (e.g. a general purpose function that returns both the light intensity and air pollution), should be __replaced by__ N functions (one for each value) that read only one specific value. E.g.:
-
- ```c++
- /*
- * Function returns the light intensity and air pollution
- */
- void getData(int *light, int *air);
- ```
-
- __Replaced by:__
- ```c++
- int getLight();
- int getAir();
- ```
-
-4. Functions that return N values through pointers; values that do not make sense to be grouped together, but are time dependent, and make sense to be read at the same time. For example, a sensor that reads air humidity and temperature. A user may want to know the temperature value _temp_ read at the exact moment the humidity value _humid_ was read. These should be __replaced by__ N+1 functions: a _getData()_ function that reads all values at the same time and stores them in global variables; and N getter functions, one for each value. E.g.
-
- ```c++
- /*
- * Function returns the light intensity and air pollution
- */
- void getData(int *temp, int *humid);
- ```
-
- __Replaced by:__
- ```c++
- void getData();
- int getTemp();
- int getHumid();
- ```
-
- <sup>1</sup>this depends on the interpretation of the returned data. For example, arguments that return the temperature and light intensity, don't make sense to be grouped into an array of size 2. But acceleration on the three axis can be grouped together in an array of size 3. where accelX is accel[0], accelY is accel[1], accelZ is accel[2].
-
-__Notice:__
-Sometimes, you may be required to write JNI code. Be aware of the difference between the C JNI calling syntax and the C++ JNI calling syntax.The C++ calling syntax will not compile as C and also vice versa. It is however possible to write JNI calls which will compile under both C and C++ and is covered in the [Typemaps for both C and C++ compilation](http://www.swig.org/Doc3.0/Java.html#Java_typemaps_for_c_and_cpp) section of the SWIG Documentation.
-
-
-###Throwing Exceptions in Java
-####Language independent:
-The %exception directive allows you to define a general purpose exception handler. For example, you can specify the following:
-
-```c++
-%exception [method_name] {
- try {
- $action
- }
- catch (std::invalid_argument& e) {
- ... handle error ...
- }
-}
-```
-
-If [method_name] is not specified then the directive is applied to all methods in its scope.
-
-The usual thing you'd want to do is catch the C++ exception and throw an equivalent exception in your language.
-
-The exception.i library file provides support for creating language independent exceptions in your interfaces. To use it, simply put an "%include exception.i" in your interface file. This provides a function SWIG_exception() that can be used to raise common language exceptions in a portable manner. For example :
-
-
-```c++
-// Language independent exception handler
-%include exception.i
-
-%exception {
- try {
- $action
- } catch(OutOfMemory) {
- SWIG_exception(SWIG_MemoryError, "Out of memory");
- } catch(...) {
- SWIG_exception(SWIG_RuntimeError,"Unknown exception");
- }
-}
-```
-
-In the upm library, the upm_exception.i interface file provides the functionality to catch common exceptions and propagate them through SWIG. It uses the exception.i library file and is language independent.
-
-The upm_exception.i interface file is included in the upm.i file, therefor SWIG wraps all generated methods' body in a try-catch statement for the following exceptions:
-
-* std::invalid_argument
-* std::domain_error
-* std::overflow_error
-* std::out_of_range
-* std::length_error
-* std::logic_error
-* std::bad_alloc
-* std::runtime_error
-* std::exception
-
-
-####Java specific:
-To throw a specific Java exception:
-
-```c++
-%exception {
- try {
- $action
- } catch (std::out_of_range &e) {
- jclass clazz = jenv->FindClass("java/lang/Exception");
- jenv->ThrowNew(clazz, "Range error");
- return $null;
- }
-}
-```
-
-Where FindClass and ThrowNew are [JNI functions](http://docs.oracle.com/javase/8/docs/technotes/guides/jni/spec/functions.html).
-
-Java defines two tipes of exceptions: checked exception and unchecked exceptions (errors and runtime exceptions). Checked exceptions are subject to the [Catch or Specify Requirement](https://docs.oracle.com/javase/tutorial/essential/exceptions/catchOrDeclare.html).
-
-The C++ compiler does not force the code to catch any exception.
-
-The %exception directive does not specify if a method throws a checked exception (does not add classes to the throws clause). For this, the %javaexception(classes) directive is used; where classes is a string containing one or more comma separated Java classes.
-
-```c++
-%javaexception("java.lang.Exception") {
- try {
- $action
- } catch (std::out_of_range &e) {
- jclass clazz = jenv->FindClass("java/lang/Exception");
- jenv->ThrowNew(clazz, "Range error");
- return $null;
- }
-}
-```
-
-In the upm library, the java_exceptions.i library file provides the functionality to catch exceptions and propagate them through SWIG as Java checked exceptions. The file provides SWIG wrappers, in the form of macros, that can be applied to methods.E.g. use the __READDATA_EXCEPTION(function)__ macro for functions that read data from a sensor and throw a std::runtime_error in case of a read failure. This will result in:
-
-```java
-void function throws IOException ();
-```
-
-##Caveats & Challenges
-
-###Wrapping C arrays with Java arrays
-SWIG can wrap arrays in a more natural Java manner than the default by using the arrays_java.i library file. Just include this file into your SWIG interface file.
-
-###Wrapping unbound C arrays with Java arrays if array is output
-Functions that return arrays, return a pointer to that array. E.g.:
-
-```c++
-/*
- * Function returns the acceleration on the three
- * axis as elements of a 3-element array.
- */
-
-int *getAccel();
-```
-
-__SWIG:__
-```c++
-%typemap(jni) int* "jintArray"
-%typemap(jstype) int* "int[]"
-%typemap(jtype) int* "int[]"
-
-%typemap(javaout) int* {
- return $jnicall;
-}
-
-%typemap(out) int *getAccel {
- $result = JCALL1(NewIntArray, jenv, 3);
- JCALL4(SetIntArrayRegion, jenv, $result, 0, 3, (const signed int*)$1);
-}
-```
-
-###Wrapping unbound C arrays with Java arrays if array is input
-In C, arrays are tipically passed as pointers, with an integer value representig the length of the array. In Java, the length of an array is always known, so the length argument is redundant. This example shows how to wrap the C array and also get rid the length argument. E.g.:
-
-```c++
-void func(uint8_t *buffer, int length);
-```
-
-__SWIG:__
-```c++
-%typemap(jtype) (uint8_t *buffer, int length) "byte[]"
-%typemap(jstype) (uint8_t *buffer, int length) "byte[]"
-%typemap(jni) (uint8_t *buffer, int length) "jbyteArray"
-%typemap(javain) (uint8_t *buffer, int length) "$javainput"
-
-%typemap(in,numinputs=1) (uint8_t *buffer, int length) {
- $1 = JCALL2(GetByteArrayElements, jenv, $input, NULL);
- $2 = JCALL1(GetArrayLength, jenv, $input);
-}
-```
-
-!!!! There is a difference between TYPE *name and TYPE * name in typemaps!!!!!
-
-
-###Implementing callbacks in Java
-Callbacks in the UPM Java library (as well as the MRAA Java library) make use of the _void mraa\_java\_isr\_callback(void\* data\)_ method from MRAA.
-
-__Callbacks in the UPM Java library are implemented as follows (we use the a110x Hall Effect sensors as example):__
-
-We extend the sensor class with another method, _installISR\(jobject runnable\)_, which is a wrapper over the original _installISR\(void \(\*isr\)\(void \*\), void \*arg\)_ method. This will install the _mraa\_java\_isr\_callback\(\)_ method as the interrupt service routine \(ISR\) to be called, with _jobject runnable_ as argument.
-
-SWIGJAVA is a symbol that is always defined by SWIG when using Java. We enclose the _installISR\(jobject runnable\)_ method in a _\#if defined(SWIGJAVA)_ check, to ensure the code only exists when creating a wrapper for Java.
-
-```c++
-#if defined(SWIGJAVA)
-void A110X::installISR(jobject runnable)
-{
- installISR(mraa_java_isr_callback, runnable);
-}
-#endif
-```
-
-We hide the underlying method, _installISR\(void \(\*isr\)\(void \*\), void \*arg\)_ , and expose only the _installISR\(jobject runnable\)_ to SWIG, through the use of the SWIGJAVA symbol. When SWIGJAVA is defined, we change the access modifier of the underlying method to private.
-
-```c++
-public:
-#if defined(SWIGJAVA)
- void installISR(jobject runnable);
-#else
- void installISR(void (*isr)(void *), void *arg);
-#endif
-private:
-#if defined(SWIGJAVA)
- void installISR(void (*isr)(void *), void *arg);
-#endif
-```
-
-To use callback in java, we create a ISR class, which implements the Java Runnable interface, and we override the _run\(\)_ method with the code to be executed when the interrupt is received. An example for the a110x Hall sensor that increments a counter each time an interrupt is received:
-
-```java
-public class A110X_intrSample {
- public static int counter=0;
-
- public static void main(String[] args) throws InterruptedException {
- upm_a110x.A110X hall = new upm_a110x.A110X(2);
-
- A110XISR callback = new A110XISR();
- hall.installISR(callback);
-
- while(true){
- System.out.println("Counter: " + counter);
- Thread.sleep(1000);
- }
- }
-}
-
-class A110XISR implements Runnable {
- public A110XISR(){
- super();
- }
- public void run(){
- A110X_intrSample.counter++;
- }
-}
-```
-####Issues with java callbacks and workarounds
-
-__SWIGJAVA not defined at compile time__
-
-Consider the following files:
-* example.h - Header file for our source file
-* example.cxx - Source file containing the class Example, for which we build java bindings
-* example.i - The SWIG interface, that includes the example.h header file
-
-The build process of a java module using SWIG is split into two steps:
-
-1. Generating the intermediate files, from the SWIG interface file. This will produce the java class file (Example.java), the JNI file (exampleJNI.java) and wrapper file (example_wrap.cxx). The source file (example.cxx) is not needed in the first step.
-
- ```
-swig -c++ -java example.i
- ```
-
-2. Generating the shared library from the C++ sources and wrapper file
- ```
-g++ -fPIC -c example.cxx example_wrap.cxx -I/usr/lib/jvm/java-1.8.0/include -I/usr/lib/jvm/java-1.8.0/include/linux
-g++ -shared example_wrap.o sensor.o -o libexample.so
- ```
-
-
-SWIGJAVA is always defined when SWIG parses the interface file, meaning it will be defined when it parses the header file (example.h) that is included in the interface file (example.i).
-SWIG also adds the "#define SWIGJAVA" directive in the wrapper file (example_wrap.cxx).
-However, in generating the shared library the SWIGJAVA symbol is only defined in the example_wrap.cxx file, because of the added "#define SWIGJAVA" directive. But we have also used the "#if defined(SWIGJAVA)" check in the source file (example.cxx), and thus need to define SWIGJAVA for it too. If we define the SWIGJAVA symbol as a compile flag, when compiling the source code to object code, the SWIGJAVA compile flag and #define SWIGJAVA" directive will clash and give a double definition warning (only a warning).
-
-In this example it is simple to compile the two source codes separately, one with the compile flag, the other without, and then create the shared library (libexample.so).
-But in a big automatic build like the java upm libraries, this may prove too hard or too complicated to do. A workaround to this would be to define a custom symbol (e.q. JAVACALLBACK in the upm library) and also test for it. In short, replace:
-```c++
-#if defined(SWIGJAVA)
-```
-by
-```c++
-#if defined(SWIGJAVA) || defined(JAVACALLBACK)
-```
-
diff --git a/peripheral/libupm/docs/documentation.md b/peripheral/libupm/docs/documentation.md
deleted file mode 100644
index 13712bb..0000000
--- a/peripheral/libupm/docs/documentation.md
+++ /dev/null
@@ -1,117 +0,0 @@
-Writing sensor documentation {#documentation}
-=====================
-
-It is highly encouraged to provide at least some basic documentation for the
-sensors that you want to add to UPM:
-
-- If you don't add documentation, the code review will take very long and
- your contribution could be rejected.
-- Try to have no warnings in doxygen, this is generally fairly easy.
-- Have the specific sensor manufacturer/model & version that you used, if you
- support multiple versions please list.
-- Simple comments do not need full stops.
-- Stick to <80 chars per line even in comments.
-- No text is allowed on the same line as the start or end of a comment /** */.
-
-####The sensor block
-
-This is added just before the class declaration in your header(.h) file and has
-mandatory fields. For single sensor libraries, this block will actually
-follow immediately after the library block. If you have multiple physical
-sensors, add this to every one.
-Here's an example (disregard the "@verbatim" tags in your actual code):
-
-```
-@verbatim
-/**
- * @library <lib-name>
- * @sensor <chip-id>
- * @comname <component-name>
- * @altname <alt-name>
- * @altid <alt-id>
- * @type <component-category>
- * @man <component-manufacturer>
- * @web <component-weblinks>
- * @con <connection-type>
- * @kit <component-kit>
- *
- * @brief Short class/sensor description
- *
- * Then add a longer
- * description here.
- *
- * @image html <component-img.jpeg>
- * @snippet <example-name.cxx> Interesting
- */
-@endverbatim
-```
-
-- `<lib-name>` When adding to an existing library this needs to match that
- library's "@defgroup", otherwise this is a new library name, generally the
- same as chip id. *Mandatory*
-- `<chip-id>` Usually the chip number used by the sensor. When this is not
- available or relevant, use a unique descriptor that makes sense. Must match
- class name. *Mandatory*
-- `<component-name>` A short name for your sensor, try to avoid including the
- manufacturer's name here. *Mandatory*
-- `<alt-name>` Alternative names that your sensor driver might have. This may
- include manufacturer's name. *Optional*
-- `<alt-id>` Alternative chip-ids that your sensor driver supports. *Optional*
-- `<component-category>` Mention one or more categories the sensor fits in. Can
- be 'other'. *Mandatory*
-- `<component-manufacturer>` Sensor manufacturer. Can be 'generic'. *Mandatory*
-- `<component-weblinks>` Links to vendors or data-sheets. *Optional*
-- `<connection-type>` Specifies how does the sensor connect to the board
- *Mandatory*
-- `<component-kit>` Specifies if the sensor is part of a kit. *Optional*
-
-Existing groups that can be used for the manufacturer, connection, category and
-kit tags are found in the src/upm.h file.
-
-Optionally, a small representative image can be placed in the "docs/images"
-subfolder and linked with the "@image" tag.
-**Please do not use existing, copyrighted images with your sensors!**
-
-The example should have an 'Interesting' section which will be highlighted as
-a code sample in doxygen. Everything in between such tags will show up in the
-class documentation when "@snippet" is added at the end of a class docstring.
-Tags use this format (in "example-name.cxx"):
-
-```
-@verbatim
- //! [Interesting]
-
- ...example code here...
-
- //! [Interesting]
-@endverbatim
-```
-
-For more examples take a look at the existing headers in our github repository.
-
-####The library block
-
-New libraries must have the "@brief", "@defgroup" and "@ingroup" tags in one
-block. This usually follows the namespace and it is common to have one sensor
-per library.
-
-You should end up with something like this:
-
-```
-@verbatim
-/**
- * @brief Short description for entire library
- *
- * Optional longer description.
- *
- * @defgroup <lib-name> libupm-<lib-name>
- * @ingroup <manufacturer> <connection> <category> (<kit>)
- */
-@endverbatim
-```
-
-In "@defgroup" use the same `<lib-name>` used in the sensor block. Multiple
-sensors can be added to the same library this way.
-For "@ingroup" add the same values as in the sensor block for manufacturer,
-category, connection type and kit. If you have multiple classes or sensors
-per library, only use the "@ingroup" tags that are common for all of them.
diff --git a/peripheral/libupm/docs/icons/allides.png b/peripheral/libupm/docs/icons/allides.png
deleted file mode 100644
index 84100fb..0000000
--- a/peripheral/libupm/docs/icons/allides.png
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/icons/c++.png b/peripheral/libupm/docs/icons/c++.png
deleted file mode 100644
index b2beb32..0000000
--- a/peripheral/libupm/docs/icons/c++.png
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/icons/eclipse.png b/peripheral/libupm/docs/icons/eclipse.png
deleted file mode 100644
index e8fcff7..0000000
--- a/peripheral/libupm/docs/icons/eclipse.png
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/icons/java.png b/peripheral/libupm/docs/icons/java.png
deleted file mode 100644
index ab4f32f..0000000
--- a/peripheral/libupm/docs/icons/java.png
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/icons/node.png b/peripheral/libupm/docs/icons/node.png
deleted file mode 100644
index f091468..0000000
--- a/peripheral/libupm/docs/icons/node.png
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/icons/python.png b/peripheral/libupm/docs/icons/python.png
deleted file mode 100644
index 3624457..0000000
--- a/peripheral/libupm/docs/icons/python.png
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/icons/wyliodrin.png b/peripheral/libupm/docs/icons/wyliodrin.png
deleted file mode 100644
index 8112749..0000000
--- a/peripheral/libupm/docs/icons/wyliodrin.png
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/icons/xdk.png b/peripheral/libupm/docs/icons/xdk.png
deleted file mode 100644
index 0ec3cd7..0000000
--- a/peripheral/libupm/docs/icons/xdk.png
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/LICENSE_CC_3_0.txt b/peripheral/libupm/docs/images/LICENSE_CC_3_0.txt
deleted file mode 100644
index a71ea79..0000000
--- a/peripheral/libupm/docs/images/LICENSE_CC_3_0.txt
+++ /dev/null
@@ -1,361 +0,0 @@
-Creative Commons Legal Code
-
-Attribution-NonCommercial-ShareAlike 3.0 Unported
-
- CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
- LEGAL SERVICES. DISTRIBUTION OF THIS LICENSE DOES NOT CREATE AN
- ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
- INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
- REGARDING THE INFORMATION PROVIDED, AND DISCLAIMS LIABILITY FOR
- DAMAGES RESULTING FROM ITS USE.
-
-License
-
-THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE
-COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS PROTECTED BY
-COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS
-AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED.
-
-BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE
-TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS LICENSE MAY
-BE CONSIDERED TO BE A CONTRACT, THE LICENSOR GRANTS YOU THE RIGHTS
-CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND
-CONDITIONS.
-
-1. Definitions
-
- a. "Adaptation" means a work based upon the Work, or upon the Work and
- other pre-existing works, such as a translation, adaptation,
- derivative work, arrangement of music or other alterations of a
- literary or artistic work, or phonogram or performance and includes
- cinematographic adaptations or any other form in which the Work may be
- recast, transformed, or adapted including in any form recognizably
- derived from the original, except that a work that constitutes a
- Collection will not be considered an Adaptation for the purpose of
- this License. For the avoidance of doubt, where the Work is a musical
- work, performance or phonogram, the synchronization of the Work in
- timed-relation with a moving image ("synching") will be considered an
- Adaptation for the purpose of this License.
- b. "Collection" means a collection of literary or artistic works, such as
- encyclopedias and anthologies, or performances, phonograms or
- broadcasts, or other works or subject matter other than works listed
- in Section 1(g) below, which, by reason of the selection and
- arrangement of their contents, constitute intellectual creations, in
- which the Work is included in its entirety in unmodified form along
- with one or more other contributions, each constituting separate and
- independent works in themselves, which together are assembled into a
- collective whole. A work that constitutes a Collection will not be
- considered an Adaptation (as defined above) for the purposes of this
- License.
- c. "Distribute" means to make available to the public the original and
- copies of the Work or Adaptation, as appropriate, through sale or
- other transfer of ownership.
- d. "License Elements" means the following high-level license attributes
- as selected by Licensor and indicated in the title of this License:
- Attribution, Noncommercial, ShareAlike.
- e. "Licensor" means the individual, individuals, entity or entities that
- offer(s) the Work under the terms of this License.
- f. "Original Author" means, in the case of a literary or artistic work,
- the individual, individuals, entity or entities who created the Work
- or if no individual or entity can be identified, the publisher; and in
- addition (i) in the case of a performance the actors, singers,
- musicians, dancers, and other persons who act, sing, deliver, declaim,
- play in, interpret or otherwise perform literary or artistic works or
- expressions of folklore; (ii) in the case of a phonogram the producer
- being the person or legal entity who first fixes the sounds of a
- performance or other sounds; and, (iii) in the case of broadcasts, the
- organization that transmits the broadcast.
- g. "Work" means the literary and/or artistic work offered under the terms
- of this License including without limitation any production in the
- literary, scientific and artistic domain, whatever may be the mode or
- form of its expression including digital form, such as a book,
- pamphlet and other writing; a lecture, address, sermon or other work
- of the same nature; a dramatic or dramatico-musical work; a
- choreographic work or entertainment in dumb show; a musical
- composition with or without words; a cinematographic work to which are
- assimilated works expressed by a process analogous to cinematography;
- a work of drawing, painting, architecture, sculpture, engraving or
- lithography; a photographic work to which are assimilated works
- expressed by a process analogous to photography; a work of applied
- art; an illustration, map, plan, sketch or three-dimensional work
- relative to geography, topography, architecture or science; a
- performance; a broadcast; a phonogram; a compilation of data to the
- extent it is protected as a copyrightable work; or a work performed by
- a variety or circus performer to the extent it is not otherwise
- considered a literary or artistic work.
- h. "You" means an individual or entity exercising rights under this
- License who has not previously violated the terms of this License with
- respect to the Work, or who has received express permission from the
- Licensor to exercise rights under this License despite a previous
- violation.
- i. "Publicly Perform" means to perform public recitations of the Work and
- to communicate to the public those public recitations, by any means or
- process, including by wire or wireless means or public digital
- performances; to make available to the public Works in such a way that
- members of the public may access these Works from a place and at a
- place individually chosen by them; to perform the Work to the public
- by any means or process and the communication to the public of the
- performances of the Work, including by public digital performance; to
- broadcast and rebroadcast the Work by any means including signs,
- sounds or images.
- j. "Reproduce" means to make copies of the Work by any means including
- without limitation by sound or visual recordings and the right of
- fixation and reproducing fixations of the Work, including storage of a
- protected performance or phonogram in digital form or other electronic
- medium.
-
-2. Fair Dealing Rights. Nothing in this License is intended to reduce,
-limit, or restrict any uses free from copyright or rights arising from
-limitations or exceptions that are provided for in connection with the
-copyright protection under copyright law or other applicable laws.
-
-3. License Grant. Subject to the terms and conditions of this License,
-Licensor hereby grants You a worldwide, royalty-free, non-exclusive,
-perpetual (for the duration of the applicable copyright) license to
-exercise the rights in the Work as stated below:
-
- a. to Reproduce the Work, to incorporate the Work into one or more
- Collections, and to Reproduce the Work as incorporated in the
- Collections;
- b. to create and Reproduce Adaptations provided that any such Adaptation,
- including any translation in any medium, takes reasonable steps to
- clearly label, demarcate or otherwise identify that changes were made
- to the original Work. For example, a translation could be marked "The
- original work was translated from English to Spanish," or a
- modification could indicate "The original work has been modified.";
- c. to Distribute and Publicly Perform the Work including as incorporated
- in Collections; and,
- d. to Distribute and Publicly Perform Adaptations.
-
-The above rights may be exercised in all media and formats whether now
-known or hereafter devised. The above rights include the right to make
-such modifications as are technically necessary to exercise the rights in
-other media and formats. Subject to Section 8(f), all rights not expressly
-granted by Licensor are hereby reserved, including but not limited to the
-rights described in Section 4(e).
-
-4. Restrictions. The license granted in Section 3 above is expressly made
-subject to and limited by the following restrictions:
-
- a. You may Distribute or Publicly Perform the Work only under the terms
- of this License. You must include a copy of, or the Uniform Resource
- Identifier (URI) for, this License with every copy of the Work You
- Distribute or Publicly Perform. You may not offer or impose any terms
- on the Work that restrict the terms of this License or the ability of
- the recipient of the Work to exercise the rights granted to that
- recipient under the terms of the License. You may not sublicense the
- Work. You must keep intact all notices that refer to this License and
- to the disclaimer of warranties with every copy of the Work You
- Distribute or Publicly Perform. When You Distribute or Publicly
- Perform the Work, You may not impose any effective technological
- measures on the Work that restrict the ability of a recipient of the
- Work from You to exercise the rights granted to that recipient under
- the terms of the License. This Section 4(a) applies to the Work as
- incorporated in a Collection, but this does not require the Collection
- apart from the Work itself to be made subject to the terms of this
- License. If You create a Collection, upon notice from any Licensor You
- must, to the extent practicable, remove from the Collection any credit
- as required by Section 4(d), as requested. If You create an
- Adaptation, upon notice from any Licensor You must, to the extent
- practicable, remove from the Adaptation any credit as required by
- Section 4(d), as requested.
- b. You may Distribute or Publicly Perform an Adaptation only under: (i)
- the terms of this License; (ii) a later version of this License with
- the same License Elements as this License; (iii) a Creative Commons
- jurisdiction license (either this or a later license version) that
- contains the same License Elements as this License (e.g.,
- Attribution-NonCommercial-ShareAlike 3.0 US) ("Applicable License").
- You must include a copy of, or the URI, for Applicable License with
- every copy of each Adaptation You Distribute or Publicly Perform. You
- may not offer or impose any terms on the Adaptation that restrict the
- terms of the Applicable License or the ability of the recipient of the
- Adaptation to exercise the rights granted to that recipient under the
- terms of the Applicable License. You must keep intact all notices that
- refer to the Applicable License and to the disclaimer of warranties
- with every copy of the Work as included in the Adaptation You
- Distribute or Publicly Perform. When You Distribute or Publicly
- Perform the Adaptation, You may not impose any effective technological
- measures on the Adaptation that restrict the ability of a recipient of
- the Adaptation from You to exercise the rights granted to that
- recipient under the terms of the Applicable License. This Section 4(b)
- applies to the Adaptation as incorporated in a Collection, but this
- does not require the Collection apart from the Adaptation itself to be
- made subject to the terms of the Applicable License.
- c. You may not exercise any of the rights granted to You in Section 3
- above in any manner that is primarily intended for or directed toward
- commercial advantage or private monetary compensation. The exchange of
- the Work for other copyrighted works by means of digital file-sharing
- or otherwise shall not be considered to be intended for or directed
- toward commercial advantage or private monetary compensation, provided
- there is no payment of any monetary compensation in con-nection with
- the exchange of copyrighted works.
- d. If You Distribute, or Publicly Perform the Work or any Adaptations or
- Collections, You must, unless a request has been made pursuant to
- Section 4(a), keep intact all copyright notices for the Work and
- provide, reasonable to the medium or means You are utilizing: (i) the
- name of the Original Author (or pseudonym, if applicable) if supplied,
- and/or if the Original Author and/or Licensor designate another party
- or parties (e.g., a sponsor institute, publishing entity, journal) for
- attribution ("Attribution Parties") in Licensor's copyright notice,
- terms of service or by other reasonable means, the name of such party
- or parties; (ii) the title of the Work if supplied; (iii) to the
- extent reasonably practicable, the URI, if any, that Licensor
- specifies to be associated with the Work, unless such URI does not
- refer to the copyright notice or licensing information for the Work;
- and, (iv) consistent with Section 3(b), in the case of an Adaptation,
- a credit identifying the use of the Work in the Adaptation (e.g.,
- "French translation of the Work by Original Author," or "Screenplay
- based on original Work by Original Author"). The credit required by
- this Section 4(d) may be implemented in any reasonable manner;
- provided, however, that in the case of a Adaptation or Collection, at
- a minimum such credit will appear, if a credit for all contributing
- authors of the Adaptation or Collection appears, then as part of these
- credits and in a manner at least as prominent as the credits for the
- other contributing authors. For the avoidance of doubt, You may only
- use the credit required by this Section for the purpose of attribution
- in the manner set out above and, by exercising Your rights under this
- License, You may not implicitly or explicitly assert or imply any
- connection with, sponsorship or endorsement by the Original Author,
- Licensor and/or Attribution Parties, as appropriate, of You or Your
- use of the Work, without the separate, express prior written
- permission of the Original Author, Licensor and/or Attribution
- Parties.
- e. For the avoidance of doubt:
-
- i. Non-waivable Compulsory License Schemes. In those jurisdictions in
- which the right to collect royalties through any statutory or
- compulsory licensing scheme cannot be waived, the Licensor
- reserves the exclusive right to collect such royalties for any
- exercise by You of the rights granted under this License;
- ii. Waivable Compulsory License Schemes. In those jurisdictions in
- which the right to collect royalties through any statutory or
- compulsory licensing scheme can be waived, the Licensor reserves
- the exclusive right to collect such royalties for any exercise by
- You of the rights granted under this License if Your exercise of
- such rights is for a purpose or use which is otherwise than
- noncommercial as permitted under Section 4(c) and otherwise waives
- the right to collect royalties through any statutory or compulsory
- licensing scheme; and,
- iii. Voluntary License Schemes. The Licensor reserves the right to
- collect royalties, whether individually or, in the event that the
- Licensor is a member of a collecting society that administers
- voluntary licensing schemes, via that society, from any exercise
- by You of the rights granted under this License that is for a
- purpose or use which is otherwise than noncommercial as permitted
- under Section 4(c).
- f. Except as otherwise agreed in writing by the Licensor or as may be
- otherwise permitted by applicable law, if You Reproduce, Distribute or
- Publicly Perform the Work either by itself or as part of any
- Adaptations or Collections, You must not distort, mutilate, modify or
- take other derogatory action in relation to the Work which would be
- prejudicial to the Original Author's honor or reputation. Licensor
- agrees that in those jurisdictions (e.g. Japan), in which any exercise
- of the right granted in Section 3(b) of this License (the right to
- make Adaptations) would be deemed to be a distortion, mutilation,
- modification or other derogatory action prejudicial to the Original
- Author's honor and reputation, the Licensor will waive or not assert,
- as appropriate, this Section, to the fullest extent permitted by the
- applicable national law, to enable You to reasonably exercise Your
- right under Section 3(b) of this License (right to make Adaptations)
- but not otherwise.
-
-5. Representations, Warranties and Disclaimer
-
-UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN WRITING AND TO THE
-FULLEST EXTENT PERMITTED BY APPLICABLE LAW, LICENSOR OFFERS THE WORK AS-IS
-AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE
-WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, INCLUDING, WITHOUT
-LIMITATION, WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
-PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF LATENT OR OTHER DEFECTS,
-ACCURACY, OR THE PRESENCE OF ABSENCE OF ERRORS, WHETHER OR NOT
-DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED
-WARRANTIES, SO THIS EXCLUSION MAY NOT APPLY TO YOU.
-
-6. Limitation on Liability. EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE
-LAW, IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR
-ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES
-ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR HAS
-BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-
-7. Termination
-
- a. This License and the rights granted hereunder will terminate
- automatically upon any breach by You of the terms of this License.
- Individuals or entities who have received Adaptations or Collections
- from You under this License, however, will not have their licenses
- terminated provided such individuals or entities remain in full
- compliance with those licenses. Sections 1, 2, 5, 6, 7, and 8 will
- survive any termination of this License.
- b. Subject to the above terms and conditions, the license granted here is
- perpetual (for the duration of the applicable copyright in the Work).
- Notwithstanding the above, Licensor reserves the right to release the
- Work under different license terms or to stop distributing the Work at
- any time; provided, however that any such election will not serve to
- withdraw this License (or any other license that has been, or is
- required to be, granted under the terms of this License), and this
- License will continue in full force and effect unless terminated as
- stated above.
-
-8. Miscellaneous
-
- a. Each time You Distribute or Publicly Perform the Work or a Collection,
- the Licensor offers to the recipient a license to the Work on the same
- terms and conditions as the license granted to You under this License.
- b. Each time You Distribute or Publicly Perform an Adaptation, Licensor
- offers to the recipient a license to the original Work on the same
- terms and conditions as the license granted to You under this License.
- c. If any provision of this License is invalid or unenforceable under
- applicable law, it shall not affect the validity or enforceability of
- the remainder of the terms of this License, and without further action
- by the parties to this agreement, such provision shall be reformed to
- the minimum extent necessary to make such provision valid and
- enforceable.
- d. No term or provision of this License shall be deemed waived and no
- breach consented to unless such waiver or consent shall be in writing
- and signed by the party to be charged with such waiver or consent.
- e. This License constitutes the entire agreement between the parties with
- respect to the Work licensed here. There are no understandings,
- agreements or representations with respect to the Work not specified
- here. Licensor shall not be bound by any additional provisions that
- may appear in any communication from You. This License may not be
- modified without the mutual written agreement of the Licensor and You.
- f. The rights granted under, and the subject matter referenced, in this
- License were drafted utilizing the terminology of the Berne Convention
- for the Protection of Literary and Artistic Works (as amended on
- September 28, 1979), the Rome Convention of 1961, the WIPO Copyright
- Treaty of 1996, the WIPO Performances and Phonograms Treaty of 1996
- and the Universal Copyright Convention (as revised on July 24, 1971).
- These rights and subject matter take effect in the relevant
- jurisdiction in which the License terms are sought to be enforced
- according to the corresponding provisions of the implementation of
- those treaty provisions in the applicable national law. If the
- standard suite of rights granted under applicable copyright law
- includes additional rights not granted under this License, such
- additional rights are deemed to be included in the License; this
- License is not intended to restrict the license of any rights under
- applicable law.
-
-
-Creative Commons Notice
-
- Creative Commons is not a party to this License, and makes no warranty
- whatsoever in connection with the Work. Creative Commons will not be
- liable to You or any party on any legal theory for any damages
- whatsoever, including without limitation any general, special,
- incidental or consequential damages arising in connection to this
- license. Notwithstanding the foregoing two (2) sentences, if Creative
- Commons has expressly identified itself as the Licensor hereunder, it
- shall have all rights and obligations of Licensor.
-
- Except for the limited purpose of indicating to the public that the
- Work is licensed under the CCPL, Creative Commons does not authorize
- the use by either party of the trademark "Creative Commons" or any
- related trademark or logo of Creative Commons without the prior
- written consent of Creative Commons. Any permitted use will be in
- compliance with Creative Commons' then-current trademark usage
- guidelines, as may be published on its website or otherwise made
- available upon request from time to time. For the avoidance of doubt,
- this trademark restriction does not form part of this License.
-
- Creative Commons may be contacted at https://creativecommons.org/.
-
diff --git a/peripheral/libupm/docs/images/a110x.jpg b/peripheral/libupm/docs/images/a110x.jpg
deleted file mode 100755
index 6b9492c..0000000
--- a/peripheral/libupm/docs/images/a110x.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/ad8232.jpg b/peripheral/libupm/docs/images/ad8232.jpg
deleted file mode 100755
index 3664e8b..0000000
--- a/peripheral/libupm/docs/images/ad8232.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/adafruitms1438.jpg b/peripheral/libupm/docs/images/adafruitms1438.jpg
deleted file mode 100755
index 85ee50f..0000000
--- a/peripheral/libupm/docs/images/adafruitms1438.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/adafruitss.jpg b/peripheral/libupm/docs/images/adafruitss.jpg
deleted file mode 100755
index a2fa5d6..0000000
--- a/peripheral/libupm/docs/images/adafruitss.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/adc121c021.jpg b/peripheral/libupm/docs/images/adc121c021.jpg
deleted file mode 100755
index f38e38e..0000000
--- a/peripheral/libupm/docs/images/adc121c021.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/adxl335.jpg b/peripheral/libupm/docs/images/adxl335.jpg
deleted file mode 100644
index f49f495..0000000
--- a/peripheral/libupm/docs/images/adxl335.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/adxl345.jpeg b/peripheral/libupm/docs/images/adxl345.jpeg
deleted file mode 100644
index 66262a8..0000000
--- a/peripheral/libupm/docs/images/adxl345.jpeg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/am2315.jpeg b/peripheral/libupm/docs/images/am2315.jpeg
deleted file mode 100644
index f13efe8..0000000
--- a/peripheral/libupm/docs/images/am2315.jpeg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/apds9002.jpg b/peripheral/libupm/docs/images/apds9002.jpg
deleted file mode 100755
index 8c4dd7e..0000000
--- a/peripheral/libupm/docs/images/apds9002.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/at42qt1070.jpg b/peripheral/libupm/docs/images/at42qt1070.jpg
deleted file mode 100755
index 9b134b1..0000000
--- a/peripheral/libupm/docs/images/at42qt1070.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/biss0001.jpg b/peripheral/libupm/docs/images/biss0001.jpg
deleted file mode 100755
index ee78a80..0000000
--- a/peripheral/libupm/docs/images/biss0001.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/bmp085.jpeg b/peripheral/libupm/docs/images/bmp085.jpeg
deleted file mode 100644
index d0c877b..0000000
--- a/peripheral/libupm/docs/images/bmp085.jpeg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/buzzer.jpg b/peripheral/libupm/docs/images/buzzer.jpg
deleted file mode 100755
index 1d54529..0000000
--- a/peripheral/libupm/docs/images/buzzer.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/cjq4435.jpg b/peripheral/libupm/docs/images/cjq4435.jpg
deleted file mode 100755
index 02637b7..0000000
--- a/peripheral/libupm/docs/images/cjq4435.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/ds1307.jpg b/peripheral/libupm/docs/images/ds1307.jpg
deleted file mode 100755
index 54a569d..0000000
--- a/peripheral/libupm/docs/images/ds1307.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/ecs1030.jpg b/peripheral/libupm/docs/images/ecs1030.jpg
deleted file mode 100755
index 487dda0..0000000
--- a/peripheral/libupm/docs/images/ecs1030.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/enc03r.jpg b/peripheral/libupm/docs/images/enc03r.jpg
deleted file mode 100755
index 659807f..0000000
--- a/peripheral/libupm/docs/images/enc03r.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/es08a.jpg b/peripheral/libupm/docs/images/es08a.jpg
deleted file mode 100644
index 9fd7b2d..0000000
--- a/peripheral/libupm/docs/images/es08a.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/flex.jpg b/peripheral/libupm/docs/images/flex.jpg
deleted file mode 100755
index 3f0f315..0000000
--- a/peripheral/libupm/docs/images/flex.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/gp2y0a.jpg b/peripheral/libupm/docs/images/gp2y0a.jpg
deleted file mode 100755
index 1347ef5..0000000
--- a/peripheral/libupm/docs/images/gp2y0a.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/grovebutton.jpg b/peripheral/libupm/docs/images/grovebutton.jpg
deleted file mode 100755
index ac2aaa0..0000000
--- a/peripheral/libupm/docs/images/grovebutton.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/grovecircularled.jpg b/peripheral/libupm/docs/images/grovecircularled.jpg
deleted file mode 100755
index 51bca59..0000000
--- a/peripheral/libupm/docs/images/grovecircularled.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/grovecollision.jpg b/peripheral/libupm/docs/images/grovecollision.jpg
deleted file mode 100755
index 8476e1d..0000000
--- a/peripheral/libupm/docs/images/grovecollision.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/groveehr.jpg b/peripheral/libupm/docs/images/groveehr.jpg
deleted file mode 100755
index fd18394..0000000
--- a/peripheral/libupm/docs/images/groveehr.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/groveeldriver.jpg b/peripheral/libupm/docs/images/groveeldriver.jpg
deleted file mode 100755
index cb106d8..0000000
--- a/peripheral/libupm/docs/images/groveeldriver.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/groveelectromagnet.jpg b/peripheral/libupm/docs/images/groveelectromagnet.jpg
deleted file mode 100755
index 0da5d1d..0000000
--- a/peripheral/libupm/docs/images/groveelectromagnet.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/groveemg.jpg b/peripheral/libupm/docs/images/groveemg.jpg
deleted file mode 100755
index c5e2885..0000000
--- a/peripheral/libupm/docs/images/groveemg.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/grovegsr.jpg b/peripheral/libupm/docs/images/grovegsr.jpg
deleted file mode 100755
index ea398ce..0000000
--- a/peripheral/libupm/docs/images/grovegsr.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/groveled.jpg b/peripheral/libupm/docs/images/groveled.jpg
deleted file mode 100755
index 52f2d7e..0000000
--- a/peripheral/libupm/docs/images/groveled.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/grovelight.jpg b/peripheral/libupm/docs/images/grovelight.jpg
deleted file mode 100755
index 4bad3f7..0000000
--- a/peripheral/libupm/docs/images/grovelight.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/grovelinefinder.jpg b/peripheral/libupm/docs/images/grovelinefinder.jpg
deleted file mode 100755
index 48f0240..0000000
--- a/peripheral/libupm/docs/images/grovelinefinder.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/groveloudness.jpg b/peripheral/libupm/docs/images/groveloudness.jpg
deleted file mode 100755
index e987472..0000000
--- a/peripheral/libupm/docs/images/groveloudness.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/grovemd.jpg b/peripheral/libupm/docs/images/grovemd.jpg
deleted file mode 100755
index f9da824..0000000
--- a/peripheral/libupm/docs/images/grovemd.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/grovemoisture.jpg b/peripheral/libupm/docs/images/grovemoisture.jpg
deleted file mode 100755
index 167d7ce..0000000
--- a/peripheral/libupm/docs/images/grovemoisture.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/groveo2.jpg b/peripheral/libupm/docs/images/groveo2.jpg
deleted file mode 100755
index 806e40d..0000000
--- a/peripheral/libupm/docs/images/groveo2.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/groverelay.jpg b/peripheral/libupm/docs/images/groverelay.jpg
deleted file mode 100755
index fb0b0e1..0000000
--- a/peripheral/libupm/docs/images/groverelay.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/grovergblcd.jpg b/peripheral/libupm/docs/images/grovergblcd.jpg
deleted file mode 100644
index cc7c59f..0000000
--- a/peripheral/libupm/docs/images/grovergblcd.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/groverotary.jpeg b/peripheral/libupm/docs/images/groverotary.jpeg
deleted file mode 100644
index ef6d747..0000000
--- a/peripheral/libupm/docs/images/groverotary.jpeg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/grovescam.jpg b/peripheral/libupm/docs/images/grovescam.jpg
deleted file mode 100755
index a69e1fd..0000000
--- a/peripheral/libupm/docs/images/grovescam.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/groveslide.jpeg b/peripheral/libupm/docs/images/groveslide.jpeg
deleted file mode 100644
index 70fb82d..0000000
--- a/peripheral/libupm/docs/images/groveslide.jpeg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/grovespeaker.jpg b/peripheral/libupm/docs/images/grovespeaker.jpg
deleted file mode 100755
index f4e901d..0000000
--- a/peripheral/libupm/docs/images/grovespeaker.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/grovetemp.jpg b/peripheral/libupm/docs/images/grovetemp.jpg
deleted file mode 100755
index 43fd72c..0000000
--- a/peripheral/libupm/docs/images/grovetemp.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/grovevdiv.jpg b/peripheral/libupm/docs/images/grovevdiv.jpg
deleted file mode 100755
index 1bd9c14..0000000
--- a/peripheral/libupm/docs/images/grovevdiv.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/grovewater.jpg b/peripheral/libupm/docs/images/grovewater.jpg
deleted file mode 100755
index 62b00b2..0000000
--- a/peripheral/libupm/docs/images/grovewater.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/grovewfs.jpg b/peripheral/libupm/docs/images/grovewfs.jpg
deleted file mode 100755
index 557830b..0000000
--- a/peripheral/libupm/docs/images/grovewfs.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/guvas12d.jpg b/peripheral/libupm/docs/images/guvas12d.jpg
deleted file mode 100755
index 91f4a3b..0000000
--- a/peripheral/libupm/docs/images/guvas12d.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/h3lis331dl.jpg b/peripheral/libupm/docs/images/h3lis331dl.jpg
deleted file mode 100644
index 24234a3..0000000
--- a/peripheral/libupm/docs/images/h3lis331dl.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/hm11.jpg b/peripheral/libupm/docs/images/hm11.jpg
deleted file mode 100755
index 92382bd..0000000
--- a/peripheral/libupm/docs/images/hm11.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/hmc5883l.jpeg b/peripheral/libupm/docs/images/hmc5883l.jpeg
deleted file mode 100644
index b6a3f3a..0000000
--- a/peripheral/libupm/docs/images/hmc5883l.jpeg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/hmtrp.jpg b/peripheral/libupm/docs/images/hmtrp.jpg
deleted file mode 100644
index 21f2910..0000000
--- a/peripheral/libupm/docs/images/hmtrp.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/hp20x.jpg b/peripheral/libupm/docs/images/hp20x.jpg
deleted file mode 100755
index 419a48c..0000000
--- a/peripheral/libupm/docs/images/hp20x.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/ht9170.jpg b/peripheral/libupm/docs/images/ht9170.jpg
deleted file mode 100644
index 61a6e9a..0000000
--- a/peripheral/libupm/docs/images/ht9170.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/htu21d.jpeg b/peripheral/libupm/docs/images/htu21d.jpeg
deleted file mode 100644
index a76649d..0000000
--- a/peripheral/libupm/docs/images/htu21d.jpeg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/hx711.jpeg b/peripheral/libupm/docs/images/hx711.jpeg
deleted file mode 100644
index feff784..0000000
--- a/peripheral/libupm/docs/images/hx711.jpeg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/ina132.jpg b/peripheral/libupm/docs/images/ina132.jpg
deleted file mode 100755
index b704357..0000000
--- a/peripheral/libupm/docs/images/ina132.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/isd1820.jpg b/peripheral/libupm/docs/images/isd1820.jpg
deleted file mode 100755
index a7aabb6..0000000
--- a/peripheral/libupm/docs/images/isd1820.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/itg3200.jpeg b/peripheral/libupm/docs/images/itg3200.jpeg
deleted file mode 100644
index ed5a435..0000000
--- a/peripheral/libupm/docs/images/itg3200.jpeg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/joystick12.jpg b/peripheral/libupm/docs/images/joystick12.jpg
deleted file mode 100755
index 8abd377..0000000
--- a/peripheral/libupm/docs/images/joystick12.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/l298.jpg b/peripheral/libupm/docs/images/l298.jpg
deleted file mode 100755
index 2696fca..0000000
--- a/peripheral/libupm/docs/images/l298.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/lcm1602.jpeg b/peripheral/libupm/docs/images/lcm1602.jpeg
deleted file mode 100644
index 1f58bed..0000000
--- a/peripheral/libupm/docs/images/lcm1602.jpeg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/ldt0028.jpg b/peripheral/libupm/docs/images/ldt0028.jpg
deleted file mode 100755
index 67afc38..0000000
--- a/peripheral/libupm/docs/images/ldt0028.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/lolshield.jpg b/peripheral/libupm/docs/images/lolshield.jpg
deleted file mode 100644
index f990242..0000000
--- a/peripheral/libupm/docs/images/lolshield.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/lpd8806.jpg b/peripheral/libupm/docs/images/lpd8806.jpg
deleted file mode 100755
index 2318c8e..0000000
--- a/peripheral/libupm/docs/images/lpd8806.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/lsm303.jpeg b/peripheral/libupm/docs/images/lsm303.jpeg
deleted file mode 100644
index fc7e60c..0000000
--- a/peripheral/libupm/docs/images/lsm303.jpeg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/m24lr64e.jpg b/peripheral/libupm/docs/images/m24lr64e.jpg
deleted file mode 100755
index b8b7fb2..0000000
--- a/peripheral/libupm/docs/images/m24lr64e.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/max31855.jpg b/peripheral/libupm/docs/images/max31855.jpg
deleted file mode 100755
index e763f44..0000000
--- a/peripheral/libupm/docs/images/max31855.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/maxsonarez.jpg b/peripheral/libupm/docs/images/maxsonarez.jpg
deleted file mode 100755
index f06c7b9..0000000
--- a/peripheral/libupm/docs/images/maxsonarez.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/mhz16.jpg b/peripheral/libupm/docs/images/mhz16.jpg
deleted file mode 100755
index 3a16a8f..0000000
--- a/peripheral/libupm/docs/images/mhz16.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/mic.jpg b/peripheral/libupm/docs/images/mic.jpg
deleted file mode 100644
index 51dd9c7..0000000
--- a/peripheral/libupm/docs/images/mic.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/micsv89.jpg b/peripheral/libupm/docs/images/micsv89.jpg
deleted file mode 100644
index 1ea6fdc..0000000
--- a/peripheral/libupm/docs/images/micsv89.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/mlx90614.jpg b/peripheral/libupm/docs/images/mlx90614.jpg
deleted file mode 100755
index beacbbd..0000000
--- a/peripheral/libupm/docs/images/mlx90614.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/mma7455.jpg b/peripheral/libupm/docs/images/mma7455.jpg
deleted file mode 100755
index f18aba4..0000000
--- a/peripheral/libupm/docs/images/mma7455.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/mma7660.jpg b/peripheral/libupm/docs/images/mma7660.jpg
deleted file mode 100755
index b81d697..0000000
--- a/peripheral/libupm/docs/images/mma7660.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/mpl3115a2.jpg b/peripheral/libupm/docs/images/mpl3115a2.jpg
deleted file mode 100644
index 735baf1..0000000
--- a/peripheral/libupm/docs/images/mpl3115a2.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/mpr121.jpg b/peripheral/libupm/docs/images/mpr121.jpg
deleted file mode 100644
index 5d14a30..0000000
--- a/peripheral/libupm/docs/images/mpr121.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/mpu9150.jpg b/peripheral/libupm/docs/images/mpu9150.jpg
deleted file mode 100644
index 4897e8e..0000000
--- a/peripheral/libupm/docs/images/mpu9150.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/mq2-5.jpeg b/peripheral/libupm/docs/images/mq2-5.jpeg
deleted file mode 100644
index 40d3b46..0000000
--- a/peripheral/libupm/docs/images/mq2-5.jpeg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/mq3-9.jpeg b/peripheral/libupm/docs/images/mq3-9.jpeg
deleted file mode 100644
index a96403f..0000000
--- a/peripheral/libupm/docs/images/mq3-9.jpeg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/mq303a.jpg b/peripheral/libupm/docs/images/mq303a.jpg
deleted file mode 100644
index 18b065d..0000000
--- a/peripheral/libupm/docs/images/mq303a.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/my9221.jpg b/peripheral/libupm/docs/images/my9221.jpg
deleted file mode 100644
index 008e024..0000000
--- a/peripheral/libupm/docs/images/my9221.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/nrf24l01.jpg b/peripheral/libupm/docs/images/nrf24l01.jpg
deleted file mode 100644
index 0066e7d..0000000
--- a/peripheral/libupm/docs/images/nrf24l01.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/nrf8001.jpg b/peripheral/libupm/docs/images/nrf8001.jpg
deleted file mode 100644
index ee6f5e5..0000000
--- a/peripheral/libupm/docs/images/nrf8001.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/nunchuck.jpg b/peripheral/libupm/docs/images/nunchuck.jpg
deleted file mode 100755
index 8e4fb96..0000000
--- a/peripheral/libupm/docs/images/nunchuck.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/otp538u.jpg b/peripheral/libupm/docs/images/otp538u.jpg
deleted file mode 100755
index b56b0e9..0000000
--- a/peripheral/libupm/docs/images/otp538u.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/pca9685.jpg b/peripheral/libupm/docs/images/pca9685.jpg
deleted file mode 100644
index 1a41567..0000000
--- a/peripheral/libupm/docs/images/pca9685.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/ppd42ns.jpg b/peripheral/libupm/docs/images/ppd42ns.jpg
deleted file mode 100644
index 2631bb1..0000000
--- a/peripheral/libupm/docs/images/ppd42ns.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/pulsensor.jpg b/peripheral/libupm/docs/images/pulsensor.jpg
deleted file mode 100644
index e7b2f0c..0000000
--- a/peripheral/libupm/docs/images/pulsensor.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/rfr359f.jpg b/peripheral/libupm/docs/images/rfr359f.jpg
deleted file mode 100644
index 5362581..0000000
--- a/peripheral/libupm/docs/images/rfr359f.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/rgbringcoder.jpg b/peripheral/libupm/docs/images/rgbringcoder.jpg
deleted file mode 100755
index fe081a0..0000000
--- a/peripheral/libupm/docs/images/rgbringcoder.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/rotaryencoder.jpg b/peripheral/libupm/docs/images/rotaryencoder.jpg
deleted file mode 100644
index 7ea96b0..0000000
--- a/peripheral/libupm/docs/images/rotaryencoder.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/rpr220.jpg b/peripheral/libupm/docs/images/rpr220.jpg
deleted file mode 100644
index ef5d944..0000000
--- a/peripheral/libupm/docs/images/rpr220.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/si114x.jpg b/peripheral/libupm/docs/images/si114x.jpg
deleted file mode 100755
index ed5e4df..0000000
--- a/peripheral/libupm/docs/images/si114x.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/sm130.jpg b/peripheral/libupm/docs/images/sm130.jpg
deleted file mode 100755
index 0e53e62..0000000
--- a/peripheral/libupm/docs/images/sm130.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/ssd1306.jpeg b/peripheral/libupm/docs/images/ssd1306.jpeg
deleted file mode 100644
index e24fda4..0000000
--- a/peripheral/libupm/docs/images/ssd1306.jpeg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/ssd1308.jpeg b/peripheral/libupm/docs/images/ssd1308.jpeg
deleted file mode 100644
index d297475..0000000
--- a/peripheral/libupm/docs/images/ssd1308.jpeg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/ssd1327.jpeg b/peripheral/libupm/docs/images/ssd1327.jpeg
deleted file mode 100644
index e6a339a..0000000
--- a/peripheral/libupm/docs/images/ssd1327.jpeg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/st7735.jpg b/peripheral/libupm/docs/images/st7735.jpg
deleted file mode 100755
index 035c003..0000000
--- a/peripheral/libupm/docs/images/st7735.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/stepmotor.jpg b/peripheral/libupm/docs/images/stepmotor.jpg
deleted file mode 100755
index 25dbe1d..0000000
--- a/peripheral/libupm/docs/images/stepmotor.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/sx6119.jpg b/peripheral/libupm/docs/images/sx6119.jpg
deleted file mode 100755
index d66f16a..0000000
--- a/peripheral/libupm/docs/images/sx6119.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/ta12200.jpg b/peripheral/libupm/docs/images/ta12200.jpg
deleted file mode 100755
index 77c73b7..0000000
--- a/peripheral/libupm/docs/images/ta12200.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/tcs3414cs.jpg b/peripheral/libupm/docs/images/tcs3414cs.jpg
deleted file mode 100755
index 510d923..0000000
--- a/peripheral/libupm/docs/images/tcs3414cs.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/th02.jpg b/peripheral/libupm/docs/images/th02.jpg
deleted file mode 100755
index 356865f..0000000
--- a/peripheral/libupm/docs/images/th02.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/tm1637.jpeg b/peripheral/libupm/docs/images/tm1637.jpeg
deleted file mode 100644
index f3b4e71..0000000
--- a/peripheral/libupm/docs/images/tm1637.jpeg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/tp401.jpeg b/peripheral/libupm/docs/images/tp401.jpeg
deleted file mode 100644
index 70feb42..0000000
--- a/peripheral/libupm/docs/images/tp401.jpeg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/tsl2561.jpg b/peripheral/libupm/docs/images/tsl2561.jpg
deleted file mode 100644
index 04891f3..0000000
--- a/peripheral/libupm/docs/images/tsl2561.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/ttp223.jpg b/peripheral/libupm/docs/images/ttp223.jpg
deleted file mode 100755
index f062a4b..0000000
--- a/peripheral/libupm/docs/images/ttp223.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/ublox6.jpg b/peripheral/libupm/docs/images/ublox6.jpg
deleted file mode 100755
index 99a2d56..0000000
--- a/peripheral/libupm/docs/images/ublox6.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/uln200xa.jpg b/peripheral/libupm/docs/images/uln200xa.jpg
deleted file mode 100755
index 18351e4..0000000
--- a/peripheral/libupm/docs/images/uln200xa.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/waterlevel.jpg b/peripheral/libupm/docs/images/waterlevel.jpg
deleted file mode 100755
index 1c12593..0000000
--- a/peripheral/libupm/docs/images/waterlevel.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/wt5001.jpg b/peripheral/libupm/docs/images/wt5001.jpg
deleted file mode 100755
index 498ae8a..0000000
--- a/peripheral/libupm/docs/images/wt5001.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/yg1006.jpg b/peripheral/libupm/docs/images/yg1006.jpg
deleted file mode 100755
index 830e1bf..0000000
--- a/peripheral/libupm/docs/images/yg1006.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/images/zfm20.jpg b/peripheral/libupm/docs/images/zfm20.jpg
deleted file mode 100755
index e244cae..0000000
--- a/peripheral/libupm/docs/images/zfm20.jpg
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/docs/knownlimitations.md b/peripheral/libupm/docs/knownlimitations.md
deleted file mode 100644
index a0a8ada..0000000
--- a/peripheral/libupm/docs/knownlimitations.md
+++ /dev/null
@@ -1,83 +0,0 @@
-Known Limitations {#knownlimitations}
-===============
-
-Some sensors do not work seamlessly with a specific board. This means that they
-are either incompatible or work only under specific settings. This is a list of
-such sensors and known workarounds if they exist.
-
-#### Grove Sensors
-
- * **Grove LCD RGB Backlit** (JHD1313M1) requires 5V and should be used with an
- external power supply connected to the board to function properly. Although
- some high powered USB ports might be enough, in most cases you will encounter
- dropped characters, washed out text and/or failed I2C writes while using USB
- power alone.
- * **Grove I2C Touch Sensor** (MPR121) v1.3 is incompatible with the Intel
- Edison using the Arduino board, but will work with the Mini-breakout if
- supplied with at least 4V. Revision v1.2 works well on all Intel boards.
- * **Grove Nunchuck** only works with the Intel Galileo boards and is unusable
- on the Intel Edison boards.
- * **Grove 3-Axis Digital Gyroscope** (ITG-3200) is not compatible with the
- Intel Edison Arduino board but will work with the Mini-breakout.
- * **Grove 3-Axis Digital Accelerometer +/-16g** (ADXL345) only works with the
- Intel Edison Arduino board when powered from the 3.3V line.
- * **Grove 3-Axis Digital Compass** (HMC5883L) reports inaccurate values at 5V
- on the Intel Edison Arduino board and newer revisions might not work at all.
- Use 3.3V or the Mini-breakout.
- * **Grove 96x96 OLED Display** will not work on the Intel Edison with Arduino
- breakout.
- * **Grove 128x64 OLED Display** will not work on the Intel Edison with Arduino
- breakout.
- * **Grove Barometer** (BMP085) has an unstable connection on the Intel Edison
- using the Arduino breakout and may drop read data. The Xadow version of this
- sensor (BMP180) is also dropping data packets occasionally.
- * **Grove 6-Axis Accelerometer & Compass** (LSM303) fails to write to the
- configuration register properly and returns invalid data.
- * **Grove I2C ADC Converter** does not show up on the I2C bus on the Intel
- Edison with the Arduino board.
- * **Grove I2C Motor Driver** is not compatible with the Intel Galileo due to
- the inability to change the I2C bus speed to 100 KHz.
- * **Grove Digital Light Sensor** (TSL2561) may have an unstable connection on
- the Intel Edison using the Arduino breakout that results in missed I2C reads.
- This is usually applicable when the I2C lines are pulled-up to 5V. Works as
- expected with the Mini-breakout.
- * **Grove CO2 Sensor** will return zeroed data and is unusable on the Intel
- Galileo.
- * **Grove BLE** (HM-11) does not return data on the Intel Galileo board due to
- known UART limitation.
- * **Grove Hall Sensor** (A11X) if the base shield is set to 3V on Intel Edison,
- it will trigger continous callbacks when the sensor is not reading anything.
- * **Grove RTC** (DS1307) is not compatible with the Intel Edison Arduino board
- but will work with the Mini-breakout.
-
-#### Adafruit Sensors
-
- * **Adafruit Motor Shield** (1438) is not detected on the I2C bus when
- connected to the Intel Edison with an Arduino breakout.
-
-#### Other Sensors
-
- * **NRF24L01** corrupted data packets are sent to the device due to the Intel
- Edison SPI bus limitation. Sensor works as expected with the Intel Galileo
- boards.
- * **NRF8001** based devices do not initialize properly with provided examples
- on Intel Edison boards also due to SPI bus limitation and data corruption.
- Works on Intel Galileo.
-
-#### General
-
-Some *I2C* sensors add too much capacitance to the SDA line of the Intel Edison
-Arduino breakout board, thus the signal sticks to a logic 1. When this happens,
-other sensors connected to the I2C bus are unusable. While there is no generic
-solution for this limitation, in most cases the sensor works on the Intel
-Edison Mini-breakout. When this board is not an option, the sensor can be
-sometimes replaced with the same model from a different vendor.
-
-The Intel Edison *SPI* bus can corrupt data being sent across when certain
-sensors are connected to it. Based on the sensor, this can affect functionality
-slightly or make the sensor entirely unusable. Unlike the I2C bus limitation,
-different boards are not likely to resolve this. A kernel update on the other
-hand might help alleviate this.
-
-On the Intel Galileo boards, the *UART* bus might drop data if several bytes
-are read at once.
diff --git a/peripheral/libupm/docs/max31855.md b/peripheral/libupm/docs/max31855.md
deleted file mode 100644
index 7405989..0000000
--- a/peripheral/libupm/docs/max31855.md
+++ /dev/null
@@ -1,97 +0,0 @@
-Making a UPM module for MAX31855 {#max31855}
-================================
-
-The Maxim Integrated MAX31855 is a thermocouple amplifier allowing you to read
-from a K type thermocouple. My board comes from the Pmod kit form Maxim
-(MAX31855PMB1) but you can get this from many different sources. The adafruit
-people made arduino code already so we'll use that as a
-[reference](https://github.com/adafruit/Adafruit-MAX31855-library/blob/master/Adafruit_MAX31855.cpp).
-
-### Basics
-
-This is a spi module so we will use the mraa spi functions to build our module.
-First thing to do is to create a tree structure like this in upm/src/max31855:
-
-* max31855.cxx
-* max31855.h
-* jsupm_max31855.i
-* pyupm_max31855.i
-* CMakeLists.txt
-
-And then an example file to use & test our lib with in upm/examples/max31855.cxx.
-
-### Swig
-
-The .i files are used by swig, there is one for each python & javascript. They
-contain essentially the same thing and are very simple. The only thing to
-change between the javascript & node.js one is the argument to %module.
-
-@snippet jsupm_max31855.i Interesting
-
-The %include parameter defines which functions will be available to the
-node/python module created, Whilst the headers inside %{} will be explicitly
-required during compilation. Typically only the top level header is required in
-either of those args. The upm.i is just a shortcut to include some commonly
-used swig wrappers for UPM sensors, it's not obligatory but recommended.
-
-### API
-
-Then we create the header (max31855.h) , a very simple header in our case we
-will have only a very basic api. We provide a getTemp() function which will
-return the same type as in the arduino library, a double.
-
-@snippet max31855.h Interesting
-
-Note that the header contains both the io that we will use, the gpio is in this
-case used as the chip select pin.
-
-### Implementing our API
-
-In the adafruit library the read function (our chip is a 3pin SPI so only read
-is possible), the spiread32() does all the work. It starts by setting up the io
-so we will do the same in our constructor.
-
-Note unlike on Arduino, we'll just set a 2Mhz clock and let the chip do the
-work.
-
-@snippet src/max31855/max31855.cxx Constructor
-
-Then we also need to implement a nice cleanup in our destructor.
-
-@snippet src/max31855/max31855.cxx Destructor
-
-Then to read data, we will use spi_write_buf which will allow us to write a
-whole uint32_t in order to get one back, which is what the arduino code does in
-spiread32. Obviously we set our chip select to low first. Here is the start of
-the implementation of MAX31855::getTemp()
-
-@snippet src/max31855/max31855.cxx spi
-
-Then using the arduino code as reference we simply reconstruct form the 4
-uint8_t values a 32bit int value and select only the valuable parts of
-information from that. The MAX31855 datasheet explains exactly which bits are
-useful, we will just do the same as the adafruit code, first checking the error
-bit and then scrapping everything but the 14bit of thermocouple data that are
-useful to us and converting it to a double.
-
-@snippet src/max31855/max31855.cxx conversion
-
-### Finalizing
-
-Our final example, very easy to use API!
-
-@snippet examples/c++/max31855.cxx Interesting
-
-### Building
-
-The we need to add it to the examples/CMakeLists.txt. Only three lines are required
-
-~~~~~~~~~~~
-add_executable (max31855-example max31855.cxx)
-include_directories (${PROJECT_SOURCE_DIR}/src/max31855)
-target_link_libraries (max31855-example max31855 ${CMAKE_THREAD_LIBS_INIT})
-~~~~~~~~~~~
-
-Note you don't have to rebuild everything, cmake keeps target lists so if you
-named your example target modulename-example you can simply do make
-max31855-example and both the library & example will build.
diff --git a/peripheral/libupm/docs/naming.md b/peripheral/libupm/docs/naming.md
deleted file mode 100644
index dcb3a8c..0000000
--- a/peripheral/libupm/docs/naming.md
+++ /dev/null
@@ -1,30 +0,0 @@
-Naming a module {#naming}
-===============
-
-UPM attempts to follow a clear naming pattern. Modules should be sensibly named
-and then placed in ${libdir}/upm and headers in ${includedir}/upm, all modules
-should be prefixed with libupm-<modulename>. The upm_module_init will
-automatically name python UPM modules as pyupm_<modulename> and javascript
-modules as jsupm_<modulename>. For example for src/grove/ the library built
-will be libupm-grove.so, the python module pyupm_grove and the js module
-jsupm_grove.
-
-### Choosing a name for a new module
-
-1. Pick a name, typically the chip name is the most sensible
-2. Use it & stick to it
-
-### Rules for name picking
-
-1. Your lib must belong to the UPM namespace
-2. Usually picking the name of the chip of your sensor/actuator makes sense.
-Other times this does not. Try to pick a generic name so people with a similar
-sensor can inherit your class if they only have minor changes.
-3. Avoid brand names, often your module can be very generic with little effort
-4. Use only lowercase characters in your file names and folder names.
-
-### Doubt
-
-If ever, give either of us a ping via email:
-mihai.tudor.panu@intel.com or brendan.le.foll@intel.com
-and we'll try suggest decent names for your module.
diff --git a/peripheral/libupm/docs/porting.md b/peripheral/libupm/docs/porting.md
deleted file mode 100644
index a75041a..0000000
--- a/peripheral/libupm/docs/porting.md
+++ /dev/null
@@ -1,65 +0,0 @@
-Porting a module from Arduino {#porting}
-=============================
-
-Porting arduino libraries to libmraa as UPM libraries is usually fairly easy.
-The issues typically come from misunderstanding of how a non real time OS deals
-with interrupts and timers. It also highly depends on the sensor. A concrete
-example is explained in detail on @ref max31855
-
-### Adding a new module to UPM
-
-1. Choose a name for your module (see @ref naming)
-2. Make a new folder in src/modulename
-3. Create a CMakeLists.txt file inside src/modulename
-
-### CmakeLists.txt
-
-By default you need a header called modulename.h and a C++ file called
-modulename.cxx. You can have multiple headers and source files. Only public
-headers need to be added to module_h and all source files need to be in
-module_src.
-
-~~~~~~~~~~~
-set (libname "modulename")
-set (libdescription "Module Description")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
-~~~~~~~~~~~
-
-### Making your API
-
-The easiest way to do this is to have a look at a similar sensor to yours.
-Typically create a class for your sensor with a constructor that defines the
-pins it is on. This constructor will create the mraa_*_context structs that are
-required to talk to the board's IO. An I2c sensor will create a
-mraa_i2c_context, keep it as a private member and require a bus number and slave
-address in it's constructor.
-
-Typically in sensors a simple object->read() function is preferred, depending on
-your sensor/actuator this may or may not be easy or not even make sense. Most
-UPM APIs have a simple set of functions.
-
-### Mapping arduino API to libmraa
-
-Your constructor is similar to the setup() function in arduino, you should
-initialise your IO the way you want it. This means initialising contexts
-(private members) and setting the correct modes for them.
-
-See the mraa API documentation for exact API.
-
-### Building
-
-To build your module just follow @ref building. By creating a folder and the
-CMakelists.txt file you have done all that is required to add your sensor to
-the UPM build system.
-
-### Sending your module to us for inclusion in UPM
-
-The last step is when you're happy with your module and it works send us a pull
-request! We'd love to include your sensor in our repository.
-
-If you don't like github you can also send mihai.tudor.panu@intel.com a git
-formatted patch of your sensor. More details are on @ref contributions and on
-https://help.github.com/articles/creating-a-pull-request
-
diff --git a/peripheral/libupm/doxy/Doxyfile.in b/peripheral/libupm/doxy/Doxyfile.in
deleted file mode 100644
index 83db5af..0000000
--- a/peripheral/libupm/doxy/Doxyfile.in
+++ /dev/null
@@ -1,2370 +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 = upm
-
-# 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 = @upm_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 = "Sensor/Actuator repository for libmraa (v@MRAA_VERSION@)"
-
-# With the PROJECT_LOGO tag one can specify an logo or icon that is included in
-# the documentation. The maximum height of the logo should not exceed 55 pixels
-# and the maximum width should not exceed 200 pixels. Doxygen will copy the logo
-# to the output directory.
-
-PROJECT_LOGO =
-
-# 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
-
-DETAILS_AT_TOP = YES
-
-# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
-# inherited members of a class in the documentation of that class as if those
-# members were ordinary class members. Constructors, destructors and assignment
-# 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 = library="@ingroup " \
- sensor="@li **ID:** " \
- comname="@li **Name:** " \
- altname="@li **Other Names:** " \
- altid="@li **Other Chips:** " \
- type="@li **Category:** " \
- man="@li **Manufacturer:** " \
- web="@li **Link:** " \
- con="@li **Connection:** " \
- kit="@li **Kit:** " \
-
-# This tag can be used to specify a number of word-keyword mappings (TCL only).
-# A mapping has the form "name=value". For example adding "class=itcl::class"
-# will allow you to use the command class in the itcl::class meaning.
-
-TCL_SUBST =
-
-# 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@/doxy/DoxygenLayout.xml
-
-# The CITE_BIB_FILES tag can be used to specify one or more bib files containing
-# the reference definitions. This must be a list of .bib files. The .bib
-# 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@/src/upm.h \
- @CMAKE_CURRENT_SOURCE_DIR@/src \
- @CMAKE_CURRENT_SOURCE_DIR@/docs \
- @CMAKE_CURRENT_SOURCE_DIR@/doxy/README.cpp.md
-
-# This tag can be used to specify the character encoding of the source files
-# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
-# 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 = 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 = @PROJECT_SOURCE_DIR@/src/doxy2swig.py
-
-# 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 = aci_*
-
-# The EXAMPLE_PATH tag can be used to specify one or more files or directories
-# that contain example code fragments that are included (see the \include
-# command).
-
-EXAMPLE_PATH = @CMAKE_CURRENT_SOURCE_DIR@/examples/c++ \
- @CMAKE_CURRENT_SOURCE_DIR@/docs/ \
- @CMAKE_CURRENT_SOURCE_DIR@/src/max31855/
-
-# If the value of the EXAMPLE_PATH tag contains directories, you can use the
-# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
-# *.h) to filter out the source-files in the directories. If left blank all
-# files are included.
-
-EXAMPLE_PATTERNS = *.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 = @CMAKE_CURRENT_SOURCE_DIR@/docs/images/
-
-# The INPUT_FILTER tag can be used to specify a program that doxygen should
-# invoke to filter for each input file. Doxygen will invoke the filter program
-# 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@/doxy/README.cpp.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
-
-# 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/libupm/doxy/Doxyfile.java.in b/peripheral/libupm/doxy/Doxyfile.java.in
deleted file mode 100644
index bc873d1..0000000
--- a/peripheral/libupm/doxy/Doxyfile.java.in
+++ /dev/null
@@ -1,2332 +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 = upm
-
-# 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 = @upm_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 = "Sensor/Actuator repository for libmraa (v@MRAA_VERSION@)"
-
-# With the PROJECT_LOGO tag one can specify an logo or icon that is included in
-# the documentation. The maximum height of the logo should not exceed 55 pixels
-# and the maximum width should not exceed 200 pixels. Doxygen will copy the logo
-# to the output directory.
-
-PROJECT_LOGO =
-
-# 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
-
-DETAILS_AT_TOP = YES
-
-# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
-# inherited members of a class in the documentation of that class as if those
-# members were ordinary class members. Constructors, destructors and assignment
-# 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 = library="@ingroup " \
- sensor="@li **ID:** " \
- comname="@li **Name:** " \
- altname="@li **Other Names:** " \
- altid="@li **Other Chips:** " \
- type="@li **Category:** " \
- man="@li **Manufacturer:** " \
- web="@li **Link:** " \
- con="@li **Connection:** " \
- kit="@li **Kit:** " \
-
-# This tag can be used to specify a number of word-keyword mappings (TCL only).
-# A mapping has the form "name=value". For example adding "class=itcl::class"
-# will allow you to use the command class in the itcl::class meaning.
-
-TCL_SUBST =
-
-# 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@/doxy/DoxygenLayout.xml
-
-# The CITE_BIB_FILES tag can be used to specify one or more bib files containing
-# the reference definitions. This must be a list of .bib files. The .bib
-# 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@/src/upm.h \
- @CMAKE_BINARY_DIR@/src \
- @CMAKE_CURRENT_SOURCE_DIR@/docs \
- @CMAKE_CURRENT_SOURCE_DIR@/doxy/README.java.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 \
- *.md
-
-# 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 = @PROJECT_SOURCE_DIR@/src/doxy2swig.py
-
-# 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 = */SWIGTYPE_* */javaupm_*
-
-# 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 = aci_*
-
-# The EXAMPLE_PATH tag can be used to specify one or more files or directories
-# that contain example code fragments that are included (see the \include
-# command).
-
-EXAMPLE_PATH = @CMAKE_CURRENT_SOURCE_DIR@/examples/java/ \
- @CMAKE_CURRENT_SOURCE_DIR@/docs/ \
- @CMAKE_CURRENT_SOURCE_DIR@/src/max31855/
-
-# If the value of the EXAMPLE_PATH tag contains directories, you can use the
-# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
-# *.h) to filter out the source-files in the directories. If left blank all
-# files are included.
-
-EXAMPLE_PATTERNS = *.cxx \
- *.java \
- *.md
-
-# 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 = @CMAKE_CURRENT_SOURCE_DIR@/docs/images/
-
-# The INPUT_FILTER tag can be used to specify a program that doxygen should
-# invoke to filter for each input file. Doxygen will invoke the filter program
-# 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@/doxy/README.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/libupm/doxy/DoxygenLayout.xml b/peripheral/libupm/doxy/DoxygenLayout.xml
deleted file mode 100644
index aae647b..0000000
--- a/peripheral/libupm/doxy/DoxygenLayout.xml
+++ /dev/null
@@ -1,198 +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="UPM Libraries" intro="Here is a
- list of UPM libraries that can be used. Note that each of the classes
- listed in these libraries are completely separate so you will need to link
- against all those that you have used in your program. Use the hierarchical
- tree to filter between different types of sensors."/> <tab
- type="namespaces" visible="yes" title="">
- <tab type="namespacelist" visible="yes" title="" intro=""/>
- <tab type="namespacemembers" visible="yes" title="" intro=""/>
- </tab>
- <tab type="classes" visible="yes" title="">
- <tab type="classlist" visible="yes" title="" intro=""/>
- <tab type="classindex" visible="$ALPHABETICAL_INDEX" title=""/>
- <tab type="hierarchy" visible="yes" title="" intro=""/>
- <tab type="classmembers" visible="yes" title="" intro=""/>
- </tab>
- <tab type="files" visible="yes" title="">
- <tab type="filelist" visible="yes" title="" intro=""/>
- <tab type="globals" visible="yes" title="" intro=""/>
- </tab>
- <tab type="examples" visible="yes" title="" intro=""/>
- </navindex>
-
- <!-- Layout definition for a class page -->
- <class>
- <briefdescription visible="yes"/>
- <detaileddescription title=""/>
- <includes visible="$SHOW_INCLUDE_FILES"/>
- <memberdecl>
- <nestedclasses visible="yes" title=""/>
- <publictypes title=""/>
- <services title=""/>
- <interfaces title=""/>
- <publicslots title=""/>
- <signals title=""/>
- <publicmethods title=""/>
- <publicstaticmethods title=""/>
- <publicattributes title=""/>
- <publicstaticattributes title=""/>
- <protectedtypes title=""/>
- <protectedslots title=""/>
- <protectedmethods title=""/>
- <protectedstaticmethods title=""/>
- <protectedattributes title=""/>
- <protectedstaticattributes title=""/>
- <packagetypes title=""/>
- <packagemethods title=""/>
- <packagestaticmethods title=""/>
- <packageattributes title=""/>
- <packagestaticattributes title=""/>
- <properties title=""/>
- <events title=""/>
- <privatetypes title=""/>
- <privateslots title=""/>
- <privatemethods title=""/>
- <privatestaticmethods title=""/>
- <privateattributes title=""/>
- <privatestaticattributes title=""/>
- <friends title=""/>
- <related title="" subtitle=""/>
- <membergroups visible="yes"/>
- </memberdecl>
- <memberdef>
- <inlineclasses title=""/>
- <typedefs title=""/>
- <enums title=""/>
- <services title=""/>
- <interfaces title=""/>
- <constructors title=""/>
- <functions title=""/>
- <related title=""/>
- <variables title=""/>
- <properties title=""/>
- <events title=""/>
- </memberdef>
- <allmemberslink visible="yes"/>
- <inheritancegraph visible="$CLASS_GRAPH"/>
- <collaborationgraph visible="$COLLABORATION_GRAPH"/>
- <usedfiles visible="$SHOW_USED_FILES"/>
- <authorsection visible="yes"/>
- </class>
-
- <!-- Layout definition for a namespace page -->
- <namespace>
- <briefdescription visible="yes"/>
- <memberdecl>
- <nestednamespaces visible="yes" title=""/>
- <constantgroups visible="yes" title=""/>
- <classes visible="yes" title=""/>
- <typedefs title=""/>
- <enums title=""/>
- <functions title=""/>
- <variables title=""/>
- <membergroups visible="yes"/>
- </memberdecl>
- <detaileddescription title=""/>
- <memberdef>
- <inlineclasses title=""/>
- <typedefs title=""/>
- <enums title=""/>
- <functions title=""/>
- <variables title=""/>
- </memberdef>
- <authorsection visible="yes"/>
- </namespace>
-
- <!-- Layout definition for a file page -->
- <file>
- <briefdescription visible="no"/>
- <includegraph visible="$INCLUDE_GRAPH"/>
- <includes visible="$SHOW_INCLUDE_FILES"/>
- <detaileddescription title="API Description"/>
- <sourcelink visible="yes"/>
- <memberdecl>
- <classes visible="yes" title=""/>
- <namespaces visible="yes" title=""/>
- <functions title=""/>
- <constantgroups visible="yes" title=""/>
- <defines title=""/>
- <typedefs title=""/>
- <enums title=""/>
- <variables title=""/>
- <membergroups visible="yes"/>
- </memberdecl>
- <memberdef>
- <inlineclasses title=""/>
- <functions title=""/>
- <defines title=""/>
- <typedefs title=""/>
- <enums title=""/>
- <variables title=""/>
- </memberdef>
- <includedbygraph visible="$INCLUDED_BY_GRAPH"/>
- <authorsection/>
- </file>
-
- <!-- Layout definition for a group page -->
- <group>
- <briefdescription visible="yes"/>
- <memberdecl>
- <nestedgroups visible="yes" title="Libraries"/>
- <dirs visible="yes" title=""/>
- <files visible="yes" title=""/>
- <namespaces visible="yes" title=""/>
- <classes visible="yes" title=""/>
- <defines title=""/>
- <typedefs title=""/>
- <enums title=""/>
- <enumvalues title=""/>
- <functions title=""/>
- <variables title=""/>
- <signals title=""/>
- <publicslots title=""/>
- <protectedslots title=""/>
- <privateslots title=""/>
- <events title=""/>
- <properties title=""/>
- <friends title=""/>
- <membergroups visible="yes"/>
- </memberdecl>
- <detaileddescription title=""/>
- <memberdef>
- <pagedocs/>
- <inlineclasses title=""/>
- <defines title=""/>
- <typedefs title=""/>
- <enums title=""/>
- <enumvalues title=""/>
- <functions title=""/>
- <variables title=""/>
- <signals title=""/>
- <publicslots title=""/>
- <protectedslots title=""/>
- <privateslots title=""/>
- <events title=""/>
- <properties title=""/>
- <friends title=""/>
- </memberdef>
- <groupgraph visible="$GROUP_GRAPHS"/>
- <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/libupm/doxy/README.cpp.md b/peripheral/libupm/doxy/README.cpp.md
deleted file mode 100644
index 7bbb9f3..0000000
--- a/peripheral/libupm/doxy/README.cpp.md
+++ /dev/null
@@ -1,82 +0,0 @@
-UPM (Useful Packages & Modules) Sensor/Actuator repository for MRAA
-==============
-
-UPM is a high level repository for sensors that use MRAA. Each sensor links
-to MRAA and are not meant to be interlinked although some groups of sensors
-may be. Each sensor contains a header which allows to interface with it.
-Typically a sensor is represented as a class and instantiated.
-
-The constructor is expected to initialise the sensor and parameters may be used
-to provide identification/pin location on the board.
-
-Typically an update() function will be called in order to get new data from the
-sensor in order to reduce load when doing multiple reads to sensor data.
-
-### Example
-
-A sensor/actuator is expected to work as such (here is the servo ES08A API):
-@snippet es08a.cxx Interesting
-
-However implementation and API design is completely up to the developer, some
-enumerable sensors for example may provide much clever instantiation. Displays
-may also create more complex structures in order to interface with them.
-
-Browse through the list of all [examples](https://github.com/intel-iot-devkit/upm/tree/master/examples/c%2B%2B).
-
-Multi-sensor samples for the starter and specialized kits can be found in the
-[iot-devkit-samples](https://github.com/intel-iot-devkit/iot-devkit-samples) repository.
-
-### Supported Sensors
-
-Supported [sensor list](http://iotdk.intel.com/docs/master/upm/modules.html) from API documentation.
-
-You can also refer to the [Intel IoT Developer Zone](https://software.intel.com/iot/sensors).
-
-### IDE Compatibility
-
-If you would like to create Eclipse IDE projects using the UPM C++ samples,
-please follow the instructions provided on the Intel Developer Zone IDE page.
-
-@htmlonly
-<a href="https://software.intel.com/iot/software/ide"><img src="docs/icons/eclipse.png"/></a>
-@endhtmlonly
-
-### Building UPM
-
-See @ref building here.
-
-### Making your own UPM module
-
-@ref porting link has more information on making new UPM modules.
-
-There is also an example available for @ref max31855 sensor.
-
-### Naming conventions and rules for new UPM contributions
-
-Before you begin development, take a look at our @ref naming conventions.
-
-Also, please read the guidelines for @ref contributions to UPM.
-
-Don't forget to check the @ref documentation section.
-
-Make sure you add yourself as an author on every new code file submitted.
-If you are providing a fix with significant changes, feel free to add yourself
-as a contributor. Signing-off your commits is mandatory.
-
-API Documentation
-==============
-
-@htmlonly
-
-<a href="http://iotdk.intel.com/docs/master/upm"><img src="docs/icons/c++.png"/></a>
-<a href="http://iotdk.intel.com/docs/master/upm/java"><img src="docs/icons/java.png"/></a>
-<a href="http://iotdk.intel.com/docs/master/upm/python"><img src="docs/icons/python.png"/></a>
-<a href="http://iotdk.intel.com/docs/master/upm/node"><img src="docs/icons/node.png"/></a>
-
-@endhtmlonly
-
-### Changelog
-Version @ref changelog here.
-
-### Known Limitations
-List of @ref knownlimitations here.
diff --git a/peripheral/libupm/doxy/README.java.md b/peripheral/libupm/doxy/README.java.md
deleted file mode 100644
index f6f59e3..0000000
--- a/peripheral/libupm/doxy/README.java.md
+++ /dev/null
@@ -1,81 +0,0 @@
-UPM (Useful Packages & Modules) Sensor/Actuator repository for MRAA
-
-UPM is a high level repository for sensors that use MRAA. Each sensor links
-to MRAA and are not meant to be interlinked although some groups of sensors
-may be. Each sensor contains a header which allows to interface with it.
-Typically a sensor is represented as a class and instantiated.
-
-The constructor is expected to initialise the sensor and parameters may be used
-to provide identification/pin location on the board.
-
-Typically an update() function will be called in order to get new data from the
-sensor in order to reduce load when doing multiple reads to sensor data.
-
-### Example
-
-A sensor/actuator is expected to work as such (here is the servo ES08A API):
-@snippet ES08ASample.java Interesting
-
-However implementation and API design is completely up to the developer, some
-enumerable sensors for example may provide much clever instantiation. Displays
-may also create more complex structures in order to interface with them.
-
-Browse through the list of all [examples](https://github.com/intel-iot-devkit/upm/tree/master/examples/java).
-
-Multi-sensor samples for the starter and specialized kits can be found in the
-[iot-devkit-samples](https://github.com/intel-iot-devkit/iot-devkit-samples) repository.
-
-### Supported Sensors
-
-Supported [sensor list](http://iotdk.intel.com/docs/master/upm/java/modules.html) from API documentation.
-
-You can also refer to the [Intel® IoT Developer Zone](https://software.intel.com/iot/sensors).
-
-### IDE Compatibility
-
-If you would like to create Eclipse IDE projects using the UPM Java samples,
-please follow the instructions provided on the Intel Developer Zone IDE page.
-
-@htmlonly
-<a href="https://software.intel.com/iot/software/ide"><img src="../docs/icons/eclipse.png"/></a>
-@endhtmlonly
-
-### Building UPM
-
-See @ref building here.
-
-### Making your own UPM module
-
-@ref porting link has more information on making new UPM modules.
-
-There is also an example available for @ref max31855 sensor.
-
-### Naming conventions and rules for new UPM contributions
-
-Before you begin development, take a look at our @ref naming conventions.
-
-Also, please read the guidelines for @ref contributions to UPM.
-
-Don't forget to check the @ref documentation section.
-
-Make sure you add yourself as an author on every new code file submitted.
-If you are providing a fix with significant changes, feel free to add yourself
-as a contributor. Signing-off your commits is mandatory.
-
-API Documentation
-==============
-
-@htmlonly
-
-<a href="http://iotdk.intel.com/docs/master/upm"><img src="../docs/icons/c++.png"/></a>
-<a href="http://iotdk.intel.com/docs/master/upm/java"><img src="../docs/icons/java.png"/></a>
-<a href="http://iotdk.intel.com/docs/master/upm/python"><img src="../docs/icons/python.png"/></a>
-<a href="http://iotdk.intel.com/docs/master/upm/node"><img src="../docs/icons/node.png"/></a>
-
-@endhtmlonly
-
-### Changelog
-Version @ref changelog here.
-
-### Known Limitations
-List of @ref knownlimitations here.
diff --git a/peripheral/libupm/doxy/conf.py.in b/peripheral/libupm/doxy/conf.py.in
deleted file mode 100644
index fac8930..0000000
--- a/peripheral/libupm/doxy/conf.py.in
+++ /dev/null
@@ -1,352 +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
-import shlex
-
-# 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_CURRENT_BINARY_DIR@/pyupm/")
-sys.path.insert(0, "@MRAA_LIBDIR@@LIB_SUFFIX@")
-
-# -- General configuration ------------------------------------------------
-
-# Custom flags and filters if needed
-# autodoc_default_flags = ['members', 'private-members', 'special-members', 'undoc-members', 'show-inheritance']
-
-# def autodoc_skip_member(app, what, name, obj, skip, options):
- # exclusions = ('__weakref__', # special-members
- # '__doc__', '__module__', '__dict__', # undoc-members
- # 'swig_import_helper'
- # )
- # exclude = name in exclusions
- # return skip or exclude
-
-# def setup(app):
- # app.connect('autodoc-skip-member', autodoc_skip_member)
-
-# 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.todo',
- '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 = 'upm'
-copyright = '2015, 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 = '@upm_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
-
-# If true, `todo` and `todoList` produce output, else they produce nothing.
-todo_include_todos = True
-
-# -- 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 = 'default'
-#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 = 'upmdoc'
-
-
-# -- 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 = 'UPM'
-epub_publisher = 'UPM'
-epub_copyright = '2015, Intel Corporation'
-
-# 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/libupm/doxy/index.rst b/peripheral/libupm/doxy/index.rst
deleted file mode 100644
index cd91bae..0000000
--- a/peripheral/libupm/doxy/index.rst
+++ /dev/null
@@ -1,94 +0,0 @@
-.. UPM Python documentation master file, created by Sisinty Sasmita Patra
- UPM Team on Thu May 14 15:58:46 2015.
- You can adapt this file completely to your liking, but it should at least
- contain the root `toctree` directive.
-
-**Welcome to UPM Python Documentation!**
-=========================================
-
-.. include:: ../../README.md
- :start-after: ==============
- :end-before: ### Example
-
-``Building UPM``
-################
-
-For building UPM, please follow this `link <https://github.com/intel-iot-devkit/upm/blob/master/docs/building.md>`_.
-
-``Examples``
-############
-
-Multi-sensor samples for the starter and specialized kits can be found in the `iot-devkit-samples <https://github.com/intel-iot-devkit/iot-devkit-samples>`_
-repository.
-
-Individual sensor usage examples for Python are available `here <https://github.com/intel-iot-devkit/upm/tree/master/examples/python>`_.
-
-``IDE Compatibility``
-################
-
-While there is no official IDE provided with our Python libraries, we do recommend the web-based IDE Wyliodrin. It can be used with multiple programming
-languages, including Python. More information can be found on the Intel Developer Zone IDE page.
-
-.. image:: ../docs/icons/wyliodrin.png
- :target: https://software.intel.com/iot/software/ide
-
-``Making your own UPM Module``
-##############################
-
-This `link <https://github.com/intel-iot-devkit/upm/blob/master/docs/porting.md>`_ has more information on making a new UPM module.
-
-There is also an example available for max31855 `sensor <https://github.com/intel-iot-devkit/upm/blob/master/docs/max31855.md>`_.
-
-``Naming Conventions and Rules for New UPM Contributions``
-##########################################################
-
-Before you begin development, please take a look at our naming `conventions <https://github.com/intel-iot-devkit/upm/blob/master/docs/naming.md>`_.
-
-Also, please read the guidelines for contributions to `UPM <https://github.com/intel-iot-devkit/upm/blob/master/docs/contributions.md>`_.
-
-Don't forget to check the documentation `section <https://github.com/intel-iot-devkit/upm/blob/master/docs/documentation.md>`_.
-
-.. note::
-
- * Make sure you add yourself as an author on every new code file submitted.
- * If you are providing a fix with significant changes, feel free to add yourself as a contributor.
- * Signing-off your commits is mandatory.
-
-``List of Available Sensors Drivers``
-######################################
-
-Click on the library prefix below to expand the full list of sensors:
-
-.. toctree::
- :maxdepth: 1
-
- modules
-
-``Other API Documentation``
-###########################
-
-.. image:: ../docs/icons/c++.png
- :target: http://iotdk.intel.com/docs/master/upm
-.. image:: ../docs/icons/java.png
- :target: http://iotdk.intel.com/docs/master/upm/java
-.. image:: ../docs/icons/python.png
- :target: http://iotdk.intel.com/docs/master/upm/python
-.. image:: ../docs/icons/node.png
- :target: http://iotdk.intel.com/docs/master/upm/node
-
-``Version Changelog``
-#####################
-
-For our Version Changelog, please see `here <https://github.com/intel-iot-devkit/upm/blob/master/docs/changelog.md>`_.
-
-``Known Limitations``
-###################################
-
-For the List of Known Limitations, please see `here <https://github.com/intel-iot-devkit/upm/blob/master/docs/knownlimitations.md>`_.
-
-``Indices and tables``
-######################
-
-* :ref:`genindex`
-* :ref:`modindex`
-* :ref:`search`
diff --git a/peripheral/libupm/doxy/node/docgen.js b/peripheral/libupm/doxy/node/docgen.js
deleted file mode 100644
index 305cec3..0000000
--- a/peripheral/libupm/doxy/node/docgen.js
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Author: Heidi Pan <heidi.pan@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.
- */
-
-// dependencies
-var xml2js = require('./xml2js')
- , fs = require('fs')
- , Promise = require('bluebird')
- , opts = require('commander')
- , _ = require('lodash')
- , mkdirp = require('mkdirp');
-
-
-// parse command line arguments
-_.extend(opts, { addOptions: function(module) { return module.addOptions(opts); } });
-opts
- .option('-m, --module [module]', 'module name for which to build documentation', 'mraa')
- .option('-f, --formats [formats]', 'format for js comments', 'yuidoc,ternjs')
- .option('-o, --outdir [directory]', 'top directory to build documentation', __dirname + '/jsdoc')
- .addOptions(xml2js)
- .parse(process.argv);
-
-
-// use promise-style programming rather than spaghetti callbacks
-Promise.promisifyAll(fs);
-Promise.promisifyAll(mkdirp);
-
-
-// main
-xml2js.parse().then(function(specjs) {
- var formats = opts.formats.split(',');
- Promise.all(_.map(formats, function(format) {
- var generateDocs = require(__dirname + '/generators/' + format + '/generator');
- var dir = opts.outdir + '/' + format + '/' + specjs.MODULE;
- return mkdirp.mkdirpAsync(dir).then(function() {
- return fs.writeFileAsync(dir + '/doc.js', generateDocs(specjs));
- });
- }));
-});
diff --git a/peripheral/libupm/doxy/node/generators/jsdoc/conf.json b/peripheral/libupm/doxy/node/generators/jsdoc/conf.json
deleted file mode 100644
index a2f37cc..0000000
--- a/peripheral/libupm/doxy/node/generators/jsdoc/conf.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "templates": {
- "default": {
- "outputSourceFiles": false
- }
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/doxy/node/generators/jsdoc/generator.js b/peripheral/libupm/doxy/node/generators/jsdoc/generator.js
deleted file mode 100644
index 6dd3d7d..0000000
--- a/peripheral/libupm/doxy/node/generators/jsdoc/generator.js
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Author: Heidi Pan <heidi.pan@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.
- */
-
-// dependencies
-var _ = require('lodash');
-
-
-// generate JSDoc-style documentation
-function generateDocs(specjs) {
- var docs = GENERATE_MODULE(specjs.MODULE);
- docs = _.reduce(specjs.METHODS, function(memo, methodSpec, methodName) {
- return memo += GENERATE_METHOD(methodName, methodSpec);
- }, docs);
- docs = _.reduce(specjs.ENUMS, function(memo, enumSpec, enumName) {
- return memo += GENERATE_ENUM(enumName, enumSpec);
- }, docs);
- docs = _.reduce(specjs.CLASSES, function(memo, classSpec, parentClass) {
- return _.reduce(classSpec.methods, function(memo, methodSpec, methodName) {
- return memo += GENERATE_METHOD(methodName, methodSpec, parentClass);
- }, memo);
- }, docs);
- return docs;
-}
-
-
-// comment wrapper around entire spec
-function GENERATE_DOC(text) {
- return '/**\n' + text + ' */\n';
-}
-
-
-// generate module spec
-function GENERATE_MODULE(module) {
- return GENERATE_DOC('@module ' + module + '\n');
-}
-
-
-// generate method spec with parent module/class
-function GENERATE_METHOD(name, spec, parent) {
- name = name.replace(/!+$/, '');
- return GENERATE_DOC(spec.description + '\n'
- + '@method ' + name + '\n'
- + '@instance\n'
- + (parent ? ('@memberof ' + parent + '\n') : '')
- + _.reduce(spec.params, function(memo, paramSpec, paramName) {
- return '@param {' + paramSpec.type + '} ' + paramName + ' ' + paramSpec.description + '\n';
- }, '')
- + ( !_.isEmpty(spec.return) ? ('@return {' + spec.return.type + '} ' + spec.return.description + '\n') : ''));
-}
-
-
-// generate enum spec
-function GENERATE_ENUM(name, spec) {
- return GENERATE_DOC(spec.description + '\n\n'
- + '@var ' + name + '\n'
- + '@type Enum(' + spec.type + ')\n'
- + '@instance\n');
-}
-
-
-// TODO
-// generate link spec
-function GENERATE_LINK(text) {
- return '{@link ' + text + '}';
-}
-
-
-module.exports = generateDocs;
diff --git a/peripheral/libupm/doxy/node/generators/ternjs/generator.js b/peripheral/libupm/doxy/node/generators/ternjs/generator.js
deleted file mode 100644
index 2378fe1..0000000
--- a/peripheral/libupm/doxy/node/generators/ternjs/generator.js
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Author: Heidi Pan <heidi.pan@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.
- */
-
-// dependencies
-var _ = require('lodash');
-
-
-// generate json for ternjs input
-function generateDocs(specjs) {
- GENERATE_TYPE = (function(enums) {
- return function(type) {
- return (_.contains(enums, type) ? ('Enum ' + type) : type);
- }
- })(_.keys(specjs.ENUMS_BY_GROUP));
- var docs = { '!name': specjs.MODULE + 'library' };
- _.extend(docs, GENERATE_MODULE(specjs.MODULE));
- _.each(specjs.ENUMS, function(enumSpec, enumName) {
- _.extend(docs[specjs.MODULE], GENERATE_ENUM(enumName, enumSpec));
- });
- _.each(specjs.METHODS, function(methodSpec, methodName) {
- _.extend(docs[specjs.MODULE], GENERATE_METHOD(methodName, methodSpec));
- });
-
- if (_.isEmpty(specjs.CLASSGROUPS)) {
- _.extend(docs[specjs.MODULE], GENERATE_CLASSES(specjs.CLASSES));
- } else {
- var grouped = _.flatten(_.pluck(_.values(specjs.CLASSGROUPS), 'classes'));
- var ungrouped = _.difference(_.keys(specjs.CLASSES), grouped);
- _.extend(docs[specjs.MODULE], GENERATE_CLASSES(_.pick(specjs.CLASSES, ungrouped)));
- _.each(specjs.CLASSGROUPS, function(groupSpec, groupName) {
- _.extend(docs, GENERATE_MODULE(groupName));
- _.extend(docs[groupName], GENERATE_CLASSES(_.pick(specjs.CLASSES, groupSpec.classes), groupName));
- });
- }
- return JSON.stringify(docs, null, 2);
-}
-
-
-// generate module spec
-function GENERATE_MODULE(module) {
- var docs = {};
- docs[module] = {};
- return docs;
-}
-
-
-// generate the spec for the given list of classes
-function GENERATE_CLASSES(classes) {
- var docs = {};
- _.each(classes, function(classSpec, parentClass) {
- var constructor = classSpec.methods[parentClass];
- _.extend(docs, GENERATE_METHOD(parentClass, constructor ? constructor : { params: {}, return: {}, description: '' } ));
- if (_.has(docs, parentClass)) {
- _.each(classSpec.enums, function(enumSpec, enumName) {
- _.extend(docs[parentClass], GENERATE_ENUM(enumName, enumSpec));
- });
- docs[parentClass].prototype = {};
- _.each(_.omit(classSpec.methods, parentClass), function(methodSpec, methodName) {
- _.extend(docs[parentClass].prototype, GENERATE_METHOD(methodName, methodSpec));
- });
- _.each(classSpec.variables, function(variableSpec, variableName) {
- _.extend(docs[parentClass].prototype, GENERATE_VARIABLE(variableName, variableSpec));
- });
- }
- });
- return docs;
-}
-
-
-// generate method spec
-function GENERATE_METHOD(name, spec) {
- var doc = {};
- doc[name] = {
- '!type': 'fn(' + GENERATE_PARAMS(spec.params) + ')' + GENERATE_RETURN(spec.return),
- '!doc': spec.description
- }
- return doc;
-}
-
-
-// generate parameter signatures for method
-function GENERATE_PARAMS(spec) {
- return _.map(spec, function(paramSpec, paramName) {
- return paramName + ': ' + paramSpec.type;
- }).join(', ');
-}
-
-
-// generate return signature for method
-function GENERATE_RETURN(spec) {
- return (_.isEmpty(spec) ? '' : (' -> ' + spec.type));
-}
-
-
-// generate enum spec
-function GENERATE_ENUM(name, spec) {
- var doc = {};
- doc[name] = 'Enum ' + spec.type ;
- return doc;
-}
-
-
-// generate variable spec
-function GENERATE_VARIABLE(name, spec) {
- var doc = {};
- doc[name]= spec.type ;
- return doc;
-}
-
-
-module.exports = generateDocs;
diff --git a/peripheral/libupm/doxy/node/generators/yuidoc/conf.json b/peripheral/libupm/doxy/node/generators/yuidoc/conf.json
deleted file mode 100644
index 002d0ab..0000000
--- a/peripheral/libupm/doxy/node/generators/yuidoc/conf.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "name": "UPM",
- "description": "The UPM API: High Level Sensor Library for Intel IoT Devices Using MRAA",
- "logo": "http://upload.wikimedia.org/wikipedia/commons/8/8c/Transparent.png",
- "options": {
- "outdir": "./html/node"
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/doxy/node/generators/yuidoc/generator.js b/peripheral/libupm/doxy/node/generators/yuidoc/generator.js
deleted file mode 100644
index fb5fe2a..0000000
--- a/peripheral/libupm/doxy/node/generators/yuidoc/generator.js
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Author: Heidi Pan <heidi.pan@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.
- */
-
-// dependencies
-var _ = require('lodash');
-
-
-// generate YuiDocs-style documentation
-function generateDocs(specjs) {
- var docs = GENERATE_MODULE(specjs.MODULE, '');
- GENERATE_TYPE = (function(enums) {
- return function(type) {
- return (_.contains(enums, type) ? ('Enum ' + type) : type);
- }
- })(_.keys(specjs.ENUMS_BY_GROUP));
- docs = _.reduce(specjs.METHODS, function(memo, methodSpec, methodName) {
- return memo += GENERATE_METHOD(methodName, methodSpec);
- }, docs);
- docs = _.reduce(specjs.ENUMS, function(memo, enumSpec, enumName) {
- return memo += GENERATE_ENUM(enumName, enumSpec);
- }, docs);
- if (_.isEmpty(specjs.CLASSGROUPS)) {
- docs += GENERATE_CLASSES(specjs.CLASSES);
- } else {
- docs += GENERATE_MODULE('common', '');
- var grouped = _.flatten(_.pluck(_.values(specjs.CLASSGROUPS), 'classes'));
- var ungrouped = _.difference(_.keys(specjs.CLASSES), grouped);
- docs += GENERATE_CLASSES(_.pick(specjs.CLASSES, ungrouped), 'common');
- _.each(specjs.CLASSGROUPS, function(groupSpec, groupName) {
- docs += GENERATE_CLASSES(_.pick(specjs.CLASSES, groupSpec.classes), groupName);
- });
- // TODO: figure out why yuidoc won't associate the class with the right module if module definitions are interspersed
- _.each(specjs.CLASSGROUPS, function(groupSpec, groupName) {
- docs += GENERATE_MODULE(groupName, groupSpec.description);
- });
- }
- return docs;
-}
-
-
-// comment wrapper around entire spec
-function GENERATE_DOC(text) {
- return '/**\n' + text + ' */\n';
-}
-
-
-// generate module spec
-function GENERATE_MODULE(name, description) {
- return GENERATE_DOC(description + '\n'
- + '@module ' + name + '\n');
-}
-
-
-// generate spec for the given list of classes
-function GENERATE_CLASSES(classes, parent) {
- return _.reduce(classes, function(memo, classSpec, className) {
- return memo
- + GENERATE_CLASS(className, classSpec.description, parent, classSpec.parent)
- + _.reduce(classSpec.methods, function(memo, methodSpec, methodName) {
- return memo += GENERATE_METHOD(methodName, methodSpec, className);
- }, '')
- + _.reduce(classSpec.variables, function(memo, variableSpec, variableName) {
- return memo += GENERATE_VAR(variableName, variableSpec, className);
- }, '')
- + _.reduce(classSpec.enums, function(memo, enumSpec, enumName) {
- return memo += GENERATE_ENUM(enumName, enumSpec, className);
- }, '');
- }, '');
-}
-
-
-// generate class spec
-function GENERATE_CLASS(name, description, namespace, parent) {
- return GENERATE_DOC(description + '\n'
- + '@class ' + name + '\n'
- + (namespace ? ('@module ' + namespace + '\n') : '')
- /*
- TODO: leave out until figure out what swig does with inheritance
- + (parent ? ('@extends ' + parent + '\n') : '')
- */
- );
-}
-
-
-// generate method spec with parent module/class
-function GENERATE_METHOD(name, spec, parent) {
- name = name.replace(/!+$/, '');
- return GENERATE_DOC(spec.description + '\n'
- + '@method ' + name + '\n'
- + (parent ? ('@for ' + parent + '\n') : '@for common\n')
- + _.reduce(spec.params, function(memo, paramSpec, paramName) {
- return memo + '@param {' + GENERATE_TYPE(paramSpec.type) + '} ' + paramName + ' ' + paramSpec.description + '\n';
- }, '')
- + ( !_.isEmpty(spec.return) ? ('@return {' + GENERATE_TYPE(spec.return.type) + '} ' + spec.return.description + '\n') : ''));
-}
-
-
-// generate enum spec
-function GENERATE_ENUM(name, spec, parent) {
- return GENERATE_DOC(spec.description + '\n'
- + '@property ' + name + '\n'
- + '@type Enum ' + spec.type + '\n'
- + '@for ' + (parent ? parent : 'common') + '\n');
-}
-
-
-// generate variable specs
-function GENERATE_VAR(name, spec, parent) {
- return GENERATE_DOC(spec.description + '\n'
- + '@property ' + name + '\n'
- + '@type ' + spec.type + '\n'
- + '@for ' + parent + '\n');
-}
-
-
-// TODO
-// generate link spec
-function GENERATE_LINK(text) {
- return '{{#crossLink "' + text + '"}}{{/crossLink}}';
-}
-
-
-module.exports = generateDocs; \ No newline at end of file
diff --git a/peripheral/libupm/doxy/node/generators/yuidoc/helper.js b/peripheral/libupm/doxy/node/generators/yuidoc/helper.js
deleted file mode 100644
index cdedaaf..0000000
--- a/peripheral/libupm/doxy/node/generators/yuidoc/helper.js
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- * Author: Heidi Pan <heidi.pan@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.
- */
-
-
-// extract the field from the class description text
-function getField(classDescription, field) {
- var pattern = new RegExp('\\+ __' + field + ':__ [A-Za-z0-9]*');
- var label = new RegExp('\\+ __' + field + ':__');
- if (classDescription) {
- var matched = classDescription.match(pattern);
- if (matched) {
- return (matched[0].replace(label, '')).trim();
- }
- }
- return 'other';
-}
-
-
-// generate html to group modules by the given field (e.g. category/connection type) of its children classes
-function listByGroup(modules, classes, field, projectRoot) {
-
- var moduleClasses = {};
- var modulesByGroup = {};
- var i, j;
- for (i = 0; i < modules.length; i++) {
- moduleClasses[modules[i].name] = [];
- }
- for (i = 0; i < classes.length; i++) {
- moduleClasses[classes[i].module].push(i);
- }
- for (var module in moduleClasses) {
- var classIndices = moduleClasses[module];
- var groups = [];
- for (i = 0; i < classIndices.length; i++) {
- groups.push(getField(classes[classIndices[i]].description, field));
- }
- if (groups.length != 0) {
- var group = groups[0];
- var sanitychecked = true;
- for (i = 1; i < groups.length; i++) {
- if (groups[i] != group) {
- sanitychecked = false;
- break;
- }
- }
- if (!sanitychecked) {
- // TODO
- }
- if (group in modulesByGroup) {
- modulesByGroup[group].push(module);
- } else {
- modulesByGroup[group] = [module];
- }
- }
- }
- var groups = Object.keys(modulesByGroup).sort();
- var html = '';
- var pfx = projectRoot + 'modules/';
- for (i = 0; i < groups.length; i++) {
- var group = groups[i];
- html += '<div class="upmGroup"><div class="right-arrow"></div>' + group + '</div><span class="upmModules" style="display:none">';
- var moduleNames = modulesByGroup[group];
- for (j = 0; j < moduleNames.length; j++) {
- var moduleName = moduleNames[j];
- html += '<a href="' + pfx + moduleName + '.html">' + moduleName + '</a>';
- }
- html += '</span>';
- }
- return html;
-}
-
-
-// click handler to change direction of arrow and toggle visibility of grouped modules
-var onClickHandler = "Y.on('domready', function() { \
- Y.on('click', function(e) { \
- var classes = this.next('.upmModules').toggleView(); \
- if (classes.getStyle('display') == 'none') { \
- this.one('> div').removeClass('down-arrow').addClass('right-arrow'); \
- } else { \
- this.one('> div').removeClass('right-arrow').addClass('down-arrow'); \
- } \
- }, '.upmGroup'); \
-});";
-
-
-// css to generate triangle icons
-var insertStyles = "Y.one(document.head).append('<style> \
- div.right-arrow { \
- width: 0; \
- height: 0; \
- border-bottom: 5px solid transparent; \
- border-top: 5px solid transparent; \
- border-left: 5px solid #356de4; \
- font-size: 0; \
- margin-right: 5px; \
- vertical-align: 5px; \
- float: left; \
- } \
- div.down-arrow { \
- width: 0; \
- height: 0; \
- border-left: 5px solid transparent; \
- border-right: 5px solid transparent; \
- border-top: 5px solid #356de4; \
- font-size: 0; \
- margin-right: 5px; \
- float: left; \
- } \
- div.upmGroup { \
- font-weight: bold; \
- } \
-</style>');";
-
-
-var scripts = "YUI().use('node', 'event', function (Y) {"
- + onClickHandler
-// + insertStyles
- + "});";
-
-
-module.exports = {
-
- listByCategory: function() {
- return listByGroup(this.modules, this.classes, 'Category', this.projectRoot);
- },
-
- listByManufacturer: function() {
- return listByGroup(this.modules, this.classes, 'Manufacturer', this.projectRoot);
- },
-
- listByConnection: function() {
- return listByGroup(this.modules, this.classes, 'Connection', this.projectRoot);
- },
-
- javascripts: function(options) {
- return '<script type="text/javascript">' + scripts + '</script>';
- },
-
- // generate custom cross links
- // assume lowercase script will be run, so generate class links with lower case
- customCrossLinks: function() {
- var selector = 'script[type="class-metadata"]'
- var html = "<script type='text/javascript'> \
- var find = function(ar, elem) { \
- for (var i = 0; i < ar.length; i++) { \
- if (ar[i] == elem) { \
- return true; \
- } \
- } \
- return false; \
- }; \
- YUI().use('node', 'event', function (Y) { \
- Y.on('domready', function() { \
- var classes = Y.all('" + selector + "').getHTML(); \
- for (var i = 0; i < classes.length; i++) { \
- classes[i] = classes[i].toLowerCase(); \
- } \
- Y.all('span.type').each(function(node) { \
- var t = node.getHTML(); \
- if (find(classes, t.toLowerCase())) { \
- node.setHTML('<a href=' + t.toLowerCase() + '.html>' + t + '</a>'); \
- } \
- }); \
- }); \
- }); \
- </script>";
- for (var i = 0; i < this.classes.length; i++) {
- html += "<script type='class-metadata'>" + this.classes[i].name + "</script>";
- }
- return html;
- }
-
-}; \ No newline at end of file
diff --git a/peripheral/libupm/doxy/node/generators/yuidoc/tmpl/LICENSE b/peripheral/libupm/doxy/node/generators/yuidoc/tmpl/LICENSE
deleted file mode 100644
index 841cfb7..0000000
--- a/peripheral/libupm/doxy/node/generators/yuidoc/tmpl/LICENSE
+++ /dev/null
@@ -1,27 +0,0 @@
-Original Work Copyright 2011 Yahoo! Inc.
-All rights reserved.
-
-Modified Work Copyright (c) 2015 Intel Corporation.
-Author: Heidi Pan <heidi.pan@intel.com>
-
-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 name of the Yahoo! Inc. 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 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 YAHOO! INC. 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. \ No newline at end of file
diff --git a/peripheral/libupm/doxy/node/generators/yuidoc/tmpl/assets/css/main.css b/peripheral/libupm/doxy/node/generators/yuidoc/tmpl/assets/css/main.css
deleted file mode 100644
index 911f751..0000000
--- a/peripheral/libupm/doxy/node/generators/yuidoc/tmpl/assets/css/main.css
+++ /dev/null
@@ -1,814 +0,0 @@
-/*
-Font sizes for all selectors other than the body are given in percentages,
-with 100% equal to 13px. To calculate a font size percentage, multiply the
-desired size in pixels by 7.6923076923.
-
-Here's a quick lookup table:
-
-10px - 76.923%
-11px - 84.615%
-12px - 92.308%
-13px - 100%
-14px - 107.692%
-15px - 115.385%
-16px - 123.077%
-17px - 130.769%
-18px - 138.462%
-19px - 146.154%
-20px - 153.846%
-*/
-
-html {
- background: #fff;
- color: #333;
- overflow-y: scroll;
-}
-
-body {
- /*font: 13px/1.4 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', 'Bitstream Vera Sans', 'Helvetica', 'Arial', sans-serif;*/
- font: 13px/1.4 'Helvetica', 'Arial', sans-serif;
- margin: 0;
- padding: 0;
-}
-
-/* -- Links ----------------------------------------------------------------- */
-a {
- color: #356de4;
- text-decoration: none;
-}
-
-.hidden {
- display: none;
-}
-
-a:hover { text-decoration: underline; }
-
-/* "Jump to Table of Contents" link is shown to assistive tools, but hidden from
- sight until it's focused. */
-.jump {
- position: absolute;
- padding: 3px 6px;
- left: -99999px;
- top: 0;
-}
-
-.jump:focus { left: 40%; }
-
-/* -- Paragraphs ------------------------------------------------------------ */
-p { margin: 1.3em 0; }
-dd p, td p { margin-bottom: 0; }
-dd p:first-child, td p:first-child { margin-top: 0; }
-
-/* -- Headings -------------------------------------------------------------- */
-h1, h2, h3, h4, h5, h6 {
- color: #D98527;/*was #f80*/
- font-family: 'Trebuchet MS', sans-serif;
- font-weight: bold;
- line-height: 1.1;
- margin: 1.1em 0 0.5em;
-}
-
-h1 {
- font-size: 184.6%;
- color: #30418C;
- margin: 0.75em 0 0.5em;
-}
-
-h2 {
- font-size: 153.846%;
- color: #E48A2B;
-}
-
-h3 { font-size: 138.462%; }
-
-h4 {
- border-bottom: 1px solid #DBDFEA;
- color: #E48A2B;
- font-size: 115.385%;
- font-weight: normal;
- padding-bottom: 2px;
-}
-
-h5, h6 { font-size: 107.692%; }
-
-/* -- Code and examples ----------------------------------------------------- */
-code, kbd, pre, samp {
- font-family: Menlo, Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;
- font-size: 92.308%;
- line-height: 1.35;
-}
-
-p code, p kbd, p samp, li code {
- background: #FCFBFA;
- border: 1px solid #EFEEED;
- padding: 0 3px;
-}
-
-a code, a kbd, a samp,
-pre code, pre kbd, pre samp,
-table code, table kbd, table samp,
-.intro code, .intro kbd, .intro samp,
-.toc code, .toc kbd, .toc samp {
- background: none;
- border: none;
- padding: 0;
-}
-
-pre.code, pre.terminal, pre.cmd {
- overflow-x: auto;
- *overflow-x: scroll;
- padding: 0.3em 0.6em;
-}
-
-pre.code {
- background: #FCFBFA;
- border: 1px solid #EFEEED;
- border-left-width: 5px;
-}
-
-pre.terminal, pre.cmd {
- background: #F0EFFC;
- border: 1px solid #D0CBFB;
- border-left: 5px solid #D0CBFB;
-}
-
-/* Don't reduce the font size of <code>/<kbd>/<samp> elements inside <pre>
- blocks. */
-pre code, pre kbd, pre samp { font-size: 100%; }
-
-/* Used to denote text that shouldn't be selectable, such as line numbers or
- shell prompts. Guess which browser this doesn't work in. */
-.noselect {
- -moz-user-select: -moz-none;
- -khtml-user-select: none;
- -webkit-user-select: none;
- -o-user-select: none;
- user-select: none;
-}
-
-/* -- Lists ----------------------------------------------------------------- */
-dd { margin: 0.2em 0 0.7em 1em; }
-dl { margin: 1em 0; }
-dt { font-weight: bold; }
-
-/* -- Tables ---------------------------------------------------------------- */
-caption, th { text-align: left; }
-
-table {
- border-collapse: collapse;
- width: 100%;
-}
-
-td, th {
- border: 1px solid #fff;
- padding: 5px 12px;
- vertical-align: top;
-}
-
-td { background: #E6E9F5; }
-td dl { margin: 0; }
-td dl dl { margin: 1em 0; }
-td pre:first-child { margin-top: 0; }
-
-th {
- background: #D2D7E6;/*#97A0BF*/
- border-bottom: none;
- border-top: none;
- color: #000;/*#FFF1D5*/
- font-family: 'Trebuchet MS', sans-serif;
- font-weight: bold;
- line-height: 1.3;
- white-space: nowrap;
-}
-
-
-/* -- Layout and Content ---------------------------------------------------- */
-#doc {
- margin: auto;
- min-width: 1024px;
-}
-
-.content { padding: 0 20px 0 25px; }
-
-.sidebar {
- padding: 0 15px 0 10px;
-}
-#bd {
- padding: 7px 0 130px;
- position: relative;
- width: 99%;
-}
-
-/* -- Table of Contents ----------------------------------------------------- */
-
-/* The #toc id refers to the single global table of contents, while the .toc
- class refers to generic TOC lists that could be used throughout the page. */
-
-.toc code, .toc kbd, .toc samp { font-size: 100%; }
-.toc li { font-weight: bold; }
-.toc li li { font-weight: normal; }
-
-/* -- Intro and Example Boxes ----------------------------------------------- */
-/*
-.intro, .example { margin-bottom: 2em; }
-.example {
- -moz-border-radius: 4px;
- -webkit-border-radius: 4px;
- border-radius: 4px;
- -moz-box-shadow: 0 0 5px #bfbfbf;
- -webkit-box-shadow: 0 0 5px #bfbfbf;
- box-shadow: 0 0 5px #bfbfbf;
- padding: 1em;
-}
-.intro {
- background: none repeat scroll 0 0 #F0F1F8; border: 1px solid #D4D8EB; padding: 0 1em;
-}
-*/
-
-/* -- Other Styles ---------------------------------------------------------- */
-
-/* These are probably YUI-specific, and should be moved out of Selleck's default
- theme. */
-
-.button {
- border: 1px solid #dadada;
- -moz-border-radius: 3px;
- -webkit-border-radius: 3px;
- border-radius: 3px;
- color: #444;
- display: inline-block;
- font-family: Helvetica, Arial, sans-serif;
- font-size: 92.308%;
- font-weight: bold;
- padding: 4px 13px 3px;
- -moz-text-shadow: 1px 1px 0 #fff;
- -webkit-text-shadow: 1px 1px 0 #fff;
- text-shadow: 1px 1px 0 #fff;
- white-space: nowrap;
-
- background: #EFEFEF; /* old browsers */
- background: -moz-linear-gradient(top, #f5f5f5 0%, #efefef 50%, #e5e5e5 51%, #dfdfdf 100%); /* firefox */
- background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f5f5f5), color-stop(50%,#efefef), color-stop(51%,#e5e5e5), color-stop(100%,#dfdfdf)); /* webkit */
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f5f5f5', endColorstr='#dfdfdf',GradientType=0 ); /* ie */
-}
-
-.button:hover {
- border-color: #466899;
- color: #fff;
- text-decoration: none;
- -moz-text-shadow: 1px 1px 0 #222;
- -webkit-text-shadow: 1px 1px 0 #222;
- text-shadow: 1px 1px 0 #222;
-
- background: #6396D8; /* old browsers */
- background: -moz-linear-gradient(top, #6396D8 0%, #5A83BC 50%, #547AB7 51%, #466899 100%); /* firefox */
- background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#6396D8), color-stop(50%,#5A83BC), color-stop(51%,#547AB7), color-stop(100%,#466899)); /* webkit */
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#6396D8', endColorstr='#466899',GradientType=0 ); /* ie */
-}
-
-.newwindow { text-align: center; }
-
-.header .version em {
- display: block;
- text-align: right;
-}
-
-
-#classdocs .item {
- border-bottom: 1px solid #466899;
- margin: 1em 0;
- padding: 1.5em;
-}
-
-#classdocs .item .params p,
- #classdocs .item .returns p,{
- display: inline;
-}
-
-#classdocs .item em code, #classdocs .item em.comment {
- color: green;
-}
-
-#classdocs .item em.comment a {
- color: green;
- text-decoration: underline;
-}
-
-#classdocs .foundat {
- font-size: 11px;
- font-style: normal;
-}
-
-.attrs .emits {
- margin-left: 2em;
- padding: .5em;
- border-left: 1px dashed #ccc;
-}
-
-abbr {
- border-bottom: 1px dashed #ccc;
- font-size: 80%;
- cursor: help;
-}
-
-.prettyprint li.L0,
-.prettyprint li.L1,
-.prettyprint li.L2,
-.prettyprint li.L3,
-.prettyprint li.L5,
-.prettyprint li.L6,
-.prettyprint li.L7,
-.prettyprint li.L8 {
- list-style: decimal;
-}
-
-ul li p {
- margin-top: 0;
-}
-
-.method .name {
- font-size: 110%;
-}
-
-.apidocs .methods .extends .method,
-.apidocs .properties .extends .property,
-.apidocs .attrs .extends .attr,
-.apidocs .events .extends .event {
- font-weight: bold;
-}
-
-.apidocs .methods .extends .inherited,
-.apidocs .properties .extends .inherited,
-.apidocs .attrs .extends .inherited,
-.apidocs .events .extends .inherited {
- font-weight: normal;
-}
-
-#hd {
- background: whiteSmoke;
- background: -moz-linear-gradient(top,#DCDBD9 0,#F6F5F3 100%);
- background: -webkit-gradient(linear,left top,left bottom,color-stop(0%,#DCDBD9),color-stop(100%,#F6F5F3));
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#dcdbd9',endColorstr='#F6F5F3',GradientType=0);
- border-bottom: 1px solid #DFDFDF;
- padding: 0 15px 1px 20px;
- margin-bottom: 15px;
-}
-
-#hd img {
- margin-right: 10px;
- vertical-align: middle;
-
-}
-
-
-img {
- max-height: 300px;
-}
-
-
-/* -- API Docs CSS ---------------------------------------------------------- */
-
-/*
-This file is organized so that more generic styles are nearer the top, and more
-specific styles are nearer the bottom of the file. This allows us to take full
-advantage of the cascade to avoid redundant style rules. Please respect this
-convention when making changes.
-*/
-
-/* -- Generic TabView styles ------------------------------------------------ */
-
-/*
-These styles apply to all API doc tabviews. To change styles only for a
-specific tabview, see the other sections below.
-*/
-
-.yui3-js-enabled .apidocs .tabview {
- visibility: hidden; /* Hide until the TabView finishes rendering. */
- _visibility: visible;
-}
-
-.apidocs .tabview.yui3-tabview-content { visibility: visible; }
-.apidocs .tabview .yui3-tabview-panel { background: #fff; }
-
-/* -- Generic Content Styles ------------------------------------------------ */
-
-/* Headings */
-h2, h3, h4, h5, h6 {
- border: none;
- color: #30418C;
- font-weight: bold;
- text-decoration: none;
-}
-
-.link-docs {
- float: right;
- font-size: 15px;
- margin: 4px 4px 6px;
- padding: 6px 30px 5px;
-}
-
-.apidocs { zoom: 1; }
-
-/* Generic box styles. */
-.apidocs .box {
- border: 1px solid;
- border-radius: 3px;
- margin: 1em 0;
- padding: 0 1em;
-}
-
-/* A flag is a compact, capsule-like indicator of some kind. It's used to
- indicate private and protected items, item return types, etc. in an
- attractive and unobtrusive way. */
-.apidocs .flag {
- background: #bababa;
- border-radius: 3px;
- color: #fff;
- font-size: 11px;
- margin: 0 0.5em;
- padding: 2px 4px 1px;
-}
-
-/* Class/module metadata such as "Uses", "Extends", "Defined in", etc. */
-.apidocs .meta {
- background: #f9f9f9;
- border-color: #efefef;
- color: #555;
- font-size: 11px;
- padding: 3px 6px;
-}
-
-.apidocs .meta p { margin: 0; }
-
-/* Deprecation warning. */
-.apidocs .box.deprecated,
-.apidocs .flag.deprecated {
- background: #fdac9f;
- border: 1px solid #fd7775;
-}
-
-.apidocs .box.deprecated p { margin: 0.5em 0; }
-.apidocs .flag.deprecated { color: #333; }
-
-/* Module/Class intro description. */
-.apidocs .intro {
- background: #f0f1f8;
- border-color: #d4d8eb;
-}
-
-/* Loading spinners. */
-#bd.loading .apidocs,
-#api-list.loading .yui3-tabview-panel {
- background: #fff url(../img/spinner.gif) no-repeat center 70px;
- min-height: 150px;
-}
-
-#bd.loading .apidocs .content,
-#api-list.loading .yui3-tabview-panel .apis {
- display: none;
-}
-
-.apidocs .no-visible-items { color: #666; }
-
-/* Generic inline list. */
-.apidocs ul.inline {
- display: inline;
- list-style: none;
- margin: 0;
- padding: 0;
-}
-
-.apidocs ul.inline li { display: inline; }
-
-/* Comma-separated list. */
-.apidocs ul.commas li:after { content: ','; }
-.apidocs ul.commas li:last-child:after { content: ''; }
-
-/* Keyboard shortcuts. */
-kbd .cmd { font-family: Monaco, Helvetica; }
-
-/* -- Generic Access Level styles ------------------------------------------- */
-.apidocs .item.protected,
-.apidocs .item.private,
-.apidocs .index-item.protected,
-.apidocs .index-item.deprecated,
-.apidocs .index-item.private {
- display: none;
-}
-
-.show-deprecated .item.deprecated,
-.show-deprecated .index-item.deprecated,
-.show-protected .item.protected,
-.show-protected .index-item.protected,
-.show-private .item.private,
-.show-private .index-item.private {
- display: block;
-}
-
-.hide-inherited .item.inherited,
-.hide-inherited .index-item.inherited {
- display: none;
-}
-
-/* -- Generic Item Index styles --------------------------------------------- */
-.apidocs .index { margin: 1.5em 0 3em; }
-
-.apidocs .index h3 {
- border-bottom: 1px solid #efefef;
- color: #333;
- font-size: 13px;
- margin: 2em 0 0.6em;
- padding-bottom: 2px;
-}
-
-.apidocs .index .no-visible-items { margin-top: 2em; }
-
-.apidocs .index-list {
- border-color: #efefef;
- font-size: 12px;
- list-style: none;
- margin: 0;
- padding: 0;
- -moz-column-count: 4;
- -moz-column-gap: 10px;
- -moz-column-width: 170px;
- -ms-column-count: 4;
- -ms-column-gap: 10px;
- -ms-column-width: 170px;
- -o-column-count: 4;
- -o-column-gap: 10px;
- -o-column-width: 170px;
- -webkit-column-count: 4;
- -webkit-column-gap: 10px;
- -webkit-column-width: 170px;
- column-count: 4;
- column-gap: 10px;
- column-width: 170px;
-}
-
-.apidocs .no-columns .index-list {
- -moz-column-count: 1;
- -ms-column-count: 1;
- -o-column-count: 1;
- -webkit-column-count: 1;
- column-count: 1;
-}
-
-.apidocs .index-item { white-space: nowrap; }
-
-.apidocs .index-item .flag {
- background: none;
- border: none;
- color: #afafaf;
- display: inline;
- margin: 0 0 0 0.2em;
- padding: 0;
-}
-
-/* -- Generic API item styles ----------------------------------------------- */
-.apidocs .args {
- display: inline;
- margin: 0 0.5em;
-}
-
-.apidocs .flag.chainable { background: #46ca3b; }
-.apidocs .flag.protected { background: #9b86fc; }
-.apidocs .flag.private { background: #fd6b1b; }
-.apidocs .flag.async { background: #356de4; }
-.apidocs .flag.required { background: #e60923; }
-
-.apidocs .item {
- border-bottom: 1px solid #efefef;
- margin: 1.5em 0 2em;
- padding-bottom: 2em;
-}
-
-.apidocs .item h4,
-.apidocs .item h5,
-.apidocs .item h6 {
- color: #333;
- font-family: inherit;
- font-size: 100%;
-}
-
-.apidocs .item .description p,
-.apidocs .item pre.code {
- margin: 1em 0 0;
-}
-
-.apidocs .item .meta {
- background: none;
- border: none;
- padding: 0;
-}
-
-.apidocs .item .name {
- display: inline;
- font-size: 14px;
-}
-
-.apidocs .item .type,
-.apidocs .item .type a,
-.apidocs .returns-inline {
- color: #555;
-}
-
-.apidocs .item .type,
-.apidocs .returns-inline {
- font-size: 11px;
- margin: 0 0 0 0;
-}
-
-.apidocs .item .type a { border-bottom: 1px dotted #afafaf; }
-.apidocs .item .type a:hover { border: none; }
-
-/* -- Item Parameter List --------------------------------------------------- */
-.apidocs .params-list {
- list-style: square;
- margin: 1em 0 0 2em;
- padding: 0;
-}
-
-.apidocs .param { margin-bottom: 1em; }
-
-.apidocs .param .type,
-.apidocs .param .type a {
- color: #666;
-}
-
-.apidocs .param .type {
- margin: 0 0 0 0.5em;
- *margin-left: 0.5em;
-}
-
-.apidocs .param-name { font-weight: bold; }
-
-/* -- Item "Emits" block ---------------------------------------------------- */
-.apidocs .item .emits {
- background: #f9f9f9;
- border-color: #eaeaea;
-}
-
-/* -- Item "Returns" block -------------------------------------------------- */
-.apidocs .item .returns .type,
-.apidocs .item .returns .type a {
- font-size: 100%;
- margin: 0;
-}
-
-/* -- Class Constructor block ----------------------------------------------- */
-.apidocs .constructor .item {
- border: none;
- padding-bottom: 0;
-}
-
-/* -- File Source View ------------------------------------------------------ */
-.apidocs .file pre.code,
-#doc .apidocs .file pre.prettyprint {
- background: inherit;
- border: none;
- overflow: visible;
- padding: 0;
-}
-
-.apidocs .L0,
-.apidocs .L1,
-.apidocs .L2,
-.apidocs .L3,
-.apidocs .L4,
-.apidocs .L5,
-.apidocs .L6,
-.apidocs .L7,
-.apidocs .L8,
-.apidocs .L9 {
- background: inherit;
-}
-
-/* -- Submodule List -------------------------------------------------------- */
-.apidocs .module-submodule-description {
- font-size: 12px;
- margin: 0.3em 0 1em;
-}
-
-.apidocs .module-submodule-description p:first-child { margin-top: 0; }
-
-/* -- Sidebar TabView ------------------------------------------------------- */
-#api-tabview { margin-top: 0.6em; }
-
-#api-tabview-filter,
-#api-tabview-panel {
- border: 1px solid #dfdfdf;
-}
-
-#api-tabview-filter {
- border-bottom: none;
- border-top: none;
- padding: 0.6em 10px 0 10px;
-}
-
-#api-tabview-panel { border-top: none; }
-#api-filter { width: 97%; }
-
-/* -- Content TabView ------------------------------------------------------- */
-#classdocs .yui3-tabview-panel { border: none; }
-
-/* -- Source File Contents -------------------------------------------------- */
-.prettyprint li.L0,
-.prettyprint li.L1,
-.prettyprint li.L2,
-.prettyprint li.L3,
-.prettyprint li.L5,
-.prettyprint li.L6,
-.prettyprint li.L7,
-.prettyprint li.L8 {
- list-style: decimal;
-}
-
-/* -- API options ----------------------------------------------------------- */
-#api-options {
- font-size: 11px;
- margin-top: 2.2em;
- position: absolute;
- right: 1.5em;
-}
-
-/*#api-options label { margin-right: 0.6em; }*/
-
-/* -- API list -------------------------------------------------------------- */
-#api-list {
- margin-top: 1.5em;
- *zoom: 1;
-}
-
-.apis {
- font-size: 12px;
- line-height: 1.4;
- list-style: none;
- margin: 0;
- padding: 0.5em 0 0.5em 0.4em;
-}
-
-.apis a {
- border: 1px solid transparent;
- display: block;
- margin: 0 0 0 -4px;
- padding: 1px 4px 0;
- text-decoration: none;
- _border: none;
- _display: inline;
-}
-
-.apis a:hover,
-.apis a:focus {
- background: #E8EDFC;
- background: -moz-linear-gradient(top, #e8edfc 0%, #becef7 100%);
- background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#E8EDFC), color-stop(100%,#BECEF7));
- border-color: #AAC0FA;
- border-radius: 3px;
- color: #333;
- outline: none;
-}
-
-.api-list-item a:hover,
-.api-list-item a:focus {
- font-weight: bold;
- text-shadow: 1px 1px 1px #fff;
-}
-
-.apis .message { color: #888; }
-.apis .result a { padding: 3px 5px 2px; }
-
-.apis .result .type {
- right: 4px;
- top: 7px;
-}
-
-.api-list-item .yui3-highlight {
- font-weight: bold;
-}
-
-div.right-arrow {
- width: 0;
- height: 0;
- border-bottom: 5px solid transparent;
- border-top: 5px solid transparent;
- border-left: 5px solid #356de4;
- font-size: 0;
- margin-right: 5px;
- float: left;
- }
-
-div.down-arrow {
- width: 0;
- height: 0;
- border-left: 5px solid transparent;
- border-right: 5px solid transparent;
- border-top: 5px solid #356de4;
- font-size: 0;
- margin-right: 5px;
- float: left;
-}
-
-div.upmGroup {
- font-weight: bold;
-}
diff --git a/peripheral/libupm/doxy/node/generators/yuidoc/tmpl/layouts/main.handlebars b/peripheral/libupm/doxy/node/generators/yuidoc/tmpl/layouts/main.handlebars
deleted file mode 100644
index 82aa193..0000000
--- a/peripheral/libupm/doxy/node/generators/yuidoc/tmpl/layouts/main.handlebars
+++ /dev/null
@@ -1,53 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-<head>
- <meta charset="utf-8">
- <title>{{htmlTitle}}</title>
- <link rel="stylesheet" href="{{yuiGridsUrl}}">
- <link rel="stylesheet" href="{{projectAssets}}/vendor/prettify/prettify-min.css">
- <link rel="stylesheet" href="{{projectAssets}}/css/main.css" id="site_styles">
- <link rel="icon" href="{{projectAssets}}/favicon.ico">
- <script src="{{yuiSeedUrl}}"></script>
-</head>
-<body class="yui3-skin-sam">
-
-<div id="doc">
- <div id="hd" class="yui3-g header">
- <div class="yui3-u-3-4">
- <h1>UPM</h1>
- <p>
- The UPM API is a high level sensor library for IoT devices using MRAA. See examples <a href="https://github.com/intel-iot-devkit/upm/tree/master/examples/javascript">here</a>.
- Back to <a href="http://iotdk.intel.com/docs/master/upm/node/"> index </a> page.
- <br><em>SparkFun sensor images provided under <a href=https://creativecommons.org/licenses/by-nc-sa/3.0/>CC BY-NC-SA-3.0</a>.</em>
- </p>
- </div>
- </div>
- <div id="bd" class="yui3-g">
-
- <div class="yui3-u-1-4">
- <div id="docs-sidebar" class="sidebar apidocs">
- {{>sidebar}}
- </div>
- </div>
- <div class="yui3-u-3-4">
- {{>options}}
- <div class="apidocs">
- <div id="docs-main">
- <div class="content">
- {{>layout_content}}
- </div>
- </div>
- </div>
- </div>
- </div>
-</div>
-<script src="{{projectAssets}}/vendor/prettify/prettify-min.js"></script>
-<script>prettyPrint();</script>
-<script src="{{projectAssets}}/js/yui-prettify.js"></script>
-<script src="{{projectAssets}}/../api.js"></script>
-<script src="{{projectAssets}}/js/api-filter.js"></script>
-<script src="{{projectAssets}}/js/api-list.js"></script>
-<script src="{{projectAssets}}/js/api-search.js"></script>
-<script src="{{projectAssets}}/js/apidocs.js"></script>
-</body>
-</html>
diff --git a/peripheral/libupm/doxy/node/generators/yuidoc/tmpl/partials/classes.handlebars b/peripheral/libupm/doxy/node/generators/yuidoc/tmpl/partials/classes.handlebars
deleted file mode 100644
index 01bad1a..0000000
--- a/peripheral/libupm/doxy/node/generators/yuidoc/tmpl/partials/classes.handlebars
+++ /dev/null
@@ -1,205 +0,0 @@
-<h1>{{name}} Class</h1>
-<div class="box meta">
- {{#if uses}}
- <div class="uses">
- Uses
- <ul class="inline commas">
- {{#uses}}
- <li><a href="{{.}}.html">{{.}}</a></li>
- {{/uses}}
- </ul>
- </div>
- {{/if}}
-
- {{#if extends}}
- <div class="extends">
- Extends {{#crossLink extends}}{{/crossLink}}
- </div>
- {{/if}}
-
- {{#if foundAt}}
- <div class="foundat">
- Defined in: <a href="{{foundAt}}">`{{{file}}}:{{{line}}}`</a>
- </div>
- {{/if}}
-
- {{#if module}}
- {{#if submodule}}
- Module: {{#crossLinkModule submodule}}{{/crossLinkModule}}<br>
- Parent Module: {{#crossLinkModule module}}{{/crossLinkModule}}
- {{else}}
- Module: {{#crossLinkModule module}}{{/crossLinkModule}}
- {{/if}}
- {{/if}}
-
- {{#if since}}
- <p>Available since {{since}}</p>
- {{/if}}
-</div>
-
-{{#if deprecated}}
- <div class="box deprecated">
- <p>
- {{#if deprecationMessage}}
- <strong>Deprecated:</strong> {{deprecationMessage}}
- {{else}}
- This class is deprecated.
- {{/if}}
- </p>
- </div>
-{{/if}}
-
-<div class="box intro">
- {{{classDescription}}}
-</div>
-
-{{#is_constructor}}
- <div class="constructor">
- <h2>Constructor</h2>
-{{>method}}
- </div>
-{{/is_constructor}}
-
-<div id="classdocs" class="tabview">
- <ul class="api-class-tabs">
- <li class="api-class-tab index"><a href="#index">Index</a></li>
-
- {{#if methods}}
- <li class="api-class-tab methods"><a href="#methods">Methods</a></li>
- {{/if}}
- {{#if properties}}
- <li class="api-class-tab properties"><a href="#properties">Properties</a></li>
- {{/if}}
- {{#if attrs}}
- <li class="api-class-tab attrs"><a href="#attrs">Attributes</a></li>
- {{/if}}
- {{#if events}}
- <li class="api-class-tab events"><a href="#events">Events</a></li>
- {{/if}}
- </ul>
-
- <div>
- <div id="index" class="api-class-tabpanel index">
- <h2 class="off-left">Item Index</h2>
-
- {{#if methods}}
- <div class="index-section methods">
- <h3>Methods</h3>
-
- <ul class="index-list methods{{#if extends}} extends{{/if}}">
- {{#methods}}
- <li class="index-item method{{#if access}} {{access}}{{/if}}{{#if deprecated}} deprecated{{/if}}{{#if overwritten_from}} inherited{{/if}}{{#if extended_from}} inherited{{/if}}">
- <a href="#method_{{name}}">{{name}}</a>
-
- {{#if static}}
- <span class="flag static">static</span>
- {{/if}}
- {{#if deprecated}}
- <span class="flag deprecated">deprecated</span>
- {{/if}}
- </li>
- {{/methods}}
- </ul>
- </div>
- {{/if}}
-
- {{#if properties}}
- <div class="index-section properties">
- <h3>Properties</h3>
-
- <ul class="index-list properties{{#if extends}} extends{{/if}}">
- {{#properties}}
- <li class="index-item property{{#if access}} {{access}}{{/if}}{{#if deprecated}} deprecated{{/if}}{{#if overwritten_from}} inherited{{/if}}{{#if extended_from}} inherited{{/if}}">
- <a href="#property_{{name}}">{{name}}</a>
-
- {{#if static}}
- <span class="flag static">static</span>
- {{/if}}
- {{#if deprecated}}
- <span class="flag deprecated">deprecated</span>
- {{/if}}
- </li>
- {{/properties}}
- </ul>
- </div>
- {{/if}}
-
- {{#if attrs}}
- <div class="index-section attrs">
- <h3>Attributes</h3>
-
- <ul class="index-list attrs{{#if extends}} extends{{/if}}">
- {{#attrs}}
- <li class="index-item attr{{#if access}} {{access}}{{/if}}{{#if deprecated}} deprecated{{/if}}{{#if overwritten_from}} inherited{{/if}}{{#if extended_from}} inherited{{/if}}">
- <a href="#attr_{{name}}">{{name}}</a>
- </li>
- {{/attrs}}
- </ul>
- </div>
- {{/if}}
-
- {{#if events}}
- <div class="index-section events">
- <h3>Events</h3>
-
- <ul class="index-list events{{#if extends}} extends{{/if}}">
- {{#events}}
- <li class="index-item event{{#if access}} {{access}}{{/if}}{{#if deprecated}} deprecated{{/if}}{{#if overwritten_from}} inherited{{/if}}{{#if extended_from}} inherited{{/if}}">
- <a href="#event_{{name}}">{{name}}</a>
-
- {{#if static}}
- <span class="flag static">static</span>
- {{/if}}
- {{#if deprecated}}
- <span class="flag deprecated">deprecated</span>
- {{/if}}
- </li>
- {{/events}}
- </ul>
- </div>
- {{/if}}
- </div>
-
- {{#if methods}}
- <div id="methods" class="api-class-tabpanel">
- <h2 class="off-left">Methods</h2>
-
- {{#methods}}
-{{>method}}
- {{/methods}}
- </div>
- {{/if}}
-
- {{#if properties}}
- <div id="properties" class="api-class-tabpanel">
- <h2 class="off-left">Properties</h2>
-
- {{#properties}}
- {{>props}}
- {{/properties}}
- </div>
- {{/if}}
-
- {{#if attrs}}
- <div id="attrs" class="api-class-tabpanel">
- <h2 class="off-left">Attributes</h2>
-
- {{#attrs}}
- {{>attrs}}
- {{/attrs}}
- </div>
- {{/if}}
-
- {{#if events}}
- <div id="events" class="api-class-tabpanel">
- <h2 class="off-left">Events</h2>
-
- {{#events}}
- {{>events}}
- {{/events}}
- </div>
- {{/if}}
- </div>
-</div>
-
-{{{customCrossLinks}}}
diff --git a/peripheral/libupm/doxy/node/generators/yuidoc/tmpl/partials/index.handlebars b/peripheral/libupm/doxy/node/generators/yuidoc/tmpl/partials/index.handlebars
deleted file mode 100644
index 9b893b5..0000000
--- a/peripheral/libupm/doxy/node/generators/yuidoc/tmpl/partials/index.handlebars
+++ /dev/null
@@ -1,180 +0,0 @@
-<div class="apidocs">
- <div class="content" id="docs-main">
- <h1><strong>Welcome to UPM Node.JS Documentation!</strong><a class="headerlink"
- href="#welcome-to-upm-python-documentation"></a></h1>
-
-
- <p>Browse to a module or class using the sidebar to view its API
- documentation.</p>
-
- <p>UPM is a high level repository for sensors that use MRAA. Each
- sensor links to MRAA and are not meant to be interlinked although
- some groups of sensors may be. Each sensor contains a header which
- allows to interface with it. Typically a sensor is represented as a
- class and instantiated.</p>
-
- <p>The constructor is expected to initialise the sensor and parameters
- may be used to provide identification/pin location on the board.</p>
-
- <p>Typically an update() function will be called in order to get new
- data from the sensor in order to reduce load when doing multiple reads
- to sensor data.</p>
- <div class="section" id="examples">
- <h3><code class="docutils literal"><span class="pre">Examples</span></code><a class="headerlink"
- href="#examples"
- title="Permalink to this headline">*</a></h3>
-
-
- <p>Multi-sensor samples for the starter and specialized kits can be
- found in the
- <a class="reference external"
- href="https://github.com/intel-iot-devkit/iot-devkit-samples">iot-devkit-samples</a>
- repository.</p>
-
- <p>Individual sensor usage examples for node.js are available
- <a class="reference external"
- href="https://github.com/intel-iot-devkit/upm/tree/master/examples/javascript">here</a>.</p>
-
- </div>
- <div class="section" id="ide">
- <h3><tt class="docutils literal"><span class="pre">IDE Compatibility</span>
- <span class="pre">UPM</span></tt><a class="headerlink"
- href="#ide"
- title="Permalink to this headline">*</a></h3>
-
-
- <p>Intel&reg; XDK IoT Edition is the recommended IDE for Node.js development.
- Visit the Intel&reg; Developer Zone IDE page for more information on how to get
- started.<br>
- <a href="https://software.intel.com/iot/software/ide"><img src="../docs/icons/xdk.png"/></a>
- </p>
- </div>
- <div class="section" id="building-upm">
- <h3><tt class="docutils literal"><span class="pre">Building</span>
- <span class="pre">UPM</span></tt><a class="headerlink"
- href="#building-upm"
- title="Permalink to this headline">*</a></h3>
-
-
- <p>For building UPM, please follow this
- <a class="reference external"
- href="https://github.com/intel-iot-devkit/upm/blob/master/docs/building.md">link</a>.</p>
-
- </div>
- <div class="section" id="making-your-own-upm-module">
- <h3><tt class="docutils literal"><span class="pre">Making</span>
- <span class="pre">your</span> <span class="pre">own</span>
- <span class="pre">UPM</span> <span class="pre">Module</span></tt><a class="headerlink"
- href="#making-your-own-upm-module"
- title="Permalink to this headline">*</a></h3>
-
-
- <p>This
- <a class="reference external"
- href="https://github.com/intel-iot-devkit/upm/blob/master/docs/porting.md">link</a>
- has more information on making a new UPM module.</p>
-
- <p>There is also an example available for max31855
- <a class="reference external"
- href="https://github.com/intel-iot-devkit/upm/blob/master/docs/max31855.md">sensor</a>.</p>
-
- </div>
- <div class="section"
- id="naming-conventions-and-rules-for-new-upm-contributions">
- <h3><tt class="docutils literal"><span class="pre">Naming</span>
- <span class="pre">Conventions</span> <span class="pre">and</span>
- <span class="pre">Rules</span> <span class="pre">for</span>
- <span class="pre">New</span> <span class="pre">UPM</span>
- <span class="pre">Contributions</span></tt><a class="headerlink"
- href="#naming-conventions-and-rules-for-new-upm-contributions"
- title="Permalink to this headline">*</a></h3>
-
-
- <p>Before you begin development, please take a look at our naming
- <a class="reference external"
- href="https://github.com/intel-iot-devkit/upm/blob/master/docs/naming.md">conventions</a>.</p>
-
-
- <p>Also, please read the guidelines for contributions to
- <a class="reference external"
- href="https://github.com/intel-iot-devkit/upm/blob/master/docs/contributions.md">UPM</a>.</p>
-
-
- <p>Don&rsquo;t forget to check the documentation
- <a class="reference external"
- href="https://github.com/intel-iot-devkit/upm/blob/master/docs/documentation.md">section</a>.</p>
-
- <div class="admonition note">
-
- <p class="first admonition-title">Note</p>
- <ul class="last simple">
- <li>Make sure you add yourself as an author on every new code
- file submitted.</li>
- <li>If you are providing a fix with significant changes, feel
- free to add yourself as a contributor.</li>
- <li>Signing-off your commits is mandatory.</li>
- </ul>
- </div>
- </div>
- <div class="section" id="api-documentation">
- <h1><strong>Other API Documentation</strong><a class="headerlink"
- href="#api-documentation"
- title="Permalink to this headline"></a></h1>
-
-
- <p><a href="http://iotdk.intel.com/docs/master/upm"><img src="../docs/icons/c++.png" /></a>
- <a href="http://iotdk.intel.com/docs/master/upm/java"><img src="../docs/icons/java.png" /></a>
- <a href="http://iotdk.intel.com/docs/master/upm/python"><img src="../docs/icons/python.png" /></a>
- <a href="http://iotdk.intel.com/docs/master/upm/node"><img src="../docs/icons/node.png" /></a>
- </p>
- </div>
- <div class="section" id="version-changelog">
- <h3><tt class="docutils literal"><span class="pre">Version</span>
- <span class="pre">Changelog</span></tt><a class="headerlink"
- href="#version-changelog"
- title="Permalink to this headline">*</a></h3>
-
-
- <p>For our Version Changelog, please see
- <a class="reference external"
- href="https://github.com/intel-iot-devkit/upm/blob/master/docs/changelog.md">here</a>.</p>
-
- </div>
- <div class="section" id="known-limitations">
- <h3><tt class="docutils literal"><span class="pre">Known</span>
- <span class="pre">Limitations</span></tt><a class="headerlink"
- href="#known-limitations"
- title="Permalink to this headline">*</a></h3>
-
-
- <p>For the List of Known Limitations, please see
- <a class="reference external"
- href="https://github.com/intel-iot-devkit/upm/blob/master/docs/knownlimitations.md">here</a>.</p>
-
- </div>
- <div class="section" id="keyboard-shortcuts">
- <h3><tt class="docutils literal"><span class="pre">Keyboard</span>
- <span class="pre">Shortcuts</span></tt><a class="headerlink"
- href="#keyboard-shortcuts"
- title="Permalink to this headline">*</a></h3>
-
- <ul>
- <li>
-
- <p>Press <kbd>s</kbd> to focus the API search box.</p> </li>
- <li>
-
- <p>Use <kbd>Up</kbd> and <kbd>Down</kbd> to select classes,
- modules, and search results.</p> </li>
- <li class="mac-only">
-
- <p>With the API search box or sidebar focused, use <kbd><span class="cmd">&#8984;</span>-Left</kbd>
- or <kbd><span class="cmd">&#8984;</span>-Right</kbd> to switch
- sidebar tabs.</p> </li>
- <li class="pc-only">
-
- <p>With the API search box or sidebar focused, use <kbd>Ctrl+Left</kbd>
- and <kbd>Ctrl+Right</kbd> to switch sidebar tabs.</p> </li>
- </ul>
- </div>
- </div>
diff --git a/peripheral/libupm/doxy/node/generators/yuidoc/tmpl/partials/method.handlebars b/peripheral/libupm/doxy/node/generators/yuidoc/tmpl/partials/method.handlebars
deleted file mode 100644
index 664d79b..0000000
--- a/peripheral/libupm/doxy/node/generators/yuidoc/tmpl/partials/method.handlebars
+++ /dev/null
@@ -1,212 +0,0 @@
-<div id="method_{{name}}" class="method item{{#if access}} {{access}}{{/if}}{{#if deprecated}} deprecated{{/if}}{{#if extended_from}} inherited{{/if}}">
- <h3 class="name"><code>{{name}}</code></h3>
-
- {{#if params}}
- <div class="args">
- <span class="paren">(</span><ul class="args-list inline commas">
- {{#params}}
- <li class="arg">
- {{#if optional}}
- <code class="optional">[{{name}}{{#if optdefault}}={{optdefault}}{{/if}}]</code>
- {{else}}
- <code>{{name}}</code>
- {{/if}}
- </li>
- {{/params}}
- </ul><span class="paren">)</span>
- </div>
- {{else}}
- <span class="paren">()</span>
- {{/if}}
-
- {{#if return}}
- <span class="returns-inline">
- <span class="type">{{#crossLink returnType}}{{/crossLink}}</span>
- </span>
- {{/if}}
-
- {{#if deprecated}}
- <span class="flag deprecated"{{#if deprecationMessage}} title="{{deprecationMessage}}"{{/if}}>deprecated</span>
- {{/if}}
-
- {{#if access}}
- <span class="flag {{access}}">{{access}}</span>
- {{/if}}
-
- {{#if final}}
- <span class="flag final">final</span>
- {{/if}}
-
- {{#if static}}
- <span class="flag static">static</span>
- {{/if}}
-
- {{#if chainable}}
- <span class="flag chainable">chainable</span>
- {{/if}}
-
- {{#if async}}
- <span class="flag async">async</span>
- {{/if}}
-
- <div class="meta">
- {{#if overwritten_from}}
- <p>Inherited from
- <a href="{{crossLinkRaw overwritten_from/class}}#method_{{overwritten_from/name}}">
- {{overwritten_from/class}}
- </a>
- {{#if foundAt}}
- but overwritten in
- {{/if}}
- {{else}}
- {{#if extended_from}}
- <p>Inherited from
- <a href="{{crossLinkRaw extended_from}}#method_{{name}}">{{extended_from}}</a>:
- {{else}}
- {{#providedBy}}
- <p>Provided by the <a href="../modules/{{.}}.html">{{.}}</a> module.</p>
- {{/providedBy}}
- <p>
- {{#if foundAt}}
- Defined in
- {{/if}}
- {{/if}}
- {{/if}}
- {{#if foundAt}}
- <a href="{{foundAt}}">`{{{file}}}:{{{line}}}`</a>
- {{/if}}
- </p>
-
-
- {{#if deprecationMessage}}
- <p>Deprecated: {{deprecationMessage}}</p>
- {{/if}}
-
- {{#if since}}
- <p>Available since {{since}}</p>
- {{/if}}
- </div>
-
- <div class="description">
- {{{methodDescription}}}
- </div>
-
- {{#if params}}
- <div class="params">
- <h4>Parameters:</h4>
-
- <ul class="params-list">
- {{#params}}
- <li class="param">
- {{#if optional}}
- <code class="param-name optional">[{{name}}{{#if optdefault}}={{optdefault}}{{/if}}]</code>
- <span class="type">{{#crossLink type}}{{/crossLink}}</span>
- <span class="flag optional" title="This parameter is optional.">optional</span>
- {{else}}
- <code class="param-name">{{name}}</code>
- <span class="type">{{#crossLink type}}{{/crossLink}}</span>
- {{/if}}
-
- {{#if multiple}}
- <span class="flag multiple" title="This argument may occur one or more times.">multiple</span>
- {{/if}}
-
- <div class="param-description">
- {{{description}}}
- </div>
-
- {{#if props}}
- <ul class="params-list">
- {{#props}}
- <li class="param">
- {{#if optional}}
- <code class="param-name optional">[{{name}}{{#if optdefault}}={{optdefault}}{{/if}}]</code>
- <span class="type">{{#crossLink type}}{{/crossLink}}</span>
- <span class="flag optional" title="This parameter is optional.">optional</span>
- {{else}}
- <code class="param-name">{{name}}</code>
- <span class="type">{{#crossLink type}}{{/crossLink}}</span>
- {{/if}}
-
- <div class="param-description">
- {{{description}}}
- </div>
-
- {{#if props}}
- <ul class="params-list">
- {{#props}}
- <li class="param">
- {{#if optional}}
- <code class="param-name optional">[{{name}}{{#if optdefault}}={{optdefault}}{{/if}}]</code>
- <span class="type">{{#crossLink type}}{{/crossLink}}</span>
- <span class="flag optional" title="This parameter is optional.">optional</span>
- {{else}}
- <code class="param-name">{{name}}</code>
- <span class="type">{{#crossLink type}}{{/crossLink}}</span>
- {{/if}}
-
- <div class="param-description">
- {{{description}}}
- </div>
- </li>
- {{/props}}
- </ul>
- {{/if}}
- </li>
- {{/props}}
- </ul>
- {{/if}}
- </li>
- {{/params}}
- </ul>
- </div>
- {{/if}}
-
- {{#return}}
- <div class="returns">
- <h4>Returns:</h4>
-
- <div class="returns-description">
- {{#if description}}
- {{#if type}}
- <span class="type">{{#crossLink type}}{{/crossLink}}</span>:
- {{/if}}
- {{{description}}}
- {{else}}
- {{#if type}}
- <span class="type">{{#crossLink type}}{{/crossLink}}</span>:
- {{/if}}
- {{/if}}
- </div>
- </div>
- {{/return}}
-
- {{#throws}}
- <div class="throws">
- <h4>Throws:</h4>
-
- <div class="throws-description">
- {{#if description}}
- {{#if type}}
- <span class="type">{{#crossLink type}}{{/crossLink}}</span>:
- {{/if}}
- {{{description}}}
- {{else}}
- {{#if type}}
- <span class="type">{{#crossLink type}}{{/crossLink}}</span>:
- {{/if}}
- {{/if}}
- </div>
- </div>
- {{/throws}}
-
- {{#example}}
- <div class="example">
- <h4>Example:</h4>
-
- <div class="example-content">
- {{{.}}}
- </div>
- </div>
- {{/example}}
-</div>
diff --git a/peripheral/libupm/doxy/node/generators/yuidoc/tmpl/partials/module.handlebars b/peripheral/libupm/doxy/node/generators/yuidoc/tmpl/partials/module.handlebars
deleted file mode 100644
index 190007f..0000000
--- a/peripheral/libupm/doxy/node/generators/yuidoc/tmpl/partials/module.handlebars
+++ /dev/null
@@ -1,92 +0,0 @@
-<h1>{{name}} Module</h1>
-<div class="box clearfix meta">
- {{#extra}}
- {{#selleck}}
- <a class="button link-docs" href="/yui/docs/{{name}}">User Guide &amp; Examples</a>
- {{/selleck}}
- {{/extra}}
-
- {{#if requires}}
- <div class="uses">
- Requires
- <ul class="inline commas">
- {{#requires}}
- <li>{{#crossLinkModule .}}{{/crossLinkModule}}</li>
- {{/requires}}
- </ul>
- </div>
- {{/if}}
-
- {{#if foundAt}}
- <div class="foundat">
- Defined in: <a href="{{foundAt}}">`{{{file}}}:{{{line}}}`</a>
- </div>
- {{/if}}
-
- {{#if since}}
- <p>Available since {{since}}</p>
- {{/if}}
-</div>
-
-{{#if deprecated}}
- <div class="box deprecated">
- <p>
- {{#if deprecationMessage}}
- <strong>Deprecated:</strong> {{deprecationMessage}}
- {{else}}
- This module is deprecated.
- {{/if}}
- </p>
- </div>
-{{/if}}
-
-<div class="box intro">
- {{{moduleDescription}}}
-</div>
-
-{{#example}}
- <div class="example">
- <h4>Example:</h4>
- <div class="example-content">
- {{{.}}}
- </div>
- </div>
-{{/example}}
-
-<div class="yui3-g">
- <div class="yui3-u-1-2">
- {{#if moduleClasses}}
- <p>This module provides the following classes:</p>
-
- <ul class="module-classes">
- {{#moduleClasses}}
- <li class="module-class">
- <a href="{{../projectRoot}}classes/{{name}}.html">
- {{displayName}}
- </a>
- </li>
- {{/moduleClasses}}
- </ul>
- {{/if}}
- </div>
-
- <div class="yui3-u-1-2">
- {{#if subModules}}
- <p>This module is a rollup of the following modules:</p>
-
- <ul class="module-submodules">
- {{#subModules}}
- <li class="module-submodule">
- <a href="{{../projectRoot}}modules/{{name}}.html">
- {{displayName}}
- </a>
-
- <div class="module-submodule-description">
- {{{description}}}
- </div>
- </li>
- {{/subModules}}
- </ul>
- {{/if}}
- </div>
-</div>
diff --git a/peripheral/libupm/doxy/node/generators/yuidoc/tmpl/partials/options.handlebars b/peripheral/libupm/doxy/node/generators/yuidoc/tmpl/partials/options.handlebars
deleted file mode 100644
index 2d8333a..0000000
--- a/peripheral/libupm/doxy/node/generators/yuidoc/tmpl/partials/options.handlebars
+++ /dev/null
@@ -1,22 +0,0 @@
-<div id="api-options" hidden>
- Show:
- <label for="api-show-inherited">
- <input type="checkbox" id="api-show-inherited" checked>
- Inherited
- </label>
-
- <label for="api-show-protected">
- <input type="checkbox" id="api-show-protected">
- Protected
- </label>
-
- <label for="api-show-private">
- <input type="checkbox" id="api-show-private">
- Private
- </label>
- <label for="api-show-deprecated">
- <input type="checkbox" id="api-show-deprecated">
- Deprecated
- </label>
- </div>
-
diff --git a/peripheral/libupm/doxy/node/generators/yuidoc/tmpl/partials/props.handlebars b/peripheral/libupm/doxy/node/generators/yuidoc/tmpl/partials/props.handlebars
deleted file mode 100644
index 696e720..0000000
--- a/peripheral/libupm/doxy/node/generators/yuidoc/tmpl/partials/props.handlebars
+++ /dev/null
@@ -1,119 +0,0 @@
-<div id="property_{{name}}" class="property item{{#if access}} {{access}}{{/if}}{{#if deprecated}} deprecated{{/if}}{{#if extended_from}} inherited{{/if}}">
- <h3 class="name"><code>{{name}}</code></h3>
- <span class="type">{{#crossLink type}}{{/crossLink}}</span>
-
- {{#if deprecated}}
- <span class="flag deprecated"{{#if deprecationMessage}} title="{{deprecationMessage}}"{{/if}}>deprecated</span>
- {{/if}}
-
- {{#if access}}
- <span class="flag {{access}}">{{access}}</span>
- {{/if}}
-
- {{#if final}}
- <span class="flag final">final</span>
- {{/if}}
-
- {{#if static}}
- <span class="flag static">static</span>
- {{/if}}
-
- <div class="meta">
- {{#if overwritten_from}}
- <p>Inherited from
- <a href="{{crossLinkRaw overwritten_from/class}}#property_{{overwritten_from/name}}">
- {{overwritten_from/class}}
- </a>
- {{#if foundAt}}
- but overwritten in
- {{/if}}
- {{else}}
- {{#if extended_from}}
- <p>Inherited from
- <a href="{{crossLinkRaw extended_from}}#property_{{name}}">{{extended_from}}</a>:
- {{else}}
- {{#providedBy}}
- <p>Provided by the <a href="../modules/{{.}}.html">{{.}}</a> module.</p>
- {{/providedBy}}
- <p>
- {{#if foundAt}}
- Defined in
- {{/if}}
- {{/if}}
- {{/if}}
- {{#if foundAt}}
- <a href="{{foundAt}}">`{{{file}}}:{{{line}}}`</a>
- {{/if}}
- </p>
-
- {{#if deprecationMessage}}
- <p>Deprecated: {{deprecationMessage}}</p>
- {{/if}}
-
- {{#if since}}
- <p>Available since {{since}}</p>
- {{/if}}
- </div>
-
- <div class="description">
- {{{propertyDescription}}}
- </div>
-
- {{#if default}}
- <p><strong>Default:</strong> {{default}}</p>
- {{/if}}
-
- {{#example}}
- <div class="example">
- <h4>Example:</h4>
-
- <div class="example-content">
- {{{.}}}
- </div>
- </div>
- {{/example}}
-
- {{#if subprops}}
- <h4>Sub-properties:</h4>
-
- <ul class="params-list">
- {{#subprops}}
- <li class="param">
- {{#if optional}}
- <code class="param-name optional">[{{name}}{{#if optdefault}}={{optdefault}}{{/if}}]</code>
- <span class="type">{{#crossLink type}}{{/crossLink}}</span>
- <span class="flag optional" title="This property is optional.">optional</span>
- {{else}}
- <code class="param-name">{{name}}</code>
- <span class="type">{{#crossLink type}}{{/crossLink}}</span>
- {{/if}}
-
- <div class="param-description">
- {{{description}}}
- </div>
-
- {{#if subprops}}
- <ul class="params-list">
- {{#subprops}}
- <li class="param">
- {{#if optional}}
- <code class="param-name optional">[{{name}}{{#if optdefault}}={{optdefault}}{{/if}}]</code>
- <span class="type">{{#crossLink type}}{{/crossLink}}</span>
- <span class="flag optional" title="This property is optional.">optional</span>
- {{else}}
- <code class="param-name">{{name}}</code>
- <span class="type">{{#crossLink type}}{{/crossLink}}</span>
- {{/if}}
-
- <div class="param-description">
- {{{description}}}
- </div>
- </li>
- {{/subprops}}
- </ul>
- {{/if}}
- </li>
- {{/subprops}}
- </ul>
- {{/if}}
-</div>
diff --git a/peripheral/libupm/doxy/node/generators/yuidoc/tmpl/partials/sidebar.handlebars b/peripheral/libupm/doxy/node/generators/yuidoc/tmpl/partials/sidebar.handlebars
deleted file mode 100644
index fcffc3c..0000000
--- a/peripheral/libupm/doxy/node/generators/yuidoc/tmpl/partials/sidebar.handlebars
+++ /dev/null
@@ -1,27 +0,0 @@
-<div id="api-list">
- <h2 class="off-left">APIs</h2>
- <div id="api-tabview" class="tabview">
- <ul class="tabs">
- <li><a href="#api-categories">By Category</a></li>
- <li><a href="#api-connections">By Connection Type</a></li>
- </ul>
-
- <div id="api-tabview-filter">
- <input type="search" id="api-filter" placeholder="Type to filter APIs" hidden>
- </div>
-
- <div id="api-tabview-panel">
- <ul id="api-categories" class="apis modules">
- {{{listByCategory}}}
- </ul>
-
- <ul id="api-connections" class="apis modules">
- {{{listByConnection}}}
- </ul>
-
- </div>
- </div>
-
- {{{javascripts}}}
-
-</div> \ No newline at end of file
diff --git a/peripheral/libupm/doxy/node/grammars/xml.peg b/peripheral/libupm/doxy/node/grammars/xml.peg
deleted file mode 100644
index bca96d5..0000000
--- a/peripheral/libupm/doxy/node/grammars/xml.peg
+++ /dev/null
@@ -1,45 +0,0 @@
-document
- = _ ignore* _ "<doxygen " _ attr:attr* _ ">" body:elements _ "</doxygen>" _ { return body; }
-
-
-elements
- = element*
-
-element
- = _ "<" startTag:id _ attr:attr* _ ">" _ children:elements _ "</" endTag:id ">" _ {
- if (startTag != endTag) {
- throw new Error("Expected </" + startTag + "> but </" + endTag + "> found.");
- }
- return {name: startTag, attr: attr, children: children }
- }
- / "<" tag:id _ attr:attr* _ "/>" _ {
- return {name: tag, attr: attr }
- }
- / _ text:text _ { return text }
-
-ignore
- = "<?xml" _ attr* _ "?>" { return }
-
-attr
- = name:id _ "=" _ value:string { return { name:name, value:value } }
-
-string
- = '"' '"' _ { return ""; }
- / "'" "'" _ { return ""; }
- / '"' text:quoted '"' _ { return text; }
- / "'" text:quoted "'" _ { return text; }
-
-quoted
- = chars:[^<>'" \t\n\r]+ { return chars.join(""); }
-
-text
- = chars:[^<> \t\n\r]+ { return chars.join(""); }
-
-id
- = chars:[^<>/'"=? \t\n\r]+ { return chars.join(""); }
-
-_ "whitespace"
- = whitespace*
-
-whitespace
- = [ \t\n\r]
diff --git a/peripheral/libupm/doxy/node/tolower.js b/peripheral/libupm/doxy/node/tolower.js
deleted file mode 100644
index c9c2421..0000000
--- a/peripheral/libupm/doxy/node/tolower.js
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Author: Dina M Suehiro <dina.m.suehiro@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.
- */
-
-// dependencies
-var opts = require('commander'), // for command line args
- fs = require('fs'), // for file system access
- path = require('path'); // for file path parsing
-
-// parse command line arguments
-opts
- .option('-i, --inputdir [directory]', 'product documents directory', __dirname + '/docs/yuidoc/upm')
- .parse(process.argv);
-
-// Set to true for console output
-var debug = true;
-
-// Global arrays tracking the files that have been renamed
-var originalFiles = [];
-var renamedFiles = [];
-
-// Filter to get html files from different directories
-var rootFiles = getHtmlFilenames(opts.inputdir);
-var classesFiles = getHtmlFilenames(opts.inputdir + "/classes");
-var modulesFiles = getHtmlFilenames(opts.inputdir + "/modules");
-
-// Rename files in the classes directory to have lower-cased file names.
-renameFiles(classesFiles);
-
-classesFiles = getHtmlFilenames(opts.inputdir + "/classes");
-
-// Go through the html files and update links to reflect the file names that we changed.
-renameLinks(rootFiles);
-renameLinks(classesFiles);
-renameLinks(modulesFiles);
-
-// Helper function that returns paths to the html files in the specified directory
-function getHtmlFilenames (directory)
-{
- return fs.readdirSync(directory).map(function (file) {
- return path.join(directory, file);
- }).filter(function (file) {
- return fs.statSync(file).isFile();
- }).filter(function (file) {
- return path.extname(file).toLowerCase() == ".html";
- });
-}
-
-// Goes through the files and renames them to be lower-cased and tracks them the
-// renamed files in the originalFiles[] and renamedFiles[] arrays.
-function renameFiles(files)
-{
- files.forEach(function (file)
- {
- var originalName = path.basename(file);
- var newFileName = originalName.toLowerCase();
- var directory = path.dirname(file);
- if (originalName != newFileName)
- {
- fs.renameSync(file, directory + "/" + newFileName); //, function(err)
-
- if (debug)
- console.log('Renamed: %s --> %s', originalName, newFileName);
-
- originalFiles.push(originalName);
- renamedFiles.push(newFileName);
- }
- });
-}
-
-// Helper function goes through the specified files and does a file/replace of the
-// originalFiles to the renamedFiles so that the .html links match what has been renamed.
-function renameLinks (files)
-{
- if (originalFiles.length <= 0)
- {
- if (debug)
- console.log("No links to rename.");
- return;
- }
-
- files.forEach(function (file)
- {
- // Read the file
- data = fs.readFileSync(file, 'ascii');
-
- // Find/replace the file names that were renamed
- for (var i = 0; i < originalFiles.length; i++)
- {
- var findString = '/' + originalFiles[i] + '\"';
- var replaceString = '/' + renamedFiles[i] + '\"';
-
- data = data.replace(findString, replaceString);
- }
-
- // Write back
- fs.writeFile(file, data, 'ascii', function (err) {
- if (err)
- throw err;
- });
-
- if (debug)
- console.log('Renamed links in: %s', file);
- });
-}
diff --git a/peripheral/libupm/doxy/node/xml2js.js b/peripheral/libupm/doxy/node/xml2js.js
deleted file mode 100644
index 95af761..0000000
--- a/peripheral/libupm/doxy/node/xml2js.js
+++ /dev/null
@@ -1,935 +0,0 @@
-/*
- * Author: Heidi Pan <heidi.pan@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.
- */
-
-// dependencies
-var peg = require('pegjs')
- , fs = require('fs')
- , path = require('path')
- , Promise = require('bluebird')
- , _ = require('lodash')
- , util = require('util');
-
-
-// use promise-style programming rather than spaghetti callbacks
-Promise.promisifyAll(fs);
-
-
-var xml2js = {
-
- // js-format specs
- // MODULE: <module name>
- // ENUMS: {
- // <enum name>: {
- // type: <enum type>,
- // description: <enum description>
- // }, ...
- // }
- // ENUMS_BY_GROUP: {
- // <enum type>: {
- // description: <enum group description>
- // members: [ <enum name>, ... ]
- // }, ...
- // }
- // METHODS: {
- // <method name>: {
- // description: <method description>,
- // params: {
- // <param name>: {
- // type: <param type>,
- // description: <param description >
- // }, ...
- // },
- // return: {
- // type: <return type>,
- // description: <return description>
- // }
- // }, ...
- // }
- // CLASSES: {
- // <class name>: {
- // description: <class description>,
- // parent: <parent class name>,
- // group: <group name>,
- // methods: { ... },
- // variables: {
- // <variable name>: {
- // type: <variable type>,
- // description: <variable description>
- // }
- // },
- // enums: { ... },
- // enums_by_group: { ... }
- // }, ...
- // }
- // CLASSGROUPS: {
- // <group name>: {
- // description: <group description>,
- // classes: [ <class name>, ... ],
- // enums: { ... },
- // enums_by_group: { ... }
- // }, ...
- // }
- MODULE: '',
- ENUMS: {},
- ENUMS_BY_GROUP: {},
- METHODS: {},
- CLASSES: {},
- CLASSGROUPS: {},
-
-
- // baseline c -> js type mapping
- TYPEMAPS: {
- '^(const)?\\s*(unsigned|signed)?\\s*(int|short|long|float|double|size_t|u?int\\d{1,2}_t)?$': 'Number',
- '^bool$': 'Boolean',
- '^(const)?\\s*(unsigned|signed)?\\s*(char|char\\s*\\*|std::string)$': 'String', // TODO: verify that swig does this mapping
- '^void\\s*\\(\\s*\\*\\s*\\)\\s*\\(\\s*void\\s*\\*\\)\\s*$': 'Function'
- },
-
-
- // custom c -> js type mapping for pointers
- // ARRAY_TYPEMAPS: {
- // <pointer data type>: {
- // arrayType: <swig generated array type that will replace pointers of data type>,
- // classes: [ <class that contains arrayType>, ... ]
- // }, ...
- // }
- // POINTER_TYPEMAPS: {
- // <class that contains pointerType>: {
- // <c pointer data type>: <js swig generated pointer type that will replace pointers of data type>, ...
- // }, ...
- // }
- ARRAY_TYPEMAPS: {},
- POINTER_TYPEMAPS: {},
-
-
- // add command line options for this module
- addOptions: function(opts) {
- xml2js.opts = opts;
- return opts
- .option('-i, --inputdir [directory]', 'directory for xml files', __dirname + '/xml/mraa')
- .option('-c, --custom [file]', 'json for customizations')
- .option('-t, --typemaps [directory]', 'directory for custom pointer type maps')
- .option('-g, --imagedir [directory]', 'directory to link to where the images will be kept', '')
- .option('-s, --strict', 'leave out methods/variables if unknown type')
- },
-
-
- // parse doxygen xml -> js-format specs
- // TODO: figure out whether we need to document any protected methods/variables
- parse: function() {
- var XML_GRAMMAR_SPEC = 'grammars/xml.peg';
- var NAMESPACE_SPEC = xml2js.opts.inputdir + '/namespace' + xml2js.opts.module + '.xml';
- var CLASS_SPEC = function(c) { return xml2js.opts.inputdir + '/' + c + '.xml'; }
- var TYPES_SPEC = xml2js.opts.inputdir + '/types_8h.xml';
- xml2js.MODULE = xml2js.opts.module;
- return Promise.join(createXmlParser(XML_GRAMMAR_SPEC),
- xml2js.opts.typemaps ? initCustomPointerTypemaps(xml2js.opts.typemaps) : Promise.resolve(),
- fs.readFileAsync(NAMESPACE_SPEC, 'utf8'),
- fs.existsSync(TYPES_SPEC) ? fs.readFileAsync(TYPES_SPEC, 'utf8') : Promise.resolve(null),
- function(xmlparser, ignore, xml, xml_types) {
- if (xml_types != null) {
- _.extend(xml2js.ENUMS, getEnums(xmlparser.parse(xml_types)[0], false));
- _.extend(xml2js.ENUMS_BY_GROUP, getEnums(xmlparser.parse(xml_types)[0], true));
- }
- var spec_c = xmlparser.parse(xml)[0];
- _.extend(xml2js.ENUMS, getEnums(spec_c, false));
- _.extend(xml2js.ENUMS_BY_GROUP, getEnums(spec_c, true));
- _.extend(xml2js.METHODS, getMethods(spec_c));
- _.each(getSubclassNames(spec_c), function(className) { xml2js.CLASSES[className] = {} });
- var parseClasses = _.map(getSubclasses(spec_c), function(c) {
- return fs.readFileAsync(CLASS_SPEC(c), 'utf8').then(function(xml) {
- try {
- var spec_c = xmlparser.parse(xml)[0];
- var className = getName(spec_c);
- _.extend(xml2js.CLASSES[className], {
- description: getDescription(spec_c),
- parent: getParent(spec_c, className),
- enums: getEnums(spec_c, false, className),
- enums_by_group: getEnums(spec_c, true, className),
- variables: getVariables(spec_c, className),
- methods: getMethods(spec_c, className)
- });
- } catch(e) {
- console.log(e.toString() + ': class ' + className + ' was not parsed correctly.');
- }
- });
- });
- var parseGroups = fs.readdirAsync(xml2js.opts.inputdir).then(function(files) {
- var groupxmlfiles = _.filter(files, function(fn) {
- return ((path.extname(fn) == '.xml') && (path.basename(fn).search(/^group/) != -1));
- });
- return Promise.all(_.map(groupxmlfiles, function(fn) {
- return fs.readFileAsync(xml2js.opts.inputdir + '/' + fn, 'utf8').then(function(xml) {
- var spec_c = xmlparser.parse(xml)[0];
- if (_.isEmpty(getSubmodules(spec_c))) {
- var group = getName(spec_c);
- var classes = getSubclassNames(spec_c);
- xml2js.CLASSGROUPS[group] = {
- description: getDescription(spec_c),
- classes: classes
- };
- _.each(classes, function(c) {
- if (_.has(xml2js.CLASSES, c)) {
- xml2js.CLASSES[c].group = group;
- } else {
- console.log('Warning: Group ' + group + ' has unknown class ' + c);
- }
- });
- }
- });
- }));
- });
- return Promise.all(parseClasses.concat(parseGroups));
- }).then(function() {
- if (!_.isEmpty(xml2js.CLASSGROUPS)) {
- // try to categorize ungrouped classes, if any
- var grouped = _.flatten(_.pluck(_.values(xml2js.CLASSGROUPS), 'classes'));
- var ungrouped = _.difference(_.keys(xml2js.CLASSES), grouped);
- _.each(ungrouped, function(c) {
- _.each(findUsage(c), function(group) {
- xml2js.CLASSGROUPS[group].classes.push(c);
- });
- });
- grouped = _.flatten(_.pluck(_.values(xml2js.CLASSGROUPS), 'classes'));
- ungrouped = _.difference(_.keys(xml2js.CLASSES), grouped);
- // try to categorize ungrouped enums, if any
- _.each(xml2js.ENUMS_BY_GROUP, function(enumGroupSpec, enumGroupName) {
- _.each(findUsage(enumGroupName, true), function(c) {
- xml2js.CLASSES[c].enums_by_group[enumGroupName] = enumGroupSpec;
- _.each(enumGroupSpec.members, function(enumName) {
- xml2js.CLASSES[c].enums[enumName] = xml2js.ENUMS[enumName];
- delete xml2js.ENUMS[enumName];
- });
- delete xml2js.ENUMS_BY_GROUP[enumGroupName];
- });
- });
- }
- }).then(function() {
- if (xml2js.opts.custom && fs.existsSync(xml2js.opts.custom)) {
- return fs.readFileAsync(xml2js.opts.custom, 'utf8').then(function(custom) {
- try {
- customizeMethods(JSON.parse(custom));
- } catch(e) {
- console.log('invalid custom.json, ignored. ' + e.toString());
- }
- });
- } else {
- console.log(xml2js.opts.custom ? ('Error: No such customization file exists: ' + xml2js.opts.custom) : 'No customizations given.');
- }
- }).then(function() {
- generateCustomPointerClasses();
- validateMethods();
- validateVars();
- return _.pick(xml2js, 'MODULE', 'ENUMS', 'ENUMS_BY_GROUP', 'METHODS', 'CLASSES', 'CLASSGROUPS');
- });
- }
-};
-
-
-// create an xml parser
-function createXmlParser(XML_GRAMMAR_SPEC) {
- return fs.readFileAsync(XML_GRAMMAR_SPEC, 'utf8').then(function(xmlgrammar) {
- return peg.buildParser(xmlgrammar);
- });
-}
-
-
-// configure c->js typemaps from custom swig directives
-// TODO: many built in assumptions based on current upm file structures & .i customizations
-function initCustomPointerTypemaps(typemapsdir) {
- return fs.readdirAsync(typemapsdir).then(function(dirs) {
- return Promise.all(_.map(dirs, function(dir) {
- // get all js*.i directives from class-specific subdirectories, to be parsed below for %typemaps directives
- return fs.readdirAsync(typemapsdir + '/' + dir).then(function(files) {
- var directive = _.find(files, function(fn) {
- return ((path.extname(fn) == '.i') && (path.basename(fn).search(/^js/) != -1));
- });
- var data = {};
- if (directive) {
- data[dir] = typemapsdir + '/' + dir + '/' + directive;
- }
- return data;
- }).catch(function(e) {
- // get all .i directives from top level directory, and parse for %array_class directives
- if (e.code == 'ENOTDIR') {
- var fn = dir;
- if (path.extname(fn) == '.i') {
- return fs.readFileAsync(typemapsdir + '/' + fn, 'utf8').then(function(directives) {
- var arraytypes = _.filter(directives.split(/\n/), function(line) {
- return (line.search(/^%array_class/) != -1);
- });
- _.each(arraytypes, function(arraytype) {
- var parsed = arraytype.match(/%array_class\(([A-Za-z0-9_]+)[\s]*,[\s]*([A-Za-z0-9_]+)\)/);
- if (parsed) {
- var from = parsed[1];
- var to = parsed[2];
- xml2js.ARRAY_TYPEMAPS[from] = { arrayType: to, classes: [] };
- } else {
- console.log('Incorrectly parsed array_class from ' + fn + ': ' + arraytype);
- }
- });
- });
- }
- } else {
- throw e;
- }
- });
- }));
- }).then(function(__directivesFiles) {
- // parse for %typemaps & %pointer_functions directives
- var _directivesFiles = _.filter(__directivesFiles, function(data) { return !_.isEmpty(data); });
- var directivesFiles = _.object(_.map(_directivesFiles, _.keys), _.flatten(_.map(_directivesFiles, _.values)));
- return Promise.all(_.map(directivesFiles, function(directivesFn, className) {
- return fs.readFileAsync(directivesFn, 'utf8').then(function(directives) {
- var typemaps = _.filter(directives.split(/\n/), function(line) {
- return (line.search(/^%typemap/) != -1);
- });
- _.each(typemaps, function(typemap) {
- var parsed = typemap.match(/%typemap\((in|out)\)[\s]+([A-Za-z0-9_]+[\s]*[\*])/);
- if (parsed) {
- var dir = parsed[1]; // TODO: ignored for now
- var type = normalizePointer(parsed[2]);
- var datatype = getPointerDataType(type);
- if (_.has(xml2js.ARRAY_TYPEMAPS, datatype)) {
- xml2js.ARRAY_TYPEMAPS[datatype].classes.push(className);
- } else {
- console.log('Ignored typemap from ' + directivesFn + ': ' + typemap.replace('{', '') + ' (no %array_class directive found for ' + datatype + ')');
- }
- } else {
- console.log('Ignored typemap from ' + directivesFn + ': ' + typemap.replace('{', '') + ' (only considering in/out typemaps of pointer types)');
- }
- });
- var ptrfns = _.filter(directives.split(/\n/), function(line) {
- return (line.search(/^%pointer_functions/) != -1);
- });
- _.each(ptrfns, function(ptrfn) {
- var parsed = ptrfn.match(/%pointer_functions\(([A-Za-z0-9_]+)[\s]*,[\s]*([A-Za-z0-9_]+)\)/);
- if (parsed) {
- var from = parsed[1];
- var to = parsed[2];
- if (!_.has(xml2js.POINTER_TYPEMAPS, className)) {
- xml2js.POINTER_TYPEMAPS[className] = {};
- }
- xml2js.POINTER_TYPEMAPS[className][from] = to;
- }
- });
- });
- }));
- });
-}
-
-
-// generate class specs for custom pointer types
-function generateCustomPointerClasses() {
- var arrayTypes = _.pluck(_.values(xml2js.ARRAY_TYPEMAPS), 'arrayType');
- var pointerTypes = _.uniq(_.flatten(_.map(_.values(xml2js.POINTER_TYPEMAPS), _.values)));
- _.each(arrayTypes, function(arrayType) {
- var dataType = _.findKey(xml2js.ARRAY_TYPEMAPS, function(to) { return to.arrayType == arrayType; });
- xml2js.CLASSES[arrayType] = {
- description: 'Array of type ' + dataType + '.',
- enums: {},
- enums_by_group: {},
- variables: {},
- methods: {}
- };
- xml2js.CLASSES[arrayType].methods[arrayType] = {
- description: 'Instantiates the array.',
- params: {
- nelements: {
- type: 'Number',
- description: 'number of elements in the array'
- }
- },
- return: {}
- };
- xml2js.CLASSES[arrayType].methods.getitem = {
- description: 'Access a particular element in the array.',
- params: {
- index: {
- type: 'Number',
- description: 'index of array to read from'
- },
- },
- return: {
- type: getType(dataType),
- description: 'the value of the element found at the given index of the array'
- }
- };
- xml2js.CLASSES[arrayType].methods.setitem = {
- description: 'Modify a particular element in the array.',
- params: {
- index: {
- type: 'Number',
- description: 'index of array to write to'
- },
- value: {
- type: getType(dataType),
- description: 'the value to set the element found at the given index of the array'
- }
- },
- return: {}
- };
- });
- var pointerDataTypeMap = _.reduce(_.map(_.values(xml2js.POINTER_TYPEMAPS), _.invert), function(memo, typemap) {
- return _.extend(memo, typemap);
- }, {});
- _.each(pointerTypes, function(pointerType) {
- var dataType = pointerDataTypeMap[pointerType];
- xml2js.CLASSES[pointerType] = {
- description: 'Proxy object to data of type ' + dataType + '.',
- enums: {},
- enums_by_group: {},
- variables: {},
- methods: {}
- };
- xml2js.CLASSES[pointerType].methods[pointerType] = {
- description: 'Instantiates the proxy object.',
- params: {},
- return: {}
- };
- xml2js.CLASSES[pointerType].methods.value = {
- description: 'Get the value of the object.',
- params: {},
- return: {
- type: getType(dataType),
- description: 'the value of the object'
- }
- };
- xml2js.CLASSES[pointerType].methods.assign = {
- description: 'Set the value of the object.',
- params: {
- value: {
- type: getType(dataType),
- description: 'the value to set the object to'
- }
- },
- return: {}
- };
- });
-}
-
-
-// search for usage of a type
-function findUsage(type, classOnly) {
- var filterClasses = function(fn) { return _.without(_.map(xml2js.CLASSES, fn), undefined); };
- var usesType = function(classSpec, className) {
- var methodsOfType = (_.find(classSpec.methods, function(methodSpec, methodName) {
- return ((!_.isEmpty(methodSpec.return) && methodSpec.return.type == type) ||
- (_.contains(_.pluck(methodSpec.params, 'type'), type)));
- }) != undefined);
- var variablesOfType = _.contains(_.pluck(classSpec.variable, 'type'), type);
- return ((methodsOfType || variablesOfType) ? className : undefined);
- };
- var extendsType = function(classSpec, className) {
- return ((classSpec.parent == type) ? className : undefined);
- };
- var classes = _.union(filterClasses(usesType), filterClasses(extendsType));
- if (classOnly) {
- return classes;
- } else {
- return _.without(_.uniq(_.pluck(_.pick(xml2js.CLASSES, classes), 'group')), undefined);
- }
-}
-
-
-// override autogenerated methods with custom configuration
-function customizeMethods(custom) {
- _.each(custom, function(classMethods, className) {
- _.extend(xml2js.CLASSES[className].methods, _.pick(classMethods, function(methodSpec, methodName) {
- return isValidMethodSpec(methodSpec, className + '.' + methodName);
- }));
- });
-}
-
-
-// make sure methods have valid types, otherwise warn (& don't include if strict)
-function validateMethods() {
- xml2js.METHODS = _.pick(xml2js.METHODS, function(methodSpec, methodName) {
- return hasValidTypes(methodSpec, methodName);
- });
- _.each(xml2js.CLASSES, function(classSpec, className) {
- var valid = _.pick(classSpec.methods, function(methodSpec, methodName) {
- return hasValidTypes(methodSpec, className + '.' + methodName, className);
- });
- if (xml2js.opts.strict) {
- xml2js.CLASSES[className].methods = valid;
- }
- });
-}
-
-
-// make sure variables have valid types, otherwise warn (& don't include if strict)
-function validateVars() {
- _.each(xml2js.CLASSES, function(classSpec, className) {
- var valid = _.pick(classSpec.variables, function(varSpec, varName) {
- return ofValidType(varSpec, className + '.' + varName, className);
- });
- if (xml2js.opts.strict) {
- xml2js.CLASSES[className].variables = valid;
- }
- });
-}
-
-
-// verify that the json spec is well formatted
-function isValidMethodSpec(methodSpec, methodName) {
- var valid = true;
- var printIgnoredMethodOnce = _.once(function() { console.log(methodName + ' from ' + path.basename(xml2js.opts.custom) + ' is omitted from JS documentation.'); });
- function checkRule(rule, errMsg) {
- if (!rule) {
- printIgnoredMethodOnce();
- console.log(' ' + errMsg);
- valid = false;
- }
- }
- checkRule(_.has(methodSpec, 'description'), 'no description given');
- checkRule(_.has(methodSpec, 'params'), 'no params given (specify "params": {} for no params)');
- _.each(methodSpec.params, function(paramSpec, paramName) {
- checkRule(_.has(paramSpec, 'type'), 'no type given for param ' + paramName);
- checkRule(_.has(paramSpec, 'description'), 'no description given for param ' + paramName);
- });
- checkRule(_.has(methodSpec, 'return'), 'no return given (specify "return": {} for no return value)');
- checkRule(_.has(methodSpec.return, 'type'), 'no type given for return value');
- checkRule(_.has(methodSpec.return, 'description'), 'no description given for return value');
- return valid;
-}
-
-
-// get enum specifications
-function getEnums(spec_c, bygroup, parent) {
- var spec_js = {};
- var enumGroups = _.find(getChildren(spec_c, 'sectiondef'), function(section) {
- var kind = getAttr(section, 'kind');
- return ((kind == 'enum') || (kind == 'public-type'));
- });
- if (enumGroups) {
- _.each(enumGroups.children, function(enumGroup) {
- var enumGroupName = getText(getChild(enumGroup, 'name'), 'name');
- var enumGroupDescription = getText(getChild(enumGroup, 'detaileddescription'), 'description');
- var enumGroupVals = getChildren(enumGroup, 'enumvalue');
- if (bygroup) {
- spec_js[enumGroupName] = {
- description: enumGroupDescription,
- members: []
- };
- }
- _.each(enumGroupVals, function(e) {
- // TODO: get prefix as option
- var enumName = getText(getChild(e, 'name'), 'name').replace(/^MRAA_/, '');
- var enumDescription = getText(getChild(e, 'detaileddescription'), 'description');
- if (!bygroup) {
- spec_js[enumName] = {
- type: enumGroupName,
- description: enumDescription
- };
- } else {
- spec_js[enumGroupName].members.push(enumName);
- }
- });
- });
- }
- return spec_js;
-}
-
-
-// get the name for the module/group/class
-function getName(spec_c) {
- return getText(getChild(spec_c, 'compoundname'), 'name').replace(xml2js.opts.module + '::', '');
-}
-
-
-// get the description for the module/group/class
-function getDescription(spec_c) {
- return getText(getChild(spec_c, 'detaileddescription'), 'description');
-}
-
-
-// get the classes (xml file names) for the given module
-function getSubclasses(spec_c) {
- return _.map(getChildren(spec_c, 'innerclass'), function(innerclass) {
- return getAttr(innerclass, 'refid');
- });
-}
-
-
-// get the classes (class names) for the given module
-function getSubclassNames(spec_c) {
- return _.map(getChildren(spec_c, 'innerclass'), function(innerclass) {
- return getText(innerclass).replace(xml2js.opts.module + '::', '');
- });
-}
-
-
-// get the submodules (xml file names) for the given module
-function getSubmodules(spec_c) {
- return _.map(getChildren(spec_c, 'innergroup'), function(innergroup) {
- return getAttr(innergroup, 'refid');
- });
-}
-
-
-// get parent class, if any
-function getParent(spec_c, className) {
- var parent = getChild(spec_c, 'basecompoundref');
- if (parent) {
- parent = getText(parent);
- if (!_.has(xml2js.CLASSES, parent)) {
- console.log('WARNING: Class ' + className + ' has unknown parent class ' + parent);
- }
- }
- return parent;
-}
-
-
-function hasParams(paramsSpec) {
- return !(_.isEmpty(paramsSpec) ||
- ((_.size(paramsSpec) == 1) && getText(getChild(paramsSpec[0], 'type')) == 'void'));
-}
-
-
-// get method specifications for top-level module or a given class
-// TODO: overloaded functions
-// TODO: functions w/ invalid parameter(s)/return
-function getMethods(spec_c, parent) {
- var spec_js = {};
- var methods = _.find(getChildren(spec_c, 'sectiondef'), function(section) {
- var kind = getAttr(section, 'kind');
- return ((kind == 'public-func') || (kind == 'func'));
- });
- if (methods) {
- _.each(methods.children, function(method) {
- var methodName = getText(getChild(method, 'name'), 'name');
- if (methodName[0] != '~') { // filter out destructors
- try {
- var description = getChild(method, 'detaileddescription');
- var methodDescription = getText(description, 'description');
- var paramsSpec = getChildren(method, 'param');
- var params = {};
- if (hasParams(paramsSpec)) {
- params = getParams(paramsSpec, getParamsDetails(description), methodName, parent);
- }
- var returnSpec = getChild(method, 'type');
- var retval = {};
- if (!_.isEmpty(returnSpec)) {
- retval = getReturn(returnSpec, getReturnDetails(description), methodName, parent);
- }
- methodName = getUniqueMethodName(methodName, spec_js, parent);
- spec_js[methodName] = {
- description: methodDescription,
- params: params,
- return: retval
- };
- } catch(e) {
- console.log((parent ? (parent + '.') : '') + methodName + ' is omitted from JS documentation.');
- console.log(' ' + e.toString());
- }
- }
- });
- }
- return spec_js;
-}
-
-
-// get a unique string to represent the name of an overloaded method
-function getUniqueMethodName(methodName, module, parent) {
- if (methodName in module) {
- do {
- methodName += '!';
- } while (methodName in module);
- }
- return methodName;
-}
-
-
-// get variable specifications for a class
-function getVariables(spec_c, parent) {
- var spec_js = {};
- var vars = _.find(getChildren(spec_c, 'sectiondef'), function(section) {
- var kind = getAttr(section, 'kind');
- return (kind == 'public-attrib');
- });
- if (vars) {
- _.each(_.filter(vars.children, function(variable) {
- return (getAttr(variable, 'kind') == 'variable');
- }), function(variable) {
- var varName = getText(getChild(variable, 'name'), 'name');
- var varType = getType(getText(getChild(variable, 'type')), parent);
- var varDescription = getText(getChild(variable, 'detaileddescription'));
- spec_js[varName] = {
- type: varType,
- description: varDescription
- }
- });
- }
- return spec_js;
-}
-
-
-// get return value specs of a method
-function getReturn(spec_c, details, method, parent) {
- var retType = getType(getText(spec_c, 'type'), parent);
- var retDescription = (details ? getText(details, 'description') : '');
- return ((retType == 'void') ? {} : {
- type: retType,
- description: retDescription
- });
-}
-
-
-// get paramater specs of a method
-function getParams(spec_c, details, method, parent) {
- var spec_js = {};
- _.each(spec_c, function(param) {
- try {
- var paramType = getType(getText(getChild(param, 'type'), 'type'), parent);
- var paramName = getText(getChild(param, 'declname'), 'name');
- spec_js[paramName] = { type: paramType };
- } catch(e) {
- if (paramType == '...') {
- spec_js['arguments'] = { type: paramType };
- } else {
- throw e;
- }
- }
- });
- _.each(details, function(param) {
- var getParamName = function(p) { return getText(getChild(getChild(p, 'parameternamelist'), 'parametername'), 'name'); }
- var paramName = getParamName(param);
- var paramDescription = getText(getChild(param, 'parameterdescription'), 'description');
- if (_.has(spec_js, paramName)) {
- spec_js[paramName].description = paramDescription;
- } else {
- var msg = ' has documentation for an unknown parameter: ' + paramName + '. ';
- var suggestions = _.difference(_.keys(spec_js), _.map(details, getParamName));
- var msgAddendum = (!_.isEmpty(suggestions) ? ('Did you mean ' + suggestions.join(', or ') + '?') : '');
- console.log('Warning: ' + (parent ? (parent + '.') : '') + method + msg + msgAddendum);
- }
- });
- return spec_js;
-}
-
-
-// get the equivalent javascript type from the given c type
-function getType(type_c, parent) {
- var type_js = type_c;
- _.find(xml2js.TYPEMAPS, function(to, from) {
- var pattern = new RegExp(from, 'i');
- if (type_c.search(pattern) == 0) {
- type_js = to;
- return true;
- }
- });
- if (isPointer(type_js)) {
- var dataType = getPointerDataType(type_js);
- var className = parent.toLowerCase();
- if (_.has(xml2js.ARRAY_TYPEMAPS, dataType) && _.contains(xml2js.ARRAY_TYPEMAPS[dataType].classes, className)) {
- type_js = xml2js.ARRAY_TYPEMAPS[dataType].arrayType;
- } else if (_.has(xml2js.POINTER_TYPEMAPS, className) && _.has(xml2js.POINTER_TYPEMAPS[className], dataType)) {
- type_js = xml2js.POINTER_TYPEMAPS[className][dataType];
- } else if (_.has(xml2js.CLASSES, dataType)) { // TODO: verify that swig does this mapping
- type_js = dataType;
- } else {
- type_js = dataType + ' &#42;'
- }
- }
- return type_js;
-}
-
-
-// verify that all types associated with the method are valid
-function hasValidTypes(methodSpec, methodName, parent) {
- var valid = true;
- var msg = (xml2js.opts.strict ? ' is omitted from JS documentation.' : ' has invalid type(s).');
- var printIgnoredMethodOnce = _.once(function() { console.log(methodName + msg); });
- _.each(methodSpec.params, function(paramSpec, paramName) {
- if (!isValidType(paramSpec.type, parent)) {
- valid = false;
- printIgnoredMethodOnce();
- console.log(' Error: parameter ' + paramName + ' has invalid type ' + typeToString(paramSpec.type));
- }
- });
- if (!_.isEmpty(methodSpec.return) && !isValidType(methodSpec.return.type, parent)) {
- valid = false;
- printIgnoredMethodOnce();
- console.log(' Error: returns invalid type ' + typeToString(methodSpec.return.type));
- }
- return valid;
-}
-
-
-// verify that type of variable is valid
-function ofValidType(varSpec, varName, parent) {
- if (isValidType(varSpec.type, parent)) {
- return true;
- } else {
- var msgAddendum = (xml2js.opts.strict ? ' Omitted from JS documentation.' : '');
- console.log('Error: ' + varName + ' is of invalid type ' + typeToString(varSpec.type) + '.' + msgAddendum);
- return false;
- }
-}
-
-
-// verify whether the given type is valid JS
-function isValidType(type, parent) {
- return (_.contains(_.values(xml2js.TYPEMAPS), type) ||
- _.has(xml2js.CLASSES, type) ||
- _.has(xml2js.ENUMS_BY_GROUP, type) ||
- _.contains(['Buffer', 'Function', 'mraa_result_t'], type) ||
- _.has((parent ? xml2js.CLASSES[parent].enums_by_group : []), type) ||
- isValidPointerType(type, parent));
-}
-
-
-function isValidPointerType(type, parent) {
- var className = parent.toLowerCase();
- var arrayTypemap = _.find(xml2js.ARRAY_TYPEMAPS, function(to) { return to.arrayType == type; });
- var valid = ((arrayTypemap && _.contains(arrayTypemap.classes, className)) ||
- (_.has(xml2js.POINTER_TYPEMAPS, className) && (_.contains(_.values(xml2js.POINTER_TYPEMAPS[className]), type))));
- return valid;
-}
-
-
-// determines whether a type looks like a c pointer
-function isPointer(type) {
- return (type.search(/\w+\s*(\*|&amp;)$/) != -1);
-}
-
-
-// remove extraneous whitespace from pointer types as canonical representation
-function normalizePointer(ptr) {
- return ptr.replace(/\s*$/, '');
-}
-
-
-// get the data type of a pointer (e.g. int is the data type of int*)
-function getPointerDataType(ptr) {
- return ptr.replace(/\s*(\*|&amp;)$/, '');
-}
-
-
-// print more human friendly type for error messages
-function typeToString(type) {
- return type.replace('&#42;', '*');
-}
-
-
-// get the detailed description of a method's parameters
-function getParamsDetails(spec_c) {
- var paras = getChildren(spec_c, 'para');
- var details = _.find(_.map(paras, function(para) {
- return getChild(para, 'parameterlist');
- }), function(obj) { return (obj != undefined); });
- return (details ? details.children : undefined);
-}
-
-
-// get the detailed description of a method's return value
-function getReturnDetails(spec_c) {
- var paras = getChildren(spec_c, 'para');
- return _.find(_.map(paras, function(para) {
- return getChild(para, 'simplesect');
- }), function(obj) { return ((obj != undefined) && (getAttr(obj, 'kind') == 'return')); });
-}
-
-
-// get (and flatten) the text of the given object
-function getText(obj, why) {
- // TODO: links ignored for now, patched for types for
- var GENERATE_LINK = function(x) { return x + ' '; }
- return _.reduce(obj.children, function(text, elem) {
- if (_.isString(elem)) {
- return text += elem.trim() + ' ';
- } else if (_.isPlainObject(elem)) {
- switch(elem.name) {
- case 'para':
- return text += getText(elem, why) + ' \n';
- case 'ref':
- return text += GENERATE_LINK(getText(elem, why));
- case 'parameterlist':
- case 'simplesect':
- return text; // to be handled elsewhere
- case 'programlisting':
- case 'htmlonly':
- return text; // ignored
- // TODO: html doesn't seem to work for yuidoc, using markdown for now
- case 'itemizedlist':
- return text += '\n' + getText(elem, why) + ' \n \n';
- case 'listitem':
- return text += '+ ' + getText(elem, why) + '\n';
- case 'bold':
- return text += '__' + getText(elem, why).trim() + '__ ';
- case 'ulink':
- return text += '[' + getText(elem, why).trim() + '](' + getAttr(elem, 'url').trim() + ') ';
- case 'image':
- // TODO: copy images over; hard coded for now
- var fn = getAttr(elem, 'name');
- return text += ' \n \n![' + fn + '](' + xml2js.opts.imagedir + '/' + fn + ') ';
- case 'linebreak':
- return text += ' \n';
- case 'ndash':
- return text += '&ndash; ';
- default:
- // TODO: incomplete list of doxygen xsd implemented
- console.warn('NYI Unknown Object Type: ' + elem.name);
- return text;
- //throw new Error('NYI Unknown Object Type: ' + elem.name);
- }
- } else {
- throw new Error('NYI Unknown Type: ' + (typeof elem));
- }
- }, '').trim();
-}
-
-
-// get the value of attribute with the given name of the given object
-function getAttr(obj, name) {
- return _.find(obj.attr, function(item) {
- return item.name == name;
- }).value;
-}
-
-
-// get the child object with the given name of the given object
-function getChild(obj, name) {
- return _.find(obj.children, function(child) {
- return child.name == name;
- });
-}
-
-
-// get all children objects with the given name of the given object
-function getChildren(obj, name) {
- return _.filter(obj.children, function(child) {
- return child.name == name;
- });
-}
-
-
-// debug helper: print untruncated object
-function printObj(obj) {
- console.log(util.inspect(obj, false, null));
-}
-
-
-module.exports = xml2js; \ No newline at end of file
diff --git a/peripheral/libupm/doxy/samples.mapping.txt b/peripheral/libupm/doxy/samples.mapping.txt
deleted file mode 100644
index db7c4c7..0000000
--- a/peripheral/libupm/doxy/samples.mapping.txt
+++ /dev/null
@@ -1,73 +0,0 @@
-# Mapping C++ sample files to Java sample files
-a110x-intr.cxx A110X_intrSample.java
-a110x.cxx A110XSample.java
-adc121c021.cxx ADC121C021Sample.java
-adxl345.cxx Adxl345Sample.java
-biss0001.cxx BISS0001Sample.java
-bmpx8x.cxx BMPX8XSample.java
-buzzer-sound.cxx Buzzer_soundSample.java
-cjq4435.cxx CJQ4435Sample.java
-ds1307.cxx DS1307Sample.java
-enc03r.cxx ENC03RSample.java
-es08a.cxx ES08ASample.java
-grovebutton.cxx GroveButtonSample.java
-groveehr.cxx GroveEHRSample.java
-groveled.cxx GroveLEDSample.java
-grovelinefinder.cxx GroveLineFinderSample.java
-grovelight.cxx GroveLightSample.java
-grovemoisture.cxx GroveMoistureSample.java
-groverelay.cxx GroveRelaySample.java
-groverotary.cxx GroveRotarySample.java
-grovescam.cxx GROVESCAMSample.java
-groveslide.cxx GroveSlideSample.java
-grovespeaker.cxx GroveSpeakerSample.java
-grovevdiv.cxx GroveVDivSample.java
-grovewater.cxx GroveWaterSample.java
-grovewfs.cxx GroveWFSSample.java
-guvas12d.cxx GUVAS12DSample.java
-h3lis331dl.cxx H3LIS331DLSample.java
-hcsr04.cxx HCSR04Sample.java
-hm11.cxx HM11Sample.java
-hmc5883l.cxx Hmc5883lSample.java
-htu21d.cxx HTU21DSample.java
-itg3200.cxx Itg3200Sample.java
-jhd1313m1-lcd.cxx Jhd1313m1_lcdSample.java
-joystick12.cxx Joystick12Sample.java
-lcm1602-i2c.cxx Lcm1602_i2cSample.java
-ldt0028.cxx LDT0028Sample.java
-lol.cxx LoLSample.java
-lsm303.cxx LSM303Sample.java
-m24lr64e.cxx M24LR64ESample.java
-max44000.cxx MAX44000Sample.java
-mic.cxx MicrophoneSample.java
-mma7455.cxx MMA7455Sample.java
-mma7660.cxx MMA7660Sample.java
-mpl3115a2.cxx MPL3115A2Sample.java
-mpr121.cxx MPR121Sample.java
-mpu9150.cxx MPU9150Sample.java
-mq2.cxx MQ2Sample.java
-mq303a.cxx MQ303ASample.java
-mq5.cxx MQ5Sample.java
-my9221-ledbar.cxx MY9221_ledbarSample.java
-nrf24l01-receiver.cxx NRF24L01_receiverSample.java
-nrf24l01-transmitter.cxx NRF24L01_transmitterSample.java
-nunchuck.cxx NUNCHUCKSample.java
-otp538u.cxx OTP538USample.java
-ppd42ns.cxx PPD42NSSample.java
-pulsensor.cxx PulsensorSample.java
-rfr359f.cxx RFR359FSample.java
-rotaryencoder.cxx RotaryEncoderSample.java
-rpr220-intr.cxx RPR220_intrSample.java
-rpr220.cxx RPR220Sample.java
-ssd1308-oled.cxx SSD1308_oledSample.java
-ssd1327-oled.cxx SSD1327_oledSample.java
-st7735.cxx ST7735Sample.java
-stepmotor.cxx StepMotorSample.java
-tm1637.cxx TM1637Sample.java
-tp401.cxx TP401Sample.java
-tsl2561.cxx TSL2561Sample.java
-ttp223.cxx TTP223Sample.java
-ublox6.cxx Ublox6Sample.java
-uln200xa.cxx ULN200XASample.java
-wt5001.cxx WT5001Sample.java
-yg1006.cxx YG1006Sample.java
diff --git a/peripheral/libupm/examples/c++/CMakeLists.txt b/peripheral/libupm/examples/c++/CMakeLists.txt
deleted file mode 100644
index b227703..0000000
--- a/peripheral/libupm/examples/c++/CMakeLists.txt
+++ /dev/null
@@ -1,260 +0,0 @@
-# Extract module name from non-standard example name
-macro(get_module_name example_name module_name)
- string(LENGTH ${example_name} length)
- string(FIND ${example_name} "-" index)
- if (${index} GREATER 1)
- string(SUBSTRING ${example_name} 0 ${index} substr)
- set(${module_name} ${substr})
- elseif (${example_name} MATCHES "^grove")
- set (${module_name} "grove")
- elseif ((${example_name} MATCHES "^mq" AND ${length} EQUAL 3) OR ${example_name} STREQUAL "tp401")
- set (${module_name} "gas")
- else()
- set(${module_name} ${example_name})
- endif()
-endmacro()
-
-# Set source file, include and linker settings for an example
-# If example cannot be built, example_bin is cleared
-macro(add_custom_example example_bin example_src example_module_list)
- set(found_all_modules TRUE)
- foreach (module ${example_module_list})
- if (NOT EXISTS "${PROJECT_SOURCE_DIR}/src/${module}")
- set(found_all_modules FALSE)
- endif()
- if (MODULE_LIST)
- list(FIND MODULE_LIST ${module} index)
- if (${index} EQUAL -1)
- set(found_all_modules FALSE)
- endif()
- endif()
- endforeach()
- if (found_all_modules)
- add_executable (${example_bin} ${example_src})
- target_link_libraries (${example_bin} ${CMAKE_THREAD_LIBS_INIT})
- foreach (module ${example_module_list})
- set(module_dir "${PROJECT_SOURCE_DIR}/src/${module}")
- include_directories (${module_dir})
- if (${module} STREQUAL "lcd")
- set(module "i2clcd")
- endif()
- target_link_libraries (${example_bin} ${module})
- endforeach()
- else()
- MESSAGE(INFO " Ignored ${example_bin}")
- set (example_bin "")
- endif()
-endmacro()
-
-
-# Add specified example by name
-# Note special case for grove based examples
-macro(add_example example_name)
- set(example_src "${example_name}.cxx")
- set(example_bin "${example_name}-example")
- get_module_name(${example_name} module_name)
- set(module_dir "${PROJECT_SOURCE_DIR}/src/${module_name}")
- if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${example_src}"
- AND EXISTS ${module_dir}
- AND IS_DIRECTORY ${module_dir})
- add_custom_example(${example_bin} ${example_src} ${module_name})
- if ((NOT ${example_bin} STREQUAL "") AND (${module_name} STREQUAL "grove"))
- set(grove_module_path "${PROJECT_SOURCE_DIR}/src/${example_name}")
- if (EXISTS ${grove_module_path})
- include_directories(${grove_module_path})
- target_link_libraries (${example_bin} ${example_name})
- endif()
- endif()
- else()
- MESSAGE(INFO " Ignored ${example_bin}")
- endif()
-endmacro()
-
-
-set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/examples)
-
-# Set the mraa include and link directories prior to adding examples
-include_directories (${MRAA_INCLUDE_DIRS})
-link_directories (${MRAA_LIBDIR})
-
-# If your sample source file matches the name of the module it tests, add it here
-# Exceptions are as follows:
-# string after first '-' is ignored (e.g. nrf24l01-transmitter maps to nrf24l01)
-# mq? will use module gas
-# grove* will use module grove
-add_example (hmc5883l)
-add_example (groveled)
-add_example (groverelay)
-add_example (grovelight)
-add_example (grovetemp)
-add_example (grovebutton)
-add_example (groverotary)
-add_example (groveslide)
-add_example (buzzer-sound)
-add_example (nrf24l01-transmitter)
-add_example (nrf24l01-receiver)
-add_example (nrf24l01-broadcast)
-add_example (hcsr04)
-add_example (max44000)
-add_example (mma7455)
-add_example (st7735)
-add_example (max31855)
-add_example (bmpx8x)
-add_example (stepmotor)
-add_example (pulsensor)
-add_example (mic)
-add_example (mpu9150)
-add_example (maxds3231m)
-add_example (max31723)
-add_example (max5487)
-add_example (nrf8001-broadcast)
-add_example (nrf8001-helloworld)
-add_example (lpd8806)
-add_example (mlx90614)
-add_example (ecs1030)
-add_example (mq2)
-add_example (mq3)
-add_example (mq4)
-add_example (mq5)
-add_example (mq6)
-add_example (mq7)
-add_example (mq8)
-add_example (mq9)
-add_example (tp401)
-add_example (tcs3414cs)
-add_example (th02)
-add_example (ttp223)
-add_example (lsm303)
-add_example (joystick12)
-add_example (lol)
-add_example (tsl2561)
-add_example (htu21d)
-add_example (mpl3115a2)
-add_example (ldt0028)
-add_example (am2315)
-add_example (itg3200)
-add_example (enc03r)
-add_example (adc121c021)
-add_example (ds1307)
-add_example (a110x)
-add_example (gp2y0a)
-add_example (grovemoisture)
-add_example (groveehr)
-add_example (ta12200)
-add_example (grovelinefinder)
-add_example (grovevdiv)
-add_example (grovewater)
-add_example (guvas12d)
-add_example (mpr121)
-add_example (ublox6)
-add_example (yg1006)
-add_example (wt5001)
-add_example (ppd42ns)
-add_example (mq303a)
-add_example (grovespeaker)
-add_example (rfr359f)
-add_example (biss0001)
-add_example (rotaryencoder)
-add_example (adxl345)
-add_example (rpr220)
-add_example (rpr220-intr)
-add_example (mma7660)
-add_example (cjq4435)
-add_example (adxl335)
-add_example (hmtrp)
-add_example (nunchuck)
-add_example (otp538u)
-add_example (grovecollision)
-add_example (groveelectromagnet)
-add_example (groveemg)
-add_example (groveo2)
-add_example (grovegsr)
-add_example (ina132)
-add_example (l298)
-add_example (l298-stepper)
-add_example (at42qt1070)
-add_example (grovemd)
-add_example (grovemd-stepper)
-add_example (pca9685)
-add_example (groveeldriver)
-add_example (adafruitss)
-add_example (adafruitms1438)
-add_example (adafruitms1438-stepper)
-add_example (hx711)
-add_example (flex)
-add_example (a110x-intr)
-add_example (mhz16)
-add_example (apds9002)
-add_example (waterlevel)
-add_example (tm1637)
-add_example (zfm20)
-add_example (zfm20-register)
-add_example (uln200xa)
-add_example (grovewfs)
-add_example (isd1820)
-add_example (sx6119)
-add_example (si114x)
-add_example (maxsonarez)
-add_example (hm11)
-add_example (ht9170)
-add_example (h3lis331dl)
-add_example (ad8232)
-add_example (grovescam)
-add_example (m24lr64e)
-add_example (rgbringcoder)
-add_example (hp20x)
-add_example (pn532)
-add_example (pn532-writeurl)
-add_example (lsm9ds0)
-add_example (loudness)
-add_example (mg811)
-add_example (wheelencoder)
-add_example (sm130)
-add_example (grovegprs)
-add_example (lm35)
-add_example (micsv89)
-add_example (xbee)
-add_example (urm37)
-add_example (urm37-uart)
-add_example (adxrs610)
-add_example (bma220)
-add_example (dfrph)
-add_example (mcp9808)
-add_example (groveultrasonic)
-add_example (sx1276-lora)
-add_example (sx1276-fsk)
-add_example (ili9341)
-if (OPENZWAVE_FOUND)
- include_directories(${OPENZWAVE_INCLUDE_DIRS})
- add_example (ozw)
-endif()
-add_example (nlgpio16)
-add_example (ads1x15)
-if (MODBUS_FOUND)
- include_directories(${MODBUS_INCLUDE_DIRS})
- add_example (t3311)
- add_example (hwxpxx)
-endif()
-add_example (hdxxvxta)
-add_example (rhusb)
-add_example (apds9930)
-add_example (kxcjk1013)
-add_example (ssd1351)
-
-# These are special cases where you specify example binary, source file and module(s)
-include_directories (${PROJECT_SOURCE_DIR}/src)
-add_custom_example (groveled-multi-example groveled-multi.cxx grove)
-add_custom_example (lcm1602-i2c-example lcm1602-i2c.cxx lcd)
-add_custom_example (lcm1602-parallel-example lcm1602-parallel.cxx lcd)
-add_custom_example (jhd1313m1-lcd-example jhd1313m1-lcd.cxx lcd)
-add_custom_example (es08a-example es08a.cxx servo)
-add_custom_example (ssd1306-oled-example ssd1306-oled.cxx lcd)
-add_custom_example (ssd1308-oled-example ssd1308-oled.cxx lcd)
-add_custom_example (ssd1327-oled-example ssd1327-oled.cxx lcd)
-add_custom_example (sainsmartks-example sainsmartks.cxx lcd)
-add_custom_example (eboled-example eboled.cxx lcd)
-add_custom_example (mpu60x0-example mpu60x0.cxx mpu9150)
-add_custom_example (ak8975-example ak8975.cxx mpu9150)
-add_custom_example (mpu9250-example mpu9250.cxx mpu9150)
-add_custom_example (groveledbar-example groveledbar.cxx my9221)
-add_custom_example (grovecircularled-example grovecircularled.cxx my9221)
diff --git a/peripheral/libupm/examples/c++/a110x-intr.cxx b/peripheral/libupm/examples/c++/a110x-intr.cxx
deleted file mode 100644
index 187c2ed..0000000
--- a/peripheral/libupm/examples/c++/a110x-intr.cxx
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "a110x.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-// Our pulse counter
-volatile unsigned int counter = 0;
-
-// Our interrupt handler
-void hallISR(void *arg)
-{
- counter++;
-}
-
-int main ()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // Instantiate an A110X sensor on digital pin D2
- upm::A110X* hall = new upm::A110X(2);
-
- // This example uses a user-supplied interrupt handler to count
- // pulses that occur when a magnetic field of the correct polarity
- // is detected. This could be used to measure the rotations per
- // minute (RPM) of a rotor for example.
-
- hall->installISR(hallISR, NULL);
-
- while (shouldRun)
- {
- cout << "Pulses detected: " << counter << endl;
-
- sleep(1);
- }
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete hall;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/a110x.cxx b/peripheral/libupm/examples/c++/a110x.cxx
deleted file mode 100644
index 30c355d..0000000
--- a/peripheral/libupm/examples/c++/a110x.cxx
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "a110x.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-
-int main ()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // Instantiate an A110X sensor on digital pin D2
- upm::A110X* hall = new upm::A110X(2);
-
- // check every second for the presence of a magnetic field (south
- // polarity)
- while (shouldRun)
- {
- bool val = hall->magnetDetected();
- if (val)
- cout << "Magnet (south polarity) detected." << endl;
- else
- cout << "No magnet detected." << endl;
-
- sleep(1);
- }
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete hall;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/ad8232.cxx b/peripheral/libupm/examples/c++/ad8232.cxx
deleted file mode 100644
index 5d03527..0000000
--- a/peripheral/libupm/examples/c++/ad8232.cxx
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "ad8232.h"
-
-using namespace std;
-
-bool shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // Instantiate a Ad8232 sensor on digital pins 10 (LO+), 11 (LO-)
- // and an analog pin, 0 (OUTPUT)
- upm::AD8232 *ad8232 = new upm::AD8232(10, 11, 0);
-
- // Output the raw numbers from the ADC, for plotting elsewhere.
- // A return of 0 indicates a Lead Off (LO) condition.
- // In theory, this data could be fed to software like Processing
- // (https://www.processing.org/) to plot the data just like an
- // EKG you would see in a hospital.
- while (shouldRun)
- {
- cout << ad8232->value() << endl;
- usleep(1000);
- }
-//! [Interesting]
-
- cout << "Exiting" << endl;
-
- delete ad8232;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/adafruitms1438-stepper.cxx b/peripheral/libupm/examples/c++/adafruitms1438-stepper.cxx
deleted file mode 100644
index 1bcf75b..0000000
--- a/peripheral/libupm/examples/c++/adafruitms1438-stepper.cxx
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <signal.h>
-#include <iostream>
-#include "adafruitms1438.h"
-
-using namespace std;
-using namespace upm;
-
-int main(int argc, char **argv)
-{
-//! [Interesting]
- // Instantiate an Adafruit MS 1438 on I2C bus 0
-
- upm::AdafruitMS1438 *ms =
- new upm::AdafruitMS1438(ADAFRUITMS1438_I2C_BUS,
- ADAFRUITMS1438_DEFAULT_I2C_ADDR);
-
- // Setup for use with a stepper motor connected to the M1 & M2 ports
-
- // set a PWM period of 50Hz
-
- // disable first, to be safe
- ms->disableStepper(AdafruitMS1438::STEPMOTOR_M12);
-
- // configure for a NEMA-17, 200 steps per revolution
- ms->stepConfig(AdafruitMS1438::STEPMOTOR_M12, 200);
-
- // set speed at 10 RPM's
- ms->setStepperSpeed(AdafruitMS1438::STEPMOTOR_M12, 10);
- ms->setStepperDirection(AdafruitMS1438::STEPMOTOR_M12,
- AdafruitMS1438::DIR_CW);
-
- // enable
- cout << "Enabling..." << endl;
- ms->enableStepper(AdafruitMS1438::STEPMOTOR_M12);
-
- cout << "Rotating 1 full revolution at 10 RPM speed." << endl;
- ms->stepperSteps(AdafruitMS1438::STEPMOTOR_M12, 200);
-
- cout << "Sleeping for 2 seconds..." << endl;
- sleep(2);
- cout << "Rotating 1/2 revolution in opposite direction at 10 RPM speed."
- << endl;
-
- ms->setStepperDirection(AdafruitMS1438::STEPMOTOR_M12,
- AdafruitMS1438::DIR_CCW);
- ms->stepperSteps(AdafruitMS1438::STEPMOTOR_M12, 100);
-
- cout << "Disabling..." << endl;
- ms->disableStepper(AdafruitMS1438::STEPMOTOR_M12);
-
- cout << "Exiting" << endl;
-
-//! [Interesting]
-
- delete ms;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/adafruitms1438.cxx b/peripheral/libupm/examples/c++/adafruitms1438.cxx
deleted file mode 100644
index 8ca184c..0000000
--- a/peripheral/libupm/examples/c++/adafruitms1438.cxx
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <signal.h>
-#include <iostream>
-#include "adafruitms1438.h"
-
-using namespace std;
-using namespace upm;
-
-int main(int argc, char **argv)
-{
-//! [Interesting]
- // Instantiate an Adafruit MS 1438 on I2C bus 0
-
- upm::AdafruitMS1438 *ms =
- new upm::AdafruitMS1438(ADAFRUITMS1438_I2C_BUS,
- ADAFRUITMS1438_DEFAULT_I2C_ADDR);
-
- // Setup for use with a DC motor connected to the M3 port
-
- // set a PWM period of 50Hz
- ms->setPWMPeriod(50);
-
- // disable first, to be safe
- ms->disableMotor(AdafruitMS1438::MOTOR_M3);
-
- // set speed at 50%
- ms->setMotorSpeed(AdafruitMS1438::MOTOR_M3, 50);
- ms->setMotorDirection(AdafruitMS1438::MOTOR_M3, AdafruitMS1438::DIR_CW);
-
- cout << "Spin M3 at half speed for 3 seconds, then reverse for 3 seconds."
- << endl;
-
- ms->enableMotor(AdafruitMS1438::MOTOR_M3);
-
- sleep(3);
-
- cout << "Reversing M3" << endl;
- ms->setMotorDirection(AdafruitMS1438::MOTOR_M3, AdafruitMS1438::DIR_CCW);
-
- sleep(3);
-
- cout << "Stopping M3" << endl;
- ms->disableMotor(AdafruitMS1438::MOTOR_M3);
-
- cout << "Exiting" << endl;
-
-//! [Interesting]
-
- delete ms;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/adafruitss.cxx b/peripheral/libupm/examples/c++/adafruitss.cxx
deleted file mode 100644
index f2a7ebf..0000000
--- a/peripheral/libupm/examples/c++/adafruitss.cxx
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Author: Stan Gifford <stan@gifford.id.au>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-/**
- * Description
- * Demo program for Adafruit 16 channel servo shield/controller
- * Physical setup for tests is a single servo attached to one channel.
- * Note - when 3 or more GWS servos attached results unpredictable.
- * Adafruit do recommend a Cap be installed on the board which should alleviate the issue.
- * I (and Adafruit) are unable to give any Capacitor sizing data.
- */
-
-#include <iostream>
-#include "adafruitss.h"
-#include <unistd.h>
-
-using namespace std;
-
-int main() {
-
-int n;
-
-//! [Interesting]
- upm::adafruitss* servos = new upm::adafruitss(6,0x40);
-
- for (;;)
- {
- cout << "Setting all to 0" << endl;
- for (n = 0; n < 16; n++)
- servos->servo(n, 1, 0); // GWS Mini Servo = Type 1.
- usleep(1000000); // Wait 1 second
-
- cout << "Setting all to 45" << endl;
- for (n = 0; n < 16; n++)
- servos->servo(n, 1, 45);
- usleep(1000000); // Wait 1 second
-
- cout << "Setting all to 90" << endl;
- for (n = 0; n < 16; n++)
- servos->servo(n, 1, 90);
- usleep(1000000); // Wait 1 second
-
- cout << "Setting all to 135" << endl;
- for (n = 0; n < 16; n++)
- servos->servo(n, 1, 135);
- usleep(1000000); // Wait 1 second
-
- cout << "Setting all to 180" << endl;
- for (n = 0; n < 16; n++)
- servos->servo(n, 1, 160);
- usleep(2000000); // Wait 1 second
- }
-//! [Interesting]
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/adc121c021.cxx b/peripheral/libupm/examples/c++/adc121c021.cxx
deleted file mode 100644
index 18288ad..0000000
--- a/peripheral/libupm/examples/c++/adc121c021.cxx
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <signal.h>
-#include <iostream>
-#include "adc121c021.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main(int argc, char **argv)
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // Instantiate an ADC121C021 on I2C bus 0
-
- upm::ADC121C021 *adc = new upm::ADC121C021(ADC121C021_I2C_BUS,
- ADC121C021_DEFAULT_I2C_ADDR);
-
- // An analog sensor, such as a Grove light sensor,
- // must be attached to the adc
- // Prints the value and corresponding voltage every 50 milliseconds
- while (shouldRun)
- {
- uint16_t val = adc->value();
- cout << "ADC value: " << val << " Volts = "
- << adc->valueToVolts(val) << endl;
- usleep(50000);
- }
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete adc;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/adis16448.cxx b/peripheral/libupm/examples/c++/adis16448.cxx
deleted file mode 100644
index a1d4296..0000000
--- a/peripheral/libupm/examples/c++/adis16448.cxx
+++ /dev/null
@@ -1,66 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////////////
-// The MIT License (MIT)
-//
-// Submit Date: 03/09/2015
-// Author: Juan Jose Chong <juanjchong@gmail.com>
-// Copyright (c) 2015 Juan Jose Chong
-//
-//////////////////////////////////////////////////////////////////////////////////////
-// adis16448.cxx
-//////////////////////////////////////////////////////////////////////////////////////
-//
-// This example code runs on an Intel Edison and uses mraa to acquire data
-// from an ADIS16448. This data is then scaled and printed onto the terminal.
-//
-// This software has been tested to connect to an ADIS16448 through a level shifter
-// such as the TI TXB0104. The SPI lines (DIN, DOUT, SCLK, /CS) are all wired through
-// the level shifter and the ADIS16448 is also being powered by the Intel Edison.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-//////////////////////////////////////////////////////////////////////////////////////
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-
-#include "adis16448.h"
-
-int
-main(int argc, char **argv)
-{
- while(true)
- {
- //! [Interesting]
- upm::ADIS16448* imu = new upm::ADIS16448(0,3); //upm::ADIS16448(SPI,RST)
-
- //Read the specified register, scale it, and display it on the screen
- std::cout << "XGYRO_OUT:" << imu->gyroScale(imu->regRead(XGYRO_OUT)) << std::endl;
- std::cout << "YGYRO_OUT:" << imu->gyroScale(imu->regRead(YGYRO_OUT)) << std::endl;
- std::cout << "ZGYRO_OUT:" << imu->gyroScale(imu->regRead(ZGYRO_OUT)) << std::endl;
- std::cout << " " << std::endl;
- std::cout << "XACCL_OUT:" << imu->accelScale(imu->regRead(XACCL_OUT)) << std::endl;
- std::cout << "YACCL_OUT:" << imu->accelScale(imu->regRead(YACCL_OUT)) << std::endl;
- std::cout << "ZACCL_OUT:" << imu->accelScale(imu->regRead(ZACCL_OUT)) << std::endl;
- std::cout << " " << std::endl;
- //! [Interesting]
- sleep(1);
- }
- return (0);
-}
diff --git a/peripheral/libupm/examples/c++/ads1x15.cxx b/peripheral/libupm/examples/c++/ads1x15.cxx
deleted file mode 100644
index 3c5da65..0000000
--- a/peripheral/libupm/examples/c++/ads1x15.cxx
+++ /dev/null
@@ -1,320 +0,0 @@
-/*
- * Author: Marc Graham <marc@m2ag.net>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include "mraa.hpp"
-
-#include <iostream>
-#include <unistd.h>
-#include "ads1015.h"
-#include "ads1115.h"
-
-
-
-int main()
-{
-
- using namespace std;
- using namespace upm;
- int command;
- //Select the device you are testing here and adjust case 6 for the correct sample rates.
- //upm::ADS1015 *ads = new upm::ADS1015(1);
- upm::ADS1115 *ads = new upm::ADS1115(1, 0x49);
- float inputVoltage;
- int ans;
-
- do
- {
-
- cout << endl;
- cout << "1 - get Conversion \t" ;
- cout << "2 - get last conversion" << endl;
- cout << "3 - get Gain \t\t";
- cout << "4 - set Gain" << endl;;
- cout << "5 - get Data Rate \t";
- cout << "6 - set Data Rate" << endl;
- cout << "7 - Set Upper Threshold \t" ;
- cout << "8 - Set Lower Threshold \t";
- cout << "9 - Display Thresholds \t";
- cout << "10 - Set Default Thresholds \t";
- cout << "11 - Set conversion ready" << endl;
- cout << "12 - get Comp Que \t" ;
- cout << "13 - set Comp Que" << endl;
- cout << "14 - get Comp Pol \t";
- cout << "15 - set Comp Pol" << endl;
- cout << "16 - get Comp mode \t";
- cout << "17 - set Comp mode " << endl;
- cout << "18 - get Comp Latch\t";
- cout << "19 - set Comp Latch " << endl;
- cout << "20 - get Continuous \t";
- cout << "21 - set Continuous \t" << endl;
- cout << "-1 - exit" << endl;
- cout << "Enter a command: ";
- cin >> command;
-
-
- switch(command)
- {
- case 2:
- cout << ads->getLastSample() << endl;
- break;
- case 3:
- cout << std::hex << ads->getGain() << endl;
- break;
- case 5:
- cout << std::hex << ads->getSPS() << endl;
- break;
- case 4:
- int gain;
- ADS1015::ADSGAIN set_gain;
- cout << "select one of the following:" << endl;
- cout << "1 -> gain 2/3 \t 2 -> gain1 \t 3 -> gain 2" << endl;
- cout << "4 -> gain 4 \t 5 -> gain 8 \t 6 -> gain 15" << endl;
- cin >> gain;
- switch(gain){
- case 1:
- set_gain = ADS1X15::GAIN_TWOTHIRDS;
- break;
- case 2:
- set_gain = ADS1X15::GAIN_ONE;
- break;
- case 3:
- set_gain = ADS1X15::GAIN_TWO;
- break;
- case 4:
- set_gain = ADS1X15::GAIN_FOUR;
- break;
- case 5:
- set_gain = ADS1X15::GAIN_EIGHT;
- break;
- case 6:
- set_gain = ADS1X15::GAIN_SIXTEEN;
- break;
- default:
- set_gain = ADS1X15::GAIN_ONE;
- }
- ads->setGain(set_gain);
- break;
- case 6:
- int rate;
- /*ADS1015::ADSDATARATE set_rate;
- cout << "select one of the following:" << endl;
- cout << "1 -> SPS_120 \t 2 -> SPS_250 \t 3 -> SPS_490 \t 4 -> SPS_920" << endl;
- cout << "5 -> SPS_1600 \t 6 -> SPS_2400 \t 7 -> SPS_3300" << endl;
- cin >> rate;
- switch(rate){
- case 1:
- set_rate = ADS1015::SPS_128;
- break;
- case 2:
- set_rate = ADS1015::SPS_250;
- break;
- case 3:
- set_rate = ADS1015::SPS_490;
- break;
- case 4:
- set_rate = ADS1015::SPS_920;
- break;
- case 5:
- set_rate = ADS1015::SPS_1600;
- break;
- case 6:
- set_rate = ADS1015::SPS_2400;
- break;
- case 7:
- set_rate = ADS1015::SPS_3300;
- break;
- default:
- set_rate = ADS1015::SPS_1600;
- } */
- ADS1115::ADSDATARATE set_rate;
- cout << "select one of the following:" << endl;
- cout << "1 -> SPS_8 \t 2 -> SPS_16 \t 3 -> SPS_32 \t 4 -> SPS_64" << endl;
- cout << "5 -> SPS_128 \t 6 -> SPS_250 \t 7 -> SPS_475 \t 8-> SPS_860" << endl;
- cin >> rate;
- switch(rate){
- case 1:
- set_rate = ADS1115::SPS_8;
- break;
- case 2:
- set_rate = ADS1115::SPS_16;
- break;
- case 3:
- set_rate = ADS1115::SPS_32;
- break;
- case 4:
- set_rate = ADS1115::SPS_64;
- break;
- case 5:
- set_rate = ADS1115::SPS_128;
- break;
- case 6:
- set_rate = ADS1115::SPS_250;
- break;
- case 7:
- set_rate = ADS1115::SPS_475;
- break;
- case 8:
- set_rate = ADS1115::SPS_860;
- break;
- default:
- set_rate = ADS1115::SPS_128;
- }
-
- ads->setSPS(set_rate);
- break;
- case 1:
- int mode;
- ADS1X15::ADSMUXMODE set_mode;
- cout << "select one of the following:" << endl;
- cout << "1 -> MUX_0_1 \t 2 -> MUX_0_3 \t 3 -> MUX_1_3 \t 4 -> MUX_2_3" << endl;
- cout << "5 -> SINGLE_0 \t 6 -> SINGLE_1 \t 7 -> SINGLE_2 \t 8 -> SINGLE_3" << endl;
- cin >> mode;
- switch(mode){
- case 1:
- set_mode = ADS1X15::DIFF_0_1;
- break;
- case 2:
- set_mode = ADS1X15::DIFF_0_3;
- break;
- case 3:
- set_mode = ADS1X15::DIFF_1_3;
- break;
- case 4:
- set_mode = ADS1X15::DIFF_2_3;
- break;
- case 5:
- set_mode = ADS1X15::SINGLE_0;
- break;
- case 6:
- set_mode = ADS1X15::SINGLE_1;
- break;
- case 7:
- set_mode = ADS1X15::SINGLE_2;
- break;
- case 8:
- set_mode = ADS1X15::SINGLE_3;
- break;
- default:
- set_mode = ADS1X15::DIFF_0_1;
- break;
- }
- cout << ads->getSample(set_mode) << endl;
- break;
- case 7:
- cout << " enter a float value: " ;
- cin >> inputVoltage;
- ads->setThresh(ADS1115::THRESH_HIGH, inputVoltage);
- break;
- case 8:
- cout << " enter a float value: " ;
- cin >> inputVoltage;
- ads->setThresh(ADS1115::THRESH_LOW, inputVoltage);
- break;
- case 9:
- cout << "Upper " << ads->getThresh(ADS1X15::THRESH_HIGH) << endl;
- cout << "Lower " << ads->getThresh(ADS1X15::THRESH_LOW) << endl;
- break;
- case 10:
- ads->setThresh(ADS1115::THRESH_DEFAULT);
- break;
- case 11:
- ads->setThresh(ADS1015::CONVERSION_RDY);
- break;
- case 12:
- cout << ads->getCompQue() << endl;
- break;
- case 13:
- int que;
- cout << "select one of the following:" << endl;
- cout << "1 -> CQUE_1CONV \t 2 -> CQUE_2CONV \t 3 -> CQUE_3CONV \t 4 -> CQUE_NONE" << endl;
- cin >> que;
- switch(que){
- case 1:
- ads->setCompQue(ADS1X15::CQUE_1CONV);
- break;
- case 2:
- ads->setCompQue(ADS1X15::CQUE_2CONV);
- break;
- case 3:
- ads->setCompQue(ADS1X15::CQUE_4CONV);
- break;
- case 4:
- default:
- ads->setCompQue(ADS1X15::CQUE_NONE);
- break;
- }
- break;
- case 14:
- cout << ads->getCompPol() << endl;
- break;
- case 15:
- cout << "select one of the following:" << endl;
- cout << "1 -> active high \t 2 -> active low" << endl;
- cin >> ans;
- if(ans == 1) ads->setCompPol(true);
- else ads->setCompPol(false);
- break;
- case 16:
- cout << ads->getCompMode() << endl;
- break;
- case 17:
- cout << "select one of the following:" << endl;
- cout << "1 -> Window \t 2 -> Traditional (default)" << endl;
- cin >> ans;
- if(ans == 1) ads->setCompMode(true);
- else ads->setCompMode();
- break;
- case 18:
- cout << ads->getCompLatch() << cout;
- break;
- case 19:
- cout << "select one of the following:" << endl;
- cout << "1 -> Latching \t 2 -> Non-latching (default)" << endl;
- cin >> ans;
- if(ans == 1) ads->setCompLatch(true);
- else ads->setCompLatch();
- break;
- case 20:
- cout << ads->getContinuous() << cout;
- break;
- case 21:
- cout << "select one of the following:" << endl;
- cout << "1 -> Power Down (default) \t 2 -> Continuous" << endl;
- cin >> ans;
- if(ans == 1) ads->setContinuous(true);
- else ads->setContinuous();
- break;
- case -1:
- break;
- default:
-
- break;
- }
-
- }while (command != -1 );
-
- delete ads;
-
- return MRAA_SUCCESS;
-}
diff --git a/peripheral/libupm/examples/c++/adxl335.cxx b/peripheral/libupm/examples/c++/adxl335.cxx
deleted file mode 100644
index 471695d..0000000
--- a/peripheral/libupm/examples/c++/adxl335.cxx
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "adxl335.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-
-int main ()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // Instantiate an ADXL335 accelerometer on analog pins A0, A1, and A2
- upm::ADXL335* accel = new upm::ADXL335(0, 1, 2);
-
- cout << "Please make sure the sensor is completely still. Sleeping for"
- << " 2 seconds." << endl;
- sleep(2);
- cout << "Calibrating..." << endl;
-
- accel->calibrate();
-
- while (shouldRun)
- {
- int x, y, z;
- float aX, aY, aZ;
-
- accel->values(&x, &y, &z);
- cout << "Raw Values: X: " << x << " Y: " << y << " Z: " << z << endl;
-
- accel->acceleration(&aX, &aY, &aZ);
- cout << "Acceleration: X: " << aX << "g" << endl;
- cout << "Acceleration: Y: " << aY << "g" << endl;
- cout << "Acceleration: Z: " << aZ << "g" << endl;
- cout << endl;
-
- usleep(200000);
- }
-//! [Interesting]
-
- cout << "Exiting" << endl;
-
- delete accel;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/adxl345.cxx b/peripheral/libupm/examples/c++/adxl345.cxx
deleted file mode 100644
index a5bc2cc..0000000
--- a/peripheral/libupm/examples/c++/adxl345.cxx
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Author: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include "adxl345.h"
-
-int
-main(int argc, char **argv)
-{
-//! [Interesting]
- int16_t *raw;
- float *acc;
-
- // Note: Sensor only works at 3.3V on the Intel Edison with Arduino breakout
- upm::Adxl345* accel = new upm::Adxl345(0);
-
- while(true){
- accel->update(); // Update the data
- raw = accel->getRawValues(); // Read raw sensor data
- acc = accel->getAcceleration(); // Read acceleration (g)
- fprintf(stdout, "Current scale: 0x%2xg\n", accel->getScale());
- fprintf(stdout, "Raw: %6d %6d %6d\n", raw[0], raw[1], raw[2]);
- fprintf(stdout, "AccX: %5.2f g\n", acc[0]);
- fprintf(stdout, "AccY: %5.2f g\n", acc[1]);
- fprintf(stdout, "AccZ: %5.2f g\n", acc[2]);
- sleep(1);
- }
-//! [Interesting]
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/adxrs610.cxx b/peripheral/libupm/examples/c++/adxrs610.cxx
deleted file mode 100644
index 4ec53ef..0000000
--- a/peripheral/libupm/examples/c++/adxrs610.cxx
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "adxrs610.h"
-
-using namespace std;
-
-bool shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
-
- // Instantiate a ADXRS610 sensor on analog pin A0 (dataout), and
- // analog A1 (temp out) with an analog reference voltage of
- // 5.0
- upm::ADXRS610 *sensor = new upm::ADXRS610(0, 1, 5.0);
-
- // set a deadband region around the zero point to report 0.0 (optional)
- sensor->setDeadband(0.015);
-
- // Every tenth of a second, sample the ADXRS610 and output it's
- // corresponding temperature and angular velocity
-
- while (shouldRun)
- {
- cout << "Vel (deg/s): " << sensor->getAngularVelocity() << endl;
- cout << "Temp (C): " << sensor->getTemperature() << endl;
-
- usleep(100000);
- }
-
-//! [Interesting]
-
- cout << "Exiting" << endl;
-
- delete sensor;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/ak8975.cxx b/peripheral/libupm/examples/c++/ak8975.cxx
deleted file mode 100644
index 1b95ead..0000000
--- a/peripheral/libupm/examples/c++/ak8975.cxx
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "mpu9150.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-
-int main(int argc, char **argv)
-{
- signal(SIGINT, sig_handler);
-//! [Interesting]
-
- upm::AK8975 *sensor = new upm::AK8975();
-
- sensor->init();
-
- while (shouldRun)
- {
- sensor->update();
-
- float x, y, z;
-
- sensor->getMagnetometer(&x, &y, &z);
- cout << "Magnetometer: ";
- cout << "MX = " << x << " MY = " << y << " MZ = " << z << endl;
-
- cout << endl;
-
- usleep(500000);
- }
-
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete sensor;
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/am2315.cxx b/peripheral/libupm/examples/c++/am2315.cxx
deleted file mode 100644
index 4b95e1c..0000000
--- a/peripheral/libupm/examples/c++/am2315.cxx
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Author: William Penner <william.penner@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-
-#include "am2315.h"
-
-volatile int doWork = 0;
-
-upm::AM2315 *sensor = NULL;
-
-void
-sig_handler(int signo)
-{
- if (signo == SIGINT) {
- printf("\nCtrl-C received.\n");
- doWork = 1;
- }
-}
-
-int
-main(int argc, char **argv)
-{
- // Register signal handler
- signal(SIGINT, sig_handler);
-
- //! [Interesting]
- float humidity = 0.0;
- float temperature = 0.0;
-
- sensor = new upm::AM2315(0, AM2315_I2C_ADDRESS);
-
- sensor->testSensor();
-
- while (!doWork) {
- humidity = sensor->getHumidity();
- temperature = sensor->getTemperature();
-
- std::cout << "humidity value = " <<
- humidity <<
- ", temperature value = " <<
- temperature << std::endl;
- usleep (500000);
- }
- //! [Interesting]
-
- std::cout << "exiting application" << std::endl;
-
- delete sensor;
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/apds9002.cxx b/peripheral/libupm/examples/c++/apds9002.cxx
deleted file mode 100644
index 87b5070..0000000
--- a/peripheral/libupm/examples/c++/apds9002.cxx
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Author: Zion Orent <zorent@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "apds9002.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-
-int main ()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // Instantiate a Grove Luminance sensor on analog pin A0
- upm::APDS9002* luminance = new upm::APDS9002(0);
-
- while (shouldRun)
- {
- int val = luminance->value();
- cout << "Luminance value is " << val << endl;
-
- sleep(1);
- }
-//! [Interesting]
-
- cout << "Exiting" << endl;
-
- delete luminance;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/apds9930.cxx b/peripheral/libupm/examples/c++/apds9930.cxx
deleted file mode 100644
index 8d461c9..0000000
--- a/peripheral/libupm/examples/c++/apds9930.cxx
+++ /dev/null
@@ -1,63 +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 <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "apds9930.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void
-sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int
-main()
-{
- signal(SIGINT, sig_handler);
- //! [Interesting]
- // Instantiate a Digital Proximity and Ambient Light sensor on iio device 4
- upm::APDS9930* light_proximity = new upm::APDS9930(4);
-
- while (shouldRun) {
- float lux = light_proximity->getAmbient();
- cout << "Luminance value is " << lux << endl;
- float proximity = light_proximity->getProximity();
- cout << "Proximity value is " << proximity << endl;
- sleep(1);
- }
- //! [Interesting]
-
- cout << "Exiting" << endl;
-
- delete light_proximity;
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/at42qt1070.cxx b/peripheral/libupm/examples/c++/at42qt1070.cxx
deleted file mode 100644
index c22a998..0000000
--- a/peripheral/libupm/examples/c++/at42qt1070.cxx
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <signal.h>
-#include <iostream>
-#include "at42qt1070.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-void printButtons(upm::AT42QT1070 *touch)
-{
- bool buttonPressed = false;
- uint8_t buttons = touch->getButtons();
-
- cout << "Buttons Pressed: ";
- for (int i=0; i<7; i++)
- {
- if (buttons & (1 << i))
- {
- cout << i << " ";
- buttonPressed = true;
- }
- }
-
- if (!buttonPressed)
- cout << "None";
-
- cout << endl;
-
- if (touch->isCalibrating())
- cout << "Calibration is occurring." << endl;
-
- if (touch->isOverflowed())
- cout << "Overflow was detected." << endl;
-}
-
-int main(int argc, char **argv)
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // Instantiate an AT42QT1070 on I2C bus 0
-
- upm::AT42QT1070 *touch = new upm::AT42QT1070(AT42QT1070_I2C_BUS,
- AT42QT1070_DEFAULT_I2C_ADDR);
-
- while (shouldRun)
- {
- touch->updateState();
- printButtons(touch);
- usleep(100000);
- }
-
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete touch;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/biss0001.cxx b/peripheral/libupm/examples/c++/biss0001.cxx
deleted file mode 100644
index 1574c2f..0000000
--- a/peripheral/libupm/examples/c++/biss0001.cxx
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Author: Zion Orent <zorent@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "biss0001.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-
-int main ()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // Instantiate a Grove Motion sensor on GPIO pin D2
- upm::BISS0001* motion = new upm::BISS0001(2);
-
- while (shouldRun)
- {
- bool val = motion->value();
-
- if (val)
- cout << "Detecting moving object";
- else
- cout << "No moving objects detected";
-
- cout << endl;
-
- sleep(1);
- }
-//! [Interesting]
-
- cout << "Exiting" << endl;
-
- delete motion;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/bma220.cxx b/peripheral/libupm/examples/c++/bma220.cxx
deleted file mode 100644
index a41b81a..0000000
--- a/peripheral/libupm/examples/c++/bma220.cxx
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "bma220.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-
-int main(int argc, char **argv)
-{
- signal(SIGINT, sig_handler);
-//! [Interesting]
-
- // Instantiate an BMA220 using default parameters (bus 0, addr 0x0a)
- upm::BMA220 *sensor = new upm::BMA220();
-
- // Output data every half second until interrupted
- while (shouldRun)
- {
- sensor->update();
-
- float x, y, z;
-
- sensor->getAccelerometer(&x, &y, &z);
- cout << "Accelerometer: ";
- cout << "AX: " << x << " AY: " << y << " AZ: " << z << endl;
-
- usleep(500000);
- }
-
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete sensor;
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/bmpx8x.cxx b/peripheral/libupm/examples/c++/bmpx8x.cxx
deleted file mode 100644
index 28e5be8..0000000
--- a/peripheral/libupm/examples/c++/bmpx8x.cxx
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "bmpx8x.h"
-#include <signal.h>
-
-int doWork = 0;
-upm::BMPX8X *sensor = NULL;
-
-void
-sig_handler(int signo)
-{
- printf("got signal\n");
- if (signo == SIGINT) {
- printf("exiting application\n");
- doWork = 1;
- }
-}
-
-int
-main(int argc, char **argv)
-{
- //! [Interesting]
- uint32_t presure = 0;
- float temperature = 0;
- float altitude = 0;
- uint32_t sealevel = 0;
-
- // Instantiate a BMPX8X sensor on I2C
- sensor = new upm::BMPX8X(0, ADDR);
-
- // Print the pressure, altitude, sea level, and
- // temperature values every 0.1 seconds
- while (!doWork) {
- presure = sensor->getPressure ();
- temperature = sensor->getTemperature ();
- altitude = sensor->getAltitude ();
- sealevel = sensor->getSealevelPressure ();
-
- std::cout << "pressure value = " <<
- presure <<
- ", altitude value = " <<
- altitude <<
- ", sealevel value = " <<
- sealevel <<
- ", temperature = " <<
- temperature << std::endl;
- usleep (100000);
- }
- //! [Interesting]
-
- std::cout << "exiting application" << std::endl;
-
- delete sensor;
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/buzzer-sound.cxx b/peripheral/libupm/examples/c++/buzzer-sound.cxx
deleted file mode 100644
index 1d377ba..0000000
--- a/peripheral/libupm/examples/c++/buzzer-sound.cxx
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "buzzer.h"
-
-
-int
-main(int argc, char **argv) {
- //! [Interesting]
- int chord[] = { DO, RE, MI, FA, SOL, LA, SI, DO, SI };
-
- // create Buzzer instance
- upm::Buzzer* sound = new upm::Buzzer(5);
- // print sensor name
- std::cout << sound->name() << std::endl;
-
- // play sound (DO, RE, MI, etc...), pausing for 0.1 seconds between notes
- for (int chord_ind = 0; chord_ind < 7; chord_ind++) {
- // play each note for one second
- std::cout << sound->playSound(chord[chord_ind], 1000000) << std::endl;
- usleep(100000);
- }
- //! [Interesting]
-
- std::cout << "exiting application" << std::endl;
-
- delete sound;
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/cjq4435.cxx b/peripheral/libupm/examples/c++/cjq4435.cxx
deleted file mode 100644
index f9d84d4..0000000
--- a/peripheral/libupm/examples/c++/cjq4435.cxx
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "cjq4435.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-
-int main ()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // Instantiate a CJQ4435 MOSFET on a PWM capable digital pin D3
- upm::CJQ4435* mosfet = new upm::CJQ4435(3);
-
- mosfet->setPeriodMS(10);
- mosfet->enable(true);
-
- while (shouldRun)
- {
- // start with a duty cycle of 0.0 (off) and increment to 1.0 (on)
- for (float i=0.0; i <= 1.0; i+=0.1)
- {
- mosfet->setDutyCycle(i);
- usleep(100000);
- }
- sleep(1);
- // Now take it back down
- // start with a duty cycle of 1.0 (on) and decrement to 0.0 (off)
- for (float i=1.0; i >= 0.0; i-=0.1)
- {
- mosfet->setDutyCycle(i);
- usleep(100000);
- }
- sleep(1);
- }
-
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete mosfet;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/dfrph.cxx b/peripheral/libupm/examples/c++/dfrph.cxx
deleted file mode 100644
index 601fdbf..0000000
--- a/peripheral/libupm/examples/c++/dfrph.cxx
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "dfrph.h"
-
-using namespace std;
-
-bool shouldRun = true;
-
-#define DFRPH_AREF 5.0
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
-
- // Instantiate a DFRPH sensor on analog pin A0, with an analog
- // reference voltage of DFRPH_AREF
- upm::DFRPH *sensor = new upm::DFRPH(0, DFRPH_AREF);
-
-
- // After calibration, set the offset (based on calibration with a pH
- // 7.0 buffer solution). See the UPM sensor documentation for
- // calibrations instructions.
- sensor->setOffset(0.065);
-
- // Every second, sample the pH and output it's corresponding
- // analog voltage.
-
- while (shouldRun)
- {
- cout << "Detected volts: " << sensor->volts() << endl;
- cout << "pH value: " << sensor->pH() << endl;
- cout << endl;
-
- sleep(1);
- }
-
-//! [Interesting]
-
- cout << "Exiting" << endl;
-
- delete sensor;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/ds1307.cxx b/peripheral/libupm/examples/c++/ds1307.cxx
deleted file mode 100644
index 44a0b08..0000000
--- a/peripheral/libupm/examples/c++/ds1307.cxx
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "ds1307.h"
-
-using namespace std;
-
-void printTime(upm::DS1307 *rtc)
-{
- cout << "The time is: " <<
- rtc->month << "/" << rtc->dayOfMonth << "/" << rtc->year << " "
- << rtc->hours << ":" << rtc->minutes << ":" << rtc->seconds;
-
- if (rtc->amPmMode)
- cout << (rtc->pm) ? " PM " : " AM ";
-
- cout << endl;
-
- cout << "Clock is in " << ((rtc->amPmMode) ? "AM/PM mode" : "24hr mode")
- << endl;
-}
-
-int
-main(int argc, char **argv)
-{
-//! [Interesting]
- // Instantiate a DS1037 on I2C bus 0
- upm::DS1307 *rtc = new upm::DS1307(0);
-
- // always do this first
- cout << "Loading the current time... " << endl;
- if (!rtc->loadTime())
- {
- cerr << "rtc->loadTime() failed." << endl;
- return 0;
- }
-
- printTime(rtc);
-
- // set the year as an example
- cout << "setting the year to 50" << endl;
- rtc->year = 50;
-
- rtc->setTime();
-
- // reload the time and print it
- rtc->loadTime();
- printTime(rtc);
-
- //! [Interesting]
-
- delete rtc;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/eboled.cxx b/peripheral/libupm/examples/c++/eboled.cxx
deleted file mode 100644
index c1c281c..0000000
--- a/peripheral/libupm/examples/c++/eboled.cxx
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include "eboled.h"
-
-using namespace std;
-
-int main(int argc, char **argv)
-{
-//! [Interesting]
- // Instantiate an Edison Block OLED using default values
- upm::EBOLED *lcd = new upm::EBOLED();
-
- lcd->clear();
- lcd->setCursor(10, 15);
- lcd->write("Hello");
- lcd->setCursor(30, 15);
- lcd->write("World!");
- lcd->refresh();
-
- cout << "Sleeping for 5 seconds..." << endl;
- sleep(5);
-
- delete lcd;
-//! [Interesting]
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/ecs1030.cxx b/peripheral/libupm/examples/c++/ecs1030.cxx
deleted file mode 100644
index 40a7dc5..0000000
--- a/peripheral/libupm/examples/c++/ecs1030.cxx
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include <stdlib.h>
-#include "ecs1030.h"
-
-int is_running = 0;
-upm::ECS1030 *sensor = NULL;
-
-void
-sig_handler(int signo)
-{
- printf("got signal\n");
- if (signo == SIGINT) {
- is_running = 1;
- }
-}
-
-//! [Interesting]
-int
-main(int argc, char **argv)
-{
- sensor = new upm::ECS1030(0);
- signal(SIGINT, sig_handler);
-
- while (!is_running) {
- std::cout << "I = " << sensor->getCurrency_A () << ", Power = " << sensor->getPower_A () << std::endl;
- std::cout << "I = " << sensor->getCurrency_B () << ", Power = " << sensor->getPower_B () << std::endl;
- }
-
- std::cout << "exiting application" << std::endl;
-
- delete sensor;
-
- return 0;
-}
-//! [Interesting]
diff --git a/peripheral/libupm/examples/c++/enc03r.cxx b/peripheral/libupm/examples/c++/enc03r.cxx
deleted file mode 100644
index da0db9b..0000000
--- a/peripheral/libupm/examples/c++/enc03r.cxx
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "enc03r.h"
-
-using namespace std;
-
-bool shouldRun = true;
-
-// analog voltage, usually 3.3 or 5.0
-#define CALIBRATION_SAMPLES 1000
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
-
- // Instantiate a ENC03R on analog pin A0
- upm::ENC03R *gyro = new upm::ENC03R(0);
-
- // The first thing we need to do is calibrate the sensor.
- cout << "Please place the sensor in a stable location, and do not" << endl;
- cout << "move it while calibration takes place." << endl;
- cout << "This may take a couple of minutes." << endl;
-
- gyro->calibrate(CALIBRATION_SAMPLES);
- cout << "Calibration complete. Reference value: "
- << gyro->calibrationValue() << endl;
-
- // Read the input and print both the raw value and the angular velocity,
- // waiting 0.1 seconds between readings
- while (shouldRun)
- {
- unsigned int val = gyro->value();
- double av = gyro->angularVelocity(val);
-
- cout << "Raw value: " << val << ", "
- << "angular velocity: " << av << " deg/s" << endl;
-
- usleep(100000);
- }
-//! [Interesting]
-
- cout << "Exiting" << endl;
-
- delete gyro;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/es08a.cxx b/peripheral/libupm/examples/c++/es08a.cxx
deleted file mode 100644
index 3f7e5c4..0000000
--- a/peripheral/libupm/examples/c++/es08a.cxx
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "es08a.h"
-#include <signal.h>
-#include <stdlib.h>
-
-int
-main(int argc, char **argv)
-{
- //! [Interesting]
- upm::ES08A *servo = new upm::ES08A(5);
-
- // Sets the shaft to 180, then to 90, then to 0,
- // then back to 90, and finally back to 180,
- // pausing for a second in between each angle
- servo->setAngle (180);
- std::cout << "Set angle to 180" << std::endl;
- sleep(1);
- servo->setAngle (90);
- std::cout << "Set angle to 90" << std::endl;
- sleep(1);
- servo->setAngle (0);
- std::cout << "Set angle to 0" << std::endl;
- sleep(1);
- servo->setAngle (90);
- std::cout << "Set angle to 90" << std::endl;
- sleep(1);
- servo->setAngle (180);
- std::cout << "Set angle to 180" << std::endl;
- //! [Interesting]
-
- std::cout << "exiting application" << std::endl;
-
- delete servo;
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/flex.cxx b/peripheral/libupm/examples/c++/flex.cxx
deleted file mode 100644
index 5477338..0000000
--- a/peripheral/libupm/examples/c++/flex.cxx
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Author: Zion Orent <zorent@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "flex.h"
-
-using namespace std;
-
-bool shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // The was tested with a Spectra Symbol flex sensor.
- // We attached a 22K resistor to a breadboard,
- // with 1 end attached to GND and the other connected to
- // both the flex sensor and A0.
- // The flex sensor was connected on 1 pin to the 22K resistor and A0
- // and on the other pin to 5V.
-
- // Instantiate a Flex sensor on analog pin A0
- upm::Flex *flex = new upm::Flex(0);
-
- while (shouldRun)
- {
- cout << "Flex value: " << flex->value() << endl;
- sleep(1);
- }
-//! [Interesting]
-
- cout << "Exiting" << endl;
-
- delete flex;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/gp2y0a.cxx b/peripheral/libupm/examples/c++/gp2y0a.cxx
deleted file mode 100644
index 0111b17..0000000
--- a/peripheral/libupm/examples/c++/gp2y0a.cxx
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "gp2y0a.h"
-
-using namespace std;
-
-bool shouldRun = true;
-
-// analog voltage, usually 3.3 or 5.0
-#define GP2Y0A_AREF 5.0
-#define SAMPLES_PER_QUERY 20
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // Note, for the Grove 80cm version of this sensor, due to the way
- // it is wired, you need to plug this into the A0 port, where it
- // will use the available A1 pin for data.
-
- // Instantiate a GP2Y0A on analog pin A1
- upm::GP2Y0A *volts = new upm::GP2Y0A(1);
-
- // The higher the voltage (closer to AREF) the closer the object is. NOTE:
- // the measured voltage will probably not exceed 3.3 volts.
- // Every second, print the averaged voltage value (averaged over 20 samples).
- while (shouldRun)
- {
- cout << "AREF: " << GP2Y0A_AREF
- << ", Voltage value (higher means closer): "
- << volts->value(GP2Y0A_AREF, SAMPLES_PER_QUERY) << endl;
-
- sleep(1);
- }
-//! [Interesting]
-
- cout << "Exiting" << endl;
-
- delete volts;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/grovebutton.cxx b/peripheral/libupm/examples/c++/grovebutton.cxx
deleted file mode 100644
index 7d2d69a..0000000
--- a/peripheral/libupm/examples/c++/grovebutton.cxx
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Author: Sarah Knepper <sarah.knepper@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "grove.h"
-
-int
-main(int argc, char **argv)
-{
- // This example uses GPIO 0
-//! [Interesting]
-
- // Create the button object using GPIO pin 0
- upm::GroveButton* button = new upm::GroveButton(0);
-
- // Read the input and print, waiting one second between readings
- while( 1 ) {
- std::cout << button->name() << " value is " << button->value() << std::endl;
- sleep(1);
- }
-
- // Delete the button object
- delete button;
-//! [Interesting]
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/grovecircularled.cxx b/peripheral/libupm/examples/c++/grovecircularled.cxx
deleted file mode 100644
index 066e017..0000000
--- a/peripheral/libupm/examples/c++/grovecircularled.cxx
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "grovecircularled.h"
-
-using namespace std;
-
-bool shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
-
- // Instantiate a Grove Circular LED on D9 for data, D8 for clock
-
- upm::GroveCircularLED *circle = new upm::GroveCircularLED(9, 8);
-
- int level = 0;
- while (shouldRun)
- {
- circle->setSpinner(level);
- level = (level + 1) % 24;
- usleep(100000);
- }
-
-//! [Interesting]
-
- cout << "Exiting" << endl;
-
- delete circle;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/grovecollision.cxx b/peripheral/libupm/examples/c++/grovecollision.cxx
deleted file mode 100644
index 2de7609..0000000
--- a/peripheral/libupm/examples/c++/grovecollision.cxx
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-#include <iostream>
-#include <unistd.h>
-#include <signal.h>
-#include "grovecollision.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main(int argc, char **argv)
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // The was tested with the Grove Collision Sensor
- // Instantiate a Grove Collision on digital pin D2
- upm::GroveCollision* collision = new upm::GroveCollision(2);
-
- bool collisionState = false;
- cout << "No collision" << endl;
- while (shouldRun)
- {
- if (collision->isColliding() && !collisionState)
- {
- cout << "Collision!" << endl;
- collisionState = true;
- }
- else if (collisionState)
- {
- cout << "No collision" << endl;
- collisionState = false;
- }
- }
-
-//! [Interesting]
- cout << "Exiting" << endl;
-
- delete collision;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/groveehr.cxx b/peripheral/libupm/examples/c++/groveehr.cxx
deleted file mode 100644
index b056a15..0000000
--- a/peripheral/libupm/examples/c++/groveehr.cxx
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "groveehr.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-
-int main()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // Instantiate a Grove Ear-clip Heart Rate sensor on digital pin D2
- upm::GroveEHR* heart = new upm::GroveEHR(2);
-
- // set the beat counter to 0, init the clock and start counting beats
- heart->clearBeatCounter();
- heart->initClock();
- heart->startBeatCounter();
-
- while (shouldRun)
- {
- // we grab these just for display purposes in this example
- uint32_t millis = heart->getMillis();
- uint32_t beats = heart->beatCounter();
-
- // heartRate() requires that at least 5 seconds pass before
- // returning anything other than 0
- int hr = heart->heartRate();
-
- // output milliseconds passed, beat count, and computed heart rate
- cout << "Millis: " << millis << " Beats: " << beats;
- cout << " Heart Rate: " << hr << endl;
-
- sleep(1);
- }
-
- heart->stopBeatCounter();
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete heart;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/groveeldriver.cxx b/peripheral/libupm/examples/c++/groveeldriver.cxx
deleted file mode 100644
index 126eaaf..0000000
--- a/peripheral/libupm/examples/c++/groveeldriver.cxx
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-#include <iostream>
-#include <unistd.h>
-#include <signal.h>
-#include "groveeldriver.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main(int argc, char **argv)
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // The was tested with the Grove El Driver Module
- // Instantiate a Grove El Driver on digital pin D2
- upm::GroveElDriver* eldriver = new upm::GroveElDriver(2);
-
- bool lightState = true;
-
- while (shouldRun)
- {
- if (lightState)
- eldriver->on();
- else
- eldriver->off();
- lightState = !lightState;
- sleep(1);
- }
-
-//! [Interesting]
- eldriver->off();
- cout << "Exiting" << endl;
-
- delete eldriver;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/groveelectromagnet.cxx b/peripheral/libupm/examples/c++/groveelectromagnet.cxx
deleted file mode 100644
index 386f4de..0000000
--- a/peripheral/libupm/examples/c++/groveelectromagnet.cxx
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-#include <iostream>
-#include <time.h>
-#include <signal.h>
-#include "groveelectromagnet.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-float get_time()
-{
- return ((float)(clock()))/CLOCKS_PER_SEC;
-}
-
-int main(int argc, char **argv)
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // The was tested with the Grove Electromagnetic Module
- // Instantiate a Grove Electromagnet on digital pin D2
- upm::GroveElectromagnet* magnet = new upm::GroveElectromagnet(2);
- cout << "Starting up magnet...." << endl;
- magnet->off();
-
- bool magnetState = false;
- float time_passed = get_time();
-
- // Turn magnet on and off every 5 seconds
- while (shouldRun)
- {
- if ((get_time() - time_passed) > 5.0)
- {
- magnetState = !magnetState;
- if (magnetState)
- magnet->on();
- else
- magnet->off();
- cout << "Turning magnet " << ((magnetState) ? "on" : "off") << endl;
- time_passed = get_time();
- }
- }
-
-//! [Interesting]
- magnet->off();
- cout << "Exiting" << endl;
-
- delete magnet;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/groveemg.cxx b/peripheral/libupm/examples/c++/groveemg.cxx
deleted file mode 100644
index d06295a..0000000
--- a/peripheral/libupm/examples/c++/groveemg.cxx
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "groveemg.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main(int argc, char **argv)
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // The was tested with the GroveEMG Muscle Signal Reader Sensor Module
- // Instantiate a GroveEMG on analog pin A0
- upm::GroveEMG *emg = new upm::GroveEMG(0);
- cout << "Calibrating...." << endl;
- emg->calibrate();
-
- while (shouldRun)
- {
- cout << emg->value() << endl;
- usleep(100000);
- }
-
-//! [Interesting]
- cout << "Exiting" << endl;
- delete emg;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/grovegprs.cxx b/peripheral/libupm/examples/c++/grovegprs.cxx
deleted file mode 100644
index bc0e3d9..0000000
--- a/peripheral/libupm/examples/c++/grovegprs.cxx
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include <stdio.h>
-#include "grovegprs.h"
-
-using namespace std;
-using namespace upm;
-
-void printUsage(char *progname)
-{
- cout << "Usage: " << progname << " [AT command]" << endl;
- cout << endl;
-
- cout << "If an argument is supplied on the command line, that argument is"
- << endl;
- cout << "sent to the module and the response is printed out." << endl;
- cout << endl;
- cout << "If no argument is used, then the manufacturer and the current"
- << endl;
- cout << "saved profiles are queried and the results printed out." << endl;
- cout << endl;
- cout << endl;
-}
-
-// simple helper function to send a command and wait for a response
-void sendCommand(upm::GroveGPRS* sensor, string cmd)
-{
- // commands need to be terminated with a carriage return
- cmd += "\r";
-
- sensor->writeDataStr(cmd);
-
- // wait up to 1 second
- if (sensor->dataAvailable(1000))
- {
- cout << "Returned: " << sensor->readDataStr(1024) << endl;
- }
- else
- {
- cerr << "Timed out waiting for response" << endl;
- }
-}
-
-
-int main(int argc, char **argv)
-{
-//! [Interesting]
-
- // Instantiate a GroveGPRS Module on UART 0
- upm::GroveGPRS* sensor = new upm::GroveGPRS(0);
-
- // Set the baud rate, 19200 baud is the default.
- if (sensor->setBaudRate(19200) != mraa::SUCCESS)
- {
- cerr << "Failed to set tty baud rate" << endl;
- return 1;
- }
-
- printUsage(argv[0]);
-
- if (argc > 1)
- {
- cout << "Sending command line argument (" << argv[1] << ")..." << endl;
- sendCommand(sensor, argv[1]);
- }
- else
- {
- // query the module manufacturer
- cout << "Querying module manufacturer (AT+CGMI)..." << endl;
- sendCommand(sensor, "AT+CGMI");
-
- sleep(1);
-
- // query the saved profiles
- cout << "Querying the saved profiles (AT&V)..." << endl;
- sendCommand(sensor, "AT&V");
-
- // A comprehensive list is available from the datasheet at:
- // http://www.seeedstudio.com/wiki/images/7/72/AT_Commands_v1.11.pdf
- }
-
-//! [Interesting]
-
- delete sensor;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/grovegsr.cxx b/peripheral/libupm/examples/c++/grovegsr.cxx
deleted file mode 100644
index 549e775..0000000
--- a/peripheral/libupm/examples/c++/grovegsr.cxx
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Author: Zion Orent <zorent@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "grovegsr.h"
-
-using namespace std;
-
-bool shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // The was tested with the GroveGSR Galvanic Skin Response Sensor module.
-
- // Instantiate a GroveGSR on analog pin A0
- upm::GroveGSR *gsr = new upm::GroveGSR(0);
- cout << "Calibrating...." << endl;
- gsr->calibrate();
-
- while (shouldRun)
- {
- cout << gsr->value() << endl;
- usleep(500000);
- }
-//! [Interesting]
-
- cout << "Exiting" << endl;
-
- delete gsr;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/groveled-multi.cxx b/peripheral/libupm/examples/c++/groveled-multi.cxx
deleted file mode 100644
index 16a6eba..0000000
--- a/peripheral/libupm/examples/c++/groveled-multi.cxx
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014-2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "grove.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-
-int main()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
-
- // Instantiate a grove LED on D2. Here we are controlling a Grove
- // Multi-color flash LED. We just just need to turn it on - it will
- // then cycle through various colors (red, green, blue, purple) on it's
- // own until turned off.
- upm::GroveLed* led = new upm::GroveLed(2);
-
- // start the light show
- led->on();
-
- // just sleep until interrupted
- while (shouldRun)
- sleep(1);
-
-//! [Interesting]
-
- led->off();
- cout << "Exiting..." << endl;
-
- delete led;
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/groveled.cxx b/peripheral/libupm/examples/c++/groveled.cxx
deleted file mode 100644
index 52d5e84..0000000
--- a/peripheral/libupm/examples/c++/groveled.cxx
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Author: Brendan Le Foll <brendan.le.foll@intel.com>
- * Contributions: Sarah Knepper <sarah.knepper@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "grove.h"
-
-int
-main(int argc, char **argv)
-{
-//! [Interesting]
-
- // Create the Grove LED object using GPIO pin 2
- upm::GroveLed* led = new upm::GroveLed(2);
-
- // Print the name
- std::cout << led->name() << std::endl;
-
- // Turn the LED on and off 10 times, pausing one second
- // between transitions
- for (int i=0; i < 10; i++) {
- led->on();
- sleep(1);
- led->off();
- sleep(1);
- }
-
- // Delete the Grove LED object
- delete led;
-//! [Interesting]
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/groveledbar.cxx b/peripheral/libupm/examples/c++/groveledbar.cxx
deleted file mode 100644
index d86110c..0000000
--- a/peripheral/libupm/examples/c++/groveledbar.cxx
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "groveledbar.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-
-int main ()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
-
- // Instantiate a GroveLEDBar, we use D8 for the data, and D9 for the
- // clock. This was tested with a Grove LED bar.
- upm::GroveLEDBar* bar = new upm::GroveLEDBar(8, 9);
-
- while (shouldRun)
- {
- // count up from green to red
- for (int i=0; i<=10; i++)
- {
- bar->setBarLevel(i, true);
- usleep(100000);
- }
- sleep(1);
-
- // count down from red to green
- for (int i=0; i<=10; i++)
- {
- bar->setBarLevel(i, false);
- usleep(100000);
- }
- sleep(1);
- }
-//! [Interesting]
-
- cout << "Exiting..." << endl;
- // turn off the LED's
- bar->setBarLevel(0);
-
- delete bar;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/grovelight.cxx b/peripheral/libupm/examples/c++/grovelight.cxx
deleted file mode 100644
index 64760c9..0000000
--- a/peripheral/libupm/examples/c++/grovelight.cxx
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Author: Brendan Le Foll <brendan.le.foll@intel.com>
- * Contributions: Sarah Knepper <sarah.knepper@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "grove.h"
-
-int
-main(int argc, char **argv)
-{
-//! [Interesting]
- // Create the light sensor object using AIO pin 0
- upm::GroveLight* light = new upm::GroveLight(0);
-
- // Read the input and print both the raw value and a rough lux value,
- // waiting one second between readings
- while( 1 ) {
- std::cout << light->name() << " raw value is " << light->raw_value() <<
- ", which is roughly " << light->value() << " lux" << std::endl;
- sleep(1);
- }
-
- // Delete the light sensor object
- delete light;
-//! [Interesting]
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/grovelinefinder.cxx b/peripheral/libupm/examples/c++/grovelinefinder.cxx
deleted file mode 100644
index a8290c5..0000000
--- a/peripheral/libupm/examples/c++/grovelinefinder.cxx
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "grovelinefinder.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-
-int main ()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // Instantiate a Grove Line Finder sensor on digital pin D2
- upm::GroveLineFinder* finder = new upm::GroveLineFinder(2);
-
- // check every second for the presence of white detection
- while (shouldRun)
- {
- bool val = finder->whiteDetected();
- if (val)
- cout << "White detected." << endl;
- else
- cout << "Black detected." << endl;
-
- sleep(1);
- }
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete finder;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/grovemd-stepper.cxx b/peripheral/libupm/examples/c++/grovemd-stepper.cxx
deleted file mode 100644
index f65c5e4..0000000
--- a/peripheral/libupm/examples/c++/grovemd-stepper.cxx
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <signal.h>
-#include <iostream>
-#include "grovemd.h"
-
-using namespace std;
-
-int main(int argc, char **argv)
-{
- //! [Interesting]
- // Instantiate an I2C Grove Motor Driver on I2C bus 0
-
- upm::GroveMD *motors = new upm::GroveMD(GROVEMD_I2C_BUS,
- GROVEMD_DEFAULT_I2C_ADDR);
-
- // This example demonstrates using the GroveMD to drive a stepper motor
-
- // configure it, for this example, we'll assume 200 steps per rev
- motors->configStepper(200);
-
- // set for half a rotation
- motors->setStepperSteps(100);
-
- // let it go - clockwise rotation, 10 RPM speed
- motors->enableStepper(upm::GroveMD::STEP_DIR_CW, 10);
-
- sleep(3);
-
- // Now do it backwards...
- motors->setStepperSteps(100);
- motors->enableStepper(upm::GroveMD::STEP_DIR_CCW, 10);
-
- // now disable
- motors->disableStepper();
-
- //! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete motors;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/grovemd.cxx b/peripheral/libupm/examples/c++/grovemd.cxx
deleted file mode 100644
index a5c1015..0000000
--- a/peripheral/libupm/examples/c++/grovemd.cxx
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <signal.h>
-#include <iostream>
-#include "grovemd.h"
-
-using namespace std;
-
-int main(int argc, char **argv)
-{
- //! [Interesting]
- // Instantiate an I2C Grove Motor Driver on I2C bus 0
-
- upm::GroveMD *motors = new upm::GroveMD(GROVEMD_I2C_BUS,
- GROVEMD_DEFAULT_I2C_ADDR);
-
- // set direction to CW and set speed to 50%
- cout << "Spin M1 and M2 at half speed for 3 seconds" << endl;
- motors->setMotorDirections(upm::GroveMD::DIR_CW, upm::GroveMD::DIR_CW);
- motors->setMotorSpeeds(127, 127);
-
- sleep(3);
- // counter clockwise
- cout << "Reversing M1 and M2 for 3 seconds" << endl;
- motors->setMotorDirections(upm::GroveMD::DIR_CCW, upm::GroveMD::DIR_CCW);
- sleep(3);
-
- //! [Interesting]
-
- cout << "Stopping motors" << endl;
- motors->setMotorSpeeds(0, 0);
-
- cout << "Exiting..." << endl;
-
- delete motors;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/grovemoisture.cxx b/peripheral/libupm/examples/c++/grovemoisture.cxx
deleted file mode 100644
index 1fee54c..0000000
--- a/peripheral/libupm/examples/c++/grovemoisture.cxx
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "grovemoisture.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-
-int main ()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // Instantiate a Grove Moisture sensor on analog pin A0
- upm::GroveMoisture* moisture = new upm::GroveMoisture(0);
-
- // Values (approximate):
- // 0-300, sensor in air or dry soil
- // 300-600, sensor in humid soil
- // 600+, sensor in wet soil or submerged in water.
- // Read the value every second and print the corresponding moisture level
- while (shouldRun)
- {
- int val = moisture->value();
- cout << "Moisture value: " << val << ", ";
- if (val >= 0 && val < 300)
- cout << "dry";
- else if (val >= 300 && val < 600)
- cout << "moist";
- else
- cout << "wet";
-
- cout << endl;
-
- sleep(1);
- }
-//! [Interesting]
-
- cout << "Exiting" << endl;
-
- delete moisture;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/groveo2.cxx b/peripheral/libupm/examples/c++/groveo2.cxx
deleted file mode 100644
index cc1b240..0000000
--- a/peripheral/libupm/examples/c++/groveo2.cxx
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "groveo2.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main(int argc, char **argv)
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // The was tested with the O2 Oxygen Concentration Sensor Module
- // Instantiate a GroveO2 on analog pin A0
- upm::GroveO2 *O2 = new upm::GroveO2(0);
- while (shouldRun)
- {
- cout << "The output voltage is: " << O2->voltageValue() << "mV" << endl;
- usleep(100000);
- }
-
-//! [Interesting]
- cout << "Exiting" << endl;
- delete O2;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/groverelay.cxx b/peripheral/libupm/examples/c++/groverelay.cxx
deleted file mode 100644
index 4366dd6..0000000
--- a/peripheral/libupm/examples/c++/groverelay.cxx
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Author: Sarah Knepper <sarah.knepper@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "grove.h"
-
-int
-main(int argc, char **argv)
-{
- // This example uses GPIO 0
-//! [Interesting]
-
- // Create the relay switch object using GPIO pin 0
- upm::GroveRelay* relay = new upm::GroveRelay(0);
-
- // Close and then open the relay switch 3 times,
- // waiting one second each time. The LED on the relay switch
- // will light up when the switch is on (closed).
- // The switch will also make a noise between transitions.
- for ( int i = 0; i < 3; i++ ) {
- relay->on();
- if ( relay->isOn() )
- std::cout << relay->name() << " is on" << std::endl;
- sleep(1);
- relay->off();
- if ( relay->isOff() )
- std::cout << relay->name() << " is off" << std::endl;
- sleep(1);
- }
-
- // Delete the relay switch object
- delete relay;
-//! [Interesting]
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/groverotary.cxx b/peripheral/libupm/examples/c++/groverotary.cxx
deleted file mode 100644
index 4139242..0000000
--- a/peripheral/libupm/examples/c++/groverotary.cxx
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Author: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <iomanip>
-#include "grove.h"
-
-using namespace std;
-
-int main ()
-{
-//! [Interesting]
- // Instantiate a rotary sensor on analog pin A0
- upm::GroveRotary* knob = new upm::GroveRotary(0);
-
- // Print sensor name to confirm it initialized properly
- cout << knob->name() << endl;
-
- while(true) {
- float abs_value = knob->abs_value(); // Absolute raw value
- float abs_deg = knob->abs_deg(); // Absolute degrees
- float abs_rad = knob->abs_rad(); // Absolute radians
- float rel_value = knob->rel_value(); // Relative raw value
- float rel_deg = knob->rel_deg(); // Relative degrees
- float rel_rad = knob->rel_rad(); // Relative radians
-
- fprintf(stdout, "Absolute: %4d raw %5.2f deg = %3.2f rad Relative: %4d raw %5.2f deg %3.2f rad\n",
- (int16_t)abs_value, abs_deg, abs_rad, (int16_t)rel_value, rel_deg, rel_rad);
-
- usleep(2500000); // Sleep for 2.5s
- }
-//! [Interesting]
- delete knob;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/grovescam.cxx b/peripheral/libupm/examples/c++/grovescam.cxx
deleted file mode 100644
index 6edd85d..0000000
--- a/peripheral/libupm/examples/c++/grovescam.cxx
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include <stdio.h>
-#include "grovescam.h"
-
-using namespace std;
-using namespace upm;
-
-int main (int argc, char **argv)
-{
-//! [Interesting]
-
- // Instantiate a Grove Serial Camera on UART 0
- upm::GROVESCAM* camera = new upm::GROVESCAM(0);
-
- // make sure port is initialized properly. 115200 baud is the default.
- if (!camera->setupTty())
- {
- cerr << "Failed to setup tty port parameters" << endl;
- return 1;
- }
-
- if (camera->init())
- cout << "Initialized..." << endl;
- else
- cout << "init() failed" << endl;
-
- if (camera->preCapture())
- cout << "preCapture succeeded..." << endl;
- else
- cout << "preCapture failed." << endl;
-
- if (camera->doCapture())
- cout << "doCapture succeeded..." << endl;
- else
- cout << "doCapture failed." << endl;
-
- cout << "Image size is " << camera->getImageSize() << " bytes" << endl;
-
- if (camera->getImageSize() > 0)
- {
- cout << "Storing image.jpg..." << endl;
- if (camera->storeImage("image.jpg"))
- cout << "storeImage succeeded..." << endl;
- else
- cout << "storeImage failed." << endl;
- }
-//! [Interesting]
-
- delete camera;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/groveslide.cxx b/peripheral/libupm/examples/c++/groveslide.cxx
deleted file mode 100644
index 42e975a..0000000
--- a/peripheral/libupm/examples/c++/groveslide.cxx
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Author: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-#include <unistd.h>
-#include <iostream>
-#include <iomanip>
-#include "grove.h"
-
-using namespace std;
-
-int main ()
-{
-//! [Interesting]
- upm::GroveSlide* slide = new upm::GroveSlide(0); // Instantiate new grove slide potentiometer on analog pin A0
-
- cout << slide->name() << endl;
-
- while(true) {
- float adc_value = slide->raw_value(); // Read raw value
- float volts = slide->voltage_value(); // Read voltage, board reference set at 5.0V
- fprintf(stdout, "%4d = %.2f V\n", (uint16_t)adc_value, volts);
-
- usleep(2500000); // Sleep for 2.5s
- }
-//! [Interesting]
- delete slide;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/grovespeaker.cxx b/peripheral/libupm/examples/c++/grovespeaker.cxx
deleted file mode 100644
index 97d6518..0000000
--- a/peripheral/libupm/examples/c++/grovespeaker.cxx
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "grovespeaker.h"
-
-using namespace std;
-
-int main ()
-{
-//! [Interesting]
- // Instantiate a Grove Speaker on digital pin D2
- upm::GroveSpeaker* speaker = new upm::GroveSpeaker(2);
-
- // Play all 7 of the lowest notes
- speaker->playAll();
-
- // Play a medium C-sharp
- speaker->playSound('c', true, "med");
-//! [Interesting]
-
- cout << "Exiting" << endl;
-
- delete speaker;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/grovetemp.cxx b/peripheral/libupm/examples/c++/grovetemp.cxx
deleted file mode 100644
index 73de9c7..0000000
--- a/peripheral/libupm/examples/c++/grovetemp.cxx
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Author: Brendan Le Foll <brendan.le.foll@intel.com>
- * Contributions: Sarah Knepper <sarah.knepper@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <iomanip>
-#include "grove.h"
-
-int
-main(int argc, char **argv)
-{
-//! [Interesting]
-
- // Create the temperature sensor object using AIO pin 0
- upm::GroveTemp* temp = new upm::GroveTemp(0);
- std::cout << temp->name() << std::endl;
-
- // Read the temperature ten times, printing both the Celsius and
- // equivalent Fahrenheit temperature, waiting one second between readings
- for (int i=0; i < 10; i++) {
- int celsius = temp->value();
- int fahrenheit = (int) (celsius * 9.0/5.0 + 32.0);
- printf("%d degrees Celsius, or %d degrees Fahrenheit\n",
- celsius, fahrenheit);
- sleep(1);
- }
-
- // Delete the temperature sensor object
- delete temp;
-//! [Interesting]
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/groveultrasonic.cxx b/peripheral/libupm/examples/c++/groveultrasonic.cxx
deleted file mode 100644
index e054c4c..0000000
--- a/peripheral/libupm/examples/c++/groveultrasonic.cxx
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Author: Jun Kato <i@junkato.jp>
- * Copyright (c) 2015 Jun Kato.
- *
- * Thanks to Seeed Studio for a working arduino sketch
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "groveultrasonic.h"
-#include <signal.h>
-#include <stdlib.h>
-#include <sys/time.h>
-
-upm::GroveUltraSonic *sonar = NULL;
-bool running = true;
-
-void
-sig_handler(int signo)
-{
- if (signo == SIGINT) {
- running = false;
- }
-}
-
-int
-main(int argc, char **argv)
-{
- signal(SIGINT, sig_handler);
-//! [Interesting]
- // upm::GroveUltraSonic *sonar = NULL;
- sonar = new upm::GroveUltraSonic(2);
- while(running) {
- int width = sonar->getDistance();
- printf("Echo width = %d\n", width);
- printf("Distance inches = %f.2\n\n", width/148.0);
- sleep(3);
- }
-//! [Interesting]
- printf("exiting application\n");
- delete sonar;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/grovevdiv.cxx b/peripheral/libupm/examples/c++/grovevdiv.cxx
deleted file mode 100644
index 40be66c..0000000
--- a/peripheral/libupm/examples/c++/grovevdiv.cxx
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "grovevdiv.h"
-
-using namespace std;
-
-bool shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-
-int main ()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // Instantiate a Grove Voltage Divider sensor on analog pin A0
- upm::GroveVDiv* vDiv = new upm::GroveVDiv(0);
-
- // collect data and output measured voltage according to the setting
- // of the scaling switch (3 or 10)
- while (shouldRun)
- {
- unsigned int val = vDiv->value(100);
- float gain3val = vDiv->computedValue(3, val);
- float gain10val = vDiv->computedValue(10, val);
- cout << "ADC value: " << val << " Gain 3: " << gain3val
- << "v Gain 10: " << gain10val << "v" << endl;
-
- sleep(1);
- }
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete vDiv;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/grovewater.cxx b/peripheral/libupm/examples/c++/grovewater.cxx
deleted file mode 100644
index 51bfacb..0000000
--- a/peripheral/libupm/examples/c++/grovewater.cxx
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "grovewater.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-
-int main ()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // Instantiate a Grove Water sensor on digital pin D2
- upm::GroveWater* water = new upm::GroveWater(2);
-
- while (shouldRun)
- {
- bool val = water->isWet();
- if (val)
- cout << "Sensor is wet." << endl;
- else
- cout << "Sensor is dry." << endl;
-
- sleep(1);
- }
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete water;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/grovewfs.cxx b/peripheral/libupm/examples/c++/grovewfs.cxx
deleted file mode 100644
index ea819ae..0000000
--- a/peripheral/libupm/examples/c++/grovewfs.cxx
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "grovewfs.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-
-int main()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // Instantiate a Grove Water Flow Sensor on digital pin D2
- upm::GroveWFS* flow = new upm::GroveWFS(2);
-
- // set the flow counter to 0 and start counting
- flow->clearFlowCounter();
- flow->startFlowCounter();
-
- while (shouldRun)
- {
- // we grab these (,illis and flowCount) just for display
- // purposes in this example
- uint32_t millis = flow->getMillis();
- uint32_t flowCount = flow->flowCounter();
-
- float fr = flow->flowRate();
-
- // output milliseconds passed, flow count, and computed flow rate
- cout << "Millis: " << millis << " Flow Count: " << flowCount;
- cout << " Flow Rate: " << fr << " LPM" << endl;
-
- // best to gather data for at least one second for reasonable
- // results.
- sleep(2);
- }
-
- flow->stopFlowCounter();
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete flow;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/guvas12d.cxx b/peripheral/libupm/examples/c++/guvas12d.cxx
deleted file mode 100644
index 3351741..0000000
--- a/peripheral/libupm/examples/c++/guvas12d.cxx
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "guvas12d.h"
-
-using namespace std;
-
-bool shouldRun = true;
-
-// analog voltage, usually 3.3 or 5.0
-#define GUVAS12D_AREF 5.0
-#define SAMPLES_PER_QUERY 1024
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // The was tested with the Grove UV Sensor module.
- // It has a sensing range from between 200-400nm. It's strongest
- // response is around 320-360nm.
-
- // Instantiate a GUVAS12D on analog pin A0
- upm::GUVAS12D *volts = new upm::GUVAS12D(0);
-
- // The higher the voltage the more intense the UV radiation.
-
- while (shouldRun)
- {
- cout << "AREF: " << GUVAS12D_AREF
- << ", Voltage value (higher means more UV): "
- << volts->value(GUVAS12D_AREF, SAMPLES_PER_QUERY) << endl;
-
- sleep(1);
- }
-//! [Interesting]
-
- cout << "Exiting" << endl;
-
- delete volts;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/h3lis331dl.cxx b/peripheral/libupm/examples/c++/h3lis331dl.cxx
deleted file mode 100644
index d4a04ca..0000000
--- a/peripheral/libupm/examples/c++/h3lis331dl.cxx
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <signal.h>
-#include <iostream>
-#include "h3lis331dl.h"
-
-using namespace std;
-using namespace upm;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main(int argc, char **argv)
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // Instantiate an H3LIS331DL on I2C bus 0
-
- upm::H3LIS331DL *accel = new upm::H3LIS331DL(H3LIS331DL_I2C_BUS,
- H3LIS331DL_DEFAULT_I2C_ADDR);
-
- // Initialize the device with default values
- accel->init();
-
- while (shouldRun)
- {
- int x, y, z;
- float ax, ay, az;
-
- accel->update();
-
- accel->getRawXYZ(&x, &y, &z);
- accel->getAcceleration(&ax, &ay, &az);
-
- cout << "Raw: X = " << x << " Y = " << y << " Z = " << z << endl;
-
- cout << "Acceleration: AX = " << ax << " AY = " << ay << " AZ = " << az
- << endl;
-
- cout << endl;
-
- usleep(500000);
- }
-
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete accel;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/hcsr04.cxx b/peripheral/libupm/examples/c++/hcsr04.cxx
deleted file mode 100644
index c0a2725..0000000
--- a/peripheral/libupm/examples/c++/hcsr04.cxx
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "hcsr04.h"
-#include <signal.h>
-#include <stdlib.h>
-#include <sys/time.h>
-
-upm::HCSR04 *sonar = NULL;
-
-void
-sig_handler(int signo)
-{
- printf("got signal\n");
- if (signo == SIGINT) {
- printf("exiting application\n");
- sonar->m_doWork = 1;
- }
-}
-
-//! [Interesting]
-int
-main(int argc, char **argv)
-{
- sonar = new upm::HCSR04(5, 6);
- signal(SIGINT, sig_handler);
-
- sleep(1);
-
- for(;;){
- std::cout << "get distance" << std::endl;
- double distance = sonar->getDistance(CM);
- std::cout << "distance " << distance << std::endl;
- sleep(5);
- }
-
- delete sonar;
-
- return 0;
-}
-//! [Interesting]
diff --git a/peripheral/libupm/examples/c++/hdxxvxta.cxx b/peripheral/libupm/examples/c++/hdxxvxta.cxx
deleted file mode 100644
index 2a555f3..0000000
--- a/peripheral/libupm/examples/c++/hdxxvxta.cxx
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2016 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-
-#include "hdxxvxta.h"
-
-using namespace std;
-
-bool shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main(int argc, char **argv)
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
-
- cout << "Initializing..." << endl;
-
- // Instantiate an HDXXVXTA instance, using A1 for humidity and A0
- // for temperature
- upm::HDXXVXTA *sensor = new upm::HDXXVXTA(1, 0);
-
- // update and print available values every second
- while (shouldRun)
- {
- // update our values from the sensor
- sensor->update();
-
- // we show both C and F for temperature
- cout << "Temperature: " << sensor->getTemperature()
- << " C / " << sensor->getTemperature(true) << " F"
- << endl;
-
- cout << "Humidity: " << sensor->getHumidity()
- << " %" << endl;
-
- cout << endl;
-
- sleep(1);
- }
-
- cout << "Exiting..." << endl;
-
- delete sensor;
-
-//! [Interesting]
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/hm11.cxx b/peripheral/libupm/examples/c++/hm11.cxx
deleted file mode 100644
index e759804..0000000
--- a/peripheral/libupm/examples/c++/hm11.cxx
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include <stdio.h>
-#include "hm11.h"
-
-using namespace std;
-using namespace upm;
-
-void printUsage(char *progname)
-{
- cout << "Usage: " << progname << " [AT command]" << endl;
- cout << endl;
-
- cout << "If an argument is supplied on the command line, that argument is"
- << endl;
- cout << "sent to the module and the response is printed out." << endl;
- cout << endl;
- cout << "If no argument is used, then the address and PIN of the module"
- << endl;
- cout << "are queried and the results printed out." << endl;
- cout << endl;
- cout << endl;
-}
-
-// simple helper function to send a command and wait for a response
-void sendCommand(upm::HM11* ble, char *cmd)
-{
- char buffer[BUFSIZ];
- ble->writeData(cmd, strlen(cmd));
-
- // wait up to 1 second
- if (ble->dataAvailable(1000))
- {
- memset(buffer, 0, BUFSIZ);
-
- ble->readData(buffer, BUFSIZ - 1);
- cout << "Returned: " << buffer << endl;
- }
- else
- {
- cerr << "Timed out waiting for response" << endl;
- }
-}
-
-
-int main (int argc, char **argv)
-{
-//! [Interesting]
- char buffer[BUFSIZ];
- // Instantiate a HM11 BLE Module on UART 0
-
- upm::HM11* ble = new upm::HM11(0);
-
- // make sure port is initialized properly. 9600 baud is the default.
- if (!ble->setupTty(B9600))
- {
- cerr << "Failed to setup tty port parameters" << endl;
- return 1;
- }
-
- printUsage(argv[0]);
-
- if (argc > 1)
- {
- cout << "Sending command line argument (" << argv[1] << ")..." << endl;
- sendCommand(ble, argv[1]);
- }
- else
- {
- // query the module address
- char addr[] = "AT+ADDR?";
- cout << "Querying module address (" << addr << ")..." << endl;
- sendCommand(ble, addr);
-
- sleep(1);
-
- // query the module address
- char pin[] = "AT+PASS?";
- cout << "Querying module PIN (" << pin << ")..." << endl;
- sendCommand(ble, pin);
-
- // Other potentially useful commands are:
- //
- // AT+VERS? - query module version
- // AT+ROLE0 - set as slave
- // AT+ROLE1 - set as master
- // AT+CLEAR - clear all previous settings
- // AT+RESET - restart the device
- //
- // A comprehensive list is available from the datasheet at:
- // http://www.seeedstudio.com/wiki/images/c/cd/Bluetooth4_en.pdf
- }
-
-//! [Interesting]
-
- delete ble;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/hmc5883l.cxx b/peripheral/libupm/examples/c++/hmc5883l.cxx
deleted file mode 100644
index dec08ce..0000000
--- a/peripheral/libupm/examples/c++/hmc5883l.cxx
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Author: Brendan Le Foll <brendan.le.foll@intel.com>
- * Contributions: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include "hmc5883l.h"
-
-int
-main(int argc, char **argv)
-{
-//! [Interesting]
- // Instantiate on I2C
- upm::Hmc5883l* compass = new upm::Hmc5883l(0);
- int16_t *pos;
-
- compass->set_declination(0.2749); // Set your declination from true north in radians
-
- // Print out the coordinates, heading, and direction every second
- while(true){
- compass->update(); // Update the coordinates
- pos = compass->coordinates();
- fprintf(stdout, "coor: %5d %5d %5d ", pos[0], pos[1], pos[2]);
- fprintf(stdout, "heading: %5.2f direction: %3.2f\n", compass->heading(), compass->direction());
- sleep(1);
- }
-//! [Interesting]
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/hmtrp.cxx b/peripheral/libupm/examples/c++/hmtrp.cxx
deleted file mode 100644
index 3d58ba9..0000000
--- a/peripheral/libupm/examples/c++/hmtrp.cxx
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <string.h>
-#include <iostream>
-#include <signal.h>
-#include "hmtrp.h"
-
-using namespace std;
-
-bool shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-void printUsage()
-{
- cout << "Usage:" << endl;
- cout << "Pass a commandline argument (any argument) to this program"
- << endl;
- cout << "to query the radio configuration and output it. NOTE: the"
- << endl;
- cout << "radio must be in CONFIG mode for this to work."
- << endl;
- cout << endl;
- cout << "Running this program without arguments will simply transmit"
- << endl;
- cout << "'Hello World!' every second, and output any data received from"
- << endl;
- cout << "another radio."
- << endl;
- cout << endl;
-}
-
-const size_t bufferLength = 256;
-
-int main (int argc, char **argv)
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // Instantiate a HMTRP radio device on uart 0
-
- upm::HMTRP* radio = new upm::HMTRP(0);
-
- // make sure port is initialized properly. 9600 baud is the default.
- if (!radio->setupTty(B9600))
- {
- cerr << "Failed to setup tty port parameters" << endl;
- return 1;
- }
-
- printUsage();
-
- // By default, this radio simply transmits data sent via writeData()
- // and reads any available data via readData().
-
- // It can be placed into a configuration mode by grounding the
- // CONFIG pin on the module. When this is done, the various
- // configuration query and config methods can be used. In this
- // example, by default, we just read any data available fom the
- // device, and periodically transmit "Hello World".
-
- // If any argument was specified on the command line, do a simple
- // configuration query and output the results. The radio must be in
- // CONFIG mode for this to work.
-
- if (argc > 1)
- {
- // config mode
- uint32_t freq;
- uint32_t dataRate;
- uint16_t rxBandwidth;
- uint8_t modulation;
- uint8_t txPower;
- uint32_t uartBaud;
-
- if (radio->getConfig(&freq, &dataRate, &rxBandwidth, &modulation,
- &txPower, &uartBaud))
- {
- cout << "Radio configuration:" << endl;
- cout << "freq: " << freq << " dataRate: " << dataRate
- << " rxBandwidth: " << rxBandwidth << "Khz" << endl;
-
- cout << "modulation: " << int(modulation) << "Khz txPower: "
- << int(txPower) << " uartBaud: " << uartBaud << endl;
- }
- else
- {
- cerr << "getConfig() failed. Make sure the radio is in "
- << "CONFIG mode." << endl;
- }
- }
- else
- {
- // normal read/write mode
- char radioBuffer[bufferLength];
- int counter = 0;
- cout << "Running in normal read/write mode." << endl;
-
- while (shouldRun)
- {
- // we don't want the read to block in this example, so always
- // check to see if data is available first.
- if (radio->dataAvailable())
- {
- memset(radioBuffer, 0, bufferLength);
- int rv = radio->readData(radioBuffer, bufferLength - 1);
-
- if (rv > 0)
- cout << "Received: " << radioBuffer << endl;
-
- if (rv < 0) // some sort of read error occured
- {
- cerr << "Port read error." << endl;
- break;
- }
-
- continue;
- }
-
- usleep(100000); // 100ms
- counter++;
- // every second, transmit "Hello World"
- if (counter > 10)
- {
- static const char *hello = "Hello World!";
- cout << "Transmitting hello world..." << endl;
- radio->writeData((char *)hello, strlen(hello) + 1);
- counter = 0;
- }
- }
- }
-
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete radio;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/hp20x.cxx b/peripheral/libupm/examples/c++/hp20x.cxx
deleted file mode 100644
index 119a449..0000000
--- a/peripheral/libupm/examples/c++/hp20x.cxx
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <signal.h>
-#include <iostream>
-#include "hp20x.h"
-
-using namespace std;
-using namespace upm;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main(int argc, char **argv)
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // Instantiate an HP20X on default I2C bus and address
-
- upm::HP20X *bar = new upm::HP20X();
-
- // Initialize the device with default values
- bar->init();
-
- // Output data every second until interrupted
- while (shouldRun)
- {
- printf("Temperature: %f Celcius\n", bar->getTemperature());
- printf("Pressure: %f Millibars\n", bar->getPressure());
- printf("Altitude: %f Meters\n", bar->getAltitude());
-
- printf("\n");
-
- sleep(1);
- }
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete bar;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/ht9170.cxx b/peripheral/libupm/examples/c++/ht9170.cxx
deleted file mode 100644
index 1be72b6..0000000
--- a/peripheral/libupm/examples/c++/ht9170.cxx
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-
-#include "ht9170.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main ()
-{
- signal(SIGINT, sig_handler);
- //! [Interesting]
-
- // Instantiate a DTMF decoder
- upm::HT9170* dtmf = new upm::HT9170(12, 11, 10, 9, 8);
-
- // Now we just spin in a loop, sleeping every 100ms, checking to see
- // if a digit is available. If so, we decode and print the digit,
- // and continue looping.
-
- while(shouldRun)
- {
- if (dtmf->digitReady())
- {
- cout << "Got DTMF code: " << dtmf->decodeDigit() << endl;
- // now spin until digitReady() goes false again
- while (dtmf->digitReady())
- ;
- }
-
- usleep(100000);
- }
-
- //! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete dtmf;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/htu21d.cxx b/peripheral/libupm/examples/c++/htu21d.cxx
deleted file mode 100644
index 63d6fdf..0000000
--- a/peripheral/libupm/examples/c++/htu21d.cxx
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Author: William Penner <william.penner@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-
-#include "htu21d.h"
-
-volatile int doWork = 0;
-
-upm::HTU21D *sensor = NULL;
-
-void
-sig_handler(int signo)
-{
- if (signo == SIGINT) {
- printf("\nCtrl-C received.\n");
- doWork = 1;
- }
-}
-
-int
-main(int argc, char **argv)
-{
- // Register signal handler
- signal(SIGINT, sig_handler);
-
- //! [Interesting]
- float humidity = 0.0;
- float temperature = 0.0;
- float compRH = 0.0;
-
- sensor = new upm::HTU21D(0, HTU21D_I2C_ADDRESS);
-
- sensor->testSensor();
-
- while (!doWork) {
- compRH = sensor->getCompRH(true);
- humidity = sensor->getHumidity(false);
- temperature = sensor->getTemperature(false);
-
- std::cout << "humidity value = " <<
- humidity <<
- ", temperature value = " <<
- temperature <<
- ", compensated RH value = " <<
- compRH << std::endl;
- usleep (500000);
- }
- //! [Interesting]
-
- std::cout << "exiting application" << std::endl;
-
- delete sensor;
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/hwxpxx.cxx b/peripheral/libupm/examples/c++/hwxpxx.cxx
deleted file mode 100644
index 1cfdf54..0000000
--- a/peripheral/libupm/examples/c++/hwxpxx.cxx
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2016 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-
-#include "hwxpxx.h"
-
-using namespace std;
-
-bool shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main(int argc, char **argv)
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
-
- string defaultDev = "/dev/ttyUSB0";
-
- // if an argument was specified, use it as the device instead
- if (argc > 1)
- defaultDev = string(argv[1]);
-
- cout << "Using device " << defaultDev << endl;
- cout << "Initializing..." << endl;
-
- // Instantiate an HWXPXX instance, using MODBUS slave address 3, and
- // default comm parameters (19200, 8, N, 2)
- upm::HWXPXX *sensor = new upm::HWXPXX(defaultDev, 3);
-
- // output the Slave ID (manufacturer, model, serno)
- cout << "Slave ID: " << sensor->getSlaveID() << endl;
-
- // stored temperature and humidity offsets
- cout << "Temperature Offset: " << sensor->getTemperatureOffset()
- << endl;
- cout << "Humidity Offset: " << sensor->getHumidityOffset()
- << endl;
-
- cout << endl;
-
- // update and print available values every second
- while (shouldRun)
- {
- // update our values from the sensor
- sensor->update();
-
- // we show both C and F for temperature
- cout << "Temperature: " << sensor->getTemperature()
- << " C / " << sensor->getTemperature(true) << " F"
- << endl;
-
- cout << "Humidity: " << sensor->getHumidity()
- << " %" << endl;
-
- cout << "Slider: " << sensor->getSlider() << " %" << endl;
-
- cout << "Override Switch Status: " << sensor->getOverrideSwitchStatus()
- << endl;
-
- cout << endl;
-
- sleep(1);
- }
-
- cout << "Exiting..." << endl;
-
- delete sensor;
-
-//! [Interesting]
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/hx711.cxx b/peripheral/libupm/examples/c++/hx711.cxx
deleted file mode 100644
index 531734b..0000000
--- a/peripheral/libupm/examples/c++/hx711.cxx
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
-*
-* Author: Rafael da Mata Neri <rafael.neri@gmail.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-*
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to
-* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
-* the Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all
-* copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
-* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
-* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
-* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-
-//! [Interesting]
-#include "hx711.h"
-
-int
-main(int argc, char **argv)
-{
- upm::HX711 *scale = new upm::HX711(3, 2);
-
- // 2837: value obtained via calibration
- scale->setScale(2837);
- scale->tare();
- std::cout << scale->getUnits() << std::endl;
-
- return 0;
-}
-//! [Interesting]
diff --git a/peripheral/libupm/examples/c++/ili9341.cxx b/peripheral/libupm/examples/c++/ili9341.cxx
deleted file mode 100644
index 8fe397a..0000000
--- a/peripheral/libupm/examples/c++/ili9341.cxx
+++ /dev/null
@@ -1,84 +0,0 @@
-/**
- * Author: Shawn Hymel
- * Copyright (c) 2016 SparkFun Electronics
- *
- * 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 "ili9341.h"
-
-int main(int argc, char **argv) {
-//! [Interesting]
-
- // Pins (Edison)
- // CS_LCD GP44 (MRAA 31)
- // CS_SD GP43 (MRAA 38) unused
- // DC GP12 (MRAA 20)
- // RESEST GP13 (MRAA 14)
- upm::ILI9341 * lcd = new upm::ILI9341(31, 38, 20, 14);
-
- // Fill the screen with a solid color
- lcd->fillScreen(lcd->color565(0, 40, 16));
-
- // Draw some shapes
- lcd->drawFastVLine(10, 10, 100, ILI9341_RED);
- lcd->drawFastHLine(20, 10, 50, ILI9341_CYAN);
- lcd->drawLine(160, 30, 200, 60, ILI9341_GREEN);
- lcd->fillRect(20, 30, 75, 60, ILI9341_ORANGE);
- lcd->drawCircle(70, 50, 20, ILI9341_PURPLE);
- lcd->fillCircle(120, 50, 20, ILI9341_PURPLE);
- lcd->drawTriangle(50, 100, 10, 140, 90, 140, ILI9341_YELLOW);
- lcd->fillTriangle(150, 100, 110, 140, 190, 140, ILI9341_YELLOW);
- lcd->drawRoundRect(20, 150, 50, 30, 10, ILI9341_RED);
- lcd->drawRoundRect(130, 150, 50, 30, 10, ILI9341_RED);
- lcd->fillRoundRect(75, 150, 50, 30, 10, ILI9341_RED);
-
- // Write some text
- lcd->setCursor(0, 200);
- lcd->setTextColor(ILI9341_LIGHTGREY);
- lcd->setTextWrap(true);
- lcd->setTextSize(1);
- lcd->print("Text 1\n");
- lcd->setTextSize(2);
- lcd->print("Text 2\n");
- lcd->setTextSize(3);
- lcd->print("Text 3\n");
- lcd->setTextSize(4);
- lcd->print("Text 4\n");
-
- // Test screen rotation
- for(int r = 0; r < 4; r++) {
- lcd->setRotation(r);
- lcd->fillRect(0, 0, 5, 5, ILI9341_WHITE);
- sleep(1);
- }
-
- // Invert colors, wait, then revert back
- lcd->invertDisplay(true);
- sleep(2);
- lcd->invertDisplay(false);
-
- // Don't forget to free up that memory!
- delete lcd;
-//! [Interesting]
- return 0;
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/c++/ina132.cxx b/peripheral/libupm/examples/c++/ina132.cxx
deleted file mode 100644
index 0c78630..0000000
--- a/peripheral/libupm/examples/c++/ina132.cxx
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Author: Zion Orent <zorent@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "ina132.h"
-
-using namespace std;
-
-bool shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // The was tested with the INA132 Differential Amplifier Sensor module.
-
- // Instantiate an INA132 on analog pin A0
- upm::INA132 *amplifier = new upm::INA132(0);
-
- while (shouldRun)
- {
- cout << amplifier->value() << endl;
- sleep(1);
- }
-//! [Interesting]
-
- cout << "Exiting" << endl;
-
- delete amplifier;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/isd1820.cxx b/peripheral/libupm/examples/c++/isd1820.cxx
deleted file mode 100644
index 3246808..0000000
--- a/peripheral/libupm/examples/c++/isd1820.cxx
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "isd1820.h"
-
-using namespace std;
-
-int main (int argc, char **argv)
-{
-//! [Interesting]
- // Instantiate a ISD1820 on digital pins 2 (play) and 3 (record)
- // This example was tested on the Grove Recorder.
-
- upm::ISD1820* recorder = new upm::ISD1820(2, 3);
-
- // if an argument was specified (any argument), go into record mode,
- // else playback a previously recorded sample
-
- cout << "Supply any argument to the command line to record." << endl;
- cout << "Running this example without arguments will play back any " << endl;
- cout << "previously recorded sound." << endl;
- cout << "There is approximately 10 seconds of recording time." << endl;
-
- cout << endl;
-
- bool doRecord = false;
-
- if (argc > 1)
- doRecord = true;
-
- // depending on what was selected, do it, and sleep for 15 seconds
-
- if (doRecord)
- recorder->record(true);
- else
- recorder->play(true);
-
- // There are about 10 seconds of recording/playback time, so we will
- // sleep for a little extra time.
- cout << "Sleeping for 15 seconds..." << endl;
- sleep(15);
-
- // now, turn off whatever we were doing.
-
- if (doRecord)
- recorder->record(false);
- else
- recorder->play(false);
-
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete recorder;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/itg3200.cxx b/peripheral/libupm/examples/c++/itg3200.cxx
deleted file mode 100644
index a1bf8af..0000000
--- a/peripheral/libupm/examples/c++/itg3200.cxx
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Author: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include "itg3200.h"
-
-int
-main(int argc, char **argv)
-{
-//! [Interesting]
- int16_t *rot;
- float *ang;
-
- // Note: Sensor not supported on Intel Edison with Arduino breakout
- upm::Itg3200* gyro = new upm::Itg3200(0);
-
- while(true){
- gyro->update(); // Update the data
- rot = gyro->getRawValues(); // Read raw sensor data
- ang = gyro->getRotation(); // Read rotational speed (deg/sec)
- fprintf(stdout, "Raw: %6d %6d %6d\n", rot[0], rot[1], rot[2]);
- fprintf(stdout, "AngX: %5.2f\n", ang[0]);
- fprintf(stdout, "AngY: %5.2f\n", ang[1]);
- fprintf(stdout, "AngZ: %5.2f\n", ang[2]);
- fprintf(stdout, "Temp: %5.2f Raw: %6d\n", gyro->getTemperature(), gyro->getRawTemp());
- sleep(1);
- }
-//! [Interesting]
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/jhd1313m1-lcd.cxx b/peripheral/libupm/examples/c++/jhd1313m1-lcd.cxx
deleted file mode 100644
index ca2f155..0000000
--- a/peripheral/libupm/examples/c++/jhd1313m1-lcd.cxx
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Author: Yevgeniy Kiveish <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include "jhd1313m1.h"
-
-int
-main(int argc, char **argv)
-{
-//! [Interesting]
- // 0x62 RGB_ADDRESS, 0x3E LCD_ADDRESS
- upm::Jhd1313m1 *lcd = new upm::Jhd1313m1(0, 0x3E, 0x62);
- lcd->setCursor(0,0);
- lcd->write("Hello World");
- lcd->setCursor(1,2);
- lcd->write("Hello World");
-
- printf("Sleeping for 5 seconds\n");
- sleep(5);
- delete lcd;
-//! [Interesting]
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/joystick12.cxx b/peripheral/libupm/examples/c++/joystick12.cxx
deleted file mode 100644
index 408ca2a..0000000
--- a/peripheral/libupm/examples/c++/joystick12.cxx
+++ /dev/null
@@ -1,66 +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.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "joystick12.h"
-#include <stdlib.h>
-#include <sys/time.h>
-
-int is_running = 0;
-upm::Joystick12 *sensor = NULL;
-
-void
-sig_handler(int signo)
-{
- printf("got signal\n");
- if (signo == SIGINT) {
- is_running = 1;
- }
-}
-
-//! [Interesting]
-int
-main(int argc, char **argv)
-{
- // Instantiate a joystick on analog pins A0 and A1
- sensor = new upm::Joystick12(0,1);
- signal(SIGINT, sig_handler);
-
- // Print the X and Y input values every second
- while (!is_running) {
- float x = sensor->getXInput();
- float y = sensor->getYInput();
- std::cout << "Driving X:" << x << ": and Y:" << y << std::endl;
- sleep(1);
- }
-
- std::cout << "exiting application" << std::endl;
-
- delete sensor;
-
- return 0;
-}
-//! [Interesting]
diff --git a/peripheral/libupm/examples/c++/kxcjk1013.cxx b/peripheral/libupm/examples/c++/kxcjk1013.cxx
deleted file mode 100644
index 3732dbd..0000000
--- a/peripheral/libupm/examples/c++/kxcjk1013.cxx
+++ /dev/null
@@ -1,75 +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 <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "kxcjk1013.h"
-
-using namespace std;
-
-int shouldRun = true;
-upm::KXCJK1013* accelerometer;
-
-void
-sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-void
-data_callback(char* data)
-{
- float x, y, z;
- accelerometer->extract3Axis(data, &x, &y, &z);
- printf("%.1f %.1f %.1f\n", x, y, z);
- // usleep(100);
-}
-
-int
-main()
-{
- signal(SIGINT, sig_handler);
- //! [Interesting]
- // Instantiate a KXCJK1013 Accelerometer Sensor on iio device 0
- accelerometer = new upm::KXCJK1013(0);
- accelerometer->setScale(0.019163);
- accelerometer->setSamplingFrequency(25.0);
- accelerometer->enable3AxisChannel();
- accelerometer->installISR(data_callback, NULL);
- accelerometer->enableBuffer(16);
-
- while (shouldRun) {
- sleep(1);
- }
- accelerometer->disableBuffer();
-
- //! [Interesting]
- cout << "Exiting" << endl;
-
- delete accelerometer;
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/l298-stepper.cxx b/peripheral/libupm/examples/c++/l298-stepper.cxx
deleted file mode 100644
index 8fe2b91..0000000
--- a/peripheral/libupm/examples/c++/l298-stepper.cxx
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "l298.h"
-
-using namespace std;
-
-int main ()
-{
- //! [Interesting]
-
- // Instantiate a Stepper motor on a L298 Dual H-Bridge.
-
- // This was tested with the NEMA-17 12V, 350mA, with 200 steps per rev.
- upm::L298* l298 = new upm::L298(200, 3, 4, 7, 8, 9);
-
- l298->setSpeed(10); // 10 RPMs
- l298->setDirection(upm::L298::DIR_CW);
- l298->enable(true);
- cout << "Rotating 1 full revolution at 10 RPM speed." << endl;
- // move 200 steps, a full rev
- l298->stepperSteps(200);
- cout << "Sleeping for 2 seconds..." << endl;
- sleep(2);
- cout << "Rotating 1/2 revolution in opposite direction at 10 RPM speed."
- << endl;
- l298->setDirection(upm::L298::DIR_CCW);
- l298->stepperSteps(100);
- // release
- l298->enable(false);
-
- //! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete l298;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/l298.cxx b/peripheral/libupm/examples/c++/l298.cxx
deleted file mode 100644
index 8e360b2..0000000
--- a/peripheral/libupm/examples/c++/l298.cxx
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "l298.h"
-
-using namespace std;
-
-int main ()
-{
- //! [Interesting]
-
- // Instantiate one of the 2 possible DC motors on a L298 Dual
- // H-Bridge. For controlling a stepper motor, see the l298-stepper
- // example.
- upm::L298* l298 = new upm::L298(3, 4, 7);
-
- cout << "Starting motor at 50% for 3 seconds..." << endl;
- l298->setSpeed(50);
- l298->setDirection(upm::L298::DIR_CW);
- l298->enable(true);
-
- sleep(3);
-
- cout << "Reversing direction..." << endl;
- l298->setDirection(upm::L298::DIR_NONE); // fast stop
- l298->setDirection(upm::L298::DIR_CCW);
- sleep(3);
-
- l298->setSpeed(0);
- l298->enable(false);
-
- //! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete l298;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/lcm1602-i2c.cxx b/peripheral/libupm/examples/c++/lcm1602-i2c.cxx
deleted file mode 100644
index f405f96..0000000
--- a/peripheral/libupm/examples/c++/lcm1602-i2c.cxx
+++ /dev/null
@@ -1,48 +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 "lcm1602.h"
-
-int
-main(int argc, char **argv)
-{
-//! [Interesting]
- upm::Lcm1602* lcd = new upm::Lcm1602(0, 0x27);
- lcd->setCursor(0,0);
- lcd->write("Hello World");
-//! [Interesting]
- sleep(3);
- lcd->setCursor(1,2);
- lcd->write("Hello World");
- sleep(3);
- lcd->setCursor(2,4);
- lcd->write("Hello World");
- sleep(3);
- lcd->setCursor(3,6);
- lcd->write("Hello World");
- sleep(3);
- delete lcd;
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/lcm1602-parallel.cxx b/peripheral/libupm/examples/c++/lcm1602-parallel.cxx
deleted file mode 100644
index 642c6af..0000000
--- a/peripheral/libupm/examples/c++/lcm1602-parallel.cxx
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Author: Sergey Kiselev <sergey.kiselev@intel.com>
- * Author: Yevgeniy Kiveish <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 - 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <lcm1602.h>
-
-int
-main(int argc, char **argv)
-{
-//! [Interesting]
- // LCD connection:
- // LCD RS pin to digital pin 8
- // LCD Enable pin to digital pin 13
- // LCD D4 pin to digital pin 2
- // LCD D5 pin to digital pin 3
- // LCD D6 pin to digital pin 4
- // LCD D7 pin to digital pin 5
- // LCD R/W pin to ground
- // 10K trimmer potentiometer:
- // ends to +5V and ground
- // wiper to LCD VO pin (pin 3)
- upm::Lcm1602 *lcd = new upm::Lcm1602(8, 13, 2, 3, 4, 5, 20, 2);
- lcd->setCursor(0,0);
- lcd->write("Hello World");
- lcd->setCursor(1,2);
- lcd->write("Hello World");
-
- printf("Sleeping for 5 seconds\n");
- sleep(5);
- delete lcd;
-//! [Interesting]
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/ldt0028.cxx b/peripheral/libupm/examples/c++/ldt0028.cxx
deleted file mode 100644
index 8d9c8b7..0000000
--- a/peripheral/libupm/examples/c++/ldt0028.cxx
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Author: Sarah Knepper <sarah.knepper@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <iomanip>
-#include <cmath>
-#include "ldt0028.h"
-
-int
-main(int argc, char **argv)
-{
-//! [Interesting]
- const int NUMBER_OF_SECONDS = 10;
- const int MICROSECONDS_PER_SECOND = 1000000;
- const int SAMPLES_PER_SECOND = 50;
- const int THRESHOLD = 100;
-
- // Create the LDT0-028 Piezo Vibration Sensor object using AIO pin 0
- upm::LDT0028* sensor = new upm::LDT0028(0);
-
- // Read the signal every 20 milliseconds for 10 seconds
- std::cout << "For the next " << NUMBER_OF_SECONDS << " seconds, "
- << SAMPLES_PER_SECOND << " samples will be taken every second."
- << std::endl << std::endl;
- uint16_t* buffer = new uint16_t[NUMBER_OF_SECONDS * SAMPLES_PER_SECOND];
- for (int i=0; i < NUMBER_OF_SECONDS * SAMPLES_PER_SECOND; i++) {
- buffer[i] = (uint16_t) sensor->getSample();
- usleep(MICROSECONDS_PER_SECOND / SAMPLES_PER_SECOND);
- }
-
- // Print the number of times the reading was greater than the threshold
- int count = 0;
- for (int i=0; i < NUMBER_OF_SECONDS * SAMPLES_PER_SECOND; i++) {
- if (buffer[i] > THRESHOLD) {
- count++;
- }
- }
- std::cout << sensor->name() << " exceeded the threshold value of " <<
- THRESHOLD << " a total of " << count << " times," << std::endl
- << "out of a total of " << NUMBER_OF_SECONDS*SAMPLES_PER_SECOND
- << " readings." << std::endl << std::endl;
-
- // Print a graphical representation of the average value sampled
- // each second for the past 10 seconds, using a scale factor of 15
- std::cout << "Now printing a graphical representation of the average reading "
- << std::endl << "each second for the last "
- << NUMBER_OF_SECONDS << " seconds." << std::endl;
- const int SCALE_FACTOR = 15;
- for (int i=0; i < NUMBER_OF_SECONDS; i++) {
- long sum = 0;
- for (int j=0; j < SAMPLES_PER_SECOND; j++) {
- sum += buffer[i*SAMPLES_PER_SECOND + j];
- }
- double average = (double) sum / (double) SAMPLES_PER_SECOND;
- int stars_to_print = (int) round(average / SCALE_FACTOR);
- std::cout << "(" << std::setw(4) << (int) round(average) << ") | ";
- for (int j=0; j<stars_to_print; j++) {
- std::cout << "*";
- }
- std::cout << std::endl;
- }
-
- // Delete the sensor object
- delete sensor;
-//! [Interesting]
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/lm35.cxx b/peripheral/libupm/examples/c++/lm35.cxx
deleted file mode 100644
index 8930940..0000000
--- a/peripheral/libupm/examples/c++/lm35.cxx
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "lm35.h"
-
-using namespace std;
-
-bool shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
-
- // Instantiate a LM35 on analog pin A0, with a default analog
- // reference voltage of 5.0
- upm::LM35 *sensor = new upm::LM35(0);
-
- // Every half second, sample the sensor and output the temperature
-
- while (shouldRun)
- {
- cout << "Temperature: " << sensor->getTemperature() << " C" << endl;
-
- usleep(500000);
- }
-
-//! [Interesting]
-
- cout << "Exiting" << endl;
-
- delete sensor;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/lol.cxx b/peripheral/libupm/examples/c++/lol.cxx
deleted file mode 100644
index 9f2943d..0000000
--- a/peripheral/libupm/examples/c++/lol.cxx
+++ /dev/null
@@ -1,67 +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.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "lol.h"
-#include <stdlib.h>
-#include <sys/time.h>
-
-int is_running = 0;
-upm::LoL *sensor = NULL;
-
-void
-sig_handler(int signo)
-{
- printf("got signal\n");
- if (signo == SIGINT) {
- is_running = 1;
- }
-}
-
-//! [Interesting]
-int
-main(int argc, char **argv)
-{
- sensor = new upm::LoL();
- signal(SIGINT, sig_handler);
-
- unsigned char *buffer;
- //buffer = sensor->getFramebuffer();
- int x = 0, y = 0;
- while (!is_running) {
- sensor->setPixel(x, y, !(sensor->getPixel(x, y)));
- if (++x == 13) { x = 0; y++; }
- if (y == 9) y = 0;
- usleep(10000);
- }
-
- std::cout << "exiting application" << std::endl;
-
- delete sensor;
-
- return 0;
-}
-//! [Interesting]
diff --git a/peripheral/libupm/examples/c++/loudness.cxx b/peripheral/libupm/examples/c++/loudness.cxx
deleted file mode 100644
index 44e62b0..0000000
--- a/peripheral/libupm/examples/c++/loudness.cxx
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "loudness.h"
-
-using namespace std;
-
-bool shouldRun = true;
-
-#define LOUDNESS_AREF 5.0
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
-
- // Instantiate a Loudness sensor on analog pin A0, with an analog
- // reference voltage of LOUDNESS_AREF
- upm::Loudness *loud = new upm::Loudness(0, LOUDNESS_AREF);
-
- // Every tenth of a second, sample the loudness and output it's
- // corresponding analog voltage.
-
- while (shouldRun)
- {
- cout << "Detected loudness (volts): " << loud->loudness() << endl;
-
- usleep(100000);
- }
-
-//! [Interesting]
-
- cout << "Exiting" << endl;
-
- delete loud;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/lpd8806.cxx b/peripheral/libupm/examples/c++/lpd8806.cxx
deleted file mode 100644
index 8828f07..0000000
--- a/peripheral/libupm/examples/c++/lpd8806.cxx
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "lpd8806.h"
-#include <signal.h>
-
-void scanner(uint8_t r, uint8_t g, uint8_t b, uint8_t wait);
-
-int doWork = 0;
-upm::LPD8806 *sensor = NULL;
-
-void
-sig_handler(int signo)
-{
- printf("got signal\n");
- if (signo == SIGINT) {
- printf("exiting application\n");
- doWork = 1;
- }
-}
-
-int
-main(int argc, char **argv)
-{
- //! [Interesting]
- sensor = new upm::LPD8806(10, 7);
- usleep (1000000);
-
- sensor->show ();
-
- while (!doWork) {
- // Back-and-forth lights
- scanner(127, 0, 0, 30); // red, slow
- scanner(0, 0, 127, 15); // blue, fast
- usleep (1000000);
- }
- //! [Interesting]
-
- std::cout << "exiting application" << std::endl;
-
- delete sensor;
-
- return 0;
-}
-
-void scanner(uint8_t r, uint8_t g, uint8_t b, uint8_t wait) {
- int i, j, pos, dir;
-
- pos = 0;
- dir = 1;
-
- for(i=0; i < ((sensor->getStripLength() - 1) * 8); i++) {
- // Draw 5 pixels centered on pos. setPixelColor() will clip
- // any pixels off the ends of the strip, no worries there.
- // we'll make the colors dimmer at the edges for a nice pulse
- // look
- sensor->setPixelColor(pos - 2, r/4, g/4, b/4);
- sensor->setPixelColor(pos - 1, r/2, g/2, b/2);
- sensor->setPixelColor(pos, r, g, b);
- sensor->setPixelColor(pos + 1, r/2, g/2, b/2);
- sensor->setPixelColor(pos + 2, r/4, g/4, b/4);
-
- sensor->show();
- usleep (wait * 1000);
- // If we wanted to be sneaky we could erase just the tail end
- // pixel, but it's much easier just to erase the whole thing
- // and draw a new one next time.
- for(j=-2; j<= 2; j++) {
- sensor->setPixelColor(pos+j, 0,0,0);
- }
- // Bounce off ends of strip
- pos += dir;
- if(pos < 0) {
- pos = 1;
- dir = -dir;
- } else if (pos >= sensor->getStripLength()) {
- pos = sensor->getStripLength() - 2;
- dir = -dir;
- }
- }
-}
diff --git a/peripheral/libupm/examples/c++/lsm303.cxx b/peripheral/libupm/examples/c++/lsm303.cxx
deleted file mode 100644
index f75fd5b..0000000
--- a/peripheral/libupm/examples/c++/lsm303.cxx
+++ /dev/null
@@ -1,71 +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 <iostream>
-
-//! [Interesting]
-#include "lsm303.h"
-
-int
-main(int argc, char **argv)
-{
- // Instantiate LSM303 compass on I2C
- upm::LSM303 *sensor = new upm::LSM303(0);
-
- // Get the coordinate data
- sensor->getCoordinates();
- int16_t* coor = sensor->getRawCoorData(); // in XYZ order.
- // The sensor returns XZY, but the driver compensates and makes it XYZ
-
- // Print out the X, Y, and Z coordinate data using two different methods
- std::cout << "coor: rX " << (int)coor[0]
- << " - rY " << (int)coor[1]
- << " - rZ " << (int)coor[2]
- << std::endl;
- std::cout << "coor: gX " << sensor->getCoorX()
- << " - gY " << sensor->getCoorY()
- << " - gZ " << sensor->getCoorZ()
- << std::endl;
-
- // Get and print out the heading
- std::cout << "heading: "
- << sensor->getHeading()
- << std::endl;
-
- // Get the acceleration
- sensor->getAcceleration();
- int16_t* accel = sensor->getRawAccelData();
- // Print out the X, Y, and Z acceleration data using two different methods
- std::cout << "acc: rX " << (int)accel[0]
- << " - rY " << (int)accel[1]
- << " - Z " << (int)accel[2]
- << std::endl;
- std::cout << "acc: gX " << sensor->getAccelX()
- << " - gY " << sensor->getAccelY()
- << " - gZ " << sensor->getAccelZ()
- << std::endl;
-
- return 0;
-}
-//! [Interesting]
diff --git a/peripheral/libupm/examples/c++/lsm9ds0.cxx b/peripheral/libupm/examples/c++/lsm9ds0.cxx
deleted file mode 100644
index 66644a0..0000000
--- a/peripheral/libupm/examples/c++/lsm9ds0.cxx
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "lsm9ds0.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-
-int main(int argc, char **argv)
-{
- signal(SIGINT, sig_handler);
-//! [Interesting]
-
- // Instantiate an LSM9DS0 using default parameters (bus 1, gyro addr 6b,
- // xm addr 1d)
- upm::LSM9DS0 *sensor = new upm::LSM9DS0();
-
- sensor->init();
-
- while (shouldRun)
- {
- sensor->update();
-
- float x, y, z;
-
- sensor->getAccelerometer(&x, &y, &z);
- cout << "Accelerometer: ";
- cout << "AX: " << x << " AY: " << y << " AZ: " << z << endl;
-
- sensor->getGyroscope(&x, &y, &z);
- cout << "Gryoscope: ";
- cout << "GX: " << x << " GY: " << y << " GZ: " << z << endl;
-
- sensor->getMagnetometer(&x, &y, &z);
- cout << "Magnetometer: ";
- cout << "MX = " << x << " MY = " << y << " MZ = " << z << endl;
-
- cout << "Temperature: " << sensor->getTemperature() << endl;
- cout << endl;
-
- usleep(500000);
- }
-
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete sensor;
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/m24lr64e.cxx b/peripheral/libupm/examples/c++/m24lr64e.cxx
deleted file mode 100644
index 6c3aae0..0000000
--- a/peripheral/libupm/examples/c++/m24lr64e.cxx
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "m24lr64e.h"
-
-using namespace std;
-using namespace upm;
-
-int main(int argc, char **argv)
-{
-//! [Interesting]
- // Instantiate an M24LR64E on I2C bus 0
-
- upm::M24LR64E *nfcTag = new upm::M24LR64E(M24LR64E_I2C_BUS);
-
- // This example accesses the device in the 'user' (default) mode,
- // reads the last byte of data in the EEPROM, inverts it, writes
- // it back, and then re-reads it.
-
- // Read the last byte of the EEPROM area
-
- int addr = M24LR64E::EEPROM_I2C_LENGTH - 1;
- printf("Address: %d\n", addr);
- uint8_t byte = nfcTag->readByte(addr);
- printf("Read byte: %02x\n", byte);
-
- // Now change it to it's opposite and write it
- byte = ~byte;
- nfcTag->writeByte(addr, byte);
- printf("Wrote inverted byte: %02x\n", byte);
-
- // Now read it back.
- byte = nfcTag->readByte(addr);
- printf("Read byte: %02x\n", byte);
-
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete nfcTag;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/max31723.cxx b/peripheral/libupm/examples/c++/max31723.cxx
deleted file mode 100644
index 96082af..0000000
--- a/peripheral/libupm/examples/c++/max31723.cxx
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "max31723.h"
-#include <signal.h>
-
-int doWork = 0;
-upm::MAX31723 *sensor = NULL;
-
-void
-sig_handler(int signo)
-{
- printf("got signal\n");
- if (signo == SIGINT) {
- printf("exiting application\n");
- doWork = 1;
- }
-}
-
-int
-main(int argc, char **argv)
-{
- //! [Interesting]
- sensor = new upm::MAX31723(7);
- usleep (1000000);
-
- while (!doWork) {
- std::cout << "Temperature " << sensor->getTemperature() << std::endl;
- usleep (1000000);
- }
- //! [Interesting]
-
- std::cout << "exiting application" << std::endl;
-
- delete sensor;
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/max31855.cxx b/peripheral/libupm/examples/c++/max31855.cxx
deleted file mode 100644
index 2390d93..0000000
--- a/peripheral/libupm/examples/c++/max31855.cxx
+++ /dev/null
@@ -1,41 +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 <unistd.h>
-#include <iostream>
-#include <signal.h>
-
-//! [Interesting]
-#include "max31855.h"
-
-int
-main(int argc, char **argv)
-{
- upm::MAX31855 *temp = new upm::MAX31855(0, 8);
-
- std::cout << temp->getTemp() << std::endl;
-
- return 0;
-}
-//! [Interesting]
diff --git a/peripheral/libupm/examples/c++/max44000.cxx b/peripheral/libupm/examples/c++/max44000.cxx
deleted file mode 100644
index 404f544..0000000
--- a/peripheral/libupm/examples/c++/max44000.cxx
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "max44000.h"
-
-int
-main(int argc, char **argv)
-{
- //! [Interesting]
- upm::MAX44000 *sensor = new upm::MAX44000(0, ADDR);
- std::cout << "proximity value = " << sensor->getAmbient () << std::endl;
- //! [Interesting]
-
- std::cout << "exiting application" << std::endl;
-
- delete sensor;
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/max5487.cxx b/peripheral/libupm/examples/c++/max5487.cxx
deleted file mode 100644
index 661be05..0000000
--- a/peripheral/libupm/examples/c++/max5487.cxx
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "max5487.h"
-#include <signal.h>
-
-upm::MAX5487 *sensor = NULL;
-
-void
-sig_handler(int signo)
-{
- printf("got signal\n");
- if (signo == SIGINT) {
- printf("exiting application\n");
- }
-}
-
-int
-main(int argc, char **argv)
-{
- //! [Interesting]
- sensor = new upm::MAX5487(7);
-
- // Power LED UP
- for (int i = 0; i < 255; i++) {
- sensor->setWiperA(i);
- usleep (5000);
- }
-
- // Power LED DOWN
- for (int i = 0; i < 255; i++) {
- sensor->setWiperA(255 - i);
- usleep (5000);
- }
-
- //! [Interesting]
-
- std::cout << "exiting application" << std::endl;
-
- delete sensor;
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/maxds3231m.cxx b/peripheral/libupm/examples/c++/maxds3231m.cxx
deleted file mode 100644
index e5a6fc1..0000000
--- a/peripheral/libupm/examples/c++/maxds3231m.cxx
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "maxds3231m.h"
-#include <signal.h>
-
-int doWork = 0;
-upm::MAXDS3231M *sensor = NULL;
-
-void
-sig_handler(int signo)
-{
- printf("got signal\n");
- if (signo == SIGINT) {
- printf("exiting application\n");
- doWork = 1;
- }
-}
-
-int
-main(int argc, char **argv)
-{
- //! [Interesting]
- upm::Time3231 t;
- sensor = new upm::MAXDS3231M(0, ADDR);
-
- t.second = 1;
- t.minute = 3;
- t.hour = 3;
- t.day = 3;
- t.month = 3;
- t.year = 3;
- t.weekDay = 3;
- sensor->setDate (t); // Note, second should be set to 1.
-
- usleep (500000);
-
- while (!doWork) {
- if (sensor->getDate (t)) {
- std::cout << (int)t.hour << ":" << (int)t.minute << ":" << (int)t.second << std::endl;
- }
- std::cout << "Temperature " << sensor->getTemperature() << std::endl;
- usleep (1000000);
- }
- //! [Interesting]
-
- std::cout << "exiting application" << std::endl;
-
- delete sensor;
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/maxsonarez.cxx b/peripheral/libupm/examples/c++/maxsonarez.cxx
deleted file mode 100644
index 3c3d300..0000000
--- a/peripheral/libupm/examples/c++/maxsonarez.cxx
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "maxsonarez.h"
-
-using namespace std;
-
-bool shouldRun = true;
-
-#define MAXSONAREZ_AREF 5.0
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
-
- // Instantiate a MaxSonarEZ on analog pin A1, with an analog
- // reference voltage of MAXSONAREZ_AREF
- upm::MAXSONAREZ *sonar = new upm::MAXSONAREZ(1, MAXSONAREZ_AREF);
-
- // Every second, sample the sonar and output the distance to an
- // object in inches.
-
- // With the EZ3 version, the minimum and maximum ranges seemed to be
- // between 6 and 33 inches
-
- while (shouldRun)
- {
- cout << "AREF: " << MAXSONAREZ_AREF
- << ", distance in inches: " << sonar->inches() << endl;
-
- sleep(1);
- }
-
-//! [Interesting]
-
- cout << "Exiting" << endl;
-
- delete sonar;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/mcp9808.cxx b/peripheral/libupm/examples/c++/mcp9808.cxx
deleted file mode 100644
index ba4e5e4..0000000
--- a/peripheral/libupm/examples/c++/mcp9808.cxx
+++ /dev/null
@@ -1,163 +0,0 @@
-#include <iostream>
-#include <unistd.h>
-#include "mcp9808.h"
-
-#include "mraa.hpp"
-
-int main()
-{
- using namespace std;
-
-//! [Interesting]
- int command;
- upm::MCP9808 *temp = new upm::MCP9808(6);
-
- do
- {
- cout << endl;
- cout << "1 - read temp \t" ;
- cout << "2 - sleep mode \t";
- cout << "3 - wake up" << endl;
- cout << "4 - set mode to " << (temp->isCelsius() == true ? "Fahrenheit" : "Celcius") << endl;
- cout << "5 - show status bits" << endl;
- cout << "6 - Set Tcrit \t" ;
- cout << "7 - Set Tupper \t" ;
- cout << "8 - Set Tlower " << endl;
- cout << "9 - Display monitor temps " << endl;
- cout << "10 - Enable alert default\t";
- cout << "11 - Enable alert interrupt" << endl;
- cout << "12 - Clear interrupt \t" ;
- cout << "13 - Clear alert mode" << endl;
- cout << "14 - Get Hysteresis\t";
- cout << "15 - Set Hysteresis" << endl;
- cout << "16 - Get Resolution\t";
- cout << "17 - Set Resolution" << endl;
- cout << "18 - Get Manufacturer ID"<< endl;
- cout << "19 - Get Device ID" << endl;
- cout << "-1 - exit" << endl;
- cout << "Enter a command: ";
- cin >> command;
-
- switch(command)
- {
- float t;
- case 1:
- std::cout << "Temp: " << temp->getTemp() << "° " << (temp->isCelsius()? "Celsius" : "Fahrenheit")<< std::endl;
- break;
- case 2:
- cout << "shutdown sensor (sleep mode)" << endl;
- temp->shutDown();
- break;
- case 3:
- cout << "wake up sensor" << endl;
- temp->shutDown(false);
- break;
- case 4:
- cout << "set mode to " << (temp->isCelsius() ? "Fahrenheit" : "Celcius") << endl;
- temp->setMode(!temp->isCelsius());
- break;
- case 5:
- cout << "Tcrit = " << temp->isTcrit();
- cout << " Tupper = " << temp->isTupper();
- cout << " Tlower = " << temp->isTlower();
- break;
- case 6:
- cout << "enter a value";
- cin >> t;
- temp->setMonitorReg(temp->CRIT_TEMP, t);
- break;
- case 7:
- cout << "enter a value";
- cin >> t;
- temp->setMonitorReg(temp->UPPER_TEMP, t);
- break;
- case 8:
- cout << "enter a value";
- cin >> t;
- temp->setMonitorReg(temp->LOWER_TEMP, t);
- break;
- case 9:
- cout << "tcrit = " << temp->getMonitorReg(temp->CRIT_TEMP) << endl;
- cout << "tupper = " << temp->getMonitorReg(temp->UPPER_TEMP) << endl;
- cout << "tlower = " << temp->getMonitorReg(temp->LOWER_TEMP) << endl;
- break;
- case 10:
- cout << "set alert mode default" ;
- temp->setAlertMode(temp->ALERTCTRL);
- break;
- case 11:
- cout << "set alert mode interrupt";
- temp->setAlertMode(temp->ALERTMODE | temp->ALERTCTRL );
- break;
- case 12:
- temp->clearInterrupt();
- break;
- case 13:
- cout << "Clear alerts" << endl;
- temp->clearAlertMode();
- break;
- case 14:
- cout << "Hysteresis: " << temp->getHysteresis() << endl;
- break;
- case 15:
- int u;
- cout << "enter 1 to 4";
- cin >> u ;
- switch(u)
- {
- case 1:
- temp->setHysteresis(temp->HYST_0);
- break;
- case 2:
- temp->setHysteresis(temp->HYST_1_5);
- break;
- case 3:
- temp->setHysteresis(temp->HYST_3_0);
- break;
- case 4:
- default:
- temp->setHysteresis(temp->HYST_6_0);
- break;
- }
- break;
- case 16:
- cout << "Resolution: " << temp->getResolution() << endl;
- break;
- case 17:
- int v;
- cout << "enter 1 to 4";
- cin >> v ;
- switch(v)
- {
- case 1:
- temp->setResolution(temp->RES_LOW);
- break;
- case 2:
- temp->setResolution(temp->RES_MEDIUM);
- break;
- case 3:
- temp->setResolution(temp->RES_HIGH);
- break;
- case 4:
- default:
- temp->setResolution(temp->RES_PRECISION);
- break;
- }
- break;
- case 18:
- cout << "Manufacturer ID: " << std::hex << temp->getManufacturer() << endl;
- break;
- case 19:
- cout << "Get device ID: " << std::hex << temp->getDevicedId() << endl;
- break;
- case -1:
- break;
- default:
- cout << endl << "That option is not available. Try again" << endl;
- break;
- }
-
- }while (command != -1 );
-//! [Interesting]
- return MRAA_SUCCESS;
-}
diff --git a/peripheral/libupm/examples/c++/mg811.cxx b/peripheral/libupm/examples/c++/mg811.cxx
deleted file mode 100644
index b17423c..0000000
--- a/peripheral/libupm/examples/c++/mg811.cxx
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "mg811.h"
-
-using namespace std;
-
-bool shouldRun = true;
-
-#define MG811_AREF 5.0
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
-
- // Instantiate an MG811 on analog pin A0, and digital pin D2 with an
- // analog reference voltage of MG811_AREF (5.0)
- upm::MG811 *sensor = new upm::MG811(0, 2, MG811_AREF);
-
- // Every tenth of a second, sample the sensor and output it's
- // detected CO2 concentration in parts per million (ppm)
-
- while (shouldRun)
- {
- cout << "CO2 concentration in PPM: " << sensor->ppm() << endl;
-
- usleep(100000);
- }
-
-//! [Interesting]
-
- cout << "Exiting" << endl;
-
- delete sensor;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/mhz16.cxx b/peripheral/libupm/examples/c++/mhz16.cxx
deleted file mode 100644
index 542dc5f..0000000
--- a/peripheral/libupm/examples/c++/mhz16.cxx
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "mhz16.h"
-
-using namespace std;
-
-bool shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main (int argc, char **argv)
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // Instantiate a MHZ16 serial CO2 sensor on uart 0.
- // This example was tested on the Grove CO2 sensor module.
-
- upm::MHZ16* co2 = new upm::MHZ16(0);
-
- // make sure port is initialized properly. 9600 baud is the default.
- if (!co2->setupTty(B9600))
- {
- cerr << "Failed to setup tty port parameters" << endl;
- return 1;
- }
-
- cout << "Make sure that the sensor has had at least 3 minutes to warm up"
- << endl;
- cout << "or you will not get valid results." << endl;
- cout << "The temperature reported is not the ambient temperature, " << endl;
- cout << "but rather the temperature of the sensor elements." << endl;
-
- sleep(1);
-
- while (shouldRun)
- {
- if(!co2->getData()){
- cerr << "Failed to retrieve data" << endl;
- continue;
- }
-
- cout << "CO2 concentration: " << co2->getGas() << " PPM, "
- << "Temperature (in C): " << co2->getTemperature() <<endl;
-
- sleep(2);
- }
-
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete co2;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/mic.cxx b/peripheral/libupm/examples/c++/mic.cxx
deleted file mode 100644
index 8773d71..0000000
--- a/peripheral/libupm/examples/c++/mic.cxx
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "mic.h"
-#include <signal.h>
-#include <stdlib.h>
-#include <sys/time.h>
-
-int is_running = 0;
-uint16_t buffer [128];
-upm::Microphone *sensor = NULL;
-
-void
-sig_handler(int signo)
-{
- printf("got signal\n");
- if (signo == SIGINT) {
- is_running = 1;
- }
-}
-
-//! [Interesting]
-int
-main(int argc, char **argv)
-{
- // Attach microphone to analog port A0
- sensor = new upm::Microphone(0);
- signal(SIGINT, sig_handler);
-
- thresholdContext ctx;
- ctx.averageReading = 0;
- ctx.runningAverage = 0;
- ctx.averagedOver = 2;
-
- // Infinite loop, ends when script is cancelled
- // Repeatedly, take a sample every 2 microseconds;
- // find the average of 128 samples; and
- // print a running graph of the averages
- while (!is_running) {
- int len = sensor->getSampledWindow (2, 128, buffer);
- if (len) {
- int thresh = sensor->findThreshold (&ctx, 30, buffer, len);
- sensor->printGraph(&ctx);
- if (thresh) {
- // do something ....
- }
- }
- }
-
- std::cout << "exiting application" << std::endl;
-
- delete sensor;
-
- return 0;
-}
-//! [Interesting]
diff --git a/peripheral/libupm/examples/c++/micsv89.cxx b/peripheral/libupm/examples/c++/micsv89.cxx
deleted file mode 100644
index cf1530b..0000000
--- a/peripheral/libupm/examples/c++/micsv89.cxx
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Author: Marc Graham <marc@m2ag.net>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <unistd.h>
-#include <signal.h>
-#include "micsv89.h"
-
-/*
- * An example for using the MICSV89 sensor library.
- * The MICSV89 comes in 4 variants, PWM and I2c
- * in 3.3 volts and 5 volts. This library only implements
- * the I2c version of the device.
- *
- * Device output is not valid until a warm up of 15 minutes
- * of operation.
- *
- * Additional linker flags: -lupm-micsv89
- */
-
-using namespace std;
-
-volatile int running = 1;
-
-void
-sig_handler(int signo)
-{
- if (signo == SIGINT) {
- cout << "Exiting program." << endl;
- running = 0;
- }
-}
-
-int main()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- upm::MICSV89 *sensor = new upm::MICSV89(6);
-
- while(running)
- {
- sensor->update();
- while(!sensor->valid());
- cout << "co2: " << sensor->co2equ() << endl;
- cout << "short: " << sensor->vocshort() << endl;
- cout << "tvoc: " << sensor->tvoc() << endl;
- cout << "resistor: " << sensor->resistor() << endl;
- cout << "****************************" << endl;
- sleep(5);
- }
-
- delete sensor;
-//! [Interesting]
-
- return MRAA_SUCCESS;
-}
diff --git a/peripheral/libupm/examples/c++/mlx90614.cxx b/peripheral/libupm/examples/c++/mlx90614.cxx
deleted file mode 100644
index dbd00f4..0000000
--- a/peripheral/libupm/examples/c++/mlx90614.cxx
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "mlx90614.h"
-#include <signal.h>
-
-int doWork = 0;
-upm::MLX90614 *sensor = NULL;
-
-void
-sig_handler(int signo)
-{
- printf("got signal\n");
- if (signo == SIGINT) {
- printf("exiting application\n");
- doWork = 1;
- }
-}
-
-int
-main(int argc, char **argv)
-{
- //! [Interesting]
- sensor = new upm::MLX90614(0, DEVICE_ADDR);
-
- while (!doWork) {
- std::cout << "Object Temperature (" << sensor->readObjectTempC() << ") Ambient Temperature (" << sensor->readAmbientTempC() << ")" << std::endl;
- usleep (1000000);
- }
- //! [Interesting]
-
- std::cout << "exiting application" << std::endl;
-
- delete sensor;
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/mma7455.cxx b/peripheral/libupm/examples/c++/mma7455.cxx
deleted file mode 100644
index 052919f..0000000
--- a/peripheral/libupm/examples/c++/mma7455.cxx
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "mma7455.h"
-#include <signal.h>
-#include <pthread.h>
-
-int doWork = 0;
-upm::MMA7455 *sensor = NULL;
-
-void
-sig_handler(int signo)
-{
- printf("got signal\n");
- if (signo == SIGINT) {
- printf("exiting application\n");
- doWork = 1;
- }
-}
-
-int
-main(int argc, char **argv)
-{
- //! [Interesting]
- sensor = new upm::MMA7455(0, ADDR);
-
- short x, y, z;
- while (!doWork) {
- sensor->readData(&x, &y, &z);
- std::cout << "Accelerometer X(" << x << ") Y(" << y << ") Z(" << z << ")" << std::endl;
- usleep (100000);
- }
-
- //! [Interesting]
-
- std::cout << "exiting application" << std::endl;
-
- delete sensor;
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/mma7660.cxx b/peripheral/libupm/examples/c++/mma7660.cxx
deleted file mode 100644
index c426db5..0000000
--- a/peripheral/libupm/examples/c++/mma7660.cxx
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <signal.h>
-#include <iostream>
-#include "mma7660.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main(int argc, char **argv)
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // Instantiate an MMA7660 on I2C bus 0
-
- upm::MMA7660 *accel = new upm::MMA7660(MMA7660_I2C_BUS,
- MMA7660_DEFAULT_I2C_ADDR);
-
- // place device in standby mode so we can write registers
- accel->setModeStandby();
-
- // enable 64 samples per second
- accel->setSampleRate(upm::MMA7660::AUTOSLEEP_64);
-
- // place device into active mode
- accel->setModeActive();
-
- while (shouldRun)
- {
- int x, y, z;
-
- accel->getRawValues(&x, &y, &z);
- cout << "Raw values: x = " << x
- << " y = " << y
- << " z = " << z
- << endl;
-
- float ax, ay, az;
-
- accel->getAcceleration(&ax, &ay, &az);
- cout << "Acceleration: x = " << ax
- << "g y = " << ay
- << "g z = " << az
- << "g" << endl;
-
- usleep(500000);
- }
-
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete accel;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/mpl3115a2.cxx b/peripheral/libupm/examples/c++/mpl3115a2.cxx
deleted file mode 100644
index f9499d1..0000000
--- a/peripheral/libupm/examples/c++/mpl3115a2.cxx
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Author: William Penner <william.penner@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-
-#include "mpl3115a2.h"
-
-volatile int doWork = 0;
-
-upm::MPL3115A2 *sensor = NULL;
-
-void
-sig_handler(int signo)
-{
- if (signo == SIGINT) {
- printf("\nCtrl-C received.\n");
- doWork = 1;
- }
-}
-
-int
-main(int argc, char **argv)
-{
- // Register signal handler
- signal(SIGINT, sig_handler);
-
- //! [Interesting]
- float pressure = 0.0;
- float temperature = 0.0;
- float altitude = 0.0;
- float sealevel = 0.0;
-
- sensor = new upm::MPL3115A2(0, MPL3115A2_I2C_ADDRESS);
-
- sensor->testSensor();
-
- while (!doWork) {
- temperature = sensor->getTemperature(true);
- pressure = sensor->getPressure(false);
- altitude = sensor->getAltitude();
- sealevel = sensor->getSealevelPressure();
-
- std::cout << "pressure value = " <<
- pressure <<
- ", altitude value = " <<
- altitude <<
- ", sealevel value = " <<
- sealevel <<
- ", temperature = " <<
- temperature << std::endl;
- usleep (500000);
- }
- //! [Interesting]
-
- std::cout << "exiting application" << std::endl;
-
- delete sensor;
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/mpr121.cxx b/peripheral/libupm/examples/c++/mpr121.cxx
deleted file mode 100644
index 7998965..0000000
--- a/peripheral/libupm/examples/c++/mpr121.cxx
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <signal.h>
-#include <iostream>
-#include "mpr121.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-void printButtons(upm::MPR121 *touch)
-{
- bool buttonPressed = false;
-
- cout << "Buttons Pressed: ";
- for (int i=0; i<12; i++)
- {
- if (touch->m_buttonStates & (1 << i))
- {
- cout << i << " ";
- buttonPressed = true;
- }
- }
-
- if (!buttonPressed)
- cout << "None";
-
- if (touch->m_overCurrentFault)
- cout << "Over Current Fault detected!" << endl;
-
- cout << endl;
-}
-
-int main(int argc, char **argv)
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // Instantiate an MPR121 on I2C bus 0
-
- upm::MPR121 *touch = new upm::MPR121(MPR121_I2C_BUS, MPR121_DEFAULT_I2C_ADDR);
-
- // init according to AN3944 defaults
- touch->configAN3944();
-
- while (shouldRun)
- {
- touch->readButtons();
- printButtons(touch);
- sleep(1);
- }
-
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete touch;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/mpu60x0.cxx b/peripheral/libupm/examples/c++/mpu60x0.cxx
deleted file mode 100644
index d90a017..0000000
--- a/peripheral/libupm/examples/c++/mpu60x0.cxx
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "mpu9150.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-
-int main(int argc, char **argv)
-{
- signal(SIGINT, sig_handler);
-//! [Interesting]
-
- upm::MPU60X0 *sensor = new upm::MPU60X0();
-
- sensor->init();
-
- while (shouldRun)
- {
- sensor->update();
-
- float x, y, z;
-
- sensor->getAccelerometer(&x, &y, &z);
- cout << "Accelerometer: ";
- cout << "AX: " << x << " AY: " << y << " AZ: " << z << endl;
-
- sensor->getGyroscope(&x, &y, &z);
- cout << "Gryoscope: ";
- cout << "GX: " << x << " GY: " << y << " GZ: " << z << endl;
-
- cout << "Temperature: " << sensor->getTemperature() << endl;
- cout << endl;
-
- usleep(500000);
- }
-
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete sensor;
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/mpu9150.cxx b/peripheral/libupm/examples/c++/mpu9150.cxx
deleted file mode 100644
index d6f5da5..0000000
--- a/peripheral/libupm/examples/c++/mpu9150.cxx
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "mpu9150.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-
-int main(int argc, char **argv)
-{
- signal(SIGINT, sig_handler);
-//! [Interesting]
-
- upm::MPU9150 *sensor = new upm::MPU9150();
-
- sensor->init();
-
- while (shouldRun)
- {
- sensor->update();
-
- float x, y, z;
-
- sensor->getAccelerometer(&x, &y, &z);
- cout << "Accelerometer: ";
- cout << "AX: " << x << " AY: " << y << " AZ: " << z << endl;
-
- sensor->getGyroscope(&x, &y, &z);
- cout << "Gryoscope: ";
- cout << "GX: " << x << " GY: " << y << " GZ: " << z << endl;
-
- sensor->getMagnetometer(&x, &y, &z);
- cout << "Magnetometer: ";
- cout << "MX = " << x << " MY = " << y << " MZ = " << z << endl;
-
- cout << "Temperature: " << sensor->getTemperature() << endl;
- cout << endl;
-
- usleep(500000);
- }
-
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete sensor;
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/mpu9250.cxx b/peripheral/libupm/examples/c++/mpu9250.cxx
deleted file mode 100644
index fd093f9..0000000
--- a/peripheral/libupm/examples/c++/mpu9250.cxx
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "mpu9250.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-
-int main(int argc, char **argv)
-{
- signal(SIGINT, sig_handler);
-//! [Interesting]
-
- upm::MPU9250 *sensor = new upm::MPU9250();
-
- sensor->init();
-
- while (shouldRun)
- {
- sensor->update();
-
- float x, y, z;
-
- sensor->getAccelerometer(&x, &y, &z);
- cout << "Accelerometer: ";
- cout << "AX: " << x << " AY: " << y << " AZ: " << z << endl;
-
- sensor->getGyroscope(&x, &y, &z);
- cout << "Gryoscope: ";
- cout << "GX: " << x << " GY: " << y << " GZ: " << z << endl;
-
- sensor->getMagnetometer(&x, &y, &z);
- cout << "Magnetometer: ";
- cout << "MX = " << x << " MY = " << y << " MZ = " << z << endl;
-
- cout << "Temperature: " << sensor->getTemperature() << endl;
- cout << endl;
-
- usleep(500000);
- }
-
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete sensor;
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/mq2.cxx b/peripheral/libupm/examples/c++/mq2.cxx
deleted file mode 100644
index f3bd9ca..0000000
--- a/peripheral/libupm/examples/c++/mq2.cxx
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "mq2.h"
-#include <signal.h>
-#include <stdlib.h>
-#include <sys/time.h>
-
-int is_running = 0;
-uint16_t buffer [128];
-upm::MQ2 *sensor = NULL;
-
-void
-sig_handler(int signo)
-{
- printf("got signal\n");
- if (signo == SIGINT) {
- is_running = 1;
- }
-}
-
-//! [Interesting]
-int
-main(int argc, char **argv)
-{
- // Attach gas sensor to A0
- sensor = new upm::MQ2(0);
- signal(SIGINT, sig_handler);
-
- thresholdContext ctx;
- ctx.averageReading = 0;
- ctx.runningAverage = 0;
- ctx.averagedOver = 2;
-
- // Infinite loop, ends when script is cancelled
- // Repeatedly, take a sample every 2 milliseconds;
- // find the average of 128 samples; and
- // print a running graph of the averages using a resolution of 5
- while (!is_running) {
- int len = sensor->getSampledWindow (2, 128, buffer);
- if (len) {
- int thresh = sensor->findThreshold (&ctx, 30, buffer, len);
- sensor->printGraph(&ctx, 5);
- if (thresh) {
- // do something ....
- }
- }
- }
-
- std::cout << "exiting application" << std::endl;
-
- delete sensor;
-
- return 0;
-}
-//! [Interesting]
diff --git a/peripheral/libupm/examples/c++/mq3.cxx b/peripheral/libupm/examples/c++/mq3.cxx
deleted file mode 100644
index 9fd3cce..0000000
--- a/peripheral/libupm/examples/c++/mq3.cxx
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "mq3.h"
-#include <signal.h>
-#include <stdlib.h>
-#include <sys/time.h>
-
-int is_running = 0;
-uint16_t buffer [128];
-upm::MQ3 *sensor = NULL;
-
-void
-sig_handler(int signo)
-{
- printf("got signal\n");
- if (signo == SIGINT) {
- is_running = 1;
- }
-}
-
-//! [Interesting]
-int
-main(int argc, char **argv)
-{
- // Attach gas sensor to A0
- sensor = new upm::MQ3(0);
- signal(SIGINT, sig_handler);
-
- thresholdContext ctx;
- ctx.averageReading = 0;
- ctx.runningAverage = 0;
- ctx.averagedOver = 2;
-
- // Infinite loop, ends when script is cancelled
- // Repeatedly, take a sample every 2 milliseconds;
- // find the average of 128 samples; and
- // print a running graph of the averages using a resolution of 5
- while (!is_running) {
- int len = sensor->getSampledWindow (2, 128, buffer);
- if (len) {
- int thresh = sensor->findThreshold (&ctx, 30, buffer, len);
- sensor->printGraph(&ctx, 5);
- if (thresh) {
- // do something ....
- }
- }
- }
-
- std::cout << "exiting application" << std::endl;
-
- delete sensor;
-
- return 0;
-}
-//! [Interesting]
diff --git a/peripheral/libupm/examples/c++/mq303a.cxx b/peripheral/libupm/examples/c++/mq303a.cxx
deleted file mode 100644
index 4557de0..0000000
--- a/peripheral/libupm/examples/c++/mq303a.cxx
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "mq303a.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main ()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // Instantiate an mq303a sensor on analog pin A0
-
- // This device uses a heater powered from an analog I/O pin.
- // If using A0 as the data pin, then you need to use A1, as the heater
- // pin (if using a grove mq303a). For A1, we can use the D15 gpio,
- // setup as an output, and drive it low to power the heater.
-
- upm::MQ303A *mq303a = new upm::MQ303A(0, 15);
-
- cout << "Enabling heater and waiting 2 minutes for warmup." << endl;
- mq303a->heaterEnable(true);
- sleep(120);
-
- cout << "This sensor may need to warm until the value drops below about 450."
- << endl;
-
- // Print the detected alcohol value every second
- while (shouldRun)
- {
- int val = mq303a->value();
-
- cout << "Alcohol detected (higher means stronger alcohol): "
- << val << endl;
-
- sleep(1);
- }
-//! [Interesting]
-
- cout << "Exiting" << endl;
- mq303a->heaterEnable(false);
-
- delete mq303a;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/mq4.cxx b/peripheral/libupm/examples/c++/mq4.cxx
deleted file mode 100644
index 686970b..0000000
--- a/peripheral/libupm/examples/c++/mq4.cxx
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "mq4.h"
-#include <signal.h>
-#include <stdlib.h>
-#include <sys/time.h>
-
-bool shouldRun = true;
-
-using namespace std;
-
-void
-sig_handler(int signo)
-{
- if (signo == SIGINT)
- {
- shouldRun = false;
- }
-}
-
-//! [Interesting]
-int main(int argc, char **argv)
-{
- // Attach gas sensor to Analog A0
- upm::MQ4 *sensor = new upm::MQ4(0);
- signal(SIGINT, sig_handler);
-
- uint16_t buffer [128];
-
- thresholdContext ctx;
- ctx.averageReading = 0;
- ctx.runningAverage = 0;
- ctx.averagedOver = 2;
-
- // Infinite loop, ends when script is cancelled
- // Repeatedly, take a sample every 2 microseconds;
- // find the average of 128 samples; and
- // print a running graph of asteriskss as averages
- while (shouldRun)
- {
- int len = sensor->getSampledWindow (2, 128, buffer);
- if (len) {
- int thresh = sensor->findThreshold (&ctx, 30, buffer, len);
- sensor->printGraph(&ctx, 5);
- if (thresh) {
- // do something ....
- }
- }
- }
-
- cout << "Exiting" << endl;
-
- delete sensor;
-
- return 0;
-}
-//! [Interesting]
diff --git a/peripheral/libupm/examples/c++/mq5.cxx b/peripheral/libupm/examples/c++/mq5.cxx
deleted file mode 100644
index 541bb26..0000000
--- a/peripheral/libupm/examples/c++/mq5.cxx
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "mq5.h"
-#include <signal.h>
-#include <stdlib.h>
-#include <sys/time.h>
-
-int is_running = 0;
-uint16_t buffer [128];
-upm::MQ5 *sensor = NULL;
-
-void
-sig_handler(int signo)
-{
- printf("got signal\n");
- if (signo == SIGINT) {
- is_running = 1;
- }
-}
-
-//! [Interesting]
-int
-main(int argc, char **argv)
-{
- sensor = new upm::MQ5(0);
- signal(SIGINT, sig_handler);
-
- thresholdContext ctx;
- ctx.averageReading = 0;
- ctx.runningAverage = 0;
- ctx.averagedOver = 2;
-
- while (!is_running) {
- int len = sensor->getSampledWindow (2, 128, buffer);
- if (len) {
- int thresh = sensor->findThreshold (&ctx, 30, buffer, len);
- sensor->printGraph(&ctx, 7);
- if (thresh) {
- // do something ....
- }
- }
- }
-
- std::cout << "exiting application" << std::endl;
-
- delete sensor;
-
- return 0;
-}
-//! [Interesting]
diff --git a/peripheral/libupm/examples/c++/mq6.cxx b/peripheral/libupm/examples/c++/mq6.cxx
deleted file mode 100644
index 0a73af1..0000000
--- a/peripheral/libupm/examples/c++/mq6.cxx
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "mq6.h"
-#include <signal.h>
-#include <stdlib.h>
-#include <sys/time.h>
-
-bool shouldRun = true;
-
-using namespace std;
-
-void
-sig_handler(int signo)
-{
- if (signo == SIGINT)
- {
- shouldRun = false;
- }
-}
-
-//! [Interesting]
-int main(int argc, char **argv)
-{
- // Attach gas sensor to Analog A0
- upm::MQ6 *sensor = new upm::MQ6(0);
- signal(SIGINT, sig_handler);
-
- uint16_t buffer [128];
-
- thresholdContext ctx;
- ctx.averageReading = 0;
- ctx.runningAverage = 0;
- ctx.averagedOver = 2;
-
- // Infinite loop, ends when script is cancelled
- // Repeatedly, take a sample every 2 microseconds;
- // find the average of 128 samples; and
- // print a running graph of asteriskss as averages
- while (shouldRun)
- {
- int len = sensor->getSampledWindow (2, 128, buffer);
- if (len) {
- int thresh = sensor->findThreshold (&ctx, 30, buffer, len);
- sensor->printGraph(&ctx, 5);
- if (thresh) {
- // do something ....
- }
- }
- }
-
- cout << "Exiting" << endl;
-
- delete sensor;
-
- return 0;
-}
-//! [Interesting]
diff --git a/peripheral/libupm/examples/c++/mq7.cxx b/peripheral/libupm/examples/c++/mq7.cxx
deleted file mode 100644
index a6279f1..0000000
--- a/peripheral/libupm/examples/c++/mq7.cxx
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "mq7.h"
-#include <signal.h>
-#include <stdlib.h>
-#include <sys/time.h>
-
-bool shouldRun = true;
-
-using namespace std;
-
-void
-sig_handler(int signo)
-{
- if (signo == SIGINT)
- {
- shouldRun = false;
- }
-}
-
-//! [Interesting]
-int main(int argc, char **argv)
-{
- // Attach gas sensor to Analog A0
- upm::MQ7 *sensor = new upm::MQ7(0);
- signal(SIGINT, sig_handler);
-
- uint16_t buffer [128];
-
- thresholdContext ctx;
- ctx.averageReading = 0;
- ctx.runningAverage = 0;
- ctx.averagedOver = 2;
-
- // Infinite loop, ends when script is cancelled
- // Repeatedly, take a sample every 2 microseconds;
- // find the average of 128 samples; and
- // print a running graph of asteriskss as averages
- while (shouldRun)
- {
- int len = sensor->getSampledWindow (2, 128, buffer);
- if (len) {
- int thresh = sensor->findThreshold (&ctx, 30, buffer, len);
- sensor->printGraph(&ctx, 5);
- if (thresh) {
- // do something ....
- }
- }
- }
-
- cout << "Exiting" << endl;
-
- delete sensor;
-
- return 0;
-}
-//! [Interesting]
diff --git a/peripheral/libupm/examples/c++/mq8.cxx b/peripheral/libupm/examples/c++/mq8.cxx
deleted file mode 100644
index eae583f..0000000
--- a/peripheral/libupm/examples/c++/mq8.cxx
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "mq8.h"
-#include <signal.h>
-#include <stdlib.h>
-#include <sys/time.h>
-
-bool shouldRun = true;
-
-using namespace std;
-
-void
-sig_handler(int signo)
-{
- if (signo == SIGINT)
- {
- shouldRun = false;
- }
-}
-
-//! [Interesting]
-int main(int argc, char **argv)
-{
- // Attach gas sensor to Analog A0
- upm::MQ8 *sensor = new upm::MQ8(0);
- signal(SIGINT, sig_handler);
-
- uint16_t buffer [128];
-
- thresholdContext ctx;
- ctx.averageReading = 0;
- ctx.runningAverage = 0;
- ctx.averagedOver = 2;
-
- // Infinite loop, ends when script is cancelled
- // Repeatedly, take a sample every 2 microseconds;
- // find the average of 128 samples; and
- // print a running graph of asteriskss as averages
- while (shouldRun)
- {
- int len = sensor->getSampledWindow (2, 128, buffer);
- if (len) {
- int thresh = sensor->findThreshold (&ctx, 30, buffer, len);
- sensor->printGraph(&ctx, 5);
- if (thresh) {
- // do something ....
- }
- }
- }
-
- cout << "Exiting" << endl;
-
- delete sensor;
-
- return 0;
-}
-//! [Interesting]
diff --git a/peripheral/libupm/examples/c++/mq9.cxx b/peripheral/libupm/examples/c++/mq9.cxx
deleted file mode 100644
index b62dad3..0000000
--- a/peripheral/libupm/examples/c++/mq9.cxx
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "mq9.h"
-#include <signal.h>
-#include <stdlib.h>
-#include <sys/time.h>
-
-int is_running = 0;
-uint16_t buffer [128];
-upm::MQ9 *sensor = NULL;
-
-void
-sig_handler(int signo)
-{
- printf("got signal\n");
- if (signo == SIGINT) {
- is_running = 1;
- }
-}
-
-//! [Interesting]
-int
-main(int argc, char **argv)
-{
- sensor = new upm::MQ9(0);
- signal(SIGINT, sig_handler);
-
- thresholdContext ctx;
- ctx.averageReading = 0;
- ctx.runningAverage = 0;
- ctx.averagedOver = 2;
-
- while (!is_running) {
- int len = sensor->getSampledWindow (2, 128, buffer);
- if (len) {
- int thresh = sensor->findThreshold (&ctx, 30, buffer, len);
- sensor->printGraph(&ctx, 5);
- if (thresh) {
- // do something ....
- }
- }
- }
-
- std::cout << "exiting application" << std::endl;
-
- delete sensor;
-
- return 0;
-}
-//! [Interesting]
diff --git a/peripheral/libupm/examples/c++/nlgpio16.cxx b/peripheral/libupm/examples/c++/nlgpio16.cxx
deleted file mode 100644
index 44c901e..0000000
--- a/peripheral/libupm/examples/c++/nlgpio16.cxx
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include <stdio.h>
-#include "nlgpio16.h"
-
-using namespace std;
-using namespace upm;
-
-int main(int argc, char **argv)
-{
- // Instantiate a NLGPIO16 Module on the default UART (/dev/ttyACM0)
- upm::NLGPIO16* sensor = new upm::NLGPIO16();
-
- // get the Version
- cout << "Device Version: " << sensor->getVersion() << endl;
- // read the gpio at pin 3
- cout << "GPIO 3 Value: " << sensor->gpioRead(3) << endl;
- // read the analog voltage at pin 5
- cout << "Analog 5 Voltage: " << sensor->analogReadVolts(5) << endl;
- // set the gpio at pin 14 to HIGH
- sensor->gpioSet(14);
-
- delete sensor;
- return 0;
-}
-
-//! [Interesting]
diff --git a/peripheral/libupm/examples/c++/nrf24l01-broadcast.cxx b/peripheral/libupm/examples/c++/nrf24l01-broadcast.cxx
deleted file mode 100644
index f4a1d21..0000000
--- a/peripheral/libupm/examples/c++/nrf24l01-broadcast.cxx
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <string.h>
-#include <unistd.h>
-#include <iostream>
-#include "nrf24l01.h"
-#include <signal.h>
-#include <stdio.h>
-#include <vector>
-
-int running = 0;
-upm::NRF24L01 *sensor = NULL;
-
-void
-sig_handler(int signo)
-{
- printf("got signal\n");
- if (signo == SIGINT) {
- printf("exiting application\n");
- running = 1;
- }
-}
-
-void nrf_handler () {
-}
-
-int
-main(int argc, char **argv)
-{
- //! [Interesting]
-
- sensor = new upm::NRF24L01(7, 8);
- sensor->setBeaconingMode ();
-
- std::vector<std::string> msgs;
-
- msgs.push_back ("Hello World 1!!!");
- msgs.push_back ("Hello World 2!!!");
- msgs.push_back ("Hello World 3!!!");
- msgs.push_back ("Hello World 4!!!");
- msgs.push_back ("Hello World 5!!!");
-
- signal(SIGINT, sig_handler);
-
- while (!running) {
- for (std::vector<std::string>::iterator item = msgs.begin(); item != msgs.end(); ++item) {
- std::cout << "BROADCASTING " << (*item).c_str() << std::endl;
-
- for (int i = 0; i < 3; i++) {
- sensor->sendBeaconingMsg ((uint8_t*) (*item).c_str());
- usleep (1000000);
- }
- }
- }
-
- std::cout << "exiting application" << std::endl;
-
- msgs.clear();
- delete sensor;
-
- //! [Interesting]
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/nrf24l01-receiver.cxx b/peripheral/libupm/examples/c++/nrf24l01-receiver.cxx
deleted file mode 100644
index 344cb0c..0000000
--- a/peripheral/libupm/examples/c++/nrf24l01-receiver.cxx
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <string.h>
-#include <unistd.h>
-#include <iostream>
-#include "nrf24l01.h"
-#include <signal.h>
-
-int running = 0;
-upm::NRF24L01 *comm = NULL;
-
-uint8_t local_address[5] = {0x01, 0x01, 0x01, 0x01, 0x01};
-uint8_t broadcast_address[5] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
-
-void
-sig_handler(int signo)
-{
- printf("got signal\n");
- if (signo == SIGINT) {
- printf("exiting application\n");
- running = 1;
- }
-}
-
-//! [Interesting]
-void nrf_handler () {
- std::cout << "Reciever :: " << *((uint32_t *)&(comm->m_rxBuffer[0])) << std::endl;
-}
-
-int
-main(int argc, char **argv)
-{
-
- comm = new upm::NRF24L01(7, 8);
- comm->setSourceAddress ((uint8_t *) local_address);
- comm->setDestinationAddress ((uint8_t *) broadcast_address);
- comm->setPayload (MAX_BUFFER);
- comm->configure ();
- comm->setSpeedRate (upm::NRF_250KBPS);
- comm->setChannel (99);
- comm->setDataReceivedHandler (nrf_handler);
-
- signal(SIGINT, sig_handler);
-
- while (!running) {
- comm->pollListener ();
- }
-
- std::cout << "exiting application" << std::endl;
-
- delete comm;
- return 0;
-}
-//! [Interesting]
diff --git a/peripheral/libupm/examples/c++/nrf24l01-transmitter.cxx b/peripheral/libupm/examples/c++/nrf24l01-transmitter.cxx
deleted file mode 100644
index 5d9f7cc..0000000
--- a/peripheral/libupm/examples/c++/nrf24l01-transmitter.cxx
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <string.h>
-#include <unistd.h>
-#include <iostream>
-#include "nrf24l01.h"
-#include <signal.h>
-
-int running = 0;
-upm::NRF24L01 *comm = NULL;
-
-uint8_t destAddress[5] = {0x01, 0x01, 0x01, 0x01, 0x01};
-uint8_t srcAddress[5] = {0x01, 0x01, 0x01, 0x01, 0x02};
-
-void
-sig_handler(int signo)
-{
- printf("got signal\n");
- if (signo == SIGINT) {
- printf("exiting application\n");
- running = 1;
- }
-}
-
-void nrf_handler () {
-}
-
-int
-main(int argc, char **argv)
-{
-//! [Interesting]
- uint32_t dummyData = 0;
- comm = new upm::NRF24L01(7, 8);
- comm->setSourceAddress ((uint8_t *) srcAddress);
- comm->setDestinationAddress ((uint8_t *) destAddress);
- comm->setPayload (MAX_BUFFER);
- comm->setChannel (99);
- comm->configure ();
- comm->setDataReceivedHandler (nrf_handler);
-
- signal(SIGINT, sig_handler);
-
- while (!running) {
- memcpy (comm->m_txBuffer, &dummyData, sizeof (dummyData));
- comm->send ();
- std::cout << "devi2 :: sending data ...." << dummyData << std::endl;
- usleep (3000000);
- dummyData += 3000;
- }
-
- std::cout << "exiting application" << std::endl;
-
- delete comm;
-//! [Interesting]
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/nrf8001-broadcast.cxx b/peripheral/libupm/examples/c++/nrf8001-broadcast.cxx
deleted file mode 100644
index 534e32b..0000000
--- a/peripheral/libupm/examples/c++/nrf8001-broadcast.cxx
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "nrf8001.h"
-#include "nrf8001-broadcast.h"
-#include <lib_aci.h>
-#include <aci_setup.h>
-#include <signal.h>
-
-#ifdef SERVICES_PIPE_TYPE_MAPPING_CONTENT
- static services_pipe_type_mapping_t
- services_pipe_type_mapping[NUMBER_OF_PIPES] = SERVICES_PIPE_TYPE_MAPPING_CONTENT;
-#else
- #define NUMBER_OF_PIPES 0
- static services_pipe_type_mapping_t * services_pipe_type_mapping = NULL;
-#endif
-
-/**
- * Store the setup for the nRF8001 in the flash of the AVR to save on RAM
- */
-static hal_aci_data_t setup_msgs[NB_SETUP_MESSAGES] = SETUP_MESSAGES_CONTENT;
-
-/**
- * aci_struct that will contain
- * total initial credits
- * current credit
- * current state of the aci (setup/standby/active/sleep)
- * open remote pipe pending
- * close remote pipe pending
- * Current pipe available bitmap
- * Current pipe closed bitmap
- * Current connection interval, slave latency and link supervision timeout
- * Current State of the the GATT client (Service Discovery)
- * Status of the bond (R) Peer address
- */
-static struct aci_state_t aci_state;
-
-/**
- * Temporary buffers for sending ACI commands
- */
-static hal_aci_evt_t aci_data;
-
-void
-sig_handler(int signo)
-{
- printf("got signal\n");
- if (signo == SIGINT) {
- printf("exiting application\n");
- }
-}
-
-void
-init_aci_setup () {
- /**
- * Point ACI data structures to the the setup data that the nRFgo studio generated for the nRF8001
- */
- if (NULL != services_pipe_type_mapping) {
- aci_state.aci_setup_info.services_pipe_type_mapping = &services_pipe_type_mapping[0];
- } else {
- aci_state.aci_setup_info.services_pipe_type_mapping = NULL;
- }
-
- aci_state.aci_setup_info.number_of_pipes = NUMBER_OF_PIPES;
- aci_state.aci_setup_info.setup_msgs = setup_msgs;
- aci_state.aci_setup_info.num_setup_msgs = NB_SETUP_MESSAGES;
-}
-
-int
-main(int argc, char **argv)
-{
- //! [Interesting]
-
- init_aci_setup ();
- init_local_interfaces (&aci_state, 10, 8, 4);
-
- while (1) {
- static bool setup_required = false;
- if (lib_aci_event_get (&aci_state, &aci_data)) {
- aci_evt_t * aci_evt;
- aci_evt = &aci_data.evt;
-
- switch(aci_evt->evt_opcode) {
- /**
- As soon as you reset the nRF8001 you will get an ACI Device Started Event
- */
- case ACI_EVT_DEVICE_STARTED: {
- aci_state.data_credit_available = aci_evt->params.device_started.credit_available;
- switch(aci_evt->params.device_started.device_mode) {
- case ACI_DEVICE_SETUP:
- /**
- When the device is in the setup mode
- */
- printf ("Evt Device Started: Setup\n");
- setup_required = true;
- break;
-
- case ACI_DEVICE_STANDBY:
- printf ("Evt Device Started: Standby\n");
- lib_aci_broadcast(10/* in seconds */, 0x0100 /* advertising interval 100ms */);
- printf ("Broadcasting started\n");
- break;
- }
- }
- break; //ACI Device Started Event
-
- case ACI_EVT_CMD_RSP:
- if (ACI_STATUS_SUCCESS != aci_evt->params.cmd_rsp.cmd_status) {
- printf ("ACI_EVT_CMD_RSP\n");
- while (1);
- }
- break;
-
- case ACI_EVT_CONNECTED:
- printf ("ACI_EVT_CONNECTED\n");
- break;
-
- case ACI_EVT_PIPE_STATUS:
- printf ("ACI_EVT_PIPE_STATUS\n");
- break;
-
- case ACI_EVT_DISCONNECTED:
- if (ACI_STATUS_ERROR_ADVT_TIMEOUT == aci_evt->params.disconnected.aci_status) {
- printf ("Broadcasting timed out\n");
- } else {
- printf ("Evt Disconnected. Link Loss\n");
- }
- break;
-
- case ACI_EVT_DATA_RECEIVED:
- printf ("ACI_EVT_DATA_RECEIVED\n");
- break;
-
- case ACI_EVT_HW_ERROR:
- printf ("ACI_EVT_HW_ERROR\n");
- break;
- }
- }
-
- if (setup_required) {
- if (SETUP_SUCCESS == do_aci_setup(&aci_state)) {
- setup_required = false;
- }
- }
- usleep (100);
- }
-
- close_local_interfaces (&aci_state);
-
- //! [Interesting]
-
- std::cout << "exiting application" << std::endl;
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/nrf8001-broadcast.h b/peripheral/libupm/examples/c++/nrf8001-broadcast.h
deleted file mode 100644
index b6f8cb5..0000000
--- a/peripheral/libupm/examples/c++/nrf8001-broadcast.h
+++ /dev/null
@@ -1,93 +0,0 @@
-#include "hal_platform.h"
-#include "aci.h"
-
-#pragma once
-
-#define PIPE_GAP_DEVICE_NAME_SET 1
-
-#define NUMBER_OF_PIPES 1
-
-#define SERVICES_PIPE_TYPE_MAPPING_CONTENT {\
- {ACI_STORE_LOCAL, ACI_SET}, \
-}
-
-#define GAP_PPCP_MAX_CONN_INT 0xffff /**< Maximum connection interval as a multiple of 1.25 msec , 0xFFFF means no specific value requested */
-#define GAP_PPCP_MIN_CONN_INT 0xffff /**< Minimum connection interval as a multiple of 1.25 msec , 0xFFFF means no specific maximum*/
-#define GAP_PPCP_SLAVE_LATENCY 0
-#define GAP_PPCP_CONN_TIMEOUT 0xffff /** Connection Supervision timeout multiplier as a multiple of 10msec, 0xFFFF means no specific value requested */
-
-#define NB_SETUP_MESSAGES 13
-#define SETUP_MESSAGES_CONTENT {\
- {0x00,\
- {\
- 0x07,0x06,0x00,0x00,0x03,0x02,0x41,0xd7,\
- },\
- },\
- {0x00,\
- {\
- 0x1f,0x06,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x01,0x01,0x00,0x00,0x06,0x00,0x01,\
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
- },\
- },\
- {0x00,\
- {\
- 0x1f,0x06,0x10,0x1c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x90,0x00,0x64,\
- },\
- },\
- {0x00,\
- {\
- 0x1f,0x06,0x10,0x38,0x02,0xff,0x02,0x58,0x00,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
- 0x00,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
- },\
- },\
- {0x00,\
- {\
- 0x05,0x06,0x10,0x54,0x00,0x00,\
- },\
- },\
- {0x00,\
- {\
- 0x1f,0x06,0x20,0x00,0x04,0x04,0x02,0x02,0x00,0x01,0x28,0x00,0x01,0x00,0x18,0x04,0x04,0x05,0x05,0x00,\
- 0x02,0x28,0x03,0x01,0x0e,0x03,0x00,0x00,0x2a,0x04,0x14,0x0b,\
- },\
- },\
- {0x00,\
- {\
- 0x1f,0x06,0x20,0x1c,0x05,0x00,0x03,0x2a,0x00,0x01,0x62,0x63,0x61,0x73,0x74,0x63,0x73,0x65,0x6d,0x69,\
- 0x2e,0x04,0x04,0x05,0x05,0x00,0x04,0x28,0x03,0x01,0x02,0x05,\
- },\
- },\
- {0x00,\
- {\
- 0x1f,0x06,0x20,0x38,0x00,0x01,0x2a,0x06,0x04,0x03,0x02,0x00,0x05,0x2a,0x01,0x01,0x00,0x00,0x04,0x04,\
- 0x05,0x05,0x00,0x06,0x28,0x03,0x01,0x02,0x07,0x00,0x04,0x2a,\
- },\
- },\
- {0x00,\
- {\
- 0x1f,0x06,0x20,0x54,0x06,0x04,0x09,0x08,0x00,0x07,0x2a,0x04,0x01,0xff,0xff,0xff,0xff,0x00,0x00,0xff,\
- 0xff,0x04,0x04,0x02,0x02,0x00,0x08,0x28,0x00,0x01,0x01,0x18,\
- },\
- },\
- {0x00,\
- {\
- 0x04,0x06,0x20,0x70,0x00,\
- },\
- },\
- {0x00,\
- {\
- 0x0d,0x06,0x40,0x00,0x2a,0x00,0x01,0x00,0x80,0x04,0x00,0x03,0x00,0x00,\
- },\
- },\
- {0x00,\
- {\
- 0x06,0x06,0x60,0x00,0x00,0x00,0x00,\
- },\
- },\
- {0x00,\
- {\
- 0x06,0x06,0xf0,0x00,0x03,0x4c,0xf2,\
- },\
- },\
-}
diff --git a/peripheral/libupm/examples/c++/nrf8001-helloworld.cxx b/peripheral/libupm/examples/c++/nrf8001-helloworld.cxx
deleted file mode 100644
index 5866a0f..0000000
--- a/peripheral/libupm/examples/c++/nrf8001-helloworld.cxx
+++ /dev/null
@@ -1,362 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "nrf8001.h"
-#include "nrf8001-helloworld.h"
-#include <lib_aci.h>
-#include <aci_setup.h>
-#include <signal.h>
-#include "uart_over_ble.h"
-
-/*
- * You can use the nRF UART app in the Apple iOS app store and Google Play for Android 4.3 for Samsung Galaxy S4
- * with this helloworld application
- */
-
-#ifdef SERVICES_PIPE_TYPE_MAPPING_CONTENT
- static services_pipe_type_mapping_t
- services_pipe_type_mapping[NUMBER_OF_PIPES] = SERVICES_PIPE_TYPE_MAPPING_CONTENT;
-#else
- #define NUMBER_OF_PIPES 0
- static services_pipe_type_mapping_t * services_pipe_type_mapping = NULL;
-#endif
-
-/**
- * Store the setup for the nRF8001 in the flash of the AVR to save on RAM
- */
-static hal_aci_data_t setup_msgs[NB_SETUP_MESSAGES] = SETUP_MESSAGES_CONTENT;
-
-/**
- * aci_struct that will contain
- * total initial credits
- * current credit
- * current state of the aci (setup/standby/active/sleep)
- * open remote pipe pending
- * close remote pipe pending
- * Current pipe available bitmap
- * Current pipe closed bitmap
- * Current connection interval, slave latency and link supervision timeout
- * Current State of the the GATT client (Service Discovery)
- * Status of the bond (R) Peer address
- */
-static struct aci_state_t aci_state;
-
-/**
- * Temporary buffers for sending ACI commands
- */
-static hal_aci_evt_t aci_data;
-
-/*
-Timing change state variable
-*/
-static bool timing_change_done = false;
-
-/*
-Used to test the UART TX characteristic notification
-*/
-static uart_over_ble_t uart_over_ble;
-static uint8_t uart_buffer[20];
-static uint8_t uart_buffer_len = 0;
-static uint8_t dummychar = 0;
-
-void
-sig_handler(int signo)
-{
- printf("got signal\n");
- if (signo == SIGINT) {
- printf("exiting application\n");
- }
-}
-
-void
-init_aci_setup () {
- /**
- * Point ACI data structures to the the setup data that the nRFgo studio generated for the nRF8001
- */
- if (NULL != services_pipe_type_mapping) {
- aci_state.aci_setup_info.services_pipe_type_mapping = &services_pipe_type_mapping[0];
- } else {
- aci_state.aci_setup_info.services_pipe_type_mapping = NULL;
- }
-
- aci_state.aci_setup_info.number_of_pipes = NUMBER_OF_PIPES;
- aci_state.aci_setup_info.setup_msgs = setup_msgs;
- aci_state.aci_setup_info.num_setup_msgs = NB_SETUP_MESSAGES;
-}
-
-void
-uart_over_ble_init (void) {
- uart_over_ble.uart_rts_local = true;
-}
-
-bool
-uart_tx (uint8_t *buffer, uint8_t buffer_len) {
- bool status = false;
-
- if (lib_aci_is_pipe_available(&aci_state, PIPE_UART_OVER_BTLE_UART_TX_TX) &&
- (aci_state.data_credit_available >= 1)) {
- status = lib_aci_send_data(PIPE_UART_OVER_BTLE_UART_TX_TX, buffer, buffer_len);
- if (status) {
- aci_state.data_credit_available--;
- }
- }
-
- return status;
-}
-
-bool
-uart_process_control_point_rx(uint8_t *byte, uint8_t length) {
- bool status = false;
- aci_ll_conn_params_t *conn_params;
-
- if (lib_aci_is_pipe_available(&aci_state, PIPE_UART_OVER_BTLE_UART_CONTROL_POINT_TX) ) {
- switch (*byte) {
- /*
- Queues a ACI Disconnect to the nRF8001 when this packet is received.
- May cause some of the UART packets being sent to be dropped
- */
- case UART_OVER_BLE_DISCONNECT:
- /*
- Parameters:
- None
- */
- lib_aci_disconnect(&aci_state, ACI_REASON_TERMINATE);
- status = true;
- break;
-
- /*
- Queues an ACI Change Timing to the nRF8001
- */
- case UART_OVER_BLE_LINK_TIMING_REQ:
- /*
- Parameters:
- Connection interval min: 2 bytes
- Connection interval max: 2 bytes
- Slave latency: 2 bytes
- Timeout: 2 bytes
- Same format as Peripheral Preferred Connection Parameters (See nRFgo studio -> nRF8001 Configuration -> GAP Settings
- Refer to the ACI Change Timing Request in the nRF8001 Product Specifications
- */
- conn_params = (aci_ll_conn_params_t *)(byte+1);
- lib_aci_change_timing( conn_params->min_conn_interval,
- conn_params->max_conn_interval,
- conn_params->slave_latency,
- conn_params->timeout_mult);
- status = true;
- break;
-
- /*
- Clears the RTS of the UART over BLE
- */
- case UART_OVER_BLE_TRANSMIT_STOP:
- /*
- Parameters:
- None
- */
- uart_over_ble.uart_rts_local = false;
- status = true;
- break;
-
-
- /*
- Set the RTS of the UART over BLE
- */
- case UART_OVER_BLE_TRANSMIT_OK:
- /*
- Parameters:
- None
- */
- uart_over_ble.uart_rts_local = true;
- status = true;
- break;
- }
- }
-
- return status;
-}
-
-int
-main(int argc, char **argv)
-{
- //! [Interesting]
-
- init_aci_setup ();
- init_local_interfaces (&aci_state, 10, 8, 4);
-
- while (1) {
- static bool setup_required = false;
-
- // We enter the if statement only when there is a ACI event available to be processed
- if (lib_aci_event_get(&aci_state, &aci_data)) {
- aci_evt_t * aci_evt;
- aci_evt = &aci_data.evt;
- switch(aci_evt->evt_opcode) {
- /**
- As soon as you reset the nRF8001 you will get an ACI Device Started Event
- */
- case ACI_EVT_DEVICE_STARTED: {
- aci_state.data_credit_total = aci_evt->params.device_started.credit_available;
- switch(aci_evt->params.device_started.device_mode) {
- case ACI_DEVICE_SETUP:
- /**
- When the device is in the setup mode
- */
- printf ("Evt Device Started: Setup \n");
- setup_required = true;
- break;
-
- case ACI_DEVICE_STANDBY:
- printf ("Evt Device Started: Standby \n");
- // Looking for an iPhone by sending radio advertisements
- // When an iPhone connects to us we will get an ACI_EVT_CONNECTED event from the nRF8001
- if (aci_evt->params.device_started.hw_error) {
- usleep (20000); //Handle the HW error event correctly.
- } else {
- lib_aci_connect(0/* in seconds : 0 means forever */, 0x0050 /* advertising interval 50ms*/);
- printf ("Advertising started \n");
- }
- break;
- }
- }
- break; // ACI Device Started Event
-
- case ACI_EVT_CMD_RSP:
- //If an ACI command response event comes with an error -> stop
- if (ACI_STATUS_SUCCESS != aci_evt->params.cmd_rsp.cmd_status) {
- //ACI ReadDynamicData and ACI WriteDynamicData will have status codes of
- //TRANSACTION_CONTINUE and TRANSACTION_COMPLETE
- //all other ACI commands will have status code of ACI_STATUS_SCUCCESS for a successful command
- printf ("ACI_EVT_CMD_RSP \n");
- }
- if (ACI_CMD_GET_DEVICE_VERSION == aci_evt->params.cmd_rsp.cmd_opcode) {
- //Store the version and configuration information of the nRF8001 in the Hardware Revision String Characteristic
- lib_aci_set_local_data(&aci_state, PIPE_DEVICE_INFORMATION_HARDWARE_REVISION_STRING_SET,
- (uint8_t *)&(aci_evt->params.cmd_rsp.params.get_device_version), sizeof(aci_evt_cmd_rsp_params_get_device_version_t));
- }
- break;
-
- case ACI_EVT_CONNECTED:
- printf ("ACI_EVT_CONNECTED");
- uart_over_ble_init ();
- timing_change_done = false;
- aci_state.data_credit_available = aci_state.data_credit_total;
-
- /*
- Get the device version of the nRF8001 and store it in the Hardware Revision String
- */
- lib_aci_device_version();
- break;
-
- case ACI_EVT_PIPE_STATUS:
- printf ("ACI_EVT_PIPE_STATUS \n");
- if (lib_aci_is_pipe_available(&aci_state, PIPE_UART_OVER_BTLE_UART_TX_TX) && (false == timing_change_done)) {
- lib_aci_change_timing_GAP_PPCP(); // change the timing on the link as specified in the nRFgo studio -> nRF8001 conf. -> GAP.
- // Used to increase or decrease bandwidth
- timing_change_done = true;
-
- char hello[]="Hello World, works";
- uart_tx((uint8_t *)&hello[0], strlen(hello));
- }
- break;
-
- case ACI_EVT_TIMING:
- printf ("Evt link connection interval changed \n");
- lib_aci_set_local_data(&aci_state,
- PIPE_UART_OVER_BTLE_UART_LINK_TIMING_CURRENT_SET,
- (uint8_t *)&(aci_evt->params.timing.conn_rf_interval), /* Byte aligned */
- PIPE_UART_OVER_BTLE_UART_LINK_TIMING_CURRENT_SET_MAX_SIZE);
- break;
-
- case ACI_EVT_DISCONNECTED:
- printf ("ACI_EVT_DISCONNECTED \n");
- lib_aci_connect(0/* in seconds : 0 means forever */, 0x0050 /* advertising interval 50ms*/);
- printf ("Advertising started \n");
- break;
-
- case ACI_EVT_DATA_RECEIVED:
- if (PIPE_UART_OVER_BTLE_UART_RX_RX == aci_evt->params.data_received.rx_data.pipe_number) {
- for(int i=0; i<aci_evt->len - 2; i++) {
- uart_buffer[i] = aci_evt->params.data_received.rx_data.aci_data[i];
- }
-
- uart_buffer_len = aci_evt->len - 2;
- if (lib_aci_is_pipe_available(&aci_state, PIPE_UART_OVER_BTLE_UART_TX_TX)) {
- }
- }
-
- if (PIPE_UART_OVER_BTLE_UART_CONTROL_POINT_RX == aci_evt->params.data_received.rx_data.pipe_number) {
- //Subtract for Opcode and Pipe number
- uart_process_control_point_rx(&aci_evt->params.data_received.rx_data.aci_data[0], aci_evt->len - 2);
- }
-
- printf ("Incomming data - %s\n", uart_buffer);
- break;
-
- case ACI_EVT_DATA_CREDIT:
- printf ("ACI_EVT_DATA_CREDIT \n");
- aci_state.data_credit_available = aci_state.data_credit_available + aci_evt->params.data_credit.credit;
- break;
-
- case ACI_EVT_PIPE_ERROR:
- printf ("ACI_EVT_PIPE_ERROR \n");
- //Increment the credit available as the data packet was not sent.
- //The pipe error also represents the Attribute protocol Error Response sent from the peer and that should not be counted
- //for the credit.
- if (ACI_STATUS_ERROR_PEER_ATT_ERROR != aci_evt->params.pipe_error.error_code) {
- aci_state.data_credit_available++;
- }
- break;
-
- case ACI_EVT_HW_ERROR:
- printf ("ACI_EVT_HW_ERROR \n");
- lib_aci_connect(0/* in seconds, 0 means forever */, 0x0050 /* advertising interval 50ms*/);
- printf ("Advertising started \n");
- break;
-
- }
- }
-
- /* setup_required is set to true when the device starts up and enters setup mode.
- * It indicates that do_aci_setup() should be called. The flag should be cleared if
- * do_aci_setup() returns ACI_STATUS_TRANSACTION_COMPLETE.
- */
- if(setup_required) {
- if (SETUP_SUCCESS == do_aci_setup(&aci_state)) {
- setup_required = false;
- }
- }
-
- usleep (100);
- }
-
- close_local_interfaces (&aci_state);
-
- //! [Interesting]
-
- std::cout << "exiting application" << std::endl;
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/nrf8001-helloworld.h b/peripheral/libupm/examples/c++/nrf8001-helloworld.h
deleted file mode 100644
index ec566b5..0000000
--- a/peripheral/libupm/examples/c++/nrf8001-helloworld.h
+++ /dev/null
@@ -1,254 +0,0 @@
-#include "hal_platform.h"
-#include "aci.h"
-
-#pragma once
-
-#define SETUP_ID 0
-#define SETUP_FORMAT 2 /** nRF8001 Cx */
-#define ACI_DYNAMIC_DATA_SIZE 263
-
-/* Service: GATT - Characteristic: Service Changed - Pipe: TX_ACK */
-#define PIPE_GATT_SERVICE_CHANGED_TX_ACK 1
-#define PIPE_GATT_SERVICE_CHANGED_TX_ACK_MAX_SIZE 4
-
-/* Service: Device Information - Characteristic: Hardware Revision String - Pipe: SET */
-#define PIPE_DEVICE_INFORMATION_HARDWARE_REVISION_STRING_SET 2
-#define PIPE_DEVICE_INFORMATION_HARDWARE_REVISION_STRING_SET_MAX_SIZE 9
-
-/* Service: Device Information - Characteristic: Manufacturer Name String - Pipe: SET */
-#define PIPE_DEVICE_INFORMATION_MANUFACTURER_NAME_STRING_SET 3
-#define PIPE_DEVICE_INFORMATION_MANUFACTURER_NAME_STRING_SET_MAX_SIZE 20
-
-/* Service: Device Information - Characteristic: Model Number String - Pipe: SET */
-#define PIPE_DEVICE_INFORMATION_MODEL_NUMBER_STRING_SET 4
-#define PIPE_DEVICE_INFORMATION_MODEL_NUMBER_STRING_SET_MAX_SIZE 8
-
-/* Service: Device Information - Characteristic: Firmware Revision String - Pipe: SET */
-#define PIPE_DEVICE_INFORMATION_FIRMWARE_REVISION_STRING_SET 5
-#define PIPE_DEVICE_INFORMATION_FIRMWARE_REVISION_STRING_SET_MAX_SIZE 4
-
-/* Service: Device Information - Characteristic: PNP_ID - Pipe: SET */
-#define PIPE_DEVICE_INFORMATION_PNP_ID_SET 6
-#define PIPE_DEVICE_INFORMATION_PNP_ID_SET_MAX_SIZE 7
-
-/* Service: UART over BTLE - Characteristic: UART RX - Pipe: RX */
-#define PIPE_UART_OVER_BTLE_UART_RX_RX 7
-#define PIPE_UART_OVER_BTLE_UART_RX_RX_MAX_SIZE 20
-
-/* Service: UART over BTLE - Characteristic: UART TX - Pipe: TX */
-#define PIPE_UART_OVER_BTLE_UART_TX_TX 8
-#define PIPE_UART_OVER_BTLE_UART_TX_TX_MAX_SIZE 20
-
-/* Service: UART over BTLE - Characteristic: UART Control Point - Pipe: TX */
-#define PIPE_UART_OVER_BTLE_UART_CONTROL_POINT_TX 9
-#define PIPE_UART_OVER_BTLE_UART_CONTROL_POINT_TX_MAX_SIZE 9
-
-/* Service: UART over BTLE - Characteristic: UART Control Point - Pipe: RX */
-#define PIPE_UART_OVER_BTLE_UART_CONTROL_POINT_RX 10
-#define PIPE_UART_OVER_BTLE_UART_CONTROL_POINT_RX_MAX_SIZE 9
-
-/* Service: UART over BTLE - Characteristic: UART Link Timing Current - Pipe: SET */
-#define PIPE_UART_OVER_BTLE_UART_LINK_TIMING_CURRENT_SET 11
-#define PIPE_UART_OVER_BTLE_UART_LINK_TIMING_CURRENT_SET_MAX_SIZE 6
-
-
-#define NUMBER_OF_PIPES 11
-
-#define SERVICES_PIPE_TYPE_MAPPING_CONTENT {\
- {ACI_STORE_LOCAL, ACI_TX_ACK}, \
- {ACI_STORE_LOCAL, ACI_SET}, \
- {ACI_STORE_LOCAL, ACI_SET}, \
- {ACI_STORE_LOCAL, ACI_SET}, \
- {ACI_STORE_LOCAL, ACI_SET}, \
- {ACI_STORE_LOCAL, ACI_SET}, \
- {ACI_STORE_LOCAL, ACI_RX}, \
- {ACI_STORE_LOCAL, ACI_TX}, \
- {ACI_STORE_LOCAL, ACI_TX}, \
- {ACI_STORE_LOCAL, ACI_RX}, \
- {ACI_STORE_LOCAL, ACI_SET}, \
-}
-
-#define GAP_PPCP_MAX_CONN_INT 0x12 /**< Maximum connection interval as a multiple of 1.25 msec , 0xFFFF means no specific value requested */
-#define GAP_PPCP_MIN_CONN_INT 0xa /**< Minimum connection interval as a multiple of 1.25 msec , 0xFFFF means no specific value requested */
-#define GAP_PPCP_SLAVE_LATENCY 0
-#define GAP_PPCP_CONN_TIMEOUT 0xa /** Connection Supervision timeout multiplier as a multiple of 10msec, 0xFFFF means no specific value requested */
-
-#define NB_SETUP_MESSAGES 30
-#define SETUP_MESSAGES_CONTENT {\
- {0x00,\
- {\
- 0x07,0x06,0x00,0x00,0x02,0x02,0x41,0xfe,\
- },\
- },\
- {0x00,\
- {\
- 0x1f,0x06,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0a,0x00,0x0b,0x01,0x01,0x00,0x00,0x06,0x00,0x00,\
- 0x90,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
- },\
- },\
- {0x00,\
- {\
- 0x1e,0x06,0x10,0x1c,0x01,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
- 0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x14,0x03,0x90,0x01,\
- },\
- },\
- {0x00,\
- {\
- 0x1f,0x06,0x20,0x00,0x04,0x04,0x02,0x02,0x00,0x01,0x28,0x00,0x01,0x00,0x18,0x04,0x04,0x05,0x05,0x00,\
- 0x02,0x28,0x03,0x01,0x02,0x03,0x00,0x00,0x2a,0x04,0x04,0x14,\
- },\
- },\
- {0x00,\
- {\
- 0x1f,0x06,0x20,0x1c,0x05,0x00,0x03,0x2a,0x00,0x01,0x48,0x65,0x6c,0x6c,0x6f,0x63,0x73,0x65,0x6d,0x69,\
- 0x2e,0x63,0x6f,0x6d,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x04,\
- },\
- },\
- {0x00,\
- {\
- 0x1f,0x06,0x20,0x38,0x05,0x05,0x00,0x04,0x28,0x03,0x01,0x02,0x05,0x00,0x01,0x2a,0x06,0x04,0x03,0x02,\
- 0x00,0x05,0x2a,0x01,0x01,0x80,0x00,0x04,0x04,0x05,0x05,0x00,\
- },\
- },\
- {0x00,\
- {\
- 0x1f,0x06,0x20,0x54,0x06,0x28,0x03,0x01,0x02,0x07,0x00,0x04,0x2a,0x06,0x04,0x09,0x08,0x00,0x07,0x2a,\
- 0x04,0x01,0x0a,0x00,0x12,0x00,0x00,0x00,0x0a,0x00,0x04,0x04,\
- },\
- },\
- {0x00,\
- {\
- 0x1f,0x06,0x20,0x70,0x02,0x02,0x00,0x08,0x28,0x00,0x01,0x01,0x18,0x04,0x04,0x05,0x05,0x00,0x09,0x28,\
- 0x03,0x01,0x22,0x0a,0x00,0x05,0x2a,0x26,0x04,0x05,0x04,0x00,\
- },\
- },\
- {0x00,\
- {\
- 0x1f,0x06,0x20,0x8c,0x0a,0x2a,0x05,0x01,0x00,0x00,0x00,0x00,0x46,0x14,0x03,0x02,0x00,0x0b,0x29,0x02,\
- 0x01,0x00,0x00,0x04,0x04,0x02,0x02,0x00,0x0c,0x28,0x00,0x01,\
- },\
- },\
- {0x00,\
- {\
- 0x1f,0x06,0x20,0xa8,0x0a,0x18,0x04,0x04,0x05,0x05,0x00,0x0d,0x28,0x03,0x01,0x02,0x0e,0x00,0x27,0x2a,\
- 0x04,0x04,0x09,0x01,0x00,0x0e,0x2a,0x27,0x01,0x0a,0x00,0x00,\
- },\
- },\
- {0x00,\
- {\
- 0x1f,0x06,0x20,0xc4,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x04,0x05,0x05,0x00,0x0f,0x28,0x03,0x01,0x02,\
- 0x10,0x00,0x29,0x2a,0x04,0x04,0x14,0x02,0x00,0x10,0x2a,0x29,\
- },\
- },\
- {0x00,\
- {\
- 0x1f,0x06,0x20,0xe0,0x01,0x30,0x31,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
- 0x00,0x00,0x00,0x00,0x00,0x04,0x04,0x05,0x05,0x00,0x11,0x28,\
- },\
- },\
- {0x00,\
- {\
- 0x1f,0x06,0x20,0xfc,0x03,0x01,0x02,0x12,0x00,0x24,0x2a,0x04,0x04,0x08,0x02,0x00,0x12,0x2a,0x24,0x01,\
- 0x31,0x32,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x04,0x05,0x05,\
- },\
- },\
- {0x00,\
- {\
- 0x1f,0x06,0x21,0x18,0x00,0x13,0x28,0x03,0x01,0x02,0x14,0x00,0x26,0x2a,0x04,0x04,0x04,0x02,0x00,0x14,\
- 0x2a,0x26,0x01,0x33,0x34,0x00,0x00,0x04,0x04,0x05,0x05,0x00,\
- },\
- },\
- {0x00,\
- {\
- 0x1f,0x06,0x21,0x34,0x15,0x28,0x03,0x01,0x02,0x16,0x00,0x50,0x2a,0x06,0x04,0x08,0x07,0x00,0x16,0x2a,\
- 0x50,0x01,0x02,0x00,0x00,0xaa,0xaa,0xcc,0xcc,0x04,0x04,0x10,\
- },\
- },\
- {0x00,\
- {\
- 0x1f,0x06,0x21,0x50,0x10,0x00,0x17,0x28,0x00,0x01,0x9e,0xca,0xdc,0x24,0x0e,0xe5,0xa9,0xe0,0x93,0xf3,\
- 0xa3,0xb5,0x01,0x00,0x40,0x6e,0x04,0x04,0x13,0x13,0x00,0x18,\
- },\
- },\
- {0x00,\
- {\
- 0x1f,0x06,0x21,0x6c,0x28,0x03,0x01,0x04,0x19,0x00,0x9e,0xca,0xdc,0x24,0x0e,0xe5,0xa9,0xe0,0x93,0xf3,\
- 0xa3,0xb5,0x02,0x00,0x40,0x6e,0x44,0x10,0x14,0x00,0x00,0x19,\
- },\
- },\
- {0x00,\
- {\
- 0x1f,0x06,0x21,0x88,0x00,0x02,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x04,0x13,0x13,0x00,\
- },\
- },\
- {0x00,\
- {\
- 0x1f,0x06,0x21,0xa4,0x1a,0x28,0x03,0x01,0x10,0x1b,0x00,0x9e,0xca,0xdc,0x24,0x0e,0xe5,0xa9,0xe0,0x93,\
- 0xf3,0xa3,0xb5,0x03,0x00,0x40,0x6e,0x14,0x00,0x14,0x00,0x00,\
- },\
- },\
- {0x00,\
- {\
- 0x1f,0x06,0x21,0xc0,0x1b,0x00,0x03,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x46,0x14,0x03,0x02,\
- },\
- },\
- {0x00,\
- {\
- 0x1f,0x06,0x21,0xdc,0x00,0x1c,0x29,0x02,0x01,0x00,0x00,0x04,0x04,0x13,0x13,0x00,0x1d,0x28,0x03,0x01,\
- 0x14,0x1e,0x00,0x9e,0xca,0xdc,0x24,0x0e,0xe5,0xa9,0xe0,0x93,\
- },\
- },\
- {0x00,\
- {\
- 0x1f,0x06,0x21,0xf8,0xf3,0xa3,0xb5,0x04,0x00,0x40,0x6e,0x54,0x10,0x09,0x00,0x00,0x1e,0x00,0x04,0x02,\
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x46,0x14,0x03,\
- },\
- },\
- {0x00,\
- {\
- 0x1f,0x06,0x22,0x14,0x02,0x00,0x1f,0x29,0x02,0x01,0x00,0x00,0x04,0x04,0x13,0x13,0x00,0x20,0x28,0x03,\
- 0x01,0x02,0x21,0x00,0x9e,0xca,0xdc,0x24,0x0e,0xe5,0xa9,0xe0,\
- },\
- },\
- {0x00,\
- {\
- 0x1b,0x06,0x22,0x30,0x93,0xf3,0xa3,0xb5,0x05,0x00,0x40,0x6e,0x06,0x04,0x07,0x06,0x00,0x21,0x00,0x05,\
- 0x02,0xff,0xff,0xff,0xff,0xff,0xff,0x00,\
- },\
- },\
- {0x00,\
- {\
- 0x1f,0x06,0x40,0x00,0x2a,0x05,0x01,0x00,0x04,0x04,0x00,0x0a,0x00,0x0b,0x2a,0x27,0x01,0x00,0x80,0x04,\
- 0x00,0x0e,0x00,0x00,0x2a,0x29,0x01,0x00,0x80,0x04,0x00,0x10,\
- },\
- },\
- {0x00,\
- {\
- 0x1f,0x06,0x40,0x1c,0x00,0x00,0x2a,0x24,0x01,0x00,0x80,0x04,0x00,0x12,0x00,0x00,0x2a,0x26,0x01,0x00,\
- 0x80,0x04,0x00,0x14,0x00,0x00,0x2a,0x50,0x01,0x00,0x80,0x04,\
- },\
- },\
- {0x00,\
- {\
- 0x1f,0x06,0x40,0x38,0x00,0x16,0x00,0x00,0x00,0x02,0x02,0x00,0x08,0x04,0x00,0x19,0x00,0x00,0x00,0x03,\
- 0x02,0x00,0x02,0x04,0x00,0x1b,0x00,0x1c,0x00,0x04,0x02,0x00,\
- },\
- },\
- {0x00,\
- {\
- 0x13,0x06,0x40,0x54,0x0a,0x04,0x00,0x1e,0x00,0x1f,0x00,0x05,0x02,0x00,0x80,0x04,0x00,0x21,0x00,0x00,\
- },\
- },\
- {0x00,\
- {\
- 0x13,0x06,0x50,0x00,0x9e,0xca,0xdc,0x24,0x0e,0xe5,0xa9,0xe0,0x93,0xf3,0xa3,0xb5,0x00,0x00,0x40,0x6e,\
- },\
- },\
- {0x00,\
- {\
- 0x06,0x06,0xf0,0x00,0x02,0xb2,0xd1,\
- },\
- },\
-}
diff --git a/peripheral/libupm/examples/c++/nunchuck.cxx b/peripheral/libupm/examples/c++/nunchuck.cxx
deleted file mode 100644
index 4b9d617..0000000
--- a/peripheral/libupm/examples/c++/nunchuck.cxx
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-
-#include "nunchuck.h"
-
-using namespace std;
-
-bool shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main(int argc, char **argv)
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // Instantiate a nunchuck controller bus 0
- upm::NUNCHUCK *nunchuck = new upm::NUNCHUCK(0);
-
- // always do this first
- cout << "Initializing... " << endl;
- if (!nunchuck->init())
- {
- cerr << "nunchuck->init() failed." << endl;
- return 0;
- }
-
- while (shouldRun)
- {
- nunchuck->update();
-
- cout << "stickX: " << nunchuck->stickX
- << ", stickY: " << nunchuck->stickY << endl;
- cout << "accelX: " << nunchuck->accelX
- << ", accelY: " << nunchuck->accelY
- << ", accelZ: " << nunchuck->accelZ << endl;
-
- cout << "button C: "
- << ((nunchuck->buttonC) ? "pressed" : "not pressed") << endl;
- cout << "button Z: "
- << ((nunchuck->buttonZ) ? "pressed" : "not pressed") << endl;
- cout << endl;
-
- usleep(100000);
- }
- //! [Interesting]
-
- delete nunchuck;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/otp538u.cxx b/peripheral/libupm/examples/c++/otp538u.cxx
deleted file mode 100644
index ea6e3b3..0000000
--- a/peripheral/libupm/examples/c++/otp538u.cxx
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <iomanip>
-#include <signal.h>
-#include "otp538u.h"
-
-using namespace std;
-
-bool shouldRun = true;
-
-// analog voltage, usually 3.3 or 5.0
-#define OTP538U_AREF 5.0
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
-
- // Instantiate a OTP538U on analog pins A0 and A1
- // A0 is used for the Ambient Temperature and A1 is used for the
- // Object temperature.
- upm::OTP538U *temps = new upm::OTP538U(0, 1, OTP538U_AREF);
-
- // Output ambient and object temperatures
- while (shouldRun)
- {
- cout << "Ambient temp: " << std::fixed << setprecision(2)
- << temps->ambientTemperature()
- << " C, Object temp: " << temps->objectTemperature()
- << " C" << endl;
-
- sleep(1);
- }
-//! [Interesting]
-
- cout << "Exiting" << endl;
-
- delete temps;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/ozw.cxx b/peripheral/libupm/examples/c++/ozw.cxx
deleted file mode 100644
index 40c30f4..0000000
--- a/peripheral/libupm/examples/c++/ozw.cxx
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-
-#include "ozw.h"
-
-using namespace std;
-
-int main(int argc, char **argv)
-{
-//! [Interesting]
-
- string defaultDev = "/dev/ttyACM0";
-
- // if an argument was specified, use it as the device instead
- if (argc > 1)
- defaultDev = string(argv[1]);
-
- // Instantiate an OZW instance
- upm::OZW *sensor = new upm::OZW();
-
- // The first thing to do is create options, then lock them when done.
- sensor->optionsCreate();
- sensor->optionsLock();
-
- // Next, initialize it.
- cout << "Initializing, this may take awhile depending on your ZWave network"
- << endl;
-
- if (!sensor->init(defaultDev))
- {
- cerr << "Init failed." << endl;
- return 0;
- }
- cout << "Initialization complete" << endl;
-
- cout << "Dumping nodes..." << endl;
-
- sensor->dumpNodes();
-
- // The following is example output of dumpNodes:
- //
- // Dumping nodes...
- // Node 1: Z-Stick Gen5
- // Node 2: Smart Switch 6
- // Index: 0, Type: bool, Label: Switch, Value: False
- // Index: 2, Type: float, Label: Energy, Value: 1.190 kWh
- // Index: 3, Type: float, Label: Previous Reading, Value: 1.190 kWh
- // Index: 4, Type: int32, Label: Interval, Value: 1521 seconds
- // Index: 5, Type: float, Label: Power, Value: 0.000 W
- // Index: 6, Type: float, Label: Voltage, Value: 121.256 V
- // Index: 7, Type: float, Label: Current, Value: 0.000 A
- // Index: 8, Type: bool, Label: Exporting, Value: False
- // Index: 45, Type: list, Label: Day, Value: Friday
- // Index: 46, Type: byte, Label: Hour, Value: 5
- // Index: 47, Type: byte, Label: Minute, Value: 53
- // Node 3: Multi Sensor
- // Index: 0, Type: bool, Label: Sensor, Value: True
- // Index: 1, Type: float, Label: Temperature, Value: 72.8 F
- // Index: 2, Type: float, Label: Luminance, Value: 4 lux
- // Index: 3, Type: float, Label: Relative Humidity, Value: 22 %
- // Index: 17, Type: byte, Label: Battery Level, Value: 98 %
- // Node 5: Minimote
- // Node 6: Smart Energy Switch
- // Index: 0, Type: bool, Label: Switch, Value: False
- // Index: 2, Type: float, Label: Power, Value: 0.000 W
- // Index: 3, Type: float, Label: Energy, Value: 1.609 kWh
- // Index: 4, Type: float, Label: Previous Reading, Value: 1.609 kWh
- // Index: 5, Type: int32, Label: Interval, Value: 1521 seconds
- // Index: 6, Type: float, Label: Power, Value: 0.000 W
- // Index: 7, Type: float, Label: Previous Reading, Value: 1.609 W
- // Index: 8, Type: int32, Label: Interval, Value: 1521 seconds
- // Index: 9, Type: bool, Label: Exporting, Value: False
- // Node 7: Smart Energy Switch
- // Index: 0, Type: bool, Label: Switch, Value: False
- // Index: 2, Type: float, Label: Power, Value: 0.000 W
- // Index: 3, Type: float, Label: Energy, Value: 0.000 kWh
- // Index: 4, Type: float, Label: Previous Reading, Value: 0.000 kWh
- // Index: 5, Type: int32, Label: Interval, Value: 1521 seconds
- // Index: 6, Type: float, Label: Power, Value: 0.000 W
- // Index: 7, Type: float, Label: Previous Reading, Value: 0.000 W
- // Index: 8, Type: int32, Label: Interval, Value: 1521 seconds
- // Index: 9, Type: bool, Label: Exporting, Value: False
- //
- // So, with the above in mind:
- //
- // 1. Query the temperature on node 3 and print it out (as a
- // string), along with the units of measure:
- //
- // cout << "Temperature: " << sensor->getValueAsString(3, 1)
- // << " " << sensor->getValueUnits(3, 1) << endl;
- //
- // 2. query the same temperature as a float:
- //
- // float temperature = sensor->getValueAsFloat(3, 1);
- //
- // 3. Turn on the light plugged into the switch on Node 7, wait 5
- // seconds, then turn it back off again:
- //
- // cout << "Turning ON node 7" << endl;
- // sensor->setValueAsBool(7, 0, true);
- //
- // cout << "Sleeping for 5 seconds" << endl;
- // sleep(5);
- //
- // cout << "Turning OFF node 7" << endl;
- // sensor->setValueAsBool(7, 0, false);
-
-
-//! [Interesting]
-
-
- cout << "Exiting..." << endl;
-
- delete sensor;
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/pca9685.cxx b/peripheral/libupm/examples/c++/pca9685.cxx
deleted file mode 100644
index 0806e40..0000000
--- a/peripheral/libupm/examples/c++/pca9685.cxx
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <signal.h>
-#include <iostream>
-#include "pca9685.h"
-
-using namespace std;
-
-int main(int argc, char **argv)
-{
-//! [Interesting]
- // Instantiate an PCA9685 on I2C bus 0
-
- upm::PCA9685 *leds = new upm::PCA9685(PCA9685_I2C_BUS,
- PCA9685_DEFAULT_I2C_ADDR);
-
- // put device to sleep
- leds->setModeSleep(true);
-
- // setup a period of 50Hz
- leds->setPrescaleFromHz(50);
-
- // wake device up
- leds->setModeSleep(false);
-
- // Setup a 50% duty cycle -- on time at 0, off time at 2048 (4096 / 2)
- // Set for all channels
-
- leds->ledOnTime(PCA9685_ALL_LED, 0);
- leds->ledOffTime(PCA9685_ALL_LED, 2048);
-
- // but, turn channel 3 full off and channel 4 full on
-
- cout << "Turning channel 3 off, and channel 4 on." << endl;
- cout << "All other channels will be PWM'd at a 50% duty cycle." << endl;
-
- leds->ledFullOff(3, true);
- leds->ledFullOn(4, true);
-
- // now, just sleep for 5 seconds, reset channels 3 and 4, and exit.
- cout << "Sleeping for 5 seconds..." << endl;
-
- sleep(5);
-
- cout << "Exiting..." << endl;
-
- // clear the bits we set earlier
- leds->ledFullOff(3, false);
- leds->ledFullOn(4, false);
-
-//! [Interesting]
-
- delete leds;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/pn532-writeurl.cxx b/peripheral/libupm/examples/c++/pn532-writeurl.cxx
deleted file mode 100644
index f7fc956..0000000
--- a/peripheral/libupm/examples/c++/pn532-writeurl.cxx
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "pn532.h"
-
-using namespace std;
-
-// the URL we want to add as an NDEF record
-// NOTE: this cannot exceed 34 characters.
-static char url[] = "iotdk.intel.com";
-
-
-int main(int argc, char **argv)
-{
-//! [Interesting]
- // Instantiate an PN532 on I2C bus 0 (default) using gpio 3 for the
- // IRQ, and gpio 2 for the reset pin.
-
- upm::PN532 *nfc = new upm::PN532(3, 2);
-
- if (!nfc->init())
- cerr << "init() failed" << endl;
-
- uint32_t vers = nfc->getFirmwareVersion();
-
- if (vers)
- printf("Got firmware version: 0x%08x\n", vers);
- else
- {
- printf("Could not identify PN532\n");
- return 1;
- }
-
- // Now scan and identify any cards that come in range (1 for now)
-
- // Retry forever
- nfc->setPassiveActivationRetries(0xff);
-
- nfc->SAMConfig();
-
- uint8_t uidSize;
- uint8_t uid[7];
-
- bool foundCard = false;
- while (!foundCard)
- {
- memset(uid, 0, 7);
- if (nfc->readPassiveTargetID(nfc->BAUD_MIFARE_ISO14443A,
- uid, &uidSize, 2000))
- {
- // found a card
- printf("Found a card: UID len %d\n", uidSize);
- printf("UID: ");
- for (int i = 0; i < uidSize; i++)
- printf("%02x ", uid[i]);
- printf("\n");
- printf("SAK: 0x%02x\n", nfc->getSAK());
- printf("ATQA: 0x%04x\n\n", nfc->getATQA());
- foundCard = true;
- }
- else
- {
- printf("Waiting for a card...\n");
- }
- }
-
- if (uidSize != 7)
- {
- printf("This example will only write an NDEF URI to preformatted\n");
- printf("Mifare Ultralight or NTAG2XX tags\n");
-
- return 1;
- }
-
- // 48 bytes is maximum data area on ultralight cards, so we use that
- // as the maximum datasize here. Obviously if you have a bigger
- // card, you can write more data.
- if (!nfc->ntag2xx_WriteNDEFURI(nfc->NDEF_URIPREFIX_HTTP, url, 48))
- {
- // failure
- printf("Failed to write NDEF record tag.\n");
- return 1;
- }
-
- printf("Success, URL record written to tag.\n");
-
-
-//! [Interesting]
-
- delete nfc;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/pn532.cxx b/peripheral/libupm/examples/c++/pn532.cxx
deleted file mode 100644
index d1b7ba0..0000000
--- a/peripheral/libupm/examples/c++/pn532.cxx
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <signal.h>
-#include <iostream>
-#include "pn532.h"
-
-using namespace std;
-
-bool shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-
-int main(int argc, char **argv)
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // Instantiate an PN532 on I2C bus 0 (default) using gpio 3 for the
- // IRQ, and gpio 2 for the reset pin.
-
- upm::PN532 *nfc = new upm::PN532(3, 2);
-
- if (!nfc->init())
- cerr << "init() failed" << endl;
-
- uint32_t vers = nfc->getFirmwareVersion();
-
- if (vers)
- printf("Got firmware version: 0x%08x\n", vers);
- else
- {
- printf("Could not identify PN532\n");
- return 1;
- }
-
- // Now scan and identify any cards that come in range (1 for now)
-
- // Retry forever
- nfc->setPassiveActivationRetries(0xff);
-
- nfc->SAMConfig();
-
- uint8_t uidSize;
- uint8_t uid[7];
-
- while (shouldRun)
- {
- memset(uid, 0, 7);
- if (nfc->readPassiveTargetID(nfc->BAUD_MIFARE_ISO14443A,
- uid, &uidSize, 2000))
- {
- // found a card
- printf("Found a card: UID len %d\n", uidSize);
- printf("UID: ");
- for (int i = 0; i < uidSize; i++)
- printf("%02x ", uid[i]);
- printf("\n");
- printf("SAK: 0x%02x\n", nfc->getSAK());
- printf("ATQA: 0x%04x\n\n", nfc->getATQA());
- sleep(1);
- }
- else
- {
- printf("Waiting for a card...\n");
- }
- }
-
-
-//! [Interesting]
-
- delete nfc;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/ppd42ns.cxx b/peripheral/libupm/examples/c++/ppd42ns.cxx
deleted file mode 100644
index 38a64e5..0000000
--- a/peripheral/libupm/examples/c++/ppd42ns.cxx
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Author: Zion Orent <zorent@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "ppd42ns.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-
-int main ()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // Instantiate a dust sensor on GPIO pin D8
- upm::PPD42NS* dust = new upm::PPD42NS(8);
- upm::dustData data;
- cout << "This program will give readings every 30 seconds until you stop it" << endl;
- while (shouldRun)
- {
- data = dust->getData();
- cout << "Low pulse occupancy: " << data.lowPulseOccupancy << endl;
- cout << "Ratio: " << data.ratio << endl;
- cout << "Concentration: " << data.concentration << endl;
- }
-//! [Interesting]
-
- cout << "Exiting" << endl;
-
- delete dust;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/pulsensor.cxx b/peripheral/libupm/examples/c++/pulsensor.cxx
deleted file mode 100644
index dcb9cba..0000000
--- a/peripheral/libupm/examples/c++/pulsensor.cxx
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <string.h>
-#include <unistd.h>
-#include "pulsensor.h"
-#include <signal.h>
-
-using namespace upm;
-
-int doWork = 0;
-
-void
-sig_handler(int signo)
-{
- printf("got signal\n");
- if (signo == SIGINT) {
- printf("exiting application\n");
- doWork = 1;
- }
-}
-
-void
-handler (clbk_data data) {
- printf ("callback data (%d)\n", data);
-}
-
-int
-main(int argc, char **argv)
-{
-//! [Interesting]
- Pulsensor *sensor = new Pulsensor(handler);
-
- sensor->start_sampler();
- while (!doWork) {
- usleep (5);
- }
- sensor->stop_sampler();
-//! [Interesting]
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/rfr359f.cxx b/peripheral/libupm/examples/c++/rfr359f.cxx
deleted file mode 100644
index b7a8c21..0000000
--- a/peripheral/libupm/examples/c++/rfr359f.cxx
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "rfr359f.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-
-int main ()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // Instantiate an RFR359F digital pin D2
- // This was tested on the Grove IR Distance Interrupter
-
- upm::RFR359F* dInterruptor = new upm::RFR359F(2);
-
- // The range appears to be about 4 inches, depending on adjustment
- while (shouldRun)
- {
- if (dInterruptor->objectDetected())
- cout << "Object detected" << endl;
- else
- cout << "Area is clear" << endl;
-
- usleep(100000); // 100ms
- }
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete dInterruptor;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/rgbringcoder.cxx b/peripheral/libupm/examples/c++/rgbringcoder.cxx
deleted file mode 100644
index 52644cd..0000000
--- a/peripheral/libupm/examples/c++/rgbringcoder.cxx
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "rgbringcoder.h"
-#include <signal.h>
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-
-int main(int argc, char **argv)
-{
- signal(SIGINT, sig_handler);
-
- //! [Interesting]
-
- // There are a lot of pins to hook up. These pins are valid for the
- // Edison board, but may need to be adjusted for other platforms.
-
- // In order:
- // enable - 4
- // latch - 10
- // clear - 11
- // clock - 2
- // data - 9
- // switch - 7
-
- // red pwm - 3
- // green pwm - 5
- // blue pwm - 6
-
- // encA - 12
- // encB - 13
-
- upm::RGBRingCoder *ringCoder =
- new upm::RGBRingCoder(4, 10, 11, 2, 9, 7, 12, 13, 3, 5, 6);
-
- uint16_t spin = 0x0001;
- bool oldState = false;
- int oldPos = 0;
-
- // Lets go green
- ringCoder->setRGBLED(0.99, 0.01, 0.99);
-
- while (shouldRun)
- {
- // you spin me round...
- if (spin == 0)
- spin = 0x0001;
-
- ringCoder->setRingLEDS(spin);
- spin <<= 1;
-
- // check button state
- bool bstate = ringCoder->getButtonState();
- if (bstate != oldState)
- {
- cout << "Button state changed from " << oldState << " to "
- << bstate << endl;
- oldState = bstate;
- }
-
- // check encoder position
- int epos = ringCoder->getEncoderPosition();
- if (epos != oldPos)
- {
- cout << "Encoder position changed from " << oldPos << " to "
- << epos << endl;
- oldPos = epos;
- }
-
- usleep(100000);
- }
-
- //! [Interesting]
-
- delete ringCoder;
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/rhusb.cxx b/peripheral/libupm/examples/c++/rhusb.cxx
deleted file mode 100644
index 20f12ed..0000000
--- a/peripheral/libupm/examples/c++/rhusb.cxx
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2016 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-
-#include "rhusb.h"
-
-using namespace std;
-
-bool shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main(int argc, char **argv)
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
-
- string defaultDev = "/dev/ttyUSB0";
-
- // if an argument was specified, use it as the device instead
- if (argc > 1)
- defaultDev = string(argv[1]);
-
- cout << "Using device " << defaultDev << endl;
- cout << "Initializing..." << endl;
-
- // Instantiate an RHUSB instance on defaultDev
- upm::RHUSB sensor(defaultDev);
-
- // output the firmware ID
- cout << "Firmware ID: " << sensor.getFirmwareID() << endl;
- cout << endl;
-
- // update and print available values every second
- while (shouldRun)
- {
- // update our values from the sensor
- sensor.update();
-
- // we show both C and F for temperature
- cout << "Temperature: " << sensor.getTemperature()
- << " C / " << sensor.getTemperature(true) << " F"
- << endl;
-
- cout << "Humidity: " << sensor.getHumidity()
- << " %" << endl;
-
- cout << endl;
-
- sleep(1);
- }
-
-
- cout << "Exiting..." << endl;
-
-//! [Interesting]
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/rotaryencoder.cxx b/peripheral/libupm/examples/c++/rotaryencoder.cxx
deleted file mode 100644
index f6c505e..0000000
--- a/peripheral/libupm/examples/c++/rotaryencoder.cxx
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "rotaryencoder.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-
-int main()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // Instantiate a Grove Rotary Encoder, using signal pins D2 and D3
- upm::RotaryEncoder* rotaryencoder = new upm::RotaryEncoder(2, 3);
-
- while (shouldRun)
- {
- cout << "Position: " << rotaryencoder->position() << endl;
- usleep(100000);
- }
-
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete rotaryencoder;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/rpr220-intr.cxx b/peripheral/libupm/examples/c++/rpr220-intr.cxx
deleted file mode 100644
index 05a8381..0000000
--- a/peripheral/libupm/examples/c++/rpr220-intr.cxx
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "rpr220.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-volatile unsigned int counter = 0;
-
-// Our interrupt handler
-void rprISR(void *arg)
-{
- counter++;
-}
-
-
-int main()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // This example uses an interrupt handler to increment a counter
-
- // Instantiate an RPR220 digital pin D2
- // This was tested on the Grove IR Reflective Sensor
-
- upm::RPR220* rpr220 = new upm::RPR220(2);
-
- // Here, we setup our Interupt Service Routine (ISR) to count
- // 'black' pulses detected.
-
- rpr220->installISR(rprISR, NULL);
-
- while (shouldRun)
- {
- cout << "Counter: " << counter << endl;
-
- sleep(1);
- }
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete rpr220;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/rpr220.cxx b/peripheral/libupm/examples/c++/rpr220.cxx
deleted file mode 100644
index c9bdf1d..0000000
--- a/peripheral/libupm/examples/c++/rpr220.cxx
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "rpr220.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-
-int main()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // This example uses a simple method to determine current status
-
- // Instantiate an RPR220 digital pin D2
- // This was tested on the Grove IR Reflective Sensor
-
- upm::RPR220* rpr220 = new upm::RPR220(2);
-
- while (shouldRun)
- {
- if (rpr220->blackDetected())
- cout << "Black detected" << endl;
- else
- cout << "Black NOT detected" << endl;
-
- usleep(100000); // 100ms
- }
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete rpr220;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/sainsmartks.cxx b/peripheral/libupm/examples/c++/sainsmartks.cxx
deleted file mode 100644
index 19c8704..0000000
--- a/peripheral/libupm/examples/c++/sainsmartks.cxx
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <signal.h>
-#include <iostream>
-
-#include "sainsmartks.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-
-int main(int argc, char **argv)
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // use default pins
- upm::SAINSMARTKS* lcd = new upm::SAINSMARTKS();
- lcd->setCursor(0,0);
- lcd->write("Sainsmart KS");
- lcd->setCursor(1,2);
- lcd->write("Hello World");
-
- // output current key value every second.
- while (shouldRun)
- {
- cout << "Button value: " << lcd->getRawKeyValue() << endl;
- sleep(1);
- }
-
-//! [Interesting]
-
- delete lcd;
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/si114x.cxx b/peripheral/libupm/examples/c++/si114x.cxx
deleted file mode 100644
index 4c069c9..0000000
--- a/peripheral/libupm/examples/c++/si114x.cxx
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "si114x.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-
-int main ()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // Instantiate a SI114x UV Sensor on I2C bus 0
- upm::SI114X* uvi = new upm::SI114X(0);
-
- // First initialize it
- uvi->initialize();
-
- cout << "UV Index Scale:" << endl;
- cout << "---------------" << endl;
- cout << "11+ Extreme" << endl;
- cout << "8-10 Very High" << endl;
- cout << "6-7 High" << endl;
- cout << "3-5 Moderate" << endl;
- cout << "0-2 Low" << endl;
- cout << endl;
-
- // update every second and print the currently measured UV Index
- while (shouldRun)
- {
- // update current value(s)
- uvi->update();
-
- // print detected value
- cout << "UV Index: " << uvi->getUVIndex() << endl;
-
- sleep(1);
- }
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete uvi;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/sm130.cxx b/peripheral/libupm/examples/c++/sm130.cxx
deleted file mode 100644
index 3d1e3bd..0000000
--- a/peripheral/libupm/examples/c++/sm130.cxx
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <string>
-#include <signal.h>
-#include <stdio.h>
-#include "sm130.h"
-
-using namespace std;
-using namespace upm;
-
-int main (int argc, char **argv)
-{
-//! [Interesting]
-
- // Instantiate a UART based SM130 RFID Module using defaults
- upm::SM130* sensor = new upm::SM130();
-
- // set the baud rate. 19200 baud is the default.
- if (sensor->setBaudRate(19200))
- {
- cerr << "Failed to set baud rate" << endl;
- return 1;
- }
-
- cout << "Resetting..." << endl;
- sensor->reset();
-
- cout << "Firmware revision: " << sensor->getFirmwareVersion() << endl;
-
- cout << "Waiting up to 5 seconds for a tag..." << endl;
-
- if (sensor->waitForTag(5000))
- {
- cout << "Found tag, UID: "
- << sensor->string2HexString(sensor->getUID()) << endl;
- cout << "Tag Type: " << sensor->tag2String(sensor->getTagType())
- << endl;
- }
- else
- {
- // error
- cout << "waitForTag failed: " << sensor->getLastErrorString() << endl;
- }
-
-//! [Interesting]
-
- cout << "Exiting" << endl;
- delete sensor;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/ssd1306-oled.cxx b/peripheral/libupm/examples/c++/ssd1306-oled.cxx
deleted file mode 100644
index 07421e3..0000000
--- a/peripheral/libupm/examples/c++/ssd1306-oled.cxx
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * Author Marc Graham <marc@m2ag.net>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Adapted from ssd1308 library.
- * Author: Yevgeniy Kiveish <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include "ssd1306.h"
-
-#define DEVICE_ADDRESS 0x3C
-#define BUS_NUMBER 0x6
-
-static uint8_t intel_logo[] = {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 192, 192, 192, 224,
- 224, 224, 224, 240, 240, 248, 248, 120, 120, 120, 120, 60, 60, 60, 60, 60,
- 62, 30, 30, 30, 30, 30, 30, 30, 31, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 31, 31, 31, 31, 31,
- 30, 62, 62, 62, 62, 126, 126, 124, 124, 252, 252, 248, 248, 240, 240, 240,
- 224, 224, 224, 192, 128, 128, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 128, 128, 128,
- 128, 0, 56, 56, 28, 30, 14, 15, 15, 7, 7, 7, 7, 3, 3, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 192, 192, 192, 192, 192, 192, 192, 192, 0, 0, 0, 0, 192, 193, 195, 195,
- 195, 7, 15, 15, 63, 127, 255, 255, 255, 254, 252, 252, 240, 192, 0, 0, 0,
- 0, 0, 0, 0, 0, 128, 192, 192, 240, 248, 124, 124, 60, 0, 0, 0, 0, 159, 159,
- 159, 159, 159, 159, 159, 159, 0, 0, 0, 0, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 0, 0,
- 0, 0, 0, 0, 254, 254, 254, 254, 254, 254, 254, 254, 128, 128, 128, 128,
- 128, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 192, 192, 192, 192, 192, 192, 128,
- 128, 128, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255,
- 0, 0, 0, 0, 3, 7, 3, 3, 3, 0, 0, 0, 0, 0, 1, 1, 255, 255, 255, 255, 255,
- 255, 255, 0, 0, 224, 248, 252, 252, 255, 127, 15, 15, 3, 1, 0, 0, 0, 0, 0,
- 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 255,
- 255, 255, 255, 255, 255, 15, 15, 15, 15, 15, 15, 255, 255, 255, 255, 255,
- 255, 255, 252, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 15, 15,
- 15, 15, 15, 224, 224, 252, 254, 255, 255, 255, 255, 159, 159, 143, 143,
- 135, 135, 143, 159, 255, 255, 255, 255, 255, 255, 252, 248, 0, 0, 0, 255,
- 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128,
- 224, 248, 248, 255, 255, 255, 255, 255, 127, 15, 255, 255, 255, 255, 255,
- 255, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255,
- 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0,
- 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 255,
- 255, 255, 255, 255, 255, 192, 192, 192, 192, 192, 31, 31, 255, 255, 255,
- 255, 255, 255, 231, 231, 199, 199, 199, 199, 199, 199, 199, 199, 231, 231,
- 231, 231, 199, 135, 0, 0, 0, 63, 255, 255, 255, 255, 255, 255, 255, 0, 0,
- 0, 0, 224, 240, 248, 248, 252, 254, 255, 255, 255, 127, 63, 63, 31, 15, 7,
- 7, 1, 0, 0, 63, 63, 255, 255, 255, 255, 255, 240, 192, 192, 128, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 3, 3, 7, 7, 7, 7, 7, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7,
- 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 3, 3, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 0, 0, 0, 1, 3, 3, 3, 7, 7, 7, 7, 15, 15, 15, 15, 7, 7, 7,
- 7, 7, 3, 3, 3, 1, 0, 0, 0, 0, 1, 3, 3, 7, 135, 135, 135, 192, 192, 0, 0, 7,
- 7, 3, 3, 3, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 7, 15, 15,
- 31, 127, 127, 127, 255, 255, 252, 252, 252, 248, 240, 240, 240, 224, 224,
- 224, 192, 192, 192, 192, 128, 128, 128, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 128, 128, 128, 128, 128, 128, 128, 192, 192, 192, 192, 192,
- 224, 224, 224, 224, 240, 240, 240, 240, 248, 248, 248, 248, 252, 252, 252,
- 254, 254, 255, 255, 255, 255, 255, 255, 127, 127, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
- 3, 3, 3, 7, 7, 7, 15, 15, 31, 31, 31, 63, 63, 63, 63, 63, 127, 127, 127,
- 127, 127, 255, 255, 255, 255, 254, 254, 254, 254, 254, 254, 254, 254, 254,
- 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254,
- 255, 255, 255, 255, 255, 255, 255, 127, 127, 127, 127, 127, 127, 127, 127,
- 63, 63, 63, 63, 63, 31, 31, 31, 31, 31, 15, 15, 15, 15, 7, 7, 7, 7, 3, 3,
- 3, 3, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0
- };
-
-int
-main(int argc, char **argv)
-{
-//! [Interesting]
- upm::SSD1306 *lcd = new upm::SSD1306(BUS_NUMBER, DEVICE_ADDRESS);
-
- lcd->clear();
- lcd->stopscroll();
- lcd->draw(intel_logo, 1024);
-
- sleep(3);
-
- lcd->clear();
- lcd->setCursor(2, 0);
- lcd->write("Hello");
- lcd->setCursor(3,0);
- lcd->write("World");
-
- sleep(3);
-
- lcd->invert(true);
-
- sleep(3);
-
- lcd->dim(true);
-
- sleep(3);
-
- lcd->dim(false);
-
- sleep(3);
-
- lcd->invert(false);
- lcd->startscrollright(0x00, 0x0F);
-
- sleep(5);
-
- lcd->stopscroll();
- lcd->startscrollleft(0x00, 0x0F);
-
- sleep(5);
-
- lcd->stopscroll();
- lcd->startscrolldiagleft(0x00,0x0F);
-
- sleep(5);
-
- lcd->stopscroll();
- lcd->startscrolldiagright(0x00,0x0F);
-
- sleep(5);
-
- lcd->stopscroll();
-
- delete lcd;
-//! [Interesting]
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/ssd1308-oled.cxx b/peripheral/libupm/examples/c++/ssd1308-oled.cxx
deleted file mode 100644
index f54169e..0000000
--- a/peripheral/libupm/examples/c++/ssd1308-oled.cxx
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Author: Yevgeniy Kiveish <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include "ssd1308.h"
-
-#define DEVICE_ADDRESS 0x3C
-#define BUS_NUMBER 0x0
-
-static uint8_t intel_logo[] = {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 192, 192, 192, 224,
- 224, 224, 224, 240, 240, 248, 248, 120, 120, 120, 120, 60, 60, 60, 60, 60,
- 62, 30, 30, 30, 30, 30, 30, 30, 31, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 31, 31, 31, 31, 31,
- 30, 62, 62, 62, 62, 126, 126, 124, 124, 252, 252, 248, 248, 240, 240, 240,
- 224, 224, 224, 192, 128, 128, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 128, 128, 128,
- 128, 0, 56, 56, 28, 30, 14, 15, 15, 7, 7, 7, 7, 3, 3, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 192, 192, 192, 192, 192, 192, 192, 192, 0, 0, 0, 0, 192, 193, 195, 195,
- 195, 7, 15, 15, 63, 127, 255, 255, 255, 254, 252, 252, 240, 192, 0, 0, 0,
- 0, 0, 0, 0, 0, 128, 192, 192, 240, 248, 124, 124, 60, 0, 0, 0, 0, 159, 159,
- 159, 159, 159, 159, 159, 159, 0, 0, 0, 0, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 0, 0,
- 0, 0, 0, 0, 254, 254, 254, 254, 254, 254, 254, 254, 128, 128, 128, 128,
- 128, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 192, 192, 192, 192, 192, 192, 128,
- 128, 128, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255,
- 0, 0, 0, 0, 3, 7, 3, 3, 3, 0, 0, 0, 0, 0, 1, 1, 255, 255, 255, 255, 255,
- 255, 255, 0, 0, 224, 248, 252, 252, 255, 127, 15, 15, 3, 1, 0, 0, 0, 0, 0,
- 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 255,
- 255, 255, 255, 255, 255, 15, 15, 15, 15, 15, 15, 255, 255, 255, 255, 255,
- 255, 255, 252, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 15, 15,
- 15, 15, 15, 224, 224, 252, 254, 255, 255, 255, 255, 159, 159, 143, 143,
- 135, 135, 143, 159, 255, 255, 255, 255, 255, 255, 252, 248, 0, 0, 0, 255,
- 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128,
- 224, 248, 248, 255, 255, 255, 255, 255, 127, 15, 255, 255, 255, 255, 255,
- 255, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255,
- 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0,
- 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 255,
- 255, 255, 255, 255, 255, 192, 192, 192, 192, 192, 31, 31, 255, 255, 255,
- 255, 255, 255, 231, 231, 199, 199, 199, 199, 199, 199, 199, 199, 231, 231,
- 231, 231, 199, 135, 0, 0, 0, 63, 255, 255, 255, 255, 255, 255, 255, 0, 0,
- 0, 0, 224, 240, 248, 248, 252, 254, 255, 255, 255, 127, 63, 63, 31, 15, 7,
- 7, 1, 0, 0, 63, 63, 255, 255, 255, 255, 255, 240, 192, 192, 128, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 3, 3, 7, 7, 7, 7, 7, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7,
- 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 3, 3, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 0, 0, 0, 1, 3, 3, 3, 7, 7, 7, 7, 15, 15, 15, 15, 7, 7, 7,
- 7, 7, 3, 3, 3, 1, 0, 0, 0, 0, 1, 3, 3, 7, 135, 135, 135, 192, 192, 0, 0, 7,
- 7, 3, 3, 3, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 7, 15, 15,
- 31, 127, 127, 127, 255, 255, 252, 252, 252, 248, 240, 240, 240, 224, 224,
- 224, 192, 192, 192, 192, 128, 128, 128, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 128, 128, 128, 128, 128, 128, 128, 192, 192, 192, 192, 192,
- 224, 224, 224, 224, 240, 240, 240, 240, 248, 248, 248, 248, 252, 252, 252,
- 254, 254, 255, 255, 255, 255, 255, 255, 127, 127, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
- 3, 3, 3, 7, 7, 7, 15, 15, 31, 31, 31, 63, 63, 63, 63, 63, 127, 127, 127,
- 127, 127, 255, 255, 255, 255, 254, 254, 254, 254, 254, 254, 254, 254, 254,
- 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254,
- 255, 255, 255, 255, 255, 255, 255, 127, 127, 127, 127, 127, 127, 127, 127,
- 63, 63, 63, 63, 63, 31, 31, 31, 31, 31, 15, 15, 15, 15, 7, 7, 7, 7, 3, 3,
- 3, 3, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0 };
-
-int
-main(int argc, char **argv)
-{
-//! [Interesting]
- upm::SSD1308 *lcd = new upm::SSD1308(BUS_NUMBER, DEVICE_ADDRESS);
-
- lcd->clear();
- lcd->draw(intel_logo, 1024);
-
- delete lcd;
-//! [Interesting]
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/ssd1327-oled.cxx b/peripheral/libupm/examples/c++/ssd1327-oled.cxx
deleted file mode 100644
index 73323ec..0000000
--- a/peripheral/libupm/examples/c++/ssd1327-oled.cxx
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Author: Yevgeniy Kiveish <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include "ssd1327.h"
-
-#define DEVICE_ADDRESS 0x3C
-#define BUS_NUMBER 0x0
-
-static uint8_t SeeedLogo[] ={
-0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x60, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x06, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xC0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x01, 0xC0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x03, 0x80, 0x03, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x80, 0x03, 0x80,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x80, 0x03, 0xC0, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x07, 0x80, 0x01, 0xC0, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
-0x07, 0x80, 0x01, 0xE0, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x0F, 0x80, 0x01, 0xE0,
-0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x0F, 0x00, 0x01, 0xE0, 0x08, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x30, 0x0F, 0x00, 0x01, 0xE0, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30,
-0x0F, 0x00, 0x01, 0xE0, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x0F, 0x00, 0x01, 0xE0,
-0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x0F, 0x00, 0x01, 0xE0, 0x18, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x38, 0x0F, 0x00, 0x01, 0xE0, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38,
-0x0F, 0x80, 0x01, 0xE0, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x0F, 0x80, 0x01, 0xE0,
-0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x0F, 0x80, 0x03, 0xE0, 0x78, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x1E, 0x07, 0x80, 0x03, 0xE0, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E,
-0x07, 0x80, 0x03, 0xE0, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x07, 0x80, 0x03, 0xC1,
-0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x87, 0xC0, 0x07, 0xC1, 0xF0, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x0F, 0x83, 0xC0, 0x07, 0x83, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F,
-0xC3, 0xC0, 0x07, 0x87, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xE1, 0xE0, 0x07, 0x0F,
-0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xF0, 0xE0, 0x0F, 0x0F, 0x80, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x01, 0xF8, 0xF0, 0x0E, 0x1F, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
-0xF8, 0x70, 0x1C, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x30, 0x18, 0x7E,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x18, 0x30, 0xFC, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x1F, 0x88, 0x21, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x0F, 0xC4, 0x47, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xE0, 0x0F, 0x80,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x02, 0x00, 0x06, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x06,
-0x00, 0x00, 0x60, 0x00, 0x7E, 0x3F, 0x0F, 0xC3, 0xF0, 0xFA, 0x0F, 0xDF, 0xE1, 0x9F, 0xEC, 0x7E,
-0xE6, 0x73, 0x9C, 0xE7, 0x39, 0xCE, 0x1C, 0xDF, 0xE1, 0xB9, 0xEC, 0xE7, 0xE0, 0x61, 0xD8, 0x66,
-0x1B, 0x86, 0x1C, 0x06, 0x61, 0xB0, 0x6D, 0xC3, 0x7C, 0x7F, 0xFF, 0xFF, 0xFF, 0x06, 0x0F, 0x86,
-0x61, 0xB0, 0x6D, 0x83, 0x3E, 0x7F, 0xFF, 0xFF, 0xFF, 0x06, 0x07, 0xC6, 0x61, 0xB0, 0x6D, 0x83,
-0xC3, 0x61, 0x18, 0x46, 0x03, 0x86, 0x18, 0x66, 0x61, 0xB0, 0x6D, 0xC3, 0xFE, 0x7F, 0x9F, 0xE7,
-0xF9, 0xFE, 0x1F, 0xE6, 0x3F, 0x9F, 0xEC, 0xFE, 0x7E, 0x3F, 0x0F, 0xC3, 0xF0, 0xFA, 0x0F, 0xC6,
-0x3F, 0x9F, 0xEC, 0x7E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00,
-0x00, 0x20, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x20, 0x82, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6C, 0xF3, 0xCF, 0x70, 0x9E, 0x79, 0xE7, 0x80, 0x00, 0x00,
-0x00, 0x00, 0x7D, 0x9E, 0x68, 0x20, 0xB2, 0xC8, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x9E,
-0x6F, 0x20, 0xB2, 0xF9, 0xE7, 0x80, 0x00, 0x00, 0x00, 0x00, 0x46, 0x9A, 0x61, 0x20, 0xB2, 0xCB,
-0x60, 0x80, 0x00, 0x00, 0x00, 0x00, 0x7C, 0xF3, 0xCF, 0x30, 0x9E, 0x79, 0xE7, 0x90, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x02, 0x00, 0x00, 0x82, 0x60, 0x00, 0x00,
-0xF8, 0x00, 0x00, 0x40, 0x40, 0x02, 0x00, 0x00, 0x83, 0x60, 0x00, 0x00, 0x8C, 0x00, 0x00, 0x40,
-0x60, 0xB7, 0x79, 0xE7, 0x81, 0xC7, 0x92, 0x70, 0x89, 0xE7, 0x9E, 0x78, 0x7C, 0xE2, 0xC9, 0x2C,
-0x81, 0xCC, 0xD2, 0x40, 0xFB, 0x21, 0xB2, 0x48, 0x40, 0x62, 0xF9, 0x2C, 0x80, 0x8C, 0xD2, 0x40,
-0x8B, 0xE7, 0xB0, 0x48, 0x40, 0xE2, 0xC9, 0x2C, 0x80, 0x84, 0xD2, 0x40, 0x8B, 0x2D, 0x92, 0x48,
-0x7D, 0xB3, 0x79, 0x27, 0x80, 0x87, 0x9E, 0x40, 0x8D, 0xE7, 0x9E, 0x48, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-};
-
-
-int
-main(int argc, char **argv)
-{
-//! [Interesting]
- upm::SSD1327 *lcd = new upm::SSD1327(BUS_NUMBER, 0x3C);
-
- // If you don't set the display to be white, the seeed logo will appear jagged
- lcd->setGrayLevel(12);
- lcd->draw(SeeedLogo, 96 * 96 / 8);
-
- // Simple print hello world
- for (uint8_t i = 0; i < 12; i++)
- {
- lcd->setCursor(i, 0);
- lcd->setGrayLevel(i);
- lcd->write("Hello World");
- }
-
- delete lcd;
-//! [Interesting]
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/ssd1351.cxx b/peripheral/libupm/examples/c++/ssd1351.cxx
deleted file mode 100644
index c0de509..0000000
--- a/peripheral/libupm/examples/c++/ssd1351.cxx
+++ /dev/null
@@ -1,61 +0,0 @@
-#include "mraa.hpp"
-#include <iostream>
-#include <unistd.h>
-
-#include "ssd1351.h"
-
-#define BLACK 0x0000
-#define WHITE 0xFFFF
-#define INTEL_BLUE 0x0BF8
-
-int main(int argc, char **argv)
-{
- // Define colors (16-bit RGB on 5/6/5 bits)
- int colors[] = {0x0000, 0x000F, 0x03E0, 0x03EF,
- 0x7800, 0x780F, 0x7BE0, 0xC618,
- 0x7BEF, 0x001F, 0x07E0, 0x07FF,
- 0xF800, 0xF81F, 0xFFE0, 0xFFFF};
-//! [Interesting]
- // Initialize display with pins
- // oc = 0, dc = 1, r = 2, si = 11, cl = 13
- upm::SSD1351* display = new upm::SSD1351(0, 1, 2);
-
- // Test lines pixel by pixel
- for(int i = 0; i < SSD1351HEIGHT; i++) {
- for(int j = 0; j < SSD1351WIDTH; j++) {
- display->drawPixel(i, j, colors[i/8]);
- }
- }
- display->refresh();
- sleep(5);
-
- // Test rectangles
- for(int i = 0; i < SSD1351HEIGHT/32; i++) {
- for (int j = 0; j < SSD1351WIDTH/32; j++) {
- display->fillRect(i * 32, j * 32, 32, 32, colors[i * 4 + j]);
- }
- }
- display->refresh();
- sleep(5);
-
- // Test circles
- display->fillScreen(0x2104);
- for(int i = 0; i < SSD1351HEIGHT/32; i++) {
- for (int j = 0; j < SSD1351WIDTH/32; j++) {
- display->drawCircle(i * 32 + 15, j * 32 + 15, 15, colors[i * 4 + j]);
- }
- }
- display->refresh();
- sleep(5);
-
- // Test Text
- display->fillScreen(INTEL_BLUE);
- display->setTextColor(WHITE, INTEL_BLUE);
- display->setTextSize(4);
- display->setCursor(7, 30);
- display->print("Intel");
- display->setCursor(5, 70);
- display->print("IoTDK");
- display->refresh();
-//! [Interesting]
-}
diff --git a/peripheral/libupm/examples/c++/st7735.cxx b/peripheral/libupm/examples/c++/st7735.cxx
deleted file mode 100644
index 2c14d49..0000000
--- a/peripheral/libupm/examples/c++/st7735.cxx
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <string.h>
-#include <unistd.h>
-#include <iostream>
-#include "st7735.h"
-#include <signal.h>
-
-int
-main(int argc, char **argv)
-{
-//! [Interesting]
- upm::ST7735 * lcd = new upm::ST7735(7, 4, 9, 8);
- lcd->fillScreen (ST7735_RED);
- lcd->refresh ();
-
- lcd->fillScreen (ST7735_CYAN);
- lcd->refresh ();
-
- lcd->fillScreen (ST7735_BLACK);
- lcd->refresh ();
-
- lcd->drawLine(10, 10, 10, 100, ST7735_MAGENTA);
- lcd->drawLine(20, 20, 10, 100, ST7735_YELLOW);
- lcd->drawLine(30, 30, 50, 100, ST7735_WHITE);
- lcd->refresh ();
-
- lcd->drawPixel (20, 20, ST7735_GREEN);
- lcd->refresh ();
-
- lcd->drawTriangle (50, 50, 80, 80, 60, 90, ST7735_GREEN);
- lcd->refresh ();
-
- lcd->drawCircle (100, 110, 10, ST7735_BLUE);
- lcd->refresh ();
-
-
- lcd->setTextWrap(0x0);
-
- lcd->setCursor(0, 30);
- lcd->setTextColor(ST7735_RED, ST7735_RED);
- lcd->setTextSize(1);
- lcd->print("Hello World!");
-
- lcd->setCursor(10, 50);
- lcd->setTextColor(ST7735_RED, ST7735_YELLOW);
- lcd->setTextSize(2);
- lcd->print("BIG");
-
- lcd->refresh ();
-
- std::cout << "exiting application" << std::endl;
-
- delete lcd;
-//! [Interesting]
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/stepmotor.cxx b/peripheral/libupm/examples/c++/stepmotor.cxx
deleted file mode 100644
index 9357d5d..0000000
--- a/peripheral/libupm/examples/c++/stepmotor.cxx
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Authors: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Mihai Tudor Panu <mihai.tudor.panu@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "stepmotor.h"
-
-using namespace std;
-
-int doWork = 1;
-upm::StepMotor *sensor = NULL;
-
-void
-sig_handler(int signo)
-{
- printf("got signal\n");
- if (signo == SIGINT) {
- printf("exiting application\n");
- doWork = 0;
- }
-}
-
-int
-main(int argc, char **argv)
-{
-//! [Interesting]
- sensor = new upm::StepMotor(2, 3);
-
- while (doWork) {
- cout << "1 Revolution forward and back at 60 rpm" << endl;
- sensor->setSpeed(60);
- sensor->stepForward(200);
- usleep(1000000);
- sensor->stepBackward(200);
- usleep(1000000);
-
- cout << "1 Revolution forward and back at 150 rpm" << endl;
- sensor->setSpeed(150);
- sensor->stepForward(200);
- usleep(1000000);
- sensor->stepBackward(200);
- usleep(1000000);
-
- cout << "1 Revolution forward and back at 300 rpm" << endl;
- sensor->setSpeed(300);
- sensor->stepForward(200);
- usleep (1000000);
- sensor->stepBackward(200);
- usleep (1000000);
- }
-
- delete sensor;
-//! [Interesting]
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/sx1276-fsk.cxx b/peripheral/libupm/examples/c++/sx1276-fsk.cxx
deleted file mode 100644
index f63d1bf..0000000
--- a/peripheral/libupm/examples/c++/sx1276-fsk.cxx
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <stdlib.h>
-#include <iostream>
-#include <signal.h>
-#include "sx1276.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-
-int main(int argc, char **argv)
-{
- signal(SIGINT, sig_handler);
-//! [Interesting]
-
- cout << "Specify an argument to go into receive mode. Default is transmit"
- << endl;
-
- bool rx = false;
- if (argc > 1)
- rx = true;
-
- // Instantiate an SX1276 using default parameters
- upm::SX1276 *sensor = new upm::SX1276();
-
- // 915Mhz
- sensor->setChannel(915000000);
-
- // FSK configuration (rx and tx must be configured the same):
- // Tx output power = 14 dBm
- // FSK freq deviation = 25000 Hz
- // FSK bandwidth = 50000 bps
- // FSK AFC bandwidth = 83333 Hz
- // FSK datarate = 50000 bps
- // FSK preamble len = 5
- // FSK fixed length payload = false
- // FSK CRC check = true
- // FSK (rx) continuous Rx mode = false
-
- sensor->setTxConfig(sensor->MODEM_FSK, 14, 25000, 0,
- 50000, 0, 5, false, true, false, 0, false);
-
- sensor->setRxConfig(sensor->MODEM_FSK, 50000, 50000,
- 0, 83333, 5, 0, false, 0, true,
- false, 0, false, true);
-
- int count = 0;
- int buflen = 64;
- char buffer[buflen];
-
- while (shouldRun)
- {
- if (!rx)
- {
- snprintf(buffer, buflen, "Ping %d", count++);
- cout << "Sending..." << std::string(buffer) << endl;
- sensor->sendStr(string(buffer), 3000);
-
- sensor->setSleep();
- sleep(1);
- }
- else
- {
- // receiving
- cout << "Attempting to receive..." << endl;
- int rv;
- if (rv = sensor->setRx(3000))
- {
- cout << "setRx returned " << rv << endl;
- }
- else
- {
- cout << "Received Buffer: " << sensor->getRxBufferStr() << endl;
- }
-
- // go back to sleep when done
- sensor->setSleep();
- usleep(250000);
- }
-
-
- }
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete sensor;
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/sx1276-lora.cxx b/peripheral/libupm/examples/c++/sx1276-lora.cxx
deleted file mode 100644
index 7c45597..0000000
--- a/peripheral/libupm/examples/c++/sx1276-lora.cxx
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <stdlib.h>
-#include <iostream>
-#include <signal.h>
-#include "sx1276.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-
-int main(int argc, char **argv)
-{
- signal(SIGINT, sig_handler);
-//! [Interesting]
- cout << "Specify an argument to go into receive mode. Default is transmit"
- << endl;
-
- bool rx = false;
- if (argc > 1)
- rx = true;
-
- // Instantiate an SX1276 using default parameters
- upm::SX1276 *sensor = new upm::SX1276();
-
- // 915Mhz
- sensor->setChannel(915000000);
-
- // LORA configuration (rx and tx must be configured the same):
- // Tx output power = 14 dBm
- // LORA bandwidth = 125000 (can also be 250K and 500K)
- // LORA spreading factor = 7
- // LORA coding rate = 1 (4/5)
- // LORA preamble len = 8
- // LORA symbol timeout = 5
- // LORA fixed payload = false
- // LORA IQ inversion = false
- // LORA (rx) continuous Rx mode = true
-
- sensor->setTxConfig(sensor->MODEM_LORA, 14, 0, 125000,
- 7, 1, 8, false, true, false, 0, false);
-
- sensor->setRxConfig(sensor->MODEM_LORA, 125000, 7,
- 1, 0, 8, 5, false, 0, true, false, 0, false, true);
-
- int count = 0;
- int buflen = 64;
- char buffer[buflen];
-
- while (shouldRun)
- {
- if (!rx)
- {
- snprintf(buffer, buflen, "Ping %d", count++);
- cout << "Sending..." << std::string(buffer) << endl;
- sensor->sendStr(string(buffer), 3000);
- sensor->setSleep();
- sleep(1);
- }
- else
- {
- // receiving
- cout << "Attempting to receive..." << endl;
- int rv;
- if (rv = sensor->setRx(3000))
- {
- cout << "setRx returned " << rv << endl;
- }
- else
- {
- cout << "Received Buffer: " << sensor->getRxBufferStr() << endl;
- }
-
- // go back to sleep when done
- sensor->setSleep();
- usleep(5000);
- }
-
-
- }
-
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete sensor;
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/sx6119.cxx b/peripheral/libupm/examples/c++/sx6119.cxx
deleted file mode 100644
index 2608387..0000000
--- a/peripheral/libupm/examples/c++/sx6119.cxx
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "sx6119.h"
-
-using namespace std;
-
-int main (int argc, char **argv)
-{
-//! [Interesting]
- // Instantiate a SX6119 on digital pins 2 (power) and 3 (seek)
- // This example was tested on the Grove FM Receiver.
-
- upm::SX6119* radio = new upm::SX6119(2, 3);
-
- // if an argument was specified (any argument), seek to the next
- // station, else just toggle the power.
-
-
- cout << "Supply any argument to the command line to seek to the" << endl;
- cout << "next station." << endl;
- cout << "Running the example without an argument will toggle the" <<endl;
- cout << "power on or off." << endl;
-
- cout << endl;
-
- bool doSeek = false;
-
- if (argc > 1)
- doSeek = true;
-
- // depending on what was selected, do it
-
- if (doSeek)
- radio->seek();
- else
- radio->togglePower();
-
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete radio;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/t3311.cxx b/peripheral/libupm/examples/c++/t3311.cxx
deleted file mode 100644
index 1859dc6..0000000
--- a/peripheral/libupm/examples/c++/t3311.cxx
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2016 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-
-#include "t3311.h"
-
-using namespace std;
-
-bool shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main(int argc, char **argv)
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
-
- string defaultDev = "/dev/ttyUSB0";
-
- // if an argument was specified, use it as the device instead
- if (argc > 1)
- defaultDev = string(argv[1]);
-
- cout << "Initializing..." << endl;
-
- // Instantiate an T3311 instance, using MODBUS slave address 1, and
- // default comm parameters (9600, 8, N, 2)
- upm::T3311 *sensor = new upm::T3311(defaultDev, 1);
-
- // output the serial number and firmware revision
- cout << "Serial Number: " << sensor->getSerialNumber() << endl;
- cout << "Firmware Revision: " << sensor->getFirmwareMajor()
- << "." << sensor->getFirmwareMinor() << endl;
- cout << endl;
-
- // update and print available values every second
- while (shouldRun)
- {
- // update our values from the sensor
- sensor->update();
-
- // we show both C and F for temperature
- cout << "Temperature: " << sensor->getTemperature()
- << " C / " << sensor->getTemperature(true) << " F"
- << endl;
-
- cout << "Humidity: " << sensor->getHumidity()
- << " %" << endl;
-
- // this value depends on the sensor configuration -- by default
- // it is the dew point temperature
- cout << "Computed Value: " << sensor->getComputedValue() << endl;
-
- // with FW revisions > 2.44, extended computed data is available
- if (sensor->extendedDataAvailable())
- {
- cout << "Dew Point Temperature: " << sensor->getDewPointTemperature()
- << " C / " << sensor->getDewPointTemperature(true) << " F"
- << endl;
-
- cout << "Absolute Humidity: " << sensor->getAbsoluteHumidity()
- << " g/m3" << endl;
-
- cout << "Specific Humidity: " << sensor->getSpecificHumidity()
- << " g/kg" << endl;
-
- cout << "Mixing Ratio: " << sensor->getMixingRatio()
- << " g/kg" << endl;
-
- cout << "Specific Enthalpy: " << sensor->getSpecificEnthalpy()
- << " kJ/kg" << endl;
- }
-
- cout << endl;
-
- sleep(1);
- }
-
- cout << "Exiting..." << endl;
-
- delete sensor;
-
-//! [Interesting]
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/ta12200.cxx b/peripheral/libupm/examples/c++/ta12200.cxx
deleted file mode 100644
index 5f949a1..0000000
--- a/peripheral/libupm/examples/c++/ta12200.cxx
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "ta12200.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-
-int main()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // Instantiate a TA12-200 sensor on analog pin A0
- upm::TA12200* electricity = new upm::TA12200(0);
-
- while (shouldRun)
- {
- unsigned int maxVal = electricity->highestValue();
- float current = electricity->milliAmps(maxVal);
-
- cout << "Max ADC Value: " << maxVal << ", current: " << current
- << "mA" << endl;
- usleep(100000);
- }
-
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete electricity;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/tcs3414cs.cxx b/peripheral/libupm/examples/c++/tcs3414cs.cxx
deleted file mode 100644
index 5e6376e..0000000
--- a/peripheral/libupm/examples/c++/tcs3414cs.cxx
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "tcs3414cs.h"
-#include <signal.h>
-
-int doWork = 0;
-upm::TCS3414CS *sensor = NULL;
-
-void
-sig_handler(int signo)
-{
- printf("got signal\n");
- if (signo == SIGINT) {
- printf("exiting application\n");
- doWork = 1;
- }
-}
-
-int
-main(int argc, char **argv)
-{
- //! [Interesting]
- upm::tcs3414sc_rgb_t rgb;
-
- // Instantiate the color sensor on I2C
- sensor = new upm::TCS3414CS ();
-
- // Print out the r, g, b, and clr value every 0.5 seconds
- while (!doWork) {
- sensor->readRGB (&rgb);
- std::cout << (int)rgb.r << ", " << (int)rgb.g << ", " << (int)rgb.b << ", " << rgb.clr << std::endl;
- usleep (500000);
- }
- //! [Interesting]
-
- std::cout << "exiting application" << std::endl;
-
- delete sensor;
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/th02.cxx b/peripheral/libupm/examples/c++/th02.cxx
deleted file mode 100644
index cce0367..0000000
--- a/peripheral/libupm/examples/c++/th02.cxx
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "th02.h"
-#include <signal.h>
-
-int doWork = 0;
-upm::TH02 *sensor = NULL;
-
-void
-sig_handler(int signo)
-{
- printf("got signal\n");
- if (signo == SIGINT) {
- printf("exiting application\n");
- doWork = 1;
- }
-}
-
-int
-main(int argc, char **argv)
-{
- //! [Interesting]
- float temperature = 0.0;
- float humidity = 0.0;
- sensor = new upm::TH02 ();
-
- while (!doWork) {
- temperature = sensor->getTemperature ();
- humidity = sensor->getHumidity ();
- std::cout << "Temperature = " << temperature << ", Humidity = " << humidity << std::endl;
- usleep (500000);
- }
- //! [Interesting]
-
- std::cout << "exiting application" << std::endl;
-
- delete sensor;
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/tm1637.cxx b/peripheral/libupm/examples/c++/tm1637.cxx
deleted file mode 100644
index 235ae50..0000000
--- a/peripheral/libupm/examples/c++/tm1637.cxx
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Author: Mihai Tudor Panu <mihai.tudor.panu@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 "tm1637.h"
-#include <signal.h>
-#include <unistd.h>
-#include <sstream>
-#include <time.h>
-
-using namespace std;
-using namespace upm;
-
-bool run = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- run = false;
-}
-
-int
-main(int argc, char** argv)
-{
- //! [Interesting]
- bool point = true;
- int timezone = -7; // Your UTC offset
- time_t rawtime;
- struct tm * gmt;
- char myTime[5];
-
- fprintf(stdout, "TM1637 Display Example\n");
- signal(SIGINT, sig_handler);
-
- TM1637 myDisplay = TM1637(0, 1); // TM1637 on pins 0 (clk) and 1 (dio)
- myDisplay.write(0x39, 0x09, 0x09); // Start a box using 7-segment encoding
- myDisplay.writeAt(3, ']'); // Finish box using writeAt function
- sleep(3); // Wait 3 seconds
-
- while(run)
- {
- time(&rawtime); // Update raw time
- gmt = gmtime(&rawtime); // Get current time
-
- int hour = (gmt) ? gmt->tm_hour : 0;
- int min = (gmt) ? gmt->tm_min : 0;
- // Format and store the time in 24 hour format
- snprintf(myTime, 5, "%2d%02d", (hour + timezone + 24) % 24, min);
-
- myDisplay.write(myTime); // Write to display as string
- myDisplay.setColon(point ^= true); // Toggle the dots on the display
- sleep(1); // Only update once every second
- }
-
- //! [Interesting]
- return 0;
-}
-
-
diff --git a/peripheral/libupm/examples/c++/tp401.cxx b/peripheral/libupm/examples/c++/tp401.cxx
deleted file mode 100644
index 255d3f0..0000000
--- a/peripheral/libupm/examples/c++/tp401.cxx
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Author: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-#include <unistd.h>
-#include <iostream>
-#include "tp401.h"
-
-using namespace std;
-
-//! [Interesting]
-// Give a qualitative meaning to the value from the sensor
-std::string
-airQuality(uint16_t value)
-{
- if(value < 50) return "Fresh Air";
- if(value < 200) return "Normal Indoor Air";
- if(value < 400) return "Low Pollution";
- if(value < 600) return "High Pollution - Action Recommended";
- return "Very High Pollution - Take Action Immediately";
-}
-
-int main ()
-{
- upm::TP401* airSensor = new upm::TP401(0); // Instantiate new grove air quality sensor on analog pin A0
-
- cout << airSensor->name() << endl;
-
- fprintf(stdout, "Heating sensor for 3 minutes...\n");
- // wait 3 minutes for sensor to warm up
- for(int i = 0; i < 3; i++) {
- if(i) {
- fprintf(stdout, "Please wait, %d minute(s) passed..\n", i);
- }
- sleep(60);
- }
- fprintf(stdout, "Sensor ready!\n");
-
- while(true) {
- uint16_t value = airSensor->getSample(); // Read raw value
- float ppm = airSensor->getPPM(); // Read CO ppm (can vary slightly from previous read)
- fprintf(stdout, "raw: %4d ppm: %5.2f %s\n", value, ppm, airQuality(value).c_str());
- usleep(2500000); // Sleep for 2.5s
- }
-
- delete airSensor;
- return 0;
-}
-//! [Interesting]
diff --git a/peripheral/libupm/examples/c++/tsl2561.cxx b/peripheral/libupm/examples/c++/tsl2561.cxx
deleted file mode 100644
index 14ddb8a..0000000
--- a/peripheral/libupm/examples/c++/tsl2561.cxx
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Author: Nandkishor Sonar <Nandkishor.Sonar@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * LIGHT-TO-DIGITAL CONVERTER [TAOS-TSL2561]
- *
- * 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 "tsl2561.h"
-
-int main (int argc, char **argv)
-{
- mraa_result_t error = MRAA_SUCCESS;
- upm::TSL2561 *sensor = NULL;
- int loopCount = 100;
-
-//! [Interesting]
- if (argc < 2) {
- printf("Provide loop count \n");
- } else {
- loopCount = atoi(argv[1]);
- }
- sensor = new upm::TSL2561();
-
- for(int i=0; i< loopCount; i++){
- fprintf(stdout, "Lux = %d\n", sensor->getLux());
- }
-
-//! [Interesting]
-
- delete(sensor);
-
- return (0);
-}
diff --git a/peripheral/libupm/examples/c++/ttp223.cxx b/peripheral/libupm/examples/c++/ttp223.cxx
deleted file mode 100644
index 1d15585..0000000
--- a/peripheral/libupm/examples/c++/ttp223.cxx
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Author: Sarah Knepper <sarah.knepper@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "ttp223.h"
-
-int
-main(int argc, char **argv)
-{
- // This example uses GPIO 0
-//! [Interesting]
-
- // Create the TTP223 touch sensor object using GPIO pin 0
- upm::TTP223* touch = new upm::TTP223(0);
-
- // Check whether or not a finger is near the touch sensor and
- // print accordingly, waiting one second between readings
- while( 1 ) {
- if ( touch->isPressed() ) {
- std::cout << touch->name() << " is pressed" << std::endl;
- } else {
- std::cout << touch->name() << " is not pressed" << std::endl;
- }
- sleep(1);
- }
-
- // Delete the touch sensor object
- delete touch;
-//! [Interesting]
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/ublox6.cxx b/peripheral/libupm/examples/c++/ublox6.cxx
deleted file mode 100644
index a0cd5f2..0000000
--- a/peripheral/libupm/examples/c++/ublox6.cxx
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "ublox6.h"
-
-using namespace std;
-
-bool shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-const size_t bufferLength = 256;
-
-int main (int argc, char **argv)
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // Instantiate a Ublox6 GPS device on uart 0.
- upm::Ublox6* nmea = new upm::Ublox6(0);
-
- // make sure port is initialized properly. 9600 baud is the default.
- if (!nmea->setupTty(B9600))
- {
- cerr << "Failed to setup tty port parameters" << endl;
- return 1;
- }
-
- // Collect and output NMEA data. There are various libraries out on
- // the Internet, such as tinyGPS or tinyGPS++ that can handle
- // decoding NMEA data and presenting it in a more easily accessible
- // format. This example will just check for, and read raw NMEA data
- // from the device and output it on stdout.
-
- // This device also supports numerous configuration options, which
- // you can set with writeData(). Please refer to the Ublox-6 data
- // sheet for further information on the formats of the data sent and
- // received, and the various operating modes available.
-
- char nmeaBuffer[bufferLength];
- while (shouldRun)
- {
- // we don't want the read to block in this example, so always
- // check to see if data is available first.
- if (nmea->dataAvailable())
- {
- int rv = nmea->readData(nmeaBuffer, bufferLength);
-
- if (rv > 0)
- write(1, nmeaBuffer, rv);
-
- if (rv < 0) // some sort of read error occured
- {
- cerr << "Port read error." << endl;
- break;
- }
-
- continue;
- }
-
- usleep(100000); // 100ms
- }
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete nmea;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/uln200xa.cxx b/peripheral/libupm/examples/c++/uln200xa.cxx
deleted file mode 100644
index 53a6958..0000000
--- a/peripheral/libupm/examples/c++/uln200xa.cxx
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "uln200xa.h"
-
-using namespace std;
-
-int main ()
-{
- //! [Interesting]
-
- // Instantiate a Stepper motor on a ULN200XA Dual H-Bridge.
-
- // This was tested with the Grove Gear Stepper Motor with Driver
-
- // Wire the pins so that I1 is pin D8, I2 is pin D9, I3 is pin D10 and
- // I4 is pin D11
- upm::ULN200XA* uln200xa = new upm::ULN200XA(4096, 8, 9, 10, 11);
-
- uln200xa->setSpeed(5);
- uln200xa->setDirection(upm::ULN200XA::DIR_CW);
- cout << "Rotating 1 revolution clockwise." << endl;
- uln200xa->stepperSteps(4096);
- cout << "Sleeping for 2 seconds..." << endl;
- sleep(2);
- cout << "Rotating 1/2 revolution counter clockwise." << endl;
- uln200xa->setDirection(upm::ULN200XA::DIR_CCW);
- uln200xa->stepperSteps(2048);
-
- // turn off the power
- uln200xa->release();
-
- //! [Interesting]
- cout << "Exiting..." << endl;
-
- delete uln200xa;
- return 0;
-}
-
diff --git a/peripheral/libupm/examples/c++/urm37-uart.cxx b/peripheral/libupm/examples/c++/urm37-uart.cxx
deleted file mode 100644
index 7a94a1f..0000000
--- a/peripheral/libupm/examples/c++/urm37-uart.cxx
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "urm37.h"
-
-using namespace std;
-
-bool shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
-
- // Instantiate a URM37 sensor on UART 0, with the reset pin on D2
- upm::URM37 *sensor = new upm::URM37(0, 2);
-
- // Every half a second, sample the URM37 and output the measured
- // distance in cm, and temperature in degrees C
-
- while (shouldRun)
- {
- cout << "Detected distance (cm): " << sensor->getDistance() << endl;
- cout << "Temperature (C): " << sensor->getTemperature() << endl;
-
- usleep(500000);
- }
-
-//! [Interesting]
-
- cout << "Exiting" << endl;
-
- delete sensor;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/urm37.cxx b/peripheral/libupm/examples/c++/urm37.cxx
deleted file mode 100644
index 820b2a1..0000000
--- a/peripheral/libupm/examples/c++/urm37.cxx
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "urm37.h"
-
-using namespace std;
-
-bool shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
-
- // Instantiate a URM37 sensor on analog pin A0, reset pin on D2,
- // trigger pin on D3 with an analog reference voltage of 5.0
- upm::URM37 *sensor = new upm::URM37(0, 2, 3, 5.0);
-
- // Every half a second, sample the URM37 and output the measured
- // distance in cm.
-
- while (shouldRun)
- {
- cout << "Detected distance (cm): " << sensor->getDistance() << endl;
- usleep(500000);
- }
-
-//! [Interesting]
-
- cout << "Exiting" << endl;
-
- delete sensor;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/waterlevel.cxx b/peripheral/libupm/examples/c++/waterlevel.cxx
deleted file mode 100644
index d3a069f..0000000
--- a/peripheral/libupm/examples/c++/waterlevel.cxx
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-#include <iostream>
-#include <unistd.h>
-#include <signal.h>
-#include "waterlevel.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main(int argc, char **argv)
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // The was tested with the Water Level Sensor
- // Instantiate a Water Level Sensor on digital pin D2
- upm::WaterLevel* waterlevel = new upm::WaterLevel(2);
-
- while (shouldRun)
- {
- if (waterlevel->isSubmerged())
- cout << "Sensor is submerged in liquid" << endl;
- else
- cout << "Liquid is below water level sensor" << endl;
- sleep(1);
- }
-
-//! [Interesting]
- cout << "Exiting" << endl;
-
- delete waterlevel;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/wheelencoder.cxx b/peripheral/libupm/examples/c++/wheelencoder.cxx
deleted file mode 100644
index 08a7825..0000000
--- a/peripheral/libupm/examples/c++/wheelencoder.cxx
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "wheelencoder.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-
-int main()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // Instantiate a DFRobot Wheel Encoder on digital pin D2
- upm::WheelEncoder* sensor = new upm::WheelEncoder(2);
-
- // set the counter to 0 and start counting
- sensor->clearCounter();
- sensor->startCounter();
-
- while (shouldRun)
- {
- // output milliseconds passed and current sensor count
- cout << "Millis: " << sensor->getMillis() << " Count: "
- << sensor->counter() << endl;
-
- sleep(1);
- }
-
- sensor->stopCounter();
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete sensor;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/wt5001.cxx b/peripheral/libupm/examples/c++/wt5001.cxx
deleted file mode 100644
index 317e877..0000000
--- a/peripheral/libupm/examples/c++/wt5001.cxx
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "wt5001.h"
-
-using namespace std;
-
-void printUsage(char *progname)
-{
- cout << "Usage:" << progname << " <command>" << endl;
- cout << "Commands:" << endl;
- cout << "0 - stop playing" << endl;
- cout << "1 - start playing track 1" << endl;
- cout << "2 - pause/un-pause playback" << endl;
- cout << "3 - next track" << endl;
- cout << "4 - previous track" << endl;
-}
-
-int main (int argc, char **argv)
-{
-//! [Interesting]
- // Instantiate a WT5001 serial MP3 player on uart 0.
- // This example was tested on the Grove Serial MP3 module.
-
- upm::WT5001* mp3 = new upm::WT5001(0);
-
- int cmd = -1;
- if (argc > 1)
- cmd = atoi(argv[1]);
-
- // make sure port is initialized properly. 9600 baud is the default.
- if (!mp3->setupTty(B9600))
- {
- cerr << "Failed to setup tty port parameters" << endl;
- return 1;
- }
-
- switch (cmd)
- {
- case 0:
- mp3->stop();
- break;
-
- case 1:
- mp3->play(upm::WT5001::SD, 1);
- break;
-
- case 2:
- mp3->pause();
- break;
-
- case 3:
- mp3->next();
- break;
-
- case 4:
- mp3->previous();
- break;
-
- default:
- // nothing, just output usage, and info below
- printUsage(argv[0]);
- break;
- }
-
- // Example: set the date
- // mp3->setDate(2015, 1, 1);
-
- // Example: set the time
- // mp3->setTime(12, 30, 30);
-
- // print out some information
- uint8_t vol = 0;
- if (mp3->getVolume(&vol))
- cout << "The current volume is: " << int(vol) << endl;
-
- uint8_t ps = 0;
- if (mp3->getPlayState(&ps))
- cout << "The current play state is: " << int(ps) << endl;
-
- uint16_t numf = 0;
- if (mp3->getNumFiles(upm::WT5001::SD, &numf))
- cout << "The number of files on the SD card is: " << int(numf) << endl;
-
- uint16_t curf = 0;
- if (mp3->getCurrentFile(&curf))
- cout << "The current file is: " << int(curf) << endl;
-
- uint16_t year = 0;
- uint8_t month = 0, day = 0;
- if (mp3->getDate(&year, &month, &day))
- cout << "The device date is: " << int(month) << "/" << int(day)
- << "/" << int(year) << endl;
-
- uint8_t hour = 0, minute = 0, second = 0;
- if (mp3->getTime(&hour, &minute, &second))
- cout << "The device time is: " << int(hour) << ":" << int(minute)
- << ":" << int(second) << endl;
-
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete mp3;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/xbee.cxx b/peripheral/libupm/examples/c++/xbee.cxx
deleted file mode 100644
index 834d8bc..0000000
--- a/peripheral/libupm/examples/c++/xbee.cxx
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include <stdio.h>
-#include "xbee.h"
-
-using namespace std;
-using namespace upm;
-
-void printUsage(char *progname)
-{
- cout << "Usage: " << progname << " [AT command]" << endl;
- cout << endl;
-
- cout << "If an argument is supplied on the command line, that argument is"
- << endl;
- cout << "sent to the module and the response is printed out." << endl;
- cout << endl;
- cout << "If no argument is used, then the firmware revision, serial number"
- << endl;
- cout << "and the current IP address (if set) are queried." << endl;
- cout << endl;
- cout << endl;
-}
-
-//! [Interesting]
-
-// simple helper function to send a command and wait for a response
-void sendCommand(upm::XBee* sensor, string cmd)
-{
- // commands need to be terminated with a carriage return
- cmd += "\r";
-
- sensor->writeDataStr(cmd);
-
- string resp;
- while (sensor->dataAvailable(2000))
- {
- resp += sensor->readDataStr(1024);
- }
-
- if (resp.empty())
- {
- cerr << "Timed out waiting for response" << endl;
- return;
- }
-
- resp = sensor->stringCR2LF(resp);
- cout << "Returned (" << resp.size() << " bytes): " << endl;
- cout << resp << endl;
-}
-
-int main(int argc, char **argv)
-{
-
- // Instantiate a XBee Module on UART 0
- upm::XBee* sensor = new upm::XBee(0);
-
- // Set the baud rate, 9600 baud is the default.
- if (sensor->setBaudRate(9600))
- {
- cerr << "Failed to set tty baud rate" << endl;
- return 1;
- }
-
- printUsage(argv[0]);
-
- if (argc > 1)
- {
- // enable command mode
- sensor->commandMode();
- cout << "Sending command line argument (" << argv[1] << ")..." << endl;
- sendCommand(sensor, argv[1]);
- }
- else
- {
- // enable command mode
- sensor->commandMode();
- // query the verbose firmware revision
- cout << "Querying verbose firmware revision (ATVL)..." << endl;
- sendCommand(sensor, "ATVL");
- // query the number
- cout << "Querying Serial Number High (ATSH)..." << endl;
- sendCommand(sensor, "ATSH");
- cout << "Querying Serial Number Low (ATSL)..." << endl;
- sendCommand(sensor, "ATSL");
-
- cout << "Querying address, if set (ATMY)..." << endl;
- sendCommand(sensor, "ATMY");
-
- // For the XBee WiFi S6B
- // A comprehensive list of commands and command modes is
- // available from the datasheet at:
- // ftp1.digi.com/support/documentation/90002180_L.pdf
-
- // For the XBee S1
- // A comprehensive list of commands and command modes is
- // available from the datasheet at:
- // http://www.sparkfun.com/datasheets/Wireless/Zigbee/XBee-Datasheet.pdf
-
- // For the XBee WiFi module:
- // An example using AT commands to connect to an AP, with a
- // private Key using WPA2:
-
- // Connect to AP with SSID 'mySSID':
- // ATIDmySSID
-
- // Provide the private key 'secret':
- // ATPKsecret
-
- // Use WPA2 encryption
- // ATEE2
-
- }
-
-
- delete sensor;
- return 0;
-}
-
-//! [Interesting]
diff --git a/peripheral/libupm/examples/c++/yg1006.cxx b/peripheral/libupm/examples/c++/yg1006.cxx
deleted file mode 100644
index 07dbfb5..0000000
--- a/peripheral/libupm/examples/c++/yg1006.cxx
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "yg1006.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-
-int main ()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // Instantiate a yg1006 flame sensor on digital pin D2
- upm::YG1006* flame = new upm::YG1006(2);
-
- // check every second for the presence of a flame
- while (shouldRun)
- {
- bool val = flame->flameDetected();
- if (val)
- cout << "Flame detected." << endl;
- else
- cout << "No flame detected." << endl;
-
- sleep(1);
- }
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete flame;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/zfm20-register.cxx b/peripheral/libupm/examples/c++/zfm20-register.cxx
deleted file mode 100644
index fb1292c..0000000
--- a/peripheral/libupm/examples/c++/zfm20-register.cxx
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "zfm20.h"
-
-using namespace std;
-using namespace upm;
-
-int main (int argc, char **argv)
-{
-//! [Interesting]
- // Instantiate a ZFM20 Fingerprint reader on UART 0
-
- upm::ZFM20* fp = new upm::ZFM20(0);
-
- // make sure port is initialized properly. 57600 baud is the default.
- if (!fp->setupTty(B57600))
- {
- cerr << "Failed to setup tty port parameters" << endl;
- return 1;
- }
-
- // This example demonstrates registering a fingerprint on the zfm20
- // module. The procedure is as follows:
- //
- // 1. get an image, store it in characteristics buffer 1
- // 2. get another image, store it in characteristics buffer 2
- // 3. store the image, assuming the two fingerprints match
-
- // first, we need to register our address and password
-
- fp->setPassword(ZFM20_DEFAULT_PASSWORD);
- fp->setAddress(ZFM20_DEFAULT_ADDRESS);
-
- // now verify the password. If this fails, any other commands
- // will be ignored, so we just bail.
- if (fp->verifyPassword())
- {
- cout << "Password verified." << endl;
- }
- else
- {
- cerr << "Password verification failed." << endl;
- return 1;
- }
-
- cout << endl;
-
- uint8_t rv;
- // get the first image
-
- cout << "Place a finger on the sensor." << endl;
- while (fp->generateImage() != ZFM20::ERR_OK)
- ;
-
- // in theory, we have an image
- cout << "Image captured, converting..." << endl;
-
- if ((rv = fp->image2Tz(1)) != ZFM20::ERR_OK)
- {
- cerr << "Image conversion failed with error code " << int(rv) <<endl;
- return 1;
- }
-
- cout << "Image conversion succeeded, remove finger." << endl;
- sleep(1);
-
- while (fp->generateImage() != ZFM20::ERR_NO_FINGER)
- ;
-
- cout << endl;
- cout << "Now place the same finger on the sensor." << endl;
-
- while (fp->generateImage() != ZFM20::ERR_OK)
- ;
-
- cout << "Image captured, converting..." << endl;
-
- // save this one in slot 2
- if ((rv = fp->image2Tz(2)) != ZFM20::ERR_OK)
- {
- cerr << "Image conversion failed with error code " << int(rv) <<endl;
- return 1;
- }
-
- cout << "Image conversion succeeded, remove finger." << endl;
- cout << endl;
-
- cout << "Storing fingerprint at id 1" << endl;
-
- // create the model
- if ((rv = fp->createModel()) != ZFM20::ERR_OK)
- {
- if (rv == ZFM20::ERR_FP_ENROLLMISMATCH)
- cerr << "Fingerprints did not match." << endl;
- else
- cerr << "createModel failed with error code " << int(rv) <<endl;
-
- return 1;
- }
-
- // now store it, we hard code the id (second arg) to 1 here
- if ((rv = fp->storeModel(1, 1)) != ZFM20::ERR_OK)
- {
- cerr << "storeModel failed with error code " << int(rv) <<endl;
- return 1;
- }
-
- cout << endl;
- cout << "Fingerprint stored at id 1." << endl;
-
-//! [Interesting]
-
- delete fp;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/zfm20.cxx b/peripheral/libupm/examples/c++/zfm20.cxx
deleted file mode 100644
index a7323b0..0000000
--- a/peripheral/libupm/examples/c++/zfm20.cxx
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "zfm20.h"
-
-using namespace std;
-using namespace upm;
-
-int main (int argc, char **argv)
-{
-//! [Interesting]
- // Instantiate a ZFM20 Fingerprint reader on UART 0
-
- upm::ZFM20* fp = new upm::ZFM20(0);
-
- // make sure port is initialized properly. 57600 baud is the default.
- if (!fp->setupTty(B57600))
- {
- cerr << "Failed to setup tty port parameters" << endl;
- return 1;
- }
-
- // first, set the default password and address
- fp->setPassword(ZFM20_DEFAULT_PASSWORD);
- fp->setAddress(ZFM20_DEFAULT_ADDRESS);
-
- // now verify the password. If this fails, any other commands
- // will be ignored, so we just bail.
- if (fp->verifyPassword())
- {
- cout << "Password verified." << endl;
- }
- else
- {
- cerr << "Password verification failed." << endl;
- return 1;
- }
-
- // how many valid stored templates (fingerprints) do we have?
- cout << "Total stored templates: " << fp->getNumTemplates() << endl;
- cout << endl;
-
- // now spin waiting for a fingerprint to successfully image
- cout << "Waiting for finger print..." << endl;
-
- while (fp->generateImage() == ZFM20::ERR_NO_FINGER)
- ;
-
- // in theory, we have an image
- cout << "Image captured, converting..." << endl;
-
- uint8_t rv;
- if ((rv = fp->image2Tz(1)) != ZFM20::ERR_OK)
- {
- cerr << "Image conversion failed with error code " << int(rv) <<endl;
- return 1;
- }
-
- cout << "Image conversion succeeded." << endl;
- cout << "Searching database..." << endl;
-
- uint16_t id = 0;
- uint16_t score = 0;
-
- // we search for a print matching slot 1, where we shored our last
- // converted fingerprint
- if ((rv = fp->search(1, &id, &score)) != ZFM20::ERR_OK)
- {
- if (rv == ZFM20::ERR_FP_NOTFOUND)
- {
- cout << "Finger Print not found" << endl;
- return 0;
- }
- else
- {
- cerr << "Search failed with error code " << int(rv) <<endl;
- return 1;
- }
- }
-
- cout << "Fingerprint found!" << endl;
- cout << "ID: " << int(id) << ", Score: " << int(score) << endl;
-
-//! [Interesting]
-
- delete fp;
- return 0;
-}
diff --git a/peripheral/libupm/examples/java/A110XSample.java b/peripheral/libupm/examples/java/A110XSample.java
deleted file mode 100644
index 18d17bc..0000000
--- a/peripheral/libupm/examples/java/A110XSample.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-public class A110XSample {
-
- public static void main(String[] args) throws InterruptedException {
- //! [Interesting]
- // Instantiate an A110X sensor on digital pin D2
- upm_a110x.A110X hall = new upm_a110x.A110X(2);
-
- // check every second for the presence of a magnetic field (south polarity)
- while(true){
- if(hall.magnetDetected())
- System.out.println("Magnet (south polarity) detected.");
- else
- System.out.println("No magnet detected.");
-
- Thread.sleep(1000);
- }
- //! [Interesting]
- }
-}
diff --git a/peripheral/libupm/examples/java/A110X_intrSample.java b/peripheral/libupm/examples/java/A110X_intrSample.java
deleted file mode 100644
index 53d23a5..0000000
--- a/peripheral/libupm/examples/java/A110X_intrSample.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-public class A110X_intrSample {
-
- public static int counter=0;
-
- public static void main(String[] args) throws InterruptedException {
- //! [Interesting]
- // Instantiate an A110X sensor on digital pin D2
- upm_a110x.A110X hall = new upm_a110x.A110X(2);
-
- // This example uses a user-supplied interrupt handler to count
- // pulses that occur when a magnetic field of the correct polarity
- // is detected. This could be used to measure the rotations per
- // minute (RPM) of a rotor for example.
-
- A110XISR callback = new A110XISR();
- hall.installISR(callback);
-
- while(true){
- System.out.println("Counter: " + counter);
- Thread.sleep(1000);
- }
- //! [Interesting]
- }
-}
-
-class A110XISR implements Runnable {
- public A110XISR(){
- super();
- }
- public void run(){
- A110X_intrSample.counter++;
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/ADC121C021Sample.java b/peripheral/libupm/examples/java/ADC121C021Sample.java
deleted file mode 100644
index 5e34cd4..0000000
--- a/peripheral/libupm/examples/java/ADC121C021Sample.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-//NOT TESTED!!!
-public class ADC121C021Sample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Instantiate an ADC121C021 on I2C bus 0
- upm_adc121c021.ADC121C021 adc = new upm_adc121c021.ADC121C021(0);
-
- // An analog sensor, such as a Grove light sensor,
- // must be attached to the adc·
- // Prints the value and corresponding voltage every 50 milliseconds
- while (true) {
- int val = adc.value();
-
- System.out.println("ADC value: " + val + "Volts = " + adc.valueToVolts(val));
-
- Thread.sleep(1000);
- }
- // ! [Interesting]
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/Ad8232Example.java b/peripheral/libupm/examples/java/Ad8232Example.java
deleted file mode 100644
index 3b6102b..0000000
--- a/peripheral/libupm/examples/java/Ad8232Example.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
-* Author: Abhishek Malik <abhishek.malik@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 upm_ad8232.AD8232;
-
-public class Ad8232Example {
-
- static {
- try {
- System.loadLibrary("javaupm_ad8232");
- 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) {
- // TODO Auto-generated method stub
- //! [Interesting]
- // Instantiate a Ad8232 sensor on digital pins 10 (LO+), 11 (LO-)
- // and an analog pin, 0 (OUTPUT)
- AD8232 ad8232 = new AD8232(10, 11, 0);
- while(true){
- // Output the raw numbers from the ADC, for plotting elsewhere.
- // A return of 0 indicates a Lead Off (LO) condition.
- // In theory, this data could be fed to software like Processing
- // (https://www.processing.org/) to plot the data just like an
- // EKG you would see in a hospital.
- System.out.println(ad8232.value());
- try {
- Thread.sleep(1);
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- System.out.println("The following error has occured: "+e.getMessage());
- }
- }
- }
-
-}
diff --git a/peripheral/libupm/examples/java/Adxl345Sample.java b/peripheral/libupm/examples/java/Adxl345Sample.java
deleted file mode 100644
index 028f658..0000000
--- a/peripheral/libupm/examples/java/Adxl345Sample.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-//NOT TESTED!!!
-public class Adxl345Sample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- short[] val;
- float[] accel;
-
- // Note: Sensor only works at 3.3V on the Intel Edison with Arduino
- // breakout
- upm_adxl345.Adxl345 sensor = new upm_adxl345.Adxl345(0);
-
- while (true) {
- sensor.update();
- val = sensor.getRawValues();
- accel = sensor.getAcceleration();
-
- System.out.println("Current scale: " + sensor.getScale());
- System.out.println("Raw Values: X: " + val[0] + " Y: " + val[1] + " Z: " + val[2]);
- System.out.println("Acceleration: X: " + accel[0] + "g Y: " + accel[1] + "g Z: "
- + accel[2] + "g");
-
- Thread.sleep(1000);
- }
- // ! [Interesting]
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/Apds9002.java b/peripheral/libupm/examples/java/Apds9002.java
deleted file mode 100644
index 4bb5de8..0000000
--- a/peripheral/libupm/examples/java/Apds9002.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Author: Abhishek Malik <abhishek.malik@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 upm_apds9002.APDS9002;
-
-public class Apds9002 {
-
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- //! [Interesting]
- // Instantiate the APDS9002 (Grove luminance sensor) on the Analog pin A0
- APDS9002 lum = new APDS9002(0);
-
- while(true){
- System.out.println("The Luminance value is : "+lum.value());
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- System.out.println("The following exception occured: "+e.getMessage());
- }
- }
- //! [Interesting]
- }
-
-}
diff --git a/peripheral/libupm/examples/java/BISS0001Sample.java b/peripheral/libupm/examples/java/BISS0001Sample.java
deleted file mode 100644
index eaacacf..0000000
--- a/peripheral/libupm/examples/java/BISS0001Sample.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-public class BISS0001Sample{
-
- public static void main(String[] args) throws InterruptedException {
-//! [Interesting]
- // Instantiate a Grove Motion sensor on GPIO pin D7
- upm_biss0001.BISS0001 motion = new upm_biss0001.BISS0001(7);
-
- while (true) {
- boolean value = motion.value();
-
- if(value)
- System.out.println("Detecting moving object");
- else
- System.out.println("No moving objects detected");
-
- Thread.sleep(1000);
- }
-//! [Interesting]
- }
-
-}
diff --git a/peripheral/libupm/examples/java/BMPX8XSample.java b/peripheral/libupm/examples/java/BMPX8XSample.java
deleted file mode 100644
index c803121..0000000
--- a/peripheral/libupm/examples/java/BMPX8XSample.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-//NOT TESTED!!!
-public class BMPX8XSample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Instantiate a BMPX8X sensor on I2C
- upm_bmpx8x.BMPX8X sensor = new upm_bmpx8x.BMPX8X(0);
-
- // Print the pressure, altitude, sea level, and
- // temperature values every second
- while (true) {
- System.out.println("Pressure: " + sensor.getPressure());
- System.out.println("Altitude: " + sensor.getAltitude());
- System.out.println("Sealevel pressure: "
- + sensor.getSealevelPressure());
- System.out.println("Temperature: " + sensor.getTemperature());
- System.out.println();
-
- Thread.sleep(1000);
- }
- // ! [Interesting]
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/BuzzerSample.java b/peripheral/libupm/examples/java/BuzzerSample.java
deleted file mode 100644
index e94be7f..0000000
--- a/peripheral/libupm/examples/java/BuzzerSample.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-public class BuzzerSample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- int chord[] = {
- upm_buzzer.javaupm_buzzer.DO,
- upm_buzzer.javaupm_buzzer.RE,
- upm_buzzer.javaupm_buzzer.MI,
- upm_buzzer.javaupm_buzzer.FA,
- upm_buzzer.javaupm_buzzer.SOL,
- upm_buzzer.javaupm_buzzer.LA,
- upm_buzzer.javaupm_buzzer.SI};
-
- // Instantiate a buzzer on digital pin D5
- upm_buzzer.Buzzer sound = new upm_buzzer.Buzzer(5);
-
- // print sensor name
- System.out.println(sound.name());
-
- for (int i = 0; i < chord.length; i++) {
- // play each note for one second
- int note = sound.playSound(chord[i], 1000000);
- System.out.println(note);
-
- Thread.sleep(100);
- }
- // ! [Interesting]
- sound.stopSound();
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/Buzzer_soundSample.java b/peripheral/libupm/examples/java/Buzzer_soundSample.java
deleted file mode 100644
index 576d888..0000000
--- a/peripheral/libupm/examples/java/Buzzer_soundSample.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-public class Buzzer_soundSample {
-
- public static void main(String[] args) throws InterruptedException {
- //! [Interesting]
- int chord[] = {
- upm_buzzer.javaupm_buzzer.DO,
- upm_buzzer.javaupm_buzzer.RE,
- upm_buzzer.javaupm_buzzer.MI,
- upm_buzzer.javaupm_buzzer.FA,
- upm_buzzer.javaupm_buzzer.SOL,
- upm_buzzer.javaupm_buzzer.LA,
- upm_buzzer.javaupm_buzzer.SI
- };
-
- // Instantiate a buzzer on digital pin D5
- upm_buzzer.Buzzer sound = new upm_buzzer.Buzzer(5);
-
- // print sensor name
- System.out.println(sound.name());
-
- for (int i = 0; i < chord.length; i++) {
- // play each note for one second
- int note = sound.playSound( chord[i], 1000000);
- System.out.println(note);
-
- Thread.sleep(100);
- }
- //! [Interesting]
- sound.stopSound();
- }
-
-
-}
diff --git a/peripheral/libupm/examples/java/CJQ4435Sample.java b/peripheral/libupm/examples/java/CJQ4435Sample.java
deleted file mode 100644
index 333c20e..0000000
--- a/peripheral/libupm/examples/java/CJQ4435Sample.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-public class CJQ4435Sample {
-
- public static void main(String[] args) throws InterruptedException {
- // Instantiate a CJQ4435 MOSFET on a PWM capable digital pin D3
- upm_cjq4435.CJQ4435 mosfet = new upm_cjq4435.CJQ4435(3);
-
- mosfet.setPeriodMS(10);
- mosfet.enable(true);
-
- while (true) {
- // start with a duty cycle of 0.0 (off) and increment to 1.0 (on)
- for (float i = 0; i <= 1; i += 0.1) {
- mosfet.setDutyCycle(i);
- Thread.sleep(100);
- }
- Thread.sleep(1000);
-
- // Now take it back down
- // start with a duty cycle of 1.0 (on) and decrement to 0.0 (off)
- for (float i = 1; i >= 0; i -= 0.1) {
- mosfet.setDutyCycle(i);
- Thread.sleep(100);
- }
- Thread.sleep(1000);
- }
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/CMakeLists.txt b/peripheral/libupm/examples/java/CMakeLists.txt
deleted file mode 100644
index 95d187a..0000000
--- a/peripheral/libupm/examples/java/CMakeLists.txt
+++ /dev/null
@@ -1,116 +0,0 @@
-find_package(Java REQUIRED)
-include(UseJava)
-
-macro(add_example example_name jar_name)
- set(example_src "${example_name}.java")
- set(example_jar "${CMAKE_CURRENT_BINARY_DIR}/../../src/${jar_name}/upm_${jar_name}.jar")
-
- add_jar(${example_name} SOURCES ${example_src} INCLUDE_JARS ${example_jar})
-endmacro()
-
-macro(add_example_with_path example_name jar_path)
- set(example_src "${example_name}.java")
- set(example_jar "${CMAKE_CURRENT_BINARY_DIR}/../../src/${jar_path}")
-
- add_jar(${example_name} SOURCES ${example_src} INCLUDE_JARS ${example_jar})
-endmacro()
-
-add_example(A110X_intrSample a110x)
-add_example(A110XSample a110x)
-add_example(ADC121C021Sample adc121c021)
-add_example(Adxl345Sample adxl345)
-add_example(Apds9002 apds9002)
-add_example(BISS0001Sample biss0001)
-add_example(BMPX8XSample bmpx8x)
-add_example(BuzzerSample buzzer)
-add_example(Buzzer_soundSample buzzer)
-add_example(CJQ4435Sample cjq4435)
-add_example(DS1307Sample ds1307)
-add_example(ENC03RSample enc03r)
-add_example(ES08ASample servo)
-add_example(GroveButtonSample grove)
-add_example(GroveButton_intrSample grove)
-add_example(GroveCollision grovecollision)
-add_example(GroveEHRSample groveehr)
-add_example(GroveEmg groveemg)
-add_example(GroveGsr grovegsr)
-add_example(GroveLed_multiSample grove)
-add_example(GroveLEDSample grove)
-add_example(GroveLightSample grove)
-add_example(GroveLineFinderSample grovelinefinder)
-add_example(GroveMDSample grovemd)
-add_example(GroveMoistureSample grovemoisture)
-add_example(GroveMQ3 gas)
-add_example(GroveMQ9 gas)
-add_example(GroveO2Example groveo2)
-add_example(GroveQTouch at42qt1070)
-add_example(GroveRelaySample grove)
-add_example(GroveRotarySample grove)
-add_example(GROVESCAMSample grovescam)
-add_example(GroveSlideSample grove)
-add_example(GroveSpeakerSample grovespeaker)
-add_example(GroveTempSample grove)
-add_example(GroveVDivSample grovevdiv)
-add_example(GroveWaterSample grovewater)
-add_example(GroveWFSSample grovewfs)
-add_example(GUVAS12DSample guvas12d)
-add_example(H3LIS331DLSample h3lis331dl)
-add_example(HCSR04Sample hcsr04)
-add_example(HM11Sample hm11)
-add_example(Hmc5883lSample hmc5883l)
-add_example(HMTRPSample hmtrp)
-add_example(HP20xExample hp20x)
-add_example(HTU21DSample htu21d)
-add_example(Itg3200Sample itg3200)
-add_example(Joystick12Sample joystick12)
-add_example(LDT0028Sample ldt0028)
-add_example(LoLSample lol)
-add_example(LSM303Sample lsm303)
-add_example(M24LR64ESample m24lr64e)
-add_example(MAX44000Sample max44000)
-add_example(MHZ16Sample mhz16)
-add_example(MicrophoneSample mic)
-add_example(MMA7455Sample mma7455)
-add_example(MMA7660Sample mma7660)
-add_example(MPL3115A2Sample mpl3115a2)
-add_example(MPR121Sample mpr121)
-add_example(MPU9150Sample mpu9150)
-add_example(MQ2Sample gas)
-add_example(MQ303ASample mq303a)
-add_example(MQ5Sample gas)
-add_example(GroveLEDBar my9221)
-add_example(NRF24L01_receiverSample nrf24l01)
-add_example(NRF24L01_transmitterSample nrf24l01)
-add_example(NUNCHUCKSample nunchuck)
-add_example(OTP538USample otp538u)
-add_example(PPD42NSSample ppd42ns)
-add_example(PulsensorSample pulsensor)
-add_example(RFR359FSample rfr359f)
-add_example(RotaryEncoderSample rotaryencoder)
-add_example(RPR220_intrSample rpr220)
-add_example(RPR220Sample rpr220)
-add_example(ST7735Sample st7735)
-add_example(StepMotorSample stepmotor)
-add_example(TM1637Sample tm1637)
-add_example(TP401Sample gas)
-add_example(TSL2561Sample tsl2561)
-add_example(TTP223Sample ttp223)
-add_example(Ublox6Sample ublox6)
-add_example(ULN200XASample uln200xa)
-add_example(WaterLevelSensor waterlevel)
-add_example(WT5001Sample wt5001)
-add_example(YG1006Sample yg1006)
-add_example(ZFM20Sample zfm20)
-add_example(Ad8232Example ad8232)
-add_example(Gp2y0aExample gp2y0a)
-add_example(Th02Example th02)
-add_example(FlexSensorExample flex)
-
-
-add_example_with_path(Jhd1313m1_lcdSample lcd/upm_i2clcd.jar)
-add_example_with_path(Jhd1313m1Sample lcd/upm_i2clcd.jar)
-add_example_with_path(Lcm1602_i2cSample lcd/upm_i2clcd.jar)
-add_example_with_path(Lcm1602_parallelSample lcd/upm_i2clcd.jar)
-add_example_with_path(SSD1308_oledSample lcd/upm_i2clcd.jar)
-add_example_with_path(SSD1327_oledSample lcd/upm_i2clcd.jar)
-
diff --git a/peripheral/libupm/examples/java/DS1307Sample.java b/peripheral/libupm/examples/java/DS1307Sample.java
deleted file mode 100644
index 89ae5dc..0000000
--- a/peripheral/libupm/examples/java/DS1307Sample.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-//NOT TESTED!!!
-public class DS1307Sample {
-
- static private void printTime(upm_ds1307.DS1307 rtc) {
- System.out.print("The time is: " + rtc.getMonth() + "/" + rtc.getDayOfMonth() + "/"
- + rtc.getYear() + " " + rtc.getHours() + ":" + rtc.getMinutes() + ":"
- + rtc.getSeconds());
-
- if (rtc.getAmPmMode()) {
- if (rtc.getAmPmMode())
- System.out.print(" PM");
- else
- System.out.print(" AM");
- }
-
- System.out.println();
-
- if (rtc.getAmPmMode())
- System.out.println("Clock is in AM/PM mode");
- else
- System.out.println("Clock is in 24h mode");
-
- }
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Instantiate a DS1037 on I2C bus 0
- upm_ds1307.DS1307 rtc = new upm_ds1307.DS1307(0);
-
- // always do this first
- System.out.println("Loading the current time...");
- if (!rtc.loadTime()) {
- System.err.println("rtc->loadTime() failed.");
- System.exit(-1);
- }
-
- printTime(rtc);
-
- // set the year as an example
- System.out.println("setting the year to 50");
- rtc.setYear(50);
- rtc.setTime();
-
- // reload the time and print it
- rtc.loadTime();
- printTime(rtc);
-
- // ! [Interesting]
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/ENC03RSample.java b/peripheral/libupm/examples/java/ENC03RSample.java
deleted file mode 100644
index c2aa0bd..0000000
--- a/peripheral/libupm/examples/java/ENC03RSample.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-//NOT TESTED!!!
-public class ENC03RSample {
- private static final long CALIBRATION_SAMPLES = 1000;
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
-
- // Instantiate a ENC03R on analog pin A0
- upm_enc03r.ENC03R gyro = new upm_enc03r.ENC03R(0);
-
- System.out.println("Please place the sensor in a stable location, and do not");
- System.out.println("move it while calibration takes place");
- System.out.println("This may take a couple of minutes.");
-
- gyro.calibrate(CALIBRATION_SAMPLES);
- System.out.println("Calibration complete. Reference value: " + gyro.calibrationValue());
-
- // Read the input and print both the raw value and the angular velocity,
- // waiting 1 second between readings
- while (true) {
- long val = gyro.value();
- double av = gyro.angularVelocity(val);
-
- System.out.println("Raw value: " + val + ", angular velocity: " + av + " deg/s");
-
- Thread.sleep(1000);
- }
- // ! [Interesting]
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/ES08ASample.java b/peripheral/libupm/examples/java/ES08ASample.java
deleted file mode 100644
index 0285204..0000000
--- a/peripheral/libupm/examples/java/ES08ASample.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-public class ES08ASample {
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- upm_servo.ES08A servo = new upm_servo.ES08A(6);
-
- // Sets the shaft to 180, then to 90, then to 0,
- // then back to 90, and finally back to 180,
- // pausing for a second in between each angle
- servo.setAngle(180);
- System.out.println("Set angle to 180");
- Thread.sleep(1000);
-
- servo.setAngle(90);
- System.out.println("Set angle to 90");
- Thread.sleep(1000);
-
- servo.setAngle(0);
- System.out.println("Set angle to 0");
- Thread.sleep(1000);
-
- servo.setAngle(90);
- System.out.println("Set angle to 90");
- Thread.sleep(1000);
-
- servo.setAngle(180);
- System.out.println("Set angle to 180");
- // ! [Interesting]
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/FlexSensorExample.java b/peripheral/libupm/examples/java/FlexSensorExample.java
deleted file mode 100644
index ce4e697..0000000
--- a/peripheral/libupm/examples/java/FlexSensorExample.java
+++ /dev/null
@@ -1,41 +0,0 @@
-import upm_flex.Flex;
-
-public class FlexSensorExample {
-
- static {
- try {
- System.loadLibrary("javaupm_flex");
- 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) {
- // TODO Auto-generated method stub
- //! [Interesting]
- // The was tested with a Spectra Symbol flex sensor.
- // We attached a 22K resistor to a breadboard,
- // with 1 end attached to GND and the other connected to
- // both the flex sensor and A0.
- // The flex sensor was connected on 1 pin to the 22K resistor and A0
- // and on the other pin to 5V.
-
- // Instantiate a Flex sensor on analog pin A0
- Flex flex = new Flex(0);
- while(true){
- System.out.println("Flex Sensor value is: "+flex.value());
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- //! [Interesting]
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/GROVESCAMSample.java b/peripheral/libupm/examples/java/GROVESCAMSample.java
deleted file mode 100644
index 1e4a374..0000000
--- a/peripheral/libupm/examples/java/GROVESCAMSample.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-//NOT TESTED!!!
-public class GROVESCAMSample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Instantiate a Grove Serial Camera on UART 0
- upm_grovescam.GROVESCAM camera = new upm_grovescam.GROVESCAM(0);
-
- // make sure port is initialized properly. 115200 baud is the default.
- if (!camera.setupTty()) {
- System.err.println("Failed to setup tty port parameters");
- System.exit(-1);
- }
-
- if (camera.init())
- System.out.println("Initialized...");
- else
- System.out.println("Initialization failed");
-
- if (camera.preCapture())
- System.out.println("preCapture succeeded...");
- else
- System.out.println("preCapture failed.");
-
- if (camera.doCapture())
- System.out.println("doCapture succeeded...");
- else
- System.out.println("doCapture failed.");
-
- if (camera.getImageSize() > 0) {
- System.out.println("Storing image.jpg...");
-
- if (camera.storeImage("image.jpg"))
- System.out.println("storeImage succeeded...");
- else
- System.out.println("storeImage failed.");
-
- }
- // ! [Interesting]
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/GUVAS12DSample.java b/peripheral/libupm/examples/java/GUVAS12DSample.java
deleted file mode 100644
index 0cd4115..0000000
--- a/peripheral/libupm/examples/java/GUVAS12DSample.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-public class GUVAS12DSample {
- // analog voltage, usually 3.3 or 5.0
- private static final float GUVAS12D_AREF = 5;
- private static final int SAMPLES_PER_QUERY = 1024;
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Instantiate a GUVAS12D on analog pin A3
- upm_guvas12d.GUVAS12D volts = new upm_guvas12d.GUVAS12D(3);
-
- while (true) {
- float value = volts.value(GUVAS12D_AREF, SAMPLES_PER_QUERY);
-
- System.out.println("AREF: " + GUVAS12D_AREF
- + ", Voltage value (higher means more UV): " + value);
-
- Thread.sleep(1000);
- }
- // ! [Interesting]
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/Gp2y0aExample.java b/peripheral/libupm/examples/java/Gp2y0aExample.java
deleted file mode 100644
index 0837f55..0000000
--- a/peripheral/libupm/examples/java/Gp2y0aExample.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Author: Abhishek Malik <abhishek.malik@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 upm_gp2y0a.GP2Y0A;
-
-public class Gp2y0aExample {
-
- public static final float GP2Y0A_AREF = 5;
- public static final short SAMPLES_PER_QUERY = 20;
-
- static {
- try {
- System.loadLibrary("javaupm_gp2y0a");
- 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) {
- // TODO Auto-generated method stub
- //! [Interesting]
- // Note, for the Grove 80cm version of this sensor, due to the way
- // it is wired, you need to plug this into the A0 port, where it
- // will use the available A1 pin for data.
-
- // Instantiate a GP2Y0A on analog pin A1
- GP2Y0A gp2y0a = new GP2Y0A(1);
-
- // The higher the voltage (closer to AREF) the closer the object is. NOTE:
- // the measured voltage will probably not exceed 3.3 volts.
- // Every second, print the averaged voltage value (averaged over 20 samples).
- while(true){
- System.out.println("AREF: " + GP2Y0A_AREF + "\t, Voltage Value (Higher means Closer): "+ gp2y0a.value(GP2Y0A_AREF, SAMPLES_PER_QUERY));
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- System.out.println("The following exception occured: "+e.getMessage());
- }
- }
- //! [Interesting]
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/GroveButtonSample.java b/peripheral/libupm/examples/java/GroveButtonSample.java
deleted file mode 100644
index 9be6e2f..0000000
--- a/peripheral/libupm/examples/java/GroveButtonSample.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-public class GroveButtonSample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Create the button object using GPIO pin 2
- upm_grove.GroveButton button = new upm_grove.GroveButton(2);
-
- while (true) {
- System.out.println(button.name() + " value is " + button.value());
-
- Thread.sleep(1000);
- }
- // ! [Interesting]
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/GroveButton_intrSample.java b/peripheral/libupm/examples/java/GroveButton_intrSample.java
deleted file mode 100644
index ad0d72e..0000000
--- a/peripheral/libupm/examples/java/GroveButton_intrSample.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-public class GroveButton_intrSample {
-
- public static int counter = 0;
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- upm_grove.GroveButton b = new upm_grove.GroveButton(2);
-
- ButtonISR callback = new ButtonISR();
- b.installISR(2, callback);
-
- while (true) {
- System.out.println("Counter: " + counter);
- Thread.sleep(1000);
- }
- // ! [Interesting]
- }
-}
-
-class ButtonISR implements Runnable {
- public ButtonISR() {
- super();
- }
-
- public void run() {
- GroveButton_intrSample.counter++;
- System.out.println("Button pressed!");
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/GroveCollision.java b/peripheral/libupm/examples/java/GroveCollision.java
deleted file mode 100644
index e1ace72..0000000
--- a/peripheral/libupm/examples/java/GroveCollision.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Author: Abhishek Malik <abhishek.malik@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 upm_grovecollision.*;
-
-public class GroveCollision {
-
- public static void main(String[] args) {
- // Initializing the sensor on D2 on the Base Shield
- upm_grovecollision.GroveCollision collision = new upm_grovecollision.GroveCollision(2);
- boolean collisionState = false;
-
- // ! [Interesting]
- while(true){
- if(collision.isColliding() && !collisionState){
- System.out.println("Collision!!");
- collisionState = true;
- }
- else if (collisionState){
- System.out.println("No Collision!");
- collisionState = false;
- }
- }
- // ! [Interesting]
- }
-
-}
diff --git a/peripheral/libupm/examples/java/GroveEHRSample.java b/peripheral/libupm/examples/java/GroveEHRSample.java
deleted file mode 100644
index ddec36a..0000000
--- a/peripheral/libupm/examples/java/GroveEHRSample.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-//NOT TESTED!!!
-public class GroveEHRSample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Instantiate a Grove Ear-clip Heart Rate sensor on digital pin D2
- upm_groveehr.GroveEHR heart = new upm_groveehr.GroveEHR(2);
-
- // set the beat counter to 0, init the clock and start counting beats
- heart.clearBeatCounter();
- heart.initClock();
- heart.startBeatCounter();
-
- while (true) {
- long millis = heart.getMillis();
- long beats = heart.beatCounter();
-
- // heartRate() requires that at least 5 seconds pass before
- // returning anything other than 0
- int hr = heart.heartRate();
-
- // output milliseconds passed, beat count, and computed heart rate
- System.out.println("Millis: " + millis + ", Beats: " + beats + ", Heart rate: " + hr);
-
- Thread.sleep(1000);
- }
- // ! [Interesting]
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/GroveEmg.java b/peripheral/libupm/examples/java/GroveEmg.java
deleted file mode 100644
index eaa8ba0..0000000
--- a/peripheral/libupm/examples/java/GroveEmg.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Author: Abhishek Malik <abhishek.malik@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 upm_groveemg.GroveEMG;
-
-public class GroveEmg {
-
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- //! [Interesting]
- // Instantiating the Grove EMG sensor on Analog pin 0
- GroveEMG emg = new GroveEMG(0);
- System.out.println("Calibrating ... ");
- emg.calibrate();
-
- while(true){
- System.out.println("EMG Val: "+emg.value());
- try {
- Thread.sleep(100);
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- System.out.println("The following exception occured: "+e.getMessage());
- }
- }
- }
- //! [Interesting]
-}
diff --git a/peripheral/libupm/examples/java/GroveGsr.java b/peripheral/libupm/examples/java/GroveGsr.java
deleted file mode 100644
index 08a04b9..0000000
--- a/peripheral/libupm/examples/java/GroveGsr.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Author: Abhishek Malik <abhishek.malik@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 upm_grovegsr.GroveGSR;
-
-public class GroveGsr {
-
- public static void main(String[] args) {
- // TODO Auto-generated method stub
-
- //! [Interesting]
- // Instantiate a Grove GSR sensor on analog pin A0
- GroveGSR gsr = new GroveGSR(0);
- System.out.println("Calibrating...");
- gsr.calibrate();
-
- while(true){
- System.out.println("Value: "+gsr.value());
- try {
- Thread.sleep(500);
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- System.out.println("The following exception occured: "+e.getMessage());
- }
- }
- //! [Interesting]
- }
-
-}
diff --git a/peripheral/libupm/examples/java/GroveLEDBar.java b/peripheral/libupm/examples/java/GroveLEDBar.java
deleted file mode 100644
index 51d2f71..0000000
--- a/peripheral/libupm/examples/java/GroveLEDBar.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-public class GroveLEDBar {
-
- public static void main(String[] args) throws InterruptedException {
- //! [Interesting]
- // Instantiate a Grove LED Bar, with Data pin D8 and Clock pin D9
- upm_my9221.GroveLEDBar bar = new upm_my9221.GroveLEDBar((short) 8, (short) 9);
-
- while (true) {
- for (short idx = 1; idx < 11; idx++) {
- bar.setBarLevel(idx);
- Thread.sleep(100);
- }
- }
- //! [Interesting]
- }
-
-}
diff --git a/peripheral/libupm/examples/java/GroveLEDSample.java b/peripheral/libupm/examples/java/GroveLEDSample.java
deleted file mode 100644
index b996449..0000000
--- a/peripheral/libupm/examples/java/GroveLEDSample.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Author: Andrei Vasiliu <andrei.vasiliu@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.
- */
-
-public class GroveLEDSample {
- public static void main (String args[]) throws InterruptedException {
- //! [Interesting]
- upm_grove.GroveLed led = new upm_grove.GroveLed(2);
-
- for (int i = 0; i < 10; ++i) {
- led.on();
- Thread.sleep(1000);
- led.off();
- Thread.sleep(1000);
- }
- led.delete();
- //! [Interesting]
- }
-}
diff --git a/peripheral/libupm/examples/java/GroveLed_multiSample.java b/peripheral/libupm/examples/java/GroveLed_multiSample.java
deleted file mode 100644
index 98d792c..0000000
--- a/peripheral/libupm/examples/java/GroveLed_multiSample.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-//NOT TESTED!!!
-public class GroveLed_multiSample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Instantiate a grove LED on D2. Here we are controlling a Grove
- // Multi-color flash LED. We just just need to turn it on - it will
- // then cycle through various colors (red, green, blue, purple) on it's
- // own until turned off.
- upm_grove.GroveLed led = new upm_grove.GroveLed(2);
-
- // start the light show
- led.on();
-
- // just sleep until interrupted
- while (true) {
- Thread.sleep(1);
- }
- // ! [Interesting]
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/GroveLightSample.java b/peripheral/libupm/examples/java/GroveLightSample.java
deleted file mode 100644
index 611b744..0000000
--- a/peripheral/libupm/examples/java/GroveLightSample.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-public class GroveLightSample {
- public static void main(String args[]) throws InterruptedException {
- // ! [Interesting]
- upm_grove.GroveLight gl = new upm_grove.GroveLight(2);
-
- while (true) {
- float raw_value = gl.raw_value();
- float value = gl.value();
-
- System.out.println("raw value: " + raw_value);
- System.out.println("value: " + value);
-
- Thread.sleep(1000);
- }
- // ! [Interesting]
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/GroveLineFinderSample.java b/peripheral/libupm/examples/java/GroveLineFinderSample.java
deleted file mode 100644
index 2baa418..0000000
--- a/peripheral/libupm/examples/java/GroveLineFinderSample.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-public class GroveLineFinderSample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Instantiate a Grove Line Finder sensor on digital pin D2
- upm_grovelinefinder.GroveLineFinder finder = new upm_grovelinefinder.GroveLineFinder(2);
- // check every second for the presence of white detection
- while (true) {
- boolean val = finder.whiteDetected();
- if (val) {
- System.out.println("White detected");
- } else {
- System.out.println("Black detected");
- }
-
- Thread.sleep(1000);
- }
- // ! [Interesting]
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/GroveMDSample.java b/peripheral/libupm/examples/java/GroveMDSample.java
deleted file mode 100644
index 9bb4bb7..0000000
--- a/peripheral/libupm/examples/java/GroveMDSample.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-public class GroveMDSample {
- private static final short speed50 = 127;
- private static final short speed0 = 0;
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Instantiate an I2C Grove Motor Driver on I2C bus 0
- upm_grovemd.GroveMD motors = new upm_grovemd.GroveMD();
-
- // set direction to clockwise (CW) and set speed to 50%
- System.out.println("Spin M1 and M2 at half speed for 3 seconds");
- motors.setMotorDirections(upm_grovemd.GroveMD.DC_DIRECTION_T.DIR_CW,
- upm_grovemd.GroveMD.DC_DIRECTION_T.DIR_CW);
- motors.setMotorSpeeds(speed50, speed50);
- Thread.sleep(3000);
-
- // counter clockwise (CCW)
- System.out.println("Reversing M1 and M2 for 3 seconds");
- motors.setMotorDirections(upm_grovemd.GroveMD.DC_DIRECTION_T.DIR_CCW,
- upm_grovemd.GroveMD.DC_DIRECTION_T.DIR_CCW);
- Thread.sleep(3000);
-
- // stop motors
- System.out.println("Stopping motors");
- motors.setMotorSpeeds(speed0, speed0);
- // ! [Interesting]
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/GroveMQ3.java b/peripheral/libupm/examples/java/GroveMQ3.java
deleted file mode 100644
index c101189..0000000
--- a/peripheral/libupm/examples/java/GroveMQ3.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Author: Abhishek Malik <abhishek.malik@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 upm_gas.Gas;
-import upm_gas.MQ2;
-import upm_gas.MQ3;
-import upm_gas.MQ4;
-import upm_gas.MQ5;
-import upm_gas.MQ6;
-import upm_gas.MQ7;
-import upm_gas.MQ8;
-import upm_gas.MQ9;
-import upm_gas.TP401;
-import upm_gas.thresholdContext;
-
-public class GroveMQ3 {
-
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- //! [Interesting]
- // initialize the sensor on A0
- MQ3 mq3 = new MQ3(0);
-
- short[] buffer = new short[128];
-
- thresholdContext context = new thresholdContext();
-
- context.setAverageReading(0);
- context.setRunningAverage(0);
- context.setAveragedOver(2);
-
- int len;
- int thres;
- while(true){
- len = mq3.getSampledWindow((long)2, buffer);
-
- if(len != 0){
- thres = mq3.findThreshold(context, 30, buffer);
- mq3.printGraph(context, (short)5);
- if(thres != 0){
- // do something
- System.out.println("threshold is crossed");
- }
- }
- }
- //! [Interesting]
- }
-
-}
diff --git a/peripheral/libupm/examples/java/GroveMQ9.java b/peripheral/libupm/examples/java/GroveMQ9.java
deleted file mode 100644
index 24b916d..0000000
--- a/peripheral/libupm/examples/java/GroveMQ9.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Author: Abhishek Malik <abhishek.malik@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 upm_gas.Gas;
-import upm_gas.MQ2;
-import upm_gas.MQ3;
-import upm_gas.MQ4;
-import upm_gas.MQ5;
-import upm_gas.MQ6;
-import upm_gas.MQ7;
-import upm_gas.MQ8;
-import upm_gas.MQ9;
-import upm_gas.TP401;
-import upm_gas.thresholdContext;
-
-public class GroveMQ9 {
-
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- //! [Interesting]
- // initialize the sensor on A0
- MQ9 mq9 = new MQ9(0);
-
- short[] buffer = new short[128];
-
- thresholdContext context = new thresholdContext();
-
- context.setAverageReading(0);
- context.setRunningAverage(0);
- context.setAveragedOver(2);
-
- int len;
- int thres;
- while(true){
- len = mq9.getSampledWindow((long)2, buffer);
-
- if(len != 0){
- thres = mq9.findThreshold(context, 30, buffer);
- mq9.printGraph(context, (short)5);
- if(thres != 0){
- // do something
- System.out.println("threshold is crossed");
- }
- }
- }
- //! [Interesting]
- }
-
-}
diff --git a/peripheral/libupm/examples/java/GroveMoistureSample.java b/peripheral/libupm/examples/java/GroveMoistureSample.java
deleted file mode 100644
index 8fb32d6..0000000
--- a/peripheral/libupm/examples/java/GroveMoistureSample.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-public class GroveMoistureSample {
- public static void main(String args[]) throws InterruptedException {
- // ! [Interesting]
- upm_grovemoisture.GroveMoisture gm = new upm_grovemoisture.GroveMoisture(1);
-
- while (true) {
- int moisture_val = gm.value();
- String result;
-
- if (moisture_val >= 0 && moisture_val < 300)
- result = "Dry";
- else if ((moisture_val >= 0 && moisture_val < 300))
- result = "Moist";
- else
- result = "Wet";
-
- System.out.println("Moisture Value: " + moisture_val + ", " + result);
-
- Thread.sleep(1000);
- }
- // ! [Interesting]
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/GroveO2Example.java b/peripheral/libupm/examples/java/GroveO2Example.java
deleted file mode 100644
index fe22b80..0000000
--- a/peripheral/libupm/examples/java/GroveO2Example.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Author: Abhishek Malik <abhishek.malik@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 upm_groveo2.GroveO2;
-
-public class GroveO2Example {
-
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- //! [Interesting]
- // Initializing the Grove O2 sensor on the A) analog pin
- GroveO2 o2 = new GroveO2(0);
-
- while(true){
- System.out.println("The output voltage is: "+o2.voltageValue());
- try {
- Thread.sleep(100);
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- System.out.println("The following exception has occured: "+e.getMessage());
- }
- }
- //! [Interesting]
- }
-}
diff --git a/peripheral/libupm/examples/java/GroveQTouch.java b/peripheral/libupm/examples/java/GroveQTouch.java
deleted file mode 100644
index 795e4ac..0000000
--- a/peripheral/libupm/examples/java/GroveQTouch.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Author: Abhishek Malik <abhishek.malik@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 upm_at42qt1070.AT42QT1070;
-
-public class GroveQTouch {
-
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- // Instantiating the Q Touch sensor on the I2C bus 0
- AT42QT1070 touch = new AT42QT1070(0, (short) 0x1b);
- short pressedButtons;
-
- // ! [Interesting]
- while(true){
- touch.updateState();
- printButtons(touch.getButtons());
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- // ! [Interesting]
- }
-
- /**
- * This function prints out the button numbers from 0 through 6
- * @param buttonNumber
- */
- public static void printButtons(int buttonNumber){
- boolean buttonPressed = false;
- System.out.print("Button Pressed: ");
- for(int i=0;i<7;i++){
- if((buttonNumber & (1<<i)) != 0){
- System.out.println(i+" ");
- buttonPressed = true;
- }
- }
-
-
-
- if(!buttonPressed){
- System.out.println("None ");
- }
- }
-}
diff --git a/peripheral/libupm/examples/java/GroveRelaySample.java b/peripheral/libupm/examples/java/GroveRelaySample.java
deleted file mode 100644
index 56a044b..0000000
--- a/peripheral/libupm/examples/java/GroveRelaySample.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-public class GroveRelaySample {
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Create the button object using UART
- upm_grove.GroveRelay relay = new upm_grove.GroveRelay(5);
-
- for (int i = 0; i < 3; i++) {
- relay.on();
- if (relay.isOn())
- System.out.println("Relay is on");
- Thread.sleep(1000);
-
- relay.off();
- if (relay.isOff())
- System.out.println("Relay is off");
- Thread.sleep(1000);
- }
- // ! [Interesting]
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/GroveRotarySample.java b/peripheral/libupm/examples/java/GroveRotarySample.java
deleted file mode 100644
index f1b98c7..0000000
--- a/peripheral/libupm/examples/java/GroveRotarySample.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-public class GroveRotarySample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- upm_grove.GroveRotary knob = new upm_grove.GroveRotary(0);
-
- while (true) {
- float abs_value = knob.abs_value(); // Absolute raw value
- float abs_deg = knob.abs_deg(); // Absolute degrees
- float abs_rad = knob.abs_rad(); // Absolute radians
- float rel_value = knob.rel_value(); // Relative raw value
- float rel_deg = knob.rel_deg(); // Relative degrees
- float rel_rad = knob.rel_rad(); // Relative radians
-
- System.out.println("Absolute: " + abs_value + " raw, " + abs_deg + " deg, " + abs_rad
- + " rad");
- System.out.println("Relative: " + rel_value + " raw, " + rel_deg + " deg, " + rel_rad
- + " rad");
-
- Thread.sleep(3000);
- }
- // ! [Interesting]
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/GroveSlideSample.java b/peripheral/libupm/examples/java/GroveSlideSample.java
deleted file mode 100644
index b159713..0000000
--- a/peripheral/libupm/examples/java/GroveSlideSample.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Author: Andrei Vasiliu <andrei.vasiliu@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.
- */
-
-public class GroveSlideSample {
- public static void main (String args[]) throws InterruptedException {
- //! [Interesting]
- // Instantiate new grove slide potentiometer on analog pin A0
- upm_grove.GroveSlide slide = new upm_grove.GroveSlide(0);
-
- while (true) {
- float raw_value = slide.raw_value();
- float value = slide.voltage_value();
-
- System.out.println("raw value: " + raw_value);
- System.out.println("value: " + value);
-
- Thread.sleep(2500);
- }
- //! [Interesting]
- }
-}
diff --git a/peripheral/libupm/examples/java/GroveSpeakerSample.java b/peripheral/libupm/examples/java/GroveSpeakerSample.java
deleted file mode 100644
index 2e96c89..0000000
--- a/peripheral/libupm/examples/java/GroveSpeakerSample.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Author: Andrei Vasiliu <andrei.vasiliu@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.
- */
-
-public class GroveSpeakerSample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Instantiate a Grove Speaker on digital pin D2
- upm_grovespeaker.GroveSpeaker speaker = new upm_grovespeaker.GroveSpeaker(2);
-
- // Play all 7 of the lowest notes
- speaker.playAll();
-
- // Play a medium C-sharp
- speaker.playSound('c', true, "med");
- // ! [Interesting]
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/GroveTempSample.java b/peripheral/libupm/examples/java/GroveTempSample.java
deleted file mode 100644
index 6878827..0000000
--- a/peripheral/libupm/examples/java/GroveTempSample.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Author: Andrei Vasiliu <andrei.vasiliu@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.
- */
-
-public class GroveTempSample {
- public static void main (String args[]) throws InterruptedException {
- //! [Interesting]
- upm_grove.GroveTemp temp = new upm_grove.GroveTemp(3);
-
- for (int i = 0; i < 10; ++i) {
-
- int celsius = temp.value();
- int fahrneheit = celsius * 2 + 32;
-
- System.out.println("Celsius: " + celsius);
- System.out.println("Fahrneheit: " + fahrneheit);
-
- Thread.sleep(1000);
- }
- temp.delete();
- //! [Interesting]
- }
-}
diff --git a/peripheral/libupm/examples/java/GroveVDivSample.java b/peripheral/libupm/examples/java/GroveVDivSample.java
deleted file mode 100644
index 579f2c3..0000000
--- a/peripheral/libupm/examples/java/GroveVDivSample.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-//NOT TESTED!!!
-public class GroveVDivSample {
- private static final short gain3 = 3;
- private static final short gain10 = 10;
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Instantiate a Grove Voltage Divider sensor on analog pin A0
- upm_grovevdiv.GroveVDiv vDiv = new upm_grovevdiv.GroveVDiv(0);
-
- // collect data and output measured voltage according to the setting
- // of the scaling switch (3 or 10)
- while (true) {
- long val = vDiv.value(100);
- float gain3val = vDiv.computedValue(gain3, val);
- float gain10val = vDiv.computedValue(gain10, val);
-
- System.out.println("ADC value: " + val + ", Gain 3: " + gain3val + "v, Gain 10: "
- + gain10val);
-
- Thread.sleep(1000);
- }
- // ! [Interesting]
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/GroveWFSSample.java b/peripheral/libupm/examples/java/GroveWFSSample.java
deleted file mode 100644
index 5ab4997..0000000
--- a/peripheral/libupm/examples/java/GroveWFSSample.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-//NOT TESTED!!!
-public class GroveWFSSample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Instantiate a Grove Water Flow Sensor on digital pin D2
- upm_grovewfs.GroveWFS flow = new upm_grovewfs.GroveWFS(2);
-
- flow.clearFlowCounter();
- flow.startFlowCounter();
-
- while (true) {
- System.out.print("Millis: " + flow.getMillis() + " FlowCount: " + flow.flowCounter());
- System.out.println(" Flow Rate: " + flow.flowRate() + " LPM");
-
- Thread.sleep(2000);
- }
- // ! [Interesting]
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/GroveWaterSample.java b/peripheral/libupm/examples/java/GroveWaterSample.java
deleted file mode 100644
index f275df7..0000000
--- a/peripheral/libupm/examples/java/GroveWaterSample.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-public class GroveWaterSample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Instantiate a Grove Water sensor on digital pin D2
- upm_grovewater.GroveWater water = new upm_grovewater.GroveWater(2);
-
- while (true) {
- boolean val = water.isWet();
- if (val) {
- System.out.println("Sensor is wet");
- } else {
- System.out.println("Sensor is dry");
- }
-
- Thread.sleep(1000);
- }
- // ! [Interesting]
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/H3LIS331DLSample.java b/peripheral/libupm/examples/java/H3LIS331DLSample.java
deleted file mode 100644
index ee1db39..0000000
--- a/peripheral/libupm/examples/java/H3LIS331DLSample.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-//NOT TESTED!!!
-public class H3LIS331DLSample {
-
- public static void main(String[] args) throws InterruptedException {
- //! [Interesting]
- int[] val;
- float[] accel;
-
- // Instantiate an H3LIS331DL on I2C bus 0
- upm_h3lis331dl.H3LIS331DL sensor = new upm_h3lis331dl.H3LIS331DL(0);
-
- // Initialize the device with default values
- sensor.init();
-
- while(true){
- sensor.update();
-
- val = sensor.getRawXYZ();
- System.out.println( "Raw: X: " + val[0] + " Y: " + val[1] + " Z: " + val[2] );
-
- accel = sensor.getAcceleration();
- System.out.println( "Acceleration: X: " + accel[0] + " Y: " + accel[1] + " Z: " + accel[2] );
-
- Thread.sleep(1000);
- }
- //! [Interesting]
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/HCSR04Sample.java b/peripheral/libupm/examples/java/HCSR04Sample.java
deleted file mode 100644
index ee90773..0000000
--- a/peripheral/libupm/examples/java/HCSR04Sample.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-//NOT TESTED!!!
-public class HCSR04Sample {
-
- // ! [Interesting]
- public static void main(String[] args) throws InterruptedException {
- upm_hcsr04.HCSR04 sonar = new upm_hcsr04.HCSR04((short) 5, (short) 6);
-
- Thread.sleep(1000);
-
- while (true) {
- System.out.println("Get distance");
- double distance = sonar.getDistance(upm_hcsr04.javaupm_hcsr04Constants.CM);
- System.out.println("Distance: " + distance);
-
- Thread.sleep(5000);
- }
- }
-}
-// ! [Interesting] \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/HM11Sample.java b/peripheral/libupm/examples/java/HM11Sample.java
deleted file mode 100644
index b37ae21..0000000
--- a/peripheral/libupm/examples/java/HM11Sample.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-//NOT TESTED!!!
-public class HM11Sample {
-
- private static final int BUFSIZ = 1024;
-
- private static void printUsage() {
- System.out.println("Usage: java HM11Sample [AT command]");
-
- System.out.println("If an argument is supplied on the command line, that argument is");
- System.out.println("sent to the module and the response is printed out.");
- System.out.println("If no argument is used, then the address and PIN of the module");
- System.out.println("are queried and the results printed out.");
-
- }
-
- private static void sendCommand(upm_hm11.HM11 ble, byte[] cmd) {
- byte[] buffer = new byte[BUFSIZ];
- ble.writeData(cmd);
-
- // wait up to 1 second
- if (ble.dataAvailable(1000)) {
- ble.readData(buffer);
- } else {
- System.err.println("Timed out waiting for response");
- }
-
- }
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Instantiate a HM11 BLE Module on UART 0
- upm_hm11.HM11 ble = new upm_hm11.HM11(0);
-
- // make sure port is initialized properly. 9600 baud is the default.
- if (!ble.setupTty()) {
- System.err.println("Failed to setup tty port parameters");
- System.exit(-1);
- }
-
- printUsage();
-
- if (args.length > 0) {
- System.out.println("Sending command line argument (" + args[0] + ")...");
- sendCommand(ble, args[0].getBytes());
- } else {
- // query the module address
- String addr = "AT+ADDR?";
- System.out.println("Querying module address (" + addr + ")...");
- sendCommand(ble, addr.getBytes());
-
- Thread.sleep(1000);
-
- // query the module address
- String pin = "AT+PASS?";
- System.out.println("Querying module pin (" + pin + ")...");
- sendCommand(ble, pin.getBytes());
-
- // Other potentially useful commands are:
- //
- // AT+VERS? - query module version
- // AT+ROLE0 - set as slave
- // AT+ROLE1 - set as master
- // AT+CLEAR - clear all previous settings
- // AT+RESET - restart the device
- //
- // A comprehensive list is available from the datasheet at:
- // http://www.seeedstudio.com/wiki/images/c/cd/Bluetooth4_en.pdf
-
- }
- // ! [Interesting]
- }
-}
diff --git a/peripheral/libupm/examples/java/HMTRPSample.java b/peripheral/libupm/examples/java/HMTRPSample.java
deleted file mode 100644
index a3d24bd..0000000
--- a/peripheral/libupm/examples/java/HMTRPSample.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-//NOT TESTED!!!
-public class HMTRPSample {
-
- static private final int bufferLength = 255;
-
- private static void printUsage() {
- System.out.println("Usage:");
- System.out.println("Pass a commandline argument (any argument) to this program");
- System.out.println("to query the radio configuration and output it. NOTE: the");
- System.out.println("radio must be in CONFIG mode for this to work.");
- System.out.println("Running this program without arguments will simply transmit");
- System.out.println("'Hello World!' every second, and output any data received from");
- System.out.println("another radio.");
- }
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Instantiate a HMTRP radio device on uart 0
- upm_hmtrp.HMTRP radio = new upm_hmtrp.HMTRP(0);
-
- // make sure port is initialized properly. 9600 baud is the default.
- if (!radio.setupTty()) {
- System.err.println("Failed to setup tty port parameters");
- System.exit(-1);
- }
- printUsage();
-
- // By default, this radio simply transmits data sent via writeData()
- // and reads any available data via readData().
-
- // It can be placed into a configuration mode by grounding the
- // CONFIG pin on the module. When this is done, the various
- // configuration query and config methods can be used. In this
- // example, by default, we just read any data available fom the
- // device, and periodically transmit "Hello World".
-
- // If any argument was specified on the command line, do a simple
- // configuration query and output the results. The radio must be in·
- // CONFIG mode for this to work.
-
- if (args.length > 0) {
- // config mode
- long[] freq = {0};
- long[] dataRate = {0};
- int[] rxBandwidth = {0};
- short[] modulation = {0};
- short[] txPower = {0};
- long[] uartBaud = {0};
-
- if (radio.getConfig(freq, dataRate, rxBandwidth, modulation, txPower, uartBaud)) {
- System.out.println("Radio configuration:");
- System.out.println("freq: " + freq[0] + " dataRate: " + dataRate[0]
- + " rxBandwidth: " + rxBandwidth[0] + "Khz");
- System.out.println("modulation: " + modulation[0] + "Khz txPower: " + txPower[0]
- + " uartBaud: " + uartBaud[0]);
- } else {
- System.err.println("getConfig() failed. Make sure the radio is in CONFIG mode.");
- }
- } else {
- // normal read/write mode
- byte[] radioBuffer = new byte[bufferLength];
- byte[] hello = "Hello World".getBytes();
- int counter = 0;
-
- System.out.println("Running in normal read/write mode.");
-
- while (true) {
- // we don't want the read to block in this example, so always
- // check to see if data is available first.
- if (radio.dataAvailable()) {
- int rv = radio.readData(radioBuffer);
-
- if (rv > 0) {
- System.out.print("Received: ");
- for (int i = 0; i < radioBuffer.length; i++)
- System.out.print((char) radioBuffer[i]);
- System.out.println();
- } else {
- System.err.println("Port read error.");
- break;
- }
- continue;
- }
-
- Thread.sleep(100);
-
- counter++;
- // every second, transmit "Hello World!"
- if (counter > 10) {
- System.out.println("Transmitting hello world...");
- radio.writeData(hello);
- counter = 0;
- }
- }
- }
- // ! [Interesting]
- }
-}
diff --git a/peripheral/libupm/examples/java/HP20xExample.java b/peripheral/libupm/examples/java/HP20xExample.java
deleted file mode 100644
index 8082031..0000000
--- a/peripheral/libupm/examples/java/HP20xExample.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Author: Abhishek Malik <abhishek.malik@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 upm_hp20x.HP20X;
-
-public class HP20xExample {
-
- public static void main(String[] args) {
- // TODO Auto-generated method stub
-
- //! [Interesting]
- // Instantiate the sensor on the default I2C bus and sensor
- HP20X hp20x = new HP20X();
-
- // Initializing the sensor with the default values
- hp20x.init();
-
- while(true){
- System.out.println("Temperature: "+hp20x.getTemperature()+"\tPressure: "+hp20x.getPressure()+"\tAltitude: "+hp20x.getAltitude());
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- System.out.println("The following exception occured: "+e.getMessage());
- }
- }
- //! [Interesting]
- }
-}
diff --git a/peripheral/libupm/examples/java/HTU21DSample.java b/peripheral/libupm/examples/java/HTU21DSample.java
deleted file mode 100644
index 33ad1a2..0000000
--- a/peripheral/libupm/examples/java/HTU21DSample.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-//NOT TESTED!!!
-public class HTU21DSample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- float humidity = 0;
- float temperature = 0;
- float compRH = 0;
-
- upm_htu21d.HTU21D sensor = new upm_htu21d.HTU21D(0);
- sensor.testSensor();
-
- while (true) {
- compRH = sensor.getCompRH();
- humidity = sensor.getHumidity();
- temperature = sensor.getTemperature();
-
- System.out.println("Humidity: " + humidity + ", Temperature: " + temperature
- + ", compensated RH: " + compRH);
-
- Thread.sleep(5000);
- }
- // ! [Interesting]
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/Hmc5883lSample.java b/peripheral/libupm/examples/java/Hmc5883lSample.java
deleted file mode 100644
index c16439c..0000000
--- a/peripheral/libupm/examples/java/Hmc5883lSample.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-public class Hmc5883lSample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Instantiate on I2C
- upm_hmc5883l.Hmc5883l compas = new upm_hmc5883l.Hmc5883l(0);
-
- short[] pos;
-
- // Set your declination from true north in radians
- compas.set_declination(0.2749f);
-
- while (true) {
- // Update the coordinates
- compas.update();
-
- pos = compas.coordinates();
- System.out.println("Coor: " + pos[0] + " " + pos[1] + " " + pos[2]);
- System.out.println("Heading: " + compas.heading() + " Direction:" + compas.direction());
-
- Thread.sleep(2000);
- }
- // ! [Interesting]
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/Itg3200Sample.java b/peripheral/libupm/examples/java/Itg3200Sample.java
deleted file mode 100644
index 9edaa92..0000000
--- a/peripheral/libupm/examples/java/Itg3200Sample.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-//NOT TESTED!!!
-public class Itg3200Sample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- short[] rot;
- float[] ang;
-
- // Note: Sensor not supported on Intel Edison with Arduino breakout
- upm_itg3200.Itg3200 gyro = new upm_itg3200.Itg3200(0);
-
- while (true) {
- gyro.update();
- rot = gyro.getRawValues();
- ang = gyro.getRotation();
-
- System.out.println("Raw Values: X: " + rot[0] + " Y: " + rot[1] + " Z: " + rot[2]);
- System.out.println("Angular Velocities: X: " + ang[0] + " Y: " + ang[1] + " Z: "
- + ang[2]);
-
- System.out.println("Temp: " + gyro.getTemperature() + ", Raw: " + gyro.getRawTemp());
-
- Thread.sleep(1000);
- }
- // ! [Interesting]
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/Jhd1313m1Sample.java b/peripheral/libupm/examples/java/Jhd1313m1Sample.java
deleted file mode 100644
index db84426..0000000
--- a/peripheral/libupm/examples/java/Jhd1313m1Sample.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-public class Jhd1313m1Sample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- upm_i2clcd.Jhd1313m1 lcd = new upm_i2clcd.Jhd1313m1(0);
-
- lcd.setCursor(0, 0);
- lcd.write("Hello World");
- lcd.setCursor(1, 2);
- lcd.write("Hello World");
-
- System.out.println("Sleeping for 5 seconds");
- Thread.sleep(5000);
- lcd.clear();
- // ! [Interesting]
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/Jhd1313m1_lcdSample.java b/peripheral/libupm/examples/java/Jhd1313m1_lcdSample.java
deleted file mode 100644
index bda1994..0000000
--- a/peripheral/libupm/examples/java/Jhd1313m1_lcdSample.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-public class Jhd1313m1_lcdSample{
-
- public static void main(String[] args) throws InterruptedException {
- //! [Interesting]
- upm_i2clcd.Jhd1313m1 lcd = new upm_i2clcd.Jhd1313m1(1, 0x3E, 0x62);
-
- lcd.setCursor(0,0);
- lcd.write("Hello World");
- lcd.setCursor(1,2);
- lcd.write("Hello World");
-
- System.out.println("Sleeping for 5 seconds");
- Thread.sleep(5000);
- lcd.clear();
- //! [Interesting]
- }
-
-}
diff --git a/peripheral/libupm/examples/java/Joystick12Sample.java b/peripheral/libupm/examples/java/Joystick12Sample.java
deleted file mode 100644
index 31660bc..0000000
--- a/peripheral/libupm/examples/java/Joystick12Sample.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-public class Joystick12Sample {
-
- public static void main(String[] args) throws InterruptedException {
- //! [Interesting]
- // Instantiate a joystick on analog pins A0 and A1
- upm_joystick12.Joystick12 joystick = new upm_joystick12.Joystick12(0,1);
-
- // Print the X and Y input values every second
- while(true){
- float x = joystick.getXInput();
- float y = joystick.getYInput();
-
- System.out.println("Driving X: " + x + " , and Y: " + y );
-
- Thread.sleep(1000);
- }
- //! [Interesting]
- }
-
-}
diff --git a/peripheral/libupm/examples/java/Joystick12_exampleSample.java b/peripheral/libupm/examples/java/Joystick12_exampleSample.java
deleted file mode 100644
index 442d59c..0000000
--- a/peripheral/libupm/examples/java/Joystick12_exampleSample.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-public class Joystick12_exampleSample {
-
- public static void main(String[] args) throws InterruptedException {
- //! [Interesting]
- // Instantiate a joystick on analog pins A0 and A1
- upm_joystick12.Joystick12 joystick = new upm_joystick12.Joystick12(0,1);
-
- // Print the X and Y input values every second
- while(true){
- float x = joystick.getXInput();
- float y = joystick.getYInput();
-
- System.out.println("Driving X: " + x + " , and Y: " + y );
-
- Thread.sleep(1000);
- }
- //! [Interesting]
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/LDT0028Sample.java b/peripheral/libupm/examples/java/LDT0028Sample.java
deleted file mode 100644
index 0d3970e..0000000
--- a/peripheral/libupm/examples/java/LDT0028Sample.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-//NOT TESTED!!!
-public class LDT0028Sample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
-
- // Create the LDT0-028 Piezo Vibration Sensor object using AIO pin 0
- upm_ldt0028.LDT0028 sensor = new upm_ldt0028.LDT0028(0);
-
- System.out.println("Sensor name: " + sensor.name());
-
- while (true) {
- System.out.println("Sample value: " + sensor.getSample());
- Thread.sleep(1000);
- }
- // ! [Interesting]
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/LSM303Sample.java b/peripheral/libupm/examples/java/LSM303Sample.java
deleted file mode 100644
index 3644e02..0000000
--- a/peripheral/libupm/examples/java/LSM303Sample.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-//NOT TESTED!!!
-public class LSM303Sample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Instantiate LSM303 compass on I2C
- upm_lsm303.LSM303 sensor = new upm_lsm303.LSM303(0);
-
- // Get the coordinate data
- sensor.getCoordinates();
- short[] coor = sensor.getRawCoorData(); // in XYZ order.·
- // The sensor returns XZY, but the driver compensates and makes it XYZ
-
- // Print out the X, Y, and Z coordinate data using two different methods
- System.out.println("coor: rX " + coor[0] + " - rY " + coor[1] + " - rZ " + coor[2]);
- System.out.println("coor: gX " + sensor.getCoorX() + " - gY " + sensor.getCoorY()
- + " - gZ " + sensor.getCoorZ());
-
- // Get and print out the heading
- System.out.println("heading: " + sensor.getHeading());
-
- // Get the acceleration
- sensor.getAcceleration();
- short[] accel = sensor.getRawAccelData();
-
- // Print out the X, Y, and Z acceleration data using two different
- // methods
- System.out.println("acc: rX " + accel[0] + " - rY " + accel[1] + " - rZ " + accel[2]);
- System.out.println("acc: gX " + sensor.getAccelX() + " - gY " + sensor.getAccelY()
- + " - gZ " + sensor.getAccelZ());
-
- // ! [Interesting]
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/Lcm1602_i2cSample.java b/peripheral/libupm/examples/java/Lcm1602_i2cSample.java
deleted file mode 100644
index 53b8ba4..0000000
--- a/peripheral/libupm/examples/java/Lcm1602_i2cSample.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-//NOT TESTED!!!
-public class Lcm1602_i2cSample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- upm_i2clcd.Lcm1602 lcd = new upm_i2clcd.Lcm1602(0, 0x27);
-
- lcd.setCursor(0, 0);
- lcd.write("Hello World");
- Thread.sleep(3000);
-
- lcd.setCursor(1, 2);
- lcd.write("Hello World");
- Thread.sleep(3000);
-
- lcd.setCursor(2, 4);
- lcd.write("Hello World");
- Thread.sleep(3000);
-
- lcd.setCursor(3, 6);
- lcd.write("Hello World");
- Thread.sleep(3000);
- // ! [Interesting]
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/Lcm1602_parallelSample.java b/peripheral/libupm/examples/java/Lcm1602_parallelSample.java
deleted file mode 100644
index e720d23..0000000
--- a/peripheral/libupm/examples/java/Lcm1602_parallelSample.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-//NOT TESTED!!!
-public class Lcm1602_parallelSample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // LCD connection:
- // LCD RS pin to digital pin 8
- // LCD Enable pin to digital pin 13
- // LCD D4 pin to digital pin 2
- // LCD D5 pin to digital pin 3
- // LCD D6 pin to digital pin 4
- // LCD D7 pin to digital pin 5
- // LCD R/W pin to ground
- // 10K trimmer potentiometer:
- // ends to +5V and ground
- // wiper to LCD VO pin (pin 3)
- upm_i2clcd.Lcm1602 lcd = new upm_i2clcd.Lcm1602((short) 8, (short) 13, (short) 2, (short) 3, (short) 4, (short) 5, (short) 20, (short) 2);
-
- lcd.setCursor(0, 0);
- lcd.write("Hello World");
- lcd.setCursor(1, 2);
- lcd.write("Hello World");
-
- System.out.println("Sleeping for 5 seconds");
- Thread.sleep(5000);
- // ! [Interesting]
- }
-}
diff --git a/peripheral/libupm/examples/java/LoLSample.java b/peripheral/libupm/examples/java/LoLSample.java
deleted file mode 100644
index c37a6ca..0000000
--- a/peripheral/libupm/examples/java/LoLSample.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-//NOT TESTED!!!
-public class LoLSample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- upm_lol.LoL sensor = new upm_lol.LoL();
-
- int x = 0, y = 0;
- while (true) {
- // revert pixel
- sensor.setPixel(x, y, sensor.getPixel(x, y));
-
- if (++x == 13) {
- x = 0;
- y++;
- }
- if (y == 9)
- y = 0;
- Thread.sleep(10);
- }
- // ! [Interesting]
- }
-}
diff --git a/peripheral/libupm/examples/java/LoL_exampleSample.java b/peripheral/libupm/examples/java/LoL_exampleSample.java
deleted file mode 100644
index b6d2bf3..0000000
--- a/peripheral/libupm/examples/java/LoL_exampleSample.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-//NOT TESTED!!!
-public class LoL_exampleSample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- upm_lol.LoL sensor = new upm_lol.LoL();
-
- int x = 0, y = 0;
- while (true) {
- // revert pixel
- sensor.setPixel(x, y, sensor.getPixel(x, y));
-
- if (++x == 13) {
- x = 0;
- y++;
- }
- if (y == 9)
- y = 0;
- Thread.sleep(10);
- }
- // ! [Interesting]
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/M24LR64ESample.java b/peripheral/libupm/examples/java/M24LR64ESample.java
deleted file mode 100644
index a0152a1..0000000
--- a/peripheral/libupm/examples/java/M24LR64ESample.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-//NOT TESTED!!!
-public class M24LR64ESample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Instantiate an M24LR64E on I2C bus 0
- upm_m24lr64e.M24LR64E nfcTag = new upm_m24lr64e.M24LR64E(0);
-
- // This example accesses the device in the 'user' (default) mode,
- // reads the last byte of data in the EEPROM, inverts it, writes
- // it back, and then re-reads it.
-
- // Read the last byte of the EEPROM area
- int addr = upm_m24lr64e.M24LR64E.EEPROM_I2C_LENGTH - 1;
- System.out.println("Address: " + addr);
- short read = nfcTag.readByte(addr);
- System.out.println("Read: " + read);
-
- // Now change it to it's opposite and write it
- read = (short) (~read & 0xff);
- nfcTag.writeByte(addr, read);
- System.out.println("Wrote: " + read);
-
- // Now read it back
- read = nfcTag.readByte(addr);
- System.out.println("Read: " + read);
-
- // ! [Interesting]
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/MAX44000Sample.java b/peripheral/libupm/examples/java/MAX44000Sample.java
deleted file mode 100644
index 67e7e03..0000000
--- a/peripheral/libupm/examples/java/MAX44000Sample.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-//NOT TESTED!!!
-public class MAX44000Sample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- upm_max44000.MAX44000 sensor = new upm_max44000.MAX44000(0);
-
- while (true) {
- System.out.println("proximity value = " + sensor.getAmbient());
- Thread.sleep(1000);
- }
- // ! [Interesting]
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/MHZ16Sample.java b/peripheral/libupm/examples/java/MHZ16Sample.java
deleted file mode 100644
index 9059a23..0000000
--- a/peripheral/libupm/examples/java/MHZ16Sample.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-//NOT TESTED!!!
-public class MHZ16Sample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Instantiate a MHZ16 serial CO2 sensor on uart 0.
- upm_mhz16.MHZ16 co2 = new upm_mhz16.MHZ16(0);
-
- System.out.println("Make sure that the sensor has had at least 3 minutes to warm up");
- System.out.println("or you will not get valid results.");
- System.out.println("The temperature reported is not the ambient temperature,");
- System.out.println("but rather the temperature of the sensor elements.");
-
- while (true) {
- if (!co2.getData()) {
- System.out.println("Failed to retrieve data");
- continue;
- }
- System.out.println("CO2 concentration: " + co2.getGas() + "PPM, Temperature (in C): "
- + co2.getTemperature());
-
- Thread.sleep(2000);
- }
- // ! [Interesting]
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/MMA7455Sample.java b/peripheral/libupm/examples/java/MMA7455Sample.java
deleted file mode 100644
index 08ee897..0000000
--- a/peripheral/libupm/examples/java/MMA7455Sample.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-//NOT TESTED!!!
-public class MMA7455Sample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- upm_mma7455.MMA7455 sensor = new upm_mma7455.MMA7455(0);
- short[] val;
-
- while (true) {
- val = sensor.readData();
- System.out.println("Accelerometer X: " + val[0] + ", Y: " + val[1] + ", Z: " + val[2]);
-
- Thread.sleep(1000);
- }
- // ! [Interesting]
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/MMA7660Sample.java b/peripheral/libupm/examples/java/MMA7660Sample.java
deleted file mode 100644
index 77736e2..0000000
--- a/peripheral/libupm/examples/java/MMA7660Sample.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-//NOT TESTED!!!
-public class MMA7660Sample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Instantiate an MMA7660 on I2C bus 0
- upm_mma7660.MMA7660 accel = new upm_mma7660.MMA7660(0);
-
- // place device in standby mode so we can write registers
- accel.setModeStandby();
-
- // enable 64 samples per second
- accel.setSampleRate(upm_mma7660.MMA7660.MMA7660_AUTOSLEEP_T.AUTOSLEEP_64);
-
- // place device into active mode
- accel.setModeActive();
-
- while (true) {
- int[] rawValues = accel.getRawValues();
- System.out.println("Raw Values: x = " + rawValues[0] + " y = " + rawValues[1] + " x = "
- + rawValues[2]);
-
- float[] acceleration = accel.getAcceleration();
- System.out.println("Raw Values: x = " + acceleration[0] + " y = " + acceleration[1]
- + " x = " + acceleration[2]);
-
- Thread.sleep(1000);
- }
- // ! [Interesting]
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/MPL3115A2Sample.java b/peripheral/libupm/examples/java/MPL3115A2Sample.java
deleted file mode 100644
index 8f5b877..0000000
--- a/peripheral/libupm/examples/java/MPL3115A2Sample.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-//NOT TESTED!!!
-public class MPL3115A2Sample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Instantiate a MPL3115A2 sensor on I2C
- upm_mpl3115a2.MPL3115A2 sensor = new upm_mpl3115a2.MPL3115A2(0);
-
- while (true) {
- System.out.println("Pressure: " + sensor.getPressure());
- System.out.println("Altitude: " + sensor.getAltitude());
- System.out.println("Sealevel pressure: " + sensor.getSealevelPressure());
- System.out.println("Temperature: " + sensor.getTemperature());
- System.out.println();
-
- Thread.sleep(1000);
- }
- // ! [Interesting]
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/MPR121Sample.java b/peripheral/libupm/examples/java/MPR121Sample.java
deleted file mode 100644
index 37128b1..0000000
--- a/peripheral/libupm/examples/java/MPR121Sample.java
+++ /dev/null
@@ -1,34 +0,0 @@
-public class MPR121Sample {
-
- private static void printButtons(upm_mpr121.MPR121 touch) {
- boolean buttonPresed = false;
-
- System.out.print("Buttons pressed: ");
- for (int i = 0; i < 12; i++) {
- if ((touch.getM_buttonStates() & (1 << i)) != 0) {
- System.out.print(i + " ");
- buttonPresed = true;
- }
- }
-
- if (!buttonPresed)
- System.out.print("None ");
-
- System.out.println();
- }
-
- public static void main(String[] args) throws InterruptedException {
- // Instantiate an MPR121 on I2C bus 0
- upm_mpr121.MPR121 touch = new upm_mpr121.MPR121(0);
-
- // init according to AN3944 defaults
- touch.configAN3944();
-
- while (true) {
- touch.readButtons();
- printButtons(touch);
- Thread.sleep(1000);
- }
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/MPU9150Sample.java b/peripheral/libupm/examples/java/MPU9150Sample.java
deleted file mode 100644
index a8de875..0000000
--- a/peripheral/libupm/examples/java/MPU9150Sample.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-//NOT TESTED!!!
-public class MPU9150Sample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- upm_mpu9150.MPU9150 sensor = new upm_mpu9150.MPU9150();
-
- sensor.init();
-
- while (true) {
- sensor.update();
-
- float[] accel = sensor.getAccelerometer();
- System.out.println("Accelerometer: " + "AX: " + accel[0] + " AY: " + accel[1] + " AZ: "
- + accel[2]);
-
- float[] gyro = sensor.getGyroscope();
- System.out.println("Gryoscope: " + "GX: " + gyro[0] + " GY: " + gyro[1] + " GZ: "
- + gyro[2]);
-
- float[] magn = sensor.getMagnetometer();
- System.out.println("Magnetometer: " + "MX: " + magn[0] + " MY: " + magn[1] + " MZ: "
- + magn[2]);
-
- Thread.sleep(1000);
- }
- // ! [Interesting]
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/MQ2Sample.java b/peripheral/libupm/examples/java/MQ2Sample.java
deleted file mode 100644
index fbad70a..0000000
--- a/peripheral/libupm/examples/java/MQ2Sample.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-//NOT TESTED!!!
-public class MQ2Sample {
- private static final short resolution = 5;
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- short[] buffer = new short[128];
-
- // Attach gas sensor to A0
- upm_gas.MQ2 sensor = new upm_gas.MQ2(0);
-
- upm_gas.thresholdContext ctx = new upm_gas.thresholdContext();
- ctx.setAverageReading(0);
- ctx.setRunningAverage(0);
- ctx.setAveragedOver(2);
-
- while (true) {
- int len = sensor.getSampledWindow(2, buffer);
-
- if (len != 0) {
- int thresh = sensor.findThreshold(ctx, 30, buffer);
- sensor.printGraph(ctx, resolution);
- if (thresh != 0) {
- System.out.println("---Threshold reached---");
- }
- }
-
- Thread.sleep(1000);
- }
- // ! [Interesting]
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/MQ303ASample.java b/peripheral/libupm/examples/java/MQ303ASample.java
deleted file mode 100644
index 13365b4..0000000
--- a/peripheral/libupm/examples/java/MQ303ASample.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-public class MQ303ASample {
-
- public static void main(String[] args) throws InterruptedException {
- // Instantiate an mq303a sensor on analog pin A0
-
- // This device uses a heater powered from an analog I/O pin.·
- // If using A0 as the data pin, then you need to use A1, as the heater
- // pin (if using a grove mq303a). For A1, we can use the D15 gpio,·
- // setup as an output, and drive it low to power the heater.
- upm_mq303a.MQ303A mq303a = new upm_mq303a.MQ303A(1, 15);
-
- System.out.println("Enabling heater and waiting 2 minutes for warmup.");
- mq303a.heaterEnable(true);
- Thread.sleep(120000);
-
- System.out.println("This sensor may need to warm until the value drops below about 450.");
-
- for (int i = 1; i < 10; i++) {
- int val = mq303a.value();
- System.out.println("Alcohol detected (higher means stronger alcohol): " + val);
-
- Thread.sleep(1000);
- }
-
- mq303a.heaterEnable(false);
- System.out.println("Exiting");
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/MQ5Sample.java b/peripheral/libupm/examples/java/MQ5Sample.java
deleted file mode 100644
index c2ae23d..0000000
--- a/peripheral/libupm/examples/java/MQ5Sample.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-public class MQ5Sample {
- private static final short resolution = 7;
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- short[] buffer = new short[128];
-
- // Attach gas sensor to A0
- upm_gas.MQ5 sensor = new upm_gas.MQ5(0);
-
- upm_gas.thresholdContext ctx = new upm_gas.thresholdContext();
- ctx.setAverageReading(0);
- ctx.setRunningAverage(0);
- ctx.setAveragedOver(2);
-
- while (true) {
- int len = sensor.getSampledWindow(2, buffer);
-
- if (len != 0) {
- int thresh = sensor.findThreshold(ctx, 30, buffer);
- sensor.printGraph(ctx, resolution);
- if (thresh != 0) {
- System.out.println("---Threshold reached---");
- }
- }
-
- Thread.sleep(1000);
- }
- // ! [Interesting]
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/MicrophoneSample.java b/peripheral/libupm/examples/java/MicrophoneSample.java
deleted file mode 100644
index d59fc32..0000000
--- a/peripheral/libupm/examples/java/MicrophoneSample.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-public class MicrophoneSample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- short[] buffer = new short[128];
-
- // Attach microphone to analog port A0
- upm_mic.Microphone sensor = new upm_mic.Microphone(0);
-
- upm_mic.thresholdContext ctx = new upm_mic.thresholdContext();
- ctx.setAverageReading(0);
- ctx.setRunningAverage(0);
- ctx.setAveragedOver(2);
-
- // Repeatedly, take a sample every 2 microseconds;
- // find the average of 128 samples; and
- // print a running graph of the averages
- while (true) {
- int len = sensor.getSampledWindow(2, buffer);
-
- if (len != 0) {
- int thresh = sensor.findThreshold(ctx, 30, buffer);
- sensor.printGraph(ctx);
- if (thresh != 0) {
- System.out.println("---Threshold reached--- " + ctx.getRunningAverage() + " "
- + ctx.getAverageReading());
- }
- }
- }
- // ! [Interesting]
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/NRF24L01_receiverSample.java b/peripheral/libupm/examples/java/NRF24L01_receiverSample.java
deleted file mode 100644
index c5dc481..0000000
--- a/peripheral/libupm/examples/java/NRF24L01_receiverSample.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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 upm_nrf24l01.Callback;
-
-//NOT TESTED!!!
-public class NRF24L01_receiverSample {
-
- static private final byte[] local_address = {0x01, 0x01, 0x01, 0x01, 0x01};
- static private final byte[] broadcast_address = {(byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
- (byte) 0xFF, (byte) 0xFF};
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- upm_nrf24l01.NRF24L01 comm = new upm_nrf24l01.NRF24L01((short) 7, (short) 8);
-
- Callback callback = new ReceiverCallback(comm);
-
- comm.setSourceAddress(local_address);
- comm.setDestinationAddress(broadcast_address);
- comm.setPayload((short) upm_nrf24l01.javaupm_nrf24l01Constants.MAX_BUFFER);
- comm.configure();
- comm.setSpeedRate(upm_nrf24l01.speed_rate_t.NRF_250KBPS);
- comm.setChannel((short) 99);
- comm.setDataReceivedHandler(callback);
-
- while (true) {
- comm.pollListener();
- }
-
- // ! [Interesting]
- }
-}
-
-class ReceiverCallback extends Callback {
-
- private upm_nrf24l01.NRF24L01 comm = null;
-
- public ReceiverCallback(upm_nrf24l01.NRF24L01 comm) {
- super();
- this.comm = comm;
- }
- public void run() {
- if (comm != null) {
- short[] rx_buffer = comm.getM_rxBuffer();
- System.out.print("Received: ");
- for (int i = 0; i < rx_buffer.length; i++)
- System.out.print(rx_buffer[i]);
- System.out.println();
- } else {
- System.out.println("No NRF24L01 instance given to callback");
- }
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/NRF24L01_transmitterSample.java b/peripheral/libupm/examples/java/NRF24L01_transmitterSample.java
deleted file mode 100644
index f2918f0..0000000
--- a/peripheral/libupm/examples/java/NRF24L01_transmitterSample.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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 upm_nrf24l01.Callback;
-
-//NOT TESTED!!!
-public class NRF24L01_transmitterSample {
-
- static private final byte[] destAddress = {0x01, 0x01, 0x01, 0x01, 0x01};
- static private final byte[] srcAddress = {0x01, 0x01, 0x01, 0x01, 0x01};
- static private byte[] tx_buffer = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A,
- 0x00};
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- upm_nrf24l01.NRF24L01 comm = new upm_nrf24l01.NRF24L01((short) 7, (short) 8);
-
- Callback callback = new TransmitterCallback();
-
- comm.setSourceAddress(srcAddress);
- comm.setDestinationAddress(destAddress);
- comm.setPayload((short) upm_nrf24l01.javaupm_nrf24l01Constants.MAX_BUFFER);
- comm.setChannel((short) 99);
- comm.configure();
- comm.setDataReceivedHandler(callback);
-
- while (true) {
- comm.send(tx_buffer);
- System.out.println("devi2 :: sending data ....");
- for (int i = 0; i < tx_buffer.length; i++)
- System.out.print(tx_buffer[i]);
- System.out.println();
- Thread.sleep(3000);
- }
- // ! [Interesting]
- }
-}
-
-class TransmitterCallback extends Callback {
- public TransmitterCallback() {
- super();
- }
- public void run() {
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/NUNCHUCKSample.java b/peripheral/libupm/examples/java/NUNCHUCKSample.java
deleted file mode 100644
index 0a26d99..0000000
--- a/peripheral/libupm/examples/java/NUNCHUCKSample.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-public class NUNCHUCKSample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Instantiate a nunchuck controller bus 0
- upm_nunchuck.NUNCHUCK nunchuck = new upm_nunchuck.NUNCHUCK(0);
-
- // always do this first
- System.out.println("Initializing... ");
- if (!nunchuck.init()) {
- System.err.println("nunchuck->init() failed.");
- return;
- }
-
- while (true) {
- nunchuck.update();
- System.out.println("stickX: " + nunchuck.getStickX() + ", stickY: "
- + nunchuck.getStickY());
- System.out.println("accelX: " + nunchuck.getAccelX() + ", accelY: "
- + nunchuck.getAccelY() + ", accelZ: " + nunchuck.getAccelZ());
-
- if (nunchuck.getButtonC())
- System.out.println("Button C pressed");
- else
- System.out.println("Button C not pressed");
-
- if (nunchuck.getButtonZ())
- System.out.println("Button Z pressed");
- else
- System.out.println("Button Z not pressed");
-
- Thread.sleep(1000);
- }
- // ! [Interesting]
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/OTP538USample.java b/peripheral/libupm/examples/java/OTP538USample.java
deleted file mode 100644
index 07b3ba9..0000000
--- a/peripheral/libupm/examples/java/OTP538USample.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-public class OTP538USample {
- private static final float OTP538U_AREF = 5;
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Instantiate a OTP538U on analog pins A0 and A1
- // A0 is used for the Ambient Temperature and A1 is used for the Object
- // temperature.
- upm_otp538u.OTP538U temps = new upm_otp538u.OTP538U(0, 1, OTP538U_AREF);
-
- while (true) {
- System.out.println("Ambient temp: " + temps.ambientTemperature() + " C");
- System.out.println("Object temp: " + temps.objectTemperature() + " C");
-
- Thread.sleep(1000);
- }
- // ! [Interesting]
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/PPD42NSSample.java b/peripheral/libupm/examples/java/PPD42NSSample.java
deleted file mode 100644
index 78d0628..0000000
--- a/peripheral/libupm/examples/java/PPD42NSSample.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-public class PPD42NSSample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Instantiate a dust sensor on GPIO pin D8
- upm_ppd42ns.PPD42NS dust = new upm_ppd42ns.PPD42NS(8);
- upm_ppd42ns.dustData data;
-
- System.out.println("This program will give readings every 30 seconds until you stop it");
-
- while (true) {
- data = dust.getData();
-
- System.out.println("Low pulse occupancy: " + data.getLowPulseOccupancy());
- System.out.println("Ratio: " + data.getRatio());
- System.out.println("Concentration: " + data.getConcentration());
- }
- // ! [Interesting]
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/PulsensorSample.java b/peripheral/libupm/examples/java/PulsensorSample.java
deleted file mode 100644
index fb1e85b..0000000
--- a/peripheral/libupm/examples/java/PulsensorSample.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Author: Andrei Vasiliu <andrei.vasiliu@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 upm_pulsensor.*;
-
-public class PulsensorSample {
- static class PulsensorCallback extends Callback {
- public PulsensorCallback() {
- super();
- }
- public void run (clbk_data arg) {
- System.out.println();
- }
- }
-
- public static void main (String[] args) throws InterruptedException {
- // ! [Interesting]
- Callback obj_call = new PulsensorCallback();
- Pulsensor p = new Pulsensor(obj_call);
- p.start_sampler();
- Thread.sleep(1000);
- p.stop_sampler();
- // ! [Interesting]
- }
-}
diff --git a/peripheral/libupm/examples/java/RFR359FSample.java b/peripheral/libupm/examples/java/RFR359FSample.java
deleted file mode 100644
index 0c286de..0000000
--- a/peripheral/libupm/examples/java/RFR359FSample.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-public class RFR359FSample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Instantiate an RFR359F digital pin D2
- upm_rfr359f.RFR359F dInterruptor = new upm_rfr359f.RFR359F(2);
-
- while (true) {
- if (dInterruptor.objectDetected()) {
- System.out.println("Object detected");
- } else {
- System.out.println("Area is clear!");
- }
-
- Thread.sleep(100);
- }
- // ! [Interesting]
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/RPR220Sample.java b/peripheral/libupm/examples/java/RPR220Sample.java
deleted file mode 100644
index ae76be6..0000000
--- a/peripheral/libupm/examples/java/RPR220Sample.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-public class RPR220Sample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // This example uses a simple method to determine current status
-
- // Instantiate an RPR220 digital pin D2
- upm_rpr220.RPR220 sensor = new upm_rpr220.RPR220(2);
-
- while (true) {
- if (sensor.blackDetected())
- System.out.println("Black detected");
- else
- System.out.println("Black NOT detected");
-
- Thread.sleep(100);
- }
- // ! [Interesting]
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/RPR220_intrSample.java b/peripheral/libupm/examples/java/RPR220_intrSample.java
deleted file mode 100644
index 1ea80b4..0000000
--- a/peripheral/libupm/examples/java/RPR220_intrSample.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-public class RPR220_intrSample {
-
- public static int counter = 0;
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // This example uses an interrupt handler to increment a counter
-
- // Instantiate an RPR220 digital pin D2
- upm_rpr220.RPR220 sensor = new upm_rpr220.RPR220(2);
-
- RPRISR callback = new RPRISR();
- sensor.installISR(callback);
-
- while (true) {
- System.out.println("Counter: " + counter);
- Thread.sleep(1000);
- }
- // ! [Interesting]
- }
-}
-
-class RPRISR implements Runnable {
- public RPRISR() {
- super();
- }
- public void run() {
- RPR220_intrSample.counter++;
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/RotaryEncoderSample.java b/peripheral/libupm/examples/java/RotaryEncoderSample.java
deleted file mode 100644
index 8272f57..0000000
--- a/peripheral/libupm/examples/java/RotaryEncoderSample.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-public class RotaryEncoderSample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Instantiate a Grove Rotary Encoder, using signal pins D2 and D3
- upm_rotaryencoder.RotaryEncoder rotaryencoder = new upm_rotaryencoder.RotaryEncoder(2, 3);
-
- while (true) {
- System.out.println("Position: " + rotaryencoder.position());
-
- Thread.sleep(1000);
- }
- // ! [Interesting]
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/SSD1308_oledSample.java b/peripheral/libupm/examples/java/SSD1308_oledSample.java
deleted file mode 100644
index c7a5bd3..0000000
--- a/peripheral/libupm/examples/java/SSD1308_oledSample.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-//NOT TESTED!!!
-public class SSD1308_oledSample {
-
- static private final int[] IntelLogo = new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 192,
- 192, 192, 224, 224, 224, 224, 240, 240, 248, 248, 120, 120, 120, 120, 60, 60, 60, 60,
- 60, 62, 30, 30, 30, 30, 30, 30, 30, 31, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 31, 31, 31, 31, 31, 30, 62, 62, 62, 62,
- 126, 126, 124, 124, 252, 252, 248, 248, 240, 240, 240, 224, 224, 224, 192, 128, 128,
- 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128,
- 128, 128, 128, 128, 128, 128, 128, 0, 56, 56, 28, 30, 14, 15, 15, 7, 7, 7, 7, 3, 3, 1,
- 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 192, 192,
- 192, 192, 192, 192, 192, 192, 0, 0, 0, 0, 192, 193, 195, 195, 195, 7, 15, 15, 63, 127,
- 255, 255, 255, 254, 252, 252, 240, 192, 0, 0, 0, 0, 0, 0, 0, 0, 128, 192, 192, 240,
- 248, 124, 124, 60, 0, 0, 0, 0, 159, 159, 159, 159, 159, 159, 159, 159, 0, 0, 0, 0, 128,
- 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 0, 0, 0, 0, 0, 0, 254, 254, 254, 254, 254, 254, 254, 254, 128, 128, 128, 128,
- 128, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 192, 192, 192, 192, 192, 192, 128, 128, 128,
- 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 3, 7, 3, 3,
- 3, 0, 0, 0, 0, 0, 1, 1, 255, 255, 255, 255, 255, 255, 255, 0, 0, 224, 248, 252, 252,
- 255, 127, 15, 15, 3, 1, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 0,
- 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 15, 15, 15, 15, 15, 15, 255, 255, 255,
- 255, 255, 255, 255, 252, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 15, 15,
- 15, 15, 15, 224, 224, 252, 254, 255, 255, 255, 255, 159, 159, 143, 143, 135, 135, 143,
- 159, 255, 255, 255, 255, 255, 255, 252, 248, 0, 0, 0, 255, 255, 255, 255, 255, 255,
- 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 224, 248, 248, 255, 255, 255, 255,
- 255, 127, 15, 255, 255, 255, 255, 255, 255, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255,
- 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255,
- 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 255,
- 255, 255, 255, 255, 255, 192, 192, 192, 192, 192, 31, 31, 255, 255, 255, 255, 255, 255,
- 231, 231, 199, 199, 199, 199, 199, 199, 199, 199, 231, 231, 231, 231, 199, 135, 0, 0,
- 0, 63, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 224, 240, 248, 248, 252, 254,
- 255, 255, 255, 127, 63, 63, 31, 15, 7, 7, 1, 0, 0, 63, 63, 255, 255, 255, 255, 255,
- 240, 192, 192, 128, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 3, 7, 7, 7, 7, 7, 0, 0, 0, 0, 7, 7,
- 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 3, 3, 7,
- 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 1, 3, 3, 3, 7, 7, 7, 7, 15, 15, 15, 15, 7, 7, 7, 7, 7,
- 3, 3, 3, 1, 0, 0, 0, 0, 1, 3, 3, 7, 135, 135, 135, 192, 192, 0, 0, 7, 7, 3, 3, 3, 1, 1,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 7, 15, 15, 31, 127, 127, 127, 255, 255,
- 252, 252, 252, 248, 240, 240, 240, 224, 224, 224, 192, 192, 192, 192, 128, 128, 128,
- 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 128, 128, 128, 192, 192,
- 192, 192, 192, 224, 224, 224, 224, 240, 240, 240, 240, 248, 248, 248, 248, 252, 252,
- 252, 254, 254, 255, 255, 255, 255, 255, 255, 127, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 3, 3, 7, 7, 7, 15,
- 15, 31, 31, 31, 63, 63, 63, 63, 63, 127, 127, 127, 127, 127, 255, 255, 255, 255, 254,
- 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254,
- 254, 254, 254, 254, 254, 254, 255, 255, 255, 255, 255, 255, 255, 127, 127, 127, 127,
- 127, 127, 127, 127, 63, 63, 63, 63, 63, 31, 31, 31, 31, 31, 15, 15, 15, 15, 7, 7, 7, 7,
- 3, 3, 3, 3, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0};
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- upm_i2clcd.SSD1308 lcd = new upm_i2clcd.SSD1308(0);
-
- byte[] image = new byte[IntelLogo.length];
- for (int i = 0; i < IntelLogo.length; i++)
- image[i] = (byte) IntelLogo[i];
-
- lcd.clear();
- lcd.draw(image);
- // ! [Interesting]
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/SSD1327_oledSample.java b/peripheral/libupm/examples/java/SSD1327_oledSample.java
deleted file mode 100644
index defeea6..0000000
--- a/peripheral/libupm/examples/java/SSD1327_oledSample.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-//NOT TESTED!!!
-public class SSD1327_oledSample {
-
- static private final int[] SeeedLogo = new int[]{0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x08,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x04, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x06, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xC0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x01, 0xC0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x03, 0x80, 0x03, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
- 0x80, 0x03, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x80, 0x03,
- 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x80, 0x01, 0xC0, 0x08,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x07, 0x80, 0x01, 0xE0, 0x08, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x0F, 0x80, 0x01, 0xE0, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x30, 0x0F, 0x00, 0x01, 0xE0, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x30, 0x0F, 0x00, 0x01, 0xE0, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x0F,
- 0x00, 0x01, 0xE0, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x0F, 0x00, 0x01,
- 0xE0, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x0F, 0x00, 0x01, 0xE0, 0x18,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x0F, 0x00, 0x01, 0xE0, 0x38, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x38, 0x0F, 0x80, 0x01, 0xE0, 0x38, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x3C, 0x0F, 0x80, 0x01, 0xE0, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x3E, 0x0F, 0x80, 0x03, 0xE0, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x07,
- 0x80, 0x03, 0xE0, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x07, 0x80, 0x03,
- 0xE0, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x07, 0x80, 0x03, 0xC1, 0xF0,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x87, 0xC0, 0x07, 0xC1, 0xF0, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x0F, 0x83, 0xC0, 0x07, 0x83, 0xE0, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x0F, 0xC3, 0xC0, 0x07, 0x87, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x07, 0xE1, 0xE0, 0x07, 0x0F, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xF0,
- 0xE0, 0x0F, 0x0F, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xF8, 0xF0, 0x0E,
- 0x1F, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xF8, 0x70, 0x1C, 0x3F, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x30, 0x18, 0x7E, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x18, 0x30, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x1F, 0x88, 0x21, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x0F, 0xC4, 0x47, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
- 0xE0, 0x0F, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x3E,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0xE0, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x06, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00,
- 0x06, 0x00, 0x00, 0x60, 0x00, 0x7E, 0x3F, 0x0F, 0xC3, 0xF0, 0xFA, 0x0F, 0xDF, 0xE1,
- 0x9F, 0xEC, 0x7E, 0xE6, 0x73, 0x9C, 0xE7, 0x39, 0xCE, 0x1C, 0xDF, 0xE1, 0xB9, 0xEC,
- 0xE7, 0xE0, 0x61, 0xD8, 0x66, 0x1B, 0x86, 0x1C, 0x06, 0x61, 0xB0, 0x6D, 0xC3, 0x7C,
- 0x7F, 0xFF, 0xFF, 0xFF, 0x06, 0x0F, 0x86, 0x61, 0xB0, 0x6D, 0x83, 0x3E, 0x7F, 0xFF,
- 0xFF, 0xFF, 0x06, 0x07, 0xC6, 0x61, 0xB0, 0x6D, 0x83, 0xC3, 0x61, 0x18, 0x46, 0x03,
- 0x86, 0x18, 0x66, 0x61, 0xB0, 0x6D, 0xC3, 0xFE, 0x7F, 0x9F, 0xE7, 0xF9, 0xFE, 0x1F,
- 0xE6, 0x3F, 0x9F, 0xEC, 0xFE, 0x7E, 0x3F, 0x0F, 0xC3, 0xF0, 0xFA, 0x0F, 0xC6, 0x3F,
- 0x9F, 0xEC, 0x7E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x20, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x44, 0x00, 0x00, 0x20, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6C,
- 0xF3, 0xCF, 0x70, 0x9E, 0x79, 0xE7, 0x80, 0x00, 0x00, 0x00, 0x00, 0x7D, 0x9E, 0x68,
- 0x20, 0xB2, 0xC8, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x9E, 0x6F, 0x20, 0xB2,
- 0xF9, 0xE7, 0x80, 0x00, 0x00, 0x00, 0x00, 0x46, 0x9A, 0x61, 0x20, 0xB2, 0xCB, 0x60,
- 0x80, 0x00, 0x00, 0x00, 0x00, 0x7C, 0xF3, 0xCF, 0x30, 0x9E, 0x79, 0xE7, 0x90, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x7C, 0x02, 0x00, 0x00, 0x82, 0x60, 0x00, 0x00, 0xF8, 0x00, 0x00,
- 0x40, 0x40, 0x02, 0x00, 0x00, 0x83, 0x60, 0x00, 0x00, 0x8C, 0x00, 0x00, 0x40, 0x60,
- 0xB7, 0x79, 0xE7, 0x81, 0xC7, 0x92, 0x70, 0x89, 0xE7, 0x9E, 0x78, 0x7C, 0xE2, 0xC9,
- 0x2C, 0x81, 0xCC, 0xD2, 0x40, 0xFB, 0x21, 0xB2, 0x48, 0x40, 0x62, 0xF9, 0x2C, 0x80,
- 0x8C, 0xD2, 0x40, 0x8B, 0xE7, 0xB0, 0x48, 0x40, 0xE2, 0xC9, 0x2C, 0x80, 0x84, 0xD2,
- 0x40, 0x8B, 0x2D, 0x92, 0x48, 0x7D, 0xB3, 0x79, 0x27, 0x80, 0x87, 0x9E, 0x40, 0x8D,
- 0xE7, 0x9E, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- upm_i2clcd.SSD1327 lcd = new upm_i2clcd.SSD1327(0);
-
- // If you don't set the display to be white, the seeed logo will appear
- // jagged
- lcd.setGrayLevel((short) 12);
-
- byte[] image = new byte[SeeedLogo.length];
- for (int i = 0; i < SeeedLogo.length; i++)
- image[i] = (byte) SeeedLogo[i];
-
- lcd.draw(image);
-
- // Simple print hello world
- for (short i = 0; i < 12; i++) {
- lcd.setCursor(i, 0);
- lcd.setGrayLevel(i);
- lcd.write("Hello World");
- }
-
- // ! [Interesting]
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/ST7735Sample.java b/peripheral/libupm/examples/java/ST7735Sample.java
deleted file mode 100644
index a866e98..0000000
--- a/peripheral/libupm/examples/java/ST7735Sample.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-//NOT TESTED!!!
-public class ST7735Sample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- upm_st7735.ST7735 lcd = new upm_st7735.ST7735((short) 7, (short) 4, (short) 9, (short) 8);
-
- lcd.fillScreen(upm_st7735.javaupm_st7735Constants.ST7735_RED);
- lcd.refresh();
-
- lcd.fillScreen(upm_st7735.javaupm_st7735Constants.ST7735_CYAN);
- lcd.refresh();
-
- lcd.fillScreen(upm_st7735.javaupm_st7735Constants.ST7735_BLACK);
- lcd.refresh();
-
- lcd.drawLine((short) 10, (short) 10, (short) 10, (short) 100,
- upm_st7735.javaupm_st7735Constants.ST7735_MAGENTA);
- lcd.drawLine((short) 20, (short) 20, (short) 10, (short) 100,
- upm_st7735.javaupm_st7735Constants.ST7735_YELLOW);
- lcd.drawLine((short) 30, (short) 30, (short) 50, (short) 100,
- upm_st7735.javaupm_st7735Constants.ST7735_WHITE);
- lcd.refresh();
-
- lcd.drawPixel((short) 20, (short) 20, upm_st7735.javaupm_st7735Constants.ST7735_GREEN);
- lcd.refresh();
-
- lcd.drawTriangle((short) 50, (short) 50, (short) 80, (short) 80, (short) 60, (short) 90,
- upm_st7735.javaupm_st7735Constants.ST7735_GREEN);
- lcd.refresh();
-
- lcd.drawCircle((short) 100, (short) 110, (short) 10,
- upm_st7735.javaupm_st7735Constants.ST7735_BLUE);
- lcd.refresh();
-
- lcd.setTextWrap((short) 0);
-
- lcd.setCursor((short) 0, (short) 30);
- lcd.setTextColor(upm_st7735.javaupm_st7735Constants.ST7735_RED,
- upm_st7735.javaupm_st7735Constants.ST7735_RED);
- lcd.setTextSize((short) 1);
- lcd.print("Hello World!");
-
- lcd.setCursor((short) 10, (short) 50);
- lcd.setTextColor(upm_st7735.javaupm_st7735Constants.ST7735_RED,
- upm_st7735.javaupm_st7735Constants.ST7735_YELLOW);
- lcd.setTextSize((short) 2);
- lcd.print("BIG");
-
- lcd.refresh();
- // ! [Interesting]
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/StepMotorSample.java b/peripheral/libupm/examples/java/StepMotorSample.java
deleted file mode 100644
index 88cbe5a..0000000
--- a/peripheral/libupm/examples/java/StepMotorSample.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-//NOT TESTED!!!
-public class StepMotorSample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- upm_stepmotor.StepMotor sensor = new upm_stepmotor.StepMotor(2, 3);
-
- while (true) {
- System.out.println("One complete rotation forward and back at 60 rpm.");
- sensor.setSpeed(60);
- sensor.stepForward(200);
- Thread.sleep(1000);
- sensor.stepBackward(200);
- Thread.sleep(1000);
-
- System.out.println("One complete rotation forward and back at 150 rpm.");
- sensor.setSpeed(150);
- sensor.stepForward(200);
- Thread.sleep(1000);
- sensor.stepBackward(200);
- Thread.sleep(1000);
-
- System.out.println("One complete rotation forward and back at 300 rpm.");
- sensor.setSpeed(300);
- sensor.stepForward(200);
- Thread.sleep(1000);
- sensor.stepBackward(200);
- Thread.sleep(1000);
- }
- // ! [Interesting]
- }
-}
diff --git a/peripheral/libupm/examples/java/TM1637Sample.java b/peripheral/libupm/examples/java/TM1637Sample.java
deleted file mode 100644
index 840b969..0000000
--- a/peripheral/libupm/examples/java/TM1637Sample.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.time.LocalDateTime;
-
-//NOT TESTED!!!
-public class TM1637Sample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // TM1637 on pins 0 (clk) and 1 (dio)
- upm_tm1637.TM1637 myDisplay = new upm_tm1637.TM1637(0, 1);
-
- // Start a box using 7-segment encoding
- myDisplay.write(0x39, 0x09, 0x09);
-
- // Finish box using writeAt function
- myDisplay.writeAt(3, ']');
-
- // Wait 3 seconds
- Thread.sleep(3000);
-
- LocalDateTime now;
- while (true) {
- now = LocalDateTime.now();
- int hour = now.getHour();
- int min = now.getMinute();
- int sec = now.getSecond();
-
- System.out.println(hour + ":" + min + ":" + sec);
- myDisplay.writeString(hour + ":" + min);
-
- Thread.sleep(1000);
- }
- // ! [Interesting]
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/TP401Sample.java b/peripheral/libupm/examples/java/TP401Sample.java
deleted file mode 100644
index 89ac2b1..0000000
--- a/peripheral/libupm/examples/java/TP401Sample.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-public class TP401Sample {
- private static String airQuality(int value) {
- if (value < 50)
- return "Fresh Air";
- if (value < 200)
- return "Normal Indoor Air";
- if (value < 400)
- return "Low Pollution";
- if (value < 600)
- return "High Pollution - Action Recommended";
- return "Very High Pollution - Take Action Immediately";
- }
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Instantiate new grove air quality sensor on analog pin A0
- upm_gas.TP401 airSensor = new upm_gas.TP401(0);
-
- System.out.println(airSensor.name());
-
- System.out.println("Heating sensor for 3 minutes...");
- // wait 3 minutes for sensor to warm up
- for (int i = 0; i < 3; i++) {
- if (i != 0)
- System.out.println("Please wait, " + i + " minute(s) passed..");
- Thread.sleep(60000);
- }
- System.out.println("Sensor ready!");
-
- while (true) {
- int value = airSensor.getSample(); // Read raw value
- float ppm = airSensor.getPPM(); // Read CO ppm (can vary slightly
- // from previous read)
-
- System.out.println("raw: " + value + " ppm: " + ppm + " " + airQuality(value));
-
- Thread.sleep(100);
- }
- // ! [Interesting]
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/TSL2561Sample.java b/peripheral/libupm/examples/java/TSL2561Sample.java
deleted file mode 100644
index d366446..0000000
--- a/peripheral/libupm/examples/java/TSL2561Sample.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-public class TSL2561Sample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Instantiate a TSL2561 Digital Light Sensor on I2C
- upm_tsl2561.TSL2561 sensor = new upm_tsl2561.TSL2561();
-
- while (true) {
- System.out.println("Lux = " + sensor.getLux());
-
- Thread.sleep(1000);
- }
- // ! [Interesting]
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/TTP223Sample.java b/peripheral/libupm/examples/java/TTP223Sample.java
deleted file mode 100644
index 394efb5..0000000
--- a/peripheral/libupm/examples/java/TTP223Sample.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-public class TTP223Sample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- upm_ttp223.TTP223 touch = new upm_ttp223.TTP223(7);
-
- while (true) {
- if (touch.isPressed())
- System.out.println(touch.name() + " is pressed");
- else
- System.out.println(touch.name() + " is not pressed");
-
- Thread.sleep(1000);
- }
- // ! [Interesting]
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/Th02Example.java b/peripheral/libupm/examples/java/Th02Example.java
deleted file mode 100644
index f2a97c4..0000000
--- a/peripheral/libupm/examples/java/Th02Example.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
-* Author: Abhishek Malik <abhishek.malik@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 upm_th02.TH02;
-
-public class Th02Example {
-
- static {
- try {
- System.loadLibrary("javaupm_th02");
- 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) {
- // TODO Auto-generated method stub
- float temperature = 0;
- float humidity = 0;
-
- TH02 sensor = new TH02();
- while(true){
- temperature = sensor.getTemperature();
- humidity = sensor.getHumidity();
- System.out.println("Temperature = "+temperature+", Humidity = "+humidity);
- try {
- Thread.sleep(500);
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- System.out.println("The following exception has occured: "+e.getMessage());
- }
- }
- }
-
-}
diff --git a/peripheral/libupm/examples/java/ULN200XASample.java b/peripheral/libupm/examples/java/ULN200XASample.java
deleted file mode 100644
index 81f97ad..0000000
--- a/peripheral/libupm/examples/java/ULN200XASample.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-//NOT TESTED!!!
-public class ULN200XASample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Instantiate a Stepper motor on a ULN200XA Dual H-Bridge.
- // Wire the pins so that I1 is pin D8, I2 is pin D9, I3 is pin D10 and
- // I4 is pin D11
- upm_uln200xa.ULN200XA uln200xa = new upm_uln200xa.ULN200XA(4096, 8, 9, 10, 11);
-
- uln200xa.setSpeed(5);
- System.out.println("Rotating 1 revolution clockwise.");
- uln200xa.setDirection(upm_uln200xa.ULN200XA.ULN200XA_DIRECTION_T.DIR_CW);
- uln200xa.stepperSteps(4096);
-
- System.out.println("Sleeping for 2 seconds...");
- Thread.sleep(2000);
-
- System.out.println("Rotating 1/2 revolution counter clockwise.");
- uln200xa.setDirection(upm_uln200xa.ULN200XA.ULN200XA_DIRECTION_T.DIR_CCW);
- uln200xa.stepperSteps(2048);
-
- // turn off the power
- uln200xa.release();
- // ! [Interesting]
-
- System.out.println("Exiting...");
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/Ublox6Sample.java b/peripheral/libupm/examples/java/Ublox6Sample.java
deleted file mode 100644
index b7c5017..0000000
--- a/peripheral/libupm/examples/java/Ublox6Sample.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-public class Ublox6Sample {
- private static final int BUFFERLENGTH = 256;
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Instantiate a Ublox6 GPS device on uart 0
- upm_ublox6.Ublox6 nmea = new upm_ublox6.Ublox6(0);
-
- // make sure port is initialized properly. 9600 baud is the default.
- if (!nmea.setupTty()) {
- throw new RuntimeException("Failed to setup tty port parameters");
- }
-
- // Collect and output NMEA data. There are various libraries out on
- // the Internet, that can handle decoding NMEA data and presenting
- // it in a more easily accessible format. This example will just
- // check for, and read raw NMEA data from the device and output it
- // on standard output.
-
- // This device also supports numerous configuration options, which
- // you can set with writeData(). Please refer to the Ublox-6 data
- // sheet for further information on the formats of the data sent and
- // received, and the various operating modes available.
-
- byte[] nmeaBuffer = new byte[BUFFERLENGTH];
-
- while (true) {
- // we don't want the read to block in this example, so always
- // check to see if data is available first.
- if (nmea.dataAvailable()) {
- int rv = nmea.readData(nmeaBuffer);
-
- if (rv > 0)
- for (int i = 0; i < rv; i++)
- System.out.print((char) nmeaBuffer[i]);
-
- if (rv < 0) { // some sort of read error occurred
- System.err.println("Port read error.");
- break;
- }
- continue;
- }
-
- Thread.sleep(1000);
- }
- // ! [Interesting]
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/WT5001Sample.java b/peripheral/libupm/examples/java/WT5001Sample.java
deleted file mode 100644
index 2266b3d..0000000
--- a/peripheral/libupm/examples/java/WT5001Sample.java
+++ /dev/null
@@ -1,130 +0,0 @@
-import java.io.IOException;
-
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-//NOT TESTED!!!
-public class WT5001Sample {
-
- static private void printUsage() {
- System.out.println("Usage: java WT5001Sample <command>");
- System.out.println("Commands:");
- System.out.println("0 - stop playing");
- System.out.println("1 - start playing track 1");
- System.out.println("2 - pause/un-pause playback");
- System.out.println("3 - next track");
- System.out.println("4 - previous track");
- }
-
- public static void main(String[] args) {
- // ! [Interesting]
- // Instantiate a WT5001 serial MP3 player on uart 0
- upm_wt5001.WT5001 mp3 = new upm_wt5001.WT5001(0);
-
- int cmd = -1;
- if (args.length > 0)
- cmd = Integer.parseInt(args[0]);
-
- // make sure port is initialized properly. 9600 baud is the default
- if (!mp3.setupTty()) {
- System.err.println("error in loading native library");
- System.exit(-1);
- }
-
- switch (cmd) {
- case 0 :
- mp3.stop();
- break;
-
- case 1 :
- mp3.play(upm_wt5001.WT5001.WT5001_PLAYSOURCE_T.SD, 1);
- break;
-
- case 2 :
- mp3.pause();
- break;
-
- case 3 :
- mp3.next();
- break;
-
- case 4 :
- mp3.previous();
- break;
-
- default :
- // nothing, just output usage, and info below
- printUsage();
- break;
- }
-
- // print out some information
- try {
- short vol;
- vol = mp3.getVolume();
- System.out.println("The current volume is: " + vol);
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- try {
- short ps;
- ps = mp3.getPlayState();
- System.out.println("The current play state is: " + ps);
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- try {
- int numf;
- numf = mp3.getNumFiles(upm_wt5001.WT5001.WT5001_PLAYSOURCE_T.SD);
- System.out.println("The number of files on the SD card is: " + numf);
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- try {
- int curf;
- curf = mp3.getCurrentFile();
- System.out.println("The current file is: " + curf);
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- int year[] = new int[1];
- short month[] = new short[1];
- short day[] = new short[1];
- if (mp3.getDate(year, month, day))
- System.out.println("The device date is: " + year[0] + "/" + month[0] + "/" + day[0]);
-
- short hour[] = new short[1];
- short minute[] = new short[1];
- short second[] = new short[1];
- if (mp3.getTime(hour, minute, second))
- System.out
- .println("The device time is: " + hour[0] + ":" + minute[0] + ":" + second[0]);
- // ! [Interesting]
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/WaterLevelSensor.java b/peripheral/libupm/examples/java/WaterLevelSensor.java
deleted file mode 100644
index d08aaee..0000000
--- a/peripheral/libupm/examples/java/WaterLevelSensor.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Author: Abhishek Malik <abhishek.malik@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 upm_waterlevel.WaterLevel;
-
-public class WaterLevelSensor {
-
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- //! [Interesting]
- // Instantiating the sensor on Digital Pin 2
- WaterLevel level = new WaterLevel(2);
-
- while(true){
- if(level.isSubmerged()){
- System.out.println("The sensor is submerged");
- }
- else{
- System.out.println("The sensor is above water level");
- }
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- System.out.println("The following exception occured: "+e.getMessage());
- }
- }
- //! [Interesting]
- }
-
-}
diff --git a/peripheral/libupm/examples/java/YG1006Sample.java b/peripheral/libupm/examples/java/YG1006Sample.java
deleted file mode 100644
index b994829..0000000
--- a/peripheral/libupm/examples/java/YG1006Sample.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-public class YG1006Sample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Instantiate a yg1006 flame sensor on digital pin D2
- upm_yg1006.YG1006 flame = new upm_yg1006.YG1006(2);
-
- while (true) {
- boolean val = flame.flameDetected();
- if (val) {
- System.out.println("Flame detected");
- } else {
- System.out.println("No flame detected");
- }
-
- Thread.sleep(1000);
- }
- // ! [Interesting]
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/ZFM20Sample.java b/peripheral/libupm/examples/java/ZFM20Sample.java
deleted file mode 100644
index 3a36b84..0000000
--- a/peripheral/libupm/examples/java/ZFM20Sample.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@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.
- */
-
-//NOT TESTED!!!
-public class ZFM20Sample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Instantiate a ZFM20 Fingerprint reader on UART 0
- upm_zfm20.ZFM20 fp = new upm_zfm20.ZFM20(0);
-
- // make sure port is initialized properly. 57600 baud is the default
- if (!fp.setupTty()) {
- System.err.println("Failed to setup tty port parameters");
- System.exit(-1);
- }
-
- // first, set the default password and address
- fp.setPassword(upm_zfm20.javaupm_zfm20.ZFM20_DEFAULT_PASSWORD);
- fp.setAddress(upm_zfm20.javaupm_zfm20.ZFM20_DEFAULT_ADDRESS);
-
- // now verify the password. If this fails, any other commands
- // will be ignored, so we just bail.
- if (fp.verifyPassword()) {
- System.out.println("Password verified.");
- } else {
- System.err.println("Password verification failed.");
- System.exit(-1);
- }
-
- // how many valid stored templates (fingerprints) do we have?
- System.out.println("Total stored templates: " + fp.getNumTemplates());
-
- // now spin waiting for a fingerprint to successfully image
- System.out.println("Waiting for finger print...");
- while (fp.generateImage() == upm_zfm20.ZFM20.ZFM20_ERRORS_T.ERR_NO_FINGER.swigValue());
-
- // in theory, we have an image
- System.out.println("Image captured, converting...");
- short rv = fp.image2Tz(1);
- if (rv != upm_zfm20.ZFM20.ZFM20_ERRORS_T.ERR_OK.swigValue()) {
- System.err.println("Image conversion failed with error code " + rv);
- System.exit(-1);
- }
- System.out.println("Image conversion succeeded");
-
- // we search for a print matching slot 1, where we shored our last
- // converted fingerprint
- int[] id = new int[1];
- int[] score = new int[1];
- rv = fp.search(1, id, score);
- if (rv != upm_zfm20.ZFM20.ZFM20_ERRORS_T.ERR_OK.swigValue()) {
- if (rv == upm_zfm20.ZFM20.ZFM20_ERRORS_T.ERR_FP_NOTFOUND.swigValue()) {
- System.out.println("Fingerprint not found");
- System.exit(0);
- } else {
- System.err.println("Search failed with error code " + rv);
- System.exit(-1);
- }
- }
-
- System.out.println("Fingerprint found!");
- System.out.println("ID: " + id[0] + ", Score: " + score[0]);
-
- // ! [Interesting]
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/javascript/a110x.js b/peripheral/libupm/examples/javascript/a110x.js
deleted file mode 100644
index df26d37..0000000
--- a/peripheral/libupm/examples/javascript/a110x.js
+++ /dev/null
@@ -1,47 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*global */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2014 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var hallEffectSensor = require('jsupm_a110x');
-
-// Instantiate a Hall Effect magnet sensor on digital pin D2
-var myHallEffectSensor = new hallEffectSensor.A110X(2);
-
-// Check every second for the presence of a magnetic field (south polarity)
-setInterval(function()
-{
- if (myHallEffectSensor.magnetDetected())
- console.log("Magnet (south polarity) detected.");
- else
- console.log("No magnet detected.");
-}, 1000);
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/ad8232.js b/peripheral/libupm/examples/javascript/ad8232.js
deleted file mode 100644
index 56913fa..0000000
--- a/peripheral/libupm/examples/javascript/ad8232.js
+++ /dev/null
@@ -1,51 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Jon Trulson <jtrulson@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-var ad8232Sensor_lib = require('jsupm_ad8232');
-
-// Instantiate a AD8232 sensor on digital pins 10 (LO+), 11 (LO-)
-// and an analog pin, 0 (OUTPUT)
-var myAd8232Sensor_obj = new ad8232Sensor_lib.AD8232(10, 11, 0);
-
-// Output the raw numbers from the ADC, for plotting elsewhere.
-// A return of 0 indicates a Lead Off (LO) condition.
-// In theory, this data could be fed to software like Processing
-// (https://www.processing.org/) to plot the data just like an
-// EKG you would see in a hospital.
-var myInterval = setInterval(function()
-{
- console.log(myAd8232Sensor_obj.value());
-}, 1);
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- clearInterval(myInterval);
- myAd8232Sensor_obj = null;
- ad8232Sensor_lib.cleanUp();
- ad8232Sensor_lib = null;
- console.log("Exiting");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/adafruitms1438-stepper.js b/peripheral/libupm/examples/javascript/adafruitms1438-stepper.js
deleted file mode 100644
index d06edce..0000000
--- a/peripheral/libupm/examples/javascript/adafruitms1438-stepper.js
+++ /dev/null
@@ -1,92 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-function exit()
-{
- console.log("Exiting");
-
- myMotorShield_obj = null;
- if (MotorShield_lib)
- {
- MotorShield_lib.cleanUp();
- MotorShield_lib = null;
- }
- process.exit(0);
-}
-
-var MotorShield_lib = require('jsupm_adafruitms1438');
-
-/* Import header values */
-var I2CBus = MotorShield_lib.ADAFRUITMS1438_I2C_BUS;
-var I2CAddr = MotorShield_lib.ADAFRUITMS1438_DEFAULT_I2C_ADDR;
-
-var M12motor = MotorShield_lib.AdafruitMS1438.STEPMOTOR_M12;
-var MotorDirCW = MotorShield_lib.AdafruitMS1438.DIR_CW;
-var MotorDirCCW = MotorShield_lib.AdafruitMS1438.DIR_CCW;
-
-
-// Instantiate an Adafruit MS 1438 on I2C bus 0
-var myMotorShield_obj = new MotorShield_lib.AdafruitMS1438(I2CBus, I2CAddr);
-
-
-// Setup for use with a stepper motor connected to the M1 & M2 ports
-
-// disable first, to be safe
-myMotorShield_obj.disableStepper(M12motor);
-
-// configure for a NEMA-17, 200 steps per revolution
-myMotorShield_obj.stepConfig(M12motor, 200);
-
-// set speed at 10 RPM's
-myMotorShield_obj.setStepperSpeed(M12motor, 10);
-myMotorShield_obj.setStepperDirection(M12motor, MotorDirCW);
-
-console.log("Enabling...");
-myMotorShield_obj.enableStepper(M12motor);
-
-console.log("Rotating 1 full revolution at 10 RPM speed.");
-myMotorShield_obj.stepperSteps(M12motor, 200);
-
-console.log("Sleeping for 2 seconds...");
-
-
-setTimeout(function()
-{
- console.log("Rotating 1/2 revolution in opposite direction at 10 RPM speed.");
-
- myMotorShield_obj.setStepperDirection(M12motor, MotorDirCCW);
- myMotorShield_obj.stepperSteps(M12motor, 100);
-
- console.log("Disabling...");
- myMotorShield_obj.disableStepper(M12motor);
- exit();
-}, 2000);
-
-
-process.on('SIGINT', function()
-{
- exit();
-});
diff --git a/peripheral/libupm/examples/javascript/adafruitms1438.js b/peripheral/libupm/examples/javascript/adafruitms1438.js
deleted file mode 100644
index 7c34d1a..0000000
--- a/peripheral/libupm/examples/javascript/adafruitms1438.js
+++ /dev/null
@@ -1,89 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-function exit()
-{
- console.log("Exiting");
-
- myMotorShield_obj = null;
- if (MotorShield_lib)
- {
- MotorShield_lib.cleanUp();
- MotorShield_lib = null;
- }
- process.exit(0);
-}
-
-var MotorShield_lib = require('jsupm_adafruitms1438');
-
-
-/* Import header values */
-var I2CBus = MotorShield_lib.ADAFRUITMS1438_I2C_BUS;
-var I2CAddr = MotorShield_lib.ADAFRUITMS1438_DEFAULT_I2C_ADDR;
-
-var M3motor = MotorShield_lib.AdafruitMS1438.MOTOR_M3;
-var MotorDirCW = MotorShield_lib.AdafruitMS1438.DIR_CW;
-var MotorDirCCW = MotorShield_lib.AdafruitMS1438.DIR_CCW;
-
-
-// Instantiate an Adafruit MS 1438 on I2C bus 0
-var myMotorShield_obj = new MotorShield_lib.AdafruitMS1438(I2CBus, I2CAddr);
-
-
-// Setup for use with a DC motor connected to the M3 port
-
-// set a PWM period of 50Hz
-myMotorShield_obj.setPWMPeriod(50);
-
-// disable first, to be safe
-myMotorShield_obj.disableMotor(M3motor);
-
-// set speed at 50%
-myMotorShield_obj.setMotorSpeed(M3motor, 50);
-myMotorShield_obj.setMotorDirection(M3motor, MotorDirCW);
-
-process.stdout.write("Spin M3 at half speed for 3 seconds, ");
-console.log("then reverse for 3 seconds.");
-myMotorShield_obj.enableMotor(M3motor);
-
-setTimeout(function()
-{
- console.log("Reversing M3");
- myMotorShield_obj.setMotorDirection(M3motor, MotorDirCCW);
-}, 3000);
-
-
-setTimeout(function()
-{
- console.log("Stopping M3");
- myMotorShield_obj.disableMotor(M3motor);
- exit();
-}, 6000);
-
-process.on('SIGINT', function()
-{
- exit();
-});
diff --git a/peripheral/libupm/examples/javascript/adc121c021.js b/peripheral/libupm/examples/javascript/adc121c021.js
deleted file mode 100644
index b02de34..0000000
--- a/peripheral/libupm/examples/javascript/adc121c021.js
+++ /dev/null
@@ -1,53 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*global */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-// Load ADC121C021 module
-var I2C_ADC = require('jsupm_adc121c021');
-// Instantiate an ADC121C021 on I2C bus 0
-var busID = I2C_ADC.ADC121C021_I2C_BUS;
-var I2CAddr = I2C_ADC.ADC121C021_DEFAULT_I2C_ADDR;
-var myI2C_ADC = new I2C_ADC.ADC121C021(busID, I2CAddr);
-
-// get the data every 50 milliseconds
-var myInterval = setInterval(function()
-{
- var val = myI2C_ADC.value();
- var voltsVal = myI2C_ADC.valueToVolts(val);
- console.log("ADC value: " + val + " Volts = " + voltsVal);
-}, 50);
-
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- clearInterval(myInterval);
- myI2C_ADC = null;
- I2C_ADC.cleanUp();
- I2C_ADC = null;
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/adis16448.js b/peripheral/libupm/examples/javascript/adis16448.js
deleted file mode 100644
index 1e83f82..0000000
--- a/peripheral/libupm/examples/javascript/adis16448.js
+++ /dev/null
@@ -1,67 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////////////
-// The MIT License (MIT)
-//
-// Submit Date: 03/09/2015
-// Author: Juan Jose Chong <juanjchong@gmail.com>
-// Copyright (c) 2015 Juan Jose Chong
-//
-//////////////////////////////////////////////////////////////////////////////////////
-// adis16448.js
-//////////////////////////////////////////////////////////////////////////////////////
-//
-// This example code runs on an Intel Edison and uses mraa to acquire data
-// from an ADIS16448. This data is then scaled and printed onto the terminal.
-//
-// This software has been tested to connect to an ADIS16448 through a level shifter
-// such as the TI TXB0104. The SPI lines (DIN, DOUT, SCLK, /CS) are all wired through
-// the level shifter and the ADIS16448 is also being powered by the Intel Edison.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-//////////////////////////////////////////////////////////////////////////////////////
-
-//Call the ADIS16448 library
-var adis16448 = require('jsupm_adis16448');
-
-//Instantiate SPI and Reset
-var imu = new adis16448.ADIS16448(0,3);
-
-periodicActivity(); //Call the periodicActivity function
-
-function periodicActivity()
-{
- //Read & Scale Gyro/Accel Data
- var xgyro = imu.gyroScale(imu.regRead(0x04));
- var ygyro = imu.gyroScale(imu.regRead(0x06));
- var zgyro = imu.gyroScale(imu.regRead(0x08));
- var xaccl = imu.accelScale(imu.regRead(0x0A));
- var yaccl = imu.accelScale(imu.regRead(0x0C));
- var zaccl = imu.accelScale(imu.regRead(0x0E));
-
- //Display Scaled Data on the Console Log
- console.log('XGYRO: ' + xgyro);
- console.log('YGYRO: ' + ygyro);
- console.log('ZGYRO: ' + zgyro);
- console.log('XACCL: ' + xaccl);
- console.log('YACCL: ' + yaccl);
- console.log('ZACCL: ' + zaccl);
- console.log(' ');
- setTimeout(periodicActivity,200); //call the indicated function after 0.2 seconds (200 milliseconds)
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/javascript/ads1x15.js b/peripheral/libupm/examples/javascript/ads1x15.js
deleted file mode 100644
index 3556253..0000000
--- a/peripheral/libupm/examples/javascript/ads1x15.js
+++ /dev/null
@@ -1,46 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
- * Author: Marc Graham <marc@m2ag.net>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-var mraa = require('mraa');
-var version = mraa.getVersion();
-
-if (version >= 'v0.6.1') {
- console.log('mraa version (' + version + ') ok');
-}
-else {
- console.log('mraa version(' + version + ') is old - this code may not work');
-}
-
-var ADS1X15 = require('jsupm_ads1x15');
-var ads1115 = new ADS1X15.ADS1115(1, 0x49);
-var ads1015 = new ADS1X15.ADS1015(1, 0x48);
-
-setInterval(function(){
- console.log(ads1115.getSample());
- console.log(ads1015.getSample());
- console.log("*********************");
-}, 1000);
-
-
diff --git a/peripheral/libupm/examples/javascript/adxl335.js b/peripheral/libupm/examples/javascript/adxl335.js
deleted file mode 100644
index 9ecf4fd..0000000
--- a/peripheral/libupm/examples/javascript/adxl335.js
+++ /dev/null
@@ -1,89 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var analogGyro3Axis = require("jsupm_adxl335");
-
-var g_addnumBool = true;
-var g_cycleNum = 0.0;
-var g_cycleCount = 0;
-
-// Instantiate an ADXL335 accelerometer on analog pins A0, A1, and A2
-var myAnalogGyro3Axis = new analogGyro3Axis.ADXL335(0, 1, 2);
-
-console.log("Please make sure the sensor is completely still.");
-console.log("Sleeping for 2 seconds");
-
-var g_myInterval;
-
-setTimeout(function()
-{
- console.log("Calibrating...");
- myAnalogGyro3Axis.calibrate();
- // Get values from accelerometer every 0.2 seconds
- g_myInterval = setInterval(runAccelerometer, 200);
-}, 2000);
-
-
-var x = new analogGyro3Axis.new_intPointer();
-var y = new analogGyro3Axis.new_intPointer();
-var z = new analogGyro3Axis.new_intPointer();
-
-var aX = new analogGyro3Axis.new_floatPointer();
-var aY = new analogGyro3Axis.new_floatPointer();
-var aZ = new analogGyro3Axis.new_floatPointer();
-
-var outputStr;
-
-function runAccelerometer()
-{
- myAnalogGyro3Axis.values(x, y, z);
- outputStr = "Raw Values: X: " +
- analogGyro3Axis.intPointer_value(x) +
- " Y: " + analogGyro3Axis.intPointer_value(y) +
- " Z: " + analogGyro3Axis.intPointer_value(z);
- console.log(outputStr);
-
- myAnalogGyro3Axis.acceleration(aX, aY, aZ);
- outputStr = "Acceleration: X: " +
- analogGyro3Axis.floatPointer_value(aX) + "g\n" +
- "Acceleration: Y: " +
- analogGyro3Axis.floatPointer_value(aY) + "g\n" +
- "Acceleration: Z: " +
- analogGyro3Axis.floatPointer_value(aZ) + "g";
- console.log(outputStr);
-
- console.log(" ");
-}
-
-
-// When exiting: clear interval and print exit message
-process.on('SIGINT', function()
-{
- clearInterval(g_myInterval);
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/adxl345.js b/peripheral/libupm/examples/javascript/adxl345.js
deleted file mode 100644
index d03d1f4..0000000
--- a/peripheral/libupm/examples/javascript/adxl345.js
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
-* Author: Mihai Tudor Panu <mihai.tudor.panu@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.
-*/
-
-// Load accelerometer
-var adxl345 = require('jsupm_adxl345');
-
-// Instantiate on I2C bus
-var adxl = new adxl345.Adxl345(0);
-
-setInterval(function()
-{
- adxl.update(); // Update the data
- var raw = adxl.getRawValues(); // Read raw sensor data
- var force = adxl.getAcceleration(); // Read acceleration force (g)
- var rawvalues = raw.getitem(0) + " " + raw.getitem(1) + " " + raw.getitem(2);
- console.log("Raw Values: " + rawvalues);
- console.log("ForceX: " + force.getitem(0).toFixed(2) + " g");
- console.log("ForceY: " + force.getitem(1).toFixed(2) + " g");
- console.log("ForceZ: " + force.getitem(2).toFixed(2) + " g");
-}, 1000);
diff --git a/peripheral/libupm/examples/javascript/adxrs610.js b/peripheral/libupm/examples/javascript/adxrs610.js
deleted file mode 100644
index 16c105c..0000000
--- a/peripheral/libupm/examples/javascript/adxrs610.js
+++ /dev/null
@@ -1,57 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-var sensorObj = require('jsupm_adxrs610');
-
-// Instantiate a ADXRS610 sensor on analog pin A0 (dataout), and
-// analog A1 (temp out) with an analog reference voltage of
-// 5.0
-var sensor = new sensorObj.ADXRS610(0, 1, 5.0);
-
-// set a deadband region around the zero point to report 0.0 (optional)
-sensor.setDeadband(0.015);
-
-// Every tenth of a second, sample the ADXRS610 and output it's
-// corresponding temperature and angular velocity
-
-setInterval(function()
-{
- console.log("Vel (deg/s): " + sensor.getAngularVelocity());
- console.log("Temp (C): " + sensor.getTemperature());
-}, 100);
-
-// exit on ^C
-process.on('SIGINT', function()
-{
- sensor = null;
- sensorObj.cleanUp();
- sensorObj = null;
- console.log("Exiting.");
- process.exit(0);
-});
-
diff --git a/peripheral/libupm/examples/javascript/ak8975.js b/peripheral/libupm/examples/javascript/ak8975.js
deleted file mode 100644
index 6081719..0000000
--- a/peripheral/libupm/examples/javascript/ak8975.js
+++ /dev/null
@@ -1,64 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-var sensorObj = require('jsupm_mpu9150');
-
-// Instantiate an AK8975 on default I2C bus and address
-var sensor = new sensorObj.AK8975();
-
-// Initialize the device with default values
-sensor.init();
-
-var x = new sensorObj.new_floatp();
-var y = new sensorObj.new_floatp();
-var z = new sensorObj.new_floatp();
-
-// Output data every half second until interrupted
-setInterval(function()
-{
- sensor.update();
-
- sensor.getMagnetometer(x, y, z);
- console.log("Magnetometer: MX: " + sensorObj.floatp_value(x) +
- " MY: " + sensorObj.floatp_value(y) +
- " MZ: " + sensorObj.floatp_value(z));
-
- console.log();
-
-}, 500);
-
-// exit on ^C
-process.on('SIGINT', function()
-{
- sensor = null;
- sensorObj.cleanUp();
- sensorObj = null;
- console.log("Exiting.");
- process.exit(0);
-});
-
diff --git a/peripheral/libupm/examples/javascript/apds9002.js b/peripheral/libupm/examples/javascript/apds9002.js
deleted file mode 100644
index 829584f..0000000
--- a/peripheral/libupm/examples/javascript/apds9002.js
+++ /dev/null
@@ -1,47 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-// Load Grove Luminance sensor module
-var luminanceSensor_lib = require('jsupm_apds9002');
-
-// Instantiate a Grove Luminance sensor on analog pin A0
-var myLuminanceSensor_obj = new luminanceSensor_lib.APDS9002(0);
-
-var myInterval = setInterval(function()
-{
- console.log("Luminance value is " + myLuminanceSensor_obj.value());
-}, 1000);
-
-// On exit: clear interval and memory, print message
-process.on('SIGINT', function()
-{
- clearInterval(myInterval);
- myLuminanceSensor_obj = null;
- luminanceSensor_lib.cleanUp();
- luminanceSensor_lib = null;
- console.log("Exiting");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/at42qt1070.js b/peripheral/libupm/examples/javascript/at42qt1070.js
deleted file mode 100644
index c061f13..0000000
--- a/peripheral/libupm/examples/javascript/at42qt1070.js
+++ /dev/null
@@ -1,81 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-/* functions */
-function printButtons(touchObj)
-{
- var buttonPressed = false;
- var buttons = touchObj.getButtons();
-
- process.stdout.write("Buttons Pressed: ");
- for (var i=0; i<7; i++)
- {
- if (buttons & (1 << i))
- {
- process.stdout.write(i + " ");
- buttonPressed = true;
- }
- }
-
- if (!buttonPressed)
- process.stdout.write("None");
-
- console.log(" ");
-
- if (touchObj.isCalibrating())
- console.log("Calibration is occurring.");
-
- if (touchObj.isOverflowed())
- console.log("Overflow was detected.");
-}
-
-
-/* Global code that runs on startup */
-
-var touchSensor_lib = require('jsupm_at42qt1070');
-
-var I2C_BUS = touchSensor_lib.AT42QT1070_I2C_BUS;
-var DEFAULT_I2C_ADDR = touchSensor_lib.AT42QT1070_DEFAULT_I2C_ADDR;
-// Instantiate an AT42QT1070 on I2C bus 0
-var mytouchSensor_obj = new touchSensor_lib.AT42QT1070(I2C_BUS,
- DEFAULT_I2C_ADDR);
-
-var myInterval = setInterval(function()
-{
- mytouchSensor_obj.updateState();
- printButtons(mytouchSensor_obj);
-}, 100);
-
-// Print message when exiting and clear interval/memory
-process.on('SIGINT', function()
-{
- clearInterval(myInterval);
- mytouchSensor_obj = null;
- touchSensor_lib.cleanUp();
- touchSensor_lib = null;
- console.log("Exiting");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/biss0001.js b/peripheral/libupm/examples/javascript/biss0001.js
deleted file mode 100644
index 830a88d..0000000
--- a/peripheral/libupm/examples/javascript/biss0001.js
+++ /dev/null
@@ -1,45 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*global */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2014 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-//Load Grove Motion module
-var grove_motion = require('jsupm_biss0001');
-// Instantiate a Grove Motion sensor on GPIO pin D2
-var myMotionObj = new grove_motion.BISS0001(2);
-setInterval(function()
-{
- if (myMotionObj.value())
- console.log("Detecting moving object");
- else
- console.log("No moving objects detected");
-}, 1000);
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/bma220.js b/peripheral/libupm/examples/javascript/bma220.js
deleted file mode 100644
index bc267de..0000000
--- a/peripheral/libupm/examples/javascript/bma220.js
+++ /dev/null
@@ -1,59 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-var sensorObj = require('jsupm_bma220');
-
-// Instantiate an BMA220 using default parameters (bus 0, addr 0x0a)
-var sensor = new sensorObj.BMA220();
-
-var x = new sensorObj.new_floatp();
-var y = new sensorObj.new_floatp();
-var z = new sensorObj.new_floatp();
-
-// Output data every half second until interrupted
-setInterval(function()
-{
- sensor.update();
-
- sensor.getAccelerometer(x, y, z);
- console.log("Accelerometer: AX: " + sensorObj.floatp_value(x) +
- " AY: " + sensorObj.floatp_value(y) +
- " AZ: " + sensorObj.floatp_value(z));
-
-}, 500);
-
-// exit on ^C
-process.on('SIGINT', function()
-{
- sensor = null;
- sensorObj.cleanUp();
- sensorObj = null;
- console.log("Exiting.");
- process.exit(0);
-});
-
diff --git a/peripheral/libupm/examples/javascript/bmpx8x.js b/peripheral/libupm/examples/javascript/bmpx8x.js
deleted file mode 100644
index 3da0514..0000000
--- a/peripheral/libupm/examples/javascript/bmpx8x.js
+++ /dev/null
@@ -1,55 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*global */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2014 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-//Load Barometer module
-var bmpx8x = require('jsupm_bmpx8x');
-// load this on i2c
-var myBarometerObj = new bmpx8x.BMPX8X(0, bmpx8x.ADDR);
-var pressure, temperature, altitude, sealevel;
-
-// Print the pressure, altitude, sea level, and
-// temperature values every 0.1 seconds
-setInterval(function()
-{
- var pressure = myBarometerObj.getPressure();
- var temperature = myBarometerObj.getTemperature();
- var altitude = myBarometerObj.getAltitude();
- var sealevel = myBarometerObj.getSealevelPressure();
-
- var BMPX8Xresults = "pressure value = " + pressure;
- BMPX8Xresults += ", altitude value = " + altitude;
- BMPX8Xresults += ", sealevel value = " + sealevel;
- BMPX8Xresults += ", temperature = " + temperature;
- console.log(BMPX8Xresults);
-}, 100);
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/buzzer.js b/peripheral/libupm/examples/javascript/buzzer.js
deleted file mode 100644
index 4fcc7dc..0000000
--- a/peripheral/libupm/examples/javascript/buzzer.js
+++ /dev/null
@@ -1,65 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*global */
-/*
- * Author: Zion Orent <zorent@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-var upmBuzzer = require("jsupm_buzzer");
-// Initialize on GPIO 5
-var myBuzzer = new upmBuzzer.Buzzer(5);
-var chords = [];
-chords.push(upmBuzzer.DO);
-chords.push(upmBuzzer.RE);
-chords.push(upmBuzzer.MI);
-chords.push(upmBuzzer.FA);
-chords.push(upmBuzzer.SOL);
-chords.push(upmBuzzer.LA);
-chords.push(upmBuzzer.SI);
-chords.push(upmBuzzer.DO);
-chords.push(upmBuzzer.SI);
-var chordIndex = 0;
-
-// Print sensor name
-console.log(myBuzzer.name());
-
-function melody()
-{
- if (chords.length != 0)
- {
- //Play sound for one second
- console.log( myBuzzer.playSound(chords[chordIndex], 1000000) );
- chordIndex++;
- //Reset the sound to start from the beginning.
- if (chordIndex > chords.length - 1)
- chordIndex = 0;
- }
-}
-setInterval(melody, 100);
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/cjq4435.js b/peripheral/libupm/examples/javascript/cjq4435.js
deleted file mode 100644
index dac41b8..0000000
--- a/peripheral/libupm/examples/javascript/cjq4435.js
+++ /dev/null
@@ -1,87 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var MOSFETsensor = require("jsupm_cjq4435");
-
-var g_addnumBool = true;
-var g_cycleNum = 0.0;
-var g_cycleCount = 0;
-
-// Instantiate a CJQ4435 MOSFET on a PWM capable digital pin D3
-var myMOSFETsensor = new MOSFETsensor.CJQ4435(3);
-
-myMOSFETsensor.setPeriodMS(10);
-myMOSFETsensor.enable(true);
-
-// A note on timing:
-// In the C++ example, the system sleeps 11 times for 100 milliseconds
-// between each duty cycle. After reaching the last point of the cycle,
-// the system sleeps again for 1 second.
-// The sleeps are cumulative, so the system has slept for 2.1 seconds
-// sum total for each cycle.
-// setInterval and setTimeout make asynchronous function calls;
-// they aren't cumulative.
-// In order to approximate the behavior of the C++ example, we need
-// to call each iteration 2.1 seconds apart instead of 1 second apart.
-
-var myInterval = setInterval(function()
-{
- setDutyCycle();
-}, (1000 + (11*100)) );
-
-
-// We start with a duty cycle of 0.0 (off) and increment to 1.0 (on)
-// Then we take it back down,
-// starting with a duty cycle of 1.0 (on) and decrement to 0.0 (off)
-function setDutyCycle()
-{
- myMOSFETsensor.setDutyCycle(g_cycleNum);
- if (g_addnumBool)
- g_cycleNum += 0.1;
- else
- g_cycleNum -= 0.1;
- g_cycleCount++;
- if (g_cycleCount > 10)
- {
- g_addnumBool = !g_addnumBool;
- g_cycleCount = 0;
- }
- else
- setTimeout(setDutyCycle, 100);
-}
-
-
-// When exiting: clear interval and print exit message
-process.on('SIGINT', function()
-{
- clearInterval(myInterval);
- myMOSFETsensor = null;
- MOSFETsensor.cleanUp();
- MOSFETsensor = null;
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/dfrph.js b/peripheral/libupm/examples/javascript/dfrph.js
deleted file mode 100644
index f9f7f55..0000000
--- a/peripheral/libupm/examples/javascript/dfrph.js
+++ /dev/null
@@ -1,59 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-var sensorObj = require('jsupm_dfrph');
-
-// Instantiate a DFRPH sensor on analog pin A0, with an analog
-// reference voltage of 5.0
-var sensor = new sensorObj.DFRPH(0, 5.0);
-
-
-// After calibration, set the offset (based on calibration with a pH
-// 7.0 buffer solution). See the UPM sensor documentation for
-// calibrations instructions.
-sensor.setOffset(0.065);
-
-// Every second, sample the pH and output it's corresponding
-// analog voltage.
-
-setInterval(function()
-{
- console.log("Detected volts: " + sensor.volts());
- console.log("pH value: " + sensor.pH());
-}, 1000);
-
-// exit on ^C
-process.on('SIGINT', function()
-{
- sensor = null;
- sensorObj.cleanUp();
- sensorObj = null;
- console.log("Exiting.");
- process.exit(0);
-});
-
diff --git a/peripheral/libupm/examples/javascript/ds1307.js b/peripheral/libupm/examples/javascript/ds1307.js
deleted file mode 100644
index 9d11319..0000000
--- a/peripheral/libupm/examples/javascript/ds1307.js
+++ /dev/null
@@ -1,68 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*global */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2014 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-// Load RTC Clock module for Grove - RTC clock
-var ds1307 = require('jsupm_ds1307');
-// load this on i2c bus 0
-var myRTCClockObj = new ds1307.DS1307(0);
-
-// always do this first
-console.log("Loading the current time... ");
-
-var result = myRTCClockObj.loadTime();
-if (!result)
-{
- console.log("myRTCClockObj.loadTime() failed.");
- process.exit(1);
-}
-
-printTime(myRTCClockObj);
-
-// set the year as an example
-console.log("setting the year to 50");
-myRTCClockObj.year = 50;
-myRTCClockObj.setTime();
-
-// reload the time and print it
-myRTCClockObj.loadTime();
-printTime(myRTCClockObj);
-
-function printTime(RTCObj)
-{
- var timeStr = "The time is: " +
- RTCObj.month + "/" + RTCObj.dayOfMonth + "/" + RTCObj.year + " " +
- RTCObj.hours + ":" + RTCObj.minutes + ":" + RTCObj.seconds;
-
- if (RTCObj.amPmMode)
- timeStr += (RTCObj.pm ? " PM " : " AM ");
-
- console.log(timeStr);
-
- console.log("Clock is in " +
- (RTCObj.amPmMode ? "AM/PM mode" : "24hr mode"));
-}
-
diff --git a/peripheral/libupm/examples/javascript/eboled.js b/peripheral/libupm/examples/javascript/eboled.js
deleted file mode 100644
index bf999de..0000000
--- a/peripheral/libupm/examples/javascript/eboled.js
+++ /dev/null
@@ -1,150 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Author: Tyler Gibson <tgibson@microsoft.com>
- * Copyright (c) 2015 Microsoft 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 lcdObj = require('jsupm_i2clcd');
-var oled = new lcdObj.EBOLED();
-
-var sample = 0;
-var samples = 13;
-
-function exit()
-{
- oled = null;
- lcdObj.cleanUp();
- lcdObj = null;
- process.exit(0);
-}
-
-setInterval( function()
-{
- if(sample>samples)
- {
- exit();
- }
- oled.clearScreenBuffer();
- runSample(sample++);
- oled.refresh();
-}, 1500);
-
-function runSample(sample)
-{
- switch(sample) {
- case 0:
- // x/y coords are 0 based, using 1 here for padding.
- oled.setCursor(1,1);
- // nowrap = 0, wrapping = 1
- oled.setTextWrap(1);
- oled.write("HELLO WORLD! Mixed with #123 and y's, g's and q's.");
- break;
- case 1:
- oled.setCursor(12, 1);
- //multiply text size, only integers
- oled.setTextSize(3);
- oled.write("BOO!");
- oled.setTextSize(1);
- break;
- case 2:
- oled.drawRectangleFilled(0,0,48,9);
- oled.setCursor(1,1);
- // 0=Black, 1=White, 2=Xor (Toggle)
- oled.setTextColor(2);
- oled.write("Cutout");
- break;
- case 3:
- var total = Math.random()*100;
- for(var stars=0; stars<total; stars++ )
- oled.drawPixel(Math.floor(Math.random()*63), Math.floor(Math.random()*47), 1);
- break;
- case 4:
- for(var burst=0; burst<12; burst++)
- oled.drawLine(31, 24, Math.floor(Math.random()*63), Math.floor(Math.random()*47), 1);
- break;
- case 5:
- var lastPeak = 24;
- for(var peak=0; peak < 64; peak++)
- {
- var thisPeak = Math.abs(lastPeak + Math.floor(Math.random()*(-6) + Math.random()*6));
- oled.drawLine(peak, thisPeak, peak, 47, 1);
- lastPeak = thisPeak;
- }
- break;
- case 6:
- for(var y=0; y<47; y++)
- {
- oled.drawLineHorizontal(0,y+1,63,2);
- oled.refresh();
- oled.drawLineHorizontal(0,y,63,2);
- }
- break;
- case 7:
- var eqbarHeights = [ Math.floor(Math.random()*32),
- Math.floor(Math.random()*32),
- Math.floor(Math.random()*32),
- Math.floor(Math.random()*32),
- Math.floor(Math.random()*32),
- Math.floor(Math.random()*32),
- Math.floor(Math.random()*32) ];
- var begin = Date.now();
- while(Date.now()-begin < 2000)
- {
- oled.clearScreenBuffer();
- for(var eqbar=0; eqbar<7; eqbar++)
- {
- oled.drawRectangleFilled(eqbar*9, 49 - eqbarHeights[eqbar], 8, eqbarHeights[eqbar], 1);
- eqbarHeights[eqbar] = eqbarHeights[eqbar] + Math.random()*(-2) + Math.random()*2;
- if(eqbarHeights[eqbar]<0)
- eqbarHeights[eqbar] = 1;
- }
- oled.refresh();
- }
- oled.clear();
- break;
- case 8:
- oled.drawRoundedRectangle(8, 8, 48, 16, 4, 1);
- oled.setCursor(12, 16);
- oled.write("Cancel");
- break;
- case 9:
- oled.drawTriangle(2, 2, 52, 7, 17, 37, 1);
- break;
- case 10:
- oled.drawTriangleFilled(2, 2, 52, 7, 17, 37, 1);
- break;
- case 11:
- oled.drawCircle(32, 24, 14, 1);
- break;
- case 12:
- oled.drawCircleFilled(32, 24, 14, 1);
- break;
- case 13:
- oled.fillScreen(1);
- break;
- }
-}
diff --git a/peripheral/libupm/examples/javascript/enc03r.js b/peripheral/libupm/examples/javascript/enc03r.js
deleted file mode 100644
index 15b6d80..0000000
--- a/peripheral/libupm/examples/javascript/enc03r.js
+++ /dev/null
@@ -1,66 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*global */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2014 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-// Load analog gyro module
-var analogGyro = require('jsupm_enc03r');
-// Instantiate a ENC03R on analog pin A0
-var myGyro = new analogGyro.ENC03R(0);
-
-var CALIBRATION_SAMPLES = 1000;
-
-console.log("Please place the sensor in a stable location,\n" +
- "and do not move it while calibration takes place.\n" +
- "This may take a couple of minutes.");
-
-myGyro.calibrate(CALIBRATION_SAMPLES);
-console.log("Calibration complete. Reference value: " +
- myGyro.calibrationValue());
-
-// Read the input and print both the raw value and the angular velocity,
-// waiting 0.1 seconds between readings
-setInterval(function()
-{
- var gyroVal = myGyro.value();
- var outputStr = "Raw value: " + gyroVal + ", " +
- "angular velocity: " +
- roundNum(myGyro.angularVelocity(gyroVal), 5) + " deg/s";
- console.log(outputStr);
-}, 100);
-
-function roundNum(num, decimalPlaces)
-{
- var extraNum = (1 / (Math.pow(10, decimalPlaces) * 1000));
- return (Math.round((num + extraNum) * (Math.pow(10, decimalPlaces))) /
- Math.pow(10, decimalPlaces));
-}
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/es08a.js b/peripheral/libupm/examples/javascript/es08a.js
deleted file mode 100644
index 36db8d2..0000000
--- a/peripheral/libupm/examples/javascript/es08a.js
+++ /dev/null
@@ -1,69 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*global */
-/*
- * Author: Zion Orent <zorent@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-//Load servo module.
-var servoModule = require("jsupm_servo");
-
-//Instantiate ES08A Servo module on GPIO 5
-var servo = new servoModule.ES08A(5);
-
-// function to initialize servo
- // timeOffset: how long after hitting "run"
- // should we start this servo instance
- // timeInterval: how frequently should this instance run after timeOffset
- // angle: the angle for this instance
-function startServo(timeOffset, timeInterval, angle)
-{
- // Start running this instance after timeOffset milliseconds
- setTimeout(function()
- {
- // run this instance every timeInterval milliseconds
- setInterval(function()
- {
- servo.setAngle(angle);
- console.log("Set angle to " + angle);
- }, timeInterval);
- }, timeOffset);
- // timeOffset tells setTimeout when
- // to execute the function specified in the first param
- // angle is passed as a param to the specified function
-}
-// start immediately, run every 3 seconds, go 0 degrees
-startServo(0, 3000, 0);
-
-// start in 1 second, run every 3 seconds, go 90 degrees
-startServo(1000, 3000, 90);
-
-// start in 2 seconds, run every 3 seconds, go 180 degrees
-startServo(2000, 3000, 180);
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/flex.js b/peripheral/libupm/examples/javascript/flex.js
deleted file mode 100644
index 73c6ee0..0000000
--- a/peripheral/libupm/examples/javascript/flex.js
+++ /dev/null
@@ -1,53 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-var flexSensor_lib = require('jsupm_flex');
-
-// The was tested with a Spectra Symbol flex sensor.
-// We attached a 22K resistor to a breadboard,
-// with 1 end attached to GND and the other connected to
-// both the flex sensor and A0.
-// The flex sensor was connected on 1 pin to the 22K resistor and A0
-// and on the other pin to 5V.
-
-// Instantiate a UV sensor on analog pin A0
-var myFlexSensor_obj = new flexSensor_lib.Flex(0);
-
-var myInterval = setInterval(function()
-{
- var outputStr = "Flex value: " + myFlexSensor_obj.value();
- console.log(outputStr);
-}, 1000);
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- clearInterval(myInterval);
- myFlexSensor_obj = null;
- flexSensor_lib.cleanUp();
- flexSensor_lib = null;
- console.log("Exiting");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/gp2y0a.js b/peripheral/libupm/examples/javascript/gp2y0a.js
deleted file mode 100644
index 3c0bc7b..0000000
--- a/peripheral/libupm/examples/javascript/gp2y0a.js
+++ /dev/null
@@ -1,60 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2014 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-// JavaScript file for GP2Y0A family of IR Proximity Sensors
-
-// analog voltage, usually 3.3 or 5.0
-var GP2Y0A_AREF = 5.0;
-var SAMPLES_PER_QUERY = 20;
-
-var IRProximity = require('jsupm_gp2y0a');
-
-// Note, for the Grove 80cm version of this sensor, due to the way it is wired,
-// you need to plug this into the A0 port, where it will use the available
-// A1 pin for data.
-// Instantiate a GP2Y0A on analog pin A1
-var myVolts = new IRProximity.GP2Y0A(1);
-
-// The higher the voltage (closer to AREF) the closer the object is.
-// NOTE: The measured voltage will probably not exceed 3.3 volts.
-// Every second, print the averaged voltage value
-// (averaged over 20 samples).
-var myInterval = setInterval(function()
-{
- console.log("AREF: " + GP2Y0A_AREF +
- ", Voltage value (higher means closer): " +
- myVolts.value(GP2Y0A_AREF, SAMPLES_PER_QUERY));
-}, 1000);
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- clearInterval(myInterval);
- myVolts = null;
- IRProximity.cleanUp();
- IRProximity = null;
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/grove_mcfled.js b/peripheral/libupm/examples/javascript/grove_mcfled.js
deleted file mode 100644
index f539269..0000000
--- a/peripheral/libupm/examples/javascript/grove_mcfled.js
+++ /dev/null
@@ -1,46 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var upmled = require("jsupm_grove");
-// Initialize on GPIO 2
-var myled = new upmled.GroveLed(2);
-myled.on();
-
-// Dummy setInterval, just to keep program from quitting
-// This way, the LED turns off when you quit the program
-var myInterval = setInterval(function()
-{
- ;
-}, 1000);
-
-// When exiting: turn off LED, clear interval, and print message
-process.on('SIGINT', function()
-{
- clearInterval(myInterval);
- myled.off();
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/grovebutton.js b/peripheral/libupm/examples/javascript/grovebutton.js
deleted file mode 100644
index 428396a..0000000
--- a/peripheral/libupm/examples/javascript/grovebutton.js
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Author: Sarah Knepper <sarah.knepper@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-// Load Grove module
-var groveSensor = require('jsupm_grove');
-
-// Create the button object using GPIO pin 0
-var button = new groveSensor.GroveButton(0);
-
-// Read the input and print, waiting one second between readings
-function readButtonValue() {
- console.log(button.name() + " value is " + button.value());
-}
-setInterval(readButtonValue, 1000);
diff --git a/peripheral/libupm/examples/javascript/grovecircularled.js b/peripheral/libupm/examples/javascript/grovecircularled.js
deleted file mode 100644
index 3bc303c..0000000
--- a/peripheral/libupm/examples/javascript/grovecircularled.js
+++ /dev/null
@@ -1,49 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
- * Author: Jun Kato
- * Contributions: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-// Instantiate a Grove Circular LED on gpio pins 9 and 8
-var GCL = require("jsupm_my9221");
-var circle = new GCL.GroveCircularLED(9, 8);
-var level = 0;
-
-// Show a spinner.
-var myInterval = setInterval(function()
-{
- circle.setSpinner(level);
- level = (level + 1) % 24;
-}, 100);
-
-// When exiting, clear interval and print message.
-process.on('SIGINT', function()
-{
- clearInterval(myInterval);
- circle.setLevel(0);
- circle = null;
- GCL.cleanUp();
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/grovecollision.js b/peripheral/libupm/examples/javascript/grovecollision.js
deleted file mode 100644
index dc577a4..0000000
--- a/peripheral/libupm/examples/javascript/grovecollision.js
+++ /dev/null
@@ -1,62 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var collision_lib = require("jsupm_grovecollision");
-
-// The was tested with the Grove Collision Sensor
-// Instantiate a Grove Collision on digital pin D2
-var collision_obj = new collision_lib.GroveCollision(2);
-
-var collisionState = false;
-console.log("No collision");
-
-// Having an infinate loop prevents nodeJS from catching Cntl-C
-// We need to catch Cntl-C to clean up memory
-// Instead, we check the collision sensor every millisecond
-var myInterval = setInterval(function()
-{
- if (collision_obj.isColliding() && !collisionState)
- {
- console.log("Collision!");
- collisionState = true;
- }
- else if (!collision_obj.isColliding() && collisionState)
- {
- console.log("No collision");
- collisionState = false;
- }
-}, 1);
-
-// When exiting: clear interval, clean up memory, and print message
-process.on('SIGINT', function()
-{
- clearInterval(myInterval);
- collision_obj = null;
- collision_lib.cleanUp();
- collision_lib = null;
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/groveehr.js b/peripheral/libupm/examples/javascript/groveehr.js
deleted file mode 100644
index 7a9902b..0000000
--- a/peripheral/libupm/examples/javascript/groveehr.js
+++ /dev/null
@@ -1,64 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2014 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-// Load heart rate sensor module
-var heartRateSensor = require('jsupm_groveehr');
-// Instantiate a Grove Ear-clip Heart Rate sensor on digital pin D2
-var myHeartRateSensor = new heartRateSensor.GroveEHR(2);
-
-// set the beat counter to 0, init the clock and start counting beats
-myHeartRateSensor.clearBeatCounter();
-myHeartRateSensor.initClock();
-myHeartRateSensor.startBeatCounter();
-
-var millis, beats, hr;
-var myInterval = setInterval(function()
-{
- // we grab these just for display purposes in this example
- millis = myHeartRateSensor.getMillis();
- beats = myHeartRateSensor.beatCounter();
-
- // heartRate() requires that at least 5 seconds pass before
- // returning anything other than 0
- hr = myHeartRateSensor.heartRate();
-
- // output milliseconds passed, beat count, and computed heart rate
- console.log("Millis: " + millis + " Beats: " + beats +
- " Heart Rate: " + hr);
-}, 1000);
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- clearInterval(myInterval);
- myHeartRateSensor.stopBeatCounter();
- myHeartRateSensor = null
- heartRateSensor.cleanUp();
- heartRateSensor = null;
-
- console.log("Exiting");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/groveeldriver.js b/peripheral/libupm/examples/javascript/groveeldriver.js
deleted file mode 100644
index 362fb76..0000000
--- a/peripheral/libupm/examples/javascript/groveeldriver.js
+++ /dev/null
@@ -1,54 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var eldriver_lib = require("jsupm_groveeldriver");
-
-// The was tested with the Grove El Driver Module
-// Instantiate a Grove El Driver on digital pin D2
-var eldriver_obj = new eldriver_lib.GroveElDriver(2);
-
-var lightState = true;
-
-var myInterval = setInterval(function()
-{
- if (lightState)
- eldriver_obj.on();
- else
- eldriver_obj.off();
- lightState = !lightState;
-}, 1000);
-
-// When exiting: turn off EL wire, clear interval, and print message
-process.on('SIGINT', function()
-{
- clearInterval(myInterval);
- eldriver_obj.off();
- eldriver_obj = null;
- eldriver_lib.cleanUp();
- eldriver_lib = null;
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/groveelectromagnet.js b/peripheral/libupm/examples/javascript/groveelectromagnet.js
deleted file mode 100644
index 390fa85..0000000
--- a/peripheral/libupm/examples/javascript/groveelectromagnet.js
+++ /dev/null
@@ -1,57 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var electromagnet_lib = require("jsupm_groveelectromagnet");
-// The was tested with the Grove Electromagnetic Module
-// Instantiate a Grove Electromagnet on digital pin D2
-var electromagnet_obj = new electromagnet_lib.GroveElectromagnet(2);
-console.log("Starting up magnet....");
-electromagnet_obj.off();
-
-var magnetState = false;
-
-// Turn magnet on and off every 5 seconds
-var myInterval = setInterval(function()
-{
- magnetState = !magnetState;
- if (magnetState)
- electromagnet_obj.on();
- else
- electromagnet_obj.off();
- console.log("Turning magnet " + ((magnetState) ? "on" : "off"));
-}, 5000);
-
-// When exiting: clear interval, turn off magnet, run memory cleanup, and print message
-process.on('SIGINT', function()
-{
- clearInterval(myInterval);
- electromagnet_obj.off();
- electromagnet_obj = null;
- electromagnet_lib.cleanUp();
- electromagnet_lib = null;
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/groveemg.js b/peripheral/libupm/examples/javascript/groveemg.js
deleted file mode 100644
index 8eee4de..0000000
--- a/peripheral/libupm/examples/javascript/groveemg.js
+++ /dev/null
@@ -1,48 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-var groveemg_lib = require("jsupm_groveemg");
-
-// The was tested with the GroveEMG Muscle Signal Reader Sensor Module
-// Instantiate a GroveEMG on analog pin A0
-var groveemg_obj = new groveemg_lib.GroveEMG(0);
-console.log("Calibrating....");
-groveemg_obj.calibrate();
-
-var myInterval = setInterval(function()
-{
- console.log(groveemg_obj.value());
-}, 100);
-
-// When exiting: clear interval, and print message
-process.on('SIGINT', function()
-{
- clearInterval(myInterval);
- groveemg_obj = null;
- groveemg_lib.cleanUp();
- groveemg_lib = null;
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/grovegprs.js b/peripheral/libupm/examples/javascript/grovegprs.js
deleted file mode 100644
index d63f088..0000000
--- a/peripheral/libupm/examples/javascript/grovegprs.js
+++ /dev/null
@@ -1,114 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-var sensorObj = require('jsupm_grovegprs');
-
-
-/************** Functions **************/
-function printUsage(progname)
-{
- var outputStr = "Usage: " + progname + " [AT command]\n\n" +
- "If an argument is supplied on the command line, that argument is\n" +
- "sent to the module and the response is printed out.\n\n" +
- "If no argument is used, then the manufacturer and the current\n" +
- "saved profiles are queried and the results printed out.\n\n"
- console.log(outputStr);
-}
-
-// simple helper function to send a command and wait for a response
-function sendCommand(sensor, cmd, callback)
-{
- // commands need to be terminated with a carriage return
- cmd += "\r";
- sensor.writeDataStr(cmd);
-
- // wait up to 1 second
- if (sensor.dataAvailable(1000))
- {
- console.log("Returned: " + sensor.readDataStr(1024));
- }
- else
- console.log("Timed out waiting for response");
-
- if (callback)
- callback();
-}
-
-/************** Main code **************/
-// Instantiate a GROVEGPRS Module on UART 0
-var sensor = new sensorObj.GroveGPRS(0);
-
-// Set the baud rate, 19200 baud is the default.
-if (sensor.setBaudRate(19200))
-{
- console.log("Failed to set baud rate");
- process.exit(0);
-}
-
-printUsage(process.argv[1]);
-
-// Note: in nodeJS, command-line argument 0 is "node".
-// Command-line argument 1 is "grovegprs.js"
-// If you have a third argument, then it's a command
-if (process.argv.length > 2)
-{
- console.log("Sending command line argument (" + process.argv[2] + ")...");
- sendCommand(sensor, process.argv[2]);
-}
-else
-{
- // sending this command as a synchronous callback ensures better timing
- var callbackFunc = function()
- {
- setTimeout(function()
- {
- // query the saved profiles
- console.log("Querying the saved profiles (AT&V)...");
- sendCommand(sensor, "AT&V");
-
- // A comprehensive list is available from the
- // datasheet at:
- // http://www.seeedstudio.com/wiki/images/7/72/AT_Commands_v1.11.pdf
- }, 1000);
- };
-
- // query the module manufacturer
- console.log("Querying module manufacturer (AT+CGMI)...");
- sendCommand(sensor, "AT+CGMI", callbackFunc);
-}
-
-
-/************** Exit code **************/
-process.on('SIGINT', function()
-{
- sensor = null;
- sensorObj.cleanUp();
- sensorObj = null;
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/grovegsr.js b/peripheral/libupm/examples/javascript/grovegsr.js
deleted file mode 100644
index 5217eee..0000000
--- a/peripheral/libupm/examples/javascript/grovegsr.js
+++ /dev/null
@@ -1,51 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var grovegsr_lib = require("jsupm_grovegsr");
-
-// The was tested with the GroveGSR Galvanic Skin Response Sensor module.
-
-// Instantiate a GroveGSR on analog pin A0
-var grovegsr_obj = new grovegsr_lib.GroveGSR(0);
-console.log("Calibrating....");
-grovegsr_obj.calibrate();
-
-var myInterval = setInterval(function()
-{
- console.log(grovegsr_obj.value());
-}, 500);
-
-
-// When exiting: clear interval, and print message
-process.on('SIGINT', function()
-{
- clearInterval(myInterval);
- grovegsr_obj = null;
- grovegsr_lib.cleanUp();
- grovegsr_lib = null;
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/groveled.js b/peripheral/libupm/examples/javascript/groveled.js
deleted file mode 100644
index 7314d39..0000000
--- a/peripheral/libupm/examples/javascript/groveled.js
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Author: Sarah Knepper <sarah.knepper@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-// Load Grove module
-var groveSensor = require('jsupm_grove');
-
-// Create the Grove LED object using GPIO pin 2
-var led = new groveSensor.GroveLed(2);
-
-// Print the name
-console.log(led.name());
-
-// Turn the LED on and off 10 times, pausing one second
-// between transitions
-var i = 0;
-var waiting = setInterval(function() {
- if ( i % 2 == 0 ) {
- led.on();
- } else {
- led.off();
- }
- i++;
- if ( i == 20 ) clearInterval(waiting);
- }, 1000);
-
diff --git a/peripheral/libupm/examples/javascript/groveledbar.js b/peripheral/libupm/examples/javascript/groveledbar.js
deleted file mode 100644
index 960463f..0000000
--- a/peripheral/libupm/examples/javascript/groveledbar.js
+++ /dev/null
@@ -1,73 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var LEDBar = require("jsupm_my9221");
-
-// Instantiate a MY9221, we use D8 for the data, and D9 for the
-// data clock. This was tested with a Grove LED bar.
-var myLEDBar = new LEDBar.GroveLEDBar(8, 9);
-
-var directionBool = true;
-
-// A note on timing:
-// In the C++ example, the system sleeps 10 times for 50 milliseconds
-// between each LED lighting. After the LED has reached the last light
-// of the cycle, the system sleeps again for 1 second.
-// The sleeps are cumulative, so the system has slept for 1.5 seconds
-// sum total for each cycle.
-// setInterval and setTimeout make asynchronous function calls;
-// they aren't cumulative.
-// In order to approximate the behavior of the C++ example, we need
-// to call each iteration 1.5 seconds apart instead of 1 second apart.
-var myInterval = setInterval(function()
-{
- // start showing LED strip with just the first one lit
- show_LED(1, directionBool);
-}, (1000 + (10*50)) );
-
-function show_LED(level, direction)
-{
- // If it's less than 10
- // light up the LED now
- // call show_LED again in 50 ms
- if (level <= 10)
- {
- myLEDBar.setBarLevel(level, directionBool);
- setTimeout(show_LED, 50, ++level, directionBool);
- }
- // Switch LED lighting directions between lighting cycles
- else
- directionBool = !directionBool;
-}
-
-// When exiting: clear LED strip lights, clear interval, print exit message
-process.on('SIGINT', function()
-{
- myLEDBar.setBarLevel(0, true);
- clearInterval(myInterval);
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/grovelight.js b/peripheral/libupm/examples/javascript/grovelight.js
deleted file mode 100644
index d09b462..0000000
--- a/peripheral/libupm/examples/javascript/grovelight.js
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Author: Sarah Knepper <sarah.knepper@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-// Load Grove module
-var groveSensor = require('jsupm_grove');
-
-// Create the light sensor object using AIO pin 0
-var light = new groveSensor.GroveLight(0);
-
-// Read the input and print both the raw value and a rough lux value,
-// waiting one second between readings
-function readLightSensorValue() {
- console.log(light.name() + " raw value is " + light.raw_value() +
- ", which is roughly " + light.value() + " lux");
-}
-setInterval(readLightSensorValue, 1000);
diff --git a/peripheral/libupm/examples/javascript/grovelinefinder.js b/peripheral/libupm/examples/javascript/grovelinefinder.js
deleted file mode 100644
index 85f0b96..0000000
--- a/peripheral/libupm/examples/javascript/grovelinefinder.js
+++ /dev/null
@@ -1,47 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*global */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2014 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var lineFinderSensor = require('jsupm_grovelinefinder');
-
-// Instantiate a Grove line finder sensor on digital pin D2
-var myLineFinderSensor = new lineFinderSensor.GroveLineFinder(2);
-
-// Check every second for the presence of white detection
-setInterval(function()
-{
- if (myLineFinderSensor.whiteDetected())
- console.log("White detected.");
- else
- console.log("Black detected.");
-}, 1000);
-
-// Turn relay off when exiting
-process.on('SIGINT', function()
-{
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/grovemd-stepper.js b/peripheral/libupm/examples/javascript/grovemd-stepper.js
deleted file mode 100644
index 1264d8a..0000000
--- a/peripheral/libupm/examples/javascript/grovemd-stepper.js
+++ /dev/null
@@ -1,95 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-var grovemdObj = require('jsupm_grovemd');
-
-// This example demonstrates using the GroveMD to drive a stepper motor
-
-function start()
-{
- if (motor)
- {
- // configure it, for this example, we'll assume 200 steps per rev
- motor.configStepper(200);
- motor.setStepperSteps(100);
- // start it going at 10 RPM
- motor.enableStepper(grovemdObj.GroveMD.STEP_DIR_CW, 10);
- }
-}
-
-function reverse()
-{
- if (motor)
- {
- // now reverse
- motor.setStepperSteps(100);
- // start it going at 10 RPM
- motor.enableStepper(grovemdObj.GroveMD.STEP_DIR_CCW, 10);
- }
-}
-
-function end()
-{
- if (motor)
- {
- motor.disableStepper();
- }
- exit();
-}
-
-// When exiting: clear memory and print exit message
-function exit()
-{
- if (motor)
- {
- motor = null;
- grovemdObj.cleanUp();
- }
- grovemdObj = null;
- console.log("Exiting");
- process.exit(0);
-}
-
-
-// Instantiate an I2C Grove Motor Driver on I2C bus 0
-var motor = new grovemdObj.GroveMD(
- grovemdObj.GROVEMD_I2C_BUS,
- grovemdObj.GROVEMD_DEFAULT_I2C_ADDR);
-
-start();
-
-setTimeout(function()
-{
- reverse();
- setTimeout(end, 3000);
-}, 3000);
-
-
-process.on('SIGINT', function()
-{
- exit();
-});
diff --git a/peripheral/libupm/examples/javascript/grovemd.js b/peripheral/libupm/examples/javascript/grovemd.js
deleted file mode 100644
index 76109f4..0000000
--- a/peripheral/libupm/examples/javascript/grovemd.js
+++ /dev/null
@@ -1,94 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var groveMotorDriver_lib = require('jsupm_grovemd');
-
-function start()
-{
- if (my_MotorDriver_obj)
- {
- // set direction to CW and set speed to 50%
- console.log("Spin M1 and M2 at half speed for 3 seconds");
- my_MotorDriver_obj.setMotorDirections(groveMotorDriver_lib.GroveMD.DIR_CW,
- groveMotorDriver_lib.GroveMD.DIR_CW);
- my_MotorDriver_obj.setMotorSpeeds(127, 127);
- }
-}
-
-function reverse()
-{
- if (my_MotorDriver_obj)
- {
- // counter clockwise
- console.log("Reversing M1 and M2 for 3 seconds");
- my_MotorDriver_obj.setMotorDirections(groveMotorDriver_lib.GroveMD.DIR_CCW,
- groveMotorDriver_lib.GroveMD.DIR_CCW);
- }
-}
-
-function end()
-{
- if (my_MotorDriver_obj)
- {
- console.log("Stopping motors");
- my_MotorDriver_obj.setMotorSpeeds(0, 0);
- }
- exit();
-}
-
-// When exiting: clear memory and print exit message
-function exit()
-{
- if (my_MotorDriver_obj)
- {
- my_MotorDriver_obj = null;
- groveMotorDriver_lib.cleanUp();
- }
- groveMotorDriver_lib = null;
- console.log("Exiting");
- process.exit(0);
-}
-
-
-// Instantiate an I2C Grove Motor Driver on I2C bus 0
-var my_MotorDriver_obj = new groveMotorDriver_lib.GroveMD(
- groveMotorDriver_lib.GROVEMD_I2C_BUS,
- groveMotorDriver_lib.GROVEMD_DEFAULT_I2C_ADDR);
-
-start();
-
-setTimeout(function()
-{
- reverse();
- setTimeout(end, 3000);
-}, 3000);
-
-
-process.on('SIGINT', function()
-{
- exit();
-});
diff --git a/peripheral/libupm/examples/javascript/grovemoisture.js b/peripheral/libupm/examples/javascript/grovemoisture.js
deleted file mode 100644
index 3d3f705..0000000
--- a/peripheral/libupm/examples/javascript/grovemoisture.js
+++ /dev/null
@@ -1,57 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*global */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2014 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-//Load Grove Moisture module
-var grove_moisture = require('jsupm_grovemoisture');
-
-// Instantiate a Grove Moisture sensor on analog pin A0
-var myMoistureObj = new grove_moisture.GroveMoisture(0);
-
-// Values (approximate):
-// 0-300, sensor in air or dry soil
-// 300-600, sensor in humid soil
-// 600+, sensor in wet soil or submerged in water
-// Read the value every second and print the corresponding moisture level
-setInterval(function()
-{
- var result;
- var moisture_val = parseInt(myMoistureObj.value());
- if (moisture_val >= 0 && moisture_val < 300)
- result = "Dry";
- else if (moisture_val >= 300 && moisture_val < 600)
- result = "Moist";
- else
- result = "Wet";
- console.log("Moisture value: " + moisture_val + ", " + result);
-}, 1000);
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/groveo2.js b/peripheral/libupm/examples/javascript/groveo2.js
deleted file mode 100644
index 14ac46f..0000000
--- a/peripheral/libupm/examples/javascript/groveo2.js
+++ /dev/null
@@ -1,52 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-var groveO2_lib = require("jsupm_groveo2");
-
-// The was tested with the O2 Oxygen Concentration Sensor Module
-// Instantiate a GroveO2 on analog pin A0
-var groveO2_obj = new groveO2_lib.GroveO2(0);
-
-var myInterval = setInterval(function()
-{
- console.log("The output voltage is: " + roundNum(groveO2_obj.voltageValue(), 5) + "mV");
-}, 100);
-
-function roundNum(num, decimalPlaces)
-{
- var extraNum = (1 / (Math.pow(10, decimalPlaces) * 1000));
- return (Math.round((num + extraNum) * (Math.pow(10, decimalPlaces))) / Math.pow(10, decimalPlaces));
-}
-
-// When exiting: clear interval, and print message
-process.on('SIGINT', function()
-{
- clearInterval(myInterval);
- groveO2_obj = null;
- groveO2_lib.cleanUp();
- groveO2_lib = null;
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/groverelay.js b/peripheral/libupm/examples/javascript/groverelay.js
deleted file mode 100644
index a8fefe7..0000000
--- a/peripheral/libupm/examples/javascript/groverelay.js
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Author: Sarah Knepper <sarah.knepper@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-// Load Grove module
-var groveSensor = require('jsupm_grove');
-
-// Create the relay switch object using GPIO pin 0
-var relay = new groveSensor.GroveRelay(0);
-
-// Close and then open the relay switch 3 times,
-// waiting one second each time. The LED on the relay switch
-// will light up when the switch is on (closed).
-// The switch will also make a noise between transitions.
-var i = 0;
-var waiting = setInterval(function() {
- if ( i % 2 == 0 ) {
- relay.on();
- if ( relay.isOn() )
- console.log(relay.name() + " is on");
- } else {
- relay.off();
- if ( relay.isOff() )
- console.log(relay.name() + " is off");
- }
- i++;
- if ( i == 6) clearInterval(waiting);
- }, 1000);
-
diff --git a/peripheral/libupm/examples/javascript/groverotary.js b/peripheral/libupm/examples/javascript/groverotary.js
deleted file mode 100644
index 040f38c..0000000
--- a/peripheral/libupm/examples/javascript/groverotary.js
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Author: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-//setup/Initialization
-var upm_grove = require('jsupm_grove');
-
-//setup access analog input Analog pin #0 (A0)
-var groveRotary = new upm_grove.GroveRotary(0);
-
-loop();
-
-function loop()
-{
- var abs = groveRotary.abs_value();
- var absdeg = groveRotary.abs_deg();
- var absrad = groveRotary.abs_rad();
-
- var rel = groveRotary.rel_value();
- var reldeg = groveRotary.rel_deg();
- var relrad = groveRotary.rel_rad();
-
- //write the knob value to the console in different formats
- console.log("Abs: " + abs + " " + Math.round(parseInt(absdeg)) + " " + absrad.toFixed(3));
- console.log("Rel: " + rel + " " + Math.round(parseInt(reldeg)) + " " + relrad.toFixed(3));
-
- //wait 2 s and call function again
- setTimeout(loop, 2000);
-}
diff --git a/peripheral/libupm/examples/javascript/grovescam.js b/peripheral/libupm/examples/javascript/grovescam.js
deleted file mode 100644
index 7872bf8..0000000
--- a/peripheral/libupm/examples/javascript/grovescam.js
+++ /dev/null
@@ -1,72 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-var cameraObj = require('jsupm_grovescam');
-
-// Instantiate a Grove Serial Camera on UART 0
-var camera = new cameraObj.GROVESCAM(0);
-
-// make sure port is initialized properly. 115200 baud is the default.
-if (!camera.setupTty())
-{
- console.log("Failed to setup tty port parameters");
- process.exit(1);
-}
-
-if (camera.init())
- console.log("Initialized...");
-else
- console.log("init() failed");
-
-if (camera.preCapture())
- console.log("preCapture succeeded...");
-else
- console.log("preCapture failed.");
-
-if (camera.doCapture())
- console.log("doCapture succeeded...");
-else
- console.log("doCapture failed.");
-
-console.log("Image size is " + camera.getImageSize() + " bytes");
-
-if (camera.getImageSize() > 0)
-{
- console.log("Storing image.jpg...");
- if (camera.storeImage("image.jpg"))
- console.log("storeImage succeeded...");
- else
- console.log("storeImage failed.");
-}
-
-
-camera = null;
-cameraObj.cleanUp();
-cameraObj = null;
-console.log("Exiting.");
-process.exit(0);
-
diff --git a/peripheral/libupm/examples/javascript/groveslide.js b/peripheral/libupm/examples/javascript/groveslide.js
deleted file mode 100644
index bd16eee..0000000
--- a/peripheral/libupm/examples/javascript/groveslide.js
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Author: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-var upm_grove = require('jsupm_grove');
-
-//setup access analog input Analog pin #0 (A0)
-var groveSlide = new upm_grove.GroveSlide(0);
-
-loop();
-
-function loop()
-{
- var raw = groveSlide.raw_value();
- var volts = groveSlide.voltage_value();
-
- //write the slider values to the console
- console.log("Slider Value: " + raw + " = " + volts.toFixed(2) + " V");
-
- //wait 2 s then call function again
- setTimeout(loop, 2000);
-}
diff --git a/peripheral/libupm/examples/javascript/grovespeaker.js b/peripheral/libupm/examples/javascript/grovespeaker.js
deleted file mode 100644
index bac28f0..0000000
--- a/peripheral/libupm/examples/javascript/grovespeaker.js
+++ /dev/null
@@ -1,44 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*global */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2014 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-//Load Grove Speaker module
-var groveSpeaker = require('jsupm_grovespeaker');
-// Instantiate a Grove Speaker on digital pin D2
-var mySpeaker = new groveSpeaker.GroveSpeaker(2);
-
-// Play all 7 of the lowest notes
-mySpeaker.playAll();
-
-// Play a medium C-sharp
-mySpeaker.playSound('c', true, "med");
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/grovetemp.js b/peripheral/libupm/examples/javascript/grovetemp.js
deleted file mode 100644
index dba3954..0000000
--- a/peripheral/libupm/examples/javascript/grovetemp.js
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Author: Sarah Knepper <sarah.knepper@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-// Load Grove module
-var groveSensor = require('jsupm_grove');
-
-// Create the temperature sensor object using AIO pin 0
-var temp = new groveSensor.GroveTemp(0);
-console.log(temp.name());
-
-// Read the temperature ten times, printing both the Celsius and
-// equivalent Fahrenheit temperature, waiting one second between readings
-var i = 0;
-var waiting = setInterval(function() {
- var celsius = temp.value();
- var fahrenheit = celsius * 9.0/5.0 + 32.0;
- console.log(celsius + " degrees Celsius, or " +
- Math.round(fahrenheit) + " degrees Fahrenheit");
- i++;
- if (i == 10) clearInterval(waiting);
- }, 1000);
diff --git a/peripheral/libupm/examples/javascript/groveultrasonic.js b/peripheral/libupm/examples/javascript/groveultrasonic.js
deleted file mode 100644
index e2b5804..0000000
--- a/peripheral/libupm/examples/javascript/groveultrasonic.js
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Author: Jun Kato <i@junkato.jp>
- * Copyright (c) 2015 Jun Kato.
- *
- * Thanks to Seeed Studio for a working arduino sketch
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-var ultrasonic = require("jsupm_groveultrasonic");
-var sensor = new ultrasonic.GroveUltraSonic(2);
-
-var myInterval = setInterval(function()
-{
- var travelTime = sensor.getDistance();
- if (travelTime > 0) {
- var distance = (travelTime / 29 / 2).toFixed(3);
- console.log("distance: " + distance + " [cm]");
- }
-}, 200);
-
-// When exiting: clear interval and print message
-process.on('SIGINT', function()
-{
- clearInterval(myInterval);
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/grovevdiv.js b/peripheral/libupm/examples/javascript/grovevdiv.js
deleted file mode 100644
index 4ff052a..0000000
--- a/peripheral/libupm/examples/javascript/grovevdiv.js
+++ /dev/null
@@ -1,53 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2014 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var voltageDivider = require('jsupm_grovevdiv');
-// Instantiate a Grove Voltage Divider sensor on analog pin A0
-var myVoltageDivider = new voltageDivider.GroveVDiv(0);
-
-// collect data and output measured voltage according to the setting
-// of the scaling switch (3 or 10)
-var val, gain3val, gain10val;
-function getVoltageInfo()
-{
- val = myVoltageDivider.value(100);
- gain3val = myVoltageDivider.computedValue(3, val);
- gain10val = myVoltageDivider.computedValue(10, val);
- console.log("ADC value: " + val + " Gain 3: " + gain3val
- + "v Gain 10: " + gain10val + "v");
-}
-
-setInterval(getVoltageInfo, 1000);
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- myVoltageDivider = null;
- voltageDivider.cleanUp();
- voltageDivider = null;
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/grovewater.js b/peripheral/libupm/examples/javascript/grovewater.js
deleted file mode 100644
index 5768c9a..0000000
--- a/peripheral/libupm/examples/javascript/grovewater.js
+++ /dev/null
@@ -1,49 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*global */
-/*
- * Author: Zion Orent <zorent@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-// Load Grove module
-var waterSensor = require('jsupm_grovewater');
-
-// Instantiate a Grove Water sensor on digital pin D2
-var water = new waterSensor.GroveWater(2);
-
-// Read whether the sensor is wet/dry, waiting one second between readings
-function readWaterState()
-{
- if (water.isWet())
- console.log("Sensor is wet");
- else
- console.log("Sensor is dry");
-}
-setInterval(readWaterState, 1000);
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/grovewfs.js b/peripheral/libupm/examples/javascript/grovewfs.js
deleted file mode 100644
index daa232c..0000000
--- a/peripheral/libupm/examples/javascript/grovewfs.js
+++ /dev/null
@@ -1,69 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var waterFlow_lib = require('jsupm_grovewfs');
-
-// Instantiate a Grove Water Flow Sensor on digital pin D2
-var myWaterFlow_obj = new waterFlow_lib.GroveWFS(2);
-
-// set the flow counter to 0 and start counting
-myWaterFlow_obj.clearFlowCounter();
-myWaterFlow_obj.startFlowCounter();
-
-
-var millis, flowCount, fr;
-var myInterval = setInterval(function()
-{
- // we grab these (millis and flowCount) just for display
- // purposes in this example
- millis = myWaterFlow_obj.getMillis();
- flowCount = myWaterFlow_obj.flowCounter();
-
- fr = myWaterFlow_obj.flowRate();
-
- // output milliseconds passed, flow count, and computed flow rate
- outputStr = "Millis: " + millis + " Flow Count: " + flowCount +
- " Flow Rate: " + fr + " LPM";
- console.log(outputStr);
-
- // best to gather data for at least one second for reasonable
- // results.
-}, 2000);
-
-
-// When exiting: clear interval and print message
-process.on('SIGINT', function()
-{
- clearInterval(myInterval);
- myWaterFlow_obj.stopFlowCounter();
- myWaterFlow_obj = null
- waterFlow_lib.cleanUp();
- waterFlow_lib = null;
-
- console.log("Exiting");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/guvas12d.js b/peripheral/libupm/examples/javascript/guvas12d.js
deleted file mode 100644
index 5410777..0000000
--- a/peripheral/libupm/examples/javascript/guvas12d.js
+++ /dev/null
@@ -1,56 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*global */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2014 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var UVSensor = require('jsupm_guvas12d');
-
-// Instantiate a UV sensor on analog pin A0
-var myUVSensor = new UVSensor.GUVAS12D(0);
-
-// analog voltage, usually 3.3 or 5.0
-var g_GUVAS12D_AREF = 5.0;
-var g_SAMPLES_PER_QUERY = 1024;
-
-setInterval(function()
-{
- var outputStr = "AREF: " + g_GUVAS12D_AREF
- + ", Voltage value (higher means more UV): "
- + roundNum(myUVSensor.value(g_GUVAS12D_AREF, g_SAMPLES_PER_QUERY), 6);
- console.log(outputStr);
-}, 1000);
-
-function roundNum(num, decimalPlaces)
-{
- var extraNum = (1 / (Math.pow(10, decimalPlaces) * 1000));
- return (Math.round((num + extraNum) * (Math.pow(10, decimalPlaces))) / Math.pow(10, decimalPlaces));
-}
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/h3lis331dl.js b/peripheral/libupm/examples/javascript/h3lis331dl.js
deleted file mode 100644
index ae38cd5..0000000
--- a/peripheral/libupm/examples/javascript/h3lis331dl.js
+++ /dev/null
@@ -1,91 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
-* Author: Jon Trulson <jtrulson@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var digitalAccelerometer = require('jsupm_h3lis331dl');
-
-// Instantiate an H3LIS331DL on I2C bus 0
-var myDigitalAccelerometer = new digitalAccelerometer.H3LIS331DL(
- digitalAccelerometer.H3LIS331DL_I2C_BUS,
- digitalAccelerometer.H3LIS331DL_DEFAULT_I2C_ADDR);
-
-// Initialize the device with default values
-myDigitalAccelerometer.init();
-
-var x, y, z;
-x = digitalAccelerometer.new_intp();
-y = digitalAccelerometer.new_intp();
-z = digitalAccelerometer.new_intp();
-
-var ax, ay, az;
-ax = digitalAccelerometer.new_floatp();
-ay = digitalAccelerometer.new_floatp();
-az = digitalAccelerometer.new_floatp();
-
-var outputStr;
-
-var myInterval = setInterval(function()
-{
- myDigitalAccelerometer.update();
- myDigitalAccelerometer.getRawXYZ(x, y, z);
- outputStr = "Raw: X = " + digitalAccelerometer.intp_value(x) +
- " Y = " + digitalAccelerometer.intp_value(y) +
- " Z = " + digitalAccelerometer.intp_value(z);
- console.log(outputStr);
-
- myDigitalAccelerometer.getAcceleration(ax, ay, az);
- outputStr = "Acceleration: AX = "
- + roundNum(digitalAccelerometer.floatp_value(ax), 6)
- + " AY = " + roundNum(digitalAccelerometer.floatp_value(ay), 6)
- + " AZ = " + roundNum(digitalAccelerometer.floatp_value(az), 6);
- console.log(outputStr);
-}, 500);
-
-// round off output to match C example, which has 6 decimal places
-function roundNum(num, decimalPlaces)
-{
- var extraNum = (1 / (Math.pow(10, decimalPlaces) * 1000));
- return (Math.round((num + extraNum)
- * (Math.pow(10, decimalPlaces))) / Math.pow(10, decimalPlaces));
-}
-
-// When exiting: clear interval and print message
-process.on('SIGINT', function()
-{
- clearInterval(myInterval);
-
- // clean up memory
- digitalAccelerometer.delete_intp(x);
- digitalAccelerometer.delete_intp(y);
- digitalAccelerometer.delete_intp(z);
-
- digitalAccelerometer.delete_floatp(ax);
- digitalAccelerometer.delete_floatp(ay);
- digitalAccelerometer.delete_floatp(az);
-
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/hdxxvxta.js b/peripheral/libupm/examples/javascript/hdxxvxta.js
deleted file mode 100644
index 628c85c..0000000
--- a/peripheral/libupm/examples/javascript/hdxxvxta.js
+++ /dev/null
@@ -1,64 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2016 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-var sensorObj = require('jsupm_hdxxvxta');
-
-
-/************** Main code **************/
-
-console.log("Initializing...");
-
-// Instantiate an HDXXVXTA instance, using A1 for humidity and A0
-// for temperature
-var sensor = new sensorObj.HDXXVXTA(1, 0);
-
-// update and print available values every second
-setInterval(function()
-{
- // update our values from the sensor
- sensor.update();
-
- // we show both C and F for temperature
- console.log("Temperature:", sensor.getTemperature(),
- "C /", sensor.getTemperature(true), "F");
-
- console.log("Humidity:", sensor.getHumidity(), "%");
-
- console.log("");
-
-}, 1000);
-
-
-process.on('SIGINT', function()
-{
- sensor = null;
- sensorObj.cleanUp();
- sensorObj = null;
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/hm11.js b/peripheral/libupm/examples/javascript/hm11.js
deleted file mode 100644
index 326f61e..0000000
--- a/peripheral/libupm/examples/javascript/hm11.js
+++ /dev/null
@@ -1,136 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-
-/************** Variables **************/
-// normal read/write mode
-var bufferLength = 256;
-
-var ble = require('jsupm_hm11');
-
-
-/************** Functions **************/
-function printUsage(progname)
-{
- var outputStr = "Usage: " + progname + " [AT command]\n\n" +
- "If an argument is supplied on the command line, that argument is\n" +
- "sent to the module and the response is printed out.\n\n" +
- "If no argument is used, then the address and PIN of the module\n" +
- "are queried and the results printed out.\n\n"
- console.log(outputStr);
-}
-
-// simple helper function to send a command and wait for a response
-function sendCommand(bleObj, cmd, callback)
-{
- var bleBuffer = new ble.charArray(bufferLength);
- bleObj.writeData(cmd, cmd.length);
-
- // wait up to 1 second
- if (bleObj.dataAvailable(1000))
- {
- bleObj.readData(bleBuffer, bufferLength);
- var bleData = "";
- // read only the number of characters
- // specified by myGPSSensor.readData
- for (var x = 0; x < bufferLength; x++)
- {
- if (bleBuffer.getitem(x) == '\0')
- break;
- else
- bleData += bleBuffer.getitem(x);
- }
- console.log(bleData);
- }
- else
- console.log("Timed out waiting for response");
- if (callback)
- callback();
-}
-
-/************** Main code **************/
-// Instantiate a HM11 BLE Module on UART 0
-var my_ble_obj = new ble.HM11(0);
-
-// make sure port is initialized properly. 9600 baud is the default.
-if (!my_ble_obj.setupTty(ble.int_B9600))
-{
- console.log("Failed to setup tty port parameters");
- process.exit(0);
-}
-
-printUsage(process.argv[1]);
-
-// Note: in nodeJS, command-line argument 0 is "node".
-// Command-line argument 1 is "hm11.js"
-// If you have a third argument, then it's a command for BLE
-if (process.argv.length > 2)
-{
- console.log("Sending command line argument (" + process.argv[2] + ")...");
- sendCommand(my_ble_obj, process.argv[2]);
-}
-else
-{
- // query the module address
- var addr = "AT+ADDR?";
- console.log("Querying module address (" + addr + ")...");
-
- // sending this command as a synchronous callback ensures better timing
- var callbackFunc = function()
- {
- setTimeout(function()
- {
- // query the module address
- var pin = "AT+PASS?";
- console.log("Querying module PIN (" + pin + ")...");
- sendCommand(my_ble_obj, pin);
-
- // Other potentially useful commands are:
- //
- // AT+VERS? - query module version
- // AT+ROLE0 - set as slave
- // AT+ROLE1 - set as master
- // AT+CLEAR - clear all previous settings
- // AT+RESET - restart the device
- //
- // A comprehensive list is available from the datasheet at:
- // http://www.seeedstudio.com/wiki/images/c/cd/Bluetooth4_en.pdf
- }, 1000);
- };
- sendCommand(my_ble_obj, addr, callbackFunc);
-}
-
-
-/************** Exit code **************/
-process.on('SIGINT', function()
-{
- my_ble_obj = null;
- ble.cleanUp();
- ble = null;
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/hmc5883l.js b/peripheral/libupm/examples/javascript/hmc5883l.js
deleted file mode 100644
index c70a60d..0000000
--- a/peripheral/libupm/examples/javascript/hmc5883l.js
+++ /dev/null
@@ -1,61 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*global */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2014 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-// Load Compass module
-var hmc5883l = require('jsupm_hmc5883l');
-// load this on i2c
-var myCompass = new hmc5883l.Hmc5883l(0);
-// Set your declination from true north in radians
-myCompass.set_declination(0.2749);
-
-var coordsObj;
-// Print out the coordinates, heading, and direction every second
-setInterval(function()
-{
- myCompass.update(); // Update the coordinates
- coordsObj = myCompass.coordinates();
- var coords = (coordsObj.getitem(0) + " ");
- coords += (coordsObj.getitem(1) + " ");
- coords += coordsObj.getitem(2);
- var heading = round2Digits(myCompass.heading());
- var direction = round2Digits(myCompass.direction());
- var compassResults = "coords: " + coords +
- " heading: " + heading + " direction " + direction;
- console.log(compassResults);
-}, 1000);
-
-function round2Digits(num)
-{
- return Math.round((num + 0.00001) * 100) / 100;
-}
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/hmtrp.js b/peripheral/libupm/examples/javascript/hmtrp.js
deleted file mode 100644
index 3bdd0f2..0000000
--- a/peripheral/libupm/examples/javascript/hmtrp.js
+++ /dev/null
@@ -1,161 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-function printUsage()
-{
- var outputStr = "Usage:\n" +
- "Pass a commandline argument (any argument) to this program\n" +
- "to query the radio configuration and output it. NOTE: the\n" +
- "radio must be in CONFIG mode for this to work.\n\n" +
- "Running this program without arguments will simply transmit\n" +
- "'Hello World!' every second, and output any data received from\n" +
- "another radio.\n\n";
- console.log(outputStr);
-}
-
-var HMTRP_Radio = require('jsupm_hmtrp');
-
-// Instantiate a HMTRP radio device on uart 0
-var my_HMTRP_Radio = new HMTRP_Radio.HMTRP(0);
-
-var g_myInterval;
-var g_counter = 0;
-
-// normal read/write mode
-var bufferLength = 256;
-var radioBuffer = new HMTRP_Radio.charArray(bufferLength);
-
-// make sure port is initialized properly. 9600 baud is the default.
-if (!my_HMTRP_Radio.setupTty(HMTRP_Radio.int_B9600))
-{
- console.log("Failed to setup tty port parameters");
- process.exit(0);
-}
-
-printUsage();
-
-// By default, this radio simply transmits data sent via writeData()
-// and reads any available data via readData().
-
-// It can be placed into a configuration mode by grounding the
-// CONFIG pin on the module. When this is done, the various
-// configuration query and config methods can be used. In this
-// example, by default, we just read any data available fom the
-// device, and periodically transmit "Hello World".
-
-// If any argument was specified on the command line, do a simple
-// configuration query and output the results. The radio must be in
-// CONFIG mode for this to work.
-
-
-// Note that the first command-line argument
-// should be "node" and the second is "hmtrp.js".
-// The data we want would be the third... if it exists
-if (process.argv.length > 2)
-{
- // config mode
- var freq = new HMTRP_Radio.uint32Array(0);
- var dataRate = new HMTRP_Radio.uint32Array(0);
- var rxBandwidth = new HMTRP_Radio.uint16Array(0);
- var modulation = new HMTRP_Radio.uint8Array(0);
- var txPower = new HMTRP_Radio.uint8Array(0);
- var uartBaud = new HMTRP_Radio.uint32Array(0);
-
- if (my_HMTRP_Radio.getConfig(
- freq, dataRate, rxBandwidth, modulation, txPower, uartBaud))
- {
- console.log("Radio configuration:");
- var outputStr = "freq: " + freq.getitem(0) +
- " dataRate: " + dataRate.getitem(0) +
- " rxBandwidth: " + rxBandwidth.getitem(0) + "Khz";
- console.log(outputStr);
-
- outputStr = "modulation: " + parseInt(modulation.getitem(0));
- outputStr += " Khz txPower: " + parseInt(txPower.getitem(0));
- outputStr += " uartBaud: " + uartBaud.getitem(0);
- console.log(outputStr);
- }
- else
- {
- var errString = "getConfig() failed. Make sure the radio " +
- "is in CONFIG mode.";
- console.log(errString);
- }
-}
-else
-{
- console.log("Running in normal read/write mode.");
- g_myInterval = setInterval(runRadio, 100); // 100ms
-}
-
-function runRadio()
-{
- // we don't want the read to block in this example, so always
- // check to see if data is available first.
- if (my_HMTRP_Radio.dataAvailable())
- {
- var rv = my_HMTRP_Radio.readData(radioBuffer, bufferLength);
-
- if (rv > 0)
- {
- var resultStr = "";
- for (var x = 0; x < rv; x++)
- resultStr += radioBuffer.getitem(x);
- console.log("Received: " + resultStr);
- }
-
- if (rv < 0) // some sort of read error occured
- {
- console.log("Port read error.");
- return;
- }
- }
- g_counter++;
- // every second, transmit "Hello World"
- if (g_counter > 10)
- {
- var msg = "Hello World!";
-
- console.log("Transmitting " + msg + "...");
-
- // Adding 1 for NULL terminator.
- // Note that SWIG automatically adds a NULL terminator,
- // so no need to NULL-terminate ourselves.
- // Just increment the message length to include
- // the NULL that's already there
- my_HMTRP_Radio.writeData(msg, (msg.length + 1));
- g_counter = 0;
- }
-}
-
-// When exiting: clear interval and print message
-process.on('SIGINT', function()
-{
- clearInterval(g_myInterval);
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/hp20x.js b/peripheral/libupm/examples/javascript/hp20x.js
deleted file mode 100644
index 0447459..0000000
--- a/peripheral/libupm/examples/javascript/hp20x.js
+++ /dev/null
@@ -1,55 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-var barometerObj = require('jsupm_hp20x');
-
-// Instantiate an HP20X on default I2C bus and address
-var bar = new barometerObj.HP20X();
-
-// Initialize the device with default values
-bar.init();
-
-// Output data every second until interrupted
-setInterval(function()
-{
- console.log("Temperature: " + bar.getTemperature() + " Celcius");
- console.log("Pressure: " + bar.getPressure() + " Millibars");
- console.log("Altitude: " + bar.getAltitude() + " Meters");
- console.log("");
-}, 1000);
-
-// exit on ^C
-process.on('SIGINT', function()
-{
- bar = null;
- barometerObj.cleanUp();
- barometerObj = null;
- console.log("Exiting.");
- process.exit(0);
-});
-
diff --git a/peripheral/libupm/examples/javascript/ht9170.js b/peripheral/libupm/examples/javascript/ht9170.js
deleted file mode 100644
index d7bf1ff..0000000
--- a/peripheral/libupm/examples/javascript/ht9170.js
+++ /dev/null
@@ -1,54 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-var ht9170_dtmf_lib = require("jsupm_ht9170");
-
-// Instantiate a DTMF decoder
-var dtmf_obj = new ht9170_dtmf_lib.HT9170(12, 11, 10, 9, 8);
-
-// Now we just spin in a loop, sleeping every 100ms, checking to see
-// if a digit is available. If so, we decode and print the digit,
-// and continue looping.
-var myInterval = setInterval(function()
-{
- if (dtmf_obj.digitReady())
- {
- console.log("Got DTMF code: " + dtmf_obj.decodeDigit());
- // now spin until digitReady() goes false again
- while (dtmf.digitReady())
- ;
- }
-}, 100);
-
-// When exiting: clear interval, and print message
-process.on('SIGINT', function()
-{
- clearInterval(myInterval);
- dtmf_obj = null;
- ht9170_dtmf_lib.cleanUp();
- ht9170_dtmf_lib = null;
- console.log("Exiting");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/hwxpxx.js b/peripheral/libupm/examples/javascript/hwxpxx.js
deleted file mode 100644
index 08269c7..0000000
--- a/peripheral/libupm/examples/javascript/hwxpxx.js
+++ /dev/null
@@ -1,86 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2016 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-var sensorObj = require('jsupm_hwxpxx');
-
-
-/************** Main code **************/
-
-var defaultDev = "/dev/ttyUSB0";
-
-// if an argument was specified, use it as the device instead
-if (process.argv.length > 2)
-{
- defaultDev = process.argv[2];
-}
-
-console.log("Using device " + defaultDev);
-console.log("Initializing...");
-
-// Instantiate an HWXPXX instance, using MODBUS slave address 3, and
-// default comm parameters (19200, 8, N, 2)
-var sensor = new sensorObj.HWXPXX(defaultDev, 3);
-
-// output the Slave ID (manufacturer, model, serno)
-console.log("Slave ID:", sensor.getSlaveID());
-
-// stored temperature and humidity offsets
-console.log("Temperature Offset:", sensor.getTemperatureOffset());
-console.log("Humidity Offset:", sensor.getHumidityOffset());
-
-console.log("");
-
-// update and print available values every second
-setInterval(function()
-{
- // update our values from the sensor
- sensor.update();
-
- // we show both C and F for temperature
- console.log("Temperature:", sensor.getTemperature(),
- "C /", sensor.getTemperature(true), "F");
-
- console.log("Humidity:", sensor.getHumidity(), "%");
-
- console.log("Slider:", sensor.getSlider(), "%");
-
- console.log("Override Switch Status:", sensor.getOverrideSwitchStatus());
-
- console.log("");
-
-}, 1000);
-
-
-process.on('SIGINT', function()
-{
- sensor = null;
- sensorObj.cleanUp();
- sensorObj = null;
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/hx711.js b/peripheral/libupm/examples/javascript/hx711.js
deleted file mode 100644
index 8393734..0000000
--- a/peripheral/libupm/examples/javascript/hx711.js
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
-*
-* Author: Rafael da Mata Neri <rafael.neri@gmail.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-*
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to
-* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
-* the Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all
-* copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
-* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
-* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
-* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var hx711 = require('jsupm_hx711');
-// Instantiate a HX711 data on digital pin D3 and clock on digital pin D2
-var scale = new hx711.HX711(3, 2);
-
-setTimeout(function(){
- // 2837: value obtained via calibration
- scale.setScale(2837);
- scale.tare(2);
- setInterval(function(){
- console.log(scale.getUnits());
- }, 1000);
-}, 1000);
diff --git a/peripheral/libupm/examples/javascript/ili9341.js b/peripheral/libupm/examples/javascript/ili9341.js
deleted file mode 100644
index ba0f47b..0000000
--- a/peripheral/libupm/examples/javascript/ili9341.js
+++ /dev/null
@@ -1,79 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/**
- * Author: Shawn Hymel
- * Copyright (c) 2016 SparkFun Electronics
- *
- * 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 ili9341 = require('jsupm_ili9341');
-
-// Pins (Edison)
-// CS_LCD GP44 (MRAA 31)
-// CS_SD GP43 (MRAA 38) unused
-// DC GP12 (MRAA 20)
-// RESEST GP13 (MRAA 14)
-var lcd = new ili9341.ILI9341(31, 38, 20, 14);
-
-// Fill the screen with a solid color
-lcd.fillScreen(lcd.color565(0, 40, 16));
-
-// Draw some shapes
-lcd.drawFastVLine(10, 10, 100, ili9341.ILI9341_RED);
-lcd.drawFastHLine(20, 10, 50, ili9341.ILI9341_CYAN);
-lcd.drawLine(160, 30, 200, 60, ili9341.ILI9341_GREEN);
-lcd.fillRect(20, 30, 75, 60, ili9341.ILI9341_ORANGE);
-lcd.drawCircle(70, 50, 20, ili9341.ILI9341_PURPLE);
-lcd.fillCircle(120, 50, 20, ili9341.ILI9341_PURPLE);
-lcd.drawTriangle(50, 100, 10, 140, 90, 140, ili9341.ILI9341_YELLOW);
-lcd.fillTriangle(150, 100, 110, 140, 190, 140, ili9341.ILI9341_YELLOW);
-lcd.drawRoundRect(20, 150, 50, 30, 10, ili9341.ILI9341_RED);
-lcd.drawRoundRect(130, 150, 50, 30, 10, ili9341.ILI9341_RED);
-lcd.fillRoundRect(75, 150, 50, 30, 10, ili9341.ILI9341_RED);
-
-// Write some text
-lcd.setCursor(0, 200);
-lcd.setTextColor(ili9341.ILI9341_LIGHTGREY);
-lcd.setTextWrap(true);
-lcd.setTextSize(1);
-lcd.print("Text 1\n");
-lcd.setTextSize(2);
-lcd.print("Text 2\n");
-lcd.setTextSize(3);
-lcd.print("Text 3\n");
-lcd.setTextSize(4);
-lcd.print("Text 4\n");
-
-// Test screen rotation
-function rotateScreen(r) {
- lcd.setRotation(r);
- lcd.fillRect(0, 0, 5, 5, ili9341.ILI9341_WHITE);
- if (r < 4) {
- r++;
- setTimeout(function() { rotateScreen(r); }, 1000);
- }
-}
-rotateScreen(0);
-
-// Invert colors, wait, then revert back
-setTimeout(function() { lcd.invertDisplay(true); }, 4000);
-setTimeout(function() { lcd.invertDisplay(false); }, 6000); \ No newline at end of file
diff --git a/peripheral/libupm/examples/javascript/ina132.js b/peripheral/libupm/examples/javascript/ina132.js
deleted file mode 100644
index 554c3a0..0000000
--- a/peripheral/libupm/examples/javascript/ina132.js
+++ /dev/null
@@ -1,54 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-var differential_amplifier_lib = require("jsupm_ina132");
-
-// Tested with the INA132 Differential Amplifier Sensor module.
-// Instantiate an INA132 on analog pin A0
-var differential_amplifier_obj = new differential_amplifier_lib.INA132(0);
-
-var myInterval = setInterval(function()
-{
- console.log(roundNum(differential_amplifier_obj.value(), 5));
-}, 1000);
-
-function roundNum(num, decimalPlaces)
-{
- var extraNum = (1 / (Math.pow(10, decimalPlaces) * 1000));
- var numerator = Math.round((num + extraNum) * (Math.pow(10, decimalPlaces)));
- var denominator = Math.pow(10, decimalPlaces);
- return (numerator / denominator);
-}
-
-// When exiting: clear interval, and print message
-process.on('SIGINT', function()
-{
- clearInterval(myInterval);
- differential_amplifier_obj = null;
- differential_amplifier_lib.cleanUp();
- differential_amplifier_lib = null;
- console.log("Exiting");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/isd1820.js b/peripheral/libupm/examples/javascript/isd1820.js
deleted file mode 100644
index 628dff6..0000000
--- a/peripheral/libupm/examples/javascript/isd1820.js
+++ /dev/null
@@ -1,68 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var recorder_lib = require("jsupm_isd1820");
-
-// Instantiate a ISD1820 on digital pins 2 (play) and 3 (record)
-// This example was tested on the Grove Recorder.
-var myRecorder = new recorder_lib.ISD1820(2, 3);
-
-
-var doRecord = false;
-
-if (process.argv.length > 2)
- doRecord = true;
-
-// if an argument was specified (any argument), go into record mode,
-// else playback a previously recorded sample
-console.log("Supply any argument to the command line to record.");
-console.log("Running this example without arguments will play back ");
-console.log("any previously recorded sound.");
-console.log("There is approximately 10 seconds of recording time.\n");
-
-// depending on what was selected, do it, and sleep for 15 seconds
-if (doRecord)
- myRecorder.record(true);
-else
- myRecorder.play(true);
-
-// There are about 10 seconds of recording/playback time, so we will
-// sleep for a little extra time.
-console.log("Sleeping for 15 seconds...");
-
-setTimeout(function()
-{
- // turn off whatever we were doing.
- if (doRecord)
- myRecorder.record(false);
- else
- myRecorder.play(false);
- console.log("Exiting");
- myRecorder = null;
- recorder_lib.cleanUp();
- recorder_lib = null;
- process.exit(0);
-}, 15 * 1000);
diff --git a/peripheral/libupm/examples/javascript/itg3200.js b/peripheral/libupm/examples/javascript/itg3200.js
deleted file mode 100644
index 4ed6883..0000000
--- a/peripheral/libupm/examples/javascript/itg3200.js
+++ /dev/null
@@ -1,64 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*global */
-/*
-* Author: Sarah Knepper <sarah.knepper@intel.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-// Load gyroscope module
-var itg3200 = require('jsupm_itg3200');
-// load this on i2c
-var gyro = new itg3200.Itg3200(0);
-
-var rot;
-var ang;
-
-// Note: Sensor not supported on Intel Edison with Arduino breakout
-setInterval(function()
-{
- gyro.update(); // Update the data
- rot = gyro.getRawValues(); // Read raw sensor data
- ang = gyro.getRotation(); // Read rotational speed (deg/sec)
- var rots = (rot.getitem(0) + " ");
- rots += (rot.getitem(1) + " ");
- rots += rot.getitem(2);
- var temp = round2Digits(gyro.getTemperature());
- var raw = round2Digits(gyro.getRawTemp());
- console.log("Raw: " + rots);
- console.log("AngX: " + round2Digits(ang.getitem(0)));
- console.log("AngY: " + round2Digits(ang.getitem(1)));
- console.log("AngZ: " + round2Digits(ang.getitem(2)));
- console.log("Temp: " + temp + " Raw: " + raw);
-}, 1000);
-
-function round2Digits(num)
-{
- return Math.round((num + 0.00001) * 100) / 100;
-}
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/jhd1313m1-lcd.js b/peripheral/libupm/examples/javascript/jhd1313m1-lcd.js
deleted file mode 100644
index 5699aac..0000000
--- a/peripheral/libupm/examples/javascript/jhd1313m1-lcd.js
+++ /dev/null
@@ -1,41 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*global */
-/*
- * Author: Zion Orent <zorent@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-// Load lcd module on I2C
-var LCD = require('jsupm_i2clcd');
-
-// Initialize Jhd1313m1 at 0x62 (RGB_ADDRESS) and 0x3E (LCD_ADDRESS)
-var myLcd = new LCD.Jhd1313m1 (0, 0x3E, 0x62);
-
-myLcd.setCursor(0,0);
-// RGB Blue
-//myLcd.setColor(53, 39, 249);
-// RGB Red
-myLcd.setColor(255, 0, 0);
-myLcd.write('Hello World');
-myLcd.setCursor(1,2);
-myLcd.write('Hello World');
diff --git a/peripheral/libupm/examples/javascript/joystick12.js b/peripheral/libupm/examples/javascript/joystick12.js
deleted file mode 100644
index 82d73b2..0000000
--- a/peripheral/libupm/examples/javascript/joystick12.js
+++ /dev/null
@@ -1,54 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*global */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2014 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var joystick = require('jsupm_joystick12');
-
-// Instantiate a joystick on analog pins A0 and A1
-var myJoystick = new joystick.Joystick12(0, 1);
-
-// Print the X and Y input values every second
-setInterval(function()
-{
- var XString = "Driving X:" + roundNum(myJoystick.getXInput(), 6);
- var YString = ": and Y:" + roundNum(myJoystick.getYInput(), 6);
- console.log(XString + YString);
-}, 1000);
-
-function roundNum(num, decimalPlaces)
-{
- var extraNum = (1 / (Math.pow(10, decimalPlaces) * 1000));
- var numerator = Math.round((num + extraNum) * (Math.pow(10, decimalPlaces)));
- var denominator = Math.pow(10, decimalPlaces);
- return (numerator / denominator);
-}
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/l298-stepper.js b/peripheral/libupm/examples/javascript/l298-stepper.js
deleted file mode 100644
index ef2bbce..0000000
--- a/peripheral/libupm/examples/javascript/l298-stepper.js
+++ /dev/null
@@ -1,77 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var HBridge_lib = require('jsupm_l298');
-
-// Instantiate a Stepper motor on a L298 Dual H-Bridge.
-// This was tested with the NEMA-17 12V, 350mA, with 200 steps per rev.
-var myHBridge_obj = new HBridge_lib.L298(200, 3, 4, 7, 8, 9);
-
-/**************************************
- * Instantiate H-bridge stepper object
-***************************************/
-myHBridge_obj.goForward = function()
-{
- myHBridge_obj.setSpeed(10); // 10 RPMs
- myHBridge_obj.setDirection(HBridge_lib.L298.DIR_CW);
- myHBridge_obj.enable(true);
- console.log("Rotating 1 full revolution at 10 RPM speed.");
- // move 200 steps, a full rev
- myHBridge_obj.stepperSteps(200);
-};
-
-myHBridge_obj.reverseDirection = function()
-{
- console.log("Rotating 1/2 revolution in opposite direction at 10 RPM speed.");
- myHBridge_obj.setDirection(HBridge_lib.L298.DIR_CCW);
- myHBridge_obj.stepperSteps(100);
-};
-
-myHBridge_obj.stop = function()
-{
- myHBridge_obj.enable(false);
-};
-
-myHBridge_obj.quit = function()
-{
- myHBridge_obj = null;
- HBridge_lib.cleanUp();
- HBridge_lib = null;
- console.log("Exiting");
- process.exit(0);
-};
-
-
-/************************
- * Run H-bridge stepper!
-*************************/
-myHBridge_obj.goForward();
-setTimeout(myHBridge_obj.reverseDirection, 2000);
-setTimeout(function()
-{
- myHBridge_obj.stop();
- myHBridge_obj.quit();
-}, 4000);
diff --git a/peripheral/libupm/examples/javascript/l298.js b/peripheral/libupm/examples/javascript/l298.js
deleted file mode 100644
index 8d972cb..0000000
--- a/peripheral/libupm/examples/javascript/l298.js
+++ /dev/null
@@ -1,77 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var HBridge_lib = require('jsupm_l298');
-
-// Instantiate one of the 2 possible DC motors on a L298 Dual
-// H-Bridge. For controlling a stepper motor, see the l298-stepper
-// example.
-var myHBridge_obj = new HBridge_lib.L298(3, 4, 7);
-
-/*****************************
- * Instantiate H-bridge object
-******************************/
-myHBridge_obj.goForward = function()
-{
- console.log("Starting motor at 50% for 3 seconds...");
- myHBridge_obj.setSpeed(50);
- myHBridge_obj.setDirection(HBridge_lib.L298.DIR_CW);
- myHBridge_obj.enable(true);
-};
-
-myHBridge_obj.reverseDirection = function()
-{
- console.log("Reversing direction...");
- myHBridge_obj.setDirection(HBridge_lib.L298.DIR_NONE); // fast stop
- myHBridge_obj.setDirection(HBridge_lib.L298.DIR_CCW);
-};
-
-myHBridge_obj.stop = function()
-{
- myHBridge_obj.setSpeed(0);
- myHBridge_obj.enable(false);
-};
-
-myHBridge_obj.quit = function()
-{
- myHBridge_obj = null;
- HBridge_lib.cleanUp();
- HBridge_lib = null;
- console.log("Exiting");
- process.exit(0);
-};
-
-
-/************************
- * Run H-bridge!
-*************************/
-myHBridge_obj.goForward();
-setTimeout(myHBridge_obj.reverseDirection, 3000);
-setTimeout(function()
-{
- myHBridge_obj.stop();
- myHBridge_obj.quit();
-}, 6000);
diff --git a/peripheral/libupm/examples/javascript/ldt0028.js b/peripheral/libupm/examples/javascript/ldt0028.js
deleted file mode 100644
index e57dbc6..0000000
--- a/peripheral/libupm/examples/javascript/ldt0028.js
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Author: Sarah Knepper <sarah.knepper@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-// Load Grove module
-var sensorModule = require('jsupm_ldt0028');
-
-var NUMBER_OF_SECONDS = 10;
-var MILLISECONDS_PER_SECOND = 1000;
-var SAMPLES_PER_SECOND = 50;
-var THRESHOLD = 100;
-
-// Create the LDT0-028 Piezo Vibration Sensor object using AIO pin 0
-var sensor = new sensorModule.LDT0028(0);
-
-// Read the signal every 20 milliseconds for 10 seconds
-console.log("For the next " + NUMBER_OF_SECONDS + " seconds, " +
- SAMPLES_PER_SECOND + " samples will be taken every second.");
-console.log("");
-var buffer = [];
-for (var i=0; i < NUMBER_OF_SECONDS * SAMPLES_PER_SECOND; i++) {
- buffer.push(sensor.getSample());
- delay(MILLISECONDS_PER_SECOND / SAMPLES_PER_SECOND );
-}
-
-// Print the number of times the reading was greater than the threshold
-var count = 0;
-for (var i=0; i < NUMBER_OF_SECONDS * SAMPLES_PER_SECOND; i++) {
- if (buffer[i] > THRESHOLD) {
- count++;
- }
-}
-console.log(sensor.name() + " exceeded the threshold value of " +
- THRESHOLD + " a total of " + count + " times,");
-console.log("out of a total of " + NUMBER_OF_SECONDS*SAMPLES_PER_SECOND +
- " readings.");
-console.log("");
-
-// Print a graphical representation of the average value sampled
-// each second for the past 10 seconds, using a scale factor of 15
-console.log("Now printing a graphical representation of the average reading ");
-console.log("each second for the last " + NUMBER_OF_SECONDS + " seconds.");
-var SCALE_FACTOR = 15;
-for (var i=0; i < NUMBER_OF_SECONDS; i++) {
- var sum = 0;
- for (var j=0; j < SAMPLES_PER_SECOND; j++) {
- sum += buffer[i*SAMPLES_PER_SECOND+j];
- }
- var average = sum / SAMPLES_PER_SECOND;
- var stars_to_print = Math.round(average / SCALE_FACTOR);
- var string = "(" + (" " + Math.round(average)).slice(-4) + ") | ";
- for (var j=0; j < stars_to_print; j++) {
- string += "*";
- }
- console.log(string);
-}
-
-function delay( milliseconds ) {
- var startTime = Date.now();
- while (Date.now() - startTime < milliseconds);
-}
-
diff --git a/peripheral/libupm/examples/javascript/lm35.js b/peripheral/libupm/examples/javascript/lm35.js
deleted file mode 100644
index 86f029e..0000000
--- a/peripheral/libupm/examples/javascript/lm35.js
+++ /dev/null
@@ -1,51 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-var sensorObj = require('jsupm_lm35');
-
-// Instantiate a LM35 on analog pin A0, with a default analog
-// reference voltage of 5.0
-var sensor = new sensorObj.LM35(0);
-
-// Every half second, sample the sensor and output the temperature
-
-setInterval(function()
-{
- console.log("Temperature: " + sensor.getTemperature() + " C");
-}, 500);
-
-// exit on ^C
-process.on('SIGINT', function()
-{
- sensor = null;
- sensorObj.cleanUp();
- sensorObj = null;
- console.log("Exiting.");
- process.exit(0);
-});
-
diff --git a/peripheral/libupm/examples/javascript/loudness.js b/peripheral/libupm/examples/javascript/loudness.js
deleted file mode 100644
index 94485a3..0000000
--- a/peripheral/libupm/examples/javascript/loudness.js
+++ /dev/null
@@ -1,52 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-var sensorObj = require('jsupm_loudness');
-
-// Instantiate a Loudness sensor on analog pin A0, with an analog
-// reference voltage of 5.0
-var sensor = new sensorObj.Loudness(0, 5.0);
-
-// Every tenth of a second, sample the loudness and output it's
-// corresponding analog voltage.
-
-setInterval(function()
-{
- console.log("Detected loudness (volts): " + sensor.loudness());
-}, 100);
-
-// exit on ^C
-process.on('SIGINT', function()
-{
- sensor = null;
- sensorObj.cleanUp();
- sensorObj = null;
- console.log("Exiting.");
- process.exit(0);
-});
-
diff --git a/peripheral/libupm/examples/javascript/lsm303.js b/peripheral/libupm/examples/javascript/lsm303.js
deleted file mode 100644
index 376b7b4..0000000
--- a/peripheral/libupm/examples/javascript/lsm303.js
+++ /dev/null
@@ -1,78 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2014 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var accelrCompassSensor = require('jsupm_lsm303');
-
-// Instantiate LSM303 compass on I2C
-var myAccelrCompass = new accelrCompassSensor.LSM303(0);
-
-var successFail, coords, outputStr, accel;
-var myInterval = setInterval(function()
-{
- // Load coordinates into LSM303 object
- successFail = myAccelrCompass.getCoordinates();
- // in XYZ order. The sensor returns XZY,
- // but the driver compensates and makes it XYZ
- coords = myAccelrCompass.getRawCoorData();
-
- // Print out the X, Y, and Z coordinate data using two different methods
- outputStr = "coor: rX " + coords.getitem(0)
- + " - rY " + coords.getitem(1)
- + " - rZ " + coords.getitem(2);
- console.log(outputStr);
- outputStr = "coor: gX " + myAccelrCompass.getCoorX()
- + " - gY " + myAccelrCompass.getCoorY()
- + " - gZ " + myAccelrCompass.getCoorZ();
- console.log(outputStr);
-
- // Get and print out the heading
- console.log("heading: " + myAccelrCompass.getHeading());
-
- // Get the acceleration
- myAccelrCompass.getAcceleration();
- accel = myAccelrCompass.getRawAccelData();
- // Print out the X, Y, and Z acceleration data using two different methods
- outputStr = "acc: rX " + accel.getitem(0)
- + " - rY " + accel.getitem(1)
- + " - Z " + accel.getitem(2);
- console.log(outputStr);
- outputStr = "acc: gX " + myAccelrCompass.getAccelX()
- + " - gY " + myAccelrCompass.getAccelY()
- + " - gZ " + myAccelrCompass.getAccelZ();
- console.log(outputStr);
- console.log(" ");
-}, 1000);
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- clearInterval(myInterval);
- myAccelrCompass = null;
- accelrCompassSensor.cleanUp();
- accelrCompassSensor = null;
- console.log("Exiting");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/lsm9ds0.js b/peripheral/libupm/examples/javascript/lsm9ds0.js
deleted file mode 100644
index a984457..0000000
--- a/peripheral/libupm/examples/javascript/lsm9ds0.js
+++ /dev/null
@@ -1,77 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-var sensorObj = require('jsupm_lsm9ds0');
-
-// Instantiate an LSM9DS0 using default parameters (bus 1, gyro addr 6b,
-// xm addr 1d)
-var sensor = new sensorObj.LSM9DS0();
-
-// Initialize the device with default values
-sensor.init();
-
-var x = new sensorObj.new_floatp();
-var y = new sensorObj.new_floatp();
-var z = new sensorObj.new_floatp();
-
-// Output data every half second until interrupted
-setInterval(function()
-{
- sensor.update();
-
- sensor.getAccelerometer(x, y, z);
- console.log("Accelerometer: AX: " + sensorObj.floatp_value(x) +
- " AY: " + sensorObj.floatp_value(y) +
- " AZ: " + sensorObj.floatp_value(z));
-
- sensor.getGyroscope(x, y, z);
- console.log("Gyroscope: GX: " + sensorObj.floatp_value(x) +
- " AY: " + sensorObj.floatp_value(y) +
- " AZ: " + sensorObj.floatp_value(z));
-
- sensor.getMagnetometer(x, y, z);
- console.log("Magnetometer: MX: " + sensorObj.floatp_value(x) +
- " MY: " + sensorObj.floatp_value(y) +
- " MZ: " + sensorObj.floatp_value(z));
-
- console.log("Temperature: " + sensor.getTemperature());
-
- console.log();
-
-}, 500);
-
-// exit on ^C
-process.on('SIGINT', function()
-{
- sensor = null;
- sensorObj.cleanUp();
- sensorObj = null;
- console.log("Exiting.");
- process.exit(0);
-});
-
diff --git a/peripheral/libupm/examples/javascript/m24lr64e.js b/peripheral/libupm/examples/javascript/m24lr64e.js
deleted file mode 100644
index b022efd..0000000
--- a/peripheral/libupm/examples/javascript/m24lr64e.js
+++ /dev/null
@@ -1,59 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-var nfcTagObj = require('jsupm_m24lr64e');
-
-// Instantiate a M24LR64E Grove NFC Tag Module on UART 0
-var nfcTag = new nfcTagObj.M24LR64E(nfcTagObj.M24LR64E_I2C_BUS);
-
-// This example accesses the device in the 'user' (default) mode,
-// reads the last byte of data in the EEPROM, inverts it, writes
-// it back, and then re-reads it.
-
-// Read the last byte of the EEPROM area
-var addr = (nfcTagObj.M24LR64E.EEPROM_I2C_LENGTH - 1);
-console.log("Address: " + addr);
-var byte = nfcTag.readByte(addr);
-
-console.log("Read byte: " + byte.toString(16));
-
-// Now change it to it's opposite and write it
-byte = (~byte & 0xff);
-nfcTag.writeByte(addr, byte);
-console.log("Wrote inverted byte: " + byte.toString(16));
-
-// Now read it back.
-byte = nfcTag.readByte(addr);
-console.log("Read byte: " + byte.toString(16));
-
-// clean up
-nfcTag = null;
-nfcTagObj.cleanUp();
-nfcTagObj = null;
-console.log("Exiting...");
-process.exit(0);
diff --git a/peripheral/libupm/examples/javascript/maxsonarez.js b/peripheral/libupm/examples/javascript/maxsonarez.js
deleted file mode 100644
index 3393b48..0000000
--- a/peripheral/libupm/examples/javascript/maxsonarez.js
+++ /dev/null
@@ -1,59 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Jon Trulson <jtrulson@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-// JavaScript example for the MaxSonar-EZ family of ultrasonic range finders
-
-// analog voltage, usually 3.3 or 5.0
-var MAXSONAREZ_AREF = 5.0;
-
-var MaxSonarEZ = require('jsupm_maxsonarez');
-
-// Instantiate a MaxSonar-EZ on analog pin A1, with an analog
-// reference voltage of MAXSONAREZ_AREF
-var mySonar = new MaxSonarEZ.MAXSONAREZ(1, MAXSONAREZ_AREF);
-
-// Every second, sample the sonar and output the distance to an
-// object in inches.
-
-// With the EZ3 version, the minimum and maximum ranges seemed to be
-// between 6 and 33 inches
-
-var myInterval = setInterval(function()
-{
- console.log("AREF: " + MAXSONAREZ_AREF +
- ", distance in inches: " + mySonar.inches());
-}, 1000);
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- clearInterval(myInterval);
- mySonar = null;
- MaxSonarEZ.cleanUp();
- MaxSonarEZ = null;
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/mcp9808.js b/peripheral/libupm/examples/javascript/mcp9808.js
deleted file mode 100644
index eca142a..0000000
--- a/peripheral/libupm/examples/javascript/mcp9808.js
+++ /dev/null
@@ -1,70 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-// Leave the above lines for propper jshinting
-//Type Node.js Here :)
-/*
-* The MIT License
-*
-* Author: Marc Graham <marc@m2ag.net>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var mcp = require('jsupm_mcp9808');
-
-var temp = new mcp.MCP9808(6);
-
-console.log(temp.getTemp());
-
-//Sleep mode:
-temp.shutDown();
-//wake up
-temp.shutDown(false);
-//set mode to report fahrenheit
-temp.setMode(false);
-//check reporting mode
-console.log(temp.isCelsius()) //False = fahrenheit
-//set mode to celsius
-temp.setMode();
-//read temp
-temp.getTemp();
-//check Tcrit, Tupper or Tlower status bits
-temp.isTcrit(); // true if over boundry.
-temp.isTupper();
-temp.isTlower();
-//set the values of monitior registers
-temp.setMonitorReg(mcp.MCP9808.CRIT_TEMP, 23);
-temp.setMonitorReg(mcp.MCP9808.LOWER_TEMP, 20);
-temp.setMonitorReg(mcp.MCP9808.UPPER_TEMP, 22);
-//read MonitorReg
-console.log("Tcrit = " + temp.getMonitorReg(mcp.MCP9808.CRIT_TEMP));
-console.log("Tcrit = " + temp.getMonitorReg(mcp.MCP9808.LOWER_TEMP));
-console.log("Tcrit = " + temp.getMonitorReg(mcp.MCP9808.UPPER_TEMP));
-
-
-process.exit(0);
-
-
-
-
-
-
- \ No newline at end of file
diff --git a/peripheral/libupm/examples/javascript/mg811.js b/peripheral/libupm/examples/javascript/mg811.js
deleted file mode 100644
index 21e63a8..0000000
--- a/peripheral/libupm/examples/javascript/mg811.js
+++ /dev/null
@@ -1,53 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-var sensorObj = require('jsupm_mg811');
-
-// Instantiate an MG811 on analog pin A0, and digital pin D2 with an
-// analog reference voltage of MG811_AREF (5.0)
-
-var sensor = new sensorObj.MG811(0, 2, 5.0);
-
-// Every tenth of a second, sample the sensor and output it's
-// detected CO2 concentration in parts per million (ppm)
-
-setInterval(function()
-{
- console.log("CO2 concentration in PPM: " + sensor.ppm());
-}, 100);
-
-// exit on ^C
-process.on('SIGINT', function()
-{
- sensor = null;
- sensorObj.cleanUp();
- sensorObj = null;
- console.log("Exiting.");
- process.exit(0);
-});
-
diff --git a/peripheral/libupm/examples/javascript/mhz16.js b/peripheral/libupm/examples/javascript/mhz16.js
deleted file mode 100644
index 71ded00..0000000
--- a/peripheral/libupm/examples/javascript/mhz16.js
+++ /dev/null
@@ -1,78 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var CO2_lib = require('jsupm_mhz16');
-
-// Instantiate a MHZ16 serial CO2 sensor on uart 0.
-// This example was tested on the Grove CO2 sensor module.
-var myCO2_obj = new CO2_lib.MHZ16(0);
-
-// make sure port is initialized properly. 9600 baud is the default.
-if (!myCO2_obj.setupTty(CO2_lib.int_B9600))
-{
- console.log("Failed to setup tty port parameters");
- process.exit(0);
-}
-
-outputStr = "Make sure that the sensor has had " +
- "at least 3 minutes to warm up";
-console.log(outputStr);
-outputStr = "or you will not get valid results.";
-console.log(outputStr);
-outputStr = "The temperature reported is not the ambient temperature,";
-console.log(outputStr);
-outputStr = "but rather the temperature of the sensor elements.";
-console.log(outputStr);
-
-function writeCO2data()
-{
- if (!myCO2_obj.getData())
- console.log("Failed to retrieve data");
- else
- {
- outputStr = "CO2 concentration: " + myCO2_obj.getGas() +
- " PPM, " +
- "Temperature (in C): " + myCO2_obj.getTemperature();
- console.log(outputStr);
- }
-}
-var myInterval;
-setTimeout(function()
-{
- myInterval = setInterval(writeCO2data, 2000);
-}, 1000);
-
-
-// Print message, clear memory when exiting
-process.on('SIGINT', function()
-{
- clearInterval(myInterval);
- myCO2_obj = null;
- CO2_lib.cleanUp();
- CO2_lib = null;
- console.log("Exiting");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/mic.js b/peripheral/libupm/examples/javascript/mic.js
deleted file mode 100644
index f77e2cf..0000000
--- a/peripheral/libupm/examples/javascript/mic.js
+++ /dev/null
@@ -1,61 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*global */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2014 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var upmMicrophone = require("jsupm_mic");
-
-// Attach microphone to analog port A0
-var myMic = new upmMicrophone.Microphone(0);
-
-var threshContext = new upmMicrophone.thresholdContext;
-threshContext.averageReading = 0;
-threshContext.runningAverage = 0;
-threshContext.averagedOver = 2;
-
-var is_running = false;
-// Infinite loop, ends when script is cancelled
-// Repeatedly, take a sample every 2 microseconds;
-// find the average of 128 samples; and
-// print a running graph of the averages
-while(1)
-{
- var buffer = new upmMicrophone.uint16Array(128);
- var len = myMic.getSampledWindow(2, 128, buffer);
- if (len)
- {
- var thresh = myMic.findThreshold(threshContext, 30, buffer, len);
- myMic.printGraph(threshContext);
- if (thresh)
- console.log("Threshold is " + thresh);
- }
-}
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/micsv89.js b/peripheral/libupm/examples/javascript/micsv89.js
deleted file mode 100644
index ff69c56..0000000
--- a/peripheral/libupm/examples/javascript/micsv89.js
+++ /dev/null
@@ -1,26 +0,0 @@
-// Drive the Grive RGB LCD (a JHD1313m1)
-//
-// The way to drive the LCD directly from
-// Javascript code using the i2c interface directly
-// This approach is useful for learning about using
-// the i2c bus. The i2c file is an implementation
-// in Javascript for some of the common LCD functions
-
-// configure jshint
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-var upmMICSV89 = require("jsupm_micsv89");
-
-var mics = new upmMICSV89.MICSV89(6);
-
-while(1)
-{
- mics.update();
- while(!mics.valid());
- console.log("co2: " + mics.co2equ());
- console.log("short: " + mics.vocshort());
- console.log("tvoc: " + mics.tvoc());
- console.log("resistor: " + mics.resistor());
- console.log("***********************");
-}
diff --git a/peripheral/libupm/examples/javascript/mma7660.js b/peripheral/libupm/examples/javascript/mma7660.js
deleted file mode 100644
index 32b419f..0000000
--- a/peripheral/libupm/examples/javascript/mma7660.js
+++ /dev/null
@@ -1,98 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var digitalAccelerometer = require('jsupm_mma7660');
-
-// Instantiate an MMA7660 on I2C bus 0
-var myDigitalAccelerometer = new digitalAccelerometer.MMA7660(
- digitalAccelerometer.MMA7660_I2C_BUS,
- digitalAccelerometer.MMA7660_DEFAULT_I2C_ADDR);
-
-// place device in standby mode so we can write registers
-myDigitalAccelerometer.setModeStandby();
-
-// enable 64 samples per second
-myDigitalAccelerometer.setSampleRate(digitalAccelerometer.MMA7660.AUTOSLEEP_64);
-
-// place device into active mode
-myDigitalAccelerometer.setModeActive();
-
-var x, y, z;
-x = digitalAccelerometer.new_intp();
-y = digitalAccelerometer.new_intp();
-z = digitalAccelerometer.new_intp();
-
-var ax, ay, az;
-ax = digitalAccelerometer.new_floatp();
-ay = digitalAccelerometer.new_floatp();
-az = digitalAccelerometer.new_floatp();
-
-var outputStr;
-
-var myInterval = setInterval(function()
-{
- myDigitalAccelerometer.getRawValues(x, y, z);
- outputStr = "Raw values: x = " + digitalAccelerometer.intp_value(x) +
- " y = " + digitalAccelerometer.intp_value(y) +
- " z = " + digitalAccelerometer.intp_value(z);
- console.log(outputStr);
-
- myDigitalAccelerometer.getAcceleration(ax, ay, az);
- outputStr = "Acceleration: x = "
- + roundNum(digitalAccelerometer.floatp_value(ax), 6)
- + "g y = " + roundNum(digitalAccelerometer.floatp_value(ay), 6)
- + "g z = " + roundNum(digitalAccelerometer.floatp_value(az), 6) + "g";
- console.log(outputStr);
-}, 500);
-
-// round off output to match C example, which has 6 decimal places
-function roundNum(num, decimalPlaces)
-{
- var extraNum = (1 / (Math.pow(10, decimalPlaces) * 1000));
- return (Math.round((num + extraNum)
- * (Math.pow(10, decimalPlaces))) / Math.pow(10, decimalPlaces));
-}
-
-// When exiting: clear interval and print message
-process.on('SIGINT', function()
-{
- clearInterval(myInterval);
-
- // clean up memory
- digitalAccelerometer.delete_intp(x);
- digitalAccelerometer.delete_intp(y);
- digitalAccelerometer.delete_intp(z);
-
- digitalAccelerometer.delete_floatp(ax);
- digitalAccelerometer.delete_floatp(ay);
- digitalAccelerometer.delete_floatp(az);
-
- myDigitalAccelerometer.setModeStandby();
-
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/mpr121.js b/peripheral/libupm/examples/javascript/mpr121.js
deleted file mode 100644
index a619f41..0000000
--- a/peripheral/libupm/examples/javascript/mpr121.js
+++ /dev/null
@@ -1,69 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*global */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2014 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var touchSensor = require('jsupm_mpr121');
-
-var myTouchSensor = new touchSensor.MPR121(touchSensor.MPR121_I2C_BUS, touchSensor.MPR121_DEFAULT_I2C_ADDR);
-
-myTouchSensor.configAN3944();
-
-setInterval(function()
-{
- myTouchSensor.readButtons();
- printButtons(myTouchSensor);
-}, 1000);
-
-function printButtons(touchSensor)
-{
- var buttonPressed = false;
-
- var outputStr = "Buttons Pressed: ";
- for (var i=0; i<12; i++)
- {
- if (touchSensor.m_buttonStates & (1 << i))
- {
- outputStr += (i + " ");
- buttonPressed = true;
- }
- }
-
- if (!buttonPressed)
- outputStr += "None";
-
- console.log(outputStr);
-
- if (touchSensor.m_overCurrentFault)
- console.log("Over Current Fault detected!");
-}
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- console.log("Exiting...");
- process.exit(0);
-});
-
diff --git a/peripheral/libupm/examples/javascript/mpu60x0.js b/peripheral/libupm/examples/javascript/mpu60x0.js
deleted file mode 100644
index 46354b1..0000000
--- a/peripheral/libupm/examples/javascript/mpu60x0.js
+++ /dev/null
@@ -1,71 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-var sensorObj = require('jsupm_mpu9150');
-
-// Instantiate an MPU60X0 on default I2C bus and address
-var sensor = new sensorObj.MPU60X0();
-
-// Initialize the device with default values
-sensor.init();
-
-var x = new sensorObj.new_floatp();
-var y = new sensorObj.new_floatp();
-var z = new sensorObj.new_floatp();
-
-// Output data every half second until interrupted
-setInterval(function()
-{
- sensor.update();
-
- sensor.getAccelerometer(x, y, z);
- console.log("Accelerometer: AX: " + sensorObj.floatp_value(x) +
- " AY: " + sensorObj.floatp_value(y) +
- " AZ: " + sensorObj.floatp_value(z));
-
- sensor.getGyroscope(x, y, z);
- console.log("Gyroscope: GX: " + sensorObj.floatp_value(x) +
- " AY: " + sensorObj.floatp_value(y) +
- " AZ: " + sensorObj.floatp_value(z));
-
- console.log("Temperature: " + sensor.getTemperature());
-
- console.log();
-
-}, 500);
-
-// exit on ^C
-process.on('SIGINT', function()
-{
- sensor = null;
- sensorObj.cleanUp();
- sensorObj = null;
- console.log("Exiting.");
- process.exit(0);
-});
-
diff --git a/peripheral/libupm/examples/javascript/mpu9150.js b/peripheral/libupm/examples/javascript/mpu9150.js
deleted file mode 100644
index 6b3b4d4..0000000
--- a/peripheral/libupm/examples/javascript/mpu9150.js
+++ /dev/null
@@ -1,76 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-var sensorObj = require('jsupm_mpu9150');
-
-// Instantiate an MPU9105 on default I2C bus and address
-var sensor = new sensorObj.MPU9150();
-
-// Initialize the device with default values
-sensor.init();
-
-var x = new sensorObj.new_floatp();
-var y = new sensorObj.new_floatp();
-var z = new sensorObj.new_floatp();
-
-// Output data every half second until interrupted
-setInterval(function()
-{
- sensor.update();
-
- sensor.getAccelerometer(x, y, z);
- console.log("Accelerometer: AX: " + sensorObj.floatp_value(x) +
- " AY: " + sensorObj.floatp_value(y) +
- " AZ: " + sensorObj.floatp_value(z));
-
- sensor.getGyroscope(x, y, z);
- console.log("Gyroscope: GX: " + sensorObj.floatp_value(x) +
- " AY: " + sensorObj.floatp_value(y) +
- " AZ: " + sensorObj.floatp_value(z));
-
- sensor.getMagnetometer(x, y, z);
- console.log("Magnetometer: MX: " + sensorObj.floatp_value(x) +
- " MY: " + sensorObj.floatp_value(y) +
- " MZ: " + sensorObj.floatp_value(z));
-
- console.log("Temperature: " + sensor.getTemperature());
-
- console.log();
-
-}, 500);
-
-// exit on ^C
-process.on('SIGINT', function()
-{
- sensor = null;
- sensorObj.cleanUp();
- sensorObj = null;
- console.log("Exiting.");
- process.exit(0);
-});
-
diff --git a/peripheral/libupm/examples/javascript/mpu9250.js b/peripheral/libupm/examples/javascript/mpu9250.js
deleted file mode 100644
index b188012..0000000
--- a/peripheral/libupm/examples/javascript/mpu9250.js
+++ /dev/null
@@ -1,76 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-var sensorObj = require('jsupm_mpu9150');
-
-// Instantiate an MPU9105 on default I2C bus and address
-var sensor = new sensorObj.MPU9250();
-
-// Initialize the device with default values
-sensor.init();
-
-var x = new sensorObj.new_floatp();
-var y = new sensorObj.new_floatp();
-var z = new sensorObj.new_floatp();
-
-// Output data every half second until interrupted
-setInterval(function()
-{
- sensor.update();
-
- sensor.getAccelerometer(x, y, z);
- console.log("Accelerometer: AX: " + sensorObj.floatp_value(x) +
- " AY: " + sensorObj.floatp_value(y) +
- " AZ: " + sensorObj.floatp_value(z));
-
- sensor.getGyroscope(x, y, z);
- console.log("Gyroscope: GX: " + sensorObj.floatp_value(x) +
- " AY: " + sensorObj.floatp_value(y) +
- " AZ: " + sensorObj.floatp_value(z));
-
- sensor.getMagnetometer(x, y, z);
- console.log("Magnetometer: MX: " + sensorObj.floatp_value(x) +
- " MY: " + sensorObj.floatp_value(y) +
- " MZ: " + sensorObj.floatp_value(z));
-
- console.log("Temperature: " + sensor.getTemperature());
-
- console.log();
-
-}, 500);
-
-// exit on ^C
-process.on('SIGINT', function()
-{
- sensor = null;
- sensorObj.cleanUp();
- sensorObj = null;
- console.log("Exiting.");
- process.exit(0);
-});
-
diff --git a/peripheral/libupm/examples/javascript/mq2.js b/peripheral/libupm/examples/javascript/mq2.js
deleted file mode 100644
index 6e91692..0000000
--- a/peripheral/libupm/examples/javascript/mq2.js
+++ /dev/null
@@ -1,59 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var upmMQ2 = require("jsupm_gas");
-
-// Attach gas sensor to AIO0
-var myMQ2 = new upmMQ2.MQ2(0);
-
-var threshContext = new upmMQ2.thresholdContext;
-threshContext.averageReading = 0;
-threshContext.runningAverage = 0;
-threshContext.averagedOver = 2;
-
-// Infinite loop, ends when script is cancelled
-// Repeatedly, take a sample every 2 milliseconds;
-// find the average of 128 samples; and
-// print a running graph of the averages using a resolution of 5
-while(1)
-{
- var buffer = new upmMQ2.uint16Array(128);
- var len = myMQ2.getSampledWindow(2, 128, buffer);
- if (len)
- {
- var thresh = myMQ2.findThreshold(threshContext, 30, buffer, len);
- myMQ2.printGraph(threshContext, 5);
- //if (thresh)
- // console.log("Threshold is " + thresh);
- }
-}
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/mq3.js b/peripheral/libupm/examples/javascript/mq3.js
deleted file mode 100644
index 607d422..0000000
--- a/peripheral/libupm/examples/javascript/mq3.js
+++ /dev/null
@@ -1,60 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*global */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var upmMQ3 = require("jsupm_gas");
-
-// Attach gas sensor to AIO0
-var myMQ3 = new upmMQ3.MQ3(0);
-
-var threshContext = new upmMQ3.thresholdContext;
-threshContext.averageReading = 0;
-threshContext.runningAverage = 0;
-threshContext.averagedOver = 2;
-
-// Infinite loop, ends when script is cancelled
-// Repeatedly, take a sample every 2 milliseconds;
-// find the average of 128 samples; and
-// print a running graph of the averages using a resolution of 5
-while(1)
-{
- var buffer = new upmMQ3.uint16Array(128);
- var len = myMQ3.getSampledWindow(2, 128, buffer);
- if (len)
- {
- var thresh = myMQ3.findThreshold(threshContext, 30, buffer, len);
- myMQ3.printGraph(threshContext, 5);
- //if (thresh)
- // console.log("Threshold is " + thresh);
- }
-}
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/mq303a.js b/peripheral/libupm/examples/javascript/mq303a.js
deleted file mode 100644
index 8cce09c..0000000
--- a/peripheral/libupm/examples/javascript/mq303a.js
+++ /dev/null
@@ -1,78 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*global */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2014 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-// Load alcohol sensor module
-var mq303a = require('jsupm_mq303a');
-
-// Instantiate an mq303a sensor on analog pin A0
-// This device uses a heater powered from an analog I/O pin.
-// If using A0 as the data pin, then you need to use A1, as the heater
-// pin (if using a grove mq303a). For A1, we can use the D15 gpio,
-// setup as an output, and drive it low to power the heater.
-var myAlcoholObj = new mq303a.MQ303A(0, 15);
-
-console.log("Enabling heater and waiting 2 minutes for warmup.");
-
-// give time updates every 30 seconds until 2 minutes have passed
-// for the alcohol sensor to warm up
-statusMessage(1);
-statusMessage(2);
-statusMessage(3);
-
-function statusMessage(amt)
-{
- setTimeout(function()
- {
- console.log((amt * 30) + " seconds have passed");
- }, 30000 * amt);
-}
-
-// run the alcohol sensor in 2 minutes
-setTimeout(runAlcoholSensor, 120000);
-
-function runAlcoholSensor()
-{
- var notice = "This sensor may need to warm " +
- "until the value drops below about 450."
- console.log(notice);
-
- // Print the detected alcohol value every second
- setInterval(function()
- {
- var val = myAlcoholObj.value();
- var msg = "Alcohol detected ";
- msg += "(higher means stronger alcohol): ";
- console.log(msg + val);
- }, 1000);
-}
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/mq4.js b/peripheral/libupm/examples/javascript/mq4.js
deleted file mode 100644
index c8d589e..0000000
--- a/peripheral/libupm/examples/javascript/mq4.js
+++ /dev/null
@@ -1,60 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-var upmGAS = require("jsupm_gas");
-
-// Attach gas sensor to Analog A0
-var sensor = new upmGAS.MQ4(0);
-
-var threshContext = new upmGAS.thresholdContext;
-threshContext.averageReading = 0;
-threshContext.runningAverage = 0;
-threshContext.averagedOver = 2;
-
-// Infinite loop, ends when script is cancelled
-// Repeatedly, take a sample every 2 microseconds;
-// find the average of 128 samples; and
-// print a running graph of asteriskss as averages
-
-while(1)
-{
- var buffer = new upmGAS.uint16Array(128);
- var len = sensor.getSampledWindow(2, 128, buffer);
- if (len)
- {
- var thresh = sensor.findThreshold(threshContext, 30, buffer, len);
- sensor.printGraph(threshContext, 5);
- //if (thresh)
- // console.log("Threshold is " + thresh);
- }
-}
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/mq5.js b/peripheral/libupm/examples/javascript/mq5.js
deleted file mode 100644
index db0a4cb..0000000
--- a/peripheral/libupm/examples/javascript/mq5.js
+++ /dev/null
@@ -1,57 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*global */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var upmMQ5 = require("jsupm_gas");
-
-// Attach gas sensor to AIO0
-var myMQ5 = new upmMQ5.MQ5(0);
-
-var threshContext = new upmMQ5.thresholdContext;
-threshContext.averageReading = 0;
-threshContext.runningAverage = 0;
-threshContext.averagedOver = 2;
-
-// Infinite loop, ends when script is cancelled
-while(1)
-{
- var buffer = new upmMQ5.uint16Array(128);
- var len = myMQ5.getSampledWindow(2, 128, buffer);
- if (len)
- {
- var thresh = myMQ5.findThreshold(threshContext, 30, buffer, len);
- myMQ5.printGraph(threshContext, 5);
- //if (thresh)
- // console.log("Threshold is " + thresh);
- }
-}
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/mq6.js b/peripheral/libupm/examples/javascript/mq6.js
deleted file mode 100644
index 03757a6..0000000
--- a/peripheral/libupm/examples/javascript/mq6.js
+++ /dev/null
@@ -1,60 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-var upmGAS = require("jsupm_gas");
-
-// Attach gas sensor to Analog A0
-var sensor = new upmGAS.MQ6(0);
-
-var threshContext = new upmGAS.thresholdContext;
-threshContext.averageReading = 0;
-threshContext.runningAverage = 0;
-threshContext.averagedOver = 2;
-
-// Infinite loop, ends when script is cancelled
-// Repeatedly, take a sample every 2 microseconds;
-// find the average of 128 samples; and
-// print a running graph of asteriskss as averages
-
-while(1)
-{
- var buffer = new upmGAS.uint16Array(128);
- var len = sensor.getSampledWindow(2, 128, buffer);
- if (len)
- {
- var thresh = sensor.findThreshold(threshContext, 30, buffer, len);
- sensor.printGraph(threshContext, 5);
- //if (thresh)
- // console.log("Threshold is " + thresh);
- }
-}
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/mq7.js b/peripheral/libupm/examples/javascript/mq7.js
deleted file mode 100644
index 6d305b1..0000000
--- a/peripheral/libupm/examples/javascript/mq7.js
+++ /dev/null
@@ -1,60 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-var upmGAS = require("jsupm_gas");
-
-// Attach gas sensor to Analog A0
-var sensor = new upmGAS.MQ7(0);
-
-var threshContext = new upmGAS.thresholdContext;
-threshContext.averageReading = 0;
-threshContext.runningAverage = 0;
-threshContext.averagedOver = 2;
-
-// Infinite loop, ends when script is cancelled
-// Repeatedly, take a sample every 2 microseconds;
-// find the average of 128 samples; and
-// print a running graph of asteriskss as averages
-
-while(1)
-{
- var buffer = new upmGAS.uint16Array(128);
- var len = sensor.getSampledWindow(2, 128, buffer);
- if (len)
- {
- var thresh = sensor.findThreshold(threshContext, 30, buffer, len);
- sensor.printGraph(threshContext, 5);
- //if (thresh)
- // console.log("Threshold is " + thresh);
- }
-}
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/mq8.js b/peripheral/libupm/examples/javascript/mq8.js
deleted file mode 100644
index 7b6bf99..0000000
--- a/peripheral/libupm/examples/javascript/mq8.js
+++ /dev/null
@@ -1,60 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-var upmGAS = require("jsupm_gas");
-
-// Attach gas sensor to Analog A0
-var sensor = new upmGAS.MQ8(0);
-
-var threshContext = new upmGAS.thresholdContext;
-threshContext.averageReading = 0;
-threshContext.runningAverage = 0;
-threshContext.averagedOver = 2;
-
-// Infinite loop, ends when script is cancelled
-// Repeatedly, take a sample every 2 microseconds;
-// find the average of 128 samples; and
-// print a running graph of asteriskss as averages
-
-while(1)
-{
- var buffer = new upmGAS.uint16Array(128);
- var len = sensor.getSampledWindow(2, 128, buffer);
- if (len)
- {
- var thresh = sensor.findThreshold(threshContext, 30, buffer, len);
- sensor.printGraph(threshContext, 5);
- //if (thresh)
- // console.log("Threshold is " + thresh);
- }
-}
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/mq9.js b/peripheral/libupm/examples/javascript/mq9.js
deleted file mode 100644
index e89ddcc..0000000
--- a/peripheral/libupm/examples/javascript/mq9.js
+++ /dev/null
@@ -1,56 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var upmMQ9 = require("jsupm_gas");
-
-// Attach gas sensor to AIO0
-var myMQ9 = new upmMQ9.MQ9(0);
-
-var threshContext = new upmMQ9.thresholdContext;
-threshContext.averageReading = 0;
-threshContext.runningAverage = 0;
-threshContext.averagedOver = 2;
-
-// Infinite loop, ends when script is cancelled
-while(1)
-{
- var buffer = new upmMQ9.uint16Array(128);
- var len = myMQ9.getSampledWindow(2, 128, buffer);
- if (len)
- {
- var thresh = myMQ9.findThreshold(threshContext, 30, buffer, len);
- myMQ9.printGraph(threshContext, 5);
- //if (thresh)
- // console.log("Threshold is " + thresh);
- }
-}
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/nlgpio16.js b/peripheral/libupm/examples/javascript/nlgpio16.js
deleted file mode 100644
index 1a7e7c2..0000000
--- a/peripheral/libupm/examples/javascript/nlgpio16.js
+++ /dev/null
@@ -1,51 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-var sensorObj = require('jsupm_nlgpio16');
-
-// Instantiate a NLGPIO16 Module on the default UART (/dev/ttyACM0)
-var sensor = new sensorObj.NLGPIO16();
-
-// get the Version
-console.log("Device Version:", sensor.getVersion());
-// read the gpio at pin 3
-console.log("GPIO 3 Value:", sensor.gpioRead(3));
-// read the analog voltage at pin 5
-console.log("Analog 5 Voltage:", sensor.analogReadVolts(5));
-// set the gpio at pin 14 to HIGH
-sensor.gpioSet(14);
-
-/************** Exit code **************/
-process.on('SIGINT', function()
-{
- sensor = null;
- sensorObj.cleanUp();
- sensorObj = null;
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/nunchuck.js b/peripheral/libupm/examples/javascript/nunchuck.js
deleted file mode 100644
index c35a12a..0000000
--- a/peripheral/libupm/examples/javascript/nunchuck.js
+++ /dev/null
@@ -1,66 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var nunchuck_lib = require('jsupm_nunchuck');
-
-// Instantiate a nunchuck controller bus 0
-var nunchuck_obj = new nunchuck_lib.NUNCHUCK(0);
-
-// always do this first
-console.log("Initializing... ");
-if (!nunchuck_obj.init())
-{
- console.log("nunchuck->init() failed.");
- process.exit(0);
-}
-
-setInterval(function()
-{
- nunchuck_obj.update();
-
- var outputStr = "stickX: " + nunchuck_obj.stickX +
- ", stickY: " + nunchuck_obj.stickY;
- console.log(outputStr);
- outputStr = "accelX: " + nunchuck_obj.accelX +
- ", accelY: " + nunchuck_obj.accelY +
- ", accelZ: " + nunchuck_obj.accelZ;
- console.log(outputStr);
-
- outputStr = "button C: " +
- ((nunchuck_obj.buttonC) ? "pressed" : "not pressed");
- console.log(outputStr);
- outputStr = "button Z: " +
- ((nunchuck_obj.buttonZ) ? "pressed" : "not pressed");
- console.log(outputStr);
-}, 100);
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/oled_ssd1306.js b/peripheral/libupm/examples/javascript/oled_ssd1306.js
deleted file mode 100644
index b3ceac7..0000000
--- a/peripheral/libupm/examples/javascript/oled_ssd1306.js
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Author: Marc Graham <marc@m2ag.net>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-
-var intel_logo = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 192, 192, 192, 224,
-224, 224, 224, 240, 240, 248, 248, 120, 120, 120, 120, 60, 60, 60, 60, 60,
-62, 30, 30, 30, 30, 30, 30, 30, 31, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
-15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 31, 31, 31, 31, 31,
-30, 62, 62, 62, 62, 126, 126, 124, 124, 252, 252, 248, 248, 240, 240, 240,
-224, 224, 224, 192, 128, 128, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 128, 128, 128,
-128, 0, 56, 56, 28, 30, 14, 15, 15, 7, 7, 7, 7, 3, 3, 1, 1, 1, 1, 0, 0, 0,
-0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-192, 192, 192, 192, 192, 192, 192, 192, 0, 0, 0, 0, 192, 193, 195, 195,
-195, 7, 15, 15, 63, 127, 255, 255, 255, 254, 252, 252, 240, 192, 0, 0, 0,
-0, 0, 0, 0, 0, 128, 192, 192, 240, 248, 124, 124, 60, 0, 0, 0, 0, 159, 159,
-159, 159, 159, 159, 159, 159, 0, 0, 0, 0, 128, 128, 128, 128, 128, 128,
-128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 0, 0,
-0, 0, 0, 0, 254, 254, 254, 254, 254, 254, 254, 254, 128, 128, 128, 128,
-128, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 192, 192, 192, 192, 192, 192, 128,
-128, 128, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255,
-0, 0, 0, 0, 3, 7, 3, 3, 3, 0, 0, 0, 0, 0, 1, 1, 255, 255, 255, 255, 255,
-255, 255, 0, 0, 224, 248, 252, 252, 255, 127, 15, 15, 3, 1, 0, 0, 0, 0, 0,
-0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 255,
-255, 255, 255, 255, 255, 15, 15, 15, 15, 15, 15, 255, 255, 255, 255, 255,
-255, 255, 252, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 15, 15,
-15, 15, 15, 224, 224, 252, 254, 255, 255, 255, 255, 159, 159, 143, 143,
-135, 135, 143, 159, 255, 255, 255, 255, 255, 255, 252, 248, 0, 0, 0, 255,
-255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128,
-224, 248, 248, 255, 255, 255, 255, 255, 127, 15, 255, 255, 255, 255, 255,
-255, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255,
-255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0,
-0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 255,
-255, 255, 255, 255, 255, 192, 192, 192, 192, 192, 31, 31, 255, 255, 255,
-255, 255, 255, 231, 231, 199, 199, 199, 199, 199, 199, 199, 199, 231, 231,
-231, 231, 199, 135, 0, 0, 0, 63, 255, 255, 255, 255, 255, 255, 255, 0, 0,
-0, 0, 224, 240, 248, 248, 252, 254, 255, 255, 255, 127, 63, 63, 31, 15, 7,
-7, 1, 0, 0, 63, 63, 255, 255, 255, 255, 255, 240, 192, 192, 128, 0, 0, 0,
-0, 0, 0, 0, 0, 1, 3, 3, 7, 7, 7, 7, 7, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7,
-0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 3, 3, 7, 7, 7,
-7, 7, 7, 7, 7, 7, 0, 0, 0, 1, 3, 3, 3, 7, 7, 7, 7, 15, 15, 15, 15, 7, 7, 7,
-7, 7, 3, 3, 3, 1, 0, 0, 0, 0, 1, 3, 3, 7, 135, 135, 135, 192, 192, 0, 0, 7,
-7, 3, 3, 3, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 7, 15, 15,
-31, 127, 127, 127, 255, 255, 252, 252, 252, 248, 240, 240, 240, 224, 224,
-224, 192, 192, 192, 192, 128, 128, 128, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-0, 0, 0, 0, 0, 128, 128, 128, 128, 128, 128, 128, 192, 192, 192, 192, 192,
-224, 224, 224, 224, 240, 240, 240, 240, 248, 248, 248, 248, 252, 252, 252,
-254, 254, 255, 255, 255, 255, 255, 255, 127, 127, 0, 0, 0, 0, 0, 0, 0, 0,
-0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
-3, 3, 3, 7, 7, 7, 15, 15, 31, 31, 31, 63, 63, 63, 63, 63, 127, 127, 127,
-127, 127, 255, 255, 255, 255, 254, 254, 254, 254, 254, 254, 254, 254, 254,
-254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254,
-255, 255, 255, 255, 255, 255, 255, 127, 127, 127, 127, 127, 127, 127, 127,
-63, 63, 63, 63, 63, 31, 31, 31, 31, 31, 15, 15, 15, 15, 7, 7, 7, 7, 3, 3,
-3, 3, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-0, 0, 0, 0, 0, 0, 0];
-
-function exit()
-{
- lcd = null;
- lcdObj.cleanUp();
- lcdObj = null;
- process.exit(0);
-}
-
-// Load i2clcd module
-var lcdObj = require('jsupm_i2clcd');
-var lcd = new lcdObj.SSD1306(6, 0x3c);
-var next = 0;
-
-lcd.clear();
-lcd.setCursor(2, 0);
-lcd.write("Hello");
-lcd.setCursor(3, 0);
-lcd.write("World!");
-
-setInterval(function(){
- loop();
-},
-3000 );
-
-function loop(){
- switch(next)
- {
- case 0:
- lcd.invert(true)
- break;
- case 1:
- lcd.dim(true);
- break;
- case 2:
- lcd.invert(false);
- break;
- case 3:
- lcd.startscrollright(0x00, 0x0F);
- break;
- case 4:
- lcd.startscrollleft(0x00, 0x0F);
- break;
- case 5:
- lcd.startscrolldiagleft(0x00, 0x0F)
- break;
- case 6:
- lcd.startscrolldiagright(0x00, 0x0F)
- break;
- case 7:
- var logo = new lcdObj.uint8Array(intel_logo.length);
- for(var x = 0 ; x < intel_logo.length ; x++){
- logo.setitem(x, intel_logo[x]);
- }
- lcd.stopscroll();
- lcd.clear();
- lcd.draw(logo, 1024);
- break;
- case 8:
- default:
- lcd.stopscroll();
- lcd.clear();
- lcd.setCursor(2, 0);
- lcd.write("All");
- lcd.setCursor(3, 0);
- lcd.write("Done!");
- exit();
- }
- next++;
-}
diff --git a/peripheral/libupm/examples/javascript/oled_ssd1308.js b/peripheral/libupm/examples/javascript/oled_ssd1308.js
deleted file mode 100644
index 280294b..0000000
--- a/peripheral/libupm/examples/javascript/oled_ssd1308.js
+++ /dev/null
@@ -1,99 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-//Load i2clcd module
-var LCD = require('jsupm_i2clcd');
-
-var myLcd = new LCD.SSD1308 (0, 0x3C);
-
-var logoArr = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 192, 192, 192, 224,
-224, 224, 224, 240, 240, 248, 248, 120, 120, 120, 120, 60, 60, 60, 60, 60,
-62, 30, 30, 30, 30, 30, 30, 30, 31, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
-15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 31, 31, 31, 31, 31,
-30, 62, 62, 62, 62, 126, 126, 124, 124, 252, 252, 248, 248, 240, 240, 240,
-224, 224, 224, 192, 128, 128, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 128, 128, 128,
-128, 0, 56, 56, 28, 30, 14, 15, 15, 7, 7, 7, 7, 3, 3, 1, 1, 1, 1, 0, 0, 0,
-0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-192, 192, 192, 192, 192, 192, 192, 192, 0, 0, 0, 0, 192, 193, 195, 195,
-195, 7, 15, 15, 63, 127, 255, 255, 255, 254, 252, 252, 240, 192, 0, 0, 0,
-0, 0, 0, 0, 0, 128, 192, 192, 240, 248, 124, 124, 60, 0, 0, 0, 0, 159, 159,
-159, 159, 159, 159, 159, 159, 0, 0, 0, 0, 128, 128, 128, 128, 128, 128,
-128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 0, 0,
-0, 0, 0, 0, 254, 254, 254, 254, 254, 254, 254, 254, 128, 128, 128, 128,
-128, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 192, 192, 192, 192, 192, 192, 128,
-128, 128, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255,
-0, 0, 0, 0, 3, 7, 3, 3, 3, 0, 0, 0, 0, 0, 1, 1, 255, 255, 255, 255, 255,
-255, 255, 0, 0, 224, 248, 252, 252, 255, 127, 15, 15, 3, 1, 0, 0, 0, 0, 0,
-0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 255,
-255, 255, 255, 255, 255, 15, 15, 15, 15, 15, 15, 255, 255, 255, 255, 255,
-255, 255, 252, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 15, 15,
-15, 15, 15, 224, 224, 252, 254, 255, 255, 255, 255, 159, 159, 143, 143,
-135, 135, 143, 159, 255, 255, 255, 255, 255, 255, 252, 248, 0, 0, 0, 255,
-255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128,
-224, 248, 248, 255, 255, 255, 255, 255, 127, 15, 255, 255, 255, 255, 255,
-255, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255,
-255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0,
-0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 255,
-255, 255, 255, 255, 255, 192, 192, 192, 192, 192, 31, 31, 255, 255, 255,
-255, 255, 255, 231, 231, 199, 199, 199, 199, 199, 199, 199, 199, 231, 231,
-231, 231, 199, 135, 0, 0, 0, 63, 255, 255, 255, 255, 255, 255, 255, 0, 0,
-0, 0, 224, 240, 248, 248, 252, 254, 255, 255, 255, 127, 63, 63, 31, 15, 7,
-7, 1, 0, 0, 63, 63, 255, 255, 255, 255, 255, 240, 192, 192, 128, 0, 0, 0,
-0, 0, 0, 0, 0, 1, 3, 3, 7, 7, 7, 7, 7, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7,
-0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 3, 3, 7, 7, 7,
-7, 7, 7, 7, 7, 7, 0, 0, 0, 1, 3, 3, 3, 7, 7, 7, 7, 15, 15, 15, 15, 7, 7, 7,
-7, 7, 3, 3, 3, 1, 0, 0, 0, 0, 1, 3, 3, 7, 135, 135, 135, 192, 192, 0, 0, 7,
-7, 3, 3, 3, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 7, 15, 15,
-31, 127, 127, 127, 255, 255, 252, 252, 252, 248, 240, 240, 240, 224, 224,
-224, 192, 192, 192, 192, 128, 128, 128, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-0, 0, 0, 0, 0, 128, 128, 128, 128, 128, 128, 128, 192, 192, 192, 192, 192,
-224, 224, 224, 224, 240, 240, 240, 240, 248, 248, 248, 248, 252, 252, 252,
-254, 254, 255, 255, 255, 255, 255, 255, 127, 127, 0, 0, 0, 0, 0, 0, 0, 0,
-0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
-3, 3, 3, 7, 7, 7, 15, 15, 31, 31, 31, 63, 63, 63, 63, 63, 127, 127, 127,
-127, 127, 255, 255, 255, 255, 254, 254, 254, 254, 254, 254, 254, 254, 254,
-254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254,
-255, 255, 255, 255, 255, 255, 255, 127, 127, 127, 127, 127, 127, 127, 127,
-63, 63, 63, 63, 63, 31, 31, 31, 31, 31, 15, 15, 15, 15, 7, 7, 7, 7, 3, 3,
-3, 3, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-0, 0, 0, 0, 0, 0, 0];
-
-var intelLogo = new LCD.uint8Array(logoArr.length);
-for (var x = 0; x < logoArr.length; x++)
- intelLogo.setitem(x, logoArr[x]);
-
-myLcd.clear();
-myLcd.draw(intelLogo, 1024);
-
-intelLogo = null;
-myLcd = null;
-LCD.cleanUp();
-LCD = null;
diff --git a/peripheral/libupm/examples/javascript/oled_ssd1327.js b/peripheral/libupm/examples/javascript/oled_ssd1327.js
deleted file mode 100644
index 2832ad2..0000000
--- a/peripheral/libupm/examples/javascript/oled_ssd1327.js
+++ /dev/null
@@ -1,194 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*global */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2014 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-//Load i2clcd module
-var LCD = require('jsupm_i2clcd');
-
-var myLcd = new LCD.SSD1327 (0, 0x3C);
-
-var logoArr = [0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x08, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x60, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x06, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x01, 0xC0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x01, 0xC0, 0x07, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x03, 0x80, 0x03, 0x80, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x03, 0x80, 0x03, 0x80,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x07, 0x80, 0x03, 0xC0, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x07, 0x80, 0x01, 0xC0,
-0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
-0x07, 0x80, 0x01, 0xE0, 0x08, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x20, 0x0F, 0x80, 0x01, 0xE0,
-0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30,
-0x0F, 0x00, 0x01, 0xE0, 0x08, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x30, 0x0F, 0x00, 0x01, 0xE0,
-0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30,
-0x0F, 0x00, 0x01, 0xE0, 0x18, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x30, 0x0F, 0x00, 0x01, 0xE0,
-0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38,
-0x0F, 0x00, 0x01, 0xE0, 0x18, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x38, 0x0F, 0x00, 0x01, 0xE0,
-0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38,
-0x0F, 0x80, 0x01, 0xE0, 0x38, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x3C, 0x0F, 0x80, 0x01, 0xE0,
-0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E,
-0x0F, 0x80, 0x03, 0xE0, 0x78, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x1E, 0x07, 0x80, 0x03, 0xE0,
-0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E,
-0x07, 0x80, 0x03, 0xE0, 0xF0, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x1F, 0x07, 0x80, 0x03, 0xC1,
-0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F,
-0x87, 0xC0, 0x07, 0xC1, 0xF0, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x0F, 0x83, 0xC0, 0x07, 0x83,
-0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F,
-0xC3, 0xC0, 0x07, 0x87, 0xE0, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x07, 0xE1, 0xE0, 0x07, 0x0F,
-0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
-0xF0, 0xE0, 0x0F, 0x0F, 0x80, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x01, 0xF8, 0xF0, 0x0E, 0x1F,
-0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
-0xF8, 0x70, 0x1C, 0x3F, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0xFC, 0x30, 0x18, 0x7E,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x7F, 0x18, 0x30, 0xFC, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x1F, 0x88, 0x21, 0xF0,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x0F, 0xC4, 0x47, 0xE0, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x03, 0xE0, 0x0F, 0x80,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0xF8, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0xE0, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
-0x00, 0x00, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x02, 0x00, 0x06, 0x00, 0x00, 0x6C, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x06,
-0x00, 0x00, 0x60, 0x00, 0x7E, 0x3F, 0x0F, 0xC3,
-0xF0, 0xFA, 0x0F, 0xDF, 0xE1, 0x9F, 0xEC, 0x7E,
-0xE6, 0x73, 0x9C, 0xE7, 0x39, 0xCE, 0x1C, 0xDF,
-0xE1, 0xB9, 0xEC, 0xE7, 0xE0, 0x61, 0xD8, 0x66,
-0x1B, 0x86, 0x1C, 0x06, 0x61, 0xB0, 0x6D, 0xC3,
-0x7C, 0x7F, 0xFF, 0xFF, 0xFF, 0x06, 0x0F, 0x86,
-0x61, 0xB0, 0x6D, 0x83, 0x3E, 0x7F, 0xFF, 0xFF,
-0xFF, 0x06, 0x07, 0xC6, 0x61, 0xB0, 0x6D, 0x83,
-0xC3, 0x61, 0x18, 0x46, 0x03, 0x86, 0x18, 0x66,
-0x61, 0xB0, 0x6D, 0xC3, 0xFE, 0x7F, 0x9F, 0xE7,
-0xF9, 0xFE, 0x1F, 0xE6, 0x3F, 0x9F, 0xEC, 0xFE,
-0x7E, 0x3F, 0x0F, 0xC3, 0xF0, 0xFA, 0x0F, 0xC6,
-0x3F, 0x9F, 0xEC, 0x7E, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00,
-0x00, 0x20, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x44, 0x00, 0x00, 0x20, 0x82, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6C, 0xF3,
-0xCF, 0x70, 0x9E, 0x79, 0xE7, 0x80, 0x00, 0x00,
-0x00, 0x00, 0x7D, 0x9E, 0x68, 0x20, 0xB2, 0xC8,
-0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x9E,
-0x6F, 0x20, 0xB2, 0xF9, 0xE7, 0x80, 0x00, 0x00,
-0x00, 0x00, 0x46, 0x9A, 0x61, 0x20, 0xB2, 0xCB,
-0x60, 0x80, 0x00, 0x00, 0x00, 0x00, 0x7C, 0xF3,
-0xCF, 0x30, 0x9E, 0x79, 0xE7, 0x90, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x7C, 0x02, 0x00, 0x00, 0x82, 0x60, 0x00, 0x00,
-0xF8, 0x00, 0x00, 0x40, 0x40, 0x02, 0x00, 0x00,
-0x83, 0x60, 0x00, 0x00, 0x8C, 0x00, 0x00, 0x40,
-0x60, 0xB7, 0x79, 0xE7, 0x81, 0xC7, 0x92, 0x70,
-0x89, 0xE7, 0x9E, 0x78, 0x7C, 0xE2, 0xC9, 0x2C,
-0x81, 0xCC, 0xD2, 0x40, 0xFB, 0x21, 0xB2, 0x48,
-0x40, 0x62, 0xF9, 0x2C, 0x80, 0x8C, 0xD2, 0x40,
-0x8B, 0xE7, 0xB0, 0x48, 0x40, 0xE2, 0xC9, 0x2C,
-0x80, 0x84, 0xD2, 0x40, 0x8B, 0x2D, 0x92, 0x48,
-0x7D, 0xB3, 0x79, 0x27, 0x80, 0x87, 0x9E, 0x40,
-0x8D, 0xE7, 0x9E, 0x48, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00];
-
-var SeeedLogo = new LCD.uint8Array(logoArr.length);
-for (var x = 0; x < logoArr.length; x++)
- SeeedLogo.setitem(x, logoArr[x]);
-
-// If you don't set the display to be white, the seeed logo will appear jagged
-myLcd.setGrayLevel(12);
-myLcd.draw(SeeedLogo, 96 * 96 / 8);
-
-
-for (var i = 0; i < 12; i++)
-{
- myLcd.setCursor(i, 0);
- myLcd.setGrayLevel(i);
- myLcd.write('Hello World');
-}
-
-
diff --git a/peripheral/libupm/examples/javascript/otp538u.js b/peripheral/libupm/examples/javascript/otp538u.js
deleted file mode 100644
index 7da6853..0000000
--- a/peripheral/libupm/examples/javascript/otp538u.js
+++ /dev/null
@@ -1,64 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-// analog voltage, usually 3.3 or 5.0
-var OTP538U_AREF = 5.0;
-
-var tempIRSensor_lib = require('jsupm_otp538u');
-
-// Instantiate a OTP538U on analog pins A0 and A1
-// A0 is used for the Ambient Temperature and A1 is used for the
-// Object temperature.
-var tempIRSensor_obj = new tempIRSensor_lib.OTP538U(0, 1, OTP538U_AREF);
-
-
-function checkTemp()
-{
- var outputStr = "Ambient temp: " +
- roundNum(tempIRSensor_obj.ambientTemperature(), 2) +
- " C, Object temp: " +
- roundNum(tempIRSensor_obj.objectTemperature(), 2) +
- " C";
- console.log(outputStr);
-}
-
-var myInterval = setInterval(checkTemp, 1000);
-
-function roundNum(num, decimalPlaces)
-{
- var extraNum = (1 / (Math.pow(10, decimalPlaces) * 1000));
- return (Math.round((num + extraNum) *
- (Math.pow(10, decimalPlaces))) / Math.pow(10, decimalPlaces));
-}
-
-// When exiting: clear interval and print message
-process.on('SIGINT', function()
-{
- clearInterval(myInterval);
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/ozw.js b/peripheral/libupm/examples/javascript/ozw.js
deleted file mode 100644
index 5c5c7d5..0000000
--- a/peripheral/libupm/examples/javascript/ozw.js
+++ /dev/null
@@ -1,128 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-var sensorObj = require('jsupm_ozw');
-
-
-/************** Main code **************/
-// Instantiate an OZW instance
-var sensor = new sensorObj.OZW();
-
-var defaultDev = "/dev/ttyACM0";
-
-// if an argument was specified, use it as the device instead
-if (process.argv.length > 2)
-{
- defaultDev = process.argv[2];
-}
-
-// The first thing to do is create options, then lock them when done.
-sensor.optionsCreate();
-sensor.optionsLock();
-
-// Next, initialize it.
-console.log("Initializing, this may take awhile depending on your ZWave network");
-
-if (!sensor.init(defaultDev))
-{
- console.log("Init failed.");
- process.exit(0);
-}
-console.log("Initialization complete");
-
-console.log("Dumping nodes...");
-
-sensor.dumpNodes();
-
-// The following is example output of dumpNodes:
-//
-// Dumping nodes...
-// Node 1: Z-Stick Gen5
-// Node 2: Smart Switch 6
-// Index: 0, Type: bool, Label: Switch, Value: False
-// Index: 2, Type: float, Label: Energy, Value: 1.190 kWh
-// Index: 3, Type: float, Label: Previous Reading, Value: 1.190 kWh
-// Index: 4, Type: int32, Label: Interval, Value: 1521 seconds
-// Index: 5, Type: float, Label: Power, Value: 0.000 W
-// Index: 6, Type: float, Label: Voltage, Value: 121.256 V
-// Index: 7, Type: float, Label: Current, Value: 0.000 A
-// Index: 8, Type: bool, Label: Exporting, Value: False
-// Index: 45, Type: list, Label: Day, Value: Friday
-// Index: 46, Type: byte, Label: Hour, Value: 5
-// Index: 47, Type: byte, Label: Minute, Value: 53
-// Node 3: Multi Sensor
-// Index: 0, Type: bool, Label: Sensor, Value: True
-// Index: 1, Type: float, Label: Temperature, Value: 72.8 F
-// Index: 2, Type: float, Label: Luminance, Value: 4 lux
-// Index: 3, Type: float, Label: Relative Humidity, Value: 22 %
-// Index: 17, Type: byte, Label: Battery Level, Value: 98 %
-// Node 5: Minimote
-// Node 6: Smart Energy Switch
-// Index: 0, Type: bool, Label: Switch, Value: False
-// Index: 2, Type: float, Label: Power, Value: 0.000 W
-// Index: 3, Type: float, Label: Energy, Value: 1.609 kWh
-// Index: 4, Type: float, Label: Previous Reading, Value: 1.609 kWh
-// Index: 5, Type: int32, Label: Interval, Value: 1521 seconds
-// Index: 6, Type: float, Label: Power, Value: 0.000 W
-// Index: 7, Type: float, Label: Previous Reading, Value: 1.609 W
-// Index: 8, Type: int32, Label: Interval, Value: 1521 seconds
-// Index: 9, Type: bool, Label: Exporting, Value: False
-// Node 7: Smart Energy Switch
-// Index: 0, Type: bool, Label: Switch, Value: False
-// Index: 2, Type: float, Label: Power, Value: 0.000 W
-// Index: 3, Type: float, Label: Energy, Value: 0.000 kWh
-// Index: 4, Type: float, Label: Previous Reading, Value: 0.000 kWh
-// Index: 5, Type: int32, Label: Interval, Value: 1521 seconds
-// Index: 6, Type: float, Label: Power, Value: 0.000 W
-// Index: 7, Type: float, Label: Previous Reading, Value: 0.000 W
-// Index: 8, Type: int32, Label: Interval, Value: 1521 seconds
-// Index: 9, Type: bool, Label: Exporting, Value: False
-//
-// So, with the above in mind:
-//
-// 1. Query the temperature on node 3 and print it out (as a
-// string), along with the units of measure:
-//
-// console.log("Temperature: " + sensor.getValueAsString(3, 1) +
-// " " + sensor.getValueUnits(3, 1));
-//
-// 2. query the same temperature as a float:
-//
-// var temperature = sensor.getValueAsFloat(3, 1);
-//
-// 3. Turn on the light plugged into the switch on Node 7
-//
-// console.log("Turning ON node 7");
-// sensor.setValueAsBool(7, 0, true);
-//
-
-sensor = null;
-sensorObj.cleanUp();
-sensorObj = null;
-console.log("Exiting...");
-process.exit(0);
diff --git a/peripheral/libupm/examples/javascript/pca9685.js b/peripheral/libupm/examples/javascript/pca9685.js
deleted file mode 100644
index 3768f8e..0000000
--- a/peripheral/libupm/examples/javascript/pca9685.js
+++ /dev/null
@@ -1,85 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-function exit()
-{
- console.log("Exiting");
-
- if (myLEDController_obj)
- {
- // clear the bits we set earlier
- myLEDController_obj.ledFullOff(3, false);
- myLEDController_obj.ledFullOn(4, false);
- }
- myLEDController_obj = null;
- if (LEDController_lib)
- {
- LEDController_lib.cleanUp();
- LEDController_lib = null;
- }
- process.exit(0);
-}
-
-// The pca9685 is an led controller.
-// It's being used in this case to drive motors.
-var LEDController_lib = require('jsupm_pca9685');
-
-var I2CBus = LEDController_lib.PCA9685_I2C_BUS;
-var I2CAddr = LEDController_lib.PCA9685_DEFAULT_I2C_ADDR;
-// Instantiate an PCA9685 on I2C bus 0
-var myLEDController_obj = new LEDController_lib.PCA9685(I2CBus, I2CAddr);
-
-// put device to sleep
-myLEDController_obj.setModeSleep(true);
-
-// setup a period of 50Hz
-myLEDController_obj.setPrescaleFromHz(50);
-
-// wake device up
-myLEDController_obj.setModeSleep(false);
-
-// Setup a 50% duty cycle -- on time at 0, off time at 2048 (4096 / 2)
-// Set for all channels
-var LEDNum = LEDController_lib.PCA9685_ALL_LED;
-myLEDController_obj.ledOnTime(LEDNum, 0);
-myLEDController_obj.ledOffTime(LEDNum, 2048);
-
-// but, turn channel 3 full off and channel 4 full on
-console.log("Turning channel 3 off, and channel 4 on.");
-console.log("All other channels will be PWM'd at a 50% duty cycle.");
-
-myLEDController_obj.ledFullOff(3, true);
-myLEDController_obj.ledFullOn(4, true);
-
- // now, just sleep for 5 seconds, reset channels 3 and 4, and exit.
-console.log("Sleeping for 5 seconds...");
-
-setTimeout(exit, 5000);
-
-process.on('SIGINT', function()
-{
- exit();
-});
diff --git a/peripheral/libupm/examples/javascript/pn532-writeurl.js b/peripheral/libupm/examples/javascript/pn532-writeurl.js
deleted file mode 100644
index 2a037ad..0000000
--- a/peripheral/libupm/examples/javascript/pn532-writeurl.js
+++ /dev/null
@@ -1,136 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
-* Author: Jon Trulson <jtrulson@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-// Load PN532 module
-var pn532 = require('jsupm_pn532');
-
-// Instantiate an PN532 on I2C bus 0 (default) using gpio 3 for the
-// IRQ, and gpio 2 for the reset pin.
-var myNFCObj = new pn532.PN532(3, 2);
-
-function writeUrl()
-{
- if (uidSize.getitem(0) != 7)
- {
- console.log("This example will only write an NDEF URI to preformatted");
- console.log("Mifare Ultralight or NTAG2XX tags");
- exit();
- }
-
- // 48 bytes is maximum data area on ultralight cards, so we use that
- // as the maximum datasize here. Obviously if you have a bigger
- // card, you can write more data.
- if (!myNFCObj.ntag2xx_WriteNDEFURI(pn532.PN532.NDEF_URIPREFIX_HTTP,
- url, 48))
- {
- // failure
- console.log("Failed to write NDEF record tag.");
- exit(1);
- }
-
- console.log("Success, URL record written to tag.");
-}
-
-function toHex(d, pad)
-{
- // pad should be between 1 and 8
- return ("00000000"+(Number(d).toString(16))).slice(-pad)
-}
-
-function exit()
-{
- clearInterval(myInterval);
- myNFCObj = null;
- pn532.cleanUp();
- pn532 = null;
- console.log("Exiting");
- process.exit(0);
-}
-
-// When exiting: clear interval, and print message
-process.on('SIGINT', function()
-{
- exit();
-});
-
-// "main"
-if (!myNFCObj.init())
- console.log("init() failed");
-
-var vers = myNFCObj.getFirmwareVersion();
-
-if (vers)
- console.log("Got firmware version: " + toHex(vers, 8));
-else
-{
- console.log("Could not identify PN532");
- exit();
-}
-
-// Now scan and identify any cards that come in range (1 for now)
-
-// Retry forever
-myNFCObj.setPassiveActivationRetries(0xff);
-
-myNFCObj.SAMConfig();
-
-var uidSize = new pn532.uint8Array(0);
-var uid = new pn532.uint8Array(7);
-
-// the URL we want to add as an NDEF record
-// NOTE: this cannot exceed 34 characters.
-url = "iotdk.intel.com";
-
-var myInterval = setInterval(function()
-{
- for (var x = 0; x < 7; x++)
- uid.setitem(x, 0);
- if (myNFCObj.readPassiveTargetID(pn532.PN532.BAUD_MIFARE_ISO14443A,
- uid, uidSize, 2000))
- {
- // found a card
- console.log("Found a card: UID len " + uidSize.getitem(0));
- process.stdout.write("UID: ");
- for (var i = 0; i < uidSize.getitem(0); i++)
- {
- var byteVal = uid.getitem(i);
- process.stdout.write(toHex(byteVal, 2) + " ");
- }
- process.stdout.write("\n");
- console.log("SAK: " + toHex(myNFCObj.getSAK(), 2));
- console.log("ATQA: " + toHex(myNFCObj.getATQA(), 4));
- console.log(" ");
-
- // write the URL
- writeUrl();
- clearInterval(myInterval);
- return;
- }
- else
- console.log("Waiting for a card...");
-}, 1000);
-
diff --git a/peripheral/libupm/examples/javascript/pn532.js b/peripheral/libupm/examples/javascript/pn532.js
deleted file mode 100644
index e740a73..0000000
--- a/peripheral/libupm/examples/javascript/pn532.js
+++ /dev/null
@@ -1,102 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-// Load PN532 module
-var pn532 = require('jsupm_pn532');
-
-// Instantiate an PN532 on I2C bus 0 (default) using gpio 3 for the
-// IRQ, and gpio 2 for the reset pin.
-var myNFCObj = new pn532.PN532(3, 2);
-
-if (!myNFCObj.init())
- console.log("init() failed");
-
-var vers = myNFCObj.getFirmwareVersion();
-
-if (vers)
- console.log("Got firmware version: " + toHex(vers, 8));
-else
-{
- console.log("Could not identify PN532");
- exit();
-}
-
-// Now scan and identify any cards that come in range (1 for now)
-
-// Retry forever
-myNFCObj.setPassiveActivationRetries(0xff);
-
-myNFCObj.SAMConfig();
-
-var uidSize = new pn532.uint8Array(0);
-var uid = new pn532.uint8Array(7);
-
-var myInterval = setInterval(function()
-{
- for (var x = 0; x < 7; x++)
- uid.setitem(x, 0);
- if (myNFCObj.readPassiveTargetID(pn532.PN532.BAUD_MIFARE_ISO14443A,
- uid, uidSize, 2000))
- {
- // found a card
- console.log("Found a card: UID len " + uidSize.getitem(0));
- process.stdout.write("UID: ");
- for (var i = 0; i < uidSize.getitem(0); i++)
- {
- var byteVal = uid.getitem(i);
- process.stdout.write(toHex(byteVal, 2) + " ");
- }
- process.stdout.write("\n");
- console.log("SAK: " + toHex(myNFCObj.getSAK(), 2));
- console.log("ATQA: " + toHex(myNFCObj.getATQA(), 4));
- console.log(" ");
- }
- else
- console.log("Waiting for a card...");
-}, 1000);
-
-function toHex(d, pad)
-{
- // pad should be between 1 and 8
- return ("00000000"+(Number(d).toString(16))).slice(-pad)
-}
-
-function exit()
-{
- clearInterval(myInterval);
- myNFCObj = null;
- pn532.cleanUp();
- pn532 = null;
- console.log("Exiting");
- process.exit(0);
-}
-
-// When exiting: clear interval, and print message
-process.on('SIGINT', function()
-{
- exit();
-});
diff --git a/peripheral/libupm/examples/javascript/ppd42ns.js b/peripheral/libupm/examples/javascript/ppd42ns.js
deleted file mode 100644
index c6a48da..0000000
--- a/peripheral/libupm/examples/javascript/ppd42ns.js
+++ /dev/null
@@ -1,52 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*global */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2014 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-// Load dust sensor module
-var dustSensor = require('jsupm_ppd42ns');
-// Instantiate a dust sensor on digital pin D8
-var myDustSensor = new dustSensor.PPD42NS(8);
-
-var data;
-
-// Continue until user ends program
-var notice = "This program will give readings ";
-notice += "every 30 seconds until you stop it"
-console.log(notice);
-while(1)
-{
- data = myDustSensor.getData();
- console.log("Low pulse occupancy: " + data.lowPulseOccupancy);
- console.log("Ratio: " + data.ratio);
- console.log("Concentration: " + data.concentration);
-}
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/rfr359f.js b/peripheral/libupm/examples/javascript/rfr359f.js
deleted file mode 100644
index 00832a0..0000000
--- a/peripheral/libupm/examples/javascript/rfr359f.js
+++ /dev/null
@@ -1,48 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var distInterrupter = require("jsupm_rfr359f");
-
-// Instantiate an RFR359F digital pin D2
-// This was tested on the Grove IR Distance Interrupter
-var myDistInterrupter = new distInterrupter.RFR359F(2);
-
-// The range appears to be about 4 inches, depending on adjustment
-var myInterval = setInterval(function()
-{
- if (myDistInterrupter.objectDetected())
- console.log("Object detected");
- else
- console.log("Area is clear");
-}, 100);
-
-// When exiting: turn off LED, clear interval, and print message
-process.on('SIGINT', function()
-{
- clearInterval(myInterval);
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/rgbringcoder.js b/peripheral/libupm/examples/javascript/rgbringcoder.js
deleted file mode 100644
index 6fb2276..0000000
--- a/peripheral/libupm/examples/javascript/rgbringcoder.js
+++ /dev/null
@@ -1,98 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-var ringcoderObj = require('jsupm_rgbringcoder');
-
-// There are a lot of pins to hook up. These pins are valid for the
-// Edison board, but may need to be adjusted for other platforms.
-
-// In order:
-// enable - 4
-// latch - 10
-// clear - 11
-// clock - 2
-// data - 9
-// switch - 7
-
-// red pwm - 3
-// green pwm - 5
-// blue pwm - 6
-
-// encA - 12
-// encB - 13
-var ringCoder = new ringcoderObj.RGBRingCoder(4, 10, 11, 2, 9, 7, 12, 13, 3,
- 5, 6);
-
-var spin = 0x0001;
-var oldState = false;
-var oldPos = 0;
-
-// Lets go green
-ringCoder.setRGBLED(0.99, 0.01, 0.99);
-
-setInterval(function()
-{
- // you spin me round...
- if ((spin & 0xffff) == 0)
- spin = 0x0001;
-
- ringCoder.setRingLEDS(spin);
- spin <<= 1;
-
- // check button state
- var bstate = ringCoder.getButtonState();
- if (bstate != oldState)
- {
- console.log("Button state changed from " + oldState + " to "
- + bstate);
- oldState = bstate;
- }
-
- // check encoder position
- var epos = ringCoder.getEncoderPosition();
- if (epos != oldPos)
- {
- console.log("Encoder position changed from " + oldPos + " to "
- + epos);
- oldPos = epos;
- }
-}, 100);
-
-
-// exit on ^C
-process.on('SIGINT', function()
-{
- ringCoder = null;
- ringcoderObj.cleanUp();
- ringcoderObj = null;
- console.log("Exiting.");
- process.exit(0);
-});
-
-
-
-
diff --git a/peripheral/libupm/examples/javascript/rhusb.js b/peripheral/libupm/examples/javascript/rhusb.js
deleted file mode 100644
index bbd5a16..0000000
--- a/peripheral/libupm/examples/javascript/rhusb.js
+++ /dev/null
@@ -1,76 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2016 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-var sensorObj = require('jsupm_rhusb');
-
-
-/************** Main code **************/
-
-var defaultDev = "/dev/ttyUSB0";
-
-// if an argument was specified, use it as the device instead
-if (process.argv.length > 2)
-{
- defaultDev = process.argv[2];
-}
-
-console.log("Using device " + defaultDev);
-console.log("Initializing...");
-
-// Instantiate an RHUSB instance on defaultDev
-var sensor = new sensorObj.RHUSB(defaultDev);
-
-// output the firmware ID
-console.log("Firmware ID:", sensor.getFirmwareID());
-console.log("");
-
-// update and print available values every second
-setInterval(function()
-{
- // update our values from the sensor
- sensor.update();
-
- // we show both C and F for temperature
- console.log("Temperature:", sensor.getTemperature(),
- "C /", sensor.getTemperature(true), "F");
-
- console.log("Humidity:", sensor.getHumidity(), "%");
-
- console.log("");
-
-}, 1000);
-
-
-process.on('SIGINT', function()
-{
- sensor = null;
- sensorObj.cleanUp();
- sensorObj = null;
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/rotaryencoder.js b/peripheral/libupm/examples/javascript/rotaryencoder.js
deleted file mode 100644
index a3f5d00..0000000
--- a/peripheral/libupm/examples/javascript/rotaryencoder.js
+++ /dev/null
@@ -1,43 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var rotaryEncoder = require("jsupm_rotaryencoder");
-
-// Instantiate a Grove Rotary Encoder, using signal pins D2 and D3
-var myRotaryEncoder = new rotaryEncoder.RotaryEncoder(2, 3);
-
-var myInterval = setInterval(function()
-{
- console.log("Position: " + myRotaryEncoder.position());
-}, 100);
-
-// When exiting: clear interval and print message
-process.on('SIGINT', function()
-{
- clearInterval(myInterval);
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/rpr220.js b/peripheral/libupm/examples/javascript/rpr220.js
deleted file mode 100644
index 5474bdd..0000000
--- a/peripheral/libupm/examples/javascript/rpr220.js
+++ /dev/null
@@ -1,49 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var reflectiveSensor = require("jsupm_rpr220");
-
-// This example uses a simple method to determine current status
-
-// Instantiate an RPR220 digital pin D2
-// This was tested on the Grove IR Reflective Sensor
-var myReflectiveSensor = new reflectiveSensor.RPR220(2);
-
-var myInterval = setInterval(function()
-{
- if (myReflectiveSensor.blackDetected())
- console.log("Black detected");
- else
- console.log("Black NOT detected");
-}, 100);
-
-// When exiting: clear interval and print message
-process.on('SIGINT', function()
-{
- clearInterval(myInterval);
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/sainsmartks.js b/peripheral/libupm/examples/javascript/sainsmartks.js
deleted file mode 100644
index f81168f..0000000
--- a/peripheral/libupm/examples/javascript/sainsmartks.js
+++ /dev/null
@@ -1,53 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-var sainsmartObj = require('jsupm_i2clcd');
-
-// Instantiate a Sainsmart LCD Keypad Shield using default pins
-var lcd = new sainsmartObj.SAINSMARTKS();
-
-lcd.setCursor(0,0);
-lcd.write("Sainsmart KS");
-lcd.setCursor(1,2);
-lcd.write("Hello World");
-
-// output current key value every second.
-setInterval(function()
-{
- console.log("Button value: " + lcd.getRawKeyValue());
-}, 1000);
-
-// exit on ^C
-process.on('SIGINT', function()
-{
- lcd = null;
- sainsmartObj.cleanUp();
- sainsmartObj = null;
- console.log("Exiting.");
- process.exit(0);
-});
-
diff --git a/peripheral/libupm/examples/javascript/si114x.js b/peripheral/libupm/examples/javascript/si114x.js
deleted file mode 100644
index 94d438a..0000000
--- a/peripheral/libupm/examples/javascript/si114x.js
+++ /dev/null
@@ -1,66 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var UV_lib = require('jsupm_si114x');
-
-// Instantiate a SI114x UV Sensor on I2C bus 0
-var myUVSensor = new UV_lib.SI114X(0);
-
-for (var x in myUVSensor)
- console.log(x);
-// First initialize it
-myUVSensor.initialize();
-
-console.log("UV Index Scale:");
-console.log("---------------");
-console.log("11+ Extreme");
-console.log("8-10 Very High");
-console.log("6-7 High");
-console.log("3-5 Moderate");
-console.log("0-2 Low\n");
-
-// update every second and print the currently measured UV Index
-var myInterval = setInterval(function()
-{
- // update current value(s)
- myUVSensor.update();
-
- // print detected value
- console.log("UV Index: " + myUVSensor.getUVIndex());
-}, 1000);
-
-
-// When exiting: clear interval and print message
-process.on('SIGINT', function()
-{
- clearInterval(myInterval);
- myUVSensor = null
- UV_lib.cleanUp();
- UV_lib = null;
- console.log("Exiting");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/sm130.js b/peripheral/libupm/examples/javascript/sm130.js
deleted file mode 100644
index b0f86f8..0000000
--- a/peripheral/libupm/examples/javascript/sm130.js
+++ /dev/null
@@ -1,70 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-var sensorObj = require('jsupm_sm130');
-
-// Instantiate a UART based SM130 RFID Module using defaults
-var sensor = new sensorObj.SM130();
-
-// Set the baud rate, 19200 baud is the default.
-if (sensor.setBaudRate(19200))
-{
- console.log("Failed to set baud rate");
- process.exit(0);
-}
-
-console.log("Resetting...");
-sensor.reset();
-
-console.log("Firmware revision: " + sensor.getFirmwareVersion());
-
-console.log("Waiting up to 5 seconds for a tag...");
-
-if (sensor.waitForTag(5000))
-{
- console.log("Found tag, UID: " +
- sensor.string2HexString(sensor.getUID()));
- console.log("Tag Type: " +
- sensor.tag2String(sensor.getTagType()));
-}
-else
-{
- // error
- console.log("waitForTag failed: " +
- sensor.getLastErrorString());
-}
-
-/************** Exit code **************/
-process.on('SIGINT', function()
-{
- sensor = null;
- sensorObj.cleanUp();
- sensorObj = null;
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/st7735.js b/peripheral/libupm/examples/javascript/st7735.js
deleted file mode 100644
index 3718c5d..0000000
--- a/peripheral/libupm/examples/javascript/st7735.js
+++ /dev/null
@@ -1,65 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Takahiro Poly Horikawa <horikawa.takahiro@gmail.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-var st7735 = require('jsupm_st7735');
-
-var lcd = new st7735.ST7735(10, 7, 9, 8);
-lcd.fillScreen(st7735.ST7735_RED);
-lcd.refresh();
-
-lcd.fillScreen(st7735.ST7735_CYAN);
-lcd.refresh();
-
-lcd.fillScreen(st7735.ST7735_BLACK);
-lcd.refresh();
-
-lcd.drawLine(10, 10, 10, 100, st7735.ST7735_MAGENTA);
-lcd.drawLine(20, 20, 10, 100, st7735.ST7735_YELLOW);
-lcd.drawLine(30, 30, 10, 100, st7735.ST7735_WHITE);
-lcd.refresh();
-
-lcd.drawPixel(20, 20, st7735.ST7735_GREEN);
-lcd.refresh();
-
-lcd.drawTriangle(50, 50, 80, 80, 60, 90, st7735.ST7735_GREEN);
-lcd.refresh();
-
-lcd.drawCircle(100, 110, 10, st7735.ST7735_BLUE);
-lcd.refresh();
-
-lcd.setTextWrap(0x0);
-
-lcd.setCursor(0, 30);
-lcd.setTextColor(st7735.ST7735_RED, st7735.ST7735_RED);
-lcd.setTextSize(1);
-lcd.print('Hello World!');
-
-lcd.setCursor(10, 50);
-lcd.setTextColor(st7735.ST7735_RED, st7735.ST7735_RED);
-lcd.setTextSize(2);
-lcd.print('BIG');
-
-lcd.refresh();
-
diff --git a/peripheral/libupm/examples/javascript/stepmotor.js b/peripheral/libupm/examples/javascript/stepmotor.js
deleted file mode 100644
index 51842a5..0000000
--- a/peripheral/libupm/examples/javascript/stepmotor.js
+++ /dev/null
@@ -1,68 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Mihai Tudor Panu <mihai.tudor.panu@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 lib = require('jsupm_stepmotor');
-
-// Instantiate a stepper motor driver on pins 2 (direction) and 3 (step)
-var stepper = new lib.StepMotor(2, 3);
-
-function delay(milliseconds) {
- var startTime = Date.now();
- while (Date.now() - startTime < milliseconds);
-}
-
-stepper.quit = function()
-{
- stepper = null;
- lib.cleanUp();
- lib = null;
- console.log("Exiting");
- process.exit(0);
-};
-
-// The driver is synchronous and blocking
-console.log("Rotating 1 revolution forward and back at 60 rpm.");
-stepper.setSpeed(60);
-stepper.stepForward(200);
-delay(1000);
-stepper.stepBackward(200);
-delay(1000);
-
-console.log("Rotating 1 revolution forward and back at 150 rpm.");
-stepper.setSpeed(150);
-stepper.stepForward(200);
-delay(1000);
-stepper.stepBackward(200);
-delay(1000);
-
-console.log("Rotating 1 revolution forward and back at 300 rpm.");
-stepper.setSpeed(300);
-stepper.stepForward(200);
-delay(1000);
-stepper.stepBackward(200);
-delay(1000);
-
-stepper.quit();
diff --git a/peripheral/libupm/examples/javascript/sx1276-fsk.js b/peripheral/libupm/examples/javascript/sx1276-fsk.js
deleted file mode 100644
index c3a4b3a..0000000
--- a/peripheral/libupm/examples/javascript/sx1276-fsk.js
+++ /dev/null
@@ -1,112 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-var sensorObj = require('jsupm_sx1276');
-
-var count = 0;
-var interval;
-
-/************** Functions **************/
-function transmit(sensor)
-{
- var buffer = "Ping " + count;
- count++;
- console.log("Sending... " + buffer);
-
- sensor.sendStr(buffer, 3000);
- sensor.setSleep();
-}
-
-function receive(sensor)
-{
- console.log("Attempting to receive... ");
- var rv = 0;
- rv = sensor.setRx(3000);
-
- if (rv)
- {
- console.log("setRx returned " + rv);
- }
- else
- {
- console.log("Received Buffer: " + sensor.getRxBufferStr());
- }
-
- sensor.setSleep();
-}
-
-/************** Main code **************/
-// Instantiate an SX1276 using default parameters
-
-var sensor = new sensorObj.SX1276();
-
-console.log("Specify an argument to go into receive mode. Default is transmit");
-
-// 915Mhz
-sensor.setChannel(915000000)
-
-// FSK configuration (rx and tx must be configured the same):
-// Tx output power = 14 dBm
-// FSK freq deviation = 25000 Hz
-// FSK bandwidth = 50000 bps
-// FSK AFC bandwidth = 83333 Hz
-// FSK datarate = 50000 bps
-// FSK preamble len = 5
-// FSK fixed length payload = false
-// FSK CRC check = true
-// FSK (rx) continuous Rx mode = False
-
-sensor.setTxConfig(sensorObj.SX1276.MODEM_FSK, 14, 25000, 0,
- 50000, 0, 5, false, true, false, 0, false);
-
-sensor.setRxConfig(sensorObj.SX1276.MODEM_FSK, 50000, 50000,
- 0, 83333, 5, 0, false, 0, true,
- false, 0, false, true);
-
-
-if (process.argv.length > 2)
-{
- // receive mode
- interval = setInterval(function() { receive(sensor); }, 250);
-}
-else
-{
- // transmit mode
- interval = setInterval(function() { transmit(sensor); }, 1000);
-}
-
-
-/************** Exit code **************/
-process.on('SIGINT', function()
-{
- sensor = null;
- sensorObj.cleanUp();
- sensorObj = null;
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/sx1276-lora.js b/peripheral/libupm/examples/javascript/sx1276-lora.js
deleted file mode 100644
index 82581cc..0000000
--- a/peripheral/libupm/examples/javascript/sx1276-lora.js
+++ /dev/null
@@ -1,110 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-var sensorObj = require('jsupm_sx1276');
-
-var count = 0;
-var interval;
-
-/************** Functions **************/
-function transmit(sensor)
-{
- var buffer = "Ping " + count;
- count++;
- console.log("Sending... " + buffer);
-
- sensor.sendStr(buffer, 3000);
- sensor.setSleep();
-}
-
-function receive(sensor)
-{
- console.log("Attempting to receive... ");
- var rv = 0;
- rv = sensor.setRx(3000);
-
- if (rv)
- {
- console.log("setRx returned " + rv);
- }
- else
- {
- console.log("Received Buffer: " + sensor.getRxBufferStr());
- }
-
- sensor.setSleep();
-}
-
-/************** Main code **************/
-// Instantiate an SX1276 using default parameters
-
-var sensor = new sensorObj.SX1276();
-
-console.log("Specify an argument to go into receive mode. Default is transmit");
-
-// 915Mhz
-sensor.setChannel(915000000)
-
-// LORA configuration (rx and tx must be configured the same):
-// Tx output power = 14 dBm
-// LORA bandwidth = 125000 (can also be 250K and 500K)
-// LORA spreading factor = 7
-// LORA coding rate = 1 (4/5)
-// LORA preamble len = 8
-// LORA symbol timeout = 5
-// LORA fixed payload = false
-// LORA IQ inversion = false
-// LORA (rx) continuous Rx mode = true
-
-sensor.setTxConfig(sensorObj.SX1276.MODEM_LORA, 14, 0, 125000,
- 7, 1, 8, false, true, false, 0, false);
-
-sensor.setRxConfig(sensorObj.SX1276.MODEM_LORA, 125000, 7,
- 1, 0, 8, 5, false, 0, true, false, 0, false, true);
-
-if (process.argv.length > 2)
-{
- // receive mode
- interval = setInterval(function() { receive(sensor); }, 250);
-}
-else
-{
- // transmit mode
- interval = setInterval(function() { transmit(sensor); }, 1000);
-}
-
-
-/************** Exit code **************/
-process.on('SIGINT', function()
-{
- sensor = null;
- sensorObj.cleanUp();
- sensorObj = null;
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/sx6119.js b/peripheral/libupm/examples/javascript/sx6119.js
deleted file mode 100644
index 6833fc0..0000000
--- a/peripheral/libupm/examples/javascript/sx6119.js
+++ /dev/null
@@ -1,53 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var FM_receiver_lib = require('jsupm_sx6119');
-
-// Instantiate a SX6119 on digital pins 2 (power) and 3 (seek)
-// This example was tested on the Grove FM Receiver.
-var myFM_receiver_obj = new FM_receiver_lib.SX6119(2, 3);
-
-// if an argument was specified (any argument), seek to the next
-// station, else just toggle the power.
-
-
-console.log("Supply any argument to the command line to seek to the");
-console.log("next station.");
-console.log("Running the example without an argument will toggle the");
-console.log("power on or off.\n");
-
-var doSeek = false;
-
-if (process.argv.length > 2)
- doSeek = true;
-
-// depending on what was selected, do it
-if (doSeek)
- myFM_receiver_obj.seek();
-else
- myFM_receiver_obj.togglePower();
-
-console.log("Exiting");
diff --git a/peripheral/libupm/examples/javascript/t3311.js b/peripheral/libupm/examples/javascript/t3311.js
deleted file mode 100644
index e62679b..0000000
--- a/peripheral/libupm/examples/javascript/t3311.js
+++ /dev/null
@@ -1,101 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2016 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-var sensorObj = require('jsupm_t3311');
-
-
-/************** Main code **************/
-
-var defaultDev = "/dev/ttyUSB0";
-
-// if an argument was specified, use it as the device instead
-if (process.argv.length > 2)
-{
- defaultDev = process.argv[2];
-}
-
-console.log("Initializing...");
-
-// Instantiate an T3311 instance, using MODBUS slave address 1, and
-// default comm parameters (9600, 8, N, 2)
-var sensor = new sensorObj.T3311(defaultDev, 1);
-
-// output the serial number and firmware revision
-console.log("Serial Number:", sensor.getSerialNumber());
-console.log("Firmware Revision:", sensor.getFirmwareMajor() + "." +
- sensor.getFirmwareMinor());
-console.log("");
-
-// update and print available values every second
-setInterval(function()
-{
- // update our values from the sensor
- sensor.update();
-
- // we show both C and F for temperature
- console.log("Temperature:", sensor.getTemperature(),
- "C /", sensor.getTemperature(true), "F");
-
- console.log("Humidity:", sensor.getHumidity(), "%");
-
- // this value depends on the sensor configuration -- by default
- // it is the dew point temperature
- console.log("Computed Value:", sensor.getComputedValue());
-
- // with FW revisions > 2.44, extended computed data is available
- if (sensor.extendedDataAvailable())
- {
- console.log("Dew Point Temperature:", sensor.getDewPointTemperature(),
- "C /", sensor.getDewPointTemperature(true), "F");
-
- console.log("Absolute Humidity:", sensor.getAbsoluteHumidity(),
- "g/m3");
-
- console.log("Specific Humidity:", sensor.getSpecificHumidity(),
- "g/kg");
-
- console.log("Mixing Ratio:", sensor.getMixingRatio(),
- "g/kg");
-
- console.log("Specific Enthalpy:", sensor.getSpecificEnthalpy(),
- "kJ/kg");
- }
-
- console.log("");
-
-}, 1000);
-
-
-process.on('SIGINT', function()
-{
- sensor = null;
- sensorObj.cleanUp();
- sensorObj = null;
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/ta12200.js b/peripheral/libupm/examples/javascript/ta12200.js
deleted file mode 100644
index 57dafeb..0000000
--- a/peripheral/libupm/examples/javascript/ta12200.js
+++ /dev/null
@@ -1,51 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2014 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var electricitySensor = require('jsupm_ta12200');
-// Instantiate a TA12-200 sensor on analog pin A0
-var myElectricitySensor = new electricitySensor.TA12200(0);
-
-var maxVal, current;
-var myInterval = setInterval(function()
-{
- maxVal = myElectricitySensor.highestValue();
- current = myElectricitySensor.milliAmps(maxVal);
-
- outputStr = "Max ADC Value: " + maxVal +
- ", current: " + current + "mA";
- console.log(outputStr);
-}, 100);
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- clearInterval(myInterval);
- myElectricitySensor = null;
- electricitySensor.cleanUp();
- electricitySensor = null;
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/tcs3414cs.js b/peripheral/libupm/examples/javascript/tcs3414cs.js
deleted file mode 100644
index 6c1579c..0000000
--- a/peripheral/libupm/examples/javascript/tcs3414cs.js
+++ /dev/null
@@ -1,47 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*global */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2014 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var colorSensor = require('jsupm_tcs3414cs');
-
-// Instantiate the color sensor on I2C
-var mycolorSensor = new colorSensor.TCS3414CS();
-
-var rgb = new colorSensor.tcs3414sc_rgb_t;
-
-// Print out the r, g, b, and clr value every 0.5 seconds
-setInterval(function()
-{
- mycolorSensor.readRGB(rgb);
- console.log(rgb.r + ", " + rgb.g + ", " + rgb.b + ", " + rgb.clr);
-}, 500);
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/tm1637.js b/peripheral/libupm/examples/javascript/tm1637.js
deleted file mode 100644
index 6220059..0000000
--- a/peripheral/libupm/examples/javascript/tm1637.js
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
-* Author: Mihai Tudor Panu <mihai.tudor.panu@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.
-*/
-
-// Some vars
-var colon = true;
-var interval;
-
-// Load display
-var tm1637 = require('jsupm_tm1637');
-
-// Instantiate on pins 0 (Clk) and 1 (Dio)
-var display = new tm1637.TM1637(0, 1);
-
-// Get the current time
-var now = new Date();
-console.log("System time: " + now.getHours() + ":" + ("0" + now.getMinutes()).slice(-2));
-console.log("Time zone can be changed by setting the TZ environment variable.");
-
-// Display and time update function
-function update(){
- now = new Date();
- var time = now.getHours().toString() + ("0" + now.getMinutes().toString()).slice(-2);
- display.writeString(time);
- display.setColon(colon = !colon);
-}
-
-// Start with a 7-segment encoded box on the display
-display.write(0x39, 0x09, 0x09, 0x0f);
-
-// Start displaying the clock after 3 seconds
-setTimeout(function(){
- // And update every second thereafter
- interval = setInterval(update, 1000);
-}, 3000)
-
-// Exit handler
-process.on('SIGINT', function()
-{
- clearInterval(interval);
- display = null;
- tm1637.cleanUp();
- tm1637 = null;
- console.log("Interrupt received, exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/tp401.js b/peripheral/libupm/examples/javascript/tp401.js
deleted file mode 100644
index 6ab2b29..0000000
--- a/peripheral/libupm/examples/javascript/tp401.js
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Author: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-var upmTP401 = require('jsupm_gas');
-//var time = require('sleep');
-
-//give a qualitative meaning to the value from the sensor
-function airQuality(value)
-{
- if(value < 50) return "Fresh Air";
- if(value < 200) return "Normal Indoor Air";
- if(value < 400) return "Low Pollution";
- if(value < 600) return "High Pollution - Action Recommended";
- return "Very High Pollution - Take Action Immediately";
-}
-
-function loop()
-{
- //read values (consecutive reads might vary slightly)
- var value = airSensor.getSample();
- var ppm = airSensor.getPPM();
-
- //write the sensor values to the console
- console.log("raw: " + value + " ppm: " + (" " + ppm.toFixed(2)).substring(-5, 5) + " " + airQuality(value));
-
- //wait 2.5 s then call function again
- setTimeout(loop, 2500);
-}
-
-//setup sensor on Analog pin #0 (A0)
-var airSensor = new upmTP401.TP401(0);
-
-//warm up sensor
-console.log("Sensor is warming up for 3 minutes..");
-var i = 1;
-
-//print a message every passing minute
-var waiting = setInterval(function() {
- console.log(i++ + " minute(s) passed.");
- if(i == 3) clearInterval(waiting);
- }, 60000);
-
-//start loop in 3 minutes
-setTimeout(function(){
- console.log("Sensor is ready!");
- loop();
- }, 180000);
diff --git a/peripheral/libupm/examples/javascript/tsl2561.js b/peripheral/libupm/examples/javascript/tsl2561.js
deleted file mode 100644
index cd3d7ff..0000000
--- a/peripheral/libupm/examples/javascript/tsl2561.js
+++ /dev/null
@@ -1,44 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*global */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2014 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var digitalLightSensor = require('jsupm_tsl2561');
-
-// Instantiate a digital light sensor TSL2561 on I2C
-var myDigitalLightSensor = new digitalLightSensor.TSL2561();
-
-
-setInterval(function()
-{
- console.log("Light value is " + myDigitalLightSensor.getLux());
-}, 1000);
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/ttp223.js b/peripheral/libupm/examples/javascript/ttp223.js
deleted file mode 100644
index 8814556..0000000
--- a/peripheral/libupm/examples/javascript/ttp223.js
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Author: Sarah Knepper <sarah.knepper@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-// Load TTP223 touch sensor module
-var sensorModule = require('jsupm_ttp223');
-
-// Create the TTP223 touch sensor object using GPIO pin 0
-var touch = new sensorModule.TTP223(0);
-
-// Check whether or not a finger is near the touch sensor and
-// print accordingly, waiting one second between readings
-function readSensorValue() {
- if ( touch.isPressed() ) {
- console.log(touch.name() + " is pressed");
- } else {
- console.log(touch.name() + " is not pressed");
- }
-}
-setInterval(readSensorValue, 1000);
diff --git a/peripheral/libupm/examples/javascript/ublox6.js b/peripheral/libupm/examples/javascript/ublox6.js
deleted file mode 100644
index d68640a..0000000
--- a/peripheral/libupm/examples/javascript/ublox6.js
+++ /dev/null
@@ -1,84 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*global */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2014 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var GPSSensor = require('jsupm_ublox6');
-
-// Instantiate a Ublox6 GPS device on uart 0.
-var myGPSSensor = new GPSSensor.Ublox6(0);
-
-if (!myGPSSensor.setupTty(GPSSensor.int_B9600))
-{
- console.log("Failed to setup tty port parameters");
- process.exit(0);
-}
-
-// Collect and output NMEA data.
-
-// This device also supports numerous configuration options, which
-// you can set with writeData(). Please refer to the Ublox-6 data
-// sheet for further information on the formats of the data sent and
-// received, and the various operating modes available.
-
-var bufferLength = 256;
-var nmeaBuffer = new GPSSensor.charArray(bufferLength);
-
-function getGPSInfo()
-{
- // we don't want the read to block in this example, so always
- // check to see if data is available first.
- if (myGPSSensor.dataAvailable())
- {
- var rv = myGPSSensor.readData(nmeaBuffer, bufferLength);
-
- var GPSData, dataCharCode, isNewLine, lastNewLine;
- var numlines= 0;
- if (rv > 0)
- {
- GPSData = "";
- // read only the number of characters
- // specified by myGPSSensor.readData
- for (var x = 0; x < rv; x++)
- GPSData += nmeaBuffer.getitem(x);
- process.stdout.write(GPSData)
- }
-
- if (rv < 0) // some sort of read error occured
- {
- console.log("Port read error.");
- process.exit(0);
- }
- }
-}
-
-setInterval(getGPSInfo, 100);
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/uln200xa.js b/peripheral/libupm/examples/javascript/uln200xa.js
deleted file mode 100644
index 4101707..0000000
--- a/peripheral/libupm/examples/javascript/uln200xa.js
+++ /dev/null
@@ -1,71 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Jon Trulson <jtrulson@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var Uln200xa_lib = require('jsupm_uln200xa');
-
-// Instantiate a Stepper motor on a ULN200XA Darlington Motor Driver
-// This was tested with the Grove Geared Step Motor with Driver
-
-// Instantiate a ULN2003XA stepper object
-var myUln200xa_obj = new Uln200xa_lib.ULN200XA(4096, 8, 9, 10, 11);
-
-myUln200xa_obj.goForward = function()
-{
- myUln200xa_obj.setSpeed(5); // 5 RPMs
- myUln200xa_obj.setDirection(Uln200xa_lib.ULN200XA.DIR_CW);
- console.log("Rotating 1 revolution clockwise.");
- myUln200xa_obj.stepperSteps(4096);
-};
-
-myUln200xa_obj.reverseDirection = function()
-{
- console.log("Rotating 1/2 revolution counter clockwise.");
- myUln200xa_obj.setDirection(Uln200xa_lib.ULN200XA.DIR_CCW);
- myUln200xa_obj.stepperSteps(2048);
-};
-
-myUln200xa_obj.stop = function()
-{
- myUln200xa_obj.release();
-};
-
-myUln200xa_obj.quit = function()
-{
- myUln200xa_obj = null;
- Uln200xa_lib.cleanUp();
- Uln200xa_lib = null;
- console.log("Exiting");
- process.exit(0);
-};
-
-// Run ULN200xa driven stepper
-myUln200xa_obj.goForward();
-setTimeout(myUln200xa_obj.reverseDirection, 2000);
-setTimeout(function()
-{
- myUln200xa_obj.stop();
- myUln200xa_obj.quit();
-}, 2000);
diff --git a/peripheral/libupm/examples/javascript/urm37-uart.js b/peripheral/libupm/examples/javascript/urm37-uart.js
deleted file mode 100644
index ee81cc5..0000000
--- a/peripheral/libupm/examples/javascript/urm37-uart.js
+++ /dev/null
@@ -1,52 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-var sensorObj = require('jsupm_urm37');
-
-// Instantiate a URM37 sensor on UART 0, with the reset pin on D2
-var sensor = new sensorObj.URM37(0, 2);
-
-// Every half a second, sample the URM37 and output the measured
-// distance in cm, and temperature in degrees C
-
-setInterval(function()
-{
- console.log("Detected distance (cm): " + sensor.getDistance());
- console.log("Temperature (C): " + sensor.getTemperature());
-}, 500);
-
-// exit on ^C
-process.on('SIGINT', function()
-{
- sensor = null;
- sensorObj.cleanUp();
- sensorObj = null;
- console.log("Exiting.");
- process.exit(0);
-});
-
diff --git a/peripheral/libupm/examples/javascript/urm37.js b/peripheral/libupm/examples/javascript/urm37.js
deleted file mode 100644
index 17b1c16..0000000
--- a/peripheral/libupm/examples/javascript/urm37.js
+++ /dev/null
@@ -1,52 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-var sensorObj = require('jsupm_urm37');
-
-// Instantiate a URM37 sensor on analog pin A0, reset pin on D2,
-// trigger pin on D3 with an analog reference voltage of 5.0
-var sensor = new sensorObj.URM37(0, 2, 3, 5.0);
-
-// Every half a second, sample the URM37 and output the measured
-// distance in cm.
-
-setInterval(function()
-{
- console.log("Detected distance (cm): " + sensor.getDistance());
-}, 500);
-
-// exit on ^C
-process.on('SIGINT', function()
-{
- sensor = null;
- sensorObj.cleanUp();
- sensorObj = null;
- console.log("Exiting.");
- process.exit(0);
-});
-
diff --git a/peripheral/libupm/examples/javascript/waterlevel.js b/peripheral/libupm/examples/javascript/waterlevel.js
deleted file mode 100644
index bb4d0af..0000000
--- a/peripheral/libupm/examples/javascript/waterlevel.js
+++ /dev/null
@@ -1,50 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var waterlevel_lib = require("jsupm_waterlevel");
-
-// The was tested with the Water Level Sensor
-// Instantiate a Water Level Sensor on digital pin D2
-var waterlevel_obj = new waterlevel_lib.WaterLevel(2);
-
-var myInterval = setInterval(function()
-{
- if (waterlevel_obj.isSubmerged())
- console.log("Sensor is submerged in liquid");
- else
- console.log("Liquid is below water level sensor");
-}, 1000);
-
-// When exiting: clear interval, clean up memory, and print message
-process.on('SIGINT', function()
-{
- clearInterval(myInterval);
- waterlevel_obj = null;
- waterlevel_lib.cleanUp();
- waterlevel_lib = null;
- console.log("Exiting");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/wheelencoder.js b/peripheral/libupm/examples/javascript/wheelencoder.js
deleted file mode 100644
index 532ea02..0000000
--- a/peripheral/libupm/examples/javascript/wheelencoder.js
+++ /dev/null
@@ -1,54 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-var sensorObj = require('jsupm_wheelencoder');
-
-// Instantiate a DFRobot Wheel Encoder on digital pin D2
-var sensor = new sensorObj.WheelEncoder(2);
-
-// set the counter to 0 and start counting
-sensor.clearCounter();
-sensor.startCounter();
-
-setInterval(function()
-{
- // output milliseconds passed and current sensor count
- console.log("Millis: " + sensor.getMillis() + " Count: " +
- sensor.counter());
-}, 1000);
-
-// exit on ^C
-process.on('SIGINT', function()
-{
- sensor = null;
- sensorObj.cleanUp();
- sensorObj = null;
- console.log("Exiting.");
- process.exit(0);
-});
-
diff --git a/peripheral/libupm/examples/javascript/wt5001.js b/peripheral/libupm/examples/javascript/wt5001.js
deleted file mode 100644
index ca58b04..0000000
--- a/peripheral/libupm/examples/javascript/wt5001.js
+++ /dev/null
@@ -1,130 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*global */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var MP3Player = require('jsupm_wt5001');
-
-function printUsage(progname)
-{
- console.log("Usage: node " + progname + " <command>");
- console.log("Commands:");
- console.log("0 - stop playing");
- console.log("1 - start playing track 1");
- console.log("2 - pause/un-pause playback");
- console.log("3 - next track");
- console.log("4 - previous track");
-}
-
-// Instantiate a WT5001 serial MP3 player on uart 0.
-// This example was tested on the Grove Serial MP3 module.
-
-var myMP3Player = new MP3Player.WT5001(0);
-
-var cmd = -1;
-if (process.argv.length > 2)
- cmd = parseInt(process.argv[2]);
-
-if (!myMP3Player.setupTty(MP3Player.int_B9600))
-{
- console.log("Failed to setup tty port parameters");
- process.exit(0);
-}
-
-switch (cmd)
-{
- case 0:
- myMP3Player.stop();
- break;
-
- case 1:
- myMP3Player.play(MP3Player.WT5001.SD, 1);
- break;
-
- case 2:
- myMP3Player.pause();
- break;
-
- case 3:
- myMP3Player.next();
- break;
-
- case 4:
- myMP3Player.previous();
- break;
-
- default:
- // nothing, just output usage, and info below
- printUsage(process.argv[1]);
- break;
-}
-
-// print out some information
-var vol = new MP3Player.uint8Array(0);
-myMP3Player.getVolume(vol);
-console.log("The current volume is: " + vol.getitem(0));
-
-var ps = new MP3Player.uint8Array(0);
-myMP3Player.getPlayState(ps);
-console.log("The current play state is: " + ps.getitem(0));
-
-var numf = new MP3Player.uint16Array(0);
-myMP3Player.getNumFiles(MP3Player.WT5001.SD, numf);
-console.log("The number of files on the SD card is: " + numf.getitem(0));
-
-var curf = new MP3Player.uint16Array(0);
-myMP3Player.getCurrentFile(curf);
-console.log("The current file is: " + curf.getitem(0));
-
-// set the date
-myMP3Player.setDate(2015, 3, 14);
-
-// set the time
-myMP3Player.setTime(9, 26, 53);
-
-var year = new MP3Player.uint16Array(0);
-var month = new MP3Player.uint8Array(0);
-var day = new MP3Player.uint8Array(0);
-myMP3Player.getDate(year, month, day);
-var mp3date = month.getitem(0) + "/";
-mp3date += (day.getitem(0) + "/");
-mp3date += year.getitem(0);
-console.log("The device date is: " + mp3date);
-
-var hour = new MP3Player.uint8Array(0);
-var minute = new MP3Player.uint8Array(0);
-var second = new MP3Player.uint8Array(0);
-myMP3Player.getTime(hour, minute, second);
-var mp3time = hour.getitem(0) + ":";
-mp3time += (minute.getitem(0) + ":");
-mp3time += second.getitem(0);
-console.log("The device time is: " + mp3time);
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/xbee.js b/peripheral/libupm/examples/javascript/xbee.js
deleted file mode 100644
index bd8603e..0000000
--- a/peripheral/libupm/examples/javascript/xbee.js
+++ /dev/null
@@ -1,140 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-var sensorObj = require('jsupm_xbee');
-
-
-/************** Functions **************/
-function printUsage(progname)
-{
- var outputStr = "Usage: " + progname + " [AT command]\n\n" +
- "If an argument is supplied on the command line, that argument is\n" +
- "sent to the module and the response is printed out.\n\n" +
- "If no argument is used, then the firmware revision, serial number\n" +
- "and the current IP address (if set) are queried.\n\n"
- console.log(outputStr);
-}
-
-// simple helper function to send a command and wait for a response
-function sendCommand(sensor, cmd)
-{
- // commands need to be terminated with a carriage return
- cmd += "\r";
- sensor.writeDataStr(cmd);
-
- var resp = "";
- while (sensor.dataAvailable(2000))
- {
- resp += sensor.readDataStr(1024);
- }
-
- if (!resp)
- {
- console.log("Timed out waiting for response");
- }
- else
- {
- resp = sensor.stringCR2LF(resp);
- console.log("Returned (" + resp.length + " bytes):");
- console.log(resp);
- }
-}
-
-/************** Main code **************/
-// Instantiate a XBEE Module on UART 0
-var sensor = new sensorObj.XBee(0);
-
-// Set the baud rate, 9600 baud is the default.
-if (sensor.setBaudRate(9600))
-{
- console.log("Failed to set baud rate");
- process.exit(0);
-}
-
-printUsage(process.argv[1]);
-
-// Note: in nodeJS, command-line argument 0 is "node".
-// Command-line argument 1 is "xbee.js"
-// If you have a third argument, then it's a command
-if (process.argv.length > 2)
-{
- // enable command mode
- sensor.commandMode();
- console.log("Sending command line argument (" + process.argv[2] + ")...");
- sendCommand(sensor, process.argv[2]);
-}
-else
-{
- // enable command mode
- sensor.commandMode();
- // query the verbose firmware revision
- console.log("Querying verbose firmware revision (ATVL)...");
- sendCommand(sensor, "ATVL");
- // query the number
- console.log("Querying Serial Number High (ATSH)...");
- sendCommand(sensor, "ATSH");
- console.log("Querying Serial Number Low (ATSL)...");
- sendCommand(sensor, "ATSL");
-
- console.log("Querying address, if set (ATMY)...");
- sendCommand(sensor, "ATMY");
-
- // For the XBee WiFi S6B
- // A comprehensive list of commands and command modes is
- // available from the datasheet at:
- // ftp1.digi.com/support/documentation/90002180_L.pdf
-
- // For the XBee S1
- // A comprehensive list of commands and command modes is
- // available from the datasheet at:
- // http://www.sparkfun.com/datasheets/Wireless/Zigbee/XBee-Datasheet.pdf
-
- // For the XBee WiFi module:
- // An example using AT commands to connect to an AP, with a
- // private Key using WPA2:
-
- // Connect to AP with SSID 'mySSID':
- // ATIDmySSID
-
- // Provide the private key 'secret':
- // ATPKsecret
-
- // Use WPA2 encryption
- // ATEE2
-}
-
-
-/************** Exit code **************/
-process.on('SIGINT', function()
-{
- sensor = null;
- sensorObj.cleanUp();
- sensorObj = null;
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/yg1006.js b/peripheral/libupm/examples/javascript/yg1006.js
deleted file mode 100644
index be6887d..0000000
--- a/peripheral/libupm/examples/javascript/yg1006.js
+++ /dev/null
@@ -1,47 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*global */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2014 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var flameSensor = require('jsupm_yg1006');
-
-// Instantiate a flame sensor on digital pin D2
-var myFlameSensor = new flameSensor.YG1006(2);
-
-// Check every second for the presence of a flame
-setInterval(function()
-{
- if (myFlameSensor.flameDetected())
- console.log("Flame detected.");
- else
- console.log("No flame detected.");
-}, 1000);
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/zfm20-register.js b/peripheral/libupm/examples/javascript/zfm20-register.js
deleted file mode 100644
index 53938ed..0000000
--- a/peripheral/libupm/examples/javascript/zfm20-register.js
+++ /dev/null
@@ -1,137 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-var fingerprint_lib = require('jsupm_zfm20');
-
-// Instantiate a ZFM20 Fingerprint reader on UART 0
-var myFingerprintSensor = new fingerprint_lib.ZFM20(0);
-
-// make sure port is initialized properly. 57600 baud is the default.
-if (!myFingerprintSensor.setupTty(fingerprint_lib.int_B57600))
-{
- console.log("Failed to setup tty port parameters");
- process.exit(1);
-}
-
-// This example demonstrates registering a fingerprint on the zfm20
-// module. The procedure is as follows:
-//
-// 1. get an image, store it in characteristics buffer 1
-// 2. get another image, store it in characteristics buffer 2
-// 3. store the image, assuming the two fingerprints match
-
-// first, we need to register our address and password
-myFingerprintSensor.setPassword(fingerprint_lib.ZFM20_DEFAULT_PASSWORD);
-myFingerprintSensor.setAddress(fingerprint_lib.ZFM20_DEFAULT_ADDRESS);
-
-// now verify the password. If this fails, any other commands
-// will be ignored, so we just bail.
-if (myFingerprintSensor.verifyPassword())
- console.log("Password verified.");
-else
-{
- console.log("Password verification failed.");
- process.exit(1);
-}
-
-console.log(" ");
-
-// get the first image
-console.log("Place a finger on the sensor.");
-while (myFingerprintSensor.generateImage() != fingerprint_lib.ZFM20.ERR_OK)
- ;
-
-// in theory, we have an image
-console.log("Image captured, converting...");
-
-var rv = myFingerprintSensor.image2Tz(1);
-
-if (rv != fingerprint_lib.ZFM20.ERR_OK)
-{
- console.log("Image conversion failed with error code " + rv);
- process.exit(1)
-}
-
-console.log("Image conversion succeeded, remove finger.");
-setTimeout(function()
-{
- while (myFingerprintSensor.generateImage() != fingerprint_lib.ZFM20.ERR_NO_FINGER)
- ;
-
- console.log(" ");
- console.log("Now place the same finger on the sensor.");
-
- while (myFingerprintSensor.generateImage() == fingerprint_lib.ZFM20.ERR_NO_FINGER)
- ;
-
- console.log("Image captured, converting...");
-
- // save this one in slot 2
- rv = myFingerprintSensor.image2Tz(2)
- if (rv != fingerprint_lib.ZFM20.ERR_OK)
- {
- console.log("Image conversion failed with error code %d" + rv);
- process.exit(1);
- }
-
- console.log("Image conversion succeeded, remove finger.");
- console.log(" ");
-
- console.log("Storing fingerprint at id 1");
-
- // create the model
- rv = myFingerprintSensor.createModel()
- if (rv != fingerprint_lib.ZFM20.ERR_OK)
- {
- if (rv == fingerprint_lib.ZFM20.ERR_FP_ENROLLMISMATCH)
- console.log("Fingerprints did not match.");
- else
- console.log("createModel failed with error code " + rv);
- process.exit(1);
- }
-
- // now store it, we hard code the id (second arg) to 1 here
- rv = myFingerprintSensor.storeModel(1, 1);
- if (rv != fingerprint_lib.ZFM20.ERR_OK)
- {
- console.log("storeModel failed with error code " + rv);
- process.exit(1);
- }
-
- console.log(" ");
- console.log("Fingerprint stored at id 1.");
-}, 1000);
-
-// Print message when exiting
-function exit()
-{
- myFingerprintSensor = null;
- fingerprint_lib.cleanUp();
- fingerprint_lib = null;
- console.log("Exiting");
- process.exit(0);
-}
-process.on('exit', exit);
-process.on('SIGINT', exit);
diff --git a/peripheral/libupm/examples/javascript/zfm20.js b/peripheral/libupm/examples/javascript/zfm20.js
deleted file mode 100644
index 5733e9d..0000000
--- a/peripheral/libupm/examples/javascript/zfm20.js
+++ /dev/null
@@ -1,97 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-var fingerprint_lib = require('jsupm_zfm20');
-
-// Instantiate a ZFM20 Fingerprint reader on UART 0
-var myFingerprintSensor = new fingerprint_lib.ZFM20(0);
-
-// make sure port is initialized properly. 57600 baud is the default.
-if (!myFingerprintSensor.setupTty(fingerprint_lib.int_B57600))
-{
- console.log("Failed to setup tty port parameters");
- process.exit(1);
-}
-
-// how many valid stored templates (fingerprints) do we have?
-console.log("Total stored templates: " + myFingerprintSensor.getNumTemplates());
-console.log(" ");
-
-// now spin waiting for a fingerprint to successfully image
-console.log("Waiting for finger print...");
-
-while (myFingerprintSensor.generateImage() == fingerprint_lib.ZFM20.ERR_NO_FINGER)
- ;
-
-// in theory, we have an image
-console.log("Image captured, converting...");
-
-var rv = myFingerprintSensor.image2Tz(1);
-if (rv != fingerprint_lib.ZFM20.ERR_OK)
-{
- console.log("Image conversion failed with error code " + rv);
- process.exit(1);
-}
-
-console.log("Image conversion succeeded.");
-console.log("Searching database...");
-
-var myid = new fingerprint_lib.uint16Array(0);
-myid.setitem(0, 0);
-var myscore = new fingerprint_lib.uint16Array(0);
-myscore.setitem(0, 0);
-
-// we search for a print matching slot 1, where we stored our last
-// converted fingerprint
-rv = myFingerprintSensor.search(1, myid, myscore)
-if (rv != fingerprint_lib.ZFM20.ERR_OK)
-{
- if (rv == fingerprint_lib.ZFM20.ERR_FP_NOTFOUND)
- {
- console.log("Finger Print not found");
- process.exit(0);
- }
- else
- {
- console.log("Search failed with error code " + rv);
- process.exit(1);
- }
-}
-
-console.log("Fingerprint found!");
-console.log("ID: " + myid.getitem(0) + ", Score: " + myscore.getitem(0));
-
-
-// Print message when exiting
-function exit()
-{
- myFingerprintSensor = null;
- fingerprint_lib.cleanUp();
- fingerprint_lib = null;
- console.log("Exiting");
- process.exit(0);
-}
-process.on('SIGINT', exit);
-process.on('exit', exit);
diff --git a/peripheral/libupm/examples/python/a110x.py b/peripheral/libupm/examples/python/a110x.py
deleted file mode 100644
index 15ba01e..0000000
--- a/peripheral/libupm/examples/python/a110x.py
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_a110x as upmA110x
-
-# Instantiate a Hall Effect magnet sensor on digital pin D2
-myHallEffectSensor = upmA110x.A110X(2)
-
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit, including functions from myHallEffectSensor
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-while(1):
- if (myHallEffectSensor.magnetDetected()):
- print "Magnet (south polarity) detected."
- else:
- print "No magnet detected."
- time.sleep(1)
diff --git a/peripheral/libupm/examples/python/ad8232.py b/peripheral/libupm/examples/python/ad8232.py
deleted file mode 100644
index 97284ad..0000000
--- a/peripheral/libupm/examples/python/ad8232.py
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_ad8232 as upmAD8232
-
-# Instantiate a AD8232 sensor on digital pins 10 (LO+), 11 (LO-)
-# and an analog pin, 0 (OUTPUT)
-myAD8232 = upmAD8232.AD8232(10, 11, 0)
-
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit, including functions from myAD8232
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-# Output the raw numbers from the ADC, for plotting elsewhere.
-# A return of 0 indicates a Lead Off (LO) condition.
-# In theory, this data could be fed to software like Processing
-# (https://www.processing.org/) to plot the data just like an
-# EKG you would see in a hospital.
-while(1):
- print myAD8232.value()
- time.sleep(.001)
diff --git a/peripheral/libupm/examples/python/adafruitms1438-stepper.py b/peripheral/libupm/examples/python/adafruitms1438-stepper.py
deleted file mode 100644
index 5385951..0000000
--- a/peripheral/libupm/examples/python/adafruitms1438-stepper.py
+++ /dev/null
@@ -1,88 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_adafruitms1438 as upmAdafruitms1438
-
-
-# Import header values
-I2CBus = upmAdafruitms1438.ADAFRUITMS1438_I2C_BUS
-I2CAddr = upmAdafruitms1438.ADAFRUITMS1438_DEFAULT_I2C_ADDR
-
-M12Motor = upmAdafruitms1438.AdafruitMS1438.STEPMOTOR_M12
-MotorDirCW = upmAdafruitms1438.AdafruitMS1438.DIR_CW
-MotorDirCCW = upmAdafruitms1438.AdafruitMS1438.DIR_CCW
-
-
-# Instantiate an Adafruit MS 1438 on I2C bus 0
-myMotorShield = upmAdafruitms1438.AdafruitMS1438(I2CBus, I2CAddr)
-
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit,
-# including functions from myMotorShield
-def exitHandler():
- myMotorShield.disableStepper(M12Motor)
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-# Setup for use with a stepper motor connected to the M1 & M2 ports
-
-# set a PWM period of 50Hz
-
-# disable first, to be safe
-myMotorShield.disableStepper(M12Motor)
-
-# configure for a NEMA-17, 200 steps per revolution
-myMotorShield.stepConfig(M12Motor, 200)
-
-# set speed at 10 RPM's
-myMotorShield.setStepperSpeed(M12Motor, 10);
-myMotorShield.setStepperDirection(M12Motor, MotorDirCW)
-
-# enable
-print "Enabling..."
-myMotorShield.enableStepper(M12Motor)
-
-print "Rotating 1 full revolution at 10 RPM speed."
-myMotorShield.stepperSteps(M12Motor, 200)
-
-print "Sleeping for 2 seconds..."
-time.sleep(2)
-print "Rotating 1/2 revolution in opposite direction at 10 RPM speed."
-
-myMotorShield.setStepperDirection(M12Motor, MotorDirCCW)
-myMotorShield.stepperSteps(M12Motor, 100)
-
-print "Disabling..."
-
-# exitHandler runs automatically
diff --git a/peripheral/libupm/examples/python/adafruitms1438.py b/peripheral/libupm/examples/python/adafruitms1438.py
deleted file mode 100644
index 816bbe5..0000000
--- a/peripheral/libupm/examples/python/adafruitms1438.py
+++ /dev/null
@@ -1,83 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_adafruitms1438 as upmAdafruitms1438
-
-
-# Import header values
-I2CBus = upmAdafruitms1438.ADAFRUITMS1438_I2C_BUS
-I2CAddr = upmAdafruitms1438.ADAFRUITMS1438_DEFAULT_I2C_ADDR
-
-M3Motor = upmAdafruitms1438.AdafruitMS1438.MOTOR_M3
-MotorDirCW = upmAdafruitms1438.AdafruitMS1438.DIR_CW
-MotorDirCCW = upmAdafruitms1438.AdafruitMS1438.DIR_CCW
-
-
-# Instantiate an Adafruit MS 1438 on I2C bus 0
-myMotorShield = upmAdafruitms1438.AdafruitMS1438(I2CBus, I2CAddr)
-
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit,
-# including functions from myMotorShield
-def exitHandler():
- myMotorShield.disableMotor(M3Motor)
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-# Setup for use with a DC motor connected to the M3 port
-
-# set a PWM period of 50Hz
-myMotorShield.setPWMPeriod(50)
-
-# disable first, to be safe
-myMotorShield.disableMotor(M3Motor)
-
-# set speed at 50%
-myMotorShield.setMotorSpeed(M3Motor, 50)
-myMotorShield.setMotorDirection(M3Motor, MotorDirCW)
-
-print ("Spin M3 at half speed for 3 seconds, "
-"then reverse for 3 seconds.")
-myMotorShield.enableMotor(M3Motor)
-
-time.sleep(3)
-
-print "Reversing M3"
-myMotorShield.setMotorDirection(M3Motor, MotorDirCCW)
-
-time.sleep(3)
-
-print "Stopping M3"
-
-# exitHandler runs automatically
diff --git a/peripheral/libupm/examples/python/adc121c021.py b/peripheral/libupm/examples/python/adc121c021.py
deleted file mode 100644
index 61500c4..0000000
--- a/peripheral/libupm/examples/python/adc121c021.py
+++ /dev/null
@@ -1,55 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_adc121c021 as upmAdc121c021
-
-# Instantiate an ADC121C021 on I2C bus 0
-busID = upmAdc121c021.ADC121C021_I2C_BUS
-I2CAddr = upmAdc121c021.ADC121C021_DEFAULT_I2C_ADDR
-
-myAnalogDigitalConv = upmAdc121c021.ADC121C021(busID, I2CAddr)
-
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This lets you run code on exit,
-# including functions from myAnalogDigitalConv
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-# get the data every 50 milliseconds
-while(1):
- val = myAnalogDigitalConv.value()
- voltsVal = myAnalogDigitalConv.valueToVolts(val)
- print "ADC value: %s Volts = %s" % (val, voltsVal)
- time.sleep(.05)
diff --git a/peripheral/libupm/examples/python/adxl335.py b/peripheral/libupm/examples/python/adxl335.py
deleted file mode 100644
index bc62181..0000000
--- a/peripheral/libupm/examples/python/adxl335.py
+++ /dev/null
@@ -1,78 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_adxl335 as upmAdxl335
-
-myAnalogAccel = upmAdxl335.ADXL335(0, 1, 2)
-
-print "Please make sure the sensor is completely still."
-print "Sleeping for 2 seconds"
-time.sleep(2)
-
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit,
-# including functions from myAnalogAccel
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-print "Calibrating..."
-myAnalogAccel.calibrate()
-
-x = upmAdxl335.new_intPointer()
-y = upmAdxl335.new_intPointer()
-z = upmAdxl335.new_intPointer()
-
-aX = upmAdxl335.new_floatPointer()
-aY = upmAdxl335.new_floatPointer()
-aZ = upmAdxl335.new_floatPointer()
-
-while (1):
- myAnalogAccel.values(x, y, z)
- outputStr = "Raw Values: X: {0} Y: {1} Z: {2}".format(
- upmAdxl335.intPointer_value(x), upmAdxl335.intPointer_value(y),
- upmAdxl335.intPointer_value(z))
- print outputStr
-
- myAnalogAccel.acceleration(aX, aY, aZ)
- outputStr = ("Acceleration: X: {0}g\n"
- "Acceleration: Y: {1}g\n"
- "Acceleration: Z: {2}g").format(upmAdxl335.floatPointer_value(aX),
- upmAdxl335.floatPointer_value(aY),
- upmAdxl335.floatPointer_value(aZ))
- print outputStr
-
- print " "
-
- time.sleep(.2)
diff --git a/peripheral/libupm/examples/python/adxl345.py b/peripheral/libupm/examples/python/adxl345.py
deleted file mode 100644
index d19110a..0000000
--- a/peripheral/libupm/examples/python/adxl345.py
+++ /dev/null
@@ -1,41 +0,0 @@
-# Author: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
-# Copyright (c) 2014 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-from time import sleep
-import pyupm_adxl345 as adxl345
-
-# Create an I2C accelerometer object
-adxl = adxl345.Adxl345(0)
-
-# Loop indefinitely
-while True:
-
- adxl.update() # Update the data
- raw = adxl.getRawValues() # Read raw sensor data
- force = adxl.getAcceleration() # Read acceleration force (g)
- print "Raw: %6d %6d %6d" % (raw[0], raw[1], raw[2])
- print "ForceX: %5.2f g" % (force[0])
- print "ForceY: %5.2f g" % (force[1])
- print "ForceZ: %5.2f g\n" % (force[2])
-
- # Sleep for 1 s
- sleep(1)
diff --git a/peripheral/libupm/examples/python/adxrs610.py b/peripheral/libupm/examples/python/adxrs610.py
deleted file mode 100644
index 5183e7b..0000000
--- a/peripheral/libupm/examples/python/adxrs610.py
+++ /dev/null
@@ -1,55 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_adxrs610 as sensorObj
-
-# Instantiate a ADXRS610 sensor on analog pin A0 (dataout), and
-# analog A1 (temp out) with an analog reference voltage of
-# 5.0
-sensor = sensorObj.ADXRS610(0, 1, 5.0)
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-# set a deadband region around the zero point to report 0.0 (optional)
-sensor.setDeadband(0.015);
-
-# Every tenth of a second, sample the ADXRS610 and output it's
-# corresponding temperature and angular velocity
-
-while (1):
- print "Vel (deg/s):", sensor.getAngularVelocity()
- print "Temp (C):", sensor.getTemperature()
- time.sleep(.1)
diff --git a/peripheral/libupm/examples/python/ak8975.py b/peripheral/libupm/examples/python/ak8975.py
deleted file mode 100644
index ad19df9..0000000
--- a/peripheral/libupm/examples/python/ak8975.py
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_mpu9150 as sensorObj
-
-# Instantiate an AK8975 on I2C bus 0
-sensor = sensorObj.AK8975()
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-sensor.init()
-
-x = sensorObj.new_floatp()
-y = sensorObj.new_floatp()
-z = sensorObj.new_floatp()
-
-while (1):
- sensor.update()
- sensor.getMagnetometer(x, y, z)
- print "Magnetometer: MX: ", sensorObj.floatp_value(x),
- print " MY: ", sensorObj.floatp_value(y),
- print " MZ: ", sensorObj.floatp_value(z)
-
- print
-
- time.sleep(.5)
diff --git a/peripheral/libupm/examples/python/apds9002.py b/peripheral/libupm/examples/python/apds9002.py
deleted file mode 100644
index f9ea3cb..0000000
--- a/peripheral/libupm/examples/python/apds9002.py
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_apds9002 as upmApds9002
-
-# Instantiate a Grove Luminance sensor on analog pin A0
-myLuminance = upmApds9002.APDS9002(0)
-
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This lets you run code on exit, including functions from myLuminance
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-while(1):
- print "Luminance value is {0}".format(
- myLuminance.value())
-
- time.sleep(1)
diff --git a/peripheral/libupm/examples/python/at42qt1070.py b/peripheral/libupm/examples/python/at42qt1070.py
deleted file mode 100644
index 06addfe..0000000
--- a/peripheral/libupm/examples/python/at42qt1070.py
+++ /dev/null
@@ -1,79 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_at42qt1070 as upmAt42qt1070
-
-# functions
-def printButtons(touchObj):
- buttonPressed = False
- buttons = touchObj.getButtons()
-
- sys.stdout.write("Buttons Pressed: ")
- for i in range(7):
- if (buttons & (1 << i)):
- sys.stdout.write(str(i) + " ")
- buttonPressed = True
-
- if (not buttonPressed):
- sys.stdout.write("None")
-
- print " "
-
- if (touchObj.isCalibrating()):
- print "Calibration is occurring."
-
- if (touchObj.isOverflowed()):
- print "Overflow was detected."
-
-
-# Global code that runs on startup
-
-I2C_BUS = upmAt42qt1070.AT42QT1070_I2C_BUS
-DEFAULT_I2C_ADDR = upmAt42qt1070.AT42QT1070_DEFAULT_I2C_ADDR
-
-# Instantiate an AT42QT1070 on I2C bus 0
-myTouchSensor = upmAt42qt1070.AT42QT1070(I2C_BUS,
- DEFAULT_I2C_ADDR)
-
-
-# Exit handlers
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-
-# This function lets you run code on exit, including functions from myTouchSensor
-atexit.register(exitHandler)
-# This function stops python from printing a stacktrace when you hit control-C
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-# Print the button being touched every 0.1 seconds
-while(1):
- myTouchSensor.updateState()
- printButtons(myTouchSensor)
- time.sleep(.1)
diff --git a/peripheral/libupm/examples/python/biss0001.py b/peripheral/libupm/examples/python/biss0001.py
deleted file mode 100644
index ba8901d..0000000
--- a/peripheral/libupm/examples/python/biss0001.py
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_biss0001 as upmMotion
-
-# Instantiate a Grove Motion sensor on GPIO pin D2
-myMotion = upmMotion.BISS0001(2)
-
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit, including functions from myMotion
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-# Read the value every second and detect motion
-while(1):
- if (myMotion.value()):
- print "Detecting moving object"
- else:
- print "No moving objects detected"
- time.sleep(1)
diff --git a/peripheral/libupm/examples/python/bma220.py b/peripheral/libupm/examples/python/bma220.py
deleted file mode 100644
index 9db6cdf..0000000
--- a/peripheral/libupm/examples/python/bma220.py
+++ /dev/null
@@ -1,55 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_bma220 as sensorObj
-
-# Instantiate an BMA220 using default parameters (bus 0, addr 0x0a)
-sensor = sensorObj.BMA220()
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-x = sensorObj.new_floatp()
-y = sensorObj.new_floatp()
-z = sensorObj.new_floatp()
-
-while (1):
- sensor.update()
- sensor.getAccelerometer(x, y, z)
- print "Accelerometer: AX:", sensorObj.floatp_value(x),
- print " AY:", sensorObj.floatp_value(y),
- print " AZ:", sensorObj.floatp_value(z)
-
- time.sleep(.5)
diff --git a/peripheral/libupm/examples/python/bmpx8x.py b/peripheral/libupm/examples/python/bmpx8x.py
deleted file mode 100644
index 017fba5..0000000
--- a/peripheral/libupm/examples/python/bmpx8x.py
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_bmpx8x as upmBmpx8x
-
-# Load Barometer module on i2c
-myBarometer = upmBmpx8x.BMPX8X(0, upmBmpx8x.ADDR);
-
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit, including functions from myBarometer
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-# Print the pressure, altitude, sea level, and
-# temperature values every 0.1 seconds
-while(1):
- outputStr = ("pressure value = {0}"
- ", altitude value = {1}"
- ", sealevel value = {2}"
- ", temperature = {3}".format(
- myBarometer.getPressure(),
- myBarometer.getTemperature(),
- myBarometer.getAltitude(),
- myBarometer.getSealevelPressure()))
-
- print outputStr
- time.sleep(.1)
diff --git a/peripheral/libupm/examples/python/buzzer.py b/peripheral/libupm/examples/python/buzzer.py
deleted file mode 100644
index b1a3d18..0000000
--- a/peripheral/libupm/examples/python/buzzer.py
+++ /dev/null
@@ -1,45 +0,0 @@
-# Author: Sarah Knepper <sarah.knepper@intel.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time
-import pyupm_buzzer as upmBuzzer
-
-# Create the buzzer object using GPIO pin 5
-buzzer = upmBuzzer.Buzzer(5)
-
-chords = [upmBuzzer.DO, upmBuzzer.RE, upmBuzzer.MI, upmBuzzer.FA,
- upmBuzzer.SOL, upmBuzzer.LA, upmBuzzer.SI, upmBuzzer.DO,
- upmBuzzer.SI];
-
-# Print sensor name
-print buzzer.name()
-
-# Play sound (DO, RE, MI, etc.), pausing for 0.1 seconds between notes
-for chord_ind in range (0,7):
- # play each note for one second
- print buzzer.playSound(chords[chord_ind], 1000000)
- time.sleep(0.1)
-
-print "exiting application"
-
-# Delete the buzzer object
-del buzzer
diff --git a/peripheral/libupm/examples/python/cjq4435.py b/peripheral/libupm/examples/python/cjq4435.py
deleted file mode 100644
index a4ed268..0000000
--- a/peripheral/libupm/examples/python/cjq4435.py
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-from __future__ import division
-import time
-import pyupm_cjq4435 as upmCjq4435
-
-# Instantiate a CJQ4435 MOSFET on a PWM capable digital pin D3
-myMOSFETsensor = upmCjq4435.CJQ4435(3)
-
-
-myMOSFETsensor.setPeriodMS(10)
-myMOSFETsensor.enable(True)
-
-# start with a duty cycle of 0.0 (off) and increment to 1.0 (on)
-for i in range(11):
- myMOSFETsensor.setDutyCycle(i / 10)
- time.sleep(.1)
-time.sleep(1)
-
-# Now take it back down
-# start with a duty cycle of 1.0 (on) and decrement to 0.0 (off)
-for i in range(10, -1, -1):
- myMOSFETsensor.setDutyCycle(i / 10)
- time.sleep(.1)
-time.sleep(1)
diff --git a/peripheral/libupm/examples/python/dfrph.py b/peripheral/libupm/examples/python/dfrph.py
deleted file mode 100644
index 1fadf03..0000000
--- a/peripheral/libupm/examples/python/dfrph.py
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_dfrph as sensorObj
-
-# Instantiate a DFRPH sensor on analog pin A0, with an analog
-# reference voltage of 5.0
-sensor = sensorObj.DFRPH(0, 5.0)
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-# After calibration, set the offset (based on calibration with a pH
-# 7.0 buffer solution). See the UPM sensor documentation for
-# calibrations instructions.
-sensor.setOffset(0.065);
-
-# Every second, sample the pH and output it's corresponding
-# analog voltage.
-
-while (1):
- print "Detected volts: ", sensor.volts()
- print "pH value: ", sensor.pH()
- time.sleep(1)
diff --git a/peripheral/libupm/examples/python/ds1307.py b/peripheral/libupm/examples/python/ds1307.py
deleted file mode 100644
index 7d35d8e..0000000
--- a/peripheral/libupm/examples/python/ds1307.py
+++ /dev/null
@@ -1,60 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_ds1307 as upmDs1307
-
-# load RTC clock on i2c bus 0
-myRTCClock = upmDs1307.DS1307(0)
-
-def printTime(RTCObj):
- timeStr = "The time is: {0}/{1}/{2} {3}:{4}:{5}".format(
- RTCObj.month, RTCObj.dayOfMonth, RTCObj.year,
- RTCObj.hours, RTCObj.minutes, RTCObj.seconds)
-
- if (RTCObj.amPmMode):
- timeStr += (" PM " if RTCObj.pm else " AM ")
-
- print timeStr
-
- print "Clock is in", ("AM/PM mode"
- if RTCObj.amPmMode else "24hr mode")
-
-
-# always do this first
-print "Loading the current time... "
-result = myRTCClock.loadTime()
-if (not result):
- print "myRTCClock.loadTime() failed."
- sys.exit(0)
-
-printTime(myRTCClock);
-
-# set the year as an example
-print "setting the year to 50"
-myRTCClock.year = 50
-myRTCClock.setTime()
-
-# reload the time and print it
-myRTCClock.loadTime()
-printTime(myRTCClock)
diff --git a/peripheral/libupm/examples/python/eboled.py b/peripheral/libupm/examples/python/eboled.py
deleted file mode 100644
index b33aaba..0000000
--- a/peripheral/libupm/examples/python/eboled.py
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys
-
-import pyupm_i2clcd as lcdObj
-
-# setup with default values
-lcd = lcdObj.EBOLED();
-
-lcd.clear();
-lcd.setCursor(10, 15);
-lcd.write("Hello");
-lcd.setCursor(30, 15);
-lcd.write("World!");
-lcd.refresh();
-print "Sleeping for 5 seconds..."
-time.sleep(5)
-
-
-
diff --git a/peripheral/libupm/examples/python/enc03r.py b/peripheral/libupm/examples/python/enc03r.py
deleted file mode 100644
index 45db89f..0000000
--- a/peripheral/libupm/examples/python/enc03r.py
+++ /dev/null
@@ -1,64 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_enc03r as upmEnc03r
-
-# Instantiate an ENC03R on analog pin A0
-myAnalogGyro = upmEnc03r.ENC03R(0)
-
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit,
-# including functions from myAnalogGyro
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-CALIBRATION_SAMPLES = 1000
-
-print ("Please place the sensor in a stable location,\n"
-"and do not move it while calibration takes place.\n"
-"This may take a couple of minutes.")
-
-myAnalogGyro.calibrate(CALIBRATION_SAMPLES)
-print "Calibration complete. "
-print "Reference value: ", myAnalogGyro.calibrationValue()
-
-while(1):
- gyroVal = myAnalogGyro.value();
- outputStr = ("Raw value: {0}, "
- "angular velocity: {1}"
- " deg/s".format(gyroVal, myAnalogGyro.angularVelocity(gyroVal)))
- print outputStr
-
- time.sleep(.1)
diff --git a/peripheral/libupm/examples/python/es08a.py b/peripheral/libupm/examples/python/es08a.py
deleted file mode 100644
index 09a1284..0000000
--- a/peripheral/libupm/examples/python/es08a.py
+++ /dev/null
@@ -1,46 +0,0 @@
-# Author: John Van Drasek <john.r.van.drasek@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 time
-import pyupm_servo as servo
-
-# Create the servo object using D5
-gServo = servo.ES08A(5)
-
-for i in range(0,10):
- # Set the servo arm to 0 degrees
- gServo.setAngle(0)
- print 'Set angle to 0'
- time.sleep(1)
-
- # Set the servo arm to 90 degrees
- gServo.setAngle(90)
- print 'Set angle to 90'
- time.sleep(1)
-
- # Set the servo arm to 180 degrees
- gServo.setAngle(180)
- print 'Set angle to 180'
- time.sleep(1)
-
-# Delete the servo object
-del gServo
diff --git a/peripheral/libupm/examples/python/gp2y0a.py b/peripheral/libupm/examples/python/gp2y0a.py
deleted file mode 100644
index f736d2c..0000000
--- a/peripheral/libupm/examples/python/gp2y0a.py
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_gp2y0a as upmGp2y0a
-
-# Note, for the Grove 80cm version of this sensor, due to the way it is wired,
-# you need to plug this into the A0 port, where it will use the available
-# A1 pin for data.
-# Instantiate a GP2Y0A on analog pin A1
-myIRProximity = upmGp2y0a.GP2Y0A(1)
-
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This lets you run code on exit,
-# including functions from myIRProximity
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-# analog voltage, usually 3.3 or 5.0
-GP2Y0A_AREF = 5.0;
-SAMPLES_PER_QUERY = 20;
-
-# The higher the voltage (closer to AREF) the closer the object is.
-# NOTE: The measured voltage will probably not exceed 3.3 volts.
-# Every second, print the averaged voltage value
-# (averaged over 20 samples).
-while (1):
- print "AREF: {0}, Voltage value (higher means closer): {1}".format(
- GP2Y0A_AREF,
- myIRProximity.value(GP2Y0A_AREF, SAMPLES_PER_QUERY))
- time.sleep(1)
diff --git a/peripheral/libupm/examples/python/grovebutton.py b/peripheral/libupm/examples/python/grovebutton.py
deleted file mode 100644
index c62c399..0000000
--- a/peripheral/libupm/examples/python/grovebutton.py
+++ /dev/null
@@ -1,35 +0,0 @@
-# Author: Sarah Knepper <sarah.knepper@intel.com>
-# Copyright (c) 2014 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time
-import pyupm_grove as grove
-
-# Create the button object using GPIO pin 0
-button = grove.GroveButton(0)
-
-# Read the input and print, waiting one second between readings
-while 1:
- print button.name(), ' value is ', button.value()
- time.sleep(1)
-
-# Delete the button object
-del button
diff --git a/peripheral/libupm/examples/python/grovecircularled.py b/peripheral/libupm/examples/python/grovecircularled.py
deleted file mode 100644
index 1c5a485..0000000
--- a/peripheral/libupm/examples/python/grovecircularled.py
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/usr/bin/python
-#
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_my9221 as upmGroveCircularLED
-
-# Exit handlers
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-def exitHandler():
- circle.setLevel(0, True)
- print "Exiting"
- sys.exit(0)
-
-# This function lets you run code on exit
-atexit.register(exitHandler)
-# This function stops python from printing a stacktrace when you hit control-C
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-# Instantiate a Grove Circular LED on gpio pins 9 and 8
-circle = upmGroveCircularLED.GroveCircularLED(9, 8)
-
-level = 0
-
-while(1):
- circle.setSpinner(level)
- level = (level + 1) % 24
- time.sleep(.1)
diff --git a/peripheral/libupm/examples/python/grovecollision.py b/peripheral/libupm/examples/python/grovecollision.py
deleted file mode 100644
index 6cdd05c..0000000
--- a/peripheral/libupm/examples/python/grovecollision.py
+++ /dev/null
@@ -1,57 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_grovecollision as upmGrovecollision
-
-# The was tested with the Grove Collision Sensor
-# Instantiate a Grove Collision on digital pin D2
-myGrovecollision = upmGrovecollision.GroveCollision(2)
-
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This lets you run code on exit,
-# including functions from myGrovecollision
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-collisionState = False
-print "No collision"
-
-while(1):
- if (myGrovecollision.isColliding() and not collisionState):
- print "Collision!"
- collisionState = True
- elif (not myGrovecollision.isColliding() and collisionState):
- print "No collision"
- collisionState = False
diff --git a/peripheral/libupm/examples/python/groveehr.py b/peripheral/libupm/examples/python/groveehr.py
deleted file mode 100644
index 3dd0ee2..0000000
--- a/peripheral/libupm/examples/python/groveehr.py
+++ /dev/null
@@ -1,68 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-
-import time, sys, signal, atexit
-import pyupm_groveehr as upmGroveehr
-
-# Instantiate a Grove Ear-clip Heart Rate sensor on digital pin D2
-myHeartRateSensor = upmGroveehr.GroveEHR(2)
-
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This lets you run code on exit,
-# including functions from myHeartRateSensor
-def exitHandler():
- myHeartRateSensor.stopBeatCounter()
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-# set the beat counter to 0, init the clock and start counting beats
-myHeartRateSensor.clearBeatCounter()
-myHeartRateSensor.initClock()
-myHeartRateSensor.startBeatCounter()
-
-while(1):
- # we grab these (millis and flowCount) just for display
- # purposes in this example
- millis = myHeartRateSensor.getMillis()
- beats = myHeartRateSensor.beatCounter()
-
- # heartRate() requires that at least 5 seconds pass before
- # returning anything other than 0
- fr = myHeartRateSensor.heartRate()
-
- # output milliseconds passed, beat count, and computed heart rate
- outputStr = "Millis: {0} Beats: {1} Heart Rate: {2}".format(
- millis, beats, fr)
- print outputStr
- time.sleep(1)
diff --git a/peripheral/libupm/examples/python/groveeldriver.py b/peripheral/libupm/examples/python/groveeldriver.py
deleted file mode 100644
index c9fd936..0000000
--- a/peripheral/libupm/examples/python/groveeldriver.py
+++ /dev/null
@@ -1,57 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_groveeldriver as upmGroveeldriver
-
-# The was tested with the Grove El Driver Module
-# Instantiate a Grove El Driver on digital pin D2
-myEldriver = upmGroveeldriver.GroveElDriver(2)
-
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit, including functions from myEldriver
-def exitHandler():
- print "Exiting"
- myEldriver.off()
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-lightState = True
-
-while(1):
- if (lightState):
- myEldriver.on()
- else:
- myEldriver.off()
- lightState = not lightState
-
- time.sleep(1)
diff --git a/peripheral/libupm/examples/python/groveelectromagnet.py b/peripheral/libupm/examples/python/groveelectromagnet.py
deleted file mode 100644
index c84af68..0000000
--- a/peripheral/libupm/examples/python/groveelectromagnet.py
+++ /dev/null
@@ -1,60 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_groveelectromagnet as upmGroveelectromagnet
-
-# This was tested with the Grove Electromagnetic Module
-# Instantiate a Grove Electromagnet on digital pin D2
-myElectromagnet = upmGroveelectromagnet.GroveElectromagnet(2)
-
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This lets you run code on exit,
-# including functions from myElectromagnet
-def exitHandler():
- print "Exiting"
- myElectromagnet.off()
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-magnetState = False
-
-# Turn magnet on and off every 5 seconds
-while(1):
- magnetState = not magnetState
- if (magnetState):
- myElectromagnet.on()
- else:
- myElectromagnet.off()
- print "Turning magnet", ("on" if magnetState else "off")
-
- time.sleep(5)
diff --git a/peripheral/libupm/examples/python/groveemg.py b/peripheral/libupm/examples/python/groveemg.py
deleted file mode 100644
index 898db26..0000000
--- a/peripheral/libupm/examples/python/groveemg.py
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_groveemg as upmGroveemg
-
-# Tested with the GroveEMG Muscle Signal Reader Sensor Module
-# Instantiate a GroveEMG on analog pin A0
-myEMG = upmGroveemg.GroveEMG(0)
-
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This lets you run code on exit, including functions from myEMG
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-print "Calibrating...."
-myEMG.calibrate()
-
-while (1):
- print myEMG.value()
- time.sleep(.1)
diff --git a/peripheral/libupm/examples/python/grovegprs.py b/peripheral/libupm/examples/python/grovegprs.py
deleted file mode 100644
index d441e38..0000000
--- a/peripheral/libupm/examples/python/grovegprs.py
+++ /dev/null
@@ -1,86 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_grovegprs as sensorObj
-
-# Instantiate a GroveGPRS Module on UART 0
-sensor = sensorObj.GroveGPRS(0)
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-# Set the baud rate, 19200 baud is the default.
-if (sensor.setBaudRate(19200)):
- print "Failed to set baud rate"
- sys.exit(0)
-
-
-usageStr = ("Usage:\n"
-"If an argument is supplied on the command line, that argument is\n"
-"sent to the module and the response is printed out.\n\n"
-"If no argument is used, then the manufacturer and the current\n"
-"saved profiles are queried and the results printed out.\n\n")
-print usageStr
-
-# simple helper function to send a command and wait for a response
-def sendCommand(sensor, cmd):
- # commands need to be terminated with a carriage return
- cmd += "\r";
- sensor.writeDataStr(cmd)
-
- # wait up to 1 second
- if (sensor.dataAvailable(1000)):
- print "Returned: ",
- print sensor.readDataStr(1024)
- else:
- print "Timed out waiting for response"
-
-
-if (len(sys.argv) > 1):
- print "Sending command line argument (" + sys.argv[1] + ")..."
- sendCommand(sensor, sys.argv[1])
-else:
- # query the module manufacturer
- print "Querying module manufacturer (AT+CGMI)..."
- sendCommand(sensor, "AT+CGMI");
-
- time.sleep(1);
-
- # query the saved profiles
- print "Querying the saved profiles (AT&V)..."
- sendCommand(sensor, "AT&V");
-
- # A comprehensive list is available from the datasheet at:
- # http://www.seeedstudio.com/wiki/images/7/72/AT_Commands_v1.11.pdf
diff --git a/peripheral/libupm/examples/python/grovegsr.py b/peripheral/libupm/examples/python/grovegsr.py
deleted file mode 100644
index 993a6b0..0000000
--- a/peripheral/libupm/examples/python/grovegsr.py
+++ /dev/null
@@ -1,53 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_grovegsr as upmGrovegsr
-
-# Tested with the GroveGSR Galvanic Skin Response Sensor module.
-
-# Instantiate a GroveGSR on analog pin A0
-myGSR = upmGrovegsr.GroveGSR(0)
-
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This lets you run code on exit, including functions from myGSR
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-print "Calibrating...."
-myGSR.calibrate()
-
-while (1):
- print myGSR.value()
- time.sleep(.5)
diff --git a/peripheral/libupm/examples/python/groveled.py b/peripheral/libupm/examples/python/groveled.py
deleted file mode 100644
index eb104bf..0000000
--- a/peripheral/libupm/examples/python/groveled.py
+++ /dev/null
@@ -1,41 +0,0 @@
-# Author: Sarah Knepper <sarah.knepper@intel.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time
-import pyupm_grove as grove
-
-# Create the Grove LED object using GPIO pin 2
-led = grove.GroveLed(2)
-
-# Print the name
-print led.name()
-
-# Turn the LED on and off 10 times, pausing one second
-# between transitions
-for i in range (0,10):
- led.on()
- time.sleep(1)
- led.off()
- time.sleep(1)
-
-# Delete the Grove LED object
-del led
diff --git a/peripheral/libupm/examples/python/groveledbar.py b/peripheral/libupm/examples/python/groveledbar.py
deleted file mode 100644
index 39d8462..0000000
--- a/peripheral/libupm/examples/python/groveledbar.py
+++ /dev/null
@@ -1,64 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_my9221 as upmMy9221
-
-# Instantiate a MY9221, we use D8 for the data, and D9 for the
-# data clock. This was tested with a Grove LED bar.
-myLEDBar = upmMy9221.GroveLEDBar(8, 9)
-
-
-# Exit handlers
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-def exitHandler():
- myLEDBar.setBarLevel(0, True)
- print "Exiting"
- sys.exit(0)
-
-# This function lets you run code on exit
-atexit.register(exitHandler)
-# This function stops python from printing a stacktrace when you hit control-C
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-directionBool = True
-level = 1
-
-x = 0
-while(1):
- # If it's less than 10
- # light up the LED now
- # call show_LED again in 50 ms
- if (level <= 10):
- myLEDBar.setBarLevel(level, directionBool)
- level += 1
- # Switch LED lighting directions between lighting cycles
- else:
- directionBool = not directionBool
- level = 1
- time.sleep(1)
- time.sleep(.05)
- x += 1
diff --git a/peripheral/libupm/examples/python/grovelight.py b/peripheral/libupm/examples/python/grovelight.py
deleted file mode 100644
index a1939d7..0000000
--- a/peripheral/libupm/examples/python/grovelight.py
+++ /dev/null
@@ -1,37 +0,0 @@
-# Author: Sarah Knepper <sarah.knepper@intel.com>
-# Copyright (c) 2014 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time
-import pyupm_grove as grove
-
-# Create the light sensor object using AIO pin 0
-light = grove.GroveLight(0)
-
-# Read the input and print both the raw value and a rough lux value,
-# waiting one second between readings
-while 1:
- print light.name() + " raw value is %d" % light.raw_value() + \
- ", which is roughly %d" % light.value() + " lux";
- time.sleep(1)
-
-# Delete the light sensor object
-del light
diff --git a/peripheral/libupm/examples/python/grovelinefinder.py b/peripheral/libupm/examples/python/grovelinefinder.py
deleted file mode 100644
index bdcd68a..0000000
--- a/peripheral/libupm/examples/python/grovelinefinder.py
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_grovelinefinder as upmGrovelinefinder
-
-# Instantiate a Grove line finder sensor on digital pin D2
-myLineFinder = upmGrovelinefinder.GroveLineFinder(2)
-
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit, including functions from myLineFinder
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-while(1):
- if (myLineFinder.whiteDetected()):
- print "White detected."
- else:
- print "Black detected."
- time.sleep(1)
diff --git a/peripheral/libupm/examples/python/grovemd-stepper.py b/peripheral/libupm/examples/python/grovemd-stepper.py
deleted file mode 100644
index 7bafae5..0000000
--- a/peripheral/libupm/examples/python/grovemd-stepper.py
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time
-import pyupm_grovemd as upmGrovemd
-
-I2C_BUS = upmGrovemd.GROVEMD_I2C_BUS
-I2C_ADDR = upmGrovemd.GROVEMD_DEFAULT_I2C_ADDR
-
-# Instantiate an I2C Grove Motor Driver on I2C bus 0
-myMotorDriver = upmGrovemd.GroveMD(I2C_BUS, I2C_ADDR)
-
-# This example demonstrates using the GroveMD to drive a stepper motor
-
-# configure it, for this example, we'll assume 200 steps per rev
-myMotorDriver.configStepper(200)
-
-# set for half a rotation
-myMotorDriver.setStepperSteps(100)
-
-# let it go - clockwise rotation, 10 RPM speed
-myMotorDriver.enableStepper(upmGrovemd.GroveMD.STEP_DIR_CW, 10)
-
-time.sleep(3)
-
-# Now do it backwards...
-myMotorDriver.setStepperSteps(100)
-myMotorDriver.enableStepper(upmGrovemd.GroveMD.STEP_DIR_CCW, 10)
-
-# now disable
-myMotorDriver.disableStepper()
-
diff --git a/peripheral/libupm/examples/python/grovemd.py b/peripheral/libupm/examples/python/grovemd.py
deleted file mode 100644
index ac4243d..0000000
--- a/peripheral/libupm/examples/python/grovemd.py
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time
-import pyupm_grovemd as upmGrovemd
-
-I2C_BUS = upmGrovemd.GROVEMD_I2C_BUS
-I2C_ADDR = upmGrovemd.GROVEMD_DEFAULT_I2C_ADDR
-
-# Instantiate an I2C Grove Motor Driver on I2C bus 0
-myMotorDriver = upmGrovemd.GroveMD(I2C_BUS, I2C_ADDR)
-
-
-# set direction to CW and set speed to 50%
-print "Spin M1 and M2 at half speed for 3 seconds"
-myMotorDriver.setMotorDirections(upmGrovemd.GroveMD.DIR_CW, upmGrovemd.GroveMD.DIR_CW)
-myMotorDriver.setMotorSpeeds(127, 127)
-
-time.sleep(3)
-# counter clockwise
-print "Reversing M1 and M2 for 3 seconds"
-myMotorDriver.setMotorDirections(upmGrovemd.GroveMD.DIR_CCW,
-upmGrovemd.GroveMD.DIR_CCW)
-time.sleep(3)
-
-print "Stopping motors"
-myMotorDriver.setMotorSpeeds(0, 0)
diff --git a/peripheral/libupm/examples/python/grovemoisture.py b/peripheral/libupm/examples/python/grovemoisture.py
deleted file mode 100644
index 78d3fe4..0000000
--- a/peripheral/libupm/examples/python/grovemoisture.py
+++ /dev/null
@@ -1,61 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_grovemoisture as upmMoisture
-
-# Instantiate a Grove Moisture sensor on analog pin A0
-myMoisture = upmMoisture.GroveMoisture(0)
-
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit, including functions from myMoisture
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-# Values (approximate):
-# 0-300, sensor in air or dry soil
-# 300-600, sensor in humid soil
-# 600+, sensor in wet soil or submerged in water
-
-# Read the value every second and print the corresponding moisture level
-while(1):
- moisture_val = myMoisture.value()
- if (moisture_val >= 0 and moisture_val < 300):
- result = "Dry"
- elif (moisture_val >= 300 and moisture_val < 600):
- result = "Moist"
- else:
- result = "Wet"
- print "Moisture value: {0}, {1}".format(moisture_val, result)
- time.sleep(1)
diff --git a/peripheral/libupm/examples/python/groveo2.py b/peripheral/libupm/examples/python/groveo2.py
deleted file mode 100644
index 03f612b..0000000
--- a/peripheral/libupm/examples/python/groveo2.py
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_groveo2 as upmGroveo2
-
-# This was tested with the O2 Oxygen Concentration Sensor Module
-# Instantiate a GroveO2 on analog pin A0
-myGroveO2 = upmGroveo2.GroveO2(0)
-
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This lets you run code on exit, including functions from myGroveO2
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-while(1):
- print "The output voltage is: {0}mV".format(
- myGroveO2.voltageValue())
-
- time.sleep(.1)
diff --git a/peripheral/libupm/examples/python/groverelay.py b/peripheral/libupm/examples/python/groverelay.py
deleted file mode 100644
index 44f033f..0000000
--- a/peripheral/libupm/examples/python/groverelay.py
+++ /dev/null
@@ -1,44 +0,0 @@
-# Author: Sarah Knepper <sarah.knepper@intel.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time
-import pyupm_grove as grove
-
-# Create the relay switch object using GPIO pin 0
-relay = grove.GroveRelay(0)
-
-# Close and then open the relay switch 3 times,
-# waiting one second each time. The LED on the relay switch
-# will light up when the switch is on (closed).
-# The switch will also make a noise between transitions.
-for i in range (0,3):
- relay.on()
- if relay.isOn():
- print relay.name(), 'is on'
- time.sleep(1)
- relay.off()
- if relay.isOff():
- print relay.name(), 'is off'
- time.sleep(1)
-
-# Delete the relay switch object
-del relay
diff --git a/peripheral/libupm/examples/python/groverotary.py b/peripheral/libupm/examples/python/groverotary.py
deleted file mode 100644
index 6d62c3c..0000000
--- a/peripheral/libupm/examples/python/groverotary.py
+++ /dev/null
@@ -1,45 +0,0 @@
-# Author: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
-# Copyright (c) 2014 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-from time import sleep
-import pyupm_grove as grove
-
-# New knob on AIO pin 0
-knob = grove.GroveRotary(0)
-
-# Loop indefinitely
-while True:
-
- # Read values
- abs = knob.abs_value()
- absdeg = knob.abs_deg()
- absrad = knob.abs_rad()
-
- rel = knob.rel_value()
- reldeg = knob.rel_deg()
- relrad = knob.rel_rad()
-
- print "Abs values: %4d" % int(abs) , " raw %4d" % int(absdeg), "deg = %5.2f" % absrad , " rad ",
- print "Rel values: %4d" % int(rel) , " raw %4d" % int(reldeg), "deg = %5.2f" % relrad , " rad"
-
- # Sleep for 2.5 s
- sleep(2.5)
diff --git a/peripheral/libupm/examples/python/grovescam.py b/peripheral/libupm/examples/python/grovescam.py
deleted file mode 100644
index 53ede09..0000000
--- a/peripheral/libupm/examples/python/grovescam.py
+++ /dev/null
@@ -1,61 +0,0 @@
-#!/usr/bin/python
-#
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import sys
-import pyupm_grovescam as upmGrovescam
-
-# Instantiate a Grove Serial Camera on UART 0
-camera = upmGrovescam.GROVESCAM(0)
-
-# make sure port is initialized properly. 115200 baud is the default.
-if (not camera.setupTty()):
- print "Failed to setup tty port parameters"
- sys.exit(1)
-
-if (camera.init()):
- print "Initialized..."
-else:
- print "init() failed"
-
-if (camera.preCapture()):
- print "preCapture succeeded..."
-else:
- print "preCapture failed."
-
-if (camera.doCapture()):
- print "doCapture succeeded..."
-else:
- print "doCapture failed."
-
-print "Image size is", camera.getImageSize(), "bytes"
-
-if (camera.getImageSize() > 0):
- print "Storing image.jpg..."
- if (camera.storeImage("image.jpg")):
- print "storeImage succeeded..."
- else:
- print "storeImage failed."
-
-print "Exiting."
-sys.exit(0)
diff --git a/peripheral/libupm/examples/python/groveslide.py b/peripheral/libupm/examples/python/groveslide.py
deleted file mode 100644
index 894fdc8..0000000
--- a/peripheral/libupm/examples/python/groveslide.py
+++ /dev/null
@@ -1,39 +0,0 @@
-# Author: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
-# Copyright (c) 2014 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-from time import sleep
-import pyupm_grove as grove
-
-# New Grove Slider on AIO pin 0
-slider = grove.GroveSlide(0)
-
-# Loop indefinitely
-while True:
-
- # Read values
- raw = slider.raw_value()
- volts = slider.voltage_value()
-
- print "Slider value: ", raw , " = %.2f" % volts , " V"
-
- # Sleep for 2.5 s
- sleep(2.5)
diff --git a/peripheral/libupm/examples/python/grovespeaker.py b/peripheral/libupm/examples/python/grovespeaker.py
deleted file mode 100644
index 6e53b3c..0000000
--- a/peripheral/libupm/examples/python/grovespeaker.py
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_grovespeaker as upmGrovespeaker
-
-# Instantiate a Grove Speaker on digital pin D2
-mySpeaker = upmGrovespeaker.GroveSpeaker(2)
-
-# Play all 7 of the lowest notes
-mySpeaker.playAll()
-
-# Play a medium C-sharp
-mySpeaker.playSound('c', True, "med")
diff --git a/peripheral/libupm/examples/python/grovetemp.py b/peripheral/libupm/examples/python/grovetemp.py
deleted file mode 100644
index bd9cc24..0000000
--- a/peripheral/libupm/examples/python/grovetemp.py
+++ /dev/null
@@ -1,41 +0,0 @@
-# Author: Brendan Le Foll <brendan.le.foll@intel.com>
-# Contributions: Sarah Knepper <sarah.knepper@intel.com>
-# Copyright (c) 2014 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time
-import pyupm_grove as grove
-
-# Create the temperature sensor object using AIO pin 0
-temp = grove.GroveTemp(0)
-print temp.name()
-
-# Read the temperature ten times, printing both the Celsius and
-# equivalent Fahrenheit temperature, waiting one second between readings
-for i in range(0, 10):
- celsius = temp.value()
- fahrenheit = celsius * 9.0/5.0 + 32.0;
- print "%d degrees Celsius, or %d degrees Fahrenheit" \
- % (celsius, fahrenheit)
- time.sleep(1)
-
-# Delete the temperature sensor object
-del temp
diff --git a/peripheral/libupm/examples/python/grovevdiv.py b/peripheral/libupm/examples/python/grovevdiv.py
deleted file mode 100644
index 7719277..0000000
--- a/peripheral/libupm/examples/python/grovevdiv.py
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_grovevdiv as upmGrovevdiv
-
-# Instantiate a Grove Voltage Divider sensor on analog pin A0
-myVoltageDivider = upmGrovevdiv.GroveVDiv(0)
-
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit,
-# including functions from myVoltageDivider
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-while(1):
- val = myVoltageDivider.value(100)
- gain3val = myVoltageDivider.computedValue(3, val)
- gain10val = myVoltageDivider.computedValue(10, val)
- print "ADC value: {0} Gain 3: {1}v Gain 10: {2}v".format(
- val, gain3val, gain10val)
-
- time.sleep(1)
diff --git a/peripheral/libupm/examples/python/grovewater.py b/peripheral/libupm/examples/python/grovewater.py
deleted file mode 100644
index 54a3d14..0000000
--- a/peripheral/libupm/examples/python/grovewater.py
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_grovewater as upmGrovewater
-
-# Instantiate a Grove Water sensor on digital pin D2
-myWaterSensor = upmGrovewater.GroveWater(2)
-
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit, including functions from myWaterSensor
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-while(1):
- if (myWaterSensor.isWet()):
- print "Sensor is wet"
- else:
- print "Sensor is dry"
- time.sleep(1)
diff --git a/peripheral/libupm/examples/python/grovewfs.py b/peripheral/libupm/examples/python/grovewfs.py
deleted file mode 100644
index 84c5a97..0000000
--- a/peripheral/libupm/examples/python/grovewfs.py
+++ /dev/null
@@ -1,64 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_grovewfs as upmGrovewfs
-
-# Instantiate a Grove Water Flow Sensor on digital pin D2
-myWaterFlow = upmGrovewfs.GroveWFS(2)
-
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit,
-# including functions from myWaterFlow
-def exitHandler():
- myWaterFlow.stopFlowCounter()
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-# set the flow counter to 0 and start counting
-myWaterFlow.clearFlowCounter()
-myWaterFlow.startFlowCounter()
-
-while (1):
- # we grab these (millis and flowCount) just for display
- # purposes in this example
- millis = myWaterFlow.getMillis()
- flowCount = myWaterFlow.flowCounter()
-
- fr = myWaterFlow.flowRate()
-
- # output milliseconds passed, flow count, and computed flow rate
- outputStr = "Millis: {0} Flow Count: {1} Flow Rate: {2} LPM".format(
- millis, flowCount, fr)
- print outputStr
- time.sleep(2)
diff --git a/peripheral/libupm/examples/python/guvas12d.py b/peripheral/libupm/examples/python/guvas12d.py
deleted file mode 100644
index dca8de8..0000000
--- a/peripheral/libupm/examples/python/guvas12d.py
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_guvas12d as upmUV
-
-# Instantiate a UV sensor on analog pin A0
-myUVSensor = upmUV.GUVAS12D(0);
-
-# analog voltage, usually 3.3 or 5.0
-GUVAS12D_AREF = 5.0;
-SAMPLES_PER_QUERY = 1024;
-
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit, including functions from myUVSensor
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-while(1):
- s = ("AREF: {0}, "
- "Voltage value (higher means more UV): "
- "{1}".format(GUVAS12D_AREF,
- myUVSensor.value(GUVAS12D_AREF, SAMPLES_PER_QUERY)))
- print s
- time.sleep(1)
diff --git a/peripheral/libupm/examples/python/h3lis331dl.py b/peripheral/libupm/examples/python/h3lis331dl.py
deleted file mode 100644
index 60142f5..0000000
--- a/peripheral/libupm/examples/python/h3lis331dl.py
+++ /dev/null
@@ -1,76 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_h3lis331dl as upmH3LIS331DL
-
-# Instantiate an H3LIS331DL on I2C bus 0
-myDigitalAccelerometer = upmH3LIS331DL.H3LIS331DL(
- upmH3LIS331DL.H3LIS331DL_I2C_BUS,
- upmH3LIS331DL.H3LIS331DL_DEFAULT_I2C_ADDR);
-
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit, including functions from myDigitalAccelerometer
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-# Initialize the device with default values
-myDigitalAccelerometer.init()
-
-x = upmH3LIS331DL.new_intp()
-y = upmH3LIS331DL.new_intp()
-z = upmH3LIS331DL.new_intp()
-
-ax = upmH3LIS331DL.new_floatp()
-ay = upmH3LIS331DL.new_floatp()
-az = upmH3LIS331DL.new_floatp()
-
-while (1):
- myDigitalAccelerometer.update()
- myDigitalAccelerometer.getRawXYZ(x, y, z)
- outputStr = ("Raw: X = {0}"
- " Y = {1}"
- " Z = {2}").format(upmH3LIS331DL.intp_value(x),
- upmH3LIS331DL.intp_value(y),
- upmH3LIS331DL.intp_value(z))
- print outputStr
-
- myDigitalAccelerometer.getAcceleration(ax, ay, az)
- outputStr = ("Acceleration: AX = {0}"
- " AY = {1}"
- " AZ = {2}").format(upmH3LIS331DL.floatp_value(ax),
- upmH3LIS331DL.floatp_value(ay),
- upmH3LIS331DL.floatp_value(az))
- print outputStr
- time.sleep(.5)
diff --git a/peripheral/libupm/examples/python/hdxxvxta.py b/peripheral/libupm/examples/python/hdxxvxta.py
deleted file mode 100644
index c539d90..0000000
--- a/peripheral/libupm/examples/python/hdxxvxta.py
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2016 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_hdxxvxta as sensorObj
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-print "Initializing..."
-
-# Instantiate an HDXXVXTA instance, using A1 for humidity and A0
-# for temperature
-sensor = sensorObj.HDXXVXTA(1, 0)
-
-# update and print available values every second
-while (1):
- # update our values from the sensor
- sensor.update()
-
- # we show both C and F for temperature
- print "Temperature:", sensor.getTemperature(), "C /",
- print sensor.getTemperature(True), "F"
-
- print "Humidity:", sensor.getHumidity(), "%"
-
- print
- time.sleep(1)
diff --git a/peripheral/libupm/examples/python/hm11.py b/peripheral/libupm/examples/python/hm11.py
deleted file mode 100644
index c20a8ea..0000000
--- a/peripheral/libupm/examples/python/hm11.py
+++ /dev/null
@@ -1,110 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_hm11 as upmHm11
-
-# Instantiate a HM11 BLE Module on UART 0
-my_ble_obj = upmHm11.HM11(0)
-
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit,
-# including functions from my_ble_obj
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-bufferLength = 256
-
-# make sure port is initialized properly. 9600 baud is the default.
-if (not my_ble_obj.setupTty(upmHm11.cvar.int_B9600)):
- print "Failed to setup tty port parameters"
- sys.exit(0)
-
-
-usageStr = ("Usage:\n"
-"Pass a commandline argument (any argument) to this program\n"
-"to query the radio configuration and output it. NOTE: the\n"
-"radio must be in CONFIG mode for this to work.\n\n"
-"Running this program without arguments will simply transmit\n"
-"'Hello World!' every second, and output any data received from\n"
-"another radio.\n\n")
-print usageStr
-
-# simple helper function to send a command and wait for a response
-def sendCommand(bleObj, cmd):
- bleBuffer = upmHm11.charArray(bufferLength)
- bleObj.writeData(cmd, len(cmd))
-
- # wait up to 1 second
- if (bleObj.dataAvailable(1000)):
- bleObj.readData(bleBuffer, bufferLength)
- bleData = ""
- # read only the number of characters
- # specified by myGPSSensor.readData
- for x in range(0, bufferLength):
- if (bleBuffer.__getitem__(x) == '\0'):
- break
- else:
- bleData += bleBuffer.__getitem__(x)
- print bleData
- else:
- print "Timed out waiting for response"
-
-
-if (len(sys.argv) > 1):
- print "Sending command line argument (" + sys.argv[1] + ")..."
- sendCommand(my_ble_obj, sys.argv[1])
-else:
- # query the module address
- addr = "AT+ADDR?";
- print "Querying module address (" + addr + ")..."
-
- sendCommand(my_ble_obj, addr)
- time.sleep(1)
- # query the module address
- pin = "AT+PASS?";
- print "Querying module PIN (" + pin + ")..."
- sendCommand(my_ble_obj, pin)
-
- # Other potentially useful commands are:
- #
- # AT+VERS? - query module version
- # AT+ROLE0 - set as slave
- # AT+ROLE1 - set as master
- # AT+CLEAR - clear all previous settings
- # AT+RESET - restart the device
- #
- # A comprehensive list is available from the datasheet at:
- # http://www.seeedstudio.com/wiki/images/c/cd/Bluetooth4_en.pdf
-
diff --git a/peripheral/libupm/examples/python/hmc5883l.py b/peripheral/libupm/examples/python/hmc5883l.py
deleted file mode 100644
index 5043073..0000000
--- a/peripheral/libupm/examples/python/hmc5883l.py
+++ /dev/null
@@ -1,44 +0,0 @@
-# Author: Mihai Tudor Panu <mihai.tudor.panu@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 time import sleep
-import pyupm_hmc5883l as hmc5883l
-
-# Create an I2C compass object and set declination
-hmc = hmc5883l.Hmc5883l(0)
-hmc.set_declination(0.2749)
-
-# Loop indefinitely
-while True:
-
- hmc.update() # Update the data
- pos = hmc.coordinates() # Read raw coordinates
- hdg = hmc.heading() # Read heading
- dir = hmc.direction() # Read direction
-
- # Print values
- print "Coor: %5d %5d %5d" % (pos[0], pos[1], pos[2])
- print "Heading: %5.2f" % (hdg)
- print "Direction: %3.2f\n" % (dir)
-
- # Sleep for 1 s
- sleep(1)
diff --git a/peripheral/libupm/examples/python/hmtrp.py b/peripheral/libupm/examples/python/hmtrp.py
deleted file mode 100644
index dd2298f..0000000
--- a/peripheral/libupm/examples/python/hmtrp.py
+++ /dev/null
@@ -1,143 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_hmtrp as upmHmtrp
-
-# Instantiate a HMTRP radio device on uart 0
-my_HMTRP_Radio = upmHmtrp.HMTRP(0)
-
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit,
-# including functions from my_HMTRP_Radio
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-myCounter = 0
-
-# normal read/write mode
-bufferLength = 256
-radioBuffer = upmHmtrp.charArray(bufferLength)
-
-# make sure port is initialized properly. 9600 baud is the default.
-if (not my_HMTRP_Radio.setupTty(upmHmtrp.cvar.int_B9600)):
- print "Failed to setup tty port parameters"
- sys.exit(0)
-
-
-usageStr = ("Usage:\n"
-"Pass a commandline argument (any argument) to this program\n"
-"to query the radio configuration and output it. NOTE: the\n"
-"radio must be in CONFIG mode for this to work.\n\n"
-"Running this program without arguments will simply transmit\n"
-"'Hello World!' every second, and output any data received from\n"
-"another radio.\n\n")
-print usageStr
-
-'''
-By default, this radio simply transmits data sent via writeData()
-and reads any available data via readData().
-
-It can be placed into a configuration mode by grounding the
-CONFIG pin on the module. When this is done, the various
-configuration query and config methods can be used. In this
-example, by default, we just read any data available fom the
-device, and periodically transmit "Hello World".
-
-If any argument was specified on the command line, do a simple
-configuration query and output the results. The radio must be in
-CONFIG mode for this to work.
-
-
-Note that the first command-line argument should be "hmtry.py"
-The data we want would be the second... if it exists
-'''
-if (len(sys.argv) > 1):
- # config mode
- freq = upmHmtrp.uint32Array(0)
- dataRate = upmHmtrp.uint32Array(0)
- rxBandwidth = upmHmtrp.uint16Array(0)
- modulation = upmHmtrp.uint8Array(0)
- txPower = upmHmtrp.uint8Array(0)
- uartBaud = upmHmtrp.uint32Array(0)
-
- if (my_HMTRP_Radio.getConfig(freq, dataRate, rxBandwidth,
- modulation, txPower, uartBaud)):
- print "Radio configuration:"
- outputStr = ("freq: {0} dataRate: {1} "
- "rxBandwidth: {2}Khz").format(freq.__getitem__(0),
- dataRate.__getitem__(0),
- rxBandwidth.__getitem__(0))
- print outputStr
-
- outputStr = "modulation: %d Khz txPower: %d uartBaud: %d" % (
- modulation.__getitem__(0), txPower.__getitem__(0),
- uartBaud.__getitem__(0))
- print outputStr
- else:
- errString = ("getConfig() failed. Make sure the radio "
- "is in CONFIG mode.")
- print errString
-else:
- print "Running in normal read/write mode."
- while (1):
- # we don't want the read to block in this example, so always
- # check to see if data is available first.
- if (my_HMTRP_Radio.dataAvailable()):
- rv = my_HMTRP_Radio.readData(radioBuffer, bufferLength)
-
- if (rv > 0):
- resultStr = "";
- for x in range(rv):
- resultStr += radioBuffer.__getitem__(x)
- print "Received:", resultStr
-
- if (rv < 0): # some sort of read error occured
- print "Port read error."
- sys.exit(0)
- myCounter += 1
- # every second, transmit "Hello World"
- if (myCounter > 10):
- msg = "Hello World!"
-
- print "Transmitting %s..." % msg
-
- # Adding 1 for NULL terminator.
- # Note that SWIG automatically adds a NULL terminator,
- # so no need to NULL-terminate ourselves.
- # Just increment the message length to include
- # the NULL that's already there
- my_HMTRP_Radio.writeData(msg, (len(msg) + 1))
- myCounter = 0
- time.sleep(.1)
diff --git a/peripheral/libupm/examples/python/hp20x.py b/peripheral/libupm/examples/python/hp20x.py
deleted file mode 100644
index f0ae5e6..0000000
--- a/peripheral/libupm/examples/python/hp20x.py
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_hp20x as barometerObj
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit,
-# including functions from ringCoder
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-# Instantiate an HP20X on default I2C bus and address
-bar = barometerObj.HP20X()
-
-# Initialize the device with default values
-bar.init()
-
-while(1):
- print "Temperature:", bar.getTemperature(), "Celcius"
- print "Pressure: ", bar.getPressure(), "Millibars"
- print "Altitude: ", bar.getAltitude(), "Meters"
- print
- time.sleep(1)
-
diff --git a/peripheral/libupm/examples/python/ht9170.py b/peripheral/libupm/examples/python/ht9170.py
deleted file mode 100644
index 838b0cc..0000000
--- a/peripheral/libupm/examples/python/ht9170.py
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_ht9170 as upmHt9170
-
-# Instantiate a DTMF decoder
-myDTMF = upmHt9170.HT9170(12, 11, 10, 9, 8)
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This lets you run code on exit, including functions from myDTMF
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-# Now we just spin in a loop, sleeping every 100ms, checking to see
-# if a digit is available. If so, we decode and print the digit,
-# and continue looping.
-while (1):
- if (dtmf_obj.digitReady()):
- print "Got DTMF code:", dtmf_obj.decodeDigit()
- # now spin until digitReady() goes false again
- while (dtmf.digitReady()):
- pass
- time.sleep(.1)
diff --git a/peripheral/libupm/examples/python/hwxpxx.py b/peripheral/libupm/examples/python/hwxpxx.py
deleted file mode 100644
index 0def995..0000000
--- a/peripheral/libupm/examples/python/hwxpxx.py
+++ /dev/null
@@ -1,79 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2016 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_hwxpxx as sensorObj
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit
-def exitHandler():
- print "Exiting..."
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-defaultDev = "/dev/ttyUSB0"
-
-# if an argument was specified, use it as the device instead
-if (len(sys.argv) > 1):
- defaultDev = sys.argv[1]
-
-print "Using device", defaultDev
-print "Initializing..."
-
-# Instantiate an HWXPXX instance, using MODBUS slave address 3, and
-# default comm parameters (19200, 8, N, 2)
-sensor = sensorObj.HWXPXX(defaultDev, 3)
-
-# output the serial number and firmware revision
-print "Slave ID:", sensor.getSlaveID()
-
-# stored temperature and humidity offsets
-print "Temperature Offset:", sensor.getTemperatureOffset()
-print "Humidity Offset:", sensor.getHumidityOffset()
-
-print
-
-# update and print available values every second
-while (1):
- # update our values from the sensor
- sensor.update()
-
- # we show both C and F for temperature
- print "Temperature:", sensor.getTemperature(), "C /",
- print sensor.getTemperature(True), "F"
-
- print "Humidity:", sensor.getHumidity(), "%"
-
- print "Slider:", sensor.getSlider(), "%"
-
- print "Override Switch Status:", sensor.getOverrideSwitchStatus()
-
- print
- time.sleep(1)
diff --git a/peripheral/libupm/examples/python/ili9341.py b/peripheral/libupm/examples/python/ili9341.py
deleted file mode 100644
index 5194cc3..0000000
--- a/peripheral/libupm/examples/python/ili9341.py
+++ /dev/null
@@ -1,75 +0,0 @@
-#!/usr/bin/python
-# Author: Shawn Hymel
-# Copyright (c) 2016 SparkFun Electronics
-#
-# 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 time
-import pyupm_ili9341 as ili9341
-
-# Pins (Edison)
-# CS_LCD GP44 (MRAA 31)
-# CS_SD GP43 (MRAA 38) unused
-# DC GP12 (MRAA 20)
-# RESEST GP13 (MRAA 14)
-lcd = ili9341.ILI9341(31, 38, 20, 14)
-
-# Fill the screen with a solid color
-lcd.fillScreen(lcd.color565(0, 40, 16))
-
-# Draw some shapes
-lcd.drawFastVLine(10, 10, 100, ili9341.ILI9341_RED)
-lcd.drawFastHLine(20, 10, 50, ili9341.ILI9341_CYAN)
-lcd.drawLine(160, 30, 200, 60, ili9341.ILI9341_GREEN)
-lcd.fillRect(20, 30, 75, 60, ili9341.ILI9341_ORANGE)
-lcd.drawCircle(70, 50, 20, ili9341.ILI9341_PURPLE)
-lcd.fillCircle(120, 50, 20, ili9341.ILI9341_PURPLE)
-lcd.drawTriangle(50, 100, 10, 140, 90, 140, ili9341.ILI9341_YELLOW)
-lcd.fillTriangle(150, 100, 110, 140, 190, 140, ili9341.ILI9341_YELLOW)
-lcd.drawRoundRect(20, 150, 50, 30, 10, ili9341.ILI9341_RED)
-lcd.drawRoundRect(130, 150, 50, 30, 10, ili9341.ILI9341_RED)
-lcd.fillRoundRect(75, 150, 50, 30, 10, ili9341.ILI9341_RED)
-
-# Write some text
-lcd.setCursor(0, 200)
-lcd.setTextColor(ili9341.ILI9341_LIGHTGREY)
-lcd.setTextWrap(True)
-lcd.setTextSize(1)
-lcd._print("Text 1\n")
-lcd.setTextSize(2)
-lcd._print("Text 2\n")
-lcd.setTextSize(3)
-lcd._print("Text 3\n")
-lcd.setTextSize(4)
-lcd._print("Text 4\n")
-
-# Test screen rotation
-for r in range(0, 4):
- lcd.setRotation(r)
- lcd.fillRect(0, 0, 5, 5, ili9341.ILI9341_WHITE)
- time.sleep(1)
-
-# Invert colors, wait, then revert back
-lcd.invertDisplay(True)
-time.sleep(2)
-lcd.invertDisplay(False)
-
-# Don't forget to free up that memory!
-del lcd \ No newline at end of file
diff --git a/peripheral/libupm/examples/python/ina132.py b/peripheral/libupm/examples/python/ina132.py
deleted file mode 100644
index 8db4862..0000000
--- a/peripheral/libupm/examples/python/ina132.py
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-
-import time, sys, signal, atexit
-import pyupm_ina132 as upmIna132
-
-# Tested with the INA132 Differential Amplifier Sensor module.
-# Instantiate an INA132 on analog pin A0
-myDifferentialAmplifier = upmIna132.INA132(0)
-
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This lets you run code on exit,
-# including functions from myDifferentialAmplifier
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-while(1):
- print myDifferentialAmplifier.value()
- time.sleep(1)
diff --git a/peripheral/libupm/examples/python/isd1820.py b/peripheral/libupm/examples/python/isd1820.py
deleted file mode 100644
index f39f477..0000000
--- a/peripheral/libupm/examples/python/isd1820.py
+++ /dev/null
@@ -1,74 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, atexit
-import pyupm_isd1820 as upmIsd1820
-
-# Instantiate a ISD1820 on digital pins 2 (play) and 3 (record)
-# This example was tested on the Grove Recorder.
-myRecorder = upmIsd1820.ISD1820(2, 3)
-
-
-doRecord = False
-
-if len(sys.argv) > 1:
- doRecord = True
-
-
-# This lets you run code on exit,
-# including functions from myRecorder
-def exitHandler():
- # turn off whatever we were doing.
- if (doRecord):
- myRecorder.record(False)
- else:
- myRecorder.play(False)
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-
-
-# if an argument was specified (any argument), go into record mode,
-# else playback a previously recorded sample
-
-print "Supply any argument to the command line to record."
-print "Running this example without arguments will play back any "
-print "previously recorded sound."
-print "There is approximately 10 seconds of recording time.\n"
-
-
-# depending on what was selected, do it, and sleep for 15 seconds
-if (doRecord):
- myRecorder.record(True)
-else:
- myRecorder.play(True)
-
-# There are about 10 seconds of recording/playback time, so we will
-# sleep for a little extra time.
-print "Sleeping for 15 seconds..."
-time.sleep(15)
-
-
-# exitHandler runs automatically
diff --git a/peripheral/libupm/examples/python/itg3200.py b/peripheral/libupm/examples/python/itg3200.py
deleted file mode 100644
index cd4a7c4..0000000
--- a/peripheral/libupm/examples/python/itg3200.py
+++ /dev/null
@@ -1,42 +0,0 @@
-# Author: John Van Drasek <john.r.van.drasek@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 time
-import pyupm_itg3200 as itg3200
-
-# Create an I2C gyro object
-gyro = itg3200.Itg3200(0)
-
-while(1):
- gyro.update() # Update the data
- rot = gyro.getRawValues() # Read raw sensor data
- ang = gyro.getRotation() # Read rotational speed (deg/sec)
- print "Raw: %6d %6d %6d" % (rot[0], rot[1], rot[2])
- print "AngX: %5.2f" % (ang[0])
- print "AngY: %5.2f" % (ang[1])
- print "AngZ: %5.2f" % (ang[2])
- print "Temp: %5.2f Raw: %6d" % (gyro.getTemperature(), gyro.getRawTemp())
- print ' '
- time.sleep(1)
-
-# Delete the gyro object
-del gyro
diff --git a/peripheral/libupm/examples/python/jhd1313m1-lcd.py b/peripheral/libupm/examples/python/jhd1313m1-lcd.py
deleted file mode 100644
index fc0bc65..0000000
--- a/peripheral/libupm/examples/python/jhd1313m1-lcd.py
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/usr/bin/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 pyupm_i2clcd as lcd
-
-# Initialize Jhd1313m1 at 0x3E (LCD_ADDRESS) and 0x62 (RGB_ADDRESS)
-myLcd = lcd.Jhd1313m1(0, 0x3E, 0x62)
-
-myLcd.setCursor(0,0)
-# RGB Blue
-#myLcd.setColor(53, 39, 249)
-
-# RGB Red
-myLcd.setColor(255, 0, 0)
-
-myLcd.write('Hello World')
-myLcd.setCursor(1,2)
-myLcd.write('Hello World')
diff --git a/peripheral/libupm/examples/python/joystick12.py b/peripheral/libupm/examples/python/joystick12.py
deleted file mode 100644
index eaae149..0000000
--- a/peripheral/libupm/examples/python/joystick12.py
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_joystick12 as upmJoystick12
-
-# Instantiate a joystick on analog pins A0 and A1
-myJoystick = upmJoystick12.Joystick12(0, 1)
-
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit, including functions from myJoystick
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-# Print the X and Y input values every second
-while(1):
- XString = "Driving X:" + str(myJoystick.getXInput())
- YString = ": and Y:" + str(myJoystick.getYInput())
- print XString + YString
-
- time.sleep(1)
diff --git a/peripheral/libupm/examples/python/l298-stepper.py b/peripheral/libupm/examples/python/l298-stepper.py
deleted file mode 100644
index cfac86f..0000000
--- a/peripheral/libupm/examples/python/l298-stepper.py
+++ /dev/null
@@ -1,67 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-
-import time, sys, signal, atexit
-import pyupm_l298 as upmL298
-
-# Instantiate a Stepper motor on a L298 Dual H-Bridge.
-# This was tested with the NEMA-17 12V, 350mA, with 200 steps per rev.
-myHBridge = upmL298.L298(200, 3, 4, 7, 8, 9)
-
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This lets you run code on exit,
-# including functions from myHBridge
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-myHBridge.setSpeed(10) # 10 RPMs
-myHBridge.setDirection(upmL298.L298.DIR_CW)
-myHBridge.enable(True)
-
-print "Rotating 1 full revolution at 10 RPM speed."
-# move 200 steps, a full rev
-myHBridge.stepperSteps(200)
-
-print "Sleeping for 2 seconds..."
-time.sleep(2)
-
-print "Rotating 1/2 revolution in opposite direction at 10 RPM speed."
-myHBridge.setDirection(upmL298.L298.DIR_CCW)
-myHBridge.stepperSteps(100)
-
-# release
-myHBridge.enable(False)
-
-# exitHandler is called automatically
diff --git a/peripheral/libupm/examples/python/l298.py b/peripheral/libupm/examples/python/l298.py
deleted file mode 100644
index f0b507c..0000000
--- a/peripheral/libupm/examples/python/l298.py
+++ /dev/null
@@ -1,65 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-
-import time, sys, signal, atexit
-import pyupm_l298 as upmL298
-
-# Instantiate one of the 2 possible DC motors on a L298 Dual
-# H-Bridge. For controlling a stepper motor, see the l298-stepper
-# example.
-myHBridge = upmL298.L298(3, 4, 7)
-
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This lets you run code on exit,
-# including functions from myHBridge
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-print "Starting motor at 50% for 3 seconds..."
-myHBridge.setSpeed(50)
-myHBridge.setDirection(upmL298.L298.DIR_CW)
-myHBridge.enable(True)
-
-time.sleep(3)
-
-print "Reversing direction..."
-myHBridge.setDirection(upmL298.L298.DIR_NONE) # fast stop
-myHBridge.setDirection(upmL298.L298.DIR_CCW)
-time.sleep(3);
-
-myHBridge.setSpeed(0)
-myHBridge.enable(False)
-
-# exitHandler is called automatically
diff --git a/peripheral/libupm/examples/python/ldt0028.py b/peripheral/libupm/examples/python/ldt0028.py
deleted file mode 100644
index b6001a7..0000000
--- a/peripheral/libupm/examples/python/ldt0028.py
+++ /dev/null
@@ -1,66 +0,0 @@
-# Author: Sarah Knepper <sarah.knepper@intel.com>
-# Copyright (c) 2014 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time
-import array
-import pyupm_ldt0028 as ldt0028
-
-NUMBER_OF_SECONDS = 10
-SAMPLES_PER_SECOND = 50
-THRESHOLD = 100
-
-# Create the LDT0-028 Piezo Vibration Sensor object using AIO pin 0
-sensor = ldt0028.LDT0028(0)
-
-# Read the signal every 20 milliseconds for 10 seconds
-print 'For the next', NUMBER_OF_SECONDS, 'seconds,', \
- SAMPLES_PER_SECOND, 'samples will be taken every second.\n'
-buffer = array.array('H')
-for i in range(0, NUMBER_OF_SECONDS * SAMPLES_PER_SECOND):
- buffer.append(sensor.getSample())
- time.sleep(1.0/SAMPLES_PER_SECOND)
-
-# Print the number of times the reading was greater than the threshold
-count = 0
-for i in range(0, NUMBER_OF_SECONDS * SAMPLES_PER_SECOND):
- if buffer[i] > THRESHOLD:
- count += 1
-print sensor.name(), ' exceeded the threshold value of', \
- THRESHOLD, 'a total of', count, 'times,'
-print 'out of a total of', NUMBER_OF_SECONDS*SAMPLES_PER_SECOND, \
- 'reading.\n'
-
-# Print a graphical representation of the average value sampled
-# each second for the past 10 seconds, using a scale factor of 15
-print 'Now printing a graphical representation of the average reading '
-print 'each second for the last', NUMBER_OF_SECONDS, 'seconds.'
-SCALE_FACTOR = 15
-for i in range(0, NUMBER_OF_SECONDS):
- sum = 0
- for j in range(0, SAMPLES_PER_SECOND):
- sum += buffer[i*SAMPLES_PER_SECOND+j]
- average = sum / SAMPLES_PER_SECOND
- stars_to_print = int(round(average / SCALE_FACTOR))
- print '(' + repr(int(round(average))).rjust(4) + ') |', '*' * stars_to_print
-
-# Delete the sensor object
-del sensor
diff --git a/peripheral/libupm/examples/python/lm35.py b/peripheral/libupm/examples/python/lm35.py
deleted file mode 100644
index 342f0a9..0000000
--- a/peripheral/libupm/examples/python/lm35.py
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_lm35 as sensorObj
-
-# Instantiate a LM35 on analog pin A0, with a default analog
-# reference voltage of 5.0
-sensor = sensorObj.LM35(0)
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-# Every half second, sample the sensor and output the temperature
-
-while (1):
- print "Temperature:", sensor.getTemperature(), "C"
- time.sleep(.5)
diff --git a/peripheral/libupm/examples/python/loudness.py b/peripheral/libupm/examples/python/loudness.py
deleted file mode 100644
index 1b4101b..0000000
--- a/peripheral/libupm/examples/python/loudness.py
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_loudness as sensorObj
-
-# Instantiate a Loudness sensor on analog pin A0, with an analog
-# reference voltage of 5.0
-sensor = sensorObj.Loudness(0, 5.0)
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-# Every tenth of a second, sample the loudness and output it's
-# corresponding analog voltage.
-
-while (1):
- print "Detected loudness (volts): ", sensor.loudness()
- time.sleep(.1)
diff --git a/peripheral/libupm/examples/python/lsm303.py b/peripheral/libupm/examples/python/lsm303.py
deleted file mode 100644
index adc4cd2..0000000
--- a/peripheral/libupm/examples/python/lsm303.py
+++ /dev/null
@@ -1,87 +0,0 @@
-#!/usr/bin/python
-
-# Author: Brendan Le Foll <brendan.le.foll@intel.com>
-# Contributions: Zion Orent <zorent@ics.com>
-# Copyright (c) 2014 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE
-
-import time, sys, signal, atexit
-import pyupm_lsm303 as lsm303
-
-# Instantiate LSM303 compass on I2C
-myAccelrCompass = lsm303.LSM303(0)
-
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This lets you run code on exit,
-# including functions from myAccelrCompass
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-while(1):
- # Load coordinates into LSM303 object
- successFail = myAccelrCompass.getCoordinates()
- # in XYZ order. The sensor returns XZY,
- # but the driver compensates and makes it XYZ
- coords = myAccelrCompass.getRawCoorData()
-
- # Print out the X, Y, and Z coordinate data
- # using two different methods
- outputStr = "coor: rX {0} - rY {1} - rZ {2}".format(
- coords.__getitem__(0), coords.__getitem__(1),
- coords.__getitem__(2))
- print outputStr
-
- outputStr = "coor: gX {0} - gY {1} - gZ {2}".format(
- myAccelrCompass.getCoorX(), myAccelrCompass.getCoorY(),
- myAccelrCompass.getCoorZ())
- print outputStr
-
- # Get and print out the heading
- print "heading:", myAccelrCompass.getHeading()
-
- # Get the acceleration
- myAccelrCompass.getAcceleration();
- accel = myAccelrCompass.getRawAccelData();
-
- # Print out the X, Y, and Z acceleration data
- # using two different methods
- outputStr = "acc: rX {0} - rY {1} - Z {2}".format(
- accel.__getitem__(0), accel.__getitem__(1), accel.__getitem__(2))
- print outputStr
-
- outputStr = "acc: gX {0} - gY {1} - gZ {2}".format(
- myAccelrCompass.getAccelX(), myAccelrCompass.getAccelY(),
- myAccelrCompass.getAccelZ())
- print outputStr
-
- print " "
- time.sleep(1)
diff --git a/peripheral/libupm/examples/python/lsm9ds0.py b/peripheral/libupm/examples/python/lsm9ds0.py
deleted file mode 100644
index 10edc94..0000000
--- a/peripheral/libupm/examples/python/lsm9ds0.py
+++ /dev/null
@@ -1,71 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_lsm9ds0 as sensorObj
-
-# Instantiate an LSM9DS0 using default parameters (bus 1, gyro addr 6b,
-# xm addr 1d)
-sensor = sensorObj.LSM9DS0()
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-sensor.init()
-
-x = sensorObj.new_floatp()
-y = sensorObj.new_floatp()
-z = sensorObj.new_floatp()
-
-while (1):
- sensor.update()
- sensor.getAccelerometer(x, y, z)
- print "Accelerometer: AX: ", sensorObj.floatp_value(x),
- print " AY: ", sensorObj.floatp_value(y),
- print " AZ: ", sensorObj.floatp_value(z)
-
- sensor.getGyroscope(x, y, z)
- print "Gyroscope: GX: ", sensorObj.floatp_value(x),
- print " GY: ", sensorObj.floatp_value(y),
- print " GZ: ", sensorObj.floatp_value(z)
-
- sensor.getMagnetometer(x, y, z)
- print "Magnetometer: MX: ", sensorObj.floatp_value(x),
- print " MY: ", sensorObj.floatp_value(y),
- print " MZ: ", sensorObj.floatp_value(z)
-
- print "Temperature: ", sensor.getTemperature()
- print
-
- time.sleep(.5)
diff --git a/peripheral/libupm/examples/python/m24lr64e.py b/peripheral/libupm/examples/python/m24lr64e.py
deleted file mode 100644
index 848181e..0000000
--- a/peripheral/libupm/examples/python/m24lr64e.py
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import sys
-import pyupm_m24lr64e as nfcTagObj
-
-# Instantiate a M24LR64E Grove NFC Tag Module on UART 0
-nfcTag = nfcTagObj.M24LR64E(nfcTagObj.M24LR64E_I2C_BUS)
-
-# This example accesses the device in the 'user' (default) mode,
-# reads the last byte of data in the EEPROM, inverts it, writes
-# it back, and then re-reads it.
-
-# Read the last byte of the EEPROM area
-addr = (nfcTagObj.M24LR64E.EEPROM_I2C_LENGTH - 1)
-print "Address: ", addr
-byte = nfcTag.readByte(addr)
-
-print "Read byte: ", format(byte, '02x')
-
-# Now change it to it's opposite and write it
-byte = (~byte & 0xff)
-nfcTag.writeByte(addr, byte)
-print "Wrote inverted byte: ", format(byte, '02x')
-
-# Now read it back.
-byte = nfcTag.readByte(addr)
-print "Read byte: ", format(byte, '02x')
-
diff --git a/peripheral/libupm/examples/python/make_oled_pic.py b/peripheral/libupm/examples/python/make_oled_pic.py
deleted file mode 100755
index 85b3ca0..0000000
--- a/peripheral/libupm/examples/python/make_oled_pic.py
+++ /dev/null
@@ -1,74 +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
-
-from __future__ import print_function
-
-from PIL import Image
-import sys
-
-# Pixels are arranged in one byte for 8 vertical pixels and not addressed individually
-# We convert the image to greysacle and end up making it monochrome where we
-# consider that every pixel that is '40' is black.
-
-width = 128
-height = 64
-
-if len(sys.argv) != 2:
- print('Please specify an image to use as the only argument')
- exit(1)
-
-im = Image.open(sys.argv[1])
-im = im.convert('L').resize((width, height))
-
-data = list(im.getdata())
-
-byteblock = [0 for i in range(width)]
-widthblock = [list(byteblock) for i in range(int(height/8))]
-numblock = 0
-pixcount = 0
-i = 0
-
-# we split the list by width * 8, to create data chunks of 8rows
-datachunks=[data[x:x+(width*8)] for x in range(0, len(data), (width*8))]
-
-# grab every pixel of image (or datachunk)
-while i < len(widthblock):
- pixcount = 0
- for y in datachunks[i]:
- xcoor = pixcount % width
- ycoor = int(pixcount/width)
- blknum = xcoor % len(widthblock)
- blkycoor = ycoor
-
- # 40 is what we consider 'black'
- if y > 40:
- widthblock[i][xcoor] |= (1 << blkycoor)
-
- pixcount += 1
- i += 1
-
-flatlist = [y for x in widthblock for y in x]
-
-carray = 'static uint8_t image[] = {\n' + ', '.join(str(x) for x in flatlist)
-print(carray + '\n};')
diff --git a/peripheral/libupm/examples/python/maxsonarez.py b/peripheral/libupm/examples/python/maxsonarez.py
deleted file mode 100644
index 645ca58..0000000
--- a/peripheral/libupm/examples/python/maxsonarez.py
+++ /dev/null
@@ -1,60 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_maxsonarez as MaxSonarEZ
-
-# Instantiate a MaxSonar-EZ on analog pin A1, with an analog
-# reference voltage of MAXSONAREZ_AREF
-Sonar = MaxSonarEZ.MAXSONAREZ(1)
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This lets you run code on exit,
-# including functions from Sonar
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-# analog voltage, usually 3.3 or 5.0
-MAXSONAREZ_AREF = 5.0;
-
-# Every second, sample the sonar and output the distance to an
-# object in inches.
-
-# With the EZ3 version, the minimum and maximum ranges seemed to be
-# between 6 and 33 inches
-
-while (1):
- print "AREF: {0}, distance in inches: {1}".format(
- MAXSONAREZ_AREF,
- Sonar.inches())
- time.sleep(1)
diff --git a/peripheral/libupm/examples/python/mg811.py b/peripheral/libupm/examples/python/mg811.py
deleted file mode 100644
index 78a75d8..0000000
--- a/peripheral/libupm/examples/python/mg811.py
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_mg811 as sensorObj
-
-# Instantiate an MG811 on analog pin A0, and digital pin D2 with an
-# analog reference voltage of MG811_AREF (5.0)
-
-sensor = sensorObj.MG811(0, 2, 5.0)
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-# Every tenth of a second, sample the sensor and output it's
-# detected CO2 concentration in parts per million (ppm)
-
-while (1):
- print "CO2 concentration in PPM: ", sensor.ppm()
- time.sleep(.1)
diff --git a/peripheral/libupm/examples/python/mhz16.py b/peripheral/libupm/examples/python/mhz16.py
deleted file mode 100644
index 4fa0615..0000000
--- a/peripheral/libupm/examples/python/mhz16.py
+++ /dev/null
@@ -1,70 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_mhz16 as upmMhz16
-
-# Instantiate a MHZ16 serial CO2 sensor on uart 0.
-# This example was tested on the Grove CO2 sensor module.
-myCO2 = upmMhz16.MHZ16(0)
-
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit,
-# including functions from myCO2
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-# make sure port is initialized properly. 9600 baud is the default.
-if (not myCO2.setupTty(upmMhz16.cvar.int_B9600)):
- print "Failed to setup tty port parameters"
- sys.exit(0)
-
-print ("Make sure that the sensor has had "
-"at least 3 minutes to warm up\n"
-"or you will not get valid results.\n"
-"The temperature reported is not the ambient temperature,\n"
-"but rather the temperature of the sensor elements.")
-
-time.sleep(1)
-
-while(1):
- if (not myCO2.getData()):
- print "Failed to retrieve data"
- else:
- outputStr = ("CO2 concentration: {0} PPM, "
- "Temperature (in C): {1}".format(
- myCO2.getGas(), myCO2.getTemperature()))
- print outputStr
-
- time.sleep(2)
diff --git a/peripheral/libupm/examples/python/mic.py b/peripheral/libupm/examples/python/mic.py
deleted file mode 100644
index 240d61e..0000000
--- a/peripheral/libupm/examples/python/mic.py
+++ /dev/null
@@ -1,47 +0,0 @@
-# Author: John Van Drasek <john.r.van.drasek@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 time
-import pyupm_mic as upmMicrophone
-
-# Attach microphone to analog port A0
-myMic = upmMicrophone.Microphone(0)
-threshContext = upmMicrophone.thresholdContext()
-threshContext.averageReading = 0
-threshContext.runningAverage = 0
-threshContext.averagedOver = 2
-
-# Infinite loop, ends when script is cancelled
-# Repeatedly, take a sample every 2 microseconds;
-# find the average of 128 samples; and
-# print a running graph of dots as averages
-while(1):
- buffer = upmMicrophone.uint16Array(128)
- len = myMic.getSampledWindow(2, 128, buffer);
- if len:
- thresh = myMic.findThreshold(threshContext, 30, buffer, len)
- myMic.printGraph(threshContext)
- if(thresh):
- print "Threshold is ", thresh
-
-# Delete the upmMicrophone object
-del myMic
diff --git a/peripheral/libupm/examples/python/mma7660.py b/peripheral/libupm/examples/python/mma7660.py
deleted file mode 100644
index 1471a60..0000000
--- a/peripheral/libupm/examples/python/mma7660.py
+++ /dev/null
@@ -1,81 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_mma7660 as upmMMA7660
-
-# Instantiate an MMA7660 on I2C bus 0
-myDigitalAccelerometer = upmMMA7660.MMA7660(
- upmMMA7660.MMA7660_I2C_BUS,
- upmMMA7660.MMA7660_DEFAULT_I2C_ADDR);
-
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit, including functions from myDigitalAccelerometer
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-# place device in standby mode so we can write registers
-myDigitalAccelerometer.setModeStandby()
-
-# enable 64 samples per second
-myDigitalAccelerometer.setSampleRate(upmMMA7660.MMA7660.AUTOSLEEP_64)
-
-# place device into active mode
-myDigitalAccelerometer.setModeActive()
-
-x = upmMMA7660.new_intp()
-y = upmMMA7660.new_intp()
-z = upmMMA7660.new_intp()
-
-ax = upmMMA7660.new_floatp()
-ay = upmMMA7660.new_floatp()
-az = upmMMA7660.new_floatp()
-
-while (1):
- myDigitalAccelerometer.getRawValues(x, y, z)
- outputStr = ("Raw values: x = {0}"
- " y = {1}"
- " z = {2}").format(upmMMA7660.intp_value(x),
- upmMMA7660.intp_value(y),
- upmMMA7660.intp_value(z))
- print outputStr
-
- myDigitalAccelerometer.getAcceleration(ax, ay, az)
- outputStr = ("Acceleration: x = {0}"
- "g y = {1}"
- "g z = {2}g").format(upmMMA7660.floatp_value(ax),
- upmMMA7660.floatp_value(ay),
- upmMMA7660.floatp_value(az))
- print outputStr
- time.sleep(.5)
diff --git a/peripheral/libupm/examples/python/mpr121.py b/peripheral/libupm/examples/python/mpr121.py
deleted file mode 100644
index 8e38262..0000000
--- a/peripheral/libupm/examples/python/mpr121.py
+++ /dev/null
@@ -1,73 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_mpr121 as upmMpr121
-
-I2C_BUS = upmMpr121.MPR121_I2C_BUS
-DEFAULT_I2C_ADDR = upmMpr121.MPR121_DEFAULT_I2C_ADDR
-
-# Instantiate an MPR121 touch sensor on I2C
-myTouchSensor = upmMpr121.MPR121(I2C_BUS, DEFAULT_I2C_ADDR)
-
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit,
-# including functions from myTouchSensor
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-
-def printButtons(touchSensor):
- buttonPressed = False
-
- outputStr = "Buttons Pressed: "
- for i in range(12):
- if (touchSensor.m_buttonStates & (1 << i)):
- outputStr += (str(i) + " ")
- buttonPressed = True
-
- if (not buttonPressed):
- outputStr += "None"
-
- print outputStr
-
- if (touchSensor.m_overCurrentFault):
- print "Over Current Fault detected!"
-
-
-while(1):
- myTouchSensor.readButtons()
- printButtons(myTouchSensor)
-
- time.sleep(1)
diff --git a/peripheral/libupm/examples/python/mpu60x0.py b/peripheral/libupm/examples/python/mpu60x0.py
deleted file mode 100644
index 009e3ee..0000000
--- a/peripheral/libupm/examples/python/mpu60x0.py
+++ /dev/null
@@ -1,65 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_mpu9150 as sensorObj
-
-# Instantiate an MPU60X0 on I2C bus 0
-sensor = sensorObj.MPU60X0()
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-sensor.init()
-
-x = sensorObj.new_floatp()
-y = sensorObj.new_floatp()
-z = sensorObj.new_floatp()
-
-while (1):
- sensor.update()
- sensor.getAccelerometer(x, y, z)
- print "Accelerometer: AX: ", sensorObj.floatp_value(x),
- print " AY: ", sensorObj.floatp_value(y),
- print " AZ: ", sensorObj.floatp_value(z)
-
- sensor.getGyroscope(x, y, z)
- print "Gyroscope: GX: ", sensorObj.floatp_value(x),
- print " GY: ", sensorObj.floatp_value(y),
- print " GZ: ", sensorObj.floatp_value(z)
-
- print "Temperature: ", sensor.getTemperature()
- print
-
- time.sleep(.5)
diff --git a/peripheral/libupm/examples/python/mpu9150.py b/peripheral/libupm/examples/python/mpu9150.py
deleted file mode 100644
index bba54b0..0000000
--- a/peripheral/libupm/examples/python/mpu9150.py
+++ /dev/null
@@ -1,70 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_mpu9150 as sensorObj
-
-# Instantiate an MPU9150 on I2C bus 0
-sensor = sensorObj.MPU9150()
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-sensor.init()
-
-x = sensorObj.new_floatp()
-y = sensorObj.new_floatp()
-z = sensorObj.new_floatp()
-
-while (1):
- sensor.update()
- sensor.getAccelerometer(x, y, z)
- print "Accelerometer: AX: ", sensorObj.floatp_value(x),
- print " AY: ", sensorObj.floatp_value(y),
- print " AZ: ", sensorObj.floatp_value(z)
-
- sensor.getGyroscope(x, y, z)
- print "Gyroscope: GX: ", sensorObj.floatp_value(x),
- print " GY: ", sensorObj.floatp_value(y),
- print " GZ: ", sensorObj.floatp_value(z)
-
- sensor.getMagnetometer(x, y, z)
- print "Magnetometer: MX: ", sensorObj.floatp_value(x),
- print " MY: ", sensorObj.floatp_value(y),
- print " MZ: ", sensorObj.floatp_value(z)
-
- print "Temperature: ", sensor.getTemperature()
- print
-
- time.sleep(.5)
diff --git a/peripheral/libupm/examples/python/mpu9250.py b/peripheral/libupm/examples/python/mpu9250.py
deleted file mode 100644
index 1653846..0000000
--- a/peripheral/libupm/examples/python/mpu9250.py
+++ /dev/null
@@ -1,70 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_mpu9150 as sensorObj
-
-# Instantiate an MPU9250 on I2C bus 0
-sensor = sensorObj.MPU9250()
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-sensor.init()
-
-x = sensorObj.new_floatp()
-y = sensorObj.new_floatp()
-z = sensorObj.new_floatp()
-
-while (1):
- sensor.update()
- sensor.getAccelerometer(x, y, z)
- print "Accelerometer: AX: ", sensorObj.floatp_value(x),
- print " AY: ", sensorObj.floatp_value(y),
- print " AZ: ", sensorObj.floatp_value(z)
-
- sensor.getGyroscope(x, y, z)
- print "Gyroscope: GX: ", sensorObj.floatp_value(x),
- print " GY: ", sensorObj.floatp_value(y),
- print " GZ: ", sensorObj.floatp_value(z)
-
- sensor.getMagnetometer(x, y, z)
- print "Magnetometer: MX: ", sensorObj.floatp_value(x),
- print " MY: ", sensorObj.floatp_value(y),
- print " MZ: ", sensorObj.floatp_value(z)
-
- print "Temperature: ", sensor.getTemperature()
- print
-
- time.sleep(.5)
diff --git a/peripheral/libupm/examples/python/mq2.py b/peripheral/libupm/examples/python/mq2.py
deleted file mode 100644
index 3073fda..0000000
--- a/peripheral/libupm/examples/python/mq2.py
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_gas as upmGas
-
-# Attach gas sensor to AIO0
-myMQ2 = upmGas.MQ2(0);
-
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit, including functions from myMQ2
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-threshContext = upmGas.thresholdContext()
-threshContext.averageReading = 0
-threshContext.runningAverage = 0
-threshContext.averagedOver = 2
-
-# Infinite loop, ends when script is cancelled
-# Repeatedly, take a sample every 2 microseconds;
-# find the average of 128 samples; and
-# print a running graph of dots as averages
-mybuffer = upmGas.uint16Array(128)
-while(1):
- samplelen = myMQ2.getSampledWindow(2, 128, mybuffer)
- if samplelen:
- thresh = myMQ2.findThreshold(threshContext, 30, mybuffer, samplelen)
- myMQ2.printGraph(threshContext, 5)
- if(thresh):
- print "Threshold is ", thresh
diff --git a/peripheral/libupm/examples/python/mq3.py b/peripheral/libupm/examples/python/mq3.py
deleted file mode 100644
index c464cfc..0000000
--- a/peripheral/libupm/examples/python/mq3.py
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_gas as upmGas
-
-# Attach gas sensor to AIO0
-myMQ3 = upmGas.MQ3(0)
-
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit, including functions from myMQ3
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-threshContext = upmGas.thresholdContext()
-threshContext.averageReading = 0
-threshContext.runningAverage = 0
-threshContext.averagedOver = 2
-
-# Infinite loop, ends when script is cancelled
-# Repeatedly, take a sample every 2 microseconds;
-# find the average of 128 samples; and
-# print a running graph of dots as averages
-mybuffer = upmGas.uint16Array(128)
-while(1):
- samplelen = myMQ3.getSampledWindow(2, 128, mybuffer)
- if samplelen:
- thresh = myMQ3.findThreshold(threshContext, 30, mybuffer, samplelen)
- myMQ3.printGraph(threshContext, 5)
- if(thresh):
- print "Threshold is ", thresh
diff --git a/peripheral/libupm/examples/python/mq303a.py b/peripheral/libupm/examples/python/mq303a.py
deleted file mode 100644
index de71bcf..0000000
--- a/peripheral/libupm/examples/python/mq303a.py
+++ /dev/null
@@ -1,75 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-
-# Load alcohol sensor module
-import pyupm_mq303a as upmMq303a
-
-# Instantiate an mq303a sensor on analog pin A0
-# This device uses a heater powered from an analog I/O pin.
-# If using A0 as the data pin, then you need to use A1, as the heater
-# pin (if using a grove mq303a). For A1, we can use the D15 gpio,
-# setup as an output, and drive it low to power the heater.
-myAlcoholSensor = upmMq303a.MQ303A(0, 15)
-
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit, including functions from myAlcoholSensor
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-print "Enabling heater and waiting 2 minutes for warmup."
-
-# give time updates every 30 seconds until 2 minutes have passed
-# for the alcohol sensor to warm up
-def warmup(iteration):
- totalSeconds = (30 * iteration)
- time.sleep(30)
- print totalSeconds, "seconds have passed"
-warmup(1)
-warmup(2)
-warmup(3)
-warmup(4)
-
-notice = ("This sensor may need to warm "
-"until the value drops below about 450.")
-print notice
-
-# Print the detected alcohol value every second
-while(1):
- val = myAlcoholSensor.value()
- msg = "Alcohol detected "
- msg += "(higher means stronger alcohol): "
- print msg + str(val)
- time.sleep(1)
diff --git a/peripheral/libupm/examples/python/mq4.py b/peripheral/libupm/examples/python/mq4.py
deleted file mode 100644
index 579246b..0000000
--- a/peripheral/libupm/examples/python/mq4.py
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_gas as upmGAS
-
-# Attach gas sensor to Analog A0
-sensor = upmGAS.MQ4(0)
-
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit, including functions from sensor
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-threshContext = upmGAS.thresholdContext()
-threshContext.averageReading = 0
-threshContext.runningAverage = 0
-threshContext.averagedOver = 2
-
-# Infinite loop, ends when script is cancelled
-# Repeatedly, take a sample every 2 microseconds;
-# find the average of 128 samples; and
-# print a running graph of asteriskss as averages
-mybuffer = upmGAS.uint16Array(128)
-while(1):
- samplelen = sensor.getSampledWindow(2, 128, mybuffer)
- if samplelen:
- thresh = sensor.findThreshold(threshContext, 30, mybuffer, samplelen)
- sensor.printGraph(threshContext, 5)
-# if(thresh):
-# print "Threshold is ", thresh
diff --git a/peripheral/libupm/examples/python/mq5.py b/peripheral/libupm/examples/python/mq5.py
deleted file mode 100644
index 5e7deb8..0000000
--- a/peripheral/libupm/examples/python/mq5.py
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_gas as upmGas
-
-# Attach gas sensor to AIO0
-myMQ5 = upmGas.MQ5(0)
-
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit, including functions from myMQ5
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-threshContext = upmGas.thresholdContext()
-threshContext.averageReading = 0
-threshContext.runningAverage = 0
-threshContext.averagedOver = 2
-
-# Infinite loop, ends when script is cancelled
-# Repeatedly, take a sample every 2 microseconds;
-# find the average of 128 samples; and
-# print a running graph of dots as averages
-mybuffer = upmGas.uint16Array(128)
-while(1):
- samplelen = myMQ5.getSampledWindow(2, 128, mybuffer)
- if samplelen:
- thresh = myMQ5.findThreshold(threshContext, 30, mybuffer, samplelen)
- myMQ5.printGraph(threshContext, 5)
- if(thresh):
- print "Threshold is ", thresh
diff --git a/peripheral/libupm/examples/python/mq6.py b/peripheral/libupm/examples/python/mq6.py
deleted file mode 100644
index 8788e23..0000000
--- a/peripheral/libupm/examples/python/mq6.py
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_gas as upmGAS
-
-# Attach gas sensor to Analog A0
-sensor = upmGAS.MQ6(0)
-
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit, including functions from sensor
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-threshContext = upmGAS.thresholdContext()
-threshContext.averageReading = 0
-threshContext.runningAverage = 0
-threshContext.averagedOver = 2
-
-# Infinite loop, ends when script is cancelled
-# Repeatedly, take a sample every 2 microseconds;
-# find the average of 128 samples; and
-# print a running graph of asteriskss as averages
-mybuffer = upmGAS.uint16Array(128)
-while(1):
- samplelen = sensor.getSampledWindow(2, 128, mybuffer)
- if samplelen:
- thresh = sensor.findThreshold(threshContext, 30, mybuffer, samplelen)
- sensor.printGraph(threshContext, 5)
-# if(thresh):
-# print "Threshold is ", thresh
diff --git a/peripheral/libupm/examples/python/mq7.py b/peripheral/libupm/examples/python/mq7.py
deleted file mode 100644
index 62a9056..0000000
--- a/peripheral/libupm/examples/python/mq7.py
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_gas as upmGAS
-
-# Attach gas sensor to Analog A0
-sensor = upmGAS.MQ7(0)
-
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit, including functions from sensor
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-threshContext = upmGAS.thresholdContext()
-threshContext.averageReading = 0
-threshContext.runningAverage = 0
-threshContext.averagedOver = 2
-
-# Infinite loop, ends when script is cancelled
-# Repeatedly, take a sample every 2 microseconds;
-# find the average of 128 samples; and
-# print a running graph of asteriskss as averages
-mybuffer = upmGAS.uint16Array(128)
-while(1):
- samplelen = sensor.getSampledWindow(2, 128, mybuffer)
- if samplelen:
- thresh = sensor.findThreshold(threshContext, 30, mybuffer, samplelen)
- sensor.printGraph(threshContext, 5)
-# if(thresh):
-# print "Threshold is ", thresh
diff --git a/peripheral/libupm/examples/python/mq8.py b/peripheral/libupm/examples/python/mq8.py
deleted file mode 100644
index 5380018..0000000
--- a/peripheral/libupm/examples/python/mq8.py
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_gas as upmGAS
-
-# Attach gas sensor to Analog A0
-sensor = upmGAS.MQ8(0)
-
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit, including functions from sensor
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-threshContext = upmGAS.thresholdContext()
-threshContext.averageReading = 0
-threshContext.runningAverage = 0
-threshContext.averagedOver = 2
-
-# Infinite loop, ends when script is cancelled
-# Repeatedly, take a sample every 2 microseconds;
-# find the average of 128 samples; and
-# print a running graph of asteriskss as averages
-mybuffer = upmGAS.uint16Array(128)
-while(1):
- samplelen = sensor.getSampledWindow(2, 128, mybuffer)
- if samplelen:
- thresh = sensor.findThreshold(threshContext, 30, mybuffer, samplelen)
- sensor.printGraph(threshContext, 5)
-# if(thresh):
-# print "Threshold is ", thresh
diff --git a/peripheral/libupm/examples/python/mq9.py b/peripheral/libupm/examples/python/mq9.py
deleted file mode 100644
index f39cf39..0000000
--- a/peripheral/libupm/examples/python/mq9.py
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_gas as upmGas
-
-# Attach gas sensor to AIO0
-myMQ9 = upmGas.MQ9(0)
-
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit, including functions from myMQ9
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-threshContext = upmGas.thresholdContext()
-threshContext.averageReading = 0
-threshContext.runningAverage = 0
-threshContext.averagedOver = 2
-
-# Infinite loop, ends when script is cancelled
-# Repeatedly, take a sample every 2 microseconds;
-# find the average of 128 samples; and
-# print a running graph of dots as averages
-mybuffer = upmGas.uint16Array(128)
-while(1):
- samplelen = myMQ9.getSampledWindow(2, 128, mybuffer)
- if samplelen:
- thresh = myMQ9.findThreshold(threshContext, 30, mybuffer, samplelen)
- myMQ9.printGraph(threshContext, 5)
- if(thresh):
- print "Threshold is ", thresh
diff --git a/peripheral/libupm/examples/python/nlgpio16.py b/peripheral/libupm/examples/python/nlgpio16.py
deleted file mode 100644
index 7be815d..0000000
--- a/peripheral/libupm/examples/python/nlgpio16.py
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import sys, signal, atexit
-import pyupm_nlgpio16 as sensorObj
-
-# Instantiate a NLGPIO16 Module on the default UART (/dev/ttyACM0)
-sensor = sensorObj.NLGPIO16()
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-# get the Version
-print "Device Version:", sensor.getVersion()
-# read the gpio at pin 3
-print "GPIO 3 Value:", sensor.gpioRead(3)
-# read the analog voltage at pin 5
-print "Analog 5 Voltage:", sensor.analogReadVolts(5)
-# set the gpio at pin 14 to HIGH
-sensor.gpioSet(14)
diff --git a/peripheral/libupm/examples/python/nunchuck.py b/peripheral/libupm/examples/python/nunchuck.py
deleted file mode 100644
index f7bc261..0000000
--- a/peripheral/libupm/examples/python/nunchuck.py
+++ /dev/null
@@ -1,73 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_nunchuck as upmNunchuck
-
-# Instantiate a nunchuck controller bus 0 on I2C
-myNunchuck = upmNunchuck.NUNCHUCK(0)
-
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit, including functions from myNunchuck
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-# always do this first
-print "Initializing... "
-if (not myNunchuck.init()):
- print "nunchuck->init() failed."
- sys.exit(0);
-
-def buttonStateStr(buttonState):
- return "pressed" if buttonState else "not pressed"
-
-# Print the X and Y input values every second
-while(1):
- myNunchuck.update()
-
- outputStr = "stickX: {0}, stickY: {1}".format(
- myNunchuck.stickX, myNunchuck.stickY)
- print outputStr
- outputStr = "accelX: {0}, accelY: {1}, accelZ: {2}".format(
- myNunchuck.accelX, myNunchuck.accelY, myNunchuck.accelZ)
- print outputStr
-
- outputStr = "button C: {0}".format(
- buttonStateStr(myNunchuck.buttonC))
- print outputStr
- outputStr = "button Z: {0}".format(
- buttonStateStr(myNunchuck.buttonZ))
- print outputStr
-
- time.sleep(.1)
diff --git a/peripheral/libupm/examples/python/oled_ssd1308.py b/peripheral/libupm/examples/python/oled_ssd1308.py
deleted file mode 100644
index 9ea1443..0000000
--- a/peripheral/libupm/examples/python/oled_ssd1308.py
+++ /dev/null
@@ -1,95 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-# Load i2clcd display module
-import time, signal, sys
-import pyupm_i2clcd as upmLCD
-
-myLCD = upmLCD.SSD1308(0, 0x3C);
-
-logoArr = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 192, 192, 192, 224,
-224, 224, 224, 240, 240, 248, 248, 120, 120, 120, 120, 60, 60, 60, 60, 60,
-62, 30, 30, 30, 30, 30, 30, 30, 31, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
-15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 31, 31, 31, 31, 31,
-30, 62, 62, 62, 62, 126, 126, 124, 124, 252, 252, 248, 248, 240, 240, 240,
-224, 224, 224, 192, 128, 128, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 128, 128, 128,
-128, 0, 56, 56, 28, 30, 14, 15, 15, 7, 7, 7, 7, 3, 3, 1, 1, 1, 1, 0, 0, 0,
-0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-192, 192, 192, 192, 192, 192, 192, 192, 0, 0, 0, 0, 192, 193, 195, 195,
-195, 7, 15, 15, 63, 127, 255, 255, 255, 254, 252, 252, 240, 192, 0, 0, 0,
-0, 0, 0, 0, 0, 128, 192, 192, 240, 248, 124, 124, 60, 0, 0, 0, 0, 159, 159,
-159, 159, 159, 159, 159, 159, 0, 0, 0, 0, 128, 128, 128, 128, 128, 128,
-128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 0, 0,
-0, 0, 0, 0, 254, 254, 254, 254, 254, 254, 254, 254, 128, 128, 128, 128,
-128, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 192, 192, 192, 192, 192, 192, 128,
-128, 128, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255,
-0, 0, 0, 0, 3, 7, 3, 3, 3, 0, 0, 0, 0, 0, 1, 1, 255, 255, 255, 255, 255,
-255, 255, 0, 0, 224, 248, 252, 252, 255, 127, 15, 15, 3, 1, 0, 0, 0, 0, 0,
-0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 255,
-255, 255, 255, 255, 255, 15, 15, 15, 15, 15, 15, 255, 255, 255, 255, 255,
-255, 255, 252, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 15, 15,
-15, 15, 15, 224, 224, 252, 254, 255, 255, 255, 255, 159, 159, 143, 143,
-135, 135, 143, 159, 255, 255, 255, 255, 255, 255, 252, 248, 0, 0, 0, 255,
-255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128,
-224, 248, 248, 255, 255, 255, 255, 255, 127, 15, 255, 255, 255, 255, 255,
-255, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255,
-255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0,
-0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 255,
-255, 255, 255, 255, 255, 192, 192, 192, 192, 192, 31, 31, 255, 255, 255,
-255, 255, 255, 231, 231, 199, 199, 199, 199, 199, 199, 199, 199, 231, 231,
-231, 231, 199, 135, 0, 0, 0, 63, 255, 255, 255, 255, 255, 255, 255, 0, 0,
-0, 0, 224, 240, 248, 248, 252, 254, 255, 255, 255, 127, 63, 63, 31, 15, 7,
-7, 1, 0, 0, 63, 63, 255, 255, 255, 255, 255, 240, 192, 192, 128, 0, 0, 0,
-0, 0, 0, 0, 0, 1, 3, 3, 7, 7, 7, 7, 7, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7,
-0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 3, 3, 7, 7, 7,
-7, 7, 7, 7, 7, 7, 0, 0, 0, 1, 3, 3, 3, 7, 7, 7, 7, 15, 15, 15, 15, 7, 7, 7,
-7, 7, 3, 3, 3, 1, 0, 0, 0, 0, 1, 3, 3, 7, 135, 135, 135, 192, 192, 0, 0, 7,
-7, 3, 3, 3, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 7, 15, 15,
-31, 127, 127, 127, 255, 255, 252, 252, 252, 248, 240, 240, 240, 224, 224,
-224, 192, 192, 192, 192, 128, 128, 128, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-0, 0, 0, 0, 0, 128, 128, 128, 128, 128, 128, 128, 192, 192, 192, 192, 192,
-224, 224, 224, 224, 240, 240, 240, 240, 248, 248, 248, 248, 252, 252, 252,
-254, 254, 255, 255, 255, 255, 255, 255, 127, 127, 0, 0, 0, 0, 0, 0, 0, 0,
-0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
-3, 3, 3, 7, 7, 7, 15, 15, 31, 31, 31, 63, 63, 63, 63, 63, 127, 127, 127,
-127, 127, 255, 255, 255, 255, 254, 254, 254, 254, 254, 254, 254, 254, 254,
-254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254,
-255, 255, 255, 255, 255, 255, 255, 127, 127, 127, 127, 127, 127, 127, 127,
-63, 63, 63, 63, 63, 31, 31, 31, 31, 31, 15, 15, 15, 15, 7, 7, 7, 7, 3, 3,
-3, 3, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-0, 0, 0, 0, 0, 0, 0]
-
-intelLogo = upmLCD.uint8Array(len(logoArr))
-
-for x in range(len(logoArr)):
- intelLogo.__setitem__(x, logoArr[x])
-myLCD.clear()
-myLCD.draw(intelLogo, 1024)
-
-del intelLogo
-del myLCD
-print "Exiting"
diff --git a/peripheral/libupm/examples/python/oled_ssd1327.py b/peripheral/libupm/examples/python/oled_ssd1327.py
deleted file mode 100644
index be19a95..0000000
--- a/peripheral/libupm/examples/python/oled_ssd1327.py
+++ /dev/null
@@ -1,189 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-# Load i2clcd display module
-import time, signal, sys
-import pyupm_i2clcd as upmLCD
-
-myLCD = upmLCD.SSD1327(0, 0x3C);
-
-logoArr = [0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x08, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x60, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x06, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x01, 0xC0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x01, 0xC0, 0x07, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x03, 0x80, 0x03, 0x80, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x03, 0x80, 0x03, 0x80,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x07, 0x80, 0x03, 0xC0, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x07, 0x80, 0x01, 0xC0,
-0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
-0x07, 0x80, 0x01, 0xE0, 0x08, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x20, 0x0F, 0x80, 0x01, 0xE0,
-0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30,
-0x0F, 0x00, 0x01, 0xE0, 0x08, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x30, 0x0F, 0x00, 0x01, 0xE0,
-0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30,
-0x0F, 0x00, 0x01, 0xE0, 0x18, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x30, 0x0F, 0x00, 0x01, 0xE0,
-0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38,
-0x0F, 0x00, 0x01, 0xE0, 0x18, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x38, 0x0F, 0x00, 0x01, 0xE0,
-0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38,
-0x0F, 0x80, 0x01, 0xE0, 0x38, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x3C, 0x0F, 0x80, 0x01, 0xE0,
-0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E,
-0x0F, 0x80, 0x03, 0xE0, 0x78, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x1E, 0x07, 0x80, 0x03, 0xE0,
-0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E,
-0x07, 0x80, 0x03, 0xE0, 0xF0, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x1F, 0x07, 0x80, 0x03, 0xC1,
-0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F,
-0x87, 0xC0, 0x07, 0xC1, 0xF0, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x0F, 0x83, 0xC0, 0x07, 0x83,
-0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F,
-0xC3, 0xC0, 0x07, 0x87, 0xE0, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x07, 0xE1, 0xE0, 0x07, 0x0F,
-0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
-0xF0, 0xE0, 0x0F, 0x0F, 0x80, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x01, 0xF8, 0xF0, 0x0E, 0x1F,
-0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
-0xF8, 0x70, 0x1C, 0x3F, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0xFC, 0x30, 0x18, 0x7E,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x7F, 0x18, 0x30, 0xFC, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x1F, 0x88, 0x21, 0xF0,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x0F, 0xC4, 0x47, 0xE0, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x03, 0xE0, 0x0F, 0x80,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0xF8, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0xE0, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
-0x00, 0x00, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x02, 0x00, 0x06, 0x00, 0x00, 0x6C, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x06,
-0x00, 0x00, 0x60, 0x00, 0x7E, 0x3F, 0x0F, 0xC3,
-0xF0, 0xFA, 0x0F, 0xDF, 0xE1, 0x9F, 0xEC, 0x7E,
-0xE6, 0x73, 0x9C, 0xE7, 0x39, 0xCE, 0x1C, 0xDF,
-0xE1, 0xB9, 0xEC, 0xE7, 0xE0, 0x61, 0xD8, 0x66,
-0x1B, 0x86, 0x1C, 0x06, 0x61, 0xB0, 0x6D, 0xC3,
-0x7C, 0x7F, 0xFF, 0xFF, 0xFF, 0x06, 0x0F, 0x86,
-0x61, 0xB0, 0x6D, 0x83, 0x3E, 0x7F, 0xFF, 0xFF,
-0xFF, 0x06, 0x07, 0xC6, 0x61, 0xB0, 0x6D, 0x83,
-0xC3, 0x61, 0x18, 0x46, 0x03, 0x86, 0x18, 0x66,
-0x61, 0xB0, 0x6D, 0xC3, 0xFE, 0x7F, 0x9F, 0xE7,
-0xF9, 0xFE, 0x1F, 0xE6, 0x3F, 0x9F, 0xEC, 0xFE,
-0x7E, 0x3F, 0x0F, 0xC3, 0xF0, 0xFA, 0x0F, 0xC6,
-0x3F, 0x9F, 0xEC, 0x7E, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00,
-0x00, 0x20, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x44, 0x00, 0x00, 0x20, 0x82, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6C, 0xF3,
-0xCF, 0x70, 0x9E, 0x79, 0xE7, 0x80, 0x00, 0x00,
-0x00, 0x00, 0x7D, 0x9E, 0x68, 0x20, 0xB2, 0xC8,
-0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x9E,
-0x6F, 0x20, 0xB2, 0xF9, 0xE7, 0x80, 0x00, 0x00,
-0x00, 0x00, 0x46, 0x9A, 0x61, 0x20, 0xB2, 0xCB,
-0x60, 0x80, 0x00, 0x00, 0x00, 0x00, 0x7C, 0xF3,
-0xCF, 0x30, 0x9E, 0x79, 0xE7, 0x90, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x7C, 0x02, 0x00, 0x00, 0x82, 0x60, 0x00, 0x00,
-0xF8, 0x00, 0x00, 0x40, 0x40, 0x02, 0x00, 0x00,
-0x83, 0x60, 0x00, 0x00, 0x8C, 0x00, 0x00, 0x40,
-0x60, 0xB7, 0x79, 0xE7, 0x81, 0xC7, 0x92, 0x70,
-0x89, 0xE7, 0x9E, 0x78, 0x7C, 0xE2, 0xC9, 0x2C,
-0x81, 0xCC, 0xD2, 0x40, 0xFB, 0x21, 0xB2, 0x48,
-0x40, 0x62, 0xF9, 0x2C, 0x80, 0x8C, 0xD2, 0x40,
-0x8B, 0xE7, 0xB0, 0x48, 0x40, 0xE2, 0xC9, 0x2C,
-0x80, 0x84, 0xD2, 0x40, 0x8B, 0x2D, 0x92, 0x48,
-0x7D, 0xB3, 0x79, 0x27, 0x80, 0x87, 0x9E, 0x40,
-0x8D, 0xE7, 0x9E, 0x48, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
-
-SeeedLogo = upmLCD.uint8Array(len(logoArr))
-
-for x in range(len(logoArr)):
- SeeedLogo.__setitem__(x, logoArr[x])
-
-# If you don't set the display to be white, the seeed logo will appear jagged
-myLCD.setGrayLevel(12)
-myLCD.draw(SeeedLogo, 96 * 96 / 8);
-
-for i in range(12):
- myLCD.setCursor(i, 0)
- myLCD.setGrayLevel(i)
- myLCD.write('Hello World')
-
-print "Exiting"
diff --git a/peripheral/libupm/examples/python/otp538u.py b/peripheral/libupm/examples/python/otp538u.py
deleted file mode 100644
index a7713b1..0000000
--- a/peripheral/libupm/examples/python/otp538u.py
+++ /dev/null
@@ -1,58 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_otp538u as upmOtp538u
-
-# analog voltage, usually 3.3 or 5.0
-OTP538U_AREF = 5.0
-
-# Instantiate a OTP538U on analog pins A0 and A1
-# A0 is used for the Ambient Temperature and A1 is used for the
-# Object temperature.
-myTempIR = upmOtp538u.OTP538U(0, 1, OTP538U_AREF)
-
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This lets you run code on exit, including functions from myTempIR
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-while(1):
- outputStr = ("Ambient temp: {0}"
- " C, Object temp: {1}"
- " C".format(myTempIR.ambientTemperature(),
- myTempIR.objectTemperature()))
- print outputStr
-
- time.sleep(1)
diff --git a/peripheral/libupm/examples/python/ozw.py b/peripheral/libupm/examples/python/ozw.py
deleted file mode 100644
index 010c1fc..0000000
--- a/peripheral/libupm/examples/python/ozw.py
+++ /dev/null
@@ -1,126 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_ozw as sensorObj
-
-# Instantiate an OZW instance
-sensor = sensorObj.OZW()
-
-# This function lets you run code on exit
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-
-defaultDev = "/dev/ttyACM0"
-if (len(sys.argv) > 1):
- defaultDev = sys.argv[1]
-
-# The first thing to do is create options, then lock them when done.
-sensor.optionsCreate()
-sensor.optionsLock()
-
-# Next, initialize it.
-print "Initializing, this may take awhile depending on your ZWave network"
-
-if (not sensor.init(defaultDev)):
- print "Init failed."
- sys.exit(1)
-
-print "Initialization complete"
-
-print "Dumping nodes..."
-
-sensor.dumpNodes()
-
-# The following is example output of dumpNodes:
-#
-# Dumping nodes...
-# Node 1: Z-Stick Gen5
-# Node 2: Smart Switch 6
-# Index: 0, Type: bool, Label: Switch, Value: False
-# Index: 2, Type: float, Label: Energy, Value: 1.190 kWh
-# Index: 3, Type: float, Label: Previous Reading, Value: 1.190 kWh
-# Index: 4, Type: int32, Label: Interval, Value: 1521 seconds
-# Index: 5, Type: float, Label: Power, Value: 0.000 W
-# Index: 6, Type: float, Label: Voltage, Value: 121.256 V
-# Index: 7, Type: float, Label: Current, Value: 0.000 A
-# Index: 8, Type: bool, Label: Exporting, Value: False
-# Index: 45, Type: list, Label: Day, Value: Friday
-# Index: 46, Type: byte, Label: Hour, Value: 5
-# Index: 47, Type: byte, Label: Minute, Value: 53
-# Node 3: Multi Sensor
-# Index: 0, Type: bool, Label: Sensor, Value: True
-# Index: 1, Type: float, Label: Temperature, Value: 72.8 F
-# Index: 2, Type: float, Label: Luminance, Value: 4 lux
-# Index: 3, Type: float, Label: Relative Humidity, Value: 22 %
-# Index: 17, Type: byte, Label: Battery Level, Value: 98 %
-# Node 5: Minimote
-# Node 6: Smart Energy Switch
-# Index: 0, Type: bool, Label: Switch, Value: False
-# Index: 2, Type: float, Label: Power, Value: 0.000 W
-# Index: 3, Type: float, Label: Energy, Value: 1.609 kWh
-# Index: 4, Type: float, Label: Previous Reading, Value: 1.609 kWh
-# Index: 5, Type: int32, Label: Interval, Value: 1521 seconds
-# Index: 6, Type: float, Label: Power, Value: 0.000 W
-# Index: 7, Type: float, Label: Previous Reading, Value: 1.609 W
-# Index: 8, Type: int32, Label: Interval, Value: 1521 seconds
-# Index: 9, Type: bool, Label: Exporting, Value: False
-# Node 7: Smart Energy Switch
-# Index: 0, Type: bool, Label: Switch, Value: False
-# Index: 2, Type: float, Label: Power, Value: 0.000 W
-# Index: 3, Type: float, Label: Energy, Value: 0.000 kWh
-# Index: 4, Type: float, Label: Previous Reading, Value: 0.000 kWh
-# Index: 5, Type: int32, Label: Interval, Value: 1521 seconds
-# Index: 6, Type: float, Label: Power, Value: 0.000 W
-# Index: 7, Type: float, Label: Previous Reading, Value: 0.000 W
-# Index: 8, Type: int32, Label: Interval, Value: 1521 seconds
-# Index: 9, Type: bool, Label: Exporting, Value: False
-#
-# So, with the above in mind:
-#
-# 1. Query the temperature on node 3 and print it out (as a
-# string), along with the units of measure:
-#
-# print "Temperature:", sensor.getValueAsString(3, 1),
-# sensor->getValueUnits(3, 1)
-#
-# 2. query the same temperature as a float:
-#
-# temperature = sensor.getValueAsFloat(3, 1)
-#
-# 3. Turn on the light plugged into the switch on Node 7, wait 5
-# seconds, then turn it back off again:
-#
-# print "Turning ON node 7"
-# sensor.setValueAsBool(7, 0, true)
-#
-# print "Sleeping for 5 seconds";
-# time.sleep(5)
-#
-# print "Turning OFF node 7"
-# sensor.setValueAsBool(7, 0, false);
-
diff --git a/peripheral/libupm/examples/python/pn532-writeurl.py b/peripheral/libupm/examples/python/pn532-writeurl.py
deleted file mode 100644
index b3abc41..0000000
--- a/peripheral/libupm/examples/python/pn532-writeurl.py
+++ /dev/null
@@ -1,105 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_pn532 as upmPn532
-
-# Instantiate an PN532 on I2C bus 0 (default) using gpio 3 for the
-# IRQ, and gpio 2 for the reset pin.
-myNFC = upmPn532.PN532(3, 2)
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This lets you run code on exit
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-if (not myNFC.init()):
- print "init() failed"
- sys.exit(0)
-
-vers = myNFC.getFirmwareVersion()
-
-if (vers):
- print "Got firmware version: %08x" % vers
-else:
- print "Could not identify PN532"
- sys.exit(0)
-
-# Now scan and identify any cards that come in range (1 for now)
-
-# Retry forever
-myNFC.setPassiveActivationRetries(0xff)
-
-myNFC.SAMConfig()
-
-uidSize = upmPn532.uint8Array(0)
-uid = upmPn532.uint8Array(7)
-
-# the URL we want to add as an NDEF record
-# NOTE: this cannot exceed 34 characters.
-url = "iotdk.intel.com"
-
-foundCard = False
-
-while (not foundCard):
- for i in range(7):
- uid.__setitem__(i, 0)
- if (myNFC.readPassiveTargetID(upmPn532.PN532.BAUD_MIFARE_ISO14443A,
- uid, uidSize, 2000)):
- # found a card
- print "Found a card: UID len", uidSize.__getitem__(0)
- print "UID: ",
- for i in range(uidSize.__getitem__(0)):
- print "%02x" % uid.__getitem__(i),
- print
- print "SAK: %02x" % myNFC.getSAK()
- print "ATQA: %04x" % myNFC.getATQA()
- print
- foundCard = True
- else:
- print "Waiting for a card...\n"
-
-if (uidSize.__getitem__(0) != 7):
- print "This example will only write an NDEF URI to preformatted"
- print "Mifare Ultralight or NTAG2XX tags"
- sys.exit(1)
-
-# 48 bytes is maximum data area on ultralight cards, so we use that
-# as the maximum datasize here. Obviously if you have a bigger
-# card, you can write more data.
-if (not myNFC.ntag2xx_WriteNDEFURI(upmPn532.PN532.NDEF_URIPREFIX_HTTP, url, 48)):
- # failure
- print "Failed to write NDEF record tag."
- sys.exit(1)
-
-print "Success, URL record written to tag."
diff --git a/peripheral/libupm/examples/python/pn532.py b/peripheral/libupm/examples/python/pn532.py
deleted file mode 100644
index bb000d4..0000000
--- a/peripheral/libupm/examples/python/pn532.py
+++ /dev/null
@@ -1,85 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_pn532 as upmPn532
-
-# Instantiate an PN532 on I2C bus 0 (default) using gpio 3 for the
-# IRQ, and gpio 2 for the reset pin.
-myNFC = upmPn532.PN532(3, 2)
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This lets you run code on exit
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-if (not myNFC.init()):
- print "init() failed"
- sys.exit(0)
-
-vers = myNFC.getFirmwareVersion()
-
-if (vers):
- print "Got firmware version: %08x" % vers
-else:
- print "Could not identify PN532"
- sys.exit(0)
-
-# Now scan and identify any cards that come in range (1 for now)
-
-# Retry forever
-myNFC.setPassiveActivationRetries(0xff)
-
-myNFC.SAMConfig()
-
-uidSize = upmPn532.uint8Array(0)
-uid = upmPn532.uint8Array(7)
-
-
-while (1):
- for i in range(7):
- uid.__setitem__(i, 0)
- if (myNFC.readPassiveTargetID(upmPn532.PN532.BAUD_MIFARE_ISO14443A,
- uid, uidSize, 2000)):
- # found a card
- print "Found a card: UID len", uidSize.__getitem__(0)
- print "UID: ",
- for i in range(uidSize.__getitem__(0)):
- print "%02x" % uid.__getitem__(i),
- print
- print "SAK: %02x" % myNFC.getSAK()
- print "ATQA: %04x" % myNFC.getATQA()
- print
- time.sleep(1)
- else:
- print "Waiting for a card...\n"
diff --git a/peripheral/libupm/examples/python/ppd42ns.py b/peripheral/libupm/examples/python/ppd42ns.py
deleted file mode 100644
index 86e037d..0000000
--- a/peripheral/libupm/examples/python/ppd42ns.py
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_ppd42ns as upmPpd42ns
-
-# Instantiate a dust sensor on digital pin D8
-myDustSensor = upmPpd42ns.PPD42NS(8)
-
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit, including functions from myDustSensor
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-notice = ("This program will give readings "
-"every 30 seconds until you stop it")
-print notice
-
-while(1):
- data = myDustSensor.getData()
- # we need to sleep for a bit for the data to print out
- time.sleep(.1)
- print "Low pulse occupancy: " + str(data.lowPulseOccupancy)
- print "Ratio: " + str(data.ratio)
- print "Concentration: " + str(data.concentration)
diff --git a/peripheral/libupm/examples/python/rfr359f.py b/peripheral/libupm/examples/python/rfr359f.py
deleted file mode 100644
index 349821d..0000000
--- a/peripheral/libupm/examples/python/rfr359f.py
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_rfr359f as upmRfr359f
-
-# Instantiate an RFR359F digital pin D2
-# This was tested on the Grove IR Distance Interrupter
-myDistInterrupter = upmRfr359f.RFR359F(2)
-
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit, including functions from myDistInterrupter
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-while(1):
- if (myDistInterrupter.objectDetected()):
- print "Object detected"
- else:
- print "Area is clear"
- time.sleep(.1)
diff --git a/peripheral/libupm/examples/python/rgbringcoder.py b/peripheral/libupm/examples/python/rgbringcoder.py
deleted file mode 100644
index 5c0b1fb..0000000
--- a/peripheral/libupm/examples/python/rgbringcoder.py
+++ /dev/null
@@ -1,90 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_rgbringcoder as upmRGBRingCoder
-
-# There are a lot of pins to hook up. These pins are valid for the
-# Edison board, but may need to be adjusted for other platforms.
-
-# In order:
-# enable - 4
-# latch - 10
-# clear - 11
-# clock - 2
-# data - 9
-# switch - 7
-
-# red pwm - 3
-# green pwm - 5
-# blue pwm - 6
-
-# encA - 12
-# encB - 13
-ringCoder = upmRGBRingCoder.RGBRingCoder(4, 10, 11, 2, 9, 7, 12, 13, 3,
- 5, 6)
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit,
-# including functions from ringCoder
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-spin = 0x0001;
-oldState = False;
-oldPos = 0;
-
-# Lets go green
-ringCoder.setRGBLED(0.99, 0.01, 0.99);
-
-while(1):
- # you spin me round...
- if ((spin & 0xffff) == 0):
- spin = 0x0001
-
- ringCoder.setRingLEDS(spin)
- spin <<= 1
-
- # check button state
- bstate = ringCoder.getButtonState()
- if (bstate != oldState):
- print "Button state changed from", oldState, " to ", bstate
- oldState = bstate
-
- # check encoder position
- epos = ringCoder.getEncoderPosition()
- if (epos != oldPos):
- print "Encoder position changed from", oldPos, "to", epos
- oldPos = epos
-
- time.sleep(0.1)
diff --git a/peripheral/libupm/examples/python/rhusb.py b/peripheral/libupm/examples/python/rhusb.py
deleted file mode 100644
index 70198e0..0000000
--- a/peripheral/libupm/examples/python/rhusb.py
+++ /dev/null
@@ -1,69 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2016 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_rhusb as sensorObj
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit
-def exitHandler():
- print "Exiting..."
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-defaultDev = "/dev/ttyUSB0"
-
-# if an argument was specified, use it as the device instead
-if (len(sys.argv) > 1):
- defaultDev = sys.argv[1]
-
-print "Using device", defaultDev
-print "Initializing..."
-
-# Instantiate an RHUSB instance on defaultDev
-sensor = sensorObj.RHUSB(defaultDev)
-
-# output the firmware ID
-print "Firmware ID:", sensor.getFirmwareID()
-print
-
-# update and print available values every second
-while (1):
- # update our values from the sensor
- sensor.update()
-
- # we show both C and F for temperature
- print "Temperature:", sensor.getTemperature(), "C /",
- print sensor.getTemperature(True), "F"
-
- print "Humidity:", sensor.getHumidity(), "%"
-
- print
- time.sleep(1)
diff --git a/peripheral/libupm/examples/python/rotaryencoder.py b/peripheral/libupm/examples/python/rotaryencoder.py
deleted file mode 100644
index 89738fd..0000000
--- a/peripheral/libupm/examples/python/rotaryencoder.py
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_rotaryencoder as upmRotaryEncoder
-
-# Instantiate a Grove Rotary Encoder, using signal pins D2 and D3
-myRotaryEncoder = upmRotaryEncoder.RotaryEncoder(2, 3);
-
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit, including functions from myRotaryEncoder
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-# Read the value every second and detect motion
-while(1):
- print "Position: {0}".format(myRotaryEncoder.position())
- time.sleep(.1)
diff --git a/peripheral/libupm/examples/python/rpr220.py b/peripheral/libupm/examples/python/rpr220.py
deleted file mode 100644
index edf14ca..0000000
--- a/peripheral/libupm/examples/python/rpr220.py
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_rpr220 as upmRpr220
-
-# This example uses a simple method to determine current status
-
-# Instantiate an RPR220 digital pin D2
-# This was tested on the Grove IR Reflective Sensor
-myReflectiveSensor = upmRpr220.RPR220(2)
-
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This lets you run code on exit,
-# including functions from myReflectiveSensor
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-while(1):
- if (myReflectiveSensor.blackDetected()):
- print "Black detected"
- else:
- print "Black NOT detected"
-
- time.sleep(.1)
diff --git a/peripheral/libupm/examples/python/sainsmartks.py b/peripheral/libupm/examples/python/sainsmartks.py
deleted file mode 100644
index 7763de9..0000000
--- a/peripheral/libupm/examples/python/sainsmartks.py
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_i2clcd as sainsmartObj
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit,
-# including functions from ringCoder
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-# Instantiate a Sainsmart LCD Keypad Shield using default pins
-lcd = sainsmartObj.SAINSMARTKS()
-
-lcd.setCursor(0,0)
-lcd.write("Sainsmart KS")
-lcd.setCursor(1,2)
-lcd.write("Hello World")
-
-# output current key value every second.
-while(1):
- print "Button value: ", lcd.getRawKeyValue()
- time.sleep(1)
-
diff --git a/peripheral/libupm/examples/python/si114x.py b/peripheral/libupm/examples/python/si114x.py
deleted file mode 100644
index 4264620..0000000
--- a/peripheral/libupm/examples/python/si114x.py
+++ /dev/null
@@ -1,66 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_si114x as upmSi114x
-
-# Instantiate a SI114x UV Sensor on I2C bus 0
-myUVSensor = upmSi114x.SI114X(0)
-
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit,
-# including functions from myUVSensor
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-# First initialize it
-myUVSensor.initialize()
-
-print "UV Index Scale:"
-print "---------------"
-print "11+ Extreme"
-print "8-10 Very High"
-print "6-7 High"
-print "3-5 Moderate"
-print "0-2 Low\n"
-
-# update every second and print the currently measured UV Index
-while (1):
- # update current value(s)
- myUVSensor.update()
-
- # print detected value
- print "UV Index:", myUVSensor.getUVIndex()
-
- time.sleep(1)
diff --git a/peripheral/libupm/examples/python/sm130.py b/peripheral/libupm/examples/python/sm130.py
deleted file mode 100644
index ce6ae1b..0000000
--- a/peripheral/libupm/examples/python/sm130.py
+++ /dev/null
@@ -1,63 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_sm130 as sensorObj
-
-# Instantiate a UART based SM130 RFID Module using defaults
-sensor = sensorObj.SM130()
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-# Set the baud rate, 19200 baud is the default.
-if (sensor.setBaudRate(19200)):
- print "Failed to set baud rate"
- sys.exit(0)
-
-print "Resetting..."
-sensor.reset()
-
-print "Firmware revision: " + sensor.getFirmwareVersion()
-
-print "Waiting up to 5 seconds for a tag..."
-
-if (sensor.waitForTag(5000)):
- print "Found tag, UID:",
- print sensor.string2HexString(sensor.getUID())
- print "Tag Type:",
- print sensor.tag2String(sensor.getTagType())
-else:
- # error
- print "waitForTag failed: " + sensor.getLastErrorString()
diff --git a/peripheral/libupm/examples/python/stepmotor.py b/peripheral/libupm/examples/python/stepmotor.py
deleted file mode 100644
index 125ac71..0000000
--- a/peripheral/libupm/examples/python/stepmotor.py
+++ /dev/null
@@ -1,64 +0,0 @@
-#!/usr/bin/python
-# Author: Mihai Tudor Panu <mihai.tudor.panu@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 time, sys, signal, atexit
-import pyupm_stepmotor as mylib
-
-# Instantiate a StepMotor object on pins 2 (dir) and 3 (step)
-stepper = mylib.StepMotor(2, 3)
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This lets you run code on exit
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-print "Rotating 1 revolution forward and back at 60 rpm."
-stepper.setSpeed(60)
-stepper.stepForward(200)
-time.sleep(1)
-stepper.stepBackward(200)
-time.sleep(1)
-
-print "Rotating 1 revolution forward and back at 150 rpm."
-stepper.setSpeed(150)
-stepper.stepForward(200)
-time.sleep(1)
-stepper.stepBackward(200)
-time.sleep(1)
-
-print "Rotating 1 revolution forward and back at 300 rpm."
-stepper.setSpeed(300)
-stepper.stepForward(200)
-time.sleep(1)
-stepper.stepBackward(200)
-time.sleep(1)
diff --git a/peripheral/libupm/examples/python/sx1276-fsk.py b/peripheral/libupm/examples/python/sx1276-fsk.py
deleted file mode 100644
index 6899699..0000000
--- a/peripheral/libupm/examples/python/sx1276-fsk.py
+++ /dev/null
@@ -1,89 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_sx1276 as sensorObj
-
-# Instantiate an SX1276 using default parameters
-sensor = sensorObj.SX1276()
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-print "Specify an argument to go into receive mode. Default is transmit"
-
-# 915Mhz
-sensor.setChannel(915000000)
-
-# FSK configuration (rx and tx must be configured the same):
-# Tx output power = 14 dBm
-# FSK freq deviation = 25000 Hz
-# FSK bandwidth = 50000 bps
-# FSK AFC bandwidth = 83333 Hz
-# FSK datarate = 50000 bps
-# FSK preamble len = 5
-# FSK fixed length payload = false
-# FSK CRC check = true
-# FSK (rx) continuous Rx mode = False
-
-sensor.setTxConfig(sensor.MODEM_FSK, 14, 25000, 0,
- 50000, 0, 5, False, True, False, 0, False)
-
-sensor.setRxConfig(sensor.MODEM_FSK, 50000, 50000,
- 0, 83333, 5, 0, False, 0, True,
- False, 0, False, True)
-
-count = 0
-
-while True:
- if (len(sys.argv) > 1):
- # receive mode
- print "Attempting to receive..."
- rv = sensor.setRx(3000)
- if (rv):
- print "setRx returned ", rv
- else:
- print "Received Buffer: ", sensor.getRxBufferStr();
- # go back to sleep when done
-
- sensor.setSleep()
- time.sleep(.25)
- else:
- # transmit mode
- buffer = "Ping " + str(count)
- count += 1
- print "Sending..." + buffer
- sensor.sendStr(buffer, 3000)
- sensor.setSleep();
- time.sleep(1);
diff --git a/peripheral/libupm/examples/python/sx1276-lora.py b/peripheral/libupm/examples/python/sx1276-lora.py
deleted file mode 100644
index 05d9700..0000000
--- a/peripheral/libupm/examples/python/sx1276-lora.py
+++ /dev/null
@@ -1,88 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_sx1276 as sensorObj
-
-# Instantiate an SX1276 using default parameters
-sensor = sensorObj.SX1276()
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-print "Specify an argument to go into receive mode. Default is transmit"
-
-# 915Mhz
-sensor.setChannel(915000000)
-
-# LORA configuration (rx and tx must be configured the same):
-# Tx output power = 14 dBm
-# LORA bandwidth = 125000 (can also be 250K and 500K)
-# LORA spreading factor = 7
-# LORA coding rate = 1 (4/5)
-# LORA preamble len = 8
-# LORA symbol timeout = 5
-# LORA fixed payload = false
-# LORA IQ inversion = false
-# LORA (rx) continuous Rx mode = true
-
-sensor.setTxConfig(sensor.MODEM_LORA, 14, 0, 125000,
- 7, 1, 8, False, True, False, 0, False)
-
-sensor.setRxConfig(sensor.MODEM_LORA, 125000, 7,
- 1, 0, 8, 5, False, 0, True, False, 0, False, True)
-
-count = 0
-
-while True:
- if (len(sys.argv) > 1):
- # receive mode
- print "Attempting to receive..."
- rv = sensor.setRx(3000)
- if (rv):
- print "setRx returned ", rv
- else:
- print "Received Buffer: ", sensor.getRxBufferStr();
- # go back to sleep when done
-
- sensor.setSleep()
- time.sleep(.25)
- else:
- # transmit mode
- buffer = "Ping " + str(count)
- count += 1
- print "Sending..." + buffer
- sensor.sendStr(buffer, 3000)
- sensor.setSleep();
- time.sleep(1);
diff --git a/peripheral/libupm/examples/python/sx6119.py b/peripheral/libupm/examples/python/sx6119.py
deleted file mode 100644
index a849836..0000000
--- a/peripheral/libupm/examples/python/sx6119.py
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import sys
-import pyupm_sx6119 as upmSx6119
-
-# Instantiate a SX6119 on digital pins 2 (power) and 3 (seek)
-# This example was tested on the Grove FM Receiver.
-myFM_receiver_obj = upmSx6119.SX6119(2, 3)
-
-# if an argument was specified (any argument), seek to the next
-# station, else just toggle the power.
-
-print "Supply any argument to the command line to seek to the"
-print "next station."
-print "Running the example without an argument will toggle the"
-print "power on or off.\n"
-
-doSeek = False
-
-if (len(sys.argv) > 1):
- doSeek = True
-
-# depending on what was selected, do it
-if (doSeek):
- myFM_receiver_obj.seek()
-else:
- myFM_receiver_obj.togglePower()
-
-print "Exiting";
diff --git a/peripheral/libupm/examples/python/t3311.py b/peripheral/libupm/examples/python/t3311.py
deleted file mode 100644
index 0c568df..0000000
--- a/peripheral/libupm/examples/python/t3311.py
+++ /dev/null
@@ -1,90 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2016 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_t3311 as sensorObj
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-defaultDev = "/dev/ttyUSB0"
-
-# if an argument was specified, use it as the device instead
-if (len(sys.argv) > 1):
- defaultDev = sys.argv[1]
-
-print "Initializing..."
-
-# Instantiate an T3311 instance, using MODBUS slave address 1, and
-# default comm parameters (9600, 8, N, 2)
-sensor = sensorObj.T3311(defaultDev, 1)
-
-# output the serial number and firmware revision
-print "Serial Number:", sensor.getSerialNumber()
-print "Firmware Revision: {0}.{1}".format(sensor.getFirmwareMajor(),
- sensor.getFirmwareMinor())
-print
-
-# update and print available values every second
-while (1):
- # update our values from the sensor
- sensor.update()
-
- # we show both C and F for temperature
- print "Temperature:", sensor.getTemperature(), "C /",
- print sensor.getTemperature(True), "F"
-
- print "Humidity:", sensor.getHumidity(), "%"
-
- # this value depends on the sensor configuration -- by default
- # it is the dew point temperature
- print "Computed Value:", sensor.getComputedValue()
-
- # with FW revisions > 2.44, extended computed data is available
- if (sensor.extendedDataAvailable()):
- print "Dew Point Temperature:", sensor.getDewPointTemperature(),
- print "C /", sensor.getDewPointTemperature(True), "F"
-
- print "Absolute Humidity:", sensor.getAbsoluteHumidity(), "g/m3"
-
- print "Specific Humidity:", sensor.getSpecificHumidity(),
- print "g/kg"
-
- print "Mixing Ratio:", sensor.getMixingRatio(), "g/kg"
-
- print "Specific Enthalpy:", sensor.getSpecificEnthalpy(),
- print "kJ/kg"
-
- print
- time.sleep(1)
diff --git a/peripheral/libupm/examples/python/ta12200.py b/peripheral/libupm/examples/python/ta12200.py
deleted file mode 100644
index 7fce6ab..0000000
--- a/peripheral/libupm/examples/python/ta12200.py
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_ta12200 as upmTa12200
-
-# Instantiate a TA12-200 sensor on analog pin A0
-myElectricitySensor = upmTa12200.TA12200(0)
-
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This lets you run code on exit,
-# including functions from myElectricitySensor
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-# get the data every 50 milliseconds
-while(1):
- maxVal = myElectricitySensor.highestValue()
- current = myElectricitySensor.milliAmps(maxVal)
-
- outputStr = "Max ADC Value: %s, current: %smA" % (maxVal, current)
- print outputStr
- time.sleep(.1)
diff --git a/peripheral/libupm/examples/python/tcs3414cs.py b/peripheral/libupm/examples/python/tcs3414cs.py
deleted file mode 100644
index 7b7fae0..0000000
--- a/peripheral/libupm/examples/python/tcs3414cs.py
+++ /dev/null
@@ -1,55 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_tcs3414cs as upmTcs3414cs
-
-# Instantiate the color sensor on I2C
-myColorSensor = upmTcs3414cs.TCS3414CS()
-
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This lets you run code on exit,
-# including functions from myColorSensor
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-myrgb = upmTcs3414cs.tcs3414sc_rgb_t()
-
-# Print out the r, g, b, and clr value every 0.5 seconds
-while(1):
- myColorSensor.readRGB(myrgb)
- print "{0}, {1}, {2}, {3}".format(myrgb.r,
- myrgb.g, myrgb.b, myrgb.clr)
-
- time.sleep(.5)
diff --git a/peripheral/libupm/examples/python/tm1637.py b/peripheral/libupm/examples/python/tm1637.py
deleted file mode 100644
index 8c75744..0000000
--- a/peripheral/libupm/examples/python/tm1637.py
+++ /dev/null
@@ -1,54 +0,0 @@
-# Author: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
-# Copyright (c) 2014 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, signal
-import pyupm_tm1637 as tm1637
-
-# Register exit handler for normal Ctrl+C exit
-def SIGINTHandler(signum, frame):
- raise SystemExit
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-# Create a display object on pins 0 CLK and 1 DIO
-display = tm1637.TM1637(0, 1)
-dots = True
-
-# Get local time
-myTime = time.localtime(time.time())
-print time.strftime("System time: %H:%M", myTime)
-print ("You can adjust your time zone by setting the TZ environment variable.")
-
-# Draw a box for 3 seconds using 7-segment encoding
-display.write(0x39, 0x09, 0x09, 0x0f)
-time.sleep(3)
-
-# Loop indefinitely
-while True:
- # Update and display time
- timeString = time.strftime("%H%M", time.localtime(time.time()))
- display.write(timeString)
- # Toggle colon
- display.setColon(dots)
- dots = not dots
-
- # Sleep for 1 s
- time.sleep(1)
diff --git a/peripheral/libupm/examples/python/tp401.py b/peripheral/libupm/examples/python/tp401.py
deleted file mode 100644
index 5519508..0000000
--- a/peripheral/libupm/examples/python/tp401.py
+++ /dev/null
@@ -1,54 +0,0 @@
-# Author: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
-# Copyright (c) 2014 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-from time import sleep
-import pyupm_gas as TP401
-
-# Give a qualitative meaning to the value from the sensor
-def airQuality(value):
- if(value < 50): return "Fresh Air"
- if(value < 200): return "Normal Indoor Air"
- if(value < 400): return "Low Pollution"
- if(value < 600): return "High Pollution - Action Recommended"
- return "Very High Pollution - Take Action Immediately"
-
-# New Grove Air Quality Sensor on AIO pin 0
-airSensor = TP401.TP401(0)
-
-# Wait for sensor to warm up
-print "Sensor is warming up for 3 minutes..."
-for i in range (1, 4):
- sleep(60)
- print i, "minute(s) passed."
-print "Sensor is ready!"
-
-# Loop indefinitely
-while True:
-
- # Read values (consecutive reads might vary slightly)
- value = airSensor.getSample()
- ppm = airSensor.getPPM()
-
- print "raw: %4d" % value , " ppm: %5.2f " % ppm , airQuality(value)
-
- # Sleep for 2.5 s
- sleep(2.5)
diff --git a/peripheral/libupm/examples/python/tsl2561.py b/peripheral/libupm/examples/python/tsl2561.py
deleted file mode 100644
index 35a3336..0000000
--- a/peripheral/libupm/examples/python/tsl2561.py
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_tsl2561 as upmTsl2561
-
-# Instantiate a digital light sensor TSL2561 on I2C
-myDigitalLightSensor = upmTsl2561.TSL2561()
-
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit, including functions from myDigitalLightSensor
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-while(1):
- print "Light value is " + str(myDigitalLightSensor.getLux())
- time.sleep(1)
diff --git a/peripheral/libupm/examples/python/ttp223.py b/peripheral/libupm/examples/python/ttp223.py
deleted file mode 100644
index 7d1c847..0000000
--- a/peripheral/libupm/examples/python/ttp223.py
+++ /dev/null
@@ -1,39 +0,0 @@
-# Author: Sarah Knepper <sarah.knepper@intel.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time
-import pyupm_ttp223 as ttp223
-
-# Create the TTP223 touch sensor object using GPIO pin 0
-touch = ttp223.TTP223(0)
-
-# Check whether or not a finger is near the touch sensor and
-# print accordingly, waiting one second between readings
-while 1:
- if touch.isPressed():
- print touch.name(), 'is pressed'
- else:
- print touch.name(), 'is not pressed'
- time.sleep(1)
-
-# Delete the touch sensor object
-del touch
diff --git a/peripheral/libupm/examples/python/ublox6.py b/peripheral/libupm/examples/python/ublox6.py
deleted file mode 100644
index bb98d2b..0000000
--- a/peripheral/libupm/examples/python/ublox6.py
+++ /dev/null
@@ -1,82 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_ublox6 as upmUblox6
-
-# Instantiate a Ublox6 GPS device on uart 0.
-myGPSSensor = upmUblox6.Ublox6(0)
-
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit, including functions from myGPSSensor
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-if (not myGPSSensor.setupTty(upmUblox6.cvar.int_B9600)):
- print "Failed to setup tty port parameters"
- sys.exit(0)
-
-# Collect and output NMEA data.
-
-# This device also supports numerous configuration options, which
-# you can set with writeData(). Please refer to the Ublox-6 data
-# sheet for further information on the formats of the data sent and
-# received, and the various operating modes available.
-
-
-bufferLength = 256
-nmeaBuffer = upmUblox6.charArray(bufferLength)
-
-def getGPSInfo():
- # we don't want the read to block in this example, so always
- # check to see if data is available first.
- if (myGPSSensor.dataAvailable()):
- rv = myGPSSensor.readData(nmeaBuffer, bufferLength)
-
- numlines= 0
- if (rv > 0):
- GPSData = ""
- # read only the number of characters
- # specified by myGPSSensor.readData
- for x in range(rv):
- GPSData += nmeaBuffer.__getitem__(x)
- sys.stdout.write(GPSData)
-
- if (rv < 0): # some sort of read error occured
- print "Port read error."
- sys.exit(0)
-
-while (1):
- getGPSInfo()
- time.sleep(.1)
diff --git a/peripheral/libupm/examples/python/uln200xa.py b/peripheral/libupm/examples/python/uln200xa.py
deleted file mode 100644
index e926e46..0000000
--- a/peripheral/libupm/examples/python/uln200xa.py
+++ /dev/null
@@ -1,66 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-
-import time, sys, signal, atexit
-import pyupm_uln200xa as upmULN200XA
-
-# Instantiate a Stepper motor on a ULN200XA Darlington Motor Driver
-# This was tested with the Grove Geared Step Motor with Driver
-
-# Instantiate a ULN2003XA stepper object
-myUln200xa = upmULN200XA.ULN200XA(4096, 8, 9, 10, 11)
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This lets you run code on exit,
-# including functions from myUln200xa
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-myUln200xa.setSpeed(5) # 5 RPMs
-myUln200xa.setDirection(upmULN200XA.ULN200XA.DIR_CW)
-
-print "Rotating 1 revolution clockwise."
-myUln200xa.stepperSteps(4096)
-
-print "Sleeping for 2 seconds..."
-time.sleep(2)
-
-print "Rotating 1/2 revolution counter clockwise."
-myUln200xa.setDirection(upmULN200XA.ULN200XA.DIR_CCW)
-myUln200xa.stepperSteps(2048)
-
-# release
-myUln200xa.release()
-
-# exitHandler is called automatically
diff --git a/peripheral/libupm/examples/python/urm37-uart.py b/peripheral/libupm/examples/python/urm37-uart.py
deleted file mode 100644
index 8e6ee80..0000000
--- a/peripheral/libupm/examples/python/urm37-uart.py
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_urm37 as sensorObj
-
-# Instantiate a URM37 sensor on UART 0, with the reset pin on D2
-sensor = sensorObj.URM37(0, 2)
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-# Every half a second, sample the URM37 and output the measured
-# distance in cm, and temperature in degrees C
-
-while (1):
- print "Detected distance (cm):", sensor.getDistance()
- print "Temperature (C):", sensor.getTemperature()
- time.sleep(.5)
diff --git a/peripheral/libupm/examples/python/urm37.py b/peripheral/libupm/examples/python/urm37.py
deleted file mode 100644
index fa977aa..0000000
--- a/peripheral/libupm/examples/python/urm37.py
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_urm37 as sensorObj
-
-# Instantiate a URM37 sensor on analog pin A0, reset pin on D2,
-# trigger pin on D3 with an analog reference voltage of 5.0
-sensor = sensorObj.URM37(0, 2, 3, 5.0)
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-# Every half a second, sample the URM37 and output the measured
-# distance in cm.
-
-while (1):
- print "Detected distance (cm):", sensor.getDistance()
- time.sleep(.5)
diff --git a/peripheral/libupm/examples/python/using_carrays.py b/peripheral/libupm/examples/python/using_carrays.py
deleted file mode 100644
index 730cb36..0000000
--- a/peripheral/libupm/examples/python/using_carrays.py
+++ /dev/null
@@ -1,31 +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 pyupm_mic
-
-mymic = pyupm_mic.Microphone(1)
-# careful this is an unitialised array with no bounds checking!
-x = pyupm_mic.uint16Array(3)
-mymic.getSampledWindow(100, 3, x)
-
diff --git a/peripheral/libupm/examples/python/waterlevel.py b/peripheral/libupm/examples/python/waterlevel.py
deleted file mode 100644
index 18309e4..0000000
--- a/peripheral/libupm/examples/python/waterlevel.py
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_waterlevel as upmWaterlevel
-
-# The was tested with the Water Level Sensor
-# Instantiate a Water Level Sensor on digital pin D2
-myWaterLevel = upmWaterlevel.WaterLevel(2)
-
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit,
-# including functions from myWaterLevel
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-while(1):
- if (myWaterLevel.isSubmerged()):
- print "Sensor is submerged in liquid"
- else:
- print "Liquid is below water level sensor"
-
- time.sleep(1)
diff --git a/peripheral/libupm/examples/python/wheelencoder.py b/peripheral/libupm/examples/python/wheelencoder.py
deleted file mode 100644
index b61cc87..0000000
--- a/peripheral/libupm/examples/python/wheelencoder.py
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_wheelencoder as sensorObj
-
-# Instantiate a DFRobot Wheel Encoder on digital pin D2
-sensor = sensorObj.WheelEncoder(2)
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-# set the counter to 0 and start counting
-sensor.clearCounter();
-sensor.startCounter();
-
-while (1):
- print "Millis:", sensor.getMillis(), "Count:", sensor.counter()
- time.sleep(1)
diff --git a/peripheral/libupm/examples/python/wt5001.py b/peripheral/libupm/examples/python/wt5001.py
deleted file mode 100644
index 315799c..0000000
--- a/peripheral/libupm/examples/python/wt5001.py
+++ /dev/null
@@ -1,107 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, signal, sys
-import pyupm_wt5001 as upmWt5001
-
-# Instantiate a WT5001 serial MP3 player on uart 0.
-# This example was tested on the Grove Serial MP3 module.
-myMP3Player = upmWt5001.WT5001(0)
-
-
-def printUsage(progname):
- print ("Usage: python " + progname + " <command>\n"
- "Commands:\n"
- "0 - stop playing\n"
- "1 - start playing track 1\n"
- "2 - pause/un-pause playback\n"
- "3 - next track\n"
- "4 - previous track")
-
-
-cmd = -1;
-if (len(sys.argv) > 1):
- cmd = int(sys.argv[1])
-
-if (not myMP3Player.setupTty(upmWt5001.cvar.int_B9600)):
- print "Failed to setup tty port parameters"
- sys.exit(0)
-
-if cmd == 0:
- myMP3Player.stop()
-elif cmd == 1:
- myMP3Player.play(upmWt5001.WT5001.SD, 1)
-elif cmd == 2:
- myMP3Player.pause()
-elif cmd == 3:
- myMP3Player.next()
-elif cmd == 4:
- myMP3Player.previous()
-else:
- # nothing, just output usage, and info below
- printUsage(sys.argv[0])
-
-
-# print out some information
-vol = upmWt5001.uint8Array(0)
-myMP3Player.getVolume(vol)
-print "The current volume is: " + str(vol.__getitem__(0))
-
-ps = upmWt5001.uint8Array(0)
-myMP3Player.getPlayState(ps)
-print "The current play state is: " + str(ps.__getitem__(0))
-
-numf = upmWt5001.uint16Array(0)
-myMP3Player.getNumFiles(upmWt5001.WT5001.SD, numf)
-print "The number of files on the SD card is: " + str(numf.__getitem__(0))
-
-curf = upmWt5001.uint16Array(0)
-myMP3Player.getCurrentFile(curf)
-print "The current file is: " + str(curf.__getitem__(0))
-
-
-# set the date
-myMP3Player.setDate(2015, 3, 14)
-
-# set the time
-myMP3Player.setTime(9, 26, 53)
-
-
-year = upmWt5001.uint16Array(0)
-month = upmWt5001.uint8Array(0)
-day = upmWt5001.uint8Array(0)
-
-myMP3Player.getDate(year, month, day)
-mp3date = str(month.__getitem__(0)) + "/"
-mp3date += (str(day.__getitem__(0)) + "/")
-mp3date += str(year.__getitem__(0))
-print "The device date is: " + mp3date
-
-hour = upmWt5001.uint8Array(0)
-minute = upmWt5001.uint8Array(0)
-second = upmWt5001.uint8Array(0)
-myMP3Player.getTime(hour, minute, second)
-mp3time = str(hour.__getitem__(0)) + ":"
-mp3time += (str(minute.__getitem__(0)) + ":")
-mp3time += str(second.__getitem__(0))
-print "The device time is: " + mp3time
diff --git a/peripheral/libupm/examples/python/xbee.py b/peripheral/libupm/examples/python/xbee.py
deleted file mode 100644
index 3ca3720..0000000
--- a/peripheral/libupm/examples/python/xbee.py
+++ /dev/null
@@ -1,117 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_xbee as sensorObj
-
-# Instantiate a XBee Module on UART 0
-sensor = sensorObj.XBee(0)
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-# Set the baud rate, 9600 baud is the default.
-if (sensor.setBaudRate(9600)):
- print "Failed to set baud rate"
- sys.exit(0)
-
-
-usageStr = ("Usage:\n"
-"If an argument is supplied on the command line, that argument is\n"
-"sent to the module and the response is printed out.\n\n"
-"If no argument is used, then the firmware revision, serial number\n"
-"and the current IP address (if set) are queried.\n\n")
-print usageStr
-
-# simple helper function to send a command and wait for a response
-def sendCommand(sensor, cmd):
- # commands need to be terminated with a carriage return
- cmd += "\r"
- sensor.writeDataStr(cmd)
-
- resp = ""
- while sensor.dataAvailable(2000):
- resp += sensor.readDataStr(1024)
-
- if not resp:
- print "Timed out waiting for response"
- else:
- resp = sensor.stringCR2LF(resp)
- print "Returned (", len(resp), "bytes):"
- print resp
-
-
-if (len(sys.argv) > 1):
- # enable command mode
- sensor.commandMode()
- print "Sending command line argument (" + sys.argv[1] + ")..."
- sendCommand(sensor, sys.argv[1])
-else:
- # enable command mode
- sensor.commandMode()
- # query the verbose firmware revision
- print "Querying verbose firmware revision (ATVL)..."
- sendCommand(sensor, "ATVL")
- # query the number
- print "Querying Serial Number High (ATSH)..."
- sendCommand(sensor, "ATSH")
- print "Querying Serial Number Low (ATSL)..."
- sendCommand(sensor, "ATSL")
-
- print "Querying address, if set (ATMY)..."
- sendCommand(sensor, "ATMY");
-
- # For the XBee WiFi S6B
- # A comprehensive list of commands and command modes is
- # available from the datasheet at:
- # ftp1.digi.com/support/documentation/90002180_L.pdf
-
- # For the XBee S1
- # A comprehensive list of commands and command modes is
- # available from the datasheet at:
- # http://www.sparkfun.com/datasheets/Wireless/Zigbee/XBee-Datasheet.pdf
-
- # For the XBee WiFi module:
- # An example using AT commands to connect to an AP, with a
- # private Key using WPA2:
-
- # Connect to AP with SSID 'mySSID':
- # ATIDmySSID
-
- # Provide the private key 'secret':
- # ATPKsecret
-
- # Use WPA2 encryption
- # ATEE2
-
diff --git a/peripheral/libupm/examples/python/yg1006.py b/peripheral/libupm/examples/python/yg1006.py
deleted file mode 100644
index 6f21c1d..0000000
--- a/peripheral/libupm/examples/python/yg1006.py
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_yg1006 as upmYG1006
-
-# Instantiate a flame sensor on digital pin D2
-myFlameSensor = upmYG1006.YG1006(2)
-
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit, including functions from myFlameSensor
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-while(1):
- if (myFlameSensor.flameDetected()):
- print "Flame detected."
- else:
- print "No flame detected."
-
- time.sleep(1)
diff --git a/peripheral/libupm/examples/python/zfm20-register.py b/peripheral/libupm/examples/python/zfm20-register.py
deleted file mode 100644
index 589a4df..0000000
--- a/peripheral/libupm/examples/python/zfm20-register.py
+++ /dev/null
@@ -1,132 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_zfm20 as upmZfm20
-
-# Instantiate a ZFM20 Fingerprint reader on UART 0
-myFingerprintSensor = upmZfm20.ZFM20(0)
-
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit,
-# including functions from myFingerprintSensor
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-# make sure port is initialized properly. 57600 baud is the default.
-if (not myFingerprintSensor.setupTty(upmZfm20.cvar.int_B57600)):
- print "Failed to setup tty port parameters"
- sys.exit(1)
-
-
-# This example demonstrates registering a fingerprint on the zfm20
-# module. The procedure is as follows:
-#
-# 1. get an image, store it in characteristics buffer 1
-# 2. get another image, store it in characteristics buffer 2
-# 3. store the image, assuming the two fingerprints match
-
-# first, we need to register our address and password
-
-myFingerprintSensor.setPassword(upmZfm20.ZFM20_DEFAULT_PASSWORD)
-myFingerprintSensor.setAddress(upmZfm20.ZFM20_DEFAULT_ADDRESS)
-
-# now verify the password. If this fails, any other commands
-# will be ignored, so we just bail.
-if (myFingerprintSensor.verifyPassword()):
- print "Password verified."
-else:
- print "Password verification failed."
- sys.exit(1)
-
-
-print " "
-
-# get the first image
-print "Place a finger on the sensor."
-while (myFingerprintSensor.generateImage() != upmZfm20.ZFM20.ERR_OK):
- pass
-
-# in theory, we have an image
-print "Image captured, converting..."
-
-rv = myFingerprintSensor.image2Tz(1)
-
-if (rv != upmZfm20.ZFM20.ERR_OK):
- print "Image conversion failed with error code %d" % rv
- sys.exit(1)
-
-print "Image conversion succeeded, remove finger."
-time.sleep(1)
-
-while (myFingerprintSensor.generateImage() != upmZfm20.ZFM20.ERR_NO_FINGER):
- pass
-
-print " "
-print "Now place the same finger on the sensor."
-
-while (myFingerprintSensor.generateImage() == upmZfm20.ZFM20.ERR_NO_FINGER):
- pass
-
-print "Image captured, converting..."
-
-# save this one in slot 2
-rv = myFingerprintSensor.image2Tz(2)
-if (rv != upmZfm20.ZFM20.ERR_OK):
- print "Image conversion failed with error code %d" % rv
- sys.exit(1)
-
-print "Image conversion succeeded, remove finger."
-print " "
-
-print "Storing fingerprint at id 1"
-
-# create the model
-rv = myFingerprintSensor.createModel()
-if (rv != upmZfm20.ZFM20.ERR_OK):
- if (rv == upmZfm20.ZFM20.ERR_FP_ENROLLMISMATCH):
- print "Fingerprints did not match."
- else:
- print "createModel failed with error code %d" % rv
- sys.exit(1)
-
-# now store it, we hard code the id (second arg) to 1 here
-rv = myFingerprintSensor.storeModel(1, 1)
-if (rv != upmZfm20.ZFM20.ERR_OK):
- print "storeModel failed with error code %d" % rv
- sys.exit(1)
-
-print " "
-print "Fingerprint stored at id 1."
-
diff --git a/peripheral/libupm/examples/python/zfm20.py b/peripheral/libupm/examples/python/zfm20.py
deleted file mode 100644
index e813e47..0000000
--- a/peripheral/libupm/examples/python/zfm20.py
+++ /dev/null
@@ -1,90 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_zfm20 as upmZfm20
-
-# Instantiate a ZFM20 Fingerprint reader on UART 0
-myFingerprintSensor = upmZfm20.ZFM20(0)
-
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit,
-# including functions from myFingerprintSensor
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-# make sure port is initialized properly. 57600 baud is the default.
-if (not myFingerprintSensor.setupTty(upmZfm20.cvar.int_B57600)):
- print "Failed to setup tty port parameters"
- sys.exit(1)
-
-# how many valid stored templates (fingerprints) do we have?
-print "Total stored templates: %d" % myFingerprintSensor.getNumTemplates()
-print " "
-
-# now spin waiting for a fingerprint to successfully image
-print "Waiting for finger print..."
-
-while (myFingerprintSensor.generateImage() == upmZfm20.ZFM20.ERR_NO_FINGER):
- pass
-
-# in theory, we have an image
-print "Image captured, converting..."
-
-rv = myFingerprintSensor.image2Tz(1)
-if (rv != upmZfm20.ZFM20.ERR_OK):
- print "Image conversion failed with error code %d" % rv
- sys.exit(1)
-
-print "Image conversion succeeded."
-print "Searching database..."
-
-myid = upmZfm20.uint16Array(0)
-myid.__setitem__(0, 0)
-myscore = upmZfm20.uint16Array(0)
-myscore.__setitem__(0, 0)
-
-# we search for a print matching slot 1, where we stored our last
-# converted fingerprint
-rv = myFingerprintSensor.search(1, myid, myscore)
-if (rv != upmZfm20.ZFM20.ERR_OK):
- if (rv == upmZfm20.ZFM20.ERR_FP_NOTFOUND):
- print "Finger Print not found"
- sys.exit(0)
- else:
- print "Search failed with error code %d" % rv
- sys.exit(1)
-
-print "Fingerprint found!"
-print "ID: %d, Score: %d" % (myid.__getitem__(0), myscore.__getitem__(0))
diff --git a/peripheral/libupm/src/CMakeLists.txt b/peripheral/libupm/src/CMakeLists.txt
deleted file mode 100644
index 5c0fa85..0000000
--- a/peripheral/libupm/src/CMakeLists.txt
+++ /dev/null
@@ -1,238 +0,0 @@
-macro (file_to_list readfile outlist)
- FILE(READ "${readfile}" contents)
- STRING(REGEX REPLACE ";" "\\\\;" contents "${contents}")
- STRING(REGEX REPLACE "\n" ";" contents "${contents}")
- set("${outlist}" "${contents}" )
-endmacro()
-
-file_to_list ("javaswig_blacklist" JAVASWIG_BLACKLIST)
-file_to_list ("pythonswig_blacklist" PYTHONSWIG_BLACKLIST)
-file_to_list ("nodeswig_blacklist" NODESWIG_BLACKLIST)
-
-macro(subdirlist result curdir)
- file(GLOB children RELATIVE ${curdir} ${curdir}/*)
- set(dirlist "")
- foreach(child ${children})
- if(IS_DIRECTORY ${curdir}/${child})
- set(dirlist ${dirlist} ${child})
- endif()
- endforeach()
- set(${result} ${dirlist})
-endmacro()
-
-macro (upm_CREATE_INSTALL_PKGCONFIG generated_file install_location)
- configure_file (${PROJECT_SOURCE_DIR}/src/pkgconfig.in
- ${CMAKE_CURRENT_BINARY_DIR}/${generated_file} @ONLY)
- install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${generated_file} DESTINATION ${install_location})
-endmacro (upm_CREATE_INSTALL_PKGCONFIG)
-
-macro(upm_SWIG_PYTHON)
- if (BUILDSWIGPYTHON AND BUILDSWIG)
- set_source_files_properties (pyupm_${libname}.i PROPERTIES CPLUSPLUS ON)
- set_source_files_properties (pyupm_${libname}.i PROPERTIES SWIG_FLAGS "-I${CMAKE_CURRENT_BINARY_DIR}/..")
- swig_add_module (pyupm_${libname} python pyupm_${libname}.i ${module_src})
- swig_link_libraries (pyupm_${libname} ${PYTHON_LIBRARIES} ${MRAA_LIBRARIES})
- target_include_directories ( ${SWIG_MODULE_pyupm_${libname}_REAL_NAME}
- PUBLIC
- "${PYTHON_INCLUDE_PATH}"
- "${PYTHON_INCLUDE_DIRS}"
- )
- install (FILES ${CMAKE_CURRENT_BINARY_DIR}/_pyupm_${libname}.so
- ${CMAKE_CURRENT_BINARY_DIR}/pyupm_${libname}.py
- DESTINATION ${CMAKE_INSTALL_LIBDIR}/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages/
- COMPONENT ${libname})
- endif()
-endmacro()
-
-macro(upm_SWIG_NODE)
- if (BUILDSWIGNODE AND BUILDSWIG)
- set_source_files_properties (jsupm_${libname}.i PROPERTIES CPLUSPLUS ON)
- set_source_files_properties (jsupm_${libname}.i PROPERTIES SWIG_FLAGS "-node")
- swig_add_module (jsupm_${libname} javascript jsupm_${libname}.i ${module_src})
- swig_link_libraries (jsupm_${libname} ${MRAA_LIBRARIES} ${NODE_LIBRARIES})
- target_include_directories ( ${SWIG_MODULE_jsupm_${libname}_REAL_NAME}
- PUBLIC
- "${NODE_INCLUDE_DIRS}"
- )
- set_target_properties (jsupm_${libname} PROPERTIES
- COMPILE_FLAGS "${CMAKE_CXX_FLAGS} -DBUILDING_NODE_EXTENSION -DSWIG_V8_VERSION=0x0${V8_DEFINE_STRING}"
- PREFIX ""
- SUFFIX ".node"
- )
- if (${V8_VERSION_MAJOR} GREATER 3)
- if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
- if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.7")
- message(FATAL_ERROR " **ERROR** GCC 4.7 or above is required to compile jsupm_${libname} ")
- endif()
- endif()
- set_property (TARGET jsupm_${libname} PROPERTY CXX_STANDARD 11)
- set_property (TARGET jsupm_${libname} PROPERTY CXX_STANDARD_REQUIRED ON)
- endif()
- createpackagejson(${libname})
- install (FILES ${CMAKE_CURRENT_BINARY_DIR}/jsupm_${libname}.node
- DESTINATION lib/node_modules/jsupm_${libname} COMPONENT ${libname})
- endif()
-endmacro()
-
-macro(upm_SWIG_JAVA)
- if (BUILDSWIGJAVA AND BUILDSWIG)
-
- FIND_PACKAGE (JNI REQUIRED)
- pkg_check_modules (MRAAJAVA REQUIRED mraajava>=0.8.0)
-
- include_directories (
- ${JAVA_INCLUDE_PATH}
- ${JAVA_INCLUDE_PATH2}
- ${CMAKE_CURRENT_SOURCE_DIR}/..
- )
-
- set_source_files_properties (javaupm_${libname}.i PROPERTIES CPLUSPLUS ON)
- set_source_files_properties (javaupm_${libname}.i PROPERTIES SWIG_FLAGS ";-package;upm_${libname};-I${CMAKE_BINARY_DIR}/src")
- swig_add_module (javaupm_${libname} java javaupm_${libname}.i ${module_src})
- swig_link_libraries (javaupm_${libname} ${MRAAJAVA_LDFLAGS} ${JAVA_LDFLAGS})
- target_include_directories ( ${SWIG_MODULE_javaupm_${libname}_REAL_NAME}
- PUBLIC
- "${JAVA_INCLUDE_DIRS}"
- "${JAVA_INCLUDE_PATH}"
- )
- set_target_properties (javaupm_${libname} PROPERTIES
- COMPILE_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive -DJAVACALLBACK"
- PREFIX "lib"
- SUFFIX ".so"
- )
- install (TARGETS javaupm_${libname} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
- install (FILES ${CMAKE_CURRENT_BINARY_DIR}/upm_${libname}.jar DESTINATION ${CMAKE_INSTALL_LIBDIR}/../lib/java)
-
- if (NOT DEFINED $ENV{JAVA_HOME_NATIVE})
- 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 ()
-
- add_custom_command (TARGET javaupm_${libname}
- POST_BUILD
- COMMAND cmake -E echo "Compiling java.."
- COMMAND cmake -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/upm_${libname}
- COMMAND ${JAVAC} *.java -d ${CMAKE_CURRENT_BINARY_DIR}
- COMMAND cmake -E echo "Creating jar"
- COMMAND ${JAR} cvf upm_${libname}.jar upm_${libname}
- )
-
- endif()
-endmacro()
-
-macro(upm_doxygen)
- if (DOXYGEN_FOUND)
- if(NOT DEFINED classname)
- set (classname ${libname})
- endif()
- set (CMAKE_SWIG_FLAGS -DDOXYGEN=${DOXYGEN_FOUND})
- if (BUILDSWIG)
- add_dependencies (_pyupm_${libname} pyupm_doxy2swig)
- add_dependencies (pydoc _pyupm_${libname})
- else ()
- add_dependencies (${libname} doc)
- endif ()
- endif ()
-endmacro()
-
-if (SWIG_FOUND)
- if(BUILDSWIGPYTHON)
- find_package (PythonLibs)
- string (REPLACE "." ";" PYTHON_VERSION_LIST ${PYTHONLIBS_VERSION_STRING})
- list (GET PYTHON_VERSION_LIST 0 PYTHON_VERSION_MAJOR)
- list (GET PYTHON_VERSION_LIST 1 PYTHON_VERSION_MINOR)
- endif(BUILDSWIGPYTHON)
- if(BUILDSWIGNODE)
- if(NOT NODE_FOUND)
- find_package(Node)
- endif()
- if(SWIG_VERSION VERSION_LESS 3.0.5 AND NODE_VERSION_STRING VERSION_GREATER 0.12)
- message("WARNING - SWIG 3.0.5+ required for building with nodejs 0.12. Current version is ${SWIG_VERSION}")
- endif()
- find_path (NODE_ROOT_DIR "node/node.h")
- set (NODE_INCLUDE_DIRS
- ${NODE_ROOT_DIR}/src
- ${NODE_ROOT_DIR}/node
- ${NODE_ROOT_DIR}/deps/v8/include
- ${NODE_ROOT_DIR}/deps/uv/include
- )
- macro(createpackagejson)
- configure_file (${PROJECT_SOURCE_DIR}/src/package.json.in ${CMAKE_CURRENT_BINARY_DIR}/package.json @ONLY)
- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/package.json
- DESTINATION lib/node_modules/jsupm_${libname} COMPONENT ${libname})
- endmacro()
-
- endif(BUILDSWIGNODE)
-
-endif()
-
-macro(upm_module_init)
- link_directories (${MRAA_LIBDIR})
- add_library (${libname} SHARED ${module_src})
- foreach (linkflag ${ARGN})
- target_link_libraries (${libname} ${linkflag})
- endforeach ()
- include_directories (${MRAA_INCLUDE_DIRS} .)
- target_link_libraries (${libname} ${MRAA_LIBRARIES})
- set_target_properties(
- ${libname}
- PROPERTIES PREFIX "libupm-"
- SOVERSION ${upm_VERSION_MAJOR}
- VERSION ${upm_VERSION_STRING}
- )
- upm_create_install_pkgconfig (upm-${libname}.pc ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
- if (SWIG_FOUND)
- if (NOT ";${PYTHONSWIG_BLACKLIST};" MATCHES ";${libname};")
- upm_swig_python()
- endif()
- if (NOT ";${NODESWIG_BLACKLIST};" MATCHES ";${libname};")
- upm_swig_node()
- endif()
- if (NOT ";${JAVASWIG_BLACKLIST};" MATCHES ";${libname};")
- upm_swig_java()
- endif()
- endif()
- if (BUILDDOC)
- upm_doxygen()
- endif()
- install(TARGETS ${libname} DESTINATION ${CMAKE_INSTALL_LIBDIR})
- install (FILES ${module_h} DESTINATION include/upm COMPONENT ${libname})
-
- if (IPK)
- cpack_add_component (${libname} DISPLAY_NAME ${libname} REQUIRED INSTALL_TYPES all)
- set(CPACK_COMPONENT_${libname}_DESCRIPTION "${libdescription}")
- endif()
-endmacro(upm_module_init)
-
-# Generate python module documentation from doxygen collateral
-if (BUILDDOC AND BUILDSWIGPYTHON AND SWIG_FOUND)
- # doxy2swig the doxygen output
- add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/pyupm_doxy2swig.i
- COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/doxy2swig.py
- ${CMAKE_BINARY_DIR}/xml/index.xml
- ${CMAKE_CURRENT_BINARY_DIR}/pyupm_doxy2swig.i
- DEPENDS ${CMAKE_BINARY_DIR}/xml/index.xml
- )
- add_custom_target (pyupm_doxy2swig DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/pyupm_doxy2swig.i)
- add_dependencies (pyupm_doxy2swig doc)
-# BUILDDOC not set but still building python modules, generate an empty
-# pyupm_doxy2swig.i file (overwriting if necessary)
-elseif (BUILDSWIGPYTHON AND SWIG_FOUND)
- message (INFO " Generating empty ${CMAKE_CURRENT_BINARY_DIR}/pyupm_doxy2swig.i")
- file (WRITE ${CMAKE_CURRENT_BINARY_DIR}/pyupm_doxy2swig.i "// Empty doxy2swig stub")
-endif (BUILDDOC AND BUILDSWIGPYTHON AND SWIG_FOUND)
-
-if (MODULE_LIST)
- set(SUBDIRS ${MODULE_LIST})
- set(SUBDIRS ${SUBDIRS} upm)
-else()
- subdirlist(SUBDIRS ${CMAKE_CURRENT_SOURCE_DIR})
-endif()
-foreach(subdir ${SUBDIRS})
- if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${subdir}/CMakeLists.txt)
- add_subdirectory(${subdir})
- endif()
-endforeach()
diff --git a/peripheral/libupm/src/a110x/CMakeLists.txt b/peripheral/libupm/src/a110x/CMakeLists.txt
deleted file mode 100644
index f649239..0000000
--- a/peripheral/libupm/src/a110x/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "a110x")
-set (libdescription "upm a110x sensor module")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/a110x/a110x.cxx b/peripheral/libupm/src/a110x/a110x.cxx
deleted file mode 100644
index 9023091..0000000
--- a/peripheral/libupm/src/a110x/a110x.cxx
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <string>
-#include <stdexcept>
-
-#include "a110x.h"
-
-using namespace upm;
-using namespace std;
-
-A110X::A110X(int pin)
-{
- if ( !(m_gpio = mraa_gpio_init(pin)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_gpio_init() failed, invalid pin?");
- return;
- }
-
- mraa_gpio_dir(m_gpio, MRAA_GPIO_IN);
- m_isrInstalled = false;
-}
-
-A110X::~A110X()
-{
- if (m_isrInstalled)
- uninstallISR();
-
- mraa_gpio_close(m_gpio);
-}
-
-bool A110X::magnetDetected()
-{
- return (!mraa_gpio_read(m_gpio) ? true : false);
-}
-
-#ifdef JAVACALLBACK
-void A110X::installISR(jobject runnable)
-{
-installISR(mraa_java_isr_callback, runnable);
-}
-#endif
-
-void A110X::installISR(void (*isr)(void *), void *arg)
-{
- if (m_isrInstalled)
- uninstallISR();
-
- // install our interrupt handler
- mraa_gpio_isr(m_gpio, MRAA_GPIO_EDGE_BOTH,
- isr, arg);
- m_isrInstalled = true;
-}
-
-void A110X::uninstallISR()
-{
- mraa_gpio_isr_exit(m_gpio);
- m_isrInstalled = false;
-}
diff --git a/peripheral/libupm/src/a110x/a110x.h b/peripheral/libupm/src/a110x/a110x.h
deleted file mode 100644
index d833a37..0000000
--- a/peripheral/libupm/src/a110x/a110x.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include <mraa/gpio.h>
-
-namespace upm {
- /**
- * @brief A110X Hall Effect library
- * @defgroup a110x libupm-a110x
- * @ingroup seeed gpio electric robok
- */
-
- /**
- * @library a110x
- * @sensor a110x
- * @comname A110X Hall Effect Sensor
- * @altname Grove Hall Sensor
- * @altid A1101, A1102, A1103, A1004, A1106
- * @type electric
- * @man seeed
- * @web http://www.allegromicro.com/en/Products/Magnetic-Digital-Position-Sensor-ICs/Hall-Effect-Unipolar-Switches/A1101-2-3-4-6.aspx
- * @con gpio
- * @kit robok
- *
- * @brief API for the A110X Hall Effect sensors
- *
- * UPM module for the A110X (A1101, A1102, A1103, A1104, and A1106)
- * Hall Effect sensors. It outputs a digital signal indicating
- * whether it is detecting a magnetic field with south polarity
- * perpendicular to the sensor element.
- *
- * @image html a110x.jpg
- * An example showing a simple test for the presence of a field
- * @snippet a110x.cxx Interesting
- * An example demonstrating the use of an interrupt handler to count pulses
- * @snippet a110x-intr.cxx Interesting
- */
- class A110X {
- public:
- /**
- * A110x digital sensor constructor
- *
- * @param pin Digital pin to use
- */
- A110X(int pin);
- /**
- * A110X destructor
- */
- ~A110X();
- /**
- * Determines whether a magnetic field of south polarity has been detected
- *
- * @return True if magnetic field detected
- */
- bool magnetDetected();
-
- /**
- * Installs an interrupt service routine (ISR) to be called when
- * the appropriate magnetic field is detected
- *
- * @param fptr Pointer to a function to be called on interrupt
- * @param arg Pointer to an object to be supplied as an
- * argument to the ISR.
- */
-#if defined(SWIGJAVA) || defined(JAVACALLBACK)
- void installISR(jobject runnable);
-#else
- void installISR(void (*isr)(void *), void *arg);
-#endif
- /**
- * Uninstalls the previously installed ISR
- *
- */
- void uninstallISR();
-
- private:
-#if defined(SWIGJAVA) || defined(JAVACALLBACK)
- void installISR(void (*isr)(void *), void *arg);
-#endif
-
- bool m_isrInstalled;
- mraa_gpio_context m_gpio;
- };
-}
-
-
diff --git a/peripheral/libupm/src/a110x/javaupm_a110x.i b/peripheral/libupm/src/a110x/javaupm_a110x.i
deleted file mode 100644
index ca9cb37..0000000
--- a/peripheral/libupm/src/a110x/javaupm_a110x.i
+++ /dev/null
@@ -1,20 +0,0 @@
-%module javaupm_a110x
-%include "../upm.i"
-%include "stdint.i"
-%include "typemaps.i"
-
-%{
- #include "a110x.h"
-%}
-%include "a110x.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_a110x");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%}
diff --git a/peripheral/libupm/src/a110x/jsupm_a110x.i b/peripheral/libupm/src/a110x/jsupm_a110x.i
deleted file mode 100644
index 1aa7916..0000000
--- a/peripheral/libupm/src/a110x/jsupm_a110x.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_a110x
-%include "../upm.i"
-
-%{
- #include "a110x.h"
-%}
-
-%include "a110x.h"
diff --git a/peripheral/libupm/src/a110x/pyupm_a110x.i b/peripheral/libupm/src/a110x/pyupm_a110x.i
deleted file mode 100644
index 9eeabdb..0000000
--- a/peripheral/libupm/src/a110x/pyupm_a110x.i
+++ /dev/null
@@ -1,11 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_a110x
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "a110x.h"
-%{
- #include "a110x.h"
-%}
diff --git a/peripheral/libupm/src/ad8232/CMakeLists.txt b/peripheral/libupm/src/ad8232/CMakeLists.txt
deleted file mode 100644
index 0a57240..0000000
--- a/peripheral/libupm/src/ad8232/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "ad8232")
-set (libdescription "upm ad8232 heart rate monitor")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/ad8232/ad8232.cxx b/peripheral/libupm/src/ad8232/ad8232.cxx
deleted file mode 100644
index 35612ae..0000000
--- a/peripheral/libupm/src/ad8232/ad8232.cxx
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-
-#include "ad8232.h"
-
-using namespace upm;
-using namespace std;
-
-AD8232::AD8232(int loPlus, int loMinus, int output, float aref) :
- m_gpioLOPlus(loPlus), m_gpioLOMinus(loMinus), m_aioOUT(output)
-{
- m_gpioLOPlus.dir(mraa::DIR_IN);
- m_gpioLOMinus.dir(mraa::DIR_IN);
-
- m_aref = aref;
- m_ares = (1 << m_aioOUT.getBit());
-}
-
-AD8232::~AD8232()
-{
-}
-
-int AD8232::value()
-{
- if (m_gpioLOPlus.read() || m_gpioLOMinus.read())
- return 0;
- else
- return m_aioOUT.read();
-}
diff --git a/peripheral/libupm/src/ad8232/ad8232.h b/peripheral/libupm/src/ad8232/ad8232.h
deleted file mode 100644
index f4eaf7e..0000000
--- a/peripheral/libupm/src/ad8232/ad8232.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <stdint.h>
-#include <sys/time.h>
-
-#include <mraa/gpio.hpp>
-
-#include <mraa/aio.hpp>
-
-#define AD8232_DEFAULT_AREF 3.3
-
-namespace upm {
-
- /**
- * @brief AD8232 Heart Rate Monitor library
- * @defgroup ad8232 libupm-ad8232
- * @ingroup sparkfun gpio medical
- */
-
- /**
- * @library ad8232
- * @sensor ad8232
- * @comname AD8232 Heart Rate Monitor
- * @type medical
- * @man sparkfun
- * @web https://www.sparkfun.com/products/12650
- * @con gpio aio
- *
- * @brief UPM module for the AD8232 Heart Rate Monitor
- *
- * Note: this sensor must be driven at 3.3V only.
- *
- * This module simply spits out the ADC values reported by the sensor, with
- * the intent to send that data, via serial or network port, somewhere to
- * another piece of software running on a computer that plots the data for
- * you, like an EKG.
- *
- * Processing (https://www.processing.org/) is software
- * that should work, using information from the SparkFun* website.
- *
- * This example just dumps the raw data:
- *
- * @image html ad8232.jpg
- * <br><em>AD8232 Heart Rate Monitor image provided by SparkFun under
- * <a href=https://creativecommons.org/licenses/by-nc-sa/3.0/>
- * CC BY-NC-SA-3.0</a>.</em>
- *
- * @snippet ad8232.cxx Interesting
- */
-
- class AD8232 {
- public:
-
- /**
- * AD8232 constructor
- *
- * @param loPlus Digital pin to use for LO+
- * @param loMinus Digital pin to use for LO-
- * @param output Analog pin to read the data
- */
- AD8232(int loPlus, int loMinus, int output, float aref=AD8232_DEFAULT_AREF);
-
- /**
- * AD8232 destructor
- */
- ~AD8232();
-
- /**
- * Returns the current ADC value for the device output pin. If an
- * LO (leads off) event is detected, 0 is returned.
- *
- * @return ADC value
- */
- int value();
-
- private:
- mraa::Aio m_aioOUT;
- mraa::Gpio m_gpioLOPlus;
- mraa::Gpio m_gpioLOMinus;
-
- float m_aref;
- int m_ares;
-
- };
-}
-
-
diff --git a/peripheral/libupm/src/ad8232/javaupm_ad8232.i b/peripheral/libupm/src/ad8232/javaupm_ad8232.i
deleted file mode 100644
index 391f1cf..0000000
--- a/peripheral/libupm/src/ad8232/javaupm_ad8232.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_ad8232
-%include "../upm.i"
-
-%{
- #include "ad8232.h"
-%}
-
-%include "ad8232.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_ad8232");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/ad8232/jsupm_ad8232.i b/peripheral/libupm/src/ad8232/jsupm_ad8232.i
deleted file mode 100644
index e2fe8d8..0000000
--- a/peripheral/libupm/src/ad8232/jsupm_ad8232.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_ad8232
-%include "../upm.i"
-
-%{
- #include "ad8232.h"
-%}
-
-%include "ad8232.h"
diff --git a/peripheral/libupm/src/ad8232/pyupm_ad8232.i b/peripheral/libupm/src/ad8232/pyupm_ad8232.i
deleted file mode 100644
index 46abb7d..0000000
--- a/peripheral/libupm/src/ad8232/pyupm_ad8232.i
+++ /dev/null
@@ -1,11 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_ad8232
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "ad8232.h"
-%{
- #include "ad8232.h"
-%}
diff --git a/peripheral/libupm/src/adafruitms1438/CMakeLists.txt b/peripheral/libupm/src/adafruitms1438/CMakeLists.txt
deleted file mode 100644
index d3da7e7..0000000
--- a/peripheral/libupm/src/adafruitms1438/CMakeLists.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-set (libname "adafruitms1438")
-set (libdescription "upm module for the Adafruit Motor Shield 1438")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-set (reqlibname "upm-pca9685")
-include_directories("../pca9685")
-upm_module_init()
-add_dependencies(${libname} pca9685)
-target_link_libraries(${libname} pca9685)
-if (BUILDSWIG)
- if (BUILDSWIGNODE)
- set_target_properties(${SWIG_MODULE_jsupm_${libname}_REAL_NAME} PROPERTIES SKIP_BUILD_RPATH TRUE)
- swig_link_libraries (jsupm_${libname} pca9685 ${MRAA_LIBRARIES} ${NODE_LIBRARIES})
- endif()
- if (BUILDSWIGPYTHON)
- set_target_properties(${SWIG_MODULE_pyupm_${libname}_REAL_NAME} PROPERTIES SKIP_BUILD_RPATH TRUE)
- swig_link_libraries (pyupm_${libname} pca9685 ${PYTHON_LIBRARIES} ${MRAA_LIBRARIES})
- endif()
-endif()
diff --git a/peripheral/libupm/src/adafruitms1438/adafruitms1438.cxx b/peripheral/libupm/src/adafruitms1438/adafruitms1438.cxx
deleted file mode 100644
index f1475d4..0000000
--- a/peripheral/libupm/src/adafruitms1438/adafruitms1438.cxx
+++ /dev/null
@@ -1,310 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <math.h>
-#include <iostream>
-#include <string>
-
-#include "adafruitms1438.h"
-
-using namespace upm;
-using namespace std;
-
-
-AdafruitMS1438::AdafruitMS1438(int bus, uint8_t address) :
- m_pca9685(new PCA9685(bus, address))
-{
- setupPinMaps();
-
- // set a default period of 50Hz
- setPWMPeriod(50);
-
- // disable all PWM's (4 of them). They are shared with each other
- // (stepper/DC), so just disable the DC motors here
- disableMotor(MOTOR_M1);
- disableMotor(MOTOR_M2);
- disableMotor(MOTOR_M3);
- disableMotor(MOTOR_M4);
-
- // Set all 'on time' registers to 0
- m_pca9685->ledOnTime(PCA9685_ALL_LED, 0);
-
- // set the default stepper config at 200 steps per rev
- stepConfig(STEPMOTOR_M12, 200);
- stepConfig(STEPMOTOR_M34, 200);
-}
-
-AdafruitMS1438::~AdafruitMS1438()
-{
- delete m_pca9685;
-}
-
-void AdafruitMS1438::initClock(STEPMOTORS_T motor)
-{
- gettimeofday(&m_stepConfig[motor].startTime, NULL);
-}
-
-uint32_t AdafruitMS1438::getMillis(STEPMOTORS_T motor)
-{
- struct timeval elapsed, now;
- uint32_t elapse;
-
- // get current time
- gettimeofday(&now, NULL);
-
- struct timeval startTime = m_stepConfig[motor].startTime;
-
- // compute the delta since m_startTime
- if( (elapsed.tv_usec = now.tv_usec - startTime.tv_usec) < 0 )
- {
- elapsed.tv_usec += 1000000;
- elapsed.tv_sec = now.tv_sec - startTime.tv_sec - 1;
- }
- else
- {
- elapsed.tv_sec = now.tv_sec - startTime.tv_sec;
- }
-
- elapse = (uint32_t)((elapsed.tv_sec * 1000) + (elapsed.tv_usec / 1000));
-
- // never return 0
- if (elapse == 0)
- elapse = 1;
-
- return elapse;
-}
-
-// setup the pin mappings of the pca9685 outputs to the proper motor controls
-void AdafruitMS1438::setupPinMaps()
-{
- // first the dc motors
- m_dcMotors[0] = (DC_PINMAP_T){ 8, 10, 9 };
- m_dcMotors[1] = (DC_PINMAP_T){ 13, 11, 12 };
- m_dcMotors[2] = (DC_PINMAP_T){ 2, 4, 3 };
- m_dcMotors[3] = (DC_PINMAP_T){ 7, 5, 6 };
-
- // now the 2 steppers
- m_stepMotors[0] = (STEPPER_PINMAP_T){ 8, 10, 9,
- 13, 11, 12 };
- m_stepMotors[1] = (STEPPER_PINMAP_T){ 2, 4, 3,
- 7, 5, 6 };
-}
-
-void AdafruitMS1438::setPWMPeriod(float hz)
-{
- // must be in sleep mode to set the prescale register
- m_pca9685->setModeSleep(true);
- m_pca9685->setPrescaleFromHz(hz);
- m_pca9685->setModeSleep(false);
-}
-
-void AdafruitMS1438::enableMotor(DCMOTORS_T motor)
-{
- m_pca9685->ledFullOff(m_dcMotors[motor].pwm, false);
-}
-
-void AdafruitMS1438::disableMotor(DCMOTORS_T motor)
-{
- m_pca9685->ledFullOff(m_dcMotors[motor].pwm, true);
-}
-
-void AdafruitMS1438::enableStepper(STEPMOTORS_T motor)
-{
- m_pca9685->ledFullOff(m_stepMotors[motor].pwmA, false);
- m_pca9685->ledFullOff(m_stepMotors[motor].pwmB, false);
-}
-
-void AdafruitMS1438::disableStepper(STEPMOTORS_T motor)
-{
- m_pca9685->ledFullOff(m_stepMotors[motor].pwmA, true);
- m_pca9685->ledFullOff(m_stepMotors[motor].pwmB, true);
-}
-
-void AdafruitMS1438::setMotorSpeed(DCMOTORS_T motor, int speed)
-{
- if (speed < 0)
- speed = 0;
-
- if (speed > 100)
- speed = 100;
-
- float percent = float(speed) / 100.0;
-
- // make sure that the FullOn bit is turned off, or the speed setting
- // (PWM duty cycle) won't have any effect.
- m_pca9685->ledFullOn(m_dcMotors[motor].pwm, false);
-
- // set the PWM duty cycle
- m_pca9685->ledOffTime(m_dcMotors[motor].pwm, int(4095.0 * percent));
-}
-
-void AdafruitMS1438::setStepperSpeed(STEPMOTORS_T motor, int speed)
-{
- m_stepConfig[motor].stepDelay = 60 * 1000 /
- m_stepConfig[motor].stepsPerRev / speed;
-}
-
-void AdafruitMS1438::setMotorDirection(DCMOTORS_T motor, DIRECTION_T dir)
-{
- if (dir & 0x01)
- {
- m_pca9685->ledFullOn(m_dcMotors[motor].in1, true);
- m_pca9685->ledFullOff(m_dcMotors[motor].in1, false);
- }
- else
- {
- m_pca9685->ledFullOff(m_dcMotors[motor].in1, true);
- m_pca9685->ledFullOn(m_dcMotors[motor].in1, false);
- }
-
- if (dir & 0x02)
- {
- m_pca9685->ledFullOn(m_dcMotors[motor].in2, true);
- m_pca9685->ledFullOff(m_dcMotors[motor].in2, false);
- }
- else
- {
- m_pca9685->ledFullOff(m_dcMotors[motor].in2, true);
- m_pca9685->ledFullOn(m_dcMotors[motor].in2, false);
- }
-}
-
-void AdafruitMS1438::setStepperDirection(STEPMOTORS_T motor, DIRECTION_T dir)
-{
- switch (dir)
- {
- case DIR_CW:
- m_stepConfig[motor].stepDirection = 1;
- break;
- case DIR_CCW:
- m_stepConfig[motor].stepDirection = -1;
- break;
- default: // default to 1 if DIR_NONE specified
- m_stepConfig[motor].stepDirection = 1;
- break;
- }
-}
-
-void AdafruitMS1438::stepConfig(STEPMOTORS_T motor, unsigned int stepsPerRev)
-{
- m_stepConfig[motor].stepsPerRev = stepsPerRev;
- m_stepConfig[motor].currentStep = 0;
- m_stepConfig[motor].stepDelay = 0;
- m_stepConfig[motor].stepDirection = 1; // forward
-
- // now, setup the control pins - we want both FULL ON and FULL OFF.
- // Since FULL OFF has precedence, we can then control the steps by
- // just turning on/off the FULL OFF bit for the relevant outputs
-
- m_pca9685->ledFullOff(m_stepMotors[motor].pwmA, true);
- m_pca9685->ledFullOn(m_stepMotors[motor].pwmA, true);
-
- m_pca9685->ledFullOff(m_stepMotors[motor].pwmB, true);
- m_pca9685->ledFullOn(m_stepMotors[motor].pwmB, true);
-
- m_pca9685->ledFullOff(m_stepMotors[motor].in1A, true);
- m_pca9685->ledFullOn(m_stepMotors[motor].in1A, true);
-
- m_pca9685->ledFullOff(m_stepMotors[motor].in2A, true);
- m_pca9685->ledFullOn(m_stepMotors[motor].in2A, true);
-
- m_pca9685->ledFullOff(m_stepMotors[motor].in1B, true);
- m_pca9685->ledFullOn(m_stepMotors[motor].in1B, true);
-
- m_pca9685->ledFullOff(m_stepMotors[motor].in2B, true);
- m_pca9685->ledFullOn(m_stepMotors[motor].in2B, true);
-}
-
-void AdafruitMS1438::stepperStep(STEPMOTORS_T motor)
-{
- int step = m_stepConfig[motor].currentStep % 4;
-
- // Step I0 I1 I2 I3
- // 1 1 0 1 0
- // 2 0 1 1 0
- // 3 0 1 0 1
- // 4 1 0 0 1
-
- // we invert the logic since we are essentially toggling an OFF bit,
- // not an ON bit.
- switch (step)
- {
- case 0: // 1010
- m_pca9685->ledFullOff(m_stepMotors[motor].in1A, false);
- m_pca9685->ledFullOff(m_stepMotors[motor].in2A, true);
- m_pca9685->ledFullOff(m_stepMotors[motor].in1B, false);
- m_pca9685->ledFullOff(m_stepMotors[motor].in2B, true);
- break;
- case 1: // 0110
- m_pca9685->ledFullOff(m_stepMotors[motor].in1A, true);
- m_pca9685->ledFullOff(m_stepMotors[motor].in2A, false);
- m_pca9685->ledFullOff(m_stepMotors[motor].in1B, false);
- m_pca9685->ledFullOff(m_stepMotors[motor].in2B, true);
- break;
- case 2: //0101
- m_pca9685->ledFullOff(m_stepMotors[motor].in1A, true);
- m_pca9685->ledFullOff(m_stepMotors[motor].in2A, false);
- m_pca9685->ledFullOff(m_stepMotors[motor].in1B, true);
- m_pca9685->ledFullOff(m_stepMotors[motor].in2B, false);
- break;
- case 3: //1001
- m_pca9685->ledFullOff(m_stepMotors[motor].in1A, false);
- m_pca9685->ledFullOff(m_stepMotors[motor].in2A, true);
- m_pca9685->ledFullOff(m_stepMotors[motor].in1B, true);
- m_pca9685->ledFullOff(m_stepMotors[motor].in2B, false);
- break;
- }
-}
-
-void AdafruitMS1438::stepperSteps(STEPMOTORS_T motor, unsigned int steps)
-{
- while (steps > 0)
- {
- if (getMillis(motor) >= m_stepConfig[motor].stepDelay)
- {
- // reset the clock
- initClock(motor);
-
- m_stepConfig[motor].currentStep += m_stepConfig[motor].stepDirection;
-
- if (m_stepConfig[motor].stepDirection == 1)
- {
- if (m_stepConfig[motor].currentStep >=
- m_stepConfig[motor].stepsPerRev)
- m_stepConfig[motor].currentStep = 0;
- }
- else
- {
- if (m_stepConfig[motor].currentStep <= 0)
- m_stepConfig[motor].currentStep =
- m_stepConfig[motor].stepsPerRev;
- }
-
- steps--;
- stepperStep(motor);
- }
- }
-}
-
diff --git a/peripheral/libupm/src/adafruitms1438/adafruitms1438.h b/peripheral/libupm/src/adafruitms1438/adafruitms1438.h
deleted file mode 100644
index 1f00ac9..0000000
--- a/peripheral/libupm/src/adafruitms1438/adafruitms1438.h
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <stdint.h>
-#include <sys/time.h>
-
-#include <string>
-#include <mraa/i2c.h>
-#include <mraa/gpio.h>
-
-#include "pca9685.h"
-
-#define ADAFRUITMS1438_I2C_BUS 0
-#define ADAFRUITMS1438_DEFAULT_I2C_ADDR 0x60
-
-namespace upm {
-
- /**
- * @brief Adafruit Motor Shield 1438 library
- * @defgroup adafruitms1438 libupm-adafruitms1438
- * @ingroup adafruit i2c motor
- */
-
- /**
- * @library adafruitms1438
- * @sensor adafruitms1438
- * @comname Adafruit Motor Shield
- * @type motor
- * @man adafruit
- * @web http://www.adafruit.com/products/1438
- * @con i2c
- *
- * @brief API for the AdafruitMS1438 Motor Shield
- *
- * This class implements support for the stepper and DC motors that
- * can be connected to this Motor Shield.
- * Note: the two servo connections are not controlled by the PCA9685
- * controller (or this class). They are connected directly to digital
- * PWM pins 9 and 10 on the Arduino* breakout board.
- *
- * @image html adafruitms1438.jpg
- * An example using a DC motor connected to M3
- * @snippet adafruitms1438.cxx Interesting
- * An example using a stepper motor connected to M1 & M2
- * @snippet adafruitms1438-stepper.cxx Interesting
- */
- class AdafruitMS1438 {
- public:
-
- /**
- * Enum to specify the direction of a motor
- */
- typedef enum {
- DIR_NONE = 0x00,
- DIR_CW = 0x01,
- DIR_CCW = 0x02
- } DIRECTION_T;
-
- /**
- * Enum to specify a DC motor
- */
- typedef enum {
- MOTOR_M1 = 0,
- MOTOR_M2 = 1,
- MOTOR_M3 = 2,
- MOTOR_M4 = 3
- } DCMOTORS_T;
-
- /**
- * Enum to specify a stepper motor
- */
- typedef enum {
- STEPMOTOR_M12 = 0,
- STEPMOTOR_M34 = 1
- } STEPMOTORS_T;
-
- /**
- * AdafruitMS1438 constructor
- *
- * @param bus I2C bus to use
- * @param address Address for this sensor
- */
- AdafruitMS1438(int bus, uint8_t address = ADAFRUITMS1438_DEFAULT_I2C_ADDR);
-
- /**
- * AdafruitMS1438 destructor
- */
- ~AdafruitMS1438();
-
- /**
- * Returns the number of milliseconds elapsed since initClock(...)
- * was last called.
- *
- * @return Elapsed milliseconds
- */
- uint32_t getMillis(STEPMOTORS_T motor);
-
- /**
- * Resets the clock
- *
- */
- void initClock(STEPMOTORS_T motor);
-
- /**
- * Sets the PWM period. Note: this applies to all PWM channels.
- *
- * @param hz Sets the PWM period
- */
- void setPWMPeriod(float hz);
-
- /**
- * Enables PWM output for a motor
- *
- * @param motor DC motor to enable
- */
- void enableMotor(DCMOTORS_T motor);
-
- /**
- * Disables PWM output for a motor
- *
- * @param motor DC motor to disable
- */
- void disableMotor(DCMOTORS_T motor);
-
- /**
- * Enables output for a stepper motor
- *
- * @param motor Stepper motor to enable
- */
- void enableStepper(STEPMOTORS_T motor);
-
- /**
- * Disable output for a stepper motor
- *
- * @param motor Stepper motor to disable
- */
- void disableStepper(STEPMOTORS_T motor);
-
- /**
- * set the speed of a DC motor. Values can range from 0 (off) to
- * 100 (full speed).
- *
- * @param motor the DC motor to configure
- * @param speed speed to set the motor to
- */
- void setMotorSpeed(DCMOTORS_T motor, int speed);
-
- /**
- * Sets the speed of a stepper in revolutions per minute (RPM)
- *
- * @param motor DC motor to configure
- * @param speed Speed to set the motor to
- */
- void setStepperSpeed(STEPMOTORS_T motor, int speed);
-
- /**
- * Sets the direction of a DC motor, clockwise or counterclockwise
- *
- * @param motor DC motor to configure
- * @param dir Direction to set the motor in
- */
- void setMotorDirection(DCMOTORS_T motor, DIRECTION_T dir);
-
- /**
- * Sets the direction of a stepper motor, clockwise or counterclockwise
- *
- * @param motor Stepper motor to configure
- * @param dir Direction to set the motor in
- */
- void setStepperDirection(STEPMOTORS_T motor, DIRECTION_T dir);
-
- /**
- * Sets a stepper motor configuration
- *
- * @param motor Stepper motor to configure
- * @param stepsPerRev Number of steps to complete a full revolution
- */
- void stepConfig(STEPMOTORS_T motor, unsigned int stepsPerRev);
-
- /**
- * Steps a stepper motor a specified number of steps
- *
- * @param motor Stepper motor to step
- * @param steps Number of steps to move the stepper motor
- */
- void stepperSteps(STEPMOTORS_T motor, unsigned int steps);
-
- private:
- // SWIG will generate a warning for these 'nested structs'; however,
- // it can be ignored as these structs are never exposed.
-
- // struct to hold mappings of DC motors
- typedef struct {
- int pwm;
- int in1;
- int in2;
- } DC_PINMAP_T;
-
- // struct to hold mappings of stepper motors
- typedef struct {
- int pwmA;
- int in1A;
- int in2A;
- int pwmB;
- int in1B;
- int in2B;
- } STEPPER_PINMAP_T;
-
- // struct to hold information about each stepper
- typedef struct {
- int stepsPerRev; // steps per revolution
- int currentStep; // current step number
- uint32_t stepDelay; // delay between steps
- int stepDirection; // direction to step
- struct timeval startTime; // starting time
- } STEPPER_CONFIG_T;
-
- void setupPinMaps();
- void stepperStep(STEPMOTORS_T motor);
-
- DC_PINMAP_T m_dcMotors[4];
- STEPPER_PINMAP_T m_stepMotors[2];
- STEPPER_CONFIG_T m_stepConfig[2];
-
- PCA9685 *m_pca9685;
- };
-}
-
-
diff --git a/peripheral/libupm/src/adafruitms1438/javaupm_adafruitms1438.i b/peripheral/libupm/src/adafruitms1438/javaupm_adafruitms1438.i
deleted file mode 100644
index a02306c..0000000
--- a/peripheral/libupm/src/adafruitms1438/javaupm_adafruitms1438.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_adafruitms1438
-%include "../upm.i"
-
-%{
- #include "adafruitms1438.h"
-%}
-
-%include "adafruitms1438.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_adafruitms1438");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/adafruitms1438/jsupm_adafruitms1438.i b/peripheral/libupm/src/adafruitms1438/jsupm_adafruitms1438.i
deleted file mode 100644
index 69060e5..0000000
--- a/peripheral/libupm/src/adafruitms1438/jsupm_adafruitms1438.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_adafruitms1438
-%include "../upm.i"
-
-%{
- #include "adafruitms1438.h"
-%}
-
-%include "adafruitms1438.h"
diff --git a/peripheral/libupm/src/adafruitms1438/pyupm_adafruitms1438.i b/peripheral/libupm/src/adafruitms1438/pyupm_adafruitms1438.i
deleted file mode 100644
index 812311a..0000000
--- a/peripheral/libupm/src/adafruitms1438/pyupm_adafruitms1438.i
+++ /dev/null
@@ -1,15 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_adafruitms1438
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-#ifdef DOXYGEN
-%include "adafruitms1438_doc.i"
-#endif
-
-%include "adafruitms1438.h"
-%{
- #include "adafruitms1438.h"
-%}
diff --git a/peripheral/libupm/src/adafruitss/CMakeLists.txt b/peripheral/libupm/src/adafruitss/CMakeLists.txt
deleted file mode 100644
index 40214ce..0000000
--- a/peripheral/libupm/src/adafruitss/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "adafruitss")
-set (libdescription "upm Adafruit pca9685 based 16-channel servo shield")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/adafruitss/adafruitss.cxx b/peripheral/libupm/src/adafruitss/adafruitss.cxx
deleted file mode 100644
index 1bd967a..0000000
--- a/peripheral/libupm/src/adafruitss/adafruitss.cxx
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * Author: Stan Gifford <stan@gifford.id.au>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <string>
-#include <stdexcept>
-
-#include "adafruitss.h"
-#include <unistd.h>
-#include <math.h>
-
-using namespace upm;
-
-adafruitss::adafruitss(int bus,int i2c_address)
-{
- if ( !(m_i2c = mraa_i2c_init(bus)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_i2c_init() failed");
- return;
- }
-
- pca9685_addr = i2c_address;
- if (mraa_i2c_address(m_i2c, pca9685_addr) != MRAA_SUCCESS)
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_i2c_address() failed");
- return;
- }
-
- m_rx_tx_buf[0]=PCA9685_MODE1;
- m_rx_tx_buf[1]=0;
- if (mraa_i2c_write(m_i2c,m_rx_tx_buf,2) != MRAA_SUCCESS)
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_i2c_write() failed");
- return;
- }
-
- adafruitss::setPWMFreq(60);
-
- adafruitss::update();
-}
-
-void adafruitss::setPWMFreq(float freq) {
- float afreq= freq * 0.899683334F; // Correct for overshoot in the frequency setting (see issue #11). (Tested at 60hz with Logic 4 for 50hz and 60hz)
- float prescaleval = 25000000;
- prescaleval /= 4096;
- prescaleval /= afreq;
- prescaleval -= 1;
- float pwm_frequency = freq; // Use actual requested frequency gives the correct pulse width
-
- _duration_1ms = ((4096*pwm_frequency)/1000); // This is 1ms duration
-
- uint8_t prescale = roundf(prescaleval);
-
-
-
- mraa_i2c_address(m_i2c, pca9685_addr);
- mraa_i2c_read_byte_data(m_i2c,PCA9685_MODE1);
-
-
- m_rx_tx_buf[0]=PCA9685_MODE1;
- m_rx_tx_buf[1]=0x10; // sleep
- mraa_i2c_address(m_i2c, pca9685_addr);
- mraa_i2c_write(m_i2c,m_rx_tx_buf,2);
-
-
-
- m_rx_tx_buf[0]=PCA9685_PRESCALE;
- m_rx_tx_buf[1]=prescale;
- mraa_i2c_address(m_i2c, pca9685_addr);
- mraa_i2c_write(m_i2c,m_rx_tx_buf,2);
-
-
-
-
- m_rx_tx_buf[0]=PCA9685_MODE1;
- m_rx_tx_buf[1]=0x00;
- mraa_i2c_address(m_i2c, pca9685_addr);
- mraa_i2c_write(m_i2c,m_rx_tx_buf,2);
-
- // mraa_i2c_write_byte_data(m_i2c,0x00,PCA9685_MODE1);
-
- usleep(5000);
-
-
- m_rx_tx_buf[0]=PCA9685_MODE1;
- m_rx_tx_buf[1]=0xa1;
- mraa_i2c_address(m_i2c, pca9685_addr);
- mraa_i2c_write(m_i2c,m_rx_tx_buf,2);
-}
-
-int adafruitss::update(void)
-{
- return MRAA_SUCCESS;
-}
-
-void adafruitss::servo(uint8_t port, uint8_t servo_type, float degrees) {
- // Set Servo values
- // Degrees is from 0 to 180
- // servo_type: 0 = standard 1ms to 2ms
- // 1 = extended 0.6ms to 2.4ms
- // 2 = extended 0.8ms to 2.2ms
-
- float duration;
-
- if(degrees>180) degrees=180; // Ensure within bounds
- if (degrees<0) degrees=0;
- switch (servo_type) {
- default:
- case 0: // Standard Servo 1ms to 2ms
- duration = _duration_1ms + ((_duration_1ms*degrees)/180);
- break;
-
- case 1: // Extended Servo 0.6ms to 2.4ms, i.e. 1.8ms from 0 to 180
- //duration = (_duration_1ms*0.6) + ((_duration_1ms*1.8*degrees)/180); simplified to..
- duration = (_duration_1ms*0.6) + ((_duration_1ms*degrees)/100);
- break;
-
- case 2: // Extended Servo 0.8ms to 2.2ms, i.e. 1.4ms from 0 to 180
- //duration = (_duration_1ms*0.8) + ((_duration_1ms*1.4*degrees)/180); simplified to..
- duration = (_duration_1ms*0.8) + ((_duration_1ms*degrees)/128);
- break;
- case 3: // Extended Servo 0.9ms to 2.1ms, - GWS Mini STD BB servo
- //duration = (_duration_1ms*0.9) + ((_duration_1ms*1.4*degrees)/180); simplified to..
- duration = (_duration_1ms*0.9) + ((_duration_1ms*degrees)/120);
- break;
- }
-
- uint16_t d= roundf(duration);
- mraa_i2c_address(m_i2c, pca9685_addr);
- m_rx_tx_buf[0]=LED0_REG+4*port;
- m_rx_tx_buf[1]=0;
- m_rx_tx_buf[2]=0;
- m_rx_tx_buf[3]=d;
- m_rx_tx_buf[4]=d>>8;
-
- mraa_i2c_write(m_i2c,m_rx_tx_buf,5);
- }
-
diff --git a/peripheral/libupm/src/adafruitss/adafruitss.h b/peripheral/libupm/src/adafruitss/adafruitss.h
deleted file mode 100644
index e9dbb75..0000000
--- a/peripheral/libupm/src/adafruitss/adafruitss.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Author: Stan Gifford <stan@gifford.id.au>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#pragma once
-
-#include <mraa/i2c.h>
-
-#define MAX_BUFFER_LENGTH 6
-
-#define SERVO_MIN 0
-#define SERVO_MAX 180
-#define SERVO_FREQ 60
-#define PCA9685_SUBADR1 0x2
-#define PCA9685_SUBADR2 0x3
-#define PCA9685_SUBADR3 0x4
-
-#define PCA9685_MODE1 0x0
-#define PCA9685_PRESCALE 0xFE
-
-#define LED0_ON_L 0x6
-#define LED0_ON_H 0x7
-#define LED0_OFF_L 0x8
-#define LED0_OFF_H 0x9
-
-#define ALLLED_ON_L 0xFA
-#define ALLLED_ON_H 0xFB
-#define ALLLED_OFF_L 0xFC
-#define ALLLED_OFF_H 0xFD
-
-#define PCA9685_MODE1_REG 0x00
-#define PCA9685_PRESCALE_REG 0xFE
-#define LED0_REG 0x06
-
-namespace upm {
-
- /**
- * @brief Adafruit PCA9685-based Servo Shield library
- * @defgroup adafruitss libupm-adafruitss
- * @ingroup adafruit i2c servos
- */
-
- /**
- * @library adafruitss
- * @sensor adafruitss
- * @comname Adafruit Servo Shield
- * @type servos
- * @man adafruit
- * @web http://www.adafruit.com/product/1411
- * @con i2c
- *
- * @brief API for the Adafruit Servo Shield
- *
- * UPM library for the PCA9685-based Adafruit 16-channel servo shield. If 3
- * or more GWS servos are attached, results could be unpredictable. Adafruit
- * Industries recommend installing a capacitor on the board, which should
- * alleviate the issue. Sizing depends on servos and their number.
- *
- * @image html adafruitss.jpg
- * @snippet adafruitss.cxx Interesting
- */
-
- class adafruitss {
- public:
- /**
- * Creates an adafruitss object
- *
- * @param bus Number of the used I2C bus
- * @param i2c_address Address of the servo shield on the I2C bus
- */
- adafruitss(int bus, int i2c_address);
- int update(void);
- /**
- * Sets the frequency of the servos
- *
- * @param freq Frequency at which the servos operate
- */
- void setPWMFreq(float freq);
- /**
- * Moves one of the servos to a specified angle
- *
- * @param port Port of the servo on the shield (servo number)
- * @param servo_type Can be 0 = standard (1ms to 2ms), 1 = extended
- * (0.6ms to 2.4ms), or 2 = extended (0.8ms to 2.2ms)
- * @param degrees Angle to set the servo to
- */
- void servo(uint8_t port, uint8_t servo_type, float degrees);
-
- private:
-
- int pca9685_addr;
- mraa_i2c_context m_i2c;
- uint8_t m_rx_tx_buf[MAX_BUFFER_LENGTH];
- float _duration_1ms;
-};
-
-}
diff --git a/peripheral/libupm/src/adafruitss/javaupm_adafruitss.i b/peripheral/libupm/src/adafruitss/javaupm_adafruitss.i
deleted file mode 100644
index 4e64220..0000000
--- a/peripheral/libupm/src/adafruitss/javaupm_adafruitss.i
+++ /dev/null
@@ -1,18 +0,0 @@
-%module javaupm_adafruitss
-%include "../upm.i"
-
-%include "adafruitss.h"
-%{
- #include "adafruitss.h"
-%}
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_adafruitss");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/adafruitss/jsupm_adafruitss.i b/peripheral/libupm/src/adafruitss/jsupm_adafruitss.i
deleted file mode 100644
index cb15aaa..0000000
--- a/peripheral/libupm/src/adafruitss/jsupm_adafruitss.i
+++ /dev/null
@@ -1,7 +0,0 @@
-%module jsupm_adafruitss
-%include "../upm.i"
-
-%include "adafruitss.h"
-%{
- #include "adafruitss.h"
-%}
diff --git a/peripheral/libupm/src/adafruitss/pyupm_adafruitss.i b/peripheral/libupm/src/adafruitss/pyupm_adafruitss.i
deleted file mode 100644
index 8f8131f..0000000
--- a/peripheral/libupm/src/adafruitss/pyupm_adafruitss.i
+++ /dev/null
@@ -1,11 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_adafruitss
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "adafruitss.h"
-%{
- #include "adafruitss.h"
-%}
diff --git a/peripheral/libupm/src/adc121c021/CMakeLists.txt b/peripheral/libupm/src/adc121c021/CMakeLists.txt
deleted file mode 100644
index 1c198fd..0000000
--- a/peripheral/libupm/src/adc121c021/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "adc121c021")
-set (libdescription "upm adc121c021 I2C ADC converter module")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/adc121c021/adc121c021.cxx b/peripheral/libupm/src/adc121c021/adc121c021.cxx
deleted file mode 100644
index 7bdb8a3..0000000
--- a/peripheral/libupm/src/adc121c021/adc121c021.cxx
+++ /dev/null
@@ -1,261 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <string>
-#include <stdexcept>
-
-#include "adc121c021.h"
-
-using namespace upm;
-using namespace std;
-
-
-ADC121C021::ADC121C021(int bus, uint8_t address, float vref)
-{
- // setup our i2c link
- m_i2c = mraa_i2c_init(bus);
- if ( !(m_i2c = mraa_i2c_init(bus)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_i2c_init() failed");
- return;
- }
-
- m_addr = address;
-
- mraa_result_t ret = mraa_i2c_address(m_i2c, m_addr);
-
- if (ret != MRAA_SUCCESS)
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_i2c_address() failed");
- return;
- }
-
- m_vref = vref;
-}
-
-ADC121C021::~ADC121C021()
-{
- mraa_i2c_stop(m_i2c);
-}
-
-mraa_result_t ADC121C021::writeByte(uint8_t reg, uint8_t byte)
-{
- return mraa_i2c_write_byte_data(m_i2c, byte, reg);
-}
-
-mraa_result_t ADC121C021::writeWord(uint8_t reg, uint16_t word)
-{
- // We need to swap the bytes
- uint8_t b1 = (word & 0xff00) >> 8;
- word <<= 8;
- word |= b1;
-
- return mraa_i2c_write_word_data(m_i2c, word, reg);
-}
-
-uint8_t ADC121C021::readByte(uint8_t reg)
-{
- return mraa_i2c_read_byte_data(m_i2c, reg);
-}
-
-uint16_t ADC121C021::readWord(uint8_t reg)
-{
- uint16_t val = mraa_i2c_read_word_data(m_i2c, reg);
- uint8_t b1;
-
- // The value returned is in the wrong byte order, so we need to swap them
- b1 = (val & 0xff00) >> 8;
- val <<= 8;
- val |= b1;
-
- return val;
-}
-
-uint16_t ADC121C021::value()
-{
- // mask off alert flag and reserved bits
- return (readWord(ADC121C021_REG_RESULT) & 0x0fff);
-}
-
-float ADC121C021::valueToVolts(uint16_t val)
-{
- // The arduino example multiplies this by 2, which seems wrong. If
- // the reference voltage is 3.0, then you should never get a voltage
- // value higher than that.
- //
- // val * m_vref * 2.0 / ADC121C021_RESOLUTION
- return (val * m_vref / ADC121C021_RESOLUTION);
-}
-
-bool ADC121C021::getAlertStatus()
-{
- // high order bit is the alert flag, mask off the rest
- bool rv = (readWord(ADC121C021_REG_RESULT) & 0x8000) ? true : false;
-
- if (rv)
- {
- // read the alert low and high values and set the appropriate
- // member variables
- uint8_t astatus = readByte(ADC121C021_REG_ALERT_STATUS);
- if (astatus & 0x01)
- m_alertLow = true;
- else
- m_alertLow = false;
-
- if (astatus & 0x02)
- m_alertHigh = true;
- else
- m_alertHigh = false;
- }
-
- return rv;
-}
-
-void ADC121C021::clearAlertStatus()
-{
- // zero out both the low and high alert flags
- writeByte(ADC121C021_REG_ALERT_STATUS, 0x03);
-
- m_alertHigh = false;
- m_alertLow = false;
-}
-
-void ADC121C021::enableAlertFlag(bool enable)
-{
- // read the current config register
- uint8_t val = readByte(ADC121C021_REG_CONFIG);
-
- if (enable)
- val |= 0x08;
- else
- val &= ~0x08;
-
- // write the register back
- writeByte(ADC121C021_REG_CONFIG, val);
-}
-
-void ADC121C021::enableAlertPin(bool enable)
-{
- // read the current config register
- uint8_t val = readByte(ADC121C021_REG_CONFIG);
-
- if (enable)
- val |= 0x04;
- else
- val &= ~0x04;
-
- // write the register back
- writeByte(ADC121C021_REG_CONFIG, val);
-}
-
-void ADC121C021::enableAlertHold(bool enable)
-{
- // read the current config register
- uint8_t val = readByte(ADC121C021_REG_CONFIG);
-
- if (enable)
- val |= 0x10;
- else
- val &= ~0x10;
-
- // write the register back
- writeByte(ADC121C021_REG_CONFIG, val);
-}
-
-void ADC121C021::enableAlertPinPolarityHigh(bool enable)
-{
- // read the current config register
- uint8_t val = readByte(ADC121C021_REG_CONFIG);
-
- if (enable)
- val |= 0x01;
- else
- val &= ~0x01;
-
- // write the register back
- writeByte(ADC121C021_REG_CONFIG, val);
-}
-
-void ADC121C021::setAutomaticConversion(ADC121C021_CYCLE_TIME_T cycleTime)
-{
- // first we
-
- // read the current config register, masking off the cycle time bits
- uint8_t val = readByte(ADC121C021_REG_CONFIG) & 0x1f;
-
- val |= ((uint8_t)cycleTime << 5);
-
- // write the register back
- writeByte(ADC121C021_REG_CONFIG, val);
-}
-
-mraa_result_t ADC121C021::setAlertLowLimit(uint16_t limit)
-{
- // mask off the invalid bits in case they were set
- limit &= 0x0fff;
-
- // write it
- return writeWord(ADC121C021_REG_ALERT_LIM_UNDER, limit);
-}
-
-mraa_result_t ADC121C021::setAlertHighLimit(uint16_t limit)
-{
- // mask off the invalid bits in case they were set
- limit &= 0x0fff;
-
- // write it
- return writeWord(ADC121C021_REG_ALERT_LIM_OVER, limit);
-}
-
-mraa_result_t ADC121C021::setHysteresis(uint16_t limit)
-{
- // mask off the invalid bits in case they were set
- limit &= 0x0fff;
-
- // write it
- return writeWord(ADC121C021_REG_ALERT_HYS, limit);
-}
-
-uint16_t ADC121C021::getHighestConversion()
-{
- return readWord(ADC121C021_REG_HIGHEST_CONV);
-}
-
-uint16_t ADC121C021::getLowestConversion()
-{
- return readWord(ADC121C021_REG_LOWEST_CONV);
-}
-
-mraa_result_t ADC121C021::clearHighestConversion()
-{
- return writeWord(ADC121C021_REG_HIGHEST_CONV, 0x0000);
-}
-
-mraa_result_t ADC121C021::clearLowestConversion()
-{
- return writeWord(ADC121C021_REG_LOWEST_CONV, 0x0fff);
-}
diff --git a/peripheral/libupm/src/adc121c021/adc121c021.h b/peripheral/libupm/src/adc121c021/adc121c021.h
deleted file mode 100644
index 8a2519d..0000000
--- a/peripheral/libupm/src/adc121c021/adc121c021.h
+++ /dev/null
@@ -1,314 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include <mraa/i2c.h>
-
-#define ADC121C021_I2C_BUS 0
-#define ADC121C021_DEFAULT_I2C_ADDR 0x55
-
-#define ADC121C021_RESOLUTION 4096 // 12 bits
-
-/**
- * ADC121C021 registers
- */
-
-#define ADC121C021_REG_RESULT 0x00
-#define ADC121C021_REG_ALERT_STATUS 0x01
-#define ADC121C021_REG_CONFIG 0x02
-#define ADC121C021_REG_ALERT_LIM_UNDER 0x03
-#define ADC121C021_REG_ALERT_LIM_OVER 0x04
-#define ADC121C021_REG_ALERT_HYS 0x05
-#define ADC121C021_REG_LOWEST_CONV 0x06
-#define ADC121C021_REG_HIGHEST_CONV 0x07
-
-// For the Grove I2C ADC
-#define ADC121C021_DEFAULT_VREF 3.0
-
-namespace upm {
- /**
- * @brief ADC121C021 I2C Analog-to-Digital Converter library
- * @defgroup adc121c021 libupm-adc121c021
- * @ingroup seeed i2c electric
- */
-
-
- /**
- * Valid cycle times for the automatic conversion mode
- */
-
- typedef enum { ADC121C021_CYCLE_NONE = 0, // disabled
- ADC121C021_CYCLE_32 = 1, // 27 ksps
- ADC121C021_CYCLE_64 = 2, // 13.5
- ADC121C021_CYCLE_128 = 3, // 6.7
- ADC121C021_CYCLE_256 = 4, // 3.4
- ADC121C021_CYCLE_512 = 5, // 1.7
- ADC121C021_CYCLE_1024 = 6, // 0.9
- ADC121C021_CYCLE_2048 = 7 // 0.4
- } ADC121C021_CYCLE_TIME_T;
-
- /**
- * @library adc121c021
- * @sensor adc121c021
- * @comname ADC121C021 Analog-to-Digital Converter
- * @altname Grove I2C ADC
- * @type electric
- * @man seeed
- * @web http://www.seeedstudio.com/depot/Grove-I2C-ADC-p-1580.html
- * @con i2c
- *
- * @brief API for the ADC121C021 I2C Analog-to-Digital Converter
- *
- * UPM module for the ADC121C021 12-bit analog-to-digital converter (ADC).
- * By constantly providing a reference voltage, this sensor helps
- * increase the accuracy of a value collected from an analog sensor.
- *
- * @image html adc121c021.jpg
- * @snippet adc121c021.cxx Interesting
- */
- class ADC121C021 {
- public:
- /**
- * ADC121C021 ADC constructor
- *
- * @param bus I2C bus to use
- * @param address Address for this sensor; default is 0x55
- * @param vref Reference voltage for this sensor; default is 3.0v
- */
- ADC121C021(int bus, uint8_t address = ADC121C021_DEFAULT_I2C_ADDR,
- float vref = ADC121C021_DEFAULT_VREF);
-
- /**
- * ADC121C021 destructor
- */
- ~ADC121C021();
-
- /**
- * Writes a byte value into the register
- *
- * @param reg Register location to write into
- * @param byte Byte to write
- * @return 0 (MRAA_SUCCESS) if successful; non-zero otherwise
- */
- mraa_result_t writeByte(uint8_t reg, uint8_t byte);
-
- /**
- * Writes a word value into the register
- *
- * @param reg Register location to write into
- * @param word Word to write
- * @return 0 (MRAA_SUCCESS) if successful; non-zero otherwise
- */
- mraa_result_t writeWord(uint8_t reg, uint16_t word);
-
- /**
- * Reads the byte value from the register
- *
- * @param reg Register location to read from
- * @return Value in the specified register
- */
- uint8_t readByte(uint8_t reg);
-
- /**
- * Reads the word value from the register
- *
- * @param reg Register location to read from
- * @return Value in the specified register
- */
- uint16_t readWord(uint8_t reg);
-
- /**
- * Reads the current value of conversion
- *
- * @return Current value of conversion
- */
- uint16_t value();
-
- /**
- * Converts a supplied value to voltage based on the set vref
- *
- * @param val Value of conversion (from value())
- * @return Value of conversion in volts
- */
- float valueToVolts(uint16_t val);
-
- /**
- * Reads the current status of the alert flag. If the flag is set, the
- * low or high alert indicators are set as appropriate, and
- * you can access these values with alertLowTriggered() or
- * alertHighTriggered().
- *
- * @return True if the alert flag is set
- */
- bool getAlertStatus();
-
- /**
- * Returns the current value of m_alertLow. You must call
- * getAlertStatus() to update this value.
- *
- * @return Current status of the alert low flag
- */
- bool alertLowTriggered() { return m_alertLow; };
-
- /**
- * Returns the current value of m_alertHigh. You must call
- * getAlertStatus() to update this value.
- *
- * @return Current status of the alert high flag
- */
- bool alertHighTriggered() { return m_alertHigh; };
-
- /**
- * Clears the alert low and alert high flags. This also clears the
- * last stored alert values.
- */
- void clearAlertStatus();
-
- /**
- * Enables or disables the alert flag functionality. If enabled,
- * when the measured value exceeds the low or high limits
- * configured, the alert flag is set. Use getAlertStatus()
- * to access these values.
- *
- * @param enable If true, enables the alert flag; otherwise, disables the
- * alert flag
- */
- void enableAlertFlag(bool enable);
-
- /**
- * Enables or disables the alert pin functionality.
- *
- * @param enable If true, enables the alert pin; otherwise, disables the
- * alert pin
- */
- void enableAlertPin(bool enable);
-
- /**
- * Enables or disables the alert hold functionality. When the alert
- * hold is enabled, the alert status remains until manually
- * cleared via clearAlertStatus(). Otherwise, the alert self-clears
- * when the value moves into the defined limits if alerts
- * are enabled via enableAlertFlag().
- *
- * @param enable If true, enables the alert hold; otherwise, disables the
- * alert hold
- */
- void enableAlertHold(bool enable);
-
- /**
- * If the alert pin is enabled, defines the active
- * polarity of the pin in an alert condition. Enabling this sets
- * the pin to active high in an alert condition; otherwise,
- * active low is used.
- *
- * @param enable If true, the alert pin is active high; otherwise, active
- * low
- */
- void enableAlertPinPolarityHigh(bool enable);
-
- /**
- * Enables or disables the automatic conversion mode. When enabled, the
- * ADC samples and updates the conversion value independently.
- * It is disabled by default, so conversion is only done by
- * calling value().
- *
- * @param cycleTime Sets the cycle time for automatic conversion
- */
- void setAutomaticConversion(ADC121C021_CYCLE_TIME_T cycleTime);
-
- /**
- * Sets the alert low limit. If alerts are enabled and the
- * measured conversion value is lower than the low limit, an alert is
- * triggered.
- *
- * @param limit Alert low limit
- * @return 0 (MRAA_SUCCESS) if successful; non-zero otherwise
- */
- mraa_result_t setAlertLowLimit(uint16_t limit);
-
- /**
- * Sets the alert high limit. If alerts are enabled and the
- * measured conversion value is higher than the high limit, an alert is
- * triggered.
- *
- * @param limit Alert high limit
- * @return 0 (MRAA_SUCCESS) if successful; non-zero otherwise
- */
- mraa_result_t setAlertHighLimit(uint16_t limit);
-
- /**
- * Sets the hysteresis value. If a high or low alert condition is
- * triggered, the conversion result must move within the high or
- * low limit by more than this value to clear the alert condition.
- * If the alert hold is set, the alert doesn't self-clear
- * regardless of this value.
- *
- * @param limit Hysteresis limit
- * @return 0 (MRAA_SUCCESS) if successful; non-zero otherwise
- */
- mraa_result_t setHysteresis(uint16_t limit);
-
- /**
- * Returns the highest conversion value recorded so far. This value
- * is only updated by the converter when the automatic conversion mode
- * is enabled.
- *
- * @return Highest conversion value
- */
- uint16_t getHighestConversion();
-
- /**
- * Returns the lowest conversion value recorded so far. This value
- * is only updated by the converter when the automatic conversion mode
- * is enabled.
- *
- * @return Lowest conversion value
- */
- uint16_t getLowestConversion();
-
- /**
- * Clears the highest conversion value recorded so far.
- *
- * @return 0 (MRAA_SUCCESS) if successful; non-zero otherwise
- */
- mraa_result_t clearHighestConversion();
-
- /**
- * Clears the lowest conversion value recorded so far.
- *
- * @return 0 (MRAA_SUCCESS) if successful; non-zero otherwise
- */
- mraa_result_t clearLowestConversion();
-
- private:
- mraa_i2c_context m_i2c;
- uint8_t m_addr;
- float m_vref;
- bool m_alertLow;
- bool m_alertHigh;
- };
-}
-
-
diff --git a/peripheral/libupm/src/adc121c021/javaupm_adc121c021.i b/peripheral/libupm/src/adc121c021/javaupm_adc121c021.i
deleted file mode 100644
index 33e4d2e..0000000
--- a/peripheral/libupm/src/adc121c021/javaupm_adc121c021.i
+++ /dev/null
@@ -1,20 +0,0 @@
-%module javaupm_adc121c021
-%include "../upm.i"
-/*%include "../carrays_uint16_t.i"
-*/
-%{
- #include "adc121c021.h"
-%}
-
-%include "adc121c021.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_adc121c021");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/adc121c021/jsupm_adc121c021.i b/peripheral/libupm/src/adc121c021/jsupm_adc121c021.i
deleted file mode 100644
index 83c2893..0000000
--- a/peripheral/libupm/src/adc121c021/jsupm_adc121c021.i
+++ /dev/null
@@ -1,9 +0,0 @@
-%module jsupm_adc121c021
-%include "../upm.i"
-%include "../carrays_uint16_t.i"
-
-%{
- #include "adc121c021.h"
-%}
-
-%include "adc121c021.h"
diff --git a/peripheral/libupm/src/adc121c021/pyupm_adc121c021.i b/peripheral/libupm/src/adc121c021/pyupm_adc121c021.i
deleted file mode 100644
index 9fd2a83..0000000
--- a/peripheral/libupm/src/adc121c021/pyupm_adc121c021.i
+++ /dev/null
@@ -1,15 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_adc121c021
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-#ifdef DOXYGEN
-%include "adc121c021_doc.i"
-#endif
-
-%include "adc121c021.h"
-%{
- #include "adc121c021.h"
-%}
diff --git a/peripheral/libupm/src/adis16448/CMakeLists.txt b/peripheral/libupm/src/adis16448/CMakeLists.txt
deleted file mode 100644
index d7b4972..0000000
--- a/peripheral/libupm/src/adis16448/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "adis16448")
-set (libdescription "libupm High-Precision IMU")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/adis16448/adis16448.cxx b/peripheral/libupm/src/adis16448/adis16448.cxx
deleted file mode 100644
index b95d3fa..0000000
--- a/peripheral/libupm/src/adis16448/adis16448.cxx
+++ /dev/null
@@ -1,247 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////////////
-// The MIT License (MIT)
-//
-// Submit Date: 03/09/2015
-// Author: Juan Jose Chong <juanjchong@gmail.com>
-// Copyright (c) 2015 Juan Jose Chong
-//
-//////////////////////////////////////////////////////////////////////////////////////
-// adis16448.cxx
-//////////////////////////////////////////////////////////////////////////////////////
-//
-// This library runs on an Intel Edison and uses mraa to acquire data
-// from an ADIS16448. This data is then scaled and printed onto the terminal.
-//
-// This software has been tested to connect to an ADIS16448 through a level shifter
-// such as the TI TXB0104. The SPI lines (DIN, DOUT, SCLK, /CS) are all wired through
-// the level shifter and the ADIS16448 is also being powered by the Intel Edison.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-//////////////////////////////////////////////////////////////////////////////////////
-#include <iostream>
-#include <string>
-#include <stdexcept>
-#include <unistd.h>
-#include <stdlib.h>
-#include <functional>
-#include <string.h>
-
-#include "adis16448.h"
-
-using namespace upm;
-
-////////////////////////////////////////////////////////////////////////////
-// Constructor with configurable CS, DR, and RST
-////////////////////////////////////////////////////////////////////////////
-// RST - Hardware reset pin
-////////////////////////////////////////////////////////////////////////////
-ADIS16448::ADIS16448(int bus, int rst)
-{
-// Configure I/O
- //Initialize RST pin
- if ( !(_rst = mraa_gpio_init(rst)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_gpio_init() failed, invalid pin?");
- return;
- }
- mraa_gpio_dir(_rst, MRAA_GPIO_IN); //Set direction as INPUT
-
- // Configure SPI
- if ( !(_spi = mraa_spi_init(bus)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_spi_init() failed");
- return;
- }
- configSPI();
-}
-
-////////////////////////////////////////////////////////////////////////////
-// Destructor - Stops SPI and Closes all GPIO used. Reports an error if
-// unable to close either properly.
-////////////////////////////////////////////////////////////////////////////
-ADIS16448::~ADIS16448()
-{
-// Close SPI bus
- mraa_result_t error;
- error = mraa_spi_stop(_spi);
- if(error != MRAA_SUCCESS)
- {
- mraa_result_print(error);
- }
-// Close GPIO
- error = mraa_gpio_close(_rst);
- if(error != MRAA_SUCCESS)
- {
- mraa_result_print(error);
- }
-}
-
-////////////////////////////////////////////////////////////////////////////
-// Performs hardware reset by setting _RST pin low for 2 seconds.
-////////////////////////////////////////////////////////////////////////////
-void ADIS16448::resetDUT()
-{
- mraa_gpio_write(_rst, 0);
- usleep(100000); //Sleep for 100ms
- mraa_gpio_write(_rst, 1);
- usleep(1000000); //Sleep for 1s
-}
-
-////////////////////////////////////////////////////////////////////////////
-// Sets SPI bit order, clock divider, and data mode. This function is useful
-// when there are multiple SPI devices using different settings.
-////////////////////////////////////////////////////////////////////////////
-void ADIS16448::configSPI() {
- mraa_spi_frequency(_spi, 1000000); //Set SPI frequency to 1MHz
-
- if ( mraa_spi_mode(_spi, MRAA_SPI_MODE3) != MRAA_SUCCESS )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_spi_mode() failed");
- return;
- }
- //Set # of bits per word
-
- if ( mraa_spi_bit_per_word(_spi, 16) != MRAA_SUCCESS )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_spi_bit_per_word() failed");
- return;
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////
-// Reads two bytes (one word) in two sequential registers over SPI
-////////////////////////////////////////////////////////////////////////////////////////////
-// regAddr - register address from the lookup table in ADIS16448.h
-// return - (int) signed 16 bit 2's complement number
-////////////////////////////////////////////////////////////////////////////////////////////
-int16_t ADIS16448::regRead(uint8_t regAddr)
-{
- configSPI(); //Set up SPI (useful when multiple SPI devices present on bus)
-// Write register address to be read
- uint8_t buf[2]; //Allocate write buffer
- memset(buf, 0, sizeof(uint8_t)*2); //Initialize buffer and write 0s
- buf[1] = regAddr; //Write the user-requested register address to the buffer
- mraa_spi_write_buf(_spi, buf, 2); //Write the buffer onto the SPI port
-
- usleep(20); //Delay to not violate read rate (210us)
-
-// Read data from register requested
- buf[1] = 0; //Clear contents of write buffer
- uint8_t* x = mraa_spi_write_buf(_spi, buf, 2); //Write 0x0000 to SPI and read data requested above
- int16_t _dataOut = (x[1] << 8) | (x[0] & 0xFF);; //Concatenate upper and lower bytes
-
- usleep(20); //delay to not violate read rate (210us)
- return(_dataOut);
-}
-////////////////////////////////////////////////////////////////////////////
-// Writes one byte of data to the specified register over SPI
-////////////////////////////////////////////////////////////////////////////
-// regAddr - register address from the lookup table
-// regData - data to be written to the register
-////////////////////////////////////////////////////////////////////////////
-void ADIS16448::regWrite(uint8_t regAddr,uint16_t regData)
-{
- configSPI();
-// Separate the 16 bit command word into two bytes
- uint16_t addr = (((regAddr & 0x7F) | 0x80) << 8); //Check that the address is 7 bits, flip the sign bit
- uint16_t lowWord = (addr | (regData & 0xFF));
- uint16_t highWord = ((addr | 0x100) | ((regData >> 8) & 0xFF));
-// Write the low byte to the SPI bus
- uint8_t lbuf[2]; //Allocate write buffer
- memset(lbuf, 0, sizeof(uint8_t)*2); //Fill low buffer with 0's
- lbuf[0] = (lowWord >> 8);
- lbuf[1] = (lowWord);
- mraa_spi_write_buf(_spi, lbuf, 2); //Write the buffer to the SPI port
-
- usleep(20);
-
-// Write the high byte to the SPI bus
- uint8_t hbuf[2]; //Allocate write buffer
- memset(hbuf, 0, sizeof(uint8_t)*2); //Fill high buffer with 0's
- hbuf[0] = (highWord >> 8);
- hbuf[1] = (highWord);
- mraa_spi_write_buf(_spi, hbuf, 2); //Write the buffer to the SPI port
-
- usleep(20);
-
-}
-/////////////////////////////////////////////////////////////////////////////////////////
-// Converts accelerometer data output from the sensorRead() function and returns
-// acceleration in g's
-/////////////////////////////////////////////////////////////////////////////////////////
-// sensorData - data output from sensorRead()
-// return - (float) signed/scaled accelerometer in G's
-/////////////////////////////////////////////////////////////////////////////////////////
-float ADIS16448::accelScale(int16_t sensorData)
-{
- float finalData = sensorData * 0.000833; // multiply by accel sensitivity (250uG/LSB)
- return finalData;
-}
-/////////////////////////////////////////////////////////////////////////////////////////////
-// Converts gyro data output from the sensorRead() function and returns gyro rate in deg/sec
-/////////////////////////////////////////////////////////////////////////////////////////////
-// sensorData - data output from sensorRead()
-// return - (float) signed/scaled gyro in degrees/sec
-/////////////////////////////////////////////////////////////////////////////////////////
-float ADIS16448::gyroScale(int16_t sensorData)
-{
- float finalData = sensorData * 0.04; //multiply by gyro sensitivity (0.005 LSB/dps)
- return finalData;
-}
-/////////////////////////////////////////////////////////////////////////////////////////////
-// Converts temperature data output from the sensorRead() function and returns temperature
-// in degrees Celcius
-/////////////////////////////////////////////////////////////////////////////////////////////
-// sensorData - data output from sensorRead()
-// return - (float) signed/scaled temperature in degrees Celcius
-/////////////////////////////////////////////////////////////////////////////////////////
-float ADIS16448::tempScale(int16_t sensorData)
-{
- float finalData = (sensorData * 0.07386) + 31; //multiply by temperature scale and add 31 to equal 0x0000
- return finalData;
-}
-/////////////////////////////////////////////////////////////////////////////////////////////
-// Converts barometer data output from sensorRead() function and returns pressure in bar
-/////////////////////////////////////////////////////////////////////////////////////////////
-// sensorData - data output from sensorRead()
-// return - (float) signed/scaled temperature in degrees Celcius
-/////////////////////////////////////////////////////////////////////////////////////////
-float ADIS16448::pressureScale(int16_t sensorData)
-{
- float finalData = (sensorData * 0.02); //multiply by gyro sensitivity (0.005 LSB/dps)
- return finalData;
-}
-/////////////////////////////////////////////////////////////////////////////////////////////
-// Converts magnetometer output from sensorRead() function and returns magnetic field
-// reading in Gauss
-/////////////////////////////////////////////////////////////////////////////////////////////
-// sensorData - data output from sensorRead()
-// return - (float) signed/scaled temperature in degrees Celcius
-/////////////////////////////////////////////////////////////////////////////////////////
-float ADIS16448::magnetometerScale(int16_t sensorData)
-{
- float finalData = (sensorData * 0.0001429); //multiply by sensor resolution (142.9uGa LSB/dps)
- return finalData;
-}
diff --git a/peripheral/libupm/src/adis16448/adis16448.h b/peripheral/libupm/src/adis16448/adis16448.h
deleted file mode 100644
index 0159e48..0000000
--- a/peripheral/libupm/src/adis16448/adis16448.h
+++ /dev/null
@@ -1,173 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////////////
-// The MIT License (MIT)
-//
-// Submit Date: 03/09/2015
-// Author: Juan Jose Chong <juanjchong@gmail.com>
-// Copyright (c) 2015 Juan Jose Chong
-//
-//////////////////////////////////////////////////////////////////////////////////////
-// adis16448.h
-//////////////////////////////////////////////////////////////////////////////////////
-//
-// This library runs on an Intel Edison and uses mraa to acquire data
-// from an ADIS16448. This data is then scaled and printed onto the terminal.
-//
-// This software has been tested to connect to an ADIS16448 through a level shifter
-// such as the TI TXB0104. The SPI lines (DIN, DOUT, SCLK, /CS) are all wired through
-// the level shifter and the ADIS16448 is also being powered by the Intel Edison.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-//////////////////////////////////////////////////////////////////////////////////////
-#include <string>
-#include <mraa/spi.h>
-#include <mraa/gpio.h>
-
-// User Register Memory Map from Table 6 of the Datasheet
-#define FLASH_CNT 0x00 //Flash memory write count
-#define XGYRO_OUT 0x04 //X-axis gyroscope output
-#define YGYRO_OUT 0x06 //Y-axis gyroscope output
-#define ZGYRO_OUT 0x08 //Z-axis gyroscope output
-#define XACCL_OUT 0x0A //X-axis accelerometer output
-#define YACCL_OUT 0x0C //Y-axis accelerometer output
-#define ZACCL_OUT 0x0E //Z-axis accelerometer output
-#define XMAGN_OUT 0X10 //X-axis magnetometer output
-#define YMAGN_OUT 0x12 //Y-axis magnetometer output
-#define ZMAGN_OUT 0x14 //Z-axis magnetometer output
-#define BARO_OUT 0x16 //Barometer pressure measurement, high word
-#define TEMP_OUT 0x18 //Temperature output
-#define XGYRO_OFF 0x1A //X-axis gyroscope bias offset factor
-#define YGYRO_OFF 0x1C //Y-axis gyroscope bias offset factor
-#define ZGYRO_OFF 0x1E //Z-axis gyroscope bias offset factor
-#define XACCL_OFF 0x20 //X-axis acceleration bias offset factor
-#define YACCL_OFF 0x22 //Y-axis acceleration bias offset factor
-#define ZACCL_OFF 0x24 //Z-axis acceleration bias offset factor
-#define XMAGN_HIC 0x26 //X-axis magnetometer, hard iron factor
-#define YMAGN_HIC 0x28 //Y-axis magnetometer, hard iron factor
-#define ZMAGN_HIC 0x2A //Z-axis magnetometer, hard iron factor
-#define XMAGN_SIC 0x2C //X-axis magnetometer, soft iron factor
-#define YMAGN_SIC 0x2E //Y-axis magnetometer, soft iron factor
-#define ZMAGN_SIC 0x30 //Z-axis magnetometer, soft iron factor
-#define GPIO_CTRL 0x32 //GPIO control
-#define MSC_CTRL 0x34 //Misc. control
-#define SMPL_PRD 0x36 //Sample clock/Decimation filter control
-#define SENS_AVG 0x38 //Digital filter control
-#define SEQ_CNT 0x3A //xMAGN_OUT and BARO_OUT counter
-#define DIAG_STAT 0x3C //System status
-#define GLOB_CMD 0x3E //System command
-#define ALM_MAG1 0x40 //Alarm 1 amplitude threshold
-#define ALM_MAG2 0x42 //Alarm 2 amplitude threshold
-#define ALM_SMPL1 0x44 //Alarm 1 sample size
-#define ALM_SMPL2 0x46 //Alarm 2 sample size
-#define ALM_CTRL 0x48 //Alarm control
-#define LOT_ID1 0x52 //Lot identification number
-#define LOT_ID2 0x54 //Lot identification number
-#define PROD_ID 0x56 //Product identifier
-#define SERIAL_NUM 0x58 //Lot-specific serial number
-
-namespace upm {
- /**
- * @brief ADIS16448 Accelerometer library
- * @defgroup adis16448 libupm-adis16448
- * @ingroup generic spi accelerometer
- */
-
- /**
- * @library adis16448
- * @sensor adis16448
- * @comname ADIS16448 Accelerometer
- * @type accelerometer
- * @man generic
- * @web http://www.analog.com/en/products/sensors/isensor-mems-inertial-measurement-units/adis16448.html
- * @con spi
- *
- * @brief API for the Analog Devices ADIS16448 Accelerometer
- *
- * This is an industrial-grade accelerometer by Analog Devices.
- *
- * @snippet adis16448.cxx Interesting
- */
- class ADIS16448{
-
- public:
-
- /**
- * Constructor with configurable HW Reset
- */
- ADIS16448(int bus, int rst);
-
- /**
- * Destructor
- */
- ~ADIS16448();
-
- /**
- * Performs hardware reset by sending the specified pin low for 2 seconds
- */
- void resetDUT();
-
- /**
- * Sets SPI frequency, mode, and bits/word
- */
- void configSPI();
-
- /**
- * Reads a specified register and returns data
- */
- int16_t regRead(uint8_t regAddr);
-
- /**
- * Writes to a specified register
- */
- void regWrite(uint8_t regAddr, uint16_t regData);
-
- /**
- * Scales accelerometer data
- */
- float accelScale(int16_t sensorData);
-
- /**
- * Scales gyro data
- */
- float gyroScale(int16_t sensorData);
-
- /**
- * Scales temperature data
- */
- float tempScale(int16_t sensorData);
-
- /**
- * Scales pressure data
- */
- float pressureScale(int16_t sensorData);
-
- /**
- * Scales magnetometer data
- */
- float magnetometerScale(int16_t sensorData);
-
- private:
-
- mraa_spi_context _spi;
- mraa_gpio_context _rst;
-
- };
-}
-
diff --git a/peripheral/libupm/src/adis16448/javaupm_adis16448.i b/peripheral/libupm/src/adis16448/javaupm_adis16448.i
deleted file mode 100644
index b4cc0b1..0000000
--- a/peripheral/libupm/src/adis16448/javaupm_adis16448.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_adis16448
-%include "../upm.i"
-
-%{
- #include "adis16448.h"
-%}
-
-%include "adis16448.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_adis16448");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/adis16448/jsupm_adis16448.i b/peripheral/libupm/src/adis16448/jsupm_adis16448.i
deleted file mode 100644
index 64882d0..0000000
--- a/peripheral/libupm/src/adis16448/jsupm_adis16448.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_adis16448
-%include "../upm.i"
-
-%{
- #include "adis16448.h"
-%}
-
-%include "adis16448.h"
diff --git a/peripheral/libupm/src/adis16448/pyupm_adis16448.i b/peripheral/libupm/src/adis16448/pyupm_adis16448.i
deleted file mode 100644
index 62ef918..0000000
--- a/peripheral/libupm/src/adis16448/pyupm_adis16448.i
+++ /dev/null
@@ -1,10 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_adis16448
-%include "../upm.i"
-
-%{
- #include "adis16448.h"
-%}
-
-%include "adis16448.h"
diff --git a/peripheral/libupm/src/ads1x15/CMakeLists.txt b/peripheral/libupm/src/ads1x15/CMakeLists.txt
deleted file mode 100644
index 67c2e85..0000000
--- a/peripheral/libupm/src/ads1x15/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "ads1x15")
-set (libdescription "analog to digital converter")
-set (module_src ${libname}.cxx ads1115.cxx ads1015.cxx)
-set (module_h ${libname}.h ads1115.h ads1015.h)
-upm_module_init() \ No newline at end of file
diff --git a/peripheral/libupm/src/ads1x15/ads1015.cxx b/peripheral/libupm/src/ads1x15/ads1015.cxx
deleted file mode 100644
index 1beef3d..0000000
--- a/peripheral/libupm/src/ads1x15/ads1015.cxx
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Author: Marc Graham <marc@m2ag.net>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#include "ads1015.h"
-
-using namespace upm;
-
-void
-ADS1015::setSPS(ADSSAMPLERATE rate){
- updateConfigRegister((m_config_reg & ~ADS1X15_DR_MASK) | rate);
-}
-
-ADS1015::ADS1015(int bus, uint8_t address) : ADS1X15(bus, address) {
- m_name = "ADS1015";
- m_conversionDelay = ADS1015_CONVERSIONDELAY;
- m_bitShift = 4;
- ADS1X15::getCurrentConfig();
-}
-
-ADS1015::~ADS1015(){};
-
-//Private functions
-float
-ADS1015::getMultiplier(void){
- float multi = 0.0;
- switch((ADSGAIN)m_config_reg & ADS1X15_PGA_MASK){
- case GAIN_TWOTHIRDS:
- multi = 0.003;
- break;
- case GAIN_ONE:
- multi = 0.002;
- break;
- case GAIN_TWO:
- multi = 0.001;
- break;
- case GAIN_FOUR:
- multi = 0.0005;
- break;
- case GAIN_EIGHT:
- multi = 0.00025;
- break;
- case GAIN_SIXTEEN:
- multi = 0.000125;
- break;
- default:
- multi = 0.001;
- break;
- }
- return multi;
-}
-
-void
-ADS1015::setDelay(){
- switch((int)ADS1X15::getSPS()){
- case 0:
- m_conversionDelay = 8000;
- break;
- case 32:
- m_conversionDelay = 4000;
- break;
- case 64:
- m_conversionDelay = 3000;
- break;
- case 96:
- m_conversionDelay = 1100;
- break;
- case 128:
- m_conversionDelay = 700;
- break;
- case 160:
- m_conversionDelay = 500;
- break;
- case 192:
- m_conversionDelay = 400;
- break;
- default:
- m_conversionDelay = 8000;
- break;
- }
-}
-
-
diff --git a/peripheral/libupm/src/ads1x15/ads1015.h b/peripheral/libupm/src/ads1x15/ads1015.h
deleted file mode 100644
index 6d0fd9f..0000000
--- a/peripheral/libupm/src/ads1x15/ads1015.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Author: Marc Graham <marc@m2ag.net>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-/*=========================================================================*/
-
-#pragma once
-
-#include "ads1x15.h"
-
-
-
-/*=========================================================================
- CONVERSION DELAY (in microS)
- -----------------------------------------------------------------------*/
- #define ADS1015_CONVERSIONDELAY (8000)
-/*=========================================================================*/
-
-
-/*=========================================================================
- CONFIG REGISTER
-
- -----------------------------------------------------------------------*/
-
-#define ADS1015_DR_MASK (0x00E0)
-#define ADS1015_DR_128SPS (0x0000) // 128 samples per second
-#define ADS1015_DR_250SPS (0x0020) // 250 samples per second
-#define ADS1015_DR_490SPS (0x0040) // 490 samples per second
-#define ADS1015_DR_920SPS (0x0060) // 920 samples per second
-#define ADS1015_DR_1600SPS (0x0080) // 1600 samples per second (default)
-#define ADS1015_DR_2400SPS (0x00A0) // 2400 samples per second
-#define ADS1015_DR_3300SPS (0x00C0) // 3300 samples per second
-
-/*=========================================================================*/
-
-namespace upm {
- /**
- * @library ads1x15
- * @sensor ADS1015
- * @comname ADS1015 ADC
- * @type electric
- * @man ti adafruit
- * @con i2c
- * @web web http://www.ti.com/lit/ds/symlink/ads1015.pdf
- *
- * @brief API for ADS1015
- *
- * The ADS1013, ADS1014, and ADS1015 are precision analog-to-digital converters (ADCs) with 12 bits of resolution
- * offered in an ultra-small, leadless QFN-10 package or an MSOP-10 package. The ADS1013/4/5 are designed with
- * precision, power, and ease of implementation in mind. The ADS1013/4/5 feature an onboard reference and oscillator.
- * Data is transferred via an I2C-compatible serial interface; four I2C slave addresses can be selected. The ADS1013/4/5
- * operate from a single power supply ranging from 2.0V to 5.5V.
- * The ADS1013/4/5 can perform conversions at rates up to 3300 samples per second (SPS). An onboard PGA is available
- * on the ADS1014 and ADS1015 that offers input ranges from the supply to as low as ±256mV, allowing both large and small
- * signals to be measured with high resolution. The ADS1015 also features an input multiplexer (MUX) that provides two
- * differential or four single-ended inputs.
- * The ADS1013/4/5 operate either in continuous conversion mode or a single-shot mode that automatically powers down
- * after a conversion and greatly reduces current consumption during idle periods. The ADS1013/4/5 are specified from
- * –40°C to +125°C.
- *
- * Tested with Adafriut ADS1015 board: https://www.adafruit.com/products/1083
- *
- * @image html ads1015.jpg
- * @snippet ads1x15.cxx Interesting
- */
- class ADS1015 : public ADS1X15 {
-
- public:
-
- /**
- * @enum ADSSAMPLERATE
- * @brief uint16_t enum containing values
- * representing the sample rate of the device.
- *
- * @var ADSSAMPLERATE::SPS_128 = 0x0000
- * @var ADSSAMPLERATE::SPS_250 = 0x0020
- * @var ADSSAMPLERATE::SPS_490 = 0x0040
- * @var ADSSAMPLERATE::SPS_920 = 0x0060
- * @var ADSSAMPLERATE::SPS_1600 = 0x0080
- * @var ADSSAMPLERATE::SPS_2400 = 0x00A0
- * @var ADSSAMPLERATE::SPS_3300 = 0x00C0
- */
- typedef enum ADSSAMPLERATE {
- SPS_128 = ADS1015_DR_128SPS,
- SPS_250 = ADS1015_DR_250SPS,
- SPS_490 = ADS1015_DR_490SPS,
- SPS_920 = ADS1015_DR_920SPS,
- SPS_1600 = ADS1015_DR_1600SPS,
- SPS_2400 = ADS1015_DR_2400SPS,
- SPS_3300 = ADS1015_DR_3300SPS
- } ADSSAMPLERATE;
-
-
- /**
- * ADS1X15 constructor
- *
- * @param bus i2c bus the sensor is attached to.
- * @param address. Device address. Default is 0x48.
- */
- ADS1015 (int bus, uint8_t address = 0x48);
-
- /**
- * ADS1X15 destructor
- */
- ~ADS1015 ();
-
- /**
- * Sets the sample rate of the device. This function
- * needs to be overridden in subclasses as the ADS1115 and
- * ADS1015 have different sample rates.
- *
- * @param ADSSAMPLERATE enum
- */
- void setSPS(ADSSAMPLERATE rate = SPS_1600);
-
- protected:
- float getMultiplier(void);
- void setDelay(void);
-
- };
-}
diff --git a/peripheral/libupm/src/ads1x15/ads1115.cxx b/peripheral/libupm/src/ads1x15/ads1115.cxx
deleted file mode 100644
index ee0dfda..0000000
--- a/peripheral/libupm/src/ads1x15/ads1115.cxx
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Author: Marc Graham <marc@m2ag.net>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#include "ads1115.h"
-
-using namespace upm;
-
-ADS1115::ADS1115(int bus, uint8_t address) : ADS1X15(bus, address) {
- m_name = "ADS1115";
- m_conversionDelay = ADS1115_CONVERSIONDELAY;
- m_bitShift = 0;
- ADS1X15::getCurrentConfig();
-}
-
-ADS1115::~ADS1115(){};
-
-void
-ADS1115::setSPS(ADSDATARATE rate){
- updateConfigRegister((m_config_reg & ~ADS1X15_DR_MASK) | rate);
-}
-
-//Protected functions
-float
-ADS1115::getMultiplier(void){
- float multi = 0.0;
- switch((ADSGAIN)m_config_reg & ADS1X15_PGA_MASK){
- case GAIN_TWOTHIRDS:
- multi = 0.0001875;
- break;
- case GAIN_ONE:
- multi = 0.000125;
- break;
- case GAIN_TWO:
- multi = 0.0000625;
- break;
- case GAIN_FOUR:
- multi = 0.00003125;
- break;
- case GAIN_EIGHT:
- multi = 0.000015625;
- break;
- case GAIN_SIXTEEN:
- multi = 0.0000078125;
- break;
- default:
- multi = 0.0001875;
- break;
- }
- return multi;
-}
-
-void
-ADS1115::setDelay(){
- switch((int)ADS1X15::getSPS()){
- case 0:
- m_conversionDelay = 126000;
- break;
- case 32:
- m_conversionDelay = 63000;
- break;
- case 64:
- m_conversionDelay = 32000;
- break;
- case 96:
- m_conversionDelay = 16000;
- break;
- case 128:
- m_conversionDelay = 8000;
- break;
- case 160:
- m_conversionDelay = 4500;
- break;
- case 192:
- m_conversionDelay = 2200;
- break;
- case 224:
- m_conversionDelay = 1200;
- break;
- default:
- m_conversionDelay = 126000;
- break;
- }
-}
diff --git a/peripheral/libupm/src/ads1x15/ads1115.h b/peripheral/libupm/src/ads1x15/ads1115.h
deleted file mode 100644
index 32c4b93..0000000
--- a/peripheral/libupm/src/ads1x15/ads1115.h
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Author: Marc Graham <marc@m2ag.net>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-/*=========================================================================*/
-
-#pragma once
-
-#include "ads1x15.h"
-
-
-
-/*=========================================================================
- CONVERSION DELAY (in microS)
- -----------------------------------------------------------------------*/
- #define ADS1115_CONVERSIONDELAY (8000)
-/*=========================================================================*/
-
-
-/*=========================================================================
- CONFIG REGISTER
-
- -----------------------------------------------------------------------*/
-
-#define ADS1115_DR_MASK (0x00E0)
-#define ADS1115_DR_8SPS (0x0000) // 8 samples per second
-#define ADS1115_DR_16SPS (0x0020) // 16 samples per second
-#define ADS1115_DR_32SPS (0x0040) // 32 samples per second
-#define ADS1115_DR_64SPS (0x0060) // 64 samples per second
-#define ADS1115_DR_128SPS (0x0080) // 128 samples per second (default)
-#define ADS1115_DR_250SPS (0x00A0) // 250 samples per second
-#define ADS1115_DR_475SPS (0x00C0) // 475 samples per second
-#define ADS1115_DR_860SPS (0x00E0) // 860 samples per second
-
-/*=========================================================================*/
-
-namespace upm {
- /**
- * @library ads1x15
- * @sensor ADS1115
- * @comname ADS1115 ADC
- * @type electric
- * @man ti adafruit
- * @con i2c
- * @web http://www.ti.com/lit/ds/symlink/ads1115.pdf
- *
- * @brief API for ADS1115
- *
- * The ADS1113, ADS1114, and ADS1115 are precision analog-to-digital converters (ADCs) with 16 bits of resolution offered
- * in an ultra-small, leadless QFN-10 package or an MSOP-10 package. The ADS1113/4/5 are designed with precision, power,
- * and ease of implementation in mind. The ADS1113/4/5 feature an onboard reference and oscillator. Data is transferred via
- * an I2C-compatible serial interface; four I2C slave addresses can be selected. The ADS1113/4/5 operate from a single power
- * supply ranging from 2.0V to 5.5V.
- * The ADS1113/4/5 can perform conversions at rates up to 860 samples per second (SPS). An onboard PGA is available on
- * the ADS1114 and ADS1115 that offers input ranges from the supply to as low as ±256mV, allowing both large and small
- * signals to be measured with high resolution. The ADS1115 also features an input multiplexer (MUX) that provides two
- * differential or four single-ended inputs.
- * The ADS1113/4/5 operate either in continuous conversion mode or a single-shot mode that automatically powers down after
- * a conversion and greatly reduces current consumption during idle periods. The ADS1113/4/5 are specified from –40°C to +125°C.
- *
- * Tested with DIYMall ADS1115 board. Also available from Adafruit: https://www.adafruit.com/products/1085
- *
- * @image html ads1115.jpg
- * @snippet ads1x15.cxx Interesting
- */
- class ADS1115 : public ADS1X15 {
-
- public:
-
- /**
- * @enum ADSSAMPLERATE
- * @brief uint16_t enum containing values
- * representing the sample rate of the device.
- *
- * @var ADSSAMPLERATE::SPS_8 = 0x0000
- * @var ADSSAMPLERATE::SPS_16 = 0x0020
- * @var ADSSAMPLERATE::SPS_32 = 0x0040
- * @var ADSSAMPLERATE::SPS_64 = 0x0060
- * @var ADSSAMPLERATE::SPS_128 = 0x0080
- * @var ADSSAMPLERATE::SPS_250 = 0x00A0
- * @var ADSSAMPLERATE::SPS_475 = 0x00C0
- * @var ADSSAMPLERATE::SPS_860 = 0x00E0
- */
- typedef enum ADSDATARATE
- {
- SPS_8 = ADS1115_DR_8SPS,
- SPS_16 = ADS1115_DR_16SPS,
- SPS_32 = ADS1115_DR_32SPS,
- SPS_64 = ADS1115_DR_64SPS,
- SPS_128 = ADS1115_DR_128SPS,
- SPS_250 = ADS1115_DR_250SPS,
- SPS_475 = ADS1115_DR_475SPS,
- SPS_860 = ADS1115_DR_860SPS
- } ADSDATARATE;
-
-
-
- /**
- * ADS1X15 constructor
- *
- * @param bus i2c bus the sensor is attached to.
- * @param address. Device address. Default is 0x48.
- */
- ADS1115 (int bus, uint8_t address = 0x48);
-
- /**
- * ADS1X15 destructor
- */
- ~ADS1115();
-
- /**
- * Sets the sample rate of the device. This function
- * needs to be overridden in subclasses as the ADS1115 and
- * ADS1015 have different sample rates.
- *
- * @param ADSSAMPLERATE enum
- */
- void setSPS(ADSDATARATE rate = ADS1115::SPS_128);
-
-
- protected:
- float getMultiplier(void);
- void setDelay(void);
-
- };
-}
diff --git a/peripheral/libupm/src/ads1x15/ads1x15.cxx b/peripheral/libupm/src/ads1x15/ads1x15.cxx
deleted file mode 100644
index 4a1ea9d..0000000
--- a/peripheral/libupm/src/ads1x15/ads1x15.cxx
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * Author: Marc Graham <marc@m2ag.net>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-#include "ads1x15.h"
-
-#include <unistd.h>
-
-using namespace upm;
-
-ADS1X15::ADS1X15(int bus, uint8_t address){
-
- if(!(i2c = new mraa::I2c(bus))){
- throw std::invalid_argument(std::string(__FUNCTION__) +": I2c.init() failed");
- return;
- }
-
- if((i2c->address(address) != mraa::SUCCESS)){
- throw std::invalid_argument(std::string(__FUNCTION__) + ": I2c.address() failed");
- return;
- }
-
- if(i2c->frequency( mraa::I2C_FAST) != mraa::SUCCESS){
- throw std::invalid_argument(std::string(__FUNCTION__) + ": I2c.frequency(I2C_FAST) failed");
- return;
- }
- //Will be reset by sub class.
- m_bitShift = 0;
- m_conversionDelay = .001;
- m_config_reg = 0x0000;
-}
-
-ADS1X15::~ADS1X15(){}
-
-float
-ADS1X15::getSample(ADSMUXMODE mode){
- updateConfigRegister((m_config_reg & ~ADS1X15_MUX_MASK) | mode, true);
- usleep(m_conversionDelay);
- return getLastSample();
-}
-
-float
-ADS1X15::getLastSample(int reg){
- uint16_t value = i2c->readWordReg(reg);
- bool neg = false;
- value = swapWord(value);
- if(value & 0x8000){
- neg = true;
- value = ~value;
- }
- if(m_name == "ADS1015") value = value >> m_bitShift;
- if(neg) return 0.0 - value * getMultiplier();
- else return value * getMultiplier();
-}
-
-void
-ADS1X15::setGain(ADSGAIN gain){
- updateConfigRegister((m_config_reg & ~ADS1X15_PGA_MASK) | gain);
-}
-
-void
-ADS1X15::setSPS(ADSSAMPLERATE rate){
- updateConfigRegister((m_config_reg & ~ADS1X15_DR_MASK) | rate);
-}
-
-void
-ADS1X15::setCompMode(bool mode){
- if(mode) updateConfigRegister((m_config_reg & ~ADS1X15_CMODE_MASK));
- else updateConfigRegister((m_config_reg & ~ADS1X15_CMODE_MASK) | ADS1X15_CMODE_WINDOW);
-}
-
-void
-ADS1X15::setCompPol(bool mode){
- if(!mode) updateConfigRegister((m_config_reg & ~ADS1X15_CPOL_MASK));
- else updateConfigRegister((m_config_reg & ~ADS1X15_CPOL_MASK) | ADS1X15_CPOL_ACTVHI);
-}
-
-void
-ADS1X15::setCompLatch(bool mode){
- if(mode) updateConfigRegister((m_config_reg & ~ADS1X15_CLAT_MASK));
- else updateConfigRegister((m_config_reg & ~ADS1X15_CLAT_MASK) | ADS1X15_CLAT_LATCH);
-}
-
-void
-ADS1X15::setCompQue(ADSCOMP mode){
- updateConfigRegister((m_config_reg & ~ADS1X15_CQUE_MASK) | mode);
-}
-
-void
-ADS1X15::setContinuous(bool mode){
- if(mode) updateConfigRegister((m_config_reg & ~ADS1X15_MODE_MASK));
- else updateConfigRegister((m_config_reg & ~ADS1X15_MODE_MASK) | ADS1X15_MODE_SINGLE);
-}
-
-float
-ADS1X15::getThresh(ADSTHRESH reg){
- if( THRESH_HIGH && THRESH_LOW) return getLastSample(reg);
- else return 0.0;
-}
-
-void
-ADS1X15::setThresh(ADSTHRESH reg, float value){
- uint16_t set_value;
- switch((int)reg){
- case 4: //set conversion_rdy operation
- if(i2c->writeWordReg(ADS1X15_REG_POINTER_LOWTHRESH, 0x0000) != mraa::SUCCESS){
- throw std::invalid_argument(std::string(__FUNCTION__) + ": I2c.write() failed");
- return;
- }
- if(i2c->writeWordReg(ADS1X15_REG_POINTER_HITHRESH, 0x0080) != mraa::SUCCESS){
- throw std::invalid_argument(std::string(__FUNCTION__) + ": I2c.write() failed");
- return;
- }
- break;
- case 2:
- case 3:
- set_value = value / getMultiplier();
- set_value = set_value << m_bitShift;
- if(i2c->writeWordReg(reg, swapWord(set_value)) != mraa::SUCCESS){
- throw std::invalid_argument(std::string(__FUNCTION__) + ": I2c.write() failed");
- return;
- }
- break;
- case 5: //set default
- default:
- if(i2c->writeWordReg(ADS1X15_REG_POINTER_LOWTHRESH, 0x0080) != mraa::SUCCESS){
- throw std::invalid_argument(std::string(__FUNCTION__) + ": I2c.write() failed");
- return;
- }
- if(i2c->writeWordReg(ADS1X15_REG_POINTER_HITHRESH, 0xF07F) != mraa::SUCCESS){
- throw std::invalid_argument(std::string(__FUNCTION__) + ": I2c.write() failed");
- return;
- }
- break;
- }
-}
-
-
-//Private functions
-void
-ADS1X15::getCurrentConfig(){
- m_config_reg = i2c->readWordReg(ADS1X15_REG_POINTER_CONFIG);
- m_config_reg = swapWord(m_config_reg);
- setDelay();
-}
-
-void
-ADS1X15::updateConfigRegister(uint16_t update, bool read){
- uint16_t temp = update;
- //Mask out read bit if we are just updating the configuration.
- if(!read) temp = update & 0x7FFF;
- if(i2c->writeWordReg(ADS1X15_REG_POINTER_CONFIG, swapWord(temp)) != mraa::SUCCESS){
- throw std::invalid_argument(std::string(__FUNCTION__) + ": I2c.write() failed");
- return;
- }
- //If we update the configuration re-set the in memory copy.
- if(!read) getCurrentConfig();
-}
-
-uint16_t
-ADS1X15::swapWord(uint16_t value){
- uint16_t res = value;
- return ((res & 0xFF) << 8) | ((res >> 8 ) & 0xFF);
-}
-
-
diff --git a/peripheral/libupm/src/ads1x15/ads1x15.h b/peripheral/libupm/src/ads1x15/ads1x15.h
deleted file mode 100644
index 8ff4fa3..0000000
--- a/peripheral/libupm/src/ads1x15/ads1x15.h
+++ /dev/null
@@ -1,424 +0,0 @@
-/*
- * Author: Marc Graham <marc@m2ag.net>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#pragma once
-
-#include <iostream>
-#include <string>
-#include "mraa.hpp"
-#include "mraa/i2c.hpp"
-
-/*=========================================================================
- I2C ADDRESS/BITS
- -----------------------------------------------------------------------*/
-#define ADS1X15_ADDRESS (0x48) // 1001 000 (ADDR = GND)
-/*=========================================================================*/
-
-
-/*=========================================================================
- POINTER REGISTER
- -----------------------------------------------------------------------*/
-#define ADS1X15_REG_POINTER_MASK (0x03)
-#define ADS1X15_REG_POINTER_CONVERT (0x00)
-#define ADS1X15_REG_POINTER_CONFIG (0x01)
-#define ADS1X15_REG_POINTER_LOWTHRESH (0x02)
-#define ADS1X15_REG_POINTER_HITHRESH (0x03)
-/*=========================================================================*/
-
-/*=========================================================================
- CONFIG REGISTER
-
- -----------------------------------------------------------------------*/
-#define ADS1X15_OS_MASK (0x8000)
-#define ADS1X15_OS_SINGLE (0x8000) // Write: Set to start a single-conversion
-#define ADS1X15_OS_BUSY (0x0000) // Read: Bit = 0 when conversion is in progress
-#define ADS1X15_OS_NOTBUSY (0x8000) // Read: Bit = 1 when device is not performing a conversion
-
-#define ADS1X15_MUX_MASK (0x7000)
-#define ADS1X15_MUX_DIFF_0_1 (0x0000) // Differential P = AIN0, N = AIN1 (default)
-#define ADS1X15_MUX_DIFF_0_3 (0x1000) // Differential P = AIN0, N = AIN3
-#define ADS1X15_MUX_DIFF_1_3 (0x2000) // Differential P = AIN1, N = AIN3
-#define ADS1X15_MUX_DIFF_2_3 (0x3000) // Differential P = AIN2, N = AIN3
-#define ADS1X15_MUX_SINGLE_0 (0x4000) // Single-ended AIN0
-#define ADS1X15_MUX_SINGLE_1 (0x5000) // Single-ended AIN1
-#define ADS1X15_MUX_SINGLE_2 (0x6000) // Single-ended AIN2
-#define ADS1X15_MUX_SINGLE_3 (0x7000) // Single-ended AIN3
-
-#define ADS1X15_PGA_MASK (0x0E00)
-#define ADS1X15_PGA_6_144V (0x0000) // +/-6.144V range = Gain 2/3
-#define ADS1X15_PGA_4_096V (0x0200) // +/-4.096V range = Gain 1
-#define ADS1X15_PGA_2_048V (0x0400) // +/-2.048V range = Gain 2 (default)
-#define ADS1X15_PGA_1_024V (0x0600) // +/-1.024V range = Gain 4
-#define ADS1X15_PGA_0_512V (0x0800) // +/-0.512V range = Gain 8
-#define ADS1X15_PGA_0_256V (0x0A00) // +/-0.256V range = Gain 16
-
-#define ADS1X15_MODE_MASK (0x0100)
-#define ADS1X15_MODE_CONTIN (0x0000) // Continuous conversion mode
-#define ADS1X15_MODE_SINGLE (0x0100) // Power-down single-shot mode (default)
-
-#define ADS1X15_DR_MASK (0x00E0)
-
-#define ADS1X15_CMODE_MASK (0x0010)
-#define ADS1X15_CMODE_TRAD (0x0000) // Traditional comparator with hysteresis (default)
-#define ADS1X15_CMODE_WINDOW (0x0010) // Window comparator
-
-#define ADS1X15_CPOL_MASK (0x0008)
-#define ADS1X15_CPOL_ACTVLOW (0x0000) // ALERT/RDY pin is low when active (default)
-#define ADS1X15_CPOL_ACTVHI (0x0008) // ALERT/RDY pin is high when active
-
-#define ADS1X15_CLAT_MASK (0x0400) // Determines if ALERT/RDY pin latches once asserted
-#define ADS1X15_CLAT_NONLAT (0x0000) // Non-latching comparator (default)
-#define ADS1X15_CLAT_LATCH (0x0400) // Latching comparator
-
-#define ADS1X15_CQUE_MASK (0x0003)
-/* This wouldn't compile for the python wrapper. with these in for some reason.
-#define ADS1X15_CQUE_1CONV (0x0000) // Assert ALERT/RDY after one conversions
-#define ADS1X15_CQUE_2CONV (0x0001) // Assert ALERT/RDY after two conversions
-#define ADS1X15_CQUE_4CONV (0x0002) // Assert ALERT/RDY after four conversions
-#define ADS1X15_CQUE_NONE (0x0003) // Disable the comparator and put ALERT/RDY in high state (default)
-*/
-/*=========================================================================*/
-
-namespace upm {
- /**
- * @brief ADS1X15 family adc library
- *
- * Library for TI analog to digital converter ic. Base clase fro ADS1X15 provides all the functionality that
- * ADS1115 and ADS1015 ics have in common.
- *
- * @defgroup ads1x15 libupm-ads1x15
- * @ingroup ti adafruit i2c electric
- */
- class ADS1X15 {
-
- public:
-
- /**
- * @enum ADSGAIN
- * @brief uint16_t enum containing values for
- * setting gain for ADS1X15 devices.
- *
- * @var ADSGAIN::TWOTHIRDS = 0x0000
- * @var ADSGAIN::ONE = 0x0200
- * @var ADSGAIN::TWO = 0x0400
- * @var ADSGAIN::FOUR = 0x0600
- * @var ADSGAIN::EIGHT = 0x0800
- * @var ADSGAIN::SIXTEEN = 0x0A00
- */
- typedef enum ADSGAIN {
- GAIN_TWOTHIRDS = ADS1X15_PGA_6_144V,
- GAIN_ONE = ADS1X15_PGA_4_096V,
- GAIN_TWO = ADS1X15_PGA_2_048V,
- GAIN_FOUR = ADS1X15_PGA_1_024V,
- GAIN_EIGHT = ADS1X15_PGA_0_512V,
- GAIN_SIXTEEN = ADS1X15_PGA_0_256V
- } ADSGAIN ;
-
- /**
- * @enum ADSMUXMODE
- * @brief uint16_t enum containing values used
- * for selecting ADS1X15 read operations.
- *
- * @var ADSMUXMODE::DIFF_0_1 = 0x0000
- * @var ADSMUXMODE::DIFF_0_2 = 0x1000
- * @var ADSMUXMODE::DIFF_1_3 = 0x2000
- * @var ADSMUXMODE::DIFF_2_3 = 0x3000
- * @var ADSMUXMODE::SINGLE_0 = 0x4000
- * @var ADSMUXMODE::SINGLE_1 = 0x5000
- * @var ADSMUXMODE::SINGLE_2 = 0x6000
- * @var ADSMUXMODE::SINGLE_3 = 0x7000
- */
- typedef enum ADSMUXMODE {
- DIFF_0_1 = ADS1X15_MUX_DIFF_0_1, // Differential P = AIN0, N = AIN1 (default)
- DIFF_0_3 = ADS1X15_MUX_DIFF_0_3, // Differential P = AIN0, N = AIN3
- DIFF_1_3 = ADS1X15_MUX_DIFF_1_3, // Differential P = AIN1, N = AIN3
- DIFF_2_3 = ADS1X15_MUX_DIFF_2_3, // Differential P = AIN2, N = AIN3
- SINGLE_0 = ADS1X15_MUX_SINGLE_0, // Single-ended AIN0
- SINGLE_1 = ADS1X15_MUX_SINGLE_1, // Single-ended AIN1
- SINGLE_2 = ADS1X15_MUX_SINGLE_2, // Single-ended AIN2
- SINGLE_3 = ADS1X15_MUX_SINGLE_3 // Single-ended AIN3
- } ADSMUXMODE;
-
- /**
- * @enum ADSCOMP
- * @brief uint16_t enum containing values
- * for setting ADS1X15 comparator queue modes.
- *
- * @var ADSCOMP::CQUE_1CONV = 0x0000
- * @var ADSCOMP::CQUE_2CONV = 0x0001
- * @var ADSCOMP::CQUE_3CONV = 0x0002
- * @var ADSCOMP::CQUE_NONE = 0x0003
- */
- typedef enum ADSCOMP {
- CQUE_1CONV = 0x0000, // Assert ALERT/RDY after one conversions
- CQUE_2CONV = 0x0001, // Assert ALERT/RDY after two conversions
- CQUE_4CONV = 0x0002, // Assert ALERT/RDY after four conversions
- CQUE_NONE = 0x0003 // Disable the comparator and put ALERT/RDY in high state (default)
- } ADSCOMP;
-
- /**
- * @enum ADSTHRESH
- * @brief uint8_t enum containing register addresses
- * used for setting HI and LOW threshold values as
- * well as setting conversion ready and set to default.
- *
- * @var ADSTHRESH::THRESH_LOW = 0x02
- * @var ADSTHRESH::THRESH_HIGH = 0x03
- * @var ADSTHRESH::CONVERSION_RDY = 0x04
- * @var ADSTHRESH::THRESH_DEFAULT = 0x05
- */
- typedef enum ADSTHRESH {
- THRESH_LOW = ADS1X15_REG_POINTER_LOWTHRESH,
- THRESH_HIGH = ADS1X15_REG_POINTER_HITHRESH,
- CONVERSION_RDY = 0x04,
- THRESH_DEFAULT = 0x05
-
- } ADSTHRESH;
-
- /**
- * @enum ADSSAMPLERATE
- * @brief uint16_t enum containing values
- * representing the sample rate of the device.
- * Will be overridden in subclass
- *
- * @var ADSSAMPLERATE::SPS_DEFAULT = 0x0080
- */
- typedef enum ADSSAMPLERATE {
- SPS_DEFAULT = 0x0080
- } ADSSAMPLERATE;
-
- /**
- * ADS1X15 constructor
- *
- * @param bus i2c bus the sensor is attached to.
- * @param address. Device address. Default is 0x48.
- */
- ADS1X15(int bus, uint8_t address);
-
- /**
- * ADS1X15 destructor
- */
- virtual ~ADS1X15 ();
-
- /**
- * Returns the name of the sensor
- */
- std::string name()
- {
- return m_name;
- }
-
- /**
- * Returns the contents of conversion register without performing
- * a conversion operation. Will use a multiplier based on the
- * current gain setting to give the voltage as a float. Used
- * internally to return the HI and LOW threshold values.
- *
- * @param reg uint8_t value specifying register to read.
- * Should generally be called with no parameter.
- */
- float getLastSample(int reg = ADS1X15_REG_POINTER_CONVERT);
-
- /**
- * Performs a read as specified by ADS1X15::ADSMUXMOE and
- * returns the value as a float. Uses getLastSample() internally
- * to return voltage value.
- *
- * @pram mode ADSMUXMODE specifying inputs to be sampled.
- */
- float getSample(ADSMUXMODE mode = ADS1X15::DIFF_0_1);
-
- /**
- * Returns the current gain setting being used by the device
- * as an ADSGAIN value.
- */
- ADSGAIN getGain(){
- return (ADSGAIN)(m_config_reg & ADS1X15_PGA_MASK);
- }
-
- /**
- * Sets the PGA gain bits to the desired gain. Default
- * is +/- 2.094 volts.
- *
- * @param gain ADSGAIN value reprenting the desired gain.
- * See warnings in spec sheet.
- */
- void setGain(ADSGAIN gain = ADS1X15::GAIN_TWO);
-
- /**
- * Returns the current device sample rate a an ADSSAMPLERATE
- * value.
- */
- ADSSAMPLERATE getSPS(void){
- return (ADSSAMPLERATE)(m_config_reg & ADS1X15_DR_MASK);
- }
-
- /**
- * Sets the sample rate of the device. This function
- * needs to be overrode in subclasses as the ADS1115 and
- * ADS1015 have different data rates.
- *
- * @param ADSSAMPLERATE enum
- * SPS_DEFAULT = 0x0080
- */
- virtual void setSPS(ADSSAMPLERATE rate);
-
- /**
- * Returns the comparator mode.
- * False = Traditional comparator with Hysteresis (default)
- * True = Window Comparator
- */
- bool getCompMode(void){
- return (bool)(m_config_reg & ADS1X15_CMODE_MASK);
- }
-
- /**
- * Sets the comparator mode of the device.
- *
- * @param mode bool value denoting mode.
- * False = Traditional comparator with Hysteresis (default)
- * True = Window Comparator
- */
- void setCompMode(bool mode = false);
-
- /**
- * Get comparator polarity. Reports the polarity
- * of the ALERT/RDY pin. Returns:
- * False = Active Low (default)
- * True = Active High
- */
- bool getCompPol(void){
- return (bool)(m_config_reg & ADS1X15_CPOL_MASK);
- }
-
- /**
- * Sets the comparator polarity. Controls the
- * polarity of the ALERT/RDY pin.
- *
- * @param mode bool.
- * False = Active Low (default)
- * True = Active High
- */
- void setCompPol(bool mode = false);
-
- /**
- * Returns bool representing the state of the
- * comparator latching functionality.
- * False = Non Latching comparator (default)
- * True = Latching Comparator
- */
- bool getCompLatch(void){
- return (bool)(m_config_reg & ADS1X15_CLAT_MASK);
- }
-
- /**
- * Sets bit controlling comparator operation.
- *
- * @param mode bool
- * False = Non Latching comparator (default)
- * True = Latching Comparator
- */
- void setCompLatch(bool mode = false);
-
- /**
- * Returns ADSCOMP value representing the state of
- * comparator queue.
- *
- * CQUE_1CONV = Assert after one conversion
- * CQUE_2CONV = Assert after two conversions
- * CQUE_2CONV = Assert after four conversions
- * CQUE_NONE = Disable comparator (default)
- */
- ADSCOMP getCompQue(void){
- return (ADSCOMP)(m_config_reg & ADS1X15_CQUE_MASK);
- }
-
- /**
- * Sets bits controlling Comparator queue operation.
- *
- * @param mode ADSCOMP enum.
- * CQUE_1CONV = Assert after one conversion
- * CQUE_2CONV = Assert after two conversions
- * CQUE_2CONV = Assert after four conversions
- * CQUE_NONE = Disable comparator (default)
- */
- void setCompQue(ADSCOMP mode = ADS1X15::CQUE_NONE);
-
- /**
- * Returns bool reflecting state of device mode bit.
- *
- * False = Power Down Single shot mode (default)
- * True = Continuous conversion mode
- */
- bool getContinuous(void){
- return !(bool)(m_config_reg & ADS1X15_MODE_MASK);
- }
-
- /**
- * Sets the state of device mode but.
- *
- * @param mode bool
- * False = Power Down Single shot mode (default)
- * True = Continuous conversion mode
- */
- void setContinuous(bool mode = false);
-
- /**
- * Returns current high or low threshold setting.
- *
- * @param reg ADSTHRES enum value.
- * Returns 0.0 unless THRESH_HIGH or THRESH_LOW requested.
- */
- float getThresh(ADSTHRESH reg = THRESH_LOW);
-
- /**
- * Sets threshold levels or configures for conversion ready
- * operation of ALERT/RDY output.
- *
- * @param reg ADSTHRESH enum
- * @param value float value to set threshold register to.
- *
- * THRESH_LOW = Sets low thresh register.
- * THRESH_HIGH = Sets high thresh register.
- * CONVERSION_RDY = Configures conversion ready operation
- * THRESH_DEFAULT = resets high/low registers to startup values.
- */
- void setThresh(ADSTHRESH reg = THRESH_DEFAULT , float value = 0.0);
-
- protected:
- std::string m_name;
- float m_conversionDelay;
- uint8_t m_bitShift;
- uint16_t m_config_reg;
- //Must be overridden in subclass for proper values.
- virtual float getMultiplier(void) = 0;
- //Must be overridden in subclass for proper values.
- virtual void setDelay(void) = 0;
- void getCurrentConfig();
- void updateConfigRegister(uint16_t update, bool read = false);
- uint16_t swapWord(uint16_t value);
-
- mraa::I2c* i2c;
-
- };}
diff --git a/peripheral/libupm/src/ads1x15/javaupm_ads1x15.i b/peripheral/libupm/src/ads1x15/javaupm_ads1x15.i
deleted file mode 100644
index 88522e3..0000000
--- a/peripheral/libupm/src/ads1x15/javaupm_ads1x15.i
+++ /dev/null
@@ -1,26 +0,0 @@
-%module javaupm_ads1x15
-%include "../upm.i"
-%include "typemaps.i"
-
-%{
- #include "ads1x15.h"
- #include "ads1015.h"
- #include "ads1115.h"
-%}
-
-%include "ads1x15.h"
-%include "ads1015.h"
-%include "ads1115.h"
-
-
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_ads1x15");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/ads1x15/jsupm_ads1x15.i b/peripheral/libupm/src/ads1x15/jsupm_ads1x15.i
deleted file mode 100644
index 11a00e7..0000000
--- a/peripheral/libupm/src/ads1x15/jsupm_ads1x15.i
+++ /dev/null
@@ -1,17 +0,0 @@
-%module jsupm_ads1x15
-%include "../upm.i"
-
-%include "ads1x15.h"
-%{
- #include "ads1x15.h"
-%}
-
-%include "ads1015.h"
-%{
- #include "ads1015.h"
-%}
-
-%include "ads1115.h"
-%{
- #include "ads1115.h"
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/ads1x15/pyupm_ads1x15.i b/peripheral/libupm/src/ads1x15/pyupm_ads1x15.i
deleted file mode 100644
index dc17d1a..0000000
--- a/peripheral/libupm/src/ads1x15/pyupm_ads1x15.i
+++ /dev/null
@@ -1,21 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_ads1x15
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "ads1x15.h"
-%{
- #include "ads1x15.h"
-%}
-
-%include "ads1015.h"
-%{
- #include "ads1015.h"
-%}
-
-%include "ads1115.h"
-%{
- #include "ads1115.h"
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/adxl335/CMakeLists.txt b/peripheral/libupm/src/adxl335/CMakeLists.txt
deleted file mode 100644
index 0260767..0000000
--- a/peripheral/libupm/src/adxl335/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "adxl335")
-set (libdescription "upm adxl335 grove 3-axis anaolog accelerometer")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/adxl335/adxl335.cxx b/peripheral/libupm/src/adxl335/adxl335.cxx
deleted file mode 100644
index de6f1b9..0000000
--- a/peripheral/libupm/src/adxl335/adxl335.cxx
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Adapted from the seeedstudio example
- * https://github.com/Seeed-Studio/Accelerometer_ADXL335
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <string>
-#include <stdexcept>
-
-#include "adxl335.h"
-
-using namespace std;
-using namespace upm;
-
-ADXL335::ADXL335(int pinX, int pinY, int pinZ, float aref)
-{
- m_aref = aref;
- m_zeroX = 0.0;
- m_zeroY = 0.0;
- m_zeroZ = 0.0;
-
- if ( !(m_aioX = mraa_aio_init(pinX)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_aio_init(X) failed, invalid pin?");
- return;
- }
-
- if ( !(m_aioY = mraa_aio_init(pinY)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_aio_init(Y) failed, invalid pin?");
- return;
- }
-
- if ( !(m_aioZ = mraa_aio_init(pinZ)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_aio_init(Z) failed, invalid pin?");
- return;
- }
-}
-
-ADXL335::~ADXL335()
-{
- mraa_aio_close(m_aioX);
- mraa_aio_close(m_aioY);
- mraa_aio_close(m_aioZ);
-}
-
-void ADXL335::values(int *xVal, int *yVal, int *zVal)
-{
- *xVal = mraa_aio_read(m_aioX);
- *yVal = mraa_aio_read(m_aioY);
- *zVal = mraa_aio_read(m_aioZ);
-}
-
-#ifdef SWIGJAVA
-int *ADXL335::values()
-{
- int *v = new int[3];
- values(&v[0], &v[1], &v[2]);
- return v;
-}
-#endif
-
-void ADXL335::acceleration(float *xAccel, float *yAccel, float *zAccel)
-{
- int x, y, z;
- float xVolts, yVolts, zVolts;
-
- values(&x, &y, &z);
- xVolts = float(x) * m_aref / 1024.0;
- yVolts = float(y) * m_aref / 1024.0;
- zVolts = float(z) * m_aref / 1024.0;
-
- *xAccel = (xVolts - m_zeroX) / ADXL335_SENSITIVITY;
- *yAccel = (yVolts - m_zeroY) / ADXL335_SENSITIVITY;
- *zAccel = (zVolts - m_zeroZ) / ADXL335_SENSITIVITY;
-}
-
-#ifdef SWIGJAVA
-float *ADXL335::acceleration()
-{
- float *v = new float[3];
- acceleration(&v[0], &v[1], &v[2]);
- return v;
-}
-#endif
-
-void ADXL335::calibrate()
-{
- // make sure the sensor is still before running calibration.
-
- int x, y, z;
- usleep(10000);
-
- values(&x, &y, &z);
-
- setZeroX(float(x) * m_aref / 1024.0);
- setZeroY(float(y) * m_aref / 1024.0);
- setZeroZ(float(z) * m_aref / 1024.0);
-}
diff --git a/peripheral/libupm/src/adxl335/adxl335.h b/peripheral/libupm/src/adxl335/adxl335.h
deleted file mode 100644
index e7671da..0000000
--- a/peripheral/libupm/src/adxl335/adxl335.h
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Adapted from the seeedstudio example
- * https://github.com/Seeed-Studio/Accelerometer_ADXL335
- *
- * 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 <string>
-#include <mraa/aio.h>
-
-#define ADXL335_DEFAULT_AREF 5.0
-#define ADXL335_SENSITIVITY 0.25 // 0.25v/g
-
-namespace upm {
-
- /**
- * @brief ADXL335 Accelerometer library
- * @defgroup adxl335 libupm-adxl335
- * @ingroup seeed analog accelerometer
- */
-
- /**
- * @library adxl335
- * @sensor adxl335
- * @comname ADXL335 3-Axis Analog Accelerometer
- * @altname Grove 3-Axis Analog Accelerometer
- * @type accelerometer
- * @man seeed
- * @con analog
- *
- * @brief API for the ADXL335 3-Axis Analog Accelerometer
- *
- * UPM module for the ADXL335 3-axis analog accelerometer. This
- * was tested on a Grove 3-axis Analog Accelerometer. It uses 3
- * analog pins, one for each axis: X, Y, and Z.
- *
- * @image html adxl335.jpg
- * @snippet adxl335.cxx Interesting
- */
- class ADXL335 {
- public:
- /**
- * ADXL335 constructor
- *
- * @param pinX Analog pin to use for X-axis
- * @param pinY Analog pin to use for Y-axis
- * @param pinZ Analog pin to use for Z-axis
- * @param aref Analog reference voltage; default is 5.0v
- */
- ADXL335(int pinX, int pinY, int pinZ, float aref=ADXL335_DEFAULT_AREF);
-
- /**
- * ADXL335 destructor
- */
- ~ADXL335();
-
- /**
- * Sets the "zero" value of the X-axis, determined through calibration
- *
- * @param zeroX "Zero" value of the X-axis
- */
- void setZeroX(float zeroX) { m_zeroX = zeroX; };
-
- /**
- * Sets the "zero" value of the Y-axis, determined through calibration
- *
- * @param zeroY "Zero" value of the Y-axis
- */
- void setZeroY(float zeroY) { m_zeroY = zeroY; };
-
- /**
- * Sets the "zero" value of the Z-axis, determined through calibration
- *
- * @param zeroZ "Zero" value of the Z-axis
- */
- void setZeroZ(float zeroZ) { m_zeroZ = zeroZ; };
-
- /**
- * Gets the analog values for the 3 axes
- *
- * @param xVal Pointer to the returned X-axis value
- * @param yVal Pointer to the returned Y-axis value
- * @param zVal Pointer to the returned Z-axis value
- */
- void values(int *xVal, int *yVal, int *zVal);
-
-#ifdef SWIGJAVA
- /**
- * Gets the analog values for the 3 axes
- *
- * @return Array containing value of X, Y, Z axes
- */
- int *values();
-#endif
-
- /**
- * Gets the acceleration along all 3 axes
- *
- * @param xAccel Pointer to returned X-axis value
- * @param yAccel Pointer to returned Y-axis value
- * @param zAccel Pointer to returned Z-axis value
- */
- void acceleration(float *xAccel, float *yAccel, float *zAccel);
-
-#ifdef SWIGJAVA
- /**
- * Gets the acceleration along all 3 axes
- *
- * @return Array containing acceleration on X, Y, Z axes
- */
- float *acceleration();
-#endif
-
- /**
- * While the sensor is still, measures the X-axis, Y-axis, and Z-axis
- * values and uses those values as the zero values.
- */
- void calibrate();
-
- private:
- mraa_aio_context m_aioX;
- mraa_aio_context m_aioY;
- mraa_aio_context m_aioZ;
- float m_aref;
- float m_zeroX, m_zeroY, m_zeroZ;
- };
-}
-
-
diff --git a/peripheral/libupm/src/adxl335/javaupm_adxl335.i b/peripheral/libupm/src/adxl335/javaupm_adxl335.i
deleted file mode 100644
index 2624571..0000000
--- a/peripheral/libupm/src/adxl335/javaupm_adxl335.i
+++ /dev/null
@@ -1,54 +0,0 @@
-%module javaupm_adxl335
-%include "../upm.i"
-%include "cpointer.i"
-%include "typemaps.i"
-
-%apply int *OUTPUT { int *xVal, int *yVal, int *zVal };
-%apply float *OUTPUT { float *xAccel, float *yAccel, float *zAccel };
-
-%{
- #include "adxl335.h"
-%}
-
-%typemap(jni) float* "jfloatArray"
-%typemap(jstype) float* "float[]"
-%typemap(jtype) float* "float[]"
-
-%typemap(javaout) float* {
- return $jnicall;
-}
-
-%typemap(out) float *acceleration {
- $result = JCALL1(NewFloatArray, jenv, 3);
- JCALL4(SetFloatArrayRegion, jenv, $result, 0, 3, $1);
-}
-
-%typemap(jni) int* "jintArray"
-%typemap(jstype) int* "int[]"
-%typemap(jtype) int* "int[]"
-
-%typemap(javaout) int* {
- return $jnicall;
-}
-
-%typemap(out) int *values {
- $result = JCALL1(NewIntArray, jenv, 3);
- JCALL4(SetIntArrayRegion, jenv, $result, 0, 3, (const signed int*)$1);
- delete [] $1;
-}
-
-%ignore values(int *, int *, int *);
-%ignore acceleration(float *, float *, float *);
-
-%include "adxl335.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_adxl335");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/adxl335/jsupm_adxl335.i b/peripheral/libupm/src/adxl335/jsupm_adxl335.i
deleted file mode 100644
index 452204c..0000000
--- a/peripheral/libupm/src/adxl335/jsupm_adxl335.i
+++ /dev/null
@@ -1,12 +0,0 @@
-%module jsupm_adxl335
-%include "../upm.i"
-%include "cpointer.i"
-
-%pointer_functions(int, intPointer);
-%pointer_functions(float, floatPointer);
-
-%{
- #include "adxl335.h"
-%}
-
-%include "adxl335.h"
diff --git a/peripheral/libupm/src/adxl335/pyupm_adxl335.i b/peripheral/libupm/src/adxl335/pyupm_adxl335.i
deleted file mode 100644
index ea4f240..0000000
--- a/peripheral/libupm/src/adxl335/pyupm_adxl335.i
+++ /dev/null
@@ -1,15 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_adxl335
-%include "../upm.i"
-%include "cpointer.i"
-
-%pointer_functions(int, intPointer);
-%pointer_functions(float, floatPointer);
-
-%feature("autodoc", "3");
-
-%include "adxl335.h"
-%{
- #include "adxl335.h"
-%}
diff --git a/peripheral/libupm/src/adxl345/CMakeLists.txt b/peripheral/libupm/src/adxl345/CMakeLists.txt
deleted file mode 100644
index 9f19228..0000000
--- a/peripheral/libupm/src/adxl345/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "adxl345")
-set (libdescription "libupm Digital Accelerometer")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/adxl345/adxl345.cxx b/peripheral/libupm/src/adxl345/adxl345.cxx
deleted file mode 100644
index 3503d64..0000000
--- a/peripheral/libupm/src/adxl345/adxl345.cxx
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * Author: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <string>
-#include <stdexcept>
-#include <unistd.h>
-#include "math.h"
-#include "adxl345.h"
-
-#define READ_BUFFER_LENGTH 6
-
-//address and id
-#define ADXL345_I2C_ADDR 0x53
-#define ADXL345_ID 0x00
-
-//control registers
-#define ADXL345_OFSX 0x1E
-#define ADXL345_OFSY 0x1F
-#define ADXL345_OFSZ 0x20
-#define ADXL345_TAP_THRESH 0x1D
-#define ADXL345_TAP_DUR 0x21
-#define ADXL345_TAP_LATENCY 0x22
-#define ADXL345_ACT_THRESH 0x24
-#define ADXL345_INACT_THRESH 0x25
-#define ADXL345_INACT_TIME 0x26
-#define ADXL345_INACT_ACT_CTL 0x27
-#define ADXL345_FALL_THRESH 0x28
-#define ADXL345_FALL_TIME 0x29
-#define ADXL345_TAP_AXES 0x2A
-#define ADXL345_ACT_TAP_STATUS 0x2B
-
-//interrupt registers
-#define ADXL345_INT_ENABLE 0x2E
-#define ADXL345_INT_MAP 0x2F
-#define ADXL345_INT_SOURCE 0x30
-
-//data registers (read only)
-#define ADXL345_XOUT_L 0x32
-#define ADXL345_XOUT_H 0x33
-#define ADXL345_YOUT_L 0x34
-#define ADXL345_YOUT_H 0x35
-#define ADXL345_ZOUT_L 0x36
-#define ADXL345_ZOUT_H 0x37
-#define DATA_REG_SIZE 6
-
-//data and power management
-#define ADXL345_BW_RATE 0x2C
-#define ADXL345_POWER_CTL 0x2D
-#define ADXL345_DATA_FORMAT 0x31
-#define ADXL345_FIFO_CTL 0x38
-#define ADXL345_FIFO_STATUS 0x39
-
-//useful values
-#define ADXL345_POWER_ON 0x08
-#define ADXL345_AUTO_SLP 0x30
-#define ADXL345_STANDBY 0x00
-
-//scales and resolution
-#define ADXL345_FULL_RES 0x08
-#define ADXL345_10BIT 0x00
-#define ADXL345_2G 0x00
-#define ADXL345_4G 0x01
-#define ADXL345_8G 0x02
-#define ADXL345_16G 0x03
-
-using namespace upm;
-
-Adxl345::Adxl345(int bus) : m_i2c(bus)
-{
- //init bus and reset chip
- if ( m_i2c.address(ADXL345_I2C_ADDR) != mraa::SUCCESS ){
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": i2c.address() failed");
- return;
- }
-
- m_buffer[0] = ADXL345_POWER_CTL;
- m_buffer[1] = ADXL345_POWER_ON;
- if( m_i2c.write(m_buffer, 2) != mraa::SUCCESS){
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": i2c.write() control register failed");
- return;
- }
-
- if ( m_i2c.address(ADXL345_I2C_ADDR) != mraa::SUCCESS ){
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": i2c.address() failed");
- return;
- }
-
- m_buffer[0] = ADXL345_DATA_FORMAT;
- m_buffer[1] = ADXL345_16G | ADXL345_FULL_RES;
- if( m_i2c.write(m_buffer, 2) != mraa::SUCCESS){
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": i2c.write() mode register failed");
- return;
- }
-
- //2.5V sensitivity is 256 LSB/g = 0.00390625 g/bit
- //3.3V x and y sensitivity is 265 LSB/g = 0.003773584 g/bit, z is the same
-
- m_offsets[0] = 0.003773584;
- m_offsets[1] = 0.003773584;
- m_offsets[2] = 0.00390625;
-
- Adxl345::update();
-}
-
-float*
-Adxl345::getAcceleration()
-{
- for(int i = 0; i < 3; i++){
- m_accel[i] = m_rawaccel[i] * m_offsets[i];
- }
- return &m_accel[0];
-}
-
-int16_t*
-Adxl345::getRawValues()
-{
- return &m_rawaccel[0];
-}
-
-uint8_t
-Adxl345::getScale(){
-
- uint8_t result;
-
- m_i2c.address(ADXL345_I2C_ADDR);
- m_i2c.writeByte(ADXL345_DATA_FORMAT);
-
- m_i2c.address(ADXL345_I2C_ADDR);
- result = m_i2c.readByte();
-
- return pow(2, (result & 0x03) + 1);
-}
-
-mraa::Result
-Adxl345::update(void)
-{
- m_i2c.address(ADXL345_I2C_ADDR);
- m_i2c.writeByte(ADXL345_XOUT_L);
-
- m_i2c.address(ADXL345_I2C_ADDR);
- m_i2c.read(m_buffer, DATA_REG_SIZE);
-
- // x
- m_rawaccel[0] = ((m_buffer[1] << 8 ) | m_buffer[0]);
- // y
- m_rawaccel[1] = ((m_buffer[3] << 8 ) | m_buffer[2]);
- // z
- m_rawaccel[2] = ((m_buffer[5] << 8 ) | m_buffer[4]);
-
- return mraa::SUCCESS;
-}
diff --git a/peripheral/libupm/src/adxl345/adxl345.h b/peripheral/libupm/src/adxl345/adxl345.h
deleted file mode 100644
index 7d35f23..0000000
--- a/peripheral/libupm/src/adxl345/adxl345.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Author: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <mraa/i2c.hpp>
-
-#define READ_BUFFER_LENGTH 6
-
-namespace upm {
-
-/**
- * @brief ADXL345 Accelerometer library
- * @defgroup adxl345 libupm-adxl345
- * @ingroup seeed i2c accelerometer
- */
-
-/**
- * @library adxl345
- * @sensor adxl345
- * @comname ADXL345 3-Axis Digital Accelerometer
- * @altname Grove 3-Axis Digital Accelerometer (16g)
- * @type accelerometer
- * @man seeed
- * @con i2c
- *
- * @brief API for the ADXL345 3-Axis Digital Accelerometer
- *
- * ADXL345 is a 3-axis digital accelerometer.
- * (http://www.seeedstudio.com/wiki/images/2/2c/ADXL345_datasheet.pdf)
- * The sensor has configurable resolutions to measure ±2g, ±4g, ±8g, or ±16g.
- * Note: The Grove* version of the sensor is incompatible with and not detected
- * on the I2C bus by the Intel(R) Edison using an Arduino* breakout board at 5V
- * (3V works fine).
- *
- * @image html adxl345.jpeg
- * @snippet adxl345.cxx Interesting
- */
-class Adxl345 {
-public:
- /**
- * Creates an ADXL345 object
- *
- * @param bus Number of the used I2C bus
- */
- Adxl345(int bus);
-
- /**
- * there is no need for a ADXL345 object destructor
- * ~Adxl345();
- */
-
- /**
- * Returns a pointer to a float[3] that contains acceleration (g) forces
- *
- * @return float* to a float[3]
- */
- float* getAcceleration();
-
- /**
- * Returns a pointer to an int[3] that contains the raw register values
- * for X, Y, and Z
- *
- * @return int* to an int[3]
- */
- int16_t* getRawValues();
-
- /**
- * Returns the scale the accelerometer is currently set up to: 2, 4, 8,
- * or 16
- *
- * @return uint with the current scale value
- */
- uint8_t getScale();
-
- /**
- * Updates the acceleration values from the I2C bus
- *
- * @return 0 if successful
- */
- mraa::Result update();
-private:
- float m_accel[3];
- float m_offsets[3];
- int16_t m_rawaccel[3];
- uint8_t m_buffer[READ_BUFFER_LENGTH];
- mraa::I2c m_i2c;
-};
-
-}
diff --git a/peripheral/libupm/src/adxl345/javaupm_adxl345.i b/peripheral/libupm/src/adxl345/javaupm_adxl345.i
deleted file mode 100644
index 9b759b4..0000000
--- a/peripheral/libupm/src/adxl345/javaupm_adxl345.i
+++ /dev/null
@@ -1,47 +0,0 @@
-%module javaupm_adxl345
-%include "../upm.i"
-
-%{
- #include "adxl345.h"
-%}
-
-%typemap(jni) float* "jfloatArray"
-%typemap(jstype) float* "float[]"
-%typemap(jtype) float* "float[]"
-
-%typemap(javaout) float* {
- return $jnicall;
-}
-
-%typemap(out) float * {
- $result = JCALL1(NewFloatArray, jenv, 3);
- JCALL4(SetFloatArrayRegion, jenv, $result, 0, 3, $1);
-}
-
-
-%typemap(jni) int16_t* "jshortArray"
-%typemap(jstype) int16_t* "short[]"
-%typemap(jtype) int16_t* "short[]"
-
-%typemap(javaout) int16_t* {
- return $jnicall;
-}
-
-%typemap(out) int16_t *getRawValues {
- $result = JCALL1(NewShortArray, jenv, 3);
- JCALL4(SetShortArrayRegion, jenv, $result, 0, 3, (jshort*)$1);
- delete [] $1;
-}
-
-%include "adxl345.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_adxl345");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/adxl345/jsupm_adxl345.i b/peripheral/libupm/src/adxl345/jsupm_adxl345.i
deleted file mode 100644
index 6f72b79..0000000
--- a/peripheral/libupm/src/adxl345/jsupm_adxl345.i
+++ /dev/null
@@ -1,20 +0,0 @@
-%module jsupm_adxl345
-%include "../upm.i"
-%include "../carrays_int16_t.i"
-%include "../carrays_float.i"
-
-%{
- #include "adxl345.h"
-%}
-
-%typemap(out) int16_t * {
- $result = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_int16Array, 0 | 0 );
-}
-
-%typemap(out) float * {
- $result = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_floatArray, 0 | 0 );
-}
-
-%include "adxl345.h"
-
-%include <carrays.i>
diff --git a/peripheral/libupm/src/adxl345/pyupm_adxl345.i b/peripheral/libupm/src/adxl345/pyupm_adxl345.i
deleted file mode 100644
index b3c5300..0000000
--- a/peripheral/libupm/src/adxl345/pyupm_adxl345.i
+++ /dev/null
@@ -1,25 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_adxl345
-%include "../upm.i"
-%include "../carrays_int16_t.i"
-%include "../carrays_float.i"
-
-%typemap(out) int16_t * {
- $result = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_int16Array, 0 | 0 );
-}
-
-%typemap(out) float * {
- $result = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_floatArray, 0 | 0 );
-}
-
-%feature("autodoc", "3");
-
-#ifdef DOXYGEN
-%include "adxl345_doc.i"
-#endif
-
-%include "adxl345.h"
-%{
- #include "adxl345.h"
-%}
diff --git a/peripheral/libupm/src/adxrs610/CMakeLists.txt b/peripheral/libupm/src/adxrs610/CMakeLists.txt
deleted file mode 100644
index eb349f8..0000000
--- a/peripheral/libupm/src/adxrs610/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "adxrs610")
-set (libdescription "upm ADXRS610 gyroscope")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/adxrs610/adxrs610.cxx b/peripheral/libupm/src/adxrs610/adxrs610.cxx
deleted file mode 100644
index 8d48928..0000000
--- a/peripheral/libupm/src/adxrs610/adxrs610.cxx
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-
-#include "adxrs610.h"
-
-using namespace std;
-using namespace upm;
-
-ADXRS610::ADXRS610(int dPin, int tPin, float aref) :
- m_aioData(dPin), m_aioTemp(tPin)
-{
- // ADC resolution of data and temp should be the same...
- m_aRes = (1 << m_aioData.getBit());
- m_aref = aref;
-
- setZeroPoint(calibrateZeroPoint());
- setDeadband(0.0);
-
- m_centerVolts = aref / 2.0;
-
-}
-
-ADXRS610::~ADXRS610()
-{
-}
-
-float ADXRS610::getDataVolts()
-{
- int val = m_aioData.read();
-
- return(float(val) * (m_aref / float(m_aRes)));
-}
-
-float ADXRS610::getTemperatureVolts()
-{
- int val = m_aioTemp.read();
-
- return(float(val) * (m_aref / float(m_aRes)));
-}
-
-float ADXRS610::calibrateZeroPoint(unsigned int samples)
-{
- // The gyro should be in a stable, non-moving state
-
- float sum = 0;
- for (int i=0; i<samples; i++)
- sum += getDataVolts();
-
- return sum / samples;
-}
-
-float ADXRS610::getTemperature()
-{
- float tempV = getTemperatureVolts();
-
- // nominal 2.5 volts at 25C
- if (tempV > m_centerVolts)
- return (m_temperatureNom + ((tempV - m_centerVolts) / m_temperatureCoeff));
- else
- return (m_temperatureNom - ((m_centerVolts - tempV) / m_temperatureCoeff));
-}
-
-float ADXRS610::getAngularVelocity()
-{
- float dataV = getDataVolts();
-
- // check the deadband
- if (dataV < (m_zeroPoint + m_deadband) &&
- dataV > (m_zeroPoint - m_deadband))
- return 0.0;
-
- if (dataV > m_zeroPoint)
- return ((dataV - m_zeroPoint) / m_degreeCoeff);
- else
- return -((m_zeroPoint - dataV) / m_degreeCoeff);
-}
diff --git a/peripheral/libupm/src/adxrs610/adxrs610.h b/peripheral/libupm/src/adxrs610/adxrs610.h
deleted file mode 100644
index 07bc389..0000000
--- a/peripheral/libupm/src/adxrs610/adxrs610.h
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <iostream>
-#include <string>
-#include <mraa/aio.hpp>
-
-// volts per degree / second (typ)
-#define m_degreeCoeff 0.006
-
-// volts per degree C (typ)
-#define m_temperatureCoeff 0.009
-
-// nominal temperature at m_centerVolts
-#define m_temperatureNom 25.0
-
-namespace upm {
- /**
- * @brief DFRobot ADXRS610 Gyro Breakout Board
- * @defgroup adxrs610 libupm-adxrs610
- * @ingroup dfrobot analog compass
- */
-
- /**
- * @library adxrs610
- * @sensor adxrs610
- * @comname DFRobot ADXRS610 Gyro Breakout Board
- * @altname ADXRS610
- * @type compass
- * @man dfrobot
- * @web http://www.dfrobot.com/index.php?route=product/product&product_id=642
- * @con analog
- *
- * @brief DFRobot ADXRS610 Gyro Beakout board
- *
- * The ADXRS610 is a MEMS based single axis gyroscope with a range
- * of +/- 300 degrees/sec. It also incorporates a temperature
- * sensing unit that can be used for advanced calibration.
- *
- * This sensor returns an analog voltage proportional to the
- * rotation about the Z-axis in degrees/sec. The temperature
- * component returns a proportional analog values in degrees C.
- *
- * This driver was developed using the DFRobot ADXRS610 Gyro Beakout board.
- *
- * @image html adxrs610.jpg
- * @snippet adxrs610.cxx Interesting
- */
-
- class ADXRS610 {
- public:
-
- /**
- * ADXRS610 constructor
- *
- * @param dPin Analog pin to use for DATAOUT
- * @param tPin Analog pin to use for temperature measurement
- * @param aref Analog reference voltage; default is 5.0 V
- */
- ADXRS610(int dPin, int tPin, float aref=5.0);
-
- /**
- * ADXRS610 destructor
- */
- ~ADXRS610();
-
- /**
- * Returns the voltage detected on the DATA analog pin
- *
- * @return The detected voltage
- */
- float getDataVolts();
-
- /**
- * Returns the voltage detected on the TEMP analog pin
- *
- * @return The detected voltage
- */
- float getTemperatureVolts();
-
- /**
- * This method allows you to specify a deadband region around the
- * zero point of the gyro (at rest). This can be used as a
- * primitive filter to ignore movment around the zero point.
- *
- * @param deadband The voltage around the zero point which will be
- * ignored
- */
- void setDeadband(float deadband) { m_deadband = deadband; };
-
- /**
- * Set the zero point. This is the point measured and averaged
- * when the sensor is not moving. It is set at construction time
- * (averaged over a number of samples), but can be overriden here.
- *
- * @param zeroPoint The averaged zero point of the sensor at rest
- */
- void setZeroPoint(float zeroPoint) { m_zeroPoint = zeroPoint; };
-
- /**
- * This method samples the data pin samples times to produce an
- * average. This value can then be used as the zero point
- * (setZeroPoint()).
- *
- * @param samples the number of samples to take an average over.
- * The default is 50.
- * @return the average of the reading over samples times.
- */
- float calibrateZeroPoint(unsigned int samples=50);
-
- /**
- * Return the zero point value.
- *
- * @return the current zero point value
- */
- float getZeroPoint() { return m_zeroPoint; };
-
- /**
- * Return the measured temperature in Celcius. Note, the
- * datasheet says that this value is very repeatable, but is not
- * an accurate absolute temperature.
- *
- * @return the current temperature in C
- */
- float getTemperature();
-
- /**
- * Return the measured angular velocity in degrees/sec.
- *
- * @return the current angular velocity in degrees/sec
- */
- float getAngularVelocity();
-
- protected:
- mraa::Aio m_aioData;
- mraa::Aio m_aioTemp;
-
- private:
- float m_aref;
- // ADC resolution
- int m_aRes;
-
- // measured or set zero point value
- float m_zeroPoint;
- // desired deadband, default is 0.0
- float m_deadband;
-
- // aref / 2
- float m_centerVolts;
- };
-}
-
-
diff --git a/peripheral/libupm/src/adxrs610/javaupm_adxrs610.i b/peripheral/libupm/src/adxrs610/javaupm_adxrs610.i
deleted file mode 100644
index 0c89c14..0000000
--- a/peripheral/libupm/src/adxrs610/javaupm_adxrs610.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_adxrs610
-%include "../upm.i"
-
-%{
- #include "adxrs610.h"
-%}
-
-%include "adxrs610.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_adxrs610");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/adxrs610/jsupm_adxrs610.i b/peripheral/libupm/src/adxrs610/jsupm_adxrs610.i
deleted file mode 100644
index 841fa60..0000000
--- a/peripheral/libupm/src/adxrs610/jsupm_adxrs610.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_adxrs610
-%include "../upm.i"
-
-%{
- #include "adxrs610.h"
-%}
-
-%include "adxrs610.h"
diff --git a/peripheral/libupm/src/adxrs610/pyupm_adxrs610.i b/peripheral/libupm/src/adxrs610/pyupm_adxrs610.i
deleted file mode 100644
index fd597ff..0000000
--- a/peripheral/libupm/src/adxrs610/pyupm_adxrs610.i
+++ /dev/null
@@ -1,11 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_adxrs610
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "adxrs610.h"
-%{
- #include "adxrs610.h"
-%}
diff --git a/peripheral/libupm/src/am2315/CMakeLists.txt b/peripheral/libupm/src/am2315/CMakeLists.txt
deleted file mode 100644
index 5931421..0000000
--- a/peripheral/libupm/src/am2315/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "am2315")
-set (libdescription "libupm Humidity Sensor")
-set (module_src ${libname}.cpp)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/am2315/am2315.cpp b/peripheral/libupm/src/am2315/am2315.cpp
deleted file mode 100644
index c687cc7..0000000
--- a/peripheral/libupm/src/am2315/am2315.cpp
+++ /dev/null
@@ -1,319 +0,0 @@
-/*
- * Author: William Penner <william.penner@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-#include <iostream>
-#include <string>
-#include <stdexcept>
-#include <unistd.h>
-#include <stdlib.h>
-#include <pthread.h>
-#include <sched.h>
-#include <time.h>
-
-#include "am2315.h"
-
-using namespace upm;
-
-char g_name[] = AM2315_NAME;
-
-AM2315::AM2315(int bus, int devAddr) {
- m_temperature = 0;
- m_humidity = 0;
- m_last_time = 0;
-
- m_name = g_name;
-
- m_controlAddr = devAddr;
- m_bus = bus;
-
- m_base_priority = sched_getscheduler(0);
-
- if ( !(m_i2ControlCtx = mraa_i2c_init(m_bus)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_i2c_init() failed");
- return;
- }
-
- mraa_result_t ret = mraa_i2c_address(m_i2ControlCtx, m_controlAddr);
- if (ret != MRAA_SUCCESS) {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_i2c_address() failed");
- return;
- }
- m_model = i2cReadReg_16(AM2315_MODEL);
- m_version = i2cReadReg_8(AM2315_VERSION);
- m_id = i2cReadReg_32(AM2315_ID);
-
- fprintf(stdout,"%s: Model: 0x%04x Version: 0x%02x ID: 0x%08x\n",
- m_name, m_model, m_version, m_id );
-}
-
-AM2315::~AM2315() {
- mraa_i2c_stop(m_i2ControlCtx);
-}
-
-void
-AM2315::update_values(void)
-{
- time_t ctime = time(NULL);
- if ((ctime - m_last_time) >= AM2315_SAMPLE) {
- uint32_t uival = i2cReadReg_32(AM2315_HUMIDITY);
- m_humidity = uival >> 16;
- m_temperature = uival & 0xffff;
- m_last_time = ctime;
- }
- else {
- // In case the time is changed - backwards
- if (ctime < m_last_time)
- m_last_time = ctime;
- }
-}
-
-float
-AM2315::getTemperature(void)
-{
- update_values();
- return (float)m_temperature / 10;
-}
-
-float
-AM2315::getTemperatureF(void)
-{
- return getTemperature() * 9 / 5 + 32;
-}
-
-float
-AM2315::getHumidity(void)
-{
- update_values();
- return (float)m_humidity / 10;
-}
-
-/*
- * Test function: when reading the AM2315 many times rapidly should
- * result in a temperature increase. This test will verify that the
- * value is changing from read to read
- */
-
-int
-AM2315::testSensor(void)
-{
- int i;
- int iError = 0;
- float fTemp, fHum;
- float fTempMax, fTempMin;
- float fHumMax, fHumMin;
-
- fprintf(stdout, "%s: Executing Sensor Test\n", m_name );
-
- fHum = getHumidity();
- fTemp = getTemperature();
- fTempMax = fTempMin = fTemp;
- fHumMax = fHumMin = fHum;
-
- // Then sample the sensor a few times
- for (i=0; i < 10; i++) {
- fHum = getHumidity();
- fTemp = getTemperature();
- if (fHum < fHumMin) fHumMin = fHum;
- if (fHum > fHumMax) fHumMax = fHum;
- if (fTemp < fTempMin) fTempMin = fTemp;
- if (fTemp > fTempMax) fTempMax = fTemp;
- usleep(50000);
- }
-
- // Now check the results
- if (fHumMin == fHumMax && fTempMin == fTempMax) {
- fprintf(stdout, "%s: Humidity/Temp reading was unchanged - warning\n",
- m_name );
- iError++;
- }
- if (iError == 0) {
- fprintf(stdout, "%s: Device appears functional\n", m_name );
- }
-
- fprintf(stdout, "%s: Test complete\n", m_name );
-
- return iError;
-}
-
-uint16_t
-AM2315::crc16(uint8_t* ptr, uint8_t len)
-{
- uint16_t crc = 0xffff;
- uint8_t i;
-
- while(len--) {
- crc ^= *ptr++;
- for (i=0; i < 8; i++) {
- if (crc & 0x01) {
- crc >>= 1;
- crc ^= 0xA001;
- }
- else {
- crc >>= 1;
- }
- }
- }
- return crc;
-}
-
-/*
- * Functions to read and write data to the i2c device in the
- * special format used by the device. This is using i2c to
- * interface to a controller that the AOSONG AM2315 uses to
- * perform the measurements and manage other registers.
- */
-int
-AM2315::i2cWriteReg(uint8_t reg, uint8_t* data, uint8_t ilen)
-{
- uint8_t tdata[16] = { AM2315_WRITE, reg, ilen };
- mraa_result_t error;
-
- for (int i=0; i < ilen; i++) {
- tdata[i+3] = data[i];
- }
- uint16_t crc = crc16(tdata, ilen+3);
- // CRC is sent out backwards from other registers (low, high)
- tdata[ilen+3] = crc;
- tdata[ilen+4] = (crc >> 8);
-
- mraa_result_t ret = mraa_i2c_address(m_i2ControlCtx, m_controlAddr);
- int iLoops = 5;
- mraa_set_priority(HIGH_PRIORITY);
- do {
- error = mraa_i2c_write(m_i2ControlCtx, tdata, ilen+5);
- usleep(800);
- } while(error != MRAA_SUCCESS && --iLoops);
- mraa_set_priority(m_base_priority);
-
- if (error != MRAA_SUCCESS) {
- fprintf(stdout, "%s: Error, timeout writing sensor.\n", m_name);
- return -1;
- }
- crc = crc16(tdata,3);
- mraa_i2c_read(m_i2ControlCtx, tdata, 5);
- if ((tdata[0] != AM2315_WRITE) ||
- (tdata[1] != reg) ||
- (tdata[2] != ilen) ||
- (tdata[3] != (crc & 0xff)) ||
- (tdata[4] != (crc >> 8))) {
- fprintf(stdout, "%s: CRC error during write verification\n", m_name);
- return -1;
- }
- return 0;
-}
-
-
-// TODO: Need to patch up function to return only the data that
-// is needed and not require the various functions that call this
-// to send it enough buffer to cover the function
-
-uint8_t
-AM2315::i2cReadReg(int reg, uint8_t* data, int ilen)
-{
- uint8_t tdata[16] = { AM2315_READ, reg, ilen };
-
- mraa_result_t ret = mraa_i2c_address(m_i2ControlCtx, m_controlAddr);
- int iLoops = 5;
- mraa_set_priority(HIGH_PRIORITY);
- do {
- ret = mraa_i2c_write(m_i2ControlCtx, tdata, 3);
- usleep(800);
- } while(ret != MRAA_SUCCESS && --iLoops);
- if (ret != MRAA_SUCCESS) {
- fprintf(stdout, "%s: Error, timeout reading sensor.\n", m_name);
- mraa_set_priority(m_base_priority);
- return -1;
- }
- usleep(5000);
- mraa_i2c_read(m_i2ControlCtx, tdata, ilen+4);
- mraa_set_priority(m_base_priority);
-
- uint16_t crc = crc16(tdata, ilen+2);
- if ((tdata[0] != AM2315_READ) ||
- (tdata[1] != ilen) ||
- (tdata[ilen+2] != (crc & 0xff)) ||
- (tdata[ilen+3] != (crc >> 8))) {
- fprintf(stdout, "%s: Read crc failed.\n", m_name);
- }
- for (int i=0; i < ilen; i++)
- data[i] = tdata[i+2];
-
- return 0;
-}
-
-/*
- * Functions to set up the reads and writes to simplify the process of
- * formatting data as needed by the microcontroller
- */
-
-int
-AM2315::i2cWriteReg_32(int reg, uint32_t ival) {
- uint8_t data[4];
- data[0] = ival >> 24;
- data[1] = ival >> 16;
- data[1] = ival >> 8;
- data[1] = ival & 0xff;
- return i2cWriteReg(reg, data, 4);
-}
-
-int
-AM2315::i2cWriteReg_16(int reg, uint16_t ival) {
- uint8_t data[2];
- data[0] = ival & 0xff;
- data[1] = ival >> 8;
- return i2cWriteReg(reg, data, 2);
-}
-
-int
-AM2315::i2cWriteReg_8(int reg, uint8_t ival) {
- uint8_t data[2];
- data[0] = ival & 0xff;
- data[1] = ival >> 8;
- return i2cWriteReg(reg, data, 2);
-}
-
-uint32_t
-AM2315::i2cReadReg_32 (int reg) {
- uint8_t data[4];
- i2cReadReg(reg, data, 4);
- return ((((((uint32_t)data[0] << 8) | data[1]) << 8) |
- data[2]) << 8) | data[3];
-}
-
-uint16_t
-AM2315::i2cReadReg_16 (int reg) {
- uint8_t data[2];
- i2cReadReg(reg, data, 2);
- return ((int16_t)data[0] << 8) | (uint16_t)data[1];
-}
-
-uint8_t
-AM2315::i2cReadReg_8 (int reg) {
- uint8_t data[1];
- i2cReadReg(reg, data, 1);
- return data[0];
-}
-
diff --git a/peripheral/libupm/src/am2315/am2315.h b/peripheral/libupm/src/am2315/am2315.h
deleted file mode 100644
index 5d69882..0000000
--- a/peripheral/libupm/src/am2315/am2315.h
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * Author: William Penner <william.penner@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-#pragma once
-
-#include <string>
-#include <mraa/i2c.h>
-#include <math.h>
-
-#define AM2315_NAME "am2315"
-#define AM2315_I2C_ADDRESS 0x5c
-
-#define AM2315_READ 0x03
-#define AM2315_WRITE 0x10
-
-/* AM2315 Commands */
-#define AM2315_HUMIDITY 0x00
-#define AM2315_TEMP 0x02
-#define AM2315_MODEL 0x08
-#define AM2315_VERSION 0x0A
-#define AM2315_ID 0x0B
-#define AM2315_STATUS 0x0F
-#define AM2315_USER_A 0x10
-#define AM2315_USER_B 0x12
-
-#define AM2315_SAMPLE 2
-
-#define HIGH_PRIORITY 99
-
-namespace upm {
-
-/**
- * @brief AM2315 Temperature & Humidity Sensor library
- * @defgroup am2315 libupm-am2315
- * @ingroup adafruit i2c temp
- */
-
-/**
- * @library am2315
- * @sensor am2315
- * @comname AM2315 Temperature & Humidity Sensor
- * @type temp
- * @man adafruit
- * @web http://www.adafruit.com/products/1293
- * @con i2c
- *
- * @brief API for the AM2315 Temperature & Humidity Sensor
- *
- * AM2315 by Measurement Specialties
- * (http://www.aosong.com/asp_bin/Products/en/AM2315.pdf)
- * is a digital humidity sensor with temperature output.
- * RH reports between 0 and 100%, and the temperature range is
- * -40 to +125 degC.
- * The sampling period of this sensor is 2 seconds. Reads occurring
- * more often than that return cached data.
- *
- * @image html am2315.jpeg
- * @snippet am2315.cxx Interesting
- */
-class AM2315 {
- public:
- /**
- * Instantiates an AM2315 object
- *
- * @param bus Number of the used bus
- * @param devAddr Address of the used I2C device
- * @param mode AM2315 oversampling
- */
- AM2315 (int bus, int devAddr=AM2315_I2C_ADDRESS);
-
- /**
- * AM2315 object destructor; basically, it closes the I2C connection.
- */
- ~AM2315 ();
-
- /**
- * Gets the current measured humidity [RH]
- *
- * Data is updated every 2 seconds - accesses occurring more often than
- * that return cached data
- */
- float getHumidity(void);
-
- /**
- * Gets the humidity cell temperature [degC]
- *
- * Data is updated every 2 seconds - accesses occurring more often than
- * that return cached data
- */
- float getTemperature(void);
-
- /**
- * Gets the humidity cell temperature [degF]
- *
- * Data is updated every 2 seconds - accesses occurring more often than
- * that return cached data
- */
- float getTemperatureF(void);
-
- /**
- * Function intended to test the device and verify it
- * is operating correctly.
- *
- */
- int testSensor(void);
-
- /**
- * Writes a four-byte (32b) register
- *
- * Note: these access routines are not the normal accesses to an I2C
- * device. AM2315 contains a microcontroller that manages the
- * actual readings. These handlers then make requests over I2C using
- * a protocol defined by AM2315.
- *
- * @param reg Address of the register
- * @param ival 32b value
- */
- int i2cWriteReg_32(int reg, uint32_t ival);
-
- /**
- * Writes a two-byte (16b) register
- *
- * @param reg Address of the register
- * @param ival 16b value
- */
- int i2cWriteReg_16(int reg, uint16_t ival);
-
- /**
- * Writes a one-byte (8b) register
- *
- * @param reg Address of the register
- * @param ival 8b value
- */
- int i2cWriteReg_8(int reg, uint8_t ival);
-
- /**
- * Reads a four-byte register
- *
- * @param reg Address of the register
- */
- uint32_t i2cReadReg_32 (int reg);
-
- /**
- * Reads a two-byte register
- *
- * @param reg Address of the register
- */
- uint16_t i2cReadReg_16 (int reg);
-
- /**
- * Reads a one-byte register
- *
- * @param reg Address of the register
- */
- uint8_t i2cReadReg_8 (int reg);
-
- private:
-
- char* m_name;
-
- int m_controlAddr;
- int m_bus;
- mraa_i2c_context m_i2ControlCtx;
-
- void update_values(void);
- uint8_t i2cReadReg(int reg, uint8_t* data, int ilen);
- int i2cWriteReg(uint8_t reg, uint8_t* data, uint8_t ilen);
- uint16_t crc16(uint8_t* ptr, uint8_t len);
-
- int32_t m_temperature;
- int32_t m_humidity;
-
- uint16_t m_model;
- uint16_t m_version;
- uint32_t m_id;
-
- time_t m_last_time;
-
- int m_base_priority;
- pthread_t this_thread;
-};
-
-}
diff --git a/peripheral/libupm/src/am2315/javaupm_am2315.i b/peripheral/libupm/src/am2315/javaupm_am2315.i
deleted file mode 100644
index 5d2a0ad..0000000
--- a/peripheral/libupm/src/am2315/javaupm_am2315.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_am2315
-%include "../upm.i"
-
-%{
- #include "am2315.h"
-%}
-
-%include "am2315.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_am2315");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/am2315/jsupm_am2315.i b/peripheral/libupm/src/am2315/jsupm_am2315.i
deleted file mode 100644
index f6baf25..0000000
--- a/peripheral/libupm/src/am2315/jsupm_am2315.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_am2315
-%include "../upm.i"
-
-%{
- #include "am2315.h"
-%}
-
-%include "am2315.h"
diff --git a/peripheral/libupm/src/am2315/pyupm_am2315.i b/peripheral/libupm/src/am2315/pyupm_am2315.i
deleted file mode 100644
index 7e9acf1..0000000
--- a/peripheral/libupm/src/am2315/pyupm_am2315.i
+++ /dev/null
@@ -1,15 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_am2315
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-#ifdef DOXYGEN
-%include "am2315_doc.i"
-#endif
-
-%include "am2315.h"
-%{
- #include "am2315.h"
-%}
diff --git a/peripheral/libupm/src/apds9002/CMakeLists.txt b/peripheral/libupm/src/apds9002/CMakeLists.txt
deleted file mode 100644
index e006f8f..0000000
--- a/peripheral/libupm/src/apds9002/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "apds9002")
-set (libdescription "upm apds9002 luminance module")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/apds9002/apds9002.cxx b/peripheral/libupm/src/apds9002/apds9002.cxx
deleted file mode 100644
index cd3138e..0000000
--- a/peripheral/libupm/src/apds9002/apds9002.cxx
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Author: Zion Orent <zorent@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <string>
-#include <stdexcept>
-
-#include "apds9002.h"
-
-using namespace upm;
-
-APDS9002::APDS9002(int pin)
-{
- if ( !(m_aio = mraa_aio_init(pin)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_aio_init() failed, invalid pin?");
- return;
- }
-}
-
-APDS9002::~APDS9002()
-{
- mraa_aio_close(m_aio);
-}
-
-int APDS9002::value()
-{
- return mraa_aio_read(m_aio);
-}
diff --git a/peripheral/libupm/src/apds9002/apds9002.h b/peripheral/libupm/src/apds9002/apds9002.h
deleted file mode 100644
index 0c3a3d5..0000000
--- a/peripheral/libupm/src/apds9002/apds9002.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Author: Zion Orent <zorent@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include <mraa/aio.h>
-
-namespace upm {
- /**
- * @brief APDS-9002 Luminance Sensor library
- * @defgroup apds9002 libupm-apds9002
- * @ingroup seeed analog light
- */
-
- /**
- * @library apds9002
- * @sensor apds9002
- * @comname APDS-9002 Luminance Sensor
- * @altname Grove Luminance Sensor
- * @type light
- * @man seeed
- * @con analog
- *
- * @brief UPM module for the APDS-9002 Luminance Sensor
- *
- * This sensor transforms luminous intensity to output analog values.
- * It uses an APDS-9002 ambient light sensor.
- *
- * @image html apds9002.jpg
- * @snippet apds9002.cxx Interesting
- */
-
- class APDS9002 {
- public:
- /**
- * APDS-9002 luminance sensor constructor
- *
- * @param pin Analog pin to use
- */
- APDS9002(int pin);
- /**
- * APDS9002 destructor
- */
- ~APDS9002();
- /**
- * Gets the luminance value from the sensor
- *
- * @return Luminance value
- */
- int value();
-
- private:
- mraa_aio_context m_aio;
- };
-}
-
-
diff --git a/peripheral/libupm/src/apds9002/javaupm_apds9002.i b/peripheral/libupm/src/apds9002/javaupm_apds9002.i
deleted file mode 100644
index 645e8f9..0000000
--- a/peripheral/libupm/src/apds9002/javaupm_apds9002.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_apds9002
-%include "../upm.i"
-
-%{
- #include "apds9002.h"
-%}
-
-%include "apds9002.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_apds9002");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/apds9002/jsupm_apds9002.i b/peripheral/libupm/src/apds9002/jsupm_apds9002.i
deleted file mode 100644
index 383f568..0000000
--- a/peripheral/libupm/src/apds9002/jsupm_apds9002.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_apds9002
-%include "../upm.i"
-
-%{
- #include "apds9002.h"
-%}
-
-%include "apds9002.h"
diff --git a/peripheral/libupm/src/apds9002/pyupm_apds9002.i b/peripheral/libupm/src/apds9002/pyupm_apds9002.i
deleted file mode 100644
index 516f112..0000000
--- a/peripheral/libupm/src/apds9002/pyupm_apds9002.i
+++ /dev/null
@@ -1,11 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_apds9002
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "apds9002.h"
-%{
- #include "apds9002.h"
-%}
diff --git a/peripheral/libupm/src/apds9930/CMakeLists.txt b/peripheral/libupm/src/apds9930/CMakeLists.txt
deleted file mode 100644
index d534a79..0000000
--- a/peripheral/libupm/src/apds9930/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "apds9930")
-set (libdescription "upm apds9930 sensor module")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/apds9930/apds9930.cxx b/peripheral/libupm/src/apds9930/apds9930.cxx
deleted file mode 100644
index e365d4c..0000000
--- a/peripheral/libupm/src/apds9930/apds9930.cxx
+++ /dev/null
@@ -1,61 +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 <iostream>
-#include <string>
-#include <stdexcept>
-
-#include "apds9930.h"
-
-using namespace upm;
-
-APDS9930::APDS9930(int device)
-{
- if (!(m_iio = mraa_iio_init(device))) {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_iio_init() failed, invalid device?");
- return;
- }
-}
-
-APDS9930::~APDS9930()
-{
- // mraa_iio_stop(m_iio);
-}
-
-int
-APDS9930::getAmbient()
-{
- int iio_value = 0;
- mraa_iio_read_int(m_iio, "in_illuminance_input", &iio_value);
- return iio_value;
-}
-
-int
-APDS9930::getProximity()
-{
- int iio_value = 0;
- mraa_iio_read_int(m_iio, "in_proximity_raw", &iio_value);
- return iio_value;
-}
diff --git a/peripheral/libupm/src/apds9930/apds9930.h b/peripheral/libupm/src/apds9930/apds9930.h
deleted file mode 100644
index a5c3a81..0000000
--- a/peripheral/libupm/src/apds9930/apds9930.h
+++ /dev/null
@@ -1,82 +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
-
-#include <string>
-#include <mraa/iio.h>
-
-namespace upm
-{
-/**
- * @brief APDS9930 Digital Proximity and Ambient Light Sensor library
- * @defgroup apds9930 libupm-apds9930
- * @ingroup Avago Technologies iio i2c proximity and ambient light sensor
- */
-
-/**
- * @library apds9930
- * @sensor apds9930
- * @comname APDS9930 Digital Proximity and Ambient Light Sensor
- * @type light proximity
- * @man Avago Technologies
- * @con iio i2c
- *
- * @brief APDS9930 Digital Proximity and Ambient Light Sensor
- *
- * This sensor provides digital ambient light sensing (ALS),
- * IR LED and a complete proximity detection system.
- *
- * @snippet apds9930.cxx Interesting
- */
-
-class APDS9930
-{
- public:
- /**
- * APDS-9930 digital proximity and ambient light sensor constructor
- *
- * @param iio device number
- */
- APDS9930(int device);
- /**
- * APDS9930 destructor
- */
- ~APDS9930();
- /**
- * Gets the ambient luminance value from the sensor
- *
- * @return Ambient Luminance value
- */
- int getAmbient();
- /**
- * Gets the proximity value from the sensor
- *
- * @return Proximity value
- */
- int getProximity();
-
- private:
- mraa_iio_context m_iio;
-};
-}
diff --git a/peripheral/libupm/src/apds9930/javaupm_apds9930.i b/peripheral/libupm/src/apds9930/javaupm_apds9930.i
deleted file mode 100644
index ca8aa53..0000000
--- a/peripheral/libupm/src/apds9930/javaupm_apds9930.i
+++ /dev/null
@@ -1,18 +0,0 @@
-%module javaupm_apds9930
-%include "../upm.i"
-
-%{
- #include "apds9930.h"
-%}
-%include "apds9930.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_apds9930");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%}
diff --git a/peripheral/libupm/src/apds9930/jsupm_apds9930.i b/peripheral/libupm/src/apds9930/jsupm_apds9930.i
deleted file mode 100644
index 80e77af..0000000
--- a/peripheral/libupm/src/apds9930/jsupm_apds9930.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_apds9930
-%include "../upm.i"
-
-%{
- #include "apds9930.h"
-%}
-
-%include "apds9930.h"
diff --git a/peripheral/libupm/src/apds9930/pyupm_apds9930.i b/peripheral/libupm/src/apds9930/pyupm_apds9930.i
deleted file mode 100644
index fb1f6c5..0000000
--- a/peripheral/libupm/src/apds9930/pyupm_apds9930.i
+++ /dev/null
@@ -1,9 +0,0 @@
-%module pyupm_apds9930
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "apds9930.h"
-%{
- #include "apds9930.h"
-%}
diff --git a/peripheral/libupm/src/at42qt1070/CMakeLists.txt b/peripheral/libupm/src/at42qt1070/CMakeLists.txt
deleted file mode 100644
index 8b48db8..0000000
--- a/peripheral/libupm/src/at42qt1070/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "at42qt1070")
-set (libdescription "upm module for the Atmel AT42QT1070 QTouch sensor")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/at42qt1070/at42qt1070.cxx b/peripheral/libupm/src/at42qt1070/at42qt1070.cxx
deleted file mode 100644
index f9207d2..0000000
--- a/peripheral/libupm/src/at42qt1070/at42qt1070.cxx
+++ /dev/null
@@ -1,252 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <math.h>
-#include <iostream>
-#include <string>
-#include <stdexcept>
-
-#include "at42qt1070.h"
-
-using namespace upm;
-using namespace std;
-
-
-AT42QT1070::AT42QT1070(int bus, uint8_t address)
-{
- m_addr = address;
-
- // setup our i2c link
- if (!(m_i2c = mraa_i2c_init(bus))) {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_i2c_init() failed");
- return;
- }
-
- mraa_result_t rv;
-
- if ((rv = mraa_i2c_address(m_i2c, m_addr)) != MRAA_SUCCESS) {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_i2c_address() failed");
- return;
- }
-
- if (readChipID() != 0x2E) {
- throw std::runtime_error("Chip ID does not match the expected value (2Eh)");
- }
-
- m_buttonStates = 0;
- m_calibrating = false;
- m_overflow = false;
-}
-
-AT42QT1070::~AT42QT1070()
-{
- mraa_i2c_stop(m_i2c);
-}
-
-bool
-AT42QT1070::writeByte(uint8_t reg, uint8_t byte)
-{
- mraa_result_t rv = mraa_i2c_write_byte_data(m_i2c, byte, reg);
-
- if (rv != MRAA_SUCCESS) {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": mraa_i2c_write_byte() failed");
- return false;
- }
-
- return true;
-}
-
-bool
-AT42QT1070::writeWord(uint8_t reg, uint16_t word)
-{
- mraa_result_t rv = mraa_i2c_write_word_data(m_i2c, word, reg);
-
- if (rv != MRAA_SUCCESS) {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": mraa_i2c_write_word() failed");
- return false;
- }
-
- return true;
-}
-
-uint8_t
-AT42QT1070::readByte(uint8_t reg)
-{
- return mraa_i2c_read_byte_data(m_i2c, reg);
-}
-
-uint16_t
-AT42QT1070::readWord(uint8_t reg)
-{
- return mraa_i2c_read_word_data(m_i2c, reg);
-}
-
-uint8_t
-AT42QT1070::readChipID(void)
-{
- return readByte(REG_CHIPID);
-}
-
-void
-AT42QT1070::updateState()
-{
- uint8_t stat = readByte(REG_DETSTATUS);
-
- // if we are calibrating, don't change anything
- if (stat & DET_CALIBRATE) {
- m_calibrating = true;
- return;
- } else {
- m_calibrating = false;
- }
-
- if (stat & DET_OVERFLOW)
- m_overflow = true;
- else
- m_overflow = false;
-
- // if a touch is occurring, read the button states
- if (stat & DET_TOUCH) {
- uint8_t keys = readByte(REG_KEYSTATUS);
- // high bit is reserved, filter it out
- m_buttonStates = keys & ~0x80;
- } else {
- m_buttonStates = 0;
- }
-}
-
-uint8_t
-AT42QT1070::getLPMode(void)
-{
- return readByte(REG_LP);
-}
-
-uint8_t
-AT42QT1070::setLPMode(uint8_t mode)
-{
- writeByte(REG_LP, mode);
-
- return getLPMode();
-}
-
-uint8_t
-AT42QT1070::getAVE(uint8_t key)
-{
- uint8_t value, ave;
-
- if (key > 6) {
- throw std::invalid_argument("Only keys 0-6 are allowed");
- }
-
- value = readByte(REG_AVE0 + key);
- ave = (value & 0xFC) >> 2;
-
- return ave;
-}
-
-uint8_t
-AT42QT1070::setAVE(uint8_t key, uint8_t ave)
-{
- uint8_t value;
-
- if (key > 6) {
- throw std::invalid_argument("Only keys 0-6 are allowed");
- }
-
- switch (ave) {
- case 1:
- case 2:
- case 4:
- case 8:
- case 16:
- case 32:
- break;
-
- default:
- throw std::invalid_argument("Invalid averaging factor");
- }
-
- value = readByte(REG_AVE0 + key);
- value = value & 0x03;
- value = value | (ave << 2);
- writeByte(REG_AVE0 + key, value);
-
- return getAVE(key);
-}
-
-uint8_t
-AT42QT1070::getAKSGroup(uint8_t key)
-{
- uint8_t value, aks;
-
- if (key > 6) {
- throw std::invalid_argument("Only keys 0-6 are allowed");
- }
-
- value = readByte(REG_AVE0 + key);
- aks = value & 0x03;
-
- return aks;
-}
-
-uint8_t
-AT42QT1070::setAKSGroup(uint8_t key, uint8_t group)
-{
- uint8_t value;
-
- if (key > 6) {
- throw std::invalid_argument("Only keys 0-6 are allowed");
- }
-
- if (group > 3) {
- throw std::invalid_argument("Only groups 0-3 are allowed");
- }
-
- value = readByte(REG_AVE0 + key);
- value = value & 0xFC;
- value = value | group;
-
- writeByte(REG_AVE0 + key, value);
-
- return getAKSGroup(key);
-}
-
-bool
-AT42QT1070::reset()
-{
- // write a non-zero value to the reset register
- return writeByte(REG_RESET, 0xff);
-}
-
-bool
-AT42QT1070::calibrate()
-{
- // write a non-zero value to the calibrate register
- return writeByte(REG_CALIBRATE, 0xff);
-}
diff --git a/peripheral/libupm/src/at42qt1070/at42qt1070.h b/peripheral/libupm/src/at42qt1070/at42qt1070.h
deleted file mode 100644
index 935a4bd..0000000
--- a/peripheral/libupm/src/at42qt1070/at42qt1070.h
+++ /dev/null
@@ -1,313 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <stdint.h>
-#include <sys/time.h>
-
-#include <string>
-#include <mraa/i2c.h>
-
-#define AT42QT1070_I2C_BUS 0
-#define AT42QT1070_DEFAULT_I2C_ADDR 0x1b
-
-namespace upm
-{
-/**
- * @brief Atmel* AT42QT1070 QTouch* Sensor library
- * @defgroup at42qt1070 libupm-at42qt1070
- * @ingroup seeed i2c touch
- */
-
-/**
- * @library at42qt1070
- * @sensor at42qt1070
- * @comname AT42QT1070 QTouch Sensor
- * @altname Grove QTouch Sensor
- * @type touch
- * @man seeed
- * @con i2c
- *
- * @brief API for the Atmel AT42QT1070 QTouch Sensor
- *
- * This class implements support for the Atmel AT42QT1070 QTouch
- * sensor, which supports 7 capacitive buttons.
- *
- * It was developed using a Grove-Q Touch Sensor board.
- *
- * @image html at42qt1070.jpg
- * @snippet at42qt1070.cxx Interesting
- */
-class AT42QT1070
-{
- public:
- // registers
- typedef enum {
- REG_CHIPID = 0,
- REG_FWVERS = 1,
-
- REG_DETSTATUS = 2, // detection status
- REG_KEYSTATUS = 3, // key status
-
- REG_KEYSIG0_H = 4, // key signal
- REG_KEYSIG0_L = 5,
- REG_KEYSIG1_H = 6,
- REG_KEYSIG1_L = 7,
- REG_KEYSIG2_H = 8,
- REG_KEYSIG2_L = 9,
- REG_KEYSIG3_H = 10,
- REG_KEYSIG3_L = 11,
- REG_KEYSIG4_H = 12,
- REG_KEYSIG4_L = 13,
- REG_KEYSIG5_H = 14,
- REG_KEYSIG5_L = 15,
- REG_KEYSIG6_H = 16,
- REG_KEYSIG6_L = 17,
-
- REG_REFDATA0_H = 18, // key reference data
- REG_REFDATA0_L = 19,
- REG_REFDATA1_H = 20,
- REG_REFDATA1_L = 21,
- REG_REFDATA2_H = 22,
- REG_REFDATA2_L = 23,
- REG_REFDATA3_H = 24,
- REG_REFDATA3_L = 25,
- REG_REFDATA4_H = 26,
- REG_REFDATA4_L = 27,
- REG_REFDATA5_H = 28,
- REG_REFDATA5_L = 29,
- REG_REFDATA6_H = 30,
- REG_REFDATA6_L = 31,
-
- REG_NTHR0 = 32, // negative threshold level
- REG_NTHR1 = 33,
- REG_NTHR2 = 34,
- REG_NTHR3 = 35,
- REG_NTHR4 = 36,
- REG_NTHR5 = 37,
- REG_NTHR6 = 38,
-
- REG_AVE0 = 39, // key suppression
- REG_AVE1 = 40,
- REG_AVE2 = 41,
- REG_AVE3 = 42,
- REG_AVE4 = 43,
- REG_AVE5 = 44,
- REG_AVE6 = 45,
-
- REG_DI0 = 46, // detection integrator
- REG_DI1 = 47,
- REG_DI2 = 48,
- REG_DI3 = 49,
- REG_DI4 = 50,
- REG_DI5 = 51,
- REG_DI6 = 52,
-
- REG_GUARD = 53, // FastOutDI/Max Cal/Guard channel
- REG_LP = 54, // low power
- REG_MAXON = 55, // max on duration
- REG_CALIBRATE = 56,
- REG_RESET = 57
- } AT42QT1070_REG_T;
-
- // detection register bits
- typedef enum {
- DET_TOUCH = 0x01,
- // 0x02-0x20 reserved
- DET_OVERFLOW = 0x40,
- DET_CALIBRATE = 0x80
- } AT42QT1070_DET_T;
-
-
- /**
- * AT42QT1070 constructor
- *
- * @param bus I2C bus to use
- * @param address Address for this sensor
- */
- AT42QT1070(int bus, uint8_t address = AT42QT1070_DEFAULT_I2C_ADDR);
-
- /**
- * AT42QT1070 destructor
- */
- ~AT42QT1070();
-
- /**
- * Writes a byte value into the register
- *
- * @param reg Register location to write into
- * @param byte Byte to write
- * @return True if successful
- */
- bool writeByte(uint8_t reg, uint8_t byte);
-
- /**
- * Writes a word value into the register. Note: the device must have the
- * auto-increment bit set in the MODE1 register to work.
- *
- * @param reg Register location to write into
- * @param word Word to write
- * @return True if successful
- */
- bool writeWord(uint8_t reg, uint16_t word);
-
- /**
- * Read a byte value from the register
- *
- * @param reg Register location to read from
- * @return Value in the specified register
- */
- uint8_t readByte(uint8_t reg);
-
- /**
- * Read a word value from the register. Note: the device must have the
- * auto-increment bit set in the MODE1 register to work.
- *
- * @param reg Register location to read from
- * @return Value in the specified register
- */
- uint16_t readWord(uint8_t reg);
-
-
- /**
- * Reads the Chip ID register on the sensor
- *
- * @return Value of the Chip ID register
- */
- uint8_t readChipID(void);
-
- /**
- * Reads the current touch status and detection state
- *
- * @return Key status bits for all keys (0-6)
- */
- void updateState();
-
-
- /**
- * Reads the current low-power mode setting
- *
- * @return Low-power mode setting from the sensor
- */
- uint8_t getLPMode(void);
-
- /**
- * Changes the low-pomer mode setting on the sensor
- *
- * @param mode dDsired new mode
- * @return New setting on the sensor
- */
- uint8_t setLPMode(uint8_t mode);
-
-
- /**
- * Reads the current averaging factor setting for a key
- *
- * @param key Key being read
- * @return Averaging factor
- */
- uint8_t getAVE(uint8_t key);
-
- /**
- * Changes the averaging factor setting for a key
- *
- * @param key Key being changed
- * @param ave New averaging factor
- * @return New averaging factor as read from the device
- */
- uint8_t setAVE(uint8_t key, uint8_t ave);
-
- /**
- * Reads the AKS group of which a key is part
- *
- * @param key Key (0-6) being queried
- * @return AKS group of which the key is part
- */
- uint8_t getAKSGroup(uint8_t key);
-
- /**
- * Changes the AKS group of which a key is part
- *
- * @param key Key (0-6) being changed
- * @param group New group for the key
- * @return New value on the sensor
- */
- uint8_t setAKSGroup(uint8_t key, uint8_t group);
-
- /**
- * Returns the overflow indicator
- *
- * @return True if overflow is indicated
- */
- bool
- isOverflowed()
- {
- return m_overflow;
- };
-
- /**
- * Returns the calibrating indicator
- *
- * @return True if calibration is in progress
- */
- bool
- isCalibrating()
- {
- return m_calibrating;
- };
-
- /**
- * Issues a reset command
- *
- * @return True if successful
- */
- bool reset();
-
- /**
- * Issues a calibrate command
- *
- * @return True if successful
- */
- bool calibrate();
-
- /**
- * Gets the current button states
- *
- * @returns Button states
- */
- uint8_t
- getButtons()
- {
- return m_buttonStates;
- };
-
- private:
- uint8_t m_buttonStates;
- bool m_calibrating;
- bool m_overflow;
-
- mraa_i2c_context m_i2c;
- uint8_t m_addr;
-};
-}
diff --git a/peripheral/libupm/src/at42qt1070/javaupm_at42qt1070.i b/peripheral/libupm/src/at42qt1070/javaupm_at42qt1070.i
deleted file mode 100644
index 8aceab0..0000000
--- a/peripheral/libupm/src/at42qt1070/javaupm_at42qt1070.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_at42qt1070
-%include "../upm.i"
-
-%{
- #include "at42qt1070.h"
-%}
-
-%include "at42qt1070.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_at42qt1070");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/at42qt1070/jsupm_at42qt1070.i b/peripheral/libupm/src/at42qt1070/jsupm_at42qt1070.i
deleted file mode 100644
index 9c47e46..0000000
--- a/peripheral/libupm/src/at42qt1070/jsupm_at42qt1070.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_at42qt1070
-%include "../upm.i"
-
-%{
- #include "at42qt1070.h"
-%}
-
-%include "at42qt1070.h"
diff --git a/peripheral/libupm/src/at42qt1070/pyupm_at42qt1070.i b/peripheral/libupm/src/at42qt1070/pyupm_at42qt1070.i
deleted file mode 100644
index 21897ed..0000000
--- a/peripheral/libupm/src/at42qt1070/pyupm_at42qt1070.i
+++ /dev/null
@@ -1,15 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_at42qt1070
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-#ifdef DOXYGEN
-%include "at42qt1070_doc.i"
-#endif
-
-%include "at42qt1070.h"
-%{
- #include "at42qt1070.h"
-%}
diff --git a/peripheral/libupm/src/biss0001/CMakeLists.txt b/peripheral/libupm/src/biss0001/CMakeLists.txt
deleted file mode 100644
index 1e1223a..0000000
--- a/peripheral/libupm/src/biss0001/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "biss0001")
-set (libdescription "upm biss0001 motion module")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/biss0001/biss0001.cxx b/peripheral/libupm/src/biss0001/biss0001.cxx
deleted file mode 100644
index 7f366a7..0000000
--- a/peripheral/libupm/src/biss0001/biss0001.cxx
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Author: Zion Orent <sorent@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <string>
-#include <stdexcept>
-
-#include "biss0001.h"
-
-using namespace upm;
-
-BISS0001::BISS0001(int pin)
-{
- if ( !(m_gpio = mraa_gpio_init(pin)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_gpio_init() failed, invalid pin?");
- return;
- }
- mraa_gpio_dir(m_gpio, MRAA_GPIO_IN);
-}
-
-BISS0001::~BISS0001()
-{
- mraa_gpio_close(m_gpio);
-}
-
-bool BISS0001::value()
-{
- return (mraa_gpio_read(m_gpio) ? true : false);
-}
diff --git a/peripheral/libupm/src/biss0001/biss0001.h b/peripheral/libupm/src/biss0001/biss0001.h
deleted file mode 100644
index 470f27b..0000000
--- a/peripheral/libupm/src/biss0001/biss0001.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Author: Zion Orent <sorent@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include <mraa/aio.h>
-
-namespace upm {
- /**
- * @brief BISS0001 Motion Sensor library
- * @defgroup biss0001 libupm-biss0001
- * @ingroup seeed gpio light tsk
- */
-
- /**
- * @library biss0001
- * @sensor biss0001
- * @comname BISS0001 Motion Sensor
- * @altname Grove PIR Motion Sensor
- * @type light
- * @man seeed
- * @web http://www.seeedstudio.com/depot/Grove-PIR-Motion-Sensor-p-802.html
- * @con gpio
- * @kit tsk
- *
- * @brief API for the BISS0001 Motion Sensor
- *
- * UPM module for the BISS0001 Motion Sensor
- *
- * @image html biss0001.jpg
- * @snippet biss0001.cxx Interesting
- */
- class BISS0001 {
- public:
- /**
- * BISS0001 motion sensor constructor
- *
- * @param pin Digital pin to use
- */
- BISS0001(int pin);
- /**
- * BISS0001 destructor
- */
- ~BISS0001();
- /**
- * Gets the motion value from the sensor
- *
- * @return Motion reading
- */
- bool value();
-
- private:
- mraa_gpio_context m_gpio;
- };
-}
-
-
diff --git a/peripheral/libupm/src/biss0001/javaupm_biss0001.i b/peripheral/libupm/src/biss0001/javaupm_biss0001.i
deleted file mode 100644
index c841230..0000000
--- a/peripheral/libupm/src/biss0001/javaupm_biss0001.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_biss0001
-%include "../upm.i"
-
-%{
- #include "biss0001.h"
-%}
-
-%include "biss0001.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_biss0001");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/biss0001/jsupm_biss0001.i b/peripheral/libupm/src/biss0001/jsupm_biss0001.i
deleted file mode 100644
index bff6ccf..0000000
--- a/peripheral/libupm/src/biss0001/jsupm_biss0001.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_biss0001
-%include "../upm.i"
-
-%{
- #include "biss0001.h"
-%}
-
-%include "biss0001.h"
diff --git a/peripheral/libupm/src/biss0001/pyupm_biss0001.i b/peripheral/libupm/src/biss0001/pyupm_biss0001.i
deleted file mode 100644
index c485f58..0000000
--- a/peripheral/libupm/src/biss0001/pyupm_biss0001.i
+++ /dev/null
@@ -1,11 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_biss0001
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "biss0001.h"
-%{
- #include "biss0001.h"
-%}
diff --git a/peripheral/libupm/src/bma220/CMakeLists.txt b/peripheral/libupm/src/bma220/CMakeLists.txt
deleted file mode 100644
index fcea4bb..0000000
--- a/peripheral/libupm/src/bma220/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "bma220")
-set (libdescription "accelerometer sensor based on bma220")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/bma220/bma220.cxx b/peripheral/libupm/src/bma220/bma220.cxx
deleted file mode 100644
index 4148b93..0000000
--- a/peripheral/libupm/src/bma220/bma220.cxx
+++ /dev/null
@@ -1,531 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <stdexcept>
-#include <string>
-#include <string.h>
-
-#include "bma220.h"
-
-using namespace upm;
-using namespace std;
-
-
-BMA220::BMA220(int bus, uint8_t addr) :
- m_i2c(bus), m_gpioIntr(0)
-{
- m_addr = addr;
-
- m_accelX = 0.0;
- m_accelY = 0.0;
- m_accelZ = 0.0;
-
- m_accelScale = 0.0;
-
- mraa::Result rv;
- if ( (rv = m_i2c.address(m_addr)) != mraa::SUCCESS)
- {
- throw std::runtime_error(string(__FUNCTION__) +
- ": I2c.address() failed");
- return;
- }
-
- // Init the accelerometer
- enableAxes(true, true, true);
-
- // set scaling rate
- if (!setAccelerometerScale(FSL_RANGE_2G))
- {
- throw std::runtime_error(string(__FUNCTION__) +
- ": Unable to set accel scale");
- return;
- }
-}
-
-BMA220::~BMA220()
-{
- uninstallISR();
-}
-
-void BMA220::update()
-{
- updateAccelerometer();
-}
-
-void BMA220::updateAccelerometer()
-{
- int x, y, z;
- char buf = 0;
-
- buf = (char)readReg(REG_ACC_X);
- x = int(buf) / 4;
-
- buf = (char)readReg(REG_ACC_Y);
- y = int(buf) / 4;
-
- buf = (char)readReg(REG_ACC_Z);
- z = int(buf) / 4;
-
- m_accelX = float(x);
- m_accelY = float(y);
- m_accelZ = float(z);
-}
-
-uint8_t BMA220::readReg(uint8_t reg)
-{
- return m_i2c.readReg(reg);
-}
-
-bool BMA220::writeReg(uint8_t reg, uint8_t val)
-{
- mraa::Result rv;
- if ((rv = m_i2c.writeReg(reg, val)) != mraa::SUCCESS)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": I2c.writeReg() failed");
- return false;
- }
-
- return true;
-}
-
-bool BMA220::setAccelerometerScale(FSL_RANGE_T scale)
-{
- uint8_t reg = readReg(REG_SBIST_FSL_CONFIG);
-
- reg &= ~(_REG_SBIST_FSL_RANGE_MASK << _REG_SBIST_FSL_RANGE_SHIFT);
-
- reg |= (scale << _REG_SBIST_FSL_RANGE_SHIFT);
-
- if (!writeReg(REG_SBIST_FSL_CONFIG, reg))
- {
- return false;
- }
-
- // store scaling factor
-
- switch (scale)
- {
- case FSL_RANGE_2G:
- m_accelScale = 16.0;
- break;
-
- case FSL_RANGE_4G:
- m_accelScale = 8.0;
- break;
-
- case FSL_RANGE_8G:
- m_accelScale = 4.0;
- break;
-
- case FSL_RANGE_16G:
- m_accelScale = 2.0;
- break;
-
- default: // should never occur, but...
- m_accelScale = 0.0; // set a safe, though incorrect value
- throw std::logic_error(string(__FUNCTION__) +
- ": internal error, unsupported scale");
- break;
- }
-
- return true;
-}
-
-void BMA220::getAccelerometer(float *x, float *y, float *z)
-{
- if (x)
- *x = m_accelX / m_accelScale;
-
- if (y)
- *y = m_accelY / m_accelScale;
-
- if (z)
- *z = m_accelZ / m_accelScale;
-}
-
-#ifdef JAVACALLBACK
-float *BMA220::getAccelerometer()
-{
- float *v = new float[3];
- getAccelerometer(&v[0], &v[1], &v[2]);
- return v;
-}
-#endif
-
-uint8_t BMA220::getChipID()
-{
- return readReg(REG_CHIPID);
-}
-
-uint8_t BMA220::getChipRevision()
-{
- return readReg(REG_REVISIONID);
-}
-
-bool BMA220::setFilterConfig(FILTER_CONFIG_T filter)
-{
- uint8_t reg = readReg(REG_FILTER_CONFIG);
-
- reg &= ~(_FILTER_CONFIG_FILTER_MASK << _FILTER_CONFIG_FILTER_SHIFT);
-
- reg |= (filter << _FILTER_CONFIG_FILTER_SHIFT);
-
- return writeReg(REG_FILTER_CONFIG, reg);
-}
-
-bool BMA220::setSerialHighBW(bool high)
-{
- uint8_t reg = readReg(REG_FILTER_CONFIG);
-
- if (high)
- reg |= FILTER_CONFIG_SERIAL_HIGH_BW;
- else
- reg &= ~FILTER_CONFIG_SERIAL_HIGH_BW;
-
- return writeReg(REG_FILTER_CONFIG, reg);
-}
-
-bool BMA220::enableAxes(bool xEn, bool yEn, bool zEn)
-{
- uint8_t reg = readReg(REG_ENABLE_CONFIG3);
-
- if (xEn)
- reg |= ENABLE_CONFIG3_X_CHAN;
- else
- reg &= ~ENABLE_CONFIG3_X_CHAN;
-
- if (yEn)
- reg |= ENABLE_CONFIG3_Y_CHAN;
- else
- reg &= ~ENABLE_CONFIG3_Y_CHAN;
-
- if (zEn)
- reg |= ENABLE_CONFIG3_Z_CHAN;
- else
- reg &= ~ENABLE_CONFIG3_Z_CHAN;
-
- return writeReg(REG_ENABLE_CONFIG3, reg);
-}
-
-uint8_t BMA220::suspend()
-{
- return readReg(REG_SUSPEND);
-}
-
-uint8_t BMA220::softReset()
-{
- return readReg(REG_SOFTRESET);
-}
-
-bool BMA220::sleep(bool enable)
-{
- uint8_t reg = readReg(REG_ENABLE_CONFIG3);
-
- if (enable)
- reg |= ENABLE_CONFIG3_SLEEP_EN;
- else
- reg &= ~ENABLE_CONFIG3_SLEEP_EN;
-
- return writeReg(REG_ENABLE_CONFIG3, reg);
-}
-
-bool BMA220::setSleepDuration(SLEEP_DUR_T dur)
-{
- uint8_t reg = readReg(REG_ENABLE_CONFIG3);
-
- reg &= ~(_ENABLE_CONFIG3_SLEEP_DUR_MASK << _ENABLE_CONFIG3_SLEEP_DUR_SHIFT);
-
- reg |= (dur << _ENABLE_CONFIG3_SLEEP_DUR_SHIFT);
-
- return writeReg(REG_ENABLE_CONFIG3, reg);
-}
-
-bool BMA220::setLowGThreshold(uint8_t thresh)
-{
- uint8_t reg = readReg(REG_THRESHOLD);
-
- thresh &= 0x0f;
-
- reg &= ~(_THRESHOLD_LOW_MASK << _THRESHOLD_LOW_SHIFT);
-
- reg |= (thresh << _THRESHOLD_LOW_SHIFT);
-
- return writeReg(REG_THRESHOLD, reg);
-}
-
-bool BMA220::setHighGThreshold(uint8_t thresh)
-{
- uint8_t reg = readReg(REG_THRESHOLD);
-
- thresh &= 0x0f;
-
- reg &= ~(_THRESHOLD_HIGH_MASK << _THRESHOLD_HIGH_SHIFT);
-
- reg |= (thresh << _THRESHOLD_HIGH_SHIFT);
-
- return writeReg(REG_THRESHOLD, reg);
-}
-
-bool BMA220::setLowGHysteresis(uint8_t hyst)
-{
- uint8_t reg = readReg(REG_L_HYST_DUR);
-
- hyst &= _L_HYST_DUR_LOW_HY_MASK;
-
- reg &= ~(_L_HYST_DUR_LOW_HY_MASK << _L_HYST_DUR_LOW_HY_SHIFT);
-
- reg |= (hyst << _L_HYST_DUR_LOW_HY_SHIFT);
-
- return writeReg(REG_L_HYST_DUR, reg);
-}
-
-bool BMA220::setLowGDuration(uint8_t dur)
-{
- uint8_t reg = readReg(REG_L_HYST_DUR);
-
- dur &= _L_HYST_DUR_LOW_DUR_MASK;
-
- reg &= ~(_L_HYST_DUR_LOW_DUR_MASK << _L_HYST_DUR_LOW_DUR_SHIFT);
-
- reg |= (dur << _L_HYST_DUR_LOW_DUR_SHIFT);
-
- return writeReg(REG_L_HYST_DUR, reg);
-}
-
-bool BMA220::setHighGHysteresis(uint8_t hyst)
-{
- uint8_t reg = readReg(REG_H_HYST_DUR);
-
- hyst &= _H_HYST_DUR_HIGH_HY_MASK;
-
- reg &= ~(_H_HYST_DUR_HIGH_HY_MASK << _H_HYST_DUR_HIGH_HY_SHIFT);
-
- reg |= (hyst << _H_HYST_DUR_HIGH_HY_SHIFT);
-
- return writeReg(REG_H_HYST_DUR, reg);
-}
-
-bool BMA220::setHighGDuration(uint8_t dur)
-{
- uint8_t reg = readReg(REG_H_HYST_DUR);
-
- dur &= _H_HYST_DUR_HIGH_DUR_MASK;
-
- reg &= ~(_H_HYST_DUR_HIGH_DUR_MASK << _H_HYST_DUR_HIGH_DUR_SHIFT);
-
- reg |= (dur << _H_HYST_DUR_HIGH_DUR_SHIFT);
-
- return writeReg(REG_H_HYST_DUR, reg);
-}
-
-bool BMA220::setTapDuration(uint8_t dur)
-{
- uint8_t reg = readReg(REG_TAP_CONFIG);
-
- dur &= _TAP_CONFIG_DUR_MASK;
-
- reg &= ~(_TAP_CONFIG_DUR_MASK << _TAP_CONFIG_DUR_SHIFT);
-
- reg |= (dur << _TAP_CONFIG_DUR_SHIFT);
-
- return writeReg(REG_TAP_CONFIG, reg);
-}
-
-bool BMA220::setTapThreshold(uint8_t thresh)
-{
- uint8_t reg = readReg(REG_TAP_CONFIG);
-
- thresh &= _TAP_CONFIG_THRESH_MASK;
-
- reg &= ~(_TAP_CONFIG_THRESH_MASK << _TAP_CONFIG_THRESH_SHIFT);
-
- reg |= (thresh << _TAP_CONFIG_THRESH_SHIFT);
-
- return writeReg(REG_TAP_CONFIG, reg);
-}
-
-bool BMA220::enableTapFilter(bool filt)
-{
- uint8_t reg = readReg(REG_TAP_CONFIG);
-
- if (filt)
- reg |= TAP_CONFIG_FILTER;
- else
- reg &= ~TAP_CONFIG_FILTER;
-
- return writeReg(REG_TAP_CONFIG, reg);
-}
-
-bool BMA220::setSlopeDuration(uint8_t dur)
-{
- uint8_t reg = readReg(REG_SLOPE_CONFIG);
-
- dur &= _SLOPE_CONFIG_DUR_MASK;
-
- reg &= ~(_SLOPE_CONFIG_DUR_MASK << _SLOPE_CONFIG_DUR_SHIFT);
-
- reg |= (dur << _SLOPE_CONFIG_DUR_SHIFT);
-
- return writeReg(REG_SLOPE_CONFIG, reg);
-}
-
-bool BMA220::setSlopeThreshold(uint8_t thresh)
-{
- uint8_t reg = readReg(REG_SLOPE_CONFIG);
-
- thresh &= _SLOPE_CONFIG_THRESH_MASK;
-
- reg &= ~(_SLOPE_CONFIG_THRESH_MASK << _SLOPE_CONFIG_THRESH_SHIFT);
-
- reg |= (thresh << _SLOPE_CONFIG_THRESH_SHIFT);
-
- return writeReg(REG_SLOPE_CONFIG, reg);
-}
-
-bool BMA220::enableSlopeFilter(bool filt)
-{
- uint8_t reg = readReg(REG_SLOPE_CONFIG);
-
- if (filt)
- reg |= SLOPE_CONFIG_FILTER;
- else
- reg &= ~SLOPE_CONFIG_FILTER;
-
- return writeReg(REG_SLOPE_CONFIG, reg);
-}
-
-uint8_t BMA220::getInterruptStatus1()
-{
- return (readReg(REG_INT_STATUS1) & 0x8f);
-}
-
-BMA220::CONFIG_ORIENT_T BMA220::getOrient()
-{
- uint8_t reg = readReg(REG_INT_STATUS2);
-
- reg &= (_INT_STATUS1_ORIENT_MASK << _INT_STATUS1_ORIENT_SHIFT);
-
- reg >>= _INT_STATUS1_ORIENT_SHIFT;
-
- return (CONFIG_ORIENT_T)reg;
-}
-
-uint8_t BMA220::getInterruptStatus2()
-{
- return (readReg(REG_INT_STATUS2) & 0x1f);
-}
-
-bool BMA220::setInterruptEnables1(uint8_t bits)
-{
- return writeReg(REG_ENABLE_CONFIG, bits);
-}
-
-uint8_t BMA220::getInterruptEnables1()
-{
- return readReg(REG_ENABLE_CONFIG);
-}
-
-bool BMA220::setInterruptEnables2(uint8_t bits)
-{
- uint8_t reg = readReg(REG_ENABLE_CONFIG2);
-
- // only the first 4 bits...
- bits &= 0x0f;
- reg &= 0x0f;
-
- reg |= bits;
-
- return writeReg(REG_ENABLE_CONFIG2, reg);
-}
-
-uint8_t BMA220::getInterruptEnables2()
-{
- return (readReg(REG_ENABLE_CONFIG2) & 0x0f);
-}
-
-bool BMA220::setInterruptLatch(CONFIG2_LAT_T lat)
-{
- uint8_t reg = readReg(REG_ENABLE_CONFIG2);
-
- reg &= ~(_ENABLE_CONFIG2_LAT_INT_MASK << _ENABLE_CONFIG2_LAT_INT_SHIFT);
-
- reg |= (lat << _ENABLE_CONFIG2_LAT_INT_SHIFT);
-
- return writeReg(REG_ENABLE_CONFIG2, reg);
-}
-
-bool BMA220::resetInterrupts()
-{
- // This resets the interrupt controller, and should be called
- // whenever the interrupt configuration changes
- uint8_t reg = readReg(REG_ENABLE_CONFIG2);
-
- reg |= ENABLE_CONFIG2_RESET_INT;
-
- return writeReg(REG_ENABLE_CONFIG2, reg);
-}
-
-#if defined(SWIGJAVA) || (JAVACALLBACK)
-void BMA220::installISR(int gpio, mraa::Edge level,
- jobject runnable)
-{
- // delete any existing ISR and GPIO context
- uninstallISR();
-
- // create gpio context
- m_gpioIntr = new mraa::Gpio(gpio);
-
- m_gpioIntr->dir(mraa::DIR_IN);
- m_gpioIntr->isr(level, runnable);
-
-}
-#else
-void BMA220::installISR(int gpio, mraa::Edge level,
- void (*isr)(void *), void *arg)
-{
- // delete any existing ISR and GPIO context
- uninstallISR();
-
- // create gpio context
- m_gpioIntr = new mraa::Gpio(gpio);
-
- m_gpioIntr->dir(mraa::DIR_IN);
- m_gpioIntr->isr(level, isr, arg);
-}
-#endif
-
-void BMA220::uninstallISR()
-{
- if (m_gpioIntr)
- {
- m_gpioIntr->isrExit();
- delete m_gpioIntr;
-
- m_gpioIntr = 0;
- }
-}
-
diff --git a/peripheral/libupm/src/bma220/bma220.h b/peripheral/libupm/src/bma220/bma220.h
deleted file mode 100644
index e361d48..0000000
--- a/peripheral/libupm/src/bma220/bma220.h
+++ /dev/null
@@ -1,831 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include <mraa/common.hpp>
-#include <mraa/i2c.hpp>
-#include <mraa/gpio.hpp>
-
-#define BMA220_I2C_BUS 0
-#define BMA220_DEFAULT_ADDR 0x0a
-
-namespace upm {
-
- /**
- * @brief BMA220 Accelerometer library
- * @defgroup bma220 libupm-bma220
- * @ingroup i2c gpio accelerometer
- */
-
- /**
- * @library bma220
- * @sensor bma220
- * @comname BMA220 3-axis Accelerometer
- * @type accelerometer
- * @man dfrobot
- * @con i2c gpio
- * @web http://www.dfrobot.com/index.php?route=product/product&product_id=1085
- *
- * @brief API for the BMA220 3-axis Accelerometer
- *
- * The BMA220 is a low cost, very small 3-axis accelerometer with 6
- * bits of resolution. It can also detect orientation and tap events.
- *
- * The BMA220 has a linear acceleration full scale of
- * 2g/4g/8g/16g.
- *
- * While not all of the functionality of this device is supported
- * initially, methods and register definitions are provided that
- * should allow an end user to implement whatever features are
- * required.
- *
- * This driver was developed on a DFRobot BMA (Tiny).
- *
- * @image html bma220.jpg
- * @snippet bma220.cxx Interesting
- */
-
- class BMA220 {
- public:
-
- // NOTE: reserved registers must not be written into or read from.
- // Reserved bitfields must always be 0. The registers aren't
- // named in the datasheet, so I made up some hopefully useful
- // names for them. The whole I2C register map design is a little
- // strange, IMO.
-
- /**
- * BMA220 Accelerometer registers
- */
- typedef enum {
- REG_CHIPID = 0x00,
- REG_REVISIONID = 0x02,
-
- // 2 lsb bits of ACC regs are always 0, yeilding 6 bits resolution
- REG_ACC_X = 0x04, // acceleration data
- REG_ACC_Y = 0x06,
- REG_ACC_Z = 0x08,
-
- REG_H_HYST_DUR = 0x0a, // high hysteresis/dur
- REG_THRESHOLD = 0x0c, // high/low threshold
- REG_L_HYST_DUR = 0x0e, // low hysteresis/dur
-
- REG_TAP_CONFIG = 0x10,
-
- REG_SLOPE_CONFIG = 0x12,
- REG_TAP_CONFIG2 = 0x14,
-
- REG_INT_STATUS1 = 0x16,
- REG_INT_STATUS2 = 0x18,
-
- REG_ENABLE_CONFIG = 0x1a,
- REG_ENABLE_CONFIG2 = 0x1c,
- REG_ENABLE_CONFIG3 = 0x1e,
-
- REG_FILTER_CONFIG = 0x20,
-
- REG_SBIST_FSL_CONFIG = 0x22, // self test and full scale range
-
- // 0x24 - 0x2c reserved
-
- REG_I2C_WATCHDOG = 0x2e, // + SPI 3-wire mode
-
- REG_SUSPEND = 0x30,
- REG_SOFTRESET = 0x32
- } REG_T;
-
-
- /**
- * REG_H_HYST_DUR bits
- */
- typedef enum {
- H_HYST_DUR_HIGH_DUR0 = 0x01,
- H_HYST_DUR_HIGH_DUR1 = 0x02,
- H_HYST_DUR_HIGH_DUR2 = 0x04,
- H_HYST_DUR_HIGH_DUR3 = 0x08,
- H_HYST_DUR_HIGH_DUR4 = 0x10,
- H_HYST_DUR_HIGH_DUR5 = 0x20,
- _H_HYST_DUR_HIGH_DUR_MASK = 63,
- _H_HYST_DUR_HIGH_DUR_SHIFT = 0,
-
- H_HYST_DUR_HIGH_HY1 = 0x40,
- H_HYST_DUR_HIGH_HY2 = 0x80,
- _H_HYST_DUR_HIGH_HY_MASK = 3,
- _H_HYST_DUR_HIGH_HY_SHIFT = 6
- } H_HYST_DUR_HIGH_BITS_T;
-
- /**
- * REG_THRESHOLD bits
- */
- typedef enum {
- THRESHOLD_HIGH0 = 0x01,
- THRESHOLD_HIGH1 = 0x02,
- THRESHOLD_HIGH2 = 0x04,
- THRESHOLD_HIGH3 = 0x08,
- _THRESHOLD_HIGH_MASK = 15,
- _THRESHOLD_HIGH_SHIFT = 0,
-
- THRESHOLD_LOW0 = 0x10,
- THRESHOLD_LOW1 = 0x20,
- THRESHOLD_LOW2 = 0x40,
- THRESHOLD_LOW3 = 0x80,
- _THRESHOLD_LOW_MASK = 15,
- _THRESHOLD_LOW_SHIFT = 4
- } THRESHOLD_BITS_T;
-
- /**
- * REG_L_HYST_DUR bits
- */
- typedef enum {
- L_HYST_DUR_LOW_DUR0 = 0x01,
- L_HYST_DUR_LOW_DUR1 = 0x02,
- L_HYST_DUR_LOW_DUR2 = 0x04,
- L_HYST_DUR_LOW_DUR3 = 0x08,
- L_HYST_DUR_LOW_DUR4 = 0x10,
- L_HYST_DUR_LOW_DUR5 = 0x20,
- _L_HYST_DUR_LOW_DUR_MASK = 63,
- _L_HYST_DUR_LOW_DUR_SHIFT = 0,
-
- L_HYST_DUR_LOW_HY1 = 0x40,
- L_HYST_DUR_LOW_HY2 = 0x80,
- _L_HYST_DUR_LOW_HY_MASK = 3,
- _L_HYST_DUR_LOW_HY_SHIFT = 6
- } L_HYST_DUR_LOW_BITS_T;
-
- /**
- * REG_TAP_CONFIG bits
- */
- typedef enum {
- TAP_CONFIG_DUR0 = 0x01,
- TAP_CONFIG_DUR1 = 0x02,
- TAP_CONFIG_DUR2 = 0x04,
- _TAP_CONFIG_DUR_MASK = 7,
- _TAP_CONFIG_DUR_SHIFT = 0,
-
- TAP_CONFIG_THRESH0 = 0x08,
- TAP_CONFIG_THRESH1 = 0x10,
- TAP_CONFIG_THRESH2 = 0x20,
- TAP_CONFIG_THRESH3 = 0x40,
- _TAP_CONFIG_THRESH_MASK = 15,
- _TAP_CONFIG_THRESH_SHIFT = 3,
-
- TAP_CONFIG_FILTER = 0x80
- } TAP_CONFIG_BITS_T;
-
- /**
- * REG_SLOPE_CONFIG bits
- */
- typedef enum {
- SLOPE_CONFIG_DUR0 = 0x01,
- SLOPE_CONFIG_DUR1 = 0x02,
- _SLOPE_CONFIG_DUR_MASK = 3,
- _SLOPE_CONFIG_DUR_SHIFT = 0,
-
- SLOPE_CONFIG_THRESH0 = 0x04,
- SLOPE_CONFIG_THRESH1 = 0x08,
- SLOPE_CONFIG_THRESH2 = 0x10,
- SLOPE_CONFIG_THRESH3 = 0x20,
- _SLOPE_CONFIG_THRESH_MASK = 15,
- _SLOPE_CONFIG_THRESH_SHIFT = 2,
-
- SLOPE_CONFIG_FILTER = 0x40,
- SLOPE_CONFIG_ORIENT_EX = 0x80 // exchange x and z axis for orient
- } SLOPE_CONFIG_BITS_T;
-
- /**
- * REG_TAP_CONFIG2 bits
- */
- typedef enum {
- TAP_CONFIG2_SAMP0 = 0x01,
- TAP_CONFIG2_SAMP1 = 0x02,
- _TAP_CONFIG2_SAMP_MASK = 3,
- _TAP_CONFIG2_SAMP_SHIFT = 0,
-
- TAP_CONFIG2_ORIENT_BLOCK0 = 0x04,
- TAP_CONFIG2_ORIENT_BLOCK1 = 0x08,
- _TAP_CONFIG2_ORIENT_BLOCK_MASK = 3,
- _TAP_CONFIG2_ORIENT_BLOCK_SHIFT = 2,
-
- TAP_CONFIG2_TIP_EN = 0x10
-
- // 0x20-0x80 reserved
- } TAP_CONFIG2_BITS_T;
-
- /**
- * TAP_CONFIG2_SAMP values
- */
- typedef enum {
- TAP_SAMP_2 = 0, // 2 data samples after wakeup
- TAP_SAMP_4 = 1,
- TAP_SAMP_8 = 2,
- TAP_SAMP_16 = 3
- } TAP_SAMP_T;
-
- /**
- * TAP_CONFIG2_ORIENT_BLOCK values
- *
- */
- typedef enum {
- TAP_ORIENT_BLOCK_0 = 0, // orient blocking disabled
- TAP_ORIENT_BLOCK_2 = 1, // |z|>0.9g OR |x|+|y| < 0.2g OR m<0.2g
- TAP_ORIENT_BLOCK_3 = 2, // |z|>0.9g OR |x|+|y| < 0.3g OR m<0.3g
- TAP_ORIENT_BLOCK_4 = 3, // |z|>0.9g OR |x|+|y| < 0.4g OR m<0.4g
- } TAP_ORIENT_BLOCK_T;
-
- /**
- * REG_INT_STATUS1 bits
- */
- typedef enum {
- INT_STATUS1_SIGN = 0x01,
- INT_STATUS1_FIRST_Z = 0x02,
- INT_STATUS1_FIRST_Y = 0x04,
- INT_STATUS1_FIRST_X = 0x08,
-
- INT_STATUS1_ORIENT0 = 0x10,
- INT_STATUS1_ORIENT1 = 0x20,
- INT_STATUS1_ORIENT2 = 0x40,
- _INT_STATUS1_ORIENT_MASK = 7,
- _INT_STATUS1_ORIENT_SHIFT = 4,
-
- INT_STATUS1_ORIENT_INT = 0x80 // orient intr was generated
- } INT_STATUS1_BITS_T;
-
- /**
- * INT_STATUS1_ORIENT values
- *
- * These are values reported by the device if orientation
- * detection is enabled.
- */
- typedef enum {
- CONFIG_ORI_UP_PORT_UPRIGHT = 0, // up portrait
- CONFIG_ORI_UP_PORT_UPSIDE_DOWN = 1,
- CONFIG_ORI_UP_LAND_LEFT = 2, // landscape
- CONFIG_ORI_UP_LAND_RIGHT = 3,
- CONFIG_ORI_DN_PORT_UPRIGHT = 4, // down portrait
- CONFIG_ORI_DN_PORT_UPSIDE_DOWN = 5,
- CONFIG_ORI_DN_LAND_LEFT = 6, // landscape
- CONFIG_ORI_DN_LAND_RIGHT = 7
- } CONFIG_ORIENT_T;
-
- /**
- * REG_INT_STATUS2 bits
- */
- typedef enum {
- INT_STATUS2_SLOPE = 0x01,
- INT_STATUS2_DATA = 0x02,
- INT_STATUS2_HIGH = 0x04,
- INT_STATUS2_LOW = 0x08,
- INT_STATUS2_TAP = 0x10
-
- // 0x20-0x80 reserved
- } INT_STATUS2_BITS_T;
-
- /**
- * REG_ENABLE_CONFIG bits
- */
- typedef enum {
- ENABLE_CONFIG_TT_Z = 0x01,
- ENABLE_CONFIG_TT_Y = 0x02,
- ENABLE_CONFIG_TT_X = 0x04,
- ENABLE_CONFIG_SLOPE_Z = 0x08,
- ENABLE_CONFIG_SLOPE_Y = 0x10,
- ENABLE_CONFIG_SLOPE_X = 0x20,
- ENABLE_CONFIG_ORIENT = 0x40,
- ENABLE_CONFIG_DATA = 0x80
- } ENABLE_CONFIG_BITS_T;
-
- /**
- * REG_ENABLE_CONFIG2 bits
- */
- typedef enum {
- ENABLE_CONFIG2_HIGH_Z = 0x01,
- ENABLE_CONFIG2_HIGH_Y = 0x02,
- ENABLE_CONFIG2_HIGH_X = 0x04,
-
- ENABLE_CONFIG2_LOW = 0x08,
-
- ENABLE_CONFIG2_LAT_INT0 = 0x10, // interrupt latching
- ENABLE_CONFIG2_LAT_INT1 = 0x20,
- ENABLE_CONFIG2_LAT_INT2 = 0x40,
- _ENABLE_CONFIG2_LAT_INT_MASK = 7,
- _ENABLE_CONFIG2_LAT_INT_SHIFT = 4,
-
- ENABLE_CONFIG2_RESET_INT = 0x80 // reset interrupts
- } ENABLE_CONFIG2_BITS_T;
-
- /**
- * ENABLE_CONFIG2_LAT values
- *
- * These are values that define the interrupt latching behavior
- */
- typedef enum {
- CONFIG2_LAT_UNLATCH = 0, // unlatched intrs
- CONFIG2_LAT_0_25 = 1, // latch intr for 0.25s
- CONFIG2_LAT_0_5 = 2, // latch intr for 0.5s
- CONFIG2_LAT_1 = 3, // latch intr for 1s
- CONFIG2_LAT_2 = 4, // latch intr for 2s
- CONFIG2_LAT_4 = 5, // latch intr for 4s
- CONFIG2_LAT_8 = 6, // latch intr for 8s
- CONFIG2_LAT_PERM = 7 // latch permanently
- } CONFIG2_LAT_T;
-
- /**
- * REG_ENABLE_CONFIG3 bits
- */
- typedef enum {
- ENABLE_CONFIG3_Z_CHAN = 0x01,
- ENABLE_CONFIG3_Y_CHAN = 0x02,
- ENABLE_CONFIG3_X_CHAN = 0x04,
-
- ENABLE_CONFIG3_SLEEP_DUR0 = 0x08,
- ENABLE_CONFIG3_SLEEP_DUR1 = 0x10,
- ENABLE_CONFIG3_SLEEP_DUR2 = 0x20,
- _ENABLE_CONFIG3_SLEEP_DUR_MASK = 7,
- _ENABLE_CONFIG3_SLEEP_DUR_SHIFT = 3,
-
- ENABLE_CONFIG3_SLEEP_EN = 0x40
-
- // 0x80 reserved
- } ENABLE_CONFIG3_BITS_T;
-
- /**
- * ENABLE_CONFIG3_SLEEP_DUR values
- *
- * These are values that define the length of time the device
- * sleeps before sampling when in sleep mode.
- */
- typedef enum {
- SLEEP_DUR_2MS = 0, // 2 ms
- SLEEP_DUR_10MS = 1,
- SLEEP_DUR_25MS = 2,
- SLEEP_DUR_50MS = 3,
- SLEEP_DUR_100MS = 4,
- SLEEP_DUR_500MS = 5,
- SLEEP_DUR_1S = 6, // 1 second
- SLEEP_DUR_2S = 7
- } SLEEP_DUR_T;
-
- /**
- * REG_FILTER_CONFIG bits
- */
- typedef enum {
- FILTER_CONFIG_FILTER0 = 0x01,
- FILTER_CONFIG_FILTER1 = 0x02,
- FILTER_CONFIG_FILTER2 = 0x04,
- FILTER_CONFIG_FILTER3 = 0x08,
- _FILTER_CONFIG_FILTER_MASK = 15,
- _FILTER_CONFIG_FILTER_SHIFT = 0,
-
- // 0x10-0x40 reserved
-
- FILTER_CONFIG_SERIAL_HIGH_BW = 0x80
- } FILTER_CONFIG_BITS_T;
-
- /**
- * FILTER_CONFIG_FILTER values
- *
- * These are values that define the digital filtering frequency
- */
- typedef enum {
- FILTER_CONFIG_1KHZ = 0, // 1Khz
- FILTER_CONFIG_500HZ = 1,
- FILTER_CONFIG_250HZ = 2,
- FILTER_CONFIG_125HZ = 3,
- FILTER_CONFIG_64HZ = 4,
- FILTER_CONFIG_32HZ = 5
- } FILTER_CONFIG_T;
-
- /**
- * REG_SBIST_FSL_CONFIG bits
- */
- typedef enum {
- REG_SBIST_FSL_RANGE0 = 0x01, // full scale range
- REG_SBIST_FSL_RANGE1 = 0x02,
- _REG_SBIST_FSL_RANGE_MASK = 3,
- _REG_SBIST_FSL_RANGE_SHIFT = 0,
-
- REG_SBIST_FSL_SBIST0 = 0x04, // self test enables
- REG_SBIST_FSL_SBIST1 = 0x08,
- _REG_SBIST_FSL_SBIST_MASK = 3,
- _REG_SBIST_FSL_SBIST_SHIFT = 2,
-
- REG_SBIST_FSL_SBIST_SIGN = 0x10 // signedness of self test
-
- // 0x20-0x80 reserved
- } SBIST_FSL_CONFIG_BITS_T;
-
- /**
- * REG_SBIST_FSL_RANGE values
- *
- * These are values that define the Full Scale configuration
- */
- typedef enum {
- FSL_RANGE_2G = 0, // 2G FSL
- FSL_RANGE_4G = 1,
- FSL_RANGE_8G = 2,
- FSL_RANGE_16G = 3
- } FSL_RANGE_T;
-
- /**
- * REG_SBIST_FSL_SBIST values
- *
- * These are values that enable self test mode
- */
- typedef enum {
- SBIST_OFF = 0, // self test off
- SBIST_X = 1, // self test X
- SBIST_Y = 2,
- SBIST_Z = 3
- } SBIST_T;
-
- /**
- * REG_I2C_WATCHDOG bits
- */
- typedef enum {
- I2C_WATCHDOG_SPI3 = 0x01, // SPI 3wire mode (SPI not supported)
-
- I2C_WATCHDOG_TO_SEL = 0x02,
- I2C_WATCHDOG_TO_EN = 0x04
-
- // 0x08-0x80 reserved
- } I2C_WATCHDOG_BITS_T;
-
-
- /**
- * BMA220 constructor
- *
- * @param bus i2c bus to use
- * @param address the address for this device
- */
- BMA220(int bus=BMA220_I2C_BUS, uint8_t addr=BMA220_DEFAULT_ADDR);
-
- /**
- * BMA220 Destructor
- */
- ~BMA220();
-
- /**
- * update the accelerometer values
- */
- void update();
-
- /**
- * read a register
- *
- * @param dev the device to access (XM or G)
- * @param reg the register to read
- * @return the value of the register
- */
- uint8_t readReg(uint8_t reg);
-
- /**
- * write to a register
- *
- * @param dev the device to access (XM or G)
- * @param reg the register to write to
- * @param val the value to write
- * @return true if successful, false otherwise
- */
- bool writeReg(uint8_t reg, uint8_t val);
-
- /**
- * return the chip ID
- *
- * @return the chip ID (usually 0xdd)
- */
- uint8_t getChipID();
-
- /**
- * return the chip revision
- *
- * @return the chip revision (usually 0x00)
- */
- uint8_t getChipRevision();
-
- /**
- * set the scaling mode of the accelerometer (2g/4g/8g/16g)
- *
- * @param scale one of the FSL_RANGE_T values
- * @return true if successful, false otherwise
- */
- bool setAccelerometerScale(FSL_RANGE_T scale);
-
- /**
- * get the accelerometer values in gravities
- *
- * @param x the returned x value, if arg is non-NULL
- * @param y the returned y value, if arg is non-NULL
- * @param z the returned z value, if arg is non-NULL
- */
- void getAccelerometer(float *x, float *y, float *z);
-
-#if defined(SWIGJAVA) || defined(JAVACALLBACK)
- /**
- * get the accelerometer values in gravities
- *
- * @return Array containing X, Y, Z acceleration values
- */
- float *getAccelerometer();
-#endif
-
- /**
- * set the filtering configuration
- *
- * @param filter one of the FILTER_CONFIG_T values
- * @return true if successful
- */
- bool setFilterConfig(FILTER_CONFIG_T filter);
-
- /**
- * enable or disable high bandwidth serial access (1Khz). This
- * essentially disables filtering and makes the raw unfiltered
- * data available in the axis registers.
- *
- * @param high true to enable high bw access, false otherwise
- * @return true if successful
- */
- bool setSerialHighBW(bool high);
-
- /**
- * enable or disable axis channels
- *
- * @param xEn true to enable the axis, false otherwise
- * @param yEn true to enable the axis, false otherwise
- * @param zEn true to enable the axis, false otherwise
- * @return true if successful
- */
- bool enableAxes(bool xEn, bool yEn, bool zEn);
-
- /**
- * place the device into, or take the device out of suspend mode
- *
- * @return 0x00 if the device was in active mode, 0xff if the
- * device was in suspend mode
- */
- uint8_t suspend();
-
- /**
- * place the device into, or take the device out of soft reset mode
- *
- * @return 0x00 if the device was in active mode, 0xff if the
- * device was in soft reset mode
- */
- uint8_t softReset();
-
- /**
- * place the device into, or take the device out of low power
- * mode. See the datasheet for information on how low power mode
- * is implemented on this device.
- *
- * @param enable true to set low power mode, false otherwise
- * @return true if successful
- */
- bool sleep(bool enable);
-
- /**
- * when in low power (sleep) mode, specify how often the device
- * wakes up to acquire samples.
- *
- * @param dur one of the SLEEP_DUR_T values
- * @return true if successful
- */
- bool setSleepDuration(SLEEP_DUR_T dur);
-
- /**
- * specify the threshold for low G detection
- *
- * @param thresh see the datasheet
- * @return true if successful
- */
- bool setLowGThreshold(uint8_t thresh);
-
- /**
- * specify the threshold for high G detection
- *
- * @param thresh see the datasheet
- * @return true if successful
- */
- bool setHighGThreshold(uint8_t thresh);
-
- /**
- * specify the hysteresis for low G detection
- *
- * @param hyst 2 bit hysteresis value
- * @return true if successful
- */
- bool setLowGHysteresis(uint8_t hyst);
-
- /**
- * specify the sample duration for low G detection
- *
- * @param dur the number of samples (depends on bandwidth)
- * @return true if successful
- */
- bool setLowGDuration(uint8_t dur);
-
- /**
- * specify the hysteresis for high G detection
- *
- * @param hyst 2 bit hysteresis value
- * @return true if successful
- */
- bool setHighGHysteresis(uint8_t hyst);
-
- /**
- * specify the sample duration for high G detection
- *
- * @param dur the number of samples (depends on bandwidth)
- * @return true if successful
- */
- bool setHighGDuration(uint8_t dur);
-
- /**
- * specify the sample duration for tap detection
- *
- * @param dur the number of samples (depends on bandwidth)
- * @return true if successful
- */
- bool setTapDuration(uint8_t dur);
-
- /**
- * specify the threshold for tap detection
- *
- * @param thresh see the datasheet
- * @return true if successful
- */
- bool setTapThreshold(uint8_t thresh);
-
- /**
- * unable to disable tap filtering
- *
- * @param filt true to enable, false otherwise
- * @return true if successful
- */
- bool enableTapFilter(bool filt);
-
- /**
- * specify the sample duration for slope detection
- *
- * @param dur the number of samples (depends on bandwidth)
- * @return true if successful
- */
- bool setSlopeDuration(uint8_t dur);
-
- /**
- * specify the threshold for slope detection
- *
- * @param thresh see the datasheet
- * @return true if successful
- */
- bool setSlopeThreshold(uint8_t thresh);
-
- /**
- * enable or disable slope filtering
- *
- * @param filt true to enable filtering, false otherwise
- * @return true if successful
- */
- bool enableSlopeFilter(bool filt);
-
- /**
- * return a bitmask of the interrupt status 1 register
- *
- * @return bitmask of INT_STATUS1_BITS_T bits (minus the orient value)
- */
- uint8_t getInterruptStatus1();
-
- /**
- * return the orient value from the interrupt status 1 register
- *
- * @return one of the CONFIG_ORIENT_T values
- */
- CONFIG_ORIENT_T getOrient();
-
- /**
- * return a bitmask of the interrupt status 2 register
- *
- * @return bitmask of INT_STATUS2_BITS_T bits
- */
- uint8_t getInterruptStatus2();
-
- /**
- * enable interrupts for events in interrupt config register 1
- *
- * @param bits bitmask of ENABLE_CONFIG_BITS_T values
- * @return true if successful
- */
- bool setInterruptEnables1(uint8_t bits);
-
- /**
- * return the enabled interrupts for events in interrupt config register 1
- *
- * @return bitmask of ENABLE_CONFIG_BITS_T values
- */
- uint8_t getInterruptEnables1();
-
- /**
- * enable interrupts for events in interrupt config register 2
- *
- * @param bits bitmask of ENABLE_CONFIG2_BITS_T values
- * @return true if successful
- */
- bool setInterruptEnables2(uint8_t bits);
-
- /**
- * return the enabled interrupts for events in interrupt config register 2
- *
- * @return bitmask of ENABLE_CONFIG2_BITS_T values
- */
- uint8_t getInterruptEnables2();
-
- /**
- * configure interrupt latching behavior
- *
- * @param lat one of the CONFIG2_LAT_T values
- * @return true if successful
- */
- bool setInterruptLatch(CONFIG2_LAT_T lat);
-
- /**
- * reset the interrupt controller. This should be called after
- * any changes are made to interrupt configuration, or to reset
- * interrupts if latched interrupts have been enabled and an
- * interrupt has occurred..
- *
- * @return true if successful
- */
- bool resetInterrupts();
-
-#if defined(SWIGJAVA) || defined(JAVACALLBACK)
- void installISR(int gpio, mraa::Edge level, jobject runnable);
-#else
- /**
- * install an interrupt handler.
- *
- * @param gpio gpio pin to use as interrupt pin
- * @param level the interrupt trigger level (one of mraa::Edge
- * values). Make sure that you have configured the interrupt pin
- * properly for whatever level you choose.
- * @param isr the interrupt handler, accepting a void * argument
- * @param arg the argument to pass the the interrupt handler
- */
- void installISR(int gpio, mraa::Edge level,
- void (*isr)(void *), void *arg);
-#endif
-
- /**
- * uninstall a previously installed interrupt handler
- *
- */
- void uninstallISR();
-
- protected:
- mraa::I2c m_i2c;
- mraa::Gpio *m_gpioIntr;
- uint8_t m_addr;
-
- // uncompensated accelerometer values
- float m_accelX;
- float m_accelY;
- float m_accelZ;
-
- // accelerometer full scale
- float m_accelScale;
-
- private:
- /**
- * update the accelerometer values
- */
- void updateAccelerometer();
- // Adding a private function definition for java bindings
-#if defined(SWIGJAVA) || defined(JAVACALLBACK)
- void installISR(int gpio, mraa::Edge level,
- void (*isr)(void *), void *arg);
-#endif
-
- };
-}
-
-
diff --git a/peripheral/libupm/src/bma220/javaupm_bma220.i b/peripheral/libupm/src/bma220/javaupm_bma220.i
deleted file mode 100644
index 82e1f56..0000000
--- a/peripheral/libupm/src/bma220/javaupm_bma220.i
+++ /dev/null
@@ -1,42 +0,0 @@
-%module javaupm_bma220
-%include "../upm.i"
-%include "cpointer.i"
-%include "typemaps.i"
-%include "arrays_java.i";
-%include "../java_buffer.i"
-
-%apply int {mraa::Edge};
-%apply float *INOUT { float *x, float *y, float *z };
-
-%typemap(jni) float* "jfloatArray"
-%typemap(jstype) float* "float[]"
-%typemap(jtype) float* "float[]"
-
-%typemap(javaout) float* {
- return $jnicall;
-}
-
-%typemap(out) float *getAccelerometer {
- $result = JCALL1(NewFloatArray, jenv, 3);
- JCALL4(SetFloatArrayRegion, jenv, $result, 0, 3, $1);
- delete [] $1;
-}
-
-%ignore getAccelerometer(float *, float *, float *);
-
-%{
- #include "bma220.h"
-%}
-
-%include "bma220.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_bma220");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%}
diff --git a/peripheral/libupm/src/bma220/jsupm_bma220.i b/peripheral/libupm/src/bma220/jsupm_bma220.i
deleted file mode 100644
index fa25b7f..0000000
--- a/peripheral/libupm/src/bma220/jsupm_bma220.i
+++ /dev/null
@@ -1,11 +0,0 @@
-%module jsupm_bma220
-%include "../upm.i"
-%include "cpointer.i"
-
-%pointer_functions(float, floatp);
-
-%include "bma220.h"
-%{
- #include "bma220.h"
-%}
-
diff --git a/peripheral/libupm/src/bma220/pyupm_bma220.i b/peripheral/libupm/src/bma220/pyupm_bma220.i
deleted file mode 100644
index 30f16b7..0000000
--- a/peripheral/libupm/src/bma220/pyupm_bma220.i
+++ /dev/null
@@ -1,17 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_bma220
-%include "../upm.i"
-%include "cpointer.i"
-
-%include "stdint.i"
-
-%feature("autodoc", "3");
-
-%pointer_functions(float, floatp);
-
-%include "bma220.h"
-%{
- #include "bma220.h"
-%}
-
diff --git a/peripheral/libupm/src/bmpx8x/CMakeLists.txt b/peripheral/libupm/src/bmpx8x/CMakeLists.txt
deleted file mode 100644
index 5960e12..0000000
--- a/peripheral/libupm/src/bmpx8x/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "bmpx8x")
-set (libdescription "upm BMPX8X")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/bmpx8x/bmpx8x.cxx b/peripheral/libupm/src/bmpx8x/bmpx8x.cxx
deleted file mode 100644
index 058e265..0000000
--- a/peripheral/libupm/src/bmpx8x/bmpx8x.cxx
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <string>
-#include <stdexcept>
-#include <unistd.h>
-#include <stdlib.h>
-
-#include "bmpx8x.h"
-
-using namespace upm;
-
-BMPX8X::BMPX8X (int bus, int devAddr, uint8_t mode) : m_controlAddr(devAddr), m_i2ControlCtx(bus) {
-
- m_name = "BMPX8X";
-
- mraa::Result ret = m_i2ControlCtx.address(m_controlAddr);
- if (ret != mraa::SUCCESS) {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_i2c_address() failed");
- return;
- }
-
- if (i2cReadReg_8 (0xD0) != 0x55) {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": Invalid chip ID");
- return;
- }
-
- if (mode > BMP085_ULTRAHIGHRES) {
- mode = BMP085_ULTRAHIGHRES;
- }
- oversampling = mode;
-
- /* read calibration data */
- ac1 = i2cReadReg_16 (BMP085_CAL_AC1);
- ac2 = i2cReadReg_16 (BMP085_CAL_AC2);
- ac3 = i2cReadReg_16 (BMP085_CAL_AC3);
- ac4 = i2cReadReg_16 (BMP085_CAL_AC4);
- ac5 = i2cReadReg_16 (BMP085_CAL_AC5);
- ac6 = i2cReadReg_16 (BMP085_CAL_AC6);
-
- b1 = i2cReadReg_16 (BMP085_CAL_B1);
- b2 = i2cReadReg_16 (BMP085_CAL_B2);
-
- mb = i2cReadReg_16 (BMP085_CAL_MB);
- mc = i2cReadReg_16 (BMP085_CAL_MC);
- md = i2cReadReg_16 (BMP085_CAL_MD);
-}
-
-int32_t
-BMPX8X::getPressure () {
- int32_t UT, UP, B3, B5, B6, X1, X2, X3, p;
- uint32_t B4, B7;
-
- UT = getTemperatureRaw();
- UP = getPressureRaw();
- B5 = computeB5(UT);
-
- // do pressure calcs
- B6 = B5 - 4000;
- X1 = ((int32_t)b2 * ( (B6 * B6)>>12 )) >> 11;
- X2 = ((int32_t)ac2 * B6) >> 11;
- X3 = X1 + X2;
- B3 = ((((int32_t)ac1*4 + X3) << oversampling) + 2) / 4;
-
- X1 = ((int32_t)ac3 * B6) >> 13;
- X2 = ((int32_t)b1 * ((B6 * B6) >> 12)) >> 16;
- X3 = ((X1 + X2) + 2) >> 2;
- B4 = ((uint32_t)ac4 * (uint32_t)(X3 + 32768)) >> 15;
- B7 = ((uint32_t)UP - B3) * (uint32_t)( 50000UL >> oversampling );
-
- if (B7 < 0x80000000) {
- p = (B7 * 2) / B4;
- } else {
- p = (B7 / B4) * 2;
- }
- X1 = (p >> 8) * (p >> 8);
- X1 = (X1 * 3038) >> 16;
- X2 = (-7357 * p) >> 16;
-
- p = p + ((X1 + X2 + (int32_t)3791)>>4);
-
- return p;
-}
-
-int32_t
-BMPX8X::getPressureRaw () {
- uint32_t raw;
-
- i2cWriteReg (BMP085_CONTROL, BMP085_READPRESSURECMD + (oversampling << 6));
-
- if (oversampling == BMP085_ULTRALOWPOWER) {
- usleep(5000);
- } else if (oversampling == BMP085_STANDARD) {
- usleep(8000);
- } else if (oversampling == BMP085_HIGHRES) {
- usleep(14000);
- } else {
- usleep(26000);
- }
-
- raw = i2cReadReg_16 (BMP085_PRESSUREDATA);
-
- raw <<= 8;
- raw |= i2cReadReg_8 (BMP085_PRESSUREDATA + 2);
- raw >>= (8 - oversampling);
-
- return raw;
-}
-
-int16_t
-BMPX8X::getTemperatureRaw () {
- i2cWriteReg (BMP085_CONTROL, BMP085_READTEMPCMD);
- usleep(5000);
- return i2cReadReg_16 (BMP085_TEMPDATA);
-}
-
-float
-BMPX8X::getTemperature () {
- int32_t UT, B5; // following ds convention
- float temp;
-
- UT = getTemperatureRaw ();
-
- B5 = computeB5 (UT);
- temp = (B5 + 8) >> 4;
- temp /= 10;
-
- return temp;
-}
-
-int32_t
-BMPX8X::getSealevelPressure(float altitudeMeters) {
- float pressure = getPressure ();
- return (int32_t)(pressure / pow(1.0-altitudeMeters/44330, 5.255));
-}
-
-float
-BMPX8X::getAltitude (float sealevelPressure) {
- float altitude;
-
- float pressure = getPressure ();
-
- altitude = 44330 * (1.0 - pow(pressure /sealevelPressure,0.1903));
-
- return altitude;
-}
-
-int32_t
-BMPX8X::computeB5(int32_t UT) {
- int32_t X1 = (UT - (int32_t)ac6) * ((int32_t)ac5) >> 15;
- int32_t X2 = ((int32_t)mc << 11) / (X1+(int32_t)md);
-
- return X1 + X2;
-}
-
-mraa::Result
-BMPX8X::i2cWriteReg (uint8_t reg, uint8_t value) {
- mraa::Result error = mraa::SUCCESS;
-
- uint8_t data[2] = { reg, value };
- error = m_i2ControlCtx.address (m_controlAddr);
- error = m_i2ControlCtx.write (data, 2);
-
- return error;
-}
-
-uint16_t
-BMPX8X::i2cReadReg_16 (int reg) {
- uint16_t data;
-
- m_i2ControlCtx.address(m_controlAddr);
- m_i2ControlCtx.writeByte(reg);
-
- m_i2ControlCtx.address(m_controlAddr);
- m_i2ControlCtx.read((uint8_t *)&data, 0x2);
-
- uint8_t high = (data & 0xFF00) >> 8;
- data = (data << 8) & 0xFF00;
- data |= high;
-
- return data;
-}
-
-uint8_t
-BMPX8X::i2cReadReg_8 (int reg) {
- uint8_t data;
-
- m_i2ControlCtx.address(m_controlAddr);
- m_i2ControlCtx.writeByte(reg);
-
- m_i2ControlCtx.address(m_controlAddr);
- m_i2ControlCtx.read(&data, 0x1);
-
- return data;
-}
diff --git a/peripheral/libupm/src/bmpx8x/bmpx8x.h b/peripheral/libupm/src/bmpx8x/bmpx8x.h
deleted file mode 100644
index a58ef08..0000000
--- a/peripheral/libupm/src/bmpx8x/bmpx8x.h
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Contributions: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Credits to Adafruit.
- * Based on Adafruit BMP085 library.
- *
- * 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 <string>
-#include <mraa/i2c.hpp>
-#include <math.h>
-
-#define ADDR 0x77 // device address
-
-// registers address
-#define BMP085_ULTRALOWPOWER 0
-#define BMP085_STANDARD 1
-#define BMP085_HIGHRES 2
-#define BMP085_ULTRAHIGHRES 3
-#define BMP085_CAL_AC1 0xAA // R Calibration data (16 bits)
-#define BMP085_CAL_AC2 0xAC // R Calibration data (16 bits)
-#define BMP085_CAL_AC3 0xAE // R Calibration data (16 bits)
-#define BMP085_CAL_AC4 0xB0 // R Calibration data (16 bits)
-#define BMP085_CAL_AC5 0xB2 // R Calibration data (16 bits)
-#define BMP085_CAL_AC6 0xB4 // R Calibration data (16 bits)
-#define BMP085_CAL_B1 0xB6 // R Calibration data (16 bits)
-#define BMP085_CAL_B2 0xB8 // R Calibration data (16 bits)
-#define BMP085_CAL_MB 0xBA // R Calibration data (16 bits)
-#define BMP085_CAL_MC 0xBC // R Calibration data (16 bits)
-#define BMP085_CAL_MD 0xBE // R Calibration data (16 bits)
-
-#define BMP085_CONTROL 0xF4
-#define BMP085_TEMPDATA 0xF6
-#define BMP085_PRESSUREDATA 0xF6
-#define BMP085_READTEMPCMD 0x2E
-#define BMP085_READPRESSURECMD 0x34
-
-#define HIGH 1
-#define LOW 0
-
-namespace upm {
-
-/**
- * @brief Bosch BMP & GY65 Atmospheric Pressure Sensor library
- * @defgroup bmpx8x libupm-bmpx8x
- * @ingroup seeed adafruit sparkfun i2c pressure
- */
-
-/**
- * @library bmpx8x
- * @sensor bmpx8x
- * @comname BMP Atmospheric Pressure Sensor
- * @altname GY65 BMP085 BMP180 BMP183
- * @type pressure
- * @man seeed adafruit sparkfun
- * @con i2c
- *
- * @brief API for the GY65/BMP085 and BMP180 Atmospheric Pressure Sensors
- *
- * Bosch GY65/BMP085 and BMP180 are high-precision, ultra-low
- * power consumption pressure sensors. They operate in the range of
- * 30,000-110,000 Pa.
- *
- * This module has been tested on the GY65/BMP085 and BMP180 sensors.
- *
- * @image html bmp085.jpeg
- * @snippet bmpx8x.cxx Interesting
- */
-
-class BMPX8X {
- public:
- /**
- * Instantiates a BMPX8X object
- *
- * @param bus Number of the used bus
- * @param devAddr Address of the used I2C device
- * @param mode BMP085 mode
- */
- BMPX8X (int bus, int devAddr=0x77, uint8_t mode=BMP085_ULTRAHIGHRES);
-
- /**
- * BMPX8X object destructor; basically, it closes the I2C connection.
- * ~BMPX8X ();
- * LE: there is no need for the destructor, as the I2C connection
- * will be closed when the m_i2ControlCtx variable will go out of
- * scope (when all the BMPX8X objects will be destroyed)
- */
- /**
- * Returns the calculated pressure
- */
- int32_t getPressure ();
-
- /**
- *
- * Gets raw pressure data
- */
- int32_t getPressureRaw ();
-
- /**
- * Gets raw temperature data from the sensor
- */
- int16_t getTemperatureRaw ();
-
- /**
- * Returns the calculated temperature
- */
- float getTemperature ();
-
- /**
- * With a given absolute altitude, sea level can be calculated
- *
- * @param altitudeMeters Altitude
- */
- int32_t getSealevelPressure(float altitudeMeters = 0);
-
- /**
- * With a given sea level, altitude in meters can be calculated
- *
- * @param sealevelPressure Sea level
- */
- float getAltitude (float sealevelPressure = 101325);
-
- /**
- * Calculates B5 (check the spec for more information)
- *
- * @param UT
- */
- int32_t computeB5 (int32_t UT);
-
- /**
- * Reads a two-byte register
- *
- * @param reg Address of the register
- */
- uint16_t i2cReadReg_16 (int reg);
-
- /**
- * Writes to a one-byte register
- *
- * @param reg Address of the register
- * @param value Byte to be written
- */
- mraa::Result i2cWriteReg (uint8_t reg, uint8_t value);
-
- /**
- * Reads a one-byte register
- *
- * @param reg Address of the register
- */
- uint8_t i2cReadReg_8 (int reg);
-
- private:
- std::string m_name;
-
- int m_controlAddr;
- int m_bus;
- mraa::I2c m_i2ControlCtx;
-
- uint8_t oversampling;
- int16_t ac1, ac2, ac3, b1, b2, mb, mc, md;
- uint16_t ac4, ac5, ac6;
-};
-
-}
diff --git a/peripheral/libupm/src/bmpx8x/javaupm_bmpx8x.i b/peripheral/libupm/src/bmpx8x/javaupm_bmpx8x.i
deleted file mode 100644
index 227056b..0000000
--- a/peripheral/libupm/src/bmpx8x/javaupm_bmpx8x.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_bmpx8x
-%include "../upm.i"
-
-%{
- #include "bmpx8x.h"
-%}
-
-%include "bmpx8x.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_bmpx8x");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/bmpx8x/jsupm_bmpx8x.i b/peripheral/libupm/src/bmpx8x/jsupm_bmpx8x.i
deleted file mode 100644
index 419f75c..0000000
--- a/peripheral/libupm/src/bmpx8x/jsupm_bmpx8x.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_bmpx8x
-%include "../upm.i"
-
-%{
- #include "bmpx8x.h"
-%}
-
-%include "bmpx8x.h"
diff --git a/peripheral/libupm/src/bmpx8x/pyupm_bmpx8x.i b/peripheral/libupm/src/bmpx8x/pyupm_bmpx8x.i
deleted file mode 100644
index 22f3fe2..0000000
--- a/peripheral/libupm/src/bmpx8x/pyupm_bmpx8x.i
+++ /dev/null
@@ -1,12 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_bmpx8x
-%include "../upm.i"
-
-%include "stdint.i"
-
-%include "bmpx8x.h"
-%{
- #include "bmpx8x.h"
-%}
-
diff --git a/peripheral/libupm/src/buzzer/CMakeLists.txt b/peripheral/libupm/src/buzzer/CMakeLists.txt
deleted file mode 100644
index 02749c0..0000000
--- a/peripheral/libupm/src/buzzer/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "buzzer")
-set (libdescription "upm buzzer")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/buzzer/buzzer.cxx b/peripheral/libupm/src/buzzer/buzzer.cxx
deleted file mode 100644
index 8ef8922..0000000
--- a/peripheral/libupm/src/buzzer/buzzer.cxx
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <string>
-#include <stdexcept>
-#include <unistd.h>
-
-#include "buzzer.h"
-
-using namespace upm;
-using namespace std;
-
-Buzzer::Buzzer(int pinNumber) {
- m_pwm_context = mraa_pwm_init(pinNumber);
- if(m_pwm_context == 0)
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_pwm_init() failed, invalid pin?");
- return;
- }
- m_name = "Buzzer";
- mraa_pwm_enable (m_pwm_context, 1);
- Buzzer::setVolume(1.0);
-}
-
-void Buzzer::setVolume(float vol){
- m_volume = vol;
-}
-
-float Buzzer::getVolume(){
- return m_volume;
-}
-
-int Buzzer::playSound(int note, int delay) {
- mraa_pwm_period_us(m_pwm_context, note);
- mraa_pwm_write(m_pwm_context, m_volume * 0.5);
- if(delay){
- usleep(delay);
- Buzzer::stopSound();
- }
- return note;
-}
-
-void Buzzer::stopSound(){
- // Has to be checked out on a scope and make sure it's flat 0
- mraa_pwm_period_us(m_pwm_context, 1);
- mraa_pwm_write(m_pwm_context, 0);
-}
-
-Buzzer::~Buzzer() {
- Buzzer::stopSound();
- mraa_pwm_enable(m_pwm_context, 0);
- mraa_pwm_close(m_pwm_context);
-}
-
diff --git a/peripheral/libupm/src/buzzer/buzzer.h b/peripheral/libupm/src/buzzer/buzzer.h
deleted file mode 100644
index dfeb47d..0000000
--- a/peripheral/libupm/src/buzzer/buzzer.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include <mraa/pwm.h>
-
-#define DO 3300 // 261 Hz 3830
-#define RE 2930 // 294 Hz
-#define MI 2600 // 329 Hz
-#define FA 2460 // 349 Hz
-#define SOL 2190 // 392 Hz
-#define LA 1960 // 440 Hz
-#define SI 1750 // 493 Hz
-
-namespace upm {
-
-/**
- * @brief Buzzer library
- * @defgroup buzzer libupm-buzzer
- * @ingroup seeed pwm sound gsk
- */
-
-/**
- * @library buzzer
- * @sensor buzzer
- * @comname Grove Buzzer
- * @type sound
- * @man seeed
- * @con pwm
- * @kit gsk
- *
- * @brief API for the Buzzer component
- *
- * This module defines the Buzzer interface for libbuzzer.
- * This sensor can make different tones when connected to
- * a pin capable of analog pulse-width modulation. It emits
- * sound using a piezoelectric material that vibrates at different
- * frequencies based on the input voltage.
- *
- * @image html buzzer.jpg
- * @snippet buzzer-sound.cxx Interesting
- */
-class Buzzer {
- public:
- /**
- * Instantiates a Buzzer object.
- *
- * @param pinNumber Buzzer pin number
- */
- Buzzer (int pinNumber);
-
- /**
- * Buzzer object destructor.
- */
- ~Buzzer ();
-
- /**
- * Plays a tone for a certain amount of time or indefinitely. When delay
- * is not used, the sound can be stopped by calling stopSound().
- *
- * @param note Note to play (C, D, E, etc.) or frequency
- * @param delay Time in microseconds for which to play the sound; if the value is
- * 0, the sound is played indefinitely
- *
- * @return Note played
- */
- int playSound (int note, int delay);
-
- /**
- * Stops the sound currently playing. Should be called when playSound()
- * does not have a delay value.
- */
- void stopSound();
-
- /**
- * Sets the volume for the buzzer, but may affect the sound timbre.
- * Works best with halved values; e.g., 1.0, 0.5, 0.25, etc.
- *
- * @param vol Value to set the volume to, from 0.0 to 1.0
- */
- void setVolume(float vol);
-
- /**
- * Gets the buzzer volume.
- *
- * @return Value the volume was set to
- */
- float getVolume();
-
- /**
- * Returns the name of the sensor.
- *
- * @return Name of the sensor
- */
- std::string name()
- {
- return m_name;
- }
- protected:
- std::string m_name;
- private:
- mraa_pwm_context m_pwm_context;
- float m_volume;
-};
-}
diff --git a/peripheral/libupm/src/buzzer/javaupm_buzzer.i b/peripheral/libupm/src/buzzer/javaupm_buzzer.i
deleted file mode 100644
index e647831..0000000
--- a/peripheral/libupm/src/buzzer/javaupm_buzzer.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_buzzer
-%include "../upm.i"
-
-%{
- #include "buzzer.h"
-%}
-
-%include "buzzer.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_buzzer");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/buzzer/jsupm_buzzer.i b/peripheral/libupm/src/buzzer/jsupm_buzzer.i
deleted file mode 100644
index d957892..0000000
--- a/peripheral/libupm/src/buzzer/jsupm_buzzer.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_buzzer
-%include "../upm.i"
-
-%{
- #include "buzzer.h"
-%}
-
-%include "buzzer.h"
diff --git a/peripheral/libupm/src/buzzer/pyupm_buzzer.i b/peripheral/libupm/src/buzzer/pyupm_buzzer.i
deleted file mode 100644
index a58d139..0000000
--- a/peripheral/libupm/src/buzzer/pyupm_buzzer.i
+++ /dev/null
@@ -1,11 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_buzzer
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "buzzer.h"
-%{
- #include "buzzer.h"
-%}
diff --git a/peripheral/libupm/src/carrays_float.i b/peripheral/libupm/src/carrays_float.i
deleted file mode 100644
index 77e19ae..0000000
--- a/peripheral/libupm/src/carrays_float.i
+++ /dev/null
@@ -1,8 +0,0 @@
-// From the SWIG documentation:
-// Unlike #include, %include includes each file once
-// (and will not reload the file on subsequent %include declarations).
-// Therefore, it is not necessary to use include-guards in SWIG interfaces.
-// So you can include this file and .i files for other C types
-%include "stdint.i"
-%include "carrays.i"
-%array_class(float, floatArray);
diff --git a/peripheral/libupm/src/carrays_int16_t.i b/peripheral/libupm/src/carrays_int16_t.i
deleted file mode 100644
index 4b7bd0b..0000000
--- a/peripheral/libupm/src/carrays_int16_t.i
+++ /dev/null
@@ -1,8 +0,0 @@
-// From the SWIG documentation:
-// Unlike #include, %include includes each file once
-// (and will not reload the file on subsequent %include declarations).
-// Therefore, it is not necessary to use include-guards in SWIG interfaces.
-// So you can include this file and .i files for other C types
-%include "stdint.i"
-%include "carrays.i"
-%array_class(int16_t, int16Array);
diff --git a/peripheral/libupm/src/carrays_uint16_t.i b/peripheral/libupm/src/carrays_uint16_t.i
deleted file mode 100644
index 662abec..0000000
--- a/peripheral/libupm/src/carrays_uint16_t.i
+++ /dev/null
@@ -1,35 +0,0 @@
-// From the SWIG documentation:
-// Unlike #include, %include includes each file once
-// (and will not reload the file on subsequent %include declarations).
-// Therefore, it is not necessary to use include-guards in SWIG interfaces.
-// So you can include this file and .i files for other C types
-%include "stdint.i"
-%include "carrays.i"
-%array_class(uint16_t, uint16Array);
-
-// Adding these typemaps because SWIG is converting uint8, uint16, and uint32 into a short by default
-// This forces SWIG to convert it correctly
-
-#if (SWIG_JAVASCRIPT_V8)
-%typemap(in) uint16_t * {
- void *argp = 0 ;
- int res = SWIG_ConvertPtr($input, &argp,SWIGTYPE_p_uint16Array, 0 | 0 );
- if (!SWIG_IsOK(res)) {
- SWIG_exception_fail(SWIG_ArgError(res), "failed to convert input to uint16");
- }
- $1 = (uint16_t *)(argp);
-}
-#endif
-
-#if (SWIGPYTHON)
-%typemap(in) uint16_t * {
- void *argp = 0 ;
- int res = SWIG_ConvertPtr($input, &argp,SWIGTYPE_p_uint16Array, 0 | 0 );
- if (!SWIG_IsOK(res)) {
- SWIG_exception_fail(SWIG_ArgError(res), "failed to convert input to uint16");
- }
- $1 = reinterpret_cast< uint16_t * >(argp);
-}
-#endif
-
-//#elsif (SWIGJAVA)
diff --git a/peripheral/libupm/src/carrays_uint32_t.i b/peripheral/libupm/src/carrays_uint32_t.i
deleted file mode 100644
index 0f95fa1..0000000
--- a/peripheral/libupm/src/carrays_uint32_t.i
+++ /dev/null
@@ -1,56 +0,0 @@
-// From the SWIG documentation:
-// Unlike #include, %include includes each file once
-// (and will not reload the file on subsequent %include declarations).
-// Therefore, it is not necessary to use include-guards in SWIG interfaces.
-// So you can include this file and .i files for other C types
-%include "stdint.i"
-%include "carrays.i"
-%array_class(uint32_t, uint32Array);
-
-// Adding these typemaps because SWIG is converting uint8, uint16, and uint32 into a short by default
-// This forces SWIG to convert it correctly
-
-#if (SWIG_JAVASCRIPT_V8)
-%typemap(in) uint32_t * {
- void *argp = 0 ;
- int res = SWIG_ConvertPtr($input, &argp, SWIGTYPE_p_uint32Array, 0 | 0 );
- if (!SWIG_IsOK(res)) {
- SWIG_exception_fail(SWIG_ArgError(res), "failed to convert input to uint32 *");
- }
- $1 = (uint32_t *)(argp);
-}
-
-/*$input (non-pointer) is a v8::object, which inherits from v8::value */
-%typemap(in) uint32_t {
- int ecode2 = 0 ;
- if (($input)->IsInt32())
- $1 = ($input)->Uint32Value();
- else
- SWIG_exception_fail(SWIG_ArgError(ecode2), "failed to convert uint32");
-}
-#endif
-
-#if (SWIGPYTHON)
-%typemap(in) uint32_t * {
- void *argp = 0 ;
- int res = SWIG_ConvertPtr($input, &argp, SWIGTYPE_p_uint32Array, 0 | 0 );
- if (!SWIG_IsOK(res)) {
- SWIG_exception_fail(SWIG_ArgError(res), "failed to convert input to uint32 *");
- }
- $1 = reinterpret_cast< uint32_t * >(argp);
-}
-
-/*$input (non-pointer) */
-%typemap(in) uint32_t {
- long v;
- int res = SWIG_AsVal_long ($input, &v);
- if (SWIG_IsOK(res)) {
- $1 = PyInt_AsLong($input);
- }
- else {
- SWIG_exception_fail(SWIG_ArgError(res), "failed to convert uint32");
- }
-}
-#endif
-
-//#elsif (SWIGJAVA)
diff --git a/peripheral/libupm/src/carrays_uint8_t.i b/peripheral/libupm/src/carrays_uint8_t.i
deleted file mode 100644
index cef9a77..0000000
--- a/peripheral/libupm/src/carrays_uint8_t.i
+++ /dev/null
@@ -1,35 +0,0 @@
-// From the SWIG documentation:
-// Unlike #include, %include includes each file once
-// (and will not reload the file on subsequent %include declarations).
-// Therefore, it is not necessary to use include-guards in SWIG interfaces.
-// So you can include this file and .i files for other C types
-%include "stdint.i"
-%include "carrays.i"
-%array_class(uint8_t, uint8Array);
-
-// Adding these typemaps because SWIG is converting uint8, uint16, and uint32 into a short by default
-// This forces SWIG to convert it correctly
-
-#if (SWIG_JAVASCRIPT_V8)
-%typemap(in) uint8_t * {
- void *argp = 0 ;
- int res = SWIG_ConvertPtr($input, &argp,SWIGTYPE_p_uint8Array, 0 | 0 );
- if (!SWIG_IsOK(res)) {
- SWIG_exception_fail(SWIG_ArgError(res), "failed to convert input to uint8");
- }
- $1 = (uint8_t *)(argp);
-}
-#endif
-
-#if (SWIGPYTHON)
-%typemap(in) uint8_t * {
- void *argp = 0 ;
- int res = SWIG_ConvertPtr($input, &argp,SWIGTYPE_p_uint8Array, 0 | 0 );
- if (!SWIG_IsOK(res)) {
- SWIG_exception_fail(SWIG_ArgError(res), "failed to convert input to uint8");
- }
- $1 = reinterpret_cast< uint8_t * >(argp);
-}
-#endif
-
-//#elsif (SWIGJAVA)
diff --git a/peripheral/libupm/src/cjq4435/CMakeLists.txt b/peripheral/libupm/src/cjq4435/CMakeLists.txt
deleted file mode 100644
index b9c954b..0000000
--- a/peripheral/libupm/src/cjq4435/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "cjq4435")
-set (libdescription "upm cjq4435 MOSFET module")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/cjq4435/cjq4435.cxx b/peripheral/libupm/src/cjq4435/cjq4435.cxx
deleted file mode 100644
index 43c2a56..0000000
--- a/peripheral/libupm/src/cjq4435/cjq4435.cxx
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <string>
-#include <stdexcept>
-
-#include "cjq4435.h"
-
-using namespace upm;
-using namespace std;
-
-CJQ4435::CJQ4435(int pin)
-{
- if ( !(m_pwm = mraa_pwm_init(pin)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_pwm_init() failed, invalid pin?");
- return;
- }
-
- m_enabled = false;
-}
-
-CJQ4435::~CJQ4435()
-{
- if (m_enabled)
- mraa_pwm_enable(m_pwm, 0);
-
- mraa_pwm_close(m_pwm);
-}
-
-void CJQ4435::setPeriodUS(int us)
-{
- if (mraa_pwm_period_us(m_pwm, us) != MRAA_SUCCESS)
- cerr << __FUNCTION__ << ": period specified is not supported"
- << endl;
-}
-
-void CJQ4435::setPeriodMS(int ms)
-{
- if (mraa_pwm_period_ms(m_pwm, ms) != MRAA_SUCCESS)
- cerr << __FUNCTION__ << ": period specified is not supported"
- << endl;
-}
-
-void CJQ4435::setPeriodSeconds(float seconds)
-{
- if (mraa_pwm_period(m_pwm, seconds) != MRAA_SUCCESS)
- cerr << __FUNCTION__ << ": period specified is not supported"
- << endl;
-}
-
-void CJQ4435::enable(bool enable)
-{
- m_enabled = enable;
- mraa_pwm_enable(m_pwm, ((enable) ? 1 : 0));
-}
-
-void CJQ4435::setDutyCycle(float dutyCycle)
-{
- if (dutyCycle < 0.0)
- dutyCycle = 0.0;
-
- if (dutyCycle > 1.0)
- dutyCycle = 1.0;
-
- mraa_pwm_write(m_pwm, dutyCycle);
-}
-
-void CJQ4435::on()
-{
- // set a 1 second period, with 100% duty cycle
-
- enable(false);
- setPeriodUS(1000);
- setDutyCycle(1.0);
- enable(true);
-}
-
-void CJQ4435::off()
-{
- // set a 1 second period, with 0% duty cycle
-
- enable(false);
- setPeriodUS(1000);
- setDutyCycle(0.0);
- enable(true);
-}
-
diff --git a/peripheral/libupm/src/cjq4435/cjq4435.h b/peripheral/libupm/src/cjq4435/cjq4435.h
deleted file mode 100644
index 025cafc..0000000
--- a/peripheral/libupm/src/cjq4435/cjq4435.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <mraa/pwm.h>
-
-namespace upm {
- /**
- * @brief CJQ4435 MOSFET library
- * @defgroup cjq4435 libupm-cjq4435
- * @ingroup seeed gpio pwm electric robok
- */
-
- /**
- * @library cjq4435
- * @sensor cjq4435
- * @comname Grove MOSFET
- * @altname CJQ4435
- * @type electric
- * @man seeed
- * @con gpio pwm
- * @kit robok
- *
- * @brief API for the CJQ4435 MOSFET
- *
- * UPM module for the CJQ4435 MOSFET. It was developed using the
- * Grove MOSFET module. A MOSFET is like a switch, but it can
- * switch much faster than a mechanical relay. Here, we implement
- * support via MRAA pulse width modulation (PWM) functions.
- * Note: available periods vary depending on
- * the capabilities of your device.
- *
- * @image html cjq4435.jpg
- * @snippet cjq4435.cxx Interesting
- */
- class CJQ4435 {
- public:
- /**
- * CJQ4435 constructor
- *
- * @param pin Digital pin to use; this pin must be PWM-capable
- */
- CJQ4435(int pin);
-
- /**
- * CJQ4435 destructor
- */
- ~CJQ4435();
-
- /**
- * Sets a period in microseconds
- *
- * @param us Period in microseconds
- */
- void setPeriodUS(int us);
-
- /**
- * Sets a period in milliseconds
- *
- * @param ms Period in milliseconds
- */
- void setPeriodMS(int ms);
-
- /**
- * Sets a period in seconds
- *
- * @param seconds Period in seconds
- */
- void setPeriodSeconds(float seconds);
-
- /**
- * Enables output
- *
- * @param enable Enables PWM output if true, disables otherwise
- */
- void enable(bool enable);
-
- /**
- * Sets a duty cycle. Duty cycle is a floating-point number
- * between 0.0 (always off) and 1.0 (always on). It represents a
- * proportion of time, per period, during which the output is
- * driven high.
- *
- * @param dutyCycle Duty cycle to use
- */
- void setDutyCycle(float dutyCycle);
-
- /**
- * Shortcut to turn the output to continuous on (high)
- */
- void on();
-
- /**
- * Shortcut to turn the output to continuous off (low)
- */
- void off();
-
- private:
- bool m_enabled;
- mraa_pwm_context m_pwm;
- };
-}
-
-
diff --git a/peripheral/libupm/src/cjq4435/javaupm_cjq4435.i b/peripheral/libupm/src/cjq4435/javaupm_cjq4435.i
deleted file mode 100644
index a67fb5b..0000000
--- a/peripheral/libupm/src/cjq4435/javaupm_cjq4435.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_cjq4435
-%include "../upm.i"
-
-%{
- #include "cjq4435.h"
-%}
-
-%include "cjq4435.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_cjq4435");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/cjq4435/jsupm_cjq4435.i b/peripheral/libupm/src/cjq4435/jsupm_cjq4435.i
deleted file mode 100644
index 3fe19ee..0000000
--- a/peripheral/libupm/src/cjq4435/jsupm_cjq4435.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_cjq4435
-%include "../upm.i"
-
-%{
- #include "cjq4435.h"
-%}
-
-%include "cjq4435.h"
diff --git a/peripheral/libupm/src/cjq4435/pyupm_cjq4435.i b/peripheral/libupm/src/cjq4435/pyupm_cjq4435.i
deleted file mode 100644
index 706cd28..0000000
--- a/peripheral/libupm/src/cjq4435/pyupm_cjq4435.i
+++ /dev/null
@@ -1,11 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_cjq4435
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "cjq4435.h"
-%{
- #include "cjq4435.h"
-%}
diff --git a/peripheral/libupm/src/dfrph/CMakeLists.txt b/peripheral/libupm/src/dfrph/CMakeLists.txt
deleted file mode 100644
index 1f08e95..0000000
--- a/peripheral/libupm/src/dfrph/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "dfrph")
-set (libdescription "upm dfrobot pH sensors")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/dfrph/dfrph.cxx b/peripheral/libupm/src/dfrph/dfrph.cxx
deleted file mode 100644
index a984af7..0000000
--- a/peripheral/libupm/src/dfrph/dfrph.cxx
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-
-#include "dfrph.h"
-
-using namespace std;
-using namespace upm;
-
-DFRPH::DFRPH(int pin, float aref) :
- m_aio(pin)
-{
- m_aRes = (1 << m_aio.getBit());
- m_aref = aref;
-
- m_offset = 0.0;
-}
-
-DFRPH::~DFRPH()
-{
-}
-
-float DFRPH::volts()
-{
- int val = m_aio.read();
-
- return(val * (m_aref / m_aRes));
-}
-
-void DFRPH::setOffset(float offset)
-{
- m_offset = offset;
-}
-
-float DFRPH::pH(unsigned int samples)
-{
- if (!samples)
- samples = 1;
-
- float sum = 0.0;
-
- for (int i=0; i<samples; i++)
- {
- sum += volts();
- usleep(20000);
- }
-
- sum /= samples;
-
- // 3.5 is a 'magic' DFRobot number. Seems to work though :)
- return (3.5 * sum + m_offset);
-}
diff --git a/peripheral/libupm/src/dfrph/dfrph.h b/peripheral/libupm/src/dfrph/dfrph.h
deleted file mode 100644
index 68c2557..0000000
--- a/peripheral/libupm/src/dfrph/dfrph.h
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <iostream>
-#include <string>
-#include <mraa/aio.hpp>
-
-namespace upm {
- /**
- * @brief DFRobot pH sensors
- * @defgroup dfrph libupm-dfrph
- * @ingroup dfrobot liquid analog
- */
-
- /**
- * @library dfrph
- * @sensor dfrph
- * @comname DFRobot pH Sensors
- * @type liquid
- * @man dfrobot
- * @web http://www.dfrobot.com/index.php?route=product/product&product_id=1110
- * @con analog
- *
- * @brief API for the DFRobot pH Sensors
- *
- * This sensor family returns an analog voltage proportional to the
- * acidity or alkalinity of a liquid -- it's pH value.
- *
- * This driver was developed using the DFRobot Analog pH meter and
- * the DFRobot Analog pH Meter Pro.
- *
- *
- * Calibration instructions, taken and slightly reworded from the
- * DFRobot wiki at:
- * http://dfrobot.com/wiki/index.php/PH_meter%28SKU:_SEN0161%29
- *
- * 1) Connect equipment: the pH electrode is connected to the BNC
- * connector on the pH meter board, and then the pH meter board is
- * connected to the analog port 0 of the controller. When the
- * controller gets power, you will see the blue LED on board is on.
- *
- * 2) Put the pH electrode into the standard solution whose pH
- * value is 7.00. Run the dfrph example and note the pH output
- * value. Compare the value with 7.00, and calculate the
- * difference. This is the value you should supply to the
- * setOffset() method.
- *
- * 3) Put the pH electrode into the pH standard solution whose
- * value is 4.00. Then wait about one minute, and adjust the
- * potentiometer on the interface board. Let the value stabilise
- * at around 4.00. At this time,the acidic calibration has been
- * completed and you can measure the pH value of an acidic
- * solution.
- *
- * 4) According to the linear characteristics of pH electrode
- * itself, after the above calibration,you can directly measure the
- * pH value of the alkaline solution. If you want to get better
- * accuracy, you can recalibrate it. Alkaline calibration use the
- * standard solution whose pH value is 9.18. Also adjust the
- * potentiometer and let the value stabilise at around 9.18. After
- * this calibration, you can measure the pH value of an alkaline
- * solution.
- *
- * @image html dfrph.jpg
- * @snippet dfrph.cxx Interesting
- */
-
- class DFRPH {
- public:
-
- /**
- * DFRPH constructor
- *
- * @param pin Analog pin to use
- * @param aref Analog reference voltage; default is 5.0 V
- */
- DFRPH(int pin, float aref=5.0);
-
- /**
- * DFRPH destructor
- */
- ~DFRPH();
-
- /**
- * Returns the voltage detected on the analog pin
- *
- * @return The detected voltage
- */
- float volts();
-
- /**
- * Specifies the offset determined from calibration. The default
- * is 0.0.
- *
- * @param offset The offset value to use
- */
- void setOffset(float offset);
-
- /**
- * Take a number of samples and return the detected pH value. The
- * default number of samples is 15.
- *
- * @param samples The number of samples to average over, default 15
- * @return The pH value detected
- */
- float pH(unsigned int samples=15);
-
- protected:
- mraa::Aio m_aio;
-
- private:
- float m_aref;
- // ADC resolution
- int m_aRes;
-
- // voltage offset
- float m_offset;
- };
-}
-
-
diff --git a/peripheral/libupm/src/dfrph/javaupm_dfrph.i b/peripheral/libupm/src/dfrph/javaupm_dfrph.i
deleted file mode 100644
index 68fe193..0000000
--- a/peripheral/libupm/src/dfrph/javaupm_dfrph.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_dfrph
-%include "../upm.i"
-
-%{
- #include "dfrph.h"
-%}
-
-%include "dfrph.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_dfrph");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/dfrph/jsupm_dfrph.i b/peripheral/libupm/src/dfrph/jsupm_dfrph.i
deleted file mode 100644
index ca3a249..0000000
--- a/peripheral/libupm/src/dfrph/jsupm_dfrph.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_dfrph
-%include "../upm.i"
-
-%{
- #include "dfrph.h"
-%}
-
-%include "dfrph.h"
diff --git a/peripheral/libupm/src/dfrph/pyupm_dfrph.i b/peripheral/libupm/src/dfrph/pyupm_dfrph.i
deleted file mode 100644
index f22183e..0000000
--- a/peripheral/libupm/src/dfrph/pyupm_dfrph.i
+++ /dev/null
@@ -1,11 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_dfrph
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "dfrph.h"
-%{
- #include "dfrph.h"
-%}
diff --git a/peripheral/libupm/src/doxy2swig.py b/peripheral/libupm/src/doxy2swig.py
deleted file mode 100755
index b537671..0000000
--- a/peripheral/libupm/src/doxy2swig.py
+++ /dev/null
@@ -1,457 +0,0 @@
-#!/usr/bin/env python
-"""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/libupm/src/ds1307/CMakeLists.txt b/peripheral/libupm/src/ds1307/CMakeLists.txt
deleted file mode 100644
index 3ee7e08..0000000
--- a/peripheral/libupm/src/ds1307/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "ds1307")
-set (libdescription "upm ds1307 RTC module")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/ds1307/ds1307.cxx b/peripheral/libupm/src/ds1307/ds1307.cxx
deleted file mode 100644
index 8681cea..0000000
--- a/peripheral/libupm/src/ds1307/ds1307.cxx
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Adapted from Seeed Studio library:
- * https://github.com/Seeed-Studio/RTC_DS1307
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <string>
-#include <stdexcept>
-
-#include "ds1307.h"
-
-using namespace upm;
-using namespace std;
-
-
-DS1307::DS1307(int bus) : m_i2c(bus)
-{
- // setup our i2c link
- mraa::Result ret = m_i2c.address(DS1307_I2C_ADDR);
- if (ret != mraa::SUCCESS){
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": i2c.address() failed");
- return;
- }
-}
-
-mraa::Result DS1307::writeBytes(uint8_t reg, uint8_t *buffer, int len)
-{
- if (!len || !buffer)
- return mraa::ERROR_INVALID_PARAMETER;
-
- // create a buffer 1 byte larger than the supplied buffer,
- // store the register in the first byte
- uint8_t buf2[len + 1];
-
- buf2[0] = reg;
-
- // copy in the buffer after the reg byte
- for (int i=1; i<(len + 1); i++)
- buf2[i] = buffer[i-1];
-
- mraa::Result ret = m_i2c.address(DS1307_I2C_ADDR);
- if (ret != mraa::SUCCESS){
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": i2c.address() failed");
- return ret;
- }
-
- return m_i2c.write(buf2, len + 1);
-}
-
-int DS1307::readBytes(uint8_t reg, uint8_t *buffer, int len)
-{
- if (!len || !buffer)
- return 0;
-
- mraa::Result ret = m_i2c.address(DS1307_I2C_ADDR);
- if (ret != mraa::SUCCESS){
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": i2c.address() failed");
- return 0;
- }
- m_i2c.writeByte(reg);
-
- return m_i2c.read(buffer, len);
-}
-
-bool DS1307::loadTime()
-{
- // read the first 7 registers
- uint8_t buffer[7];
- int bytesRead = readBytes(0, buffer, 7);
-
- if (bytesRead != 7)
- {
- // problem
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": failed to read expected 7 bytes from device");
- return false;
- }
-
- // We need to mask some control bits off of some of these values
- // and convert the result to decimal from BCD. We also need to account
- // for format (AM/PM or 24hr), and if AM/PM, whether PM should be set.
-
- // first bit here is the oscillator enable/disable bit
- seconds = bcdToDec(buffer[0] & 0x7f);
- minutes = bcdToDec(buffer[1]);
-
- // check AM/PM or 24hr mode
- if (buffer[2] & 0x40)
- {
- // We are in AM/PM mode
- hours = bcdToDec(buffer[2] & 0x1f);
- amPmMode = true;
- pm = (buffer[2] & 0x20) ? true : false;
- }
- else
- {
- // 24hr mode
- hours = bcdToDec(buffer[2] & 0x3f);
- amPmMode = false;
- pm = false;
- }
-
- dayOfWeek = bcdToDec(buffer[3]);
- dayOfMonth = bcdToDec(buffer[4]);
- month = bcdToDec(buffer[5]);
- year = bcdToDec(buffer[6]);
-
- return true;
-}
-
-bool DS1307::setTime()
-{
- uint8_t buffer[7];
-
- // seconds
- // we need to read in seconds first to preserve the osc enable bit
- uint8_t tmpbuf;
-
- readBytes(0, &tmpbuf, 1);
- buffer[0] = decToBcd(seconds) | (tmpbuf & 0x80);
-
- // minutes
- buffer[1] = decToBcd(minutes);
-
- // hours
- if (amPmMode)
- {
- buffer[2] = decToBcd(hours) | 0x40;
- if (pm)
- buffer[2] |= 0x20;
- }
- else
- buffer[2] = decToBcd(hours);
-
- // day of week
- buffer[3] = decToBcd(dayOfWeek);
-
- // day of month
- buffer[4] = decToBcd(dayOfMonth);
-
- // month
- buffer[5] = decToBcd(month);
-
- // year
- buffer[6] = decToBcd(year);
-
- return writeBytes(0, buffer, 7);
-}
-
-mraa::Result DS1307::enableClock()
-{
- // the oscillator enable bit is the high bit of reg 0
- // so read it, clear it, and write it back.
-
- uint8_t buf;
- readBytes(0, &buf, 1);
-
- buf &= ~0x80;
-
- return writeBytes(0, &buf, 1);
-}
-
-mraa::Result DS1307::disableClock()
-{
- // the oscillator enable bit is the high bit of reg 0
- // so read it, set it, and write it back.
-
- uint8_t buf;
- readBytes(0, &buf, 1);
-
- buf |= 0x80;
-
- return writeBytes(0, &buf, 1);
-}
-
-
-// Convert decimal to BCD
-uint8_t DS1307::decToBcd(unsigned int val)
-{
- return ( (val/10*16) + (val%10) );
-}
-
-// Convert BCD to decimal
-unsigned int DS1307::bcdToDec(uint8_t val)
-{
- return ( (val/16*10) + (val%16) );
-}
-
diff --git a/peripheral/libupm/src/ds1307/ds1307.h b/peripheral/libupm/src/ds1307/ds1307.h
deleted file mode 100644
index 4061866..0000000
--- a/peripheral/libupm/src/ds1307/ds1307.h
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Adapted from Seeed Studio library:
- * https://github.com/Seeed-Studio/RTC_DS1307
- *
- * 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 <string>
-#include <mraa/i2c.hpp>
-
-#define DS1307_I2C_BUS 0
-#define DS1307_I2C_ADDR 0x68
-
-// Days of the week
-#define DS1307_DAY_MON 1
-#define DS1307_DAY_TUE 2
-#define DS1307_DAY_WED 3
-#define DS1307_DAY_THU 4
-#define DS1307_DAY_FRI 5
-#define DS1307_DAY_SAT 6
-#define DS1307_DAY_SUN 7
-
-namespace upm {
- /**
- * @brief DS1307 Real-Time Clock library
- * @defgroup ds1307 libupm-ds1307
- * @ingroup seeed i2c time
- */
-
- /**
- * @library ds1307
- * @sensor ds1307
- * @comname Grove RTC (Real-Time Clock)
- * @altname DS1307 RTC
- * @type time
- * @man seeed
- * @con i2c
- *
- * @brief API for the DS1307 Real-Time CLock
- *
- * UPM module for the DS1307-based real-time clock. The clock can provide information
- * about seconds, minutes, hours, day of the week, day of the month,
- * month, and year. It can operate in either a 24-hour or a 12-hour format.
- * This device can also output a square wave at 1Khz, 4Khz, 8Khz, and 32Khz.
- * However, this capability is not implemented in this module.
- *
- * @image html ds1307.jpg
- * @snippet ds1307.cxx Interesting
- */
- class DS1307 {
- public:
- /**
- * DS1307 constructor
- *
- * @param bus I2C bus to use
- */
- DS1307(int bus);
-
- /**
- * Loads all the time values
- *
- * @return True if time data loaded successfully
- */
- bool loadTime();
-
- /**
- * Sets the time. You should call loadTime() beforehand to
- * maintain consistency
- *
- * @return True if time is set successfully
- */
- bool setTime();
-
- /**
- * Enables an oscillator on the clock.
- *
- * @return 0 (mraa::SUCCESS) if successful; non-zero otherwise
- */
- mraa::Result enableClock();
-
- /**
- * Disables the oscillator on the clock. This prevents the clock
- * from updating any time/date values
- *
- * @return 0 (mraa::SUCCESS) if successful; non-zero otherwise
- */
- mraa::Result disableClock();
-
- /**
- * Writes value(s) into registers
- *
- * @param reg Register location to start writing into
- * @param buffer Buffer for data storage
- * @param len Number of bytes to write
- * @return 0 (mraa::SUCCESS) if successful; non-zero otherwise
- */
- mraa::Result writeBytes(uint8_t reg, uint8_t *buffer, int len);
-
- /**
- * Reads value(s) from registers
- *
- * @param reg Register location to start reading from
- * @param buffer Buffer for data storage
- * @param len Number of bytes to read
- * @return Number of bytes read
- */
- int readBytes(uint8_t reg, uint8_t *buffer, int len);
-
- /**
- * Converts a BCD value into decimal
- *
- * @param val BCD value to convert
- * @return Converted decimal value
- */
- unsigned int bcdToDec(uint8_t val);
-
- /**
- * Converts a decimal value into BCD
- *
- * @param val Decimal value to convert
- * @return Converted BCD value
- */
- uint8_t decToBcd(unsigned int val);
-
- // These variables store the time data loaded with loadTime(), and
- // are the source of data when setTime() is called. It is a
- // good idea to call loadTime() to set up the current values before
- // calling setTime() to ensure RTC data is consistent
-
- /**
- * Holds seconds
- */
- unsigned int seconds;
- /**
- * Holds minutes
- */
- unsigned int minutes;
- /**
- * Holds hours; 1-12 in the am/pm format, 0-23 otherwise
- */
- unsigned int hours;
- /**
- * Holds a day of the week; 1-7, where 1 is Sunday
- */
- unsigned int dayOfWeek;
- /**
- * Holds a day of the month, 1-31
- */
- unsigned int dayOfMonth;
- /**
- * Holds a month, 1-12
- */
- unsigned int month;
- /**
- * Holds a year, 0-99
- */
- unsigned int year;
- /**
- * True if the am/pm format is used, false otherwise
- */
- bool amPmMode;
- /**
- * For the am/pm format, it is true if it's pm, false otherwise
- */
- bool pm;
-
- private:
- mraa::I2c m_i2c;
- };
-}
-
-
diff --git a/peripheral/libupm/src/ds1307/javaupm_ds1307.i b/peripheral/libupm/src/ds1307/javaupm_ds1307.i
deleted file mode 100644
index ba7de15..0000000
--- a/peripheral/libupm/src/ds1307/javaupm_ds1307.i
+++ /dev/null
@@ -1,21 +0,0 @@
-%module javaupm_ds1307
-%include "../upm.i"
-%include "arrays_java.i";
-%include "../java_buffer.i"
-
-%{
- #include "ds1307.h"
-%}
-
-%include "ds1307.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_ds1307");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/ds1307/jsupm_ds1307.i b/peripheral/libupm/src/ds1307/jsupm_ds1307.i
deleted file mode 100644
index f102ea0..0000000
--- a/peripheral/libupm/src/ds1307/jsupm_ds1307.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_ds1307
-%include "../upm.i"
-
-%{
- #include "ds1307.h"
-%}
-
-%include "ds1307.h"
diff --git a/peripheral/libupm/src/ds1307/pyupm_ds1307.i b/peripheral/libupm/src/ds1307/pyupm_ds1307.i
deleted file mode 100644
index 33e65eb..0000000
--- a/peripheral/libupm/src/ds1307/pyupm_ds1307.i
+++ /dev/null
@@ -1,15 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_ds1307
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-#ifdef DOXYGEN
-%include "ds1307_doc.i"
-#endif
-
-%include "ds1307.h"
-%{
- #include "ds1307.h"
-%}
diff --git a/peripheral/libupm/src/ecs1030/CMakeLists.txt b/peripheral/libupm/src/ecs1030/CMakeLists.txt
deleted file mode 100644
index ccbe8dc..0000000
--- a/peripheral/libupm/src/ecs1030/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "ecs1030")
-set (libdescription "Non-invasive current sensor")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/ecs1030/ecs1030.cxx b/peripheral/libupm/src/ecs1030/ecs1030.cxx
deleted file mode 100644
index aa1c73a..0000000
--- a/peripheral/libupm/src/ecs1030/ecs1030.cxx
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <unistd.h>
-#include <stdlib.h>
-#include <string>
-#include <stdexcept>
-
-#include "ecs1030.h"
-
-using namespace upm;
-
-ECS1030::ECS1030 (uint8_t pinNumber) {
- m_dataPinCtx = mraa_aio_init(pinNumber);
- if (m_dataPinCtx == NULL) {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_aio_init() failed");
- }
-
- m_calibration = 111.1;
-}
-
-ECS1030::~ECS1030 () {
- mraa_result_t error = MRAA_SUCCESS;
-
- error = mraa_aio_close (m_dataPinCtx);
- if (error != MRAA_SUCCESS) {
- }
-}
-
-double
-ECS1030::getCurrency_A () {
- int sensorValue = 0;
- float rLoad = 0;
- float volt = 0;
- float rms = 0;
-
- for (int i = 0; i < NUMBER_OF_SAMPLES; i++) {
- sensorValue = mraa_aio_read (m_dataPinCtx);
- volt = (VOLT_M * sensorValue) - 2.5;
- volt = volt * volt;
- rms = rms + volt;
- usleep (DELAY_MS);
- }
-
- rms = rms / (float)NUMBER_OF_SAMPLES;
- rms = sqrt(rms);
- return rms / R_LOAD;
-}
-
-double
-ECS1030::getCurrency_B () {
- double sumCurrency = 0;
-
- for (int i = 0; i < NUMBER_OF_SAMPLES; i++) {
- m_lastSample = m_sample;
- m_sample = mraa_aio_read (m_dataPinCtx);
- m_lastFilter = m_filteredSample;
- m_filteredSample = 0.996 * (m_lastFilter + m_sample - m_lastSample);
- sumCurrency += (m_filteredSample * m_filteredSample);
- }
-
- double ratio = m_calibration * ((SUPPLYVOLTAGE / 1000.0) / (ADC_RESOLUTION));
- return ( ratio * sqrt(sumCurrency / NUMBER_OF_SAMPLES) );
-}
-
-double
-ECS1030::getPower_A () {
- return 220.0 * getCurrency_A ();
-}
-
-double
-ECS1030::getPower_B () {
- return 220.0 * getCurrency_B ();
-}
diff --git a/peripheral/libupm/src/ecs1030/ecs1030.h b/peripheral/libupm/src/ecs1030/ecs1030.h
deleted file mode 100644
index 29deb4a..0000000
--- a/peripheral/libupm/src/ecs1030/ecs1030.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include <math.h>
-#include <mraa/aio.h>
-#include <mraa/gpio.h>
-
-namespace upm {
-
-#define NUMBER_OF_SAMPLES 500
-#define ADC_RESOLUTION 1024
-#define SUPPLYVOLTAGE 5100
-#define CURRENT_RATIO 2000.0
-
-#define HIGH 1
-#define LOW 0
-
-#define TRUE HIGH
-#define FALSE LOW
-
- /**
- * @brief ECS1030 Electricity Sensor library
- * @defgroup ecs1030 libupm-ecs1030
- * @ingroup sparkfun analog electric
- */
-
- /**
- * @library ecs1030
- * @sensor ecs1030
- * @comname ECS1030 Non-Invasive Current Sensor
- * @type electric
- * @man sparkfun
- * @web https://www.sparkfun.com/products/11005
- * @con analog
- *
- * @brief API for the ECS1030 Non-Invasive Current/Electricity Sensor
- *
- * This non-invasive current sensor can be clamped around the supply line of
- * an electrical load to tell you how much current is passing through it. It
- * does this by acting as an inductor and responding to the magnetic field
- * around a current-carrying conductor. This particular current sensor
- * measures a load up to 30 A, which makes it great for building your own
- * energy monitors.
- *
- * @image html ecs1030.jpg
- * <br><em>ECS1030 Sensor image provided by SparkFun* under
- * <a href=https://creativecommons.org/licenses/by-nc-sa/3.0/>
- * CC BY-NC-SA-3.0</a>.</em>
- *
- * @snippet ecs1030.cxx Interesting
- */
-class ECS1030 {
- public:
- static const uint8_t DELAY_MS = 20000 / NUMBER_OF_SAMPLES; /* 1/50Hz is 20ms period */
- static const uint8_t VOLT_M = 5.1 / 1023;
- static const uint8_t R_LOAD = 2000.0 / CURRENT_RATIO;
-
- /**
- * Instantiates an ECS1030 object
- *
- * @param pinNumber Number of the data pin
- */
- ECS1030 (uint8_t pinNumber);
-
- /**
- * ECS1030 object destructor; basically, it closes the GPIO.
- */
- ~ECS1030 ();
-
- /**
- * Returns electric current data for a sampled period
- */
- double getCurrency_A ();
-
- /**
- * Returns power data for a sampled period
- */
- double getPower_A ();
-
- /**
- * Returns electric current data for a sampled period
- */
- double getCurrency_B ();
-
- /**
- * Returns power data for a sampled period
- */
- double getPower_B ();
-
- /**
- * Returns the name of the component
- */
- std::string name() {
- return m_name;
- }
- private:
- std::string m_name;
- mraa_aio_context m_dataPinCtx;
-
- double m_calibration;
- int m_lastSample;
- double m_lastFilter;
- int m_sample;
- double m_filteredSample;
-};
-}
diff --git a/peripheral/libupm/src/ecs1030/javaupm_ecs1030.i b/peripheral/libupm/src/ecs1030/javaupm_ecs1030.i
deleted file mode 100644
index 93f5c5e..0000000
--- a/peripheral/libupm/src/ecs1030/javaupm_ecs1030.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_ecs1030
-%include "../upm.i"
-
-%{
- #include "ecs1030.h"
-%}
-
-%include "ecs1030.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_ecs1030");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/ecs1030/jsupm_ecs1030.i b/peripheral/libupm/src/ecs1030/jsupm_ecs1030.i
deleted file mode 100644
index 12abd2c..0000000
--- a/peripheral/libupm/src/ecs1030/jsupm_ecs1030.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_ecs1030
-%include "../upm.i"
-
-%{
- #include "ecs1030.h"
-%}
-
-%include "ecs1030.h"
diff --git a/peripheral/libupm/src/ecs1030/pyupm_ecs1030.i b/peripheral/libupm/src/ecs1030/pyupm_ecs1030.i
deleted file mode 100644
index 82c4d95..0000000
--- a/peripheral/libupm/src/ecs1030/pyupm_ecs1030.i
+++ /dev/null
@@ -1,13 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_ecs1030
-%include "../upm.i"
-
-%include "stdint.i"
-
-%feature("autodoc", "3");
-
-%include "ecs1030.h"
-%{
- #include "ecs1030.h"
-%}
diff --git a/peripheral/libupm/src/enc03r/CMakeLists.txt b/peripheral/libupm/src/enc03r/CMakeLists.txt
deleted file mode 100644
index 3fc0420..0000000
--- a/peripheral/libupm/src/enc03r/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "enc03r")
-set (libdescription "upm enc03r single axis analog gyro module")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/enc03r/enc03r.cxx b/peripheral/libupm/src/enc03r/enc03r.cxx
deleted file mode 100644
index 6b1faa8..0000000
--- a/peripheral/libupm/src/enc03r/enc03r.cxx
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <string>
-#include <stdexcept>
-
-#include "enc03r.h"
-
-using namespace upm;
-using namespace std;
-
-ENC03R::ENC03R(int pin, float vref)
-{
- if ( !(m_aio = mraa_aio_init(pin)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_aio_init() failed, invalid pin?");
- return;
- }
-
- m_vref = vref;
- m_calibrationValue = 0;
-}
-
-ENC03R::~ENC03R()
-{
- mraa_aio_close(m_aio);
-}
-
-unsigned int ENC03R::value()
-{
- return mraa_aio_read(m_aio);
-}
-
-void ENC03R::calibrate(unsigned int samples)
-{
- unsigned int val;
- float total = 0.0;
-
- for (int i=0; i<samples; i++)
- {
- val = mraa_aio_read(m_aio);
- total += (float)val;
- usleep(2000);
- }
-
- m_calibrationValue = total / (float)samples;
-}
-
-double ENC03R::angularVelocity(unsigned int val)
-{
- // from seeed studio example
- //return (((double)(val-m_calibrationValue)*(m_vref*1000.0))/1023.0/0.67);
- return (((double)(val-m_calibrationValue)*(m_vref*1000.0))/685.41);
-}
diff --git a/peripheral/libupm/src/enc03r/enc03r.h b/peripheral/libupm/src/enc03r/enc03r.h
deleted file mode 100644
index 8587ea0..0000000
--- a/peripheral/libupm/src/enc03r/enc03r.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include <mraa/aio.h>
-
-namespace upm {
-
- /**
- * @brief ENC03R Single Axis Gyro library
- * @defgroup enc03r libupm-enc03r
- * @ingroup seeed analog compass robok
- */
-
- /**
- * @library enc03r
- * @sensor enc03r
- * @comname ENC03R Single Axis Gyro
- * @altname Grove Single Axis Analog Gyro
- * @type compass
- * @man seeed
- * @con analog
- * @kit robok
- *
- * @brief API for the ENC03R Single Axis Analog Gyro
- *
- * UPM module for the ENC03R single axis analog gyro.
- * This gyroscope measures x-axis angular velocity, that is
- * how fast the sensor is rotating around the x-axis.
- * Calibration of the sensor is necessary for accurate readings.
- *
- * @image html enc03r.jpg
- * @snippet enc03r.cxx Interesting
- */
- class ENC03R {
- public:
-
- /**
- * ENC03R sensor constructor
- *
- * @param pin Analog pin to use
- * @param vref Reference voltage to use; default is 5.0 V
- */
- ENC03R(int pin, float vref=5.0);
-
- /**
- * ENC03R destructor
- */
- ~ENC03R();
-
- /**
- * Calibrates the sensor by determining an analog reading over many
- * samples with no movement of the sensor. This must be done
- * before attempting to use the sensor.
- *
- * @param samples Number of samples to use for calibration
- */
- void calibrate(unsigned int samples);
-
- /**
- * Returns the raw value of the sensor
- *
- * @return Raw value of the sensor
- */
- unsigned int value();
-
- /**
- * Returns the currently stored calibration value
- *
- * @return Current calibration value
- */
- float calibrationValue() { return m_calibrationValue; };
-
- /**
- * Computes angular velocity based on the value and stored calibration
- * reference.
- *
- * @param val Value to use to compute angular velocity
- * @return Computed angular velocity
- */
- double angularVelocity(unsigned int val);
-
- private:
- // determined by calibrate();
- float m_calibrationValue;
-
- // reference voltage
- float m_vref;
- mraa_aio_context m_aio;
- };
-}
-
-
diff --git a/peripheral/libupm/src/enc03r/javaupm_enc03r.i b/peripheral/libupm/src/enc03r/javaupm_enc03r.i
deleted file mode 100644
index 2557969..0000000
--- a/peripheral/libupm/src/enc03r/javaupm_enc03r.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_enc03r
-%include "../upm.i"
-
-%{
- #include "enc03r.h"
-%}
-
-%include "enc03r.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_enc03r");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/enc03r/jsupm_enc03r.i b/peripheral/libupm/src/enc03r/jsupm_enc03r.i
deleted file mode 100644
index b47cdd4..0000000
--- a/peripheral/libupm/src/enc03r/jsupm_enc03r.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_enc03r
-%include "../upm.i"
-
-%{
- #include "enc03r.h"
-%}
-
-%include "enc03r.h"
diff --git a/peripheral/libupm/src/enc03r/pyupm_enc03r.i b/peripheral/libupm/src/enc03r/pyupm_enc03r.i
deleted file mode 100644
index c50e66a..0000000
--- a/peripheral/libupm/src/enc03r/pyupm_enc03r.i
+++ /dev/null
@@ -1,11 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_enc03r
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "enc03r.h"
-%{
- #include "enc03r.h"
-%}
diff --git a/peripheral/libupm/src/flex/CMakeLists.txt b/peripheral/libupm/src/flex/CMakeLists.txt
deleted file mode 100644
index 5769281..0000000
--- a/peripheral/libupm/src/flex/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "flex")
-set (libdescription "upm flex sensor module")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/flex/flex.cxx b/peripheral/libupm/src/flex/flex.cxx
deleted file mode 100644
index 4e63362..0000000
--- a/peripheral/libupm/src/flex/flex.cxx
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Author: Zion Orent <zorent@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <string>
-#include <stdexcept>
-
-#include "flex.h"
-
-using namespace upm;
-using namespace std;
-
-Flex::Flex(int pin)
-{
- if ( !(m_aio = mraa_aio_init(pin)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_aio_init() failed, invalid pin?");
- return;
- }
-}
-
-Flex::~Flex()
-{
- mraa_aio_close(m_aio);
-}
-
-int Flex::value()
-{
- return mraa_aio_read(m_aio);
-}
diff --git a/peripheral/libupm/src/flex/flex.h b/peripheral/libupm/src/flex/flex.h
deleted file mode 100644
index 7ac4ad1..0000000
--- a/peripheral/libupm/src/flex/flex.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Author: Zion Orent <zorent@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include <mraa/aio.h>
-
-namespace upm {
-
- /**
- * @brief Spectra Symbol Flex Sensor library
- * @defgroup flex libupm-flex
- * @ingroup sparkfun analog flexfor
- */
-
- /**
- * @library flex
- * @sensor flex
- * @comname Flex Sensor
- * @type flexfor
- * @man sparkfun
- * @web https://www.sparkfun.com/products/8606
- * @con analog
- *
- * @brief API for the Spectra Symbol Flex Sensor
- *
- * A simple flex sensor. The resistance across the sensor increases when
- * flexed. Patented technology by Spectra Symbol, these sensors were used in
- * the original Nintendo* Power Glove.
- *
- * @image html flex.jpg
- * <br><em>Flex Sensor image provided by SparkFun* under
- * <a href=https://creativecommons.org/licenses/by-nc-sa/3.0/>
- * CC BY-NC-SA-3.0</a>.</em>
- *
- * @snippet flex.cxx Interesting
- */
- class Flex {
- public:
- /**
- * Flex sensor constructor
- *
- * @param pin Analog pin to use
- */
- Flex(int pin);
- /**
- * Flex sensor destructor
- */
- ~Flex();
- /**
- * @return Analog flex value
- */
- int value();
-
- private:
- mraa_aio_context m_aio;
- };
-}
-
-
diff --git a/peripheral/libupm/src/flex/javaupm_flex.i b/peripheral/libupm/src/flex/javaupm_flex.i
deleted file mode 100644
index fc28dcf..0000000
--- a/peripheral/libupm/src/flex/javaupm_flex.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_flex
-%include "../upm.i"
-
-%{
- #include "flex.h"
-%}
-
-%include "flex.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_flex");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/flex/jsupm_flex.i b/peripheral/libupm/src/flex/jsupm_flex.i
deleted file mode 100644
index 12c45f3..0000000
--- a/peripheral/libupm/src/flex/jsupm_flex.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_flex
-%include "../upm.i"
-
-%{
- #include "flex.h"
-%}
-
-%include "flex.h"
diff --git a/peripheral/libupm/src/flex/pyupm_flex.i b/peripheral/libupm/src/flex/pyupm_flex.i
deleted file mode 100644
index e964689..0000000
--- a/peripheral/libupm/src/flex/pyupm_flex.i
+++ /dev/null
@@ -1,11 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_flex
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "flex.h"
-%{
- #include "flex.h"
-%}
diff --git a/peripheral/libupm/src/gas/CMakeLists.txt b/peripheral/libupm/src/gas/CMakeLists.txt
deleted file mode 100644
index 9d50cc2..0000000
--- a/peripheral/libupm/src/gas/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "gas")
-set (libdescription "Gas sensors")
-set (module_src ${libname}.cxx mq2.cxx mq3.cxx mq4.cxx mq5.cxx mq6.cxx mq7.cxx mq8.cxx mq9.cxx tp401.cxx)
-set (module_h ${libname}.h mq2.h mq3.h mq4.h mq5.h mq6.h mq7.h mq8.h mq9.h tp401.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/gas/README.txt b/peripheral/libupm/src/gas/README.txt
deleted file mode 100644
index 3045f0f..0000000
--- a/peripheral/libupm/src/gas/README.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-Grove - Gas Sensor(MQ-2):Combustible Gas Smoke [medium sensitivity]
-Grove - Gas Sensor(MQ-3):Alcohol and Benzine [high sensitivity] Long warm-up
-Grove - Gas Sensor(MQ-5):LPG, Natural Gas, Town Gas [high sensitivity]
-Grove - Gas Sensor(MQ-9):LPG, CO, CH4 [low sensitivity]
-Grove - Air Quality Sensor(TP-401): CO, alcohol, acetone, thinner, others [high sensitivity].
-
-Note - Gas sensors need to be heated, first minute the data is incorrect. Air
-Quality sensor needs 48h to stabilize.
diff --git a/peripheral/libupm/src/gas/gas.cxx b/peripheral/libupm/src/gas/gas.cxx
deleted file mode 100644
index a43b82c..0000000
--- a/peripheral/libupm/src/gas/gas.cxx
+++ /dev/null
@@ -1,98 +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 <iostream>
-#include <unistd.h>
-#include <stdlib.h>
-#include <functional>
-#include <string.h>
-#include <stdexcept>
-#include "gas.h"
-
-using namespace upm;
-
-Gas::Gas(int gasPin) : m_aio(gasPin) {
-}
-
-Gas::~Gas() {
-}
-
-int
-Gas::getSampledWindow (unsigned int freqMS, int numberOfSamples,
- uint16_t * buffer) {
- int sampleIdx = 0;
-
- // must have freq
- if (!freqMS) {
- return 0;
- }
-
- // too many samples
- if (numberOfSamples > 0xFFFFFF) {
- return 0;
- }
-
- while (sampleIdx < numberOfSamples) {
- buffer[sampleIdx++] = getSample();
- usleep(freqMS * 1000);
- }
-
- return sampleIdx;
-}
-
-int
-Gas::findThreshold (thresholdContext* ctx, unsigned int threshold,
- uint16_t * buffer, int len) {
- long sum = 0;
- for (unsigned int i = 0; i < len; i++) {
- sum += buffer[i];
- }
-
- ctx->averageReading = sum / len;
- ctx->runningAverage = (((ctx->averagedOver-1) * ctx->runningAverage) + ctx->averageReading) / ctx->averagedOver;
-
- if (ctx->runningAverage > threshold) {
- return ctx->runningAverage;
- } else {
- return 0;
- }
-}
-
-int
-Gas::getSampledData (thresholdContext* ctx) {
- return ctx->runningAverage;
-}
-
-int
-Gas::getSample () {
- return m_aio.read();
-}
-
-void
-Gas::printGraph (thresholdContext* ctx, uint8_t resolution) {
- std::cout << "(" << ctx->runningAverage << ") | ";
- for (int i = 0; i < ctx->runningAverage / resolution; i++)
- std::cout << "*";
- std::cout << std::endl;
-}
diff --git a/peripheral/libupm/src/gas/gas.h b/peripheral/libupm/src/gas/gas.h
deleted file mode 100644
index 19bd781..0000000
--- a/peripheral/libupm/src/gas/gas.h
+++ /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.
- */
-#pragma once
-
-#include <string>
-#include <mraa/aio.hpp>
-
-struct thresholdContext {
- long averageReading;
- long runningAverage;
- int averagedOver;
-};
-
-namespace upm {
-/**
- * @brief Gas Sensor library
- *
- * Library for air quality and gas detecting sensors. Base class Gas provides buffered
- * sampling, threshold checking, basic printing function, and standard read function.
- *
- * @defgroup gas libupm-gas
- * @ingroup seeed analog gaseous eak hak
- */
-class Gas {
- public:
- /**
- * Instantiates a Gas object
- *
- * @param gasPin Pin where gas is connected
- */
- Gas(int gasPin);
-
- /**
- * Gas object destructor
- */
- ~Gas();
-
- /**
- * Gets samples from the gas sensor according to the provided window and
- * number of samples
- *
- * @param freqMS Time between each sample (in milliseconds)
- * @param numberOfSamples Number of sample to sample for this window
- * @param buffer Buffer with sampled data
- */
- virtual int getSampledWindow (unsigned int freqMS, int numberOfSamples, uint16_t * buffer);
-
- /**
- * Given the sampled buffer, this method returns TRUE/FALSE if the threshold
- * is reached
- *
- * @param ctx Threshold context
- * @param threshold Sample threshold
- * @param buffer Buffer with samples
- * @param len Buffer length
- */
- virtual int findThreshold (thresholdContext* ctx, unsigned int threshold, uint16_t * buffer, int len);
-
- /**
- * Returns average data for the sampled window
- *
- * @param ctx Threshold context
- */
- virtual int getSampledData (thresholdContext* ctx);
-
- /**
- * Returns one sample from the sensor
- */
- virtual int getSample ();
-
- /**
- *
- * Prints a running average of the threshold context
- *
- * @param ctx Threshold context
- */
- virtual void printGraph (thresholdContext* ctx, uint8_t resolution);
-
- protected:
- mraa::Aio m_aio;
-};
-
-}
diff --git a/peripheral/libupm/src/gas/javaupm_gas.i b/peripheral/libupm/src/gas/javaupm_gas.i
deleted file mode 100644
index fc3b016..0000000
--- a/peripheral/libupm/src/gas/javaupm_gas.i
+++ /dev/null
@@ -1,68 +0,0 @@
-%module javaupm_gas
-%include "../upm.i"
-%include "typemaps.i"
-
-%{
- #include "gas.h"
- #include "mq2.h"
- #include "mq3.h"
- #include "mq4.h"
- #include "mq5.h"
- #include "mq6.h"
- #include "mq7.h"
- #include "mq8.h"
- #include "mq9.h"
- #include "tp401.h"
-%}
-
-%typemap(jni) (uint16_t *buffer, int len) "jshortArray";
-%typemap(jtype) (uint16_t *buffer, int len) "short[]";
-%typemap(jstype) (uint16_t *buffer, int len) "short[]";
-
-%typemap(javain) (uint16_t *buffer, int len) "$javainput";
-
-%typemap(in) (uint16_t *buffer, int len) {
- $1 = (uint16_t *) JCALL2(GetShortArrayElements, jenv, $input, NULL);
- $2 = JCALL1(GetArrayLength, jenv, $input);
-}
-
-%typemap(freearg) (uint16_t *buffer, int len) {
- JCALL3(ReleaseShortArrayElements, jenv, $input, (jshort *)$1, 0);
-}
-
-%typemap(jni) (int numberOfSamples, uint16_t *buffer) "jshortArray";
-%typemap(jtype) (int numberOfSamples, uint16_t *buffer) "short[]";
-%typemap(jstype) (int numberOfSamples, uint16_t *buffer) "short[]";
-
-%typemap(javain) (int numberOfSamples, uint16_t *buffer) "$javainput";
-
-%typemap(in) (int numberOfSamples, uint16_t *buffer) {
- $2 = (uint16_t *) JCALL2(GetShortArrayElements, jenv, $input, NULL);
- $1 = JCALL1(GetArrayLength, jenv, $input);
-}
-
-%typemap(freearg) (int numberOfSamples, uint16_t *buffer) {
- JCALL3(ReleaseShortArrayElements, jenv, $input, (jshort *)$2, 0);
-}
-
-%include "gas.h"
-%include "mq2.h"
-%include "mq3.h"
-%include "mq4.h"
-%include "mq5.h"
-%include "mq6.h"
-%include "mq7.h"
-%include "mq8.h"
-%include "mq9.h"
-%include "tp401.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_gas");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/gas/jsupm_gas.i b/peripheral/libupm/src/gas/jsupm_gas.i
deleted file mode 100644
index 25a5097..0000000
--- a/peripheral/libupm/src/gas/jsupm_gas.i
+++ /dev/null
@@ -1,53 +0,0 @@
-%module jsupm_gas
-%include "../upm.i"
-%include "../carrays_uint16_t.i"
-
-%include "gas.h"
-%{
- #include "gas.h"
-%}
-
-%include "mq2.h"
-%{
- #include "mq2.h"
-%}
-
-%include "mq3.h"
-%{
- #include "mq3.h"
-%}
-
-%include "mq4.h"
-%{
- #include "mq4.h"
-%}
-
-%include "mq5.h"
-%{
- #include "mq5.h"
-%}
-
-%include "mq6.h"
-%{
- #include "mq6.h"
-%}
-
-%include "mq7.h"
-%{
- #include "mq7.h"
-%}
-
-%include "mq8.h"
-%{
- #include "mq8.h"
-%}
-
-%include "mq9.h"
-%{
- #include "mq9.h"
-%}
-
-%include "tp401.h"
-%{
- #include "tp401.h"
-%}
diff --git a/peripheral/libupm/src/gas/mq2.cxx b/peripheral/libupm/src/gas/mq2.cxx
deleted file mode 100644
index d91dc35..0000000
--- a/peripheral/libupm/src/gas/mq2.cxx
+++ /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.
- */
-
-#include "mq2.h"
-
-using namespace upm;
-
-MQ2::MQ2 (int gasPin) : Gas (gasPin) {
-}
-
-MQ2::~MQ2 () {
-}
diff --git a/peripheral/libupm/src/gas/mq2.h b/peripheral/libupm/src/gas/mq2.h
deleted file mode 100644
index a30d737..0000000
--- a/peripheral/libupm/src/gas/mq2.h
+++ /dev/null
@@ -1,74 +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 <iostream>
-#include <string>
-#include "gas.h"
-
-namespace upm {
- /**
- * @library gas
- * @sensor mq2
- * @comname Grove MQ2 Gas Sensor
- * @type gaseous
- * @man seeed
- * @con analog
- * @kit hak
- *
- * @brief API for the Grove MQ2 Gas Sensor
- *
- * The Grove MQ2 Gas Sensor module is useful for gas leakage detection
- * (in home and industry). It can detect LPG, i-butane, methane, alcohol,
- * hydrogen, smoke, and other combustible gases. It's a medium-sensitivity
- * sensor with a detection range of 300-10,000 ppm.
- *
- * @image html mq2-5.jpeg
- * @snippet mq2.cxx Interesting
- */
- class MQ2 : public Gas {
- public:
- /**
- * MQ2 constructor
- *
- * @param gasPin Analog pin where the sensor is connected
- */
- MQ2 (int gasPin);
-
- /**
- * MQ2 destructor
- */
- ~MQ2 ();
-
- /**
- * Returns the name of the sensor
- */
- std::string name()
- {
- return m_name;
- }
- private:
- std::string m_name;
- };
-}
diff --git a/peripheral/libupm/src/gas/mq3.cxx b/peripheral/libupm/src/gas/mq3.cxx
deleted file mode 100644
index f000a70..0000000
--- a/peripheral/libupm/src/gas/mq3.cxx
+++ /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.
- */
-
-#include "mq3.h"
-
-using namespace upm;
-
-MQ3::MQ3 (int gasPin) : Gas (gasPin) {
-}
-
-MQ3::~MQ3 () {
-}
diff --git a/peripheral/libupm/src/gas/mq3.h b/peripheral/libupm/src/gas/mq3.h
deleted file mode 100644
index 295e2aa..0000000
--- a/peripheral/libupm/src/gas/mq3.h
+++ /dev/null
@@ -1,73 +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 <iostream>
-#include <string>
-#include "gas.h"
-
-namespace upm {
- /**
- * @library gas
- * @sensor mq3
- * @comname Grove MQ3 Gas Sensor
- * @type gaseous
- * @man seeed
- * @con analog
- *
- * @brief API for the MQ3 Gas Sensor
- *
- * The Grove MQ3 Gas Sensor module is useful for gas leakage detection (in
- * home and industry). It can detect alcohol vapors and benzine. It's
- * highly sensitive but has a long warm-up time of about 1 minute. It's
- * detection range is 0.04-4 mg/L Alcohol.
- *
- * @image html mq3-9.jpeg
- * @snippet mq3.cxx Interesting
- */
- class MQ3 : public Gas {
- public:
- /**
- * MQ3 constructor
- *
- * @param gasPin Analog pin where the sensor is connected
- */
- MQ3 (int gasPin);
-
- /**
- * MQ3 destructor
- */
- ~MQ3 ();
-
- /**
- * Returns the name of the sensor
- */
- std::string name()
- {
- return m_name;
- }
- private:
- std::string m_name;
- };
-}
diff --git a/peripheral/libupm/src/gas/mq4.cxx b/peripheral/libupm/src/gas/mq4.cxx
deleted file mode 100644
index ac136ce..0000000
--- a/peripheral/libupm/src/gas/mq4.cxx
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include "mq4.h"
-
-using namespace upm;
-
-MQ4::MQ4 (int gasPin) : Gas (gasPin)
-{
-}
-
-MQ4::~MQ4 ()
-{
-}
diff --git a/peripheral/libupm/src/gas/mq4.h b/peripheral/libupm/src/gas/mq4.h
deleted file mode 100644
index 581c908..0000000
--- a/peripheral/libupm/src/gas/mq4.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <iostream>
-#include <string>
-#include "gas.h"
-
-namespace upm {
- /**
- * @library gas
- * @sensor mq4
- * @comname DFRobot MQ4 Gas Sensor
- * @type gaseous
- * @man dfrobot
- * @con analog
- *
- * @brief API for the DFRobot MQ4 Gas Sensor
- *
- * The MQ4 Gas Sensor module is useful for detecting CH4 (Methane),
- * and natural gas concentrations in the air. It has a
- * detection range of 100-10000 ppm.
- *
- * For optimum use, it requires calibration after a pre-heat time of
- * at least 24 hours. See the datasheet for details.
- *
- * @image html mq2-5.jpeg
- * @snippet mq4.cxx Interesting
- */
- class MQ4 : public Gas {
- public:
- /**
- * MQ4 constructor
- *
- * @param gasPin Analog pin where the sensor is connected
- */
- MQ4 (int gasPin);
-
- /**
- * MQ4 destructor
- */
- ~MQ4 ();
-
- /**
- * Returns the name of the sensor
- */
- std::string name()
- {
- return m_name;
- }
- private:
- std::string m_name;
- };
-}
diff --git a/peripheral/libupm/src/gas/mq5.cxx b/peripheral/libupm/src/gas/mq5.cxx
deleted file mode 100644
index 8d1536f..0000000
--- a/peripheral/libupm/src/gas/mq5.cxx
+++ /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.
- */
-
-#include "mq5.h"
-
-using namespace upm;
-
-MQ5::MQ5 (int gasPin) : Gas (gasPin) {
-}
-
-MQ5::~MQ5 () {
-}
diff --git a/peripheral/libupm/src/gas/mq5.h b/peripheral/libupm/src/gas/mq5.h
deleted file mode 100644
index ec176f7..0000000
--- a/peripheral/libupm/src/gas/mq5.h
+++ /dev/null
@@ -1,74 +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 <iostream>
-#include <string>
-#include "gas.h"
-
-namespace upm {
- /**
- * @library gas
- * @sensor mq5
- * @comname Grove MQ5 Gas Sensor
- * @type gaseous
- * @man seeed
- * @con analog
- * @kit eak
- *
- * @brief API for the MQ5 Gas Sensor
- *
- * The Grove MQ5 Gas Sensor module is useful for gas leakage detection
- * (in home and industry). It can detect LPG, natural gas, town gas, and so
- * on. It is highly sensitive and has a detection range of
- * 300-10,000 ppm.
- *
- * @image html mq2-5.jpeg
- * @snippet mq5.cxx Interesting
- */
- class MQ5 : public Gas {
- public:
- /**
- * MQ5 constructor
- *
- * @param gasPin Analog pin where the sensor is connected
- */
- MQ5 (int gasPin);
-
- /**
- * MQ9 destructor
- */
- ~MQ5 ();
-
- /**
- * Returns the name of the sensor
- */
- std::string name()
- {
- return m_name;
- }
- private:
- std::string m_name;
- };
-}
diff --git a/peripheral/libupm/src/gas/mq6.cxx b/peripheral/libupm/src/gas/mq6.cxx
deleted file mode 100644
index 90fae15..0000000
--- a/peripheral/libupm/src/gas/mq6.cxx
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include "mq6.h"
-
-using namespace upm;
-
-MQ6::MQ6 (int gasPin) : Gas (gasPin)
-{
-}
-
-MQ6::~MQ6 ()
-{
-}
diff --git a/peripheral/libupm/src/gas/mq6.h b/peripheral/libupm/src/gas/mq6.h
deleted file mode 100644
index fafa7fd..0000000
--- a/peripheral/libupm/src/gas/mq6.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <iostream>
-#include <string>
-#include "gas.h"
-
-namespace upm {
- /**
- * @library gas
- * @sensor mq6
- * @comname DFRobot MQ6 LPG Gas Sensor
- * @type gaseous
- * @man dfrobot
- * @con analog
- *
- * @brief API for the DFRobot MQ6 LPG Gas Sensor
- *
- * The MQ6 Gas Sensor module is useful for detecting LPG,
- * iso-butane, propane, and LNG concentrations in the air. It has a
- * detection range of 200-10000 ppm.
- *
- * For optimum use, it requires calibration after a pre-heat time of
- * at least 24 hours. See the datasheet for details.
- *
- * @image html mq2-5.jpeg
- * @snippet mq6.cxx Interesting
- */
- class MQ6 : public Gas {
- public:
- /**
- * MQ6 constructor
- *
- * @param gasPin Analog pin where the sensor is connected
- */
- MQ6 (int gasPin);
-
- /**
- * MQ6 destructor
- */
- ~MQ6 ();
-
- /**
- * Returns the name of the sensor
- */
- std::string name()
- {
- return m_name;
- }
- private:
- std::string m_name;
- };
-}
diff --git a/peripheral/libupm/src/gas/mq7.cxx b/peripheral/libupm/src/gas/mq7.cxx
deleted file mode 100644
index 76201a4..0000000
--- a/peripheral/libupm/src/gas/mq7.cxx
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include "mq7.h"
-
-using namespace upm;
-
-MQ7::MQ7 (int gasPin) : Gas (gasPin)
-{
-}
-
-MQ7::~MQ7 ()
-{
-}
diff --git a/peripheral/libupm/src/gas/mq7.h b/peripheral/libupm/src/gas/mq7.h
deleted file mode 100644
index 1550a3e..0000000
--- a/peripheral/libupm/src/gas/mq7.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <iostream>
-#include <string>
-#include "gas.h"
-
-namespace upm {
- /**
- * @library gas
- * @sensor mq7
- * @comname DFRobot MQ7 CO Gas Sensor
- * @type gaseous
- * @man dfrobot
- * @con analog
- *
- * @brief API for the DFRobot MQ7 CO Gas Sensor
- *
- * The Grove MQ7 Gas Sensor module is useful for detecting Carbon
- * Monoxide (CO) concentrations in the air. It has a detection
- * range of 20-2000 ppm.
- *
- * For optimum use, it requires calibration after a pre-heat time of
- * 48 hours. See the datasheet for details.
- *
- * @image html mq3-9.jpeg
- * @snippet mq7.cxx Interesting
- */
- class MQ7 : public Gas {
- public:
- /**
- * MQ7 constructor
- *
- * @param gasPin Analog pin where the sensor is connected
- */
- MQ7 (int gasPin);
-
- /**
- * MQ7 destructor
- */
- ~MQ7 ();
-
- /**
- * Returns the name of the sensor
- */
- std::string name()
- {
- return m_name;
- }
- private:
- std::string m_name;
- };
-}
diff --git a/peripheral/libupm/src/gas/mq8.cxx b/peripheral/libupm/src/gas/mq8.cxx
deleted file mode 100644
index 667eab5..0000000
--- a/peripheral/libupm/src/gas/mq8.cxx
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include "mq8.h"
-
-using namespace upm;
-
-MQ8::MQ8 (int gasPin) : Gas (gasPin)
-{
-}
-
-MQ8::~MQ8 ()
-{
-}
diff --git a/peripheral/libupm/src/gas/mq8.h b/peripheral/libupm/src/gas/mq8.h
deleted file mode 100644
index 10bc7a4..0000000
--- a/peripheral/libupm/src/gas/mq8.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <iostream>
-#include <string>
-#include "gas.h"
-
-namespace upm {
- /**
- * @library gas
- * @sensor mq8
- * @comname DFRobot MQ8 CO Gas Sensor
- * @type gaseous
- * @man dfrobot
- * @con analog
- *
- * @brief API for the DFRobot MQ8 Hydrogen (H2) Gas Sensor
- *
- * The MQ8 Gas Sensor module is useful for detecting Hydrogen gas
- * concentrations in the air. It has a detection range of 100-10000
- * ppm.
- *
- * For optimum use, it requires calibration after a pre-heat time of
- * at least 24 hours. See the datasheet for details.
- *
- * @image html mq2-5.jpeg
- * @snippet mq8.cxx Interesting
- */
- class MQ8 : public Gas {
- public:
- /**
- * MQ8 constructor
- *
- * @param gasPin Analog pin where the sensor is connected
- */
- MQ8 (int gasPin);
-
- /**
- * MQ8 destructor
- */
- ~MQ8 ();
-
- /**
- * Returns the name of the sensor
- */
- std::string name()
- {
- return m_name;
- }
- private:
- std::string m_name;
- };
-}
diff --git a/peripheral/libupm/src/gas/mq9.cxx b/peripheral/libupm/src/gas/mq9.cxx
deleted file mode 100644
index f9ee171..0000000
--- a/peripheral/libupm/src/gas/mq9.cxx
+++ /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.
- */
-
-#include "mq9.h"
-
-using namespace upm;
-
-MQ9::MQ9 (int gasPin) : Gas (gasPin) {
-}
-
-MQ9::~MQ9 () {
-}
diff --git a/peripheral/libupm/src/gas/mq9.h b/peripheral/libupm/src/gas/mq9.h
deleted file mode 100644
index dada03a..0000000
--- a/peripheral/libupm/src/gas/mq9.h
+++ /dev/null
@@ -1,72 +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 <iostream>
-#include <string>
-#include "gas.h"
-
-namespace upm {
- /**
- * @library gas
- * @sensor mq9
- * @comname Grove MQ9 Gas Sensor
- * @type gaseous
- * @man seeed
- * @con analog
- *
- * @brief API for the MQ9 Gas Sensor
- *
- * The Grove MQ9 Gas Sensor module is useful for gas leakage detection (in
- * home and industry). It can detect carbon monoxide, coal gas, and
- * liquefied gas. Its sensitivity is 10-1,000 ppm CO, and 100-10,000 ppm Gas.
- *
- * @image html mq3-9.jpeg
- * @snippet mq9.cxx Interesting
- */
- class MQ9 : public Gas {
- public:
- /**
- * MQ9 constructor
- *
- * @param gasPin Analog pin where the sensor is connected
- */
- MQ9 (int gasPin);
-
- /**
- * MQ9 destructor
- */
- ~MQ9 ();
-
- /**
- * Returns the name of the sensor
- */
- std::string name()
- {
- return m_name;
- }
- private:
- std::string m_name;
- };
-}
diff --git a/peripheral/libupm/src/gas/pyupm_gas.i b/peripheral/libupm/src/gas/pyupm_gas.i
deleted file mode 100644
index 1af489d..0000000
--- a/peripheral/libupm/src/gas/pyupm_gas.i
+++ /dev/null
@@ -1,57 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_gas
-%include "../upm.i"
-%include "../carrays_uint16_t.i"
-
-%feature("autodoc", "3");
-
-%include "gas.h"
-%{
- #include "gas.h"
-%}
-
-%include "mq2.h"
-%{
- #include "mq2.h"
-%}
-
-%include "mq3.h"
-%{
- #include "mq3.h"
-%}
-
-%include "mq4.h"
-%{
- #include "mq4.h"
-%}
-
-%include "mq5.h"
-%{
- #include "mq5.h"
-%}
-
-%include "mq6.h"
-%{
- #include "mq6.h"
-%}
-
-%include "mq7.h"
-%{
- #include "mq7.h"
-%}
-
-%include "mq8.h"
-%{
- #include "mq8.h"
-%}
-
-%include "mq9.h"
-%{
- #include "mq9.h"
-%}
-
-%include "tp401.h"
-%{
- #include "tp401.h"
-%}
diff --git a/peripheral/libupm/src/gas/tp401.cxx b/peripheral/libupm/src/gas/tp401.cxx
deleted file mode 100644
index 9426355..0000000
--- a/peripheral/libupm/src/gas/tp401.cxx
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Author: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include "tp401.h"
-
-using namespace upm;
-
-TP401::TP401 (int gasPin) : Gas (gasPin) {
- m_name = "Grove Air Quality Sensor";
-}
-
-TP401::~TP401 () {
-}
-
-float
-TP401::getPPM() {
- return 25.0 * (float)TP401::getSample() / 1023.0;
-}
diff --git a/peripheral/libupm/src/gas/tp401.h b/peripheral/libupm/src/gas/tp401.h
deleted file mode 100644
index 494cbb5..0000000
--- a/peripheral/libupm/src/gas/tp401.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Author: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <iostream>
-#include <string>
-#include "gas.h"
-
-namespace upm {
- /**
- * @library gas
- * @sensor tp401
- * @comname Grove Air Quality Sensor
- * @altname TP401 Gas Sensor
- * @type gaseous
- * @man seeed
- * @con analog
- * @kit hak
- *
- * @brief API for the Grove TP401 Air Quality Sensor
- *
- * The Grove TP401 Air Quality Sensor module is useful for monitoring air purity indoors.
- * It can detect CO and a wide range of other harmful gases, but, due to a limited detection
- * range, it should be used only when qualitative results are needed. Example applications
- * are air recirculation, ventilation systems, and refreshing sprayers.
- * The sensor is linear and should be roughly sensitive to 0-20 ppm CO from 0-4 V.
- * Note: the sensor requires 2-3 minutes to warm up initially and 48 hours of
- * operation to stabilize completely.
- *
- * @image html tp401.jpeg
- * @snippet tp401.cxx Interesting
- */
- class TP401 : public Gas {
- public:
- /**
- * TP401 constructor
- *
- * @param gasPin Analog pin where the sensor is connected
- */
- TP401 (int gasPin);
-
- /**
- * TP401 destructor
- */
- ~TP401 ();
-
- /**
- * Returns the name of the sensor
- *
- * @return Name of the sensor
- */
- std::string name()
- {
- return m_name;
- }
-
- /**
- * Returns one sample in parts per million (ppm) of CO in the air based on
- * the following sensor calibration: 0-4 V is roughly 0-20 ppm CO
- *
- * @return New sample converted to ppm CO
- */
- float getPPM();
-
- private:
- std::string m_name;
- };
-}
diff --git a/peripheral/libupm/src/gp2y0a/CMakeLists.txt b/peripheral/libupm/src/gp2y0a/CMakeLists.txt
deleted file mode 100644
index ddb50a5..0000000
--- a/peripheral/libupm/src/gp2y0a/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "gp2y0a")
-set (libdescription "upm gp2y0a family of IR distance detectors")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/gp2y0a/gp2y0a.cxx b/peripheral/libupm/src/gp2y0a/gp2y0a.cxx
deleted file mode 100644
index 07abc7d..0000000
--- a/peripheral/libupm/src/gp2y0a/gp2y0a.cxx
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <string>
-#include <stdexcept>
-
-#include "gp2y0a.h"
-
-using namespace std;
-using namespace upm;
-
-GP2Y0A::GP2Y0A(int pin)
-{
- if (!(m_aio = mraa_aio_init(pin)))
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_aio_init() failed, invalid pin?");
- return;
- }
-
- // get the ADC resolution
- m_aRes = (1 << mraa_aio_get_bit(m_aio));
-}
-
-GP2Y0A::~GP2Y0A()
-{
- mraa_aio_close(m_aio);
-}
-
-float GP2Y0A::value(float aref, uint8_t samples)
-{
- int val;
- int sum = 0;
-
- for (int i=0; i<samples; i++)
- {
- val = mraa_aio_read(m_aio);
- sum += val;
- }
-
- val = sum / samples;
- float volts = float(val) * aref / float(m_aRes);
-
- return volts;
-}
diff --git a/peripheral/libupm/src/gp2y0a/gp2y0a.h b/peripheral/libupm/src/gp2y0a/gp2y0a.h
deleted file mode 100644
index d3d4213..0000000
--- a/peripheral/libupm/src/gp2y0a/gp2y0a.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <iostream>
-#include <string>
-#include <mraa/aio.h>
-
-namespace upm {
- /**
- * @brief GP2Y0A-based IR Proximity Sensor library
- * @defgroup gp2y0a libupm-gp2y0a
- * @ingroup seeed analog light
- */
-
- /**
- * @library gp2y0a
- * @sensor gp2y0a
- * @comname GP2Y0A IR Proximity Sensor
- * @altname Grove 80cm IR Proximity Sensor
- * @type light
- * @man seeed
- * @con analog
- *
- * @brief API for the GP2Y0A family of IR Proximity Sensors
- *
- * Sensors of this family return an analog voltage corresponding to the distance
- * of an object from the sensor. The voltage is lower when objects
- * are far away; the voltage increases as objects get closer
- * to the sensor.
- *
- * @image html gp2y0a.jpg
- * @snippet gp2y0a.cxx Interesting
- */
- class GP2Y0A {
- public:
-
- /**
- * GP2Y0A sensor constructor
- *
- * @param pin Analog pin to use
- */
- GP2Y0A(int pin);
-
- /**
- * GP2Y0A destructor
- */
- ~GP2Y0A();
-
- /**
- * Gets an average voltage value from the sensor
- *
- * @param aref Reference voltage in use (usually 5.0V or 3.3V)
- * @param samples Number of samples to average over
- * @return Average voltage reading
- */
- float value(float aref, uint8_t samples);
-
- private:
- mraa_aio_context m_aio;
- // ADC resolution
- int m_aRes;
- };
-}
-
-
diff --git a/peripheral/libupm/src/gp2y0a/javaupm_gp2y0a.i b/peripheral/libupm/src/gp2y0a/javaupm_gp2y0a.i
deleted file mode 100644
index 8b2f761..0000000
--- a/peripheral/libupm/src/gp2y0a/javaupm_gp2y0a.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_gp2y0a
-%include "../upm.i"
-
-%{
- #include "gp2y0a.h"
-%}
-
-%include "gp2y0a.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_gp2y0a");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/gp2y0a/jsupm_gp2y0a.i b/peripheral/libupm/src/gp2y0a/jsupm_gp2y0a.i
deleted file mode 100644
index 95eaad2..0000000
--- a/peripheral/libupm/src/gp2y0a/jsupm_gp2y0a.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_gp2y0a
-%include "../upm.i"
-
-%{
- #include "gp2y0a.h"
-%}
-
-%include "gp2y0a.h"
diff --git a/peripheral/libupm/src/gp2y0a/pyupm_gp2y0a.i b/peripheral/libupm/src/gp2y0a/pyupm_gp2y0a.i
deleted file mode 100644
index dba38d3..0000000
--- a/peripheral/libupm/src/gp2y0a/pyupm_gp2y0a.i
+++ /dev/null
@@ -1,11 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_gp2y0a
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "gp2y0a.h"
-%{
- #include "gp2y0a.h"
-%}
diff --git a/peripheral/libupm/src/grove/CMakeLists.txt b/peripheral/libupm/src/grove/CMakeLists.txt
deleted file mode 100644
index c102c2e..0000000
--- a/peripheral/libupm/src/grove/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "grove")
-set (libdescription "upm grove module")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/grove/grove.cxx b/peripheral/libupm/src/grove/grove.cxx
deleted file mode 100644
index 4be1f3e..0000000
--- a/peripheral/libupm/src/grove/grove.cxx
+++ /dev/null
@@ -1,302 +0,0 @@
-/*
- * Author: Brendan Le Foll <brendan.le.foll@intel.com>
- * Contributions: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
- * Contributions: Sarah Knepper <sarah.knepper@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <string>
-#include <stdexcept>
-
-#include "grove.h"
-#include "math.h"
-
-using namespace upm;
-
-//// GroveLed ////
-
-GroveLed::GroveLed(int pin)
-{
- if ( !(m_gpio = mraa_gpio_init(pin)) ) {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_gpio_init() failed, invalid pin?");
- return;
- }
- mraa_gpio_dir(m_gpio, MRAA_GPIO_OUT);
- m_name = "LED Socket";
-}
-
-GroveLed::~GroveLed()
-{
- mraa_gpio_close(m_gpio);
-}
-
-mraa_result_t GroveLed::write(int value)
-{
- if (value >= 1) {
- return mraa_gpio_write(m_gpio, 1);
- }
- return mraa_gpio_write(m_gpio, 0);
-}
-
-mraa_result_t GroveLed::on()
-{
- return write(1);
-}
-
-mraa_result_t GroveLed::off()
-{
- return write(0);
-}
-
-//// GroveRelay ////
-
-GroveRelay::GroveRelay(unsigned int pin)
-{
- if ( !(m_gpio = mraa_gpio_init(pin)) ) {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_gpio_init() failed, invalid pin?");
- return;
- }
- mraa_gpio_dir(m_gpio, MRAA_GPIO_OUT);
- m_name = "Relay Switch";
-}
-
-GroveRelay::~GroveRelay()
-{
- mraa_gpio_close(m_gpio);
-}
-
-mraa_result_t GroveRelay::on()
-{
- return mraa_gpio_write(m_gpio, 1);
-}
-
-mraa_result_t GroveRelay::off()
-{
- return mraa_gpio_write(m_gpio, 0);
-}
-
-bool GroveRelay::isOn()
-{
- return mraa_gpio_read(m_gpio) == 1;
-}
-
-bool GroveRelay::isOff()
-{
- return mraa_gpio_read(m_gpio) == 0;
-}
-
-//// GroveTemp ////
-
-GroveTemp::GroveTemp(unsigned int pin)
-{
- if ( !(m_aio = mraa_aio_init(pin)) ) {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_aio_init() failed, invalid pin?");
- return;
- }
- m_name = "Temperature Sensor";
-}
-
-GroveTemp::~GroveTemp()
-{
- mraa_aio_close(m_aio);
-}
-
-int GroveTemp::value ()
-{
- int a = mraa_aio_read(m_aio);
- float r = (float)(1023.0-a)*10000.0/a;
- float t = 1.0/(log(r/10000.0)/3975.0 + 1.0/298.15)-273.15;
- return (int) round(t);
-}
-
-float GroveTemp::raw_value()
-{
- return (float) mraa_aio_read(m_aio);
-}
-
-//// GroveLight ////
-
-GroveLight::GroveLight(unsigned int pin)
-{
- if ( !(m_aio = mraa_aio_init(pin)) ) {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_aio_init() failed, invalid pin?");
- return;
- }
- m_name = "Light Sensor";
-}
-
-GroveLight::~GroveLight()
-{
- mraa_aio_close(m_aio);
-}
-
-int GroveLight::value()
-{
- // rough conversion to lux, using formula from Grove Starter Kit booklet
- float a = (float) mraa_aio_read(m_aio);
- a = 10000.0/pow(((1023.0-a)*10.0/a)*15.0,4.0/3.0);
- return (int) round(a);
-}
-
-float GroveLight::raw_value()
-{
- return (float) mraa_aio_read(m_aio);
-}
-
-//// GroveRotary ////
-
-GroveRotary::GroveRotary(unsigned int pin)
-{
- if ( !(m_aio = mraa_aio_init(pin)) ) {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_aio_init() failed, invalid pin?");
- return;
- }
- m_name = "Rotary Angle Sensor";
-}
-
-GroveRotary::~GroveRotary()
-{
- mraa_aio_close(m_aio);
-}
-
-float GroveRotary::abs_value()
-{
- return (float) mraa_aio_read(m_aio);
-}
-
-float GroveRotary::abs_deg()
-{
- return GroveRotary::abs_value() * (float) m_max_angle / 1023.0;
-}
-
-float GroveRotary::abs_rad()
-{
- return GroveRotary::abs_deg() * M_PI / 180.0;
-}
-
-float GroveRotary::rel_value()
-{
- return GroveRotary::abs_value() - 512.0;
-}
-
-float GroveRotary::rel_deg()
-{
- return GroveRotary::rel_value() * (float) m_max_angle / 1023.0;
-}
-
-float GroveRotary::rel_rad()
-{
- return GroveRotary::rel_deg() * M_PI / 180.0;
-}
-
-//// GroveSlide ////
-
-GroveSlide::GroveSlide(unsigned int pin, float ref_voltage)
-{
- if ( !(m_aio = mraa_aio_init(pin)) ) {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_aio_init() failed, invalid pin?");
- return;
- }
- m_ref_voltage = ref_voltage;
- m_name = "Slide Potentiometer";
-}
-
-GroveSlide::~GroveSlide()
-{
- mraa_aio_close(m_aio);
-}
-
-float GroveSlide::raw_value()
-{
- return (float) mraa_aio_read(m_aio);
-}
-
-float GroveSlide::voltage_value()
-{
- // conversion to Volts
- float a = GroveSlide::raw_value();
- a = m_ref_voltage * a / 1023.0 ;
- return a;
-}
-
-float GroveSlide::ref_voltage()
-{
- return m_ref_voltage;
-}
-
-//// GroveButton ////
-
-GroveButton::GroveButton(unsigned int pin)
-{
- if ( !(m_gpio = mraa_gpio_init(pin)) ) {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_gpio_init() failed, invalid pin?");
- return;
- }
- mraa_gpio_dir(m_gpio, MRAA_GPIO_IN);
- m_name = "Button Sensor";
-}
-
-GroveButton::~GroveButton()
-{
- mraa_gpio_close(m_gpio);
-}
-
-std::string GroveButton::name()
-{
- return m_name;
-}
-
-int GroveButton::value()
-{
- return mraa_gpio_read(m_gpio);
-}
-
-#ifdef JAVACALLBACK
-void GroveButton::installISR(mraa::Edge level, jobject runnable)
-{
- installISR(level, mraa_java_isr_callback, runnable);
-}
-#endif
-
-void GroveButton::installISR(mraa::Edge level, void (*isr)(void *), void *arg)
-{
- if (m_isrInstalled)
- uninstallISR();
-
- // install our interrupt handler
- mraa_gpio_isr(m_gpio, (mraa_gpio_edge_t) level, isr, arg);
- m_isrInstalled = true;
-}
-
-void GroveButton::uninstallISR()
-{
- mraa_gpio_isr_exit(m_gpio);
- m_isrInstalled = false;
-}
diff --git a/peripheral/libupm/src/grove/grove.h b/peripheral/libupm/src/grove/grove.h
deleted file mode 100644
index 1ef60e9..0000000
--- a/peripheral/libupm/src/grove/grove.h
+++ /dev/null
@@ -1,410 +0,0 @@
-/*
- * Author: Brendan Le Foll <brendan.le.foll@intel.com>
- * Contributions: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
- * Contributions: Sarah Knepper <sarah.knepper@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include <mraa/aio.hpp>
-#include <mraa/gpio.hpp>
-
-namespace upm {
-
-/**
- * @brief Generic library for basic Grove sensors
- * @defgroup grove libupm-grove
- * @ingroup seeed gpio pwm ainput button led light relay temp touch gsk eak hak
- */
-class Grove {
- public:
- virtual ~Grove() {}
- std::string name()
- {
- return m_name;
- }
- protected:
- std::string m_name;
-};
-
-/**
- * @brief API for the Grove LED
- *
- * UPM module for the Grove LED (or other similar light-emitting diodes).
- * An LED is a small lightbulb that emits light in
- * response to a small current. The longer wire of an LED connects
- * to the positive seat (anode); the shorter wire connects to the
- * negative seat (cathode). The flat side of the bulb corresponds
- * to the cathode, while the rounded side corresponds to the anode.
- *
- * @ingroup grove gpio
- * @snippet groveled.cxx Interesting
- * @snippet groveled-multi.cxx Interesting
- * @image html groveled.jpg
- */
-class GroveLed: public Grove {
- public:
- /**
- * Grove LED constructor
- *
- * @param gpio Pin to use
- */
- GroveLed(int pin);
- /**
- * Grove LED destructor
- */
- ~GroveLed();
- /**
- * Turns the LED on or off, depending on the value.
- * If the value is positive (greater than or equal
- * to 1), the LED is turned on. Otherwise, for 0
- * or negative values, the LED is turned off.
- *
- * @param value Tells the LED to turn on (for values >=1)
- * or off (for values <1)
- *
- * @return 0 if successful, non-zero otherwise
- */
- mraa_result_t write(int value);
- /**
- * Turns the LED off
- *
- * @return 0 if successful, non-zero otherwise
- */
- mraa_result_t off();
- /**
- * Turns the LED on
- *
- * @return 0 if successful, non-zero otherwise
- */
- mraa_result_t on();
- private:
- mraa_gpio_context m_gpio;
-};
-
-/**
- * @brief API for the Grove Relay
- *
- * UPM module for the Grove relay switch. Grove relay is a
- * digital normally-open switch that uses low voltage or current to
- * control a higher voltage and/or higher current. When closed,
- * the indicator LED lights up and current is allowed to flow.
- *
- * @ingroup grove gpio
- * @snippet groverelay.cxx Interesting
- * @image html groverelay.jpg
- */
-class GroveRelay: public Grove {
- public:
- /**
- * Grove relay constructor
- *
- * @param gpio Pin to use
- */
- GroveRelay(unsigned int pin);
- /**
- * Grove relay destructor
- */
- ~GroveRelay();
- /**
- * Sets the relay switch to on (closed). This allows current
- * to flow and lights up the indicator LED.
- *
- * @return 0 if successful, non-zero otherwise
- */
- mraa_result_t on();
- /**
- * Sets the relay switch to off (open). This stops current
- * from flowing and the indicator LED is not lit.
- *
- * @return 0 if successful, non-zero otherwise
- */
- mraa_result_t off();
- /**
- * Defines whether the relay switch is closed.
- *
- * @return True if the switch is on (closed), false otherwise
- */
- bool isOn();
- /**
- * Defines whether the relay switch is open.
- *
- * @return True if the switch is off (open), false otherwise
- */
- bool isOff();
- private:
- mraa_gpio_context m_gpio;
-};
-
-/**
- * @brief API for the Grove Temperature Sensor
- *
- * Basic UPM module for the Grove temperature sensor on analog
- *
- * @ingroup grove analog
- * @snippet grovetemp.cxx Interesting
- * @image html grovetemp.jpg
- */
-class GroveTemp: public Grove {
- public:
- /**
- * Grove analog temperature sensor constructor
- *
- * @param pin Analog pin to use
- */
- GroveTemp(unsigned int pin);
- /**
- * GroveTemp destructor
- */
- ~GroveTemp();
- /**
- * Gets the raw value from the AIO pin
- *
- * @return Raw value from the ADC
- */
- float raw_value();
- /**
- * Gets the temperature in Celsius from the sensor
- *
- * @return Normalized temperature in Celsius
- */
- int value();
- private:
- mraa_aio_context m_aio;
-};
-
-/**
- * @brief API for the Grove Light Sensor
- *
- * The Grove light sensor detects the intensity of the ambient light.
- * As the light intensity of the environment increases, the resistance
- * of the sensor decreases. This means the raw value from the
- * analog pin is greater in bright light and smaller in the dark.
- * An approximate lux value can also be returned.
- *
- * @ingroup grove analog
- * @snippet grovelight.cxx Interesting
- * @image html grovelight.jpg
- */
-class GroveLight: public Grove {
- public:
- /**
- * Grove analog light sensor constructor
- *
- * @param pin Analog pin to use
- */
- GroveLight(unsigned int pin);
- /**
- * GroveLight destructor
- */
- ~GroveLight();
- /**
- * Gets the raw value from the AIO pin
- *
- * @return Raw value from the ADC
- */
- float raw_value();
- /**
- * Gets an approximate light value, in lux, from the sensor
- *
- * @return Normalized light reading in lux
- */
- int value();
- private:
- mraa_aio_context m_aio;
-};
-
-/**
- * @brief API for the Grove Rotary Angle Sensor (Knob)
- *
- * Basic UPM module for the Grove rotary angle sensor (knob) on analog. Provides
- * a set of functions to read the absolute pin value, degrees or radians, and another set
- * to do the same relative to the center of the knob range.
- *
- * @ingroup grove analog
- * @snippet groverotary.cxx Interesting
- * @image html groverotary.jpeg
- */
-class GroveRotary: public Grove {
- public:
- /**
- * Grove rotary angle sensor constructor
- *
- * @param pin Number of the analog pin to use
- */
- GroveRotary(unsigned int pin);
- /**
- * GroveRotary destructor
- */
- ~GroveRotary();
- /**
- * Gets the absolute raw value from the AIO pin
- *
- * @return Unsigned value from the ADC
- */
- float abs_value();
- /**
- * Gets absolute raw degrees from the AIO pin
- *
- * @return Unsigned degrees from the ADC
- */
- float abs_deg();
- /**
- * Gets absolute raw radians from the AIO pin
- *
- * @return Unsigned radians from the ADC
- */
- float abs_rad();
- /**
- * Gets the relative value from the AIO pin
- *
- * @return Signed value from the ADC
- */
- float rel_value();
- /**
- * Gets relative degrees from the AIO pin
- *
- * @return Signed degrees from the ADC
- */
- float rel_deg();
- /**
- * Gets relative radians from the AIO pin
- *
- * @return Signed radians from the ADC
- */
- float rel_rad();
- private:
- mraa_aio_context m_aio;
- static const int m_max_angle = 300;
-};
-
-/**
- * @brief API for the Grove Slide Potentiometer
- *
- * Basic UPM module for the Grove slide potentiometer on analog that
- * returns either a raw value or a scaled voltage value.
- *
- * @ingroup grove analog
- * @snippet groveslide.cxx Interesting
- * @image html groveslide.jpeg
- */
-class GroveSlide: public Grove {
- public:
- /**
- * Grove analog slide potentiometer constructor
- *
- * @param pin Number of the analog pin to use
- *
- * @param ref_voltage Reference voltage the board is set to, as a floating-point value; default is 5.0V
- */
- GroveSlide(unsigned int pin, float ref_voltage = 5.0);
- /**
- * GroveSlide destructor
- */
- ~GroveSlide();
- /**
- * Gets the raw value from the AIO pin
- *
- * @return Raw value from the ADC
- */
- float raw_value();
- /**
- * Gets the voltage value from the pin
- *
- * @return Voltage reading based on the reference voltage
- */
- float voltage_value();
- /**
- * Gets the board's reference voltage passed on object initialization
- *
- * @return Reference voltage the class was set for
- */
- float ref_voltage();
- private:
- mraa_aio_context m_aio;
- float m_ref_voltage;
-};
-
-/**
- * @brief API for the Grove Button
- *
- * Basic UPM module for the Grove button
- *
- * @ingroup grove gpio
- * @snippet grovebutton.cxx Interesting
- * @image html grovebutton.jpg
- */
-class GroveButton: public Grove {
- public:
- /**
- * Grove button constructor
- *
- * @param gpio Pin to use
- */
- GroveButton(unsigned int pin);
- /**
- * Grove button destructor
- */
- ~GroveButton();
- /**
- * Gets the name of the sensor
- *
- * @return Name of this sensor
- */
- std::string name();
- /**
- * Gets the value from the GPIO pin
- *
- * @return Value from the GPIO pin
- */
- int value();
-
- /**
- * Installs an interrupt service routine (ISR) to be called when
- * the button is activated or deactivated.
- *
- * @param fptr Pointer to a function to be called on interrupt
- * @param arg Pointer to an object to be supplied as an
- * argument to the ISR.
- */
-#if defined(SWIGJAVA) || defined(JAVACALLBACK)
- void installISR(mraa::Edge level, jobject runnable);
-#else
- void installISR(mraa::Edge level, void (*isr)(void *), void *arg);
-#endif
- /**
- * Uninstalls the previously installed ISR
- *
- */
- void uninstallISR();
-
- private:
-#if defined(SWIGJAVA) || defined(JAVACALLBACK)
- void installISR(mraa::Edge level, void (*isr)(void *), void *arg);
-#endif
- bool m_isrInstalled;
- std::string m_name;
- mraa_gpio_context m_gpio;
-};
-
-}
diff --git a/peripheral/libupm/src/grove/grovebutton.h b/peripheral/libupm/src/grove/grovebutton.h
deleted file mode 100644
index 6f746cc..0000000
--- a/peripheral/libupm/src/grove/grovebutton.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Place-holder Header for Documentation and future API change
- *
- * 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.
- */
-
-/**
- * @library grove
- * @sensor grovebutton
- * @comname Grove Button
- * @altname Grove Touch Sensor
- * @type button touch
- * @man seeed
- * @con gpio
- * @kit gsk
- *
- * @brief API for the Grove Button
- *
- * Basic UPM module for the Grove button
- *
- * @image html grovebutton.jpg
- * @snippet grovebutton.cxx Interesting
- */
diff --git a/peripheral/libupm/src/grove/groveled.h b/peripheral/libupm/src/grove/groveled.h
deleted file mode 100644
index c35c653..0000000
--- a/peripheral/libupm/src/grove/groveled.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Place-holder Header for Documentation and future API change
- *
- * 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.
- */
-
-/**
- * @library grove
- * @sensor groveled
- * @comname Grove LED
- * @type led
- * @man seeed
- * @con gpio
- * @kit gsk
- *
- * @brief API for the Grove LED
- *
- * UPM module for the Grove LED (or other similar light-emitting diodes).
- * An LED is a small lightbulb that emits light in
- * response to a small current. The longer wire of an LED connects
- * to the positive seat (anode); the shorter wire connects to the
- * negative seat (cathode). The flat side of the bulb corresponds
- * to the cathode, while the rounded side corresponds to the anode.
- *
- * @image html groveled.jpg
- * @snippet groveled.cxx Interesting
- * @snippet groveled-multi.cxx Interesting
- */
-
diff --git a/peripheral/libupm/src/grove/grovelight.h b/peripheral/libupm/src/grove/grovelight.h
deleted file mode 100644
index b71d8ad..0000000
--- a/peripheral/libupm/src/grove/grovelight.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Place-holder Header for Documentation and future API change
- *
- * 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.
- */
-
-/**
- * @library grove
- * @sensor grovelight
- * @comname Grove Light Sensor
- * @type light
- * @man seeed
- * @con analog
- * @kit gsk
- *
- * @brief API for the Grove Light Sensor
- *
- * The Grove light sensor detects the intensity of the ambient light.
- * As the light intensity of the environment increases, the resistance
- * of the sensor decreases. This means the raw value from the
- * analog pin is larger in bright light and smaller in the dark.
- * An approximate lux value can also be returned.
- *
- * @image html grovelight.jpg
- * @snippet grovelight.cxx Interesting
- */
-
diff --git a/peripheral/libupm/src/grove/groverelay.h b/peripheral/libupm/src/grove/groverelay.h
deleted file mode 100644
index 6edc77d..0000000
--- a/peripheral/libupm/src/grove/groverelay.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Place-holder Header for Documentation and future API change
- *
- * 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.
- */
-
-/**
- * @library grove
- * @sensor groverelay
- * @comname Grove Relay
- * @type relay
- * @man seeed
- * @con gpio
- * @kit gsk eak hak
- *
- * @brief API for the Grove Relay
- *
- * UPM module for the Grove relay switch. The Grove relay is a
- * digital normally-open switch that uses low voltage or current to
- * control a higher voltage and/or higher current. When closed,
- * the indicator LED lights up and current is allowed to flow.
- *
- * @image html groverelay.jpg
- * @snippet groverelay.cxx Interesting
- */
-
diff --git a/peripheral/libupm/src/grove/groverotary.h b/peripheral/libupm/src/grove/groverotary.h
deleted file mode 100644
index ee98978..0000000
--- a/peripheral/libupm/src/grove/groverotary.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Place-holder Header for Documentation and future API change
- *
- * 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.
- */
-
-/**
- * @library grove
- * @sensor groverotary
- * @comname Grove Rotary Angle Sensor
- * @altname Rotary Potentiometer
- * @type ainput
- * @man seeed
- * @con analog
- * @kit gsk
- *
- * @brief API for the Grove Rotary Angle Sensor (Knob)
- *
- * Basic UPM module for the Grove rotary angle sensor (knob) on analog. Provides
- * a set of functions to read the absolute pin value, degrees or radians, and another set
- * to do the same relative to the center of the knob's range.
- *
- * @image html groverotary.jpeg
- * @snippet groverotary.cxx Interesting
- */
- \ No newline at end of file
diff --git a/peripheral/libupm/src/grove/groveslide.h b/peripheral/libupm/src/grove/groveslide.h
deleted file mode 100644
index e3cbba1..0000000
--- a/peripheral/libupm/src/grove/groveslide.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Place-holder Header for Documentation and future API change
- *
- * 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.
- */
-
-/**
- * @library grove
- * @sensor groveslide
- * @comname Grove Slide Potentiometer
- * @type ainput
- * @man seeed
- * @con analog
- *
- * @brief API for the Grove Slide Potentiometer
- *
- * Basic UPM module for the Grove slide potentiometer on analog that
- * returns either a raw value or a scaled voltage value.
- *
- * @image html groveslide.jpeg
- * @snippet groveslide.cxx Interesting
- */
- \ No newline at end of file
diff --git a/peripheral/libupm/src/grove/grovetemp.h b/peripheral/libupm/src/grove/grovetemp.h
deleted file mode 100644
index d85ac3e..0000000
--- a/peripheral/libupm/src/grove/grovetemp.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Place-holder Header for Documentation and future API change
- *
- * 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.
- */
-
-/**
- * @library grove
- * @sensor grovetemp
- * @comname Grove Temperature Sensor
- * @type temp
- * @man seeed
- * @con analog
- * @kit gsk
- *
- * @brief API for the Grove Temperature Sensor
- *
- * Basic UPM module for the Grove temperature sensor on analog
- *
- * @image html grovetemp.jpg
- * @snippet grovetemp.cxx Interesting
- */
-
diff --git a/peripheral/libupm/src/grove/javaupm_grove.i b/peripheral/libupm/src/grove/javaupm_grove.i
deleted file mode 100644
index ab9636b..0000000
--- a/peripheral/libupm/src/grove/javaupm_grove.i
+++ /dev/null
@@ -1,23 +0,0 @@
-%module (docstring="Basic Grove sensors") javaupm_grove
-
-%include "../upm.i"
-
-%apply int {mraa::Edge}
-
-%{
- #include "grove.h"
-%}
-
-%include "grove.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_grove");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%}
-
diff --git a/peripheral/libupm/src/grove/jsupm_grove.i b/peripheral/libupm/src/grove/jsupm_grove.i
deleted file mode 100644
index b1f9e7d..0000000
--- a/peripheral/libupm/src/grove/jsupm_grove.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_grove
-%include "../upm.i"
-
-%{
- #include "grove.h"
-%}
-
-%include "grove.h"
diff --git a/peripheral/libupm/src/grove/pyupm_grove.i b/peripheral/libupm/src/grove/pyupm_grove.i
deleted file mode 100644
index b61c155..0000000
--- a/peripheral/libupm/src/grove/pyupm_grove.i
+++ /dev/null
@@ -1,15 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_grove
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-#ifdef DOXYGEN
-%include "grove_doc.i"
-#endif
-
-%include "grove.h"
-%{
- #include "grove.h"
-%}
diff --git a/peripheral/libupm/src/grovecollision/CMakeLists.txt b/peripheral/libupm/src/grovecollision/CMakeLists.txt
deleted file mode 100644
index 0bdce67..0000000
--- a/peripheral/libupm/src/grovecollision/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "grovecollision")
-set (libdescription "upm grovecollision sensor module")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init("-lrt")
diff --git a/peripheral/libupm/src/grovecollision/grovecollision.cxx b/peripheral/libupm/src/grovecollision/grovecollision.cxx
deleted file mode 100644
index fd8aa9b..0000000
--- a/peripheral/libupm/src/grovecollision/grovecollision.cxx
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Author: Zion Orent <sorent@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <string>
-#include <stdexcept>
-
-#include "grovecollision.h"
-
-using namespace upm;
-
-GroveCollision::GroveCollision(int pin)
-{
-
- if ( !(m_gpio = mraa_gpio_init(pin)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_gpio_init() failed, invalid pin?");
- return;
- }
- mraa_gpio_dir(m_gpio, MRAA_GPIO_IN);
-}
-
-GroveCollision::~GroveCollision()
-{
- mraa_gpio_close(m_gpio);
-}
-
-bool GroveCollision::isColliding()
-{
- // Collisions cause 0; no collision is 1
- return (!(bool)mraa_gpio_read(m_gpio));
-}
diff --git a/peripheral/libupm/src/grovecollision/grovecollision.h b/peripheral/libupm/src/grovecollision/grovecollision.h
deleted file mode 100644
index 57b93f6..0000000
--- a/peripheral/libupm/src/grovecollision/grovecollision.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Author: Zion Orent <sorent@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <mraa/gpio.h>
-
-namespace upm {
- /**
- * @brief Grove Collision Sensor library
- * @defgroup grovecollision libupm-grovecollision
- * @ingroup seeed gpio accelerometer
- */
-
- /**
- * @library grovecollision
- * @sensor grovecollision
- * @comname Grove Collision Sensor
- * @type accelerometer
- * @man seeed
- * @con gpio
- *
- * @brief API for the Grove Collision Sensor
- *
- * The Grove Collision Sensor can detect whether any
- * collision movement or vibration happens.
- * It outputs a low pulse signal when vibration is detected.
- *
- * @image html grovecollision.jpg
- * @snippet grovecollision.cxx Interesting
- */
- class GroveCollision {
- public:
- /**
- * Grove collision sensor constructor
- *
- * @param pin Digital pin to use
- */
- GroveCollision(int pin);
- /**
- * GroveCollision destructor
- */
- ~GroveCollision();
- /**
- * @return bool Defines whether something is colliding with sensor
- */
- bool isColliding();
-
- private:
- mraa_gpio_context m_gpio;
- };
-}
diff --git a/peripheral/libupm/src/grovecollision/javaupm_grovecollision.i b/peripheral/libupm/src/grovecollision/javaupm_grovecollision.i
deleted file mode 100644
index 7cb1049..0000000
--- a/peripheral/libupm/src/grovecollision/javaupm_grovecollision.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_grovecollision
-%include "../upm.i"
-
-%{
- #include "grovecollision.h"
-%}
-
-%include "grovecollision.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_grovecollision");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/grovecollision/jsupm_grovecollision.i b/peripheral/libupm/src/grovecollision/jsupm_grovecollision.i
deleted file mode 100644
index 5164b3e..0000000
--- a/peripheral/libupm/src/grovecollision/jsupm_grovecollision.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_grovecollision
-%include "../upm.i"
-
-%{
- #include "grovecollision.h"
-%}
-
-%include "grovecollision.h"
diff --git a/peripheral/libupm/src/grovecollision/pyupm_grovecollision.i b/peripheral/libupm/src/grovecollision/pyupm_grovecollision.i
deleted file mode 100644
index 3d128a0..0000000
--- a/peripheral/libupm/src/grovecollision/pyupm_grovecollision.i
+++ /dev/null
@@ -1,11 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_grovecollision
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "grovecollision.h"
-%{
- #include "grovecollision.h"
-%}
diff --git a/peripheral/libupm/src/groveehr/CMakeLists.txt b/peripheral/libupm/src/groveehr/CMakeLists.txt
deleted file mode 100644
index 32efe5a..0000000
--- a/peripheral/libupm/src/groveehr/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "groveehr")
-set (libdescription "upm grove ear-clip heart rate sensor module")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/groveehr/groveehr.cxx b/peripheral/libupm/src/groveehr/groveehr.cxx
deleted file mode 100644
index d2b0cd9..0000000
--- a/peripheral/libupm/src/groveehr/groveehr.cxx
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <string>
-#include <stdexcept>
-
-#include "groveehr.h"
-
-using namespace upm;
-using namespace std;
-
-GroveEHR::GroveEHR(int pin)
-{
- if ( !(m_gpio = mraa_gpio_init(pin)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_aio_init() failed, invalid pin?");
- return;
- }
-
- mraa_gpio_dir(m_gpio, MRAA_GPIO_IN);
-
- initClock();
- m_beatCounter = 0;
-}
-
-GroveEHR::~GroveEHR()
-{
- mraa_gpio_close(m_gpio);
-}
-
-void GroveEHR::initClock()
-{
- gettimeofday(&m_startTime, NULL);
-}
-
-uint32_t GroveEHR::getMillis()
-{
- struct timeval elapsed, now;
- uint32_t elapse;
-
- // get current time
- gettimeofday(&now, NULL);
-
- // compute the delta since m_startTime
- if( (elapsed.tv_usec = now.tv_usec - m_startTime.tv_usec) < 0 )
- {
- elapsed.tv_usec += 1000000;
- elapsed.tv_sec = now.tv_sec - m_startTime.tv_sec - 1;
- }
- else
- {
- elapsed.tv_sec = now.tv_sec - m_startTime.tv_sec;
- }
-
- elapse = (uint32_t)((elapsed.tv_sec * 1000) + (elapsed.tv_usec / 1000));
-
- // never return 0
- if (elapse == 0)
- elapse = 1;
-
- return elapse;
-}
-
-void GroveEHR::clearBeatCounter()
-{
- m_beatCounter = 0;
-}
-
-void GroveEHR::startBeatCounter()
-{
- // install our interrupt handler
- mraa_gpio_isr(m_gpio, MRAA_GPIO_EDGE_RISING,
- &beatISR, this);
-}
-
-void GroveEHR::stopBeatCounter()
-{
- // remove the interrupt handler
- mraa_gpio_isr_exit(m_gpio);
-}
-
-uint32_t GroveEHR::beatCounter()
-{
- return m_beatCounter;
-}
-
-void GroveEHR::beatISR(void *ctx)
-{
- upm::GroveEHR *This = (upm::GroveEHR *)ctx;
- This->m_beatCounter++;
-}
-
-int GroveEHR::heartRate()
-{
- uint32_t millis = getMillis();
- uint32_t beats = beatCounter();
-
- float heartRate = 0;
- // wait at least 5 seconds before attempting to compute the
- // heart rate
- if (millis > 5000)
- {
- heartRate = (float(beats) / (float(millis) / 1000.0)) * 60.0;
- }
-
- return int(heartRate);
-}
diff --git a/peripheral/libupm/src/groveehr/groveehr.h b/peripheral/libupm/src/groveehr/groveehr.h
deleted file mode 100644
index 371fe83..0000000
--- a/peripheral/libupm/src/groveehr/groveehr.h
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include <stdint.h>
-#include <sys/time.h>
-#include <mraa/gpio.h>
-
-namespace upm {
- /**
- * @brief Grove Ear-clip Heart Rate Sensor library
- * @defgroup groveehr libupm-groveehr
- * @ingroup seeed gpio medical
- */
-
- /**
- * @library groveehr
- * @sensor groveehr
- * @comname Grove Ear-clip Heart Rate Sensor
- * @type medical
- * @man seeed
- * @con gpio
- *
- * @brief API for the Grove Ear-clip Heart Rate Sensor
- *
- * UPM module for the Grove ear-clip heart rate sensor. It is used to measure your
- * heart rate.
- *
- * @image html groveehr.jpg
- * @snippet groveehr.cxx Interesting
- */
- class GroveEHR {
- public:
- /**
- * GroveEHR constructor
- *
- * @param pin Digital pin to use
- */
- GroveEHR(int pin);
- /**
- * GroveEHR destructor
- */
- ~GroveEHR();
- /**
- * Returns the time of milliseconds elapsed since initClock()
- * was last called.
- *
- * @return Elapsed milliseconds
- */
- uint32_t getMillis();
-
- /**
- * Resets the clock
- *
- */
- void initClock();
-
- /**
- * Resets the beat counter to 0. The beat counter should be
- * stopped via stopBeatCounter() prior to calling this function.
- *
- */
- void clearBeatCounter();
-
- /**
- * Starts the beat counter
- *
- */
- void startBeatCounter();
-
- /**
- * Stops the beat counter
- *
- */
- void stopBeatCounter();
-
- /**
- * Gets the beat Counter
- *
- * @return Beat counter
- */
- uint32_t beatCounter();
-
- /**
- * Computes the heart rate
- *
- * @return Computed heart rate
- */
- int heartRate();
-
- private:
- /**
- * Beat interrupt service routine (ISR)
- *
- */
- static void beatISR(void *ctx);
-
- volatile uint32_t m_beatCounter;
- struct timeval m_startTime;
- mraa_gpio_context m_gpio;
- };
-}
-
-
diff --git a/peripheral/libupm/src/groveehr/javaupm_groveehr.i b/peripheral/libupm/src/groveehr/javaupm_groveehr.i
deleted file mode 100644
index 2b5d110..0000000
--- a/peripheral/libupm/src/groveehr/javaupm_groveehr.i
+++ /dev/null
@@ -1,21 +0,0 @@
-%module javaupm_groveehr
-%include "../upm.i"
-
-%ignore beatISR;
-
-%{
- #include "groveehr.h"
-%}
-
-%include "groveehr.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_groveehr");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/groveehr/jsupm_groveehr.i b/peripheral/libupm/src/groveehr/jsupm_groveehr.i
deleted file mode 100644
index 9c324ba..0000000
--- a/peripheral/libupm/src/groveehr/jsupm_groveehr.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_groveehr
-%include "../upm.i"
-
-%{
- #include "groveehr.h"
-%}
-
-%include "groveehr.h"
diff --git a/peripheral/libupm/src/groveehr/pyupm_groveehr.i b/peripheral/libupm/src/groveehr/pyupm_groveehr.i
deleted file mode 100644
index 0568df4..0000000
--- a/peripheral/libupm/src/groveehr/pyupm_groveehr.i
+++ /dev/null
@@ -1,11 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_groveehr
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "groveehr.h"
-%{
- #include "groveehr.h"
-%}
diff --git a/peripheral/libupm/src/groveeldriver/CMakeLists.txt b/peripheral/libupm/src/groveeldriver/CMakeLists.txt
deleted file mode 100644
index 9ce5b02..0000000
--- a/peripheral/libupm/src/groveeldriver/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "groveeldriver")
-set (libdescription "upm groveeldriver sensor module")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init("-lrt")
diff --git a/peripheral/libupm/src/groveeldriver/groveeldriver.cxx b/peripheral/libupm/src/groveeldriver/groveeldriver.cxx
deleted file mode 100644
index c8755d6..0000000
--- a/peripheral/libupm/src/groveeldriver/groveeldriver.cxx
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Author: Zion Orent <sorent@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <string>
-#include <stdexcept>
-
-#include "groveeldriver.h"
-
-using namespace upm;
-
-GroveElDriver::GroveElDriver(int pin)
-{
- if ( !(m_gpio = mraa_gpio_init(pin)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_gpio_init() failed, invalid pin?");
- return;
- }
- mraa_gpio_dir(m_gpio, MRAA_GPIO_OUT);
-}
-
-GroveElDriver::~GroveElDriver()
-{
- mraa_gpio_close(m_gpio);
-}
-
-void GroveElDriver::on()
-{
- mraa_result_t error = MRAA_SUCCESS;
- error = mraa_gpio_write (m_gpio, HIGH);
- if (error != MRAA_SUCCESS)
- mraa_result_print(error);
-}
-
-void GroveElDriver::off()
-{
- mraa_result_t error = MRAA_SUCCESS;
- error = mraa_gpio_write (m_gpio, LOW);
- if (error != MRAA_SUCCESS)
- mraa_result_print(error);
-}
diff --git a/peripheral/libupm/src/groveeldriver/groveeldriver.h b/peripheral/libupm/src/groveeldriver/groveeldriver.h
deleted file mode 100644
index 7ed7963..0000000
--- a/peripheral/libupm/src/groveeldriver/groveeldriver.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Author: Zion Orent <sorent@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <mraa/gpio.h>
-
-#define HIGH 1
-#define LOW 0
-
-namespace upm {
- /**
- * @brief Grove EL Driver Module library
- * @defgroup groveeldriver libupm-groveeldriver
- * @ingroup seeed gpio electric
- */
-
- /**
- * @library groveeldriver
- * @sensor groveeldriver
- * @comname Grove EL Driver
- * @type electric
- * @man seeed
- * @con gpio
- *
- * @brief API for the Grove EL Driver Module
- *
- * The Grove EL Driver allows you to easily light up an
- * EL wire with just one single Grove cable.
- *
- * @image html groveeldriver.jpg
- * @snippet groveeldriver.cxx Interesting
- */
- class GroveElDriver {
- public:
- /**
- * Grove EL Driver constructor
- *
- * @param pin Digital pin to use
- */
- GroveElDriver(int pin);
- /**
- * Grove EL Driver destructor
- */
- ~GroveElDriver();
- /**
- * Turns the EL wire on
- */
- void on();
- /**
- * Turns the EL wire off
- */
- void off();
-
- private:
- mraa_gpio_context m_gpio;
- };
-}
diff --git a/peripheral/libupm/src/groveeldriver/javaupm_groveeldriver.i b/peripheral/libupm/src/groveeldriver/javaupm_groveeldriver.i
deleted file mode 100644
index 061329c..0000000
--- a/peripheral/libupm/src/groveeldriver/javaupm_groveeldriver.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_groveeldriver
-%include "../upm.i"
-
-%{
- #include "groveeldriver.h"
-%}
-
-%include "groveeldriver.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_groveeldriver");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/groveeldriver/jsupm_groveeldriver.i b/peripheral/libupm/src/groveeldriver/jsupm_groveeldriver.i
deleted file mode 100644
index 28964e8..0000000
--- a/peripheral/libupm/src/groveeldriver/jsupm_groveeldriver.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_groveeldriver
-%include "../upm.i"
-
-%{
- #include "groveeldriver.h"
-%}
-
-%include "groveeldriver.h"
diff --git a/peripheral/libupm/src/groveeldriver/pyupm_groveeldriver.i b/peripheral/libupm/src/groveeldriver/pyupm_groveeldriver.i
deleted file mode 100644
index 057367b..0000000
--- a/peripheral/libupm/src/groveeldriver/pyupm_groveeldriver.i
+++ /dev/null
@@ -1,11 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_groveeldriver
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "groveeldriver.h"
-%{
- #include "groveeldriver.h"
-%}
diff --git a/peripheral/libupm/src/groveelectromagnet/CMakeLists.txt b/peripheral/libupm/src/groveelectromagnet/CMakeLists.txt
deleted file mode 100644
index 69b1d88..0000000
--- a/peripheral/libupm/src/groveelectromagnet/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "groveelectromagnet")
-set (libdescription "upm groveelectromagnet sensor module")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init("-lrt")
diff --git a/peripheral/libupm/src/groveelectromagnet/groveelectromagnet.cxx b/peripheral/libupm/src/groveelectromagnet/groveelectromagnet.cxx
deleted file mode 100644
index d3e118d..0000000
--- a/peripheral/libupm/src/groveelectromagnet/groveelectromagnet.cxx
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Author: Zion Orent <sorent@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <string>
-#include <stdexcept>
-
-#include "groveelectromagnet.h"
-
-using namespace upm;
-
-GroveElectromagnet::GroveElectromagnet(int pin)
-{
- if ( !(m_gpio = mraa_gpio_init(pin)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_gpio_init() failed, invalid pin?");
- return;
- }
- mraa_gpio_dir(m_gpio, MRAA_GPIO_OUT);
-}
-
-GroveElectromagnet::~GroveElectromagnet()
-{
- mraa_gpio_close(m_gpio);
-}
-
-void GroveElectromagnet::on()
-{
- mraa_result_t error = MRAA_SUCCESS;
- error = mraa_gpio_write (m_gpio, HIGH);
- if (error != MRAA_SUCCESS)
- mraa_result_print(error);
-}
-
-void GroveElectromagnet::off()
-{
- mraa_result_t error = MRAA_SUCCESS;
- error = mraa_gpio_write (m_gpio, LOW);
- if (error != MRAA_SUCCESS)
- mraa_result_print(error);
-}
diff --git a/peripheral/libupm/src/groveelectromagnet/groveelectromagnet.h b/peripheral/libupm/src/groveelectromagnet/groveelectromagnet.h
deleted file mode 100644
index c39ae4c..0000000
--- a/peripheral/libupm/src/groveelectromagnet/groveelectromagnet.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Author: Zion Orent <sorent@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <mraa/gpio.h>
-
-#define HIGH 1
-#define LOW 0
-
-namespace upm {
- /**
- * @brief Grove Electromagnet library
- * @defgroup groveelectromagnet libupm-groveelectromagnet
- * @ingroup seeed gpio electric
- */
-
- /**
- * @library groveelectromagnet
- * @sensor groveelectromagnet
- * @comname Grove Electromagnet
- * @type electric
- * @man seeed
- * @con gpio
- *
- * @brief API for the Grove Electromagnet
- *
- * The Grove Electromagnet can hold up to 1 kg (approximately 2.2 lbs)
- *
- * @image html groveelectromagnet.jpg
- * @snippet groveelectromagnet.cxx Interesting
- */
- class GroveElectromagnet {
- public:
- /**
- * Grove Electromagnet constructor
- *
- * @param pin Digital pin to use
- */
- GroveElectromagnet(int pin);
- /**
- * Grove Electromagnet destructor
- */
- ~GroveElectromagnet();
- /**
- * Turns the magnet on
- */
- void on();
- /**
- * Turns the magnet off
- */
- void off();
-
- private:
- mraa_gpio_context m_gpio;
- };
-}
diff --git a/peripheral/libupm/src/groveelectromagnet/javaupm_groveelectromagnet.i b/peripheral/libupm/src/groveelectromagnet/javaupm_groveelectromagnet.i
deleted file mode 100644
index 5def283..0000000
--- a/peripheral/libupm/src/groveelectromagnet/javaupm_groveelectromagnet.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_groveelectromagnet
-%include "../upm.i"
-
-%{
- #include "groveelectromagnet.h"
-%}
-
-%include "groveelectromagnet.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_groveelectromagnet");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/groveelectromagnet/jsupm_groveelectromagnet.i b/peripheral/libupm/src/groveelectromagnet/jsupm_groveelectromagnet.i
deleted file mode 100644
index 323a8fb..0000000
--- a/peripheral/libupm/src/groveelectromagnet/jsupm_groveelectromagnet.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_groveelectromagnet
-%include "../upm.i"
-
-%{
- #include "groveelectromagnet.h"
-%}
-
-%include "groveelectromagnet.h"
diff --git a/peripheral/libupm/src/groveelectromagnet/pyupm_groveelectromagnet.i b/peripheral/libupm/src/groveelectromagnet/pyupm_groveelectromagnet.i
deleted file mode 100644
index 8102266..0000000
--- a/peripheral/libupm/src/groveelectromagnet/pyupm_groveelectromagnet.i
+++ /dev/null
@@ -1,11 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_groveelectromagnet
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "groveelectromagnet.h"
-%{
- #include "groveelectromagnet.h"
-%}
diff --git a/peripheral/libupm/src/groveemg/CMakeLists.txt b/peripheral/libupm/src/groveemg/CMakeLists.txt
deleted file mode 100644
index 7e2388d..0000000
--- a/peripheral/libupm/src/groveemg/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "groveemg")
-set (libdescription "upm groveemg muscle signal reader sensor module")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/groveemg/groveemg.cxx b/peripheral/libupm/src/groveemg/groveemg.cxx
deleted file mode 100644
index 17f3d25..0000000
--- a/peripheral/libupm/src/groveemg/groveemg.cxx
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Author: Zion Orent <zorent@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <string>
-#include <stdexcept>
-
-#include "groveemg.h"
-
-using namespace upm;
-using namespace std;
-
-GroveEMG::GroveEMG(int pin)
-{
- if ( !(m_aio = mraa_aio_init(pin)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_aio_init() failed, invalid pin?");
- return;
- }
-}
-
-GroveEMG::~GroveEMG()
-{
- mraa_aio_close(m_aio);
-}
-
-void GroveEMG::calibrate()
-{
- int val, sum = 0;
-
- for (int i=0; i<1100; i++)
- {
- val = mraa_aio_read(m_aio);
- sum += val;
- usleep(1000);
- }
- sum /= 1100;
- cout << "Static analog data = " << sum << endl;
-}
-
-int GroveEMG::value()
-{
- int val = mraa_aio_read(m_aio);
- return val;
-}
diff --git a/peripheral/libupm/src/groveemg/groveemg.h b/peripheral/libupm/src/groveemg/groveemg.h
deleted file mode 100644
index eef5fa3..0000000
--- a/peripheral/libupm/src/groveemg/groveemg.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Author: Zion Orent <zorent@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include <mraa/aio.h>
-
-namespace upm {
- /**
- * @brief Grove EMG Muscle Signal Reader library
- * @defgroup groveemg libupm-groveemg
- * @ingroup seeed analog electric
- */
-
- /**
- * @library groveemg
- * @sensor groveemg
- * @comname Grove EMG Sensor
- * @type electric
- * @man seeed
- * @con analog
- *
- * @brief API for the Grove EMG Muscle Signal Reader
- *
- * Grove EMG muscle signal reader gathers small muscle signals,
- * then processes them, and returns the result
- *
- * @image html groveemg.jpg
- * @snippet groveemg.cxx Interesting
- */
- class GroveEMG {
- public:
- /**
- * Grove EMG reader constructor
- *
- * @param pin Analog pin to use
- */
- GroveEMG(int pin);
- /**
- * GroveEMG destructor
- */
- ~GroveEMG();
-
- /**
- * Calibrates the Grove EMG reader
- */
- void calibrate();
-
- /**
- * Measures muscle signals from the reader
- *
- * @return Muscle output as analog voltage
- */
- int value();
-
- private:
- mraa_aio_context m_aio;
- };
-}
-
-
diff --git a/peripheral/libupm/src/groveemg/javaupm_groveemg.i b/peripheral/libupm/src/groveemg/javaupm_groveemg.i
deleted file mode 100644
index c829829..0000000
--- a/peripheral/libupm/src/groveemg/javaupm_groveemg.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_groveemg
-%include "../upm.i"
-
-%{
- #include "groveemg.h"
-%}
-
-%include "groveemg.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_groveemg");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/groveemg/jsupm_groveemg.i b/peripheral/libupm/src/groveemg/jsupm_groveemg.i
deleted file mode 100644
index 7cac045..0000000
--- a/peripheral/libupm/src/groveemg/jsupm_groveemg.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_groveemg
-%include "../upm.i"
-
-%{
- #include "groveemg.h"
-%}
-
-%include "groveemg.h"
diff --git a/peripheral/libupm/src/groveemg/pyupm_groveemg.i b/peripheral/libupm/src/groveemg/pyupm_groveemg.i
deleted file mode 100644
index 8bccef2..0000000
--- a/peripheral/libupm/src/groveemg/pyupm_groveemg.i
+++ /dev/null
@@ -1,11 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_groveemg
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "groveemg.h"
-%{
- #include "groveemg.h"
-%}
diff --git a/peripheral/libupm/src/grovegprs/CMakeLists.txt b/peripheral/libupm/src/grovegprs/CMakeLists.txt
deleted file mode 100644
index 524cb36..0000000
--- a/peripheral/libupm/src/grovegprs/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "grovegprs")
-set (libdescription "upm grove GPRS module")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/grovegprs/grovegprs.cxx b/peripheral/libupm/src/grovegprs/grovegprs.cxx
deleted file mode 100644
index 4f83bc8..0000000
--- a/peripheral/libupm/src/grovegprs/grovegprs.cxx
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-
-#include "grovegprs.h"
-
-using namespace upm;
-using namespace std;
-
-static const int defaultDelay = 100; // max wait time for read
-
-GroveGPRS::GroveGPRS(int uart) :
- m_uart(uart)
-{
-}
-
-GroveGPRS::~GroveGPRS()
-{
-}
-
-bool GroveGPRS::dataAvailable(unsigned int millis)
-{
- return m_uart.dataAvailable(millis);
-}
-
-int GroveGPRS::readData(char *buffer, unsigned int len)
-{
- return m_uart.read(buffer, len);
-}
-
-std::string GroveGPRS::readDataStr(int len)
-{
- return m_uart.readStr(len);
-}
-
-int GroveGPRS::writeData(char *buffer, unsigned int len)
-{
- m_uart.flush();
- return m_uart.write(buffer, len);
-}
-
-int GroveGPRS::writeDataStr(std::string data)
-{
- m_uart.flush();
- return m_uart.writeStr(data);
-}
-
-mraa::Result GroveGPRS::setBaudRate(int baud)
-{
- return m_uart.setBaudRate(baud);
-}
-
diff --git a/peripheral/libupm/src/grovegprs/grovegprs.h b/peripheral/libupm/src/grovegprs/grovegprs.h
deleted file mode 100644
index 1aa774f..0000000
--- a/peripheral/libupm/src/grovegprs/grovegprs.h
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Thanks to Adafruit for supplying a google translated version of the
- * Chinese datasheet and some clues in their code.
- *
- * 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 <string>
-#include <iostream>
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-
-#include <mraa/common.hpp>
-#include <mraa/uart.hpp>
-
-#define GROVEGPRS_DEFAULT_UART 0
-
-namespace upm {
- /**
- * @brief Grove GPRS Module library
- * @defgroup grovegprs libupm-grovegprs
- * @ingroup seeed uart wifi
- */
-
- /**
- * @library grovegprs
- * @sensor grovegprs
- * @comname Grove GPRS Module
- * @type wifi
- * @man seeed
- * @con uart
- * @web http://www.seeedstudio.com/wiki/GPRS_Shield_V2.0
- *
- * @brief API for the Grove GPRS Module
- *
- * The driver was tested with the Grove GPRS Module, V2. It's a
- * GSM GPRS module based on the SIM900. This module uses a
- * standard 'AT' command set. See the datasheet for a full list
- * of available commands and their possible responses:
- *
- * http://www.seeedstudio.com/wiki/images/7/72/AT_Commands_v1.11.pdf
- *
- * It is connected via a UART at 19200 baud.
- *
- * @image html grovegprs.jpg
- * @snippet grovegprs.cxx Interesting
- */
-
- class GroveGPRS {
- public:
-
- /**
- * GroveGPRS object constructor
- *
- * @param uart Default UART to use (0 or 1). Default is 0.
- */
- GroveGPRS(int uart=GROVEGPRS_DEFAULT_UART);
-
- /**
- * GroveGPRS object destructor
- */
- ~GroveGPRS();
-
- /**
- * Checks to see if there is data available for reading
- *
- * @param millis Number of milliseconds to wait; 0 means no waiting
- * @return true if there is data available for reading
- */
- bool dataAvailable(unsigned int millis);
-
- /**
- * Reads any available data into a user-supplied buffer. Note: the
- * call blocks until data is available for reading. Use
- * dataAvailable() to determine whether there is data available
- * beforehand, to avoid blocking.
- *
- * @param buffer Buffer to hold the data read
- * @param len Length of the buffer
- * @return Number of bytes read
- */
- int readData(char *buffer, unsigned int len);
-
- /**
- * Reads any available data and returns it in a std::string. Note:
- * the call blocks until data is available for reading. Use
- * dataAvailable() to determine whether there is data available
- * beforehand, to avoid blocking.
- *
- * @param len Maximum length of the data to be returned
- * @return Number of bytes read
- */
- std::string readDataStr(int len);
-
- /**
- * Writes the data in the buffer to the device. If you are
- * writing a command, be sure to terminate it with a carriage
- * return (\r)
- *
- * @param buffer Buffer to hold the data to write
- * @param len Length of the buffer
- * @return Number of bytes written
- */
- int writeData(char *buffer, unsigned len);
-
- /**
- * Writes the std:string data to the device. If you are writing a
- * command, be sure to terminate it with a carriage return (\r)
- *
- * @param data Buffer to write to the device
- * @return Number of bytes written
- */
- int writeDataStr(std::string data);
-
- /**
- * Sets the baud rate for the device. The default is 19200.
- *
- * @param baud Desired baud rate.
- * @return true if successful
- */
- mraa::Result setBaudRate(int baud=19200);
-
-
- protected:
- mraa::Uart m_uart;
-
- private:
- };
-}
-
-
diff --git a/peripheral/libupm/src/grovegprs/javaupm_grovegprs.i b/peripheral/libupm/src/grovegprs/javaupm_grovegprs.i
deleted file mode 100644
index e048626..0000000
--- a/peripheral/libupm/src/grovegprs/javaupm_grovegprs.i
+++ /dev/null
@@ -1,22 +0,0 @@
-%module javaupm_grovegprs
-%include "../upm.i"
-%include "carrays.i"
-%include "std_string.i"
-
-%{
- #include "grovegprs.h"
-%}
-
-%include "grovegprs.h"
-%array_class(char, charArray);
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_grovegprs");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/grovegprs/jsupm_grovegprs.i b/peripheral/libupm/src/grovegprs/jsupm_grovegprs.i
deleted file mode 100644
index a4f0556..0000000
--- a/peripheral/libupm/src/grovegprs/jsupm_grovegprs.i
+++ /dev/null
@@ -1,11 +0,0 @@
-%module jsupm_grovegprs
-%include "../upm.i"
-%include "carrays.i"
-%include "std_string.i"
-
-%{
- #include "grovegprs.h"
-%}
-
-%include "grovegprs.h"
-%array_class(char, charArray);
diff --git a/peripheral/libupm/src/grovegprs/pyupm_grovegprs.i b/peripheral/libupm/src/grovegprs/pyupm_grovegprs.i
deleted file mode 100644
index 46567e9..0000000
--- a/peripheral/libupm/src/grovegprs/pyupm_grovegprs.i
+++ /dev/null
@@ -1,14 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_grovegprs
-%include "../upm.i"
-%include "carrays.i"
-%include "std_string.i"
-
-%feature("autodoc", "3");
-
-%{
- #include "grovegprs.h"
-%}
-%include "grovegprs.h"
-%array_class(char, charArray);
diff --git a/peripheral/libupm/src/grovegsr/CMakeLists.txt b/peripheral/libupm/src/grovegsr/CMakeLists.txt
deleted file mode 100644
index 051ad08..0000000
--- a/peripheral/libupm/src/grovegsr/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "grovegsr")
-set (libdescription "upm grovegsr galvanic skin response sensor module")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/grovegsr/grovegsr.cxx b/peripheral/libupm/src/grovegsr/grovegsr.cxx
deleted file mode 100644
index 0d7669d..0000000
--- a/peripheral/libupm/src/grovegsr/grovegsr.cxx
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Author: Zion Orent <zorent@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <string>
-#include <stdexcept>
-
-#include "grovegsr.h"
-
-using namespace upm;
-using namespace std;
-
-GroveGSR::GroveGSR(int pin)
-{
- if ( !(m_aio = mraa_aio_init(pin)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_aio_init() failed, invalid pin?");
- return;
- }
-}
-
-GroveGSR::~GroveGSR()
-{
- mraa_aio_close(m_aio);
-}
-
-void GroveGSR::calibrate()
-{
- sleep(1);
- int val, threshold, sum = 0;
-
- for(int i=0; i<500; i++)
- {
- val = mraa_aio_read(m_aio);
- sum += val;
- usleep(5000);
- }
- threshold = sum / 500;
- cout << "Threshold = " << threshold << endl;
-}
-
-int GroveGSR::value()
-{
- int val = mraa_aio_read(m_aio);
- return val;
-}
diff --git a/peripheral/libupm/src/grovegsr/grovegsr.h b/peripheral/libupm/src/grovegsr/grovegsr.h
deleted file mode 100644
index 32666ab..0000000
--- a/peripheral/libupm/src/grovegsr/grovegsr.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Author: Zion Orent <zorent@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include <mraa/aio.h>
-
-namespace upm {
- /**
- * @brief Grove GSR Galvanic Skin Response Sensor library
- * @defgroup grovegsr libupm-grovegsr
- * @ingroup seeed analog electric
- */
-
- /**
- * @library grovegsr
- * @sensor grovegsr
- * @comname Grove GSR Sensor
- * @type electric
- * @man seeed
- * @con analog
- *
- * @brief API for the Grove GSR Galvanic Skin Response Sensor
- *
- * Measures the electrical conductance of skin
- * to measure strong emotional reactions.
- * In other words, it measures sweat on your fingers
- * as an indicator of strong emotional reactions.
- *
- * @image html grovegsr.jpg
- * @snippet grovegsr.cxx Interesting
- */
- class GroveGSR {
- public:
- /**
- * Grove GSR sensor constructor
- *
- * @param pin Analog pin to use
- */
- GroveGSR(int pin);
- /**
- * GroveGSR destructor
- */
- ~GroveGSR();
-
- /**
- * Calibrates the Grove GSR sensor
- */
- void calibrate();
-
- /**
- * Gets the electrical conductance of the skin from the sensor
- *
- * @return Electrical conductance of the skin
- */
- int value();
-
- private:
- mraa_aio_context m_aio;
- };
-}
-
-
diff --git a/peripheral/libupm/src/grovegsr/javaupm_grovegsr.i b/peripheral/libupm/src/grovegsr/javaupm_grovegsr.i
deleted file mode 100644
index 658146d..0000000
--- a/peripheral/libupm/src/grovegsr/javaupm_grovegsr.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_grovegsr
-%include "../upm.i"
-
-%{
- #include "grovegsr.h"
-%}
-
-%include "grovegsr.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_grovegsr");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/grovegsr/jsupm_grovegsr.i b/peripheral/libupm/src/grovegsr/jsupm_grovegsr.i
deleted file mode 100644
index d1ec016..0000000
--- a/peripheral/libupm/src/grovegsr/jsupm_grovegsr.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_grovegsr
-%include "../upm.i"
-
-%{
- #include "grovegsr.h"
-%}
-
-%include "grovegsr.h"
diff --git a/peripheral/libupm/src/grovegsr/pyupm_grovegsr.i b/peripheral/libupm/src/grovegsr/pyupm_grovegsr.i
deleted file mode 100644
index 6e1a7ce..0000000
--- a/peripheral/libupm/src/grovegsr/pyupm_grovegsr.i
+++ /dev/null
@@ -1,11 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_grovegsr
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "grovegsr.h"
-%{
- #include "grovegsr.h"
-%}
diff --git a/peripheral/libupm/src/grovelinefinder/CMakeLists.txt b/peripheral/libupm/src/grovelinefinder/CMakeLists.txt
deleted file mode 100644
index 46d22e9..0000000
--- a/peripheral/libupm/src/grovelinefinder/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "grovelinefinder")
-set (libdescription "upm grove line finder sensor module")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/grovelinefinder/grovelinefinder.cxx b/peripheral/libupm/src/grovelinefinder/grovelinefinder.cxx
deleted file mode 100644
index 297f526..0000000
--- a/peripheral/libupm/src/grovelinefinder/grovelinefinder.cxx
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <string>
-#include <stdexcept>
-
-#include "grovelinefinder.h"
-
-using namespace upm;
-using namespace std;
-
-GroveLineFinder::GroveLineFinder(int pin)
-{
- if ( !(m_gpio = mraa_gpio_init(pin)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_gpio_init() failed, invalid pin?");
- return;
- }
-
- mraa_gpio_dir(m_gpio, MRAA_GPIO_IN);
-}
-
-GroveLineFinder::~GroveLineFinder()
-{
- mraa_gpio_close(m_gpio);
-}
-
-bool GroveLineFinder::whiteDetected()
-{
- return (!mraa_gpio_read(m_gpio) ? true : false);
-}
-
-bool GroveLineFinder::blackDetected()
-{
- return (mraa_gpio_read(m_gpio) ? true : false);
-}
diff --git a/peripheral/libupm/src/grovelinefinder/grovelinefinder.h b/peripheral/libupm/src/grovelinefinder/grovelinefinder.h
deleted file mode 100644
index 5e662a2..0000000
--- a/peripheral/libupm/src/grovelinefinder/grovelinefinder.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include <mraa/gpio.h>
-
-namespace upm {
- /**
- * @brief Grove Line Finder Sensor library
- * @defgroup grovelinefinder libupm-grovelinefinder
- * @ingroup seeed gpio color robok
- */
-
- /**
- * @library grovelinefinder
- * @sensor grovelinefinder
- * @comname Grove Line Finder
- * @type color
- * @man seeed
- * @con gpio
- * @kit robok
- *
- * @brief API for the Grove Line Finder Sensor
- *
- * UPM module for the Grove Line Finder sensor. It outputs a
- * digital signal indicating whether it is detecting black on a
- * white background, or white on a black background.
- *
- * @image html grovelinefinder.jpg
- * @snippet grovelinefinder.cxx Interesting
- */
- class GroveLineFinder {
- public:
- /**
- * Grove Line Finder digital sensor constructor
- *
- * @param pin Digital pin to use
- */
- GroveLineFinder(int pin);
- /**
- * GroveLineFinder destructor
- */
- ~GroveLineFinder();
- /**
- * Determines whether white has been detected
- *
- * @return True if white is detected
- */
- bool whiteDetected();
- /**
- * Determines whether black has been detected
- *
- * @return True if black is detected
- */
- bool blackDetected();
-
- private:
- mraa_gpio_context m_gpio;
- };
-}
-
-
diff --git a/peripheral/libupm/src/grovelinefinder/javaupm_grovelinefinder.i b/peripheral/libupm/src/grovelinefinder/javaupm_grovelinefinder.i
deleted file mode 100644
index bee2ffd..0000000
--- a/peripheral/libupm/src/grovelinefinder/javaupm_grovelinefinder.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_grovelinefinder
-%include "../upm.i"
-
-%{
- #include "grovelinefinder.h"
-%}
-
-%include "grovelinefinder.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_grovelinefinder");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/grovelinefinder/jsupm_grovelinefinder.i b/peripheral/libupm/src/grovelinefinder/jsupm_grovelinefinder.i
deleted file mode 100644
index e379f37..0000000
--- a/peripheral/libupm/src/grovelinefinder/jsupm_grovelinefinder.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_grovelinefinder
-%include "../upm.i"
-
-%{
- #include "grovelinefinder.h"
-%}
-
-%include "grovelinefinder.h"
diff --git a/peripheral/libupm/src/grovelinefinder/pyupm_grovelinefinder.i b/peripheral/libupm/src/grovelinefinder/pyupm_grovelinefinder.i
deleted file mode 100644
index 3e58d21..0000000
--- a/peripheral/libupm/src/grovelinefinder/pyupm_grovelinefinder.i
+++ /dev/null
@@ -1,11 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_grovelinefinder
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "grovelinefinder.h"
-%{
- #include "grovelinefinder.h"
-%}
diff --git a/peripheral/libupm/src/groveloudness/groveloudness.cxx b/peripheral/libupm/src/groveloudness/groveloudness.cxx
deleted file mode 100644
index 6a6a284..0000000
--- a/peripheral/libupm/src/groveloudness/groveloudness.cxx
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <string>
-#include <stdexcept>
-
-#include "groveloudness.h"
-
-using namespace upm;
-
-GroveLoudness::GroveLoudness(int pin)
-{
- if ( !(m_aio = mraa_aio_init(pin)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_aio_init() failed, invalid pin?");
- return;
- }
-}
-
-GroveLoudness::~GroveLoudness()
-{
- mraa_aio_close(m_aio);
-}
-
-int GroveLoudness::value()
-{
- return mraa_aio_read(m_aio);
-}
diff --git a/peripheral/libupm/src/grovemd/CMakeLists.txt b/peripheral/libupm/src/grovemd/CMakeLists.txt
deleted file mode 100644
index 6f30715..0000000
--- a/peripheral/libupm/src/grovemd/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "grovemd")
-set (libdescription "upm grove i2c motor driver module")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/grovemd/grovemd.cxx b/peripheral/libupm/src/grovemd/grovemd.cxx
deleted file mode 100644
index 2e588a4..0000000
--- a/peripheral/libupm/src/grovemd/grovemd.cxx
+++ /dev/null
@@ -1,244 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <string>
-#include <stdexcept>
-
-#include "grovemd.h"
-
-using namespace upm;
-using namespace std;
-
-
-GroveMD::GroveMD(int bus, uint8_t address) :
- m_i2c(bus)
-{
- m_addr = address;
-
- // this board *requires* 100Khz i2c bus only
- mraa::Result rv;
- if ( (rv = m_i2c.frequency(mraa::I2C_STD)) != mraa::SUCCESS )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": I2c.frequency(I2C_STD) failed");
- return;
- }
-
- if (m_i2c.address(m_addr))
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": I2c.address() failed");
- return;
- }
-
- initClock();
- // default to mode1 stepper operation, 200 steps per rev.
- configStepper(200, STEP_MODE1);
-}
-
-GroveMD::~GroveMD()
-{
- setMotorSpeeds(0, 0);
- writePacket(SET_DIRECTION, 0, GROVEMD_NOOP);
-}
-
-bool GroveMD::writePacket(REG_T reg, uint8_t data1, uint8_t data2)
-{
- uint8_t buf[3];
-
- buf[0] = reg;
- buf[1] = data1;
- buf[2] = data2;
-
- if ( m_i2c.write(buf, 3) != mraa::SUCCESS )
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": I2c.write() failed");
- return false;
- }
-
- // This sleep appears to be required. Without it, writes randomly
- // fail (no ACK received). This happens most often on the SET_SPEED
- // packet. I am guessing that there is a timing problem and/or bug
- // in the motor driver's firmware.
-
- usleep(100);
-
- return true;
-}
-
-bool GroveMD::setMotorSpeeds(uint8_t speedA, uint8_t speedB)
-{
- return writePacket(SET_SPEED, speedA, speedB);
-}
-
-bool GroveMD::setPWMFrequencyPrescale(uint8_t freq)
-{
- return writePacket(SET_PWM_FREQ, freq, GROVEMD_NOOP);
-}
-
-bool GroveMD::setMotorDirections(DC_DIRECTION_T dirA, DC_DIRECTION_T dirB)
-{
- uint8_t dir = ((dirB & 0x03) << 2) | (dirA & 0x03);
- return writePacket(SET_DIRECTION, dir, GROVEMD_NOOP);
-}
-
-bool GroveMD::enableStepper(STEP_DIRECTION_T dir, uint8_t speed)
-{
- // If mode 2, send the command and return immediately
- if (m_stepMode == STEP_MODE2)
- return writePacket(STEPPER_ENABLE, dir, speed);
-
- // otherwise, mode 1, setup the basics and start stepping.
-
- m_stepDelay = 60 * 1000 / m_stepsPerRev / speed;
- m_stepDirection = ((dir == STEP_DIR_CW) ? 1 : -1);
-
- // seeed says speed should always be 255,255 for stepper operation
- setMotorSpeeds(255, 255);
-
- while (m_totalSteps > 0)
- {
- if (getMillis() >= m_stepDelay)
- {
- // reset the clock
- initClock();
-
- m_currentStep += m_stepDirection;
-
- if (m_stepDirection == 1)
- {
- if (m_currentStep >= m_stepsPerRev)
- m_currentStep = 0;
- }
- else
- {
- if (m_currentStep <= 0)
- m_currentStep = m_stepsPerRev;
- }
-
- m_totalSteps--;
- stepperStep();
- }
- }
-
- // and... we're done
- return true;
-}
-
-bool GroveMD::disableStepper()
-{
- if (m_stepMode == STEP_MODE2)
- return writePacket(STEPPER_DISABLE, GROVEMD_NOOP, GROVEMD_NOOP);
-
- // else, mode 1
- writePacket(SET_DIRECTION, 0, GROVEMD_NOOP);
- return setMotorSpeeds(0, 0);
-}
-
-bool GroveMD::setStepperSteps(unsigned int steps)
-{
- if (m_stepMode == STEP_MODE2)
- {
- if (steps == 0)
- {
- // invalid
- throw std::out_of_range(std::string(__FUNCTION__) +
- ": invalid number of steps. " +
- "Valid values are between 1 and 255.");
- return false;
- }
- return writePacket(STEPPER_NUM_STEPS, steps, GROVEMD_NOOP);
- }
-
- // for mode one, just store it for future use by enableStepper()
- m_totalSteps = steps;
- return true;
-}
-
-void GroveMD::initClock()
-{
- gettimeofday(&m_startTime, NULL);
-}
-
-uint32_t GroveMD::getMillis()
-{
- struct timeval elapsed, now;
- uint32_t elapse;
-
- // get current time
- gettimeofday(&now, NULL);
-
- // compute the delta since m_startTime
- if( (elapsed.tv_usec = now.tv_usec - m_startTime.tv_usec) < 0 )
- {
- elapsed.tv_usec += 1000000;
- elapsed.tv_sec = now.tv_sec - m_startTime.tv_sec - 1;
- }
- else
- {
- elapsed.tv_sec = now.tv_sec - m_startTime.tv_sec;
- }
-
- elapse = (uint32_t)((elapsed.tv_sec * 1000) + (elapsed.tv_usec / 1000));
-
- // never return 0
- if (elapse == 0)
- elapse = 1;
-
- return elapse;
-}
-
-void GroveMD::configStepper(unsigned int stepsPerRev, STEP_MODE_T mode)
-{
- m_stepsPerRev = stepsPerRev;
- m_stepMode = mode;
- m_currentStep = 0;
- m_stepDelay = 0;
- m_stepDirection = 1;
- m_totalSteps = 0;
-}
-
-void GroveMD::stepperStep()
-{
- int step = m_currentStep % 4;
-
- switch (step)
- {
- case 0:
- writePacket(SET_DIRECTION, 0b0101, GROVEMD_NOOP);
- break;
- case 1:
- writePacket(SET_DIRECTION, 0b0110, GROVEMD_NOOP);
- break;
- case 2:
- writePacket(SET_DIRECTION, 0b1010, GROVEMD_NOOP);
- break;
- case 3:
- writePacket(SET_DIRECTION, 0b1001, GROVEMD_NOOP);
- break;
- }
-}
diff --git a/peripheral/libupm/src/grovemd/grovemd.h b/peripheral/libupm/src/grovemd/grovemd.h
deleted file mode 100644
index 9483475..0000000
--- a/peripheral/libupm/src/grovemd/grovemd.h
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <stdint.h>
-#include <sys/time.h>
-#include <string>
-#include <mraa/types.hpp>
-#include <mraa/i2c.hpp>
-
-#define GROVEMD_I2C_BUS 0
-#define GROVEMD_DEFAULT_I2C_ADDR 0x0f
-
-namespace upm {
- /**
- * @brief Grove I2C Motor Driver library
- * @defgroup grovemd libupm-grovemd
- * @ingroup seeed i2c motor robok
- */
-
- /**
- * @library grovemd
- * @sensor grovemd
- * @comname Grove I2C Motor Driver
- * @type motor
- * @man seeed
- * @con i2c
- * @kit robok
- *
- * @brief API for the Grove I2C Motor Driver
- *
- * This class implements support for the Grove I2C Motor Driver.
- * This device can support a single 4-wire stepper motor, or two
- * 2-wire DC motors. The device contains an Atmel* ATmega8L
- * microcontroller that manages an L298N H-bridge driver chip.
- *
- * This device supports an I2C bus speed of 100Khz only.
- *
- * The module does not provide any telemetry or status - it only
- * accepts I2C commands for its various operations.
- *
- * This module was tested with version 1.3 of the Grove I2C Motor
- * Driver.
- *
- * For stepper operation, this driver can run in one of two modes -
- * Mode 1, where this driver handles the stepping operation, and
- * Mode 2, where this driver simply sends commands to the Grove
- * Motor Driver, and it handles the stepping operation. Mode2
- * requires updated (and working) firmware to be loaded onto the
- * device.
- *
- * The default stepper operation mode is Mode1, which is generally
- * more flexible and is supported on all firmware revisions.
- *
- * @image html grovemd.jpg
- * An example showing the use of a DC motor
- * @snippet grovemd.cxx Interesting
- * An example showing the use of a 4-wire stepper
- * @snippet grovemd-stepper.cxx Interesting
- */
- class GroveMD {
-
- public:
- // GroveMD registers
- typedef enum { SET_SPEED = 0x82,
- SET_PWM_FREQ = 0x84,
- SET_DIRECTION = 0xaa,
- SET_MOTOR_A = 0xa1, // not documented
- SET_MOTOR_B = 0xa5, // not documented
- STEPPER_ENABLE = 0x1a,
- STEPPER_DISABLE = 0x1b,
- STEPPER_NUM_STEPS = 0x1c
- } REG_T;
-
- // legal directions for the stepper
- typedef enum { STEP_DIR_CCW = 0x01,
- STEP_DIR_CW = 0x00
- } STEP_DIRECTION_T;
-
- // legal directions for individual DC motors
- typedef enum { DIR_CCW = 0x02,
- DIR_CW = 0x01
- } DC_DIRECTION_T;
-
- // stepper modes
- typedef enum { STEP_MODE1 = 0x00,
- STEP_MODE2 = 0x01
- } STEP_MODE_T;
-
- /**
- * GroveMD constructor
- *
- * @param bus I2C bus to use
- * @param address I2C address to use
- */
- GroveMD(int bus=GROVEMD_I2C_BUS,
- uint8_t address=GROVEMD_DEFAULT_I2C_ADDR);
-
- /**
- * GroveMD destructor
- */
- ~GroveMD();
-
- /**
- * Composes and writes a 3-byte packet to the controller
- *
- * @param reg Register location
- * @param data1 First byte of data
- * @param data2 Second byte of data
- * @return True if successful
- */
- bool writePacket(REG_T reg, uint8_t data1, uint8_t data2);
-
- /**
- * To control DC motors, sets the speed of motors A & B.
- * Valid values are 0-255.
- *
- * @param speedA Speed of motor A
- * @param speedB Speed of motor B
- * @return True if successful
- */
- bool setMotorSpeeds(uint8_t speedA, uint8_t speedB);
-
- /**
- * To control DC motors, sets the PWM frequency prescale
- * factor. Note: this register is not ducumented other than to say
- * the default value is 0x03. Presumably, this is the timer
- * prescale factor used on the ATMega MCU timer driving the PWM.
- *
- * @param freq PWM prescale frequency; default is 0x03
- * @return True if successful
- */
- bool setPWMFrequencyPrescale(uint8_t freq=0x03);
-
- /**
- * To control DC motors, sets the directions of motors A & B
- *
- * @param dirA Direction for motor A, DIR_CW or DIR_CCW
- * @param dirB Direction for motor B, DIR_CW or DIR_CCW
- * @return True if successful
- */
- bool setMotorDirections(DC_DIRECTION_T dirA, DC_DIRECTION_T dirB);
-
- /**
- * To control a stepper motor, sets its direction and speed, and
- * then starts operation. For Mode2, this method will return
- * immediately. For Mode1 (the default) this method returns when
- * the number of steps specified by setStepperSteps() has
- * completed.
- *
- * @param dir Direction, STEP_DIR_CW or STEP_DIR_CCW
- * @param speed Motor speed. Valid range is 1-255. For Mode 1
- * (default), this specifies the speed in RPM's. For Mode 2,
- * speed is multiplied by 4ms by the board, so higher numbers
- * will mean a slower speed.
- * @return True if successful
- */
- bool enableStepper(STEP_DIRECTION_T dir, uint8_t speed);
-
- /**
- * To control a stepper motor, stops the stepper motor.
- *
- * @return True if successful
- */
- bool disableStepper();
-
- /**
- * To control a stepper motor, specifies the number of steps to
- * execute. For Mode2, valid values are between 1-255, 255 means
- * continuous rotation.
- *
- * For Mode1 (the default) steps can be any positive integer.
- *
- * @param steps Number of steps to execute. 255 (only in Mode2)
- * means continuous rotation.
- * @return True if successful
- */
- bool setStepperSteps(unsigned int steps);
-
- /**
- * Configure the initial Stepper parameters. This should be
- * called before any other stepper method.
- *
- * @param stepsPerRev The number of steps required to complete one
- * full revolution.
- * @param mode The stepper operating mode, default STEP_MODE1
- * @return Elapsed milliseconds
- */
- void configStepper(unsigned int stepsPerRev, STEP_MODE_T mode=STEP_MODE1);
-
- protected:
- mraa::I2c m_i2c;
- uint8_t m_addr;
-
- private:
- // steps per revolution
- int m_stepsPerRev;
- int m_currentStep;
- uint32_t m_stepDelay;
- uint32_t m_totalSteps;
- STEP_MODE_T m_stepMode;
-
- /**
- * Steps the motor one tick
- *
- */
- void stepperStep();
-
- // step direction: - 1 = forward, -1 = backward
- int m_stepDirection;
-
- // This is a NOOP value used to pad packets
- static const uint8_t GROVEMD_NOOP = 0x01;
- // our timer
- struct timeval m_startTime;
-
- /**
- * Returns the number of milliseconds elapsed since initClock()
- * was last called.
- *
- * @return Elapsed milliseconds
- */
- uint32_t getMillis();
-
- /**
- * Resets the clock
- *
- */
- void initClock();
-
- };
-}
-
-
diff --git a/peripheral/libupm/src/grovemd/javaupm_grovemd.i b/peripheral/libupm/src/grovemd/javaupm_grovemd.i
deleted file mode 100644
index 341297c..0000000
--- a/peripheral/libupm/src/grovemd/javaupm_grovemd.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_grovemd
-%include "../upm.i"
-
-%{
- #include "grovemd.h"
-%}
-
-%include "grovemd.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_grovemd");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/grovemd/jsupm_grovemd.i b/peripheral/libupm/src/grovemd/jsupm_grovemd.i
deleted file mode 100644
index a907c05..0000000
--- a/peripheral/libupm/src/grovemd/jsupm_grovemd.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_grovemd
-%include "../upm.i"
-
-%{
- #include "grovemd.h"
-%}
-
-%include "grovemd.h"
diff --git a/peripheral/libupm/src/grovemd/pyupm_grovemd.i b/peripheral/libupm/src/grovemd/pyupm_grovemd.i
deleted file mode 100644
index 4de7fbe..0000000
--- a/peripheral/libupm/src/grovemd/pyupm_grovemd.i
+++ /dev/null
@@ -1,15 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_grovemd
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-#ifdef DOXYGEN
-%include "grovemd_doc.i"
-#endif
-
-%include "grovemd.h"
-%{
- #include "grovemd.h"
-%}
diff --git a/peripheral/libupm/src/grovemoisture/CMakeLists.txt b/peripheral/libupm/src/grovemoisture/CMakeLists.txt
deleted file mode 100644
index a50d11e..0000000
--- a/peripheral/libupm/src/grovemoisture/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "grovemoisture")
-set (libdescription "upm grove moisture module")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/grovemoisture/grovemoisture.cxx b/peripheral/libupm/src/grovemoisture/grovemoisture.cxx
deleted file mode 100644
index 2145b44..0000000
--- a/peripheral/libupm/src/grovemoisture/grovemoisture.cxx
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <string>
-#include <stdexcept>
-
-#include "grovemoisture.h"
-
-using namespace upm;
-
-GroveMoisture::GroveMoisture(int pin)
-{
- if ( !(m_aio = mraa_aio_init(pin)) )
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_aio_init() failed, invalid pin?");
-}
-
-GroveMoisture::~GroveMoisture()
-{
- mraa_aio_close(m_aio);
-}
-
-int GroveMoisture::value()
-{
- return mraa_aio_read(m_aio);
-}
diff --git a/peripheral/libupm/src/grovemoisture/grovemoisture.h b/peripheral/libupm/src/grovemoisture/grovemoisture.h
deleted file mode 100644
index 2b08170..0000000
--- a/peripheral/libupm/src/grovemoisture/grovemoisture.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include <mraa/aio.h>
-
-namespace upm {
- /**
- * @brief Grove Moisture Sensor library
- * @defgroup grovemoisture libupm-grovemoisture
- * @ingroup seeed analog liquid eak hak
- */
-
- /**
- * @library grovemoisture
- * @sensor grovemoisture
- * @comname Grove Moisture Sensor
- * @type liquid
- * @man seeed
- * @con analog
- * @kit eak hak
- *
- * @brief API for the Grove Moisture Sensor
- *
- * UPM module for the Grove Moisture Sensor.
- * This sensor can be used to detect the moisture content
- * of soil or whether there is water around the sensor.
- * As the moisture content increases, so does the value that is read.
- * Note: this sensor is not designed to be left in soil
- * nor to be used outdoors.
- *
- * @image html grovemoisture.jpg
- * @snippet grovemoisture.cxx Interesting
- */
- class GroveMoisture {
- public:
- /**
- * Grove analog moisture sensor constructor
- *
- * @param pin Analog pin to use
- */
- GroveMoisture(int pin);
- /**
- * GroveMoisture destructor
- */
- ~GroveMoisture();
- /**
- * Gets the moisture value from the sensor
- *
- * @return Moisture reading
- */
- int value();
-
- private:
- mraa_aio_context m_aio;
- };
-}
-
-
diff --git a/peripheral/libupm/src/grovemoisture/javaupm_grovemoisture.i b/peripheral/libupm/src/grovemoisture/javaupm_grovemoisture.i
deleted file mode 100644
index 886991a..0000000
--- a/peripheral/libupm/src/grovemoisture/javaupm_grovemoisture.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_grovemoisture
-%include "../upm.i"
-
-%{
- #include "grovemoisture.h"
-%}
-
-%include "grovemoisture.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_grovemoisture");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/grovemoisture/jsupm_grovemoisture.i b/peripheral/libupm/src/grovemoisture/jsupm_grovemoisture.i
deleted file mode 100644
index e77e94b..0000000
--- a/peripheral/libupm/src/grovemoisture/jsupm_grovemoisture.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_grovemoisture
-%include "../upm.i"
-
-%{
- #include "grovemoisture.h"
-%}
-
-%include "grovemoisture.h"
diff --git a/peripheral/libupm/src/grovemoisture/pyupm_grovemoisture.i b/peripheral/libupm/src/grovemoisture/pyupm_grovemoisture.i
deleted file mode 100644
index cc1e015..0000000
--- a/peripheral/libupm/src/grovemoisture/pyupm_grovemoisture.i
+++ /dev/null
@@ -1,11 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_grovemoisture
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "grovemoisture.h"
-%{
- #include "grovemoisture.h"
-%}
diff --git a/peripheral/libupm/src/groveo2/CMakeLists.txt b/peripheral/libupm/src/groveo2/CMakeLists.txt
deleted file mode 100644
index a9edadb..0000000
--- a/peripheral/libupm/src/groveo2/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "groveo2")
-set (libdescription "upm groveO2 oxygen concentration sensor module")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/groveo2/groveo2.cxx b/peripheral/libupm/src/groveo2/groveo2.cxx
deleted file mode 100644
index 61b95eb..0000000
--- a/peripheral/libupm/src/groveo2/groveo2.cxx
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Author: Zion Orent <zorent@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <string>
-#include <stdexcept>
-
-#include "groveo2.h"
-
-using namespace upm;
-using namespace std;
-
-GroveO2::GroveO2(int pin)
-{
- if ( !(m_aio = mraa_aio_init(pin)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_aio_init() failed, invalid pin?");
- return;
- }
-}
-
-GroveO2::~GroveO2()
-{
- mraa_aio_close(m_aio);
-}
-
-float GroveO2::voltageValue()
-{
- int val = mraa_aio_read(m_aio);
- float sensorVoltage = (val/1024.0) * 5.0;
- sensorVoltage = (sensorVoltage/201.0) * 10000.0;
- return sensorVoltage;
-}
diff --git a/peripheral/libupm/src/groveo2/groveo2.h b/peripheral/libupm/src/groveo2/groveo2.h
deleted file mode 100644
index 16081d2..0000000
--- a/peripheral/libupm/src/groveo2/groveo2.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Author: Zion Orent <zorent@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include <mraa/aio.h>
-
-namespace upm {
- /**
- * @brief Grove O2 Oxygen Gas Sensor library
- * @defgroup groveo2 libupm-groveo2
- * @ingroup seeed analog gaseous
- */
-
- /**
- * @library groveo2
- * @sensor groveo2
- * @comname Grove O2 Sensor
- * @type gaseous
- * @man seeed
- * @con analog
- *
- * @brief API for the Grove O2 Oxygen Gas Sensor
- *
- * The Grove O2 Oxygen Gas sensor measures the oxygen concentration in the air
- *
- * @image html groveo2.jpg
- * @snippet groveo2.cxx Interesting
- */
- class GroveO2 {
- public:
- /**
- * Grove O2 Oxygen Gas sensor constructor
- *
- * @param pin Analog pin to use
- */
- GroveO2(int pin);
- /**
- * GroveO2 destructor
- */
- ~GroveO2();
- /**
- * Measures O2 from the sensor
- *
- * @return Oxygen concentration as voltage
- */
- float voltageValue();
-
- private:
- mraa_aio_context m_aio;
- };
-}
diff --git a/peripheral/libupm/src/groveo2/javaupm_groveo2.i b/peripheral/libupm/src/groveo2/javaupm_groveo2.i
deleted file mode 100644
index 8ae0399..0000000
--- a/peripheral/libupm/src/groveo2/javaupm_groveo2.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_groveo2
-%include "../upm.i"
-
-%{
- #include "groveo2.h"
-%}
-
-%include "groveo2.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_groveo2");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/groveo2/jsupm_groveo2.i b/peripheral/libupm/src/groveo2/jsupm_groveo2.i
deleted file mode 100644
index 8e3482e..0000000
--- a/peripheral/libupm/src/groveo2/jsupm_groveo2.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_groveo2
-%include "../upm.i"
-
-%{
- #include "groveo2.h"
-%}
-
-%include "groveo2.h"
diff --git a/peripheral/libupm/src/groveo2/pyupm_groveo2.i b/peripheral/libupm/src/groveo2/pyupm_groveo2.i
deleted file mode 100644
index f468b52..0000000
--- a/peripheral/libupm/src/groveo2/pyupm_groveo2.i
+++ /dev/null
@@ -1,11 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_groveo2
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "groveo2.h"
-%{
- #include "groveo2.h"
-%}
diff --git a/peripheral/libupm/src/grovescam/CMakeLists.txt b/peripheral/libupm/src/grovescam/CMakeLists.txt
deleted file mode 100644
index 509a664..0000000
--- a/peripheral/libupm/src/grovescam/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "grovescam")
-set (libdescription "upm grove serial camera module")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/grovescam/grovescam.cxx b/peripheral/libupm/src/grovescam/grovescam.cxx
deleted file mode 100644
index 1bc6235..0000000
--- a/peripheral/libupm/src/grovescam/grovescam.cxx
+++ /dev/null
@@ -1,489 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Thanks to Seeed Studio for a working arduino sketch
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <string>
-#include <stdexcept>
-#include <errno.h>
-
-#include "grovescam.h"
-
-using namespace upm;
-using namespace std;
-
-static const int maxRetries = 100;
-
-GROVESCAM::GROVESCAM(int uart, uint8_t camAddr)
-{
- m_ttyFd = -1;
-
- // save our shifted camera address, we'll need it a lot
- m_camAddr = (camAddr << 5);
-
- m_picTotalLen = 0;
-
- if ( !(m_uart = mraa_uart_init(uart)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_uart_init() failed");
- return;
- }
-
- // This requires a recent MRAA (1/2015)
- const char *devPath = mraa_uart_get_dev_path(m_uart);
-
- if (!devPath)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": mraa_uart_get_dev_path() failed");
- return;
- }
-
- // now open the tty
- if ( (m_ttyFd = open(devPath, O_RDWR)) == -1)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": open of " +
- string(devPath) + " failed:" +
- string(strerror(errno)));
- return;
- }
-}
-
-GROVESCAM::~GROVESCAM()
-{
- if (m_ttyFd != -1)
- close(m_ttyFd);
-}
-
-bool GROVESCAM::dataAvailable(unsigned int millis)
-{
- if (m_ttyFd == -1)
- return false;
-
- 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;
- }
-
- int nfds;
- fd_set readfds;
-
- FD_ZERO(&readfds);
-
- FD_SET(m_ttyFd, &readfds);
-
- if (select(m_ttyFd + 1, &readfds, NULL, NULL, &timeout) > 0)
- return true; // data is ready
- else
- return false;
-}
-
-int GROVESCAM::readData(uint8_t *buffer, int len)
-{
- if (m_ttyFd == -1)
- return(-1);
-
- int rv = read(m_ttyFd, (char *)buffer, len);
-
- if (rv < 0)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": read() failed: " +
- string(strerror(errno)));
- return rv;
- }
-
- return rv;
-}
-
-int GROVESCAM::writeData(uint8_t *buffer, int len)
-{
- if (m_ttyFd == -1)
- return(-1);
-
- // first, flush any pending but unread input
-
- tcflush(m_ttyFd, TCIFLUSH);
-
- int rv = write(m_ttyFd, (char *)buffer, len);
-
- if (rv < 0)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": write() failed: " +
- string(strerror(errno)));
- return rv;
- }
-
- tcdrain(m_ttyFd);
-
- return rv;
-}
-
-bool GROVESCAM::setupTty(speed_t baud)
-{
- if (m_ttyFd == -1)
- return(false);
-
- struct termios termio;
-
- // get current modes
- tcgetattr(m_ttyFd, &termio);
-
- // setup for a 'raw' mode. 81N, no echo or special character
- // handling, such as flow control.
- cfmakeraw(&termio);
-
- // set our baud rates
- cfsetispeed(&termio, baud);
- cfsetospeed(&termio, baud);
-
- // make it so
- if (tcsetattr(m_ttyFd, TCSAFLUSH, &termio) < 0)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": tcsetattr() failed: " +
- string(strerror(errno)));
- return false;
- }
-
- return true;
-}
-
-void GROVESCAM::drainInput()
-{
- uint8_t ch;
-
- while (dataAvailable(0))
- readData(&ch, 1);
-}
-
-bool GROVESCAM::init()
-{
- const unsigned int pktLen = 6;
- uint8_t cmd[pktLen] = {0xaa, static_cast<uint8_t>(0x0d|m_camAddr), 0x00,
- 0x00, 0x00, 0x00};
- uint8_t resp[pktLen];
- int retries = 0;
-
- while (true)
- {
- if (retries++ > maxRetries)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": maximum retries exceeded");
- return false;
- }
-
- writeData(cmd, pktLen);
-
- if (!dataAvailable(500))
- continue;
-
- if (readData(resp, pktLen) != pktLen)
- continue;
-
- if (resp[0] == 0xaa
- && resp[1] == (0x0e | m_camAddr)
- && resp[2] == 0x0d
- && resp[4] == 0
- && resp[5] == 0)
- {
- if (readData(resp, pktLen) != pktLen)
- continue;
- else
- {
- if (resp[0] == 0xaa
- && resp[1] == (0x0d | m_camAddr)
- && resp[2] == 0
- && resp[3] == 0
- && resp[4] == 0
- && resp[5] == 0)
- break;
- }
- }
- }
-
- cmd[1] = 0x0e | m_camAddr;
- cmd[2] = 0x0d;
- writeData(cmd, pktLen);
-
- return true;
-}
-
-bool GROVESCAM::preCapture(PIC_FORMATS_T fmt)
-{
- const unsigned int pktLen = 6;
- uint8_t cmd[pktLen] = { 0xaa, static_cast<uint8_t>(0x01 | m_camAddr), 0x00,
- 0x07, 0x00, static_cast<uint8_t>(fmt) };
- uint8_t resp[pktLen];
- int retries = 0;
-
- while (true)
- {
- if (retries++ > maxRetries)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": maximum retries exceeded");
- return false;
- }
-
- drainInput();
-
- writeData(cmd, pktLen);
-
- if (!dataAvailable(100))
- continue;
-
- if (readData(resp, pktLen) != pktLen)
- continue;
-
- if (resp[0] == 0xaa
- && resp[1] == (0x0e | m_camAddr)
- && resp[2] == 0x01
- && resp[4] == 0
- && resp[5] == 0) break;
- }
-
- return true;
-}
-
-bool GROVESCAM::doCapture()
-{
- const unsigned int pktLen = 6;
- uint8_t cmd[pktLen] = { 0xaa, static_cast<uint8_t>(0x06 | m_camAddr), 0x08,
- MAX_PKT_LEN & 0xff, (MAX_PKT_LEN >> 8) & 0xff, 0};
- uint8_t resp[pktLen];
- int retries = 0;
-
- m_picTotalLen = 0;
-
- while (true)
- {
- if (retries++ > maxRetries)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": maximum retries exceeded");
- return false;
- }
-
- drainInput();
- writeData(cmd, pktLen);
- usleep(100000);
-
- if (!dataAvailable(100))
- continue;
-
- if (readData(resp, pktLen) != pktLen)
- continue;
-
- if (resp[0] == 0xaa
- && resp[1] == (0x0e | m_camAddr)
- && resp[2] == 0x06
- && resp[4] == 0
- && resp[5] == 0)
- break;
- }
-
- cmd[1] = 0x05 | m_camAddr;
- cmd[2] = 0;
- cmd[3] = 0;
- cmd[4] = 0;
- cmd[5] = 0;
-
- retries = 0;
- while (true)
- {
- if (retries++ > maxRetries)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": maximum retries exceeded");
- return false;
- }
-
- drainInput();
- writeData(cmd, pktLen);
- if (readData(resp, pktLen) != pktLen)
- continue;
-
- if (resp[0] == 0xaa
- && resp[1] == (0x0e | m_camAddr)
- && resp[2] == 0x05
- && resp[4] == 0
- && resp[5] == 0)
- break;
- }
-
- cmd[1] = 0x04 | m_camAddr;
- cmd[2] = 0x01;
-
- retries = 0;
- while (true)
- {
- if (retries++ > maxRetries)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": maximum retries exceeded");
- return false;
- }
-
- drainInput();
- writeData(cmd, 6);
-
- if (readData(resp, pktLen) != pktLen)
- continue;
-
- if (resp[0] == 0xaa
- && resp[1] == (0x0e | m_camAddr)
- && resp[2] == 0x04
- && resp[4] == 0
- && resp[5] == 0)
- {
- if (!dataAvailable(1000))
- continue;
-
- if (readData(resp, pktLen) != pktLen)
- continue;
-
- if (resp[0] == 0xaa
- && resp[1] == (0x0a | m_camAddr)
- && resp[2] == 0x01)
- {
- m_picTotalLen = (resp[3]) | (resp[4] << 8) | (resp[5] << 16);
- break;
- }
- }
- }
-
- return true;
-}
-
-bool GROVESCAM::storeImage(const char *fname)
-{
- if (!fname)
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": filename is NULL");
- return false;
- }
-
- if (!m_picTotalLen)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": Picture length is zero, you need to capture first.");
-
- return false;
- }
-
- FILE *file = fopen(fname, "wb");
-
- if (!file)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": fopen() failed: " +
- string(strerror(errno)));
- return false;
- }
-
- /// let the games begin...
- const unsigned int pktLen = 6;
- unsigned int pktCnt = (m_picTotalLen) / (MAX_PKT_LEN - 6);
- if ((m_picTotalLen % (MAX_PKT_LEN-6)) != 0)
- pktCnt += 1;
-
- uint8_t cmd[pktLen] = { 0xaa, static_cast<uint8_t>(0x0e | m_camAddr), 0x00,
- 0x00, 0x00, 0x00 };
- uint8_t pkt[MAX_PKT_LEN];
- int retries = 0;
-
- for (unsigned int i = 0; i < pktCnt; i++)
- {
- cmd[4] = i & 0xff;
- cmd[5] = (i >> 8) & 0xff;
-
- retries = 0;
-
- retry:
-
- usleep(10000);
-
- drainInput();
- writeData(cmd, pktLen);
-
- if (!dataAvailable(1000))
- {
- if (retries++ > maxRetries)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": timeout, maximum retries exceeded");
- return false;
- }
- goto retry;
- }
-
- uint16_t cnt = readData(pkt, MAX_PKT_LEN);
-
- unsigned char sum = 0;
- for (int y = 0; y < cnt - 2; y++)
- {
- sum += pkt[y];
- }
- if (sum != pkt[cnt-2])
- {
- if (retries++ <= maxRetries)
- goto retry;
- else
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": cksum error, maximum retries exceeded");
- return false;
- }
- }
-
- fwrite((const uint8_t *)&pkt[4], cnt - 6, 1, file);
- }
-
- cmd[4] = 0xf0;
- cmd[5] = 0xf0;
- writeData(cmd, pktLen);
-
- fclose(file);
-
- // reset the pic length to 0 for another run.
- m_picTotalLen = 0;
-
- return true;
-}
diff --git a/peripheral/libupm/src/grovescam/grovescam.h b/peripheral/libupm/src/grovescam/grovescam.h
deleted file mode 100644
index 82fff7d..0000000
--- a/peripheral/libupm/src/grovescam/grovescam.h
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Thanks to Seeed Studio for a working arduino sketch
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include <iostream>
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <termios.h>
-#include <sys/time.h>
-#include <sys/select.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include <mraa/uart.h>
-
-#define GROVESCAM_DEFAULT_UART 0
-
-#define GROVESCAM_DEFAULT_CAMERA_ADDR 0
-
-namespace upm {
- /**
- * @brief Grove Serial Camera library
- * @defgroup grovescam libupm-grovescam
- * @ingroup seeed uart other
- */
-
- /**
- * @library grovescam
- * @sensor grovescam
- * @comname Grove Serial Camera
- * @type other
- * @man seeed
- * @con uart
- * @web http://www.seeedstudio.com/wiki/Grove_-_Serial_Camera_Kit
- *
- * @brief API for the Grove Serial Camera
- *
- * The driver was tested with the Grove Serial Camera. There is
- * no protocol documentation currently available, so this module
- * was developed based completely on the Seeed Studio* Arduino*
- * sketch.
- *
- * It is connected via a UART at 115,200 baud.
- *
- * @image html grovescam.jpg
- * @snippet grovescam.cxx Interesting
- */
-
- class GROVESCAM {
- public:
-
- static const unsigned int MAX_PKT_LEN = 128;
-
- typedef enum {
- FORMAT_VGA = 7, // 640x480
- FORMAT_CIF = 5, // 352×288
- FORMAT_OCIF = 3 // ??? (maybe they meant QCIF?)
- } PIC_FORMATS_T;
-
- /**
- * Grove Serial Camera constructor
- *
- * @param uart Default UART to use (0 or 1)
- * @param camAddr 3-bit address identifier of the camera; default is 0
- */
- GROVESCAM(int uart, uint8_t camAddr=GROVESCAM_DEFAULT_CAMERA_ADDR);
-
- /**
- * GROVESCAM destructor
- */
- ~GROVESCAM();
-
- /**
- * Checks to see if there is data available for reading
- *
- * @param millis Number of milliseconds to wait; 0 means no waiting.
- * @return True if there is data available for reading
- */
- bool dataAvailable(unsigned int millis);
-
- /**
- * Reads any available data into a user-supplied buffer. Note: the
- * call blocks until data is available to be read. Use
- * dataAvailable() to determine whether there is data available
- * beforehand, to avoid blocking.
- *
- * @param buffer Buffer to hold the data read
- * @param len Length of the buffer
- * @return Number of bytes read
- */
- int readData(uint8_t *buffer, int len);
-
- /**
- * Writes the data in the buffer to the device
- *
- * @param buffer Buffer to hold the data read
- * @param len Length of the buffer
- * @return Number of bytes written
- */
- int writeData(uint8_t *buffer, int len);
-
- /**
- * Sets up proper tty I/O modes and the baud rate. For this device, the default
- * baud rate is 9,600 (B9600).
- *
- * @param baud Desired baud rate
- * @return True if successful
- */
- bool setupTty(speed_t baud=B115200);
-
- /**
- * Reads serial input and discards until no more characters are available
- *
- */
- void drainInput();
-
- /**
- * Initializes the camera
- *
- */
- bool init();
-
- /**
- * Tells the camera to prepare for a capture
- *
- * @param fmt One of the PIC_FORMATS_T values
- */
- bool preCapture(PIC_FORMATS_T fmt=FORMAT_VGA);
-
- /**
- * Starts the capture
- *
- * @return True if successful
- */
- bool doCapture();
-
- /**
- * Stores the captured image in a file
- *
- * @param fname Name of the file to write
- * @return True if successful
- */
- bool storeImage(const char *fname);
-
- /**
- * Returns the picture length. Note: this is only valid after
- * doCapture() has run successfully.
- *
- * @return Image length
- */
- int getImageSize() { return m_picTotalLen; };
-
- protected:
- int ttyFd() { return m_ttyFd; };
-
- private:
- mraa_uart_context m_uart;
- int m_ttyFd;
-
- uint8_t m_camAddr;
- int m_picTotalLen;
- };
-}
-
-
diff --git a/peripheral/libupm/src/grovescam/javaupm_grovescam.i b/peripheral/libupm/src/grovescam/javaupm_grovescam.i
deleted file mode 100644
index 8e55cdf..0000000
--- a/peripheral/libupm/src/grovescam/javaupm_grovescam.i
+++ /dev/null
@@ -1,20 +0,0 @@
-%module javaupm_grovescam
-%include "../upm.i"
-%include "../java_buffer.i"
-
-%{
- #include "grovescam.h"
-%}
-
-%include "grovescam.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_grovescam");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/grovescam/jsupm_grovescam.i b/peripheral/libupm/src/grovescam/jsupm_grovescam.i
deleted file mode 100644
index d8e12ec..0000000
--- a/peripheral/libupm/src/grovescam/jsupm_grovescam.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_grovescam
-%include "../upm.i"
-
-%{
- #include "grovescam.h"
-%}
-
-%include "grovescam.h"
diff --git a/peripheral/libupm/src/grovescam/pyupm_grovescam.i b/peripheral/libupm/src/grovescam/pyupm_grovescam.i
deleted file mode 100644
index 6bb7163..0000000
--- a/peripheral/libupm/src/grovescam/pyupm_grovescam.i
+++ /dev/null
@@ -1,11 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_grovescam
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%{
- #include "grovescam.h"
-%}
-%include "grovescam.h"
diff --git a/peripheral/libupm/src/grovespeaker/CMakeLists.txt b/peripheral/libupm/src/grovespeaker/CMakeLists.txt
deleted file mode 100644
index ab3b511..0000000
--- a/peripheral/libupm/src/grovespeaker/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "grovespeaker")
-set (libdescription "upm grovespeaker speaker module")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/grovespeaker/grovespeaker.cxx b/peripheral/libupm/src/grovespeaker/grovespeaker.cxx
deleted file mode 100644
index 0b34e48..0000000
--- a/peripheral/libupm/src/grovespeaker/grovespeaker.cxx
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * Author: Zion Orent <sorent@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <string>
-#include <stdexcept>
-
-#include "grovespeaker.h"
-
-using namespace upm;
-
-GroveSpeaker::GroveSpeaker(int pin)
-{
- if ( !(m_gpio = mraa_gpio_init(pin)) )
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_gpio_init() failed, invalid pin?");
-
- mraa_gpio_dir(m_gpio, MRAA_GPIO_OUT);
- m_note_list['a'] = storeNote(1136, 1073, 568, 536, 284, 268);
- m_note_list['b'] = storeNote(1012, 0, 506, 0, 253, 0);
- m_note_list['c'] = storeNote(1911, 1804, 956, 902, 478, 451);
- m_note_list['d'] = storeNote(1703, 1607, 851, 804, 426, 402);
- m_note_list['e'] = storeNote(1517, 0, 758, 0, 379, 0);
- m_note_list['f'] = storeNote(1432, 1351, 716, 676, 358, 338);
- m_note_list['g'] = storeNote(1276, 1204, 638, 602, 319, 301);
-}
-
-GroveSpeaker::~GroveSpeaker()
-{
- mraa_gpio_close(m_gpio);
-}
-
-NoteData GroveSpeaker::storeNote(int noteDelayLow, int noteDelayLowSharp,
- int noteDelayMed, int noteDelayMedSharp,
- int noteDelayHigh, int noteDelayHighSharp)
-{
- NoteData note;
- note.delayTimeLow = noteDelayLow;
- note.delayTimeLowSharp = noteDelayLowSharp;
- note.delayTimeMed = noteDelayMed;
- note.delayTimeMedSharp = noteDelayMedSharp;
- note.delayTimeHigh = noteDelayHigh;
- note.delayTimeHighSharp = noteDelayHighSharp;
- return note;
-}
-
-void GroveSpeaker::playAll()
-{
- playSound('c', false, "low");
- usleep(200000);
- playSound('d', false, "low");
- usleep(200000);
- playSound('e', false, "low");
- usleep(200000);
- playSound('f', false, "low");
- usleep(200000);
- playSound('g', false, "low");
- usleep(500000);
- playSound('a', false, "low");
- usleep(500000);
- playSound('b', false, "low");
- usleep(500000);
-}
-
-void GroveSpeaker::playSound(char letter, bool sharp, std::string vocalWeight)
-{
- std::map<char, NoteData>::iterator it = m_note_list.find(letter);
- if(it == m_note_list.end())
- {
- std::cout << "The key " << letter << " doesn't exist." << std::endl;
- return;
- }
- NoteData nd = it->second;
- int delayTime;
- if (sharp)
- {
- if (vocalWeight.compare("low") == 0)
- delayTime = nd.delayTimeLowSharp;
- else if (vocalWeight.compare("med") == 0)
- delayTime = nd.delayTimeMedSharp;
- else if (vocalWeight.compare("high") == 0)
- delayTime = nd.delayTimeHighSharp;
- else
- {
- std::cout << "Correct voice weight values are low, med, or high"
- << std::endl;
- return;
- }
- }
- else
- {
- if (vocalWeight.compare("low") == 0)
- delayTime = nd.delayTimeLow;
- else if (vocalWeight.compare("med") == 0)
- delayTime = nd.delayTimeMed;
- else if (vocalWeight.compare("high") == 0)
- delayTime = nd.delayTimeHigh;
- else
- {
- std::cout << "Correct voice weight values are low, med, or high"
- << std::endl;
- return;
- }
- }
- // If delayTime is zero, that means you tried to choose a sharp note
- // for a note that has no sharp
- if (sharp && !delayTime)
- {
- std::cout << "The key " << letter << " doesn't have a sharp note."
- << std::endl;
- return;
- }
- sound(delayTime);
-}
-
-void GroveSpeaker::sound(int note_delay)
-{
- mraa_result_t error = MRAA_SUCCESS;
- for (int i = 0; i < 100; i++)
- {
- error = mraa_gpio_write (m_gpio, HIGH);
- usleep(note_delay);
- error = mraa_gpio_write (m_gpio, LOW);
- usleep(note_delay);
- }
- if (error != MRAA_SUCCESS)
- mraa_result_print(error);
-}
-
diff --git a/peripheral/libupm/src/grovespeaker/grovespeaker.h b/peripheral/libupm/src/grovespeaker/grovespeaker.h
deleted file mode 100644
index 535dc48..0000000
--- a/peripheral/libupm/src/grovespeaker/grovespeaker.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Author: Zion Orent <sorent@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include <map>
-#include <unistd.h>
-#include <mraa/gpio.h>
-
-#define HIGH 1
-#define LOW 0
-
-namespace upm {
- /**
- * @brief Grove Speaker library
- * @defgroup grovespeaker libupm-grovespeaker
- * @ingroup seeed gpio sound hak
- */
-typedef struct
-{
- int delayTimeLow;
- int delayTimeLowSharp;
- int delayTimeMed;
- int delayTimeMedSharp;
- int delayTimeHigh;
- int delayTimeHighSharp;
-} NoteData;
- /**
- * @library grovespeaker
- * @sensor grovespeaker
- * @comname Grove Speaker
- * @type sound
- * @man seeed
- * @con gpio
- * @kit hak
- *
- * @brief API for the Grove Speaker
- *
- * UPM module for the Grove Speaker.
- * This sensor can generate different tones and sounds depending on the
- * frequency of the input signal.
- *
- * @image html grovespeaker.jpg
- * @snippet grovespeaker.cxx Interesting
- */
- class GroveSpeaker {
- public:
- /**
- * Grove Speaker constructor
- *
- * @param pin Digital pin to use
- */
- GroveSpeaker(int pin);
- /**
- * GroveSpeaker destructor
- */
- ~GroveSpeaker();
- /**
- * Plays all alto notes (lowest notes)
- *
- */
- void playAll();
- /**
- * Plays a sound and a note whether it's sharp or not
- *
- * @param letter Character name of the note
- * ('a', 'b', 'c', 'd', 'e', 'f', or 'g')
- * @param sharp If true, plays a sharp version of the note; otherwise, does not play the note
- * @param vocalWeight String to determine whether to play a low ("low"),
- * a medium ("med"), or a high ("high") note
- */
- void playSound(char letter, bool sharp, std::string vocalWeight);
-
- private:
- mraa_gpio_context m_gpio;
- std::map <char, NoteData> m_note_list;
- void sound(int note_delay);
- NoteData storeNote(int noteDelayLow, int noteDelayLowSharp,
- int noteDelayMed, int noteDelayMedSharp,
- int noteDelayHigh, int noteDelayHighSharp);
- };
-}
diff --git a/peripheral/libupm/src/grovespeaker/javaupm_grovespeaker.i b/peripheral/libupm/src/grovespeaker/javaupm_grovespeaker.i
deleted file mode 100644
index c3f98a7..0000000
--- a/peripheral/libupm/src/grovespeaker/javaupm_grovespeaker.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_grovespeaker
-%include "../upm.i"
-
-%{
- #include "grovespeaker.h"
-%}
-
-%include "grovespeaker.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_grovespeaker");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/grovespeaker/jsupm_grovespeaker.i b/peripheral/libupm/src/grovespeaker/jsupm_grovespeaker.i
deleted file mode 100644
index cf0f1e6..0000000
--- a/peripheral/libupm/src/grovespeaker/jsupm_grovespeaker.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_grovespeaker
-%include "../upm.i"
-
-%{
- #include "grovespeaker.h"
-%}
-
-%include "grovespeaker.h"
diff --git a/peripheral/libupm/src/grovespeaker/pyupm_grovespeaker.i b/peripheral/libupm/src/grovespeaker/pyupm_grovespeaker.i
deleted file mode 100644
index 16d54db..0000000
--- a/peripheral/libupm/src/grovespeaker/pyupm_grovespeaker.i
+++ /dev/null
@@ -1,11 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_grovespeaker
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "grovespeaker.h"
-%{
- #include "grovespeaker.h"
-%}
diff --git a/peripheral/libupm/src/groveultrasonic/CMakeLists.txt b/peripheral/libupm/src/groveultrasonic/CMakeLists.txt
deleted file mode 100644
index 3144f43..0000000
--- a/peripheral/libupm/src/groveultrasonic/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "groveultrasonic")
-set (libdescription "upm grove ultrasonic proximity sensor")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/groveultrasonic/groveultrasonic.cxx b/peripheral/libupm/src/groveultrasonic/groveultrasonic.cxx
deleted file mode 100644
index 2a695f7..0000000
--- a/peripheral/libupm/src/groveultrasonic/groveultrasonic.cxx
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Author: Jun Kato <i@junkato.jp>
- * Copyright (c) 2015 Jun Kato.
- *
- * Thanks to Seeed Studio for a working arduino sketch
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <unistd.h>
-#include <stdlib.h>
-#include <functional>
-
-#include "groveultrasonic.h"
-
-using namespace upm;
-
-GroveUltraSonic::GroveUltraSonic (uint8_t pin) {
- mraa_result_t error = MRAA_SUCCESS;
- m_name = "GroveUltraSonic";
-
- mraa_init();
-
- // setup pin
- m_pinCtx = mraa_gpio_init(pin);
- if (m_pinCtx == NULL) {
- fprintf (stderr, "Are you sure that pin%d you requested is valid on your platform?", pin);
- exit (1);
- }
- mraa_gpio_use_mmaped(m_pinCtx, 1);
- mraa_gpio_isr (m_pinCtx, MRAA_GPIO_EDGE_BOTH,
- &signalISR, this);
-}
-
-GroveUltraSonic::~GroveUltraSonic () {
-
- // close pin
- mraa_gpio_isr_exit(m_pinCtx);
- mraa_gpio_close (m_pinCtx);
-}
-
-int
-GroveUltraSonic::getDistance () {
-
- // output trigger signal
- mraa_gpio_dir(m_pinCtx, MRAA_GPIO_OUT);
- mraa_gpio_write(m_pinCtx, LOW);
- usleep(2);
- mraa_gpio_write(m_pinCtx, HIGH);
- usleep(5);
- mraa_gpio_write(m_pinCtx, LOW);
-
- // wait for the pulse,
- m_doWork = true;
- m_InterruptCounter = 0;
- mraa_gpio_dir(m_pinCtx, MRAA_GPIO_IN);
-
- // though do not wait over 25 [ms].
- int timer = 0;
- while (m_doWork && timer++ < 5) {
- // in 25 [ms], sound travels 25000 / 29 / 2 = 431 [cm],
- // which is more than 400 [cm], the max distance measurable with this sensor.
- usleep(5 * 1000); // 5 [ms]
- }
-
- // calc diff
- long diff = m_FallingTimeStamp.tv_usec - m_RisingTimeStamp.tv_usec;
- diff += (m_FallingTimeStamp.tv_sec - m_RisingTimeStamp.tv_sec) * 1000000;
- return timer >= 5 ? 0 : diff;
-}
-
-void
-GroveUltraSonic::signalISR(void *ctx) {
- upm::GroveUltraSonic *This = (upm::GroveUltraSonic *)ctx;
- This->ackEdgeDetected();
-}
-
-void
-GroveUltraSonic::ackEdgeDetected () {
- if (++m_InterruptCounter % 2 == 0) {
- gettimeofday(&m_FallingTimeStamp, NULL);
- m_doWork = false;
- } else {
- gettimeofday(&m_RisingTimeStamp, NULL);
- }
-}
diff --git a/peripheral/libupm/src/groveultrasonic/groveultrasonic.h b/peripheral/libupm/src/groveultrasonic/groveultrasonic.h
deleted file mode 100644
index d1fd340..0000000
--- a/peripheral/libupm/src/groveultrasonic/groveultrasonic.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Author: Jun Kato <i@junkato.jp>
- * Copyright (c) 2015 Jun Kato.
- *
- * Thanks to Seeed Studio for a working arduino sketch
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include <mraa/aio.h>
-#include <mraa/gpio.h>
-#include <sys/time.h>
-
-#define HIGH 1
-#define LOW 0
-
-namespace upm {
-
-/**
- * @brief Grove ultrasonic sensor library
- * @defgroup groveultrasonic libupm-groveultrasonic
- * @ingroup grove gpio sound
- */
-
-/**
- * @library groveultrasonic
- * @sensor groveultrasonic
- * @comname Grove Ultrasonic Ranger
- * @type sound
- * @man seeed
- * @con gpio
- *
- * @brief API for Grove Ultrasonic Ranger
- *
- * This Grove Ultrasonic sensor is a non-contact distance measurement module
- * which is compatible with the Grove system. It is designed for easy modular
- * project usage with industrial performance. Detection ranges from 3 cm (1.2")
- * to 4 m (13'1.5") and works best when the object is within a 30 degree angle
- * relative to the sensor.
- *
- * @image html groveultrasonic.jpg
- * @snippet groveultrasonic.cxx Interesting
- */
-class GroveUltraSonic {
- public:
- /**
- * Instantiates a GroveUltraSonic object
- *
- * @param pin pin for triggering the sensor for distance and for receiving pulse response
- */
- GroveUltraSonic (uint8_t pin);
-
- /**
- * GroveUltraSonic object destructor.
- */
- ~GroveUltraSonic ();
-
- /**
- * Returns the echo's pulse width from the sensor in microseconds.
- * Divide by 58 to convert distance to centimetres.
- * Divide by 148 to convert distance to inches.
- */
- int getDistance ();
-
- /**
- * Return name of the component
- */
- std::string name()
- {
- return m_name;
- }
-
- /**
- * Returns true while the sensor is busy waiting for the echo pulse
- */
- bool working()
- {
- return m_doWork;
- }
-
- private:
- bool m_doWork; /* Flag to control blocking function while waiting for falling edge interrupt */
- mraa_gpio_context m_pinCtx;
- uint8_t m_InterruptCounter;
- struct timeval m_RisingTimeStamp;
- struct timeval m_FallingTimeStamp;
- std::string m_name;
-
- /**
- * ISR for the pulse signal
- */
- static void signalISR(void *ctx);
-
- /**
- * On each interrupt this function will detect if the interrupt
- * was falling edge or rising.
- * Should be called from the interrupt handler.
- */
- void ackEdgeDetected ();
-};
-
-}
diff --git a/peripheral/libupm/src/groveultrasonic/javaupm_groveultrasonic.i b/peripheral/libupm/src/groveultrasonic/javaupm_groveultrasonic.i
deleted file mode 100644
index a0680e9..0000000
--- a/peripheral/libupm/src/groveultrasonic/javaupm_groveultrasonic.i
+++ /dev/null
@@ -1,21 +0,0 @@
-%module javaupm_groveultrasonic
-%include "../upm.i"
-
-%ignore signalISR;
-
-%{
- #include "groveultrasonic.h"
-%}
-
-%include "groveultrasonic.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_groveultrasonic");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%}
diff --git a/peripheral/libupm/src/groveultrasonic/jsupm_groveultrasonic.i b/peripheral/libupm/src/groveultrasonic/jsupm_groveultrasonic.i
deleted file mode 100644
index 6993b01..0000000
--- a/peripheral/libupm/src/groveultrasonic/jsupm_groveultrasonic.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_groveultrasonic
-%include "../upm.i"
-
-%{
- #include "groveultrasonic.h"
-%}
-
-%include "groveultrasonic.h"
diff --git a/peripheral/libupm/src/groveultrasonic/pyupm_groveultrasonic.i b/peripheral/libupm/src/groveultrasonic/pyupm_groveultrasonic.i
deleted file mode 100644
index 188dd40..0000000
--- a/peripheral/libupm/src/groveultrasonic/pyupm_groveultrasonic.i
+++ /dev/null
@@ -1,11 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_groveultrasonic
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "groveultrasonic.h"
-%{
- #include "groveultrasonic.h"
-%}
diff --git a/peripheral/libupm/src/grovevdiv/CMakeLists.txt b/peripheral/libupm/src/grovevdiv/CMakeLists.txt
deleted file mode 100644
index ec612c0..0000000
--- a/peripheral/libupm/src/grovevdiv/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "grovevdiv")
-set (libdescription "upm grove voltage divider module")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/grovevdiv/grovevdiv.cxx b/peripheral/libupm/src/grovevdiv/grovevdiv.cxx
deleted file mode 100644
index 722956e..0000000
--- a/peripheral/libupm/src/grovevdiv/grovevdiv.cxx
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <string>
-#include <stdexcept>
-
-#include "grovevdiv.h"
-
-using namespace upm;
-using namespace std;
-
-GroveVDiv::GroveVDiv(int pin)
-{
- if ( !(m_aio = mraa_aio_init(pin)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_aio_init() failed, invalid pin?");
- return;
- }
-}
-
-GroveVDiv::~GroveVDiv()
-{
- mraa_aio_close(m_aio);
-}
-
-unsigned int GroveVDiv::value(unsigned int samples)
-{
- unsigned int sum = 0;
-
- for (int i=0; i<samples; i++)
- {
- sum += mraa_aio_read(m_aio);
- usleep(2000);
- }
-
- return (sum / samples);
-}
-
-float GroveVDiv::computedValue(uint8_t gain, unsigned int val, int vref, int res)
-{
- return ((float(gain) * float(val) * float(vref) / float(res)) / 1000.0);
-
-}
-
diff --git a/peripheral/libupm/src/grovevdiv/grovevdiv.h b/peripheral/libupm/src/grovevdiv/grovevdiv.h
deleted file mode 100644
index 9e93879..0000000
--- a/peripheral/libupm/src/grovevdiv/grovevdiv.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include <iostream>
-#include <stdint.h>
-#include <mraa/aio.h>
-
-// reference voltage in millivolts
-#define GROVEVDIV_VREF 4980
-
-// default ADC resolution
-#define GROVEVDIV_ADC_RES 1024
-
-namespace upm {
- /**
- * @brief Grove Voltage Divider Sensor library
- * @defgroup grovevdiv libupm-grovevdiv
- * @ingroup seeed analog electric robok
- */
-
- /**
- * @library grovevdiv
- * @sensor grovevdiv
- * @comname Grove Voltage Divider
- * @type electric
- * @man seeed
- * @con analog
- * @kit robok
- *
- * @brief API for the Grove Voltage Divider Sensor
- *
- * UPM module for the Grove Voltage Divider sensor
- *
- * @image html grovevdiv.jpg
- * @snippet grovevdiv.cxx Interesting
- */
- class GroveVDiv {
- public:
- /**
- * Grove Voltage Divider sensor constructor
- *
- * @param pin Analog pin to use
- */
- GroveVDiv(int pin);
-
- /**
- * Grove Voltage Divider destructor
- */
- ~GroveVDiv();
-
- /**
- * Gets the conversion value from the sensor
- *
- * @param samples Specifies how many samples to average over
- * @return Average ADC conversion value
- */
- unsigned int value(unsigned int samples);
-
- /**
- * Computes the measured voltage
- *
- * @param gain Gain switch, either 3 or 10 for Grove
- * @param val Measured voltage (from value())
- * @param vref Reference voltage in millivolts
- * @param res ADC resolution
- *
- * @return Measured voltage
- */
- float computedValue(uint8_t gain, unsigned int val, int vref=GROVEVDIV_VREF,
- int res=GROVEVDIV_ADC_RES);
-
- private:
- mraa_aio_context m_aio;
- };
-}
diff --git a/peripheral/libupm/src/grovevdiv/javaupm_grovevdiv.i b/peripheral/libupm/src/grovevdiv/javaupm_grovevdiv.i
deleted file mode 100644
index 1fb23bd..0000000
--- a/peripheral/libupm/src/grovevdiv/javaupm_grovevdiv.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_grovevdiv
-%include "../upm.i"
-
-%{
- #include "grovevdiv.h"
-%}
-
-%include "grovevdiv.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_grovevdiv");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/grovevdiv/jsupm_grovevdiv.i b/peripheral/libupm/src/grovevdiv/jsupm_grovevdiv.i
deleted file mode 100644
index 35c3bd4..0000000
--- a/peripheral/libupm/src/grovevdiv/jsupm_grovevdiv.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_grovevdiv
-%include "../upm.i"
-
-%{
- #include "grovevdiv.h"
-%}
-
-%include "grovevdiv.h"
diff --git a/peripheral/libupm/src/grovevdiv/pyupm_grovevdiv.i b/peripheral/libupm/src/grovevdiv/pyupm_grovevdiv.i
deleted file mode 100644
index 1267a8f..0000000
--- a/peripheral/libupm/src/grovevdiv/pyupm_grovevdiv.i
+++ /dev/null
@@ -1,11 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_grovevdiv
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "grovevdiv.h"
-%{
- #include "grovevdiv.h"
-%}
diff --git a/peripheral/libupm/src/grovewater/CMakeLists.txt b/peripheral/libupm/src/grovewater/CMakeLists.txt
deleted file mode 100644
index 2fa64b1..0000000
--- a/peripheral/libupm/src/grovewater/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "grovewater")
-set (libdescription "upm grove water module")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/grovewater/grovewater.cxx b/peripheral/libupm/src/grovewater/grovewater.cxx
deleted file mode 100644
index 7456df2..0000000
--- a/peripheral/libupm/src/grovewater/grovewater.cxx
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <string>
-#include <stdexcept>
-
-#include "grovewater.h"
-
-using namespace upm;
-using namespace std;
-
-GroveWater::GroveWater(int pin)
-{
- if ( !(m_gpio = mraa_gpio_init(pin)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_gpio_init() failed, invalid pin?");
- return;
- }
-
- mraa_gpio_dir(m_gpio, MRAA_GPIO_IN);
-}
-
-GroveWater::~GroveWater()
-{
- mraa_gpio_close(m_gpio);
-}
-
-bool GroveWater::isWet()
-{
- return (!mraa_gpio_read(m_gpio) ? true : false);
-}
diff --git a/peripheral/libupm/src/grovewater/grovewater.h b/peripheral/libupm/src/grovewater/grovewater.h
deleted file mode 100644
index 50e74b4..0000000
--- a/peripheral/libupm/src/grovewater/grovewater.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include <mraa/gpio.h>
-
-namespace upm {
- /**
- * @brief Grove Water Sensor library
- * @defgroup grovewater libupm-grovewater
- * @ingroup seeed gpio liquid eak
- */
-
- /**
- * @library grovewater
- * @sensor grovewater
- * @comname Grove Water Sensor
- * @type liquid
- * @man seeed
- * @con gpio
- * @kit eak
- *
- * @brief API for the Grove Water Sensor
- *
- * UPM module for the Grove Water sensor
- *
- * @image html grovewater.jpg
- * @snippet grovewater.cxx Interesting
- */
- class GroveWater {
- public:
- /**
- * Grove digital water sensor constructor
- *
- * @param pin Digital pin to use
- */
- GroveWater(int pin);
- /**
- * GroveWater destructor
- */
- ~GroveWater();
- /**
- * Gets the water (wet/not wet) value from the sensor
- *
- * @return True if the sensor is wet, false otherwise
- */
- bool isWet();
-
- private:
- mraa_gpio_context m_gpio;
- };
-}
diff --git a/peripheral/libupm/src/grovewater/javaupm_grovewater.i b/peripheral/libupm/src/grovewater/javaupm_grovewater.i
deleted file mode 100644
index d679c2e..0000000
--- a/peripheral/libupm/src/grovewater/javaupm_grovewater.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_grovewater
-%include "../upm.i"
-
-%{
- #include "grovewater.h"
-%}
-
-%include "grovewater.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_grovewater");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/grovewater/jsupm_grovewater.i b/peripheral/libupm/src/grovewater/jsupm_grovewater.i
deleted file mode 100644
index b1407af..0000000
--- a/peripheral/libupm/src/grovewater/jsupm_grovewater.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_grovewater
-%include "../upm.i"
-
-%{
- #include "grovewater.h"
-%}
-
-%include "grovewater.h"
diff --git a/peripheral/libupm/src/grovewater/pyupm_grovewater.i b/peripheral/libupm/src/grovewater/pyupm_grovewater.i
deleted file mode 100644
index f4218a1..0000000
--- a/peripheral/libupm/src/grovewater/pyupm_grovewater.i
+++ /dev/null
@@ -1,11 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_grovewater
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "grovewater.h"
-%{
- #include "grovewater.h"
-%}
diff --git a/peripheral/libupm/src/grovewfs/CMakeLists.txt b/peripheral/libupm/src/grovewfs/CMakeLists.txt
deleted file mode 100644
index 826a32e..0000000
--- a/peripheral/libupm/src/grovewfs/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "grovewfs")
-set (libdescription "upm grove water flow sensor module")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/grovewfs/grovewfs.cxx b/peripheral/libupm/src/grovewfs/grovewfs.cxx
deleted file mode 100644
index 2eb70ac..0000000
--- a/peripheral/libupm/src/grovewfs/grovewfs.cxx
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <string>
-#include <stdexcept>
-
-#include "grovewfs.h"
-
-using namespace upm;
-using namespace std;
-
-GroveWFS::GroveWFS(int pin)
-{
- if ( !(m_gpio = mraa_gpio_init(pin)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_gpio_init() failed, invalid pin?");
- return;
- }
-
- mraa_gpio_dir(m_gpio, MRAA_GPIO_IN);
-
- initClock();
- m_flowCounter = 0;
- m_isrInstalled = false;
-}
-
-GroveWFS::~GroveWFS()
-{
- if (m_isrInstalled)
- stopFlowCounter();
-
- mraa_gpio_close(m_gpio);
-}
-
-void GroveWFS::initClock()
-{
- gettimeofday(&m_startTime, NULL);
-}
-
-uint32_t GroveWFS::getMillis()
-{
- struct timeval elapsed, now;
- uint32_t elapse;
-
- // get current time
- gettimeofday(&now, NULL);
-
- // compute the delta since m_startTime
- if( (elapsed.tv_usec = now.tv_usec - m_startTime.tv_usec) < 0 )
- {
- elapsed.tv_usec += 1000000;
- elapsed.tv_sec = now.tv_sec - m_startTime.tv_sec - 1;
- }
- else
- {
- elapsed.tv_sec = now.tv_sec - m_startTime.tv_sec;
- }
-
- elapse = (uint32_t)((elapsed.tv_sec * 1000) + (elapsed.tv_usec / 1000));
-
- // never return 0
- if (elapse == 0)
- elapse = 1;
-
- return elapse;
-}
-
-void GroveWFS::startFlowCounter()
-{
- initClock();
- // install our interrupt handler
- mraa_gpio_isr(m_gpio, MRAA_GPIO_EDGE_RISING,
- &flowISR, this);
-
- m_isrInstalled = true;
-}
-
-void GroveWFS::stopFlowCounter()
-{
- // remove the interrupt handler
- mraa_gpio_isr_exit(m_gpio);
-
- m_isrInstalled = false;
-}
-
-void GroveWFS::flowISR(void *ctx)
-{
- upm::GroveWFS *This = (upm::GroveWFS *)ctx;
- This->m_flowCounter++;
-}
-
-float GroveWFS::flowRate()
-{
- uint32_t millis = getMillis();
- uint32_t flow = flowCounter();
-
- // 7.5 comes from the seeedstudio page, see the confusing datasheet :)
- float flowRate = (float(flow) * 7.5) / ((float(millis) / 1000.0) * 60.0);
-
- return flowRate;
-}
diff --git a/peripheral/libupm/src/grovewfs/grovewfs.h b/peripheral/libupm/src/grovewfs/grovewfs.h
deleted file mode 100644
index bec30dc..0000000
--- a/peripheral/libupm/src/grovewfs/grovewfs.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include <stdint.h>
-#include <sys/time.h>
-#include <mraa/gpio.h>
-
-namespace upm {
-
- /**
- * @brief Grove Water Flow Sensor library
- * @defgroup grovewfs libupm-grovewfs
- * @ingroup seeed gpio liquid eak
- */
-
- /**
- * @library grovewfs
- * @sensor grovewfs
- * @comname Grove Water Flow Sensor
- * @type liquid
- * @man seeed
- * @web http://www.seeedstudio.com/wiki/index.php?title=G1/2_Water_Flow_sensor
- * @con gpio
- * @kit eak
-
- * @brief API for the Grove Water Flow Sensor
- *
- * This sensor is used to measure water flow in liters per
- * minute (LPM). It incorporates a Hall Effect sensor. The UPM module
- * defines an interrupt routine to be triggered on each low pulse,
- * keeping count. This device requires a 10K pull-up resistor for
- * the signal line (yellow wire). There is a schematic diagram on
- * the SeeedStudio site (3/2015):
- * http://www.seeedstudio.com/wiki/index.php?title=G1/2_Water_Flow_sensor
- *
- * However, be careful when wiring this up - the schematic appears to
- * have a bug in it: the lower left connection of the signal line
- * (yellow) to Vcc (red) should not be there. The sensor can work
- * with this connection, but probably not for very long.
- *
- * @image html grovewfs.jpg
- * @snippet grovewfs.cxx Interesting
- */
- class GroveWFS {
- public:
- /**
- * Grove Water Flow sensor constructor
- *
- * @param pin Digital pin to use
- */
- GroveWFS(int pin);
- /**
- * GroveWFS destructor
- */
- ~GroveWFS();
- /**
- * Returns the number of milliseconds elapsed since initClock()
- * was last called.
- *
- * @return Elapsed milliseconds
- */
- uint32_t getMillis();
-
- /**
- * Resets the clock
- *
- */
- void initClock();
-
- /**
- * Resets the flow counter to 0. The flow counter should be
- * stopped via stopFlowCounter() prior to calling this function.
- *
- */
- void clearFlowCounter() { m_flowCounter = 0; };
-
- /**
- * Starts the flow counter
- *
- */
- void startFlowCounter();
-
- /**
- * Stops the flow counter
- *
- */
- void stopFlowCounter();
-
- /**
- * Gets the flow counter
- *
- * @return Flow counter
- */
- uint32_t flowCounter() { return m_flowCounter; };
-
- /**
- * Computes the flow rate in liters per minute (LPM)
- *
- * @return Computed flow rate
- */
- float flowRate();
-
- private:
- /**
- * Flow interrupt service routine (ISR)
- *
- */
- static void flowISR(void *ctx);
-
- volatile uint32_t m_flowCounter;
- struct timeval m_startTime;
- mraa_gpio_context m_gpio;
- bool m_isrInstalled;
- };
-}
-
-
diff --git a/peripheral/libupm/src/grovewfs/javaupm_grovewfs.i b/peripheral/libupm/src/grovewfs/javaupm_grovewfs.i
deleted file mode 100644
index 7e650ac..0000000
--- a/peripheral/libupm/src/grovewfs/javaupm_grovewfs.i
+++ /dev/null
@@ -1,21 +0,0 @@
-%module javaupm_grovewfs
-%include "../upm.i"
-
-%ignore flowISR;
-
-%{
- #include "grovewfs.h"
-%}
-
-%include "grovewfs.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_grovewfs");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/grovewfs/jsupm_grovewfs.i b/peripheral/libupm/src/grovewfs/jsupm_grovewfs.i
deleted file mode 100644
index d85d64d..0000000
--- a/peripheral/libupm/src/grovewfs/jsupm_grovewfs.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_grovewfs
-%include "../upm.i"
-
-%{
- #include "grovewfs.h"
-%}
-
-%include "grovewfs.h"
diff --git a/peripheral/libupm/src/grovewfs/pyupm_grovewfs.i b/peripheral/libupm/src/grovewfs/pyupm_grovewfs.i
deleted file mode 100644
index 7dd71ff..0000000
--- a/peripheral/libupm/src/grovewfs/pyupm_grovewfs.i
+++ /dev/null
@@ -1,11 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_grovewfs
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "grovewfs.h"
-%{
- #include "grovewfs.h"
-%}
diff --git a/peripheral/libupm/src/guvas12d/CMakeLists.txt b/peripheral/libupm/src/guvas12d/CMakeLists.txt
deleted file mode 100644
index 3485e0e..0000000
--- a/peripheral/libupm/src/guvas12d/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "guvas12d")
-set (libdescription "upm guvas12d UV sensor module")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/guvas12d/guvas12d.cxx b/peripheral/libupm/src/guvas12d/guvas12d.cxx
deleted file mode 100644
index 7b30e1f..0000000
--- a/peripheral/libupm/src/guvas12d/guvas12d.cxx
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <string>
-#include <stdexcept>
-
-#include "guvas12d.h"
-
-using namespace upm;
-using namespace std;
-
-GUVAS12D::GUVAS12D(int pin)
-{
- if ( !(m_aio = mraa_aio_init(pin)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_aio_init() failed, invalid pin?");
- return;
- }
-}
-
-GUVAS12D::~GUVAS12D()
-{
- mraa_aio_close(m_aio);
-}
-
-float GUVAS12D::value(float aref, unsigned int samples)
-{
- int val;
- unsigned long sum = 0;
-
- for (int i=0; i<samples; i++)
- {
- val = mraa_aio_read(m_aio);
- sum += val;
- usleep(2000);
- }
-
- sum = sum / samples;
- float volts = (float)sum * aref / 1024.0;
-
- return volts;
-}
diff --git a/peripheral/libupm/src/guvas12d/guvas12d.h b/peripheral/libupm/src/guvas12d/guvas12d.h
deleted file mode 100644
index 9ca2f5c..0000000
--- a/peripheral/libupm/src/guvas12d/guvas12d.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include <mraa/aio.h>
-
-namespace upm {
- /**
- * @brief GUVA-S12D UV sensor library
- * @defgroup guvas12d libupm-guvas12d
- * @ingroup seeed analog light eak
- */
-
- /**
- * @library guvas12d
- * @sensor guvas12d
- * @comname Grove UV Sensor
- * @altname GUVA-S12D UV Sensor
- * @type light
- * @man seeed
- * @con analog
- * @kit eak
- *
- * @brief API for the GUVA-S12D UV Sensor
- *
- * UPM module for the GUVA-S12D UV sensor
- *
- * @image html guvas12d.jpg
- * @snippet guvas12d.cxx Interesting
- */
- class GUVAS12D {
- public:
- /**
- * GUVA-S12D UV sensor constructor
- *
- * @param pin Analog pin to use
- */
- GUVAS12D(int pin);
- /**
- * GUVAS12D destructor
- */
- ~GUVAS12D();
- /**
- * Gets the average voltage value from the sensor
- *
- * @param aref Reference voltage in use (usually 5.0 V or 3.3 V)
- * @param samples Number of samples to average over
- * @return Average voltage reading
- */
- float value(float aref, unsigned int samples);
-
- private:
- mraa_aio_context m_aio;
- };
-}
diff --git a/peripheral/libupm/src/guvas12d/javaupm_guvas12d.i b/peripheral/libupm/src/guvas12d/javaupm_guvas12d.i
deleted file mode 100644
index 1b7af28..0000000
--- a/peripheral/libupm/src/guvas12d/javaupm_guvas12d.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_guvas12d
-%include "../upm.i"
-
-%{
- #include "guvas12d.h"
-%}
-
-%include "guvas12d.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_guvas12d");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/guvas12d/jsupm_guvas12d.i b/peripheral/libupm/src/guvas12d/jsupm_guvas12d.i
deleted file mode 100644
index 9660754..0000000
--- a/peripheral/libupm/src/guvas12d/jsupm_guvas12d.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_guvas12d
-%include "../upm.i"
-
-%{
- #include "guvas12d.h"
-%}
-
-%include "guvas12d.h"
diff --git a/peripheral/libupm/src/guvas12d/pyupm_guvas12d.i b/peripheral/libupm/src/guvas12d/pyupm_guvas12d.i
deleted file mode 100644
index 715b533..0000000
--- a/peripheral/libupm/src/guvas12d/pyupm_guvas12d.i
+++ /dev/null
@@ -1,11 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_guvas12d
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "guvas12d.h"
-%{
- #include "guvas12d.h"
-%}
diff --git a/peripheral/libupm/src/h3lis331dl/CMakeLists.txt b/peripheral/libupm/src/h3lis331dl/CMakeLists.txt
deleted file mode 100644
index cec9f55..0000000
--- a/peripheral/libupm/src/h3lis331dl/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "h3lis331dl")
-set (libdescription "upm h3lis331dl I2c Accelerometer (400g)")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/h3lis331dl/h3lis331dl.cxx b/peripheral/libupm/src/h3lis331dl/h3lis331dl.cxx
deleted file mode 100644
index e726f2a..0000000
--- a/peripheral/libupm/src/h3lis331dl/h3lis331dl.cxx
+++ /dev/null
@@ -1,624 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <math.h>
-#include <iostream>
-#include <stdexcept>
-#include <string>
-
-#include "h3lis331dl.h"
-
-using namespace upm;
-using namespace std;
-
-
-H3LIS331DL::H3LIS331DL(int bus, uint8_t address):
- m_i2c(bus)
-{
- m_addr = address;
-
- mraa::Result rv;
- if ( (rv = m_i2c.address(m_addr)) != mraa::SUCCESS)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": I2c.address() failed");
- return;
- }
-
- m_rawX = m_rawY = m_rawZ = 0;
- setAdjustmentOffsets(0, 0, 0);
-}
-
-H3LIS331DL::~H3LIS331DL()
-{
-}
-
-bool H3LIS331DL::init(DR_BITS_T odr, PM_BITS_T pm, FS_BITS_T fs)
-{
- if (!setDataRate(odr)) {
- return false;
- }
- if (!setPowerMode(pm)) {
- return false;
- }
- if (!setFullScale(fs)) {
- return false;
- }
-
- // now enable X, Y, and Z axes
- if (!enableAxis(REG1_XEN | REG1_YEN | REG1_ZEN)) {
- return false;
- }
-
- return true;
-}
-
-uint8_t H3LIS331DL::getChipID()
-{
- return m_i2c.readReg(REG_WHOAMI);
-}
-
-bool H3LIS331DL::setDataRate(DR_BITS_T odr)
-{
- uint8_t reg1 = m_i2c.readReg(REG_REG1);
-
- reg1 &= ~(REG1_DR0 | REG1_DR1);
- reg1 |= (odr << REG1_DR_SHIFT);
-
- if (m_i2c.writeReg(REG_REG1, reg1))
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": I2c.writeReg() failed");
- return false;
- }
-
- return true;
-}
-
-bool H3LIS331DL::setPowerMode(PM_BITS_T pm)
-{
- uint8_t reg1 = m_i2c.readReg(REG_REG1);
-
- reg1 &= ~(REG1_PM0 | REG1_PM1 | REG1_PM2);
- reg1 |= (pm << REG1_PM_SHIFT);
-
- if (m_i2c.writeReg(REG_REG1, reg1))
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": I2c.writeReg() failed");
- return false;
- }
-
- return true;
-}
-
-bool H3LIS331DL::enableAxis(uint8_t axisEnable)
-{
- uint8_t reg1 = m_i2c.readReg(REG_REG1);
-
- reg1 &= ~(REG1_XEN | REG1_YEN | REG1_ZEN);
- reg1 |= (axisEnable & (REG1_XEN | REG1_YEN | REG1_ZEN));
-
- if (m_i2c.writeReg(REG_REG1, reg1))
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": I2c.writeReg() failed");
- return false;
- }
-
- return true;
-}
-
-bool H3LIS331DL::setFullScale(FS_BITS_T fs)
-{
- uint8_t reg4 = m_i2c.readReg(REG_REG4);
-
- reg4 &= ~(REG4_FS0 | REG4_FS1);
- reg4 |= (fs << REG4_FS_SHIFT);
-
- if (m_i2c.writeReg(REG_REG4, reg4))
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": I2c.writeReg() failed");
- return false;
- }
-
- return true;
-}
-
-bool H3LIS331DL::setHPCF(HPCF_BITS_T val)
-{
- uint8_t reg = m_i2c.readReg(REG_REG2);
-
- reg &= ~(REG2_HPCF0 | REG2_HPCF1);
- reg |= (val << REG2_HPCF_SHIFT);
-
- if (m_i2c.writeReg(REG_REG2, reg))
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": I2c.writeReg() failed");
- return false;
- }
-
- return true;
-}
-
-bool H3LIS331DL::setHPM(HPM_BITS_T val)
-{
- uint8_t reg = m_i2c.readReg(REG_REG2);
-
- reg &= ~(REG2_HPM0 | REG2_HPM1);
- reg |= (val << REG2_HPM_SHIFT);
-
- if (m_i2c.writeReg(REG_REG2, reg))
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": I2c.writeReg() failed");
- return false;
- }
-
- return true;
-}
-
-bool H3LIS331DL::boot()
-{
- uint8_t reg = m_i2c.readReg(REG_REG2);
-
- reg |= REG2_BOOT;
-
- if (m_i2c.writeReg(REG_REG2, reg))
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": I2c.writeReg() failed");
- return false;
- }
-
- // wait for the boot bit to clear
- do {
- reg = m_i2c.readReg(REG_REG2);
- usleep(200000);
- } while (reg & REG2_BOOT);
-
- return true;
-}
-
-bool H3LIS331DL::enableHPF1(bool enable)
-{
- uint8_t reg = m_i2c.readReg(REG_REG2);
-
- if (enable)
- reg |= REG2_HPEN1;
- else
- reg &= ~REG2_HPEN1;
-
- if (m_i2c.writeReg(REG_REG2, reg))
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": I2c.writeReg() failed");
- return false;
- }
-
- return true;
-}
-
-bool H3LIS331DL::enableHPF2(bool enable)
-{
- uint8_t reg = m_i2c.readReg(REG_REG2);
-
- if (enable)
- reg |= REG2_HPEN2;
- else
- reg &= ~REG2_HPEN2;
-
- if (m_i2c.writeReg(REG_REG2, reg))
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": I2c.writeReg() failed");
- return false;
- }
-
- return true;
-}
-
-bool H3LIS331DL::enableFDS(bool enable)
-{
- uint8_t reg = m_i2c.readReg(REG_REG2);
-
- if (enable)
- reg |= REG2_FDS;
- else
- reg &= ~REG2_FDS;
-
- if (m_i2c.writeReg(REG_REG2, reg))
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": I2c.writeReg() failed");
- return false;
- }
-
- return true;
-}
-
-bool H3LIS331DL::setInterruptActiveLow(bool enable)
-{
- uint8_t reg = m_i2c.readReg(REG_REG3);
-
- if (enable)
- reg |= REG3_IHL;
- else
- reg &= ~REG3_IHL;
-
- if (m_i2c.writeReg(REG_REG3, reg))
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": I2c.writeReg() failed");
- return false;
- }
-
- return true;
-}
-
-bool H3LIS331DL::setInterruptOpenDrain(bool enable)
-{
- uint8_t reg = m_i2c.readReg(REG_REG3);
-
- if (enable)
- reg |= REG3_PP_OD;
- else
- reg &= ~REG3_PP_OD;
-
- if (m_i2c.writeReg(REG_REG3, reg))
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": I2c.writeReg() failed");
- return false;
- }
-
- return true;
-}
-
-bool H3LIS331DL::setInterrupt1Latch(bool enable)
-{
- uint8_t reg = m_i2c.readReg(REG_REG3);
-
- if (enable)
- reg |= REG3_LIR1;
- else
- reg &= ~REG3_LIR1;
-
- if (m_i2c.writeReg(REG_REG3, reg))
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": I2c.writeReg() failed");
- return false;
- }
-
- return true;
-}
-
-bool H3LIS331DL::setInterrupt2Latch(bool enable)
-{
- uint8_t reg = m_i2c.readReg(REG_REG3);
-
- if (enable)
- reg |= REG3_LIR2;
- else
- reg &= ~REG3_LIR2;
-
- if (m_i2c.writeReg(REG_REG3, reg))
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": I2c.writeReg() failed");
- return false;
- }
-
- return true;
-}
-
-bool H3LIS331DL::setInterrupt1PadConfig(I_CFG_BITS_T val)
-{
- uint8_t reg = m_i2c.readReg(REG_REG3);
-
- reg &= ~(REG3_I1_CFG0 | REG3_I1_CFG1);
- reg |= (val << REG3_I1_CFG_SHIFT);
-
- if (m_i2c.writeReg(REG_REG3, reg))
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": I2c.writeReg() failed");
- return false;
- }
-
- return true;
-}
-
-bool H3LIS331DL::setInterrupt2PadConfig(I_CFG_BITS_T val)
-{
- uint8_t reg = m_i2c.readReg(REG_REG3);
-
- reg &= ~(REG3_I2_CFG0 | REG3_I2_CFG1);
- reg |= (val << REG3_I2_CFG_SHIFT);
-
- if (m_i2c.writeReg(REG_REG3, reg))
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": I2c.writeReg() failed");
- return false;
- }
-
- return true;
-}
-
-
-bool H3LIS331DL::enableBDU(bool enable)
-{
- uint8_t reg = m_i2c.readReg(REG_REG4);
-
- if (enable)
- reg |= REG4_BDU;
- else
- reg &= ~REG4_BDU;
-
- if (m_i2c.writeReg(REG_REG4, reg))
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": I2c.writeReg() failed");
- return false;
- }
-
- return true;
-}
-
-bool H3LIS331DL::enableBLE(bool enable)
-{
- uint8_t reg = m_i2c.readReg(REG_REG4);
-
- if (enable)
- reg |= REG4_BLE;
- else
- reg &= ~REG4_BLE;
-
- if (m_i2c.writeReg(REG_REG4, reg))
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": I2c.writeReg() failed");
- return false;
- }
-
- return true;
-}
-
-bool H3LIS331DL::enableSleepToWake(bool enable)
-{
- uint8_t reg = m_i2c.readReg(REG_REG5);
-
- if (enable)
- reg |= (REG5_TURNON0 | REG5_TURNON1);
- else
- reg &= ~(REG5_TURNON0 | REG5_TURNON1);
-
- if (m_i2c.writeReg(REG_REG5, reg))
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": I2c.writeReg() failed");
- return false;
- }
-
- return true;
-}
-
-uint8_t H3LIS331DL::getStatus()
-{
- return m_i2c.readReg(REG_STATUS);
-}
-
-bool H3LIS331DL::setInterrupt1Config(uint8_t val)
-{
- uint8_t reg = m_i2c.readReg(REG_INT1_CFG);
-
- // mask off reserved bit
- reg = (val & ~0x40);
-
- if (m_i2c.writeReg(REG_INT1_CFG, reg))
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": I2c.writeReg() failed");
- return false;
- }
-
- return true;
-}
-
-bool H3LIS331DL::setInterrupt1Source(uint8_t val)
-{
- uint8_t reg = m_i2c.readReg(REG_INT1_SRC);
-
- // mask off reserved bit
- reg = (val & ~0x80);
-
- if (m_i2c.writeReg(REG_INT1_SRC, reg))
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": I2c.writeReg() failed");
- return false;
- }
-
- return true;
-}
-
-bool H3LIS331DL::setInterrupt1Threshold(uint8_t val)
-{
- if (m_i2c.writeReg(REG_INT1_THS, val))
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": I2c.writeReg() failed");
- return false;
- }
-
- return true;
-}
-
-bool H3LIS331DL::setInterrupt1Duration(uint8_t val)
-{
- if (m_i2c.writeReg(REG_INT1_DUR, val))
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": I2c.writeReg() failed");
- return false;
- }
-
- return true;
-}
-
-bool H3LIS331DL::setInterrupt2Config(uint8_t val)
-{
- uint8_t reg = m_i2c.readReg(REG_INT2_CFG);
-
- // mask off reserved bit
- reg = (val & ~0x40);
-
- if (m_i2c.writeReg(REG_INT2_CFG, reg))
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": I2c.writeReg() failed");
- return false;
- }
-
- return true;
-}
-
-bool H3LIS331DL::setInterrupt2Source(uint8_t val)
-{
- uint8_t reg = m_i2c.readReg(REG_INT2_SRC);
-
- // mask off reserved bit
- reg = (val & ~0x80);
-
- if (m_i2c.writeReg(REG_INT2_SRC, reg))
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": I2c.writeReg() failed");
- return false;
- }
-
- return true;
-}
-
-bool H3LIS331DL::setInterrupt2Threshold(uint8_t val)
-{
- if (m_i2c.writeReg(REG_INT2_THS, val))
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": I2c.writeReg() failed");
- return false;
- }
-
- return true;
-}
-
-bool H3LIS331DL::setInterrupt2Duration(uint8_t val)
-{
- if (m_i2c.writeReg(REG_INT2_DUR, val))
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": I2c.writeReg() failed");
- return false;
- }
-
- return true;
-}
-
-void H3LIS331DL::update()
-{
- uint8_t low, high;
-
- // X
- low = m_i2c.readReg(REG_OUT_X_L);
- high = m_i2c.readReg(REG_OUT_X_H);
- m_rawX = ((high << 8) | low);
-
- // Y
- low = m_i2c.readReg(REG_OUT_Y_L);
- high = m_i2c.readReg(REG_OUT_Y_H);
- m_rawY = ((high << 8) | low);
-
- // Z
- low = m_i2c.readReg(REG_OUT_Z_L);
- high = m_i2c.readReg(REG_OUT_Z_H);
- m_rawZ = ((high << 8) | low);
-}
-
-void H3LIS331DL::setAdjustmentOffsets(int adjX, int adjY, int adjZ)
-{
- m_adjX = adjX;
- m_adjY = adjY;
- m_adjZ = adjZ;
-}
-
-void H3LIS331DL::getAcceleration(float *aX, float *aY, float *aZ)
-{
- const float gains = 0.003; // Seeed magic number?
-
- *aX = float(m_rawX - m_adjX) * gains;
- *aY = float(m_rawY - m_adjY) * gains;
- *aZ = float(m_rawZ - m_adjZ) * gains;
-}
-
-void H3LIS331DL::getRawXYZ(int *x, int *y, int*z)
-{
- *x = m_rawX;
- *y = m_rawY;
- *z = m_rawZ;
-}
-
-void H3LIS331DL::getXYZ(int *x, int *y, int*z)
-{
- *x = (m_rawX - m_adjX);
- *y = (m_rawY - m_adjY);
- *z = (m_rawZ - m_adjZ);
-}
-
-#ifdef SWIGJAVA
-float *H3LIS331DL::getAcceleration()
-{
- float *v = new float[3];
- getAcceleration(&v[0], &v[1], &v[2]);
- return v;
-}
-
-int *H3LIS331DL::getRawXYZ()
-{
- int *v = new int[3];
- getRawXYZ(&v[0], &v[1], &v[2]);
- return v;
-}
-
-int *H3LIS331DL::getXYZ()
-{
- int *v = new int[3];
- getXYZ(&v[0], &v[1], &v[2]);
- return v;
-}
-#endif
diff --git a/peripheral/libupm/src/h3lis331dl/h3lis331dl.h b/peripheral/libupm/src/h3lis331dl/h3lis331dl.h
deleted file mode 100644
index 90b8a02..0000000
--- a/peripheral/libupm/src/h3lis331dl/h3lis331dl.h
+++ /dev/null
@@ -1,640 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include <mraa/common.hpp>
-#include <mraa/i2c.hpp>
-
-#define H3LIS331DL_I2C_BUS 0
-#define H3LIS331DL_DEFAULT_I2C_ADDR 0x18
-
-namespace upm {
-
- /**
- * @brief H3LIS331DL I2C Accelerometer (400g) library
- * @defgroup h3lis331dl libupm-h3lis331dl
- * @ingroup seeed i2c accelerometer
- */
-
- /**
- * @library h3lis331dl
- * @sensor h3lis331dl
- * @comname H3LIS331DL 3-Axis Digital Accelerometer
- * @altname Grove 3-Axis Digital Accelerometer (400g)
- * @type accelerometer
- * @man seeed
- * @web http://www.seeedstudio.com/depot/Grove-3Axis-Digital-Accelerometer400g-p-1897.html
- * @con i2c
- *
- * @brief API for the H3LIS331DL-based Grove 3-Axis Digital Accelerometer (400g)
- *
- * This is a high-performance, high-range accelerometer for extreme applications.
- *
- * @image html h3lis331dl.jpg
- * @snippet h3lis331dl.cxx Interesting
- */
- class H3LIS331DL {
- public:
-
- /**
- * H3LIS331DL registers
- */
- typedef enum {
- // Reserved bytes must not be written into as they contain
- // factory calibration data. Changing those values may lead to
- // improper functioning of the device.
-
- // 0x00-0x0E reserved
-
- REG_WHOAMI = 0x0f,
-
- // 0x10-0x1f reserved
-
- REG_REG1 = 0x20,
- REG_REG2 = 0x21,
- REG_REG3 = 0x22,
- REG_REG4 = 0x23,
- REG_REG5 = 0x24,
-
- REG_HP_FILTER_RESET = 0x25,
- REG_REFERENCE = 0x26,
-
- REG_STATUS = 0x27,
-
- REG_OUT_X_L = 0x28,
- REG_OUT_X_H = 0x29,
- REG_OUT_Y_L = 0x2a,
- REG_OUT_Y_H = 0x2b,
- REG_OUT_Z_L = 0x2c,
- REG_OUT_Z_H = 0x2d,
-
- // 0x2e, 0x2f reserved
-
- REG_INT1_CFG = 0x30,
- REG_INT1_SRC = 0x31,
- REG_INT1_THS = 0x32,
- REG_INT1_DUR = 0x33,
-
- REG_INT2_CFG = 0x34,
- REG_INT2_SRC = 0x35,
- REG_INT2_THS = 0x36,
- REG_INT2_DUR = 0x37,
-
- // 0x38-0x3f reserved
- } H3LIS331DL_REG_T;
-
- /**
- * REG1 bits
- */
- typedef enum {
- REG1_XEN = 0x01, // X-axis enable
- REG1_YEN = 0x02,
- REG1_ZEN = 0x04,
-
- REG1_DR0 = 0x08, // data rate
- REG1_DR1 = 0x10,
- REG1_DR_SHIFT = 3, // DR shift
-
- REG1_PM0 = 0x20, // power mode
- REG1_PM1 = 0x40,
- REG1_PM2 = 0x80,
- REG1_PM_SHIFT = 5
- } REG1_BITS_T;
-
- /**
- * REG1 DR (output rate) bits
- */
- typedef enum {
- DR_50_37 = 0x0, // 50Hz output with 37Hz LPF cutoff
- DR_100_74 = 0x1,
- DR_400_292 = 0x2,
- DR_1000_780 = 0x3
- } DR_BITS_T;
-
- /**
- * REG1 PM (power mode) bits
- */
- typedef enum {
- PM_POWERDWN = 0x0,
- PM_NORMAL = 0x1,
- PM_LP05 = 0x2, // .5 updates/sec
- PM_LP1 = 0x3, // 1 update/sec
- PM_LP2 = 0x4,
- PM_LP5 = 0x5,
- PM_LP10 = 0x6
- } PM_BITS_T;
-
- /**
- * REG2 bits
- */
- typedef enum {
- REG2_HPCF0 = 0x01,
- REG2_HPCF1 = 0x02,
- REG2_HPCF_SHIFT = 0,
-
- REG2_HPEN1 = 0x04,
- REG2_HPEN2 = 0x08,
- REG2_FDS = 0x10,
-
- REG2_HPM0 = 0x20,
- REG2_HPM1 = 0x40,
- REG2_HPM_SHIFT = 5,
-
- REG2_BOOT = 0x80
- } REG2_BITS_T;
-
- /**
- * REG2 HPCF (high-pass cutoff frequency) bits
- */
- typedef enum {
- HPCF_8 = 0x0,
- HPCF_16 = 0x1,
- HPCF_32 = 0x2,
- HPCF_64 = 0x3,
- } HPCF_BITS_T;
-
- /**
- * REG2 HPM (high-pass filter mode) bits
- */
- typedef enum {
- HPM_NORMAL0 = 0x0,
- HPM_REF = 0x1,
- HPM_NORMAL1 = 0x2
- } HPM_BITS_T;
-
- /**
- * REG3 bits
- */
- typedef enum {
- REG3_I1_CFG0 = 0x01,
- REG3_I1_CFG1 = 0x02,
- REG3_I1_CFG_SHIFT = 0,
-
- REG3_LIR1 = 0x04,
-
- REG3_I2_CFG0 = 0x08,
- REG3_I2_CFG1 = 0x10,
- REG3_I2_CFG_SHIFT = 3,
-
- REG3_LIR2 = 0x20,
- REG3_PP_OD = 0x40,
- REG3_IHL = 0x80
- } REG3_BITS_T;
-
- /**
- * REG3 I1/I2 PAD control bits
- */
- typedef enum {
- I_SRC = 0x0, // INT source
- I_OR = 0x1, // INT1 OR INT2 source
- I_DR = 0x2, // Data Ready
- I_BOOTING = 0x3 // Boot is running
- } I_CFG_BITS_T;
-
- /**
- * REG4 bits
- */
- typedef enum {
- REG4_SIM = 0x01, // SPI 4 or 3 wire
-
- // bits 01,02,04 reserved
-
- REG4_FS0 = 0x10,
- REG4_FS1 = 0x20,
- REG4_FS_SHIFT = 4,
-
- REG4_BLE = 0x40, // big/little-endian
- REG4_BDU = 0x80 // Block data update
- } REG4_BITS_T;
-
- /**
- * REG4 FS (full scale) bits
- */
- typedef enum {
- FS_100 = 0x0, // 100g scale
- FS_200 = 0x1, // 200g scale
- FS_400 = 0x3 // 400g scale
- } FS_BITS_T;
-
- /**
- * REG5 TURNON (sleep to wake) bits
- */
- typedef enum {
- REG5_TURNON0 = 0x01, // turn-on mode for sleep-to-wake
- REG5_TURNON1 = 0x02
-
- // bits 04-80 reserved
- } REG5_BITS_T;
-
- /**
- * STATUS bits
- */
- typedef enum {
- STATUS_XDA = 0x01, // X data available
- STATUS_YDA = 0x02,
- STATUS_ZDA = 0x04,
- STATUS_ZYXDA = 0x08, // X, Y, and Z data available
- STATUS_XOR = 0x10, // X overrun
- STATUS_YOR = 0x20,
- STATUS_ZOR = 0x40,
- STATUS_ZYXOR = 0x80 // X, Y, and Z data overrun
- } STATUS_BITS_T;
-
- /**
- * INT1/INT2 CFG bits
- */
- typedef enum {
- INT_CFG_XLIE = 0x01, // enable intr on low X event
- INT_CFG_XHIE = 0x02, // enable intr on high X event
- INT_CFG_YLIE = 0x04,
- INT_CFG_YHIE = 0x08,
- INT_CFG_ZLIE = 0x10,
- INT_CFG_ZHIE = 0x20,
- // 0x40 reserved
- INT_CFG_AOI = 0x80 // AND or OR combination or intrs
- } INT_CFG_BITS_T;
-
- /**
- * INT1/INT2 SRC bits
- */
- typedef enum {
- INT_SRC_XL = 0x01, // X low intr event
- INT_SRC_XH = 0x02, // X high intr event
- INT_SRC_YL = 0x04,
- INT_SRC_YH = 0x08,
- INT_SRC_ZL = 0x10,
- INT_SRC_ZH = 0x20,
- INT_SRC_IA = 0x40 // Interrupt generated (active)
- // 0x80 reserved
- } INT_SRC_BITS_T;
-
- /**
- * H3LIS331DL constructor
- *
- * @param bus I2C bus to use
- * @param address Address for this device
- */
- H3LIS331DL(int bus, uint8_t address = H3LIS331DL_DEFAULT_I2C_ADDR);
-
- /**
- * H3LIS331DL destructor
- */
- ~H3LIS331DL();
-
- /**
- * Sets up initial values and starts operation
- *
- * @param odr Data rate: one of the DR_BITS_T values
- * @param pm Power mode: one of the PM_BITS_T values
- * @param fs FullScale: one of the FS_BITS_T values
- * @return True if successful
- */
- bool init(DR_BITS_T odr=DR_50_37, PM_BITS_T pm=PM_NORMAL,
- FS_BITS_T fs=FS_100);
-
- /**
- * Reads and returns the chip ID (WHO_AM_I register)
- *
- * @return True if successful
- */
- uint8_t getChipID();
-
- /**
- * Sets the output data rate
- *
- * @param One of the DR_BITS_T values
- * @return True if successful
- */
- bool setDataRate(DR_BITS_T odr);
-
- /**
- * Sets the power mode
- *
- * @param One of the PM_BITS_T values
- * @return True if successful
- */
- bool setPowerMode(PM_BITS_T pm);
-
- /**
- * Enables one or more of the 3 axes. The argument is a bitmask
- * composed of REG1_XEN, REG1_YEN, and/or REG1_ZEN corresponding to
- * the axes you want enabled.
- *
- * @param axisEnable Bitmask of axes to enable
- * (REG1_XEN | REG1_YEN | REG1_ZEN)
- * @return True if successful
- */
- bool enableAxis(uint8_t axisEnable);
-
- /**
- * Sets the scaling factor to 100g, 200g, or 400g
- *
- * @param fs One of the FS_BITS_T values
- * @return True if successful
- */
- bool setFullScale(FS_BITS_T fs);
-
- /**
- * Sets a high-pass cutoff filter
- *
- * @param val One of the HPCF_BITS_T values
- * @return True if successful
- */
- bool setHPCF(HPCF_BITS_T val);
-
- /**
- * Sets a high-pass filter mode
- *
- * @param val One of the HPM_BITS_T values
- * @return True if successful
- */
- bool setHPM(HPM_BITS_T val);
-
- /**
- * Boots the device. Booting the device causes internal flash
- * calibration values to be reloaded into the visible registers
- * in case they have been corrupted. This function
- * returns when the booting is complete.
- *
- * @return True if successful
- */
- bool boot();
-
- /**
- * Enables a high-pass filter for interrupt 1 source
- *
- * @param enable True to enable the filter, false otherwise
- * @return True if successful
- */
- bool enableHPF1(bool enable);
-
- /**
- * Enables a high-pass filter for interrupt 2 source
- *
- * @param enable True to enable the filter, false otherwise
- * @return True if successful
- */
- bool enableHPF2(bool enable);
-
- /**
- * Enables filtered data selection
- *
- * @param enable True to enable, false otherwise
- * @return True if successful
- */
- bool enableFDS(bool enable);
-
- /**
- * Sets interrupts to be active low instead of high
- *
- * @param enable True to enable, false otherwise
- * @return True if successful
- */
- bool setInterruptActiveLow(bool enable);
-
- /**
- * Sets an interrupt output mode to open drain rather than push/pull
- *
- * @param enable True to enable, false otherwise
- * @return True if successful
- */
- bool setInterruptOpenDrain(bool enable);
-
- /**
- * Enables interrupt 1 latch
- *
- * @param enable True to enable, false otherwise
- * @return True if successful
- */
- bool setInterrupt1Latch(bool enable);
-
- /**
- * Enables interrupt 2 latch
- *
- * @param enable True to enable, false otherwise
- * @return True if successful
- */
- bool setInterrupt2Latch(bool enable);
-
- /**
- * Sets the interrupt 1 pad configuration
- *
- * @param val One fo the I_CFG_BITS_T values
- * @return True if successful
- */
- bool setInterrupt1PadConfig(I_CFG_BITS_T val);
-
- /**
- * Sets the interrupt 2 pad configuration
- *
- * @param val One fo the I_CFG_BITS_T values
- * @return True if successful
- */
- bool setInterrupt2PadConfig(I_CFG_BITS_T val);
-
- /**
- * Enables block data update. When enabled, low/high output
- * registers are not updated until both low and high values have
- * been read.
- *
- * @param enable True to enable, false otherwise
- * @return True if successful
- */
- bool enableBDU(bool enable);
-
- /**
- * Enables big-endian output for 16b reads
- *
- * @param enable True to enable, false otherwise
- * @return True if successful
- */
- bool enableBLE(bool enable);
-
- /**
- * Enables sleep-to-wake functionality
- *
- * @param enable True to enable, false otherwise
- * @return True if successful
- */
- bool enableSleepToWake(bool enable);
-
- /**
- * Returns the contents of the REG_STATUS register
- *
- * @return Contents of the REG_STATUS register
- */
- uint8_t getStatus();
-
- /**
- * Sets up the interrupt 1 config register
- *
- * @param val Bitmask of desired INT_CFG_BITS_T bits
- * @return True if successful
- */
- bool setInterrupt1Config(uint8_t val);
-
- /**
- * Sets up the interrupt 2 config register
- *
- * @param val Bitmask of desired INT_CFG_BITS_T bits
- * @return True if successful
- */
- bool setInterrupt2Config(uint8_t val);
-
- /**
- * Sets up the interrupt 1 source register
- *
- * @param val Bitmask of desired INT_SRC_BITS_T bits
- * @return True if successful
- */
- bool setInterrupt1Source(uint8_t val);
-
- /**
- * Sets up the interrupt 2 source register
- *
- * @param val Bitmask of desired INT_SRC_BITS_T bits
- * @return True if successful
- */
- bool setInterrupt2Source(uint8_t val);
-
- /**
- * Sets up the interrupt 1 threshold register
- *
- * @param val Threshhold to set
- * @return True if successful
- */
- bool setInterrupt1Threshold(uint8_t val);
-
- /**
- * Sets up the interrupt 2 threshold register
- *
- * @param val Threshhold to set
- * @return True if successful
- */
- bool setInterrupt2Threshold(uint8_t val);
-
- /**
- * Sets up the interrupt 1 duration register
- *
- * @param val Duration to set
- * @return True if successful
- */
- bool setInterrupt1Duration(uint8_t val);
-
- /**
- * Sets up the interrupt 2 duration register
- *
- * @param val Duration to set
- * @return True if successful
- */
- bool setInterrupt2Duration(uint8_t val);
-
- /**
- * Reads the sensor and stores current values internally
- */
- void update();
-
- /**
- * Sets adjustment offsets for each of the axes. This can be used
- * for calibration. The values supplied here are subtracted
- * from the axis data read from the device.
- *
- * @param adjX Amount by which to correct the X-axis measurement
- * @param adjY Amount by which to correct the Y-axis measurement
- * @param adjZ Amount by which to correct the Z-axis measurement
- */
- void setAdjustmentOffsets(int adjX, int adjY, int adjZ);
-
- /**
- * Gets acceleration values for each of the axes
- *
- * @param aX Returned X-axis acceleration
- * @param aY Returned Y-axis acceleration
- * @param aZ Returned Z-axis acceleration
- */
- void getAcceleration(float *aX, float *aY, float *aZ);
-
- /**
- * Gets raw axis values
- *
- * @param x Returned raw X-axis value
- * @param y Returned raw Y-axis value
- * @param z Returned raw Z-axis value
- */
- void getRawXYZ(int *x, int *y, int *z);
-
- /**
- * Gets adjusted axis values
- *
- * @param x Returned X-axis value
- * @param y Returned Y-axis value
- * @param z Returned Z-axis value
- */
- void getXYZ(int *x, int *y, int *z);
-
-#ifdef SWIGJAVA
- /**
- * Gets acceleration values for each of the axes
- *
- * @return Array containing X, Y, Z acceleration values
- */
- float *getAcceleration();
-
- /**
- * Gets raw axis values
- *
- * @return Array containing X, Y, Z raw values
- */
- int *getRawXYZ();
-
- /**
- * Gets adjusted axis values
- *
- * @return Array containing X, Y, Z adjusted axis values
- */
- int *getXYZ();
-#endif
-
-
- /**
- * Provides public access to the MRAA I2C context of the class for
- * direct user access
- *
- * @return Reference to the class I2C context
- */
- mraa::I2c& i2cContext() { return m_i2c; };
-
-
- protected:
- int16_t m_rawX, m_rawY, m_rawZ;
- int16_t m_adjX, m_adjY, m_adjZ;
- mraa::I2c m_i2c;
-
- private:
- uint8_t m_addr;
- };
-}
-
-
diff --git a/peripheral/libupm/src/h3lis331dl/javaupm_h3lis331dl.i b/peripheral/libupm/src/h3lis331dl/javaupm_h3lis331dl.i
deleted file mode 100644
index 812a53d..0000000
--- a/peripheral/libupm/src/h3lis331dl/javaupm_h3lis331dl.i
+++ /dev/null
@@ -1,62 +0,0 @@
-%module javaupm_h3lis331dl
-%include "../upm.i"
-%include "cpointer.i"
-%include "typemaps.i"
-
-%apply int *OUTPUT { int *x, int *y, int*z };
-%apply float *OUTPUT { float *aX, float *aY, float *aZ };
-
-%ignore i2cContext;
-
-%{
- #include "h3lis331dl.h"
-%}
-
-%typemap(jni) float* "jfloatArray"
-%typemap(jstype) float* "float[]"
-%typemap(jtype) float* "float[]"
-
-%typemap(javaout) float* {
- return $jnicall;
-}
-
-%typemap(out) float *getAcceleration {
- $result = JCALL1(NewFloatArray, jenv, 3);
- JCALL4(SetFloatArrayRegion, jenv, $result, 0, 3, $1);
- delete [] $1;
-}
-
-%typemap(jni) int* "jintArray"
-%typemap(jstype) int* "int[]"
-%typemap(jtype) int* "int[]"
-
-%typemap(javaout) int* {
- return $jnicall;
-}
-
-%typemap(out) int *getRawXYZ {
- $result = JCALL1(NewIntArray, jenv, 3);
- JCALL4(SetIntArrayRegion, jenv, $result, 0, 3, (const int*)$1);
-}
-
-%typemap(out) int *getXYZ {
- $result = JCALL1(NewIntArray, jenv, 3);
- JCALL4(SetIntArrayRegion, jenv, $result, 0, 3, (const int*)$1);
-}
-
-%ignore getRawXYZ(int *, int *, int *);
-%ignore getXYZ(int *, int *, int *);
-%ignore getAcceleration(float *, float *, float *);
-
-%include "h3lis331dl.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_h3lis331dl");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/h3lis331dl/jsupm_h3lis331dl.i b/peripheral/libupm/src/h3lis331dl/jsupm_h3lis331dl.i
deleted file mode 100644
index f459bf3..0000000
--- a/peripheral/libupm/src/h3lis331dl/jsupm_h3lis331dl.i
+++ /dev/null
@@ -1,13 +0,0 @@
-%module jsupm_h3lis331dl
-%include "../upm.i"
-%include "cpointer.i"
-
-/* Send "int *" and "float *" to JavaScript as intp and floatp */
-%pointer_functions(int, intp);
-%pointer_functions(float, floatp);
-
-%{
- #include "h3lis331dl.h"
-%}
-
-%include "h3lis331dl.h"
diff --git a/peripheral/libupm/src/h3lis331dl/pyupm_h3lis331dl.i b/peripheral/libupm/src/h3lis331dl/pyupm_h3lis331dl.i
deleted file mode 100644
index 553081e..0000000
--- a/peripheral/libupm/src/h3lis331dl/pyupm_h3lis331dl.i
+++ /dev/null
@@ -1,20 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_h3lis331dl
-%include "../upm.i"
-%include "cpointer.i"
-
-/* Send "int *" and "float *" to python as intp and floatp */
-%pointer_functions(int, intp);
-%pointer_functions(float, floatp);
-
-%feature("autodoc", "3");
-
-#ifdef DOXYGEN
-%include "h3lis331dl_doc.i"
-#endif
-
-%include "h3lis331dl.h"
-%{
- #include "h3lis331dl.h"
-%}
diff --git a/peripheral/libupm/src/hcsr04/CMakeLists.txt b/peripheral/libupm/src/hcsr04/CMakeLists.txt
deleted file mode 100644
index 81e692d..0000000
--- a/peripheral/libupm/src/hcsr04/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "hcsr04")
-set (libdescription "upm proximity sensor")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/hcsr04/hcsr04.cxx b/peripheral/libupm/src/hcsr04/hcsr04.cxx
deleted file mode 100644
index 1a6a49e..0000000
--- a/peripheral/libupm/src/hcsr04/hcsr04.cxx
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Author: Rafael Neri <rafael.neri@gmail.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 <iostream>
-#include <string>
-#include <stdexcept>
-#include <unistd.h>
-#include <stdlib.h>
-#include <functional>
-
-#ifdef JAVACALLBACK
-#undef JAVACALLBACK
-#endif
-
-#include "hcsr04.h"
-
-using namespace upm;
-
-HCSR04::HCSR04 (uint8_t triggerPin, uint8_t echoPin) {
- mraa_result_t error = MRAA_SUCCESS;
- m_name = "HCSR04";
-
- m_triggerPinCtx = mraa_gpio_init (triggerPin);
- if (m_triggerPinCtx == NULL) {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_pwm_init() failed, invalid pin?");
- return;
- }
-
- mraa_gpio_dir(m_triggerPinCtx, MRAA_GPIO_OUT);
- mraa_gpio_write (m_triggerPinCtx, 0);
-
- m_echoPinCtx = mraa_gpio_init(echoPin);
- if (m_echoPinCtx == NULL) {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_gpio_init() failed, invalid pin?");
- return;
- }
-
- mraa_gpio_dir(m_echoPinCtx, MRAA_GPIO_IN);
- mraa_gpio_isr(m_echoPinCtx, MRAA_GPIO_EDGE_BOTH, &ackEdgeDetected, (void*)this);
-}
-
-HCSR04::~HCSR04 () {
- mraa_result_t error = MRAA_SUCCESS;
-
- error = mraa_gpio_close (m_triggerPinCtx);
- if (error != MRAA_SUCCESS) {
- mraa_result_print (error);
- }
-
- error = mraa_gpio_close (m_echoPinCtx);
- if (error != MRAA_SUCCESS) {
- mraa_result_print (error);
- }
-}
-
-double
-HCSR04::timing() {
- mraa_gpio_write (m_triggerPinCtx, 1);
- usleep(10);
- mraa_gpio_write (m_triggerPinCtx, 0);
-
- m_doWork = 0;
- m_InterruptCounter = 0;
- while (!m_doWork) {
- usleep (5);
- }
-
- return m_FallingTimeStamp - m_RisingTimeStamp;
-}
-
-void
-HCSR04::ackEdgeDetected (void *ctx) {
- upm::HCSR04 *This = (upm::HCSR04 *)ctx;
- struct timeval timer;
- gettimeofday(&timer, NULL);
-
- This->m_InterruptCounter++;
- if (!(This->m_InterruptCounter % 2)) {
- This->m_FallingTimeStamp = 1000000 * timer.tv_sec + timer.tv_usec;
- This->m_doWork = 1;
- } else {
- This->m_RisingTimeStamp = 1000000 * timer.tv_sec + timer.tv_usec;
- }
-}
-
-double
-HCSR04::getDistance(int sys)
-{
- double _timing = timing();
- if (sys)
- {
- return (_timing/2) / 29.1;
- } else {
- return (_timing/2) / 74.1;
- }
-}
diff --git a/peripheral/libupm/src/hcsr04/hcsr04.h b/peripheral/libupm/src/hcsr04/hcsr04.h
deleted file mode 100644
index 95721df..0000000
--- a/peripheral/libupm/src/hcsr04/hcsr04.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Author: Rafael Neri <rafael.neri@gmail.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 <string>
-#include <mraa/aio.h>
-#include <mraa/gpio.h>
-#include <mraa/pwm.h>
-#include <sys/time.h>
-
-#define CM 1
-#define INC 0
-
-namespace upm {
-/**
- * @brief HC-SR04 Ultrasonic Sensor library
- * @defgroup hcsr04 libupm-hcsr04
- * @ingroup generic gpio sound
- */
-
-/**
- * @library hcsr04
- * @sensor hcsr04
- * @comname HC-SR04 Ultrasonic Sensor
- * @type sound
- * @man generic
- * @con gpio
- *
- * @brief API for the HC-SR04 Ultrasonic Sensor
- *
- * This module defines the HC-SR04 interface for libhcsr04
- *
- * @image html groveultrasonic.jpg
- * @snippet hcsr04.cxx Interesting
- */
-class HCSR04 {
- public:
- /**
- * Instantiates an HCSR04 object
- *
- * @param triggerPin Pin to trigger the sensor for distance
- * @param echoPin Pulse response to triggering
- * @param fptr Function pointer to handle rising-edge and
- * falling-edge interrupts
- */
- HCSR04 (uint8_t triggerPin, uint8_t echoPin);
- /**
- * HCSR04 object destructor
- */
- ~HCSR04 ();
-
- /**
- * Gets the distance from the sensor
- */
- double getDistance (int sys);
-
-
- uint8_t m_doWork; /**< Flag to control blocking function while waiting for a falling-edge interrupt */
-
- /**
- * Returns the name of the sensor
- */
- std::string name()
- {
- return m_name;
- }
-
- private:
- /**
- * On each interrupt, this function detects if the interrupt
- * was falling-edge or rising-edge.
- */
- static void ackEdgeDetected (void *ctx);
-
- double timing();
- mraa_gpio_context m_triggerPinCtx;
- mraa_gpio_context m_echoPinCtx;
-
- long m_RisingTimeStamp;
- long m_FallingTimeStamp;
- uint8_t m_InterruptCounter;
-
- std::string m_name;
-};
-
-}
diff --git a/peripheral/libupm/src/hcsr04/javaupm_hcsr04.i b/peripheral/libupm/src/hcsr04/javaupm_hcsr04.i
deleted file mode 100644
index 046646b..0000000
--- a/peripheral/libupm/src/hcsr04/javaupm_hcsr04.i
+++ /dev/null
@@ -1,20 +0,0 @@
-%module javaupm_hcsr04
-%include "../upm.i"
-
-%{
- #include "hcsr04.h"
-%}
-
-%include "hcsr04.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_hcsr04");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%}
-
diff --git a/peripheral/libupm/src/hcsr04/jsupm_hcsr04.i b/peripheral/libupm/src/hcsr04/jsupm_hcsr04.i
deleted file mode 100644
index f86bd1b..0000000
--- a/peripheral/libupm/src/hcsr04/jsupm_hcsr04.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_hcsr04
-%include "../upm.i"
-
-%{
- #include "hcsr04.h"
-%}
-
-%include "hcsr04.h"
diff --git a/peripheral/libupm/src/hcsr04/pyupm_hcsr04.i b/peripheral/libupm/src/hcsr04/pyupm_hcsr04.i
deleted file mode 100644
index 56e435b..0000000
--- a/peripheral/libupm/src/hcsr04/pyupm_hcsr04.i
+++ /dev/null
@@ -1,11 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_hcsr04
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "hcsr04.h"
-%{
- #include "hcsr04.h"
-%}
diff --git a/peripheral/libupm/src/hdxxvxta/CMakeLists.txt b/peripheral/libupm/src/hdxxvxta/CMakeLists.txt
deleted file mode 100644
index 9f8244d..0000000
--- a/peripheral/libupm/src/hdxxvxta/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "hdxxvxta")
-set (libdescription "upm Veris HDXXVXTA Temperature/Humidity transmitter")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/hdxxvxta/hdxxvxta.cxx b/peripheral/libupm/src/hdxxvxta/hdxxvxta.cxx
deleted file mode 100644
index 6c25d1b..0000000
--- a/peripheral/libupm/src/hdxxvxta/hdxxvxta.cxx
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2016 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-
-#include "hdxxvxta.h"
-
-using namespace upm;
-using namespace std;
-
-// conversion from celcius to fahrenheit
-
-static float c2f(float c)
-{
- return (c * (9.0 / 5.0) + 32.0);
-}
-
-
-HDXXVXTA::HDXXVXTA(int hPin, int tPin, float aref) :
- m_aioHum(hPin), m_aioTemp(0)
-{
- if (tPin >= 0)
- m_hasTemp = true;
- else
- m_hasTemp = false;
-
- m_temperature = 0.0;
- m_humidity = 0.0;
-
- if (m_hasTemp)
- {
- m_aioTemp = new mraa::Aio(tPin);
- m_aResTemp = (1 << m_aioTemp->getBit());
- }
- else
- m_aResTemp = 0;
-
- m_aResHum = (1 << m_aioHum.getBit());
- m_aref = aref;
-
- // set the default temperature range to the A1 series (-40C-50C),
- // regardless of whether temperature measuring is enabled
- setRange(RANGE_MINUS40_50);
-}
-
-HDXXVXTA::~HDXXVXTA()
-{
- if (m_aioTemp)
- delete m_aioTemp;
-}
-
-void HDXXVXTA::update()
-{
- // temperature
- int val;
- float volts;
-
- if (m_hasTemp)
- {
- val = m_aioTemp->read();
- volts = (float(val) * (m_aref / m_aResTemp));
-
- switch (m_range)
- {
- case RANGE_MINUS40_50:
- // valid range is 50 + abs(-40) = 90
- m_temperature = ((volts / m_aref) * 90.0) - 40.0;
- break;
-
- case RANGE_0_50:
- // valid range is 50
- m_temperature = ((volts / m_aref) * 50.0);
- break;
-
- default:
- // shouldn't happen, but...
- throw std::out_of_range(std::string(__FUNCTION__) +
- ": internal error, invalid range value");
- break;
- }
- }
-
- // humidity
- val = m_aioHum.read();
- volts = (float(val) * (m_aref / m_aResHum));
- m_humidity = ((volts / m_aref) * 100.0);
-}
-
-float HDXXVXTA::getTemperature(bool fahrenheit)
-{
- if (fahrenheit)
- return c2f(m_temperature);
- else
- return m_temperature;
-}
-
-float HDXXVXTA::getHumidity()
-{
- return m_humidity;
-}
-
diff --git a/peripheral/libupm/src/hdxxvxta/hdxxvxta.h b/peripheral/libupm/src/hdxxvxta/hdxxvxta.h
deleted file mode 100644
index a0f5f7a..0000000
--- a/peripheral/libupm/src/hdxxvxta/hdxxvxta.h
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2016 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include <iostream>
-
-#include <mraa/aio.hpp>
-
-// Unlikey to be changable without external circuitry (voltage divider)
-#define HDXXVXTA_DEFAULT_AREF 5.0
-
-namespace upm {
- /**
- * @brief Veris HDXXVXTA Humidity Transmitter
- * @defgroup hdxxvxta libupm-hdxxvxta
- * @ingroup veris ainput temp
- */
-
- /**
- * @library hdxxvxta
- * @sensor hdxxvxta
- * @comname Veris HDXXVXTA Humidity Transmitter family
- * @type temp
- * @man veris
- * @con ainput
- * @web http://www.veris.com/Item/HD2NVSTA1.aspx
- *
- * @brief API for the Veris HDXXVXTA Humidity Transmitter
- *
- * The driver was developed using the HD2NVSTA1 humidity
- * transmitter. The 'T' variant supports a temperature
- * transmitter as well. Both signals are provided by the device
- * as analog 0-5Vdc or 0-10Vdc outputs. The A1 variant supports a
- * temperature range of -40C-50C, while the A2 variant supports a
- * range of 0C-50C. Humidity ranges for all devices in this
- * device family range from 0% to 100% (non-condensing).
- *
- * This driver used the 5Vdc outputs for obvious reasons. Your
- * MCU must be configured for 5V operation. Using any other
- * analog reference voltage will require the appropriate external
- * circuitry (such as a voltage divider) in order to interface
- * safely with your MCU.
- *
- * For devices which do not support temperature, use '-1' as the
- * temperature pin number in the object constructor. If
- * temperature measurement is disabled, getTemperature() will always
- * return 0C/32F.
- *
- * @snippet hdxxvxta.cxx Interesting
- */
-
- class HDXXVXTA {
- public:
-
- typedef enum {
- // *A1 series (-40C-50C)
- RANGE_MINUS40_50 = 1,
- // *A2 series (0C-50C)
- RANGE_0_50 = 2
- } RANGE_T;
-
- /**
- * HDXXVXTA object constructor
- *
- * @param hPin Analog pin to use for the humidity measurement
- * @param tPin Analog pin to use for temperature. If your device
- * does not support temperature, use -1 as the value so that
- * temperature will not be queried and an analog pin won't be
- * wasted.
- * @param aref The analog reference voltage, default 5.0
- */
- HDXXVXTA(int hPin, int tPin, float aref=HDXXVXTA_DEFAULT_AREF);
-
- /**
- * HDXXVXTA object destructor
- */
- ~HDXXVXTA();
-
- /**
- * Set the temperature range of the sensor. HD*A1 sensors support
- * a range of -40C-50C, while HD*A2 devices support a temperature
- * range of 0C-50C. The constructor sets a default of
- * RANGE_MINUS40_50.
- *
- * @param One of the RANGE_T values, default is RANGE_MINUS40_50
- */
- void setRange(RANGE_T range=RANGE_MINUS40_50)
- {
- m_range = range;
- };
-
- /**
- * Read current values from the sensor and update internal stored
- * values. This method must be called prior to querying any
- * values, such as temperature or humidity.
- */
- void update();
-
- /**
- * Get the current temperature. update() must have been called
- * prior to calling this method. If temperature measurement was
- * disabled (by passing -1 as the temperature pin in the
- * constructor) then this function will always return 0C/32F.
- *
- * @param fahrenheit true to return the temperature in degrees
- * fahrenheit, false to return the temperature in degrees celcius.
- * The default is false (degrees Celcius).
- * @return The last temperature reading in Celcius or Fahrenheit
- */
- float getTemperature(bool fahrenheit=false);
-
- /**
- * Get the current relative humidity. update() must have been called
- * prior to calling this method.
- *
- * @return The last humidity reading
- */
- float getHumidity();
-
-
- protected:
- // temperature is an optional feature of the humidity transmitter
- mraa::Aio *m_aioTemp;
-
- mraa::Aio m_aioHum;
-
- private:
- float m_aref;
- int m_aResTemp;
- int m_aResHum;
-
- // does this sensor support temperature reporting?
- bool m_hasTemp;
-
- // in Celcius
- float m_temperature;
-
- float m_humidity;
-
- RANGE_T m_range;
- };
-}
-
-
diff --git a/peripheral/libupm/src/hdxxvxta/javaupm_hdxxvxta.i b/peripheral/libupm/src/hdxxvxta/javaupm_hdxxvxta.i
deleted file mode 100644
index 95c78bf..0000000
--- a/peripheral/libupm/src/hdxxvxta/javaupm_hdxxvxta.i
+++ /dev/null
@@ -1,21 +0,0 @@
-%module javaupm_hdxxvxta
-%include "../upm.i"
-%include "std_string.i"
-
-%{
- #include "hdxxvxta.h"
-%}
-
-%include "hdxxvxta.h"
-
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_hdxxvxta");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%}
diff --git a/peripheral/libupm/src/hdxxvxta/jsupm_hdxxvxta.i b/peripheral/libupm/src/hdxxvxta/jsupm_hdxxvxta.i
deleted file mode 100644
index 8fa283d..0000000
--- a/peripheral/libupm/src/hdxxvxta/jsupm_hdxxvxta.i
+++ /dev/null
@@ -1,10 +0,0 @@
-%module jsupm_hdxxvxta
-%include "../upm.i"
-%include "std_string.i"
-
-%{
- #include "hdxxvxta.h"
-%}
-
-%include "hdxxvxta.h"
-
diff --git a/peripheral/libupm/src/hdxxvxta/pyupm_hdxxvxta.i b/peripheral/libupm/src/hdxxvxta/pyupm_hdxxvxta.i
deleted file mode 100644
index 377deab..0000000
--- a/peripheral/libupm/src/hdxxvxta/pyupm_hdxxvxta.i
+++ /dev/null
@@ -1,13 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_hdxxvxta
-%include "../upm.i"
-%include "std_string.i"
-
-%feature("autodoc", "3");
-
-%{
- #include "hdxxvxta.h"
-%}
-%include "hdxxvxta.h"
-
diff --git a/peripheral/libupm/src/hm11/CMakeLists.txt b/peripheral/libupm/src/hm11/CMakeLists.txt
deleted file mode 100644
index 6e9fb87..0000000
--- a/peripheral/libupm/src/hm11/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "hm11")
-set (libdescription "upm grove hm11 bluetooth low energy module")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/hm11/hm11.cxx b/peripheral/libupm/src/hm11/hm11.cxx
deleted file mode 100644
index 0c6cebc..0000000
--- a/peripheral/libupm/src/hm11/hm11.cxx
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <string>
-#include <stdexcept>
-
-#include "hm11.h"
-
-using namespace upm;
-using namespace std;
-
-static const int defaultDelay = 100; // max wait time for read
-
-HM11::HM11(int uart)
-{
- m_ttyFd = -1;
-
- if ( !(m_uart = mraa_uart_init(uart)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_uart_init() failed");
- return;
- }
-
- // This requires a recent MRAA (1/2015)
- const char *devPath = mraa_uart_get_dev_path(m_uart);
-
- if (!devPath)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": mraa_uart_get_dev_path() failed");
- return;
- }
-
- // now open the tty
- if ( (m_ttyFd = open(devPath, O_RDWR)) == -1)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": open of " +
- string(devPath) + " failed:" +
- string(strerror(errno)));
- return;
- }
-}
-
-HM11::~HM11()
-{
- if (m_ttyFd != -1)
- close(m_ttyFd);
-}
-
-bool HM11::dataAvailable(unsigned int millis)
-{
- if (m_ttyFd == -1)
- return false;
-
- struct timeval timeout;
-
- // no waiting
- timeout.tv_sec = 0;
- timeout.tv_usec = millis * 1000;
-
- int nfds;
- fd_set readfds;
-
- FD_ZERO(&readfds);
-
- FD_SET(m_ttyFd, &readfds);
-
- if (select(m_ttyFd + 1, &readfds, NULL, NULL, &timeout) > 0)
- return true; // data is ready
- else
- return false;
-}
-
-int HM11::readData(char *buffer, int len)
-{
- if (m_ttyFd == -1)
- return(-1);
-
- int rv = read(m_ttyFd, buffer, len);
-
- if (rv < 0)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": read() failed: " +
- string(strerror(errno)));
- return rv;
- }
-
- return rv;
-}
-
-int HM11::writeData(char *buffer, int len)
-{
- if (m_ttyFd == -1)
- return(-1);
-
- // first, flush any pending but unread input
-
- tcflush(m_ttyFd, TCIFLUSH);
-
- int rv = write(m_ttyFd, buffer, len);
-
- if (rv < 0)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": write() failed: " +
- string(strerror(errno)));
- return rv;
- }
-
- tcdrain(m_ttyFd);
-
- return rv;
-}
-
-bool HM11::setupTty(speed_t baud)
-{
- if (m_ttyFd == -1)
- return(false);
-
- struct termios termio;
-
- // get current modes
- tcgetattr(m_ttyFd, &termio);
-
- // setup for a 'raw' mode. 81N, no echo or special character
- // handling, such as flow control.
- cfmakeraw(&termio);
-
- // set our baud rates
- cfsetispeed(&termio, baud);
- cfsetospeed(&termio, baud);
-
- // make it so
- if (tcsetattr(m_ttyFd, TCSAFLUSH, &termio) < 0)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": tcsetattr() failed: " +
- string(strerror(errno)));
- return false;
- }
-
- return true;
-}
-
diff --git a/peripheral/libupm/src/hm11/hm11.h b/peripheral/libupm/src/hm11/hm11.h
deleted file mode 100644
index 29e4319..0000000
--- a/peripheral/libupm/src/hm11/hm11.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Thanks to Adafruit for supplying a google translated version of the
- * Chinese datasheet and some clues in their code.
- *
- * 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 <string>
-#include <iostream>
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <termios.h>
-#include <sys/time.h>
-#include <sys/select.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include <mraa/uart.h>
-
-#define HM11_DEFAULT_UART 0
-
-namespace upm {
- /**
- * @brief HM-11 Bluetooth 4.0 Low Energy Module library
- * @defgroup hm11 libupm-hm11
- * @ingroup seeed uart wifi
- */
-
- /**
- * @library hm11
- * @sensor hm11
- * @comname HM-11 Bluetooth Low Energy
- * @altname Grove BLE
- * @altid HM-10, HM-12
- * @type wifi
- * @man seeed
- * @con uart
- * @web http://www.seeedstudio.com/wiki/images/c/cd/Bluetooth4_en.pdf
- *
- * @brief API for the HM-11 4.0 Bluetooth Low Energy Module
- *
- * The driver was tested with the Grove BLE module. It's an HM-11
- * BLE 4.0 module based on a TI CC2541 chip. It operates using a
- * standard 'AT' command set. See the datasheet for a full list
- * of available commands and their possible responses:
- *
- * http://www.seeedstudio.com/wiki/images/c/cd/Bluetooth4_en.pdf
- *
- * It is connected via a UART at 9,600 baud.
- *
- * @image html hm11.jpg
- * @snippet hm11.cxx Interesting
- */
-
- class HM11 {
- public:
-
- /**
- * HM11 object constructor
- *
- * @param uart Default UART to use (0 or 1)
- */
- HM11(int uart);
-
- /**
- * HM11 object destructor
- */
- ~HM11();
-
- /**
- * Checks to see if there is data available for reading
- *
- * @param millis Number of milliseconds to wait; 0 means no waiting
- * @return True if there is data available for reading
- */
- bool dataAvailable(unsigned int millis);
-
- /**
- * Reads any available data into a user-supplied buffer. Note: the
- * call blocks until data is available for reading. Use
- * dataAvailable() to determine whether there is data available
- * beforehand, to avoid blocking.
- *
- * @param buffer Buffer to hold the data read
- * @param len Length of the buffer
- * @return Number of bytes read
- */
- int readData(char *buffer, int len);
-
- /**
- * Writes the data in the buffer to the device
- *
- * @param buffer Buffer to hold the data read
- * @param len Length of the buffer
- * @return Number of bytes written
- */
- int writeData(char *buffer, int len);
-
- /**
- * Sets up proper tty I/O modes and the baud rate. For this device, the default
- * baud rate is 9,600 (B9600).
- *
- * @param baud Desired baud rate.
- * @return True if successful
- */
- bool setupTty(speed_t baud=B9600);
-
-
- protected:
- int ttyFd() { return m_ttyFd; };
-
- private:
- mraa_uart_context m_uart;
- int m_ttyFd;
- };
-}
-
-
diff --git a/peripheral/libupm/src/hm11/javaupm_hm11.i b/peripheral/libupm/src/hm11/javaupm_hm11.i
deleted file mode 100644
index df71082..0000000
--- a/peripheral/libupm/src/hm11/javaupm_hm11.i
+++ /dev/null
@@ -1,24 +0,0 @@
-%module javaupm_hm11
-%include "../upm.i"
-%include "carrays.i"
-%include "../java_buffer.i"
-
-%{
- #include "hm11.h"
- speed_t int_B9600 = B9600;
-%}
-
-%include "hm11.h"
-speed_t int_B9600 = B9600;
-%array_class(char, charArray);
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_hm11");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/hm11/jsupm_hm11.i b/peripheral/libupm/src/hm11/jsupm_hm11.i
deleted file mode 100644
index 4f02b7a..0000000
--- a/peripheral/libupm/src/hm11/jsupm_hm11.i
+++ /dev/null
@@ -1,12 +0,0 @@
-%module jsupm_hm11
-%include "../upm.i"
-%include "carrays.i"
-
-%{
- #include "hm11.h"
- speed_t int_B9600 = B9600;
-%}
-
-%include "hm11.h"
-speed_t int_B9600 = B9600;
-%array_class(char, charArray);
diff --git a/peripheral/libupm/src/hm11/pyupm_hm11.i b/peripheral/libupm/src/hm11/pyupm_hm11.i
deleted file mode 100644
index 345d106..0000000
--- a/peripheral/libupm/src/hm11/pyupm_hm11.i
+++ /dev/null
@@ -1,15 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_hm11
-%include "../upm.i"
-%include "carrays.i"
-
-%feature("autodoc", "3");
-
-%{
- #include "hm11.h"
- speed_t int_B9600 = B9600;
-%}
-%include "hm11.h"
-speed_t int_B9600 = B9600;
-%array_class(char, charArray);
diff --git a/peripheral/libupm/src/hmc5883l/CMakeLists.txt b/peripheral/libupm/src/hmc5883l/CMakeLists.txt
deleted file mode 100644
index f97d75f..0000000
--- a/peripheral/libupm/src/hmc5883l/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "hmc5883l")
-set (libdescription "libupm Digital Compass")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/hmc5883l/hmc5883l.cxx b/peripheral/libupm/src/hmc5883l/hmc5883l.cxx
deleted file mode 100644
index bcada4b..0000000
--- a/peripheral/libupm/src/hmc5883l/hmc5883l.cxx
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * Author: Brendan Le Foll <brendan.le.foll@intel.com>
- * Contributions: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <string>
-#include <stdexcept>
-
-#include "math.h"
-#include "hmc5883l.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
-
-using namespace upm;
-
-Hmc5883l::Hmc5883l(int bus) : m_i2c(bus)
-{
- mraa::Result error;
- error = m_i2c.address(HMC5883L_I2C_ADDR);
- if(error != mraa::SUCCESS){
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": i2c.address() failed");
- return;
- }
- m_rx_tx_buf[0] = HMC5883L_CONF_REG_B;
- m_rx_tx_buf[1] = GA_1_3_REG;
- error = m_i2c.write(m_rx_tx_buf, 2);
- if(error != mraa::SUCCESS){
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": i2c.write() configuration failed");
- return;
- }
-
- error = m_i2c.address(HMC5883L_I2C_ADDR);
- if(error != mraa::SUCCESS){
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": i2c.address() failed");
- return;
- }
- m_rx_tx_buf[0] = HMC5883L_MODE_REG;
- m_rx_tx_buf[1] = HMC5883L_CONT_MODE;
- error = m_i2c.write(m_rx_tx_buf, 2);
- if(error != mraa::SUCCESS){
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": i2c.write() mode failed");
- return;
- }
-
- Hmc5883l::update();
-}
-
-mraa::Result
-Hmc5883l::update(void)
-{
- m_i2c.address(HMC5883L_I2C_ADDR);
- m_i2c.writeByte(HMC5883L_DATA_REG);
-
- m_i2c.address(HMC5883L_I2C_ADDR);
- m_i2c.read(m_rx_tx_buf, DATA_REG_SIZE);
-
- // x
- m_coor[0] = (m_rx_tx_buf[HMC5883L_X_MSB_REG] << 8 ) | m_rx_tx_buf[HMC5883L_X_LSB_REG];
- // z
- m_coor[2] = (m_rx_tx_buf[HMC5883L_Z_MSB_REG] << 8 ) | m_rx_tx_buf[HMC5883L_Z_LSB_REG];
- // y
- m_coor[1] = (m_rx_tx_buf[HMC5883L_Y_MSB_REG] << 8 ) | m_rx_tx_buf[HMC5883L_Y_LSB_REG];
-
- return mraa::SUCCESS;
-}
-
-float
-Hmc5883l::direction(void)
-{
- return atan2(m_coor[1] * SCALE_0_92_MG, m_coor[0] * SCALE_0_92_MG) + m_declination;
-}
-
-float
-Hmc5883l::heading(void)
-{
- float dir = Hmc5883l::direction() * 180/M_PI;
- if(dir < 0){
- dir += 360.0;
- }
- return dir;
-}
-
-int16_t*
-Hmc5883l::coordinates(void)
-{
- return &m_coor[0];
-}
-
-void
-Hmc5883l::set_declination(float dec)
-{
- m_declination = dec;
-}
-
-float
-Hmc5883l::get_declination()
-{
- return m_declination;
-}
diff --git a/peripheral/libupm/src/hmc5883l/hmc5883l.h b/peripheral/libupm/src/hmc5883l/hmc5883l.h
deleted file mode 100644
index 3bd8b76..0000000
--- a/peripheral/libupm/src/hmc5883l/hmc5883l.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Author: Brendan Le Foll <brendan.le.foll@intel.com>
- * Contributions: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <mraa/i2c.hpp>
-
-#define MAX_BUFFER_LENGTH 6
-
-namespace upm {
-
-/**
- * @brief HMC5883L Magnometer library
- * @defgroup hmc5883l libupm-hmc5883l
- * @ingroup seeed i2c compass robok
- */
-
-/**
- * @library hmc5883l
- * @sensor hmc5883l
- * @comname HMC5883L 3-Axis Digital Compass
- * @altname Grove 3-Axis Digital Compass
- * @type compass
- * @man seeed
- * @con i2c
- * @kit robok
- *
- * @brief API for the HMC5883L 3-Axis Digital Compass
- *
- * Honeywell [HMC5883L]
- * (http://www.adafruit.com/datasheets/HMC5883L_3-Axis_Digital_Compass_IC.pdf)
- * is a 3-axis digital compass. Communication with HMC5883L is simple and
- * all done through an I2C interface. Different breakout boards are available.
- * Typically, a 3V supply is all that is needed to power the sensor.
- *
- * @image html hmc5883l.jpeg
- * @snippet hmc5883l.cxx Interesting
- */
-class Hmc5883l {
-public:
- /**
- * Creates an Hmc5883l object
- *
- * @param bus Number of the used I2C bus
- */
- Hmc5883l(int bus);
-
- /*
- * Returns the direction
- */
- float direction();
-
- /*
- * Returns the heading
- */
- float heading();
-
- /**
- * Returns a pointer to an int[3] that contains the coordinates as ints
- *
- * @return *int to an int[3]
- */
- int16_t* coordinates();
-
- /**
- * Updates the values by reading from I2C
- *
- * @return 0 if successful
- */
- mraa::Result update();
-
- /**
- * Sets the magnetic declination for better calibration
- */
- void set_declination(float dec);
-
- /**
- * Gets the current magnetic declination value
- *
- * @return Magnetic declination as a floating-point value
- */
- float get_declination();
-private:
- int16_t m_coor[3];
- float m_declination;
- uint8_t m_rx_tx_buf[MAX_BUFFER_LENGTH];
- mraa::I2c m_i2c;
-};
-
-}
diff --git a/peripheral/libupm/src/hmc5883l/javaupm_hmc5883l.i b/peripheral/libupm/src/hmc5883l/javaupm_hmc5883l.i
deleted file mode 100644
index cc80059..0000000
--- a/peripheral/libupm/src/hmc5883l/javaupm_hmc5883l.i
+++ /dev/null
@@ -1,32 +0,0 @@
-%module javaupm_hmc5883l
-%include "../upm.i"
-
-%{
- #include "hmc5883l.h"
-%}
-
-%typemap(jni) int16_t* "jshortArray"
-%typemap(jstype) int16_t* "short[]"
-%typemap(jtype) int16_t* "short[]"
-
-%typemap(javaout) int16_t* {
- return $jnicall;
-}
-
-%typemap(out) int16_t *coordinates {
- $result = JCALL1(NewShortArray, jenv, 3);
- JCALL4(SetShortArrayRegion, jenv, $result, 0, 3, (jshort*)$1);
-}
-
-%include "hmc5883l.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_hmc5883l");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/hmc5883l/jsupm_hmc5883l.i b/peripheral/libupm/src/hmc5883l/jsupm_hmc5883l.i
deleted file mode 100644
index b04b3e9..0000000
--- a/peripheral/libupm/src/hmc5883l/jsupm_hmc5883l.i
+++ /dev/null
@@ -1,14 +0,0 @@
-%module jsupm_hmc5883l
-%include "../upm.i"
-%include "../carrays_int16_t.i"
-%{
- #include "hmc5883l.h"
-%}
-
-// Adding this typemap because SWIG is converting int16 into a short by default
-// This forces SWIG to convert it correctly
-%typemap(out) int16_t* {
- $result = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_int16Array, 0 | 0 );
-}
-
-%include "hmc5883l.h"
diff --git a/peripheral/libupm/src/hmc5883l/pyupm_hmc5883l.i b/peripheral/libupm/src/hmc5883l/pyupm_hmc5883l.i
deleted file mode 100644
index c14f949..0000000
--- a/peripheral/libupm/src/hmc5883l/pyupm_hmc5883l.i
+++ /dev/null
@@ -1,20 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_hmc5883l
-%include "../upm.i"
-%include "../carrays_int16_t.i"
-
-%feature("autodoc", "3");
-
-#ifdef DOXYGEN
-%include "hmc5883l_doc.i"
-#endif
-
-%typemap(out) int16_t* {
- $result = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_int16Array, 0 | 0 );
-}
-
-%include "hmc5883l.h"
-%{
- #include "hmc5883l.h"
-%}
diff --git a/peripheral/libupm/src/hmtrp/CMakeLists.txt b/peripheral/libupm/src/hmtrp/CMakeLists.txt
deleted file mode 100644
index 6a43ba3..0000000
--- a/peripheral/libupm/src/hmtrp/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "hmtrp")
-set (libdescription "upm grove serial rf pro (hmtrp) module")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/hmtrp/hmtrp.cxx b/peripheral/libupm/src/hmtrp/hmtrp.cxx
deleted file mode 100644
index ca71c31..0000000
--- a/peripheral/libupm/src/hmtrp/hmtrp.cxx
+++ /dev/null
@@ -1,504 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <string>
-#include <stdexcept>
-
-#include "hmtrp.h"
-
-using namespace upm;
-using namespace std;
-
-static const int defaultDelay = 100; // max wait time for read
-
-// protocol start code
-const uint8_t HMTRP_START1 = 0xaa;
-const uint8_t HMTRP_START2 = 0xfa;
-
-HMTRP::HMTRP(int uart)
-{
- m_ttyFd = -1;
-
- if ( !(m_uart = mraa_uart_init(uart)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_uart_init() failed");
- return;
- }
-
- // This requires a recent MRAA (1/2015)
- const char *devPath = mraa_uart_get_dev_path(m_uart);
-
- if (!devPath)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": mraa_uart_get_dev_path() failed");
- return;
- }
-
- // now open the tty
- if ( (m_ttyFd = open(devPath, O_RDWR)) == -1)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": open of " +
- string(devPath) + " failed: " +
- string(strerror(errno)));
- return;
- }
-}
-
-HMTRP::~HMTRP()
-{
- if (m_ttyFd != -1)
- close(m_ttyFd);
-}
-
-bool HMTRP::dataAvailable(unsigned int millis)
-{
- if (m_ttyFd == -1)
- return false;
-
- struct timeval timeout;
-
- timeout.tv_sec = 0;
- timeout.tv_usec = millis * 1000;
-
- int nfds;
- fd_set readfds;
-
- FD_ZERO(&readfds);
-
- FD_SET(m_ttyFd, &readfds);
-
- if (select(m_ttyFd + 1, &readfds, NULL, NULL, &timeout) > 0)
- return true; // data is ready
- else
- return false;
-}
-
-int HMTRP::readData(char *buffer, int len, int millis)
-{
- if (m_ttyFd == -1)
- return(-1);
-
- // if specified, wait to see if input shows up, otherwise block
- if (millis >= 0)
- {
- if (!dataAvailable(millis))
- return 0; // timed out
- }
-
- int rv = read(m_ttyFd, buffer, len);
-
- if (rv < 0)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": read() failed: " +
- string(strerror(errno)));
- return rv;
- }
-
- return rv;
-}
-
-int HMTRP::writeData(char *buffer, int len)
-{
- if (m_ttyFd == -1)
- return(-1);
-
- int rv = write(m_ttyFd, buffer, len);
-
- if (rv < 0)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": write() failed: " +
- string(strerror(errno)));
- return rv;
- }
-
- tcdrain(m_ttyFd);
-
- return rv;
-}
-
-bool HMTRP::setupTty(speed_t baud)
-{
- if (m_ttyFd == -1)
- return(false);
-
- struct termios termio;
-
- // get current modes
- tcgetattr(m_ttyFd, &termio);
-
- // setup for a 'raw' mode. 81N, no echo or special character
- // handling, such as flow control.
- cfmakeraw(&termio);
-
- // set our baud rates
- cfsetispeed(&termio, baud);
- cfsetospeed(&termio, baud);
-
- // make it so
- if (tcsetattr(m_ttyFd, TCSAFLUSH, &termio) < 0)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": tcsetattr() failed: " +
- string(strerror(errno)));
- return false;
- }
-
- return true;
-}
-
-bool HMTRP::checkOK()
-{
- char buf[4];
-
- int rv = readData(buf, 4, defaultDelay);
-
- if (rv != 4)
- {
- cerr << __FUNCTION__ << ": failed to receive OK response, rv = "
- << rv << ", expected 4" << endl;
- return false;
- }
-
- // looking for "OK\r\n"
- if (buf[0] == 'O' && buf[1] == 'K' &&
- buf[2] == '\r' && buf[3] == '\n')
- return true;
- else
- return false;
-}
-
-bool HMTRP::reset()
-{
- char pkt[3];
-
- pkt[0] = HMTRP_START1;
- pkt[1] = HMTRP_START2;
- pkt[2] = RESET;
-
- writeData(pkt, 3);
-
- return checkOK();
-}
-
-bool HMTRP::getConfig(uint32_t *freq, uint32_t *dataRate,
- uint16_t *rxBandwidth, uint8_t *modulation,
- uint8_t *txPower, uint32_t *uartBaud)
-{
- char pkt[3];
- pkt[0] = HMTRP_START1;
- pkt[1] = HMTRP_START2;
- pkt[2] = GET_CONFIG;
-
- writeData(pkt, 3);
- usleep(100000);
-
- // now read back a 16 byte response
- char buf[16];
- int rv = readData(buf, 16, defaultDelay);
-
- if (rv != 16)
- {
- cerr << __FUNCTION__ << ": failed to receive correct response: rv = "
- << rv << ", expected 16" << endl;
- return false;
- }
-
- // now decode
- if (freq)
- {
- *freq = ( ((buf[0] & 0xff) << 24) |
- ((buf[1] & 0xff) << 16) |
- ((buf[2] & 0xff) << 8) |
- (buf[3] & 0xff) );
- }
-
- if (dataRate)
- {
- *dataRate = ( ((buf[4] & 0xff) << 24) |
- ((buf[5] & 0xff) << 16) |
- ((buf[6] & 0xff) << 8) |
- (buf[7] & 0xff) );
- }
-
- if (rxBandwidth)
- {
- *rxBandwidth = ( ((buf[8] & 0xff) << 8) |
- (buf[9] & 0xff) );
- }
-
- if (modulation)
- {
- *modulation = buf[10] & 0xff;
- }
-
- if (txPower)
- {
- *txPower = buf[11] & 0xff;
- }
-
- if (uartBaud)
- {
- *uartBaud = ( ((buf[12] & 0xff) << 24) |
- ((buf[13] & 0xff) << 16) |
- ((buf[14] & 0xff) << 8) |
- (buf[15] & 0xff) );
- }
-
- return true;
-}
-
-bool HMTRP::setFrequency(uint32_t freq)
-{
- char pkt[7];
-
- pkt[0] = HMTRP_START1;
- pkt[1] = HMTRP_START2;
- pkt[2] = SET_FREQUENCY;
-
- pkt[3] = ( ((freq & 0xff000000) >> 24) & 0xff );
- pkt[4] = ( ((freq & 0x00ff0000) >> 16) & 0xff );
- pkt[5] = ( ((freq & 0x0000ff00) >> 8) & 0xff );
- pkt[6] = ( (freq & 0x000000ff) & 0xff );
-
- writeData(pkt, 7);
-
- return checkOK();
-}
-
-bool HMTRP::setRFDataRate(uint32_t rate)
-{
- // Valid values are between 1200-115200
-
- if (rate < 1200 || rate > 115200)
- {
- throw std::out_of_range(std::string(__FUNCTION__) +
- ": Valid rate values are between 1200-115200");
- return false;
- }
-
- char pkt[7];
-
- pkt[0] = HMTRP_START1;
- pkt[1] = HMTRP_START2;
- pkt[2] = SET_RF_DATARATE;
-
- pkt[3] = ( ((rate & 0xff000000) >> 24) & 0xff );
- pkt[4] = ( ((rate & 0x00ff0000) >> 16) & 0xff );
- pkt[5] = ( ((rate & 0x0000ff00) >> 8) & 0xff );
- pkt[6] = ( (rate & 0x000000ff) & 0xff );
-
- writeData(pkt, 7);
-
- return checkOK();
-}
-
-bool HMTRP::setRXBandwidth(uint16_t rxBand)
-{
- // Valid values are between 30-620 (in Khz)
-
- if (rxBand < 30 || rxBand > 620)
- {
- throw std::out_of_range(std::string(__FUNCTION__) +
- ": Valid rxBand values are between 30-620");
- return false;
- }
-
- char pkt[5];
-
- pkt[0] = HMTRP_START1;
- pkt[1] = HMTRP_START2;
- pkt[2] = SET_RX_BW;
-
- pkt[3] = ( ((rxBand & 0xff00) >> 8) & 0xff );
- pkt[4] = ( rxBand & 0xff );
-
- writeData(pkt, 5);
-
- return checkOK();
-}
-
-bool HMTRP::setFrequencyModulation(uint8_t modulation)
-{
- // Valid values are between 10-160 (in Khz)
-
- if (modulation < 10 || modulation > 160)
- {
- throw std::out_of_range(std::string(__FUNCTION__) +
- ": Valid modulation values are between 10-160");
- return false;
- }
-
- char pkt[4];
-
- pkt[0] = HMTRP_START1;
- pkt[1] = HMTRP_START2;
- pkt[2] = SET_FREQ_MODULATION;
-
- pkt[3] = modulation;
-
- writeData(pkt, 4);
-
- return checkOK();
-}
-
-bool HMTRP::setTransmitPower(uint8_t power)
-{
- // Valid values are between 0-7
-
- if (power > 7)
- {
- throw std::out_of_range(std::string(__FUNCTION__) +
- ": Valid power values are between 0-7");
- return false;
- }
-
- char pkt[4];
-
- pkt[0] = HMTRP_START1;
- pkt[1] = HMTRP_START2;
- pkt[2] = SET_TX_POWER;
-
- pkt[3] = power;
-
- writeData(pkt, 4);
-
- return checkOK();
-}
-
-bool HMTRP::setUARTSpeed(uint32_t speed)
-{
- // Valid values are between 1200-115200
-
- if (speed < 1200 || speed > 115200)
- {
- throw std::out_of_range(std::string(__FUNCTION__) +
- ": Valid speed values are between 1200-115200");
- return false;
- }
-
- char pkt[7];
-
- pkt[0] = HMTRP_START1;
- pkt[1] = HMTRP_START2;
- pkt[2] = SET_UART_SPEED;
-
- pkt[3] = ( ((speed & 0xff000000) >> 24) & 0xff );
- pkt[4] = ( ((speed & 0x00ff0000) >> 16) & 0xff );
- pkt[5] = ( ((speed & 0x0000ff00) >> 8) & 0xff );
- pkt[6] = ( (speed & 0x000000ff) & 0xff );
-
- writeData(pkt, 7);
-
- return checkOK();
-}
-
-
-bool HMTRP::getRFSignalStrength(uint8_t *strength)
-{
- if (!strength)
- return false;
-
- *strength = 0;
-
- char pkt[3];
- pkt[0] = HMTRP_START1;
- pkt[1] = HMTRP_START2;
- pkt[2] = GET_RF_SIGNAL_STR;
-
- writeData(pkt, 3);
- usleep(100000);
-
- // now read back a 1 byte response
- char buf;
- int rv = readData(&buf, 1, defaultDelay);
-
- if (rv != 1)
- {
- cerr << __FUNCTION__ << ": failed to receive correct response: rv = "
- << rv << ", expected 1" << endl;
- return false;
- }
-
- // now decode
- *strength = (uint8_t)buf;
-
- return true;
-}
-
-uint8_t HMTRP::getRFSignalStrength()
-{
- uint8_t strength = 0;
- if (!getRFSignalStrength(&strength))
- throw std::runtime_error(std::string(__PRETTY_FUNCTION__) +
- ": readData() failed");
- return strength;
-}
-
-bool HMTRP::getModSignalStrength(uint8_t *strength)
-{
- if (!strength)
- return false;
-
- *strength = 0;
-
- char pkt[3];
- pkt[0] = HMTRP_START1;
- pkt[1] = HMTRP_START2;
- pkt[2] = GET_MOD_SIGNAL_STR;
-
- writeData(pkt, 3);
- usleep(100000);
-
- // now read back a 1 byte response
- char buf;
- int rv = readData(&buf, 1, defaultDelay);
-
- if (rv != 1)
- {
- cerr << __FUNCTION__ << ": failed to receive correct response: rv = "
- << rv << ", expected 1" << endl;
- return false;
- }
-
- // now decode
- *strength = (uint8_t)buf;
-
- return true;
-}
-
-uint8_t HMTRP::getModSignalStrength()
-{
- uint8_t strength = 0;
- if (!getModSignalStrength(&strength))
- throw std::runtime_error(std::string(__PRETTY_FUNCTION__) +
- ": readData() failed");
- return strength;
-}
-
diff --git a/peripheral/libupm/src/hmtrp/hmtrp.h b/peripheral/libupm/src/hmtrp/hmtrp.h
deleted file mode 100644
index c091a8f..0000000
--- a/peripheral/libupm/src/hmtrp/hmtrp.h
+++ /dev/null
@@ -1,269 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include <iostream>
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <termios.h>
-#include <sys/time.h>
-#include <sys/select.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include <mraa/uart.h>
-
-#define HMTRP_DEFAULT_UART 0
-
-namespace upm {
-/**
- * @brief HMTRP Serial RF Pro library
- * @defgroup hmtrp libupm-hmtrp
- * @ingroup seeed uart wifi
- */
-
-/**
- * @library hmtrp
- * @sensor hmtrp
- * @comname Grove Serial RF Pro
- * @altname HMTRP-433 HMTRP-470 HMTRP-868 HMTRP-915
- * @type wifi
- * @man seeed
- * @con uart
- *
- * @brief API for the HM-TRP Serial RF Pro transceiver
- *
- * UPM support for the HM-TRP Serial RF Pro transceiver. This was tested
- * specifically with the Grove Serial RF Pro transceiver. In theory,
- * this class should work with the following devices:
- *
- * HM-TRP-433: 414000000-454000000Hz
- * HM-TRP-470: 450000000-490000000Hz
- * HM-TRP-868: 849000000-889000000Hz
- * HM-TRP-915: 895000000-935000000Hz
- *
- * The only difference is the transmit and receive frequencies
- * supported.
- *
- * By default, the device simply sends and receives any data
- * presented on its UART interface. It can be put into a
- * configuration mode by grounding the CONFIG pin on the transceiver.
- *
- * @image html hmtrp.jpg
- * @snippet hmtrp.cxx Interesting
- */
- class HMTRP {
- public:
-
- // HMTRP opcodes
- typedef enum { RESET = 0xf0,
- GET_CONFIG = 0xe1,
- SET_FREQUENCY = 0xd2,
- SET_RF_DATARATE = 0xc3, // 1200-115200 (baud)
- SET_RX_BW = 0xb4, // 30-620 (Khz)
- SET_FREQ_MODULATION = 0xa5, // 10-160 (KHz)
- SET_TX_POWER = 0x96, // 0-7
- SET_UART_SPEED = 0x1e, // recommended not to change
- GET_RF_SIGNAL_STR = 0xa7,
- GET_MOD_SIGNAL_STR = 0x78
- } HMTRP_OPCODE_T;
-
- /**
- * HMTRP Serial RF Pro transceiver constructor
- *
- * @param uart Default UART to use (0 or 1)
- */
- HMTRP(int uart=HMTRP_DEFAULT_UART);
-
- /**
- * HMTRP destructor
- */
- ~HMTRP();
-
- /**
- * Checks to see if there is data available for reading
- *
- * @param millis Number of milliseconds to wait; 0 means no waiting (default).
- * @return True if there is data available for reading
- */
- bool dataAvailable(unsigned int millis=0);
-
- /**
- * Reads any available data in a user-supplied buffer
- *
- * @param buffer Buffer to hold the data read
- * @param len Length of the buffer
- * @param millis Maximum time in milliseconds to wait for input. -1 means
- * waiting forever (default).
- * @return Number of bytes read; 0 if timed out and millis is >= 0
- */
- int readData(char *buffer, int len, int millis=-1);
-
- /**
- * Writes the data in the buffer to the device
- *
- * @param buffer Buffer to hold the data read
- * @param len Length of the buffer
- * @return Number of bytes written
- */
- int writeData(char *buffer, int len);
-
- /**
- * Sets up proper tty I/O modes and the baud rate. The default
- * baud rate is 9,600 (B9600).
- *
- * @param baud Desired baud rate.
- * @return True if successful
- */
- bool setupTty(speed_t baud=B9600);
-
- /**
- * Looks for and verifies an OK response. This looks like "OK\r\n"
- *
- * @return True if OK received
- */
- bool checkOK();
-
- /**
- * Resets the device to default parameters, except for the UART baud rate
- *
- * @return True if successful
- */
- bool reset();
-
- /**
- * Queries the radio to determine its configuration
- *
- * @param freq Operating frequency
- * @param dataRate TX/RX bit rate
- * @param rxBandwidth Receiving bandwidth in Khz
- * @param modulation Modulation frequency in Khz
- * @param txPower Transmission power (1-7)
- * @param uartBaud UART baud rate
- * @return True if successful
- */
- bool getConfig(uint32_t *freq, uint32_t *dataRate, uint16_t *rxBandwidth,
- uint8_t *modulation, uint8_t *txPower, uint32_t *uartBaud);
-
- /**
- * Sets the frequency. Note: this is limited depending on which
- * HM-TRP device you are using. Consult the datasheet.
- *
- * @param freq Operating frequency
- * @return True if successful
- */
- bool setFrequency(uint32_t freq);
-
- /**
- * Sets the RF data transmission rate. Valid values are between
- * 1,200 and 115,200.
- *
- * @param rate Radio transmission rate in baud (1,200-115,200)
- * @return True if successful
- */
- bool setRFDataRate(uint32_t rate);
-
- /**
- * Sets the RX bandwidth. Valid values are between 30 and 620 (in Khz)
- *
- * @param rxBand RX bandwidth in Khz (30-620)
- * @return True if successful
- */
- bool setRXBandwidth(uint16_t rxBand);
-
- /**
- * Sets the frequency modulation. Valid values are between 10 and 160 (in Khz)
- *
- * @param modulation Frequency modulation to use, in Khz (10-160)
- * @return True if successful
- */
- bool setFrequencyModulation(uint8_t modulation);
-
- /**
- * Sets the transmit power level. Valid values are between 0 and 7,
- * 7 being the maximum power.
- *
- * @param power Power level to use during transmission. Valid values
- * are between 0 and 7.
- * @return True if successful
- */
- bool setTransmitPower(uint8_t power);
-
- /**
- * Sets the configured baud rate of the UART. It is strongly
- * recommended you do not change this, or you may lose the
- * ability to communicate with the transceiver. Valid values are 1,200-115,200.
- *
- * @param speed Desired baud rate to configure the device to use
- * Valid values are between 1,200 and 115,200.
- * @return True if successful
- */
- bool setUARTSpeed(uint32_t speed);
-
- /**
- * Gets the RF signal strength
- *
- * @param strength Returned strength
- * @return True if successful
- */
- bool getRFSignalStrength(uint8_t *strength);
-
- /**
- * Gets the RF signal strength
- *
- * @return Signal strength
- * @throws std::runtime_error if reading from the sensor failed
- */
- uint8_t getRFSignalStrength();
-
- /**
- * Gets the modulation signal strength.
- *
- * @param strength Returned strength
- * @return True if successful
- */
- bool getModSignalStrength(uint8_t *strength);
-
- /**
- * Gets the modulation signal strength.
- *
- * @return Signal strength
- * @throws std::runtime_error if reading from the sensor failed
- */
- uint8_t getModSignalStrength();
-
-
- private:
- mraa_uart_context m_uart;
- int m_ttyFd;
- };
-}
-
-
diff --git a/peripheral/libupm/src/hmtrp/javaupm_hmtrp.i b/peripheral/libupm/src/hmtrp/javaupm_hmtrp.i
deleted file mode 100644
index 2f38e06..0000000
--- a/peripheral/libupm/src/hmtrp/javaupm_hmtrp.i
+++ /dev/null
@@ -1,37 +0,0 @@
-%module javaupm_hmtrp
-%include "../upm.i"
-%include "stdint.i"
-%include "typemaps.i"
-%include "../java_buffer.i"
-%include "../java_exceptions.i"
-
-%apply uint32_t *OUTPUT { uint32_t *freq, uint32_t *dataRate };
-%apply uint16_t *OUTPUT { uint16_t *rxBandwidth };
-%apply uint8_t *OUTPUT { uint8_t *modulation, uint8_t *txPower };
-%apply uint32_t *OUTPUT { uint32_t *uartBaud };
-%apply uint8_t *OUTPUT { uint8_t *strength };
-
-%{
- #include "hmtrp.h"
- speed_t int_B9600 = B9600;
-%}
-
-%ignore getRFSignalStrength(uint8_t *strength);
-READDATA_EXCEPTION(getRFSignalStrength())
-
-%ignore getModSignalStrength(uint8_t *strength);
-READDATA_EXCEPTION(getModSignalStrength())
-
-%include "hmtrp.h"
-speed_t int_B9600 = B9600;
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_hmtrp");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%}
diff --git a/peripheral/libupm/src/hmtrp/jsupm_hmtrp.i b/peripheral/libupm/src/hmtrp/jsupm_hmtrp.i
deleted file mode 100644
index 2853677..0000000
--- a/peripheral/libupm/src/hmtrp/jsupm_hmtrp.i
+++ /dev/null
@@ -1,14 +0,0 @@
-%module jsupm_hmtrp
-%include "../upm.i"
-%include "../carrays_uint8_t.i"
-%include "../carrays_uint16_t.i"
-%include "../carrays_uint32_t.i"
-
-%{
- #include "hmtrp.h"
- speed_t int_B9600 = B9600;
-%}
-
-%include "hmtrp.h"
-speed_t int_B9600 = B9600;
-%array_class(char, charArray);
diff --git a/peripheral/libupm/src/hmtrp/pyupm_hmtrp.i b/peripheral/libupm/src/hmtrp/pyupm_hmtrp.i
deleted file mode 100644
index 3898382..0000000
--- a/peripheral/libupm/src/hmtrp/pyupm_hmtrp.i
+++ /dev/null
@@ -1,20 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_hmtrp
-%include "../upm.i"
-%include "../carrays_uint8_t.i"
-%include "../carrays_uint16_t.i"
-%include "../carrays_uint32_t.i"
-
-%rename("getModSignalStrengthNoParam") getModSignalStrength();
-%rename("getRFSignalStrengthNoParam") getRFSignalStrength();
-
-%feature("autodoc", "3");
-
-%include "hmtrp.h"
-%{
- #include "hmtrp.h"
- speed_t int_B9600 = B9600;
-%}
-speed_t int_B9600 = B9600;
-%array_class(char, charArray);
diff --git a/peripheral/libupm/src/hp20x/CMakeLists.txt b/peripheral/libupm/src/hp20x/CMakeLists.txt
deleted file mode 100644
index 63c0b82..0000000
--- a/peripheral/libupm/src/hp20x/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "hp20x")
-set (libdescription "upm grove barometer (high efficiency)")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/hp20x/hp20x.cxx b/peripheral/libupm/src/hp20x/hp20x.cxx
deleted file mode 100644
index 73ae3e2..0000000
--- a/peripheral/libupm/src/hp20x/hp20x.cxx
+++ /dev/null
@@ -1,287 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <math.h>
-#include <iostream>
-#include <string>
-#include <stdexcept>
-
-#include "hp20x.h"
-
-using namespace upm;
-using namespace std;
-
-
-HP20X::HP20X(int bus, uint8_t address):
- m_i2c(bus)
-{
- m_addr = address;
-
- mraa::Result rv;
- if ( (rv = m_i2c.address(m_addr)) != mraa::SUCCESS)
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": I2c.address() failed");
- return;
- }
-}
-
-HP20X::~HP20X()
-{
-}
-
-bool HP20X::init(DSR_BITS_T dsr)
-{
- // wait for the device to report ready
- waitforDeviceReady();
-
- m_dsr = dsr;
-
- // enable compensation? Datasheet says yes, but a register readback
- // says no. Data does seem stable, so....
- compensationEnable(true);
-
- return true;
-}
-
-bool HP20X::isReady()
-{
- uint8_t intsrc = readReg(REG_INT_SRC);
-
- if (intsrc & INT_SRC_DEV_RDY)
- return true;
-
- return false;
-}
-
-bool HP20X::waitforDeviceReady()
-{
- const int maxRetries = 20;
-
- int retries = 0;
-
- while (retries < maxRetries)
- {
- if (isReady())
- return true;
-
- usleep(20000);
- retries++;
- }
-
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": timeout waiting for device to become ready");
-
- return false;
-}
-
-bool HP20X::writeCmd(uint8_t cmd)
-{
- mraa::Result rv;
- if ((rv = m_i2c.writeByte(cmd)) != mraa::SUCCESS)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": I2c.writeByte() failed");
- return false;
- }
-
- return true;
-}
-
-bool HP20X::writeReg(HP20X_REG_T reg, uint8_t data)
-{
- waitforDeviceReady();
-
- uint8_t r = CMD_WRITE_REG | reg;
-
- mraa::Result rv;
- if ((rv = m_i2c.writeReg(r, data)) != mraa::SUCCESS)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": I2c.writeReg() failed");
- return false;
- }
-
- return true;
-}
-
-uint8_t HP20X::readReg(HP20X_REG_T reg)
-{
- uint8_t r = CMD_READ_REG | reg;
-
- return m_i2c.readReg(r);
-}
-
-int HP20X::readData()
-{
- uint8_t buf[3] = {0};
-
- if (!m_i2c.read(buf, 3))
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": I2c.read() failed");
- return 0;
- }
-
- // handle 24bit sign extension
- int minus = 1;
- if (buf[0] & 0x80)
- {
- // negative
- buf[0] &= 0x3f;
- minus = -1;
- }
-
- return ( minus * ((buf[0] << 16) | (buf[1] << 8) | buf[2]) );
-}
-
-float HP20X::getTemperature()
-{
- // wait for the device to report ready
- waitforDeviceReady();
-
- // start conversion, T only
- uint8_t cmd = CMD_ADC_CVT | (CHNL_T << CHNL_SHIFT) | (m_dsr << DSR_SHIFT);
- writeCmd(cmd);
-
- // wait for the device to report ready
- waitforDeviceReady();
-
- // now read the temperature
- writeCmd(CMD_READ_T);
-
- return ((float)readData() / 100.0);
-}
-
-float HP20X::getPressure()
-{
- // wait for the device to report ready
- waitforDeviceReady();
-
- // start conversion, PT only
- uint8_t cmd = CMD_ADC_CVT | (CHNL_PT << CHNL_SHIFT) | (m_dsr << DSR_SHIFT);
- writeCmd(cmd);
-
- // wait for the device to report ready
- waitforDeviceReady();
-
- // now read the pressure
- writeCmd(CMD_READ_P);
-
- return ((float)readData() / 100.0);
-}
-
-float HP20X::getAltitude()
-{
- // wait for the device to report ready
- waitforDeviceReady();
-
- // start conversion, PT only
- uint8_t cmd = CMD_ADC_CVT | (CHNL_PT << CHNL_SHIFT) | (m_dsr << DSR_SHIFT);
- writeCmd(cmd);
-
- // wait for the device to report ready
- waitforDeviceReady();
-
- // now read the pressure
- writeCmd(CMD_READ_A);
-
- return ((float)readData() / 100.0);
-}
-
-void HP20X::compensationEnable(bool enable)
-{
- if (enable)
- writeReg(REG_PARA, PARA_CMPS_EN);
- else
- writeReg(REG_PARA, 0);
-}
-
-bool HP20X::setInterruptEnable(uint8_t bits)
-{
- return writeReg(REG_INT_EN, bits);
-}
-
-bool HP20X::setInterruptConfig(uint8_t bits)
-{
- return writeReg(REG_INT_CFG, bits);
-}
-
-uint8_t HP20X::getInterruptSource()
-{
- return readReg(REG_INT_SRC);
-}
-
-void HP20X::setDSR(DSR_BITS_T dsr)
-{
- m_dsr = dsr;
-}
-
-void HP20X::recalibrateInternal()
-{
- waitforDeviceReady();
- writeCmd(CMD_ANA_CAL);
-}
-
-void HP20X::softReset()
-{
- waitforDeviceReady();
- writeCmd(CMD_SOFT_RST);
- waitforDeviceReady();
-}
-
-void HP20X::setAltitudeOffset(int16_t off)
-{
- writeReg(REG_ALT_OFF_LSB, (off & 0xff));
- writeReg(REG_ALT_OFF_MSB, ((off >> 8) & 0xff));
-}
-
-void HP20X::setPAThreshholds(int16_t low, int16_t med, int16_t high)
-{
- // low
- writeReg(REG_PA_L_TH_LSB, (low & 0xff));
- writeReg(REG_PA_L_TH_MSB, ((low >> 8) & 0xff));
-
- // medium
- writeReg(REG_PA_M_TH_LSB, (med & 0xff));
- writeReg(REG_PA_M_TH_MSB, ((med >> 8) & 0xff));
-
- // high
- writeReg(REG_PA_H_TH_LSB, (high & 0xff));
- writeReg(REG_PA_H_TH_MSB, ((high >> 8) & 0xff));
-}
-
-void HP20X::setTemperatureThreshholds(int8_t low, int8_t med, int8_t high)
-{
- // low
- writeReg(REG_T_L_TH, low);
-
- // medium
- writeReg(REG_T_M_TH, med);
-
- // high
- writeReg(REG_T_H_TH, high);
-}
-
diff --git a/peripheral/libupm/src/hp20x/hp20x.h b/peripheral/libupm/src/hp20x/hp20x.h
deleted file mode 100644
index 9831341..0000000
--- a/peripheral/libupm/src/hp20x/hp20x.h
+++ /dev/null
@@ -1,385 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include <mraa/common.hpp>
-#include <mraa/i2c.hpp>
-
-#define HP20X_I2C_BUS 0
-#define HP20X_DEFAULT_I2C_ADDR 0x76
-
-namespace upm {
-
- /**
- * @brief HP20X I2C Barometer (High-Accuracy) library
- * @defgroup hp20x libupm-hp20x
- * @ingroup seeed i2c pressure
- */
-
- /**
- * @library hp20x
- * @sensor hp20x
- * @comname Grove Barometer (High-Accuracy)
- * @altname HP20X Barometer (High-Accuracy)
- * @type pressure
- * @man seeed
- * @web http://www.seeedstudio.com/depot/Grove-Barometer-HighAccuracy-p-1865.html
- * @con i2c
- *
- * @brief API for the HP20X-based Grove Barometer (High-Accuracy)
- *
- * This is a high-accuracy barometer providing pressure, altitude,
- * and temperature data. It can be calibrated for a given altitude
- * offset, and a wide range of interrupt generating capabilities are
- * supported. As usual, see the HP20X datasheet for more details.
- *
- * This module was developed using a Grove Barometer (High-Accuracy)
- * based on an HP206C chip.
- *
- * @image html hp20x.jpg
- * @snippet hp20x.cxx Interesting
- */
- class HP20X {
- public:
-
- /**
- * HP20X commands
- */
- typedef enum {
- CMD_SOFT_RST = 0x06,
-
- CMD_ADC_CVT = 0x40, // mask - ANDed with DSR and CHNL bits
-
- CMD_READ_PT = 0x10, // read pressure/temp
- CMD_READ_AT = 0x11, // read alt/temp
-
- CMD_READ_P = 0x30, // read pressure only
- CMD_READ_A = 0x31, // read alt only
- CMD_READ_T = 0x32, // read temp only
-
- CMD_ANA_CAL = 0x28, // recalibrate internal analog blocks
-
- CMD_READ_REG = 0x80, // mask - ANDed with reg addr
- CMD_WRITE_REG = 0xc0 // mask - ANDed with reg addr
- } HP20X_CMD_T;
-
- /**
- * CHNL bits
- */
- typedef enum {
- CHNL_PT = 0x00, // pressure and temperature
- CHNL_T = 0x02, // temperature
-
- CHNL_SHIFT = 0 // don't use, indicates position in REG
- } CHNL_BITS_T;
-
- /**
- * DSR bits
- */
- typedef enum {
- DSR_4096 = 0x00, // decimation rate of digital filter
- DSR_2048 = 0x01,
- DSR_1024 = 0x02,
- DSR_512 = 0x03,
- DSR_256 = 0x04,
- DSR_128 = 0x05,
-
- DSR_SHIFT = 2 // don't use, indicates position in REG
- } DSR_BITS_T;
-
-
- /**
- * HP20X registers
- */
- typedef enum {
- REG_ALT_OFF_LSB = 0x00,
- REG_ALT_OFF_MSB = 0x01,
-
- REG_PA_H_TH_LSB = 0x02, // Pres/Alt high threshold
- REG_PA_H_TH_MSB = 0x03,
-
- REG_PA_M_TH_LSB = 0x04, // Pres/Alt medium threshold
- REG_PA_M_TH_MSB = 0x05,
-
- REG_PA_L_TH_LSB = 0x06, // Pres/Alt low threshold
- REG_PA_L_TH_MSB = 0x07,
-
- REG_T_H_TH = 0x08, // temperature high threshold
- REG_T_M_TH = 0x09,
- REG_T_L_TH = 0x0a,
-
- REG_INT_EN = 0x0b, // interrupt enables
- REG_INT_CFG = 0x0c, // interrupt configuration
- REG_INT_SRC = 0x0d, // interrupt sources
-
- REG_PARA = 0x0e // parameters config
- } HP20X_REG_T;
-
- /**
- * INT_EN bits
- */
- typedef enum {
- INT_EN_T_WIN_EN = 0x01,
- INT_EN_PA_WIN_EN = 0x02,
-
- INT_EN_T_TRAV_EN = 0x04,
- INT_EN_PA_TRAV_EN = 0x08,
-
- INT_EN_T_RDY_EN = 0x10,
- INT_EN_PA_RDY_EN = 0x20
- // 0x40, 0x80 reserved
- } INT_EN_BITS_T;
-
- /**
- * INT_CFG bits
- */
- typedef enum {
- INT_CFG_T_WIN_CFG = 0x01,
- INT_CFG_PA_WIN_CFG = 0x02,
-
- INT_CFG_T_TRAV_CFG = 0x04,
- INT_CFG_PA_TRAV_CFG = 0x08,
-
- INT_CFG_T_RDY_CFG = 0x10,
- INT_CFG_PA_RDY_CFG = 0x20,
-
- INT_CFG_PA_MODE = 0x40
- // 0x80 reserved
- } INT_CFG_BITS_T;
-
- /**
- * INT_SRC bits
- */
- typedef enum {
- INT_SRC_T_WIN = 0x01,
- INT_SRC_PA_WIN = 0x02,
-
- INT_SRC_T_TRAV = 0x04,
- INT_SRC_PA_TRAV = 0x08,
-
- INT_SRC_T_RDY = 0x10,
- INT_SRC_PA_RDY = 0x20,
-
- INT_SRC_DEV_RDY = 0x40, // device is ready
-
- INT_SRC_TH_ERR = 0x80 // threshold error
- } INT_SRC_BITS_T;
-
- /**
- * PARA bits
- */
- typedef enum {
- // 0x01-0x40 reserved
- PARA_CMPS_EN = 0x80 // compensation enable
- } PARA_BITS_T;
-
- /**
- * HP20X constructor
- *
- * @param bus I2C bus to use
- * @param address Address for this device
- */
- HP20X(int bus=HP20X_I2C_BUS, uint8_t address=HP20X_DEFAULT_I2C_ADDR);
-
- /**
- * HP20X destructor
- */
- ~HP20X();
-
- /**
- * Sets up initial values and starts operation
- *
- * @param dsr Data sampling rate; one of the DSR_BITS_T values
- * @return True if successful
- */
- bool init(DSR_BITS_T dsr=DSR_4096);
-
- /**
- * Sends a command to the device
- *
- * @param cmd Command to send; usually, one of the HP20X_CMD_T values
- * @return True if successful
- */
- bool writeCmd(uint8_t cmd);
-
- /**
- * Writes a value to a register
- *
- * @param reg Register to write to; one of the HP20X_REG_T values
- * @param data Value to write
- * @return True if successful
- */
- bool writeReg(HP20X_REG_T reg, uint8_t data);
-
- /**
- * Reads a register and returns its value
- *
- * @param reg Register to read; one of the HP20X_REG_T values
- * @return Value of a specified register
- */
- uint8_t readReg(HP20X_REG_T reg);
-
- /**
- * Reads 3 bytes of data in response to a conversion request, and
- * converts it to an integer
- *
- * @return Value read back (temperature, pressure, etc.)
- */
- int readData();
-
- /**
- * Checks to see if the DR_RDY bit is set, indicating the device
- * can accept commands
- *
- * @return True if the device is ready, false otherwise
- */
- bool isReady();
-
- /**
- * Checks to see if the device is ready, and sleeps/retries if not.
- * Returns once the device indicates it's ready.
- *
- * @return True if the device is ready; false if retries are exhausted
- */
- bool waitforDeviceReady();
-
- /**
- * Returns the temperature in Celsius
- *
- * @return Temperature
- */
- float getTemperature();
-
- /**
- * Returns the pressure in millibars
- *
- * @return Pressure
- */
- float getPressure();
-
- /**
- * Returns the computed altitude in meters
- *
- * @return Altitude
- */
- float getAltitude();
-
- /**
- * Enables or disables the on-chip compensator. This allows the
- * chip to filter and clean up the output data.
- *
- * @param enable True to enable, false otherwise
- */
- void compensationEnable(bool enable);
-
- /**
- * Sets up the interrupt enable register. This register defines
- * which events can cause a hardware interrupt pin to be pulled high
- * (active).
- *
- * @param bits One or more of the INT_EN_BITS_T bits
- * @return True if successful, false otherwise
- */
- bool setInterruptEnable(uint8_t bits);
-
- /**
- * Sets up the interrupt configuration register. This register
- * defines which events can cause an interrupt to be indicated.
- *
- * @param bits One or more of the INT_EN_BITS_T bits
- * @return True if successful, false otherwise
- */
- bool setInterruptConfig(uint8_t bits);
-
- /**
- * Gets the interrupt source register. This register indicates
- * which interrupts have been triggered. In addition, it
- * indicates when certain operations have been completed.
- *
- * @return One of more of the INT_SRC_BITS_T values
- */
- uint8_t getInterruptSource();
-
- /**
- * Sets the data sampling rate. Higher rates are more precise, but
- * take more time per measurement.
- *
- * @param dsr One of the DSR_BITS_T values
- */
- void setDSR(DSR_BITS_T dsr);
-
-
- /**
- * Starts an internal recalibration of analog blocks. This is
- * faster than a soft reset.
- */
- void recalibrateInternal();
-
- /**
- * Executes a soft reset. All register values are reset to power-on
- * defaults. This function returns when the reset is
- * complete and the device reports it is ready.
- */
- void softReset();
-
- /**
- * Sets the altitude offset for your region. See the datasheet for
- * more details. Setting this correctly for your region is
- * required for accurate altitude data.
- *
- * @param off Offset
- */
- void setAltitudeOffset(int16_t off);
-
- /**
- * Sets pressure/altitude thresholds for interrupt generation
- *
- * @param low Low threshold to generate an interrupt
- * @param med Medium threshold to generate an interrupt
- * @param high High threshold to generate an interrupt
- */
- void setPAThreshholds(int16_t low, int16_t med, int16_t high);
-
- /**
- * Sets temperature thresholds for interrupt generation
- *
- * @param low Low threshold to generate an interrupt
- * @param med Medium threshold to generate an interrupt
- * @param high High threshold to generate an interrupt
- */
- void setTemperatureThreshholds(int8_t low, int8_t med, int8_t high);
-
-
- protected:
- mraa::I2c m_i2c;
-
- private:
- uint8_t m_addr;
- uint8_t m_dsr;
-
- };
-}
-
-
diff --git a/peripheral/libupm/src/hp20x/javaupm_hp20x.i b/peripheral/libupm/src/hp20x/javaupm_hp20x.i
deleted file mode 100644
index 54d7c33..0000000
--- a/peripheral/libupm/src/hp20x/javaupm_hp20x.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_hp20x
-%include "../upm.i"
-
-%{
- #include "hp20x.h"
-%}
-
-%include "hp20x.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_hp20x");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/hp20x/jsupm_hp20x.i b/peripheral/libupm/src/hp20x/jsupm_hp20x.i
deleted file mode 100644
index cf9a645..0000000
--- a/peripheral/libupm/src/hp20x/jsupm_hp20x.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_hp20x
-%include "../upm.i"
-
-%{
- #include "hp20x.h"
-%}
-
-%include "hp20x.h"
diff --git a/peripheral/libupm/src/hp20x/pyupm_hp20x.i b/peripheral/libupm/src/hp20x/pyupm_hp20x.i
deleted file mode 100644
index 39c0b07..0000000
--- a/peripheral/libupm/src/hp20x/pyupm_hp20x.i
+++ /dev/null
@@ -1,15 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_hp20x
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-#ifdef DOXYGEN
-%include "hp20x_doc.i"
-#endif
-
-%include "hp20x.h"
-%{
- #include "hp20x.h"
-%}
diff --git a/peripheral/libupm/src/ht9170/CMakeLists.txt b/peripheral/libupm/src/ht9170/CMakeLists.txt
deleted file mode 100644
index b00f1eb..0000000
--- a/peripheral/libupm/src/ht9170/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "ht9170")
-set (libdescription "upm ht9170 DTMF decoder")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/ht9170/ht9170.cxx b/peripheral/libupm/src/ht9170/ht9170.cxx
deleted file mode 100644
index d34987b..0000000
--- a/peripheral/libupm/src/ht9170/ht9170.cxx
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <string>
-#include <stdexcept>
-
-#include "ht9170.h"
-
-using namespace upm;
-using namespace std;
-
-HT9170::HT9170(int dr, int o1, int o2, int o3, int o4)
-{
- // init the gpio's we will need
- if ( !(m_dr = mraa_gpio_init(dr)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_gpio_init(dr) failed, invalid pin?");
- return;
- }
- mraa_gpio_dir(m_dr, MRAA_GPIO_IN);
-
- if ( !(m_o1 = mraa_gpio_init(o1)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_gpio_init(o1) failed, invalid pin?");
- return;
- }
- mraa_gpio_dir(m_o1, MRAA_GPIO_IN);
-
- if ( !(m_o2 = mraa_gpio_init(o2)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_gpio_init(o2) failed, invalid pin?");
- return;
- }
- mraa_gpio_dir(m_o2, MRAA_GPIO_IN);
-
- if ( !(m_o3 = mraa_gpio_init(o3)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_gpio_init(o3) failed, invalid pin?");
- return;
- }
- mraa_gpio_dir(m_o3, MRAA_GPIO_IN);
-
- if ( !(m_o4 = mraa_gpio_init(o4)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_gpio_init(o4) failed, invalid pin?");
- return;
- }
- mraa_gpio_dir(m_o4, MRAA_GPIO_IN);
-}
-
-HT9170::~HT9170()
-{
- mraa_gpio_close(m_dr);
- mraa_gpio_close(m_o1);
- mraa_gpio_close(m_o2);
- mraa_gpio_close(m_o3);
- mraa_gpio_close(m_o4);
-}
-
-bool HT9170::digitReady()
-{
- return (mraa_gpio_read(m_dr) ? true : false);
-}
-
-char HT9170::decodeDigit()
-{
- // This lookup table is derived from the decode table on page 7 of
- // the HT9170B/HT9170D datasheet.
-
- static const char decode[16] = {
- 'D', // 0
- '1', // 1
- '2', // 2
- '3', // 3
- '4', // 4
- '5', // 5
- '6', // 6
- '7', // 7
- '8', // 8
- '9', // 9
- '0', // 10
- '*', // 11
- '#', // 12
- 'A', // 13
- 'B', // 14
- 'C' // 15
- };
-
- uint8_t bits = 0;
-
- bits = mraa_gpio_read(m_o1);
- bits |= (mraa_gpio_read(m_o2) << 1);
- bits |= (mraa_gpio_read(m_o3) << 2);
- bits |= (mraa_gpio_read(m_o4) << 3);
-
- return decode[bits];
-}
diff --git a/peripheral/libupm/src/ht9170/ht9170.h b/peripheral/libupm/src/ht9170/ht9170.h
deleted file mode 100644
index a16f6ea..0000000
--- a/peripheral/libupm/src/ht9170/ht9170.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <stdint.h>
-
-#include <mraa/gpio.h>
-
-namespace upm {
- /**
- * @brief HT9170 DTMF Decoder library
- * @defgroup ht9170 libupm-ht9170
- * @ingroup seeed gpio other
- */
-
- /**
- * @library ht9170
- * @sensor ht9170
- * @comname HT9170 DTMF Decoder
- * @altname HT9170B, HT9170D
- * @type other
- * @man seeed
- * @web http://www.seeedstudio.com/depot/DTMFDual-Tone-Multi-Frequency-Shield-p-1839.html
- * @con gpio
- *
- * @brief API for the HT9170 DTMF Decoder
- *
- * This driver was developed using the DTMF (Dual-Tone
- * Multi-Frequency) Shield by Seeed Studio*. It can decode DTMF signals presented at
- * its audio input. It does not generate DTMF signals.
- *
- * @image html ht9170.jpg
- * @snippet ht9170.cxx Interesting
- */
- class HT9170 {
- public:
-
- /**
- * HT9170 constructor
- *
- * @param dr Data ready pin
- * @param o1 Digital pin for data output 1
- * @param o2 Digital pin for data output 2
- * @param o3 Digital pin for data output 3
- * @param o4 Digital pin for data output 4
- */
- HT9170(int dr, int o1, int o2, int o3, int o4);
-
- /**
- * HT9170 destructor
- */
- ~HT9170();
-
- /**
- * Checks to see if a DTMF number is ready to be read
- *
- * @return True if there is a digit available to decode
- */
- bool digitReady();
-
- /**
- * Decodes a digit and returns it
- *
- */
- char decodeDigit();
-
- private:
- mraa_gpio_context m_dr;
- mraa_gpio_context m_o1;
- mraa_gpio_context m_o2;
- mraa_gpio_context m_o3;
- mraa_gpio_context m_o4;
- };
-}
-
-
diff --git a/peripheral/libupm/src/ht9170/javaupm_ht9170.i b/peripheral/libupm/src/ht9170/javaupm_ht9170.i
deleted file mode 100644
index 4bc6b1d..0000000
--- a/peripheral/libupm/src/ht9170/javaupm_ht9170.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_ht9170
-%include "../upm.i"
-
-%{
- #include "ht9170.h"
-%}
-
-%include "ht9170.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_ht9170");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/ht9170/jsupm_ht9170.i b/peripheral/libupm/src/ht9170/jsupm_ht9170.i
deleted file mode 100644
index f4d14b3..0000000
--- a/peripheral/libupm/src/ht9170/jsupm_ht9170.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_ht9170
-%include "../upm.i"
-
-%{
- #include "ht9170.h"
-%}
-
-%include "ht9170.h"
diff --git a/peripheral/libupm/src/ht9170/pyupm_ht9170.i b/peripheral/libupm/src/ht9170/pyupm_ht9170.i
deleted file mode 100644
index bb5d3d2..0000000
--- a/peripheral/libupm/src/ht9170/pyupm_ht9170.i
+++ /dev/null
@@ -1,11 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_ht9170
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "ht9170.h"
-%{
- #include "ht9170.h"
-%}
diff --git a/peripheral/libupm/src/htu21d/CMakeLists.txt b/peripheral/libupm/src/htu21d/CMakeLists.txt
deleted file mode 100644
index 4385a1f..0000000
--- a/peripheral/libupm/src/htu21d/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "htu21d")
-set (libdescription "libupm Humidity Sensor")
-set (module_src ${libname}.cpp)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/htu21d/htu21d.cpp b/peripheral/libupm/src/htu21d/htu21d.cpp
deleted file mode 100644
index 0ff097c..0000000
--- a/peripheral/libupm/src/htu21d/htu21d.cpp
+++ /dev/null
@@ -1,236 +0,0 @@
-/*
- * Author: William Penner <william.penner@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-#include <iostream>
-#include <string>
-#include <stdexcept>
-
-#include <unistd.h>
-#include <stdlib.h>
-
-#include "htu21d.h"
-
-using namespace upm;
-
-HTU21D::HTU21D(int bus, int devAddr) : m_i2ControlCtx(bus) {
- m_temperature = 0;
- m_humidity = 0;
-
- m_name = HTU21D_NAME;
-
- m_controlAddr = devAddr;
- m_bus = bus;
-
- mraa::Result ret = m_i2ControlCtx.address(m_controlAddr);
- if (ret != mraa::SUCCESS) {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_i2c_address() failed");
- }
- resetSensor();
-}
-
-void
-HTU21D::resetSensor(void)
-{
- uint8_t data;
- m_i2ControlCtx.address (m_controlAddr);
- m_i2ControlCtx.write (&data, 1);
- usleep(20000);
-}
-
-/*
- * Convert register value to degC * 1000
- */
-int32_t
-HTU21D::convertTemp(int32_t regval)
-{
- return ((21965 * (regval & 0xFFFC)) >> 13) - 46850;
-}
-
-/*
- * Convert register value to %RH * 1000
- */
-int32_t
-HTU21D::convertRH(int regval)
-{
- return ((15625 * (regval & 0xFFFC)) >> 13) - 6000;
-}
-
-int
-HTU21D::sampleData(void)
-{
- uint32_t itemp;
-
- itemp = i2cReadReg_16(HTU21D_READ_TEMP_HOLD);
- m_temperature = convertTemp(itemp);
-
- itemp = i2cReadReg_16(HTU21D_READ_HUMIDITY_HOLD);
- m_humidity = convertRH(itemp);
-
- return 0;
-}
-
-float
-HTU21D::getTemperature(int bSampleData)
-{
- if (bSampleData) {
- sampleData();
- }
- return (float)m_temperature / 1000;
-}
-
-float
-HTU21D::getHumidity(int bSampleData)
-{
- if (bSampleData) {
- sampleData();
- }
- return (float)m_humidity / 1000;
-}
-
-/*
- * Use the compensation equation from the datasheet to correct the
- * current reading
- * RHcomp = RHactualT + (25 - Tactual) * CoeffTemp
- * RHcomp is in units of %RH * 1000
- */
-float
-HTU21D::getCompRH(int bSampleData)
-{
- if (bSampleData) {
- sampleData();
- }
- return (float)(m_humidity + (25000 - m_temperature) * 3 / 20) / 1000;
-}
-
-int
-HTU21D::setHeater(int bEnable)
-{
- uint8_t userreg;
-
- userreg = i2cReadReg_8(HTU21D_READ_USER_REG);
- if (bEnable)
- userreg |= HTU21D_HEATER_ENABLE;
- else
- userreg &= ~HTU21D_HEATER_ENABLE;
- if (i2cWriteReg(HTU21D_WRITE_USER_REG, userreg) < 0)
- return -1;
-
- return 0;
-}
-
-/*
- * Test function: when reading the HTU21D many times rapidly should
- * result in a temperature increase. This test will verify that the
- * value is changing from read to read
- */
-
-int
-HTU21D::testSensor(void)
-{
- int i;
- int iError = 0;
- float fTemp, fHum;
- float fTempMax, fTempMin;
- float fHumMax, fHumMin;
- float fHumFirst, fTempFirst;
-
- fprintf(stdout, "Executing Sensor Test\n" );
-
- fHum = getHumidity(true);
- fTemp = getTemperature(false);
- fTempFirst = fTempMax = fTempMin = fTemp;
- fHumFirst = fHumMax = fHumMin = fHum;
-
- // Turn on the heater to make a sensor change
- setHeater(true);
-
- // Then sample the sensor a few times
- for (i=0; i < 10; i++) {
- fHum = getHumidity(true);
- fTemp = getTemperature(false);
- if (fHum < fHumMin) fHumMin = fHum;
- if (fHum > fHumMax) fHumMax = fHum;
- if (fTemp < fTempMin) fTempMin = fTemp;
- if (fTemp > fTempMax) fTempMax = fTemp;
- usleep(50000);
- }
-
- // Turn off the heater
- setHeater(false);
-
- // Now check the results
- if ((fTemp - fTempFirst) <= 0) {
- fprintf(stdout, " Temperature should have increased, but didn't\n" );
- iError++;
- }
- if (fHumMin == fHumMax) {
- fprintf(stdout, " Humidity reading was unchanged - warning\n" );
- iError++;
- }
- if (fTempMin == fTempMax) {
- fprintf(stdout, " Temperature reading was unchanged - warning\n" );
- iError++;
- }
- if (iError == 0) {
- fprintf(stdout, " Device appears functional\n" );
- }
-
- fprintf(stdout, " Test complete\n" );
-
- return iError;
-}
-
-/*
- * Functions to read and write data to the i2c device
- */
-
-mraa::Result
-HTU21D::i2cWriteReg (uint8_t reg, uint8_t value) {
- mraa::Result error = mraa::SUCCESS;
-
- uint8_t data[2] = { reg, value };
- m_i2ControlCtx.address (m_controlAddr);
- error = m_i2ControlCtx.write (data, 2);
- if ( error != mraa::SUCCESS)
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_i2c_write() failed");
-
- return error;
-}
-
-uint16_t
-HTU21D::i2cReadReg_16 (int reg) {
- uint16_t data;
- m_i2ControlCtx.address(m_controlAddr);
- data = (uint16_t)m_i2ControlCtx.readReg(reg) << 8;
- data |= (uint16_t)m_i2ControlCtx.readReg(reg+1);
- return data;
-}
-
-uint8_t
-HTU21D::i2cReadReg_8 (int reg) {
- m_i2ControlCtx.address(m_controlAddr);
- return m_i2ControlCtx.readReg(reg);
-}
-
diff --git a/peripheral/libupm/src/htu21d/htu21d.h b/peripheral/libupm/src/htu21d/htu21d.h
deleted file mode 100644
index 910d351..0000000
--- a/peripheral/libupm/src/htu21d/htu21d.h
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * Author: William Penner <william.penner@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-#pragma once
-
-#include <string>
-#include <mraa/i2c.hpp>
-#include <math.h>
-
-#define HTU21D_NAME "htu21d"
-#define HTU21D_I2C_ADDRESS 0x40
-
-/* HTU21D Commands */
-#define HTU21D_READ_TEMP_HOLD 0xE3
-#define HTU21D_READ_HUMIDITY_HOLD 0xE5
-#define HTU21D_WRITE_USER_REG 0xE6
-#define HTU21D_READ_USER_REG 0xE7
-#define HTU21D_SOFT_RESET 0xFE
-
-/* User Register Bit Definition */
-#define HTU21D_DISABLE_OTP 0x02
-#define HTU21D_HEATER_ENABLE 0x04
-#define HTU21D_END_OF_BATTERY 0x40
-#define HTU21D_RESO_RH12_T14 0x00
-#define HTU21D_RESO_RH8_T12 0x01
-#define HTU21D_RESO_RH10_T13 0x80
-#define HTU21D_RESO_RH11_T11 0x81
-
-namespace upm {
-
-/**
- * @brief HTU21D Humidity Sensor library
- * @defgroup htu21d libupm-htu21d
- * @ingroup seeed adafruit sparkfun i2c temp
- */
-
-/**
- * @library htu21d
- * @sensor htu21d
- * @comname HTU21D Temperature & Humidity Sensor
- * @type temp
- * @man seeed adafruit sparkfun
- * @web http://www.meas-spec.com/downloads/HTU21D.pdf
- * @con i2c
- *
- * @brief API for the HTU21D Temperature & Humidity Sensor
- *
- * HTU21D by Measurement Specialties is a digital humidity sensor with
- * temperature output.
- * RH reports between 0 and 100%, and the temperature range is
- * -40 to +125 degC. Note: getCompRH is the preferred
- * function below (passing true to cause a measurement cycle). If
- * actual values used for the compensated ready are necessary, use
- * the getHumidity(false) and getTemperature(false) functions following
- * the getCompRH call.
- * Also note the sensor should not perform more than a couple of
- * measurements per second to limit the heating of the sensor.
- *
- * @image html htu21d.jpeg
- * @snippet htu21d.cxx Interesting
- */
-class HTU21D {
- public:
- /**
- * Instantiates an HTU21D object
- *
- * @param bus Number of the used bus
- * @param devAddr Address of the used I2C device
- * @param mode HTU21D oversampling
- */
- HTU21D (int bus, int devAddr=HTU21D_I2C_ADDRESS);
-
- /**
- * Initiates a temperature/pressure mesasurement and waits for the function
- * to complete. The humidity and temperature registers can be read
- * after this call.
- */
- int sampleData(void);
-
- /**
- * Gets the current measured humidity [RH]
- */
- float getHumidity(int bSampleData = false);
-
- /**
- * Gets the humidity cell temperature [degC]
- */
- float getTemperature(int bSampleData = false);
-
- /**
- * Using the current humidity and temperature, the function
- * calculates the compensated RH using the equation from
- * the datasheet.
- */
- float getCompRH(int bSampleData = true);
-
- /**
- * Sets the heater state. The heater is used to test
- * the sensor functionality since the temperature should increase
- * 0.5 to 1.5 degC, and the humidity should decrease. The
- * testSensor() function below uses the heater.
- *
- * @param bEnable Sets to non-zero to turn the heater on
- */
- int setHeater(int bEnable = false);
-
- /**
- * Performs a soft reset of the MPL3115A2 device to ensure
- * it is in a known state. This function can be used to reset
- * the min/max temperature and pressure values.
- */
- void resetSensor(void);
-
- /**
- * Tests the device and verifies it
- * is operating correctly.
- *
- */
- int testSensor(void);
-
- /**
- * Writes to a one-byte register
- *
- * @param reg Address of the register
- * @param value Byte to be written
- */
- mraa::Result i2cWriteReg (uint8_t reg, uint8_t value);
-
- /**
- * Reads a two-byte register
- *
- * @param reg Address of the register
- */
- uint16_t i2cReadReg_16 (int reg);
-
- /**
- * Reads a one-byte register
- *
- * @param reg Address of the register
- */
- uint8_t i2cReadReg_8 (int reg);
-
- private:
-
- /**
- * Converts the temperature register to degC * 1000
- */
- int32_t convertTemp(int32_t regval);
-
- /**
- * Converts the RH register to %RH * 1000
- */
- int32_t convertRH(int32_t regval);
-
- std::string m_name;
-
- int m_controlAddr;
- int m_bus;
- mraa::I2c m_i2ControlCtx;
-
- int32_t m_temperature;
- int32_t m_humidity;
-};
-
-}
diff --git a/peripheral/libupm/src/htu21d/javaupm_htu21d.i b/peripheral/libupm/src/htu21d/javaupm_htu21d.i
deleted file mode 100644
index 7c6b1ef..0000000
--- a/peripheral/libupm/src/htu21d/javaupm_htu21d.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_htu21d
-%include "../upm.i"
-
-%{
- #include "htu21d.h"
-%}
-
-%include "htu21d.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_htu21d");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/htu21d/jsupm_htu21d.i b/peripheral/libupm/src/htu21d/jsupm_htu21d.i
deleted file mode 100644
index e6d9c9d..0000000
--- a/peripheral/libupm/src/htu21d/jsupm_htu21d.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_htu21d
-%include "../upm.i"
-
-%{
- #include "htu21d.h"
-%}
-
-%include "htu21d.h"
diff --git a/peripheral/libupm/src/htu21d/pyupm_htu21d.i b/peripheral/libupm/src/htu21d/pyupm_htu21d.i
deleted file mode 100644
index 6f87b98..0000000
--- a/peripheral/libupm/src/htu21d/pyupm_htu21d.i
+++ /dev/null
@@ -1,15 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_htu21d
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-#ifdef DOXYGEN
-%include "htu21d_doc.i"
-#endif
-
-%include "htu21d.h"
-%{
- #include "htu21d.h"
-%}
diff --git a/peripheral/libupm/src/hwxpxx/CMakeLists.txt b/peripheral/libupm/src/hwxpxx/CMakeLists.txt
deleted file mode 100644
index 47bee1a..0000000
--- a/peripheral/libupm/src/hwxpxx/CMakeLists.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-set (libname "hwxpxx")
-set (libdescription "upm module for the Veris HWXPXX (HWXPHTX)")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-
-pkg_search_module(MODBUS libmodbus)
-if (MODBUS_FOUND)
- set (reqlibname "libmodbus")
- include_directories(${MODBUS_INCLUDE_DIRS})
- upm_module_init()
- add_dependencies(${libname} ${MODBUS_LIBRARIES})
- target_link_libraries(${libname} ${MODBUS_LIBRARIES})
- if (BUILDSWIG)
- if (BUILDSWIGNODE)
- swig_link_libraries (jsupm_${libname} ${MODBUS_LIBRARIES} ${MRAA_LIBRARIES} ${NODE_LIBRARIES})
- endif()
- if (BUILDSWIGPYTHON)
- swig_link_libraries (pyupm_${libname} ${MODBUS_LIBRARIES} ${PYTHON_LIBRARIES} ${MRAA_LIBRARIES})
- endif()
- endif()
-endif ()
diff --git a/peripheral/libupm/src/hwxpxx/hwxpxx.cxx b/peripheral/libupm/src/hwxpxx/hwxpxx.cxx
deleted file mode 100644
index 78753ce..0000000
--- a/peripheral/libupm/src/hwxpxx/hwxpxx.cxx
+++ /dev/null
@@ -1,379 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2016 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <stdexcept>
-#include <string>
-
-#include "hwxpxx.h"
-
-using namespace upm;
-using namespace std;
-
-// conversion from fahrenheit to celcius and back
-
-static float f2c(float f)
-{
- return ((f - 32.0) / (9.0 / 5.0));
-}
-
-static float c2f(float c)
-{
- return (c * (9.0 / 5.0) + 32.0);
-}
-
-HWXPXX::HWXPXX(std::string device, int address, int baud, int bits, char parity,
- int stopBits) :
- m_mbContext(0)
-{
- // check some of the parameters
- if (!(bits == 7 || bits == 8))
- {
- throw std::out_of_range(std::string(__FUNCTION__) +
- ": bits must be 7 or 8");
- }
-
- if (!(parity == 'N' || parity == 'E' || parity == 'O'))
- {
- throw std::out_of_range(std::string(__FUNCTION__) +
- ": parity must be 'N', 'O', or 'E'");
- }
-
- if (!(stopBits == 1 || stopBits == 2))
- {
- throw std::out_of_range(std::string(__FUNCTION__) +
- ": stopBits must be 1 or 2");
- }
-
- m_temperature = 0.0;
- m_humidity = 0.0;
- m_slider = 0;
-
- // now, open/init the device and modbus context
-
- if (!(m_mbContext = modbus_new_rtu(device.c_str(), baud, parity, bits,
- stopBits)))
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": modbus_new_rtu() failed");
- }
-
- // set the slave address of the device we want to talk to
-
- // addresses are only 8bits wide
- address &= 0xff;
- if (modbus_set_slave(m_mbContext, address))
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": modbus_set_slave() failed");
- }
-
- // set the serial mode
- modbus_rtu_set_serial_mode(m_mbContext, MODBUS_RTU_RS232);
-
- // now connect..
- if (modbus_connect(m_mbContext))
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": modbus_connect() failed");
- }
-
- // read the 2 coils to determine temperature scale and current status
- // of (optional) override switch
- uint8_t coils[2];
- readCoils(COIL_TEMP_SCALE, 2, coils);
-
- // temp scale
- if (coils[0])
- m_isCelcius = false;
- else
- m_isCelcius = true;
-
- // current override switch status
- m_override = ((coils[1]) ? true : false);
-
- // turn off debugging
- setDebug(false);
-}
-
-HWXPXX::~HWXPXX()
-{
- if (m_mbContext)
- {
- modbus_close(m_mbContext);
- modbus_free(m_mbContext);
- }
-}
-
-int HWXPXX::readInputRegs(INPUT_REGS_T reg, int len, uint16_t *buf)
-{
- int rv;
-
- if ((rv = modbus_read_input_registers(m_mbContext, reg, len, buf)) < 0)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": modbus_read_input_registers() failed");
- }
-
- return rv;
-}
-
-uint16_t HWXPXX::readInputReg(INPUT_REGS_T reg)
-{
- uint16_t val;
-
- if (readInputRegs(reg, 1, &val) != 1)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": readInputRegs() returned bad data");
- }
-
- return val;
-}
-
-int HWXPXX::readHoldingRegs(HOLDING_REGS_T reg, int len, uint16_t *buf)
-{
- int rv;
-
- if ((rv = modbus_read_registers(m_mbContext, reg, len, buf)) < 0)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": modbus_read_registers() failed");
- }
-
- return rv;
-}
-
-uint16_t HWXPXX::readHoldingReg(HOLDING_REGS_T reg)
-{
- uint16_t val;
-
- if (readHoldingRegs(reg, 1, &val) != 1)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": readInputRegs() returned bad data");
- }
-
- return val;
-}
-
-void HWXPXX::writeHoldingReg(HOLDING_REGS_T reg, int value)
-{
- if (modbus_write_register(m_mbContext, reg, value) != 1)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": modbus_write_register() failed");
- }
-}
-
-int HWXPXX::readCoils(COIL_REGS_T reg, int numBits, uint8_t *buf)
-{
- int rv;
-
- if ((rv = modbus_read_bits(m_mbContext, reg, numBits, buf)) < 0)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": modbus_read_bits() failed");
- }
-
- return rv;
-}
-
-bool HWXPXX::readCoil(COIL_REGS_T reg)
-{
- uint8_t buf;
-
- if (readCoils(reg, 1, &buf) != 1)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": readCoils() returned bad data");
- }
-
- return ((buf) ? true : false);
-}
-
-void HWXPXX::writeCoil(COIL_REGS_T reg, bool val)
-{
- int value = (val) ? TRUE : FALSE;
-
- if (modbus_write_bit(m_mbContext, reg, value) != 1)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": modbus_write_bit() failed");
- }
-}
-
-void HWXPXX::update()
-{
- static const int dataLen = 3;
- uint16_t data[dataLen];
-
- // we read 3 input registers starting at humidity
- if (readInputRegs(INPUT_HUMIDITY, dataLen, data) != dataLen)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": readInputRegs() failed to read 3 registers");
- }
-
- // humidity
- m_humidity = float((int16_t)data[0]) / 10.0;
-
- // temperature, we always store as C
- float tmpF = float((int16_t)data[1]) / 10.0;
-
- if (m_isCelcius)
- m_temperature = tmpF;
- else
- m_temperature = f2c(tmpF);
-
- // optional slider level
- m_slider = int(data[2]);
-
- // optional override switch status
- m_override = readCoil(COIL_OVERRIDE);
-}
-
-float HWXPXX::getTemperature(bool fahrenheit)
-{
- if (fahrenheit)
- return c2f(m_temperature);
- else
- return m_temperature;
-}
-
-float HWXPXX::getHumidity()
-{
- return m_humidity;
-}
-
-int HWXPXX::getSlider()
-{
- return m_slider;
-}
-
-bool HWXPXX::getOverrideSwitchStatus()
-{
- return m_override;
-}
-
-int HWXPXX::getTemperatureOffset()
-{
- return int((int16_t)readHoldingReg(HOLDING_TEMP_OFFSET));
-}
-
-int HWXPXX::getHumidityOffset()
-{
- return int((int16_t)readHoldingReg(HOLDING_HUM_OFFSET));
-}
-
-void HWXPXX::setTemperatureOffset(int offset)
-{
- if (offset < -50 || offset > 50)
- {
- throw std::out_of_range(std::string(__FUNCTION__) +
- ": offset must be between -50 to 50");
- }
-
- writeHoldingReg(HOLDING_TEMP_OFFSET, offset);
-}
-
-void HWXPXX::setHumidityOffset(int offset)
-{
- if (offset < -100 || offset > 100)
- {
- throw std::out_of_range(std::string(__FUNCTION__) +
- ": offset must be between -100 to 100");
- }
-
- writeHoldingReg(HOLDING_HUM_OFFSET, offset);
-}
-
-void HWXPXX::clearOverrideSwitch()
-{
- writeCoil(COIL_OVERRIDE, false);
-}
-
-void HWXPXX::setTemperatureScale(bool fahrenheit)
-{
- writeCoil(COIL_TEMP_SCALE, fahrenheit);
-
- // now re-read and set m_isCelcius properly
- if (readCoil(COIL_TEMP_SCALE))
- m_isCelcius = false;
- else
- m_isCelcius = true;
-}
-
-string HWXPXX::getSlaveID()
-{
- uint8_t id[MODBUS_MAX_PDU_LENGTH];
- int rv;
-
- if ((rv = modbus_report_slave_id(m_mbContext, MODBUS_MAX_PDU_LENGTH, id)) < 0)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": modbus_report_slave_id() failed");
- }
-
- // the first byte is the number of bytes in the response, the second
- // byte is the active indicator (00 = off, ff = on), and the rest
- // are ascii identification (company, model, and serial number) data.
-
- if (rv > 2)
- {
- string retID((char *)&id[2], rv - 2);
- return retID;
- }
- else
- return "";
-}
-
-void HWXPXX::setSlaveAddress(int addr)
-{
- // addresses are only 8bits wide
- addr &= 0xff;
-
- if (modbus_set_slave(m_mbContext, addr))
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": modbus_set_slave() failed");
- }
-
- // now re-read and set m_isCelcius properly
- if (readCoil(COIL_TEMP_SCALE))
- m_isCelcius = false;
- else
- m_isCelcius = true;
-}
-
-void HWXPXX::setDebug(bool enable)
-{
- m_debugging = enable;
-
- if (enable)
- modbus_set_debug(m_mbContext, 1);
- else
- modbus_set_debug(m_mbContext, 0);
-}
diff --git a/peripheral/libupm/src/hwxpxx/hwxpxx.h b/peripheral/libupm/src/hwxpxx/hwxpxx.h
deleted file mode 100644
index 1d2da73..0000000
--- a/peripheral/libupm/src/hwxpxx/hwxpxx.h
+++ /dev/null
@@ -1,283 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2016 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-
-#include <modbus/modbus.h>
-
-namespace upm {
-
- /**
- * @brief HWXPXX Hardware Protocol Humidity and Temperature Sensor
- * @defgroup hwxpxx libupm-hwxpxx
- * @ingroup uart temp
- */
-
- /**
- * @library hwxpxx
- * @sensor hwxpxx
- * @comname UPM API for the Veris HWXPXX Hardware Protocol Humidity and Temperature Sensor
- * @type temp
- * @man veris
- * @con uart
- * @web http://cpengineerscorp.net/veris-industries-hwxphtx.html
- *
- * @brief UPM API for the Veris HWXPXX Hardware Protocol Humidity and Temperature Sensor
- *
- * This module implements support for the Veris HWXPHTX Hardware
- * Protocol Humidity and Temperature Sensor family. It uses MODBUS
- * over an RS485 interface. You must have libmodbus v3.1.2 (or
- * greater) installed to compile and use this driver.
- *
- * This module was developed using libmodbus 3.1.2, and the HWXPHTX.
- * This sensor supports humidity, and optionally, temperature,
- * slider switch, and override switch reporting. The HWXPHTX used to
- * develop this driver did not include the optional slider or
- * override switches, however support for them is provided.
- *
- * It was developed using an RS232->RS485 inteface. You cannot use
- * the built in MCU TTL UART pins for accessing this device -- you
- * must use a full serial RS232->RS485 interface connected via USB.
- *
- * @snippet hwxpxx.cxx Interesting
- */
-
- class HWXPXX {
- public:
- // MODBUS input registers
- typedef enum {
- INPUT_HUMIDITY = 0x0000,
- // optional temp sensor
- INPUT_TEMPERATURE = 0x0001,
- // optional slider input
- INPUT_SLIDER = 0x0002
- } INPUT_REGS_T;
-
- // MODBUS coil registers
- typedef enum {
- // device reports in C or F?
- COIL_TEMP_SCALE = 0x0000,
-
- // optional override button status
- COIL_OVERRIDE = 0x0001
- } COIL_REGS_T;
-
- // MODBUS holding registers
- typedef enum {
- HOLDING_TEMP_OFFSET = 0x0000,
- HOLDING_HUM_OFFSET = 0x0001
- } HOLDING_REGS_T;
-
- /**
- * HWXPXX constructor
- *
- * @param device Path to the serial device
- * @param address The MODBUS slave address
- * @param baud The baudrate of the device. Default: 19200
- * @param bits The number of bits per byte. Default: 8
- * @param parity The parity of the connection, 'N' for None, 'E'
- * for Even, 'O' for Odd. Default: 'N'
- * @param stopBits The number of stop bits. Default: 2
- */
- HWXPXX(std::string device, int address, int baud=19200, int bits=8,
- char parity='N', int stopBits=2);
-
- /**
- * HWXPXX Destructor
- */
- ~HWXPXX();
-
- /**
- * Read current values from the sensor and update internal stored
- * values. This method must be called prior to querying any
- * values, such as temperature, humidity, override switch status,
- * or slider switch status.
- */
- void update();
-
- /**
- * Get the current temperature. update() must have been called
- * prior to calling this method. If this option was not
- * installed, this method will always return 0C/0F, depending on
- * the scale the device is operating in natively.
- *
- * @param fahrenheit true to return the temperature in degrees
- * fahrenheit, false to return the temperature in degrees celcius.
- * The default is false (degrees Celcius).
- * @return The last temperature reading in Celcius or Fahrenheit
- */
- float getTemperature(bool fahrenheit=false);
-
- /**
- * Get the current relative humidity. update() must have been called
- * prior to calling this method.
- *
- * @return The last humidity reading
- */
- float getHumidity();
-
- /**
- * Get the current slider switch position. update() must have
- * been called prior to calling this method. This returns a value
- * between 0-100 corresponding to the position of the slider
- * switch. If this option is not installed, this method will
- * always return 0.
- *
- * @return The last slider switch reading
- */
- int getSlider();
-
- /**
- * Get the current override switch status. update() must have
- * been called prior to calling this method. This returns true if
- * the override switch was pressed. Use clearOverrideSwitch() to
- * reset this value to false. If this option is not installed,
- * then this method will always return false. It is not possible
- * to programatically set this value to true - that can only be
- * done by physically pressing the override switch.
- *
- * @return The last overide switch status reading
- */
- bool getOverrideSwitchStatus();
-
- /**
- * Clear the override switch status (set it to false). If this
- * option is not installed, then this method will have no effect
- * (the overide switch status will always be false).
- *
- */
- void clearOverrideSwitch();
-
- /**
- * Return the current temperature offset stored on the device.
- * This is a value between -50 and +50, specified in tenths of a
- * degree in whatever scale (Celcius or Fahrenheit) is in use.
- * This offset is applied to the returned temperature reading by the
- * device.
- *
- * @return The current temperature offset in tenths of a degree
- */
- int getTemperatureOffset();
-
- /**
- * Return the current humidity offset stored on the device. This
- * is a value between -100 and +100, specified in tenths of a
- * percent. This offset is applied to the returned humidity
- * reading by the device.
- *
- * @return The current humidity offset in tenths of a percent
- */
- int getHumidityOffset();
-
- /**
- * Set the stored temperature offset on the device. This is a
- * value between -50 and +50, specified in tenths of a degree in
- * what ever scale (Celcius or Fahrenheit) is in use. This offset
- * is applied to the returned temperature reading by the device.
- *
- * @param offset Offset in tenths of a degree with a range of -50 to +50
- */
- void setTemperatureOffset(int offset);
-
- /**
- * Set the stored humidity offset on the device. This is a value
- * between -100 and +100, specified in tenths of a percent. This
- * offset is applied to the returned humidity reading by the
- * device.
- *
- * @param offset Offset in tenths of a percent with a range of -100 to +100
- */
- void setHumidityOffset(int offset);
-
- /**
- * Set the temperature scale used by the device. This driver
- * detects this setting automatically and adjusts itself
- * accordingly, so this is generally never needed. It is used to
- * set the native reporting scale of the temperature either in
- * degrees Celcius or Fahrenheit. Its setting will not affect
- * the operation of getTemperature().
- *
- * @param fahrenheit true to set Fahrenheit, false to set Celcius
- */
- void setTemperatureScale(bool fahrenheit);
-
- /**
- * Return a string corresponding the the device's MODBUS slave ID.
- * This includes information such as the manufacturer, device
- * model number and serial number.
- *
- * @return string represnting the MODBUS slave ID
- */
- std::string getSlaveID();
-
- /**
- * Set a new MODBUS slave address. This is useful if you have
- * multiple HWXPXX devices on a single bus. When this method is
- * called, the current temperature scale is re-read so that
- * further update() calls can work correctly.
- *
- * @param addr The new slave address to set
- */
- void setSlaveAddress(int addr);
-
- /**
- * Enable or disable debugging output. This primarily enables and
- * disables libmodbus debugging output.
- *
- * @param enable true to enable debugging, false otherwise
- */
- void setDebug(bool enable);
-
- protected:
- // input registers
- int readInputRegs(INPUT_REGS_T reg, int len, uint16_t *buf);
- uint16_t readInputReg(INPUT_REGS_T reg);
-
- // coils
- int readCoils(COIL_REGS_T reg, int numBits, uint8_t *buf);
- bool readCoil(COIL_REGS_T reg);
- void writeCoil(COIL_REGS_T reg, bool val);
-
- // holding registers
- int readHoldingRegs(HOLDING_REGS_T reg, int len, uint16_t *buf);
- uint16_t readHoldingReg(HOLDING_REGS_T reg);
- void writeHoldingReg(HOLDING_REGS_T reg, int value);
-
- // MODBUS context
- modbus_t *m_mbContext;
-
- // is the device reporting in C or F?
- bool m_isCelcius;
-
- private:
- bool m_debugging;
-
- // data
- float m_temperature;
- float m_humidity; // relative
- int m_slider; // optional slider value
- bool m_override; // status of override switch
- };
-}
diff --git a/peripheral/libupm/src/hwxpxx/javaupm_hwxpxx.i b/peripheral/libupm/src/hwxpxx/javaupm_hwxpxx.i
deleted file mode 100644
index f6f849b..0000000
--- a/peripheral/libupm/src/hwxpxx/javaupm_hwxpxx.i
+++ /dev/null
@@ -1,20 +0,0 @@
-%module javaupm_hwxpxx
-%include "../upm.i"
-%include "typemaps.i"
-
-%{
- #include "hwxpxx.h"
-%}
-
-%include "hwxpxx.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_hwxpxx");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%}
diff --git a/peripheral/libupm/src/hwxpxx/jsupm_hwxpxx.i b/peripheral/libupm/src/hwxpxx/jsupm_hwxpxx.i
deleted file mode 100644
index 2620000..0000000
--- a/peripheral/libupm/src/hwxpxx/jsupm_hwxpxx.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_hwxpxx
-%include "../upm.i"
-%include "stdint.i"
-
-%include "hwxpxx.h"
-%{
- #include "hwxpxx.h"
-%}
diff --git a/peripheral/libupm/src/hwxpxx/pyupm_hwxpxx.i b/peripheral/libupm/src/hwxpxx/pyupm_hwxpxx.i
deleted file mode 100644
index fcfec09..0000000
--- a/peripheral/libupm/src/hwxpxx/pyupm_hwxpxx.i
+++ /dev/null
@@ -1,12 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_hwxpxx
-%include "../upm.i"
-%include "stdint.i"
-
-%feature("autodoc", "3");
-
-%include "hwxpxx.h"
-%{
- #include "hwxpxx.h"
-%}
diff --git a/peripheral/libupm/src/hx711/CMakeLists.txt b/peripheral/libupm/src/hx711/CMakeLists.txt
deleted file mode 100644
index 8cdf95e..0000000
--- a/peripheral/libupm/src/hx711/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "hx711")
-set (libdescription "HX711 24bit ADC")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/hx711/hx711.cxx b/peripheral/libupm/src/hx711/hx711.cxx
deleted file mode 100644
index 28e60bf..0000000
--- a/peripheral/libupm/src/hx711/hx711.cxx
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Author: Rafael da Mata Neri <rafael.neri@gmail.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- * the Software, and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#include <iostream>
-#include <fstream>
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdexcept>
-#include "hx711.h"
-
-using namespace upm;
-using namespace std;
-
-HX711::HX711(uint8_t data, uint8_t sck, uint8_t gain) {
- mraa_result_t error = MRAA_SUCCESS;
-
- this->m_dataPinCtx = mraa_gpio_init(data);
- if (this->m_dataPinCtx == NULL) {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": Couldn't initialize DATA pin.");
- }
-
- this->m_sckPinCtx = mraa_gpio_init(sck);
- if (this->m_sckPinCtx == NULL) {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": Couldn't initialize CLOCK pin.");
- }
-
- error = mraa_gpio_dir (this->m_dataPinCtx, MRAA_GPIO_IN);
- if (error != MRAA_SUCCESS) {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": Couldn't set direction for DATA pin.");
- }
-
- error = mraa_gpio_dir (this->m_sckPinCtx, MRAA_GPIO_OUT);
- if (error != MRAA_SUCCESS) {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": Couldn't set direction for CLOCK pin.");
- }
-
- this->setGain(gain);
-}
-
-HX711::~HX711() {
- mraa_result_t error = MRAA_SUCCESS;
-
- error = mraa_gpio_close (this->m_dataPinCtx);
- if (error != MRAA_SUCCESS) {
- mraa_result_print(error);
- }
-
- error = mraa_gpio_close (this->m_sckPinCtx);
- if (error != MRAA_SUCCESS) {
- mraa_result_print(error);
- }
-}
-
-unsigned long HX711::read() {
- unsigned long Count = 0;
-
- while (mraa_gpio_read(this->m_dataPinCtx));
-
- for (int i=0; i<GAIN; i++)
- {
- mraa_gpio_write(this->m_sckPinCtx, 1);
- Count = Count << 1;
- mraa_gpio_write(this->m_sckPinCtx, 0);
- if(mraa_gpio_read(this->m_dataPinCtx))
- {
- Count++;
- }
- }
-
- mraa_gpio_write(this->m_sckPinCtx, 1);
- Count = Count ^ 0x800000;
- mraa_gpio_write(this->m_sckPinCtx, 0);
-
- return (Count);
-}
-
-void HX711::setGain(uint8_t gain){
- switch (gain) {
- case 128: // channel A, gain factor 128
- GAIN = 24;
- break;
- case 64: // channel A, gain factor 64
- GAIN = 26;
- break;
- case 32: // channel B, gain factor 32
- GAIN = 25;
- break;
- }
-
- mraa_gpio_write(this->m_sckPinCtx, 0);
- read();
-}
-
-unsigned long HX711::readAverage(uint8_t times){
- unsigned long sum = 0;
- for (uint8_t i = 0; i < times; i++) {
- sum += read();
- }
- return sum / times;
-}
-
-double HX711::getValue(uint8_t times){
- return readAverage(times) - OFFSET;
-}
-
-float HX711::getUnits(uint8_t times){
- return getValue(times) / SCALE;
-}
-
-void HX711::tare(uint8_t times){
- double sum = readAverage(times);
- setOffset(sum);
-}
-
-void HX711::setScale(float scale){
- SCALE = scale;
-}
-
-void HX711::setOffset(long offset){
- OFFSET = offset;
-}
diff --git a/peripheral/libupm/src/hx711/hx711.h b/peripheral/libupm/src/hx711/hx711.h
deleted file mode 100644
index 4047fbc..0000000
--- a/peripheral/libupm/src/hx711/hx711.h
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Author: Rafael da Mata Neri <rafael.neri@gmail.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- * the Software, and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <string.h>
-#include <mraa/gpio.h>
-
-namespace upm {
- /**
- * @brief HX711 24-bit ADC library
- * @defgroup hx711 libupm-hx711
- * @ingroup generic gpio electric
- */
-
- /**
- * @library hx711
- * @sensor hx711
- * @comname HX711 Analog-to-Digital Converter
- * @type electric
- * @man generic
- * @web http://www.dfrobot.com/image/data/SEN0160/hx711_english.pdf
- * @con gpio
- *
- * @brief API for the HX711 Analog-to-Digital Converter
- *
- * HX711 is a precision 24-bit analog-to-digital converter (ADC)
- * designed for weight scales and industrial control applications to
- * interface directly with a bridge sensor. This module was tested on
- * the Intel(R) Galileo Gen 2 board.
- *
- * @image html hx711.jpeg
- * @snippet hx711.cxx Interesting
- */
- class HX711 {
- public:
- /**
- * HX711 constructor
- *
- * @param data Defines the data pin
- * @param sck Defines the clock pin
- * @param gain Defines the gain factor
- * Valid values are 128 or 64 for channel A; channel B works with a 32-gain factor only
- */
- HX711(uint8_t data, uint8_t sck, uint8_t gain = 128);
-
- /**
- * HX711 destructor
- */
- ~HX711();
-
- /**
- * Waits for the chip to be ready and returns a reading
- *
- * @return Raw ADC reading
- */
- unsigned long read();
-
- /**
- * Sets the gain factor; takes effect only after a call to read()
- * channel A can be set for a 128 or 64 gain; channel B has a fixed 32-gain
- * factor depending on the parameter; the channel is also set to either A or B
- * @param gain Defines the gain factor
- */
- void setGain(uint8_t gain = 128);
-
- /**
- * Returns an average reading
- * @param times Defines how many reading to do
- * @return Average reading
- */
- unsigned long readAverage(uint8_t times = 10);
-
- /**
- * Returns (readAverage() - OFFSET)
- * @param times Defines how many readings to do
- * @return Current value without the tare weight
- */
- double getValue(uint8_t times = 10);
-
- /**
- * Returns getValue() divided by SCALE
- * @param times Defines how many readings to do
- * @return Raw value divided by a value obtained via calibration
- */
- float getUnits(uint8_t times = 1);
-
- /**
- * Sets the OFFSET value for the tare weight
- * @param times Defines how many times to read the tare value
- */
- void tare(uint8_t times = 10);
-
- /**
- * Sets the SCALE value
- * This value is used to convert the raw data to human-readable data (measurement units)
- * @param scale Value obtained via calibration
- */
- void setScale(float scale = 1.f);
- private:
- mraa_gpio_context m_sckPinCtx; // Power Down and Serial Clock Input Pin
- mraa_gpio_context m_dataPinCtx; // Serial Data Output Pin
-
- uint8_t GAIN; // amplification factor
- unsigned long OFFSET; // used for tare weight
- float SCALE; // used to return weight in grams, kg, ounces, whatever
-
-
- /**
- * Sets the OFFSET value
- * This value is subtracted from the actual reading (tare weight)
- * @param scale Value obtained via calibration
- */
- void setOffset(long offset = 0);
- };
-
-}
diff --git a/peripheral/libupm/src/hx711/javaupm_hx711.i b/peripheral/libupm/src/hx711/javaupm_hx711.i
deleted file mode 100644
index 2d8fdf5..0000000
--- a/peripheral/libupm/src/hx711/javaupm_hx711.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_hx711
-%include "../upm.i"
-
-%{
- #include "hx711.h"
-%}
-
-%include "hx711.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_hx711");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/hx711/jsupm_hx711.i b/peripheral/libupm/src/hx711/jsupm_hx711.i
deleted file mode 100644
index ddaabe9..0000000
--- a/peripheral/libupm/src/hx711/jsupm_hx711.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_hx711
-%include "../upm.i"
-
-%{
- #include "hx711.h"
-%}
-
-%include "hx711.h"
diff --git a/peripheral/libupm/src/hx711/pyupm_hx711.i b/peripheral/libupm/src/hx711/pyupm_hx711.i
deleted file mode 100644
index 8d313f0..0000000
--- a/peripheral/libupm/src/hx711/pyupm_hx711.i
+++ /dev/null
@@ -1,12 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_hx711
-%include "../upm.i"
-%include "stdint.i"
-
-%feature("autodoc", "3");
-
-%include "hx711.h"
-%{
- #include "hx711.h"
-%}
diff --git a/peripheral/libupm/src/ili9341/CMakeLists.txt b/peripheral/libupm/src/ili9341/CMakeLists.txt
deleted file mode 100644
index 6998826..0000000
--- a/peripheral/libupm/src/ili9341/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "ili9341")
-set (libdescription "libupm ILI9341 SPI LCD")
-set (module_src gfx.cxx ili9341.cxx)
-set (module_h gfx.h ili9341.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/ili9341/gfx.cxx b/peripheral/libupm/src/ili9341/gfx.cxx
deleted file mode 100644
index 90f83de..0000000
--- a/peripheral/libupm/src/ili9341/gfx.cxx
+++ /dev/null
@@ -1,749 +0,0 @@
-/**
- * Author: Shawn Hymel
- * Copyright (c) 2016 SparkFun Electronics
- *
- * Based on GFX interface by Yevgeniy Kiveisha and Adafruit Industries.
- *
- * 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 "gfx.h"
-
-using namespace upm;
-
-GFX::GFX(int16_t w, int16_t h) : WIDTH(w), HEIGHT(h) {
- _width = WIDTH;
- _height = HEIGHT;
- rotation = 0;
-
- cursor_x = 0;
- cursor_y = 0;
- textsize = 1;
- textcolor = 0xFFFF;
- textbgcolor = 0xFFFF;
- wrap = true;
- _cp437 = false;
-}
-
-void GFX::drawLine(int16_t x0,
- int16_t y0,
- int16_t x1,
- int16_t y1,
- uint16_t color) {
-
- int16_t steep = abs(y1 - y0) > abs(x1 - x0);
- if (steep) {
- adagfxswap(x0, y0);
- adagfxswap(x1, y1);
- }
-
- if (x0 > x1) {
- adagfxswap(x0, x1);
- adagfxswap(y0, y1);
- }
-
- int16_t dx, dy;
- dx = x1 - x0;
- dy = abs(y1 - y0);
-
- int16_t err = dx / 2;
- int16_t ystep;
-
- if (y0 < y1) {
- ystep = 1;
- } else {
- ystep = -1;
- }
-
- for (; x0<=x1; x0++) {
- if (steep) {
- drawPixel(y0, x0, color);
- } else {
- drawPixel(x0, y0, color);
- }
- err -= dy;
- if (err < 0) {
- y0 += ystep;
- err += dx;
- }
- }
-}
-
-void GFX::drawFastVLine(int16_t x,
- int16_t y,
- int16_t h,
- uint16_t color) {
- drawLine(x, y, x, y+h-1, color);
-}
-
-void GFX::drawFastHLine(int16_t x,
- int16_t y,
- int16_t w,
- uint16_t color) {
- drawLine(x, y, x+w-1, y, color);
-}
-
-void GFX::drawRect(int16_t x,
- int16_t y,
- int16_t w,
- int16_t h,
- uint16_t color) {
- drawFastHLine(x, y, w, color);
- drawFastHLine(x, y+h-1, w, color);
- drawFastVLine(x, y, h, color);
- drawFastVLine(x+w-1, y, h, color);
-}
-
-void GFX::fillRect(int16_t x,
- int16_t y,
- int16_t w,
- int16_t h,
- uint16_t color) {
- for (int16_t i=x; i<x+w; i++) {
- drawFastVLine(i, y, h, color);
- }
-}
-
-void GFX::fillScreen(uint16_t color) {
- fillRect(0, 0, _width, _height, color);
-}
-
-void GFX::invertDisplay(bool i) {
- // Do nothing, must be subclassed if supported by hardware
-}
-
-void GFX::drawCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color) {
- int16_t f = 1 - r;
- int16_t ddF_x = 1;
- int16_t ddF_y = -2 * r;
- int16_t x = 0;
- int16_t y = r;
-
- drawPixel(x0 , y0+r, color);
- drawPixel(x0 , y0-r, color);
- drawPixel(x0+r, y0 , color);
- drawPixel(x0-r, y0 , color);
-
- while (x<y) {
- if (f >= 0) {
- y--;
- ddF_y += 2;
- f += ddF_y;
- }
- x++;
- ddF_x += 2;
- f += ddF_x;
-
- drawPixel(x0 + x, y0 + y, color);
- drawPixel(x0 - x, y0 + y, color);
- drawPixel(x0 + x, y0 - y, color);
- drawPixel(x0 - x, y0 - y, color);
- drawPixel(x0 + y, y0 + x, color);
- drawPixel(x0 - y, y0 + x, color);
- drawPixel(x0 + y, y0 - x, color);
- drawPixel(x0 - y, y0 - x, color);
- }
-}
-
-void GFX::drawCircleHelper(int16_t x0,
- int16_t y0,
- int16_t r,
- uint8_t cornername,
- uint16_t color) {
- int16_t f = 1 - r;
- int16_t ddF_x = 1;
- int16_t ddF_y = -2 * r;
- int16_t x = 0;
- int16_t y = r;
-
- while (x<y) {
- if (f >= 0) {
- y--;
- ddF_y += 2;
- f += ddF_y;
- }
- x++;
- ddF_x += 2;
- f += ddF_x;
- if (cornername & 0x4) {
- drawPixel(x0 + x, y0 + y, color);
- drawPixel(x0 + y, y0 + x, color);
- }
- if (cornername & 0x2) {
- drawPixel(x0 + x, y0 - y, color);
- drawPixel(x0 + y, y0 - x, color);
- }
- if (cornername & 0x8) {
- drawPixel(x0 - y, y0 + x, color);
- drawPixel(x0 - x, y0 + y, color);
- }
- if (cornername & 0x1) {
- drawPixel(x0 - y, y0 - x, color);
- drawPixel(x0 - x, y0 - y, color);
- }
- }
-}
-
-void GFX::fillCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color) {
- drawFastVLine(x0, y0-r, 2*r+1, color);
- fillCircleHelper(x0, y0, r, 3, 0, color);
-}
-
-void GFX::fillCircleHelper(int16_t x0,
- int16_t y0,
- int16_t r,
- uint8_t cornername,
- int16_t delta,
- uint16_t color) {
- int16_t f = 1 - r;
- int16_t ddF_x = 1;
- int16_t ddF_y = -2 * r;
- int16_t x = 0;
- int16_t y = r;
-
- while (x<y) {
- if (f >= 0) {
- y--;
- ddF_y += 2;
- f += ddF_y;
- }
- x++;
- ddF_x += 2;
- f += ddF_x;
-
- if (cornername & 0x1) {
- drawFastVLine(x0+x, y0-y, 2*y+1+delta, color);
- drawFastVLine(x0+y, y0-x, 2*x+1+delta, color);
- }
- if (cornername & 0x2) {
- drawFastVLine(x0-x, y0-y, 2*y+1+delta, color);
- drawFastVLine(x0-y, y0-x, 2*x+1+delta, color);
- }
- }
-}
-
-void GFX::drawTriangle(int16_t x0,
- int16_t y0,
- int16_t x1,
- int16_t y1,
- int16_t x2,
- int16_t y2,
- uint16_t color) {
- drawLine(x0, y0, x1, y1, color);
- drawLine(x1, y1, x2, y2, color);
- drawLine(x2, y2, x0, y0, color);
-}
-
-void GFX::fillTriangle(int16_t x0,
- int16_t y0,
- int16_t x1,
- int16_t y1,
- int16_t x2,
- int16_t y2,
- uint16_t color) {
-
- int16_t a, b, y, last;
-
- // Sort coordinates by Y order (y2 >= y1 >= y0)
- if (y0 > y1) {
- adagfxswap(y0, y1); adagfxswap(x0, x1);
- }
- if (y1 > y2) {
- adagfxswap(y2, y1); adagfxswap(x2, x1);
- }
- if (y0 > y1) {
- adagfxswap(y0, y1); adagfxswap(x0, x1);
- }
-
- if(y0 == y2) { // Handle awkward all-on-same-line case as its own thing
- a = b = x0;
- if(x1 < a) a = x1;
- else if(x1 > b) b = x1;
- if(x2 < a) a = x2;
- else if(x2 > b) b = x2;
- drawFastHLine(a, y0, b-a+1, color);
- return;
- }
-
- int16_t
- dx01 = x1 - x0,
- dy01 = y1 - y0,
- dx02 = x2 - x0,
- dy02 = y2 - y0,
- dx12 = x2 - x1,
- dy12 = y2 - y1;
- int32_t
- sa = 0,
- sb = 0;
-
- // For upper part of triangle, find scanline crossings for segments
- // 0-1 and 0-2. If y1=y2 (flat-bottomed triangle), the scanline y1
- // is included here (and second loop will be skipped, avoiding a /0
- // error there), otherwise scanline y1 is skipped here and handled
- // in the second loop...which also avoids a /0 error here if y0=y1
- // (flat-topped triangle).
- if(y1 == y2) last = y1; // Include y1 scanline
- else last = y1-1; // Skip it
-
- for(y=y0; y<=last; y++) {
- a = x0 + sa / dy01;
- b = x0 + sb / dy02;
- sa += dx01;
- sb += dx02;
- /* longhand:
- a = x0 + (x1 - x0) * (y - y0) / (y1 - y0);
- b = x0 + (x2 - x0) * (y - y0) / (y2 - y0);
- */
- if(a > b) adagfxswap(a,b);
- drawFastHLine(a, y, b-a+1, color);
- }
-
- // For lower part of triangle, find scanline crossings for segments
- // 0-2 and 1-2. This loop is skipped if y1=y2.
- sa = dx12 * (y - y1);
- sb = dx02 * (y - y0);
- for(; y<=y2; y++) {
- a = x1 + sa / dy12;
- b = x0 + sb / dy02;
- sa += dx12;
- sb += dx02;
- /* longhand:
- a = x1 + (x2 - x1) * (y - y1) / (y2 - y1);
- b = x0 + (x2 - x0) * (y - y0) / (y2 - y0);
- */
- if(a > b) adagfxswap(a,b);
- drawFastHLine(a, y, b-a+1, color);
- }
-}
-
-// Draw a rounded rectangle
-void GFX::drawRoundRect(int16_t x,
- int16_t y,
- int16_t w,
- int16_t h,
- int16_t r,
- uint16_t color) {
-
- // smarter version
- drawFastHLine(x+r , y , w-2*r, color); // Top
- drawFastHLine(x+r , y+h-1, w-2*r, color); // Bottom
- drawFastVLine(x , y+r , h-2*r, color); // Left
- drawFastVLine(x+w-1, y+r , h-2*r, color); // Right
- // draw four corners
- drawCircleHelper(x+r , y+r , r, 1, color);
- drawCircleHelper(x+w-r-1, y+r , r, 2, color);
- drawCircleHelper(x+w-r-1, y+h-r-1, r, 4, color);
- drawCircleHelper(x+r , y+h-r-1, r, 8, color);
-}
-
-void GFX::fillRoundRect(int16_t x,
- int16_t y,
- int16_t w,
- int16_t h,
- int16_t r,
- uint16_t color) {
-
- // smarter version
- fillRect(x+r, y, w-2*r, h, color);
-
- // draw four corners
- fillCircleHelper(x+w-r-1, y+r, r, 1, h-2*r-1, color);
- fillCircleHelper(x+r , y+r, r, 2, h-2*r-1, color);
-}
-
-void GFX::drawChar(int16_t x,
- int16_t y,
- unsigned char c,
- uint16_t color,
- uint16_t bg,
- uint8_t size) {
-
- if((x >= _width) || // Clip right
- (y >= _height) || // Clip bottom
- ((x + 6 * size - 1) < 0) || // Clip left
- ((y + 8 * size - 1) < 0)) // Clip top
- return;
-
- if(!_cp437 && (c >= 176)) c++; // Handle 'classic' charset behavior
-
- for(int8_t i=0; i<6; i++ ) {
- uint8_t line;
- if(i < 5) line = font[(c * 5) + i];
- else line = 0x0;
- for(int8_t j=0; j<8; j++, line >>= 1) {
- if(line & 0x1) {
- if(size == 1) drawPixel(x+i, y+j, color);
- else fillRect(x+(i*size), y+(j*size), size, size, color);
- } else if(bg != color) {
- if(size == 1) drawPixel(x+i, y+j, bg);
- else fillRect(x+i*size, y+j*size, size, size, bg);
- }
- }
- }
-}
-
-int16_t GFX::getCursorX(void) const {
- return cursor_x;
-}
-
-int16_t GFX::getCursorY(void) const {
- return cursor_y;
-}
-
-void GFX::setCursor(int16_t x, int16_t y) {
- cursor_x = x;
- cursor_y = y;
-}
-
-void GFX::setTextColor(uint16_t c) {
- // For 'transparent' background, we'll set the bg
- // to the same as fg instead of using a flag
- textcolor = textbgcolor = c;
-}
-
-void GFX::setTextColor(uint16_t c, uint16_t bg) {
- textcolor = c;
- textbgcolor = bg;
-}
-
-void GFX::setTextSize(uint8_t s) {
- textsize = (s > 0) ? s : 1;
-}
-
-void GFX::setTextWrap(bool w) {
- wrap = w;
-}
-
-uint8_t GFX::getRotation(void) const {
- return rotation;
-}
-
-void GFX::setRotation(uint8_t r) {
- rotation = (r & 3);
- switch(rotation) {
- case 0:
- case 2:
- _width = WIDTH;
- _height = HEIGHT;
- break;
- case 1:
- case 3:
- _width = HEIGHT;
- _height = WIDTH;
- break;
- }
-}
-
-void GFX::cp437(bool x) {
- _cp437 = x;
-}
-
-void GFX::write(uint8_t c) {
-
- if(c == '\n') {
- cursor_y += textsize*8;
- cursor_x = 0;
- } else if(c == '\r') {
- // skip em
- } else {
-
- // Heading off edge?
- if(wrap && ((cursor_x + textsize * 6) >= _width)) {
- cursor_x = 0; // Reset x to zero
- cursor_y += textsize * 8; // Advance y one line
- }
- drawChar(cursor_x, cursor_y, c, textcolor, textbgcolor, textsize);
- cursor_x += textsize * 6;
- }
-}
-
-void GFX::print(std::string msg) {
- int len = msg.length();
- for (int idx = 0; idx < len; idx++) {
- write(msg[idx]);
- }
-}
-
-int16_t GFX::width(void) const {
- return _width;
-}
-
-int16_t GFX::height(void) const {
- return _height;
-}
-
-const unsigned char GFX::font[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x3E, 0x5B, 0x4F, 0x5B, 0x3E,
- 0x3E, 0x6B, 0x4F, 0x6B, 0x3E,
- 0x1C, 0x3E, 0x7C, 0x3E, 0x1C,
- 0x18, 0x3C, 0x7E, 0x3C, 0x18,
- 0x1C, 0x57, 0x7D, 0x57, 0x1C,
- 0x1C, 0x5E, 0x7F, 0x5E, 0x1C,
- 0x00, 0x18, 0x3C, 0x18, 0x00,
- 0xFF, 0xE7, 0xC3, 0xE7, 0xFF,
- 0x00, 0x18, 0x24, 0x18, 0x00,
- 0xFF, 0xE7, 0xDB, 0xE7, 0xFF,
- 0x30, 0x48, 0x3A, 0x06, 0x0E,
- 0x26, 0x29, 0x79, 0x29, 0x26,
- 0x40, 0x7F, 0x05, 0x05, 0x07,
- 0x40, 0x7F, 0x05, 0x25, 0x3F,
- 0x5A, 0x3C, 0xE7, 0x3C, 0x5A,
- 0x7F, 0x3E, 0x1C, 0x1C, 0x08,
- 0x08, 0x1C, 0x1C, 0x3E, 0x7F,
- 0x14, 0x22, 0x7F, 0x22, 0x14,
- 0x5F, 0x5F, 0x00, 0x5F, 0x5F,
- 0x06, 0x09, 0x7F, 0x01, 0x7F,
- 0x00, 0x66, 0x89, 0x95, 0x6A,
- 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x94, 0xA2, 0xFF, 0xA2, 0x94,
- 0x08, 0x04, 0x7E, 0x04, 0x08,
- 0x10, 0x20, 0x7E, 0x20, 0x10,
- 0x08, 0x08, 0x2A, 0x1C, 0x08,
- 0x08, 0x1C, 0x2A, 0x08, 0x08,
- 0x1E, 0x10, 0x10, 0x10, 0x10,
- 0x0C, 0x1E, 0x0C, 0x1E, 0x0C,
- 0x30, 0x38, 0x3E, 0x38, 0x30,
- 0x06, 0x0E, 0x3E, 0x0E, 0x06,
- 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x5F, 0x00, 0x00,
- 0x00, 0x07, 0x00, 0x07, 0x00,
- 0x14, 0x7F, 0x14, 0x7F, 0x14,
- 0x24, 0x2A, 0x7F, 0x2A, 0x12,
- 0x23, 0x13, 0x08, 0x64, 0x62,
- 0x36, 0x49, 0x56, 0x20, 0x50,
- 0x00, 0x08, 0x07, 0x03, 0x00,
- 0x00, 0x1C, 0x22, 0x41, 0x00,
- 0x00, 0x41, 0x22, 0x1C, 0x00,
- 0x2A, 0x1C, 0x7F, 0x1C, 0x2A,
- 0x08, 0x08, 0x3E, 0x08, 0x08,
- 0x00, 0x80, 0x70, 0x30, 0x00,
- 0x08, 0x08, 0x08, 0x08, 0x08,
- 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x20, 0x10, 0x08, 0x04, 0x02,
- 0x3E, 0x51, 0x49, 0x45, 0x3E,
- 0x00, 0x42, 0x7F, 0x40, 0x00,
- 0x72, 0x49, 0x49, 0x49, 0x46,
- 0x21, 0x41, 0x49, 0x4D, 0x33,
- 0x18, 0x14, 0x12, 0x7F, 0x10,
- 0x27, 0x45, 0x45, 0x45, 0x39,
- 0x3C, 0x4A, 0x49, 0x49, 0x31,
- 0x41, 0x21, 0x11, 0x09, 0x07,
- 0x36, 0x49, 0x49, 0x49, 0x36,
- 0x46, 0x49, 0x49, 0x29, 0x1E,
- 0x00, 0x00, 0x14, 0x00, 0x00,
- 0x00, 0x40, 0x34, 0x00, 0x00,
- 0x00, 0x08, 0x14, 0x22, 0x41,
- 0x14, 0x14, 0x14, 0x14, 0x14,
- 0x00, 0x41, 0x22, 0x14, 0x08,
- 0x02, 0x01, 0x59, 0x09, 0x06,
- 0x3E, 0x41, 0x5D, 0x59, 0x4E,
- 0x7C, 0x12, 0x11, 0x12, 0x7C,
- 0x7F, 0x49, 0x49, 0x49, 0x36,
- 0x3E, 0x41, 0x41, 0x41, 0x22,
- 0x7F, 0x41, 0x41, 0x41, 0x3E,
- 0x7F, 0x49, 0x49, 0x49, 0x41,
- 0x7F, 0x09, 0x09, 0x09, 0x01,
- 0x3E, 0x41, 0x41, 0x51, 0x73,
- 0x7F, 0x08, 0x08, 0x08, 0x7F,
- 0x00, 0x41, 0x7F, 0x41, 0x00,
- 0x20, 0x40, 0x41, 0x3F, 0x01,
- 0x7F, 0x08, 0x14, 0x22, 0x41,
- 0x7F, 0x40, 0x40, 0x40, 0x40,
- 0x7F, 0x02, 0x1C, 0x02, 0x7F,
- 0x7F, 0x04, 0x08, 0x10, 0x7F,
- 0x3E, 0x41, 0x41, 0x41, 0x3E,
- 0x7F, 0x09, 0x09, 0x09, 0x06,
- 0x3E, 0x41, 0x51, 0x21, 0x5E,
- 0x7F, 0x09, 0x19, 0x29, 0x46,
- 0x26, 0x49, 0x49, 0x49, 0x32,
- 0x03, 0x01, 0x7F, 0x01, 0x03,
- 0x3F, 0x40, 0x40, 0x40, 0x3F,
- 0x1F, 0x20, 0x40, 0x20, 0x1F,
- 0x3F, 0x40, 0x38, 0x40, 0x3F,
- 0x63, 0x14, 0x08, 0x14, 0x63,
- 0x03, 0x04, 0x78, 0x04, 0x03,
- 0x61, 0x59, 0x49, 0x4D, 0x43,
- 0x00, 0x7F, 0x41, 0x41, 0x41,
- 0x02, 0x04, 0x08, 0x10, 0x20,
- 0x00, 0x41, 0x41, 0x41, 0x7F,
- 0x04, 0x02, 0x01, 0x02, 0x04,
- 0x40, 0x40, 0x40, 0x40, 0x40,
- 0x00, 0x03, 0x07, 0x08, 0x00,
- 0x20, 0x54, 0x54, 0x78, 0x40,
- 0x7F, 0x28, 0x44, 0x44, 0x38,
- 0x38, 0x44, 0x44, 0x44, 0x28,
- 0x38, 0x44, 0x44, 0x28, 0x7F,
- 0x38, 0x54, 0x54, 0x54, 0x18,
- 0x00, 0x08, 0x7E, 0x09, 0x02,
- 0x18, 0xA4, 0xA4, 0x9C, 0x78,
- 0x7F, 0x08, 0x04, 0x04, 0x78,
- 0x00, 0x44, 0x7D, 0x40, 0x00,
- 0x20, 0x40, 0x40, 0x3D, 0x00,
- 0x7F, 0x10, 0x28, 0x44, 0x00,
- 0x00, 0x41, 0x7F, 0x40, 0x00,
- 0x7C, 0x04, 0x78, 0x04, 0x78,
- 0x7C, 0x08, 0x04, 0x04, 0x78,
- 0x38, 0x44, 0x44, 0x44, 0x38,
- 0xFC, 0x18, 0x24, 0x24, 0x18,
- 0x18, 0x24, 0x24, 0x18, 0xFC,
- 0x7C, 0x08, 0x04, 0x04, 0x08,
- 0x48, 0x54, 0x54, 0x54, 0x24,
- 0x04, 0x04, 0x3F, 0x44, 0x24,
- 0x3C, 0x40, 0x40, 0x20, 0x7C,
- 0x1C, 0x20, 0x40, 0x20, 0x1C,
- 0x3C, 0x40, 0x30, 0x40, 0x3C,
- 0x44, 0x28, 0x10, 0x28, 0x44,
- 0x4C, 0x90, 0x90, 0x90, 0x7C,
- 0x44, 0x64, 0x54, 0x4C, 0x44,
- 0x00, 0x08, 0x36, 0x41, 0x00,
- 0x00, 0x00, 0x77, 0x00, 0x00,
- 0x00, 0x41, 0x36, 0x08, 0x00,
- 0x02, 0x01, 0x02, 0x04, 0x02,
- 0x3C, 0x26, 0x23, 0x26, 0x3C,
- 0x1E, 0xA1, 0xA1, 0x61, 0x12,
- 0x3A, 0x40, 0x40, 0x20, 0x7A,
- 0x38, 0x54, 0x54, 0x55, 0x59,
- 0x21, 0x55, 0x55, 0x79, 0x41,
- 0x22, 0x54, 0x54, 0x78, 0x42, // a-umlaut
- 0x21, 0x55, 0x54, 0x78, 0x40,
- 0x20, 0x54, 0x55, 0x79, 0x40,
- 0x0C, 0x1E, 0x52, 0x72, 0x12,
- 0x39, 0x55, 0x55, 0x55, 0x59,
- 0x39, 0x54, 0x54, 0x54, 0x59,
- 0x39, 0x55, 0x54, 0x54, 0x58,
- 0x00, 0x00, 0x45, 0x7C, 0x41,
- 0x00, 0x02, 0x45, 0x7D, 0x42,
- 0x00, 0x01, 0x45, 0x7C, 0x40,
- 0x7D, 0x12, 0x11, 0x12, 0x7D, // A-umlaut
- 0xF0, 0x28, 0x25, 0x28, 0xF0,
- 0x7C, 0x54, 0x55, 0x45, 0x00,
- 0x20, 0x54, 0x54, 0x7C, 0x54,
- 0x7C, 0x0A, 0x09, 0x7F, 0x49,
- 0x32, 0x49, 0x49, 0x49, 0x32,
- 0x3A, 0x44, 0x44, 0x44, 0x3A, // o-umlaut
- 0x32, 0x4A, 0x48, 0x48, 0x30,
- 0x3A, 0x41, 0x41, 0x21, 0x7A,
- 0x3A, 0x42, 0x40, 0x20, 0x78,
- 0x00, 0x9D, 0xA0, 0xA0, 0x7D,
- 0x3D, 0x42, 0x42, 0x42, 0x3D, // O-umlaut
- 0x3D, 0x40, 0x40, 0x40, 0x3D,
- 0x3C, 0x24, 0xFF, 0x24, 0x24,
- 0x48, 0x7E, 0x49, 0x43, 0x66,
- 0x2B, 0x2F, 0xFC, 0x2F, 0x2B,
- 0xFF, 0x09, 0x29, 0xF6, 0x20,
- 0xC0, 0x88, 0x7E, 0x09, 0x03,
- 0x20, 0x54, 0x54, 0x79, 0x41,
- 0x00, 0x00, 0x44, 0x7D, 0x41,
- 0x30, 0x48, 0x48, 0x4A, 0x32,
- 0x38, 0x40, 0x40, 0x22, 0x7A,
- 0x00, 0x7A, 0x0A, 0x0A, 0x72,
- 0x7D, 0x0D, 0x19, 0x31, 0x7D,
- 0x26, 0x29, 0x29, 0x2F, 0x28,
- 0x26, 0x29, 0x29, 0x29, 0x26,
- 0x30, 0x48, 0x4D, 0x40, 0x20,
- 0x38, 0x08, 0x08, 0x08, 0x08,
- 0x08, 0x08, 0x08, 0x08, 0x38,
- 0x2F, 0x10, 0xC8, 0xAC, 0xBA,
- 0x2F, 0x10, 0x28, 0x34, 0xFA,
- 0x00, 0x00, 0x7B, 0x00, 0x00,
- 0x08, 0x14, 0x2A, 0x14, 0x22,
- 0x22, 0x14, 0x2A, 0x14, 0x08,
- 0x55, 0x00, 0x55, 0x00, 0x55, // #176 (25% block) missing in old code
- 0xAA, 0x55, 0xAA, 0x55, 0xAA, // 50% block
- 0xFF, 0x55, 0xFF, 0x55, 0xFF, // 75% block
- 0x00, 0x00, 0x00, 0xFF, 0x00,
- 0x10, 0x10, 0x10, 0xFF, 0x00,
- 0x14, 0x14, 0x14, 0xFF, 0x00,
- 0x10, 0x10, 0xFF, 0x00, 0xFF,
- 0x10, 0x10, 0xF0, 0x10, 0xF0,
- 0x14, 0x14, 0x14, 0xFC, 0x00,
- 0x14, 0x14, 0xF7, 0x00, 0xFF,
- 0x00, 0x00, 0xFF, 0x00, 0xFF,
- 0x14, 0x14, 0xF4, 0x04, 0xFC,
- 0x14, 0x14, 0x17, 0x10, 0x1F,
- 0x10, 0x10, 0x1F, 0x10, 0x1F,
- 0x14, 0x14, 0x14, 0x1F, 0x00,
- 0x10, 0x10, 0x10, 0xF0, 0x00,
- 0x00, 0x00, 0x00, 0x1F, 0x10,
- 0x10, 0x10, 0x10, 0x1F, 0x10,
- 0x10, 0x10, 0x10, 0xF0, 0x10,
- 0x00, 0x00, 0x00, 0xFF, 0x10,
- 0x10, 0x10, 0x10, 0x10, 0x10,
- 0x10, 0x10, 0x10, 0xFF, 0x10,
- 0x00, 0x00, 0x00, 0xFF, 0x14,
- 0x00, 0x00, 0xFF, 0x00, 0xFF,
- 0x00, 0x00, 0x1F, 0x10, 0x17,
- 0x00, 0x00, 0xFC, 0x04, 0xF4,
- 0x14, 0x14, 0x17, 0x10, 0x17,
- 0x14, 0x14, 0xF4, 0x04, 0xF4,
- 0x00, 0x00, 0xFF, 0x00, 0xF7,
- 0x14, 0x14, 0x14, 0x14, 0x14,
- 0x14, 0x14, 0xF7, 0x00, 0xF7,
- 0x14, 0x14, 0x14, 0x17, 0x14,
- 0x10, 0x10, 0x1F, 0x10, 0x1F,
- 0x14, 0x14, 0x14, 0xF4, 0x14,
- 0x10, 0x10, 0xF0, 0x10, 0xF0,
- 0x00, 0x00, 0x1F, 0x10, 0x1F,
- 0x00, 0x00, 0x00, 0x1F, 0x14,
- 0x00, 0x00, 0x00, 0xFC, 0x14,
- 0x00, 0x00, 0xF0, 0x10, 0xF0,
- 0x10, 0x10, 0xFF, 0x10, 0xFF,
- 0x14, 0x14, 0x14, 0xFF, 0x14,
- 0x10, 0x10, 0x10, 0x1F, 0x00,
- 0x00, 0x00, 0x00, 0xF0, 0x10,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
- 0xFF, 0xFF, 0xFF, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0xFF, 0xFF,
- 0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
- 0x38, 0x44, 0x44, 0x38, 0x44,
- 0xFC, 0x4A, 0x4A, 0x4A, 0x34, // sharp-s or beta
- 0x7E, 0x02, 0x02, 0x06, 0x06,
- 0x02, 0x7E, 0x02, 0x7E, 0x02,
- 0x63, 0x55, 0x49, 0x41, 0x63,
- 0x38, 0x44, 0x44, 0x3C, 0x04,
- 0x40, 0x7E, 0x20, 0x1E, 0x20,
- 0x06, 0x02, 0x7E, 0x02, 0x02,
- 0x99, 0xA5, 0xE7, 0xA5, 0x99,
- 0x1C, 0x2A, 0x49, 0x2A, 0x1C,
- 0x4C, 0x72, 0x01, 0x72, 0x4C,
- 0x30, 0x4A, 0x4D, 0x4D, 0x30,
- 0x30, 0x48, 0x78, 0x48, 0x30,
- 0xBC, 0x62, 0x5A, 0x46, 0x3D,
- 0x3E, 0x49, 0x49, 0x49, 0x00,
- 0x7E, 0x01, 0x01, 0x01, 0x7E,
- 0x2A, 0x2A, 0x2A, 0x2A, 0x2A,
- 0x44, 0x44, 0x5F, 0x44, 0x44,
- 0x40, 0x51, 0x4A, 0x44, 0x40,
- 0x40, 0x44, 0x4A, 0x51, 0x40,
- 0x00, 0x00, 0xFF, 0x01, 0x03,
- 0xE0, 0x80, 0xFF, 0x00, 0x00,
- 0x08, 0x08, 0x6B, 0x6B, 0x08,
- 0x36, 0x12, 0x36, 0x24, 0x36,
- 0x06, 0x0F, 0x09, 0x0F, 0x06,
- 0x00, 0x00, 0x18, 0x18, 0x00,
- 0x00, 0x00, 0x10, 0x10, 0x00,
- 0x30, 0x40, 0xFF, 0x01, 0x01,
- 0x00, 0x1F, 0x01, 0x01, 0x1E,
- 0x00, 0x19, 0x1D, 0x17, 0x12,
- 0x00, 0x3C, 0x3C, 0x3C, 0x3C,
- 0x00, 0x00, 0x00, 0x00, 0x00 // #255 NBSP
-}; \ No newline at end of file
diff --git a/peripheral/libupm/src/ili9341/gfx.h b/peripheral/libupm/src/ili9341/gfx.h
deleted file mode 100644
index c62e81e..0000000
--- a/peripheral/libupm/src/ili9341/gfx.h
+++ /dev/null
@@ -1,406 +0,0 @@
-/**
- * Author: Shawn Hymel
- * Copyright (c) 2016 SparkFun Electronics
- *
- * Based on GFX interface by Yevgeniy Kiveisha and Adafruit Industries.
- *
- * 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.hpp>
-
-#define adagfxswap(a, b) { int16_t t = a; a = b; b = t; }
-
-namespace upm
-{
- /**
- * @brief GFX helper class
- */
- class GFX {
- public:
-
- /**
- * Creates a GFX object
- *
- * @param w Screen width
- * @param h Screen height
- */
- GFX(int16_t w, int16_t h);
-
- /**
- * Sends a pixel color (RGB) to the driver chip. This must be
- * defined by the subclass (pure virtual function).
- *
- * @param x Axis on the horizontal scale
- * @param y Axis on the vertical scale
- * @param color RGB (16-bit) color (R[0-4], G[5-10], B[11-15]
- */
- virtual void drawPixel(int16_t x, int16_t y, uint16_t color) = 0;
-
- /**
- * Draw a line.
- *
- * @param x0 Start of line x coordinate
- * @param y0 Start of line y coordinate
- * @param x1 End of line x coordinate
- * @param y1 End of line y coordinate
- * @param color RGB (16-bit) color (R[0-4], G[5-10], B[11-15]
- */
- virtual void drawLine(int16_t x0,
- int16_t y0,
- int16_t x1,
- int16_t y1,
- uint16_t color);
-
- /**
- * Draws a vertical line using minimal SPI writes.
- *
- * @param x Axis on the horizontal scale to begin line
- * @param y Axis on the vertical scale to begin line
- * @param h Height of line in pixels
- * @param color RGB (16-bit) color (R[0-4], G[5-10], B[11-15]
- */
- virtual void drawFastVLine(int16_t x,
- int16_t y,
- int16_t h,
- uint16_t color);
-
- /**
- * Draws a horizontal line using minimal SPI writes.
- *
- * @param x Axis on the horizontal scale to begin line
- * @param y Axis on the vertical scale to begin line
- * @param w Width of line in pixels
- * @param color RGB (16-bit) color (R[0-4], G[5-10], B[11-15]
- */
- virtual void drawFastHLine(int16_t x,
- int16_t y,
- int16_t w,
- uint16_t color);
-
- /**
- * Draws a rectangle (not filled).
- *
- * @param x Position of upper left corner on horizontal axis
- * @param y Position of upper left corner on vertical axis
- * @param w Width of rectangle
- * @param h Height of rectangle
- * @color RGB (16-bit) color (R[0-4], G[5-10], B[11-15]
- */
- virtual void drawRect(int16_t x,
- int16_t y,
- int16_t w,
- int16_t h,
- uint16_t color);
-
- /**
- * Draw a filled rectangle.
- *
- * @param x Axis on the horizontal scale of upper-left corner
- * @param y Axis on the vertical scale of upper-left corner
- * @param w Width of rectangle in pixels
- * @param h Height of rectangle in pixels
- * @param color RGB (16-bit) color (R[0-4], G[5-10], B[11-15]
- */
- virtual void fillRect(int16_t x,
- int16_t y,
- int16_t w,
- int16_t h,
- uint16_t color);
-
- /**
- * Fill the screen with a single color.
- *
- * @param color RGB (16-bit) color (R[0-4], G[5-10], B[11-15]
- */
- virtual void fillScreen(uint16_t color);
-
- /**
- * Invert colors on the display.
- *
- * @param i True or false to invert colors
- */
- virtual void invertDisplay(bool i);
-
- /**
- * Draw a circle outline.
- *
- * @param x0 Center point of circle on x-axis
- * @param y0 Center point of circle on y-axis
- * @param r Radius of circle
- * @param color RGB (16-bit) color (R[0-4], G[5-10], B[11-15]
- */
- void drawCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color);
-
- /**
- * Used to draw rounded corners.
- *
- * @param x0 Center point of circle on x-axis
- * @param y0 Center point of circle on y-axis
- * @param r Radius of circle
- * @param cornername Mask of corner number (1, 2, 4, 8)
- * @param color RGB (16-bit) color (R[0-4], G[5-10], B[11-15]
- */
- void drawCircleHelper(int16_t x0,
- int16_t y0,
- int16_t r,
- uint8_t cornername,
- uint16_t color);
-
- /**
- * Draws a filled circle.
- *
- * @param x0 Center point of circle on x-axis
- * @param y0 Center point of circle on y-axis
- * @param r Radius of circle
- * @param color RGB (16-bit) color (R[0-4], G[5-10], B[11-15]
- */
- void fillCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color);
-
- /**
- * Used to draw a filled circle and rounded rectangles.
- *
- * @param x0 Center point of circle on x-axis
- * @param y0 Center point of circle on y-axis
- * @param r Radius of circle
- * @param cornername Mask of corner number (1, 2, 4, 8)
- * @param delta Line offset
- * @param color RGB (16-bit) color (R[0-4], G[5-10], B[11-15]
- */
- void fillCircleHelper(int16_t x0,
- int16_t y0,
- int16_t r,
- uint8_t cornername,
- int16_t delta,
- uint16_t color);
-
- /**
- * Draw a triangle.
- *
- * @param x0 First point coordinate on x-axis
- * @param y0 First point coordinate on y-axis
- * @param x1 Second point coordinate on x-axis
- * @param y1 Second point coordinate on y-axis
- * @param x2 Third point coordinate on x-axis
- * @param y2 Third point coordinate on y-axis
- * @param color RGB (16-bit) color (R[0-4], G[5-10], B[11-15]
- */
- void drawTriangle(int16_t x0,
- int16_t y0,
- int16_t x1,
- int16_t y1,
- int16_t x2,
- int16_t y2,
- uint16_t color);
-
- /**
- * Draw a filled triangle.
- *
- * @param x0 First point coordinate on x-axis
- * @param y0 First point coordinate on y-axis
- * @param x1 Second point coordinate on x-axis
- * @param y1 Second point coordinate on y-axis
- * @param x2 Third point coordinate on x-axis
- * @param y2 Third point coordinate on y-axis
- * @param color RGB (16-bit) color (R[0-4], G[5-10], B[11-15]
- */
- void fillTriangle(int16_t x0,
- int16_t y0,
- int16_t x1,
- int16_t y1,
- int16_t x2,
- int16_t y2,
- uint16_t color);
-
- /**
- * Draw a rectangle with rounded corners
- *
- * @param x0 X-axis coordinate of top-left corner
- * @param y0 Y-axis coordinate of top-left corner
- * @param w Width of rectangle
- * @param h height of rectangle
- * @param radius Radius of rounded corners
- * @param color RGB (16-bit) color (R[0-4], G[5-10], B[11-15]
- */
- void drawRoundRect(int16_t x0,
- int16_t y0,
- int16_t w,
- int16_t h,
- int16_t radius,
- uint16_t color);
-
- /**
- * Draw a filled rectangle with rounded corners
- *
- * @param x0 X-axis coordinate of top-left corner
- * @param y0 Y-axis coordinate of top-left corner
- * @param w Width of rectangle
- * @param h height of rectangle
- * @param radius Radius of rounded corners
- * @param color RGB (16-bit) color (R[0-4], G[5-10], B[11-15]
- */
- void fillRoundRect(int16_t x0,
- int16_t y0,
- int16_t w,
- int16_t h,
- int16_t radius,
- uint16_t color);
-
- /**
- * Draw a character at the specified point.
- *
- * @param x X-axis coordinate of the top-left corner
- * @param y Y-axis coordinate of the top-left corner
- * @param c Character to draw
- * @param color RGB (16-bit) color (R[0-4], G[5-10], B[11-15]
- * @param bg Background color (16-bit RGB)
- * @param size Font size
- */
- void drawChar(int16_t x,
- int16_t y,
- unsigned char c,
- uint16_t color,
- uint16_t bg,
- uint8_t size);
-
- /**
- * Get the x-axis coordinate of the upper-left corner of the cursor.
- *
- * @return X-axis coordinate of the cursor
- */
- int16_t getCursorX(void) const;
-
- /**
- * Get the y-axis coordinate of the upper-left corner of the cursor.
- *
- * @return Y-axis coordinate of the cursor
- */
- int16_t getCursorY(void) const;
-
- /**
- * Set the cursor for writing text.
- *
- * @param x X-axis coordinate of the top-left corner of the cursor
- * @param y Y-axis coordinate of the top-left corner of the cursor
- */
- void setCursor(int16_t x, int16_t y);
-
- /**
- * Set the color for text.
- *
- * @param c RGB (16-bit) color (R[0-4], G[5-10], B[11-15]
- */
- void setTextColor(uint16_t c);
-
- /**
- * Set the color for text and text background (highlight).
- *
- * @param c Text color (RGB, 16-bit)
- * @param bg Background text color (RGB, 16-bit)
- */
- void setTextColor(uint16_t c, uint16_t bg);
-
- /**
- * Set the size of the text.
- *
- * @param s Font size (multiples of 8 pixel text height)
- */
- void setTextSize(uint8_t s);
-
- /**
- * Enable or disable text wrapping.
- *
- * @param w True to wrap text. False to truncate.
- */
- void setTextWrap(bool w);
-
- /**
- * Get the current rotation configuration of the screen.
- *
- * @return current rotation 0-3
- */
- uint8_t getRotation(void) const;
-
- /**
- * Sets the rotation of the screen. Can be overridden with another
- * screen-specific definition.
- *
- * @param r Rotation 0-3
- */
- void setRotation(uint8_t r);
-
- /**
- * Enable (or disable) Code Page 437-compatible charset.
- *
- * @param x True to enable CP437 charset. False to disable.
- */
- void cp437(bool x);
-
- /**
- * Write a character at the current cursor position. Definition
- * can be overridden with board-specific code.
- *
- * @param c Character to draw
- */
- virtual void write(uint8_t c);
-
- /**
- * Prints a string to the screen.
- *
- * @param s Message to print
- */
- void print(std::string msg);
-
- /**
- * Get the current width of the screen.
- *
- * @return the width in pixels
- */
- int16_t width(void) const;
-
- /**
- * Get the current height of the screen.
- *
- * @return the height in pixels
- */
- int16_t height(void) const;
-
- protected:
-
- const int16_t WIDTH;
- const int16_t HEIGHT;
-
- int16_t _width;
- int16_t _height;
-
- uint8_t rotation;
-
- uint16_t textcolor;
- uint16_t textbgcolor;
- int16_t cursor_x;
- int16_t cursor_y;
- uint8_t textsize;
- bool wrap;
- bool _cp437;
- static const unsigned char font[];
- };
-} \ No newline at end of file
diff --git a/peripheral/libupm/src/ili9341/ili9341.cxx b/peripheral/libupm/src/ili9341/ili9341.cxx
deleted file mode 100644
index b0a4e57..0000000
--- a/peripheral/libupm/src/ili9341/ili9341.cxx
+++ /dev/null
@@ -1,487 +0,0 @@
-/*
- * Author: Shawn Hymel
- * Copyright (c) 2015 SparkFun Electronics
- *
- * Credits to Adafruit.
- * Based on Adafruit ST7735 library, see original license in license.txt file.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <string>
-#include <stdexcept>
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#include "ili9341.h"
-
-using namespace upm;
-
-ILI9341::ILI9341(uint8_t csLCD, uint8_t csSD, uint8_t dc, uint8_t rst) :
- GFX(ILI9341_TFTWIDTH, ILI9341_TFTHEIGHT), m_csLCDPinCtx(csLCD),
- m_csSDPinCtx(csSD), m_dcPinCtx(dc), m_rstPinCtx(rst), m_spi(0) {
-
- initModule();
- configModule();
-}
-
-void ILI9341::initModule() {
- mraa::Result error = mraa::SUCCESS;
-
- error = m_csLCDPinCtx.dir(mraa::DIR_OUT);
- if (error != mraa::SUCCESS) {
- mraa::printError(error);
- }
-
- error = m_csSDPinCtx.dir(mraa::DIR_OUT);
- if (error != mraa::SUCCESS) {
- mraa::printError(error);
- }
-
- error = m_dcPinCtx.dir(mraa::DIR_OUT);
- if (error != mraa::SUCCESS) {
- mraa::printError(error);
- }
-
- error = m_rstPinCtx.dir(mraa::DIR_OUT);
- if (error != mraa::SUCCESS) {
- mraa::printError(error);
- }
-
- error = m_spi.frequency(SPI_FREQ);
- if (error != mraa::SUCCESS) {
- mraa::printError (error);
- }
-
- lcdCSOff();
-}
-
-void ILI9341::setRotation(uint8_t r) {
-
- writecommand(ILI9341_MADCTL);
- r = r % 4; // can't be higher than 3
- switch(r) {
- case 0:
- writedata(MADCTL_MX | MADCTL_BGR);
- _width = ILI9341_TFTWIDTH;
- _height = ILI9341_TFTHEIGHT;
- break;
- case 1:
- writedata(MADCTL_MV | MADCTL_BGR);
- _width = ILI9341_TFTHEIGHT;
- _height = ILI9341_TFTWIDTH;
- break;
- case 2:
- writedata(MADCTL_MY | MADCTL_BGR);
- _width = ILI9341_TFTWIDTH;
- _height = ILI9341_TFTHEIGHT;
- break;
- case 3:
- writedata(MADCTL_MX | MADCTL_MY | MADCTL_MV | MADCTL_BGR);
- _width = ILI9341_TFTHEIGHT;
- _height = ILI9341_TFTWIDTH;
- break;
- }
-}
-
-void ILI9341::configModule() {
-
- // Toggle RST low to reset
- rstHigh();
- usleep(5000);
- rstLow();
- usleep(20000);
- rstHigh();
- usleep(150000);
-
- // Send initialization commands
- writecommand(0xEF);
- writedata(0x03);
- writedata(0x80);
- writedata(0x02);
-
- writecommand(0xCF);
- writedata(0x00);
- writedata(0XC1);
- writedata(0X30);
-
- writecommand(0xED);
- writedata(0x64);
- writedata(0x03);
- writedata(0X12);
- writedata(0X81);
-
- writecommand(0xE8);
- writedata(0x85);
- writedata(0x00);
- writedata(0x78);
-
- writecommand(0xCB);
- writedata(0x39);
- writedata(0x2C);
- writedata(0x00);
- writedata(0x34);
- writedata(0x02);
-
- writecommand(0xF7);
- writedata(0x20);
-
- writecommand(0xEA);
- writedata(0x00);
- writedata(0x00);
-
- writecommand(ILI9341_PWCTR1); //Power control
- writedata(0x23); //VRH[5:0]
-
- writecommand(ILI9341_PWCTR2); //Power control
- writedata(0x10); //SAP[2:0];BT[3:0]
-
- writecommand(ILI9341_VMCTR1); //VCM control
- writedata(0x3e);
- writedata(0x28);
-
- writecommand(ILI9341_VMCTR2); //VCM control2
- writedata(0x86); //--
-
- writecommand(ILI9341_MADCTL); // Memory Access Control
- writedata(0x48);
-
- writecommand(ILI9341_PIXFMT);
- writedata(0x55);
-
- writecommand(ILI9341_FRMCTR1);
- writedata(0x00);
- writedata(0x18);
-
- writecommand(ILI9341_DFUNCTR); // Display Function Control
- writedata(0x08);
- writedata(0x82);
- writedata(0x27);
-
- writecommand(0xF2); // 3Gamma Function Disable
- writedata(0x00);
-
- writecommand(ILI9341_GAMMASET); //Gamma curve selected
- writedata(0x01);
-
- writecommand(ILI9341_GMCTRP1); //Set Gamma
- writedata(0x0F);
- writedata(0x31);
- writedata(0x2B);
- writedata(0x0C);
- writedata(0x0E);
- writedata(0x08);
- writedata(0x4E);
- writedata(0xF1);
- writedata(0x37);
- writedata(0x07);
- writedata(0x10);
- writedata(0x03);
- writedata(0x0E);
- writedata(0x09);
- writedata(0x00);
-
- writecommand(ILI9341_GMCTRN1); //Set Gamma
- writedata(0x00);
- writedata(0x0E);
- writedata(0x14);
- writedata(0x03);
- writedata(0x11);
- writedata(0x07);
- writedata(0x31);
- writedata(0xC1);
- writedata(0x48);
- writedata(0x08);
- writedata(0x0F);
- writedata(0x0C);
- writedata(0x31);
- writedata(0x36);
- writedata(0x0F);
-
- writecommand(ILI9341_SLPOUT);
- usleep(120000);
- writecommand(ILI9341_DISPON);
-}
-
-void ILI9341::setAddrWindow(uint16_t x0,
- uint16_t y0,
- uint16_t x1,
- uint16_t y1) {
-
- writecommand(ILI9341_CASET); // Column addr set
- writedata(x0 >> 8);
- writedata(x0 & 0xFF); // XSTART
- writedata(x1 >> 8);
- writedata(x1 & 0xFF); // XEND
-
- writecommand(ILI9341_PASET); // Row addr set
- writedata(y0>>8);
- writedata(y0); // YSTART
- writedata(y1>>8);
- writedata(y1); // YEND
-
- writecommand(ILI9341_RAMWR); // write to RAM
-}
-
-void ILI9341::drawPixel(int16_t x, int16_t y, uint16_t color) {
-
- if((x < 0) ||(x >= _width) || (y < 0) || (y >= _height)) {
- return;
- }
-
- setAddrWindow(x, y, x + 1, y + 1);
-
- writedata(color >> 8);
- writedata(color);
-}
-
-void ILI9341::drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color) {
-
- // Rudimentary clipping
- if((x >= _width) || (y >= _height)) {
- return;
- }
-
- if((y+h-1) >= _height) {
- h = _height-y;
- }
-
- setAddrWindow(x, y, x, y+h-1);
-
- uint8_t hi = color >> 8;
- uint8_t lo = color;
-
- lcdCSOn();
- dcHigh();
-
- while (h--) {
- m_spi.writeByte(hi);
- m_spi.writeByte(lo);
- }
-
- lcdCSOff();
-}
-
-void ILI9341::drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color) {
-
- // Rudimentary clipping
- if((x >= _width) || (y >= _height)) {
- return;
- }
-
- if((x+w-1) >= _width) {
- w = _width - x;
- }
-
- setAddrWindow(x, y, x+w-1, y);
-
- uint8_t hi = color >> 8;
- uint8_t lo = color;
-
- lcdCSOn();
- dcHigh();
-
- while (w--) {
- m_spi.writeByte(hi);
- m_spi.writeByte(lo);
- }
-
- lcdCSOff();
-}
-
-void ILI9341::fillRect(int16_t x,
- int16_t y,
- int16_t w,
- int16_t h,
- uint16_t color) {
-
- // rudimentary clipping (drawChar w/big text requires this)
- if((x >= _width) || (y >= _height)) return;
- if((x + w - 1) >= _width) w = _width - x;
- if((y + h - 1) >= _height) h = _height - y;
-
- setAddrWindow(x, y, x+w-1, y+h-1);
-
- uint8_t hi = color >> 8;
- uint8_t lo = color;
-
- lcdCSOn();
- dcHigh();
-
- for(y = h; y > 0; y--) {
- for(x = w; x > 0; x--) {
- m_spi.writeByte(hi);
- m_spi.writeByte(lo);
- }
- }
-
- lcdCSOff();
-}
-
-void ILI9341::fillScreen(uint16_t color) {
- fillRect(0, 0, _width, _height, color);
-}
-
-void ILI9341::invertDisplay(bool i) {
- writecommand(i ? ILI9341_INVON : ILI9341_INVOFF);
-}
-
-uint16_t ILI9341::color565(uint8_t r, uint8_t g, uint8_t b) {
- return ((r & 0xF8) << 8) | ((g & 0xFC) << 3) | (b >> 3);
-}
-
-void ILI9341::executeCMDList(const uint8_t *addr) {
- uint8_t numCommands, numArgs;
- uint16_t ms;
-
- numCommands = *(addr++); // Number of commands to follow
- while (numCommands--) { // For each command...
- writecommand(*(addr++)); // Read, issue command
- numArgs = *(addr++); // Number of args to follow
- ms = numArgs & DELAY; // If hibit set, delay follows args
- numArgs &= ~DELAY; // Mask out delay bit
- while (numArgs--) { // For each argument...
- writedata(*(addr++)); // Read, issue argument
- }
-
- if (ms) {
- ms = *(addr++); // Read post-command delay time (ms)
- if (ms == 255) {
- ms = 500; // If 255, delay for 500 ms
- }
- usleep(ms * 1000);
- }
- }
-}
-
-void ILI9341::writecommand(uint8_t c) {
- lcdCSOn();
- dcLow();
- m_spi.writeByte(c);
- lcdCSOff();
-}
-
-void ILI9341::writedata(uint8_t d) {
- lcdCSOn();
- dcHigh();
- m_spi.writeByte(d);
- lcdCSOff();
-}
-
-mraa::Result ILI9341::lcdCSOn() {
- mraa::Result error = mraa::SUCCESS;
-
- error = m_csLCDPinCtx.write(LOW);
- if (error != mraa::SUCCESS) {
- mraa::printError (error);
- }
-
- error = m_csSDPinCtx.write(HIGH);
- if (error != mraa::SUCCESS) {
- mraa::printError (error);
- }
-
- return error;
-}
-
-mraa::Result ILI9341::lcdCSOff() {
- mraa::Result error = mraa::SUCCESS;
-
- error = m_csLCDPinCtx.write(HIGH);
- if (error != mraa::SUCCESS) {
- mraa::printError (error);
- }
-
- return error;
-}
-
-mraa::Result ILI9341::sdCSOn() {
- mraa::Result error = mraa::SUCCESS;
-
- error = m_csSDPinCtx.write(LOW);
- if (error != mraa::SUCCESS) {
- mraa::printError (error);
- }
-
- error = m_csLCDPinCtx.write(HIGH);
- if (error != mraa::SUCCESS) {
- mraa::printError (error);
- }
-
- return error;
-}
-
-mraa::Result ILI9341::sdCSOff() {
- mraa::Result error = mraa::SUCCESS;
-
- error = m_csSDPinCtx.write(HIGH);
- if (error != mraa::SUCCESS) {
- mraa::printError (error);
- }
-
- return error;
-}
-
-mraa::Result ILI9341::dcHigh() {
- mraa::Result error = mraa::SUCCESS;
-
- error = m_dcPinCtx.write(HIGH);
- if (error != mraa::SUCCESS) {
- mraa::printError(error);
- }
-
- return error;
-}
-
-mraa::Result ILI9341::dcLow() {
- mraa::Result error = mraa::SUCCESS;
-
- error = m_dcPinCtx.write(LOW);
- if (error != mraa::SUCCESS) {
- mraa::printError(error);
- }
-
- return error;
-}
-
-mraa::Result ILI9341::rstHigh() {
- mraa::Result error = mraa::SUCCESS;
-
- error = m_rstPinCtx.write(HIGH);
- if (error != mraa::SUCCESS) {
- mraa::printError(error);
- }
-
- return error;
-}
-
-mraa::Result ILI9341::rstLow() {
- mraa::Result error = mraa::SUCCESS;
-
- error = m_rstPinCtx.write(LOW);
- if (error != mraa::SUCCESS) {
- mraa::printError(error);
- }
-
- return error;
-} \ No newline at end of file
diff --git a/peripheral/libupm/src/ili9341/ili9341.h b/peripheral/libupm/src/ili9341/ili9341.h
deleted file mode 100644
index fbf8a20..0000000
--- a/peripheral/libupm/src/ili9341/ili9341.h
+++ /dev/null
@@ -1,344 +0,0 @@
-/*
- * Author: Shawn Hymel
- * Copyright (c) 2015 SparkFun Electronics
- *
- * Credits to Adafruit.
- * Based on Adafruit ILI9341 library, see original license in license.txt file.
- *
- * 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
-
-// Includes
-#include <string>
-#include <mraa/common.hpp>
-#include <mraa/gpio.hpp>
-#include <mraa/spi.hpp>
-#include "gfx.h"
-
-// Defines
-#define ILI9341_TFTWIDTH 240
-#define ILI9341_TFTHEIGHT 320
-
-#define SPI_FREQ 15000000
-
-#define ILI9341_NOP 0x00
-#define ILI9341_SWRESET 0x01
-#define ILI9341_RDDID 0x04
-#define ILI9341_RDDST 0x09
-
-#define ILI9341_SLPIN 0x10
-#define ILI9341_SLPOUT 0x11
-#define ILI9341_PTLON 0x12
-#define ILI9341_NORON 0x13
-
-#define ILI9341_RDMODE 0x0A
-#define ILI9341_RDMADCTL 0x0B
-#define ILI9341_RDPIXFMT 0x0C
-#define ILI9341_RDIMGFMT 0x0D
-#define ILI9341_RDSELFDIAG 0x0F
-
-#define ILI9341_INVOFF 0x20
-#define ILI9341_INVON 0x21
-#define ILI9341_GAMMASET 0x26
-#define ILI9341_DISPOFF 0x28
-#define ILI9341_DISPON 0x29
-
-#define ILI9341_CASET 0x2A
-#define ILI9341_PASET 0x2B
-#define ILI9341_RAMWR 0x2C
-#define ILI9341_RAMRD 0x2E
-
-#define ILI9341_PTLAR 0x30
-#define ILI9341_MADCTL 0x36
-#define ILI9341_PIXFMT 0x3A
-
-#define ILI9341_FRMCTR1 0xB1
-#define ILI9341_FRMCTR2 0xB2
-#define ILI9341_FRMCTR3 0xB3
-#define ILI9341_INVCTR 0xB4
-#define ILI9341_DFUNCTR 0xB6
-
-#define ILI9341_PWCTR1 0xC0
-#define ILI9341_PWCTR2 0xC1
-#define ILI9341_PWCTR3 0xC2
-#define ILI9341_PWCTR4 0xC3
-#define ILI9341_PWCTR5 0xC4
-#define ILI9341_VMCTR1 0xC5
-#define ILI9341_VMCTR2 0xC7
-
-#define ILI9341_RDID1 0xDA
-#define ILI9341_RDID2 0xDB
-#define ILI9341_RDID3 0xDC
-#define ILI9341_RDID4 0xDD
-
-#define ILI9341_GMCTRP1 0xE0
-#define ILI9341_GMCTRN1 0xE1
-
-#define MADCTL_MY 0x80
-#define MADCTL_MX 0x40
-#define MADCTL_MV 0x20
-#define MADCTL_ML 0x10
-#define MADCTL_RGB 0x00
-#define MADCTL_BGR 0x08
-#define MADCTL_MH 0x04
-
-#define HIGH 1
-#define LOW 0
-
-#define DELAY 0x80
-
-// Color definitions
-#define ILI9341_BLACK 0x0000 /* 0, 0, 0 */
-#define ILI9341_NAVY 0x000F /* 0, 0, 128 */
-#define ILI9341_DARKGREEN 0x03E0 /* 0, 128, 0 */
-#define ILI9341_DARKCYAN 0x03EF /* 0, 128, 128 */
-#define ILI9341_MAROON 0x7800 /* 128, 0, 0 */
-#define ILI9341_PURPLE 0x780F /* 128, 0, 128 */
-#define ILI9341_OLIVE 0x7BE0 /* 128, 128, 0 */
-#define ILI9341_LIGHTGREY 0xC618 /* 192, 192, 192 */
-#define ILI9341_DARKGREY 0x7BEF /* 128, 128, 128 */
-#define ILI9341_BLUE 0x001F /* 0, 0, 255 */
-#define ILI9341_GREEN 0x07E0 /* 0, 255, 0 */
-#define ILI9341_CYAN 0x07FF /* 0, 255, 255 */
-#define ILI9341_RED 0xF800 /* 255, 0, 0 */
-#define ILI9341_MAGENTA 0xF81F /* 255, 0, 255 */
-#define ILI9341_YELLOW 0xFFE0 /* 255, 255, 0 */
-#define ILI9341_WHITE 0xFFFF /* 255, 255, 255 */
-#define ILI9341_ORANGE 0xFD20 /* 255, 165, 0 */
-#define ILI9341_GREENYELLOW 0xAFE5 /* 173, 255, 47 */
-#define ILI9341_PINK 0xF81F
-
-namespace upm {
- /**
- * @brief ILI9341 LCD library
- * @defgroup ili9341 libupm-ili9341
- * @ingroup adafruit spi display
- */
- /**
- * @library ili9341
- * @sensor ili9341
- * @comname ILI9341 LCD
- * @type display
- * @man adafruit
- * @web http://www.adafruit.com/product/2090
- * @con spi
- *
- * @brief API for the ILI9342 LCd
- *
- * This module defines the interface for the ILI9341 display library
- *
- * @image html ili9341.jpg
- * @snippet ili9341.cxx Interesting
- */
- class ILI9341 : public GFX {
- public:
- /**
- * Instantiates an ILI9341 object
- *
- * @param csLCD LCD chip select pin
- * @param csSD SD card select pin
- * @param dc Data/command pin
- * @param rst Reset pin
- */
- ILI9341(uint8_t csLCD, uint8_t csSD, uint8_t dc, uint8_t rst);
-
- /**
- * Returns the name of the component
- */
- std::string name() {
- return m_name;
- }
-
- /**
- * Initializes GPIOs used to talk to the LCD
- */
- void initModule();
-
- /**
- * Configures the LCD driver chip via SPI
- */
- void configModule();
-
- /**
- * Sets the window size inside the screen where pixel data is
- * written. Concrete implementation from GFX interface.
- *
- * @param x0 First coordinate
- * @param y0 First coordinate
- * @param x1 Second coordinate
- * @param y1 Second coordinate
- */
- void setAddrWindow(uint16_t x0,
- uint16_t y0,
- uint16_t x1,
- uint16_t y1);
-
- /**
- * Sends a pixel color (RGB) to the driver chip. Concrete
- * implementation from GFX interface.
- *
- * @param x Axis on the horizontal scale
- * @param y Axis on the vertical scale
- * @param color RGB (16-bit) color (R[0-4], G[5-10], B[11-15]
- */
- void drawPixel(int16_t x, int16_t y, uint16_t color);
-
- /**
- * Draws a vertical line using minimal SPI writes.
- *
- * @param x Axis on the horizontal scale to begin line
- * @param y Axis on the vertical scale to begin line
- * @param h Height of line in pixels
- * @param color RGB (16-bit) color (R[0-4], G[5-10], B[11-15]
- */
- void drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color);
-
- /**
- * Draws a horizontal line using minimal SPI writes.
- *
- * @param x Axis on the horizontal scale to begin line
- * @param y Axis on the vertical scale to begin line
- * @param w Width of line in pixels
- * @param color RGB (16-bit) color (R[0-4], G[5-10], B[11-15]
- */
- void drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color);
-
- /**
- * Draw a filled rectangle.
- *
- * @param x Axis on the horizontal scale of upper-left corner
- * @param y Axis on the vertical scale of upper-left corner
- * @param w Width of rectangle in pixels
- * @param h Height of rectangle in pixels
- * @param color RGB (16-bit) color (R[0-4], G[5-10], B[11-15]
- */
- void fillRect(int16_t x,
- int16_t y,
- int16_t w,
- int16_t h,
- uint16_t color);
-
- /**
- * Fill the screen with a single color.
- *
- * @param color RGB (16-bit) color (R[0-4], G[5-10], B[11-15]
- */
- void fillScreen(uint16_t color);
-
- /**
- * Sets the screen to one of four 90 deg rotations.
- *
- * @param r Rotation setting: 0, 1, 2, 3
- */
- void setRotation(uint8_t r);
-
- /**
- * Invert colors on the display.
- *
- * @param i True or false to invert colors
- */
- void invertDisplay(bool i);
-
- /**
- * Pass 8-bit R, G, B values and get back 16-bit packed color.
- *
- * @param r Red color 0-31
- * @param g Green color 0-63
- * @param b blue color 0-31
- * @return 16-bit packed color (RGB) value
- */
- uint16_t color565(uint8_t r, uint8_t g, uint8_t b);
-
- /**
- * Executes a set of commands and data.
- *
- * @param addr Pointer to the start of the commands/data section
- */
- void executeCMDList(const uint8_t *addr);
-
- /**
- * Sends a command to the display driver via SPI.
- *
- * @param c Command to be written
- */
- void writecommand(uint8_t c);
-
- /**
- * Sends data to the display driver via SPI
- *
- * @param d Data to be written
- */
- void writedata(uint8_t d);
-
- /**
- * Set LCD chip select to LOW
- */
- mraa::Result lcdCSOn();
-
- /**
- * Set LCD chip select to HIGH
- */
- mraa::Result lcdCSOff();
-
- /**
- * Set SD card chip select to LOW
- */
- mraa::Result sdCSOn();
-
- /**
- * Set SD card chip select to HIGH
- */
- mraa::Result sdCSOff();
-
- /**
- * Set data/command line to HIGH
- */
- mraa::Result dcHigh();
-
- /**
- * Set data/command line to LOW
- */
- mraa::Result dcLow();
-
- /**
- * Set reset line to HIGH
- */
- mraa::Result rstHigh();
-
- /**
- * Set reset line to LOW
- */
- mraa::Result rstLow();
-
- private:
- mraa::Spi m_spi;
- uint8_t m_spiBuffer[32];
-
- mraa::Gpio m_csLCDPinCtx;
- mraa::Gpio m_csSDPinCtx;
- mraa::Gpio m_dcPinCtx;
- mraa::Gpio m_rstPinCtx;
-
- std::string m_name;
- };
-}
-
diff --git a/peripheral/libupm/src/ili9341/javaupm_ili9341.i b/peripheral/libupm/src/ili9341/javaupm_ili9341.i
deleted file mode 100644
index d725498..0000000
--- a/peripheral/libupm/src/ili9341/javaupm_ili9341.i
+++ /dev/null
@@ -1,28 +0,0 @@
-%module javaupm_ili9341
-%include "../upm.i"
-%include "stdint.i"
-%include "typemaps.i"
-
-%apply uint8_t *INPUT { uint8_t *addr }
-
-%include "gfx.h"
-%{
- #include "gfx.h"
-%}
-
-%{
- #include "ili9341.h"
-%}
-
-%include "ili9341.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_ili9341");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/ili9341/jsupm_ili9341.i b/peripheral/libupm/src/ili9341/jsupm_ili9341.i
deleted file mode 100644
index db58074..0000000
--- a/peripheral/libupm/src/ili9341/jsupm_ili9341.i
+++ /dev/null
@@ -1,12 +0,0 @@
-%module jsupm_ili9341
-%include "../upm.i"
-
-%include "gfx.h"
-%{
- #include "gfx.h"
-%}
-
-%include "ili9341.h"
-%{
- #include "ili9341.h"
-%}
diff --git a/peripheral/libupm/src/ili9341/pyupm_ili9341.i b/peripheral/libupm/src/ili9341/pyupm_ili9341.i
deleted file mode 100644
index c772853..0000000
--- a/peripheral/libupm/src/ili9341/pyupm_ili9341.i
+++ /dev/null
@@ -1,17 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_ili9341
-%include "../upm.i"
-
-%feature("autodoc", "3");
-%rename("printString") print(std::string msg);
-
-%include "gfx.h"
-%{
- #include "gfx.h"
-%}
-
-%include "ili9341.h"
-%{
- #include "ili9341.h"
-%}
diff --git a/peripheral/libupm/src/ina132/CMakeLists.txt b/peripheral/libupm/src/ina132/CMakeLists.txt
deleted file mode 100644
index d1dd9fd..0000000
--- a/peripheral/libupm/src/ina132/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "ina132")
-set (libdescription "upm ina132 differential amplifier sensor module")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/ina132/ina132.cxx b/peripheral/libupm/src/ina132/ina132.cxx
deleted file mode 100644
index ffba007..0000000
--- a/peripheral/libupm/src/ina132/ina132.cxx
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Author: Zion Orent <zorent@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <string>
-#include <stdexcept>
-#include <unistd.h>
-
-#include "ina132.h"
-
-using namespace upm;
-using namespace std;
-
-INA132::INA132(int pin)
-{
- if ( !(m_aio = mraa_aio_init(pin)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_aio_init() failed, invalid pin?");
- return;
- }
-}
-
-INA132::~INA132()
-{
- mraa_aio_close(m_aio);
-}
-
-float INA132::value()
-{
- int val, i;
- float v, vo;
- float sum=0;
- for(i=0;i<10;i++)
- {
- val = mraa_aio_read(m_aio);
- v = val*5.00/1023;
- sum += v;
- usleep(10000);
- }
- vo = sum/10;
- return vo;
-}
diff --git a/peripheral/libupm/src/ina132/ina132.h b/peripheral/libupm/src/ina132/ina132.h
deleted file mode 100644
index 56d32d3..0000000
--- a/peripheral/libupm/src/ina132/ina132.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Author: Zion Orent <zorent@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include <mraa/aio.h>
-
-namespace upm {
- /**
- * @brief INA132 Differential Amplifier Sensor library
- * @defgroup ina132 libupm-ina132
- * @ingroup seeed analog electric
- */
- /**
- * @library ina132
- * @sensor ina132
- * @comname Grove Differential Amplifier
- * @altname INA132
- * @type electric
- * @man seeed
- * @con analog
- *
- * @brief API for the INA132 Differential Amplifier Sensor
- *
- * The INA132 Differential Amplifier Sensor is designed
- * for precise differential-input amplification.
- *
- * This sensor was tested amplifying the signal
- * from a Weight Sensor (Load Cell) 0-500g
- *
- * @image html ina132.jpg
- * @snippet ina132.cxx Interesting
- */
- class INA132 {
- public:
- /**
- * INA132 constructor
- *
- * @param pin Analog pin to use
- */
- INA132(int pin);
- /**
- * INA132 destructor
- */
- ~INA132();
-
- /**
- * Measures precise differential-input amplification from the sensor
- *
- * @return Precise differential-input amplification
- */
- float value();
-
- private:
- mraa_aio_context m_aio;
- };
-}
-
-
diff --git a/peripheral/libupm/src/ina132/javaupm_ina132.i b/peripheral/libupm/src/ina132/javaupm_ina132.i
deleted file mode 100644
index b49ed20..0000000
--- a/peripheral/libupm/src/ina132/javaupm_ina132.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_ina132
-%include "../upm.i"
-
-%{
- #include "ina132.h"
-%}
-
-%include "ina132.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_ina132");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/ina132/jsupm_ina132.i b/peripheral/libupm/src/ina132/jsupm_ina132.i
deleted file mode 100644
index 28be9ba..0000000
--- a/peripheral/libupm/src/ina132/jsupm_ina132.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_ina132
-%include "../upm.i"
-
-%{
- #include "ina132.h"
-%}
-
-%include "ina132.h"
diff --git a/peripheral/libupm/src/ina132/pyupm_ina132.i b/peripheral/libupm/src/ina132/pyupm_ina132.i
deleted file mode 100644
index 01f6a60..0000000
--- a/peripheral/libupm/src/ina132/pyupm_ina132.i
+++ /dev/null
@@ -1,11 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_ina132
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "ina132.h"
-%{
- #include "ina132.h"
-%}
diff --git a/peripheral/libupm/src/isd1820/CMakeLists.txt b/peripheral/libupm/src/isd1820/CMakeLists.txt
deleted file mode 100644
index 57ee9c1..0000000
--- a/peripheral/libupm/src/isd1820/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "isd1820")
-set (libdescription "upm grove recorder")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/isd1820/isd1820.cxx b/peripheral/libupm/src/isd1820/isd1820.cxx
deleted file mode 100644
index 29aed20..0000000
--- a/peripheral/libupm/src/isd1820/isd1820.cxx
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <string>
-#include <stdexcept>
-
-#include "isd1820.h"
-
-using namespace upm;
-using namespace std;
-
-ISD1820::ISD1820(int playPin, int recPin)
-{
- if ( !(m_gpioPlay = mraa_gpio_init(playPin)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_gpio_init(playPin) failed, invalid pin?");
- return;
- }
-
- mraa_gpio_dir(m_gpioPlay, MRAA_GPIO_OUT);
-
- if ( !(m_gpioRec = mraa_gpio_init(recPin)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_gpio_init(recPin) failed, invalid pin?");
- return;
- }
-
- mraa_gpio_dir(m_gpioRec, MRAA_GPIO_OUT);
-
- // make sure we are not recording or playing
- play(false);
- record(false);
-}
-
-ISD1820::~ISD1820()
-{
- mraa_gpio_close(m_gpioPlay);
- mraa_gpio_close(m_gpioRec);
-}
-
-void ISD1820::play(bool enable)
-{
- if (enable)
- {
- // make sure we are not recording
- record(false);
- mraa_gpio_write(m_gpioPlay, 1);
- }
- else
- {
- mraa_gpio_write(m_gpioPlay, 0);
- }
-}
-
-void ISD1820::record(bool enable)
-{
- if (enable)
- {
- // make sure we are not playing
- play(false);
- mraa_gpio_write(m_gpioRec, 1);
- }
- else
- {
- mraa_gpio_write(m_gpioRec, 0);
- }
-}
diff --git a/peripheral/libupm/src/isd1820/isd1820.h b/peripheral/libupm/src/isd1820/isd1820.h
deleted file mode 100644
index 8e89511..0000000
--- a/peripheral/libupm/src/isd1820/isd1820.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <iostream>
-
-#include <mraa/gpio.h>
-
-namespace upm {
- /**
- * @brief ISD1820 Voice Recorder Module library
- * @defgroup isd1820 libupm-isd1820
- * @ingroup seeed gpio sound
- */
-
- /**
- * @library isd1820
- * @sensor isd1820
- * @comname Grove Recorder
- * @altname ISD1820 Recorder
- * @type sound
- * @man seeed
- * @con gpio
- *
- * @brief API support for the ISD1820-based Grove Voice Recorder
- *
- * This class implements support for the Grove Voice Recorder. There
- * are two digital pins: one that enables recording, and the other
- * that plays back what was previously recorded.
- *
- * @image html isd1820.jpg
- * @snippet isd1820.cxx Interesting
- */
- class ISD1820 {
- public:
-
- /**
- * ISD1820 constructor
- *
- * @param recPin Pin to use for recording
- * @param playPin Pin to use for playback
- */
- ISD1820(int playPin, int recPin);
-
- /**
- * ISD1820 destructor
- */
- ~ISD1820();
-
- /**
- * Starts or stops playback
- *
- * @param enable Starts playback if true, stops if false
- */
- void play(bool enable);
-
- /**
- * Starts or stops recording
- *
- * @param enable Starts recording if true, stops if false
- */
- void record(bool enable);
-
- private:
- mraa_gpio_context m_gpioRec;
- mraa_gpio_context m_gpioPlay;
- };
-}
-
-
diff --git a/peripheral/libupm/src/isd1820/javaupm_isd1820.i b/peripheral/libupm/src/isd1820/javaupm_isd1820.i
deleted file mode 100644
index ac5f341..0000000
--- a/peripheral/libupm/src/isd1820/javaupm_isd1820.i
+++ /dev/null
@@ -1,20 +0,0 @@
-%module javaupm_isd1820
-%include "../upm.i"
-
-%{
- #include "isd1820.h"
-%}
-
-%include "isd1820.h"
-
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_isd1820");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/isd1820/jsupm_isd1820.i b/peripheral/libupm/src/isd1820/jsupm_isd1820.i
deleted file mode 100644
index 30d7e03..0000000
--- a/peripheral/libupm/src/isd1820/jsupm_isd1820.i
+++ /dev/null
@@ -1,9 +0,0 @@
-%module jsupm_isd1820
-%include "../upm.i"
-
-%{
- #include "isd1820.h"
-%}
-
-%include "isd1820.h"
-
diff --git a/peripheral/libupm/src/isd1820/pyupm_isd1820.i b/peripheral/libupm/src/isd1820/pyupm_isd1820.i
deleted file mode 100644
index ec916f4..0000000
--- a/peripheral/libupm/src/isd1820/pyupm_isd1820.i
+++ /dev/null
@@ -1,13 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_isd1820
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%{
- #include "isd1820.h"
-%}
-
-%include "isd1820.h"
-
diff --git a/peripheral/libupm/src/itg3200/CMakeLists.txt b/peripheral/libupm/src/itg3200/CMakeLists.txt
deleted file mode 100644
index 5be008b..0000000
--- a/peripheral/libupm/src/itg3200/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "itg3200")
-set (libdescription "libupm Digital Gyro")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/itg3200/itg3200.cxx b/peripheral/libupm/src/itg3200/itg3200.cxx
deleted file mode 100644
index 1f2f2ff..0000000
--- a/peripheral/libupm/src/itg3200/itg3200.cxx
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * Author: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <string>
-#include <stdexcept>
-#include <unistd.h>
-#include "math.h"
-#include "itg3200.h"
-
-#define READ_BUFFER_LENGTH 8
-
-//address and id
-#define ITG3200_I2C_ADDR 0x68
-#define ITG3200_ID 0x00
-
-//configuration registers
-#define ITG3200_SMPLRT_DIV 0x15
-#define ITG3200_DLPF_FS 0x16
-
-//interrupt registers
-#define ITG3200_INT_CFG 0x17
-#define ITG3200_INT_STATUS 0x1A
-
-//data registers (read only)
-#define ITG3200_TEMP_H 0x1B
-#define ITG3200_TEMP_L 0x1C
-#define ITG3200_XOUT_H 0x1D
-#define ITG3200_XOUT_L 0x1E
-#define ITG3200_YOUT_H 0x1F
-#define ITG3200_YOUT_L 0x20
-#define ITG3200_ZOUT_H 0x21
-#define ITG3200_ZOUT_L 0x22
-#define DATA_REG_SIZE 8
-
-//power management
-#define ITG3200_PWR_MGM 0x3E
-
-//useful values
-#define ITG3200_RESET 0x80
-#define ITG3200_SLEEP 0x40
-#define ITG3200_WAKEUP 0x00
-
-using namespace upm;
-
-Itg3200::Itg3200(int bus) : m_i2c(bus)
-{
- m_i2c.address(ITG3200_I2C_ADDR);
- m_buffer[0] = ITG3200_PWR_MGM;
- m_buffer[1] = ITG3200_RESET;
- m_i2c.write(m_buffer, 2);
-
- Itg3200::calibrate();
- Itg3200::update();
-}
-
-void
-Itg3200::calibrate(void)
-{
- int reads = 600;
- int delay = 4000; // 4 milliseconds
- int skip = 5; // initial samples to skip
- int temp[3] = {0};
-
- for(int i = 0; i < reads; i++){
-
- Itg3200::update();
- if (i >= skip){
- for (int j = 0; j < 3; j++){
- temp[j] += m_rotation[j];
- }
- }
- usleep(delay);
- }
-
- for(int i = 0; i < 3; i++){
- m_offsets[i] = (-1) * temp[i] / (reads - skip);
- }
-}
-
-float
-Itg3200::getTemperature()
-{
- return 35.0 + (m_temperature + 13200.0) / 280.0;
-}
-
-float*
-Itg3200::getRotation()
-{
- for(int i = 0; i < 3; i++){
- m_angle[i] = m_rotation[i]/14.375;
- }
- return &m_angle[0];
-}
-
-int16_t*
-Itg3200::getRawValues()
-{
- return &m_rotation[0];
-}
-
-int16_t
-Itg3200::getRawTemp()
-{
- return m_temperature;
-}
-
-mraa::Result
-Itg3200::update(void)
-{
- m_i2c.address(ITG3200_I2C_ADDR);
- m_i2c.writeByte(ITG3200_TEMP_H);
-
- m_i2c.address(ITG3200_I2C_ADDR);
- m_i2c.read(m_buffer, DATA_REG_SIZE);
-
- //temp
- //
- m_temperature = (m_buffer[0] << 8 ) | m_buffer[1];
- // x
- m_rotation[0] = ((m_buffer[2] << 8 ) | m_buffer[3]) + m_offsets[0];
- // y
- m_rotation[1] = ((m_buffer[4] << 8 ) | m_buffer[5]) + m_offsets[1];
- // z
- m_rotation[2] = ((m_buffer[6] << 8 ) | m_buffer[7]) + m_offsets[2];
-
- return mraa::SUCCESS;
-}
diff --git a/peripheral/libupm/src/itg3200/itg3200.h b/peripheral/libupm/src/itg3200/itg3200.h
deleted file mode 100644
index 32ec1f6..0000000
--- a/peripheral/libupm/src/itg3200/itg3200.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Author: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <mraa/i2c.hpp>
-
-#define READ_BUFFER_LENGTH 8
-
-namespace upm {
-
-/**
- * @brief ITG-3200 Gyroscope library
- * @defgroup itg3200 libupm-itg3200
- * @ingroup seeed i2c compass
- */
-
-/**
- * @library itg3200
- * @sensor itg3200
- * @comname ITG-3200 3-Axis Digital Gyroscope
- * @altname Grove 3-Axis Digital Gyroscope
- * @type compass
- * @man seeed
- * @con i2c
- *
- * @brief API for the ITG-3200 3-Axis Digital Gyroscope
- *
- * InvenSense* ITG-3200 is a 3-axis digital gyroscope.
- * (https://www.sparkfun.com/datasheets/Sensors/Gyro/PS-ITG-3200-00-01.4.pdf)
- * This sensor has been tested and can run at either 3.3V or 5V on Intel(R) Galileo.<br>
- * <strong>However</strong>, it is incompatible with and not detected on the I2C bus
- * by Intel(R) Edison using the Arduino* breakout board.
- *
- * @image html itg3200.jpeg
- * @snippet itg3200.cxx Interesting
- */
-class Itg3200 {
-public:
- /**
- * Creates an Itg3200 object
- *
- * @param bus Number of the used I2C bus
- */
- Itg3200(int bus);
-
- /**
- * Calibrates the sensor to 0 on all axes. The sensor needs to be resting for accurate calibration.
- * It takes about 3 seconds and is also called by the constructor on object creation.
- *
- */
- void calibrate();
-
- /**
- * Returns the temperature reading, in Celsius, from the integrated temperature sensor
- *
- * @return float Temperature in Celsius
- */
- float getTemperature();
-
- /**
- * Returns a pointer to a float[3] that contains computed rotational speeds (angular velocities)
- *
- * @return float* to a float[3]
- */
- float* getRotation();
-
- /**
- * Returns a pointer to an int[3] that contains raw register values for X, Y, and Z
- *
- * @return int* to an int[3]
- */
- int16_t* getRawValues();
-
- /**
- * Returns an int that contains the raw register value for the temperature
- *
- * @return int Raw temperature
- */
- int16_t getRawTemp();
-
- /**
- * Updates the rotational values and temperature by reading from the I2C bus
- *
- * @return 0 if successful
- */
- mraa::Result update();
-private:
- float m_angle[3];
- int16_t m_rotation[3];
- int16_t m_offsets[3];
- int16_t m_temperature;
- uint8_t m_buffer[READ_BUFFER_LENGTH];
- mraa::I2c m_i2c;
-};
-
-}
diff --git a/peripheral/libupm/src/itg3200/javaupm_itg3200.i b/peripheral/libupm/src/itg3200/javaupm_itg3200.i
deleted file mode 100644
index 012c6a0..0000000
--- a/peripheral/libupm/src/itg3200/javaupm_itg3200.i
+++ /dev/null
@@ -1,46 +0,0 @@
-%module javaupm_itg3200
-%include "../upm.i"
-
-%{
- #include "itg3200.h"
-%}
-
-%typemap(jni) float* "jfloatArray"
-%typemap(jstype) float* "float[]"
-%typemap(jtype) float* "float[]"
-
-%typemap(javaout) float* {
- return $jnicall;
-}
-
-%typemap(out) float *getRotation {
- $result = JCALL1(NewFloatArray, jenv, 3);
- JCALL4(SetFloatArrayRegion, jenv, $result, 0, 3, $1);
-}
-
-
-%typemap(jni) int16_t* "jshortArray"
-%typemap(jstype) int16_t* "short[]"
-%typemap(jtype) int16_t* "short[]"
-
-%typemap(javaout) int16_t* {
- return $jnicall;
-}
-
-%typemap(out) int16_t *getRawValues {
- $result = JCALL1(NewShortArray, jenv, 3);
- JCALL4(SetShortArrayRegion, jenv, $result, 0, 3, (jshort*)$1);
-}
-
-%include "itg3200.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_itg3200");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/itg3200/jsupm_itg3200.i b/peripheral/libupm/src/itg3200/jsupm_itg3200.i
deleted file mode 100644
index 011ffc6..0000000
--- a/peripheral/libupm/src/itg3200/jsupm_itg3200.i
+++ /dev/null
@@ -1,20 +0,0 @@
-%module jsupm_itg3200
-%include "../upm.i"
-%include "../carrays_int16_t.i"
-%include "../carrays_float.i"
-
-%{
- #include "itg3200.h"
-%}
-
-%typemap(out) int16_t * {
- $result = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_int16Array, 0 | 0 );
-}
-
-%typemap(out) float * {
- $result = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_floatArray, 0 | 0 );
-}
-
-%include "itg3200.h"
-
-%include <carrays.i>
diff --git a/peripheral/libupm/src/itg3200/pyupm_itg3200.i b/peripheral/libupm/src/itg3200/pyupm_itg3200.i
deleted file mode 100644
index 7faae41..0000000
--- a/peripheral/libupm/src/itg3200/pyupm_itg3200.i
+++ /dev/null
@@ -1,25 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_itg3200
-%include "../upm.i"
-%include "../carrays_int16_t.i"
-%include "../carrays_float.i"
-
-%typemap(out) int16_t * {
- $result = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_int16Array, 0 | 0 );
-}
-
-%typemap(out) float * {
- $result = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_floatArray, 0 | 0 );
-}
-
-%feature("autodoc", "3");
-
-#ifdef DOXYGEN
-%include "itg3200_doc.i"
-#endif
-
-%include "itg3200.h"
-%{
- #include "itg3200.h"
-%}
diff --git a/peripheral/libupm/src/java_buffer.i b/peripheral/libupm/src/java_buffer.i
deleted file mode 100644
index 6fec084..0000000
--- a/peripheral/libupm/src/java_buffer.i
+++ /dev/null
@@ -1,45 +0,0 @@
-
-%typemap(jni) (uint8_t *buffer, int len) "jbyteArray";
-%typemap(jtype) (uint8_t *buffer, int len) "byte[]";
-%typemap(jstype) (uint8_t *buffer, int len) "byte[]";
-
-%typemap(javain) (uint8_t *buffer, int len) "$javainput";
-
-%typemap(in) (uint8_t *buffer, int len) {
- $1 = (uint8_t *) JCALL2(GetByteArrayElements, jenv, $input, NULL);
- $2 = JCALL1(GetArrayLength, jenv, $input);
-}
-
-%typemap(freearg) (uint8_t *buffer, int len) {
- JCALL3(ReleaseByteArrayElements, jenv, $input, (jbyte *)$1, 0);
-}
-
-%typemap(jni) (uint8_t *pkt, int len) "jbyteArray";
-%typemap(jtype) (uint8_t *pkt, int len) "byte[]";
-%typemap(jstype) (uint8_t *pkt, int len) "byte[]";
-
-%typemap(javain) (uint8_t *pkt, int len) "$javainput";
-
-%typemap(in) (uint8_t *pkt, int len) {
- $1 = (uint8_t *) JCALL2(GetByteArrayElements, jenv, $input, NULL);
- $2 = JCALL1(GetArrayLength, jenv, $input);
-}
-
-%typemap(freearg) (uint8_t *pkt, int len) {
- JCALL3(ReleaseByteArrayElements, jenv, $input, (jbyte *)$1, 0);
-}
-
-%typemap(jni) (char *buffer, int len) "jbyteArray";
-%typemap(jtype) (char *buffer, int len) "byte[]";
-%typemap(jstype) (char *buffer, int len) "byte[]";
-
-%typemap(javain) (char *buffer, int len) "$javainput";
-
-%typemap(in) (char *buffer, int len) {
- $1 = (char *) JCALL2(GetByteArrayElements, jenv, $input, NULL);
- $2 = JCALL1(GetArrayLength, jenv, $input);
-}
-
-%typemap(freearg) (char *buffer, int len) {
- JCALL3(ReleaseByteArrayElements, jenv, $input, (jbyte *)$1, 0);
-}
diff --git a/peripheral/libupm/src/java_exceptions.i b/peripheral/libupm/src/java_exceptions.i
deleted file mode 100644
index 235dbe9..0000000
--- a/peripheral/libupm/src/java_exceptions.i
+++ /dev/null
@@ -1,21 +0,0 @@
-/* -----------------------------------------------------------------------------
- * java_exceptions.i
- *
- * SWIG library file providing java-specific exception handling in the upm library
- * ----------------------------------------------------------------------------- */
-
-/*
- * Use this macro for functions that read data from a sensor and throw a
- * std::runtime_error in case of a read failure
-*/
-%define READDATA_EXCEPTION(function)
-%javaexception("java.io.IOException") function {
- try {
- $action
- } catch (std::runtime_error &e) {
- jclass clazz = jenv->FindClass("java/io/IOException");
- jenv->ThrowNew(clazz, e.what());
- return $null;
- }
-}
-%enddef
diff --git a/peripheral/libupm/src/javaswig_blacklist b/peripheral/libupm/src/javaswig_blacklist
deleted file mode 100644
index f38ff79..0000000
--- a/peripheral/libupm/src/javaswig_blacklist
+++ /dev/null
@@ -1 +0,0 @@
-nrf8001
diff --git a/peripheral/libupm/src/joystick12/CMakeLists.txt b/peripheral/libupm/src/joystick12/CMakeLists.txt
deleted file mode 100644
index 750e62e..0000000
--- a/peripheral/libupm/src/joystick12/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "joystick12")
-set (libdescription "ElecFreaks Joystick 1.2")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/joystick12/javaupm_joystick12.i b/peripheral/libupm/src/joystick12/javaupm_joystick12.i
deleted file mode 100644
index 8ebe78f..0000000
--- a/peripheral/libupm/src/joystick12/javaupm_joystick12.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_joystick12
-%include "../upm.i"
-
-%{
- #include "joystick12.h"
-%}
-
-%include "joystick12.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_joystick12");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/joystick12/joystick12.cxx b/peripheral/libupm/src/joystick12/joystick12.cxx
deleted file mode 100644
index b70557c..0000000
--- a/peripheral/libupm/src/joystick12/joystick12.cxx
+++ /dev/null
@@ -1,98 +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.
- */
-
-#include <iostream>
-#include <string>
-#include <stdexcept>
-#include <unistd.h>
-#include <stdlib.h>
-#include <functional>
-#include <string.h>
-#include "joystick12.h"
-
-using namespace upm;
-
-// FIXME AK: to make configurable if needed
-const int Joystick12::X_left = 100;
-const int Joystick12::X_center = 1610;
-const int Joystick12::X_right= 4070;
-
-const int Joystick12::Y_left = 2;
-const int Joystick12::Y_center = 1610;
-const int Joystick12::Y_right= 4070;
-
-
-Joystick12::Joystick12(int pinX, int pinY) {
-
- if ( !(m_joystickCtxX = mraa_aio_init(pinX)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_aio_init(pinX) failed, invalid pin?");
- return;
- }
-
- if ( !(m_joystickCtxY = mraa_aio_init(pinY)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_aio_init(pinY) failed, invalid pin?");
- return;
- }
-}
-
-Joystick12::~Joystick12() {
- // close inputs
- mraa_result_t error;
- error = mraa_aio_close(m_joystickCtxX);
- if (error != MRAA_SUCCESS) {
- mraa_result_print(error);
- }
- error = mraa_aio_close(m_joystickCtxY);
- if (error != MRAA_SUCCESS) {
- mraa_result_print(error);
- }
-}
-
-float Joystick12::getXInput() {
- float in = mraa_aio_read (m_joystickCtxX);
- if (in < X_left) return -1;
- if (in < X_center) return -(X_center - in) / (X_center - X_left);
- if (in == X_center) return 0;
- if (in < X_right) return (in - X_center) / (X_right - X_center);
- if (in >= X_right) return 1;
- mraa_result_print(MRAA_ERROR_UNSPECIFIED);
- return 0;
-}
-
-float Joystick12::getYInput() {
- float in = mraa_aio_read (m_joystickCtxY);
- if (in < Y_left) return -1;
- if (in < Y_center) return -(Y_center - in) / (Y_center - Y_left);
- if (in == Y_center) return 0;
- if (in < Y_right) return (in - Y_center) / (Y_right - Y_center);
- if (in >= Y_right) return 1;
- mraa_result_print(MRAA_ERROR_UNSPECIFIED);
- return 0;
-}
-
-
diff --git a/peripheral/libupm/src/joystick12/joystick12.h b/peripheral/libupm/src/joystick12/joystick12.h
deleted file mode 100644
index 2157fa6..0000000
--- a/peripheral/libupm/src/joystick12/joystick12.h
+++ /dev/null
@@ -1,97 +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.
- */
-#pragma once
-
-#include <string>
-#include <mraa/gpio.h>
-#include <mraa/aio.h>
-
-namespace upm {
-
-/**
- * @brief Analog Joystick library
- * @defgroup joystick12 libupm-joystick12
- * @ingroup generic analog ainput robok
- */
-
-/**
- * @library joystick12
- * @sensor joystick12
- * @comname Analog Joystick
- * @type ainput
- * @man generic
- * @con analog
- * @kit robok
- *
- * @brief API for the ElecFreaks* Joystick v 1.2-1.4 Breakout
- *
- * This module defines the Joystick API, and implementation for the X and Y
- * buttons could be treated as normal GPIO - this enables easier
- * interrupt support. This driver should be compatible with any
- * 2-axis analog joystick.
- *
- * @image html joystick12.jpg
- * @snippet joystick12-example.cxx Interesting
- */
-class Joystick12 {
- public:
- /**
- * Instantiates a Joystick object
- *
- * @param pinX Analog pin where the X input is connected
- * @param pinY Analog pin where the Y input is connected
- */
- Joystick12(int pinX, int pinY);
-
- /**
- * Joystick object destructor
- */
- ~Joystick12();
-
- /**
- * Gets the X input
- * @return float X value, ranging from -1 to 1; 0 is mid
- */
- float getXInput();
-
- /**
- * Gets the Y input
- *
- * @return float Y value, ranging from -1 to 1; 0 is mid
- */
- float getYInput();
-
- private:
- mraa_aio_context m_joystickCtxX;
- mraa_aio_context m_joystickCtxY;
-
- static const int X_left;
- static const int X_center;
- static const int X_right;
- static const int Y_left;
- static const int Y_center;
- static const int Y_right;
-};
-};
-
diff --git a/peripheral/libupm/src/joystick12/jsupm_joystick12.i b/peripheral/libupm/src/joystick12/jsupm_joystick12.i
deleted file mode 100644
index 640273f..0000000
--- a/peripheral/libupm/src/joystick12/jsupm_joystick12.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_joystick12
-%include "../upm.i"
-
-%{
- #include "joystick12.h"
-%}
-
-%include "joystick12.h"
diff --git a/peripheral/libupm/src/joystick12/pyupm_joystick12.i b/peripheral/libupm/src/joystick12/pyupm_joystick12.i
deleted file mode 100644
index fa7637c..0000000
--- a/peripheral/libupm/src/joystick12/pyupm_joystick12.i
+++ /dev/null
@@ -1,13 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_joystick12
-%include "../upm.i"
-
-%include "stdint.i"
-
-%feature("autodoc", "3");
-
-%include "joystick12.h"
-%{
- #include "joystick12.h"
-%}
diff --git a/peripheral/libupm/src/kxcjk1013/CMakeLists.txt b/peripheral/libupm/src/kxcjk1013/CMakeLists.txt
deleted file mode 100644
index 679dc4a..0000000
--- a/peripheral/libupm/src/kxcjk1013/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "kxcjk1013")
-set (libdescription "upm kxcjk1013 sensor module")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/kxcjk1013/javaupm_kxcjk1013.i b/peripheral/libupm/src/kxcjk1013/javaupm_kxcjk1013.i
deleted file mode 100644
index 1c5e88f..0000000
--- a/peripheral/libupm/src/kxcjk1013/javaupm_kxcjk1013.i
+++ /dev/null
@@ -1,20 +0,0 @@
-%module javaupm_kxcjk1013
-%include "../upm.i"
-
-%{
- #include "kxcjk1013.h"
-%}
-%include "kxcjk1013.h"
-
-%ignore installISR(void (*isr)(char*), void* arg);
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_kxcjk1013");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%}
diff --git a/peripheral/libupm/src/kxcjk1013/jsupm_kxcjk1013.i b/peripheral/libupm/src/kxcjk1013/jsupm_kxcjk1013.i
deleted file mode 100644
index e457563..0000000
--- a/peripheral/libupm/src/kxcjk1013/jsupm_kxcjk1013.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_kxcjk1013
-%include "../upm.i"
-
-%{
- #include "kxcjk1013.h"
-%}
-
-%include "kxcjk1013.h"
diff --git a/peripheral/libupm/src/kxcjk1013/kxcjk1013.cxx b/peripheral/libupm/src/kxcjk1013/kxcjk1013.cxx
deleted file mode 100644
index 0eafbb7..0000000
--- a/peripheral/libupm/src/kxcjk1013/kxcjk1013.cxx
+++ /dev/null
@@ -1,199 +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 <iostream>
-#include <string>
-#include <stdexcept>
-#include <string.h>
-#include "kxcjk1013.h"
-
-using namespace upm;
-
-KXCJK1013::KXCJK1013(int device)
-{
- float accel_scale;
- char trigger[64];
-
- if (!(m_iio = mraa_iio_init(device))) {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_iio_init() failed, invalid device?");
- return;
- }
- m_scale = 1;
- m_iio_device_num = device;
- sprintf(trigger, "hrtimer-kxcjk1013-hr-dev%d", device);
-
- if (mraa_iio_create_trigger(m_iio, trigger) != MRAA_SUCCESS)
- fprintf(stderr, "Create trigger failed\n");
-
- if (mraa_iio_get_mounting_matrix(m_iio, m_mount_matrix) == MRAA_SUCCESS)
- m_mount_matrix_exist = true;
- else
- m_mount_matrix_exist = false;
-
- if (mraa_iio_read_float(m_iio, "in_accel_scale", &accel_scale) == MRAA_SUCCESS)
- m_scale = accel_scale;
-}
-
-KXCJK1013::~KXCJK1013()
-{
- // mraa_iio_stop(m_iio);
-}
-
-void
-KXCJK1013::installISR(void (*isr)(char*), void* arg)
-{
- mraa_iio_trigger_buffer(m_iio, isr, NULL);
-}
-
-int64_t
-KXCJK1013::getChannelValue(unsigned char* input, mraa_iio_channel* chan)
-{
- uint64_t u64;
- int i;
- int storagebits = chan->bytes * 8;
- int realbits = chan->bits_used;
- int zeroed_bits = storagebits - realbits;
- uint64_t sign_mask;
- uint64_t value_mask;
-
- u64 = 0;
-
- if (!chan->lendian)
- for (i = 0; i < storagebits / 8; i++)
- u64 = (u64 << 8) | input[i];
- else
- for (i = storagebits / 8 - 1; i >= 0; i--)
- u64 = (u64 << 8) | input[i];
-
- u64 = (u64 >> chan->shift) & (~0ULL >> zeroed_bits);
-
- if (!chan->signedd)
- return (int64_t) u64; /* We don't handle unsigned 64 bits int */
-
- /* Signed integer */
-
- switch (realbits) {
- case 0 ... 1:
- return 0;
-
- case 8:
- return (int64_t)(int8_t) u64;
-
- case 16:
- return (int64_t)(int16_t) u64;
-
- case 32:
- return (int64_t)(int32_t) u64;
-
- case 64:
- return (int64_t) u64;
-
- default:
- sign_mask = 1 << (realbits - 1);
- value_mask = sign_mask - 1;
-
- if (u64 & sign_mask)
- return -((~u64 & value_mask) + 1); /* Negative value: return 2-complement */
- else
- return (int64_t) u64; /* Positive value */
- }
-}
-
-bool
-KXCJK1013::enableBuffer(int length)
-{
- mraa_iio_write_int(m_iio, "buffer/length", length);
- // enable must be last step, else will have error in writing above config
- mraa_iio_write_int(m_iio, "buffer/enable", 1);
-
- return true;
-}
-
-bool
-KXCJK1013::disableBuffer()
-{
- mraa_iio_write_int(m_iio, "buffer/enable", 0);
-
- return true;
-}
-
-bool
-KXCJK1013::setScale(float scale)
-{
- mraa_iio_write_float(m_iio, "in_accel_scale", scale);
-
- return true;
-}
-
-bool
-KXCJK1013::setSamplingFrequency(float sampling_frequency)
-{
- mraa_iio_write_float(m_iio, "in_accel_sampling_frequency", sampling_frequency);
-
- return true;
-}
-
-bool
-KXCJK1013::enable3AxisChannel()
-{
- char trigger[64];
- sprintf(trigger, "kxcjk1013-hr-dev%d", m_iio_device_num);
-
- mraa_iio_write_string(m_iio, "trigger/current_trigger", trigger);
- mraa_iio_write_int(m_iio, "scan_elements/in_accel_x_en", 1);
- mraa_iio_write_int(m_iio, "scan_elements/in_accel_y_en", 1);
- mraa_iio_write_int(m_iio, "scan_elements/in_accel_z_en", 1);
-
- // need update channel data size after enable
- mraa_iio_update_channels(m_iio);
- return true;
-}
-
-void
-KXCJK1013::extract3Axis(char* data, float* x, float* y, float* z)
-{
- mraa_iio_channel* channels = mraa_iio_get_channels(m_iio);
- float tmp[3];
- int i = 0;
- int iio_x, iio_y, iio_z;
-
- iio_x = getChannelValue((unsigned char*) (data + channels[0].location), &channels[0]);
- iio_y = getChannelValue((unsigned char*) (data + channels[1].location), &channels[1]);
- iio_z = getChannelValue((unsigned char*) (data + channels[2].location), &channels[2]);
-
- *x = (iio_x * m_scale);
- *y = (iio_y * m_scale);
- *z = (iio_z * m_scale);
-
- if (m_mount_matrix_exist) {
- tmp[0] = *x * m_mount_matrix[0] + *y * m_mount_matrix[1] + *z * m_mount_matrix[2];
- tmp[1] = *x * m_mount_matrix[3] + *y * m_mount_matrix[4] + *z * m_mount_matrix[5];
- tmp[2] = *x * m_mount_matrix[6] + *y * m_mount_matrix[7] + *z * m_mount_matrix[8];
-
- *x = tmp[0];
- *y = tmp[1];
- *z = tmp[2];
- }
-}
diff --git a/peripheral/libupm/src/kxcjk1013/kxcjk1013.h b/peripheral/libupm/src/kxcjk1013/kxcjk1013.h
deleted file mode 100644
index 0a2f2ab..0000000
--- a/peripheral/libupm/src/kxcjk1013/kxcjk1013.h
+++ /dev/null
@@ -1,127 +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
-
-#include <string>
-#include <mraa/iio.h>
-
-namespace upm
-{
-/**
- * @brief KXCJK1013 Tri-axis Digital Accelerometer
- * @defgroup kxcjk1013 libupm-kxcjk1013
- * @ingroup Kionix iio i2c tri-axis digital accelerometer
- */
-
-/**
- * @library kxcjk1013
- * @sensor kxcjk1013
- * @comname KXCJK1013 Tri-axis Digital Accelerometer
- * @type accelerometer
- * @man Kionix
- * @con iio i2c
- *
- * @brief KXCJK1013 Tri-axis Digital Accelerometer API
- *
- * The KXCJK is a tri-axis +/-2g, +/-4g or +/-8g silicon micromachined
- * accelerometer.
- *
- * @snippet kxcjk1013.cxx Interesting
- */
-
-class KXCJK1013
-{
- public:
- /**
- * KXCJK1013 Tri-axis Digital Accelerometer
- *
- * @param iio device number
- */
- KXCJK1013(int device);
- /**
- * KXCJK1013 destructor
- */
- ~KXCJK1013();
- /**
- * Installs an interrupt service routine (ISR) to be called when
- * an interrupt occurs
- *
- * @param interrupt channel
- * @param fptr Pointer to a function to be called on interrupt
- * @param arg Pointer to an object to be supplied as an
- * argument to the ISR.
- */
- void installISR(void (*isr)(char*), void* arg);
- /**
- * Extract the channel value based on channel type
- * @param input Channel data
- * @param chan MRAA iio-layer channel info
- */
- int64_t getChannelValue(unsigned char* input, mraa_iio_channel* chan);
-
- /**
- * Enable trigger buffer
- * @param trigger buffer length in string
- */
- bool enableBuffer(int length);
-
- /**
- * Disable trigger buffer
- */
- bool disableBuffer();
-
- /**
- * Set scale
- * @param scale in string
- */
- bool setScale(const float scale);
-
- /**
- * Set sampling frequency
- * @param sampling frequency in string
- */
- bool setSamplingFrequency(const float sampling_frequency);
-
- /**
- * Enable 3 axis scan element
- */
- bool enable3AxisChannel();
-
- /**
- * Process enabled channel buffer and return x, y, z axis
- * @param data Enabled channel data, 6 bytes, each axis 2 bytes
- * @param x X-Axis
- * @param y Y-Axis
- * @param z Z-Axis
- */
- void extract3Axis(char* data, float* x, float* y, float* z);
-
- private:
- mraa_iio_context m_iio;
- int m_iio_device_num;
- bool m_mount_matrix_exist; // is mount matrix exist
- float m_mount_matrix[9]; // mount matrix
- float m_scale; // accelerometer data scale
-};
-}
diff --git a/peripheral/libupm/src/kxcjk1013/pyupm_kxcjk1013.i b/peripheral/libupm/src/kxcjk1013/pyupm_kxcjk1013.i
deleted file mode 100644
index 87b8d77..0000000
--- a/peripheral/libupm/src/kxcjk1013/pyupm_kxcjk1013.i
+++ /dev/null
@@ -1,9 +0,0 @@
-%module pyupm_kxcjk1013
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "kxcjk1013.h"
-%{
- #include "kxcjk1013.h"
-%}
diff --git a/peripheral/libupm/src/l298/CMakeLists.txt b/peripheral/libupm/src/l298/CMakeLists.txt
deleted file mode 100644
index e42e3b5..0000000
--- a/peripheral/libupm/src/l298/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "l298")
-set (libdescription "upm l298 dual h-bridge")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/l298/javaupm_l298.i b/peripheral/libupm/src/l298/javaupm_l298.i
deleted file mode 100644
index 8a9355e..0000000
--- a/peripheral/libupm/src/l298/javaupm_l298.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_l298
-%include "../upm.i"
-
-%{
- #include "l298.h"
-%}
-
-%include "l298.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_l298");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/l298/jsupm_l298.i b/peripheral/libupm/src/l298/jsupm_l298.i
deleted file mode 100644
index 7fec3a0..0000000
--- a/peripheral/libupm/src/l298/jsupm_l298.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_l298
-%include "../upm.i"
-
-%{
- #include "l298.h"
-%}
-
-%include "l298.h"
diff --git a/peripheral/libupm/src/l298/l298.cxx b/peripheral/libupm/src/l298/l298.cxx
deleted file mode 100644
index 00c08ec..0000000
--- a/peripheral/libupm/src/l298/l298.cxx
+++ /dev/null
@@ -1,345 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <string>
-#include <stdexcept>
-
-#include "l298.h"
-
-using namespace upm;
-using namespace std;
-
-// constructor for the DC motor(s) mode
-L298::L298(int pwmA, int dir1, int dir2)
-{
- // No stepper in this mode
- m_stepper = false;
-
- // disable until complete
- m_motor = false;
-
- if ( !(m_pwm = mraa_pwm_init(pwmA)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_pwm_init() failed, invalid pin?");
- return;
- }
-
- if ( !(m_dir1 = mraa_gpio_init(dir1)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_gpio_init(dir1) failed, invalid pin?");
- mraa_pwm_close(m_pwm);
- return;
- }
- mraa_gpio_dir(m_dir1, MRAA_GPIO_OUT);
-
- if ( !(m_dir2 = mraa_gpio_init(dir2)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_gpio_init(dir2) failed, invalid pin?");
- mraa_pwm_close(m_pwm);
- mraa_gpio_close(m_dir1);
- return;
- }
- mraa_gpio_dir(m_dir2, MRAA_GPIO_OUT);
-
- setPeriodMS(L298_DEFAULT_PWM_PERIOD);
- setDirection(DIR_NONE);
- setSpeed(0);
- m_motor = true;
-}
-
-// constructor for the stepper mode
-L298::L298(int stepsPerRev, int en, int i1, int i2, int i3, int i4)
-{
- // no DC motors in this mode
- m_motor = false;
-
- // disable until complete
- m_stepper = false;
-
- m_stepsPerRev = stepsPerRev;
- m_currentStep = 0;
- m_stepDelay = 0;
- m_stepDirection = 1; // default is forward
-
- // init the gpio's we will need
- if ( !(m_stepEnable = mraa_gpio_init(en)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_gpio_init(en) failed, invalid pin?");
- return;
- }
- mraa_gpio_dir(m_stepEnable, MRAA_GPIO_OUT);
-
- if ( !(m_stepI1 = mraa_gpio_init(i1)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_gpio_init(i1) failed, invalid pin?");
- return;
- }
- mraa_gpio_dir(m_stepI1, MRAA_GPIO_OUT);
-
- if ( !(m_stepI2 = mraa_gpio_init(i2)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_gpio_init(i2) failed, invalid pin?");
- mraa_gpio_close(m_stepI1);
- return;
- }
- mraa_gpio_dir(m_stepI2, MRAA_GPIO_OUT);
-
- if ( !(m_stepI3 = mraa_gpio_init(i3)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_gpio_init(i3) failed, invalid pin?");
- mraa_gpio_close(m_stepI1);
- mraa_gpio_close(m_stepI2);
- return;
- }
- mraa_gpio_dir(m_stepI3, MRAA_GPIO_OUT);
-
- if ( !(m_stepI4 = mraa_gpio_init(i4)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_gpio_init(i4) failed, invalid pin?");
- mraa_gpio_close(m_stepI1);
- mraa_gpio_close(m_stepI2);
- mraa_gpio_close(m_stepI3);
-
- return;
- }
- mraa_gpio_dir(m_stepI4, MRAA_GPIO_OUT);
-
- m_stepper = true;
-}
-
-
-void L298::initClock()
-{
- gettimeofday(&m_startTime, NULL);
-}
-
-uint32_t L298::getMillis()
-{
- struct timeval elapsed, now;
- uint32_t elapse;
-
- // get current time
- gettimeofday(&now, NULL);
-
- // compute the delta since m_startTime
- if( (elapsed.tv_usec = now.tv_usec - m_startTime.tv_usec) < 0 )
- {
- elapsed.tv_usec += 1000000;
- elapsed.tv_sec = now.tv_sec - m_startTime.tv_sec - 1;
- }
- else
- {
- elapsed.tv_sec = now.tv_sec - m_startTime.tv_sec;
- }
-
- elapse = (uint32_t)((elapsed.tv_sec * 1000) + (elapsed.tv_usec / 1000));
-
- // never return 0
- if (elapse == 0)
- elapse = 1;
-
- return elapse;
-}
-
-
-L298::~L298()
-{
- if (m_stepper)
- {
- enable(false);
- mraa_gpio_close(m_stepEnable);
- mraa_gpio_close(m_stepI1);
- mraa_gpio_close(m_stepI2);
- mraa_gpio_close(m_stepI3);
- mraa_gpio_close(m_stepI4);
- }
-
- if (m_motor)
- {
- setDirection(DIR_NONE);
- setSpeed(0);
- enable(false);
- mraa_pwm_close(m_pwm);
- mraa_gpio_close(m_dir1);
- mraa_gpio_close(m_dir2);
- }
-}
-
-void L298::setPeriodMS(int ms)
-{
- if (m_motor)
- {
- if (mraa_pwm_period_ms(m_pwm, ms) != MRAA_SUCCESS)
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_pwm_period_ms() failed");
- }
-}
-
-void L298::enable(bool enable)
-{
- if (m_motor)
- {
- mraa_pwm_enable(m_pwm, ((enable) ? 1 : 0));
- }
-
- if (m_stepper)
- {
- mraa_gpio_write(m_stepEnable, ((enable) ? 1 : 0));
- }
-}
-
-void L298::setSpeed(int speed)
-{
- if (m_motor)
- {
- if (speed < 0)
- speed = 0;
-
- if (speed > 100)
- speed = 100;
-
- float percent = float(speed) / 100.0;
-
- if (m_motor)
- {
- mraa_pwm_write(m_pwm, percent);
- }
- }
-
- if (m_stepper)
- {
- m_stepDelay = 60 * 1000 / m_stepsPerRev / speed;
- }
-}
-
-void L298::setDirection(L298_DIRECTION_T dir)
-{
- if (m_motor)
- {
- if (dir & 0x01)
- mraa_gpio_write(m_dir1, 1);
- else
- mraa_gpio_write(m_dir1, 0);
-
- if (dir & 0x02)
- mraa_gpio_write(m_dir2, 1);
- else
- mraa_gpio_write(m_dir2, 0);
- }
-
- if (m_stepper)
- {
- switch (dir)
- {
- case DIR_CW:
- m_stepDirection = 1;
- break;
- case DIR_CCW:
- m_stepDirection = -1;
- break;
- default: // default to 1 if DIR_NONE specified
- m_stepDirection = 1;
- break;
- }
- }
-
-
-}
-
-void L298::stepperStep()
-{
- int step = m_currentStep % 4;
-
- // Step I0 I1 I2 I3
- // 1 1 0 1 0
- // 2 0 1 1 0
- // 3 0 1 0 1
- // 4 1 0 0 1
-
- switch (step)
- {
- case 0: // 1010
- mraa_gpio_write(m_stepI1, 1);
- mraa_gpio_write(m_stepI2, 0);
- mraa_gpio_write(m_stepI3, 1);
- mraa_gpio_write(m_stepI4, 0);
- break;
- case 1: // 0110
- mraa_gpio_write(m_stepI1, 0);
- mraa_gpio_write(m_stepI2, 1);
- mraa_gpio_write(m_stepI3, 1);
- mraa_gpio_write(m_stepI4, 0);
- break;
- case 2: //0101
- mraa_gpio_write(m_stepI1, 0);
- mraa_gpio_write(m_stepI2, 1);
- mraa_gpio_write(m_stepI3, 0);
- mraa_gpio_write(m_stepI4, 1);
- break;
- case 3: //1001
- mraa_gpio_write(m_stepI1, 1);
- mraa_gpio_write(m_stepI2, 0);
- mraa_gpio_write(m_stepI3, 0);
- mraa_gpio_write(m_stepI4, 1);
- break;
- }
-}
-
-void L298::stepperSteps(unsigned int steps)
-{
- while (steps > 0)
- {
- if (getMillis() >= m_stepDelay)
- {
- // reset the clock
- initClock();
-
- m_currentStep += m_stepDirection;
-
- if (m_stepDirection == 1)
- {
- if (m_currentStep >= m_stepsPerRev)
- m_currentStep = 0;
- }
- else
- {
- if (m_currentStep <= 0)
- m_currentStep = m_stepsPerRev;
- }
-
- steps--;
- stepperStep();
- // cerr << "STEPNUM: " << m_currentStep << endl;
- }
- }
-}
diff --git a/peripheral/libupm/src/l298/l298.h b/peripheral/libupm/src/l298/l298.h
deleted file mode 100644
index 985a07c..0000000
--- a/peripheral/libupm/src/l298/l298.h
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <stdint.h>
-#include <sys/time.h>
-
-#include <mraa/gpio.h>
-#include <mraa/pwm.h>
-
-// in milliseconds
-#define L298_DEFAULT_PWM_PERIOD 4
-
-namespace upm {
- /**
- * @brief L298 Dual H-Bridge Motor Driver library
- * @defgroup l298 libupm-l298
- * @ingroup seeed sparkfun gpio pwm motor
- */
-
- /**
- * @library l298
- * @sensor l298
- * @comname L298 Dual H-Bridge Motor Driver
- * @type motor
- * @man seeed sparkfun
- * @web https://www.sparkfun.com/products/9670
- * @con gpio pwm
- *
- * @brief API for the L298 Dual H-Bridge Motor Driver
- *
- * It was developed using the RobotBase Dual H-Bridge module.
- *
- * This module can support 2 DC motors, or one 2-phase stepper motor.
- * It requires 3 pins per DC motor (or H-bridge), or 4 pins for
- * the stepper motor (uses both H-bridges).
- *
- * @image html l298.jpg
- * <br><em>L298 Dual H-Bridge Motor Driver image provided by SparkFun* under
- * <a href=https://creativecommons.org/licenses/by-nc-sa/3.0/>
- * CC BY-NC-SA-3.0</a>.</em>
- *
- * Example driving a DC motor
- * @snippet l298.cxx Interesting
- * Example driving a stepper motor
- * @snippet l298-stepper.cxx Interesting
- */
- class L298 {
- public:
-
- /**
- * Enum to specify the direction of a motor
- */
- typedef enum {
- DIR_NONE = 0x00,
- DIR_CW = 0x01,
- DIR_CCW = 0x02
- } L298_DIRECTION_T;
-
- /**
- * L298 constructor for DC motor(s) connected.
- *
- * @param pwm Digital pin to use for a DC motor - must be PWM-capable
- * @param dir1 Digital pin to use for motor direction pin 1
- * @param dir2 Digital pin to use for motor direction pin 2
- */
- L298(int pwm, int dir1, int dir2);
-
- /**
- * L298 constructor for a 4-wire stepper motor
- *
- * @param stepsPerRev Number of steps per full revolution
- * @param en Enables the pin
- * @param i1 Digital pin to use for stepper input 1
- * @param i2 Digital pin to use for stepper input 2
- * @param i3 Digital pin to use for stepper input 3
- * @param i4 Digital pin to use for stepper input 4
- */
- L298(int stepsPerRev, int en, int i1, int i2, int i3, int i4);
-
- /**
- * L298 destructor
- */
- ~L298();
-
- /**
- * Returns the number of milliseconds elapsed since initClock()
- * was last called.
- *
- * @return Elapsed milliseconds
- */
- uint32_t getMillis();
-
- /**
- * Resets the clock
- *
- */
- void initClock();
-
- /**
- * Sets the period in milliseconds
- *
- * @param ms Period in milliseconds
- */
- void setPeriodMS(int ms);
-
- /**
- * Enables the PWM output for a motor
- *
- * @param enable Enables the PWM output if true, disables if false
- */
- void enable(bool enable);
-
- /**
- * Sets the speed of a DC or stepper motor. For a DC motor, values
- * can range from 0 (off) to 100 (full speed). For a stepper
- * motor, specify the desired RPM.
- *
- * @param speed Speed to set the motor to
- */
- void setSpeed(int speed);
-
- /**
- * Sets the direction of the motor, clockwise or counterclockwise
- *
- * @param dir Direction to set the motor to
- */
- void setDirection(L298_DIRECTION_T dir);
-
- /**
- * Steps the stepper motor a specified number of steps
- *
- * @param steps Number of steps to move the stepper motor
- */
- void stepperSteps(unsigned int steps);
-
- private:
- // DC motor mode enabled
- bool m_motor;
- // stepper mode enabled
- bool m_stepper;
-
- struct timeval m_startTime;
-
- // DC motor
- mraa_pwm_context m_pwm;
- mraa_gpio_context m_dir1;
- mraa_gpio_context m_dir2;
-
- // stepper (4-wire)
- mraa_gpio_context m_stepEnable;
- mraa_gpio_context m_stepI1;
- mraa_gpio_context m_stepI2;
- mraa_gpio_context m_stepI3;
- mraa_gpio_context m_stepI4;
-
- // steps per revolution
- int m_stepsPerRev;
- int m_currentStep;
- uint32_t m_stepDelay;
-
- /**
- * Steps the motor one tick
- *
- */
- void stepperStep();
-
- // step direction: - 1 = forward, -1 = backward
- int m_stepDirection;
- };
-}
-
-
diff --git a/peripheral/libupm/src/l298/pyupm_l298.i b/peripheral/libupm/src/l298/pyupm_l298.i
deleted file mode 100644
index c8aaa5f..0000000
--- a/peripheral/libupm/src/l298/pyupm_l298.i
+++ /dev/null
@@ -1,11 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_l298
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "l298.h"
-%{
- #include "l298.h"
-%}
diff --git a/peripheral/libupm/src/lcd/CMakeLists.txt b/peripheral/libupm/src/lcd/CMakeLists.txt
deleted file mode 100755
index c21ea8a..0000000
--- a/peripheral/libupm/src/lcd/CMakeLists.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-set (libname "i2clcd")
-set (classname "lcd")
-set (libdescription "upm lcd/oled displays")
-set (module_src lcd.cxx lcm1602.cxx jhd1313m1.cxx ssd1308.cxx eboled.cxx ssd1327.cxx sainsmartks.cxx ssd1306.cxx)
-set (module_h lcd.h lcm1602.h jhd1313m1.h ssd1308.h eboled.h ssd1327.h ssd.h sainsmartks.h ssd1306.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/lcd/eboled.cxx b/peripheral/libupm/src/lcd/eboled.cxx
deleted file mode 100644
index 295591f..0000000
--- a/peripheral/libupm/src/lcd/eboled.cxx
+++ /dev/null
@@ -1,567 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Author: Tyler Gibson <tgibson@microsoft.com>
- * Copyright (c) 2015 Microsoft 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 "eboled.h"
-
-using namespace upm;
-using namespace std;
-
-static uint16_t screenBuffer[BUFFER_SIZE];
-
-EBOLED::EBOLED(int spi, int CD, int reset) :
- m_spi(spi), m_gpioCD(CD), m_gpioRST(reset)
-{
- m_name = "EBOLED";
- m_textColor = COLOR_WHITE;
- m_textWrap = 0;
- m_textSize = 1;
- m_cursorX = 0;
- m_cursorY = 0;
-
- m_gpioCD.dir(mraa::DIR_OUT);
- m_gpioRST.dir(mraa::DIR_OUT);
-
- //1000000 is standard.
- m_spi.frequency(10000000);
-
- // reset the device
- m_gpioRST.write(1);
- usleep(5000);
- m_gpioRST.write(0);
- usleep(10000);
- m_gpioRST.write(1);
-
- command(CMD_DISPLAYOFF);
-
- command(CMD_SETDISPLAYCLOCKDIV);
- command(0x80);
-
- command(CMD_SETMULTIPLEX);
- command(0x2f);
-
- command(CMD_SETDISPLAYOFFSET);
- command(0x0); // no offset
-
- command(CMD_SETSTARTLINE | 0x0); // line #0
-
- command(CMD_CHARGEPUMP); // enable charge pump
- command(0x14);
-
- command(CMD_NORMALDISPLAY);
- command(CMD_DISPLAYALLONRESUME);
-
- command(CMD_SEGREMAP | 0x1); // reverse mapping (SEG0==COL127)
- command(CMD_COMSCANDEC);
-
- command(CMD_SETCOMPINS); // custom COM PIN mapping
- command(0x12);
-
- command(CMD_SETCONTRAST);
- command(0x8f);
-
- command(CMD_SETPRECHARGE);
- command(0xf1);
-
- command(CMD_SETVCOMDESELECT);
- command(0x40);
-
- command(CMD_DISPLAYON);
-
- usleep(4500);
-
- setAddressingMode(HORIZONTAL);
-
- //Set Page Address range, required for horizontal addressing mode.
- command(CMD_SETPAGEADDRESS); // triple-byte cmd
- command(0x00); //Initial page address
- command(0x05); //Final page address
-
- //Set Column Address range, required for horizontal addressing mode.
- command(CMD_SETCOLUMNADDRESS); // triple-byte cmd
- command(0x20); // this display has a horizontal offset of 20 columns
- command(0x5f); // 64 columns wide - 0 based 63 offset
-}
-
-EBOLED::~EBOLED()
-{
- clear();
-}
-
-mraa::Result EBOLED::refresh()
-{
- mraa::Result error = mraa::SUCCESS;;
-
- m_gpioCD.write(1); // data mode
- for(int i=0; i<BUFFER_SIZE; i++)
- {
- error = data(screenBuffer[i]);
- if(error != mraa::SUCCESS)
- return error;
- }
-
- return error;
-}
-
-mraa::Result EBOLED::write (std::string msg)
-{
- int len = msg.length();
- uint8_t temp_cursorX = m_cursorX;
- for (int idx = 0; idx < len; idx++)
- {
- if (msg[idx] == '\n')
- {
- m_cursorY += m_textSize * 9;
- temp_cursorX = m_cursorX;
- }
- else if (msg[idx] == '\r')
- {
- // skip em
- }
- else
- {
- drawChar(temp_cursorX, m_cursorY, msg[idx], m_textColor, m_textSize);
- temp_cursorX += m_textSize * 6;
-
- //textColor used to avoid wrapping if COLOR_BLACK is set.
- if (m_textWrap && (m_textColor > OLED_WIDTH - temp_cursorX - 6))
- {
- m_cursorY += m_textSize * 9;
- temp_cursorX = m_cursorX;
- }
- }
- }
- return mraa::SUCCESS;;
-}
-
-mraa::Result EBOLED::setCursor (int row, int column) {
- m_cursorX = column;
- m_cursorY = row;
- return mraa::SUCCESS;;
-}
-
-void EBOLED::setTextColor (uint8_t textColor) {
- m_textColor = textColor;
-}
-
-void EBOLED::setTextSize (uint8_t size) {
- m_textSize = (size > 0) ? size : 1;
-}
-
-void EBOLED::setTextWrap (uint8_t wrap) {
- m_textWrap = wrap;
-}
-
-void EBOLED::drawChar (uint8_t x, uint8_t y, uint8_t data, uint8_t color, uint8_t size) {
- if( (x >= OLED_WIDTH) || // Clip right
- (y >= OLED_HEIGHT) || // Clip bottom
- ((x + 6 * size - 1) < 0) || // Clip left
- ((y + 8 * size - 1) < 0)) // Clip top
- return;
-
- if (data < 0x20 || data > 0x7F) {
- data = 0x20; // space
- }
-
- for (int8_t i=0; i<6; i++ ) {
- uint8_t line;
- if (i == 6)
- line = 0x0;
- else
- {
- //32 offset to align standard ASCII range to index
- line = BasicFont[data - 32][i+1];
- for (int8_t j = 0; j<8; j++)
- {
- if (line & 0x1)
- {
- if (size == 1) // default size
- drawPixel(x+i, y+j, color);
- else
- drawRectangleFilled(x+(i*size), y+(j*size), size, size, color); // big size
- }
- line >>= 1;
- }
- }
- }
-}
-
-mraa::Result EBOLED::clear()
-{
- mraa::Result error = mraa::SUCCESS;;
-
- m_gpioCD.write(1); // data mode
- for(int i=0; i<BUFFER_SIZE; i++)
- {
- error = data(0x0000);
- if(error != mraa::SUCCESS)
- return error;
- }
-
- return mraa::SUCCESS;;
-}
-
-mraa::Result EBOLED::home()
-{
- return setCursor(0, 0);
-}
-
-void EBOLED::drawPixel(int8_t x, int8_t y, uint8_t color)
-{
- if(x<0 || x>=OLED_WIDTH || y<0 || y>=OLED_HEIGHT)
- return;
-
- /* Screenbuffer is uint16 array, but pages are 8bit high so each buffer
- * index is two columns. This means the index is based on x/2 and
- * OLED_WIDTH/2 = VERT_COLUMNS.
- *
- * Then to set the appropriate bit, we need to shift based on the y
- * offset in relation to the page and then adjust for high/low based
- * on the x position.
- */
-
- switch(color)
- {
- case COLOR_XOR:
- screenBuffer[(x/2) + ((y/8) * VERT_COLUMNS)] ^= (1<<(y%8+(x%2 * 8)));
- return;
- case COLOR_WHITE:
- screenBuffer[(x/2) + ((y/8) * VERT_COLUMNS)] |= (1<<(y%8+(x%2 * 8)));
- return;
- case COLOR_BLACK:
- screenBuffer[(x/2) + ((y/8) * VERT_COLUMNS)] &= ~(1<<(y%8+(x%2 * 8)));
- return;
- }
-}
-
-void EBOLED::drawLine(int8_t x0, int8_t y0, int8_t x1, int8_t y1, uint8_t color)
-{
- int16_t steep = abs(y1 - y0) > abs(x1 - x0);
-
- if (steep) {
- swap(x0, y0);
- swap(x1, y1);
- }
-
- if (x0 > x1) {
- swap(x0, x1);
- swap(y0, y1);
- }
-
- int16_t dx, dy;
- dx = x1 - x0;
- dy = abs (y1 - y0);
-
- int16_t err = dx / 2;
- int16_t ystep;
-
- if (y0 < y1) {
- ystep = 1;
- } else {
- ystep = -1;
- }
-
- for (; x0 <= x1; x0++) {
- if (steep) {
- drawPixel(y0, x0, color);
- } else {
- drawPixel(x0, y0, color);
- }
- err -= dy;
- if (err < 0) {
- y0 += ystep;
- err += dx;
- }
- }
-}
-
-void EBOLED::drawLineHorizontal(int8_t x, int8_t y, uint8_t width, uint8_t color)
-{
- drawLine(x, y, x+width-1, y, color);
-}
-
-void EBOLED::drawLineVertical(int8_t x, int8_t y, uint8_t height, uint8_t color)
-{
- drawLine(x, y, x, y+height-1, color);
-}
-
-void EBOLED::drawRectangle(int8_t x, int8_t y, uint8_t width, uint8_t height, uint8_t color)
-{
- drawLineHorizontal(x, y, width, color);
- drawLineHorizontal(x, y+height-1, color);
-
- uint8_t innerHeight = height - 2;
- if(innerHeight > 0)
- {
- drawLineVertical(x, y+1, innerHeight, color);
- drawLineVertical(x+width-1, y+1, innerHeight, color);
- }
-}
-
-void EBOLED::drawRoundedRectangle(int8_t x, int8_t y, int8_t width, int8_t height, int16_t radius, uint8_t color) {
- // smarter version
- drawLineHorizontal(x+radius , y , width-2*radius, color); // Top
- drawLineHorizontal(x+radius , y+height-1, width-2*radius, color); // Bottom
- drawLineVertical( x , y+radius , height-2*radius, color); // Left
- drawLineVertical( x+width-1 , y+radius , height-2*radius, color); // Right
- // draw four corners
- drawRoundCorners(x+radius , y+radius , radius, 1, color);
- drawRoundCorners(x+width-radius-1, y+radius , radius, 2, color);
- drawRoundCorners(x+width-radius-1, y+height-radius-1, radius, 4, color);
- drawRoundCorners(x+radius , y+height-radius-1, radius, 8, color);
-}
-
-void EBOLED::drawRectangleFilled(int8_t x, int8_t y, uint8_t width, uint8_t height, uint8_t color)
-{
- for (uint8_t i=x; i<x+width; i++) {
- drawLineVertical(i, y, height, color);
- }
-}
-
-void EBOLED::drawTriangle(int8_t x0, int8_t y0, int8_t x1, int8_t y1, int8_t x2, int8_t y2, uint8_t color)
-{
- drawLine(x0, y0, x1, y1, color);
- drawLine(x1, y1, x2, y2, color);
- drawLine(x2, y2, x0, y0, color);
-}
-
-void EBOLED::drawTriangleFilled ( int8_t x0, int8_t y0, int8_t x1, int8_t y1, int8_t x2, int8_t y2, uint8_t color) {
-
- int16_t a, b, y, last;
-
- // Sort coordinates by Y order (y2 >= y1 >= y0)
- if (y0 > y1) {
- swap(y0, y1); swap(x0, x1);
- }
- if (y1 > y2) {
- swap(y2, y1); swap(x2, x1);
- }
- if (y0 > y1) {
- swap(y0, y1); swap(x0, x1);
- }
-
- if(y0 == y2) { // Handle awkward all-on-same-line case as its own thing
- a = b = x0;
- if(x1 < a) a = x1;
- else if(x1 > b) b = x1;
- if(x2 < a) a = x2;
- else if(x2 > b) b = x2;
- drawLineHorizontal(a, y0, b-a+1, color);
- return;
- }
-
- int16_t
- dx01 = x1 - x0,
- dy01 = y1 - y0,
- dx02 = x2 - x0,
- dy02 = y2 - y0,
- dx12 = x2 - x1,
- dy12 = y2 - y1;
- int32_t
- sa = 0,
- sb = 0;
-
- // For upper part of triangle, find scanline crossings for segments
- // 0-1 and 0-2. If y1=y2 (flat-bottomed triangle), the scanline y1
- // is included here (and second loop will be skipped, avoiding a /0
- // error there), otherwise scanline y1 is skipped here and handled
- // in the second loop...which also avoids a /0 error here if y0=y1
- // (flat-topped triangle).
- if(y1 == y2) last = y1; // Include y1 scanline
- else last = y1-1; // Skip it
-
- for(y=y0; y<=last; y++) {
- a = x0 + sa / dy01;
- b = x0 + sb / dy02;
- sa += dx01;
- sb += dx02;
- /* longhand:
- a = x0 + (x1 - x0) * (y - y0) / (y1 - y0);
- b = x0 + (x2 - x0) * (y - y0) / (y2 - y0);
- */
- if(a > b) swap(a,b);
- drawLineHorizontal(a, y, b-a+1, color);
- }
-
- // For lower part of triangle, find scanline crossings for segments
- // 0-2 and 1-2. This loop is skipped if y1=y2.
- sa = dx12 * (y - y1);
- sb = dx02 * (y - y0);
- for(; y<=y2; y++) {
- a = x1 + sa / dy12;
- b = x0 + sb / dy02;
- sa += dx12;
- sb += dx02;
- /* longhand:
- a = x1 + (x2 - x1) * (y - y1) / (y2 - y1);
- b = x0 + (x2 - x0) * (y - y0) / (y2 - y0);
- */
- if(a > b) swap(a,b);
- drawLineHorizontal(a, y, b-a+1, color);
- }
-}
-
-void EBOLED::drawCircle(int16_t x0, int16_t y0, int16_t radius, uint8_t color)
-{
- int16_t f = 1 - radius;
- int16_t ddF_x = 1;
- int16_t ddF_y = -2 * radius;
- int16_t x = 0;
- int16_t y = radius;
-
- drawPixel(x0 , y0+radius, color);
- drawPixel(x0 , y0-radius, color);
- drawPixel(x0+radius, y0 , color);
- drawPixel(x0-radius, y0 , color);
-
- while (x<y)
- {
- if (f >= 0)
- {
- y--;
- ddF_y += 2;
- f += ddF_y;
- }
- x++;
-
- ddF_x += 2;
- f += ddF_x;
-
- drawPixel(x0 + x, y0 + y, color);
- drawPixel(x0 - x, y0 + y, color);
- drawPixel(x0 + x, y0 - y, color);
- drawPixel(x0 - x, y0 - y, color);
- drawPixel(x0 + y, y0 + x, color);
- drawPixel(x0 - y, y0 + x, color);
- drawPixel(x0 + y, y0 - x, color);
- drawPixel(x0 - y, y0 - x, color);
- }
-}
-
-void EBOLED::drawRoundCorners( int8_t x0, int8_t y0, int16_t radius, uint8_t cornername, uint8_t color) {
- int16_t f = 1 - radius;
- int16_t ddF_x = 1;
- int16_t ddF_y = -2 * radius;
- int16_t x = 0;
- int16_t y = radius;
-
- while (x<y) {
- if (f >= 0) {
- y--;
- ddF_y += 2;
- f += ddF_y;
- }
- x++;
- ddF_x += 2;
- f += ddF_x;
- if (cornername & 0x4) {
- drawPixel(x0 + x, y0 + y, color);
- drawPixel(x0 + y, y0 + x, color);
- }
- if (cornername & 0x2) {
- drawPixel(x0 + x, y0 - y, color);
- drawPixel(x0 + y, y0 - x, color);
- }
- if (cornername & 0x8) {
- drawPixel(x0 - y, y0 + x, color);
- drawPixel(x0 - x, y0 + y, color);
- }
- if (cornername & 0x1) {
- drawPixel(x0 - y, y0 - x, color);
- drawPixel(x0 - x, y0 - y, color);
- }
- }
-}
-
-void EBOLED::drawCircleFilled(int8_t x0, int8_t y0, int16_t radius, uint8_t color) {
- drawLineVertical(x0, y0-radius, 2*radius+1, color);
- drawRoundedCornersFilled(x0, y0, radius, 3, 0, color);
-}
-
-void EBOLED::drawRoundedCornersFilled(int8_t x0, int8_t y0, int16_t radius, uint8_t cornername, int16_t delta, uint8_t color) {
-
- int16_t f = 1 - radius;
- int16_t ddF_x = 1;
- int16_t ddF_y = -2 * radius;
- int16_t x = 0;
- int16_t y = radius;
-
- while (x<y) {
- if (f >= 0) {
- y--;
- ddF_y += 2;
- f += ddF_y;
- }
- x++;
- ddF_x += 2;
- f += ddF_x;
-
- if (cornername & 0x1) {
- drawLineVertical(x0+x, y0-y, 2*y+1+delta, color);
- drawLineVertical(x0+y, y0-x, 2*x+1+delta, color);
- }
- if (cornername & 0x2) {
- drawLineVertical(x0-x, y0-y, 2*y+1+delta, color);
- drawLineVertical(x0-y, y0-x, 2*x+1+delta, color);
- }
- }
-}
-
-void EBOLED::fillScreen(uint8_t color)
-{
- drawRectangleFilled(0, 0, OLED_WIDTH-1, OLED_HEIGHT-1, color);
-}
-
-mraa::Result EBOLED::setAddressingMode(displayAddressingMode mode)
-{
- mraa::Result rv;
-
- rv = command(CMD_MEMORYADDRMODE);
- rv = command(mode);
-
- return rv;
-}
-
-mraa::Result EBOLED::command(uint8_t cmd)
-{
- m_gpioCD.write(0); // command mode
- m_spi.writeByte(cmd);
- return mraa::SUCCESS;
-}
-
-mraa::Result EBOLED::data(uint16_t data)
-{
- m_spi.write_word(data);
- return mraa::SUCCESS;
-}
-
-void EBOLED::clearScreenBuffer()
-{
- for(int i=0; i<BUFFER_SIZE;i++)
- screenBuffer[i] = 0x0000;
-}
diff --git a/peripheral/libupm/src/lcd/eboled.h b/peripheral/libupm/src/lcd/eboled.h
deleted file mode 100644
index bd6f3d0..0000000
--- a/peripheral/libupm/src/lcd/eboled.h
+++ /dev/null
@@ -1,378 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Author: Tyler Gibson <tgibson@microsoft.com>
- * Copyright (c) 2015 Microsoft Corporation.
- *
- * Credits to Adafruit.
- * Based on Adafruit ST7735 library, see original license in license.txt file.
- *
- * 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 <string>
-#include <mraa/spi.hpp>
-
-#include <mraa/gpio.hpp>
-
-#include "lcd.h"
-#include "ssd.h"
-
-#define EBOLED_DEFAULT_SPI_BUS 0
-#define EBOLED_DEFAULT_CD 36
-#define EBOLED_DEFAULT_RESET 48
-
-#define swap(a, b) { uint8_t t = a; a = b; b = t; }
-
-namespace upm
-{
- const uint8_t COLOR_WHITE = 0x01;
- const uint8_t COLOR_BLACK = 0x00;
- const uint8_t COLOR_XOR = 0x02;
- const uint8_t OLED_WIDTH = 0x40; // 64 pixels
- const uint8_t VERT_COLUMNS = 0x20; // half width for hi/lo 16bit writes.
- const uint8_t OLED_HEIGHT = 0x30; // 48 pixels
- const int BUFFER_SIZE = 192;
-
- /**
- * @library i2clcd
- * @sensor eboled
- * @comname Sparkfun Edison Block OLED Display
- * @altname ssd1306
- * @type display
- * @man sparkfun
- * @web https://www.sparkfun.com/products/13035
- * @con spi
- *
- * @brief API for EBOLED spi controlled OLED display
- *
- * The EBOLED is an ssd1306 with some modifications to work as an
- * Edison Block. It is a 64x48 pixel OLED display that connects
- * directly to an edison via it's 80-pin connector. Edison Blocks
- * are stackable modules created by Sparkfun.
- *
- * This block has some buttons on it that can be accessed using
- * standard GPIO -- this driver only concerns itself with the
- * display.
- *
- * @image html eboled.jpg
- * <br><em>OLED Sensor image provided by SparkFun* under
- * <a href=https://creativecommons.org/licenses/by-nc-sa/3.0/>
- * CC BY-NC-SA-3.0</a>.</em>
- *
- * @snippet eboled.cxx Interesting
- */
- class EBOLED : public LCD
- {
- // SSD commands
- typedef enum {
- CMD_SETLOWCOLUMN = 0x00,
- CMD_EXTERNALVCC = 0x01,
- CMD_SWITCHCAPVCC = 0x02,
- CMD_SETHIGHCOLUMN = 0x10,
- CMD_MEMORYADDRMODE = 0x20,
- CMD_SETCOLUMNADDRESS = 0x21,
- CMD_SETPAGEADDRESS = 0x22,
- CMD_SETSTARTLINE = 0x40, // 0x40 - 0x7f
- CMD_SETCONTRAST = 0x81,
- CMD_CHARGEPUMP = 0x8d,
- CMD_SEGREMAP = 0xa0,
- CMD_DISPLAYALLONRESUME = 0xa4,
- CMD_DISPLAYALLON = 0xa5,
- CMD_NORMALDISPLAY = 0xa6,
- CMD_INVERTDISPLAY = 0xa7,
- CMD_SETMULTIPLEX = 0xa8,
- CMD_DISPLAYOFF = 0xae,
- CMD_DISPLAYON = 0xaf,
- CMD_SETPAGESTARTADDR = 0xb0, // 0xb0-0xb7
- CMD_COMSCANINC = 0xc0,
- CMD_COMSCANDEC = 0xc8,
- CMD_SETDISPLAYOFFSET = 0xd3,
- CMD_SETDISPLAYCLOCKDIV = 0xd5,
- CMD_SETPRECHARGE = 0xd9,
- CMD_SETCOMPINS = 0xda,
- CMD_SETVCOMDESELECT = 0xdb
- } SSD_CMDS_T;
-
- public:
- /**
- * EBOLED Constructor. Note that you will not have any choice as
- * to the pins used, so they are all set to default values.
- *
- * @param spi spi bus to use
- * @param CD Command/Data select pin
- * @param reset reset pin
- * @param address the slave address the lcd is registered on
- */
- EBOLED(int spi=EBOLED_DEFAULT_SPI_BUS, int CD=EBOLED_DEFAULT_CD,
- int reset=EBOLED_DEFAULT_RESET);
-
- /**
- * EBOLED Destructor
- */
- ~EBOLED();
-
- /**
- * Draw the buffer to screen.
- *
- * @return result of operation
- */
- mraa::Result refresh();
-
- /**
- * Write a string to LCD
- *
- * @param msg the std::string to write to display, note only ascii
- * chars are supported
- * @return result of operation
- */
- mraa::Result write(std::string msg);
-
- /**
- * Set cursor to a coordinate
- *
- * @param y Axis on the vertical scale. This device supports 6 rows.
- * @param x Axis on the horizontal scale This device supports 64 columns
- *
- * @return result of operation
- */
- mraa::Result setCursor (int row, int column);
-
- /**
- * Sets a text color for a message
- *
- * @param textColor Font color: COLOR_WHITE, COLOR_BLACK or COLOR_XOR
- */
- void setTextColor (uint8_t textColor);
-
- /**
- * Sets the size of the font
- *
- * @param size Font size
- */
- void setTextSize (uint8_t size);
-
- /**
- * Wraps a printed message
- *
- * @param wrap True (1) or false (0)
- */
- void setTextWrap (uint8_t wrap);
-
- /**
- * Write a single character to the screen.
- *
- * @param x Axis on the horizontal scale
- * @param y Axis on the vertical scale
- * @param data Character to write
- * @param color Character color
- * @param bg Character background color
- * @param size Size of the font
- */
- void drawChar (uint8_t x, uint8_t y, uint8_t data, uint8_t color, uint8_t size);
-
- /**
- * Clear display
- *
- * @return result of operation
- */
- mraa::Result clear();
-
- void clearScreenBuffer();
-
- /**
- * Return to coordinate 0,0
- *
- * @return result of operation
- */
- mraa::Result home();
-
- /**
- * Write a single pixel to the screen buffer.
- * Can do an specific color write or toggle (xor) a pixel.
- *
- * @param x the x position of the pixel
- * @param y the y position of the pixel
- * @param color pixel is COLOR_WHITE, COLOR_BLACK or COLOR_XOR
- */
- void drawPixel (int8_t x, int8_t y, uint8_t color=COLOR_WHITE);
-
- /**
- * Draw a line to the screen buffer.
- *
- * @param x0 the x position of the beginning of the line
- * @param y0 the y position of the beginning of the line
- * @param x1 the x position of the end of the line
- * @param y1 the y position of the end of the line
- * @param color line is COLOR_WHITE, COLOR_BLACK or COLOR_XOR
- */
- void drawLine (int8_t x0, int8_t y0, int8_t x1, int8_t y1, uint8_t color = COLOR_WHITE);
-
- /**
- * Draw a horizontal line to the screen buffer.
- *
- * @param x the x position of the beginning of the line
- * @param y the y position of the beginning of the line
- * @param width is the horizontal length of the line
- * @param color line is COLOR_WHITE, COLOR_BLACK or COLOR_XOR
- */
- void drawLineHorizontal (int8_t x, int8_t y, uint8_t width, uint8_t color = COLOR_WHITE);
-
- /**
- * Draw a vertical line to the screen buffer.
- *
- * @param x the x position of the beginning of the line
- * @param y the y position of the beginning of the line
- * @param width is the vertical length of the line
- * @param color line is COLOR_WHITE, COLOR_BLACK or COLOR_XOR
- */
- void drawLineVertical (int8_t x, int8_t y, uint8_t height, uint8_t color = COLOR_WHITE);
-
- /**
- * Draw a rectangle to the screen buffer.
- *
- * @param x the left edge
- * @param y the top edge
- * @param width sets the right edge
- * @param height bottom edge
- * @param color outline is COLOR_WHITE, COLOR_BLACK or COLOR_XOR
- */
- void drawRectangle (int8_t x, int8_t y, uint8_t width, uint8_t height, uint8_t color = COLOR_WHITE);
-
- /**
- * Draw a rectangle with rounded corners to the screen buffer.
- *
- * @param x the left edge
- * @param y the top edge
- * @param width sets the right edge
- * @param height bottom edge
- * @param radius of the rounded corners
- * @param color outline is COLOR_WHITE, COLOR_BLACK or COLOR_XOR
- */
- void drawRoundedRectangle(int8_t x, int8_t y, int8_t width, int8_t height, int16_t radius, uint8_t color);
-
- /**
- * Draw a filled rectangle to the screen buffer.
- *
- * @param x the left edge
- * @param y the top edge
- * @param width sets the right edge
- * @param height bottom edge
- * @param color fill color is COLOR_WHITE, COLOR_BLACK or COLOR_XOR
- */
- void drawRectangleFilled (int8_t x, int8_t y, uint8_t width, uint8_t height, uint8_t color = COLOR_WHITE);
-
- /**
- * Draw a triangle to the screen buffer.
- *
- * @param x0 the x coordinate of the first corner
- * @param y0 the y coordinate of the first corner
- * @param x1 the x coordinate of the second corner
- * @param y1 the y coordinate of the second corner
- * @param x2 the x coordinate of the third corner
- * @param y2 the y coordinate of the third corner
- * @param color outline is COLOR_WHITE, COLOR_BLACK or COLOR_XOR
- */
- void drawTriangle (int8_t x0, int8_t y0, int8_t x1, int8_t y1, int8_t x2, int8_t y2, uint8_t color = COLOR_WHITE);
-
- /**
- * Draw a filled triangle to the screen buffer.
- *
- * @param x0 the x coordinate of the first corner
- * @param y0 the y coordinate of the first corner
- * @param x1 the x coordinate of the second corner
- * @param y1 the y coordinate of the second corner
- * @param x2 the x coordinate of the third corner
- * @param y2 the y coordinate of the third corner
- * @param color fill color is COLOR_WHITE, COLOR_BLACK or COLOR_XOR
- */
- void drawTriangleFilled ( int8_t x0, int8_t y0, int8_t x1, int8_t y1, int8_t x2, int8_t y2, uint8_t color);
-
- /**
- * Draw a circle to the screen buffer.
- *
- * @param x0 the x coordinate of the circle's center
- * @param y0 the y coordinate of the circle's center
- * @param radius the radius of the circle
- * @param color outline is COLOR_WHITE, COLOR_BLACK or COLOR_XOR
- */
- void drawCircle (int16_t x0, int16_t y0, int16_t radius, uint8_t color = COLOR_WHITE);
-
- /**
- * Draw a quarter circle arc to the screen buffer.
- *
- * @param x0 the x coordinate of the arc's center
- * @param y0 the y coordinate of the arc's center
- * @param radius the radius of the arc
- * @param cornername denotes which of the 4 quarters to draw - 1,2,4,8
- * @param color outline is COLOR_WHITE, COLOR_BLACK or COLOR_XOR
- */
- void drawRoundCorners( int8_t x0, int8_t y0, int16_t radius, uint8_t cornername, uint8_t color);
-
- /**
- * Draw a filled circle to the screen buffer.
- *
- * @param x0 the x coordinate of the circle's center
- * @param y0 the y coordinate of the circle's center
- * @param radius the radius of the circle
- * @param color outline is COLOR_WHITE, COLOR_BLACK or COLOR_XOR
- */
- void drawCircleFilled(int8_t x0, int8_t y0, int16_t radius, uint8_t color);
-
- /**
- * Draw a quarter pie to the screen buffer.
- *
- * @param x0 the x coordinate of the arc's center
- * @param y0 the y coordinate of the arc's center
- * @param radius the radius of the arc
- * @param cornername denotes which of the 4 quarters to draw - 1,2,4,8
- * @param color fill color is COLOR_WHITE, COLOR_BLACK or COLOR_XOR
- */
- void drawRoundedCornersFilled(int8_t x0, int8_t y0, int16_t radius, uint8_t cornername, int16_t delta, uint8_t color);
-
- /**
- * Fill the screen buffer with specified color.
- *
- * @param color fill color is COLOR_WHITE, COLOR_BLACK or COLOR_XOR
- */
- void fillScreen (uint8_t color=COLOR_WHITE);
-
-
- protected:
- mraa::Result command(uint8_t cmd);
- mraa::Result data(uint16_t data);
- mraa::Result writeChar(uint8_t value);
- mraa::Result setAddressingMode(displayAddressingMode mode);
-
- private:
- mraa::Gpio m_gpioCD; // command(0)/data(1)
- mraa::Gpio m_gpioRST; // reset pin
-
- mraa::Spi m_spi;
-
- uint8_t m_cursorX;
- uint8_t m_cursorY;
- uint8_t m_textSize;
- uint8_t m_textColor;
- uint8_t m_textWrap;
- };
-}
diff --git a/peripheral/libupm/src/lcd/hd44780_bits.h b/peripheral/libupm/src/lcd/hd44780_bits.h
deleted file mode 100644
index e3f60c4..0000000
--- a/peripheral/libupm/src/lcd/hd44780_bits.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-// This file contains bit definitions for the HD44780 and compatible
-// LCD controllers. They are used by most drivers in this (LCD)
-// library, though the SSD controllers only seem to make use of the
-// LCD_DATA and LCD_CMD values.
-//
-// Those values (DATA, CMD) are specific to the implementation of the
-// i2C expander in use, so may not be appropriate for inclusion into
-// this file. But for now, we will leave them here.
-
-#include <stdint.h>
-
-namespace upm
-{
-// commands
- const uint8_t LCD_CLEARDISPLAY = 0x01;
- const uint8_t LCD_RETURNHOME = 0x02;
- const uint8_t LCD_ENTRYMODESET = 0x04;
- const uint8_t LCD_DISPLAYCONTROL = 0x08;
- const uint8_t LCD_CURSORSHIFT = 0x10;
- const uint8_t LCD_FUNCTIONSET = 0x20;
-
- const uint8_t LCD_BACKLIGHT = 0x08;
- const uint8_t LCD_NOBACKLIGHT = 0x00;
-
- // flags for display entry mode
- const uint8_t LCD_ENTRYRIGHT = 0x00;
- const uint8_t LCD_ENTRYLEFT = 0x02;
- const uint8_t LCD_ENTRYSHIFTINCREMENT = 0x01;
- const uint8_t LCD_ENTRYSHIFTDECREMENT = 0x00;
-
- // flags for display on/off control
- const uint8_t LCD_DISPLAYON = 0x04;
- const uint8_t LCD_DISPLAYOFF = 0x00;
- const uint8_t LCD_CURSORON = 0x02;
- const uint8_t LCD_CURSOROFF = 0x00;
- const uint8_t LCD_BLINKON = 0x01;
- const uint8_t LCD_BLINKOFF = 0x00;
-
- // flags for display/cursor shift
- const uint8_t LCD_DISPLAYMOVE = 0x08;
- const uint8_t LCD_MOVERIGHT = 0x04;
- const uint8_t LCD_MOVELEFT = 0x00;
-
- // flags for function set
- const uint8_t LCD_8BITMODE = 0x10;
- const uint8_t LCD_4BITMODE = 0x00;
- const uint8_t LCD_2LINE = 0x08;
- const uint8_t LCD_1LINE = 0x00;
- const uint8_t LCD_5x10DOTS = 0x04;
- const uint8_t LCD_5x8DOTS = 0x00;
-
- // flags for CGRAM
- const uint8_t LCD_SETCGRAMADDR = 0x40;
-
- // may be implementation specific
- const uint8_t LCD_EN = 0x04; // Enable bit
- const uint8_t LCD_RW = 0x02; // Read/Write bit
- const uint8_t LCD_RS = 0x01; // Register select bit
- const uint8_t LCD_DATA = 0x40;
- const uint8_t LCD_CMD = 0x80;
-}
diff --git a/peripheral/libupm/src/lcd/javaupm_i2clcd.i b/peripheral/libupm/src/lcd/javaupm_i2clcd.i
deleted file mode 100644
index 4705025..0000000
--- a/peripheral/libupm/src/lcd/javaupm_i2clcd.i
+++ /dev/null
@@ -1,56 +0,0 @@
-%module javaupm_i2clcd
-%include "../upm.i"
-%include "stdint.i"
-%include "typemaps.i"
-%include "arrays_java.i";
-
-%apply signed char[] {uint8_t []};
-%ignore BasicFont;
-
-%typemap(jni) (uint8_t *data, int bytes) "jbyteArray";
-%typemap(jtype) (uint8_t *data, int bytes) "byte[]";
-%typemap(jstype) (uint8_t *data, int bytes) "byte[]";
-
-%typemap(javain) (uint8_t *data, int bytes) "$javainput";
-
-%typemap(in) (uint8_t *data, int bytes) {
- $1 = (uint8_t *) JCALL2(GetByteArrayElements, jenv, $input, NULL);
- $2 = JCALL1(GetArrayLength, jenv, $input);
-}
-
-%typemap(freearg) (uint8_t *data, int bytes) {
- JCALL3(ReleaseByteArrayElements, jenv, $input, (jbyte *)$1, 0);
-}
-
-%{
- #include "lcd.h"
- #include "ssd.h"
- #include "ssd1327.h"
- #include "ssd1308.h"
- #include "ssd1306.h"
- #include "eboled.h"
- #include "lcm1602.h"
- #include "jhd1313m1.h"
- #include "sainsmartks.h"
-%}
-
-%include "lcd.h"
-%include "ssd.h"
-%include "ssd1327.h"
-%include "ssd1308.h"
-%include "ssd1306.h"
-%include "eboled.h"
-%include "lcm1602.h"
-%include "jhd1313m1.h"
-%include "sainsmartks.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_i2clcd");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/lcd/jhd1313m1.cxx b/peripheral/libupm/src/lcd/jhd1313m1.cxx
deleted file mode 100644
index d1afc92..0000000
--- a/peripheral/libupm/src/lcd/jhd1313m1.cxx
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Contributions: Jon Trulson <jtrulson@ics.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <stdexcept>
-#include <unistd.h>
-
-#include "lcd_private.h"
-#include "hd44780_bits.h"
-#include "jhd1313m1.h"
-
-using namespace upm;
-
-Jhd1313m1::Jhd1313m1(int bus, int lcdAddress, int rgbAddress)
- : m_i2c_lcd_rgb(bus), Lcm1602(bus, lcdAddress, false)
-{
- m_rgb_address = rgbAddress;
- m_name = "Jhd1313m1";
-
- mraa::Result ret = m_i2c_lcd_rgb.address(m_rgb_address);
- if (ret != mraa::SUCCESS) {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": I2c.address() failed");
- }
-
- usleep(50000);
- ret = command(LCD_FUNCTIONSET | LCD_2LINE);
-
- if (!ret) {
- ret = command(LCD_FUNCTIONSET | LCD_2LINE);
- UPM_CHECK_MRAA_SUCCESS(ret, "Unable to initialise the LCD controller");
- }
-
- usleep(100);
- ret = displayOn();
-
- UPM_CHECK_MRAA_SUCCESS(ret, "Unable to initialise the LCD controller");
-
- usleep(100);
- ret = clear();
- UPM_CHECK_MRAA_SUCCESS(ret, "Unable to initialise the LCD controller");
-
- usleep(2000);
- ret = command(LCD_ENTRYMODESET | LCD_ENTRYLEFT | LCD_ENTRYSHIFTDECREMENT);
- UPM_CHECK_MRAA_SUCCESS(ret, "Unable to initialise the LCD controller");
-
- ret = m_i2c_lcd_rgb.writeReg(0, 0);
- UPM_CHECK_MRAA_SUCCESS(ret, "Unable to initialise the RGB controller");
- ret = m_i2c_lcd_rgb.writeReg(1, 0);
- UPM_CHECK_MRAA_SUCCESS(ret, "Unable to initialise the RGB controller");
- ret = m_i2c_lcd_rgb.writeReg(0x08, 0xAA);
- UPM_CHECK_MRAA_SUCCESS(ret, "Unable to initialise the RGB controller");
-
- ret = m_i2c_lcd_rgb.writeReg(0x04, 0xFF);
- UPM_CHECK_MRAA_SUCCESS(ret, "Unable to initialise the RGB controller");
- ret = m_i2c_lcd_rgb.writeReg(0x03, 0xFF);
- UPM_CHECK_MRAA_SUCCESS(ret, "Unable to initialise the RGB controller");
- ret = m_i2c_lcd_rgb.writeReg(0x02, 0xFF);
- UPM_CHECK_MRAA_SUCCESS(ret, "Unable to initialise the RGB controller");
-}
-
-Jhd1313m1::~Jhd1313m1()
-{
- clear();
- setColor(0x00, 0x00, 0x00);
-}
-
-mraa::Result
-Jhd1313m1::setColor(uint8_t r, uint8_t g, uint8_t b)
-{
- mraa::Result ret;
-
- ret = m_i2c_lcd_rgb.writeReg(0, 0);
- UPM_GOTO_ON_MRAA_FAIL(ret, beach);
- ret = m_i2c_lcd_rgb.writeReg(1, 0);
- UPM_GOTO_ON_MRAA_FAIL(ret, beach);
- ret = m_i2c_lcd_rgb.writeReg(0x08, 0xAA);
- UPM_GOTO_ON_MRAA_FAIL(ret, beach);
-
- ret = m_i2c_lcd_rgb.writeReg(0x04, r);
- UPM_GOTO_ON_MRAA_FAIL(ret, beach);
- ret = m_i2c_lcd_rgb.writeReg(0x03, g);
- UPM_GOTO_ON_MRAA_FAIL(ret, beach);
- ret = m_i2c_lcd_rgb.writeReg(0x02, b);
-
-beach:
- return ret;
-}
-
-mraa::Result
-Jhd1313m1::scroll(bool direction)
-{
- if (direction) {
- return scrollDisplayLeft();
- } else {
- return scrollDisplayRight();
- }
-}
-
-mraa::Result Jhd1313m1::command(uint8_t cmd)
-{
- return m_i2c_lcd_control->writeReg(LCD_CMD, cmd);
-
-}
-mraa::Result Jhd1313m1::data(uint8_t cmd)
-{
- return m_i2c_lcd_control->writeReg(LCD_DATA, cmd);
-}
diff --git a/peripheral/libupm/src/lcd/jhd1313m1.h b/peripheral/libupm/src/lcd/jhd1313m1.h
deleted file mode 100644
index e13b646..0000000
--- a/peripheral/libupm/src/lcd/jhd1313m1.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Contributions: Jon Trulson <jtrulson@ics.com>
- *
- * 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 <string>
-#include "lcm1602.h"
-
-namespace upm
-{
-/**
- * @library i2clcd
- * @sensor jhd1313m1
- * @comname JHD1313M1 Display
- * @altname Grove RGB LCD
- * @type display
- * @man seeed adafruit sparkfun
- * @web http://www.seeedstudio.com/depot/Grove-LCD-RGB-Backlight-p-1643.html?cPath=34_36
- * @con i2c
- * @kit gsk
- *
- * @brief API for the JHD1313M1 I2C controller for HD44780-based displays with
- * an RGB backlight, such as a Grove RGB I2C LCD display
- *
- * JHD1313M1 has two I2C addreses: one belongs to a controller, very similar
- * to the upm::Lcm1602 LCD driver, that controls the HD44780-based display, and the
- * other controls only the backlight. This module was tested with the Seeed
- * Grove LCD RGB Backlight v2.0 display that requires 5V to operate.
- *
- * @image html grovergblcd.jpg
- * @snippet jhd1313m1-lcd.cxx Interesting
- */
-class Jhd1313m1 : public Lcm1602
-{
- public:
- /**
- * Jhd1313m1 constructor
- *
- * @param bus I2C bus to use
- * @param address Slave address the LCD is registered on
- * @param address Slave address the RGB backlight is registered on
- */
- Jhd1313m1(int bus, int lcdAddress = 0x3E, int rgbAddress = 0x62);
- /**
- * Jhd1313m1 destructor
- */
- ~Jhd1313m1();
- /**
- * Makes the LCD scroll text
- *
- * @param direction True if scrolling to the right
- * @return Result of the operation
- */
- mraa::Result scroll(bool direction);
- /**
- * Sets the color of the backlight
- *
- * @param r 0-255 value for red
- * @param g 0-255 value for green
- * @param b 0-255 value for blue
- * @return Result of the operation
- */
- mraa::Result setColor(uint8_t r, uint8_t g, uint8_t b);
-
- protected:
- virtual mraa::Result command(uint8_t cmd);
- virtual mraa::Result data(uint8_t data);
-
- private:
- int m_rgb_address;
- mraa::I2c m_i2c_lcd_rgb;
-};
-}
diff --git a/peripheral/libupm/src/lcd/jsupm_i2clcd.i b/peripheral/libupm/src/lcd/jsupm_i2clcd.i
deleted file mode 100755
index fe106b7..0000000
--- a/peripheral/libupm/src/lcd/jsupm_i2clcd.i
+++ /dev/null
@@ -1,44 +0,0 @@
-%module jsupm_i2clcd
-%include "../upm.i"
-%include "../carrays_uint8_t.i"
-
-%include "ssd.h"
-%include "lcd.h"
-%{
- #include "lcd.h"
-%}
-
-%include "lcm1602.h"
-%{
- #include "lcm1602.h"
-%}
-
-%include "jhd1313m1.h"
-%{
- #include "jhd1313m1.h"
-%}
-
-%include "ssd1327.h"
-%{
- #include "ssd1327.h"
-%}
-
-%include "ssd1308.h"
-%{
- #include "ssd1308.h"
-%}
-
-%include "eboled.h"
-%{
- #include "eboled.h"
-%}
-
-%include "sainsmartks.h"
-%{
- #include "sainsmartks.h"
-%}
-
-%include "ssd1306.h"
-%{
- #include "ssd1306.h"
-%}
diff --git a/peripheral/libupm/src/lcd/lcd.cxx b/peripheral/libupm/src/lcd/lcd.cxx
deleted file mode 100644
index af3d082..0000000
--- a/peripheral/libupm/src/lcd/lcd.cxx
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <unistd.h>
-
-#include "lcd.h"
-
-using namespace upm;
-
-LCD::LCD()
-{
- m_name = "LCD";
-}
-
-LCD::~LCD()
-{
-}
-
-mraa::Result
-LCD::write(int row, int column, std::string msg)
-{
- setCursor(row, column);
- return write(msg);
-}
-
-std::string
-LCD::name()
-{
- return m_name;
-}
diff --git a/peripheral/libupm/src/lcd/lcd.h b/peripheral/libupm/src/lcd/lcd.h
deleted file mode 100644
index a4f48e8..0000000
--- a/peripheral/libupm/src/lcd/lcd.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include <mraa.h>
-#include <mraa/types.hpp>
-
-namespace upm
-{
-/**
- * @brief I2C LCD Display library
- * @defgroup i2clcd libupm-i2clcd
- * @ingroup dfrobot sainsmart seeed sparkfun adafruit i2c gpio display gsk
- */
-class LCD
-{
- public:
- LCD();
- virtual ~LCD();
- mraa::Result write(int x, int y, std::string msg);
-
- virtual mraa::Result write(std::string msg) = 0;
- virtual mraa::Result setCursor(int row, int column) = 0;
- virtual mraa::Result clear() = 0;
- virtual mraa::Result home() = 0;
-
- std::string name();
-
- protected:
- std::string m_name;
-};
-}
diff --git a/peripheral/libupm/src/lcd/lcd_private.h b/peripheral/libupm/src/lcd/lcd_private.h
deleted file mode 100644
index b09ae5b..0000000
--- a/peripheral/libupm/src/lcd/lcd_private.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Author: Wouter van Verre <wouter.van.verre@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
-
-#define UPM_CHECK_MRAA_SUCCESS(ret, msg) \
- if ((ret) != mraa::SUCCESS) { \
- throw std::runtime_error(std::string(__PRETTY_FUNCTION__) + ": " + msg); \
- }
-
-#define UPM_GOTO_ON_MRAA_FAIL(ret, target) \
- if ((ret) != mraa::SUCCESS) { \
- goto target; \
- }
diff --git a/peripheral/libupm/src/lcd/lcm1602.cxx b/peripheral/libupm/src/lcd/lcm1602.cxx
deleted file mode 100644
index 38f0c87..0000000
--- a/peripheral/libupm/src/lcd/lcm1602.cxx
+++ /dev/null
@@ -1,462 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Author: Daniel Mosquera
- * Copyright (c) 2013 Daniel Mosquera
- *
- * Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Contributions: Jon Trulson <jtrulson@ics.com>
- * Sergey Kiselev <sergey.kiselev@intel.com>
- *
- * 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 <string>
-#include <stdexcept>
-#include <unistd.h>
-
-#include "hd44780_bits.h"
-#include "lcm1602.h"
-
-using namespace upm;
-
-Lcm1602::Lcm1602(int bus_in, int addr_in, bool isExpander,
- uint8_t numColumns, uint8_t numRows) :
- m_i2c_lcd_control(new mraa::I2c(bus_in)),
- m_gpioRS(0), m_gpioEnable(0), m_gpioD0(0),
- m_gpioD1(0), m_gpioD2(0), m_gpioD3(0),
- m_numColumns(numColumns), m_numRows(numRows)
-{
- mraa::Result error = mraa::SUCCESS;
- m_name = "Lcm1602 (I2C)";
- m_isI2C = true;
-
- m_lcd_control_address = addr_in;
-
- error = m_i2c_lcd_control->address(m_lcd_control_address);
- if (error != mraa::SUCCESS) {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": I2c.address() failed");
- return;
- }
-
- // default display control
- m_displayControl = LCD_DISPLAYON | LCD_CURSOROFF | LCD_BLINKOFF;
-
- // if we are not dealing with an expander (say via a derived class
- // like Jhd1313m1), then we do not want to execute the rest of the
- // code below. Rather, the derived class's constructor should
- // follow up with any setup required -- we will only initialize
- // the I2C context and bail.
-
- if (!isExpander)
- return;
-
- usleep(50000);
- expandWrite(LCD_BACKLIGHT);
- usleep(100000);
-
- write4bits(0x03 << 4);
- usleep(4500);
- write4bits(0x30);
- usleep(4500);
- write4bits(0x30);
- usleep(150);
-
- // Put into 4 bit mode
- write4bits(0x20);
-
- m_displayControl = LCD_DISPLAYON | LCD_CURSOROFF | LCD_BLINKOFF;
- // Set numeber of lines
- command(LCD_FUNCTIONSET | 0x0f);
- command(LCD_DISPLAYCONTROL | m_displayControl);
- clear();
-
- // Set entry mode.
- m_entryDisplayMode = LCD_ENTRYLEFT | LCD_ENTRYSHIFTDECREMENT;
- command(LCD_ENTRYMODESET | m_entryDisplayMode);
-
- home();
-}
-
-Lcm1602::Lcm1602(uint8_t rs, uint8_t enable, uint8_t d0,
- uint8_t d1, uint8_t d2, uint8_t d3,
- uint8_t numColumns, uint8_t numRows) :
- m_i2c_lcd_control(0),
- m_gpioRS(new mraa::Gpio(rs)), m_gpioEnable(new mraa::Gpio(enable)),
- m_gpioD0(new mraa::Gpio(d0)), m_gpioD1(new mraa::Gpio(d1)),
- m_gpioD2(new mraa::Gpio(d2)), m_gpioD3(new mraa::Gpio(d3)),
- m_numColumns(numColumns), m_numRows(numRows)
-{
- mraa::Result error = mraa::SUCCESS;
- m_name = "Lcm1602 (4-bit GPIO)";
- m_isI2C = false;
-
- // setup our gpios
-
- m_gpioRS->dir(mraa::DIR_OUT);
- m_gpioEnable->dir(mraa::DIR_OUT);
-
- m_gpioD0->dir(mraa::DIR_OUT);
- m_gpioD1->dir(mraa::DIR_OUT);
- m_gpioD2->dir(mraa::DIR_OUT);
- m_gpioD3->dir(mraa::DIR_OUT);
-
-
- // set RS and Enable low to begin issuing commands
- m_gpioRS->write(0);
- m_gpioEnable->write(0);
-
- // wait to stabilize
- usleep(100000);
-
- // set 4bit mode
-
- // These steps are adapted from the HD44780 datasheet, figure 24
-
- // try 1
- write4bits(0x03);
- usleep(4500);
-
- // try 2
- write4bits(0x03);
- usleep(4500);
-
- // try 3
- write4bits(0x03);
- usleep(150);
-
- // Finally, put into 4 bit mode
- write4bits(0x02);
-
- // Set number of lines
- command(LCD_FUNCTIONSET | LCD_2LINE | LCD_4BITMODE | LCD_5x8DOTS);
- m_displayControl = LCD_DISPLAYON | LCD_CURSOROFF | LCD_BLINKOFF;
- command(LCD_DISPLAYCONTROL | m_displayControl);
- usleep(2000);
- clear();
-
- // Set entry mode.
- m_entryDisplayMode = LCD_ENTRYLEFT | LCD_ENTRYSHIFTDECREMENT;
- command(LCD_ENTRYMODESET | m_entryDisplayMode);
-
- home();
-}
-
-Lcm1602::~Lcm1602()
-{
- // clean up after ourselves
- if (m_isI2C)
- {
- delete m_i2c_lcd_control;
- }
- else
- {
- delete m_gpioRS;
- delete m_gpioEnable;
-
- delete m_gpioD0;
- delete m_gpioD1;
- delete m_gpioD2;
- delete m_gpioD3;
- }
-}
-
-/*
- * **************
- * virtual area
- * **************
- */
-mraa::Result
-Lcm1602::write(std::string msg)
-{
- mraa::Result error = mraa::SUCCESS;
- for (std::string::size_type i = 0; i < msg.size(); ++i) {
- error = data(msg[i]);
- }
- return error;
-}
-
-mraa::Result
-Lcm1602::setCursor(int row, int column)
-{
- mraa::Result error = mraa::SUCCESS;
- column = column % m_numColumns;
- uint8_t offset = column;
-
- switch (m_numRows)
- {
- case 1:
- // Single row displays with more than 8 columns usually have their
- // DDRAM split in two halves. The first half starts at address 00.
- // The second half starts at address 40. E.g. 16x2 DDRAM mapping:
- // 00 01 02 03 04 05 06 07 40 41 42 43 44 45 46 47
- if (m_numColumns > 8)
- {
- offset = (column % (m_numColumns / 2)) +
- (column / (m_numColumns / 2)) * 0x40;
- }
- break;
- case 2:
- // this should work for any display with two rows
- // DDRAM mapping:
- // 00 .. 27
- // 40 .. 67
- offset += row * 0x40;
- break;
- case 4:
- if (m_numColumns == 16)
- {
- // 16x4 display
- // DDRAM mapping:
- // 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- // 40 41 42 43 43 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- // 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- // 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
- int row_addr[] = { 0x00, 0x40, 0x10, 0x50 };
- offset += row_addr[row];
- }
- else
- {
- // 20x4 display
- // DDRAM mapping:
- // 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13
- // 40 41 42 43 43 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53
- // 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27
- // 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67
- int row_addr[] = { 0x00, 0x40, 0x14, 0x54 };
- offset += row_addr[row];
- }
- break;
- }
-
- return command(LCD_CMD | offset);
-}
-
-mraa::Result
-Lcm1602::clear()
-{
- mraa::Result ret;
- ret = command(LCD_CLEARDISPLAY);
- usleep(2000); // this command takes awhile
- return ret;
-}
-
-mraa::Result
-Lcm1602::home()
-{
- mraa::Result ret;
- ret = command(LCD_RETURNHOME);
- usleep(2000); // this command takes awhile
- return ret;
-}
-
-mraa::Result
-Lcm1602::createChar(uint8_t charSlot, uint8_t charData[])
-{
- mraa::Result error = mraa::SUCCESS;
- charSlot &= 0x07; // only have 8 positions we can set
- error = command(LCD_SETCGRAMADDR | (charSlot << 3));
- if (error == mraa::SUCCESS) {
- for (int i = 0; i < 8; i++) {
- error = data(charData[i]);
- }
- }
-
- return error;
-}
-
-mraa::Result Lcm1602::displayOn()
-{
- m_displayControl |= LCD_DISPLAYON;
- return command(LCD_DISPLAYCONTROL | m_displayControl);
-}
-
-mraa::Result Lcm1602::displayOff()
-{
- m_displayControl &= ~LCD_DISPLAYON;
- return command(LCD_DISPLAYCONTROL | m_displayControl);
-}
-
-mraa::Result Lcm1602::cursorOn()
-{
- m_displayControl |= LCD_CURSORON;
- return command(LCD_DISPLAYCONTROL | m_displayControl);
-}
-
-mraa::Result Lcm1602::cursorOff()
-{
- m_displayControl &= ~LCD_CURSORON;
- return command(LCD_DISPLAYCONTROL | m_displayControl);
-}
-
-mraa::Result Lcm1602::cursorBlinkOn()
-{
- m_displayControl |= LCD_BLINKON;
- return command(LCD_DISPLAYCONTROL | m_displayControl);
-}
-
-mraa::Result Lcm1602::cursorBlinkOff()
-{
- m_displayControl &= ~LCD_BLINKON;
- return command(LCD_DISPLAYCONTROL | m_displayControl);
-}
-
-mraa::Result Lcm1602::scrollDisplayLeft()
-{
- return command(LCD_CURSORSHIFT | LCD_DISPLAYMOVE | LCD_MOVELEFT);
-}
-
-mraa::Result Lcm1602::scrollDisplayRight()
-{
- return command(LCD_CURSORSHIFT | LCD_DISPLAYMOVE | LCD_MOVERIGHT);
-}
-
-mraa::Result Lcm1602::entryLeftToRight()
-{
- m_entryDisplayMode |= LCD_ENTRYLEFT;
- return command(LCD_ENTRYMODESET | m_entryDisplayMode);
-}
-
-mraa::Result Lcm1602::entryRightToLeft()
-{
- m_entryDisplayMode &= ~LCD_ENTRYLEFT;
- return command(LCD_ENTRYMODESET | m_entryDisplayMode);
-}
-
-mraa::Result Lcm1602::autoscrollOn()
-{
- m_entryDisplayMode |= LCD_ENTRYSHIFTINCREMENT;
- return command(LCD_ENTRYMODESET | m_entryDisplayMode);
-}
-
-mraa::Result Lcm1602::autoscrollOff()
-{
- m_entryDisplayMode &= ~LCD_ENTRYSHIFTINCREMENT;
- return command(LCD_ENTRYMODESET | m_entryDisplayMode);
-}
-
-mraa::Result Lcm1602::command(uint8_t cmd)
-{
- return send(cmd, 0);
-}
-
-mraa::Result Lcm1602::data(uint8_t cmd)
-{
- return send(cmd, LCD_RS); // 1
-}
-
-
-/*
- * **************
- * private area
- * **************
- */
-mraa::Result
-Lcm1602::send(uint8_t value, int mode)
-{
- mraa::Result ret = mraa::SUCCESS;
- uint8_t h;
- uint8_t l;
-
- if (m_isI2C)
- {
- h = value & 0xf0;
- l = (value << 4) & 0xf0;
- ret = write4bits(h | mode);
- ret = write4bits(l | mode);
- return ret;
- }
-
- // else, gpio (4 bit)
-
- // register select
- m_gpioRS->write(mode);
-
- h = value >> 4;
- l = value & 0x0f;
-
- ret = write4bits(h);
- ret = write4bits(l);
- return ret;
-}
-
-mraa::Result
-Lcm1602::write4bits(uint8_t value)
-{
- mraa::Result ret = mraa::SUCCESS;
-
- if (m_isI2C)
- {
- ret = expandWrite(value);
- ret = pulseEnable(value);
- return ret;
- }
-
- // else gpio
- ret = m_gpioD0->write( ((value >> 0) & 0x01) );
- ret = m_gpioD1->write( ((value >> 1) & 0x01) );
- ret = m_gpioD2->write( ((value >> 2) & 0x01) );
- ret = m_gpioD3->write( ((value >> 3) & 0x01) );
-
- ret = pulseEnable(value); // value is ignored here for gpio
-
- return ret;
-}
-
-mraa::Result
-Lcm1602::expandWrite(uint8_t value)
-{
- // invalid for gpio
- if (!m_isI2C)
- return mraa::ERROR_INVALID_RESOURCE;
-
- uint8_t buffer = value | LCD_BACKLIGHT;
- return m_i2c_lcd_control->writeByte(buffer);
-}
-
-mraa::Result
-Lcm1602::pulseEnable(uint8_t value)
-{
- mraa::Result ret = mraa::SUCCESS;
-
- if (m_isI2C)
- {
- ret = expandWrite(value | LCD_EN);
- usleep(1);
- ret = expandWrite(value & ~LCD_EN);
- usleep(50);
- return ret;
- }
-
- // else gpio
-
- ret = m_gpioEnable->write(0);
- usleep(1);
- ret = m_gpioEnable->write(1);
- usleep(1); // must be > 450ns
- ret = m_gpioEnable->write(0);
- usleep(100); // must be >37us
-
- return ret;
-}
diff --git a/peripheral/libupm/src/lcd/lcm1602.h b/peripheral/libupm/src/lcd/lcm1602.h
deleted file mode 100644
index 6c26082..0000000
--- a/peripheral/libupm/src/lcd/lcm1602.h
+++ /dev/null
@@ -1,263 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Author: Daniel Mosquera
- * Copyright (c) 2013 Daniel Mosquera
- *
- * Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Contributions: Jon Trulson <jtrulson@ics.com>
- * Sergey Kiselev <sergey.kiselev@intel.com>
- *
- * Permission is hereby granted, free of uint8_tge, 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 <string>
-#include <mraa/i2c.hpp>
-
-#include <mraa/gpio.hpp>
-
-#include "lcd.h"
-
-namespace upm
-{
-/**
- * @library i2clcd
- * @sensor lcm1602
- * @comname LCM1602 Display
- * @type display
- * @man adafruit sparkfun seeed
- * @web https://www.adafruit.com/datasheets/TC1602A-01T.pdf
- * @con i2c gpio
- *
- * @brief API for the LCM1602 I2C controller for HD44780-based displays
- *
- * This supports all sizes of HD44780 displays, from 16x2 to 4x20. The
- * controller has no idea of the actual display hardware, so it lets you write
- * farther than you can see. These displays with such controllers are available
- * from various manufacturers with different I2C addresses. Adafruit*
- * TC1602A-01T seems to be a well-documented example. The driver also supports
- * parallel GPIO connections directly to the HD44780 in case you are not using
- * an I2C expander/backpack.
- *
- * @image html lcm1602.jpeg
- * Example for LCM1602 displays that use the I2C bus
- * @snippet lcm1602-i2c.cxx Interesting
- * Code sample for GPIO based LCM1602 displays
- * @snippet lcm1602-parallel.cxx Interesting
- */
-class Lcm1602 : public LCD
-{
- public:
- /**
- * Lcm1602 constructor; calls libmraa initialisation functions
- *
- * @param bus I2C bus to use
- * @param address Slave address the LCD is registered on
- * @param isExpander True if we are dealing with an I2C expander,
- * false otherwise. Default is true.
- */
- Lcm1602(int bus, int address, bool isExpander=true,
- uint8_t numColumns = 16, uint8_t numRows = 4);
-
- /**
- * Lcm1602 alternate constructor, used for GPIO based HD44780
- * controllers supporting RS, Enable, and 4 data pins in 4-bit
- * mode.
- *
- * @param rs Register select pin
- * @param enable Enable pin
- * @param d0 Data 0 pin
- * @param d1 Data 1 pin
- * @param d2 Data 2 pin
- * @param d3 Data 3 pin
- */
- Lcm1602(uint8_t rs, uint8_t enable,
- uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3,
- uint8_t numColumns = 16, uint8_t numRows = 4);
-
- /**
- * Lcm1602 destructor
- */
- ~Lcm1602();
- /**
- * Writes a string to the LCD
- *
- * @param msg std::string to write to the display; note: only ASCII
- * characters are supported
- * @return Result of the operation
- */
- mraa::Result write(std::string msg);
- /**
- * Sets the cursor to specified coordinates
- *
- * @param row Row to set the cursor to
- * @param column Column to set the cursor to
- * @return Result of the operation
- */
- mraa::Result setCursor(int row, int column);
- /**
- * Clears the display of all characters
- *
- * @return Result of the operation
- */
- mraa::Result clear();
- /**
- * Returns to the original coordinates (0,0)
- *
- * @return Result of the operation
- */
- mraa::Result home();
-
- /**
- * Create a custom character
- *
- * @param charSlot the character slot to write, only 8 are available
- * @param charData The character data (8 bytes) making up the character
- * @return Result of operation
- */
- mraa::Result createChar(uint8_t charSlot, uint8_t charData[]);
-
- /**
- * Turn the display on
- *
- * @return Result of operation
- */
- mraa::Result displayOn();
-
- /**
- * Turn the display off
- *
- * @return Result of operation
- */
- mraa::Result displayOff();
-
- /**
- * Turn the cursor on
- *
- * @return Result of operation
- */
- mraa::Result cursorOn();
-
- /**
- * Turn the cursor off
- *
- * @return Result of operation
- */
- mraa::Result cursorOff();
-
- /**
- * Turn cursor blink on
- *
- * @return Result of operation
- */
- mraa::Result cursorBlinkOn();
-
- /**
- * Turn cursor blink off
- *
- * @return Result of operation
- */
- mraa::Result cursorBlinkOff();
-
- /**
- * Scroll the display left, without changing the character RAM
- *
- * @return Result of operation
- */
- mraa::Result scrollDisplayLeft();
-
- /**
- * Scroll the display right, without changing the character RAM
- *
- * @return Result of operation
- */
- mraa::Result scrollDisplayRight();
-
- /**
- * set the entry mode so that characters are added left to right
- *
- * @return Result of operation
- */
- mraa::Result entryLeftToRight();
-
- /**
- * set the entry mode so that characters are added right to left
- *
- * @return Result of operation
- */
- mraa::Result entryRightToLeft();
-
- /**
- * Right justify text entered from the cursor
- *
- * @return Result of operation
- */
- mraa::Result autoscrollOn();
-
- /**
- * Left justify text entered from the cursor
- *
- * @return Result of operation
- */
- mraa::Result autoscrollOff();
-
-
- protected:
- mraa::Result send(uint8_t value, int mode);
- mraa::Result write4bits(uint8_t value);
- mraa::Result expandWrite(uint8_t value);
- mraa::Result pulseEnable(uint8_t value);
-
- uint8_t m_displayControl;
- uint8_t m_entryDisplayMode;
-
- // Display size
- uint8_t m_numColumns;
- uint8_t m_numRows;
-
- // Add a command() and data() virtual member functions, with a
- // default implementation in lcm1602. This is expected to be
- // implemented by derived classes with different needs (Jhd1313m1,
- // for example).
- virtual mraa::Result command(uint8_t cmd);
- virtual mraa::Result data(uint8_t data);
-
- int m_lcd_control_address;
- mraa::I2c* m_i2c_lcd_control;
-
- private:
-
- // true if using i2c, false otherwise (gpio)
- bool m_isI2C;
-
- // gpio operation
- mraa::Gpio* m_gpioRS;
- mraa::Gpio* m_gpioEnable;
- mraa::Gpio* m_gpioD0;
- mraa::Gpio* m_gpioD1;
- mraa::Gpio* m_gpioD2;
- mraa::Gpio* m_gpioD3;
-};
-}
diff --git a/peripheral/libupm/src/lcd/license.txt b/peripheral/libupm/src/lcd/license.txt
deleted file mode 100644
index 7492e93..0000000
--- a/peripheral/libupm/src/lcd/license.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-Software License Agreement (BSD License)
-
-Copyright (c) 2012 Adafruit Industries. 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.
-
-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.
diff --git a/peripheral/libupm/src/lcd/pyupm_i2clcd.i b/peripheral/libupm/src/lcd/pyupm_i2clcd.i
deleted file mode 100755
index 04cab46..0000000
--- a/peripheral/libupm/src/lcd/pyupm_i2clcd.i
+++ /dev/null
@@ -1,48 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_i2clcd
-%include "../upm.i"
-%include "../carrays_uint8_t.i"
-
-%feature("autodoc", "3");
-
-%include "ssd.h"
-%include "lcd.h"
-%{
- #include "lcd.h"
-%}
-
-%include "lcm1602.h"
-%{
- #include "lcm1602.h"
-%}
-
-%include "jhd1313m1.h"
-%{
- #include "jhd1313m1.h"
-%}
-
-%include "ssd1327.h"
-%{
- #include "ssd1327.h"
-%}
-
-%include "ssd1308.h"
-%{
- #include "ssd1308.h"
-%}
-
-%include "eboled.h"
-%{
- #include "eboled.h"
-%}
-
-%include "sainsmartks.h"
-%{
- #include "sainsmartks.h"
-%}
-
-%include "ssd1306.h"
-%{
- #include "ssd1306.h"
-%}
diff --git a/peripheral/libupm/src/lcd/sainsmartks.cxx b/peripheral/libupm/src/lcd/sainsmartks.cxx
deleted file mode 100644
index 5c1eb99..0000000
--- a/peripheral/libupm/src/lcd/sainsmartks.cxx
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <unistd.h>
-
-#include "sainsmartks.h"
-
-using namespace upm;
-
-SAINSMARTKS::SAINSMARTKS(uint8_t rs, uint8_t enable,
- uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3,
- uint8_t keypad)
- : Lcm1602(rs, enable, d0, d1, d2, d3),
- m_aioKeypad(keypad)
-{
- m_name = "Sainsmart LCD Keypad Shield";
-}
-
-SAINSMARTKS::~SAINSMARTKS()
-{
-}
-
-float SAINSMARTKS::getRawKeyValue()
-{
- return m_aioKeypad.readFloat();
-}
diff --git a/peripheral/libupm/src/lcd/sainsmartks.h b/peripheral/libupm/src/lcd/sainsmartks.h
deleted file mode 100644
index fa4e4cc..0000000
--- a/peripheral/libupm/src/lcd/sainsmartks.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include <mraa/aio.hpp>
-#include "lcm1602.h"
-
-namespace upm
-{
- /**
- * @library i2clcd
- * @sensor sainsmartks
- * @comname SainSmart LCD Keypad Shield
- * @type display
- * @man sainsmart dfrobot sparkfun
- * @web http://www.sainsmart.com/sainsmart-1602-lcd-keypad-shield-for-arduino-duemilanove-uno-mega2560-mega1280.html
- * @web http://www.dfrobot.com/index.php?route=product/product&product_id=51
- * @web https://www.sparkfun.com/products/13293
- * @con gpio analog
- *
- * @brief API for Sainsmart LCD Keypad Shield
- *
- * The Sainsmart LCD Keypad Shield uses 6 digital outputs and 1 analog input
- * (for the keypad). The outputs are used to drive an attached LCM1602 LCD
- * controller. This driver should also be compatible with the similar LCD
- * keypad shields from DFRobot and Sparkfun.
- *
- * @image html keypadlcd.jpg
- * @snippet sainsmartks.cxx Interesting
- */
- class SAINSMARTKS : public Lcm1602
- {
- public:
- /**
- * SAINSMARTKS constructor
- *
- * As this is a shield, you will not likely have any choice over
- * the pins that are used. For this reason, we provide defaults
- * for all of them -- of course they can be changed if your device
- * is different.
- *
- * @param rs register select pin
- * @param enable enable pin
- * @param d0 data 0 pin
- * @param d1 data 1 pin
- * @param d2 data 2 pin
- * @param d3 data 3 pin
- * @param keypad analog pin of the keypad
- */
- SAINSMARTKS(uint8_t rs=8, uint8_t enable=9,
- uint8_t d0=4, uint8_t d1=5, uint8_t d2=6, uint8_t d3=7,
- uint8_t keypad=0);
- /**
- * SAINSMARTKS destructor
- */
- ~SAINSMARTKS();
-
- /**
- * returns the floating point representation of the key that is
- * being pushed. Each key produces a different value between 0.0
- * and 1.0, and only one key can be read at a time.
- *
- * @return the floating point value representing a key
- */
- float getRawKeyValue();
-
- private:
- mraa::Aio m_aioKeypad;
- };
-}
diff --git a/peripheral/libupm/src/lcd/ssd.h b/peripheral/libupm/src/lcd/ssd.h
deleted file mode 100644
index 860bb15..0000000
--- a/peripheral/libupm/src/lcd/ssd.h
+++ /dev/null
@@ -1,135 +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
-
-namespace upm
-{
-const uint8_t DISPLAY_CMD_OFF = 0xAE;
-const uint8_t DISPLAY_CMD_ON = 0xAF;
-
-const uint8_t BASE_LOW_COLUMN_ADDR = 0x00;
-const uint8_t BASE_HIGH_COLUMN_ADDR = 0x10;
-const uint8_t BASE_PAGE_START_ADDR = 0xB0;
-const uint8_t DISPLAY_CMD_MEM_ADDR_MODE = 0x20;
-
-const uint8_t BasicFont[][8] = { { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x5F, 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x07, 0x00, 0x07, 0x00, 0x00, 0x00 },
- { 0x00, 0x14, 0x7F, 0x14, 0x7F, 0x14, 0x00, 0x00 },
- { 0x00, 0x24, 0x2A, 0x7F, 0x2A, 0x12, 0x00, 0x00 },
- { 0x00, 0x23, 0x13, 0x08, 0x64, 0x62, 0x00, 0x00 },
- { 0x00, 0x36, 0x49, 0x55, 0x22, 0x50, 0x00, 0x00 },
- { 0x00, 0x00, 0x05, 0x03, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x1C, 0x22, 0x41, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x41, 0x22, 0x1C, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x08, 0x2A, 0x1C, 0x2A, 0x08, 0x00, 0x00 },
- { 0x00, 0x08, 0x08, 0x3E, 0x08, 0x08, 0x00, 0x00 },
- { 0x00, 0xA0, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00 },
- { 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x20, 0x10, 0x08, 0x04, 0x02, 0x00, 0x00 },
- { 0x00, 0x3E, 0x51, 0x49, 0x45, 0x3E, 0x00, 0x00 },
- { 0x00, 0x00, 0x42, 0x7F, 0x40, 0x00, 0x00, 0x00 },
- { 0x00, 0x62, 0x51, 0x49, 0x49, 0x46, 0x00, 0x00 },
- { 0x00, 0x22, 0x41, 0x49, 0x49, 0x36, 0x00, 0x00 },
- { 0x00, 0x18, 0x14, 0x12, 0x7F, 0x10, 0x00, 0x00 },
- { 0x00, 0x27, 0x45, 0x45, 0x45, 0x39, 0x00, 0x00 },
- { 0x00, 0x3C, 0x4A, 0x49, 0x49, 0x30, 0x00, 0x00 },
- { 0x00, 0x01, 0x71, 0x09, 0x05, 0x03, 0x00, 0x00 },
- { 0x00, 0x36, 0x49, 0x49, 0x49, 0x36, 0x00, 0x00 },
- { 0x00, 0x06, 0x49, 0x49, 0x29, 0x1E, 0x00, 0x00 },
- { 0x00, 0x00, 0x36, 0x36, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0xAC, 0x6C, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x08, 0x14, 0x22, 0x41, 0x00, 0x00, 0x00 },
- { 0x00, 0x14, 0x14, 0x14, 0x14, 0x14, 0x00, 0x00 },
- { 0x00, 0x41, 0x22, 0x14, 0x08, 0x00, 0x00, 0x00 },
- { 0x00, 0x02, 0x01, 0x51, 0x09, 0x06, 0x00, 0x00 },
- { 0x00, 0x32, 0x49, 0x79, 0x41, 0x3E, 0x00, 0x00 },
- { 0x00, 0x7E, 0x09, 0x09, 0x09, 0x7E, 0x00, 0x00 },
- { 0x00, 0x7F, 0x49, 0x49, 0x49, 0x36, 0x00, 0x00 },
- { 0x00, 0x3E, 0x41, 0x41, 0x41, 0x22, 0x00, 0x00 },
- { 0x00, 0x7F, 0x41, 0x41, 0x22, 0x1C, 0x00, 0x00 },
- { 0x00, 0x7F, 0x49, 0x49, 0x49, 0x41, 0x00, 0x00 },
- { 0x00, 0x7F, 0x09, 0x09, 0x09, 0x01, 0x00, 0x00 },
- { 0x00, 0x3E, 0x41, 0x41, 0x51, 0x72, 0x00, 0x00 },
- { 0x00, 0x7F, 0x08, 0x08, 0x08, 0x7F, 0x00, 0x00 },
- { 0x00, 0x41, 0x7F, 0x41, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x20, 0x40, 0x41, 0x3F, 0x01, 0x00, 0x00 },
- { 0x00, 0x7F, 0x08, 0x14, 0x22, 0x41, 0x00, 0x00 },
- { 0x00, 0x7F, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00 },
- { 0x00, 0x7F, 0x02, 0x0C, 0x02, 0x7F, 0x00, 0x00 },
- { 0x00, 0x7F, 0x04, 0x08, 0x10, 0x7F, 0x00, 0x00 },
- { 0x00, 0x3E, 0x41, 0x41, 0x41, 0x3E, 0x00, 0x00 },
- { 0x00, 0x7F, 0x09, 0x09, 0x09, 0x06, 0x00, 0x00 },
- { 0x00, 0x3E, 0x41, 0x51, 0x21, 0x5E, 0x00, 0x00 },
- { 0x00, 0x7F, 0x09, 0x19, 0x29, 0x46, 0x00, 0x00 },
- { 0x00, 0x26, 0x49, 0x49, 0x49, 0x32, 0x00, 0x00 },
- { 0x00, 0x01, 0x01, 0x7F, 0x01, 0x01, 0x00, 0x00 },
- { 0x00, 0x3F, 0x40, 0x40, 0x40, 0x3F, 0x00, 0x00 },
- { 0x00, 0x1F, 0x20, 0x40, 0x20, 0x1F, 0x00, 0x00 },
- { 0x00, 0x3F, 0x40, 0x38, 0x40, 0x3F, 0x00, 0x00 },
- { 0x00, 0x63, 0x14, 0x08, 0x14, 0x63, 0x00, 0x00 },
- { 0x00, 0x03, 0x04, 0x78, 0x04, 0x03, 0x00, 0x00 },
- { 0x00, 0x61, 0x51, 0x49, 0x45, 0x43, 0x00, 0x00 },
- { 0x00, 0x7F, 0x41, 0x41, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x02, 0x04, 0x08, 0x10, 0x20, 0x00, 0x00 },
- { 0x00, 0x41, 0x41, 0x7F, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x04, 0x02, 0x01, 0x02, 0x04, 0x00, 0x00 },
- { 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00 },
- { 0x00, 0x01, 0x02, 0x04, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x20, 0x54, 0x54, 0x54, 0x78, 0x00, 0x00 },
- { 0x00, 0x7F, 0x48, 0x44, 0x44, 0x38, 0x00, 0x00 },
- { 0x00, 0x38, 0x44, 0x44, 0x28, 0x00, 0x00, 0x00 },
- { 0x00, 0x38, 0x44, 0x44, 0x48, 0x7F, 0x00, 0x00 },
- { 0x00, 0x38, 0x54, 0x54, 0x54, 0x18, 0x00, 0x00 },
- { 0x00, 0x08, 0x7E, 0x09, 0x02, 0x00, 0x00, 0x00 },
- { 0x00, 0x18, 0xA4, 0xA4, 0xA4, 0x7C, 0x00, 0x00 },
- { 0x00, 0x7F, 0x08, 0x04, 0x04, 0x78, 0x00, 0x00 },
- { 0x00, 0x00, 0x7D, 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x80, 0x84, 0x7D, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x7F, 0x10, 0x28, 0x44, 0x00, 0x00, 0x00 },
- { 0x00, 0x41, 0x7F, 0x40, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x7C, 0x04, 0x18, 0x04, 0x78, 0x00, 0x00 },
- { 0x00, 0x7C, 0x08, 0x04, 0x7C, 0x00, 0x00, 0x00 },
- { 0x00, 0x38, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00 },
- { 0x00, 0xFC, 0x24, 0x24, 0x18, 0x00, 0x00, 0x00 },
- { 0x00, 0x18, 0x24, 0x24, 0xFC, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x7C, 0x08, 0x04, 0x00, 0x00, 0x00 },
- { 0x00, 0x48, 0x54, 0x54, 0x24, 0x00, 0x00, 0x00 },
- { 0x00, 0x04, 0x7F, 0x44, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x3C, 0x40, 0x40, 0x7C, 0x00, 0x00, 0x00 },
- { 0x00, 0x1C, 0x20, 0x40, 0x20, 0x1C, 0x00, 0x00 },
- { 0x00, 0x3C, 0x40, 0x30, 0x40, 0x3C, 0x00, 0x00 },
- { 0x00, 0x44, 0x28, 0x10, 0x28, 0x44, 0x00, 0x00 },
- { 0x00, 0x1C, 0xA0, 0xA0, 0x7C, 0x00, 0x00, 0x00 },
- { 0x00, 0x44, 0x64, 0x54, 0x4C, 0x44, 0x00, 0x00 },
- { 0x00, 0x08, 0x36, 0x41, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x41, 0x36, 0x08, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x02, 0x01, 0x01, 0x02, 0x01, 0x00, 0x00 },
- { 0x00, 0x02, 0x05, 0x05, 0x02, 0x00, 0x00, 0x00 } };
-
-typedef enum { HORIZONTAL = 0, VERTICAL = 1, PAGE = 2 } displayAddressingMode;
-}
diff --git a/peripheral/libupm/src/lcd/ssd1306.cxx b/peripheral/libupm/src/lcd/ssd1306.cxx
deleted file mode 100644
index 29ffa7e..0000000
--- a/peripheral/libupm/src/lcd/ssd1306.cxx
+++ /dev/null
@@ -1,313 +0,0 @@
-/*
- * Author: Marc Graham <marc@m2ag.net>
- * Copyright (c) 2015 Intel Corporation
- *
- * Adapted from ssd1308 library.
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <string>
-#include <unistd.h>
-
-#include "hd44780_bits.h"
-#include "ssd1306.h"
-
-using namespace upm;
-
-SSD1306::SSD1306(int bus_in, int addr_in) : m_i2c_lcd_control(bus_in)
-{
- int vccstate = SSD1306_SWITCHCAPVCC;
- _vccstate = vccstate;
-
- int LCD_CMD = 0x00;
-
- m_lcd_control_address = addr_in;
- m_name = "SSD1306";
-
- mraa::Result error = m_i2c_lcd_control.address(m_lcd_control_address);
-
- if (error != mraa::SUCCESS) {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": mraa_i2c_address() failed");
- return;
- }
-
- error = m_i2c_lcd_control.frequency(mraa::I2C_FAST);
-
- if (error != mraa::SUCCESS) {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_i2c_frequency(MRAA_I2C_FAST) failed");
- return;
- }
-
- m_i2c_lcd_control.writeReg(LCD_CMD, DISPLAY_CMD_OFF); // display off
- usleep(4500);
- //ADD 1306 stuff
- // Init sequence for 128x64 OLED module // 0xAE
- m_i2c_lcd_control.writeReg(LCD_CMD, SSD1306_SETDISPLAYCLOCKDIV); // 0xD5
- m_i2c_lcd_control.writeReg(LCD_CMD, 0x80); // the suggested ratio 0x80
- m_i2c_lcd_control.writeReg(LCD_CMD, SSD1306_SETMULTIPLEX); // 0xA8
- m_i2c_lcd_control.writeReg(LCD_CMD, 0x3F);
- m_i2c_lcd_control.writeReg(LCD_CMD, SSD1306_SETDISPLAYOFFSET); // 0xD3
- m_i2c_lcd_control.writeReg(LCD_CMD, 0x0); // no offset
- m_i2c_lcd_control.writeReg(LCD_CMD, SSD1306_SETSTARTLINE | 0x0); // line #0
- m_i2c_lcd_control.writeReg(LCD_CMD, SSD1306_CHARGEPUMP); // 0x8D
- if (vccstate == SSD1306_EXTERNALVCC) {
- m_i2c_lcd_control.writeReg(LCD_CMD, 0x10);
- } else {
- m_i2c_lcd_control.writeReg(LCD_CMD,0x14);
- }
- m_i2c_lcd_control.writeReg(LCD_CMD, SSD1306_MEMORYMODE); // 0x20
- m_i2c_lcd_control.writeReg(LCD_CMD, 0x00); // 0x0 act like ks0108
- m_i2c_lcd_control.writeReg(LCD_CMD, SSD1306_SEGREMAP | 0x1);
- m_i2c_lcd_control.writeReg(LCD_CMD, SSD1306_COMSCANDEC);
- m_i2c_lcd_control.writeReg(LCD_CMD, SSD1306_SETCOMPINS); // 0xDA
- m_i2c_lcd_control.writeReg(LCD_CMD, 0x12);
- m_i2c_lcd_control.writeReg(LCD_CMD, SSD1306_SETCONTRAST); // 0x81
- if (vccstate == SSD1306_EXTERNALVCC) {
- m_i2c_lcd_control.writeReg(LCD_CMD, 0x9F);
- } else {
- m_i2c_lcd_control.writeReg(LCD_CMD, 0xCF);
- }
- m_i2c_lcd_control.writeReg(LCD_CMD, SSD1306_SETPRECHARGE); // 0xd9
- if (vccstate == SSD1306_EXTERNALVCC) {
- m_i2c_lcd_control.writeReg(LCD_CMD, 0x22);
- } else {
- m_i2c_lcd_control.writeReg(LCD_CMD,0xF1);
- }
- m_i2c_lcd_control.writeReg(LCD_CMD, SSD1306_SETVCOMDETECT); // 0xDB
- m_i2c_lcd_control.writeReg(LCD_CMD, 0x40);
- m_i2c_lcd_control.writeReg(LCD_CMD, SSD1306_DISPLAYALLON_RESUME); // 0xA4
- m_i2c_lcd_control.writeReg(LCD_CMD, DISPLAY_CMD_SET_NORMAL_1306); // 0xA6
-
- //END 1306 Stuff
- m_i2c_lcd_control.writeReg(LCD_CMD, DISPLAY_CMD_ON); // display on
- usleep(4500);
- setNormalDisplay(); // set to normal display '1' is ON
-
- clear();
- setAddressingMode(PAGE);
-}
-
-SSD1306::~SSD1306()
-{
-}
-
-mraa::Result
-SSD1306::draw(uint8_t* data, int bytes)
-{
- mraa::Result error = mraa::SUCCESS;
-
- setAddressingMode(HORIZONTAL);
- for (int idx = 0; idx < bytes; idx++) {
- m_i2c_lcd_control.writeReg(LCD_DATA, data[idx]);
- }
-
- return error;
-}
-
-/*
- * **************
- * virtual area
- * **************
- */
-mraa::Result
-SSD1306::write(std::string msg)
-{
- mraa::Result error = mraa::SUCCESS;
-
- setAddressingMode(PAGE);
- for (std::string::size_type i = 0; i < msg.size(); ++i) {
- writeChar(msg[i]);
- }
-
- return error;
-}
-
-mraa::Result
-SSD1306::setCursor(int row, int column)
-{
- mraa::Result error = mraa::SUCCESS;
-
- error = m_i2c_lcd_control.writeReg(LCD_CMD, BASE_PAGE_START_ADDR + row); // set page address
- error = m_i2c_lcd_control.writeReg(LCD_CMD,
- BASE_LOW_COLUMN_ADDR + (8 * column & 0x0F)); // set column
- // lower address
- error = m_i2c_lcd_control.writeReg(LCD_CMD,
- BASE_HIGH_COLUMN_ADDR +
- ((8 * column >> 4) & 0x0F)); // set column higher address
-
- return error;
-}
-
-mraa::Result
-SSD1306::clear()
-{
- mraa::Result error = mraa::SUCCESS;
- uint8_t columnIdx, rowIdx;
-
- m_i2c_lcd_control.writeReg(LCD_CMD, DISPLAY_CMD_OFF); // display off
- for (rowIdx = 0; rowIdx < 8; rowIdx++) {
- setCursor(rowIdx, 0);
-
- // clear all columns
- for (columnIdx = 0; columnIdx < 16; columnIdx++) {
- writeChar(' ');
- }
- }
- m_i2c_lcd_control.writeReg(LCD_CMD, DISPLAY_CMD_ON); // display on
- home();
-
- return error;
-}
-
-mraa::Result
-SSD1306::home()
-{
- return setCursor(0, 0);
-}
-
-/*
- * **************
- * private area
- * **************
- */
-mraa::Result
-SSD1306::writeChar(uint8_t value)
-{
- mraa::Result rv;
- if (value < 0x20 || value > 0x7F) {
- value = 0x20; // space
- }
-
- for (uint8_t idx = 0; idx < 8; idx++) {
- rv = m_i2c_lcd_control.writeReg(LCD_DATA, BasicFont[value - 32][idx]);
- }
-
- return rv;
-}
-
-mraa::Result
-SSD1306::setNormalDisplay()
-{
- return m_i2c_lcd_control.writeReg(LCD_CMD,
- DISPLAY_CMD_SET_NORMAL_1306); // set to normal display '1' is
- // ON
-}
-
-mraa::Result
-SSD1306::setAddressingMode(displayAddressingMode mode)
-{
- mraa::Result rv;
- rv =m_i2c_lcd_control.writeReg(LCD_CMD, DISPLAY_CMD_MEM_ADDR_MODE); // set addressing mode
- rv =m_i2c_lcd_control.writeReg(LCD_CMD, mode); // set page addressing mode
- return rv;
-}
-
-
-mraa::Result
-SSD1306::invert(bool i)
-{
- mraa::Result rv;
- if(i){
- rv = m_i2c_lcd_control.writeReg(LCD_CMD, DISPLAY_CMD_SET_INVERT_1306);
- } else {
- rv = m_i2c_lcd_control.writeReg(LCD_CMD, DISPLAY_CMD_SET_NORMAL_1306);
- }
- return rv;
-}
-
-
-void SSD1306::startscrollright(uint8_t start, uint8_t stop){
- m_i2c_lcd_control.writeReg(LCD_CMD,SSD1306_RIGHT_HORIZONTAL_SCROLL);
- m_i2c_lcd_control.writeReg(LCD_CMD,0X00);
- m_i2c_lcd_control.writeReg(LCD_CMD,start);
- m_i2c_lcd_control.writeReg(LCD_CMD,0X00);
- m_i2c_lcd_control.writeReg(LCD_CMD,stop);
- m_i2c_lcd_control.writeReg(LCD_CMD,0X00);
- m_i2c_lcd_control.writeReg(LCD_CMD,0XFF);
- m_i2c_lcd_control.writeReg(LCD_CMD,SSD1306_ACTIVATE_SCROLL);
-}
-
-
-void SSD1306::startscrollleft(uint8_t start, uint8_t stop){
- m_i2c_lcd_control.writeReg(LCD_CMD,SSD1306_LEFT_HORIZONTAL_SCROLL);
- m_i2c_lcd_control.writeReg(LCD_CMD,0X00);
- m_i2c_lcd_control.writeReg(LCD_CMD,start);
- m_i2c_lcd_control.writeReg(LCD_CMD,0X00);
- m_i2c_lcd_control.writeReg(LCD_CMD,stop);
- m_i2c_lcd_control.writeReg(LCD_CMD,0X00);
- m_i2c_lcd_control.writeReg(LCD_CMD,0XFF);
- m_i2c_lcd_control.writeReg(LCD_CMD,SSD1306_ACTIVATE_SCROLL);
-}
-
-void SSD1306::startscrolldiagright(uint8_t start, uint8_t stop){
- m_i2c_lcd_control.writeReg(LCD_CMD, SSD1306_SET_VERTICAL_SCROLL_AREA);
- m_i2c_lcd_control.writeReg(LCD_CMD, 0X00);
- m_i2c_lcd_control.writeReg(LCD_CMD, SSD1306_LCDHEIGHT);
- m_i2c_lcd_control.writeReg(LCD_CMD, SSD1306_VERTICAL_AND_RIGHT_HORIZONTAL_SCROLL);
- m_i2c_lcd_control.writeReg(LCD_CMD, 0X00);
- m_i2c_lcd_control.writeReg(LCD_CMD, start);
- m_i2c_lcd_control.writeReg(LCD_CMD, 0X00);
- m_i2c_lcd_control.writeReg(LCD_CMD, stop);
- m_i2c_lcd_control.writeReg(LCD_CMD, 0X01);
- m_i2c_lcd_control.writeReg(LCD_CMD, SSD1306_ACTIVATE_SCROLL);
-}
-
-void SSD1306::startscrolldiagleft(uint8_t start, uint8_t stop){
- m_i2c_lcd_control.writeReg(LCD_CMD, SSD1306_SET_VERTICAL_SCROLL_AREA);
- m_i2c_lcd_control.writeReg(LCD_CMD, 0X00);
- m_i2c_lcd_control.writeReg(LCD_CMD, SSD1306_LCDHEIGHT);
- m_i2c_lcd_control.writeReg(LCD_CMD, SSD1306_VERTICAL_AND_LEFT_HORIZONTAL_SCROLL);
- m_i2c_lcd_control.writeReg(LCD_CMD, 0X00);
- m_i2c_lcd_control.writeReg(LCD_CMD, start);
- m_i2c_lcd_control.writeReg(LCD_CMD, 0X00);
- m_i2c_lcd_control.writeReg(LCD_CMD, stop);
- m_i2c_lcd_control.writeReg(LCD_CMD, 0X01);
- m_i2c_lcd_control.writeReg(LCD_CMD, SSD1306_ACTIVATE_SCROLL);
-}
-
-void SSD1306::stopscroll(void){
- m_i2c_lcd_control.writeReg(LCD_CMD,SSD1306_DEACTIVATE_SCROLL);
-}
-
-// Dim the display
-// dim = true: display is dimmed
-// dim = false: display is normal
-void SSD1306::dim(bool dim) {
- uint8_t contrast;
-
- if (dim) {
- contrast = 0; // Dimmed display
- } else {
- if (_vccstate == SSD1306_EXTERNALVCC) {
- contrast = 0x9F;
- } else {
- contrast = 0xCF;
- }
- }
- // the range of contrast to too small to be really useful
- // it is useful to dim the display
- m_i2c_lcd_control.writeReg(LCD_CMD,SSD1306_SETCONTRAST);
- m_i2c_lcd_control.writeReg(LCD_CMD,contrast);
-}
diff --git a/peripheral/libupm/src/lcd/ssd1306.h b/peripheral/libupm/src/lcd/ssd1306.h
deleted file mode 100644
index e1fbc46..0000000
--- a/peripheral/libupm/src/lcd/ssd1306.h
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
- * Author: Marc Graham <marc@m2ag.net>
- * Copyright (c) 2015 Intel Corporation
- *
- * Adapted from ssd1308 library.
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#pragma once
-
-#include <string>
-#include <mraa/i2c.hpp>
-#include "lcd.h"
-#include "ssd.h"
-
-namespace upm
-{
-const uint8_t DISPLAY_CMD_SET_NORMAL_1306 = 0xA6;
-const uint8_t SSD1306_SETCONTRAST = 0x81;
-const uint8_t SSD1306_DISPLAYALLON_RESUME =0xA4;
-const uint8_t SSD1306_DISPLAYALLON = 0xA5;
-const uint8_t DISPLAY_CMD_SET_INVERT_1306 = 0xA7;
-
-const uint8_t SSD1306_SETDISPLAYOFFSET =0xD3;
-const uint8_t SSD1306_SETCOMPINS = 0xDA;
-
-const uint8_t SSD1306_SETVCOMDETECT = 0xDB;
-
-const uint8_t SSD1306_SETDISPLAYCLOCKDIV = 0xD5;
-const uint8_t SSD1306_SETPRECHARGE = 0xD9;
-
-const uint8_t SSD1306_SETMULTIPLEX = 0xA8;
-
-const uint8_t SSD1306_SETLOWCOLUM = 0x00;
-const uint8_t SSD1306_SETHIGHCOLUMN = 0x10;
-
-const uint8_t SSD1306_SETSTARTLINE = 0x40;
-
-const uint8_t SSD1306_MEMORYMODE = 0x20;
-const uint8_t SSD1306_COLUMNADDR = 0x21;
-const uint8_t SSD1306_PAGEADDR = 0x22;
-
-const uint8_t SSD1306_COMSCANINC = 0xC0;
-const uint8_t SSD1306_COMSCANDEC = 0xC8;
-
-const uint8_t SSD1306_SEGREMAP = 0xA0;
-
-const uint8_t SSD1306_CHARGEPUMP = 0x8D;
-
-const uint8_t SSD1306_EXTERNALVCC = 0x1;
-const uint8_t SSD1306_SWITCHCAPVCC = 0x2;
-
-// Scrolling const uint8_t s
-const uint8_t SSD1306_ACTIVATE_SCROLL = 0x2F;
-const uint8_t SSD1306_DEACTIVATE_SCROLL = 0x2E;
-const uint8_t SSD1306_SET_VERTICAL_SCROLL_AREA = 0xA3;
-const uint8_t SSD1306_RIGHT_HORIZONTAL_SCROLL = 0x26;
-const uint8_t SSD1306_LEFT_HORIZONTAL_SCROLL = 0x27;
-const uint8_t SSD1306_VERTICAL_AND_RIGHT_HORIZONTAL_SCROLL = 0x29;
-const uint8_t SSD1306_VERTICAL_AND_LEFT_HORIZONTAL_SCROLL = 0x2A;
-
-const uint8_t SSD1306_BLACK = 0;
-const uint8_t SSD1306_WHITE = 1;
-const uint8_t SSD1306_LCDWIDTH = 128;
-const uint8_t SSD1306_LCDHEIGHT = 64;
-
-/**
- * @library i2clcd
- * @sensor ssd1306
- * @comname SSD1306 OLED Display
- * @altname Adafruit SSD1306 OLED Display 0.96"
- * @type display
- * @man adafruit
- * @web https://www.adafruit.com/datasheets/SSD1306.pdf
- * @web http://www.farnell.com/datasheets/609753.pdf
- * @con i2c
- *
- * @brief API for SSD1306 I2C-controlled OLED displays
- *
- * SSD1306 is a 128x64 dot-matrix OLED/PLED segment driver with a
- * controller. This device is available from many suppliers for a
- * very low cost. This implementation was tested using a generic
- * SSD1306 device from eBay.
- *
- * @image html ssd1306.jpeg
- * @snippet ssd1306-oled.cxx Interesting
- */
-class SSD1306 : public LCD
-{
- public:
- /**
- * SSD1306 constructor; calls libmraa initialisation functions
- *
- * @param bus I2C bus to use
- * @param address Slave address the LCD is registered on
- */
- SSD1306(int bus, int address = 0x3C);
- /**
- * SSD1306 destructor
- */
- ~SSD1306();
- /**
- * Draws an image; see examples/python/make_oled_pic.py for an
- * explanation of how pixels are mapped to bytes
- *
- * @param data Buffer to read
- * @param bytes Number of bytes to read from the pointer
- * @return Result of the operation
- */
- mraa::Result draw(uint8_t* data, int bytes);
- /**
- * Writes a string to the LCD
- *
- * @param msg std::string to write to the display; note: only ASCII
- * characters are supported
- * @return Result of the operation
- */
- mraa::Result write(std::string msg);
- /**
- * Sets the cursor to specified coordinates
- *
- * @param row Row to set the cursor to
- * @param column Column to set the cursor to
- * @return Result of the operation
- */
- mraa::Result setCursor(int row, int column);
- /**
- * Clears the display of all characters
- *
- * @return Result of the operation
- */
- mraa::Result clear();
- /**
- * Returns to the original coordinates (0,0)
- *
- * @return Result of the operation
- */
- mraa::Result home();
- /**
- * Inverts the display
- *
- * @param i true to invert, false for normal display
- * @return Result of the operation
- */
- mraa::Result invert(bool i);
- /**
- * Activate a scroll to the right for rows start through stop
- * The display is 16 rows tall. To scroll the whole display, run:
- * display.scrollright(0x00, 0x0F)
- *
- * @param start First row to scroll
- * @param stop Last row to scroll
- * @return void
- */
- void startscrollright(uint8_t start, uint8_t stop);
- /**
- * Activate a scroll to the left for rows start through stop
- * The display is 16 rows tall. To scroll the whole display, run:
- * display.startscrollright(0x00, 0x0F)
- *
- * @param start First row to scroll
- * @param stop Last row to scroll
- * @return void
- */
- void startscrollleft(uint8_t start, uint8_t stop);
- /**
- * Activate a scroll to the upper right for rows start through stop
- * The display is 16 rows tall. To scroll the whole display, run:
- * display.startscrollleft(0x00, 0x0F)
- *
- * @param start First row to scroll
- * @param stop Last row to scroll
- * @return void
- */
- void startscrolldiagright(uint8_t start, uint8_t stop);
- /**
- * Activate a scroll to the upper left for rows start through stop
- * The display is 16 rows tall. To scroll the whole display, run:
- * display.startscrolldiaagright(0x00, 0x0F)
- *
- * @param start First row to scroll
- * @param stop Last row to scroll
- * @return void
- */
- void startscrolldiagleft(uint8_t start, uint8_t stop);
- /**
- * Stops display scrolling.
- *
- * @return void
- */
- void stopscroll(void);
- /**
- * Dims display
- *
- * @param dim True to dim display, false for max intensity
- * @return Result of last operation
- */
- void dim(bool dim);
-
- private:
- mraa::Result writeChar(uint8_t value);
- mraa::Result setNormalDisplay();
- mraa::Result setAddressingMode(displayAddressingMode mode);
-
- int m_lcd_control_address;
- mraa::I2c m_i2c_lcd_control;
-
- int _vccstate;
-};
-}
diff --git a/peripheral/libupm/src/lcd/ssd1308.cxx b/peripheral/libupm/src/lcd/ssd1308.cxx
deleted file mode 100644
index 7adc830..0000000
--- a/peripheral/libupm/src/lcd/ssd1308.cxx
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <stdexcept>
-#include <string>
-#include <unistd.h>
-
-#include "hd44780_bits.h"
-#include "ssd1308.h"
-
-using namespace upm;
-
-SSD1308::SSD1308(int bus_in, int addr_in) : m_i2c_lcd_control(bus_in)
-{
- m_lcd_control_address = addr_in;
- m_name = "SSD1308";
-
- mraa::Result error = m_i2c_lcd_control.address(m_lcd_control_address);
- if (error != mraa::SUCCESS) {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": I2c.address() failed");
- return;
- }
-
- m_i2c_lcd_control.writeReg(LCD_CMD, DISPLAY_CMD_OFF); // display off
- usleep(4500);
- m_i2c_lcd_control.writeReg(LCD_CMD, DISPLAY_CMD_ON); // display on
- usleep(4500);
- setNormalDisplay(); // set to normal display '1' is ON
-
- clear();
- setAddressingMode(PAGE);
-}
-
-SSD1308::~SSD1308()
-{
-}
-
-mraa::Result
-SSD1308::draw(uint8_t* data, int bytes)
-{
- mraa::Result error = mraa::SUCCESS;
-
- setAddressingMode(HORIZONTAL);
- for (int idx = 0; idx < bytes; idx++) {
- m_i2c_lcd_control.writeReg(LCD_DATA, data[idx]);
- }
-
- return error;
-}
-
-/*
- * **************
- * virtual area
- * **************
- */
-mraa::Result
-SSD1308::write(std::string msg)
-{
- mraa::Result error = mraa::SUCCESS;
- uint8_t data[2] = { 0x40, 0 };
-
- setAddressingMode(PAGE);
- for (std::string::size_type i = 0; i < msg.size(); ++i) {
- writeChar(msg[i]);
- }
-
- return error;
-}
-
-mraa::Result
-SSD1308::setCursor(int row, int column)
-{
- mraa::Result error = mraa::SUCCESS;
-
- error = m_i2c_lcd_control.writeReg(LCD_CMD, BASE_PAGE_START_ADDR + row); // set page address
- error = m_i2c_lcd_control.writeReg(LCD_CMD,
- BASE_LOW_COLUMN_ADDR + (8 * column & 0x0F)); // set column
- // lower address
- error = m_i2c_lcd_control.writeReg(LCD_CMD,
- BASE_HIGH_COLUMN_ADDR +
- ((8 * column >> 4) & 0x0F)); // set column higher address
-
- return error;
-}
-
-mraa::Result
-SSD1308::clear()
-{
- mraa::Result error = mraa::SUCCESS;
- uint8_t columnIdx, rowIdx;
-
- m_i2c_lcd_control.writeReg(LCD_CMD, DISPLAY_CMD_OFF); // display off
- for (rowIdx = 0; rowIdx < 8; rowIdx++) {
- setCursor(rowIdx, 0);
-
- // clear all columns
- for (columnIdx = 0; columnIdx < 16; columnIdx++) {
- writeChar(' ');
- }
- }
- m_i2c_lcd_control.writeReg(LCD_CMD, DISPLAY_CMD_ON); // display on
- home();
-
- return mraa::SUCCESS;
-}
-
-mraa::Result
-SSD1308::home()
-{
- return setCursor(0, 0);
-}
-
-/*
- * **************
- * private area
- * **************
- */
-mraa::Result
-SSD1308::writeChar(uint8_t value)
-{
- mraa::Result rv;
- if (value < 0x20 || value > 0x7F) {
- value = 0x20; // space
- }
-
- for (uint8_t idx = 0; idx < 8; idx++) {
- rv = m_i2c_lcd_control.writeReg(LCD_DATA, BasicFont[value - 32][idx]);
- }
-
- return rv;
-}
-
-mraa::Result
-SSD1308::setNormalDisplay()
-{
- return m_i2c_lcd_control.writeReg(LCD_CMD,
- DISPLAY_CMD_SET_NORMAL_1308); // set to normal display '1' is
- // ON
-}
-
-mraa::Result
-SSD1308::setAddressingMode(displayAddressingMode mode)
-{
- mraa::Result rv;
- rv =m_i2c_lcd_control.writeReg(LCD_CMD, DISPLAY_CMD_MEM_ADDR_MODE); // set addressing mode
- rv =m_i2c_lcd_control.writeReg(LCD_CMD, mode); // set page addressing mode
- return rv;
-}
diff --git a/peripheral/libupm/src/lcd/ssd1308.h b/peripheral/libupm/src/lcd/ssd1308.h
deleted file mode 100644
index 8fd2b35..0000000
--- a/peripheral/libupm/src/lcd/ssd1308.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#pragma once
-
-#include <string>
-#include <mraa/i2c.hpp>
-#include "lcd.h"
-#include "ssd.h"
-
-namespace upm
-{
-const uint8_t DISPLAY_CMD_SET_NORMAL_1308 = 0xA6;
-
-/**
- * @library i2clcd
- * @sensor ssd1308
- * @comname SSD1308 OLED Display
- * @altname Grove OLED Display 0.96"
- * @type display
- * @man seeed adafruit
- * @web http://garden.seeedstudio.com/images/4/46/SSD1308_1.0.pdf
- * @web http://www.seeedstudio.com/wiki/Grove_-_OLED_Display_0.96%22
- * @con i2c
- *
- * @brief API for SSD1308 I2C-controlled OLED displays
- *
- * SSD1308 is a 128x64 dot-matrix OLED/PLED segment driver with a
- * controller. This implementation was tested using the Grove LED 128×64
- * Display module, which is an OLED monochrome display.
- *
- * @image html ssd1308.jpeg
- * @snippet ssd1308-oled.cxx Interesting
- */
-class SSD1308 : public LCD
-{
- public:
- /**
- * SSD1308 constructor; calls libmraa initialisation functions
- *
- * @param bus I2C bus to use
- * @param address Slave address the LCD is registered on
- */
- SSD1308(int bus, int address = 0x3C);
- /**
- * SSD1308 destructor
- */
- ~SSD1308();
- /**
- * Draws an image; see examples/python/make_oled_pic.py for an
- * explanation of how pixels are mapped to bytes
- *
- * @param data Buffer to read
- * @param bytes Number of bytes to read from the pointer
- * @return Result of the operation
- */
- mraa::Result draw(uint8_t* data, int bytes);
- /**
- * Writes a string to the LCD
- *
- * @param msg std::string to write to the display; note: only ASCII
- * characters are supported
- * @return Result of the operation
- */
- mraa::Result write(std::string msg);
- /**
- * Sets the cursor to specified coordinates
- *
- * @param row Row to set the cursor to
- * @param column Column to set the cursor to
- * @return Result of the operation
- */
- mraa::Result setCursor(int row, int column);
- /**
- * Clears the display of all characters
- *
- * @return Result of the operation
- */
- mraa::Result clear();
- /**
- * Returns to the original coordinates (0,0)
- *
- * @return Result of the operation
- */
- mraa::Result home();
-
- private:
- mraa::Result writeChar(uint8_t value);
- mraa::Result setNormalDisplay();
- mraa::Result setAddressingMode(displayAddressingMode mode);
-
- int m_lcd_control_address;
- mraa::I2c m_i2c_lcd_control;
-};
-}
diff --git a/peripheral/libupm/src/lcd/ssd1327.cxx b/peripheral/libupm/src/lcd/ssd1327.cxx
deleted file mode 100644
index 28cc343..0000000
--- a/peripheral/libupm/src/lcd/ssd1327.cxx
+++ /dev/null
@@ -1,319 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <stdexcept>
-#include <string>
-#include <unistd.h>
-
-#include "hd44780_bits.h"
-#include "ssd1327.h"
-
-using namespace upm;
-
-#define INIT_SLEEP 50000
-#define CMD_SLEEP 10000
-
-SSD1327::SSD1327(int bus_in, int addr_in) : m_i2c_lcd_control(bus_in)
-{
- mraa::Result error = mraa::SUCCESS;
-
- m_lcd_control_address = addr_in;
- m_name = "SSD1327";
-
- error = m_i2c_lcd_control.address(m_lcd_control_address);
- if (error != mraa::SUCCESS) {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": I2c.address() failed");
- return;
- }
-
- usleep(INIT_SLEEP);
- m_i2c_lcd_control.writeReg(LCD_CMD, 0xFD); // Unlock OLED driver IC MCU
- // interface from entering command.
- // i.e: Accept commands
- usleep(INIT_SLEEP);
- m_i2c_lcd_control.writeReg(LCD_CMD, 0x12);
- usleep(INIT_SLEEP);
- error = m_i2c_lcd_control.writeReg(LCD_CMD, 0xAE); // Set display off
- usleep(INIT_SLEEP);
- m_i2c_lcd_control.writeReg(LCD_CMD, 0xA8); // set multiplex ratio
- usleep(INIT_SLEEP);
- error = m_i2c_lcd_control.writeReg(LCD_CMD, 0x5F); // 96
- usleep(INIT_SLEEP);
- error = m_i2c_lcd_control.writeReg(LCD_CMD, 0xA1); // set display start line
- usleep(INIT_SLEEP);
- error = m_i2c_lcd_control.writeReg(LCD_CMD, 0x00); //
- usleep(INIT_SLEEP);
- error = m_i2c_lcd_control.writeReg(LCD_CMD, 0xA2); // set display offset
- usleep(INIT_SLEEP);
- error = m_i2c_lcd_control.writeReg(LCD_CMD, 0x60);
- usleep(INIT_SLEEP);
- error = m_i2c_lcd_control.writeReg(LCD_CMD, 0xA0); // set remap
- usleep(INIT_SLEEP);
- error = m_i2c_lcd_control.writeReg(LCD_CMD, 0x46);
- usleep(INIT_SLEEP);
- error = m_i2c_lcd_control.writeReg(LCD_CMD, 0xAB); // set vdd internal
- usleep(INIT_SLEEP);
- error = m_i2c_lcd_control.writeReg(LCD_CMD, 0x01); //
- usleep(INIT_SLEEP);
- error = m_i2c_lcd_control.writeReg(LCD_CMD, 0x81); // set contrasr
- usleep(INIT_SLEEP);
- error = m_i2c_lcd_control.writeReg(LCD_CMD, 0x53); // 100 nit
- usleep(INIT_SLEEP);
- error = m_i2c_lcd_control.writeReg(LCD_CMD, 0xB1); // Set Phase Length
- usleep(INIT_SLEEP);
- error = m_i2c_lcd_control.writeReg(LCD_CMD, 0X51); //
- usleep(INIT_SLEEP);
- error = m_i2c_lcd_control.writeReg(LCD_CMD, 0xB3); // Set Display Clock Divide Ratio/Oscillator
- // Frequency
- usleep(INIT_SLEEP);
- error = m_i2c_lcd_control.writeReg(LCD_CMD, 0x01); //
- usleep(INIT_SLEEP);
- error = m_i2c_lcd_control.writeReg(LCD_CMD, 0xB9); //
- usleep(INIT_SLEEP);
- error = m_i2c_lcd_control.writeReg(LCD_CMD, 0xBC); // set pre_charge
- // voltage/VCOMH
- usleep(INIT_SLEEP);
- error = m_i2c_lcd_control.writeReg(LCD_CMD, 0x08); // (0x08);
- usleep(INIT_SLEEP);
- error = m_i2c_lcd_control.writeReg(LCD_CMD, 0xBE); // set VCOMH
- usleep(INIT_SLEEP);
- error = m_i2c_lcd_control.writeReg(LCD_CMD, 0X07); // (0x07);
- usleep(INIT_SLEEP);
- error = m_i2c_lcd_control.writeReg(LCD_CMD, 0xB6); // Set second pre-charge
- // period
- usleep(INIT_SLEEP);
- error = m_i2c_lcd_control.writeReg(LCD_CMD, 0x01); //
- usleep(INIT_SLEEP);
- error = m_i2c_lcd_control.writeReg(LCD_CMD, 0xD5); // enable second precharge and enternal vsl
- usleep(INIT_SLEEP);
- error = m_i2c_lcd_control.writeReg(LCD_CMD, 0X62); // (0x62);
- usleep(INIT_SLEEP);
- error = m_i2c_lcd_control.writeReg(LCD_CMD, 0xA4); // Set Normal Display Mode
- usleep(INIT_SLEEP);
- error = m_i2c_lcd_control.writeReg(LCD_CMD, 0x2E); // Deactivate Scroll
- usleep(INIT_SLEEP);
- error = m_i2c_lcd_control.writeReg(LCD_CMD, 0xAF); // Switch on display
- usleep(INIT_SLEEP);
-
- // Row Address
- error = m_i2c_lcd_control.writeReg(LCD_CMD, 0x75); // Set Row Address
- usleep(INIT_SLEEP);
- error = m_i2c_lcd_control.writeReg(LCD_CMD, 0x00); // Start 0
- usleep(INIT_SLEEP);
- error = m_i2c_lcd_control.writeReg(LCD_CMD, 0x5f); // End 95
- usleep(INIT_SLEEP);
-
- // Column Address
- error = m_i2c_lcd_control.writeReg(LCD_CMD, 0x15); // Set Column Address
- usleep(INIT_SLEEP);
- error = m_i2c_lcd_control.writeReg(LCD_CMD, 0x08); // Start from 8th Column of
- // driver IC. This is 0th
- // Column for OLED
- usleep(INIT_SLEEP);
- error = m_i2c_lcd_control.writeReg(LCD_CMD, 0x37); // End at (8 + 47)th
- // column. Each Column has 2
- // pixels(segments)
- usleep(INIT_SLEEP);
-
- clear();
- setNormalDisplay();
- setVerticalMode();
-}
-
-SSD1327::~SSD1327()
-{
-}
-
-mraa::Result
-SSD1327::draw(uint8_t* data, int bytes)
-{
- mraa::Result error = mraa::SUCCESS;
-
- setHorizontalMode();
- for (int row = 0; row < bytes; row++) {
- for (uint8_t col = 0; col < 8; col += 2) {
- uint8_t value = 0x0;
-
- uint8_t bitOne = (data[row] << col) & 0x80;
- uint8_t bitTwo = (data[row] << (col + 1)) & 0x80;
-
- value |= (bitOne) ? grayHigh : 0x00;
- value |= (bitTwo) ? grayLow : 0x00;
-
- m_i2c_lcd_control.writeReg(LCD_DATA, value);
- usleep(CMD_SLEEP - 2000);
- }
- }
-
- return error;
-}
-
-/*
- * **************
- * virtual area
- * **************
- */
-mraa::Result
-SSD1327::write(std::string msg)
-{
- mraa::Result error = mraa::SUCCESS;
-
- setVerticalMode();
- for (std::string::size_type i = 0; i < msg.size(); ++i) {
- writeChar(msg[i]);
- }
-
- return error;
-}
-
-mraa::Result
-SSD1327::setCursor(int row, int column)
-{
- mraa::Result error = mraa::SUCCESS;
-
- // Column Address
- m_i2c_lcd_control.writeReg(LCD_CMD, 0x15); /* Set Column Address */
- usleep(CMD_SLEEP);
- m_i2c_lcd_control.writeReg(LCD_CMD, 0x08 + (column * 4)); /* Start Column:
- Start from 8 */
- usleep(CMD_SLEEP);
- m_i2c_lcd_control.writeReg(LCD_CMD, 0x37); /* End Column */
- usleep(CMD_SLEEP);
- // Row Address
- m_i2c_lcd_control.writeReg(LCD_CMD, 0x75); /* Set Row Address */
- usleep(CMD_SLEEP);
- m_i2c_lcd_control.writeReg(LCD_CMD, 0x00 + (row * 8)); /* Start Row*/
- usleep(CMD_SLEEP);
- m_i2c_lcd_control.writeReg(LCD_CMD, 0x07 + (row * 8)); /* End Row*/
- usleep(CMD_SLEEP);
-
- return error;
-}
-
-mraa::Result
-SSD1327::clear()
-{
- mraa::Result error = mraa::SUCCESS;
- uint8_t columnIdx, rowIdx;
-
- for (rowIdx = 0; rowIdx < 12; rowIdx++) {
- // clear all columns
- for (columnIdx = 0; columnIdx < 12; columnIdx++) {
- writeChar(' ');
- }
- }
-
- return mraa::SUCCESS;
-}
-
-mraa::Result
-SSD1327::home()
-{
- return setCursor(0, 0);
-}
-
-void
-SSD1327::setGrayLevel(uint8_t level)
-{
- grayHigh = (level << 4) & 0xF0;
- grayLow = level & 0x0F;
-}
-
-/*
- * **************
- * private area
- * **************
- */
-mraa::Result
-SSD1327::writeChar(uint8_t value)
-{
- mraa::Result rv = mraa::SUCCESS;
- if (value < 0x20 || value > 0x7F) {
- value = 0x20; // space
- }
-
- for (uint8_t row = 0; row < 8; row = row + 2) {
- for (uint8_t col = 0; col < 8; col++) {
- uint8_t data = 0x0;
-
- uint8_t bitOne = ((BasicFont[value - 32][row]) >> col) & 0x1;
- uint8_t bitTwo = ((BasicFont[value - 32][row + 1]) >> col) & 0x1;
-
- data |= (bitOne) ? grayHigh : 0x00;
- data |= (bitTwo) ? grayLow : 0x00;
-
- rv = m_i2c_lcd_control.writeReg(LCD_DATA, data);
- usleep(CMD_SLEEP - 2000);
- }
- }
- return rv;
-}
-
-mraa::Result
-SSD1327::setNormalDisplay()
-{
- return m_i2c_lcd_control.writeReg(LCD_CMD,
- DISPLAY_CMD_SET_NORMAL); // set to normal display '1' is ON
-}
-
-mraa::Result
-SSD1327::setHorizontalMode()
-{
- mraa::Result rv = mraa::SUCCESS;
- rv = m_i2c_lcd_control.writeReg(LCD_CMD, 0xA0); // remap to
- usleep(CMD_SLEEP);
- rv = m_i2c_lcd_control.writeReg(LCD_CMD, 0x42); // horizontal mode
- usleep(CMD_SLEEP);
-
- // Row Address
- rv = m_i2c_lcd_control.writeReg(LCD_CMD, 0x75); // Set Row Address
- usleep(CMD_SLEEP);
- rv = m_i2c_lcd_control.writeReg(LCD_CMD, 0x00); // Start 0
- usleep(CMD_SLEEP);
- rv = m_i2c_lcd_control.writeReg(LCD_CMD, 0x5f); // End 95
- usleep(CMD_SLEEP);
-
- // Column Address
- rv = m_i2c_lcd_control.writeReg(LCD_CMD, 0x15); // Set Column Address
- usleep(CMD_SLEEP);
- rv = m_i2c_lcd_control.writeReg(LCD_CMD, 0x08); // Start from 8th Column of driver
- // IC. This is 0th Column for OLED
- usleep(CMD_SLEEP);
- rv = m_i2c_lcd_control.writeReg(LCD_CMD, 0x37); // End at (8 + 47)th column. Each
- // Column has 2 pixels(or segments)
- usleep(CMD_SLEEP);
- return rv;
-}
-
-mraa::Result
-SSD1327::setVerticalMode()
-{
- mraa::Result rv = mraa::SUCCESS;
- rv = m_i2c_lcd_control.writeReg(LCD_CMD, 0xA0); // remap to
- usleep(CMD_SLEEP);
- rv = m_i2c_lcd_control.writeReg(LCD_CMD, 0x46); // Vertical mode
- usleep(CMD_SLEEP);
- return rv;
-}
diff --git a/peripheral/libupm/src/lcd/ssd1327.h b/peripheral/libupm/src/lcd/ssd1327.h
deleted file mode 100644
index 5785080..0000000
--- a/peripheral/libupm/src/lcd/ssd1327.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#pragma once
-
-#include <string>
-#include <mraa/i2c.hpp>
-#include "lcd.h"
-#include "ssd.h"
-
-namespace upm
-{
-const uint8_t DISPLAY_CMD_SET_NORMAL = 0xA4;
-
-/**
- * @library i2clcd
- * @sensor ssd1327
- * @comname SSD1327 OLED Display
- * @altname Grove OLED Display 1.12"
- * @type display
- * @man seeed adafruit
- * @web http://garden.seeedstudio.com/images/8/82/SSD1327_datasheet.pdf
- * @web http://www.seeedstudio.com/wiki/Grove_-_OLED_Display_1.12%22
- * @con i2c
- *
- * @brief API for SSD1327 I2C-controlled OLED displays
- *
- * SSD1327 is a 96x96 dot-matrix OLED/PLED segment driver with a controller.
- * This implementation was tested using the Grove LED 96×96 Display module,
- * which is an OLED monochrome display.
- *
- * @image html ssd1327.jpeg
- * @snippet ssd1327-oled.cxx Interesting
- */
-class SSD1327 : public LCD
-{
- public:
- /**
- * SSD1327 constructor; calls libmraa initialisation functions
- *
- * @param bus I2C bus to use
- * @param address Slave address the LCD is registered on
- */
- SSD1327(int bus, int address = 0x3C);
- /**
- * SSD1327 destructor
- */
- ~SSD1327();
- /**
- * Draws an image; see examples/python/make_oled_pic.py for an
- * explanation of how pixels are mapped to bytes
- *
- * @param data Buffer to read
- * @param bytes Number of bytes to read from the pointer
- * @return Result of the operation
- */
- mraa::Result draw(uint8_t* data, int bytes);
- /**
- * Sets the gray level for the LCD panel
- *
- * @param gray level from 0 to 255
- * @return Result of the operation
- */
- void setGrayLevel(uint8_t level);
- /**
- * Writes a string to the LCD
- *
- * @param msg std::string to write to the display; note: only ASCII
- * characters are supported
- * @return Result of the operation
- */
- mraa::Result write(std::string msg);
- /**
- * Sets the cursor to specified coordinates
- *
- * @param row Row to set the cursor to
- * @param column Column to set the cursor to
- * @return Result of the operation
- */
- mraa::Result setCursor(int row, int column);
- /**
- * Clears the display of all characters
- *
- * @return Result of the operation
- */
- mraa::Result clear();
- /**
- * Returns to the original coordinates (0,0)
- *
- * @return Result of the operation
- */
- mraa::Result home();
-
- private:
- mraa::Result writeChar(uint8_t value);
- mraa::Result setNormalDisplay();
- mraa::Result setHorizontalMode();
- mraa::Result setVerticalMode();
-
- uint8_t grayHigh;
- uint8_t grayLow;
-
- int m_lcd_control_address;
- mraa::I2c m_i2c_lcd_control;
-};
-}
diff --git a/peripheral/libupm/src/ldt0028/CMakeLists.txt b/peripheral/libupm/src/ldt0028/CMakeLists.txt
deleted file mode 100644
index e066e35..0000000
--- a/peripheral/libupm/src/ldt0028/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "ldt0028")
-set (libdescription "upm ldt0028")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/ldt0028/javaupm_ldt0028.i b/peripheral/libupm/src/ldt0028/javaupm_ldt0028.i
deleted file mode 100644
index 6407f5f..0000000
--- a/peripheral/libupm/src/ldt0028/javaupm_ldt0028.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_ldt0028
-%include "../upm.i"
-
-%{
- #include "ldt0028.h"
-%}
-
-%include "ldt0028.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_ldt0028");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/ldt0028/jsupm_ldt0028.i b/peripheral/libupm/src/ldt0028/jsupm_ldt0028.i
deleted file mode 100644
index 7682fb2..0000000
--- a/peripheral/libupm/src/ldt0028/jsupm_ldt0028.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_ldt0028
-%include "../upm.i"
-
-%{
- #include "ldt0028.h"
-%}
-
-%include "ldt0028.h"
diff --git a/peripheral/libupm/src/ldt0028/ldt0028.cxx b/peripheral/libupm/src/ldt0028/ldt0028.cxx
deleted file mode 100644
index c1c8445..0000000
--- a/peripheral/libupm/src/ldt0028/ldt0028.cxx
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Author: Sarah Knepper <sarah.knepper@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <string>
-#include <stdexcept>
-
-#include "ldt0028.h"
-
-using namespace upm;
-
-LDT0028::LDT0028(unsigned int pin) {
- // initialize analog input
- if ( !(m_pin = mraa_aio_init(pin)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_aio_init() failed, invalid pin?");
- return;
- }
- m_name = "ldt0-028";
-}
-
-LDT0028::~LDT0028() {
- // close analog input
- mraa_aio_close(m_pin);
-}
-
-std::string LDT0028::name() {
- return m_name;
-}
-
-int LDT0028::getSample() {
- return mraa_aio_read(m_pin);
-}
diff --git a/peripheral/libupm/src/ldt0028/ldt0028.h b/peripheral/libupm/src/ldt0028/ldt0028.h
deleted file mode 100644
index 532d47f..0000000
--- a/peripheral/libupm/src/ldt0028/ldt0028.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Author: Sarah Knepper <sarah.knepper@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include <mraa/aio.h>
-
-namespace upm {
-
-/**
- * @brief LDT0-028 Piezo Vibration Sensor library
- * @defgroup ldt0028 libupm-ldt0028
- * @ingroup seeed analog flexfor
- */
-
-/**
- * @library ldt0028
- * @sensor ldt0028
- * @comname LDT0-028 Piezo Vibration Sensor
- * @altname Grove Piezo Vibration Sensor
- * @type flexfor
- * @man seeed
- * @con analog
- *
- * @brief API for LDT0-028 PZT film-based sensors,
- * such as a Grove Piezo Vibration sensor
- *
- * This module defines the LDT0-028 interface for libupm-ldt0028
- *
- * @image html ldt0028.jpg
- * @snippet ldt0028.cxx Interesting
- */
-class LDT0028 {
- public:
- /**
- * LDT0028 constructor
- *
- * @param pin AIO pin where the sensor is connected
- */
- LDT0028(unsigned int pin);
-
- /**
- * LDT0028 destructor
- */
- ~LDT0028();
-
- /**
- * Returns the name of this sensor
- *
- * @return Name of this sensor
- */
- std::string name();
-
- /**
- * Returns one sample from this sensor
- *
- * @return One value from this sensor
- */
- int getSample();
-
- protected:
- std::string m_name; //!< name of this sensor
- mraa_aio_context m_pin; //!< AIO pin
-};
-
-}
diff --git a/peripheral/libupm/src/ldt0028/pyupm_ldt0028.i b/peripheral/libupm/src/ldt0028/pyupm_ldt0028.i
deleted file mode 100644
index 6760eed..0000000
--- a/peripheral/libupm/src/ldt0028/pyupm_ldt0028.i
+++ /dev/null
@@ -1,12 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_ldt0028
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "ldt0028.h"
-%{
- #include "ldt0028.h"
-%}
-
diff --git a/peripheral/libupm/src/lm35/CMakeLists.txt b/peripheral/libupm/src/lm35/CMakeLists.txt
deleted file mode 100644
index 54e41fa..0000000
--- a/peripheral/libupm/src/lm35/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "lm35")
-set (libdescription "upm DFRobot LM35 temperature sensor")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/lm35/javaupm_lm35.i b/peripheral/libupm/src/lm35/javaupm_lm35.i
deleted file mode 100644
index aafab80..0000000
--- a/peripheral/libupm/src/lm35/javaupm_lm35.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_lm35
-%include "../upm.i"
-
-%{
- #include "lm35.h"
-%}
-
-%include "lm35.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_lm35");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/lm35/jsupm_lm35.i b/peripheral/libupm/src/lm35/jsupm_lm35.i
deleted file mode 100644
index a0cb334..0000000
--- a/peripheral/libupm/src/lm35/jsupm_lm35.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_lm35
-%include "../upm.i"
-
-%{
- #include "lm35.h"
-%}
-
-%include "lm35.h"
diff --git a/peripheral/libupm/src/lm35/lm35.cxx b/peripheral/libupm/src/lm35/lm35.cxx
deleted file mode 100644
index 07509e8..0000000
--- a/peripheral/libupm/src/lm35/lm35.cxx
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include "lm35.h"
-
-using namespace std;
-using namespace upm;
-
-LM35::LM35(int pin, float aref) :
- m_aio(pin)
-{
- m_aRes = m_aio.getBit();
- m_aref = aref;
-}
-
-LM35::~LM35()
-{
-}
-
-float LM35::getTemperature()
-{
- int val = m_aio.read();
-
- // convert to mV
- float temp = (float(val) * (m_aref / float(1 << m_aRes))) * 1000.0;
-
- // 10mV/degree C
- return(temp / 10.0);
-}
diff --git a/peripheral/libupm/src/lm35/lm35.h b/peripheral/libupm/src/lm35/lm35.h
deleted file mode 100644
index 2bf6fba..0000000
--- a/peripheral/libupm/src/lm35/lm35.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <iostream>
-#include <string>
-#include <mraa/aio.hpp>
-
-namespace upm {
- /**
- * @brief DFRobot LM35 Linear Temperature Sensor
- * @defgroup lm35 libupm-lm35
- * @ingroup dfrobot analog temp
- */
-
- /**
- * @library lm35
- * @sensor lm35
- * @comname DFRobot LM35 Linear Temperature Sensor
- * @altname LM35
- * @type temp
- * @man dfrobot
- * @web http://www.dfrobot.com/index.php?route=product/product&product_id=76
- * @con analog
- *
- * @brief API for the DFRobot LM35 Linear Temperature Sensor
- *
- * This sensor returns an analog voltage proportional to the
- * temperature of the ambient environment.
- *
- * It has a range of 2C to 150C.
- *
- * This driver was developed using the DFRobot LM35 Linear
- * Temperature Sensor
- *
- * @image html lm35.jpg
- * @snippet lm35.cxx Interesting
- */
-
- class LM35 {
- public:
-
- /**
- * LM35 constructor
- *
- * @param pin Analog pin to use
- * @param aref Analog reference voltage; default is 5.0 V
- */
- LM35(int pin, float aref=5.0);
-
- /**
- * LM35 destructor
- */
- ~LM35();
-
- /**
- * Returns the temperature in degrees Celcius
- *
- * @return The Temperature in degrees Celcius
- */
- float getTemperature();
-
- protected:
- mraa::Aio m_aio;
-
- private:
- float m_aref;
- // ADC resolution
- int m_aRes;
- };
-}
-
-
diff --git a/peripheral/libupm/src/lm35/pyupm_lm35.i b/peripheral/libupm/src/lm35/pyupm_lm35.i
deleted file mode 100644
index 5a29a37..0000000
--- a/peripheral/libupm/src/lm35/pyupm_lm35.i
+++ /dev/null
@@ -1,11 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_lm35
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "lm35.h"
-%{
- #include "lm35.h"
-%}
diff --git a/peripheral/libupm/src/lol/CMakeLists.txt b/peripheral/libupm/src/lol/CMakeLists.txt
deleted file mode 100644
index d43c02b..0000000
--- a/peripheral/libupm/src/lol/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "lol")
-set (libdescription "LoL Olimex LoL rev A")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/lol/javaupm_lol.i b/peripheral/libupm/src/lol/javaupm_lol.i
deleted file mode 100644
index 6c1ceae..0000000
--- a/peripheral/libupm/src/lol/javaupm_lol.i
+++ /dev/null
@@ -1,36 +0,0 @@
-%module javaupm_lol
-%include "../upm.i"
-%include "stdint.i"
-%include "arrays_java.i";
-%include "typemaps.i"
-
-%typemap(jni) unsigned char* "jbyteArray";
-%typemap(jtype) unsigned char* "byte[]";
-%typemap(jstype) unsigned char* "byte[]";
-
-%typemap(javaout) unsigned char* {
- return $jnicall;
-}
-
-%typemap(out) unsigned char* {
- $result = JCALL1(NewByteArray, jenv, LOL_X*LOL_Y);
- JCALL4(SetByteArrayRegion, jenv, $result, 0, LOL_X*LOL_Y-1, reinterpret_cast<jbyte*>($1));
- delete [] $1;
-}
-
-%{
- #include "lol.h"
-%}
-
-%include "lol.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_lol");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/lol/jsupm_lol.i b/peripheral/libupm/src/lol/jsupm_lol.i
deleted file mode 100644
index 73659e8..0000000
--- a/peripheral/libupm/src/lol/jsupm_lol.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_lol
-%include "../upm.i"
-
-%{
- #include "lol.h"
-%}
-
-%include "lol.h"
diff --git a/peripheral/libupm/src/lol/lol.cxx b/peripheral/libupm/src/lol/lol.cxx
deleted file mode 100644
index aa712e6..0000000
--- a/peripheral/libupm/src/lol/lol.cxx
+++ /dev/null
@@ -1,189 +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.
- */
-
-#include <iostream>
-#include <string>
-#include <stdexcept>
-#include <unistd.h>
-#include <stdlib.h>
-#include <functional>
-#include <string.h>
-#include "lol.h"
-
-using namespace upm;
-
-static mraa_gpio_context *m_Ctx;
-static unsigned char *buffer;
-
-static mraa_gpio_context c1, c2, c3, c4;
-
-static int charlie_pairs [12][22] = {
-{3,124, 4,110, 5,96, 6,82, 7,68, 8,54, 9,40, 10,26, 11,12, -1,-1, -1,-1},
-{3,122, 4,108, 5,94, 6,80, 7,66, 8,52, 9,38, 10,24, 11,10, -1,-1, -1,-1},
-{3,120, 4,106, 5,92, 6,78, 7,64, 8,50, 9,36, 10,22, 11,8, -1,-1, -1,-1},
-{0,125, 1,123, 2,121, 4,98, 5,84, 6,70, 7,56, 8,42, 9,28, 10,14, 11,0},
-{0,111, 1,109, 2,107, 3,112, 5,85, 6,71, 7,57, 8,43, 9,29, 10,15, 11,1},
-{0,97, 1,95, 2,93, 3,113, 4,99, 6,72, 7,58, 8,44, 9,30, 10,16, 11,2},
-{0,83, 1,81, 2,79, 3,114, 4,100,5,86, 7,59, 8,45, 9,31, 10,17, 11,3},
-{0,69, 1,67, 2,65, 3,115, 4,101,5,87, 6,73, 8,46, 9,32, 10,18, 11,4},
-{0,55, 1,53, 2,51, 3,116, 4,102,5,88, 6,74, 7,60, 9,33, 10,19, 11,5},
-{0,41, 1,39, 2,37, 3,117, 4,103,5,89, 6,75, 7,61, 8,47, 10,20, 11,6},
-{0,27, 1,25, 2,23, 3,118, 4,104,5,90, 6,76, 7,62, 8,48, 9,34, 11,7},
-{0,13, 1,11, 2,9, 3,119, 4,105,5,91, 6,77, 7,63, 8,49, 9,35, 10,21}
-};
-
-void clear_gpio(int gpio)
-{
- mraa_gpio_mode(m_Ctx[gpio], MRAA_GPIO_HIZ);
- mraa_gpio_dir(m_Ctx[gpio], MRAA_GPIO_IN);
-}
-
-void clear_prev_cycle(int cycle)
-{
- int i;
-
- // What is prev cycle?
- cycle--;
- if (cycle == -1)
- cycle = 11;
-
- // Disable all "1"'s
- for (i = 0; i < 11; i++) {
- if (charlie_pairs[cycle][i*2] == -1)
- break;
- if(buffer[charlie_pairs[cycle][i*2 + 1]])
- clear_gpio(charlie_pairs[cycle][i*2]);
- }
-
-// Disable "0"
- clear_gpio(cycle);
-}
-
-void set_strong_one(int gpio)
-{
- mraa_gpio_dir(m_Ctx[gpio], MRAA_GPIO_OUT);
- mraa_gpio_mode(m_Ctx[gpio], MRAA_GPIO_STRONG);
- mraa_gpio_write(m_Ctx[gpio], 1);
-}
-
-void set_strong_zero(int gpio)
-{
- mraa_gpio_dir(m_Ctx[gpio], MRAA_GPIO_OUT);
- mraa_gpio_mode(m_Ctx[gpio], MRAA_GPIO_STRONG);
- mraa_gpio_write(m_Ctx[gpio], 0);
-}
-
-
-static void clear_gpios()
-{
- int i;
- for (i = 0; i < 12; i++)
- clear_gpio(i);
-}
-
-void *do_draw(void *arg)
-{
- clear_gpios();
-
- while (1) {
- int i, cur;
- uint8_t cycle = 0;
- // 12 Cycles of Matrix
- for (cycle = 0; cycle < 12; cycle++)
- {
- if (cycle == 12) cycle = 0;
-
- clear_prev_cycle(cycle);
- // set strong/0 on current cycle line
- set_strong_zero(cycle);
-
- // draw ones from framebuffer
- for (i = 0; i < 11; i++) {
- cur = charlie_pairs[cycle][i*2];
- if (cur == -1) break;
-
- if (buffer[charlie_pairs[cycle][i*2 + 1]]) {
- set_strong_one(cur);
-// printf("cycle %d %d %d %d\n", cycle, i, charlie_pairs[cycle][i*2 + 1],
-// buffer[charlie_pairs[cycle][i*2 + 1]]);
- }
- }
- }
-
- }
-}
-
-LoL::LoL() {
- int i = 0;
- mraa_result_t error;
- for (i = 0; i < 12; i++)
- {
- if ( !(m_LoLCtx[i] = mraa_gpio_init(i+2)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_gpio_init() failed, invalid pin?");
- return;
- }
-
- }
-
- memset(framebuffer, 0, LOL_X*LOL_Y);
-
- // I am optimistic and stupid - thread creation
- // always works in my world
- buffer = (unsigned char*)framebuffer;
- m_Ctx = m_LoLCtx;
- pthread_create (&drawer_thread, NULL, do_draw, NULL);
-}
-
-LoL::~LoL() {
- int i = 0;
- mraa_result_t error;
- for (i = 0; i < 12; i++)
- mraa_gpio_close(m_LoLCtx[i]);
-}
-
-unsigned char* LoL::getFramebuffer() {
- return framebuffer;
-}
-
-void LoL::setPixel(int x, int y, bool pixel)
-{
- if (x < 0 || y < 0 || x >= LOL_X || y >= LOL_Y)
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": pixel coordinates out of bounds");
-
- framebuffer[x + LOL_X*y] = (pixel) ? 1 : 0;
- return;
-}
-
-bool LoL::getPixel(int x, int y)
-{
- if (x < 0 || y < 0 || x >= LOL_X || y >= LOL_Y)
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": pixel coordinates out of bounds");
-
- return (framebuffer[x + LOL_X*y] == 0) ? false : true;
-}
-
diff --git a/peripheral/libupm/src/lol/lol.h b/peripheral/libupm/src/lol/lol.h
deleted file mode 100644
index a1ea32c..0000000
--- a/peripheral/libupm/src/lol/lol.h
+++ /dev/null
@@ -1,100 +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.
- */
-#pragma once
-
-#include <string>
-#include <mraa/gpio.h>
-#include <mraa/aio.h>
-#include <pthread.h>
-
-namespace upm {
-
-#define LOL_X 14
-#define LOL_Y 9
-
-/**
- * @brief Olimex LoL Array library
- * @defgroup lol libupm-lol
- * @ingroup adafruit gpio display
- */
-
-/**
- * @library lol
- * @sensor lol
- * @comname Olimex LoL Array
- * @type display
- * @man adafruit
- * @con gpio
- *
- * @brief API for the Olimex LoL array
- *
- * This module defines the LoL API and implementation for a simple framebuffer.
- *
- * @image html lolshield.jpg
- * @snippet lol-example.cxx Interesting
- */
-class LoL {
- public:
- /**
- * Instantiates an LoL object
- * singleton
- */
- LoL();
-
- /**
- * LoL object destructor
- */
- ~LoL();
-
- /**
- * Gets a framebuffer pointer
- * @return 0 if successful
- */
- unsigned char *getFramebuffer();
-
- /**
- * Gets a pixel at specified coordinates
- * @param x Coordinate x
- * @param y Coordinate y
- * @return true if the pixel is on, false if off
- * @throws std::invalid_argument if pixel is out of bounds
- */
- bool getPixel(int x, int y);
-
- /**
- * Sets a pixel at specified coordinates
- * @param x Coordinate x
- * @param y Coordinate y
- * @param pixel false is off, true is on
- * @throws std::invalid_argument if pixel is out of bounds
- */
- void setPixel(int x, int y, bool pixel);
-
- private:
- mraa_gpio_context m_LoLCtx[14];
- unsigned char framebuffer[LOL_X*LOL_Y];
- pthread_t drawer_thread;
-};
-};
-
diff --git a/peripheral/libupm/src/lol/pyupm_lol.i b/peripheral/libupm/src/lol/pyupm_lol.i
deleted file mode 100644
index aedf997..0000000
--- a/peripheral/libupm/src/lol/pyupm_lol.i
+++ /dev/null
@@ -1,13 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_lol
-%include "../upm.i"
-
-%include "stdint.i"
-
-%feature("autodoc", "3");
-
-%include "lol.h"
-%{
- #include "lol.h"
-%}
diff --git a/peripheral/libupm/src/loudness/CMakeLists.txt b/peripheral/libupm/src/loudness/CMakeLists.txt
deleted file mode 100644
index 49e6af6..0000000
--- a/peripheral/libupm/src/loudness/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "loudness")
-set (libdescription "upm loudness sensors")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/loudness/javaupm_loudness.i b/peripheral/libupm/src/loudness/javaupm_loudness.i
deleted file mode 100644
index 5818ee7..0000000
--- a/peripheral/libupm/src/loudness/javaupm_loudness.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_loudness
-%include "../upm.i"
-
-%{
- #include "loudness.h"
-%}
-
-%include "loudness.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_loudness");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/loudness/jsupm_loudness.i b/peripheral/libupm/src/loudness/jsupm_loudness.i
deleted file mode 100644
index 5a3ed4f..0000000
--- a/peripheral/libupm/src/loudness/jsupm_loudness.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_loudness
-%include "../upm.i"
-
-%{
- #include "loudness.h"
-%}
-
-%include "loudness.h"
diff --git a/peripheral/libupm/src/loudness/loudness.cxx b/peripheral/libupm/src/loudness/loudness.cxx
deleted file mode 100644
index d16610f..0000000
--- a/peripheral/libupm/src/loudness/loudness.cxx
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-
-#include "loudness.h"
-
-using namespace std;
-using namespace upm;
-
-Loudness::Loudness(int pin, float aref) :
- m_aio(pin)
-{
- m_aRes = m_aio.getBit();
- m_aref = aref;
-}
-
-Loudness::~Loudness()
-{
-}
-
-float Loudness::loudness()
-{
- int val = m_aio.read();
-
- return(val * (m_aref / float(1 << m_aRes)));
-}
diff --git a/peripheral/libupm/src/loudness/loudness.h b/peripheral/libupm/src/loudness/loudness.h
deleted file mode 100644
index 526eaf2..0000000
--- a/peripheral/libupm/src/loudness/loudness.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <iostream>
-#include <string>
-#include <mraa/aio.hpp>
-
-namespace upm {
- /**
- * @brief Generic loudness sensors
- * @defgroup loudness libupm-loudness
- * @ingroup dfrobot seeed analog sound
- */
-
- /**
- * @library loudness
- * @sensor loudness
- * @comname Loudness Sensor
- * @altname Grove loudness hyld9767
- * @type sound
- * @man dfrobot seeed
- * @web http://www.dfrobot.com/index.php?route=product/product&product_id=83
- * @con analog
- *
- * @brief API for the Loudness Sensor
- *
- * This sensor family returns an analog voltage proportional to the
- * loudness of the ambient environment. It's output does not
- * correspond to a particular sound level in decibels. The higher
- * the output voltage, the louder the ambient noise level.
- *
- * This device uses an electret microphone for sound input.
- *
- * This driver was developed using the DFRobot Loudness Sensor V2
- * and the Grove Loudness sensor.
- *
- * @image html groveloudness.jpg
- * @snippet loudness.cxx Interesting
- */
-
- class Loudness {
- public:
-
- /**
- * Loudness constructor
- *
- * @param pin Analog pin to use
- * @param aref Analog reference voltage; default is 5.0 V
- */
- Loudness(int pin, float aref=5.0);
-
- /**
- * Loudness destructor
- */
- ~Loudness();
-
- /**
- * Returns the voltage detected on the analog pin
- *
- * @return The detected voltage
- */
- float loudness();
-
- protected:
- mraa::Aio m_aio;
-
- private:
- float m_aref;
- // ADC resolution
- int m_aRes;
- };
-}
-
-
diff --git a/peripheral/libupm/src/loudness/pyupm_loudness.i b/peripheral/libupm/src/loudness/pyupm_loudness.i
deleted file mode 100644
index 4fc9c8d..0000000
--- a/peripheral/libupm/src/loudness/pyupm_loudness.i
+++ /dev/null
@@ -1,11 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_loudness
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "loudness.h"
-%{
- #include "loudness.h"
-%}
diff --git a/peripheral/libupm/src/lpd8806/.DS_Store b/peripheral/libupm/src/lpd8806/.DS_Store
deleted file mode 100644
index 095d5c9..0000000
--- a/peripheral/libupm/src/lpd8806/.DS_Store
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/src/lpd8806/._.DS_Store b/peripheral/libupm/src/lpd8806/._.DS_Store
deleted file mode 100644
index 16d5ab2..0000000
--- a/peripheral/libupm/src/lpd8806/._.DS_Store
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/src/lpd8806/._CMakeLists.txt b/peripheral/libupm/src/lpd8806/._CMakeLists.txt
deleted file mode 100644
index 2802dda..0000000
--- a/peripheral/libupm/src/lpd8806/._CMakeLists.txt
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/src/lpd8806/._jsupm_lpd8806.i b/peripheral/libupm/src/lpd8806/._jsupm_lpd8806.i
deleted file mode 100644
index 59e6f40..0000000
--- a/peripheral/libupm/src/lpd8806/._jsupm_lpd8806.i
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/src/lpd8806/._pyupm_lpd8806.i b/peripheral/libupm/src/lpd8806/._pyupm_lpd8806.i
deleted file mode 100644
index b4ee648..0000000
--- a/peripheral/libupm/src/lpd8806/._pyupm_lpd8806.i
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/src/lpd8806/CMakeLists.txt b/peripheral/libupm/src/lpd8806/CMakeLists.txt
deleted file mode 100644
index 146ce83..0000000
--- a/peripheral/libupm/src/lpd8806/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "lpd8806")
-set (libdescription “Digital RGB LED strip”)
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/lpd8806/javaupm_lpd8806.i b/peripheral/libupm/src/lpd8806/javaupm_lpd8806.i
deleted file mode 100644
index 5de138a..0000000
--- a/peripheral/libupm/src/lpd8806/javaupm_lpd8806.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_lpd8806
-%include "../upm.i"
-
-%{
- #include "lpd8806.h"
-%}
-
-%include "lpd8806.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_lpd8806");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/lpd8806/jsupm_lpd8806.i b/peripheral/libupm/src/lpd8806/jsupm_lpd8806.i
deleted file mode 100644
index 279c8fe..0000000
--- a/peripheral/libupm/src/lpd8806/jsupm_lpd8806.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_lpd8806
-%include "../upm.i"
-
-%{
- #include "lpd8806.h"
-%}
-
-%include "lpd8806.h"
diff --git a/peripheral/libupm/src/lpd8806/lpd8806.cxx b/peripheral/libupm/src/lpd8806/lpd8806.cxx
deleted file mode 100644
index 40c1e82..0000000
--- a/peripheral/libupm/src/lpd8806/lpd8806.cxx
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <unistd.h>
-#include <stdlib.h>
-#include <cstring>
-#include <stdexcept>
-
-#include "lpd8806.h"
-
-using namespace upm;
-
-LPD8806::LPD8806 (uint16_t pixelCount, uint8_t csn) : m_csnPinCtx(csn), m_spi(0) {
- mraa::Result error = mraa::SUCCESS;
- m_name = "LPD8806";
-
- m_pixels = NULL;
-
- error = m_csnPinCtx.dir (mraa::DIR_OUT);
- if (error != mraa::SUCCESS) {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": GPIO failed to set direction");
- }
-
- CSOff ();
-
- // set spi mode to mode2 (CPOL = 0, CPHA = 0)
- m_spi.mode (mraa::SPI_MODE0);
-
- CSOn ();
- // issue initial latch/reset to strip:
- for (uint16_t i = ((pixelCount + 31) / 32); i > 0; i--) {
- m_spi.writeByte (0);
- }
- CSOff ();
-
- m_pixelsCount = pixelCount;
-
- uint8_t latchBytes;
- uint16_t dataBytes, totalBytes;
- uint16_t numBytes = 0;
-
- dataBytes = m_pixelsCount * 3;
- latchBytes = (m_pixelsCount + 31) / 32;
- totalBytes = dataBytes + latchBytes;
- if ((m_pixels = (uint8_t *) malloc(totalBytes))) {
- numBytes = totalBytes;
- memset ( m_pixels , 0x80, dataBytes); // Init to RGB 'off' state
- memset (&m_pixels[dataBytes], 0 , latchBytes); // Clear latch bytes
- }
-}
-
-LPD8806::~LPD8806() {
- if (m_pixels) {
- free(m_pixels);
- }
-}
-
-void
-LPD8806::setPixelColor (uint16_t pixelOffset, uint8_t r, uint8_t g, uint8_t b) {
- if (pixelOffset < m_pixelsCount) { // Arrays are 0-indexed, thus NOT '<='
- uint8_t *ptr = &m_pixels[pixelOffset * 3];
- *ptr++ = g | 0x80; // Strip color order is GRB,
- *ptr++ = r | 0x80; // not the more common RGB,
- *ptr++ = b | 0x80; // so the order here is intentional; don't "fix"
- }
-}
-
-void
-LPD8806::show (void) {
- uint8_t *ptr = m_pixels;
- uint16_t byte = (m_pixelsCount * 3) + ((m_pixelsCount + 31) / 32);
-
- while (byte--) {
- m_spi.writeByte (*ptr++);
- }
-}
-
-uint16_t
-LPD8806::getStripLength (void) {
- return m_pixelsCount;
-}
-
-/*
- * **************
- * private area
- * **************
- */
-
-mraa::Result
-LPD8806::CSOn () {
- return m_csnPinCtx.write (HIGH);
-}
-
-mraa::Result
-LPD8806::CSOff () {
- return m_csnPinCtx.write (LOW);
-}
diff --git a/peripheral/libupm/src/lpd8806/lpd8806.h b/peripheral/libupm/src/lpd8806/lpd8806.h
deleted file mode 100644
index cc8f7e4..0000000
--- a/peripheral/libupm/src/lpd8806/lpd8806.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include <mraa/aio.hpp>
-
-#include <mraa/gpio.hpp>
-
-#include <mraa/spi.hpp>
-
-#define HIGH 1
-#define LOW 0
-
-namespace upm {
-
-/**
- * @brief FastPixel LPD8806 library
- * @defgroup lpd8806 libupm-lpd8806
- * @ingroup adafruit spi led
- */
-
-/**
- * @library lpd8806
- * @sensor lpd8806
- * @comname LPD8806 RGB LED Strip Controller
- * @type led
- * @man adafruit
- * @con spi
- *
- * @brief API for the LPD8806 RGB LED Strip Controller
- *
- * FastPixel* LPD8806 is an RGB LED strip controller.
- *
- * @image html lpd8806.jpg
- * @snippet lpd8806.cxx Interesting
- */
-class LPD8806 {
- public:
-
- /**
- * Instantiates an LPD8806 object
- *
- * @param pixelCount Number of pixels in the strip
- * @param csn Chip select pin
- */
- LPD8806 (uint16_t pixelCount, uint8_t csn);
-
- /**
- * LPD8806 object destructor; basically, it frees the allocated
- * pixel buffer.
- */
- ~LPD8806 ();
-
- /**
- * @param pixelOffset Pixel offset in the strip of the pixel
- * @param r Red LED
- * @param g Green LED
- * @param b Blue LED
- */
- void setPixelColor (uint16_t pixelOffset, uint8_t r, uint8_t g, uint8_t b);
-
- /**
- * Writes the data stored in the array of pixels to the chip
- */
- void show (void);
-
- /**
- * Returns the length of the LED strip
- */
- uint16_t getStripLength (void);
-
- /**
- * Returns the name of the component
- */
- std::string name()
- {
- return m_name;
- }
- private:
- std::string m_name;
- mraa::Spi m_spi;
- mraa::Gpio m_csnPinCtx;
-
- uint8_t* m_pixels;
- uint8_t m_pixelsCount;
-
- uint8_t readRegister (uint8_t reg);
- void writeRegister (uint8_t reg, uint8_t data);
-
- /**
- * Sets the chip select pin to LOW
- */
- mraa::Result CSOn ();
-
- /**
- * Sets the chip select pin to HIGH
- */
- mraa::Result CSOff ();
-};
-
-}
diff --git a/peripheral/libupm/src/lpd8806/pyupm_lpd8806.i b/peripheral/libupm/src/lpd8806/pyupm_lpd8806.i
deleted file mode 100644
index ee8db84..0000000
--- a/peripheral/libupm/src/lpd8806/pyupm_lpd8806.i
+++ /dev/null
@@ -1,11 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_lpd8806
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "lpd8806.h"
-%{
- #include "lpd8806.h"
-%}
diff --git a/peripheral/libupm/src/lsm303/CMakeLists.txt b/peripheral/libupm/src/lsm303/CMakeLists.txt
deleted file mode 100644
index d97e58b..0000000
--- a/peripheral/libupm/src/lsm303/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "lsm303")
-set (libdescription "upm lsm303")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/lsm303/javaupm_lsm303.i b/peripheral/libupm/src/lsm303/javaupm_lsm303.i
deleted file mode 100644
index 961c74f..0000000
--- a/peripheral/libupm/src/lsm303/javaupm_lsm303.i
+++ /dev/null
@@ -1,32 +0,0 @@
-%module javaupm_lsm303
-%include "../upm.i"
-
-%{
- #include "lsm303.h"
-%}
-
-%typemap(jni) int16_t* "jshortArray"
-%typemap(jstype) int16_t* "short[]"
-%typemap(jtype) int16_t* "short[]"
-
-%typemap(javaout) int16_t* {
- return $jnicall;
-}
-
-%typemap(out) int16_t *getRawAccelData {
- $result = JCALL1(NewShortArray, jenv, 3);
- JCALL4(SetShortArrayRegion, jenv, $result, 0, 3, (jshort*)$1);
-}
-
-%include "lsm303.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_lsm303");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/lsm303/jsupm_lsm303.i b/peripheral/libupm/src/lsm303/jsupm_lsm303.i
deleted file mode 100644
index f6f65cf..0000000
--- a/peripheral/libupm/src/lsm303/jsupm_lsm303.i
+++ /dev/null
@@ -1,15 +0,0 @@
-%module jsupm_lsm303
-%include "../upm.i"
-%include "../carrays_int16_t.i"
-
-// Adding this typemap because SWIG is converting int16 into a short by default
-// This forces SWIG to convert it correctly
-%typemap(out) int16_t* {
- jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_int16Array, 0 | 0 );
-}
-
-%{
- #include "lsm303.h"
-%}
-
-%include "lsm303.h"
diff --git a/peripheral/libupm/src/lsm303/lsm303.cxx b/peripheral/libupm/src/lsm303/lsm303.cxx
deleted file mode 100644
index 87d4afe..0000000
--- a/peripheral/libupm/src/lsm303/lsm303.cxx
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * Author: Brendan Le Foll <brendan.le.foll@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Code based on LSM303DLH sample by Jim Lindblom SparkFun Electronics
- * and the CompensatedCompass.ino by Frankie Chu from SeedStudio
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <string>
-#include <stdexcept>
-#include <unistd.h>
-#include <stdlib.h>
-
-#include "lsm303.h"
-
-using namespace upm;
-
-LSM303::LSM303(int bus, int addrMag, int addrAcc, int accScale) : m_i2c(bus)
-{
- m_addrMag = addrMag;
- m_addrAcc = addrAcc;
-
- // 0x27 is the 'normal' mode with X/Y/Z enable
- setRegisterSafe(m_addrAcc, CTRL_REG1_A, 0x27);
-
- // scale can be 2, 4 or 8
- if (2 == accScale) {
- setRegisterSafe(m_addrAcc, CTRL_REG4_A, 0x00);
- } else if (4 == accScale) {
- setRegisterSafe(m_addrAcc, CTRL_REG4_A, 0x10);
- } else { // default; equivalent to 8g
- setRegisterSafe(m_addrAcc, CTRL_REG4_A, 0x30);
- }
-
- // 0x10 = minimum datarate ~15Hz output rate
- setRegisterSafe(m_addrMag, CRA_REG_M, 0x10);
-
- // magnetic scale = +/-1.3
- // Gaussmagnetic scale = +/-1.3Gauss (0x20)
- // +-8.1Gauss (0xe0)
- setRegisterSafe(m_addrMag, CRB_REG_M, 0xe0);
-
- // 0x00 = continouous conversion mode
- setRegisterSafe(m_addrMag, MR_REG_M, 0x00);
-}
-
-float
-LSM303::getHeading()
-{
- if (getCoordinates() != mraa::SUCCESS) {
- return -1;
- }
-
- float heading = 180.0 * atan2(double(coor[Y]), double(coor[X]))/M_PI;
-
- if (heading < 0.0)
- heading += 360.0;
-
- return heading;
-}
-
-int16_t*
-LSM303::getRawAccelData()
-{
- return &accel[0];
-}
-
-int16_t*
-LSM303::getRawCoorData()
-{
- return &coor[0];
-}
-
-int16_t
-LSM303::getAccelX()
-{
- return accel[X];
-}
-
-int16_t
-LSM303::getAccelY()
-{
- return accel[Y];
-}
-
-int16_t
-LSM303::getAccelZ()
-{
- return accel[Z];
-}
-
-mraa::Result
-LSM303::getCoordinates()
-{
- mraa::Result ret = mraa::SUCCESS;
-
- memset(&buf[0], 0, sizeof(uint8_t)*6);
- ret = m_i2c.address(m_addrMag);
- ret = m_i2c.writeByte(OUT_X_H_M);
- ret = m_i2c.address(m_addrMag);
- int num = m_i2c.read(buf, 6);
- if (num != 6) {
- return ret;
- }
- // convert to coordinates
- for (int i=0; i<3; i++) {
- coor[i] = (int16_t(buf[2*i] << 8))
- | int16_t(buf[(2*i)+1]);
- }
- // swap elements 1 and 2 to get things in natural XYZ order
- int16_t t = coor[2];
- coor[2] = coor[1];
- coor[1] = t;
- //printf("X=%x, Y=%x, Z=%x\n", coor[X], coor[Y], coor[Z]);
-
- return ret;
-}
-
-int16_t
-LSM303::getCoorX() {
- return coor[X];
-}
-
-int16_t
-LSM303::getCoorY() {
- return coor[Y];
-}
-
-int16_t
-LSM303::getCoorZ() {
- return coor[Z];
-}
-
-// helper function that writes a value to the acc and then reads
-// FIX: shouldn't this be write-then-read?
-int
-LSM303::readThenWrite(uint8_t reg)
-{
- m_i2c.address(m_addrAcc);
- m_i2c.writeByte(reg);
- m_i2c.address(m_addrAcc);
- return (int) m_i2c.readByte();
-}
-
-mraa::Result
-LSM303::getAcceleration()
-{
- mraa::Result ret = mraa::SUCCESS;
-
- accel[X] = (int16_t(readThenWrite(OUT_X_H_A)) << 8)
- | int16_t(readThenWrite(OUT_X_L_A));
- accel[Y] = (int16_t(readThenWrite(OUT_Y_H_A)) << 8)
- | int16_t(readThenWrite(OUT_Y_L_A));
- accel[Z] = (int16_t(readThenWrite(OUT_Z_H_A)) << 8)
- | int16_t(readThenWrite(OUT_Z_L_A));
- //printf("X=%x, Y=%x, Z=%x\n", accel[X], accel[Y], accel[Z]);
-
- return ret;
-}
-
-// helper function that sets a register and then checks the set was succesful
-mraa::Result
-LSM303::setRegisterSafe(uint8_t slave, uint8_t sregister, uint8_t data)
-{
- buf[0] = sregister;
- buf[1] = data;
-
- if (m_i2c.address(slave) != mraa::SUCCESS) {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_i2c_address() failed");
- return mraa::ERROR_INVALID_HANDLE;
- }
- if (m_i2c.write(buf, 2) != mraa::SUCCESS) {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_i2c_write() failed");
- return mraa::ERROR_INVALID_HANDLE;
- }
- uint8_t val = m_i2c.readReg(sregister);
- if (val != data) {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": failed to set register correctly");
- return mraa::ERROR_UNSPECIFIED;
- }
- return mraa::SUCCESS;
-}
diff --git a/peripheral/libupm/src/lsm303/lsm303.h b/peripheral/libupm/src/lsm303/lsm303.h
deleted file mode 100644
index 767d547..0000000
--- a/peripheral/libupm/src/lsm303/lsm303.h
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * Author: Brendan Le Foll<brendan.le.foll@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Code based on LSM303DLH sample by Jim Lindblom SparkFun Electronics
- * and the CompensatedCompass.ino by Frankie Chu from SeedStudio
- *
- * 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 <string.h>
-#include <mraa/i2c.hpp>
-#include <math.h>
-
-namespace upm {
-
-/* LSM303 Address definitions */
-#define LSM303_MAG 0x1E
-#define LSM303_ACC 0x19
-
-/* LSM303 Register definitions */
-#define CTRL_REG1_A 0x20
-#define CTRL_REG2_A 0x21
-#define CTRL_REG3_A 0x22
-#define CTRL_REG4_A 0x23
-#define CTRL_REG5_A 0x24
-
-#define CRA_REG_M 0x00
-#define CRB_REG_M 0x01
-
-#define MR_REG_M 0x02
-#define OUT_X_H_M 0x03
-
-#define OUT_X_L_A 0x28
-#define OUT_X_H_A 0x29
-#define OUT_Y_L_A 0x2A
-#define OUT_Y_H_A 0x2B
-#define OUT_Z_L_A 0x2C
-#define OUT_Z_H_A 0x2D
-
-#define X 0
-#define Y 1
-#define Z 2
-
-/**
- * @brief LSM303 Accelerometer/Compass library
- * @defgroup lsm303 libupm-lsm303
- * @ingroup seeed adafruit i2c accelerometer compass
- */
-
-/**
- * @library lsm303
- * @sensor lsm303
- * @comname LSM303 Accelerometer & Compass
- * @altname Grove 6-Axis Accelerometer & Compass
- * @type accelerometer compass
- * @man seeed adafruit
- * @web http://www.seeedstudio.com/wiki/Grove_-_6-Axis_Accelerometer%26Compass
- * @con i2c
- *
- * @brief API for the LSM303 Accelerometer & Compass
- *
- * This module defines the LSM303DLH 3-axis magnetometer/3-axis accelerometer.
- * This module was tested with the Seeed Studio* Grove 6-Axis Accelerometer & Compass
- * module used over I2C. The magnometer and acceleromter are accessed
- * at two seperate I2C addresses.
- *
- * @image html lsm303.jpeg
- * @snippet lsm303.cxx Interesting
- */
-class LSM303 {
- public:
- /**
- * Instantiates an LSM303 object
- *
- * @param i2c bus
- * @param addr Magnetometer
- * @param addr Accelerometer
- */
- LSM303 (int bus,
- int addrMag=LSM303_MAG,
- int addrAcc=LSM303_ACC,
- int accScale=8);
-
- /**
- * LSM303 object destructor
- * where is no more need for this here - I2c connection will be stopped
- * automatically when m_i2c variable will go out of scope
- * ~LSM303 ();
- **/
-
- /**
- * Gets the current heading; headings <0 indicate an error has occurred
- *
- * @return float
- */
- float getHeading();
-
- /**
- * Gets the coordinates in the XYZ order
- */
- mraa::Result getCoordinates();
-
- /**
- * Gets accelerometer values
- * Should be called before other "get" functions for acceleration
- */
- mraa::Result getAcceleration();
-
- /**
- * Gets raw coordinate data; it is updated when getCoordinates() is called
- */
- int16_t* getRawCoorData();
-
- /**
- * Gets the X component of the coordinates data
- */
- int16_t getCoorX();
-
- /**
- * Gets the Y component of the coordinates data
- */
- int16_t getCoorY();
-
- /**
- * Gets the Z component of the coordinates data
- */
- int16_t getCoorZ();
-
- /**
- * Gets raw accelerometer data; it is updated when getAcceleration() is called
- */
- int16_t* getRawAccelData();
-
- /**
- * Gets the X component of the acceleration data
- */
- int16_t getAccelX();
-
- /**
- * Gets the Y component of the acceleration data
- */
- int16_t getAccelY();
-
- /**
- * Gets the Z component of the acceleration data
- */
- int16_t getAccelZ();
-
- private:
- int readThenWrite(uint8_t reg);
- mraa::Result setRegisterSafe(uint8_t slave, uint8_t sregister, uint8_t data);
-
- mraa::I2c m_i2c;
- int m_addrMag;
- int m_addrAcc;
- uint8_t buf[6];
- int16_t coor[3];
- int16_t accel[3];
-};
-
-}
diff --git a/peripheral/libupm/src/lsm303/pyupm_lsm303.i b/peripheral/libupm/src/lsm303/pyupm_lsm303.i
deleted file mode 100644
index b32d25e..0000000
--- a/peripheral/libupm/src/lsm303/pyupm_lsm303.i
+++ /dev/null
@@ -1,18 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_lsm303
-%include "../upm.i"
-%include "../carrays_int16_t.i"
-
-%feature("autodoc", "3");
-
-// Adding this typemap because SWIG is converting int16 into a short by default
-// This forces SWIG to convert it correctly
-%typemap(out) int16_t* {
- resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_int16Array, 0 | 0 );
-}
-
-%include "lsm303.h"
-%{
- #include "lsm303.h"
-%}
diff --git a/peripheral/libupm/src/lsm303d/CMakeLists.txt b/peripheral/libupm/src/lsm303d/CMakeLists.txt
deleted file mode 100644
index 7a7a58f..0000000
--- a/peripheral/libupm/src/lsm303d/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "lsm303d")
-set (libdescription "upm lsm303d")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/lsm303d/javaupm_lsm303d.i b/peripheral/libupm/src/lsm303d/javaupm_lsm303d.i
deleted file mode 100644
index 7d938b8..0000000
--- a/peripheral/libupm/src/lsm303d/javaupm_lsm303d.i
+++ /dev/null
@@ -1,22 +0,0 @@
-%module javaupm_lsm303d
-%include "../upm.i"
-
-%{
- #include "lsm303d.h"
-%}
-
-%typemap(jni) int16_t* "jintArray"
-%typemap(jstype) int16_t* "int[]"
-%typemap(jtype) int16_t* "int[]"
-
-%typemap(javaout) int16_t* {
- return $jnicall;
-}
-
-%typemap(out) int16_t *getRawAccelData {
- $result = JCALL1(NewIntArray, jenv, 3);
- JCALL4(SetIntArrayRegion, jenv, $result, 0, 3, (const signed int*)$1);
- //delete [] $1;
-}
-
-%include "lsm303d.h"
diff --git a/peripheral/libupm/src/lsm303d/jsupm_lsm303d.i b/peripheral/libupm/src/lsm303d/jsupm_lsm303d.i
deleted file mode 100644
index cfdb1d1..0000000
--- a/peripheral/libupm/src/lsm303d/jsupm_lsm303d.i
+++ /dev/null
@@ -1,15 +0,0 @@
-%module jsupm_lsm303d
-%include "../upm.i"
-%include "../carrays_int16_t.i"
-
-// Adding this typemap because SWIG is converting int16 into a short by default
-// This forces SWIG to convert it correctly
-%typemap(out) int16_t* {
- jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_int16Array, 0 | 0 );
-}
-
-%{
- #include "lsm303d.h"
-%}
-
-%include "lsm303d.h"
diff --git a/peripheral/libupm/src/lsm303d/lsm303d.cxx b/peripheral/libupm/src/lsm303d/lsm303d.cxx
deleted file mode 100644
index ba9e303..0000000
--- a/peripheral/libupm/src/lsm303d/lsm303d.cxx
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
- * Author: Brendan Le Foll <brendan.le.foll@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Code based on LSM303DLH sample by Jim Lindblom SparkFun Electronics
- * and the CompensatedCompass.ino by Frankie Chu from SeedStudio
- *
- * Further modifications to port to the LSM303d by <bruce.j.beare@intel.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <string>
-#include <stdexcept>
-#include <unistd.h>
-#include <stdlib.h>
-
-#include "lsm303d.h"
-
-using namespace upm;
-
-LSM303d::LSM303d(int bus, int addr, int accScale) : m_i2c(bus)
-{
- m_addr = addr;
-
- uint8_t afs_bits = 0; // LM303D_SCALE_2G - see the data sheet
- const uint8_t abw_bits = 3; // 50hz Anti-alias filter bandwidth - see the data sheet
-
- // 0x27 is the 'normal' mode with X/Y/Z enable
- // Data is available at 100HZ.
- // See the data sheet for higher data rates.
- setRegisterSafe(m_addr, CTRL_REG1, 0x67);
-
- // scale can be 2, 4 or 8
- switch (accScale) {
- case LM303D_SCALE_2G:
- afs_bits = 0;
- break;
- case LM303D_SCALE_4G:
- afs_bits = 1;
- break;
- case LM303D_SCALE_6G:
- afs_bits = 2;
- break;
- case LM303D_SCALE_8G:
- afs_bits = 3;
- break;
- case LM303D_SCALE_16G:
- afs_bits = 4;
- break;
- default:
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": failed to specify scaling correctly");
- break;
- }
- setRegisterSafe(m_addr, CTRL_REG2, (abw_bits<<6)|(afs_bits<<3));
-
- // Enable Mag.
- const uint8_t mag_resolution_bits = 3 << 5; // high resolution
- const uint8_t mag_data_rate_bits = 4 << 2; // 50 hz
- const uint8_t mag_sensor_mode = 0; // continuous conversion
-
- setRegisterSafe(m_addr, CTRL_REG5, mag_resolution_bits|mag_data_rate_bits);
- setRegisterSafe(m_addr, CTRL_REG7, mag_sensor_mode);
-}
-
-float
-LSM303d::getHeading()
-{
- if (getCoordinates() != mraa::SUCCESS) {
- return -1.0;
- }
-
- float heading = 180.0 * atan2(double(coor[Y]), double(coor[X]))/M_PI;
-
- if (heading < 0.0)
- heading += 360.0;
-
- return heading;
-}
-
-int16_t*
-LSM303d::getRawAccelData()
-{
- return &accel[0];
-}
-
-int16_t*
-LSM303d::getRawCoorData()
-{
- return &coor[0];
-}
-
-int16_t
-LSM303d::getAccelX()
-{
- return accel[X];
-}
-
-int16_t
-LSM303d::getAccelY()
-{
- return accel[Y];
-}
-
-int16_t
-LSM303d::getAccelZ()
-{
- return accel[Z];
-}
-
-mraa::Result
-LSM303d::getCoordinates()
-{
- mraa::Result ret = mraa::SUCCESS;
- uint8_t status = writeThenRead(STATUS_M);
-
- coor[X] = (int16_t(writeThenRead(OUT_X_H_M)) << 8)
- | int16_t(writeThenRead(OUT_X_L_M));
- coor[Y] = (int16_t(writeThenRead(OUT_Y_H_M)) << 8)
- | int16_t(writeThenRead(OUT_Y_L_M));
- coor[Z] = (int16_t(writeThenRead(OUT_Z_H_M)) << 8)
- | int16_t(writeThenRead(OUT_Z_L_M));
- //printf("status=0x%x, X=%d, Y=%d, Z=%d\n", status, coor[X], coor[Y], coor[Z]);
-
- return ret;
-}
-
-
-int16_t
-LSM303d::getCoorX() {
- return coor[X];
-}
-
-int16_t
-LSM303d::getCoorY() {
- return coor[Y];
-}
-
-int16_t
-LSM303d::getCoorZ() {
- return coor[Z];
-}
-
-// helper function that writes a value to the acc and then reads
-int
-LSM303d::writeThenRead(uint8_t reg)
-{
- m_i2c.address(m_addr);
- m_i2c.writeByte(reg);
- m_i2c.address(m_addr);
- return (int) m_i2c.readByte();
-}
-
-mraa::Result
-LSM303d::getAcceleration()
-{
- mraa::Result ret = mraa::SUCCESS;
-
- accel[X] = (int16_t(writeThenRead(OUT_X_H_A)) << 8)
- | int16_t(writeThenRead(OUT_X_L_A));
- accel[Y] = (int16_t(writeThenRead(OUT_Y_H_A)) << 8)
- | int16_t(writeThenRead(OUT_Y_L_A));
- accel[Z] = (int16_t(writeThenRead(OUT_Z_H_A)) << 8)
- | int16_t(writeThenRead(OUT_Z_L_A));
- //printf("X=%x, Y=%x, Z=%x\n", accel[X], accel[Y], accel[Z]);
-
- return ret;
-}
-
-// helper function that sets a register and then checks the set was succesful
-mraa::Result
-LSM303d::setRegisterSafe(uint8_t slave, uint8_t sregister, uint8_t data)
-{
- buf[0] = sregister;
- buf[1] = data;
-
- if (m_i2c.address(slave) != mraa::SUCCESS) {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_i2c_address() failed");
- return mraa::ERROR_INVALID_HANDLE;
- }
- if (m_i2c.write(buf, 2) != mraa::SUCCESS) {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_i2c_write() failed");
- return mraa::ERROR_INVALID_HANDLE;
- }
- uint8_t val = m_i2c.readReg(sregister);
- if (val != data) {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": failed to set register correctly");
- return mraa::ERROR_UNSPECIFIED;
- }
- return mraa::SUCCESS;
-}
diff --git a/peripheral/libupm/src/lsm303d/lsm303d.h b/peripheral/libupm/src/lsm303d/lsm303d.h
deleted file mode 100644
index 79d3204..0000000
--- a/peripheral/libupm/src/lsm303d/lsm303d.h
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * Author: Brendan Le Foll<brendan.le.foll@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Code based on LSM303DLH sample by Jim Lindblom SparkFun Electronics
- * and the CompensatedCompass.ino by Frankie Chu from SeedStudio
- *
- * Further modifications to port to the LSM303d by <bruce.j.beare@intel.com>
- *
- * 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 <string.h>
-#include <mraa/i2c.hpp>
-#include <math.h>
-
-namespace upm {
-/**
- * @brief LSM303d Accelerometer/Compass library
- * @defgroup lsm303d libupm-lsm303d
- * @ingroup seeed adafruit i2c accelerometer compass
- */
-
-/**
- * @library lsm303d
- * @sensor lsm303d
- * @comname LSM303d Accelerometer & Compass
- * @altname Grove 6-Axis Accelerometer & Compass
- * @type accelerometer compass
- * @man seeed adafruit
- * @web http://www.seeedstudio.com/wiki/Grove_-_6-Axis_Accelerometer%26Compass
- * @con i2c
- *
- * @brief API for the LSM303d Accelerometer & Compass
- *
- * This module defines the LSM303d 3-axis magnetometer/3-axis accelerometer.
- * This module was tested with the Seeed Studio* Grove 6-Axis Accelerometer & Compass
- * version 2.0 module used over I2C. The magnometer and acceleromter are accessed
- * at two seperate I2C addresses.
- *
- * @image html lsm303d.jpeg
- * @snippet lsm303d.cxx Interesting
- */
-class LSM303d {
- public:
-
- /* Address definitions for the grove 6DOF v2.0 */
- typedef enum {
- LSM303d_ADDR = 0x1E
- } GROVE_6DOF_ADDRS_T;
-
- typedef enum {
- LM303D_SCALE_2G = 2,
- LM303D_SCALE_4G = 4,
- LM303D_SCALE_6G = 6,
- LM303D_SCALE_8G = 8,
- LM303D_SCALE_16G = 16
- } LSM303D_SCALE_T;
-
- typedef enum {
- X = 0,
- Y = 1,
- Z = 2
- } XYZ_T;
-
- /**
- * Instantiates an LSM303d object
- *
- * @param i2c bus
- * @param addr Magnetometer
- * @param addr Accelerometer
- */
- LSM303d (int bus,
- int addr=LSM303d_ADDR,
- int accScale=LM303D_SCALE_4G);
-
- /**
- * LSM303d object destructor
- * where is no more need for this here - I2c connection will be stopped
- * automatically when m_i2c variable will go out of scope
- * ~LSM303d ();
- **/
-
- /**
- * Gets the current heading; headings <0 indicate an error has occurred
- *
- * @return float
- */
- float getHeading();
-
- /**
- * Gets the coordinates in the XYZ order
- */
- mraa::Result getCoordinates();
-
- /**
- * Gets accelerometer values
- * Should be called before other "get" functions for acceleration
- */
- mraa::Result getAcceleration();
-
- /**
- * Gets raw coordinate data; it is updated when getCoordinates() is called
- */
- int16_t* getRawCoorData();
-
- /**
- * Gets the X component of the coordinates data
- */
- int16_t getCoorX();
-
- /**
- * Gets the Y component of the coordinates data
- */
- int16_t getCoorY();
-
- /**
- * Gets the Z component of the coordinates data
- */
- int16_t getCoorZ();
-
- /**
- * Gets raw accelerometer data; it is updated when getAcceleration() is called
- */
- int16_t* getRawAccelData();
-
- /**
- * Gets the X component of the acceleration data
- */
- int16_t getAccelX();
-
- /**
- * Gets the Y component of the acceleration data
- */
- int16_t getAccelY();
-
- /**
- * Gets the Z component of the acceleration data
- */
- int16_t getAccelZ();
-
- private:
-
- /* LSM303d Register definitions */
- typedef enum {
- STATUS_M = 0x7,
- OUT_X_L_M = 0x8,
- OUT_X_H_M = 0x9,
- OUT_Y_L_M = 0xA,
- OUT_Y_H_M = 0xB,
- OUT_Z_L_M = 0xC,
- OUT_Z_H_M = 0xD,
-
- CTRL_REG0 = 0x1f,
- CTRL_REG1 = 0x20,
- CTRL_REG2 = 0x21,
- CTRL_REG3 = 0x22,
- CTRL_REG4 = 0x23,
- CTRL_REG5 = 0x24,
- CTRL_REG6 = 0x25,
- CTRL_REG7 = 0x26,
-
- STATUS_REGA = 0x27,
-
- OUT_X_L_A = 0x28,
- OUT_X_H_A = 0x29,
- OUT_Y_L_A = 0x2A,
- OUT_Y_H_A = 0x2B,
- OUT_Z_L_A = 0x2C,
- OUT_Z_H_A = 0x2D,
-
- FIFO_CTRL = 0x2E,
- FIFO_SRC = 0x2F,
-
- IG_CFG1 = 0x30,
- IG_SRC1 = 0x31,
- IG_THS1 = 0x32,
- IG_DUR1 = 0x33,
-
- IG_CFG2 = 0x34,
- IG_SRC2 = 0x35,
- IG_THS2 = 0x36,
- IG_DUR2 = 0x37,
-
- CLICK_CFG = 0x38,
- CLICK_SRC = 0x39,
- CLICK_THS = 0x3A,
-
- TIME_LIMIT = 0x3B,
- TIME_LATEN = 0x3C,
- TIME_WINDO = 0x3D,
-
- ACT_THS = 0x3E,
- ACT_DUR = 0x3F,
- } LSM303d_REGS_T;
-
- int writeThenRead(uint8_t reg);
- mraa::Result setRegisterSafe(uint8_t slave, uint8_t sregister, uint8_t data);
-
- mraa::I2c m_i2c;
- int m_addr;
-
- uint8_t buf[6];
- int16_t coor[3];
- int16_t accel[3];
-};
-
-}
diff --git a/peripheral/libupm/src/lsm303d/pyupm_lsm303d.i b/peripheral/libupm/src/lsm303d/pyupm_lsm303d.i
deleted file mode 100644
index 92ec782..0000000
--- a/peripheral/libupm/src/lsm303d/pyupm_lsm303d.i
+++ /dev/null
@@ -1,16 +0,0 @@
-%module pyupm_lsm303d
-%include "../upm.i"
-%include "../carrays_int16_t.i"
-
-%feature("autodoc", "3");
-
-// Adding this typemap because SWIG is converting int16 into a short by default
-// This forces SWIG to convert it correctly
-%typemap(out) int16_t* {
- resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_int16Array, 0 | 0 );
-}
-
-%include "lsm303d.h"
-%{
- #include "lsm303d.h"
-%}
diff --git a/peripheral/libupm/src/lsm9ds0/CMakeLists.txt b/peripheral/libupm/src/lsm9ds0/CMakeLists.txt
deleted file mode 100644
index d4a45fd..0000000
--- a/peripheral/libupm/src/lsm9ds0/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "lsm9ds0")
-set (libdescription "gyro, accelerometer and magnometer sensor based on lsm9ds0")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/lsm9ds0/javaupm_lsm9ds0.i b/peripheral/libupm/src/lsm9ds0/javaupm_lsm9ds0.i
deleted file mode 100644
index 05ca5dc..0000000
--- a/peripheral/libupm/src/lsm9ds0/javaupm_lsm9ds0.i
+++ /dev/null
@@ -1,56 +0,0 @@
-%module javaupm_lsm9ds0
-%include "../upm.i"
-%include "cpointer.i"
-%include "typemaps.i"
-%include "arrays_java.i";
-%include "../java_buffer.i"
-
-%apply int {mraa::Edge};
-%apply float *INOUT { float *x, float *y, float *z };
-
-%typemap(jni) float* "jfloatArray"
-%typemap(jstype) float* "float[]"
-%typemap(jtype) float* "float[]"
-
-%typemap(javaout) float* {
- return $jnicall;
-}
-
-%typemap(out) float *getAccelerometer {
- $result = JCALL1(NewFloatArray, jenv, 3);
- JCALL4(SetFloatArrayRegion, jenv, $result, 0, 3, $1);
- delete [] $1;
-}
-
-%typemap(out) float *getGyroscope {
- $result = JCALL1(NewFloatArray, jenv, 3);
- JCALL4(SetFloatArrayRegion, jenv, $result, 0, 3, $1);
- delete [] $1;
-}
-
-%typemap(out) float *getMagnetometer {
- $result = JCALL1(NewFloatArray, jenv, 3);
- JCALL4(SetFloatArrayRegion, jenv, $result, 0, 3, $1);
- delete [] $1;
-}
-
-%ignore getAccelerometer(float *, float *, float *);
-%ignore getGyroscope(float *, float *, float *);
-%ignore getMagnetometer(float *, float *, float *);
-
-%{
- #include "lsm9ds0.h"
-%}
-
-%include "lsm9ds0.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_lsm9ds0");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%}
diff --git a/peripheral/libupm/src/lsm9ds0/jsupm_lsm9ds0.i b/peripheral/libupm/src/lsm9ds0/jsupm_lsm9ds0.i
deleted file mode 100644
index 3f0c6ad..0000000
--- a/peripheral/libupm/src/lsm9ds0/jsupm_lsm9ds0.i
+++ /dev/null
@@ -1,11 +0,0 @@
-%module jsupm_lsm9ds0
-%include "../upm.i"
-%include "cpointer.i"
-
-%pointer_functions(float, floatp);
-
-%include "lsm9ds0.h"
-%{
- #include "lsm9ds0.h"
-%}
-
diff --git a/peripheral/libupm/src/lsm9ds0/lsm9ds0.cxx b/peripheral/libupm/src/lsm9ds0/lsm9ds0.cxx
deleted file mode 100644
index 3253a62..0000000
--- a/peripheral/libupm/src/lsm9ds0/lsm9ds0.cxx
+++ /dev/null
@@ -1,804 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <stdexcept>
-#include <string.h>
-
-#include "lsm9ds0.h"
-
-using namespace upm;
-using namespace std;
-
-
-LSM9DS0::LSM9DS0(int bus, uint8_t gAddress, uint8_t xmAddress) :
- m_i2cG(bus), m_i2cXM(bus), m_gpioG_INT(0), m_gpioG_DRDY(0),
- m_gpioXM_GEN1(0), m_gpioXM_GEN2(0)
-{
- m_gAddr = gAddress;
- m_xmAddr = xmAddress;
-
- m_accelX = 0.0;
- m_accelY = 0.0;
- m_accelZ = 0.0;
-
- m_gyroX = 0.0;
- m_gyroY = 0.0;
- m_gyroZ = 0.0;
-
- m_magX = 0.0;
- m_magY = 0.0;
- m_magZ = 0.0;
-
- m_temp = 0.0;
-
- m_accelScale = 0.0;
- m_gyroScale = 0.0;
- m_magScale = 0.0;
-
- mraa::Result rv;
- if ( (rv = m_i2cG.address(m_gAddr)) != mraa::SUCCESS)
- {
- throw std::runtime_error(string(__FUNCTION__) +
- ": Could not initialize Gyro i2c address");
- return;
- }
-
- if ( (rv = m_i2cXM.address(m_xmAddr)) != mraa::SUCCESS)
- {
- throw std::runtime_error(string(__FUNCTION__) +
- ": Could not initialize XM i2c address");
- return;
- }
-}
-
-LSM9DS0::~LSM9DS0()
-{
- uninstallISR(INTERRUPT_G_INT);
- uninstallISR(INTERRUPT_G_DRDY);
- uninstallISR(INTERRUPT_XM_GEN1);
- uninstallISR(INTERRUPT_XM_GEN2);
-}
-
-bool LSM9DS0::init()
-{
- // Init the gyroscope
-
- // power up
- if (!setGyroscopePowerDown(false))
- {
- throw std::runtime_error(string(__FUNCTION__) +
- ": Unable to wake up gyro");
- return false;
- }
-
- // enable all axes
- if (!setGyroscopeEnableAxes(CTRL_REG1_G_YEN |CTRL_REG1_G_XEN |
- CTRL_REG1_G_ZEN))
- {
- throw std::runtime_error(string(__FUNCTION__) +
- ": Unable to enable gyro axes");
- return false;
- }
-
- // set gyro ODR
- if (!setGyroscopeODR(G_ODR_95_25))
- {
- throw std::runtime_error(string(__FUNCTION__) +
- ": Unable to set gyro ODR");
- return false;
- }
-
- // set gyro scale
- if (!setGyroscopeScale(G_FS_245))
- {
- throw std::runtime_error(string(__FUNCTION__) +
- ": Unable to set gyro scale");
- return false;
- }
-
- // Init the accelerometer
-
- // power up and set ODR
- if (!setAccelerometerODR(XM_AODR_100))
- {
- throw std::runtime_error(string(__FUNCTION__) +
- ": Unable to set accel ODR");
- return false;
- }
-
- // enable all axes
- if (!setAccelerometerEnableAxes(CTRL_REG1_XM_AXEN |CTRL_REG1_XM_AYEN |
- CTRL_REG1_XM_AZEN))
- {
- throw std::runtime_error(string(__FUNCTION__) +
- ": Unable to enable accel axes");
- return false;
- }
-
- // set scaling rate
- if (!setAccelerometerScale(XM_AFS_2))
- {
- throw std::runtime_error(string(__FUNCTION__) +
- ": Unable to set accel scale");
- return false;
- }
-
- // temperature sensor
-
- // enable the temperature sensor
- if (!enableTemperatureSensor(true))
- {
- throw std::runtime_error(string(__FUNCTION__) +
- ": Unable to enable temp sensor");
- return false;
- }
-
- // Init the magnetometer
-
- // set mode (this also powers it up if not XM_MD_POWERDOWN)
- if (!setMagnetometerMode(XM_MD_CONTINUOUS))
- {
- throw std::runtime_error(string(__FUNCTION__) +
- ": Unable to set mag scale");
- return false;
- }
-
- // turn LPM off
- if (!setMagnetometerLPM(false))
- {
- throw std::runtime_error(string(__FUNCTION__) +
- ": Unable to disable mag LPM");
- return false;
- }
-
- // set resolution
- if (!setMagnetometerResolution(XM_RES_LOW))
- {
- throw std::runtime_error(string(__FUNCTION__) +
- ": Unable to set mag res");
- return false;
- }
-
- // set ODR
- if (!setMagnetometerODR(XM_ODR_12_5))
- {
- throw std::runtime_error(string(__FUNCTION__) +
- ": Unable to set mag ODR");
- return false;
- }
-
- // set scale
- if (!setMagnetometerScale(XM_MFS_2))
- {
- throw std::runtime_error(string(__FUNCTION__) +
- ": Unable to set mag scale");
- return false;
- }
-
- return true;
-}
-
-
-void LSM9DS0::update()
-{
- updateGyroscope();
- updateAccelerometer();
- updateMagnetometer();
- updateTemperature();
-}
-
-void LSM9DS0::updateGyroscope()
-{
- uint8_t buffer[6];
-
- memset(buffer, 0, 6);
- readRegs(DEV_GYRO, REG_OUT_X_L_G, buffer, 6);
-
- int16_t x, y, z;
-
- x = ( (buffer[1] << 8) | buffer[0] );
- y = ( (buffer[3] << 8) | buffer[2] );
- z = ( (buffer[5] << 8) | buffer[4] );
-
- m_gyroX = float(x);
- m_gyroY = float(y);
- m_gyroZ = float(z);
-}
-
-void LSM9DS0::updateAccelerometer()
-{
- uint8_t buffer[6];
-
- memset(buffer, 0, 6);
- readRegs(DEV_XM, REG_OUT_X_L_A, buffer, 6);
-
- int16_t x, y, z;
-
- x = ( (buffer[1] << 8) | buffer[0] );
- y = ( (buffer[3] << 8) | buffer[2] );
- z = ( (buffer[5] << 8) | buffer[4] );
-
- m_accelX = float(x);
- m_accelY = float(y);
- m_accelZ = float(z);
-}
-
-void LSM9DS0::updateMagnetometer()
-{
- uint8_t buffer[6];
-
- memset(buffer, 0, 6);
- readRegs(DEV_XM, REG_OUT_X_L_M, buffer, 6);
-
- int16_t x, y, z;
-
- x = ( (buffer[1] << 8) | buffer[0] );
- y = ( (buffer[3] << 8) | buffer[2] );
- z = ( (buffer[5] << 8) | buffer[4] );
-
- m_magX = float(x);
- m_magY = float(y);
- m_magZ = float(z);
-}
-
-void LSM9DS0::updateTemperature()
-{
- uint8_t buffer[2];
-
- memset(buffer, 0, 2);
- readRegs(DEV_XM, REG_OUT_TEMP_L_XM, buffer, 2);
-
- // cerr << "HIGH: " << int(buffer[1]) << " LOW: " << int(buffer[0]) << endl;
-
- // 12b signed
- int16_t temp = ( (buffer[1] << 8) | (buffer[0] ) );
- if (temp & 0x0800)
- {
- temp &= ~0x0800;
- temp *= -1;
- }
-
- m_temp = float(temp);
-}
-
-uint8_t LSM9DS0::readReg(DEVICE_T dev, uint8_t reg)
-{
- mraa::I2c *device;
-
- switch(dev)
- {
- case DEV_GYRO: device = &m_i2cG; break;
- case DEV_XM: device = &m_i2cXM; break;
- default:
- throw std::logic_error(string(__FUNCTION__) +
- ": Internal error, invalid device specified");
- return 0;
- }
-
- return device->readReg(reg);
-}
-
-void LSM9DS0::readRegs(DEVICE_T dev, uint8_t reg, uint8_t *buffer, int len)
-{
- mraa::I2c *device;
-
- switch(dev)
- {
- case DEV_GYRO: device = &m_i2cG; break;
- case DEV_XM: device = &m_i2cXM; break;
- default:
- throw std::logic_error(string(__FUNCTION__) +
- ": Internal error, invalid device specified");
- return;
- }
-
- // We need to set the high bit of the register to enable
- // auto-increment mode for reading multiple registers in one go.
- device->readBytesReg(reg | m_autoIncrementMode, buffer, len);
-}
-
-bool LSM9DS0::writeReg(DEVICE_T dev, uint8_t reg, uint8_t val)
-{
- mraa::I2c *device;
-
- switch(dev)
- {
- case DEV_GYRO: device = &m_i2cG; break;
- case DEV_XM: device = &m_i2cXM; break;
- default:
- throw std::logic_error(string(__FUNCTION__) +
- ": Internal error, invalid device specified");
- return false;
- }
-
- mraa::Result rv;
- if ((rv = device->writeReg(reg, val)) != mraa::SUCCESS)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": I2c.writeReg() failed");
- return false;
- }
-
- return true;
-}
-
-bool LSM9DS0::setGyroscopePowerDown(bool enable)
-{
- uint8_t reg = readReg(DEV_GYRO, REG_CTRL_REG1_G);
-
- if (enable)
- reg &= ~CTRL_REG1_G_PD;
- else
- reg |= CTRL_REG1_G_PD;
-
- return writeReg(DEV_GYRO, REG_CTRL_REG1_G, reg);
-}
-
-bool LSM9DS0::setGyroscopeEnableAxes(uint8_t axes)
-{
- uint8_t reg = readReg(DEV_GYRO, REG_CTRL_REG1_G);
-
- // filter out any non-axis related data from arg
- axes &= (CTRL_REG1_G_YEN | CTRL_REG1_G_XEN | CTRL_REG1_G_ZEN);
-
- // clear them in the register
- reg &= ~(CTRL_REG1_G_YEN | CTRL_REG1_G_XEN | CTRL_REG1_G_ZEN);
-
- // now add them
- reg |= axes;
-
- return writeReg(DEV_GYRO, REG_CTRL_REG1_G, reg);
-}
-
-bool LSM9DS0::setGyroscopeODR(G_ODR_T odr)
-{
- uint8_t reg = readReg(DEV_GYRO, REG_CTRL_REG1_G);
-
- reg &= ~(_CTRL_REG1_G_ODR_MASK << _CTRL_REG1_G_ODR_SHIFT);
-
- reg |= (odr << _CTRL_REG1_G_ODR_SHIFT);
-
- return writeReg(DEV_GYRO, REG_CTRL_REG1_G, reg);
-}
-
-bool LSM9DS0::setGyroscopeScale(G_FS_T scale)
-{
- uint8_t reg = readReg(DEV_GYRO, REG_CTRL_REG4_G);
-
- reg &= ~(_CTRL_REG4_G_FS_MASK << _CTRL_REG4_G_FS_SHIFT);
-
- reg |= (scale << _CTRL_REG4_G_FS_SHIFT);
-
- if (!writeReg(DEV_GYRO, REG_CTRL_REG4_G, reg))
- {
- return false;
- }
-
- // store scaling factor (mDeg/s/LSB)
-
- switch (scale)
- {
- case G_FS_245:
- m_gyroScale = 8.75;
- break;
-
- case G_FS_500:
- m_gyroScale = 17.5;
- break;
-
- case G_FS_2000:
- m_gyroScale = 70.0;
- break;
-
- default: // should never occur, but...
- m_gyroScale = 0.0; // set a safe, though incorrect value
- throw std::logic_error(string(__FUNCTION__) +
- ": internal error, unsupported scale");
- break;
- }
-
- return true;
-}
-
-bool LSM9DS0::setAccelerometerEnableAxes(uint8_t axes)
-{
- uint8_t reg = readReg(DEV_XM, REG_CTRL_REG1_XM);
-
- // filter out any non-axis related data from arg
- axes &= (CTRL_REG1_XM_AXEN | CTRL_REG1_XM_AYEN | CTRL_REG1_XM_AZEN);
-
- // clear them in the register
- reg &= ~(CTRL_REG1_XM_AXEN | CTRL_REG1_XM_AYEN | CTRL_REG1_XM_AZEN);
-
- // now add them
- reg |= axes;
-
- return writeReg(DEV_XM, REG_CTRL_REG1_XM, reg);
-}
-
-bool LSM9DS0::setAccelerometerODR(XM_AODR_T odr)
-{
- uint8_t reg = readReg(DEV_XM, REG_CTRL_REG1_XM);
-
- reg &= ~(_CTRL_REG1_XM_AODR_MASK << _CTRL_REG1_XM_AODR_SHIFT);
-
- reg |= (odr << _CTRL_REG1_XM_AODR_SHIFT);
-
- return writeReg(DEV_XM, REG_CTRL_REG1_XM, reg);
-}
-
-bool LSM9DS0::setAccelerometerScale(XM_AFS_T scale)
-{
- uint8_t reg = readReg(DEV_XM, REG_CTRL_REG2_XM);
-
- reg &= ~(_CTRL_REG2_XM_AFS_MASK << _CTRL_REG2_XM_AFS_SHIFT);
-
- reg |= (scale << _CTRL_REG2_XM_AFS_SHIFT);
-
- if (!writeReg(DEV_XM, REG_CTRL_REG2_XM, reg))
- {
- return false;
- }
-
- // store scaling factor
-
- switch (scale)
- {
- case XM_AFS_2:
- m_accelScale = 0.061;
- break;
-
- case XM_AFS_4:
- m_accelScale = 0.122 ;
- break;
-
- case XM_AFS_6:
- m_accelScale = 0.183 ;
- break;
-
- case XM_AFS_8:
- m_accelScale = 0.244 ;
- break;
-
- case XM_AFS_16:
- m_accelScale = 0.732 ;
- break;
-
- default: // should never occur, but...
- m_accelScale = 0.0; // set a safe, though incorrect value
- throw std::logic_error(string(__FUNCTION__) +
- ": internal error, unsupported scale");
- break;
- }
-
- return true;
-}
-
-bool LSM9DS0::setMagnetometerResolution(XM_RES_T res)
-{
- uint8_t reg = readReg(DEV_XM, REG_CTRL_REG5_XM);
-
- reg &= ~(_CTRL_REG5_XM_RES_MASK << _CTRL_REG5_XM_RES_SHIFT);
-
- reg |= (res << _CTRL_REG5_XM_RES_SHIFT);
-
- return writeReg(DEV_XM, REG_CTRL_REG5_XM, reg);
-}
-
-bool LSM9DS0::setMagnetometerODR(XM_ODR_T odr)
-{
- uint8_t reg = readReg(DEV_XM, REG_CTRL_REG5_XM);
-
- reg &= ~(_CTRL_REG5_XM_ODR_MASK << _CTRL_REG5_XM_ODR_SHIFT);
-
- reg |= (odr << _CTRL_REG5_XM_ODR_SHIFT);
-
- return writeReg(DEV_XM, REG_CTRL_REG5_XM, reg);
-}
-
-bool LSM9DS0::setMagnetometerMode(XM_MD_T mode)
-{
- uint8_t reg = readReg(DEV_XM, REG_CTRL_REG7_XM);
-
- reg &= ~(_CTRL_REG7_XM_MD_MASK << _CTRL_REG7_XM_MD_SHIFT);
-
- reg |= (mode << _CTRL_REG7_XM_MD_SHIFT);
-
- return writeReg(DEV_XM, REG_CTRL_REG7_XM, reg);
-}
-
-bool LSM9DS0::setMagnetometerLPM(bool enable)
-{
- uint8_t reg = readReg(DEV_XM, REG_CTRL_REG7_XM);
-
- if (enable)
- reg |= CTRL_REG7_XM_MLP;
- else
- reg &= ~CTRL_REG7_XM_MLP;
-
- return writeReg(DEV_XM, REG_CTRL_REG7_XM, reg);
-}
-
-bool LSM9DS0::setMagnetometerScale(XM_MFS_T scale)
-{
- uint8_t reg = readReg(DEV_XM, REG_CTRL_REG6_XM);
-
- reg &= ~(_CTRL_REG6_XM_MFS_MASK << _CTRL_REG6_XM_MFS_SHIFT);
-
- reg |= (scale << _CTRL_REG6_XM_MFS_SHIFT);
-
- if (!writeReg(DEV_XM, REG_CTRL_REG6_XM, reg))
- {
- return false;
- }
-
- // store scaling factor
-
- switch (scale)
- {
- case XM_MFS_2:
- m_magScale = 0.08;
- break;
-
- case XM_MFS_4:
- m_magScale = 0.16;
- break;
-
- case XM_MFS_8:
- m_magScale = 0.32;
- break;
-
- case XM_MFS_12:
- m_magScale = 0.48;
- break;
-
- default: // should never occur, but...
- m_magScale = 0.0; // set a safe, though incorrect value
- throw std::logic_error(string(__FUNCTION__) +
- ": internal error, unsupported scale");
- break;
- }
-
- return true;
-}
-
-void LSM9DS0::getAccelerometer(float *x, float *y, float *z)
-{
- if (x)
- *x = (m_accelX * m_accelScale) / 1000.0;
-
- if (y)
- *y = (m_accelY * m_accelScale) / 1000.0;
-
- if (z)
- *z = (m_accelZ * m_accelScale) / 1000.0;
-}
-
-void LSM9DS0::getGyroscope(float *x, float *y, float *z)
-{
- if (x)
- *x = (m_gyroX * m_gyroScale) / 1000.0;
-
- if (y)
- *y = (m_gyroY * m_gyroScale) / 1000.0;
-
- if (z)
- *z = (m_gyroZ * m_gyroScale) / 1000.0;
-}
-
-void LSM9DS0::getMagnetometer(float *x, float *y, float *z)
-{
- if (x)
- *x = (m_magX * m_magScale) / 1000.0;
-
- if (y)
- *y = (m_magY * m_magScale) / 1000.0;
-
- if (z)
- *z = (m_magZ * m_magScale) / 1000.0;
-}
-
-#ifdef JAVACALLBACK
-float *LSM9DS0::getAccelerometer()
-{
- float *v = new float[3];
- getAccelerometer(&v[0], &v[1], &v[2]);
- return v;
-}
-
-float *LSM9DS0::getGyroscope()
-{
- float *v = new float[3];
- getGyroscope(&v[0], &v[1], &v[2]);
- return v;
-}
-
-float *LSM9DS0::getMagnetometer()
-{
- float *v = new float[3];
- getMagnetometer(&v[0], &v[1], &v[2]);
- return v;
-}
-#endif
-
-float LSM9DS0::getTemperature()
-{
- // This might be wrong... The datasheet does not provide enough info
- // to calculate the temperature given a specific sensor reading. So
- // - with 12b resolution, signed, and 8 degrees/per LSB, we come up
- // with the following. Then scale up and we get a number that seems
- // pretty close.
- return (((m_temp / 2048.0) * 8.0) * 100.0);
-}
-
-bool LSM9DS0::enableTemperatureSensor(bool enable)
-{
- uint8_t reg = readReg(DEV_XM, REG_CTRL_REG5_XM);
-
- if (enable)
- reg |= CTRL_REG5_XM_TEMP_EN;
- else
- reg &= ~CTRL_REG5_XM_TEMP_EN;
-
- return writeReg(DEV_XM, REG_CTRL_REG5_XM, reg);
-}
-
-uint8_t LSM9DS0::getGyroscopeStatus()
-{
- return readReg(DEV_GYRO, REG_STATUS_REG_G);
-}
-
-uint8_t LSM9DS0::getMagnetometerStatus()
-{
- return readReg(DEV_XM, REG_STATUS_REG_M);
-}
-
-uint8_t LSM9DS0::getAccelerometerStatus()
-{
- return readReg(DEV_XM, REG_STATUS_REG_A);
-}
-
-uint8_t LSM9DS0::getGyroscopeInterruptConfig()
-{
- return readReg(DEV_GYRO, REG_INT1_CFG_G);
-}
-
-bool LSM9DS0::setGyroscopeInterruptConfig(uint8_t enables)
-{
- return writeReg(DEV_GYRO, REG_INT1_CFG_G, enables);
-}
-
-uint8_t LSM9DS0::getGyroscopeInterruptSrc()
-{
- return readReg(DEV_GYRO, REG_INT1_SRC_G);
-}
-
-uint8_t LSM9DS0::getMagnetometerInterruptControl()
-{
- return readReg(DEV_XM, REG_INT_CTRL_REG_M);
-}
-
-bool LSM9DS0::setMagnetometerInterruptControl(uint8_t enables)
-{
- return writeReg(DEV_XM, REG_INT_CTRL_REG_M, enables);
-}
-
-uint8_t LSM9DS0::getMagnetometerInterruptSrc()
-{
- return readReg(DEV_XM, REG_INT_SRC_REG_M);
-}
-
-uint8_t LSM9DS0::getInterruptGen1()
-{
- return readReg(DEV_XM, REG_INT_GEN_1_REG);
-}
-
-bool LSM9DS0::setInterruptGen1(uint8_t enables)
-{
- return writeReg(DEV_XM, REG_INT_GEN_1_REG, enables);
-}
-
-uint8_t LSM9DS0::getInterruptGen1Src()
-{
- return readReg(DEV_XM, REG_INT_GEN_1_SRC);
-}
-
-uint8_t LSM9DS0::getInterruptGen2()
-{
- return readReg(DEV_XM, REG_INT_GEN_2_REG);
-}
-
-bool LSM9DS0::setInterruptGen2(uint8_t enables)
-{
- return writeReg(DEV_XM, REG_INT_GEN_2_REG, enables);
-}
-
-uint8_t LSM9DS0::getInterruptGen2Src()
-{
- return readReg(DEV_XM, REG_INT_GEN_2_SRC);
-}
-
-#if defined(SWIGJAVA) || defined (JAVACALLBACK)
-void LSM9DS0::installISR(INTERRUPT_PINS_T intr, int gpio, mraa::Edge level,
- jobject runnable)
-{
- // delete any existing ISR and GPIO context
- uninstallISR(intr);
-
- // greate gpio context
- getPin(intr) = new mraa::Gpio(gpio);
-
- getPin(intr)->dir(mraa::DIR_IN);
- getPin(intr)->isr(level, runnable);
-
-}
-#else
-void LSM9DS0::installISR(INTERRUPT_PINS_T intr, int gpio, mraa::Edge level,
- void (*isr)(void *), void *arg)
-{
- // delete any existing ISR and GPIO context
- uninstallISR(intr);
-
- // greate gpio context
- getPin(intr) = new mraa::Gpio(gpio);
-
- getPin(intr)->dir(mraa::DIR_IN);
- getPin(intr)->isr(level, isr, arg);
-}
-#endif
-
-void LSM9DS0::uninstallISR(INTERRUPT_PINS_T intr)
-{
- if (getPin(intr))
- {
- getPin(intr)->isrExit();
- delete getPin(intr);
-
- getPin(intr) = 0;
- }
-}
-
-mraa::Gpio*& LSM9DS0::getPin(INTERRUPT_PINS_T intr)
-{
- switch(intr)
- {
- case INTERRUPT_G_INT:
- return m_gpioG_INT;
- break;
- case INTERRUPT_G_DRDY:
- return m_gpioG_DRDY;
- break;
- case INTERRUPT_XM_GEN1:
- return m_gpioXM_GEN1;
- break;
- case INTERRUPT_XM_GEN2:
- return m_gpioXM_GEN2;
- break;
- default:
- throw std::out_of_range(string(__FUNCTION__) +
- ": Invalid interrupt enum passed");
- }
-}
diff --git a/peripheral/libupm/src/lsm9ds0/lsm9ds0.h b/peripheral/libupm/src/lsm9ds0/lsm9ds0.h
deleted file mode 100644
index 17648d6..0000000
--- a/peripheral/libupm/src/lsm9ds0/lsm9ds0.h
+++ /dev/null
@@ -1,1486 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include <mraa/common.hpp>
-#include <mraa/i2c.hpp>
-
-#include <mraa/gpio.hpp>
-
-#define LSM9DS0_I2C_BUS 1
-#define LSM9DS0_DEFAULT_XM_ADDR 0x1d
-#define LSM9DS0_DEFAULT_GYRO_ADDR 0x6b
-
-namespace upm {
-
- /**
- * @brief LSM9DS0 accelerometer library
- * @defgroup lsm9ds0 libupm-lsm9ds0
- * @ingroup i2c gpio accelerometer compass
- */
-
- /**
- * @library lsm9ds0
- * @sensor lsm9ds0
- * @comname LSM9DS0 3-axis Gyroscope, Accelerometer, and Magnetometer
- * @type accelerometer compass
- * @man sparkfun
- * @con i2c gpio
- * @web https://www.sparkfun.com/products/13033
- *
- * @brief API for the LSM9DS0 3-axis Gyroscope, Accelerometer,
- * and Magnetometer
- *
- * The LSM9DS0 is a system-in-package featuring a 3D digital linear
- * acceleration sensor, a 3D digital angular rate sensor, and a 3D
- * digital magnetic sensor.
- *
- * The LSM9DS0 has a linear acceleration full scale of
- * 2g/4g/6g/8g/16g, a magnetic field full scale of 2/4/8/12
- * gauss and an angular rate of 245/500/2000 dps.
- *
- * While not all of the functionality of this device is supported
- * initially, methods and register definitions are provided that
- * should allow an end user to implement whatever features are
- * required.
- *
- * This driver was developed on a Sparkfun 9DOF edison block.
- *
- * @image html lsm9ds0.jpg
- * <br><em>LSM9DS0 Sensor image provided by SparkFun* under
- * <a href=https://creativecommons.org/licenses/by-nc-sa/3.0/>
- * CC BY-NC-SA-3.0</a>.</em>
- *
- * @snippet lsm9ds0.cxx Interesting
- */
-
- class LSM9DS0 {
- public:
-
- // NOTE: reserved registers must not be written into or permanent
- // damage to the device can result. Reserved bitfields must
- // always be 0.
-
- // There are two sub-devices within this device - the
- // Accelerometer and Magnetometer (XM) and the Gyroscope (G), each
- // with their own I2C address.
-
- /**
- * LSM9DS0 Gyroscope (G) registers
- */
- typedef enum {
- // 0x00-0x0e reserved
-
- REG_WHO_AM_I_G = 0x0f, // should be 0xd4
-
- // 0x10-0x1f reserved
-
- REG_CTRL_REG1_G = 0x20,
- REG_CTRL_REG2_G = 0x21,
- REG_CTRL_REG3_G = 0x22,
- REG_CTRL_REG4_G = 0x23,
- REG_CTRL_REG5_G = 0x24,
-
- REG_REFERENCE_G = 0x25,
-
- // 0x26 reserved
-
- REG_STATUS_REG_G = 0x27,
-
- REG_OUT_X_L_G = 0x28, // gyro output, X axis, LSB
- REG_OUT_X_H_G = 0x29, // gyro output, X axis, MSB
- REG_OUT_Y_L_G = 0x2a,
- REG_OUT_Y_H_G = 0x2b,
- REG_OUT_Z_L_G = 0x2c,
- REG_OUT_Z_H_G = 0x2d,
-
- REG_FIFO_CTRL_REG_G = 0x2e,
- REG_FIFO_SRC_REG_G = 0x2f,
-
- REG_INT1_CFG_G = 0x30,
- REG_INT1_SRC_G = 0x31,
-
- REG_INT1_TSH_XH_G = 0x32, // interrupt threshold registers
- REG_INT1_TSH_XL_G = 0x33,
- REG_INT1_TSH_YH_G = 0x34,
- REG_INT1_TSH_YL_G = 0x35,
- REG_INT1_TSH_ZH_G = 0x36,
- REG_INT1_TSH_ZL_G = 0x37,
-
- // See fig 19 & 20 and preceeding description in the datasheet
- // on how to use this register
- REG_INT1_DURATION_G = 0x38
- } REG_G_T;
-
- /**
- * Gyro CTRL_REG1_G bits
- */
- typedef enum {
- CTRL_REG1_G_YEN = 0x01, // Y enable, odd ordering...
- CTRL_REG1_G_XEN = 0x02,
- CTRL_REG1_G_ZEN = 0x04,
- CTRL_REG1_G_PD = 0x08, // power down (0)
-
- CTRL_REG1_G_BW0 = 0x10, // bandwidth
- CTRL_REG1_G_BW1 = 0x20,
- _CTRL_REG1_G_BW_MASK = 3,
- _CTRL_REG1_G_BW_SHIFT = 4,
-
- CTRL_REG1_G_DR0 = 0x40, // data rate
- CTRL_REG1_G_DR1 = 0x80,
- _CTRL_REG1_G_DR_MASK = 3,
- _CTRL_REG1_G_DR_SHIFT = 6,
-
- // The following are synthetic register and shift/mask
- // definitions. Together both BW and DR setup the device for a
- // specific output data rate (ODR) and cutoff frequency. These
- // definitions allow us to use a more informative configuration
- // for these 4 bits, rather than having the user go to the
- // datasheet to figure out what to put for those values in order
- // to get the desired ODR/cutoff. These are the values we will
- // use in this driver.
-
- CTRL_REG1_G_ODR0 = 0x10, // BW0
- CTRL_REG1_G_ODR1 = 0x20, // BW1
- CTRL_REG1_G_ODR2 = 0x40, // DR0
- CTRL_REG1_G_ODR3 = 0x80, // DR1
- _CTRL_REG1_G_ODR_MASK = 15,
- _CTRL_REG1_G_ODR_SHIFT = 4
- } CTRL_REG1_G_BITS_T;
-
- /**
- * CRTL_REG1_G_ODR values
- */
- typedef enum {
- G_ODR_95_12_5 = 0, // ODR = 95Hz, cutoff = 12.5
- G_ODR_95_25 = 1, // ODR = 95Hz, cutoff = 25
- // Other two (2 and 3) are the same (95_25)
-
- G_ODR_190_12_5 = 4,
- G_ODR_190_25 = 5,
- G_ODR_190_50 = 6,
- G_ODR_190_70 = 7,
-
- G_ODR_380_20 = 8,
- G_ODR_380_25 = 9,
- G_ODR_380_50 = 10,
- G_ODR_380_100 = 11,
-
- G_ODR_760_30 = 12,
- G_ODR_760_35 = 13,
- G_ODR_760_50 = 14,
- G_ODR_760_100 = 15
- } G_ODR_T;
-
- /**
- * Gyro CTRL_REG2_G bits
- */
- typedef enum {
- CTRL_REG2_G_HPCF0 = 0x01, // high-pass cutoff freq
- CTRL_REG2_G_HPCF1 = 0x02,
- CTRL_REG2_G_HPCF2 = 0x04,
- CTRL_REG2_G_HPCF3 = 0x08,
- _CTRL_REG2_G_HPCF_MASK = 15,
- _CTRL_REG2_G_HPCF_SHIFT = 0,
-
- CTRL_REG2_G_HPM0 = 0x10, // high-pass filter mode
- CTRL_REG2_G_HPM1 = 0x20,
- _CTRL_REG2_G_HPM_MASK = 3,
- _CTRL_REG2_G_HPM_SHIFT = 4,
-
- // 0x40, 0x80 reserved
- } CTRL_REG2_G_BITS_T;
-
- /**
- * CRTL_REG2_G_HPCF values
- *
- * See table 26 in the datasheet, as these depend on your data
- * rate (ODR). We will label these according to the 95Hz column,
- * but of course the actual cutoff frequency depends on ODR.
- */
- typedef enum {
- G_HPCF_7_2 = 0, // 7.2 Hz (if ODR is 95Hz)
- G_HPCF_3_5 = 1,
- G_HPCF_1_8 = 2,
- G_HPCF_0_9 = 3, // 0.9Hz
- G_HPCF_0_45 = 4,
- G_HPCF_0_18 = 5,
- G_HPCF_0_09 = 6,
- G_HPCF_0_045 = 7,
- G_HPCF_0_018 = 8,
- G_HPCF_0_009 = 9
-
- // 10-15 unused
- } G_HPCF_T;
-
- /**
- * CRTL_REG2_G_HPM values
- *
- */
- typedef enum {
- G_HPM_NORMAL_RESET_HPF = 0, // reset reading (HP_RESET_FILTER)
- G_HPM_REFERENCE = 1, // REF signal for filtering
- G_HPM_NORMAL = 2, // normal mode
- G_HPM_AUTORESET_ON_INTR = 3 // autoreset in interrupt event
- } G_HPM_T;
-
- /**
- * Gyro CTRL_REG3_G bits (interrupt G config)
- */
- typedef enum {
- CTRL_REG3_G_I2_EMPTY = 0x01, // FIFO empty on DRDY_G
- CTRL_REG3_G_I2_ORUN = 0x02, // FIFO Overrun intr
- CTRL_REG3_G_I2_WTM = 0x04, // FIFO watermark intr
- CTRL_REG3_G_I2_DRDY = 0x08, // data ready on DRDY_G
- CTRL_REG3_G_PP_OD = 0x10, // push-pull/open drain
- CTRL_REG3_G_H_LACTIVE = 0x20,
- CTRL_REG3_G_I1_BOOT = 0x40,
- CTRL_REG3_G_I1_INT1 = 0x80, // intr enable on INT_G pin
- } CTRL_REG3_G_BITS_T;
-
- /**
- * Gyro CTRL_REG4_G bits
- */
- typedef enum {
- CTRL_REG4_G_SIM = 0x01, // SPI mode selection
-
- CTRL_REG4_G_ST0 = 0x02, // self test enables
- CTRL_REG4_G_ST1 = 0x04,
- _CTRL_REG4_G_ST_MASK = 3,
- _CTRL_REG4_G_ST_SHIFT = 1,
-
- // 0x08 reserved
-
- CTRL_REG4_G_FS0 = 0x10, // full scale selection
- CTRL_REG4_G_FS1 = 0x20,
- _CTRL_REG4_G_FS_MASK = 3,
- _CTRL_REG4_G_FS_SHIFT = 4,
-
- CTRL_REG4_G_BLE = 0x40, // big/little endian data selection
- CTRL_REG4_G_BDU = 0x80 // block data updates
- } CTRL_REG4_G_BITS_T;
-
- /**
- * CRTL_REG4_G_ST values
- *
- */
- typedef enum {
- G_ST_NORMAL = 0, // normal mode
- G_ST_SELFTEST0 = 1, // x+, y-, z-
-
- // 2, reserved
-
- G_ST_SELFTEST1 = 3 // x-, y+, z+
- } G_ST_T;
-
- /**
- * CRTL_REG4_G_FS values
- *
- */
- typedef enum {
- G_FS_245 = 0, // 245 deg/sec
- G_FS_500 = 1,
- G_FS_2000 = 2
- // 3 is also 2000
- } G_FS_T;
-
- /**
- * Gyro CTRL_REG5_G bits
- */
- typedef enum {
- CTRL_REG5_G_OUTSEL0 = 0x01, // see fig. 18 in the datasheet
- CTRL_REG5_G_OUTSEL1 = 0x02,
- _CTRL_REG5_G_OUTSEL_MASK = 3,
- _CTRL_REG5_G_OUTSEL_SHIFT = 0,
-
- CTRL_REG5_G_INT1SEL0 = 0x04, // see fig. 18 in the datasheet
- CTRL_REG5_G_INT1SEL1 = 0x08,
- _CTRL_REG5_G_INT1SEL_MASK = 3,
- _CTRL_REG5_G_INT1SEL_SHIFT = 2,
-
- CTRL_REG5_G_HPEN = 0x10, // HPF enable
-
- // 0x20 reserved
-
- CTRL_REG5_G_FIFO_EN = 0x40,
- CTRL_REG5_G_BOOT = 0x80 // reboot memory content
- } CTRL_REG5_G_BITS_T;
-
-
- /**
- * CRTL_REG5_G_OUTSEL and INT1SEL values. See Figure 18 in the
- * datasheet.
- */
- typedef enum {
- G_INT1OUTSEL_0 = 0,
- G_INT1OUTSEL_1 = 1,
- G_INT1OUTSEL_2 = 2,
- G_INT1OUTSEL_3 = 3
- } G_INT1OUTSEL_T;
-
- /**
- * Gyro STATUS_REG_G bits
- */
- typedef enum {
- STATUS_REG_G_XDA = 0x01, // X axis data available
- STATUS_REG_G_YDA = 0x02,
- STATUS_REG_G_ZDA = 0x04,
- STATUS_REG_G_ZYXDA = 0x08, // X, Y, and Z data available
-
- STATUS_REG_G_XOR = 0x10, // X data overrun
- STATUS_REG_G_YOR = 0x20,
- STATUS_REG_G_ZOR = 0x40,
- STATUS_REG_G_ZYXOR = 0x80
- } STATUS_REG_G_BITS_T;
-
- /**
- * Gyro FIFO_CTRL_REG_G bits
- */
- typedef enum {
- FIFO_CTRL_REG_G_WTM0 = 0x01, // FIFO watermark
- FIFO_CTRL_REG_G_WTM1 = 0x02,
- FIFO_CTRL_REG_G_WTM2 = 0x04,
- FIFO_CTRL_REG_G_WTM3 = 0x08,
- FIFO_CTRL_REG_G_WTM4 = 0x10,
- _FIFO_CTRL_REG_G_WTM_MASK = 31,
- _FIFO_CTRL_REG_G_WTM_SHIFT = 0,
-
- FIFO_CTRL_REG_G_FM0 = 0x20, // FIFO mode config
- FIFO_CTRL_REG_G_FM1 = 0x40,
- FIFO_CTRL_REG_G_FM2 = 0x80,
- _FIFO_CTRL_REG_G_FM_MASK = 7,
- _FIFO_CTRL_REG_G_FM_SHIFT = 5,
- } FIFO_CTRL_REG_G_T;
-
- // FIFO_CTRL_REG_G_WTM (FIFO watermark) is just a numeric value
- // between 0-31, so we won't enumerate those values.
-
- /**
- * FIFO_CTRL_REG_G_FM values (FIFO Modes)
- *
- */
- typedef enum {
- G_FM_BYPASS = 0,
- G_FM_FIFO = 1,
- G_FM_STREAM = 2,
- G_FM_STREAM2FIFO = 3,
- G_FM_BYPASS2STREAM = 4
-
- // 5-7 unused
- } G_FM_T;
-
- /**
- * FIFO_SRC_REG_G bits
- *
- */
- typedef enum {
- FIFO_CTRL_REG_G_FSS0 = 0x01, // FIFO stored data level
- FIFO_CTRL_REG_G_FSS1 = 0x02,
- FIFO_CTRL_REG_G_FSS2 = 0x04,
- FIFO_CTRL_REG_G_FSS3 = 0x08,
- FIFO_CTRL_REG_G_FSS4 = 0x10,
- _FIFO_CTRL_REG_G_FSS_MASK = 31,
- _FIFO_CTRL_REG_G_FSS_SHIFT = 0,
-
- FIFO_CTRL_REG_G_EMPTY = 0x20, // FIFO empty
- FIFO_CTRL_REG_G_OVRN = 0x40, // FIFO overrun
- FIFO_CTRL_REG_G_WTM = 0x80 // watermark status
- } FIFO_SRC_REG_G_BITS_T;
-
- /**
- * INT1_CFG_G bits
- *
- */
- typedef enum {
- INT1_CFG_G_XLIE = 0x01, // X Low event interrupt enable
- INT1_CFG_G_XHIE = 0x02, // X High event interrupt enable
- INT1_CFG_G_YLIE = 0x04,
- INT1_CFG_G_YHIE = 0x08,
- INT1_CFG_G_ZLIE = 0x10,
- INT1_CFG_G_ZHIE = 0x20,
-
- INT1_CFG_G_LIR = 0x40, // latch interrupt request
- INT1_CFG_G_ANDOR = 0x80 // OR or AND interrupt events
- } INT1_CFG_G_BITS_T;
-
- /**
- * INT1_SRC_G bits
- *
- */
- typedef enum {
- INT1_SRC_G_XL = 0x01, // X low interrupt
- INT1_SRC_G_XH = 0x02, // X high interrupt
- INT1_SRC_G_YL = 0x04,
- INT1_SRC_G_YH = 0x08,
- INT1_SRC_G_ZL = 0x10,
- INT1_SRC_G_ZH = 0x20,
-
- INT1_SRC_G_IA = 0x40 // interrupt active
-
- // 0x80 reserved
- } INT1_SRC_G_BITS_T;
-
- // The following registers are for the Accelerometer (A/X),
- // Magnetometer (M), and Temperature device.
-
- /**
- * LSM9DS0 Accelerometer (X) and Magnetometer (M) registers
- */
- typedef enum {
- // 0x00-0x04 reserved
-
- REG_OUT_TEMP_L_XM = 0x05, // temperature
- REG_OUT_TEMP_H_XM = 0x06,
-
- REG_STATUS_REG_M = 0x07,
-
- REG_OUT_X_L_M = 0x08, // magnetometer outputs
- REG_OUT_X_H_M = 0x09,
- REG_OUT_Y_L_M = 0x0a,
- REG_OUT_Y_H_M = 0x0b,
- REG_OUT_Z_L_M = 0x0c,
- REG_OUT_Z_H_M = 0x0d,
-
- // 0x0e reserved
-
- REG_WHO_AM_I_XM = 0x0f,
-
- // 0x10, 0x11 reserved
-
- REG_INT_CTRL_REG_M = 0x12,
- REG_INT_SRC_REG_M = 0x13,
-
- REG_INT_THS_L_M = 0x14, // magnetometer threshold
- REG_INT_THS_H_M = 0x15,
-
- REG_OFFSET_X_L_M = 0x16,
- REG_OFFSET_X_H_M = 0x17,
- REG_OFFSET_Y_L_M = 0x18,
- REG_OFFSET_Y_H_M = 0x19,
- REG_OFFSET_Z_L_M = 0x1a,
- REG_OFFSET_Z_H_M = 0x1b,
-
- REG_REFERENCE_X = 0x1c,
- REG_REFERENCE_Y = 0x1d,
- REG_REFERENCE_Z = 0x1e,
-
- REG_CTRL_REG0_XM = 0x1f,
- REG_CTRL_REG1_XM = 0x20,
- REG_CTRL_REG2_XM = 0x21,
- REG_CTRL_REG3_XM = 0x22,
- REG_CTRL_REG4_XM = 0x23,
- REG_CTRL_REG5_XM = 0x24,
- REG_CTRL_REG6_XM = 0x25,
- REG_CTRL_REG7_XM = 0x26,
-
- REG_STATUS_REG_A = 0x27,
-
- REG_OUT_X_L_A = 0x28, // accelerometer outputs
- REG_OUT_X_H_A = 0x29,
- REG_OUT_Y_L_A = 0x2a,
- REG_OUT_Y_H_A = 0x2b,
- REG_OUT_Z_L_A = 0x2c,
- REG_OUT_Z_H_A = 0x2d,
-
- REG_FIFO_CTRL_REG = 0x2e,
- REG_FIFO_SRC_REG = 0x2f,
-
- REG_INT_GEN_1_REG = 0x30,
- REG_INT_GEN_1_SRC = 0x31,
- REG_INT_GEN_1_THS = 0x32,
- REG_INT_GEN_1_DURATION = 0x33,
-
- REG_INT_GEN_2_REG = 0x34,
- REG_INT_GEN_2_SRC = 0x35,
- REG_INT_GEN_2_THS = 0x36,
- REG_INT_GEN_2_DURATION = 0x37,
-
- REG_CLICK_CFG = 0x38,
- REG_CLICK_SRC = 0x39,
- REG_CLICK_THS = 0x3a,
-
- REG_TIME_LIMIT = 0x3b,
- REG_TIME_LATENCY = 0x3c,
- REG_TIME_WINDOW = 0x3d,
-
- REG_ACT_THS = 0x3e,
- REG_ACT_DUR = 0x3f
- } REG_XM_T;
-
- /**
- * XM STATUS_REG_M bits
- */
- typedef enum {
- STATUS_REG_M_XMDA = 0x01, // X mag axis data available
- STATUS_REG_M_YMDA = 0x02,
- STATUS_REG_M_ZMDA = 0x04,
- STATUS_REG_M_ZYXMDA = 0x08, // X, Y, and Z mag data available
-
- STATUS_REG_M_XMOR = 0x10, // X mag data overrun
- STATUS_REG_M_YMOR = 0x20,
- STATUS_REG_M_ZMOR = 0x40,
- STATUS_REG_M_ZYXMOR = 0x80
- } STATUS_REG_M_BITS_T;
-
- /**
- * INT_CTRL_REG_M bits
- */
- typedef enum {
- INT_CTRL_REG_M_MIEN = 0x01, // mag interrupt enable
- INT_CTRL_REG_M_4D = 0x02,
- INT_CTRL_REG_M_IEL = 0x04, // latch intr request
- INT_CTRL_REG_M_IEA = 0x08,
- INT_CTRL_REG_M_PP_OD = 0x10, // push-pull/open drian
- INT_CTRL_REG_M_ZMIEN = 0x20, // Z mag axis interrupt recognition
- INT_CTRL_REG_M_YMIEN = 0x40,
- INT_CTRL_REG_M_XMIEN = 0x80
- } INT_CTRL_REG_M_BITS_T;
-
- /**
- * INT_SRC_REG_M bits
- */
- typedef enum {
- INT_SRC_REG_M_MINT = 0x01,
- INT_SRC_REG_M_MROI = 0x02,
- INT_SRC_REG_M_NTH_Z = 0x04,
- INT_SRC_REG_M_NTH_Y = 0x08,
- INT_SRC_REG_M_NTH_X = 0x10,
- INT_SRC_REG_M_PTH_Z = 0x20,
- INT_SRC_REG_M_PTH_Y = 0x40,
- INT_SRC_REG_M_PTH_X = 0x80
- } INT_SRC_REG_M_BITS_T;
-
-
- /**
- * CTRL_REG0_XM bits
- */
- typedef enum {
- CTRL_REG0_XM_HPIS2 = 0x01, // HPF enable for int generator 2
- CTRL_REG0_XM_HPIS1 = 0x02,
-
- CTRL_REG0_XM_HP_CLICK = 0x04, // HPF enable for click
-
- // 0x08,0x10 reserved
-
- CTRL_REG0_XM_WTM_LEN = 0x20, // watermark enable
- CTRL_REG0_XM_FIFO_EN = 0x40, // FIFO enable
- CTRL_REG0_XM_BOOT = 0x80 // reboot memory content
- } CTRL_REG0_XM_BITS_T;
-
- /**
- * CTRL_REG1_XM bits
- */
- typedef enum {
- CTRL_REG1_XM_AXEN = 0x01, // accelerometer x axis enable
- CTRL_REG1_XM_AYEN = 0x02,
- CTRL_REG1_XM_AZEN = 0x03,
-
- CTRL_REG1_XM_BDU = 0x04, // block data update
-
- CTRL_REG1_XM_AODR0 = 0x10, // accelerometer output data rate
- CTRL_REG1_XM_AODR1 = 0x20,
- CTRL_REG1_XM_AODR2 = 0x40,
- CTRL_REG1_XM_AODR3 = 0x80,
- _CTRL_REG1_XM_AODR_MASK = 15,
- _CTRL_REG1_XM_AODR_SHIFT = 4
- } CTRL_REG1_XM_BITS_T;
-
- /**
- * CTRL_REG1_XM_AODR values
- */
- typedef enum {
- XM_AODR_PWRDWN = 0, // power down mode
- XM_AODR_3_125 = 1, // 3.125 Hz
- XM_AODR_6_25 = 2,
- XM_AODR_12_5 = 3,
- XM_AODR_25 = 4, // 25Hz
- XM_AODR_50 = 5,
- XM_AODR_100 = 6,
- XM_AODR_200 = 7,
- XM_AODR_400 = 8,
- XM_AODR_800 = 9,
- XM_AODR_1000 = 10
- // 11-15 unused
- } XM_AODR_T;
-
- /**
- * CTRL_REG2_XM bits
- */
- typedef enum {
- CTRL_REG2_XM_SIM = 0x01,
-
- CTRL_REG2_XM_AST0 = 0x02, // accel self-test enable
- CTRL_REG2_XM_AST1 = 0x04,
- _CTRL_REG2_XM_AST_MASK = 3,
- _CTRL_REG2_XM_AST_SHIFT = 1,
-
- CTRL_REG2_XM_AFS0 = 0x08, // accel full scale
- CTRL_REG2_XM_AFS1 = 0x10,
- CTRL_REG2_XM_AFS2 = 0x20,
- _CTRL_REG2_XM_AFS_MASK = 7,
- _CTRL_REG2_XM_AFS_SHIFT = 3,
-
- CTRL_REG2_XM_ABW0 = 0x40, // accel anti-alias filter bandwidth
- CTRL_REG2_XM_ABW1 = 0x80,
- _CTRL_REG2_XM_ABW_MASK = 3,
- _CTRL_REG2_XM_ABW_SHIFT = 6
- } CTRL_REG2_XM_BITS_T;
-
- /**
- * CTRL_REG2_XM_AST values
- */
- typedef enum {
- XM_AST_NORMAL = 0,
- XM_AST_POS_SIGN = 1,
- XM_AST_NEG_SIGN = 2
- // 3 not allowed
- } XM_AST_T;
-
- /**
- * CTRL_REG2_XM_AFS (accel full scale) values
- */
- typedef enum {
- XM_AFS_2 = 0, // 2g
- XM_AFS_4 = 1,
- XM_AFS_6 = 2,
- XM_AFS_8 = 3,
- XM_AFS_16 = 4
-
- // 5-7 not used
- } XM_AFS_T;
-
- /**
- * CTRL_REG2_XM_ABW (accel anti-alias filter bandwidth) values
- */
- typedef enum {
- XM_ABW_773 = 0, // 773Hz
- XM_ABW_194 = 1, // these two might be inverted (typo in ds)
- XM_ABW_362 = 2,
- XM_ABW_50 = 3
- } XM_ABW_T;
-
- /**
- * CTRL_REG3_XM bits
- */
- typedef enum {
- CTRL_REG3_XM_P1_EMPTY = 0x01, // INT1_XM pin enables
- CTRL_REG3_XM_P1_DRDYM = 0x02,
- CTRL_REG3_XM_P1_DRDYA = 0x04,
- CTRL_REG3_XM_P1_INTM = 0x08,
- CTRL_REG3_XM_P1_INT2 = 0x10,
- CTRL_REG3_XM_P1_INT1 = 0x20,
- CTRL_REG3_XM_P1_TAP = 0x40,
- CTRL_REG3_XM_P1_BOOT = 0x80
- } CTRL_REG3_XM_BITS_T;
-
- /**
- * CTRL_REG4_XM bits
- */
- typedef enum {
- CTRL_REG4_XM_P2_WTM = 0x01, // INT2_XM pin enables
- CTRL_REG4_XM_P2_OVERRUN = 0x02,
- CTRL_REG4_XM_P2_DRDYM = 0x04,
- CTRL_REG4_XM_P2_DRDYA = 0x08,
- CTRL_REG4_XM_P2_INTM = 0x10,
- CTRL_REG4_XM_P2_INT2 = 0x20,
- CTRL_REG4_XM_P2_INT1 = 0x40,
- CTRL_REG4_XM_P2_TAP = 0x80
- } CTRL_REG4_XM_BITS_T;
-
- /**
- * CTRL_REG5_XM bits
- */
- typedef enum {
- CTRL_REG5_XM_LIR1 = 0x01, // latch intr 1
- CTRL_REG5_XM_LIR2 = 0x02, // latch intr 2
-
- CTRL_REG5_XM_ODR0 = 0x04, // mag output data rate
- CTRL_REG5_XM_ODR1 = 0x08,
- CTRL_REG5_XM_ODR2 = 0x10,
- _CTRL_REG5_XM_ODR_MASK = 7,
- _CTRL_REG5_XM_ODR_SHIFT = 2,
-
- CTRL_REG5_XM_RES0 = 0x20, // mag resolution
- CTRL_REG5_XM_RES1 = 0x40,
- _CTRL_REG5_XM_RES_MASK = 3,
- _CTRL_REG5_XM_RES_SHIFT = 5,
-
- CTRL_REG5_XM_TEMP_EN = 0x80 // temp sensor enable
- } CTRL_REG5_XM_BITS_T;
-
- /**
- * CTRL_REG5_XM_ODR (magnetometer output data rate) values
- */
- typedef enum {
- XM_ODR_3_125 = 0, // 3.125Hz
- XM_ODR_6_25 = 1,
- XM_ODR_12_5 = 2,
- XM_ODR_25 = 3,
- XM_ODR_50 = 4,
- XM_ODR_100 = 5
-
- // 6, 7 reserved
- } XM_ODR_T;
-
- /**
- * CTRL_REG5_XM_RES (magnetometer resolution) values
- */
- typedef enum {
- XM_RES_LOW = 0, // low resolution
-
- // 1, 2 reserved
-
- XM_RES_HIGH = 3,
- } XM_RES_T;
-
- /**
- * CTRL_REG6_XM bits
- */
- typedef enum {
- // 0x01-0x10 reserved
-
- CTRL_REG6_XM_MFS0 = 0x20,
- CTRL_REG6_XM_MFS1 = 0x40,
- _CTRL_REG6_XM_MFS_MASK = 3,
- _CTRL_REG6_XM_MFS_SHIFT = 5
-
- // 0x80 reserved
- } CTRL_REG6_XM_BITS_T;
-
- /**
- * CTRL_REG6_XM_MFS (magnetometer full scale) values
- */
- typedef enum {
- XM_MFS_2 = 0, // +/- 2 gauss
- XM_MFS_4 = 1,
- XM_MFS_8 = 2,
- XM_MFS_12 = 3
- } XM_MFS_T;
-
- /**
- * CTRL_REG7_XM bits
- */
- typedef enum {
- CTRL_REG7_XM_MD0 = 0x01, // mag sensor mode
- CTRL_REG7_XM_MD1 = 0x02,
- _CTRL_REG7_XM_MD_MASK = 3,
- _CTRL_REG7_XM_MD_SHIFT = 0,
-
- CTRL_REG7_XM_MLP = 0x04, // mag low power mode
-
- // 0x08, 0x10 reserved
-
- CTRL_REG7_XM_AFDS = 0x20, // filtered acceleration data
-
- CTRL_REG7_XM_AHPM0 = 0x40, // accel HPF selection
- CTRL_REG7_XM_AHPM1 = 0x80,
- _CTRL_REG7_XM_AHPM_MASK = 3,
- _CTRL_REG7_XM_AHPM_SHIFT = 6
- } CTRL_REG7_XM_BITS_T;
-
- /**
- * CTRL_REG7_XM_MD (magnetometer sensor mode) values
- */
- typedef enum {
- XM_MD_CONTINUOUS = 0, // continuous conversion
- XM_MD_SINGLE = 1, // single conversion
- XM_MD_POWERDOWN = 2 // power down mode
- // 3 is also power down mode, for some odd reason
- } XM_MD_T;
-
- /**
- * CTRL_REG7_AHPM_MD (accel high-pass filter mode) values
- */
- typedef enum {
- // XM_AHPM_NORMAL_REF: Normal mode (resets x, y and z-axis
- // reading REFERENCE_X (1Ch), REFERENCE_Y (1Dh) and REFERENCE_Y
- // (1Dh) registers respectively)
-
- XM_AHPM_NORMAL_REF = 0,
- XM_AHPM_REFERENCE = 1,
- XM_AHPM_NORMAL = 2,
- XM_AHPM_AUTORESET = 3 // autoreset on interrupt
- } XM_AHPM_T;
-
- /**
- * XM STATUS_REG_A bits
- */
- typedef enum {
- STATUS_REG_A_XADA = 0x01, // X accel axis data available
- STATUS_REG_A_YADA = 0x02,
- STATUS_REG_A_ZADA = 0x04,
- STATUS_REG_A_ZYXADA = 0x08, // X, Y, and Z accel data available
-
- STATUS_REG_A_XAOR = 0x10, // X accel data overrun
- STATUS_REG_A_YAOR = 0x20,
- STATUS_REG_A_ZAOR = 0x40,
- STATUS_REG_A_ZYXAOR = 0x80
- } STATUS_REG_A_BITS_T;
-
- /**
- * XM FIFO_CTRL_REG bits
- */
- typedef enum {
- FIFO_CTRL_REG_FTH0 = 0x01, // FIFO watermark/threshold
- FIFO_CTRL_REG_FTH1 = 0x02,
- FIFO_CTRL_REG_FTH2 = 0x04,
- FIFO_CTRL_REG_FTH3 = 0x08,
- FIFO_CTRL_REG_FTH4 = 0x10,
- _FIFO_CTRL_REG_FTH_MASK = 31,
- _FIFO_CTRL_REG_FTH_SHIFT = 0,
-
- FIFO_CTRL_REG_FM0 = 0x20, // FIFO mode config
- FIFO_CTRL_REG_FM1 = 0x40,
- FIFO_CTRL_REG_FM2 = 0x80,
- _FIFO_CTRL_REG_FM_MASK = 7,
- _FIFO_CTRL_REG_FM_SHIFT = 5,
- } FIFO_CTRL_REG_T;
-
- // FIFO_CTRL_REG_FTH (FIFO watermark/threshold) is just a numeric
- // value between 0-31, so we won't enumerate those values.
-
- /**
- * XM FIFO_CTRL_REG_FM values (FIFO Modes)
- *
- */
- typedef enum {
- FM_BYPASS = 0,
- FM_FIFO = 1,
- FM_STREAM = 2,
- FM_STREAM2FIFO = 3,
- FM_BYPASS2STREAM = 4
-
- // 5-7 unused
- } FM_T;
-
- /**
- * FIFO_SRC_REG bits
- *
- */
- typedef enum {
- FIFO_CTRL_REG_FSS0 = 0x01, // FIFO stored data level
- FIFO_CTRL_REG_FSS1 = 0x02,
- FIFO_CTRL_REG_FSS2 = 0x04,
- FIFO_CTRL_REG_FSS3 = 0x08,
- FIFO_CTRL_REG_FSS4 = 0x10,
- _FIFO_CTRL_REG_FSS_MASK = 31,
- _FIFO_CTRL_REG_FSS_SHIFT = 0,
-
- FIFO_CTRL_REG_EMPTY = 0x20, // FIFO empty
- FIFO_CTRL_REG_OVRN = 0x40, // FIFO overrun
- FIFO_CTRL_REG_WTM = 0x80 // watermark status
- } FIFO_SRC_REG_BITS_T;
-
- /**
- * INT_GEN_1_REG and INT_GEN_2_REG (GEN_X) bits
- *
- */
- typedef enum {
- INT_GEN_X_REG_XLIE_XDOWNE = 0x01, // enable intr on X low or dir recog
- INT_GEN_X_REG_XHIE_XUPE = 0x02,
- INT_GEN_X_REG_YLIE_YDOWNE = 0x04,
- INT_GEN_X_REG_YHIE_YUPE = 0x08,
- INT_GEN_X_REG_ZLIE_ZDOWNE = 0x10,
- INT_GEN_X_REG_ZHIE_ZUPE = 0x20,
- INT_GEN_X_REG_6D = 0x40, // enable 6D direction function
- INT_GEN_X_REG_AOI = 0x80 // AND/OR combination of intrs
- } INT_GEN_X_REG_BITS_T;
-
- /**
- * INT_GEN_1_SRC and INT_GEN_2_SRC (GEN_X) bits
- *
- */
- typedef enum {
- INT_GEN_X_SRC_XL = 0x01,
- INT_GEN_X_SRC_XH = 0x02,
- INT_GEN_X_SRC_YL = 0x04,
- INT_GEN_X_SRC_YH = 0x08,
- INT_GEN_X_SRC_ZL = 0x10,
- INT_GEN_X_SRC_ZH = 0x20,
- INT_GEN_X_SRC_IA = 0x40
- // 0x80 reserved
- } INT_GEN_X_SRC_BITS_T;
-
- /**
- * INT_GEN_1_THS and INT_GEN_2_THS (GEN_X) bits
- *
- */
- typedef enum {
- INT_GEN_X_THS0 = 0x01, // interrupt threshold
- INT_GEN_X_THS1 = 0x02,
- INT_GEN_X_THS2 = 0x04,
- INT_GEN_X_THS3 = 0x08,
- INT_GEN_X_THS4 = 0x10,
- INT_GEN_X_THS5 = 0x20,
- INT_GEN_X_THS6 = 0x40,
- _INT_GEN_X_THS_MASK = 127,
- _INT_GEN_X_THS_SHIFT = 0
- // 0x80 reserved
- } INT_GEN_X_THS_BITS_T;
-
- /**
- * INT_GEN_1_DUR and INT_GEN_2_DUR (GEN_X) bits
- *
- */
- typedef enum {
- INT_GEN_X_DUR0 = 0x01, // interrupt duration
- INT_GEN_X_DUR1 = 0x02,
- INT_GEN_X_DUR2 = 0x04,
- INT_GEN_X_DUR3 = 0x08,
- INT_GEN_X_DUR4 = 0x10,
- INT_GEN_X_DUR5 = 0x20,
- INT_GEN_X_DUR6 = 0x40,
- _INT_GEN_X_DUR_MASK = 127,
- _INT_GEN_X_DUR_SHIFT = 0
- // 0x80 reserved
- } INT_GEN_X_DUR_BITS_T;
-
- /**
- * CLICK_CONFIG bits
- *
- */
- typedef enum {
- CLICK_CONFIG_XS = 0x01, // enable intr single click x
- CLICK_CONFIG_XD = 0x02, // enable intr double click x
- CLICK_CONFIG_YS = 0x04,
- CLICK_CONFIG_YD = 0x08,
- CLICK_CONFIG_ZS = 0x10,
- CLICK_CONFIG_ZD = 0x20
- // 0x40, 0x80 reserved
- } CLICK_CONFIG_BITS_T;
-
- /**
- * CLICK_SRC bits
- *
- */
- typedef enum {
- CLICK_SRC_X = 0x01,
- CLICK_SRC_Y = 0x02,
- CLICK_SRC_Z = 0x04,
- CLICK_SRC_SIGN = 0x08,
- CLICK_SRC_SCLICK = 0x10,
- CLICK_SRC_DCLICK = 0x20,
- CLICK_SRC_IA = 0x40
- // 0x80 reserved
- } CLICK_SRC_BITS_T;
-
- /**
- * CLICK_THS bits
- *
- */
- typedef enum {
- CLICK_THS_THS0 = 0x01, // click threshold
- CLICK_THS_THS1 = 0x02,
- CLICK_THS_THS2 = 0x04,
- CLICK_THS_THS3 = 0x08,
- CLICK_THS_THS4 = 0x10,
- CLICK_THS_THS5 = 0x20,
- CLICK_THS_THS6 = 0x40,
- _CLICK_THS_THS_MASK = 127,
- _CLICK_THS_THS_SHIFT = 0
- // 0x80 reserved
- } CLICK_THS_BITS_T;
-
- /**
- * CLICK_TIME_LIMIT bits
- *
- */
- typedef enum {
- CLICK_TIME_LIMIT_TLI0 = 0x01,
- CLICK_TIME_LIMIT_TLI1 = 0x02,
- CLICK_TIME_LIMIT_TLI2 = 0x04,
- CLICK_TIME_LIMIT_TLI3 = 0x08,
- CLICK_TIME_LIMIT_TLI4 = 0x10,
- CLICK_TIME_LIMIT_TLI5 = 0x20,
- CLICK_TIME_LIMIT_TLI6 = 0x40,
- _CLICK_TIME_LIMIT_TLI_MASK = 127,
- _CLICK_TIME_LIMIT_TLI_SHIFT = 0
- // 0x80 reserved
- } CLICK_TIME_LIMIT_BITS_T;
-
- /**
- * ACT_THS (sleep-to-wake/return-to-sleep activation threshold) bits
- *
- */
- typedef enum {
- ACT_THS_ACTH0 = 0x01, // 1 LSb = 16mg (?)
- ACT_THS_ACTH1 = 0x02,
- ACT_THS_ACTH2 = 0x04,
- ACT_THS_ACTH3 = 0x08,
- ACT_THS_ACTH4 = 0x10,
- ACT_THS_ACTH5 = 0x20,
- ACT_THS_ACTH6 = 0x40,
- _ACT_THS_ACTH_MASK = 127,
- _ACT_THS_ACTH_SHIFT = 0
- // 0x80 reserved
- } ACT_THS_BITS_T;
-
- // Driver specific enumerations
-
- // device enums for read/write regs
- typedef enum {
- DEV_GYRO,
- DEV_XM
- } DEVICE_T;
-
- // interrupt selection for installISR() and uninstallISR()
- typedef enum {
- INTERRUPT_G_INT, // gyroscope interrupt
- INTERRUPT_G_DRDY, // gyroscope data ready interrupt
- INTERRUPT_XM_GEN1, // XM interrupt generator 1
- INTERRUPT_XM_GEN2 // XM interrupt generator 2
- } INTERRUPT_PINS_T;
-
-
- /**
- * lsm9ds0 constructor
- *
- * @param bus i2c bus to use
- * @param address the address for this device
- */
- LSM9DS0(int bus=LSM9DS0_I2C_BUS,
- uint8_t gAddress=LSM9DS0_DEFAULT_GYRO_ADDR,
- uint8_t xmAddress=LSM9DS0_DEFAULT_XM_ADDR);
-
- /**
- * LSM9DS0 Destructor
- */
- ~LSM9DS0();
-
- /**
- * set up initial values and start operation
- *
- * @return true if successful
- */
- bool init();
-
- /**
- * update the accelerometer, gyroscope, magnetometer and
- * termperature values.
- */
- void update();
-
- /**
- * update the gyroscope values only
- */
- void updateGyroscope();
-
- /**
- * update the accelerometer values only
- */
- void updateAccelerometer();
-
- /**
- * update the magnetometer values only
- */
- void updateMagnetometer();
-
- /**
- * update the temperature value only
- */
- void updateTemperature();
-
- /**
- * read a register
- *
- * @param dev the device to access (XM or G)
- * @param reg the register to read
- * @return the value of the register
- */
- uint8_t readReg(DEVICE_T dev, uint8_t reg);
-
- /**
- * read contiguous register into a buffer
- *
- * @param dev the device to access (XM or G)
- * @param reg the register to start reading at
- * @param buf the buffer to store the results
- * @param len the number of registers to read
- * @return the value of the register
- */
- void readRegs(DEVICE_T dev, uint8_t reg, uint8_t *buffer, int len);
-
- /**
- * write to a register
- *
- * @param dev the device to access (XM or G)
- * @param reg the register to write to
- * @param val the value to write
- * @return true if successful, false otherwise
- */
- bool writeReg(DEVICE_T dev, uint8_t reg, uint8_t val);
-
- /**
- * enable or disable the gyro power down mode
- *
- * @param enable true to put device to sleep, false to wake up
- * @return true if successful, false otherwise
- */
- bool setGyroscopePowerDown(bool enable);
-
- /**
- * enable or disable gyroscope axes. If all axis are disabled,
- * and powerdown mode is not set, then the gyro goes into sleep
- * mode.
- *
- * @param axes bit mask of valid axes, (CTRL_REG1_G_YEN, ...)
- * @return true if successful, false otherwise
- */
- bool setGyroscopeEnableAxes(uint8_t axes);
-
- /**
- * set the gyroscope Output Data Rate (ODR)
- *
- * @param odr one of the G_ODR_T values
- * @return true if successful, false otherwise
- */
- bool setGyroscopeODR(G_ODR_T odr);
-
- /**
- * set the scaling mode of the gyroscope
- *
- * @param scale one of the G_FS_T values
- * @return true if successful, false otherwise
- */
- bool setGyroscopeScale(G_FS_T scale);
-
- /**
- * enable or disable accelerometer axes.
- *
- * @param axes bit mask of valid axes, (CTRL_REG1_XM_AXEN, ...)
- * @return true if successful, false otherwise
- */
- bool setAccelerometerEnableAxes(uint8_t axes);
-
- /**
- * set the accelerometer Output Data Rate (ODR)
- *
- * @param odr one of the XM_AODR_T values
- * @return true if successful, false otherwise
- */
- bool setAccelerometerODR(XM_AODR_T odr);
-
- /**
- * set the scaling mode of the accelerometer
- *
- * @param scale one of the XM_AFS_T values
- * @return true if successful, false otherwise
- */
- bool setAccelerometerScale(XM_AFS_T scale);
-
- /**
- * set the magnetometer resolution
- *
- * @param res one of the XM_RES_T values
- * @return true if successful, false otherwise
- */
- bool setMagnetometerResolution(XM_RES_T res);
-
- /**
- * set the magnetometer Output Data Rate (ODR)
- *
- * @param odr one of the XM_ODR_T values
- * @return true if successful, false otherwise
- */
- bool setMagnetometerODR(XM_ODR_T odr);
-
- /**
- * set the magnetometer sensor mode
- *
- * @param mode one of the XM_MD_T values
- * @return true if successful, false otherwise
- */
- bool setMagnetometerMode(XM_MD_T mode);
-
- /**
- * enable or disable magnetometer low power mode (LPM). When in
- * low power mode, the magnetometer updates at 3.125Hz, regardless
- * of it's ODR setting.
- *
- * @param enable true to enable LPM, false otherwise
- * @return true if successful, false otherwise
- */
- bool setMagnetometerLPM(bool enable);
-
- /**
- * set the scaling mode of the magnetometer
- *
- * @param scale one of the XM_MFS_T values
- * @return true if successful, false otherwise
- */
- bool setMagnetometerScale(XM_MFS_T scale);
-
- /**
- * get the accelerometer values in gravities
- *
- * @param x the returned x value, if arg is non-NULL
- * @param y the returned y value, if arg is non-NULL
- * @param z the returned z value, if arg is non-NULL
- * @return true if successful, false otherwise
- */
- void getAccelerometer(float *x, float *y, float *z);
-
- /**
- * get the gyroscope values in degrees per second
- *
- * @param x the returned x value, if arg is non-NULL
- * @param y the returned y value, if arg is non-NULL
- * @param z the returned z value, if arg is non-NULL
- * @return true if successful, false otherwise
- */
- void getGyroscope(float *x, float *y, float *z);
-
- /**
- * get the magnetometer values in gauss
- *
- * @param x the returned x value, if arg is non-NULL
- * @param y the returned y value, if arg is non-NULL
- * @param z the returned z value, if arg is non-NULL
- * @return true if successful, false otherwise
- */
- void getMagnetometer(float *x, float *y, float *z);
-
-#if defined(SWIGJAVA) || defined(JAVACALLBACK)
- /**
- * get the accelerometer values in gravities
- *
- * @return Array containing X, Y, Z acceleration values
- */
- float *getAccelerometer();
-
- /**
- * get the gyroscope values in degrees per second
- *
- * @return Array containing X, Y, Z gyroscope values
- */
- float *getGyroscope();
-
- /**
- * get the magnetometer values in gauss
- *
- * @return Array containing X, Y, Z magnetometer values
- */
- float *getMagnetometer();
-#endif
-
- /**
- * get the temperature value. Unfortunately the datasheet does
- * not provide a mechanism to convert the temperature value into
- * the correct value, so I made a 'guess'. If it's wrong, and you
- * figure it out, send a patch!
- *
- * @return the temperature value in degrees Celcius
- */
- float getTemperature();
-
- /**
- * enable onboard temperature measurement sensor
- *
- * @param enable true to enable temperature sensor, false to disable
- * @return true if successful, false otherwise
- */
- bool enableTemperatureSensor(bool enable);
-
- /**
- * return the gyroscope status register
- *
- * @return bitmask of STATUS_REG_G_BITS_T bits
- */
- uint8_t getGyroscopeStatus();
-
- /**
- * return the magnetometer status register
- *
- * @return bitmask of STATUS_REG_M_BITS_T bits
- */
- uint8_t getMagnetometerStatus();
-
- /**
- * return the accelerometer status register
- *
- * @return bitmask of STATUS_REG_A_BITS_T bits
- */
- uint8_t getAccelerometerStatus();
-
- /**
- * return the gyroscope interrupt config register
- *
- * @return bitmask of INT1_CFG_G_BITS_T bits
- */
- uint8_t getGyroscopeInterruptConfig();
-
- /**
- * set the gyroscope interrupt config register
- *
- * @param enables bitmask of INT1_CFG_G_BITS_T values
- * @return true if successful
- */
- bool setGyroscopeInterruptConfig(uint8_t enables);
-
- /**
- * return the gyroscope interrupt src register
- *
- * @return bitmask of INT1_SRC_G_BITS_T bits
- */
- uint8_t getGyroscopeInterruptSrc();
-
- /**
- * return the magnetometer interrupt control register
- *
- * @return bitmask of INT_CTRL_REG_M_BITS_T bits
- */
- uint8_t getMagnetometerInterruptControl();
-
- /**
- * set the magnetometer interrupt control register
- *
- * @param enables bitmask of INT_CTRL_REG_M_BITS_T values
- * @return true if successful
- */
- bool setMagnetometerInterruptControl(uint8_t enables);
-
- /**
- * return the magnetometer interrupt src register
- *
- * @return bitmask of INT_SRC_REG_M_BITS_T bits
- */
- uint8_t getMagnetometerInterruptSrc();
-
- /**
- * return the inertial interrupt generator 1 register
- *
- * @return bitmask of INT_GEN_X_REG_BITS_T bits
- */
- uint8_t getInterruptGen1();
-
- /**
- * set the inertial interrupt generator 1 register
- *
- * @param enables bitmask of INT_GEN_X_REG_BITS_T values
- * @return true if successful
- */
- bool setInterruptGen1(uint8_t enables);
-
- /**
- * return the inertial interrupt generator 1 src register
- *
- * @return bitmask of INT_GEN_X_SRC_BITS_T bits
- */
- uint8_t getInterruptGen1Src();
-
- /**
- * return the inertial interrupt generator 2 register
- *
- * @return bitmask of INT_GEN_X_REG_BITS_T bits
- */
- uint8_t getInterruptGen2();
-
- /**
- * set the inertial interrupt generator 2 register
- *
- * @param enables bitmask of INT_GEN_X_REG_BITS_T values
- * @return true if successful
- */
- bool setInterruptGen2(uint8_t enables);
-
- /**
- * return the inertial interrupt generator 2 src register
- *
- * @return bitmask of INT_GEN_X_SRC_BITS_T bits
- */
- uint8_t getInterruptGen2Src();
-
-#if defined(SWIGJAVA) || defined(JAVACALLBACK)
- void installISR(INTERRUPT_PINS_T intr, int gpio, mraa::Edge level,
- jobject runnable);
-#else
- /**
- * install an interrupt handler.
- *
- * @param intr one of the INTERRUPT_PINS_T values specifying which
- * interrupt pin out of 4 you are installing
- * @param gpio gpio pin to use as interrupt pin
- * @param level the interrupt trigger level (one of mraa::Edge
- * values). Make sure that you have configured the interrupt pin
- * properly for whatever level you choose.
- * @param isr the interrupt handler, accepting a void * argument
- * @param arg the argument to pass the the interrupt handler
- */
- void installISR(INTERRUPT_PINS_T intr, int gpio, mraa::Edge level,
- void (*isr)(void *), void *arg);
-#endif
- /**
- * uninstall a previously installed interrupt handler
- *
- * @param intr one of the INTERRUPT_PINS_T values specifying which
- * interrupt pin out of 4 you are uninstalling
- */
- void uninstallISR(INTERRUPT_PINS_T intr);
-
- protected:
- // uncompensated accelerometer and gyroscope values
- float m_accelX;
- float m_accelY;
- float m_accelZ;
-
- float m_gyroX;
- float m_gyroY;
- float m_gyroZ;
-
- float m_magX;
- float m_magY;
- float m_magZ;
-
- // uncompensated temperature value
- float m_temp;
-
- // accelerometer and gyro scaling factors, depending on their Full
- // Scale settings.
- float m_accelScale;
- float m_gyroScale;
- float m_magScale;
-
- private:
- // OR'd with a register, this enables register autoincrement mode,
- // which we need.
- static const uint8_t m_autoIncrementMode = 0x80;
-
- mraa::I2c m_i2cG;
- mraa::I2c m_i2cXM;
- uint8_t m_gAddr;
- uint8_t m_xmAddr;
-
- // return a reference to a gpio pin pointer depending on intr
- mraa::Gpio*& getPin(INTERRUPT_PINS_T intr);
-
- // possible interrupt pins
- mraa::Gpio *m_gpioG_INT;
- mraa::Gpio *m_gpioG_DRDY;
- mraa::Gpio *m_gpioXM_GEN1;
- mraa::Gpio *m_gpioXM_GEN2;
- };
-}
-
-
diff --git a/peripheral/libupm/src/lsm9ds0/pyupm_lsm9ds0.i b/peripheral/libupm/src/lsm9ds0/pyupm_lsm9ds0.i
deleted file mode 100644
index 7472a9d..0000000
--- a/peripheral/libupm/src/lsm9ds0/pyupm_lsm9ds0.i
+++ /dev/null
@@ -1,17 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_lsm9ds0
-%include "../upm.i"
-%include "cpointer.i"
-
-%include "stdint.i"
-
-%feature("autodoc", "3");
-
-%pointer_functions(float, floatp);
-
-%include "lsm9ds0.h"
-%{
- #include "lsm9ds0.h"
-%}
-
diff --git a/peripheral/libupm/src/m24lr64e/CMakeLists.txt b/peripheral/libupm/src/m24lr64e/CMakeLists.txt
deleted file mode 100644
index 57daeac..0000000
--- a/peripheral/libupm/src/m24lr64e/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "m24lr64e")
-set (libdescription "upm m24lr64e grove NFC tag")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/m24lr64e/javaupm_m24lr64e.i b/peripheral/libupm/src/m24lr64e/javaupm_m24lr64e.i
deleted file mode 100644
index 185e7e5..0000000
--- a/peripheral/libupm/src/m24lr64e/javaupm_m24lr64e.i
+++ /dev/null
@@ -1,37 +0,0 @@
-%module javaupm_m24lr64e
-%include "../upm.i"
-%include "stdint.i"
-%include "arrays_java.i";
-%include "../java_buffer.i"
-
-%typemap(jni) uint8_t * "jbyteArray"
-%typemap(jtype) uint8_t * "byte[]"
-%typemap(jstype) uint8_t * "byte[]"
-
-%typemap(javaout) uint8_t * {
- return $jnicall;
-}
-
-%typemap(out) uint8_t *{
- int length = upm::M24LR64E::UID_LENGTH;
- $result = JCALL1(NewByteArray, jenv, length);
- JCALL4(SetByteArrayRegion, jenv, $result, 0, length, reinterpret_cast<signed char *>($1));
- delete [] $1;
-}
-
-%{
- #include "m24lr64e.h"
-%}
-
-%include "m24lr64e.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_m24lr64e");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/m24lr64e/jsupm_m24lr64e.i b/peripheral/libupm/src/m24lr64e/jsupm_m24lr64e.i
deleted file mode 100644
index 8e1993c..0000000
--- a/peripheral/libupm/src/m24lr64e/jsupm_m24lr64e.i
+++ /dev/null
@@ -1,10 +0,0 @@
-%module jsupm_m24lr64e
-%include "../upm.i"
-
-%include "stdint.i"
-
-%{
- #include "m24lr64e.h"
-%}
-
-%include "m24lr64e.h"
diff --git a/peripheral/libupm/src/m24lr64e/m24lr64e.cxx b/peripheral/libupm/src/m24lr64e/m24lr64e.cxx
deleted file mode 100644
index 633d5e7..0000000
--- a/peripheral/libupm/src/m24lr64e/m24lr64e.cxx
+++ /dev/null
@@ -1,306 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <math.h>
-#include <iostream>
-#include <string>
-
-#include "m24lr64e.h"
-
-using namespace upm;
-using namespace std;
-
-
-M24LR64E::M24LR64E(int bus, AccessMode mode):
- m_i2c(bus)
-{
- if (mode == USER_MODE)
- m_addr = M24LR64E_DEFAULT_I2C_ADDR;
- else
- m_addr = M24LR64E_DEFAULT_I2C_ADDR_E2;
-
- mraa::Result rv;
- if ( (rv = m_i2c.address(m_addr)) != mraa::SUCCESS)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": I2c.address() failed");
- return;
- }
-}
-
-M24LR64E::~M24LR64E()
-{
-}
-
-bool M24LR64E::submitPasswd(uint32_t passwd)
-{
- // this device actually uses two bytes to address a register
- const int pktLen = 11;
- uint8_t buf[pktLen];
-
- buf[0] = 0x09;
- buf[1] = 0x00;
-
- buf[2] = ((passwd >> 24) & 0xff);
- buf[3] = ((passwd >> 16) & 0xff);
- buf[4] = ((passwd >> 8) & 0xff);
- buf[5] = (passwd & 0xff);
-
- buf[6] = 0x09;
-
- // the password is written twice
- buf[7] = ((passwd >> 24) & 0xff);
- buf[8] = ((passwd >> 16) & 0xff);
- buf[9] = ((passwd >> 8) & 0xff);
- buf[10] = (passwd & 0xff);
-
- if (m_i2c.write(buf, pktLen))
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": I2c.write() failed");
- return false;
- }
-
- return true;
-}
-
-bool M24LR64E::writePasswd(uint32_t passwd)
-{
- const int pktLen = 11;
- uint8_t buf[pktLen];
-
- buf[0] = 0x09;
- buf[1] = 0x00;
-
- buf[2] = ((passwd >> 24) & 0xff);
- buf[3] = ((passwd >> 16) & 0xff);
- buf[4] = ((passwd >> 8) & 0xff);
- buf[5] = (passwd & 0xff);
-
- buf[6] = 0x07;
-
- // the password is written twice
- buf[7] = ((passwd >> 24) & 0xff);
- buf[8] = ((passwd >> 16) & 0xff);
- buf[9] = ((passwd >> 8) & 0xff);
- buf[10] = (passwd & 0xff);
-
- if (m_i2c.write(buf, pktLen))
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": I2c.write() failed");
- return false;
- }
-
- return true;
-}
-
-void M24LR64E::sectorProtectConfig(unsigned int sectorNumber,
- bool protectEnable,
- SectorAccessRight accessRight,
- SectorSelectPassWd passwd)
-{
- if(!protectEnable) {
- EEPROM_Write_Byte(sectorNumber,0x0);
- } else {
- EEPROM_Write_Byte(sectorNumber,
- protectEnable | (accessRight<<1) |(passwd<<2));
- }
-}
-
-void M24LR64E::clearSectorProtect(void)
-{
- uint8_t buf[64]={0x0};
- EEPROM_Write_Bytes(0, buf, 64);
-}
-
-
-void M24LR64E::sectorWriteLockBit(unsigned int sectorNumber,
- bool sockEnable)
-{
- unsigned int sectorAddress = SECTOR_SECURITY_STATUS_BASE_ADDR
- + (sectorNumber/8);
- uint8_t sectorBit = sectorNumber % 8;
- uint8_t preStatus = EEPROM_Read_Byte(sectorAddress);
-
- bool status = (preStatus >> sectorBit) & 0x01;
- if(status != sockEnable) {
- if(status == true) {
- writeByte(sectorAddress,preStatus&(~(1<<sectorBit)));
- } else {
- writeByte(sectorAddress,preStatus|(1<<sectorBit));
- }
- }
-}
-
-uint8_t M24LR64E::getDSFID()
-{
- return EEPROM_Read_Byte(DSFID_ADDR);
-}
-
-uint8_t M24LR64E::getAFI()
-{
- return EEPROM_Read_Byte(AFI_ADDR);
-}
-
-uint8_t *M24LR64E::getUID()
-{
- uint8_t* buffer = new uint8_t[UID_LENGTH];
- EEPROM_Read_Bytes(UID_ADDR, buffer, UID_LENGTH);
-
- return buffer;
-}
-
-uint32_t M24LR64E::getMemorySize()
-{
- uint32_t volume = 0x0;
- volume = EEPROM_Read_Byte(MEM_SIZE_ADDR);
- volume = volume<<8|EEPROM_Read_Byte(MEM_SIZE_ADDR+1);
- volume = volume<<8|EEPROM_Read_Byte(MEM_SIZE_ADDR+2);
- return volume;
-}
-
-void M24LR64E::clearMemory()
-{
- for(int i = 0; i < EEPROM_I2C_LENGTH; i++){
- writeByte(i,0x0);
- }
-}
-
-mraa::Result M24LR64E::writeByte(unsigned int address, uint8_t data)
-{
- return EEPROM_Write_Byte(address, data);
-}
-
-mraa::Result M24LR64E::writeBytes(unsigned int address, uint8_t* buffer, int len)
-{
- return EEPROM_Write_Bytes(address, buffer, len);
-}
-
-uint8_t M24LR64E::readByte(unsigned int address)
-{
- return EEPROM_Read_Byte(address);
-}
-
-int M24LR64E::readBytes(unsigned int address, uint8_t* buffer, int len)
-{
- return EEPROM_Read_Bytes(address, buffer, len);
-}
-
-mraa::Result M24LR64E::EEPROM_Write_Byte(unsigned int address, uint8_t data)
-{
- const int pktLen = 3;
- uint8_t buf[pktLen];
- mraa::Result rv;
-
- buf[0] = ((address >> 8) & 0xff);
- buf[1] = (address & 0xff);
- buf[2] = data;
-
- if ((rv = m_i2c.write(buf, pktLen)))
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": I2c.write() failed");
-
- usleep(I2C_WRITE_TIME * 1000);
- return rv;
-}
-
-mraa::Result M24LR64E::EEPROM_Write_Bytes(unsigned int address, uint8_t* data,
- int len)
-{
- const int pktLen = 2 + len;
- uint8_t buf[pktLen];
- mraa::Result rv;
-
- buf[0] = ((address >> 8) & 0xff);
- buf[1] = (address & 0xff);
-
- for (int i=0; i<len; i++)
- buf[2+i] = data[i];
-
- if ((rv = m_i2c.write(buf, pktLen)))
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": I2c.write() failed");
-
- usleep(I2C_WRITE_TIME * 1000);
-
- return rv;
-}
-
-uint8_t M24LR64E::EEPROM_Read_Byte(unsigned int address)
-{
- const int apktLen = 2;
- uint8_t abuf[apktLen];
-
- abuf[0] = ((address >> 8) & 0xff);
- abuf[1] = (address & 0xff);
-
- if (m_i2c.write(abuf, apktLen))
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": I2c.write() failed");
- return 0x00;
- }
-
- const int pktLen = 1;
- uint8_t buf[apktLen];
-
- buf[0] = 0;
-
- if (m_i2c.read(buf, pktLen) != pktLen)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": I2c.write() failed");
- return 0x00;
- }
-
- return buf[0];
-}
-
-int M24LR64E::EEPROM_Read_Bytes(unsigned int address,
- uint8_t* buffer, int len)
-{
- const int apktLen = 2;
- uint8_t abuf[apktLen];
-
- abuf[0] = ((address >> 8) & 0xff);
- abuf[1] = (address & 0xff);
-
- if (m_i2c.write(abuf, apktLen))
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": I2c.write() failed");
- return false;
- }
-
- int rv = m_i2c.read(buffer, len);
- if (rv != len)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": I2c.read() failed");
- }
-
- return rv;
-}
diff --git a/peripheral/libupm/src/m24lr64e/m24lr64e.h b/peripheral/libupm/src/m24lr64e/m24lr64e.h
deleted file mode 100644
index ffdaf25..0000000
--- a/peripheral/libupm/src/m24lr64e/m24lr64e.h
+++ /dev/null
@@ -1,285 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- *
- * This code was adapted from the Seeed Studio code at:
- * https://github.com/Seeed-Studio/NFC_Tag_M24LR6E
- *
- * Copyright (c) 2014 seeed technology inc.
- * Website : www.seeed.cc
- * Author : lawliet zou
- * Create Time: March 2014
- *
- * 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 <string>
-#include <mraa/common.hpp>
-#include <mraa/i2c.hpp>
-
-#define M24LR64E_I2C_BUS 0
-#define M24LR64E_DEFAULT_I2C_ADDR 0x53
-#define M24LR64E_DEFAULT_I2C_ADDR_E2 (M24LR64E_DEFAULT_I2C_ADDR | 0x04)
-
-namespace upm {
-
- /**
- * @brief Grove NFC Tag
- * @defgroup m24lr64e libupm-m24lr64e
- * @ingroup seeed i2c other
- */
-
- /**
- * @library m24lr64e
- * @sensor m24lr64e
- * @comname Grove NFC Tag
- * @type other
- * @man seeed
- * @web http://www.seeedstudio.com/wiki/Grove_-_NFC_Tag
- * @con i2c
- *
- * @brief C++ API for the M24LR64E-based Grove NFC Tag
- *
- * Grove NFC tag is an 8KB electrically erasable programmable read-only memory (EEPROM)
- * that can be written to or read from using I2C and NFC-equipped devices.
- *
- * The user mode (default) allows read and write access to all 8KB
- * of space, provided the sector security status (SSS) allows it.
- * The root mode allows modification of the SSS data and other
- * information, provided the proper password is submitted. The
- * default password for a new tag is 0x00000000. See the datasheet
- * for more details.
- *
- * The Seeed Studio* wiki page for this device includes a link to an
- * Android* application that can be used to also read and write the
- * device via NFC, as well as set NFC passwords, which cannot be
- * done via I2C.
- *
- * @image html m24lr64e.jpg
- * @snippet m24lr64e.cxx Interesting
- */
- class M24LR64E {
- public:
-
- static const int EEPROM_I2C_LENGTH = 8192;
- static const int PASSWORD_LENGTH = 4;
- static const int SECTOR_SECURITY_STATUS_BASE_ADDR = 0x800; // 2048
-
- static const uint8_t LOCK_PROTECT_BIT = 0x01;
- static const uint8_t WRITE_READ_PROTECT_BIT = 0x02;
- static const uint8_t PASSWORD_CTRL_BIT = 0x04;
-
- static const int UID_LENGTH = 8; // bytes
-
- static const unsigned int I2C_WRITE_TIME = 5; // 5ms
-
- /**
- * M24LR64E addresses, accessible only in the root mode
- */
- typedef enum {
- I2C_PASSWORD_ADDR = 2304,
- RF_PASSWORD_1_ADDR = 2308, // RF pwds not available in
- RF_PASSWORD_2_ADDR = 2312, // I2C access modes
- RF_PASSWORD_3_ADDR = 2316,
- DSFID_ADDR = 2320, // 1 byte
- AFI_ADDR = 2321, // 1 byte
- RESV_ADDR = 2322, // 1 bytes
- CONFIG_ADDR = 2323, // 1 bytes
- UID_ADDR = 2324, // 8 bytes
- MEM_SIZE_ADDR = 2332, // 3 bytes
- IC_REF_ADDR = 2335, // 1 byte
- PROG_COMP_ENERGY_HARVEST_ADDR = 2339 // 1 byte
- } M24LR64E_ADDR_T;
-
- enum AccessMode {
- USER_MODE = 0x0, // offers simple read/write access right
- ROOT_MODE = 0x1 // offers password change access right
- };
-
- enum SectorAccessRight {
- // **********************************
- // * submit passWd * no submit *
- //b2,b1 * Read * Write * Read * Write *
- // 00 * 1 1 1 0 *
- // 01 * 1 1 1 1 *
- // 10 * 1 1 0 0 *
- // 11 * 0 1 0 0 *
- // **********************************
- Access_1110 = 0,
- Access_1111 = 1,
- Access_1100 = 2,
- Access_0111 = 3,
- };
-
- enum SectorSelectPassWd {
- //00 => no passwd protect
- //01 => passWd 1
- //10 => passWd 2
- //11 => passwd 3
- noPasswd = 0,
- passwd_1 = 1,
- passwd_2 = 2,
- passwd_3 = 3,
- };
-
- /**
- * M24LR64E constructor
- *
- * @param bus I2C bus to use
- * @param mode Access mode (user or root) to use
- */
- M24LR64E(int bus, AccessMode mode = USER_MODE);
-
- /**
- * M24LR64E destructor
- */
- ~M24LR64E();
-
- /**
- * Submits an I2C access password
- *
- * @param passwd 4-byte access password
- */
- bool submitPasswd(uint32_t passwd);
-
- /**
- * Writes a new I2C password
- *
- * @param passwd 4-byte access password
- */
- bool writePasswd(uint32_t passwd);
-
- /**
- * Sets a protection bit for a sector. Must be in the root mode
- *
- * @param sectorNumber Sector whose protection you are modifying
- * @param protectEnable True if you are enabling protection
- * @param accessRight Access rights to set
- * @param passwd Password number to enable, if any
- */
- void sectorProtectConfig(unsigned int sectorNumber,
- bool protectEnable,
- SectorAccessRight accessRight,
- SectorSelectPassWd passwd);
-
- /**
- * Clears sector protection bits. Must be in the root mode.
- */
- void clearSectorProtect(void);
-
- /**
- * Sets or clears a sector security status lock bit for a sector.
- * Must be in the root mode.
- *
- * @param sectorNumber Sector whose SSS you want to modify
- * @param sockEnable True to set the bit, false to clear it
- */
- void sectorWriteLockBit(unsigned int sectorNumber,
- bool sockEnable);
-
- /**
- * Returns a data storage family identifier (DSFID)
- * Must be in the root mode.
- *
- * @return DSFID
- */
- uint8_t getDSFID();
-
- /**
- * Returns an application family identifier (AFI)
- * Must be in the root mode.
- *
- * @return AFI
- */
- uint8_t getAFI();
-
- /**
- * Returns a unique ID.
- * Must be in the root mode.
- * Maintained to preserve compatibility with older code.
- *
- * @result buf Buffer to hold the UID. Must be UID_LENGTH bytes.
- */
- uint8_t *getUID();
-
- /**
- * Returns the memory size
- * Must be in the root mode.
- *
- * @return Amount of memory present
- */
- uint32_t getMemorySize();
-
- /**
- * Sets all memory to 0, if permissions allow
- */
- void clearMemory();
-
- /**
- * Writes a byte to the EEPROM
- *
- * @param address Address to write to
- * @param data Data to write
- */
- mraa::Result writeByte(unsigned int address, uint8_t data);
-
- /**
- * Writes bytes to the EEPROM
- *
- * @param address Address to write to
- * @param data Data to write
- * @param data Length of the data buffer
- */
- mraa::Result writeBytes(unsigned int address, uint8_t* buffer, int len);
-
- /**
- * Reads a byte from the EEPROM
- *
- * @param address Address to read from
- * @return data Value read
- */
- uint8_t readByte(unsigned int address);
-
- /**
- * Reads multiple bytes from the EEPROM
- *
- * @param address Address to read from
- * @param buffer Buffer to store data
- * @param len Number of bytes to read
- */
- int readBytes(unsigned int address, uint8_t* buffer, int len);
-
- protected:
- mraa::I2c m_i2c;
- mraa::Result EEPROM_Write_Byte(unsigned int address, uint8_t data);
- mraa::Result EEPROM_Write_Bytes(unsigned int address, uint8_t* data,
- int len);
- uint8_t EEPROM_Read_Byte(unsigned int address);
- int EEPROM_Read_Bytes(unsigned int address,
- uint8_t* buffer, int len);
-
- private:
- uint8_t m_addr;
- };
-}
-
-
diff --git a/peripheral/libupm/src/m24lr64e/pyupm_m24lr64e.i b/peripheral/libupm/src/m24lr64e/pyupm_m24lr64e.i
deleted file mode 100644
index 7b70298..0000000
--- a/peripheral/libupm/src/m24lr64e/pyupm_m24lr64e.i
+++ /dev/null
@@ -1,17 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_m24lr64e
-%include "../upm.i"
-
-%include "stdint.i"
-
-%feature("autodoc", "3");
-
-#ifdef DOXYGEN
-%include "m24lr64e_doc.i"
-#endif
-
-%include "m24lr64e.h"
-%{
- #include "m24lr64e.h"
-%}
diff --git a/peripheral/libupm/src/max31723/CMakeLists.txt b/peripheral/libupm/src/max31723/CMakeLists.txt
deleted file mode 100644
index 911b374..0000000
--- a/peripheral/libupm/src/max31723/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "max31723")
-set (libdescription "Very accurate temperature sensor")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/max31723/javaupm_max31723.i b/peripheral/libupm/src/max31723/javaupm_max31723.i
deleted file mode 100644
index 419a34a..0000000
--- a/peripheral/libupm/src/max31723/javaupm_max31723.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_max31723
-%include "../upm.i"
-
-%{
- #include "max31723.h"
-%}
-
-%include "max31723.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_max31723");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/max31723/jsupm_max31723.i b/peripheral/libupm/src/max31723/jsupm_max31723.i
deleted file mode 100644
index e35ead5..0000000
--- a/peripheral/libupm/src/max31723/jsupm_max31723.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_max31723
-%include "../upm.i"
-
-%{
- #include "max31723.h"
-%}
-
-%include "max31723.h"
diff --git a/peripheral/libupm/src/max31723/max31723.cxx b/peripheral/libupm/src/max31723/max31723.cxx
deleted file mode 100644
index 133a44d..0000000
--- a/peripheral/libupm/src/max31723/max31723.cxx
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdexcept>
-
-#include "max31723.h"
-
-using namespace upm;
-
-MAX31723::MAX31723 (int csn) : m_csnPinCtx(csn), m_spi(0) {
- mraa::Result error = mraa::SUCCESS;
- m_name = "MAX31723";
-
- error = m_csnPinCtx.dir (mraa::DIR_OUT);
- if (error != mraa::SUCCESS) {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": m_csnPinCtx.dir() failed");
- }
-
- CSOff ();
-
- // set spi mode to mode2 (CPOL = 1, CPHA = 0)
- m_spi.mode (mraa::SPI_MODE2);
- // set ontinuously perform temperature conversions
- writeRegister (R_STS_WRITE_CMD, B_CONT_READING);
-}
-
-short
-MAX31723::getTemperature () {
- uint8_t lsb = 0;
- uint8_t msb = 0;
- short temperature = 0;
-
- lsb = readRegister (R_TEMPERATURE_LSB);
- msb = readRegister (R_TEMPERATURE_MSB);
-
- if ((msb & 0x80) != 0) {
- msb &= 0x7F;
- temperature = 0 - msb;
-
- } else {
- temperature = msb;
- }
-
- return temperature;
-}
-
-/*
- * **************
- * private area
- * **************
- */
-
-uint8_t
-MAX31723::readRegister (uint8_t reg) {
- uint8_t data[2] = { 0x00, 0x00 };
- uint8_t* sensorData = NULL;
-
- CSOn ();
- data[0] = reg;
- sensorData = m_spi.write(data, 2);
- CSOff ();
-
- return sensorData[1];
-}
-
-void
-MAX31723::writeRegister (uint8_t reg, uint8_t data) {
- uint8_t buffer[2] = { 0x00, 0x00 };
- uint8_t* sensorData = NULL;
-
- CSOn ();
- buffer[0] = reg;
- buffer[1] = data;
- sensorData = m_spi.write(buffer, 2);
- CSOff ();
-}
-
-mraa::Result
-MAX31723::CSOn () {
- return m_csnPinCtx.write (HIGH);
-}
-
-mraa::Result
-MAX31723::CSOff () {
- return m_csnPinCtx.write (LOW);
-}
diff --git a/peripheral/libupm/src/max31723/max31723.h b/peripheral/libupm/src/max31723/max31723.h
deleted file mode 100644
index 9aaaca2..0000000
--- a/peripheral/libupm/src/max31723/max31723.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include <mraa/aio.hpp>
-
-#include <mraa/gpio.hpp>
-
-#include <mraa/spi.hpp>
-
-#define HIGH 1
-#define LOW 0
-
-namespace upm {
-
-/**
- * @brief MAX31723 Temperature Sensor library
- * @defgroup max31723 libupm-max31723
- * @ingroup maxim spi temperature
- */
-/**
- * @library max31723
- * @sensor max31723
- * @comname MAX31723 Temperature Sensor
- * @type temperature
- * @man maxim
- * @con spi
- *
- * @brief API for the MAX31723 Temperature Sensor
- *
- * Maxim Integrated*
- * [MAX31723](http://datasheets.maximintegrated.com/en/ds/MAX31722-MAX31723.pdf)
- * is a low-voltage 3-wire/SPI temperature sensor controller. This module was
- * tested on the Maxim Integrated [MAX31732PMB1 PMOD
- * module](http://datasheets.maximintegrated.com/en/ds/MAX31723PMB1.pdf) from
- * the analog PMOD kit.
- *
- * @snippet max31723.cxx Interesting
- */
-class MAX31723 {
- public:
- static const uint8_t R_STS_READ_CMD = 0x00;
- static const uint8_t R_STS_WRITE_CMD = 0x80;
- static const uint8_t R_TEMPERATURE_LSB = 0x01;
- static const uint8_t R_TEMPERATURE_MSB = 0x02;
-
- static const uint8_t B_CONT_READING = 0x00;
-
- /**
- * Instantiates an MAX31723 object
- *
- * @param bus Number of the used bus
- * @param devAddr Address of the used I2C device
- */
- MAX31723 (int csn);
-
- /**
- * MAXDS3231M object destructor; basically, it closes the I2C connection.
- * it is not needed anymore, as the connections will be closed when
- * m_spi and m_csnPinCtx variables will go out of scope
- * ~MAX31723 ();
- **/
-
- /**
- * Gets the on-board temperature.
- */
- short getTemperature ();
-
- /**
- * Returns the name of the component
- */
- std::string name()
- {
- return m_name;
- }
- private:
- std::string m_name;
- mraa::Spi m_spi;
- mraa::Gpio m_csnPinCtx;
-
- uint8_t readRegister (uint8_t reg);
- void writeRegister (uint8_t reg, uint8_t data);
-
- /**
- * Sets the chip select pin to LOW
- */
- mraa::Result CSOn ();
-
- /**
- * Sets the chip select pin to HIGH
- */
- mraa::Result CSOff ();
-};
-
-}
diff --git a/peripheral/libupm/src/max31723/pyupm_max31723.i b/peripheral/libupm/src/max31723/pyupm_max31723.i
deleted file mode 100644
index 2694b7d..0000000
--- a/peripheral/libupm/src/max31723/pyupm_max31723.i
+++ /dev/null
@@ -1,11 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_max31723
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "max31723.h"
-%{
- #include "max31723.h"
-%}
diff --git a/peripheral/libupm/src/max31855/CMakeLists.txt b/peripheral/libupm/src/max31855/CMakeLists.txt
deleted file mode 100644
index b2ff5df..0000000
--- a/peripheral/libupm/src/max31855/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "max31855")
-set (libdescription "K type thermistor amplifier")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/max31855/javaupm_max31855.i b/peripheral/libupm/src/max31855/javaupm_max31855.i
deleted file mode 100644
index a778d37..0000000
--- a/peripheral/libupm/src/max31855/javaupm_max31855.i
+++ /dev/null
@@ -1,21 +0,0 @@
-//! [Interesting]
-%module javaupm_max31855
-%include "../upm.i"
-
-%{
- #include "max31855.h"
-%}
-
-%include "max31855.h"
-//! [Interesting]
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_max31855");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/max31855/jsupm_max31855.i b/peripheral/libupm/src/max31855/jsupm_max31855.i
deleted file mode 100644
index 6bb6967..0000000
--- a/peripheral/libupm/src/max31855/jsupm_max31855.i
+++ /dev/null
@@ -1,10 +0,0 @@
-//! [Interesting]
-%module jsupm_max31855
-%include "../upm.i"
-
-%{
- #include "max31855.h"
-%}
-
-%include "max31855.h"
-//! [Interesting]
diff --git a/peripheral/libupm/src/max31855/max31855.cxx b/peripheral/libupm/src/max31855/max31855.cxx
deleted file mode 100644
index 3037aaf..0000000
--- a/peripheral/libupm/src/max31855/max31855.cxx
+++ /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.
- */
-
-#include <iostream>
-#include <string>
-#include <stdexcept>
-#include <unistd.h>
-#include <stdlib.h>
-#include <functional>
-#include <string.h>
-
-#include "max31855.h"
-
-using namespace upm;
-
-//! [Constructor]
-MAX31855::MAX31855(int bus, int cs)
-{
- // initialise chip select as a normal gpio
- if ( !(m_gpio = mraa_gpio_init(cs)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_gpio_init(cs) failed, invalid pin?");
- return;
- }
- mraa_gpio_dir(m_gpio, MRAA_GPIO_OUT);
-
- // initialise the spi bus with a 2Mhz clock
- m_sensor = mraa_spi_init(bus);
- mraa_spi_frequency(m_sensor, 2000000);
-}
-//! [Constructor]
-
-//! [Destructor]
-MAX31855::~MAX31855()
-{
- // close both m_sensor & m_gpio cleanly
- mraa_result_t error;
- error = mraa_spi_stop(m_sensor);
- if (error != MRAA_SUCCESS) {
- mraa_result_print(error);
- }
- error = mraa_gpio_close(m_gpio);
- if (error != MRAA_SUCCESS) {
- mraa_result_print(error);
- }
-}
-//! [Destructor]
-
-double
-MAX31855::getTemp()
-{
-//! [spi]
- // set chip select low
- mraa_gpio_write(m_gpio, 0);
-
- uint8_t buf[4];
-
- // set our input buffer to 0, this is clean but not required
- memset(buf, 0, sizeof(uint8_t)*4);
-
- // Write buffer to the spi slave
- uint8_t* x = mraa_spi_write_buf(m_sensor, buf, 4);
-//! [spi]
-
-//! [conversion]
- // Endian correct way of making our char array into an 32bit int
- int32_t temp = (x[0] << 24) | (x[1] << 16) | (x[2] << 8) | x[3];;
-
- // mraa_spi_write_buf does not free the return buffer
- free(x);
-
- if (temp & 0x7) {
- std::cerr << "Something went very wrong!" << std::endl;
- }
-
- // scrap all the data we dont care about
- temp >>= 18;
-
- // LSB = 0.25 degrees C
- double c = (double) temp;
- c *= 0.25;
-//! [conversion]
-
- // set chip select high
- mraa_gpio_write(m_gpio, 1);
-
- return c;
-}
diff --git a/peripheral/libupm/src/max31855/max31855.h b/peripheral/libupm/src/max31855/max31855.h
deleted file mode 100644
index bbd6af8..0000000
--- a/peripheral/libupm/src/max31855/max31855.h
+++ /dev/null
@@ -1,87 +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 <string>
-#include <mraa/spi.h>
-#include <mraa/gpio.h>
-
-namespace upm {
-
-/**
- * @brief MAX31855 Thermocouple library
- * @defgroup max31855 libupm-max31855
- * @ingroup maxim adafruit spi other
- */
-/**
- * @library max31855
- * @sensor max31855
- * @comname MAX31855 Thermocouple Amplifier
- * @type other
- * @man maxim adafruit
- * @con spi
- *
- * @brief API for the MAX31855 Thermocouple Amplifier
- *
- * Maxim Integrated*
- * [MAX31855](http://datasheets.maximintegrated.com/en/ds/MAX31855.pdf)
- * is a cold-junction compensated thermocouple-to-digital converter. This
- * module was tested on the Maxim Integrated
- * [MAX31855PMB1 PMOD module]
- * (http://datasheets.maximintegrated.com/en/ds/MAX31855PMB1.pdf) from the
- * analog PMOD kit.
- *
- * @image html max31855.jpg
- * @snippet max31855.cxx Interesting
- */
-class MAX31855 {
- public:
- /**
- * Instantiates an MAX31855 object
- *
- * @param bus SPI bus to use
- * @param cs Chip select pin
- */
- MAX31855(int bus, int cs);
-
- /**
- * MAX31855 object destructor
- */
- ~MAX31855();
-
- /**
- * Gets the distance from the sensor
- *
- * @return Value in Celsius
- */
-//! [Interesting]
- double getTemp();
-//! [Interesting]
-
- private:
- mraa_spi_context m_sensor;
- mraa_gpio_context m_gpio;
-};
-
-}
diff --git a/peripheral/libupm/src/max31855/pyupm_max31855.i b/peripheral/libupm/src/max31855/pyupm_max31855.i
deleted file mode 100644
index e06c7b7..0000000
--- a/peripheral/libupm/src/max31855/pyupm_max31855.i
+++ /dev/null
@@ -1,13 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_max31855
-%include "../upm.i"
-
-%include "stdint.i"
-
-%feature("autodoc", "3");
-
-%include "max31855.h"
-%{
- #include "max31855.h"
-%}
diff --git a/peripheral/libupm/src/max44000/CMakeLists.txt b/peripheral/libupm/src/max44000/CMakeLists.txt
deleted file mode 100644
index 1109061..0000000
--- a/peripheral/libupm/src/max44000/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "max44000")
-set (libdescription "upm MAX44000")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/max44000/javaupm_max44000.i b/peripheral/libupm/src/max44000/javaupm_max44000.i
deleted file mode 100644
index fbf331a..0000000
--- a/peripheral/libupm/src/max44000/javaupm_max44000.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_max44000
-%include "../upm.i"
-
-%{
- #include "max44000.h"
-%}
-
-%include "max44000.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_max44000");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/max44000/jsupm_max44000.i b/peripheral/libupm/src/max44000/jsupm_max44000.i
deleted file mode 100644
index 80a2b5a..0000000
--- a/peripheral/libupm/src/max44000/jsupm_max44000.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_max44000
-%include "../upm.i"
-
-%{
- #include "max44000.h"
-%}
-
-%include "max44000.h"
diff --git a/peripheral/libupm/src/max44000/max44000.cxx b/peripheral/libupm/src/max44000/max44000.cxx
deleted file mode 100644
index eb7025d..0000000
--- a/peripheral/libupm/src/max44000/max44000.cxx
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <string>
-#include <stdexcept>
-#include <unistd.h>
-#include <stdlib.h>
-
-#include "max44000.h"
-
-using namespace upm;
-
-MAX44000::MAX44000 (int bus, int devAddr) : m_i2cMaxControlCtx(bus) {
- m_name = "MAX44000";
-
- m_maxControlAddr = devAddr;
- m_bus = bus;
-
- mraa::Result ret = m_i2cMaxControlCtx.address(m_maxControlAddr);
- if (ret != mraa::SUCCESS) {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_i2c_address() failed");
- }
-
- // i2cWriteReg (MCR, 0x2C);
- // i2cWriteReg (TCR, 0x6);
-}
-
-uint16_t
-MAX44000::getProximity () {
- uint16_t data = 0;
-
- data = (i2cReadReg_8 (ALSDATA_HIGH) & 0x7F) << 8;
- data = data | i2cReadReg_8 (ALSDATA_LOW);
-
- return data;
-}
-
-uint16_t
-MAX44000::getAmbient () {
- uint16_t data = 0;
-
- data = (i2cReadReg_8 (ALSDATA_HIGH) & 0x7F) << 8;
- data = data | i2cReadReg_8 (ALSDATA_LOW);
-
- return data;
-}
-
-/*
- * **************
- * private area
- * **************
- */
-uint8_t
-MAX44000::i2cReadReg_8 (int reg) {
- uint8_t data;
-
- m_i2cMaxControlCtx.address(m_maxControlAddr);
- m_i2cMaxControlCtx.writeByte(reg);
-
- m_i2cMaxControlCtx.address(m_maxControlAddr);
- m_i2cMaxControlCtx.read(&data, 0x1);
-
- return data;
-}
-
-uint16_t
-MAX44000::i2cReadReg_16 (int reg) {
- uint16_t data;
-
- m_i2cMaxControlCtx.address(m_maxControlAddr);
- m_i2cMaxControlCtx.writeByte(reg);
-
- m_i2cMaxControlCtx.address(m_maxControlAddr);
- m_i2cMaxControlCtx.read((uint8_t *)&data, 0x2);
-
- return data;
-}
-
-mraa::Result
-MAX44000::i2cWriteReg (uint8_t reg, uint8_t value) {
- mraa::Result error = mraa::SUCCESS;
-
- uint8_t data[2] = { reg, value };
- error = m_i2cMaxControlCtx.address (m_maxControlAddr);
- error = m_i2cMaxControlCtx.write (data, 2);
-
- return error;
-}
diff --git a/peripheral/libupm/src/max44000/max44000.h b/peripheral/libupm/src/max44000/max44000.h
deleted file mode 100644
index fdd4e93..0000000
--- a/peripheral/libupm/src/max44000/max44000.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include <mraa/i2c.hpp>
-
-#define ADDR 0x4A // device address
-
-// registers address
-#define ISR 0x00 // Interrupt Status Register
-#define MCR 0x01 // Main Configuration Register
-#define RCR 0x02 // Receive Configuration Register
-#define TCR 0x03 // Transmit Configuration Register
-#define ALSDATA_HIGH 0x04 // ambient sensor data high byte
-#define ALSDATA_LOW 0x05 // ambient sensor data low byte
-#define PRXDATA 0x15 // proximity sensor data
-
-#define ALS_UP_THRESH_HIGH 0x06 // ALS Interrupt Threshold Registers High
-#define ALS_UP_THRESH_LOW 0x07 // ALS Interrupt Threshold Registers Low
-#define ALS_LO_THRESH_HIGH 0x08 // ALS Interrupt Threshold Registers High
-#define ALS_LO_THRESH_LOW 0x09 // ALS Interrupt Threshold Registers Low
-#define TPTR 0x0A // ALS/PROX Threshold Persist Timer Register
-#define PROX_THRESH_IND 0x0B // Proximity Threshold Register
-#define PROX_THRESH 0x0C // Proximity Threshold Register
-#define TRIM_GAIN_GREEN 0x0F // Digital Gain Trim Register
-#define TRIM_GAIN_IR 0x10 // Digital Gain Trim Register
-
-#define HIGH 1
-#define LOW 0
-
-namespace upm {
-
-/**
- * @brief MAX44000 Proximity Sensor library
- * @defgroup max44000 libupm-max44000
- * @ingroup maxim i2c light
- */
-/**
- * @library max44000
- * @sensor max44000
- * @comname MAX44000 Proximity Sensor
- * @type light
- * @man maxim
- * @con i2c
- *
- * @brief API for the MAX44000 Ambient and Infrared Proximity Sensor
- *
- * Maxim Integrated*
- * [MAX44000](http://datasheets.maximintegrated.com/en/ds/MAX44000.pdf)
- * is an ambient and infrared proximity sensor. This module was tested on the
- * Maxim Integrated
- * [MAX44000PMB1 PMOD module]
- * (http://datasheets.maximintegrated.com/en/ds/MAX44000PMB1.pdf) from the
- * analog PMOD kit.
- *
- * @snippet max44000.cxx Interesting
- */
-class MAX44000 {
- public:
- /**
- * Instantiates an MAX44000 object
- *
- * @param bus Number of the used bus
- * @param devAddr Address of the used I2C device
- */
- MAX44000 (int bus, int devAddr=ADDR);
-
- /**
- * MAX44000 object destructor; basically, it closes the I2C connection.
- * ~MAX44000 ();
- * no need for the destructor - the I2c connection will be closed when
- * m_i2cMaxControlCtx variable will be out of context
- **/
-
- /**
- * Reads the proximity value from the sensor (based on ambient data).
- */
- uint16_t getProximity ();
- /**
- * Reads the ambient value from the sensor (based on ambient data).
- */
- uint16_t getAmbient ();
-
- /**
- * Returns the name of the component
- */
- std::string name()
- {
- return m_name;
- }
-
- /**
- * Reads a one-byte register
- *
- * @param reg Address of the register
- */
- uint8_t i2cReadReg_8 (int reg);
-
- /**
- * Reads a two-byte register
- *
- * @param reg Address of the register
- */
- uint16_t i2cReadReg_16 (int reg);
-
- /**
- * Writes to a one-byte register
- *
- * @param reg Address of the register
- * @param value Byte to be written
- */
- mraa::Result i2cWriteReg (uint8_t reg, uint8_t value);
-
- private:
- std::string m_name;
-
- int m_maxControlAddr;
- int m_bus;
- mraa::I2c m_i2cMaxControlCtx;
-};
-
-}
diff --git a/peripheral/libupm/src/max44000/pyupm_max44000.i b/peripheral/libupm/src/max44000/pyupm_max44000.i
deleted file mode 100644
index f427531..0000000
--- a/peripheral/libupm/src/max44000/pyupm_max44000.i
+++ /dev/null
@@ -1,13 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_max44000
-%include "../upm.i"
-
-%include "stdint.i"
-
-%feature("autodoc", "3");
-
-%include "max44000.h"
-%{
- #include "max44000.h"
-%}
diff --git a/peripheral/libupm/src/max5487/CMakeLists.txt b/peripheral/libupm/src/max5487/CMakeLists.txt
deleted file mode 100644
index e6d59b6..0000000
--- a/peripheral/libupm/src/max5487/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "max5487")
-set (libdescription "Digital potentiometer")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/max5487/javaupm_max5487.i b/peripheral/libupm/src/max5487/javaupm_max5487.i
deleted file mode 100644
index e31fed5..0000000
--- a/peripheral/libupm/src/max5487/javaupm_max5487.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_max5487
-%include "../upm.i"
-
-%{
- #include "max5487.h"
-%}
-
-%include "max5487.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_max5487");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/max5487/jsupm_max5487.i b/peripheral/libupm/src/max5487/jsupm_max5487.i
deleted file mode 100644
index 880aeaa..0000000
--- a/peripheral/libupm/src/max5487/jsupm_max5487.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_max5487
-%include "../upm.i"
-
-%{
- #include "max5487.h"
-%}
-
-%include "max5487.h"
diff --git a/peripheral/libupm/src/max5487/max5487.cxx b/peripheral/libupm/src/max5487/max5487.cxx
deleted file mode 100644
index 4eb90ac..0000000
--- a/peripheral/libupm/src/max5487/max5487.cxx
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdexcept>
-
-#include "max5487.h"
-
-using namespace upm;
-
-MAX5487::MAX5487 (int csn) : m_csnPinCtx(csn), m_spi(0) {
- mraa::Result error = mraa::SUCCESS;
- m_name = "MAX5487";
-
- if (csn == -1) {
- throw std::invalid_argument(std::string(__FUNCTION__));
- }
-
- error = m_csnPinCtx.dir (mraa::DIR_OUT);
- if (error != mraa::SUCCESS) {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_gpio_dir() failed");
- }
-
- CSOff ();
-}
-
-void
-MAX5487::setWiperA (uint8_t wiper) {
- uint8_t data[2] = { 0x00, 0x00};
-
- CSOn ();
-
- data[0] = R_WR_WIPER_A;
- data[1] = wiper;
-
- uint8_t* retData = m_spi.write(data, 2);
-
- CSOff ();
-}
-
-void
-MAX5487::setWiperB (uint8_t wiper) {
- uint8_t data[2] = { 0x00, 0x00};
-
- CSOn ();
-
- data[0] = R_WR_WIPER_B;
- data[1] = wiper;
-
- uint8_t* retData = m_spi.write(data, 2);
-
- CSOff ();
-}
-
-/*
- * **************
- * private area
- * **************
- */
-
-mraa::Result
-MAX5487::CSOn () {
- return m_csnPinCtx.write(LOW);
-}
-
-mraa::Result
-MAX5487::CSOff () {
- return m_csnPinCtx.write(HIGH);
-}
diff --git a/peripheral/libupm/src/max5487/max5487.h b/peripheral/libupm/src/max5487/max5487.h
deleted file mode 100644
index 287d30a..0000000
--- a/peripheral/libupm/src/max5487/max5487.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include <mraa/aio.hpp>
-
-#include <mraa/gpio.hpp>
-#include <mraa/spi.hpp>
-
-#define HIGH 1
-#define LOW 0
-
-namespace upm {
-
-/**
- * @brief MAX5487 Digital Potentiometer library
- * @defgroup max5487 libupm-max5487
- * @ingroup maxim spi digipot
- */
-/**
- * @library max5487
- * @sensor max5487
- * @comname MAX5487 Digital Potentiometer
- * @type digipot
- * @man maxim
- * @con spi
- *
- * @brief API for the MAX5487 SPI Digital Potentiometer
- *
- * Maxim Integrated*
- * [MAX5487](http://datasheets.maximintegrated.com/en/ds/MAX5487-MAX5489.pdf)
- * is a dual, 256-tap, nonvolatile, SPI, linear-taper digital
- * potentiometer. This module was tested on the Maxim Integrated [MAX5487PMB1
- * PMOD module](http://datasheets.maximintegrated.com/en/ds/MAX5487PMB1.pdf)
- * from the analog PMOD kit.
- *
- * @snippet max5487.cxx Interesting
- */
-class MAX5487 {
- public:
- static const uint8_t R_WR_WIPER_A = 0x01;
- static const uint8_t R_WR_WIPER_B = 0x02;
-
- /**
- * Instantiates an MAX5487 object
- *
- * @param csn CSN to use, if any; by default, ICSP CS (-1) is used
- */
- MAX5487 (int csn = -1);
-
- /**
- * MAX5487 object destructor, closes all IO connections
- * no more needed as the connections will be closed when
- * m_spi and m_csnPinCtx will go out of scope
- * ~MAX5487 ();
- **/
-
- /**
- * Sets a wiper for port A.
- */
- void setWiperA (uint8_t wiper);
-
- /**
- * Sets a wiper for port B.
- */
- void setWiperB (uint8_t wiper);
-
- /**
- * Returns the name of the component
- */
- std::string name()
- {
- return m_name;
- }
- private:
- std::string m_name;
- mraa::Spi m_spi;
- mraa::Gpio m_csnPinCtx;
-
- /**
- * Sets the chip select pin to LOW
- */
- mraa::Result CSOn ();
-
- /**
- * Sets the chip select pin to HIGH
- */
- mraa::Result CSOff ();
-};
-
-}
diff --git a/peripheral/libupm/src/max5487/pyupm_max5487.i b/peripheral/libupm/src/max5487/pyupm_max5487.i
deleted file mode 100644
index 693d526..0000000
--- a/peripheral/libupm/src/max5487/pyupm_max5487.i
+++ /dev/null
@@ -1,11 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_max5487
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "max5487.h"
-%{
- #include "max5487.h"
-%}
diff --git a/peripheral/libupm/src/maxds3231m/CMakeLists.txt b/peripheral/libupm/src/maxds3231m/CMakeLists.txt
deleted file mode 100644
index 561ead4..0000000
--- a/peripheral/libupm/src/maxds3231m/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "maxds3231m")
-set (libdescription "realtime clock sensor from MAX family")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/maxds3231m/javaupm_maxds3231m.i b/peripheral/libupm/src/maxds3231m/javaupm_maxds3231m.i
deleted file mode 100644
index 4dcf6f3..0000000
--- a/peripheral/libupm/src/maxds3231m/javaupm_maxds3231m.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_maxds3231m
-%include "../upm.i"
-
-%{
- #include "maxds3231m.h"
-%}
-
-%include "maxds3231m.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_maxds3231m");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/maxds3231m/jsupm_maxds3231m.i b/peripheral/libupm/src/maxds3231m/jsupm_maxds3231m.i
deleted file mode 100644
index b18f347..0000000
--- a/peripheral/libupm/src/maxds3231m/jsupm_maxds3231m.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_maxds3231m
-%include "../upm.i"
-
-%{
- #include "maxds3231m.h"
-%}
-
-%include "maxds3231m.h"
diff --git a/peripheral/libupm/src/maxds3231m/maxds3231m.cxx b/peripheral/libupm/src/maxds3231m/maxds3231m.cxx
deleted file mode 100644
index 7748303..0000000
--- a/peripheral/libupm/src/maxds3231m/maxds3231m.cxx
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdexcept>
-
-#include "maxds3231m.h"
-
-using namespace upm;
-
-MAXDS3231M::MAXDS3231M (int bus, int devAddr) : m_i2Ctx(bus) {
- m_name = "MAXDS3231M";
-
- m_i2cAddr = devAddr;
- m_bus = bus;
-
- mraa::Result ret = m_i2Ctx.address(m_i2cAddr);
- if (ret != mraa::SUCCESS) {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": m_i2Ctx.address() failed");
- }
-}
-
-void
-MAXDS3231M::setDate (Time3231 &time) {
- uint8_t *data = (uint8_t *)&time;
-
- i2cWriteReg_N (TIME_CAL_ADDR, 7, data);
-}
-
-bool
-MAXDS3231M::getDate (Time3231 &time) {
- uint8_t buffer[7];
-
- // We need 7 bytes of data.
- if (i2cReadReg_N (TIME_CAL_ADDR, 7, buffer) > 6) {
- uint8_t century = (buffer[5] & 0x80) >> 7;
-
- time.second = BCDtoDEC(buffer[0]);
- time.minute = BCDtoDEC(buffer[1]);
- time.hour = BCDtoDEC(buffer[2]);
- time.day = BCDtoDEC(buffer[4]);
- time.month = BCDtoDEC(buffer[5] & 0x1F);
- time.year = (century == 1) ? 2000 + BCDtoDEC(buffer[6]) : 1900 + BCDtoDEC(buffer[6]);
- time.weekDay = BCDtoDEC(buffer[3]);
-
- return true;
- }
-
- return false;
-}
-
-uint16_t
-MAXDS3231M::getTemperature () {
- uint8_t buffer[2];
- uint8_t msb = 0;
- uint8_t lsb = 0;
-
- i2cReadReg_N (TEMPERATURE_ADDR, 2, buffer);
- msb = buffer[0];
- lsb = buffer[1] >> 6;
-
- if ((msb & 0x80) != 0)
- msb |= ~((1 << 8) - 1); // if negative get two's complement
-
- return 0.25 * lsb + msb;
-}
-
-/*
- * **************
- * private area
- * **************
- */
-uint16_t
-MAXDS3231M::i2cReadReg_N (int reg, unsigned int len, uint8_t * buffer) {
- int readByte = 0;
-
- m_i2Ctx.address(m_i2cAddr);
- m_i2Ctx.writeByte(reg);
-
- m_i2Ctx.address(m_i2cAddr);
- readByte = m_i2Ctx.read(buffer, len);
- return readByte;
-}
-
-mraa::Result
-MAXDS3231M::i2cWriteReg_N (uint8_t reg, unsigned int len, uint8_t * buffer) {
- mraa::Result error = mraa::SUCCESS;
-
- error = m_i2Ctx.address (m_i2cAddr);
- error = m_i2Ctx.write (buffer, len);
-
- return error;
-}
-
-uint8_t
-MAXDS3231M::DECtoBSD(uint8_t data) {
- return ((data / 10 * 16) + (data % 10));
-}
-
-uint8_t
-MAXDS3231M::BCDtoDEC(uint8_t data) {
- return ((data / 16 * 10) + (data % 16));
-}
diff --git a/peripheral/libupm/src/maxds3231m/maxds3231m.h b/peripheral/libupm/src/maxds3231m/maxds3231m.h
deleted file mode 100644
index 60dcf1e..0000000
--- a/peripheral/libupm/src/maxds3231m/maxds3231m.h
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include <mraa/i2c.hpp>
-
-#define ADDR 0x68 // device address
-
-// timekeeping registers
-#define TIME_CAL_ADDR 0x00
-#define ALARM1_ADDR 0x07
-#define ALARM2_ADDR 0x0B
-#define CONTROL_ADDR 0x0E
-#define STATUS_ADDR 0x0F
-#define AGING_OFFSET_ADDR 0x10
-#define TEMPERATURE_ADDR 0x11
-
-// control register bits
-#define A1IE 0x1
-#define A2IE 0x2
-#define INTCN 0x4
-
-// status register bits
-#define A1F 0x1
-#define A2F 0x2
-#define OSF 0x80
-
-#define HIGH 1
-#define LOW 0
-
-namespace upm {
-
-struct Time3231 {
- uint8_t second;
- uint8_t minute;
- uint8_t hour;
- uint8_t day;
- uint8_t month;
- int16_t year;
- uint8_t weekDay;
-};
-
-/**
- * @brief MAXDS3231M Proximity Sensor library
- * @defgroup maxds3231m libupm-maxds3231m
- * @ingroup maxim i2c light
- */
-/**
- * @library maxds3231m
- * @sensor maxds3231m
- * @comname MAXDS3231M Real-Time Clock
- * @type light
- * @man maxim
- * @con i2c
- *
- * @brief API for the MAXDS3231M I2C Real-Time Clock
- *
- * This module defines the API for MAXDS3231M
- *
- * @snippet maxds3231m.cxx Interesting
- */
-class MAXDS3231M {
- public:
- /**
- * Instantiates an MAXDS3231M object
- *
- * @param bus Number of the used bus
- * @param devAddr Address of the used I2C device
- */
- MAXDS3231M (int bus=0, int devAddr=0x68);
-
- /**
- * Sets the date and time on the chip.
- *
- * @param time Time structure
- */
- void setDate (Time3231 &time);
-
- /**
- * Gets the date and time from the chip.
- *
- * @param time Time structure
- */
- bool getDate (Time3231 &time);
-
- /**
- * Gets the on-board temperature.
- */
- uint16_t getTemperature ();
-
- /**
- * Returns the name of the component
- */
- std::string name()
- {
- return m_name;
- }
- private:
- std::string m_name;
-
- int m_i2cAddr;
- int m_bus;
- mraa::I2c m_i2Ctx;
-
- uint16_t i2cReadReg_N (int reg, unsigned int len, uint8_t * buffer);
- mraa::Result i2cWriteReg_N (uint8_t reg, unsigned int len, uint8_t * buffer);
- uint8_t DECtoBSD (uint8_t data);
- uint8_t BCDtoDEC (uint8_t data);
-};
-
-}
diff --git a/peripheral/libupm/src/maxds3231m/pyupm_maxds3231m.i b/peripheral/libupm/src/maxds3231m/pyupm_maxds3231m.i
deleted file mode 100644
index 05c3039..0000000
--- a/peripheral/libupm/src/maxds3231m/pyupm_maxds3231m.i
+++ /dev/null
@@ -1,11 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_maxds3231m
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "maxds3231m.h"
-%{
- #include "maxds3231m.h"
-%}
diff --git a/peripheral/libupm/src/maxsonarez/CMakeLists.txt b/peripheral/libupm/src/maxsonarez/CMakeLists.txt
deleted file mode 100644
index 09441bb..0000000
--- a/peripheral/libupm/src/maxsonarez/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "maxsonarez")
-set (libdescription "upm MaxSonar EZ family of ultrasonic rangers")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/maxsonarez/javaupm_maxsonarez.i b/peripheral/libupm/src/maxsonarez/javaupm_maxsonarez.i
deleted file mode 100644
index dc3faef..0000000
--- a/peripheral/libupm/src/maxsonarez/javaupm_maxsonarez.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_maxsonarez
-%include "../upm.i"
-
-%{
- #include "maxsonarez.h"
-%}
-
-%include "maxsonarez.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_maxsonarez");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/maxsonarez/jsupm_maxsonarez.i b/peripheral/libupm/src/maxsonarez/jsupm_maxsonarez.i
deleted file mode 100644
index b0af4c4..0000000
--- a/peripheral/libupm/src/maxsonarez/jsupm_maxsonarez.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_maxsonarez
-%include "../upm.i"
-
-%{
- #include "maxsonarez.h"
-%}
-
-%include "maxsonarez.h"
diff --git a/peripheral/libupm/src/maxsonarez/maxsonarez.cxx b/peripheral/libupm/src/maxsonarez/maxsonarez.cxx
deleted file mode 100644
index 5122466..0000000
--- a/peripheral/libupm/src/maxsonarez/maxsonarez.cxx
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <string>
-#include <stdexcept>
-
-#include "maxsonarez.h"
-
-using namespace std;
-using namespace upm;
-
-MAXSONAREZ::MAXSONAREZ(int pin, float aref)
-{
- if (!(m_aio = mraa_aio_init(pin)))
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_aio_init() failed, invalid pin?");
- return;
- }
-
- m_aRes = (1 << mraa_aio_get_bit(m_aio));
- m_aref = aref;
-
- // volt's per inch of this sensor
- m_vI = (m_aref / MAXSONAREZ_RES);
-}
-
-MAXSONAREZ::~MAXSONAREZ()
-{
- mraa_aio_close(m_aio);
-}
-
-int MAXSONAREZ::inches()
-{
- int val = mraa_aio_read(m_aio);
- float volts = float(val) * (m_aref / m_aRes);
-
- return int(volts / m_vI);
-}
diff --git a/peripheral/libupm/src/maxsonarez/maxsonarez.h b/peripheral/libupm/src/maxsonarez/maxsonarez.h
deleted file mode 100644
index b63226d..0000000
--- a/peripheral/libupm/src/maxsonarez/maxsonarez.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <iostream>
-#include <string>
-#include <mraa/aio.h>
-
-// EZ series is volts/512
-#define MAXSONAREZ_RES 512
-
-namespace upm {
- /**
- * @brief MaxSonar-EZ Family of Ultrasonic Rangers library
- * @defgroup maxsonarez libupm-maxsonarez
- * @ingroup seeed analog sound
- */
-
- /**
- * @library maxsonarez
- * @sensor maxsonarez
- * @comname LV-MaxSonar-EZ Ultrasonic Ranger
- * @altname EZ1, EZ2, EZ3, EZ4
- * @type sound
- * @man sparkfun
- * @web https://www.sparkfun.com/products/8502
- * @con analog
- *
- * @brief API for the LV-MaxSonar-EZ Family of Ultrasonic Rangers
- *
- * Sensors of this family return an analog voltage corresponding to the
- * distance of an object from the sensor in inches. They have a
- * resolution of about 9.7 millivolts per inch with an analog reference voltage of 5.0 V. The
- * differences between various versions (EZ1, EZ2, etc.) are
- * related to the narrowness of the beam angle.
- *
- * This class supports these sensors with an analog input only.
- *
- * This driver was developed using an LV-MaxSonar-EZ3 ultrasonic ranger.
- *
- * @image html maxsonarez.jpg
- * <br><em>LV-MaxSonar-EZ Ultrasonic Ranger image provided by SparkFun* under
- * <a href=https://creativecommons.org/licenses/by-nc-sa/3.0/>
- * CC BY-NC-SA-3.0</a>.</em>
- *
- * @snippet maxsonarez.cxx Interesting
- */
-
- class MAXSONAREZ {
- public:
-
- /**
- * MAXSONAREZ constructor
- *
- * @param pin Analog pin to use
- * @param aref Analog reference voltage; default is 5.0 V
- */
- MAXSONAREZ(int pin, float aref=5.0);
-
- /**
- * MAXSONAREZ destructor
- */
- ~MAXSONAREZ();
-
- /**
- * Gets the distance to the object in inches
- *
- * @return Distance to the object in inches
- */
- int inches();
-
- private:
- mraa_aio_context m_aio;
- float m_aref;
- // ADC resolution
- int m_aRes;
- // computed volts per inch
- float m_vI;
- };
-}
-
-
diff --git a/peripheral/libupm/src/maxsonarez/pyupm_maxsonarez.i b/peripheral/libupm/src/maxsonarez/pyupm_maxsonarez.i
deleted file mode 100644
index e4504c8..0000000
--- a/peripheral/libupm/src/maxsonarez/pyupm_maxsonarez.i
+++ /dev/null
@@ -1,11 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_maxsonarez
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "maxsonarez.h"
-%{
- #include "maxsonarez.h"
-%}
diff --git a/peripheral/libupm/src/mcp9808/CMakeLists.txt b/peripheral/libupm/src/mcp9808/CMakeLists.txt
deleted file mode 100644
index 11d39e7..0000000
--- a/peripheral/libupm/src/mcp9808/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "mcp9808")
-set (libdescription "upm mcp9808 Precision I2c temperature sensor")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/mcp9808/javaupm_mcp9808.i b/peripheral/libupm/src/mcp9808/javaupm_mcp9808.i
deleted file mode 100644
index ff6383b..0000000
--- a/peripheral/libupm/src/mcp9808/javaupm_mcp9808.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_mcp9808
-%include "../upm.i"
-
-%{
- #include "mcp9808.h"
-%}
-
-%include "mcp9808.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_mcp9808");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/mcp9808/jsupm_mcp9808.i b/peripheral/libupm/src/mcp9808/jsupm_mcp9808.i
deleted file mode 100644
index 60e4f2f..0000000
--- a/peripheral/libupm/src/mcp9808/jsupm_mcp9808.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_mcp9808
-%include "../upm.i"
-
-%{
- #include "mcp9808.h"
-%}
-
-%include "mcp9808.h"
diff --git a/peripheral/libupm/src/mcp9808/mcp9808.cxx b/peripheral/libupm/src/mcp9808/mcp9808.cxx
deleted file mode 100644
index a9da8ed..0000000
--- a/peripheral/libupm/src/mcp9808/mcp9808.cxx
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * Author: Marc Graham <marc@m2ag.net>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-
-#include "mcp9808.h"
-#include <cmath>
-
-
-using namespace upm;
-
-MCP9808::MCP9808 (int bus, uint8_t address){
- m_name = "mcp9808";
- m_celsius = true;
- m_tcrit = false;
- m_tupper = false;
- m_tlower = false;
- if(!(i2c = new mraa::I2c(bus))){
- throw std::invalid_argument(std::string(__FUNCTION__) +": I2c.init() failed");
- return;
- }
-
- if((i2c->address(address) != mraa::SUCCESS)){
- throw std::invalid_argument(std::string(__FUNCTION__) + ": I2c.address() failed");
- return;
- }
-
- if(i2c->frequency( mraa::I2C_FAST) != mraa::SUCCESS){
- throw std::invalid_argument(std::string(__FUNCTION__) + ": I2c.frequency(I2C_STD) failed");
- return;
- }
-}
-
-
-float
-MCP9808::getTemp(){
- uint16_t result;
- //Read the register
- result = i2c->readWordReg(MCP9808_REG_AMBIENT_TEMP);
- //Swap the bytes
- result = swapWord(result);
- //Get the flag bits.
- m_tcrit = (result & 0x8000) ;
- m_tupper = (result & 0x4000) ;
- m_tlower = (result & 0x2000) ;
- return getTempValue(result);
-}
-
-void
-MCP9808::shutDown(bool sleep){
- if(sleep) this->updateConfigRegister(MCP9808_CONFIG_SHUTDOWN);
- else this->updateConfigRegister(~(MCP9808_CONFIG_SHUTDOWN), false);
-}
-
-
-void
-MCP9808::setMonitorReg(MCP9808_REG reg, float value){
- uint16_t t;
- if(m_celsius) t = value * 16.0;
- else t = ((value - 32) * 5.0/9.0) * 16.0 ;
-
- t = swapWord(t);
-
- if(i2c->writeWordReg(reg, t) != mraa::SUCCESS){
- throw std::invalid_argument(std::string(__FUNCTION__) + ": I2c.write() failed");
- return;
- }
-}
-
-float
-MCP9808::getMonitorReg(MCP9808_REG reg){
- uint16_t value = i2c->readWordReg(reg);
- value = swapWord(value);
- return getTempValue(value);
-}
-
-
-void
-MCP9808::clearInterrupt(){
- this->updateConfigRegister(MCP9808_CONFIG_INTCLR);
-}
-
-void
-MCP9808::setAlertMode(uint16_t command){
- this->updateConfigRegister(command);
-}
-
-void
-MCP9808::clearAlertMode(){
- //Preserve hysteresis and shutdown settings but
- //set all alert settings to power on default.
- this->updateConfigRegister(0x2007, false);
-}
-
-
-void
-MCP9808::setHysteresis(MCP9808_CONFIG value){
- //Clear hysteresis first.
- this->updateConfigRegister(0xFFF9, false);
- this->updateConfigRegister(value);
-}
-
-float
-MCP9808::getHysteresis(){
- uint16_t value = i2c->readWordReg(MCP9808_REG_CONFIG);
- value = (value >> 1 ) & 0xF ;
- float res = (value == 0) ? 0.0 : ( 1.5 * pow( 2.0 , value - 1 )) ;
- return (m_celsius) ? res : res * 9/5;
-}
-
-
-void
-MCP9808::setResolution(MCP9808_RESOLUTION value){
- if(i2c->writeReg(MCP9808_REG_RESOLUTION, value) != mraa::SUCCESS){
- throw std::invalid_argument(std::string(__FUNCTION__) + ": I2c.write() failed");
- return;
- }
-}
-
-float
-MCP9808::getResolution(){
- uint8_t value = i2c->readReg(MCP9808_REG_RESOLUTION);
- return 0.5 * (1.0 / std::pow( 2.0, value));
-}
-
-
-uint16_t
-MCP9808::getManufacturer(){
- return swapWord(i2c->readWordReg(MCP9808_REG_MANUF_ID));
-}
-
-uint16_t
-MCP9808::getDevicedId(){
- return swapWord(i2c->readWordReg(MCP9808_REG_DEVICE_ID));
-}
-
-MCP9808::~MCP9808 (){
- delete i2c;
-}
-
-
-//Private functions
-
-float
-MCP9808::getTempValue(uint16_t result){
- bool neg = (result & 0x1000);
- float res = (result & 0xFFF) / 16.0;
- if(neg) res = 0 - ( 256 - res );
- if(!m_celsius) res = res * 9.0/5.0 + 32;
- return res;
-}
-
-void
-MCP9808::updateConfigRegister(uint16_t update, bool on){
- uint16_t reg = i2c->readWordReg(MCP9808_REG_CONFIG);
- if(on) reg |= update;
- else reg &= update;
-
- if(i2c->writeWordReg(MCP9808_REG_CONFIG, reg) != mraa::SUCCESS){
- throw std::invalid_argument(std::string(__FUNCTION__) + ": I2c.write() failed");
- return;
- }
-}
-
-
-uint16_t
-MCP9808::swapWord(uint16_t value){
- uint16_t res = value;
- return ((res & 0xFF) << 8) | ((res >> 8 ) & 0xFF);
-}
diff --git a/peripheral/libupm/src/mcp9808/mcp9808.h b/peripheral/libupm/src/mcp9808/mcp9808.h
deleted file mode 100644
index ac2f4d1..0000000
--- a/peripheral/libupm/src/mcp9808/mcp9808.h
+++ /dev/null
@@ -1,329 +0,0 @@
-/*
- * Author: Marc Graham <marc@m2ag.net>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-
-#pragma once
-
-#include <iostream>
-#include <string>
-#include "mraa.hpp"
-#include "mraa/i2c.hpp"
-
-#define MCP9808_REG_CONFIG 0x01
-#define MCP9808_REG_AMBIENT_TEMP 0x05
-#define MCP9808_REG_MANUF_ID 0x06
-#define MCP9808_REG_DEVICE_ID 0x07
-#define MCP9808_REG_RESOLUTION 0x08
-#define MCP9808_CONFIG_SHUTDOWN 0x0001
-#define MCP9808_CONFIG_CRITLOCKED 0x8000
-#define MCP9808_CONFIG_WINLOCKED 0x4000
-#define MCP9808_CONFIG_INTCLR 0x2000
-
-namespace upm {
- /**
- * @brief MCP9808 precision temperature sensor library
- * @defgroup mcp9808 libupm-mcp9808
- * @ingroup adafruit i2c temp
- */
- /**
- * @library mcp9808
- * @sensor MCP9808
- * @comname MCP9808 Temperature Sensor
- * @type temp
- * @man adafruit
- * @con i2c
- * @web https://learn.adafruit.com/adafruit-mcp9808-precision-i2c-temperature-sensor-guide/overview
- * @web http://ww1.microchip.com/downloads/en/DeviceDoc/25095A.pdf
- *
- * @brief API for MCP9808 precision temprature sensor
- *
- * The MCP9808 digital temperature sensor converts temperatures between -20°C and +100°C
- * to a digital word with ±0.5°C (max.) accuracy. The MCP9808 comes with user-programmable
- * registers that provide flexibility for temperature sensing applications. The registers
- * allow user-selectable settings such as Shutdown or low-power modes and the specification
- * of temperature Event and Critical output boundaries. When the temperature changes beyond
- * the specified boundary limits, the MCP9808 outputs an Event signal. The user has the
- * option of setting the event output signal polarity as an active-low or active-high
- * comparator output for thermostat operation, or as temperature event interrupt output
- * for microprocessor-based systems. The event output can also be configured as a Critical
- * temperature output.
- *
- * Tested with Adafriut MCP9808 board.
- *
- * @image html mcp9808.jpg
- * @snippet mcp9808.cxx Interesting
- */
- class MCP9808 {
-
- public:
- /**
- * @enum MCP9808_REG
- * @brief uint8_t enum containing register addresses
- * used for setting temp thresholds for MCP9808
- *
- * @var MCP9808_REG::UPPER_TEMP = 0x02
- * @var MCP9808_REG::LOWER_TEMP = 0x03
- * @var MCP9808_REG::CRIT_TEMP = 0x04
- */
- typedef enum
- {
- UPPER_TEMP = 0x02,
- LOWER_TEMP = 0x03,
- CRIT_TEMP = 0x04,
- } MCP9808_REG;
-
- /**
- * @enum MCP9808_RESOLUTION
- * @brief uint8_t enum containing the four possible
- * values for MCP9808 resolution register.
- *
- * @var MCP9808_RESOLUTION::RES_LOW = 0.5C
- * @var MCP9808_RESOLUTION::RES_MEDIUM = 0.25C
- * @var MCP9808_RESOLUTION::RES_HIGH = 0.125C
- * @var MCP9808_RESOLUTION::RES_PRECISION = (default) 0.0625C
- */
- typedef enum
- {
- RES_LOW = 0x00,
- RES_MEDIUM = 0x01,
- RES_HIGH = 0x02,
- RES_PRECISION = 0x03
- } MCP9808_RESOLUTION;
-
- /**
- * @enum MCP9808_CONFIG
- * @brief uint16_t enum containing alert and hysteresis options
- * for config register.
- *
- * @var MCP9808_CONFIG::ALERTSTAT - Alert Output Status bit
- * 0 = Alert output is not asserted by the device (power-up default)
- * 1 = Alert output is asserted as a comparator/Interrupt or critical
- * temperature output
- * @var MCP9808_CONFIG::ALERTCTRL - Alert Output Control bit
- * 0 = Disabled (power-up default)
- * 1 = Enabled
- * @var MCP9808_CONFIG::ALERTSEL - Alert Output Select bit
- * 0 = Alert output for TUPPER, TLOWER and TCRIT (power-up default)
- * 1 = TA > TCRIT only (TUPPER and TLOWER temperature boundaries are disabled)
- * @var MCP9808_CONFIG::ALERTPOL - Alert Output Polarity bit
- * 0 = Active-low (power-up default; pull-up resistor required)
- * 1 = Active-high
- * @var MCP9808_CONFIG::ALERTMODE - Alert Output Mode bit
- * 0 = Comparator output (power-up default)
- * 1 = Interrupt output
- * @var MCP9808_CONFIG::HYST_0 : 0°C
- * @var MCP9808_CONFIG::HYST_1_5 : +1.5°C
- * @var MCP9808_CONFIG::HYST_3_0 : +3.0°C
- * @var MCP9808_CONFIG::HYST_6_0 : +6.0°C
- */
- typedef enum
- {
- ALERTSTAT = 0x1000,
- ALERTCTRL = 0x0800,
- ALERTSEL = 0x0400,
- ALERTPOL = 0x0200,
- ALERTMODE = 0x0100,
- HYST_0 = 0x0000,
- HYST_1_5 = 0x0002,
- HYST_3_0 = 0x0004,
- HYST_6_0 = 0x0006
- } MCP9808_CONFIG;
-
- /**
- * MCP9808 constructor
- *
- * @param bus i2c bus the sensor is attached to.
- * @param address. Device address. Default is 0x18.
- */
- MCP9808 (int bus, uint8_t address = 0x18);
-
- /**
- * MCP9808 destructor
- */
- ~MCP9808 ();
-
- /**
- * Returns the name of the sensor
- */
- std::string name()
- {
- return m_name;
- }
-
- /**
- * Returns current temperature.
- */
- float getTemp(void);
-
- /**
- * Will cause the devices to either sleep or wakeup.
- *
- * @param sleep . Bool, default true to sleep. false to wake.
- */
- void shutDown(bool sleep = true);
-
- /**
- * setMode - sets temperature reporting mode.
- *
- * @param celsius. Default is true. If false all
- * temps will be reported in fahrenhiet.
- */
- void setMode(bool celsius = true)
- {
- m_celsius = celsius;
- }
-
- /**
- * Returns true if mode is celsius
- * False if fahrenheit.
- */
- bool isCelsius(void)
- {
- return m_celsius;
- }
-
- /**
- * Returns true if TCrit threshold has been crossed
- * Reflects the state of the bit based on the most recent
- * readTemp() operation.
- */
- bool isTcrit()
- {
- return m_tcrit;
- }
-
- /**
- * Returns true if TUpper threshold crossed
- * Reflects the state of the bit based on the most recent
- * readTemp() operation.
- */
- bool isTupper()
- {
- return m_tupper;
- }
-
- /**
- * Returns true if TLower threshold crossed.
- * Reflects the state of the bit based on the most recent
- * readTemp() operation.
- */
- bool isTlower()
- {
- return m_tlower;
- }
-
- /**
- * Sets the value of TCrit, TUpper,TLower registers.
- *
- * @praam reg - MCP9808_REG enum UPPER_TEMP, LOWER_TEMP
- * or CRIT_TEMP.
- * @param value - float value representing the set value
- */
- void setMonitorReg(MCP9808_REG reg, float value);
-
- /**
- * Returns the current value of TCrit, TUpper, TLower
- * registers.
- *
- * @param reg - MCP9808_REG enum UPPER_TEMP, LOWER_TEMP
- * or CRIT_TEMP.
- */
- float getMonitorReg(MCP9808_REG reg);
-
- /**
- * Clears the interrupt when ALERT_MODE is set to
- * interrupt output and temp threshold crossed.
- */
- void clearInterrupt(void);
-
- /**
- * Sets alert mode. Can use values from MCP9808_CONFIG
- * enum. Values can be combined.
- *
- * @param command - a combination of options to set desired
- * alert mode. See spcec sheet.
- */
- void setAlertMode(uint16_t command);
-
- /**
- * Clears Alert Mode -- sets all params to default.
- */
- void clearAlertMode(void);
-
- /**
- * Sets hysteresis value.
- *
- * @param MCP9808_CONFIG enum value HYST_0, HYST_1_5,
- * HYST_3_0 or HYST_6_0
- */
- void setHysteresis(MCP9808_CONFIG value);
-
- /**
- * Returns hysteresis setting as a float value.
- */
- float getHysteresis();
-
- /**
- * Sets resolution of temperature conversion.
- *
- * @param value - MCP9808_RESOLUTION enum value.
- * RES_LOW = +0.5 C
- * RES_MEDIUM = +0.25 C
- * RES_HIGH = +0.125 C
- * RES_PRECISION = +0.0625 C (default).
- */
- void setResolution(MCP9808_RESOLUTION value);
-
- /**
- * Returns float value representing the current
- * resolution setting.
- */
- float getResolution();
-
- /**
- * Returns Manufacturer ID. Typically 0x0054;
- */
- uint16_t getManufacturer();
-
- /**
- * Returns device ID and revision. Typically 0x0400
- * With ID in the High byte.
- */
- uint16_t getDevicedId();
-
- private:
- std::string m_name;
- bool m_celsius;
- bool m_tcrit;
- bool m_tupper;
- bool m_tlower;
-
- mraa::I2c* i2c;
-
- float getTempValue(uint16_t value);
- void updateConfigRegister(uint16_t update, bool on = true);
- uint16_t swapWord(uint16_t value);
- };
-}
diff --git a/peripheral/libupm/src/mcp9808/pyupm_mcp9808.i b/peripheral/libupm/src/mcp9808/pyupm_mcp9808.i
deleted file mode 100644
index 2f094ec..0000000
--- a/peripheral/libupm/src/mcp9808/pyupm_mcp9808.i
+++ /dev/null
@@ -1,11 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_mcp9808
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "mcp9808.h"
-%{
- #include "mcp9808.h"
-%}
diff --git a/peripheral/libupm/src/mg811/CMakeLists.txt b/peripheral/libupm/src/mg811/CMakeLists.txt
deleted file mode 100644
index 66b70da..0000000
--- a/peripheral/libupm/src/mg811/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "mg811")
-set (libdescription "upm DFRobot CO2 sensor")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/mg811/javaupm_mg811.i b/peripheral/libupm/src/mg811/javaupm_mg811.i
deleted file mode 100644
index 3f7e201..0000000
--- a/peripheral/libupm/src/mg811/javaupm_mg811.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_mg811
-%include "../upm.i"
-
-%{
- #include "mg811.h"
-%}
-
-%include "mg811.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_mg811");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/mg811/jsupm_mg811.i b/peripheral/libupm/src/mg811/jsupm_mg811.i
deleted file mode 100644
index 0a4a4bb..0000000
--- a/peripheral/libupm/src/mg811/jsupm_mg811.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_mg811
-%include "../upm.i"
-
-%{
- #include "mg811.h"
-%}
-
-%include "mg811.h"
diff --git a/peripheral/libupm/src/mg811/mg811.cxx b/peripheral/libupm/src/mg811/mg811.cxx
deleted file mode 100644
index 622dd85..0000000
--- a/peripheral/libupm/src/mg811/mg811.cxx
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Thanks to public domain code by Martin Liddament for some useful clues!
- * http://www.veetech.org.uk/CO2_Monitor_Sketch_2_Operation.txt
- * and sandbox electronics (http://sandboxelectronics.com/?p=147).
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <math.h>
-#include "mg811.h"
-
-using namespace std;
-using namespace upm;
-
-// voltage gain of the DC amplifier
-static const float dcGain = 8.5;
-
-MG811::MG811(int pin, int dpin, float aref) :
- m_aio(pin), m_gpio(dpin)
-{
- m_aRes = m_aio.getBit();
- m_aref = aref;
-
- m_gpio.dir(mraa::DIR_IN);
-
- // these are just placeholder values (coarsely measured during
- // development), you should determine the appropriate values (in
- // volts) for your environment at the specified concentrations. Use
- // the getReferenceVoltage() method to get these values at 400ppm
- // and 1000ppm respectively. Good luck.
- setCalibration(0.5514, 0.370);
-}
-
-MG811::~MG811()
-{
-}
-
-float MG811::volts()
-{
- int val = m_aio.read();
-
- return(float(val) * (m_aref / float(1 << m_aRes)));
-}
-
-void MG811::setCalibration(float ppm400, float ppm1000)
-{
- m_zeroPointValue = ppm400;
- m_reactionValue = ppm1000;
-}
-
-float MG811::getReferenceVoltage()
-{
- return (volts() / dcGain);
-}
-
-float MG811::ppm()
-{
- static const float log400 = log10f(400);
- static const float log1000 = log10f(1000);
-
- float val = volts();
-
- if ((val / dcGain) >= m_zeroPointValue)
- return 0.0;
- else
- return powf(10.0, ((val/dcGain)-m_zeroPointValue) /
- (m_reactionValue / (log400-log1000))+log400);
-}
-
-bool MG811::thresholdReached()
-{
- return (m_gpio.read() ? true : false);
-}
diff --git a/peripheral/libupm/src/mg811/mg811.h b/peripheral/libupm/src/mg811/mg811.h
deleted file mode 100644
index d8c4934..0000000
--- a/peripheral/libupm/src/mg811/mg811.h
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <iostream>
-#include <string>
-#include <mraa/aio.hpp>
-#include <mraa/gpio.hpp>
-
-namespace upm {
- /**
- * @brief DFRobot CO2 Sensor
- * @defgroup mg811 libupm-mg811
- * @ingroup dfrobot analog gas
- */
-
- /**
- * @library mg811
- * @sensor mg811
- * @comname DFRobot CO2 Sensor
- * @altname MG811
- * @type gas
- * @man dfrobot
- * @web http://www.dfrobot.com/index.php?route=product/product&product_id=1023
- * @con analog
- *
- * @brief API for the DFRobot CO2 Sensor
- *
- * This sensor returns an an analog voltage that falls as the
- * concentration of CO2 increases. It contains a heater that must
- * be allowed to 'warm' up the sensor before measurements are stable
- * (hours to days is the recommendation). It requires that the MCU
- * be powered from an external power supply (not USB) at 5v, since
- * the heater will consume significant current.
- *
- * The sensor should be allowed to 'heat' up for some time before
- * beginning use, typically a couple of hours minimum. It also
- * needs fairly precise calibration at 400ppm and 1000ppm to return
- * meaningful results.
- *
- * The sensor also incorporates a potentiometer that can be adjusted
- * to specific threshold. Once that threshold is reached, an LED
- * on the sensor will light, and the digital pin will be driven
- * high.
- *
- * @image html mg811.jpg
- * @snippet mg811.cxx Interesting
- */
-
- class MG811 {
- public:
-
- /**
- * MG811 constructor
- *
- * @param pin Analog pin to use
- * @param dpin Digital pin that indicates threshold
- * @param aref Analog reference voltage; default is 5.0 V
- */
- MG811(int pin, int dpin, float aref=5.0);
-
- /**
- * MG811 destructor
- */
- ~MG811();
-
- /**
- * Return a cumputed reference voltage to be used in calibration.
- * @return Computed reference voltage
- */
- float getReferenceVoltage();
-
- /**
- * Set calibration parameters. You should measure the reference
- * voltage you get when at CO2 concentrations of 400ppm (ambient)
- * and 1000ppm using the getReferenceVoltage() method. Then
- * specify those voltages here for more accurate results.
- *
- * @param ppm400 The measured reference voltage at 400 ppm
- * @param ppm40000 The measured reference voltage at 1000 ppm
- */
- void setCalibration(float ppm400, float ppm1000);
-
- /**
- * Returns the voltage detected on the analog pin
- *
- * @return The detected voltage
- */
- float volts();
-
- /**
- * Returns the computed CO2 concentration in ppm (Parts Per
- * Million). This method will return 0.0 if the reference voltage
- * is greater than the ppm400 value. Essentially, ppm values
- * below 400 will be reported as 0.
- *
- * @return The computed CO2 concentration in ppm
- */
- float ppm();
-
- /**
- * Read the digital pin and return true if the set threshold has
- * been reached or exceeded. This threshold is set by adjusting
- * the potentiometer on the sensor.
- *
- * @return true if the threshold has been reached, false otherwise
- */
- bool thresholdReached();
-
- protected:
- mraa::Aio m_aio;
- mraa::Gpio m_gpio;
-
- // calibration values
- float m_zeroPointValue;
- float m_reactionValue;
-
- // ADC resolution
- int m_aRes;
-
- private:
- float m_aref;
- };
-}
-
-
diff --git a/peripheral/libupm/src/mg811/pyupm_mg811.i b/peripheral/libupm/src/mg811/pyupm_mg811.i
deleted file mode 100644
index 614da5c..0000000
--- a/peripheral/libupm/src/mg811/pyupm_mg811.i
+++ /dev/null
@@ -1,11 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_mg811
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "mg811.h"
-%{
- #include "mg811.h"
-%}
diff --git a/peripheral/libupm/src/mhz16/CMakeLists.txt b/peripheral/libupm/src/mhz16/CMakeLists.txt
deleted file mode 100644
index b032acb..0000000
--- a/peripheral/libupm/src/mhz16/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "mhz16")
-set (libdescription "upm grove CO2 sensor")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/mhz16/javaupm_mhz16.i b/peripheral/libupm/src/mhz16/javaupm_mhz16.i
deleted file mode 100644
index c2735a3..0000000
--- a/peripheral/libupm/src/mhz16/javaupm_mhz16.i
+++ /dev/null
@@ -1,27 +0,0 @@
-%module javaupm_mhz16
-%include "../upm.i"
-%include "cpointer.i"
-%include "typemaps.i"
-%include "arrays_java.i";
-%include "../java_buffer.i"
-
-%apply int *OUTPUT { int *gas, int *temp };
-
-%{
- #include "mhz16.h"
- speed_t int_B9600 = B9600;
-%}
-
-%include "mhz16.h"
-speed_t int_B9600 = B9600;
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_mhz16");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/mhz16/jsupm_mhz16.i b/peripheral/libupm/src/mhz16/jsupm_mhz16.i
deleted file mode 100644
index 2b3f9d8..0000000
--- a/peripheral/libupm/src/mhz16/jsupm_mhz16.i
+++ /dev/null
@@ -1,13 +0,0 @@
-%module jsupm_mhz16
-%include "../upm.i"
-%include "cpointer.i"
-
-/* Send "int *" to JavaScript as intp */
-%pointer_functions(int, intp);
-%{
- #include "mhz16.h"
- speed_t int_B9600 = B9600;
-%}
-
-%include "mhz16.h"
-speed_t int_B9600 = B9600;
diff --git a/peripheral/libupm/src/mhz16/mhz16.cxx b/peripheral/libupm/src/mhz16/mhz16.cxx
deleted file mode 100644
index 8ea3925..0000000
--- a/peripheral/libupm/src/mhz16/mhz16.cxx
+++ /dev/null
@@ -1,243 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <string>
-#include <stdexcept>
-
-#include "mhz16.h"
-
-using namespace upm;
-using namespace std;
-
-static const int defaultDelay = 100; // max wait time for read
-
-MHZ16::MHZ16(int uart)
-{
- m_ttyFd = -1;
-
- if ( !(m_uart = mraa_uart_init(uart)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_uart_init() failed");
- return;
- }
-
- // This requires a recent MRAA (1/2015)
- const char *devPath = mraa_uart_get_dev_path(m_uart);
-
- if (!devPath)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": mraa_uart_get_dev_path() failed");
- return;
- }
-
- // now open the tty
- if ( (m_ttyFd = open(devPath, O_RDWR)) == -1)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": open of " +
- string(devPath) + " failed: " +
- string(strerror(errno)));
- return;
- }
-}
-
-MHZ16::~MHZ16()
-{
- if (m_ttyFd != -1)
- close(m_ttyFd);
-
- mraa_deinit();
-}
-
-bool MHZ16::dataAvailable(unsigned int millis)
-{
- if (m_ttyFd == -1)
- return false;
-
- struct timeval timeout;
-
- // no waiting
- timeout.tv_sec = 0;
- timeout.tv_usec = millis * 1000;
-
- int nfds;
- fd_set readfds;
-
- FD_ZERO(&readfds);
-
- FD_SET(m_ttyFd, &readfds);
-
- if (select(m_ttyFd + 1, &readfds, NULL, NULL, &timeout) > 0)
- return true; // data is ready
- else
- return false;
-}
-
-int MHZ16::readData(char *buffer, int len)
-{
- if (m_ttyFd == -1)
- return(-1);
-
- if (!dataAvailable(defaultDelay))
- return 0; // timed out
-
- int rv = read(m_ttyFd, buffer, len);
-
- if (rv < 0)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": read() failed: " +
- string(strerror(errno)));
- return rv;
- }
-
- return rv;
-}
-
-int MHZ16::writeData(char *buffer, int len)
-{
- if (m_ttyFd == -1)
- return(-1);
-
- // first, flush any pending but unread input
- tcflush(m_ttyFd, TCIFLUSH);
-
- int rv = write(m_ttyFd, buffer, len);
-
- if (rv < 0)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": write() failed: " +
- string(strerror(errno)));
- return rv;
- }
-
- tcdrain(m_ttyFd);
-
- return rv;
-}
-
-bool MHZ16::setupTty(speed_t baud)
-{
- if (m_ttyFd == -1)
- return(false);
-
- struct termios termio;
-
- // get current modes
- tcgetattr(m_ttyFd, &termio);
-
- // setup for a 'raw' mode. 81N, no echo or special character
- // handling, such as flow control.
- cfmakeraw(&termio);
-
- // set our baud rates
- cfsetispeed(&termio, baud);
- cfsetospeed(&termio, baud);
-
- // make it so
- if (tcsetattr(m_ttyFd, TCSAFLUSH, &termio) < 0)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": tcsetattr() failed: " +
- string(strerror(errno)));
- return false;
- }
-
- return true;
-}
-
-bool MHZ16::verifyPacket(uint8_t *pkt, int len)
-{
- if (pkt[0] != 0xff || pkt[1] != 0x86)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": invalid packet header received");
- return false;
- }
-
- return true;
-}
-
-bool MHZ16::getData()
-{
- // the query command
- const unsigned char cmd[9] =
- {0xff, 0x01, 0x86, 0x00, 0x00, 0x00, 0x00, 0x00, 0x79};
-
- writeData((char *)cmd, 9);
-
- // wait up to one second for a response
- if (!dataAvailable(1000))
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": Timed out waiting for response");
- return false;
- }
-
- // read the packet
- unsigned char packet[9];
- int rv;
-
- if ((rv = readData((char *)packet, 9)) != 9)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": Invalid packet size read");
- return false;
- }
-
- // will throw an exception if it fails
- verifyPacket(packet, sizeof(packet));
-
- // pull out the data and return it.
- gas = (packet[2] << 8) | packet[3];
- temp = packet[4] - 40;
-
- return true;
-}
-
-int MHZ16::getGas()
-{
- return gas;
-}
-
-int MHZ16::getTemperature()
-{
- return temp;
-}
-
-void MHZ16::calibrateZeroPoint()
-{
- // the query command
- const unsigned char cmd[9] =
- {0xff, 0x01, 0x87, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78};
-
- writeData((char *)cmd, 9);
-
- // no response
-}
-
diff --git a/peripheral/libupm/src/mhz16/mhz16.h b/peripheral/libupm/src/mhz16/mhz16.h
deleted file mode 100644
index b23072c..0000000
--- a/peripheral/libupm/src/mhz16/mhz16.h
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include <iostream>
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <termios.h>
-#include <sys/time.h>
-#include <sys/select.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include <mraa/uart.h>
-
-const int MHZ16_DEFAULT_UART = 0;
-
-// protocol start and end codes
-const uint8_t MHZ16_START = 0x7e;
-const uint8_t MHZ16_END = 0x7e;
-
-namespace upm {
- /**
- * @brief MHZ16 Serial CO2 Sensor library
- * @defgroup mhz16 libupm-mhz16
- * @ingroup seeed uart gaseous
- */
-
- /**
- * @library mhz16
- * @sensor mhz16
- * @comname Grove CO2 Sensor
- * @altname MHZ16 Serial CO2 Sensor
- * @type gaseous
- * @man seeed
- * @con uart
- *
- * @brief API support for the Grove CO2 sensor
- *
- * This class implements support for the Grove CO2 sensor.
- *
- * Its CO2 detection range is 0-2,000 ppm. It requires a
- * 2-3 minute warm-up time before reporting valid data.
- *
- * @image html mhz16.jpg
- * @snippet mhz16.cxx Interesting
- */
- class MHZ16 {
- public:
-
-
- /**
- * MHZ16 constructor
- *
- * @param uart Default UART to use (0 or 1)
- */
- MHZ16(int uart);
-
- /**
- * MHZ16 destructor
- */
- ~MHZ16();
-
- /**
- * Checks to see if there is data available for reading
- *
- * @param millis Number of milliseconds to wait; 0 means no waiting.
- * @return True if there is data available for reading
- */
- bool dataAvailable(unsigned int millis);
-
- /**
- * Reads any available data in a user-supplied buffer. Note: the
- * call blocks until data is available to be read. Use
- * dataAvailable() to determine whether there is data available
- * beforehand, to avoid blocking.
- *
- * @param buffer Buffer to hold the data read
- * @param len Length of the buffer
- * @return Number of bytes read
- */
- int readData(char *buffer, int len);
-
- /**
- * Writes the data in the buffer to the device
- *
- * @param buffer Buffer to hold the data read
- * @param len Length of the buffer
- * @return Number of bytes written
- */
- int writeData(char *buffer, int len);
-
- /**
- * Sets up proper tty I/O modes and the baud rate. The default
- * baud rate is 9,600 (B9600).
- *
- * @param baud Desired baud rate.
- * @return True if successful
- */
- bool setupTty(speed_t baud=B9600);
-
- /**
- * Verifies the packet header and indicates its validity
- *
- * @param pkt Packet to check
- * @return True if the checksum is valid, false otherwise
- */
- bool verifyPacket(uint8_t *pkt, int len);
-
- /**
- * Queries the sensor and gets the gas (CO2) concentration and
- * temperature data.
- * Should be called before other "get" functions.
- *
- * @return True if successful
- */
- bool getData();
-
- /**
- * Returns the gas (CO2) concentration data.
- *
- * @return Gas concentration
- */
- int getGas();
-
- /**
- * Returns the temperature data.
- *
- * @return Temperature in Celsius
- */
- int getTemperature();
-
- /**
- * Sets the zero point of the sensor
- *
- */
- void calibrateZeroPoint();
-
- protected:
- int ttyFd() { return m_ttyFd; };
-
- private:
- mraa_uart_context m_uart;
- int m_ttyFd;
- int gas;
- int temp;
- };
-}
-
-
diff --git a/peripheral/libupm/src/mhz16/pyupm_mhz16.i b/peripheral/libupm/src/mhz16/pyupm_mhz16.i
deleted file mode 100644
index 843b380..0000000
--- a/peripheral/libupm/src/mhz16/pyupm_mhz16.i
+++ /dev/null
@@ -1,16 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_mhz16
-%include "../upm.i"
-%include "cpointer.i"
-
-%feature("autodoc", "3");
-
-/* Send "int *" to JavaScript as intp */
-%pointer_functions(int, intp);
-%{
- #include "mhz16.h"
- speed_t int_B9600 = B9600;
-%}
-%include "mhz16.h"
-speed_t int_B9600 = B9600;
diff --git a/peripheral/libupm/src/mic/CMakeLists.txt b/peripheral/libupm/src/mic/CMakeLists.txt
deleted file mode 100644
index c21cce7..0000000
--- a/peripheral/libupm/src/mic/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "mic")
-set (libdescription "Microphone simple API")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/mic/javaupm_mic.i b/peripheral/libupm/src/mic/javaupm_mic.i
deleted file mode 100644
index 5abc65c..0000000
--- a/peripheral/libupm/src/mic/javaupm_mic.i
+++ /dev/null
@@ -1,51 +0,0 @@
-%module javaupm_mic
-%include "../upm.i"
-%include "stdint.i"
-%include "arrays_java.i"
-
-%{
- #include "mic.h"
-%}
-
-%typemap(jni) (uint16_t *buffer, int len) "jshortArray";
-%typemap(jtype) (uint16_t *buffer, int len) "short[]";
-%typemap(jstype) (uint16_t *buffer, int len) "short[]";
-
-%typemap(javain) (uint16_t *buffer, int len) "$javainput";
-
-%typemap(in) (uint16_t *buffer, int len) {
- $1 = (uint16_t *) JCALL2(GetShortArrayElements, jenv, $input, NULL);
- $2 = JCALL1(GetArrayLength, jenv, $input);
-}
-
-%typemap(freearg) (uint16_t *buffer, int len) {
- JCALL3(ReleaseShortArrayElements, jenv, $input, (jshort *)$1, 0);
-}
-
-%typemap(jni) (int numberOfSamples, uint16_t *buffer) "jshortArray";
-%typemap(jtype) (int numberOfSamples, uint16_t *buffer) "short[]";
-%typemap(jstype) (int numberOfSamples, uint16_t *buffer) "short[]";
-
-%typemap(javain) (int numberOfSamples, uint16_t *buffer) "$javainput";
-
-%typemap(in) (int numberOfSamples, uint16_t *buffer) {
- $2 = (uint16_t *) JCALL2(GetShortArrayElements, jenv, $input, NULL);
- $1 = JCALL1(GetArrayLength, jenv, $input);
-}
-
-%typemap(freearg) (int numberOfSamples, uint16_t *buffer) {
- JCALL3(ReleaseShortArrayElements, jenv, $input, (jshort *)$2, 0);
-}
-
-%include "mic.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_mic");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/mic/jsupm_mic.i b/peripheral/libupm/src/mic/jsupm_mic.i
deleted file mode 100644
index c6fcad3..0000000
--- a/peripheral/libupm/src/mic/jsupm_mic.i
+++ /dev/null
@@ -1,9 +0,0 @@
-%module jsupm_mic
-%include "../upm.i"
-%include "../carrays_uint16_t.i"
-
-%{
- #include "mic.h"
-%}
-
-%include "mic.h"
diff --git a/peripheral/libupm/src/mic/mic.cxx b/peripheral/libupm/src/mic/mic.cxx
deleted file mode 100644
index ac4eb9b..0000000
--- a/peripheral/libupm/src/mic/mic.cxx
+++ /dev/null
@@ -1,102 +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 <iostream>
-#include <string>
-#include <stdexcept>
-#include <unistd.h>
-#include <stdlib.h>
-#include <functional>
-#include <string.h>
-#include "mic.h"
-
-using namespace upm;
-
-Microphone::Microphone(int micPin) {
- // initialise analog mic input
-
- if ( !(m_micCtx = mraa_aio_init(micPin)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_aio_init() failed, invalid pin?");
- return;
- }
-}
-
-Microphone::~Microphone() {
- // close analog input
- mraa_result_t error;
- error = mraa_aio_close(m_micCtx);
- if (error != MRAA_SUCCESS) {
- mraa_result_print(error);
- }
-}
-
-int
-Microphone::getSampledWindow (unsigned int freqMS, int numberOfSamples,
- uint16_t * buffer) {
- int sampleIdx = 0;
-
- // must have freq
- if (!freqMS) {
- return 0;
- }
-
- // too much samples
- if (numberOfSamples > 0xFFFFFF) {
- return 0;
- }
-
- while (sampleIdx < numberOfSamples) {
- buffer[sampleIdx++] = mraa_aio_read (m_micCtx);
- usleep(freqMS * 1000);
- }
-
- return sampleIdx;
-}
-
-int
-Microphone::findThreshold (thresholdContext* ctx, unsigned int threshold,
- uint16_t * buffer, int len) {
- long sum = 0;
- for (unsigned int i = 0; i < len; i++) {
- sum += buffer[i];
- }
-
- ctx->averageReading = sum / len;
- ctx->runningAverage = (((ctx->averagedOver-1) * ctx->runningAverage) + ctx->averageReading) / ctx->averagedOver;
-
- if (ctx->runningAverage > threshold) {
- return ctx->runningAverage;
- } else {
- return 0;
- }
-}
-
-void
-Microphone::printGraph (thresholdContext* ctx) {
- for (int i = 0; i < ctx->runningAverage; i++)
- std::cout << ".";
- std::cout << std::endl;
-}
diff --git a/peripheral/libupm/src/mic/mic.h b/peripheral/libupm/src/mic/mic.h
deleted file mode 100644
index 08c07be..0000000
--- a/peripheral/libupm/src/mic/mic.h
+++ /dev/null
@@ -1,108 +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 <string>
-#include <mraa/gpio.h>
-#include <mraa/aio.h>
-
-struct thresholdContext {
- long averageReading;
- long runningAverage;
- int averagedOver;
-};
-
-namespace upm {
-
-/**
- * @brief Analog Microphone library
- * @defgroup mic libupm-mic
- * @ingroup seeed pwm sound gsk
- */
-/**
- * @library mic
- * @sensor microphone
- * @comname Analog Microphone
- * @altname Grove Sound Sensor
- * @type sound
- * @man seeed
- * @web http://www.seeedstudio.com/wiki/Grove_-_Sound_Sensors
- * @con pwm
- * @kit gsk
- *
- * @brief API for the Analog Microphone
- *
- * This module defines the Analog Microphone sensor
- *
- * @image html mic.jpg
- * @snippet mic.cxx Interesting
- */
-class Microphone {
- public:
- /**
- * Instantiates a Microphone object
- *
- * @param micPin Pin where the microphone is connected
- */
- Microphone(int micPin);
-
- /**
- * Microphone object destructor
- */
- ~Microphone();
-
- /**
- * Gets samples from the microphone according to the provided window and
- * number of samples
- *
- * @param freqMS Time between each sample (in microseconds)
- * @param numberOfSamples Number of sample to sample for this window
- * @param buffer Buffer with sampled data
- */
- int getSampledWindow (unsigned int freqMS, int numberOfSamples, uint16_t * buffer);
-
- /**
- * Given the sampled buffer, this method returns TRUE/FALSE if threshold
- * is reached
- *
- * @param ctx Threshold context
- * @param threshold Sample threshold
- * @param buffer Buffer with samples
- * @param len Buffer length
- */
- int findThreshold (thresholdContext* ctx, unsigned int threshold, uint16_t * buffer, int len);
-
- /**
- *
- * Prints a running average of the threshold context
- *
- * @param ctx Threshold context
- */
- void printGraph (thresholdContext* ctx);
-
- private:
- mraa_aio_context m_micCtx;
-};
-
-}
diff --git a/peripheral/libupm/src/mic/pyupm_mic.i b/peripheral/libupm/src/mic/pyupm_mic.i
deleted file mode 100644
index 4cf7ff9..0000000
--- a/peripheral/libupm/src/mic/pyupm_mic.i
+++ /dev/null
@@ -1,10 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_mic
-%include "../upm.i"
-%include "../carrays_uint16_t.i"
-
-%{
- #include "mic.h"
-%}
-%include "mic.h"
diff --git a/peripheral/libupm/src/micsv89/CMakeLists.txt b/peripheral/libupm/src/micsv89/CMakeLists.txt
deleted file mode 100644
index 7297e08..0000000
--- a/peripheral/libupm/src/micsv89/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "micsv89")
-set (libdescription "upm micsv89 environmental sensor module")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/micsv89/javaupm_micsv89.i b/peripheral/libupm/src/micsv89/javaupm_micsv89.i
deleted file mode 100644
index 1e11060..0000000
--- a/peripheral/libupm/src/micsv89/javaupm_micsv89.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_micsv89
-%include "../upm.i"
-
-%{
- #include "micsv89.h"
-%}
-
-%include "micsv89.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_micsv89");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/micsv89/jsupm_micsv89.i b/peripheral/libupm/src/micsv89/jsupm_micsv89.i
deleted file mode 100644
index 98c92c0..0000000
--- a/peripheral/libupm/src/micsv89/jsupm_micsv89.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_micsv89
-%include "../upm.i"
-
-%{
- #include "micsv89.h"
-%}
-
-%include "micsv89.h"
diff --git a/peripheral/libupm/src/micsv89/micsv89.cxx b/peripheral/libupm/src/micsv89/micsv89.cxx
deleted file mode 100644
index 6fa6036..0000000
--- a/peripheral/libupm/src/micsv89/micsv89.cxx
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Author: Marc Graham <marc@m2ag.net>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include "micsv89.h"
-
-using namespace upm;
-
-MICSV89::MICSV89 (int bus, uint8_t address) {
- m_name = "micsv89";
- m_valid = false;
- m_address = address;
- i2c = new mraa::I2c(bus);
- if(i2c->address(m_address) != mraa::SUCCESS){
- throw std::invalid_argument(std::string(__FUNCTION__) + ": I2c.address() failed");
- return;
- }
- if(i2c->frequency(mraa::I2C_STD) != mraa::SUCCESS){
- throw std::invalid_argument(std::string(__FUNCTION__) + ": I2c.frequency(I2C_STD) failed");
- return;
- }
- tx_buf[0] = 0x09;
- tx_buf[1] = 0x00;
- tx_buf[2] = 0x00;
-}
-
-void MICSV89::update() {
- m_valid = false;
- if(i2c->write(tx_buf, 3) != mraa::SUCCESS){
- throw std::invalid_argument(std::string(__FUNCTION__) + ": I2c.write() failed");
- return;
- }
- sleep(1); //Give the device time to make the measurement.
- if(i2c->read(rx_buf, 6) != 6){
- throw std::invalid_argument(std::string(__FUNCTION__) + ": I2c.read() failed");
- return;
- }
- m_valid = true;
-}
-
-float MICSV89::co2equ() {
- return ((rx_buf[0] - 13) * (1600/229) + 400);
-}
-
-int MICSV89::vocshort() {
- return rx_buf[1];
-}
-
-float MICSV89::tvoc() {
- return rx_buf[2] * (1000/229);
-}
-
-float MICSV89::resistor() {
- return 10 * (rx_buf[3] + (256 * rx_buf[4]) + (65536 * rx_buf[5]));
-}
-
-MICSV89::~MICSV89() {
- delete i2c;
-}
diff --git a/peripheral/libupm/src/micsv89/micsv89.h b/peripheral/libupm/src/micsv89/micsv89.h
deleted file mode 100644
index 0fc369c..0000000
--- a/peripheral/libupm/src/micsv89/micsv89.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Author: Marc Graham <marc@m2ag.net>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#pragma once
-
-#include <iostream>
-#include <string>
-#include "mraa.hpp"
-#include "mraa/i2c.hpp"
-
-namespace upm {
- /**
- * @brief MICS-VZ89 environmental sensor library
- * @defgroup micsv89 libupm-micsv89
- * @ingroup generic i2c gaseous
- */
- /**
- * @library micsv89
- * @sensor micsv89
- * @comname MICS-VZ89 Gas Sensor
- * @type gaseous
- * @man generic
- * @con i2c
- * @web http://sgx.cdistore.com/datasheets/e2v/MiCS-VZ-86%20and%20VZ-89%20rev%204.pdf
- * @web http://www.sgxsensortech.com/content/uploads/2015/01/MICS-VZ-89-I2C-specs-rev-A.pdf
- *
- * @brief API for the MICS-VZ89 Gas Sensor
- *
- * The MiCS-VZ-86/89 combines state-of-the-art MOS sensor technology with
- * intelligent detection algorithms to monitor VOCs and CO2 equivalent
- * variations in confined spaces.
- *
- * The MICSV89 comes in 4 variants, PWM and I2C in 3.3 volts and 5 volts.
- * This library only implements the I2c version of the device.
- *
- * Device output is not valid until a warm up of 15 minutes of operation.
- *
- * @image html micsv89.jpg
- * @snippet micsv89.cxx Interesting
- */
- class MICSV89 {
- public:
- /**
- * MICSV89 constructor
- *
- * @param bus i2c bus the sensor is attached to.
- * @param address. Device address. Default is 0x70.
- */
- MICSV89 (int bus, uint8_t address = 0x70);
-
- /**
- * MICSV89 destructor
- */
- ~MICSV89 ();
-
- /**
- * Returns the name of the sensor
- */
- std::string name()
- {
- return m_name;
- }
-
- /**
- * Returns the CO2 equivalent value.
- */
- float co2equ();
-
- /**
- * Returns VOC Short value.
- */
- int vocshort();
-
- /**
- * Returns Total VOC.
- */
- float tvoc();
-
- /**
- * Returns resistor value.
- */
- float resistor();
-
- /**
- * Performs a write/read cycle.
- */
- void update();
-
- /**
- * Returns true if a valid write/read cycle has been completed.
- * At startup and during write/read cycle will be false.
- */
- bool valid()
- {
- return m_valid;
- }
-
- private:
- std::string m_name;
- bool m_valid;
- uint8_t m_address;
- uint8_t rx_buf[6];
- uint8_t tx_buf[3];
- mraa::I2c* i2c;
- };
-}
diff --git a/peripheral/libupm/src/micsv89/pyupm_micsv89.i b/peripheral/libupm/src/micsv89/pyupm_micsv89.i
deleted file mode 100644
index 8ae233f..0000000
--- a/peripheral/libupm/src/micsv89/pyupm_micsv89.i
+++ /dev/null
@@ -1,11 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_micsv89
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "micsv89.h"
-%{
- #include "micsv89.h"
-%}
diff --git a/peripheral/libupm/src/mlx90614/.DS_Store b/peripheral/libupm/src/mlx90614/.DS_Store
deleted file mode 100644
index dea2fac..0000000
--- a/peripheral/libupm/src/mlx90614/.DS_Store
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/src/mlx90614/._.DS_Store b/peripheral/libupm/src/mlx90614/._.DS_Store
deleted file mode 100644
index d83d264..0000000
--- a/peripheral/libupm/src/mlx90614/._.DS_Store
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/src/mlx90614/CMakeLists.txt b/peripheral/libupm/src/mlx90614/CMakeLists.txt
deleted file mode 100644
index ca02e69..0000000
--- a/peripheral/libupm/src/mlx90614/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "mlx90614")
-set (libdescription "Infrared thermometer designed for non-contact emperature sensing")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/mlx90614/javaupm_mlx90614.i b/peripheral/libupm/src/mlx90614/javaupm_mlx90614.i
deleted file mode 100644
index a580925..0000000
--- a/peripheral/libupm/src/mlx90614/javaupm_mlx90614.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_mlx90614
-%include "../upm.i"
-
-%{
- #include "mlx90614.h"
-%}
-
-%include "mlx90614.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_mlx90614");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/mlx90614/jsupm_mlx90614.i b/peripheral/libupm/src/mlx90614/jsupm_mlx90614.i
deleted file mode 100644
index a73650e..0000000
--- a/peripheral/libupm/src/mlx90614/jsupm_mlx90614.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_mlx90614
-%include "../upm.i"
-
-%{
- #include "mlx90614.h"
-%}
-
-%include "mlx90614.h"
diff --git a/peripheral/libupm/src/mlx90614/mlx90614.cxx b/peripheral/libupm/src/mlx90614/mlx90614.cxx
deleted file mode 100644
index aaa05ae..0000000
--- a/peripheral/libupm/src/mlx90614/mlx90614.cxx
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdexcept>
-
-#include "mlx90614.h"
-
-using namespace upm;
-
-MLX90614::MLX90614 (int bus, int devAddr) : m_i2Ctx(bus) {
- m_name = "MLX90614";
-
- m_i2cAddr = devAddr;
- m_bus = bus;
-
- mraa::Result ret = m_i2Ctx.address(m_i2cAddr);
- if (ret != mraa::SUCCESS) {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": address() failed");
- }
-}
-
-float
-MLX90614::readObjectTempF(void) {
- return (readTemperature(MLX90614_TOBJ1) * 9 / 5) + 32;
-}
-
-float
-MLX90614::readAmbientTempF(void) {
- return (readTemperature(MLX90614_TA) * 9 / 5) + 32;
-}
-
-float
-MLX90614::readObjectTempC(void) {
- return readTemperature(MLX90614_TOBJ1);
-}
-
-float
-MLX90614::readAmbientTempC(void) {
- return readTemperature(MLX90614_TA);
-}
-
-/*
- * **************
- * private area
- * **************
- */
-uint16_t
-MLX90614::i2cReadReg_N (int reg, unsigned int len, uint8_t * buffer) {
- int readByte = 0;
-
- m_i2Ctx.address(m_i2cAddr);
- m_i2Ctx.writeByte(reg);
-
- readByte = m_i2Ctx.read(buffer, len);
- return readByte;
-}
-
-mraa::Result
-MLX90614::i2cWriteReg_N (uint8_t reg, unsigned int len, uint8_t * buffer) {
- mraa::Result error = mraa::SUCCESS;
-
- error = m_i2Ctx.address(m_i2cAddr);
- error = m_i2Ctx.write(buffer, len);
-
- return error;
-}
-
-float
-MLX90614::readTemperature (uint8_t address) {
- uint8_t buffer[3];
- float temperature = 0;
-
- /* Reading temperature from sensor.
- Answer contained of 3 bytes (TEMP_LSB | TEMP_MSB | PEC)
- */
- if (i2cReadReg_N(address, 3, buffer) > 2) {
- temperature = buffer[0];
- temperature = buffer[1] << 8;
-
- temperature *= .02;
- temperature -= 273.15;
- }
-
- return temperature;
-}
diff --git a/peripheral/libupm/src/mlx90614/mlx90614.h b/peripheral/libupm/src/mlx90614/mlx90614.h
deleted file mode 100644
index 0cfe27c..0000000
--- a/peripheral/libupm/src/mlx90614/mlx90614.h
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include <mraa/i2c.hpp>
-
-#define DEVICE_ADDR 0x5A // device address
-
-// RAM
-#define MLX90614_RAWIR1 0x04
-#define MLX90614_RAWIR2 0x05
-#define MLX90614_TA 0x06
-#define MLX90614_TOBJ1 0x07
-#define MLX90614_TOBJ2 0x08
-// EEPROM
-#define MLX90614_TOMAX 0x20
-#define MLX90614_TOMIN 0x21
-#define MLX90614_PWMCTRL 0x22
-#define MLX90614_TARANGE 0x23
-#define MLX90614_EMISS 0x24
-#define MLX90614_CONFIG 0x25
-#define MLX90614_ADDR 0x0E
-#define MLX90614_ID1 0x3C
-#define MLX90614_ID2 0x3D
-#define MLX90614_ID3 0x3E
-#define MLX90614_ID4 0x3F
-
-#define HIGH 1
-#define LOW 0
-
-namespace upm {
-
-/**
- * @brief MLX90614 Temperature Sensor library
- * @defgroup mlx90614 libupm-mlx90614
- * @ingroup generic i2c temperature
- */
-/**
- * @library mlx90614
- * @sensor mlx90614
- * @comname MLX90614 Temperature Sensor
- * @type temperature
- * @man generic
- * @con i2c
- *
- * @brief API for the MLX90614 Temperature Sensor
- *
- * This module defines the MLX90614 interface for libmlx90614
- *
- * @image html mlx90614.jpg
- * @snippet mlx90614.cxx Interesting
- */
-class MLX90614 {
- public:
-
- /**
- * Instantiates an MLX90614 object
- *
- * @param bus Number of the used bus
- * @param devAddr Address of the used I2C device
- */
- MLX90614 (int bus=0, int devAddr=0x5A);
-
- /**
- * Reads the object temperature in Fahrenheit
- */
- float readObjectTempF(void);
-
- /**
- * Reads the ambient temperature in Fahrenheit
- */
- float readAmbientTempF(void);
- /**
- * Reads the object temperature in Celsius
- */
- float readObjectTempC(void);
-
- /**
- * Reads the ambient temperature in Celsius
- */
- float readAmbientTempC(void);
-
- /**
- * Returns the name of the component
- */
- std::string name()
- {
- return m_name;
- }
- private:
- std::string m_name;
-
- int m_i2cAddr;
- int m_bus;
- mraa::I2c m_i2Ctx;
-
- uint16_t i2cReadReg_N (int reg, unsigned int len, uint8_t * buffer);
- mraa::Result i2cWriteReg_N (uint8_t reg, unsigned int len, uint8_t * buffer);
- float readTemperature (uint8_t address);
-};
-
-}
diff --git a/peripheral/libupm/src/mlx90614/pyupm_mlx90614.i b/peripheral/libupm/src/mlx90614/pyupm_mlx90614.i
deleted file mode 100644
index 59c6cb4..0000000
--- a/peripheral/libupm/src/mlx90614/pyupm_mlx90614.i
+++ /dev/null
@@ -1,11 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_mlx90614
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "mlx90614.h"
-%{
- #include "mlx90614.h"
-%}
diff --git a/peripheral/libupm/src/mma7455/CMakeLists.txt b/peripheral/libupm/src/mma7455/CMakeLists.txt
deleted file mode 100644
index a52cbc9..0000000
--- a/peripheral/libupm/src/mma7455/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "mma7455")
-set (libdescription "upm MMA7455")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/mma7455/javaupm_mma7455.i b/peripheral/libupm/src/mma7455/javaupm_mma7455.i
deleted file mode 100644
index 04a1f1f..0000000
--- a/peripheral/libupm/src/mma7455/javaupm_mma7455.i
+++ /dev/null
@@ -1,40 +0,0 @@
-%module javaupm_mma7455
-%include "../upm.i"
-%include "typemaps.i"
-%include "arrays_java.i";
-%include "../java_buffer.i"
-
-%apply short *OUTPUT { short * ptrX, short * ptrY, short * ptrZ };
-
-%typemap(jni) short* "jshortArray"
-%typemap(jstype) short* "short[]"
-%typemap(jtype) short* "short[]"
-
-%typemap(javaout) short* {
- return $jnicall;
-}
-
-%typemap(out) short *readData {
- $result = JCALL1(NewShortArray, jenv, 3);
- JCALL4(SetShortArrayRegion, jenv, $result, 0, 3, (const signed short*)$1);
- delete [] $1;
-}
-
-%ignore readData(short *, short *, short *);
-
-%{
- #include "mma7455.h"
-%}
-
-%include "mma7455.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_mma7455");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/mma7455/jsupm_mma7455.i b/peripheral/libupm/src/mma7455/jsupm_mma7455.i
deleted file mode 100644
index 3ec5f13..0000000
--- a/peripheral/libupm/src/mma7455/jsupm_mma7455.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_mma7455
-%include "../upm.i"
-
-%{
- #include "mma7455.h"
-%}
-
-%include "mma7455.h"
diff --git a/peripheral/libupm/src/mma7455/mma7455.cxx b/peripheral/libupm/src/mma7455/mma7455.cxx
deleted file mode 100644
index 371ac2f..0000000
--- a/peripheral/libupm/src/mma7455/mma7455.cxx
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <string>
-#include <stdexcept>
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-#include <pthread.h>
-#include <math.h>
-
-#include "mma7455.h"
-
-using namespace upm;
-
-MMA7455::MMA7455 (int bus, int devAddr) : m_i2ControlCtx(bus) {
- unsigned char data = 0;
- int nBytes = 0;
-
- m_name = "MMA7455";
-
- m_controlAddr = devAddr;
- m_bus = bus;
-
- mraa::Result error = m_i2ControlCtx.address(m_controlAddr);
- if (error != mraa::SUCCESS) {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": mraa_i2c_address() failed");
- return;
- }
-
- // setting GLVL 0x1 (64LSB/g) and MODE 0x1 (Measurement Mode)
- data = (BIT (MMA7455_GLVL0) | BIT (MMA7455_MODE0));
- error = i2cWriteReg (MMA7455_MCTL, &data, 0x1);
- if (error != mraa::SUCCESS) {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": writing mode register failed");
- return;
- }
-
- if (mraa::SUCCESS != calibrate ()) {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": calibrate() failed");
- return;
- }
-}
-
-mraa::Result
-MMA7455::calibrate () {
- mraa::Result error = mraa::SUCCESS;
- int i = 0;
-
- accelData xyz;
- xyz.value.x = xyz.value.y = xyz.value.z = 0;
-
- do {
- error = readData (&xyz.value.x, &xyz.value.y, &xyz.value.z);
- if (mraa::SUCCESS != error) {
- return error;
- }
-
- xyz.value.x += 2 * -xyz.value.x;
- xyz.value.y += 2 * -xyz.value.y;
- xyz.value.z += 2 * -(xyz.value.z - 64);
-
- error = i2cWriteReg (MMA7455_XOFFL, (unsigned char *) &xyz, 0x6);
- if (error != mraa::SUCCESS) {
- return error;
- }
-
- } while ( ++i < 3 );
-
- return error;
-}
-
-mraa::Result
-MMA7455::readData (short * ptrX, short * ptrY, short * ptrZ) {
- accelData xyz;
- unsigned char data = 0;
- int nBytes = 0;
-
- /*do {
- nBytes = i2cReadReg (MMA7455_STATUS, &data, 0x1);
- } while ( !(data & MMA7455_DRDY) && nBytes == mraa::SUCCESS);
-
- if (nBytes == mraa::SUCCESS) {
- std::cout << "NO_GDB :: 1" << std::endl;
- return mraa::SUCCESS;
- }*/
-
- nBytes = i2cReadReg (MMA7455_XOUTL, (unsigned char *) &xyz, 0x6);
- if (nBytes == 0) {
- std::cout << "NO_GDB :: 2" << std::endl;
- return mraa::ERROR_UNSPECIFIED;
- }
-
- if (xyz.reg.x_msb & 0x02) {
- xyz.reg.x_msb |= 0xFC;
- }
-
- if (xyz.reg.y_msb & 0x02) {
- xyz.reg.y_msb |= 0xFC;
- }
-
- if (xyz.reg.z_msb & 0x02) {
- xyz.reg.z_msb |= 0xFC;
- }
-
- // The result is the g-force in units of 64 per 'g'.
- *ptrX = xyz.value.x;
- *ptrY = xyz.value.y;
- *ptrZ = xyz.value.z;
-
- return mraa::SUCCESS;
-}
-
-#ifdef SWIGJAVA
-short *MMA7455::readData() {
- short *v = new short[3];
- readData(&v[0], &v[1], &v[2]);
- return v;
-}
-#endif
-
-int
-MMA7455::i2cReadReg (unsigned char reg, uint8_t *buffer, int len) {
- if (mraa::SUCCESS != m_i2ControlCtx.address(m_controlAddr)) {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": mraa_i2c_address() failed");
- return 0;
- }
-
- if (mraa::SUCCESS != m_i2ControlCtx.writeByte(reg)) {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": mraa_i2c_write_byte() failed");
- return 0;
- }
-
- return (int) m_i2ControlCtx.read(buffer, len);
-}
-
-mraa::Result
-MMA7455::i2cWriteReg (unsigned char reg, uint8_t *buffer, int len) {
- mraa::Result error = mraa::SUCCESS;
-
- uint8_t data[len + 1];
- data[0] = reg;
- memcpy(&data[1], buffer, len);
-
- error = m_i2ControlCtx.address (m_controlAddr);
- if (error != mraa::SUCCESS) {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": mraa_i2c_address() failed");
- return error;
- }
- error = m_i2ControlCtx.write (data, len + 1);
- if (error != mraa::SUCCESS) {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": mraa_i2c_write() failed");
- return error;
- }
-
- return error;
-}
diff --git a/peripheral/libupm/src/mma7455/mma7455.h b/peripheral/libupm/src/mma7455/mma7455.h
deleted file mode 100644
index e643dec..0000000
--- a/peripheral/libupm/src/mma7455/mma7455.h
+++ /dev/null
@@ -1,243 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include <mraa/i2c.hpp>
-
-#define ADDR 0x1D // device address
-
-// Register names according to the datasheet.
-// Register 0x1C is sometimes called 'PW', and sometimes 'PD'.
-// The two reserved registers cannot be used.
-#define MMA7455_XOUTL 0x00 // Read only, Output Value X LSB
-#define MMA7455_XOUTH 0x01 // Read only, Output Value X MSB
-#define MMA7455_YOUTL 0x02 // Read only, Output Value Y LSB
-#define MMA7455_YOUTH 0x03 // Read only, Output Value Y MSB
-#define MMA7455_ZOUTL 0x04 // Read only, Output Value Z LSB
-#define MMA7455_ZOUTH 0x05 // Read only, Output Value Z MSB
-#define MMA7455_XOUT8 0x06 // Read only, Output Value X 8 bits
-#define MMA7455_YOUT8 0x07 // Read only, Output Value Y 8 bits
-#define MMA7455_ZOUT8 0x08 // Read only, Output Value Z 8 bits
-#define MMA7455_STATUS 0x09 // Read only, Status Register
-#define MMA7455_DETSRC 0x0A // Read only, Detection Source Register
-#define MMA7455_TOUT 0x0B // Temperature Output Value (Optional)
-#define MMA7455_RESERVED1 0x0C // Reserved
-#define MMA7455_I2CAD 0x0D // Read/Write, I2C Device Address
-#define MMA7455_USRINF 0x0E // Read only, User Information (Optional)
-#define MMA7455_WHOAMI 0x0F // Read only, "Who am I" value (Optional)
-#define MMA7455_XOFFL 0x10 // Read/Write, Offset Drift X LSB
-#define MMA7455_XOFFH 0x11 // Read/Write, Offset Drift X MSB
-#define MMA7455_YOFFL 0x12 // Read/Write, Offset Drift Y LSB
-#define MMA7455_YOFFH 0x13 // Read/Write, Offset Drift Y MSB
-#define MMA7455_ZOFFL 0x14 // Read/Write, Offset Drift Z LSB
-#define MMA7455_ZOFFH 0x15 // Read/Write, Offset Drift Z MSB
-#define MMA7455_MCTL 0x16 // Read/Write, Mode Control Register
-#define MMA7455_INTRST 0x17 // Read/Write, Interrupt Latch Reset
-#define MMA7455_CTL1 0x18 // Read/Write, Control 1 Register
-#define MMA7455_CTL2 0x19 // Read/Write, Control 2 Register
-#define MMA7455_LDTH 0x1A // Read/Write, Level Detection Threshold Limit Value
-#define MMA7455_PDTH 0x1B // Read/Write, Pulse Detection Threshold Limit Value
-#define MMA7455_PD 0x1C // Read/Write, Pulse Duration Value
-#define MMA7455_LT 0x1D // Read/Write, Latency Time Value (between pulses)
-#define MMA7455_TW 0x1E // Read/Write, Time Window for Second Pulse Value
-#define MMA7455_RESERVED2 0x1F // Reserved
-
-// Defines for the bits to be able to change
-// between the bit number and the binary definition.
-// By using the bit number, programming MMA7455
-// is like programming an AVR microcontroller.
-// But instead of using "(1<<X)", or "_BV(X)",
-// the Arduino "bit(X)" is used.
-#define MMA7455_D0 0
-#define MMA7455_D1 1
-#define MMA7455_D2 2
-#define MMA7455_D3 3
-#define MMA7455_D4 4
-#define MMA7455_D5 5
-#define MMA7455_D6 6
-#define MMA7455_D7 7
-
-// Status Register
-#define MMA7455_DRDY MMA7455_D0
-#define MMA7455_DOVR MMA7455_D1
-#define MMA7455_PERR MMA7455_D2
-
-// Mode Control Register
-#define MMA7455_MODE0 MMA7455_D0
-#define MMA7455_MODE1 MMA7455_D1
-#define MMA7455_GLVL0 MMA7455_D2
-#define MMA7455_GLVL1 MMA7455_D3
-#define MMA7455_STON MMA7455_D4
-#define MMA7455_SPI3W MMA7455_D5
-#define MMA7455_DRPD MMA7455_D6
-
-// Control 1 Register
-#define MMA7455_INTPIN MMA7455_D0
-#define MMA7455_INTREG0 MMA7455_D1
-#define MMA7455_INTREG1 MMA7455_D2
-#define MMA7455_XDA MMA7455_D3
-#define MMA7455_YDA MMA7455_D4
-#define MMA7455_ZDA MMA7455_D5
-#define MMA7455_THOPT MMA7455_D6
-#define MMA7455_DFBW MMA7455_D7
-
-// Control 2 Register
-#define MMA7455_LDPL MMA7455_D0
-#define MMA7455_PDPL MMA7455_D1
-#define MMA7455_DRVO MMA7455_D2
-
-// Interrupt Latch Reset Register
-#define MMA7455_CLR_INT1 MMA7455_D0
-#define MMA7455_CLR_INT2 MMA7455_D1
-
-// Detection Source Register
-#define MMA7455_INT1 MMA7455_D0
-#define MMA7455_INT2 MMA7455_D1
-#define MMA7455_PDZ MMA7455_D2
-#define MMA7455_PDY MMA7455_D3
-#define MMA7455_PDX MMA7455_D4
-#define MMA7455_LDZ MMA7455_D5
-#define MMA7455_LDY MMA7455_D6
-#define MMA7455_LDX MMA7455_D7
-
-// I2C Device Address Register
-#define MMA7455_I2CDIS MMA7455_D7
-
-#define HIGH 1
-#define LOW 0
-
-namespace upm {
-
-typedef union {
- struct {
- unsigned char x_lsb;
- unsigned char x_msb;
- unsigned char y_lsb;
- unsigned char y_msb;
- unsigned char z_lsb;
- unsigned char z_msb;
- } reg;
-
- struct {
- short x;
- short y;
- short z;
- } value;
-} accelData;
-
-#define BIT(n) (1<<n)
-
-/**
- * @brief MMA7455 Accelerometer library
- * @defgroup mma7455 libupm-mma7455
- * @ingroup generic i2c accelerometer
- */
-/**
- * @library mma7455
- * @sensor mma7455
- * @comname MMA7455 Accelerometer Sensor
- * @type accelerometer
- * @man generic
- * @con i2c
- *
- * @brief API for the MMA7455 Accelerometer
- *
- * This module defines the MMA7455 interface for libmma7455
- *
- * @image html mma7455.jpg
- * @snippet mma7455.cxx Interesting
- */
-class MMA7455 {
- public:
- /**
- * Instantiates an MMA7455 object
- *
- * @param bus Number of the used bus
- * @param devAddr Address of the used I2C device
- */
- MMA7455 (int bus=0, int devAddr=0x1D);
-
- /**
- * Returns the name of the component
- *
- * @return Name of the component
- */
- std::string name()
- {
- return m_name;
- }
-
- /**
- * Calibrates the sensor
- *
- * @return 0 (MRAA_SUCCESS) if successful; non-zero otherwise
- */
- mraa::Result calibrate ();
-
- /**
- * Reads X-axis, Y-axis, and Z-axis acceleration data
- *
- * @param ptrX X-axis
- * @param ptrY Y-axis
- * @param ptrZ Z-axis
- *
- * @return 0 (MRAA_SUCCESS) if successful; non-zero otherwise
- */
- mraa::Result readData (short * ptrX, short * ptrY, short * ptrZ);
-
-#ifdef SWIGJAVA
- /**
- * Reads X-axis, Y-axis, and Z-axis acceleration data
- *
- * @return Array containing X, Y, Z acceleration data
- */
- short *readData ();
-#endif
- /**
- * Internal function for reading I2C data
- *
- * @param reg Register address
- * @param buffer Register data buffer
- * @param len Buffer size
- */
- int i2cReadReg (unsigned char reg, uint8_t *buffer, int len);
-
- /**
- * Internal function for writing I2C data
- *
- * @param reg Register address
- * @param buffer Register data buffer
- * @param len Buffer size
- */
- mraa::Result i2cWriteReg (unsigned char reg, uint8_t *buffer, int len);
-
- private:
- std::string m_name;
- int m_controlAddr;
- int m_bus;
- mraa::I2c m_i2ControlCtx;
-};
-
-}
diff --git a/peripheral/libupm/src/mma7455/pyupm_mma7455.i b/peripheral/libupm/src/mma7455/pyupm_mma7455.i
deleted file mode 100644
index 309a138..0000000
--- a/peripheral/libupm/src/mma7455/pyupm_mma7455.i
+++ /dev/null
@@ -1,11 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_mma7455
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "mma7455.h"
-%{
- #include "mma7455.h"
-%}
diff --git a/peripheral/libupm/src/mma7660/CMakeLists.txt b/peripheral/libupm/src/mma7660/CMakeLists.txt
deleted file mode 100644
index 4748db5..0000000
--- a/peripheral/libupm/src/mma7660/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "mma7660")
-set (libdescription "upm mma7660 I2C 3-axis digital accelermeter (1.5g)")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/mma7660/javaupm_mma7660.i b/peripheral/libupm/src/mma7660/javaupm_mma7660.i
deleted file mode 100644
index 50a2116..0000000
--- a/peripheral/libupm/src/mma7660/javaupm_mma7660.i
+++ /dev/null
@@ -1,56 +0,0 @@
-%module javaupm_mma7660
-%include "../upm.i"
-%include "cpointer.i"
-%include "typemaps.i"
-
-%apply int *OUTPUT { int *x, int *y, int *z };
-%apply float *OUTPUT { float *ax, float *ay, float *az };
-
-%{
- #include "mma7660.h"
-%}
-
-%typemap(jni) float* "jfloatArray"
-%typemap(jstype) float* "float[]"
-%typemap(jtype) float* "float[]"
-
-%typemap(javaout) float* {
- return $jnicall;
-}
-
-%typemap(out) float *getAcceleration {
- $result = JCALL1(NewFloatArray, jenv, 3);
- JCALL4(SetFloatArrayRegion, jenv, $result, 0, 3, $1);
- delete [] $1;
-}
-
-
-%typemap(jni) int* "jintArray"
-%typemap(jstype) int* "int[]"
-%typemap(jtype) int* "int[]"
-
-%typemap(javaout) int* {
- return $jnicall;
-}
-
-%typemap(out) int *getRawValues {
- $result = JCALL1(NewIntArray, jenv, 3);
- JCALL4(SetIntArrayRegion, jenv, $result, 0, 3, (const signed int*)$1);
- delete [] $1;
-}
-
-%ignore getRawValues(int *, int *, int *);
-%ignore getAcceleration(float *, float *, float *);
-
-%include "mma7660.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_mma7660");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%}
diff --git a/peripheral/libupm/src/mma7660/jsupm_mma7660.i b/peripheral/libupm/src/mma7660/jsupm_mma7660.i
deleted file mode 100644
index 25adc07..0000000
--- a/peripheral/libupm/src/mma7660/jsupm_mma7660.i
+++ /dev/null
@@ -1,13 +0,0 @@
-%module jsupm_mma7660
-%include "../upm.i"
-%include "cpointer.i"
-
-/* Send "int *" and "float *" to JavaScript as intp and floatp */
-%pointer_functions(int, intp);
-%pointer_functions(float, floatp);
-
-%{
- #include "mma7660.h"
-%}
-
-%include "mma7660.h"
diff --git a/peripheral/libupm/src/mma7660/mma7660.cxx b/peripheral/libupm/src/mma7660/mma7660.cxx
deleted file mode 100644
index 2215221..0000000
--- a/peripheral/libupm/src/mma7660/mma7660.cxx
+++ /dev/null
@@ -1,275 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <stdexcept>
-#include <string>
-
-#include "mma7660.h"
-
-using namespace upm;
-using namespace std;
-
-
-MMA7660::MMA7660(int bus, uint8_t address)
-{
- m_addr = address;
- m_isrInstalled = false;
-
- // setup our i2c link
- if ( !(m_i2c = mraa_i2c_init(bus)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_i2c_init() failed");
- return;
- }
-
- mraa_result_t rv;
-
- if ( (rv = mraa_i2c_address(m_i2c, m_addr)) != MRAA_SUCCESS)
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_i2c_address() failed");
- return;
- }
-}
-
-MMA7660::~MMA7660()
-{
- if (m_isrInstalled)
- uninstallISR();
-
- setModeStandby();
- mraa_i2c_stop(m_i2c);
-}
-
-bool MMA7660::writeByte(uint8_t reg, uint8_t byte)
-{
- mraa_result_t rv = mraa_i2c_write_byte_data(m_i2c, byte, reg);
-
- if (rv != MRAA_SUCCESS)
- {
- return false;
- }
-
- return true;
-}
-
-uint8_t MMA7660::readByte(uint8_t reg)
-{
- return mraa_i2c_read_byte_data(m_i2c, reg);
-}
-
-void MMA7660::getRawValues(int *x, int *y, int *z)
-{
- *x = getVerifiedAxis(REG_XOUT);
- *y = getVerifiedAxis(REG_YOUT);
- *z = getVerifiedAxis(REG_ZOUT);
-}
-
-#ifdef JAVACALLBACK
-int *MMA7660::getRawValues()
-{
- int *values = new int[3];
- getRawValues(&values[0], &values[1], &values[2]);
- return values;
-}
-#endif
-
-void MMA7660::setModeActive()
-{
- uint8_t modeReg = readByte(REG_MODE);
-
- // The D2 (TON bit) should be cleared, and the MODE bit set
-
- modeReg &= ~MODE_TON;
- modeReg |= MODE_MODE;
-
- writeByte(REG_MODE, modeReg);
-}
-
-void MMA7660::setModeStandby()
-{
- uint8_t modeReg = readByte(REG_MODE);
-
- // the D0 (mode bit) and D2 (TON bit) should be cleared.
-
- modeReg &= ~MODE_TON;
- modeReg &= ~MODE_MODE;
-
- writeByte(REG_MODE, modeReg);
-}
-
-// read an axis value, verifying it's validity
-int MMA7660::getVerifiedAxis(MMA7660_REG_T axis)
-{
- // We only want one of the 3 axes
-
- if (axis > 2)
- {
- throw std::out_of_range(std::string(__FUNCTION__) +
- ": axis must be 0, 1, or 2.");
- return 0;
- }
-
- // we need to check the alert bit and sign bits if the alert bit is
- // set, this means that the register was being updated when the
- // register was read, so re-read until it's clear.
-
- uint8_t val;
- do {
- val = readByte(axis);
-
- // check alert bit
- } while (val & 0x40);
-
- // shift the sign bit over, and compensate
- return (char(val << 2) / 4);
-}
-
-// read the tilt register, verifying it's validity
-uint8_t MMA7660::getVerifiedTilt()
-{
- // we need to check the alert bit and sign bits if the alert bit is
- // set, this means that the register was being updated when the
- // register was read, so re-read until it's clear.
-
- uint8_t val;
- do {
- val = readByte(REG_TILT);
-
- // check alert bit
- } while (val & 0x40);
-
- return val;
-}
-
-uint8_t MMA7660::tiltBackFront()
-{
- uint8_t val = getVerifiedTilt();
-
- // mask off the bits we don't care about
- val &= 0x03;
- return val;
-}
-
-uint8_t MMA7660::tiltLandscapePortrait()
-{
- uint8_t val = getVerifiedTilt();
-
- // mask off the bits we don't care about
- val >>= 2;
- val &= 0x07;
- return val;
-}
-
-bool MMA7660::tiltTap()
-{
- uint8_t val = getVerifiedTilt();
-
- if (val & 0x20)
- return true;
- else
- return false;
-}
-
-bool MMA7660::tiltShake()
-{
- uint8_t val = getVerifiedTilt();
-
- if (val & 0x80)
- return true;
- else
- return false;
-}
-
-#ifdef JAVACALLBACK
-void MMA7660::installISR(int pin, jobject runnable)
-{
- installISR(pin, mraa_java_isr_callback, runnable);
-}
-#endif
-
-void MMA7660::installISR(int pin, void (*isr)(void *), void *arg)
-{
- if (m_isrInstalled)
- uninstallISR();
-
- if ( !(m_gpio = mraa_gpio_init(pin)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_gpio_init() failed, invalid pin?");
- return;
- }
-
- mraa_gpio_dir(m_gpio, MRAA_GPIO_IN);
-
- // install our interrupt handler
- mraa_gpio_isr(m_gpio, MRAA_GPIO_EDGE_RISING,
- isr, arg);
- m_isrInstalled = true;
-}
-
-void MMA7660::uninstallISR()
-{
- if (!m_isrInstalled)
- return;
-
- mraa_gpio_isr_exit(m_gpio);
- m_isrInstalled = false;
- mraa_gpio_close(m_gpio);
-}
-
-bool MMA7660::setInterruptBits(uint8_t ibits)
-{
- return writeByte(REG_INTSU, ibits);
-}
-
-bool MMA7660::setSampleRate(MMA7660_AUTOSLEEP_T sr)
-{
- return writeByte(REG_SR, sr);
-}
-
-void MMA7660::getAcceleration(float *ax, float *ay, float *az)
-{
- int x, y, z;
-
- getRawValues(&x, &y, &z);
-
- // 21.33, typical counts/g
-
- *ax = x/21.33;
- *ay = y/21.33;
- *az = z/21.33;
-}
-
-#ifdef JAVACALLBACK
-float *MMA7660::getAcceleration()
-{
- float *values = new float[3];
- getAcceleration(&values[0], &values[1], &values[2]);
- return values;
-}
-#endif
-
diff --git a/peripheral/libupm/src/mma7660/mma7660.cxx.orig b/peripheral/libupm/src/mma7660/mma7660.cxx.orig
deleted file mode 100644
index a563dd4..0000000
--- a/peripheral/libupm/src/mma7660/mma7660.cxx.orig
+++ /dev/null
@@ -1,275 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <stdexcept>
-#include <string>
-
-#include "mma7660.h"
-
-using namespace upm;
-using namespace std;
-
-
-MMA7660::MMA7660(int bus, uint8_t address)
-{
- m_addr = address;
- m_isrInstalled = false;
-
- // setup our i2c link
- if ( !(m_i2c = mraa_i2c_init(bus)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_i2c_init() failed");
- return;
- }
-
- mraa_result_t rv;
-
- if ( (rv = mraa_i2c_address(m_i2c, m_addr)) != MRAA_SUCCESS)
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_i2c_address() failed");
- return;
- }
-}
-
-MMA7660::~MMA7660()
-{
- if (m_isrInstalled)
- uninstallISR();
-
- setModeStandby();
- mraa_i2c_stop(m_i2c);
-}
-
-bool MMA7660::writeByte(uint8_t reg, uint8_t byte)
-{
- mraa_result_t rv = mraa_i2c_write_byte_data(m_i2c, byte, reg);
-
- if (rv != MRAA_SUCCESS)
- {
- return false;
- }
-
- return true;
-}
-
-uint8_t MMA7660::readByte(uint8_t reg)
-{
- return mraa_i2c_read_byte_data(m_i2c, reg);
-}
-
-void MMA7660::getRawValues(int *x, int *y, int *z)
-{
- *x = getVerifiedAxis(REG_XOUT);
- *y = getVerifiedAxis(REG_YOUT);
- *z = getVerifiedAxis(REG_ZOUT);
-}
-
-#ifdef JAVACALLBACK
-int *MMA7660::getRawValues()
-{
- int *values = new int[3];
- getRawValues(&values[0], &values[1], &values[2]);
- return values;
-}
-#endif
-
-void MMA7660::setModeActive()
-{
- uint8_t modeReg = readByte(REG_MODE);
-
- // The D2 (TON bit) should be cleared, and the MODE bit set
-
- modeReg &= ~MODE_TON;
- modeReg |= MODE_MODE;
-
- writeByte(REG_MODE, modeReg);
-}
-
-void MMA7660::setModeStandby()
-{
- uint8_t modeReg = readByte(REG_MODE);
-
- // the D0 (mode bit) and D2 (TON bit) should be cleared.
-
- modeReg &= ~MODE_TON;
- modeReg &= ~MODE_MODE;
-
- writeByte(REG_MODE, modeReg);
-}
-
-// read an axis value, verifying it's validity
-int MMA7660::getVerifiedAxis(MMA7660_REG_T axis)
-{
- // We only want one of the 3 axes
-
- if (axis > 2)
- {
- throw std::out_of_range(std::string(__FUNCTION__) +
- ": axis must be 0, 1, or 2.");
- return 0;
- }
-
- // we need to check the alert bit and sign bits if the alert bit is
- // set, this means that the register was being updated when the
- // register was read, so re-read until it's clear.
-
- uint8_t val;
- do {
- val = readByte(axis);
-
- // check alert bit
- } while (val & 0x40);
-
- // shift the sign bit over, and compensate
- return (char(val << 2) / 4);
-}
-
-// read the tilt register, verifying it's validity
-uint8_t MMA7660::getVerifiedTilt()
-{
- // we need to check the alert bit and sign bits if the alert bit is
- // set, this means that the register was being updated when the
- // register was read, so re-read until it's clear.
-
- uint8_t val;
- do {
- val = readByte(REG_TILT);
-
- // check alert bit
- } while (val & 0x40);
-
- return val;
-}
-
-uint8_t MMA7660::tiltBackFront()
-{
- uint8_t val = getVerifiedTilt();
-
- // mask off the bits we don't care about
- val &= 0x03;
- return val;
-}
-
-uint8_t MMA7660::tiltLandscapePortrait()
-{
- uint8_t val = getVerifiedTilt();
-
- // mask off the bits we don't care about
- val >>= 2;
- val &= 0x07;
- return val;
-}
-
-bool MMA7660::tiltTap()
-{
- uint8_t val = getVerifiedTilt();
-
- if (val & 0x20)
- return true;
- else
- return false;
-}
-
-bool MMA7660::tiltShake()
-{
- uint8_t val = getVerifiedTilt();
-
- if (val & 0x80)
- return true;
- else
- return false;
-}
-
-#ifdef JAVACALLBACK
-void MMA7660::installISR(int pin, IsrCallback *cb)
-{
- installISR(pin, generic_callback_isr, cb);
-}
-#endif
-
-void MMA7660::installISR(int pin, void (*isr)(void *), void *arg)
-{
- if (m_isrInstalled)
- uninstallISR();
-
- if ( !(m_gpio = mraa_gpio_init(pin)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_gpio_init() failed, invalid pin?");
- return;
- }
-
- mraa_gpio_dir(m_gpio, MRAA_GPIO_IN);
-
- // install our interrupt handler
- mraa_gpio_isr(m_gpio, MRAA_GPIO_EDGE_RISING,
- isr, arg);
- m_isrInstalled = true;
-}
-
-void MMA7660::uninstallISR()
-{
- if (!m_isrInstalled)
- return;
-
- mraa_gpio_isr_exit(m_gpio);
- m_isrInstalled = false;
- mraa_gpio_close(m_gpio);
-}
-
-bool MMA7660::setInterruptBits(uint8_t ibits)
-{
- return writeByte(REG_INTSU, ibits);
-}
-
-bool MMA7660::setSampleRate(MMA7660_AUTOSLEEP_T sr)
-{
- return writeByte(REG_SR, sr);
-}
-
-void MMA7660::getAcceleration(float *ax, float *ay, float *az)
-{
- int x, y, z;
-
- getRawValues(&x, &y, &z);
-
- // 21.33, typical counts/g
-
- *ax = x/21.33;
- *ay = y/21.33;
- *az = z/21.33;
-}
-
-#ifdef JAVACALLBACK
-float *MMA7660::getAcceleration()
-{
- float *values = new float[3];
- getAcceleration(&values[0], &values[1], &values[2]);
- return values;
-}
-#endif
-
diff --git a/peripheral/libupm/src/mma7660/mma7660.h b/peripheral/libupm/src/mma7660/mma7660.h
deleted file mode 100644
index f18a5de..0000000
--- a/peripheral/libupm/src/mma7660/mma7660.h
+++ /dev/null
@@ -1,311 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include <mraa/i2c.h>
-#include <mraa/gpio.h>
-
-#define MMA7660_I2C_BUS 0
-#define MMA7660_DEFAULT_I2C_ADDR 0x4c
-
-namespace upm {
-
- /**
- * @brief MMA7660 I2C 3-Axis Digital Accelerometer library
- * @defgroup mma7660 libupm-mma7660
- * @ingroup seeed i2c gpio accelerometer
- */
- /**
- * @library mma7660
- * @sensor mma7660
- * @comname MMA7660 3-Axis Digital Accelerometer
- * @altname Grove 3-Axis Digital Accelerometer (1.5g)
- * @type accelerometer
- * @man seeed
- * @con i2c gpio
- *
- * @brief API for the MMA7660 I2C 3-Axis Digital Accelerometer
- *
- * UPM module for the MMA7660 I2C 3-axis digital accelerometer.
- * This device supports a variety of capabilities, including the
- * generation of interrupts for various conditions, tilt and basic
- * gesture detection, and X/Y/Z-axis measurements of g-forces
- * being applied (up to 1.5g)
- *
- * This module was tested with the Grove 3-Axis Digital
- * Accelerometer (1.5g)
- *
- * @image html mma7660.jpg
- * @snippet mma7660.cxx Interesting
- */
- class MMA7660 {
- public:
-
- // MMA7660 registers
- typedef enum { REG_XOUT = 0x00,
- REG_YOUT = 0x01,
- REG_ZOUT = 0x02,
- REG_TILT = 0x03,
- REG_SRST = 0x04, // Sampling Rate Status
- REG_SPCNT = 0x05, // sleep count
- REG_INTSU = 0x06, // Interrupt setup
- REG_MODE = 0x07, // operating mode
- REG_SR = 0x08, // auto-wake/sleep, SPS, and debounce
- REG_PDET = 0x09, // tap detection
- REG_PD = 0x0a // tap debounce count
- // 0x0b-0x1f reserved
- } MMA7660_REG_T;
-
- // interrupt enable register bits
- typedef enum { INTR_NONE = 0x00, // disabled
- INTR_FBINT = 0x01, // front/back
- INTR_PLINT = 0x02, // up/down/right/left
- INTR_PDINT = 0x04, // tap detection
- INTR_ASINT = 0x08, // exit auto-sleep
- INTR_GINT = 0x10, // measurement intr
- INTR_SHINTZ = 0x20, // shake on Z
- INTR_SHINTY = 0x40, // shake on Y
- INTR_SHINTX = 0x80 // shake on X
- } MMA7660_INTR_T;
-
- // operating mode register bits
- typedef enum { MODE_MODE = 0x01, // determines mode with MODE_TON
- // 0x02 reserved
- MODE_TON = 0x04, // determines mode with MODE_MODE
- MODE_AWE = 0x08, // auto-wake
- MODE_ASE = 0x10, // auto-sleep
- MODE_SCPS = 0x20, // sleep count prescale
- MODE_IPP = 0x40, // intr out push-pull/open drain
- MODE_IAH = 0x80 // intr active low/high
- } MMA7660_MODE_T;
-
- // tilt BackFront (BF) bits
- typedef enum { BF_UNKNOWN = 0x00,
- BF_LYING_FRONT = 0x01,
- BF_LYING_BACK = 0x02
- } MMA7660_TILT_BF_T;
-
- // tilt LandscapePortrait (LP) bits
- typedef enum { LP_UNKNOWN = 0x00,
- LP_LANDSCAPE_LEFT = 0x01,
- LP_LANDSCAPE_RIGHT = 0x02,
- LP_VERT_DOWN = 0x05,
- LP_VERT_UP = 0x06
- } MMA7660_TILT_LP_T;
-
- // sample rate (auto-sleep) values
- typedef enum { AUTOSLEEP_120 = 0x00,
- AUTOSLEEP_64 = 0x01,
- AUTOSLEEP_32 = 0x02,
- AUTOSLEEP_16 = 0x03,
- AUTOSLEEP_8 = 0x04,
- AUTOSLEEP_4 = 0x05,
- AUTOSLEEP_2 = 0x06,
- AUTOSLEEP_1 = 0x07
- } MMA7660_AUTOSLEEP_T;
-
- /**
- * MMA7660 constructor
- *
- * @param bus I2C bus to use
- * @param address Address for this sensor; default is 0x55
- */
- MMA7660(int bus, uint8_t address = MMA7660_DEFAULT_I2C_ADDR);
-
- /**
- * MMA7660 destructor
- */
- ~MMA7660();
-
- /**
- * Writes a byte value into a register
- *
- * @param reg Register location to write into
- * @param byte Byte to write
- * @return True if successful
- */
- bool writeByte(uint8_t reg, uint8_t byte);
-
- /**
- * Reads a byte value from a register
- *
- * @param reg Register location to read from
- * @return Value in a specified register
- */
- uint8_t readByte(uint8_t reg);
-
- /**
- * Reads the current value of conversion
- *
- * @param x Returned x value
- * @param y Returned y value
- * @param z Returned z value
- */
- void getRawValues(int *x, int *y, int *z);
-
-#if defined(SWIGJAVA) || defined(JAVACALLBACK)
- /**
- * Reads the current value of conversion
- *
- * @return Array containing x, y, z. Free using delete.
- */
- int *getRawValues();
-#endif
-
- /**
- * Gets the computed acceleration
- *
- * @param ax Returned computed acceleration of the X-axis
- * @param ay Returned computed acceleration of the Y-axis
- * @param az Returned computed acceleration of the Z-axis
- */
- void getAcceleration(float *ax, float *ay, float *az);
-
-#if defined(SWIGJAVA) || defined(JAVACALLBACK)
- /**
- * Gets the computed acceleration
- *
- * @return Array containing x, y, z. Free using delete.
- */
- float *getAcceleration();
-#endif
-
- /**
- * Reads an axis, verifying its validity. The value passed must
- * be one of REG_XOUT, REG_YOUT, or REG_ZOUT.
- *
- * @param axis Axis to read
- * @return Axis value
- */
- int getVerifiedAxis(MMA7660_REG_T axis);
-
- /**
- * Reads the tilt register, verifying its validity
- *
- * @return Tilt value
- */
- uint8_t getVerifiedTilt();
-
- /**
- * Puts the device in the active mode. In this mode, register
- * writes are not allowed. Place the device in the standby mode before
- * attempting to write registers.
- *
- */
- void setModeActive();
-
- /**
- * Puts the device in the standby (power saving) mode. Note: when in
- * the standby mode, there is no valid data in the registers. In
- * addition, the only way to write a register is to put the
- * device in the standby mode.
- *
- */
- void setModeStandby();
-
- /**
- * Reads tiltBackFront bits
- *
- * The value returned is one of the MMA7660_TILT_BF_T values
- *
- * @return Bits corresponding to the BackFront tilt status
- */
- uint8_t tiltBackFront();
-
- /**
- * Reads tiltLandscapePortrait bits
- *
- * The value returned is one of the MMA7660_TILT_LP_T values
- *
- * @return Bits corresponding to the LandscapePortrait tilt status
- */
- uint8_t tiltLandscapePortrait();
-
- /**
- * Reads the tiltTap status
- *
- * @return True if a tap is detected
- */
- bool tiltTap();
-
- /**
- * Reads the tiltShake status
- *
- * @return True if a shake is detected
- */
- bool tiltShake();
-
- /**
- * Installs an interrupt service routine (ISR) to be called when
- * an interrupt occurs
- *
- * @param pin GPIO pin to use as the interrupt pin
- * @param fptr Pointer to a function to be called on interrupt
- * @param arg Pointer to an object to be supplied as an
- * argument to the ISR.
- */
-#if defined(SWIGJAVA) || defined(JAVACALLBACK)
- void installISR(int pin, jobject runnable);
-#else
- void installISR(int pin, void (*isr)(void *), void *arg);
-#endif
- /**
- * Uninstalls the previously installed ISR
- *
- */
- void uninstallISR();
-
- /**
- * Enables interrupt generation based on passed interrupt bits.
- * The bits are a bitmask of the requested MMA7660_INTR_T values.
- * Note: the device must be in the standby mode to set this register.
- *
- * @param ibits Sets the requested interrupt bits
- * @return True if successful
- */
- bool setInterruptBits(uint8_t ibits);
-
- /**
- * Sets the sampling rate of the sensor. The value supplied must
- * be one of the MMA7660_AUTOSLEEP_T values.
- *
- * @param sr One of the MMA7660_AUTOSLEEP_T values
- * @return True if successful
- */
- bool setSampleRate(MMA7660_AUTOSLEEP_T sr);
-
- private:
-#if defined(SWIGJAVA) || defined(JAVACALLBACK)
- void installISR(int pin, void (*isr)(void *), void *arg);
-#endif
-
- bool m_isrInstalled;
- mraa_i2c_context m_i2c;
- mraa_gpio_context m_gpio;
- uint8_t m_addr;
- };
-}
-
-
diff --git a/peripheral/libupm/src/mma7660/pyupm_mma7660.i b/peripheral/libupm/src/mma7660/pyupm_mma7660.i
deleted file mode 100644
index 23ba3fd..0000000
--- a/peripheral/libupm/src/mma7660/pyupm_mma7660.i
+++ /dev/null
@@ -1,20 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_mma7660
-%include "../upm.i"
-%include "cpointer.i"
-
-/* Send "int *" and "float *" to python as intp and floatp */
-%pointer_functions(int, intp);
-%pointer_functions(float, floatp);
-
-%feature("autodoc", "3");
-
-#ifdef DOXYGEN
-%include "mma7660_doc.i"
-#endif
-
-%include "mma7660.h"
-%{
- #include "mma7660.h"
-%}
diff --git a/peripheral/libupm/src/mpl3115a2/CMakeLists.txt b/peripheral/libupm/src/mpl3115a2/CMakeLists.txt
deleted file mode 100644
index 586cf21..0000000
--- a/peripheral/libupm/src/mpl3115a2/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "mpl3115a2")
-set (libdescription "libupm Pressure/Temperature Sensor")
-set (module_src ${libname}.cpp)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/mpl3115a2/javaupm_mpl3115a2.i b/peripheral/libupm/src/mpl3115a2/javaupm_mpl3115a2.i
deleted file mode 100644
index 651dbcc..0000000
--- a/peripheral/libupm/src/mpl3115a2/javaupm_mpl3115a2.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_mpl3115a2
-%include "../upm.i"
-
-%{
- #include "mpl3115a2.h"
-%}
-
-%include "mpl3115a2.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_mpl3115a2");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/mpl3115a2/jsupm_mpl3115a2.i b/peripheral/libupm/src/mpl3115a2/jsupm_mpl3115a2.i
deleted file mode 100644
index 318c8a3..0000000
--- a/peripheral/libupm/src/mpl3115a2/jsupm_mpl3115a2.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_mpl3115a2
-%include "../upm.i"
-
-%{
- #include "mpl3115a2.h"
-%}
-
-%include "mpl3115a2.h"
diff --git a/peripheral/libupm/src/mpl3115a2/mpl3115a2.cpp b/peripheral/libupm/src/mpl3115a2/mpl3115a2.cpp
deleted file mode 100644
index 0ed700a..0000000
--- a/peripheral/libupm/src/mpl3115a2/mpl3115a2.cpp
+++ /dev/null
@@ -1,327 +0,0 @@
-/*
- * Author: William Penner <william.penner@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * This application code supports the mpl3115a2 digital barometric pressure
- * and temperature sensor from Freescale. The datasheet is available
- * from their website:
- * http://cache.freescale.com/files/sensors/doc/data_sheet/MPL3115A2.pdf
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-#include <iostream>
-#include <string>
-#include <stdexcept>
-#include <unistd.h>
-#include <stdlib.h>
-
-#include "mpl3115a2.h"
-
-using namespace upm;
-
-MPL3115A2::MPL3115A2 (int bus, int devAddr, uint8_t mode) : m_i2ControlCtx(bus)
-{
- int id;
-
- m_name = MPL3115A2_NAME;
-
- m_controlAddr = devAddr;
- m_bus = bus;
-
- mraa::Result ret = m_i2ControlCtx.address(m_controlAddr);
- if (ret != mraa::SUCCESS) {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": mraa_i2c_address() failed");
- return;
- }
-
- setOversampling(mode);
-
- id = i2cReadReg_8(MPL3115A2_WHO_AM_I);
- if (id != MPL3115A2_DEVICE_ID) {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": incorrect device id");
- return;
- }
-}
-
-/*
- * Function to test the device and verify that is appears operational
- * Typically functioning sensors will return "noisy" values and would
- * be expected to change a bit. This fuction will check for this
- * variation.
- */
-
-int
-MPL3115A2::testSensor(void)
-{
- int i, iTries;
- int iError = 0;
- float pressure, temperature;
- float fPMin, fPMax, fTMin, fTMax;
-
- fprintf(stdout, "Executing Sensor Test.\n" );
-
- pressure = getPressure(true);
- temperature = getTemperature(false);
- fPMin = fPMax = pressure;
- fTMin = fTMax = temperature;
-
- iTries = 20;
- do {
- sampleData();
- pressure = getPressure(true);
- temperature = getTemperature(false);
- if (pressure < fPMin) fPMin = pressure;
- if (pressure > fPMax) fPMax = pressure;
- if (temperature < fTMin) fTMin = temperature;
- if (temperature > fTMax) fTMax = temperature;
- }
- while(fPMin == fPMax && fTMin == fTMax && --iTries);
-
- if (fPMin == fPMax && fTMin == fTMax) {
- fprintf(stdout, " Warning - sensor values not changing.\n" );
- return -1;
- }
-
- fprintf(stdout, " Test complete.\n");
-
- return 0;
-}
-
-/*
- * Function to dump out the i2c register block to the screen
- */
-
-void
-MPL3115A2::dumpSensor(void)
-{
- int i, j, ival;
-
- fprintf(stdout, "Dumping i2c block from %s\n", MPL3115A2_NAME);
- for (i=0; i < 256; i+=16) {
- fprintf(stdout, " %02x: ", i);
- for (j=i; j < i+16; j++) {
- fprintf(stdout, "%02x ", i2cReadReg_8(j));
- }
- fprintf(stdout, "\n");
- }
-}
-
-/*
- * Function used to soft RESET the MPL3115A2 device to ensure
- * it is in a known state. This function can be used to reset
- * the min/max temperature and pressure values.
- */
-
-int
-MPL3115A2::resetSensor(void)
-{
- fprintf(stdout, "Resetting MPL3115A2 device\n" );
- i2cWriteReg(MPL3115A2_CTRL_REG1, MPL3115A2_CTRL_RESET);
- usleep(50000);
- i2cWriteReg(MPL3115A2_CTRL_REG1, MPL3115A2_CTRL_RESET |
- MPL3115A2_SETOVERSAMPLE(m_oversampling));
-
- return 0;
-}
-
-int
-MPL3115A2::sampleData(void)
-{
- int val;
- mraa::Result ret;
- int tries = 15;
- uint32_t us_delay;
-
- // trigger measurement
- ret = i2cWriteReg(MPL3115A2_CTRL_REG1,
- MPL3115A2_CTRL_OST | MPL3115A2_SETOVERSAMPLE(m_oversampling));
- if (mraa::SUCCESS != ret) {
- fprintf(stdout, "Write to trigger measurement failed\n");
- return -1;
- }
-
- // Calculate and delay the appopriate time for the measurement
- us_delay = ((1 << m_oversampling) * 4 + 2) * 1000;
- usleep(us_delay);
-
- // Loop waiting for the ready bit to become active
- while (tries-- > 0) {
- val = i2cReadReg_8(MPL3115A2_CTRL_REG1);
-
- /* wait for data ready, i.e. OST cleared */
- if (!(val & MPL3115A2_CTRL_OST))
- break;
- usleep(20000);
- }
- if (tries < 0) {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": timeout during measurement");
- return -1;
- }
-
- return 0;
-}
-
-int32_t
-MPL3115A2::getPressureReg(int reg) {
- return ((i2cReadReg_16(reg) << 8)|(uint32_t)i2cReadReg_8(reg+2))*100/64;
-}
-
-int32_t
-MPL3115A2::getTempReg(int reg) {
- return (int32_t)((int16_t)i2cReadReg_16(reg)) * 1000 / 256;
-}
-
-float
-MPL3115A2::getPressure(int bSampleData) {
- int ret;
-
- // Trigger request to make a measurement
- if (bSampleData) {
- ret = sampleData();
- if (ret < 0) {
- fprintf(stdout, "Error sampling pressure\n");
- return -1;
- }
- }
- m_iPressure = getPressureReg(MPL3115A2_OUT_PRESS);
-
- return (float)m_iPressure / 100;
-}
-
-float
-MPL3115A2::getTemperature(int bSampleData) {
- int ret;
-
- // Trigger request to make a measurement
- if (bSampleData) {
- ret = sampleData();
- if (ret < 0) {
- fprintf(stdout, "Error sampling temperature\n");
- return -1;
- }
- }
- m_iTemperature = getTempReg(MPL3115A2_OUT_TEMP);
-
- return (float)m_iTemperature / 1000;
-}
-
-float
-MPL3115A2::getSealevelPressure(float altitudeMeters) {
- float fPressure = (float)m_iPressure / 100.0;
- return fPressure / pow(1.0-altitudeMeters/44330, 5.255);
-}
-
-float
-MPL3115A2::getAltitude (float sealevelPressure) {
- float fPressure = (float)m_iPressure / 100.0;
- return 44330 * (1.0 - pow(fPressure /sealevelPressure,0.1903));
-}
-
-void
-MPL3115A2::setOversampling(uint8_t oversampling)
-{
- if (oversampling > MPL3115A2_MAXOVERSAMPLE)
- oversampling = MPL3115A2_MAXOVERSAMPLE;
- m_oversampling = oversampling;
-}
-
-uint8_t
-MPL3115A2::getOversampling(void)
-{
- return m_oversampling;
-}
-
-float
-MPL3115A2::getTemperatureMax(void)
-{
- return (float)getTempReg(MPL3115A2_T_MAX) / 1000;
-}
-
-float
-MPL3115A2::getTemperatureMin(void)
-{
- return (float)getTempReg(MPL3115A2_T_MIN) / 1000;
-}
-
-float
-MPL3115A2::getPressureMax(void)
-{
- return (float)getPressureReg(MPL3115A2_P_MAX) / 1000;
-}
-
-float
-MPL3115A2::getPressureMin(void)
-{
- return (float)getPressureReg(MPL3115A2_P_MIN) / 1000;
-}
-
-float
-MPL3115A2::convertTempCtoF(float fTemp)
-{
- return(fTemp * 9 / 5 + 32);
-}
-
-/*
- * This is set for 15degC (Pa = 0.0002961 in Hg)
- */
-float
-MPL3115A2::convertPaToinHg(float fPressure)
-{
- return(fPressure * 0.0002961);
-}
-
-/*
- * Functions to read and write data to the i2c device
- */
-
-mraa::Result
-MPL3115A2::i2cWriteReg (uint8_t reg, uint8_t value) {
- mraa::Result error = mraa::SUCCESS;
-
- uint8_t data[2] = { reg, value };
- m_i2ControlCtx.address (m_controlAddr);
- error = m_i2ControlCtx.write (data, 2);
-
- if (error != mraa::SUCCESS)
- throw std::runtime_error(std::string(__FUNCTION__) +
- ":mraa_i2c_write() failed");
- return error;
-}
-
-uint16_t
-MPL3115A2::i2cReadReg_16 (int reg) {
- uint16_t data;
-
- m_i2ControlCtx.address(m_controlAddr);
- data = (uint16_t)m_i2ControlCtx.readReg(reg) << 8;
- data |= (uint16_t)m_i2ControlCtx.readReg(reg+1);
-
- return data;
-}
-
-uint8_t
-MPL3115A2::i2cReadReg_8 (int reg) {
- m_i2ControlCtx.address(m_controlAddr);
- return m_i2ControlCtx.readReg(reg);
-}
-
diff --git a/peripheral/libupm/src/mpl3115a2/mpl3115a2.h b/peripheral/libupm/src/mpl3115a2/mpl3115a2.h
deleted file mode 100644
index 56ae8fd..0000000
--- a/peripheral/libupm/src/mpl3115a2/mpl3115a2.h
+++ /dev/null
@@ -1,256 +0,0 @@
-/*
- * Author: William Penner <william.penner@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-#pragma once
-
-#include <string>
-#include <mraa/i2c.hpp>
-#include <math.h>
-
-#define MPL3115A2_NAME "mpl3115a2"
-
-#define MPL3115A2_I2C_ADDRESS 0x60
-#define MPL3115A2_DEVICE_ID 0xc4
-
-#define MPL3115A2_STATUS 0x00
-#define MPL3115A2_OUT_PRESS 0x01 /* MSB first, 20 bit */
-#define MPL3115A2_OUT_TEMP 0x04 /* MSB first, 12 bit */
-#define MPL3115A2_WHO_AM_I 0x0c
-#define MPL3115A2_PT_DATA_CFG 0x13
-#define MPL3115A2_P_MIN 0x1C
-#define MPL3115A2_T_MIN 0x1F
-#define MPL3115A2_P_MAX 0x21
-#define MPL3115A2_T_MAX 0x24
-#define MPL3115A2_CTRL_REG1 0x26
-
-// CTRL_REG1
-#define MPL3115A2_CTRL_SBYB 0x01 /* Standby (not) */
-#define MPL3115A2_CTRL_OST 0x02 /* One-shot trigger */
-#define MPL3115A2_CTRL_RESET 0x04 /* RESET device */
-#define MPL3115A2_CTRL_ALT_MODE 0x80 /* Altitude mode */
-
-#define MPL3115A2_SETOVERSAMPLE(a) ((a & 7) << 3)
-#define MPL3115A2_GETOVERSAMPLE(a) ((a >> 3) & 7)
-#define MPL3115A2_MAXOVERSAMPLE 7
-
-namespace upm {
-
-/**
- * @brief MPL3115A2 Atmospheric Pressure Sensor library
- * @defgroup mpl3115a2 libupm-mpl3115a2
- * @ingroup freescale i2c pressure
- */
-/**
- * @library mpl3115a2
- * @sensor mpl3115a2
- * @comname MPL3115A2 Atmospheric Pressure Sensor
- * @type pressure
- * @man freescale
- * @web http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=MPL3115A2
- * @con i2c
- *
- * @brief API for the MPL3115A2 Atmospheric Pressure Sensor
- *
- * Freescale Semiconductor* [MPL3115A2]
- * (http://cache.freescale.com/files/sensors/doc/data_sheet/MPL3115A2.pdf)
- * is a high-precision, ultra-low power consumption pressure sensor. Its operating
- * range is 50-110 kPa.
- *
- * @image html mpl3115a2.jpg
- * @snippet mpl3115a2.cxx Interesting
- */
-class MPL3115A2 {
- public:
- /**
- * Instantiates an MPL3115A2 object
- *
- * @param bus Number of the used bus
- * @param devAddr Address of the used I2C device
- * @param mode MPL3115A2 oversampling (6 = 64x)
- */
- MPL3115A2(int bus, int devAddr=MPL3115A2_I2C_ADDRESS, uint8_t mode=6);
-
- /**
- * MPL3115A2 object destructor; basically, it closes the I2C connection.
- * ~MPL3115A2();
- * no need for this here, as the I2c connection will be closed when the
- * m_i2ControlCtx variable will go out of scope
- **/
-
- /**
- * Tests the sensor and tries to determine if the sensor is operating by looking
- * for small variations in the value
- */
- int testSensor(void);
-
- /**
- * Performs a soft reset of the MPL3115A2 device to ensure
- * it is in a known state. This function can be used to reset
- * the min/max temperature and pressure values.
- */
- int resetSensor(void);
-
- /**
- * Dumps out the I2C register block to stdout
- */
- void dumpSensor(void);
-
- /**
- * Initiates a temperature/pressure mesasurement and waits for the function
- * to complete. Temperature and pressure registers can be read
- * after this call.
- */
- int sampleData(void);
-
- /**
- * Reads the pressure value from MPL3115A2 [Pa * 100]
- *
- * @param reg Base address of the pressure register
- */
- int32_t getPressureReg(int reg);
-
- /**
- * Reads the temperature value from MPL3115A2 [degC * 1000]
- *
- * @param reg Base address of the temperature register
- */
- int32_t getTempReg(int reg);
-
- /**
- * Reads the current pressure value from MPL3115A2 [Pa]
- *
- * @param bSampleData Sets non-zero to a sample reading
- */
- float getPressure(int bSampleData = true);
-
- /**
- * Reads the current temperature value from MPL3115A2 [degC]
- *
- * @param bSampleData Sets non-zero to a sample reading
- */
- float getTemperature(int bSampleData = true);
-
- /**
- * Reads the current pressure and, using a known altitude, calculates
- * the sea level pressure value [Pa]
- * This function should be preceded by the sampleData() call
- *
- * @param altitudeMeters Altitude in meters
- */
- float getSealevelPressure(float altitudeMeters = 0.0);
-
- /**
- * Reads the current pressure and, using a known sea level pressure,
- * calculates the altitude value [m]
- * This function should be preceded by the sampleData() call
- *
- * @param sealevelPressure Current sea level pressure
- */
- float getAltitude (float sealevelPressure = 101325.0);
-
- /**
- * Defines the oversampling setting (ranges from 0 to 7). The
- * value represents 2^n samples (ranging from 1 to 128). The
- * time to calculate a sample is approximately (2^n * 4 + 2) ms
- *
- * @param oversampling New oversampling value
- */
- void setOversampling(uint8_t oversampling);
-
- /**
- * Returns the current oversampling value
- */
- uint8_t getOversampling(void);
-
- /**
- * Reads the maximum measured temperature [degC]
- */
- float getTemperatureMax(void);
-
- /**
- * Reads the minimum measured temperature [degC]
- */
- float getTemperatureMin(void);
-
- /**
- * Reads the maximum measured pressure [Pa]
- */
- float getPressureMax (void);
-
- /**
- * Reads the minimum measured pressure [Pa]
- */
- float getPressureMin (void);
-
- /**
- * Converts temperature from degC*1000 to degF*1000
- *
- * @param iTemp Temperature in degC
- */
- float convertTempCtoF(float fTemp);
-
- /**
- * Converts pressure from Pa*100 to inHg*10000
- * This is set for 15degC (Pa = 0.0002961 in Hg)
- * TODO: Change the function to add temperature calibration
- *
- * @param iPressure Pressure in Pa
- */
- float convertPaToinHg(float fPressure);
-
- /**
- * Writes one byte to an I2C register
- *
- * @param reg Address of the register
- * @param value Byte to be written
- */
- mraa::Result i2cWriteReg (uint8_t reg, uint8_t value);
-
- /**
- * Reads two bytes from an I2C register
- *
- * @param reg Address of the register
- */
- uint16_t i2cReadReg_16 (int reg);
-
- /**
- * Reads a one-byte register
- *
- * @param reg Address of the register
- */
- uint8_t i2cReadReg_8 (int reg);
-
- private:
- std::string m_name;
-
- int m_controlAddr;
- int m_bus;
- mraa::I2c m_i2ControlCtx;
-
- uint8_t m_oversampling;
- int32_t m_iPressure;
- int32_t m_iTemperature;
-};
-
-}
-
diff --git a/peripheral/libupm/src/mpl3115a2/pyupm_mpl3115a2.i b/peripheral/libupm/src/mpl3115a2/pyupm_mpl3115a2.i
deleted file mode 100644
index 2221d3a..0000000
--- a/peripheral/libupm/src/mpl3115a2/pyupm_mpl3115a2.i
+++ /dev/null
@@ -1,15 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_mpl3115a2
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-#ifdef DOXYGEN
-%include "mpl3115a2_doc.i"
-#endif
-
-%include "mpl3115a2.h"
-%{
- #include "mpl3115a2.h"
-%}
diff --git a/peripheral/libupm/src/mpr121/CMakeLists.txt b/peripheral/libupm/src/mpr121/CMakeLists.txt
deleted file mode 100644
index e4ffacb..0000000
--- a/peripheral/libupm/src/mpr121/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "mpr121")
-set (libdescription "upm mpr121 I2C Touch module")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/mpr121/javaupm_mpr121.i b/peripheral/libupm/src/mpr121/javaupm_mpr121.i
deleted file mode 100644
index 8f1e146..0000000
--- a/peripheral/libupm/src/mpr121/javaupm_mpr121.i
+++ /dev/null
@@ -1,21 +0,0 @@
-%module javaupm_mpr121
-%include "../upm.i"
-%include "arrays_java.i";
-%include "../java_buffer.i"
-
-%{
- #include "mpr121.h"
-%}
-
-%include "mpr121.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_mpr121");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/mpr121/jsupm_mpr121.i b/peripheral/libupm/src/mpr121/jsupm_mpr121.i
deleted file mode 100644
index d725fd2..0000000
--- a/peripheral/libupm/src/mpr121/jsupm_mpr121.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_mpr121
-%include "../upm.i"
-
-%{
- #include "mpr121.h"
-%}
-
-%include "mpr121.h"
diff --git a/peripheral/libupm/src/mpr121/mpr121.cxx b/peripheral/libupm/src/mpr121/mpr121.cxx
deleted file mode 100644
index 8e7f703..0000000
--- a/peripheral/libupm/src/mpr121/mpr121.cxx
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <string>
-#include <stdexcept>
-
-#include "mpr121.h"
-
-using namespace upm;
-using namespace std;
-
-
-MPR121::MPR121(int bus, uint8_t address) : m_i2c(bus)
-{
- m_addr = address;
- mraa::Result ret = m_i2c.address(m_addr);
-
- if (ret != mraa::SUCCESS)
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_i2c_address() failed");
- return;
- }
-
- m_buttonStates = 0;
- m_overCurrentFault = false;
-}
-
-mraa::Result MPR121::writeBytes(uint8_t reg, uint8_t *buffer, int len)
-{
- if (!len || !buffer)
- return mraa::SUCCESS;
-
- // create a buffer 1 byte larger than the supplied buffer,
- // store the register in the first byte
- uint8_t buf2[len + 1];
-
- buf2[0] = reg;
-
- // copy in the buffer after the reg byte
- for (int i=1; i<(len + 1); i++)
- buf2[i] = buffer[i-1];
-
- m_i2c.address(m_addr);
-
- return m_i2c.write(buf2, len + 1);
-}
-
-int MPR121::readBytes(uint8_t reg, uint8_t *buffer, int len)
-{
- if (!len || !buffer)
- return 0;
-
- // The usual m_i2c.read() does not work here, so we need to
- // read each byte individually.
- for (int i=0; i<len; i++)
- buffer[i] = m_i2c.readReg(reg + i);
-
- return len;
-}
-
-bool MPR121::configAN3944()
-{
- // Configure the mpr121 chip as recommended in the AN3944 MPR121
- // Quick Start Guide
-
- mraa::Result rv;
-
- // First, turn off all electrodes by zeroing out the Electrode Configuration
- // register.
- // If this one fails, it's unlikely any of the others will succeed.
- uint8_t eleConf = 0x00;
- if ((rv = writeBytes(0x5e, &eleConf, 1)) != mraa::SUCCESS)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": writeBytes(0x5e) failed");
- return false;
- }
-
- // Section A
- // Filtering when data is greater than baseline
- // regs 0x2b-0x2e
- uint8_t sectA[] = { 0x01, 0x01, 0x00, 0x00 };
- if ((rv = writeBytes(0x2b, sectA, 4)) != mraa::SUCCESS)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": writeBytes(0x2b) failed");
- return false;
- }
-
- // Section B
- // Filtering when data is less than baseline
- // regs 0x2f-0x32
- uint8_t sectB[] = { 0x01, 0x01, 0xff, 0x02 };
- if ((rv = writeBytes(0x2f, sectB, 4)) != mraa::SUCCESS)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": writeBytes(0x2f) failed");
- return false;
- }
-
- // Section C
- // Touch Threshold/Release registers, ELE0-ELE11
- // regs 0x41-0x58
- // __T_ __R_
- uint8_t sectC[] = { 0x0f, 0x0a,
- 0x0f, 0x0a,
- 0x0f, 0x0a,
- 0x0f, 0x0a,
- 0x0f, 0x0a,
- 0x0f, 0x0a,
- 0x0f, 0x0a,
- 0x0f, 0x0a,
- 0x0f, 0x0a,
- 0x0f, 0x0a,
- 0x0f, 0x0a,
- 0x0f, 0x0a };
- if ((rv = writeBytes(0x41, sectC, 24)) != mraa::SUCCESS)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": writeBytes(0x41) failed");
- return false;
- }
-
- // Section D
- // Filter configuration
- // reg 0x5d
- uint8_t filterConf = 0x04;
- if ((rv = writeBytes(0x5d, &filterConf, 1)) != mraa::SUCCESS)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": writeBytes(0x5d) failed");
- return false;
- }
-
- // Section F
- // Autoconfiguration registers
- // regs 0x7b-0x7f
- uint8_t sectF0 = 0x0b;
- if ((rv = writeBytes(0x7b, &sectF0, 1)) != mraa::SUCCESS)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": writeBytes(0x7b) failed");
- return false;
- }
- uint8_t sectF1[] = { 0x9c, 0x65, 0x8c };
- if ((rv = writeBytes(0x7d, sectF1, 3)) != mraa::SUCCESS)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": writeBytes(0x7d) failed");
- return false;
- }
-
- // Section E - this one must be set last, and switches to run mode
- // Enable all 12 electrodes, and set a pre-calibration to avoid
- // excessive calibration delay on startup.
- // reg 0x5e
- eleConf = 0x8c;
- if ((rv = writeBytes(0x5e, &eleConf, 1)) != mraa::SUCCESS)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": writeBytes(0x5e) failed");
- return false;
- }
-
- return true;
-}
-
-void MPR121::readButtons()
-{
- uint8_t rv;
- uint8_t buffer[2];
-
- // read in the 2 bytes at register 0x00-0x01, and setup the member
- // variables accordingly.
-
- readBytes(0x00, buffer, 2);
-
- m_buttonStates = (buffer[0] | ((buffer[1] & 0x1f) << 8));
- if (buffer[1] & 0x80)
- m_overCurrentFault = true;
- else
- m_overCurrentFault = false;
-
- return;
-}
diff --git a/peripheral/libupm/src/mpr121/mpr121.h b/peripheral/libupm/src/mpr121/mpr121.h
deleted file mode 100644
index 3b01071..0000000
--- a/peripheral/libupm/src/mpr121/mpr121.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include <mraa/i2c.hpp>
-
-#define MPR121_I2C_BUS 0
-#define MPR121_DEFAULT_I2C_ADDR 0x5a
-
-namespace upm {
- /**
- * @brief MPR121 Touch Sensor library
- * @defgroup mpr121 libupm-mpr121
- * @ingroup seeed i2c touch tsk
- */
- /**
- * @library mpr121
- * @sensor mpr121
- * @comname MPR121 Touch Sensor
- * @altname Grove I2C Touch Sensor
- * @type touch
- * @man seeed
- * @web http://www.seeedstudio.com/wiki/Grove_-_I2C_Touch_Sensor
- * @con i2c
- * @kit tsk
- *
- * @brief API for the MPR121 I2C Touch Sensor
- *
- * UPM module for the MPR121 touch sensor
- *
- * @image html mpr121.jpg
- * @snippet mpr121.cxx Interesting
- */
- class MPR121 {
- public:
- /**
- * MPR121 constructor
- *
- * @param bus I2C bus to use
- */
- MPR121(int bus, uint8_t address = MPR121_DEFAULT_I2C_ADDR);
-
- /**
- * MPR121 destructor
- * ~MPR121();
- * there is no need for the destructor
- **/
-
- /**
- * Sets up a default configuration, based on Application Note 3944
- * (AN3944):
- * http://cache.freescale.com/files/sensors/doc/app_note/AN3944.pdf
- *
- * After configuration, the sensor is left in the run state.
- *
- * @return True if configuration is successful
- */
- bool configAN3944();
-
- /**
- * Reads button states in the m_buttonStates member variable. Also,
- * sets the m_overCurrentFault variable if overcurrent is detected.
- */
- void readButtons();
-
- /**
- * Writes value(s) into registers
- *
- * @param reg Register location to start writing into
- * @param buffer Buffer for data storage
- * @param len Number of bytes to write
- * @return mraa::Result
- */
- mraa::Result writeBytes(uint8_t reg, uint8_t *buffer, int len);
-
- /**
- * Reads value(s) from registers
- *
- * @param reg Register location to start reading from
- * @param buffer Buffer for data storage
- * @param len Number of bytes to read
- */
- int readBytes(uint8_t reg, uint8_t *buffer, int len);
-
- /**
- * Button states
- */
- uint16_t m_buttonStates;
-
- /**
- * Overcurrent detected
- */
- bool m_overCurrentFault;
-
- private:
- mraa::I2c m_i2c;
- uint8_t m_addr;
- };
-}
-
-
diff --git a/peripheral/libupm/src/mpr121/pyupm_mpr121.i b/peripheral/libupm/src/mpr121/pyupm_mpr121.i
deleted file mode 100644
index 993e0c4..0000000
--- a/peripheral/libupm/src/mpr121/pyupm_mpr121.i
+++ /dev/null
@@ -1,15 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_mpr121
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-#ifdef DOXYGEN
-%include "mpr121_doc.i"
-#endif
-
-%include "mpr121.h"
-%{
- #include "mpr121.h"
-%}
diff --git a/peripheral/libupm/src/mpu9150/CMakeLists.txt b/peripheral/libupm/src/mpu9150/CMakeLists.txt
deleted file mode 100644
index 816f46c..0000000
--- a/peripheral/libupm/src/mpu9150/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "mpu9150")
-set (libdescription "gyro, acceleromter and magnometer sensor based on mpu9150")
-set (module_src ${libname}.cxx ak8975.cxx mpu60x0.cxx mpu9250.cxx)
-set (module_h ${libname}.h ak8975.h mpu60x0.h mpu9250.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/mpu9150/ak8975.cxx b/peripheral/libupm/src/mpu9150/ak8975.cxx
deleted file mode 100644
index 7330eb3..0000000
--- a/peripheral/libupm/src/mpu9150/ak8975.cxx
+++ /dev/null
@@ -1,239 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <string>
-#include <stdexcept>
-
-#include "ak8975.h"
-
-using namespace upm;
-using namespace std;
-
-
-AK8975::AK8975(int bus, uint8_t address):
- m_i2c(bus)
-{
- m_addr = address;
- m_xCoeff = 0.0;
- m_yCoeff = 0.0;
- m_zCoeff = 0.0;
-
- mraa::Result rv;
- if ( (rv = m_i2c.address(m_addr)) != mraa::SUCCESS)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": I2c.address() failed");
- return;
- }
-}
-
-AK8975::~AK8975()
-{
-}
-
-bool AK8975::init()
-{
- // we put the device in 'fuse mode', and then read the compensation
- // coefficients and store them.
-
- // first, set power down mode
-
- if (!setMode(CNTL_PWRDWN))
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": Unable to set PWRDWN mode");
- return false;
- }
-
- if (!setMode(CNTL_FUSE_ACCESS))
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": Unable to set FUSE mode");
- return false;
- }
-
- // Read each byte and store
- m_xCoeff = (float)m_i2c.readReg(REG_ASAX);
- m_yCoeff = (float)m_i2c.readReg(REG_ASAY);
- m_zCoeff = (float)m_i2c.readReg(REG_ASAZ);
-
- // now, place back in power down mode
- if (!setMode(CNTL_PWRDWN))
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": Unable to set reset PWRDWN mode");
- return false;
- }
-
- return true;
-}
-
-bool AK8975::setMode(CNTL_MODES_T mode)
-{
- mraa::Result rv;
- if ((rv = m_i2c.writeReg(REG_CNTL, mode)) != mraa::SUCCESS)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": I2c.writeReg() failed");
- return false;
- }
-
- // sleep at least 100us for for mode transition to complete
- usleep(150);
-
- return true;
-}
-
-bool AK8975::isReady()
-{
- uint8_t rdy = m_i2c.readReg(REG_ST1);
-
- if (rdy & ST1_DRDY)
- return true;
-
- return false;
-}
-
-bool AK8975::waitforDeviceReady()
-{
- const int maxRetries = 20;
-
- int retries = 0;
-
- while (retries < maxRetries)
- {
- if (isReady())
- return true;
-
- usleep(5000);
- retries++;
- }
-
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": timeout waiting for device to become ready");
-
- return false;
-}
-
-bool AK8975::update(bool selfTest)
-{
- // this flag (selfTest) is used so that we can read values without
- // specifically taking a measurement. For example, selfTest will
- // pass true to this method so that the test results aren't
- // overwritten by a measurement.
- if (!selfTest)
- {
- // First set measurement mode (take a measurement)
- if (!setMode(CNTL_MEASURE))
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": Unable to set MEASURE mode");
- return false;
- }
- }
-
- if (!waitforDeviceReady())
- return false;
-
- // hope it worked. Now read out the values and store them (uncompensated)
- uint8_t data[6];
- m_i2c.readBytesReg(REG_HXL, data, 6);
-
- int16_t x, y, z;
- x = ( (data[1] << 8) | data[0] );
- y = ( (data[3] << 8) | data[2] );
- z = ( (data[5] << 8) | data[4] );
-
- m_xData = float(x);
- m_yData = float(y);
- m_zData = float(z);
-
- return true;
-}
-
-bool AK8975::selfTest()
-{
- mraa::Result rv;
-
- // set power down first
- if (!setMode(CNTL_PWRDWN))
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": Unable to set PWRDWN mode");
- return false;
- }
-
- // enable self test bit
- if ((rv = m_i2c.writeReg(REG_ASTC, ASTC_SELF)) != mraa::SUCCESS)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": failed to enable self test");
- return false;
- }
-
- // now set self test mode
- if (!setMode(CNTL_SELFTEST))
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": Unable to set SELFTEST mode");
- return false;
- }
-
- // now update current data (without enabling a measurement)
- update(true);
-
- // Now, reset self test register
- uint8_t reg = m_i2c.readReg(REG_ASTC);
- reg &= ~ASTC_SELF;
- if ((rv = m_i2c.writeReg(REG_ASTC, reg)) != mraa::SUCCESS)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": failed to disable self test");
- return false;
- }
-
- // after self-test measurement, device transitions to power down mode
- return true;
-}
-
-float AK8975::adjustValue(float value, float adj)
-{
- // apply the proper compensation to value. This equation is taken
- // from the AK8975 datasheet, section 8.3.11
-
- return ( value * ((((adj - 128.0) * 0.5) / 128.0) + 1.0) );
-}
-
-void AK8975::getMagnetometer(float *x, float *y, float *z)
-{
- if (x)
- *x = adjustValue(m_xData, m_xCoeff);
- if (y)
- *y = adjustValue(m_yData, m_yCoeff);
- if (z)
- *z = adjustValue(m_zData, m_zCoeff);
-}
-
diff --git a/peripheral/libupm/src/mpu9150/ak8975.h b/peripheral/libupm/src/mpu9150/ak8975.h
deleted file mode 100644
index ba9788c..0000000
--- a/peripheral/libupm/src/mpu9150/ak8975.h
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include <mraa/common.hpp>
-#include <mraa/i2c.hpp>
-
-#define AK8975_I2C_BUS 0
-#define AK8975_DEFAULT_I2C_ADDR 0x0c
-
-namespace upm {
-
- /**
- * @library mpu9150
- * @sensor ak8975
- * @comname AK8975 3-axis Magnetometer
- * @altname AK9875
- * @type compass
- * @man seeed
- * @con i2c
- *
- * @brief API for the AK8975 magnetometer
- *
- * This is a 3-axis magnetometer, which can be used alone, or
- * coupled with another device (such as the mcu9150 9-axis motion
- * sensor).
- *
- * @snippet ak8975.cxx Interesting
- */
- class AK8975 {
- public:
-
- /**
- * AK8975 registers
- */
- typedef enum {
- REG_WIA = 0x00, // device id
-
- REG_INFO = 0x01, // undocumented (AK proprietary data)
-
- REG_ST1 = 0x02, // status 1
-
- REG_HXL = 0x03, // magnetometer data, X axis low byte
- REG_HXH = 0x04, // magnetometer data, X axis high byte
- REG_HYL = 0x05,
- REG_HYH = 0x06,
- REG_HZL = 0x07,
- REG_HZH = 0x08,
-
- REG_ST2 = 0x09, // status 2
-
- REG_CNTL = 0x0a, // control
-
- // REG_RSV 0x0b reserved
-
- REG_ASTC = 0x0c, // self test (internal mag field)
-
- // REG_TS1, REG_TS2 0x0d, 0x0e reserved/factory test
-
- // REG_I2CDIS 0x0f, I2C disable. Not a good idea to use or support.
- // write a 0x1b to disable i2c. This requires a power cycle to undo.
-
- // These registers hold factory calibrated co-efficients needed to
- // properly compensate for production variations. They can only be
- // read when device is in fuse mode. They are used to adjust the
- // measured mag field values.
- REG_ASAX = 0x10, // X calibration
- REG_ASAY = 0x11,
- REG_ASAZ = 0x12
- } AK8975_REG_T;
-
- /**
- * ST1 bits
- */
- typedef enum {
- ST1_DRDY = 0x01 // data ready bit
- } ST1_BITS_T;
-
- /**
- * ST2 bits
- */
- typedef enum {
- ST2_DERR = 0x04, // data error
- ST2_HOFL = 0x08 // measurement overflow
- } ST2_BITS_T;
-
- /**
- * CNTL register, operating mode values
- */
- typedef enum {
- CNTL_PWRDWN = 0x00, // power down
- CNTL_MEASURE = 0x01, // single measurement
- CNTL_SELFTEST = 0x08,
- CNTL_FUSE_ACCESS = 0x0f // access fuse (coeff) registers
- } CNTL_MODES_T;
-
- /**
- * ASTC (self test control) bits
- */
- typedef enum {
- ASTC_SELF = 0x40 // enable self test
- } ASTC_BITS_T;
-
- /**
- * ak8975 constructor
- *
- * @param bus i2c bus to use
- * @param address the address for this device
- */
- AK8975(int bus=AK8975_I2C_BUS, uint8_t address=AK8975_DEFAULT_I2C_ADDR);
-
- /**
- * AK8975 Destructor
- */
- ~AK8975();
-
- /**
- * set up initial values and start operation
- *
- * @param dsr the data sampling rate: one of the DSR_BITS_T values
- * @return true if successful
- */
- bool init();
-
- /**
- * put the chip into a specific mode
- *
- * @param mode one of the CNTL_MODES_T values
- * @return true if successful
- */
- bool setMode(CNTL_MODES_T mode);
-
- /**
- * check to see if the ST1_DRDY bit is set, indicating the device
- * can accept commands
- *
- * @return true if device is ready, false otherwise
- */
- bool isReady();
-
- /**
- * check to see if device is ready and sleep/retry if not.
- * Returns once device indicates it's ready.
- *
- * @return true if device is ready, false if retries exhausted
- */
- bool waitforDeviceReady();
-
- /**
- * take a measurement
- *
- * @param selfTest true if we are running a self test, false
- * (default) otherwise.
- * @return true if successful, false otherwise
- */
- bool update(bool selfTest=false);
-
- /**
- * do a self test sequence. When self test is executed, the
- * device activates internal calibrated magnets, and measures
- * them, updating the measurement registers. Once complete, the
- * data can be read as usual (getMagnetometer()) and the returned
- * values compared against the following limits to determine
- * correctness:
- *
- * -100 < X < +100; -100 < Y < +100; -1000 < Z < -300
- *
- * @return true if successful, false otherwise
- */
- bool selfTest();
-
- /**
- * return the compensated values for the x, y, and z axes. The
- * unit of measurement is in micro-teslas (uT).
- *
- * @param x pointer to returned X axis value
- * @param y pointer to returned Y axis value
- * @param z pointer to returned Z axis value
- */
- void getMagnetometer(float *x, float *y, float *z);
-
-
- protected:
- /**
- * compute a compensated magnetometer axis value, based on the raw
- * axis value and a per-device, per-axis adjustment coefficient
- * that was read and stored at init() time.
- *
- * @param value the raw axis value to compensate
- * @param adj the adjustment coefficient
- * @return true if successful
- */
- float adjustValue(float value, float adj);
-
- // compensation coefficients (factory set) for this device
- float m_xCoeff;
- float m_yCoeff;
- float m_zCoeff;
-
- // uncompensated magnetometer readings
- float m_xData;
- float m_yData;
- float m_zData;
-
- private:
- mraa::I2c m_i2c;
- uint8_t m_addr;
-
- };
-}
-
-
diff --git a/peripheral/libupm/src/mpu9150/javaupm_mpu9150.i b/peripheral/libupm/src/mpu9150/javaupm_mpu9150.i
deleted file mode 100644
index 0d7c70b..0000000
--- a/peripheral/libupm/src/mpu9150/javaupm_mpu9150.i
+++ /dev/null
@@ -1,45 +0,0 @@
-%module javaupm_mpu9150
-%include "../upm.i"
-%include "typemaps.i"
-%include "arrays_java.i"
-%include "../java_buffer.i"
-
-%apply int {mraa::Edge};
-
-%{
- #include "mpu60x0.h"
- #include "mpu9150.h"
-%}
-
-
-%typemap(jni) float * "jfloatArray"
-%typemap(jstype) float * "float[]"
-%typemap(jtype) float * "float[]"
-
-%typemap(javaout) float * {
- return $jnicall;
-}
-
-%typemap(out) float * {
- $result = JCALL1(NewFloatArray, jenv, 3);
- JCALL4(SetFloatArrayRegion, jenv, $result, 0, 3, $1);
- delete [] $1;
-}
-
-%ignore getAccelerometer(float *, float *, float *);
-%ignore getGyroscope(float *, float *, float *);
-%ignore getMagnetometer(float *, float *, float *);
-
-%include "mpu60x0.h"
-%include "mpu9150.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_mpu9150");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%}
diff --git a/peripheral/libupm/src/mpu9150/jsupm_mpu9150.i b/peripheral/libupm/src/mpu9150/jsupm_mpu9150.i
deleted file mode 100644
index b08eb53..0000000
--- a/peripheral/libupm/src/mpu9150/jsupm_mpu9150.i
+++ /dev/null
@@ -1,30 +0,0 @@
-%module jsupm_mpu9150
-%include "../upm.i"
-%include "cpointer.i"
-
-%pointer_functions(float, floatp);
-
-%{
- #include "mpu9150.h"
-%}
-
-%include "ak8975.h"
-%{
- #include "ak8975.h"
-%}
-
-%include "mpu60x0.h"
-%{
- #include "mpu60x0.h"
-%}
-
-%include "mpu9150.h"
-%{
- #include "mpu9150.h"
-%}
-
-%include "mpu9250.h"
-%{
- #include "mpu9250.h"
-%}
-
diff --git a/peripheral/libupm/src/mpu9150/mpu60x0.cxx b/peripheral/libupm/src/mpu9150/mpu60x0.cxx
deleted file mode 100644
index ad79051..0000000
--- a/peripheral/libupm/src/mpu9150/mpu60x0.cxx
+++ /dev/null
@@ -1,424 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <string.h>
-
-#include "mpu60x0.h"
-
-using namespace upm;
-using namespace std;
-
-
-MPU60X0::MPU60X0(int bus, uint8_t address) :
- m_i2c(bus), m_gpioIRQ(0)
-{
- m_addr = address;
-
- m_accelX = 0.0;
- m_accelY = 0.0;
- m_accelZ = 0.0;
-
- m_gyroX = 0.0;
- m_gyroY = 0.0;
- m_gyroZ = 0.0;
-
- m_temp = 0.0;
-
- m_accelScale = 1.0;
- m_gyroScale = 1.0;
-
- mraa::Result rv;
- if ( (rv = m_i2c.address(m_addr)) != mraa::SUCCESS)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": I2c.address() failed");
- return;
- }
-}
-
-MPU60X0::~MPU60X0()
-{
- uninstallISR();
-}
-
-bool MPU60X0::init()
-{
- // first, take the device out of sleep mode
- if (!setSleep(false))
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": Unable to wake up device");
- return false;
- }
-
- // set the clock source to use the gyroscope PLL rather than the
- // internal clock for stability
- if (!setClockSource(PLL_XG))
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": Unable to set clock source");
- return false;
- }
-
- usleep(5000);
-
- // enable temperature measurement (default on power up, but let's be sure)
- enableTemperatureSensor(true);
-
- // set the gyro and accel scale bits to reasonable values
- setGyroscopeScale(FS_500);
- setAccelerometerScale(AFS_2);
-
- // enable the DLPF
- setDigitalLowPassFilter(DLPF_94_98);
-
- // let things stabilize...
- usleep(100000);
-
- return true;
-}
-
-
-void MPU60X0::update()
-{
- // read all of the sensor registers - accel, gyro, and temp
- uint8_t buffer[14];
-
- memset(buffer, 0, 14);
- readRegs(REG_ACCEL_XOUT_H, buffer, 14);
-
- int16_t ax, ay, az;
- int16_t temp;
- int16_t gx, gy, gz;
-
- ax = ( (buffer[0] << 8) | buffer[1] );
- ay = ( (buffer[2] << 8) | buffer[3] );
- az = ( (buffer[4] << 8) | buffer[5] );
-
- temp = ( (buffer[6] << 8) | buffer[7] );
-
- gx = ( (buffer[8] << 8) | buffer[9] );
- gy = ( (buffer[10] << 8) | buffer[11] );
- gz = ( (buffer[12] << 8) | buffer[13] );
-
- // now stash them
- m_accelX = float(ax);
- m_accelY = float(ay);
- m_accelZ = float(az);
-
- m_temp = float(temp);
-
- m_gyroX = float(gx);
- m_gyroY = float(gy);
- m_gyroZ = float(gz);
-}
-
-uint8_t MPU60X0::readReg(uint8_t reg)
-{
- return m_i2c.readReg(reg);
-}
-
-void MPU60X0::readRegs(uint8_t reg, uint8_t *buffer, int len)
-{
- m_i2c.readBytesReg(reg, buffer, len);
-}
-
-bool MPU60X0::writeReg(uint8_t reg, uint8_t val)
-{
- mraa::Result rv;
- if ((rv = m_i2c.writeReg(reg, val)) != mraa::SUCCESS)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": I2c.writeReg() failed");
- return false;
- }
-
- return true;
-}
-
-bool MPU60X0::setSleep(bool enable)
-{
- uint8_t reg = readReg(REG_PWR_MGMT_1);
-
- if (enable)
- reg |= PWR_SLEEP;
- else
- reg &= ~PWR_SLEEP;
-
- return writeReg(REG_PWR_MGMT_1, reg);
-}
-
-bool MPU60X0::setClockSource(CLKSEL_T clk)
-{
- uint8_t reg = readReg(REG_PWR_MGMT_1);
-
- reg &= ~(_CLKSEL_MASK << _CLKSEL_SHIFT);
-
- reg |= (clk << _CLKSEL_SHIFT);
-
- return writeReg(REG_PWR_MGMT_1, reg);
-}
-
-bool MPU60X0::setGyroscopeScale(FS_SEL_T scale)
-{
- uint8_t reg = readReg(REG_GYRO_CONFIG);
-
- reg &= ~(_FS_SEL_MASK << _FS_SEL_SHIFT);
-
- reg |= (scale << _FS_SEL_SHIFT);
-
- if (!writeReg(REG_GYRO_CONFIG, reg))
- {
- return false;
- }
-
- // store scaling factor
-
- switch (scale)
- {
- case FS_250:
- m_gyroScale = 131.0;
- break;
-
- case FS_500:
- m_gyroScale = 65.5;
- break;
-
- case FS_1000:
- m_gyroScale = 32.8;
- break;
-
- case FS_2000:
- m_gyroScale = 16.4;
- break;
-
- default: // should never occur, but...
- m_gyroScale = 1.0; // set a safe, though incorrect value
- throw std::logic_error(string(__FUNCTION__) +
- ": internal error, unsupported scale");
- break;
- }
-
- return true;
-}
-
-bool MPU60X0::setAccelerometerScale(AFS_SEL_T scale)
-{
- uint8_t reg = readReg(REG_ACCEL_CONFIG);
-
- reg &= ~(_AFS_SEL_MASK << _AFS_SEL_SHIFT);
-
- reg |= (scale << _AFS_SEL_SHIFT);
-
- if (!writeReg(REG_ACCEL_CONFIG, reg))
- {
- return false;
- }
-
- // store scaling factor
-
- switch (scale)
- {
- case AFS_2:
- m_accelScale = 16384.0;
- break;
-
- case AFS_4:
- m_accelScale = 8192.0;
- break;
-
- case AFS_8:
- m_accelScale = 4096.0;
- break;
-
- case AFS_16:
- m_accelScale = 2048.0;
- break;
-
- default: // should never occur, but...
- m_accelScale = 1.0; // set a safe, though incorrect value
- throw std::logic_error(string(__FUNCTION__) +
- ": internal error, unsupported scale");
- break;
- }
-
- return true;
-}
-
-bool MPU60X0::setDigitalLowPassFilter(DLPF_CFG_T dlp)
-{
- uint8_t reg = readReg(REG_CONFIG);
-
- reg &= ~(_CONFIG_DLPF_MASK << _CONFIG_DLPF_SHIFT);
-
- reg |= (dlp << _CONFIG_DLPF_SHIFT);
-
- return writeReg(REG_CONFIG, reg);
-}
-
-bool MPU60X0::setSampleRateDivider(uint8_t div)
-{
- return writeReg(REG_SMPLRT_DIV, div);
-}
-
-uint8_t MPU60X0::getSampleRateDivider()
-{
- return readReg(REG_SMPLRT_DIV);
-}
-
-void MPU60X0::getAccelerometer(float *x, float *y, float *z)
-{
- if (x)
- *x = m_accelX / m_accelScale;
-
- if (y)
- *y = m_accelY / m_accelScale;
-
- if (z)
- *z = m_accelZ / m_accelScale;
-}
-
-void MPU60X0::getGyroscope(float *x, float *y, float *z)
-{
- if (x)
- *x = m_gyroX / m_gyroScale;
-
- if (y)
- *y = m_gyroY / m_gyroScale;
-
- if (z)
- *z = m_gyroZ / m_gyroScale;
-}
-
-float MPU60X0::getTemperature()
-{
- // this equation is taken from the datasheet
- return (m_temp / 340.0) + 36.53;
-}
-
-bool MPU60X0::enableTemperatureSensor(bool enable)
-{
- uint8_t reg = readReg(REG_PWR_MGMT_1);
-
- if (enable)
- reg &= ~TEMP_DIS;
- else
- reg |= TEMP_DIS;
-
- return writeReg(REG_PWR_MGMT_1, reg);
-}
-
-bool MPU60X0::setExternalSync(EXT_SYNC_SET_T val)
-{
- uint8_t reg = readReg(REG_CONFIG);
-
- reg &= ~(_CONFIG_EXT_SYNC_SET_MASK << _CONFIG_EXT_SYNC_SET_SHIFT);
-
- reg |= (val << _CONFIG_EXT_SYNC_SET_SHIFT);
-
- return writeReg(REG_CONFIG, reg);
-}
-
-bool MPU60X0::enableI2CBypass(bool enable)
-{
- uint8_t reg = readReg(REG_INT_PIN_CFG);
-
- if (enable)
- reg |= I2C_BYPASS_ENABLE;
- else
- reg &= ~I2C_BYPASS_ENABLE;
-
- return writeReg(REG_INT_PIN_CFG, reg);
-}
-
-bool MPU60X0::setMotionDetectionThreshold(uint8_t thr)
-{
- return writeReg(REG_MOT_THR, thr);
-}
-
-uint8_t MPU60X0::getInterruptStatus()
-{
- return readReg(REG_INT_STATUS);
-}
-
-bool MPU60X0::setInterruptEnables(uint8_t enables)
-{
- return writeReg(REG_INT_ENABLE, enables);
-}
-
-uint8_t MPU60X0::getInterruptEnables()
-{
- return readReg(REG_INT_ENABLE);
-}
-
-bool MPU60X0::setInterruptPinConfig(uint8_t cfg)
-{
- return writeReg(REG_INT_PIN_CFG, cfg);
-}
-
-uint8_t MPU60X0::getInterruptPinConfig()
-{
- return readReg(REG_INT_PIN_CFG);
-}
-
-#if defined(SWIGJAVA) || defined(JAVACALLBACK)
-void MPU60X0::installISR(int gpio, mraa::Edge level,
- jobject runnable)
-{
- // delete any existing ISR and GPIO context
- uninstallISR();
-
- // greate gpio context
- m_gpioIRQ = new mraa::Gpio(gpio);
-
- m_gpioIRQ->dir(mraa::DIR_IN);
- m_gpioIRQ->isr(level, runnable);
-}
-#else
-void MPU60X0::installISR(int gpio, mraa::Edge level,
- void (*isr)(void *), void *arg)
-{
- // delete any existing ISR and GPIO context
- uninstallISR();
-
- // greate gpio context
- m_gpioIRQ = new mraa::Gpio(gpio);
-
- m_gpioIRQ->dir(mraa::DIR_IN);
- m_gpioIRQ->isr(level, isr, arg);
-}
-#endif
-
-void MPU60X0::uninstallISR()
-{
- if (m_gpioIRQ)
- {
- m_gpioIRQ->isrExit();
- delete m_gpioIRQ;
-
- m_gpioIRQ = 0;
- }
-}
diff --git a/peripheral/libupm/src/mpu9150/mpu60x0.h b/peripheral/libupm/src/mpu9150/mpu60x0.h
deleted file mode 100644
index 1737a69..0000000
--- a/peripheral/libupm/src/mpu9150/mpu60x0.h
+++ /dev/null
@@ -1,958 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include <mraa/common.hpp>
-#include <mraa/i2c.hpp>
-
-#include <mraa/gpio.hpp>
-
-#define MPU60X0_I2C_BUS 0
-#define MPU60X0_DEFAULT_I2C_ADDR 0x68
-
-namespace upm {
-
- /**
- * @library mpu9150
- * @sensor mpu60x0
- * @comname MPU60X0 3-axis Gyroscope and 3-axis Accelerometer
- * @type accelerometer compass
- * @man seeed
- * @con i2c gpio
- *
- * @brief API for the MPU60X0 3-axis Gyroscope and 3-axis Accelerometer
- *
- * The MPU60X0 devices provide the world’s first integrated 6-axis
- * motion processor solution that eliminates the package-level
- * gyroscope and accelerometer cross-axis misalignment associated
- * with discrete solutions. The devices combine a 3-axis gyroscope
- * and a 3-axis accelerometer on the same silicon die.
- *
- * While not all of the functionality of this device is supported
- * initially, methods and register definitions are provided that
- * should allow an end user to implement whatever features are
- * required.
- *
- * @image html mpu60x0.jpg
- * @snippet mpu60x0.cxx Interesting
- */
- class MPU60X0 {
- public:
-
- // NOTE: These enums were composed from both the mpu6050 and
- // mpu9150 register maps, since this driver was written using an
- // mpu9150, but we'd like this module to be usable with a
- // standalone mpu60x0.
- //
- // Registers and bitfields marked with an '*' in their
- // comment indicate registers or bit fields present in the mpu9150
- // register map, but not in the original mpu6050 register map. If
- // using this module on a standalone mpu6050, you should avoid
- // using those registers or bitfields marked with an *.
-
- /**
- * MPU60X0 registers
- */
- typedef enum {
- REG_SELF_TEST_X = 0x0d,
- REG_SELF_TEST_Y = 0x0e,
- REG_SELF_TEST_Z = 0x0f,
- REG_SELF_TEST_A = 0x10,
-
- REG_SMPLRT_DIV = 0x19, // sample rate divider
-
- REG_CONFIG = 0x1a,
- REG_GYRO_CONFIG = 0x1b,
- REG_ACCEL_CONFIG = 0x1c,
-
- REG_FF_THR = 0x1d, // *freefall threshold
- REG_FF_DUR = 0x1e, // *freefall duration
-
- REG_MOT_THR = 0x1f, // motion threshold
- REG_MOT_DUR = 0x20, // *motion duration
-
- REG_ZRMOT_THR = 0x21, // *zero motion threshhold
- REG_ZRMOT_DUR = 0x22, // *zero motion duration
-
- REG_FIFO_EN = 0x23,
-
- REG_I2C_MST_CTRL = 0x24, // I2C master control
-
- REG_I2C_SLV0_ADDR = 0x25, // I2C slave 0
- REG_I2C_SLV0_REG = 0x26,
- REG_I2C_SLV0_CTRL = 0x27,
-
- REG_I2C_SLV1_ADDR = 0x28, // I2C slave 1
- REG_I2C_SLV1_REG = 0x29,
- REG_I2C_SLV1_CTRL = 0x2a,
-
- REG_I2C_SLV2_ADDR = 0x2b, // I2C slave 2
- REG_I2C_SLV2_REG = 0x2c,
- REG_I2C_SLV2_CTRL = 0x2d,
-
- REG_I2C_SLV3_ADDR = 0x2e, // I2C slave 3
- REG_I2C_SLV3_REG = 0x2f,
- REG_I2C_SLV3_CTRL = 0x30,
-
- REG_I2C_SLV4_ADDR = 0x31, // I2C slave 4
- REG_I2C_SLV4_REG = 0x32,
- REG_I2C_SLV4_DO = 0x33,
- REG_I2C_SLV4_CTRL = 0x34,
- REG_I2C_SLV4_DI = 0x35,
-
- REG_I2C_MST_STATUS = 0x36, // I2C master status
-
- REG_INT_PIN_CFG = 0x37, // interrupt pin config/i2c bypass
- REG_INT_ENABLE = 0x38,
-
- // 0x39 reserved
-
- REG_INT_STATUS = 0x3a, // interrupt status
-
- REG_ACCEL_XOUT_H = 0x3b, // accelerometer outputs
- REG_ACCEL_XOUT_L = 0x3c,
-
- REG_ACCEL_YOUT_H = 0x3d,
- REG_ACCEL_YOUT_L = 0x3e,
-
- REG_ACCEL_ZOUT_H = 0x3f,
- REG_ACCEL_ZOUT_L = 0x40,
-
- REG_TEMP_OUT_H = 0x41, // temperature output
- REG_TEMP_OUT_L = 0x42,
-
- REG_GYRO_XOUT_H = 0x43, // gyro outputs
- REG_GYRO_XOUT_L = 0x44,
-
- REG_GYRO_YOUT_H = 0x45,
- REG_GYRO_YOUT_L = 0x46,
-
- REG_GYRO_ZOUT_H = 0x47,
- REG_GYRO_ZOUT_L = 0x48,
-
- REG_EXT_SENS_DATA_00 = 0x49, // external sensor data
- REG_EXT_SENS_DATA_01 = 0x4a,
- REG_EXT_SENS_DATA_02 = 0x4b,
- REG_EXT_SENS_DATA_03 = 0x4c,
- REG_EXT_SENS_DATA_04 = 0x4d,
- REG_EXT_SENS_DATA_05 = 0x4e,
- REG_EXT_SENS_DATA_06 = 0x4f,
- REG_EXT_SENS_DATA_07 = 0x50,
- REG_EXT_SENS_DATA_08 = 0x51,
- REG_EXT_SENS_DATA_09 = 0x52,
- REG_EXT_SENS_DATA_10 = 0x53,
- REG_EXT_SENS_DATA_11 = 0x54,
- REG_EXT_SENS_DATA_12 = 0x55,
- REG_EXT_SENS_DATA_13 = 0x56,
- REG_EXT_SENS_DATA_14 = 0x57,
- REG_EXT_SENS_DATA_15 = 0x58,
- REG_EXT_SENS_DATA_16 = 0x59,
- REG_EXT_SENS_DATA_17 = 0x5a,
- REG_EXT_SENS_DATA_18 = 0x5b,
- REG_EXT_SENS_DATA_19 = 0x5c,
- REG_EXT_SENS_DATA_20 = 0x5d,
- REG_EXT_SENS_DATA_21 = 0x5e,
- REG_EXT_SENS_DATA_22 = 0x5f,
- REG_EXT_SENS_DATA_23 = 0x60,
-
- REG_MOT_DETECT_STATUS = 0x61, // *
-
- // 0x62 reserved
-
- REG_I2C_SLV0_DO = 0x63, // I2C slave data outs
- REG_I2C_SLV1_DO = 0x64,
- REG_I2C_SLV2_DO = 0x65,
- REG_I2C_SLV3_DO = 0x66,
-
- REG_I2C_MST_DELAY_CTRL = 0x67,
-
- REG_SIGNAL_PATH_RESET = 0x68, // signal path resets
-
- REG_MOT_DETECT_CTRL = 0x69,
-
- REG_USER_CTRL = 0x6a,
-
- REG_PWR_MGMT_1 = 0x6b, // power management
- REG_PWR_MGMT_2 = 0x6c,
-
- // 0x6d-0x71 reserved
-
- REG_FIFO_COUNTH = 0x72,
- REG_FIFO_COUNTL = 0x73,
-
- REG_FIFO_R_W = 0x74,
-
- REG_WHO_AM_I = 0x75
- } MPU60X0_REG_T;
-
- /**
- * CONFIG bits
- */
- typedef enum {
- CONFIG_DLPF_CFG0 = 0x01, // digital low-pass filter config
- CONFIG_DLPF_CFG1 = 0x02,
- CONFIG_DLPF_CFG2 = 0x04,
- _CONFIG_DLPF_SHIFT = 0,
- _CONFIG_DLPF_MASK = 7,
-
- CONFIG_EXT_SYNC_SET0 = 0x08, // FSYNC pin config
- CONFIG_EXT_SYNC_SET1 = 0x10,
- CONFIG_EXT_SYNC_SET2 = 0x20,
- _CONFIG_EXT_SYNC_SET_SHIFT = 3,
- _CONFIG_EXT_SYNC_SET_MASK = 7
- } CONFIG_BITS_T;
-
- /**
- * CONFIG DLPF_CFG values
- */
- typedef enum {
- DLPF_260_256 = 0, // accel/gyro bandwidth (Hz)
- DLPF_184_188 = 1,
- DLPF_94_98 = 2,
- DLPF_44_42 = 3,
- DLPF_21_20 = 4,
- DLPF_10_10 = 5,
- DLPF_5_5 = 6,
- DLPF_RESERVED = 7
- } DLPF_CFG_T;
-
- /**
- * CONFIG EXT_SYNC_SET values
- */
- typedef enum {
- EXT_SYNC_DISABLED = 0,
- EXT_SYNC_TEMP_OUT = 1,
- EXT_SYNC_GYRO_XOUT = 2,
- EXT_SYNC_GYRO_YOUT = 3,
- EXT_SYNC_GYRO_ZOUT = 4,
- EXT_SYNC_ACCEL_XOUT = 5,
- EXT_SYNC_ACCEL_YOUT = 6,
- EXT_SYNC_ACCEL_ZOUT = 7
- } EXT_SYNC_SET_T;
-
- /**
- * GYRO_CONFIG bits
- */
- typedef enum {
- // 0x01-0x04 reserved
- FS_SEL0 = 0x08, // gyro full scale range
- FS_SEL1 = 0x10,
- _FS_SEL_SHIFT = 3,
- _FS_SEL_MASK = 3,
-
- ZG_ST = 0x20, // gyro self test bits
- YG_ST = 0x40,
- XG_ST = 0x80
- } GRYO_CONFIG_BITS_T;
-
- /**
- * GYRO FS_SEL values
- */
- typedef enum {
- FS_250 = 0, // 250 deg/s, 131 LSB deg/s
- FS_500 = 1, // 500 deg/s, 65.5 LSB deg/s
- FS_1000 = 2, // 1000 deg/s, 32.8 LSB deg/s
- FS_2000 = 3 // 2000 deg/s, 16.4 LSB deg/s
- } FS_SEL_T;
-
- /**
- * ACCEL_CONFIG bits
- */
- typedef enum {
- // 0x01-0x04 reserved
- AFS_SEL0 = 0x08, // accel full scale range
- AFS_SEL1 = 0x10,
- _AFS_SEL_SHIFT = 3,
- _AFS_SEL_MASK = 3,
-
- ZA_ST = 0x20, // gyro self test bits
- YA_ST = 0x40,
- XA_ST = 0x80
- } ACCEL_CONFIG_BITS_T;
-
- /**
- * ACCEL AFS_SEL (full scaling) values
- */
- typedef enum {
- AFS_2 = 0, // 2g, 16384 LSB/g
- AFS_4 = 1, // 4g, 8192 LSB/g
- AFS_8 = 2, // 8g, 4096 LSB/g
- AFS_16 = 3 // 16g, 2048 LSB/g
- } AFS_SEL_T;
-
- /**
- * REG_FIFO_EN bits
- */
- typedef enum {
- SLV0_FIFO_EN = 0x01,
- SLV1_FIFO_EN = 0x02,
- SLV2_FIFO_EN = 0x04,
-
- ACCEL_FIFO_EN = 0x08,
-
- ZG_FIFO_EN = 0x10,
- YG_FIFO_EN = 0x20,
- XG_FIFO_EN = 0x40,
-
- TEMP_FIFO_EN = 0x80
- } FIFO_EN_BITS_T;
-
- /**
- * REG_I2C_MST_CTRL bits
- */
- typedef enum {
- I2C_MST_CLK0 = 0x01,
- I2C_MST_CLK1 = 0x02,
- I2C_MST_CLK2 = 0x04,
- I2C_MST_CLK3 = 0x08,
- _I2C_MST_CLK_SHIFT = 0,
- _I2C_MST_CLK_MASK = 15,
-
- I2C_MST_P_NSR = 0x10,
-
- SLV_3_FIFO_EN = 0x20,
-
- WAIT_FOR_ES = 0x40,
-
- MULT_MST_EN = 0x80
- } I2C_MST_CTRL_BITS_T;
-
- /**
- * I2C_MST_CLK values
- */
- typedef enum {
- MST_CLK_348 = 0, // 348Khz
- MST_CLK_333 = 1,
- MST_CLK_320 = 2,
- MST_CLK_308 = 3,
- MST_CLK_296 = 4,
- MST_CLK_286 = 5,
- MST_CLK_276 = 6,
- MST_CLK_267 = 7,
- MST_CLK_258 = 8,
- MST_CLK_500 = 9,
- MST_CLK_471 = 10,
- MST_CLK_444 = 11,
- MST_CLK_421 = 12,
- MST_CLK_400 = 13,
- MST_CLK_381 = 14,
- MST_CLK_364 = 15
- } I2C_MST_CLK_T;
-
- /**
- * REG_I2C SLV0-SLV4 _ADDR bits
- */
- typedef enum {
- I2C_SLV_ADDR0 = 0x01,
- I2C_SLV_ADDR1 = 0x02,
- I2C_SLV_ADDR2 = 0x04,
- I2C_SLV_ADDR3 = 0x08,
- I2C_SLV_ADDR4 = 0x10,
- I2C_SLV_ADDR5 = 0x20,
- I2C_SLV_ADDR6 = 0x40,
- _I2C_SLV_ADDR_SHIFT = 0,
- _I2C_SLV_ADDR_MASK = 127,
-
- I2C_SLV_RW = 0x80
- } I2C_SLV_ADDR_BITS_T;
-
- /**
- * REG_I2C SLV0-SLV3 _CTRL bits
- */
- typedef enum {
- I2C_SLV_LEN0 = 0x01,
- I2C_SLV_LEN1 = 0x02,
- I2C_SLV_LEN2 = 0x04,
- I2C_SLV_LEN3 = 0x08,
- _I2C_SLV_LEN_SHIFT = 0,
- _I2C_SLV_LEN_MASK = 15,
-
- I2C_SLV_GRP = 0x10,
- I2C_SLV_REG_DIS = 0x20,
- I2C_SLV_BYTE_SW = 0x40,
- I2C_SLV_EN = 0x80
- } I2C_SLV_CTRL_BITS_T;
-
- /**
- * REG_I2C_SLV4_CTRL bits, these are different from the SLV0-SLV3
- * CRTL bits.
- *
- * MST_DLY is not enumerated in the register map. It configures
- * the reduced access rate of i2c slaves relative to the sample
- * rate. When a slave’s access rate is decreased relative to the
- * Sample Rate, the slave is accessed every
- * 1 / (1 + I2C_MST_DLY) samples
- */
- typedef enum {
- I2C_MST_DLY0 = 0x01,
- I2C_MST_DLY1 = 0x02,
- I2C_MST_DLY2 = 0x04,
- I2C_MST_DLY3 = 0x08,
- I2C_MST_DLY4 = 0x10,
- _I2C_MST_DLY_SHIFT = 0,
- _I2C_MST_DLY_MASK = 31,
-
- I2C_SLV4_REG_DIS = 0x20,
- I2C_SLV4_INT_EN = 0x40,
- I2C_SLV4_EN = 0x80
- } I2C_SLV4_CTRL_BITS_T;
-
- /**
- * REG_I2C_MST_STATUS bits
- */
- typedef enum {
- I2C_SLV0_NACK = 0x01,
- I2C_SLV1_NACK = 0x02,
- I2C_SLV2_NACK = 0x04,
- I2C_SLV3_NACK = 0x08,
- I2C_SLV4_NACK = 0x10,
-
- I2C_LOST_ARB = 0x20,
- I2C_SLV4_DONE = 0x40,
- PASS_THROUGH = 0x80
- } I2C_MST_STATUS_BITS_T;
-
- /**
- * REG_INT_PIN_CFG bits
- */
- typedef enum {
- CLKOUT_EN = 0x01, // *
-
- I2C_BYPASS_ENABLE = 0x02,
-
- FSYNC_INT_EN = 0x04,
- FSYNC_INT_LEVEL = 0x08,
-
- INT_RD_CLEAR = 0x10,
-
- LATCH_INT_EN = 0x20,
-
- INT_OPEN = 0x40,
- INT_LEVEL = 0x80
- } INT_PIN_CFG_BITS_T;
-
- /**
- * REG_INT_ENABLE bits
- */
- typedef enum {
- DATA_RDY_EN = 0x01, // *
-
- // 0x02, 0x04 reserved
-
- I2C_MST_INT_EN = 0x08,
-
- FIFO_OFLOW_EN = 0x10,
-
- ZMOT_EN = 0x20, // *zero motion
- MOT_EN = 0x40,
- FF_EN = 0x80 // *freefall
- } INT_ENABLE_BITS_T;
-
- /**
- * REG_INT_STATUS bits
- */
- typedef enum {
- DATA_RDY_INT = 0x01,
-
- // 0x02, 0x04 reserved
-
- I2C_MST_INT = 0x08,
-
- FIFO_OFLOW_INT = 0x10,
-
- ZMOT_INT = 0x20, // *zero motion
- MOT_INT = 0x40,
- FF_INT = 0x80 // *freefall
- } INT_STATUS_BITS_T;
-
- /**
- * REG_MOT_DETECT_STATUS bits (mpu9150 only)
- */
- typedef enum {
- MOT_ZRMOT = 0x01, // *
-
- // 0x02 reserved
-
- MOT_ZPOS = 0x04, // *
- MOT_ZNEG = 0x08, // *
-
- MOT_YPOS = 0x10, // *
- MOT_YNEG = 0x20, // *
-
- MOT_XPOS = 0x40, // *
- MOT_XNEG = 0x80, // *
- } MOT_DETECT_STATUS_BITS_T;
-
- /**
- * REG_MST_DELAY_CTRL bits
- */
- typedef enum {
- I2C_SLV0_DLY_EN = 0x01,
- I2C_SLV1_DLY_EN = 0x02,
- I2C_SLV2_DLY_EN = 0x04,
- I2C_SLV3_DLY_EN = 0x08,
- I2C_SLV4_DLY_EN = 0x10,
-
- // 0x20, 0x40, reserved
-
- DELAY_ES_SHADOW = 0x80
- } MST_DELAY_CTRL_BITS_T;
-
- /**
- * REG_SIGNAL_PATH_RESET bits
- */
- typedef enum {
- TEMP_RESET = 0x01,
- ACCEL_RESET = 0x02,
- GYRO_RESET = 0x04
-
- // 0x08-0x80 reserved
- } SIGNAL_PATH_RESET_BITS_T;
-
- /**
- * REG_MOT_DETECT_CTRL bits
- */
- typedef enum {
- MOT_COUNT0 = 0x01, // *
- MOT_COUNT1 = 0x02, // *
- _MOT_COUNT_SHIFT = 0,
- _MOT_COUNT_MASK = 3,
-
- FF_COUNT0 = 0x04, // *
- FF_COUNT1 = 0x08, // *
- _FF_COUNT_SHIFT = 2,
- _FF_COUNT_MASK = 3,
-
- ACCEL_ON_DELAY0 = 0x10,
- ACCEL_ON_DELAY1 = 0x20,
- _ACCEL_ON_DELAY_SHIFT = 4,
- _ACCEL_ON_DELAY_MASK = 3
- // 0x40,0x80 reserved
- } MOT_DETECT_CTRL_BITS_T;
-
- /**
- * MOT_COUNT or FF_COUNT values (mpu9150 only)
- */
- typedef enum {
- COUNT_0 = 0, // Reset
- COUNT_1 = 1, // counter decrement 1
- COUNT_2 = 2, // counter decrement 2
- COUNT_4 = 3 // counter decrement 4
- } MOT_FF_COUNT_T;
-
- /**
- * ACCEL_ON_DELAY values
- */
- typedef enum {
- ON_DELAY_0 = 0, // no delay
- ON_DELAY_1 = 1, // add 1ms
- ON_DELAY_2 = 2, // add 2ms
- ON_DELAY_3 = 3 // add 3ms
- } ACCEL_ON_DELAY_T;
-
- /**
- * REG_USER_CTRL bits
- */
- typedef enum {
- SIG_COND_RESET = 0x01,
- I2C_MST_RESET = 0x02,
- FIFO_RESET = 0x04,
-
- // 0x08 reserved
-
- I2C_IF_DIS = 0x10,
- I2C_MST_EN = 0x20,
- FIFO_EN = 0x40
-
- /// 0x80 reserved
- } USER_CTRL_BITS_T;
-
- /**
- * REG_PWR_MGMT_1 bits
- */
- typedef enum {
- CLKSEL0 = 0x01,
- CLKSEL1 = 0x02,
- CLKSEL2 = 0x04,
- _CLKSEL_SHIFT = 0,
- _CLKSEL_MASK = 7,
-
- TEMP_DIS = 0x08,
-
- // 0x10 reserved
-
- PWR_CYCLE = 0x20,
- PWR_SLEEP = 0x40,
- DEVICE_RESET = 0x80
- } PWR_MGMT_1_BITS_T;
-
- /**
- * CLKSEL values
- */
- typedef enum {
- INT_8MHZ = 0, // internal 8Mhz osc
- PLL_XG = 1, // PLL X axis gyro
- PLL_YG = 2, // PLL Y axis gyro
- PLL_ZG = 3, // PLL Z axis gyro
- PLL_EXT_32KHZ = 4, // PLL with external 32.768Khz ref
- PLL_EXT_19MHZ = 5, // PLL with external 19.2Mhz ref
- // 6 - reserved
- CLK_STOP = 7 // stops clk
- } CLKSEL_T;
-
- /**
- * REG_PWR_MGMT_2 bits
- */
- typedef enum {
- STBY_ZG = 0x01,
- STBY_YG = 0x02,
- STBY_XG = 0x04,
- STBY_ZA = 0x08,
- STBY_YA = 0x10,
- STBY_XA = 0x20,
-
- LP_WAKE_CTRL0 = 0x40,
- LP_WAKE_CTRL1 = 0x80,
- _LP_WAKE_CTRL_SHIFT = 6,
- _LP_WAKE_CTRL_MASK = 3
- } PWR_MGMT_2_BITS_T;
-
- /**
- * LP_WAKE_CTRL values
- */
- typedef enum {
- LP_WAKE_1_25 = 0, // wakeup feq: 1.25hz
- LP_WAKE_5 = 1, // 5hz
- LP_WAKE_20 = 2, // 20hz
- LP_WAKE_40 = 3, // 40hz
- } LP_WAKE_CRTL_T;
-
-
- /**
- * mpu60x0 constructor
- *
- * @param bus i2c bus to use
- * @param address the address for this device
- */
- MPU60X0(int bus=MPU60X0_I2C_BUS, uint8_t address=MPU60X0_DEFAULT_I2C_ADDR);
-
- /**
- * MPU60X0 Destructor
- */
- ~MPU60X0();
-
- /**
- * set up initial values and start operation
- *
- * @return true if successful
- */
- bool init();
-
- /**
- * take a measurement and store the current sensor values
- * internally. Note, these user facing registers are only updated
- * from the internal device sensor values when the i2c serial
- * traffic is 'idle'. So, if you are reading the values too fast,
- * the bus may never be idle, and you will just end up reading
- * the same values over and over.
- *
- * Unfortunately, it is is not clear how long 'idle' actually
- * means, so if you see this behavior, reduce the rate at which
- * you are calling update().
- *
- */
- void update();
-
- /**
- * read a register
- *
- * @param reg the register to read
- * @return the value of the register
- */
- uint8_t readReg(uint8_t reg);
-
- /**
- * read contiguous refister into a buffer
- *
- * @param reg the register to start reading at
- * @param buffer the buffer to store the results
- * @param len the number of registers to read
- * @return the value of the register
- */
- void readRegs(uint8_t reg, uint8_t *buffer, int len);
-
- /**
- * write to a register
- *
- * @param reg the register to write to
- * @param val the value to write
- * @return true if successful, false otherwise
- */
- bool writeReg(uint8_t reg, uint8_t val);
-
- /**
- * enable or disable device sleep
- *
- * @param enable true to put device to sleep, false to wake up
- * @return true if successful, false otherwise
- */
- bool setSleep(bool enable);
-
- /**
- * specify the clock source for the device to use
- *
- * @param clk one of the CLKSEL_T values
- * @return true if successful, false otherwise
- */
- bool setClockSource(CLKSEL_T clk);
-
- /**
- * set the scaling mode of the gyroscope
- *
- * @param scale one of the FS_SEL_T values
- * @return true if successful, false otherwise
- */
- bool setGyroscopeScale(FS_SEL_T scale);
-
- /**
- * set the scaling mode of the accelerometer
- *
- * @param scale one of the AFS_SEL_T values
- * @return true if successful, false otherwise
- */
- bool setAccelerometerScale(AFS_SEL_T scale);
-
- /**
- * set the Low Pass Digital filter. This enables filtering (if
- * non-0) of the accelerometer and gyro outputs.
- *
- * @param scale one of the DLPF_CFG_T values
- * @return true if successful, false otherwise
- */
- bool setDigitalLowPassFilter(DLPF_CFG_T dlp);
-
- /**
- * set the sample rate divider. This register specifies the
- * divider from the gyro output rate used to generate the Sample
- * Rate. The sensor registor output, FIFO output, DMP sampling
- * and motion detection are all based on the Sample Rate.
- *
- * The Sample Rate is generated by dividing the gyro output rate
- * by this register:
- *
- * Sample Rate = Gyro output rate / (1 + sample rate divider).
- *
- * The Gyro output rate is 8Khz when the Digital Low Pass Filter
- * (DLPF) is 0 or 7 (DLPF_260_256 or DLPF_RESERVED), and 1Khz
- * otherwise.
- *
- * @param scale one of the DLPF_CFG_T values
- * @return true if successful, false otherwise
- */
- bool setSampleRateDivider(uint8_t div);
-
- /**
- * get the current Sample Rate divider
- *
- * @return the current sample rate divider
- */
- uint8_t getSampleRateDivider();
-
- /**
- * get the accelerometer values
- *
- * @param x the returned x value, if arg is non-NULL
- * @param y the returned y value, if arg is non-NULL
- * @param z the returned z value, if arg is non-NULL
- * @return true if successful, false otherwise
- */
- void getAccelerometer(float *x, float *y, float *z);
-
- /**
- * get the gyroscope values
- *
- * @param x the returned x value, if arg is non-NULL
- * @param y the returned y value, if arg is non-NULL
- * @param z the returned z value, if arg is non-NULL
- * @return true if successful, false otherwise
- */
- void getGyroscope(float *x, float *y, float *z);
-
-#if defined(SWIGJAVA) || defined(JAVACALLBACK)
- /**
- * get the accelerometer values
- *
- * @return Array containing X, Y, Z accelerometer values
- */
- float *getAccelerometer();
-
- /**
- * get the gyroscope values
- *
- * @return Array containing X, Y, Z gyroscope values
- */
- float *getGyroscope();
-#endif
-
-
- /**
- * get the temperature value
- *
- * @return the temperature value in degrees Celcius
- */
- virtual float getTemperature();
-
- /**
- * enable onboard temperature measurement sensor
- *
- * @param enable true to enable temperature sensor, false to disable
- * @return true if successful, false otherwise
- */
- bool enableTemperatureSensor(bool enable);
-
- /**
- * configure external sync. An external signal connected to the
- * FSYNC pin can be sampled by configuring EXT_SYNC_SET. Signal
- * changes to the FSYNC pin are latched so that short strobes may
- * be captured. The latched FSYNC signal will be sampled at the
- * Sampling Rate, as defined in register 25. After sampling, the
- * latch will reset to the current FSYNC signal state.
- *
- * The sampled value will be reported in place of the least
- * significant bit in a sensor data register determined by the
- * value of EXT_SYNC_SET
- *
- * @param val one of the EXT_SYNC_SET_T values
- * @return true if successful, false otherwise
- */
- bool setExternalSync(EXT_SYNC_SET_T val);
-
- /**
- * enable I2C Bypass. Enabling this feature allows devices on the
- * MPU60X0 auxillary I2C bus to be visible on the MCU's I2C bus.
- *
- * @param enable true to I2C bypass
- * @return true if successful, false otherwise
- */
- bool enableI2CBypass(bool enable);
-
- /**
- * set the motion detection threshold for interrupt generation.
- * Motion is detected when the absolute value of any of the
- * accelerometer measurements exceeds this Motion detection
- * threshold.
- *
- * @param thr threshold
- * @return true if successful, false otherwise
- */
- bool setMotionDetectionThreshold(uint8_t thr);
-
- /**
- * return the interrupt status register.
- *
- * @return the interrupt status word (see INT_STATUS_BITS_T)
- */
- uint8_t getInterruptStatus();
-
- /**
- * set the interrupt enables
- *
- * @param enables bitmask of INT_ENABLE_BITS_T values to enable
- * @return true if successful, false otherwise
- */
- bool setInterruptEnables(uint8_t enables);
-
- /**
- * get the current interrupt enables register
- *
- * @return bitmask of INT_ENABLE_BITS_T values
- */
- uint8_t getInterruptEnables();
-
- /**
- * set the interrupt pin configuration
- *
- * @param cfg bitmask of INT_PIN_CFG_BITS_T values
- * @return true if successful, false otherwise
- */
- bool setInterruptPinConfig(uint8_t cfg);
-
- /**
- * get the current interrupt pin configuration
- *
- * @return bitmask of INT_PIN_CFG_BITS_T values
- */
- uint8_t getInterruptPinConfig();
-
- /**
- * install an interrupt handler.
- *
- * @param gpio gpio pin to use as interrupt pin
- * @param level the interrupt trigger level (one of mraa::Edge
- * values). Make sure that you have configured the interrupt pin
- * (setInterruptPinConfig()) properly for whatever level you
- * choose.
- * @param isr the interrupt handler, accepting a void * argument
- * @param arg the argument to pass the the interrupt handler
- */
-#if defined(SWIGJAVA) || defined(JAVACALLBACK)
- void installISR(int gpio, mraa::Edge level, jobject runnable);
-#else
- void installISR(int gpio, mraa::Edge level, void (*isr)(void *), void *arg);
-#endif
-
- /**
- * uninstall a previously installed interrupt handler
- *
- */
- void uninstallISR();
-
- protected:
- // uncompensated accelerometer and gyroscope values
- float m_accelX;
- float m_accelY;
- float m_accelZ;
-
- float m_gyroX;
- float m_gyroY;
- float m_gyroZ;
-
- // uncompensated temperature value
- float m_temp;
-
- // accelerometer and gyro scaling factors, depending on their Full
- // Scale settings.
- float m_accelScale;
- float m_gyroScale;
-
- private:
- mraa::I2c m_i2c;
- uint8_t m_addr;
-
- mraa::Gpio *m_gpioIRQ;
- };
-}
-
-
diff --git a/peripheral/libupm/src/mpu9150/mpu9150.cxx b/peripheral/libupm/src/mpu9150/mpu9150.cxx
deleted file mode 100644
index a253e84..0000000
--- a/peripheral/libupm/src/mpu9150/mpu9150.cxx
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <unistd.h>
-#include <stdlib.h>
-
-#include "mpu9150.h"
-
-using namespace upm;
-using namespace std;
-
-MPU9150::MPU9150 (int bus, int address, int magAddress, bool enableAk8975) :
- m_mag(0), MPU60X0(bus, address)
-{
- m_magAddress = magAddress;
- m_i2cBus = bus;
- m_enableAk8975 = enableAk8975;
-}
-
-MPU9150::~MPU9150()
-{
- if (m_mag)
- delete m_mag;
-}
-
-bool MPU9150::init()
-{
- // init the gyro/accel component
- if (!MPU60X0::init())
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": Unable to init MPU60X0");
- return false;
- }
-
- // Enabling I2C bypass will allow us to access the
- // AK8975 Magnetometer on I2C addr 0x0c.
- if (m_enableAk8975 == true)
- {
- if (!enableI2CBypass(true))
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": Unable to enable I2C bypass");
- return false;
- }
-
- // Now that we've done that, create an AK8975 instance and
- // initialize it.
-
- m_mag = new AK8975(m_i2cBus, m_magAddress);
-
- if (!m_mag->init())
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": Unable to init magnetometer");
- delete m_mag;
- m_mag = 0;
- return false;
- }
- }
-
- return true;
-}
-
-void MPU9150::update()
-{
- MPU60X0::update();
-
- if (m_mag)
- m_mag->update();
-}
-
-void MPU9150::getMagnetometer(float *x, float *y, float *z)
-{
- float mx, my, mz;
-
- if (!m_mag)
- mx = my = mz = 0.0;
- else
- m_mag->getMagnetometer(&mx, &my, &mz);
-
- if (x)
- *x = mx;
- if (y)
- *y = my;
- if (z)
- *z = mz;
-}
-
-#ifdef SWIGJAVA
-float *MPU9150::getMagnetometer()
-{
- float *v = new float[3];
- getMagnetometer(&v[0], &v[1], &v[2]);
- return v;
-}
-#endif
diff --git a/peripheral/libupm/src/mpu9150/mpu9150.h b/peripheral/libupm/src/mpu9150/mpu9150.h
deleted file mode 100644
index 2a53fea..0000000
--- a/peripheral/libupm/src/mpu9150/mpu9150.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#pragma once
-
-#include "mpu60x0.h"
-#include "ak8975.h"
-
-#define MPU9150_I2C_BUS 0
-#define MPU9150_DEFAULT_I2C_ADDR MPU60X0_DEFAULT_I2C_ADDR
-
-
-namespace upm {
-
- /**
- * @brief MPU9150 accelerometer library
- * @defgroup mpu9150 libupm-mpu9150
- * @ingroup seeed i2c gpio accelerometer compass
- */
-
- /**
- * @library mpu9150
- * @sensor mpu9150
- * @comname MPU9150 Inertial Measurement Unit
- * @altname Grove IMU 9DOF
- * @type accelerometer compass
- * @man seeed
- * @web http://www.seeedstudio.com/wiki/Grove_-_IMU_9DOF_v1.0
- * @con i2c gpio
- *
- * @brief API for MPU9150 chip (Accelerometer, Gyro and Magnometer Sensor)
- *
- * This module defines the MPU9150 interface for libmpu9150
- *
- * @image html mpu9150.jpg
- * @snippet mpu9150.cxx Interesting
- */
-
- class MPU9150: public MPU60X0
- {
- public:
- /**
- * MPU9150 constructor
- *
- * @param bus I2C bus to use
- * @param address The address for this device
- * @param magAddress The address of the connected magnetometer
- */
- MPU9150 (int bus=MPU9150_I2C_BUS, int address=MPU9150_DEFAULT_I2C_ADDR,
- int magAddress=AK8975_DEFAULT_I2C_ADDR, bool enableAk8975=false);
-
- /**
- * MPU9150 destructor
- */
- ~MPU9150 ();
-
- /**
- * Set up initial values and start operation
- *
- * @return true if successful
- */
- bool init();
-
- /**
- * Take a measurement and store the current sensor values
- * internally. Note, these user facing registers are only updated
- * from the internal device sensor values when the i2c serial
- * traffic is 'idle'. So, if you are reading the values too fast,
- * the bus may never be idle, and you will just end up reading
- * the same values over and over.
- *
- * Unfortunately, it is is not clear how long 'idle' actually
- * means, so if you see this behavior, reduce the rate at which
- * you are calling update().
- */
- void update();
-
- /**
- * Return the compensated values for the x, y, and z axes. The
- * unit of measurement is in micro-teslas (uT).
- *
- * @param x Pointer to returned X axis value
- * @param y Pointer to returned Y axis value
- * @param z Pointer to returned Z axis value
- */
- void getMagnetometer(float *x, float *y, float *z);
-
-#ifdef SWIGJAVA
- /**
- * Return the compensated values for the x, y, and z axes. The
- * unit of measurement is in micro-teslas (uT).
- *
- * @return Array containing X, Y, Z magnetometer values
- */
- float *getMagnetometer();
-#endif
-
-
-
- protected:
- // magnetometer instance
- AK8975* m_mag;
-
-
- private:
- int m_i2cBus;
- uint8_t m_magAddress;
- bool m_enableAk8975;
- };
-
-}
diff --git a/peripheral/libupm/src/mpu9150/mpu9250.cxx b/peripheral/libupm/src/mpu9150/mpu9250.cxx
deleted file mode 100644
index c646a98..0000000
--- a/peripheral/libupm/src/mpu9150/mpu9250.cxx
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <unistd.h>
-#include <stdlib.h>
-
-#include "mpu9250.h"
-
-using namespace upm;
-using namespace std;
-
-MPU9250::MPU9250 (int bus, int address, int magAddress, bool enableAk8975) :
- MPU9150(bus, address, magAddress, enableAk8975)
-{
-}
-
-MPU9250::~MPU9250()
-{
-}
-
-float MPU9250::getTemperature()
-{
- // this equation is taken from the datasheet. The 333.87 value was
- // taken from the adafruit code (it is referenced as
- // Temp_Sensitivity in the datasheet, but no value is provided there).
- return (m_temp / 333.87) + 21.0;
-}
-
diff --git a/peripheral/libupm/src/mpu9150/mpu9250.h b/peripheral/libupm/src/mpu9150/mpu9250.h
deleted file mode 100644
index c4da944..0000000
--- a/peripheral/libupm/src/mpu9150/mpu9250.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#pragma once
-
-#include "mpu9150.h"
-
-#define MPU9250_I2C_BUS 0
-#define MPU9250_DEFAULT_I2C_ADDR MPU9150_DEFAULT_I2C_ADDR
-
-
-namespace upm {
-
- /**
- * @library mpu9150
- * @sensor mpu9250
- * @comname MPU9250 Inertial Measurement Unit
- * @altname Grove IMU 9DOF V2
- * @type accelerometer compass
- * @man seeed
- * @web http://www.seeedstudio.com/wiki/Grove_-_IMU_9DOF_v2.0
- * @con i2c gpio
- *
- * @brief API for MPU9250 chip (Accelerometer, Gyro and Magnometer Sensor)
- *
- * This module defines the MPU9250 interface for libmpu9150
- *
- * @image html mpu9250.jpg
- * @snippet mpu9250.cxx Interesting
- */
-
- class MPU9250: public MPU9150
- {
- public:
- /**
- * MPU9250 constructor
- *
- * @param bus I2C bus to use
- * @param address The address for this device
- * @param magAddress The address of the connected magnetometer
- * @param enableAk8975 Enables i2c bypass mode for magnetometer, default
- * is true
- */
- MPU9250 (int bus=MPU9250_I2C_BUS, int address=MPU9250_DEFAULT_I2C_ADDR,
- int magAddress=AK8975_DEFAULT_I2C_ADDR, bool enableAk8975=true);
-
- /**
- * MPU9250 destructor
- */
- ~MPU9250 ();
-
- /**
- * get the temperature value
- *
- * @return the temperature value in degrees Celcius
- */
- float getTemperature();
-
- protected:
-
- private:
- };
-
-}
diff --git a/peripheral/libupm/src/mpu9150/pyupm_mpu9150.i b/peripheral/libupm/src/mpu9150/pyupm_mpu9150.i
deleted file mode 100644
index 0918efb..0000000
--- a/peripheral/libupm/src/mpu9150/pyupm_mpu9150.i
+++ /dev/null
@@ -1,32 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_mpu9150
-%include "../upm.i"
-%include "cpointer.i"
-
-%include "stdint.i"
-
-%feature("autodoc", "3");
-
-%pointer_functions(float, floatp);
-
-%include "ak8975.h"
-%{
- #include "ak8975.h"
-%}
-
-%include "mpu60x0.h"
-%{
- #include "mpu60x0.h"
-%}
-
-%include "mpu9150.h"
-%{
- #include "mpu9150.h"
-%}
-
-%include "mpu9250.h"
-%{
- #include "mpu9250.h"
-%}
-
diff --git a/peripheral/libupm/src/mq303a/CMakeLists.txt b/peripheral/libupm/src/mq303a/CMakeLists.txt
deleted file mode 100644
index aae1c75..0000000
--- a/peripheral/libupm/src/mq303a/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "mq303a")
-set (libdescription "upm mq303a module")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/mq303a/javaupm_mq303a.i b/peripheral/libupm/src/mq303a/javaupm_mq303a.i
deleted file mode 100644
index da7c5bb..0000000
--- a/peripheral/libupm/src/mq303a/javaupm_mq303a.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_mq303a
-%include "../upm.i"
-
-%{
- #include "mq303a.h"
-%}
-
-%include "mq303a.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_mq303a");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/mq303a/jsupm_mq303a.i b/peripheral/libupm/src/mq303a/jsupm_mq303a.i
deleted file mode 100644
index 857b92a..0000000
--- a/peripheral/libupm/src/mq303a/jsupm_mq303a.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_mq303a
-%include "../upm.i"
-
-%{
- #include "mq303a.h"
-%}
-
-%include "mq303a.h"
diff --git a/peripheral/libupm/src/mq303a/mq303a.cxx b/peripheral/libupm/src/mq303a/mq303a.cxx
deleted file mode 100644
index 612ffd5..0000000
--- a/peripheral/libupm/src/mq303a/mq303a.cxx
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <string>
-#include <stdexcept>
-
-#include "mq303a.h"
-
-using namespace upm;
-
-MQ303A::MQ303A(int pin, int heaterPin)
-{
- if ( !(m_aio = mraa_aio_init(pin)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_aio_init() failed, invalid pin?");
- return;
- }
-
- if ( !(m_gpio = mraa_gpio_init(heaterPin)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_gpio_init() failed, invalid pin?");
- return;
- }
- mraa_gpio_dir(m_gpio, MRAA_GPIO_OUT);
-}
-
-MQ303A::~MQ303A()
-{
- heaterEnable(false);
- mraa_aio_close(m_aio);
- mraa_gpio_close(m_gpio);
-}
-
-int MQ303A::value()
-{
- return (1023 - mraa_aio_read(m_aio));
-}
-
-void MQ303A::heaterEnable(bool enable)
-{
- if (enable)
- mraa_gpio_write(m_gpio, 0); // 0 turns on the heater
- else
- mraa_gpio_write(m_gpio, 1); // 1 turns off the heater
-}
diff --git a/peripheral/libupm/src/mq303a/mq303a.h b/peripheral/libupm/src/mq303a/mq303a.h
deleted file mode 100644
index 41e5c3b..0000000
--- a/peripheral/libupm/src/mq303a/mq303a.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include <mraa/aio.h>
-
-namespace upm {
-
- /**
- * @brief MQ303A Alcohol Sensor library
- * @defgroup mq303a libupm-mq303a
- * @ingroup seeed analog gpio gaseous tsk
- */
- /**
- * @library mq303a
- * @sensor mq303a
- * @comname MQ303A Alcohol Sensor
- * @altname Grove Alcohol Sensor
- * @type gaseous
- * @man seeed
- * @web http://www.seeedstudio.com/wiki/Grove_-_Alcohol_Sensor
- * @con analog gpio
- * @kit tsk
- *
- * @brief API for the MQ303A Alcohol Sensor
- *
- * UPM module for the MQ303A alcohol sensor.
- * This sensor needs to be warmed up before stable results are
- * obtained. The higher the value returned from value(),
- * the higher the amount of alcohol detected.
- *
- * @image html mq303a.jpg
- * @snippet mq303a.cxx Interesting
- */
- class MQ303A {
- public:
- /**
- * MQ303A constructor
- *
- * @param pin Analog pin to use
- * @param heaterPin Digital pin mapped to the analog pin to use
- */
- MQ303A(int pin, int heaterPin);
-
- /**
- * MQ303A destructor
- */
- ~MQ303A();
-
- /**
- * Gets the alcohol reading from the sensor.
- * The value read from the analog pin is inverted.
- * A higher returned value means a higher amount of alcohol detected.
- *
- * @return Alcohol reading
- */
- int value();
-
- /**
- * Enables the heater
- *
- * @param enable Enables the heater if true; otherwise, disables it
- */
- void heaterEnable(bool enable);
-
- private:
- mraa_aio_context m_aio;
- mraa_gpio_context m_gpio;
- };
-}
-
-
diff --git a/peripheral/libupm/src/mq303a/pyupm_mq303a.i b/peripheral/libupm/src/mq303a/pyupm_mq303a.i
deleted file mode 100644
index 4aee330..0000000
--- a/peripheral/libupm/src/mq303a/pyupm_mq303a.i
+++ /dev/null
@@ -1,11 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_mq303a
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "mq303a.h"
-%{
- #include "mq303a.h"
-%}
diff --git a/peripheral/libupm/src/my9221/CMakeLists.txt b/peripheral/libupm/src/my9221/CMakeLists.txt
deleted file mode 100644
index dbf8ba6..0000000
--- a/peripheral/libupm/src/my9221/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "my9221")
-set (libdescription "upm my9221")
-set (module_src ${libname}.cxx groveledbar.cxx grovecircularled.cxx)
-set (module_h ${libname}.h groveledbar.h grovecircularled.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/my9221/grovecircularled.cxx b/peripheral/libupm/src/my9221/grovecircularled.cxx
deleted file mode 100644
index 7c89cd6..0000000
--- a/peripheral/libupm/src/my9221/grovecircularled.cxx
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2016 Intel Corporation.
- *
- * These modules were rewritten, based on original work by:
- *
- * (original my9221/groveledbar driver)
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * (grovecircularled driver)
- * Author: Jun Kato and Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Contributions: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <string>
-#include <stdexcept>
-#include <unistd.h>
-#include <stdlib.h>
-
-#include "grovecircularled.h"
-
-using namespace upm;
-using namespace std;
-
-GroveCircularLED::GroveCircularLED (uint8_t dataPin, uint8_t clockPin)
- : MY9221(dataPin, clockPin, 2)
-{
- // auto refresh by default
- setAutoRefresh(true);
- clearAll();
-}
-
-GroveCircularLED::~GroveCircularLED()
-{
-}
-
-void GroveCircularLED::setSpinner(uint8_t position)
-{
- if (position > 23)
- position = 23;
-
- for (uint8_t i=0; i<(LEDS_PER_INSTANCE * m_instances); i++)
- m_bitStates[i] = (i == position) ? m_highIntensity : m_lowIntensity;
-
- if (m_autoRefresh)
- refresh();
-
- return;
-}
-
-void GroveCircularLED::setLevel(uint8_t level, bool direction)
-{
- if (level > 23)
- level = 23;
-
- if (!direction)
- {
- for (int i=0; i<(LEDS_PER_INSTANCE * m_instances); i++)
- m_bitStates[i] = (i < level) ? m_highIntensity : m_lowIntensity;
- }
- else
- {
- for (int i=0; i<(LEDS_PER_INSTANCE * m_instances); i++)
- m_bitStates[i] = (((LEDS_PER_INSTANCE * m_instances) - i) <= level)
- ? m_highIntensity : m_lowIntensity;
- }
-
- if (m_autoRefresh)
- refresh();
-
- return;
-}
diff --git a/peripheral/libupm/src/my9221/grovecircularled.h b/peripheral/libupm/src/my9221/grovecircularled.h
deleted file mode 100644
index 51bc2da..0000000
--- a/peripheral/libupm/src/my9221/grovecircularled.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2016 Intel Corporation.
- *
- * These modules were rewritten, based on original work by:
- *
- * (original my9221/groveledbar)
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * (grovecircularled)
- * Author: Jun Kato and Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Contributions: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include <mraa/common.hpp>
-#include <mraa/gpio.hpp>
-#include "my9221.h"
-
-namespace upm {
-
- /**
- * @library my9221
- * @sensor grovecircularled
- * @comname Grove Circular LED
- * @type display
- * @man seeed
- * @web http://www.seeedstudio.com/wiki/Grove_-_Circular_LED
- * @con gpio
- *
- * @brief API for the Grove Circular LED module
- *
- * This is a circular LED ring based on the MY9221 chip. It is often used
- * with a rotary encoder and has 24 controllable LEDs.
- *
- * @image html grovecircularled.jpg
- * @snippet grovecircularled.cxx Interesting
- */
-
- class GroveCircularLED : public MY9221 {
- public:
- /**
- * Instantiates an GroveCircularLED object
- *
- * @param dataPin Data pin
- * @param clockPin Clock pin
- */
- GroveCircularLED(uint8_t dataPin, uint8_t clockPin);
-
- /**
- * GroveCircularLED destructor
- */
- ~GroveCircularLED();
-
- /**
- * Sets the spinner (turns off all LEDs but selected one)
- *
- * @param position Selected position for the spinner (0-23)
- */
- void setSpinner(uint8_t position);
-
- /**
- * Sets the lighting status
- *
- * @param level Selected level for the circular LED (0-23)
- * @param direction Up or down; up is true and default
- */
- void setLevel(uint8_t level, bool direction=true);
-
- protected:
- private:
- };
-
-}
diff --git a/peripheral/libupm/src/my9221/groveledbar.cxx b/peripheral/libupm/src/my9221/groveledbar.cxx
deleted file mode 100644
index 0146a84..0000000
--- a/peripheral/libupm/src/my9221/groveledbar.cxx
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2016 Intel Corporation.
- *
- * These modules were rewritten, based on original work by:
- *
- * (original my9221/groveledbar driver)
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * (grovecircularled driver)
- * Author: Jun Kato and Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Contributions: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <string>
-#include <stdexcept>
-#include <unistd.h>
-#include <stdlib.h>
-
-#include "groveledbar.h"
-
-using namespace upm;
-using namespace std;
-
-GroveLEDBar::GroveLEDBar (uint8_t dataPin, uint8_t clockPin, int instances)
- : MY9221(dataPin, clockPin, instances)
-{
- // auto refresh by default
- setAutoRefresh(true);
- clearAll();
-}
-
-GroveLEDBar::~GroveLEDBar()
-{
-}
-
-void GroveLEDBar::setBarLevel(uint8_t level, bool greenToRed, int barNumber)
-{
- if (level > 10)
- level = 10;
-
- if (barNumber >= m_instances)
- barNumber = m_instances - 1;
-
- int start = barNumber * LEDS_PER_INSTANCE;
- int end = start + LEDS_PER_INSTANCE;
-
- if (!greenToRed)
- {
- for (int i=start; i<end; i++)
- m_bitStates[i] = (i < (level + start)) ?
- m_highIntensity : m_lowIntensity;
- }
- else
- {
- for (int i=start; i<end; i++)
- m_bitStates[i] = ( ((start + LEDS_PER_INSTANCE) - i) <=
- (level + 2 + start)) ?
- m_highIntensity : m_lowIntensity;
- }
-
- if (m_autoRefresh)
- refresh();
-
- return;
-}
diff --git a/peripheral/libupm/src/my9221/groveledbar.h b/peripheral/libupm/src/my9221/groveledbar.h
deleted file mode 100644
index 35c8c4d..0000000
--- a/peripheral/libupm/src/my9221/groveledbar.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2016 Intel Corporation.
- *
- * These modules were rewritten, based on original work by:
- *
- * (original my9221/groveledbar)
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * (grovecircularled)
- * Author: Jun Kato and Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Contributions: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include <mraa/common.hpp>
-#include <mraa/gpio.hpp>
-
-#include "my9221.h"
-
-namespace upm {
-
- /**
- * @library my9221
- * @sensor groveledbar
- * @comname Grove LED Bar
- * @altname MY9221 LED Bar
- * @type display
- * @man seeed
- * @web http://www.seeedstudio.com/wiki/Grove_-_LED_Bar
- * @con gpio
- * @kit eak
- *
- * @brief API for Grove LED Bars base on the MY9221
- *
- * This is a 10-segment LED bar, with 8 green segments, 1 yellow
- * segment, and one red segment. They can be daisy chained together
- * so that this module can control multiple LED bars.
- *
- * @image html my9221.jpg
- * @snippet groveledbar.cxx Interesting
- */
-
- class GroveLEDBar : public MY9221 {
- public:
-
- /**
- * Instantiates an GroveLEDBar object
- *
- * @param dataPin Data pin
- * @param clockPin Clock pin
- * @param instances Number of daisy-chained Grove LED Bars, default 1
- */
- GroveLEDBar(uint8_t dataPin, uint8_t clockPin, int instances=1);
-
- /**
- * GroveLEDBar destructor
- */
- ~GroveLEDBar();
-
- /**
- * Sets the bar level
- *
- * @param level Selected level for the bar (0 - 10). 0 is off
- * @param greenToRed true if you start the level on the first
- * green LED, false otherwise
- * @param barNumber If you have multiple LED bars chained
- * together, this argument selects a specific bar starting at 0.
- * The default is 0.
- */
- void setBarLevel(uint8_t level, bool greenToRed=true, int barNumber=0);
-
- protected:
- private:
- };
-
-}
diff --git a/peripheral/libupm/src/my9221/javaupm_my9221.i b/peripheral/libupm/src/my9221/javaupm_my9221.i
deleted file mode 100644
index 0534108..0000000
--- a/peripheral/libupm/src/my9221/javaupm_my9221.i
+++ /dev/null
@@ -1,28 +0,0 @@
-%module javaupm_my9221
-%include "../upm.i"
-
-%include "my9221.h"
-%{
- #include "my9221.h"
-%}
-
-%include "groveledbar.h"
-%{
- #include "groveledbar.h"
-%}
-
-%include "grovecircularled.h"
-%{
- #include "grovecircularled.h"
-%}
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_my9221");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%}
diff --git a/peripheral/libupm/src/my9221/jsupm_my9221.i b/peripheral/libupm/src/my9221/jsupm_my9221.i
deleted file mode 100644
index a8e51e7..0000000
--- a/peripheral/libupm/src/my9221/jsupm_my9221.i
+++ /dev/null
@@ -1,18 +0,0 @@
-%module jsupm_my9221
-%include "../upm.i"
-
-%include "my9221.h"
-%{
- #include "my9221.h"
-%}
-
-%include "groveledbar.h"
-%{
- #include "groveledbar.h"
-%}
-
-%include "grovecircularled.h"
-%{
- #include "grovecircularled.h"
-%}
-
diff --git a/peripheral/libupm/src/my9221/my9221.cxx b/peripheral/libupm/src/my9221/my9221.cxx
deleted file mode 100644
index a5df3fb..0000000
--- a/peripheral/libupm/src/my9221/my9221.cxx
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2016 Intel Corporation.
- *
- * These modules were rewritten, based on original work by:
- *
- * (original my9221/groveledbar driver)
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * (grovecircularled driver)
- * Author: Jun Kato and Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Contributions: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <string>
-#include <stdexcept>
-#include <unistd.h>
-#include <stdlib.h>
-
-#include "my9221.h"
-
-using namespace upm;
-using namespace std;
-
-MY9221::MY9221 (uint8_t dataPin, uint8_t clockPin, int instances)
- : m_gpioData(dataPin), m_gpioClk(clockPin), m_bitStates(0)
-{
- if (instances < 1)
- {
- throw std::out_of_range(std::string(__FUNCTION__) +
- ": instances must be at least 1");
- }
-
- // set directions
- m_gpioClk.dir(mraa::DIR_OUT);
- m_gpioData.dir(mraa::DIR_OUT);
-
- // we warn if these fail, since it may not be possible to handle
- // more than one instance
-
- if (m_gpioClk.useMmap(true) != mraa::SUCCESS)
- cerr << __FUNCTION__
- << ": Warning: mmap of Clk pin failed, correct operation "
- << "may be affected."
- << endl;
-
- if (m_gpioData.useMmap(true) != mraa::SUCCESS)
- cerr << __FUNCTION__
- << ": Warning: mmap of Data pin failed, correct operation "
- << "may be affected."
- << endl;
-
- setLowIntensityValue(0x00); // full off
- setHighIntensityValue(0xff); // full brightness
-
- m_commandWord = 0x0000; // all defaults
- m_instances = instances;
-
- m_bitStates = new uint16_t[instances * LEDS_PER_INSTANCE];
-
- setAutoRefresh(true);
- clearAll();
-}
-
-MY9221::~MY9221()
-{
- clearAll();
-
- if (!m_autoRefresh)
- refresh();
-
- delete m_bitStates;
-}
-
-void MY9221::setLED(int led, bool on)
-{
- int maxLed = (LEDS_PER_INSTANCE * m_instances) - 1;
-
- if (led > maxLed)
- led = maxLed;
- if (led < 0)
- led = 0;
-
- m_bitStates[led] = (on) ? m_highIntensity : m_lowIntensity;
-
- if (m_autoRefresh)
- refresh();
-}
-
-void MY9221::setLowIntensityValue(int intensity)
-{
- m_lowIntensity = (intensity & 0xff);
-}
-
-void MY9221::setHighIntensityValue(int intensity)
-{
- m_highIntensity = (intensity & 0xff);
-}
-
-void MY9221::setAll()
-{
- for (int i=0; i<(m_instances * LEDS_PER_INSTANCE); i++)
- m_bitStates[i] = m_highIntensity;
-
- if (m_autoRefresh)
- refresh();
-}
-
-void MY9221::clearAll()
-{
- for (int i=0; i<(m_instances * LEDS_PER_INSTANCE); i++)
- m_bitStates[i] = m_lowIntensity;
-
- if (m_autoRefresh)
- refresh();
-}
-
-void MY9221::refresh()
-{
- for (int i=0; i<(m_instances * LEDS_PER_INSTANCE); i++)
- {
- if (i % 12 == 0)
- {
- send16bitBlock(m_commandWord);
- }
- send16bitBlock(m_bitStates[i]);
- }
-
- lockData();
-}
-
-void MY9221::lockData()
-{
- m_gpioData.write(0);
- usleep(220);
-
- for(int idx = 0; idx < 4; idx++)
- {
- m_gpioData.write(1);
- m_gpioData.write(0);
- }
-
- // in reality, we only need > 200ns + (m_instances * 10ns), so the
- // following should be good for up to m_instances < 80), if the
- // datasheet is to be believed :)
- usleep(1);
-
- return;
-}
-
-void MY9221::send16bitBlock(uint16_t data)
-{
- for (uint8_t bit_idx = 0; bit_idx < 16; bit_idx++)
- {
- uint32_t state = (data & 0x8000) ? 1 : 0;
- m_gpioData.write(state);
- state = m_gpioClk.read();
-
- if (state)
- state = 0;
- else
- state = 1;
-
- m_gpioClk.write(state);
-
- data <<= 1;
- }
- return;
-}
diff --git a/peripheral/libupm/src/my9221/my9221.h b/peripheral/libupm/src/my9221/my9221.h
deleted file mode 100644
index 5eebb39..0000000
--- a/peripheral/libupm/src/my9221/my9221.h
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2016 Intel Corporation.
- *
- * These modules were rewritten, based on original work by:
- *
- * (original my9221/groveledbar)
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * (grovecircularled)
- * Author: Jun Kato and Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Contributions: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include <mraa/common.hpp>
-#include <mraa/gpio.hpp>
-
-namespace upm {
-
- /**
- * @brief MY9221 LED Controller library
- * @defgroup my9221 libupm-my9221
- * @ingroup seeed display gpio eak
- */
- class MY9221 {
- public:
-
- // 12 LED channels per chip (instance)
- static const int LEDS_PER_INSTANCE = 12;
-
- /**
- * Instantiates an MY9221 object
- *
- * @param dataPin Data pin
- * @param clockPin Clock pin
- * @param instances Number of daisy-chained my9221s, default 1
- */
- MY9221(uint8_t dataPin, uint8_t clockPin, int instances=1);
-
- /**
- * MY9221 destructor
- */
- ~MY9221();
-
- /**
- * Enable or disable auto refresh. When auto refresh is enabled,
- * update the LED display as soon as the internal state changes.
- * When false, the display(s) will not be updated until the
- * refresh() method is called.
- *
- * @param enable true to enable auto refresh, false otherwise
- */
- void setAutoRefresh(bool enable)
- {
- m_autoRefresh = enable;
- }
-
- /**
- * Set an LED to a specific on (high intensity) or off (low
- * intensity) value.
- *
- * @param led The LED whose state you wish to change
- * @param on true to turn on the LED, false to turn the LED off
- */
- void setLED(int led, bool on);
-
- /**
- * Set the greyscale intensity of an LED in the OFF state. The
- * intensity is a value from 0 (fully off) to 255 (fully on).
- * This will take effect on any future LED set or clear
- * operations.
- *
- * @param intensity a value from 0 (fully off) to 255 (fully on)
- */
- void setLowIntensityValue(int intensity);
-
- /**
- * Set the greyscale intensity of an LED in the ON state. The
- * intensity is a value from 0 (fully off) to 255 (fully on).
- * This will take effect on any future LED set or clear
- * operations.
- *
- * @param intensity a value from 0 (fully off) to 255 (fully on)
- */
- void setHighIntensityValue(int intensity);
-
- /**
- * Set all of the LEDS to the ON (high intensity value) state.
- */
- void setAll();
-
- /**
- * Set all of the LEDS to the OFF (low intensity value) state.
- */
- void clearAll();
-
- /**
- * Set the LED states to match the internal stored states. This
- * is useful when auto refresh (setAutoRefresh()) is false to
- * update the display.
- */
- void refresh();
-
- protected:
- virtual void lockData();
- virtual void send16bitBlock(uint16_t data);
-
- bool m_autoRefresh;
- // we're only doing 8-bit greyscale, so the high order bits are
- // always 0
- uint16_t m_lowIntensity;
- uint16_t m_highIntensity;
-
- unsigned int m_instances;
-
- // an array of uint16_t's representing our bit states (on/off)
- // intensities. Only the low 8 bits are used, but in the future
- // 16bit support can work here as well.
- uint16_t *m_bitStates;
-
- uint16_t m_commandWord;
-
- mraa::Gpio m_gpioClk;
- mraa::Gpio m_gpioData;
-
- private:
- };
-
-}
diff --git a/peripheral/libupm/src/my9221/pyupm_my9221.i b/peripheral/libupm/src/my9221/pyupm_my9221.i
deleted file mode 100644
index ee9422a..0000000
--- a/peripheral/libupm/src/my9221/pyupm_my9221.i
+++ /dev/null
@@ -1,21 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_my9221
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "my9221.h"
-%{
- #include "my9221.h"
-%}
-
-%include "groveledbar.h"
-%{
- #include "groveledbar.h"
-%}
-
-%include "grovecircularled.h"
-%{
- #include "grovecircularled.h"
-%}
diff --git a/peripheral/libupm/src/nlgpio16/CMakeLists.txt b/peripheral/libupm/src/nlgpio16/CMakeLists.txt
deleted file mode 100644
index 585c781..0000000
--- a/peripheral/libupm/src/nlgpio16/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "nlgpio16")
-set (libdescription "upm module for the Numato Labs GPIO 16 USB")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/nlgpio16/javaupm_nlgpio16.i b/peripheral/libupm/src/nlgpio16/javaupm_nlgpio16.i
deleted file mode 100644
index 481df82..0000000
--- a/peripheral/libupm/src/nlgpio16/javaupm_nlgpio16.i
+++ /dev/null
@@ -1,22 +0,0 @@
-%module javaupm_nlgpio16
-%include "../upm.i"
-%include "carrays.i"
-%include "std_string.i"
-
-%{
- #include "nlgpio16.h"
-%}
-
-%include "nlgpio16.h"
-%array_class(char, charArray);
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_nlgpio16");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%}
diff --git a/peripheral/libupm/src/nlgpio16/jsupm_nlgpio16.i b/peripheral/libupm/src/nlgpio16/jsupm_nlgpio16.i
deleted file mode 100644
index d44e4d9..0000000
--- a/peripheral/libupm/src/nlgpio16/jsupm_nlgpio16.i
+++ /dev/null
@@ -1,11 +0,0 @@
-%module jsupm_nlgpio16
-%include "../upm.i"
-%include "carrays.i"
-%include "std_string.i"
-
-%{
- #include "nlgpio16.h"
-%}
-
-%include "nlgpio16.h"
-%array_class(char, charArray);
diff --git a/peripheral/libupm/src/nlgpio16/nlgpio16.cxx b/peripheral/libupm/src/nlgpio16/nlgpio16.cxx
deleted file mode 100644
index 591dece..0000000
--- a/peripheral/libupm/src/nlgpio16/nlgpio16.cxx
+++ /dev/null
@@ -1,344 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <time.h>
-
-#include "nlgpio16.h"
-
-using namespace upm;
-using namespace std;
-
-static const int maxBuffer = 1024;
-static const int baudRate = 115200;
-
-static char num2Hex(int i, bool upcase)
-{
- char temp;
-
- switch (i)
- {
- case 0: return '0';
- case 1: return '1';
- case 2: return '2';
- case 3: return '3';
- case 4: return '4';
- case 5: return '5';
- case 6: return '6';
- case 7: return '7';
- case 8: return '8';
- case 9: return '9';
- case 10: temp = (upcase) ? 'A' : 'a'; return temp;
- case 11: temp = (upcase) ? 'B' : 'b'; return temp;
- case 12: temp = (upcase) ? 'C' : 'c'; return temp;
- case 13: temp = (upcase) ? 'D' : 'd'; return temp;
- case 14: temp = (upcase) ? 'E' : 'e'; return temp;
- case 15: temp = (upcase) ? 'F' : 'f'; return temp;
-
- default:
- throw std::out_of_range(std::string(__FUNCTION__) +
- ": number must be between 0 and 15");
- return '0';
- }
-}
-
-NLGPIO16::NLGPIO16(string uart) :
- m_uart(uart)
-{
- m_uart.setBaudRate(baudRate);
-}
-
-NLGPIO16::~NLGPIO16()
-{
-}
-
-bool NLGPIO16::dataAvailable(unsigned int millis)
-{
- return m_uart.dataAvailable(millis);
-}
-
-std::string NLGPIO16::readStr(int len)
-{
- return m_uart.readStr(len);
-}
-
-int NLGPIO16::writeStr(std::string data)
-{
- m_uart.flush();
- return m_uart.writeStr(data);
-}
-
-string NLGPIO16::sendCommand(string cmd)
-{
- // make sure we got a command
- if (cmd.empty())
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": cmd is empty!");
- return "";
- }
-
- // make sure string is CR terminated
- if (cmd.at(cmd.size() - 1) != '\r')
- cmd.append("\r");
-
- writeStr(cmd);
-
- string resp;
- while (dataAvailable(10))
- {
- resp += readStr(maxBuffer);
- }
-
- if (resp.empty())
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": timed out waiting for response");
- return "";
- }
-
- // check that the last character is the prompt
- if (resp.at(resp.size() - 1) != '>')
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": read from device corrupted");
- return "";
- }
-
- // delete the last 3 characters, which should be '\n\r>'
- resp.erase(resp.size() - 3, 3);
-
- // find first delimeter (second should already be erased)
- size_t pos = resp.find("\n\r");
-
- // if we didn't find one, then the command was invalid. This
- // shouldn't happen, but we check for it anyway
- if (pos == string::npos)
- return "";
-
- pos += 2; // skip past them.
-
- // now we should have the value (or an empty string in the case of a
- // write command). Erase everything else and return the result.
- resp.erase(0, pos);
-
- return resp;
-}
-
-void NLGPIO16::gpioSet(int gpio)
-{
- if (gpio < 0 || gpio > 15)
- {
- throw std::out_of_range(std::string(__FUNCTION__) +
- ": gpio must be between 0 and 15");
- return;
- }
-
- string cmd("gpio set ");
- cmd += num2Hex(gpio, true);
-
- // set commands don't return anything useful
- sendCommand(cmd);
- return;
-}
-
-void NLGPIO16::gpioClear(int gpio)
-{
- if (gpio < 0 || gpio > 15)
- {
- throw std::out_of_range(std::string(__FUNCTION__) +
- ": gpio must be between 0 and 15");
- return;
- }
-
- string cmd("gpio clear ");
- cmd += num2Hex(gpio, true);
-
- // set commands don't return anything useful
- sendCommand(cmd);
- return;
-}
-
-bool NLGPIO16::gpioRead(int gpio)
-{
- if (gpio < 0 || gpio > 15)
- {
- throw std::out_of_range(std::string(__FUNCTION__) +
- ": gpio must be between 0 and 15");
- return false;
- }
-
- string cmd("gpio read ");
- cmd += num2Hex(gpio, true);
-
- string resp = sendCommand(cmd);
- if (resp.empty())
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": invalid empty response from device");
- return false;
- }
-
- // c++11 toString() would be handy...
- return ( (atoi(resp.c_str()) == 0) ? false : true );
-}
-
-unsigned int NLGPIO16::gpioReadAll()
-{
- string cmd("gpio readall");
-
- string resp = sendCommand(cmd);
- if (resp.empty())
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": invalid empty response from device");
- return false;
- }
-
- // Convert to unsigned int (but mask out everything but the lower 16bits)
- unsigned int value = strtoul(resp.c_str(), NULL, 16);
- value &= 0xffff;
-
- return value;
-}
-
-void NLGPIO16::gpioSetIOMask(int mask)
-{
- if (mask < 0 || mask > 65535)
- {
- throw std::out_of_range(std::string(__FUNCTION__) +
- ": mask must be between 0 and 65535");
- return;
- }
-
- string cmd("gpio iomask ");
- cmd += num2Hex( ((mask & 0xf000) >> 12), false);
- cmd += num2Hex( ((mask & 0x0f00) >> 8), false);
- cmd += num2Hex( ((mask & 0x00f0) >> 4), false);
- cmd += num2Hex( ((mask & 0x000f) >> 0), false);
-
- sendCommand(cmd);
-
- return;
-}
-
-void NLGPIO16::gpioSetIODir(int mask)
-{
- if (mask < 0 || mask > 65535)
- {
- throw std::out_of_range(std::string(__FUNCTION__) +
- ": mask must be between 0 and 65535");
- return;
- }
-
- string cmd("gpio iodir ");
- cmd += num2Hex( ((mask & 0xf000) >> 12), false);
- cmd += num2Hex( ((mask & 0x0f00) >> 8), false);
- cmd += num2Hex( ((mask & 0x00f0) >> 4), false);
- cmd += num2Hex( ((mask & 0x000f) >> 0), false);
-
- sendCommand(cmd);
-
- return;
-}
-
-void NLGPIO16::gpioWriteAll(int mask)
-{
- if (mask < 0 || mask > 65535)
- {
- throw std::out_of_range(std::string(__FUNCTION__) +
- ": mask must be between 0 and 65535");
- return;
- }
-
- string cmd("gpio writeall ");
- cmd += num2Hex( ((mask & 0xf000) >> 12), false);
- cmd += num2Hex( ((mask & 0x0f00) >> 8), false);
- cmd += num2Hex( ((mask & 0x00f0) >> 4), false);
- cmd += num2Hex( ((mask & 0x000f) >> 0), false);
-
- sendCommand(cmd);
-
- return;
-}
-
-string NLGPIO16::getVersion()
-{
- return sendCommand("vers");
-}
-
-string NLGPIO16::getID()
-{
- return sendCommand("id get");
-}
-
-void NLGPIO16::setID(string id)
-{
- if (id.size() != 8)
- {
- throw std::out_of_range(std::string(__FUNCTION__) +
- ": ID must be exactly 8 characters in length");
- return;
- }
-
- string cmd("id set ");
- cmd += id;
-
- sendCommand(cmd);
-
- return;
-}
-
-int NLGPIO16::analogReadValue(int adc)
-{
- // Only ports 0-6 are ADC capable
- if (adc < 0 || adc > 6)
- {
- throw std::out_of_range(std::string(__FUNCTION__) +
- ": adc must be between 0 and 6");
- return false;
- }
-
- string cmd("adc read ");
- cmd += num2Hex(adc, true);
-
- string resp = sendCommand(cmd);
- if (resp.empty())
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": invalid empty response from device");
- return false;
- }
-
- // c++11 stoi() would be handy...
- return atoi(resp.c_str());
-}
-
-float NLGPIO16::analogReadVolts(int adc)
-{
- float value = float(analogReadValue(adc));
-
- return ( value * (ADC_AREF / float(1 << ADC_PRECISION)) );
-}
-
diff --git a/peripheral/libupm/src/nlgpio16/nlgpio16.h b/peripheral/libupm/src/nlgpio16/nlgpio16.h
deleted file mode 100644
index 4070690..0000000
--- a/peripheral/libupm/src/nlgpio16/nlgpio16.h
+++ /dev/null
@@ -1,239 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Thanks to Adafruit for supplying a google translated version of the
- * Chinese datasheet and some clues in their code.
- *
- * 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 <string>
-#include <iostream>
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-
-#include <mraa/common.hpp>
-#include <mraa/uart.hpp>
-
-#define NLGPIO16_DEFAULT_UART_DEV "/dev/ttyACM0"
-
-// ADC analog ref voltage is 3.3v
-#define ADC_AREF 3.3
-
-// 10-bit precision (0-1023)
-#define ADC_PRECISION 10
-
-namespace upm {
- /**
- * @brief NLGPIO16 module
- * @defgroup nlgpio16 libupm-nlgpio16
- * @ingroup sparkfun uart gpio ainput
- */
-
- /**
- * @library nlgpio16
- * @sensor nlgpio16
- * @comname NLGPIO16 16 channel USB GPIO Module
- * @type other
- * @man numatolabs
- * @con uart
- * @web http://numato.com/16-channel-usb-gpio-module-with-analog-inputs/
- *
- * @brief API for the NLGPIO16 16 channel USB GPIO Module
- *
- * The NLGPIO16 is a USB adapter providing access to 16 GPIO's, 7
- * of which can be used as analog inputs. The GPIO's are 3.3v
- * only. An external power supply can be connected to provide
- * more current if the need arises.
- *
- * It is recommended to use a series resistor with the GPIO/ADC
- * pins when interfacing with other circuits. In output mode,
- * GPIOs can source up to 8mA (gpio8-gpio15). So no additional
- * circuitry is needed to drive regular LEDs. A 470 Ohms series
- * resistor is recommended for current limiting when connecting an
- * LED to a GPIO. In contrast to GPIOs, analog inputs can read
- * voltages at any level between 0 to 3.3V volts. It is
- * recommended to use a series resistor to protect the input from
- * stray voltages and spikes. The internal Analog to Digital
- * converter supports 10 bits resolution which is adequate for
- * most applications.
- *
- * Maximum IO source/sink current on GPIO 0-7 is 2mA
- * Maximum IO source/sink current on GPIO 8-15 is 8mA
- *
- * @snippet nlgpio16.cxx Interesting
- */
-
- class NLGPIO16 {
- public:
-
- /**
- * NLGPIO16 object constructor
- *
- * @param uart UART device path to use. Default is /dev/ttyACM0.
- */
- NLGPIO16(std::string uart=NLGPIO16_DEFAULT_UART_DEV);
-
- /**
- * NLGPIO16 object destructor
- */
- ~NLGPIO16();
-
- /**
- * Get the version of the device
- *
- * @return String containing device revision
- */
- std::string getVersion();
-
- /**
- * Get the device ID. The device ID is an 8 character
- * alpha-numeric string.
- *
- * @return String containing device ID
- */
- std::string getID();
-
- /**
- * Set the device ID. The device ID is an 8 character
- * alpha-numeric string. The supplied ID must be exactly 8
- * characters in length.
- *
- * @param id String containing a new 8 character device ID
- */
- void setID(std::string id);
-
- /**
- * Set a gpio output to the HIGH (1) state. The gpio is
- * automatically set as an output when this call is made,
- * regardless of it's previous mode.
- *
- * @param gpio The gpio to set. Valid values are between 0-15
- */
- void gpioSet(int gpio);
-
- /**
- * Set a gpio output to the LOW (0) state. The gpio is
- * automatically set as an output when this call is made,
- * regardless of it's previous mode.
- *
- * @param gpio The gpio to clear. Valid values are between 0-15
- */
- void gpioClear(int gpio);
-
- /**
- * Read the state of a gpio. The gpio is automatically set as an
- * input when this call is made, regardless of it's previous
- * mode.
- *
- * @param gpio The gpio to read. Valid values are between 0-15
- * @return true if the gpio is in the HIGH state, false otherwise
- */
- bool gpioRead(int gpio);
-
- /**
- * Read the state of all gpios. The returned integer is a bitmask
- * of all 16 gpios, where a 0 bit means the gpio is in the LOW
- * state, whereas a 1 bit means the gpio is in a HIGH state.
- *
- * @return bitmask of the state of all 16 gpios. The LSB is gpio0.
- */
- unsigned int gpioReadAll();
-
- /**
- * Set a mask for selectively updating multiple gpios with the
- * gpioIODir() and gpioWriteAll() methods. Each bit set in the 16
- * bit argument (LSB = gpio0) represents whether the two previously
- * mentioned methods will act on a given gpio or not. A 0 in a
- * given bit position will cause any update to that gpio via
- * gpioIODir() and gpioWriteAll() to be ignored, while a 1 bit
- * enables that gpio to be affected by those two methods.
- *
- * @param mask A bitmask of the 16 gpios affected by gpioIODir() and
- * gpioWriteAll()
- */
- void gpioSetIOMask(int mask);
-
- /**
- * Set the driection mode (input or output) for all gpios enabled
- * by gpioSetIOMask(). A 0 in a given bit postion (LSB = gpio0)
- * configures the gpio as an ouput, and a 1 bit configures the
- * gpio as an input. Only the gpios enabled by gpioSetMask() are
- * affected by this call.
- *
- * @param mask A bitmask of the 16 gpios whose direction mode is
- * to be set
- */
- void gpioSetIODir(int mask);
-
- /**
- * Write all enabled gpios (set via gpioSetIOMask()) to a given
- * value. A 1 bit (LSB = gpio0) sets the given output to HIGH, a
- * zero sets the given output to LOW. Only the gpios enabled by
- * gpioSetMask() are affected by this call.
- *
- * @param mask The values to set for the 16 gpios (LSB = gpio0)
- */
- void gpioWriteAll(int mask);
-
- /**
- * Read the raw analog input value present at the given gpio. The
- * gpio is switched to analog input mode by this call, regardless of
- * any previous mode. The returned value will be a number between
- * 0-1023 (10 bit resolution). Only the first 7 gpios (0-6) can be
- * used for analog input.
- *
- * @param adc The gpio number to read (0-6)
- * @return The raw integer value from the ADC (0-1023)
- */
- int analogReadValue(int adc);
-
- /**
- * Read the raw analog input value present at the given gpio and
- * return the coresponding voltage value at the pin. The gpio is
- * switched to analog input mode by this call, regardless of any
- * previous mode. The returned value will be a number between
- * 0.0-3.3, depending on the voltage present at the pin. Only the
- * first 7 gpios (0-6) can be used for analog input.
- *
- * @param adc The gpio number to read (0-6)
- * @return The voltage present at the pin
- */
- float analogReadVolts(int adc);
-
-
- protected:
- mraa::Uart m_uart;
-
- // UART helpers
- bool dataAvailable(unsigned int millis);
- std::string readStr(int len);
- int writeStr(std::string data);
-
- // does most of the work for sending commands and getting responses
- std::string sendCommand(std::string cmd);
-
- private:
- };
-}
diff --git a/peripheral/libupm/src/nlgpio16/pyupm_nlgpio16.i b/peripheral/libupm/src/nlgpio16/pyupm_nlgpio16.i
deleted file mode 100644
index e268375..0000000
--- a/peripheral/libupm/src/nlgpio16/pyupm_nlgpio16.i
+++ /dev/null
@@ -1,14 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_nlgpio16
-%include "../upm.i"
-%include "carrays.i"
-%include "std_string.i"
-
-%feature("autodoc", "3");
-
-%{
- #include "nlgpio16.h"
-%}
-%include "nlgpio16.h"
-%array_class(char, charArray);
diff --git a/peripheral/libupm/src/nodeswig_blacklist b/peripheral/libupm/src/nodeswig_blacklist
deleted file mode 100644
index e69de29..0000000
--- a/peripheral/libupm/src/nodeswig_blacklist
+++ /dev/null
diff --git a/peripheral/libupm/src/nrf24l01/CMakeLists.txt b/peripheral/libupm/src/nrf24l01/CMakeLists.txt
deleted file mode 100644
index 538d3a1..0000000
--- a/peripheral/libupm/src/nrf24l01/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "nrf24l01")
-set (libdescription "libupm NRF tx/rx")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/nrf24l01/Callback.h b/peripheral/libupm/src/nrf24l01/Callback.h
deleted file mode 100644
index 3e0cd96..0000000
--- a/peripheral/libupm/src/nrf24l01/Callback.h
+++ /dev/null
@@ -1,22 +0,0 @@
-#pragma once
-
-#if defined(SWIGJAVA) || defined(JAVACALLBACK)
-class Callback
-{
- public:
- virtual ~Callback()
- {
- }
- virtual void run()
- { /* empty, overloaded in Java*/
- }
-};
-
-
-static void generic_callback (Callback* callback)
-{
- if (callback == NULL)
- return;
- callback->run();
-}
-#endif
diff --git a/peripheral/libupm/src/nrf24l01/javaupm_nrf24l01.i b/peripheral/libupm/src/nrf24l01/javaupm_nrf24l01.i
deleted file mode 100644
index a78cbc3..0000000
--- a/peripheral/libupm/src/nrf24l01/javaupm_nrf24l01.i
+++ /dev/null
@@ -1,26 +0,0 @@
-%module(directors="1") javaupm_nrf24l01
-%include "../upm.i"
-
-%feature("director") Callback;
-SWIG_DIRECTOR_OWNED(Callback)
-
-%include "arrays_java.i";
-%apply signed char[] {uint8_t *};
-
-%include "Callback.h"
-%{
- #include "nrf24l01.h"
-%}
-
-%include "nrf24l01.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_nrf24l01");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/nrf24l01/jsupm_nrf24l01.i b/peripheral/libupm/src/nrf24l01/jsupm_nrf24l01.i
deleted file mode 100644
index 2be49ab..0000000
--- a/peripheral/libupm/src/nrf24l01/jsupm_nrf24l01.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_nrf24l01
-%include "../upm.i"
-
-%{
- #include "nrf24l01.h"
-%}
-
-%include "nrf24l01.h"
diff --git a/peripheral/libupm/src/nrf24l01/nrf24l01.cxx b/peripheral/libupm/src/nrf24l01/nrf24l01.cxx
deleted file mode 100644
index 1b8b702..0000000
--- a/peripheral/libupm/src/nrf24l01/nrf24l01.cxx
+++ /dev/null
@@ -1,535 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- * BLE Beaconing based on http://dmitry.gr/index.php?r=05.Projects&proj=11.%20Bluetooth%20LE%20fakery
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <unistd.h>
-#include <string>
-#include <stdexcept>
-#include <stdlib.h>
-
-#include "nrf24l01.h"
-
-using namespace upm;
-
-
-NRF24L01::NRF24L01 (uint8_t cs, uint8_t ce)
- : m_csnPinCtx(cs), m_cePinCtx(ce), m_spi(0)
-{
- init (cs, ce);
-}
-
-void
-NRF24L01::init (uint8_t chip_select, uint8_t chip_enable) {
- mraa::Result error = mraa::SUCCESS;
-
- m_csn = chip_select;
- m_ce = chip_enable;
- m_channel = 99;
-
- error = m_csnPinCtx.dir(mraa::DIR_OUT);
- if (error != mraa::SUCCESS) {
- mraa::printError (error);
- }
-
- error = m_cePinCtx.dir(mraa::DIR_OUT);
- if (error != mraa::SUCCESS) {
- mraa::printError (error);
- }
-
- ceLow();
- csOff ();
-}
-
-void
-NRF24L01::configure () {
- /* Set RF channel */
- setRegister (RF_CH, m_channel);
-
- /* Set length of incoming payload */
- setRegister (RX_PW_P0, m_payload);
-
- /* Set length of incoming payload for broadcast */
- setRegister (RX_PW_P1, m_payload);
-
- /* Start receiver */
- rxPowerUp ();
- rxFlushBuffer ();
-}
-
-void
-NRF24L01::send (uint8_t * value) {
- uint8_t status;
- status = getStatus();
-
- while (m_ptx) {
- status = getStatus();
-
- if((status & ((1 << TX_DS) | (1 << MAX_RT)))){
- m_ptx = 0;
- break;
- }
- } // Wait until last paket is send
-
- ceLow ();
- txPowerUp (); // Set to transmitter mode , Power up
- txFlushBuffer ();
-
- csOn ();
- m_spi.writeByte(W_TX_PAYLOAD); // Write cmd to write payload
- writeBytes (value, NULL, m_payload); // Write payload
- csOff ();
- ceHigh(); // Start transmission
-
- while (dataSending ()) { }
-
- usleep (10000);
-}
-
-void
-NRF24L01::send () {
- send (m_txBuffer);
-}
-
-void
-NRF24L01::setSourceAddress (uint8_t * addr) {
- ceLow ();
- writeRegister (RX_ADDR_P0, addr, ADDR_LEN);
- ceHigh ();
-}
-
-void
-NRF24L01::setDestinationAddress (uint8_t * addr) {
- writeRegister (TX_ADDR, addr, ADDR_LEN);
-}
-
-void
-NRF24L01::setBroadcastAddress (uint8_t * addr) {
- writeRegister (RX_ADDR_P1, addr, ADDR_LEN);
-}
-
-void
-NRF24L01::setPayload (uint8_t payload) {
- m_payload = payload;
-}
-
-#ifdef JAVACALLBACK
-void
-NRF24L01::setDataReceivedHandler (Callback *call_obj)
-{
- callback_obj = call_obj;
- dataReceivedHandler = &generic_callback;
-}
-#else
-void
-NRF24L01::setDataReceivedHandler (funcPtrVoidVoid handler)
-{
- dataReceivedHandler = handler;
-}
-#endif
-
-bool
-NRF24L01::dataReady () {
- /* See note in getData() function - just checking RX_DR isn't good enough */
- uint8_t status = getStatus();
- /* We can short circuit on RX_DR, but if it's not set, we still need
- * to check the FIFO for any pending packets */
- if ( status & (1 << RX_DR) ) {
- return 1;
- }
-
- return !rxFifoEmpty();
-}
-
-bool
-NRF24L01::dataSending () {
- uint8_t status;
- if(m_ptx) { // Sending mode.
- status = getStatus();
- /* if sending successful (TX_DS) or max retries exceded (MAX_RT). */
- if((status & ((1 << TX_DS) | (1 << MAX_RT)))){
- rxPowerUp ();
- return false;
- }
- return true;
- }
- return false;
-}
-
-void
-NRF24L01::getData (uint8_t * data) {
- csOn ();
- /* Send cmd to read rx payload */
- m_spi.writeByte(R_RX_PAYLOAD);
- /* Read payload */
- writeBytes (data, data, m_payload);
- csOff ();
- /* NVI: per product spec, p 67, note c:
- * "The RX_DR IRQ is asserted by a new packet arrival event. The procedure
- * for handling this interrupt should be: 1) read payload through SPI,
- * 2) clear RX_DR IRQ, 3) read FIFO_STATUS to check if there are more
- * payloads available in RX FIFO, 4) if there are more data in RX FIFO,
- * repeat from step 1)."
- * So if we're going to clear RX_DR here, we need to check the RX FIFO
- * in the dataReady() function */
- /* Reset status register */
- setRegister (STATUS, (1<<RX_DR));
-}
-
-uint8_t
-NRF24L01::getStatus() {
- return getRegister (STATUS);
-}
-
-bool
-NRF24L01::rxFifoEmpty () {
- uint8_t fifoStatus = getRegister (FIFO_STATUS);
- return (fifoStatus & (1 << RX_EMPTY));
-}
-
-void
-NRF24L01::rxPowerUp () {
- m_ptx = 0;
- ceLow ();
- setRegister (CONFIG, _CONFIG | ( (1 << PWR_UP) | (1 << PRIM_RX) ));
- ceHigh ();
- setRegister (STATUS, (1 << TX_DS) | (1 << MAX_RT));
-}
-
-void
-NRF24L01::rxFlushBuffer () {
- sendCommand (FLUSH_RX);
-}
-
-void
-NRF24L01::txPowerUp () {
- m_ptx = 1;
- setRegister (CONFIG, _CONFIG | ( (1 << PWR_UP) | (0 << PRIM_RX) ));
-}
-
-void
-NRF24L01::powerDown(){
- ceLow ();
- setRegister (CONFIG, _CONFIG);
-}
-
-void
-NRF24L01::setChannel (uint8_t channel) {
- m_channel = channel;
- setRegister (RF_CH, channel);
-}
-
-void
-NRF24L01::setPower (power_t power) {
- uint8_t setupRegisterData = 0;
-
- switch (power) {
- case NRF_0DBM:
- m_power = 3;
- break;
- case NRF_6DBM:
- m_power = 2;
- break;
- case NRF_12DBM:
- m_power = 1;
- break;
- case NRF_18DBM:
- m_power = 0;
- break;
- }
-
- setupRegisterData = getRegister (RF_SETUP); // Read current value.
- setupRegisterData &= 0xFC; // Erase the old value;
- setupRegisterData |= (m_power & 0x3);
- setRegister (RF_SETUP, setupRegisterData); // Write the new value.
-}
-
-uint8_t
-NRF24L01::setSpeedRate (speed_rate_t rate) {
- uint8_t setupRegisterData = 0;
-
- setupRegisterData = getRegister (RF_SETUP); // Read current value.
- setupRegisterData &= ~((1 << RF_DR_LOW) | (1 << RF_DR_HIGH));
-
- switch (rate) {
- case NRF_250KBPS:
- setupRegisterData |= (1 << RF_DR_LOW) ;
- break;
- case NRF_1MBPS:
- break;
- case NRF_2MBPS:
- setupRegisterData |= (1 << RF_DR_HIGH);
- break;
- }
-
- setRegister (RF_SETUP, setupRegisterData); // Write the new value.
-
- if (setupRegisterData == getRegister (RF_SETUP)) {
- return 0x0;
- }
-
- return 0x1;
-}
-
-mraa::Result
-NRF24L01::ceHigh () {
- return m_cePinCtx.write(HIGH);
-}
-
-mraa::Result
-NRF24L01::ceLow () {
- return m_cePinCtx.write(LOW);
-}
-
-mraa::Result
-NRF24L01::csOn () {
- return m_csnPinCtx.write(LOW);
-}
-
-mraa::Result
-NRF24L01::csOff () {
- return m_csnPinCtx.write(HIGH);
-}
-
-void
-NRF24L01::pollListener() {
- if (dataReady()) {
- getData (m_rxBuffer);
-#ifdef JAVACALLBACK
- dataReceivedHandler (callback_obj); /* let know that data arrived */
-#else
- dataReceivedHandler (); /* let know that data arrived */
-#endif
- }
-}
-
-void
-NRF24L01::txFlushBuffer () {
- sendCommand (FLUSH_TX);
-}
-
-void
-NRF24L01::setBeaconingMode () {
- setRegister (CONFIG, 0x12); // on, no crc, int on RX/TX done
- setRegister (EN_AA, 0x00); // no auto-acknowledge
- setRegister (EN_RXADDR, 0x00); // no RX
- setRegister (SETUP_AW, 0x02); // 5-byte address
- setRegister (SETUP_RETR, 0x00); // no auto-retransmit
- setRegister (RF_SETUP, 0x06); // 1MBps at 0dBm
- setRegister (STATUS, 0x3E); // clear various flags
- setRegister (DYNPD, 0x00); // no dynamic payloads
- setRegister (FEATURE, 0x00); // no features
- setRegister (RX_PW_P0, 32); // always RX 32 bytes
- setRegister (EN_RXADDR, 0x01); // RX on pipe 0
-
- uint8_t addr[4] = { swapbits(0x8E), swapbits(0x89), swapbits(0xBE), swapbits(0xD6)};
- writeRegister (TX_ADDR, addr, 4);
- writeRegister (RX_ADDR_P0, addr, 4);
-
- uint8_t index = 0;
- m_bleBuffer[index++] = 0x42; // PDU type, given address is random
- m_bleBuffer[index++] = 0x1B; // 6+3+2+16 = 27 bytes of payload
-
- m_bleBuffer[index++] = BLE_MAC_0;
- m_bleBuffer[index++] = BLE_MAC_1;
- m_bleBuffer[index++] = BLE_MAC_2;
- m_bleBuffer[index++] = BLE_MAC_3;
- m_bleBuffer[index++] = BLE_MAC_4;
- m_bleBuffer[index++] = BLE_MAC_5;
-
- m_bleBuffer[index++] = 2; // flags (LE-only, limited discovery mode)
- m_bleBuffer[index++] = 0x01;
- m_bleBuffer[index++] = 0x05;
-
- m_bleBuffer[index++] = 17;
- m_bleBuffer[index++] = 0x08;
-}
-
-void
-NRF24L01::sendBeaconingMsg (uint8_t * msg) {
- const uint8_t chRf[] = {2, 26,80};
- const uint8_t chLe[] = {37,38,39};
- uint8_t index = BLE_PAYLOAD_OFFSET + 16;
-
- memcpy (&m_bleBuffer[BLE_PAYLOAD_OFFSET], msg, 16);
- m_bleBuffer[index++] = 0x55;
- m_bleBuffer[index++] = 0x55;
- m_bleBuffer[index++] = 0x55;
-
- uint8_t channel = 0;
- while (++channel != sizeof(chRf)) {
- setRegister (RF_CH, chRf[channel]);
- setRegister (STATUS, 0x6E); //clear flags
-
- blePacketEncode (m_bleBuffer, index, chLe[channel]);
-
- sendCommand (FLUSH_TX); // Clear RX Fifo
- sendCommand (FLUSH_RX); // Clear TX Fifo
-
- csOn ();
- m_spi.writeByte(W_TX_PAYLOAD); // Write cmd to write payload
- writeBytes (m_bleBuffer, NULL, 32); // Write payload
- csOff ();
-
- setRegister (CONFIG, 0x12); // tx on
- ceHigh (); // Start transmission
- usleep (10000);
- ceLow ();
- }
-}
-
-/*
- * ---------------
- * PRIVATE SECTION
- * ---------------
- */
-
-void
-NRF24L01::writeBytes (uint8_t * dataout, uint8_t * datain, uint8_t len) {
- if(len > MAX_BUFFER){
- len = MAX_BUFFER;
- }
- for (uint8_t i = 0; i < len; i++) {
- if (datain != NULL) {
- datain[i] = m_spi.writeByte(dataout[i]);
- } else {
- m_spi.writeByte(dataout[i]);
- }
- }
-}
-
-void
-NRF24L01::setRegister (uint8_t reg, uint8_t value) {
- csOn ();
- m_spi.writeByte(W_REGISTER | (REGISTER_MASK & reg));
- m_spi.writeByte(value);
- csOff ();
-}
-
-uint8_t
-NRF24L01::getRegister (uint8_t reg) {
- uint8_t data = 0;
-
- csOn ();
- m_spi.writeByte(R_REGISTER | (REGISTER_MASK & reg));
- data = m_spi.writeByte(data);
- csOff ();
-
- return data;
-}
-
-void
-NRF24L01::readRegister (uint8_t reg, uint8_t * value, uint8_t len) {
- csOn ();
- m_spi.writeByte(R_REGISTER | (REGISTER_MASK & reg));
- writeBytes (value, value, len);
- csOff ();
-}
-
-void
-NRF24L01::writeRegister (uint8_t reg, uint8_t * value, uint8_t len) {
- csOn ();
- m_spi.writeByte(W_REGISTER | (REGISTER_MASK & reg));
- writeBytes (value, NULL, len);
- csOff ();
-}
-
-void
-NRF24L01::sendCommand (uint8_t cmd) {
- csOn ();
- m_spi.writeByte(cmd);
- csOff ();
-}
-
-void
-NRF24L01::bleCrc (const uint8_t* data, uint8_t len, uint8_t* dst) {
- uint8_t v, t, d;
- while(len--) {
- d = *data++;
- for(v = 0; v < 8; v++, d >>= 1){
- t = dst[0] >> 7;
- dst[0] <<= 1;
- if(dst[1] & 0x80) dst[0] |= 1;
- dst[1] <<= 1;
- if(dst[2] & 0x80) dst[1] |= 1;
- dst[2] <<= 1;
-
- if(t != (d & 1)) {
- dst[2] ^= 0x5B;
- dst[1] ^= 0x06;
- }
- }
- }
-}
-
-void
-NRF24L01::bleWhiten (uint8_t* data, uint8_t len, uint8_t whitenCoeff) {
- uint8_t m;
- while(len--) {
- for(m = 1; m; m <<= 1) {
- if(whitenCoeff & 0x80){
- whitenCoeff ^= 0x11;
- (*data) ^= m;
- }
- whitenCoeff <<= 1;
- }
- data++;
- }
-}
-
-void
-NRF24L01::blePacketEncode(uint8_t* packet, uint8_t len, uint8_t chan) {
- if(len > MAX_BUFFER){
- len = MAX_BUFFER;
- }
-
- //length is of packet, including crc. pre-populate crc in packet with initial crc value!
- uint8_t i, dataLen = len - 3;
-
- bleCrc(packet, dataLen, packet + dataLen);
- for(i = 0; i < 3; i++, dataLen++) {
- packet[dataLen] = swapbits(packet[dataLen]);
- }
-
- bleWhiten(packet, len, (swapbits(chan) | 2));
- for(i = 0; i < len; i++) {
- packet[i] = swapbits(packet[i]);
- }
-}
-
-uint8_t
-NRF24L01::swapbits(uint8_t a) {
- uint8_t v = 0;
-
- if(a & 0x80) v |= 0x01;
- if(a & 0x40) v |= 0x02;
- if(a & 0x20) v |= 0x04;
- if(a & 0x10) v |= 0x08;
- if(a & 0x08) v |= 0x10;
- if(a & 0x04) v |= 0x20;
- if(a & 0x02) v |= 0x40;
- if(a & 0x01) v |= 0x80;
-
- return v;
-}
diff --git a/peripheral/libupm/src/nrf24l01/nrf24l01.h b/peripheral/libupm/src/nrf24l01/nrf24l01.h
deleted file mode 100644
index 0a468b8..0000000
--- a/peripheral/libupm/src/nrf24l01/nrf24l01.h
+++ /dev/null
@@ -1,431 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- * BLE Beaconing based on http://dmitry.gr/index.php?r=05.Projects&proj=11.%20Bluetooth%20LE%20fakery
- *
- * 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 <string>
-#include <mraa/aio.hpp>
-#include <mraa/common.hpp>
-
-#include <mraa/gpio.hpp>
-
-#include <mraa/spi.hpp>
-#include <cstring>
-
-#if defined(SWIGJAVA) || defined(JAVACALLBACK)
-#include "Callback.h"
-#endif
-
-/* Memory Map */
-#define CONFIG 0x00
-#define EN_AA 0x01
-#define EN_RXADDR 0x02
-#define SETUP_AW 0x03
-#define SETUP_RETR 0x04
-#define RF_CH 0x05
-#define RF_SETUP 0x06
-#define STATUS 0x07
-#define OBSERVE_TX 0x08
-#define CD 0x09
-#define RX_ADDR_P0 0x0A
-#define RX_ADDR_P1 0x0B
-#define RX_ADDR_P2 0x0C
-#define RX_ADDR_P3 0x0D
-#define RX_ADDR_P4 0x0E
-#define RX_ADDR_P5 0x0F
-#define TX_ADDR 0x10
-#define RX_PW_P0 0x11
-#define RX_PW_P1 0x12
-#define RX_PW_P2 0x13
-#define RX_PW_P3 0x14
-#define RX_PW_P4 0x15
-#define RX_PW_P5 0x16
-#define FIFO_STATUS 0x17
-#define DYNPD 0x1C
-#define FEATURE 0x1D
-
-/* Bit Mnemonics */
-#define MASK_RX_DR 6
-#define MASK_TX_DS 5
-#define MASK_MAX_RT 4
-#define EN_CRC 3
-#define CRCO 2
-#define PWR_UP 1
-#define PRIM_RX 0
-#define ENAA_P5 5
-#define ENAA_P4 4
-#define ENAA_P3 3
-#define ENAA_P2 2
-#define ENAA_P1 1
-#define ENAA_P0 0
-#define ERX_P5 5
-#define ERX_P4 4
-#define ERX_P3 3
-#define ERX_P2 2
-#define ERX_P1 1
-#define ERX_P0 0
-#define AW 0
-#define ARD 4
-#define ARC 0
-#define PLL_LOCK 4
-#define RF_DR 3
-#define RF_PWR 1
-#define LNA_HCURR 0
-#define RX_DR 6
-#define TX_DS 5
-#define MAX_RT 4
-#define RX_P_NO 1
-#define TX_FULL 0
-#define PLOS_CNT 4
-#define ARC_CNT 0
-#define TX_REUSE 6
-#define FIFO_FULL 5
-#define TX_EMPTY 4
-#define RX_FULL 1
-#define RX_EMPTY 0
-
-/* Instruction Mnemonics */
-#define R_REGISTER 0x00
-#define W_REGISTER 0x20
-#define REGISTER_MASK 0x1F
-#define R_RX_PAYLOAD 0x61
-#define W_TX_PAYLOAD 0xA0
-#define FLUSH_TX 0xE1
-#define FLUSH_RX 0xE2
-#define REUSE_TX_PL 0xE3
-#define NOP 0xFF
-
-#define RF_DR_LOW 5
-#define RF_DR_HIGH 3
-#define RF_PWR_LOW 1
-#define RF_PWR_HIGH 2
-
-/* Nrf24l settings */
-#define ADDR_LEN 5
-#define _CONFIG ((1<<EN_CRC) | (0<<CRCO) )
-
-#define MAX_BUFFER 32
-
-#define HIGH 1
-#define LOW 0
-
-/* BLE beaconing */
-#define BLE_MAC_0 0xEF
-#define BLE_MAC_1 0xFF
-#define BLE_MAC_2 0xC0
-#define BLE_MAC_3 0xAA
-#define BLE_MAC_4 0x18
-#define BLE_MAC_5 0x00
-
-#define BLE_PAYLOAD_OFFSET 13
-
-namespace upm {
-
-#if defined(SWIGJAVA) || defined(JAVACALLBACK)
-typedef void (* funcPtrVoidVoid) (Callback *);
-#else
-typedef void (* funcPtrVoidVoid) ();
-#endif
-
-typedef enum {
- NRF_250KBPS = 0,
- NRF_1MBPS = 1,
- NRF_2MBPS = 2,
-} speed_rate_t;
-
-typedef enum {
- NRF_0DBM = 0,
- NRF_6DBM = 1,
- NRF_12DBM = 2,
- NRF_18DBM = 3,
-} power_t;
-
-/**
- * @brief NRF24L01 Transceiver library
- * @defgroup nrf24l01 libupm-nrf24l01
- * @ingroup seeed sparkfun spi wifi
- */
-/**
- * @library nrf24l01
- * @sensor nrf24l01
- * @comname NRF24L01 Transceiver
- * @type wifi
- * @man seeed sparkfun
- * @web http://www.seeedstudio.com/depot/nRF24L01Module-p-1394.html
- * @con spi
- *
- * id
- * @brief API for the NRF24L01 Transceiver Module
- *
- * This module defines the NRF24L01 interface for libnrf24l01
- *
- * @image html nrf24l01.jpg
- * @snippet nrf24l01-receiver.cxx Interesting
- * @snippet nrf24l01-transmitter.cxx Interesting
- * @snippet nrf24l01-broadcast.cxx Interesting
- */
-class NRF24L01 {
- public:
- /**
- * Instantiates an NRF24l01 object
- *
- * @param cs Chip select pin
- */
- NRF24L01 (uint8_t cs, uint8_t ce);
-
- /**
- * Returns the name of the component
- */
- std::string name()
- {
- return m_name;
- }
-
- /**
- * Initializes needed GPIO pins and SPI
- *
- * @param chipSelect Sets up the chip select pin
- * @param chipEnable Sets up the chip enable pin
- */
- void init (uint8_t chipSelect, uint8_t chipEnable);
-
- /**
- * Configures the NRF24L01 transceiver
- */
- void configure ();
-
- /**
- * Sends the buffer data
- *
- * @param *value Pointer to the buffer
- */
- void send (uint8_t * value);
-
- /**
- * Sends the data located in an inner bufer; the user must fill the
- * m_txBuffer buffer
- */
- void send ();
-
- /**
- * Sets a receiving address of the device
- *
- * @param addr 5-byte address
- */
- void setSourceAddress (uint8_t * addr);
-
- /**
- * Sets a recipient address. The nrfSend method sends the data buffer
- * to this address
- *
- * @param addr 5-byte address
- */
- void setDestinationAddress (uint8_t * addr);
-
- /**
- * Sets a broadcasting address
- *
- * @param addr 5-byte address
- */
- void setBroadcastAddress (uint8_t * addr);
-
- /**
- * Sets the payload size
- *
- * @param load Size of the payload (MAX 32)
- */
- void setPayload (uint8_t load);
-
-#if defined(SWIGJAVA) || defined(JAVACALLBACK)
- /**
- * Sets the handler to be called when data has been
- * received
- * @param call_obj Object used for callback - Java
- */
- void setDataReceivedHandler (Callback *call_obj);
-#else
- /**
- * Sets the handler to be called when data has been
- * received
- * @param handler Handler used for callback
- */
- void setDataReceivedHandler (funcPtrVoidVoid handler);
-#endif
- /**
- * Checks if the data has arrived
- */
- bool dataReady ();
-
- /**
- * Checks if the transceiver is in the sending mode
- */
- bool dataSending ();
-
- /**
- * Sinks all the arrived data into a provided buffer
- *
- * @param load Size of the payload (MAX 32)
- */
- void getData (uint8_t * data);
-
- /**
- * Checks the transceiver state
- */
- uint8_t getStatus ();
-
- /**
- * Checks if the receive stack is empty
- */
- bool rxFifoEmpty ();
-
- /**
- * Powers the receiver up
- */
- void rxPowerUp ();
-
- /**
- * Flushes the receive stack
- */
- void rxFlushBuffer ();
-
- /**
- * Powers the transmitter up
- */
- void txPowerUp ();
-
- /**
- * Powers everything down
- */
- void powerDown ();
-
- void setChannel (uint8_t channel);
-
- void setPower (power_t power);
-
- uint8_t setSpeedRate (speed_rate_t rate);
-
- /**
- * Flushes the transmit stack
- */
- void txFlushBuffer ();
-
- /**
- * Pulling the method listening for the arrived data,
- * dataRecievedHandler is triggered if data arrives
- */
- void pollListener ();
-
- /**
- * Sets the chip enable pin to HIGH
- */
- mraa::Result ceHigh ();
-
- /**
- * Sets the chip enable pin to LOW
- */
- mraa::Result ceLow ();
-
- /**
- * Sets the chip select pin to LOW
- */
- mraa::Result csOn ();
-
- /**
- * Sets the chip select pin to HIGH
- */
- mraa::Result csOff ();
-
- /**
- * Configures the NRF24L01 transceiver to behave as a BLE
- * (Bluetooth Low Energy) beaconing devcie.
- */
- void setBeaconingMode ();
-
- /**
- * Beacons the provided message to BLE scanners.
- *
- * @param msg Beacons the provided message (max length is 16 bytes)
- */
- void sendBeaconingMsg (uint8_t * msg);
-
- uint8_t m_rxBuffer[MAX_BUFFER]; /**< Receive buffer */
- uint8_t m_txBuffer[MAX_BUFFER]; /**< Transmit buffer */
- uint8_t m_bleBuffer [32]; /**< BLE buffer */
-
- private:
-#if defined(SWIGJAVA) || defined(JAVACALLBACK)
- /**< Callback object to use for setting the handler from Java */
- Callback *callback_obj;
-#endif
- funcPtrVoidVoid dataReceivedHandler; /**< Data arrived handler */
-
- /**
- * Writes bytes to an SPI device
- */
- void writeBytes (uint8_t * dataout, uint8_t * datain, uint8_t len);
- /**
- * Sets the register value on an SPI device [one byte]
- */
- void setRegister (uint8_t reg, uint8_t value);
- /**
- * Gets the register value from an SPI device [one byte]
- */
- uint8_t getRegister (uint8_t reg);
- /**
- * Reads an array of bytes from the given starting position in NRF24L01 registers
- */
- void readRegister (uint8_t reg, uint8_t * value, uint8_t len);
- /**
- * Writes an array of bytes into NRF24L01 registers
- */
- void writeRegister (uint8_t reg, uint8_t * value, uint8_t len);
- /**
- * Sends a command to NRF24L01
- */
- void sendCommand (uint8_t cmd);
-
- void bleCrc (const uint8_t* data, uint8_t len, uint8_t* dst);
-
- void bleWhiten (uint8_t* data, uint8_t len, uint8_t whitenCoeff);
-
- void blePacketEncode(uint8_t* packet, uint8_t len, uint8_t chan);
-
- uint8_t swapbits (uint8_t a);
-
- mraa::Spi m_spi;
- uint8_t m_ce;
- uint8_t m_csn;
- uint8_t m_channel;
- uint8_t m_power;
- uint8_t m_ptx;
- uint8_t m_payload;
- uint8_t m_localAddress[5];
-
- mraa::Gpio m_csnPinCtx;
- mraa::Gpio m_cePinCtx;
-
- std::string m_name;
-};
-
-}
diff --git a/peripheral/libupm/src/nrf24l01/pyupm_nrf24l01.i b/peripheral/libupm/src/nrf24l01/pyupm_nrf24l01.i
deleted file mode 100644
index 55d8f43..0000000
--- a/peripheral/libupm/src/nrf24l01/pyupm_nrf24l01.i
+++ /dev/null
@@ -1,11 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_nrf24l01
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "nrf24l01.h"
-%{
- #include "nrf24l01.h"
-%}
diff --git a/peripheral/libupm/src/nrf8001/CMakeLists.txt b/peripheral/libupm/src/nrf8001/CMakeLists.txt
deleted file mode 100644
index a449e44..0000000
--- a/peripheral/libupm/src/nrf8001/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "nrf8001")
-set (libdescription "BLE module from NordicSemiconductor family")
-set (module_src hal_aci_tl.cpp aci_setup.cpp aci_queue.cpp acilib.cpp lib_aci.cpp ${libname}.cxx)
-set (module_h hal_aci_tl.h aci_setup.h aci_queue.h acilib.h lib_aci.h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/nrf8001/aci.h b/peripheral/libupm/src/nrf8001/aci.h
deleted file mode 100644
index db67354..0000000
--- a/peripheral/libupm/src/nrf8001/aci.h
+++ /dev/null
@@ -1,672 +0,0 @@
-/* Copyright (c) 2014, Nordic Semiconductor ASA
- *
- * 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.
- */
-
-/**
- * @file
- * @ingroup aci
- */
-
-/**
- * @defgroup aci aci
- * @{
- * @ingroup aci-lib
- *
- * @brief Definitions for the ACI (Application Control Interface)
- * @remarks
- *
- * Flow control from application mcu to nRF8001
- *
- * Data flow control:
- * The flow control is credit based and the credit is initally given using the "device started" event.
- * A credit of more than 1 is given to the application mcu.
- * These credits are used only after the "ACI Connected Event" is sent to the application mcu.
- *
- * every send_data that is used decrements the credit available by 1. This is to be tracked by the application mcu.
- * When the credit available reaches 0, the application mcu shall not send any more send_data.
- * Credit is returned using the "credit event", this returned credit can then be used to send more send_data.
- * This flow control is not necessary and not available for Broadcast.
- * The entire credit available with the external mcu expires when a "disconnected" event arrives.
- *
- * Command flow control:
- * When a command is sent over the ACI, the next command shall not be sent until after a response
- * for the command sent has arrived.
- *
- */
-
-#ifndef ACI_H__
-#define ACI_H__
-
-/**
- * Define an _aci_packed_ macro we can use in structure and enumerated type
- * declarations so that the types are sized consistently across different
- * platforms. In particular Arduino platforms using the GCC compiler and the
- * Nordic processors using the Keil compiler.
- *
- * It's really the GNU compiler platforms that need a special keyword to get
- * tight packing of values. On GNU platforms we can use the keyword:
- * __attribute__((__packed__))
- * The thing is that while this keyword does the right thing with old and new
- * versions of the gcc (C) compiler it only works right with g++ (C++) compiler
- * versions that are version 4 or newer.
- */
-#ifdef __GNUC__
-# if __GNUC__ >= 4
-# define _aci_packed_ __attribute__((__packed__))
-# else
-# error "older g++ versions don't handle packed attribute in typedefs"
-# endif
-#else
-# define _aci_packed_
-#endif
-
-#include <stdint.h>
-#include <cstddef>
-#include <string.h>
-#include <unistd.h>
-
-/*
- * Define a macro that compares the size of the first parameter to the integer
- * value of the second parameter. If they do not match, a compile time error
- * for negative array size occurs (even gnu chokes on negative array size).
- *
- * This compare is done by creating a typedef for an array. No variables are
- * created and no memory is consumed with this check. The created type is
- * used for checking only and is not for use by any other code. The value
- * of 10 in this macro is arbitrary, it just needs to be a value larger
- * than one to result in a positive number for the array size.
- */
-#define ACI_ASSERT_SIZE(x,y) typedef char x ## _assert_size_t[-1+10*(sizeof(x) == (y))]
-
-/**
- * @def ACI_VERSION
- * @brief Current ACI protocol version. 0 means a device that is not yet released.
- * A numer greater than 0 refers to a specific ACI version documented and released.
- * The ACI consists of the ACI commands, ACI events and error codes.
- */
-#define ACI_VERSION (0x02)
-/**
- * @def BTLE_DEVICE_ADDRESS_SIZE
- * @brief Size in bytes of a Bluetooth Address
- */
-#define BTLE_DEVICE_ADDRESS_SIZE (6)
-/**
- * @def ACI_PACKET_MAX_LEN
- * @brief Maximum length in bytes of a full ACI packet, including length prefix, opcode and payload
- */
-#define ACI_PACKET_MAX_LEN (32)
-/**
- * @def ACI_ECHO_DATA_MAX_LEN
- * @brief Maximum length in bytes of the echo data portion
- */
-#define ACI_ECHO_DATA_MAX_LEN (ACI_PACKET_MAX_LEN - 3)
-/**
- * @def ACI_DEVICE_MAX_PIPES
- * @brief Maximum number of ACI pipes
- */
-#define ACI_DEVICE_MAX_PIPES (62)
-/**
- * @def ACI_PIPE_TX_DATA_MAX_LEN
- * @brief Maximum length in bytes of a transmission data pipe packet
- */
-#define ACI_PIPE_TX_DATA_MAX_LEN (20)
-/**
- * @def ACI_PIPE_RX_DATA_MAX_LEN
- * @brief Maximum length in bytes of a reception data pipe packet
- */
-#define ACI_PIPE_RX_DATA_MAX_LEN (22)
-/**
- * @def ACI_GAP_DEVNAME_MAX_LEN
- * @brief Maximum length in bytes of the GAP device name
- */
-#define ACI_GAP_DEVNAME_MAX_LEN (20)
-/**
- * @def ACI_AD_PACKET_MAX_LEN
- * @brief Maximum length in bytes of an AD packet
- */
-#define ACI_AD_PACKET_MAX_LEN (31)
-/**
- * @def ACI_AD_PACKET_MAX_USER_LEN
- * @brief Maximum usable length in bytes of an AD packet
- */
-#define ACI_AD_PACKET_MAX_USER_LEN (31 - 3)
-/**
- * @def ACI_PIPE_INVALID
- * @brief Invalid pipe number
- */
-#define ACI_PIPE_INVALID (0xFF)
-
-/**
- * @enum aci_pipe_store_t
- * @brief Storage type identifiers: local and remote
- */
-typedef enum
-{
- ACI_STORE_INVALID = 0x0,
- ACI_STORE_LOCAL= 0x01,
- ACI_STORE_REMOTE= 0x02
-} _aci_packed_ aci_pipe_store_t;
-
-/**
- * @enum aci_pipe_type_t
- * @brief Pipe types
- */
-typedef enum
-{
- ACI_TX_BROADCAST = 0x0001,
- ACI_TX = 0x0002,
- ACI_TX_ACK = 0x0004,
- ACI_RX = 0x0008,
- ACI_RX_ACK = 0x0010,
- ACI_TX_REQ = 0x0020,
- ACI_RX_REQ = 0x0040,
- ACI_SET = 0x0080,
- ACI_TX_SIGN = 0x0100,
- ACI_RX_SIGN = 0x0200,
- ACI_RX_ACK_AUTO = 0x0400
-} _aci_packed_ aci_pipe_type_t;
-
-ACI_ASSERT_SIZE(aci_pipe_type_t, 2);
-
-/**
- * @enum aci_bd_addr_type_t
- * @brief Bluetooth Address types
- */
-typedef enum
-{
- ACI_BD_ADDR_TYPE_INVALID = 0x00,
- ACI_BD_ADDR_TYPE_PUBLIC = 0x01,
- ACI_BD_ADDR_TYPE_RANDOM_STATIC = 0x02,
- ACI_BD_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE = 0x03,
- ACI_BD_ADDR_TYPE_RANDOM_PRIVATE_UNRESOLVABLE = 0x04
-} _aci_packed_ aci_bd_addr_type_t;
-
-/**
- * @enum aci_device_output_power_t
- * @brief Radio output power levels
- */
-typedef enum
-{
- ACI_DEVICE_OUTPUT_POWER_MINUS_18DBM = 0x00, /**< Output power set to -18dBm */
- ACI_DEVICE_OUTPUT_POWER_MINUS_12DBM = 0x01, /**< Output power set to -12dBm */
- ACI_DEVICE_OUTPUT_POWER_MINUS_6DBM = 0x02, /**< Output power set to -6dBm */
- ACI_DEVICE_OUTPUT_POWER_0DBM = 0x03 /**< Output power set to 0dBm - DEFAULT*/
-} _aci_packed_ aci_device_output_power_t;
-
-/**
- * @enum aci_device_operation_mode_t
- * @brief Device operation modes
- */
-typedef enum
-{
- ACI_DEVICE_INVALID =0x00,
- ACI_DEVICE_TEST =0x01,
- ACI_DEVICE_SETUP =0x02,
- ACI_DEVICE_STANDBY =0x03,
- ACI_DEVICE_SLEEP =0x04
-} _aci_packed_ aci_device_operation_mode_t;
-
-/**
- * @enum aci_disconnect_reason_t
- * @brief Reason enumeration for ACI_CMD_DISCONNECT
- */
-typedef enum
-{
- ACI_REASON_TERMINATE =0x01, /**< Use this to disconnect (does a terminate request), you need to wait for the "disconnected" event */
- ACI_REASON_BAD_TIMING =0x02 /*<Use this to disconnect and inform the peer, that the timing on the link is not acceptable for the device, you need to wait for the "disconnected" event */
-} _aci_packed_ aci_disconnect_reason_t;
-
-/**
- * @enum aci_test_mode_change_t
- * @brief Device test mode control
- */
-typedef enum
-{
- ACI_TEST_MODE_DTM_UART = 0x01,
- ACI_TEST_MODE_DTM_ACI = 0x02,
- ACI_TEST_MODE_EXIT = 0xFF
-
-} _aci_packed_ aci_test_mode_change_t;
-
-ACI_ASSERT_SIZE(aci_test_mode_change_t, 1);
-
-/**
- * @enum aci_permissions_t
- * @brief Data store permissions
- */
-typedef enum
-{
- ACI_PERMISSIONS_NONE =0x00,
- ACI_PERMISSIONS_LINK_AUTHENTICATED =0x01
-} _aci_packed_ aci_permissions_t;
-
-/**
- * @def ACI_VS_UUID_128_MAX_COUNT
- * @brief Maximum number of 128-bit Vendor Specific
- * UUIDs that can be set
- */
-#define ACI_VS_UUID_128_MAX_COUNT 64 /** #0 reserved for invalid, #1 reservered for BT SIG and a maximum of 1024 bytes (16*64) */
-
-/**
- * @struct aci_ll_conn_params_t
- * @brief Link Layer Connection Parameters
- */
-typedef struct
-{
- uint16_t min_conn_interval; /**< Minimum connection interval requested from peer */
- #define ACI_PPCP_MIN_CONN_INTVL_NONE 0xFFFF
- #define ACI_PPCP_MIN_CONN_INTVL_MIN 0x0006
- #define ACI_PPCP_MIN_CONN_INTVL_MAX 0x0C80
- uint16_t max_conn_interval; /**< Maximum connection interval requested from peer */
- #define ACI_PPCP_MAX_CONN_INTVL_NONE 0xFFFF
- #define ACI_PPCP_MAX_CONN_INTVL_MIN 0x0006
- #define ACI_PPCP_MAX_CONN_INTVL_MAX 0x0C80
- uint16_t slave_latency; /**< Connection interval latency requested from peer */
- #define ACI_PPCP_SLAVE_LATENCY_MAX 0x03E8
- uint16_t timeout_mult; /**< Link supervisor timeout multiplier requested from peer */
- #define ACI_PPCP_TIMEOUT_MULT_NONE 0xFFFF
- #define ACI_PPCP_TIMEOUT_MULT_MIN 0x000A
- #define ACI_PPCP_TIMEOUT_MULT_MAX 0x0C80
-} _aci_packed_ aci_ll_conn_params_t;
-
-/**
- * @def aci_gap_ppcp_t
- * @brief GAP Peripheral Preferred Connection Parameters
- */
-#define aci_gap_ppcp_t aci_ll_conn_params_t
-
-/**
- * @def ACI_AD_LOC_SVCUUID_16_MAX_COUNT
- * @brief Maximum number of 16-bit UUIDs that can
- * be inserted in the Services tag of AD
- */
-#define ACI_AD_LOC_SVCUUID_16_MAX_COUNT 5
-
-/**
- * @def ACI_AD_LOC_SVCUUID_128_MAX_COUNT
- * @brief Maximum number of 128-bit UUIDs that can
- * be inserted in the Services tag of AD
- */
-#define ACI_AD_LOC_SVCUUID_128_MAX_COUNT 1
-
-/**
- * @def ACI_AD_SOL_SVCUUID_16_MAX_COUNT
- * @brief Maximum number of UUIDs that can
- * be inserted in the Solicited Services tag of AD
- */
-#define ACI_AD_SOL_SVCUUID_16_MAX_COUNT 5
-
-/**
- * @def ACI_AD_SOL_SVCUUID_128_MAX_COUNT
- * @brief Maximum number of UUIDs that can
- * be inserted in the Solicited Services tag of AD
- */
-#define ACI_AD_SOL_SVCUUID_128_MAX_COUNT 1
-
-/**
- * @def ACI_SEC_ENCKEY_SIZE_MIN
- * @brief Minimum encryption key size
- */
-#define ACI_SEC_ENCKEY_SIZE_MIN 7
-/**
- * @def ACI_SEC_ENCKEY_SIZE_MAX
- * @brief Maximum encryption key size
- */
-#define ACI_SEC_ENCKEY_SIZE_MAX 16
-/**
- * @def ACI_CUSTOM_AD_TYPE_MAX_COUNT
- * @brief Maximum number of custom ad types
- */
-#define ACI_CUSTOM_AD_TYPE_MAX_COUNT 8
-/**
- * @def ACI_CUSTOM_AD_TYPE_MAX_DATA_LENGTH
- * @brief Maximum custom ad type data size
- */
-#define ACI_CUSTOM_AD_TYPE_MAX_DATA_LENGTH 20
-
-/**
- * @struct aci_tx_data_t
- * @brief Generic ACI transmit data structure
- */
-typedef struct
-{
- uint8_t pipe_number;
- uint8_t aci_data[ACI_PIPE_TX_DATA_MAX_LEN];
-} _aci_packed_ aci_tx_data_t;
-
-ACI_ASSERT_SIZE(aci_tx_data_t, ACI_PIPE_TX_DATA_MAX_LEN + 1);
-
-/**
- * @struct aci_rx_data_t
- * @brief Generic ACI receive data structure
- */
-typedef struct
-{
- uint8_t pipe_number;
- uint8_t aci_data[ACI_PIPE_RX_DATA_MAX_LEN];
-} _aci_packed_ aci_rx_data_t;
-
-ACI_ASSERT_SIZE(aci_rx_data_t, ACI_PIPE_RX_DATA_MAX_LEN + 1);
-
-/**
- * @enum aci_hw_error_t
- * @brief Hardware Error codes
- */
-typedef enum
-{
- ACI_HW_ERROR_NONE = 0x00,
- ACI_HW_ERROR_FATAL = 0x01
-} _aci_packed_ aci_hw_error_t;
-
-/**
- * @enum aci_clock_accuracy_t
- * @brief Bluetooth Low Energy Clock Accuracy
- */
-typedef enum
-{
- ACI_CLOCK_ACCURACY_500_PPM = 0x00,
- ACI_CLOCK_ACCURACY_250_PPM = 0x01,
- ACI_CLOCK_ACCURACY_150_PPM = 0x02,
- ACI_CLOCK_ACCURACY_100_PPM = 0x03,
- ACI_CLOCK_ACCURACY_75_PPM = 0x04,
- ACI_CLOCK_ACCURACY_50_PPM = 0x05,
- ACI_CLOCK_ACCURACY_30_PPM = 0x06,
- ACI_CLOCK_ACCURACY_20_PPM = 0x07
-} _aci_packed_ aci_clock_accuracy_t;
-
-/**
- * @enum aci_app_latency_mode_t
- * @brief Application latency modes
- */
-typedef enum
-{
- ACI_APP_LATENCY_DISABLE = 0,
- ACI_APP_LATENCY_ENABLE = 1
-} _aci_packed_ aci_app_latency_mode_t;
-
-/**
- * @enum gatt_format_t
- * @brief GATT format definitions
- */
-typedef enum
-{
- ACI_GATT_FORMAT_NONE = 0x00, /**< No characteristic format available */
- ACI_GATT_FORMAT_BOOLEAN = 0x01, /**< Not Supported */
- ACI_GATT_FORMAT_2BIT = 0x02, /**< Not Supported */
- ACI_GATT_FORMAT_NIBBLE = 0x03, /**< Not Supported */
- ACI_GATT_FORMAT_UINT8 = 0x04,
- ACI_GATT_FORMAT_UINT12 = 0x05,
- ACI_GATT_FORMAT_UINT16 = 0x06,
- ACI_GATT_FORMAT_UINT24 = 0x07,
- ACI_GATT_FORMAT_UINT32 = 0x08,
- ACI_GATT_FORMAT_UINT48 = 0x09,
- ACI_GATT_FORMAT_UINT64 = 0x0A,
- ACI_GATT_FORMAT_UINT128 = 0x0B,
- ACI_GATT_FORMAT_SINT8 = 0x0C,
- ACI_GATT_FORMAT_SINT12 = 0x0D,
- ACI_GATT_FORMAT_SINT16 = 0x0E,
- ACI_GATT_FORMAT_SINT24 = 0x0F,
- ACI_GATT_FORMAT_SINT32 = 0x10,
- ACI_GATT_FORMAT_SINT48 = 0x11,
- ACI_GATT_FORMAT_SINT64 = 0x12,
- ACI_GATT_FORMAT_SINT128 = 0x13,
- ACI_GATT_FORMAT_FLOAT32 = 0x14,
- ACI_GATT_FORMAT_FLOAT64 = 0x15,
- ACI_GATT_FORMAT_SFLOAT = 0x16,
- ACI_GATT_FORMAT_FLOAT = 0x17,
- ACI_GATT_FORMAT_DUINT16 = 0x18,
- ACI_GATT_FORMAT_UTF8S = 0x19,
- ACI_GATT_FORMAT_UTF16S = 0x1A,
- ACI_GATT_FORMAT_STRUCT = 0x1B
-} _aci_packed_ aci_gatt_format_t;
-
-/**
- * @brief GATT Bluetooth namespace
- */
-typedef enum
-{
- ACI_GATT_NAMESPACE_INVALID = 0x00,
- ACI_GATT_NAMESPACE_BTSIG = 0x01 /**< Bluetooth SIG */
-} _aci_packed_ aci_gatt_namespace_t;
-
-/**
- * @brief Security key types
- */
-typedef enum
-{
- ACI_KEY_TYPE_INVALID = 0x00,
- ACI_KEY_TYPE_PASSKEY = 0x01
-} _aci_packed_ aci_key_type_t;
-
-/**
- * @enum aci_bond_status_code_t
- * @brief Bond status code
- */
-typedef enum
-{
- /**
- * Bonding succeeded
- */
- ACI_BOND_STATUS_SUCCESS = 0x00,
- /**
- * Bonding failed
- */
- ACI_BOND_STATUS_FAILED = 0x01,
- /**
- * Bonding error: Timeout can occur when link termination is unexpected or did not get connected OR SMP timer expired
- */
- ACI_BOND_STATUS_FAILED_TIMED_OUT = 0x02,
- /**
- * Bonding error: Passkey entry failed
- */
- ACI_BOND_STATUS_FAILED_PASSKEY_ENTRY_FAILED = 0x81,
- /**
- * Bonding error: OOB unavailable
- */
- ACI_BOND_STATUS_FAILED_OOB_UNAVAILABLE = 0x82,
- /**
- * Bonding error: Authentication request failed
- */
- ACI_BOND_STATUS_FAILED_AUTHENTICATION_REQ = 0x83,
- /**
- * Bonding error: Confirm value failed
- */
- ACI_BOND_STATUS_FAILED_CONFIRM_VALUE = 0x84,
- /**
- * Bonding error: Pairing unsupported
- */
- ACI_BOND_STATUS_FAILED_PAIRING_UNSUPPORTED = 0x85,
- /**
- * Bonding error: Invalid encryption key size
- */
- ACI_BOND_STATUS_FAILED_ENCRYPTION_KEY_SIZE = 0x86,
- /**
- * Bonding error: Unsupported SMP command
- */
- ACI_BOND_STATUS_FAILED_SMP_CMD_UNSUPPORTED = 0x87,
- /**
- * Bonding error: Unspecified reason
- */
- ACI_BOND_STATUS_FAILED_UNSPECIFIED_REASON = 0x88,
- /**
- * Bonding error: Too many attempts
- */
- ACI_BOND_STATUS_FAILED_REPEATED_ATTEMPTS = 0x89,
- /**
- * Bonding error: Invalid parameters
- */
- ACI_BOND_STATUS_FAILED_INVALID_PARAMETERS = 0x8A
-
-} _aci_packed_ aci_bond_status_code_t;
-
-ACI_ASSERT_SIZE(aci_bond_status_code_t, 1);
-
-/**
- * @enum aci_bond_status_source_t
- * @brief Source of a bond status code
- */
-typedef enum
-{
- ACI_BOND_STATUS_SOURCE_INVALID = 0x00,
- ACI_BOND_STATUS_SOURCE_LOCAL = 0x01,
- ACI_BOND_STATUS_SOURCE_REMOTE = 0x02
-
-} _aci_packed_ aci_bond_status_source_t;
-
-/**
- * @enum aci_status_code_t
- * @brief ACI status codes
- */
-typedef enum
-{
- /**
- * Success
- */
- ACI_STATUS_SUCCESS = 0x00,
- /**
- * Transaction continuation status
- */
- ACI_STATUS_TRANSACTION_CONTINUE = 0x01,
- /**
- * Transaction completed
- */
- ACI_STATUS_TRANSACTION_COMPLETE = 0x02,
- /**
- * Extended status, further checks needed
- */
- ACI_STATUS_EXTENDED = 0x03,
- /**
- * Unknown error.
- */
- ACI_STATUS_ERROR_UNKNOWN = 0x80,
- /**
- * Internal error.
- */
- ACI_STATUS_ERROR_INTERNAL = 0x81,
- /**
- * Unknown command
- */
- ACI_STATUS_ERROR_CMD_UNKNOWN = 0x82,
- /**
- * Command invalid in the current device state
- */
- ACI_STATUS_ERROR_DEVICE_STATE_INVALID = 0x83,
- /**
- * Invalid length
- */
- ACI_STATUS_ERROR_INVALID_LENGTH = 0x84,
- /**
- * Invalid input parameters
- */
- ACI_STATUS_ERROR_INVALID_PARAMETER = 0x85,
- /**
- * Busy
- */
- ACI_STATUS_ERROR_BUSY = 0x86,
- /**
- * Invalid data format or contents
- */
- ACI_STATUS_ERROR_INVALID_DATA = 0x87,
- /**
- * CRC mismatch
- */
- ACI_STATUS_ERROR_CRC_MISMATCH = 0x88,
- /**
- * Unsupported setup format
- */
- ACI_STATUS_ERROR_UNSUPPORTED_SETUP_FORMAT = 0x89,
- /**
- * Invalid sequence number during a write dynamic data sequence
- */
- ACI_STATUS_ERROR_INVALID_SEQ_NO = 0x8A,
- /**
- * Setup data is locked and cannot be modified
- */
- ACI_STATUS_ERROR_SETUP_LOCKED = 0x8B,
- /**
- * Setup error due to lock verification failure
- */
- ACI_STATUS_ERROR_LOCK_FAILED = 0x8C,
- /**
- * Bond required: Local Pipes need bonded/trusted peer
- */
- ACI_STATUS_ERROR_BOND_REQUIRED = 0x8D,
- /**
- * Command rejected as a transaction is still pending
- */
- ACI_STATUS_ERROR_REJECTED = 0x8E,
- /**
- * Pipe Error Event : Data size exceeds size specified for pipe : Transmit failed
- */
- ACI_STATUS_ERROR_DATA_SIZE = 0x8F,
- /**
- * Pipe Error Event : Invalid pipe
- */
- ACI_STATUS_ERROR_PIPE_INVALID = 0x90,
- /**
- * Pipe Error Event : Credit not available
- */
- ACI_STATUS_ERROR_CREDIT_NOT_AVAILABLE = 0x91,
- /**
- * Pipe Error Event : Peer device has sent an error on an pipe operation on the remote characteristic
- */
- ACI_STATUS_ERROR_PEER_ATT_ERROR = 0x92,
- /**
- * Connection was not established before the BTLE advertising was stopped
- */
- ACI_STATUS_ERROR_ADVT_TIMEOUT = 0x93,
- /**
- * Peer has triggered a Security Manager Protocol Error
- */
- ACI_STATUS_ERROR_PEER_SMP_ERROR = 0x94,
- /**
- * Pipe Error Event : Pipe type invalid for the selected operation
- */
- ACI_STATUS_ERROR_PIPE_TYPE_INVALID = 0x95,
- /**
- * Pipe Error Event : Pipe state invalid for the selected operation
- */
- ACI_STATUS_ERROR_PIPE_STATE_INVALID = 0x96,
- /**
- * Invalid key size provided
- */
- ACI_STATUS_ERROR_INVALID_KEY_SIZE = 0x97,
- /**
- * Invalid key data provided
- */
- ACI_STATUS_ERROR_INVALID_KEY_DATA = 0x98,
- /**
- * Reserved range start
- */
- ACI_STATUS_RESERVED_START = 0xF0,
- /**
- * Reserved range end
- */
- ACI_STATUS_RESERVED_END = 0xFF
-
-} _aci_packed_ aci_status_code_t;
-
-ACI_ASSERT_SIZE(aci_status_code_t, 1);
-
-/**
- * @}
- */
-
-#endif // ACI_H__
diff --git a/peripheral/libupm/src/nrf8001/aci_cmds.h b/peripheral/libupm/src/nrf8001/aci_cmds.h
deleted file mode 100644
index 61f744b..0000000
--- a/peripheral/libupm/src/nrf8001/aci_cmds.h
+++ /dev/null
@@ -1,433 +0,0 @@
-/* Copyright (c) 2014, Nordic Semiconductor ASA
- *
- * 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.
- */
-
-/**
- * @file
- * @ingroup aci
- * @brief Definitions for the ACI (Application Control Interface) commands
- * @remarks
- *
- */
-
-#ifndef ACI_CMDS_H__
-#define ACI_CMDS_H__
-
-#include "aci.h"
-
-/**
- * @enum aci_cmd_opcode_t
- * @brief ACI command opcodes
- */
-typedef enum
-{
- /**
- * Enter test mode
- */
- ACI_CMD_TEST = 0x01,
- /**
- * Echo (loopback) test command
- */
- ACI_CMD_ECHO = 0x02,
- /**
- * Send a BTLE DTM command to the radio
- */
- ACI_CMD_DTM_CMD = 0x03,
- /**
- * Put the device to sleep
- */
- ACI_CMD_SLEEP = 0x04,
- /**
- * Wakeup the device from deep sleep
- */
- ACI_CMD_WAKEUP = 0x05,
- /**
- * Replace the contents of the internal database with
- * user provided data
- */
- ACI_CMD_SETUP = 0x06,
- /**
- * Read the portions of memory required to be restored after a power cycle
- */
- ACI_CMD_READ_DYNAMIC_DATA = 0x07,
- /**
- * Write back the data retrieved using ACI_CMD_READ_DYNAMIC_DATA
- */
- ACI_CMD_WRITE_DYNAMIC_DATA = 0x08,
- /**
- * Retrieve the device's version information
- */
- ACI_CMD_GET_DEVICE_VERSION = 0x09,
- /**
- * Request the Bluetooth address and its type
- */
- ACI_CMD_GET_DEVICE_ADDRESS = 0x0A,
- /**
- * Request the battery level measured by nRF8001
- */
- ACI_CMD_GET_BATTERY_LEVEL = 0x0B,
- /**
- * Request the temperature value measured by nRF8001
- */
- ACI_CMD_GET_TEMPERATURE = 0x0C,
- /**
- * Write to the local Attribute Database
- */
- ACI_CMD_SET_LOCAL_DATA = 0x0D,
- /**
- * Reset the baseband and radio and go back to idle
- */
- ACI_CMD_RADIO_RESET = 0x0E,
- /**
- * Start advertising and wait for a master connection
- */
- ACI_CMD_CONNECT = 0x0F,
- /**
- * Start advertising and wait for a master connection
- */
- ACI_CMD_BOND = 0x10,
- /**
- * Start advertising and wait for a master connection
- */
- ACI_CMD_DISCONNECT = 0x11,
- /**
- * Throttles the Radio transmit power
- */
- ACI_CMD_SET_TX_POWER = 0x12,
- /**
- * Trigger a connection parameter update
- */
- ACI_CMD_CHANGE_TIMING = 0x13,
- /**
- * Open a remote pipe for data reception
- */
- ACI_CMD_OPEN_REMOTE_PIPE = 0x14,
- /**
- * Transmit data over an open pipe
- */
- ACI_CMD_SEND_DATA = 0x15,
- /**
- * Send an acknowledgment of received data
- */
- ACI_CMD_SEND_DATA_ACK = 0x16,
- /**
- * Request data over an open pipe
- */
- ACI_CMD_REQUEST_DATA = 0x17,
- /**
- * NACK a data reception
- */
- ACI_CMD_SEND_DATA_NACK = 0x18,
- /**
- * Set application latency
- */
- ACI_CMD_SET_APP_LATENCY = 0x19,
- /**
- * Set a security key
- */
- ACI_CMD_SET_KEY = 0x1A,
- /**
- * Open Advertising Pipes
- */
- ACI_CMD_OPEN_ADV_PIPE = 0x1B,
- /**
- * Start non-connectable advertising
- */
- ACI_CMD_BROADCAST = 0x1C,
- /**
- * Start a security request in bonding mode
- */
- ACI_CMD_BOND_SECURITY_REQUEST = 0x1D,
- /**
- * Start Directed advertising towards a Bonded Peer
- */
- ACI_CMD_CONNECT_DIRECT = 0x1E,
- /**
- * Close a previously opened remote pipe
- */
- ACI_CMD_CLOSE_REMOTE_PIPE = 0x1F,
- /**
- * Invalid ACI command opcode
- */
- ACI_CMD_INVALID = 0xFF
-
-} _aci_packed_ aci_cmd_opcode_t;
-
-ACI_ASSERT_SIZE(aci_cmd_opcode_t, 1);
-
-/**
- * @struct aci_cmd_params_test_t
- * @brief Structure for the ACI_CMD_TEST ACI command parameters
- */
-typedef struct
-{
- aci_test_mode_change_t test_mode_change; /**< enum aci_test_mode_change_t */
-} _aci_packed_ aci_cmd_params_test_t;
-
-ACI_ASSERT_SIZE(aci_cmd_params_test_t, 1);
-
-/**
- * @struct aci_cmd_params_echo_t
- * @brief Structure for the ACI_CMD_ECHO ACI command parameters
- */
-typedef struct
-{
- uint8_t echo_data[ACI_ECHO_DATA_MAX_LEN];
-} _aci_packed_ aci_cmd_params_echo_t;
-
-ACI_ASSERT_SIZE(aci_cmd_params_echo_t, ACI_ECHO_DATA_MAX_LEN);
-
-/**
- * @struct aci_cmd_params_dtm_cmd_t
- * @brief Structure for the ACI_CMD_DTM_CMD ACI command parameters
- */
-typedef struct
-{
- uint8_t cmd_msb;
- uint8_t cmd_lsb;
-} _aci_packed_ aci_cmd_params_dtm_cmd_t;
-
-/**
- * @struct aci_cmd_params_setup_t
- * @brief Structure for the ACI_CMD_SETUP ACI command parameters
- */
-typedef struct
-{
- uint8_t setup_data[1];
-} _aci_packed_ aci_cmd_params_setup_t;
-
-ACI_ASSERT_SIZE(aci_cmd_params_setup_t, 1);
-
-/**
- * @struct aci_cmd_params_write_dynamic_data_t
- * @brief Structure for the ACI_CMD_WRITE_DYNAMIC_DATA ACI command parameters
- * @note Dynamic data chunk size in this command is defined to go up to ACI_PACKET_MAX_LEN - 3
- */
-typedef struct
-{
- uint8_t seq_no;
- uint8_t dynamic_data[1];
-} _aci_packed_ aci_cmd_params_write_dynamic_data_t;
-
-/**
- * @define aci_cmd_params_set_local_data_t
- * @brief Structure for the ACI_CMD_SET_LOCAL_DATA ACI command parameters
- */
-typedef struct
-{
- aci_tx_data_t tx_data;
-} _aci_packed_ aci_cmd_params_set_local_data_t;
-
-/**
- * @struct aci_cmd_params_connect_t
- * @brief Structure for the ACI_CMD_CONNECT ACI command parameters
- */
-typedef struct
-{
- uint16_t timeout; /**< 0x0000 (no timeout) to 0x3FFF */
- uint16_t adv_interval; /**< 16 bits of advertising interval for general discovery */
-} _aci_packed_ aci_cmd_params_connect_t;
-
-ACI_ASSERT_SIZE(aci_cmd_params_connect_t, 4);
-
-/**
- * @define aci_cmd_params_bond_t
- * @brief Structure for the ACI_CMD_BOND ACI command parameters
- */
-typedef struct
-{
- uint16_t timeout; /**< 0x0000 (no timeout) to 0x3FFF */
- uint16_t adv_interval; /**< 16 bits of advertising interval for general discovery */
-} _aci_packed_ aci_cmd_params_bond_t;
-
-ACI_ASSERT_SIZE(aci_cmd_params_bond_t, 4);
-
-/**
- * @struct aci_cmd_params_disconnect_t
- * @brief Structure for the ACI_CMD_DISCONNECT ACI command parameters
- */
-typedef struct
-{
- aci_disconnect_reason_t reason; /**< enum aci_disconnect_reason_t */
-} _aci_packed_ aci_cmd_params_disconnect_t;
-
-ACI_ASSERT_SIZE(aci_cmd_params_disconnect_t, 1);
-
-/**
- * @struct aci_cmd_params_set_tx_power_t
- * @brief Structure for the ACI_CMD_SET_TX_POWER ACI command parameters
- */
-typedef struct
-{
- aci_device_output_power_t device_power; /**< enum aci_device_output_power_t */
-} _aci_packed_ aci_cmd_params_set_tx_power_t;
-
-ACI_ASSERT_SIZE(aci_cmd_params_set_tx_power_t, 1);
-/**
- * @struct aci_cmd_params_change_timing_t
- * @brief Structure for the ACI_CMD_CHANGE_TIMING ACI command parameters
- */
-typedef struct
-{
- aci_ll_conn_params_t conn_params;
-} _aci_packed_ aci_cmd_params_change_timing_t;
-
-ACI_ASSERT_SIZE(aci_cmd_params_change_timing_t, 8);
-
-/**
- * @struct aci_cmd_params_open_remote_pipe_t
- * @brief Structure for the ACI_CMD_OPEN_REMOTE_PIPE ACI command parameters
- */
-typedef struct
-{
- uint8_t pipe_number;
-} _aci_packed_ aci_cmd_params_open_remote_pipe_t;
-
-/**
- * @struct aci_cmd_params_send_data_t
- * @brief Structure for the ACI_CMD_SEND_DATA ACI command parameters
- */
-typedef struct
-{
- aci_tx_data_t tx_data;
-} _aci_packed_ aci_cmd_params_send_data_t;
-
-/**
- * @define aci_cmd_params_send_data_ack_t
- * @brief Structure for the ACI_CMD_SEND_DATA_ACK ACI command parameters
- */
-typedef struct
-{
- uint8_t pipe_number;
-} _aci_packed_ aci_cmd_params_send_data_ack_t;
-
-/**
- * @struct aci_cmd_params_send_data_t
- * @brief Structure for the ACI_CMD_SEND_DATA ACI command parameters
- */
-typedef struct
-{
- uint8_t pipe_number;
-} _aci_packed_ aci_cmd_params_request_data_t;
-
-/**
- * @define aci_cmd_params_send_data_nack_t
- * @brief Structure for the ACI_CMD_SEND_DATA_NACK ACI command parameters
- */
-typedef struct
-{
- uint8_t pipe_number;
- uint8_t error_code;
-} _aci_packed_ aci_cmd_params_send_data_nack_t;
-
-ACI_ASSERT_SIZE(aci_cmd_params_send_data_nack_t, 2);
-
-/**
- * @define aci_cmd_params_set_app_latency_t
- * @brief Structure for the ACI_CMD_SET_APP_LATENCY ACI command parameters
- */
-typedef struct
-{
- aci_app_latency_mode_t mode;
- uint16_t latency;
-} _aci_packed_ aci_cmd_params_set_app_latency_t;
-
-ACI_ASSERT_SIZE(aci_cmd_params_set_app_latency_t, 3);
-/**
- * @define aci_cmd_params_set_key_t
- * @brief Structure for the ACI_CMD_SET_KEY ACI command parameters
- */
-typedef struct
-{
- aci_key_type_t key_type;
- union
- {
- uint8_t passkey[6];
- uint8_t oob_key[16];
- } key;
-} _aci_packed_ aci_cmd_params_set_key_t;
-
-ACI_ASSERT_SIZE(aci_cmd_params_set_key_t, 17);
-/**
- * @define aci_cmd_params_open_adv_pipe_t
- * @brief Structure for the ACI_CMD_OPEN_ADV_PIPE ACI command parameters
- */
-typedef struct
-{
- uint8_t pipes[8];
-} _aci_packed_ aci_cmd_params_open_adv_pipe_t;
-
-/**
- * @define aci_cmd_params_broadcast_t
- * @brief Structure for the ACI_CMD_BROADCAST ACI command parameters
- */
-typedef struct
-{
- uint16_t timeout; /**< 0x0000 (no timeout) to 0x3FFF */
- uint16_t adv_interval; /**< 16 bits of advertising interval for general discovery */
-} _aci_packed_ aci_cmd_params_broadcast_t;
-
-/**
- * @struct aci_cmd_params_close_remote_pipe_t
- * @brief Structure for the ACI_CMD_CLOSE_REMOTE_PIPE ACI command parameters
- */
-typedef struct
-{
- uint8_t pipe_number;
-} _aci_packed_ aci_cmd_params_close_remote_pipe_t;
-
-/**
- * @struct aci_cmd_t
- * @brief Encapsulates a generic ACI command
- */
-typedef struct
-{
- uint8_t len; /**< Length of the ACI command */
- aci_cmd_opcode_t cmd_opcode; /**< enum aci_cmd_opcode_t -> Opcode of the ACI command */
- union
- {
- aci_cmd_params_test_t test;
- aci_cmd_params_echo_t echo;
- aci_cmd_params_dtm_cmd_t dtm_cmd;
- aci_cmd_params_setup_t setup;
- aci_cmd_params_write_dynamic_data_t write_dynamic_data;
- aci_cmd_params_set_local_data_t set_local_data;
- aci_cmd_params_connect_t connect;
- aci_cmd_params_bond_t bond;
- aci_cmd_params_disconnect_t disconnect;
- aci_cmd_params_set_tx_power_t set_tx_power;
- aci_cmd_params_change_timing_t change_timing;
- aci_cmd_params_open_remote_pipe_t open_remote_pipe;
- aci_cmd_params_send_data_t send_data;
- aci_cmd_params_send_data_ack_t send_data_ack;
- aci_cmd_params_request_data_t request_data;
- aci_cmd_params_send_data_nack_t send_data_nack;
- aci_cmd_params_set_app_latency_t set_app_latency;
- aci_cmd_params_set_key_t set_key;
- aci_cmd_params_open_adv_pipe_t open_adv_pipe;
- aci_cmd_params_broadcast_t broadcast;
- aci_cmd_params_close_remote_pipe_t close_remote_pipe;
-
- } params;
-} _aci_packed_ aci_cmd_t;
-
-#endif // ACI_CMDS_H__
-
-
diff --git a/peripheral/libupm/src/nrf8001/aci_evts.h b/peripheral/libupm/src/nrf8001/aci_evts.h
deleted file mode 100644
index 0a577f5..0000000
--- a/peripheral/libupm/src/nrf8001/aci_evts.h
+++ /dev/null
@@ -1,397 +0,0 @@
-/* Copyright (c) 2014, Nordic Semiconductor ASA
- *
- * 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.
- */
-
-/**
- * @file
- *
- * @ingroup aci
- *
- * @brief Definitions for the ACI (Application Control Interface) events
- */
-
-#ifndef ACI_EVTS_H__
-#define ACI_EVTS_H__
-
-#include "aci.h"
-
-/**
- * @enum aci_evt_opcode_t
- * @brief ACI event opcodes
- */
-typedef enum
-{
- /**
- * Invalid event code
- */
- ACI_EVT_INVALID = 0x00,
- /**
- * Sent every time the device starts
- */
- ACI_EVT_DEVICE_STARTED = 0x81,
- /**
- * Mirrors the ACI_CMD_ECHO
- */
- ACI_EVT_ECHO = 0x82,
- /**
- * Asynchronous hardware error event
- */
- ACI_EVT_HW_ERROR = 0x83,
- /**
- * Event opcode used as a event response for all commands
- */
- ACI_EVT_CMD_RSP = 0x84,
- /**
- * Link connected
- */
- ACI_EVT_CONNECTED = 0x85,
- /**
- * Link disconnected
- */
- ACI_EVT_DISCONNECTED = 0x86,
- /**
- * Bond completion result
- */
- ACI_EVT_BOND_STATUS = 0x87,
- /**
- * Pipe bitmap for available pipes
- */
- ACI_EVT_PIPE_STATUS = 0x88,
- /**
- * Sent to the application when the radio enters a connected state
- * or when the timing of the radio connection changes
- */
- ACI_EVT_TIMING = 0x89,
- /**
- * Notification to the application that transmit credits are
- * available
- */
- ACI_EVT_DATA_CREDIT = 0x8A,
- /**
- * Data acknowledgement event
- */
- ACI_EVT_DATA_ACK = 0x8B,
- /**
- * Data received notification event
- */
- ACI_EVT_DATA_RECEIVED = 0x8C,
- /**
- * Error notification event
- */
- ACI_EVT_PIPE_ERROR = 0x8D,
- /**
- * Display Passkey Event
- */
- ACI_EVT_DISPLAY_PASSKEY = 0x8E,
- /**
- * Security Key request
- */
- ACI_EVT_KEY_REQUEST = 0x8F
-
-} _aci_packed_ aci_evt_opcode_t;
-
-ACI_ASSERT_SIZE(aci_evt_opcode_t, 1);
-
-/**
- * @struct aci_evt_params_device_started_t
- * @brief Structure for the ACI_EVT_DEVICE_STARTED event return parameters
- */
-typedef struct
-{
- aci_device_operation_mode_t device_mode; /**< Mode in which the device is being started */
- aci_hw_error_t hw_error; /**< Hardware Error if available for the start */
- uint8_t credit_available; /**< Flow control credit available for this specific FW build */
-} _aci_packed_ aci_evt_params_device_started_t;
-
-ACI_ASSERT_SIZE(aci_evt_params_device_started_t, 3);
-
-/**
- * @struct aci_evt_params_hw_error_t
- * @brief Structure for the ACI_EVT_HW_ERROR event return parameters
- */
-typedef struct
-{
- uint16_t line_num;
- uint8_t file_name[20];
-} _aci_packed_ aci_evt_params_hw_error_t;
-
-ACI_ASSERT_SIZE(aci_evt_params_hw_error_t, 22);
-
-/**
- * @struct aci_evt_cmd_rsp_params_dtm_cmd_t
- * @brief Structure for the ACI_EVT_CMD_RSP event with opcode=ACI_CMD_DTM_CMD event return parameters
- */
-typedef struct
-{
- uint8_t evt_msb;
- uint8_t evt_lsb;
-} _aci_packed_ aci_evt_cmd_rsp_params_dtm_cmd_t;
-
-/**
- * @struct aci_evt_cmd_rsp_read_dynamic_data_t
- * @brief Structure for the ACI_EVT_CMD_RSP event with opcode=ACI_CMD_READ_DYNAMIC_DATA event return parameters
- * @note Dynamic data chunk size in this event is defined to go up to ACI_PACKET_MAX_LEN - 5
- */
-typedef struct
-{
- uint8_t seq_no;
- uint8_t dynamic_data[1];
-} _aci_packed_ aci_evt_cmd_rsp_read_dynamic_data_t;
-
-/**
- * @struct aci_evt_cmd_rsp_params_get_device_version_t
- * @brief Structure for the ACI_EVT_CMD_RSP event with opcode=ACI_CMD_GET_DEVICE_VERSION event return parameters
- */
-typedef struct
-{
- uint16_t configuration_id;
- uint8_t aci_version;
- uint8_t setup_format;
- uint32_t setup_id;
- uint8_t setup_status;
-} _aci_packed_ aci_evt_cmd_rsp_params_get_device_version_t;
-
-ACI_ASSERT_SIZE(aci_evt_cmd_rsp_params_get_device_version_t, 9);
-
-/**
- * @struct aci_evt_cmd_rsp_params_get_device_address_t
- * @brief Structure for the ACI_EVT_CMD_RSP event with opcode=ACI_CMD_GET_DEVICE_ADDRESS event return parameters
- */
-typedef struct
-{
- uint8_t bd_addr_own[BTLE_DEVICE_ADDRESS_SIZE];
- aci_bd_addr_type_t bd_addr_type;
-} _aci_packed_ aci_evt_cmd_rsp_params_get_device_address_t;
-
-ACI_ASSERT_SIZE(aci_evt_cmd_rsp_params_get_device_address_t, BTLE_DEVICE_ADDRESS_SIZE + 1);
-
-/**
- * @struct aci_evt_cmd_rsp_params_get_battery_level_t
- * @brief Structure for the ACI_EVT_CMD_RSP event with opcode=ACI_CMD_GET_BATTERY_LEVEL event return parameters
- */
-typedef struct
-{
- uint16_t battery_level;
-} _aci_packed_ aci_evt_cmd_rsp_params_get_battery_level_t;
-
-/**
- * @struct aci_evt_cmd_rsp_params_get_temperature_t
- * @brief Structure for the ACI_EVT_CMD_RSP event with opcode=ACI_CMD_GET_TEMPERATURE event return parameters
- */
-typedef struct
-{
- int16_t temperature_value;
-} _aci_packed_ aci_evt_cmd_rsp_params_get_temperature_t;
-
-/**
- * @struct aci_evt_params_cmd_rsp_t
- * @brief Structure for the ACI_EVT_CMD_RSP event return parameters
- */
-typedef struct
-{
- aci_cmd_opcode_t cmd_opcode; /**< Command opcode for which the event response is being sent */
- aci_status_code_t cmd_status; /**< Status of the command that was sent. Used in the context of the command. */
- union
- {
- aci_evt_cmd_rsp_params_dtm_cmd_t dtm_cmd;
- aci_evt_cmd_rsp_read_dynamic_data_t read_dynamic_data;
- aci_evt_cmd_rsp_params_get_device_version_t get_device_version;
- aci_evt_cmd_rsp_params_get_device_address_t get_device_address;
- aci_evt_cmd_rsp_params_get_battery_level_t get_battery_level;
- aci_evt_cmd_rsp_params_get_temperature_t get_temperature;
- uint8_t padding[29];
- } params;
-} _aci_packed_ aci_evt_params_cmd_rsp_t;
-
-ACI_ASSERT_SIZE(aci_evt_params_cmd_rsp_t, 31);
-
-/**
- * @struct aci_evt_params_connected_t
- * @brief Structure for the ACI_EVT_CONNECTED event return parameters
- */
-typedef struct
-{
- aci_bd_addr_type_t dev_addr_type;
- uint8_t dev_addr[BTLE_DEVICE_ADDRESS_SIZE];
- uint16_t conn_rf_interval; /**< rf_interval = conn_rf_interval * 1.25 ms Range:0x0006 to 0x0C80 */
- uint16_t conn_slave_rf_latency; /**< Number of RF events the slave can skip */
- uint16_t conn_rf_timeout; /**< Timeout as a multiple of 10ms i.e timeout = conn_rf_timeout * 10ms Range: 0x000A to 0x0C80 */
- aci_clock_accuracy_t master_clock_accuracy; /**< Clock accuracy of Bluetooth master: Enumerated list of values from 500 ppm to 20 ppm */
-} _aci_packed_ aci_evt_params_connected_t;
-
-ACI_ASSERT_SIZE(aci_evt_params_connected_t, 14);
-
-/**
- * @struct aci_evt_params_disconnected_t
- * @brief Structure for the ACI_EVT_DISCONNECTED event return parameters
- */
-typedef struct
-{
- aci_status_code_t aci_status;
- uint8_t btle_status;
-} _aci_packed_ aci_evt_params_disconnected_t;
-
-ACI_ASSERT_SIZE(aci_evt_params_disconnected_t, 2);
-
-/**
- * @struct aci_evt_params_bond_status_t
- * @brief Structure for the ACI_EVT_BOND_STATUS event return parameters
- */
-typedef struct
-{
- aci_bond_status_code_t status_code;
- aci_bond_status_source_t status_source;
- uint8_t secmode1_bitmap;
- uint8_t secmode2_bitmap;
- uint8_t keys_exchanged_slave;
- uint8_t keys_exchanged_master;
-} _aci_packed_ aci_evt_params_bond_status_t;
-
-ACI_ASSERT_SIZE(aci_evt_params_bond_status_t, 6);
-
-/**
- * @struct aci_evt_params_pipe_status_t
- * @brief Structure for the ACI_EVT_PIPE_STATUS event return parameters
- */
-typedef struct
-{
- uint8_t pipes_open_bitmap[8];
- uint8_t pipes_closed_bitmap[8];
-} _aci_packed_ aci_evt_params_pipe_status_t;
-
-ACI_ASSERT_SIZE(aci_evt_params_pipe_status_t, 16);
-
-/**
- * @struct aci_evt_params_timing_t
- * @brief Structure for the ACI_EVT_TIMING event return parameters
- */
-typedef struct
-{
- uint16_t conn_rf_interval; /**< rf_interval = conn_rf_interval * 1.25 ms Range:0x0006 to 0x0C80 */
- uint16_t conn_slave_rf_latency; /**< Number of RF events the slave can skip */
- uint16_t conn_rf_timeout; /**< Timeout as a multiple of 10ms i.e timeout = conn_rf_timeout * 10ms Range: 0x000A to 0x0C80 */
-} _aci_packed_ aci_evt_params_timing_t;
-
-ACI_ASSERT_SIZE(aci_evt_params_timing_t, 6);
-
-/**
- * @struct aci_evt_params_data_credit_t
- * @brief Structure for the ACI_EVT_DATA_CREDIT event return parameters
- */
-typedef struct
-{
- uint8_t credit;
-} _aci_packed_ aci_evt_params_data_credit_t;
-
-/**
- * @struct aci_evt_params_data_ack_t
- * @brief Structure for the ACI_EVT_DATA_ACK event return parameters
- */
-typedef struct
-{
- uint8_t pipe_number;
-} _aci_packed_ aci_evt_params_data_ack_t;
-
-/**
- * @struct aci_evt_params_data_received_t
- * @brief Structure for the ACI_EVT_DATA_RECEIVED event return parameters
- */
-typedef struct
-{
- aci_rx_data_t rx_data;
-} _aci_packed_ aci_evt_params_data_received_t;
-
-typedef struct
-{
- uint8_t content[1];
-} _aci_packed_ error_data_t;
-
-/**
- * @struct aci_evt_params_pipe_error_t
- * @brief Structure for the ACI_EVT_PIPE_ERROR event return parameters
- */
-typedef struct
-{
- uint8_t pipe_number;
- uint8_t error_code;
- union
- {
- error_data_t error_data;
- } params;
-} _aci_packed_ aci_evt_params_pipe_error_t;
-
-/**
- * @struct aci_evt_params_display_passkey_t
- * @brief Structure for the ACI_EVT_DISPLAY_PASSKEY event return parameters
- */
-typedef struct
-{
- uint8_t passkey[6];
-} _aci_packed_ aci_evt_params_display_passkey_t;
-
-/**
- * @struct aci_evt_params_key_request_t
- * @brief Structure for the ACI_EVT_KEY_REQUEST event return parameters
- */
-typedef struct
-{
- aci_key_type_t key_type;
-} _aci_packed_ aci_evt_params_key_request_t;
-
-/**
- * @struct aci_event_params_echo_t
- * @brief Structure for the ACI_EVT_ECHO ACI event parameters
- */
-typedef struct
-{
- uint8_t echo_data[ACI_ECHO_DATA_MAX_LEN];
-} _aci_packed_ aci_evt_params_echo_t;
-
-/**
- * @struct aci_evt_t
- * @brief Encapsulates a generic ACI event
- */
-typedef struct
-{
- uint8_t len;
- aci_evt_opcode_t evt_opcode;
- union
- {
- aci_evt_params_device_started_t device_started;
- aci_evt_params_echo_t echo;
- aci_evt_params_hw_error_t hw_error;
- aci_evt_params_cmd_rsp_t cmd_rsp;
- aci_evt_params_connected_t connected;
- aci_evt_params_disconnected_t disconnected;
- aci_evt_params_bond_status_t bond_status;
- aci_evt_params_pipe_status_t pipe_status;
- aci_evt_params_timing_t timing;
- aci_evt_params_data_credit_t data_credit;
- aci_evt_params_data_ack_t data_ack;
- aci_evt_params_data_received_t data_received;
- aci_evt_params_pipe_error_t pipe_error;
- aci_evt_params_display_passkey_t display_passkey;
- aci_evt_params_key_request_t key_request;
- } params;
-} _aci_packed_ aci_evt_t;
-
-ACI_ASSERT_SIZE(aci_evt_t, 33);
-
-#endif // ACI_EVTS_H__
diff --git a/peripheral/libupm/src/nrf8001/aci_protocol_defines.h b/peripheral/libupm/src/nrf8001/aci_protocol_defines.h
deleted file mode 100644
index 65b2aad..0000000
--- a/peripheral/libupm/src/nrf8001/aci_protocol_defines.h
+++ /dev/null
@@ -1,192 +0,0 @@
-/* Copyright (c) 2014, Nordic Semiconductor ASA
- *
- * 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.
- */
-
-/**
- * @file
- *
- * @ingroup aci
- *
- * @brief This file contents defines for the position of all the fields of ACI
- * command or event messages
- */
-
-#ifndef ACI_OFFSET_H__
-#define ACI_OFFSET_H__
-
-
- #define OFFSET_ACI_LL_CONN_PARAMS_T_MIN_CONN_INTERVAL_LSB 0
- #define OFFSET_ACI_LL_CONN_PARAMS_T_MIN_CONN_INTERVAL_MSB 1
- #define OFFSET_ACI_LL_CONN_PARAMS_T_MAX_CONN_INTERVAL_LSB 2
- #define OFFSET_ACI_LL_CONN_PARAMS_T_MAX_CONN_INTERVAL_MSB 3
- #define OFFSET_ACI_LL_CONN_PARAMS_T_SLAVE_LATENCY_LSB 4
- #define OFFSET_ACI_LL_CONN_PARAMS_T_SLAVE_LATENCY_MSB 5
- #define OFFSET_ACI_LL_CONN_PARAMS_T_TIMEOUT_MULT_LSB 6
- #define OFFSET_ACI_LL_CONN_PARAMS_T_TIMEOUT_MULT_MSB 7
- #define OFFSET_ACI_TX_DATA_T_PIPE_NUMBER 0
- #define OFFSET_ACI_TX_DATA_T_ACI_DATA 1
- #define OFFSET_ACI_RX_DATA_T_PIPE_NUMBER 0
- #define OFFSET_ACI_RX_DATA_T_ACI_DATA 1
- #define OFFSET_ACI_CMD_PARAMS_TEST_T_TEST_MODE_CHANGE 0
- #define OFFSET_ACI_CMD_PARAMS_ECHO_T_ECHO_DATA 0
- #define OFFSET_ACI_CMD_PARAMS_DTM_CMD_T_CMD_MSB 0
- #define OFFSET_ACI_CMD_PARAMS_DTM_CMD_T_CMD_LSB 1
- #define OFFSET_ACI_CMD_PARAMS_SETUP_T_SETUP_DATA 0
- #define OFFSET_ACI_CMD_PARAMS_WRITE_DYNAMIC_DATA_T_SEQ_NO 0
- #define OFFSET_ACI_CMD_PARAMS_WRITE_DYNAMIC_DATA_T_DYNAMIC_DATA 1
- #define OFFSET_ACI_CMD_PARAMS_SET_LOCAL_DATA_T_TX_DATA 0
- #define OFFSET_ACI_CMD_PARAMS_CONNECT_T_TIMEOUT_LSB 0
- #define OFFSET_ACI_CMD_PARAMS_CONNECT_T_TIMEOUT_MSB 1
- #define OFFSET_ACI_CMD_PARAMS_CONNECT_T_ADV_INTERVAL_LSB 2
- #define OFFSET_ACI_CMD_PARAMS_CONNECT_T_ADV_INTERVAL_MSB 3
- #define OFFSET_ACI_CMD_PARAMS_BOND_T_TIMEOUT_LSB 0
- #define OFFSET_ACI_CMD_PARAMS_BOND_T_TIMEOUT_MSB 1
- #define OFFSET_ACI_CMD_PARAMS_BOND_T_ADV_INTERVAL_LSB 2
- #define OFFSET_ACI_CMD_PARAMS_BOND_T_ADV_INTERVAL_MSB 3
- #define OFFSET_ACI_CMD_PARAMS_DISCONNECT_T_REASON 0
- #define OFFSET_ACI_CMD_PARAMS_SET_TX_POWER_T_DEVICE_POWER 0
- #define OFFSET_ACI_CMD_PARAMS_CHANGE_TIMING_T_CONN_PARAMS 0
- #define OFFSET_ACI_CMD_PARAMS_OPEN_REMOTE_PIPE_T_PIPE_NUMBER 0
- #define OFFSET_ACI_CMD_PARAMS_SEND_DATA_T_TX_DATA 0
- #define OFFSET_ACI_CMD_PARAMS_SEND_DATA_ACK_T_PIPE_NUMBER 0
- #define OFFSET_ACI_CMD_PARAMS_REQUEST_DATA_T_PIPE_NUMBER 0
- #define OFFSET_ACI_CMD_PARAMS_SEND_DATA_NACK_T_PIPE_NUMBER 0
- #define OFFSET_ACI_CMD_PARAMS_SEND_DATA_NACK_T_ERROR_CODE 1
- #define OFFSET_ACI_CMD_PARAMS_SET_APP_LATENCY_T_MODE 0
- #define OFFSET_ACI_CMD_PARAMS_SET_APP_LATENCY_T_LATENCY_LSB 1
- #define OFFSET_ACI_CMD_PARAMS_SET_APP_LATENCY_T_LATENCY_MSB 2
- #define OFFSET_ACI_CMD_PARAMS_SET_KEY_T_KEY_TYPE 0
- #define OFFSET_ACI_CMD_PARAMS_SET_KEY_T_PASSKEY 1
- #define OFFSET_ACI_CMD_PARAMS_SET_KEY_T_OOB_KEY 1
- #define OFFSET_ACI_CMD_PARAMS_OPEN_ADV_PIPE_T_PIPES 0
- #define OFFSET_ACI_CMD_PARAMS_BROADCAST_T_TIMEOUT_LSB 0
- #define OFFSET_ACI_CMD_PARAMS_BROADCAST_T_TIMEOUT_MSB 1
- #define OFFSET_ACI_CMD_PARAMS_BROADCAST_T_ADV_INTERVAL_LSB 2
- #define OFFSET_ACI_CMD_PARAMS_BROADCAST_T_ADV_INTERVAL_MSB 3
- #define OFFSET_ACI_CMD_PARAMS_CLOSE_REMOTE_PIPE_T_PIPE_NUMBER 0
- #define OFFSET_ACI_CMD_T_LEN 0
- #define OFFSET_ACI_CMD_T_CMD_OPCODE 1
- #define OFFSET_ACI_CMD_T_TEST 2
- #define OFFSET_ACI_CMD_T_ECHO 2
- #define OFFSET_ACI_CMD_T_DTM_CMD 2
- #define OFFSET_ACI_CMD_T_SETUP 2
- #define OFFSET_ACI_CMD_T_WRITE_DYNAMIC_DATA 2
- #define OFFSET_ACI_CMD_T_SET_LOCAL_DATA 2
- #define OFFSET_ACI_CMD_T_CONNECT 2
- #define OFFSET_ACI_CMD_T_BOND 2
- #define OFFSET_ACI_CMD_T_DISCONNECT 2
- #define OFFSET_ACI_CMD_T_SET_TX_POWER 2
- #define OFFSET_ACI_CMD_T_CHANGE_TIMING 2
- #define OFFSET_ACI_CMD_T_OPEN_REMOTE_PIPE 2
- #define OFFSET_ACI_CMD_T_SEND_DATA 2
- #define OFFSET_ACI_CMD_T_SEND_DATA_ACK 2
- #define OFFSET_ACI_CMD_T_REQUEST_DATA 2
- #define OFFSET_ACI_CMD_T_SEND_DATA_NACK 2
- #define OFFSET_ACI_CMD_T_SET_APP_LATENCY 2
- #define OFFSET_ACI_CMD_T_SET_KEY 2
- #define OFFSET_ACI_CMD_T_OPEN_ADV_PIPE 2
- #define OFFSET_ACI_CMD_T_BROADCAST 2
- #define OFFSET_ACI_CMD_T_CLOSE_REMOTE_PIPE 2
- #define OFFSET_ACI_EVT_PARAMS_DEVICE_STARTED_T_DEVICE_MODE 0
- #define OFFSET_ACI_EVT_PARAMS_DEVICE_STARTED_T_HW_ERROR 1
- #define OFFSET_ACI_EVT_PARAMS_DEVICE_STARTED_T_CREDIT_AVAILABLE 2
- #define OFFSET_ACI_EVT_PARAMS_HW_ERROR_T_LINE_NUM_LSB 0
- #define OFFSET_ACI_EVT_PARAMS_HW_ERROR_T_LINE_NUM_MSB 1
- #define OFFSET_ACI_EVT_PARAMS_HW_ERROR_T_FILE_NAME 2
- #define OFFSET_ACI_EVT_CMD_RSP_PARAMS_DTM_CMD_T_EVT_MSB 0
- #define OFFSET_ACI_EVT_CMD_RSP_PARAMS_DTM_CMD_T_EVT_LSB 1
- #define OFFSET_ACI_EVT_CMD_RSP_READ_DYNAMIC_DATA_T_SEQ_NO 0
- #define OFFSET_ACI_EVT_CMD_RSP_READ_DYNAMIC_DATA_T_DYNAMIC_DATA 1
- #define OFFSET_ACI_EVT_CMD_RSP_PARAMS_GET_DEVICE_VERSION_T_CONFIGURATION_ID_LSB 0
- #define OFFSET_ACI_EVT_CMD_RSP_PARAMS_GET_DEVICE_VERSION_T_CONFIGURATION_ID_MSB 1
- #define OFFSET_ACI_EVT_CMD_RSP_PARAMS_GET_DEVICE_VERSION_T_ACI_VERSION 2
- #define OFFSET_ACI_EVT_CMD_RSP_PARAMS_GET_DEVICE_VERSION_T_SETUP_FORMAT 3
- #define OFFSET_ACI_EVT_CMD_RSP_PARAMS_GET_DEVICE_VERSION_T_SETUP_ID_LSB0 4
- #define OFFSET_ACI_EVT_CMD_RSP_PARAMS_GET_DEVICE_VERSION_T_SETUP_ID_LSB1 5
- #define OFFSET_ACI_EVT_CMD_RSP_PARAMS_GET_DEVICE_VERSION_T_SETUP_ID_MSB0 6
- #define OFFSET_ACI_EVT_CMD_RSP_PARAMS_GET_DEVICE_VERSION_T_SETUP_ID_MSB1 7
- #define OFFSET_ACI_EVT_CMD_RSP_PARAMS_GET_DEVICE_VERSION_T_SETUP_STATUS 8
- #define OFFSET_ACI_EVT_CMD_RSP_PARAMS_GET_DEVICE_ADDRESS_T_BD_ADDR_OWN 0
- #define OFFSET_ACI_EVT_CMD_RSP_PARAMS_GET_DEVICE_ADDRESS_T_BD_ADDR_TYPE 6
- #define OFFSET_ACI_EVT_CMD_RSP_PARAMS_GET_BATTERY_LEVEL_T_BATTERY_LEVEL_LSB 0
- #define OFFSET_ACI_EVT_CMD_RSP_PARAMS_GET_BATTERY_LEVEL_T_BATTERY_LEVEL_MSB 1
- #define OFFSET_ACI_EVT_CMD_RSP_PARAMS_GET_TEMPERATURE_T_TEMPERATURE_VALUE_LSB 0
- #define OFFSET_ACI_EVT_CMD_RSP_PARAMS_GET_TEMPERATURE_T_TEMPERATURE_VALUE_MSB 1
- #define OFFSET_ACI_EVT_PARAMS_CMD_RSP_T_CMD_OPCODE 0
- #define OFFSET_ACI_EVT_PARAMS_CMD_RSP_T_CMD_STATUS 1
- #define OFFSET_ACI_EVT_PARAMS_CMD_RSP_T_DTM_CMD 2
- #define OFFSET_ACI_EVT_PARAMS_CMD_RSP_T_READ_DYNAMIC_DATA 2
- #define OFFSET_ACI_EVT_PARAMS_CMD_RSP_T_GET_DEVICE_VERSION 2
- #define OFFSET_ACI_EVT_PARAMS_CMD_RSP_T_GET_DEVICE_ADDRESS 2
- #define OFFSET_ACI_EVT_PARAMS_CMD_RSP_T_GET_BATTERY_LEVEL 2
- #define OFFSET_ACI_EVT_PARAMS_CMD_RSP_T_GET_TEMPERATURE 2
- #define OFFSET_ACI_EVT_PARAMS_CONNECTED_T_DEV_ADDR_TYPE 0
- #define OFFSET_ACI_EVT_PARAMS_CONNECTED_T_DEV_ADDR 1
- #define OFFSET_ACI_EVT_PARAMS_CONNECTED_T_CONN_RF_INTERVAL_LSB 7
- #define OFFSET_ACI_EVT_PARAMS_CONNECTED_T_CONN_RF_INTERVAL_MSB 8
- #define OFFSET_ACI_EVT_PARAMS_CONNECTED_T_CONN_SLAVE_RF_LATENCY_LSB 9
- #define OFFSET_ACI_EVT_PARAMS_CONNECTED_T_CONN_SLAVE_RF_LATENCY_MSB 10
- #define OFFSET_ACI_EVT_PARAMS_CONNECTED_T_CONN_RF_TIMEOUT_LSB 11
- #define OFFSET_ACI_EVT_PARAMS_CONNECTED_T_CONN_RF_TIMEOUT_MSB 12
- #define OFFSET_ACI_EVT_PARAMS_CONNECTED_T_MASTER_CLOCK_ACCURACY 13
- #define OFFSET_ACI_EVT_PARAMS_DISCONNECTED_T_ACI_STATUS 0
- #define OFFSET_ACI_EVT_PARAMS_DISCONNECTED_T_BTLE_STATUS 1
- #define OFFSET_ACI_EVT_PARAMS_BOND_STATUS_T_STATUS_CODE 0
- #define OFFSET_ACI_EVT_PARAMS_BOND_STATUS_T_STATUS_SOURCE 1
- #define OFFSET_ACI_EVT_PARAMS_BOND_STATUS_T_SECMODE1_BITMAP 2
- #define OFFSET_ACI_EVT_PARAMS_BOND_STATUS_T_SECMODE2_BITMAP 3
- #define OFFSET_ACI_EVT_PARAMS_BOND_STATUS_T_KEYS_EXCHANGED_SLAVE 4
- #define OFFSET_ACI_EVT_PARAMS_BOND_STATUS_T_KEYS_EXCHANGED_MASTER 5
- #define OFFSET_ACI_EVT_PARAMS_PIPE_STATUS_T_PIPES_OPEN_BITMAP 0
- #define OFFSET_ACI_EVT_PARAMS_PIPE_STATUS_T_PIPES_CLOSED_BITMAP 8
- #define OFFSET_ACI_EVT_PARAMS_TIMING_T_CONN_RF_INTERVAL_LSB 0
- #define OFFSET_ACI_EVT_PARAMS_TIMING_T_CONN_RF_INTERVAL_MSB 1
- #define OFFSET_ACI_EVT_PARAMS_TIMING_T_CONN_SLAVE_RF_LATENCY_LSB 2
- #define OFFSET_ACI_EVT_PARAMS_TIMING_T_CONN_SLAVE_RF_LATENCY_MSB 3
- #define OFFSET_ACI_EVT_PARAMS_TIMING_T_CONN_RF_TIMEOUT_LSB 4
- #define OFFSET_ACI_EVT_PARAMS_TIMING_T_CONN_RF_TIMEOUT_MSB 5
- #define OFFSET_ACI_EVT_PARAMS_DATA_CREDIT_T_CREDIT 0
- #define OFFSET_ACI_EVT_PARAMS_DATA_ACK_T_PIPE_NUMBER 0
- #define OFFSET_ACI_EVT_PARAMS_DATA_RECEIVED_T_RX_DATA 0
- #define OFFSET_ERROR_DATA_T_CONTENT 0
- #define OFFSET_ACI_EVT_PARAMS_PIPE_ERROR_T_PIPE_NUMBER 0
- #define OFFSET_ACI_EVT_PARAMS_PIPE_ERROR_T_ERROR_CODE 1
- #define OFFSET_ACI_EVT_PARAMS_PIPE_ERROR_T_ERROR_DATA 2
- #define OFFSET_ACI_EVT_PARAMS_DISPLAY_PASSKEY_T_PASSKEY 0
- #define OFFSET_ACI_EVT_PARAMS_KEY_REQUEST_T_KEY_TYPE 0
- #define OFFSET_ACI_EVT_T_LEN 0
- #define OFFSET_ACI_EVT_T_EVT_OPCODE 1
- #define OFFSET_ACI_EVT_T_DEVICE_STARTED 2
- #define OFFSET_ACI_EVT_T_HW_ERROR 2
- #define OFFSET_ACI_EVT_T_CMD_RSP 2
- #define OFFSET_ACI_EVT_T_CONNECTED 2
- #define OFFSET_ACI_EVT_T_DISCONNECTED 2
- #define OFFSET_ACI_EVT_T_BOND_STATUS 2
- #define OFFSET_ACI_EVT_T_PIPE_STATUS 2
- #define OFFSET_ACI_EVT_T_TIMING 2
- #define OFFSET_ACI_EVT_T_DATA_CREDIT 2
- #define OFFSET_ACI_EVT_T_DATA_ACK 2
- #define OFFSET_ACI_EVT_T_DATA_RECEIVED 2
- #define OFFSET_ACI_EVT_T_PIPE_ERROR 2
- #define OFFSET_ACI_EVT_T_DISPLAY_PASSKEY 2
- #define OFFSET_ACI_EVT_T_KEY_REQUEST 2
-
-#endif //ACI_OFFSET_H__
-
diff --git a/peripheral/libupm/src/nrf8001/aci_queue.cxx b/peripheral/libupm/src/nrf8001/aci_queue.cxx
deleted file mode 100644
index 63ac0f8..0000000
--- a/peripheral/libupm/src/nrf8001/aci_queue.cxx
+++ /dev/null
@@ -1,201 +0,0 @@
-/* Copyright (c) 2014, Nordic Semiconductor ASA
- *
- * 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.
- */
-
- /** @file
-@brief Implementation of a circular queue for ACI data
-*/
-
-#include "hal_aci_tl.h"
-#include "aci_queue.h"
-
-void aci_queue_init(aci_queue_t *aci_q)
-{
- uint8_t loop;
-
- // ble_assert(NULL != aci_q);
-
- aci_q->head = 0;
- aci_q->tail = 0;
- for(loop=0; loop<ACI_QUEUE_SIZE; loop++)
- {
- aci_q->aci_data[loop].buffer[0] = 0x00;
- aci_q->aci_data[loop].buffer[1] = 0x00;
- }
-}
-
-bool aci_queue_dequeue(aci_queue_t *aci_q, hal_aci_data_t *p_data)
-{
- // ble_assert(NULL != aci_q);
- // ble_assert(NULL != p_data);
-
- if (aci_queue_is_empty(aci_q))
- {
- return false;
- }
-
- memcpy((uint8_t *)p_data, (uint8_t *)&(aci_q->aci_data[aci_q->head]), sizeof(hal_aci_data_t));
- aci_q->head = (aci_q->head + 1) % ACI_QUEUE_SIZE;
-
- return true;
-}
-
-bool aci_queue_dequeue_from_isr(aci_queue_t *aci_q, hal_aci_data_t *p_data)
-{
- // ble_assert(NULL != aci_q);
- // ble_assert(NULL != p_data);
-
- if (aci_queue_is_empty_from_isr(aci_q))
- {
- return false;
- }
-
- memcpy((uint8_t *)p_data, (uint8_t *)&(aci_q->aci_data[aci_q->head]), sizeof(hal_aci_data_t));
- aci_q->head = (aci_q->head + 1) % ACI_QUEUE_SIZE;
-
- return true;
-}
-
-bool aci_queue_enqueue(aci_queue_t *aci_q, hal_aci_data_t *p_data)
-{
- const uint8_t length = p_data->buffer[0];
-
- // ble_assert(NULL != aci_q);
- // ble_assert(NULL != p_data);
-
- if (aci_queue_is_full(aci_q))
- {
- return false;
- }
-
- aci_q->aci_data[aci_q->tail].status_byte = 0;
- memcpy((uint8_t *)&(aci_q->aci_data[aci_q->tail].buffer[0]), (uint8_t *)&p_data->buffer[0], length + 1);
- aci_q->tail = (aci_q->tail + 1) % ACI_QUEUE_SIZE;
-
- return true;
-}
-
-bool aci_queue_enqueue_from_isr(aci_queue_t *aci_q, hal_aci_data_t *p_data)
-{
- const uint8_t length = p_data->buffer[0];
-
- // ble_assert(NULL != aci_q);
- // ble_assert(NULL != p_data);
-
- if (aci_queue_is_full_from_isr(aci_q))
- {
- return false;
- }
-
- aci_q->aci_data[aci_q->tail].status_byte = 0;
- memcpy((uint8_t *)&(aci_q->aci_data[aci_q->tail].buffer[0]), (uint8_t *)&p_data->buffer[0], length + 1);
- aci_q->tail = (aci_q->tail + 1) % ACI_QUEUE_SIZE;
-
- return true;
-}
-
-bool aci_queue_is_empty(aci_queue_t *aci_q)
-{
- bool state = false;
-
- // ble_assert(NULL != aci_q);
-
- //Critical section
- // noInterrupts();
- if (aci_q->head == aci_q->tail)
- {
- state = true;
- }
- // interrupts();
-
- return state;
-}
-
-bool aci_queue_is_empty_from_isr(aci_queue_t *aci_q)
-{
- // ble_assert(NULL != aci_q);
-
- return aci_q->head == aci_q->tail;
-}
-
-bool aci_queue_is_full(aci_queue_t *aci_q)
-{
- uint8_t next;
- bool state;
-
- // ble_assert(NULL != aci_q);
-
- //This should be done in a critical section
- // noInterrupts();
- next = (aci_q->tail + 1) % ACI_QUEUE_SIZE;
-
- if (next == aci_q->head)
- {
- state = true;
- }
- else
- {
- state = false;
- }
-
- // interrupts();
- //end
-
- return state;
-}
-
-bool aci_queue_is_full_from_isr(aci_queue_t *aci_q)
-{
- const uint8_t next = (aci_q->tail + 1) % ACI_QUEUE_SIZE;
-
- // ble_assert(NULL != aci_q);
-
- return next == aci_q->head;
-}
-
-bool aci_queue_peek(aci_queue_t *aci_q, hal_aci_data_t *p_data)
-{
- // ble_assert(NULL != aci_q);
- // ble_assert(NULL != p_data);
-
- if (aci_queue_is_empty(aci_q))
- {
- return false;
- }
-
- memcpy((uint8_t *)p_data, (uint8_t *)&(aci_q->aci_data[aci_q->head]), sizeof(hal_aci_data_t));
-
- return true;
-}
-
-bool aci_queue_peek_from_isr(aci_queue_t *aci_q, hal_aci_data_t *p_data)
-{
- // ble_assert(NULL != aci_q);
- // ble_assert(NULL != p_data);
-
- if (aci_queue_is_empty_from_isr(aci_q))
- {
- return false;
- }
-
- memcpy((uint8_t *)p_data, (uint8_t *)&(aci_q->aci_data[aci_q->head]), sizeof(hal_aci_data_t));
-
- return true;
-}
diff --git a/peripheral/libupm/src/nrf8001/aci_queue.h b/peripheral/libupm/src/nrf8001/aci_queue.h
deleted file mode 100644
index 4d95e2a..0000000
--- a/peripheral/libupm/src/nrf8001/aci_queue.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/* Copyright (c) 2014, Nordic Semiconductor ASA
- *
- * 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.
- */
-
-/**
- * @file
- * @brief Interface for buffer.
- * @ingroup aci
- */
-
-/**
-@{
-*/
-
-#ifndef ACI_QUEUE_H__
-#define ACI_QUEUE_H__
-
-#include "aci.h"
-#include "hal_aci_tl.h"
-
-/*********************************************************************** */
-/* The ACI_QUEUE_SIZE determines the memory usage of the system. */
-/* Successfully tested to a ACI_QUEUE_SIZE of 4 (interrupt) and 4 (polling) */
-/*********************************************************************** */
-#define ACI_QUEUE_SIZE 4
-
-/** Data type for queue of data packets to send/receive from radio.
- *
- * A FIFO queue is maintained for packets. New packets are added (enqueued)
- * at the tail and taken (dequeued) from the head. The head variable is the
- * index of the next packet to dequeue while the tail variable is the index of
- * where the next packet should be queued.
- */
-
-typedef struct {
- hal_aci_data_t aci_data[ACI_QUEUE_SIZE];
- uint8_t head;
- uint8_t tail;
-} aci_queue_t;
-
-void aci_queue_init(aci_queue_t *aci_q);
-
-bool aci_queue_dequeue(aci_queue_t *aci_q, hal_aci_data_t *p_data);
-bool aci_queue_dequeue_from_isr(aci_queue_t *aci_q, hal_aci_data_t *p_data);
-
-bool aci_queue_enqueue(aci_queue_t *aci_q, hal_aci_data_t *p_data);
-bool aci_queue_enqueue_from_isr(aci_queue_t *aci_q, hal_aci_data_t *p_data);
-
-bool aci_queue_is_empty(aci_queue_t *aci_q);
-bool aci_queue_is_empty_from_isr(aci_queue_t *aci_q);
-
-bool aci_queue_is_full(aci_queue_t *aci_q);
-bool aci_queue_is_full_from_isr(aci_queue_t *aci_q);
-
-bool aci_queue_peek(aci_queue_t *aci_q, hal_aci_data_t *p_data);
-bool aci_queue_peek_from_isr(aci_queue_t *aci_q, hal_aci_data_t *p_data);
-
-#endif /* ACI_QUEUE_H__ */
-/** @} */
diff --git a/peripheral/libupm/src/nrf8001/aci_setup.cxx b/peripheral/libupm/src/nrf8001/aci_setup.cxx
deleted file mode 100644
index dca6d4e..0000000
--- a/peripheral/libupm/src/nrf8001/aci_setup.cxx
+++ /dev/null
@@ -1,177 +0,0 @@
-/* Copyright (c) 2014, Nordic Semiconductor ASA
- *
- * 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 "aci.h"
-#include "hal_aci_tl.h"
-#include <lib_aci.h>
-#include "aci_setup.h"
-
-
-// aci_struct that will contain
-// total initial credits
-// current credit
-// current state of the aci (setup/standby/active/sleep)
-// open remote pipe pending
-// close remote pipe pending
-// Current pipe available bitmap
-// Current pipe closed bitmap
-// Current connection interval, slave latency and link supervision timeout
-// Current State of the the GATT client (Service Discovery status)
-
-
-// hal_aci_data_t msg_to_send;
-extern hal_aci_data_t msg_to_send;
-
-
-/************************************************************************** */
-/* Utility function to fill the the ACI command queue */
-/* aci_stat Pointer to the ACI state */
-/* num_cmd_offset(in/out) Offset in the Setup message array to start from */
-/* offset is updated to the new index after the queue is filled */
-/* or the last message us placed in the queue */
-/* Returns true if at least one message was transferred */
-/***************************************************************************/
-bool aci_setup_fill(aci_state_t *aci_stat, uint8_t *num_cmd_offset)
-{
- bool ret_val = false;
-
- while (*num_cmd_offset < aci_stat->aci_setup_info.num_setup_msgs)
- {
- //Board dependent defines
- /*#if defined (__AVR__)
- //For Arduino copy the setup ACI message from Flash to RAM.
- memcpy_P(&msg_to_send, &(aci_stat->aci_setup_info.setup_msgs[*num_cmd_offset]),
- pgm_read_byte_near(&(aci_stat->aci_setup_info.setup_msgs[*num_cmd_offset].buffer[0]))+2);
- #elif defined(__PIC32MX__)
- //In ChipKit we store the setup messages in RAM
- //Add 2 bytes to the length byte for status byte, length for the total number of bytes
- memcpy(&msg_to_send, &(aci_stat->aci_setup_info.setup_msgs[*num_cmd_offset]),
- (aci_stat->aci_setup_info.setup_msgs[*num_cmd_offset].buffer[0]+2));
- #endif*/
-
- memcpy(&msg_to_send, &(aci_stat->aci_setup_info.setup_msgs[*num_cmd_offset]),
- (aci_stat->aci_setup_info.setup_msgs[*num_cmd_offset].buffer[0]+2));
-
- //Put the Setup ACI message in the command queue
- if (!hal_aci_tl_send(&msg_to_send))
- {
- //ACI Command Queue is full
- // *num_cmd_offset is now pointing to the index of the Setup command that did not get sent
- return ret_val;
- }
-
- ret_val = true;
-
- (*num_cmd_offset)++;
- }
-
- return ret_val;
-}
-
-uint8_t do_aci_setup(aci_state_t *aci_stat)
-{
- uint8_t setup_offset = 0;
- uint32_t i = 0x0000;
- aci_evt_t * aci_evt = NULL;
- aci_status_code_t cmd_status = ACI_STATUS_ERROR_CRC_MISMATCH;
-
- /*
- We are using the same buffer since we are copying the contents of the buffer
- when queuing and immediately processing the buffer when receiving
- */
- hal_aci_evt_t *aci_data = (hal_aci_evt_t *)&msg_to_send;
-
- /* Messages in the outgoing queue must be handled before the Setup routine can run.
- * If it is non-empty we return. The user should then process the messages before calling
- * do_aci_setup() again.
- */
- if (!lib_aci_command_queue_empty())
- {
- return SETUP_FAIL_COMMAND_QUEUE_NOT_EMPTY;
- }
-
- /* If there are events pending from the device that are not relevant to setup, we return false
- * so that the user can handle them. At this point we don't care what the event is,
- * as any event is an error.
- */
- if (lib_aci_event_peek(aci_data))
- {
- return SETUP_FAIL_EVENT_QUEUE_NOT_EMPTY;
- }
-
- /* Fill the ACI command queue with as many Setup messages as it will hold. */
- aci_setup_fill(aci_stat, &setup_offset);
-
- while (cmd_status != ACI_STATUS_TRANSACTION_COMPLETE)
- {
- /* This counter is used to ensure that this function does not loop forever. When the device
- * returns a valid response, we reset the counter.
- */
- if (i++ > 0xFFFFE)
- {
- return SETUP_FAIL_TIMEOUT;
- }
-
- if (lib_aci_event_peek(aci_data))
- {
- aci_evt = &(aci_data->evt);
-
- if (ACI_EVT_CMD_RSP != aci_evt->evt_opcode)
- {
- //Receiving something other than a Command Response Event is an error.
- return SETUP_FAIL_NOT_COMMAND_RESPONSE;
- }
-
- cmd_status = (aci_status_code_t) aci_evt->params.cmd_rsp.cmd_status;
- switch (cmd_status)
- {
- case ACI_STATUS_TRANSACTION_CONTINUE:
- //As the device is responding, reset guard counter
- i = 0;
-
- /* As the device has processed the Setup messages we put in the command queue earlier,
- * we can proceed to fill the queue with new messages
- */
- aci_setup_fill(aci_stat, &setup_offset);
- break;
-
- case ACI_STATUS_TRANSACTION_COMPLETE:
- //Break out of the while loop when this status code appears
- break;
-
- default:
- //An event with any other status code should be handled by the application
- return SETUP_FAIL_NOT_SETUP_EVENT;
- }
-
- /* If we haven't returned at this point, the event was either ACI_STATUS_TRANSACTION_CONTINUE
- * or ACI_STATUS_TRANSACTION_COMPLETE. We don't need the event itself, so we simply
- * remove it from the queue.
- */
- lib_aci_event_get (aci_stat, aci_data);
- }
- }
-
- return SETUP_SUCCESS;
-}
-
-
diff --git a/peripheral/libupm/src/nrf8001/aci_setup.h b/peripheral/libupm/src/nrf8001/aci_setup.h
deleted file mode 100644
index 7f9a420..0000000
--- a/peripheral/libupm/src/nrf8001/aci_setup.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/* Copyright (c) 2014, Nordic Semiconductor ASA
- *
- * 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.
- */
-
-/**
- * @file
- * @brief ACI setup functions
- * @ingroup aci
- */
-
-#ifndef H_ACI_SETUP
-#define H_ACI_SETUP
-
-#define SETUP_SUCCESS 0
-#define SETUP_FAIL_COMMAND_QUEUE_NOT_EMPTY 1
-#define SETUP_FAIL_EVENT_QUEUE_NOT_EMPTY 2
-#define SETUP_FAIL_TIMEOUT 3
-#define SETUP_FAIL_NOT_SETUP_EVENT 4
-#define SETUP_FAIL_NOT_COMMAND_RESPONSE 5
-
-bool aci_setup_fill(aci_state_t *aci_stat, uint8_t *num_cmd_offset);
-/** @brief Setup the nRF8001 device
- * @details
- * Performs ACI Setup by transmitting the setup messages generated by nRFgo Studio to the
- * nRF8001, and should be called when the nRF8001 starts or resets.
- * Once all messages are sent, the nRF8001 will send a Device Started Event.
- * The function requires that the Command queue is empty when it is invoked, and will fail
- * otherwise.
- * @returns An integer indicating the reason the function terminated
- */
-uint8_t do_aci_setup(aci_state_t *aci_stat);
-
-#endif
diff --git a/peripheral/libupm/src/nrf8001/acilib.cxx b/peripheral/libupm/src/nrf8001/acilib.cxx
deleted file mode 100644
index 4e7f41f..0000000
--- a/peripheral/libupm/src/nrf8001/acilib.cxx
+++ /dev/null
@@ -1,610 +0,0 @@
-/* Copyright (c) 2014, Nordic Semiconductor ASA
- *
- * 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.
- */
-
-/**
- * @file
- *
- * @ingroup group_acilib
- *
- * @brief Implementation of the acilib module.
- */
-
-
-#include "hal_platform.h"
-#include "aci.h"
-#include "aci_cmds.h"
-#include "aci_evts.h"
-#include "acilib.h"
-#include "aci_protocol_defines.h"
-#include "acilib_defs.h"
-#include "acilib_if.h"
-#include "acilib_types.h"
-
-
-void acil_encode_cmd_set_test_mode(uint8_t *buffer, aci_cmd_params_test_t *p_aci_cmd_params_test)
-{
- *(buffer + OFFSET_ACI_CMD_T_LEN) = 2;
- *(buffer + OFFSET_ACI_CMD_T_CMD_OPCODE) = ACI_CMD_TEST;
- *(buffer + OFFSET_ACI_CMD_T_TEST + OFFSET_ACI_CMD_PARAMS_TEST_T_TEST_MODE_CHANGE) = p_aci_cmd_params_test->test_mode_change;
-}
-
-void acil_encode_cmd_sleep(uint8_t *buffer)
-{
- *(buffer + OFFSET_ACI_CMD_T_LEN) = 1;
- *(buffer + OFFSET_ACI_CMD_T_CMD_OPCODE) = ACI_CMD_SLEEP;
-}
-
-void acil_encode_cmd_get_device_version(uint8_t *buffer)
-{
- *(buffer + OFFSET_ACI_CMD_T_LEN) = 1;
- *(buffer + OFFSET_ACI_CMD_T_CMD_OPCODE) = ACI_CMD_GET_DEVICE_VERSION;
-}
-
-void acil_encode_cmd_set_local_data(uint8_t *buffer, aci_cmd_params_set_local_data_t *p_aci_cmd_params_set_local_data, uint8_t data_size)
-{
- *(buffer + OFFSET_ACI_CMD_T_LEN) = MSG_SET_LOCAL_DATA_BASE_LEN + data_size;
- *(buffer + OFFSET_ACI_CMD_T_CMD_OPCODE) = ACI_CMD_SET_LOCAL_DATA;
- *(buffer + OFFSET_ACI_CMD_T_SET_LOCAL_DATA + OFFSET_ACI_CMD_PARAMS_SEND_DATA_T_TX_DATA + OFFSET_ACI_TX_DATA_T_PIPE_NUMBER) = p_aci_cmd_params_set_local_data->tx_data.pipe_number;
- memcpy(buffer + OFFSET_ACI_CMD_T_SET_LOCAL_DATA + OFFSET_ACI_CMD_PARAMS_SEND_DATA_T_TX_DATA + OFFSET_ACI_TX_DATA_T_ACI_DATA, &(p_aci_cmd_params_set_local_data->tx_data.aci_data[0]), data_size);
-}
-
-void acil_encode_cmd_connect(uint8_t *buffer, aci_cmd_params_connect_t *p_aci_cmd_params_connect)
-{
- *(buffer + OFFSET_ACI_CMD_T_LEN) = MSG_CONNECT_LEN;
- *(buffer + OFFSET_ACI_CMD_T_CMD_OPCODE) = ACI_CMD_CONNECT;
- *(buffer + OFFSET_ACI_CMD_T_CONNECT + OFFSET_ACI_CMD_PARAMS_CONNECT_T_TIMEOUT_MSB) = (uint8_t)(p_aci_cmd_params_connect->timeout >> 8);
- *(buffer + OFFSET_ACI_CMD_T_CONNECT + OFFSET_ACI_CMD_PARAMS_CONNECT_T_TIMEOUT_LSB) = (uint8_t)(p_aci_cmd_params_connect->timeout);
- *(buffer + OFFSET_ACI_CMD_T_CONNECT + OFFSET_ACI_CMD_PARAMS_CONNECT_T_ADV_INTERVAL_MSB) = (uint8_t)(p_aci_cmd_params_connect->adv_interval >> 8);
- *(buffer + OFFSET_ACI_CMD_T_CONNECT + OFFSET_ACI_CMD_PARAMS_CONNECT_T_ADV_INTERVAL_LSB) = (uint8_t)(p_aci_cmd_params_connect->adv_interval);
-}
-
-void acil_encode_cmd_bond(uint8_t *buffer, aci_cmd_params_bond_t *p_aci_cmd_params_bond)
-{
- *(buffer + OFFSET_ACI_CMD_T_LEN) = MSG_BOND_LEN;
- *(buffer + OFFSET_ACI_CMD_T_CMD_OPCODE) = ACI_CMD_BOND;
- *(buffer + OFFSET_ACI_CMD_T_BOND + OFFSET_ACI_CMD_PARAMS_BOND_T_TIMEOUT_MSB) = (uint8_t)(p_aci_cmd_params_bond->timeout >> 8);
- *(buffer + OFFSET_ACI_CMD_T_BOND + OFFSET_ACI_CMD_PARAMS_BOND_T_TIMEOUT_LSB) = (uint8_t)(p_aci_cmd_params_bond->timeout);
- *(buffer + OFFSET_ACI_CMD_T_BOND + OFFSET_ACI_CMD_PARAMS_BOND_T_ADV_INTERVAL_MSB) = (uint8_t)(p_aci_cmd_params_bond->adv_interval >> 8);
- *(buffer + OFFSET_ACI_CMD_T_BOND + OFFSET_ACI_CMD_PARAMS_BOND_T_ADV_INTERVAL_LSB) = (uint8_t)(p_aci_cmd_params_bond->adv_interval);
-}
-
-void acil_encode_cmd_disconnect(uint8_t *buffer, aci_cmd_params_disconnect_t *p_aci_cmd_params_disconnect)
-{
- *(buffer + OFFSET_ACI_CMD_T_LEN) = MSG_DISCONNECT_LEN;
- *(buffer + OFFSET_ACI_CMD_T_CMD_OPCODE) = ACI_CMD_DISCONNECT;
- *(buffer + OFFSET_ACI_CMD_T_DISCONNECT + OFFSET_ACI_CMD_PARAMS_DISCONNECT_T_REASON) = (uint8_t)(p_aci_cmd_params_disconnect->reason);
-}
-
-void acil_encode_baseband_reset(uint8_t *buffer)
-{
- *(buffer + OFFSET_ACI_CMD_T_LEN) = MSG_BASEBAND_RESET_LEN;
- *(buffer + OFFSET_ACI_CMD_T_CMD_OPCODE) = ACI_CMD_RADIO_RESET;
-}
-
-void acil_encode_direct_connect(uint8_t *buffer)
-{
- *(buffer + OFFSET_ACI_CMD_T_LEN) = MSG_DIRECT_CONNECT_LEN;
- *(buffer + OFFSET_ACI_CMD_T_CMD_OPCODE) = ACI_CMD_CONNECT_DIRECT;
-}
-
-void acil_encode_cmd_wakeup(uint8_t *buffer)
-{
- *(buffer + OFFSET_ACI_CMD_T_LEN) = MSG_WAKEUP_LEN;
- *(buffer + OFFSET_ACI_CMD_T_CMD_OPCODE) = ACI_CMD_WAKEUP;
-}
-
-void acil_encode_cmd_set_radio_tx_power(uint8_t *buffer, aci_cmd_params_set_tx_power_t *p_aci_cmd_params_set_tx_power)
-{
- *(buffer + OFFSET_ACI_CMD_T_LEN) = MSG_SET_RADIO_TX_POWER_LEN;
- *(buffer + OFFSET_ACI_CMD_T_CMD_OPCODE) = ACI_CMD_SET_TX_POWER;
- *(buffer + OFFSET_ACI_CMD_T_SET_TX_POWER + OFFSET_ACI_CMD_PARAMS_SET_TX_POWER_T_DEVICE_POWER) = (uint8_t)p_aci_cmd_params_set_tx_power->device_power;
-}
-
-void acil_encode_cmd_get_address(uint8_t *buffer)
-{
- *(buffer + OFFSET_ACI_CMD_T_LEN) = MSG_GET_DEVICE_ADDR_LEN;
- *(buffer + OFFSET_ACI_CMD_T_CMD_OPCODE) = ACI_CMD_GET_DEVICE_ADDRESS;
-}
-
-void acil_encode_cmd_send_data(uint8_t *buffer, aci_cmd_params_send_data_t *p_aci_cmd_params_send_data_t, uint8_t data_size)
-{
- *(buffer + OFFSET_ACI_CMD_T_LEN) = MSG_SEND_DATA_BASE_LEN + data_size;
- *(buffer + OFFSET_ACI_CMD_T_CMD_OPCODE) = ACI_CMD_SEND_DATA;
- *(buffer + OFFSET_ACI_CMD_T_SEND_DATA + OFFSET_ACI_CMD_PARAMS_SEND_DATA_T_TX_DATA + OFFSET_ACI_TX_DATA_T_PIPE_NUMBER) = p_aci_cmd_params_send_data_t->tx_data.pipe_number;
- memcpy((buffer + OFFSET_ACI_CMD_T_SEND_DATA + OFFSET_ACI_CMD_PARAMS_SEND_DATA_T_TX_DATA + OFFSET_ACI_TX_DATA_T_ACI_DATA), &(p_aci_cmd_params_send_data_t->tx_data.aci_data[0]), data_size);
-}
-
-void acil_encode_cmd_request_data(uint8_t *buffer, aci_cmd_params_request_data_t *p_aci_cmd_params_request_data)
-{
- *(buffer + OFFSET_ACI_CMD_T_LEN) = MSG_DATA_REQUEST_LEN;
- *(buffer + OFFSET_ACI_CMD_T_CMD_OPCODE) = ACI_CMD_REQUEST_DATA;
- *(buffer + OFFSET_ACI_CMD_T_REQUEST_DATA + OFFSET_ACI_CMD_PARAMS_REQUEST_DATA_T_PIPE_NUMBER) = p_aci_cmd_params_request_data->pipe_number;
-}
-
-void acil_encode_cmd_open_remote_pipe(uint8_t *buffer, aci_cmd_params_open_remote_pipe_t *p_aci_cmd_params_open_remote_pipe)
-{
- *(buffer + OFFSET_ACI_CMD_T_LEN) = MSG_OPEN_REMOTE_PIPE_LEN;
- *(buffer + OFFSET_ACI_CMD_T_CMD_OPCODE) = ACI_CMD_OPEN_REMOTE_PIPE;
- *(buffer + OFFSET_ACI_CMD_T_OPEN_REMOTE_PIPE + OFFSET_ACI_CMD_PARAMS_OPEN_REMOTE_PIPE_T_PIPE_NUMBER) = p_aci_cmd_params_open_remote_pipe->pipe_number;
-}
-
-void acil_encode_cmd_close_remote_pipe(uint8_t *buffer, aci_cmd_params_close_remote_pipe_t *p_aci_cmd_params_close_remote_pipe)
-{
- *(buffer + OFFSET_ACI_CMD_T_LEN) = MSG_CLOSE_REMOTE_PIPE_LEN;
- *(buffer + OFFSET_ACI_CMD_T_CMD_OPCODE) = ACI_CMD_CLOSE_REMOTE_PIPE;
- *(buffer + OFFSET_ACI_CMD_T_CLOSE_REMOTE_PIPE + OFFSET_ACI_CMD_PARAMS_CLOSE_REMOTE_PIPE_T_PIPE_NUMBER) = p_aci_cmd_params_close_remote_pipe->pipe_number;
-}
-
-void acil_encode_cmd_echo_msg(uint8_t *buffer, aci_cmd_params_echo_t *p_cmd_params_echo, uint8_t msg_size)
-{
- *(buffer + OFFSET_ACI_CMD_T_LEN) = MSG_ECHO_MSG_CMD_BASE_LEN + msg_size;
- *(buffer + OFFSET_ACI_CMD_T_CMD_OPCODE) = ACI_CMD_ECHO;
- memcpy((buffer + OFFSET_ACI_CMD_T_ECHO + OFFSET_ACI_CMD_PARAMS_ECHO_T_ECHO_DATA), &(p_cmd_params_echo->echo_data[0]), msg_size);
-}
-
-void acil_encode_cmd_battery_level(uint8_t *buffer)
-{
- *(buffer + OFFSET_ACI_CMD_T_LEN) = 1;
- *(buffer + OFFSET_ACI_CMD_T_CMD_OPCODE) = ACI_CMD_GET_BATTERY_LEVEL;
-}
-
-void acil_encode_cmd_temparature(uint8_t *buffer)
-{
- *(buffer + OFFSET_ACI_CMD_T_LEN) = 1;
- *(buffer + OFFSET_ACI_CMD_T_CMD_OPCODE) = ACI_CMD_GET_TEMPERATURE;
-}
-
-void acil_encode_cmd_read_dynamic_data(uint8_t *buffer)
-{
- *(buffer + OFFSET_ACI_CMD_T_LEN) = 1;
- *(buffer + OFFSET_ACI_CMD_T_CMD_OPCODE) = ACI_CMD_READ_DYNAMIC_DATA;
-}
-
-void acil_encode_cmd_write_dynamic_data(uint8_t *buffer, uint8_t seq_no, uint8_t* dynamic_data, uint8_t dynamic_data_size)
-{
- *(buffer + OFFSET_ACI_CMD_T_LEN) = MSG_WRITE_DYNAMIC_DATA_BASE_LEN + dynamic_data_size;
- *(buffer + OFFSET_ACI_CMD_T_CMD_OPCODE) = ACI_CMD_WRITE_DYNAMIC_DATA;
- *(buffer + OFFSET_ACI_CMD_T_WRITE_DYNAMIC_DATA + OFFSET_ACI_CMD_PARAMS_WRITE_DYNAMIC_DATA_T_SEQ_NO) = seq_no;
- memcpy((buffer + OFFSET_ACI_CMD_T_WRITE_DYNAMIC_DATA + OFFSET_ACI_CMD_PARAMS_WRITE_DYNAMIC_DATA_T_DYNAMIC_DATA), dynamic_data, dynamic_data_size);
-}
-
-void acil_encode_cmd_change_timing_req(uint8_t *buffer, aci_cmd_params_change_timing_t *p_aci_cmd_params_change_timing)
-{
- *(buffer + OFFSET_ACI_CMD_T_LEN) = MSG_CHANGE_TIMING_LEN;
- *(buffer + OFFSET_ACI_CMD_T_CMD_OPCODE) = ACI_CMD_CHANGE_TIMING;
- *(buffer + OFFSET_ACI_CMD_T_CHANGE_TIMING + OFFSET_ACI_CMD_PARAMS_CHANGE_TIMING_T_CONN_PARAMS + OFFSET_ACI_LL_CONN_PARAMS_T_MIN_CONN_INTERVAL_MSB) = (uint8_t)(p_aci_cmd_params_change_timing->conn_params.min_conn_interval >> 8);
- *(buffer + OFFSET_ACI_CMD_T_CHANGE_TIMING + OFFSET_ACI_CMD_PARAMS_CHANGE_TIMING_T_CONN_PARAMS + OFFSET_ACI_LL_CONN_PARAMS_T_MIN_CONN_INTERVAL_LSB) = (uint8_t)(p_aci_cmd_params_change_timing->conn_params.min_conn_interval);
- *(buffer + OFFSET_ACI_CMD_T_CHANGE_TIMING + OFFSET_ACI_CMD_PARAMS_CHANGE_TIMING_T_CONN_PARAMS + OFFSET_ACI_LL_CONN_PARAMS_T_MAX_CONN_INTERVAL_MSB) = (uint8_t)(p_aci_cmd_params_change_timing->conn_params.max_conn_interval >> 8);
- *(buffer + OFFSET_ACI_CMD_T_CHANGE_TIMING + OFFSET_ACI_CMD_PARAMS_CHANGE_TIMING_T_CONN_PARAMS + OFFSET_ACI_LL_CONN_PARAMS_T_MAX_CONN_INTERVAL_LSB) = (uint8_t)(p_aci_cmd_params_change_timing->conn_params.max_conn_interval);
- *(buffer + OFFSET_ACI_CMD_T_CHANGE_TIMING + OFFSET_ACI_CMD_PARAMS_CHANGE_TIMING_T_CONN_PARAMS + OFFSET_ACI_LL_CONN_PARAMS_T_SLAVE_LATENCY_MSB ) = (uint8_t)(p_aci_cmd_params_change_timing->conn_params.slave_latency >> 8);
- *(buffer + OFFSET_ACI_CMD_T_CHANGE_TIMING + OFFSET_ACI_CMD_PARAMS_CHANGE_TIMING_T_CONN_PARAMS + OFFSET_ACI_LL_CONN_PARAMS_T_SLAVE_LATENCY_LSB ) = (uint8_t)(p_aci_cmd_params_change_timing->conn_params.slave_latency);
- *(buffer + OFFSET_ACI_CMD_T_CHANGE_TIMING + OFFSET_ACI_CMD_PARAMS_CHANGE_TIMING_T_CONN_PARAMS + OFFSET_ACI_LL_CONN_PARAMS_T_TIMEOUT_MULT_MSB ) = (uint8_t)(p_aci_cmd_params_change_timing->conn_params.timeout_mult >> 8);
- *(buffer + OFFSET_ACI_CMD_T_CHANGE_TIMING + OFFSET_ACI_CMD_PARAMS_CHANGE_TIMING_T_CONN_PARAMS + OFFSET_ACI_LL_CONN_PARAMS_T_TIMEOUT_MULT_LSB ) = (uint8_t)(p_aci_cmd_params_change_timing->conn_params.timeout_mult);
-}
-
-void acil_encode_cmd_set_app_latency(uint8_t *buffer, aci_cmd_params_set_app_latency_t *p_aci_cmd_params_set_app_latency)
-{
- *(buffer + OFFSET_ACI_CMD_T_LEN) = MSG_SET_APP_LATENCY_LEN;
- *(buffer + OFFSET_ACI_CMD_T_CMD_OPCODE) = ACI_CMD_SET_APP_LATENCY;
- *(buffer + OFFSET_ACI_CMD_T_SET_APP_LATENCY + OFFSET_ACI_CMD_PARAMS_SET_APP_LATENCY_T_MODE) = (uint8_t)( p_aci_cmd_params_set_app_latency->mode);
- *(buffer + OFFSET_ACI_CMD_T_SET_APP_LATENCY + OFFSET_ACI_CMD_PARAMS_SET_APP_LATENCY_T_LATENCY_MSB) = (uint8_t)( p_aci_cmd_params_set_app_latency->latency>>8);
- *(buffer + OFFSET_ACI_CMD_T_SET_APP_LATENCY + OFFSET_ACI_CMD_PARAMS_SET_APP_LATENCY_T_LATENCY_LSB) = (uint8_t)( p_aci_cmd_params_set_app_latency->latency);
-}
-
-void acil_encode_cmd_change_timing_req_GAP_PPCP(uint8_t *buffer)
-{
- *(buffer + OFFSET_ACI_CMD_T_LEN) = MSG_CHANGE_TIMING_LEN_GAP_PPCP;
- *(buffer + OFFSET_ACI_CMD_T_CMD_OPCODE) = ACI_CMD_CHANGE_TIMING;
-}
-
-
-void acil_encode_cmd_setup(uint8_t *buffer, aci_cmd_params_setup_t *p_aci_cmd_params_setup, uint8_t setup_data_size)
-{
- *(buffer + OFFSET_ACI_CMD_T_LEN) = setup_data_size + MSG_SETUP_CMD_BASE_LEN;
- *(buffer + OFFSET_ACI_CMD_T_CMD_OPCODE) = ACI_CMD_SETUP;
- memcpy((buffer + OFFSET_ACI_CMD_T_SETUP), &(p_aci_cmd_params_setup->setup_data[0]), setup_data_size);
-}
-
-void acil_encode_cmd_dtm_cmd(uint8_t *buffer, aci_cmd_params_dtm_cmd_t *p_aci_cmd_params_dtm_cmd)
-{
- *(buffer + OFFSET_ACI_CMD_T_LEN) = MSG_DTM_CMD;
- *(buffer + OFFSET_ACI_CMD_T_CMD_OPCODE) = ACI_CMD_DTM_CMD;
- *(buffer + OFFSET_ACI_CMD_T_DTM_CMD) = p_aci_cmd_params_dtm_cmd->cmd_msb;
- *(buffer + OFFSET_ACI_CMD_T_DTM_CMD + 1) = p_aci_cmd_params_dtm_cmd->cmd_lsb;
-}
-
-void acil_encode_cmd_send_data_ack(uint8_t *buffer, const uint8_t pipe_number )
-{
- *(buffer + OFFSET_ACI_CMD_T_LEN) = MSG_ACK_LEN;
- *(buffer + OFFSET_ACI_CMD_T_CMD_OPCODE) = ACI_CMD_SEND_DATA_ACK;
- *(buffer + OFFSET_ACI_CMD_T_SEND_DATA_ACK + OFFSET_ACI_CMD_PARAMS_SEND_DATA_ACK_T_PIPE_NUMBER) = pipe_number;
-}
-
-void acil_encode_cmd_send_data_nack(uint8_t *buffer, const uint8_t pipe_number, const uint8_t err_code )
-{
- *(buffer + OFFSET_ACI_CMD_T_LEN) = MSG_NACK_LEN;
- *(buffer + OFFSET_ACI_CMD_T_CMD_OPCODE) = ACI_CMD_SEND_DATA_NACK;
- *(buffer + OFFSET_ACI_CMD_T_SEND_DATA_NACK + OFFSET_ACI_CMD_PARAMS_SEND_DATA_NACK_T_PIPE_NUMBER) = pipe_number;
- *(buffer + OFFSET_ACI_CMD_T_SEND_DATA_NACK + OFFSET_ACI_CMD_PARAMS_SEND_DATA_NACK_T_ERROR_CODE) = err_code;
-}
-
-void acil_encode_cmd_bond_security_request(uint8_t *buffer)
-{
- *(buffer + OFFSET_ACI_CMD_T_LEN) = 1;
- *(buffer + OFFSET_ACI_CMD_T_CMD_OPCODE) = ACI_CMD_BOND_SECURITY_REQUEST;
-}
-
-void acil_encode_cmd_broadcast(uint8_t *buffer, aci_cmd_params_broadcast_t * p_aci_cmd_params_broadcast)
-{
- *(buffer + OFFSET_ACI_CMD_T_LEN) = MSG_BROADCAST_LEN;
- *(buffer + OFFSET_ACI_CMD_T_CMD_OPCODE) = ACI_CMD_BROADCAST;
- *(buffer + OFFSET_ACI_CMD_T_BROADCAST + OFFSET_ACI_CMD_PARAMS_BROADCAST_T_TIMEOUT_LSB) = (p_aci_cmd_params_broadcast->timeout & 0xff);
- *(buffer + OFFSET_ACI_CMD_T_BROADCAST + OFFSET_ACI_CMD_PARAMS_BROADCAST_T_TIMEOUT_MSB) = (uint8_t)(p_aci_cmd_params_broadcast->timeout >> 8);
- *(buffer + OFFSET_ACI_CMD_T_BROADCAST + OFFSET_ACI_CMD_PARAMS_BROADCAST_T_ADV_INTERVAL_LSB) = (p_aci_cmd_params_broadcast->adv_interval & 0xff);
- *(buffer + OFFSET_ACI_CMD_T_BROADCAST + OFFSET_ACI_CMD_PARAMS_BROADCAST_T_ADV_INTERVAL_MSB) = (uint8_t)(p_aci_cmd_params_broadcast->adv_interval >> 8);
-}
-
-void acil_encode_cmd_open_adv_pipes(uint8_t *buffer, aci_cmd_params_open_adv_pipe_t * p_aci_cmd_params_open_adv_pipe)
-{
- *(buffer + OFFSET_ACI_CMD_T_LEN) = MSG_OPEN_ADV_PIPES_LEN;
- *(buffer + OFFSET_ACI_CMD_T_CMD_OPCODE) = ACI_CMD_OPEN_ADV_PIPE;
- memcpy(buffer + OFFSET_ACI_CMD_T_OPEN_ADV_PIPE + OFFSET_ACI_CMD_PARAMS_OPEN_ADV_PIPE_T_PIPES, p_aci_cmd_params_open_adv_pipe->pipes, 8);
-}
-
-
-void acil_encode_cmd_set_key(uint8_t *buffer, aci_cmd_params_set_key_t *p_aci_cmd_params_set_key)
-{
- /*
- The length of the key is computed based on the type of key transaction.
- - Key Reject
- - Key type is passkey
- */
- uint8_t len;
-
- switch (p_aci_cmd_params_set_key->key_type)
- {
- case ACI_KEY_TYPE_INVALID:
- len = MSG_SET_KEY_REJECT_LEN;
- break;
- case ACI_KEY_TYPE_PASSKEY:
- len = MSG_SET_KEY_PASSKEY_LEN;
- break;
- default:
- len=0;
- break;
- }
- *(buffer + OFFSET_ACI_CMD_T_LEN) = len;
- *(buffer + OFFSET_ACI_CMD_T_CMD_OPCODE) = ACI_CMD_SET_KEY;
- *(buffer + OFFSET_ACI_CMD_T_SET_KEY + OFFSET_ACI_CMD_PARAMS_SET_KEY_T_KEY_TYPE) = p_aci_cmd_params_set_key->key_type;
- memcpy((buffer + OFFSET_ACI_CMD_T_SET_KEY + OFFSET_ACI_CMD_PARAMS_SET_KEY_T_PASSKEY), (uint8_t * )&(p_aci_cmd_params_set_key->key), len-2);//Reducing 2 for the opcode byte and type
-}
-
-bool acil_encode_cmd(uint8_t *buffer, aci_cmd_t *p_aci_cmd)
-{
- bool ret_val = false;
-
- switch(p_aci_cmd->cmd_opcode)
- {
- case ACI_CMD_TEST:
- acil_encode_cmd_set_test_mode(buffer, &(p_aci_cmd->params.test));
- break;
- case ACI_CMD_SLEEP:
- acil_encode_cmd_sleep(buffer);
- break;
- case ACI_CMD_GET_DEVICE_VERSION:
- acil_encode_cmd_get_device_version(buffer);
- break;
- case ACI_CMD_WAKEUP:
- acil_encode_cmd_wakeup(buffer);
- break;
- case ACI_CMD_ECHO:
- acil_encode_cmd_echo_msg(buffer, &(p_aci_cmd->params.echo), (p_aci_cmd->len - MSG_ECHO_MSG_CMD_BASE_LEN));
- break;
- case ACI_CMD_GET_BATTERY_LEVEL:
- acil_encode_cmd_battery_level(buffer);
- break;
- case ACI_CMD_GET_TEMPERATURE:
- acil_encode_cmd_temparature(buffer);
- break;
- case ACI_CMD_GET_DEVICE_ADDRESS:
- acil_encode_cmd_get_address(buffer);
- break;
- case ACI_CMD_SET_TX_POWER:
- acil_encode_cmd_set_radio_tx_power(buffer, &(p_aci_cmd->params.set_tx_power));
- break;
- case ACI_CMD_CONNECT:
- acil_encode_cmd_connect(buffer, &(p_aci_cmd->params.connect));
- break;
- case ACI_CMD_BOND:
- acil_encode_cmd_bond(buffer, &(p_aci_cmd->params.bond));
- break;
- case ACI_CMD_DISCONNECT:
- acil_encode_cmd_disconnect(buffer, &(p_aci_cmd->params.disconnect));
- break;
- case ACI_CMD_RADIO_RESET:
- acil_encode_baseband_reset(buffer);
- break;
- case ACI_CMD_CHANGE_TIMING:
- acil_encode_cmd_change_timing_req(buffer, &(p_aci_cmd->params.change_timing));
- break;
- case ACI_CMD_SETUP:
- acil_encode_cmd_setup(buffer, &(p_aci_cmd->params.setup), (p_aci_cmd->len - MSG_SETUP_CMD_BASE_LEN));
- break;
- case ACI_CMD_DTM_CMD:
- acil_encode_cmd_dtm_cmd(buffer, &(p_aci_cmd->params.dtm_cmd));
- break;
- case ACI_CMD_READ_DYNAMIC_DATA:
- acil_encode_cmd_read_dynamic_data(buffer);
- break;
- case ACI_CMD_WRITE_DYNAMIC_DATA:
- acil_encode_cmd_write_dynamic_data(buffer, p_aci_cmd->params.write_dynamic_data.seq_no, &(p_aci_cmd->params.write_dynamic_data.dynamic_data[0]), (p_aci_cmd->len - MSG_WRITE_DYNAMIC_DATA_BASE_LEN));
- break;
- case ACI_CMD_OPEN_REMOTE_PIPE:
- acil_encode_cmd_open_remote_pipe(buffer, &(p_aci_cmd->params.open_remote_pipe));
- break;
- case ACI_CMD_SEND_DATA:
- acil_encode_cmd_send_data(buffer, &(p_aci_cmd->params.send_data), (p_aci_cmd->len - MSG_SEND_DATA_BASE_LEN));
- break;
- case ACI_CMD_SEND_DATA_ACK:
- acil_encode_cmd_send_data_ack(buffer, p_aci_cmd->params.send_data_ack.pipe_number );
- break;
- case ACI_CMD_REQUEST_DATA:
- acil_encode_cmd_request_data(buffer, &(p_aci_cmd->params.request_data));
- break;
- case ACI_CMD_SET_LOCAL_DATA:
- acil_encode_cmd_set_local_data(buffer, (aci_cmd_params_set_local_data_t *)(&(p_aci_cmd->params.send_data)), (p_aci_cmd->len - MSG_SET_LOCAL_DATA_BASE_LEN));
- break;
- case ACI_CMD_BOND_SECURITY_REQUEST:
- acil_encode_cmd_bond_security_request(buffer);
- break;
- default:
- break;
- }
- return ret_val;
-}
-
-void acil_decode_evt_command_response(uint8_t *buffer_in, aci_evt_params_cmd_rsp_t *p_evt_params_cmd_rsp)
-{
- aci_evt_cmd_rsp_params_get_device_version_t *p_device_version;
- aci_evt_cmd_rsp_params_get_device_address_t *p_device_address;
- aci_evt_cmd_rsp_params_get_temperature_t *p_temperature;
- aci_evt_cmd_rsp_params_get_battery_level_t *p_batt_lvl;
- aci_evt_cmd_rsp_read_dynamic_data_t *p_read_dyn_data;
- aci_evt_cmd_rsp_params_dtm_cmd_t *p_dtm_evt;
-
- p_evt_params_cmd_rsp->cmd_opcode = (aci_cmd_opcode_t)*(buffer_in + OFFSET_ACI_EVT_T_CMD_RSP + OFFSET_ACI_EVT_PARAMS_CMD_RSP_T_CMD_OPCODE);
- p_evt_params_cmd_rsp->cmd_status = (aci_status_code_t)*(buffer_in + OFFSET_ACI_EVT_T_CMD_RSP + OFFSET_ACI_EVT_PARAMS_CMD_RSP_T_CMD_STATUS);
-
- switch (p_evt_params_cmd_rsp->cmd_opcode)
- {
- case ACI_CMD_GET_DEVICE_VERSION:
- p_device_version = &(p_evt_params_cmd_rsp->params.get_device_version);
- p_device_version->configuration_id = (uint16_t)*(buffer_in + OFFSET_ACI_EVT_T_CMD_RSP + OFFSET_ACI_EVT_PARAMS_CMD_RSP_T_GET_DEVICE_VERSION + OFFSET_ACI_EVT_CMD_RSP_PARAMS_GET_DEVICE_VERSION_T_CONFIGURATION_ID_LSB);
- p_device_version->configuration_id |= (uint16_t)*(buffer_in + OFFSET_ACI_EVT_T_CMD_RSP + OFFSET_ACI_EVT_PARAMS_CMD_RSP_T_GET_DEVICE_VERSION + OFFSET_ACI_EVT_CMD_RSP_PARAMS_GET_DEVICE_VERSION_T_CONFIGURATION_ID_MSB) << 8;
- p_device_version->aci_version = *(buffer_in + OFFSET_ACI_EVT_T_CMD_RSP + OFFSET_ACI_EVT_PARAMS_CMD_RSP_T_GET_DEVICE_VERSION + OFFSET_ACI_EVT_CMD_RSP_PARAMS_GET_DEVICE_VERSION_T_ACI_VERSION);
- p_device_version->setup_format = *(buffer_in + OFFSET_ACI_EVT_T_CMD_RSP + OFFSET_ACI_EVT_PARAMS_CMD_RSP_T_GET_DEVICE_VERSION + OFFSET_ACI_EVT_CMD_RSP_PARAMS_GET_DEVICE_VERSION_T_SETUP_FORMAT);
- p_device_version->setup_id = (uint32_t)*(buffer_in + OFFSET_ACI_EVT_T_CMD_RSP + OFFSET_ACI_EVT_PARAMS_CMD_RSP_T_GET_DEVICE_VERSION + OFFSET_ACI_EVT_CMD_RSP_PARAMS_GET_DEVICE_VERSION_T_SETUP_ID_LSB0);
- p_device_version->setup_id |= (uint32_t)*(buffer_in + OFFSET_ACI_EVT_T_CMD_RSP + OFFSET_ACI_EVT_PARAMS_CMD_RSP_T_GET_DEVICE_VERSION + OFFSET_ACI_EVT_CMD_RSP_PARAMS_GET_DEVICE_VERSION_T_SETUP_ID_LSB1) << 8;
- p_device_version->setup_id |= (uint32_t)*(buffer_in + OFFSET_ACI_EVT_T_CMD_RSP + OFFSET_ACI_EVT_PARAMS_CMD_RSP_T_GET_DEVICE_VERSION + OFFSET_ACI_EVT_CMD_RSP_PARAMS_GET_DEVICE_VERSION_T_SETUP_ID_MSB0) << 16;
- p_device_version->setup_id |= (uint32_t)*(buffer_in + OFFSET_ACI_EVT_T_CMD_RSP + OFFSET_ACI_EVT_PARAMS_CMD_RSP_T_GET_DEVICE_VERSION + OFFSET_ACI_EVT_CMD_RSP_PARAMS_GET_DEVICE_VERSION_T_SETUP_ID_MSB1) << 24;
- p_device_version->setup_status = *(buffer_in + OFFSET_ACI_EVT_T_CMD_RSP + OFFSET_ACI_EVT_PARAMS_CMD_RSP_T_GET_DEVICE_VERSION + OFFSET_ACI_EVT_CMD_RSP_PARAMS_GET_DEVICE_VERSION_T_SETUP_STATUS);
- break;
-
- case ACI_CMD_GET_DEVICE_ADDRESS:
- p_device_address = &(p_evt_params_cmd_rsp->params.get_device_address);
- memcpy((uint8_t *)(p_device_address->bd_addr_own), (buffer_in + OFFSET_ACI_EVT_T_CMD_RSP+OFFSET_ACI_EVT_PARAMS_CMD_RSP_T_GET_DEVICE_ADDRESS+OFFSET_ACI_EVT_CMD_RSP_PARAMS_GET_DEVICE_ADDRESS_T_BD_ADDR_OWN), BTLE_DEVICE_ADDRESS_SIZE);
- p_device_address->bd_addr_type = (aci_bd_addr_type_t) *(buffer_in + OFFSET_ACI_EVT_T_CMD_RSP+OFFSET_ACI_EVT_PARAMS_CMD_RSP_T_GET_DEVICE_ADDRESS+OFFSET_ACI_EVT_CMD_RSP_PARAMS_GET_DEVICE_ADDRESS_T_BD_ADDR_TYPE);
- break;
-
- case ACI_CMD_GET_TEMPERATURE:
- p_temperature = &(p_evt_params_cmd_rsp->params.get_temperature);
- p_temperature->temperature_value = (int16_t)*(buffer_in + OFFSET_ACI_EVT_T_CMD_RSP + OFFSET_ACI_EVT_PARAMS_CMD_RSP_T_GET_TEMPERATURE + OFFSET_ACI_EVT_CMD_RSP_PARAMS_GET_TEMPERATURE_T_TEMPERATURE_VALUE_LSB);
- p_temperature->temperature_value |= (int16_t)*(buffer_in + OFFSET_ACI_EVT_T_CMD_RSP + OFFSET_ACI_EVT_PARAMS_CMD_RSP_T_GET_TEMPERATURE + OFFSET_ACI_EVT_CMD_RSP_PARAMS_GET_TEMPERATURE_T_TEMPERATURE_VALUE_MSB) << 8;
- break;
-
- case ACI_CMD_GET_BATTERY_LEVEL:
- p_batt_lvl = &(p_evt_params_cmd_rsp->params.get_battery_level);
- p_batt_lvl->battery_level = (int16_t)*(buffer_in + OFFSET_ACI_EVT_T_CMD_RSP + OFFSET_ACI_EVT_PARAMS_CMD_RSP_T_GET_BATTERY_LEVEL + OFFSET_ACI_EVT_CMD_RSP_PARAMS_GET_BATTERY_LEVEL_T_BATTERY_LEVEL_LSB);
- p_batt_lvl->battery_level |= (int16_t)*(buffer_in + OFFSET_ACI_EVT_T_CMD_RSP + OFFSET_ACI_EVT_PARAMS_CMD_RSP_T_GET_BATTERY_LEVEL + OFFSET_ACI_EVT_CMD_RSP_PARAMS_GET_BATTERY_LEVEL_T_BATTERY_LEVEL_MSB) << 8;
- break;
-
- case ACI_CMD_READ_DYNAMIC_DATA:
- p_read_dyn_data = &(p_evt_params_cmd_rsp->params.read_dynamic_data);
- p_read_dyn_data->seq_no = (uint8_t)*(buffer_in + OFFSET_ACI_EVT_T_CMD_RSP + OFFSET_ACI_EVT_PARAMS_CMD_RSP_T_READ_DYNAMIC_DATA + OFFSET_ACI_EVT_CMD_RSP_READ_DYNAMIC_DATA_T_SEQ_NO);
- memcpy((uint8_t *)(p_read_dyn_data->dynamic_data), (buffer_in + OFFSET_ACI_EVT_T_CMD_RSP + OFFSET_ACI_EVT_PARAMS_CMD_RSP_T_READ_DYNAMIC_DATA + OFFSET_ACI_CMD_PARAMS_WRITE_DYNAMIC_DATA_T_DYNAMIC_DATA), ACIL_DECODE_EVT_GET_LENGTH(buffer_in) - 3); // 3 bytes subtracted account for EventCode, CommandOpCode and Status bytes.
- // Now that the p_read_dyn_data->dynamic_data will be pointing to memory location with enough space to accommodate upto 27 bytes of dynamic data received. This is because of the padding element in aci_evt_params_cmd_rsp_t
- break;
-
- case ACI_CMD_DTM_CMD:
- p_dtm_evt = &(p_evt_params_cmd_rsp->params.dtm_cmd);
- p_dtm_evt->evt_msb = (uint8_t)*(buffer_in + OFFSET_ACI_EVT_T_CMD_RSP + OFFSET_ACI_EVT_PARAMS_CMD_RSP_T_DTM_CMD + OFFSET_ACI_EVT_CMD_RSP_PARAMS_DTM_CMD_T_EVT_MSB);
- p_dtm_evt->evt_lsb = (uint8_t)*(buffer_in + OFFSET_ACI_EVT_T_CMD_RSP + OFFSET_ACI_EVT_PARAMS_CMD_RSP_T_DTM_CMD + OFFSET_ACI_EVT_CMD_RSP_PARAMS_DTM_CMD_T_EVT_LSB);
- break;
- }
-}
-
-void acil_decode_evt_device_started(uint8_t *buffer_in, aci_evt_params_device_started_t *p_evt_params_device_started)
-{
- p_evt_params_device_started->device_mode = (aci_device_operation_mode_t) *(buffer_in + OFFSET_ACI_EVT_T_DEVICE_STARTED+OFFSET_ACI_EVT_PARAMS_DEVICE_STARTED_T_DEVICE_MODE);
- p_evt_params_device_started->hw_error = (aci_hw_error_t) *(buffer_in + OFFSET_ACI_EVT_T_DEVICE_STARTED+OFFSET_ACI_EVT_PARAMS_DEVICE_STARTED_T_HW_ERROR);
- p_evt_params_device_started->credit_available = *(buffer_in + OFFSET_ACI_EVT_T_DEVICE_STARTED+OFFSET_ACI_EVT_PARAMS_DEVICE_STARTED_T_CREDIT_AVAILABLE);
-}
-
-void acil_decode_evt_pipe_status(uint8_t *buffer_in, aci_evt_params_pipe_status_t *p_aci_evt_params_pipe_status)
-{
- memcpy((uint8_t *)p_aci_evt_params_pipe_status->pipes_open_bitmap, (buffer_in + OFFSET_ACI_EVT_T_PIPE_STATUS + OFFSET_ACI_EVT_PARAMS_PIPE_STATUS_T_PIPES_OPEN_BITMAP), 8);
- memcpy((uint8_t *)p_aci_evt_params_pipe_status->pipes_closed_bitmap, (buffer_in + OFFSET_ACI_EVT_T_PIPE_STATUS + OFFSET_ACI_EVT_PARAMS_PIPE_STATUS_T_PIPES_CLOSED_BITMAP), 8);
-}
-
-void acil_decode_evt_disconnected(uint8_t *buffer_in, aci_evt_params_disconnected_t *p_aci_evt_params_disconnected)
-{
- p_aci_evt_params_disconnected->aci_status = (aci_status_code_t)*(buffer_in + OFFSET_ACI_EVT_T_DISCONNECTED + OFFSET_ACI_EVT_PARAMS_DISCONNECTED_T_ACI_STATUS);
- p_aci_evt_params_disconnected->btle_status = *(buffer_in + OFFSET_ACI_EVT_T_DISCONNECTED + OFFSET_ACI_EVT_PARAMS_DISCONNECTED_T_BTLE_STATUS);
-}
-
-void acil_decode_evt_bond_status(uint8_t *buffer_in, aci_evt_params_bond_status_t *p_aci_evt_params_bond_status)
-{
- p_aci_evt_params_bond_status->status_code = (aci_bond_status_code_t)*(buffer_in + OFFSET_ACI_EVT_T_BOND_STATUS + OFFSET_ACI_EVT_PARAMS_BOND_STATUS_T_STATUS_CODE);
- p_aci_evt_params_bond_status->status_source = (aci_bond_status_source_t)*(buffer_in + OFFSET_ACI_EVT_T_BOND_STATUS + OFFSET_ACI_EVT_PARAMS_BOND_STATUS_T_STATUS_SOURCE);
- p_aci_evt_params_bond_status->secmode1_bitmap = *(buffer_in + OFFSET_ACI_EVT_T_BOND_STATUS + OFFSET_ACI_EVT_PARAMS_BOND_STATUS_T_SECMODE1_BITMAP);
- p_aci_evt_params_bond_status->secmode2_bitmap = *(buffer_in + OFFSET_ACI_EVT_T_BOND_STATUS + OFFSET_ACI_EVT_PARAMS_BOND_STATUS_T_SECMODE2_BITMAP);
- p_aci_evt_params_bond_status->keys_exchanged_slave = *(buffer_in + OFFSET_ACI_EVT_T_BOND_STATUS + OFFSET_ACI_EVT_PARAMS_BOND_STATUS_T_KEYS_EXCHANGED_SLAVE);
- p_aci_evt_params_bond_status->keys_exchanged_master = *(buffer_in + OFFSET_ACI_EVT_T_BOND_STATUS + OFFSET_ACI_EVT_PARAMS_BOND_STATUS_T_KEYS_EXCHANGED_MASTER);
-}
-
-uint8_t acil_decode_evt_data_received(uint8_t *buffer_in, aci_evt_params_data_received_t *p_evt_params_data_received)
-{
- uint8_t size = *( buffer_in + OFFSET_ACI_EVT_T_LEN) - (OFFSET_ACI_EVT_T_DATA_RECEIVED + OFFSET_ACI_RX_DATA_T_ACI_DATA) + 1 ;
- p_evt_params_data_received->rx_data.pipe_number = *(buffer_in + OFFSET_ACI_EVT_T_DATA_RECEIVED + OFFSET_ACI_RX_DATA_T_PIPE_NUMBER);
- memcpy((uint8_t *)p_evt_params_data_received->rx_data.aci_data, (buffer_in + OFFSET_ACI_EVT_T_DATA_RECEIVED + OFFSET_ACI_RX_DATA_T_ACI_DATA), size);
- return size;
-}
-
-void acil_decode_evt_data_ack(uint8_t *buffer_in, aci_evt_params_data_ack_t *p_evt_params_data_ack)
-{
- p_evt_params_data_ack->pipe_number = *(buffer_in + OFFSET_ACI_EVT_T_DATA_ACK + OFFSET_ACI_EVT_PARAMS_DATA_ACK_T_PIPE_NUMBER);
-}
-
-uint8_t acil_decode_evt_hw_error(uint8_t *buffer_in, aci_evt_params_hw_error_t *p_aci_evt_params_hw_error)
-{
- uint8_t size = *(buffer_in + OFFSET_ACI_EVT_T_LEN) - (OFFSET_ACI_EVT_T_HW_ERROR + OFFSET_ACI_EVT_PARAMS_HW_ERROR_T_FILE_NAME) + 1;
- p_aci_evt_params_hw_error->line_num = (uint16_t)(*(buffer_in + OFFSET_ACI_EVT_T_HW_ERROR + OFFSET_ACI_EVT_PARAMS_HW_ERROR_T_LINE_NUM_MSB)) << 8;
- p_aci_evt_params_hw_error->line_num |= (uint16_t)*(buffer_in + OFFSET_ACI_EVT_T_HW_ERROR + OFFSET_ACI_EVT_PARAMS_HW_ERROR_T_LINE_NUM_LSB);
- memcpy((uint8_t *)p_aci_evt_params_hw_error->file_name, (buffer_in + OFFSET_ACI_EVT_T_HW_ERROR + OFFSET_ACI_EVT_PARAMS_HW_ERROR_T_FILE_NAME), size);
- return size;
-}
-
-void acil_decode_evt_credit(uint8_t *buffer_in, aci_evt_params_data_credit_t *p_evt_params_data_credit)
-{
- p_evt_params_data_credit->credit = *(buffer_in + OFFSET_ACI_EVT_T_DATA_CREDIT + OFFSET_ACI_EVT_PARAMS_DATA_CREDIT_T_CREDIT);
-}
-
-void acil_decode_evt_connected(uint8_t *buffer_in, aci_evt_params_connected_t *p_aci_evt_params_connected)
-{
- p_aci_evt_params_connected->dev_addr_type = (aci_bd_addr_type_t)*(buffer_in + OFFSET_ACI_EVT_T_CONNECTED + OFFSET_ACI_EVT_PARAMS_CONNECTED_T_DEV_ADDR_TYPE);
- memcpy(&(p_aci_evt_params_connected->dev_addr[0]), (buffer_in + OFFSET_ACI_EVT_T_CONNECTED + OFFSET_ACI_EVT_PARAMS_CONNECTED_T_DEV_ADDR), BTLE_DEVICE_ADDRESS_SIZE);
- p_aci_evt_params_connected->conn_rf_interval = (uint16_t)*(buffer_in + OFFSET_ACI_EVT_T_CONNECTED + OFFSET_ACI_EVT_PARAMS_CONNECTED_T_CONN_RF_INTERVAL_MSB) << 8;
- p_aci_evt_params_connected->conn_rf_interval |= (uint16_t)*(buffer_in + OFFSET_ACI_EVT_T_CONNECTED + OFFSET_ACI_EVT_PARAMS_CONNECTED_T_CONN_RF_INTERVAL_LSB);
- p_aci_evt_params_connected->conn_slave_rf_latency = (uint16_t)*(buffer_in + OFFSET_ACI_EVT_T_CONNECTED + OFFSET_ACI_EVT_PARAMS_CONNECTED_T_CONN_SLAVE_RF_LATENCY_MSB) << 8;
- p_aci_evt_params_connected->conn_slave_rf_latency |= (uint16_t)*(buffer_in + OFFSET_ACI_EVT_T_CONNECTED + OFFSET_ACI_EVT_PARAMS_CONNECTED_T_CONN_SLAVE_RF_LATENCY_LSB);
- p_aci_evt_params_connected->conn_rf_timeout = (uint16_t)*(buffer_in + OFFSET_ACI_EVT_T_CONNECTED + OFFSET_ACI_EVT_PARAMS_CONNECTED_T_CONN_RF_TIMEOUT_MSB) << 8;
- p_aci_evt_params_connected->conn_rf_timeout |= (uint16_t)*(buffer_in + OFFSET_ACI_EVT_T_CONNECTED + OFFSET_ACI_EVT_PARAMS_CONNECTED_T_CONN_RF_TIMEOUT_LSB);
- p_aci_evt_params_connected->master_clock_accuracy = (aci_clock_accuracy_t)*(buffer_in + OFFSET_ACI_EVT_T_CONNECTED + OFFSET_ACI_EVT_PARAMS_CONNECTED_T_MASTER_CLOCK_ACCURACY);
-
-}
-
-void acil_decode_evt_timing(uint8_t *buffer_in, aci_evt_params_timing_t *p_evt_params_timing)
-{
- p_evt_params_timing->conn_rf_interval = *(buffer_in + OFFSET_ACI_EVT_T_TIMING + OFFSET_ACI_EVT_PARAMS_TIMING_T_CONN_RF_INTERVAL_MSB) << 8;
- p_evt_params_timing->conn_rf_interval |= (uint16_t)*(buffer_in + OFFSET_ACI_EVT_T_TIMING + OFFSET_ACI_EVT_PARAMS_TIMING_T_CONN_RF_INTERVAL_LSB);
- p_evt_params_timing->conn_slave_rf_latency = (uint16_t)*(buffer_in + OFFSET_ACI_EVT_T_TIMING + OFFSET_ACI_EVT_PARAMS_TIMING_T_CONN_SLAVE_RF_LATENCY_MSB) << 8;
- p_evt_params_timing->conn_slave_rf_latency |= (uint16_t)*(buffer_in + OFFSET_ACI_EVT_T_TIMING + OFFSET_ACI_EVT_PARAMS_TIMING_T_CONN_SLAVE_RF_LATENCY_LSB);
- p_evt_params_timing->conn_rf_timeout = (uint16_t)*(buffer_in + OFFSET_ACI_EVT_T_TIMING + OFFSET_ACI_EVT_PARAMS_TIMING_T_CONN_RF_TIMEOUT_MSB) << 8;
- p_evt_params_timing->conn_rf_timeout |= *(buffer_in + OFFSET_ACI_EVT_T_TIMING + OFFSET_ACI_EVT_PARAMS_TIMING_T_CONN_RF_TIMEOUT_LSB);
-}
-
-void acil_decode_evt_pipe_error(uint8_t *buffer_in, aci_evt_params_pipe_error_t *p_evt_params_pipe_error)
-{
- //volatile uint8_t size = *(buffer_in + OFFSET_ACI_EVT_T_LEN) - (OFFSET_ACI_EVT_T_PIPE_ERROR + OFFSET_ACI_EVT_PARAMS_PIPE_ERROR_T_ERROR_DATA) + 1;
- p_evt_params_pipe_error->pipe_number = *(buffer_in + OFFSET_ACI_EVT_T_PIPE_ERROR + OFFSET_ACI_EVT_PARAMS_PIPE_ERROR_T_PIPE_NUMBER);
- p_evt_params_pipe_error->error_code = *(buffer_in + OFFSET_ACI_EVT_T_PIPE_ERROR + OFFSET_ACI_EVT_PARAMS_PIPE_ERROR_T_ERROR_CODE);
- p_evt_params_pipe_error->params.error_data.content[0] = *(buffer_in + OFFSET_ACI_EVT_T_PIPE_ERROR + OFFSET_ACI_EVT_PARAMS_PIPE_ERROR_T_ERROR_DATA + OFFSET_ERROR_DATA_T_CONTENT);
-}
-
-void acil_decode_evt_key_request(uint8_t *buffer_in, aci_evt_params_key_request_t *p_evt_params_key_request)
-{
- p_evt_params_key_request->key_type = (aci_key_type_t)*(buffer_in + OFFSET_ACI_EVT_T_KEY_REQUEST + OFFSET_ACI_EVT_PARAMS_KEY_REQUEST_T_KEY_TYPE);
-}
-
-uint8_t acil_decode_evt_echo(uint8_t *buffer_in, aci_evt_params_echo_t *aci_evt_params_echo)
-{
- uint8_t size = *(buffer_in + OFFSET_ACI_EVT_T_LEN) - 1;
- memcpy(&aci_evt_params_echo->echo_data[0], (buffer_in + OFFSET_ACI_EVT_T_EVT_OPCODE + 1), size);
- return size;
-}
-
-void acil_decode_evt_display_passkey(uint8_t *buffer_in, aci_evt_params_display_passkey_t *p_aci_evt_params_display_passkey)
-{
- p_aci_evt_params_display_passkey->passkey[0] = *(buffer_in + OFFSET_ACI_EVT_T_DISPLAY_PASSKEY + OFFSET_ACI_EVT_PARAMS_DISPLAY_PASSKEY_T_PASSKEY + 0);
- p_aci_evt_params_display_passkey->passkey[1] = *(buffer_in + OFFSET_ACI_EVT_T_DISPLAY_PASSKEY + OFFSET_ACI_EVT_PARAMS_DISPLAY_PASSKEY_T_PASSKEY + 1);
- p_aci_evt_params_display_passkey->passkey[2] = *(buffer_in + OFFSET_ACI_EVT_T_DISPLAY_PASSKEY + OFFSET_ACI_EVT_PARAMS_DISPLAY_PASSKEY_T_PASSKEY + 2);
- p_aci_evt_params_display_passkey->passkey[3] = *(buffer_in + OFFSET_ACI_EVT_T_DISPLAY_PASSKEY + OFFSET_ACI_EVT_PARAMS_DISPLAY_PASSKEY_T_PASSKEY + 3);
- p_aci_evt_params_display_passkey->passkey[4] = *(buffer_in + OFFSET_ACI_EVT_T_DISPLAY_PASSKEY + OFFSET_ACI_EVT_PARAMS_DISPLAY_PASSKEY_T_PASSKEY + 4);
- p_aci_evt_params_display_passkey->passkey[5] = *(buffer_in + OFFSET_ACI_EVT_T_DISPLAY_PASSKEY + OFFSET_ACI_EVT_PARAMS_DISPLAY_PASSKEY_T_PASSKEY + 5);
-}
-
-bool acil_decode_evt(uint8_t *buffer_in, aci_evt_t *p_aci_evt)
-{
- bool ret_val = true;
-
- p_aci_evt->len = ACIL_DECODE_EVT_GET_LENGTH(buffer_in);
- p_aci_evt->evt_opcode = (aci_evt_opcode_t)ACIL_DECODE_EVT_GET_OPCODE(buffer_in);
-
- switch(p_aci_evt->evt_opcode)
- {
- case ACI_EVT_DEVICE_STARTED:
- acil_decode_evt_device_started(buffer_in, &(p_aci_evt->params.device_started));
- break;
- case ACI_EVT_HW_ERROR:
- acil_decode_evt_hw_error(buffer_in, &(p_aci_evt->params.hw_error));
- break;
- case ACI_EVT_CMD_RSP:
- acil_decode_evt_command_response(buffer_in, &(p_aci_evt->params.cmd_rsp));
- break;
- case ACI_EVT_DATA_CREDIT:
- acil_decode_evt_credit(buffer_in, &(p_aci_evt->params.data_credit));
- break;
- case ACI_EVT_CONNECTED:
- acil_decode_evt_connected(buffer_in, &(p_aci_evt->params.connected));
- break;
- case ACI_EVT_PIPE_STATUS:
- acil_decode_evt_pipe_status(buffer_in, &(p_aci_evt->params.pipe_status));
- break;
- case ACI_EVT_DISCONNECTED:
- acil_decode_evt_disconnected(buffer_in, &(p_aci_evt->params.disconnected));
- break;
- case ACI_EVT_BOND_STATUS:
- acil_decode_evt_bond_status(buffer_in, &(p_aci_evt->params.bond_status));
- break;
- case ACI_EVT_TIMING:
- acil_decode_evt_timing(buffer_in, &(p_aci_evt->params.timing));
- break;
- case ACI_EVT_DATA_ACK:
- acil_decode_evt_data_ack(buffer_in, &(p_aci_evt->params.data_ack));
- break;
- case ACI_EVT_DATA_RECEIVED:
- acil_decode_evt_data_received(buffer_in, &(p_aci_evt->params.data_received));
- break;
- case ACI_EVT_PIPE_ERROR:
- acil_decode_evt_pipe_error(buffer_in, &(p_aci_evt->params.pipe_error));
- break;
- case ACI_EVT_KEY_REQUEST:
- acil_decode_evt_key_request(buffer_in, &(p_aci_evt->params.key_request));
- break;
- case ACI_EVT_DISPLAY_PASSKEY:
- acil_decode_evt_display_passkey(buffer_in, &(p_aci_evt->params.display_passkey));
- break;
- default:
- ret_val = false;
- break;
- }
- return ret_val;
-}
diff --git a/peripheral/libupm/src/nrf8001/acilib.h b/peripheral/libupm/src/nrf8001/acilib.h
deleted file mode 100644
index d7d20c0..0000000
--- a/peripheral/libupm/src/nrf8001/acilib.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* Copyright (c) 2014, Nordic Semiconductor ASA
- *
- * 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.
- */
-
-/**
- * @file
- *
- * @ingroup aci-lib
- *
- * @brief Internal prototype for acilib module.
- */
-
-#ifndef _acilib_H_
-#define _acilib_H_
-
-#define MSG_SET_LOCAL_DATA_BASE_LEN 2
-#define MSG_CONNECT_LEN 5
-#define MSG_BOND_LEN 5
-#define MSG_DISCONNECT_LEN 2
-#define MSG_BASEBAND_RESET_LEN 1
-#define MSG_WAKEUP_LEN 1
-#define MSG_SET_RADIO_TX_POWER_LEN 2
-#define MSG_GET_DEVICE_ADDR_LEN 1
-#define MSG_SEND_DATA_BASE_LEN 2
-#define MSG_DATA_REQUEST_LEN 2
-#define MSG_OPEN_REMOTE_PIPE_LEN 2
-#define MSG_CLOSE_REMOTE_PIPE_LEN 2
-#define MSG_DTM_CMD 3
-#define MSG_WRITE_DYNAMIC_DATA_BASE_LEN 2
-#define MSG_SETUP_CMD_BASE_LEN 1
-#define MSG_ECHO_MSG_CMD_BASE_LEN 1
-#define MSG_CHANGE_TIMING_LEN 9
-#define MSG_SET_APP_LATENCY_LEN 4
-#define MSG_CHANGE_TIMING_LEN_GAP_PPCP 1
-#define MSG_DIRECT_CONNECT_LEN 1
-#define MSG_SET_KEY_REJECT_LEN 2
-#define MSG_SET_KEY_PASSKEY_LEN 8
-#define MSG_SET_KEY_OOB_LEN 18
-#define MSG_ACK_LEN 2
-#define MSG_NACK_LEN 3
-#define MSG_BROADCAST_LEN 5
-#define MSG_OPEN_ADV_PIPES_LEN 9
-
-#endif /* _acilib_H_ */
diff --git a/peripheral/libupm/src/nrf8001/acilib_defs.h b/peripheral/libupm/src/nrf8001/acilib_defs.h
deleted file mode 100644
index c193415..0000000
--- a/peripheral/libupm/src/nrf8001/acilib_defs.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Copyright (c) 2014, Nordic Semiconductor ASA
- *
- * 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.
- */
-
-/**
- * @file
- *
- * @ingroup aci-lib
- *
- * @brief Definitions for the acilib interfaces
- */
-
-#ifndef _acilib_DEFS_H_
-#define _acilib_DEFS_H_
-
-#define ACIL_DECODE_EVT_GET_LENGTH(buffer_in) (*(buffer_in + OFFSET_ACI_EVT_T_LEN))
-
-#define ACIL_DECODE_EVT_GET_OPCODE(buffer_in) (*(buffer_in + OFFSET_ACI_EVT_T_EVT_OPCODE))
-
-#endif /* _acilib_DEFS_H_ */
diff --git a/peripheral/libupm/src/nrf8001/acilib_if.h b/peripheral/libupm/src/nrf8001/acilib_if.h
deleted file mode 100644
index 483e893..0000000
--- a/peripheral/libupm/src/nrf8001/acilib_if.h
+++ /dev/null
@@ -1,471 +0,0 @@
-/* Copyright (c) 2014, Nordic Semiconductor ASA
- *
- * 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.
- */
-
-/**
- * @file
- *
- * @ingroup aci-lib
- *
- * @brief Prototypes for the acilib interfaces.
- */
-
-#ifndef _acilib_IF_H_
-#define _acilib_IF_H_
-
-/** @brief Encode the ACI message for set test mode command
- *
- * @param[in,out] buffer Pointer to ACI message buffer
- * @param[in] test_mode Pointer to the test mode in ::aci_cmd_params_test_t
- *
- * @return None
- */
-void acil_encode_cmd_set_test_mode(uint8_t *buffer, aci_cmd_params_test_t *p_aci_cmd_params_test);
-
-/** @brief Encode the ACI message for sleep command
- *
- * @param[in,out] buffer Pointer to ACI message buffer
- *
- * @return None
- */
-void acil_encode_cmd_sleep(uint8_t *buffer);
-
-/** @brief Encode the ACI message for get device version
- *
- * @param[in,out] buffer Pointer to ACI message buffer
- *
- * @return None
- */
-void acil_encode_cmd_get_device_version(uint8_t *buffer);
-
-/** @brief Encode the ACI message for set local data
- *
- * @param[in,out] buffer Pointer to ACI message buffer
- * @param[in] p_aci_cmd_params_set_local_data Pointer to the local data parameters in ::aci_cmd_params_set_local_data_t
- * @param[in] data_size Size of data message
- *
- * @return None
- */
-void acil_encode_cmd_set_local_data(uint8_t *buffer, aci_cmd_params_set_local_data_t *p_aci_cmd_params_set_local_data, uint8_t data_size);
-
-/** @brief Encode the ACI message to connect
- *
- * @param[in,out] buffer Pointer to ACI message buffer
- * @param[in] p_aci_cmd_params_connect Pointer to the run parameters in ::aci_cmd_params_connect_t
- *
- * @return None
- */
-void acil_encode_cmd_connect(uint8_t *buffer, aci_cmd_params_connect_t *p_aci_cmd_params_connect);
-
-/** @brief Encode the ACI message to bond
- *
- * @param[in,out] buffer Pointer to ACI message buffer
- * @param[in] p_aci_cmd_params_bond Pointer to the run parameters in ::aci_cmd_params_bond_t
- *
- * @return None
- */
-void acil_encode_cmd_bond(uint8_t *buffer, aci_cmd_params_bond_t *p_aci_cmd_params_bond);
-
-/** @brief Encode the ACI message to disconnect
- *
- * @param[in,out] buffer Pointer to ACI message buffer
- * @param[in] p_aci_cmd_params_disconnect Pointer to the run parameters in ::aci_cmd_params_disconnect_t
- *
- * @return None
- */
-void acil_encode_cmd_disconnect(uint8_t *buffer, aci_cmd_params_disconnect_t *p_aci_cmd_params_disconnect);
-
-/** @brief Encode the ACI message to baseband reset
- *
- * @param[in,out] buffer Pointer to ACI message buffer
- *
- * @return None
- */
- void acil_encode_baseband_reset(uint8_t *buffer);
-
- /** @brief Encode the ACI message for Directed Advertising
- *
- * @param[in,out] buffer Pointer to ACI message buffer
- *
- * @return None
- */
- void acil_encode_direct_connect(uint8_t *buffer);
-
-/** @brief Encode the ACI message to wakeup
- *
- * @param[in,out] buffer Pointer to ACI message buffer
- *
- * @return None
- */
-void acil_encode_cmd_wakeup(uint8_t *buffer);
-
-/** @brief Encode the ACI message for set radio Tx power
- *
- * @param[in,out] buffer Pointer to ACI message buffer
- * @param[in] p_aci_cmd_params_set_tx_power Pointer to the set Tx power parameters in ::aci_cmd_params_set_tx_power_t
- *
- * @return None
- */
-void acil_encode_cmd_set_radio_tx_power(uint8_t *buffer, aci_cmd_params_set_tx_power_t *p_aci_cmd_params_set_tx_power);
-
-/** @brief Encode the ACI message for get device address
- *
- * @param[in,out] buffer Pointer to ACI message buffer
- *
- * @return None
- */
-void acil_encode_cmd_get_address(uint8_t *buffer);
-
-/** @brief Encode the ACI message for send data
- *
- * @param[in,out] buffer Pointer to ACI message buffer
- * @param[in] p_aci_cmd_params_send_data_t Pointer to the data parameters in ::aci_cmd_params_send_data_t
- * @param[in] data_size Size of data message
- *
- * @return None
- */
-void acil_encode_cmd_send_data(uint8_t *buffer, aci_cmd_params_send_data_t *p_aci_cmd_params_send_data_t, uint8_t data_size);
-
-/** @brief Encode the ACI message for request data
- *
- * @param[in,out] buffer Pointer to ACI message buffer
- * @param[in] p_aci_cmd_params_request_data Pointer to the request data parameters in ::aci_cmd_params_request_data_t
- *
- * @return None
- */
-void acil_encode_cmd_request_data(uint8_t *buffer, aci_cmd_params_request_data_t *p_aci_cmd_params_request_data);
-
-/** @brief Encode the ACI message for open remote pipe
- *
- * @param[in,out] buffer Pointer to ACI message buffer
- * @param[in] p_aci_cmd_params_open_remote_pipe Pointer to the dynamic data parameters in ::aci_cmd_params_open_remote_pipe_t
- *
- * @return None
- */
-void acil_encode_cmd_open_remote_pipe(uint8_t *buffer, aci_cmd_params_open_remote_pipe_t *p_aci_cmd_params_open_remote_pipe);
-
-/** @brief Encode the ACI message for close remote pipe
- *
- * @param[in,out] buffer Pointer to ACI message buffer
- * @param[in] p_aci_cmd_params_close_remote_pipe Pointer to the dynamic data parameters in ::aci_cmd_params_close_remote_pipe_t
- *
- * @return None
- */
-void acil_encode_cmd_close_remote_pipe(uint8_t *buffer, aci_cmd_params_close_remote_pipe_t *p_aci_cmd_params_close_remote_pipe);
-
-/** @brief Encode the ACI message for echo message
- *
- * @param[in,out] buffer Pointer to ACI message buffer
- * @param[in] p_cmd_params_echo Pointer to the dynamic data parameters in ::aci_cmd_params_echo_t
- * @param[in] msg_size Size of the message
- *
- * @return None
- */
-void acil_encode_cmd_echo_msg(uint8_t *buffer, aci_cmd_params_echo_t *p_cmd_params_echo, uint8_t msg_size);
-
-/** @brief Encode the ACI message to battery level
- *
- * @param[in,out] buffer Pointer to ACI message buffer
- *
- * @return None
- */
-void acil_encode_cmd_battery_level(uint8_t *buffer);
-
-/** @brief Encode the ACI message to temparature
- *
- * @param[in,out] buffer Pointer to ACI message buffer
- *
- * @return None
- */
-void acil_encode_cmd_temparature(uint8_t *buffer);
-
-/** @brief Encode the ACI message to read dynamic data
- *
- * @param[in,out] buffer Pointer to ACI message buffer
- *
- * @return None
- */
-void acil_encode_cmd_read_dynamic_data(uint8_t *buffer);
-
-/** @brief Encode the ACI message to change timing request
- *
- * @param[in,out] buffer Pointer to ACI message buffer
- * @param[in] p_aci_cmd_params_change_timing Pointer to the change timing parameters in ::aci_cmd_params_change_timing_t
- *
- * @return None
- */
-void acil_encode_cmd_change_timing_req(uint8_t *buffer, aci_cmd_params_change_timing_t *p_aci_cmd_params_change_timing);
-
-/** @brief Encode the ACI message to change timing request using the timing parameters from GAP PPCP
- *
- * @param[in,out] buffer Pointer to ACI message buffer
- * @param[in] p_aci_cmd_params_change_timing Pointer to the change timing parameters in ::aci_cmd_params_change_timing_t
- *
- * @return None
- */
-void acil_encode_cmd_change_timing_req_GAP_PPCP(uint8_t *buffer);
-
-
-/** @brief Encode the ACI message for write dynamic data
- *
- * @param[in,out] buffer Pointer to ACI message buffer
- * @param[in] seq_no Sequence number of the dynamic data (as received in the response to @c Read Dynamic Data)
- * @param[in] dynamic_data Pointer to the dynamic data
- * @param[in] dynamic_data_size Size of dynamic data
- *
- * @return None
- */
-void acil_encode_cmd_write_dynamic_data(uint8_t *buffer, uint8_t seq_no, uint8_t* dynamic_data, uint8_t dynamic_data_size);
-
-/** @brief Encode the ACI message to send data acknowledgement
- *
- * @param[in,out] buffer Pointer to ACI message buffer
- * @param[in] pipe_number Pipe number for which the ack is to be sent
- *
- * @return None
- */
-void acil_encode_cmd_send_data_ack(uint8_t *buffer, const uint8_t pipe_number);
-
-/** @brief Encode the ACI message to send negative acknowledgement
- *
- * @param[in,out] buffer Pointer to ACI message buffer
- * @param[in] pipe_number Pipe number for which the nack is to be sent
- * @param[in] error_code Error code that has to be sent in the NACK
- *
- * @return None
- */
-void acil_encode_cmd_send_data_nack(uint8_t *buffer, const uint8_t pipe_number,const uint8_t error_code);
-
-/** @brief Encode the ACI message to set the application latency
- *
- * @param[in,out] buffer Pointer to ACI message buffer
- * @param[in] p_aci_cmd_params_set_app_latency Pointer to the set_application_latency command parameters in ::aci_cmd_params_dtm_cmd_t
- *
- * @return None
- */
-void acil_encode_cmd_set_app_latency(uint8_t *buffer, aci_cmd_params_set_app_latency_t *p_aci_cmd_params_set_app_latency);
-
-/** @brief Encode the ACI message for setup
- *
- * @param[in,out] buffer Pointer to ACI message buffer
- * @param[in] p_cmd_params_set_run_behaviour Pointer to the setup data in ::aci_cmd_params_setup_t
- * @param[in] setup_data_size Size of setup message
- *
- * @return None
- */
-void acil_encode_cmd_setup(uint8_t *buffer, aci_cmd_params_setup_t *p_aci_cmd_params_setup, uint8_t setup_data_size);
-
-/** @brief Encode the ACI message for DTM command
- *
- * @param[in,out] buffer Pointer to ACI message buffer
- * @param[in] p_cmd_params_set_run_behaviour Pointer to the DTM command parameters in ::aci_cmd_params_dtm_cmd_t
- *
- * @return None
- */
-void acil_encode_cmd_dtm_cmd(uint8_t *buffer, aci_cmd_params_dtm_cmd_t *p_aci_cmd_params_dtm_cmd);
-
-/** @brief Encode the ACI message for Set Key Request command
- *
- * @param[in,out] buffer Pointer to ACI message buffer
- *
- * @return None
- */
-void acil_encode_cmd_set_key(uint8_t *buffer, aci_cmd_params_set_key_t *p_aci_cmd_params_set_key);
-
-/** @brief Encode the ACI message for Bond Security Request command
- *
- * @param[in,out] buffer Pointer to ACI message buffer
- *
- * @return None
- */
-void acil_encode_cmd_bond_security_request(uint8_t *buffer);
-
-/** @brief Encode the ACI message
- *
- * @param[in,out] buffer Pointer to ACI message buffer
- * @param[in] p_aci_cmd Pointer to ACI command data in ::aci_cmd_t
- * @param[in] bool
- *
- * @return bool true, if succesful, else returns false
- */
-bool acil_encode_cmd(uint8_t *buffer, aci_cmd_t *p_aci_cmd);
-
-/** @brief Encode the ACI message for Broadcast command
- *
- * @param[in,out] buffer Pointer to ACI message buffer
- * @param[in] p_aci_cmd Pointer to ACI command data in ::aci_cmd_params_broadcast_t
- *
- * @return None
- */
-void acil_encode_cmd_broadcast(uint8_t *buffer, aci_cmd_params_broadcast_t * p_aci_cmd_params_broadcast);
-
-/** @brief Encode the ACI message for Open Adv Pipes
- *
- * @param[in,out] buffer Pointer to ACI message buffer
- * @param[in] p_aci_cmd Pointer to ACI command data in ::aci_cmd_params_open_adv_pipe_t
- *
- * @return None
- */
-void acil_encode_cmd_open_adv_pipes(uint8_t *buffer, aci_cmd_params_open_adv_pipe_t * p_aci_cmd_params_set_adv_svc_data);
-
-/** @brief Decode the ACI event command response
- *
- * @param[in] buffer_in Pointer to message received
- * @param[in,out] buffer Pointer to the decoded message in ::aci_evt_params_cmd_rsp_t
- *
- * @return None
- */
-void acil_decode_evt_command_response(uint8_t *buffer_in, aci_evt_params_cmd_rsp_t *p_evt_params_cmd_rsp);
-
-/** @brief Decode the ACI event device started
- *
- * @param[in] buffer_in Pointer to message received
- * @param[in,out] p_aci_evt Pointer to the decoded message in ::aci_evt_params_device_started_t
- *
- * @return None
- */
-void acil_decode_evt_device_started(uint8_t *buffer_in, aci_evt_params_device_started_t *p_evt_params_device_started);
-
-/** @brief Decode the ACI event pipe status
- *
- * @param[in] buffer_in Pointer to message received
- * @param[in,out] p_aci_evt_params_pipe_status Pointer to the decoded message in ::aci_evt_params_pipe_status_t
- *
- * @return None
- */
-void acil_decode_evt_pipe_status(uint8_t *buffer_in, aci_evt_params_pipe_status_t *p_aci_evt_params_pipe_status);
-
-/** @brief Decode the ACI event for disconnected
- *
- * @param[in] buffer_in Pointer to message received
- * @param[in,out] p_aci_evt_params_disconnected Pointer to the decoded message in ::aci_evt_params_disconnected_t
- *
- * @return None
- */
-void acil_decode_evt_disconnected(uint8_t *buffer_in, aci_evt_params_disconnected_t *p_aci_evt_params_disconnected);
-
-/** @brief Decode the ACI event for bond status
- *
- * @param[in] buffer_in Pointer to message received
- * @param[in,out] p_aci_evt_params_bond_status Pointer to the decoded message in ::aci_evt_params_bond_status_t
- *
- * @return None
- */
-void acil_decode_evt_bond_status(uint8_t *buffer_in, aci_evt_params_bond_status_t *p_aci_evt_params_bond_status);
-
-/** @brief Decode the ACI event for data received
- *
- * @param[in] buffer_in Pointer to message received
- * @param[in,out] p_evt_params_data_received Pointer to the decoded message in ::aci_evt_params_data_received_t
- *
- * @return size Received data size
- */
-uint8_t acil_decode_evt_data_received(uint8_t *buffer_in, aci_evt_params_data_received_t *p_evt_params_data_received);
-
-/** @brief Decode the ACI event data acknowledgement
- *
- * @param[in] buffer_in Pointer to message received
- * @param[in,out] p_evt_params_data_ack Pointer to the decoded message in ::aci_evt_params_data_ack_t
- *
- * @return None
- */
-void acil_decode_evt_data_ack(uint8_t *buffer_in, aci_evt_params_data_ack_t *p_evt_params_data_ack);
-
-/** @brief Decode the ACI event for hardware error
- *
- * @param[in] buffer_in Pointer to message received
- * @param[in,out] p_aci_evt_params_hw_error Pointer to the decoded message in ::aci_evt_params_hw_error_t
- *
- * @return size Size of debug information
- */
-uint8_t acil_decode_evt_hw_error(uint8_t *buffer_in, aci_evt_params_hw_error_t *p_aci_evt_params_hw_error);
-
-/** @brief Decode the ACI event data credit
- *
- * @param[in] buffer_in Pointer to message received
- * @param[in,out] p_evt_params_data_credit Pointer to the decoded message in ::aci_evt_params_data_credit_t
- *
- * @return None
- */
-void acil_decode_evt_credit(uint8_t *buffer_in, aci_evt_params_data_credit_t *p_evt_params_data_credit);
-
-/** @brief Decode the ACI event for connected
- *
- * @param[in] buffer_in Pointer to message received
- * @param[in,out] p_aci_evt_params_connected Pointer to the decoded message in ::aci_evt_params_connected_t
- *
- * @return None
- */
-void acil_decode_evt_connected(uint8_t *buffer_in, aci_evt_params_connected_t *p_aci_evt_params_connected);
-
-/** @brief Decode the ACI event for timing
- *
- * @param[in] buffer_in Pointer to message received
- * @param[in,out] p_evt_params_timing Pointer to the decoded message in ::aci_evt_params_timing_t
- *
- * @return None
- */
-void acil_decode_evt_timing(uint8_t *buffer_in, aci_evt_params_timing_t *p_evt_params_timing);
-
-/** @brief Decode the ACI event for pipe error
- *
- * @param[in] buffer_in Pointer to message received
- * @param[in,out] p_evt_params_pipe_error Pointer to the decoded message in ::aci_evt_params_pipe_error_t
- *
- */
-void acil_decode_evt_pipe_error(uint8_t *buffer_in, aci_evt_params_pipe_error_t *p_evt_params_pipe_error);
-
-/** @brief Decode the ACI event for key request
- *
- * @param[in] buffer_in Pointer to message received
- * @param[in,out] p_evt_params_key_type Pointer to the decoded message in ::aci_evt_params_key_type_t
- *
- * @return None
- */
-void acil_decode_evt_key_request(uint8_t *buffer_in, aci_evt_params_key_request_t *p_evt_params_key_request);
-
-/** @brief Decode the ACI event for echo
- *
- * @param[in] buffer_in Pointer to message received
- * @param[in,out] buffer_out Pointer to the echo message (max size of buffer ::ACI_ECHO_DATA_MAX_LEN)
- *
- * @return size Received echo message size
- */
-uint8_t acil_decode_evt_echo(uint8_t *buffer_in, aci_evt_params_echo_t *buffer_out);
-
-/** @brief Decode the ACI event
- *
- * @param[in] buffer_in Pointer to message received
- * @param[in,out] p_aci_evt Pointer to the decoded message in ::aci_evt_t
- *
- * @return bool true, if succesful, else returns false
- */
-bool acil_decode_evt(uint8_t *buffer_in, aci_evt_t *p_aci_evt);
-
-/** @brief Decode the Display Key Event
- *
- * @param[in] buffer_in Pointer to message received
- * @param[in,out] p_aci_evt Pointer to the decoded message in ::aci_evt_params_display_passkey_t
- *
- * @return None
- */
-void acil_decode_evt_display_passkey(uint8_t *buffer_in, aci_evt_params_display_passkey_t *p_aci_evt_params_display_passkey);
-
-#endif /* _acilib_IF_H_ */
diff --git a/peripheral/libupm/src/nrf8001/acilib_types.h b/peripheral/libupm/src/nrf8001/acilib_types.h
deleted file mode 100644
index 438ea3c..0000000
--- a/peripheral/libupm/src/nrf8001/acilib_types.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright (c) 2014, Nordic Semiconductor ASA
- *
- * 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.
- */
-
-/**
- * @file
- *
- * @ingroup aci-lib
- *
- * @brief Type used in the acilib interfaces
- */
-
-#ifndef _acilib_TYPES_H_
-#define _acilib_TYPES_H_
-
-#endif /* _acilib_TYPES_H_ */
diff --git a/peripheral/libupm/src/nrf8001/boards.h b/peripheral/libupm/src/nrf8001/boards.h
deleted file mode 100644
index c84db0a..0000000
--- a/peripheral/libupm/src/nrf8001/boards.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright (c) 2014, Nordic Semiconductor ASA
- *
- * 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.
- */
-
-/**
- * @file
- * @brief Defines for the different Bluetooth low energy boards
- * @ingroup nrf8001
- */
-
-#ifndef _BLE_BOARDS_H_
-#define _BLE_BOARDS_H_
-
-#define BOARD_DEFAULT 0 /**< Use this if you do not know the board you are using or you are creating a new one */
-#define REDBEARLAB_SHIELD_V1_1 1 /**< Redbearlab Bluetooth low energy shield v1.1 */
-#define REDBEARLAB_SHIELD_V2012_07 1 /**< Identical to Redbearlab v1.1 shield */
-#define REDBEARLAB_SHIELD_V2 0 /**< Redbearlab Bluetooth low energy shield v2.x - No special handling required for pin reset same as default */
-
-#endif
diff --git a/peripheral/libupm/src/nrf8001/dtm.h b/peripheral/libupm/src/nrf8001/dtm.h
deleted file mode 100644
index 9ae01c5..0000000
--- a/peripheral/libupm/src/nrf8001/dtm.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* Copyright (c) 2014, Nordic Semiconductor ASA
- *
- * 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.
- */
-
-/**
- * @file
- *
- * @ingroup aci-lib
- *
- * @brief Internal prototype for acilib module.
- */
-
-#ifndef DTM_H__
-#define DTM_H__
-
-/** @brief DTM command codes (upper two bits in the DTM command), use a bitwise OR with the frequency N = 0x00 - 0x27: N = (F-2402)/2 Frequency Range 2402 MHz
-to 2480 MHz*/
-#define DTM_LE_CMD_RESET 0x00 /**< DTM reset command code */
-#define DTM_LE_CMD_RECEIVER_TEST 0x40 /**< DTM receiver test command code */
-#define DTM_LE_CMD_TRANSMITTER_TEST 0x80 /**< DTM transmitter test command code */
-#define DTM_LE_CMD_TEST_END 0xC0 /**< DTM test end command code */
-
-
-/** @brief Defined packet types for DTM */
-#define DTM_LE_PKT_PRBS9 0x00 /**< Bit pattern PRBS9. */
-#define DTM_LE_PKT_0X0F 0x01 /**< Bit pattern 11110000 (LSB is the leftmost bit). */
-#define DTM_LE_PKT_0X55 0x02 /**< Bit pattern 10101010 (LSB is the leftmost bit). */
-#define DTM_LE_PKT_VENDOR 0x03 /**< Vendor specific. Nordic: continous carrier test */
-
-/** @brief Defined bit fields for DTM responses. */
-#define LE_PACKET_REPORTING_EVENT_MSB_BIT 0x80 /**< Bit field for most significant bit */
-#define LE_TEST_STATUS_EVENT_LSB_BIT 0x01 /**< Bit field for least significant bit */
-
-/** @brief DTM response types. */
-#define LE_TEST_STATUS_EVENT 0x00 /**< DTM event response */
-#define LE_TEST_PACKET_REPORT_EVENT 0x80 /**< DTM packet report reponse */
-
-/** @brief DTM return values. */
-#define LE_TEST_STATUS_SUCCESS 0x00 /**< DTM success return value */
-#define LE_TEST_STATUS_FAILURE 0x01 /**< DTM failure return value */
-
-
-
-#endif //DTM_H__
-
-/** @} */
diff --git a/peripheral/libupm/src/nrf8001/hal_aci_tl.cxx b/peripheral/libupm/src/nrf8001/hal_aci_tl.cxx
deleted file mode 100644
index 9d36a8e..0000000
--- a/peripheral/libupm/src/nrf8001/hal_aci_tl.cxx
+++ /dev/null
@@ -1,459 +0,0 @@
-/* Copyright (c) 2014, Nordic Semiconductor ASA
- *
- * 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.
- */
-
-/** @file
-@brief Implementation of the ACI transport layer module
-*/
-
-#include <string>
-#include <stdexcept>
-#include <stdio.h>
-
-#include "hal_platform.h"
-#include "hal_aci_tl.h"
-#include "aci_queue.h"
-
-#define HIGH 1
-#define LOW 0
-
-#define REVERSE_BITS(byte) (((reverse_lookup[(byte & 0x0F)]) << 4) + reverse_lookup[((byte & 0xF0) >> 4)])
-static const uint8_t reverse_lookup[] = { 0, 8, 4, 12, 2, 10, 6, 14,1, 9, 5, 13,3, 11, 7, 15 };
-
-static void m_aci_data_print(hal_aci_data_t *p_data);
-static void m_aci_event_check(void);
-static void m_aci_isr(void);
-static void m_aci_pins_set(aci_pins_t *a_pins_ptr);
-static inline void m_aci_reqn_disable (void);
-static inline void m_aci_reqn_enable (void);
-static void m_aci_q_flush(void);
-static bool m_aci_spi_transfer(hal_aci_data_t * data_to_send, hal_aci_data_t * received_data);
-
-static uint8_t spi_readwrite(uint8_t aci_byte);
-
-static bool aci_debug_print = false;
-
-aci_queue_t aci_tx_q;
-aci_queue_t aci_rx_q;
-
-static aci_pins_t *a_pins_local_ptr;
-
-void m_aci_data_print(hal_aci_data_t *p_data)
-{
- const uint8_t length = p_data->buffer[0];
- uint8_t i;
- printf("%d\n", length);
- printf(" :\n");
- for (i=0; i<=length; i++)
- {
- printf("%x", p_data->buffer[i]);
- printf(", ");
- }
- printf("\n");
-}
-
-/*
- Interrupt service routine called when the RDYN line goes low. Runs the SPI transfer.
-*/
-static void m_aci_isr(void)
-{
- hal_aci_data_t data_to_send;
- hal_aci_data_t received_data;
-
- // Receive from queue
- if (!aci_queue_dequeue_from_isr(&aci_tx_q, &data_to_send))
- {
- /* queue was empty, nothing to send */
- data_to_send.status_byte = 0;
- data_to_send.buffer[0] = 0;
- }
-
- // Receive and/or transmit data
- m_aci_spi_transfer(&data_to_send, &received_data);
-
- if (!aci_queue_is_full_from_isr(&aci_rx_q) && !aci_queue_is_empty_from_isr(&aci_tx_q))
- {
- m_aci_reqn_enable();
- }
-
- // Check if we received data
- if (received_data.buffer[0] > 0)
- {
- if (!aci_queue_enqueue_from_isr(&aci_rx_q, &received_data))
- {
- /* Receive Buffer full.
- Should never happen.
- Spin in a while loop.
- */
- while(1);
- }
-
- // Disable ready line interrupt until we have room to store incoming messages
- if (aci_queue_is_full_from_isr(&aci_rx_q))
- {
- // detachInterrupt(a_pins_local_ptr->interrupt_number);
- }
- }
-
- return;
-}
-
-/*
- Checks the RDYN line and runs the SPI transfer if required.
-*/
-static void m_aci_event_check(void)
-{
- hal_aci_data_t data_to_send;
- hal_aci_data_t received_data;
-
- // No room to store incoming messages
- if (aci_queue_is_full(&aci_rx_q))
- {
- return;
- }
-
- // If the ready line is disabled and we have pending messages outgoing we enable the request line
- if (HIGH == mraa_gpio_read (a_pins_local_ptr->m_rdy_ctx))
- // if (HIGH == digitalRead(a_pins_local_ptr->rdyn_pin))
- {
- if (!aci_queue_is_empty(&aci_tx_q))
- {
- m_aci_reqn_enable();
- }
-
- return;
- }
-
- // Receive from queue
- if (!aci_queue_dequeue(&aci_tx_q, &data_to_send))
- {
- /* queue was empty, nothing to send */
- data_to_send.status_byte = 0;
- data_to_send.buffer[0] = 0;
- }
-
- // Receive and/or transmit data
- m_aci_spi_transfer(&data_to_send, &received_data);
-
- /* If there are messages to transmit, and we can store the reply, we request a new transfer */
- if (!aci_queue_is_full(&aci_rx_q) && !aci_queue_is_empty(&aci_tx_q))
- {
- m_aci_reqn_enable();
- }
-
- // Check if we received data
- if (received_data.buffer[0] > 0)
- {
- if (!aci_queue_enqueue(&aci_rx_q, &received_data))
- {
- /* Receive Buffer full.
- Should never happen.
- Spin in a while loop.
- */
- while(1);
- }
- }
-
- return;
-}
-
-/** @brief Point the low level library at the ACI pins specified
- * @details
- * The ACI pins are specified in the application and a pointer is made available for
- * the low level library to use
- */
-static void m_aci_pins_set(aci_pins_t *a_pins_ptr)
-{
- a_pins_local_ptr = a_pins_ptr;
-}
-
-static inline void m_aci_reqn_disable (void)
-{
- mraa_gpio_write (a_pins_local_ptr->m_req_ctx, HIGH);
-}
-
-static inline void m_aci_reqn_enable (void)
-{
- mraa_gpio_write (a_pins_local_ptr->m_req_ctx, LOW);
-}
-
-static void m_aci_q_flush(void)
-{
- // noInterrupts();
- /* re-initialize aci cmd queue and aci event queue to flush them*/
- aci_queue_init(&aci_tx_q);
- aci_queue_init(&aci_rx_q);
- // interrupts();
-}
-
-static bool m_aci_spi_transfer(hal_aci_data_t * data_to_send, hal_aci_data_t * received_data)
-{
- uint8_t byte_cnt;
- uint8_t byte_sent_cnt;
- uint8_t max_bytes;
-
- m_aci_reqn_enable();
-
- // Send length, receive header
- byte_sent_cnt = 0;
- received_data->status_byte = spi_readwrite(data_to_send->buffer[byte_sent_cnt++]);
- // Send first byte, receive length from slave
- received_data->buffer[0] = spi_readwrite(data_to_send->buffer[byte_sent_cnt++]);
- if (0 == data_to_send->buffer[0])
- {
- max_bytes = received_data->buffer[0];
- }
- else
- {
- // Set the maximum to the biggest size. One command byte is already sent
- max_bytes = (received_data->buffer[0] > (data_to_send->buffer[0] - 1))
- ? received_data->buffer[0]
- : (data_to_send->buffer[0] - 1);
- }
-
- if (max_bytes > HAL_ACI_MAX_LENGTH)
- {
- max_bytes = HAL_ACI_MAX_LENGTH;
- }
-
- // Transmit/receive the rest of the packet
- for (byte_cnt = 0; byte_cnt < max_bytes; byte_cnt++)
- {
- received_data->buffer[byte_cnt+1] = spi_readwrite(data_to_send->buffer[byte_sent_cnt++]);
- }
-
- // RDYN should follow the REQN line in approx 100ns
- m_aci_reqn_disable();
-
- return (max_bytes > 0);
-}
-
-void hal_aci_tl_debug_print(bool enable)
-{
- aci_debug_print = enable;
-}
-
-void hal_aci_tl_pin_reset(void)
-{
- if (UNUSED != a_pins_local_ptr->reset_pin)
- {
- // pinMode(a_pins_local_ptr->reset_pin, OUTPUT);
-
- if ((REDBEARLAB_SHIELD_V1_1 == a_pins_local_ptr->board_name) ||
- (REDBEARLAB_SHIELD_V2012_07 == a_pins_local_ptr->board_name))
- {
- //The reset for the Redbearlab v1.1 and v2012.07 boards are inverted and has a Power On Reset
- //circuit that takes about 100ms to trigger the reset
- mraa_gpio_write (a_pins_local_ptr->m_rst_ctx, HIGH);
- usleep (100000);
- mraa_gpio_write (a_pins_local_ptr->m_rst_ctx, LOW);
- }
- else
- {
- mraa_gpio_write (a_pins_local_ptr->m_rst_ctx, HIGH);
- mraa_gpio_write (a_pins_local_ptr->m_rst_ctx, LOW);
- mraa_gpio_write (a_pins_local_ptr->m_rst_ctx, HIGH);
- }
- }
-}
-
-bool hal_aci_tl_event_peek(hal_aci_data_t *p_aci_data)
-{
- if (!a_pins_local_ptr->interface_is_interrupt)
- {
- m_aci_event_check();
- }
-
- if (aci_queue_peek(&aci_rx_q, p_aci_data))
- {
- return true;
- }
-
- return false;
-}
-
-bool hal_aci_tl_event_get(hal_aci_data_t *p_aci_data)
-{
- bool was_full;
-
- if (!a_pins_local_ptr->interface_is_interrupt && !aci_queue_is_full(&aci_rx_q))
- {
- m_aci_event_check();
- }
-
- was_full = aci_queue_is_full(&aci_rx_q);
-
- if (aci_queue_dequeue(&aci_rx_q, p_aci_data))
- {
- if (aci_debug_print)
- {
- printf(" E");
- m_aci_data_print(p_aci_data);
- }
-
- if (was_full && a_pins_local_ptr->interface_is_interrupt)
- {
- /* Enable RDY line interrupt again */
- // attachInterrupt(a_pins_local_ptr->interrupt_number, m_aci_isr, LOW);
- }
-
- /* Attempt to pull REQN LOW since we've made room for new messages */
- if (!aci_queue_is_full(&aci_rx_q) && !aci_queue_is_empty(&aci_tx_q))
- {
- m_aci_reqn_enable();
- }
-
- return true;
- }
-
- return false;
-}
-
-void hal_aci_tl_init(aci_pins_t *a_pins, bool debug)
-{
- mraa_result_t error = MRAA_SUCCESS;
- aci_debug_print = debug;
-
- /* Needs to be called as the first thing for proper intialization*/
- m_aci_pins_set(a_pins);
-
- /*
- * Init SPI
- */
- a_pins->m_spi = mraa_spi_init (0);
- if (a_pins->m_spi == NULL) {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_spi_init() failed");
- }
-
- mraa_spi_frequency (a_pins->m_spi, 2000000);
- mraa_spi_mode (a_pins->m_spi, MRAA_SPI_MODE0);
-
- /* Initialize the ACI Command queue. This must be called after the delay above. */
- aci_queue_init(&aci_tx_q);
- aci_queue_init(&aci_rx_q);
-
- // Configure the IO lines
- a_pins->m_rdy_ctx = mraa_gpio_init (a_pins->rdyn_pin);
- if (a_pins->m_rdy_ctx == NULL) {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_gpio_init(rdyn) failed, invalid pin?");
- }
-
- a_pins->m_req_ctx = mraa_gpio_init (a_pins->reqn_pin);
- if (a_pins->m_req_ctx == NULL) {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_gpio_init(reqn) failed, invalid pin?");
- }
-
- a_pins->m_rst_ctx = mraa_gpio_init (a_pins->reset_pin);
- if (a_pins->m_rst_ctx == NULL) {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_gpio_init(reset) failed, invalid pin?");
- }
-
- error = mraa_gpio_dir (a_pins->m_rdy_ctx, MRAA_GPIO_IN);
- if (error != MRAA_SUCCESS) {
- printf ("[ERROR] GPIO failed to initilize \n");
- }
-
- error = mraa_gpio_dir (a_pins->m_req_ctx, MRAA_GPIO_OUT);
- if (error != MRAA_SUCCESS) {
- printf ("[ERROR] GPIO failed to initilize \n");
- }
-
- error = mraa_gpio_dir (a_pins->m_rst_ctx, MRAA_GPIO_OUT);
- if (error != MRAA_SUCCESS) {
- printf ("[ERROR] GPIO failed to initilize \n");
- }
-
- if (UNUSED != a_pins->active_pin) {
- }
-
- /* Pin reset the nRF8001, required when the nRF8001 setup is being changed */
- hal_aci_tl_pin_reset();
-
- /* Set the nRF8001 to a known state as required by the datasheet*/
- mraa_gpio_write (a_pins->m_req_ctx, LOW);
-
- usleep(30000); //Wait for the nRF8001 to get hold of its lines - the lines float for a few ms after the reset
-
- /* Attach the interrupt to the RDYN line as requested by the caller */
- if (a_pins->interface_is_interrupt) {
- // We use the LOW level of the RDYN line as the atmega328 can wakeup from sleep only on LOW
- // attachInterrupt(a_pins->interrupt_number, m_aci_isr, LOW);
- }
-}
-
-bool hal_aci_tl_send(hal_aci_data_t *p_aci_cmd)
-{
- const uint8_t length = p_aci_cmd->buffer[0];
- bool ret_val = false;
-
- if (length > HAL_ACI_MAX_LENGTH)
- {
- return false;
- }
-
- ret_val = aci_queue_enqueue(&aci_tx_q, p_aci_cmd);
- if (ret_val)
- {
- if(!aci_queue_is_full(&aci_rx_q))
- {
- // Lower the REQN only when successfully enqueued
- m_aci_reqn_enable();
- }
- }
-
- return ret_val;
-}
-
-static uint8_t spi_readwrite(const uint8_t aci_byte)
-{
- uint8_t reversed, ret;
- reversed = mraa_spi_write (a_pins_local_ptr->m_spi, REVERSE_BITS (aci_byte));
- ret = REVERSE_BITS (reversed);
- return ret;
-}
-
-bool hal_aci_tl_rx_q_empty (void)
-{
- return aci_queue_is_empty(&aci_rx_q);
-}
-
-bool hal_aci_tl_rx_q_full (void)
-{
- return aci_queue_is_full(&aci_rx_q);
-}
-
-bool hal_aci_tl_tx_q_empty (void)
-{
- return aci_queue_is_empty(&aci_tx_q);
-}
-
-bool hal_aci_tl_tx_q_full (void)
-{
- return aci_queue_is_full(&aci_tx_q);
-}
-
-void hal_aci_tl_q_flush (void)
-{
- m_aci_q_flush();
-}
diff --git a/peripheral/libupm/src/nrf8001/hal_aci_tl.h b/peripheral/libupm/src/nrf8001/hal_aci_tl.h
deleted file mode 100644
index 6511fae..0000000
--- a/peripheral/libupm/src/nrf8001/hal_aci_tl.h
+++ /dev/null
@@ -1,189 +0,0 @@
-/* Copyright (c) 2014, Nordic Semiconductor ASA
- *
- * 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.
- */
-
-/**
- * @file
- * @brief Interface for hal_aci_tl.
- * @ingroup nrf8001
- */
-
-/**
-@{
-
-@brief Module for the ACI Transport Layer interface
-@details This module is responsible for sending and receiving messages over the ACI interface of the nRF8001 chip.
- The hal_aci_tl_send_cmd() can be called directly to send ACI commands.
-
-
-The RDYN line is hooked to an interrupt on the MCU when the level is low.
-The SPI master clocks in the interrupt context.
-The ACI Command is taken from the head of the command queue is sent over the SPI
-and the received ACI event is placed in the tail of the event queue.
-
-*/
-
-#ifndef HAL_ACI_TL_H__
-#define HAL_ACI_TL_H__
-
-#include "hal_platform.h"
-#include "aci.h"
-#include "boards.h"
-
-#include <mraa/aio.h>
-#include <mraa/gpio.h>
-#include <mraa/spi.h>
-
-#ifndef HAL_ACI_MAX_LENGTH
-#define HAL_ACI_MAX_LENGTH 31
-#endif
-
-/************************************************************************/
-/* Unused nRF8001 pin */
-/************************************************************************/
-#define UNUSED 255
-
-/** Data type for ACI commands and events */
-typedef struct {
- uint8_t status_byte;
- uint8_t buffer[HAL_ACI_MAX_LENGTH+1];
-} _aci_packed_ hal_aci_data_t;
-
-ACI_ASSERT_SIZE(hal_aci_data_t, HAL_ACI_MAX_LENGTH + 2);
-
-/** Datatype for ACI pins and interface (polling/interrupt)*/
-typedef struct aci_pins_t
-{
- mraa_spi_context m_spi;
- mraa_gpio_context m_rdy_ctx;
- mraa_gpio_context m_req_ctx;
- mraa_gpio_context m_rst_ctx;
-
- uint8_t board_name; //Optional : Use BOARD_DEFAULT if you do not know. See boards.h
- uint8_t reqn_pin; //Required
- uint8_t rdyn_pin; //Required
- uint8_t mosi_pin; //Required
- uint8_t miso_pin; //Required
- uint8_t sck_pin; //Required
-
- uint8_t spi_clock_divider; //Required : Clock divider on the SPI clock : nRF8001 supports a maximum clock of 3MHz
-
- uint8_t reset_pin; //Recommended but optional - Set it to UNUSED when not connected
- uint8_t active_pin; //Optional - Set it to UNUSED when not connected
- uint8_t optional_chip_sel_pin; //Optional - Used only when the reqn line is required to be separate from the SPI chip select. Eg. Arduino DUE
-
- bool interface_is_interrupt; //Required - true = Uses interrupt on RDYN pin. false - Uses polling on RDYN pin
-
- uint8_t interrupt_number; //Required when using interrupts, otherwise ignored
-} aci_pins_t;
-
-/** @brief ACI Transport Layer initialization.
- * @details
- * This function initializes the transport layer, including configuring the SPI, creating
- * message queues for Commands and Events and setting up interrupt if required.
- * @param a_pins Pins on the MCU used to connect to the nRF8001
- * @param bool True if debug printing should be enabled on the Serial.
- */
-void hal_aci_tl_init(aci_pins_t *a_pins, bool debug);
-
-/** @brief Sends an ACI command to the radio.
- * @details
- * This function sends an ACI command to the radio. This queue up the message to send and
- * lower the request line. When the device lowers the ready line, @ref m_aci_spi_transfer()
- * will send the data.
- * @param aci_buffer Pointer to the message to send.
- * @return True if the data was successfully queued for sending,
- * false if there is no more space to store messages to send.
- */
-bool hal_aci_tl_send(hal_aci_data_t *aci_buffer);
-
-/** @brief Process pending transactions.
- * @details
- * The library code takes care of calling this function to check if the nRF8001 RDYN line indicates a
- * pending transaction. It will send a pending message if there is one and return any receive message
- * that was pending.
- * @return Points to data buffer for received data. Length byte in buffer is 0 if no data received.
- */
-hal_aci_data_t * hal_aci_tl_poll_get(void);
-
-/** @brief Get an ACI event from the event queue
- * @details
- * Call this function from the main context to get an event from the ACI event queue
- * This is called by lib_aci_event_get
- */
-bool hal_aci_tl_event_get(hal_aci_data_t *p_aci_data);
-
-/** @brief Peek an ACI event from the event queue
- * @details
- * Call this function from the main context to peek an event from the ACI event queue.
- * This is called by lib_aci_event_peek
- */
-bool hal_aci_tl_event_peek(hal_aci_data_t *p_aci_data);
-
-/** @brief Enable debug printing of all ACI commands sent and ACI events received
- * @details
- * when the enable parameter is true. The debug printing is enabled on the Serial.
- * When the enable parameter is false. The debug printing is disabled on the Serial.
- * By default the debug printing is disabled.
- */
-void hal_aci_tl_debug_print(bool enable);
-
-
-/** @brief Pin reset the nRF8001
- * @details
- * The reset line of the nF8001 needs to kept low for 200 ns.
- * Redbearlab shield v1.1 and v2012.07 are exceptions as they
- * have a Power ON Reset circuit that works differently.
- * The function handles the exceptions based on the board_name in aci_pins_t
- */
-void hal_aci_tl_pin_reset(void);
-
-/** @brief Return full status of transmit queue
- * @details
- *
- */
- bool hal_aci_tl_rx_q_full(void);
-
- /** @brief Return empty status of receive queue
- * @details
- *
- */
- bool hal_aci_tl_rx_q_empty(void);
-
-/** @brief Return full status of receive queue
- * @details
- *
- */
- bool hal_aci_tl_tx_q_full(void);
-
- /** @brief Return empty status of transmit queue
- * @details
- *
- */
- bool hal_aci_tl_tx_q_empty(void);
-
-/** @brief Flush the ACI command Queue and the ACI Event Queue
- * @details
- * Call this function in the main thread
- */
-void hal_aci_tl_q_flush(void);
-
-#endif // HAL_ACI_TL_H__
-/** @} */
diff --git a/peripheral/libupm/src/nrf8001/hal_platform.h b/peripheral/libupm/src/nrf8001/hal_platform.h
deleted file mode 100644
index 73ac402..0000000
--- a/peripheral/libupm/src/nrf8001/hal_platform.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/* Copyright (c) 2014, Nordic Semiconductor ASA
- *
- * 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.
- */
-
-/**
- * @file
- * @brief HAL specific macros
- * @ingroup nrf8001
- */
-
-#ifndef PLATFORM_H__
-#define PLATFORM_H__
-
-//Board dependent defines
-#if defined (__AVR__)
- //For Arduino this AVR specific library has to be used for reading from Flash memory
- #include <avr/pgmspace.h>
- #include "Arduino.h"
- #ifdef PROGMEM
- #undef PROGMEM
- #define PROGMEM __attribute__(( section(".progmem.data") ))
- #endif
-#elif defined(__PIC32MX__)
- //For Chipkit add the following libraries.
- #include <stdint.h>
- #include <stdbool.h>
- #include <string.h>
- #include <wiring.h>
- #include <WProgram.h>
-
- //For making the Serial.Print compatible between Arduino and Chipkit
- #define F(X) (X)
-
- //For ChipKit neither PROGMEM or PSTR are needed for PIC32
- #define PROGMEM
- #define PSTR(s) (s)
-
- #define pgm_read_byte(x) (*((char *)x))
- #define pgm_read_byte_near(x) (*((char *)x))
- #define pgm_read_byte_far(x) (*((char *)x))
- #define pgm_read_word(x) (*((short *)x))
- #define pgm_read_word_near(x) (*((short *)x))
- #define pgm_read_workd_far(x) (*((short *)x))
-
- #define prog_void const void
- #define prog_char const char
- #define prog_uchar const unsigned char
- #define prog_int8_t const int8_t
- #define prog_uint8_t const uint8_t
- #define prog_int16_t const int16_t
- #define prog_uint16_t const uint16_t
- #define prog_int32_t const int32_t
- #define prog_uint32_t const uint32_t
- #define prog_int64_t const int64_t
- #define prog_uint64_t const uint64_t
-
- //Redefine the function for reading from flash in ChipKit
- #define memcpy_P memcpy
-#endif
-
-#endif /* PLATFORM_H__ */
diff --git a/peripheral/libupm/src/nrf8001/javaupm_nrf8001.i b/peripheral/libupm/src/nrf8001/javaupm_nrf8001.i
deleted file mode 100644
index 9956b43..0000000
--- a/peripheral/libupm/src/nrf8001/javaupm_nrf8001.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_nrf8001
-%include "../upm.i"
-
-%{
- #include "nrf8001.h"
-%}
-
-%include "nrf8001.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_nrf8001");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/nrf8001/jsupm_nrf8001.i b/peripheral/libupm/src/nrf8001/jsupm_nrf8001.i
deleted file mode 100644
index cb1aadd..0000000
--- a/peripheral/libupm/src/nrf8001/jsupm_nrf8001.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_nrf8001
-%include "../upm.i"
-
-%{
- #include "nrf8001.h"
-%}
-
-%include "nrf8001.h"
diff --git a/peripheral/libupm/src/nrf8001/lib_aci.cxx b/peripheral/libupm/src/nrf8001/lib_aci.cxx
deleted file mode 100644
index c194876..0000000
--- a/peripheral/libupm/src/nrf8001/lib_aci.cxx
+++ /dev/null
@@ -1,742 +0,0 @@
-/* Copyright (c) 2014, Nordic Semiconductor ASA
- *
- * 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.
- */
-
-/** @file
- @brief Implementation of the ACI library.
- */
-
-#include "hal_platform.h"
-#include "aci.h"
-#include "aci_cmds.h"
-#include "aci_evts.h"
-#include "aci_protocol_defines.h"
-#include "acilib_defs.h"
-#include "acilib_if.h"
-#include "hal_aci_tl.h"
-#include "aci_queue.h"
-#include "lib_aci.h"
-
-
-#define LIB_ACI_DEFAULT_CREDIT_NUMBER 1
-
-/*
-Global additionally used used in aci_setup
-*/
-hal_aci_data_t msg_to_send;
-
-
-static services_pipe_type_mapping_t * p_services_pipe_type_map;
-static hal_aci_data_t * p_setup_msgs;
-
-
-
-
-static bool is_request_operation_pending;
-static bool is_indicate_operation_pending;
-static bool is_open_remote_pipe_pending;
-static bool is_close_remote_pipe_pending;
-
-static uint8_t request_operation_pipe = 0;
-static uint8_t indicate_operation_pipe = 0;
-
-
-// The following structure (aci_cmd_params_open_adv_pipe) will be used to store the complete command
-// including the pipes to be opened.
-static aci_cmd_params_open_adv_pipe_t aci_cmd_params_open_adv_pipe;
-
-
-
-extern aci_queue_t aci_rx_q;
-extern aci_queue_t aci_tx_q;
-
-bool lib_aci_is_pipe_available(aci_state_t *aci_stat, uint8_t pipe)
-{
- uint8_t byte_idx;
-
- byte_idx = pipe / 8;
- if (aci_stat->pipes_open_bitmap[byte_idx] & (0x01 << (pipe % 8)))
- {
- return(true);
- }
- return(false);
-}
-
-
-bool lib_aci_is_pipe_closed(aci_state_t *aci_stat, uint8_t pipe)
-{
- uint8_t byte_idx;
-
- byte_idx = pipe / 8;
- if (aci_stat->pipes_closed_bitmap[byte_idx] & (0x01 << (pipe % 8)))
- {
- return(true);
- }
- return(false);
-}
-
-
-bool lib_aci_is_discovery_finished(aci_state_t *aci_stat)
-{
- return(aci_stat->pipes_open_bitmap[0]&0x01);
-}
-
-void lib_aci_board_init(aci_state_t *aci_stat)
-{
- hal_aci_evt_t *aci_data = NULL;
- aci_data = (hal_aci_evt_t *)&msg_to_send;
-
- if (REDBEARLAB_SHIELD_V1_1 == aci_stat->aci_pins.board_name)
- {
- /*
- The Bluetooth low energy Arduino shield v1.1 requires about 100ms to reset.
- This is not required for the nRF2740, nRF2741 modules
- */
- usleep(100000);
-
- /*
- Send the soft reset command to the nRF8001 to get the nRF8001 to a known state.
- */
- lib_aci_radio_reset();
-
- while (1)
- {
- /*Wait for the command response of the radio reset command.
- as the nRF8001 will be in either SETUP or STANDBY after the ACI Reset Radio is processed
- */
-
-
- if (true == lib_aci_event_get(aci_stat, aci_data))
- {
- aci_evt_t * aci_evt;
- aci_evt = &(aci_data->evt);
-
- if (ACI_EVT_CMD_RSP == aci_evt->evt_opcode)
- {
- if (ACI_STATUS_ERROR_DEVICE_STATE_INVALID == aci_evt->params.cmd_rsp.cmd_status) //in SETUP
- {
- //Inject a Device Started Event Setup to the ACI Event Queue
- msg_to_send.buffer[0] = 4; //Length
- msg_to_send.buffer[1] = 0x81; //Device Started Event
- msg_to_send.buffer[2] = 0x02; //Setup
- msg_to_send.buffer[3] = 0; //Hardware Error -> None
- msg_to_send.buffer[4] = 2; //Data Credit Available
- aci_queue_enqueue(&aci_rx_q, &msg_to_send);
- }
- else if (ACI_STATUS_SUCCESS == aci_evt->params.cmd_rsp.cmd_status) //We are now in STANDBY
- {
- //Inject a Device Started Event Standby to the ACI Event Queue
- msg_to_send.buffer[0] = 4; //Length
- msg_to_send.buffer[1] = 0x81; //Device Started Event
- msg_to_send.buffer[2] = 0x03; //Standby
- msg_to_send.buffer[3] = 0; //Hardware Error -> None
- msg_to_send.buffer[4] = 2; //Data Credit Available
- aci_queue_enqueue(&aci_rx_q, &msg_to_send);
- }
- else if (ACI_STATUS_ERROR_CMD_UNKNOWN == aci_evt->params.cmd_rsp.cmd_status) //We are now in TEST
- {
- //Inject a Device Started Event Test to the ACI Event Queue
- msg_to_send.buffer[0] = 4; //Length
- msg_to_send.buffer[1] = 0x81; //Device Started Event
- msg_to_send.buffer[2] = 0x01; //Test
- msg_to_send.buffer[3] = 0; //Hardware Error -> None
- msg_to_send.buffer[4] = 0; //Data Credit Available
- aci_queue_enqueue(&aci_rx_q, &msg_to_send);
- }
-
- printf ("BREAK\n");
- //Break out of the while loop
- break;
- }
- else
- {
- //Serial.println(F("Discard any other ACI Events"));
- }
-
- }
- }
- }
-}
-
-
-void lib_aci_init(aci_state_t *aci_stat, bool debug)
-{
- uint8_t i;
-
- for (i = 0; i < PIPES_ARRAY_SIZE; i++) {
- aci_stat->pipes_open_bitmap[i] = 0;
- aci_stat->pipes_closed_bitmap[i] = 0;
- aci_cmd_params_open_adv_pipe.pipes[i] = 0;
- }
-
- is_request_operation_pending = false;
- is_indicate_operation_pending = false;
- is_open_remote_pipe_pending = false;
- is_close_remote_pipe_pending = false;
-
- request_operation_pipe = 0;
- indicate_operation_pipe = 0;
-
- p_services_pipe_type_map = aci_stat->aci_setup_info.services_pipe_type_mapping;
- p_setup_msgs = aci_stat->aci_setup_info.setup_msgs;
-
- hal_aci_tl_init (&aci_stat->aci_pins, debug);
- lib_aci_board_init (aci_stat);
-}
-
-
-uint8_t lib_aci_get_nb_available_credits(aci_state_t *aci_stat)
-{
- return aci_stat->data_credit_available;
-}
-
-uint16_t lib_aci_get_cx_interval_ms(aci_state_t *aci_stat)
-{
- uint32_t cx_rf_interval_ms_32bits;
- uint16_t cx_rf_interval_ms;
-
- cx_rf_interval_ms_32bits = aci_stat->connection_interval;
- cx_rf_interval_ms_32bits *= 125; // the connection interval is given in multiples of 0.125 milliseconds
- cx_rf_interval_ms = cx_rf_interval_ms_32bits / 100;
-
- return cx_rf_interval_ms;
-}
-
-
-uint16_t lib_aci_get_cx_interval(aci_state_t *aci_stat)
-{
- return aci_stat->connection_interval;
-}
-
-
-uint16_t lib_aci_get_slave_latency(aci_state_t *aci_stat)
-{
- return aci_stat->slave_latency;
-}
-
-
-bool lib_aci_set_app_latency(uint16_t latency, aci_app_latency_mode_t latency_mode)
-{
- aci_cmd_params_set_app_latency_t aci_set_app_latency;
-
- aci_set_app_latency.mode = latency_mode;
- aci_set_app_latency.latency = latency;
- acil_encode_cmd_set_app_latency(&(msg_to_send.buffer[0]), &aci_set_app_latency);
-
- return hal_aci_tl_send(&msg_to_send);
-}
-
-
-bool lib_aci_test(aci_test_mode_change_t enter_exit_test_mode)
-{
- aci_cmd_params_test_t aci_cmd_params_test;
- aci_cmd_params_test.test_mode_change = enter_exit_test_mode;
- acil_encode_cmd_set_test_mode(&(msg_to_send.buffer[0]), &aci_cmd_params_test);
- return hal_aci_tl_send(&msg_to_send);
-}
-
-
-bool lib_aci_sleep()
-{
- acil_encode_cmd_sleep(&(msg_to_send.buffer[0]));
- return hal_aci_tl_send(&msg_to_send);
-}
-
-
-bool lib_aci_radio_reset()
-{
- acil_encode_baseband_reset(&(msg_to_send.buffer[0]));
- return hal_aci_tl_send(&msg_to_send);
-}
-
-
-bool lib_aci_direct_connect()
-{
- acil_encode_direct_connect(&(msg_to_send.buffer[0]));
- return hal_aci_tl_send(&msg_to_send);
-}
-
-
-bool lib_aci_device_version()
-{
- acil_encode_cmd_get_device_version(&(msg_to_send.buffer[0]));
- return hal_aci_tl_send(&msg_to_send);
-}
-
-
-bool lib_aci_set_local_data(aci_state_t *aci_stat, uint8_t pipe, uint8_t *p_value, uint8_t size)
-{
- aci_cmd_params_set_local_data_t aci_cmd_params_set_local_data;
-
- if ((p_services_pipe_type_map[pipe-1].location != ACI_STORE_LOCAL)
- ||
- (size > ACI_PIPE_TX_DATA_MAX_LEN))
- {
- return false;
- }
-
- aci_cmd_params_set_local_data.tx_data.pipe_number = pipe;
- memcpy(&(aci_cmd_params_set_local_data.tx_data.aci_data[0]), p_value, size);
- acil_encode_cmd_set_local_data(&(msg_to_send.buffer[0]), &aci_cmd_params_set_local_data, size);
- return hal_aci_tl_send(&msg_to_send);
-}
-
-bool lib_aci_connect(uint16_t run_timeout, uint16_t adv_interval)
-{
- aci_cmd_params_connect_t aci_cmd_params_connect;
- aci_cmd_params_connect.timeout = run_timeout;
- aci_cmd_params_connect.adv_interval = adv_interval;
- acil_encode_cmd_connect(&(msg_to_send.buffer[0]), &aci_cmd_params_connect);
- return hal_aci_tl_send(&msg_to_send);
-}
-
-
-bool lib_aci_disconnect(aci_state_t *aci_stat, aci_disconnect_reason_t reason)
-{
- bool ret_val;
- uint8_t i;
- aci_cmd_params_disconnect_t aci_cmd_params_disconnect;
- aci_cmd_params_disconnect.reason = reason;
- acil_encode_cmd_disconnect(&(msg_to_send.buffer[0]), &aci_cmd_params_disconnect);
- ret_val = hal_aci_tl_send(&msg_to_send);
- // If we have actually sent the disconnect
- if (ret_val)
- {
- // Update pipes immediately so that while the disconnect is happening,
- // the application can't attempt sending another message
- // If the application sends another message before we updated this
- // a ACI Pipe Error Event will be received from nRF8001
- for (i=0; i < PIPES_ARRAY_SIZE; i++)
- {
- aci_stat->pipes_open_bitmap[i] = 0;
- aci_stat->pipes_closed_bitmap[i] = 0;
- }
- }
- return ret_val;
-}
-
-
-bool lib_aci_bond(uint16_t run_timeout, uint16_t adv_interval)
-{
- aci_cmd_params_bond_t aci_cmd_params_bond;
- aci_cmd_params_bond.timeout = run_timeout;
- aci_cmd_params_bond.adv_interval = adv_interval;
- acil_encode_cmd_bond(&(msg_to_send.buffer[0]), &aci_cmd_params_bond);
- return hal_aci_tl_send(&msg_to_send);
-}
-
-
-bool lib_aci_wakeup()
-{
- acil_encode_cmd_wakeup(&(msg_to_send.buffer[0]));
- return hal_aci_tl_send(&msg_to_send);
-}
-
-
-bool lib_aci_set_tx_power(aci_device_output_power_t tx_power)
-{
- aci_cmd_params_set_tx_power_t aci_cmd_params_set_tx_power;
- aci_cmd_params_set_tx_power.device_power = tx_power;
- acil_encode_cmd_set_radio_tx_power(&(msg_to_send.buffer[0]), &aci_cmd_params_set_tx_power);
- return hal_aci_tl_send(&msg_to_send);
-}
-
-
-bool lib_aci_get_address()
-{
- acil_encode_cmd_get_address(&(msg_to_send.buffer[0]));
- return hal_aci_tl_send(&msg_to_send);
-}
-
-
-bool lib_aci_get_temperature()
-{
- acil_encode_cmd_temparature(&(msg_to_send.buffer[0]));
- return hal_aci_tl_send(&msg_to_send);
-}
-
-
-bool lib_aci_get_battery_level()
-{
- acil_encode_cmd_battery_level(&(msg_to_send.buffer[0]));
- return hal_aci_tl_send(&msg_to_send);
-}
-
-
-bool lib_aci_send_data(uint8_t pipe, uint8_t *p_value, uint8_t size)
-{
- bool ret_val = false;
- aci_cmd_params_send_data_t aci_cmd_params_send_data;
-
-
- if(!((p_services_pipe_type_map[pipe-1].pipe_type == ACI_TX) ||
- (p_services_pipe_type_map[pipe-1].pipe_type == ACI_TX_ACK)))
- {
- return false;
- }
-
- if (size > ACI_PIPE_TX_DATA_MAX_LEN)
- {
- return false;
- }
- {
- aci_cmd_params_send_data.tx_data.pipe_number = pipe;
- memcpy(&(aci_cmd_params_send_data.tx_data.aci_data[0]), p_value, size);
- acil_encode_cmd_send_data(&(msg_to_send.buffer[0]), &aci_cmd_params_send_data, size);
-
- ret_val = hal_aci_tl_send(&msg_to_send);
- }
- return ret_val;
-}
-
-
-bool lib_aci_request_data(aci_state_t *aci_stat, uint8_t pipe)
-{
- bool ret_val = false;
- aci_cmd_params_request_data_t aci_cmd_params_request_data;
-
- if(!((p_services_pipe_type_map[pipe-1].location == ACI_STORE_REMOTE)&&(p_services_pipe_type_map[pipe-1].pipe_type == ACI_RX_REQ)))
- {
- return false;
- }
-
-
- {
-
- {
-
-
-
- aci_cmd_params_request_data.pipe_number = pipe;
- acil_encode_cmd_request_data(&(msg_to_send.buffer[0]), &aci_cmd_params_request_data);
-
- ret_val = hal_aci_tl_send(&msg_to_send);
- }
- }
- return ret_val;
-}
-
-
-bool lib_aci_change_timing(uint16_t minimun_cx_interval, uint16_t maximum_cx_interval, uint16_t slave_latency, uint16_t timeout)
-{
- aci_cmd_params_change_timing_t aci_cmd_params_change_timing;
- aci_cmd_params_change_timing.conn_params.min_conn_interval = minimun_cx_interval;
- aci_cmd_params_change_timing.conn_params.max_conn_interval = maximum_cx_interval;
- aci_cmd_params_change_timing.conn_params.slave_latency = slave_latency;
- aci_cmd_params_change_timing.conn_params.timeout_mult = timeout;
- acil_encode_cmd_change_timing_req(&(msg_to_send.buffer[0]), &aci_cmd_params_change_timing);
- return hal_aci_tl_send(&msg_to_send);
-}
-
-
-bool lib_aci_change_timing_GAP_PPCP()
-{
- acil_encode_cmd_change_timing_req_GAP_PPCP(&(msg_to_send.buffer[0]));
- return hal_aci_tl_send(&msg_to_send);
-}
-
-
-bool lib_aci_open_remote_pipe(aci_state_t *aci_stat, uint8_t pipe)
-{
- bool ret_val = false;
- aci_cmd_params_open_remote_pipe_t aci_cmd_params_open_remote_pipe;
-
- if(!((p_services_pipe_type_map[pipe-1].location == ACI_STORE_REMOTE)&&
- ((p_services_pipe_type_map[pipe-1].pipe_type == ACI_RX)||
- (p_services_pipe_type_map[pipe-1].pipe_type == ACI_RX_ACK_AUTO)||
- (p_services_pipe_type_map[pipe-1].pipe_type == ACI_RX_ACK))))
- {
- return false;
- }
-
-
- {
-
- is_request_operation_pending = true;
- is_open_remote_pipe_pending = true;
- request_operation_pipe = pipe;
- aci_cmd_params_open_remote_pipe.pipe_number = pipe;
- acil_encode_cmd_open_remote_pipe(&(msg_to_send.buffer[0]), &aci_cmd_params_open_remote_pipe);
- ret_val = hal_aci_tl_send(&msg_to_send);
- }
- return ret_val;
-}
-
-
-bool lib_aci_close_remote_pipe(aci_state_t *aci_stat, uint8_t pipe)
-{
- bool ret_val = false;
- aci_cmd_params_close_remote_pipe_t aci_cmd_params_close_remote_pipe;
-
- if(!((p_services_pipe_type_map[pipe-1].location == ACI_STORE_REMOTE)&&
- ((p_services_pipe_type_map[pipe-1].pipe_type == ACI_RX)||
- (p_services_pipe_type_map[pipe-1].pipe_type == ACI_RX_ACK_AUTO)||
- (p_services_pipe_type_map[pipe-1].pipe_type == ACI_RX_ACK))))
- {
- return false;
- }
-
-
- {
-
- is_request_operation_pending = true;
- is_close_remote_pipe_pending = true;
- request_operation_pipe = pipe;
- aci_cmd_params_close_remote_pipe.pipe_number = pipe;
- acil_encode_cmd_close_remote_pipe(&(msg_to_send.buffer[0]), &aci_cmd_params_close_remote_pipe);
- ret_val = hal_aci_tl_send(&msg_to_send);
- }
- return ret_val;
-}
-
-
-bool lib_aci_set_key(aci_key_type_t key_rsp_type, uint8_t *key, uint8_t len)
-{
- aci_cmd_params_set_key_t aci_cmd_params_set_key;
- aci_cmd_params_set_key.key_type = key_rsp_type;
- memcpy((uint8_t*)&(aci_cmd_params_set_key.key), key, len);
- acil_encode_cmd_set_key(&(msg_to_send.buffer[0]), &aci_cmd_params_set_key);
- return hal_aci_tl_send(&msg_to_send);
-}
-
-
-bool lib_aci_echo_msg(uint8_t msg_size, uint8_t *p_msg_data)
-{
- aci_cmd_params_echo_t aci_cmd_params_echo;
- if(msg_size > (ACI_ECHO_DATA_MAX_LEN))
- {
- return false;
- }
-
- if (msg_size > (ACI_ECHO_DATA_MAX_LEN))
- {
- msg_size = ACI_ECHO_DATA_MAX_LEN;
- }
-
- memcpy(&(aci_cmd_params_echo.echo_data[0]), p_msg_data, msg_size);
- acil_encode_cmd_echo_msg(&(msg_to_send.buffer[0]), &aci_cmd_params_echo, msg_size);
-
- return hal_aci_tl_send(&msg_to_send);
-}
-
-
-bool lib_aci_bond_request()
-{
- acil_encode_cmd_bond_security_request(&(msg_to_send.buffer[0]));
- return hal_aci_tl_send(&msg_to_send);
-}
-
-bool lib_aci_event_peek(hal_aci_evt_t *p_aci_evt_data)
-{
- return hal_aci_tl_event_peek((hal_aci_data_t *)p_aci_evt_data);
-}
-
-bool lib_aci_event_get(aci_state_t *aci_stat, hal_aci_evt_t *p_aci_evt_data)
-{
- bool status = false;
-
- status = hal_aci_tl_event_get((hal_aci_data_t *)p_aci_evt_data);
-
- /**
- Update the state of the ACI with the
- ACI Events -> Pipe Status, Disconnected, Connected, Bond Status, Pipe Error
- */
- if (true == status)
- {
- aci_evt_t * aci_evt;
-
- aci_evt = &p_aci_evt_data->evt;
-
- switch(aci_evt->evt_opcode)
- {
- case ACI_EVT_PIPE_STATUS:
- {
- uint8_t i=0;
-
- for (i=0; i < PIPES_ARRAY_SIZE; i++)
- {
- aci_stat->pipes_open_bitmap[i] = aci_evt->params.pipe_status.pipes_open_bitmap[i];
- aci_stat->pipes_closed_bitmap[i] = aci_evt->params.pipe_status.pipes_closed_bitmap[i];
- }
- }
- break;
-
- case ACI_EVT_DISCONNECTED:
- {
- uint8_t i=0;
-
- for (i=0; i < PIPES_ARRAY_SIZE; i++)
- {
- aci_stat->pipes_open_bitmap[i] = 0;
- aci_stat->pipes_closed_bitmap[i] = 0;
- }
- aci_stat->confirmation_pending = false;
- aci_stat->data_credit_available = aci_stat->data_credit_total;
-
- }
- break;
-
- case ACI_EVT_TIMING:
- aci_stat->connection_interval = aci_evt->params.timing.conn_rf_interval;
- aci_stat->slave_latency = aci_evt->params.timing.conn_slave_rf_latency;
- aci_stat->supervision_timeout = aci_evt->params.timing.conn_rf_timeout;
- break;
-
- default:
- /* Need default case to avoid compiler warnings about missing enum
- * values on some platforms.
- */
- break;
-
-
-
- }
- }
- return status;
-}
-
-
-bool lib_aci_send_ack(aci_state_t *aci_stat, const uint8_t pipe)
-{
- bool ret_val = false;
- {
- acil_encode_cmd_send_data_ack(&(msg_to_send.buffer[0]), pipe);
-
- ret_val = hal_aci_tl_send(&msg_to_send);
- }
- return ret_val;
-}
-
-
-bool lib_aci_send_nack(aci_state_t *aci_stat, const uint8_t pipe, const uint8_t error_code)
-{
- bool ret_val = false;
-
- {
-
- acil_encode_cmd_send_data_nack(&(msg_to_send.buffer[0]), pipe, error_code);
- ret_val = hal_aci_tl_send(&msg_to_send);
- }
- return ret_val;
-}
-
-
-bool lib_aci_broadcast(const uint16_t timeout, const uint16_t adv_interval)
-{
- aci_cmd_params_broadcast_t aci_cmd_params_broadcast;
- if (timeout > 16383)
- {
- return false;
- }
-
- // The adv_interval should be between 160 and 16384 (which translates to the advertisement
- // interval values 100 ms and 10.24 s.
- if ((160 > adv_interval) || (adv_interval > 16384))
- {
- return false;
- }
-
- aci_cmd_params_broadcast.timeout = timeout;
- aci_cmd_params_broadcast.adv_interval = adv_interval;
- acil_encode_cmd_broadcast(&(msg_to_send.buffer[0]), &aci_cmd_params_broadcast);
- return hal_aci_tl_send(&msg_to_send);
-}
-
-
-bool lib_aci_open_adv_pipes(const uint8_t * const adv_service_data_pipes)
-{
- uint8_t i;
-
- for (i = 0; i < PIPES_ARRAY_SIZE; i++)
- {
- aci_cmd_params_open_adv_pipe.pipes[i] = adv_service_data_pipes[i];
- }
-
- acil_encode_cmd_open_adv_pipes(&(msg_to_send.buffer[0]), &aci_cmd_params_open_adv_pipe);
- return hal_aci_tl_send(&msg_to_send);
-}
-
-bool lib_aci_open_adv_pipe(const uint8_t pipe)
-{
- uint8_t byte_idx = pipe / 8;
-
- aci_cmd_params_open_adv_pipe.pipes[byte_idx] |= (0x01 << (pipe % 8));
- acil_encode_cmd_open_adv_pipes(&(msg_to_send.buffer[0]), &aci_cmd_params_open_adv_pipe);
- return hal_aci_tl_send(&msg_to_send);
-}
-
-
-bool lib_aci_read_dynamic_data()
-{
- acil_encode_cmd_read_dynamic_data(&(msg_to_send.buffer[0]));
- return hal_aci_tl_send(&msg_to_send);
-}
-
-
-bool lib_aci_write_dynamic_data(uint8_t sequence_number, uint8_t* dynamic_data, uint8_t length)
-{
- acil_encode_cmd_write_dynamic_data(&(msg_to_send.buffer[0]), sequence_number, dynamic_data, length);
- return hal_aci_tl_send(&msg_to_send);
-}
-
-bool lib_aci_dtm_command(uint8_t dtm_command_msbyte, uint8_t dtm_command_lsbyte)
-{
- aci_cmd_params_dtm_cmd_t aci_cmd_params_dtm_cmd;
- aci_cmd_params_dtm_cmd.cmd_msb = dtm_command_msbyte;
- aci_cmd_params_dtm_cmd.cmd_lsb = dtm_command_lsbyte;
- acil_encode_cmd_dtm_cmd(&(msg_to_send.buffer[0]), &aci_cmd_params_dtm_cmd);
- return hal_aci_tl_send(&msg_to_send);
-}
-
-void lib_aci_flush(void)
-{
- hal_aci_tl_q_flush();
-}
-
-void lib_aci_debug_print(bool enable)
-{
- hal_aci_tl_debug_print(enable);
-
-}
-
-void lib_aci_pin_reset(void)
-{
- hal_aci_tl_pin_reset();
-}
-
-bool lib_aci_event_queue_empty(void)
-{
- return hal_aci_tl_rx_q_empty();
-}
-
-bool lib_aci_event_queue_full(void)
-{
- return hal_aci_tl_rx_q_full();
-}
-
-bool lib_aci_command_queue_empty(void)
-{
- return hal_aci_tl_tx_q_empty();
-}
-
-bool lib_aci_command_queue_full(void)
-{
- return hal_aci_tl_tx_q_full();
-}
diff --git a/peripheral/libupm/src/nrf8001/lib_aci.h b/peripheral/libupm/src/nrf8001/lib_aci.h
deleted file mode 100644
index fc85ef4..0000000
--- a/peripheral/libupm/src/nrf8001/lib_aci.h
+++ /dev/null
@@ -1,569 +0,0 @@
-/* Copyright (c) 2014, Nordic Semiconductor ASA
- *
- * 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.
- */
-
-/**
- * @file
- * @defgroup aci-lib aci-library
- * @brief ACI library
- *
- * Library for the logical part of the Application Controller Interface (ACI)
- *
- * @ingroup nrf8001
- */
-
-#ifndef LIB_ACI_H__
-#define LIB_ACI_H__
-
-/**
-* @{
-*/
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "hal_platform.h"
-#include "hal_aci_tl.h"
-#include "aci_queue.h"
-#include "aci.h"
-#include "aci_cmds.h"
-#include "aci_evts.h"
-
-#define EVT_CMD_RESPONSE_MIN_LENGTH 3
-
-#define PIPES_ARRAY_SIZE ((ACI_DEVICE_MAX_PIPES + 7)/8)
-
-/* Same size as a hal_aci_data_t */
-typedef struct {
- uint8_t debug_byte;
- aci_evt_t evt;
-} _aci_packed_ hal_aci_evt_t;
-
-ACI_ASSERT_SIZE(hal_aci_evt_t, 34);
-
-typedef struct
-{
- uint8_t location; /**< enum aci_pipe_store_t */
- aci_pipe_type_t pipe_type;
-} services_pipe_type_mapping_t;
-
-typedef struct aci_setup_info_t
-{
- services_pipe_type_mapping_t *services_pipe_type_mapping;
- uint8_t number_of_pipes;
- hal_aci_data_t *setup_msgs;
- uint8_t num_setup_msgs;
-} aci_setup_info_t;
-
-
-
-// aci_struct that will contain
-// total initial credits
-// current credit
-// current state of the aci (setup/standby/active/sleep)
-// open remote pipe pending
-// close remote pipe pending
-// Current pipe available bitmap
-// Current pipe closed bitmap
-// Current connection interval, slave latency and link supervision timeout
-// Current State of the the GATT client (Service Discovery status)
-// Relationship of bond to peer address
-typedef struct aci_state_t
-{
- aci_pins_t aci_pins; /* Pins on the MCU used to connect to the nRF8001 */
- aci_setup_info_t aci_setup_info; /* Data structures that are created from nRFgo Studio */
- uint8_t bonded; /* ( aci_bond_status_code_t ) Is the nRF8001 bonded to a peer device */
- uint8_t data_credit_total; /* Total data credit available for the specific version of the nRF8001, total equals available when a link is established */
- aci_device_operation_mode_t device_state; /* Operating mode of the nRF8001 */
-
- /* */
-
- /* Start : Variables that are valid only when in a connection */
- uint8_t data_credit_available; /* Available data credits at a specific point of time, ACI_EVT_DATA_CREDIT updates the available credits */
-
- uint16_t connection_interval; /* Multiply by 1.25 to get the connection interval in milliseconds*/
- uint16_t slave_latency; /* Number of consecutive connection intervals that the nRF8001 is not required to transmit. Use this to save power */
- uint16_t supervision_timeout; /* Multiply by 10 to get the supervision timeout in milliseconds */
-
- uint8_t pipes_open_bitmap[PIPES_ARRAY_SIZE]; /* Bitmap -> pipes are open and can be used for sending data over the air */
- uint8_t pipes_closed_bitmap[PIPES_ARRAY_SIZE]; /* Bitmap -> pipes are closed and cannot be used for sending data over the air */
- bool confirmation_pending; /* Attribute protocol Handle Value confirmation is pending for a Handle Value Indication
- (ACK is pending for a TX_ACK pipe) on local GATT Server*/
- /* End : Variables that are valid only when in a connection */
-
-} aci_state_t;
-
-
-
-#define DISCONNECT_REASON_CX_TIMEOUT 0x08
-#define DISCONNECT_REASON_CX_CLOSED_BY_PEER_DEVICE 0x13
-#define DISCONNECT_REASON_POWER_LOSS 0x14
-#define DISCONNECT_REASON_CX_CLOSED_BY_LOCAL_DEVICE 0x16
-#define DISCONNECT_REASON_ADVERTISER_TIMEOUT 0x50
-
-
-/** @name Functions for library management */
-//@{
-
-/** @brief Function to enable printing of all ACI commands sent and ACI events received
- * @details This function shall be used to enable or disable the debug printing.
- Debug printing is disabled by default.
- */
-void lib_aci_debug_print(bool enable);
-
-/** @brief Function to pin reset the nRF8001
- * @details Pin resets the nRF8001 also handles differences between development boards
- */
-void lib_aci_pin_reset(void);
-
-/** @brief Initialization function.
- * @details This function shall be used to initialize/reset ACI Library and also Resets the
- * nRF8001 by togging the reset pin of the nRF8001. This function will reset
- * all the variables locally used by ACI library to their respective default values.
- * @param bool True if the data was successfully queued for sending,
- * false if there is no more space to store messages to send.
- */
-void lib_aci_init(aci_state_t *aci_stat, bool debug);
-
-
-/** @brief Gets the number of currently available ACI credits.
- * @return Number of ACI credits.
- */
-uint8_t lib_aci_get_nb_available_credits(aci_state_t *aci_stat);
-
-/** @brief Gets the connection interval in milliseconds.
- * @return Connection interval in milliseconds.
- */
-uint16_t lib_aci_get_cx_interval_ms(aci_state_t *aci_stat);
-
-/** @brief Gets the connection interval in multiple of 1.25&nbsp;ms.
- * @return Connection interval in multiple of 1.25&nbsp;ms.
- */
-uint16_t lib_aci_get_cx_interval(aci_state_t *aci_stat);
-
-/** @brief Gets the current slave latency.
- * @return Current slave latency.
- */
-uint16_t lib_aci_get_slave_latency(aci_state_t *aci_stat);
-
-/** @brief Checks if a given pipe is available.
- * @param pipe Pipe to check.
- * @return True if the pipe is available, otherwise false.
- */
-bool lib_aci_is_pipe_available(aci_state_t *aci_stat, uint8_t pipe);
-
-/** @brief Checks if a given pipe is closed.
- * @param pipe Pipe to check.
- * @return True if the pipe is closed, otherwise false.
- */
-bool lib_aci_is_pipe_closed(aci_state_t *aci_stat, uint8_t pipe);
-
-/** @brief Checks if the discovery operation is finished.
- * @return True if the discovery is finished.
- */
-bool lib_aci_is_discovery_finished(aci_state_t *aci_stat);
-
-
-
-//@}
-
-/** @name ACI Commands available in all modes */
-//@{
-
-/** @brief Sets the radio in sleep mode.
- * @details The function sends a @c sleep command to the radio.
- * If the radio is advertising or connected, it sends back an error, then use lib_aci_radio_reset
- * if advertising or disconnect if in a connection.
- * @return True if the transaction is successfully initiated.
- */
-bool lib_aci_sleep(void);
-
-/** @brief Resets the radio.
- * @details The function sends a @c BasebandReset command to the radio.
- * @return True if the transaction is successfully initiated.
- */
-bool lib_aci_radio_reset(void);
-
-/** @brief Radio starts directed advertising to bonded device.
- * @details The function sends a @c DirectedConnect command to the radio.
- * @return True if the transaction is successfully initiated.
- */
-bool lib_aci_direct_connect(void);
-
-/** @brief Gets the radio's version.
- * @details This function sends a @c GetDeviceVersion command.
- * @return True if the transaction is successfully initiated.
- */
-bool lib_aci_device_version(void);
-
-/** @brief Gets the device address.
- * @details This function sends a @c GetDeviceAddress command.
- * @return True if the transaction is successfully initiated.
- */
-bool lib_aci_get_address(void);
-
-/** @brief Gets the temperature.
- * @details This function sends a @c GetTemperature command. lib_aci
- * calls the @ref lib_aci_transaction_finished_hook() function when the temperature is received.
- * @return True if the transaction is successfully initiated.
- */
-bool lib_aci_get_temperature(void);
-
-/** @brief Gets the battery level.
- * @details This function sends a @c GetBatteryLevel command.
- * @return True if the transaction is successfully initiated.
- */
-bool lib_aci_get_battery_level(void);
-
-//@}
-
-/** @name ACI commands available in Sleep mode */
-//@{
-
-/** @brief Wakes up the radio.
- * @details This function sends a @c Wakeup command to wake up the radio from
- * sleep mode. When woken up the radio sends a @c DeviceStartedEvent and
- * a @c CommandResponseEvent.
- * @return True if the transaction is successfully initiated.
- */
-bool lib_aci_wakeup(void);
-
-//@}
-
-/** @name ACI commands available in Active mode */
-//@{
-
-/** @brief Sets the radio in test mode.
- * @details This function sends a @c Test command to the radio. There are two
- * Test modes available:
- * - UART: DTM commands are received over UART.
- * - ACI: DTM commands are received over ACI.
- * The same command is used to exit the test mode When receiving
- * a @c DeviceStartedEvent the radio has entered the new mode.
- * @param enter_exit_test_mode Enter a Test mode, or exit Test mode.
- * @return True if the transaction is successfully initiated.
- */
-bool lib_aci_test(aci_test_mode_change_t enter_exit_test_mode);
-
-/** @brief Sets the radio's TX power.
- * @details This function sends a @c SetTxPower command.
- * @param tx_power TX power to be used by the radio.
- * @return True if the transaction is successfully initiated.
- */
-bool lib_aci_set_tx_power(aci_device_output_power_t tx_power);
-
-/** @brief Tries to connect to a peer device.
- * @details This function sends a @c Connect command to the radio.
- * @param run_timeout Maximum advertising time in seconds (0 means infinite).
- * @param adv_interval Advertising interval (in multiple of 0.625&nbsp;ms).
- * @return True if the transaction is successfully initiated.
- */
-bool lib_aci_connect(uint16_t run_timeout, uint16_t adv_interval);
-
-/** @brief Tries to bond with a peer device.
- * @details This function sends a @c Bond command to the radio.
- * @param run_timeout Maximum advertising time in seconds (0 means infinite).
- * @param adv_interval Advertising interval (in multiple of 0.625&nbsp;ms).
- * @return True if the transaction is successfully initiated.
- */
-bool lib_aci_bond(uint16_t run_timeout, uint16_t adv_interval);
-
-/** @brief Disconnects from peer device.
- * @details This function sends a @c Disconnect command to the radio.
- * @param reason Reason for disconnecting.
- * @return True if the transaction is successfully initiated.
- */
-bool lib_aci_disconnect(aci_state_t *aci_stat, aci_disconnect_reason_t reason);
-
-/**@brief Sets Local Data.
- * @details
- * This command updates the value of the characteristic value or the characteristic descriptor stored locally on the device.
- * Can be called for all types of pipes as long as the data is stored locally.
- * @param ACI state structure
- * @param pipe Pipe number on which the data should be set.
- * @param value Pointer to the data to set.
- * @param size Size of the data to set.
- * @return True if the transaction is successfully initiated.
-*/
-bool lib_aci_set_local_data(aci_state_t *aci_stat, uint8_t pipe, uint8_t *value, uint8_t size);
-
-/** @brief Sends Broadcast message to the radio.
- * @details The Broadcast message starts advertisement procedure
- * using the given interval with the intention of broadcasting data to a peer device.
- * @param timeout Time, in seconds, to advertise before exiting to standby mode (0 means infinite).
- * Valid values: 0 to 16383.
- * @param adv_interval Advertising interval (in multiple of 0.625&nbsp;ms).
- * Valid values: 160 to 16384 (which corresponds to an interval from 100 ms to 10.24 s).
- * @return True if the broadcast message is sent successfully to the radio.
-*/
-bool lib_aci_broadcast(const uint16_t timeout, const uint16_t adv_interval);
-
-/** @name Open Advertising Pipes. */
-
-/** @brief Sends a command to the radio to set the input pipe to be placed in Advertisement Service Data.
- * @details This function sends a command to the radio that places the pipe in
- * advertisement service data. To start advertising service data, call this function before
- * Connecting, Broadcasting or Bonding to peer. The data that should be sent in the advertisement packets
- * must be set using the @c lib_aci_set_local_data function. This function can be called during
- * advertising to enable/disable broadcast pipes.
- * @param pipe The pipe that has to be placed in advertising service data.
- * @return True if the Open Adv Pipe message is sent successfully to the radio.
-*/
-bool lib_aci_open_adv_pipe(const uint8_t pipe);
-
-
-/** @name Open Advertising Pipes */
-
-/** @brief Sends a command to the radio to set the pipes to be placed in Advertisement Service Data.
- * @details This function will send a command to the radio that will set the pipes to be placed in
- * advertisement Service Data. To start advertising service data, this function should be called before
- * Connecting, Broadcasting or Bonding to peer. This function can be called during
- * advertising to enable/disable broadcast pipes. Use this as an alternative to @ref lib_aci_open_adv_pipe
- * to avoid multiple function calls for placing multiple pipes in the adv data.
- * @param adv_service_data_pipes Pipe bitmap, where '1' indicates that the corresponding
- * Valid Values: 0000000000000000 to FEFFFFFFFFFFFF7F (See the ACI Pipe Status Evt bitmap in the nRF8001 datasheet
- * TX_BROADCAST pipe data is to be placed in Advertising Service Data fields
- * @return true if the Open Adv Pipe message was sent successfully to the radio.
-*/
-bool lib_aci_open_adv_pipes(const uint8_t * const adv_service_data_pipes);
-
-
-//@}
-
-/** @name ACI commands available in Connected mode */
-//@{
-
-
-/** @brief Sets a given application latency.
- * @details This function sends a @c setApplicationLatency command.
- * @return True if the transaction is successfully initiated.
- */
-bool lib_aci_set_app_latency(uint16_t latency, aci_app_latency_mode_t latency_mode);
-
-/** @brief Opens a remote pipe.
- * @details This function sends an @c OpenRemotePipe command.
- * @param pipe Number of the pipe to open.
- * @return True if the transaction is successfully initiated.
- */
-bool lib_aci_open_remote_pipe(aci_state_t *aci_stat, uint8_t pipe);
-
-/** @brief Closes a remote pipe.
- * @details This function sends an @c CloseRemotePipe command.
- * @param pipe Pipe number to close.
- * @return True if the transaction is successfully initiated.
- */
-bool lib_aci_close_remote_pipe(aci_state_t *aci_stat, uint8_t pipe);
-
-/** @brief Sends data on a given pipe.
- * @details This function sends a @c SendData command with application data to
- * the radio. This function memorizes credit use, and checks that
- * enough credits are available.
- * @param pipe Pipe number on which the data should be sent.
- * @param value Pointer to the data to send.
- * @param size Size of the data to send.
- * @return True if the transaction is successfully initiated.
- */
-bool lib_aci_send_data(uint8_t pipe, uint8_t *value, uint8_t size);
-
-/** @brief Requests data from a given pipe.
- * @details This function sends a @c RequestData command to the radio. This
- * function memorizes credit uses, and check that enough credits are available.
- * After this command, the radio sends back either a @c DataReceivedEvent
- * or a @c PipeErrorEvent.
- * @param pipe Pipe number on which the data is requested.
- * @return True if the transaction is successfully initiated.
- */
-bool lib_aci_request_data(aci_state_t *aci_stat, uint8_t pipe);
-
-/** @brief Sends a L2CAP change connection parameters request.
- * @details This function sends a @c ChangeTiming command to the radio. This command triggers a "L2CAP change connection parameters" request
- * to the master. If the master rejects or accepts but doesn't change the connection parameters within
- * 30 seconds, a timing event with the unchanged connection parameters is sent by the radio.
- * If the request is accepted and the master changes connection parameters, a timing event with
- * the new connection parameters is sent by the radio.
- * If the master doesn't reply to the request within 60 seconds, the radio disconnects.
- * @param minimun_cx_interval Minimum connection interval requested, in multiple of 1.25&nbsp;ms.
- * @param maximum_cx_interval Maximum connection interval requested, in multiple of 1.25&nbsp;ms.
- * @param slave_latency requested slave latency.
- * @param timeout requested slave timeout, in multiple of 10&nbsp;ms.
- * @return True if the transaction is successfully initiated.
- */
-bool lib_aci_change_timing(uint16_t minimun_cx_interval, uint16_t maximum_cx_interval, uint16_t slave_latency, uint16_t timeout);
-
-/** @brief Sends a L2CAP change connection parameters request with the connection predefined preffered connection parameters.
- * @details This function sends a @c ChangeTiming command to the radio. This command triggers a "L2CAP change connection parameters" request
- * to the master. If the master rejects or accepts but doesn't change the connection parameters within
- * 30 seconds, a timing event with the unchanged connection parameters is sent by the radio.
- * If the request is accepted and the master changes connection parameters, a timing event with
- * the new connection parameters is sent by the radio.
- * If the master doesn't reply to the request within 60 seconds, the radio disconnects.
- * The timing parameters used are the Timing parameters in the GAP settings in the nRFgo Studio.
- * The Timing parameters as stored as the GAP Preferred Peripheral Connection Parameters.
- * @return True if the transaction is successfully initiated.
- */
-bool lib_aci_change_timing_GAP_PPCP(void);
-
-/** @brief Sends acknowledgement message to peer.
- * @details This function sends @c SendDataAck command to radio. The radio is expected
- * to send either Handle Value Confirmation or Write response depending
- * on whether the data is stored remotely or locally.
- * @param pipe Pipe number for which the acknowledgement is to be sent.
- * @return True if the ack was sent successfully. False otherwise.
-*/
-bool lib_aci_send_ack(aci_state_t *aci_stat, const uint8_t pipe);
-
-/** @brief Sends negative acknowledgement message to peer.
- * @details This function sends @c SendDataNack command to radio. The radio is expected
- * to send Error Response to the peer.
- * @param pipe Pipe number for which the nack is to be sent.
- * @param error_code Error code to be sent in the NACk.
- * @return True if the nack was sent successfully. False otherwise.
-*/
-bool lib_aci_send_nack(aci_state_t *aci_stat, const uint8_t pipe, const uint8_t error_code);
-
-/** @brief Sends ReadDynamicData command to the host.
- * @details This function sends @c ReadDynamicData command to host. The host is expected
- * to send @c CommandResponse back with the dynamic data. The application is expected to
- * call this function in a loop until all the dynamic data is read out from the host.
- * As long as there is dynamic data to be read from the host, the command response
- * for this message has its status field set to ACI_STATUS_TRANSACTION_CONTINUE (0x01).
- * The application may chose to store this read out data in a non-volatile memory location
- * and later chose to write it back using the function lib_aci_write_dynamic_data.
- * @return True if the command was sent successfully through the ACI. False otherwise.
-*/
-bool lib_aci_read_dynamic_data(void);
-
-/** @brief Sends WriteDynamicData command to the host.
- * @details This function sends @c WriteDynamicData command to host. The host is expected
- * to send @c CommandResponse with the status of this operation. As long as the status field
- * in the @c CommandResponse is ACI_STATUS_TRANSACTION_CONTINUE (0x01), the hosts expects
- * more dynamic data to be written. This function should ideally be called in a cycle,
- * until all the stored dynamic data is sent to the host. This function should be
- * called with the dynamic data obtained from the response to a @c ReadDynamicData
- * (see @c lib_aci_read_dynamic_data) command.
- * @param sequence_number Sequence number of the dynamic data to be sent.
- * @param dynamic_data Pointer to the dynamic data.
- * @param length Length of the dynamic data.
- * @return True if the command was sent successfully through the ACI. False otherwise.
-*/
-bool lib_aci_write_dynamic_data(uint8_t sequence_number, uint8_t* dynamic_data, uint8_t length);
-//@}
-
-/** @name ACI commands available while connected in Bond mode */
-//@{
-
-/** @brief Sends a SMP Security Request.
- * @details This function send a @c BondRequest command to the radio.
- * This command triggers a SMP Security Request to the master. If the
- * master rejects with a pairing failed or if the bond timer expires the connection is closed.
- * @return True if the transaction is successfully initiated.
- */
-bool lib_aci_bond_request(void);
-
-/** @brief Set the key requested by the 8001.
- * @details This function sends an @c SetKey command to the radio.
- * @param key_rsp_type Type of key.
- * @param key Pointer to the key to set.
- * @param len Length of the key.
- * @return True if the transaction is successfully initiated.
-*/
-bool lib_aci_set_key(aci_key_type_t key_rsp_type, uint8_t *key, uint8_t len);
-
-//@}
-
-
-
-/** @name ACI commands available in Test mode */
-//@{
-
-/** @brief Sends an echo message
- * @details This function sends an @c Echo command to the radio. lib_aci
- * places the Echp ACI command in the ACI command queue
- * @param message_size Length of the data to send.
- * @param message_data Pointer to the data to send.
- * @return True if the transaction is successfully initiated.
-*/
-bool lib_aci_echo_msg(uint8_t message_size, uint8_t *message_data);
-
-/** @brief Sends an DTM command
- * @details This function sends an @c DTM command to the radio.
- * @param dtm_command_msbyte Most significant byte of the DTM command.
- * @param dtm_command_lsbyte Least significant byte of the DTM command.
- * @return True if the transaction is successfully initiated.
-*/
-bool lib_aci_dtm_command(uint8_t dtm_command_msbyte, uint8_t dtm_command_lsbyte);
-
-/** @brief Gets an ACI event from the ACI Event Queue
- * @details This function gets an ACI event from the ACI event queue.
- * The queue is updated by the SPI driver for the ACI running in the interrupt context
- * @param aci_stat pointer to the state of the ACI.
- * @param p_aci_data pointer to the ACI Event. The ACI Event received will be copied into this pointer.
- * @return True if an ACI Event was copied to the pointer.
-*/
-bool lib_aci_event_get(aci_state_t *aci_stat, hal_aci_evt_t * aci_evt);
-
-/** @brief Peeks an ACI event from the ACI Event Queue
- * @details This function peeks at the top event in the ACI event queue.
- * In polling mode, this function will query the nRF8001 for pending events, but unlike
- * lib_aci_event_get() it will not dequeue the event from the local queue, but will instead
- * only peek at it.
- * @return True if an ACI Event was copied to the pointer.
-*/
-bool lib_aci_event_peek(hal_aci_evt_t *p_aci_evt_data);
-
-/** @brief Flushes the events in the ACI command queues and ACI Event queue
- *
-*/
-void lib_aci_flush(void);
-
-/** @brief Return full status of the Event queue
- * @details
- *
- */
- bool lib_aci_event_queue_full(void);
-
- /** @brief Return empty status of the Event queue
- * @details
- *
- */
- bool lib_aci_event_queue_empty(void);
-
-/** @brief Return full status of Command queue
- * @details
- *
- */
- bool lib_aci_command_queue_full(void);
-
- /** @brief Return empty status of Command queue
- * @details
- *
- */
- bool lib_aci_command_queue_empty(void);
-
-//@}
-
-/** @} */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* LIB_ACI_H__ */
diff --git a/peripheral/libupm/src/nrf8001/nrf8001.cxx b/peripheral/libupm/src/nrf8001/nrf8001.cxx
deleted file mode 100644
index b771436..0000000
--- a/peripheral/libupm/src/nrf8001/nrf8001.cxx
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdint.h>
-
-#include "nrf8001.h"
-
-/**
- * Include the services_lock.h to put the setup in the OTP memory of the nRF8001.
- * This would mean that the setup cannot be changed once put in.
- * However this removes the need to do the setup of the nRF8001 on every reset.
-*/
-
-void
-init_local_interfaces (aci_state_t* aci, uint8_t reqn, uint8_t rdyn, uint8_t rst) {
- /**
- * Tell the ACI library, the MCU to nRF8001 pin connections.
- * The Active pin is optional and can be marked UNUSED
- */
- aci->aci_pins.board_name = BOARD_DEFAULT; // See board.h for details REDBEARLAB_SHIELD_V1_1 or BOARD_DEFAULT
- aci->aci_pins.reqn_pin = reqn; // SS for Nordic board, 9 for REDBEARLAB_SHIELD_V1_1
- aci->aci_pins.rdyn_pin = rdyn; // 3 for Nordic board, 8 for REDBEARLAB_SHIELD_V1_1
-
- aci->aci_pins.reset_pin = rst; // 4 for Nordic board, UNUSED for REDBEARLAB_SHIELD_V1_1
- aci->aci_pins.active_pin = UNUSED;
- aci->aci_pins.optional_chip_sel_pin = UNUSED;
-
- aci->aci_pins.interface_is_interrupt = false; // Interrupts still not available in Chipkit
- aci->aci_pins.interrupt_number = 1;
-
- lib_aci_init (aci, false);
-}
-
-void
-close_local_interfaces (aci_state_t* aci) {
- mraa_result_t error = MRAA_SUCCESS;
-
- error = mraa_spi_stop(aci->aci_pins.m_spi);
- if (error != MRAA_SUCCESS) {
-
- }
- error = mraa_gpio_close (aci->aci_pins.m_rdy_ctx);
- if (error != MRAA_SUCCESS) {
-
- }
- error = mraa_gpio_close (aci->aci_pins.m_req_ctx);
- if (error != MRAA_SUCCESS) {
-
- }
- error = mraa_gpio_close (aci->aci_pins.m_rst_ctx);
- if (error != MRAA_SUCCESS) {
-
- }
-}
diff --git a/peripheral/libupm/src/nrf8001/nrf8001.h b/peripheral/libupm/src/nrf8001/nrf8001.h
deleted file mode 100644
index a34fcee..0000000
--- a/peripheral/libupm/src/nrf8001/nrf8001.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/**
- * @brief NRF8001 Bluetooth Low Energy library
- * @defgroup nrf8001 libupm-nrf8001
- * @ingroup adafruit wifi analog gpio spi
- */
-/**
- * @library nrf8001
- * @sensor nrf8001
- * @comname NRF8001 Bluetooth Low Energy
- * @type wifi
- * @man adafruit
- * @web https://learn.adafruit.com/getting-started-with-the-nrf8001-bluefruit-le-breakout/introduction
- * @con spi gpio analog
- *
- * @brief NRF8001 Bluetooth Low Energy library
- *
- * These files define the NRF8001 interface for lib-nrf8001. Interaction
- * with this device is done through the ACI routines included with the library.
- * You can use the nRF UART app in Apple* App Store and Google* Play* on
- * Samsung* Galaxy S*4 running Android* 4.3 to interact with a microcontroller running
- * the 'hello world' example.
- *
- * @image html nrf8001.jpg
- * @snippet nrf8001-helloworld.cxx Interesting
- * @snippet nrf8001-broadcast.cxx Interesting
- */
-#pragma once
-
-#include <string>
-#include <mraa/aio.h>
-#include <mraa/gpio.h>
-#include <mraa/spi.h>
-
-#include <lib_aci.h>
-#include <aci_setup.h>
-
-void init_local_interfaces (aci_state_t* aci, uint8_t reqn, uint8_t rdyn, uint8_t rst);
-void close_local_interfaces (aci_state_t* aci);
diff --git a/peripheral/libupm/src/nrf8001/pyupm_nrf8001.i b/peripheral/libupm/src/nrf8001/pyupm_nrf8001.i
deleted file mode 100644
index a6b5dd5..0000000
--- a/peripheral/libupm/src/nrf8001/pyupm_nrf8001.i
+++ /dev/null
@@ -1,11 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_nrf8001
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "nrf8001.h"
-%{
- #include "nrf8001.h"
-%}
diff --git a/peripheral/libupm/src/nrf8001/uart_over_ble.h b/peripheral/libupm/src/nrf8001/uart_over_ble.h
deleted file mode 100644
index 9a72821..0000000
--- a/peripheral/libupm/src/nrf8001/uart_over_ble.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/* Copyright (c) 2013, Nordic Semiconductor ASA
- * 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 name of Nordic Semiconductor ASA 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 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.
- */
-
-/**
- * @file
- * @brief BLE specific macros
- * @ingroup nrf8001
- */
-
-#ifndef UART_OVER_BLE_H__
-#define UART_OVER_BLE_H__
-
-/**
- * @def UART_OVER_BLE_DISCONNECT
- * @brief
- * Command to queue a ACI Disconnect to the nRF8001
- */
-#define UART_OVER_BLE_DISCONNECT (0x01)
-
-
-/**
- * @def UART_OVER_BLE_LINK_TIMING_REQ
- * @brief
- * Command to queue a ACI Change Timing to the nRF8001
- */
-#define UART_OVER_BLE_LINK_TIMING_REQ (0x02)
-
-/**
- * @def UART_OVER_BLE_TRANSMIT_STOP
- * @brief
- * Command to stop sending UART over BLE packets
- */
-#define UART_OVER_BLE_TRANSMIT_STOP (0x03)
-
-
-/**
- * @def UART_OVER_BLE_TRANSMIT_OK
- * @brief
- * Command to allow sending UART over BLE packets
- */
-#define UART_OVER_BLE_TRANSMIT_OK (0x04)
-
-/**
- * @struct uart_over_ble_t
- * @brief State of the UART RTS over Bluetooth Low Energy(BLE)
- */
-typedef struct
-{
- uint8_t uart_rts_local; /**< State of the local UART RTS */
- uint8_t uart_rts_remote; /**< State of the remote UART RTS */
-} uart_over_ble_t;
-
-#endif // UART_OVER_BLE_H__
diff --git a/peripheral/libupm/src/nunchuck/CMakeLists.txt b/peripheral/libupm/src/nunchuck/CMakeLists.txt
deleted file mode 100644
index 7263ec8..0000000
--- a/peripheral/libupm/src/nunchuck/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "nunchuck")
-set (libdescription "upm wii nunchuck module")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/nunchuck/javaupm_nunchuck.i b/peripheral/libupm/src/nunchuck/javaupm_nunchuck.i
deleted file mode 100644
index e479d05..0000000
--- a/peripheral/libupm/src/nunchuck/javaupm_nunchuck.i
+++ /dev/null
@@ -1,20 +0,0 @@
-%module javaupm_nunchuck
-%include "../upm.i"
-%include "../java_buffer.i"
-
-%{
- #include "nunchuck.h"
-%}
-
-%include "nunchuck.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_nunchuck");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/nunchuck/jsupm_nunchuck.i b/peripheral/libupm/src/nunchuck/jsupm_nunchuck.i
deleted file mode 100644
index 2e67267..0000000
--- a/peripheral/libupm/src/nunchuck/jsupm_nunchuck.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_nunchuck
-%include "../upm.i"
-
-%{
- #include "nunchuck.h"
-%}
-
-%include "nunchuck.h"
diff --git a/peripheral/libupm/src/nunchuck/nunchuck.cxx b/peripheral/libupm/src/nunchuck/nunchuck.cxx
deleted file mode 100644
index 2790deb..0000000
--- a/peripheral/libupm/src/nunchuck/nunchuck.cxx
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <string>
-#include <stdexcept>
-#include <unistd.h>
-
-#include "nunchuck.h"
-
-using namespace upm;
-using namespace std;
-
-
-NUNCHUCK::NUNCHUCK(int bus, uint8_t addr)
-{
- stickX = 0;
- stickY = 0;
- accelX = 0;
- accelY = 0;
- accelZ = 0;
- buttonC = false;
- buttonZ = false;
-
- // setup our i2c link
- if ( !(m_i2c = mraa_i2c_init(bus)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_i2c_init() failed");
- return;
- }
-
- mraa_result_t rv;
-
- if ( (rv = mraa_i2c_address(m_i2c, addr)) != MRAA_SUCCESS )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_i2c_address() failed");
- }
-}
-
-NUNCHUCK::~NUNCHUCK()
-{
- mraa_i2c_stop(m_i2c);
-}
-
-bool NUNCHUCK::writeByte(uint8_t reg, uint8_t byte)
-{
- mraa_result_t rv;
-
- if ( (rv = mraa_i2c_write_byte_data(m_i2c, byte, reg)) != MRAA_SUCCESS )
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": mraa_i2c_write_byte_data() failed");
- return false;
- }
-
- return true;
-}
-
-int NUNCHUCK::readBytes(uint8_t reg, uint8_t *buffer, int len)
-{
- if (!len || !buffer)
- return 0;
-
- mraa_i2c_address(m_i2c, NUNCHUCK_I2C_ADDR);
- mraa_i2c_write_byte(m_i2c, reg);
-
- return mraa_i2c_read(m_i2c, buffer, len);
-}
-
-bool NUNCHUCK::init()
-{
- usleep(1000000);
-
- // disable encryption
- if (!writeByte(0xf0, 0x55))
- return false;
-
- if (!writeByte(0xfb, 0x00))
- return false;
-
- return true;
-}
-
-void NUNCHUCK::update()
-{
- const int bufsize = 6;
- uint8_t buf[bufsize];
- int rv;
-
- rv = readBytes(0x00, buf, bufsize);
-
- if (rv != bufsize)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": readBytes() failed");
- return;
- }
-
- // analog stick X
- stickX = buf[0];
-
- // analog stick Y
- stickY = buf[1];
-
- // accelerometer X
- accelX = ( (buf[2] << 2) | ((buf[5] & 0x0c) >> 2) );
-
- // accelerometer Y
- accelY = ( (buf[3] << 2) | ((buf[5] & 0x30) >> 4) );
-
- // accelerometer Z
- accelZ = ( (buf[4] << 2) | ((buf[5] & 0xc0) >> 6) );
-
- // buttonC
- if (buf[5] & 0x02)
- buttonC = false;
- else
- buttonC = true;
-
- // buttonZ
- if (buf[5] & 0x01)
- buttonZ = false;
- else
- buttonZ = true;
-}
-
diff --git a/peripheral/libupm/src/nunchuck/nunchuck.h b/peripheral/libupm/src/nunchuck/nunchuck.h
deleted file mode 100644
index 24d509f..0000000
--- a/peripheral/libupm/src/nunchuck/nunchuck.h
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include <mraa/i2c.h>
-
-#define NUNCHUCK_I2C_ADDR 0x52
-
-namespace upm {
-
- /**
- * @brief Wii Nunchuk library
- * @defgroup nunchuck libupm-nunchuck
- * @ingroup generic i2c accelerometer robok
- */
- /**
- * @library nunchuck
- * @sensor nunchuck
- * @comname Wii Nunchuk
- * @type accelerometer
- * @man generic
- * @web http://wiibrew.org/wiki/Wiimote/Extension_Controllers
- * @con i2c
- * @kit robok
- *
- * @brief API for the Wii* Nunchuk controller
- *
- * UPM module for the Wii Nunchuk controller. This module was tested with
- * Wii Nunchuk connected to I2C via a Grove Wii Nunchuk adapter.
- *
- * See http://wiibrew.org/wiki/Wiimote/Extension_Controllers and
- * http://wiibrew.org/wiki/Wiimote/Extension_Controllers/Nunchuck
- * for more details on the controller and its protocol.
- *
- * A warning for the Grove Wii Nunchuk adapter: it has 2 traces on one
- * side, and 3 traces on the other. Do not match these up with the
- * Nunchuk connector's traces. The connector's 'Grove'
- * should be on the same side as the Grove interface socket on the
- * adapter.
- *
- * @image html nunchuck.jpg
- * @snippet nunchuck.cxx Interesting
- */
- class NUNCHUCK {
- public:
- /**
- * NUNCHUCK constructor
- *
- * @param bus I2C bus to use
- * @param addr I2C address to use
- */
- NUNCHUCK(int bus, uint8_t addr=NUNCHUCK_I2C_ADDR);
-
- /**
- * NUNCHUCK destructor
- */
- ~NUNCHUCK();
-
- /**
- * Writes value(s) into registers
- *
- * @param reg Register location to start writing into
- * @param byte Byte to write
- * @return True if successful
- */
- bool writeByte(uint8_t reg, uint8_t byte);
-
- /**
- * Reads value(s) from registers
- *
- * @param reg Register location to start reading from
- * @param buffer Buffer for data storage
- * @param len Number of bytes to read
- * @return Number of bytes read
- */
- int readBytes(uint8_t reg, uint8_t *buffer, int len);
-
- /**
- * Initializes the controller. Here, we disable encryption after
- * delaying for a time to ensure the controller is ready.
- *
- * @return True if initialization is successful
- */
- bool init();
-
- /**
- * Reads and updates the current state of the controller.
- *
- */
- void update();
-
- /**
- * Current analog stick X position
- *
- */
- int stickX;
-
- /**
- * Current analog stick Y position
- *
- */
- int stickY;
-
- /**
- * Current accelerometer X value
- *
- */
- int accelX;
-
- /**
- * Current accelerometer Y value
- *
- */
- int accelY;
-
- /**
- * Current accelerometer Z value
- *
- */
- int accelZ;
-
- /**
- * Button C pressed?
- *
- */
- bool buttonC;
-
- /**
- * Button Z pressed?
- *
- */
- bool buttonZ;
-
- private:
- mraa_i2c_context m_i2c;
- };
-}
-
-
diff --git a/peripheral/libupm/src/nunchuck/pyupm_nunchuck.i b/peripheral/libupm/src/nunchuck/pyupm_nunchuck.i
deleted file mode 100644
index 091eba6..0000000
--- a/peripheral/libupm/src/nunchuck/pyupm_nunchuck.i
+++ /dev/null
@@ -1,11 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_nunchuck
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "nunchuck.h"
-%{
- #include "nunchuck.h"
-%}
diff --git a/peripheral/libupm/src/otp538u/CMakeLists.txt b/peripheral/libupm/src/otp538u/CMakeLists.txt
deleted file mode 100644
index 25004b7..0000000
--- a/peripheral/libupm/src/otp538u/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "otp538u")
-set (libdescription "upm otp538u IR temperature sensor")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/otp538u/javaupm_otp538u.i b/peripheral/libupm/src/otp538u/javaupm_otp538u.i
deleted file mode 100644
index 90703b8..0000000
--- a/peripheral/libupm/src/otp538u/javaupm_otp538u.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_otp538u
-%include "../upm.i"
-
-%{
- #include "otp538u.h"
-%}
-
-%include "otp538u.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_otp538u");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/otp538u/jsupm_otp538u.i b/peripheral/libupm/src/otp538u/jsupm_otp538u.i
deleted file mode 100644
index f8972ce..0000000
--- a/peripheral/libupm/src/otp538u/jsupm_otp538u.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_otp538u
-%include "../upm.i"
-
-%{
- #include "otp538u.h"
-%}
-
-%include "otp538u.h"
diff --git a/peripheral/libupm/src/otp538u/otp538u.cxx b/peripheral/libupm/src/otp538u/otp538u.cxx
deleted file mode 100644
index 6231ae3..0000000
--- a/peripheral/libupm/src/otp538u/otp538u.cxx
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <string>
-#include <stdexcept>
-
-#include "otp538u.h"
-
-#include "thermopile_vt_table.h"
-#include "thermister_rt_table.h"
-
-using namespace upm;
-using namespace std;
-
-OTP538U::OTP538U(int pinA, int pinO, float aref)
-{
- // this is the internal voltage reference on the Grove IR temp
- // sensor module
- m_vref = 2.5;
-
- // analog reference in use
- m_aref = aref;
-
- // This is the value of the output resistor of the Grove IR
- // temp sensor's SIG2 output (ambient)
- m_vResistance = 2000000; // 2M ohms
-
- // This was the default offset voltage in the seeedstudio code. You
- // can adjust as neccessary depending on your calibration.
- m_offsetVoltage = 0.014;
-
- // We need around 1mV resolution, so use 12 bit resolution (4096)
- // with a default aref of 5.0.
- m_adcResolution = 4096;
-
- if ( !(m_aioA = mraa_aio_init(pinA)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_gpio_init(pinA) failed, invalid pin?");
- return;
- }
-
- // enable 12 bit resolution
- mraa_aio_set_bit(m_aioA, 12);
-
- if ( !(m_aioO = mraa_aio_init(pinO)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_gpio_init(pinO) failed, invalid pin?");
- return;
- }
-
- // enable 12 bit resolution
- mraa_aio_set_bit(m_aioO, 12);
-}
-
-OTP538U::~OTP538U()
-{
- mraa_aio_close(m_aioA);
- mraa_aio_close(m_aioO);
-}
-
-float OTP538U::ambientTemperature()
-{
- const int samples = 5;
- int val = 0;
- float temp = 0;
- float res;
-
- for (int i=0; i<samples; i++)
- {
- val = mraa_aio_read(m_aioA);
- temp += val;
- usleep(10000);
- }
-
- temp = temp / samples;
- temp = temp * m_aref / m_adcResolution;
-
- // compute the resistance of the thermistor
- res = m_vResistance * temp / (m_vref - temp);
-
- // look it up in the thermistor (RT) resistence/temperature table
- int rawslot;
- int j;
- for (j=0; j<otp538u_rt_table_max; j++)
- if (otp538u_rt_table[j] < res)
- {
- rawslot = j;
- break;
- }
-
- if (j >= otp538u_rt_table_max)
- {
- throw std::out_of_range(std::string(__FUNCTION__) +
- ": ambient temperature out of range.");
- return 0;
- }
-
- // we need to compensate for the fact that we are supporting
- // temperature values less than 0 (-20C), so adjust correspondingly
- // so that we obtain the correct temperature 'slot'. This will be
- // our base temperature.
- int slot = rawslot - 20;
-
- // too cold
- if (slot < 0)
- {
- throw std::out_of_range(std::string(__FUNCTION__) +
- ": ambient temperature out of range.");
- return 0;
- }
-
- // now compute the ambient temperature
- float ambientTemp = slot - 1 +
- (otp538u_rt_table[rawslot - 1]-res) / (otp538u_rt_table[rawslot - 1] -
- otp538u_rt_table[rawslot]);
-
- return ambientTemp;
-}
-
-float OTP538U::objectTemperature()
-{
- const int samples = 5;
- const float reference_vol= 0.5; // what is this value? (from seeedstudio)
- const float tempIncrement=10;
- int val = 0;
- float temp = 0;
- float ambTemp = ambientTemperature();
-
- for (int i=0; i<samples; i++)
- {
- val = mraa_aio_read(m_aioO);
- temp += val;
- usleep(10000);
- }
-
- temp = temp / samples;
-
- float temp1 = temp * m_aref / m_adcResolution;
- float sensorVolts = temp1 - (reference_vol + m_offsetVoltage);
- // cout << "Sensor Voltage: " << sensorVolts << endl;
-
- // search the VT (voltage/temperature) table to find the object
- // temperature.
- int slot;
- // add +2 to compensate for the -20C and -10C slots below zero
- int voltOffset = int(ambTemp / 10) + 1 + 2;
- float voltage = sensorVolts * 10.0;
- for (slot=0; slot<(otp538u_vt_table_max - 1); slot++)
- {
- if ( (voltage > otp538u_vt_table[slot][voltOffset]) &&
- (voltage < otp538u_vt_table[slot+1][voltOffset]) )
- {
- break;
- }
- }
-
- if (slot >= (otp538u_vt_table_max - 1))
- {
- throw std::out_of_range(std::string(__FUNCTION__) +
- ": object temperature out of range.");
- return 0;
- }
-
- float objTemp = (float(tempIncrement) * voltage) /
- ( otp538u_vt_table[slot + 1][voltOffset] -
- otp538u_vt_table[slot][voltOffset] );
-
- // cout << "TABLE VALUE [" << slot << "][" <<
- // voltOffset << "] = " << otp538u_vt_table[slot][voltOffset] << endl;
-
- return (ambTemp + objTemp);
-}
diff --git a/peripheral/libupm/src/otp538u/otp538u.h b/peripheral/libupm/src/otp538u/otp538u.h
deleted file mode 100644
index cc81719..0000000
--- a/peripheral/libupm/src/otp538u/otp538u.h
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include <mraa/aio.h>
-
-namespace upm {
-
- /**
- * @brief OTP538U IR Temperature Sensor library
- * @defgroup otp538u libupm-otp538u
- * @ingroup seeed analog light hak
- */
- /**
- * @library otp538u
- * @sensor otp538u
- * @comname OTP538U IR Temperature Sensor
- * @altname Grove IR Temperature Sensor
- * @type light
- * @man generic
- * @con analog
- * @kit hak
- *
- * @brief API for the OTP538U IR Temperature Sensor
- *
- * UPM module for the OTP538U IR temperature sensor
- *
- * This module was tested with the Grove IR non-contact temperature
- * sensor.
- *
- * The sensor provides 2 analog outputs: one for the thermistor
- * that measures the ambient temperature, and the other for the thermopile
- * that measures the object temperature.
- *
- * Much of the code depends on analyzing Seeed Studio* examples
- * and the circuit design. As a result, there are several 'magic'
- * numbers derived from their circuit design. These values are used
- * by default.
- *
- * The tables used came from the "538U VT
- * Table__20_200(v1.3).pdf" and "538RT_table.pdf" datasheets.
- *
- * These tables assume the object to be measured is 9 cm (3.54
- * inches) from the sensor.
- *
- * @image html otp538u.jpg
- * @snippet otp538u.cxx Interesting
- */
- class OTP538U {
- public:
- /**
- * OTP538U constructor
- *
- * @param pinA Analog pin to use for the ambient temperature
- * @param pinO Analog pin to use for the object temperature
- * @param aref Analog reference voltage; default is 5.0 V
- */
- OTP538U(int pinA, int pinO, float aref = 5.0);
-
- /**
- * OTP538U destructor
- */
- ~OTP538U();
-
- /**
- * Gets the ambient temperature in Celsius
- *
- * @return Ambient temperature
- */
- float ambientTemperature();
-
- /**
- * Gets the object temperature in Celsius
- *
- * @return Object temperature
- */
- float objectTemperature();
-
- /**
- * Sets the offset voltage
- *
- * The Seeed Studio wiki gives an example of calibrating the sensor
- * and calculating the offset voltage to apply. Currently, the
- * default value is set, but you can use the function to set one
- * of your own.
- *
- * @param vOffset Desired offset voltage
- */
- void setVoltageOffset(float vOffset) { m_offsetVoltage = vOffset; };
-
- /**
- * Sets the output resistance value
- *
- * The Seeed Studio wiki example uses a value of 2,000,000 in one of
- * the equations used to calculate voltage. The value is the
- * resistance of a resistor they use in the output stage of their
- * SIG2 output. This was 'decoded' by looking at the EAGLE* files
- * containing their schematics for this device.
- *
- * @param outResistance Value of the output resistor; default is 2M Ohm
- */
- void setOutputResistence(int outResistance) {
- m_vResistance = outResistance; };
-
- /**
- * Sets the reference voltage of the internal Seeed Studio voltage
- * regulator on the sensor board.
- *
- * The Seeed Studio wiki example uses a value of 2.5 in one of the
- * equations used to calculate the resistance of the ambient
- * thermistor. The value is the voltage of an internal voltage
- * regulator used on the sensor board. This was 'decoded' by
- * looking at the EAGLE files containing their schematics for this
- * device.
- *
- * @param vref Reference voltage of the internal sensor; default is 2.5 V
- */
- void setVRef(float vref) { m_vref = vref; };
-
-
- private:
- float m_vref;
- float m_aref;
- int m_vResistance;
- float m_offsetVoltage;
- int m_adcResolution;
- mraa_aio_context m_aioA;
- mraa_aio_context m_aioO;
- };
-}
-
-
diff --git a/peripheral/libupm/src/otp538u/pyupm_otp538u.i b/peripheral/libupm/src/otp538u/pyupm_otp538u.i
deleted file mode 100644
index cb03b1e..0000000
--- a/peripheral/libupm/src/otp538u/pyupm_otp538u.i
+++ /dev/null
@@ -1,11 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_otp538u
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "otp538u.h"
-%{
- #include "otp538u.h"
-%}
diff --git a/peripheral/libupm/src/otp538u/thermister_rt_table.h b/peripheral/libupm/src/otp538u/thermister_rt_table.h
deleted file mode 100644
index bb8d3c9..0000000
--- a/peripheral/libupm/src/otp538u/thermister_rt_table.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-// This table was taken from the '538RT_table.pdf' datasheet. It maps
-// resistance values to ambient temperatures starting at -20C and
-// going up to 200C in increments of 1C
-
-static const int otp538u_rt_table_max = 121;
-
-static int otp538u_rt_table[otp538u_rt_table_max] = {
- 919730, 869299, 821942, 777454, 735644, 696336, 659365, 624578, 591834,
- 561002, 531958, 504588, 478788, 454457, 431504, 409843, 389394, 370082,
- 351839, 334598, 318300, 302903, 288329, 274533, 261471, 249100, 237381,
- 226276, 215750, 205768, 196300, 187316, 178788, 170691, 163002, 155700,
- 148766, 142183, 135936, 130012, 124400, 119038, 113928, 109059, 104420,
- 100000, 95788, 91775, 87950, 84305, 80830, 77517, 74357, 71342, 68466,
- 65720, 63098, 60595, 58202, 55916, 53730, 51645, 49652, 47746, 45924,
- 44180, 42511, 40912, 39380, 37910, 36500, 35155, 33866, 32631, 31446,
- 30311, 29222, 28177, 27175, 26213, 25290, 24403, 23554, 22738, 21955,
- 21202, 20479, 19783, 19115, 18472, 17854, 17260, 16688, 16138, 15608,
- 15098, 14608, 14135, 13680, 13242, 12819, 12412, 12020, 11642, 11278,
- 10926, 10587, 10260, 9945, 9641, 9347, 9063, 8789, 8525, 8270, 8023,
- 7785, 7555, 7333, 7118, 6911
-};
-
diff --git a/peripheral/libupm/src/otp538u/thermopile_vt_table.h b/peripheral/libupm/src/otp538u/thermopile_vt_table.h
deleted file mode 100644
index d97d137..0000000
--- a/peripheral/libupm/src/otp538u/thermopile_vt_table.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-// This table was taken from the '538U VT Table__20_200(v1.3).pdf'
-// datasheet, but the 25C column has been removed for consistency.
-
-static const int otp538u_vt_table_max = 23;
-
-// Thermistor temperature (C)
-// { -20 -10 0 10 20 30 40 50 60 70 80 90 100 }
-
-static float otp538u_vt_table[otp538u_vt_table_max][13] = {
- // object temp (C)
- {0.000, -0.246, -0.523, -0.832, -1.177, -1.559, // -20C
- -1.981, -2.446, -2.957, -3.516, -4.126, -4.791, -5.513},
-
- {0.243, 0.000, -0.274, -0.580, -0.922, -1.301, // -10
- -1.721, -2.183, -2.691, -3.247, -3.854, -4.516, -5.236},
-
- {0.511, 0.271, 0.000, -0.303, -0.642, -1.018, // 0
- -1.434, -1.894, -2.398, -2.951, -3.556, -4.215, -4.931},
-
- {0.804, 0.567, 0.300, 0.000, -0.335, -0.708, // 10
- -1.121, -1.577, -2.078, -2.628, -3.229, -3.884, -4.597},
-
- {1.125, 0.891, 0.628, 0.331, 0.000, -0.369, // 20
- -0.778, -1.230, -1.728, -2.274, -2.871, -3.523, -4.232},
-
- {1.474, 1.244, 0.985, 0.692, 0.365, 0.000, // 30
- -0.405, -0.853, -1.347, -1.889, -2.482, -3.130, -3.835},
-
- {1.852, 1.628, 1.372, 1.084, 0.761, 0.401, // 40
- 0.000, -0.444, -0.933, -1.470, -2.059, -2.702, -3.403},
-
- {2.263, 2.043, 1.792, 1.509, 1.191, 0.835, // 50
- 0.439, 0.000, -0.484, -1.017, -1.601, -2.240, -2.936},
-
- {2.706, 2.491, 2.246, 1.968, 1.655, 1.304, // 60
- 0.913, 0.479, 0.000, -0.528, -1.107, -1.740, -2.431},
-
- {3.184, 2.975, 2.735, 2.462, 2.155, 1.809, // 70
- 1.424, 0.996, 0.522, 0.000, -0.573, -1.201, -1.887},
-
- {3.698, 3.495, 3.261, 2.994, 2.692, 2.353, // 80
- 1.974, 1.552, 1.084, 0.568, 0.000, -0.622, -1.301},
-
- {4.250, 4.053, 3.825, 3.565, 3.270, 2.937, // 90
- 2.564, 2.148, 1.687, 1.177, 0.616, 0.000, -0.673},
-
- {4.841, 4.651, 4.430, 4.177, 3.888, 3.562, // 100
- 3.196, 2.787, 2.332, 1.829, 1.275, 0.666, 0.000},
-
- {5.473, 5.290, 5.076, 4.830, 4.549, 4.231, // 110
- 3.872, 3.470, 3.023, 2.527, 1.980, 1.379, 0.720},
-
- {6.147, 5.972, 5.767, 5.528, 5.255, 4.944, // 120
- 4.593, 4.199, 3.760, 3.272, 2.733, 2.139, 1.488},
-
- {6.866, 6.699, 6.502, 6.272, 6.007, 5.705, // 130
- 5.362, 4.976, 4.545, 4.066, 3.535, 2.950, 2.307},
-
- {7.631, 7.473, 7.285, 7.064, 6.808, 6.514, // 140
- 6.180, 5.803, 5.381, 4.910, 4.388, 3.812, 3.178},
-
- {8.444, 8.295, 8.116, 7.905, 7.658, 7.373, // 150
- 7.049, 6.682, 6.269, 5.807, 5.295, 4.728, 4.103},
-
- {9.306, 9.167, 8.998, 8.796, 8.560, 8.285, // 160
- 7.971, 7.613, 7.211, 6.759, 6.257, 5.700, 5.085},
-
- {10.219, 10.091, 9.933, 9.741, 9.515, 9.251, // 170
- 8.947, 8.601, 8.208, 7.768, 7.276, 6.729, 6.125},
-
- {11.185, 11.068, 10.921, 10.741, 10.526, 10.274, // 180
- 9.981, 9.645, 9.264, 8.835, 8.354, 7.818, 7.226},
-
- {12.206, 12.101, 11.966, 11.798, 11.595, 11.354, // 190
- 11.073, 10.749, 10.380, 9.962, 9.493, 8.969, 8.388},
-
- {13.284, 13.191, 13.068, 12.913, 12.722, 12.494, // 200
- 12.225, 11.914, 11.557, 11.152, 10.695, 10.184, 9.616}
-};
-
diff --git a/peripheral/libupm/src/ozw/CMakeLists.txt b/peripheral/libupm/src/ozw/CMakeLists.txt
deleted file mode 100644
index 6c67157..0000000
--- a/peripheral/libupm/src/ozw/CMakeLists.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-set (libname "ozw")
-set (libdescription "upm module for the OpenZWave library interface")
-set (module_src ${libname}.cxx zwNode.cxx)
-set (module_h ${libname}.h)
-
-pkg_search_module(OPENZWAVE libopenzwave)
-if (OPENZWAVE_FOUND)
- set (reqlibname "libopenzwave")
- include_directories(${OPENZWAVE_INCLUDE_DIRS})
- upm_module_init()
- add_dependencies(${libname} ${OPENZWAVE_LIBRARIES})
- target_link_libraries(${libname} ${OPENZWAVE_LIBRARIES})
- if (BUILDSWIG)
- if (BUILDSWIGNODE)
- swig_link_libraries (jsupm_${libname} ${OPENZWAVE_LIBRARIES} ${MRAA_LIBRARIES} ${NODE_LIBRARIES})
- endif()
- if (BUILDSWIGPYTHON)
- swig_link_libraries (pyupm_${libname} ${OPENZWAVE_LIBRARIES} ${PYTHON_LIBRARIES} ${MRAA_LIBRARIES})
- endif()
- endif()
-endif ()
diff --git a/peripheral/libupm/src/ozw/javaupm_ozw.i b/peripheral/libupm/src/ozw/javaupm_ozw.i
deleted file mode 100644
index 1b6ccdc..0000000
--- a/peripheral/libupm/src/ozw/javaupm_ozw.i
+++ /dev/null
@@ -1,23 +0,0 @@
-%module javaupm_ozw
-%include "../upm.i"
-%include "cpointer.i"
-%include "typemaps.i"
-%include "arrays_java.i";
-%include "../java_buffer.i"
-
-%{
- #include "ozw.h"
-%}
-
-%include "ozw.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_ozw");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%}
diff --git a/peripheral/libupm/src/ozw/jsupm_ozw.i b/peripheral/libupm/src/ozw/jsupm_ozw.i
deleted file mode 100644
index 209fe62..0000000
--- a/peripheral/libupm/src/ozw/jsupm_ozw.i
+++ /dev/null
@@ -1,12 +0,0 @@
-%module jsupm_ozw
-%include "../upm.i"
-%include "cpointer.i"
-%include "stdint.i"
-
-%pointer_functions(float, floatp);
-
-%include "ozw.h"
-%{
- #include "ozw.h"
-%}
-
diff --git a/peripheral/libupm/src/ozw/ozw.cxx b/peripheral/libupm/src/ozw/ozw.cxx
deleted file mode 100644
index 4f8df34..0000000
--- a/peripheral/libupm/src/ozw/ozw.cxx
+++ /dev/null
@@ -1,909 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <stdexcept>
-#include <string>
-#include <pthread.h>
-
-#include "platform/Log.h"
-
-#include "zwNode.h"
-
-#include "ozw.h"
-
-using namespace upm;
-using namespace std;
-using namespace OpenZWave;
-
-
-OZW::OZW()
-{
- m_mgrCreated = false;
- m_driverFailed = false;
- m_homeId = 0;
-
- pthread_mutexattr_t mutexAttrib;
- pthread_mutexattr_init(&mutexAttrib);
- pthread_mutexattr_settype(&mutexAttrib, PTHREAD_MUTEX_RECURSIVE);
-
- if (pthread_mutex_init(&m_nodeLock, &mutexAttrib))
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": pthread_mutex_init(nodeLock) failed");
- }
-
- pthread_mutexattr_destroy(&mutexAttrib);
-
- if (pthread_mutex_init(&m_initLock, NULL))
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": pthread_mutex_init(initLock) failed");
- }
-
- // initialize our init conditional
- if (pthread_cond_init(&m_initCond, NULL))
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": pthread_cond_init() failed");
- }
-
- setDebug(false);
-}
-
-OZW::~OZW()
-{
- if (m_mgrCreated)
- {
- // remove the driver
- if (m_driverIsHID)
- Manager::Get()->RemoveDriver("HID");
- else
- Manager::Get()->RemoveDriver(m_devicePath);
-
- // remove the notification handler
- Manager::Get()->RemoveWatcher(notificationHandler, this);
-
- // now destroy Manager and Options. Options must be destroyed
- // after the Manager is destroyed.
- Manager::Destroy();
- Options::Destroy();
- }
-
- pthread_mutex_destroy(&m_nodeLock);
- pthread_mutex_destroy(&m_initLock);
- pthread_cond_destroy(&m_initCond);
-
- // delete any nodes. This should be safe after deleting the node
- // mutex since the handler is no longer registered.
- for (zwNodeMap_t::iterator it = m_zwNodeMap.begin();
- it != m_zwNodeMap.end(); ++it)
- {
- // delete the zwNode pointer
- delete (*it).second;
- }
- // empty the map
- m_zwNodeMap.clear();
-}
-
-void OZW::optionsCreate(std::string configPath,
- std::string userConfigDir,
- std::string cmdLine)
-{
- Options::Create(configPath, userConfigDir, cmdLine);
-}
-
-void OZW::optionAddInt(std::string name, int val)
-{
- Options::Get()->AddOptionInt(name, val);
-}
-
-void OZW::optionAddBool(std::string name, bool val)
-{
- Options::Get()->AddOptionBool(name, val);
-}
-
-void OZW::optionAddString(std::string name, std::string val, bool append)
-{
- Options::Get()->AddOptionString(name, val, append);
-}
-
-void OZW::optionsLock()
-{
- // lock the options if not already locked
- if (!Options::Get()->AreLocked())
- Options::Get()->Lock();
-}
-
-bool OZW::init(string devicePath, bool isHID)
-{
- // make sure options are locked
- optionsLock();
-
- pthread_mutex_lock(&m_initLock);
-
- // the fun begins
- Manager::Create();
-
- // add our event handler
- Manager::Get()->AddWatcher(notificationHandler, this);
-
- // now add the driver
- m_devicePath = devicePath;
- if (isHID)
- {
- m_driverIsHID = true;
- Manager::Get()->AddDriver("HID",
- Driver::ControllerInterface_Hid);
- }
- else
- Manager::Get()->AddDriver(devicePath);
-
- m_mgrCreated = true;
-
- // now we block here waiting for the driver to get far enough along
- // (or fail) to proceed further
- pthread_cond_wait(&m_initCond, &m_initLock);
-
- if (m_driverFailed)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": driver initialization failed");
- return false;
- }
-
- return true;
-}
-
-void OZW::notificationHandler(Notification const* notification, void *ctx)
-{
- upm::OZW *This = (upm::OZW *)ctx;
-
- This->lockNodes();
-
- if (This->m_debugging)
- fprintf(stderr, "### %s: homeId %08x, nodeId %d, type %x\n",
- __FUNCTION__,
- notification->GetHomeId(),
- notification->GetNodeId(),
- notification->GetType());
-
- const uint32_t homeId = notification->GetHomeId();
- const uint8_t nodeId = notification->GetNodeId();
-
- switch (notification->GetType())
- {
-
- case Notification::Type_NodeAdded:
- case Notification::Type_NodeNew:
- {
- if (This->m_debugging)
- cerr << "### ### ADDING NODE: " << int(nodeId) << endl;
- zwNode *node = new zwNode(homeId, nodeId);
- This->m_zwNodeMap.insert(std::pair<uint8_t, zwNode *>(nodeId, node));
-
- break;
- }
-
- case Notification::Type_NodeRemoved:
- {
- if (This->m_debugging)
- cerr << "### ### REMOVING NODE: " << int(nodeId) << endl;
- if (This->m_zwNodeMap.count(nodeId) != 0)
- {
- delete This->m_zwNodeMap[nodeId];
- This->m_zwNodeMap.erase(nodeId);
- }
-
- break;
- }
-
- case Notification::Type_ValueAdded:
- {
- if (This->m_debugging)
- cerr << "### ### VALUE ADDED " << endl;
- This->m_zwNodeMap[nodeId]->addValueID(notification->GetValueID());
-
- break;
- }
-
- case Notification::Type_ValueRemoved:
- {
- if (This->m_debugging)
- cerr << "### ### VALUE DELETED " << endl;
- This->m_zwNodeMap[nodeId]->removeValueID(notification->GetValueID());
-
- break;
- }
-
- case Notification::Type_ValueChanged:
- {
- // might be able to do something with this someday...
- break;
- }
-
- case Notification::Type_DriverReset:
- {
- // all nodes deleted. According to OZW docs, this happens
- // when a driver is reset, instead of sending potentially
- // hundreds of ValueRemoved/NodeRemoved events.
- for (zwNodeMap_t::iterator it = This->m_zwNodeMap.begin();
- it != This->m_zwNodeMap.end(); ++it)
- {
- // delete the zwNode pointer
- delete (*it).second;
- }
- // empty the map
- This->m_zwNodeMap.clear();
-
- break;
- }
-
- case Notification::Type_DriverReady:
- {
- if (This->m_debugging)
- fprintf(stderr, "### DriverReady, homeID = %08x\n", This->m_homeId);
- This->m_homeId = notification->GetHomeId();
- break;
- }
-
- case Notification::Type_DriverFailed:
- {
- if (This->m_debugging)
- cerr << "### Driver FAILED" << endl;
- This->m_driverFailed = true;
- // wake up init()
- pthread_cond_broadcast(&(This->m_initCond));
- break;
- }
-
- case Notification::Type_AwakeNodesQueried:
- case Notification::Type_AllNodesQueried:
- case Notification::Type_AllNodesQueriedSomeDead:
- {
- if (This->m_debugging)
- cerr << "### Awake/All/SomeDead complete" << endl;
- // wake up init()
- pthread_cond_broadcast(&(This->m_initCond));
- break;
- }
-
- // might be able to do something with these someday too
- case Notification::Type_Notification:
- case Notification::Type_NodeNaming:
- case Notification::Type_NodeProtocolInfo:
- case Notification::Type_NodeQueriesComplete:
- case Notification::Type_PollingEnabled:
- case Notification::Type_PollingDisabled:
- case Notification::Type_NodeEvent:
- case Notification::Type_Group:
- default:
- {
- break;
- }
- }
-
- This->unlockNodes();
-}
-
-void OZW::dumpNodes(bool all)
-{
- // iterate through all the nodes and dump various info on them
-
- lockNodes();
-
- for (zwNodeMap_t::iterator it = m_zwNodeMap.begin();
- it != m_zwNodeMap.end(); ++it)
- {
- uint8_t nodeId = (*it).first;
-
- cerr << "Node " << int(nodeId)
- << ": "
- << Manager::Get()->GetNodeProductName(m_homeId, nodeId)
- << endl;
- (*it).second->dumpNode(all);
- }
-
- unlockNodes();
-}
-
-bool OZW::getValueID(int nodeId, int index, ValueID *vid)
-{
- // nodeId's are uint8_t's in OpenZWave, but we want to use int's to
- // avoid hassles when dealing with SWIG, so here we just throw away
- // everything except the first byte.
- nodeId &= 0xff;
-
- lockNodes();
-
- zwNodeMap_t::iterator it;
-
- it = m_zwNodeMap.find(nodeId);
-
- if (it == m_zwNodeMap.end())
- {
- cerr << __FUNCTION__ << ": Node " << nodeId
- << " does not exist" << endl;
- unlockNodes();
- return false;
- }
-
- // now get the ValueID
- if (!(*it).second->indexToValueID(index, vid))
- {
- cerr << __FUNCTION__ << ": Index " << index
- << " for node " << nodeId
- << " does not exist" << endl;
- unlockNodes();
- return false;
- }
-
- unlockNodes();
- return true;
-}
-
-string OZW::getValueAsString(int nodeId, int index)
-{
- // we have to play this game since there is no default ctor for ValueID
- ValueID vid(m_homeId, (uint64)0);
-
- string rv;
-
- lockNodes();
-
- if (getValueID(nodeId, index, &vid))
- Manager::Get()->GetValueAsString(vid, &rv);
-
- unlockNodes();
-
- return rv;
-}
-
-string OZW::getValueUnits(int nodeId, int index)
-{
- ValueID vid(m_homeId, (uint64)0);
-
- lockNodes();
-
- string rv;
- if (getValueID(nodeId, index, &vid))
- rv = Manager::Get()->GetValueUnits(vid);
-
- unlockNodes();
-
- return rv;
-}
-
-void OZW::setValueUnits(int nodeId, int index, string text)
-{
- ValueID vid(m_homeId, (uint64)0);
-
- lockNodes();
-
- if (getValueID(nodeId, index, &vid))
- Manager::Get()->SetValueUnits(vid, text);
-
- unlockNodes();
-}
-
-string OZW::getValueLabel(int nodeId, int index)
-{
- ValueID vid(m_homeId, (uint64)0);
-
- lockNodes();
-
- string rv;
- if (getValueID(nodeId, index, &vid))
- rv = Manager::Get()->GetValueLabel(vid);
-
- unlockNodes();
-
- return rv;
-}
-
-void OZW::setValueLabel(int nodeId, int index, string text)
-{
- ValueID vid(m_homeId, (uint64)0);
-
- lockNodes();
-
- if (getValueID(nodeId, index, &vid))
- Manager::Get()->SetValueLabel(vid, text);
-
- unlockNodes();
-}
-
-string OZW::getValueHelp(int nodeId, int index)
-{
- ValueID vid(m_homeId, (uint64)0);
-
- lockNodes();
-
- string rv;
- if (getValueID(nodeId, index, &vid))
- rv = Manager::Get()->GetValueHelp(vid);
-
- unlockNodes();
-
- return rv;
-}
-
-void OZW::setValueHelp(int nodeId, int index, string text)
-{
- ValueID vid(m_homeId, (uint64)0);
-
- lockNodes();
-
- if (getValueID(nodeId, index, &vid))
- Manager::Get()->SetValueHelp(vid, text);
-
- unlockNodes();
-}
-
-void OZW::setValueAsBool(int nodeId, int index, bool val)
-{
- if (isValueReadOnly(nodeId, index))
- {
- cerr << __FUNCTION__ << ": Node " << nodeId << " index " << index
- << " is ReadOnly" << endl;
- return;
- }
-
- ValueID vid(m_homeId, (uint64)0);
-
- lockNodes();
-
- if (getValueID(nodeId, index, &vid))
- {
- if (!Manager::Get()->SetValue(vid, val))
- {
- cerr << __FUNCTION__ << ": Value is not a bool type" << endl;
- }
- }
-
- unlockNodes();
-}
-
-void OZW::setValueAsByte(int nodeId, int index, uint8_t val)
-{
- if (isValueReadOnly(nodeId, index))
- {
- cerr << __FUNCTION__ << ": Node " << nodeId << " index " << index
- << " is ReadOnly" << endl;
- return;
- }
-
- ValueID vid(m_homeId, (uint64)0);
-
- lockNodes();
-
- if (getValueID(nodeId, index, &vid))
- {
- if (!Manager::Get()->SetValue(vid, val))
- {
- cerr << __FUNCTION__ << ": Value is not a byte type" << endl;
- }
- }
-
- unlockNodes();
-}
-
-void OZW::setValueAsFloat(int nodeId, int index, float val)
-{
- if (isValueReadOnly(nodeId, index))
- {
- cerr << __FUNCTION__ << ": Node " << nodeId << " index " << index
- << " is ReadOnly" << endl;
- return;
- }
-
- ValueID vid(m_homeId, (uint64)0);
-
- lockNodes();
-
- if (getValueID(nodeId, index, &vid))
- {
- if (!Manager::Get()->SetValue(vid, val))
- {
- cerr << __FUNCTION__ << ": Value is not a float type" << endl;
- }
- }
-
- unlockNodes();
-}
-
-void OZW::setValueAsInt32(int nodeId, int index, int32_t val)
-{
- if (isValueReadOnly(nodeId, index))
- {
- cerr << __FUNCTION__ << ": Node " << nodeId << " index " << index
- << " is ReadOnly" << endl;
- return;
- }
-
- ValueID vid(m_homeId, (uint64)0);
-
- lockNodes();
-
- if (getValueID(nodeId, index, &vid))
- {
- if (!Manager::Get()->SetValue(vid, val))
- {
- cerr << __FUNCTION__ << ": Value is not a int32 type" << endl;
- }
- }
-
- unlockNodes();
-}
-
-void OZW::setValueAsInt16(int nodeId, int index, int16_t val)
-{
- if (isValueReadOnly(nodeId, index))
- {
- cerr << __FUNCTION__ << ": Node " << nodeId << " index " << index
- << " is ReadOnly" << endl;
- return;
- }
-
- ValueID vid(m_homeId, (uint64)0);
-
- lockNodes();
-
- if (getValueID(nodeId, index, &vid))
- {
- if (!Manager::Get()->SetValue(vid, val))
- {
- cerr << __FUNCTION__ << ": Value is not a int16 type" << endl;
- }
- }
-
- unlockNodes();
-}
-
-void OZW::setValueAsBytes(int nodeId, int index, uint8_t *val, uint8_t len)
-{
- if (isValueReadOnly(nodeId, index))
- {
- cerr << __FUNCTION__ << ": Node " << nodeId << " index " << index
- << " is ReadOnly" << endl;
- return;
- }
-
- ValueID vid(m_homeId, (uint64)0);
-
- lockNodes();
-
- if (getValueID(nodeId, index, &vid))
- {
- if (!Manager::Get()->SetValue(vid, val, len))
- {
- cerr << __FUNCTION__ << ": Value is not a bytes type" << endl;
- }
- }
-
- unlockNodes();
-}
-
-void OZW::setValueAsString(int nodeId, int index, string val)
-{
- if (isValueReadOnly(nodeId, index))
- {
- cerr << __FUNCTION__ << ": Node " << nodeId << " index " << index
- << " is ReadOnly" << endl;
- return;
- }
-
- ValueID vid(m_homeId, (uint64)0);
-
- lockNodes();
-
- if (getValueID(nodeId, index, &vid))
- {
- if (!Manager::Get()->SetValue(vid, val))
- {
- // this should always succeed, but for consistancy...
- cerr << __FUNCTION__ << ": Value is not a string type" << endl;
- }
- }
-
- unlockNodes();
-}
-
-void OZW::refreshValue(int nodeId, int index)
-{
- ValueID vid(m_homeId, (uint64)0);
-
- lockNodes();
-
- if (getValueID(nodeId, index, &vid))
- Manager::Get()->RefreshValue(vid);
-
- unlockNodes();
-}
-
-int OZW::getValueMin(int nodeId, int index)
-{
- ValueID vid(m_homeId, (uint64)0);
-
- lockNodes();
-
- int rv = 0;
- if (getValueID(nodeId, index, &vid))
- rv = Manager::Get()->GetValueMin(vid);
-
- unlockNodes();
- return rv;
-}
-
-int OZW::getValueMax(int nodeId, int index)
-{
- ValueID vid(m_homeId, (uint64)0);
-
- lockNodes();
-
- int rv = 0;
- if (getValueID(nodeId, index, &vid))
- rv = Manager::Get()->GetValueMax(vid);
-
- unlockNodes();
- return rv;
-}
-
-bool OZW::isValueReadOnly(int nodeId, int index)
-{
- ValueID vid(m_homeId, (uint64)0);
-
- lockNodes();
-
- bool rv = false;
- if (getValueID(nodeId, index, &vid))
- rv = Manager::Get()->IsValueReadOnly(vid);
-
- unlockNodes();
- return rv;
-}
-
-bool OZW::isValueWriteOnly(int nodeId, int index)
-{
- ValueID vid(m_homeId, (uint64)0);
-
- lockNodes();
-
- bool rv = false;
- if (getValueID(nodeId, index, &vid))
- rv = Manager::Get()->IsValueWriteOnly(vid);
-
- unlockNodes();
- return rv;
-}
-
-bool OZW::isValueSet(int nodeId, int index)
-{
- ValueID vid(m_homeId, (uint64)0);
-
- lockNodes();
-
- bool rv = false;
- if (getValueID(nodeId, index, &vid))
- rv = Manager::Get()->IsValueSet(vid);
-
- unlockNodes();
- return rv;
-}
-
-bool OZW::isValuePolled(int nodeId, int index)
-{
- ValueID vid(m_homeId, (uint64)0);
-
- lockNodes();
-
- bool rv = false;
- if (getValueID(nodeId, index, &vid))
- rv = Manager::Get()->IsValuePolled(vid);
-
- unlockNodes();
- return rv;
-}
-
-bool OZW::getValueAsBool(int nodeId, int index)
-{
- if (isValueWriteOnly(nodeId, index))
- {
- cerr << __FUNCTION__ << ": Node " << nodeId << " index " << index
- << " is WriteOnly" << endl;
- return false;
- }
-
- ValueID vid(m_homeId, (uint64)0);
-
- lockNodes();
-
- bool rv = false;
- if (getValueID(nodeId, index, &vid))
- {
- if (!Manager::Get()->GetValueAsBool(vid, &rv))
- {
- cerr << __FUNCTION__ << ": Value is not a bool type, returning "
- << rv << endl;
- }
- }
-
- unlockNodes();
- return rv;
-}
-
-uint8_t OZW::getValueAsByte(int nodeId, int index)
-{
- if (isValueWriteOnly(nodeId, index))
- {
- cerr << __FUNCTION__ << ": Node " << nodeId << " index " << index
- << " is WriteOnly" << endl;
- return 0;
- }
-
- ValueID vid(m_homeId, (uint64)0);
-
- lockNodes();
-
- uint8_t rv = false;
- if (getValueID(nodeId, index, &vid))
- {
- if (!Manager::Get()->GetValueAsByte(vid, &rv))
- {
- cerr << __FUNCTION__ << ": Value is not a byte type, returning "
- << int(rv) << endl;
- }
- }
-
- unlockNodes();
- return rv;
-}
-
-float OZW::getValueAsFloat(int nodeId, int index)
-{
- if (isValueWriteOnly(nodeId, index))
- {
- cerr << __FUNCTION__ << ": Node " << nodeId << " index " << index
- << " is WriteOnly" << endl;
- return 0.0;
- }
-
- ValueID vid(m_homeId, (uint64)0);
-
- lockNodes();
-
- float rv = 0.0;
- if (getValueID(nodeId, index, &vid))
- {
- if (!Manager::Get()->GetValueAsFloat(vid, &rv))
- {
- cerr << __FUNCTION__ << ": Value is not a float type, returning "
- << rv << endl;
- }
- }
-
- unlockNodes();
- return rv;
-}
-
-int OZW::getValueAsInt32(int nodeId, int index)
-{
- if (isValueWriteOnly(nodeId, index))
- {
- cerr << __FUNCTION__ << ": Node " << nodeId << " index " << index
- << " is WriteOnly" << endl;
- return 0;
- }
-
- ValueID vid(m_homeId, (uint64)0);
-
- lockNodes();
-
- int32_t rv = 0;
- if (getValueID(nodeId, index, &vid))
- {
- if (!Manager::Get()->GetValueAsInt(vid, &rv))
- {
- cerr << __FUNCTION__ << ": Value is not an int32 type, returning "
- << rv << endl;
- }
- }
-
- unlockNodes();
- return int(rv);
-}
-
-int OZW::getValueAsInt16(int nodeId, int index)
-{
- if (isValueWriteOnly(nodeId, index))
- {
- cerr << __FUNCTION__ << ": Node " << nodeId << " index " << index
- << " is WriteOnly" << endl;
- return 0;
- }
-
- ValueID vid(m_homeId, (uint64)0);
-
- lockNodes();
-
- int16_t rv = 0;
- if (getValueID(nodeId, index, &vid))
- {
- if (!Manager::Get()->GetValueAsShort(vid, &rv))
- {
- cerr << __FUNCTION__ << ": Value is not an int16 type, returning "
- << rv << endl;
- }
- }
-
- unlockNodes();
- return int(rv);
-}
-
-bool OZW::isNodeListeningDevice(int nodeId)
-{
- nodeId &= 0xff;
-
- lockNodes();
-
- bool rv = Manager::Get()->IsNodeListeningDevice(m_homeId, nodeId);
-
- unlockNodes();
- return rv;
-}
-
-bool OZW::isNodeFrequentListeningDevice(int nodeId)
-{
- nodeId &= 0xff;
-
- lockNodes();
-
- bool rv = Manager::Get()->IsNodeFrequentListeningDevice(m_homeId, nodeId);
-
- unlockNodes();
- return rv;
-}
-
-bool OZW::isNodeAwake(int nodeId)
-{
- nodeId &= 0xff;
-
- lockNodes();
-
- bool rv = Manager::Get()->IsNodeAwake(m_homeId, nodeId);
-
- unlockNodes();
- return rv;
-}
-
-void OZW::setDebug(bool enable)
-{
- m_debugging = enable;
-
- // To bad the following does not seem to affect anything. The only
- // way I've found to control it is via the options.xml file.
-
- // Log::SetLoggingState(enable);
-}
diff --git a/peripheral/libupm/src/ozw/ozw.h b/peripheral/libupm/src/ozw/ozw.h
deleted file mode 100644
index e4f4152..0000000
--- a/peripheral/libupm/src/ozw/ozw.h
+++ /dev/null
@@ -1,574 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include <map>
-
-#include "Manager.h"
-#include "Notification.h"
-#include "Options.h"
-#include "Driver.h"
-#include "Node.h"
-#include "Group.h"
-#include "platform/Log.h"
-
-namespace upm {
-
- /**
- * @brief OZW OpenZWave library
- * @defgroup ozw libupm-ozw
- * @ingroup uart wifi
- */
-
- /**
- * @library ozw
- * @sensor ozw
- * @comname UPM wrapper for the OpenZWave library
- * @type wifi
- * @man other
- * @con uart
- * @web http://www.openzwave.com/
- *
- * @brief UPM API for the OpenZWave library
- *
- * This module implements a wrapper around the OpenZWave library.
- * OpenZWave must be compiled and installed on your machine in order
- * to use this library.
- *
- * This module was developed with OpenZWave 1.3, and an Aeon Z-Stick
- * Gen5 configured as a Primary Controller. It provides the ability
- * to query and set various values that can be used to control ZWave
- * devices. It does not concern itself with configuration of
- * devices. It is assumed that you have already setup your ZWave
- * network using a tool like the OpenZWave control panel, and have
- * already configured your devices as appropriate.
- *
- * To avoid exposing some of the internals of OpenZWave, devices
- * (nodes) and their values, are accessed via a nodeId and a value
- * index number. The example will run dumpNodes() which will list
- * the currently connected devices and the values that are available
- * to them, along with an index number for that value. It is
- * through these values (nodeId and index) that you can query and
- * set device values.
- *
- * In addition to querying values from a device (such as state
- * (on/off), or temperature, etc), methods are provided to allow you
- * to control these devices to the extent they allow, for example,
- * using a ZWave connected switch to turn on a lamp.
- *
- * Since it's likely no two ZWave networks are going to be the same,
- * the example will just initialize OpenZWave and run the
- * dumpNodes() method to allow you to see what devices are present,
- * the values they support and their current content, along with the
- * per-node index number you can use to address them. There will be
- * commented out code examples showing you how to query or set a
- * specific value for a device.
- *
- * See the ozw example code comments for an example of the ouput of
- * running dumpNodes().
- *
- * In most of the methods below, You will need the NodeId (Node
- * number), and the Index number to access or otherwise affect these
- * values.
- *
- * @snippet openzwave.cxx Interesting
- */
-
- // forward declaration of private zwNode data
- class zwNode;
-
- class OZW {
- public:
-
- typedef std::map<uint8_t, zwNode *> zwNodeMap_t;
-
- /**
- * OZW constructor
- */
- OZW();
-
- /**
- * OZW Destructor
- */
- ~OZW();
-
- /**
- * Start configuration with basic options. This must be called
- * prior to init(), after the OZW() contructor is called.
- *
- * @param configPath Set the location of the OpenZWave config
- * directory, default is /etc/openzwave
- * @param userConfigDir Set the path to the user configuration
- * directory. This is the location of the zwcfg*.xml and
- * option.xml files for the user (probably created by the
- * OpenZWave Control Panel example application). The default is
- * the current directory ("").
- * @param cmdLine Specify command line formatted options to
- * OpenZWave. The default is "".
- */
- void optionsCreate(std::string configPath="/etc/openzwave",
- std::string userConfigDir="",
- std::string cmdLine="");
-
- /**
- * Add an integer Option. See the OpenZWave documentation for
- * valid values.
- *
- * @param name The name of the configuration option
- * @param val The value to set it to
- */
- void optionAddInt(std::string name, int val);
-
- /**
- * Add a boolean Option. See the OpenZWave documentation for
- * valid values.
- *
- * @param name The name of the configuration option
- * @param val The value to set it to
- */
- void optionAddBool(std::string name, bool val);
-
- /**
- * Add a string Option. See the OpenZWave documentation for valid
- * values.
- *
- * @param name The name of the configuration option
- * @param val The value to set it to
- * @append true to append to the option, false to override
- */
- void optionAddString(std::string name, std::string val, bool append);
-
- /**
- * Lock the Options. This must be called after all options have
- * been set, and before init() is called. If init() is called
- * without locking the Options, init() will lock them itself.
- * After the options have been locked, no further options can be
- * specified.
- */
- void optionsLock();
-
- /**
- * Initialize the ZWave network. This method will start a probe
- * of all defined devices on the ZWave network and query essential
- * information about them. This function will not return until
- * either initialization has failed, or has succeeded far enough
- * along for the following methods to work. Depending on the size
- * an complexity of the ZWave network, this may take anywhere from
- * seconds to several minutes to complete.
- *
- * All Options (via option*()) must have been specified before
- * this function is called. If the Options have not been locked
- * via optionsLock() prior to calling init(), this method will
- * lock them for you before proceeding.
- *
- * @param devicePath The device path for the ZWave controller,
- * typically something like /dev/ttyACM0, or similiar
- * @param isHID true if this is a HID device, false otherwise (ie:
- * a serial port like /dev/ttyACM0, /dev/ttyUSB0, etc). Default
- * is false.
- * @return true if init succeeded, false otherwise
- */
- bool init(std::string devicePath, bool isHID=false);
-
- /**
- * Dump information about all configured nodes and their values to
- * stdout. This is useful to determine what nodes are available,
- * and the index (used for querying and seting values for them).
- * In addition, it includes information about each value (type,
- * current value, etc).
- *
- * @param all set to true to dump information about all values
- * available for each node. If false, only information about
- * 'user' values (ignoring 'system' and 'configuration') are
- * output. The default is false ('user' values only).
- */
- void dumpNodes(bool all=false);
-
- /**
- * Return a string (which may be empty) indicating the Units of
- * measure for a given value. For example, querying a temperature
- * value may return "F" to indicate Fahrenheit.
- *
- * @param nodeId The node ID to query
- * @param index The value index (see dumpNodes()) of the value to query.
- * @return A string containing the Unit of measure for the value
- */
- std::string getValueUnits(int nodeId, int index);
-
- /**
- * Set the text for the Units of measure for a value.
- *
- * @param nodeId The node ID to query
- * @param index The value index (see dumpNodes()) of the value to query.
- * @param text The text to set
- */
- void setValueUnits(int nodeId, int index, std::string text);
-
- /**
- * Return a string (which may be empty) containing the
- * user-freindly Label for a value.
- *
- * @param nodeId The node ID to query
- * @param index The value index (see dumpNodes()) of the value to query.
- * @return A string containing the Value's label
- */
- std::string getValueLabel(int nodeId, int index);
-
- /**
- * Set the text for a Value's label.
- *
- * @param nodeId The node ID to query
- * @param index The value index (see dumpNodes()) of the value to query.
- * @param text The text to set
- */
- void setValueLabel(int nodeId, int index, std::string text);
-
- /**
- * Return a string (which may be empty) indicating the Help text
- * of a value, if available.
- *
- * @param nodeId The node ID to query
- * @param index The value index (see dumpNodes()) of the value to query.
- * @return A string containing the Help text, if available
- */
- std::string getValueHelp(int nodeId, int index);
-
- /**
- * Set the text for a Value's help text.
- *
- * @param nodeId The node ID to query
- * @param index The value index (see dumpNodes()) of the value to query.
- * @param text The text to set
- */
- void setValueHelp(int nodeId, int index, std::string text);
-
- /**
- * Set the contents of a Value to a string. This should always
- * succeed if the supplied content makes sense for a given value,
- * regardless of the value's actual type.
- *
- * @param nodeId The node ID
- * @param index The value index (see dumpNodes()) of the value to query.
- * @param val the content to assign to the value referenced by
- * nodeId, and index.
- */
- void setValueAsString(int nodeId, int index, std::string val);
-
- /**
- * Set the contents of a Value, to a bool. This will fail, and an
- * error message printed if the value type is not a boolean value.
- *
- * @param nodeId The node ID
- * @param index The value index (see dumpNodes()) of the value to query.
- * @param val the boolean content to assign to the value referenced
- * by nodeId, and index.
- */
- void setValueAsBool(int nodeId, int index, bool val);
-
- /**
- * Set the contents of a Value, to a byte. This will fail, and an
- * error message printed if the value type is not a byte value.
- *
- * @param nodeId The node ID
- * @param index The value index (see dumpNodes()) of the value to query.
- * @param val the byte content to assign to the value referenced
- * by nodeId, and index.
- */
- void setValueAsByte(int nodeId, int index, uint8_t val);
-
- /**
- * Set the contents of a Value, to a float. This will fail, and an
- * error message printed if the value type is not a float value.
- *
- * @param nodeId The node ID
- * @param index The value index (see dumpNodes()) of the value to query.
- * @param val the float content to assign to the value referenced
- * by nodeId, and index.
- */
- void setValueAsFloat(int nodeId, int index, float val);
-
- /**
- * Set the contents of a Value, to a 32 bit integer (int32). This
- * will fail, and an error message printed if the value type is
- * not an int32.
- *
- * @param nodeId The node ID
- * @param index The value index (see dumpNodes()) of the value to query.
- * @param val the int32 content to assign to the value referenced
- * by nodeId, and index.
- */
- void setValueAsInt32(int nodeId, int index, int32_t val);
-
- /**
- * Set the contents of a Value, to a 16 bit integer (int16). This
- * will fail, and an error message printed if the value type is
- * not an int16.
- *
- * @param nodeId The node ID
- * @param index The value index (see dumpNodes()) of the value to query.
- * @param val the int16 content to assign to the value referenced
- * by nodeId, and index.
- */
- void setValueAsInt16(int nodeId, int index, int16_t val);
-
- /**
- * Set the contents of a Value, to an array of bytes. This will
- * fail, and an error message printed if the value type is not
- * settable as an array of bytes.
- *
- * @param nodeId The node ID
- * @param index The value index (see dumpNodes()) of the value to query.
- * @param val the byte array content to assign to the value referenced
- * by nodeId, and index.
- * @param len The length of the byte array
- */
- void setValueAsBytes(int nodeId, int index, uint8_t *val, uint8_t len);
-
- /**
- * Get the minimum allowed value for a node's Value.
- *
- * @param nodeId The node ID
- * @param index The value index (see dumpNodes()) of the value to query.
- * @return The minumum allowed value
- */
- int getValueMin(int nodeId, int index);
-
- /**
- * Get the maximum allowed value for a node's Value.
- *
- * @param nodeId The node ID
- * @param index The value index (see dumpNodes()) of the value to query.
- * @return The maximum allowed value
- */
- int getValueMax(int nodeId, int index);
-
- /**
- * Test whether a value is read-only.
- *
- * @param nodeId The node ID
- * @param index The value index (see dumpNodes()) of the value to query.
- * @return true if the value is read-only, false otherwise
- */
- bool isValueReadOnly(int nodeId, int index);
-
- /**
- * Test whether a value is write only.
- *
- * @param nodeId The node ID
- * @param index The value index (see dumpNodes()) of the value to query.
- * @return true if the value is write-only, false otherwise
- */
- bool isValueWriteOnly(int nodeId, int index);
-
- /**
- * Test whether a value is really set on a node, and not a default
- * value chosen by the OpenZWave library.
- *
- * @param nodeId The node ID
- * @param index The value index (see dumpNodes()) of the value to query.
- * @return true if the value is really set, false if a default value is
- * being reported
- */
- bool isValueSet(int nodeId, int index);
-
- /**
- * Test whether a value is being manually polled by the OpenZWave
- * library. Most modern devices are never polled, rather they are
- * configured to report changing values to the controller on their
- * own at device specific intervals or when appropriate events
- * (depending the device) have occured.
- *
- * @param nodeId The node ID
- * @param index The value index (see dumpNodes()) of the value to query.
- * @return true if the value is being maually polled, false otherwise
- * being reported
- */
- bool isValuePolled(int nodeId, int index);
-
- /**
- * Return the content of a value as a string. This should always
- * succeed, regardless of the actual value type.
- *
- * @param nodeId The node ID
- * @param index The value index (see dumpNodes()) of the value to query.
- * @return A string representing the current contents of a value.
- */
- std::string getValueAsString(int nodeId, int index);
-
- /**
- * Return the content of a value as a booleang. This will fail,
- * and an error message printed if the value type is not boolean.
- *
- * @param nodeId The node ID
- * @param index The value index (see dumpNodes()) of the value to query.
- * @return A boolean representing the current contents of a value.
- */
- bool getValueAsBool(int nodeId, int index);
-
- /**
- * Return the content of a value as a byte. This will fail, and
- * an error message printed if the value type is not a byte.
- *
- * @param nodeId The node ID
- * @param index The value index (see dumpNodes()) of the value to query.
- * @return A byte representing the current contents of a value.
- */
- uint8_t getValueAsByte(int nodeId, int index);
-
- /**
- * Return the content of a value as a float. This will fail, and
- * an error message printed if the value type is not a floating
- * point value.
- *
- * @param nodeId The node ID
- * @param index The value index (see dumpNodes()) of the value to query.
- * @return A float representing the current contents of a value.
- */
- float getValueAsFloat(int nodeId, int index);
-
- /**
- * Return the content of a value as an int32. This will fail, and
- * an error message printed if the value type is not an int32.
- *
- * @param nodeId The node ID
- * @param index The value index (see dumpNodes()) of the value to query.
- * @return An int32 representing the current contents of a value.
- */
- int getValueAsInt32(int nodeId, int index);
-
- /**
- * Return the content of a value as an int16. This will fail, and
- * an error message printed if the value type is not an int16.
- *
- * @param nodeId The node ID
- * @param index The value index (see dumpNodes()) of the value to query.
- * @return An int16 representing the current contents of a value.
- */
- int getValueAsInt16(int nodeId, int index);
-
- /**
- * Issue a refresh request for a value on a node. OpenZWave will
- * query the value and update it's internal state when the device
- * responds. Note, this happens asynchronously - it may take some
- * time before the current value is reported to OpenZWave by the
- * node. If the node is asleep, you may not get a current value
- * for some time (or at all, depending on the device). This
- * method will return immediately after the request has been
- * queued.
- *
- * @param nodeId The node ID
- * @param index The value index (see dumpNodes()) of the value to query.
- */
- void refreshValue(int nodeId, int index);
-
- /**
- * Enable or disable some debugging output. Note, this will not
- * affect OpenZWave's own debugging, which is usually set in the
- * option.xml file.
- *
- * @param enable true to enable debugging, false otherwise
- */
- void setDebug(bool enable);
-
- /**
- * Determine if a node is a listening device -- in other words, the
- * node never sleeps.
- *
- * @param nodeId The node ID
- * @return true if the node never sleeps, false otherwise
- */
- bool isNodeListeningDevice(int nodeId);
-
- /**
- * Determine if a node is a frequent listening device -- in other
- * words, if the node is asleep, can it be woken by a beam.
- *
- * @param nodeId The node ID
- * @return true if the node is a frequent listening device, false
- * otherwise
- */
- bool isNodeFrequentListeningDevice(int nodeId);
-
- /**
- * Determine if a node is awake.
- *
- * @param nodeId The node ID
- * @return true if the node is awake, false otherwise
- */
- bool isNodeAwake(int nodeId);
-
- protected:
- /**
- * Based on a nodeId and a value index, lookup the corresponding
- * OpenZWave ValueID.
- *
- * @param nodeId The node ID
- * @param index The value index (see dumpNodes()) of the value to query.
- * @param A pointer to a ValueID that will be returned if successful
- * @return true of the nodeId and index was found, false otherwise
- */
- bool getValueID(int nodeId, int index, OpenZWave::ValueID *vid);
-
- /**
- * Lock the m_zwNodeMap mutex to protect against changes made to
- * the the the map by the OpenZWave notification handler. Always
- * lock this mutex when acessing anything in the zwNodeMap map.
- */
-
- void lockNodes() { pthread_mutex_lock(&m_nodeLock); };
- /**
- * Unlock the m_zwNodeMap mutex after lockNodes() has been called.
- */
- void unlockNodes() { pthread_mutex_unlock(&m_nodeLock); };
-
- private:
- uint32_t m_homeId;
- bool m_mgrCreated;
- bool m_driverFailed;
- bool m_debugging;
-
- bool m_driverIsHID;
- std::string m_devicePath;
-
- // our notification handler, called by OpenZWave for events on the
- // network.
- static void notificationHandler(OpenZWave::Notification
- const* notification,
- void *ctx);
-
- // a map of added nodes
- zwNodeMap_t m_zwNodeMap;
-
- // for coordinating access to the node list
- pthread_mutex_t m_nodeLock;
-
- // We use these to determine init failure or success (if OpenZWave
- // has successfully queried essential data about the network).
- pthread_mutex_t m_initLock;
- pthread_cond_t m_initCond;
- };
-}
-
-
diff --git a/peripheral/libupm/src/ozw/pyupm_ozw.i b/peripheral/libupm/src/ozw/pyupm_ozw.i
deleted file mode 100644
index ee987a3..0000000
--- a/peripheral/libupm/src/ozw/pyupm_ozw.i
+++ /dev/null
@@ -1,17 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_ozw
-%include "../upm.i"
-%include "cpointer.i"
-
-%include "stdint.i"
-
-%feature("autodoc", "3");
-
-%pointer_functions(float, floatp);
-
-%include "ozw.h"
-%{
- #include "ozw.h"
-%}
-
diff --git a/peripheral/libupm/src/ozw/zwNode.cxx b/peripheral/libupm/src/ozw/zwNode.cxx
deleted file mode 100644
index a55729b..0000000
--- a/peripheral/libupm/src/ozw/zwNode.cxx
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <stdint.h>
-#include <string>
-#include "zwNode.h"
-
-#include "Node.h"
-
-using namespace upm;
-using namespace std;
-using namespace OpenZWave;
-
-zwNode::zwNode(uint32_t homeId, uint8_t nodeId)
-{
- m_homeId = homeId;
- m_nodeId = nodeId;
-
- m_vindex = 0;
-}
-
-zwNode::~zwNode()
-{
-}
-
-uint8_t zwNode::nodeId()
-{
- return m_nodeId;
-}
-
-uint32_t zwNode::homeId()
-{
- return m_homeId;
-}
-
-void zwNode::addValueID(ValueID vid)
-{
- // We need to use insert since ValueID's default ctor is private
- m_values.insert(std::pair<int, ValueID>(m_vindex++, vid));
-}
-
-void zwNode::removeValueID(ValueID vid)
-{
- //we have to get a little complicated here since we need to delete
- //the value id, but the map is indexed by m_vindex
- for (valueMap_t::iterator it = m_values.begin();
- it != m_values.end(); ++it)
- {
- if ((*it).second == vid)
- {
- m_values.erase((*it).first);
- break;
- }
- }
-}
-
-bool zwNode::indexToValueID(int index, ValueID *vid)
-{
- valueMap_t::iterator it;
-
- it = m_values.find(index);
-
- if (it == m_values.end())
- {
- // not found, return false
- return false;
- }
- else
- *vid = (*it).second;
-
- return true;
-}
-
-void zwNode::dumpNode(bool all)
-{
- for (valueMap_t::iterator it = m_values.begin();
- it != m_values.end(); ++it)
- {
- int vindex = (*it).first;
- ValueID vid = (*it).second;
- string label = Manager::Get()->GetValueLabel(vid);
- string valueAsStr;
- Manager::Get()->GetValueAsString(vid, &valueAsStr);
- string valueUnits = Manager::Get()->GetValueUnits(vid);
- ValueID::ValueType vType = vid.GetType();
- string vTypeStr;
-
- switch (vType)
- {
- case ValueID::ValueType_Bool:
- vTypeStr = "bool";
- break;
-
- case ValueID::ValueType_Byte:
- vTypeStr = "byte";
- break;
-
- case ValueID::ValueType_Decimal:
- vTypeStr = "float";
- break;
-
- case ValueID::ValueType_Int:
- vTypeStr = "int32";
- break;
-
- case ValueID::ValueType_List:
- vTypeStr = "list";
- break;
-
- case ValueID::ValueType_Schedule:
- vTypeStr = "schedule";
- break;
-
- case ValueID::ValueType_Short:
- vTypeStr = "int16";
- break;
-
- case ValueID::ValueType_String:
- vTypeStr = "string";
- break;
-
- case ValueID::ValueType_Button:
- vTypeStr = "button";
- break;
-
- case ValueID::ValueType_Raw:
- vTypeStr = "raw";
- break;
-
- default:
- vTypeStr = "undefined";
- break;
- }
-
- // by default we only want user values, unless 'all' is true
- if (all || (vid.GetGenre() == ValueID::ValueGenre_User))
- fprintf(stderr, "\t Index: %2d, Type: %s, Label: %s, Value: %s %s\n",
- vindex,
- vTypeStr.c_str(),
- label.c_str(),
- valueAsStr.c_str(),
- valueUnits.c_str());
- }
-}
-
-
-
diff --git a/peripheral/libupm/src/ozw/zwNode.h b/peripheral/libupm/src/ozw/zwNode.h
deleted file mode 100644
index 0b01dc6..0000000
--- a/peripheral/libupm/src/ozw/zwNode.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <map>
-
-#include "Manager.h"
-
-namespace upm {
-
- class zwNode {
- public:
- typedef std::map<int, OpenZWave::ValueID> valueMap_t;
-
- /**
- * zwNode contructor.
- *
- * @param homeId the homeId os the network controller
- * @param nodeId the node index
- */
- zwNode(uint32_t homeId, uint8_t nodeId);
-
- ~zwNode();
-
- /**
- * get the nodeId
- *
- * @return The nodeId for this node
- */
- uint8_t nodeId();
-
- /**
- * get the homeId
- *
- * @return The homeId for this node
- */
- uint32_t homeId();
-
- /**
- * Add an OpenZWave ValueID and index to the value map,
- * incrementing m_vindex.
- *
- * @param vid The OpenZWave ValueID
- */
- void addValueID(OpenZWave::ValueID vid);
-
- /**
- * Remove an OpenZWave ValueID from the value map.
- *
- * @param vid The OpenZWave ValueID
- */
- void removeValueID(OpenZWave::ValueID vid);
-
- /**
- * Lookup and return a ValueID corresponding to an index.
- *
- * @param index the index to look up
- * @param vid The pointer to the returned ValueID, if it exists
- * @return true if the index was found, false otherwise
- */
- bool indexToValueID(int index, OpenZWave::ValueID *vid);
-
- /**
- * Dump various information about the ValueIDs stored in this
- * node.
- *
- * @param all true to dump all values, false to limit dumping only
- * 'user' values.
- */
- void dumpNode(bool all=false);
-
- protected:
-
- private:
- uint32_t m_homeId;
- uint8_t m_nodeId;
-
- valueMap_t m_values;
-
- // we increment this index for every ValueID we add
- unsigned int m_vindex;
- };
-
-}
diff --git a/peripheral/libupm/src/package.json.in b/peripheral/libupm/src/package.json.in
deleted file mode 100644
index f7c68cd..0000000
--- a/peripheral/libupm/src/package.json.in
+++ /dev/null
@@ -1,23 +0,0 @@
-{
- "name" : "jsupm_@libname@",
- "description": "Sensor library based on MRAA that allows you to use various sensors on platforms such as the Intel Galileo, Intel Edison, Minnowboard MAX and others.",
- "keywords":["intel", "edison", "galileo", "minnow", "io", "mraajs", "upmjs", "gpio", "spi", "i2c", "uart", "aio", "sensor", "actuator"],
- "homepage": "http://github.com/intel-iot-devkit/upm",
- "main" : "./jsupm_@libname@.node",
- "repository": {
- "type": "git",
- "url": "https://github.com/intel-iot-devkit/upm"
- },
- "engines" : {
- "node": ">= 0.10.x"
- },
- "bugs": {
- "url" : "http://github.com/intel-iot-devkit/upm/issues"
- },
- "dependencies": {
- "mraa": ">=@MRAA_VERSION@"
- },
- "license": "MIT",
- "version" : "@upm_VERSION_STRING@",
- "authors": "See http://github.com/intel-iot-devkit/upm/graphs/contributors"
-}
diff --git a/peripheral/libupm/src/pca9685/CMakeLists.txt b/peripheral/libupm/src/pca9685/CMakeLists.txt
deleted file mode 100644
index 621148f..0000000
--- a/peripheral/libupm/src/pca9685/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "pca9685")
-set (libdescription "upm pca9685 I2C 16ch, 12b pwm, LED controller")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/pca9685/javaupm_pca9685.i b/peripheral/libupm/src/pca9685/javaupm_pca9685.i
deleted file mode 100644
index 4ff6198..0000000
--- a/peripheral/libupm/src/pca9685/javaupm_pca9685.i
+++ /dev/null
@@ -1,20 +0,0 @@
-%module javaupm_pca9685
-%include "../upm.i"
-%include "cpointer.i"
-
-%{
- #include "pca9685.h"
-%}
-
-%include "pca9685.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_pca9685");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/pca9685/jsupm_pca9685.i b/peripheral/libupm/src/pca9685/jsupm_pca9685.i
deleted file mode 100644
index 63515d0..0000000
--- a/peripheral/libupm/src/pca9685/jsupm_pca9685.i
+++ /dev/null
@@ -1,9 +0,0 @@
-%module jsupm_pca9685
-%include "../upm.i"
-%include "cpointer.i"
-
-%{
- #include "pca9685.h"
-%}
-
-%include "pca9685.h"
diff --git a/peripheral/libupm/src/pca9685/pca9685.cxx b/peripheral/libupm/src/pca9685/pca9685.cxx
deleted file mode 100644
index ce0ae38..0000000
--- a/peripheral/libupm/src/pca9685/pca9685.cxx
+++ /dev/null
@@ -1,294 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <math.h>
-#include <iostream>
-#include <string>
-#include <stdexcept>
-
-#include "pca9685.h"
-
-using namespace upm;
-using namespace std;
-
-
-PCA9685::PCA9685(int bus, uint8_t address, bool raw)
-{
- m_addr = address;
-
- // setup our i2c link
- if ( raw )
- {
- m_i2c = mraa_i2c_init_raw(bus);
- }
- else
- {
- m_i2c = mraa_i2c_init(bus);
- }
-
- if ( !m_i2c)
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_i2c_init() failed");
- return;
- }
-
- mraa_result_t rv;
-
- if ( (rv = mraa_i2c_address(m_i2c, m_addr)) != MRAA_SUCCESS)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": mraa_i2c_address() failed");
- return;
- }
-
- // enable auto-increment mode by default
- enableAutoIncrement(true);
-
- // enable restart by default.
- enableRestart(true);
-}
-
-PCA9685::~PCA9685()
-{
- setModeSleep(true);
- mraa_i2c_stop(m_i2c);
-}
-
-bool PCA9685::writeByte(uint8_t reg, uint8_t byte)
-{
- mraa_result_t rv = mraa_i2c_write_byte_data(m_i2c, byte, reg);
-
- if (rv != MRAA_SUCCESS)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": mraa_i2c_write_byte_data() failed");
- return false;
- }
-
- return true;
-}
-
-bool PCA9685::writeWord(uint8_t reg, uint16_t word)
-{
- mraa_result_t rv = mraa_i2c_write_word_data(m_i2c, word, reg);
-
- if (rv != MRAA_SUCCESS)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": mraa_i2c_write_word_data() failed");
- return false;
- }
-
- return true;
-}
-
-uint8_t PCA9685::readByte(uint8_t reg)
-{
- return mraa_i2c_read_byte_data(m_i2c, reg);
-}
-
-uint16_t PCA9685::readWord(uint8_t reg)
-{
- return mraa_i2c_read_word_data(m_i2c, reg);
-}
-
-bool PCA9685::setModeSleep(bool sleep)
-{
- uint8_t mode1 = readByte(REG_MODE1);
- uint8_t restartBit = mode1 & MODE1_RESTART;
-
- if (sleep)
- mode1 |= MODE1_SLEEP;
- else
- mode1 &= ~MODE1_SLEEP;
-
- // if we are waking up, then preserve but don't write restart bit if set
- if (!sleep && restartBit)
- mode1 &= ~MODE1_RESTART;
-
- writeByte(REG_MODE1, mode1);
-
- // Need a delay of 500us after turning sleep mode off for the oscillator
- // to stabilize
- if (!sleep)
- usleep(500);
-
- // now check to see if we want to (and can) restart when waking up
- if (restartBit && m_restartEnabled && !sleep)
- {
- mode1 |= restartBit;
- writeByte(REG_MODE1, mode1);
- }
-
- return true;
-}
-
-bool PCA9685::enableAutoIncrement(bool ai)
-{
- uint8_t mode1 = readByte(REG_MODE1);
-
- if (ai)
- mode1 |= MODE1_AI;
- else
- mode1 &= ~MODE1_AI;
-
- return writeByte(REG_MODE1, mode1);
-}
-
-bool PCA9685::ledFullOn(uint8_t led, bool val)
-{
- if (led > 15 && (led != PCA9685_ALL_LED))
- {
- throw std::out_of_range(std::string(__FUNCTION__) +
- ": led value must be between 0-15 or " +
- "PCA9685_ALL_LED (255)");
- return false;
- }
-
- // figure out the register offset (*_ON_H)
- uint8_t regoff;
-
- if (led == PCA9685_ALL_LED)
- regoff = REG_ALL_LED_ON_H;
- else
- regoff = REG_LED0_ON_L + (led * 4) + 1;
-
- uint8_t bits = readByte(regoff);
-
- if (val)
- bits |= 0x10;
- else
- bits &= ~0x10;
-
- return writeByte(regoff, bits);
-}
-
-bool PCA9685::ledFullOff(uint8_t led, bool val)
-{
- if (led > 15 && (led != PCA9685_ALL_LED))
- {
- throw std::out_of_range(std::string(__FUNCTION__) +
- ": led value must be between 0-15 or " +
- "PCA9685_ALL_LED (255)");
- return false;
- }
-
- // figure out the register offset (*_OFF_H)
- uint8_t regoff;
-
- if (led == PCA9685_ALL_LED)
- regoff = REG_ALL_LED_OFF_H;
- else
- regoff = REG_LED0_ON_L + (led * 4) + 3;
-
- uint8_t bits = readByte(regoff);
-
- if (val)
- bits |= 0x10;
- else
- bits &= ~0x10;
-
- return writeByte(regoff, bits);
-}
-
-bool PCA9685::ledOnTime(uint8_t led, uint16_t time)
-{
- if (led > 15 && (led != PCA9685_ALL_LED))
- {
- throw std::out_of_range(std::string(__FUNCTION__) +
- ": led value must be between 0-15 or " +
- "PCA9685_ALL_LED (255)");
- return false;
- }
-
- if (time > 4095)
- {
- throw std::out_of_range(std::string(__FUNCTION__) +
- ": time value must be between 0-4095");
- return false;
- }
-
- // figure out the register offset (*_ON_L)
- uint8_t regoff;
-
- if (led == PCA9685_ALL_LED)
- regoff = REG_ALL_LED_ON_L;
- else
- regoff = REG_LED0_ON_L + (led * 4);
-
- // we need to preserve the full ON bit in *_ON_H
- uint8_t onbit = (readByte(regoff + 1) & 0x10);
-
- time = (time & 0x0fff) | (onbit << 8);
-
- return writeWord(regoff, time);
-}
-
-bool PCA9685::ledOffTime(uint8_t led, uint16_t time)
-{
- if (led > 15 && (led != PCA9685_ALL_LED))
- {
- throw std::out_of_range(std::string(__FUNCTION__) +
- ": led value must be between 0-15 or " +
- "PCA9685_ALL_LED (255)");
- return false;
- }
-
- if (time > 4095)
- {
- throw std::out_of_range(std::string(__FUNCTION__) +
- ": time value must be between 0-4095");
- return false;
- }
-
- // figure out the register offset (*_OFF_L)
- uint8_t regoff;
-
- if (led == PCA9685_ALL_LED)
- regoff = REG_ALL_LED_OFF_L;
- else
- regoff = REG_LED0_ON_L + (led * 4) + 2;
-
- // we need to preserve the full OFF bit in *_OFF_H
- uint8_t offbit = (readByte(regoff + 1) & 0x10);
-
- time = (time & 0x0fff) | (offbit << 8);
-
- return writeWord(regoff, time);
-}
-
-bool PCA9685::setPrescale(uint8_t prescale)
-{
- // This will be ignored if the device isn't in SLEEP mode
- return writeByte(REG_PRESCALE, prescale);
-}
-
-bool PCA9685::setPrescaleFromHz(float hz, float oscFreq)
-{
- float prescale = round( oscFreq / (4096.0 * hz) ) - 1;
-
- return setPrescale(uint8_t(prescale));
-}
diff --git a/peripheral/libupm/src/pca9685/pca9685.h b/peripheral/libupm/src/pca9685/pca9685.h
deleted file mode 100644
index d7b23cc..0000000
--- a/peripheral/libupm/src/pca9685/pca9685.h
+++ /dev/null
@@ -1,320 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include <mraa/i2c.h>
-#include <mraa/gpio.h>
-
-#define PCA9685_I2C_BUS 0
-#define PCA9685_DEFAULT_I2C_ADDR 0x60
-// internal oscillator frequency
-#define PCA9685_INTERNAL_OSC 25000000.0
-
-// This is a 'special' LED number, used to refer to the ALL_LED registers
-// that affect all LED outputs at once.
-#define PCA9685_ALL_LED 0xff
-
-namespace upm {
-
- /**
- * @brief PCA9685 PWM Controller library
- * @defgroup pca9685 libupm-pca9685
- * @ingroup adafruit i2c led motor
- */
- /**
- * @library pca9685
- * @sensor pca9685
- * @comname PCA9685 PWM Controller
- * @type led motor
- * @man adafruit
- * @web http://www.adafruit.com/products/815
- * @con i2c
- *
- * @brief API for the PCA9685 16-channel, 12-bit PWM LED Controller
- *
- * This controller is also used on the Adafruit* Motor Shield v2.3
- * board to control up to 4 DC motors, 2 stepper motors, and 2 servo
- * motors.
- *
- * This module was tested with the Adafruit Motor Shield v2.3
- *
- * @image html pca9685.jpg
- * @snippet pca9685.cxx Interesting
- */
- class PCA9685 {
- public:
-
- /**
- * PCA9685 registers
- */
- typedef enum { REG_MODE1 = 0x00,
- REG_MODE2 = 0x01,
- REG_I2C_SA1 = 0x02, // I2C subaddress 1
- REG_I2C_SA2 = 0x03,
- REG_I2C_SA3 = 0x04,
- REG_ALLCALL = 0x05, // I2C all call address
-
- // LED output PWM control
- REG_LED0_ON_L = 0x06, // LED0 ON low byte
- REG_LED0_ON_H = 0x07, // LED0 ON high byte
- REG_LED0_OFF_L = 0x08, // LED0 OFF low byte
- REG_LED0_OFF_H = 0x09, // LED0 OFF high byte
- REG_LED1_ON_L = 0x0a,
- REG_LED1_ON_H = 0x0b,
- REG_LED1_OFF_L = 0x0c,
- REG_LED1_OFF_H = 0x0d,
- REG_LED2_ON_L = 0x0e,
- REG_LED2_ON_H = 0x0f,
- REG_LED2_OFF_L = 0x10,
- REG_LED2_OFF_H = 0x11,
- REG_LED3_ON_L = 0x12,
- REG_LED3_ON_H = 0x13,
- REG_LED3_OFF_L = 0x14,
- REG_LED3_OFF_H = 0x15,
- REG_LED4_ON_L = 0x16,
- REG_LED4_ON_H = 0x17,
- REG_LED4_OFF_L = 0x18,
- REG_LED4_OFF_H = 0x19,
- REG_LED5_ON_L = 0x1a,
- REG_LED5_ON_H = 0x1b,
- REG_LED5_OFF_L = 0x1c,
- REG_LED5_OFF_H = 0x1d,
- REG_LED6_ON_L = 0x1e,
- REG_LED6_ON_H = 0x1f,
- REG_LED6_OFF_L = 0x20,
- REG_LED6_OFF_H = 0x21,
- REG_LED7_ON_L = 0x22,
- REG_LED7_ON_H = 0x23,
- REG_LED7_OFF_L = 0x24,
- REG_LED7_OFF_H = 0x25,
- REG_LED8_ON_L = 0x26,
- REG_LED8_ON_H = 0x27,
- REG_LED8_OFF_L = 0x28,
- REG_LED8_OFF_H = 0x29,
- REG_LED9_ON_L = 0x2a,
- REG_LED9_ON_H = 0x2b,
- REG_LED9_OFF_L = 0x2c,
- REG_LED9_OFF_H = 0x2d,
- REG_LED10_ON_L = 0x2e,
- REG_LED10_ON_H = 0x2f,
- REG_LED10_OFF_L = 0x30,
- REG_LED10_OFF_H = 0x31,
- REG_LED11_ON_L = 0x32,
- REG_LED11_ON_H = 0x33,
- REG_LED11_OFF_L = 0x34,
- REG_LED11_OFF_H = 0x35,
- REG_LED12_ON_L = 0x36,
- REG_LED12_ON_H = 0x37,
- REG_LED12_OFF_L = 0x38,
- REG_LED12_OFF_H = 0x39,
- REG_LED13_ON_L = 0x3a,
- REG_LED13_ON_H = 0x3b,
- REG_LED13_OFF_L = 0x3c,
- REG_LED13_OFF_H = 0x3d,
- REG_LED14_ON_L = 0x3e,
- REG_LED14_ON_H = 0x3f,
- REG_LED14_OFF_L = 0x40,
- REG_LED14_OFF_H = 0x41,
- REG_LED15_ON_L = 0x42,
- REG_LED15_ON_H = 0x43,
- REG_LED15_OFF_L = 0x44,
- REG_LED15_OFF_H = 0x45,
- // 0x46-0xf9 reserved
-
- REG_ALL_LED_ON_L = 0xfa, // write all LED ON L
- REG_ALL_LED_ON_H = 0xfb, // write all LED ON H
- REG_ALL_LED_OFF_L = 0xfc, // write all LED OFF L
- REG_ALL_LED_OFF_H = 0xfd, // write all LED OFF H
- REG_PRESCALE = 0xfe,
- REG_TESTMODE = 0xff // don't use
- } PCA9685_REG_T;
-
- /**
- * MODE1 bits
- */
- typedef enum { MODE1_ALL_CALL = 0x01, // all call status
- MODE1_SUB3 = 0x02, // subcall 3 status
- MODE1_SUB2 = 0x04, // subcall 2 status
- MODE1_SUB1 = 0x08, // subcall 1 status
- MODE1_SLEEP = 0x10, // sleep/normal mode
- MODE1_AI = 0x20, // auto-increment enable
- MODE1_EXTCLK = 0x40, // external clock enable
- MODE1_RESTART = 0x80 // restart status
- } PCA9685_MODE1_T;
-
- /**
- * MODE2 bits
- */
- typedef enum { MODE2_OUTNE0 = 0x01, // output driver enable bit 0
- MODE2_OUTNE = 0x02, // output driver enable bit 1
- MODE2_OUTDRV = 0x04, // output open-drain/totem pole
- MODE2_OCH = 0x08, // output change on STOP or ACK
- MODE2_INVRT = 0x10, // output logic state invert
- MODE2_RESERVE0 = 0x20, // reserved
- MODE2_RESERVE1 = 0x40, // reserved
- MODE2_RESERVE2 = 0x80 // reserved
- } PCA9685_MODE2_T;
-
- /**
- * PCA9685 constructor
- *
- * @param bus I2C bus to use
- * @param address Address for this device
- */
- PCA9685(int bus, uint8_t address = PCA9685_DEFAULT_I2C_ADDR, bool raw = false);
-
- /**
- * PCA9685 destructor
- */
- ~PCA9685();
-
- /**
- * Writes a byte value into a register
- *
- * @param reg Register location to write into
- * @param byte Byte to write
- * @return True if successful
- */
- bool writeByte(uint8_t reg, uint8_t byte);
-
- /**
- * Writes a word value into a register. Note: the device must have the
- * auto-increment bit set in the MODE1 register to work.
- *
- * @param reg Register location to write into
- * @param word Word to write
- * @return True if successful
- */
- bool writeWord(uint8_t reg, uint16_t word);
-
- /**
- * Reads a byte value from a register
- *
- * @param reg Register location to read from
- * @return Value in a specified register
- */
- uint8_t readByte(uint8_t reg);
-
- /**
- * Reads a word value from a register. Note: the device must have the
- * auto-increment bit set in the MODE1 register to work.
- *
- * @param reg Register location to read from
- * @return Value in a specified register
- */
- uint16_t readWord(uint8_t reg);
-
- /**
- * Puts the device in or out of the sleep mode. The device is always
- * in the sleep mode upon power-up.
- *
- * @param sleep True to put the device in the sleep mode, false to put out
- * @return True if successful
- */
- bool setModeSleep(bool sleep);
-
- /**
- * Sets or clears the FULL ON bit for a given LED
- *
- * @param led LED number; valid values are 0-15, PCA9685_ALL_LED
- * @param val True to set the bit, false to clear it
- * @return True if successful
- */
- bool ledFullOn(uint8_t led, bool val);
-
- /**
- * Sets or clears the FULL OFF bit for a given LED. If the FULL ON
- * bit is also set, FULL OFF has precedence.
- *
- * @param led LED number; valid values are 0-15, PCA9685_ALL_LED
- * @param val True to set the bit, false to clear it
- * @return True if successful
- */
- bool ledFullOff(uint8_t led, bool val);
-
- /**
- * Sets the 'LED on' time (0-4,095). See the PCA9685 datasheet for details.
- *
- * @param led LED number; valid values are 0-15, PCA9685_ALL_LED
- * @param time 12-bit value at which point the LED turns on
- * @return True if successful
- */
- bool ledOnTime(uint8_t led, uint16_t time);
-
- /**
- * Sets the 'LED off' time (0-4,095). See the PCA9685 datasheet for details.
- *
- * @param led LED number; valid values are 0-15, PCA9685_ALL_LED
- * @param time 12-bit value at which point the LED turns off
- * @return True if successful
- */
- bool ledOffTime(uint8_t led, uint16_t time);
-
- /**
- * Sets the prescale value. See the PCA9685 datasheet for
- * details. The prescale can only be set when the device is in
- * the sleep mode.
- *
- * @param prescale Prescale value
- * @return True if successful
- */
- bool setPrescale(uint8_t prescale);
-
- /**
- * Sets the prescale value based on a desired frequency in Hz. The
- * prescale can only be set when the device is in the sleep mode.
- *
- * @param hz Desired frequency in Hz
- * @param oscFreq Oscillator frequency; default is 25 MHz
- * @return True if successful
- */
- bool setPrescaleFromHz(float hz,
- float oscFreq=PCA9685_INTERNAL_OSC);
-
- /**
- * Enables or disables the restart capability of the controller
- *
- * @param enabled True to enable, false to disable
- * It is enabled by default.
- */
- void enableRestart(bool enabled) { m_restartEnabled = enabled; };
-
- private:
- /**
- * Enables the I2C register auto-increment. This needs to be enabled
- * for write/readWord() to work. The contructor enables this by
- * default.
- *
- * @param ai True to enable, false otherwise
- */
- bool enableAutoIncrement(bool ai);
-
- bool m_restartEnabled;
- mraa_i2c_context m_i2c;
- uint8_t m_addr;
- };
-}
-
-
diff --git a/peripheral/libupm/src/pca9685/pyupm_pca9685.i b/peripheral/libupm/src/pca9685/pyupm_pca9685.i
deleted file mode 100644
index dd0b949..0000000
--- a/peripheral/libupm/src/pca9685/pyupm_pca9685.i
+++ /dev/null
@@ -1,15 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_pca9685
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-#ifdef DOXYGEN
-%include "pca9685_doc.i"
-#endif
-
-%include "pca9685.h"
-%{
- #include "pca9685.h"
-%}
diff --git a/peripheral/libupm/src/pkgconfig.in b/peripheral/libupm/src/pkgconfig.in
deleted file mode 100644
index 6020e98..0000000
--- a/peripheral/libupm/src/pkgconfig.in
+++ /dev/null
@@ -1,14 +0,0 @@
-prefix=@CMAKE_INSTALL_PREFIX@
-exec_prefix=${prefix}
-libdir=${exec_prefix}/lib@LIB_SUFFIX@
-includedir=${prefix}/include
-
-Name: upm-@libname@
-Description: upm lib @libname@
-Version: @upm_VERSION_STRING@
-
-Libs: -L${libdir} -lupm-@libname@
-Cflags: -I${includedir}/upm
-
-Requires: @reqlibname@
-Requires.private: @reqplibname@
diff --git a/peripheral/libupm/src/pn532/CMakeLists.txt b/peripheral/libupm/src/pn532/CMakeLists.txt
deleted file mode 100644
index a03aeb4..0000000
--- a/peripheral/libupm/src/pn532/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "pn532")
-set (libdescription "upm pn532 NFC/RFID reader/writer")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/pn532/javaupm_pn532.i b/peripheral/libupm/src/pn532/javaupm_pn532.i
deleted file mode 100644
index ad97bf3..0000000
--- a/peripheral/libupm/src/pn532/javaupm_pn532.i
+++ /dev/null
@@ -1,27 +0,0 @@
-%module javaupm_pn532
-%include "../upm.i"
-%include "typemaps.i"
-%include "arrays_java.i"
-
-%apply signed char[] {uint8_t *};
-%apply unsigned char *INOUT {uint8_t *responseLength};
-%apply unsigned char *OUTPUT {uint8_t *uidLength};
-
-%ignore i2cContext;
-
-%{
- #include "pn532.h"
-%}
-
-%include "pn532.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_pn532");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/pn532/jsupm_pn532.i b/peripheral/libupm/src/pn532/jsupm_pn532.i
deleted file mode 100644
index 9fab172..0000000
--- a/peripheral/libupm/src/pn532/jsupm_pn532.i
+++ /dev/null
@@ -1,9 +0,0 @@
-%module jsupm_pn532
-%include "../upm.i"
-%include "../carrays_uint8_t.i"
-
-%{
- #include "pn532.h"
-%}
-
-%include "pn532.h"
diff --git a/peripheral/libupm/src/pn532/license.txt b/peripheral/libupm/src/pn532/license.txt
deleted file mode 100644
index f6a0f22..0000000
--- a/peripheral/libupm/src/pn532/license.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-Software License Agreement (BSD License)
-
-Copyright (c) 2012, Adafruit Industries
-All rights reserved.
-
-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 copyright holders 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 COPYRIGHT HOLDERS ''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 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/libupm/src/pn532/pn532.cxx b/peripheral/libupm/src/pn532/pn532.cxx
deleted file mode 100644
index 6764d00..0000000
--- a/peripheral/libupm/src/pn532/pn532.cxx
+++ /dev/null
@@ -1,1595 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * This code is heavily based on the Adafruit-PN532 library at
- * https://github.com/adafruit/Adafruit-PN532, which is licensed under
- * the BSD license. See upm/src/pn532/license.txt
- *
- * 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 <math.h>
-#include <iostream>
-#include <string>
-#include <stdexcept>
-
-#ifdef JAVACALLBACK
-#undef JAVACALLBACK
-#endif
-
-#include "pn532.h"
-
-using namespace upm;
-using namespace std;
-
-
-#define PN532_PACKBUFFSIZ 64
-static uint8_t pn532_packetbuffer[PN532_PACKBUFFSIZ];
-
-static uint8_t pn532ack[] = {0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00};
-static uint32_t pn532_firmwarerev = 0x00320106;
-
-PN532::PN532(int irq, int reset, int bus, uint8_t address):
- m_gpioIRQ(irq), m_gpioReset(reset), m_i2c(bus)
-{
- m_addr = address;
- m_uidLen = 0;
- m_inListedTag = 0;
- m_SAK = 0;
- m_ATQA = 0;
- m_isrInstalled = false;
- m_irqRcvd = false;
-
- memset(m_uid, 0, 7);
- memset(m_key, 0, 6);
-
- // turn off debugging by default
- pn532Debug(false);
- mifareDebug(false);
-
- mraa::Result rv;
- if ( (rv = m_i2c.address(m_addr)) != mraa::SUCCESS)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": I2c.address() failed");
- return;
- }
-
- m_gpioIRQ.dir(mraa::DIR_IN);
- m_gpioReset.dir(mraa::DIR_OUT);
-}
-
-PN532::~PN532()
-{
- if (m_isrInstalled)
- m_gpioIRQ.isrExit();
-}
-
-bool PN532::init()
-{
- m_gpioReset.write(1);
- m_gpioReset.write(0);
- usleep(400000);
-
- // install an interrupt handler
- m_gpioIRQ.isr(mraa::EDGE_FALLING, dataReadyISR, this);
- m_isrInstalled = true;
-
- m_gpioReset.write(1);
-
- return true;
-}
-
-/**************************************************************************/
-/*!
- @brief Prints a hexadecimal value in plain characters
-
- @param data Pointer to the byte data
- @param numBytes Data length in bytes
-*/
-/**************************************************************************/
-static void PrintHex(const uint8_t * data, const uint32_t numBytes)
-{
- uint32_t szPos;
- for (szPos=0; szPos < numBytes; szPos++)
- {
- fprintf(stderr, "0x%02x ", data[szPos] & 0xff);
- }
- fprintf(stderr, "\n");
-}
-
-/**************************************************************************/
-/*!
- @brief Prints a hexadecimal value in plain characters, along with
- the char equivalents in the following format
-
- 00 00 00 00 00 00 ......
-
- @param data Pointer to the byte data
- @param numBytes Data length in bytes
-*/
-/**************************************************************************/
-static void PrintHexChar(const uint8_t * data, const uint32_t numBytes)
-{
- uint32_t szPos;
- for (szPos=0; szPos < numBytes; szPos++)
- {
- fprintf(stderr, "0x%02x ", data[szPos] & 0xff);
- }
- fprintf(stderr, " ");
- for (szPos=0; szPos < numBytes; szPos++)
- {
- if (data[szPos] <= 0x1F)
- fprintf(stderr, ".");
- else
- fprintf(stderr, "%c ", (char)data[szPos]);
- }
- fprintf(stderr, "\n");
-}
-
-
-/**************************************************************************/
-/*!
- @brief Checks the firmware version of the PN5xx chip
-
- @returns The chip's firmware version and ID
-*/
-/**************************************************************************/
-uint32_t PN532::getFirmwareVersion()
-{
- uint32_t response = 0;
-
- pn532_packetbuffer[0] = CMD_GETFIRMWAREVERSION;
-
- if (! sendCommandCheckAck(pn532_packetbuffer, 1))
- return 0;
-
- // read data packet
- readData(pn532_packetbuffer, 12);
-
- int offset = 7; // Skip the ready byte when using I2C
-
- response <<= 8;
- response |= pn532_packetbuffer[offset++];
- response <<= 8;
- response |= pn532_packetbuffer[offset++];
- response <<= 8;
- response |= pn532_packetbuffer[offset++];
-
- if (response != pn532_firmwarerev)
- fprintf(stderr,
- "Warning: firmware revision 0x%08x does not match expected rev 0x%08x\n",
- response, pn532_firmwarerev);
-
- return response;
-}
-
-
-/**************************************************************************/
-/*!
- @brief Sends a command and waits a specified period for the ACK
-
- @param cmd Pointer to the command buffer
- @param cmdlen The size of the command in bytes
- @param timeout timeout before giving up
-
- @returns 1 if everything is OK, 0 if timeout occured before an
- ACK was recieved
-*/
-/**************************************************************************/
-// default timeout of one second
-bool PN532::sendCommandCheckAck(uint8_t *cmd, uint8_t cmdlen,
- uint16_t timeout)
-{
- uint16_t timer = 0;
-
- // clear any outstanding irq's
- isReady();
-
- // write the command
- writeCommand(cmd, cmdlen);
-
- // Wait for chip to say its ready!
- if (!waitForReady(timeout)) {
- cerr << __FUNCTION__ << ": Not ready, timeout" << endl;
- return false;
- }
-
- if (m_pn532Debug)
- cerr << __FUNCTION__ << ": IRQ received" << endl;
-
- // read acknowledgement
- if (!readAck()) {
- if (m_pn532Debug)
- cerr << __FUNCTION__ << ": No ACK frame received!" << endl;
-
- return false;
- }
-
- return true; // ack'd command
-}
-
-/**************************************************************************/
-/*!
- @brief Configures the SAM (Secure Access Module)
-*/
-/**************************************************************************/
-bool PN532::SAMConfig(void)
-{
- pn532_packetbuffer[0] = CMD_SAMCONFIGURATION;
- pn532_packetbuffer[1] = 0x01; // normal mode;
- pn532_packetbuffer[2] = 0x14; // timeout 50ms * 20 = 1 second
- pn532_packetbuffer[3] = 0x01; // use IRQ pin!
-
- if (! sendCommandCheckAck(pn532_packetbuffer, 4))
- return false;
-
- // read data packet
- readData(pn532_packetbuffer, 8);
-
- int offset = 6;
- return (pn532_packetbuffer[offset] == 0x15);
-}
-
-/**************************************************************************/
-/*!
- Sets the MxRtyPassiveActivation byte of the RFConfiguration register
-
- @param maxRetries 0xFF to wait forever, 0x00..0xFE to timeout
- after mxRetries
-
- @returns 1 if everything executed properly, 0 for an error
-*/
-/**************************************************************************/
-bool PN532::setPassiveActivationRetries(uint8_t maxRetries)
-{
- pn532_packetbuffer[0] = CMD_RFCONFIGURATION;
- pn532_packetbuffer[1] = 5; // Config item 5 (MaxRetries)
- pn532_packetbuffer[2] = 0xFF; // MxRtyATR (default = 0xFF)
- pn532_packetbuffer[3] = 0x01; // MxRtyPSL (default = 0x01)
- pn532_packetbuffer[4] = maxRetries;
-
- if (m_mifareDebug)
- cerr << __FUNCTION__ << ": Setting MxRtyPassiveActivation to "
- << (int)maxRetries << endl;
-
- if (! sendCommandCheckAck(pn532_packetbuffer, 5))
- return false; // no ACK
-
- return true;
-}
-
-/***** ISO14443A Commands ******/
-
-/**************************************************************************/
-/*!
- Waits for an ISO14443A target to enter the field
-
- @param cardBaudRate Baud rate of the card
- @param uid Pointer to the array that will be populated
- with the card's UID (up to 7 bytes)
- @param uidLength Pointer to the variable that will hold the
- length of the card's UID.
-
- @returns 1 if everything executed properly, 0 for an error
-*/
-/**************************************************************************/
-bool PN532::readPassiveTargetID(BAUD_T cardbaudrate, uint8_t * uid,
- uint8_t * uidLength, uint16_t timeout)
-{
- pn532_packetbuffer[0] = CMD_INLISTPASSIVETARGET;
- pn532_packetbuffer[1] = 1; // max 1 cards at once (we can set this
- // to 2 later)
- pn532_packetbuffer[2] = cardbaudrate;
-
- if (!sendCommandCheckAck(pn532_packetbuffer, 3, timeout))
- {
- if (m_pn532Debug)
- cerr << __FUNCTION__ << ": No card(s) read" << endl;
-
- return false; // no cards read
- }
-
- // wait for a card to enter the field (only possible with I2C)
- if (m_pn532Debug)
- cerr << __FUNCTION__ << ": Waiting for IRQ (indicates card presence)" << endl;
-
- if (!waitForReady(timeout)) {
- if (m_pn532Debug)
- cerr << __FUNCTION__ << ": IRQ Timeout" << endl;
-
- return false;
- }
-
- // read data packet
- readData(pn532_packetbuffer, 20);
-
- // check some basic stuff
-
- /* ISO14443A card response should be in the following format:
-
- byte Description
- ------------- ------------------------------------------
- b0..6 Frame header and preamble
- b7 Tags Found
- b8 Tag Number (only one used in this example)
- b9..10 SENS_RES
- b11 SEL_RES
- b12 NFCID Length
- b13..NFCIDLen NFCID */
-
- // SENS_RES SEL_RES Manufacturer/Card Type NFCID Len
- // -------- ------- ----------------------- ---------
- // 00 04 08 NXP Mifare Classic 1K 4 bytes
- // 00 02 18 NXP Mifare Classic 4K 4 bytes
-
- if (m_mifareDebug)
- cerr << __FUNCTION__ << ": Found " << (int)pn532_packetbuffer[7] << " tags"
- << endl;
-
- // only one card can be handled currently
- if (pn532_packetbuffer[7] != 1)
- return false;
-
- uint16_t sens_res = pn532_packetbuffer[9];
- sens_res <<= 8;
- sens_res |= pn532_packetbuffer[10];
-
- // store these for later retrieval, they can be used to more accurately
- // ID the type of card.
-
- m_ATQA = sens_res;
- m_SAK = pn532_packetbuffer[11]; // SEL_RES
-
- if (m_mifareDebug)
- {
- fprintf(stderr, "ATQA: 0x%04x\n", m_ATQA);
- fprintf(stderr, "SAK: 0x%02x\n", m_SAK);
- }
-
- /* Card appears to be Mifare Classic */
- // JET: How so?
-
- *uidLength = pn532_packetbuffer[12];
- if (m_mifareDebug)
- fprintf(stderr, "UID: ");
-
- for (uint8_t i=0; i < pn532_packetbuffer[12]; i++)
- {
- uid[i] = pn532_packetbuffer[13+i];
- if (m_mifareDebug)
- fprintf(stderr, "0x%02x ", uid[i]);
- }
- if (m_mifareDebug)
- fprintf(stderr, "\n");
-
- return true;
-}
-
-/**************************************************************************/
-/*!
- @brief Exchanges an APDU with the currently inlisted peer
-
- @param send Pointer to data to send
- @param sendLength Length of the data to send
- @param response Pointer to response data
- @param responseLength Pointer to the response data length
-*/
-/**************************************************************************/
-bool PN532::inDataExchange(uint8_t * send, uint8_t sendLength,
- uint8_t * response, uint8_t * responseLength)
-{
- if (sendLength > PN532_PACKBUFFSIZ-2) {
- if (m_pn532Debug)
- cerr << __FUNCTION__ << ": APDU length too long for packet buffer"
- << endl;
-
- return false;
- }
- uint8_t i;
-
- pn532_packetbuffer[0] = CMD_INDATAEXCHANGE; // 0x40
- pn532_packetbuffer[1] = m_inListedTag;
- for (i=0; i<sendLength; ++i) {
- pn532_packetbuffer[i+2] = send[i];
- }
-
- if (!sendCommandCheckAck(pn532_packetbuffer,sendLength+2,1000)) {
- if (m_pn532Debug)
- cerr << __FUNCTION__ << ": Could not send ADPU" << endl;
-
- return false;
- }
-
- if (!waitForReady(1000)) {
- if (m_pn532Debug)
- cerr << __FUNCTION__ << ": Response never received for ADPU..." << endl;
-
- return false;
- }
-
- readData(pn532_packetbuffer, sizeof(pn532_packetbuffer));
-
- if (pn532_packetbuffer[0] == 0 && pn532_packetbuffer[1] == 0 &&
- pn532_packetbuffer[2] == 0xff)
- {
-
- uint8_t length = pn532_packetbuffer[3];
- if (pn532_packetbuffer[4]!=(uint8_t)(~length+1))
- {
- if (m_pn532Debug)
- fprintf(stderr, "Length check invalid: 0x%02x != 0x%02x\n", length,
- (~length)+1);
-
- return false;
- }
- if (pn532_packetbuffer[5]==PN532_PN532TOHOST &&
- pn532_packetbuffer[6]==RSP_INDATAEXCHANGE)
- {
- if ((pn532_packetbuffer[7] & 0x3f)!=0)
- {
- if (m_pn532Debug)
- cerr << __FUNCTION__ << ": Status code indicates an error"
- << endl;
-
- return false;
- }
-
- length -= 3;
-
- if (length > *responseLength) {
- length = *responseLength; // silent truncation...
- }
-
- for (i=0; i<length; ++i) {
- response[i] = pn532_packetbuffer[8+i];
- }
- *responseLength = length;
-
- return true;
- }
- else {
- fprintf(stderr, "Don't know how to handle this command: 0x%02x\n",
- pn532_packetbuffer[6]);
- return false;
- }
- }
- else {
- cerr << __FUNCTION__ << ": Preamble missing" << endl;
- return false;
- }
-}
-
-/**************************************************************************/
-/*!
- @brief 'InLists' a passive target. PN532 acting as reader/initiator,
- peer acting as card/responder.
-*/
-/**************************************************************************/
-bool PN532::inListPassiveTarget()
-{
- m_inListedTag = 0;
-
- pn532_packetbuffer[0] = CMD_INLISTPASSIVETARGET;
- pn532_packetbuffer[1] = 1;
- pn532_packetbuffer[2] = 0;
-
- if (m_pn532Debug)
- cerr << __FUNCTION__ << ": About to inList passive target" << endl;
-
- if (!sendCommandCheckAck(pn532_packetbuffer,3,1000)) {
- if (m_pn532Debug)
- cerr << __FUNCTION__ << ": Could not send inlist message" << endl;
-
- return false;
- }
-
- if (!waitForReady(30000)) {
- return false;
- }
-
- readData(pn532_packetbuffer, sizeof(pn532_packetbuffer));
-
- if (pn532_packetbuffer[0] == 0 && pn532_packetbuffer[1] == 0 &&
- pn532_packetbuffer[2] == 0xff) {
-
- uint8_t length = pn532_packetbuffer[3];
- if (pn532_packetbuffer[4]!=(uint8_t)(~length+1)) {
- if (m_pn532Debug)
- fprintf(stderr, "Length check invalid: 0x%02x != 0x%02x\n", length,
- (~length)+1);
-
- return false;
- }
- if (pn532_packetbuffer[5]==PN532_PN532TOHOST &&
- pn532_packetbuffer[6]==RSP_INLISTPASSIVETARGET) {
- if (pn532_packetbuffer[7] != 1) {
- cerr << __FUNCTION__ << ": Unhandled number of tags inlisted: "
- << (int)pn532_packetbuffer[7] << endl;
- return false;
- }
-
- m_inListedTag = pn532_packetbuffer[8];
- if (m_pn532Debug)
- cerr << __FUNCTION__ << ": Tag number: " << (int)m_inListedTag << endl;
-
- return true;
- } else {
- if (m_pn532Debug)
- cerr << __FUNCTION__ << ": Unexpected response to inlist passive host"
- << endl;
-
- return false;
- }
- }
- else {
- if (m_pn532Debug)
- cerr << __FUNCTION__ << ": Preamble missing" << endl;
-
- return false;
- }
-
- return true;
-}
-
-
-/***** Mifare Classic Functions ******/
-/* MIFARE CLASSIC DESCRIPTION
- ==========================
-
- Taken from: https://www.kismetwireless.net/code-old/svn/hardware/kisbee-02/firmware/drivers/rf/pn532/helpers/pn532_mifare_classic.c
-
- MIFARE Classic cards come in 1K and 4K varieties. While several
- varieties of chips exist, the two main chipsets used are described
- in the following publicly accessible documents:
-
- MF1S503x Mifare Classic 1K data sheet:
- http://www.nxp.com/documents/data_sheet/MF1S503x.pdf
-
- MF1S70yyX MIFARE Classic 4K data sheet:
- http://www.nxp.com/documents/data_sheet/MF1S70YYX.pdf
-
- Mifare Classic cards typically have a a 4-byte NUID, though you may
- find cards with 7 byte IDs as well
-
- EEPROM MEMORY
- =============
- Mifare Classic cards have either 1K or 4K of EEPROM memory. Each
- memory block can be configured with different access conditions,
- with two seperate authentication keys present in each block.
-
- The two main Mifare Classic card types are organised as follows:
-
- 1K Cards: 16 sectors of 4 blocks (0..15)
- 4K Cards: 32 sectors of 4 blocks (0..31) and
- 8 sectors of 16 blocks (32..39)
-
- 4 block sectors
- ===============
- Sector Block Bytes Description
- ------ ----- ----- -----------
- 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
-
- 1 3 [-------KEY A-------] [Access Bits] [-------KEY A-------] Sector Trailer 1
- 2 [ Data ] Data
- 1 [ Data ] Data
- 0 [ Data ] Data
-
- 0 3 [-------KEY A-------] [Access Bits] [-------KEY A-------] Sector Trailer 1
- 2 [ Data ] Data
- 1 [ Data ] Data
- 0 [ Manufacturer Data ] Manufacturer Block
-
- Sector Trailer (Block 3)
- ------------------------
- The sector trailer block contains the two secret keys (Key A and Key B), as well
- as the access conditions for the four blocks. It has the following structure:
-
- Sector Trailer Bytes
- --------------------------------------------------------------
- 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
- [ Key A ] [Access Bits] [ Key B ]
-
- For more information in using Keys to access the clock contents, see
- Accessing Data Blocks further below.
-
- Data Blocks (Blocks 0..2)
- -------------------------
- Data blocks are 16 bytes wide and, depending on the permissions set in the
- access bits, can be read from and written to. You are free to use the 16 data
- bytes in any way you wish. You can easily store text input, store four 32-bit
- integer values, a 16 character uri, etc.
-
- Data Blocks as "Value Blocks"
- -----------------------------
- An alternative to storing random data in the 16 byte-wide blocks is to
- configure them as "Value Blocks". Value blocks allow performing electronic
- purse functions (valid commands are: read, write, increment, decrement,
- restore, transfer).
-
- Each Value block contains a single signed 32-bit value, and this value is
- stored 3 times for data integrity and security reasons. It is stored twice
- non-inverted, and once inverted. The last 4 bytes are used for a 1-byte
- address, which is stored 4 times (twice non-inverted, and twice inverted).
-
- Data blocks configured as "Value Blocks" have the following structure:
-
- Value Block Bytes
- --------------------------------------------------------------
- 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
- [ Value ] [ ~Value ] [ Value ] [A ~A A ~A]
-
- Manufacturer Block (Sector 0, Block 0)
- --------------------------------------
- Sector 0 is special since it contains the Manufacturer Block. This block
- contains the manufacturer data, and is read-only. It should be avoided
- unless you know what you are doing.
-
- 16 block sectors
- ================
- 16 block sectors are identical to 4 block sectors, but with more data blocks. The same
- structure described in the 4 block sectors above applies.
-
- Sector Block Bytes Description
- ------ ----- ----- ----------
- 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
-
- 32 15 [-------KEY A-------] [Access Bits] [-------KEY B-------] Sector Trailer 32
- 14 [ Data ] Data
- 13 [ Data ] Data
- ...
- 2 [ Data ] Data
- 1 [ Data ] Data
- 0 [ Data ] Data
-
- ACCESSING DATA BLOCKS
- =====================
-
- Before you can access the cards, you must following two steps:
-
- 1.) You must retrieve the 7 byte UID or the 4-byte NUID of the card.
- This can be done using pn532_mifareclassic_WaitForPassiveTarget()
- below, which will return the appropriate ID.
-
- 2.) You must authenticate the sector you wish to access according to the
- access rules defined in the Sector Trailer block for that sector.
- This can be done using pn532_mifareclassic_AuthenticateBlock(),
- passing in the appropriate key value.
-
- Most new cards have a default Key A of 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF,
- but some common values worth trying are:
-
- 0XFF 0XFF 0XFF 0XFF 0XFF 0XFF
- 0XD3 0XF7 0XD3 0XF7 0XD3 0XF7
- 0XA0 0XA1 0XA2 0XA3 0XA4 0XA5
- 0XB0 0XB1 0XB2 0XB3 0XB4 0XB5
- 0X4D 0X3A 0X99 0XC3 0X51 0XDD
- 0X1A 0X98 0X2C 0X7E 0X45 0X9A
- 0XAA 0XBB 0XCC 0XDD 0XEE 0XFF
- 0X00 0X00 0X00 0X00 0X00 0X00
- 0XAB 0XCD 0XEF 0X12 0X34 0X56
-
- 3.) Once authenication has succeeded, and depending on the sector
- permissions, you can then read/write/increment/decrement the
- contents of the specific block, using one of the helper functions
- included in this module.
-
-*/
-/**************************************************************************/
-/*!
- Indicates whether the specified block number is the first block
- in the sector (block 0 relative to the current sector)
-*/
-/**************************************************************************/
-bool PN532::mifareclassic_IsFirstBlock (uint32_t uiBlock)
-{
- // Test if we are in the small or big sectors
- if (uiBlock < 128)
- return ((uiBlock) % 4 == 0);
- else
- return ((uiBlock) % 16 == 0);
-}
-
-/**************************************************************************/
-/*!
- Indicates whether the specified block number is the sector trailer
-*/
-/**************************************************************************/
-bool PN532::mifareclassic_IsTrailerBlock (uint32_t uiBlock)
-{
- // Test if we are in the small or big sectors
- if (uiBlock < 128)
- return ((uiBlock + 1) % 4 == 0);
- else
- return ((uiBlock + 1) % 16 == 0);
-}
-
-/**************************************************************************/
-/*!
- Tries to authenticate a block of memory on a MIFARE card using the
- INDATAEXCHANGE command. See section 7.3.8 of the PN532 User Manual
- for more information on sending MIFARE and other commands.
-
- @param uid Pointer to a byte array containing the card UID
- @param uidLen The length (in bytes) of the card's UID (Should
- be 4 for MIFARE Classic)
- @param blockNumber The block number to authenticate. (0..63 for
- 1KB cards, and 0..255 for 4KB cards).
- @param keyNumber Which key type to use during authentication
- (0 = MIFARE_CMD_AUTH_A, 1 = MIFARE_CMD_AUTH_B)
- @param keyData Pointer to a byte array containing the 6 byte
- key value
-
- @returns 1 if everything executed properly, 0 for an error
-*/
-/**************************************************************************/
-bool PN532::mifareclassic_AuthenticateBlock (uint8_t * uid, uint8_t uidLen,
- uint32_t blockNumber,
- uint8_t keyNumber,
- uint8_t * keyData)
-{
- uint8_t len;
- uint8_t i;
-
- // Hang on to the key and uid data
- memcpy (m_key, keyData, 6);
- memcpy (m_uid, uid, uidLen);
- m_uidLen = uidLen;
-
- if (m_mifareDebug)
- {
- fprintf(stderr, "Trying to authenticate card ");
- PrintHex(m_uid, m_uidLen);
- fprintf(stderr, "Using authentication KEY %c: ",
- keyNumber ? 'B' : 'A');
- PrintHex(m_key, 6);
- }
-
- // Prepare the authentication command //
- pn532_packetbuffer[0] = CMD_INDATAEXCHANGE; /* Data Exchange Header */
- pn532_packetbuffer[1] = 1; /* Max card numbers */
- pn532_packetbuffer[2] = (keyNumber) ? MIFARE_CMD_AUTH_B : MIFARE_CMD_AUTH_A;
- pn532_packetbuffer[3] = blockNumber; /* Block
- Number
- (1K =
- 0..63, 4K
- =
- 0..255 */
- memcpy (pn532_packetbuffer+4, m_key, 6);
- for (i = 0; i < m_uidLen; i++)
- {
- pn532_packetbuffer[10+i] = m_uid[i]; /* 4 byte card ID */
- }
-
- if (! sendCommandCheckAck(pn532_packetbuffer, 10+m_uidLen))
- return false;
-
- if (!waitForReady(1000)) {
- if (m_pn532Debug)
- cerr << __FUNCTION__ << ": timeout waiting auth..." << endl;
-
- return false;
- }
-
- // Read the response packet
- readData(pn532_packetbuffer, 12);
-
- // check if the response is valid and we are authenticated???
- // for an auth success it should be bytes 5-7: 0xD5 0x41 0x00
- // Mifare auth error is technically byte 7: 0x14 but anything other
- // and 0x00 is not good
- if (pn532_packetbuffer[7] != 0x00)
- {
- if (m_pn532Debug)
- {
- fprintf(stderr, "Authentication failed: ");
- PrintHexChar(pn532_packetbuffer, 12);
- }
-
- return false;
- }
-
- return true;
-}
-
-/**************************************************************************/
-/*!
- Tries to read an entire 16-byte data block at the specified block
- address.
-
- @param blockNumber The block number to authenticate. (0..63 for
- 1KB cards, and 0..255 for 4KB cards).
- @param data Pointer to the byte array that will hold the
- retrieved data (if any)
-
- @returns 1 if everything executed properly, 0 for an error
-*/
-/**************************************************************************/
-bool PN532::mifareclassic_ReadDataBlock (uint8_t blockNumber, uint8_t * data)
-{
- if (m_mifareDebug)
- cerr << __FUNCTION__ << ": Trying to read 16 bytes from block "
- << (int)blockNumber << endl;
-
- /* Prepare the command */
- pn532_packetbuffer[0] = CMD_INDATAEXCHANGE;
- pn532_packetbuffer[1] = 1; /* Card number */
- pn532_packetbuffer[2] = MIFARE_CMD_READ; /* Mifare Read
- command = 0x30 */
- pn532_packetbuffer[3] = blockNumber; /* Block Number
- (0..63 for 1K,
- 0..255 for 4K) */
-
- /* Send the command */
- if (! sendCommandCheckAck(pn532_packetbuffer, 4))
- {
- if (m_mifareDebug)
- cerr << __FUNCTION__ << ": Failed to receive ACK for read command"
- << endl;
-
- return false;
- }
-
- /* Read the response packet */
- readData(pn532_packetbuffer, 26);
-
- /* If byte 8 isn't 0x00 we probably have an error */
- if (pn532_packetbuffer[7] != 0x00)
- {
- if (m_mifareDebug)
- {
- fprintf(stderr, "Unexpected response: ");
- PrintHexChar(pn532_packetbuffer, 26);
- }
- return false;
- }
-
- /* Copy the 16 data bytes to the output buffer */
- /* Block content starts at byte 9 of a valid response */
- memcpy (data, pn532_packetbuffer+8, 16);
-
- /* Display data for debug if requested */
- if (m_mifareDebug)
- {
- fprintf(stderr, "Block %d: ", blockNumber);
- PrintHexChar(data, 16);
- }
-
- return true;
-}
-
-/**************************************************************************/
-/*!
- Tries to write an entire 16-byte data block at the specified block
- address.
-
- @param blockNumber The block number to authenticate. (0..63 for
- 1KB cards, and 0..255 for 4KB cards).
- @param data The byte array that contains the data to write.
-
- @returns 1 if everything executed properly, 0 for an error
-*/
-/**************************************************************************/
-bool PN532::mifareclassic_WriteDataBlock (uint8_t blockNumber, uint8_t * data)
-{
- if (m_mifareDebug)
- fprintf(stderr, "Trying to write 16 bytes to block %d\n", blockNumber);
-
- /* Prepare the first command */
- pn532_packetbuffer[0] = CMD_INDATAEXCHANGE;
- pn532_packetbuffer[1] = 1; /* Card number */
- pn532_packetbuffer[2] = MIFARE_CMD_WRITE; /* Mifare Write
- command = 0xA0 */
- pn532_packetbuffer[3] = blockNumber; /* Block Number
- (0..63 for 1K,
- 0..255 for 4K) */
- memcpy (pn532_packetbuffer+4, data, 16); /* Data Payload */
-
- /* Send the command */
- if (! sendCommandCheckAck(pn532_packetbuffer, 20))
- {
- if (m_mifareDebug)
- cerr << __FUNCTION__ << ": Failed to receive ACK for write command"
- << endl;
-
- return false;
- }
- usleep(10000);
-
- /* Read the response packet */
- readData(pn532_packetbuffer, 26);
-
- return true;
-}
-
-/**************************************************************************/
-/*!
- Formats a Mifare Classic card to store NDEF Records
-
- @returns 1 if everything executed properly, 0 for an error
-*/
-/**************************************************************************/
-bool PN532::mifareclassic_FormatNDEF (void)
-{
- uint8_t sectorbuffer1[16] = {0x14, 0x01, 0x03, 0xE1, 0x03, 0xE1, 0x03, 0xE1,
- 0x03, 0xE1, 0x03, 0xE1, 0x03, 0xE1, 0x03, 0xE1};
- uint8_t sectorbuffer2[16] = {0x03, 0xE1, 0x03, 0xE1, 0x03, 0xE1, 0x03, 0xE1,
- 0x03, 0xE1, 0x03, 0xE1, 0x03, 0xE1, 0x03, 0xE1};
- uint8_t sectorbuffer3[16] = {0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0x78, 0x77,
- 0x88, 0xC1, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
-
- // Note 0xA0 0xA1 0xA2 0xA3 0xA4 0xA5 must be used for key A
- // for the MAD sector in NDEF records (sector 0)
-
- // Write block 1 and 2 to the card
- if (!(mifareclassic_WriteDataBlock (1, sectorbuffer1)))
- return false;
- if (!(mifareclassic_WriteDataBlock (2, sectorbuffer2)))
- return false;
- // Write key A and access rights card
- if (!(mifareclassic_WriteDataBlock (3, sectorbuffer3)))
- return false;
-
- // Seems that everything was OK (?!)
- return true;
-}
-
-/**************************************************************************/
-/*!
- Writes an NDEF URI Record to the specified sector (1..15)
-
- Note that this function assumes that the Mifare Classic card is
- already formatted to work as an "NFC Forum Tag" and uses a MAD1
- file system. You can use the NXP TagWriter app on Android to
- properly format cards for this.
-
- @param sectorNumber The sector that the URI record should be written
- to (can be 1..15 for a 1K card)
- @param uriIdentifier The uri identifier code (0 = none, 0x01 =
- "http://www.", etc.)
- @param url The uri text to write (max 38 characters).
-
- @returns 1 if everything executed properly, 0 for an error
-*/
-/**************************************************************************/
-bool PN532::mifareclassic_WriteNDEFURI (uint8_t sectorNumber,
- NDEF_URI_T uriIdentifier,
- const char * url)
-{
- if (!url)
- return false;
-
- // Figure out how long the string is
- uint8_t len = strlen(url);
-
- // Make sure we're within a 1K limit for the sector number
- if ((sectorNumber < 1) || (sectorNumber > 15))
- return false;
-
- // Make sure the URI payload is between 1 and 38 chars
- if ((len < 1) || (len > 38))
- return false;
-
- // Note 0xD3 0xF7 0xD3 0xF7 0xD3 0xF7 must be used for key A
- // in NDEF records
-
- // Setup the sector buffer (w/pre-formatted TLV wrapper and NDEF message)
- uint8_t sectorbuffer1[16] = {0x00, 0x00, 0x03, static_cast<uint8_t>(len+5),
- 0xD1, 0x01, static_cast<uint8_t>(len+1),
- 0x55, static_cast<uint8_t>(uriIdentifier), 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00};
- uint8_t sectorbuffer2[16] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00};
- uint8_t sectorbuffer3[16] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00};
- uint8_t sectorbuffer4[16] = {0xD3, 0xF7, 0xD3, 0xF7, 0xD3, 0xF7, 0x7F,
- 0x07, 0x88, 0x40, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF};
- if (len <= 6)
- {
- // Unlikely we'll get a url this short, but why not ...
- memcpy (sectorbuffer1+9, url, len);
- sectorbuffer1[len+9] = 0xFE;
- }
- else if (len == 7)
- {
- // 0xFE needs to be wrapped around to next block
- memcpy (sectorbuffer1+9, url, len);
- sectorbuffer2[0] = 0xFE;
- }
- else if ((len > 7) && (len <= 22))
- {
- // Url fits in two blocks
- memcpy (sectorbuffer1+9, url, 7);
- memcpy (sectorbuffer2, url+7, len-7);
- sectorbuffer2[len-7] = 0xFE;
- }
- else if (len == 23)
- {
- // 0xFE needs to be wrapped around to final block
- memcpy (sectorbuffer1+9, url, 7);
- memcpy (sectorbuffer2, url+7, len-7);
- sectorbuffer3[0] = 0xFE;
- }
- else
- {
- // Url fits in three blocks
- memcpy (sectorbuffer1+9, url, 7);
- memcpy (sectorbuffer2, url+7, 16);
- memcpy (sectorbuffer3, url+23, len-24);
- sectorbuffer3[len-23] = 0xFE;
- }
-
- // Now write all three blocks back to the card
- if (!(mifareclassic_WriteDataBlock (sectorNumber*4, sectorbuffer1)))
- return false;
- if (!(mifareclassic_WriteDataBlock ((sectorNumber*4)+1, sectorbuffer2)))
- return false;
- if (!(mifareclassic_WriteDataBlock ((sectorNumber*4)+2, sectorbuffer3)))
- return false;
- if (!(mifareclassic_WriteDataBlock ((sectorNumber*4)+3, sectorbuffer4)))
- return false;
-
- // Seems that everything was OK (?!)
- return true;
-}
-
-
-/***** NTAG2xx/ultralight Functions ******/
-
-// Ultralight tags are limited to 64 pages max, with ntag2XX tags can
-// have up to 231 pages.
-
-/* MIFARE ULTRALIGHT DESCRIPTION
- =============================
-
- Taken from: https://www.kismetwireless.net/code-old/svn/hardware/kisbee-02/firmware/drivers/rf/pn532/helpers/pn532_mifare_ultralight.c
-
- MIFARE Ultralight cards typically contain 512 bits (64 bytes) of
- memory, including 4 bytes (32-bits) of OTP (One Time Programmable)
- memory where the individual bits can be written but not erased.
-
- MF0ICU1 Mifare Ultralight Functional Specification:
- http://www.nxp.com/documents/data_sheet/MF0ICU1.pdf
-
-
- Mifare Ultralight cards have a 7-byte UID
-
- EEPROM MEMORY
- =============
- Mifare Ultralight cards have 512 bits (64 bytes) of EEPROM memory,
- including 4 byte (32 bits) of OTP memory. Unlike Mifare Classic cards,
- there is no authentication on a per block level, although the blocks
- can be set to "read-only" mode using Lock Bytes (described below).
-
- EEPROM memory is organised into 16 pages of four bytes eachs, in
- the following order
-
- Page Description
- ---- ------------
- 0 Serial Number (4 bytes)
- 1 Serial Number (4 bytes)
- 2 Byte 0: Serial Number
- Byte 1: Internal Memory
- Byte 2..3: lock bytes
- 3 One-time programmable memory (4 bytes)
- 4..15 User memory (4 bytes)
-
- Lock Bytes (Page 2)
- -------------------
- Bytes 2 and 3 of page 2 are referred to as "Lock Bytes". Each
- page from 0x03 and higher can individually locked by setting the
- corresponding locking bit to "1" to prevent further write access,
- effectively making the memory read only.
-
- For information on the lock byte mechanism, refer to section 8.5.2 of
- the datasheet (referenced above).
-
- OTP Bytes (Page 3)
- ------------------
- Page 3 is the OTP memory, and by default all bits on this page are
- set to 0. These bits can be bitwise modified using the Mifare WRITE
- command, and individual bits can be set to 1, but can not be changed
- back to 0.
-
- Data Pages (Pages 4..15)
- ------------------------
- Pages 4 to 15 are can be freely read from and written to,
- provided there is no conflict with the Lock Bytes described above.
-
- After production, the bytes have the following default values:
-
- Page Byte Values
- ---- ----------------------
- 0 1 2 3
- 4 0xFF 0xFF 0xFF 0xFF
- 5..15 0x00 0x00 0x00 0x00
-
- ACCESSING DATA BLOCKS
- =====================
-
- Before you can access the cards, you must following two steps:
-
- 1.) 'Connect' to a Mifare Ultralight card and retrieve the 7 byte
- UID of the card.
-
- 2.) Memory can be read and written directly once a passive mode
- connection has been made. No authentication is required for
- Mifare Ultralight cards.
-
-*/
-
-
-/**************************************************************************/
-/*!
- Tries to read an entire 4-byte page at the specified address.
-
- @param page The page number (0..63 in most cases)
- @param buffer Pointer to the byte array that will hold the
- retrieved data (if any)
-*/
-/**************************************************************************/
-bool PN532::ntag2xx_ReadPage (uint8_t page, uint8_t * buffer)
-{
- // TAG Type PAGES USER START USER STOP
- // -------- ----- ---------- ---------
- // NTAG 203 42 4 39
- // NTAG 213 45 4 39
- // NTAG 215 135 4 129
- // NTAG 216 231 4 225
-
- if (page >= 231)
- {
- cerr << __FUNCTION__ << ": Page value out of range" << endl;
- return false;
- }
-
- if (m_mifareDebug)
- fprintf(stderr, "Reading page %d\n", page);
-
- /* Prepare the command */
- pn532_packetbuffer[0] = CMD_INDATAEXCHANGE;
- pn532_packetbuffer[1] = 1; /* Card number */
- pn532_packetbuffer[2] = MIFARE_CMD_READ; /* Mifare Read command = 0x30 */
- pn532_packetbuffer[3] = page; /* Page Number (0..63
- in most cases) */
-
- /* Send the command */
- if (! sendCommandCheckAck(pn532_packetbuffer, 4))
- {
- if (m_mifareDebug)
- cerr << __FUNCTION__ << ": Failed to receive ACK for write command"
- << endl;
-
- return false;
- }
-
- /* Read the response packet */
- readData(pn532_packetbuffer, 26);
-
- if (m_mifareDebug)
- {
- fprintf(stderr, "Received: \n");
- PrintHexChar(pn532_packetbuffer, 26);
- }
-
- /* If byte 8 isn't 0x00 we probably have an error */
- if (pn532_packetbuffer[7] == 0x00)
- {
- /* Copy the 4 data bytes to the output buffer */
- /* Block content starts at byte 9 of a valid response */
- /* Note that the command actually reads 16 byte or 4 */
- /* pages at a time ... we simply discard the last 12 */
- /* bytes */
- memcpy (buffer, pn532_packetbuffer+8, 4);
- }
- else
- {
- if (m_mifareDebug)
- {
- fprintf(stderr, "Unexpected response reading block: \n");
- PrintHexChar(pn532_packetbuffer, 26);
- }
-
- return false;
- }
-
- /* Display data for debug if requested */
- if (m_mifareDebug)
- {
- fprintf(stderr, "Page %d:\n", page);
- PrintHexChar(buffer, 4);
- }
-
- // Return OK signal
- return true;
-}
-
-/**************************************************************************/
-/*!
- Tries to write an entire 4-byte page at the specified block
- address.
-
- @param page The page number to write. (0..63 for most cases)
- @param data The byte array that contains the data to write.
- Should be exactly 4 bytes long.
-
- @returns 1 if everything executed properly, 0 for an error
-*/
-/**************************************************************************/
-bool PN532::ntag2xx_WritePage (uint8_t page, uint8_t * data)
-{
- // TAG Type PAGES USER START USER STOP
- // -------- ----- ---------- ---------
- // NTAG 203 42 4 39
- // NTAG 213 45 4 39
- // NTAG 215 135 4 129
- // NTAG 216 231 4 225
-
- if ((page < 4) || (page > 225))
- {
- cerr << __FUNCTION__ << ": Page value out of range" << endl;
- return false;
- }
-
- if (m_mifareDebug)
- fprintf(stderr, "Trying to write 4 byte page %d\n", page);
-
- /* Prepare the first command */
- pn532_packetbuffer[0] = CMD_INDATAEXCHANGE;
- pn532_packetbuffer[1] = 1; /* Card number */
- pn532_packetbuffer[2] = MIFARE_ULTRALIGHT_CMD_WRITE; /* Mifare
- Ultralight
- Write
- command =
- 0xA2 */
- pn532_packetbuffer[3] = page; /* Page Number (0..63 for most cases) */
- memcpy (pn532_packetbuffer+4, data, 4); /* Data Payload */
-
- /* Send the command */
- if (! sendCommandCheckAck(pn532_packetbuffer, 8))
- {
- if (m_mifareDebug)
- cerr << __FUNCTION__ << ": Failed to receive ACK for write command"
- << endl;
-
- // Return Failed Signal
- return false;
- }
- usleep(10000);
-
- /* Read the response packet */
- readData(pn532_packetbuffer, 26);
-
- // Return OK Signal
- return true;
-}
-
-/**************************************************************************/
-/*!
- Writes an NDEF URI Record starting at the specified page (4..nn)
-
- Note that this function assumes that the NTAG2xx card is
- already formatted to work as an "NFC Forum Tag".
-
- @param uriIdentifier The uri identifier code (0 = none, 0x01 =
- "http://www.", etc.)
- @param url The uri text to write (null-terminated string).
- @param dataLen The size of the data area for overflow checks.
-
- @returns 1 if everything executed properly, 0 for an error
-*/
-/**************************************************************************/
-bool PN532::ntag2xx_WriteNDEFURI (NDEF_URI_T uriIdentifier, char * url,
- uint8_t dataLen)
-{
- uint8_t pageBuffer[4] = { 0, 0, 0, 0 };
-
- // Remove NDEF record overhead from the URI data (pageHeader below)
- uint8_t wrapperSize = 12;
-
- // Figure out how long the string is
- uint8_t len = strlen(url);
-
- // Make sure the URI payload will fit in dataLen (include 0xFE trailer)
- if ((len < 1) || (len+1 > (dataLen-wrapperSize)))
- return false;
-
- // Setup the record header
- // See NFCForum-TS-Type-2-Tag_1.1.pdf for details
- uint8_t pageHeader[12] =
- {
- /* NDEF Lock Control TLV (must be first and always present) */
- 0x01, /* Tag Field (0x01 = Lock Control TLV) */
- 0x03, /* Payload Length (always 3) */
- 0xA0, /* The position inside the tag of the lock bytes
- (upper 4 = page address, lower 4 = byte
- offset) */
- 0x10, /* Size in bits of the lock area */
- 0x44, /* Size in bytes of a page and the number of bytes
- each lock bit can lock (4 bit + 4 bits) */
- /* NDEF Message TLV - URI Record */
- 0x03, /* Tag Field (0x03 = NDEF Message) */
- static_cast<uint8_t>(len+5),
- /* Payload Length (not including 0xFE trailer) */
- 0xD1, /* NDEF Record Header (TNF=0x1:Well known record +
- SR + ME + MB) */
- 0x01, /* Type Length for the record type indicator */
- static_cast<uint8_t>(len+1),
- /* Payload len */
- 0x55, /* Record Type Indicator (0x55 or 'U' = URI Record) */
- static_cast<uint8_t>(uriIdentifier)
- /* URI Prefix (ex. 0x01 = "http://www.") */
- };
-
- // Write 12 byte header (three pages of data starting at page 4)
- memcpy (pageBuffer, pageHeader, 4);
- if (!(ntag2xx_WritePage (4, pageBuffer)))
- return false;
- memcpy (pageBuffer, pageHeader+4, 4);
- if (!(ntag2xx_WritePage (5, pageBuffer)))
- return false;
- memcpy (pageBuffer, pageHeader+8, 4);
- if (!(ntag2xx_WritePage (6, pageBuffer)))
- return false;
-
- // Write URI (starting at page 7)
- uint8_t currentPage = 7;
- char * urlcopy = url;
- while (len)
- {
- if (len < 4)
- {
- memset(pageBuffer, 0, 4);
- memcpy(pageBuffer, urlcopy, len);
- pageBuffer[len] = 0xFE; // NDEF record footer
- if (!(ntag2xx_WritePage (currentPage, pageBuffer)))
- return false;
- // DONE!
- return true;
- }
- else if (len == 4)
- {
- memcpy(pageBuffer, urlcopy, len);
- if (!(ntag2xx_WritePage (currentPage, pageBuffer)))
- return false;
- memset(pageBuffer, 0, 4);
- pageBuffer[0] = 0xFE; // NDEF record footer
- currentPage++;
- if (!(ntag2xx_WritePage (currentPage, pageBuffer)))
- return false;
- // DONE!
- return true;
- }
- else
- {
- // More than one page of data left
- memcpy(pageBuffer, urlcopy, 4);
- if (!(ntag2xx_WritePage (currentPage, pageBuffer)))
- return false;
- currentPage++;
- urlcopy+=4;
- len-=4;
- }
- }
-
- // Seems that everything was OK (?!)
- return true;
-}
-
-
-/**************************************************************************/
-/*!
- @brief Tries to read/verify the ACK packet
-*/
-/**************************************************************************/
-bool PN532::readAck()
-{
- uint8_t ackbuff[6];
-
- readData(ackbuff, 6);
-
- return (0 == memcmp((char *)ackbuff, (char *)pn532ack, 6));
-}
-
-
-/**************************************************************************/
-/*!
- @brief Return true if the PN532 is ready with a response.
-*/
-/**************************************************************************/
-bool PN532::isReady()
-{
- // ALWAYS clear the m_irqRcvd flag if set.
- if (m_irqRcvd)
- {
- m_irqRcvd = false;
- return true;
- }
-
- return false;
-}
-
-/**************************************************************************/
-/*!
- @brief Waits until the PN532 is ready.
-
- @param timeout Timeout before giving up
-*/
-/**************************************************************************/
-bool PN532::waitForReady(uint16_t timeout)
-{
- uint16_t timer = 0;
- while(!isReady())
- {
- if (timeout != 0)
- {
- timer += 10;
- if (timer > timeout)
- {
- return false;
- }
- }
- usleep(10000);
- }
- return true;
-}
-
-/**************************************************************************/
-/*!
- @brief Reads n bytes of data from the PN532 via SPI or I2C.
-
- @param buff Pointer to the buffer where data will be written
- @param n Number of bytes to be read
-*/
-/**************************************************************************/
-void PN532::readData(uint8_t* buff, uint8_t n)
-{
- uint8_t buf[n + 2];
- int rv;
-
- memset(buf, 0, n+2);
- usleep(2000);
- if (m_i2c.address(m_addr) != mraa::SUCCESS)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": mraa_i2c_address() failed");
- return;
- }
-
- rv = m_i2c.read(buf, n + 2);
-
- if (m_pn532Debug)
- {
- cerr << __FUNCTION__ << ": read returned " << rv << "bytes" << endl;
-
- fprintf(stderr, "(raw) buf (%d) = ", rv);
- PrintHex(buf, rv);
- fprintf(stderr, "\n");
- }
-
- for (int i=0; i<n; i++)
- buff[i] = buf[i+1];
-
- if (m_pn532Debug)
- {
- fprintf(stderr, "(returned) buf (%d) = \n", n);
- PrintHex(buff, n);
- fprintf(stderr, "\n");
- }
-}
-
-/**************************************************************************/
-/*!
- @brief Writes a command to the PN532, automatically inserting the
- preamble and required frame details (checksum, len, etc.)
-
- @param cmd Pointer to the command buffer
- @param cmdlen Command length in bytes
-*/
-/**************************************************************************/
-void PN532::writeCommand(uint8_t* cmd, uint8_t cmdlen)
-{
- // I2C command write.
-
- cmdlen++;
-
- usleep(2000); // 2ms max in case board needs to wake up
-
- // command + packet wrapper
- uint8_t buf[cmdlen + 8];
- memset(buf, 0, cmdlen + 8);
- int offset = 0;
-
- if (m_pn532Debug)
- cerr << __FUNCTION__ << ": Sending: " << endl;
-
- uint8_t checksum = PN532_PREAMBLE + PN532_PREAMBLE + PN532_STARTCODE2;
- buf[offset++] = PN532_PREAMBLE;
- buf[offset++] = PN532_PREAMBLE;
- buf[offset++] = PN532_STARTCODE2;
-
- buf[offset++] = cmdlen;
- buf[offset++] = ~cmdlen + 1;
-
- buf[offset++] = PN532_HOSTTOPN532;
- checksum += PN532_HOSTTOPN532;
-
- for (uint8_t i=0; i<cmdlen - 1; i++)
- {
- buf[offset++] = cmd[i];
- checksum += cmd[i];
- }
-
- buf[offset++] = ~checksum;
- buf[offset] = PN532_POSTAMBLE;
-
- if (m_i2c.address(m_addr) != mraa::SUCCESS)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": mraa_i2c_address() failed");
- return;
- }
-
- if (m_i2c.write(buf, cmdlen + 8 - 1) != mraa::SUCCESS)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": mraa_i2c_write() failed");
- return;
- }
-
- if (m_pn532Debug)
- {
- cerr << __FUNCTION__ << ": cmdlen + 8 = " << cmdlen + 8
- <<", offset = " << offset << endl;
-
- PrintHex(buf, cmdlen + 8);
- }
-}
-
-void PN532::dataReadyISR(void *ctx)
-{
- upm::PN532 *This = (upm::PN532 *)ctx;
-
- // if debugging is enabled, indicate when an interrupt occurred, and
- // a previously triggered interrupt was still set.
- if (This->m_pn532Debug)
- if (This->m_irqRcvd)
- cerr << __FUNCTION__ << ": INFO: Unhandled IRQ detected." << endl;
-
- This->m_irqRcvd = true;
-}
-
-PN532::TAG_TYPE_T PN532::tagType()
-{
- // This is really just a guess, ATQA and SAK could in theory be used
- // to refine the detection.
-
- if (m_uidLen == 4)
- return TAG_TYPE_MIFARE_CLASSIC;
- else if (m_uidLen == 7)
- return TAG_TYPE_NFC2;
- else
- return TAG_TYPE_UNKNOWN;
-}
diff --git a/peripheral/libupm/src/pn532/pn532.h b/peripheral/libupm/src/pn532/pn532.h
deleted file mode 100644
index 206eb5b..0000000
--- a/peripheral/libupm/src/pn532/pn532.h
+++ /dev/null
@@ -1,505 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * This code is heavily based on the Adafruit-PN532 library at
- * https://github.com/adafruit/Adafruit-PN532, which is licensed under
- * the BSD license. See upm/src/pn532/license.txt
- *
- * 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 <string.h>
-#include <string>
-#include <mraa/common.hpp>
-#include <mraa/i2c.hpp>
-
-#include <mraa/gpio.hpp>
-
-#define PN532_I2C_BUS 0
-#define PN532_DEFAULT_I2C_ADDR (0x48 >> 1)
-
-#define PN532_PREAMBLE (0x00)
-#define PN532_STARTCODE1 (0x00)
-#define PN532_STARTCODE2 (0xFF)
-#define PN532_POSTAMBLE (0x00)
-
-#define PN532_HOSTTOPN532 (0xD4)
-#define PN532_PN532TOHOST (0xD5)
-
-namespace upm {
-
- /**
- * @brief PN532 NFC/RFID reader/writer
- * @defgroup pn532 libupm-pn532
- * @ingroup adafruit i2c rfid
- */
-
- /**
- * @library pn532
- * @sensor pn532
- * @comname PN532 NFC/RFID reader/writer
- * @type rfid
- * @man adafruit
- * @web http://www.adafruit.com/products/364
- * @con i2c
- *
- * @brief API for the PN532 based NFC/RFID reader/writer
- *
- * @image html pn532.jpg
- * Identify a card and print out basic info
- * @snippet pn532.cxx Interesting
- * Add a URI to an already NDEF formatted ultralight or NTAG2XX tag
- * @snippet pn532-writeurl.cxx Interesting
- */
- class PN532 {
- public:
-
- /**
- * PN532 commands
- */
- typedef enum {
- CMD_DIAGNOSE = 0x00,
- CMD_GETFIRMWAREVERSION = 0x02,
- CMD_GETGENERALSTATUS = 0x04,
- CMD_READREGISTER = 0x06,
- CMD_WRITEREGISTER = 0x08,
- CMD_READGPIO = 0x0C,
- CMD_WRITEGPIO = 0x0E,
- CMD_SETSERIALBAUDRATE = 0x10,
- CMD_SETPARAMETERS = 0x12,
- CMD_SAMCONFIGURATION = 0x14,
- CMD_POWERDOWN = 0x16,
- CMD_RFCONFIGURATION = 0x32,
- CMD_RFREGULATIONTEST = 0x58,
- CMD_INJUMPFORDEP = 0x56,
- CMD_INJUMPFORPSL = 0x46,
- CMD_INLISTPASSIVETARGET = 0x4A,
- CMD_INATR = 0x50,
- CMD_INPSL = 0x4E,
- CMD_INDATAEXCHANGE = 0x40,
- CMD_INCOMMUNICATETHRU = 0x42,
- CMD_INDESELECT = 0x44,
- CMD_INRELEASE = 0x52,
- CMD_INSELECT = 0x54,
- CMD_INAUTOPOLL = 0x60,
- CMD_TGINITASTARGET = 0x8C,
- CMD_TGSETGENERALBYTES = 0x92,
- CMD_TGGETDATA = 0x86,
- CMD_TGSETDATA = 0x8E,
- CMD_TGSETMETADATA = 0x94,
- CMD_TGGETINITIATORCOMMAND = 0x88,
- CMD_TGRESPONSETOINITIATOR = 0x90,
- CMD_TGGETTARGETSTATUS = 0x8A
- } PN532_CMD_T;
-
- /**
- * Response bytes
- */
- typedef enum {
- RSP_INDATAEXCHANGE = 0x41,
- RSP_INLISTPASSIVETARGET = 0x4B
- } PN532_RSP_T;
-
- /**
- * MIFARE commands
- */
- typedef enum {
- MIFARE_CMD_AUTH_A = 0x60,
- MIFARE_CMD_AUTH_B = 0x61,
- MIFARE_CMD_READ = 0x30,
- MIFARE_CMD_WRITE = 0xA0,
- MIFARE_CMD_TRANSFER = 0xB0,
- MIFARE_CMD_DECREMENT = 0xC0,
- MIFARE_CMD_INCREMENT = 0xC1,
- MIFARE_CMD_STORE = 0xC2,
- MIFARE_ULTRALIGHT_CMD_WRITE = 0xA2
- } MIFARE_CMD_T;
-
- /**
- * NDEF prefixes
- */
- typedef enum {
- NDEF_URIPREFIX_NONE = 0x00,
- NDEF_URIPREFIX_HTTP_WWWDOT = 0x01,
- NDEF_URIPREFIX_HTTPS_WWWDOT = 0x02,
- NDEF_URIPREFIX_HTTP = 0x03,
- NDEF_URIPREFIX_HTTPS = 0x04,
- NDEF_URIPREFIX_TEL = 0x05,
- NDEF_URIPREFIX_MAILTO = 0x06,
- NDEF_URIPREFIX_FTP_ANONAT = 0x07,
- NDEF_URIPREFIX_FTP_FTPDOT = 0x08,
- NDEF_URIPREFIX_FTPS = 0x09,
- NDEF_URIPREFIX_SFTP = 0x0A,
- NDEF_URIPREFIX_SMB = 0x0B,
- NDEF_URIPREFIX_NFS = 0x0C,
- NDEF_URIPREFIX_FTP = 0x0D,
- NDEF_URIPREFIX_DAV = 0x0E,
- NDEF_URIPREFIX_NEWS = 0x0F,
- NDEF_URIPREFIX_TELNET = 0x10,
- NDEF_URIPREFIX_IMAP = 0x11,
- NDEF_URIPREFIX_RTSP = 0x12,
- NDEF_URIPREFIX_URN = 0x13,
- NDEF_URIPREFIX_POP = 0x14,
- NDEF_URIPREFIX_SIP = 0x15,
- NDEF_URIPREFIX_SIPS = 0x16,
- NDEF_URIPREFIX_TFTP = 0x17,
- NDEF_URIPREFIX_BTSPP = 0x18,
- NDEF_URIPREFIX_BTL2CAP = 0x19,
- NDEF_URIPREFIX_BTGOEP = 0x1A,
- NDEF_URIPREFIX_TCPOBEX = 0x1B,
- NDEF_URIPREFIX_IRDAOBEX = 0x1C,
- NDEF_URIPREFIX_FILE = 0x1D,
- NDEF_URIPREFIX_URN_EPC_ID = 0x1E,
- NDEF_URIPREFIX_URN_EPC_TAG = 0x1F,
- NDEF_URIPREFIX_URN_EPC_PAT = 0x20,
- NDEF_URIPREFIX_URN_EPC_RAW = 0x21,
- NDEF_URIPREFIX_URN_EPC = 0x22,
- NDEF_URIPREFIX_URN_NFC = 0x23
- } NDEF_URI_T;
-
- /**
- * Card baud rates
- */
- typedef enum {
- BAUD_MIFARE_ISO14443A = 0x00 // 106 Kbit/s
- } BAUD_T;
-
-
- /**
- * Tag types
- */
- typedef enum {
- TAG_TYPE_UNKNOWN = 0,
- TAG_TYPE_MIFARE_CLASSIC = 1,
- TAG_TYPE_NFC2 = 2 /* ultralight or NTAG2XX */
- } TAG_TYPE_T;
-
- /**
- * pn532 constructor
- *
- * @param irq pin to use for IRQ
- * @param reset reset pin
- * @param bus i2c bus to use
- * @param address the address for this device
- */
- PN532(int irq, int reset, int bus=PN532_I2C_BUS,
- uint8_t address=PN532_DEFAULT_I2C_ADDR);
-
- /**
- * PN532 Destructor
- */
- ~PN532();
-
- /**
- * set up initial values and start operation
- *
- * @return true if successful
- */
- bool init();
-
- /**
- * Checks the firmware version of the PN5xx chip
- *
- * @return the chip's firmware version and ID
- */
- uint32_t getFirmwareVersion();
-
- /**
- * sends a command and waits a specified period for the ACK
- *
- * @param cmd Pointer to the command buffer
- * @param cmdlen the size of the command in bytes
- * @param timeout timeout before giving up (in ms)
- *
- * @return true if everything is OK, false if timeout occured
- * before an ACK was recieved
- */
- bool sendCommandCheckAck(uint8_t *cmd, uint8_t cmdlen,
- uint16_t timeout=1000);
-
- /**
- * configures the SAM (Secure Access Module)
- *
- * @return true if successfully configured
- */
- bool SAMConfig(void);
-
- /**
- * sets the MxRtyPassiveActivation byte of the RFConfiguration
- * register. By default the pn532 will retry indefinitely.
- *
- * @param maxRetries 0xFF to wait forever, 0x00..0xFE to timeout
- * after maxRetries. 0x00 means try once, with no retries on failure.
- *
- * @return true if everything executed properly, false for an error
- */
- bool setPassiveActivationRetries(uint8_t maxRetries);
-
- /**
- * waits for an ISO14443A target to enter the field
- *
- * @param cardbaudbate baud rate of the card, one of the BAUD_T values
- * @param uid Pointer to the array that will be populated with the
- * cards UID, up to 7 bytes
- * @param uidLength Pointer to the variable that will hold the
- * length of the card's UID.
- * @param timeout the number of milliseconds to wait
- *
- * @return true if everything executed properly, false for an error
- */
- bool readPassiveTargetID(BAUD_T cardbaudrate, uint8_t * uid,
- uint8_t * uidLength, uint16_t timeout);
-
- /**
- * exchanges an APDU (Application Protocol Data Unit) with the
- * currently inlisted peer
- *
- * @param send Pointer to data to send
- * @param sendLength Length of the data to send
- * @param response Pointer to response data
- * @param responseLength Pointer to the response data length
- *
- * @return true if everything executed properly, false for an error
- */
- bool inDataExchange(uint8_t * send, uint8_t sendLength,
- uint8_t * response, uint8_t * responseLength);
-
- /**
- * 'InLists' a passive target. PN532 acting as reader/initiator,
- * peer acting as card/responder.
- *
- * @return true if everything executed properly, false for an error
- */
- bool inListPassiveTarget();
-
- /**
- * Indicates whether the specified block number is the first block
- * in the sector (block 0 relative to the current sector)
- *
- * @return true if it's the first block, false otherwise
- */
- bool mifareclassic_IsFirstBlock (uint32_t uiBlock);
-
- /**
- * indicates whether the specified block number is the sector trailer
- *
- * @return true if it's the trailer block, false otherwise
- */
- bool mifareclassic_IsTrailerBlock (uint32_t uiBlock);
-
- /**
- * tries to authenticate a block of memory on a MIFARE card using the
- * INDATAEXCHANGE command. See section 7.3.8 of the PN532 User Manual
- * for more information on sending MIFARE and other commands.
- *
- * @param uid Pointer to a byte array containing the card UID
- * @param uidLen The length (in bytes) of the card's UID (Should
- * be 4 for MIFARE Classic)
- * @param blockNumber The block number to authenticate. (0..63 for
- * 1KB cards, and 0..255 for 4KB cards).
- * @param keyNumber Which key type to use during authentication
- * (0 = MIFARE_CMD_AUTH_A, 1 = MIFARE_CMD_AUTH_B)
- * @param keyData Pointer to a byte array containing the 6 byte
- * key value
- *
- * @return true if everything executed properly, false for an error
- */
- bool mifareclassic_AuthenticateBlock (uint8_t * uid, uint8_t uidLen,
- uint32_t blockNumber,
- uint8_t keyNumber,
- uint8_t * keyData);
-
- /**
- * tries to read an entire 16-byte data block at the specified block
- * address.
- *
- * @param blockNumber The block number to read (0..63 for
- * 1KB cards, and 0..255 for 4KB cards).
- * @param data Pointer to the byte array that will hold the
- * retrieved data (if any)
- *
- * @return true if everything executed properly, false for an error
- */
- bool mifareclassic_ReadDataBlock (uint8_t blockNumber, uint8_t * data);
-
- /**
- * tries to write an entire 16-byte data block at the specified block
- * address.
- *
- * @param blockNumber The block number to write. (0..63 for
- * 1KB cards, and 0..255 for 4KB cards).
- * @param data The byte array that contains the data to write.
- *
- * @returns true if everything executed properly, false for an error
- */
- bool mifareclassic_WriteDataBlock (uint8_t blockNumber, uint8_t * data);
-
- /**
- * formats a Mifare Classic card to store NDEF Records
- *
- * @return true if everything executed properly, false for an error
- */
- bool mifareclassic_FormatNDEF (void);
-
- /**
- * writes an NDEF URI Record to the specified sector (1..15)
- *
- * Note that this function assumes that the Mifare Classic card is
- * already formatted to work as an "NFC Forum Tag" and uses a MAD1
- * file system. You can use the NXP TagWriter app on Android to
- * properly format cards for this.
- *
- * @param sectorNumber The sector that the URI record should be written
- * to (can be 1..15 for a 1K card)
- * @param uriIdentifier The uri identifier code (one of the NDEF_URI_T
- * values
- * @param url the uri text to write (max 38 characters).
- *
- * @return true if everything executed properly, false for an error
- */
- bool mifareclassic_WriteNDEFURI (uint8_t sectorNumber,
- NDEF_URI_T uriIdentifier,
- const char * url);
-
- /**
- * read an entire 4-byte page at the specified address
- *
- * @param page The page number (0..63 in most cases)
- * @param buffer Pointer to the byte array that will hold the
- * retrieved data (if any)
- *
- * @return true if everything executed properly, false for an error
- */
- bool ntag2xx_ReadPage (uint8_t page, uint8_t * buffer);
-
- /**
- * write an entire 4-byte page at the specified block address
- *
- * @param page The page number to write. (0..63 for most cases)
- * @param data The byte array that contains the data to write.
- * Should be exactly 4 bytes long.
- *
- * @return true if everything executed properly, false for an error
- */
- bool ntag2xx_WritePage (uint8_t page, uint8_t * data);
-
- /**
- * writes an NDEF URI Record starting at the specified page (4..nn)
- *
- * Note that this function assumes that the NTAG2xx card is
- * already formatted to work as an "NFC Forum Tag".
- *
- * @param uriIdentifier The uri identifier code (one of the NDEF_URI_T
- * values
- * @param url The uri text to write (null-terminated string).
- * @param dataLen The size of the data area for overflow checks.
- *
- * @return true if everything executed properly, false for an error
- */
- bool ntag2xx_WriteNDEFURI (NDEF_URI_T uriIdentifier, char * url,
- uint8_t dataLen);
-
- /**
- * return the ATQA (Answer to Request Acknowlege) value. This
- * value is only valid after a successfull call to
- * readPassiveTargetID()
- *
- * @return ATQA value
- */
- uint16_t getATQA() { return m_ATQA; };
-
- /**
- * return the SAK (Select Acknowlege) value. This
- * value is only valid after a successfull call to
- * readPassiveTargetID()
- *
- * @return SAK value
- */
- uint8_t getSAK() { return m_SAK; };
-
- /**
- * provide public access to the class's MRAA i2C context for
- * direct user access
- *
- * @return a reference to the class i2c context
- */
- mraa::I2c& i2cContext() { return m_i2c; };
-
- /**
- * enable or disable debugging output for pn532 related operations
- *
- * @param enable true to enabloe debug output, false to disable
- */
- void pn532Debug(bool enable) { m_pn532Debug = enable; };
-
- /**
- * enable or disable debugging output for mifare related operations
- *
- * @param enable true to enabloe debug output, false to disable
- */
-
- void mifareDebug(bool enable) { m_mifareDebug = enable; };
-
- /**
- * try to determine the tag type
- *
- * @return one of the TAG_TYPE_T values
- */
- TAG_TYPE_T tagType();
-
- protected:
- mraa::I2c m_i2c;
- mraa::Gpio m_gpioIRQ;
- mraa::Gpio m_gpioReset;
-
- bool readAck();
- bool isReady();
- bool waitForReady(uint16_t timeout);
- void readData(uint8_t* buff, uint8_t n);
- void writeCommand(uint8_t* cmd, uint8_t cmdlen);
-
- private:
- static void dataReadyISR(void *ctx);
- bool m_isrInstalled;
- volatile bool m_irqRcvd;
-
- uint8_t m_addr;
-
- uint8_t m_uid[7]; // ISO14443A uid
- uint8_t m_uidLen; // uid len
- uint8_t m_key[6]; // Mifare Classic key
- uint8_t m_inListedTag; // Tg number of inlisted tag.
-
- uint16_t m_ATQA; // ATQA (Answer to Request Acknowlege - ISO14443)
- // for currently inlisted card
- uint8_t m_SAK; // SAK (Select Acknowlege)
- // for currently inlisted card
-
- // debugables
- bool m_pn532Debug;
- bool m_mifareDebug;
- };
-}
-
-
diff --git a/peripheral/libupm/src/pn532/pyupm_pn532.i b/peripheral/libupm/src/pn532/pyupm_pn532.i
deleted file mode 100644
index 64bfad3..0000000
--- a/peripheral/libupm/src/pn532/pyupm_pn532.i
+++ /dev/null
@@ -1,16 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_pn532
-%include "../upm.i"
-%include "../carrays_uint8_t.i"
-
-%feature("autodoc", "3");
-
-#ifdef DOXYGEN
-%include "pn532_doc.i"
-#endif
-
-%include "pn532.h"
-%{
- #include "pn532.h"
-%}
diff --git a/peripheral/libupm/src/ppd42ns/CMakeLists.txt b/peripheral/libupm/src/ppd42ns/CMakeLists.txt
deleted file mode 100644
index 7cffed1..0000000
--- a/peripheral/libupm/src/ppd42ns/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "ppd42ns")
-set (libdescription "upm ppd42ns dust sensor module")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init("-lrt")
diff --git a/peripheral/libupm/src/ppd42ns/javaupm_ppd42ns.i b/peripheral/libupm/src/ppd42ns/javaupm_ppd42ns.i
deleted file mode 100644
index beecd3e..0000000
--- a/peripheral/libupm/src/ppd42ns/javaupm_ppd42ns.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_ppd42ns
-%include "../upm.i"
-
-%{
- #include "ppd42ns.h"
-%}
-
-%include "ppd42ns.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_ppd42ns");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/ppd42ns/jsupm_ppd42ns.i b/peripheral/libupm/src/ppd42ns/jsupm_ppd42ns.i
deleted file mode 100644
index 812d7cb..0000000
--- a/peripheral/libupm/src/ppd42ns/jsupm_ppd42ns.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_ppd42ns
-%include "../upm.i"
-
-%{
- #include "ppd42ns.h"
-%}
-
-%include "ppd42ns.h"
diff --git a/peripheral/libupm/src/ppd42ns/ppd42ns.cxx b/peripheral/libupm/src/ppd42ns/ppd42ns.cxx
deleted file mode 100644
index a7b0e0d..0000000
--- a/peripheral/libupm/src/ppd42ns/ppd42ns.cxx
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Author: Zion Orent <sorent@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <string>
-#include <stdexcept>
-#include <stddef.h>
-#include <stdio.h>
-#include <time.h>
-#include <math.h>
-#include <sys/sysinfo.h>
-#include "ppd42ns.h"
-
-using namespace upm;
-
-PPD42NS::PPD42NS(int pin)
-{
- if ( !(m_gpio = mraa_gpio_init(pin)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_gpio_init() failed, invalid pin?");
- return;
- }
-
- mraa_gpio_dir(m_gpio, MRAA_GPIO_IN);
-}
-
-PPD42NS::~PPD42NS()
-{
- mraa_gpio_close(m_gpio);
-}
-
-dustData PPD42NS::getData()
-{
- dustData data;
- struct timespec printData_start={0,0};
- struct timespec printData_now={0,0};
- clock_gettime(CLOCK_MONOTONIC, &printData_start);
- clock_gettime(CLOCK_MONOTONIC, &printData_now);
- double low_pulse_occupancy = 0;
- double pulse_check_time = 30;
-
- // Keep reading dust data until 30 seconds have passed
- double start_time, end_time;
- while (m_timediff(printData_start, printData_now) < pulse_check_time)
- {
- start_time = m_timediff(printData_start, printData_now);
- end_time = pulse_check_time - start_time;
- low_pulse_occupancy += pulseIn_polyfill(0, end_time);
- clock_gettime(CLOCK_MONOTONIC, &printData_now);
- }
-
- // Store dust data
- double ratio = low_pulse_occupancy / (pulse_check_time * 1000 * 10.0); // Integer percentage 0=>100
- double concentration = (1.1 * pow(ratio,3)) - (3.8 * pow(ratio, 2)) + (520 * ratio) + 0.62; // using spec sheet curve
- data.lowPulseOccupancy = (int)low_pulse_occupancy;
- data.ratio = ratio;
- data.concentration = concentration;
-
- return data;
-}
-
-
-// Mimicking Arduino's pulseIn function
-// return how long it takes a pin to go from HIGH to LOW or LOW to HIGH
-double PPD42NS::pulseIn_polyfill(bool high_low_value, double end_time)
-{
- struct timespec pulseIn_start={0,0};
- struct timespec pulseIn_now={0,0};
- struct timespec pulsetime_start={0,0};
- struct timespec pulsetime_end={0,0};
-
- int pin_val = 5; // some non-zero, non-1 number
- bool started_timing = false;
- bool ended_timing = false;
- clock_gettime(CLOCK_MONOTONIC, &pulseIn_start);
-
- // run through this loop until either:
- // a) we detect a change in pulse
- // b) we've hit 30 seconds
- while (!ended_timing && (m_timediff(pulseIn_start, pulseIn_now) < end_time))
- {
- pin_val = (bool)mraa_gpio_read(m_gpio);
- if (pin_val == high_low_value && !started_timing)
- {
- clock_gettime(CLOCK_MONOTONIC, &pulsetime_start);
- started_timing = true;
- //std::cout << "Started counting pulse change" << std::endl;
- usleep(50);
- }
- else if (started_timing && pin_val != high_low_value)
- {
- clock_gettime(CLOCK_MONOTONIC, &pulsetime_end);
- ended_timing = true;
- //std::cout << "Ended counting pulse change" << (m_timediff(pulseIn_start, pulseIn_now)) << std::endl;
- }
- else
- usleep(50);
- clock_gettime(CLOCK_MONOTONIC, &pulseIn_now);
- }
-
- double low_pulse_occupancy = 0;
-
- // if we ended due to detecting a pulse change and not due to hitting 30 seconds
- if (started_timing && ended_timing)
- low_pulse_occupancy = m_timediff(pulsetime_start, pulsetime_end);
- //std::cout << "Low pulse occupancy is " << low_pulse_occupancy << " seconds" << std::endl;
-
- return (low_pulse_occupancy * 1000000); // convert to microseconds
-}
-
-double PPD42NS::m_timediff(timespec time1, timespec time2)
-{
- return ((double)time2.tv_sec + 1.0e-9*time2.tv_nsec) -
- ((double)time1.tv_sec + 1.0e-9*time1.tv_nsec);
-}
diff --git a/peripheral/libupm/src/ppd42ns/ppd42ns.h b/peripheral/libupm/src/ppd42ns/ppd42ns.h
deleted file mode 100644
index 0c65467..0000000
--- a/peripheral/libupm/src/ppd42ns/ppd42ns.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Author: Zion Orent <sorent@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include <time.h>
-#include <mraa/aio.h>
-
-namespace upm {
-
-typedef struct
-{
- int lowPulseOccupancy;
- double ratio;
- double concentration;
-} dustData;
-
- /**
- * @brief PPD42NS Dust Sensor library
- * @defgroup ppd42ns libupm-ppd42ns
- * @ingroup seeed gpio other eak
- */
- /**
- * @library ppd42ns
- * @sensor ppd42ns
- * @comname PPD42NS Dust Sensor
- * @altname Grove Dust Sensor
- * @type other
- * @man seeed
- * @web http://www.seeedstudio.com/wiki/Grove_-_Dust_Sensor
- * @con gpio
- * @kit eak
- *
- * @brief API for the PPD42NS Dust Sensor
- *
- * UPM module for the PPD42NS dust sensor
- *
- * @image html ppd42ns.jpg
- * @snippet ppd42ns.cxx Interesting
- */
- class PPD42NS {
- public:
- /**
- * PPD42NS constructor
- *
- * @param pin Digital pin to use
- */
- PPD42NS(int pin);
- /**
- * PPD42NS destructor
- */
- ~PPD42NS();
- /**
- * Prints dust concentration
- *
- * @return struct dustData Contains data from the dust sensor
- */
- dustData getData();
-
- private:
- mraa_gpio_context m_gpio;
- /**
- * Returns the amount of time it takes a pin to go from HIGH to LOW or from LOW to HIGH
- *
- * @param highLowValue int Do we measure movements from HIGH to LOW or from LOW to HIGH? highLowValue is the "from" value
- */
- double pulseIn_polyfill(bool highLowValue, double endTime);
- double m_timediff(timespec time1, timespec time2);
- };
-}
-
-
diff --git a/peripheral/libupm/src/ppd42ns/pyupm_ppd42ns.i b/peripheral/libupm/src/ppd42ns/pyupm_ppd42ns.i
deleted file mode 100644
index 38fab6d..0000000
--- a/peripheral/libupm/src/ppd42ns/pyupm_ppd42ns.i
+++ /dev/null
@@ -1,11 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_ppd42ns
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "ppd42ns.h"
-%{
- #include "ppd42ns.h"
-%}
diff --git a/peripheral/libupm/src/pulsensor/CMakeLists.txt b/peripheral/libupm/src/pulsensor/CMakeLists.txt
deleted file mode 100644
index 223c642..0000000
--- a/peripheral/libupm/src/pulsensor/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "pulsensor")
-set (libdescription "upm PULSENSOR")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/pulsensor/Callback.h b/peripheral/libupm/src/pulsensor/Callback.h
deleted file mode 100644
index f9c291a..0000000
--- a/peripheral/libupm/src/pulsensor/Callback.h
+++ /dev/null
@@ -1,15 +0,0 @@
-#pragma once
-
-#if defined(SWIGJAVA) || defined(JAVACALLBACK)
-class Callback
-{
- public:
- virtual ~Callback()
- {
- }
- virtual void run(clbk_data arg)
- { /* empty, overloaded in Java*/
- }
-};
-
-#endif
diff --git a/peripheral/libupm/src/pulsensor/javaupm_pulsensor.i b/peripheral/libupm/src/pulsensor/javaupm_pulsensor.i
deleted file mode 100644
index 91b34cc..0000000
--- a/peripheral/libupm/src/pulsensor/javaupm_pulsensor.i
+++ /dev/null
@@ -1,29 +0,0 @@
-%module(directors="1") javaupm_pulsensor
-%include "../upm.i"
-%include "arrays_java.i"
-
-%feature("director") Callback;
-SWIG_DIRECTOR_OWNED(Callback)
-
-%ignore sample_thread;
-%ignore pin_ctx;
-%ignore do_sample;
-%ignore callback;
-
-%include "Callback.h"
-%{
- #include "pulsensor.h"
-%}
-
-%include "pulsensor.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_pulsensor");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/pulsensor/jsupm_pulsensor.i b/peripheral/libupm/src/pulsensor/jsupm_pulsensor.i
deleted file mode 100644
index d92312a..0000000
--- a/peripheral/libupm/src/pulsensor/jsupm_pulsensor.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_pulsensor
-%include "../upm.i"
-
-%{
- #include "pulsensor.h"
-%}
-
-%include "pulsensor.h"
diff --git a/peripheral/libupm/src/pulsensor/pulsensor.cxx b/peripheral/libupm/src/pulsensor/pulsensor.cxx
deleted file mode 100644
index 73d9a09..0000000
--- a/peripheral/libupm/src/pulsensor/pulsensor.cxx
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * Author: Andrei Vasiliu <andrei.vasiliu@intel.com>
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@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 <string>
-#include <stdexcept>
-#include <unistd.h>
-#include <stdlib.h>
-
-#include "pulsensor.h"
-
-using namespace upm;
-
-#if defined(JAVACALLBACK)
-Pulsensor::Pulsensor (Callback *obj_call) : pin_ctx(0)
-{
- obj_callback = obj_call;
-
- sample_counter = 0;
- last_beat_time = 0;
- threshold = 512;
- ibi = 600;
- trough = 512;
- peak = 512;
- is_pulse = FALSE;
- ret = FALSE;
- bpm = 0;
- qs = FALSE;
- apmlitude = 100;
-}
-#else
-Pulsensor::Pulsensor (callback_handler handler) : pin_ctx(0)
-{
- callback = handler;
-
- sample_counter = 0;
- last_beat_time = 0;
- threshold = 512;
- ibi = 600;
- trough = 512;
- peak = 512;
- is_pulse = FALSE;
- ret = FALSE;
- bpm = 0;
- qs = FALSE;
- apmlitude = 100;
-}
-#endif
-
-void Pulsensor::start_sampler ()
-{
- int error;
- ctx_counter++;
- usleep (100000);
- error = pthread_create (&(sample_thread), NULL, &Pulsensor::do_sample, this);
- if (error != 0) {
- printf ("ERROR : Cannot created sampler thread.\n");
- }
-}
-
-void Pulsensor::stop_sampler () {
- ctx_counter--;
-}
-
-void *Pulsensor::do_sample (void *arg) {
- int data_from_sensor;
- clbk_data callback_data;
-
- Pulsensor *pulsensor = static_cast<Pulsensor *>(arg);
-
- while (pulsensor->ctx_counter) {
- data_from_sensor = pulsensor->pin_ctx.read ();
- pulsensor->ret = FALSE;
-
- pulsensor->sample_counter += 2;
- int N = pulsensor->sample_counter - pulsensor->last_beat_time;
-
- if (data_from_sensor < pulsensor->threshold &&
- N > ( pulsensor->ibi / 5)* 3) {
- if (data_from_sensor < pulsensor->trough) {
- pulsensor->trough = data_from_sensor;
- }
- }
-
- if (data_from_sensor > pulsensor->threshold &&
- data_from_sensor > pulsensor->peak) {
- pulsensor->peak = data_from_sensor;
- }
-
- if (N > 250) {
- // printf ("(NO_GDB) DEBUG\n");
- if ( (data_from_sensor > pulsensor->threshold) &&
- (pulsensor->is_pulse == FALSE) &&
- (N > (pulsensor->ibi / 5)* 3) ) {
- pulsensor->is_pulse = callback_data.is_heart_beat = TRUE;
-#if defined(JAVACALLBACK)
- pulsensor->obj_callback->run(callback_data);
-#else
- pulsensor->callback(callback_data);
-#endif
-
- pulsensor->ibi = pulsensor->sample_counter - pulsensor->last_beat_time;
- pulsensor->last_beat_time = pulsensor->sample_counter;
-
- // second beat
- if (pulsensor->second_beat) {
- pulsensor->second_beat = FALSE;
- for (int i = 0; i <= 9; i++) {
- pulsensor->ibi_rate[i] = pulsensor->ibi;
- }
- }
-
- // first beat
- if (pulsensor->first_beat) {
- pulsensor->first_beat = FALSE;
- pulsensor->second_beat = TRUE;
- pulsensor->ret = TRUE;
- } else {
- uint32_t running_total = 0;
- for(int i = 0; i <= 8; i++){
- pulsensor->ibi_rate[i] = pulsensor->ibi_rate[i+1];
- running_total += pulsensor->ibi_rate[i];
- }
-
- pulsensor->ibi_rate[9] = pulsensor->ibi;
- running_total += pulsensor->ibi_rate[9];
- running_total /= 10;
- pulsensor->bpm = 60000 / running_total;
- pulsensor->qs = TRUE;
- }
- }
- }
-
- if (pulsensor->ret == FALSE) {
- if (data_from_sensor < pulsensor->threshold &&
- pulsensor->is_pulse == TRUE) {
- pulsensor->is_pulse = callback_data.is_heart_beat = FALSE;
-#if defined(JAVACALLBACK)
- pulsensor->obj_callback->run(callback_data);
-#else
- pulsensor->callback(callback_data);
-#endif
- pulsensor->is_pulse = FALSE;
- pulsensor->apmlitude = pulsensor->peak - pulsensor->trough;
- pulsensor->threshold = pulsensor->apmlitude / 2 + pulsensor->trough;
- pulsensor->peak = pulsensor->threshold;
- pulsensor->trough = pulsensor->threshold;
- }
-
- if (N > 2500) {
- pulsensor->threshold = 512;
- pulsensor->peak = 512;
- pulsensor->trough = 512;
- pulsensor->last_beat_time = pulsensor->sample_counter;
- pulsensor->first_beat = TRUE;
- pulsensor->second_beat = FALSE;
- }
- }
-
- usleep (2000);
- }
- return NULL;
-}
diff --git a/peripheral/libupm/src/pulsensor/pulsensor.h b/peripheral/libupm/src/pulsensor/pulsensor.h
deleted file mode 100644
index 8c9866d..0000000
--- a/peripheral/libupm/src/pulsensor/pulsensor.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Author: Andrei Vasiliu <andrei.vasiliu@intel.com>
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Credits to Adafruit.
- * Based on Adafruit BMP085 library.
- *
- * 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 <string>
-#include <math.h>
-#include <mraa/pwm.hpp>
-#include <mraa/aio.hpp>
-#include <mraa/gpio.hpp>
-#include <pthread.h>
-
-#define HIGH 1
-#define LOW 0
-
-#define TRUE HIGH
-#define FALSE LOW
-
-/**
- * Callback data struct
- */
-struct clbk_data {
- int is_heart_beat; /**< heartbeat check */
-};
-
-#if defined(SWIGJAVA) || defined(JAVACALLBACK)
-#include "Callback.h"
-#else
-typedef void (* callback_handler) (clbk_data);
-#endif
-
-namespace upm {
-/**
- * @brief Pulsensor Pulse Sensor library
- * @defgroup pulsensor libupm-pulsensor
- * @ingroup seeed analog medical
- */
-/**
- * @library pulsensor
- * @sensor pulsensor
- * @comname Pulse Sensor
- * @type medical
- * @man seeed
- * @web http://www.adafruit.com/products/1093
- * @con analog
- *
- * @brief C++ API for the 3-Wire Pulse Sensor
- *
- * This is a library for a 3-wire pulse sensor sold by several manufacturers.
- * Usually, you can identify the sensor based on the round breakout and the
- * distinctive heart symbol.
- *
- * @image html pulsensor.jpg
- * @snippet pulsensor.cxx Interesting
- */
-class Pulsensor {
-
-public:
-#if defined(SWIGJAVA) || defined(JAVACALLBACK)
- Pulsensor(Callback *callback);
-#else
- Pulsensor(callback_handler handler);
-#endif
- void start_sampler();
- void stop_sampler();
-
-private:
- static void *do_sample(void *arg);
- pthread_t sample_thread; /**< Thread for the code sample */
- uint32_t sample_counter; /**< Counter for the code sample */
- uint32_t last_beat_time; /**< Last heartbeat time */
- int threshold; /**< Threshold */
- int ibi_rate[10]; /**< ibi rate */
- int ibi; /**< ibi */
- int trough; /**< Trough */
- int peak; /**< Peak */
- int bpm; /**< Bits per minute */
- int apmlitude; /**< Amplitude */
- uint8_t qs; /**< qs */
- uint8_t is_pulse; /**< Is pulse check */
- uint8_t first_beat; /**< First heartbeat */
- uint8_t second_beat; /**< Second heartbeat */
- uint8_t pin; /**< Pin */
- uint8_t ret; /**< Return value */
- mraa::Aio pin_ctx; /**< The pin context */
-#if defined(SWIGJAVA) || defined(JAVACALLBACK)
- Callback *obj_callback; /**< The callback object */
-#else
- callback_handler callback; /**< The callback function */
-#endif
- volatile uint16_t ctx_counter;
-};
-}
diff --git a/peripheral/libupm/src/pulsensor/pyupm_pulsensor.i b/peripheral/libupm/src/pulsensor/pyupm_pulsensor.i
deleted file mode 100644
index 7d470cf..0000000
--- a/peripheral/libupm/src/pulsensor/pyupm_pulsensor.i
+++ /dev/null
@@ -1,13 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_pulsensor
-%include "../upm.i"
-
-%include "stdint.i"
-
-%feature("autodoc", "3");
-
-%include "pulsensor.h"
-%{
- #include "pulsensor.h"
-%}
diff --git a/peripheral/libupm/src/pythonswig_blacklist b/peripheral/libupm/src/pythonswig_blacklist
deleted file mode 100644
index e69de29..0000000
--- a/peripheral/libupm/src/pythonswig_blacklist
+++ /dev/null
diff --git a/peripheral/libupm/src/rfr359f/CMakeLists.txt b/peripheral/libupm/src/rfr359f/CMakeLists.txt
deleted file mode 100644
index 94cb79d..0000000
--- a/peripheral/libupm/src/rfr359f/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "rfr359f")
-set (libdescription "upm rfr359f grove distance interrupter")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/rfr359f/javaupm_rfr359f.i b/peripheral/libupm/src/rfr359f/javaupm_rfr359f.i
deleted file mode 100644
index ebd528f..0000000
--- a/peripheral/libupm/src/rfr359f/javaupm_rfr359f.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_rfr359f
-%include "../upm.i"
-
-%{
- #include "rfr359f.h"
-%}
-
-%include "rfr359f.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_rfr359f");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/rfr359f/jsupm_rfr359f.i b/peripheral/libupm/src/rfr359f/jsupm_rfr359f.i
deleted file mode 100644
index be5748f..0000000
--- a/peripheral/libupm/src/rfr359f/jsupm_rfr359f.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_rfr359f
-%include "../upm.i"
-
-%{
- #include "rfr359f.h"
-%}
-
-%include "rfr359f.h"
diff --git a/peripheral/libupm/src/rfr359f/pyupm_rfr359f.i b/peripheral/libupm/src/rfr359f/pyupm_rfr359f.i
deleted file mode 100644
index eacc68a..0000000
--- a/peripheral/libupm/src/rfr359f/pyupm_rfr359f.i
+++ /dev/null
@@ -1,11 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_rfr359f
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "rfr359f.h"
-%{
- #include "rfr359f.h"
-%}
diff --git a/peripheral/libupm/src/rfr359f/rfr359f.cxx b/peripheral/libupm/src/rfr359f/rfr359f.cxx
deleted file mode 100644
index 96dfc22..0000000
--- a/peripheral/libupm/src/rfr359f/rfr359f.cxx
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <string>
-#include <stdexcept>
-
-#include "rfr359f.h"
-
-using namespace upm;
-using namespace std;
-
-RFR359F::RFR359F(int pin)
-{
- if ( !(m_gpio = mraa_gpio_init(pin)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_gpio_init() failed, invalid pin?");
- return;
- }
-
- mraa_gpio_dir(m_gpio, MRAA_GPIO_IN);
-}
-
-RFR359F::~RFR359F()
-{
- mraa_gpio_close(m_gpio);
-}
-
-bool RFR359F::objectDetected()
-{
- return (!mraa_gpio_read(m_gpio) ? true : false);
-}
diff --git a/peripheral/libupm/src/rfr359f/rfr359f.h b/peripheral/libupm/src/rfr359f/rfr359f.h
deleted file mode 100644
index 862574b..0000000
--- a/peripheral/libupm/src/rfr359f/rfr359f.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include <mraa/gpio.h>
-
-namespace upm {
-
- /**
- * @brief RFR359 Distance Interrupter library
- * @defgroup rfr359f libupm-rfr359f
- * @ingroup seeed gpio light robok tsk
- */
- /**
- * @library rfr359f
- * @sensor rfr359f
- * @comname RFR359F Distance Interrupter
- * @altname Grove Distance Interrupter
- * @type light
- * @man seeed
- * @web http://www.seeedstudio.com/wiki/Grove_-_IR_Distance_Interrupt
- * @con gpio
- * @kit robok tsk
- *
- * @brief API for the RFR359F-based Grove Distance Interrupter.
- *
- * UPM module for the Grove distance interrupter. The sensitivity
- * can be adjusted with the potentiometer on the sensor module. It
- * has a range of approximately 4 inches and a quick response time.
- *
- * @image html rfr359f.jpg
- * @snippet rfr359f.cxx Interesting
- */
- class RFR359F {
- public:
- /**
- * RFR359F constructor
- *
- * @param pin Digital pin to use
- */
- RFR359F(int pin);
-
- /**
- * RFR359F destructor
- */
- ~RFR359F();
-
- /**
- * Gets the status of the pin; true means an object has been detected
- *
- * @return True if the sensor has detected an object
- */
- bool objectDetected();
-
- private:
- mraa_gpio_context m_gpio;
- };
-}
-
-
diff --git a/peripheral/libupm/src/rgbringcoder/CMakeLists.txt b/peripheral/libupm/src/rgbringcoder/CMakeLists.txt
deleted file mode 100644
index 86d6ee4..0000000
--- a/peripheral/libupm/src/rgbringcoder/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "rgbringcoder")
-set (libdescription "upm Sparkfun RGB RingCoder")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/rgbringcoder/javaupm_rgbringcoder.i b/peripheral/libupm/src/rgbringcoder/javaupm_rgbringcoder.i
deleted file mode 100644
index 2e67125..0000000
--- a/peripheral/libupm/src/rgbringcoder/javaupm_rgbringcoder.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_rgbringcoder
-%include "../upm.i"
-
-%{
- #include "rgbringcoder.h"
-%}
-
-%include "rgbringcoder.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_rgbringcoder");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/rgbringcoder/jsupm_rgbringcoder.i b/peripheral/libupm/src/rgbringcoder/jsupm_rgbringcoder.i
deleted file mode 100644
index 8f4f5f8..0000000
--- a/peripheral/libupm/src/rgbringcoder/jsupm_rgbringcoder.i
+++ /dev/null
@@ -1,9 +0,0 @@
-%module jsupm_rgbringcoder
-%include "../upm.i"
-%include "stdint.i"
-
-%{
- #include "rgbringcoder.h"
-%}
-
-%include "rgbringcoder.h"
diff --git a/peripheral/libupm/src/rgbringcoder/pyupm_rgbringcoder.i b/peripheral/libupm/src/rgbringcoder/pyupm_rgbringcoder.i
deleted file mode 100644
index 7f7afff..0000000
--- a/peripheral/libupm/src/rgbringcoder/pyupm_rgbringcoder.i
+++ /dev/null
@@ -1,11 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_rgbringcoder
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "rgbringcoder.h"
-%{
- #include "rgbringcoder.h"
-%}
diff --git a/peripheral/libupm/src/rgbringcoder/rgbringcoder.cxx b/peripheral/libupm/src/rgbringcoder/rgbringcoder.cxx
deleted file mode 100644
index 6716f81..0000000
--- a/peripheral/libupm/src/rgbringcoder/rgbringcoder.cxx
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-
-#ifdef JAVACALLBACK
-#undef JAVACALLBACK
-#endif
-#include "rgbringcoder.h"
-
-using namespace std;
-using namespace upm;
-
-RGBRingCoder::RGBRingCoder(int en, int latch, int clear, int clk, int dat,
- int sw, int encA, int encB, int red,
- int green, int blue) :
- m_gpioEn(en), m_gpioLatch(latch), m_gpioClear(clear), m_gpioClock(clk),
- m_gpioData(dat), m_gpioSwitch(sw), m_gpioEncA(encA), m_gpioEncB(encB),
- m_pwmRed(red), m_pwmGreen(green), m_pwmBlue(blue)
-{
- m_counter = 0;
-
- // enable, set LOW
- m_gpioEn.dir(mraa::DIR_OUT);
- m_gpioEn.write(0);
-
- // latch
- m_gpioLatch.dir(mraa::DIR_OUT);
- m_gpioLatch.write(0);
-
- // clear, HIGH
- m_gpioClear.dir(mraa::DIR_OUT);
- m_gpioLatch.write(1);
-
- // clock
- m_gpioClock.dir(mraa::DIR_OUT);
- m_gpioClock.write(0);
-
- // data
- m_gpioData.dir(mraa::DIR_OUT);
- m_gpioData.write(0);
-
- // switch
- m_gpioSwitch.dir(mraa::DIR_IN);
- m_gpioSwitch.mode(mraa::MODE_HIZ); // no pullup
- m_gpioSwitch.write(0);
-
- // ecoder A interrupt
- m_gpioEncA.dir(mraa::DIR_IN);
- m_gpioEncA.mode(mraa::MODE_PULLUP);
- // EDGE_BOTH would be nice...
- m_gpioEncA.isr(mraa::EDGE_RISING, &interruptHandler, this);
-
- // ecoder B interrupt
- m_gpioEncB.dir(mraa::DIR_IN);
- m_gpioEncB.mode(mraa::MODE_PULLUP);
- // EDGE_BOTH would be nice...
- m_gpioEncB.isr(mraa::EDGE_RISING, &interruptHandler, this);
-
- // RGB LED pwms, set to off
-
- // Red led
- m_pwmRed.period_ms(1);
- m_pwmRed.write(0.99);
- m_pwmRed.enable(true);
-
- // Green led
- m_pwmGreen.period_ms(1);
- m_pwmGreen.write(0.99);
- m_pwmGreen.enable(true);
-
- // Blue led
- m_pwmBlue.period_ms(1);
- m_pwmBlue.write(0.99);
- m_pwmBlue.enable(true);
-
- // whew.
-}
-
-RGBRingCoder::~RGBRingCoder()
-{
- m_gpioEncA.isrExit();
- m_gpioEncB.isrExit();
-
- // turn off the ring
- setRingLEDS(0x0000);
-
- // Turn of RGB LEDS
- setRGBLED(0.99, 0.99, 0.99);
- usleep(100000);
-
- // turn off PWM's
- m_pwmRed.enable(false);
- m_pwmGreen.enable(false);
- m_pwmBlue.enable(false);
-}
-
-void RGBRingCoder::interruptHandler(void *ctx)
-{
- upm::RGBRingCoder *This = (upm::RGBRingCoder *)ctx;
-
- // From the Sparkfun guys:
-
- // enc_states[] is a fancy way to keep track of which direction
- // the encoder is turning. 2-bits of oldEncoderState are paired
- // with 2-bits of newEncoderState to create 16 possible values.
- // Each of the 16 values will produce either a CW turn (1),
- // CCW turn (-1) or no movement (0).
-
- static int8_t enc_states[] = {0, -1, 1, 0, 1, 0, 0, -1,
- -1, 0, 0, 1, 0, 1, -1, 0};
- static uint8_t oldEncoderState = 0;
- static uint8_t newEncoderState = 0;
-
- // First, find the newEncoderState. This'll be a 2-bit value
- // the msb is the state of the B pin. The lsb is the state
- // of the A pin on the encoder.
- newEncoderState = (This->m_gpioEncB.read()<<1) |
- (This->m_gpioEncA.read());
-
- // Now we pair oldEncoderState with new encoder state
- // First we need to shift oldEncoder state left two bits.
- // This'll put the last state in bits 2 and 3.
-
- oldEncoderState <<= 2;
-
- // Mask out everything in oldEncoderState except for the previous state
- oldEncoderState &= 0x0c;
-
- // Now add the newEncoderState. oldEncoderState will now be of
- // the form: 0b0000(old B)(old A)(new B)(new A)
- oldEncoderState |= newEncoderState;
-
- // update our counter
- This->m_counter += enc_states[oldEncoderState & 0x0f];
-}
-
-void RGBRingCoder::setRingLEDS(uint16_t bits)
-{
- // First we need to set latch LOW
- m_gpioLatch.write(0);
-
- // Now shift out the bits, msb first
- for (int i=0; i<16; i++)
- {
- m_gpioData.write( ((bits & 0x8000) ? 1 : 0) );
-
- // pulse the clock pin
- m_gpioClock.write(1);
- m_gpioClock.write(0);
-
- bits <<= 1;
- }
-
- // latch it
- m_gpioLatch.write(1);
-}
-
-bool RGBRingCoder::getButtonState()
-{
- return (m_gpioSwitch.read() ? true : false);
-}
-
-void RGBRingCoder::setRGBLED(float r, float g, float b)
-{
- m_pwmRed.write(r);
- m_pwmGreen.write(g);
- m_pwmBlue.write(b);
-}
diff --git a/peripheral/libupm/src/rgbringcoder/rgbringcoder.h b/peripheral/libupm/src/rgbringcoder/rgbringcoder.h
deleted file mode 100644
index 5675c4f..0000000
--- a/peripheral/libupm/src/rgbringcoder/rgbringcoder.h
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <iostream>
-#include <string>
-#include <stdint.h>
-#include <unistd.h>
-
-#include <mraa/gpio.hpp>
-
-#include <mraa/pwm.hpp>
-
-
-namespace upm {
- /**
- * @brief SparkFun RGB RingCoder
- * @defgroup rgbringcoder libupm-rgbringcoder
- * @ingroup seeed gpio led
- */
-
- /**
- * @library rgbringcoder
- * @sensor rgbringcoder
- * @comname SparkFun RGB Ringcoder
- * @type led
- * @web https://www.sparkfun.com/products/11040
- * @man sparkfun
- * @con pwm gpio
- *
- * @brief API for the SparkFun* RGB RingCoder
- *
- * RGB RingCoder is a breakout board, a circular LED containing
- * 16 LEDs arranged in a ring, and a rotary encoder. The encoder
- * contains an RGB LED as well as a push button function.
- *
- * The device requires 11 pins, 3 of which must be PWM-capable
- * (for the RGB LEDs).
- *
- * @image html rgbringcoder.jpg
- * @snippet rgbringcoder.cxx Interesting
- */
-
- class RGBRingCoder {
- public:
-
- /**
- * RGBRingCoder constructor
- *
- * @param en Enables GPIO
- * @param latch Latch GPIO
- * @param clear Clears GPIO
- * @param clk Clock GPIO
- * @param dat Data out GPIO
- * @param sw Push button switch GPIO
- * @param encA Encoder A GPIO
- * @param encB Encoder B GPIO
- * @param red RGB red LED PWM
- * @param green RGB green LED PWM
- * @param blue RGB blue LED PWM
- */
- RGBRingCoder(int en, int latch, int clear, int clk, int dat, int sw,
- int encA, int encB, int red, int green, int blue);
-
- /**
- * RGBRingCoder destructor
- */
- ~RGBRingCoder();
-
- /*
- * Sets the state of the ring LEDs. This is a 16-bit value, where
- * each bit corresponds to one of the ring LEDs. A 1 bit means
- * that a specific LED is on, and a 0 bit means that a specific LED is
- * off.
- *
- * @param bits Bits representing the state of each LED
- */
- void setRingLEDS(uint16_t bits);
-
- /*
- * Returns the state of the button
- *
- * @return True if the button is pressed, false otherwise
- */
- bool getButtonState();
-
- /*
- * Gets the current rotary encoder counter value
- *
- * @return Current counter value
- */
- int getEncoderPosition() { return m_counter; };
-
- /*
- * Sets the encoder counter to 0
- */
- void clearEncoderPosition() { m_counter = 0; };
-
- /*
- * Sets the intensity of the red, green, and blue LEDs. Values can
- * be between 0.0 and 1.0. Lower is brighter, higher is dimmer.
- *
- * @param r Red value; valid values are 0.0-1.0
- * @param g Green value; valid values are 0.0-1.0
- * @param b Blue value; valid values are 0.0-1.0
- */
- void setRGBLED(float r, float g, float b);
-
- private:
-
- mraa::Gpio m_gpioEn;
-
- mraa::Gpio m_gpioLatch;
- mraa::Gpio m_gpioClear;
- mraa::Gpio m_gpioClock;
- mraa::Gpio m_gpioData;
-
- mraa::Gpio m_gpioSwitch;
-
- mraa::Pwm m_pwmRed;
- mraa::Pwm m_pwmGreen;
- mraa::Pwm m_pwmBlue;
-
- mraa::Gpio m_gpioEncA;
- mraa::Gpio m_gpioEncB;
-
- static void interruptHandler(void *ctx);
- volatile int m_counter;
-
- };
-}
-
-
diff --git a/peripheral/libupm/src/rhusb/CMakeLists.txt b/peripheral/libupm/src/rhusb/CMakeLists.txt
deleted file mode 100644
index 64f2aff..0000000
--- a/peripheral/libupm/src/rhusb/CMakeLists.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-set (libname "rhusb")
-set (libdescription "upm module for the Omega RH-USB sensor")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
-
diff --git a/peripheral/libupm/src/rhusb/javaupm_rhusb.i b/peripheral/libupm/src/rhusb/javaupm_rhusb.i
deleted file mode 100644
index e72f423..0000000
--- a/peripheral/libupm/src/rhusb/javaupm_rhusb.i
+++ /dev/null
@@ -1,23 +0,0 @@
-%module javaupm_rhusb
-%include "../upm.i"
-%include "typemaps.i"
-%include "cpointer.i"
-%include "arrays_java.i";
-%include "../java_buffer.i"
-
-%{
- #include "rhusb.h"
-%}
-
-%include "rhusb.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_rhusb");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%}
diff --git a/peripheral/libupm/src/rhusb/jsupm_rhusb.i b/peripheral/libupm/src/rhusb/jsupm_rhusb.i
deleted file mode 100644
index 3786cb7..0000000
--- a/peripheral/libupm/src/rhusb/jsupm_rhusb.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_rhusb
-%include "../upm.i"
-%include "stdint.i"
-
-%include "rhusb.h"
-%{
- #include "rhusb.h"
-%}
diff --git a/peripheral/libupm/src/rhusb/pyupm_rhusb.i b/peripheral/libupm/src/rhusb/pyupm_rhusb.i
deleted file mode 100644
index 83322af..0000000
--- a/peripheral/libupm/src/rhusb/pyupm_rhusb.i
+++ /dev/null
@@ -1,12 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_rhusb
-%include "../upm.i"
-%include "stdint.i"
-
-%feature("autodoc", "3");
-
-%include "rhusb.h"
-%{
- #include "rhusb.h"
-%}
diff --git a/peripheral/libupm/src/rhusb/rhusb.cxx b/peripheral/libupm/src/rhusb/rhusb.cxx
deleted file mode 100644
index 6b6b88c..0000000
--- a/peripheral/libupm/src/rhusb/rhusb.cxx
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2016 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <stdlib.h>
-#include <iostream>
-#include <stdexcept>
-#include <string>
-
-#include "rhusb.h"
-
-using namespace upm;
-using namespace std;
-
-static const int maxBuffer = 1024;
-// baud rate is always 9600
-static const int baudRate = 9600;
-
-// conversion from celcius to fahrenheit
-
-static float c2f(float c)
-{
- return (c * (9.0 / 5.0) + 32.0);
-}
-
-RHUSB::RHUSB(std::string device) :
- m_uart(device)
-{
- m_uart.setBaudRate(baudRate);
-
- m_temperature = 0.0;
- m_humidity = 0.0;
-}
-
-RHUSB::~RHUSB()
-{
-}
-
-void RHUSB::update()
-{
- char *endptr;
- float value;
-
- // first get the temp in C
- string resp = sendCommand("C");
-
- // convert
- value = strtof(resp.c_str(), &endptr);
-
- // check for conversion failure
- if (value == 0.0 && resp.c_str() == endptr)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": strtof() temperature conversion failed");
- }
- m_temperature = value;
-
- // now humidity
- resp = sendCommand("H");
-
- // convert
- value = strtof(resp.c_str(), &endptr);
-
- // check for conversion failure
- if (value == 0.0 && resp.c_str() == endptr)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": strtof() humidity conversion failed");
- }
- m_humidity = value;
-}
-
-float RHUSB::getTemperature(bool fahrenheit)
-{
- if (fahrenheit)
- return c2f(m_temperature);
- else
- return m_temperature;
-}
-
-float RHUSB::getHumidity()
-{
- return m_humidity;
-}
-
-bool RHUSB::dataAvailable(unsigned int millis)
-{
- return m_uart.dataAvailable(millis);
-}
-
-string RHUSB::readStr(int len)
-{
- return m_uart.readStr(len);
-}
-
-int RHUSB::writeStr(string data)
-{
- m_uart.flush();
- return m_uart.writeStr(data);
-}
-
-string RHUSB::sendCommand(string cmd)
-{
- // make sure we got a command
- if (cmd.empty())
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": cmd is empty!");
- return "";
- }
-
- // make sure string is CR terminated
- if (cmd.at(cmd.size() - 1) != '\r')
- cmd.append("\r");
-
- writeStr(cmd);
-
- string resp;
- // I see random timeouts with wait values below 250ms
- while (dataAvailable(250))
- {
- resp += readStr(maxBuffer);
- }
-
- if (resp.empty())
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": timed out waiting for response");
- return "";
- }
-
- // check that the last character is the prompt
- if (resp.at(resp.size() - 1) != '>')
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": read from device corrupted");
- return "";
- }
-
- // delete the last 3 characters, which should be '\r\n>'
- resp.erase(resp.size() - 3, 3);
-
- return resp;
-}
-
-string RHUSB::getFirmwareID()
-{
- string resp = sendCommand("ENQ");
-
- // For readability, replace the intermediate \r\n with a space if found.
-
- size_t pos = resp.find("\r\n");
-
- if (pos != string::npos)
- resp.replace(pos, 2, " ");
-
- return resp;
-}
diff --git a/peripheral/libupm/src/rhusb/rhusb.h b/peripheral/libupm/src/rhusb/rhusb.h
deleted file mode 100644
index 4fd4548..0000000
--- a/peripheral/libupm/src/rhusb/rhusb.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2016 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include <mraa/uart.hpp>
-
-namespace upm {
-
- /**
- * @brief Omega RH-USB Temperature and Humidity Sensor
- * @defgroup rhusb libupm-rhusb
- * @ingroup uart temp
- */
-
- /**
- * @library rhusb
- * @sensor rhusb
- * @comname UPM API for the Omega RH-USB Temperature and Humidity Sensor
- * @type temp
- * @man omega
- * @con uart
- * @web http://www.omega.com/pptst/RH-USB.html
- *
- * @brief UPM API for the Omega RH-USB Temperature and Humidity Sensor
- *
- * This module implements support for the Omega RH-USB Temperature
- * and Humidity Sensor Probe. It connects via an integrated USB
- * cable, and is accessed via a serial port. It is suitable for
- * wall or duct mounting.
- *
- * @snippet rhusb.cxx Interesting
- */
-
- class RHUSB {
- public:
- /**
- * RHUSB constructor
- *
- * @param device Path to the serial device
- */
- RHUSB(std::string device);
-
- /**
- * RHUSB Destructor
- */
- ~RHUSB();
-
- /**
- * Read current values from the sensor and update internal stored
- * values. This method must be called prior to querying any
- * values, such as temperature or humidity.
- */
- void update();
-
- /**
- * Get the current temperature. update() must have been called
- * prior to calling this method.
- *
- * @param fahrenheit true to return the temperature in degrees
- * fahrenheit, false to return the temperature in degrees celcius.
- * The default is false (degrees Celcius).
- * @return The last temperature reading in Celcius or Fahrenheit
- */
- float getTemperature(bool fahrenheit=false);
-
- /**
- * Get the current relative humidity. update() must have been called
- * prior to calling this method.
- *
- * @return The last humidity reading
- */
- float getHumidity();
-
- /**
- * Get the firmware identification string.
- *
- * @return The firmware identification
- */
- std::string getFirmwareID();
-
-
- protected:
- // serial i/o support
- bool dataAvailable(unsigned int millis);
- int writeStr(std::string data);
- std::string readStr(int len);
- std::string sendCommand(std::string cmd);
-
- mraa::Uart m_uart;
-
- private:
- // data
- float m_temperature;
- float m_humidity;
- };
-}
diff --git a/peripheral/libupm/src/rotaryencoder/CMakeLists.txt b/peripheral/libupm/src/rotaryencoder/CMakeLists.txt
deleted file mode 100644
index 56b8f57..0000000
--- a/peripheral/libupm/src/rotaryencoder/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "rotaryencoder")
-set (libdescription "upm grove rotary encoder module")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/rotaryencoder/javaupm_rotaryencoder.i b/peripheral/libupm/src/rotaryencoder/javaupm_rotaryencoder.i
deleted file mode 100644
index af10c23..0000000
--- a/peripheral/libupm/src/rotaryencoder/javaupm_rotaryencoder.i
+++ /dev/null
@@ -1,21 +0,0 @@
-%module javaupm_rotaryencoder
-%include "../upm.i"
-
-%ignore signalAISR;
-
-%{
- #include "rotaryencoder.h"
-%}
-
-%include "rotaryencoder.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_rotaryencoder");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/rotaryencoder/jsupm_rotaryencoder.i b/peripheral/libupm/src/rotaryencoder/jsupm_rotaryencoder.i
deleted file mode 100644
index 13fd7b8..0000000
--- a/peripheral/libupm/src/rotaryencoder/jsupm_rotaryencoder.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_rotaryencoder
-%include "../upm.i"
-
-%{
- #include "rotaryencoder.h"
-%}
-
-%include "rotaryencoder.h"
diff --git a/peripheral/libupm/src/rotaryencoder/pyupm_rotaryencoder.i b/peripheral/libupm/src/rotaryencoder/pyupm_rotaryencoder.i
deleted file mode 100644
index ea27bc3..0000000
--- a/peripheral/libupm/src/rotaryencoder/pyupm_rotaryencoder.i
+++ /dev/null
@@ -1,11 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_rotaryencoder
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "rotaryencoder.h"
-%{
- #include "rotaryencoder.h"
-%}
diff --git a/peripheral/libupm/src/rotaryencoder/rotaryencoder.cxx b/peripheral/libupm/src/rotaryencoder/rotaryencoder.cxx
deleted file mode 100644
index 15b7b5d..0000000
--- a/peripheral/libupm/src/rotaryencoder/rotaryencoder.cxx
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <string>
-#include <stdexcept>
-
-#include "rotaryencoder.h"
-
-using namespace upm;
-using namespace std;
-
-RotaryEncoder::RotaryEncoder(int pinA, int pinB)
-{
- if ( !(m_gpioA = mraa_gpio_init(pinA)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_gpio_init(pinA) failed, invalid pin?");
- return;
- }
-
- mraa_gpio_dir(m_gpioA, MRAA_GPIO_IN);
-
- if ( !(m_gpioB = mraa_gpio_init(pinB)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_gpio_init(pinB) failed, invalid pin?");
- return;
- }
-
- mraa_gpio_dir(m_gpioB, MRAA_GPIO_IN);
-
- m_position = 0;
-
- // setup the ISR
-
- // We would prefer to use MRAA_GPIO_EDGE_BOTH for better resolution,
- // but that does not appear to be supported
- mraa_gpio_isr(m_gpioA, MRAA_GPIO_EDGE_RISING,
- &signalAISR, this);
-}
-
-RotaryEncoder::~RotaryEncoder()
-{
- mraa_gpio_isr_exit(m_gpioA);
-
- mraa_gpio_close(m_gpioA);
- mraa_gpio_close(m_gpioB);
-}
-
-void RotaryEncoder::initPosition(int count)
-{
- m_position = count;
-}
-
-int RotaryEncoder::position()
-{
- return m_position;
-}
-
-void RotaryEncoder::signalAISR(void *ctx)
-{
- upm::RotaryEncoder *This = (upm::RotaryEncoder *)ctx;
-
- if (mraa_gpio_read(This->m_gpioA))
- {
- if (mraa_gpio_read(This->m_gpioB))
- This->m_position++; // CW
- else
- This->m_position--; // CCW
- }
-}
-
-
diff --git a/peripheral/libupm/src/rotaryencoder/rotaryencoder.h b/peripheral/libupm/src/rotaryencoder/rotaryencoder.h
deleted file mode 100644
index 2cf6bff..0000000
--- a/peripheral/libupm/src/rotaryencoder/rotaryencoder.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include <stdint.h>
-#include <sys/time.h>
-#include <mraa/gpio.h>
-
-namespace upm {
-
-/**
- * @brief Grove Rotary Encoder library
- * @defgroup rotaryencoder libupm-rotaryencoder
- * @ingroup seeed gpio other hak
- */
-/**
- * @library rotaryencoder
- * @sensor rotaryencoder
- * @comname Grove Rotary Encoder
- * @type other
- * @man seeed
- * @web http://www.seeedstudio.com/wiki/Grove_-_Encoder
- * @con gpio
- * @kit hak
- *
- * @brief API for the Grove Rotary Encoder
- *
- * UPM module for the Grove rotary encoder. This rotary encoder
- * encodes a rotation signal into electronic pulses that can be used
- * to measure rotation and direction. It is useful in cases where a
- * rotary knob is required, but using a potentiometer is not
- * desirable. A rotary encoder can turn a full 360 degrees
- * without a stop and does not place a resistive load on the
- * circuit, as is the case with a potentiometer.
- *
- * This module maintains a position that is incremented or
- * decremented according to the rotation on the encoder.
- *
- * @image html rotaryencoder.jpg
- * @snippet rotaryencoder.cxx Interesting
- */
- class RotaryEncoder {
- public:
- /**
- * RotaryEncoder constructor
- *
- * @param pinA Digital pin to use for signal A
- * @param pinB Digital pin to use for signal B
- */
- RotaryEncoder(int pinA, int pinB);
- /**
- * RotaryEncoder destructor
- */
- ~RotaryEncoder();
-
- /**
- * Resets the position to a given number; default is 0.
- *
- * @param count Integer to initialize the position to
- */
- void initPosition(int count=0);
-
- /**
- * Gets the position value
- *
- */
- int position();
-
- private:
- /**
- * Interrupt service routine (ISR) for signal A
- *
- * @param ctx User context for the ISR (*this pointer)
- */
- static void signalAISR(void *ctx);
-
- volatile int m_position;
- mraa_gpio_context m_gpioA;
- mraa_gpio_context m_gpioB;
- };
-}
-
-
diff --git a/peripheral/libupm/src/rpr220/CMakeLists.txt b/peripheral/libupm/src/rpr220/CMakeLists.txt
deleted file mode 100644
index 2a88bf0..0000000
--- a/peripheral/libupm/src/rpr220/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "rpr220")
-set (libdescription "upm rpr220 grove IR reflective sensor")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/rpr220/javaupm_rpr220.i b/peripheral/libupm/src/rpr220/javaupm_rpr220.i
deleted file mode 100644
index fd466d8..0000000
--- a/peripheral/libupm/src/rpr220/javaupm_rpr220.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_rpr220
-%include "../upm.i"
-
-
-%{
- #include "rpr220.h"
-%}
-%include "rpr220.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_rpr220");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%}
diff --git a/peripheral/libupm/src/rpr220/jsupm_rpr220.i b/peripheral/libupm/src/rpr220/jsupm_rpr220.i
deleted file mode 100644
index 75706ae..0000000
--- a/peripheral/libupm/src/rpr220/jsupm_rpr220.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_rpr220
-%include "../upm.i"
-
-%{
- #include "rpr220.h"
-%}
-
-%include "rpr220.h"
diff --git a/peripheral/libupm/src/rpr220/pyupm_rpr220.i b/peripheral/libupm/src/rpr220/pyupm_rpr220.i
deleted file mode 100644
index 2f356ca..0000000
--- a/peripheral/libupm/src/rpr220/pyupm_rpr220.i
+++ /dev/null
@@ -1,11 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_rpr220
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "rpr220.h"
-%{
- #include "rpr220.h"
-%}
diff --git a/peripheral/libupm/src/rpr220/rpr220.cxx b/peripheral/libupm/src/rpr220/rpr220.cxx
deleted file mode 100644
index 8068eaa..0000000
--- a/peripheral/libupm/src/rpr220/rpr220.cxx
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <string>
-#include <stdexcept>
-
-#include "rpr220.h"
-
-using namespace upm;
-using namespace std;
-
-RPR220::RPR220(int pin)
-{
- m_isrInstalled = false;
-
- if ( !(m_gpio = mraa_gpio_init(pin)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_gpio_init() failed, invalid pin?");
- return;
- }
-
- mraa_gpio_dir(m_gpio, MRAA_GPIO_IN);
-}
-
-RPR220::~RPR220()
-{
- if (m_isrInstalled)
- uninstallISR();
-
- mraa_gpio_close(m_gpio);
-}
-
-bool RPR220::blackDetected()
-{
- return (mraa_gpio_read(m_gpio) ? true : false);
-}
-
-#ifdef JAVACALLBACK
-void RPR220::installISR(jobject runnable)
-{
- installISR(mraa_java_isr_callback, runnable);
-}
-#endif
-
-void RPR220::installISR(void (*isr)(void *), void *arg)
-{
- if (m_isrInstalled)
- uninstallISR();
-
- // install our interrupt handler
- mraa_gpio_isr(m_gpio, MRAA_GPIO_EDGE_RISING,
- isr, arg);
- m_isrInstalled = true;
-}
-
-void RPR220::uninstallISR()
-{
- mraa_gpio_isr_exit(m_gpio);
- m_isrInstalled = false;
-}
-
diff --git a/peripheral/libupm/src/rpr220/rpr220.h b/peripheral/libupm/src/rpr220/rpr220.h
deleted file mode 100644
index c9db2e9..0000000
--- a/peripheral/libupm/src/rpr220/rpr220.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include <mraa/gpio.h>
-
-namespace upm {
-
-/**
- * @brief RPR220 IR Reflective Sensor library
- * @defgroup rpr220 libupm-rpr220
- * @ingroup seeed gpio light tsk hak
- */
-/**
- * @library rpr220
- * @sensor rpr220
- * @comname RPR220 IR Reflective Sensor
- * @altname Grove IR Reflective Sensor
- * @type light
- * @man seeed
- * @web http://www.seeedstudio.com/wiki/Grove_-_Infrared_Reflective_Sensor
- * @con gpio
- * @kit tsk hak
- *
- * @brief API for the RPR220-based Grove IR Reflective Sensor
- *
- * UPM module for the Grove IR reflective sensor. The sensitivity
- * can be adjusted with the potentiometer on the sensor module. It
- * has a range of approximately 15 mm, and a quick response time.
- *
- * It detects high-contrast dark areas on a light background.
- *
- * This module allows the user to determine the current status
- * (black detected or not). Additionally, if desired, an interrupt
- * service routine (ISR) can be installed that is called when
- * black is detected. Either method can be used, depending on your
- * use case.
- *
- * @image html rpr220.jpg
- * @snippet rpr220.cxx Interesting
- * @snippet rpr220-intr.cxx Interesting
- */
- class RPR220 {
- public:
- /**
- * RPR220 constructor
- *
- * @param pin Digital pin to use
- */
- RPR220(int pin);
-
- /**
- * RPR220 destructor
- */
- ~RPR220();
-
- /**
- * Gets the status of the pin; true means black has been detected
- *
- * @return True if the sensor has detected black
- */
- bool blackDetected();
-
-#if defined(SWIGJAVA) || defined(JAVACALLBACK)
- void installISR(jobject runnable);
-#else
- /**
- * Installs an ISR to be called when
- * black is detected
- *
- * @param fptr Pointer to a function to be called on interrupt
- * @param arg Pointer to an object to be supplied as an
- * argument to the ISR.
- */
- void installISR(void (*isr)(void *), void *arg);
-#endif
-
- /**
- * Uninstalls the previously installed ISR
- *
- */
- void uninstallISR();
-
- private:
-#if defined(SWIGJAVA) || defined(JAVACALLBACK)
- void installISR(void (*isr)(void *), void *arg);
-#endif
- bool m_isrInstalled;
- mraa_gpio_context m_gpio;
- };
-}
-
-
diff --git a/peripheral/libupm/src/servo/CMakeLists.txt b/peripheral/libupm/src/servo/CMakeLists.txt
deleted file mode 100644
index 923c09c..0000000
--- a/peripheral/libupm/src/servo/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "servo")
-set (libdescription "upm servo")
-set (module_src servo.cxx es08a.cxx es9257.cxx)
-set (module_h servo.h es08a.h es9257.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/servo/es08a.cxx b/peripheral/libupm/src/servo/es08a.cxx
deleted file mode 100644
index b7d72d3..0000000
--- a/peripheral/libupm/src/servo/es08a.cxx
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <unistd.h>
-
-#include "es08a.h"
-
-using namespace upm;
-
-ES08A::ES08A (int pin) : Servo(pin) {
- m_name = "ES08A";
- m_maxAngle = 180.0;
- m_minPulseWidth = 600;
- m_maxPulseWidth = 2200;
-}
-
-ES08A::~ES08A() {
-
-}
diff --git a/peripheral/libupm/src/servo/es08a.h b/peripheral/libupm/src/servo/es08a.h
deleted file mode 100644
index 2c28096..0000000
--- a/peripheral/libupm/src/servo/es08a.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include "servo.h"
-
-namespace upm {
-
-/**
- * @library servo
- * @sensor es08a
- * @comname ES08A Servo
- * @altname Grove Servo
- * @type servos
- * @man emax
- * @web http://www.seeedstudio.com/wiki/Grove_-_Servo
- * @con pwm
- * @kit gsk
- *
- * @brief API for the ES08A Servo
- *
- * This module defines the ES08A interface for ES08A servos.
- * Like other servos, the ES08A servo has a shaft that can be controlled
- * by setting the desired angle. There are also routines for setting
- * and getting the minimum and maximum pulse width as well as the
- * maximum period.
- *
- * @image html es08a.jpg
- * @snippet es08a.cxx Interesting
- */
- class ES08A : public Servo {
- public:
- /**
- * Instantiates an ES08A object
- *
- * @param pin Servo pin number
- */
- ES08A (int pin);
-
- /**
- * ES08A object destructor
- */
- ~ES08A ();
-};
-
-}
diff --git a/peripheral/libupm/src/servo/es9257.cxx b/peripheral/libupm/src/servo/es9257.cxx
deleted file mode 100644
index b7edf0f..0000000
--- a/peripheral/libupm/src/servo/es9257.cxx
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Author: Mihai Tudor Panu <mihai.tudor.panu@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 <iostream>
-#include <unistd.h>
-
-#include "es9257.h"
-
-using namespace upm;
-
-ES9257::ES9257 (int pin) : Servo(pin) {
- m_name = "ES9257";
- m_maxAngle = 180.0;
- m_minPulseWidth = 475;
- m_maxPulseWidth = 2100;
-}
-
-ES9257::~ES9257() {
-
-}
diff --git a/peripheral/libupm/src/servo/es9257.h b/peripheral/libupm/src/servo/es9257.h
deleted file mode 100644
index 51b41ef..0000000
--- a/peripheral/libupm/src/servo/es9257.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Author: Mihai Tudor Panu <mihai.tudor.panu@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 <string>
-#include "servo.h"
-
-namespace upm {
-
-/**
- * @library servo
- * @sensor es9257
- * @comname ES9257 Servo
- * @altname Grove Servo
- * @type servos
- * @man emax
- * @web http://www.seeedstudio.com/wiki/Grove_-_Servo
- * @con pwm
- * @kit gsk
- *
- * @brief API for the ES9257 Servo
- *
- * This module defines the ES9257 interface for ES9257 servos.
- * The ES9257 servo is a fast, heavy duty servo that is popular for moving the
- * control surfaces on RC models.
- *
- * @image html es9257.jpg
- */
- class ES9257 : public Servo {
- public:
- /**
- * Instantiates an ES9257 object
- *
- * @param pin Servo pin number
- */
- ES9257 (int pin);
-
- /**
- * ES9257 object destructor
- */
- ~ES9257 ();
-};
-
-}
diff --git a/peripheral/libupm/src/servo/javaupm_servo.i b/peripheral/libupm/src/servo/javaupm_servo.i
deleted file mode 100644
index 38e0436..0000000
--- a/peripheral/libupm/src/servo/javaupm_servo.i
+++ /dev/null
@@ -1,28 +0,0 @@
-%module javaupm_servo
-%include "../upm.i"
-
-%include "servo.h"
-%{
- #include "servo.h"
-%}
-
-%include "es08a.h"
-%{
- #include "es08a.h"
-%}
-
-%include "es9257.h"
-%{
- #include "es9257.h"
-%}
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_servo");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/servo/jsupm_servo.i b/peripheral/libupm/src/servo/jsupm_servo.i
deleted file mode 100644
index 6b17bc2..0000000
--- a/peripheral/libupm/src/servo/jsupm_servo.i
+++ /dev/null
@@ -1,17 +0,0 @@
-%module jsupm_servo
-%include "../upm.i"
-
-%include "servo.h"
-%{
- #include "servo.h"
-%}
-
-%include "es08a.h"
-%{
- #include "es08a.h"
-%}
-
-%include "es9257.h"
-%{
- #include "es9257.h"
-%}
diff --git a/peripheral/libupm/src/servo/pyupm_servo.i b/peripheral/libupm/src/servo/pyupm_servo.i
deleted file mode 100644
index 8db40d6..0000000
--- a/peripheral/libupm/src/servo/pyupm_servo.i
+++ /dev/null
@@ -1,19 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_servo
-%include "../upm.i"
-
-%include "servo.h"
-%{
- #include "servo.h"
-%}
-
-%include "es08a.h"
-%{
- #include "es08a.h"
-%}
-
-%include "es9257.h"
-%{
- #include "es9257.h"
-%}
diff --git a/peripheral/libupm/src/servo/servo.cxx b/peripheral/libupm/src/servo/servo.cxx
deleted file mode 100644
index b956ec4..0000000
--- a/peripheral/libupm/src/servo/servo.cxx
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <sstream>
-#include <string>
-#include <stdexcept>
-#include <unistd.h>
-#include <stdlib.h>
-#include <math.h>
-
-#include "servo.h"
-
-using namespace upm;
-
-Servo::Servo (int pin) {
- init(pin, MIN_PULSE_WIDTH, MAX_PULSE_WIDTH, DEFAULT_WAIT_DISABLE_PWM);
-}
-
-Servo::Servo (int pin, int minPulseWidth, int maxPulseWidth) {
- init(pin, minPulseWidth, maxPulseWidth, DEFAULT_WAIT_DISABLE_PWM);
-}
-
-Servo::Servo (int pin, int minPulseWidth, int maxPulseWidth, int waitAndDisablePwm) {
- init(pin, minPulseWidth, maxPulseWidth, waitAndDisablePwm);
-}
-
-Servo::~Servo () {
- haltPwm();
- mraa_pwm_close (m_pwmServoContext);
-}
-
-/*
- * X = between (MIN_PULSE_WIDTH , MAX_PULSE_WIDTH)
- *
- * X usec
- * _______
- * |_______________________________________
- * m_period usec
- *
- * */
-mraa_result_t Servo::setAngle (int angle) {
- if (angle > m_maxAngle || angle < 0) {
- // C++11 std::to_string() would be nice, but...
- std::ostringstream str;
- str << m_maxAngle;
- throw std::out_of_range(std::string(__FUNCTION__) +
- ": angle must be between 0 and " +
- str.str());
-
- return MRAA_ERROR_UNSPECIFIED;
- }
-
- mraa_pwm_enable (m_pwmServoContext, 1);
- mraa_pwm_period_us (m_pwmServoContext, m_period);
- mraa_pwm_pulsewidth_us (m_pwmServoContext, calcPulseTraveling(angle));
-
- if (m_waitAndDisablePwm) {
- sleep(1); // we must make sure that we don't turn off PWM before the servo is done moving.
- haltPwm();
- }
-
- m_currAngle = angle;
- return MRAA_SUCCESS;
-}
-
-mraa_result_t Servo::haltPwm () {
- return mraa_pwm_enable (m_pwmServoContext, 0);
-}
-
-/*
- * Calculating relative pulse time to the value.
- * */
-int Servo::calcPulseTraveling (int value) {
- // if bigger than the boundaries
- if (value > m_maxAngle) {
- return m_maxPulseWidth;
- }
-
- // if less than the boundaries
- if (value < 0) {
- return m_minPulseWidth;
- }
-
- // the conversion
- return (int) ((float)m_minPulseWidth + ((float)value / m_maxAngle) * ((float)m_maxPulseWidth - (float)m_minPulseWidth));
-}
-
-void
-Servo::setMinPulseWidth (int width) {
- m_minPulseWidth = width;
-}
-
-void
-Servo::setMaxPulseWidth (int width) {
- m_maxPulseWidth = width;
-}
-
-void
-Servo::setPeriod (int period) {
- m_period = period;
-}
-
-int
-Servo::getMinPulseWidth () {
- return m_minPulseWidth;
-}
-
-int
-Servo::getMaxPulseWidth () {
- return m_maxPulseWidth;
-}
-
-int
-Servo::getPeriod () {
- return m_period;
-}
-
-/**
- * private mathod: would like to use delegating constructors instead but that requires C++11
- */
-void
-Servo::init (int pin, int minPulseWidth, int maxPulseWidth, int waitAndDisablePwm) {
- m_minPulseWidth = minPulseWidth;
- m_maxPulseWidth = maxPulseWidth;
- m_period = PERIOD;
-
- m_waitAndDisablePwm = waitAndDisablePwm;
-
- m_maxAngle = 180.0;
- m_servoPin = pin;
-
- if ( !(m_pwmServoContext = mraa_pwm_init (m_servoPin)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_pwm_init() failed, invalid pin?");
- return;
- }
-
- m_currAngle = 180;
-
- setAngle (0);
-}
diff --git a/peripheral/libupm/src/servo/servo.h b/peripheral/libupm/src/servo/servo.h
deleted file mode 100644
index 17bdf13..0000000
--- a/peripheral/libupm/src/servo/servo.h
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include <mraa/pwm.h>
-
-namespace upm {
-
-#define MIN_PULSE_WIDTH 600
-#define MAX_PULSE_WIDTH 2500
-#define PERIOD 20000
-
-#define HIGH 1
-#define LOW 0
-
-#define DEFAULT_WAIT_DISABLE_PWM 0
-
-/**
- * @brief Servo library
- *
- * The base Servo class provides routines for setting the angle of the shaft
- * as well as setting and getting the minimum and maximum pulse width and
- * the maximum period.
- *
- * @defgroup servo libupm-servo
- * @ingroup seeed emax pwm servos gsk
- */
-class Servo {
- public:
- /**
- * Instantiates a Servo object
- *
- * @param pin Servo pin number
- */
- Servo (int pin);
-
- /**
- * Instantiates a Servo object
- *
- * @param pin Servo pin number
- * @param minPulseWidth Minimum pulse width, in microseconds
- * @param maxPulseWidth Maximum pulse width, in microseconds
- */
- Servo (int pin, int minPulseWidth, int maxPulseWidth);
-
- /**
- * Instantiates a Servo object
- *
- * @param pin Servo pin number
- * @param minPulseWidth Minimum pulse width, in microseconds
- * @param maxPulseWidth Maximum pulse width, in microseconds
- * @param waitAndDisablePwm If 1, PWM is enabled only during the setAngle() execution
- * for a period of 1 second, and then turned back off. If 0, PWM remains on afterward.
- */
- Servo (int pin, int minPulseWidth, int maxPulseWidth, int waitAndDisablePwm);
-
- /**
- * Servo object destructor
- */
- ~Servo();
-
- /**
- * Sets the angle of the servo engine.
- *
- * @param angle Number between 0 and 180
- * @return 0 if successful, non-zero otherwise
- */
- mraa_result_t setAngle (int angle);
-
- /**
- * Halts PWM for this servo and allows it to move freely.
- */
- mraa_result_t haltPwm ();
-
- /**
- * Returns the name of the component
- *
- * @return Name of the component
- */
- std::string name()
- {
- return m_name;
- }
-
- /**
- * Sets the minimum pulse width
- *
- * @param width Minimum HIGH signal width
- */
- void setMinPulseWidth (int width);
-
- /**
- * Sets the maximum pulse width
- *
- * @param width Maximum HIGH signal width
- */
- void setMaxPulseWidth (int width);
-
- /**
- * Sets the maximum period width
- *
- * @param period PWM period width
- */
- void setPeriod (int period);
-
- /**
- * Returns the minimum pulse width
- *
- * @return Minimum pulse width
- */
- int getMinPulseWidth ();
-
- /**
- * Returns the maximum pulse width
- *
- * @return Maximum pulse width
- */
- int getMaxPulseWidth ();
-
- /**
- * Returns the maximum PWM period width
- *
- * @return Maximum PWM period width
- */
- int getPeriod ();
-
- protected:
- int calcPulseTraveling (int value);
-
- std::string m_name;
- int m_servoPin;
- float m_maxAngle;
- mraa_pwm_context m_pwmServoContext;
- int m_currAngle;
-
- int m_minPulseWidth;
- int m_maxPulseWidth;
- int m_period;
-
- int m_waitAndDisablePwm;
-
- private:
- void init (int pin, int minPulseWidth, int maxPulseWidth, int waitAndDisablePwm);
-};
-
-}
diff --git a/peripheral/libupm/src/si114x/CMakeLists.txt b/peripheral/libupm/src/si114x/CMakeLists.txt
deleted file mode 100644
index e2d8f2e..0000000
--- a/peripheral/libupm/src/si114x/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "si114x")
-set (libdescription "upm si114x UV/IR/Visible light sensor")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/si114x/javaupm_si114x.i b/peripheral/libupm/src/si114x/javaupm_si114x.i
deleted file mode 100644
index 173c4a6..0000000
--- a/peripheral/libupm/src/si114x/javaupm_si114x.i
+++ /dev/null
@@ -1,20 +0,0 @@
-%module javaupm_si114x
-%include "../upm.i"
-%include "cpointer.i"
-
-%{
- #include "si114x.h"
-%}
-
-%include "si114x.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_si114x");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/si114x/jsupm_si114x.i b/peripheral/libupm/src/si114x/jsupm_si114x.i
deleted file mode 100644
index 9ee70e0..0000000
--- a/peripheral/libupm/src/si114x/jsupm_si114x.i
+++ /dev/null
@@ -1,9 +0,0 @@
-%module jsupm_si114x
-%include "../upm.i"
-%include "cpointer.i"
-
-%{
- #include "si114x.h"
-%}
-
-%include "si114x.h"
diff --git a/peripheral/libupm/src/si114x/pyupm_si114x.i b/peripheral/libupm/src/si114x/pyupm_si114x.i
deleted file mode 100644
index 7b35cb8..0000000
--- a/peripheral/libupm/src/si114x/pyupm_si114x.i
+++ /dev/null
@@ -1,15 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_si114x
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-#ifdef DOXYGEN
-%include "si114x_doc.i"
-#endif
-
-%include "si114x.h"
-%{
- #include "si114x.h"
-%}
diff --git a/peripheral/libupm/src/si114x/si114x.cxx b/peripheral/libupm/src/si114x/si114x.cxx
deleted file mode 100644
index 6887690..0000000
--- a/peripheral/libupm/src/si114x/si114x.cxx
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Thanks to Adafruit for some important clues
- *
- * 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 <math.h>
-#include <iostream>
-#include <stdexcept>
-#include <string>
-
-#include "si114x.h"
-
-using namespace upm;
-using namespace std;
-
-
-SI114X::SI114X(int bus, uint8_t address)
-{
- m_addr = address;
- m_uvIndex = 0;
-
- // setup our i2c link
- if ( !(m_i2c = mraa_i2c_init(bus)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_i2c_init() failed");
- return;
- }
-
- mraa_result_t rv;
-
- if ( (rv = mraa_i2c_address(m_i2c, m_addr)) != MRAA_SUCCESS)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": mraa_i2c_address() failed");
- return;
- }
-
- // The data sheet recommends setting the UV calibration values to
- // 0x7b, 0x6b, 0x01, and 0x00, however the adafruit code uses a
- // different set of values, presumably calibrated to their specific
- // implementation. We will use those defaults here, as this was
- // developed on an adafruit device.
-
- // Use setUVCalibration() to set a different set of values before
- // calling init() if you need different values.
-
- setUVCalibration(0x29, 0x89, 0x02, 0x00);
-}
-
-SI114X::~SI114X()
-{
- mraa_i2c_stop(m_i2c);
-}
-
-bool SI114X::writeByte(uint8_t reg, uint8_t byte)
-{
- mraa_result_t rv = mraa_i2c_write_byte_data(m_i2c, byte, reg);
-
- if (rv != MRAA_SUCCESS)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": mraa_i2c_write_byte() failed");
- return false;
- }
-
- return true;
-}
-
-uint8_t SI114X::readByte(uint8_t reg)
-{
- return mraa_i2c_read_byte_data(m_i2c, reg);
-}
-
-uint16_t SI114X::readWord(uint8_t reg)
-{
- return mraa_i2c_read_word_data(m_i2c, reg);
-}
-
-void SI114X::setUVCalibration(uint8_t uvcoeff0, uint8_t uvcoeff1,
- uint8_t uvcoeff2, uint8_t uvcoeff3)
-{
- m_uv_cal[0] = uvcoeff0;
- m_uv_cal[1] = uvcoeff1;
- m_uv_cal[2] = uvcoeff2;
- m_uv_cal[3] = uvcoeff3;
-};
-
-
-void SI114X::writeParam(SI114X_PARAM_T param, uint8_t value)
-{
- // write a parameter to the RAM parameter area
-
- // We write the value to the PARAM_WR register, then execute a
- // PARAM_WRITE command
-
- writeByte(REG_PARAM_WR, value);
-
- // now write it to parameter memory
- writeByte(REG_COMMAND, CMD_PARAM_SET | param);
-}
-
-uint8_t SI114X::readParam(SI114X_PARAM_T param)
-{
- // get the parameter into register REG_PARAM_READ, then read and return it.
-
- writeByte(REG_COMMAND, CMD_PARAM_QUERY | param);
- return readByte(REG_PARAM_READ);
-}
-
-void SI114X::reset()
-{
- // reset the device
-
- // zero out measuring rate
- writeByte(REG_MEAS_RATE0, 0);
- writeByte(REG_MEAS_RATE1, 0);
-
- // disable IRQ MODES
- // these are undocumented in the datasheet, but mentioned in Adafruit's code
- writeByte(REG_IRQ_MODE1, 0);
- writeByte(REG_IRQ_MODE2, 0);
-
- // turn off interrupts
- writeByte(REG_INT_CFG, 0);
- writeByte(REG_IRQ_STATUS, 0xff);
-
- // send a reset
- writeByte(REG_COMMAND, CMD_RESET);
- usleep(100);
-
- // set the hardware key
- writeByte(REG_HW_KEY, SI114X_HW_KEY);
- usleep(100);
-}
-
-void SI114X::initialize()
-{
- // initialize the device
-
- // first, reset it
- reset();
-
- // UV coefficients
- writeByte(REG_UCOEF0, m_uv_cal[0]);
- writeByte(REG_UCOEF1, m_uv_cal[1]);
- writeByte(REG_UCOEF2, m_uv_cal[2]);
- writeByte(REG_UCOEF3, m_uv_cal[3]);
-
- // enable UV sensor only for now
- writeParam(PARAM_CHLIST, CHLIST_EN_UV);
-
- // auto-measure speed - slowest - (rate * 31.25us)
- writeByte(REG_MEAS_RATE0, 0xff); // 7.9ms
-
- // set autorun
- writeByte(REG_COMMAND, CMD_ALS_AUTO);
-}
-
-void SI114X::update()
-{
- // for now, just update the UV Index member variable
- uint16_t uvi = readWord(REG_AUX_UVINDEX0);
-
- m_uvIndex = float(uvi) / 100.0;
-
- // Add any further data gets() here
-
- return;
-}
diff --git a/peripheral/libupm/src/si114x/si114x.h b/peripheral/libupm/src/si114x/si114x.h
deleted file mode 100644
index 0905997..0000000
--- a/peripheral/libupm/src/si114x/si114x.h
+++ /dev/null
@@ -1,323 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Thanks to Adafruit for some important clues
- *
- * 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 <string>
-#include <mraa/i2c.h>
-#include <mraa/gpio.h>
-
-#define SI114X_I2C_BUS 0
-#define SI114X_DEFAULT_I2C_ADDR 0x60
-#define SI114X_HW_KEY 0x17
-
-
-namespace upm {
-
- /**
- * @brief SI1145 UV Light Sensor library
- * @defgroup si114x libupm-si114x
- * @ingroup adafruit i2c light
- */
-
- /**
- * @library si114x
- * @sensor si114x
- * @comname SI1145 UV Light Sensor
- * @altname SI1146, SI1147
- * @type light
- * @man adafruit
- * @web https://www.adafruit.com/products/1777
- * @con i2c
- *
- * @brief API for the SI1145 UV Light Sensor
- *
- * This module was tested with the Adafruit* UV Light Sensor
- *
- * This device is capable of measuring IR and visible ambient
- * light as well. It also supports the ability to use externally
- * attached LEDs to perform proximity detection on 3 separate
- * channels.
- *
- * Currently, this class only supports the retrieving of the
- * calculated UV index measured by the device, but enough
- * infrastructure is provided to make it easy to enhance this driver
- * in the future to support additional capabilities, including
- * interrupt support.
- *
- * @image html si114x.jpg
- * @snippet si114x.cxx Interesting
- */
- class SI114X {
- public:
-
- /**
- * SI114X registers
- */
- typedef enum { REG_PART_ID = 0x00,
- REG_REV_ID = 0x01,
- REG_SEQ_ID = 0x02,
- REG_INT_CFG = 0x03,
- REG_IRQ_ENABLE = 0x04,
-
- // these two are not documented in the datasheet,
- // but are mentioned there, as well as in the
- // Adafruit example
- REG_IRQ_MODE1 = 0x05,
- REG_IRQ_MODE2 = 0x06,
-
- REG_HW_KEY = 0x07,
- REG_MEAS_RATE0 = 0x08,
- REG_MEAS_RATE1 = 0x09,
-
- REG_PS_LED21 = 0x0f,
- REG_PS_LED3 = 0x10,
-
- REG_UCOEF0 = 0x13,
- REG_UCOEF1 = 0x14,
- REG_UCOEF2 = 0x15,
- REG_UCOEF3 = 0x16,
- REG_PARAM_WR = 0x17,
- REG_COMMAND = 0x18,
-
- REG_RESPONSE = 0x20,
- REG_IRQ_STATUS = 0x21,
- REG_ALS_VIS_DATA0 = 0x22,
- REG_ALS_VIS_DATA1 = 0x23,
- REG_ALS_IR_DATA0 = 0x24,
- REG_ALS_IR_DATA1 = 0x25,
- REG_PS1_DATA0 = 0x26,
- REG_PS1_DATA1 = 0x27,
- REG_PS2_DATA0 = 0x28,
- REG_PS2_DATA1 = 0x29,
- REG_PS3_DATA0 = 0x2a,
- REG_PS3_DATA1 = 0x2b,
- REG_AUX_UVINDEX0 = 0x2c,
- REG_AUX_UVINDEX1 = 0x2d,
- REG_PARAM_READ = 0x2e,
-
- REG_CHIP_STAT = 0x30,
-
- REG_ANA_IN_KEY0 = 0x3b,
- REG_ANA_IN_KEY1 = 0x3c,
- REG_ANA_IN_KEY2 = 0x3d,
- REG_ANA_IN_KEY3 = 0x3e
- } SI114X_REG_T;
-
- /**
- * Parameter memory (PARAM)
- */
- typedef enum { PARAM_I2C_ADDDR = 0x00,
- PARAM_CHLIST = 0x01,
- PARAM_PSLED12_SEL = 0x02,
- PARAM_PSLED3_SEL = 0x03,
-
- PARAM_PS_ENCODING = 0x05,
- PARAM_ALS_ENCODING = 0x06,
- PARAM_PS1_ADCMUX = 0x07,
- PARAM_PS2_ADCMUX = 0x08,
- PARAM_PS3_ADCMUX = 0x09,
- PARAM_PS_ADC_COUNT = 0x0a,
- PARAM_PS_ADC_GAIN = 0x0b,
- PARAM_PS_ADC_MISC = 0x0c,
-
- PARAM_ALS_IR_ADCMUX = 0x0e,
- PARAM_AUX_ADCMUX = 0x0f,
- PARAM_ALS_VIS_ADC_COUNT = 0x10,
- PARAM_ALS_VIS_ADC_GAIN = 0x11,
- PARAM_ALS_VIS_ADC_MISC = 0x12,
-
- PARAM_LED_REC = 0x1c,
- PARAM_ALS_IR_ADC_COUNT = 0x1d,
- PARAM_ALS_IR_ADX_GAIN = 0x1e,
- PARAM_ALS_IR_ADC_MISC = 0x1f
- } SI114X_PARAM_T;
-
- /**
- * Commands (written to the REG_COMMAND register)
- */
- typedef enum { CMD_NOOP = 0x00, // clear RESPONSE reg
- CMD_RESET = 0x01,
- CMD_BUSADDR = 0x02,
-
- CMD_PS_FORCE = 0x05,
- CMD_GET_CAL = 0x12,
- CMD_ALS_FORCE = 0x06,
- CMD_PSALS_FORCE = 0x07,
-
- CMD_PS_PAUSE = 0x09,
- CMD_ALS_PAUSE = 0x0a,
- CMD_PSALS_PAUSE = 0x0b,
-
- CMD_PS_AUTO = 0x0d,
- CMD_ALS_AUTO = 0x0e,
- CMD_PSALS_AUTO = 0x0f,
-
- CMD_PARAM_QUERY = 0x80, // OR'd with PARAM_T value
- CMD_PARAM_SET = 0xa0 // OR'd with PARAM_T value
- } SI114X_CMD_T;
-
-
- /**
- * Channel list enable bits
- */
- typedef enum { CHLIST_EN_PS1 = 0x01, // proximity sense 1-3
- CHLIST_EN_PS2 = 0x02,
- CHLIST_EN_PS3 = 0x04,
-
- CHLIST_EN_ALS_VIS = 0x10, // ambient light sense
- CHLIST_EN_ALS_IR = 0x20,
- CHLIST_EN_AUX = 0x40, // AUX sense
- CHLIST_EN_UV = 0x80 // UV sense
- } SI114X_CHLIST_BITS_T;
-
- /**
- * Error codes from the RESPONSE register
- */
- typedef enum { ERR_NONE = 0x00, // no error if high nibble is 0
- // lower nibble is a counter
- ERR_INVALID_SET = 0x80, // invalid setting
- ERR_PS1_ADC_OVER = 0x88, // overflows
- ERR_PS2_ADC_OVER = 0x89,
- ERR_PS3_ADC_OVER = 0x8a,
- ERR_ALS_VIS_ADC_OVER = 0x8c,
- ERR_ALS_IR_ADC_OVER = 0x8d,
- ERR_AUX_ADC_OVER = 0x8e
- } SI114X_ERR_T;
-
-
- /**
- * Interrupt enable bits
- */
- typedef enum { IRQEN_ALS_IE = 0x01,
- IRQEN_PS1_IE = 0x04,
- IRQEN_PS2_IE = 0x08,
- IRQEN_PS3_IE = 0x10
- } SI114X_IRQEN_BITS_T;
-
- /**
- * SI114X constructor
- *
- * @param bus I2C bus to use
- * @param address Address for this device
- */
- SI114X(int bus, uint8_t address = SI114X_DEFAULT_I2C_ADDR);
-
- /**
- * SI114X destructor
- */
- ~SI114X();
-
- /**
- * Writes a byte value into a register
- *
- * @param reg Register location to write into
- * @param byte Byte to write
- * @return True if successful
- */
- bool writeByte(uint8_t reg, uint8_t byte);
-
- /**
- * Reads a byte value from a register
- *
- * @param reg Register location to read from
- * @return Value in a specified register
- */
- uint8_t readByte(uint8_t reg);
-
- /**
- * Reads a word value from a register
- *
- * @param reg Register location to read from
- * @return Value in a specified register
- */
- uint16_t readWord(uint8_t reg);
-
- /**
- * Disables interrupts and auto-measuring, issues a device reset,
- * and then sets the hardware key.
- */
- void reset();
-
- /**
- * Sets UV calibration values. The constructor sets default
- * values for you, so you only need this function if you need
- * different values for your device and situation. If you set new
- * values here, be sure to do so before calling initialize().
- *
- * @param uvcoeff0 Coefficient for REG_UCOEF0
- * @param uvcoeff1 Coefficient for REG_UCOEF1
- * @param uvcoeff2 Coefficient for REG_UCOEF2
- * @param uvcoeff3 Coefficient for REG_UCOEF3
- *
- */
- void setUVCalibration(uint8_t uvcoeff0, uint8_t uvcoeff1, uint8_t uvcoeff2,
- uint8_t uvcoeff3);
-
- /**
- * Writes a value to the parameter memory.
- *
- * @param param SI114X_PARAM_T register to write
- * @param value Value to write
- */
- void writeParam(SI114X_PARAM_T param, uint8_t value);
-
- /**
- * Reads a value from the parameter memory
- *
- * @param param SI114X_PARAM_T register to read
- * @return Value
- */
- uint8_t readParam(SI114X_PARAM_T param);
-
- /**
- * Resets and initializes the device and starts auto-sampling
- */
- void initialize();
-
- /**
- * Updates stored values. You should call this before calling
- * getUVIndex()
- */
- void update();
-
- /**
- * Reads the currently measured UV index value
- *
- * @return UV index value
- */
- float getUVIndex() { return m_uvIndex; };
-
- private:
- mraa_i2c_context m_i2c;
- uint8_t m_addr;
- // UV calibration values
- uint8_t m_uv_cal[4];
- // updated by update()
- float m_uvIndex;
- };
-}
-
-
diff --git a/peripheral/libupm/src/sm130/CMakeLists.txt b/peripheral/libupm/src/sm130/CMakeLists.txt
deleted file mode 100644
index 1875951..0000000
--- a/peripheral/libupm/src/sm130/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "sm130")
-set (libdescription "upm rfid reader")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/sm130/javaupm_sm130.i b/peripheral/libupm/src/sm130/javaupm_sm130.i
deleted file mode 100644
index 5c1e1a9..0000000
--- a/peripheral/libupm/src/sm130/javaupm_sm130.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_sm130
-%include "../upm.i"
-
-%{
- #include "sm130.h"
-%}
-
-%include "sm130.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_sm130");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/sm130/jsupm_sm130.i b/peripheral/libupm/src/sm130/jsupm_sm130.i
deleted file mode 100644
index 6ee7806..0000000
--- a/peripheral/libupm/src/sm130/jsupm_sm130.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_sm130
-%include "../upm.i"
-
-%{
- #include "sm130.h"
-%}
-
-%include "sm130.h"
diff --git a/peripheral/libupm/src/sm130/pyupm_sm130.i b/peripheral/libupm/src/sm130/pyupm_sm130.i
deleted file mode 100644
index d7cd2b1..0000000
--- a/peripheral/libupm/src/sm130/pyupm_sm130.i
+++ /dev/null
@@ -1,11 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_sm130
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "sm130.h"
-%{
- #include "sm130.h"
-%}
diff --git a/peripheral/libupm/src/sm130/sm130.cxx b/peripheral/libupm/src/sm130/sm130.cxx
deleted file mode 100644
index fb84c11..0000000
--- a/peripheral/libupm/src/sm130/sm130.cxx
+++ /dev/null
@@ -1,878 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <stdexcept>
-
-#include "sm130.h"
-
-using namespace upm;
-using namespace std;
-
-// Uncomment the below to see packaet data sent and received from the SM130
-// #define SM130_DEBUG
-
-static const int defaultDelay = 1000; // ms for read
-
-static const int maxLen = 64; // max number of bytes to read
-
-SM130::SM130(int uart, int reset) :
- m_uart(uart), m_gpioReset(reset)
-{
- m_tagType = TAG_NONE;
- m_uidLen = 0;
- m_uid.clear();
- clearError();
- initClock();
-
- m_gpioReset.dir(mraa::DIR_OUT);
- m_gpioReset.write(0);
-}
-
-SM130::~SM130()
-{
-}
-
-mraa::Result SM130::setBaudRate(int baud)
-{
- m_baud = baud;
- return m_uart.setBaudRate(baud);
-}
-
-string SM130::sendCommand(CMD_T cmd, string data)
-{
- uint8_t cksum = 0;
- string command;
-
- // for uart, we need to add the sync bytes, 0xff, 0x00
- command.push_back(0xff);
- command.push_back(0x00);
-
- // compute the length - command + data
- uint8_t len = 1; // command
- if (!data.empty())
- len += data.size();
-
- command.push_back(len);
-
- cksum += len;
-
- // now the command
- command.push_back(cmd);
- cksum += cmd;
-
- // now the data if any
- if (!data.empty())
- {
- for (int i=0; i<data.size(); i++)
- {
- command.push_back(data[i]);
- cksum += (uint8_t)data[i];
- }
- }
-
- // now add the checksum
- command.push_back(cksum);
-
-#ifdef SM130_DEBUG
- cerr << "CMD: " << string2HexString(command) << endl;
-#endif // SM130_DEBUG
-
- // send it
- m_uart.writeStr(command);
-
- // if the command is SET_BAUD, then switch to the new baudrate here
- // before attempting to read the response (and hope it worked).
- if (cmd == CMD_SET_BAUD)
- {
- usleep(100000); // 100ms
- setBaudRate(m_baud);
- }
-
- // now wait for a response
- if (!m_uart.dataAvailable(defaultDelay))
- {
- cerr << __FUNCTION__ << ": timeout waiting for response" << endl;
- return "";
- }
-
- string resp = m_uart.readStr(maxLen);
-
-#ifdef SM130_DEBUG
- cerr << "RSP: " << string2HexString(resp) << endl;
-#endif // SM130_DEBUG
-
- if (!((uint8_t)resp[0] == 0xff && (uint8_t)resp[1] == 0x00))
- {
- cerr << __FUNCTION__ << ": invalid packet header" << endl;
- return "";
- }
-
- // check size - 2 header bytes + len + cksum.
- if (resp.size() != ((uint8_t)resp[2] + 2 + 1 + 1))
- {
- cerr << __FUNCTION__ << ": invalid packet length, expected "
- << int((uint8_t)resp[2] + 2 + 1 + 1)
- << ", got " << resp.size() << endl;
- return "";
- }
-
- // verify the cksum
- cksum = 0;
- for (int i=2; i<(resp.size() - 1); i++)
- cksum += (uint8_t)resp[i];
-
- if (cksum != (uint8_t)resp[resp.size() - 1])
- {
- cerr << __FUNCTION__ << ": invalid checksum, expected "
- << int(cksum) << ", got " << (uint8_t)resp[resp.size()-1] << endl;
- return "";
- }
-
- // we could also verify that the command code returned was for the
- // command submitted...
-
- // now, remove the 2 header bytes and the checksum, leave the length
- // and command.
- resp.erase(resp.size() - 1, 1); // cksum
- resp.erase(0, 2); // header bytes
-
- // return the rest
- return resp;
-}
-
-string SM130::getFirmwareVersion()
-{
- clearError();
-
- string resp = sendCommand(CMD_VERSION, "");
-
- if (resp.empty())
- {
- cerr << __FUNCTION__ << ": failed" << endl;
- return "";
- }
-
- // delete the len and cmd, return the rest
- resp.erase(0, 2);
- return resp;
-}
-
-bool SM130::reset()
-{
- clearError();
-
- string resp = sendCommand(CMD_RESET, "");
- if (resp.empty())
- {
- cerr << __FUNCTION__ << ": failed" << endl;
- return false;
- }
-
- return true;
-}
-
-void SM130::hardwareReset()
-{
- m_gpioReset.write(1);
- usleep(100000);
- m_gpioReset.write(0);
-}
-
-bool SM130::select()
-{
- clearError();
-
- m_tagType = TAG_NONE;
- m_uidLen = 0;
- m_uid.clear();
-
- string resp = sendCommand(CMD_SELECT_TAG, "");
-
- if (resp.empty())
- {
- cerr << __FUNCTION__ << ": failed" << endl;
- return false;
- }
-
- if ((uint8_t)resp[0] == 2)
- {
- // then we got an error of some sort, store the error code, str
- // and bail.
- m_lastErrorCode = resp[2];
-
- switch (m_lastErrorCode)
- {
- case 'N': m_lastErrorString = "No tag present";
- break;
- case 'U': m_lastErrorString = "Access failed, RF field is off";
- break;
- default: m_lastErrorString = "Unknown error code";
- break;
- }
- return false;
- }
-
- // if we are here, then store the uid info and tag type.
- m_tagType = (TAG_TYPE_T)resp[2];
-
- if ((uint8_t)resp[0] == 6)
- m_uidLen = 4; // 4 byte uid
- else
- m_uidLen = 7; // 7 byte
-
- for (int i=0; i<m_uidLen; i++)
- m_uid.push_back(resp[i+3]);
-
- return true;
-}
-
-bool SM130::authenticate(uint8_t block, KEY_TYPES_T keyType, string key)
-{
- clearError();
-
- // A little sanity checking...
- if (keyType == KEY_TYPE_A || keyType == KEY_TYPE_B)
- {
- if (key.empty())
- throw std::invalid_argument(string(__FUNCTION__) +
- ": You must specify a key for type A or B");
- if (key.size() != 6)
- throw std::invalid_argument(string(__FUNCTION__) +
- ": Key size must be 6");
-
- return false; // probably not reached :)
- }
- else
- {
- // make sure the key is empty for any other key type
- key.clear();
- }
-
- string data;
- data.push_back(block);
- data.push_back(keyType);
- data += key;
-
- string resp = sendCommand(CMD_AUTHENTICATE, data);
-
- if (resp.empty())
- {
- cerr << __FUNCTION__ << ": failed" << endl;
- return false;
- }
-
- // response len is always 2, 'L' means auth was successful
- if (resp[2] != 'L')
- {
- // then we got an error of some sort, store the error code, str
- // and bail.
- m_lastErrorCode = resp[2];
-
- switch (m_lastErrorCode)
- {
- case 'N': m_lastErrorString = "No tag present, or login failed";
- break;
- case 'U': m_lastErrorString = "Login failed";
- break;
- case 'E': m_lastErrorString = "Invalid key format in EEPROM";
- break;
- default: m_lastErrorString = "Unknown error code";
- break;
- }
- return false;
- }
-
- return true;
-}
-
-string SM130::readBlock16(uint8_t block)
-{
- clearError();
-
- string data;
-
- data.push_back(block);
-
- string resp = sendCommand(CMD_READ16, data);
-
- if (resp.empty())
- {
- cerr << __FUNCTION__ << ": failed" << endl;
- return "";
- }
-
- if ((uint8_t)resp[0] == 2)
- {
- // then we got an error of some sort, store the error code, str
- // and bail.
- m_lastErrorCode = resp[2];
-
- switch (m_lastErrorCode)
- {
- case 'N': m_lastErrorString = "No tag present";
- break;
- case 'F': m_lastErrorString = "Read failed";
- break;
- default: m_lastErrorString = "Unknown error code";
- break;
- }
-
- return "";
- }
-
- // trim off the len, cmd, and block # bytes and return the rest
- resp.erase(0, 3);
- return resp;
-}
-
-int32_t SM130::readValueBlock(uint8_t block)
-{
- clearError();
-
- string data;
-
- data.push_back(block);
-
- string resp = sendCommand(CMD_READ_VALUE, data);
-
- if (resp.empty())
- {
- cerr << __FUNCTION__ << ": failed" << endl;
- return 0;
- }
-
- if ((uint8_t)resp[0] == 2)
- {
- // then we got an error of some sort, store the error code, str
- // and bail.
- m_lastErrorCode = resp[2];
-
- switch (m_lastErrorCode)
- {
- case 'N': m_lastErrorString = "No tag present";
- break;
- case 'F': m_lastErrorString = "Read failed";
- break;
- case 'I': m_lastErrorString = "Invalid Value Block";
- break;
- default: m_lastErrorString = "Unknown error code";
- break;
- }
-
- return 0;
- }
-
- int32_t rv;
- rv = ((uint8_t)resp[3] |
- ((uint8_t)resp[4] << 8) |
- ((uint8_t)resp[5] << 16) |
- ((uint8_t)resp[6] << 24));
-
- return rv;
-}
-
-bool SM130::writeBlock16(uint8_t block, string contents)
-{
- clearError();
-
- // A little sanity checking...
- if (contents.size() != 16)
- {
- throw std::invalid_argument(string(__FUNCTION__) +
- ": You must supply 16 bytes for block content");
-
- return false;
- }
-
- string data;
- data.push_back(block);
- data += contents;
-
- string resp = sendCommand(CMD_WRITE16, data);
-
- if (resp.empty())
- {
- cerr << __FUNCTION__ << ": failed" << endl;
- return false;
- }
-
- if ((uint8_t)resp[0] == 2)
- {
- // then we got an error of some sort, store the error code, str
- // and bail.
- m_lastErrorCode = resp[2];
-
- switch (m_lastErrorCode)
- {
- case 'F': m_lastErrorString = "Write failed";
- break;
- case 'N': m_lastErrorString = "No tag present";
- break;
- case 'U': m_lastErrorString = "Read after write failed";
- break;
- case 'X': m_lastErrorString = "Unable to read after write";
- break;
- default: m_lastErrorString = "Unknown error code";
- break;
- }
- return false;
- }
-
- return true;
-}
-
-bool SM130::writeValueBlock(uint8_t block, int32_t value)
-{
- clearError();
-
- string data;
- data.push_back(block);
- // put the value in, LSB first
- data += (value & 0xff);
- data += ((value >> 8) & 0xff);
- data += ((value >> 16) & 0xff);
- data += ((value >> 24) & 0xff);
-
- string resp = sendCommand(CMD_WRITE_VALUE, data);
-
- if (resp.empty())
- {
- cerr << __FUNCTION__ << ": failed" << endl;
- return false;
- }
-
- if ((uint8_t)resp[0] == 2)
- {
- // then we got an error of some sort, store the error code, str
- // and bail.
- m_lastErrorCode = resp[2];
-
- switch (m_lastErrorCode)
- {
- case 'F': m_lastErrorString = "Read failed during verification";
- break;
- case 'N': m_lastErrorString = "No tag present";
- break;
- case 'I': m_lastErrorString = "Invalid value block";
- break;
- default: m_lastErrorString = "Unknown error code";
- break;
- }
- return false;
- }
-
- return true;
-}
-
-bool SM130::writeBlock4(uint8_t block, string contents)
-{
- clearError();
-
- // A little sanity checking...
- if (contents.size() != 4)
- {
- throw std::invalid_argument(string(__FUNCTION__) +
- ": You must supply 4 bytes for block content");
-
- return false;
- }
-
- string data;
- data.push_back(block);
- data += contents;
-
- string resp = sendCommand(CMD_WRITE4, data);
-
- if (resp.empty())
- {
- cerr << __FUNCTION__ << ": failed" << endl;
- return false;
- }
-
- if ((uint8_t)resp[0] == 2)
- {
- // then we got an error of some sort, store the error code, str
- // and bail.
- m_lastErrorCode = resp[2];
-
- switch (m_lastErrorCode)
- {
- case 'F': m_lastErrorString = "Write failed";
- break;
- case 'N': m_lastErrorString = "No tag present";
- break;
- case 'U': m_lastErrorString = "Read after write failed";
- break;
- case 'X': m_lastErrorString = "Unable to read after write";
- break;
- default: m_lastErrorString = "Unknown error code";
- break;
- }
- return false;
- }
-
- return true;
-}
-
-bool SM130::writeKey(uint8_t eepromSector, KEY_TYPES_T keyType, string key)
-{
- clearError();
-
- // A little sanity checking...
- eepromSector &= 0x0f; // Only 0x00-0x0f is valid
-
- if (!(keyType == KEY_TYPE_A || keyType == KEY_TYPE_B))
- {
- throw std::invalid_argument(string(__FUNCTION__) +
- ": Key type must be A or B");
-
- return false;
- }
-
- if (key.size() != 6)
- {
- throw std::invalid_argument(string(__FUNCTION__) +
- ": Key must be 6 bytes");
-
- return false;
- }
-
- string data;
- data.push_back(eepromSector);
- data += keyType;
- data += key;
-
- string resp = sendCommand(CMD_WRITE_KEY, data);
-
- if (resp.empty())
- {
- cerr << __FUNCTION__ << ": failed" << endl;
- return false;
- }
-
- // reponse len is always 2
- if ((uint8_t)resp[2] != 'L')
- {
- // then we got an error of some sort, store the error code, str
- // and bail.
- m_lastErrorCode = resp[2];
-
- switch (m_lastErrorCode)
- {
- case 'N': m_lastErrorString = "Write master key failed";
- break;
- default: m_lastErrorString = "Unknown error code";
- break;
- }
- return false;
- }
-
- return true;
-}
-
-int32_t SM130::adjustValueBlock(uint8_t block, int32_t value, bool incr)
-{
- clearError();
-
- string data;
- data.push_back(block);
- // put the value in, LSB first
- data += (value & 0xff);
- data += ((value >> 8) & 0xff);
- data += ((value >> 16) & 0xff);
- data += ((value >> 24) & 0xff);
-
- string resp = sendCommand(((incr) ? CMD_INC_VALUE : CMD_DEC_VALUE), data);
-
- if (resp.empty())
- {
- cerr << __FUNCTION__ << ": failed" << endl;
- return 0;
- }
-
- if ((uint8_t)resp[0] == 2)
- {
- // then we got an error of some sort, store the error code, str
- // and bail.
- m_lastErrorCode = resp[2];
-
- switch (m_lastErrorCode)
- {
- case 'F': m_lastErrorString = "Read failed during verification";
- break;
- case 'N': m_lastErrorString = "No tag present";
- break;
- case 'I': m_lastErrorString = "Invalid value block";
- break;
- default: m_lastErrorString = "Unknown error code";
- break;
- }
- return 0;
- }
-
- // now unpack the new value, LSB first
- int32_t rv;
- rv = ((uint8_t)resp[3] |
- ((uint8_t)resp[4] << 8) |
- ((uint8_t)resp[5] << 16) |
- ((uint8_t)resp[6] << 24));
-
- return rv;
-}
-
-bool SM130::setAntennaPower(bool on)
-{
- clearError();
-
- string resp = sendCommand(CMD_ANTENNA_POWER, "");
-
- if (resp.empty())
- {
- cerr << __FUNCTION__ << ": failed" << endl;
- return false;
- }
-
- return true;
-}
-
-uint8_t SM130::readPorts()
-{
- clearError();
-
- string resp = sendCommand(CMD_READ_PORT, "");
-
- if (resp.empty())
- {
- cerr << __FUNCTION__ << ": failed" << endl;
- return 0;
- }
-
- // only the first 2 bits are valid
- return (resp[2] & 3);
-}
-
-bool SM130::writePorts(uint8_t val)
-{
- clearError();
-
- // only the first 2 bits are valid
- val &= 3;
-
- string data;
- data.push_back(val);
-
- string resp = sendCommand(CMD_WRITE_PORT, data);
-
- if (resp.empty())
- {
- cerr << __FUNCTION__ << ": failed" << endl;
- return false;
- }
-
- return true;
-}
-
-bool SM130::haltTag()
-{
- clearError();
-
- string resp = sendCommand(CMD_HALT_TAG, "");
-
- if (resp.empty())
- {
- cerr << __FUNCTION__ << ": failed" << endl;
- return false;
- }
-
- // reponse len is always 2
- if ((uint8_t)resp[2] != 'L')
- {
- // then we got an error of some sort, store the error code, str
- // and bail.
- m_lastErrorCode = resp[2];
-
- switch (m_lastErrorCode)
- {
- case 'U': m_lastErrorString = "Can not halt, RF field is off";
- break;
- default: m_lastErrorString = "Unknown error code";
- break;
- }
- return false;
- }
-
- return true;
-}
-
-bool SM130::setSM130BaudRate(int baud)
-{
- clearError();
-
- uint8_t newBaud;
-
- switch (baud)
- {
- case 9600: newBaud = 0x00;
- break;
- case 19200: newBaud = 0x01;
- break;
- case 38400: newBaud = 0x02;
- break;
- case 57600: newBaud = 0x03;
- break;
- case 115200: newBaud = 0x04;
- break;
- default:
- throw std::invalid_argument(string(__FUNCTION__) +
- ": Invalid SM130 baud rate specified");
- }
-
- // WARNING: this is a dangerous command
- int oldBaud = m_baud;
- m_baud = baud;
-
- string data;
- data.push_back(newBaud);
-
- string resp = sendCommand(CMD_SET_BAUD, data);
-
- if (resp.empty())
- {
- cerr << __FUNCTION__ << ": failed" << endl;
- cerr << __FUNCTION__ << ": restoring old baud rate" << endl;
-
- setBaudRate(oldBaud);
- return false;
- }
-
- // otherwise assume success, possibly incorrectly
- return true;
-}
-
-bool SM130::sleep()
-{
- clearError();
-
- string resp = sendCommand(CMD_SLEEP, "");
-
- if (resp.empty())
- {
- cerr << __FUNCTION__ << ": failed" << endl;
- return false;
- }
-
- return true;
-}
-
-string SM130::string2HexString(string input)
-{
- static const char* const lut = "0123456789abcdef";
- size_t len = input.size();
-
- string output;
- output.reserve(3 * len);
- for (size_t i = 0; i < len; ++i)
- {
- const unsigned char c = input[i];
- output.push_back(lut[c >> 4]);
- output.push_back(lut[c & 15]);
- output.push_back(' ');
- }
-
- return output;
-}
-
-void SM130::initClock()
-{
- gettimeofday(&m_startTime, NULL);
-}
-
-uint32_t SM130::getMillis()
-{
- struct timeval elapsed, now;
- uint32_t elapse;
-
- // get current time
- gettimeofday(&now, NULL);
-
- // compute the delta since m_startTime
- if( (elapsed.tv_usec = now.tv_usec - m_startTime.tv_usec) < 0 )
- {
- elapsed.tv_usec += 1000000;
- elapsed.tv_sec = now.tv_sec - m_startTime.tv_sec - 1;
- }
- else
- {
- elapsed.tv_sec = now.tv_sec - m_startTime.tv_sec;
- }
-
- elapse = (uint32_t)((elapsed.tv_sec * 1000) + (elapsed.tv_usec / 1000));
-
- // never return 0
- if (elapse == 0)
- elapse = 1;
-
- return elapse;
-}
-
-bool SM130::waitForTag(uint32_t timeout)
-{
- initClock();
-
- do
- {
- if (select())
- {
- // success
- return true;
- }
- else
- {
- // If there was an error, fail if it's anything other than a
- // tag not present
- if (getLastErrorCode() != 'N')
- return false;
-
- // otherwise, sleep for 100ms and try again
- usleep(100000);
- }
- } while (getMillis() <= timeout);
-
- return false;
-}
-
-string SM130::tag2String(TAG_TYPE_T tag)
-{
- switch (tag)
- {
- case TAG_MIFARE_ULTRALIGHT: return "MiFare Ultralight";
- case TAG_MIFARE_1K: return "MiFare 1K";
- case TAG_MIFARE_4K: return "MiFare 4K";
- case TAG_UNKNOWN: return "Unknown Tag Type";
- default: return "Invalid Tag Type";
- }
-}
-
-
-
diff --git a/peripheral/libupm/src/sm130/sm130.h b/peripheral/libupm/src/sm130/sm130.h
deleted file mode 100644
index 2665d5d..0000000
--- a/peripheral/libupm/src/sm130/sm130.h
+++ /dev/null
@@ -1,467 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include <iostream>
-
-#include <stdlib.h>
-#include <stdint.h>
-#include <unistd.h>
-#include <string.h>
-#include <sys/time.h>
-#include <sys/select.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include <mraa/common.hpp>
-#include <mraa/uart.hpp>
-#include <mraa/gpio.hpp>
-
-#define SM130_DEFAULT_UART 0
-#define SM130_DEFAULT_RESET_PIN 13
-
-namespace upm {
-
- /**
- * @brief SM130 RFID Reader Module library
- * @defgroup sm130 libupm-sm130
- * @ingroup sparkfun uart gpio rfid
- */
-
- /**
- * @library sm130
- * @sensor sm130
- * @comname SM130 RFID Reader
- * @type rfid
- * @man sparkfun
- * @web https://www.sparkfun.com/products/10126
- * @con uart gpio
- *
- * @brief API for the SM130 RFID Reader Module
- *
- * This module defines the SM130 interface for the sm130 RFID library
- *
- * This module was developed using an SM130 and a Sparkfun RFID
- * Evaluation shield using a UART for communications. It should be
- * fairly trivial to add support for I2C communication in the
- * future, if you have the correct firmware on the SM130.
- *
- * @image html sm130.jpg
- * <br><em>SM130 RFID Reader image provided by SparkFun* under
- * <a href=https://creativecommons.org/licenses/by-nc-sa/3.0/>
- * CC BY-NC-SA-3.0</a>.</em>
- *
- * @snippet sm130.cxx Interesting
- */
-
- class SM130 {
-
- public:
-
- // Valid commands
- typedef enum {
- CMD_RESET = 0x80,
- CMD_VERSION = 0x81,
- CMD_SEEK_TAG = 0x82,
- CMD_SELECT_TAG = 0x83,
- CMD_AUTHENTICATE = 0x85,
- CMD_READ16 = 0x86,
- CMD_READ_VALUE = 0x87,
- CMD_WRITE16 = 0x89,
- CMD_WRITE_VALUE = 0x8a,
- CMD_WRITE4 = 0x8b,
- CMD_WRITE_KEY = 0x8c,
- CMD_INC_VALUE = 0x8d,
- CMD_DEC_VALUE = 0x8e,
- CMD_ANTENNA_POWER = 0x90,
- CMD_READ_PORT = 0x91,
- CMD_WRITE_PORT = 0x92,
- CMD_HALT_TAG = 0x93,
- CMD_SET_BAUD = 0x94,
- CMD_SLEEP = 0x96
- } CMD_T;
-
- // valid tag types.
- typedef enum {
- TAG_NONE = 0x00, // error/invalid
-
- TAG_MIFARE_ULTRALIGHT = 0x01,
- TAG_MIFARE_1K = 0x02,
- TAG_MIFARE_4K = 0x03,
- TAG_UNKNOWN = 0xff
- } TAG_TYPE_T;
-
- // Valid authentication keys
- typedef enum {
- KEY_TYPE_EEPROM_A0 = 0x10,
- KEY_TYPE_EEPROM_A1 = 0x11,
- KEY_TYPE_EEPROM_A2 = 0x12,
- KEY_TYPE_EEPROM_A3 = 0x13,
- KEY_TYPE_EEPROM_A4 = 0x14,
- KEY_TYPE_EEPROM_A5 = 0x15,
- KEY_TYPE_EEPROM_A6 = 0x16,
- KEY_TYPE_EEPROM_A7 = 0x17,
- KEY_TYPE_EEPROM_A8 = 0x18,
- KEY_TYPE_EEPROM_A9 = 0x19,
- KEY_TYPE_EEPROM_A10 = 0x1a,
- KEY_TYPE_EEPROM_A11 = 0x1b,
- KEY_TYPE_EEPROM_A12 = 0x1c,
- KEY_TYPE_EEPROM_A13 = 0x1d,
- KEY_TYPE_EEPROM_A14 = 0x1e,
- KEY_TYPE_EEPROM_A15 = 0x1f,
-
- KEY_TYPE_EEPROM_B0 = 0x20,
- KEY_TYPE_EEPROM_B1 = 0x21,
- KEY_TYPE_EEPROM_B2 = 0x22,
- KEY_TYPE_EEPROM_B3 = 0x23,
- KEY_TYPE_EEPROM_B4 = 0x24,
- KEY_TYPE_EEPROM_B5 = 0x25,
- KEY_TYPE_EEPROM_B6 = 0x26,
- KEY_TYPE_EEPROM_B7 = 0x27,
- KEY_TYPE_EEPROM_B8 = 0x28,
- KEY_TYPE_EEPROM_B9 = 0x29,
- KEY_TYPE_EEPROM_B10 = 0x2a,
- KEY_TYPE_EEPROM_B11 = 0x2b,
- KEY_TYPE_EEPROM_B12 = 0x2c,
- KEY_TYPE_EEPROM_B13 = 0x2d,
- KEY_TYPE_EEPROM_B14 = 0x2e,
- KEY_TYPE_EEPROM_B15 = 0x2f,
-
- KEY_TYPE_A = 0xaa,
- KEY_TYPE_B = 0xbb,
-
- KEY_TYPE_A_AND_TRANSPORT_F = 0xff
- } KEY_TYPES_T;
-
- /**
- * Instantiates an SM130 object
- *
- * @param uart The UART port. Default is 0.
- * @param reset The Reset pin. Default is 13.
- */
- SM130 (int uart=SM130_DEFAULT_UART, int reset=SM130_DEFAULT_RESET_PIN);
-
- /**
- * SM130 object destructor
- */
- ~SM130 ();
-
- /**
- * Sets the baud rate for the device. The default is 19200.
- *
- * @param baud Desired baud rate, default 19200
- * @return mraa::Result value
- */
- mraa::Result setBaudRate(int baud=19200);
-
- /**
- * Gets the firmware version string.
- *
- * @return The firmware revision
- */
- std::string getFirmwareVersion();
-
- /**
- * Issues a reset command to the device.
- *
- * @return true if successful
- */
- bool reset();
-
- /**
- * Resets the device using the hardware RESET pin. This is
- * required if the device has been put to sleep using the sleep()
- * method.
- */
- void hardwareReset();
-
- /**
- * Checks to see if a tag is in the RF field, and selects it if
- * one is present.
- *
- * @return true if a tag was detected, false if no tag is present
- * or an error was detected.
- */
- bool select();
-
- /**
- * Waits for a tag to enter the RF field for up to 'timeout'
- * milliseconds. It will call select() every 100ms until 'timeout'
- * has been exceeded.
- *
- * @param timeout The number of milliseconds to wait for a tag to appear
- * @return true if a tag was detected, false if no tag was
- * detected within the timeout value, or an error occurred
- */
- bool waitForTag(uint32_t timeout);
-
- /**
- * Set the authentication key for a block. Depending on the
- * permissions on the tag, the correct key must be authenticated
- * for that block in order to perform read and write operations.
- *
- * @param block The block to authenticate for
- * @param keyType one of the KEY_TYPE_T values
- * @param key The 6 byte key to use for Type A and Type B keys
- * @return true if authentication was successful, false otherwise
- */
- bool authenticate(uint8_t block, KEY_TYPES_T keyType, std::string key="");
-
- /**
- * Read a 16 byte block. Depending on the tag, authentication of
- * the block may be required for this method to succeed.
- *
- * @param block The block to read
- * @return The 16 byte block if successful, an empty string otherwise
- */
- std::string readBlock16(uint8_t block);
-
- /**
- * Read a 4 byte value block. Depending on the tag, authentication of
- * the block may be required for this method to succeed.
- *
- * @param block The block to read
- * @return The 4 byte signed integer value block if successful, 0 otherwise
- */
- int32_t readValueBlock(uint8_t block);
-
- /**
- * Write 16 bytes to a block. Depending on the tag, authentication of
- * the block may be required for this method to succeed.
- *
- * @param block The block to write
- * @param contents A 16 byte string containing the data to write
- * @return true if successful, false otherwise
- */
- bool writeBlock16(uint8_t block, std::string contents);
-
- /**
- * Write to a 4 byte value block. Depending on the tag,
- * authentication of the block may be required for this method to
- * succeed.
- *
- * @param block The block to write
- * @param value the signed 4 byte integer to write to the value block
- * @return true if successful, false otherwise
- */
- bool writeValueBlock(uint8_t block, int32_t value);
-
- /**
- * Write 4 bytes to a block. This is typically used for
- * Ultralight tags. Depending on the tag, authentication of the
- * block may be required for this method to succeed.
- *
- * @param block The block to write
- * @param contents A 4 byte string containing the data to write
- * @return true if successful, false otherwise
- */
- bool writeBlock4(uint8_t block, std::string contents);
-
- /**
- * Write a key into one of the 16 EEPROM key slots. This can be a
- * Type A or Type B key. It is not possible to read these keys
- * once written. Once stored, the key can be used for
- * authentication without having to send the key itself. You can
- * then use the appropriate KEY_TYPE_EEPROM_* keyTypes in a call
- * to authenticate().
- *
- * @param eepromSector A number between 0 and 15, indicating the
- * EEPROM sector you want to store the key in
- * @param keyType Either KEY_TYPE_A or KEY_TYPE_B
- * @param key The 6 byte key to store in the EEPROM
- * @return true if successful, false otherwise
- */
- bool writeKey(uint8_t eepromSector, KEY_TYPES_T keyType, std::string key);
-
- /**
- * Increment or decrement a value block.
- *
- * @param block The block to adjust
- * @param value The number to increment or decrement the value block by
- * @param incr true to increment, false to decrement
- * @return The contents of the value block after the operation has
- * completed.
- */
- int32_t adjustValueBlock(uint8_t block, int32_t value, bool incr);
-
- /**
- * Turn the antenna power on or off. The power is on by default
- * after a reset. If you turn off the antenna, and methods used
- * for interacting with tags will fail until power is re-enabled.
- *
- * @param on true to enable antenna power, false to disable
- * @return true if successful, false otherwise
- */
- bool setAntennaPower(bool on);
-
- /**
- * Read the status of the 2 onboard GPIO input pins. Bit 0 is for
- * input 0, bit 1 for input 1. All other bits will be 0.
- *
- * @return bitmask of input port status values
- */
- uint8_t readPorts();
-
- /**
- * Set the output status of the 2 onboard gpio outputs. Bit 0 is for
- * output 0, bit 1 for output 1. All other bits will be discarded.
- *
- * @param val bitmask of output status bits to write
- * @return true if successful, false otherwise
- */
- bool writePorts(uint8_t val);
-
- /**
- * Halts a tag. Once a tag is halted, it cannot be accessed until
- * it is removed and reinserted into the RF field and selected.
- *
- * @return true if successful, false otherwise
- */
- bool haltTag();
-
- /**
- * Changes the baud rate of the SM130. WARNING: This is a
- * potentially dangerous command that could cause you to lose
- * contact with the device. Once the command is validated and
- * issued, the host baudrate will be changed to match, and this
- * method will wait for a response at the new baudrate for up to 1
- * second.
- *
- * If this response does not arrive, the old baudrate will be
- * restored, though there is no way to know whether the SM130
- * actually succeessfully executed the baudrate change.
- *
- * Once the SM130 has changed it's baudrate, the new value will be
- * stored in it's EEPROM, and any further access to the device
- * will need to use the new baudrate. This is true even after a
- * power on reset.
- *
- * @param baud The new baud rate to set. Valid values are 9600,
- * 19200, 38400, 57600, and 115200.
- * @return true if successful, false otherwise
- */
- bool setSM130BaudRate(int baud);
-
- /**
- * Put the SM130 to sleep. Once the device has been put to sleep,
- * the only way to wake it is via hardwareReset() or a power
- * cycle.
- *
- * @return true if successful, false otherwise
- */
- bool sleep();
-
- /**
- * Get the last error that occurred. After a successful
- * operation, this will be 0. See the datasheet for the various
- * errors that can occur in various circumstances.
- *
- * @return The last error code, or 0 if the last operation succeeded.
- */
- char getLastErrorCode() { return m_lastErrorCode; };
-
- /**
- * Get the text representation of the last error that occurred.
- * The returned string is empty if the last operation completed
- * successfully.
- *
- * @return The last error string if an error occurred, or an empty
- * string if the last operation succeeded.
- */
- std::string getLastErrorString() { return m_lastErrorString; };
-
- /**
- * Get the UID length of the currently selected tag.
- *
- * @return The UID length of the currently selected tag, or 0 if
- * no tag is currently selected.
- */
- int getUIDLen() { return m_uidLen; };
-
- /**
- * Get the UID of the currently selected tag.
- *
- * @return The UID of the currently selected tag, or an empty string if
- * no tag is currently selected.
- */
- std::string getUID() { return m_uid; };
-
- /**
- * Get the tag type of the currently selected tag.
- *
- * @return The tag type of the currently selected tag, or TAG_NONE
- * if no tag is currently selected.
- */
- TAG_TYPE_T getTagType() { return m_tagType; };
-
- /**
- * Convert the supplied tag type into a human readable string.
- *
- * @param tag One of the TAG_TYPE_T values
- * @return A string representation of the supplied tag type
- */
- std::string tag2String(TAG_TYPE_T tag);
-
- /**
- * This is a convenience function that converts a supplied string
- * into a space separated hex formatted string. This can be
- * useful for printing out binary data in a human readable format,
- * like the UID.
- *
- * @param input The string to convert
- * @return A string representation of the input in space separated
- * hex values
- */
- std::string string2HexString(std::string input);
-
- protected:
- mraa::Uart m_uart;
- mraa::Gpio m_gpioReset;
-
- std::string sendCommand(CMD_T cmd, std::string data);
- void initClock();
- uint32_t getMillis();
-
- private:
- int m_uidLen;
- std::string m_uid;
-
- char m_lastErrorCode;
- std::string m_lastErrorString;
-
- TAG_TYPE_T m_tagType;
-
- int m_baud;
-
- struct timeval m_startTime;
-
- void clearError()
- {
- m_lastErrorCode = 0;
- m_lastErrorString.clear();
- }
- };
-
-}
diff --git a/peripheral/libupm/src/ssd1351/CMakeLists.txt b/peripheral/libupm/src/ssd1351/CMakeLists.txt
deleted file mode 100644
index ee75b73..0000000
--- a/peripheral/libupm/src/ssd1351/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "ssd1351")
-set (libdescription "libupm SSD1351 SPI LCD")
-set (module_src gfx.cxx ssd1351.cxx)
-set (module_h gfx.h ssd1351.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/ssd1351/gfx.cxx b/peripheral/libupm/src/ssd1351/gfx.cxx
deleted file mode 100644
index 443932e..0000000
--- a/peripheral/libupm/src/ssd1351/gfx.cxx
+++ /dev/null
@@ -1,218 +0,0 @@
-/*
- * Authors: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Mihai Tudor Panu <mihai.tudor.panu@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 <iostream>
-#include <unistd.h>
-#include <stdlib.h>
-
-#include "gfx.h"
-
-using namespace upm;
-
-GFX::GFX (int width, int height) : m_width(width), m_height(height),
- m_textSize(1), m_textColor(0xFFFF), m_textBGColor(0x0000),
- m_cursorX(0), m_cursorY(0), m_font(font) {
-}
-
-GFX::~GFX () {
-}
-
-void
-GFX::fillScreen (uint16_t color) {
- fillRect(0, 0, m_width, m_height, color);
-}
-
-void
-GFX::fillRect (int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color) {
- for (int16_t i=x; i<x+w; i++) {
- drawFastVLine(i, y, h, color);
- }
-}
-
-void
-GFX::drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color) {
- drawLine(x, y, x, y+h-1, color);
-}
-
-void
-GFX::drawLine (int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color) {
- int16_t steep = abs(y1 - y0) > abs(x1 - x0);
-
- if (steep) {
- swap(x0, y0);
- swap(x1, y1);
- }
-
- if (x0 > x1) {
- swap(x0, x1);
- swap(y0, y1);
- }
-
- int16_t dx, dy;
- dx = x1 - x0;
- dy = abs (y1 - y0);
-
- int16_t err = dx / 2;
- int16_t ystep;
-
- if (y0 < y1) {
- ystep = 1;
- } else {
- ystep = -1;
- }
-
- for (; x0 <= x1; x0++) {
- if (steep) {
- drawPixel(y0, x0, color);
- } else {
- drawPixel(x0, y0, color);
- }
- err -= dy;
- if (err < 0) {
- y0 += ystep;
- err += dx;
- }
- }
-}
-
-void
-GFX::drawTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color) {
- drawLine(x0, y0, x1, y1, color);
- drawLine(x1, y1, x2, y2, color);
- drawLine(x2, y2, x0, y0, color);
-}
-
-void
-GFX::drawCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color) {
- int16_t f = 1 - r;
- int16_t ddF_x = 1;
- int16_t ddF_y = -2 * r;
- int16_t x = 0;
- int16_t y = r;
-
- drawPixel(x0 , y0+r, color);
- drawPixel(x0 , y0-r, color);
- drawPixel(x0+r, y0 , color);
- drawPixel(x0-r, y0 , color);
-
- while (x<y) {
- if (f >= 0) {
- y--;
- ddF_y += 2;
- f += ddF_y;
- }
- x++;
-
- ddF_x += 2;
- f += ddF_x;
-
- drawPixel(x0 + x, y0 + y, color);
- drawPixel(x0 - x, y0 + y, color);
- drawPixel(x0 + x, y0 - y, color);
- drawPixel(x0 - x, y0 - y, color);
- drawPixel(x0 + y, y0 + x, color);
- drawPixel(x0 - y, y0 + x, color);
- drawPixel(x0 + y, y0 - x, color);
- drawPixel(x0 - y, y0 - x, color);
- }
-}
-
-void
-GFX::setCursor (int16_t x, int16_t y) {
- m_cursorX = x;
- m_cursorY = y;
-}
-
-void
-GFX::setTextColor (uint16_t textColor, uint16_t textBGColor) {
- m_textColor = textColor;
- m_textBGColor = textBGColor;
-}
-
-void
-GFX::setTextSize (uint8_t size) {
- m_textSize = (size > 0) ? size : 1;
-}
-
-void
-GFX::setTextWrap (uint8_t wrap) {
- m_wrap = wrap;
-}
-
-void
-GFX::drawChar (int16_t x, int16_t y, uint8_t data, uint16_t color, uint16_t bg, uint8_t size) {
- if( (x >= m_width) || // Clip right
- (y >= m_height) || // Clip bottom
- ((x + 6 * size - 1) < 0) || // Clip left
- ((y + 8 * size - 1) < 0)) // Clip top
- return;
-
- for (int8_t i=0; i<6; i++ ) {
- uint8_t line;
- if (i == 5) {
- line = 0x0;
- } else {
- line = *(m_font+(data * 5)+i);
- for (int8_t j = 0; j<8; j++) {
- if (line & 0x1) {
- if (size == 1) // default size
- drawPixel (x+i, y+j, color);
- else { // big size
- fillRect (x+(i*size), y+(j*size), size, size, color);
- }
- } else if (bg != color) {
- if (size == 1) // default size
- drawPixel (x+i, y+j, bg);
- else { // big size
- fillRect (x+i*size, y+j*size, size, size, bg);
- }
- }
- line >>= 1;
- }
- }
- }
-}
-
-void
-GFX::print (std::string msg) {
- int len = msg.length();
-
- for (int idx = 0; idx < len; idx++) {
- if (msg[idx] == '\n') {
- m_cursorY += m_textSize * 8;
- m_cursorX = 0;
- } else if (msg[idx] == '\r') {
- // skip em
- } else {
- drawChar(m_cursorX, m_cursorY, msg[idx], m_textColor, m_textBGColor, m_textSize);
- m_cursorX += m_textSize * 6;
- if (m_wrap && ((m_cursorX + m_textSize * 6) >= m_width)) {
- m_cursorY += m_textSize * 8;
- m_cursorX = 0;
- }
- }
- }
-}
diff --git a/peripheral/libupm/src/ssd1351/gfx.h b/peripheral/libupm/src/ssd1351/gfx.h
deleted file mode 100644
index e199cd2..0000000
--- a/peripheral/libupm/src/ssd1351/gfx.h
+++ /dev/null
@@ -1,453 +0,0 @@
-/*
- * Authors: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Mihai Tudor Panu <mihai.tudor.panu@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
-
-#include <string>
-#include <stdio.h>
-#include <unistd.h>
-#include <stdint.h>
-
-#define swap(a, b) { int16_t t = a; a = b; b = t; }
-
-namespace upm {
-
-const unsigned char font[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x3E, 0x5B, 0x4F, 0x5B, 0x3E,
- 0x3E, 0x6B, 0x4F, 0x6B, 0x3E,
- 0x1C, 0x3E, 0x7C, 0x3E, 0x1C,
- 0x18, 0x3C, 0x7E, 0x3C, 0x18,
- 0x1C, 0x57, 0x7D, 0x57, 0x1C,
- 0x1C, 0x5E, 0x7F, 0x5E, 0x1C,
- 0x00, 0x18, 0x3C, 0x18, 0x00,
- 0xFF, 0xE7, 0xC3, 0xE7, 0xFF,
- 0x00, 0x18, 0x24, 0x18, 0x00,
- 0xFF, 0xE7, 0xDB, 0xE7, 0xFF,
- 0x30, 0x48, 0x3A, 0x06, 0x0E,
- 0x26, 0x29, 0x79, 0x29, 0x26,
- 0x40, 0x7F, 0x05, 0x05, 0x07,
- 0x40, 0x7F, 0x05, 0x25, 0x3F,
- 0x5A, 0x3C, 0xE7, 0x3C, 0x5A,
- 0x7F, 0x3E, 0x1C, 0x1C, 0x08,
- 0x08, 0x1C, 0x1C, 0x3E, 0x7F,
- 0x14, 0x22, 0x7F, 0x22, 0x14,
- 0x5F, 0x5F, 0x00, 0x5F, 0x5F,
- 0x06, 0x09, 0x7F, 0x01, 0x7F,
- 0x00, 0x66, 0x89, 0x95, 0x6A,
- 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x94, 0xA2, 0xFF, 0xA2, 0x94,
- 0x08, 0x04, 0x7E, 0x04, 0x08,
- 0x10, 0x20, 0x7E, 0x20, 0x10,
- 0x08, 0x08, 0x2A, 0x1C, 0x08,
- 0x08, 0x1C, 0x2A, 0x08, 0x08,
- 0x1E, 0x10, 0x10, 0x10, 0x10,
- 0x0C, 0x1E, 0x0C, 0x1E, 0x0C,
- 0x30, 0x38, 0x3E, 0x38, 0x30,
- 0x06, 0x0E, 0x3E, 0x0E, 0x06,
- 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x5F, 0x00, 0x00,
- 0x00, 0x07, 0x00, 0x07, 0x00,
- 0x14, 0x7F, 0x14, 0x7F, 0x14,
- 0x24, 0x2A, 0x7F, 0x2A, 0x12,
- 0x23, 0x13, 0x08, 0x64, 0x62,
- 0x36, 0x49, 0x56, 0x20, 0x50,
- 0x00, 0x08, 0x07, 0x03, 0x00,
- 0x00, 0x1C, 0x22, 0x41, 0x00,
- 0x00, 0x41, 0x22, 0x1C, 0x00,
- 0x2A, 0x1C, 0x7F, 0x1C, 0x2A,
- 0x08, 0x08, 0x3E, 0x08, 0x08,
- 0x00, 0x80, 0x70, 0x30, 0x00,
- 0x08, 0x08, 0x08, 0x08, 0x08,
- 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x20, 0x10, 0x08, 0x04, 0x02,
- 0x3E, 0x51, 0x49, 0x45, 0x3E,
- 0x00, 0x42, 0x7F, 0x40, 0x00,
- 0x72, 0x49, 0x49, 0x49, 0x46,
- 0x21, 0x41, 0x49, 0x4D, 0x33,
- 0x18, 0x14, 0x12, 0x7F, 0x10,
- 0x27, 0x45, 0x45, 0x45, 0x39,
- 0x3C, 0x4A, 0x49, 0x49, 0x31,
- 0x41, 0x21, 0x11, 0x09, 0x07,
- 0x36, 0x49, 0x49, 0x49, 0x36,
- 0x46, 0x49, 0x49, 0x29, 0x1E,
- 0x00, 0x00, 0x14, 0x00, 0x00,
- 0x00, 0x40, 0x34, 0x00, 0x00,
- 0x00, 0x08, 0x14, 0x22, 0x41,
- 0x14, 0x14, 0x14, 0x14, 0x14,
- 0x00, 0x41, 0x22, 0x14, 0x08,
- 0x02, 0x01, 0x59, 0x09, 0x06,
- 0x3E, 0x41, 0x5D, 0x59, 0x4E,
- 0x7C, 0x12, 0x11, 0x12, 0x7C,
- 0x7F, 0x49, 0x49, 0x49, 0x36,
- 0x3E, 0x41, 0x41, 0x41, 0x22,
- 0x7F, 0x41, 0x41, 0x41, 0x3E,
- 0x7F, 0x49, 0x49, 0x49, 0x41,
- 0x7F, 0x09, 0x09, 0x09, 0x01,
- 0x3E, 0x41, 0x41, 0x51, 0x73,
- 0x7F, 0x08, 0x08, 0x08, 0x7F,
- 0x00, 0x41, 0x7F, 0x41, 0x00,
- 0x20, 0x40, 0x41, 0x3F, 0x01,
- 0x7F, 0x08, 0x14, 0x22, 0x41,
- 0x7F, 0x40, 0x40, 0x40, 0x40,
- 0x7F, 0x02, 0x1C, 0x02, 0x7F,
- 0x7F, 0x04, 0x08, 0x10, 0x7F,
- 0x3E, 0x41, 0x41, 0x41, 0x3E,
- 0x7F, 0x09, 0x09, 0x09, 0x06,
- 0x3E, 0x41, 0x51, 0x21, 0x5E,
- 0x7F, 0x09, 0x19, 0x29, 0x46,
- 0x26, 0x49, 0x49, 0x49, 0x32,
- 0x03, 0x01, 0x7F, 0x01, 0x03,
- 0x3F, 0x40, 0x40, 0x40, 0x3F,
- 0x1F, 0x20, 0x40, 0x20, 0x1F,
- 0x3F, 0x40, 0x38, 0x40, 0x3F,
- 0x63, 0x14, 0x08, 0x14, 0x63,
- 0x03, 0x04, 0x78, 0x04, 0x03,
- 0x61, 0x59, 0x49, 0x4D, 0x43,
- 0x00, 0x7F, 0x41, 0x41, 0x41,
- 0x02, 0x04, 0x08, 0x10, 0x20,
- 0x00, 0x41, 0x41, 0x41, 0x7F,
- 0x04, 0x02, 0x01, 0x02, 0x04,
- 0x40, 0x40, 0x40, 0x40, 0x40,
- 0x00, 0x03, 0x07, 0x08, 0x00,
- 0x20, 0x54, 0x54, 0x78, 0x40,
- 0x7F, 0x28, 0x44, 0x44, 0x38,
- 0x38, 0x44, 0x44, 0x44, 0x28,
- 0x38, 0x44, 0x44, 0x28, 0x7F,
- 0x38, 0x54, 0x54, 0x54, 0x18,
- 0x00, 0x08, 0x7E, 0x09, 0x02,
- 0x18, 0xA4, 0xA4, 0x9C, 0x78,
- 0x7F, 0x08, 0x04, 0x04, 0x78,
- 0x00, 0x44, 0x7D, 0x40, 0x00,
- 0x20, 0x40, 0x40, 0x3D, 0x00,
- 0x7F, 0x10, 0x28, 0x44, 0x00,
- 0x00, 0x41, 0x7F, 0x40, 0x00,
- 0x7C, 0x04, 0x78, 0x04, 0x78,
- 0x7C, 0x08, 0x04, 0x04, 0x78,
- 0x38, 0x44, 0x44, 0x44, 0x38,
- 0xFC, 0x18, 0x24, 0x24, 0x18,
- 0x18, 0x24, 0x24, 0x18, 0xFC,
- 0x7C, 0x08, 0x04, 0x04, 0x08,
- 0x48, 0x54, 0x54, 0x54, 0x24,
- 0x04, 0x04, 0x3F, 0x44, 0x24,
- 0x3C, 0x40, 0x40, 0x20, 0x7C,
- 0x1C, 0x20, 0x40, 0x20, 0x1C,
- 0x3C, 0x40, 0x30, 0x40, 0x3C,
- 0x44, 0x28, 0x10, 0x28, 0x44,
- 0x4C, 0x90, 0x90, 0x90, 0x7C,
- 0x44, 0x64, 0x54, 0x4C, 0x44,
- 0x00, 0x08, 0x36, 0x41, 0x00,
- 0x00, 0x00, 0x77, 0x00, 0x00,
- 0x00, 0x41, 0x36, 0x08, 0x00,
- 0x02, 0x01, 0x02, 0x04, 0x02,
- 0x3C, 0x26, 0x23, 0x26, 0x3C,
- 0x1E, 0xA1, 0xA1, 0x61, 0x12,
- 0x3A, 0x40, 0x40, 0x20, 0x7A,
- 0x38, 0x54, 0x54, 0x55, 0x59,
- 0x21, 0x55, 0x55, 0x79, 0x41,
- 0x21, 0x54, 0x54, 0x78, 0x41,
- 0x21, 0x55, 0x54, 0x78, 0x40,
- 0x20, 0x54, 0x55, 0x79, 0x40,
- 0x0C, 0x1E, 0x52, 0x72, 0x12,
- 0x39, 0x55, 0x55, 0x55, 0x59,
- 0x39, 0x54, 0x54, 0x54, 0x59,
- 0x39, 0x55, 0x54, 0x54, 0x58,
- 0x00, 0x00, 0x45, 0x7C, 0x41,
- 0x00, 0x02, 0x45, 0x7D, 0x42,
- 0x00, 0x01, 0x45, 0x7C, 0x40,
- 0xF0, 0x29, 0x24, 0x29, 0xF0,
- 0xF0, 0x28, 0x25, 0x28, 0xF0,
- 0x7C, 0x54, 0x55, 0x45, 0x00,
- 0x20, 0x54, 0x54, 0x7C, 0x54,
- 0x7C, 0x0A, 0x09, 0x7F, 0x49,
- 0x32, 0x49, 0x49, 0x49, 0x32,
- 0x32, 0x48, 0x48, 0x48, 0x32,
- 0x32, 0x4A, 0x48, 0x48, 0x30,
- 0x3A, 0x41, 0x41, 0x21, 0x7A,
- 0x3A, 0x42, 0x40, 0x20, 0x78,
- 0x00, 0x9D, 0xA0, 0xA0, 0x7D,
- 0x39, 0x44, 0x44, 0x44, 0x39,
- 0x3D, 0x40, 0x40, 0x40, 0x3D,
- 0x3C, 0x24, 0xFF, 0x24, 0x24,
- 0x48, 0x7E, 0x49, 0x43, 0x66,
- 0x2B, 0x2F, 0xFC, 0x2F, 0x2B,
- 0xFF, 0x09, 0x29, 0xF6, 0x20,
- 0xC0, 0x88, 0x7E, 0x09, 0x03,
- 0x20, 0x54, 0x54, 0x79, 0x41,
- 0x00, 0x00, 0x44, 0x7D, 0x41,
- 0x30, 0x48, 0x48, 0x4A, 0x32,
- 0x38, 0x40, 0x40, 0x22, 0x7A,
- 0x00, 0x7A, 0x0A, 0x0A, 0x72,
- 0x7D, 0x0D, 0x19, 0x31, 0x7D,
- 0x26, 0x29, 0x29, 0x2F, 0x28,
- 0x26, 0x29, 0x29, 0x29, 0x26,
- 0x30, 0x48, 0x4D, 0x40, 0x20,
- 0x38, 0x08, 0x08, 0x08, 0x08,
- 0x08, 0x08, 0x08, 0x08, 0x38,
- 0x2F, 0x10, 0xC8, 0xAC, 0xBA,
- 0x2F, 0x10, 0x28, 0x34, 0xFA,
- 0x00, 0x00, 0x7B, 0x00, 0x00,
- 0x08, 0x14, 0x2A, 0x14, 0x22,
- 0x22, 0x14, 0x2A, 0x14, 0x08,
- 0xAA, 0x00, 0x55, 0x00, 0xAA,
- 0xAA, 0x55, 0xAA, 0x55, 0xAA,
- 0x00, 0x00, 0x00, 0xFF, 0x00,
- 0x10, 0x10, 0x10, 0xFF, 0x00,
- 0x14, 0x14, 0x14, 0xFF, 0x00,
- 0x10, 0x10, 0xFF, 0x00, 0xFF,
- 0x10, 0x10, 0xF0, 0x10, 0xF0,
- 0x14, 0x14, 0x14, 0xFC, 0x00,
- 0x14, 0x14, 0xF7, 0x00, 0xFF,
- 0x00, 0x00, 0xFF, 0x00, 0xFF,
- 0x14, 0x14, 0xF4, 0x04, 0xFC,
- 0x14, 0x14, 0x17, 0x10, 0x1F,
- 0x10, 0x10, 0x1F, 0x10, 0x1F,
- 0x14, 0x14, 0x14, 0x1F, 0x00,
- 0x10, 0x10, 0x10, 0xF0, 0x00,
- 0x00, 0x00, 0x00, 0x1F, 0x10,
- 0x10, 0x10, 0x10, 0x1F, 0x10,
- 0x10, 0x10, 0x10, 0xF0, 0x10,
- 0x00, 0x00, 0x00, 0xFF, 0x10,
- 0x10, 0x10, 0x10, 0x10, 0x10,
- 0x10, 0x10, 0x10, 0xFF, 0x10,
- 0x00, 0x00, 0x00, 0xFF, 0x14,
- 0x00, 0x00, 0xFF, 0x00, 0xFF,
- 0x00, 0x00, 0x1F, 0x10, 0x17,
- 0x00, 0x00, 0xFC, 0x04, 0xF4,
- 0x14, 0x14, 0x17, 0x10, 0x17,
- 0x14, 0x14, 0xF4, 0x04, 0xF4,
- 0x00, 0x00, 0xFF, 0x00, 0xF7,
- 0x14, 0x14, 0x14, 0x14, 0x14,
- 0x14, 0x14, 0xF7, 0x00, 0xF7,
- 0x14, 0x14, 0x14, 0x17, 0x14,
- 0x10, 0x10, 0x1F, 0x10, 0x1F,
- 0x14, 0x14, 0x14, 0xF4, 0x14,
- 0x10, 0x10, 0xF0, 0x10, 0xF0,
- 0x00, 0x00, 0x1F, 0x10, 0x1F,
- 0x00, 0x00, 0x00, 0x1F, 0x14,
- 0x00, 0x00, 0x00, 0xFC, 0x14,
- 0x00, 0x00, 0xF0, 0x10, 0xF0,
- 0x10, 0x10, 0xFF, 0x10, 0xFF,
- 0x14, 0x14, 0x14, 0xFF, 0x14,
- 0x10, 0x10, 0x10, 0x1F, 0x00,
- 0x00, 0x00, 0x00, 0xF0, 0x10,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
- 0xFF, 0xFF, 0xFF, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0xFF, 0xFF,
- 0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
- 0x38, 0x44, 0x44, 0x38, 0x44,
- 0x7C, 0x2A, 0x2A, 0x3E, 0x14,
- 0x7E, 0x02, 0x02, 0x06, 0x06,
- 0x02, 0x7E, 0x02, 0x7E, 0x02,
- 0x63, 0x55, 0x49, 0x41, 0x63,
- 0x38, 0x44, 0x44, 0x3C, 0x04,
- 0x40, 0x7E, 0x20, 0x1E, 0x20,
- 0x06, 0x02, 0x7E, 0x02, 0x02,
- 0x99, 0xA5, 0xE7, 0xA5, 0x99,
- 0x1C, 0x2A, 0x49, 0x2A, 0x1C,
- 0x4C, 0x72, 0x01, 0x72, 0x4C,
- 0x30, 0x4A, 0x4D, 0x4D, 0x30,
- 0x30, 0x48, 0x78, 0x48, 0x30,
- 0xBC, 0x62, 0x5A, 0x46, 0x3D,
- 0x3E, 0x49, 0x49, 0x49, 0x00,
- 0x7E, 0x01, 0x01, 0x01, 0x7E,
- 0x2A, 0x2A, 0x2A, 0x2A, 0x2A,
- 0x44, 0x44, 0x5F, 0x44, 0x44,
- 0x40, 0x51, 0x4A, 0x44, 0x40,
- 0x40, 0x44, 0x4A, 0x51, 0x40,
- 0x00, 0x00, 0xFF, 0x01, 0x03,
- 0xE0, 0x80, 0xFF, 0x00, 0x00,
- 0x08, 0x08, 0x6B, 0x6B, 0x08,
- 0x36, 0x12, 0x36, 0x24, 0x36,
- 0x06, 0x0F, 0x09, 0x0F, 0x06,
- 0x00, 0x00, 0x18, 0x18, 0x00,
- 0x00, 0x00, 0x10, 0x10, 0x00,
- 0x30, 0x40, 0xFF, 0x01, 0x01,
- 0x00, 0x1F, 0x01, 0x01, 0x1E,
- 0x00, 0x19, 0x1D, 0x17, 0x12,
- 0x00, 0x3C, 0x3C, 0x3C, 0x3C,
- 0x00, 0x00, 0x00, 0x00, 0x00
-};
-
-/**
- * @brief GFX helper class
- *
- * This file is used by the screen.
- */
-class GFX {
- public:
- /**
- * Instantiates a GFX object
- *
- * @param width Screen width
- * @param height Screen height
- */
- GFX (int width, int height);
-
- /**
- * GFX object destructor
- */
- ~GFX ();
-
- /**
- * Sends a pixel color (RGB) to the chip. Must be implemented by the
- * inherited class.
- *
- * @param x Axis on the horizontal scale
- * @param y Axis on the vertical scale
- * @param color RGB value
- */
- virtual void drawPixel (int16_t x, int16_t y, uint16_t color) = 0;
-
- /**
- * Copies the buffer to the chip via the SPI.
- */
- virtual void refresh () = 0;
-
- /**
- *
- *
- * @param x Axis on the horizontal scale
- * @param y Axis on the vertical scale
- * @param data Character to write
- * @param color Character color
- * @param bg Character background color
- * @param size Size of the font
- */
- void drawChar (int16_t x, int16_t y, uint8_t data, uint16_t color, uint16_t bg, uint8_t size);
-
- /**
- * Prints a message on the screen
- *
- * @param msg Message to print
- */
- void print (std::string msg);
-
- /**
- * Fills the screen with a selected color
- *
- * @param color Selected color
- */
- void fillScreen (uint16_t color);
-
- /**
- * Fills a rectangle with a selected color
- *
- * @param x Axis on the horizontal scale (top-left corner)
- * @param y Axis on the vertical scale (top-left corner)
- * @param w Distanse from x
- * @param h Distanse from y
- * @param color Selected color
- */
- void fillRect (int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color);
-
- /**
- * Draws a line on the vertical scale
- *
- * @param x Axis on the horizontal scale
- * @param y Axis on the vertical scale
- * @param h Distanse from y
- * @param color Selected color
- */
- void drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color);
-
- /**
- * Draws a line from coordinate C0 to coordinate C1
- *
- * @param x0 First coordinate
- * @param y0 First coordinate
- * @param x1 Second coordinate
- * @param y1 Second coordinate
- * @param color selected color
- */
- void drawLine (int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color);
-
- /**
- * Draws a triangle
- *
- * @param x0 First coordinate
- * @param y0 First coordinate
- * @param x1 Second coordinate
- * @param y1 Second coordinate
- * @param x2 Third coordinate
- * @param y2 Third coordinate
- * @param color Selected color
- */
- void drawTriangle (int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color);
-
- /**
- * Draws a circle
- *
- * @param x Center of the circle on the horizontal scale
- * @param y Center of the circle on the vertical scale
- * @param r Radius of the circle
- * @param color Color of the circle
- */
- void drawCircle (int16_t x, int16_t y, int16_t r, uint16_t color);
-
- /**
- * Sets the cursor for a text message
- *
- * @param x Axis on the horizontal scale
- * @param y Axis on the vertical scale
- */
- void setCursor (int16_t x, int16_t y);
-
- /**
- * Sets a text color for a message
- *
- * @param textColor Font color
- * @param textBGColor Background color
- */
- void setTextColor (uint16_t textColor, uint16_t textBGColor);
-
- /**
- * Sets the size of the font
- *
- * @param size Font size
- */
- void setTextSize (uint8_t size);
-
- /**
- * Wraps a printed message
- *
- * @param wrap True (0x1) or false (0x0)
- */
- void setTextWrap (uint8_t wrap);
-
- protected:
- int m_width; /**< Screen width */
- int m_height; /**< Screen height */
- int m_textSize; /**< Printed text size */
- int m_textColor; /**< Printed text color */
- int m_textBGColor; /**< Printed text background color */
- int m_cursorX; /**< Cursor X coordinate */
- int m_cursorY; /**< Cursor Y coordinate */
- int m_wrap; /**< Wrapper flag (true or false) */
-
- const unsigned char * m_font;
- };
-}
diff --git a/peripheral/libupm/src/ssd1351/javaupm_ssd1351.i b/peripheral/libupm/src/ssd1351/javaupm_ssd1351.i
deleted file mode 100644
index 7adb59a..0000000
--- a/peripheral/libupm/src/ssd1351/javaupm_ssd1351.i
+++ /dev/null
@@ -1,28 +0,0 @@
-%module javaupm_ssd1351
-%include "../upm.i"
-%include "typemaps.i"
-%include "stdint.i"
-
-%ignore m_map;
-%ignore font;
-
-%include "gfx.h"
-%{
- #include "gfx.h"
-%}
-
-%include "ssd1351.h"
-%{
- #include "ssd1351.h"
-%}
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_ssd1351");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/ssd1351/jsupm_ssd1351.i b/peripheral/libupm/src/ssd1351/jsupm_ssd1351.i
deleted file mode 100644
index b096151..0000000
--- a/peripheral/libupm/src/ssd1351/jsupm_ssd1351.i
+++ /dev/null
@@ -1,12 +0,0 @@
-%module jsupm_ssd1351
-%include "../upm.i"
-
-%include "gfx.h"
-%{
- #include "gfx.h"
-%}
-
-%include "ssd1351.h"
-%{
- #include "ssd1351.h"
-%}
diff --git a/peripheral/libupm/src/ssd1351/pyupm_ssd1351.i b/peripheral/libupm/src/ssd1351/pyupm_ssd1351.i
deleted file mode 100644
index fee480d..0000000
--- a/peripheral/libupm/src/ssd1351/pyupm_ssd1351.i
+++ /dev/null
@@ -1,17 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_ssd1351
-%include "../upm.i"
-
-%feature("autodoc", "3");
-%rename("printString") print(std::string msg);
-
-%include "gfx.h"
-%{
- #include "gfx.h"
-%}
-
-%include "ssd1351.h"
-%{
- #include "ssd1351.h"
-%}
diff --git a/peripheral/libupm/src/ssd1351/ssd1351.cxx b/peripheral/libupm/src/ssd1351/ssd1351.cxx
deleted file mode 100644
index 2103603..0000000
--- a/peripheral/libupm/src/ssd1351/ssd1351.cxx
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
- * Author: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
- * Copyright (c) 2016 Intel Corporation.
- *
- * Based on Adafruit SSD1351 library.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <string>
-#include <stdexcept>
-#include <unistd.h>
-#include <stdlib.h>
-
-#include "ssd1351.h"
-
-using namespace upm;
-using namespace std;
-
-SSD1351::SSD1351 (uint8_t oc, uint8_t dc, uint8_t rst) :
- GFX(SSD1351WIDTH, SSD1351HEIGHT),
- m_spi(0), m_oc(oc), m_dc(dc), m_rst(rst) {
-
- m_name = "SSD1351";
- m_usemap = true;
-
- // Setup SPI bus
- m_spi.frequency(8 * 1000000);
- m_spi.mode(mraa::SPI_MODE3);
- m_spi.writeByte(0x00); // Need to bring clk high before init
-
- // Init pins
- if (m_oc.dir(mraa::DIR_OUT) != mraa::SUCCESS) {
- throw std::runtime_error(string(__FUNCTION__) +
- ": Could not initialize CS pin");
- return;
- }
- m_oc.useMmap(true);
- if (m_dc.dir(mraa::DIR_OUT) != mraa::SUCCESS) {
- throw std::runtime_error(string(__FUNCTION__) +
- ": Could not initialize data/cmd pin");
- return;
- }
- m_dc.useMmap(true);
- if (m_rst.dir(mraa::DIR_OUT) != mraa::SUCCESS) {
- throw std::runtime_error(string(__FUNCTION__) +
- ": Could not initialize reset pin");
- return;
- }
-
- // Toggle reset pin
- ocLow();
- m_rst.write(1);
- usleep(500000);
- m_rst.write(0);
- usleep(500000);
- m_rst.write(1);
- usleep(500000);
-
- // Configure and init display
- writeCommand(SSD1351_CMD_COMMANDLOCK);
- writeData(0x12);
-
- writeCommand(SSD1351_CMD_COMMANDLOCK);
- writeData(0xB1);
-
- writeCommand(SSD1351_CMD_DISPLAYOFF);
-
- writeCommand(SSD1351_CMD_CLOCKDIV);
- writeCommand(0xF1);
-
- writeCommand(SSD1351_CMD_MUXRATIO);
- writeData(127);
-
- writeCommand(SSD1351_CMD_SETREMAP);
- writeData(0x74);
-
- writeCommand(SSD1351_CMD_SETCOLUMN);
- writeData(0x00);
- writeData(0x7F);
-
- writeCommand(SSD1351_CMD_SETROW);
- writeData(0x00);
- writeData(0x7F);
-
- writeCommand(SSD1351_CMD_STARTLINE);
- if (SSD1351HEIGHT == 96) {
- writeData(96);
- } else {
- writeData(0);
- }
-
- writeCommand(SSD1351_CMD_DISPLAYOFFSET);
- writeData(0x0);
-
- writeCommand(SSD1351_CMD_SETGPIO);
- writeData(0x00);
-
- writeCommand(SSD1351_CMD_FUNCTIONSELECT);
- writeData(0x01);
-
- writeCommand(SSD1351_CMD_PRECHARGE);
- writeCommand(0x32);
-
- writeCommand(SSD1351_CMD_VCOMH);
- writeCommand(0x05);
-
- writeCommand(SSD1351_CMD_NORMALDISPLAY);
-
- writeCommand(SSD1351_CMD_CONTRASTABC);
- writeData(0xC8);
- writeData(0x80);
- writeData(0xC8);
-
- writeCommand(SSD1351_CMD_CONTRASTMASTER);
- writeData(0x0F);
-
- writeCommand(SSD1351_CMD_SETVSL );
- writeData(0xA0);
- writeData(0xB5);
- writeData(0x55);
-
- writeCommand(SSD1351_CMD_PRECHARGE2);
- writeData(0x01);
-
- writeCommand(SSD1351_CMD_DISPLAYON);
-}
-
-SSD1351::~SSD1351() {
-}
-
-void
-SSD1351::writeCommand (uint8_t value) {
- dcLow();
- m_spi.writeByte(value);
-}
-
-void
-SSD1351::writeData (uint8_t value) {
- dcHigh ();
- m_spi.writeByte(value);
-}
-
-void
-SSD1351::drawPixel(int16_t x, int16_t y, uint16_t color) {
- if ((x < 0) || (y < 0) || (x >= SSD1351WIDTH) || (y >= SSD1351HEIGHT))
- return;
-
- if(m_usemap) {
- int index = (y * SSD1351WIDTH + x) * 2;
- m_map[index] = color >> 8;
- m_map[index + 1] = color;
- } else {
- writeCommand(SSD1351_CMD_SETCOLUMN);
- writeData(x);
- writeData(SSD1351WIDTH-1);
-
- writeCommand(SSD1351_CMD_SETROW);
- writeData(y);
- writeData(SSD1351HEIGHT-1);
-
- writeCommand(SSD1351_CMD_WRITERAM);
- writeData(color >> 8);
- writeData(color);
- }
-}
-void
-SSD1351::refresh () {
- writeCommand(SSD1351_CMD_WRITERAM);
- int blockSize = SSD1351HEIGHT * SSD1351WIDTH * 2 / BLOCKS;
- dcHigh();
- for (int block = 0; block < BLOCKS; block++) {
- m_spi.write(&m_map[block * blockSize], blockSize);
- }
-}
-void
-SSD1351::ocLow() {
- if (m_oc.write(LOW) != mraa::SUCCESS) {
- throw std::runtime_error(string(__FUNCTION__) +
- ": Failed to write CS pin");
- }
-}
-void
-SSD1351::ocHigh() {
- if (m_oc.write(HIGH) != mraa::SUCCESS) {
- throw std::runtime_error(string(__FUNCTION__) +
- ": Failed to write CS pin");
- }
-}
-void
-SSD1351::dcLow() {
- if (m_dc.write(LOW) != mraa::SUCCESS) {
- throw std::runtime_error(string(__FUNCTION__) +
- ": Failed to write data/cmd pin");
- }
-}
-void
-SSD1351::dcHigh() {
- if (m_dc.write(HIGH) != mraa::SUCCESS) {
- throw std::runtime_error(string(__FUNCTION__) +
- ": Failed to write data/cmd pin");
- }
-}
-void
-upm::SSD1351::useMemoryMap(bool var) {
- m_usemap = var;
-}
diff --git a/peripheral/libupm/src/ssd1351/ssd1351.h b/peripheral/libupm/src/ssd1351/ssd1351.h
deleted file mode 100644
index 6f23c66..0000000
--- a/peripheral/libupm/src/ssd1351/ssd1351.h
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * Author: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
- * Copyright (c) 2016 Intel Corporation.
- *
- * Based on Adafruit SSD1351 library.
- *
- * 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 <string>
-
-#include <mraa/common.hpp>
-#include <mraa/gpio.hpp>
-#include <mraa/spi.hpp>
-#include "gfx.h"
-
-// Display Size
-#define SSD1351WIDTH 128
-#define SSD1351HEIGHT 128 // Set this to 96 for 1.27"
-
-// SSD1351 Commands
-#define SSD1351_CMD_SETCOLUMN 0x15
-#define SSD1351_CMD_SETROW 0x75
-#define SSD1351_CMD_WRITERAM 0x5C
-#define SSD1351_CMD_READRAM 0x5D
-#define SSD1351_CMD_SETREMAP 0xA0
-#define SSD1351_CMD_STARTLINE 0xA1
-#define SSD1351_CMD_DISPLAYOFFSET 0xA2
-#define SSD1351_CMD_DISPLAYALLOFF 0xA4
-#define SSD1351_CMD_DISPLAYALLON 0xA5
-#define SSD1351_CMD_NORMALDISPLAY 0xA6
-#define SSD1351_CMD_INVERTDISPLAY 0xA7
-#define SSD1351_CMD_FUNCTIONSELECT 0xAB
-#define SSD1351_CMD_DISPLAYOFF 0xAE
-#define SSD1351_CMD_DISPLAYON 0xAF
-#define SSD1351_CMD_PRECHARGE 0xB1
-#define SSD1351_CMD_DISPLAYENHANCE 0xB2
-#define SSD1351_CMD_CLOCKDIV 0xB3
-#define SSD1351_CMD_SETVSL 0xB4
-#define SSD1351_CMD_SETGPIO 0xB5
-#define SSD1351_CMD_PRECHARGE2 0xB6
-#define SSD1351_CMD_SETGRAY 0xB8
-#define SSD1351_CMD_USELUT 0xB9
-#define SSD1351_CMD_PRECHARGELEVEL 0xBB
-#define SSD1351_CMD_VCOMH 0xBE
-#define SSD1351_CMD_CONTRASTABC 0xC1
-#define SSD1351_CMD_CONTRASTMASTER 0xC7
-#define SSD1351_CMD_MUXRATIO 0xCA
-#define SSD1351_CMD_COMMANDLOCK 0xFD
-#define SSD1351_CMD_HORIZSCROLL 0x96
-#define SSD1351_CMD_STOPSCROLL 0x9E
-#define SSD1351_CMD_STARTSCROLL 0x9F
-
-#define HIGH 1
-#define LOW 0
-
-// Number of blocks for SPI transfer of buffer
-#define BLOCKS 8
-
-namespace upm {
-/**
- * @brief SSD1351 OLED library
- * @defgroup ssd1351 libupm-ssd1351
- * @ingroup adafruit spi display
- */
-/**
- * @library ssd1351
- * @sensor ssd1351
- * @comname SSD1351 OLED
- * @type display
- * @man adafruit
- * @web http://www.adafruit.com/products/1431
- * @con spi
- *
- * @brief API for SSD1351 OLED displays
- *
- * This module defines the interface for the SSD1351 display library
- *
- * @image html ssd1351.jpg
- * @snippet ssd1351.cxx Interesting
- */
-class SSD1351 : public GFX{
- public:
- /**
- * Instantiates an SSD1351 object
- *
- * @param oc LCD chip select pin
- * @param dc Data/command pin
- * @param rst Reset pin
- */
- SSD1351 (uint8_t oc, uint8_t dc, uint8_t rst);
-
- /**
- * SSD1351 object destructor
- */
- ~SSD1351();
-
- /**
- * Returns the name of the component
- */
- std::string name()
- {
- return m_name;
- }
-
- /**
- * Sends a command to an SPI bus
- *
- * @param value Command
- */
- void writeCommand (uint8_t value);
-
- /**
- * Sends data to an SPI bus
- *
- * @param value Data
- */
- void writeData (uint8_t value);
- /**
- * Sends a pixel color (RGB) to the display buffer or chip
- *
- * @param x Axis on the horizontal scale
- * @param y Axis on the vertical scale
- * @param color RGB (16-bit) color (R[0-4], G[5-10], B[11-15])
- */
- void drawPixel (int16_t x, int16_t y, uint16_t color);
-
- /**
- * Copies the buffer to the chip via the SPI bus
- */
- void refresh ();
-
- /**
- * Set OLED chip select LOW
- */
- void ocLow ();
-
- /**
- * Set OLED chip select HIGH
- */
- void ocHigh ();
-
- /**
- * Data select LOW
- */
- void dcLow ();
-
- /**
- * Data select HIGH
- */
- void dcHigh ();
-
- /**
- * Use memory mapped (buffered) writes to the display
- *
- * @param var true for yes (default), false for no
- */
- void useMemoryMap (bool var);
- private:
- mraa::Spi m_spi;
- uint8_t m_map[SSD1351HEIGHT * SSD1351WIDTH * 2]; /**< Screen buffer */
- bool m_usemap;
-
- mraa::Gpio m_oc;
- mraa::Gpio m_dc;
- mraa::Gpio m_rst;
-
- std::string m_name;
-};
-}
diff --git a/peripheral/libupm/src/st7735/CMakeLists.txt b/peripheral/libupm/src/st7735/CMakeLists.txt
deleted file mode 100644
index f3b3a37..0000000
--- a/peripheral/libupm/src/st7735/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "st7735")
-set (libdescription "libupm SPI LCD")
-set (module_src gfx.cxx st7735.cxx)
-set (module_h gfx.h st7735.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/st7735/gfx.cxx b/peripheral/libupm/src/st7735/gfx.cxx
deleted file mode 100644
index 80cd2db..0000000
--- a/peripheral/libupm/src/st7735/gfx.cxx
+++ /dev/null
@@ -1,231 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <unistd.h>
-#include <stdlib.h>
-
-#include "gfx.h"
-
-using namespace upm;
-
-GFX::GFX (int width, int height, uint8_t * screenBuffer, const unsigned char * font) : WIDTH(width), HEIGHT(height) {
- m_height = height;
- m_width = width;
- m_font = font;
- m_map = screenBuffer;
-}
-
-GFX::~GFX () {
-}
-
-mraa::Result
-GFX::setPixel (int x, int y, uint16_t color) {
- if((x < 0) ||(x >= m_width) || (y < 0) || (y >= m_height)) {
- return mraa::ERROR_UNSPECIFIED;
- }
-
- int index = ((y * m_width) + x) * sizeof(uint16_t);
- m_map[index] = (uint8_t) (color >> 8);
- m_map[++index] = (uint8_t)(color);
-
- return mraa::SUCCESS;
-}
-
-void
-GFX::fillScreen (uint16_t color) {
- fillRect(0, 0, m_width, m_height, color);
-}
-
-void
-GFX::fillRect (int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color) {
- for (int16_t i=x; i<x+w; i++) {
- drawFastVLine(i, y, h, color);
- }
-}
-
-void
-GFX::drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color) {
- drawLine(x, y, x, y+h-1, color);
-}
-
-void
-GFX::drawLine (int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color) {
- int16_t steep = abs(y1 - y0) > abs(x1 - x0);
-
- if (steep) {
- swap(x0, y0);
- swap(x1, y1);
- }
-
- if (x0 > x1) {
- swap(x0, x1);
- swap(y0, y1);
- }
-
- int16_t dx, dy;
- dx = x1 - x0;
- dy = abs (y1 - y0);
-
- int16_t err = dx / 2;
- int16_t ystep;
-
- if (y0 < y1) {
- ystep = 1;
- } else {
- ystep = -1;
- }
-
- for (; x0 <= x1; x0++) {
- if (steep) {
- setPixel(y0, x0, color);
- } else {
- setPixel(x0, y0, color);
- }
- err -= dy;
- if (err < 0) {
- y0 += ystep;
- err += dx;
- }
- }
-}
-
-void
-GFX::drawTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color) {
- drawLine(x0, y0, x1, y1, color);
- drawLine(x1, y1, x2, y2, color);
- drawLine(x2, y2, x0, y0, color);
-}
-
-void
-GFX::drawCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color) {
- int16_t f = 1 - r;
- int16_t ddF_x = 1;
- int16_t ddF_y = -2 * r;
- int16_t x = 0;
- int16_t y = r;
-
- setPixel(x0 , y0+r, color);
- setPixel(x0 , y0-r, color);
- setPixel(x0+r, y0 , color);
- setPixel(x0-r, y0 , color);
-
- while (x<y) {
- if (f >= 0) {
- y--;
- ddF_y += 2;
- f += ddF_y;
- }
- x++;
-
- ddF_x += 2;
- f += ddF_x;
-
- setPixel(x0 + x, y0 + y, color);
- setPixel(x0 - x, y0 + y, color);
- setPixel(x0 + x, y0 - y, color);
- setPixel(x0 - x, y0 - y, color);
- setPixel(x0 + y, y0 + x, color);
- setPixel(x0 - y, y0 + x, color);
- setPixel(x0 + y, y0 - x, color);
- setPixel(x0 - y, y0 - x, color);
- }
-}
-
-void
-GFX::setCursor (int16_t x, int16_t y) {
- m_cursorX = x;
- m_cursorY = y;
-}
-
-void
-GFX::setTextColor (uint16_t textColor, uint16_t textBGColor) {
- m_textColor = textColor;
- m_textBGColor = textBGColor;
-}
-
-void
-GFX::setTextSize (uint8_t size) {
- m_textSize = (size > 0) ? size : 1;
-}
-
-void
-GFX::setTextWrap (uint8_t wrap) {
- m_wrap = wrap;
-}
-
-void
-GFX::drawChar (int16_t x, int16_t y, uint8_t data, uint16_t color, uint16_t bg, uint8_t size) {
- if( (x >= m_width) || // Clip right
- (y >= m_height) || // Clip bottom
- ((x + 6 * size - 1) < 0) || // Clip left
- ((y + 8 * size - 1) < 0)) // Clip top
- return;
-
- for (int8_t i=0; i<6; i++ ) {
- uint8_t line;
- if (i == 5) {
- line = 0x0;
- } else {
- line = *(m_font+(data * 5)+i);
- for (int8_t j = 0; j<8; j++) {
- if (line & 0x1) {
- if (size == 1) // default size
- setPixel (x+i, y+j, color);
- else { // big size
- fillRect (x+(i*size), y+(j*size), size, size, color);
- }
- } else if (bg != color) {
- if (size == 1) // default size
- setPixel (x+i, y+j, bg);
- else { // big size
- fillRect (x+i*size, y+j*size, size, size, bg);
- }
- }
- line >>= 1;
- }
- }
- }
-}
-
-void
-GFX::print (std::string msg) {
- int len = msg.length();
-
- for (int idx = 0; idx < len; idx++) {
- if (msg[idx] == '\n') {
- m_cursorY += m_textSize * 8;
- m_cursorX = 0;
- } else if (msg[idx] == '\r') {
- // skip em
- } else {
- drawChar(m_cursorX, m_cursorY, msg[idx], m_textColor, m_textBGColor, m_textSize);
- m_cursorX += m_textSize * 6;
- if (m_wrap && (m_textColor > (m_width - m_textSize * 6))) {
- m_cursorY += m_textSize * 8;
- m_cursorX = 0;
- }
- }
- }
-}
diff --git a/peripheral/libupm/src/st7735/gfx.h b/peripheral/libupm/src/st7735/gfx.h
deleted file mode 100644
index 94cb4ef..0000000
--- a/peripheral/libupm/src/st7735/gfx.h
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include <stdio.h>
-#include <unistd.h>
-#include <stdint.h>
-
-#include <mraa.hpp>
-
-#define swap(a, b) { int16_t t = a; a = b; b = t; }
-
-namespace upm {
-
-/**
- * @brief GFX helper class
- *
- * This file is used by the screen.
- */
-class GFX {
- public:
- /**
- * Instantiates a GFX object
- *
- * @param width Screen width
- * @param height Screen height
- * @param screenBuffer Pointer to the screen buffer
- * @param font Pointer to the font map
- */
- GFX (int width, int height, uint8_t * screenBuffer, const unsigned char * font);
-
- /**
- * GFX object destructor
- */
- ~GFX ();
-
- /**
- * Sets the window address
- *
- * @param x0 First coordinate
- * @param y0 First coordinate
- * @param x1 Second coordinate
- * @param y1 Second coordinate
- */
- virtual void setAddrWindow (uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1) = 0;
-
- /**
- * Sends a pixel color (RGB) to the chip. Must be implemented by the
- * inherited class.
- *
- * @param x Axis on the horizontal scale
- * @param y Axis on the vertical scale
- * @param color RGB value
- */
- virtual void drawPixel (int16_t x, int16_t y, uint16_t color) = 0;
-
- /**
- * Copies the buffer to the chip via the SPI.
- */
- virtual void refresh () = 0;
-
- /**
- *
- *
- * @param x Axis on the horizontal scale
- * @param y Axis on the vertical scale
- * @param data Character to write
- * @param color Character color
- * @param bg Character background color
- * @param size Size of the font
- */
- void drawChar (int16_t x, int16_t y, uint8_t data, uint16_t color, uint16_t bg, uint8_t size);
-
- /**
- * Prints a message on the screen
- *
- * @param msg Message to print
- */
- void print (std::string msg);
-
- /**
- * Prints a message on the screen
- *
- * @param x Axis on the horizontal scale
- * @param y Axis on the vertical scale
- * @param color Pixel color
- */
- mraa::Result setPixel (int x, int y, uint16_t color);
-
- /**
- * Fills the screen with a selected color
- *
- * @param color Selected color
- */
- void fillScreen (uint16_t color);
-
- /**
- * Fills a rectangle with a selected color
- *
- * @param x Axis on the horizontal scale (top-left corner)
- * @param y Axis on the vertical scale (top-left corner)
- * @param w Distanse from x
- * @param h Distanse from y
- * @param color Selected color
- */
- void fillRect (int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color);
-
- /**
- * Draws a line on the vertical scale
- *
- * @param x Axis on the horizontal scale
- * @param y Axis on the vertical scale
- * @param h Distanse from y
- * @param color Selected color
- */
- void drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color);
-
- /**
- * Draws a line from coordinate C0 to coordinate C1
- *
- * @param x0 First coordinate
- * @param y0 First coordinate
- * @param x1 Second coordinate
- * @param y1 Second coordinate
- * @param color selected color
- */
- void drawLine (int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color);
-
- /**
- * Draws a triangle
- *
- * @param x0 First coordinate
- * @param y0 First coordinate
- * @param x1 Second coordinate
- * @param y1 Second coordinate
- * @param x2 Third coordinate
- * @param y2 Third coordinate
- * @param color Selected color
- */
- void drawTriangle (int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color);
-
- /**
- * Draws a circle
- *
- * @param x Center of the circle on the horizontal scale
- * @param y Center of the circle on the vertical scale
- * @param r Radius of the circle
- * @param color Color of the circle
- */
- void drawCircle (int16_t x, int16_t y, int16_t r, uint16_t color);
-
- /**
- * Sets the cursor for a text message
- *
- * @param x Axis on the horizontal scale
- * @param y Axis on the vertical scale
- */
- void setCursor (int16_t x, int16_t y);
-
- /**
- * Sets a text color for a message
- *
- * @param textColor Font color
- * @param textBGColor Background color
- */
- void setTextColor (uint16_t textColor, uint16_t textBGColor);
-
- /**
- * Sets the size of the font
- *
- * @param size Font size
- */
- void setTextSize (uint8_t size);
-
- /**
- * Wraps a printed message
- *
- * @param wrap True (0x1) or false (0x0)
- */
- void setTextWrap (uint8_t wrap);
-
- int m_height; /**< Screen height */
- int m_width; /**< Screen width */
- int m_textSize; /**< Printed text size */
- int m_textColor; /**< Printed text color */
- int m_textBGColor; /**< Printed text background color */
- int m_cursorX; /**< Cursor X coordinate */
- int m_cursorY; /**< Cursor Y coordinate */
- int m_wrap; /**< Wrapper flag (true or false) */
-
- uint8_t * m_map; /**< Screens buffer */
-
- protected:
- const int16_t WIDTH, HEIGHT;
- const unsigned char * m_font;
- };
-}
diff --git a/peripheral/libupm/src/st7735/javaupm_st7735.i b/peripheral/libupm/src/st7735/javaupm_st7735.i
deleted file mode 100644
index e60367c..0000000
--- a/peripheral/libupm/src/st7735/javaupm_st7735.i
+++ /dev/null
@@ -1,57 +0,0 @@
-%module javaupm_st7735
-%include "../upm.i"
-%include "arrays_java.i"
-%include "typemaps.i"
-%include "stdint.i"
-
-%ignore m_map;
-%ignore Bcmd;
-%ignore font;
-%ignore Rcmd1;
-%ignore Rcmd2green;
-%ignore Rcmd2red;
-%ignore Rcmd3;
-
-
-/*
-%typemap(jni) unsigned char[] "jbyteArray";
-%typemap(jtype) unsigned char[] "byte[]";
-%typemap(jstype) unsigned char[] "byte[]";
-
-%typemap(out) unsigned char[] {
- $result = SWIG_JavaArrayOutSchar(jenv, reinterpret_cast<signed char*>($1), sizeof($1));
-}
-%typemap(freearg) unsigned char* {
- JCALL3(ReleaseByteArrayElements, jenv, $input, reinterpret_cast<jbyte*>($1), 0);
-}
-*/
-%typemap(jni) unsigned char* "jbyteArray";
-%typemap(jtype) unsigned char* "byte[]";
-%typemap(jstype) unsigned char* "byte[]";
-
-%typemap(javain) unsigned char* "$javainput"
-
-%typemap(in) unsigned char* {
- $1 = (unsigned char *)JCALL2(GetByteArrayElements, jenv, $input, NULL);
-}
-
-%include "gfx.h"
-%{
- #include "gfx.h"
-%}
-
-%include "st7735.h"
-%{
- #include "st7735.h"
-%}
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_st7735");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/st7735/jsupm_st7735.i b/peripheral/libupm/src/st7735/jsupm_st7735.i
deleted file mode 100644
index ea3809b..0000000
--- a/peripheral/libupm/src/st7735/jsupm_st7735.i
+++ /dev/null
@@ -1,12 +0,0 @@
-%module jsupm_st7735
-%include "../upm.i"
-
-%include "gfx.h"
-%{
- #include "gfx.h"
-%}
-
-%include "st7735.h"
-%{
- #include "st7735.h"
-%}
diff --git a/peripheral/libupm/src/st7735/license.txt b/peripheral/libupm/src/st7735/license.txt
deleted file mode 100644
index 7492e93..0000000
--- a/peripheral/libupm/src/st7735/license.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-Software License Agreement (BSD License)
-
-Copyright (c) 2012 Adafruit Industries. 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.
-
-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.
diff --git a/peripheral/libupm/src/st7735/pyupm_st7735.i b/peripheral/libupm/src/st7735/pyupm_st7735.i
deleted file mode 100644
index f1d416e..0000000
--- a/peripheral/libupm/src/st7735/pyupm_st7735.i
+++ /dev/null
@@ -1,17 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_st7735
-%include "../upm.i"
-
-%feature("autodoc", "3");
-%rename("printString") print(std::string msg);
-
-%include "gfx.h"
-%{
- #include "gfx.h"
-%}
-
-%include "st7735.h"
-%{
- #include "st7735.h"
-%}
diff --git a/peripheral/libupm/src/st7735/st7735.cxx b/peripheral/libupm/src/st7735/st7735.cxx
deleted file mode 100644
index ac01c56..0000000
--- a/peripheral/libupm/src/st7735/st7735.cxx
+++ /dev/null
@@ -1,270 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <string>
-#include <stdexcept>
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#include "st7735.h"
-
-using namespace upm;
-
-ST7735::ST7735 (uint8_t csLCD, uint8_t cSD, uint8_t rs, uint8_t rst)
- : GFX (160, 128, m_map, font), m_csLCDPinCtx(csLCD), m_cSDPinCtx(cSD),
- m_rSTPinCtx(rst), m_rSPinCtx(rs), m_spi(0) {
-
- initModule ();
- configModule ();
-}
-
-void
-ST7735::initModule () {
- mraa::Result error = mraa::SUCCESS;
-
- m_height = 160;
- m_width = 128;
-
- m_spi.frequency(15 * 1000000);
-
- error = m_csLCDPinCtx.dir(mraa::DIR_OUT);
- if (error != mraa::SUCCESS) {
- mraa::printError (error);
- }
-
- error = m_cSDPinCtx.dir(mraa::DIR_OUT);
- if (error != mraa::SUCCESS) {
- mraa::printError (error);
- }
-
- error = m_rSTPinCtx.dir(mraa::DIR_OUT);
- if (error != mraa::SUCCESS) {
- mraa::printError (error);
- }
-
- error = m_rSPinCtx.dir(mraa::DIR_OUT);
- if (error != mraa::SUCCESS) {
- mraa::printError (error);
- }
-
- error = m_spi.frequency(15 * 1000000);
- if (error != mraa::SUCCESS) {
- mraa::printError (error);
- }
-
- lcdCSOn ();
-}
-
-void
-ST7735::write (uint8_t value) {
- rsLOW ();
- m_spi.writeByte(value);
-}
-
-void
-ST7735::data (uint8_t value) {
- rsHIGH ();
- m_spi.writeByte(value);
-}
-
-void
-ST7735::executeCMDList(const uint8_t *addr) {
- uint8_t numCommands, numArgs;
- uint16_t ms;
-
- numCommands = *(addr++); // Number of commands to follow
- while(numCommands--) { // For each command...
- write (*(addr++)); // Read, issue command
- numArgs = *(addr++); // Number of args to follow
- ms = numArgs & DELAY; // If hibit set, delay follows args
- numArgs &= ~DELAY; // Mask out delay bit
- while(numArgs--) { // For each argument...
- data (*(addr++)); // Read, issue argument
- }
-
- if(ms) {
- ms = *(addr++); // Read post-command delay time (ms)
- if (ms == 255) {
- ms = 500; // If 255, delay for 500 ms
- }
- usleep (ms * 1000);
- }
- }
-}
-
-void
-ST7735::setAddrWindow(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1) {
- uint8_t colstart, rowstart;
- colstart = rowstart = 0;
-
- write (ST7735_CASET); // Column addr set
-
- rsHIGH ();
- m_spiBuffer[0] = 0x00;
- m_spiBuffer[1] = x0 + colstart; // XSTART
- m_spiBuffer[2] = 0x00;
- m_spiBuffer[3] = x1 + colstart; // XEND
- m_spi.write(m_spiBuffer, 4);
-
- write (ST7735_RASET); // Row addr set
-
- rsHIGH ();
- m_spiBuffer[0] = 0x00;
- m_spiBuffer[1] = y0 + rowstart; // YSTART
- m_spiBuffer[2] = 0x00;
- m_spiBuffer[3] = y1 + rowstart; // YEND
- m_spi.write(m_spiBuffer, 4);
-
- write (ST7735_RAMWR); // write to RAM
-}
-
-void
-ST7735::drawPixel(int16_t x, int16_t y, uint16_t color) {
- if (mraa::SUCCESS != setPixel (x, y, color)) {
- return;
- }
-
- refresh ();
-}
-
-void
-ST7735::refresh () {
- rsHIGH ();
-
- int fragmentSize = m_height * m_width * 2 / 20;
- for (int fragment = 0; fragment < 20; fragment++) {
- m_spi.write(&m_map[fragment * fragmentSize], fragmentSize);
- }
-}
-
-void
-ST7735::configModule() {
- rsHIGH ();
- lcdCSOff ();
- lcdCSOn ();
-
- m_rSTPinCtx.write(HIGH);
- usleep (500000);
- m_rSTPinCtx.write(LOW);
- usleep (500000);
- m_rSTPinCtx.write(HIGH);
- usleep (500000);
-
- executeCMDList (Rcmd1);
- executeCMDList (Rcmd2red);
- executeCMDList (Rcmd3);
-
- write (ST7735_MADCTL);
- data (0xC0);
-
- setAddrWindow (0, 0, m_width - 1, m_height - 1);
-
- fillScreen (ST7735_BLACK);
- refresh ();
-}
-
-mraa::Result
-ST7735::lcdCSOn () {
- mraa::Result error = mraa::SUCCESS;
-
- error = m_csLCDPinCtx.write(LOW);
- if (error != mraa::SUCCESS) {
- mraa::printError (error);
- }
-
- error = m_cSDPinCtx.write(HIGH);
- if (error != mraa::SUCCESS) {
- mraa::printError (error);
- }
-
- return error;
-}
-
-mraa::Result
-ST7735::lcdCSOff () {
- mraa::Result error = mraa::SUCCESS;
-
- error = m_csLCDPinCtx.write(HIGH);
- if (error != mraa::SUCCESS) {
- mraa::printError (error);
- }
-
- return error;
-}
-
-mraa::Result
-ST7735::sdCSOn () {
- mraa::Result error = mraa::SUCCESS;
-
- error = m_cSDPinCtx.write(LOW);
- if (error != mraa::SUCCESS) {
- mraa::printError (error);
- }
-
- error = m_csLCDPinCtx.write(HIGH);
- if (error != mraa::SUCCESS) {
- mraa::printError (error);
- }
-
- return error;
-}
-
-mraa::Result
-ST7735::sdCSOff () {
- mraa::Result error = mraa::SUCCESS;
-
- error = m_cSDPinCtx.write(HIGH);
- if (error != mraa::SUCCESS) {
- mraa::printError (error);
- }
-
- return error;
-}
-
-mraa::Result
-ST7735::rsHIGH () {
- mraa::Result error = mraa::SUCCESS;
-
- error = m_rSPinCtx.write(HIGH);
- if (error != mraa::SUCCESS) {
- mraa::printError (error);
- }
-
- return error;
-}
-
-mraa::Result
-ST7735::rsLOW () {
- mraa::Result error = mraa::SUCCESS;
-
- error = m_rSPinCtx.write(LOW);
- if (error != mraa::SUCCESS) {
- mraa::printError (error);
- }
-
- return error;
-}
diff --git a/peripheral/libupm/src/st7735/st7735.h b/peripheral/libupm/src/st7735/st7735.h
deleted file mode 100644
index 5f9b902..0000000
--- a/peripheral/libupm/src/st7735/st7735.h
+++ /dev/null
@@ -1,639 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Credits to Adafruit.
- * Based on Adafruit ST7735 library, see original license in license.txt file.
- *
- * 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 <string>
-#include <mraa/aio.hpp>
-#include <mraa/common.hpp>
-
-#include <mraa/gpio.hpp>
-
-#include <mraa/spi.hpp>
-#include "gfx.h"
-
-#define INITR_GREENTAB 0x0
-#define INITR_REDTAB 0x1
-#define INITR_BLACKTAB 0x2
-
-#define ST7735_TFTWIDTH 128
-#define ST7735_TFTHEIGHT 160
-
-#define ST7735_NOP 0x00
-#define ST7735_SWRESET 0x01
-#define ST7735_RDDID 0x04
-#define ST7735_RDDST 0x09
-
-#define ST7735_SLPIN 0x10
-#define ST7735_SLPOUT 0x11
-#define ST7735_PTLON 0x12
-#define ST7735_NORON 0x13
-
-#define ST7735_INVOFF 0x20
-#define ST7735_INVON 0x21
-#define ST7735_DISPOFF 0x28
-#define ST7735_DISPON 0x29
-#define ST7735_CASET 0x2A
-#define ST7735_RASET 0x2B
-#define ST7735_RAMWR 0x2C
-#define ST7735_RAMRD 0x2E
-
-#define ST7735_PTLAR 0x30
-#define ST7735_COLMOD 0x3A
-#define ST7735_MADCTL 0x36
-
-#define ST7735_FRMCTR1 0xB1
-#define ST7735_FRMCTR2 0xB2
-#define ST7735_FRMCTR3 0xB3
-#define ST7735_INVCTR 0xB4
-#define ST7735_DISSET5 0xB6
-
-#define ST7735_PWCTR1 0xC0
-#define ST7735_PWCTR2 0xC1
-#define ST7735_PWCTR3 0xC2
-#define ST7735_PWCTR4 0xC3
-#define ST7735_PWCTR5 0xC4
-#define ST7735_VMCTR1 0xC5
-
-#define ST7735_RDID1 0xDA
-#define ST7735_RDID2 0xDB
-#define ST7735_RDID3 0xDC
-#define ST7735_RDID4 0xDD
-
-#define ST7735_PWCTR6 0xFC
-
-#define ST7735_GMCTRP1 0xE0
-#define ST7735_GMCTRN1 0xE1
-
-// Color definitions
-#define ST7735_BLACK 0x0000
-#define ST7735_BLUE 0x001F
-#define ST7735_RED 0xF800
-#define ST7735_GREEN 0x07E0
-#define ST7735_CYAN 0x07FF
-#define ST7735_MAGENTA 0xF81F
-#define ST7735_YELLOW 0xFFE0
-#define ST7735_WHITE 0xFFFF
-
-#define HIGH 1
-#define LOW 0
-
-#define DELAY 0x80
-
-namespace upm {
-
-static const uint8_t Bcmd[] = {
- // Initialization commands for 7735B screens
- 18, // 18 commands in list:
- ST7735_SWRESET, DELAY, // 1: Software reset, no args, w/delay
- 50, // 50 ms delay
- ST7735_SLPOUT , DELAY, // 2: Out of sleep mode, no args, w/delay
- 255, // 255 = 500 ms delay
- ST7735_COLMOD , 1+DELAY, // 3: Set color mode, 1 arg + delay:
- 0x05, // 16-bit color
- 10, // 10 ms delay
- ST7735_FRMCTR1, 3+DELAY, // 4: Frame rate control, 3 args + delay:
- 0x00, // fastest refresh
- 0x06, // 6 lines front porch
- 0x03, // 3 lines back porch
- 10, // 10 ms delay
- ST7735_MADCTL , 1 , // 5: Memory access ctrl (directions), 1 arg:
- 0x08, // Row addr/col addr, bottom to top refresh
- ST7735_DISSET5, 2 , // 6: Display settings #5, 2 args, no delay:
- 0x15, // 1 clk cycle nonoverlap, 2 cycle gate
- // rise, 3 cycle osc equalize
- 0x02, // Fix on VTL
- ST7735_INVCTR , 1 , // 7: Display inversion control, 1 arg:
- 0x0, // Line inversion
- ST7735_PWCTR1 , 2+DELAY, // 8: Power control, 2 args + delay:
- 0x02, // GVDD = 4.7V
- 0x70, // 1.0uA
- 10, // 10 ms delay
- ST7735_PWCTR2 , 1 , // 9: Power control, 1 arg, no delay:
- 0x05, // VGH = 14.7V, VGL = -7.35V
- ST7735_PWCTR3 , 2 , // 10: Power control, 2 args, no delay:
- 0x01, // Opamp current small
- 0x02, // Boost frequency
- ST7735_VMCTR1 , 2+DELAY, // 11: Power control, 2 args + delay:
- 0x3C, // VCOMH = 4V
- 0x38, // VCOML = -1.1V
- 10, // 10 ms delay
- ST7735_PWCTR6 , 2 , // 12: Power control, 2 args, no delay:
- 0x11, 0x15,
- ST7735_GMCTRP1,16 , // 13: Magical unicorn dust, 16 args, no delay:
- 0x09, 0x16, 0x09, 0x20, // (seriously though, not sure what
- 0x21, 0x1B, 0x13, 0x19, // these config values represent)
- 0x17, 0x15, 0x1E, 0x2B,
- 0x04, 0x05, 0x02, 0x0E,
- ST7735_GMCTRN1,16+DELAY, // 14: Sparkles and rainbows, 16 args + delay:
- 0x0B, 0x14, 0x08, 0x1E, // (ditto)
- 0x22, 0x1D, 0x18, 0x1E,
- 0x1B, 0x1A, 0x24, 0x2B,
- 0x06, 0x06, 0x02, 0x0F,
- 10, // 10 ms delay
- ST7735_CASET , 4 , // 15: Column addr set, 4 args, no delay:
- 0x00, 0x02, // XSTART = 2
- 0x00, 0x81, // XEND = 129
- ST7735_RASET , 4 , // 16: Row addr set, 4 args, no delay:
- 0x00, 0x02, // XSTART = 1
- 0x00, 0x81, // XEND = 160
- ST7735_NORON , DELAY, // 17: Normal display on, no args, w/delay
- 10, // 10 ms delay
- ST7735_DISPON , DELAY, // 18: Main screen turn on, no args, w/delay
- 255 }, // 255 = 500 ms delay
-
- Rcmd1[] = { // Init for 7735R, part 1 (red or green tab)
- 15, // 15 commands in list:
- ST7735_SWRESET, DELAY, // 1: Software reset, 0 args, w/delay
- 150, // 150 ms delay
- ST7735_SLPOUT , DELAY, // 2: Out of sleep mode, 0 args, w/delay
- 255, // 500 ms delay
- ST7735_FRMCTR1, 3 , // 3: Frame rate ctrl - normal mode, 3 args:
- 0x01, 0x2C, 0x2D, // Rate = fosc/(1x2+40) * (LINE+2C+2D)
- ST7735_FRMCTR2, 3 , // 4: Frame rate control - idle mode, 3 args:
- 0x01, 0x2C, 0x2D, // Rate = fosc/(1x2+40) * (LINE+2C+2D)
- ST7735_FRMCTR3, 6 , // 5: Frame rate ctrl - partial mode, 6 args:
- 0x01, 0x2C, 0x2D, // Dot inversion mode
- 0x01, 0x2C, 0x2D, // Line inversion mode
- ST7735_INVCTR , 1 , // 6: Display inversion ctrl, 1 arg, no delay:
- 0x07, // No inversion
- ST7735_PWCTR1 , 3 , // 7: Power control, 3 args, no delay:
- 0xA2,
- 0x02, // -4.6V
- 0x84, // AUTO mode
- ST7735_PWCTR2 , 1 , // 8: Power control, 1 arg, no delay:
- 0xC5, // VGH25 = 2.4C VGSEL = -10 VGH = 3 * AVDD
- ST7735_PWCTR3 , 2 , // 9: Power control, 2 args, no delay:
- 0x0A, // Opamp current small
- 0x00, // Boost frequency
- ST7735_PWCTR4 , 2 , // 10: Power control, 2 args, no delay:
- 0x8A, // BCLK/2, Opamp current small & Medium low
- 0x2A,
- ST7735_PWCTR5 , 2 , // 11: Power control, 2 args, no delay:
- 0x8A, 0xEE,
- ST7735_VMCTR1 , 1 , // 12: Power control, 1 arg, no delay:
- 0x0E,
- ST7735_INVOFF , 0 , // 13: Don't invert display, no args, no delay
- ST7735_MADCTL , 1 , // 14: Memory access control (directions), 1 arg:
- 0xC8, // row addr/col addr, bottom to top refresh
- ST7735_COLMOD , 1 , // 15: set color mode, 1 arg, no delay:
- 0x05 }, // 16-bit color
-
- Rcmd2green[] = { // Init for 7735R, part 2 (green tab only)
- 2, // 2 commands in list:
- ST7735_CASET , 4 , // 1: Column addr set, 4 args, no delay:
- 0x00, 0x02, // XSTART = 0
- 0x00, 0x7F+0x02, // XEND = 127
- ST7735_RASET , 4 , // 2: Row addr set, 4 args, no delay:
- 0x00, 0x01, // XSTART = 0
- 0x00, 0x9F+0x01 }, // XEND = 159
- Rcmd2red[] = { // Init for 7735R, part 2 (red tab only)
- 2, // 2 commands in list:
- ST7735_CASET , 4 , // 1: Column addr set, 4 args, no delay:
- 0x00, 0x00, // XSTART = 0
- 0x00, 0x7F, // XEND = 127
- ST7735_RASET , 4 , // 2: Row addr set, 4 args, no delay:
- 0x00, 0x00, // XSTART = 0
- 0x00, 0x9F }, // XEND = 159
-
- Rcmd3[] = { // Init for 7735R, part 3 (red or green tab)
- 4, // 4 commands in list:
- ST7735_GMCTRP1, 16 , // 1: Magical unicorn dust, 16 args, no delay:
- 0x02, 0x1c, 0x07, 0x12,
- 0x37, 0x32, 0x29, 0x2d,
- 0x29, 0x25, 0x2B, 0x39,
- 0x00, 0x01, 0x03, 0x10,
- ST7735_GMCTRN1, 16 , // 2: Sparkles and rainbows, 16 args, no delay:
- 0x03, 0x1d, 0x07, 0x06,
- 0x2E, 0x2C, 0x29, 0x2D,
- 0x2E, 0x2E, 0x37, 0x3F,
- 0x00, 0x00, 0x02, 0x10,
- ST7735_NORON , DELAY, // 3: Normal display on, no args, w/delay
- 10, // 10 ms delay
- ST7735_DISPON , DELAY, // 4: Main screen turn on, no args w/delay
- 100 }; // 100 ms delay
-
-#define swap(a, b) { int16_t t = a; a = b; b = t; }
-
-const unsigned char font[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x3E, 0x5B, 0x4F, 0x5B, 0x3E,
- 0x3E, 0x6B, 0x4F, 0x6B, 0x3E,
- 0x1C, 0x3E, 0x7C, 0x3E, 0x1C,
- 0x18, 0x3C, 0x7E, 0x3C, 0x18,
- 0x1C, 0x57, 0x7D, 0x57, 0x1C,
- 0x1C, 0x5E, 0x7F, 0x5E, 0x1C,
- 0x00, 0x18, 0x3C, 0x18, 0x00,
- 0xFF, 0xE7, 0xC3, 0xE7, 0xFF,
- 0x00, 0x18, 0x24, 0x18, 0x00,
- 0xFF, 0xE7, 0xDB, 0xE7, 0xFF,
- 0x30, 0x48, 0x3A, 0x06, 0x0E,
- 0x26, 0x29, 0x79, 0x29, 0x26,
- 0x40, 0x7F, 0x05, 0x05, 0x07,
- 0x40, 0x7F, 0x05, 0x25, 0x3F,
- 0x5A, 0x3C, 0xE7, 0x3C, 0x5A,
- 0x7F, 0x3E, 0x1C, 0x1C, 0x08,
- 0x08, 0x1C, 0x1C, 0x3E, 0x7F,
- 0x14, 0x22, 0x7F, 0x22, 0x14,
- 0x5F, 0x5F, 0x00, 0x5F, 0x5F,
- 0x06, 0x09, 0x7F, 0x01, 0x7F,
- 0x00, 0x66, 0x89, 0x95, 0x6A,
- 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x94, 0xA2, 0xFF, 0xA2, 0x94,
- 0x08, 0x04, 0x7E, 0x04, 0x08,
- 0x10, 0x20, 0x7E, 0x20, 0x10,
- 0x08, 0x08, 0x2A, 0x1C, 0x08,
- 0x08, 0x1C, 0x2A, 0x08, 0x08,
- 0x1E, 0x10, 0x10, 0x10, 0x10,
- 0x0C, 0x1E, 0x0C, 0x1E, 0x0C,
- 0x30, 0x38, 0x3E, 0x38, 0x30,
- 0x06, 0x0E, 0x3E, 0x0E, 0x06,
- 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x5F, 0x00, 0x00,
- 0x00, 0x07, 0x00, 0x07, 0x00,
- 0x14, 0x7F, 0x14, 0x7F, 0x14,
- 0x24, 0x2A, 0x7F, 0x2A, 0x12,
- 0x23, 0x13, 0x08, 0x64, 0x62,
- 0x36, 0x49, 0x56, 0x20, 0x50,
- 0x00, 0x08, 0x07, 0x03, 0x00,
- 0x00, 0x1C, 0x22, 0x41, 0x00,
- 0x00, 0x41, 0x22, 0x1C, 0x00,
- 0x2A, 0x1C, 0x7F, 0x1C, 0x2A,
- 0x08, 0x08, 0x3E, 0x08, 0x08,
- 0x00, 0x80, 0x70, 0x30, 0x00,
- 0x08, 0x08, 0x08, 0x08, 0x08,
- 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x20, 0x10, 0x08, 0x04, 0x02,
- 0x3E, 0x51, 0x49, 0x45, 0x3E,
- 0x00, 0x42, 0x7F, 0x40, 0x00,
- 0x72, 0x49, 0x49, 0x49, 0x46,
- 0x21, 0x41, 0x49, 0x4D, 0x33,
- 0x18, 0x14, 0x12, 0x7F, 0x10,
- 0x27, 0x45, 0x45, 0x45, 0x39,
- 0x3C, 0x4A, 0x49, 0x49, 0x31,
- 0x41, 0x21, 0x11, 0x09, 0x07,
- 0x36, 0x49, 0x49, 0x49, 0x36,
- 0x46, 0x49, 0x49, 0x29, 0x1E,
- 0x00, 0x00, 0x14, 0x00, 0x00,
- 0x00, 0x40, 0x34, 0x00, 0x00,
- 0x00, 0x08, 0x14, 0x22, 0x41,
- 0x14, 0x14, 0x14, 0x14, 0x14,
- 0x00, 0x41, 0x22, 0x14, 0x08,
- 0x02, 0x01, 0x59, 0x09, 0x06,
- 0x3E, 0x41, 0x5D, 0x59, 0x4E,
- 0x7C, 0x12, 0x11, 0x12, 0x7C,
- 0x7F, 0x49, 0x49, 0x49, 0x36,
- 0x3E, 0x41, 0x41, 0x41, 0x22,
- 0x7F, 0x41, 0x41, 0x41, 0x3E,
- 0x7F, 0x49, 0x49, 0x49, 0x41,
- 0x7F, 0x09, 0x09, 0x09, 0x01,
- 0x3E, 0x41, 0x41, 0x51, 0x73,
- 0x7F, 0x08, 0x08, 0x08, 0x7F,
- 0x00, 0x41, 0x7F, 0x41, 0x00,
- 0x20, 0x40, 0x41, 0x3F, 0x01,
- 0x7F, 0x08, 0x14, 0x22, 0x41,
- 0x7F, 0x40, 0x40, 0x40, 0x40,
- 0x7F, 0x02, 0x1C, 0x02, 0x7F,
- 0x7F, 0x04, 0x08, 0x10, 0x7F,
- 0x3E, 0x41, 0x41, 0x41, 0x3E,
- 0x7F, 0x09, 0x09, 0x09, 0x06,
- 0x3E, 0x41, 0x51, 0x21, 0x5E,
- 0x7F, 0x09, 0x19, 0x29, 0x46,
- 0x26, 0x49, 0x49, 0x49, 0x32,
- 0x03, 0x01, 0x7F, 0x01, 0x03,
- 0x3F, 0x40, 0x40, 0x40, 0x3F,
- 0x1F, 0x20, 0x40, 0x20, 0x1F,
- 0x3F, 0x40, 0x38, 0x40, 0x3F,
- 0x63, 0x14, 0x08, 0x14, 0x63,
- 0x03, 0x04, 0x78, 0x04, 0x03,
- 0x61, 0x59, 0x49, 0x4D, 0x43,
- 0x00, 0x7F, 0x41, 0x41, 0x41,
- 0x02, 0x04, 0x08, 0x10, 0x20,
- 0x00, 0x41, 0x41, 0x41, 0x7F,
- 0x04, 0x02, 0x01, 0x02, 0x04,
- 0x40, 0x40, 0x40, 0x40, 0x40,
- 0x00, 0x03, 0x07, 0x08, 0x00,
- 0x20, 0x54, 0x54, 0x78, 0x40,
- 0x7F, 0x28, 0x44, 0x44, 0x38,
- 0x38, 0x44, 0x44, 0x44, 0x28,
- 0x38, 0x44, 0x44, 0x28, 0x7F,
- 0x38, 0x54, 0x54, 0x54, 0x18,
- 0x00, 0x08, 0x7E, 0x09, 0x02,
- 0x18, 0xA4, 0xA4, 0x9C, 0x78,
- 0x7F, 0x08, 0x04, 0x04, 0x78,
- 0x00, 0x44, 0x7D, 0x40, 0x00,
- 0x20, 0x40, 0x40, 0x3D, 0x00,
- 0x7F, 0x10, 0x28, 0x44, 0x00,
- 0x00, 0x41, 0x7F, 0x40, 0x00,
- 0x7C, 0x04, 0x78, 0x04, 0x78,
- 0x7C, 0x08, 0x04, 0x04, 0x78,
- 0x38, 0x44, 0x44, 0x44, 0x38,
- 0xFC, 0x18, 0x24, 0x24, 0x18,
- 0x18, 0x24, 0x24, 0x18, 0xFC,
- 0x7C, 0x08, 0x04, 0x04, 0x08,
- 0x48, 0x54, 0x54, 0x54, 0x24,
- 0x04, 0x04, 0x3F, 0x44, 0x24,
- 0x3C, 0x40, 0x40, 0x20, 0x7C,
- 0x1C, 0x20, 0x40, 0x20, 0x1C,
- 0x3C, 0x40, 0x30, 0x40, 0x3C,
- 0x44, 0x28, 0x10, 0x28, 0x44,
- 0x4C, 0x90, 0x90, 0x90, 0x7C,
- 0x44, 0x64, 0x54, 0x4C, 0x44,
- 0x00, 0x08, 0x36, 0x41, 0x00,
- 0x00, 0x00, 0x77, 0x00, 0x00,
- 0x00, 0x41, 0x36, 0x08, 0x00,
- 0x02, 0x01, 0x02, 0x04, 0x02,
- 0x3C, 0x26, 0x23, 0x26, 0x3C,
- 0x1E, 0xA1, 0xA1, 0x61, 0x12,
- 0x3A, 0x40, 0x40, 0x20, 0x7A,
- 0x38, 0x54, 0x54, 0x55, 0x59,
- 0x21, 0x55, 0x55, 0x79, 0x41,
- 0x21, 0x54, 0x54, 0x78, 0x41,
- 0x21, 0x55, 0x54, 0x78, 0x40,
- 0x20, 0x54, 0x55, 0x79, 0x40,
- 0x0C, 0x1E, 0x52, 0x72, 0x12,
- 0x39, 0x55, 0x55, 0x55, 0x59,
- 0x39, 0x54, 0x54, 0x54, 0x59,
- 0x39, 0x55, 0x54, 0x54, 0x58,
- 0x00, 0x00, 0x45, 0x7C, 0x41,
- 0x00, 0x02, 0x45, 0x7D, 0x42,
- 0x00, 0x01, 0x45, 0x7C, 0x40,
- 0xF0, 0x29, 0x24, 0x29, 0xF0,
- 0xF0, 0x28, 0x25, 0x28, 0xF0,
- 0x7C, 0x54, 0x55, 0x45, 0x00,
- 0x20, 0x54, 0x54, 0x7C, 0x54,
- 0x7C, 0x0A, 0x09, 0x7F, 0x49,
- 0x32, 0x49, 0x49, 0x49, 0x32,
- 0x32, 0x48, 0x48, 0x48, 0x32,
- 0x32, 0x4A, 0x48, 0x48, 0x30,
- 0x3A, 0x41, 0x41, 0x21, 0x7A,
- 0x3A, 0x42, 0x40, 0x20, 0x78,
- 0x00, 0x9D, 0xA0, 0xA0, 0x7D,
- 0x39, 0x44, 0x44, 0x44, 0x39,
- 0x3D, 0x40, 0x40, 0x40, 0x3D,
- 0x3C, 0x24, 0xFF, 0x24, 0x24,
- 0x48, 0x7E, 0x49, 0x43, 0x66,
- 0x2B, 0x2F, 0xFC, 0x2F, 0x2B,
- 0xFF, 0x09, 0x29, 0xF6, 0x20,
- 0xC0, 0x88, 0x7E, 0x09, 0x03,
- 0x20, 0x54, 0x54, 0x79, 0x41,
- 0x00, 0x00, 0x44, 0x7D, 0x41,
- 0x30, 0x48, 0x48, 0x4A, 0x32,
- 0x38, 0x40, 0x40, 0x22, 0x7A,
- 0x00, 0x7A, 0x0A, 0x0A, 0x72,
- 0x7D, 0x0D, 0x19, 0x31, 0x7D,
- 0x26, 0x29, 0x29, 0x2F, 0x28,
- 0x26, 0x29, 0x29, 0x29, 0x26,
- 0x30, 0x48, 0x4D, 0x40, 0x20,
- 0x38, 0x08, 0x08, 0x08, 0x08,
- 0x08, 0x08, 0x08, 0x08, 0x38,
- 0x2F, 0x10, 0xC8, 0xAC, 0xBA,
- 0x2F, 0x10, 0x28, 0x34, 0xFA,
- 0x00, 0x00, 0x7B, 0x00, 0x00,
- 0x08, 0x14, 0x2A, 0x14, 0x22,
- 0x22, 0x14, 0x2A, 0x14, 0x08,
- 0xAA, 0x00, 0x55, 0x00, 0xAA,
- 0xAA, 0x55, 0xAA, 0x55, 0xAA,
- 0x00, 0x00, 0x00, 0xFF, 0x00,
- 0x10, 0x10, 0x10, 0xFF, 0x00,
- 0x14, 0x14, 0x14, 0xFF, 0x00,
- 0x10, 0x10, 0xFF, 0x00, 0xFF,
- 0x10, 0x10, 0xF0, 0x10, 0xF0,
- 0x14, 0x14, 0x14, 0xFC, 0x00,
- 0x14, 0x14, 0xF7, 0x00, 0xFF,
- 0x00, 0x00, 0xFF, 0x00, 0xFF,
- 0x14, 0x14, 0xF4, 0x04, 0xFC,
- 0x14, 0x14, 0x17, 0x10, 0x1F,
- 0x10, 0x10, 0x1F, 0x10, 0x1F,
- 0x14, 0x14, 0x14, 0x1F, 0x00,
- 0x10, 0x10, 0x10, 0xF0, 0x00,
- 0x00, 0x00, 0x00, 0x1F, 0x10,
- 0x10, 0x10, 0x10, 0x1F, 0x10,
- 0x10, 0x10, 0x10, 0xF0, 0x10,
- 0x00, 0x00, 0x00, 0xFF, 0x10,
- 0x10, 0x10, 0x10, 0x10, 0x10,
- 0x10, 0x10, 0x10, 0xFF, 0x10,
- 0x00, 0x00, 0x00, 0xFF, 0x14,
- 0x00, 0x00, 0xFF, 0x00, 0xFF,
- 0x00, 0x00, 0x1F, 0x10, 0x17,
- 0x00, 0x00, 0xFC, 0x04, 0xF4,
- 0x14, 0x14, 0x17, 0x10, 0x17,
- 0x14, 0x14, 0xF4, 0x04, 0xF4,
- 0x00, 0x00, 0xFF, 0x00, 0xF7,
- 0x14, 0x14, 0x14, 0x14, 0x14,
- 0x14, 0x14, 0xF7, 0x00, 0xF7,
- 0x14, 0x14, 0x14, 0x17, 0x14,
- 0x10, 0x10, 0x1F, 0x10, 0x1F,
- 0x14, 0x14, 0x14, 0xF4, 0x14,
- 0x10, 0x10, 0xF0, 0x10, 0xF0,
- 0x00, 0x00, 0x1F, 0x10, 0x1F,
- 0x00, 0x00, 0x00, 0x1F, 0x14,
- 0x00, 0x00, 0x00, 0xFC, 0x14,
- 0x00, 0x00, 0xF0, 0x10, 0xF0,
- 0x10, 0x10, 0xFF, 0x10, 0xFF,
- 0x14, 0x14, 0x14, 0xFF, 0x14,
- 0x10, 0x10, 0x10, 0x1F, 0x00,
- 0x00, 0x00, 0x00, 0xF0, 0x10,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
- 0xFF, 0xFF, 0xFF, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0xFF, 0xFF,
- 0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
- 0x38, 0x44, 0x44, 0x38, 0x44,
- 0x7C, 0x2A, 0x2A, 0x3E, 0x14,
- 0x7E, 0x02, 0x02, 0x06, 0x06,
- 0x02, 0x7E, 0x02, 0x7E, 0x02,
- 0x63, 0x55, 0x49, 0x41, 0x63,
- 0x38, 0x44, 0x44, 0x3C, 0x04,
- 0x40, 0x7E, 0x20, 0x1E, 0x20,
- 0x06, 0x02, 0x7E, 0x02, 0x02,
- 0x99, 0xA5, 0xE7, 0xA5, 0x99,
- 0x1C, 0x2A, 0x49, 0x2A, 0x1C,
- 0x4C, 0x72, 0x01, 0x72, 0x4C,
- 0x30, 0x4A, 0x4D, 0x4D, 0x30,
- 0x30, 0x48, 0x78, 0x48, 0x30,
- 0xBC, 0x62, 0x5A, 0x46, 0x3D,
- 0x3E, 0x49, 0x49, 0x49, 0x00,
- 0x7E, 0x01, 0x01, 0x01, 0x7E,
- 0x2A, 0x2A, 0x2A, 0x2A, 0x2A,
- 0x44, 0x44, 0x5F, 0x44, 0x44,
- 0x40, 0x51, 0x4A, 0x44, 0x40,
- 0x40, 0x44, 0x4A, 0x51, 0x40,
- 0x00, 0x00, 0xFF, 0x01, 0x03,
- 0xE0, 0x80, 0xFF, 0x00, 0x00,
- 0x08, 0x08, 0x6B, 0x6B, 0x08,
- 0x36, 0x12, 0x36, 0x24, 0x36,
- 0x06, 0x0F, 0x09, 0x0F, 0x06,
- 0x00, 0x00, 0x18, 0x18, 0x00,
- 0x00, 0x00, 0x10, 0x10, 0x00,
- 0x30, 0x40, 0xFF, 0x01, 0x01,
- 0x00, 0x1F, 0x01, 0x01, 0x1E,
- 0x00, 0x19, 0x1D, 0x17, 0x12,
- 0x00, 0x3C, 0x3C, 0x3C, 0x3C,
- 0x00, 0x00, 0x00, 0x00, 0x00
-};
-
-/**
- * @brief ST7735 LCD library
- * @defgroup st7735 libupm-st7735
- * @ingroup adafruit spi display
- */
-/**
- * @library st7735
- * @sensor st7735
- * @comname ST7735 LCD
- * @type display
- * @man adafruit
- * @web http://www.adafruit.com/product/358
- * @con spi
- *
- * @brief API for the ST7735 LCD
- *
- * This module defines the interface for the ST7735 display library
- *
- * @image html st7735.jpg
- * @snippet st7735.cxx Interesting
- */
-class ST7735 : public GFX {
- public:
- /**
- * Instantiates an ST7735 object
- *
- * @param csLCD LCD chip select pin
- * @param cSD SD card chip select pin
- * @param rs Data/command pin
- * @param rst Reset pin
- */
- ST7735 (uint8_t csLCD, uint8_t cSD, uint8_t rs, uint8_t rst);
-
- /**
- * Returns the name of the component
- */
- std::string name()
- {
- return m_name;
- }
-
- /**
- * Initializes the module GPIOs
- */
- void initModule ();
-
- /**
- * Configures the chip via the SPI
- */
- void configModule ();
-
- /**
- * Sends a command to an SPI bus (rs must be LOW)
- *
- * @param value Command number
- */
- void write (uint8_t value);
-
- /**
- * Sends data to an SPI bus (rs must be HIGH)
- *
- * @param value Command number
- */
- void data (uint8_t value);
-
- /**
- * Executes a set of commands and data
- *
- * @param addr Pointer to the start of the commands/data section
- */
- void executeCMDList (const uint8_t *addr);
-
- /**
- * Sets the window size inside the screen where pixels data
- * is written.
- *
- * @param x0 First coordinate
- * @param y0 First coordinate
- * @param x1 Second coordinate
- * @param y1 Second coordinate
- */
- void setAddrWindow (uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1);
-
- /**
- * Sends a pixel color (RGB) to the chip.
- *
- * @param x Axis on the horizontal scale
- * @param y Axis on the vertical scale
- * @param color RGB (16-bit) color (R[0-4], G[5-10], B[11-15])
- */
- void drawPixel (int16_t x, int16_t y, uint16_t color);
-
- /**
- * Copies the buffer to the chip via the SPI.
- */
- void refresh ();
-
- /**
- * LCD chip select is LOW
- */
- mraa::Result lcdCSOn ();
-
- /**
- * LCD chip select is HIGH
- */
- mraa::Result lcdCSOff ();
-
- /**
- * CD card chip select is LOW
- */
- mraa::Result sdCSOn ();
-
- /**
- * CD card select is HIGH
- */
- mraa::Result sdCSOff ();
-
- /**
- * Data select is HIGH
- */
- mraa::Result rsHIGH ();
-
- /**
- * Data select is LOW
- */
- mraa::Result rsLOW ();
-
- uint8_t m_map[160 * 128 * 2]; /**< Screens buffer */
- private:
- mraa::Spi m_spi;
- uint8_t m_spiBuffer[32];
-
- mraa::Gpio m_csLCDPinCtx;
- mraa::Gpio m_cSDPinCtx;
- mraa::Gpio m_rSTPinCtx;
- mraa::Gpio m_rSPinCtx;
-
- std::string m_name;
-};
-
-}
diff --git a/peripheral/libupm/src/stepmotor/CMakeLists.txt b/peripheral/libupm/src/stepmotor/CMakeLists.txt
deleted file mode 100644
index 666086b..0000000
--- a/peripheral/libupm/src/stepmotor/CMakeLists.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-set (libname "stepmotor")
-set (libdescription "upm STEPMOTOR")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
-target_link_libraries(${libname} rt)
diff --git a/peripheral/libupm/src/stepmotor/javaupm_stepmotor.i b/peripheral/libupm/src/stepmotor/javaupm_stepmotor.i
deleted file mode 100644
index 96ec7bc..0000000
--- a/peripheral/libupm/src/stepmotor/javaupm_stepmotor.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_stepmotor
-%include "../upm.i"
-
-%{
- #include "stepmotor.h"
-%}
-
-%include "stepmotor.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_stepmotor");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/stepmotor/jsupm_stepmotor.i b/peripheral/libupm/src/stepmotor/jsupm_stepmotor.i
deleted file mode 100644
index 9cea2ec..0000000
--- a/peripheral/libupm/src/stepmotor/jsupm_stepmotor.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_stepmotor
-%include "../upm.i"
-
-%{
- #include "stepmotor.h"
-%}
-
-%include "stepmotor.h"
diff --git a/peripheral/libupm/src/stepmotor/pyupm_stepmotor.i b/peripheral/libupm/src/stepmotor/pyupm_stepmotor.i
deleted file mode 100644
index 83ade00..0000000
--- a/peripheral/libupm/src/stepmotor/pyupm_stepmotor.i
+++ /dev/null
@@ -1,13 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_stepmotor
-%include "../upm.i"
-
-%include "stdint.i"
-
-%feature("autodoc", "3");
-
-%include "stepmotor.h"
-%{
- #include "stepmotor.h"
-%}
diff --git a/peripheral/libupm/src/stepmotor/stepmotor.cxx b/peripheral/libupm/src/stepmotor/stepmotor.cxx
deleted file mode 100644
index 574c536..0000000
--- a/peripheral/libupm/src/stepmotor/stepmotor.cxx
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * Authors: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Mihai Tudor Panu <mihai.tudor.panu@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <string>
-#include <stdexcept>
-#include <stdlib.h>
-#include <time.h>
-#include "stepmotor.h"
-
-using namespace upm;
-using namespace std;
-
-StepMotor::StepMotor (int dirPin, int stePin, int steps, int enPin)
- : m_dirPinCtx(dirPin),
- m_stePinCtx(stePin),
- m_enPinCtx(0),
- m_steps(steps) {
- m_name = "StepMotor";
- setSpeed(60);
- setPosition(0);
-
- if (m_dirPinCtx.dir(mraa::DIR_OUT) != mraa::SUCCESS) {
- throw std::runtime_error(string(__FUNCTION__) +
- ": Could not initialize dirPin as output");
- return;
- }
- m_dirPinCtx.useMmap(true);
- m_dirPinCtx.write(0);
-
- if (m_stePinCtx.dir(mraa::DIR_OUT) != mraa::SUCCESS) {
- throw std::runtime_error(string(__FUNCTION__) +
- ": Could not initialize stePin as output");
- return;
- }
- m_stePinCtx.useMmap(true);
- m_stePinCtx.write(0);
-
- if (enPin >= 0) {
- m_enPinCtx = new mraa::Gpio(enPin);
- if(m_enPinCtx->dir(mraa::DIR_OUT) != mraa::SUCCESS) {
- throw std::runtime_error(string(__FUNCTION__) +
- ": Could not initialize enPin as output");
- return;
- }
- m_enPinCtx->useMmap(true);
- enable(true);
- }
-}
-
-StepMotor::~StepMotor () {
- if (m_enPinCtx)
- delete m_enPinCtx;
-}
-
-void
-StepMotor::enable (bool flag) {
- if (m_enPinCtx) {
- m_enPinCtx->write(flag);
- } else {
- throw std::runtime_error(string(__FUNCTION__) +
- ": Enable pin not defined");
- }
-}
-
-void
-StepMotor::setSpeed (int speed) {
- if (speed > 0) {
- m_delay = 60000000 / (speed * m_steps);
- } else {
- throw std::invalid_argument(string(__FUNCTION__) +
- ": Parameter must be greater than 0");
- }
-}
-
-mraa::Result
-StepMotor::step (int ticks) {
- if (ticks < 0) {
- return stepBackward(abs(ticks));
- } else {
- return stepForward(ticks);
- }
-}
-
-mraa::Result
-StepMotor::stepForward (int ticks) {
- dirForward();
- for (int i = 0; i < ticks; i++) {
- move();
- m_position++;
- delayus(m_delay - MINPULSE_US - OVERHEAD_US);
- }
- return mraa::SUCCESS;
-}
-
-mraa::Result
-StepMotor::stepBackward (int ticks) {
- dirBackward();
- for (int i = 0; i < ticks; i++) {
- move();
- m_position--;
- delayus(m_delay - MINPULSE_US - OVERHEAD_US);
- }
- return mraa::SUCCESS;
-}
-
-void
-StepMotor::setPosition (int pos) {
- m_position = pos;
-}
-
-int
-StepMotor::getPosition () {
- return m_position;
-}
-
-int
-StepMotor::getStep () {
- return m_position < 0 ? m_steps + m_position % m_steps :
- m_position % m_steps;
-}
-
-void
-StepMotor::move () {
- m_stePinCtx.write(1);
- delayus(MINPULSE_US);
- m_stePinCtx.write(0);
-}
-
-mraa::Result
-StepMotor::dirForward () {
- mraa::Result error = m_dirPinCtx.write(HIGH);
- if (error != mraa::SUCCESS) {
- throw std::runtime_error(string(__FUNCTION__) +
- ": Could not write to dirPin");
- }
- return error;
-}
-
-mraa::Result
-StepMotor::dirBackward () {
- mraa::Result error = m_dirPinCtx.write(LOW);
- if (error != mraa::SUCCESS) {
- throw std::runtime_error(string(__FUNCTION__) +
- ": Could not write to dirPin");
- }
- return error;
-}
-
-void upm::StepMotor::delayus (int us) {
- int diff = 0;
- struct timespec gettime_now;
-
- clock_gettime(CLOCK_REALTIME, &gettime_now);
- int start = gettime_now.tv_nsec;
- while (diff < us * 1000)
- {
- clock_gettime(CLOCK_REALTIME, &gettime_now);
- diff = gettime_now.tv_nsec - start;
- if (diff < 0)
- diff += 1000000000;
- }
-}
diff --git a/peripheral/libupm/src/stepmotor/stepmotor.h b/peripheral/libupm/src/stepmotor/stepmotor.h
deleted file mode 100644
index 1d996d9..0000000
--- a/peripheral/libupm/src/stepmotor/stepmotor.h
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * Authors: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Mihai Tudor Panu <mihai.tudor.panu@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Credits to Adafruit.
- * Based on Adafruit BMP085 library.
- *
- * 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 <string>
-#include <mraa/pwm.hpp>
-#include <mraa/common.hpp>
-#include <mraa/gpio.hpp>
-
-#define OVERHEAD_US 6
-#define MINPULSE_US 5
-
-#define HIGH 1
-#define LOW 0
-
-namespace upm {
-/**
- * @brief Stepper Motor library
- * @defgroup stepmotor libupm-stepmotor
- * @ingroup sparkfun generic gpio motor
- */
-/**
- * @library stepmotor
- * @sensor stepmotor
- * @comname Stepper Motor
- * @altname EasyDriver Stepper Motor Driver
- * @type motor
- * @man sparkfun generic
- * @web http://www.schmalzhaus.com/EasyDriver/index.html
- * @con gpio
- *
- * @brief API for the Stepper Motor
- *
- * This module defines the Stepper Motor interface. It is compatible with
- * stepper motor drivers that use 2 pins to control the motor, like an Easy
- * Driver from Brian Schmalz or the STR driver series from Applied Motion. It
- * can also control an enable pin if one is available and connected.
- *
- * The implementation is synchronous and thus blocking while the stepper motor
- * is in motion. However it is possible to send the commands via threading and
- * the performance of the library will be very good given a low CPU load. On a
- * busy system though you will notice some jitter especially at higher speeds.
- * It is possible to reduce this effect to some extent by using smoothing
- * and/or microstepping on stepper drivers that support such features.
- *
- * @image html stepmotor.jpg
- * <br><em>EasyDriver Sensor image provided by SparkFun* under
- * <a href=https://creativecommons.org/licenses/by-nc-sa/3.0/>
- * CC BY-NC-SA-3.0</a>.</em>
- *
- * @snippet stepmotor.cxx Interesting
- */
-class StepMotor {
- public:
- /**
- * Instantiates a StepMotor object.
- *
- * @param dirPin Direction GPIO pin
- * @param stePin Stepper pulse GPIO pin
- * @param steps Number of steps per revolution (Default 200)
- * @param enPin Enable pin if connected (Optional)
- */
- StepMotor (int dirPin, int stePin, int steps = 200, int enPin = -1);
-
- /**
- * StepMotor object destructor.
- */
- ~StepMotor ();
-
- /**
- * Can be used to enable/disable the stepper driver if an enable pin is
- * available and connected. Check your data sheet as some drivers might
- * have the enable logic inverted.
- *
- * @param flag true to enable or false to disable
- */
- void enable (bool flag);
-
- /**
- * Sets the rotation speed in rpm. Default 60 rpm.
- *
- * @param speed Rotation speed in rpm
- */
- void setSpeed (int speed);
-
- /**
- * Rotates the motor by the specified number of steps. Positive values
- * rotate clockwise and negative values rotate counter-clockwise.
- *
- * @param ticks Number of steps the motor moves
- */
- mraa::Result step (int ticks);
-
- /**
- * Rotates the motor forward (clockwise).
- *
- * @param ticks Number of steps the motor moves
- */
- mraa::Result stepForward (int ticks);
-
- /**
- * Rotates the motor backward (counter-clockwise).
- *
- * @param ticks Number of steps the motor moves
- */
- mraa::Result stepBackward (int ticks);
-
- /**
- * Sets the current position. Useful if the motor is not at 0 when the
- * driver is initialized.
- *
- * @param step Current position
- */
- void setPosition (int pos);
-
- /**
- * Gets the current position. This is cumulative and the result of all
- * the step commands sent to the motor.
- *
- * @return Stepper's position.
- */
- int getPosition ();
-
- /**
- * Gets the current step. This is relative to one revolution.
- *
- * @return Current step, ranges from 0 to number of steps per revolution.
- */
- int getStep ();
-
- private:
- std::string m_name;
-
- mraa::Gpio m_dirPinCtx;
- mraa::Gpio m_stePinCtx;
- mraa::Gpio *m_enPinCtx;
-
- int m_delay;
- int m_steps;
- int m_position;
-
- mraa::Result dirForward ();
- mraa::Result dirBackward ();
- void move ();
- void delayus (int us);
- };
-}
diff --git a/peripheral/libupm/src/sx1276/CMakeLists.txt b/peripheral/libupm/src/sx1276/CMakeLists.txt
deleted file mode 100644
index 21fb5ad..0000000
--- a/peripheral/libupm/src/sx1276/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "sx1276")
-set (libdescription "SZ1276 LoRa/FSK/OOK radio")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/sx1276/LICENSE.txt b/peripheral/libupm/src/sx1276/LICENSE.txt
deleted file mode 100644
index 3078581..0000000
--- a/peripheral/libupm/src/sx1276/LICENSE.txt
+++ /dev/null
@@ -1,25 +0,0 @@
---- Revised BSD License ---
-Copyright (c) 2013, SEMTECH S.A.
-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 name of the Semtech corporation 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 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 SEMTECH S.A. 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. \ No newline at end of file
diff --git a/peripheral/libupm/src/sx1276/javaupm_sx1276.i b/peripheral/libupm/src/sx1276/javaupm_sx1276.i
deleted file mode 100644
index 61bb24b..0000000
--- a/peripheral/libupm/src/sx1276/javaupm_sx1276.i
+++ /dev/null
@@ -1,26 +0,0 @@
-%module javaupm_sx1276
-%include "../upm.i"
-%include "cpointer.i"
-%include "typemaps.i"
-%include "arrays_java.i";
-%include "../java_buffer.i"
-
-%{
- #include "sx1276.h"
-%}
-
-%ignore send(uint8_t *buffer, uint8_t size, int txTimeout);
-%ignore getRxBuffer();
-
-%include "sx1276.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_sx1276");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%}
diff --git a/peripheral/libupm/src/sx1276/jsupm_sx1276.i b/peripheral/libupm/src/sx1276/jsupm_sx1276.i
deleted file mode 100644
index 2911804..0000000
--- a/peripheral/libupm/src/sx1276/jsupm_sx1276.i
+++ /dev/null
@@ -1,9 +0,0 @@
-%module jsupm_sx1276
-%include "../upm.i"
-%include "cpointer.i"
-
-%include "sx1276.h"
-%{
- #include "sx1276.h"
-%}
-
diff --git a/peripheral/libupm/src/sx1276/pyupm_sx1276.i b/peripheral/libupm/src/sx1276/pyupm_sx1276.i
deleted file mode 100644
index 196de39..0000000
--- a/peripheral/libupm/src/sx1276/pyupm_sx1276.i
+++ /dev/null
@@ -1,17 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_sx1276
-%include "../upm.i"
-%include "cpointer.i"
-
-%include "stdint.i"
-
-%feature("autodoc", "3");
-
-%pointer_functions(float, floatp);
-
-%include "sx1276.h"
-%{
- #include "sx1276.h"
-%}
-
diff --git a/peripheral/libupm/src/sx1276/sx1276.cxx b/peripheral/libupm/src/sx1276/sx1276.cxx
deleted file mode 100644
index 64a5ae3..0000000
--- a/peripheral/libupm/src/sx1276/sx1276.cxx
+++ /dev/null
@@ -1,2164 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <stdexcept>
-#include <sstream>
-#include <string>
-#include <string.h>
-
-#ifdef JAVACALLBACK
-#undef JAVACALLBACK
-#endif
-
-#include "sx1276.h"
-
-using namespace upm;
-using namespace std;
-
-//
-// FSK bandwidth to register definition structs
-//
-typedef struct
-{
- uint32_t bandwidth;
- uint8_t RegValue;
-} FskBandwidth_t;
-
-static const FskBandwidth_t FskBandwidths[] =
-{
- { 2600 , 0x17 },
- { 3100 , 0x0F },
- { 3900 , 0x07 },
- { 5200 , 0x16 },
- { 6300 , 0x0E },
- { 7800 , 0x06 },
- { 10400 , 0x15 },
- { 12500 , 0x0D },
- { 15600 , 0x05 },
- { 20800 , 0x14 },
- { 25000 , 0x0C },
- { 31300 , 0x04 },
- { 41700 , 0x13 },
- { 50000 , 0x0B },
- { 62500 , 0x03 },
- { 83333 , 0x12 },
- { 100000, 0x0A },
- { 125000, 0x02 },
- { 166700, 0x11 },
- { 200000, 0x09 },
- { 250000, 0x01 },
- { 300000, 0x00 }, // Invalid Badwidth
-};
-
-
-SX1276::SX1276(uint8_t chipRev, int bus, int cs, int resetPin, int dio0,
- int dio1, int dio2, int dio3, int dio4, int dio5) :
- m_spi(bus), m_gpioCS(cs), m_gpioReset(resetPin), m_gpioDIO0(dio0),
- m_gpioDIO1(dio1), m_gpioDIO2(dio2), m_gpioDIO3(dio3), m_gpioDIO4(dio4),
- m_gpioDIO5(dio5)
-{
- m_spi.mode(mraa::SPI_MODE0);
- m_spi.frequency(10000000); // 10Mhz, if supported
-
- m_gpioCS.dir(mraa::DIR_OUT);
- m_gpioCS.useMmap(true);
- csOff();
-
- m_gpioReset.dir(mraa::DIR_IN);
-
- // 10ms for POR
- usleep(10000);
-
- // setup the interrupt handlers. All 6 of them.
- m_gpioDIO0.dir(mraa::DIR_IN);
- if (m_gpioDIO0.isr(mraa::EDGE_RISING, onDio0Irq, this))
- throw std::runtime_error(string(__FUNCTION__) +
- ": Gpio.isr(dio0) failed");
-
- m_gpioDIO1.dir(mraa::DIR_IN);
- if (m_gpioDIO1.isr(mraa::EDGE_RISING, onDio1Irq, this))
- throw std::runtime_error(string(__FUNCTION__) +
- ": Gpio.isr(dio1) failed");
-
- m_gpioDIO2.dir(mraa::DIR_IN);
- if (m_gpioDIO2.isr(mraa::EDGE_RISING, onDio2Irq, this))
- throw std::runtime_error(string(__FUNCTION__) +
- ": Gpio.isr(dio2) failed");
-
- m_gpioDIO3.dir(mraa::DIR_IN);
- if (m_gpioDIO3.isr(mraa::EDGE_RISING, onDio3Irq, this))
- throw std::runtime_error(string(__FUNCTION__) +
- ": Gpio.isr(dio3) failed");
-
- m_gpioDIO4.dir(mraa::DIR_IN);
- if (m_gpioDIO4.isr(mraa::EDGE_RISING, onDio4Irq, this))
- throw std::runtime_error(string(__FUNCTION__) +
- ": Gpio.isr(dio4) failed");
-
- // this one isn't as vital, so no need to fail if this one can't be
- // setup.
- m_gpioDIO5.dir(mraa::DIR_IN);
- if (m_gpioDIO5.isr(mraa::EDGE_RISING, onDio5Irq, this))
- cerr << __FUNCTION__ << ": Gpio.isr(dio5) failed" << endl;
-
- initClock();
- m_radioEvent = REVENT_DONE;
- m_settings.state = STATE_IDLE;
- memset(m_rxBuffer, 0, FIFO_SIZE);
- m_rxSNR = 0;
- m_rxRSSI = 0;
-
- // check the chip revision (to make sure we can read the regs properly)
- uint8_t cRev = getChipVersion();
- if (cRev != chipRev)
- {
- std::ostringstream str;
- std::ostringstream str2;
-
- str << hex << (int)cRev << dec;
- str2 << hex << (int)chipRev << dec;
- throw std::runtime_error(string(__FUNCTION__) +
- ": Incorrect Chip Revision. Expected 0x" +
- str2.str() + ", got 0x" + str.str());
- }
-
- pthread_mutexattr_t mutexAttrib;
- pthread_mutexattr_init(&mutexAttrib);
- // pthread_mutexattr_settype(&mutexAttrib, PTHREAD_MUTEX_RECURSIVE);
-
- if (pthread_mutex_init(&m_intrLock, &mutexAttrib))
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": pthread_mutex_init(intrLock) failed");
- }
-
- pthread_mutexattr_destroy(&mutexAttrib);
-
- init();
-}
-
-SX1276::~SX1276()
-{
- pthread_mutex_destroy(&m_intrLock);
-}
-
-uint8_t SX1276::readReg(uint8_t reg)
-{
- uint8_t pkt[2] = {(reg & 0x7f), 0};
-
- csOn();
- if (m_spi.transfer(pkt, pkt, 2))
- {
- csOff();
- throw std::runtime_error(string(__FUNCTION__) +
- ": Spi.transfer() failed");
- return 0;
- }
- csOff();
-
- return pkt[1];
-}
-
-bool SX1276::writeReg(uint8_t reg, uint8_t val)
-{
- uint8_t pkt[2] = {reg | m_writeMode, val};
-
- csOn();
- if (m_spi.transfer(pkt, NULL, 2))
- {
- csOff();
- throw std::runtime_error(string(__FUNCTION__) +
- ": Spi.transfer() failed");
- return false;
- }
- csOff();
-
- return true;
-}
-
-void SX1276::readFifo(uint8_t *buffer, int len)
-{
- // can't read more than 256 bytes
- if (len > FIFO_SIZE)
- {
- throw std::length_error(string(__FUNCTION__) +
- ": cannot read more than 256 bytes from FIFO");
- return;
- }
-
- uint8_t pkt = 0;
-
- csOn();
- if (m_spi.transfer(&pkt, NULL, 1))
- {
- csOff();
- throw std::runtime_error(string(__FUNCTION__) +
- ": Spi.transfer(0) failed");
- return;
- }
-
- if (m_spi.transfer(NULL, buffer, len))
- {
- csOff();
- throw std::runtime_error(string(__FUNCTION__) +
- ": Spi.transfer(buf) failed");
- return;
- }
- csOff();
-}
-
-void SX1276::writeFifo(uint8_t *buffer, int len)
-{
- // can't write more than 256 bytes
- if (len > FIFO_SIZE)
- {
- throw std::length_error(string(__FUNCTION__) +
- ": cannot write more than 256 bytes to FIFO");
- return;
- }
-
- uint8_t pkt = (0 | m_writeMode);
-
- csOn();
- if (m_spi.transfer(&pkt, NULL, 1))
- {
- csOff();
- throw std::runtime_error(string(__FUNCTION__) +
- ": Spi.transfer(0) failed");
- return;
- }
-
- if (m_spi.transfer(buffer, NULL, len))
- {
- csOff();
- throw std::runtime_error(string(__FUNCTION__) +
- ": Spi.transfer(buf) failed");
- return;
- }
- csOff();
-}
-
-
-uint8_t SX1276::getChipVersion()
-{
- return readReg(COM_RegVersion);
-}
-
-
-void SX1276::reset()
-{
- m_gpioReset.dir(mraa::DIR_OUT);
- usleep(1000); // 1ms
- m_gpioReset.dir(mraa::DIR_IN);
- usleep(10000); // 10ms
-}
-
-
-void SX1276::init()
-{
- typedef struct
- {
- RADIO_MODEM_T Modem;
- uint8_t Addr;
- uint8_t Value;
- } radioRegisters_t;
-
- // some initial setup
- static const radioRegisters_t radioRegsInit[] = {
- { MODEM_FSK , COM_RegLna , 0x23 },
- { MODEM_FSK , FSK_RegRxConfig , 0x1E },
- { MODEM_FSK , FSK_RegRssiConfg , 0xD2 },
- { MODEM_FSK , FSK_RegPreambleDetect , 0xAA },
- { MODEM_FSK , FSK_RegOsc , 0x07 },
- { MODEM_FSK , FSK_RegSyncConfig , 0x12 },
- { MODEM_FSK , FSK_RegSyncValue1 , 0xC1 },
- { MODEM_FSK , FSK_RegSyncValue2 , 0x94 },
- { MODEM_FSK , FSK_RegSyncValue3 , 0xC1 },
- { MODEM_FSK , FSK_RegPacketConfig1 , 0xD8 },
- { MODEM_FSK , FSK_RegFifoThresh , 0x8F },
- { MODEM_FSK , FSK_RegImageCal , 0x02 },
- { MODEM_FSK , COM_RegDioMapping1 , 0x00 },
- { MODEM_FSK , COM_RegDioMapping2 , 0x30 },
- { MODEM_LORA, LOR_RegMaxPayloadLength, 0x40 }
- };
-
- reset();
-
- rxChainCalibration();
-
- setOpMode(MODE_Sleep);
-
- for (int i = 0; i < sizeof(radioRegsInit) / sizeof(radioRegisters_t); i++ )
- {
- setModem(radioRegsInit[i].Modem);
- writeReg(radioRegsInit[i].Addr, radioRegsInit[i].Value);
- }
-
- setModem(MODEM_FSK);
- m_settings.state = STATE_IDLE;
-}
-
-void SX1276::rxChainCalibration()
-{
- uint8_t regPaConfigInitVal;
- uint32_t initialFreq;
- uint8_t reg;
-
- // this function should only be called in init() (after reset()), as
- // the device is configured for FSK mode, LF at that time.
-
- // Save context
- regPaConfigInitVal = readReg(COM_RegPaConfig);
- initialFreq = (uint32_t) ( ((double)
- (((uint32_t)readReg(COM_RegFrfMsb) << 16) |
- ((uint32_t)readReg(COM_RegFrfMid) << 8) |
- ((uint32_t)readReg(COM_RegFrfLsb)) ) )
- * FXOSC_STEP);
-
- // Cut the PA just in case, RFO output, power = -1 dBm
- writeReg(COM_RegPaConfig, 0x00);
-
- // Launch Rx chain calibration for LF band
- reg = readReg(FSK_RegImageCal);
- writeReg(FSK_RegImageCal, reg | IMAGECAL_ImageCalStart);
-
- // spin until complete
- while (readReg(FSK_RegImageCal) & IMAGECAL_ImageCalRunning)
- usleep(1);
-
- // cerr << __FUNCTION__ << ": Imagecal LF complete" << endl;
-
- // Set a Frequency in HF band
- setChannel(868000000);
-
- // Launch Rx chain calibration for HF band
- reg = readReg(FSK_RegImageCal);
- writeReg(FSK_RegImageCal, reg | IMAGECAL_ImageCalStart);
-
- // spin until complete
- while (readReg(FSK_RegImageCal) & IMAGECAL_ImageCalRunning)
- usleep(1);
-
- // cerr << __FUNCTION__ << ": Imagecal HF complete" << endl;
-
- // Restore context
- writeReg(COM_RegPaConfig, regPaConfigInitVal);
- setChannel(initialFreq);
-}
-
-void SX1276::setChannel(uint32_t freq)
-{
- m_settings.channel = freq;
-
- freq = ( uint32_t )( ( double )freq / FXOSC_STEP );
-
- writeReg(COM_RegFrfMsb, ( uint8_t )( ( freq >> 16 ) & 0xff ) );
- writeReg(COM_RegFrfMid, ( uint8_t )( ( freq >> 8 ) & 0xff ) );
- writeReg(COM_RegFrfLsb, ( uint8_t )( freq & 0xff ) );
-}
-
-void SX1276::setOpMode(MODE_T opMode)
-{
- static uint8_t opModePrev = MODE_Standby;
-
- if(opMode != opModePrev)
- {
- opModePrev = opMode;
-
- uint8_t reg = readReg(COM_RegOpMode) &
- ~(_OPMODE_Mode_MASK << _OPMODE_Mode_SHIFT);
-
- writeReg(COM_RegOpMode, (reg | (opMode << _OPMODE_Mode_SHIFT)) );
- }
-}
-
-void SX1276::setModem(RADIO_MODEM_T modem)
-{
- if (m_settings.modem == modem )
- {
- return;
- }
-
- m_settings.modem = modem;
-
- uint8_t reg = 0;
-
- switch (m_settings.modem)
- {
- default:
- case MODEM_FSK:
- setOpMode(MODE_Sleep);
-
- // turn off lora
- reg = (readReg(COM_RegOpMode) & ~OPMODE_LongRangeMode);
- writeReg(COM_RegOpMode, reg);
-
- writeReg(COM_RegDioMapping1, 0x00);
- writeReg(COM_RegDioMapping2, 0x30); // DIO5=ModeReady
-
- break;
-
- case MODEM_LORA:
- setOpMode(MODE_Sleep);
- // turn lora on
- reg = (readReg(COM_RegOpMode) | OPMODE_LongRangeMode);
- writeReg(COM_RegOpMode, reg);
-
- writeReg(COM_RegDioMapping1, 0x00);
- writeReg(COM_RegDioMapping2, 0x00);
-
- break;
- }
-}
-
-bool SX1276::isChannelFree(RADIO_MODEM_T modem, uint32_t freq,
- int16_t rssiThresh)
-{
- int16_t rssi = 0;
-
- setModem(modem);
-
- setChannel(freq);
-
- setOpMode(MODE_FSK_RxMode);
-
- usleep(1000);
-
- rssi = getRSSI(modem);
-
- setSleep();
-
- if (rssi > rssiThresh)
- {
- return false;
- }
-
- return true;
-}
-
-int16_t SX1276::getRSSI(RADIO_MODEM_T modem)
-{
- int16_t rssi = 0;
-
- switch (modem)
- {
- case MODEM_FSK:
- // devide by 2
- rssi = -(readReg(FSK_RegRssiValue) >> 1);
-
- break;
-
- case MODEM_LORA:
- {
- uint8_t reg = readReg(LOR_RegRssiValue);
- if (m_settings.channel > RF_MID_BAND_THRESH )
- {
- rssi = LOR_RSSI_OFFSET_HF + reg;
- }
- else
- {
- rssi = LOR_RSSI_OFFSET_LF + reg;
- }
- }
- break;
-
- default:
- rssi = -1;
-
- break;
- }
-
- return rssi;
-}
-
-void SX1276::setSleep()
-{
- setOpMode(MODE_Sleep);
- m_settings.state = STATE_IDLE;
-}
-
-void SX1276::setStandby()
-{
- setOpMode(MODE_Standby);
- m_settings.state = STATE_IDLE;
-}
-
-uint8_t SX1276::lookupFSKBandWidth(uint32_t bw)
-{
- // This function looks up values in the fsk_bw_lookup_table and
- // returns the approprite register value to use for either the
- // FSK_RxBw or the FSK_RegAfcBw registers
-
- // See Table 40 in the datasheet
-
- for (int i=0; i<(sizeof(FskBandwidths)/sizeof(FskBandwidth_t)) - 1; i++)
- {
- if ( (bw >= FskBandwidths[i].bandwidth) &&
- (bw < FskBandwidths[i + 1].bandwidth) )
- {
- return FskBandwidths[i].RegValue;
- }
- }
-
- // shouldn't happen, but the universe is vast and indifferent...
- throw std::range_error(std::string(__FUNCTION__) +
- ": Unable to find bandwidth in lookup table. "
- "Bandwidth must be between 2600 and 250000 for FSK");
-
- return 0;
-}
-
-SX1276::RADIO_EVENT_T SX1276::sendStr(string buffer, int timeout)
-{
- if (buffer.size() > (FIFO_SIZE - 1))
- throw std::range_error(string(__FUNCTION__) +
- ": buffer size must be less than 256");
-
- // for LORA/FSK modem, there seems to be a 64 byte requirement,
- // (LOR_RegRxNbBytes on the receiver) never seems to be anything
- // other than 64. Same seems to go for the FSK modem. So, if the
- // packet is less than 64, pad it out to 64 bytes. This requires
- // investigation.
- while (buffer.size() < 64)
- buffer.push_back(0);
-
- return send((uint8_t *)buffer.c_str(), buffer.size(), timeout);
-}
-
-SX1276::RADIO_EVENT_T SX1276::send(uint8_t *buffer, uint8_t size,
- int txTimeout)
-{
- switch (m_settings.modem)
- {
- case MODEM_FSK:
- {
- m_settings.fskPacketHandler.NbBytes = 0;
- m_settings.fskPacketHandler.Size = size;
-
- if (m_settings.fskSettings.FixLen == false)
- {
- writeFifo((uint8_t *)&size, 1);
- }
- else
- {
- writeReg(FSK_RegPayloadLength, size );
- }
-
- if ( (size > 0) && (size <= 64) )
- {
- m_settings.fskPacketHandler.ChunkSize = size;
- }
- else
- {
- m_settings.fskPacketHandler.ChunkSize = 32;
- }
-
- // Write payload buffer
- writeFifo(buffer, m_settings.fskPacketHandler.ChunkSize);
- m_settings.fskPacketHandler.NbBytes +=
- m_settings.fskPacketHandler.ChunkSize;
- }
-
- break;
-
- case MODEM_LORA:
- {
- if (m_settings.loraSettings.IqInverted == true)
- {
- uint8_t reg = readReg(LOR_RegInvertIQ);
-
- reg &= ~(INVERTIQ_InvertIQTxOff | INVERTIQ_InvertIQRx);
- writeReg(LOR_RegInvertIQ, reg);
-
- // warning, hardcoded undocumented magic number into
- // undocumented register
- writeReg(LOR_RegInvertIQ2, 0x19);
- }
- else
- {
- uint8_t reg = readReg(LOR_RegInvertIQ);
- reg &= ~(INVERTIQ_InvertIQTxOff | INVERTIQ_InvertIQRx);
- reg |= INVERTIQ_InvertIQTxOff; // 'active' off.
- writeReg(LOR_RegInvertIQ, reg);
-
- // warning, hardcoded undocumented magic number into
- // undocumented register
- writeReg(LOR_RegInvertIQ2, 0x1d);
- }
-
- m_settings.loraPacketHandler.Size = size;
- // cerr << "PAYLOAD SIZE " << (int)size << endl;
-
- // Initializes the payload size
- writeReg(LOR_RegPayloadLength, size);
-
- // Full buffer used for Tx
- writeReg(LOR_RegFifoTxBaseAddr, 0);
- writeReg(LOR_RegFifoAddrPtr, 0 );
-
- // FIFO operations can not take place in Sleep mode
- if ((readReg(COM_RegOpMode) & _OPMODE_Mode_MASK) == MODE_Sleep)
- {
- setStandby();
- usleep(1000); // 1ms
- }
-
- // Write payload buffer
- writeFifo(buffer, size);
- }
-
- break;
- }
-
- return setTx(txTimeout);
-}
-
-
-void SX1276::setRxConfig(RADIO_MODEM_T modem, uint32_t bandwidth,
- uint32_t datarate, uint8_t coderate,
- uint32_t bandwidthAfc, uint16_t preambleLen,
- uint16_t symbTimeout, bool fixLen,
- uint8_t payloadLen,
- bool crcOn, bool freqHopOn, uint8_t hopPeriod,
- bool iqInverted, bool rxContinuous)
-{
- setModem( modem );
-
- uint8_t reg;
-
- switch (modem)
- {
- case MODEM_FSK:
- {
- m_settings.fskSettings.Bandwidth = bandwidth;
- m_settings.fskSettings.Datarate = datarate;
- m_settings.fskSettings.BandwidthAfc = bandwidthAfc;
- m_settings.fskSettings.FixLen = fixLen;
- m_settings.fskSettings.PayloadLen = payloadLen;
- m_settings.fskSettings.CrcOn = crcOn;
- m_settings.fskSettings.IqInverted = iqInverted;
- m_settings.fskSettings.RxContinuous = rxContinuous;
- m_settings.fskSettings.PreambleLen = preambleLen;
-
- datarate = (uint16_t)(FXOSC_FREQ / (double)datarate);
- writeReg(FSK_RegBitrateMsb, (uint8_t)(datarate >> 8));
- writeReg(FSK_RegBitrateLsb, (uint8_t)(datarate & 0xff));
-
- writeReg(FSK_RegRxBw, lookupFSKBandWidth(bandwidth));
- writeReg(FSK_RegAfcBw, lookupFSKBandWidth(bandwidthAfc));
-
- writeReg(FSK_RegPreambleMsb,
- (uint8_t)((preambleLen >> 8) & 0xff));
- writeReg(FSK_RegPreambleLsb, (uint8_t)(preambleLen & 0xff));
-
- if (fixLen)
- {
- writeReg(FSK_RegPayloadLength, payloadLen);
- }
-
- reg = readReg(FSK_RegPacketConfig1);
- reg &= ~(PACKETCONFIG1_CrcOn | PACKETCONFIG1_PacketFormat);
-
- if (!fixLen)
- reg |= PACKETCONFIG1_PacketFormat; // variable len
-
- if (crcOn)
- reg |= PACKETCONFIG1_CrcOn;
-
- writeReg(FSK_RegPacketConfig1, reg);
- }
-
- break;
-
- case MODEM_LORA:
- {
- // convert the supplied (legal) LORA bandwidths into something
- // the chip can handle.
- switch (bandwidth)
- {
- case 125000:
- bandwidth = BW_125;
- break;
-
- case 250000:
- bandwidth = BW_250;
- break;
-
- case 500000:
- bandwidth = BW_500;
- break;
-
- default:
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": LORA bandwidth must be 125000, 250000, "
- "or 500000");
- }
-
- m_settings.loraSettings.Bandwidth = bandwidth;
- m_settings.loraSettings.Datarate = datarate;
- m_settings.loraSettings.Coderate = coderate;
- m_settings.loraSettings.FixLen = fixLen;
- m_settings.loraSettings.PayloadLen = payloadLen;
- m_settings.loraSettings.CrcOn = crcOn;
- m_settings.loraSettings.FreqHopOn = freqHopOn;
- m_settings.loraSettings.HopPeriod = hopPeriod;
- m_settings.loraSettings.IqInverted = iqInverted;
- m_settings.loraSettings.RxContinuous = rxContinuous;
-
- // datarate is really LORA SPREADING_FACTOR_*
- if (datarate > 12)
- {
- datarate = 12;
- }
- else if (datarate < 6)
- {
- datarate = 6;
- }
-
- if ( ((bandwidth == BW_125) && ((datarate == 11) ||
- (datarate == 12))) ||
- ((bandwidth == BW_250) && (datarate == 12)) )
- {
- m_settings.loraSettings.LowDatarateOptimize = true;
- }
- else
- {
- m_settings.loraSettings.LowDatarateOptimize = false;
- }
-
- reg = readReg(LOR_RegModemConfig1);
- reg &= ~((_MODEMCONFIG1_CodingRate_MASK <<
- _MODEMCONFIG1_CodingRate_SHIFT) |
- (_MODEMCONFIG1_Bw_MASK << _MODEMCONFIG1_Bw_SHIFT) |
- MODEMCONFIG1_ImplicitHeaderModeOn);
-
- if (fixLen)
- reg |= MODEMCONFIG1_ImplicitHeaderModeOn;
-
- reg |= ((bandwidth & _MODEMCONFIG1_Bw_MASK) << _MODEMCONFIG1_Bw_SHIFT);
- reg |= ((coderate & _MODEMCONFIG1_CodingRate_MASK) <<
- _MODEMCONFIG1_CodingRate_SHIFT);
-
- writeReg(LOR_RegModemConfig1, reg);
-
- reg = readReg(LOR_RegModemConfig2);
- reg &= ~((_MODEMCONFIG2_SpreadingFactor_MASK <<
- _MODEMCONFIG2_SpreadingFactor_SHIFT) |
- MODEMCONFIG2_RxPayloadCrcOn |
- (_MODEMCONFIG2_SymbTimeoutMsb_MASK <<
- _MODEMCONFIG2_SymbTimeoutMsb_SHIFT));
-
- if (crcOn)
- reg |= MODEMCONFIG2_RxPayloadCrcOn;
-
- reg |= ((datarate & _MODEMCONFIG2_SpreadingFactor_MASK) <<
- _MODEMCONFIG2_SpreadingFactor_SHIFT);
-
- // mask symbTimeOut (MSB) for safety
- reg |= ( ((symbTimeout >> 8) & _MODEMCONFIG2_SymbTimeoutMsb_MASK) <<
- _MODEMCONFIG2_SymbTimeoutMsb_SHIFT);
- writeReg(LOR_RegModemConfig2, reg);
-
- reg = readReg(LOR_RegModemConfig3);
-
- reg &= ~MODEMCONFIG3_LowDataRateOptimize;
-
- if (m_settings.loraSettings.LowDatarateOptimize)
- reg |= MODEMCONFIG3_LowDataRateOptimize;
-
- writeReg(LOR_RegModemConfig3, reg);
-
- writeReg(LOR_RegSymbTimeoutLsb, (uint8_t)(symbTimeout & 0xff));
-
-
- writeReg(LOR_RegPreambleMsb, (uint8_t)((preambleLen >> 8) & 0xff));
- writeReg(LOR_RegPreambleLsb, (uint8_t)(preambleLen & 0xff));
-
- if (fixLen == 1)
- writeReg(LOR_RegPayloadLength, payloadLen);
-
- // The datasheet says this is only valid in FSK mode, but
- // Semtech code indicates it is only available in LORA
- // mode... So which is it?
-
- // Lets assume for now that the code is correct, as there
- // is a HopPeriod register for LoRa, and no such registers
- // exist for FSK.
- if (m_settings.loraSettings.FreqHopOn)
- {
- reg = readReg(LOR_RegPllHop);
- reg &= ~PLLHOP_FastHopOn;
- reg |= PLLHOP_FastHopOn;
- writeReg(LOR_RegPllHop, reg);
-
- writeReg(LOR_RegHopPeriod, m_settings.loraSettings.HopPeriod);
- }
- else
- {
- reg = readReg(LOR_RegPllHop);
- reg &= ~PLLHOP_FastHopOn;
- writeReg(LOR_RegPllHop, reg);
- }
-
- // errata checks - writing magic numbers into undocumented,
- // reserved registers :) The Semtech code was broken in this
- // logic.
- if ( (bandwidth == BW_500) &&
- (m_settings.channel > RF_MID_BAND_THRESH) )
- {
- // ERRATA 2.1 - Sensitivity Optimization with a 500 kHz
- // Bandwidth (HF)
- writeReg(LOR_Reserved36, 0x02);
- writeReg(LOR_Reserved3a, 0x64);
- }
- else if (bandwidth == BW_500 &&
- (m_settings.channel >= 410000000))
- {
- // ERRATA 2.1 - Sensitivity Optimization with a 500 kHz
- // Bandwidth (LF above 410Mhz)
- writeReg(LOR_Reserved36, 0x02);
- writeReg(LOR_Reserved3a, 0x7f);
- }
- else
- {
- // ERRATA 2.1 - Sensitivity Optimization with a 500 kHz
- // Bandwidth (everything else)
- writeReg(LOR_Reserved36, 0x03);
- }
-
- // datarate is really LORA spreading factor
- if (datarate == 6)
- {
- // datarate == SPREADINGFACTOR_64
- reg = readReg(LOR_RegDetectOptimize);
- reg &= ~(_DETECTOPTIMIZE_DetectionOptimize_MASK <<
- _DETECTOPTIMIZE_DetectionOptimize_SHIFT);
-
- reg |= (DETECTIONOPTIMIZE_SF6 <<
- _DETECTOPTIMIZE_DetectionOptimize_SHIFT);
-
- writeReg(LOR_RegDetectOptimize, reg);
-
- // see page 27 in the datasheet
- writeReg(LOR_RegDetectionThreshold, LOR_DetectionThreshold_SF6);
- }
- else
- {
- reg = readReg(LOR_RegDetectOptimize);
- reg &= ~(_DETECTOPTIMIZE_DetectionOptimize_MASK <<
- _DETECTOPTIMIZE_DetectionOptimize_SHIFT);
-
- reg |= (DETECTIONOPTIMIZE_SF7_SF12 <<
- _DETECTOPTIMIZE_DetectionOptimize_SHIFT);
-
- writeReg(LOR_RegDetectOptimize, reg);
-
- // see page 27 in the datasheet
- writeReg(LOR_RegDetectionThreshold,
- LOR_DetectionThreshold_SF7_SF12);
- }
- }
- break;
- }
-}
-
-void SX1276::setTxConfig(RADIO_MODEM_T modem, int8_t power,
- uint32_t fdev,
- uint32_t bandwidth, uint32_t datarate,
- uint8_t coderate, uint16_t preambleLen,
- bool fixLen, bool crcOn, bool freqHopOn,
- uint8_t hopPeriod, bool iqInverted)
-{
- uint8_t paConfig = 0;
- uint8_t paDac = 0;
-
- setModem(modem);
-
- paConfig = readReg(COM_RegPaConfig);
- paDac = readReg(COM_RegPaDac);
-
- uint8_t paSelect = 0x00; // default, +14dBm
- if (m_settings.channel < RF_MID_BAND_THRESH)
- paSelect = PACONFIG_PaSelect; // PA_BOOST, +20dBm
-
- paConfig &= ~PACONFIG_PaSelect;
- paConfig |= paSelect;
- paConfig &= ~(_PACONFIG_MaxPower_MASK << _PACONFIG_MaxPower_SHIFT);
- paConfig |= (7 << _PACONFIG_MaxPower_SHIFT); // PACONFIG_MaxPower = 7
-
- if ((paConfig & PACONFIG_PaSelect))
- {
- if (power > 17)
- {
- paDac &= ~(_PADAC_PaDac_MASK << _PADAC_PaDac_SHIFT);
- paDac |= (PADAC_BOOST << _PADAC_PaDac_SHIFT);
- }
- else
- {
- paDac &= ~(_PADAC_PaDac_MASK << _PADAC_PaDac_SHIFT);
- paDac |= (PADAC_DEFAULT << _PADAC_PaDac_SHIFT);
- }
-
- if ((paDac & PADAC_BOOST) == PADAC_BOOST)
- {
- if (power < 5)
- {
- power = 5;
- }
- if (power > 20)
- {
- power = 20;
- }
- paConfig = ~(_PACONFIG_OutputPower_MASK & _PACONFIG_OutputPower_SHIFT);
- paConfig |= ( ((uint8_t)(power - 5) &
- _PACONFIG_OutputPower_MASK) <<
- _PACONFIG_OutputPower_SHIFT );
- }
- else
- {
- if (power < 2)
- {
- power = 2;
- }
- if (power > 17)
- {
- power = 17;
- }
-
- paConfig = ~(_PACONFIG_OutputPower_MASK & _PACONFIG_OutputPower_SHIFT);
- paConfig |= ( ((uint8_t)(power - 2) &
- _PACONFIG_OutputPower_MASK) <<
- _PACONFIG_OutputPower_SHIFT );
- }
- }
- else
- {
- if (power < -1)
- {
- power = -1;
- }
- if (power > 14)
- {
- power = 14;
- }
-
- paConfig = ~(_PACONFIG_OutputPower_MASK & _PACONFIG_OutputPower_SHIFT);
- paConfig |= ( ((uint8_t)(power + 1) &
- _PACONFIG_OutputPower_MASK) <<
- _PACONFIG_OutputPower_SHIFT );
- }
- writeReg(COM_RegPaConfig, paConfig);
- writeReg(COM_RegPaDac, paDac);
-
- uint8_t reg;
-
- switch (modem)
- {
- case MODEM_FSK:
- {
- m_settings.fskSettings.Power = power;
- m_settings.fskSettings.Fdev = fdev;
- m_settings.fskSettings.Bandwidth = bandwidth;
- m_settings.fskSettings.Datarate = datarate;
- m_settings.fskSettings.PreambleLen = preambleLen;
- m_settings.fskSettings.FixLen = fixLen;
- m_settings.fskSettings.CrcOn = crcOn;
- m_settings.fskSettings.IqInverted = iqInverted;
-
- fdev = (uint16_t)((double)fdev / FXOSC_STEP);
- writeReg(FSK_RegFdevMsb, (uint8_t)(fdev >> 8));
- writeReg(FSK_RegFdevLsb, (uint8_t)(fdev & 0xFF));
-
- datarate = (uint16_t)(FXOSC_FREQ / (double)datarate);
- writeReg(FSK_RegBitrateMsb, (uint8_t)(datarate >> 8));
- writeReg(FSK_RegBitrateLsb, (uint8_t)(datarate & 0xff));
-
- writeReg(FSK_RegPreambleMsb, (uint8_t)(preambleLen >> 8));
- writeReg(FSK_RegPreambleLsb, (uint8_t)(preambleLen & 0xff));
-
- reg = readReg(FSK_RegPacketConfig1);
- reg &= ~(PACKETCONFIG1_CrcOn | PACKETCONFIG1_PacketFormat);
-
- if (!fixLen)
- reg |= PACKETCONFIG1_PacketFormat; // variable len
-
- if (crcOn)
- reg |= PACKETCONFIG1_CrcOn;
-
- writeReg(FSK_RegPacketConfig1, reg);
- }
- break;
-
- case MODEM_LORA:
- {
- m_settings.loraSettings.Power = power;
-
- // we convert bandwidth into appropriate BW_* constants for LORA
- switch (bandwidth) {
- case 125000:
- bandwidth = BW_125;
- break;
-
- case 250000:
- bandwidth = BW_250;
- break;
-
- case 500000:
- bandwidth = BW_500;
- break;
-
- default:
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": LORA bandwidth must be 125000, 250000, "
- "or 500000");
- }
-
-
- m_settings.loraSettings.Bandwidth = bandwidth;
- m_settings.loraSettings.Datarate = datarate;
- m_settings.loraSettings.Coderate = coderate;
- m_settings.loraSettings.PreambleLen = preambleLen;
- m_settings.loraSettings.FixLen = fixLen;
- m_settings.loraSettings.FreqHopOn = freqHopOn;
- m_settings.loraSettings.HopPeriod = hopPeriod;
- m_settings.loraSettings.CrcOn = crcOn;
- m_settings.loraSettings.IqInverted = iqInverted;
-
- // datarate is really SPREADINGFACTOR_* for LoRa
- if (datarate > 12)
- {
- datarate = 12;
- }
- else if (datarate < 6)
- {
- datarate = 6;
- }
-
- if ( ((bandwidth == BW_125) && ((datarate == 11) ||
- (datarate == 12))) ||
- ((bandwidth == BW_250) && (datarate == 12)) )
- {
- m_settings.loraSettings.LowDatarateOptimize = true;
- }
- else
- {
- m_settings.loraSettings.LowDatarateOptimize = false;
- }
-
-
- // datasheet says this is only valid in FSK mode, but Semtech
- // code indicates it is only available in LORA mode... So
- // which is it?
-
- // Lets assume for now that the code is correct, as there
- // is a HopPeriod register for LoRa, and no such registers
- // exist for FSK.
- if (m_settings.loraSettings.FreqHopOn == true)
- {
- reg = readReg(LOR_RegPllHop);
- reg &= ~PLLHOP_FastHopOn;
- reg |= PLLHOP_FastHopOn;
- writeReg(LOR_RegPllHop, reg);
-
- writeReg(LOR_RegHopPeriod, m_settings.loraSettings.HopPeriod);
- }
- else
- {
- reg = readReg(LOR_RegPllHop);
- reg &= ~PLLHOP_FastHopOn;
- writeReg(LOR_RegPllHop, reg);
- }
-
- reg = readReg(LOR_RegModemConfig1);
- reg &= ~((_MODEMCONFIG1_CodingRate_MASK <<
- _MODEMCONFIG1_CodingRate_SHIFT) |
- (_MODEMCONFIG1_Bw_MASK << _MODEMCONFIG1_Bw_SHIFT) |
- MODEMCONFIG1_ImplicitHeaderModeOn);
-
- if (fixLen)
- reg |= MODEMCONFIG1_ImplicitHeaderModeOn;
-
- reg |= ((bandwidth & _MODEMCONFIG1_Bw_MASK) << _MODEMCONFIG1_Bw_SHIFT);
- reg |= ((coderate & _MODEMCONFIG1_CodingRate_MASK) <<
- _MODEMCONFIG1_CodingRate_SHIFT);
-
- writeReg(LOR_RegModemConfig1, reg);
-
- reg = readReg(LOR_RegModemConfig2);
- reg &= ~((_MODEMCONFIG2_SpreadingFactor_MASK <<
- _MODEMCONFIG2_SpreadingFactor_SHIFT) |
- MODEMCONFIG2_RxPayloadCrcOn);
-
- if (crcOn)
- reg |= MODEMCONFIG2_RxPayloadCrcOn;
-
- reg |= ((datarate & _MODEMCONFIG2_SpreadingFactor_MASK) <<
- _MODEMCONFIG2_SpreadingFactor_SHIFT);
- writeReg(LOR_RegModemConfig2, reg);
-
- reg = readReg(LOR_RegModemConfig3);
-
- reg &= ~MODEMCONFIG3_LowDataRateOptimize;
-
- if (m_settings.loraSettings.LowDatarateOptimize)
- reg |= MODEMCONFIG3_LowDataRateOptimize;
-
- writeReg(LOR_RegModemConfig3, reg);
-
- writeReg(LOR_RegPreambleMsb, (uint8_t)((preambleLen >> 8) & 0xff));
- writeReg(LOR_RegPreambleLsb, (uint8_t)(preambleLen & 0xff));
-
- // datarate is SPREADINGFACTOR_*
- if (datarate == 6)
- {
- reg = readReg(LOR_RegDetectOptimize);
- reg &= ~(_DETECTOPTIMIZE_DetectionOptimize_MASK <<
- _DETECTOPTIMIZE_DetectionOptimize_SHIFT);
-
- reg |= (DETECTIONOPTIMIZE_SF6 <<
- _DETECTOPTIMIZE_DetectionOptimize_SHIFT);
-
- writeReg(LOR_RegDetectOptimize, reg);
-
- // see page 27 in the datasheet
- writeReg(LOR_RegDetectionThreshold, LOR_DetectionThreshold_SF6);
-
- }
- else
- {
- reg = readReg(LOR_RegDetectOptimize);
- reg &= ~(_DETECTOPTIMIZE_DetectionOptimize_MASK <<
- _DETECTOPTIMIZE_DetectionOptimize_SHIFT);
-
- reg |= (DETECTIONOPTIMIZE_SF7_SF12 <<
- _DETECTOPTIMIZE_DetectionOptimize_SHIFT);
-
- writeReg(LOR_RegDetectOptimize, reg);
-
- // see page 27 in the datasheet
- writeReg(LOR_RegDetectionThreshold,
- LOR_DetectionThreshold_SF7_SF12);
- }
- }
-
- break;
- }
-}
-
-SX1276::RADIO_EVENT_T SX1276::setTx(int timeout)
-{
- uint8_t reg = 0;
-
- switch (m_settings.modem)
- {
- case MODEM_FSK:
- {
- // DIO0=PacketSent
- // DIO1=FifoLevel
- // DIO2=FifoFull
- // DIO3=FifoEmpty
- // DIO4=LowBat
- // DIO5=ModeReady
-
- reg = readReg(COM_RegDioMapping1);
- reg &= ~( (DOIMAPPING1_Dio0Mapping_MASK <<
- DOIMAPPING1_Dio0Mapping_SHIFT) |
- (DOIMAPPING1_Dio2Mapping_MASK <<
- DOIMAPPING1_Dio2Mapping_SHIFT) );
-
- writeReg(COM_RegDioMapping1, reg);
-
-
- reg = readReg(COM_RegDioMapping2);
- reg &= ~( (DOIMAPPING2_Dio4Mapping_MASK <<
- DOIMAPPING2_Dio4Mapping_SHIFT) |
- (DOIMAPPING2_Dio5Mapping_MASK <<
- DOIMAPPING2_Dio5Mapping_SHIFT) );
-
- writeReg(COM_RegDioMapping2, reg);
-
- m_settings.fskPacketHandler.FifoThresh =
- (readReg(FSK_RegFifoThresh) &
- (_FIFOTHRESH_FifoThreshold_MASK << _FIFOTHRESH_FifoThreshold_SHIFT));
- }
-
- break;
-
- case MODEM_LORA:
- {
- if (m_settings.loraSettings.FreqHopOn == true )
- {
- // mask out all except TxDone and FhssChangeChannel
- writeReg(LOR_RegIrqFlagsMask,
- LOR_IRQFLAG_RxTimeout |
- LOR_IRQFLAG_RxDone |
- LOR_IRQFLAG_PayloadCrcError |
- LOR_IRQFLAG_ValidHeader |
- // LOR_IRQFLAG_TxDone |
- LOR_IRQFLAG_CadDone |
- // LOR_IRQFLAG_FhssChangeChannel |
- LOR_IRQFLAG_CadDetected);
-
- // DIO0=TxDone, DIO2=FhssChangeChannel
- reg = readReg(COM_RegDioMapping1);
- reg &= ~( (DOIMAPPING1_Dio0Mapping_MASK <<
- DOIMAPPING1_Dio0Mapping_SHIFT) |
- (DOIMAPPING1_Dio2Mapping_MASK <<
- DOIMAPPING1_Dio2Mapping_SHIFT) );
- reg |= ( (DIOMAPPING_01 << DOIMAPPING1_Dio0Mapping_SHIFT) |
- (DIOMAPPING_00 << DOIMAPPING1_Dio2Mapping_SHIFT) );
- writeReg(COM_RegDioMapping1, reg);
- }
- else
- {
- // mask out all except TxDone
- writeReg(LOR_RegIrqFlagsMask,
- LOR_IRQFLAG_RxTimeout |
- LOR_IRQFLAG_RxDone |
- LOR_IRQFLAG_PayloadCrcError |
- LOR_IRQFLAG_ValidHeader |
- // LOR_IRQFLAG_TxDone |
- LOR_IRQFLAG_CadDone |
- LOR_IRQFLAG_FhssChangeChannel |
- LOR_IRQFLAG_CadDetected);
-
- // DIO0=TxDone
- reg = readReg(COM_RegDioMapping1);
- reg &= ~( (DOIMAPPING1_Dio0Mapping_MASK <<
- DOIMAPPING1_Dio0Mapping_SHIFT) );
- reg |= (DIOMAPPING_01 << DOIMAPPING1_Dio0Mapping_SHIFT);
- writeReg(COM_RegDioMapping1, reg);
- }
- }
- break;
- }
-
- m_settings.state = STATE_TX_RUNNING;
- m_radioEvent = REVENT_EXEC;
-
- setOpMode(MODE_TxMode);
-
- initClock();
- while ((getMillis() < timeout) && m_radioEvent == REVENT_EXEC)
- usleep(100);
-
- if (m_radioEvent == REVENT_EXEC)
- {
- // timeout
- m_radioEvent = REVENT_TIMEOUT;
- }
-
- return m_radioEvent;
-}
-
-SX1276::RADIO_EVENT_T SX1276::setRx(uint32_t timeout)
-{
- bool rxContinuous = false;
- uint8_t reg = 0;
-
- switch (m_settings.modem)
- {
- case MODEM_FSK:
- {
- rxContinuous = m_settings.fskSettings.RxContinuous;
-
- // DIO0=PayloadReady
- // DIO1=FifoLevel
- // DIO2=SyncAddr
- // DIO3=FifoEmpty
- // DIO4=Preamble
- // DIO5=ModeReady
- reg = readReg(COM_RegDioMapping1);
- reg &= ~( (DOIMAPPING1_Dio0Mapping_MASK <<
- DOIMAPPING1_Dio0Mapping_SHIFT) |
- (DOIMAPPING1_Dio2Mapping_MASK <<
- DOIMAPPING1_Dio2Mapping_SHIFT) );
- reg |= ( (DIOMAPPING_00 << DOIMAPPING1_Dio0Mapping_SHIFT) |
- (DIOMAPPING_11 << DOIMAPPING1_Dio2Mapping_SHIFT) );
- writeReg(COM_RegDioMapping1, reg);
-
-
- reg = readReg(COM_RegDioMapping2);
- reg &= ~( (DOIMAPPING2_Dio4Mapping_MASK <<
- DOIMAPPING2_Dio4Mapping_SHIFT) |
- (DOIMAPPING2_Dio5Mapping_MASK <<
- DOIMAPPING2_Dio5Mapping_SHIFT) );
- reg |= (DIOMAPPING_11 << DOIMAPPING2_Dio4Mapping_SHIFT) |
- DOIMAPPING2_MapPreambleDetect;
-
- writeReg(COM_RegDioMapping2, reg);
-
- m_settings.fskPacketHandler.FifoThresh =
- (readReg(FSK_RegFifoThresh) & _FIFOTHRESH_FifoThreshold_MASK);
-
- m_settings.fskPacketHandler.PreambleDetected = false;
- m_settings.fskPacketHandler.SyncWordDetected = false;
- m_settings.fskPacketHandler.NbBytes = 0;
- m_settings.fskPacketHandler.Size = 0;
- }
-
- break;
-
- case MODEM_LORA:
- {
- // The datasheet does not mention anything other than an
- // InvertIQ bit (0x40) in RegInvertIQ register (0x33). Here,
- // we seem to have two bits in RegInvertIQ (existing one for
- // RX), and a 'new' one for TXOff (0x01). In addition,
- // INVERTIQ2 (0x3b) does not exist in the datasheet, it is
- // marked as reserved. We will assume that the datasheet is
- // out of date.
-
- if (m_settings.loraSettings.IqInverted == true)
- {
- reg = readReg(LOR_RegInvertIQ);
- reg &= ~(INVERTIQ_InvertIQTxOff | INVERTIQ_InvertIQRx);
- reg |= INVERTIQ_InvertIQRx;
- writeReg(LOR_RegInvertIQ, reg);
-
- // warning, hardcoded undocumented magic number into
- // undocumented register
- writeReg(LOR_RegInvertIQ2, 0x19);
- }
- else
- {
- reg = readReg(LOR_RegInvertIQ);
- reg &= ~(INVERTIQ_InvertIQTxOff | INVERTIQ_InvertIQRx);
- reg |= INVERTIQ_InvertIQTxOff; // 'active' off.
- writeReg(LOR_RegInvertIQ, reg);
-
- // warning, hardcoded undocumented magic number into
- // undocumented register
- writeReg(LOR_RegInvertIQ2, 0x1d);
- }
-
- // ERRATA 2.3 - Receiver Spurious Reception of a LoRa Signal
- if (m_settings.loraSettings.Bandwidth < 9)
- {
- reg = readReg(LOR_RegDetectOptimize);
- reg &= 0x7f; // clear undocumented bit 7
- writeReg(LOR_RegDetectOptimize, reg);
-
- // warning, writing magic numbers into undocumented
- // registers
- switch (m_settings.loraSettings.Bandwidth)
- {
- case 0: // 7.8 kHz
- writeReg(LOR_Reserved2f, 0x48);
- setChannel(m_settings.channel + 7.81e3);
- break;
- case 1: // 10.4 kHz
- writeReg(LOR_Reserved2f, 0x44);
- setChannel(m_settings.channel + 10.42e3);
- break;
- case 2: // 15.6 kHz
- writeReg(LOR_Reserved2f, 0x44);
- setChannel(m_settings.channel + 15.62e3);
- break;
- case 3: // 20.8 kHz
- writeReg(LOR_Reserved2f, 0x44);
- setChannel(m_settings.channel + 20.83e3);
- break;
- case 4: // 31.2 kHz
- writeReg(LOR_Reserved2f, 0x44);
- setChannel(m_settings.channel + 31.25e3);
- break;
- case 5: // 41.4 kHz
- writeReg(LOR_Reserved2f, 0x44);
- setChannel(m_settings.channel + 41.67e3);
- break;
- case 6: // 62.5 kHz
- writeReg(LOR_Reserved2f, 0x40);
- break;
- case 7: // 125 kHz
- writeReg(LOR_Reserved2f, 0x40);
- break;
- case 8: // 250 kHz
- writeReg(LOR_Reserved2f, 0x40);
- break;
- }
- }
- else
- {
- reg = readReg(LOR_RegDetectOptimize);
- reg |= 0x80; // set undocumented bit 7
- writeReg(LOR_RegDetectOptimize, reg);
- }
-
- rxContinuous = m_settings.loraSettings.RxContinuous;
-
- if (m_settings.loraSettings.FreqHopOn == true)
- {
- // mask out all except RxDone, RxTimeout, PayloadCrCError,
- // and FhssChangeChannel
- writeReg(LOR_RegIrqFlagsMask,
- // LOR_IRQFLAG_RxTimeout |
- // LOR_IRQFLAG_RxDone |
- // LOR_IRQFLAG_PayloadCrcError |
- LOR_IRQFLAG_ValidHeader |
- LOR_IRQFLAG_TxDone |
- LOR_IRQFLAG_CadDone |
- // LOR_IRQFLAG_FhssChangeChannel |
- LOR_IRQFLAG_CadDetected);
-
- // DIO0=RxDone, DIO2=FhssChangeChannel
- reg = readReg(COM_RegDioMapping1);
- reg &= ~( (DOIMAPPING1_Dio0Mapping_MASK <<
- DOIMAPPING1_Dio0Mapping_SHIFT) |
- (DOIMAPPING1_Dio2Mapping_MASK <<
- DOIMAPPING1_Dio2Mapping_SHIFT) );
- reg |= ( (DIOMAPPING_00 << DOIMAPPING1_Dio0Mapping_SHIFT) |
- (DIOMAPPING_00 << DOIMAPPING1_Dio2Mapping_SHIFT) );
- writeReg(COM_RegDioMapping1, reg);
- }
- else
- {
- // mask out all except RxDone, RxTimeout, and PayloadCrCError
- writeReg(LOR_RegIrqFlagsMask,
- // LOR_IRQFLAG_RxTimeout |
- // LOR_IRQFLAG_RxDone |
- // LOR_IRQFLAG_PayloadCrcError |
- LOR_IRQFLAG_ValidHeader |
- LOR_IRQFLAG_TxDone |
- LOR_IRQFLAG_CadDone |
- LOR_IRQFLAG_FhssChangeChannel |
- LOR_IRQFLAG_CadDetected);
-
- // DIO0=RxDone
- reg = readReg(COM_RegDioMapping1);
- reg &= ~(DOIMAPPING1_Dio0Mapping_MASK <<
- DOIMAPPING1_Dio0Mapping_SHIFT);
- reg |= (DIOMAPPING_00 << DOIMAPPING1_Dio0Mapping_SHIFT);
- writeReg(COM_RegDioMapping1, reg);
- }
-
- writeReg(LOR_RegFifoRxBaseAddr, 0);
- writeReg(LOR_RegFifoAddrPtr, 0);
- }
-
- break;
-
- }
-
- memset(m_rxBuffer, 0, FIFO_SIZE);
-
- m_settings.state = STATE_RX_RUNNING;
- m_radioEvent = REVENT_EXEC;
-
- if (m_settings.modem == MODEM_FSK)
- {
- setOpMode(MODE_FSK_RxMode);
-
- if (rxContinuous == false)
- {
- // timer..?
-#if 0
- TimerSetValue( &RxTimeoutSyncWord, ( 8.0 * ( m_settings.fsk.PreambleLen +
- ( ( SX1276Read( REG_SYNCCONFIG ) &
- ~RF_SYNCCONFIG_SYNCSIZE_MASK ) +
- 1.0 ) + 10.0 ) /
- ( double )m_settings.fsk.Datarate ) * 1e6 );
- TimerStart( &RxTimeoutSyncWord );
-#endif
- }
- }
- else
- {
- // LoRa
-
- if (rxContinuous == true)
- {
- setOpMode(MODE_LOR_RxContinuous);
- }
- else
- {
- setOpMode(MODE_LOR_RxSingle);
- }
- }
-
- initClock();
- while ((getMillis() < timeout) && m_radioEvent == REVENT_EXEC)
- usleep(100);
-
- if (m_radioEvent == REVENT_EXEC)
- {
- // timeout
- m_radioEvent = REVENT_TIMEOUT;
- }
-
- return m_radioEvent;
-}
-
-
-void SX1276::startCAD()
-{
- switch (m_settings.modem)
- {
- case MODEM_LORA:
- {
- // mask out all except CadDone and CadDetected
- writeReg(LOR_RegIrqFlagsMask,
- LOR_IRQFLAG_RxTimeout |
- LOR_IRQFLAG_RxDone |
- LOR_IRQFLAG_PayloadCrcError |
- LOR_IRQFLAG_ValidHeader |
- LOR_IRQFLAG_TxDone |
- // LOR_IRQFLAG_CadDone |
- LOR_IRQFLAG_FhssChangeChannel //|
- // LOR_IRQFLAG_CadDetected
- );
-
- // DIO3=CADDone
-
- uint8_t reg;
- reg = readReg(COM_RegDioMapping1);
- reg &= ~(DOIMAPPING1_Dio3Mapping_MASK <<
- DOIMAPPING1_Dio3Mapping_SHIFT);
- reg |= (DIOMAPPING_00 << DOIMAPPING1_Dio3Mapping_SHIFT);
- writeReg(COM_RegDioMapping1, reg);
-
- m_settings.state = STATE_CAD;
- setOpMode(MODE_LOR_CAD);
- }
-
- break;
-
- case MODEM_FSK:
- default:
- break;
- }
-}
-
-void SX1276::setMaxPayloadLength(RADIO_MODEM_T modem, uint8_t max)
-{
- setModem(modem);
-
- switch (modem)
- {
- case MODEM_FSK:
- if (m_settings.fskSettings.FixLen == false)
- {
- writeReg(FSK_RegPayloadLength, max);
- }
-
- break;
-
- case MODEM_LORA:
- writeReg(LOR_RegMaxPayloadLength, max);
-
- break;
- }
-}
-
-
-void SX1276::onDio0Irq(void *ctx)
-{
- upm::SX1276 *This = (upm::SX1276 *)ctx;
-
- This->lockIntrs();
-
- volatile uint8_t irqFlags = 0;
-
- // cerr << __FUNCTION__ << ": Enter" << endl;
-
- switch (This->m_settings.state)
- {
- case STATE_RX_RUNNING:
-
- // RxDone interrupt
- switch (This->m_settings.modem)
- {
- case MODEM_FSK:
-
- if (This->m_settings.fskSettings.CrcOn == true )
- {
- irqFlags = This->readReg(FSK_RegIrqFlags2);
-
- if (!(irqFlags & IRQFLAGS2_CrcOk))
- {
- // Clear Irqs
- This->writeReg(FSK_RegIrqFlags1,
- IRQFLAGS1_Rssi |
- IRQFLAGS1_PreambleDetect |
- IRQFLAGS1_SyncAddressMatch);
- This->writeReg(FSK_RegIrqFlags2, IRQFLAGS2_FifoOverrun);
-
- if (This->m_settings.fskSettings.RxContinuous == false )
- {
- This->m_settings.state = STATE_IDLE;
- }
- else
- {
- // Continuous mode restart Rx chain
- This->writeReg(FSK_RegRxConfig,
- This->readReg(FSK_RegRxConfig) |
- RXCONFIG_RestartRxWithoutPllLock);
- }
-
- // RxError radio event
- // cerr << __FUNCTION__ << ": RxError crc/sync timeout" << endl;
- This->m_radioEvent = REVENT_ERROR;
-
- This->m_settings.fskPacketHandler.PreambleDetected = false;
- This->m_settings.fskPacketHandler.SyncWordDetected = false;
- This->m_settings.fskPacketHandler.NbBytes = 0;
- This->m_settings.fskPacketHandler.Size = 0;
- break;
- }
- }
-
- // Read received packet size
- if ( (This->m_settings.fskPacketHandler.Size == 0) &&
- (This->m_settings.fskPacketHandler.NbBytes == 0) )
- {
- if (This->m_settings.fskSettings.FixLen == false )
- {
- This->readFifo((uint8_t*)&(This->m_settings.fskPacketHandler.Size),
- 1);
- }
- else
- {
- This->m_settings.fskPacketHandler.Size =
- This->readReg(FSK_RegPayloadLength);
- }
-
- This->readFifo(This->m_rxBuffer +
- This->m_settings.fskPacketHandler.NbBytes,
- This->m_settings.fskPacketHandler.Size -
- This->m_settings.fskPacketHandler.NbBytes);
-
- This->m_settings.fskPacketHandler.NbBytes +=
- (This->m_settings.fskPacketHandler.Size -
- This->m_settings.fskPacketHandler.NbBytes);
- }
- else
- {
- This->readFifo(This->m_rxBuffer +
- This->m_settings.fskPacketHandler.NbBytes,
- (This->m_settings.fskPacketHandler.Size -
- This->m_settings.fskPacketHandler.NbBytes));
-
- This->m_settings.fskPacketHandler.NbBytes +=
- (This->m_settings.fskPacketHandler.Size -
- This->m_settings.fskPacketHandler.NbBytes);
- }
-
- if (This->m_settings.fskSettings.RxContinuous == false)
- {
- This->m_settings.state = STATE_IDLE;
- }
- else
- {
- // Continuous mode restart Rx chain
- This->writeReg(FSK_RegRxConfig,
- This->readReg(FSK_RegRxConfig) |
- RXCONFIG_RestartRxWithoutPllLock);
- }
-
- // RxDone radio event
- This->m_rxRSSI = This->m_settings.fskPacketHandler.RssiValue;
- This->m_rxLen = This->m_settings.fskPacketHandler.Size;
- This->m_radioEvent = REVENT_DONE;
- // cerr << __FUNCTION__ << ": FSK RxDone" << endl;
- // fprintf(stderr, "### %s: RX(%d): %s\n",
- // __FUNCTION__,
- // This->m_settings.fskPacketHandler.Size,
- // This->m_rxBuffer);
-
- This->m_settings.fskPacketHandler.PreambleDetected = false;
- This->m_settings.fskPacketHandler.SyncWordDetected = false;
- This->m_settings.fskPacketHandler.NbBytes = 0;
- This->m_settings.fskPacketHandler.Size = 0;
-
- break;
-
- case MODEM_LORA:
- {
- int8_t snr = 0;
-
- // Clear Irq
- This->writeReg(LOR_RegIrqFlags, LOR_IRQFLAG_RxDone);
-
- irqFlags = This->readReg(LOR_RegIrqFlags);
-
- // cerr << "LORA PayloadCRC on = "
- // << hex << (int)This->readReg(LOR_RegHopChannel) << dec << endl;
- if (irqFlags & LOR_IRQFLAG_PayloadCrcError)
- {
- // Clear Irq
- This->writeReg(LOR_RegIrqFlags, LOR_IRQFLAG_PayloadCrcError);
- if (This->m_settings.loraSettings.RxContinuous == false)
- {
- This->m_settings.state = STATE_IDLE;
- }
- // RxError radio event
- // cerr << __FUNCTION__ << ": RxError (payload crc error)" << endl;
- This->m_radioEvent = REVENT_ERROR;
-
- break;
- }
-
- This->m_settings.loraPacketHandler.SnrValue =
- This->readReg(LOR_RegPktSnrValue);
-
- if (This->m_settings.loraPacketHandler.SnrValue & 0x80)
- {
- // The SNR sign bit is 1
- // Invert and divide by 4
- snr = ( (~(This->m_settings.loraPacketHandler.SnrValue) + 1 ) &
- 0xff) >> 2;
- snr = -snr;
- }
- else
- {
- // Divide by 4
- snr = (This->m_settings.loraPacketHandler.SnrValue & 0xff) >> 2;
- }
-
- int16_t rssi = This->readReg(LOR_RegPktRssiValue);
-
- if (snr < 0)
- {
- if (This->m_settings.channel > RF_MID_BAND_THRESH)
- {
- This->m_settings.loraPacketHandler.RssiValue =
- LOR_RSSI_OFFSET_HF + rssi + ( rssi >> 4 ) + snr;
- }
- else
- {
- This->m_settings.loraPacketHandler.RssiValue =
- LOR_RSSI_OFFSET_LF + rssi + ( rssi >> 4 ) + snr;
- }
- }
- else
- {
- if (This->m_settings.channel > RF_MID_BAND_THRESH)
- {
- This->m_settings.loraPacketHandler.RssiValue =
- LOR_RSSI_OFFSET_HF + rssi + (rssi >> 4);
- }
- else
- {
- This->m_settings.loraPacketHandler.RssiValue =
- LOR_RSSI_OFFSET_LF + rssi + (rssi >> 4);
- }
- }
-
- This->m_settings.loraPacketHandler.Size =
- This->readReg(LOR_RegRxNbBytes);
-
- // cerr << "LORA HANDLER SIZE = "
- // << (int)This->m_settings.loraPacketHandler.Size << endl;
-
- // cerr << "LORA MAXPAYLOAD = "
- // << (int)This->readReg(LOR_RegMaxPayloadLength) << endl;
-
- This->readFifo(This->m_rxBuffer,
- This->m_settings.loraPacketHandler.Size);
-
- if (This->m_settings.loraSettings.RxContinuous == false)
- {
- This->m_settings.state = STATE_IDLE;
- }
-
- // RxDone radio event
-
- // The returned size (from LOR_RegRxNbBytes) is always 64
- // bytes regardless of the packet size I sent. Something
- // is wrong here.
- // cerr << __FUNCTION__ << ": RxDone (LORA)" << endl;
- This->m_rxRSSI = (int)rssi;
- This->m_rxSNR = (int)snr;
- This->m_rxLen = This->m_settings.loraPacketHandler.Size;
- This->m_radioEvent = REVENT_DONE;
- // if (This->m_settings.state == STATE_RX_RUNNING)
- // fprintf(stderr, "### %s: snr = %d rssi = %d RX(%d): %s\n",
- // __FUNCTION__,
- // (int)snr, (int)rssi,
- // This->m_settings.loraPacketHandler.Size,
- // This->m_rxBuffer);
- // else
- // fprintf(stderr, "### %s: snr = %d rssi = %d RX: INV BUFFER (crc)\n", __FUNCTION__,
- // (int)snr, (int)rssi);
-
- }
-
- break;
-
- default:
- break;
-
- }
-
- break;
-
- case STATE_TX_RUNNING:
-
- // TxDone interrupt
- switch (This->m_settings.modem)
- {
- case MODEM_LORA:
- // Clear Irq
- This->writeReg(LOR_RegIrqFlags, LOR_IRQFLAG_TxDone);
- // fprintf(stderr, "%s: LORA IrqFlags = %02x\n", __FUNCTION__,
- // This->readReg(LOR_RegIrqFlags));
- // Intentional fall through
-
- case MODEM_FSK:
- default:
- This->m_settings.state = STATE_IDLE;
-
- // TxDone radio event
- This->m_radioEvent = REVENT_DONE;
- // cerr << __FUNCTION__ << ": TxDone" << endl;
-
- break;
- }
- break;
-
- default:
- break;
- }
-
- This->unlockIntrs();
-}
-
-
-void SX1276::onDio1Irq(void *ctx)
-{
- upm::SX1276 *This = (upm::SX1276 *)ctx;
-
- This->lockIntrs();
- // cerr << __FUNCTION__ << ": Enter" << endl;
-
- switch (This->m_settings.state)
- {
- case STATE_RX_RUNNING:
-
- switch (This->m_settings.modem)
- {
- case MODEM_FSK:
- // FifoLevel interrupt
- // Read received packet size
- if ( (This->m_settings.fskPacketHandler.Size == 0 ) &&
- (This->m_settings.fskPacketHandler.NbBytes == 0) )
- {
- if (This->m_settings.fskSettings.FixLen == false)
- {
- This->readFifo((uint8_t*)&(This->m_settings.fskPacketHandler.Size),
- 1);
- }
- else
- {
- This->m_settings.fskPacketHandler.Size =
- This->readReg(FSK_RegPayloadLength);
- }
- }
-
- if ( (This->m_settings.fskPacketHandler.Size -
- This->m_settings.fskPacketHandler.NbBytes) >
- This->m_settings.fskPacketHandler.FifoThresh)
- {
- This->readFifo((This->m_rxBuffer +
- This->m_settings.fskPacketHandler.NbBytes),
- This->m_settings.fskPacketHandler.FifoThresh);
- This->m_settings.fskPacketHandler.NbBytes +=
- This->m_settings.fskPacketHandler.FifoThresh;
- }
- else
- {
- This->readFifo((This->m_rxBuffer +
- This->m_settings.fskPacketHandler.NbBytes),
- This->m_settings.fskPacketHandler.Size -
- This->m_settings.fskPacketHandler.NbBytes);
- This->m_settings.fskPacketHandler.NbBytes +=
- (This->m_settings.fskPacketHandler.Size -
- This->m_settings.fskPacketHandler.NbBytes);
- }
-
- break;
-
- case MODEM_LORA:
- // Sync time out
- This->m_settings.state = STATE_IDLE;
- // RxError (LORA timeout) radio events
- // cerr << __FUNCTION__ << ": RxTimeout (LORA)" << endl;
- This->m_radioEvent = REVENT_TIMEOUT;
-
- break;
-
- default:
- break;
- }
-
- break;
-
- case STATE_TX_RUNNING:
-
- switch (This->m_settings.modem )
- {
- case MODEM_FSK:
- // FifoLevel interrupt
- if ( (This->m_settings.fskPacketHandler.Size -
- This->m_settings.fskPacketHandler.NbBytes) >
- This->m_settings.fskPacketHandler.ChunkSize)
- {
- This->writeFifo((This->m_rxBuffer +
- This->m_settings.fskPacketHandler.NbBytes),
- This->m_settings.fskPacketHandler.ChunkSize);
- This->m_settings.fskPacketHandler.NbBytes +=
- This->m_settings.fskPacketHandler.ChunkSize;
- }
- else
- {
- // Write the last chunk of data
- This->writeFifo((This->m_rxBuffer +
- This->m_settings.fskPacketHandler.NbBytes),
- This->m_settings.fskPacketHandler.Size -
- This->m_settings.fskPacketHandler.NbBytes);
- This->m_settings.fskPacketHandler.NbBytes +=
- (This->m_settings.fskPacketHandler.Size -
- This->m_settings.fskPacketHandler.NbBytes);
- }
- break;
-
- case MODEM_LORA:
- break;
-
- default:
- break;
- }
- break;
-
- default:
- break;
- }
-
- This->unlockIntrs();
-}
-
-void SX1276::onDio2Irq(void *ctx)
-{
- upm::SX1276 *This = (upm::SX1276 *)ctx;
-
- This->lockIntrs();
- // cerr << __FUNCTION__ << ": Enter" << endl;
-
- switch (This->m_settings.state)
- {
- case STATE_RX_RUNNING:
-
- switch (This->m_settings.modem)
- {
- case MODEM_FSK:
- if ( (This->m_settings.fskPacketHandler.PreambleDetected == true ) &&
- (This->m_settings.fskPacketHandler.SyncWordDetected == false) )
- {
- This->m_settings.fskPacketHandler.SyncWordDetected = true;
-
- This->m_settings.fskPacketHandler.RssiValue =
- -(This->readReg(FSK_RegRssiValue) >> 1 );
-
- This->m_settings.fskPacketHandler.AfcValue =
- (int32_t)(double)( ((uint16_t)This->readReg(FSK_RegAfcMsb) << 8 ) |
- (uint16_t)This->readReg(FSK_RegAfcLsb) ) *
- FXOSC_STEP;
- This->m_settings.fskPacketHandler.RxGain =
- (This->readReg(COM_RegLna) >> 5) & 0x07;
- }
-
- break;
-
- case MODEM_LORA:
- if (This->m_settings.loraSettings.FreqHopOn == true)
- {
- // Clear Irq
- This->writeReg(LOR_RegIrqFlags, LOR_IRQFLAG_FhssChangeChannel);
-
- // Fhss radio event (unsupported currently)
- // FhssChangeChannel( (readReg( LOR_RegHopChannel) &
- // ~_HOPCHANNEL_FhssPresentChannel_MASK) );
- //cerr << __FUNCTION__ << ": Fhss Change Channel (LORA, RX running)" << endl;
- }
- break;
-
- default:
- break;
- }
- break;
-
- case STATE_TX_RUNNING:
- switch (This->m_settings.modem)
- {
- case MODEM_FSK:
- break;
- case MODEM_LORA:
- if (This->m_settings.loraSettings.FreqHopOn == true)
- {
- // Clear Irq
- This->writeReg(LOR_RegIrqFlags, LOR_IRQFLAG_FhssChangeChannel);
-
- // Fhss radio event (unsupported currently)
- // FhssChangeChannel( (readReg( LOR_RegHopChannel) &
- // ~_HOPCHANNEL_FhssPresentChannel_MASK) );
- //cerr << __FUNCTION__ << ": Fhss Change Channel (LORA, TX running)" << endl;
- }
- break;
-
- default:
- break;
- }
- break;
-
- default:
- break;
- }
-
- This->unlockIntrs();
-}
-
-void SX1276::onDio3Irq(void *ctx)
-{
- upm::SX1276 *This = (upm::SX1276 *)ctx;
-
- This->lockIntrs();
- // cerr << __FUNCTION__ << ": Enter" << endl;
- switch (This->m_settings.modem)
- {
- case MODEM_FSK:
- break;
-
- case MODEM_LORA:
- if (This->readReg(LOR_RegIrqFlags) & LOR_IRQFLAG_CadDetected)
- {
- // Clear Irq
- This->writeReg(LOR_RegIrqFlags,
- (LOR_IRQFLAG_CadDetected | LOR_IRQFLAG_CadDone));
-
- // CADDetected radio event (true)
- // cerr << __FUNCTION__ << ": CadDetected (LORA)" << endl;
-
- }
- else
- {
- // Clear Irq
- This->writeReg(LOR_RegIrqFlags, LOR_IRQFLAG_CadDone);
- // CADDetected radio event (false)
- //cerr << __FUNCTION__ << ": CadDone (LORA)" << endl;
- }
-
- break;
-
- default:
- break;
- }
-
- This->unlockIntrs();
-}
-
-void SX1276::onDio4Irq(void *ctx)
-{
- upm::SX1276 *This = (upm::SX1276 *)ctx;
-
- This->lockIntrs();
- // cerr << __FUNCTION__ << ": Enter" << endl;
- switch (This->m_settings.modem)
- {
- case MODEM_FSK:
- {
- if (This->m_settings.fskPacketHandler.PreambleDetected == false)
- {
- This->m_settings.fskPacketHandler.PreambleDetected = true;
- }
- }
-
- break;
-
- case MODEM_LORA:
- break;
-
- default:
- break;
- }
-
- This->unlockIntrs();
-}
-
-void SX1276::onDio5Irq(void *ctx)
-{
- upm::SX1276 *This = (upm::SX1276 *)ctx;
-
- This->lockIntrs();
- // cerr << __FUNCTION__ << ": Enter" << endl;
- switch (This->m_settings.modem)
- {
- case MODEM_FSK:
- break;
- case MODEM_LORA:
- // fprintf(stderr, "%s: LORA IrqFlags = %02x\n", __FUNCTION__,
- // This->readReg(LOR_RegIrqFlags));
- break;
- default:
- break;
- }
-
- This->unlockIntrs();
-}
-
-void SX1276::initClock()
-{
- gettimeofday(&m_startTime, NULL);
-}
-
-uint32_t SX1276::getMillis()
-{
- struct timeval elapsed, now;
- uint32_t elapse;
-
- // get current time
- gettimeofday(&now, NULL);
-
- // compute the delta since m_startTime
- if( (elapsed.tv_usec = now.tv_usec - m_startTime.tv_usec) < 0 )
- {
- elapsed.tv_usec += 1000000;
- elapsed.tv_sec = now.tv_sec - m_startTime.tv_sec - 1;
- }
- else
- {
- elapsed.tv_sec = now.tv_sec - m_startTime.tv_sec;
- }
-
- elapse = (uint32_t)((elapsed.tv_sec * 1000) + (elapsed.tv_usec / 1000));
-
- // never return 0
- if (elapse == 0)
- elapse = 1;
-
- return elapse;
-}
-
-
diff --git a/peripheral/libupm/src/sx1276/sx1276.h b/peripheral/libupm/src/sx1276/sx1276.h
deleted file mode 100644
index e23a395..0000000
--- a/peripheral/libupm/src/sx1276/sx1276.h
+++ /dev/null
@@ -1,2036 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Thanks to Semtech for their example code at:
- * https://github.com/Lora-net/LoRaMac-node
- * released under a modified BSD license, for many clues as to how to
- * initialize and operate this radio properly.
- * See src/sx1276/LICENSE.txt
- *
- * 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 <string>
-
-#include <sys/time.h>
-#include <sys/select.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <pthread.h>
-
-#include <mraa/common.hpp>
-#include <mraa/spi.hpp>
-#include <mraa/gpio.hpp>
-
-// Our crystal oscillator frequency (32Mhz)
-#define FXOSC_FREQ 32000000.0
-
-// Our freq stepping resolution (in Hz) if FXOSC_FREQ is 32Mhz
-// (FXOSC_FREQ / 2^19) =
-#define FXOSC_STEP 61.03515625
-
-namespace upm {
-
- /**
- * @brief SX1276 LoRa/FSK modem
- * @defgroup sx1276 libupm-sx1276
- * @ingroup spi gpio wifi
- */
-
- /**
- * @library sx1276
- * @sensor sx1276
- * @comname SX1276 LoRa/FSK modem
- * @altname SX1277 SX1278 SX1279
- * @type wifi
- * @man semtech
- * @con spi gpio
- * @web http://www.digikey.com/product-search/en?vendor=0&keywords=SX1276MB1LAS
- *
- * @brief API for the SX1276 LoRa/FSK modem
- *
- * The SX1276 is a FSK/OOK/LoRa modem capable of both Low Frequency
- * and High Frequency communication.
- *
- * It requires a 3.3v power supply, do not use 5v.
- *
- * Frequency Hopping Spread Spectrum (FHSS) is not currently supported.
- *
- * While not all of the functionality of this device is supported
- * initially, methods and register definitions are provided that
- * should allow an end user to implement whatever features are
- * required.
- *
- * FSK send/receive example
- * @snippet sx1276-fsk.cxx Interesting
- * LORA send/receive example
- * @snippet sx1276-lora.cxx Interesting
- */
-
- class SX1276 {
- public:
-
- // The default chip revision
- static const uint8_t chipRevision = 0x12;
-
-
- // total FIFO size
- static const int FIFO_SIZE = 256;
-
- // differentiator between high and low bands
- static const int RF_MID_BAND_THRESH = 525000000;
-
- // LoRa RSSI offsets depending on LF or HF bands
- static const int LOR_RSSI_OFFSET_HF = -157;
- static const int LOR_RSSI_OFFSET_LF = -164;
-
- /**
- * What modem we are configured for
- */
- typedef enum {
- MODEM_LORA = 0,
- MODEM_FSK
- } RADIO_MODEM_T;
-
- /**
- * Events that can occurr during a TX or RX operation.
- *
- * When sending or receiving a packet (calling setTx()/send() or
- * setRx()), the state will be initialized to ESTATE_EXEC to
- * indicate the operation is in progress. Once an event has
- * occurred, this state will be updated accordingly.
- *
- * For receiving, if RX_DONE is set, then it is safe to retrieve
- * the rx buffer (via getRxBuffer()/getRxBufferStr()) as well as
- * query the RSSI and SNR. On RX_ERROR, these values will be the
- * same as they were last set during the last RX_DONE event.
- */
- typedef enum {
- REVENT_DONE = 0, // operation completed successfully
- REVENT_EXEC, // runninsg something
- REVENT_ERROR, // failed, crc error, sync timeout
- REVENT_TIMEOUT // timed out
- } RADIO_EVENT_T;
-
- /**
- * SX1276 registers
- *
- * NOTE: reserved registers must not be written into or read from.
- * Reserved bitfields must always be 0.
- *
- * This device has a set of "common" registers, as well as
- * registers that represent different things depending on whether
- * the device in in LoRa mode or FSK/OOK mode. So here, we will
- * prefix the register names with COM (common), LOR (LoRa mode),
- * and FSK (FSK/OOK mode) accordingly.
- */
- typedef enum {
- COM_RegFifo = 0x00, // FIFO r/w access
- COM_RegOpMode = 0x01, // LoRa/FSK
-
- FSK_RegBitrateMsb = 0x02,
- LOR_Reserved02 = 0x02, // reserved
-
- FSK_RegBitrateLsb = 0x03,
- LOR_Reserved03 = 0x03, // reserved
-
- FSK_RegFdevMsb = 0x04, // freq deviation
- LOR_Reserved04 = 0x04, // reserved
-
- FSK_RegFdevLsb = 0x05,
- LOR_Reserved05 = 0x05, // reserved
-
- COM_RegFrfMsb = 0x06, // carrier freq
- COM_RegFrfMid = 0x07,
- COM_RegFrfLsb = 0x08,
- COM_RegPaConfig = 0x09,
- COM_RegPaRamp = 0x0a,
-
- COM_RegOcp = 0x0b, // overcurrent protection
- COM_RegLna = 0x0c,
-
- FSK_RegRxConfig = 0x0d,
- LOR_RegFifoAddrPtr = 0x0d,
-
- FSK_RegRssiConfg = 0x0e,
- LOR_RegFifoTxBaseAddr = 0x0e,
-
- FSK_RegRssiCollision = 0x0f,
- LOR_RegFifoRxBaseAddr = 0x0f,
-
- FSK_RegRssiThresh = 0x10,
- LOR_RegFifoRxCurrentAddr = 0x10,
-
- FSK_RegRssiValue = 0x11,
- LOR_RegIrqFlagsMask = 0x11,
-
- FSK_RegRxBw = 0x12,
- LOR_RegIrqFlags = 0x12,
-
- FSK_RegAfcBw = 0x13, // automatic freq cntrl
- LOR_RegRxNbBytes = 0x13, // received pkt len
-
- FSK_RegOokPeak = 0x14,
- LOR_RegRxHeaderCntValueMsb = 0x14,
-
- FSK_RegOokFix = 0x15,
- LOR_RegRxHeaderCntValueLsb = 0x15,
-
- FSK_RegOokAvg = 0x16,
- LOR_RegRxPacketCntValueMsb = 0x16,
-
- FSK_Reserved17 = 0x17, // reserved
- LOR_RegRxPacketCntValueLsb = 0x17,
-
- FSK_Reserved18 = 0x18, // reserved
- LOR_RegModemStat = 0x18,
-
- FSK_Reserved19 = 0x19, // reserved
- LOR_RegPktSnrValue = 0x19,
-
- FSK_RegAfcFei = 0x1a,
- LOR_RegPktRssiValue = 0x1a,
-
- FSK_RegAfcMsb = 0x1b,
- LOR_RegRssiValue = 0x1b,
-
- FSK_RegAfcLsb = 0x1c,
- LOR_RegHopChannel = 0x1c, // fhss starting channel
-
- FSK_RegFeiMsb = 0x1d,
- LOR_RegModemConfig1 = 0x1d,
-
- FSK_RegFeiLsb = 0x1e,
- LOR_RegModemConfig2 = 0x1e,
-
- FSK_RegPreambleDetect = 0x1f,
- LOR_RegSymbTimeoutLsb = 0x1f,
-
- FSK_RegRxTimeout1 = 0x20,
- LOR_RegPreambleMsb = 0x20,
-
- FSK_RegRxTimeout2 = 0x21,
- LOR_RegPreambleLsb = 0x21,
-
- FSK_RegRxTimeout3 = 0x22,
- LOR_RegPayloadLength = 0x22,
-
- FSK_RegRxDelay = 0x23,
- LOR_RegMaxPayloadLength = 0x23,
-
- FSK_RegOsc = 0x24,
- LOR_RegHopPeriod = 0x24,
-
- FSK_RegPreambleMsb = 0x25,
- LOR_RegFifoRxByteAddr = 0x25,
-
- FSK_RegPreambleLsb = 0x26,
- LOR_RegModemConfig3 = 0x26,
-
- FSK_RegSyncConfig = 0x27,
- LOR_Reserved27 = 0x27, // reserved
-
- FSK_RegSyncValue1 = 0x28,
- LOR_RegFeiMsb = 0x28,
-
- FSK_RegSyncValue2 = 0x29,
- LOR_RegFeiMid = 0x29,
-
- FSK_RegSyncValue3 = 0x2a,
- LOR_RegFeiLsb = 0x2a,
-
- FSK_RegSyncValue4 = 0x2b,
- LOR_Reserved2b = 0x2b, // reserved
-
- FSK_RegSyncValue5 = 0x2c,
- LOR_RegRssiWideband = 0x2c,
-
- FSK_RegSyncValue6 = 0x2d,
- LOR_Reserved2d = 0x2d, // reserved
-
- FSK_RegSyncValue7 = 0x2e,
- LOR_Reserved2e = 0x2e, // reserved
-
- FSK_RegSyncValue8 = 0x2f,
- LOR_Reserved2f = 0x2f, // reserved
-
- FSK_RegPacketConfig1 = 0x30,
- LOR_Reserved30 = 0x30, // reserved
-
- FSK_RegPacketConfig2 = 0x31,
- LOR_RegDetectOptimize = 0x31,
-
- FSK_RegPayloadLength = 0x32,
- LOR_Reserved32 = 0x32, // reserved
-
- FSK_RegNodeAddr = 0x33,
- LOR_RegInvertIQ = 0x33,
-
- FSK_RegBroadcastAddr = 0x34,
- LOR_Reserved34 = 0x34, // reserved
-
- FSK_RegFifoThresh = 0x35,
- LOR_Reserved35 = 0x35, // reserved
-
- FSK_RegSeqConfig1 = 0x36,
- LOR_Reserved36 = 0x36, // reserved
-
- FSK_RegSeqConfig2 = 0x37,
- LOR_RegDetectionThreshold = 0x37,
-
- FSK_RegTimerResol = 0x38,
- LOR_Reserved38 = 0x38, // reserved
-
- FSK_RegTimer1Coeff = 0x39,
- LOR_RegSyncWord = 0x39,
-
- FSK_RegTimer2Coeff = 0x3a,
- LOR_Reserved3a = 0x3a, // reserved
-
- FSK_RegImageCal = 0x3b,
- LOR_Reserved3b = 0x3b, // reserved (in datasheet)?
- LOR_RegInvertIQ2 = 0x3b, // does not exist in datasheet
- // but used in Semtech code.
- // UNDOCUMENTED
-
- FSK_RegTemp = 0x3c,
- LOR_Reserved3c = 0x3c, // reserved
-
- FSK_RegLowBat = 0x3d,
- LOR_Reserved3d = 0x3d, // reserved
-
- FSK_RegIrqFlags1 = 0x3e,
- LOR_Reserved3e = 0x3e, // reserved
-
- FSK_RegIrqFlags2 = 0x3f,
- LOR_Reserved3f = 0x3f, // reserved
-
- COM_RegDioMapping1 = 0x40, // DIO0-DIO3
- COM_RegDioMapping2 = 0x41, // DIO4-DIO5, clk out freq
-
- COM_RegVersion = 0x42, // Semtech ID (silicon revision)
-
- // 0x43 reserved
-
- // The data sheet says this is FSK only, but the semtech code
- // implies this is only valid for LoRa. So for now, assume the
- // datasheet is wrong.
- //
- // FSK_RegPllHop = 0x44,
- // LOR_Reserved44 = 0x44, // reserved
-
- FSK_Reserved44 = 0x44,
- LOR_RegPllHop = 0x44,
-
- // 0x45-0x4a reserved
-
- COM_RegTcxo = 0x4b,
-
- // 0x4c reserved
-
- COM_RegPaDac = 0x4d,
-
- // 0x4e-0x5a reserved
-
- COM_RegFormerTemp = 0x5b,
-
- // 0x5c reserved
-
- FSK_RegBitRateFrac = 0x5d,
- LOR_Reserved5d = 0x5d, // reserved
-
- // 0x5e-0x60 reserved
-
- COM_RegAgcRef = 0x61,
- COM_RegAgcThresh1 = 0x62,
- COM_RegAgcThresh2 = 0x63,
- COM_RegAgcThresh3 = 0x64,
-
- // 0x65-0x6f reserved
-
- COM_RegPll = 0x70
-
- // 0x71-0xff reserved
- } SX1276_REGS_T;
-
- /**
- * OpMode register (differing bitfields depending on mode)
- */
- typedef enum {
- OPMODE_Mode0 = 0x01, // operating modes (sleep, etc)
- OPMODE_Mode1 = 0x02,
- OPMODE_Mode2 = 0x04,
- _OPMODE_Mode_MASK = 7,
- _OPMODE_Mode_SHIFT = 0,
-
- OPMODE_LowFrequencyModeOn = 0x08,
-
- // 0x10 reserved
-
- OPMODE_FSK_ModulationType0 = 0x20,
- OPMODE_FSK_ModulationType1 = 0x40,
- _OPMODE_FSK_ModulationType_MASK = 3,
- _OPMODE_FSK_ModulationType_SHIFT = 5,
-
- OPMODE_LOR_Reserved0x20 = 0x20,
-
- OPMODE_LOR_AccessSharedReg = 0x40, // tmp sw to FSK regs
-
- OPMODE_LongRangeMode = 0x80 // LoRa mode enable(1), else FSK
- } OPMODE_BITS_T;
-
-
- /**
- * Mode values
- */
- typedef enum {
- MODE_Sleep = 0,
- MODE_Standby = 1,
- MODE_FSTX = 2, // freq synth
- MODE_TxMode = 3,
- MODE_FSRX = 4, // freq synth
-
- MODE_FSK_RxMode = 5,
- MODE_LOR_RxContinuous = 5, // continuous rx mode
-
- MODE_FSK_Reserved6 = 6,
- MODE_LOR_RxSingle = 6, // single packet rx mode
-
- MODE_FSK_Reserved7 = 7,
- MODE_LOR_CAD = 7 // channel activity detection
- } MODE_T;
-
- /**
- * FSK_ModulationType values
- */
- typedef enum {
- MODULATION_FSK = 0, // freq shift keying
- MODULATION_OOK = 1, // on/off keying
- // 2-3 reserved
- } FSK_MODULATION_TYPE_T;
-
- /**
- * RegPaConfig register
- */
- typedef enum {
- PACONFIG_OutputPower0 = 0x01,
- PACONFIG_OutputPower1 = 0x02,
- PACONFIG_OutputPower2 = 0x04,
- PACONFIG_OutputPower3 = 0x08,
- _PACONFIG_OutputPower_MASK = 15,
- _PACONFIG_OutputPower_SHIFT = 0,
-
- PACONFIG_MaxPower0 = 0x10,
- PACONFIG_MaxPower1 = 0x20,
- PACONFIG_MaxPower2 = 0x40,
- _PACONFIG_MaxPower_MASK = 7,
- _PACONFIG_MaxPower_SHIFT = 4,
-
- PACONFIG_PaSelect = 0x80 // PA output pin,
- // 0 = 14dBm, 1 = 20dBm
- } PACONFIG_BITS_T;
-
- /**
- * RegPaRamp register
- */
- typedef enum {
- PARAMP_PaRamp0 = 0x01, // rise/fall of ramp up/down
- PARAMP_PaRamp1 = 0x02,
- PARAMP_PaRamp2 = 0x04,
- PARAMP_PaRamp3 = 0x08,
- _PARAMP_PaRamp_MASK = 15,
- _PARAMP_PaRamp_SHIFT = 0,
-
- // 0x10 reserved
-
- // LORA 0x20-0x40 reserved
-
- PARAMP_FSK_ModulationShaping0 = 0x20,
- PARAMP_FSK_ModulationShaping1 = 0x40,
- _PARAMP_FSK_ModulationShaping_MASK = 3,
- _PARAMP_FSK_ModulationShaping_SHIFT = 5
-
- // 0x80 reserved
- } PARAMP_BITS_T;
-
- /**
- * PARAMP_PaRamp values
- */
- typedef enum {
- PARAMP_3_4MS = 0, // 3.4ms
- PARAMP_2MS = 1,
- PARAMP_1MS = 2,
- PARAMP_500US = 3, // 500us
- PARAMP_250US = 4,
- PARAMP_125US = 5,
- PARAMP_100US = 6,
- PARAMP_62US = 7,
- PARAMP_50US = 8,
- PARAMP_40US = 9,
- PARAMP_31US = 10,
- PARAMP_25US = 11,
- PARAMP_20US = 12,
- PARAMP_15US = 13,
- PARAMP_12US = 14,
- PARAMP_10US = 15
- } PARAMP_T;
-
- /**
- * PARAMP_ModulationShaping values. Note, these mean different
- * things depending on whether you are using FSK or OOK. Hence
- * the FSK/OOK dups. We will also name these as 'MODSHAPING_', rather
- * than the lengthy 'MODULATIONSHAPING... '
- */
- typedef enum {
- MODSHAPING_NOSHAPING = 0,
-
- // FSK
- MODSHAPING_FSK_GaussianFilterBT1 = 1, // BT = 1.0
- MODSHAPING_FSK_GaussianFilterBT05 = 2, // BT = 0.5
- MODSHAPING_FSK_GaussianFilterBT03 = 3, // BT = 0.3
-
- // OOK
- MODSHAPING_OOK_FCutoffBitRate = 1, // Fcutoff = BitRate
- MODSHAPING_OOK_FCutoffBitRate2 = 2 // Fcutoff = 2*BitRate
-
- // for OOK, 3 is reserved
- } MODSHAPING_T;
-
- /**
- * RegOcp register (see datasheet for OcpTrim values)
- */
- typedef enum {
- OCP_OcpTrim0 = 0x01,
- OCP_OcpTrim1 = 0x02,
- OCP_OcpTrim2 = 0x04,
- OCP_OcpTrim3 = 0x08,
- _OCP_OcpTrim_MASK = 15,
- _OCP_OcpTrim_SHIFT = 0,
-
- OCP_OcpOn = 0x10
-
- // 0x20-0x80 reserved
- } OCP_BITS_T;
-
- /**
- * Lna register
- */
- typedef enum {
- LNA_LnaBoostHf0 = 0x01,
- LNA_LnaBoostHf1 = 0x02,
- _LNA_LnaBoostHf_MASK = 3,
- _LNA_LnaBoostHf_SHIFT = 0,
-
- // 0x04 reserved
-
- LNA_LnaBoostLf0 = 0x08,
- LNA_LnaBoostLf1 = 0x10,
- _LNA_LnaBoostLf_MASK = 3,
- _LNA_LnaBoostLf_SHIFT = 3,
-
- LNA_LnaGain0 = 0x20,
- LNA_LnaGain1 = 0x40,
- LNA_LnaGain2 = 0x80,
- _LNA_LnaGain_MASK = 7,
- _LNA_LnaGain_SHIFT = 5
- } LNA_BITS_T;
-
- /**
- * LnaBoostHf values
- */
- typedef enum {
- LNABOOSTHF_Default = 0,
- // 1-2 reserved
- LNABOOSTHF_BoostOn = 3, // 150% LNA current
- } LNABOOSTHF_T;
-
- /**
- * LnaBoostLf values
- */
- typedef enum {
- LNABOOSTLF_Default = 0
- // 1-3 reserved
- } LNABOOSTLF_T;
-
- /**
- * LnaGain values
- */
- typedef enum {
- // 0 reserved
- LNAGAIN_G1 = 1, // max gain
- LNAGAIN_G2 = 2,
- LNAGAIN_G3 = 3,
- LNAGAIN_G4 = 4,
- LNAGAIN_G5 = 5,
- LNAGAIN_G6 = 6 // minimum gain
- // 7 reserved
- } LNAGAIN_T;
-
- /**
- * FSK_RxConfig register. See Table 24 in the data sheet for
- * the meanings of the RxTrigger values.
- */
- typedef enum {
- RXCONFIG_RxTrigger0 = 0x01,
- RXCONFIG_RxTrigger1 = 0x02,
- RXCONFIG_RxTrigger2 = 0x04,
- _RXCONFIG_RxTrigger_MASK = 7,
- _RXCONFIG_RxTrigger_SHIFT = 0,
-
- RXCONFIG_AgcAutoOn = 0x08,
- RXCONFIG_AfcAutoOn = 0x10,
- RXCONFIG_RestartRxWithPllLock = 0x20,
- RXCONFIG_RestartRxWithoutPllLock = 0x40,
- RXCONFIG_RestartRxOnCollision = 0x80
- } RXCONFIG_BITS_T;
-
- /**
- * FSK_RssiConfig register
- */
- typedef enum {
- RSSICONFIG_RssiSmoothing0 = 0x01, // RSSI sampling/averaging
- RSSICONFIG_RssiSmoothing1 = 0x02,
- RSSICONFIG_RssiSmoothing2 = 0x04,
- _RSSICONFIG_RssiSmoothing_MASK = 7,
- _RSSICONFIG_RssiSmoothing_SHIFT = 0,
-
- RSSICONFIG_RssiOffset0 = 0x08, // 2's complement offset
- RSSICONFIG_RssiOffset1 = 0x10,
- RSSICONFIG_RssiOffset2 = 0x20,
- RSSICONFIG_RssiOffset3 = 0x40,
- RSSICONFIG_RssiOffset4 = 0x80,
- _RSSICONFIG_RssiOffset_MASK = 31,
- _RSSICONFIG_RssiOffset_SHIFT = 3
- } RSSICONFIG_BITS_T;
-
- /**
- * RssiSmoothing values
- */
- typedef enum {
- RSSISMOOTHING_2 = 0, // 2 samples used
- RSSISMOOTHING_4 = 1,
- RSSISMOOTHING_8 = 2,
- RSSISMOOTHING_16 = 3,
- RSSISMOOTHING_32 = 4,
- RSSISMOOTHING_64 = 5,
- RSSISMOOTHING_128 = 6,
- RSSISMOOTHING_256 = 7
- } RSSISMOOTHING_T;
-
- /**
- * LOR_RegIrqFlagsMask and LOR_RegIrqFlags registers
- */
- typedef enum {
- LOR_IRQFLAG_CadDetected = 0x01,
- LOR_IRQFLAG_FhssChangeChannel = 0x02,
- LOR_IRQFLAG_CadDone = 0x04,
- LOR_IRQFLAG_TxDone = 0x08,
-
- LOR_IRQFLAG_ValidHeader = 0x10,
- LOR_IRQFLAG_PayloadCrcError = 0x20,
- LOR_IRQFLAG_RxDone = 0x40,
- LOR_IRQFLAG_RxTimeout = 0x80
- } LOR_IRQFLAG_BITS_T;
-
- /**
- * FSK_RxBw register and FSK_RegAfcBw registers
- */
- typedef enum {
- RXBW_RxBwExp0 = 0x01,
- RXBW_RxBwExp1 = 0x02,
- RXBW_RxBwExp2 = 0x04,
- _RXBW_RxBwExp_MASK = 7,
- _RXBW_RxBwExp_SHIFT = 0,
-
- RXBW_RxBwMant0 = 0x08,
- RXBW_RxBwMant1 = 0x10,
- _RXBW_RxBwMant_MASK = 3,
- _RXBW_RxBwMant_SHIFT = 3,
- // 0x20-0x80 reserved
- } RXBW_BITS_T;
-
- /**
- * RXBW_RxBwMant values
- */
- typedef enum {
- RXBWMANT_0 = 0,
- RXBWMANT_1 = 1,
- RXBWMANT_2 = 2
- // 3 reserved
- } RXBWMANT_T;
-
- /**
- * RXBW_RxBwExp values
- */
- typedef enum {
- RXBWEXP_1 = 1,
- RXBWEXP_2 = 2,
- RXBWEXP_3 = 3,
- RXBWEXP_4 = 4,
- RXBWEXP_5 = 5,
- RXBWEXP_6 = 6,
- RXBWEXP_7 = 7
- // other values reserved
- } RXBWEXP_T;
-
- /**
- * FSK_OokPeak register
- */
- typedef enum {
- OOKPEAK_OokPeakThreshStep0 = 0x01,
- OOKPEAK_OokPeakThreshStep1 = 0x02,
- OOKPEAK_OokPeakThreshStep2 = 0x04,
- _OOKPEAK_OokPeakThreshStep_MASK = 7,
- _OOKPEAK_OokPeakThreshStep_SHIFT = 0,
-
- OOKPEAK_OokThreshType0 = 0x08,
- OOKPEAK_OokThreshType1 = 0x10,
- _OOKPEAK_OokThreshType_MASK = 3,
- _OOKPEAK_OokThreshType_SHIFT = 3,
-
- OOKPEAK_BitSyncOn = 0x20,
-
- // 0x40-0x80 reserved
- } OOKPEAK_BITS_T;
-
- /**
- * OokPeakThreshStep values
- */
- typedef enum {
- OOKPEAKTHRESHSTEP_05dB = 0, // dec of RSSI threshold 0.5dB
- OOKPEAKTHRESHSTEP_1dB = 1, // 1 dB
- OOKPEAKTHRESHSTEP_15dB = 2, // 1.5 dB
- OOKPEAKTHRESHSTEP_2dB = 3, // 2 dB
- OOKPEAKTHRESHSTEP_3dB = 4,
- OOKPEAKTHRESHSTEP_4dB = 5,
- OOKPEAKTHRESHSTEP_5dB = 6,
- OOKPEAKTHRESHSTEP_6dB = 7
- } OOKPEAKTHRESHSTEP_T;
-
- /**
- * OokPeakThreshType values
- */
- typedef enum {
- OOKTHRESHTYPE_FIXED = 0,
- OOKTHRESHTYPE_PEAK = 1,
- OOKTHRESHTYPE_AVERAGE = 2
- // 3 reserved
- } OOKTHRESHTYPE_T;
-
- /**
- * FSK_OokAvg register
- */
- typedef enum {
- OOKAVG_OokAvgThreshFilt0 = 0x01,
- OOKAVG_OokAvgThreshFilt1 = 0x02,
- _OOKAVG_OokAvgThreshFilt_MASK = 3,
- _OOKAVG_OokAvgThreshFilt_SHIFT = 0,
-
- OOKAVG_OokAvgOffset0 = 0x04,
- OOKAVG_OokAvgOffset1 = 0x08,
- _OOKAVG_OokAvgOffset_MASK = 3,
- _OOKAVG_OokAvgOffset_SHIFT = 2,
-
- // 0x10 reserved
-
- OOKAVG_OokPeakThreshDec0 = 0x20,
- OOKAVG_OokPeakThreshDec1 = 0x40,
- OOKAVG_OokPeakThreshDec2 = 0x80,
- _OOKAVG_OokPeakThreshDec_MASK = 7,
- _OOKAVG_OokPeakThreshDec_SHIFT = 5
- } OOKAVG_BITS_T;
-
- /**
- * OokAvgThreshFilt values
- */
- typedef enum {
- OOKAVGTHRESHFILT_32 = 0, // filter coedd in avg mode
- OOKAVGTHRESHFILT_8 = 1,
- OOKAVGTHRESHFILT_4 = 2,
- OOKAVGTHRESHFILT_2 = 3
- } OOKAVGTHRESHFILT_T;
-
- /**
- * OokAvgOffset values
- */
- typedef enum {
- OOKAVGOFFSET_0 = 0, // 0.0dB
- OOKAVGOFFSET_2 = 1,
- OOKAVGOFFSET_4 = 2,
- OOKAVGOFFSET_6 = 3
- } OOKAVGOFFSET_T;
-
- /**
- * OokPeakThreshDec values
- */
- typedef enum {
- OOKPEAKTHRESHDEC_1_1 = 0, // once per chip
- OOKPEAKTHRESHDEC_1_2 = 1, // once every 2 chips...
- OOKPEAKTHRESHDEC_1_4 = 2,
- OOKPEAKTHRESHDEC_1_8 = 3,
- OOKPEAKTHRESHDEC_2_1 = 4, // twice per chip
- OOKPEAKTHRESHDEC_4_1 = 5, // 4 times every chip...
- OOKPEAKTHRESHDEC_8_1 = 6,
- OOKPEAKTHRESHDEC_16_1 = 7
- } OOKPEAKTHRESHDEC_T;
-
- /**
- * LOR_ModemStat register
- */
- typedef enum {
- MODEMSTAT_SignalDetected = 0x01,
- MODEMSTAT_SignalSynchronized = 0x02,
- MODEMSTAT_RxOngoing = 0x04,
- MODEMSTAT_HeaderInfoValid = 0x08,
- MODEMSTAT_ModemClear = 0x10,
-
- MODEMSTAT_RxCodingRate0 = 0x20,
- MODEMSTAT_RxCodingRate1 = 0x40,
- MODEMSTAT_RxCodingRate2 = 0x80,
- _MODEMSTAT_RxCodingRate_MASK = 7,
- _MODEMSTAT_RxCodingRate_SHIFT = 5
- } MODEMSTAT_BITS_T;
-
- /**
- * FSK_RegAfcFei register
- */
- typedef enum {
- AFCFEI_AfcAutoClearOn = 0x01,
- AFCFEI_AfcClear = 0x02,
-
- // 0x04-0x08 reserved
-
- AFCFEI_AgcStart = 0x10
-
- // 0x20-0x80 reserved
- } AFCFEI_BITS_T;
-
- /**
- * LOR_HopChannel register
- */
- typedef enum {
- HOPCHANNEL_FhssPresentChannel0 = 0x01, // current freq hopping channel
- HOPCHANNEL_FhssPresentChannel1 = 0x02,
- HOPCHANNEL_FhssPresentChannel2 = 0x04,
- HOPCHANNEL_FhssPresentChannel3 = 0x08,
- HOPCHANNEL_FhssPresentChannel4 = 0x10,
- HOPCHANNEL_FhssPresentChannel5 = 0x20,
- _HOPCHANNEL_FhssPresentChannel_MASK = 63,
- _HOPCHANNEL_FhssPresentChannel_SHIFT = 0,
-
- HOPCHANNEL_CrcOnPayload = 0x40,
- HOPCHANNEL_PllTimeout = 0x80
- } HOPCHANNEL_BITS_T;
-
- /**
- * LOR_ModemConfig1 register
- */
- typedef enum {
- MODEMCONFIG1_ImplicitHeaderModeOn = 0x01,
-
- MODEMCONFIG1_CodingRate0 = 0x02,
- MODEMCONFIG1_CodingRate1 = 0x04,
- MODEMCONFIG1_CodingRate2 = 0x08,
- _MODEMCONFIG1_CodingRate_MASK = 7,
- _MODEMCONFIG1_CodingRate_SHIFT = 0,
-
- MODEMCONFIG1_Bw0 = 0x10,
- MODEMCONFIG1_Bw1 = 0x20,
- MODEMCONFIG1_Bw2 = 0x40,
- MODEMCONFIG1_Bw3 = 0x80,
- _MODEMCONFIG1_Bw_MASK = 15,
- _MODEMCONFIG1_Bw_SHIFT = 4
- } MODEMCONFIG1_BITS_T;
-
- /**
- * CodingRate values
- */
- typedef enum {
- CODINGRATE_4_5 = 1, // Error coding rate 4/5
- CODINGRATE_4_6 = 2,
- CODINGRATE_4_7 = 3,
- CODINGRATE_4_8 = 4
- } CODINGRATE_T;
-
- /**
- * Bw values
- */
- typedef enum {
- BW_7_8 = 0, // 7.8Khz
- BW_10_4 = 1,
- BW_15_6 = 2,
- BW_20_8 = 3,
- BW_31_25 = 4,
- BW_41_7 = 5,
- BW_62_5 = 6,
- BW_125 = 7,
- BW_250 = 8,
- BW_500 = 9
-
- // BW250 and BW500 not supported in lower band (169Mhz)
- } BW_T;
-
- /**
- * LOR_ModemConfig2 register
- */
- typedef enum {
- MODEMCONFIG2_SymbTimeoutMsb0 = 0x01,
- MODEMCONFIG2_SymbTimeoutMsb1 = 0x02,
- _MODEMCONFIG2_SymbTimeoutMsb_MASK = 3,
- _MODEMCONFIG2_SymbTimeoutMsb_SHIFT = 0,
-
- MODEMCONFIG2_RxPayloadCrcOn = 0x04,
-
- MODEMCONFIG2_TxContinuousMode = 0x08,
-
- MODEMCONFIG2_SpreadingFactor0 = 0x10,
- MODEMCONFIG2_SpreadingFactor1 = 0x20,
- MODEMCONFIG2_SpreadingFactor2 = 0x40,
- MODEMCONFIG2_SpreadingFactor3 = 0x80,
- _MODEMCONFIG2_SpreadingFactor_MASK = 15,
- _MODEMCONFIG2_SpreadingFactor_SHIFT = 4,
- } MODEMCONFIG2_BITS_T;
-
- /**
- * SpreadingFactor values (expressed as a base-2 logarithm)
- */
- typedef enum {
- SPREADINGFACTOR_64 = 6, // 64 chips/symbol
- SPREADINGFACTOR_128 = 7,
- SPREADINGFACTOR_256 = 8,
- SPREADINGFACTOR_512 = 9,
- SPREADINGFACTOR_1024 = 10,
- SPREADINGFACTOR_2048 = 11,
- SPREADINGFACTOR_4096 = 12
-
- // other values reserved
- } SPREADINGFACTOR_T;
-
- /**
- * FSK_PreableDetect register
- */
- typedef enum {
- PREABLEDETECT_PreambleDetectorTol0 = 0x01,
- PREABLEDETECT_PreambleDetectorTol1 = 0x02,
- PREABLEDETECT_PreambleDetectorTol2 = 0x04,
- PREABLEDETECT_PreambleDetectorTol3 = 0x08,
- PREABLEDETECT_PreambleDetectorTol4 = 0x10,
- _PREABLEDETECT_PreambleDetectorTol4_MASK = 31,
- _PREABLEDETECT_PreambleDetectorTol4_SHIFT = 0,
-
- PREABLEDETECT_PreambleDetectorSize0 = 0x20,
- PREABLEDETECT_PreambleDetectorSize1 = 0x40,
- _PREABLEDETECT_PreambleDetectorSize_MASK = 3,
- _PREABLEDETECT_PreambleDetectorSize_SHIFT = 5,
-
- PREABLEDETECT_PreambleDetectorOn = 0x80
- } PREAMBLEDETECT_BITS_T;
-
- /**
- * PreambleDetectorSize values
- */
- typedef enum {
- PREAMBLEDETECTORSIZE_1 = 0, // 1 byte
- PREAMBLEDETECTORSIZE_2 = 1,
- PREAMBLEDETECTORSIZE_3 = 2
-
- // other values reserved
- } PREAMBLEDETECTORSIZE_T;
-
- /**
- * FSK_Osc register
- */
- typedef enum {
- OSC_ClkOut0 = 0x01, // clk output freq
- OSC_ClkOut1 = 0x02,
- OSC_ClkOut2 = 0x04,
- _OSC_ClkOut_MASK = 7,
- _OSC_ClkOut_SHIFT = 0,
-
- OSC_RcCalStart = 0x08
-
- // other bits reserved
- } OSC_BITS_T;
-
- /**
- * ClkOut values
- */
- typedef enum {
- CLKOUT_1 = 0, // FXOSC
- CLKOUT_2 = 1, // FXOSC / 2 ...
- CLKOUT_4 = 2,
- CLKOUT_8 = 3,
- CLKOUT_16 = 4,
- CLKOUT_32 = 5,
- CLKOUT_RC = 6, // RC, (automatically enabled)
- CLKOUT_OFF = 7 // clkout off
- } CLKOUT_T;
-
- /**
- * LOR_ModemConfig3 register
- */
- typedef enum {
- // 0x01-0x02 reserved
-
- MODEMCONFIG3_AgcAutoOn = 0x04,
- MODEMCONFIG3_LowDataRateOptimize = 0x08 // req. for SF11 and SF12 and
- // BW125
-
- // 0x10-0x80 reserved
- } MODEMCONFIG3_BITS_T;
-
- /**
- * FSK_SyncConfig register
- */
- typedef enum {
- SYNCCONFIG_SyncSize0 = 0x01,
- SYNCCONFIG_SyncSize1 = 0x02,
- SYNCCONFIG_SyncSize2 = 0x04,
- _SYNCCONFIG_SyncSize_MASK = 7,
- _SYNCCONFIG_SyncSize_SHIFT = 0,
-
- // 0x08 reserved
-
- SYNCCONFIG_SyncOn = 0x10,
- SYNCCONFIG_PreamblePolarity = 0x20,
-
- SYNCCONFIG_AutoRestartMode0 = 0x40,
- SYNCCONFIG_AutoRestartMode1 = 0x80,
- _SYNCCONFIG_AutoRestartMode_MASK = 3,
- _SYNCCONFIG_AutoRestartMode_SHIFT = 6,
- } SYNCCONFIG_BITS_T;
-
- /**
- * AutoRestartMode values
- */
- typedef enum {
- AUTORESTARTMODE_OFF = 0,
- AUTORESTARTMODE_ON_NOPLL = 1, // don't wait for PLL resync
- AUTORESTARTMODE_ON_PLL = 2 // wait for PLL resync
- // other values reserved
- } AUTORESTARTMODE_T;
-
- /**
- * LOR_FeiMsb register (4 bit MSB of Fei value)
- */
- typedef enum {
- FEIMSB_FreqError0 = 0x01,
- FEIMSB_FreqError1 = 0x02,
- FEIMSB_FreqError2 = 0x04,
- FEIMSB_FreqError3 = 0x08,
- _FEIMSB_FreqError_MASK = 15,
- _FEIMSB_FreqError_SHIFT = 0
-
- // 0x10-0x80 reserved
- } FEIMSB_BITS_T;
-
- /**
- * FSK_PacketConfig1 register
- */
- typedef enum {
- PACKETCONFIG1_CrcWhiteningType = 0x01,
-
- PACKETCONFIG1_AddressFiltering0 = 0x02,
- PACKETCONFIG1_AddressFiltering1 = 0x04,
- _PACKETCONFIG1_AddressFiltering_MASK = 3,
- _PACKETCONFIG1_AddressFiltering_SHIFT = 1,
-
- PACKETCONFIG1_CrcAutoClearOff = 0x08,
- PACKETCONFIG1_CrcOn = 0x10,
-
- PACKETCONFIG1_DcFree0 = 0x20,
- PACKETCONFIG1_DcFree1 = 0x40,
- _PACKETCONFIG1_DcFree_MASK = 3,
- _PACKETCONFIG1_DcFree_SHIFT = 5,
-
- PACKETCONFIG1_PacketFormat = 0x80 // fixed(0) or variable(1)
- } PACKETCONFIG1_BITS_T;
-
- /**
- * AddressFiltering values
- */
- typedef enum {
- ADDRESSFILTERING_NONE = 0,
- ADDRESSFILTERING_NODE = 1, // must match node addr
- ADDRESSFILTERING_NODE_BROADCAST = 2, // match node or broadcast
- } ADDRESSFILTERING_T;
-
- /**
- * DcFree values (DC-free encoding/decoding schemes)
- */
- typedef enum {
- DCFREE_NONE = 0,
- DCFREE_MANCHESTER = 1,
- DCFREE_WHITENING = 2
- // other values reserved
- } DCFREE_T;
-
- /**
- * FSK_PacketConfig2 register
- */
- typedef enum {
- PACKETCONFIG2_PayloadLengthMsb0 = 0x01,
- PACKETCONFIG2_PayloadLengthMsb1 = 0x02,
- PACKETCONFIG2_PayloadLengthMsb2 = 0x04,
- _PACKETCONFIG2_PayloadLengthMsb_MASK = 7,
- _PACKETCONFIG2_PayloadLengthMsb_SHIFT = 0,
-
- PACKETCONFIG2_BeaconOn = 0x08,
-
- // 0x10 reserved (linked to io-homecontrol compat mode (?))
-
- PACKETCONFIG2_IoHomeOn = 0x20,
- PACKETCONFIG2_DataMode = 0x40, // continuous(0), packet(1)
-
- // 0x80 reserved
- } PACKETCONFIG2_BITS_T;
-
- /**
- * LOR_DetectOptimize register
- */
- typedef enum {
- DETECTOPTIMIZE_DetectionOptimize0 = 0x01,
- DETECTOPTIMIZE_DetectionOptimize1 = 0x02,
- DETECTOPTIMIZE_DetectionOptimize2 = 0x04,
- _DETECTOPTIMIZE_DetectionOptimize_MASK = 7,
- _DETECTOPTIMIZE_DetectionOptimize_SHIFT = 0
-
- // 0x08-0x80 reserved
- } DETECTOPTIMIZE_BITS_T;
-
- /**
- * DetectionOptimize values
- */
- typedef enum {
- DETECTIONOPTIMIZE_SF7_SF12 = 3,
- DETECTIONOPTIMIZE_SF6 = 5
-
- // other values reserved
- } DETECTIONOPTIMIZE_T;
-
- /**
- * LOR_InvertIQ register
- */
- typedef enum {
- INVERTIQ_InvertIQTxOff = 0x01, // invert LoRa I & Q signals
- // UNDOCUMENTED
-
- // 0x01-0x20 reserved
-
- INVERTIQ_InvertIQRx = 0x40 // invert LoRa I & Q signals
-
- // 0x80 reserved
- } INVERTIQ_BITS_T;
-
- /**
- * FSK_FifoThresh register
- */
- typedef enum {
- FIFOTHRESH_FifoThreshold0 = 0x01,
- FIFOTHRESH_FifoThreshold1 = 0x02,
- FIFOTHRESH_FifoThreshold2 = 0x04,
- FIFOTHRESH_FifoThreshold3 = 0x08,
- FIFOTHRESH_FifoThreshold4 = 0x10,
- FIFOTHRESH_FifoThreshold5 = 0x20,
- _FIFOTHRESH_FifoThreshold_MASK = 63,
- _FIFOTHRESH_FifoThreshold_SHIFT = 0,
-
- // 0x40 reserved
-
- FIFOTHRESH_TxStartCondition = 0x80
- } FIFOTHRESH_BITS_T;
-
- /**
- * FSK_SeqConfig1 register
- */
- typedef enum {
- SEQCONFIG1_FromTransit = 0x01,
- SEQCONFIG1_FromIdle = 0x02,
- SEQCONFIG1_LowPowerSelection = 0x04,
-
- SEQCONFIG1_FromStart0 = 0x08,
- SEQCONFIG1_FromStart1 = 0x10,
- _SEQCONFIG1_FromStart_MASK = 3,
- _SEQCONFIG1_FromStart_SHIFT = 3,
-
- SEQCONFIG1_IdleMode = 0x20,
- SEQCONFIG1_SequencerStop = 0x40,
- SEQCONFIG1_SequencerStart = 0x80
- } SEQCONFIG1_BITS_T;
-
- /**
- * FromStart values
- */
- typedef enum {
- FROMSTART_ToLowPowerSelection = 0,
- FROMSTART_ToReceiveState = 1,
- FROMSTART_ToTransmitState = 2,
- FROMSTART_ToTransmitStateOnFifoLevel = 3
- } FROMSTART_T;
-
- /**
- * FSK_SeqConfig2 register
- */
- typedef enum {
- SEQCONFIG2_FromPacketReceived0 = 0x01,
- SEQCONFIG2_FromPacketReceived1 = 0x02,
- SEQCONFIG2_FromPacketReceived2 = 0x04,
- _SEQCONFIG2_FromPacketReceived_MASK = 7,
- _SEQCONFIG2_FromPacketReceived_SHIFT = 0,
-
- SEQCONFIG2_FromRxTimeout0 = 0x08,
- SEQCONFIG2_FromRxTimeout1 = 0x10,
- _SEQCONFIG2_FromRxTimeout_MASK = 3,
- _SEQCONFIG2_FromRxTimeout_SHIFT = 3,
-
- SEQCONFIG2_FromReceive0 = 0x20,
- SEQCONFIG2_FromReceive1 = 0x40,
- SEQCONFIG2_FromReceive2 = 0x80,
- _SEQCONFIG2_FromReceive_MASK = 3,
- _SEQCONFIG2_FromReceive_SHIFT = 5
- } SEQCONFIG2_BITS_T;
-
- /**
- * FromPacketReceived values
- */
- typedef enum {
- FROMPACKETRECEIVED_ToSequencerOff = 0,
- FROMPACKETRECEIVED_ToTransmitStateOnFifoEmpty = 1,
- FROMPACKETRECEIVED_ToLowPowerSelection = 2,
- FROMPACKETRECEIVED_ToReceiveViaFS = 3, // if freq was changed
- FROMPACKETRECEIVED_ToReceive = 4 // if freq was not changed
-
- // other values reserved
- } FROMPACKETRECEIVED_T;
-
- /**
- * FromRxTimeout values
- */
- typedef enum {
- FROMRXTIMEOUT_ToReceiveViaReceiveStart = 0,
- FROMRXTIMEOUT_ToTransmitState = 1,
- FROMRXTIMEOUT_ToLowPowerSelection = 2,
- FROMRXTIMEOUT_ToSequencerOffState = 3
- } FROMRXTIMEOUT_T;
-
- /**
- * FromReceive values
- */
- typedef enum {
- FROMRECEIVE_ToPcketReceived = 1,
- FROMRECEIVE_ToLowPowerSelection = 2,
- FROMRECEIVE_ToPacketReceived = 3,
- FROMRECEIVE_ToSequencerOffOnRSSI = 4, // RSSI interrupt
- FROMRECEIVE_ToSequencerOffOnSync = 5, // SyncAddr interrupt
- FROMRECEIVE_ToSequencerOffOnPreambleDetect = 6, // PreambleDetect intr
- // other values reserved
- } FROMRECEIVE_T;
-
- /**
- * FSK_TimerResol register
- */
- typedef enum {
- TIMERRESOL_Timer2Resolution0 = 0x01,
- TIMERRESOL_Timer2Resolution1 = 0x02,
- _TIMERRESOL_Timer2Resolution_MASK = 3,
- _TIMERRESOL_Timer2Resolution_SHIFT = 0,
-
- TIMERRESOL_Timer1Resolution0 = 0x04,
- TIMERRESOL_Timer1Resolution1 = 0x08,
- _TIMERRESOL_Timer1Resolution_MASK = 3,
- _TIMERRESOL_Timer1Resolution_SHIFT = 2
-
- // 0x10-0x80 reserved
- } TIMERRESOL_BITS_T;
-
- /**
- * Timer1/Timer2Resolution values
- */
- typedef enum {
- TIMERRESOLUTION_DISABLED = 0,
- TIMERRESOLUTION_64us = 1, // 64us
- TIMERRESOLUTION_4_1ms = 2, // 4.1ms
- TIMERRESOLUTION_262ms = 3 // 262ms
- } TIMERRESOLUTION_T;
-
- /**
- * FSK_ImageCal register
- */
- typedef enum {
- IMAGECAL_TempMonitorOff = 0x01,
-
- IMAGECAL_TempThreshold0 = 0x02,
- IMAGECAL_TempThreshold1 = 0x04,
- _IMAGECAL_TempThreshold_MASK = 3,
- _IMAGECAL_TempThreshold_SHIFT = 1,
-
- IMAGECAL_TenpChange = 0x08,
-
- // 0x10 reserved
-
- IMAGECAL_ImageCalRunning = 0x20,
- IMAGECAL_ImageCalStart = 0x40,
- IMAGECAL_AutoImageCalOn = 0x80
- } IMAGECAL_BITS_T;
-
- /**
- * TempThreshold values
- */
- typedef enum {
- TEMPTHRESHOLD_5C = 0, // temp change to trigger new I/Q
- TEMPTHRESHOLD_10C = 1, // calibration
- TEMPTHRESHOLD_15C = 2,
- TEMPTHRESHOLD_20C = 3
- } TEMPTHRESHOLD_T;
-
- /**
- * FSK_LowBat register
- */
- typedef enum {
- LOWBAT_LowBatTrim0 = 0x01,
- LOWBAT_LowBatTrim1 = 0x02,
- LOWBAT_LowBatTrim2 = 0x04,
- _LOWBAT_LowBatTrim_MASK = 7,
- _LOWBAT_LowBatTrim_SHIFT = 0,
-
- LOWBAT_LowBatOn = 0x08
-
- // 0x10-0z80 reserved
- } LOWBAT_BITS_T;
-
- /**
- * LowBatTrim values
- */
- typedef enum {
- LOWBATTRIM_1_695 = 0, // 1.695v
- LOWBATTRIM_1_764 = 1,
- LOWBATTRIM_1_835 = 2,
- LOWBATTRIM_1_905 = 3,
- LOWBATTRIM_1_976 = 4,
- LOWBATTRIM_2_045 = 5,
- LOWBATTRIM_2_116 = 6,
- LOWBATTRIM_2_185 = 7
- } LOWBATTRIM_T;
-
- /**
- * FSK_IrqFlags1 register
- */
- typedef enum {
- IRQFLAGS1_SyncAddressMatch = 0x01,
- IRQFLAGS1_PreambleDetect = 0x02,
- IRQFLAGS1_Timeout = 0x04,
- IRQFLAGS1_Rssi = 0x08,
- IRQFLAGS1_PllLock = 0x10,
- IRQFLAGS1_TxReady = 0x20,
- IRQFLAGS1_RxReady = 0x40,
- IRQFLAGS1_ModeReady = 0x80
- } IRQFLAGS1_BITS_T;
-
- /**
- * FSK_IrqFlags2 register
- */
- typedef enum {
- IRQFLAGS2_LowBat = 0x01,
- IRQFLAGS2_CrcOk = 0x02,
- IRQFLAGS2_PayloadReady = 0x04,
- IRQFLAGS2_PacketSent = 0x08,
- IRQFLAGS2_FifoOverrun = 0x10,
- IRQFLAGS2_FifoLevel = 0x20,
- IRQFLAGS2_FifoEmpty = 0x40,
- IRQFLAGS2_FifoFull = 0x80
- } IRQFLAGS2_BITS_T;
-
- /**
- * COM_DioMapping1 register. See Tables 18, 29, and 30 in the
- * datasheet for the different mappings depending on mode.
- */
- typedef enum {
- DOIMAPPING1_Dio3Mapping0 = 0x01,
- DOIMAPPING1_Dio3Mapping1 = 0x02,
- DOIMAPPING1_Dio3Mapping_MASK = 3,
- DOIMAPPING1_Dio3Mapping_SHIFT = 0,
-
- DOIMAPPING1_Dio2Mapping0 = 0x04,
- DOIMAPPING1_Dio2Mapping1 = 0x08,
- DOIMAPPING1_Dio2Mapping_MASK = 3,
- DOIMAPPING1_Dio2Mapping_SHIFT = 2,
-
- DOIMAPPING1_Dio1Mapping0 = 0x10,
- DOIMAPPING1_Dio1Mapping1 = 0x20,
- DOIMAPPING1_Dio1Mapping_MASK = 3,
- DOIMAPPING1_Dio1Mapping_SHIFT = 4,
-
- DOIMAPPING1_Dio0Mapping0 = 0x40,
- DOIMAPPING1_Dio0Mapping1 = 0x80,
- DOIMAPPING1_Dio0Mapping_MASK = 3,
- DOIMAPPING1_Dio0Mapping_SHIFT = 6,
- } DIOMAPPING1_BITS_T;
-
-
- /**
- * COM_DioMapping2 register. See Tables 18, 29, and 30 in the
- * datasheet for the different mappings depending on mode.
- */
- typedef enum {
- DOIMAPPING2_MapPreambleDetect = 0x01, // rssi intr(0), preambledet(1)
-
- // 0x02-0x08 reserved
-
- DOIMAPPING2_Dio5Mapping0 = 0x10,
- DOIMAPPING2_Dio5Mapping1 = 0x20,
- DOIMAPPING2_Dio5Mapping_MASK = 3,
- DOIMAPPING2_Dio5Mapping_SHIFT = 4,
-
- DOIMAPPING2_Dio4Mapping0 = 0x40,
- DOIMAPPING2_Dio4Mapping1 = 0x80,
- DOIMAPPING2_Dio4Mapping_MASK = 3,
- DOIMAPPING2_Dio4Mapping_SHIFT = 6,
- } DIOMAPPING2_BITS_T;
-
- /**
- * DioXMapping values
- *
- * These differ depending on LoRa, FSK packet, and FSK continous
- * modes. See Tables 29, 30 (FSK), and 18 (LoRa) in the datasheet
- * for details.
- */
- typedef enum {
- DIOMAPPING_00 = 0,
- DIOMAPPING_01 = 1,
- DIOMAPPING_10 = 2,
- DIOMAPPING_11 = 3
- } DIOMAPPING_T;
-
-
- /**
- * LOR_PllHop (or FSK_PllHop depending on who you believe) register
- */
- typedef enum {
- // 0x01-0x40 reserved
-
- PLLHOP_FastHopOn = 0x80
- } PLLHOP_BITS_T;
-
- /**
- * COM_Tcxo register
- */
- typedef enum {
- // 0x01-0x08 reserved
-
- TCXO_TcxoOn = 0x10
-
- // 0x20-0x80 reserved
- } TCXO_BITS_T;
-
- /**
- * COM_PaDac register
- */
- typedef enum {
- PADAC_PaDac0 = 0x01,
- PADAC_PaDac1 = 0x02,
- PADAC_PaDac2 = 0x04,
- _PADAC_PaDac_MASK = 7,
- _PADAC_PaDac_SHIFT = 0
-
- // 0x08-0x80 reserved
- } PADAC_BITS_T;
-
- /**
- * PaDac values
- */
- typedef enum {
- PADAC_DEFAULT = 4,
- PADAC_BOOST = 7 // +20dBm on PA_BOOST when
- // OuputPower = 1111
- // other values reserved
- } PADAC_T;
-
- /**
- * FSK_BitRateFrac register
- */
- typedef enum {
- BITRATEFRAC_BitRateFrac0 = 0x01,
- BITRATEFRAC_BitRateFrac1 = 0x02,
- BITRATEFRAC_BitRateFrac2 = 0x04,
- BITRATEFRAC_BitRateFrac3 = 0x08,
- _BITRATEFRAC_BitRateFrac_MASK = 15,
- _BITRATEFRAC_BitRateFrac_SHIFT = 0
-
- // 0x10-0x80 reserved
- } BITRATEFRAC_BITS_T;
-
- /**
- * COM_AgcRef register
- *
- * These registers have 2 sets of values depending on whether
- * LowFrequencyModeOn is set or unset.
- */
- typedef enum {
- AGCREF_AgcReferenceLevel0 = 0x01,
- AGCREF_AgcReferenceLevel1 = 0x02,
- AGCREF_AgcReferenceLevel2 = 0x04,
- AGCREF_AgcReferenceLevel3 = 0x08,
- AGCREF_AgcReferenceLevel4 = 0x10,
- AGCREF_AgcReferenceLevel5 = 0x20,
- _AGCREF_AgcReferenceLevel_MASK = 63,
- _AGCREF_AgcReferenceLevel_SHIFT = 0
-
- // 0x40-0x80 reserved
- } ACFREF_BITS_T;
-
- /**
- * COM_AgcThresh1 register
- *
- * These registers have 2 sets of values depending on whether
- * LowFrequencyModeOn is set or unset.
- */
- typedef enum {
- AGCTHRESH1_AcgStep10 = 0x01,
- AGCTHRESH1_AcgStep11 = 0x02,
- AGCTHRESH1_AcgStep12 = 0x04,
- AGCTHRESH1_AcgStep13 = 0x08,
- _AGCTHRESH1_AcgStep1_MASK = 15,
- _AGCTHRESH1_AcgStep1_SHIFT = 0,
-
- // 0x10-0x80 reserved
- } ACGTHRESH1_BITS_T;
-
- /**
- * COM_AgcThresh2 register
- *
- * These registers have 2 sets of values depending on whether
- * LowFrequencyModeOn is set or unset.
- */
- typedef enum {
- AGCTHRESH2_AcgStep30 = 0x01,
- AGCTHRESH2_AcgStep31 = 0x02,
- AGCTHRESH2_AcgStep32 = 0x04,
- AGCTHRESH2_AcgStep33 = 0x08,
- _AGCTHRESH2_AcgStep3_MASK = 15,
- _AGCTHRESH2_AcgStep3_SHIFT = 0,
-
- AGCTHRESH2_AcgStep20 = 0x10,
- AGCTHRESH2_AcgStep21 = 0x20,
- AGCTHRESH2_AcgStep22 = 0x40,
- AGCTHRESH2_AcgStep23 = 0x80,
- _AGCTHRESH2_AcgStep2_MASK = 15,
- _AGCTHRESH2_AcgStep2_SHIFT = 4
- } ACGTHRESH2_BITS_T;
-
- /**
- * LOR_RegDetectionThreshold values
- */
- typedef enum {
- LOR_DetectionThreshold_SF7_SF12 = 0x0a,
- LOR_DetectionThreshold_SF6 = 0x0c
- } LOR_DETECTIONTHRESHOLD_T;
-
- /**
- * COM_AgcThresh3 register
- *
- * These registers have 2 sets of values depending on whether
- * LowFrequencyModeOn is set or unset.
- */
- typedef enum {
- AGCTHRESH3_AcgStep50 = 0x01,
- AGCTHRESH3_AcgStep51 = 0x02,
- AGCTHRESH3_AcgStep52 = 0x04,
- AGCTHRESH3_AcgStep53 = 0x08,
- _AGCTHRESH3_AcgStep5_MASK = 15,
- _AGCTHRESH3_AcgStep5_SHIFT = 0,
-
- AGCTHRESH3_AcgStep40 = 0x10,
- AGCTHRESH3_AcgStep41 = 0x20,
- AGCTHRESH3_AcgStep42 = 0x40,
- AGCTHRESH3_AcgStep43 = 0x80,
- _AGCTHRESH3_AcgStep4_MASK = 15,
- _AGCTHRESH3_AcgStep4_SHIFT = 4
- } ACGTHRESH3_BITS_T;
-
-
- /**
- * SX1276 constructor
- *
- * Since this is a shield, you will not have much choice as to
- * what pins are used.
- *
- * @param chipRev chip revision, default is 0x12
- * @param bus spi bus to use
- * @param cs GPIO pin to use as SPI Chip Select
- * @param reset GPIO pin to use as reset (A0=GPIO14)
- * @param dio0 GPIO pin to use as reset DIO0 intr
- * @param dio1 GPIO pin to use as reset DIO1 intr
- * @param dio2 GPIO pin to use as reset DIO2 intr
- * @param dio3 GPIO pin to use as reset DIO3 intr
- * @param dio4 GPIO pin to use as reset DIO4 intr
- * @param dio5 GPIO pin to use as reset DIO5 intr
- */
- SX1276(uint8_t chipRev=chipRevision, int bus=1, int cs=10, int resetPin=14,
- int dio0=2, int dio1=3, int dio2=4, int dio3=5, int dio4=17,
- int dio5=9);
-
- /**
- * SX1276 Destructor
- */
- ~SX1276();
-
- /**
- * read a register
- *
- * @param reg the register to read
- * @return the value of the register
- */
- uint8_t readReg(uint8_t reg);
-
- /**
- * write to a register
- *
- * @param reg the register to write to
- * @param val the value to write
- * @return true if successful, false otherwise
- */
- bool writeReg(uint8_t reg, uint8_t val);
-
- /**
- * return the chip revision
- *
- * @return the chip revision (usually 0x12)
- */
- uint8_t getChipVersion();
-
- /**
- * reset the modem
- */
- void reset();
-
- /**
- * read the FIFO into a buffer
- *
- * @param buffer The buffer to read data into
- * @param len The length of the buffer
- */
- void readFifo(uint8_t *buffer, int len);
-
- /**
- * write a buffer into the FIFO
- *
- * @param buffer The buffer containing the data to write
- * @param len The length of the buffer
- */
- void writeFifo(uint8_t *buffer, int len);
-
- /**
- * Set the frequency to transmit and receive on
- *
- * @param freq The frequency to set
- */
- void setChannel(uint32_t freq);
-
- /**
- * Set the operating mode
- *
- * @param opMode One of the MODE_T values
- */
- void setOpMode(MODE_T opMode);
-
- /**
- * Set the modem to access. This can be either the LORA or
- * KSK/OOK modem.
- *
- * @param modem One of the MODEM_T values
- */
- void setModem(RADIO_MODEM_T modem);
-
- /**
- * Place the SX1276 into sleep mode
- */
- void setSleep();
-
- /**
- * Place the SX1276 into standby mode
- */
- void setStandby();
-
- /**
- * Return the current Received Signal Strength Indicator for the
- * given modem
- *
- * @param modem One of the MODEM_T values
- */
- int16_t getRSSI(RADIO_MODEM_T modem);
-
- /**
- * Check to see if a given channel is free by comparing the RSSI
- * to the supplied threshold.
- *
- * @param modem One of the MODEM_T values
- * @param freq The channel to check
- * @param rssiThreshold The RSSI threshold, over which the channel
- * os considerd in use.
- */
- bool isChannelFree(RADIO_MODEM_T modem, uint32_t freq, int16_t rssiThresh);
-
- /**
- * Send the supplied string. This writes the string into the FIFO
- * and places the modem in transmit mode (via setTx()). This is a
- * wrapper around send().
- *
- * @param buffer The buffer to send
- * @param timeout The timeout in milliseconds
- * @return one of the RADIO_EVENT_T values
- */
- RADIO_EVENT_T sendStr(std::string buffer, int timeout);
-
- /**
- * Send the supplied buffer. The writes the buffer into the FIFO
- * and places the modem in transmit mode (via setTx()).
- *
- * @param buffer The buffer to send
- * @param size The size of the buffer
- * @param timeout The timeout in milliseconds
- * @return one of the RADIO_EVENT_T values
- */
- RADIO_EVENT_T send(uint8_t *buffer, uint8_t size, int timeout);
-
- /**
- * Set the receive configuration for a modem. It is important
- * that both the receive and transmit configurations match in order
- * for communication to work between two radios.
- *
- * @param modem One of the MODEM_T values
-
- * @param bandwidth The bandwidth to use. Valid values are
- * FSK : >= 2600 and <= 250000 Hz
- * LoRa: [125 kHz, 250 kHz, 500 kHz]
- * @param datarate Sets the Datarate
- * FSK : 600..300000 bits/s
- * LoRa: [6: 64, 7: 128, 8: 256, 9: 512,
- * 10: 1024, 11: 2048, 12: 4096 chips]
- * @param coderate Sets the coding rate (LoRa only)
- * FSK : N/A ( set to 0 )
- * LoRa: [1: 4/5, 2: 4/6, 3: 4/7, 4: 4/8]
- * @param bandwidthAfc Sets the AFC Bandwidth (FSK only)
- * FSK : >= 2600 and <= 250000 Hz
- * LoRa: N/A ( set to 0 )
- * @param preambleLen Sets the Preamble length
- * FSK : Number of bytes
- * LoRa: Length in symbols (the hardware adds
- * 4 more symbols)
- * @param symbTimeout Sets the RxSingle timeout value (LoRa only)
- * FSK : N/A ( set to 0 )
- * LoRa: timeout in symbols
- * @param fixLen Fixed length packets [false: variable, true: fixed]
- * @param payloadLen Sets payload length when fixed lenght is used
- * @param crcOn Enables/Disables the CRC [false: OFF, true: ON]
- * @param FreqHopOn Enables disables the intra-packet frequency hopping
- * FSK : N/A ( set to 0 )
- * LoRa: [false: OFF, true: ON]
- * @param HopPeriod Number of symbols bewteen each hop
- * FSK : N/A ( set to 0 )
- * LoRa: Number of symbols
- * @param iqInverted Inverts IQ signals (LoRa only)
- * FSK : N/A ( set to 0 )
- * LoRa: [false: not inverted, true: inverted]
- * @param rxContinuous Sets the reception in continuous mode
- * [false: single mode, true: continuous mode]
- */
- void setRxConfig(RADIO_MODEM_T modem, uint32_t bandwidth,
- uint32_t datarate, uint8_t coderate,
- uint32_t bandwidthAfc, uint16_t preambleLen,
- uint16_t symbTimeout, bool fixLen,
- uint8_t payloadLen,
- bool crcOn, bool freqHopOn, uint8_t hopPeriod,
- bool iqInverted, bool rxContinuous);
-
- /**
- * Set the transmit configuration for a modem. It is important
- * that both the receive and transmit configurations match in order
- * for communication to work between two radios.
- *
- * @param modem One of the MODEM_T values
- * @param power Sets the output power [dBm]
- * @param fdev Sets the frequency deviation (FSK only)
- * FSK : [Hz]
- * LoRa: 0
- * @param bandwidth Sets the bandwidth (LoRa only)
- * FSK : 0
- * LoRa: [125 kHz, 250 kHz,
- * or 500 kHz]
- * @param datarate Sets the Datarate
- * FSK : 600..300000 bits/s
- * LoRa: [6: 64, 7: 128, 8: 256, 9: 512,
- * 10: 1024, 11: 2048, 12: 4096 chips]
- * @param coderate Sets the coding rate (LoRa only)
- * FSK : N/A ( set to 0 )
- * LoRa: [1: 4/5, 2: 4/6, 3: 4/7, 4: 4/8]
- * @param preambleLen Sets the preamble length
- * FSK : Number of bytes
- * LoRa: Length in symbols (the hardware adds
- * 4 more symbols)
- * @param fixLen Fixed length packets [false: variable, true: fixed]
- * @param crcOn Enables disables the CRC [false: OFF, true: ON]
- * @param FreqHopOn Enables disables the intra-packet frequency hopping
- * FSK : N/A ( set to 0 )
- * LoRa: [false: OFF, true: ON]
- * @param HopPeriod Number of symbols bewteen each hop
- * FSK : N/A ( set to 0 )
- * LoRa: Number of symbols
- * @param iqInverted Inverts IQ signals (LoRa only)
- * FSK : N/A ( set to 0 )
- * LoRa: [false: not inverted, true: inverted]
- */
- void setTxConfig(RADIO_MODEM_T modem, int8_t power, uint32_t fdev,
- uint32_t bandwidth, uint32_t datarate,
- uint8_t coderate, uint16_t preambleLen,
- bool fixLen, bool crcOn, bool freqHopOn,
- uint8_t hopPeriod, bool iqInverted);
-
- /**
- * Start a receive operation. The method will return when
- * completed, either successfully, or in error (crc, or other
- * issue). If completed successfully, the returned buffer can be
- * read via getRxBuffer() or getRxBufferStr(). In addition,
- * values for RSSI and SNR (Lora only) can be retrieved.
- *
- * @param timeout The timeout in milliseconds
- * @return one of the RADIO_EVENT_T values
- */
- RADIO_EVENT_T setRx(uint32_t timeout);
-
- /**
- * Upon a successful receive, this method can be used to retrieve
- * the received packet.
- *
- * @return The received buffer in a std::string
- */
- std::string getRxBufferStr()
- {
- std::string rBuffer((char *)m_rxBuffer, getRxLen());
- return rBuffer;
- };
-
- /**
- * Upon a successful receive, this method can be used to retrieve
- * the received packet.
- *
- * @return a pointer to the received buffer. You can use
- * getRxLen() to determine the number of valid bytes present.
- */
- uint8_t *getRxBuffer()
- {
- return (uint8_t*)m_rxBuffer;
- };
-
- /**
- * Upon a successful receive, this method can be used to retrieve
- * the received packet's Received Signal Strength Indicator (RSSI)
- * value.
- *
- * @return RSSI value
- */
- int getRxRSSI()
- {
- return m_rxRSSI;
- };
-
- /**
- * Upon a successful receive, this method can be used to retrieve
- * the received packet's Signal to Noise (SNR) value.
- *
- * @return SNR value
- */
- int getRxSNR()
- {
- return m_rxSNR;
- };
-
- /**
- * Upon a successful receive, this method can be used to retrieve
- * the number of bytes received.
- *
- * @return the number of bytes received
- */
- int getRxLen()
- {
- return m_rxLen;
- };
-
-
- protected:
- // I/O
- mraa::Spi m_spi;
- mraa::Gpio m_gpioCS;
- mraa::Gpio m_gpioReset;
-
- mraa::Gpio m_gpioDIO0;
- mraa::Gpio m_gpioDIO1;
- mraa::Gpio m_gpioDIO2;
- mraa::Gpio m_gpioDIO3;
- mraa::Gpio m_gpioDIO4;
- mraa::Gpio m_gpioDIO5;
-
- // calibration called during init()
- void rxChainCalibration();
-
- // interrupt handlers
- static void onDio0Irq(void *ctx);
- static void onDio1Irq(void *ctx);
- static void onDio2Irq(void *ctx);
- static void onDio3Irq(void *ctx);
- static void onDio4Irq(void *ctx);
- static void onDio5Irq(void *ctx);
-
- /**
- * What internal state are we in
- */
- typedef enum {
- STATE_IDLE = 0,
- STATE_RX_RUNNING,
- STATE_TX_RUNNING,
- STATE_CAD
- } RADIO_STATES_T;
-
- // needs to be OR'd onto registers for SPI write
- static const uint8_t m_writeMode = 0x80;
-
- // initialize the chip
- void init();
-
- // Start a transmit event (you should use send() or sendStr()
- // rather than call this function directly.
- RADIO_EVENT_T setTx(int timeout);
-
- void startCAD(); // non-functional/non-tested
-
- // not really used, maybe it should be
- void setMaxPayloadLength(RADIO_MODEM_T modem, uint8_t max);
-
- // Chip Select control (active LOW)
- void csOn()
- {
- m_gpioCS.write(0);
- };
-
- void csOff()
- {
- m_gpioCS.write(1);
- };
-
- private:
- // Thse structs will generate SWIG warnings, as we do not expose
- // this data, they can be ignored.
-
- // stored settings for the FSK modem
- typedef struct
- {
- int8_t Power;
- uint32_t Fdev;
- uint32_t Bandwidth;
- uint32_t BandwidthAfc;
- uint32_t Datarate;
- uint16_t PreambleLen;
- bool FixLen;
- uint8_t PayloadLen;
- bool CrcOn;
- bool IqInverted;
- bool RxContinuous;
- } radioFskSettings_t;
-
- // stored settings for the LoRa modem
- typedef struct
- {
- int8_t Power;
- uint32_t Bandwidth;
- uint32_t Datarate;
- bool LowDatarateOptimize;
- uint8_t Coderate;
- uint16_t PreambleLen;
- bool FixLen;
- uint8_t PayloadLen;
- bool CrcOn;
- bool FreqHopOn;
- uint8_t HopPeriod;
- bool IqInverted;
- bool RxContinuous;
- } radioLoRaSettings_t;
-
- // FSK packet handler state
- typedef struct
- {
- uint8_t PreambleDetected;
- uint8_t SyncWordDetected;
- int8_t RssiValue;
- int32_t AfcValue;
- uint8_t RxGain;
- uint16_t Size;
- uint16_t NbBytes;
- uint8_t FifoThresh;
- uint8_t ChunkSize;
- } radioFskPacketHandler_t;
-
- // LoRa packet handler state
- typedef struct
- {
- int8_t SnrValue;
- int16_t RssiValue;
- uint8_t Size;
- } radioLoRaPacketHandler_t;
-
- // our radio settings
- struct {
- RADIO_MODEM_T modem;
- volatile RADIO_STATES_T state;
- uint32_t channel;
-
- radioFskSettings_t fskSettings;
- volatile radioFskPacketHandler_t fskPacketHandler;
-
- radioLoRaSettings_t loraSettings;
- volatile radioLoRaPacketHandler_t loraPacketHandler;
- } m_settings;
-
- uint8_t lookupFSKBandWidth(uint32_t bw);
-
- // received data (on successfull completion)
- volatile int m_rxRSSI;
- volatile int m_rxSNR;
- volatile int m_rxLen;
- uint8_t m_rxBuffer[FIFO_SIZE];
-
- // for coordinating interrupt access
- pthread_mutex_t m_intrLock;
-
- void lockIntrs() { pthread_mutex_lock(&m_intrLock); };
- void unlockIntrs() { pthread_mutex_unlock(&m_intrLock); };
-
- // current radio event status
- volatile RADIO_EVENT_T m_radioEvent;
-
- // timer support
- struct timeval m_startTime;
- void initClock();
- uint32_t getMillis();
- };
-}
-
-
diff --git a/peripheral/libupm/src/sx6119/CMakeLists.txt b/peripheral/libupm/src/sx6119/CMakeLists.txt
deleted file mode 100644
index 6effe43..0000000
--- a/peripheral/libupm/src/sx6119/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "sx6119")
-set (libdescription "upm grove FM receiver")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/sx6119/javaupm_sx6119.i b/peripheral/libupm/src/sx6119/javaupm_sx6119.i
deleted file mode 100644
index f7e5327..0000000
--- a/peripheral/libupm/src/sx6119/javaupm_sx6119.i
+++ /dev/null
@@ -1,20 +0,0 @@
-%module javaupm_sx6119
-%include "../upm.i"
-
-%{
- #include "sx6119.h"
-%}
-
-%include "sx6119.h"
-
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_sx6119");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/sx6119/jsupm_sx6119.i b/peripheral/libupm/src/sx6119/jsupm_sx6119.i
deleted file mode 100644
index 807008f..0000000
--- a/peripheral/libupm/src/sx6119/jsupm_sx6119.i
+++ /dev/null
@@ -1,9 +0,0 @@
-%module jsupm_sx6119
-%include "../upm.i"
-
-%{
- #include "sx6119.h"
-%}
-
-%include "sx6119.h"
-
diff --git a/peripheral/libupm/src/sx6119/pyupm_sx6119.i b/peripheral/libupm/src/sx6119/pyupm_sx6119.i
deleted file mode 100644
index d98477d..0000000
--- a/peripheral/libupm/src/sx6119/pyupm_sx6119.i
+++ /dev/null
@@ -1,13 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_sx6119
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%{
- #include "sx6119.h"
-%}
-
-%include "sx6119.h"
-
diff --git a/peripheral/libupm/src/sx6119/sx6119.cxx b/peripheral/libupm/src/sx6119/sx6119.cxx
deleted file mode 100644
index caa8d96..0000000
--- a/peripheral/libupm/src/sx6119/sx6119.cxx
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <string>
-#include <stdexcept>
-
-#include "sx6119.h"
-
-using namespace upm;
-using namespace std;
-
-SX6119::SX6119(int powerPin, int seekPin)
-{
- if ( !(m_gpioPower = mraa_gpio_init(powerPin)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_gpio_init(power) failed, invalid pin?");
- return;
- }
-
- mraa_gpio_dir(m_gpioPower, MRAA_GPIO_OUT);
- mraa_gpio_write(m_gpioPower, 1);
-
- if ( !(m_gpioSeek = mraa_gpio_init(seekPin)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_gpio_init(seek) failed, invalid pin?");
- return;
- }
-
- mraa_gpio_dir(m_gpioSeek, MRAA_GPIO_OUT);
- mraa_gpio_write(m_gpioSeek, 1);
-}
-
-SX6119::~SX6119()
-{
- mraa_gpio_close(m_gpioPower);
- mraa_gpio_close(m_gpioSeek);
-}
-
-void SX6119::togglePower()
-{
- // this is just a toggle -- we set LOW for one second and power will
- // be turned on or off depending on the previous condition.
- mraa_gpio_write(m_gpioPower, 0);
- sleep(1);
- mraa_gpio_write(m_gpioPower, 1);
-}
-
-void SX6119::seek()
-{
- // this is just a trigger -- we set LOW for 500ms to seek to the
- // next available station, wrapping around when we reach the end.
- mraa_gpio_write(m_gpioSeek, 0);
- usleep(500000);
- mraa_gpio_write(m_gpioSeek, 1);
-}
diff --git a/peripheral/libupm/src/sx6119/sx6119.h b/peripheral/libupm/src/sx6119/sx6119.h
deleted file mode 100644
index f226883..0000000
--- a/peripheral/libupm/src/sx6119/sx6119.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <iostream>
-
-#include <mraa/gpio.h>
-
-namespace upm {
- /**
- * @brief SX6119-based FM Receiver library
- * @defgroup sx6119 libupm-sx6119
- * @ingroup seeed gpio sound
- */
-
- /**
- * @sensor sx6119
- * @library sx6119
- * @comname Grove FM Receiver
- * @altname SX6119 FM Receiver
- * @type sound
- * @man seeed
- * @con gpio
- *
- * @brief API support for the SX6119-based Grove FM Receiver
- *
- * This class implements support for the SX6119 FM Receiver. There are
- * two digital pins: one that toggles power on/off, and the other that
- * does a seek to the next station.
- *
- * @image html sx6119.jpg
- * @snippet sx6119.cxx Interesting
- */
- class SX6119 {
- public:
-
- /**
- * SX6119 constructor
- *
- * @param powerPin Pin to use for recording
- * @param seekPin Pin to use for seeking to the next station
- */
- SX6119(int powerPin, int seekPin);
-
- /**
- * SX6119 destructor
- */
- ~SX6119();
-
- /**
- * Toggles the device power on or off
- *
- */
- void togglePower();
-
- /**
- * Seeks to the next station
- *
- */
- void seek();
-
- private:
- mraa_gpio_context m_gpioPower;
- mraa_gpio_context m_gpioSeek;
- };
-}
-
-
diff --git a/peripheral/libupm/src/t3311/CMakeLists.txt b/peripheral/libupm/src/t3311/CMakeLists.txt
deleted file mode 100644
index 89bc6b9..0000000
--- a/peripheral/libupm/src/t3311/CMakeLists.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-set (libname "t3311")
-set (libdescription "upm module for the Comet System T3311")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-
-pkg_search_module(MODBUS libmodbus)
-if (MODBUS_FOUND)
- set (reqlibname "libmodbus")
- include_directories(${MODBUS_INCLUDE_DIRS})
- upm_module_init()
- add_dependencies(${libname} ${MODBUS_LIBRARIES})
- target_link_libraries(${libname} ${MODBUS_LIBRARIES})
- if (BUILDSWIG)
- if (BUILDSWIGNODE)
- swig_link_libraries (jsupm_${libname} ${MODBUS_LIBRARIES} ${MRAA_LIBRARIES} ${NODE_LIBRARIES})
- endif()
- if (BUILDSWIGPYTHON)
- swig_link_libraries (pyupm_${libname} ${MODBUS_LIBRARIES} ${PYTHON_LIBRARIES} ${MRAA_LIBRARIES})
- endif()
- if (BUILDSWIGJAVA)
- swig_link_libraries (javaupm_${libname} ${MODBUS_LIBRARIES} ${MRAAJAVA_LDFLAGS} ${JAVA_LDFLAGS})
- endif()
- endif()
-endif ()
diff --git a/peripheral/libupm/src/t3311/javaupm_t3311.i b/peripheral/libupm/src/t3311/javaupm_t3311.i
deleted file mode 100644
index a383b49..0000000
--- a/peripheral/libupm/src/t3311/javaupm_t3311.i
+++ /dev/null
@@ -1,23 +0,0 @@
-%module javaupm_t3311
-%include "../upm.i"
-%include "typemaps.i"
-%include "cpointer.i"
-%include "arrays_java.i";
-%include "../java_buffer.i"
-
-%{
- #include "t3311.h"
-%}
-
-%include "t3311.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_t3311");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%}
diff --git a/peripheral/libupm/src/t3311/jsupm_t3311.i b/peripheral/libupm/src/t3311/jsupm_t3311.i
deleted file mode 100644
index 4b07290..0000000
--- a/peripheral/libupm/src/t3311/jsupm_t3311.i
+++ /dev/null
@@ -1,11 +0,0 @@
-%module jsupm_t3311
-%include "../upm.i"
-%include "stdint.i"
-%include "cpointer.i"
-
-%pointer_functions(float, floatp);
-
-%include "t3311.h"
-%{
- #include "t3311.h"
-%}
diff --git a/peripheral/libupm/src/t3311/pyupm_t3311.i b/peripheral/libupm/src/t3311/pyupm_t3311.i
deleted file mode 100644
index 51f706b..0000000
--- a/peripheral/libupm/src/t3311/pyupm_t3311.i
+++ /dev/null
@@ -1,15 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_t3311
-%include "../upm.i"
-%include "stdint.i"
-%include "cpointer.i"
-
-%feature("autodoc", "3");
-
-%pointer_functions(float, floatp);
-
-%include "t3311.h"
-%{
- #include "t3311.h"
-%}
diff --git a/peripheral/libupm/src/t3311/t3311.cxx b/peripheral/libupm/src/t3311/t3311.cxx
deleted file mode 100644
index 0111556..0000000
--- a/peripheral/libupm/src/t3311/t3311.cxx
+++ /dev/null
@@ -1,309 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2016 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <stdexcept>
-#include <string>
-#include <sstream>
-#include <pthread.h>
-
-#include "t3311.h"
-
-using namespace upm;
-using namespace std;
-
-// conversion from fahrenheit to celcius and back
-
-static float f2c(float f)
-{
- return ((f - 32.0) / (9.0 / 5.0));
-}
-
-static float c2f(float c)
-{
- return (c * (9.0 / 5.0) + 32.0);
-}
-
-// conversion from 1-byte BCD to decimal
-static uint8_t bcd2dec(uint8_t bcd)
-{
- return (bcd / 16 * 10) + (bcd % 16);
-}
-
-T3311::T3311(std::string device, int address, int baud, int bits, char parity,
- int stopBits) :
- m_mbContext(0)
-{
- // check some of the parameters
- if (!(bits == 7 || bits == 8))
- {
- throw std::out_of_range(std::string(__FUNCTION__) +
- ": bits must be 7 or 8");
- }
-
- if (!(parity == 'N' || parity == 'E' || parity == 'O'))
- {
- throw std::out_of_range(std::string(__FUNCTION__) +
- ": parity must be 'N', 'O', or 'E'");
- }
-
- if (!(stopBits == 1 || stopBits == 2))
- {
- throw std::out_of_range(std::string(__FUNCTION__) +
- ": stopBits must be 1 or 2");
- }
-
- m_temperature = 0.0;
- m_humidity = 0.0;
- m_computedValue = 0.0;
- m_dewPointTemperature = 0.0;
- m_absoluteHumidity = 0.0;
- m_specificHumidity = 0.0;
- m_mixingRatio = 0.0;
- m_specificEnthalpy = 0.0;
-
- // addresses are only 8bits wide
- address &= 0xff;
-
- // now, open/init the device and modbus context
-
- if (!(m_mbContext = modbus_new_rtu(device.c_str(), baud, parity, bits,
- stopBits)))
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": modbus_new_rtu() failed");
- }
-
- // set the slave address of the device we want to talk to
- if (modbus_set_slave(m_mbContext, address))
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": modbus_set_slave() failed");
- }
-
- // set the serial mode
- modbus_rtu_set_serial_mode(m_mbContext, MODBUS_RTU_RS232);
-
- // now connect..
- if (modbus_connect(m_mbContext))
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": modbus_connect() failed");
- }
-
- // This is a bit of a hack. The device uses bus power, which isn't
- // provided unless the device has been opened and accessed. As a
- // result, register reads will usually fail the first time the
- // device is accessed after a power cycle. Here, we read the
- // temperature value (which will most likely fail), then sleep,
- // allowing the sensor to "boot". The datasheet says it takes at
- // about 2 seconds to boot, we will wait for 5.
- uint16_t tmp;
- modbus_read_input_registers(m_mbContext, REG_TEMPERATURE, 1, &tmp);
-
- // sleep for 5 seconds to give time for device to powerup and boot
- sleep(5);
-
- // turn off debugging
- setDebug(false);
-
- // now read the UNIT_SETTING reg to see what units we are getting
- // our temperature data in.
- tmp = readInputReg(REG_UNIT_SETTINGS);
- if (tmp & 0x0001)
- m_isCelcius = false;
- else
- m_isCelcius = true;
-
- // read in the the FW_LO register (BCD encoded) and convert
- tmp = readInputReg(REG_FW_LO);
-
- // HI byte (major)
- m_fwRevHi = (tmp >> 8) & 0xff;
- m_fwRevHi = bcd2dec(m_fwRevHi);
-
- // LO byte (minor)
- m_fwRevLo = (tmp & 0xff);
- m_fwRevLo = bcd2dec(m_fwRevLo);
-
- if (m_fwRevHi >= 2 && m_fwRevLo >= 44)
- m_isExtendedDataAvailable = true;
- else
- m_isExtendedDataAvailable = false;
-
- // now get the serial number (BCD encoded 4-byte value, which we
- // will pack into a string)
- stringstream preformat;
- uint8_t b;
- // LO (but really HI)
- tmp = readInputReg(REG_SERIAL_LO);
- b = bcd2dec((tmp & 0xff00) >> 8);
- preformat << int(b);
-
- b = bcd2dec(tmp & 0x00ff);
- preformat << int(b);
-
- // HI (but really LO)
- tmp = readInputReg(REG_SERIAL_HI);
-
- b = bcd2dec((tmp & 0xff00) >> 8);
- preformat << int(b);
- b = bcd2dec(tmp & 0x00ff);
- preformat << int(b);
-
- m_serialNumber = preformat.str();
-}
-
-T3311::~T3311()
-{
- if (m_mbContext)
- {
- modbus_close(m_mbContext);
- modbus_free(m_mbContext);
- }
-}
-
-uint16_t T3311::readInputReg(int reg)
-{
- uint16_t val;
-
- if (modbus_read_input_registers(m_mbContext, reg, 1, &val) <= 0)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": modbus_read_input_registers() failed");
- }
-
- return val;
-}
-
-int T3311::readInputRegs(int reg, int len, uint16_t *buf)
-{
- int rv;
-
- if ((rv = modbus_read_input_registers(m_mbContext, reg, len, buf)) < 0)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": modbus_read_input_registers() failed");
- }
-
- return rv;
-}
-
-void T3311::update()
-{
- static const int dataLen = 9;
- uint16_t data[dataLen];
-
- // we read the 9 registers starting at the temperature
- if (readInputRegs(REG_TEMPERATURE, dataLen, data) != dataLen)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": read less than the expected 9 registers");
- }
-
- // temperature first, we always store as C
- float tmpF = float((int16_t)data[0]) / 10.0;
- if (m_isCelcius)
- m_temperature = tmpF;
- else
- m_temperature = f2c(tmpF);
-
- m_humidity = float((int16_t)data[1]) / 10.0;
- m_computedValue = float((int16_t)data[2]) / 10.0;
-
- // skip data[3], (pressure) as this device does not support it
-
- // if extended info is supported, grab those too
- if (extendedDataAvailable())
- {
- // we always store temps in C
- tmpF = float((int16_t)data[4]) / 10.0;
- if (m_isCelcius)
- m_dewPointTemperature = tmpF;
- else
- m_dewPointTemperature = f2c(tmpF);
-
- m_absoluteHumidity = float((int16_t)data[5]) / 10.0;
- m_specificHumidity = float((int16_t)data[6]) / 10.0;
- m_mixingRatio = float((int16_t)data[7]) / 10.0;
- m_specificEnthalpy = float((int16_t)data[8]) / 10.0;
- }
-}
-
-float T3311::getTemperature(bool fahrenheit)
-{
- if (fahrenheit)
- return c2f(m_temperature);
- else
- return m_temperature;
-}
-
-float T3311::getHumidity()
-{
- return m_humidity;
-}
-
-float T3311::getComputedValue()
-{
- return m_computedValue;
-}
-
-float T3311::getDewPointTemperature(bool fahrenheit)
-{
- if (fahrenheit)
- return c2f(m_dewPointTemperature);
- else
- return m_dewPointTemperature;
-}
-
-float T3311::getAbsoluteHumidity()
-{
- return m_absoluteHumidity;
-}
-
-float T3311::getSpecificHumidity()
-{
- return m_specificHumidity;
-}
-
-float T3311::getMixingRatio()
-{
- return m_mixingRatio;
-}
-
-float T3311::getSpecificEnthalpy()
-{
- return m_specificEnthalpy;
-}
-
-void T3311::setDebug(bool enable)
-{
- m_debugging = enable;
-
- if (enable)
- modbus_set_debug(m_mbContext, 1);
- else
- modbus_set_debug(m_mbContext, 0);
-}
diff --git a/peripheral/libupm/src/t3311/t3311.h b/peripheral/libupm/src/t3311/t3311.h
deleted file mode 100644
index f84dc95..0000000
--- a/peripheral/libupm/src/t3311/t3311.h
+++ /dev/null
@@ -1,310 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2016 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-
-#include <modbus/modbus.h>
-
-namespace upm {
-
- /**
- * @brief T3311 Temperature and Humidity Sensor
- * @defgroup t3311 libupm-t3311
- * @ingroup uart temp
- */
-
- /**
- * @library t3311
- * @sensor t3311
- * @comname UPM API for the T3311 Temperature and Humidity Sensor
- * @type temp
- * @man comet
- * @con uart
- * @web http://www.cometsystem.com/products/reg-T3311
- *
- * @brief UPM API for the T3311 MODBUS Temperature and Humidity Sensor
- *
- * This module implements support for the Comet System T3311
- * Temperature and Humidity transmitter. It uses MODBUS over an
- * RS232 serial port. You must have libmodbus v3.1.2 (or greater)
- * installed to compile and use this driver.
- *
- * This module was developed using libmodbus 3.1.2, and T3311
- * Firmware revison 2.66 connected via a Prolific RS232 Serial to
- * USB adaptor. You cannot use the built in TTL UART pins for
- * accessing this device -- you must use a full serial RS232
- * interface connected via USB.
- *
- * @snippet t3311.cxx Interesting
- */
-
- class T3311 {
- public:
-
- // MODBUS input registers
- typedef enum {
- REG_TEMPERATURE = 0x0030,
- REG_HUMIDITY = 0x0031,
-
- // This value is configured in the device itself. By default,
- // it represents the Dew Point Temperature. Use the
- // configuration utility from Comet to adjust the configuration.
- REG_COMPUTED = 0x0032,
-
- // available in devices with FW > 2.44
- REG_DEW_POINT = 0x0034,
- REG_ABS_HUMIDITY = 0x0035,
- REG_SPECIFIC_HUMIDITY = 0x0036,
- REG_MIXING_RATIO = 0x0037,
- REG_SPECIFIC_ENTHALPY = 0x0038,
-
- // 32 bit serial number. These appear to be reversed when
- // comparing against the TSensor config utility, so the
- // datasheet is probably wrong.
- REG_SERIAL_HI = 0x1034,
- REG_SERIAL_LO = 0x1035,
-
- // this is 'somewhat' documented (middle of page 15 in the
- // Advantech-ADAM standard section) in the "Description of
- // communications protocols of TXXXX series" document. We use
- // it to simply detect whether the device is configured for
- // Celcius or Fahrenheit data and compensate internally.
-
- REG_UNIT_SETTINGS = 0x203F,
-
- // firmware revision, BCD byte encoded. We only care about the
- // LO word - the HI word just contains the manufacturing date.
- REG_FW_HI = 0x3000,
- REG_FW_LO = 0x3001
- } REGS_T;
-
-
- /**
- * T3311 constructor
- *
- * @param device Path to the serial device
- * @param address The MODBUS slave address
- * @param baud The baudrate of the device. Default: 9600
- * @param bits The number of bits per byte. Default: 8
- * @param parity The parity of the connection, 'N' for None, 'E'
- * for Even, 'O' for Odd. Default: 'N'
- * @param stopBits The number of stop bits. Default: 2
- */
- T3311(std::string device, int address, int baud=9600, int bits=8,
- char parity='N', int stopBits=2);
-
- /**
- * T3311 Destructor
- */
- ~T3311();
-
- /**
- * Indicate whether the attached sensor supports extended Computed
- * Data registers. Firmware versions at, or higher than 2.44
- * provide this data.
- *
- * @return true if Extended Data is available, false otherwise
- */
- bool extendedDataAvailable()
- {
- return m_isExtendedDataAvailable;
- };
-
- /**
- * Read current values from the sensor and update internal stored
- * values. This method must be called prior to querying any
- * values, such as temperature or humidity.
- */
- void update();
-
- /**
- * Get the current temperature. update() must have been called
- * prior to calling this method.
- *
- * @param fahrenheit true to return the temperature in degrees
- * fahrenheit, false to return the temperature in degrees celcius.
- * The default is false (degrees Celcius).
- * @return The last temperature reading in Celcius or Fahrenheit
- */
- float getTemperature(bool fahrenheit=false);
-
- /**
- * Get the current relative humidity. update() must have been called
- * prior to calling this method.
- *
- * @return The last humidity reading
- */
- float getHumidity();
-
- /**
- * Get the current computed value. update() must have been
- * called prior to calling this method. This value is configured
- * via the configuration of the sensor using the sensors
- * configuration utility, and can represent several different
- * computed values. The default value from the factory is the
- * current Dew Point Temperature.
- *
- * Since the actual value configured is unknown (and unknowable)
- * to this driver, the units represented depend on how you have
- * configured the device. This function simply returns the value
- * without any conversion or interpretation, other than the
- * default scaling.
- *
- * @return The last Computed Value
- */
- float getComputedValue();
-
- /**
- * Get the current dew point temperature. update() must have been
- * called prior to calling this method. This information is only
- * available if the sensor supports Extended Data (ie:
- * extendedDataAvailable() returns true).
- *
- * @param fahrenheit true to return the temperature in degrees
- * fahrenheit, false to return the temperature in degrees celcius.
- * The default is false (degrees Celcius).
- * @return The last dew point temperature reading in Celcius or
- * Fahrenheit
- */
- float getDewPointTemperature(bool fahrenheit=false);
-
- /**
- * Get the current absolute humidity. update() must have been
- * called prior to calling this method. This information is only
- * available if the sensor supports Extended Data (ie:
- * extendedDataAvailable() returns true).
- *
- * @return The last absolute humidity reading in g/m3 (grams per
- * cubic meter).
- */
- float getAbsoluteHumidity();
-
- /**
- * Get the current specific humidity. update() must have been
- * called prior to calling this method. This information is only
- * available if the sensor supports Extended Data (ie:
- * extendedDataAvailable() returns true).
- *
- * @return The last specific humidity reading in g/kg (grams per
- * kilogram).
- */
- float getSpecificHumidity();
-
- /**
- * Get the current mixing ratio. update() must have been
- * called prior to calling this method. This information is only
- * available if the sensor supports Extended Data (ie:
- * extendedDataAvailable() returns true).
- *
- * @return The last mixing ratio reading in g/kg (grams per
- * kilogram).
- */
- float getMixingRatio();
-
- /**
- * Get the current specific enthalopy, a measure of energy
- * density. update() must have been called prior to calling this
- * method. This information is only available if the sensor
- * supports Extended Data (ie: extendedDataAvailable() returns
- * true).
- *
- * @return The last specific enthalopy reading in kJ/kg
- * (kilojoules per kilogram).
- */
- float getSpecificEnthalpy();
-
- /**
- * Get the serial number of the sensor.
- *
- * @return The serial number
- */
- std::string getSerialNumber()
- {
- return m_serialNumber;
- };
-
- /**
- * Get the firmware revision major number.
- *
- * @return The firmware revsion major number.
- */
- int getFirmwareMajor()
- {
- return m_fwRevHi;
- };
-
- /**
- * Get the firmware revision minor number.
- *
- * @return The firmware revsion minor number.
- */
- int getFirmwareMinor()
- {
- return m_fwRevLo;
- };
-
- /**
- * Enable or disable debugging output. This primarily enables and
- * disables libmodbus debugging output.
- *
- * @param enable true to enable debugging, false otherwise
- */
- void setDebug(bool enable);
-
- protected:
- uint16_t readInputReg(int reg);
- int readInputRegs(int reg, int len, uint16_t *buf);
-
- // MODBUS context
- modbus_t *m_mbContext;
-
- // is the device reporting in C or F?
- bool m_isCelcius;
-
- // Is the device FW > than 2.44?
- bool m_isExtendedDataAvailable;
-
- int m_fwRevHi;
- int m_fwRevLo;
-
- std::string m_serialNumber;
-
- private:
- bool m_debugging;
-
- // data
- float m_temperature;
- float m_humidity; // relative
- float m_computedValue;
-
- // with FW versions > 2.44, these other computed values are
- // available.
- float m_dewPointTemperature;
- float m_absoluteHumidity;
- float m_specificHumidity;
- float m_mixingRatio;
- float m_specificEnthalpy;
- };
-}
diff --git a/peripheral/libupm/src/ta12200/CMakeLists.txt b/peripheral/libupm/src/ta12200/CMakeLists.txt
deleted file mode 100644
index 0f3f0ba..0000000
--- a/peripheral/libupm/src/ta12200/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "ta12200")
-set (libdescription "upm ta12200 current transformer module")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/ta12200/javaupm_ta12200.i b/peripheral/libupm/src/ta12200/javaupm_ta12200.i
deleted file mode 100644
index 3feb468..0000000
--- a/peripheral/libupm/src/ta12200/javaupm_ta12200.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_ta12200
-%include "../upm.i"
-
-%{
- #include "ta12200.h"
-%}
-
-%include "ta12200.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_ta12200");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/ta12200/jsupm_ta12200.i b/peripheral/libupm/src/ta12200/jsupm_ta12200.i
deleted file mode 100644
index 519f1ec..0000000
--- a/peripheral/libupm/src/ta12200/jsupm_ta12200.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_ta12200
-%include "../upm.i"
-
-%{
- #include "ta12200.h"
-%}
-
-%include "ta12200.h"
diff --git a/peripheral/libupm/src/ta12200/pyupm_ta12200.i b/peripheral/libupm/src/ta12200/pyupm_ta12200.i
deleted file mode 100644
index d1838fc..0000000
--- a/peripheral/libupm/src/ta12200/pyupm_ta12200.i
+++ /dev/null
@@ -1,11 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_ta12200
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "ta12200.h"
-%{
- #include "ta12200.h"
-%}
diff --git a/peripheral/libupm/src/ta12200/ta12200.cxx b/peripheral/libupm/src/ta12200/ta12200.cxx
deleted file mode 100644
index f9d3cb0..0000000
--- a/peripheral/libupm/src/ta12200/ta12200.cxx
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <string>
-#include <stdexcept>
-
-#include "ta12200.h"
-
-using namespace upm;
-using namespace std;
-
-TA12200::TA12200(int pin)
-{
- initClock();
-
- if ( !(m_aio = mraa_aio_init(pin)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_aio_init() failed, invalid pin?");
- return;
- }
-}
-
-TA12200::~TA12200()
-{
- mraa_aio_close(m_aio);
-}
-
-void TA12200::initClock()
-{
- gettimeofday(&m_startTime, NULL);
-}
-
-uint32_t TA12200::getMillis()
-{
- struct timeval elapsed, now;
- uint32_t elapse;
-
- // get current time
- gettimeofday(&now, NULL);
-
- // compute the delta since m_startTime
- if( (elapsed.tv_usec = now.tv_usec - m_startTime.tv_usec) < 0 )
- {
- elapsed.tv_usec += 1000000;
- elapsed.tv_sec = now.tv_sec - m_startTime.tv_sec - 1;
- }
- else
- {
- elapsed.tv_sec = now.tv_sec - m_startTime.tv_sec;
- }
-
- elapse = (uint32_t)((elapsed.tv_sec * 1000) + (elapsed.tv_usec / 1000));
-
- // never return 0
- if (elapse == 0)
- elapse = 1;
-
- return elapse;
-}
-
-
-unsigned int TA12200::highestValue()
-{
- unsigned int hiVal = 0;
- unsigned int val;
- uint32_t start = getMillis();
-
- // 1 second
- while (getMillis() < (start + 1000))
- {
- val = mraa_aio_read(m_aio);
- if (val > hiVal)
- hiVal = val;
- }
-
- return hiVal;
-}
-
-float TA12200::milliAmps(unsigned int val, int res)
-{
- float ampCurrent;
- float effectiveVal;
-
- // From grove wiki page:
- // minimum_current=1/1024*5/800*2000000/1.414=8.6(mA)
- // Only for sinusoidal alternating current
- //ampCurrent = float(val) / float(res) * 5.0 / 800.0 * 2000000.0;
- ampCurrent = float(val) / float(res) * 12500.0;
- effectiveVal = ampCurrent/1.414;
- return (effectiveVal);
-}
-
diff --git a/peripheral/libupm/src/ta12200/ta12200.h b/peripheral/libupm/src/ta12200/ta12200.h
deleted file mode 100644
index b3561d4..0000000
--- a/peripheral/libupm/src/ta12200/ta12200.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include <iostream>
-#include <stdint.h>
-#include <sys/time.h>
-#include <mraa/aio.h>
-
-// default ADC resolution.
-#define TA12200_ADC_RES 1024
-
-namespace upm {
-/**
- * @brief TA12-200 Current Transformer library
- * @defgroup ta12200 libupm-ta12200
- * @ingroup seeed analog electric
- */
-/**
- * @library ta12200
- * @sensor ta12200
- * @comname TA12-200 Current Transformer
- * @altname Grove Electricity Sensor
- * @type electric
- * @man seeed
- * @web http://www.seeedstudio.com/wiki/Grove_-_Electricity_Sensor
- * @con analog
- *
- * @brief API for the TA12-200 Current Transformer
- *
- * UPM module for the TA12-200 current transformer found,
- * for instance, in the Grove Electricity Sensor.
- * This module can measure AC moving through a wire at up
- * to 5 A.
- *
- * @image html ta12200.jpg
- * @snippet ta12200.cxx Interesting
- */
- class TA12200 {
- public:
- /**
- * TA12200 constructor
- *
- * @param pin Analog pin to use
- */
- TA12200(int pin);
-
- /**
- * TA12200 destructor
- */
- ~TA12200();
-
- /**
- * Returns the number of milliseconds elapsed since initClock()
- * was last called.
- *
- * @return Elapsed milliseconds
- */
- uint32_t getMillis();
-
- /**
- * Resets the clock
- *
- */
- void initClock();
-
- /**
- * Gets the conversion value from the sensor
- *
- * @return Highest value obtained over 1 second of measuring
- */
- unsigned int highestValue();
-
- /**
- * Computes the measured voltage
- *
- * @param val Value measured by highestValue()
- * @param res ADC resolution
- *
- * @return Measured current in mA
- */
- float milliAmps(unsigned int val, int res=TA12200_ADC_RES);
-
- private:
- struct timeval m_startTime;
- mraa_aio_context m_aio;
- };
-}
-
-
diff --git a/peripheral/libupm/src/tcs3414cs/.DS_Store b/peripheral/libupm/src/tcs3414cs/.DS_Store
deleted file mode 100644
index b152328..0000000
--- a/peripheral/libupm/src/tcs3414cs/.DS_Store
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/src/tcs3414cs/._.DS_Store b/peripheral/libupm/src/tcs3414cs/._.DS_Store
deleted file mode 100644
index d4698e3..0000000
--- a/peripheral/libupm/src/tcs3414cs/._.DS_Store
+++ /dev/null
Binary files differ
diff --git a/peripheral/libupm/src/tcs3414cs/CMakeLists.txt b/peripheral/libupm/src/tcs3414cs/CMakeLists.txt
deleted file mode 100644
index fbdebd9..0000000
--- a/peripheral/libupm/src/tcs3414cs/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "tcs3414cs")
-set (libdescription "I2C Color sensor")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/tcs3414cs/javaupm_tcs3414cs.i b/peripheral/libupm/src/tcs3414cs/javaupm_tcs3414cs.i
deleted file mode 100644
index 61724e1..0000000
--- a/peripheral/libupm/src/tcs3414cs/javaupm_tcs3414cs.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_tcs3414cs
-%include "../upm.i"
-
-%{
- #include "tcs3414cs.h"
-%}
-
-%include "tcs3414cs.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_tcs3414cs");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/tcs3414cs/jsupm_tcs3414cs.i b/peripheral/libupm/src/tcs3414cs/jsupm_tcs3414cs.i
deleted file mode 100644
index 58fa1bf..0000000
--- a/peripheral/libupm/src/tcs3414cs/jsupm_tcs3414cs.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_tcs3414cs
-%include "../upm.i"
-
-%{
- #include "tcs3414cs.h"
-%}
-
-%include "tcs3414cs.h"
diff --git a/peripheral/libupm/src/tcs3414cs/pyupm_tcs3414cs.i b/peripheral/libupm/src/tcs3414cs/pyupm_tcs3414cs.i
deleted file mode 100644
index 243c05c..0000000
--- a/peripheral/libupm/src/tcs3414cs/pyupm_tcs3414cs.i
+++ /dev/null
@@ -1,11 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_tcs3414cs
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "tcs3414cs.h"
-%{
- #include "tcs3414cs.h"
-%}
diff --git a/peripheral/libupm/src/tcs3414cs/tcs3414cs.cxx b/peripheral/libupm/src/tcs3414cs/tcs3414cs.cxx
deleted file mode 100644
index 28defac..0000000
--- a/peripheral/libupm/src/tcs3414cs/tcs3414cs.cxx
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Credits to Seeed Studeo.
- * Based on Seeed Studeo code example,
- * http://www.seeedstudio.com/wiki/index.php?title=Twig_-_I2C_Color_Sensor_v0.9b.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdexcept>
-
-#include "tcs3414cs.h"
-
-using namespace upm;
-
-TCS3414CS::TCS3414CS () : m_i2Ctx(0) {
- m_name = "TCS3414CS";
-
- mraa::Result ret = m_i2Ctx.address(ADDR);
- if (ret != mraa::SUCCESS) {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": m_i2Ctx.address() failed");
- }
-
- // Set timing register
- i2cWriteReg (REG_TIMING, INTEG_MODE_FREE);
- usleep (100000);
-
- // Set interrupt source register
- i2cWriteReg (REG_INT_SOURCE, INT_SOURCE_GREEN);
- usleep (100000);
-
- // Set interrupt control register
- i2cWriteReg (REG_INT, INTR_LEVEL | INTR_PERSIST_EVERY);
- usleep (100000);
-
- // Set gain
- i2cWriteReg (REG_GAIN, GAIN_1 | PRESCALER_4);
- usleep (100000);
-
- // Enable ADC
- i2cWriteReg (REG_CTL, CTL_DAT_INIITIATE);
- usleep (100000);
-}
-
-void
-TCS3414CS::readRGB (tcs3414sc_rgb_t * rgb) {
- uint8_t buffer[8];
-
- // We need 7 bytes of data.
- if (i2cReadReg_N (REG_BLOCK_READ, 8, buffer) > 7) {
- rgb->g = buffer[1] * 256 + buffer[0];
- rgb->r = buffer[3] * 256 + buffer[2];
- rgb->b = buffer[5] * 256 + buffer[4];
- rgb->clr = buffer[7] * 256 + buffer[6];
- }
-}
-
-void
-TCS3414CS::clearInterrupt () {
- mraa::Result error = mraa::SUCCESS;
-
- error = m_i2Ctx.address (ADDR);
- error = m_i2Ctx.writeByte (CLR_INT);
-
- if (error != mraa::SUCCESS) {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": Couldn't clear interrupt");
- }
-}
-
-/*
- * **************
- * private area
- * **************
- */
-uint16_t
-TCS3414CS::i2cReadReg_N (int reg, unsigned int len, uint8_t * buffer) {
- int readByte = 0;
-
- m_i2Ctx.address(ADDR);
- m_i2Ctx.writeByte(reg);
-
- m_i2Ctx.address(ADDR);
- readByte = m_i2Ctx.read(buffer, len);
- return readByte;
-}
-
-mraa::Result
-TCS3414CS::i2cWriteReg_N (uint8_t reg, unsigned int len, uint8_t * buffer) {
- mraa::Result error = mraa::SUCCESS;
-
- error = m_i2Ctx.address (ADDR);
- error = m_i2Ctx.writeByte (reg);
- error = m_i2Ctx.write (buffer, len);
-
- return error;
-}
-
-mraa::Result
-TCS3414CS::i2cWriteReg (uint8_t reg, uint8_t data) {
- mraa::Result error = mraa::SUCCESS;
-
- error = m_i2Ctx.address (ADDR);
- error = m_i2Ctx.writeByte (reg);
- error = m_i2Ctx.writeByte (data);
-
- return error;
-}
diff --git a/peripheral/libupm/src/tcs3414cs/tcs3414cs.h b/peripheral/libupm/src/tcs3414cs/tcs3414cs.h
deleted file mode 100644
index d944912..0000000
--- a/peripheral/libupm/src/tcs3414cs/tcs3414cs.h
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Credits to Seeed Studeo.
- * Based on Seeed Studeo code example,
- * http://www.seeedstudio.com/wiki/index.php?title=Twig_-_I2C_Color_Sensor_v0.9b.
- *
- * 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 <string>
-#include <mraa/i2c.hpp>
-
-#define ADDR 0x39 // device address
-
-#define REG_CTL 0x80
-#define REG_TIMING 0x81
-#define REG_INT 0x82
-#define REG_INT_SOURCE 0x83
-#define REG_ID 0x84
-#define REG_GAIN 0x87
-#define REG_LOW_THRESH_LOW_BYTE 0x88
-#define REG_LOW_THRESH_HIGH_BYTE 0x89
-#define REG_HIGH_THRESH_LOW_BYTE 0x8A
-#define REG_HIGH_THRESH_HIGH_BYTE 0x8B
-#define REG_BLOCK_READ 0xCF
-#define REG_GREEN_LOW 0xD0
-#define REG_GREEN_HIGH 0xD1
-#define REG_RED_LOW 0xD2
-#define REG_RED_HIGH 0xD3
-#define REG_BLUE_LOW 0xD4
-#define REG_BLUE_HIGH 0xD5
-#define REG_CLEAR_LOW 0xD6
-#define REG_CLEAR_HIGH 0xD7
-#define CTL_DAT_INIITIATE 0x03
-#define CLR_INT 0xE0
-
-/* Timing Register */
-#define SYNC_EDGE 0x40
-#define INTEG_MODE_FREE 0x00
-#define INTEG_MODE_MANUAL 0x10
-#define INTEG_MODE_SYN_SINGLE 0x20
-#define INTEG_MODE_SYN_MULTI 0x30
-
-#define INTEG_PARAM_PULSE_COUNT1 0x00
-#define INTEG_PARAM_PULSE_COUNT2 0x01
-#define INTEG_PARAM_PULSE_COUNT4 0x02
-#define INTEG_PARAM_PULSE_COUNT8 0x03
-
-/* Interrupt Control Register */
-#define INTR_STOP 40
-#define INTR_DISABLE 0x00
-#define INTR_LEVEL 0x10
-#define INTR_PERSIST_EVERY 0x00
-#define INTR_PERSIST_SINGLE 0x01
-
-/* Interrupt Souce Register */
-#define INT_SOURCE_GREEN 0x00
-#define INT_SOURCE_RED 0x01
-#define INT_SOURCE_BLUE 0x10
-#define INT_SOURCE_CLEAR 0x03
-
-/* Gain Register */
-#define GAIN_1 0x00
-#define GAIN_4 0x10
-#define GAIN_16 0x20
-#define GANI_64 0x30
-#define PRESCALER_1 0x00
-#define PRESCALER_2 0x01
-#define PRESCALER_4 0x02
-#define PRESCALER_8 0x03
-#define PRESCALER_16 0x04
-#define PRESCALER_32 0x05
-#define PRESCALER_64 0x06
-
-#define HIGH 1
-#define LOW 0
-
-namespace upm {
-
-typedef struct {
- uint16_t r;
- uint16_t g;
- uint16_t b;
- uint16_t clr;
-} tcs3414sc_rgb_t;
-
-/**
- * @brief TCS3414CS Color Sensor library
- * @defgroup tcs3414cs libupm-tcs3414cs
- * @ingroup seeed i2c color
- */
-/**
- * @library tcs3414cs
- * @sensor tcs3414cs
- * @comname TCS3414CS Color Sensor
- * @altname Grove Color Sensor
- * @type color
- * @man seeed
- * @web http://www.seeedstudio.com/wiki/Grove_-_I2C_Color_Sensor
- * @con i2c
- *
- * @brief API for the TCS3414CS Color Sensor
- *
- * This module defines the TCS3414CS interface for the color sensor
- *
- * @image html tcs3414cs.jpg
- * @snippet tcs3414cs.cxx Interesting
- */
-class TCS3414CS {
- public:
- /**
- * Instantiates a TCS3414CS object
- *
- * @param bus Number of the used bus
- */
- TCS3414CS ();
-
- /**
- * Gets the RGB value from the sensor.
- *
- * @param rgb Color values
- */
- void readRGB (tcs3414sc_rgb_t * rgb);
-
- /**
- * Clears interrupts.
- */
- void clearInterrupt ();
-
- /**
- * Returns the name of the component
- */
- std::string name()
- {
- return m_name;
- }
- private:
- std::string m_name;
- mraa::I2c m_i2Ctx;
-
- uint16_t i2cReadReg_N (int reg, unsigned int len, uint8_t * buffer);
- mraa::Result i2cWriteReg_N (uint8_t reg, unsigned int len, uint8_t * buffer);
- mraa::Result i2cWriteReg (uint8_t reg, uint8_t data);
-};
-
-}
diff --git a/peripheral/libupm/src/th02/CMakeLists.txt b/peripheral/libupm/src/th02/CMakeLists.txt
deleted file mode 100644
index 94426f4..0000000
--- a/peripheral/libupm/src/th02/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "th02")
-set (libdescription "Temperature and Humidity Sensor Pro")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/th02/javaupm_th02.i b/peripheral/libupm/src/th02/javaupm_th02.i
deleted file mode 100644
index d16ae4f..0000000
--- a/peripheral/libupm/src/th02/javaupm_th02.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_th02
-%include "../upm.i"
-
-%{
- #include "th02.h"
-%}
-
-%include "th02.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_th02");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/th02/jsupm_th02.i b/peripheral/libupm/src/th02/jsupm_th02.i
deleted file mode 100644
index dcf48cf..0000000
--- a/peripheral/libupm/src/th02/jsupm_th02.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_th02
-%include "../upm.i"
-
-%{
- #include "th02.h"
-%}
-
-%include "th02.h"
diff --git a/peripheral/libupm/src/th02/pyupm_th02.i b/peripheral/libupm/src/th02/pyupm_th02.i
deleted file mode 100644
index b280c7d..0000000
--- a/peripheral/libupm/src/th02/pyupm_th02.i
+++ /dev/null
@@ -1,11 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_th02
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "th02.h"
-%{
- #include "th02.h"
-%}
diff --git a/peripheral/libupm/src/th02/th02.cxx b/peripheral/libupm/src/th02/th02.cxx
deleted file mode 100644
index ae7230b..0000000
--- a/peripheral/libupm/src/th02/th02.cxx
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Contributions: Jon Trulson <jtlulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Credits to Seeed Studeo.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdexcept>
-
-#include "th02.h"
-
-using namespace std;
-using namespace upm;
-
-TH02::TH02 (int bus, uint8_t addr) : m_i2c(bus) {
- m_addr = addr;
- m_name = "TH02";
-
- mraa::Result ret = m_i2c.address(m_addr);
- if (ret != mraa::SUCCESS) {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_i2c_address() failed");
- }
-}
-
-TH02::~TH02 () {
-}
-
-float
-TH02::getTemperature () {
- uint16_t temperature = 0;
-
- /* Start a new temperature conversion */
- if (m_i2c.writeReg(TH02_REG_CONFIG, TH02_CMD_MEASURE_TEMP)) {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": I2c.writeReg() failed");
- return 0.0;
- }
-
- /* Wait until conversion is done */
- while (getStatus() == false);
-
- temperature = m_i2c.readReg(TH02_REG_DATA_H) << 8;
- temperature |= m_i2c.readReg(TH02_REG_DATA_L);
- temperature >>= 2;
-
- return ((float(temperature) / 32.0) - 50.0);
-}
-
-float
-TH02::getHumidity () {
- uint16_t humidity = 0;
-
- /* Start a new humidity conversion */
- if (m_i2c.writeReg(TH02_REG_CONFIG, TH02_CMD_MEASURE_HUMI)) {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": I2c.writeReg() failed");
- return 0.0;
- }
-
- /* Wait until conversion is done */
- while (getStatus() == false);
-
- humidity = m_i2c.readReg(TH02_REG_DATA_H) << 8;
- humidity |= m_i2c.readReg(TH02_REG_DATA_L);
- humidity >>= 4;
-
- return ((float(humidity) / 16.0) - 24.0);
-}
-
-bool
-TH02::getStatus () {
- uint8_t status = m_i2c.readReg(TH02_REG_STATUS);
-
- if (status & TH02_STATUS_RDY_MASK)
- return false; // NOT ready
- else
- return true; // ready
-}
-
diff --git a/peripheral/libupm/src/th02/th02.h b/peripheral/libupm/src/th02/th02.h
deleted file mode 100644
index 404180a..0000000
--- a/peripheral/libupm/src/th02/th02.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Contributions: Jon Trulson <jtlulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Credits to Seeed Studeo.
- *
- * 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 <string>
-#include <mraa/i2c.hpp>
-
-#define TH02_ADDR 0x40 // device address
-
-#define TH02_REG_STATUS 0x00
-#define TH02_REG_DATA_H 0x01
-#define TH02_REG_DATA_L 0x02
-#define TH02_REG_CONFIG 0x03
-#define TH02_REG_ID 0x11
-
-#define TH02_STATUS_RDY_MASK 0x01
-
-#define TH02_CMD_MEASURE_HUMI 0x01
-#define TH02_CMD_MEASURE_TEMP 0x11
-
-namespace upm {
-
-/**
- * @brief TH02 Temperature & Humidity Sensor library
- * @defgroup th02 libupm-th02
- * @ingroup seeed i2c temp
- */
-/**
- * @library th02
- * @sensor th02
- * @comname TH02 Temperature & Humidity Sensor
- * @altname Grove Temperature & Humidity Sensor (High-Accuracy & Mini)
- * @type temp
- * @man seeed
- * @web http://www.seeedstudio.com/wiki/Grove_-_Tempture%26Humidity_Sensor_(High-Accuracy_%26Mini)_v1.0
- * @con i2c
- *
- * @brief API for the TH02 Temperature & Humidity Sensor
- *
- * This module defines the TH02 interface for libth02
- *
- * Note: For use on Intel(R) Edison with an Arduino* breakout board, Intel
- * Edison must be set to 3 V rather than 5 V.
- *
- * @image html th02.jpg
- * @snippet th02.cxx Interesting
- */
-class TH02 {
- public:
- /**
- * Instantiates a TH02 object
- */
- TH02 (int bus=0, uint8_t addr=TH02_ADDR);
-
- /**
- * TH02 object destructor; basically, it closes the I2C connection.
- */
- ~TH02 ();
-
- /**
- * Gets the temperature value from the sensor.
- */
- float getTemperature ();
-
- /**
- * Gets the humidity value from the sensor.
- */
- float getHumidity ();
-
- /**
- * Gets the sensor status.
- */
- bool getStatus ();
-
- /**
- * Returns the name of the component
- */
- std::string name()
- {
- return m_name;
- }
-
- private:
- std::string m_name;
- mraa::I2c m_i2c;
- uint8_t m_addr;
-};
-
-}
diff --git a/peripheral/libupm/src/tm1637/CMakeLists.txt b/peripheral/libupm/src/tm1637/CMakeLists.txt
deleted file mode 100644
index 6138d2e..0000000
--- a/peripheral/libupm/src/tm1637/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "tm1637")
-set (libdescription "C++ API for the TM1637 7-segment display")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/tm1637/javaupm_tm1637.i b/peripheral/libupm/src/tm1637/javaupm_tm1637.i
deleted file mode 100644
index a0e5546..0000000
--- a/peripheral/libupm/src/tm1637/javaupm_tm1637.i
+++ /dev/null
@@ -1,29 +0,0 @@
-%module javaupm_tm1637
-%include "../upm.i"
-%include "stdint.i"
-%include "typemaps.i"
-
-%varargs(4, int digit = 0) write;
-
-%rename("writeArray") write(uint8_t *digits);
-%rename("writeString") write(std::string digits);
-
-%apply uint8_t *INPUT { uint8_t *digits }
-
-%{
- #include "tm1637.h"
-%}
-
-%include "tm1637.h"
-
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_tm1637");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/tm1637/jsupm_tm1637.i b/peripheral/libupm/src/tm1637/jsupm_tm1637.i
deleted file mode 100644
index 57992e0..0000000
--- a/peripheral/libupm/src/tm1637/jsupm_tm1637.i
+++ /dev/null
@@ -1,15 +0,0 @@
-%module jsupm_tm1637
-%include "../upm.i"
-%include "../carrays_uint8_t.i"
-
-%varargs(4, int digit = 0) write;
-
-%rename("writeArray") write(uint8_t *digits);
-%rename("writeString") write(std::string digits);
-
-%{
- #include "tm1637.h"
-%}
-
-%include "tm1637.h"
-
diff --git a/peripheral/libupm/src/tm1637/pyupm_tm1637.i b/peripheral/libupm/src/tm1637/pyupm_tm1637.i
deleted file mode 100644
index fe347eb..0000000
--- a/peripheral/libupm/src/tm1637/pyupm_tm1637.i
+++ /dev/null
@@ -1,12 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_tm1637
-%include "../upm.i"
-%include "../carrays_uint8_t.i"
-
-%varargs(4, int digit = 0) write;
-
-%{
- #include "tm1637.h"
-%}
-%include "tm1637.h"
diff --git a/peripheral/libupm/src/tm1637/tm1637.cxx b/peripheral/libupm/src/tm1637/tm1637.cxx
deleted file mode 100644
index 74507f2..0000000
--- a/peripheral/libupm/src/tm1637/tm1637.cxx
+++ /dev/null
@@ -1,209 +0,0 @@
-/*
- * Author: Mihai Tudor Panu <mihai.tudor.panu@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 <string>
-#include <stdexcept>
-#include "tm1637.h"
-#include <stdarg.h>
-
-const uint8_t m_brkt[2] = {0x39, 0x0f};
-const uint8_t m_nums[10] = {0x3f, 0x06, 0x5b, 0x4f, 0x66,
- 0x6d, 0x7d, 0x07, 0x7f, 0x6f};
-const uint8_t m_char[26] = {0x77, 0x7c, 0x39, 0x5e, 0x79,
- 0x71, 0x6f, 0x76, 0x30, 0x1e,
- 0x00, 0x38, 0x00, 0x00, 0x5c,
- 0x73, 0x67, 0x50, 0x5b, 0x78,
- 0x3e, 0x1c, 0x00, 0x00, 0x6e,
- 0x5b};
-
-using namespace std;
-using namespace upm;
-
-upm::TM1637::TM1637(int clk_pin, int dio_pin, int bright, M_FAST_GPIO mmio) {
-
- if((m_clk = mraa_gpio_init(clk_pin)) == NULL){
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_gpio_init(clk) failed, invalid pin?");
- return;
- }
-
- if((m_dio = mraa_gpio_init(dio_pin)) == NULL){
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_gpio_init(dio) failed, invalid pin?");
- return;
- }
-
- mraa_gpio_dir(m_clk, MRAA_GPIO_OUT);
- mraa_gpio_dir(m_dio, MRAA_GPIO_OUT);
-
- // Let the resistors pull the lines high
- mraa_gpio_mode(m_clk, MRAA_GPIO_PULLUP);
- mraa_gpio_mode(m_dio, MRAA_GPIO_PULLUP);
-
- if(mmio){
- if(mraa_gpio_use_mmaped(m_clk, 1) != MRAA_SUCCESS ||
- mraa_gpio_use_mmaped(m_dio, 1) != MRAA_SUCCESS){
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": mraa_gpio_use_mmaped() failed");
- return;
- }
- }
-
- mraa_gpio_write(m_clk, 0);
- mraa_gpio_write(m_dio, 0);
-
- for (int i = 0; i < M_DISPLAY_DIGITS; i++) {
- m_digits[i] = 0x00;
- }
- setBrightness(bright);
-}
-upm::TM1637::~TM1637() {
- for (int i = 0; i < M_DISPLAY_DIGITS; i++) {
- m_digits[i] = 0x00;
- }
- update();
-
- mraa_gpio_close(m_clk);
- mraa_gpio_close(m_dio);
-}
-mraa_result_t upm::TM1637::write(uint8_t *digits) {
- for (int i = 0; i < M_DISPLAY_DIGITS; i++) {
- m_digits[i] = digits[i];
- }
- update();
- return MRAA_SUCCESS;
-}
-mraa_result_t upm::TM1637::write(int d, ...) {
- va_list args;
- va_start(args, d);
- m_digits[0] = (uint8_t)d;
-
- for (int i = 1; i < M_DISPLAY_DIGITS; i++) {
- m_digits[i] = (uint8_t)va_arg(args, int);
- d++;
- }
- va_end(args);
- update();
- return MRAA_SUCCESS;
-}
-mraa_result_t upm::TM1637::writeAt(int index, char symbol) {
- if(index < 0 || index >= M_DISPLAY_DIGITS){
- cerr << "TM1637: invalid index in " << __FUNCTION__ << endl;
- return MRAA_ERROR_INVALID_PARAMETER;
- }
- m_digits[index] = encode(symbol);
- update();
- return MRAA_SUCCESS;
-}
-mraa_result_t upm::TM1637::write(std::string digits) {
- int len = digits.length();
- if( len > M_DISPLAY_DIGITS){
- len = M_DISPLAY_DIGITS;
- }
- for (int i = 0; i < len; i++) {
- m_digits[i] = encode(digits[i]);
- }
- update();
- return MRAA_SUCCESS;
-}
-void upm::TM1637::setColon(bool value) {
- if(value){
- m_digits[1] |= 0x80;
- }
- else{
- m_digits[1] &= 0x7f;
- }
- update();
-}
-void upm::TM1637::setBrightness(int value) {
- m_brightness = value & 0x07;
- update();
-}
-void upm::TM1637::i2c_start() {
- mraa_gpio_write(m_clk, 1);
- mraa_gpio_write(m_dio, 1);
- mraa_gpio_write(m_dio, 0);
-}
-void upm::TM1637::i2c_stop() {
- mraa_gpio_write(m_clk, 0);
- mraa_gpio_write(m_dio, 0);
- mraa_gpio_write(m_clk, 1);
- mraa_gpio_write(m_dio, 1);
-}
-void upm::TM1637::i2c_writeByte(uint8_t value) {
- for(uint8_t i = 0; i < 8; i++)
- {
- mraa_gpio_write(m_clk, 0);
- if(value & 0x01)
- mraa_gpio_write(m_dio, 1);
- else
- mraa_gpio_write(m_dio, 0);
- value >>= 1;
- mraa_gpio_write(m_clk, 1);
- }
-
- // Ack clock without skew, TM1637 is fast enough
- mraa_gpio_write(m_clk, 0);
- mraa_gpio_write(m_clk, 1);
- mraa_gpio_write(m_clk, 0);
-}
-void upm::TM1637::update() {
- i2c_start();
- i2c_writeByte(TM1637_ADDR);
- i2c_stop();
-
- i2c_start();
- i2c_writeByte(TM1637_REG);
- for (int i = 0; i < M_DISPLAY_DIGITS; i++) {
- i2c_writeByte(m_digits[i]);
- }
- i2c_stop();
-
- i2c_start();
- i2c_writeByte(TM1637_CMD | m_brightness);
- i2c_stop();
-}
-uint8_t upm::TM1637::encode(char c) {
- if(c >= '0' && c <= '9')
- return m_nums[(int)c - 48];
- if(c >= 'a' && c <= 'z')
- return m_char[(int)c - 97];
- if(c >= 'A' && c <= 'Z')
- return m_char[(int)c - 65];
- if(c == '[')
- return m_brkt[0];
- if(c == ']')
- return m_brkt[1];
- if(c == '(' || c == ')')
- return m_brkt[(int)c - 40];
- if(c == '-')
- return 0x40;
- if(c == '_')
- return 0x08;
- if(c == '}')
- return 0x70;
- if(c == '{')
- return 0x46;
- return 0x00;
-}
diff --git a/peripheral/libupm/src/tm1637/tm1637.h b/peripheral/libupm/src/tm1637/tm1637.h
deleted file mode 100644
index 08ad2f3..0000000
--- a/peripheral/libupm/src/tm1637/tm1637.h
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * Author: Mihai Tudor Panu <mihai.tudor.panu@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 <unistd.h>
-#include <stdint.h>
-#include <string>
-#include <iostream>
-
-#include <mraa/gpio.h>
-
-
-// TM1637-specific register addresses for writing all digits at a time
-#define TM1637_ADDR 0x40
-#define TM1637_REG 0xC0
-#define TM1637_CMD 0x88
-
-// Display-specific values
-#define M_DISPLAY_DIGITS 4
-
-namespace upm
-{
-
-/**
- * @brief TM1637 7-Segment Display library
- * @defgroup tm1637 libupm-tm1637
- * @ingroup seeed gpio display
- */
-
-/**
- * @library tm1637
- * @sensor tm1637
- * @comname TM1637 7-Segment Display
- * @altname Grove 4-Digit Display
- * @type display
- * @man seeed
- * @con gpio
- *
- * @brief API for the TM1637 7-Segment Display
- *
- * TM1637 is a display controller for LED-based 7-segment displays.
- * It can be used to address and write data to multiple display digits. This
- * driver is based on the Grove version of the TM1637 display that uses 4
- * digits, thus making it ideal for clock displays, timers, counters, or even
- * score displays in a two-player arcade game.
- *
- * @image html tm1637.jpeg
- * @snippet tm1637.cxx Interesting
- */
-
- class TM1637
- {
- public:
- /**
- * Enum for the memory-mapped GPIO
- */
- typedef enum {
- NO = 0,
- YES = 1
- } M_FAST_GPIO;
- /**
- * TM1637 constructor
- *
- * @param clk_pin Clock pin the sensor is connected to
- * @param dio_pin Data pin the sensor is connected to
- * @param bright Initial brightness, from 0 (dark) to 7 (bright) (default is 3)
- * @param mmio Fast memory-mapped GPIO writes; default is yes
- */
- TM1637(int clk_pin, int dio_pin, int bright = 3, M_FAST_GPIO mmio = YES);
- /**
- * TM1637 destructor
- */
- ~TM1637();
- /**
- * Writes digits to the display in a 7-segment encoding
- *
- * @param digits Array of digits to send to the display
- * @return 0 if successful, error code otherwise
- */
- mraa_result_t write(uint8_t *digits);
- /**
- * Writes digits to the display in a 7-segment encoding
- *
- * @param d List of multiple arguments to send to the display
- * @return 0 if successful, error code otherwise
- */
- mraa_result_t write(int d, ...);
- /**
- * Writes a symbol (digit or letter) to the display in a specified index
- *
- * @param index 0-based index of the digit to change from the left
- * @param symbol Digit or letter to display
- * @return 0 if successful, error code otherwise
- */
- mraa_result_t writeAt(int index, char symbol);
- /**
- * Writes all the digits or letters to the display as a string
- *
- * @param digits String of symbols to display
- * @return 0 if successful, error code otherwise
- */
- mraa_result_t write(std::string digits);
- /**
- * Toggles the colon between digits on the display
- *
- * @param value True to turn the colon on, false to turn it off
- */
- void setColon(bool value);
- /**
- * Controls the brightness of the display
- *
- * @param value Brightness, from 0 (darkest) to 7 (brightest)
- */
- void setBrightness(int value);
-
- private:
- void i2c_start();
- void i2c_stop();
- void i2c_writeByte(uint8_t value);
- void update();
- uint8_t encode(char c);
-
- mraa_gpio_context m_clk, m_dio;
- std::string m_name;
- uint8_t m_digits[4];
- uint8_t m_brightness;
- };
-}
diff --git a/peripheral/libupm/src/tsl2561/CMakeLists.txt b/peripheral/libupm/src/tsl2561/CMakeLists.txt
deleted file mode 100644
index 9434da3..0000000
--- a/peripheral/libupm/src/tsl2561/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "tsl2561")
-set (libdescription "upm tsl2561")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/tsl2561/javaupm_tsl2561.i b/peripheral/libupm/src/tsl2561/javaupm_tsl2561.i
deleted file mode 100644
index 2d542e6..0000000
--- a/peripheral/libupm/src/tsl2561/javaupm_tsl2561.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_tsl2561
-%include "../upm.i"
-
-%{
- #include "tsl2561.h"
-%}
-
-%include "tsl2561.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_tsl2561");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/tsl2561/jsupm_tsl2561.i b/peripheral/libupm/src/tsl2561/jsupm_tsl2561.i
deleted file mode 100644
index e5403d1..0000000
--- a/peripheral/libupm/src/tsl2561/jsupm_tsl2561.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_tsl2561
-%include "../upm.i"
-
-%{
- #include "tsl2561.h"
-%}
-
-%include "tsl2561.h"
diff --git a/peripheral/libupm/src/tsl2561/pyupm_tsl2561.i b/peripheral/libupm/src/tsl2561/pyupm_tsl2561.i
deleted file mode 100644
index 1e4ac90..0000000
--- a/peripheral/libupm/src/tsl2561/pyupm_tsl2561.i
+++ /dev/null
@@ -1,15 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_tsl2561
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-#ifdef DOXYGEN
-%include "tsl2561_doc.i"
-#endif
-
-%include "tsl2561.h"
-%{
- #include "tsl2561.h"
-%}
diff --git a/peripheral/libupm/src/tsl2561/tsl2561.cxx b/peripheral/libupm/src/tsl2561/tsl2561.cxx
deleted file mode 100644
index 7bbbfc0..0000000
--- a/peripheral/libupm/src/tsl2561/tsl2561.cxx
+++ /dev/null
@@ -1,248 +0,0 @@
-/*
- * Author: Nandkishor Sonar <Nandkishor.Sonar@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * LIGHT-TO-DIGITAL CONVERTER [TAOS-TSL2561]
- * Inspiration and lux calculation formulas from data sheet
- * URL: http://www.adafruit.com/datasheets/TSL2561.pdf
- *
- * 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 <string>
-#include <stdexcept>
-#include <unistd.h>
-#include "tsl2561.h"
-
-using namespace upm;
-
-
-TSL2561::TSL2561(int bus, uint8_t devAddr, uint8_t gain, uint8_t integrationTime)
- : m_i2ControlCtx(bus)
-{
- m_controlAddr = devAddr;
- m_bus = bus;
- m_gain = gain ;
- m_integrationTime = integrationTime;
-
- m_name = "TSL2561- Digital Light Sensor";
-
- mraa::Result error = m_i2ControlCtx.address(m_controlAddr);
- if (error != mraa::SUCCESS) {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_i2c_address() failed");
- return;
- }
-
- // POWER UP.
- error = m_i2ControlCtx.writeReg(REGISTER_Control, CONTROL_POWERON);
- if (error != mraa::SUCCESS) {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": Unable to power up TSL2561");
- return;
- }
- // Power on Settling time
- usleep(1000);
-
- // Gain & Integration time .
- error = m_i2ControlCtx.writeReg(REGISTER_Timing, m_gain | m_integrationTime);
- if (error != mraa::SUCCESS) {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": Unable to set gain/time");
- return;
- }
-
- // Set interrupt threshold to default.
- error = m_i2ControlCtx.writeReg(REGISTER_Interrupt, 0x00);
- if (error != mraa::SUCCESS) {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": Unable to set interrupt threshold");
- return;
- }
-}
-
-TSL2561::~TSL2561()
-{
- // POWER DOWN
- m_i2ControlCtx.writeReg(REGISTER_Control, CONTROL_POWEROFF);
-}
-
-int
-TSL2561::getLux()
-{
- mraa::Result error = mraa::SUCCESS;
- int lux;
- uint16_t rawLuxCh0;
- uint16_t rawLuxCh1;
- uint8_t ch0_low, ch0_high, ch1_low, ch1_high;
-
- error = i2cReadReg(REGISTER_Channal0L, ch0_low);
- if (error != mraa::SUCCESS) {
- fprintf(stderr, "Error: Unable to read channel0L in getRawLux()\n");
- return error;
- }
-
- error = i2cReadReg(REGISTER_Channal0H, ch0_high);
- if (error != mraa::SUCCESS) {
- fprintf(stderr, "Error: Unable to read channel0H in getRawLux()\n");
- return error;
- }
-
- rawLuxCh0 = ch0_high*256+ch0_low;
-
- error= i2cReadReg(REGISTER_Channal1L, ch1_low);
- if (error != mraa::SUCCESS) {
- fprintf(stderr, "Error: Unable to read channel1L in getRawLux()\n");
- return error;
- }
-
- error = i2cReadReg(REGISTER_Channal1H, ch1_high);
- if (error != mraa::SUCCESS) {
- fprintf(stderr, "Error: Unable to read channel1H in getRawLux()\n");
- return error;
- }
-
- rawLuxCh1 = ch1_high*256+ch1_low;
-
- uint64_t scale = 0;
-
- switch (m_integrationTime)
- {
- case 0: // 13.7 msec
- scale = LUX_CHSCALE_TINT0;
- break;
- case 1: // 101 msec
- scale = LUX_CHSCALE_TINT1;
- break;
- default: // assume no scaling
- scale = (1 << LUX_CHSCALE);
- break;
- }
-
- // scale if gain is NOT 16X
- if (!m_gain) scale = scale << 4;
-
- uint64_t channel1 = 0;
- uint64_t channel0 = 0;
- // scale the channel values
- channel0 = (rawLuxCh0 * scale) >> LUX_CHSCALE;
- channel1 = (rawLuxCh1 * scale) >> LUX_CHSCALE;
-
- // find the ratio of the channel values (Channel1/Channel0)
- // protect against divide by zero
- unsigned long ratio1 = 0;
- if (channel0 != 0) ratio1 = (channel1 << (LUX_RATIOSCALE+1)) / channel0;
-
- // round the ratio value
- unsigned long ratio = (ratio1 + 1) >> 1;
-
- unsigned int b, m;
-
- // CS package
- // Check if ratio <= eachBreak ?
- if ((ratio >= 0) && (ratio <= LUX_K1C))
- {b=LUX_B1C; m=LUX_M1C;}
- else if (ratio <= LUX_K2C)
- {b=LUX_B2C; m=LUX_M2C;}
- else if (ratio <= LUX_K3C)
- {b=LUX_B3C; m=LUX_M3C;}
- else if (ratio <= LUX_K4C)
- {b=LUX_B4C; m=LUX_M4C;}
- else if (ratio <= LUX_K5C)
- {b=LUX_B5C; m=LUX_M5C;}
- else if (ratio <= LUX_K6C)
- {b=LUX_B6C; m=LUX_M6C;}
- else if (ratio <= LUX_K7C)
- {b=LUX_B7C; m=LUX_M7C;}
- else if (ratio > LUX_K8C)
- {b=LUX_B8C; m=LUX_M8C;}
-
- uint64_t tempLux = 0;
- tempLux = ((channel0 * b) - (channel1 * m));
- // do not allow negative lux value
- if (tempLux < 0) tempLux = 0;
-
- // round lsb (2^(LUX_SCALE-1))
- tempLux += (1 << (LUX_SCALE-1));
-
- // strip off fractional portion
- lux = tempLux >> LUX_SCALE;
-
- return lux;
-}
-
-
-mraa::Result
-TSL2561::i2cWriteReg (uint8_t reg, uint8_t value)
-{
- mraa::Result error = mraa::SUCCESS;
-
- // Start transmission to device
- error = m_i2ControlCtx.address (m_controlAddr);
- if (error != mraa::SUCCESS) {
- fprintf(stderr, "Error: on i2c bus address setup in i2cWriteReg()\n");
- return error;
- }
- // Write register to I2C
- error = m_i2ControlCtx.writeByte (reg);
- if (error != mraa::SUCCESS) {
- fprintf(stderr, "Error: on i2c bus write reg in i2cWriteReg()\n");
- return error;
- }
-
- // Write value to I2C
- error = m_i2ControlCtx.writeByte (value);
- if (error != mraa::SUCCESS) {
- fprintf(stderr, "Error: on i2c bus write value in i2cWriteReg()\n");
- return error;
- }
-
- usleep(100000);
-
- return error;
-}
-
-mraa::Result
-TSL2561::i2cReadReg(uint8_t reg, uint8_t &data)
-{
- mraa::Result error = mraa::SUCCESS;
-
- // Start transmission to device
- error = m_i2ControlCtx.address(m_controlAddr);
- if (error != mraa::SUCCESS) {
- fprintf(stderr, "Error: on i2c bus address setup in i2cReadReg()\n");
- return error;
- }
-
- // Send address of register to be read.
- error = m_i2ControlCtx.writeByte(reg);
- if (error != mraa::SUCCESS) {
- fprintf(stderr, "Error: on i2c bus write in i2cReadReg()\n");
- return error;
- }
-
- // Read byte.
- data = m_i2ControlCtx.readByte();
-
- usleep(10000);
-
- return error;
-}
diff --git a/peripheral/libupm/src/tsl2561/tsl2561.h b/peripheral/libupm/src/tsl2561/tsl2561.h
deleted file mode 100644
index 2b83533..0000000
--- a/peripheral/libupm/src/tsl2561/tsl2561.h
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * Author: Nandkishor Sonar <Nandkishor.Sonar@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * LIGHT-TO-DIGITAL CONVERTER [TAOS-TSL2561]
- * Inspiration and lux calculation formulas from data sheet
- * URL: http://www.adafruit.com/datasheets/TSL2561.pdf
- *
- * 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 <string>
-#include <mraa/i2c.hpp>
-#include <math.h>
-
-namespace upm {
-
-#define TSL2561_Address (0x29) //Device address
-
-// Integration time
-#define INTEGRATION_TIME0_13MS (0x00) // 13.7ms
-#define INTEGRATION_TIME1_101MS (0x01) // 101ms
-#define INTEGRATION_TIME2_402MS (0x02) // 402ms
-
-// Integration time
-#define GAIN_0X (0x00) // No gain - Low
-#define GAIN_16X (0x10) // 16x gain - High
-
-// Power control bits
-#define CONTROL_POWERON (0x03) // ON
-#define CONTROL_POWEROFF (0x00) // OFF
-
-// TSL2561 registers
-#define REGISTER_Control (0x80)
-#define REGISTER_Timing (0x81)
-#define REGISTER_Interrupt (0x86)
-#define REGISTER_Channal0L (0x8C)
-#define REGISTER_Channal0H (0x8D)
-#define REGISTER_Channal1L (0x8E)
-#define REGISTER_Channal1H (0x8F)
-
-// Lux calculations differ slightly for CS package
-#define LUX_SCALE (14) // Scale by 2^14
-#define LUX_RATIOSCALE (9) // Scale ratio by 2^9
-#define LUX_CHSCALE (10) // Scale channel values by 2^10
-#define LUX_CHSCALE_TINT0 (0x7517) // 322/11 * 2^TSL2561_LUX_CHSCALE
-#define LUX_CHSCALE_TINT1 (0x0FE7) // 322/81 * 2^TSL2561_LUX_CHSCALE
-
-// CS package Coefficients
-#define LUX_K1C (0x0043) // 0.130 * 2^RATIO_SCALE
-#define LUX_B1C (0x0204) // 0.0315 * 2^LUX_SCALE
-#define LUX_M1C (0x01ad) // 0.0262 * 2^LUX_SCALE
-#define LUX_K2C (0x0085) // 0.260 * 2^RATIO_SCALE
-#define LUX_B2C (0x0228) // 0.0337 * 2^LUX_SCALE
-#define LUX_M2C (0x02c1) // 0.0430 * 2^LUX_SCALE
-#define LUX_K3C (0x00c8) // 0.390 * 2^RATIO_SCALE
-#define LUX_B3C (0x0253) // 0.0363 * 2^LUX_SCALE
-#define LUX_M3C (0x0363) // 0.0529 * 2^LUX_SCALE
-#define LUX_K4C (0x010a) // 0.520 * 2^RATIO_SCALE
-#define LUX_B4C (0x0282) // 0.0392 * 2^LUX_SCALE
-#define LUX_M4C (0x03df) // 0.0605 * 2^LUX_SCALE
-#define LUX_K5C (0x014d) // 0.65 * 2^RATIO_SCALE
-#define LUX_B5C (0x0177) // 0.0229 * 2^LUX_SCALE
-#define LUX_M5C (0x01dd) // 0.0291 * 2^LUX_SCALE
-#define LUX_K6C (0x019a) // 0.80 * 2^RATIO_SCALE
-#define LUX_B6C (0x0101) // 0.0157 * 2^LUX_SCALE
-#define LUX_M6C (0x0127) // 0.0180 * 2^LUX_SCALE
-#define LUX_K7C (0x029a) // 1.3 * 2^RATIO_SCALE
-#define LUX_B7C (0x0037) // 0.00338 * 2^LUX_SCALE
-#define LUX_M7C (0x002b) // 0.00260 * 2^LUX_SCALE
-#define LUX_K8C (0x029a) // 1.3 * 2^RATIO_SCALE
-#define LUX_B8C (0x0000) // 0.000 * 2^LUX_SCALE
-#define LUX_M8C (0x0000) // 0.000 * 2^LUX_SCALE
-
- /**
- * @brief TSL2561 Digital Light Sensor library
- * @defgroup tsl2561 libupm-tsl2561
- * @ingroup seeed i2c light eak
- */
-/**
- * @library tsl2561
- * @sensor tsl2561
- * @comname TSL2561 Light Sensor
- * @altname Grove Digital Light Sensor
- * @type light
- * @man seeed
- * @web http://www.seeedstudio.com/wiki/Grove_-_Digital_Light_Sensor
- * @con i2c
- * @kit eak
- *
- * @brief API for the TSL2561 Digital Light Sensor
- *
- * TSL2560 and TSL2561 are light-to-digital converters that transform
- * light intensity to a digital signal output capable of a direct I2C (TSL2561) interface
- *
- * @image html tsl2561.jpg
- * @snippet tsl2561.cxx Interesting
- */
-class TSL2561{
- public:
- /**
- * Instantiates a TSL2561 object
- *
- * @param bus Number of the used bus
- * @param devAddr Address of the used I2C device
- * @param gain Correct gain to use
- * @param integration Time to use
- */
- TSL2561(int bus=0, uint8_t devAddr=TSL2561_Address, uint8_t gain=GAIN_0X, uint8_t integrationTime=INTEGRATION_TIME1_101MS);
-
- /**
- * GY65 object destructor; powers down TSL2561 and closes the I2C connection.
- */
- ~TSL2561();
-
- /**
- * Gets the calculated lux reading from TSL2561
- *
- * @return Calculated lux value from the sensor
- */
- int getLux();
-
- private:
- /**
- * Writes to a TSL2561 register
- *
- * @param reg Addess to write
- * @param Value to write
- * @return mraa::Result
- */
- mraa::Result i2cWriteReg(uint8_t reg, uint8_t value);
-
- /**
- * Reads from a TSL2561 register
- *
- * @param reg Addess to read
- * @param data Byte read from the register
- * @return mraa::Result
- */
- mraa::Result i2cReadReg(uint8_t reg, uint8_t &data);
-
- int m_bus;
- std::string m_name;
- int m_controlAddr;
- mraa::I2c m_i2ControlCtx;
-
- uint8_t m_gain;
- uint8_t m_integrationTime;
-};
-
-}
-
diff --git a/peripheral/libupm/src/ttp223/CMakeLists.txt b/peripheral/libupm/src/ttp223/CMakeLists.txt
deleted file mode 100644
index 33341e1..0000000
--- a/peripheral/libupm/src/ttp223/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "ttp223")
-set (libdescription "upm ttp223")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/ttp223/javaupm_ttp223.i b/peripheral/libupm/src/ttp223/javaupm_ttp223.i
deleted file mode 100644
index c6b77c6..0000000
--- a/peripheral/libupm/src/ttp223/javaupm_ttp223.i
+++ /dev/null
@@ -1,23 +0,0 @@
-%module (docstring="TTP223 Touch Sensor") javaupm_ttp223
-
-%include "../upm.i"
-
-%apply int {mraa::Edge}
-
-
-%{
- #include "ttp223.h"
-%}
-
-%include "ttp223.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_ttp223");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%}
diff --git a/peripheral/libupm/src/ttp223/jsupm_ttp223.i b/peripheral/libupm/src/ttp223/jsupm_ttp223.i
deleted file mode 100644
index f083dd8..0000000
--- a/peripheral/libupm/src/ttp223/jsupm_ttp223.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_ttp223
-%include "../upm.i"
-
-%{
- #include "ttp223.h"
-%}
-
-%include "ttp223.h"
diff --git a/peripheral/libupm/src/ttp223/pyupm_ttp223.i b/peripheral/libupm/src/ttp223/pyupm_ttp223.i
deleted file mode 100644
index 8037e91..0000000
--- a/peripheral/libupm/src/ttp223/pyupm_ttp223.i
+++ /dev/null
@@ -1,12 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_ttp223
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "ttp223.h"
-%{
- #include "ttp223.h"
-%}
-
diff --git a/peripheral/libupm/src/ttp223/ttp223.cxx b/peripheral/libupm/src/ttp223/ttp223.cxx
deleted file mode 100644
index c20e468..0000000
--- a/peripheral/libupm/src/ttp223/ttp223.cxx
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Author: Sarah Knepper <sarah.knepper@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <string>
-#include <stdexcept>
-
-#include "ttp223.h"
-
-using namespace upm;
-
-TTP223::TTP223(unsigned int pin) {
- // initialize gpio input
- if ( !(m_gpio = mraa_gpio_init(pin)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_gpio_init() failed, invalid pin?");
- return;
- }
- mraa_gpio_dir(m_gpio, MRAA_GPIO_IN);
- m_name = "ttp223";
- m_isrInstalled = false;
-}
-
-TTP223::~TTP223() {
- // close gpio input
- mraa_gpio_close(m_gpio);
-}
-
-std::string TTP223::name() {
- return m_name;
-}
-
-int TTP223::value() {
- return mraa_gpio_read(m_gpio);
-}
-
-bool TTP223::isPressed() {
- return this->value() == 1;
-}
-
-#ifdef JAVACALLBACK
-void TTP223::installISR(mraa::Edge level, jobject runnable)
-{
- installISR(level, mraa_java_isr_callback, runnable);
-}
-#endif
-
-void TTP223::installISR(mraa::Edge level, void (*isr)(void *), void *arg)
-{
- if (m_isrInstalled)
- uninstallISR();
-
- // install our interrupt handler
- mraa_gpio_isr(m_gpio, (mraa_gpio_edge_t) level, isr, arg);
- m_isrInstalled = true;
-}
-
-void TTP223::uninstallISR()
-{
- mraa_gpio_isr_exit(m_gpio);
- m_isrInstalled = false;
-}
diff --git a/peripheral/libupm/src/ttp223/ttp223.h b/peripheral/libupm/src/ttp223/ttp223.h
deleted file mode 100644
index d2a3738..0000000
--- a/peripheral/libupm/src/ttp223/ttp223.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Author: Sarah Knepper <sarah.knepper@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include <mraa/gpio.hpp>
-
-namespace upm {
-/**
- * @brief TTP223 Touch Detector Sensor library
- * @defgroup ttp223 libupm-ttp223
- * @ingroup seeed gpio touch
- */
-/**
- * @library ttp223
- * @sensor ttp223
- * @comname TTP223 Touch Sensor
- * @altname Grove Touch Sensor
- * @type touch
- * @man seeed
- * @web http://www.seeedstudio.com/depot/Grove-Touch-Sensor-p-747.html
- * @con gpio
- *
- * @brief API for the TTP223 Touch Sensor
- *
- * This touch sensor detects when a finger is near the metallic pad
- * by the change in capacitance. It can replace a more traditional push
- * button. The touch sensor can still function when placed under a
- * non-metallic surface like glass or plastic.
- *
- * @image html ttp223.jpg
- * @snippet ttp223.cxx Interesting
- */
-class TTP223 {
- public:
- /**
- * TTP223 constructor
- *
- * @param pin GPIO pin where the sensor is connected
- */
- TTP223(unsigned int pin);
-
- /**
- * TTP223 destructor
- */
- ~TTP223();
-
- /**
- * Returns the name of this sensor
- *
- * @return Name of this sensor
- */
- std::string name();
-
- /**
- * Gets the value from the GPIO pin
- *
- * @return Value from the GPIO pin
- */
- int value();
-
- /**
- * Determines whether the touch sensor is being touched
- *
- * @return True if touched, false otherwise
- */
- bool isPressed();
-
- /**
- * Installs an interrupt service routine (ISR) to be called when
- * the button is activated or deactivated.
- *
- * @param fptr Pointer to a function to be called on interrupt
- * @param arg Pointer to an object to be supplied as an
- * argument to the ISR.
- */
-#if defined(SWIGJAVA) || defined(JAVACALLBACK)
- void installISR(mraa::Edge level, jobject runnable);
-#else
- void installISR(mraa::Edge level, void (*isr)(void *), void *arg);
-#endif
- /**
- * Uninstalls the previously installed ISR
- *
- */
- void uninstallISR();
-
- protected:
-#if defined(SWIGJAVA) || defined(JAVACALLBACK)
- void installISR(mraa::Edge level, void (*isr)(void *), void *arg);
-#endif
- std::string m_name; //!< name of this sensor
- mraa_gpio_context m_gpio; //!< GPIO pin
- bool m_isrInstalled;
-};
-
-}
diff --git a/peripheral/libupm/src/ublox6/CMakeLists.txt b/peripheral/libupm/src/ublox6/CMakeLists.txt
deleted file mode 100644
index 5db1266..0000000
--- a/peripheral/libupm/src/ublox6/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "ublox6")
-set (libdescription "upm u-blox 6 GPS UART support module")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/ublox6/javaupm_ublox6.i b/peripheral/libupm/src/ublox6/javaupm_ublox6.i
deleted file mode 100644
index c5f0777..0000000
--- a/peripheral/libupm/src/ublox6/javaupm_ublox6.i
+++ /dev/null
@@ -1,22 +0,0 @@
-%module javaupm_ublox6
-%include "../upm.i"
-%include "../java_buffer.i"
-
-%{
- #include "ublox6.h"
- speed_t int_B9600 = B9600;
-%}
-
-%include "ublox6.h"
-speed_t int_B9600 = B9600;
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_ublox6");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/ublox6/jsupm_ublox6.i b/peripheral/libupm/src/ublox6/jsupm_ublox6.i
deleted file mode 100644
index 12c7552..0000000
--- a/peripheral/libupm/src/ublox6/jsupm_ublox6.i
+++ /dev/null
@@ -1,13 +0,0 @@
-%module jsupm_ublox6
-%include "../upm.i"
-%include "stdint.i"
-%include "carrays.i"
-
-%{
- #include "ublox6.h"
- speed_t int_B9600 = B9600;
-%}
-
-%include "ublox6.h"
-speed_t int_B9600 = B9600;
-%array_class(char, charArray);
diff --git a/peripheral/libupm/src/ublox6/pyupm_ublox6.i b/peripheral/libupm/src/ublox6/pyupm_ublox6.i
deleted file mode 100644
index 8567d50..0000000
--- a/peripheral/libupm/src/ublox6/pyupm_ublox6.i
+++ /dev/null
@@ -1,17 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_ublox6
-%include "../upm.i"
-%include "stdint.i"
-%include "carrays.i"
-
-%feature("autodoc", "3");
-
-%{
- #include "ublox6.h"
- speed_t int_B9600 = B9600;
-%}
-
-%include "ublox6.h"
-speed_t int_B9600 = B9600;
-%array_class(char, charArray);
diff --git a/peripheral/libupm/src/ublox6/ublox6.cxx b/peripheral/libupm/src/ublox6/ublox6.cxx
deleted file mode 100644
index b9d15c5..0000000
--- a/peripheral/libupm/src/ublox6/ublox6.cxx
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <string>
-#include <stdexcept>
-
-#include "ublox6.h"
-
-using namespace upm;
-using namespace std;
-
-Ublox6::Ublox6(int uart)
-{
- m_ttyFd = -1;
-
- if ( !(m_uart = mraa_uart_init(uart)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_uart_init() failed");
- return;
- }
-
- // This requires a recent MRAA (1/2015)
- const char *devPath = mraa_uart_get_dev_path(m_uart);
-
- if (!devPath)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": mraa_uart_get_dev_path() failed");
- return;
- }
-
- // now open the tty
- if ( (m_ttyFd = open(devPath, O_RDWR)) == -1)
- {
- string err = __FUNCTION__;
- err += ": open of " + std::string(devPath) + " failed: " +
- std::string(strerror(errno));
-
- throw std::runtime_error(err);
- return;
- }
-}
-
-Ublox6::~Ublox6()
-{
- if (m_ttyFd != -1)
- close(m_ttyFd);
-}
-
-bool Ublox6::dataAvailable()
-{
- if (m_ttyFd == -1)
- return false;
-
- struct timeval timeout;
-
- // no waiting
- timeout.tv_sec = 0;
- timeout.tv_usec = 0;
-
- int nfds;
- fd_set readfds;
-
- FD_ZERO(&readfds);
-
- FD_SET(m_ttyFd, &readfds);
-
- if (select(m_ttyFd + 1, &readfds, NULL, NULL, &timeout) > 0)
- return true; // data is ready
- else
- return false;
-}
-
-int Ublox6::readData(char *buffer, int len)
-{
- if (m_ttyFd == -1)
- return(-1);
-
- int rv = read(m_ttyFd, buffer, len);
-
- if (rv < 0)
- {
- string err = string(__FUNCTION__) + ": read failed: " +
- string(strerror(errno));
-
- throw std::runtime_error(err);
- return rv;
- }
-
- return rv;
-}
-
-int Ublox6::writeData(char * buffer, int len)
-{
- if (m_ttyFd == -1)
- return(-1);
-
- int rv = write(m_ttyFd, buffer, len);
-
- if (rv < 0)
- {
- string err = string(__FUNCTION__) + ": write failed: " +
- string(strerror(errno));
-
- throw std::runtime_error(err);
- return rv;
- }
-
- tcdrain(m_ttyFd);
-
- return rv;
-}
-
-bool Ublox6::setupTty(speed_t baud)
-{
- if (m_ttyFd == -1)
- return(false);
-
- struct termios termio;
-
- // get current modes
- tcgetattr(m_ttyFd, &termio);
-
- // setup for a 'raw' mode. 81N, no echo or special character
- // handling, such as flow control.
- cfmakeraw(&termio);
-
- // set our baud rates
- cfsetispeed(&termio, baud);
- cfsetospeed(&termio, baud);
-
- // make it so
- int rv;
- if ( (rv = tcsetattr(m_ttyFd, TCSAFLUSH, &termio)) < 0)
- {
- string err = string(__FUNCTION__) + ": tcsetattr failed: " +
- string(strerror(errno));
-
- throw std::runtime_error(err);
- return false;
- }
-
- return true;
-}
diff --git a/peripheral/libupm/src/ublox6/ublox6.h b/peripheral/libupm/src/ublox6/ublox6.h
deleted file mode 100644
index d98aad3..0000000
--- a/peripheral/libupm/src/ublox6/ublox6.h
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include <iostream>
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <termios.h>
-#include <sys/time.h>
-#include <sys/select.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include <mraa/uart.h>
-
-const int UBLOX6_DEFAULT_UART = 0;
-
-namespace upm {
- /**
- * @brief UBLOX6 & SIM28 GPS Module library
- * @defgroup ublox6 libupm-ublox6
- * @ingroup seeed uart gps tsk
- */
- /**
- * @library ublox6
- * @sensor ublox6
- * @comname Grove GPS
- * @altname U-BLOX 6 SIM28
- * @type gps
- * @man seeed
- * @web http://www.seeedstudio.com/depot/Grove-GPS-p-959.html
- * @con uart
- * @kit tsk
- *
- * @brief API for the U-BLOX 6 and SIM28 GPS Modules
- *
- * UPM support for the U-BLOX 6 GPS module. It is also compatible with
- * the SIM28 GPS module.
- *
- * @image html ublox6.jpg
- * @snippet ublox6.cxx Interesting
- */
- class Ublox6 {
- public:
- /**
- * Ublox6 object constructor
- *
- * @param uart Default UART to use (0 or 1)
- */
- Ublox6(int uart);
-
- /**
- * Ublox6 object destructor
- */
- ~Ublox6();
-
- /**
- * Checks to see if there is data available for reading
- *
- * @return True if there is data available for reading
- */
- bool dataAvailable();
-
- /**
- * Reads any available data in a user-supplied buffer. Note: the
- * call blocks until data is available to be read. Use
- * dataAvailable() to determine whether there is data available
- * beforehand, to avoid blocking.
- *
- * @param buffer Buffer to hold the data read
- * @param len Length of the buffer
- * @return the Number of bytes read
- */
- int readData(char *buffer, int len);
-
- /**
- * Writes the data in the buffer to the device
- *
- * @param buffer Buffer to hold the data read
- * @param len Length of the buffer
- * @return Number of bytes written
- */
- int writeData(char *buffer, int len);
-
- /**
- * Sets up proper tty I/O modes and the baud rate. The default
- * baud rate is 9,600 (B9600).
- *
- * @param baud Desired baud rate
- * @return True if successful
- */
- bool setupTty(speed_t baud=B9600);
-
- protected:
- int ttyFd() { return m_ttyFd; };
-
- private:
- mraa_uart_context m_uart;
- int m_ttyFd;
- };
-}
-
-
diff --git a/peripheral/libupm/src/uln200xa/CMakeLists.txt b/peripheral/libupm/src/uln200xa/CMakeLists.txt
deleted file mode 100644
index 3ac82ff..0000000
--- a/peripheral/libupm/src/uln200xa/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "uln200xa")
-set (libdescription "upm uln200xa darlington stepper driver")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/uln200xa/javaupm_uln200xa.i b/peripheral/libupm/src/uln200xa/javaupm_uln200xa.i
deleted file mode 100644
index 0805ae3..0000000
--- a/peripheral/libupm/src/uln200xa/javaupm_uln200xa.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_uln200xa
-%include "../upm.i"
-
-%{
- #include "uln200xa.h"
-%}
-
-%include "uln200xa.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_uln200xa");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/uln200xa/jsupm_uln200xa.i b/peripheral/libupm/src/uln200xa/jsupm_uln200xa.i
deleted file mode 100644
index 48127af..0000000
--- a/peripheral/libupm/src/uln200xa/jsupm_uln200xa.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_uln200xa
-%include "../upm.i"
-
-%{
- #include "uln200xa.h"
-%}
-
-%include "uln200xa.h"
diff --git a/peripheral/libupm/src/uln200xa/pyupm_uln200xa.i b/peripheral/libupm/src/uln200xa/pyupm_uln200xa.i
deleted file mode 100644
index 6385933..0000000
--- a/peripheral/libupm/src/uln200xa/pyupm_uln200xa.i
+++ /dev/null
@@ -1,11 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_uln200xa
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "uln200xa.h"
-%{
- #include "uln200xa.h"
-%}
diff --git a/peripheral/libupm/src/uln200xa/uln200xa.cxx b/peripheral/libupm/src/uln200xa/uln200xa.cxx
deleted file mode 100644
index 068c766..0000000
--- a/peripheral/libupm/src/uln200xa/uln200xa.cxx
+++ /dev/null
@@ -1,248 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <string>
-#include <stdexcept>
-
-#include "uln200xa.h"
-
-using namespace upm;
-using namespace std;
-
-ULN200XA::ULN200XA(int stepsPerRev, int i1, int i2, int i3, int i4)
-{
- m_stepsPerRev = stepsPerRev;
- m_currentStep = 0;
- m_stepDelay = 0;
- m_stepDirection = 1; // default is forward
-
- if ( !(m_stepI1 = mraa_gpio_init(i1)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_gpio_init(i1) failed, invalid pin?");
- return;
- }
- mraa_gpio_dir(m_stepI1, MRAA_GPIO_OUT);
-
- if ( !(m_stepI2 = mraa_gpio_init(i2)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_gpio_init(i2) failed, invalid pin?");
- mraa_gpio_close(m_stepI1);
- return;
- }
- mraa_gpio_dir(m_stepI2, MRAA_GPIO_OUT);
-
- if ( !(m_stepI3 = mraa_gpio_init(i3)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_gpio_init(i3) failed, invalid pin?");
- mraa_gpio_close(m_stepI1);
- mraa_gpio_close(m_stepI2);
- return;
- }
- mraa_gpio_dir(m_stepI3, MRAA_GPIO_OUT);
-
- if ( !(m_stepI4 = mraa_gpio_init(i4)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_gpio_init(i4) failed, invalid pin?");
- mraa_gpio_close(m_stepI1);
- mraa_gpio_close(m_stepI2);
- mraa_gpio_close(m_stepI3);
-
- return;
- }
- mraa_gpio_dir(m_stepI4, MRAA_GPIO_OUT);
-
- // set default speed to 1
- setSpeed(1);
-}
-
-void ULN200XA::initClock()
-{
- gettimeofday(&m_startTime, NULL);
-}
-
-uint32_t ULN200XA::getMillis()
-{
- struct timeval elapsed, now;
- uint32_t elapse;
-
- // get current time
- gettimeofday(&now, NULL);
-
- // compute the delta since m_startTime
- if( (elapsed.tv_usec = now.tv_usec - m_startTime.tv_usec) < 0 )
- {
- elapsed.tv_usec += 1000000;
- elapsed.tv_sec = now.tv_sec - m_startTime.tv_sec - 1;
- }
- else
- {
- elapsed.tv_sec = now.tv_sec - m_startTime.tv_sec;
- }
-
- elapse = (uint32_t)((elapsed.tv_sec * 1000) + (elapsed.tv_usec / 1000));
-
- // never return 0
- if (elapse == 0)
- elapse = 1;
-
- return elapse;
-}
-
-
-ULN200XA::~ULN200XA()
-{
- mraa_gpio_close(m_stepI1);
- mraa_gpio_close(m_stepI2);
- mraa_gpio_close(m_stepI3);
- mraa_gpio_close(m_stepI4);
-}
-
-void ULN200XA::setSpeed(int speed)
-{
- m_stepDelay = 60 * 1000 / m_stepsPerRev / speed;
-}
-
-void ULN200XA::setDirection(ULN200XA_DIRECTION_T dir)
-{
- switch (dir)
- {
- case DIR_CW:
- m_stepDirection = 1;
- break;
- case DIR_CCW:
- m_stepDirection = -1;
- break;
- }
-}
-
-void ULN200XA::stepperStep()
-{
- int step = m_currentStep % 8;
-
- // This motor requires a different sequencing order in 8-steps than
- // usual.
-
- // Step I0 I1 I2 I3
- // 1 0 0 0 1
- // 2 0 0 1 1
- // 3 0 0 1 0
- // 4 0 1 1 0
- // 5 0 1 0 0
- // 6 1 1 0 0
- // 7 1 0 0 0
- // 8 1 0 0 1
-
- switch (step)
- {
- case 0: // 0001
- mraa_gpio_write(m_stepI1, 0);
- mraa_gpio_write(m_stepI2, 0);
- mraa_gpio_write(m_stepI3, 0);
- mraa_gpio_write(m_stepI4, 1);
- break;
- case 1: // 0011
- mraa_gpio_write(m_stepI1, 0);
- mraa_gpio_write(m_stepI2, 0);
- mraa_gpio_write(m_stepI3, 1);
- mraa_gpio_write(m_stepI4, 1);
- break;
- case 2: // 0010
- mraa_gpio_write(m_stepI1, 0);
- mraa_gpio_write(m_stepI2, 0);
- mraa_gpio_write(m_stepI3, 1);
- mraa_gpio_write(m_stepI4, 0);
- break;
- case 3: // 0110
- mraa_gpio_write(m_stepI1, 0);
- mraa_gpio_write(m_stepI2, 1);
- mraa_gpio_write(m_stepI3, 1);
- mraa_gpio_write(m_stepI4, 0);
- break;
- case 4: // 0100
- mraa_gpio_write(m_stepI1, 0);
- mraa_gpio_write(m_stepI2, 1);
- mraa_gpio_write(m_stepI3, 0);
- mraa_gpio_write(m_stepI4, 0);
- break;
- case 5: // 1100
- mraa_gpio_write(m_stepI1, 1);
- mraa_gpio_write(m_stepI2, 1);
- mraa_gpio_write(m_stepI3, 0);
- mraa_gpio_write(m_stepI4, 0);
- break;
- case 6: // 1000
- mraa_gpio_write(m_stepI1, 1);
- mraa_gpio_write(m_stepI2, 0);
- mraa_gpio_write(m_stepI3, 0);
- mraa_gpio_write(m_stepI4, 0);
- break;
- case 7: // 1001
- mraa_gpio_write(m_stepI1, 1);
- mraa_gpio_write(m_stepI2, 0);
- mraa_gpio_write(m_stepI3, 0);
- mraa_gpio_write(m_stepI4, 1);
- break;
- }
-}
-
-void ULN200XA::stepperSteps(unsigned int steps)
-{
- while (steps > 0)
- {
- if (getMillis() >= m_stepDelay)
- {
- // reset the clock
- initClock();
-
- m_currentStep += m_stepDirection;
-
- if (m_stepDirection == 1)
- {
- if (m_currentStep >= m_stepsPerRev)
- m_currentStep = 0;
- }
- else
- {
- if (m_currentStep <= 0)
- m_currentStep = m_stepsPerRev;
- }
-
- steps--;
- stepperStep();
- }
- }
-}
-
-void ULN200XA::release()
-{
- mraa_gpio_write(m_stepI1, 0);
- mraa_gpio_write(m_stepI2, 0);
- mraa_gpio_write(m_stepI3, 0);
- mraa_gpio_write(m_stepI4, 0);
-}
diff --git a/peripheral/libupm/src/uln200xa/uln200xa.h b/peripheral/libupm/src/uln200xa/uln200xa.h
deleted file mode 100644
index 5a941b1..0000000
--- a/peripheral/libupm/src/uln200xa/uln200xa.h
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <stdint.h>
-#include <sys/time.h>
-
-#include <mraa/gpio.h>
-#include <mraa/pwm.h>
-
-namespace upm {
-
- /**
- * @brief ULN200XA Stepper Driver library
- * @defgroup uln200xa libupm-uln200xa
- * @ingroup seeed gpio motor
- */
-
- /**
- * @library uln200xa
- * @sensor uln200xa
- * @comname ULN200XA Stepper Driver
- * @altname ULN2001A ULN2002A ULN2003A ULN2004A
- * @type motor
- * @man seeed
- * @web http://www.seeedstudio.com/depot/Gear-Stepper-Motor-with-Driver-p-1685.html?cPath=39_40
- * @con gpio
- *
- * @brief UPM module for the ULN200XA Darlington Stepper Driver
- *
- * This module was developed on a ULN2003A Stepper Driver. It
- * should also support the ULN2001A, ULN2002A, and ULN2004A devices, when
- * using to drive the 28BYJ-48 unipolar stepper motor.
- *
- * @image html uln200xa.jpg
- * Example driving a stepper motor
- * @snippet uln200xa.cxx Interesting
- */
-
-
- class ULN200XA {
- public:
-
- /**
- * Enum to specify the direction of a motor
- */
- typedef enum {
- DIR_CW = 0x01,
- DIR_CCW = 0x02
- } ULN200XA_DIRECTION_T;
-
- /**
- * ULN200XA constructor
- *
- * @param stepsPerRev Number of steps per full revolution
- * @param i1 Digital pin to use for stepper input 1
- * @param i2 Digital pin to use for stepper input 2
- * @param i3 Digital pin to use for stepper input 3
- * @param i4 Digital pin to use for stepper input 4
- */
- ULN200XA(int stepsPerRev, int i1, int i2, int i3, int i4);
-
- /**
- * ULN200XA destructor
- */
- ~ULN200XA();
-
- /**
- * Returns the number of milliseconds elapsed since initClock()
- * was last called.
- *
- * @return Elapsed milliseconds
- */
- uint32_t getMillis();
-
- /**
- * Resets the clock
- *
- */
- void initClock();
-
- /**
- * Sets the speed of the stepper motor in revolutions per minute (RPM)
- *
- * @param speed Speed to set the motor to, in RPM
- */
- void setSpeed(int speed);
-
- /**
- * Sets the direction of the motor, clockwise or counterclockwise
- *
- * @param dir Direction to set the motor to
- */
- void setDirection(ULN200XA_DIRECTION_T dir);
-
- /**
- * Steps the stepper motor a specified number of steps
- *
- * @param steps Number of steps to move the stepper motor
- */
- void stepperSteps(unsigned int steps);
-
- /**
- * Releases the stepper motor by removing power
- *
- */
- void release();
-
- private:
- struct timeval m_startTime;
-
- // stepper (4-wire)
- mraa_gpio_context m_stepI1;
- mraa_gpio_context m_stepI2;
- mraa_gpio_context m_stepI3;
- mraa_gpio_context m_stepI4;
-
- // steps per revolution
- int m_stepsPerRev;
- int m_currentStep;
- uint32_t m_stepDelay;
-
- /**
- * Steps the stepper motor one tick
- *
- */
- void stepperStep();
-
- /**
- * Defines the step direction: 1 = forward, -1 = backward
- *
- */
- int m_stepDirection;
- };
-}
-
-
diff --git a/peripheral/libupm/src/upm.h b/peripheral/libupm/src/upm.h
deleted file mode 100644
index eaecb3f..0000000
--- a/peripheral/libupm/src/upm.h
+++ /dev/null
@@ -1,391 +0,0 @@
-/*
- * Author: Brendan Le Foll <brendan.le.foll@intel.com>
- * Contributions: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-/// @cond DEV
-/**
- * This file only serves to describe sensor groups based on libmraa groups.
- * Sensors may belong to multiple groups. This is purely a documentation header
- * and is not meant to be installed anywhere.
- */
-/// @endcond DEV
-
-////////////////////////////////////////////////////////////////// @cond HEA
-/// Main group place holders.
-////////////////////////////////////////////////////////////////// @endcond HEA
-
-/**
- * @brief Sensors grouped by category
- * @defgroup bycat Sensor Categories
- */
-
-/**
- * @brief Sensors grouped by connection type
- * @defgroup bycon Connection Type
- */
-
-/**
- * @brief Sensors grouped by manufacturer
- * @defgroup byman Manufacturer
- */
-
-/**
- * @brief Sensors grouped into starter kits
- * @defgroup bykit Starter Kits
- */
-
-////////////////////////////////////////////////////////////////// @cond CAT
-/// Groups for the various Sensor Categories.
-////////////////////////////////////////////////////////////////// @endcond CAT
-
-/**
- * @brief Measure acceleration & tilt or collision detection
- * @defgroup accelerometer Accelerometer
- * @ingroup bycat
- */
-
-/**
- * @brief Sensors with a variable voltage output
- * @defgroup ainput Analog Inputs
- * @ingroup bycat
- */
-
-/**
- * @brief Measure pressure and atmospheric conditions
- * @defgroup pressure Atmospheric Pressure
- * @ingroup bycat
- */
-
-/**
- * @brief Button, Switch or Toggle
- * @defgroup button Button
- * @ingroup bycat
- */
-
-/**
- * @brief Light sensors with special function: Color recognition
- * @defgroup color Color Sensor
- * @ingroup bycat
- */
-
-/**
- * @brief Measure magnetic field to give rotation or heading
- * @defgroup compass Compass/Gyro/Magnometers
- * @ingroup bycat
- */
-
-/**
- * @brief Resistive digital to analog converters (DAC)
- * @defgroup digipot Digital Potentiometer
- * @ingroup bycat
- */
-
-/**
- * @brief TFT, LCD, LED display elements
- * @defgroup display Displays
- * @ingroup bycat
- */
-
-/**
- * @brief Measure electric current and ADC converters
- * @defgroup electric Electricity
- * @ingroup bycat
- */
-
-/**
- * @brief Measure bending or detect vibration
- * @defgroup flexfor Flex/Force
- * @ingroup bycat
- */
-
-/**
- * @brief Measure substance concentrations in gases
- * @defgroup gaseous Gas
- * @ingroup bycat
- */
-
-/**
- * @brief Provide positioning capabilities
- * @defgroup gps GPS
- * @ingroup bycat
- */
-
-/**
- * @brief LEDs, LED strips, LED matrix displays & controllers
- * @defgroup led LEDs
- * @ingroup bycat
- */
-
-/**
- * @brief Measure light intensity or distances
- * @defgroup light Light/Proximity/IR
- * @ingroup bycat
- */
-
-/**
- * @brief Measure liquid flow rates or levels
- * @defgroup liquid Liquid Flow
- * @ingroup bycat
- */
-
-/**
- * @brief Sensors with specific medical application
- * @defgroup medical Medical
- * @ingroup bycat
- */
-
-/**
- * @brief Various motors & controllers to get things moving
- * @defgroup motor Motor
- * @ingroup bycat
- */
-
-/**
- * @brief Other types of supported sensors
- * @defgroup other Other
- * @ingroup bycat
- */
-
-/**
- * @brief Different low and high power relays
- * @defgroup relay Relay
- * @ingroup bycat
- */
-
-/**
- * @brief Wireless sensors using RFID tags
- * @defgroup rfid RFID
- * @ingroup bycat
- */
-
-/**
- * @brief Various servo motors & controllers
- * @defgroup servos Servo
- * @ingroup bycat
- */
-
-/**
- * @brief Provide sound recording or playback
- * @defgroup sound Sound
- * @ingroup bycat
- */
-
-/**
- * @brief Measure temperature & humidity
- * @defgroup temp Temperature/Humidity
- * @ingroup bycat
- */
-
-/**
- * @brief Sensors using serial communication
- * @defgroup serial Serial
- * @ingroup bycat
- */
-
-/**
- * @brief Real time clocks & time measurement
- * @defgroup time Time
- * @ingroup bycat
- */
-
-/**
- * @brief Capacitive touch sensors
- * @defgroup touch Touch Sensor
- * @ingroup bycat
- */
-
-/**
- * @brief Provide WiFi, Bluetooth, RF communication
- * @defgroup wifi Wireless Communication
- * @ingroup bycat
- */
-
-////////////////////////////////////////////////////////////////// @cond CON
-/// Groups for the various Connection Types.
-////////////////////////////////////////////////////////////////// @endcond CON
-
-/**
- * @brief Sensors requiring an ADC value to be read
- * @defgroup analog AIO
- * @ingroup bycon
- */
-
-/**
- * @brief Modules using the i2c bus
- * @defgroup i2c I2C
- * @ingroup bycon
- */
-
-/**
- * @brief Modules using the SPI bus
- * @defgroup spi SPI
- * @ingroup bycon
- */
-
-/**
- * @brief Modules using GPIOs directly
- * @defgroup gpio GPIO
- * @ingroup bycon
- */
-
-/**
- * @brief Modules using a PWM capable GPIO pin
- * @defgroup pwm PWM
- * @ingroup bycon
- */
-
-/**
- * @brief Modules using a serial connection (RX/TX)
- * @defgroup uart UART
- * @ingroup bycon
- */
-
-////////////////////////////////////////////////////////////////// @cond MAN
-/// Groups for the various Manufacturers.
-////////////////////////////////////////////////////////////////// @endcond MAN
-
-/**
- * @brief Adafruit Industries
- * @defgroup adafruit Adafruit
- * @ingroup byman
- */
-
-/**
- * @brief EMax
- * @defgroup emax EMax
- * @ingroup byman
- */
-
-/**
- * @brief DFRobot
- * @defgroup dfrobot DFRobot
- * @ingroup byman
- */
-
-/**
- * @brief Comet System
- * @defgroup comet Comet
- * @ingroup byman
- */
-
-/**
- * @brief EpicTinker
- * @defgroup epict EpicTinker
- * @ingroup byman
- */
-
-/**
- * @brief Freescale
- * @defgroup freescale Freescale
- * @ingroup byman
- */
-
-/**
- * @brief Generic Brands
- * @defgroup generic Generic
- * @ingroup byman
- */
-
-/**
- * @brief Honeywell
- * @defgroup honeywell Honeywell
- * @ingroup byman
- */
-
-/**
- * @brief Maxim Integrated
- * @defgroup maxim Maxim Integrated
- * @ingroup byman
- */
-
-/**
- * @brief Numato Labs
- * @defgroup numatolabs Numato Labs
- * @ingroup byman
- */
-
-/**
- * @brief Omega
- * @defgroup omega Omega
- * @ingroup byman
- */
-
-/**
- * @brief SeeedStudio - Grove Sensors
- * @defgroup seeed SeeedStudio
- * @ingroup byman
- */
-
-/**
- * @brief Sparkfun
- * @defgroup sparkfun Sparkfun
- * @ingroup byman
- */
-
-/**
- * @brief Texas Instruments
- * @defgroup ti Texas Instruments
- * @ingroup byman
- */
-
-/**
- * @brief Veris Industries
- * @defgroup veris Veris Industries
- * @ingroup byman
- */
-
-////////////////////////////////////////////////////////////////// @cond KIT
-/// Groups for the various Starter Kits.
-////////////////////////////////////////////////////////////////// @endcond KIT
-
-/**
- * @brief Grove Starter Kit - Contains basic sensors
- * @defgroup gsk Grove Starter Kit
- * @ingroup bykit
- */
-
-/**
- * @brief Home Automation Kit - For projects around the house
- * @defgroup hak Home Automation Kit
- * @ingroup bykit
- */
-
-/**
- * @brief Environment & Agriculture Kit - For outdoor projects
- * @defgroup eak Environment & Agriculture Kit
- * @ingroup bykit
- */
-
-/**
- * @brief Transportation & Safety Kit - Used mostly on vehicles
- * @defgroup tsk Transportation & Safety Kit
- * @ingroup bykit
- */
-
-/**
- * @brief Robotics Kit - Sensors for your robot
- * @defgroup robok Robotics Kit
- * @ingroup bykit
- */
diff --git a/peripheral/libupm/src/upm.i b/peripheral/libupm/src/upm.i
deleted file mode 100644
index e69c63f..0000000
--- a/peripheral/libupm/src/upm.i
+++ /dev/null
@@ -1,31 +0,0 @@
-%include "std_string.i"
-%include "stdint.i"
-%include "upm_exception.i"
-
-%apply int { speed_t };
-%apply int { mraa_result_t };
-%apply int { mraa::Result };
-
-#if (SWIG_JAVASCRIPT_V8)
-%{
- // Because there's no guarantee that v8 will ever call garbage collection,
- // we're adding a function that will allow a user to call it manually
- void cleanUp()
- {
- // Call the v8 garbage collector as long as there is memory to clean up
- // See https://codereview.chromium.org/412163003 for this API change
-#if (SWIG_V8_VERSION < 0x032838)
- while (!v8::V8::IdleNotification())
-#else
- while (!v8::Isolate::GetCurrent()->IdleNotification(1000))
-#endif
- {;}
- }
-%}
-void cleanUp();
-#endif
-
-#if (SWIGJAVA)
-%typemap(jtype) jobject runnable "java.lang.Runnable"
-%typemap(jstype) jobject runnable "java.lang.Runnable"
-#endif
diff --git a/peripheral/libupm/src/upm_exception.i b/peripheral/libupm/src/upm_exception.i
deleted file mode 100644
index bc9ebdb..0000000
--- a/peripheral/libupm/src/upm_exception.i
+++ /dev/null
@@ -1,65 +0,0 @@
-/* Standardized exception handling for UPM
- *
- * catch blocks should be listed in order from most specific to least
- * specific.
- */
-
-%include "exception.i"
-
-%exception {
- try {
- $action
- } catch (std::invalid_argument& e) {
- std::string s1("UPM Invalid Argument: "), s2(e.what());
- s1 = s1 + s2;
- SWIG_exception(SWIG_ValueError, s1.c_str());
-
- } catch (std::domain_error& e) {
- std::string s1("UPM Domain Error: "), s2(e.what());
- s1 = s1 + s2;
- SWIG_exception(SWIG_ValueError, s1.c_str() );
-
- } catch (std::overflow_error& e) {
- std::string s1("UPM Overflow Error: "), s2(e.what());
- s1 = s1 + s2;
- SWIG_exception(SWIG_OverflowError, s1.c_str() );
-
- } catch (std::out_of_range& e) {
- std::string s1("UPM Out of Range: "), s2(e.what());
- s1 = s1 + s2;
- SWIG_exception(SWIG_IndexError, s1.c_str() );
-
- } catch (std::length_error& e) {
- std::string s1("UPM Length Error: "), s2(e.what());
- s1 = s1 + s2;
- SWIG_exception(SWIG_IndexError, s1.c_str() );
-
- } catch (std::logic_error& e) {
- std::string s1("UPM Logic Error: "), s2(e.what());
- s1 = s1 + s2;
- SWIG_exception(SWIG_RuntimeError, s1.c_str() );
-
- } catch (std::bad_alloc& e) {
- /* for an allocation exception, don't try to create a string... */
- SWIG_exception(SWIG_MemoryError, e.what() );
-
- } catch (std::runtime_error& e) {
- /* catch other std::runtime_error exceptions here */
- std::string s1("UPM Runtime Error: "), s2(e.what());
- s1 = s1 + s2;
- SWIG_exception(SWIG_RuntimeError, s1.c_str());
-
- } catch (std::exception& e) {
- /* catch other std::exceptions here */
- std::string s1("UPM Error: "), s2(e.what());
- s1 = s1 + s2;
- SWIG_exception(SWIG_SystemError, s1.c_str() );
-
- } catch (...) {
- /* catch everything else */
- SWIG_exception(SWIG_UnknownError, "UPM Unknown exception" );
-
- }
-
-}
-
diff --git a/peripheral/libupm/src/urm37/CMakeLists.txt b/peripheral/libupm/src/urm37/CMakeLists.txt
deleted file mode 100644
index 91a490e..0000000
--- a/peripheral/libupm/src/urm37/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "urm37")
-set (libdescription "upm DFRobot URM37 Ultrasonic ranger")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/urm37/javaupm_urm37.i b/peripheral/libupm/src/urm37/javaupm_urm37.i
deleted file mode 100644
index 725bafe..0000000
--- a/peripheral/libupm/src/urm37/javaupm_urm37.i
+++ /dev/null
@@ -1,21 +0,0 @@
-%module javaupm_urm37
-%include "../upm.i"
-%include "std_string.i"
-
-%{
- #include "urm37.h"
-%}
-
-%include "urm37.h"
-
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_urm37");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/urm37/jsupm_urm37.i b/peripheral/libupm/src/urm37/jsupm_urm37.i
deleted file mode 100644
index bc02946..0000000
--- a/peripheral/libupm/src/urm37/jsupm_urm37.i
+++ /dev/null
@@ -1,10 +0,0 @@
-%module jsupm_urm37
-%include "../upm.i"
-%include "std_string.i"
-
-%{
- #include "urm37.h"
-%}
-
-%include "urm37.h"
-
diff --git a/peripheral/libupm/src/urm37/pyupm_urm37.i b/peripheral/libupm/src/urm37/pyupm_urm37.i
deleted file mode 100644
index 4635dbb..0000000
--- a/peripheral/libupm/src/urm37/pyupm_urm37.i
+++ /dev/null
@@ -1,13 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_urm37
-%include "../upm.i"
-%include "std_string.i"
-
-%feature("autodoc", "3");
-
-%{
- #include "urm37.h"
-%}
-%include "urm37.h"
-
diff --git a/peripheral/libupm/src/urm37/urm37.cxx b/peripheral/libupm/src/urm37/urm37.cxx
deleted file mode 100644
index 85305d3..0000000
--- a/peripheral/libupm/src/urm37/urm37.cxx
+++ /dev/null
@@ -1,318 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-
-#include "urm37.h"
-
-using namespace upm;
-using namespace std;
-
-static const int waitTimeout = 1000;
-static const int maxRetries = 10;
-
-URM37::URM37(int aPin, int resetPin, int triggerPin, float aref) :
- m_uart(0), m_aio(new mraa::Aio(aPin)), m_gpioReset(resetPin),
- m_gpioTrigger(new mraa::Gpio(triggerPin))
-{
- m_analogMode = true;
-
- m_aRes = (1 << m_aio->getBit());
- m_aref = aref;
-
- m_gpioTrigger->dir(mraa::DIR_OUT);
-
- // setup trigger for mmapped access, not a big deal if this fails
- m_gpioTrigger->useMmap(true);
-
- // trigger high
- m_gpioTrigger->write(1);
-
- init();
-}
-
-URM37::URM37(int uart, int resetPin) :
- m_uart(new mraa::Uart(uart)), m_aio(0), m_gpioReset(resetPin),
- m_gpioTrigger(0)
-{
- m_analogMode = false;
-
- m_aRes = 0;
- m_aref = 0;
-
- // 9600 baud is the only support baud rate...
- if (m_uart->setBaudRate(9600))
- {
- throw std::runtime_error(string(__FUNCTION__) +
- ": setBaudRate(9600) failed");
- return;
- }
-
- init();
-}
-
-URM37::~URM37()
-{
- if (m_uart)
- delete m_uart;
- if (m_aio)
- delete m_aio;
- if(m_gpioTrigger)
- delete m_gpioTrigger;
-}
-
-void URM37::init()
-{
- m_gpioReset.dir(mraa::DIR_OUT);
-
- // reset the device
- reset();
-}
-
-void URM37::reset()
-{
- // toggle reset
- m_gpioReset.write(0);
- usleep(100);
- m_gpioReset.write(1);
- // wait for reset to complete
- sleep(3);
-}
-
-bool URM37::dataAvailable(unsigned int millis)
-{
- return m_uart->dataAvailable(millis);
-}
-
-std::string URM37::readDataStr(int len)
-{
- return m_uart->readStr(len);
-}
-
-int URM37::writeDataStr(std::string data)
-{
- m_uart->flush();
- return m_uart->writeStr(data);
-}
-
-float URM37::getDistance(int degrees)
-{
- // analog mode
- if (m_analogMode)
- {
- m_gpioTrigger->write(0);
- int val = m_aio->read();
- m_gpioTrigger->write(1);
-
- float mVolts = (float(val) * (m_aref / m_aRes)) * 1000.0;
-
- // 6.8mV per CM
- return (mVolts / 6.8);
- }
-
- // UART mode
- // query distance cmd sequence
- uint8_t deg = (uint8_t)(degrees / 6);
- if (deg > 46)
- throw std::out_of_range(string(__FUNCTION__) +
- ": degrees out of range, must be 0-270");
-
- string cmd;
- uint8_t cksum = 0x22 + deg + 0x00;
- cmd.push_back(0x22);
- cmd.push_back(deg);
- cmd.push_back(0x00);
- cmd.push_back(cksum);
-
- string resp = sendCommand(cmd);
-
- if (resp.empty())
- {
- throw std::runtime_error(string(__FUNCTION__) +
- ": sendCommand() failed");
- return 0.0;
- }
-
- uint8_t h = (uint8_t)resp[1];
- uint8_t l = (uint8_t)resp[2];
-
- float distance = float((h << 8) | l);
-
- return (distance);
-}
-
-float URM37::getTemperature()
-{
- if (m_analogMode)
- {
- throw std::runtime_error(string(__FUNCTION__) +
- ": Temperature measurement not available in analog mode");
-
- return 0.0;
- }
-
- // query temperature cmd sequence
- string cmd;
- cmd.push_back(0x11);
- cmd.push_back(0x00);
- cmd.push_back(0x00);
- cmd.push_back(0x11);
-
- string resp = sendCommand(cmd);
-
- if (resp.empty())
- {
- throw std::runtime_error(string(__FUNCTION__) +
- ": sendCommand() failed");
- return 0.0;
- }
-
- uint8_t h = (uint8_t)resp[1];
- uint8_t l = (uint8_t)resp[2];
-
- float temp;
- temp = float((h & 0x0f) * 256 + l) / 10.0;
- if (h & 0xf0)
- temp *= -1;
-
- return (temp);
-}
-
-uint8_t URM37::readEEPROM(uint8_t addr)
-{
- if (m_analogMode)
- {
- throw std::runtime_error(string(__FUNCTION__) +
- ": readEEPROM() is not possible in analog mode");
-
- return 0;
- }
-
- if (addr > 0x04)
- throw std::out_of_range(string(__FUNCTION__) +
- ": addr must be between 0x00-0x04");
-
- string cmd;
- uint8_t cksum = 0x33 + addr + 0x00;
- cmd.push_back(0x33);
- cmd.push_back(addr);
- cmd.push_back(0x00);
- cmd.push_back(cksum);
-
- string resp = sendCommand(cmd);
-
- if (resp.empty())
- {
- throw std::runtime_error(string(__FUNCTION__) +
- ": sendCommand() failed");
- return 0;
- }
-
- return resp[2];
-}
-
-void URM37::writeEEPROM(uint8_t addr, uint8_t value)
-{
- if (m_analogMode)
- {
- throw std::runtime_error(string(__FUNCTION__) +
- ": writeEEPROM() is not possible in analog mode");
-
- return;
- }
-
- if (addr > 0x04)
- throw std::out_of_range(string(__FUNCTION__) +
- ": addr must be between 0x00-0x04");
-
- string cmd;
- uint8_t cksum = 0x44 + addr + value;
- cmd.push_back(0x44);
- cmd.push_back(addr);
- cmd.push_back(value);
- cmd.push_back(cksum);
-
- string resp = sendCommand(cmd);
-
- if (resp.empty())
- {
- throw std::runtime_error(string(__FUNCTION__) +
- ": sendCommand() failed");
- return;
- }
-
- return;
-}
-
-string URM37::sendCommand(string cmd)
-{
- if (m_analogMode)
- {
- throw std::runtime_error(string(__FUNCTION__) +
- ": can only be executed in UART mode");
-
- return "";
- }
-
- int tries = 0;
- string resp;
-
- while (tries++ < maxRetries)
- {
- writeDataStr(cmd);
- if (!dataAvailable(waitTimeout))
- {
- cerr << __FUNCTION__ << ": Timed out waiting for response" << endl;
- continue;
- }
-
- resp = readDataStr(8);
-
- // verify size
- if (resp.size() != 4)
- {
- cerr << __FUNCTION__ << ": Invalid returned packet size" << endl;
- continue;
- }
- else
- {
- // we have data, verify cksum, return the response if it's
- // good, retry otherwise
- uint8_t cksum = (uint8_t)(resp[0] + resp[1] + resp[2]);
-
- if ((uint8_t)resp[3] != cksum)
- {
- cerr << __FUNCTION__ << ": cksum failure" << endl;
- continue;
- }
-
- // else, we are good to go
- return resp;
- }
- }
-
- // :(
- return "";
-}
-
diff --git a/peripheral/libupm/src/urm37/urm37.h b/peripheral/libupm/src/urm37/urm37.h
deleted file mode 100644
index 21554b9..0000000
--- a/peripheral/libupm/src/urm37/urm37.h
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Thanks to Adafruit for supplying a google translated version of the
- * Chinese datasheet and some clues in their code.
- *
- * 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 <string>
-#include <iostream>
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-
-#include <mraa/common.hpp>
-#include <mraa/uart.hpp>
-#include <mraa/aio.hpp>
-#include <mraa/gpio.hpp>
-
-#define URM37_DEFAULT_UART 0
-
-namespace upm {
- /**
- * @brief DFRobot URM37 Ultrasonic Ranger
- * @defgroup urm37 libupm-urm37
- * @ingroup dfrobot uart gpio ainput sound
- */
-
- /**
- * @library urm37
- * @sensor urm37
- * @comname DFRobot URM37 Ultrasonic Ranger
- * @type sound
- * @man dfrobot
- * @con uart ainput gpio
- * @web http://www.dfrobot.com/index.php?route=product/product&product_id=53
- *
- * @brief API for the DFRobot URM37 Ultrasonic Ranger
- *
- * The driver was tested with the DFRobot URM37 Ultrasonic Ranger,
- * V4. It has a range of between 5 and 500 centimeters (cm). It
- * supports both analog distance measurement, and UART based
- * temperature and distance measurements. This driver does not
- * support PWM measurement mode.
- *
- * For UART operation, the only supported baud rate is 9600. In
- * addition, you must ensure that the UART TX/RX pins are
- * configured for TTL operation (the factory default) rather than
- * RS232 operation, or permanent damage to your URM37 and/or MCU
- * will result. On power up, the LED indicator will blink one
- * long pulse, followed by one short pulse to indicate TTL
- * operation. See the DFRobot wiki for more information:
- *
- * (https://www.dfrobot.com/wiki/index.php?title=URM37_V4.0_Ultrasonic_Sensor_%28SKU:SEN0001%29)
- *
- * @image html urm37.jpg
- * An example using analog mode
- * @snippet urm37.cxx Interesting
- * An example using UART mode
- * @snippet urm37-uart.cxx Interesting
- */
-
- class URM37 {
- public:
-
- /**
- * URM37 object constructor (Analog mode)
- *
- * @param aPin Analog pin to use
- * @param resetPin GPIO pin to use for reset
- * @param triggerPin GPIO pin to use for triggering a distance measurement
- * @param aref The analog reference voltage, default 5.0
- */
- URM37(int aPin, int resetPin, int triggerPin, float aref=5.0);
-
- /**
- * URM37 object constructor (UART mode)
- *
- * @param uart Default UART to use (0 or 1).
- * @param resetPin GPIO pin to use for reset
- */
- URM37(int uart, int resetPin);
-
- /**
- * URM37 object destructor
- */
- ~URM37();
-
- /**
- * Reset the device. This will take approximately 3 seconds to
- * complete.
- *
- */
- void reset();
-
- /**
- * Get the distance measurement. A return value of 65535.0
- * in UART mode indicates an invalid measurement.
- *
- * @param degrees in UART mode, this specifies the degrees to turn
- * an attached PWM servo connected to the MOTO output on the
- * URM37. Default is 0. Valid values are 0-270. This option is
- * ignored in analog mode.
- * @return The measured distance in cm
- */
- float getDistance(int degrees=0);
-
- /**
- * Get the temperature measurement. This is only valid in UART mode.
- *
- * @return The measured temperature in degrees C
- */
- float getTemperature();
-
- /**
- * In UART mode only, read a value from the EEPROM and return it.
- *
- * @param addr The address in the EEPROM to read. Valid values
- * are between 0x00-0x04.
- * @return The EEPROM value at addr
- */
- uint8_t readEEPROM(uint8_t addr);
-
- /**
- * In UART mode only, write a value into an address on the EEPROM.
- *
- * @param addr The address in the EEPROM to write. Valid values
- * are between 0x00-0x04.
- * @param value The value to write
- * @return The EEPROM value at addr
- */
- void writeEEPROM(uint8_t addr, uint8_t value);
-
- protected:
- mraa::Uart *m_uart;
- mraa::Aio *m_aio;
- mraa::Gpio *m_gpioTrigger;
- mraa::Gpio m_gpioReset;
-
- // initialize reset gpio and call reset
- void init();
-
- // send a serial command and return a 4 byte response (UART mode only)
- std::string sendCommand(std::string cmd);
-
- private:
- /**
- * Checks to see if there is data aavailable for reading
- *
- * @param millis Number of milliseconds to wait; 0 means no waiting
- * @return true if there is data available for reading
- */
- bool dataAvailable(unsigned int millis);
-
- /**
- * Reads any available data and returns it in a std::string. Note:
- * the call blocks until data is available for reading. Use
- * dataAvailable() to determine whether there is data available
- * beforehand, to avoid blocking.
- *
- * @param len Maximum length of the data to be returned
- * @return Number of bytes read
- */
- std::string readDataStr(int len);
-
- /**
- * Writes the std:string data to the device. If you are writing a
- * command, be sure to terminate it with a carriage return (\r)
- *
- * @param data Buffer to write to the device
- * @return Number of bytes written
- */
- int writeDataStr(std::string data);
-
- // analog or UART mode
- bool m_analogMode;
-
- // analog reference and resolution
- float m_aref;
- int m_aRes;
- };
-}
-
-
diff --git a/peripheral/libupm/src/waterlevel/CMakeLists.txt b/peripheral/libupm/src/waterlevel/CMakeLists.txt
deleted file mode 100644
index 4f985e2..0000000
--- a/peripheral/libupm/src/waterlevel/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "waterlevel")
-set (libdescription "upm waterlevel sensor module")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init("-lrt")
diff --git a/peripheral/libupm/src/waterlevel/javaupm_waterlevel.i b/peripheral/libupm/src/waterlevel/javaupm_waterlevel.i
deleted file mode 100644
index 7365c37..0000000
--- a/peripheral/libupm/src/waterlevel/javaupm_waterlevel.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_waterlevel
-%include "../upm.i"
-
-%{
- #include "waterlevel.h"
-%}
-
-%include "waterlevel.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_waterlevel");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/waterlevel/jsupm_waterlevel.i b/peripheral/libupm/src/waterlevel/jsupm_waterlevel.i
deleted file mode 100644
index 44a715e..0000000
--- a/peripheral/libupm/src/waterlevel/jsupm_waterlevel.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_waterlevel
-%include "../upm.i"
-
-%{
- #include "waterlevel.h"
-%}
-
-%include "waterlevel.h"
diff --git a/peripheral/libupm/src/waterlevel/pyupm_waterlevel.i b/peripheral/libupm/src/waterlevel/pyupm_waterlevel.i
deleted file mode 100644
index 75b6bda..0000000
--- a/peripheral/libupm/src/waterlevel/pyupm_waterlevel.i
+++ /dev/null
@@ -1,11 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_waterlevel
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "waterlevel.h"
-%{
- #include "waterlevel.h"
-%}
diff --git a/peripheral/libupm/src/waterlevel/waterlevel.cxx b/peripheral/libupm/src/waterlevel/waterlevel.cxx
deleted file mode 100644
index 8a06019..0000000
--- a/peripheral/libupm/src/waterlevel/waterlevel.cxx
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Author: Zion Orent <sorent@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <string>
-#include <stdexcept>
-#include "waterlevel.h"
-
-using namespace upm;
-
-WaterLevel::WaterLevel(int pin)
-{
- if ( !(m_gpio = mraa_gpio_init(pin)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_gpio_init() failed, invalid pin?");
- return;
- }
- mraa_gpio_dir(m_gpio, MRAA_GPIO_IN);
-}
-
-WaterLevel::~WaterLevel()
-{
- mraa_gpio_close(m_gpio);
-}
-
-bool WaterLevel::isSubmerged()
-{
- // Submerged causes 0; being above water is 1
- return (!(bool)mraa_gpio_read(m_gpio));
-}
diff --git a/peripheral/libupm/src/waterlevel/waterlevel.h b/peripheral/libupm/src/waterlevel/waterlevel.h
deleted file mode 100644
index a2fc877..0000000
--- a/peripheral/libupm/src/waterlevel/waterlevel.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Author: Zion Orent <sorent@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <mraa/gpio.h>
-
-namespace upm {
- /**
- * @brief Water Level Switch Library
- * @defgroup waterlevel libupm-waterlevel
- * @ingroup seeed gpio liquid
- */
- /**
- * @library waterlevel
- * @sensor waterlevel
- * @comname Grove Water Level Sensor
- * @type liquid
- * @man seeed
- * @con gpio
- *
- * @brief UPM module for the Grove Water Level Switch
- *
- * This switch is a device used to sense the level of liquid within a tank,
- * it may actuate a pump, an indicator, an alarm, or other devices.
- *
- * @image html waterlevel.jpg
- * @snippet apds9002.cxx Interesting
- */
- class WaterLevel {
- public:
- /**
- * WaterLevel constructor
- *
- * @param pin Digital pin to use
- */
- WaterLevel(int pin);
- /**
- * WaterLevel destructor
- */
- ~WaterLevel();
- /**
- * @return bool Determines whether liquid has risen above the sensor
- */
- bool isSubmerged();
-
- private:
- mraa_gpio_context m_gpio;
- };
-}
diff --git a/peripheral/libupm/src/wheelencoder/CMakeLists.txt b/peripheral/libupm/src/wheelencoder/CMakeLists.txt
deleted file mode 100644
index 9528920..0000000
--- a/peripheral/libupm/src/wheelencoder/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "wheelencoder")
-set (libdescription "upm DFRobot wheelencoder")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/wheelencoder/javaupm_wheelencoder.i b/peripheral/libupm/src/wheelencoder/javaupm_wheelencoder.i
deleted file mode 100644
index 2b29f35..0000000
--- a/peripheral/libupm/src/wheelencoder/javaupm_wheelencoder.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_wheelencoder
-%include "../upm.i"
-
-%{
- #include "wheelencoder.h"
-%}
-
-%include "wheelencoder.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_wheelencoder");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/wheelencoder/jsupm_wheelencoder.i b/peripheral/libupm/src/wheelencoder/jsupm_wheelencoder.i
deleted file mode 100644
index ded5481..0000000
--- a/peripheral/libupm/src/wheelencoder/jsupm_wheelencoder.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_wheelencoder
-%include "../upm.i"
-
-%{
- #include "wheelencoder.h"
-%}
-
-%include "wheelencoder.h"
diff --git a/peripheral/libupm/src/wheelencoder/pyupm_wheelencoder.i b/peripheral/libupm/src/wheelencoder/pyupm_wheelencoder.i
deleted file mode 100644
index 9cfab7e..0000000
--- a/peripheral/libupm/src/wheelencoder/pyupm_wheelencoder.i
+++ /dev/null
@@ -1,11 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_wheelencoder
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "wheelencoder.h"
-%{
- #include "wheelencoder.h"
-%}
diff --git a/peripheral/libupm/src/wheelencoder/wheelencoder.cxx b/peripheral/libupm/src/wheelencoder/wheelencoder.cxx
deleted file mode 100644
index ae48c1d..0000000
--- a/peripheral/libupm/src/wheelencoder/wheelencoder.cxx
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-
-#ifdef JAVACALLBACK
-#undef JAVACALLBACK
-#endif
-#include "wheelencoder.h"
-
-using namespace upm;
-using namespace std;
-
-WheelEncoder::WheelEncoder(int pin) :
- m_gpio(pin)
-{
- m_gpio.dir(mraa::DIR_IN);
-
- initClock();
- m_counter = 0;
- m_isrInstalled = false;
-}
-
-WheelEncoder::~WheelEncoder()
-{
- stopCounter();
-}
-
-void WheelEncoder::initClock()
-{
- gettimeofday(&m_startTime, NULL);
-}
-
-uint32_t WheelEncoder::getMillis()
-{
- struct timeval elapsed, now;
- uint32_t elapse;
-
- // get current time
- gettimeofday(&now, NULL);
-
- // compute the delta since m_startTime
- if( (elapsed.tv_usec = now.tv_usec - m_startTime.tv_usec) < 0 )
- {
- elapsed.tv_usec += 1000000;
- elapsed.tv_sec = now.tv_sec - m_startTime.tv_sec - 1;
- }
- else
- {
- elapsed.tv_sec = now.tv_sec - m_startTime.tv_sec;
- }
-
- elapse = (uint32_t)((elapsed.tv_sec * 1000) + (elapsed.tv_usec / 1000));
-
- // never return 0
- if (elapse == 0)
- elapse = 1;
-
- return elapse;
-}
-
-void WheelEncoder::startCounter()
-{
- initClock();
- m_counter = 0;
-
- // install our interrupt handler
- if (!m_isrInstalled)
- m_gpio.isr(mraa::EDGE_RISING, &wheelISR, this);
-
- m_isrInstalled = true;
-}
-
-void WheelEncoder::stopCounter()
-{
- // remove the interrupt handler
- if (m_isrInstalled)
- m_gpio.isrExit();
-
- m_isrInstalled = false;
-}
-
-void WheelEncoder::wheelISR(void *ctx)
-{
- upm::WheelEncoder *This = (upm::WheelEncoder *)ctx;
- This->m_counter++;
-}
-
diff --git a/peripheral/libupm/src/wheelencoder/wheelencoder.h b/peripheral/libupm/src/wheelencoder/wheelencoder.h
deleted file mode 100644
index 17356e0..0000000
--- a/peripheral/libupm/src/wheelencoder/wheelencoder.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include <stdint.h>
-#include <sys/time.h>
-#include <mraa/gpio.hpp>
-
-namespace upm {
-
- /**
- * @brief DFRobot Wheel Encoder library
- * @defgroup wheelencoder libupm-wheelencoder
- * @ingroup dfrobot gpio other
- */
-
- /**
- * @library wheelencoder
- * @sensor wheelencoder
- * @comname DFRobot Wheel Encoder
- * @type other
- * @man dfrobot
- * @web http://www.dfrobot.com/index.php?route=product/product&product_id=98
- * @con gpio
-
- * @brief API for the DFRobot Wheel Encoder
- *
- * This sensor was developed for the DFRobot Wheel Encoder, though
- * it could be used for any counting time-based task.
- *
- * When you instantiate a class of this type, the gpio pin specified
- * is connected to an interrupt. Whenever a low to high transition
- * occurs on the gpio pin, the internal counter is incremented by
- * one.
- *
- * This class also includes a millisecond counter, so that you can
- * correlate the number of counts to a time period for calculating
- * an RPM or other value as needed.
- *
- * @image html wheelencoder.jpg
- * @snippet wheelencoder.cxx Interesting
- */
- class WheelEncoder {
- public:
-
- /**
- * DFRobot Wheel Encoder sensor constructor
- *
- * @param pin Digital pin to use
- */
- WheelEncoder(int pin);
-
- /**
- * WheelEncoder destructor
- */
- ~WheelEncoder();
-
- /**
- * Returns the number of milliseconds elapsed since initClock()
- * was last called.
- *
- * @return Elapsed milliseconds
- */
- uint32_t getMillis();
-
- /**
- * Resets the clock
- *
- */
- void initClock();
-
- /**
- * Resets the counter to 0. The counter should be
- * stopped via stopCounter() prior to calling this function.
- *
- */
- void clearCounter() { m_counter = 0; };
-
- /**
- * Starts the counter. This function will also clear the current
- * count and reset the clock.
- *
- */
- void startCounter();
-
- /**
- * Stops the counter
- *
- */
- void stopCounter();
-
- /**
- * Gets the current counter value
- *
- * @return counter value
- */
- uint32_t counter() { return m_counter; };
-
- protected:
- mraa::Gpio m_gpio;
- static void wheelISR(void *ctx);
-
- private:
- volatile uint32_t m_counter;
- struct timeval m_startTime;
- bool m_isrInstalled;
- };
-}
-
-
diff --git a/peripheral/libupm/src/wt5001/CMakeLists.txt b/peripheral/libupm/src/wt5001/CMakeLists.txt
deleted file mode 100644
index f70c82b..0000000
--- a/peripheral/libupm/src/wt5001/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "wt5001")
-set (libdescription "upm grove serial mp3 (wt5001) module")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/wt5001/javaupm_wt5001.i b/peripheral/libupm/src/wt5001/javaupm_wt5001.i
deleted file mode 100644
index fa38c56..0000000
--- a/peripheral/libupm/src/wt5001/javaupm_wt5001.i
+++ /dev/null
@@ -1,45 +0,0 @@
-%module javaupm_wt5001
-%include "../upm.i"
-%include "stdint.i"
-%include "typemaps.i"
-%include "../java_buffer.i"
-%include "../java_exceptions.i"
-
-%apply uint8_t *OUTPUT { uint8_t *vol };
-%apply uint8_t *OUTPUT { uint8_t *ps };
-%apply uint16_t *OUTPUT { uint16_t *numf };
-%apply uint16_t *OUTPUT { uint16_t *curf };
-%apply uint16_t *OUTPUT { uint16_t *year };
-%apply uint8_t *OUTPUT { uint8_t *month, uint8_t *day };
-%apply uint8_t *OUTPUT { uint8_t *hour, uint8_t *minute, uint8_t *second };
-
-%{
- #include "wt5001.h"
- speed_t int_B9600 = B9600;
-%}
-
-%ignore getVolume(uint8_t *vol);
-READDATA_EXCEPTION(getVolume())
-
-%ignore getPlayState(uint8_t *ps);
-READDATA_EXCEPTION(getPlayState())
-
-%ignore getNumFiles(WT5001_PLAYSOURCE_T psrc, uint16_t *numf);
-READDATA_EXCEPTION(getNumFiles(WT5001_PLAYSOURCE_T psrc))
-
-%ignore getCurrentFile(uint16_t *curf);
-READDATA_EXCEPTION(getCurrentFile())
-
-%include "wt5001.h"
-speed_t int_B9600 = B9600;
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_wt5001");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/wt5001/jsupm_wt5001.i b/peripheral/libupm/src/wt5001/jsupm_wt5001.i
deleted file mode 100644
index c53fc57..0000000
--- a/peripheral/libupm/src/wt5001/jsupm_wt5001.i
+++ /dev/null
@@ -1,12 +0,0 @@
-%module jsupm_wt5001
-%include "../upm.i"
-%include "../carrays_uint8_t.i"
-%include "../carrays_uint16_t.i"
-
-%{
- #include "wt5001.h"
- speed_t int_B9600 = B9600;
-%}
-
-%include "wt5001.h"
-speed_t int_B9600 = B9600;
diff --git a/peripheral/libupm/src/wt5001/pyupm_wt5001.i b/peripheral/libupm/src/wt5001/pyupm_wt5001.i
deleted file mode 100644
index aa0089d..0000000
--- a/peripheral/libupm/src/wt5001/pyupm_wt5001.i
+++ /dev/null
@@ -1,20 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_wt5001
-%include "../upm.i"
-%include "../carrays_uint8_t.i"
-%include "../carrays_uint16_t.i"
-
-%rename("getVolumeNoParam") getVolume();
-%rename("getPlayStateNoParam") getPlayState();
-%rename("getNumFilesOneParam") getNumFiles(WT5001_PLAYSOURCE_T psrc);
-%rename("getCurrentFileNoParam") getCurrentFile();
-
-%feature("autodoc", "3");
-
-%{
- #include "wt5001.h"
- speed_t int_B9600 = B9600;
-%}
-%include "wt5001.h"
-speed_t int_B9600 = B9600;
diff --git a/peripheral/libupm/src/wt5001/wt5001.cxx b/peripheral/libupm/src/wt5001/wt5001.cxx
deleted file mode 100644
index e4d18ba..0000000
--- a/peripheral/libupm/src/wt5001/wt5001.cxx
+++ /dev/null
@@ -1,633 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <sstream>
-#include <string>
-#include <stdexcept>
-
-#include "wt5001.h"
-
-using namespace upm;
-using namespace std;
-
-static const int defaultDelay = 100; // max wait time for read
-
-WT5001::WT5001(int uart)
-{
- m_ttyFd = -1;
-
- if ( !(m_uart = mraa_uart_init(uart)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_uart_init() failed");
- return;
- }
-
- // This requires a recent MRAA (1/2015)
- const char *devPath = mraa_uart_get_dev_path(m_uart);
-
- if (!devPath)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": mraa_uart_get_dev_path() failed");
- return;
- }
-
- // now open the tty
- if ( (m_ttyFd = open(devPath, O_RDWR)) == -1)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": open of " +
- string(devPath) + " failed: " +
- string(strerror(errno)));
- return;
- }
-}
-
-WT5001::~WT5001()
-{
- if (m_ttyFd != -1)
- close(m_ttyFd);
-
- mraa_deinit();
-}
-
-bool WT5001::dataAvailable(unsigned int millis)
-{
- if (m_ttyFd == -1)
- return false;
-
- struct timeval timeout;
-
- // no waiting
- timeout.tv_sec = 0;
- timeout.tv_usec = millis * 1000;
-
- int nfds;
- fd_set readfds;
-
- FD_ZERO(&readfds);
-
- FD_SET(m_ttyFd, &readfds);
-
- if (select(m_ttyFd + 1, &readfds, NULL, NULL, &timeout) > 0)
- return true; // data is ready
- else
- return false;
-}
-
-int WT5001::readData(char *buffer, int len)
-{
- if (m_ttyFd == -1)
- return(-1);
-
- if (!dataAvailable(defaultDelay))
- return 0; // timed out
-
- int rv = read(m_ttyFd, buffer, len);
-
- if (rv < 0)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": read() failed: " +
- string(strerror(errno)));
- return rv;
- }
-
- return rv;
-}
-
-int WT5001::writeData(char *buffer, int len)
-{
- if (m_ttyFd == -1)
- return(-1);
-
- // first, flush any pending but unread input
- tcflush(m_ttyFd, TCIFLUSH);
-
- int rv = write(m_ttyFd, buffer, len);
-
- if (rv < 0)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": write() failed: " +
- string(strerror(errno)));
- return rv;
- }
-
- tcdrain(m_ttyFd);
-
- return rv;
-}
-
-bool WT5001::setupTty(speed_t baud)
-{
- if (m_ttyFd == -1)
- return(false);
-
- struct termios termio;
-
- // get current modes
- tcgetattr(m_ttyFd, &termio);
-
- // setup for a 'raw' mode. 81N, no echo or special character
- // handling, such as flow control.
- cfmakeraw(&termio);
-
- // set our baud rates
- cfsetispeed(&termio, baud);
- cfsetospeed(&termio, baud);
-
- // make it so
- if (tcsetattr(m_ttyFd, TCSAFLUSH, &termio) < 0)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": tcsetattr() failed: " +
- string(strerror(errno)));
- return false;
- }
-
- return true;
-}
-
-bool WT5001::checkResponse(WT5001_OPCODE_T opcode)
-{
- char resp;
- char fopcode = (char)opcode;
-
- int rv = readData(&resp, 1);
-
- // check for wrong response byte, or timeout
- if ((resp != fopcode) || rv == 0 )
- return false;
-
- return true;
-}
-
-bool WT5001::play(WT5001_PLAYSOURCE_T psrc, uint16_t index)
-{
- char pkt[6];
- WT5001_OPCODE_T opcode = PLAY_SD;
-
- pkt[0] = WT5001_START;
- pkt[1] = 0x04; // length
-
- switch (psrc) // src
- {
- case SD:
- opcode = PLAY_SD;
- break;
-
- case SPI:
- opcode = PLAY_SPI;
- break;
-
- case UDISK:
- opcode = PLAY_UDISK;
- break;
- }
-
- pkt[2] = opcode;
- pkt[3] = (index >> 8) & 0xff; // index hi
- pkt[4] = index & 0xff; // index lo
- pkt[5] = WT5001_END;
-
- writeData(pkt, 6);
-
- return checkResponse(opcode);
-}
-
-bool WT5001::stop()
-{
- char pkt[4];
- WT5001_OPCODE_T opcode = STOP;
-
- pkt[0] = WT5001_START;
- pkt[1] = 0x02; // length
- pkt[2] = opcode;
- pkt[3] = WT5001_END;
-
- writeData(pkt, 4);
-
- return checkResponse(opcode);
-}
-
-bool WT5001::next()
-{
- char pkt[4];
- WT5001_OPCODE_T opcode = NEXT;
-
- pkt[0] = WT5001_START;
- pkt[1] = 0x02; // length
- pkt[2] = opcode;
- pkt[3] = WT5001_END;
-
- writeData(pkt, 4);
-
- return checkResponse(opcode);
-}
-
-bool WT5001::previous()
-{
- char pkt[4];
- WT5001_OPCODE_T opcode = PREVIOUS;
-
- pkt[0] = WT5001_START;
- pkt[1] = 0x02; // length
- pkt[2] = opcode;
- pkt[3] = WT5001_END;
-
- writeData(pkt, 4);
-
- return checkResponse(opcode);
-}
-
-bool WT5001::pause()
-{
- char pkt[4];
- WT5001_OPCODE_T opcode = PAUSE;
-
- pkt[0] = WT5001_START;
- pkt[1] = 0x02; // length
- pkt[2] = opcode;
- pkt[3] = WT5001_END;
-
- writeData(pkt, 4);
-
- return checkResponse(opcode);
-}
-
-bool WT5001::setVolume(uint8_t vol)
-{
- if (vol > WT5001_MAX_VOLUME)
- {
- // C++11 std::to_string() would be nice, but...
- std::ostringstream str;
- str << WT5001_MAX_VOLUME;
-
- throw std::out_of_range(std::string(__FUNCTION__) +
- ": angle must be between 0 and " +
- str.str());
- return false;
- }
-
- char pkt[5];
- WT5001_OPCODE_T opcode = SET_VOLUME;
-
- pkt[0] = WT5001_START;
- pkt[1] = 0x03; // length
- pkt[2] = opcode;
- pkt[3] = vol;
- pkt[4] = WT5001_END;
-
- writeData(pkt, 5);
-
- return checkResponse(opcode);
-}
-
-bool WT5001::queue(uint16_t index)
-{
- char pkt[6];
- WT5001_OPCODE_T opcode = QUEUE;
-
- pkt[0] = WT5001_START;
- pkt[1] = 0x04; // length
- pkt[2] = opcode;
- pkt[3] = (index >> 8) & 0xff; // index hi
- pkt[4] = index & 0xff; // index lo
- pkt[5] = WT5001_END;
-
- writeData(pkt, 6);
-
- return checkResponse(opcode);
-}
-
-bool WT5001::setPlayMode(WT5001_PLAYMODE_T pm)
-{
- char pkt[5];
- WT5001_OPCODE_T opcode = PLAY_MODE;
-
- pkt[0] = WT5001_START;
- pkt[1] = 0x03; // length
- pkt[2] = opcode;
- pkt[3] = pm;
- pkt[4] = WT5001_END;
-
- writeData(pkt, 5);
-
- return checkResponse(opcode);
-}
-
-bool WT5001::insert(uint16_t index)
-{
- char pkt[6];
- WT5001_OPCODE_T opcode = INSERT_SONG;
-
- pkt[0] = WT5001_START;
- pkt[1] = 0x04; // length
- pkt[2] = opcode;
- pkt[3] = (index >> 8) & 0xff; // index hi
- pkt[4] = index & 0xff; // index lo
- pkt[5] = WT5001_END;
-
- writeData(pkt, 6);
-
- return checkResponse(opcode);
-}
-
-bool WT5001::setDate(uint16_t year, uint8_t month, uint8_t day)
-{
- char pkt[8];
- WT5001_OPCODE_T opcode = SET_DATE;
-
- pkt[0] = WT5001_START;
- pkt[1] = 0x06; // length
- pkt[2] = opcode;
- pkt[3] = (year >> 8) & 0xff; // year hi
- pkt[4] = year & 0xff; // year lo
- pkt[5] = month; // month
- pkt[6] = day; // day
- pkt[7] = WT5001_END;
-
- writeData(pkt, 8);
-
- return checkResponse(opcode);
-}
-
-bool WT5001::setTime(uint8_t hour, uint8_t minute, uint8_t second)
-{
- char pkt[7];
- WT5001_OPCODE_T opcode = SET_TIME;
-
- pkt[0] = WT5001_START;
- pkt[1] = 0x05; // length
- pkt[2] = opcode;
- pkt[3] = hour; // hour
- pkt[4] = minute; // minute
- pkt[5] = second; // second
- pkt[6] = WT5001_END;
-
- writeData(pkt, 7);
-
- return checkResponse(opcode);
-}
-
-bool WT5001::setAlarm(uint8_t hour, uint8_t minute, uint8_t second)
-{
- char pkt[7];
- WT5001_OPCODE_T opcode = SET_ALARM;
-
- pkt[0] = WT5001_START;
- pkt[1] = 0x05; // length
- pkt[2] = opcode;
- pkt[3] = hour; // hour
- pkt[4] = minute; // minute
- pkt[5] = second; // second
- pkt[6] = WT5001_END;
-
- writeData(pkt, 7);
-
- return checkResponse(opcode);
-}
-
-bool WT5001::clearAlarm()
-{
- char pkt[4];
- WT5001_OPCODE_T opcode = CLEAR_ALARM;
-
- pkt[0] = WT5001_START;
- pkt[1] = 0x02; // length
- pkt[2] = opcode;
- pkt[3] = WT5001_END;
-
- writeData(pkt, 4);
-
- return checkResponse(opcode);
-}
-
-bool WT5001::getVolume(uint8_t *vol)
-{
- char pkt[4];
- WT5001_OPCODE_T opcode = READ_VOLUME;
-
- pkt[0] = WT5001_START;
- pkt[1] = 0x02; // length
- pkt[2] = opcode;
- pkt[3] = WT5001_END;
-
- writeData(pkt, 4);
-
- if (!checkResponse(opcode))
- return false;
-
- // there should be a byte waiting for us, the volume
- int rv = readData((char *)vol, 1);
- if (rv != 1)
- return false;
-
- return true;
-}
-
-uint8_t WT5001::getVolume()
-{
- uint8_t vol = 0;
- if (!getVolume(&vol))
- throw std::runtime_error(std::string(__PRETTY_FUNCTION__) +
- ": readData() failed");
- return vol;
-}
-
-bool WT5001::getPlayState(uint8_t *ps)
-{
- char pkt[4];
- WT5001_OPCODE_T opcode = READ_PLAY_STATE;
-
- pkt[0] = WT5001_START;
- pkt[1] = 0x02; // length
- pkt[2] = opcode;
- pkt[3] = WT5001_END;
-
- writeData(pkt, 4);
-
- if (!checkResponse(opcode))
- return false;
-
- // there should be a byte waiting for us, the play state
- int rv = readData((char *)ps, 1);
- if (rv != 1)
- return false;
-
- return true;
-}
-
-uint8_t WT5001::getPlayState()
-{
- uint8_t ps = 0;
- if (!getPlayState(&ps))
- throw std::runtime_error(std::string(__PRETTY_FUNCTION__) +
- ": readData() failed");
- return ps;
-}
-
-bool WT5001::getNumFiles(WT5001_PLAYSOURCE_T psrc, uint16_t *numf)
-{
- char pkt[4];
- WT5001_OPCODE_T opcode;
-
- pkt[0] = WT5001_START;
- pkt[1] = 0x02; // length
-
- switch (psrc) // src
- {
- case SD:
- opcode = READ_SD_NUMF;
- break;
-
- case SPI:
- opcode = READ_SPI_NUMF;
- break;
-
- case UDISK:
- opcode = READ_UDISK_NUMF;
- break;
- }
-
- pkt[2] = opcode;
- pkt[3] = WT5001_END;
-
- writeData(pkt, 4);
-
- if (!checkResponse(opcode))
- return false;
-
- // read the two byte response, and encode them
- char buf[2];
- int rv = readData(buf, 2);
- if (rv != 2)
- return false;
-
- *numf = (buf[0] << 8) | buf[1];
-
- return true;
-}
-
-uint16_t WT5001::getNumFiles(WT5001_PLAYSOURCE_T psrc)
-{
- uint16_t numf = 0;
- if (!getNumFiles(psrc, &numf))
- throw std::runtime_error(std::string(__PRETTY_FUNCTION__) +
- ": readData() failed");
- return numf;
-}
-
-bool WT5001::getCurrentFile(uint16_t *curf)
-{
- char pkt[4];
- WT5001_OPCODE_T opcode = READ_CUR_FNAME;
-
- pkt[0] = WT5001_START;
- pkt[1] = 0x02; // length
- pkt[2] = opcode;
- pkt[3] = WT5001_END;
-
- writeData(pkt, 4);
-
- if (!checkResponse(opcode))
- return false;
-
- // read the two byte response, and encode them
- char buf[2];
- int rv = readData(buf, 2);
- if (rv != 2)
- return false;
-
- *curf = (buf[0] << 8) | (buf[1] & 0xff);
-
- return true;
-}
-
-uint16_t WT5001::getCurrentFile()
-{
- uint16_t curf = 0;
- if (!getCurrentFile(&curf))
- throw std::runtime_error(std::string(__PRETTY_FUNCTION__) +
- ": readData() failed");
- return curf;
-}
-
-bool WT5001::getDate(uint16_t *year, uint8_t *month, uint8_t *day)
-{
- char pkt[4];
- WT5001_OPCODE_T opcode = READ_DATE;
-
- pkt[0] = WT5001_START;
- pkt[1] = 0x02; // length
- pkt[2] = opcode;
- pkt[3] = WT5001_END;
-
- writeData(pkt, 4);
-
- if (!checkResponse(opcode))
- return false;
-
- // read the 4 byte response
- char buf[4];
- int rv = readData(buf, 4);
- if (rv != 4)
- return false;
-
- *year = (buf[0] << 8) | (buf[1] & 0xff);
- *month = buf[2];
- *day = buf[3];
- return true;
-}
-
-bool WT5001::getTime(uint8_t *hour, uint8_t *minute, uint8_t *second)
-{
- char pkt[4];
- WT5001_OPCODE_T opcode = READ_TIME;
-
- pkt[0] = WT5001_START;
- pkt[1] = 0x02; // length
- pkt[2] = opcode;
- pkt[3] = WT5001_END;
-
- writeData(pkt, 4);
-
- if (!checkResponse(opcode))
- return false;
-
- // read the 3 byte response
- char buf[3];
- int rv = readData(buf, 3);
- if (rv != 3)
- return false;
-
- *hour = buf[0];
- *minute = buf[1];
- *second = buf[2];
- return true;
-}
-
diff --git a/peripheral/libupm/src/wt5001/wt5001.h b/peripheral/libupm/src/wt5001/wt5001.h
deleted file mode 100644
index c21135a..0000000
--- a/peripheral/libupm/src/wt5001/wt5001.h
+++ /dev/null
@@ -1,383 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include <iostream>
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <termios.h>
-#include <sys/time.h>
-#include <sys/select.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include <mraa/uart.h>
-
-const int WT5001_DEFAULT_UART = 0;
-const int WT5001_MAX_VOLUME = 31;
-
-// protocol start and end codes
-const uint8_t WT5001_START = 0x7e;
-const uint8_t WT5001_END = 0x7e;
-
-namespace upm {
- /**
- * @brief WT5001 Serial MP3 module library
- * @defgroup wt5001 libupm-wt5001
- * @ingroup seeed uart sound
- */
- /**
- * @library wt5001
- * @sensor wt5001
- * @comname WT5001 Serial MP3 Module
- * @altname Grove Serial MP3 Player
- * @type sound
- * @man seeed
- * @web http://www.seeedstudio.com/wiki/Grove_%E2%80%93_Serial_MP3_Player
- * @con uart
- *
- * @brief API for the WT5001 Serial MP3 Module
- *
- * UPM support for the WT5001 Serial MP3 module. This was tested
- * specifically with the Grove Serial MP3 module.
- *
- * @image html wt5001.jpg
- * @snippet wt5001.cxx Interesting
- */
- class WT5001 {
- public:
-
- // WT5001 opcodes
- typedef enum { NONE = 0x00,
- PLAY_SD = 0xa0,
- PLAY_SPI = 0xa1,
- PLAY_UDISK = 0xa2,
- PAUSE = 0xa3,
- STOP = 0xa4,
- NEXT = 0xa5,
- PREVIOUS = 0xa6,
- SET_VOLUME = 0xa7,
- QUEUE = 0xa8,
- PLAY_MODE = 0xa9,
- COPY_SD2FLASH = 0xaa, // not implemented
- COPY_UDISK2FLASH = 0xab, // not implemented
- INSERT_SONG = 0xac,
- SET_DATE = 0xb1,
- SET_TIME = 0xb2,
- SET_ALARM = 0xb3,
- SET_ALARM_DUR = 0xb4, // not implemented
- CLEAR_ALARM = 0xb5,
- CLEAR_ALARM_DUR = 0xb6, // not implemented
- READ_VOLUME = 0xc1,
- READ_PLAY_STATE = 0xc2,
- READ_SPI_NUMF = 0xc3,
- READ_SD_NUMF = 0xc4,
- READ_UDISK_NUMF = 0xc5,
- READ_CUR_FNAME = 0xc6,
- READ_CF_CHAR = 0xc7, // not implemented
- READ_DATE = 0xd1,
- READ_TIME = 0xd2
- } WT5001_OPCODE_T;
-
- // play modes
- typedef enum { NORMAL = 0x00,
- SINGLE_REPEAT = 0x01,
- ALL_REPEAT = 0x02,
- RANDOM = 0x03
- } WT5001_PLAYMODE_T;
-
- // music source
- typedef enum { SD,
- SPI,
- UDISK
- } WT5001_PLAYSOURCE_T;
-
- /**
- * WT5001 constructor
- *
- * @param uart Default UART to use (0 or 1)
- */
- WT5001(int uart);
-
- /**
- * WT5001 destructor
- */
- ~WT5001();
-
- /**
- * Checks to see if there is data available for reading
- *
- * @param millis Number of milliseconds to wait; 0 means no waiting
- * @return True if there is data available for reading
- */
- bool dataAvailable(unsigned int millis);
-
- /**
- * Reads any available data in a user-supplied buffer. Note: the
- * call blocks until data is available to be read. Use
- * dataAvailable() to determine whether there is data available
- * beforehand, to avoid blocking.
- *
- * @param buffer Buffer to hold the data read
- * @param len Length of the buffer
- * @return Number of bytes read
- */
- int readData(char *buffer, int len);
-
- /**
- * Writes the data in the buffer to the device
- *
- * @param buffer Buffer to hold the data read
- * @param len Length of the buffer
- * @return Number of bytes written
- */
- int writeData(char *buffer, int len);
-
- /**
- * Sets up proper tty I/O modes and the baud rate. The default
- * baud rate is 9,600 (B9600).
- *
- * @param baud Desired baud rate.
- * @return True if successful
- */
- bool setupTty(speed_t baud=B9600);
-
- /**
- * Gets a command response and returns its validity
- *
- * @param index Opcode to verify
- * @return True if successful
- */
- bool checkResponse(WT5001_OPCODE_T opcode);
-
- /**
- * Plays a file from a source
- *
- * @param psrc Play source (SD, UDISK, SPI)
- * @param index File number to play
- * @return True if successful
- */
- bool play(WT5001_PLAYSOURCE_T psrc, uint16_t index);
-
- /**
- * Stops playing
- *
- * @return True if successful
- */
- bool stop();
-
- /**
- * Pauses the playback or resumes it if already paused
- *
- * @return True if successful
- */
- bool pause();
-
- /**
- * Moves to the next track
- *
- * @return True if successful
- */
- bool next();
-
- /**
- * Moves to the previous track
- *
- * @return True if successful
- */
- bool previous();
-
- /**
- * Sets the volume. Valid range is 0-31. 0 means mute.
- *
- * @return True if successful
- */
- bool setVolume(uint8_t vol);
-
- /**
- * Queues a track to play next, when the current song is finished
- *
- * @param index File number to queue
- * @return True if successful
- */
- bool queue(uint16_t index);
-
- /**
- * Sets the playback mode
- *
- * @param pm Play mode to enable
- * @return True if successful
- */
- bool setPlayMode(WT5001_PLAYMODE_T pm);
-
- /**
- * Inserts a track to play immediately, interrupting the current
- * track. When the inserted track is finished, the
- * interrupted track resumes where it was interrupted.
- *
- * @param index File number to insert
- * @return True if successful
- */
- bool insert(uint16_t index);
-
- /**
- * Sets the date of the internal clock
- *
- * @param year 4-digit year
- * @param month Month
- * @param day Day
- * @return True if successful
- */
- bool setDate(uint16_t year, uint8_t month, uint8_t day);
-
- /**
- * Sets the time of the internal clock
- *
- * @param hour Hour
- * @param minute Minute
- * @param second Second
- * @return True if successful
- */
- bool setTime(uint8_t hour, uint8_t minute, uint8_t second);
-
- /**
- * Sets the alarm
- *
- * @param hour Hour
- * @param minute Minute
- * @param second Second
- * @return True if successful
- */
- bool setAlarm(uint8_t hour, uint8_t minute, uint8_t second);
-
- /**
- * Clears any alarm that has been set
- *
- * @return True if successful
- */
- bool clearAlarm();
-
- /**
- * Gets the current volume
- *
- * @param vol Volume
- * @return True if successful
- */
- bool getVolume(uint8_t *vol);
-
- /**
- * Gets the current volume
- *
- * @return Volume
- * @throws std::runtime_error if reading from the sensor failed
- */
- uint8_t getVolume();
-
- /**
- * Gets the current play state: 1 = playing, 2 = stopped, 3 = paused
- *
- * @param ps Play state
- * @return True if successful
- */
- bool getPlayState(uint8_t *ps);
-
- /**
- * Gets the current play state: 1 = playing, 2 = stopped, 3 = paused
- *
- * @return Play state
- * @throws std::runtime_error if reading from the sensor failed
- */
- uint8_t getPlayState();
-
- /**
- * Gets the number of files present on the source device
- *
- * @param psrc Storage source
- * @param numf Number of files
- * @return True if successful
- */
- bool getNumFiles(WT5001_PLAYSOURCE_T psrc, uint16_t *numf);
-
- /**
- * Gets the number of files present on the source device
- *
- * @param psrc Storage source
- * @return Number of files
- * @throws std::runtime_error if reading from the sensor failed
- */
- uint16_t getNumFiles(WT5001_PLAYSOURCE_T psrc);
-
- /**
- * Gets the index of the current file
- *
- * @param curf Index of the current file
- * @return True if successful
- */
- bool getCurrentFile(uint16_t *curf);
-
- /**
- * Gets the index of the current file
- *
- * @return Index of the curretn file
- * @throws std::runtime_error if reading from the sensor failed
- */
- uint16_t getCurrentFile();
-
- /**
- * Gets the device date
- *
- * @param year 4-digit year
- * @param month Month
- * @param day Day
- * @return True if successful
- */
- bool getDate(uint16_t *year, uint8_t *month, uint8_t *day);
-
- /**
- * Gets the device time
- *
- * @param hour Hour
- * @param minute Minute
- * @param second Second
- * @return True if successful
- */
- bool getTime(uint8_t *hour, uint8_t *minute, uint8_t *second);
-
-
- protected:
- int ttyFd() { return m_ttyFd; };
-
- private:
- mraa_uart_context m_uart;
- int m_ttyFd;
- };
-}
-
-
diff --git a/peripheral/libupm/src/xbee/CMakeLists.txt b/peripheral/libupm/src/xbee/CMakeLists.txt
deleted file mode 100644
index 3f46f2d..0000000
--- a/peripheral/libupm/src/xbee/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "xbee")
-set (libdescription "upm XBee serial module")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/xbee/javaupm_xbee.i b/peripheral/libupm/src/xbee/javaupm_xbee.i
deleted file mode 100644
index c886424..0000000
--- a/peripheral/libupm/src/xbee/javaupm_xbee.i
+++ /dev/null
@@ -1,22 +0,0 @@
-%module javaupm_xbee
-%include "../upm.i"
-%include "carrays.i"
-%include "std_string.i"
-
-%{
- #include "xbee.h"
-%}
-
-%include "xbee.h"
-%array_class(char, charArray);
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_xbee");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/xbee/jsupm_xbee.i b/peripheral/libupm/src/xbee/jsupm_xbee.i
deleted file mode 100644
index f71f0ce..0000000
--- a/peripheral/libupm/src/xbee/jsupm_xbee.i
+++ /dev/null
@@ -1,11 +0,0 @@
-%module jsupm_xbee
-%include "../upm.i"
-%include "carrays.i"
-%include "std_string.i"
-
-%{
- #include "xbee.h"
-%}
-
-%include "xbee.h"
-%array_class(char, charArray);
diff --git a/peripheral/libupm/src/xbee/pyupm_xbee.i b/peripheral/libupm/src/xbee/pyupm_xbee.i
deleted file mode 100644
index a895f54..0000000
--- a/peripheral/libupm/src/xbee/pyupm_xbee.i
+++ /dev/null
@@ -1,14 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_xbee
-%include "../upm.i"
-%include "carrays.i"
-%include "std_string.i"
-
-%feature("autodoc", "3");
-
-%{
- #include "xbee.h"
-%}
-%include "xbee.h"
-%array_class(char, charArray);
diff --git a/peripheral/libupm/src/xbee/xbee.cxx b/peripheral/libupm/src/xbee/xbee.cxx
deleted file mode 100644
index 91c2150..0000000
--- a/peripheral/libupm/src/xbee/xbee.cxx
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <time.h>
-
-#include "xbee.h"
-
-using namespace upm;
-using namespace std;
-
-static const int maxBuffer = 1024;
-
-XBee::XBee(int uart) :
- m_uart(uart)
-{
-}
-
-XBee::~XBee()
-{
-}
-
-bool XBee::dataAvailable(unsigned int millis)
-{
- return m_uart.dataAvailable(millis);
-}
-
-int XBee::readData(char *buffer, unsigned int len)
-{
- return m_uart.read(buffer, len);
-}
-
-std::string XBee::readDataStr(int len)
-{
- return m_uart.readStr(len);
-}
-
-int XBee::writeData(char *buffer, unsigned int len)
-{
- m_uart.flush();
- return m_uart.write(buffer, len);
-}
-
-int XBee::writeDataStr(std::string data)
-{
- m_uart.flush();
- return m_uart.writeStr(data);
-}
-
-mraa::Result XBee::setBaudRate(int baud)
-{
- return m_uart.setBaudRate(baud);
-}
-
-bool XBee::commandMode(std::string cmdChars, int guardTimeMS)
-{
-
- usleep(guardTimeMS * 1000);
-
- writeDataStr(cmdChars);
-
- usleep(guardTimeMS * 1000);
-
- string resp;
- if (dataAvailable(1000))
- resp = readDataStr(maxBuffer);
-
- if (resp.find("OK"))
- return true;
- else
- return false;
-}
-
-string XBee::stringCR2LF(string str)
-{
- for (int i=0; i<str.size(); i++)
- if (str[i] == '\r')
- str[i] = '\n';
-
- return str;
-}
diff --git a/peripheral/libupm/src/xbee/xbee.h b/peripheral/libupm/src/xbee/xbee.h
deleted file mode 100644
index c03c00a..0000000
--- a/peripheral/libupm/src/xbee/xbee.h
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Thanks to Adafruit for supplying a google translated version of the
- * Chinese datasheet and some clues in their code.
- *
- * 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 <string>
-#include <iostream>
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-
-#include <mraa/common.hpp>
-#include <mraa/uart.hpp>
-
-#define XBEE_DEFAULT_UART 0
-
-namespace upm {
- /**
- * @brief XBee modules
- * @defgroup xbee libupm-xbee
- * @ingroup sparkfun uart wifi
- */
-
- /**
- * @library xbee
- * @sensor xbee
- * @comname XBee modules
- * @type wifi
- * @man sparkfun
- * @con uart
- * @web https://www.sparkfun.com/products/11215
- *
- * @brief API for the XBee modules
- *
- * This is a generic UART driver for use with Digi XBee modules.
- * It was tested with the XBee S1 802.15.4 module and the XBee S6B
- * WiFi module.
- *
- * It provides basic UART support for sending and receiving data
- * to and from the device. It is controlled by an AT or API
- * command set.
- *
- * It is connected at 9600 baud by default.
- *
- * These devices are typically configured using Digi's X-CTU
- * windows software, however it is possible of course to configure
- * them manually using AT commands. See the examples.
- *
- * @image html xbee.jpg
- * <br><em>XBee Sensor image provided by SparkFun* under
- * <a href=https://creativecommons.org/licenses/by-nc-sa/3.0/>
- * CC BY-NC-SA-3.0</a>.</em>
- *
- * @snippet xbee.cxx Interesting
- */
-
- class XBee {
- public:
-
- /**
- * XBee object constructor
- *
- * @param uart Default UART to use (0 or 1). Default is 0.
- */
- XBee(int uart=XBEE_DEFAULT_UART);
-
- /**
- * XBee object destructor
- */
- ~XBee();
-
- /**
- * Checks to see if there is data available for reading
- *
- * @param millis Number of milliseconds to wait; 0 means no waiting
- * @return true if there is data available for reading
- */
- bool dataAvailable(unsigned int millis);
-
- /**
- * Reads any available data into a user-supplied buffer. Note: the
- * call blocks until data is available for reading. Use
- * dataAvailable() to determine whether there is data available
- * beforehand, to avoid blocking.
- *
- * @param buffer Buffer to hold the data read
- * @param len Length of the buffer
- * @return Number of bytes read
- */
- int readData(char *buffer, unsigned int len);
-
- /**
- * Reads any available data and returns it in a std::string. Note:
- * the call blocks until data is available for reading. Use
- * dataAvailable() to determine whether there is data available
- * beforehand, to avoid blocking.
- *
- * @param len Maximum length of the data to be returned
- * @return string containing the data read
- */
- std::string readDataStr(int len);
-
- /**
- * Writes the data in the buffer to the device. If you are
- * writing an AT command, be sure to terminate it with a carriage
- * return (\r)
- *
- * @param buffer Buffer to hold the data to write
- * @param len Length of the buffer
- * @return Number of bytes written
- */
- int writeData(char *buffer, unsigned len);
-
- /**
- * Writes the std:string data to the device. If you are writing an
- * AT command, be sure to terminate it with a carriage return (\r)
- *
- * @param data Buffer to write to the device
- * @return Number of bytes written
- */
- int writeDataStr(std::string data);
-
- /**
- * Sets the baud rate for the device. The default is 9600.
- *
- * @param baud Desired baud rate
- * @return true if successful
- */
- mraa::Result setBaudRate(int baud=9600);
-
- /**
- * Attempts to enter AT Command Mode. When Idle, data sent to the
- * device (assuming it is not in API mode) is silently transmitted
- * to the configured destination. Running this command attempts
- * to place the device into command mode, allowing you to send AT
- * commands. Note, after a configurable period of inactivity, the
- * device will exit command mode automatically (default 10
- * seconds).
- *
- * Both the cmdChars (+++) and the Guard Time can be configured
- * on the device to different values using AT configuration
- * commands.
- *
- * @param cmdChars The command mode characters, default "+++"
- * @param guardTimeMS The number of milliseconds to wait before and
- * after sending the command characters. Default is 1000 (1 second).
- * @return true if successful (received an "OK"), false otherwise
- */
- bool commandMode(std::string cmdChars="+++", int guardTimeMS=1000);
-
- /**
- * This is a convenience method that converts each CR (\r) in a
- * string to a LF (\n) and returns it. This is useful for
- * outputting the response to an AT command for instance, which is
- * typically CR terminated.
- *
- * @param str The string to convert
- * @return The converted string
- */
- std::string stringCR2LF(std::string str);
-
- protected:
- mraa::Uart m_uart;
-
- private:
- };
-}
-
-
diff --git a/peripheral/libupm/src/yg1006/CMakeLists.txt b/peripheral/libupm/src/yg1006/CMakeLists.txt
deleted file mode 100644
index 8f58549..0000000
--- a/peripheral/libupm/src/yg1006/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "yg1006")
-set (libdescription "upm yg1006 flame sensor module")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/yg1006/javaupm_yg1006.i b/peripheral/libupm/src/yg1006/javaupm_yg1006.i
deleted file mode 100644
index c3b01c4..0000000
--- a/peripheral/libupm/src/yg1006/javaupm_yg1006.i
+++ /dev/null
@@ -1,19 +0,0 @@
-%module javaupm_yg1006
-%include "../upm.i"
-
-%{
- #include "yg1006.h"
-%}
-
-%include "yg1006.h"
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_yg1006");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/yg1006/jsupm_yg1006.i b/peripheral/libupm/src/yg1006/jsupm_yg1006.i
deleted file mode 100644
index 1b83ad1..0000000
--- a/peripheral/libupm/src/yg1006/jsupm_yg1006.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module jsupm_yg1006
-%include "../upm.i"
-
-%{
- #include "yg1006.h"
-%}
-
-%include "yg1006.h"
diff --git a/peripheral/libupm/src/yg1006/pyupm_yg1006.i b/peripheral/libupm/src/yg1006/pyupm_yg1006.i
deleted file mode 100644
index 2b5dd5a..0000000
--- a/peripheral/libupm/src/yg1006/pyupm_yg1006.i
+++ /dev/null
@@ -1,11 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_yg1006
-%include "../upm.i"
-
-%feature("autodoc", "3");
-
-%include "yg1006.h"
-%{
- #include "yg1006.h"
-%}
diff --git a/peripheral/libupm/src/yg1006/yg1006.cxx b/peripheral/libupm/src/yg1006/yg1006.cxx
deleted file mode 100644
index 7ac721a..0000000
--- a/peripheral/libupm/src/yg1006/yg1006.cxx
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <string>
-#include <stdexcept>
-
-#include "yg1006.h"
-
-using namespace upm;
-using namespace std;
-
-YG1006::YG1006(int pin)
-{
- if ( !(m_gpio = mraa_gpio_init(pin)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_gpio_init() failed, invalid pin?");
- return;
- }
-
- mraa_gpio_dir(m_gpio, MRAA_GPIO_IN);
-}
-
-YG1006::~YG1006()
-{
- mraa_gpio_close(m_gpio);
-}
-
-bool YG1006::flameDetected()
-{
- return (!mraa_gpio_read(m_gpio) ? true : false);
-}
diff --git a/peripheral/libupm/src/yg1006/yg1006.h b/peripheral/libupm/src/yg1006/yg1006.h
deleted file mode 100644
index a64f32d..0000000
--- a/peripheral/libupm/src/yg1006/yg1006.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#pragma once
-
-#include <string>
-#include <mraa/gpio.h>
-
-namespace upm {
- /**
- * @brief YG1006 Flame Sensor library
- * @defgroup yg1006 libupm-yg1006
- * @ingroup seeed gpio light hak
- */
- /**
- * @library yg1006
- * @sensor yg1006
- * @comname YG1006 Flame Sensor
- * @altname Grove Flame Sensor
- * @type light
- * @man seeed
- * @web http://www.seeedstudio.com/wiki/Grove_-_Flame_Sensor
- * @con gpio
- * @kit hak
- *
- * @brief API for the YG1006 Flame Sensor
- *
- * UPM module for the YG1006 flame sensor. It detects a flame or any
- * other light source in the 760-1,100 nm wavelength range.
- *
- * @image html yg1006.jpg
- * @snippet yg1006.cxx Interesting
- */
- class YG1006 {
- public:
- /**
- * YG1006 constructor
- *
- * @param pin Digital pin to use
- */
- YG1006(int pin);
- /**
- * YG1006 destructor
- */
- ~YG1006();
- /**
- * Determines whether a flame has been detected
- *
- * @return True if a flame or another comparable light source has been detected
- */
- bool flameDetected();
-
- private:
- mraa_gpio_context m_gpio;
- };
-}
-
-
diff --git a/peripheral/libupm/src/zfm20/CMakeLists.txt b/peripheral/libupm/src/zfm20/CMakeLists.txt
deleted file mode 100644
index 1ad514b..0000000
--- a/peripheral/libupm/src/zfm20/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set (libname "zfm20")
-set (libdescription "upm grove zfm20 fingerprint sensor module")
-set (module_src ${libname}.cxx)
-set (module_h ${libname}.h)
-upm_module_init()
diff --git a/peripheral/libupm/src/zfm20/javaupm_zfm20.i b/peripheral/libupm/src/zfm20/javaupm_zfm20.i
deleted file mode 100644
index 561ec12..0000000
--- a/peripheral/libupm/src/zfm20/javaupm_zfm20.i
+++ /dev/null
@@ -1,28 +0,0 @@
-%module javaupm_zfm20
-%include "../upm.i"
-%include "stdint.i"
-%include "typemaps.i"
-%include "arrays_java.i";
-%include "../java_buffer.i";
-
-%apply uint16_t *OUTPUT { uint16_t *id, uint16_t *score };
-
-%{
- #include "zfm20.h"
- speed_t int_B57600 = B57600;
-%}
-
-
-%include "zfm20.h"
-speed_t int_B57600 = B57600;
-
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary("javaupm_zfm20");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \n" + e);
- System.exit(1);
- }
- }
-%} \ No newline at end of file
diff --git a/peripheral/libupm/src/zfm20/jsupm_zfm20.i b/peripheral/libupm/src/zfm20/jsupm_zfm20.i
deleted file mode 100644
index 55b07b1..0000000
--- a/peripheral/libupm/src/zfm20/jsupm_zfm20.i
+++ /dev/null
@@ -1,15 +0,0 @@
-%module jsupm_zfm20
-%include "../upm.i"
-%include "../carrays_uint16_t.i"
-%include "../carrays_uint32_t.i"
-%include "cpointer.i"
-
-/* Send "int *" to JavaScript as intp */
-%pointer_functions(int, intp);
-%{
- #include "zfm20.h"
- speed_t int_B57600 = B57600;
-%}
-
-%include "zfm20.h"
-speed_t int_B57600 = B57600;
diff --git a/peripheral/libupm/src/zfm20/pyupm_zfm20.i b/peripheral/libupm/src/zfm20/pyupm_zfm20.i
deleted file mode 100644
index d1cac93..0000000
--- a/peripheral/libupm/src/zfm20/pyupm_zfm20.i
+++ /dev/null
@@ -1,18 +0,0 @@
-// Include doxygen-generated documentation
-%include "pyupm_doxy2swig.i"
-%module pyupm_zfm20
-%include "../upm.i"
-%include "../carrays_uint16_t.i"
-%include "../carrays_uint32_t.i"
-%include "cpointer.i"
-
-%feature("autodoc", "3");
-
-/* Send "int *" to python as intp */
-%pointer_functions(int, intp);
-%{
- #include "zfm20.h"
- speed_t int_B57600 = B57600;
-%}
-%include "zfm20.h"
-speed_t int_B57600 = B57600;
diff --git a/peripheral/libupm/src/zfm20/zfm20.cxx b/peripheral/libupm/src/zfm20/zfm20.cxx
deleted file mode 100644
index f0e42c8..0000000
--- a/peripheral/libupm/src/zfm20/zfm20.cxx
+++ /dev/null
@@ -1,604 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <string>
-#include <stdexcept>
-
-#include "zfm20.h"
-
-using namespace upm;
-using namespace std;
-
-static const int defaultDelay = 100; // max wait time for read
-
-ZFM20::ZFM20(int uart)
-{
- m_ttyFd = -1;
-
- if ( !(m_uart = mraa_uart_init(uart)) )
- {
- throw std::invalid_argument(std::string(__FUNCTION__) +
- ": mraa_uart_init() failed");
- return;
- }
-
- // This requires a recent MRAA (1/2015)
- const char *devPath = mraa_uart_get_dev_path(m_uart);
-
- if (!devPath)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": mraa_uart_get_dev_path() failed");
- return;
- }
-
- // now open the tty
- if ( (m_ttyFd = open(devPath, O_RDWR)) == -1)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": open of " +
- string(devPath) + " failed: " +
- string(strerror(errno)));
- return;
- }
-
- // Set the default password and address
- setPassword(ZFM20_DEFAULT_PASSWORD);
- setAddress(ZFM20_DEFAULT_ADDRESS);
-
- initClock();
-}
-
-ZFM20::~ZFM20()
-{
- if (m_ttyFd != -1)
- close(m_ttyFd);
-
- mraa_deinit();
-}
-
-bool ZFM20::dataAvailable(unsigned int millis)
-{
- if (m_ttyFd == -1)
- return false;
-
- struct timeval timeout;
-
- // no waiting
- timeout.tv_sec = 0;
- timeout.tv_usec = millis * 1000;
-
- int nfds;
- fd_set readfds;
-
- FD_ZERO(&readfds);
-
- FD_SET(m_ttyFd, &readfds);
-
- if (select(m_ttyFd + 1, &readfds, NULL, NULL, &timeout) > 0)
- return true; // data is ready
- else
- return false;
-}
-
-int ZFM20::readData(char *buffer, int len)
-{
- if (m_ttyFd == -1)
- return(-1);
-
- if (!dataAvailable(defaultDelay))
- return 0; // timed out
-
- int rv = read(m_ttyFd, buffer, len);
-
- if (rv < 0)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": read() failed: " +
- string(strerror(errno)));
- return rv;
- }
-
- return rv;
-}
-
-int ZFM20::writeData(char *buffer, int len)
-{
- if (m_ttyFd == -1)
- return(-1);
-
- // first, flush any pending but unread input
- tcflush(m_ttyFd, TCIFLUSH);
-
- int rv = write(m_ttyFd, buffer, len);
-
- if (rv < 0)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": write() failed: " +
- string(strerror(errno)));
- return rv;
- }
-
- if (rv == 0)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": write() failed, no bytes written");
- return rv;
- }
-
- tcdrain(m_ttyFd);
-
- return rv;
-}
-
-bool ZFM20::setupTty(speed_t baud)
-{
- if (m_ttyFd == -1)
- return(false);
-
- struct termios termio;
-
- // get current modes
- tcgetattr(m_ttyFd, &termio);
-
- // setup for a 'raw' mode. 81N, no echo or special character
- // handling, such as flow control.
- cfmakeraw(&termio);
-
- // set our baud rates
- cfsetispeed(&termio, baud);
- cfsetospeed(&termio, baud);
-
- // make it so
- if (tcsetattr(m_ttyFd, TCSAFLUSH, &termio) < 0)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": tcsetattr() failed: " +
- string(strerror(errno)));
- return false;
- }
-
- return true;
-}
-
-int ZFM20::writeCmdPacket(uint8_t *pkt, int len)
-{
- uint8_t rPkt[ZFM20_MAX_PKT_LEN];
-
- rPkt[0] = ZFM20_START1; // header bytes
- rPkt[1] = ZFM20_START2;
-
- rPkt[2] = (m_address >> 24) & 0xff; // address
- rPkt[3] = (m_address >> 16) & 0xff;
- rPkt[4] = (m_address >> 8) & 0xff;
- rPkt[5] = m_address & 0xff;
-
- rPkt[6] = PKT_COMMAND;
-
- rPkt[7] = ((len + 2) >> 8) & 0xff; // length (+ len bytes)
- rPkt[8] = (len + 2) & 0xff;
-
- // compute the starting checksum
- uint16_t cksum = rPkt[7] + rPkt[8] + PKT_COMMAND;
-
- int j = 9;
- for (int i=0; i<len; i++)
- {
- rPkt[j] = pkt[i];
- cksum += rPkt[j];
- j++;
- }
-
- rPkt[j++] = (cksum >> 8) & 0xff; // store the cksum
- rPkt[j++] = cksum & 0xff;
-
- return writeData((char *)rPkt, j);
-}
-
-void ZFM20::initClock()
-{
- gettimeofday(&m_startTime, NULL);
-}
-
-uint32_t ZFM20::getMillis()
-{
- struct timeval elapsed, now;
- uint32_t elapse;
-
- // get current time
- gettimeofday(&now, NULL);
-
- // compute the delta since m_startTime
- if( (elapsed.tv_usec = now.tv_usec - m_startTime.tv_usec) < 0 )
- {
- elapsed.tv_usec += 1000000;
- elapsed.tv_sec = now.tv_sec - m_startTime.tv_sec - 1;
- }
- else
- {
- elapsed.tv_sec = now.tv_sec - m_startTime.tv_sec;
- }
-
- elapse = (uint32_t)((elapsed.tv_sec * 1000) + (elapsed.tv_usec / 1000));
-
- // never return 0
- if (elapse == 0)
- elapse = 1;
-
- return elapse;
-}
-
-bool ZFM20::verifyPacket(uint8_t *pkt, int len)
-{
- // verify packet header
- if (pkt[0] != ZFM20_START1 || pkt[1] != ZFM20_START2)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": Invalid packet header");
- return false;
- }
-
- // check the ack byte
- if (pkt[6] != PKT_ACK)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": Invalid ACK code");
- return false;
- }
-
- return true;
-}
-
-bool ZFM20::getResponse(uint8_t *pkt, int len)
-{
- char buf[ZFM20_MAX_PKT_LEN];
-
- initClock();
-
- int idx = 0;
- int timer = 0;
- int rv;
- int plen = 0;
-
- while (idx < len)
- {
- // wait for some data
- if (!dataAvailable(100))
- {
- timer += getMillis();
- if (timer > ZFM20_TIMEOUT)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": Timed out waiting for packet");
- return false;
- }
-
- continue;
- }
-
- if ((rv = readData(buf, ZFM20_MAX_PKT_LEN)) == 0)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": readData() failed, no data returned");
- return false;
- }
-
- // copy it into the user supplied buffer
- for (int i=0; i<rv; i++)
- {
- pkt[idx++] = buf[i];
- if (idx >= len)
- break;
- }
- }
-
- // now verify it.
- return verifyPacket(pkt, len);
-}
-
-bool ZFM20::verifyPassword()
-{
- const int pktLen = 5;
- uint8_t pkt[pktLen] = {CMD_VERIFY_PASSWORD,
- static_cast<uint8_t>((m_password >> 24) & 0xff),
- static_cast<uint8_t>((m_password >> 16) & 0xff),
- static_cast<uint8_t>((m_password >> 8) & 0xff),
- static_cast<uint8_t>(m_password & 0xff) };
-
- writeCmdPacket(pkt, pktLen);
-
- // now read a response
- const int rPktLen = 12;
- uint8_t rPkt[rPktLen];
-
- getResponse(rPkt, rPktLen);
-
-
- return true;
-}
-
-int ZFM20::getNumTemplates()
-{
- const int pktLen = 1;
- uint8_t pkt[pktLen] = {CMD_GET_TMPL_COUNT};
-
- writeCmdPacket(pkt, pktLen);
-
- // now read a response
- const int rPktLen = 14;
- uint8_t rPkt[rPktLen];
-
- getResponse(rPkt, rPktLen);
-
- // check confirmation code
- if (rPkt[9] != 0x00)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": Invalid confirmation code");
- return 0;
- }
-
- return ((rPkt[10] << 8) | rPkt[11]);
-}
-
-bool ZFM20::setNewPassword(uint32_t pwd)
-{
- const int pktLen = 5;
- uint8_t pkt[pktLen] = {CMD_SET_PASSWORD,
- static_cast<uint8_t>((pwd >> 24) & 0xff),
- static_cast<uint8_t>((pwd >> 16) & 0xff),
- static_cast<uint8_t>((pwd >> 8) & 0xff),
- static_cast<uint8_t>(pwd & 0xff) };
-
- writeCmdPacket(pkt, pktLen);
-
- // now read a response
- const int rPktLen = 12;
- uint8_t rPkt[rPktLen];
-
- getResponse(rPkt, rPktLen);
-
- // check confirmation code
- if (rPkt[9] != 0x00)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": Invalid confirmation code");
- return false;
- }
-
- m_password = pwd;
-
- return true;
-}
-
-bool ZFM20::setNewAddress(uint32_t addr)
-{
- const int pktLen = 5;
- uint8_t pkt[pktLen] = {CMD_SET_ADDRESS,
- static_cast<uint8_t>((addr >> 24) & 0xff),
- static_cast<uint8_t>((addr >> 16) & 0xff),
- static_cast<uint8_t>((addr >> 8) & 0xff),
- static_cast<uint8_t>(addr & 0xff) };
-
- writeCmdPacket(pkt, pktLen);
-
- // now read a response
- const int rPktLen = 12;
- uint8_t rPkt[rPktLen];
-
- getResponse(rPkt, rPktLen);
-
- // check confirmation code
- if (rPkt[9] != 0x00)
- {
- throw std::runtime_error(std::string(__FUNCTION__) +
- ": Invalid confirmation code");
- return false;
- }
-
- m_address = addr;
-
- return true;
-}
-
-uint8_t ZFM20::generateImage()
-{
- const int pktLen = 1;
- uint8_t pkt[pktLen] = {CMD_GEN_IMAGE};
-
- writeCmdPacket(pkt, pktLen);
-
- // now read a response
- const int rPktLen = 12;
- uint8_t rPkt[rPktLen];
-
- getResponse(rPkt, rPktLen);
-
- return rPkt[9];
-}
-
-uint8_t ZFM20::image2Tz(int slot)
-{
- if (slot != 1 && slot != 2)
- {
- throw std::out_of_range(std::string(__FUNCTION__) +
- ": slot must be 1 or 2");
- return ERR_INTERNAL_ERR;
- }
-
- const int pktLen = 2;
- uint8_t pkt[pktLen] = {CMD_IMG2TZ,
- static_cast<uint8_t>(slot & 0xff)};
-
- writeCmdPacket(pkt, pktLen);
-
- // now read a response
- const int rPktLen = 12;
- uint8_t rPkt[rPktLen];
-
- getResponse(rPkt, rPktLen);
-
- return rPkt[9];
-}
-
-uint8_t ZFM20::createModel()
-{
- const int pktLen = 1;
- uint8_t pkt[pktLen] = {CMD_REGMODEL};
-
- writeCmdPacket(pkt, pktLen);
-
- // now read a response
- const int rPktLen = 12;
- uint8_t rPkt[rPktLen];
-
- getResponse(rPkt, rPktLen);
-
- return rPkt[9];
-}
-
-uint8_t ZFM20::storeModel(int slot, uint16_t id)
-{
- if (slot != 1 && slot != 2)
- {
- throw std::out_of_range(std::string(__FUNCTION__) +
- ": slot must be 1 or 2");
- return ERR_INTERNAL_ERR;
- }
-
- const int pktLen = 4;
- uint8_t pkt[pktLen] = {CMD_STORE,
- static_cast<uint8_t>(slot & 0xff),
- static_cast<uint8_t>((id >> 8) & 0xff),
- static_cast<uint8_t>(id & 0xff)};
-
- writeCmdPacket(pkt, pktLen);
-
- // now read a response
- const int rPktLen = 12;
- uint8_t rPkt[rPktLen];
-
- getResponse(rPkt, rPktLen);
-
- return rPkt[9];
-}
-
-uint8_t ZFM20::deleteModel(uint16_t id)
-{
- const int pktLen = 5;
- uint8_t pkt[pktLen] = {CMD_DELETE_TMPL,
- static_cast<uint8_t>((id >> 8) & 0xff),
- static_cast<uint8_t>(id & 0xff),
- 0x00,
- 0x01};
-
- writeCmdPacket(pkt, pktLen);
-
- // now read a response
- const int rPktLen = 12;
- uint8_t rPkt[rPktLen];
-
- getResponse(rPkt, rPktLen);
-
- return rPkt[9];
-}
-
-uint8_t ZFM20::deleteDB()
-{
- const int pktLen = 1;
- uint8_t pkt[pktLen] = {CMD_EMPTYDB};
-
- writeCmdPacket(pkt, pktLen);
-
- // now read a response
- const int rPktLen = 12;
- uint8_t rPkt[rPktLen];
-
- getResponse(rPkt, rPktLen);
-
- return rPkt[9];
-}
-
-uint8_t ZFM20::search(int slot, uint16_t *id, uint16_t *score)
-{
- *id = 0;
- *score = 0;
-
- if (slot != 1 && slot != 2)
- {
- throw std::out_of_range(std::string(__FUNCTION__) +
- ": slot must be 1 or 2");
- return ERR_INTERNAL_ERR;
- }
-
- // search from page 0x0000 to page 0x00a3
- const int pktLen = 6;
- uint8_t pkt[pktLen] = {CMD_SEARCH,
- static_cast<uint8_t>(slot & 0xff),
- 0x00,
- 0x00,
- 0x00,
- 0xa3};
-
- writeCmdPacket(pkt, pktLen);
-
- // now read a response
- const int rPktLen = 16;
- uint8_t rPkt[rPktLen];
-
- getResponse(rPkt, rPktLen);
-
- // if it was found, extract the location and the score
- if (rPkt[9] == ERR_OK)
- {
- *id = ((rPkt[10] << 8) & 0xff) | (rPkt[11] & 0xff);
- *score = ((rPkt[12] << 8) & 0xff) | (rPkt[13] & 0xff);
- }
-
- return rPkt[9];
-}
-
-uint8_t ZFM20::match(uint16_t *score)
-{
- *score = 0;
-
- const int pktLen = 1;
- uint8_t pkt[pktLen] = {CMD_MATCH};
-
- writeCmdPacket(pkt, pktLen);
-
- // now read a response
- const int rPktLen = 14;
- uint8_t rPkt[rPktLen];
-
- getResponse(rPkt, rPktLen);
-
- *score = ((rPkt[10] << 8) & 0xff) | (rPkt[11] & 0xff);
-
- return rPkt[9];
-}
-
-
diff --git a/peripheral/libupm/src/zfm20/zfm20.h b/peripheral/libupm/src/zfm20/zfm20.h
deleted file mode 100644
index 91ae18b..0000000
--- a/peripheral/libupm/src/zfm20/zfm20.h
+++ /dev/null
@@ -1,379 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Thanks to Adafruit for supplying a google translated version of the
- * Chinese datasheet and some clues in their code.
- *
- * 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 <string>
-#include <iostream>
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <termios.h>
-#include <sys/time.h>
-#include <sys/select.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include <mraa/uart.h>
-
-#define ZFM20_DEFAULT_UART 0
-
-// protocol start codes
-#define ZFM20_START1 0xef
-#define ZFM20_START2 0x01
-
-#define ZFM20_MAX_PKT_LEN 256
-
-#define ZFM20_TIMEOUT 5000 // in ms
-
-#define ZFM20_DEFAULT_PASSWORD 0x00000000
-#define ZFM20_DEFAULT_ADDRESS 0xffffffff
-
-
-namespace upm {
- /**
- * @brief ZFM-20 Fingerprint Sensor Module library
- * @defgroup zfm20 libupm-zfm20
- * @ingroup seeed uart touch
- */
-
- /**
- * @library zfm20
- * @sensor zfm20
- * @comname ZFM-20 Fingerprint Sensor
- * @altname Grove Fingerprint Sensor
- * @type touch
- * @man seeed
- * @con uart
- *
- * @brief API for the ZFM-20 Fingerprint Sensor Module
- *
- * This class was tested on the Grove Fingerprint Sensor
- * Module. It can store up to 163 fingerprints.
- *
- * It is connected via a UART at 57,600 baud.
- *
- * @image html zfm20.jpg
- * This example demonstrates how to register and store a new fingerprint
- * @snippet zfm20-register.cxx Interesting
- * This example demonstrates reading a fingerprint and locating it in the DB
- * @snippet zfm20.cxx Interesting
- */
- class ZFM20 {
- public:
-
- // commands
- typedef enum {
- CMD_GEN_IMAGE = 0x01,
- CMD_IMG2TZ = 0x02,
- CMD_MATCH = 0x03,
- CMD_SEARCH = 0x04,
- CMD_REGMODEL = 0x05,
- CMD_STORE = 0x06,
- CMD_LOAD_TMPL = 0x07,
- CMD_UPLOAD_TMPL = 0x08,
- CMD_DOWNLOAD_TMPL = 0x09,
- CMD_UPLOAD_IMAGE = 0x0a,
- CMD_DOWNLOAD_IMAGE = 0x0b,
- CMD_DELETE_TMPL = 0x0c,
- CMD_EMPTYDB = 0x0d,
- CMD_SET_SYSPARAMS = 0x0e,
- CMD_GET_SYSPARAMS = 0x0f,
- CMD_SET_PASSWORD = 0x12,
- CMD_VERIFY_PASSWORD = 0x13,
- CMD_GET_RANDOM_NUMBER = 0x14,
- CMD_SET_ADDRESS = 0x15,
- CMD_GET_TMPL_COUNT = 0x1d,
- CMD_GET_INDEX_TABLE = 0x1f
- } ZFM20_COMMAND_T;
-
- // Error response codes
- typedef enum {
- ERR_OK = 0x00,
- ERR_PACKET_RX_ERROR = 0x01,
- ERR_NO_FINGER = 0x02,
- ERR_FP_IMAGE_FAILED = 0x03,
- ERR_FP_TOO_MESSY = 0x06,
- ERR_FP_IMAGE_FEW_FEATURES = 0x07,
- ERR_FP_NOMATCH = 0x08,
- ERR_FP_NOTFOUND = 0x09,
- ERR_FP_ENROLLMISMATCH = 0x0a,
- ERR_BAD_LOCATION = 0x0b,
- ERR_DB_ERROR = 0x0c,
- ERR_UPLOAD_FEAT_FAILED = 0x0d,
- ERR_NO_MORE_PACKETS = 0x0e,
- ERR_UPLOAD_IMG_FAILED = 0x0f,
- ERR_RM_TMPL_FAILED = 0x10,
- ERR_EMPTY_DB_FAILED = 0x11,
- ERR_INVALID_PWD = 0x13,
- ERR_INVALID_IMAGE = 0x15,
- ERR_RW_FLASH_ERROR = 0x18,
- ERR_INVALID_REG = 0x1a,
- ERR_INVALID_ADDR = 0x20,
- ERR_NEEDS_PWD = 0x21,
- // end of module-specific errors
- ERR_INTERNAL_ERR = 0xff // API internal error
- } ZFM20_ERRORS_T;
-
- typedef enum {
- PKT_COMMAND = 0x01,
- PKT_DATA = 0x02,
- PKT_ACK = 0x07,
- PKT_END_DATA = 0x08
- } ZFM20_PKTCODES_T;
-
- /**
- * ZFM20 constructor
- *
- * @param uart Default UART to use (0 or 1)
- */
- ZFM20(int uart);
-
- /**
- * ZFM20 destructor
- */
- ~ZFM20();
-
- /**
- * Checks to see if there is data available for reading
- *
- * @param millis Number of milliseconds to wait; 0 means no waiting
- * @return true if there is data available for reading
- */
- bool dataAvailable(unsigned int millis);
-
- /**
- * Reads any available data in a user-supplied buffer. Note: the
- * call blocks until data is available to be read. Use
- * dataAvailable() to determine whether there is data available
- * beforehand, to avoid blocking.
- *
- * @param buffer Buffer to hold the data read
- * @param len Length of the buffer
- * @return Number of bytes read
- */
- int readData(char *buffer, int len);
-
- /**
- * Writes the data in the buffer to the device
- *
- * @param buffer Buffer to hold the data read
- * @param len Length of the buffer
- * @return Number of bytes written
- */
- int writeData(char *buffer, int len);
-
- /**
- * Sets up proper tty I/O modes and the baud rate. For this device,
- * the default baud rate is 57,600 (B57600).
- *
- * @param baud Desired baud rate.
- * @return True if successful
- */
- bool setupTty(speed_t baud=B57600);
-
- /**
- * Composes and writes a command packet
- *
- * @param pkt Packet
- * @param len Length of packet
- * @return Number of bytes written
- */
- int writeCmdPacket(uint8_t *pkt, int len);
-
- /**
- * Verifies the packet header and indicates its validity
- *
- * @param pkt Packet to check
- * @param len Length of packet
- * @return True if the packet is valid, false otherwise
- */
- bool verifyPacket(uint8_t *pkt, int len);
-
- /**
- * Returns the number of milliseconds elapsed since initClock()
- * was last called
- *
- * @return Elapsed milliseconds
- */
- uint32_t getMillis();
-
- /**
- * Resets the clock
- *
- */
- void initClock();
-
- /**
- * Sets the address that should be used to access the module
- *
- * @param addr Address to use
- */
- void setAddress(uint32_t addr) { m_address = addr; };
-
- /**
- * Sets the password that should be used to access the module
- *
- * @param pw Password to use
- */
- void setPassword(uint32_t pw) { m_password = pw; };
-
- /**
- * Gets the returned data from a request
- *
- * @param pkt Buffer to store the returned data
- * @param len Expected response length; pkt should be at least this
- * large
- * @return True if successful
- */
- bool getResponse(uint8_t *pkt, int len);
-
- /**
- * Verifies and authenticates to the module. The password used is
- * the last one set by setPassword().
- *
- * @return True if successful
- */
- bool verifyPassword();
-
- /**
- * Queries the module for the number of stored templates
- * (fingerprints).
- *
- * @return Number of currently stored templates
- */
- int getNumTemplates();
-
- /**
- * Sets a new password for the module. This passowrd is
- * stored in the module, and is required to access
- * the module in the future.
- *
- * @param pwd New password to set on the module
- * @return True if successful
- */
- bool setNewPassword(uint32_t pwd);
-
- /**
- * Sets a new address for the module. This address is
- * stored in the module, and is required to access
- * the module in the future.
- *
- * @param addr New address to set on the module
- * @return True if successful
- */
- bool setNewAddress(uint32_t addr);
-
- /**
- * Generates a new fingerprint image (scans a fingerprint)
- *
- * @return One of the ZFM20_ERRORS_T values
- */
- uint8_t generateImage();
-
- /**
- * Converts the image in the image buffer (generated by
- * generateImage()) and stores it in one of the two characteristics
- * buffers, 1 or 2
- *
- * @param slot Characteristics buffer to use; must be 1 or 2
- * @return One of the ZFM20_ERRORS_T values
- */
- uint8_t image2Tz(int slot);
-
- /**
- * Based on the two characteristics buffers (1 & 2), creates a
- * fingerprint model. Once a model is successfully created,
- * it can be stored in the module with storeModel().
- *
- * @return One of the ZFM20_ERRORS_T values
- */
- uint8_t createModel();
-
- /**
- * Once a fingerprint model is created, this method can be
- * used to store it (via one of the characteristics buffers) in a
- * given location.
- *
- * @param slot Characteristics buffer to store the model, 1 or 2
- * @param id Location to store the model
- * @return One of the ZFM20_ERRORS_T values
- */
- uint8_t storeModel(int slot, uint16_t id);
-
- /**
- * Deletes a stored model
- *
- * @param id Location containing the model to delete
- * @return One of the ZFM20_ERRORS_T values
- */
- uint8_t deleteModel(uint16_t id);
-
- /**
- * Deletes the model database (DB)
- *
- * @return One of the ZFM20_ERRORS_T values
- */
- uint8_t deleteDB();
-
- /**
- * Searches the fingerprint DB and returns an ID and score, if found
- *
- *
- * @param slot Slot containing a converted image to search for
- * @param id ID if found, 0 otherwise
- * @param score Score if found, 0 otherwise
- * @return One of the ZFM20_ERRORS_T values
- */
- uint8_t search(int slot, uint16_t *id, uint16_t *score);
-
- /**
- * Compares the features in characteristics buffers 1 and 2 and
- * returns a score if they match
- *
- * @param score Score
- * @return One of the ZFM20_ERRORS_T values
- */
- uint8_t match(uint16_t *score);
-
-
- protected:
- int ttyFd() { return m_ttyFd; };
-
- private:
- mraa_uart_context m_uart;
- int m_ttyFd;
- uint32_t m_password;
- uint32_t m_address;
- struct timeval m_startTime;
- };
-}
-
-
diff --git a/peripheral/libupm/tests/CMakeLists.txt b/peripheral/libupm/tests/CMakeLists.txt
deleted file mode 100644
index 62c39eb..0000000
--- a/peripheral/libupm/tests/CMakeLists.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-add_test (NAME check_consistency COMMAND ${PYTHON_EXECUTABLE}
- ${CMAKE_CURRENT_SOURCE_DIR}/check_consistency.py
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
-
-if (BUILDSWIGJAVA)
- add_test (NAME check_autoloadlibrary COMMAND ${PYTHON_EXECUTABLE}
- ${CMAKE_CURRENT_SOURCE_DIR}/check_autoloadlibrary.py
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
-
- add_test (NAME check_samplenames COMMAND ${PYTHON_EXECUTABLE}
- ${CMAKE_CURRENT_SOURCE_DIR}/check_samplenames.py
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
-
- add_test (NAME check_clean COMMAND ${PYTHON_EXECUTABLE}
- ${CMAKE_CURRENT_SOURCE_DIR}/check_clean.py
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
-endif ()
diff --git a/peripheral/libupm/tests/check_autoloadlibrary.py b/peripheral/libupm/tests/check_autoloadlibrary.py
deleted file mode 100644
index 29bf490..0000000
--- a/peripheral/libupm/tests/check_autoloadlibrary.py
+++ /dev/null
@@ -1,44 +0,0 @@
-#!/usr/bin/python
-
-import unittest as u
-import re, fnmatch, os
-
-rootDir = '../src/'
-prefix = """
-%pragma(java) jniclasscode=%{
- static {
- try {
- System.loadLibrary(\""""
-
-sufix = """\");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. \\n" + e);
- System.exit(1);
- }
- }
-%}"""
-
-class AutoLoadLibrary(u.TestCase):
-
- def test_existing_snippet(self):
- broken_modules = []
-
- for subdir, dirs, files in os.walk(rootDir):
- for fileName in files:
- if fnmatch.fnmatch(fileName, 'javaupm_*.i'):
- moduleName = fileName[:-2]
- snippet = prefix + moduleName + sufix
-
- with open(os.path.join(subdir, fileName), "r") as f:
- if not snippet in f.read():
- broken_modules.append(moduleName)
-
- self.assertEqual( len(broken_modules), 0,
- "\nThe following modules do not contain the standard auto load library code:\n" + \
- "\n".join(broken_modules) + \
- "\nConsider adding the following snippet to the SWIG interface file:\n" + \
- prefix + "<module_name>" + sufix)
-
-
-if __name__ == '__main__':
- u.main()
diff --git a/peripheral/libupm/tests/check_clean.py b/peripheral/libupm/tests/check_clean.py
deleted file mode 100644
index 2031803..0000000
--- a/peripheral/libupm/tests/check_clean.py
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/usr/bin/python
-
-import unittest as u
-import re, fnmatch, os
-
-rootDir = '../build/src/'
-swigtypeStr = 'SWIGTYPE'
-
-class Clean(u.TestCase):
-
- def test_existing_swigtype(self):
- unclean = []
-
- for dirName in os.listdir(rootDir):
- dirPath = os.path.join(rootDir, dirName)
- if not os.path.isdir(dirPath):
- continue
-
- ok = True
- for subdir, dirs, files in os.walk(dirPath):
- if not ok:
- break
- for fileName in files:
- if swigtypeStr in fileName:
- unclean.append(dirName)
- ok = False
- break
-
- self.assertEqual( len(unclean), 0,
- "\nThe following modules have unclean Java bindings:\n" + \
- "\n".join(unclean) + "\n\n" + \
- "Consider adding them to the SWIGJAVA blacklist")
-
-if __name__ == '__main__':
- u.main()
diff --git a/peripheral/libupm/tests/check_consistency.py b/peripheral/libupm/tests/check_consistency.py
deleted file mode 100644
index c1308f8..0000000
--- a/peripheral/libupm/tests/check_consistency.py
+++ /dev/null
@@ -1,60 +0,0 @@
-#!/usr/bin/python
-
-import unittest as u
-import re, fnmatch, os
-
-rootDir = '../src/'
-javaBlacklistFile = '../src/javaswig_blacklist'
-pythonBlacklistFile = '../src/pythonswig_blacklist'
-nodeBlacklistFile = '../src/nodeswig_blacklist'
-
-
-class BlacklistConsistency(u.TestCase):
-
- def test_java_blacklist(self):
-
- with open(javaBlacklistFile) as f:
- blacklist = [line.rstrip('\n') for line in f]
-
- for libraryName in blacklist:
- files = os.listdir( os.path.join(rootDir, libraryName))
- interfaceFileName = "javaupm_" + libraryName + ".i"
-
- if interfaceFileName in files:
- self.fail("\n" + libraryName + " is in javaswig blacklist.\n" + \
- "Remove it from blacklist or remove " + \
- interfaceFileName + " from sources.")
-
-
- def test_python_blacklist(self):
-
- with open(pythonBlacklistFile) as f:
- blacklist = [line.rstrip('\n') for line in f]
-
- for libraryName in blacklist:
- files = os.listdir( os.path.join(rootDir, libraryName))
- interfaceFileName = "pyupm_" + libraryName + ".i"
-
- if interfaceFileName in files:
- self.fail("\n" + libraryName + " is in pythonswig blacklist.\n" + \
- "Remove it from blacklist or remove " + \
- interfaceFileName + " from sources.")
-
-
- def test_node_blacklist(self):
-
- with open(nodeBlacklistFile) as f:
- blacklist = [line.rstrip('\n') for line in f]
-
- for libraryName in blacklist:
- files = os.listdir( os.path.join(rootDir, libraryName))
- interfaceFileName = "jsupm_" + libraryName + ".i"
-
- if interfaceFileName in files:
- self.fail("\n" + libraryName + " is in nodeswig blacklist.\n" + \
- "Remove it from blacklist or remove " + \
- interfaceFileName + " from sources.")
-
-
-if __name__ == '__main__':
- u.main()
diff --git a/peripheral/libupm/tests/check_samplenames.py b/peripheral/libupm/tests/check_samplenames.py
deleted file mode 100644
index c1edcc2..0000000
--- a/peripheral/libupm/tests/check_samplenames.py
+++ /dev/null
@@ -1,53 +0,0 @@
-#!/usr/bin/python
-
-import unittest as u
-import re, fnmatch, os, sys
-
-sampleMappingFile = '../doxy/samples.mapping.txt'
-cSamplesDir = '../examples/c++/'
-javaSamplesDir = '../examples/java/'
-
-
-class SampleNames(u.TestCase):
-
- def test_existing_samples(self):
- missing_c_files = []
- missing_java_files = []
-
- with open (sampleMappingFile, "r") as f:
- for line in f:
- sampleNames = line.split();
-
- cSampleName = sampleNames[0]
- if not cSampleName.endswith('.cxx'):
- continue
-
- javaSampleName = sampleNames[1]
- if not javaSampleName.endswith('.java'):
- continue
-
- ok = False
- for file in os.listdir(cSamplesDir):
- if file == cSampleName:
- ok = True
- break
-
- if not ok:
- missing_c_files.append(cSampleName)
-
- 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), 0,
- "\nThe following files are missing from samples:\n" + \
- "\n".join(missing_c_files) + "\n" + "\n".join(missing_java_files))
-
-if __name__ == '__main__':
- u.main()
-
diff --git a/peripheral/light/mraa/hal.mk b/peripheral/light/mraa/hal.mk
deleted file mode 100644
index 6958690..0000000
--- a/peripheral/light/mraa/hal.mk
+++ /dev/null
@@ -1,24 +0,0 @@
-# Copyright 2013 The Android Open Source Project
-#
-# 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_SRC_FILES := lights.c
-LOCAL_MODULE_RELATIVE_PATH := hw
-LOCAL_SHARED_LIBRARIES := liblog libmraa
-LOCAL_MODULE := lights.$(TARGET_DEVICE)
-LOCAL_MODULE_TAGS := optional
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/peripheral/light/mraa/lights.c b/peripheral/light/mraa/lights.c
deleted file mode 100644
index 0eda445..0000000
--- a/peripheral/light/mraa/lights.c
+++ /dev/null
@@ -1,543 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * 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.
- */
-
-/*
- * Based on htc/flounder/lights/lights.h
- */
-
-#define LOG_TAG "lights"
-
-#include <malloc.h>
-#include <string.h>
-#include <unistd.h>
-#include <errno.h>
-#include <cutils/log.h>
-#include <hardware/lights.h>
-#include <hardware/hardware.h>
-#include <gpio.h>
-
-/* List of supported lights */
-typedef enum {
- NOTIFICATIONS_TYPE,
- LIGHTS_TYPE_NUM
-} light_type_t;
-
-/* Light device data structure */
-struct light_device_ext_t {
- /* Base device */
- struct light_device_t base_dev;
- /* Physical pin */
- int pin;
- /* Current state of the light device */
- struct light_state_t state;
- /* Number of device references */
- int refs;
- /* Synchronization attributes */
- pthread_t flash_thread;
- pthread_cond_t flash_cond;
- pthread_mutex_t flash_signal_mutex;
- pthread_mutex_t write_mutex;
- /* Transform function to apply on value */
- int (*transform)(int);
-};
-
-static int64_t const ONE_MS_IN_NS = 1000000LL;
-static int64_t const ONE_S_IN_NS = 1000000000LL;
-
-/*
- * Platform version strings used to identify board versions
- */
-static char * const EDISON_ARDUINO_PLATFORM_VERSION = "arduino";
-static char * const MINNOWBOARD_TURBOT_PLATFORM_VERSION = "Turbot";
-
-/*
- * Pin constants
- * Please add a pin to EDISON_ARDUINO_PINS, EDISON_MINIBOARD_PINS &
- * MINNOWBOARD_MAX_PINS when you add a new light type
- */
-static int const EDISON_ARDUINO_PINS[LIGHTS_TYPE_NUM] = {13};
-static int const EDISON_MINIBOARD_PINS[LIGHTS_TYPE_NUM] = {31};
-static int const MINNOWBOARD_MAX_PINS[LIGHTS_TYPE_NUM] = {21};
-static int const MINNOWBOARD_TURBOT_PINS[LIGHTS_TYPE_NUM] = {27};
-
-/*
- * Array of light devices with write_mutex statically initialized
- * to be able to synchronize the open_lights & close_lights functions
- */
-struct light_device_ext_t light_devices[] = {
- [ 0 ... (LIGHTS_TYPE_NUM - 1) ] = { .write_mutex = PTHREAD_MUTEX_INITIALIZER }
-};
-
-/*
- * Set the GPIO value
- * @param pin physical pin of the GPIO
- * @param value what value to set
- * @return 0 if success, error code otherwise
- */
-static int set_gpio_value(int pin, int value)
-{
- mraa_gpio_context gpio = NULL;
- int rc = 0;
-
- if ((value != 0) && (value != 1)) {
- return EINVAL;
- }
-
- gpio = mraa_gpio_init(pin);
- if (gpio == NULL) {
- return EPERM;
- }
-
- if (mraa_gpio_dir(gpio, MRAA_GPIO_OUT) != MRAA_SUCCESS) {
- rc = EPERM;
- goto close_gpio;
- }
-
- if (mraa_gpio_write(gpio, value) != MRAA_SUCCESS) {
- rc = EPERM;
- }
-
-close_gpio:
- if (mraa_gpio_close(gpio) != MRAA_SUCCESS) {
- rc = EPERM;
- }
-
- return rc;
-}
-
-/*
- * Invert value
- * @param value what value to invert
- * @return value inverted
- */
-static int invert_value(int value) {
- return value ? 0 : 1;
-}
-
-/*
- * Get current timestamp in nanoseconds
- * @return time in nanoseconds
- */
-int64_t get_timestamp_monotonic()
-{
- struct timespec ts = {0, 0};
-
- if (!clock_gettime(CLOCK_MONOTONIC, &ts)) {
- return ONE_S_IN_NS * ts.tv_sec + ts.tv_nsec;
- }
-
- return -1;
-}
-
-/*
- * Populates a timespec data structure from a int64_t timestamp
- * @param out what timespec to populate
- * @param target_ns timestamp in nanoseconds
- */
-void set_timestamp(struct timespec *out, int64_t target_ns)
-{
- out->tv_sec = target_ns / ONE_S_IN_NS;
- out->tv_nsec = target_ns % ONE_S_IN_NS;
-}
-
-/*
- * pthread routine which flashes an LED
- * @param flash_param light device pointer
- */
-static void * flash_routine (void *flash_param)
-{
- struct light_device_ext_t *dev = (struct light_device_ext_t *)flash_param;
- struct light_state_t *flash_state;
- int color = 0, rc = 0;
- struct timespec target_time;
- int64_t timestamp, period;
-
- if (dev == NULL) {
- ALOGE("%s: Cannot flash a NULL light device", __func__);
- return NULL;
- }
-
- flash_state = &dev->state;
-
- pthread_mutex_lock(&dev->flash_signal_mutex);
-
- color = flash_state->color;
-
- /* Light flashing loop */
- while (flash_state->flashMode) {
- rc = set_gpio_value(dev->pin, color);
- if (rc != 0) {
- ALOGE("%s: Cannot set light color", __func__);
- goto mutex_unlock;
- }
-
- timestamp = get_timestamp_monotonic();
- if (timestamp < 0) {
- ALOGE("%s: Cannot get time from monotonic clock", __func__);
- goto mutex_unlock;
- }
-
- if (color) {
- color = 0;
- period = flash_state->flashOnMS * ONE_MS_IN_NS;
- } else {
- color = 1;
- period = flash_state->flashOffMS * ONE_MS_IN_NS;
- }
-
- /* check for overflow */
- if (timestamp > LLONG_MAX - period) {
- ALOGE("%s: Timestamp overflow", __func__);
- goto mutex_unlock;
- }
-
- timestamp += period;
-
- /* sleep until target_time or the cond var is signaled */
- set_timestamp(&target_time, timestamp);
- rc = pthread_cond_timedwait(&dev->flash_cond, &dev->flash_signal_mutex, &target_time);
- if ((rc != 0) && (rc != ETIMEDOUT)) {
- ALOGE("%s: pthread_cond_timedwait returned an error", __func__);
- goto mutex_unlock;
- }
- }
-
-mutex_unlock:
- pthread_mutex_unlock(&dev->flash_signal_mutex);
-
- return NULL;
-}
-
-/*
- * Check lights flash state
- * @param state pointer to the state to check
- * @return 0 if success, error code otherwise
- */
-static int check_flash_state(struct light_state_t const *state)
-{
- int64_t ns = 0;
-
- if ((state->flashOffMS < 0) || (state->flashOnMS < 0)) {
- return EINVAL;
- }
-
- if ((state->flashOffMS == 0) && (state->flashOnMS) == 0) {
- return EINVAL;
- }
-
- /* check for overflow in ns */
- ns = state->flashOffMS * ONE_MS_IN_NS;
- if (ns / ONE_MS_IN_NS != state->flashOffMS) {
- return EINVAL;
- }
- ns = state->flashOnMS * ONE_MS_IN_NS;
- if (ns / ONE_MS_IN_NS != state->flashOnMS) {
- return EINVAL;
- }
-
- return 0;
-}
-
-/*
- * Generic function for setting the state of the light
- * @param base_dev light device data structure
- * @param state what state to set
- * @return 0 if success, error code otherwise
- */
-static int set_light_generic(struct light_device_t *base_dev,
- struct light_state_t const *state)
-{
- struct light_device_ext_t *dev = (struct light_device_ext_t *)base_dev;
- struct light_state_t *current_state;
- int rc = 0;
-
- if (dev == NULL) {
- ALOGE("%s: Cannot set state for NULL device", __func__);
- return EINVAL;
- }
-
- current_state = &dev->state;
-
- pthread_mutex_lock(&dev->write_mutex);
-
- if (dev->refs == 0) {
- ALOGE("%s: The light device is not opened", __func__);
- pthread_mutex_unlock(&dev->write_mutex);
- return EINVAL;
- }
-
- ALOGV("%s: flashMode:%x, color:%x", __func__, state->flashMode, state->color);
-
- if (current_state->flashMode) {
- /* destroy flashing thread */
- pthread_mutex_lock(&dev->flash_signal_mutex);
- current_state->flashMode = LIGHT_FLASH_NONE;
- pthread_cond_signal(&dev->flash_cond);
- pthread_mutex_unlock(&dev->flash_signal_mutex);
- pthread_join(dev->flash_thread, NULL);
- }
-
- *current_state = *state;
- if (dev->transform != NULL) {
- current_state->color = dev->transform(current_state->color);
- }
-
- if (current_state->flashMode) {
- /* start flashing thread */
- if (check_flash_state(current_state) == 0) {
- rc = pthread_create(&dev->flash_thread, NULL,
- flash_routine, (void *)dev);
- if (rc != 0) {
- ALOGE("%s: Cannot create flashing thread", __func__);
- current_state->flashMode = LIGHT_FLASH_NONE;
- }
- } else {
- ALOGE("%s: Flash state is invalid", __func__);
- current_state->flashMode = LIGHT_FLASH_NONE;
- }
- } else {
- rc = set_gpio_value(dev->pin, current_state->color);
- if (rc != 0) {
- ALOGE("%s: Cannot set light color.", __func__);
- }
- }
-
- pthread_mutex_unlock(&dev->write_mutex);
-
- return rc;
-}
-
-/*
- * Initialize light synchronization resources
- * @param cond what condition variable to initialize
- * @param signal_mutex what mutex (associated with the condvar) to initialize
- * @return 0 if success, error code otherwise
- */
-static int init_light_sync_resources(pthread_cond_t *cond,
- pthread_mutex_t *signal_mutex)
-{
- int rc = 0;
- pthread_condattr_t condattr;
-
- rc = pthread_condattr_init(&condattr);
- if (rc != 0) {
- ALOGE("%s: Cannot initialize the pthread condattr", __func__);
- return rc;
- }
-
- rc = pthread_condattr_setclock(&condattr, CLOCK_MONOTONIC);
- if (rc != 0) {
- ALOGE("%s: Cannot set the clock of condattr to monotonic", __func__);
- goto destroy_condattr;
- }
-
- rc = pthread_cond_init(cond, &condattr);
- if (rc != 0) {
- ALOGE("%s: Cannot intialize the pthread structure", __func__);
- goto destroy_condattr;
- }
-
- rc = pthread_mutex_init(signal_mutex, NULL);
- if (rc != 0) {
- ALOGE("%s: Cannot initialize the mutex associated with the pthread cond", __func__);
- goto destroy_cond;
- }
-
- pthread_condattr_destroy(&condattr);
- return rc;
-
-destroy_cond:
- pthread_cond_destroy(cond);
-destroy_condattr:
- pthread_condattr_destroy(&condattr);
- return rc;
-}
-
-/*
- * Free light synchronization resources
- * @param cond what condition variable to free
- * @param signal_mutex what mutex (associated with the condvar) to free
- */
-static void free_light_sync_resources(pthread_cond_t *cond,
- pthread_mutex_t *signal_mutex)
-{
- pthread_mutex_destroy(signal_mutex);
- pthread_cond_destroy(cond);
-}
-
-/*
- * Close the lights module
- * @param base_dev light device data structure
- * @return 0 if success, error code otherwise
- */
-static int close_lights(struct light_device_t *base_dev)
-{
- struct light_device_ext_t *dev = (struct light_device_ext_t *)base_dev;
- int rc = 0;
-
- if (dev == NULL) {
- ALOGE("%s: Cannot deallocate a NULL light device", __func__);
- return EINVAL;
- }
-
- pthread_mutex_lock(&dev->write_mutex);
-
- if (dev->refs == 0) {
- /* the light device is not open */
- rc = EINVAL;
- goto mutex_unlock;
- } else if (dev->refs > 1) {
- goto dec_refs;
- }
-
- if (dev->state.flashMode) {
- /* destroy flashing thread */
- pthread_mutex_lock(&dev->flash_signal_mutex);
- dev->state.flashMode = LIGHT_FLASH_NONE;
- pthread_cond_signal(&dev->flash_cond);
- pthread_mutex_unlock(&dev->flash_signal_mutex);
- pthread_join(dev->flash_thread, NULL);
- }
-
- free_light_sync_resources(&dev->flash_cond,
- &dev->flash_signal_mutex);
-
-dec_refs:
- dev->refs--;
-
-mutex_unlock:
- pthread_mutex_unlock(&dev->write_mutex);
-
- return rc;
-}
-
-/*
- * Module initialization routine which detects the LEDs' GPIOs
- * @param type light device type
- * @return 0 if success, error code otherwise
- */
-static int init_module(int type)
-{
- const char *platform_version = NULL;
-
- if (type < 0 || type >= LIGHTS_TYPE_NUM) {
- return EINVAL;
- }
-
- light_devices[type].transform = NULL;
-
- switch(mraa_get_platform_type()) {
- case MRAA_INTEL_EDISON_FAB_C:
- platform_version = mraa_get_platform_version(MRAA_MAIN_PLATFORM_OFFSET);
- if ((platform_version != NULL) && (strncmp(platform_version,
- EDISON_ARDUINO_PLATFORM_VERSION,
- strlen(EDISON_ARDUINO_PLATFORM_VERSION)) == 0)) {
- light_devices[type].pin = EDISON_ARDUINO_PINS[type];
- } else {
- light_devices[type].pin = EDISON_MINIBOARD_PINS[type];
- }
- break;
- case MRAA_INTEL_MINNOWBOARD_MAX:
- platform_version = mraa_get_platform_version(MRAA_MAIN_PLATFORM_OFFSET);
- if ((platform_version != NULL) && (strncmp(platform_version,
- MINNOWBOARD_TURBOT_PLATFORM_VERSION,
- strlen(MINNOWBOARD_TURBOT_PLATFORM_VERSION)) == 0)) {
- light_devices[type].pin = MINNOWBOARD_TURBOT_PINS[type];
- light_devices[type].transform = invert_value;
- } else {
- light_devices[type].pin = MINNOWBOARD_MAX_PINS[type];
- }
- break;
- default:
- ALOGE("%s: Hardware platform not supported", __func__);
- return EINVAL;
- }
-
- return 0;
-}
-
-/*
- * Open a new lights device instance by name
- * @param module associated hw module data structure
- * @param name lights device name
- * @param device where to store the pointer of the allocated device
- * @return 0 if success, error code otherwise
- */
-static int open_lights(const struct hw_module_t *module, char const *name,
- struct hw_device_t **device)
-{
- struct light_device_ext_t *dev;
- int rc = 0, type = -1;
-
- ALOGV("%s: Opening %s lights module", __func__, name);
-
- if (0 == strcmp(LIGHT_ID_NOTIFICATIONS, name)) {
- type = NOTIFICATIONS_TYPE;
- } else {
- return EINVAL;
- }
-
- dev = (struct light_device_ext_t *)(light_devices + type);
-
- pthread_mutex_lock(&dev->write_mutex);
-
- if (dev->refs != 0) {
- /* already opened; nothing to do */
- goto inc_refs;
- }
-
- rc = init_module(type);
- if (rc != 0) {
- ALOGE("%s: Failed to initialize lights module", __func__);
- goto mutex_unlock;
- }
-
- rc = init_light_sync_resources(&dev->flash_cond,
- &dev->flash_signal_mutex);
- if (rc != 0) {
- goto mutex_unlock;
- }
-
- dev->base_dev.common.tag = HARDWARE_DEVICE_TAG;
- dev->base_dev.common.version = 0;
- dev->base_dev.common.module = (struct hw_module_t *)module;
- dev->base_dev.common.close = (int (*)(struct hw_device_t *))close_lights;
- dev->base_dev.set_light = set_light_generic;
-
-inc_refs:
- dev->refs++;
- *device = (struct hw_device_t *)dev;
-
-mutex_unlock:
- pthread_mutex_unlock(&dev->write_mutex);
- return rc;
-}
-
-static struct hw_module_methods_t lights_methods =
-{
- .open = open_lights,
-};
-
-struct hw_module_t HAL_MODULE_INFO_SYM =
-{
- .tag = HARDWARE_MODULE_TAG,
- .version_major = 1,
- .version_minor = 0,
- .id = LIGHTS_HARDWARE_MODULE_ID,
- .name = "Edison lights module",
- .author = "Intel",
- .methods = &lights_methods,
-};
diff --git a/peripheral/light/mraa/peripheral.mk b/peripheral/light/mraa/peripheral.mk
deleted file mode 100644
index 77ca926..0000000
--- a/peripheral/light/mraa/peripheral.mk
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# Copyright 2015 The Android Open Source Project
-#
-# 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.
-#
-
-DEVICE_PACKAGES += \
- lights.$(TARGET_DEVICE)
diff --git a/peripheral/sensors/mraa/AcquisitionThread.cpp b/peripheral/sensors/mraa/AcquisitionThread.cpp
deleted file mode 100644
index 8485508..0000000
--- a/peripheral/sensors/mraa/AcquisitionThread.cpp
+++ /dev/null
@@ -1,223 +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.
- */
-
-#include <cutils/log.h>
-#include <sys/epoll.h>
-#include <string.h>
-#include <errno.h>
-#include <hardware/sensors.h>
-#include "AcquisitionThread.hpp"
-#include "Utils.hpp"
-
-void* AcquisitionThread::acquisitionRoutine(void *param) {
- AcquisitionThread *acquisitionThread = reinterpret_cast<AcquisitionThread *>(param);
- Sensor *sensor = nullptr;
- int64_t timestamp = 0;
- struct timespec target_time;
- int rc = 0;
- sensors_event_t data;
-
- if (acquisitionThread == nullptr) {
- ALOGE("%s: The acquisition thread was not initialized", __func__);
- return nullptr;
- }
-
- sensor = acquisitionThread->sensor;
- if (sensor == nullptr) {
- ALOGE("%s: The acquisition thread doesn't have an associated sensor", __func__);
- return nullptr;
- }
-
- /* initialize sensor data structure */
- memset(&data, 0, sizeof(sensors_event_t));
- data.version = sizeof(sensors_event_t);
- data.sensor = sensor->getHandle();
- data.type = sensor->getType();
-
- pthread_mutex_lock(&acquisitionThread->pthreadMutex);
-
- /* get current timestamp */
- timestamp = get_timestamp_monotonic();
-
- /* loop until the thread is canceled */
- while(acquisitionThread->getWritePipeFd() != -1) {
- /* get one event from the sensor */
- if (sensor->pollEvents(&data, 1) != 1) {
- ALOGE("%s: Sensor %d: Cannot read data", __func__, data.sensor);
- goto exit;
- }
-
- /* send the data over the pipe to the main thread */
- rc = write(acquisitionThread->getWritePipeFd(), &data, sizeof(sensors_event_t));
- if (rc != sizeof(sensors_event_t)) {
- ALOGE("%s: Sensor %d: Cannot write data to pipe", __func__, data.sensor);
- goto exit;
- }
-
- if (acquisitionThread->getWritePipeFd() == -1) {
- ALOGE("%s: Sensor %d: The write pipe file descriptor is invalid", __func__, data.sensor);
- goto exit;
- }
-
- timestamp += sensor->getDelay();
- set_timestamp(&target_time, timestamp);
- pthread_cond_timedwait(&acquisitionThread->pthreadCond, &acquisitionThread->pthreadMutex, &target_time);
- }
-
-exit:
- pthread_mutex_unlock(&acquisitionThread->pthreadMutex);
- return nullptr;
-}
-
-AcquisitionThread::AcquisitionThread(int pollFd, Sensor *sensor)
- : pollFd(pollFd), sensor(sensor), initialized(false) {
- pipeFds[0] = pipeFds[1] = -1;
-}
-
-bool AcquisitionThread::init() {
- struct epoll_event ev;
- int rc;
-
- memset(&ev, 0, sizeof(ev));
-
- if (initialized) {
- ALOGE("%s: acquisition thread already initialized", __func__);
- return false;
- }
-
- /* create condition variable & mutex for quick thread release */
- rc = pthread_condattr_init(&pthreadCondAttr);
- if (rc != 0) {
- ALOGE("%s: Cannot initialize the pthread condattr", __func__);
- return false;
- }
- rc = pthread_condattr_setclock(&pthreadCondAttr, CLOCK_MONOTONIC);
- if (rc != 0) {
- ALOGE("%s: Cannot set the clock of condattr to monotonic", __func__);
- return false;
- }
- rc = pthread_cond_init(&pthreadCond, &pthreadCondAttr);
- if (rc != 0) {
- ALOGE("%s: Cannot intialize the pthread structure", __func__);
- return false;
- }
- rc = pthread_mutex_init(&pthreadMutex, nullptr);
- if (rc != 0) {
- ALOGE("%s: Cannot initialize the mutex associated with the pthread cond", __func__);
- goto mutex_err;
- }
-
- /* create pipe to signal events to the main thread */
- rc = pipe2(pipeFds, O_NONBLOCK);
- if (rc != 0) {
- ALOGE("%s: Cannot initialize pipe", __func__);
- goto pipe_err;
- }
-
- ev.events = EPOLLIN;
- ev.data.u32 = sensor->getHandle();
-
- /* add read pipe fd to pollFd */
- rc = epoll_ctl(pollFd, EPOLL_CTL_ADD, pipeFds[0] , &ev);
- if (rc != 0) {
- ALOGE("%s: Cannot add the read file descriptor to poll set", __func__);
- goto epoll_err;
- }
-
- /* launch the thread */
- rc = pthread_create(&pthread, nullptr, acquisitionRoutine, (void *)this);
- if (rc != 0) {
- ALOGE("%s: Cannot create acquisition pthread", __func__);
- goto thread_create_err;
- }
-
- initialized = true;
- return true;
-
-thread_create_err:
- epoll_ctl(pollFd, EPOLL_CTL_DEL, pipeFds[0], nullptr);
-epoll_err:
- close(pipeFds[0]);
- close(pipeFds[1]);
- pipeFds[0] = pipeFds[1] = -1;
-pipe_err:
- pthread_mutex_destroy(&pthreadMutex);
-mutex_err:
- pthread_cond_destroy(&pthreadCond);
- return false;
-}
-
-bool AcquisitionThread::generateFlushCompleteEvent() {
- sensors_event_t data;
- int rc;
-
- if (!initialized) {
- return false;
- }
-
- /* batching is not supported; return one META_DATA_FLUSH_COMPLETE event */
- memset(&data, 0, sizeof(sensors_event_t));
- data.version = META_DATA_VERSION;
- data.type = SENSOR_TYPE_META_DATA;
- data.meta_data.sensor = sensor->getHandle();
- data.meta_data.what = META_DATA_FLUSH_COMPLETE;
-
- /*
- * Send the event via the associated pipe. It doesn't need to be in a loop
- * as O_NONBLOCK is enabled and the number of bytes is <= PIPE_BUF.
- * If there is room to write n bytes to the pipe, then write succeeds
- * immediately, writing all n bytes; otherwise write fails.
- */
- rc = write(getWritePipeFd(), &data, sizeof(sensors_event_t));
- if (rc != sizeof(sensors_event_t)) {
- ALOGE("%s: not all data has been sent over the pipe", __func__);
- return false;
- }
-
- return true;
-}
-
-int AcquisitionThread::wakeup() {
- if (initialized) {
- return pthread_cond_signal(&pthreadCond);
- }
-
- return -EINVAL;
-}
-
-AcquisitionThread::~AcquisitionThread() {
- int readPipeEnd, writePipeEnd;
-
- if (initialized) {
- readPipeEnd = pipeFds[0];
- writePipeEnd = pipeFds[1];
- epoll_ctl(pollFd, EPOLL_CTL_DEL, readPipeEnd, nullptr);
-
- /* take the mutex to correctly signal the thread */
- pthread_mutex_lock(&pthreadMutex);
- pipeFds[0] = pipeFds[1] = -1;
- close(readPipeEnd);
- close(writePipeEnd);
-
- /* wakeup and wait for the thread */
- pthread_cond_signal(&pthreadCond);
- pthread_mutex_unlock(&pthreadMutex);
- pthread_join(pthread, nullptr);
-
- pthread_cond_destroy(&pthreadCond);
- pthread_mutex_destroy(&pthreadMutex);
- }
-}
diff --git a/peripheral/sensors/mraa/AcquisitionThread.hpp b/peripheral/sensors/mraa/AcquisitionThread.hpp
deleted file mode 100644
index 46e39c5..0000000
--- a/peripheral/sensors/mraa/AcquisitionThread.hpp
+++ /dev/null
@@ -1,100 +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.
- */
-
-#ifndef ACQUISITION_THREAD_HPP
-#define ACQUISITION_THREAD_HPP
-
-#include <pthread.h>
-#include "Sensor.hpp"
-
-class Sensor;
-
-/**
- * AcquisitionThread is used for implementing sensors polling
- *
- * The class creates a thread to periodically poll data from a
- * sensor and write it to a pipe. The main thread can use the
- * pipe read endpoint to retrieve sensor events.
- *
- * One can also wake up the thread via the wakeup method after
- * changing the sensor parameters.
- *
- * It includes support for generating a flush complete event.
- */
-class AcquisitionThread {
- public:
- /**
- * AcquisitionThread constructor
- * @param pollFd poll file descriptor
- * @param sensor the sensor to associate with the thread
- */
- AcquisitionThread(int pollFd, Sensor *sensor);
-
- /**
- * AcquistionThread destructor
- */
- ~AcquisitionThread();
-
- /**
- * Get sensor associated with the thread
- * @return the associated sensor
- */
- Sensor * getSensor() { return sensor; }
-
- /**
- * Get the file descriptor of the pipe read endpoint
- * @return the pipe read file descriptor
- */
- int getReadPipeFd() { return pipeFds[0]; }
-
- /**
- * Get the file descriptor of the pipe write endpoint
- * @return the pipe write file descriptor
- */
- int getWritePipeFd() { return pipeFds[1]; }
-
- /**
- * Initialize the acquisition thread
- * @return true if successful, false otherwise
- */
- bool init();
-
- /**
- * Generate a flush event and send it via the associated pipe
- * @return true if successful, false otherwise
- */
- bool generateFlushCompleteEvent();
-
- /**
- * Wake up thread if it is sleeping
- * @return 0 if successful, < 0 otherwise
- */
- int wakeup();
-
- private:
- static void * acquisitionRoutine(void *param);
-
- int pollFd;
- int pipeFds[2];
- pthread_t pthread;
- pthread_condattr_t pthreadCondAttr;
- pthread_cond_t pthreadCond;
- pthread_mutex_t pthreadMutex;
- Sensor *sensor;
- bool initialized;
-};
-
-#endif // ACQUISITION_THREAD_HPP
diff --git a/peripheral/sensors/mraa/Sensor.cpp b/peripheral/sensors/mraa/Sensor.cpp
deleted file mode 100644
index 849f380..0000000
--- a/peripheral/sensors/mraa/Sensor.cpp
+++ /dev/null
@@ -1,128 +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.
- */
-
-#include <cutils/log.h>
-#include <hardware/sensors.h>
-#include <errno.h>
-#include "Sensor.hpp"
-
-/* maximum delay: 1000ms */
-const int64_t kMaxDelay = 1000000000;
-/* Gravitational acceleration constant in m/s^2 */
-const float Sensor::kGravitationalAcceleration = 9.81f;
-
-Sensor::Sensor() : acquisitionThread(nullptr), handle(-1), type(-1), delay(kMaxDelay) {}
-
-Sensor::~Sensor() {
- if (acquisitionThread != nullptr) {
- delete acquisitionThread;
- acquisitionThread = nullptr;
- }
-}
-
-int Sensor::activate(int handle, int enabled) { return 0; }
-
-bool Sensor::readOneEvent(sensors_event_t *event) {
- int bytes_read = 0, bytes_to_read = sizeof(sensors_event_t);
- int fd = -1;
- char *ptr = (char *)event;
-
- if (acquisitionThread == nullptr) {
- ALOGE("%s: sensor %d doesn't have an acquisition thread", __func__, handle);
- return false;
- }
-
- /* read one event from the pipe read endpoint */
- fd = acquisitionThread->getReadPipeFd();
- do {
- bytes_read = read(fd, ptr, bytes_to_read);
- if (bytes_read <= 0) {
- break;
- }
- bytes_to_read -= bytes_read;
- ptr += bytes_read;
- } while (bytes_to_read > 0);
-
- if (bytes_to_read != 0) {
- return false;
- }
-
- return true;
-}
-
-int Sensor::activateAcquisitionThread(int pollFd, int handle, int enabled) {
- if (enabled) {
- /* create/init acquisition thread if necessary */
- if (acquisitionThread == nullptr) {
- acquisitionThread = new AcquisitionThread(pollFd, this);
- if (!acquisitionThread->init()) {
- ALOGE("%s: Cannot initialize acquisition thread for sensor %d",
- __func__, handle);
- delete acquisitionThread;
- acquisitionThread = nullptr;
- return -1;
- }
- } else {
- ALOGE("%s: Sensor %d is already enabled", __func__, handle);
- }
- } else {
- /* free acquisition thread resources */
- if (acquisitionThread != nullptr) {
- delete acquisitionThread;
- acquisitionThread = nullptr;
- } else {
- ALOGE("%s: Sensor %d is already disabled", __func__, handle);
- }
- }
- return 0;
-}
-
-int Sensor::setDelay(int handle, int64_t requestedDelay) {
- if (requestedDelay < 0) {
- return -EINVAL;
- }
-
- if (requestedDelay > kMaxDelay) {
- requestedDelay = kMaxDelay;
- }
-
- this->delay = requestedDelay;
- /* wake up thread to immediately change the delay */
- if (acquisitionThread != nullptr) {
- return acquisitionThread->wakeup();
- }
-
- return 0;
-}
-
-int Sensor::batch(int handle, int flags,
- int64_t period_ns, int64_t timeout) {
- /* batching mode is not supported; call setDelay */
- return setDelay(handle, period_ns);
-}
-
-int Sensor::flush(int handle) {
- if (acquisitionThread == nullptr) {
- return -EINVAL;
- }
-
- /* batching mode is not supported; generate META_DATA_FLUSH_COMPLETE */
- if (acquisitionThread->generateFlushCompleteEvent()) {
- return 0;
- }
-
- return -1;
-}
diff --git a/peripheral/sensors/mraa/Sensor.hpp b/peripheral/sensors/mraa/Sensor.hpp
deleted file mode 100644
index 7fc98a2..0000000
--- a/peripheral/sensors/mraa/Sensor.hpp
+++ /dev/null
@@ -1,137 +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.
- */
-
-#ifndef SENSOR_HPP
-#define SENSOR_HPP
-
-/**
- * The default sensor __attribute__((constructor)) priority is represented by
- * the first available priority value. The [0, 100] ones are used by the system
- * implementation.
- */
-#define DEFAULT_SENSOR_CONSTRUCTOR_PRIORITY 101
-
-#include "AcquisitionThread.hpp"
-
-struct sensors_event_t;
-class AcquisitionThread;
-
-/**
- * Sensor representation class
- *
- * It supports sensor enabling/disabling, changing the sensor's parameters
- * and event reading.
- */
-class Sensor {
- public:
- /**
- * Sensor constructor
- */
- Sensor();
-
- /**
- * Sensor destructor
- */
- virtual ~Sensor();
-
- /**
- * Activate the sensor
- * @param handle sensor identifier
- * @param enabled 1 for enabling and 0 for disabling
- * @return 0 on success and a negative error number otherwise
- */
- virtual int activate(int handle, int enabled);
-
- /**
- * Set delay
- * @param handle sensor identifier
- * @param ns the sampling period at which the sensor should run, in nanoseconds
- * @return 0 on success and a negative error number otherwise
- */
- virtual int setDelay(int handle, int64_t ns);
-
- /**
- * Poll for events
- * @param data where to store the events
- * @param count the number of events returned must be <= to the count
- * @return number of events returned in data on success and a negative error number otherwise
- */
- virtual int pollEvents(sensors_event_t* data, int count) = 0;
-
- /**
- * Sets a sensor’s parameters, including sampling frequency and maximum report latency
- * @param handle sensor identifier
- * @param flags currently unused
- * @param period_ns the sampling period at which the sensor should run, in nanoseconds
- * @param timeout the maximum time by which events can be delayed before being reported
- * through the HAL, in nanoseconds
- * @return 0 on success and a negative error number otherwise
- */
- virtual int batch(int handle, int flags, int64_t period_ns, int64_t timeout);
-
- /**
- * Add a flush complete event to the end of the hardware FIFO for the specified sensor and flushes the FIFO
- * @param handle sensor identifier
- * @return 0 on success and a negative error number otherwise
- */
- virtual int flush(int handle);
-
- /**
- * Read and store an event
- * @param event where to store the event
- * @return true on success and a false otherwise
- */
- virtual bool readOneEvent(sensors_event_t *event);
-
- /**
- * Get sensor identifier
- * @return sensor handle
- */
- int getHandle() { return handle; }
-
- /**
- * Get sensor type
- * @return sensor type
- */
- int getType() { return type; }
-
- /**
- * Get sensor delay in nanoseconds
- * @return sensor delay
- */
- int64_t getDelay() { return delay; }
-
- /**
- * Gravitational acceleration constant in m/s^2
- */
- static const float kGravitationalAcceleration;
-
- protected:
- /**
- * Enable or disable the associated acquisition thread
- * @param pollFd poll file descriptor
- * @param handle sensor identifier
- * @param enabled 1 for enabling and 0 for disabling
- * @return 0 on success and a negative error number otherwise
- */
- virtual int activateAcquisitionThread(int pollFd, int handle, int enabled);
-
- AcquisitionThread *acquisitionThread;
- int handle, type;
- int64_t delay;
-};
-
-#endif // SENSOR_HPP
diff --git a/peripheral/sensors/mraa/SensorUtils.cpp b/peripheral/sensors/mraa/SensorUtils.cpp
deleted file mode 100644
index 662321e..0000000
--- a/peripheral/sensors/mraa/SensorUtils.cpp
+++ /dev/null
@@ -1,22 +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.
- */
-
-#include <mraa.hpp>
-#include "SensorUtils.hpp"
-
-int SensorUtils::getI2cBusNumber() {
- return mraa_get_default_i2c_bus(MRAA_MAIN_PLATFORM_OFFSET);
-}
diff --git a/peripheral/sensors/mraa/SensorUtils.hpp b/peripheral/sensors/mraa/SensorUtils.hpp
deleted file mode 100644
index dcd48bb..0000000
--- a/peripheral/sensors/mraa/SensorUtils.hpp
+++ /dev/null
@@ -1,34 +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.
- */
-
-#ifndef SENSOR_UTILS_HPP
-#define SENSOR_UTILS_HPP
-
-/**
- * Sensor utils class
- *
- * It supports retrieving the i2c sensors bus number
- */
-class SensorUtils {
- public:
- /**
- * Get sensors i2c bus number
- * @return i2c bus number
- */
- static int getI2cBusNumber();
-};
-
-#endif // SENSOR_UTILS_HPP
diff --git a/peripheral/sensors/mraa/SensorsHAL.cpp b/peripheral/sensors/mraa/SensorsHAL.cpp
deleted file mode 100644
index 4c9238e..0000000
--- a/peripheral/sensors/mraa/SensorsHAL.cpp
+++ /dev/null
@@ -1,322 +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.
- */
-
-#include <string.h>
-#include <cutils/log.h>
-#include <stdexcept>
-#include <errno.h>
-#include <sys/epoll.h>
-#include "SensorsHAL.hpp"
-
-Sensor * (*SensorContext::sensorFactoryFuncs[MAX_DEVICES])(int);
-struct sensor_t SensorContext::sensorDescs[MAX_DEVICES];
-int SensorContext::sensorsNum = 0;
-android::Mutex SensorContext::mutex;
-
-SensorContext::SensorContext(const hw_module_t *module) {
- /* create the epoll fd used to register the incoming fds */
- pollFd = epoll_create(MAX_DEVICES);
- if (pollFd == -1) {
- throw std::runtime_error("Failed to create poll file descriptor");
- }
-
- memset(&device, 0, sizeof(device));
-
- device.common.tag = HARDWARE_DEVICE_TAG;
- device.common.version = SENSORS_DEVICE_API_VERSION_1_0;
- device.common.module = const_cast<hw_module_t*>(module);
- device.common.close = CloseWrapper;
- device.activate = ActivateWrapper;
- device.setDelay = SetDelayWrapper;
- device.poll = PollEventsWrapper;
- device.batch = BatchWrapper;
- device.flush = FlushWrapper;
-
- memset(sensors, 0, sizeof(Sensor *) * MAX_DEVICES);
-}
-
-SensorContext::~SensorContext() {
- int rc;
-
- for (int i = 0; i < sensorsNum; i++) {
- if (sensors[i]) {
- delete sensors[i];
- sensors[i] = nullptr;
- }
- }
-
- rc = close(pollFd);
- if (rc != 0) {
- ALOGE("Cannot close poll file descriptor");
- }
-}
-
-int SensorContext::addSensorModule(struct sensor_t *sensorDesc,
- Sensor * (*sensorFactoryFunc)(int)) {
- android::Mutex::Autolock autolock(mutex);
-
- if ((sensorDesc == nullptr) || (sensorFactoryFunc == nullptr)) {
- ALOGE("%s: cannot add a null sensor", __func__);
- return -EINVAL;
- }
-
- if (sensorsNum >= MAX_DEVICES) {
- ALOGE("%s: Cannot add more than %d sensors.", __func__, MAX_DEVICES);
- return -E2BIG;
- }
-
- sensorDesc->handle = sensorsNum;
- sensorDescs[sensorsNum] = *sensorDesc;
- sensorFactoryFuncs[sensorsNum] = sensorFactoryFunc;
- sensorsNum++;
-
- return 0;
-}
-
-int SensorContext::OpenWrapper(const struct hw_module_t *module,
- const char* id, struct hw_device_t **device) {
- SensorContext *ctx;
-
- try {
- ctx = new SensorContext(module);
- } catch (const std::runtime_error& e) {
- ALOGE("%s: Failed to open sensors hal. Error message: %s",
- __func__, e.what());
- return -1;
- }
-
- *device = &ctx->device.common;
-
- return 0;
-}
-
-int SensorContext::GetSensorsListWrapper(struct sensors_module_t *module,
- struct sensor_t const **list) {
- android::Mutex::Autolock autolock(mutex);
-
- if (!list || (sensorsNum == 0)) {
- return 0;
- }
-
- *list = sensorDescs;
- return sensorsNum;
-}
-
-int SensorContext::activate(int handle, int enabled) {
- int rc = 0;
-
- if (enabled != 0 && enabled != 1) {
- ALOGE("%s: Invalid parameter", __func__);
- return -EINVAL;
- }
-
- if (handle < 0 || handle >= sensorsNum) {
- return -EINVAL;
- }
-
- try {
- if (enabled) {
- if (sensors[handle] == nullptr) {
- sensors[handle] = sensorFactoryFuncs[handle](pollFd);
- if (sensors[handle] == nullptr) {
- return -1;
- }
- rc = sensors[handle]->activate(handle, enabled);
- if (rc != 0) {
- goto delete_sensor;
- }
- } else {
- return 0;
- }
- } else {
- if (sensors[handle] != nullptr) {
- rc = sensors[handle]->activate(handle, enabled);
- delete sensors[handle];
- sensors[handle] = nullptr;
- } else {
- return 0;
- }
- }
-
- return rc;
- } catch (const std::exception& e) {
- /* The upper layer doesn't expect exceptions. Catch them all. */
- ALOGE("%s: Failed to %s sensor %d. Error message: %s.",
- __func__, enabled ? "activate" : "deactivate", handle, e.what());
- }
-
-delete_sensor:
- if (sensors[handle] != nullptr) {
- delete sensors[handle];
- sensors[handle] = nullptr;
- }
-
- return -1;
-}
-
-int SensorContext::setDelay(int handle, int64_t ns) {
- if (handle < 0 || handle >= sensorsNum) {
- return -EINVAL;
- }
-
- if (sensors[handle] == nullptr) {
- ALOGE("%s: cannot set delay. sensor %d is not activated", __func__, handle);
- return -EINVAL;
- }
-
- return sensors[handle]->setDelay(handle, ns);
-}
-
-int SensorContext::pollEvents(sensors_event_t *data, int count) {
- int nfds, i;
- struct epoll_event ev[MAX_DEVICES];
- int returnedEvents = 0, sensorIndex = -1;
-
- /* return only when at least one event is available */
- while(true) {
- nfds = epoll_wait(pollFd, ev, MAX_DEVICES, -1);
- if (nfds < 0) {
- ALOGE("%s: epoll_wait returned an error: %d", __func__, errno);
- return nfds;
- }
-
- { // Autolock scope
- android::Mutex::Autolock autolock(mutex);
- for(i = 0; i < nfds && returnedEvents < count; i++) {
- if (ev[i].events == EPOLLIN) {
- sensorIndex = ev[i].data.u32;
- if ((sensorIndex < 0) || (sensorIndex > sensorsNum)) {
- ALOGE("%s: Invalid sensor index", __func__);
- return -1;
- }
-
- if (sensors[sensorIndex] == nullptr) {
- /* The sensor might have been deactivated by another thread */
- continue;
- }
-
- /*
- * The read operation might fail if the data is read by another
- * pollEvents call executed by another thread.
- */
- if (sensors[sensorIndex]->readOneEvent(data + returnedEvents)) {
- returnedEvents++;
- }
- }
- }
- } // Autolock scope
-
- if (returnedEvents > 0) {
- return returnedEvents;
- }
- }
-}
-
-int SensorContext::batch(int handle, int flags,
- int64_t period_ns, int64_t timeout) {
- if (handle < 0 || handle >= sensorsNum) {
- return -EINVAL;
- }
-
- if (sensors[handle] == nullptr) {
- ALOGE("%s: cannot set delay. sensor %d is not activated", __func__, handle);
- return -EINVAL;
- }
-
- return sensors[handle]->batch(handle, flags, period_ns, timeout);
-}
-
-int SensorContext::flush(int handle) {
- if (handle < 0 || handle >= sensorsNum) {
- return -EINVAL;
- }
-
- if (sensors[handle] == nullptr) {
- ALOGE("%s: cannot set delay. sensor %d is not activated", __func__, handle);
- return -EINVAL;
- }
-
- /* flush doesn't apply to one-shot sensors */
- if (sensorDescs[handle].flags & SENSOR_FLAG_ONE_SHOT_MODE)
- return -EINVAL;
-
- return sensors[handle]->flush(handle);
-}
-
-int SensorContext::CloseWrapper(hw_device_t *dev) {
- SensorContext *sensorContext = reinterpret_cast<SensorContext *>(dev);
- android::Mutex::Autolock autolock(mutex);
-
- if (sensorContext != nullptr) {
- delete sensorContext;
- }
-
- return 0;
-}
-
-int SensorContext::ActivateWrapper(sensors_poll_device_t *dev,
- int handle, int enabled) {
- android::Mutex::Autolock autolock(mutex);
-
- return reinterpret_cast<SensorContext *>(dev)->activate(handle, enabled);
-}
-
-int SensorContext::SetDelayWrapper(sensors_poll_device_t *dev,
- int handle, int64_t ns) {
- android::Mutex::Autolock autolock(mutex);
-
- return reinterpret_cast<SensorContext *>(dev)->setDelay(handle, ns);
-}
-
-int SensorContext::PollEventsWrapper(sensors_poll_device_t *dev,
- sensors_event_t *data, int count) {
- return reinterpret_cast<SensorContext *>(dev)->pollEvents(data, count);
-}
-
-int SensorContext::BatchWrapper(sensors_poll_device_1_t *dev, int handle,
- int flags, int64_t period_ns, int64_t timeout) {
- android::Mutex::Autolock autolock(mutex);
-
- return reinterpret_cast<SensorContext *>(dev)->batch(handle, flags, period_ns,
- timeout);
-}
-
-int SensorContext::FlushWrapper(sensors_poll_device_1_t *dev,
- int handle) {
- android::Mutex::Autolock autolock(mutex);
-
- return reinterpret_cast<SensorContext *>(dev)->flush(handle);
-}
-
-static struct hw_module_methods_t sensors_module_methods = {
- .open = SensorContext::OpenWrapper,
-};
-
-struct sensors_module_t HAL_MODULE_INFO_SYM = {
- .common = {
- .tag = HARDWARE_MODULE_TAG,
- .version_major = 1,
- .version_minor = 0,
- .id = SENSORS_HARDWARE_MODULE_ID,
- .name = "Edison Sensor HAL",
- .author = "Intel",
- .methods = &sensors_module_methods,
- .dso = nullptr,
- .reserved = {0},
- },
- .get_sensors_list = SensorContext::GetSensorsListWrapper,
- .set_operation_mode = nullptr
-};
diff --git a/peripheral/sensors/mraa/SensorsHAL.hpp b/peripheral/sensors/mraa/SensorsHAL.hpp
deleted file mode 100644
index 0e7ef14..0000000
--- a/peripheral/sensors/mraa/SensorsHAL.hpp
+++ /dev/null
@@ -1,117 +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.
- */
-
-#ifndef SENSORS_HAL_HPP
-#define SENSORS_HAL_HPP
-
-#include <hardware/sensors.h>
-#include <utils/Mutex.h>
-#include "Sensor.hpp"
-#include "SensorUtils.hpp"
-
-/**
- * Maximum number of sensor devices
- */
-#define MAX_DEVICES 20
-
-/**
- * SensorContext represents the HAL entry class
- *
- * The SensorContext class is responsible for initializing
- * a sensors_poll_device_1_t data structure and exposing the
- * sensors.h API methods.
- */
-class SensorContext {
- public:
- /**
- * Sensor poll device
- */
- sensors_poll_device_1_t device;
-
- /**
- * SensorContext constructor
- */
- SensorContext(const hw_module_t* module);
-
- /**
- * SensorContext destructor
- */
- ~SensorContext();
-
- /**
- * Add sensor module by sensor description & sensor factory function
- * @param sensorDesc sensor description
- * @param sensorFactoryFunc sensor factory function
- * @return 0 if success, error otherwise
- */
- static int addSensorModule(struct sensor_t *sensorDesc,
- Sensor * (*sensorFactoryFunc)(int pollFd));
-
- /**
- * Sensors HAL open wrapper function
- * @param module hardware module
- * @param id device identifier
- * @param device where to store the device address
- * @return 0 if success, error otherwise
- */
- static int OpenWrapper(const struct hw_module_t *module,
- const char* id, struct hw_device_t **device);
- /**
- * Sensors HAL get_sensors_list wrapper function
- * @param module sensors module
- * @param list where to store the list of available sensors
- * @return 0 if success, error otherwise
- */
- static int GetSensorsListWrapper(struct sensors_module_t *module,
- struct sensor_t const **list);
- private:
- int activate(int handle, int enabled);
- int setDelay(int handle, int64_t ns);
- int pollEvents(sensors_event_t* data, int count);
- int batch(int handle, int flags, int64_t period_ns, int64_t timeout);
- int flush(int handle);
-
- /*
- * The wrapper pass through to the specific instantiation of
- * the SensorContext.
- */
- static int CloseWrapper(hw_device_t *dev);
- static int ActivateWrapper(sensors_poll_device_t *dev, int handle,
- int enabled);
- static int SetDelayWrapper(sensors_poll_device_t *dev, int handle,
- int64_t ns);
- static int PollEventsWrapper(sensors_poll_device_t *dev,
- sensors_event_t *data, int count);
- static int BatchWrapper(sensors_poll_device_1_t *dev, int handle, int flags,
- int64_t period_ns, int64_t timeout);
- static int FlushWrapper(sensors_poll_device_1_t *dev, int handle);
-
- /* Poll file descriptor */
- int pollFd;
- /* Array of sensors */
- Sensor * sensors[MAX_DEVICES];
-
- /* Array of sensor factory functions */
- static Sensor * (*sensorFactoryFuncs[MAX_DEVICES])(int);
- /* Array of sensor descriptions */
- static struct sensor_t sensorDescs[MAX_DEVICES];
- /* Number of registered sensors */
- static int sensorsNum;
- /* Mutex used to synchronize the Sensor Context */
- static android::Mutex mutex;
-};
-
-#endif // SENSORS_HAL_HPP
diff --git a/peripheral/sensors/mraa/Utils.cpp b/peripheral/sensors/mraa/Utils.cpp
deleted file mode 100644
index 1796ef6..0000000
--- a/peripheral/sensors/mraa/Utils.cpp
+++ /dev/null
@@ -1,38 +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.
- */
-
-#include "Utils.hpp"
-
-static int64_t get_timestamp(clockid_t clock_id)
-{
- struct timespec ts = {0, 0};
-
- if (!clock_gettime(clock_id, &ts))
- return 1000000000LL * ts.tv_sec + ts.tv_nsec;
- else /* in this case errno is set appropriately */
- return -1;
-}
-
-int64_t get_timestamp_monotonic()
-{
- return get_timestamp(CLOCK_MONOTONIC);
-}
-
-void set_timestamp(struct timespec *out, int64_t target_ns)
-{
- out->tv_sec = target_ns / 1000000000LL;
- out->tv_nsec = target_ns % 1000000000LL;
-}
diff --git a/peripheral/sensors/mraa/Utils.hpp b/peripheral/sensors/mraa/Utils.hpp
deleted file mode 100644
index 4732d10..0000000
--- a/peripheral/sensors/mraa/Utils.hpp
+++ /dev/null
@@ -1,35 +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.
- */
-
-#ifndef UTILS_HPP
-#define UTILS_HPP
-
-#include <time.h>
-
-/**
- * Get current timestamp in nanoseconds
- * @return time in nanoseconds
- */
-int64_t get_timestamp_monotonic();
-
-/**
- * Populates a timespec data structure from a int64_t timestamp
- * @param out what timespec to populate
- * @param target_ns timestamp in nanoseconds
- */
-void set_timestamp(struct timespec *out, int64_t target_ns);
-
-#endif // UTILS_HPP
diff --git a/peripheral/sensors/mraa/doc/Doxyfile b/peripheral/sensors/mraa/doc/Doxyfile
deleted file mode 100644
index e132c18..0000000
--- a/peripheral/sensors/mraa/doc/Doxyfile
+++ /dev/null
@@ -1,2354 +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 = "Brillo Sensors HAL"
-
-# 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 =
-
-# 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 =
-
-# 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 = YES
-
-# 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 = 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 = NO
-
-# 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 = YES
-
-# 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 =
-
-# 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 = ../
-
-# 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 = 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 =
-
-# 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 = *
-
-# 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 =
-
-#---------------------------------------------------------------------------
-# 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 = NO
-
-# 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 = YES
-
-# 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 = NO
-
-# 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 = YES
-
-# 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 = NO
-
-# 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 = NO
-
-# 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/sensors/mraa/hal.mk b/peripheral/sensors/mraa/hal.mk
deleted file mode 100644
index ba685f5..0000000
--- a/peripheral/sensors/mraa/hal.mk
+++ /dev/null
@@ -1,64 +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_CPPFLAGS:= -Wno-unused-parameter -Wno-error=non-virtual-dtor -fexceptions
-LOCAL_CFLAGS += -DLOG_TAG=\"Sensors\" -Wno-unused-parameter
-LOCAL_SHARED_LIBRARIES := libcutils libupm libmraa
-LOCAL_C_INCLUDES := $(LOCAL_PATH)/../libupm/src/mpu9150/
-LOCAL_SRC_FILES := SensorsHAL.cpp Sensor.cpp AcquisitionThread.cpp Utils.cpp SensorUtils.cpp
-LOCAL_MODULE := sensors.$(TARGET_DEVICE)
-LOCAL_MODULE_RELATIVE_PATH := hw
-LOCAL_MODULE_TAGS := optional
-
-ifneq (,$(filter MPU9150Accelerometer, $(PLATFORM_SENSOR_LIST)))
-LOCAL_SRC_FILES += sensors/MPU9150Accelerometer.cpp
-endif
-
-ifneq (,$(filter MMA7660Accelerometer, $(PLATFORM_SENSOR_LIST)))
-LOCAL_SRC_FILES += sensors/MMA7660Accelerometer.cpp
-endif
-
-ifneq (,$(filter LSM9DS0Accelerometer, $(PLATFORM_SENSOR_LIST)))
-LOCAL_SRC_FILES += sensors/LSM9DS0Accelerometer.cpp
-endif
-
-ifneq (,$(filter LSM303dAccelerometer, $(PLATFORM_SENSOR_LIST)))
-LOCAL_SRC_FILES += sensors/LSM303dAccelerometer.cpp
-endif
-
-ifneq (,$(filter LSM303dOrientation, $(PLATFORM_SENSOR_LIST)))
-LOCAL_SRC_FILES += sensors/LSM303dOrientation.cpp
-endif
-
-ifneq (,$(filter H3LIS331DLAccelerometer, $(PLATFORM_SENSOR_LIST)))
-LOCAL_SRC_FILES += sensors/H3LIS331DLAccelerometer.cpp
-endif
-
-ifneq (,$(filter GroveLight, $(PLATFORM_SENSOR_LIST)))
-LOCAL_SRC_FILES += sensors/GroveLight.cpp
-endif
-
-ifneq (,$(filter GroveTemperature, $(PLATFORM_SENSOR_LIST)))
-LOCAL_SRC_FILES += sensors/GroveTemperature.cpp
-endif
-
-ifneq (,$(filter ProximityGPIO, $(PLATFORM_SENSOR_LIST)))
-LOCAL_SRC_FILES += sensors/ProximityGPIO.cpp
-endif
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/peripheral/sensors/mraa/peripheral.mk b/peripheral/sensors/mraa/peripheral.mk
deleted file mode 100644
index d8e8d41..0000000
--- a/peripheral/sensors/mraa/peripheral.mk
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# Copyright 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.
-#
-
-DEVICE_PACKAGES += \
- sensors.$(TARGET_DEVICE)
diff --git a/peripheral/sensors/mraa/sensors/GroveLight.cpp b/peripheral/sensors/mraa/sensors/GroveLight.cpp
deleted file mode 100644
index 68c7abc..0000000
--- a/peripheral/sensors/mraa/sensors/GroveLight.cpp
+++ /dev/null
@@ -1,63 +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.
- */
-
-#include <cutils/log.h>
-#include "GroveLight.hpp"
-#include "SensorsHAL.hpp"
-
-struct sensor_t GroveLight::sensorDescription = {
- .name = "Grove Light Sensor",
- .vendor = "Senba Optical & Electronic",
- .version = 1,
- .handle = -1,
- .type = SENSOR_TYPE_LIGHT,
- .maxRange = 60.0f,
- .resolution = 1.0f,
- .power = 0.001f,
- .minDelay = 10,
- .fifoReservedEventCount = 0,
- .fifoMaxEventCount = 0,
- .stringType = SENSOR_STRING_TYPE_LIGHT,
- .requiredPermission = "",
- .maxDelay = 1000,
- .flags = SENSOR_FLAG_ON_CHANGE_MODE,
- .reserved = {},
-};
-
-Sensor * GroveLight::createSensor(int pollFd) {
- return new GroveLight(pollFd, 0);
-}
-
-void GroveLight::initModule() {
- SensorContext::addSensorModule(&sensorDescription, createSensor);
-}
-
-GroveLight::GroveLight(int pollFd, int pin) : upm::GroveLight(pin), pollFd(pollFd) {
- handle = sensorDescription.handle;
- type = SENSOR_TYPE_LIGHT;
-}
-
-GroveLight::~GroveLight() {}
-
-int GroveLight::pollEvents(sensors_event_t* data, int count) {
- data->light = value();
- return 1;
-}
-
-int GroveLight::activate(int handle, int enabled) {
- /* start or stop the acquisition thread */
- return activateAcquisitionThread(pollFd, handle, enabled);
-}
diff --git a/peripheral/sensors/mraa/sensors/GroveLight.hpp b/peripheral/sensors/mraa/sensors/GroveLight.hpp
deleted file mode 100644
index 401e834..0000000
--- a/peripheral/sensors/mraa/sensors/GroveLight.hpp
+++ /dev/null
@@ -1,70 +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.
- */
-
-#ifndef GROVE_LIGHT_HPP
-#define GROVE_LIGHT_HPP
-
-#include <hardware/sensors.h>
-#include "Sensor.hpp"
-#include "grove.h"
-
-struct sensors_event_t;
-
-/**
- * GroveLight exposes the Grove Light sensor
- *
- * Overrides the pollEvents & activate Sensor methods.
- */
-class GroveLight : public Sensor, public upm::GroveLight {
- public:
- /**
- * GroveLight constructor
- * @param pollFd poll file descriptor
- * @param pin number of the analog input
- */
- GroveLight(int pollFd, int pin);
-
- /**
- * GroveLight destructor
- */
- ~GroveLight() override;
-
- /**
- * Poll for events
- * @param data where to store the events
- * @param count the number of events returned must be <= to the count
- * @return number of events returned in data on success and a negative error number otherwise
- */
- int pollEvents(sensors_event_t* data, int count) override;
-
- /**
- * Activate the sensor
- * @param handle sensor identifier
- * @param enabled 1 for enabling and 0 for disabling
- * @return 0 on success and a negative error number otherwise
- */
- int activate(int handle, int enabled);
-
- private:
- static Sensor * createSensor(int pollFd);
- static void initModule() __attribute__((constructor
- (DEFAULT_SENSOR_CONSTRUCTOR_PRIORITY)));
-
- int pollFd;
- static struct sensor_t sensorDescription;
-};
-
-#endif // GROVE_LIGHT_HPP
diff --git a/peripheral/sensors/mraa/sensors/GroveTemperature.cpp b/peripheral/sensors/mraa/sensors/GroveTemperature.cpp
deleted file mode 100644
index 6886df8..0000000
--- a/peripheral/sensors/mraa/sensors/GroveTemperature.cpp
+++ /dev/null
@@ -1,63 +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.
- */
-
-#include <cutils/log.h>
-#include "GroveTemperature.hpp"
-#include "SensorsHAL.hpp"
-
-struct sensor_t GroveTemperature::sensorDescription = {
- .name = "Grove Temperature Sensor",
- .vendor = "Murata",
- .version = 1,
- .handle = -1,
- .type = SENSOR_TYPE_TEMPERATURE,
- .maxRange = 125.0f,
- .resolution = 1.0f,
- .power = 0.001f,
- .minDelay = 10,
- .fifoReservedEventCount = 0,
- .fifoMaxEventCount = 0,
- .stringType = SENSOR_STRING_TYPE_TEMPERATURE,
- .requiredPermission = "",
- .maxDelay = 1000,
- .flags = SENSOR_FLAG_ON_CHANGE_MODE,
- .reserved = {},
-};
-
-Sensor * GroveTemperature::createSensor(int pollFd) {
- return new GroveTemperature(pollFd, 0);
-}
-
-void GroveTemperature::initModule() {
- SensorContext::addSensorModule(&sensorDescription, createSensor);
-}
-
-GroveTemperature::GroveTemperature(int pollFd, int pin) : upm::GroveTemp(pin), pollFd(pollFd) {
- handle = sensorDescription.handle;
- type = SENSOR_TYPE_TEMPERATURE;
-}
-
-GroveTemperature::~GroveTemperature() {}
-
-int GroveTemperature::pollEvents(sensors_event_t* data, int count) {
- data->temperature = value();
- return 1;
-}
-
-int GroveTemperature::activate(int handle, int enabled) {
- /* start or stop the acquisition thread */
- return activateAcquisitionThread(pollFd, handle, enabled);
-}
diff --git a/peripheral/sensors/mraa/sensors/GroveTemperature.hpp b/peripheral/sensors/mraa/sensors/GroveTemperature.hpp
deleted file mode 100644
index a3df4db..0000000
--- a/peripheral/sensors/mraa/sensors/GroveTemperature.hpp
+++ /dev/null
@@ -1,70 +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.
- */
-
-#ifndef GROVE_TEMPERATURE_HPP
-#define GROVE_TEMPERATURE_HPP
-
-#include <hardware/sensors.h>
-#include "Sensor.hpp"
-#include "grove.h"
-
-struct sensors_event_t;
-
-/**
- * GroveTemperature exposes the Grove Temperature sensor
- *
- * Overrides the pollEvents & activate Sensor methods.
- */
-class GroveTemperature : public Sensor, public upm::GroveTemp {
- public:
- /**
- * GroveTemperature constructor
- * @param pollFd poll file descriptor
- * @param pin number of the analog input
- */
- GroveTemperature(int pollFd, int pin);
-
- /**
- * GroveTemperature destructor
- */
- ~GroveTemperature() override;
-
- /**
- * Poll for events
- * @param data where to store the events
- * @param count the number of events returned must be <= to the count
- * @return number of events returned in data on success and a negative error number otherwise
- */
- int pollEvents(sensors_event_t* data, int count) override;
-
- /**
- * Activate the sensor
- * @param handle sensor identifier
- * @param enabled 1 for enabling and 0 for disabling
- * @return 0 on success and a negative error number otherwise
- */
- int activate(int handle, int enabled);
-
- private:
- static Sensor * createSensor(int pollFd);
- static void initModule() __attribute__((constructor
- (DEFAULT_SENSOR_CONSTRUCTOR_PRIORITY)));
-
- int pollFd;
- static struct sensor_t sensorDescription;
-};
-
-#endif // GROVE_TEMPERATURE_HPP
diff --git a/peripheral/sensors/mraa/sensors/H3LIS331DLAccelerometer.cpp b/peripheral/sensors/mraa/sensors/H3LIS331DLAccelerometer.cpp
deleted file mode 100644
index 98358c0..0000000
--- a/peripheral/sensors/mraa/sensors/H3LIS331DLAccelerometer.cpp
+++ /dev/null
@@ -1,75 +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.
- */
-
-#include <cutils/log.h>
-#include "H3LIS331DLAccelerometer.hpp"
-#include "SensorsHAL.hpp"
-#include "SensorUtils.hpp"
-
-struct sensor_t H3LIS331DLAccelerometer::sensorDescription = {
- .name = "H3LIS331DL Accelerometer",
- .vendor = "ST Microelectronics",
- .version = 1,
- .handle = -1,
- .type = SENSOR_TYPE_ACCELEROMETER,
- /* maxRange = 1.5g */
- .maxRange = 29.43f,
- .resolution = 0.46714286f,
- .power = 0.0198f,
- .minDelay = 10,
- .fifoReservedEventCount = 0,
- .fifoMaxEventCount = 0,
- .stringType = SENSOR_STRING_TYPE_ACCELEROMETER,
- .requiredPermission = "",
- .maxDelay = 1000,
- .flags = SENSOR_FLAG_CONTINUOUS_MODE,
- .reserved = {},
-};
-
-Sensor * H3LIS331DLAccelerometer::createSensor(int pollFd) {
- return new H3LIS331DLAccelerometer(pollFd, SensorUtils::getI2cBusNumber(),
- H3LIS331DL_DEFAULT_I2C_ADDR);
-}
-
-void H3LIS331DLAccelerometer::initModule() {
- SensorContext::addSensorModule(&sensorDescription, createSensor);
-}
-
-H3LIS331DLAccelerometer::H3LIS331DLAccelerometer(int pollFd, int bus, int address)
- : H3LIS331DL(bus, address), pollFd(pollFd) {
- handle = sensorDescription.handle;
- type = SENSOR_TYPE_ACCELEROMETER;
-}
-
-H3LIS331DLAccelerometer::~H3LIS331DLAccelerometer() {}
-
-int H3LIS331DLAccelerometer::pollEvents(sensors_event_t* data, int count) {
- update();
- getAcceleration(&data->acceleration.x, &data->acceleration.y, &data->acceleration.z);
- return 1;
-}
-
-int H3LIS331DLAccelerometer::activate(int handle, int enabled) {
- if (enabled) {
- if(!init(DR_100_74, PM_NORMAL, FS_100)) {
- return -1;
- }
- }
- else {
- setPowerMode(PM_POWERDWN);
- }
- return activateAcquisitionThread(pollFd, handle, enabled);
-}
diff --git a/peripheral/sensors/mraa/sensors/H3LIS331DLAccelerometer.hpp b/peripheral/sensors/mraa/sensors/H3LIS331DLAccelerometer.hpp
deleted file mode 100644
index 9dc72b6..0000000
--- a/peripheral/sensors/mraa/sensors/H3LIS331DLAccelerometer.hpp
+++ /dev/null
@@ -1,71 +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.
- */
-
-#ifndef H3LIS331DL_ACCELEROMETER_HPP
-#define H3LIS331DL_ACCELEROMETER_HPP
-
-#include <hardware/sensors.h>
-#include "Sensor.hpp"
-#include "h3lis331dl.h"
-
-struct sensors_event_t;
-
-/**
- * H3LIS331DLAccelerometer exposes the H3LIS331DL accelerometer sensor
- *
- * Overrides the pollEvents & activate Sensor methods.
- */
-class H3LIS331DLAccelerometer : public Sensor, public upm::H3LIS331DL {
- public:
- /**
- * H3LIS331DLAccelerometer constructor
- * @param pollFd poll file descriptor
- * @param bus number of the bus
- * @param address device address
- */
- H3LIS331DLAccelerometer(int pollFd, int bus=H3LIS331DL_I2C_BUS,
- int address=H3LIS331DL_DEFAULT_I2C_ADDR);
-
- /**
- * H3LIS331DLAccelerometer destructor
- */
- ~H3LIS331DLAccelerometer() override;
-
- /**
- * Poll for events
- * @param data where to store the events
- * @param count the number of events returned must be <= to the count
- * @return number of events returned in data on success and a negative error number otherwise
- */
- int pollEvents(sensors_event_t* data, int count) override;
-
- /**
- * Activate the sensor
- * @param handle sensor identifier
- * @param enabled 1 for enabling and 0 for disabling
- * @return 0 on success and a negative error number otherwise
- */
- int activate(int handle, int enabled);
-
- private:
- static Sensor * createSensor(int pollFd);
- static void initModule() __attribute__((constructor));
-
- int pollFd;
- static struct sensor_t sensorDescription;
-};
-
-#endif // H3LIS331DL_ACCELEROMETER_HPP
diff --git a/peripheral/sensors/mraa/sensors/LSM303dAccelerometer.cpp b/peripheral/sensors/mraa/sensors/LSM303dAccelerometer.cpp
deleted file mode 100644
index dc6cd1c..0000000
--- a/peripheral/sensors/mraa/sensors/LSM303dAccelerometer.cpp
+++ /dev/null
@@ -1,78 +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.
- */
-
-#include <cutils/log.h>
-#include "LSM303dAccelerometer.hpp"
-#include "SensorsHAL.hpp"
-#include "SensorUtils.hpp"
-
-struct sensor_t LSM303dAccelerometer::sensorDescription = {
- .name = "LSM303d Accelerometer",
- .vendor = "Unknown",
- .version = 1,
- .handle = -1,
- .type = SENSOR_TYPE_ACCELEROMETER,
- .maxRange = 16.0f,
- .resolution = 0.00003f,
- .power = 0.0003f,
- .minDelay = 0,
- .fifoReservedEventCount = 0,
- .fifoMaxEventCount = 0,
- .stringType = SENSOR_STRING_TYPE_ACCELEROMETER,
- .requiredPermission = "",
- .maxDelay = 0,
- .flags = SENSOR_FLAG_CONTINUOUS_MODE,
- .reserved = {},
-};
-
-Sensor * LSM303dAccelerometer::createSensor(int pollFd) {
- return new LSM303dAccelerometer(pollFd, SensorUtils::getI2cBusNumber());
-}
-
-void LSM303dAccelerometer::initModule() {
- SensorContext::addSensorModule(&sensorDescription, createSensor);
-}
-
-LSM303dAccelerometer::LSM303dAccelerometer(int pollFd,
- int bus, int address, int scale)
- : LSM303d(bus, address, scale), pollFd(pollFd), scale(scale) {
- this->type = SENSOR_TYPE_ACCELEROMETER;
- this->handle = sensorDescription.handle;
-}
-
-LSM303dAccelerometer::~LSM303dAccelerometer() {}
-
-/*
- * The raw data from the X,Y,Z axis are expressed in a 16 bit two's complement
- * format.
- * 1. We divide the 16bit value by (2**15) to convert it to floating point +-[0..1]
- * 2. We multiply by the scaling factor to adjust for max range (2,4,6,8,16 G)
- * 3. We multiply by the gravitational accelleration to convert from "g" to m/s**2
- */
-int LSM303dAccelerometer::pollEvents(sensors_event_t* data, int count) {
- getAcceleration();
- int16_t *rawdatap = getRawAccelData();
- double conversion_constant = (double)scale * (double)Sensor::kGravitationalAcceleration / pow(2,15);
- data->acceleration.x = (double)rawdatap[0] * conversion_constant;
- data->acceleration.y = (double)rawdatap[1] * conversion_constant;
- data->acceleration.z = (double)rawdatap[2] * conversion_constant;
- return 1;
-}
-
-int LSM303dAccelerometer::activate(int handle, int enabled) {
- /* start or stop the acquisition thread */
- return activateAcquisitionThread(pollFd, handle, enabled);
-}
diff --git a/peripheral/sensors/mraa/sensors/LSM303dAccelerometer.hpp b/peripheral/sensors/mraa/sensors/LSM303dAccelerometer.hpp
deleted file mode 100644
index 42d7372..0000000
--- a/peripheral/sensors/mraa/sensors/LSM303dAccelerometer.hpp
+++ /dev/null
@@ -1,76 +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.
- */
-
-#ifndef LSM303d_ACCELEROMETER_HPP
-#define LSM303d_ACCELEROMETER_HPP
-
-#include <hardware/sensors.h>
-#include "Sensor.hpp"
-#include "lsm303d.h"
-
-struct sensors_event_t;
-
-/**
- * LSM303dAccelerometer exposes the LSM303d accelerometer sensor
- *
- * Overrides the pollEvents & activate Sensor methods.
- */
-class LSM303dAccelerometer : public Sensor, public upm::LSM303d {
- public:
- /**
- * LSM303dAccelerometer constructor
- * @param pollFd poll file descriptor
- * @param bus number of the bus
- * @param address device address
- * @param magAddress magnetometer address
- * @param scale Sensor sensitivity scaling
- */
- LSM303dAccelerometer(int pollFd,
- int bus=0,
- int address = LSM303d_ADDR,
- int scale = LM303D_SCALE_2G);
-
- /**
- * LSM303dAccelerometer destructor
- */
- ~LSM303dAccelerometer() override;
-
- /**
- * Poll for events
- * @param data where to store the events
- * @param count the number of events returned must be <= to the count
- * @return number of events returned in data on success and a negative error number otherwise
- */
- int pollEvents(sensors_event_t* data, int count) override;
-
- /**
- * Activate the sensor
- * @param handle sensor identifier
- * @param enabled 1 for enabling and 0 for disabling
- * @return 0 on success and a negative error number otherwise
- */
- int activate(int handle, int enabled);
-
- private:
- static Sensor * createSensor(int pollFd);
- static void initModule() __attribute__((constructor));
-
- int pollFd;
- int scale;
- static struct sensor_t sensorDescription;
-};
-
-#endif // LSM303d_ACCELEROMETER_HPP
diff --git a/peripheral/sensors/mraa/sensors/LSM303dOrientation.cpp b/peripheral/sensors/mraa/sensors/LSM303dOrientation.cpp
deleted file mode 100644
index f766dfb..0000000
--- a/peripheral/sensors/mraa/sensors/LSM303dOrientation.cpp
+++ /dev/null
@@ -1,70 +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.
- */
-
-#include <cutils/log.h>
-#include "LSM303dOrientation.hpp"
-#include "SensorsHAL.hpp"
-#include "SensorUtils.hpp"
-
-struct sensor_t LSM303dOrientation::sensorDescription = {
- .name = "LSM303d Orientation",
- .vendor = "Unknown",
- .version = 1,
- .handle = -1,
- .type = SENSOR_TYPE_ORIENTATION,
- .maxRange = 12.0f,
- .resolution = .00003f,
- .power = 0.0003f,
- .minDelay = 0,
- .fifoReservedEventCount = 0,
- .fifoMaxEventCount = 0,
- .stringType = SENSOR_STRING_TYPE_ORIENTATION,
- .requiredPermission = "",
- .maxDelay = 0,
- .flags = SENSOR_FLAG_CONTINUOUS_MODE,
- .reserved = {},
-};
-
-Sensor * LSM303dOrientation::createSensor(int pollFd) {
- return new LSM303dOrientation(pollFd, SensorUtils::getI2cBusNumber());
-}
-
-void LSM303dOrientation::initModule() {
- SensorContext::addSensorModule(&sensorDescription, createSensor);
-}
-
-LSM303dOrientation::LSM303dOrientation(int pollFd,
- int bus, int address)
- : LSM303d(bus, address), pollFd(pollFd) {
- this->type = SENSOR_TYPE_ORIENTATION;
- this->handle = sensorDescription.handle;
-}
-
-LSM303dOrientation::~LSM303dOrientation() {}
-
-int LSM303dOrientation::pollEvents(sensors_event_t* data, int count) {
- getCoordinates();
- int16_t *rawdatap = getRawCoorData();
- data->orientation.x = (double)rawdatap[0];
- data->orientation.y = (double)rawdatap[1];
- data->orientation.z = (double)rawdatap[2];
- return 1;
-}
-
-int LSM303dOrientation::activate(int handle, int enabled) {
- /* start or stop the acquisition thread */
- return activateAcquisitionThread(pollFd, handle, enabled);
-}
diff --git a/peripheral/sensors/mraa/sensors/LSM303dOrientation.hpp b/peripheral/sensors/mraa/sensors/LSM303dOrientation.hpp
deleted file mode 100644
index afc16cc..0000000
--- a/peripheral/sensors/mraa/sensors/LSM303dOrientation.hpp
+++ /dev/null
@@ -1,72 +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.
- */
-
-#ifndef LSM303d_ORIENTATION_HPP
-#define LSM303d_ORIENTATION_HPP
-
-#include <hardware/sensors.h>
-#include "Sensor.hpp"
-#include "lsm303d.h"
-
-struct sensors_event_t;
-
-/**
- * LSM303dOrientation exposes the LSM303d orientation sensor
- *
- * Overrides the pollEvents & activate Sensor methods.
- */
-class LSM303dOrientation : public Sensor, public upm::LSM303d {
- public:
- /**
- * LSM303dOrientation constructor
- * @param pollFd poll file descriptor
- * @param bus number of the bus
- * @param address device address
- */
- LSM303dOrientation(int pollFd,
- int bus=0,
- int address = LSM303d_ADDR);
-
- /**
- * LSM303dOrientation destructor
- */
- ~LSM303dOrientation() override;
-
- /**
- * Poll for events
- * @param data where to store the events
- * @param count the number of events returned must be <= to the count
- * @return number of events returned in data on success and a negative error number otherwise
- */
- int pollEvents(sensors_event_t* data, int count) override;
-
- /**
- * Activate the sensor
- * @param handle sensor identifier
- * @param enabled 1 for enabling and 0 for disabling
- * @return 0 on success and a negative error number otherwise
- */
- int activate(int handle, int enabled);
-
- private:
- static Sensor * createSensor(int pollFd);
- static void initModule() __attribute__((constructor));
-
- int pollFd;
- static struct sensor_t sensorDescription;
-};
-
-#endif // LSM303d_ORIENTATION_HPP
diff --git a/peripheral/sensors/mraa/sensors/LSM9DS0Accelerometer.cpp b/peripheral/sensors/mraa/sensors/LSM9DS0Accelerometer.cpp
deleted file mode 100644
index 2c79850..0000000
--- a/peripheral/sensors/mraa/sensors/LSM9DS0Accelerometer.cpp
+++ /dev/null
@@ -1,76 +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 impliedt data output.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <cutils/log.h>
-#include "LSM9DS0Accelerometer.hpp"
-#include "SensorsHAL.hpp"
-#include "SensorUtils.hpp"
-
-struct sensor_t LSM9DS0Accelerometer::sensorDescription = {
- .name = "LSM9DS0 Accelerometer",
- .vendor = "Unknown",
- .version = 1,
- .handle = -1,
- .type = SENSOR_TYPE_ACCELEROMETER,
- .maxRange = 16.0f,
- .resolution = 0.061,
- .power = 0.000350,
- .minDelay = 0,
- .fifoReservedEventCount = 0,
- .fifoMaxEventCount = 0,
- .stringType = SENSOR_STRING_TYPE_ACCELEROMETER,
- .requiredPermission = "",
- .maxDelay = 1000,
- .flags = SENSOR_FLAG_CONTINUOUS_MODE,
- .reserved = {},
-};
-
-Sensor * LSM9DS0Accelerometer::createSensor(int pollFd) {
- return new LSM9DS0Accelerometer(pollFd,
- SensorUtils::getI2cBusNumber(),
- LSM9DS0_DEFAULT_GYRO_ADDR, LSM9DS0_DEFAULT_XM_ADDR);
-
-}
-
-void LSM9DS0Accelerometer::initModule() {
- SensorContext::addSensorModule(&sensorDescription, createSensor);
-}
-
-LSM9DS0Accelerometer::LSM9DS0Accelerometer(int pollFd,
- int bus, uint8_t gAddress, uint8_t xmAddress)
- : LSM9DS0 (bus, gAddress, xmAddress), pollFd(pollFd) {
- handle = sensorDescription.handle;
- type = SENSOR_TYPE_ACCELEROMETER;
-}
-
-LSM9DS0Accelerometer::~LSM9DS0Accelerometer() {}
-
-int LSM9DS0Accelerometer::pollEvents(sensors_event_t* data, int count) {
- updateAccelerometer();
- getAccelerometer(&data->acceleration.x, &data->acceleration.y, &data->acceleration.z);
- data->acceleration.x *= Sensor::kGravitationalAcceleration;
- data->acceleration.y *= Sensor::kGravitationalAcceleration;
- data->acceleration.z *= Sensor::kGravitationalAcceleration;
- return 1;
-}
-
-// LSM9DS0 accelerometer sensor implementation
-int LSM9DS0Accelerometer::activate(int handle, int enabled) {
- init();
-
- /* start or stop the acquisition thread */
- return activateAcquisitionThread(pollFd, handle, enabled);
-}
diff --git a/peripheral/sensors/mraa/sensors/LSM9DS0Accelerometer.hpp b/peripheral/sensors/mraa/sensors/LSM9DS0Accelerometer.hpp
deleted file mode 100644
index 4be9acd..0000000
--- a/peripheral/sensors/mraa/sensors/LSM9DS0Accelerometer.hpp
+++ /dev/null
@@ -1,72 +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.
- */
-
-#ifndef LSM9DS0A_ACCELEROMETER_HPP
-#define LSM9DS0A_ACCELEROMETER_HPP
-
-#include <hardware/sensors.h>
-#include "Sensor.hpp"
-#include "lsm9ds0.h"
-
-struct sensors_event_t;
-
-/**
- * LSM9DS0Accelerometer exposes the MLSM9DS0 accelerometer sensor
- *
- * Overrides the pollEvents & activate Sensor methods.
- */
-class LSM9DS0Accelerometer : public Sensor, public upm::LSM9DS0 {
- public:
- /**
- * LSM9DS0Accelerometer constructor
- * @param pollFd poll file descriptor
- * @param bus number of the bus
- * @param gAddress device address
- * @param xmAddress device address
- */
- LSM9DS0Accelerometer(int pollFd, int bus, uint8_t gAddress, uint8_t xmAddress);
-
- /**
- * LSM9DS0Accelerometer destructor
- */
- ~LSM9DS0Accelerometer() override;
-
- /**
- * Poll for events
- * @param data where to store the events
- * @param count the number of events returned must be <= to the count
- * @return number of events returned in data on success and a negative error number otherwise
- */
- int pollEvents(sensors_event_t* data, int count) override;
-
- /**
- * Activate the sensor
- * @param handle sensor identifier
- * @param enabled 1 for enabling and 0 for disabling
- * @return 0 on success and a negative error number otherwise
- */
- int activate(int handle, int enabled);
-
-private:
- static Sensor * createSensor(int pollFd);
- static void initModule() __attribute__((constructor
- (DEFAULT_SENSOR_CONSTRUCTOR_PRIORITY)));
-
- int pollFd;
- static struct sensor_t sensorDescription;
-};
-
-#endif // LSM9DS0A_ACCELEROMETER_HPP
diff --git a/peripheral/sensors/mraa/sensors/MMA7660Accelerometer.cpp b/peripheral/sensors/mraa/sensors/MMA7660Accelerometer.cpp
deleted file mode 100644
index 0aee293..0000000
--- a/peripheral/sensors/mraa/sensors/MMA7660Accelerometer.cpp
+++ /dev/null
@@ -1,83 +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.
- */
-
-#include <cutils/log.h>
-#include "MMA7660Accelerometer.hpp"
-#include "SensorsHAL.hpp"
-#include "SensorUtils.hpp"
-
-struct sensor_t MMA7660Accelerometer::sensorDescription = {
- .name = "MMA7660 Accelerometer",
- .vendor = "Freescale Semiconductor",
- .version = 1,
- .handle = -1,
- .type = SENSOR_TYPE_ACCELEROMETER,
- /* maxRange = 1.5g */
- .maxRange = 14.72f,
- .resolution = 0.459915612f,
- .power = 0.047f,
- .minDelay = 10,
- .fifoReservedEventCount = 0,
- .fifoMaxEventCount = 0,
- .stringType = SENSOR_STRING_TYPE_ACCELEROMETER,
- .requiredPermission = "",
- .maxDelay = 1000,
- .flags = SENSOR_FLAG_CONTINUOUS_MODE,
- .reserved = {},
-};
-
-Sensor * MMA7660Accelerometer::createSensor(int pollFd) {
- return new MMA7660Accelerometer(pollFd,
- SensorUtils::getI2cBusNumber(),
- MMA7660_DEFAULT_I2C_ADDR);
-}
-
-void MMA7660Accelerometer::initModule() {
- SensorContext::addSensorModule(&sensorDescription, createSensor);
-}
-
-MMA7660Accelerometer::MMA7660Accelerometer(int pollFd, int bus, uint8_t address)
- : MMA7660 (bus, address), pollFd(pollFd) {
- handle = sensorDescription.handle;
- type = SENSOR_TYPE_ACCELEROMETER;
-}
-
-MMA7660Accelerometer::~MMA7660Accelerometer() {}
-
-int MMA7660Accelerometer::pollEvents(sensors_event_t* data, int count) {
- getAcceleration(&data->acceleration.x, &data->acceleration.y, &data->acceleration.z);
- data->acceleration.x *= Sensor::kGravitationalAcceleration;
- data->acceleration.y *= Sensor::kGravitationalAcceleration;
- data->acceleration.z *= Sensor::kGravitationalAcceleration;
- return 1;
-}
-
-// MMA7660 accelerometer sensor implementation
-int MMA7660Accelerometer::activate(int handle, int enabled) {
- setModeStandby();
- if (enabled) {
- if (!setSampleRate(upm::MMA7660::AUTOSLEEP_64)) {
- ALOGE("%s: Failed to set sensor SampleRate", __func__);
- return -1;
- }
-
- setModeActive();
- usleep(kActivationPeriod);
- }
-
- /* start or stop the acquisition thread */
- return activateAcquisitionThread(pollFd, handle, enabled);
-}
diff --git a/peripheral/sensors/mraa/sensors/MMA7660Accelerometer.hpp b/peripheral/sensors/mraa/sensors/MMA7660Accelerometer.hpp
deleted file mode 100644
index 5233868..0000000
--- a/peripheral/sensors/mraa/sensors/MMA7660Accelerometer.hpp
+++ /dev/null
@@ -1,78 +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.
- */
-
-#ifndef MMA7660_ACCELEROMETER_HPP
-#define MMA7660_ACCELEROMETER_HPP
-
-#include <hardware/sensors.h>
-#include "Sensor.hpp"
-#include "mma7660.h"
-
-struct sensors_event_t;
-
-/**
- * MMA7660Accelerometer exposes the MMA7660 accelerometer sensor
- *
- * Overrides the pollEvents & activate Sensor methods.
- */
-class MMA7660Accelerometer : public Sensor, public upm::MMA7660 {
- public:
- static const int kMaxRange = 1000;
- /**
- * Time period in microseconds (1/64 * 10^6 = 15625) to wait before
- * requesting events for the default activation sampling rate (64 Hz)
- */
- static const int kActivationPeriod = 15625;
-
- /**
- * MMA7660Accelerometer constructor
- * @param pollFd poll file descriptor
- * @param bus number of the bus
- * @param address device address
- */
- MMA7660Accelerometer(int pollFd, int bus, uint8_t address);
-
- /**
- * MMA7660Accelerometer destructor
- */
- ~MMA7660Accelerometer() override;
-
- /**
- * Poll for events
- * @param data where to store the events
- * @param count the number of events returned must be <= to the count
- * @return number of events returned in data on success and a negative error number otherwise
- */
- int pollEvents(sensors_event_t* data, int count) override;
-
- /**
- * Activate the sensor
- * @param handle sensor identifier
- * @param enabled 1 for enabling and 0 for disabling
- * @return 0 on success and a negative error number otherwise
- */
- int activate(int handle, int enabled);
-
-private:
- static Sensor * createSensor(int pollFd);
- static void initModule() __attribute__((constructor
- (DEFAULT_SENSOR_CONSTRUCTOR_PRIORITY)));
-
- int pollFd;
- static struct sensor_t sensorDescription;
-};
-
-#endif // MMA7660_ACCELEROMETER_HPP
diff --git a/peripheral/sensors/mraa/sensors/MPU9150Accelerometer.cpp b/peripheral/sensors/mraa/sensors/MPU9150Accelerometer.cpp
deleted file mode 100644
index a03ad23..0000000
--- a/peripheral/sensors/mraa/sensors/MPU9150Accelerometer.cpp
+++ /dev/null
@@ -1,80 +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.
- */
-
-#include <cutils/log.h>
-#include "MPU9150Accelerometer.hpp"
-#include "SensorsHAL.hpp"
-#include "SensorUtils.hpp"
-
-struct sensor_t MPU9150Accelerometer::sensorDescription = {
- .name = "MPU9150/9250 Accelerometer",
- .vendor = "InvenSense",
- .version = 1,
- .handle = -1,
- .type = SENSOR_TYPE_ACCELEROMETER,
- /* maxRange = 2g */
- .maxRange = 19.62f,
- .resolution = 0.000061035f,
- .power = 0.0198f,
- .minDelay = 10,
- .fifoReservedEventCount = 0,
- .fifoMaxEventCount = 0,
- .stringType = SENSOR_STRING_TYPE_ACCELEROMETER,
- .requiredPermission = "",
- .maxDelay = 1000,
- .flags = SENSOR_FLAG_CONTINUOUS_MODE,
- .reserved = {},
-};
-
-Sensor * MPU9150Accelerometer::createSensor(int pollFd) {
- return new MPU9150Accelerometer(pollFd,
- SensorUtils::getI2cBusNumber(),
- MPU9150_DEFAULT_I2C_ADDR, AK8975_DEFAULT_I2C_ADDR, false);
-}
-
-void MPU9150Accelerometer::initModule() {
- SensorContext::addSensorModule(&sensorDescription, createSensor);
-}
-
-MPU9150Accelerometer::MPU9150Accelerometer(int pollFd, int bus, int address,
- int magAddress, bool enableAk8975)
- : MPU9150(bus, address, magAddress, enableAk8975), pollFd(pollFd) {
- handle = sensorDescription.handle;
- type = SENSOR_TYPE_ACCELEROMETER;
-}
-
-MPU9150Accelerometer::~MPU9150Accelerometer() {}
-
-int MPU9150Accelerometer::pollEvents(sensors_event_t* data, int count) {
- update();
- getAccelerometer(&data->acceleration.x, &data->acceleration.y, &data->acceleration.z);
- data->acceleration.x *= Sensor::kGravitationalAcceleration;
- data->acceleration.y *= Sensor::kGravitationalAcceleration;
- data->acceleration.z *= Sensor::kGravitationalAcceleration;
- return 1;
-}
-
-int MPU9150Accelerometer::activate(int handle, int enabled) {
- if (enabled) {
- if (init() != true) {
- ALOGE("%s: Failed to initialize sensor error", __func__);
- return -1;
- }
- }
-
- /* start or stop the acquisition thread */
- return activateAcquisitionThread(pollFd, handle, enabled);
-}
diff --git a/peripheral/sensors/mraa/sensors/MPU9150Accelerometer.hpp b/peripheral/sensors/mraa/sensors/MPU9150Accelerometer.hpp
deleted file mode 100644
index 100eb6b..0000000
--- a/peripheral/sensors/mraa/sensors/MPU9150Accelerometer.hpp
+++ /dev/null
@@ -1,74 +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.
- */
-
-#ifndef MPU9150_ACCELEROMETER_HPP
-#define MPU9150_ACCELEROMETER_HPP
-
-#include <hardware/sensors.h>
-#include "Sensor.hpp"
-#include "mpu9150.h"
-
-struct sensors_event_t;
-
-/**
- * MPU9150Accelerometer exposes the MPU9150 accelerometer sensor
- *
- * Overrides the pollEvents & activate Sensor methods.
- */
-class MPU9150Accelerometer : public Sensor, public upm::MPU9150 {
- public:
- /**
- * MPU9150Accelerometer constructor
- * @param pollFd poll file descriptor
- * @param bus number of the bus
- * @param address device address
- * @param magAddress magnetometer address
- * @param enableAk8975 whether to enable AK8975 or not
- */
- MPU9150Accelerometer(int pollFd, int bus=MPU9150_I2C_BUS,
- int address=MPU9150_DEFAULT_I2C_ADDR,
- int magAddress=AK8975_DEFAULT_I2C_ADDR, bool enableAk8975=false);
-
- /**
- * MPU9150Accelerometer destructor
- */
- ~MPU9150Accelerometer() override;
-
- /**
- * Poll for events
- * @param data where to store the events
- * @param count the number of events returned must be <= to the count
- * @return number of events returned in data on success and a negative error number otherwise
- */
- int pollEvents(sensors_event_t* data, int count) override;
-
- /**
- * Activate the sensor
- * @param handle sensor identifier
- * @param enabled 1 for enabling and 0 for disabling
- * @return 0 on success and a negative error number otherwise
- */
- int activate(int handle, int enabled);
-
- private:
- static Sensor * createSensor(int pollFd);
- static void initModule() __attribute__((constructor));
-
- int pollFd;
- static struct sensor_t sensorDescription;
-};
-
-#endif // MPU9150_ACCELEROMETER_HPP
diff --git a/peripheral/sensors/mraa/sensors/ProximityGPIO.cpp b/peripheral/sensors/mraa/sensors/ProximityGPIO.cpp
deleted file mode 100644
index 2fe0aaa..0000000
--- a/peripheral/sensors/mraa/sensors/ProximityGPIO.cpp
+++ /dev/null
@@ -1,84 +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.
- */
-
-/*
- * A Proximity sensor with a true/false value read in via GPIO
- * is implemented. The Sensor HAL returns a float for the proximity
- * distance... but in the case of a GPIO sensor, we only have close and
- * no-close (1/0). We fake the distance by returning the values below.
- */
-#define kProximityClose 0.0
-#define kProximityFar 100.0
-
-
-/*
- * We monitor GPIO48 for the proximity reading.
- * This corresponids to IO7 on the Arduino shield and is
- * not multiplexed with any other functionality.
- *
- * The mraa library expects the Arudino sheild pin number here when
- * talking to the Arduino expansion board. Change this appropriate when
- * using a different GPIO pin or different Edison breakout board.
- */
-#define kPinGPIO 7
-
-#include <cutils/log.h>
-#include "ProximityGPIO.hpp"
-#include "SensorsHAL.hpp"
-
-struct sensor_t ProximityGPIO::sensorDescription = {
- .name = "Proximity GPIO Sensor",
- .vendor = "Unknown",
- .version = 1,
- .handle = -1,
- .type = SENSOR_TYPE_PROXIMITY,
- .maxRange = 100.0f,
- .resolution = 1.0f,
- .power = 0.001f,
- .minDelay = 10,
- .fifoReservedEventCount = 0,
- .fifoMaxEventCount = 0,
- .stringType = SENSOR_STRING_TYPE_PROXIMITY,
- .requiredPermission = "",
- .maxDelay = 1000,
- .flags = SENSOR_FLAG_ON_CHANGE_MODE,
- .reserved = {},
-};
-
-Sensor * ProximityGPIO::createSensor(int pollFd) {
- return new ProximityGPIO(pollFd, kPinGPIO);
-}
-
-void ProximityGPIO::initModule() {
- SensorContext::addSensorModule(&sensorDescription, createSensor);
-}
-
-ProximityGPIO::ProximityGPIO(int pollFd, int pin) : upm::GroveButton(pin), pollFd(pollFd) {
- handle = sensorDescription.handle;
- type = SENSOR_TYPE_PROXIMITY;
-}
-
-ProximityGPIO::~ProximityGPIO() {}
-
-int ProximityGPIO::pollEvents(sensors_event_t* data, int count) {
- data->distance = !value() ? kProximityClose: kProximityFar;
- return 1;
-}
-
-int ProximityGPIO::activate(int handle, int enabled) {
- /* start or stop the acquisition thread */
- return activateAcquisitionThread(pollFd, handle, enabled);
-}
diff --git a/peripheral/sensors/mraa/sensors/ProximityGPIO.hpp b/peripheral/sensors/mraa/sensors/ProximityGPIO.hpp
deleted file mode 100644
index 24935f7..0000000
--- a/peripheral/sensors/mraa/sensors/ProximityGPIO.hpp
+++ /dev/null
@@ -1,70 +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.
- */
-
-#ifndef PROXIMITY_GPIO_HPP
-#define PROXIMITY_GPIO_HPP
-
-#include <hardware/sensors.h>
-#include "Sensor.hpp"
-#include "grove.h"
-
-struct sensors_event_t;
-
-/**
- * ProximityGPIO exposes the Grove Button sensor
- *
- * Overrides the pollEvents & activate Sensor methods.
- */
-class ProximityGPIO : public Sensor, public upm::GroveButton {
- public:
- /**
- * GroveButton constructor
- * @param pollFd poll file descriptor
- * @param pin number of the analog input
- */
- ProximityGPIO(int pollFd, int pin);
-
- /**
- * ProximityGPIO destructor
- */
- ~ProximityGPIO() override;
-
- /**
- * Poll for events
- * @param data where to store the events
- * @param count the number of events returned must be <= to the count
- * @return number of events returned in data on success and a negative error number otherwise
- */
- int pollEvents(sensors_event_t* data, int count) override;
-
- /**
- * Activate the sensor
- * @param handle sensor identifier
- * @param enabled 1 for enabling and 0 for disabling
- * @return 0 on success and a negative error number otherwise
- */
- int activate(int handle, int enabled);
-
- private:
- static Sensor * createSensor(int pollFd);
- static void initModule() __attribute__((constructor
- (DEFAULT_SENSOR_CONSTRUCTOR_PRIORITY)));
-
- int pollFd;
- static struct sensor_t sensorDescription;
-};
-
-#endif // PROXIMITY_GPIO_HPP