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..e81cffa2 --- /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,1,5,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() + { + } diff --git a/src/lmic/lmic.h b/src/lmic/lmic.h index 210fbd61..d01a0530 100644 --- a/src/lmic/lmic.h +++ b/src/lmic/lmic.h @@ -93,11 +93,29 @@ 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, 1, 5, 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) + +#define ARDUINO_LMIC_VERSION_GET_LOCAL(v) \ + ((v) & 0xFFu) + //! Only For Antenna Tuning Tests ! //#define CFG_TxContinuousMode 1