Add support for SX1262 based TBEAMs, see below for more details.

We probe dynamically for the SX1262 or RF95 based radios on TBEAM1.0
boards now.  If either is present it will be used.
This commit is contained in:
geeksville
2020-08-20 15:42:36 -07:00
parent 99882a675b
commit ca75dcd64d
3 changed files with 88 additions and 36 deletions

View File

@@ -271,17 +271,42 @@ void setup()
#endif
// MUST BE AFTER service.init, so we have our radio config settings (from nodedb init)
RadioInterface *rIf =
RadioInterface *rIf = NULL;
#if defined(RF95_IRQ)
// new CustomRF95(); old Radiohead based driver
new RF95Interface(RF95_NSS, RF95_IRQ, RF95_RESET, SPI);
#elif defined(SX1262_CS)
new SX1262Interface(SX1262_CS, SX1262_DIO1, SX1262_RESET, SX1262_BUSY, SPI);
#else
new SimRadio();
if (!rIf) {
rIf = new RF95Interface(RF95_NSS, RF95_IRQ, RF95_RESET, SPI);
if (!rIf->init()) {
DEBUG_MSG("Warning: Failed to find RF95 radio\n");
delete rIf;
rIf = NULL;
}
}
#endif
if (!rIf || !rIf->init())
#if defined(SX1262_CS)
if (!rIf) {
rIf = new SX1262Interface(SX1262_CS, SX1262_DIO1, SX1262_RESET, SX1262_BUSY, SPI);
if (!rIf->init()) {
DEBUG_MSG("Warning: Failed to find SX1262 radio\n");
delete rIf;
rIf = NULL;
}
}
#endif
#ifdef USE_SIM_RADIO
if (!rIf) {
rIf = new SimRadio;
if (!rIf->init()) {
DEBUG_MSG("Warning: Failed to find simulated radio\n");
delete rIf;
rIf = NULL;
}
}
#endif
if (!rIf)
recordCriticalError(ErrNoRadio);
else
router.addInterface(rIf);