beegee-tokyo / SX126x-Arduino

Arduino library to use Semtech SX126x LoRa chips and modules to communicate
MIT License
235 stars 64 forks source link

Library dependencies #56

Closed robsonos closed 2 years ago

robsonos commented 2 years ago

Hi Bernd,

If I add SX126x-Arduino to the lib_deps in platformio.ini, without including <SX126x-Arduino.h> to main.cpp, the compiler complains about missing the SPI.h and the Adafruit_TinyUSB.h dependencies:

image image

This can be easily fixed by adding those dependencies to library.json:

"dependencies": [
    {
      "name": "SPI",
      "frameworks": "arduino"
    },
    {
      "name": "Adafruit TinyUSB Library",
      "frameworks": "arduino"
    }
  ]

The motivation for this change is that we may have an #ifdef wrapping #include <SX126x-Arduino.h>, but we may still wan to keep SX126x-Arduino in lib_deps. I am happy to create a PR if you agree with those changes.

Cheers, Robson.

beegee-tokyo commented 2 years ago

Keep in mind that this library is not only for nRF52 MCU but as well supports ESP32, ESP8266 and RP2040.

Missing Adafruit_TinyUSB.h has to do with the Adafruit nRF52 BSP, out of some reason I do not get, they took Serial class out of the BSP. I do not want to add it as dependency, because it is only for nRF52 and will cause problems with other MCU platforms the library is supporting (currently ESP32 and RP2040)

Missing SPI.h is intentional to keep the library compatible with future Arduino architectures. E.g. in RP2040 BSP SPI class is named different (MbedSPI).

I am not sure why you would have the library in lib_deps if you do not use it. But I cannot implement your proposal without breaking other platforms.