Skip to content

Commit

Permalink
Merge pull request #76 from mcci-catena/issue75
Browse files Browse the repository at this point in the history
Fix #75: add new version-symbols for this library
  • Loading branch information
terrillmoore authored Jun 10, 2018
2 parents 78a5907 + 1569158 commit 2d1e1db
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 6 deletions.
13 changes: 8 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 ; }
#
Expand All @@ -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
Expand Down
36 changes: 36 additions & 0 deletions examples/header_test/header_test.ino
Original file line number Diff line number Diff line change
@@ -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 <lmic.h>

# 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()
{
}
20 changes: 19 additions & 1 deletion src/lmic/lmic.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 2d1e1db

Please sign in to comment.