StuartsProjects / SX12XX-LoRa

Library for SX12XX LoRa devices
315 stars 68 forks source link

Possibility to use different SPI devs (SPI1, SPI2) #33

Open tvntsr opened 3 years ago

tvntsr commented 3 years ago

Some hardware have several SPI devs, for instance Teensy 3.x, 4.x. Current implementation of LoRa library allows to use only first SPI dev, this fix add new method setSpi(SPIClass& spi) to allow different SPI dev to be used. By default main spi dev is used (SPI), but it is possible to use other:

LT.setSpi(SPI1);
StuartsProjects commented 3 years ago

I will take a look at the suggestion, however it would require a fair bit of testing across all 3 libraries.

Which Arduinos support multiple SPI ports in this way ?

tvntsr commented 3 years ago

Thanks, super!

Which Arduinos support multiple SPI ports in this way ?

For instance Teensy 3.x, Teensy 4.x. There are several SPI (s): SPI, SPI1, SPI2. So hardcoded SPI in the code leads to the situation when SPI1 cannot be used with the library.

StuartsProjects commented 3 years ago

I really meant to say, is there a geniune Arduino that supports multiple SPI ports in this way ?

tvntsr commented 3 years ago

As example I could provide the following link: https://learn.adafruit.com/using-atsamd21-sercom-to-add-more-spi-i2c-serial-ports?view=all