sparkfun / SparkFun_AS3935_Lightning_Detector_Arduino_Library

Other
37 stars 19 forks source link

Compile Error: SPI.setBitOrder(MSBFIRST) #15

Closed bethanysciences closed 4 years ago

bethanysciences commented 4 years ago

Subject of the issue

Working with example code Example1_BasicLightening_SPI get following error on compile:

/Users/bobbysmith/Dropbox/Arduino/libraries/SparkFun_AS3935_Lightning_Detector_Arduino_Library/src/SparkFun_AS3935.cpp: In member function 'bool SparkFun_AS3935::beginSPI(uint8_t, uint32_t, arduino::SPIClass&)':
/Users/bobbysmith/Dropbox/Arduino/libraries/SparkFun_AS3935_Lightning_Detector_Arduino_Library/src/SparkFun_AS3935.cpp:58:9: error: 'class arduino::MbedSPI' has no member named 'setBitOrder'
     SPI.setBitOrder(MSBFIRST);
         ^~~~~~~~~~~
exit status 1
Error compiling for board Arduino Nano 33 BLE.

Your workbench

Arduino Nano BLE: nRF52840 from Nordic Semiconductors, a 32-bit ARM® Cortex™-M4 CPU running at 64 MHz

Works perfectly using SAMD based boards

I think this needs the same updates Adafruit has completed in their Adafruit_usIO library to account for how the nRF52840 handles SPI.

V2 of the Sparkfun board purchased less than 1 month ago

standard HW SPI - CS on D10 and INT on D6

edspark commented 4 years ago

I don't have a nano to test but I believe this is occurring because setBitOrder is deprecated and not implemented in MbedSPI. I've replaced the function call with a #define and pass that to SPISettings. Please give it a test, and open this back up if it does not fix the issue. Fix is in the latest release.