This commit is contained in:
Thomas Kunze 2019-12-18 21:28:01 +01:00
commit 15bd076c28
11 changed files with 272 additions and 58 deletions

View File

@ -1,16 +1,8 @@
language: cpp
cache:
directories:
- ~/arduino_ide
- ~/.arduino15/packages/
git:
depth: false
quiet: true
matrix:
include:
- os: linux
# Test build for Linux platform
- language: cpp
os: linux
addons:
apt:
sources:
@ -19,50 +11,95 @@ matrix:
- g++-7
env:
- MATRIX_EVAL="CC=gcc-7 && CXX=g++-7"
- MODE=LINUX
- os: linux
env:
- MODE=ARDUINO
cache:
directories:
- ~/arduino_ide
- ~/.arduino15/packages/
git:
depth: false
quiet: true
before_install:
- eval "${MATRIX_EVAL}"
install:
script:
- cd examples/knx-linux
- mkdir -p build
- cd build
- cmake ..
- make
# Test build for Arduino platform
- language: cpp
os: linux
env:
cache:
directories:
- ~/arduino_ide
- ~/.arduino15/packages/
git:
depth: false
quiet: true
before_install:
- downloadArduinoLib() { wget -O $1.zip $2; unzip -o $1.zip -d $HOME/arduino_ide/libraries; }
- if [ "$MODE" = "LINUX" ]; then eval "${MATRIX_EVAL}"; fi
- if [ "$MODE" = "ARDUINO" ]; then source <(curl -SLs "https://raw.githubusercontent.com/adafruit/travis-ci-arduino/master/install.sh"); fi
- if [ "$MODE" = "ARDUINO" ]; then downloadArduinoLib FlashStorage "https://github.com/thelsing/FlashStorage/archive/master.zip"; fi
- if [ "$MODE" = "ARDUINO" ]; then downloadArduinoLib BSEC "https://github.com/BoschSensortec/BSEC-Arduino-library/archive/master.zip"; fi
- source <(curl -SLs "https://raw.githubusercontent.com/adafruit/travis-ci-arduino/master/install.sh")
- downloadArduinoLib FlashStorage "https://github.com/thelsing/FlashStorage/archive/master.zip"
- downloadArduinoLib BSEC "https://github.com/BoschSensortec/BSEC-Arduino-library/archive/master.zip"
# only default warning level
- if [ "$MODE" = "ARDUINO" ]; then sed -i 's#compiler.warning_level=all#compiler.warning_level=default#' ~/.arduino15/preferences.txt; fi
- sed -i 's#compiler.warning_level=all#compiler.warning_level=default#' ~/.arduino15/preferences.txt
# changes for bsec lib
# samd
- if [ "$MODE" = "ARDUINO" ]; then sed -ri 's#(recipe.c.combine.pattern=[^$]*\{archive_file\}")( -Wl,--end-group)#\1 {compiler.libraries.ldflags}\2#' ~/.arduino15/packages/arduino/hardware/samd/1.8.4/platform.txt; fi
- if [ "$MODE" = "ARDUINO" ]; then sed -i 's#compiler.elf2hex.extra_flags=#compiler.elf2hex.extra_flags=\ncompiler.libraries.ldflags=#' ~/.arduino15/packages/arduino/hardware/samd/1.8.4/platform.txt; fi
- sed -ri 's#(recipe.c.combine.pattern=[^$]*\{archive_file\}")( -Wl,--end-group)#\1 {compiler.libraries.ldflags}\2#' ~/.arduino15/packages/arduino/hardware/samd/1.8.4/platform.txt
- sed -i 's#compiler.elf2hex.extra_flags=#compiler.elf2hex.extra_flags=\ncompiler.libraries.ldflags=#' ~/.arduino15/packages/arduino/hardware/samd/1.8.4/platform.txt
# esp8266
- if [ "$MODE" = "ARDUINO" ]; then sed -ri 's#(recipe.c.combine.pattern=[^$]*\{compiler.c.elf.libs\})( -Wl,--end-group "-L\{build.path\}")#\1 {compiler.libraries.ldflags}\2#' ~/.arduino15/packages/esp8266/hardware/esp8266/2.6.2/platform.txt; fi
- if [ "$MODE" = "ARDUINO" ]; then sed -i 's#compiler.elf2hex.extra_flags=#compiler.elf2hex.extra_flags=\ncompiler.libraries.ldflags=#' ~/.arduino15/packages/esp8266/hardware/esp8266/2.6.2/platform.txt; fi
- if [ "$MODE" = "ARDUINO" ]; then sed -i '/^.*libalgobsec.*$/d' ~/.arduino15/packages/esp8266/hardware/esp8266/2.6.2/tools/sdk/ld/eagle.app.v6.common.ld.h; fi
- if [ "$MODE" = "ARDUINO" ]; then sed -ri 's#(\*libwps\.a:\(\.literal\.\* \.text\.\*\))#\1\n *libalgobsec.a:(.literal.* .text.*)#' ~/.arduino15/packages/esp8266/hardware/esp8266/2.6.2/tools/sdk/ld/eagle.app.v6.common.ld.h; fi
- sed -ri 's#(recipe.c.combine.pattern=[^$]*\{compiler.c.elf.libs\})( -Wl,--end-group "-L\{build.path\}")#\1 {compiler.libraries.ldflags}\2#' ~/.arduino15/packages/esp8266/hardware/esp8266/2.6.3/platform.txt
- sed -i 's#compiler.elf2hex.extra_flags=#compiler.elf2hex.extra_flags=\ncompiler.libraries.ldflags=#' ~/.arduino15/packages/esp8266/hardware/esp8266/2.6.3/platform.txt
- sed -i '/^.*libalgobsec.*$/d' ~/.arduino15/packages/esp8266/hardware/esp8266/2.6.3/tools/sdk/ld/eagle.app.v6.common.ld.h
- sed -ri 's#(\*libwps\.a:\(\.literal\.\* \.text\.\*\))#\1\n *libalgobsec.a:(.literal.* .text.*)#' ~/.arduino15/packages/esp8266/hardware/esp8266/2.6.3/tools/sdk/ld/eagle.app.v6.common.ld.h
# the HDC100X lib is not properly set up in githup so move things around a bit
- if [ "$MODE" = "ARDUINO" ]; then rm -rf $HOME/arduino_ide/libraries/HDC100X_Arduino_Library-master; fi
- if [ "$MODE" = "ARDUINO" ]; then downloadArduinoLib HDC100X "https://github.com/RFgermany/HDC100X_Arduino_Library/archive/master.zip"; fi
- if [ "$MODE" = "ARDUINO" ]; then mv $HOME/arduino_ide/libraries/HDC100X_Arduino_Library-master/HDC100X/* $HOME/arduino_ide/libraries/HDC100X_Arduino_Library-master; fi
- rm -rf $HOME/arduino_ide/libraries/HDC100X_Arduino_Library-master
- downloadArduinoLib HDC100X "https://github.com/RFgermany/HDC100X_Arduino_Library/archive/master.zip"
- mv $HOME/arduino_ide/libraries/HDC100X_Arduino_Library-master/HDC100X/* $HOME/arduino_ide/libraries/HDC100X_Arduino_Library-master
#- buildExampleSketch() { arduino --verify --board $BOARD $PWD/examples/$1/$1.ino; }
install:
- if [ "$MODE" = "ARDUINO" ]; then arduino --install-library "WiFiManager"; fi
- arduino --install-library "WiFiManager"
script:
- if [ "$MODE" = "LINUX" ]; then cd knx-linux; fi
- if [ "$MODE" = "LINUX" ]; then mkdir -p build; fi
- if [ "$MODE" = "LINUX" ]; then cd build; fi
- if [ "$MODE" = "LINUX" ]; then cmake ..; fi
- if [ "$MODE" = "LINUX" ]; then make; fi
# - if [ "$MODE" = "ARDUINO" ]; then buildExampleSketch knx-demo; fi
# - if [ "$MODE" = "ARDUINO" ]; then buildExampleSketch knx-sonoffS20; fi
# - if [ "$MODE" = "ARDUINO" ]; then buildExampleSketch knx-bme680; fi
# - if [ "$MODE" = "ARDUINO" ]; then buildExampleSketch knx-hdc1008; fi
- if [ "$MODE" = "ARDUINO" ]; then build_platform zero; fi
- if [ "$MODE" = "ARDUINO" ]; then build_platform esp8266; fi
# - buildExampleSketch knx-demo
# - buildExampleSketch knx-sonoffS20
# - buildExampleSketch knx-bme680
# - buildExampleSketch knx-hdc1008
- build_platform zero
- build_platform esp8266
# Test build for PlatformIO based projects
- language: python
python:
- "2.7"
cache:
directories:
- "~/.platformio"
env:
- PLATFORMIO_EXTRA_SCRIPTS=pre:/tmp/scripts/custom_hwids.py
install:
- pip install -U platformio
- platformio update
script:
# PRE scripts have to be copied manually as "platformio ci does not care about it"
- mkdir -p /tmp/scripts
- cp examples/knx-usb/custom_hwids.py /tmp/scripts
# Enable verbose output of platformio
#- platformio settings set force_verbose yes
- echo "-------";echo "Compiling example knx-usb";echo "--------";
- platformio ci --lib="." --project-conf=examples/knx-usb/platformio-ci.ini examples/knx-usb/src/main.cpp
- echo "-------";echo "Compiling example knx-demo";echo "--------";
- platformio ci --lib="." --project-conf=examples/knx-demo/platformio-ci.ini examples/knx-demo/knx-demo.ino
notifications:
email:

5
examples/knx-demo/.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
.pio
.vscode/.browse.c_cpp.db*
.vscode/c_cpp_properties.json
.vscode/launch.json
.vscode/ipch

View File

@ -0,0 +1,7 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"platformio.platformio-ide"
]
}

View File

@ -0,0 +1,51 @@
;PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
;--- SAMD --------------------------------------------------
[env:adafruit_feather_m0]
platform = atmelsam
board = adafruit_feather_m0
framework = arduino
lib_deps =
SPI
https://github.com/thelsing/FlashStorage.git
knx
build_flags =
-DMEDIUM_TYPE=2
-Wno-unknown-pragmas
;-----------------------------------------------------------
;--- ESP8266 -----------------------------------------------
[env:nodemcuv2]
platform = espressif8266
board = nodemcuv2
framework = arduino
lib_deps =
WifiManager
knx
build_flags =
-Wno-unknown-pragmas
;---------------------------------------------------------
;--- ESP32 -----------------------------------------------
[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
lib_deps =
knx
build_flags =
-Wno-unknown-pragmas

View File

@ -0,0 +1,68 @@
;PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
[platformio]
; We have to keep libdeps dir out the project directory otherwise,
; library scanner seems to have issues so compilation fails
libdeps_dir = /tmp/libdeps
src_dir = .
;--- SAMD --------------------------------------------------
[env:adafruit_feather_m0]
platform = atmelsam
board = adafruit_feather_m0
framework = arduino
; We consider that the this projects is opened within its project directory
; while working with VS Code.
lib_extra_dirs = ../../../
lib_deps =
SPI
https://github.com/thelsing/FlashStorage.git
knx
build_flags =
-DMEDIUM_TYPE=2
-Wno-unknown-pragmas
;-----------------------------------------------------------
;--- ESP8266 -----------------------------------------------
[env:nodemcuv2]
platform = espressif8266
board = nodemcuv2
framework = arduino
; We consider that the this projects is opened within its project directory
; while working with VS Code.
lib_extra_dirs = ../../../
lib_deps =
WifiManager
knx
build_flags =
-Wno-unknown-pragmas
;---------------------------------------------------------
;--- ESP32 -----------------------------------------------
[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
; We consider that the this projects is opened within its project directory
; while working with VS Code.
lib_extra_dirs = ../../../
lib_deps =
knx
build_flags =
-Wno-unknown-pragmas

View File

@ -0,0 +1,7 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"platformio.platformio-ide"
]
}

View File

@ -1,5 +1,8 @@
Import("env")
# access to global build environment
print(env)
board_config = env.BoardConfig()
board_config.update("build.hwids", [
# ["0x135e", "0x0024"] # Merten GmbH & Co. KG

View File

@ -0,0 +1,30 @@
;PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
[env:adafruit_feather_m0]
platform = atmelsam
board = adafruit_feather_m0
framework = arduino
; VID must be changed to some known KNX Manufacturer
; so that the KNX USB interface gets recognized by ETS
extra_scripts = pre:custom_hwids.py
board_build.usb_product="KNX RF - USB Interface"
lib_deps =
SPI
Adafruit TinyUSB Library
https://github.com/thelsing/FlashStorage.git
knx
build_flags =
-DMEDIUM_TYPE=2
-DUSE_CEMI_SERVER
-DUSE_TINYUSB
-Wno-unknown-pragmas

View File

@ -7,11 +7,18 @@
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
[platformio]
; We have to keep libdeps dir out the project directory otherwise,
; library scanner seems to have issues so compilation fails
libdeps_dir = /tmp/libdeps
[env:adafruit_feather_m0]
platform = atmelsam
board = adafruit_feather_m0
framework = arduino
; We consider that the this projects is opened within its project directory
; while working with VS Code.
lib_extra_dirs = ../../../
; VID must be changed to some known KNX Manufacturer
; so that the KNX USB interface gets recognized by ETS
@ -19,8 +26,8 @@ extra_scripts = pre:custom_hwids.py
board_build.usb_product="KNX RF - USB Interface"
lib_deps =
Adafruit_TinyUSB_Arduino
SPI
Adafruit TinyUSB Library
https://github.com/thelsing/FlashStorage.git
knx
@ -32,4 +39,3 @@ build_flags =
debug_tool = jlink
#upload_protocol = jlink

View File

@ -10,7 +10,7 @@
#define GPIO_GDO0_PIN 24 // GPIO 24 (GPIO_GEN5) -> WiringPi: 5 -> Pin number on header: 18
#endif
#define USE_CEMI_SERVER
//#define USE_CEMI_SERVER
#define USE_RF
#define USE_TP
#define USE_IP

View File

@ -7,7 +7,7 @@
#include "callback_property.h"
//224.0.23.12
#define DEFAULT_MULTICAST_ADDR 0xE000170C
#define DEFAULT_MULTICAST_ADDR ((uint32_t)0xE000170C)
IpParameterObject::IpParameterObject(DeviceObject& deviceObject, Platform& platform): _deviceObject(deviceObject),
_platform(platform)