jgromes / RadioLib

Universal wireless communication library for embedded devices
https://jgromes.github.io/RadioLib/
MIT License
1.48k stars 375 forks source link

[SX1262] Pinouts for Heltec Cubecell ASR650x #412

Closed dhskinner closed 2 years ago

dhskinner commented 2 years ago

Hi Jan - great work on RadioLib. Currently I'm migrating from another library (cough RadioHead) and integrating RadioLib with the Heltec Cubecell ASR-650x series - either ASR-6501 or ASR-6502. Following on from #397 (thank you for fixing this) I'm raising this new issue to make anyone else aware there is an easy but non-obvious way to understand the correct pin configuration for RadioLib & Cubecell.

Suggest including as a note in the examples for SX1262, that when defining the radio object:

#include <RadioLib.h>
#include "board-config.h"
SX1262 radio = new Module(RADIO_NSS, RADIO_DIO_1, RADIO_RESET, RADIO_BUSY);

Seems to work fine with current/latest versions at the time of raising this issue:

Hope this helps

jgromes commented 2 years ago

Thanks for pointing this out. Yes, you have to know the pins that are being used internally by CubeCell if you want to use the built-in SX1262. That's simply because RadioLib was written to be as generic as possible.

Considering the number of hoops I had to jump through in order to get CubeCell working at all (cough pinMode as macro)(cough yield as macro that does bugger all)(cough outdated GCC), streamlining this a bit more can't hurt. So I added the board_config include and pin definition to BuildOpt and now you can skip it all by calling:

SX1262 radio = new Module(RADIOLIB_BUILTIN_MODULE);

CubeCell may not be the only platform with a built-in module, so it might be better to have a generic option to specific fixed pins in the library itself, so that users don't have to figure it out.

dhskinner commented 2 years ago

Great - thanks Jan - appreciated. I was reading comments in radiolib source code and laughed :) completely agree with you. On the plus side though their hardware has a lot in a small package (and is reasonably priced) so on balance it works for now. Thanks again