PlatformIO Community

Raspberry pi pico - 'class arduino::MbedSPI' has no member named 'setBitOrder'

Hi,
Im trying to use SPI.h library for my LIS3DH and for some reason i keep getting the error i mentioned in the title.

This is the code in my .ini file:

[env:pico]
platform = raspberrypi
board = pico
framework = arduino
lib_deps = 
	khoih-prog/RP2040_PWM@^1.4.0
	sparkfun/SparkFun LIS3DH Arduino Library @ ^1.0.3

Includes in main.cpp :

#include <Arduino.h>
#include "SparkFunLIS3DH.h"
#include "Wire.h"
#include "SPI.h"
#include "RP2040_PWM.h"

I im really stuck on what could this be…
Thanks in advance

The Pico has two Arduino core implementations available: ArduinoCore-mbed and Arduino-Pico. By default, PlatformIO will use ArduinoCore-mbed.

However, that core’s SPI.h has no setBitOrder() function, as seen here.

On the other hand, Arduino-Pico has the function, but it’s marked as deprecated.

So the foremost issue is that the library you’re trying to use is using outdated functions. No wonder, the source code was lasted updated 6 years ago.

You can probably use this library if you make PlatformIO use Arduino-Pico instead. As is explained in Arduino-Pico (Earlephilhower) support, PicoProbe Debugging by maxgerhardt · Pull Request #36 · platformio/platform-raspberrypi · GitHub, you just have to make a platformio.ini modification to

[env:pico]
platform = https://github.com/maxgerhardt/platform-raspberrypi.git
board = pico
framework = arduino
board_build.core = earlephilhower
lib_deps = 
	khoih-prog/RP2040_PWM@^1.4.0
	sparkfun/SparkFun LIS3DH Arduino Library @ ^1.0.3

Alternatively, try and find a library that’s not 6 years old for your sensor.

1 Like

Hello, thanks for your reply.
I cant find any newer libraries for my sensor…

Do you think i will have a problem using Arduino-pico core because of other libraries i might add?
Is it ok to use that old library with depracted functions? It works fine on my arduino UNO using arduinoIDE

Compatibility is good from my experience :slight_smile: Can’t speak for all libraries.

In this case it should work fine, the deprecated functions are implemented after all…

GitHub - adafruit/Adafruit_LIS3DH: Arduino Library for Adafruit LIS3DH breakout board sourcecode was last modified 4 months ago, much more recent.

Yeah, i tried that library but it does not work, because my sensor is not the adafruit.
However, using the other core i managed to solve my problem. Thank you very much.