cleanup so eventually rf95 can share common msg code with sx1262

This commit is contained in:
geeksville
2020-04-29 16:28:11 -07:00
parent 4693302d82
commit 8d985cfd37
5 changed files with 67 additions and 34 deletions

View File

@@ -0,0 +1,28 @@
#include "SX1262Interface.h"
#include <configuration.h>
SX1262Interface::SX1262Interface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy,
SPIClass &spi)
: RadioLibInterface(cs, irq, rst, busy, spi, &lora), lora(&module)
{
}
/// Initialise the Driver transport hardware and software.
/// Make sure the Driver is properly configured before calling init().
/// \return true if initialisation succeeded.
bool SX1262Interface::init()
{
if (!RadioLibInterface::init())
return false;
// FIXME, move this to main
SPI.begin();
float tcxoVoltage = 0; // None - we use an XTAL
bool useRegulatorLDO = false; // Seems to depend on the connection to pin 9/DCC_SW - if an inductor DCDC?
int res = lora.begin(freq, bw, sf, cr, syncWord, power, currentLimit, preambleLength, tcxoVoltage, useRegulatorLDO);
DEBUG_MSG("LORA init result %d\n", res);
return res == ERR_NONE;
}