diff --git a/.travis.yml b/.travis.yml index a3fc8a0a..529a4e46 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,8 +5,14 @@ git: quiet: true env: - - BSP_PATH="$HOME/.arduino15/packages/adafruit/hardware/nrf52" - + global: + - BSP_PATH="$HOME/.arduino15/packages/adafruit/hardware/nrf52" + jobs: + # Split into one job per board (aka variant) + - VARIANT="feather52840" + - VARIANT="cplaynrf52840" + - VARIANT="feather52832" + addons: apt: packages: diff --git a/changelog.md b/changelog.md index f8abe4f9..52e2a7df 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,10 @@ # Adafruit nRF52 Arduino Core Changelog +## 0.14.6 - 2019.10.30 + +- Added power switch pin for Circuit Playground Bluefruit +- Make min/max templates + ## 0.14.5 - 2019.10.21 - Added Itsy nRF52840 Express support diff --git a/cores/nRF5/Arduino.h b/cores/nRF5/Arduino.h index 420c000f..5497dbbd 100644 --- a/cores/nRF5/Arduino.h +++ b/cores/nRF5/Arduino.h @@ -85,8 +85,33 @@ void suspendLoop(void); #undef abs #endif // abs -#define min(a,b) ((a)<(b)?(a):(b)) -#define max(a,b) ((a)>(b)?(a):(b)) +#ifdef __cplusplus + template + auto min(const T& a, const L& b) -> decltype((b < a) ? b : a) + { + return (b < a) ? b : a; + } + + template + auto max(const T& a, const L& b) -> decltype((b < a) ? b : a) + { + return (a < b) ? b : a; + } +#else +#ifndef min +#define min(a,b) \ + ({ __typeof__ (a) _a = (a); \ + __typeof__ (b) _b = (b); \ + _a < _b ? _a : _b; }) +#endif +#ifndef max +#define max(a,b) \ + ({ __typeof__ (a) _a = (a); \ + __typeof__ (b) _b = (b); \ + _a > _b ? _a : _b; }) +#endif +#endif + #define abs(x) ((x)>0?(x):-(x)) #define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt))) #define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5)) diff --git a/cores/nRF5/WInterrupts.c b/cores/nRF5/WInterrupts.c index 9f698852..dce18ca7 100644 --- a/cores/nRF5/WInterrupts.c +++ b/cores/nRF5/WInterrupts.c @@ -144,6 +144,10 @@ void detachInterrupt(uint32_t pin) void GPIOTE_IRQHandler() { +#if CFG_DEBUG >= 3 + SEGGER_SYSVIEW_RecordEnterISR(); +#endif + uint32_t event = offsetof(NRF_GPIOTE_Type, EVENTS_IN[0]); for (int ch = 0; ch < NUMBER_OF_GPIO_TE; ch++) { @@ -166,4 +170,8 @@ void GPIOTE_IRQHandler() event = (uint32_t)((uint32_t)event + 4); } + +#if CFG_DEBUG >= 3 + SEGGER_SYSVIEW_RecordExitISR(); +#endif } diff --git a/libraries/Bluefruit52Lib/library.properties b/libraries/Bluefruit52Lib/library.properties index f0c63763..b25ecee1 100644 --- a/libraries/Bluefruit52Lib/library.properties +++ b/libraries/Bluefruit52Lib/library.properties @@ -1,5 +1,5 @@ name=Adafruit Bluefruit nRF52 Libraries -version=0.14.5 +version=0.14.6 author=Adafruit maintainer=Adafruit sentence=Arduino library for nRF52-based Adafruit Bluefruit LE modules diff --git a/platform.txt b/platform.txt index e9ff11d8..a34a5afd 100644 --- a/platform.txt +++ b/platform.txt @@ -17,7 +17,7 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA name=Adafruit nRF52 Boards -version=0.14.5 +version=0.14.6 # Compile variables # ----------------- diff --git a/tools/build_all.py b/tools/build_all.py index 76689772..f0d01f57 100644 --- a/tools/build_all.py +++ b/tools/build_all.py @@ -65,8 +65,23 @@ def build_examples(variant): build_time = time.monotonic() -for var in variants_dict: - build_examples(var) +ENV_VARIABLE_NAME = 'VARIANT' + +# build only one variant if the environment variable is specified +if (ENV_VARIABLE_NAME in os.environ): + variant = os.environ.get(ENV_VARIABLE_NAME) + # only use the environment variable if the variant exists in the dictionary + if (variant in variants_dict): + build_examples(variant) + else: + print('\033[31failed\033[0m - invalid variant name "{}"'.format(variant)) + fail_count += 1 + exit_status = -1 + +else: # no environment variable specified, so build all variants + for var in variants_dict: + build_examples(var) + print(build_separator) build_time = time.monotonic() - build_time diff --git a/variants/circuitplayground_nrf52840/variant.cpp b/variants/circuitplayground_nrf52840/variant.cpp index fbb44b02..a29f722e 100644 --- a/variants/circuitplayground_nrf52840/variant.cpp +++ b/variants/circuitplayground_nrf52840/variant.cpp @@ -69,7 +69,8 @@ const uint32_t g_ADigitalPinMap[] = 32, // D33 is P1.00 (QSPI Data 2) 22, // D34 is P0.22 (QSPI Data 3) - + // D35 power switch + 6, // D36 is P0.06 (NeoPixel / Sensor switch) }; void initVariant() diff --git a/variants/circuitplayground_nrf52840/variant.h b/variants/circuitplayground_nrf52840/variant.h index c7fdd8cc..eaabe332 100644 --- a/variants/circuitplayground_nrf52840/variant.h +++ b/variants/circuitplayground_nrf52840/variant.h @@ -37,8 +37,8 @@ extern "C" #endif // __cplusplus // Number of pins defined in PinDescription array -#define PINS_COUNT (35) -#define NUM_DIGITAL_PINS (35) +#define PINS_COUNT (36) +#define NUM_DIGITAL_PINS (36) #define NUM_ANALOG_INPUTS (8) #define NUM_ANALOG_OUTPUTS (0)