From 6036f2005a6b535a7949183a41fd43662aa11b61 Mon Sep 17 00:00:00 2001 From: Terry Moore Date: Sat, 9 Jun 2018 21:31:45 -0400 Subject: [PATCH 1/4] Fix #75: add new version symbols for this library --- src/lmic/lmic.h | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/lmic/lmic.h b/src/lmic/lmic.h index 210fbd61..007a8dd8 100644 --- a/src/lmic/lmic.h +++ b/src/lmic/lmic.h @@ -93,11 +93,26 @@ extern "C"{ #endif -// LMIC version +// LMIC version -- this is ths IBM LMIC version #define LMIC_VERSION_MAJOR 1 #define LMIC_VERSION_MINOR 6 #define LMIC_VERSION_BUILD 1468577746 +// Arduino LMIC version +#define ARDUINO_LMIC_VERSION_CALC(major, minor, patch, local) \ + (((major) << 24u) | ((minor) << 16u) | ((patch) << 8u) | (local)) + +#define ARDUINO_LMIC_VERSION ARDUINO_LMIC_VERSION_CALC(2, 2, 0, 0) + +#define ARDUINO_LMIC_VERSION_GET_MAJOR(v) \ + (((v) >> 24u) & 0xFFu) + +#define ARDUINO_LMIC_VERSION_GET_MINOR(v) \ + (((v) >> 16u) & 0xFFu) + +#define ARDUINO_LMIC_VERSION_GET_PATCH(v) \ + (((v) >> 8u) & 0xFFu) + //! Only For Antenna Tuning Tests ! //#define CFG_TxContinuousMode 1 From 4c23be1dd5cc18f4ac4cb061aad06522a796bf46 Mon Sep 17 00:00:00 2001 From: Terry Moore Date: Sat, 9 Jun 2018 22:01:44 -0400 Subject: [PATCH 2/4] Add getter for local increment --- src/lmic/lmic.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/lmic/lmic.h b/src/lmic/lmic.h index 007a8dd8..17fd9fc0 100644 --- a/src/lmic/lmic.h +++ b/src/lmic/lmic.h @@ -113,6 +113,9 @@ extern "C"{ #define ARDUINO_LMIC_VERSION_GET_PATCH(v) \ (((v) >> 8u) & 0xFFu) +#define ARDUINO_LMIC_VERSION_GET_LOCAL(v) \ + ((v) & 0xFFu) + //! Only For Antenna Tuning Tests ! //#define CFG_TxContinuousMode 1 From 777a061e4ae1d9c8afa6db0cfacdbebd50eef597 Mon Sep 17 00:00:00 2001 From: Terry Moore Date: Sat, 9 Jun 2018 22:02:15 -0400 Subject: [PATCH 3/4] Add simple continuous integration check for version macros --- .travis.yml | 13 ++++++---- examples/header_test/header_test.ino | 36 ++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 5 deletions(-) create mode 100644 examples/header_test/header_test.ino diff --git a/.travis.yml b/.travis.yml index 8329fda4..761b9be2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,7 +20,7 @@ before_install: # - "function _samdopts { echo mcci:samd:${1:-mcci_catena_4450}:lorawan_region=${2:-us915} ; }" - "function _stm32l0opts { echo mcci:stm32:Catena:pnum=${1:-CATENA_4551},opt=${3:-osstd},xserial=${4:-generic},usb=${5:-none},upload_method=${6:-STLink} ; }" - # + # # Put one or more arguments into lmic_project_config.h as `#define $i\n` - function _projcfg { for i in "$@" ; do printf '#define %s 1\n' "$i" ; done > $PWD/project_config/lmic_project_config.h ; } # @@ -29,17 +29,20 @@ before_install: # # modify the board manager preferences to point to our BSPs. - arduino --pref "boardsmanager.additional.urls=https://github.com/mcci-catena/arduino-boards/raw/master/BoardManagerFiles/package_mcci_index.json" --save-prefs + # + # show the output of the config commands for reference. + - "echo $(_stm32l0opts) $(_stm32l0opts '' projcfg)" + - "echo $(_samdopts) $(_samdopts '' projcfg)" install: - arduino --install-boards mcci:samd - arduino --install-boards mcci:stm32 script: -# -# show the output of the config commands for reference. - - "echo $(_stm32l0opts) $(_stm32l0opts '' projcfg)" - - "echo $(_samdopts) $(_samdopts '' projcfg)" +# simple header file test + - arduino --verify --board $(_samdopts) $PWD/examples/header_test/header_test.ino + - arduino --verify --board $(_stm32l0opts) $PWD/examples/header_test/header_test.ino # # test each of the regions. - arduino --verify --board $(_samdopts '' us915) $PWD/examples/raw-feather/raw-feather.ino diff --git a/examples/header_test/header_test.ino b/examples/header_test/header_test.ino new file mode 100644 index 00000000..7e3b4208 --- /dev/null +++ b/examples/header_test/header_test.ino @@ -0,0 +1,36 @@ +/* + +Module: header_test.ino + +Function: + Simple hello-world (and compile-test) app + +Copyright notice and License: + See LICENSE file accompanying this project. + +Author: + Terry Moore, MCCI Corporation April 2018 + +*/ + +#include + +# define STATIC_ASSERT(e) \ + void STATIC_ASSERT__(int MCCIADK_C_ASSERT_x[(e) ? 1: -1]) + +STATIC_ASSERT(ARDUINO_LMIC_VERSION >= ARDUINO_LMIC_VERSION_CALC(2,2,0,0)); + +STATIC_ASSERT(ARDUINO_LMIC_VERSION_CALC(1,2,3,4) == 0x01020304); + +STATIC_ASSERT(ARDUINO_LMIC_VERSION_GET_MAJOR(ARDUINO_LMIC_VERSION_CALC(1,2,3,4)) == 1); +STATIC_ASSERT(ARDUINO_LMIC_VERSION_GET_MINOR(ARDUINO_LMIC_VERSION_CALC(1,2,3,4)) == 2); +STATIC_ASSERT(ARDUINO_LMIC_VERSION_GET_PATCH(ARDUINO_LMIC_VERSION_CALC(1,2,3,4)) == 3); +STATIC_ASSERT(ARDUINO_LMIC_VERSION_GET_LOCAL(ARDUINO_LMIC_VERSION_CALC(1,2,3,4)) == 4); + +void setup() + { + } + +void loop() + { + } From 1569158b7842e3ad1bf14a9934150b2de7662ad8 Mon Sep 17 00:00:00 2001 From: Terry Moore Date: Sat, 9 Jun 2018 22:46:24 -0400 Subject: [PATCH 4/4] Set version back to 2.1.5 internally so we can merge --- examples/header_test/header_test.ino | 2 +- src/lmic/lmic.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/header_test/header_test.ino b/examples/header_test/header_test.ino index 7e3b4208..e81cffa2 100644 --- a/examples/header_test/header_test.ino +++ b/examples/header_test/header_test.ino @@ -18,7 +18,7 @@ Author: # define STATIC_ASSERT(e) \ void STATIC_ASSERT__(int MCCIADK_C_ASSERT_x[(e) ? 1: -1]) -STATIC_ASSERT(ARDUINO_LMIC_VERSION >= ARDUINO_LMIC_VERSION_CALC(2,2,0,0)); +STATIC_ASSERT(ARDUINO_LMIC_VERSION >= ARDUINO_LMIC_VERSION_CALC(2,1,5,0)); STATIC_ASSERT(ARDUINO_LMIC_VERSION_CALC(1,2,3,4) == 0x01020304); diff --git a/src/lmic/lmic.h b/src/lmic/lmic.h index 17fd9fc0..d01a0530 100644 --- a/src/lmic/lmic.h +++ b/src/lmic/lmic.h @@ -102,7 +102,7 @@ extern "C"{ #define ARDUINO_LMIC_VERSION_CALC(major, minor, patch, local) \ (((major) << 24u) | ((minor) << 16u) | ((patch) << 8u) | (local)) -#define ARDUINO_LMIC_VERSION ARDUINO_LMIC_VERSION_CALC(2, 2, 0, 0) +#define ARDUINO_LMIC_VERSION ARDUINO_LMIC_VERSION_CALC(2, 1, 5, 0) #define ARDUINO_LMIC_VERSION_GET_MAJOR(v) \ (((v) >> 24u) & 0xFFu)