2020-04-29 23:28:11 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "RadioLibInterface.h"
|
|
|
|
|
|
|
|
class SX1262Interface : public RadioLibInterface
|
|
|
|
{
|
|
|
|
SX1262 lora;
|
|
|
|
|
|
|
|
public:
|
|
|
|
SX1262Interface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy, SPIClass &spi);
|
|
|
|
|
|
|
|
/// Initialise the Driver transport hardware and software.
|
|
|
|
/// Make sure the Driver is properly configured before calling init().
|
|
|
|
/// \return true if initialisation succeeded.
|
|
|
|
virtual bool init();
|
2020-04-30 01:46:32 +00:00
|
|
|
|
|
|
|
/// Apply any radio provisioning changes
|
|
|
|
/// Make sure the Driver is properly configured before calling init().
|
|
|
|
/// \return true if initialisation succeeded.
|
|
|
|
virtual bool reconfigure();
|
2020-04-30 16:44:16 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
/**
|
|
|
|
* Glue functions called from ISR land
|
|
|
|
*/
|
|
|
|
virtual void INTERRUPT_ATTR disableInterrupt() { lora.clearDio1Action(); }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Enable a particular ISR callback glue function
|
|
|
|
*/
|
|
|
|
virtual void enableInterrupt(void (*callback)()) { lora.setDio1Action(callback); }
|
|
|
|
|
|
|
|
/** Could we send right now (i.e. either not actively receiving or transmitting)? */
|
|
|
|
virtual bool canSendImmediately();
|
2020-04-30 19:37:58 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Start waiting to receive a message
|
|
|
|
*/
|
|
|
|
virtual void startReceive();
|
2020-04-30 20:50:40 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
void setStandby();
|
2020-04-29 23:28:11 +00:00
|
|
|
};
|