ATTINY84 /RF24 SPI problem


I have a problem using the ATTINY84 with SPI and with the RF24 library as well.

My aim is to use the ATTINY to take readings from an accelerometer using SPI, and to transmit using the NRF24l01

I’m using the RF24 library which works fine with the ATTINY84 and doesn’t need an explict #include SPI.h>

But the accerelometer (ADXL362) does need SPI.

I’m using the SpenceKonde ATTINY core, which includes its own SPI library. However, if I #include.SPI it won’t compile.

So this bare minimum sketch

#include <nRF24L01.h>
#include <RF24.h>

#include <SPI.h>

void setup() {
  // put your setup code here, to run once:


void loop() {
  // put your main code here, to run repeatedly:


gives these errors:

C:\Users\Dell Precision\AppData\Local\Arduino15\packages\ATTinyCore\hardware\avr\1.3.2\libraries\SPI/SPI.h:435:7: error: redefinition of 'class SPIClass'

 class SPIClass


In file included from C:\Users\Dell Precision\Documents\Arduino\libraries\RF24/utility/ATTiny/RF24_arch_config.h:28:0,

                 from C:\Users\Dell Precision\Documents\Arduino\libraries\RF24/RF24_config.h:51,

                 from C:\Users\Dell Precision\Documents\Arduino\libraries\RF24/RF24.h:18,

                 from C:\Users\DELLPR~1\AppData\Local\Temp\arduino_modified_sketch_338399\sketch_mar06a.ino:2:

C:\Users\Dell Precision\Documents\Arduino\libraries\RF24/utility/ATTiny/spi.h:31:7: note: previous definition of 'class SPIClass'

 class SPIClass {


Using library RF24 at version 1.3.4 in folder: C:\Users\Dell Precision\Documents\Arduino\libraries\RF24 
Using library SPI at version 1.0 in folder: C:\Users\Dell Precision\AppData\Local\Arduino15\packages\ATTinyCore\hardware\avr\1.3.2\libraries\SPI 
exit status 1
Error compiling for board ATtiny24/44/84.

Is there a way round this please?

I think another way of saying this may be that the RF24 library implements SPI itself, but that version of SPI is not working for the accelerometer.

Because if I comment out the #include SPI.h in my actual code, it compiles and uploads, but the SPI does not work (it is very hard to debug this because there is no serial output from the ATTINY and I can't get to the pins that would let me implement one of the software serial options. But it's clear that the accelerometer is not being read.)

I have been able to get the two to work together (accelerometer and NRF) but that's by not using the RF24 library, which I really want to be able to do.