sandeepmistry / arduino-LoRa

An Arduino library for sending and receiving data using LoRa radios.
MIT License
1.67k stars 634 forks source link

Compilation for Attiny fails due to SPIClass #270

Closed AzureDVBB closed 5 years ago

AzureDVBB commented 5 years ago

Tried using both AttinyCore and Attiny Microcontrollers, as boards for my Attiny44. The issue persists

The code use to test compilation

#include <LoRa.h>
#include <SPI.h>

void setup() {
  LoRa.setPins(1, 3, 4);

  if (!LoRa.begin(433E6)) {
    while (1);
  }
}

void loop() {
}

The error I'm getting is

C:\Users\Bence\Documents\Arduino\libraries\LoRa\src/LoRa.h:77:15: error: 'SPIClass' has not been declared

   void setSPI(SPIClass& spi);

               ^

C:\Users\Bence\Documents\Arduino\libraries\LoRa\src/LoRa.h:101:3: error: 'SPIClass' does not name a type

   SPIClass* _spi;

   ^

exit status 1
Error compiling for board ATtiny24/44/84.

As a side note, there is a tinySPI library. But that also produces a similar error. It works fine compiling for ESP32 and other Arduino boards.

morganrallen commented 5 years ago

I gave this a try with ATTinyCore and it seems they are either not implementing, or not correctly implementing SPIClass. The documention suggests the part supports SPI (via USI) but it's up to the Arduino hardware library to implement SPIClass. I'd suggest reading this and possibly filing a bug with ATTinyCore. https://github.com/SpenceKonde/ATTinyCore/blob/master/avr/extras/ATtiny_x4.md#spi-support