In fact I just solved it when preparing the project for you, thanks to “pio run --target clean”, and I am not able to reproduce the issue with a new project
So you might consider it closed for now, I will send you the project if I have it again in the future.
I have noticed a similar error when using the spi.transfer method from mbed. The problem seems to be rather intermittent, it comes and goes apparently at random.
I think it is linked to the fact that the spi.transfer function is only defined for certain target boards. In the header files, it is guarded by #ifdef statements that depend on the target. I guess somehow the linter doesn’t know whether it should be defining these macros or not.