redbear / nRF5x

nRF51822 and nRF52832 based baords, e.g. BLE Nano, RBL_nRF51822, Nano 2 and Blend 2
189 stars 93 forks source link

Add Nano V2 specific board define to library compiles to fix the WStream Incompatibility #20

Open drmpf opened 7 years ago

drmpf commented 7 years ago

The Arduino support for Nano V2 is not compatiable with Arduino Stream. The Nano V2 replaces the Arduino Stream with WStream while calls to Stream pick up the incompatible mbed::Stream This breaks standard libraries.

One solution is to add the following

#if defined( ARDUINO_RBL_nRF52832)
  #include <WStream.h>
  #define Stream WStream
#else
  #include <Stream.h>
#endif

But this does not work because ARDUINO_RBL_nRF52832 is only defined when detecting libraries and is not defined when compiling included libraries via the Arduino IDE Please make a board specific define available that is defined only for this board and defined for ALL compilations.

drmpf commented 7 years ago

Note for Nano V1.5 ARDUINO_RBL_nRF51822 is defined for both detecting libraries and for compiling libraries