sandeepmistry/arduino-LoRa

Cannot get standard library to work with SPI1

EduanShuda opened this issue · 0 comments

Discussed in #685

Originally posted by EduanShuda March 20, 2024
Hi

I cannot get the standard library to work as it with SPI1. According to the API documentation:

Set SPI interface

Override the default SPI interface used by the library. Must be called before LoRa.begin().

LoRa.setSPI(spi);
  • spi - new SPI interface to use, defaults to SPI

This call is optional and only needs to be used if you need to change the default SPI interface used, in the case your Arduino (or compatible) board has more than one SPI interface present.

I want to use SPI1.

In my sketch I have:
#include <SPI1.h>

In setup():

  LoRa.setSPI(SPI1);
  LoRa.setSPIFrequency(1E6);
  LoRa.setPins(SPI_CS, RST, IRQ_G0);

  if (!LoRa.begin(433900000)) {  // initialize ratio at 433900000 MHz
    while (true) {
      LED_FUNC(ERROR_LED, 5, 80);  // if failed, do nothing
    }
  }

I get this error:
Compilation error: no matching function for call to 'LoRaClass::setSPI(SPI1Class&)'

I have tried everything. Any help will be appreciated.