sforkowany z mirror/meshtastic-firmware
Add external RF switch management for RF95 (needed for RAK815)
rodzic
8ba8278fb5
commit
98dfecdb79
Plik binarny nie jest wyświetlany.
|
@ -3,9 +3,9 @@
|
|||
## RAK815
|
||||
|
||||
TODO:
|
||||
* LORA: P0.23 is for PABOOST? see page 2 in RAK813 sechematic P0.22 is for HF_RF_CPS? Look up datasheet for PE4259 Until this is fixed I bet the range is quite poor. DIO2 is not controlling PABOOST on this board!
|
||||
* i2c gps comms not quite right
|
||||
* measure power draw
|
||||
|
||||
- i2c gps comms not quite right
|
||||
- measure power draw
|
||||
|
||||
### Bootloader
|
||||
|
||||
|
|
|
@ -12,6 +12,18 @@ RF95Interface::RF95Interface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOL
|
|||
// FIXME - we assume devices never get destroyed
|
||||
}
|
||||
|
||||
/** Some boards require GPIO control of tx vs rx paths */
|
||||
void RF95Interface::setTransmitEnable(bool txon)
|
||||
{
|
||||
#ifdef RF95_TXEN
|
||||
digitalWrite(RF95_TXEN, txon ? 1 : 0);
|
||||
#endif
|
||||
|
||||
#ifdef RF95_RXEN
|
||||
digitalWrite(RF95_RXEN, txon ? 0 : 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
/// Initialise the Driver transport hardware and software.
|
||||
/// Make sure the Driver is properly configured before calling init().
|
||||
/// \return true if initialisation succeeded.
|
||||
|
@ -30,6 +42,22 @@ bool RF95Interface::init()
|
|||
digitalWrite(RF95_TCXO, 1);
|
||||
#endif
|
||||
|
||||
/*
|
||||
#define RF95_TXEN (22) // If defined, this pin should be set high prior to transmit (controls an external analog switch)
|
||||
#define RF95_RXEN (23) // If defined, this pin should be set high prior to receive (controls an external analog switch)
|
||||
*/
|
||||
|
||||
#ifdef RF95_TXEN
|
||||
pinMode(RF95_TXEN, OUTPUT);
|
||||
digitalWrite(RF95_TXEN, 0);
|
||||
#endif
|
||||
|
||||
#ifdef RF95_RXEN
|
||||
pinMode(RF95_RXEN, OUTPUT);
|
||||
digitalWrite(RF95_RXEN, 1);
|
||||
#endif
|
||||
setTransmitEnable(false);
|
||||
|
||||
int res = lora->begin(freq, bw, sf, cr, syncWord, power, currentLimit, preambleLength);
|
||||
DEBUG_MSG("RF95 init result %d\n", res);
|
||||
|
||||
|
@ -104,8 +132,18 @@ void RF95Interface::setStandby()
|
|||
completeSending(); // If we were sending, not anymore
|
||||
}
|
||||
|
||||
/** We override to turn on transmitter power as needed.
|
||||
*/
|
||||
void RF95Interface::configHardwareForSend()
|
||||
{
|
||||
setTransmitEnable(true);
|
||||
|
||||
RadioLibInterface::configHardwareForSend();
|
||||
}
|
||||
|
||||
void RF95Interface::startReceive()
|
||||
{
|
||||
setTransmitEnable(false);
|
||||
setStandby();
|
||||
int err = lora->startReceive();
|
||||
assert(err == ERR_NONE);
|
||||
|
|
|
@ -52,4 +52,13 @@ class RF95Interface : public RadioLibInterface
|
|||
virtual void addReceiveMetadata(MeshPacket *mp);
|
||||
|
||||
virtual void setStandby();
|
||||
|
||||
/**
|
||||
* We override to turn on transmitter power as needed.
|
||||
*/
|
||||
virtual void configHardwareForSend();
|
||||
|
||||
private:
|
||||
/** Some boards require GPIO control of tx vs rx paths */
|
||||
void setTransmitEnable(bool txon);
|
||||
};
|
|
@ -119,8 +119,7 @@ void SX1262Interface::addReceiveMetadata(MeshPacket *mp)
|
|||
mp->rx_snr = lora.getSNR();
|
||||
}
|
||||
|
||||
/** start an immediate transmit
|
||||
* We override to turn on transmitter power as needed.
|
||||
/** We override to turn on transmitter power as needed.
|
||||
*/
|
||||
void SX1262Interface::configHardwareForSend()
|
||||
{
|
||||
|
|
Ładowanie…
Reference in New Issue