I ran into the following error when compiling. "'_spi' was not declared in this scope"

I ran into the following error when compiling a library called BurstSPI with VSCode’s PlatformIO. This error does not occur with the mbed online compiler. Please tell me why it happens. Please tell me how to use _spi.

BurstSPI

Error
BurstSPI/BurstSPI_LPC_X.cpp:6:13: error: '_spi' was not declared in this scope

Here is my platformio.ini setting

[env:lpc1768]
platform = nxplpc@4.5.0
board = lpc1768
framework = mbed
build_flags = -D PIO_FRAMEWORK_MBED_RTOS_PRESENT

Hi Takuya,

This project seems only can be built with Mbed 2, I would suggest you to remove the build_flag -D PIO_FRAMEWORK_MBED_RTOS_PRESENT to use Mbed 2, instead of Mbed OS 5.

You can also checking your project in online IDE, the lib mbed-os means Mbed OS 5, the lib mbed means Mbed 2.

Regards,
Desmond

BurstSPI pretty much removes the read back response from the connected device for instance an ‘ack’ which causes an unnecessary delay if MISO is not connected. Simply comment it out providing you are not using any other attached SPI devices that need MISO connected.

I haven’t tried it recently but used to work for me with LCD displays.

You can’t do this on the online compiler as we only have pre-built Mbed libraries.

For the LPC1768…

return ssp_read(obj);

line 190

Thanks sayhuthut.

There was no problem if the platform of Platformio.ini was nxplpc@4.2.0, and it occurred in nxplpc@4.3.0. _spi seems to be unusable in mbed OS 5.12.3.

Has the specification of _spi changed in mbed OS 5.12.3?
How is it rewritten?

Finally fixed the BurstSPI issue with newer mbed OS (just for LPC1768).

Please find the fix in my public repo:
BurstSPI update | Mbed