Hello Experts,
I am on the journey of moving from the Arduino IDE, to the Visual Studio Code PlatformIO extension for my more complex projects. Consequently, I am very much still learning about PlatformIO.
I am trying to build the adafruit_ADS1x15 “non-blocking” example in PlatformIO.
It compiles, uploads and runs perfectly in the Arduino IDE. However, it fails to compile Adafruit BusIO\Adafruit_SPIDevice.cpp in PlatformIO.
My PlatformIO project congfig file contains (only) this
[env:nodemcu-32s]
platform = espressif32
board = nodemcu-32s
framework = arduino
lib_deps =
SPI
adafruit/Adafruit ADS1X15
adafruit/Adafruit BusIO
When I run the build, it reports the library versions and dependencies like this
Dependency Graph
|– SPI @ 1.0
|– Adafruit ADS1X15 @ 2.4.0
| |– Adafruit BusIO @ 1.14.1
| | |– Wire @ 1.0.1
| | |– SPI @ 1.0
| |– Wire @ 1.0.1
|– Adafruit BusIO @ 1.14.1
| |– Wire @ 1.0.1
| |– SPI @ 1.0
The compilation error is this.
.pio\libdeps\nodemcu-32s\Adafruit BusIO\Adafruit_SPIDevice.cpp: In member function ‘bool Adafruit_SPIDevice::write(const uint8_t*, size_t, const uint8_t*, size_t)’:
.pio\libdeps\nodemcu-32s\Adafruit BusIO\Adafruit_SPIDevice.cpp:352:61: error: invalid conversion from ‘const uint8_t* {aka const unsigned char*}’ to ‘uint8_t* {aka unsigned char*}’ [-fpermissive]
_spi->transferBytes(prefix_buffer, nullptr, prefix_len);
^
In file included from .pio\libdeps\nodemcu-32s\Adafruit BusIO\Adafruit_SPIDevice.h:9:0,
from .pio\libdeps\nodemcu-32s\Adafruit BusIO\Adafruit_SPIDevice.cpp:1:
C:\Users\jbl\.platformio\packages\framework-arduinoespressif32\libraries\SPI\src/SPI.h:73:10: note: initializing argument 1 of ‘void SPIClass::transferBytes(uint8_t*, uint8_t*, uint32_t)’
void transferBytes(uint8_t * data, uint8_t * out, uint32_t size);
^
This seems to be nothing to do with my code, so it is presumably a problem with my configuration.
Can you help me work out how to get rid of this error?
Thank you.
Hi.
On platformio.ini, change the platform to espressif32@3.5.0 instead espressif32.
Regards,
Sara
Hi Sara,
That worked perfectly.
I did try googling to find a solution to this, but could find nothing helpful.
I am surprised there were not more questions on this issue – or more importantly, more answers.
Thank you very much for your help.
Dave