• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

PlatformIO esp32SPI.H has error with const

Q&A Forum › Category: ESP32 › PlatformIO esp32SPI.H has error with const
0 Vote Up Vote Down
David Richards asked 5 months ago

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.
 

3 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 5 months ago

Hi.
On platformio.ini, change the platform to espressif32@3.5.0 instead espressif32.
Regards,
Sara

0 Vote Up Vote Down
David Richards answered 5 months ago

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
 

0 Vote Up Vote Down
Sara Santos Staff answered 5 months ago

That’s currently an issue with the ESP32 version for the arduino core. Hopefully, it will be solved in the future.
I’ll mark this issue as resolved. If you need further help, you just need to open a new question in our forum.
Regards,
Sara

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [eBook Updated] SMART HOME with RPi, ESP32, and ESP8266 (version 1.2) March 8, 2023
  • [eBook Updated] ESP32-CAM Projects (version 1.3) January 7, 2023

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2023 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.