parent
832fe1d15c
commit
d15164cc5e
|
@ -10,108 +10,115 @@ byte _lastSNR = 0;
|
||||||
// Interrupt vectors for the 3 Arduino interrupt pins
|
// Interrupt vectors for the 3 Arduino interrupt pins
|
||||||
// Each interrupt can be handled by a different instance of BG_RF95, allowing you to have
|
// Each interrupt can be handled by a different instance of BG_RF95, allowing you to have
|
||||||
// 2 or more LORAs per Arduino
|
// 2 or more LORAs per Arduino
|
||||||
BG_RF95 *BG_RF95::_deviceForInterrupt[BG_RF95_NUM_INTERRUPTS] = {0, 0, 0};
|
BG_RF95* BG_RF95::_deviceForInterrupt[BG_RF95_NUM_INTERRUPTS] = {0, 0, 0};
|
||||||
uint8_t BG_RF95::_interruptCount = 0; // Index into _deviceForInterrupt for next device
|
uint8_t BG_RF95::_interruptCount = 0; // Index into _deviceForInterrupt for next device
|
||||||
|
|
||||||
// These are indexed by the values of ModemConfigChoice
|
// These are indexed by the values of ModemConfigChoice
|
||||||
// Stored in flash (program) memory to save SRAM
|
// Stored in flash (program) memory to save SRAM
|
||||||
PROGMEM static const BG_RF95::ModemConfig MODEM_CONFIG_TABLE[] =
|
PROGMEM static const BG_RF95::ModemConfig MODEM_CONFIG_TABLE[] =
|
||||||
{
|
{
|
||||||
// 1d, 1e, 26
|
// 1d, 1e, 26
|
||||||
{0x72, 0x74, 0x00}, // Bw125Cr45Sf128 (the chip default)
|
{ 0x72, 0x74, 0x00}, // Bw125Cr45Sf128 (the chip default)
|
||||||
{0x78, 0xc4, 0x00}, // Bw125Cr48Sf4096
|
{ 0x92, 0x74, 0x00}, // Bw500Cr45Sf128
|
||||||
{0x76, 0x94, 0x04}, // Bw125Cr47Sf512
|
{ 0x48, 0x94, 0x00}, // Bw31_25Cr48Sf512
|
||||||
{0x72, 0xb4, 0x00}, // Bw125Cr45Sf2048
|
{ 0x78, 0xc4, 0x00}, // Bw125Cr48Sf4096
|
||||||
{0x88, 0xc4, 0x00}, // Bw250Cr48Sf4096
|
{ 0x72, 0xc7, 0x8}, // BG 125 cr45 sf12
|
||||||
};
|
{ 0x72, 0xb4, 0x00}, // Bw125Cr45Sf2048 <= M0IGA messup speed
|
||||||
|
{ 0x76, 0x94, 0x04}, // Bw125Cr47Sf512 <= corrected 1200baud
|
||||||
|
};
|
||||||
|
|
||||||
BG_RF95::BG_RF95(uint8_t slaveSelectPin, uint8_t interruptPin, RHGenericSPI &spi)
|
BG_RF95::BG_RF95(uint8_t slaveSelectPin, uint8_t interruptPin, RHGenericSPI& spi)
|
||||||
:
|
:
|
||||||
RHSPIDriver(slaveSelectPin, spi),
|
RHSPIDriver(slaveSelectPin, spi),
|
||||||
_rxBufValid(0) {
|
_rxBufValid(0)
|
||||||
_interruptPin = interruptPin;
|
{
|
||||||
_myInterruptIndex = 0xff; // Not allocated yet
|
_interruptPin = interruptPin;
|
||||||
|
_myInterruptIndex = 0xff; // Not allocated yet
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BG_RF95::init() {
|
bool BG_RF95::init()
|
||||||
if (!RHSPIDriver::init())
|
{
|
||||||
return false;
|
if (!RHSPIDriver::init())
|
||||||
//Serial.println("RHSPIDriver::init completed");
|
return false;
|
||||||
// Determine the interrupt number that corresponds to the interruptPin
|
//Serial.println("RHSPIDriver::init completed");
|
||||||
int interruptNumber = digitalPinToInterrupt(_interruptPin);
|
// Determine the interrupt number that corresponds to the interruptPin
|
||||||
if (interruptNumber == NOT_AN_INTERRUPT)
|
int interruptNumber = digitalPinToInterrupt(_interruptPin);
|
||||||
return false;
|
if (interruptNumber == NOT_AN_INTERRUPT)
|
||||||
|
return false;
|
||||||
#ifdef RH_ATTACHINTERRUPT_TAKES_PIN_NUMBER
|
#ifdef RH_ATTACHINTERRUPT_TAKES_PIN_NUMBER
|
||||||
interruptNumber = _interruptPin;
|
interruptNumber = _interruptPin;
|
||||||
#endif
|
#endif
|
||||||
//Serial.println("Attach Interrupt completed");
|
//Serial.println("Attach Interrupt completed");
|
||||||
|
|
||||||
// No way to check the device type :-(
|
// No way to check the device type :-(
|
||||||
|
|
||||||
// Set sleep mode, so we can also set LORA mode:
|
// Set sleep mode, so we can also set LORA mode:
|
||||||
spiWrite(BG_RF95_REG_01_OP_MODE, BG_RF95_MODE_SLEEP | BG_RF95_LONG_RANGE_MODE);
|
spiWrite(BG_RF95_REG_01_OP_MODE, BG_RF95_MODE_SLEEP | BG_RF95_LONG_RANGE_MODE);
|
||||||
delay(10); // Wait for sleep mode to take over from say, CAD
|
delay(10); // Wait for sleep mode to take over from say, CAD
|
||||||
// Check we are in sleep mode, with LORA set
|
// Check we are in sleep mode, with LORA set
|
||||||
if (spiRead(BG_RF95_REG_01_OP_MODE) != (BG_RF95_MODE_SLEEP | BG_RF95_LONG_RANGE_MODE)) {
|
if (spiRead(BG_RF95_REG_01_OP_MODE) != (BG_RF95_MODE_SLEEP | BG_RF95_LONG_RANGE_MODE))
|
||||||
//Serial.println(spiRead(BG_RF95_REG_01_OP_MODE), HEX);
|
{
|
||||||
return false; // No device present?
|
//Serial.println(spiRead(BG_RF95_REG_01_OP_MODE), HEX);
|
||||||
}
|
return false; // No device present?
|
||||||
|
}
|
||||||
|
|
||||||
// Add by Adrien van den Bossche <vandenbo@univ-tlse2.fr> for Teensy
|
// Add by Adrien van den Bossche <vandenbo@univ-tlse2.fr> for Teensy
|
||||||
// ARM M4 requires the below. else pin interrupt doesn't work properly.
|
// ARM M4 requires the below. else pin interrupt doesn't work properly.
|
||||||
// On all other platforms, its innocuous, belt and braces
|
// On all other platforms, its innocuous, belt and braces
|
||||||
pinMode(_interruptPin, INPUT);
|
pinMode(_interruptPin, INPUT);
|
||||||
|
|
||||||
// Set up interrupt handler
|
// Set up interrupt handler
|
||||||
// Since there are a limited number of interrupt glue functions isr*() available,
|
// Since there are a limited number of interrupt glue functions isr*() available,
|
||||||
// we can only support a limited number of devices simultaneously
|
// we can only support a limited number of devices simultaneously
|
||||||
// ON some devices, notably most Arduinos, the interrupt pin passed in is actuallt the
|
// ON some devices, notably most Arduinos, the interrupt pin passed in is actuallt the
|
||||||
// interrupt number. You have to figure out the interruptnumber-to-interruptpin mapping
|
// interrupt number. You have to figure out the interruptnumber-to-interruptpin mapping
|
||||||
// yourself based on knwledge of what Arduino board you are running on.
|
// yourself based on knwledge of what Arduino board you are running on.
|
||||||
if (_myInterruptIndex == 0xff) {
|
if (_myInterruptIndex == 0xff)
|
||||||
// First run, no interrupt allocated yet
|
{
|
||||||
if (_interruptCount <= BG_RF95_NUM_INTERRUPTS)
|
// First run, no interrupt allocated yet
|
||||||
_myInterruptIndex = _interruptCount++;
|
if (_interruptCount <= BG_RF95_NUM_INTERRUPTS)
|
||||||
|
_myInterruptIndex = _interruptCount++;
|
||||||
|
else
|
||||||
|
return false; // Too many devices, not enough interrupt vectors
|
||||||
|
}
|
||||||
|
_deviceForInterrupt[_myInterruptIndex] = this;
|
||||||
|
if (_myInterruptIndex == 0)
|
||||||
|
attachInterrupt(interruptNumber, isr0, RISING);
|
||||||
|
else if (_myInterruptIndex == 1)
|
||||||
|
attachInterrupt(interruptNumber, isr1, RISING);
|
||||||
|
else if (_myInterruptIndex == 2)
|
||||||
|
attachInterrupt(interruptNumber, isr2, RISING);
|
||||||
else
|
else
|
||||||
return false; // Too many devices, not enough interrupt vectors
|
{
|
||||||
}
|
//Serial.println("Interrupt vector too many vectors");
|
||||||
_deviceForInterrupt[_myInterruptIndex] = this;
|
return false; // Too many devices, not enough interrupt vectors
|
||||||
if (_myInterruptIndex == 0)
|
}
|
||||||
attachInterrupt(interruptNumber, isr0, RISING);
|
|
||||||
else if (_myInterruptIndex == 1)
|
|
||||||
attachInterrupt(interruptNumber, isr1, RISING);
|
|
||||||
else if (_myInterruptIndex == 2)
|
|
||||||
attachInterrupt(interruptNumber, isr2, RISING);
|
|
||||||
else {
|
|
||||||
//Serial.println("Interrupt vector too many vectors");
|
|
||||||
return false; // Too many devices, not enough interrupt vectors
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set up FIFO
|
// Set up FIFO
|
||||||
// We configure so that we can use the entire 256 byte FIFO for either receive
|
// We configure so that we can use the entire 256 byte FIFO for either receive
|
||||||
// or transmit, but not both at the same time
|
// or transmit, but not both at the same time
|
||||||
spiWrite(BG_RF95_REG_0E_FIFO_TX_BASE_ADDR, 0);
|
spiWrite(BG_RF95_REG_0E_FIFO_TX_BASE_ADDR, 0);
|
||||||
spiWrite(BG_RF95_REG_0F_FIFO_RX_BASE_ADDR, 0);
|
spiWrite(BG_RF95_REG_0F_FIFO_RX_BASE_ADDR, 0);
|
||||||
|
|
||||||
// Packet format is preamble + explicit-header + payload + crc
|
// Packet format is preamble + explicit-header + payload + crc
|
||||||
// Explicit Header Mode
|
// Explicit Header Mode
|
||||||
// payload is TO + FROM + ID + FLAGS + message data
|
// payload is TO + FROM + ID + FLAGS + message data
|
||||||
// RX mode is implmented with RXCONTINUOUS
|
// RX mode is implmented with RXCONTINUOUS
|
||||||
// max message data length is 255 - 4 = 251 octets
|
// max message data length is 255 - 4 = 251 octets
|
||||||
|
|
||||||
setModeIdle();
|
setModeIdle();
|
||||||
|
|
||||||
// Set up default configuration
|
// Set up default configuration
|
||||||
// No Sync Words in LORA mode.
|
// No Sync Words in LORA mode.
|
||||||
setModemConfig(Bw125Cr45Sf128); // Radio default
|
setModemConfig(Bw125Cr45Sf128); // Radio default
|
||||||
// setModemConfig(Bw125Cr48Sf4096); // slow and reliable?
|
// setModemConfig(Bw125Cr48Sf4096); // slow and reliable?
|
||||||
setPreambleLength(8); // Default is 8
|
setPreambleLength(8); // Default is 8
|
||||||
// An innocuous ISM frequency, same as RF22's
|
// An innocuous ISM frequency, same as RF22's
|
||||||
setFrequency(433.850);
|
setFrequency(433.800);
|
||||||
// Lowish power
|
// Lowish power
|
||||||
setTxPower(23);
|
setTxPower(20);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// C++ level interrupt handler for this instance
|
// C++ level interrupt handler for this instance
|
||||||
|
@ -119,296 +126,329 @@ bool BG_RF95::init() {
|
||||||
// On MiniWirelessLoRa, only one of the several interrupt lines (DI0) from the RFM95 is usefuly
|
// On MiniWirelessLoRa, only one of the several interrupt lines (DI0) from the RFM95 is usefuly
|
||||||
// connnected to the processor.
|
// connnected to the processor.
|
||||||
// We use this to get RxDone and TxDone interrupts
|
// We use this to get RxDone and TxDone interrupts
|
||||||
void BG_RF95::handleInterrupt() {
|
void BG_RF95::handleInterrupt()
|
||||||
// Read the interrupt register
|
{
|
||||||
//Serial.println("HandleInterrupt");
|
// Read the interrupt register
|
||||||
uint8_t irq_flags = spiRead(BG_RF95_REG_12_IRQ_FLAGS);
|
//Serial.println("HandleInterrupt");
|
||||||
if (_mode == RHModeRx && irq_flags & (BG_RF95_RX_TIMEOUT | BG_RF95_PAYLOAD_CRC_ERROR)) {
|
uint8_t irq_flags = spiRead(BG_RF95_REG_12_IRQ_FLAGS);
|
||||||
_rxBad++;
|
if (_mode == RHModeRx && irq_flags & (BG_RF95_RX_TIMEOUT | BG_RF95_PAYLOAD_CRC_ERROR))
|
||||||
} else if (_mode == RHModeRx && irq_flags & BG_RF95_RX_DONE) {
|
{
|
||||||
// Have received a packet
|
_rxBad++;
|
||||||
uint8_t len = spiRead(BG_RF95_REG_13_RX_NB_BYTES);
|
}
|
||||||
|
else if (_mode == RHModeRx && irq_flags & BG_RF95_RX_DONE)
|
||||||
|
{
|
||||||
|
// Have received a packet
|
||||||
|
uint8_t len = spiRead(BG_RF95_REG_13_RX_NB_BYTES);
|
||||||
|
|
||||||
|
// Reset the fifo read ptr to the beginning of the packet
|
||||||
|
spiWrite(BG_RF95_REG_0D_FIFO_ADDR_PTR, spiRead(BG_RF95_REG_10_FIFO_RX_CURRENT_ADDR));
|
||||||
|
spiBurstRead(BG_RF95_REG_00_FIFO, _buf, len);
|
||||||
|
_bufLen = len;
|
||||||
|
spiWrite(BG_RF95_REG_12_IRQ_FLAGS, 0xff); // Clear all IRQ flags
|
||||||
|
|
||||||
|
// Remember the RSSI of this packet
|
||||||
|
// this is according to the doc, but is it really correct?
|
||||||
|
// weakest receiveable signals are reported RSSI at about -66
|
||||||
|
_lastRssi = spiRead(BG_RF95_REG_1A_PKT_RSSI_VALUE) - 137;
|
||||||
|
|
||||||
|
_lastSNR = spiRead(BG_RF95_REG_19_PKT_SNR_VALUE);
|
||||||
|
|
||||||
|
// We have received a message.
|
||||||
|
validateRxBuf();
|
||||||
|
if (_rxBufValid)
|
||||||
|
setModeIdle(); // Got one
|
||||||
|
}
|
||||||
|
else if (_mode == RHModeTx && irq_flags & BG_RF95_TX_DONE)
|
||||||
|
{
|
||||||
|
_txGood++;
|
||||||
|
setModeIdle();
|
||||||
|
}
|
||||||
|
|
||||||
// Reset the fifo read ptr to the beginning of the packet
|
|
||||||
spiWrite(BG_RF95_REG_0D_FIFO_ADDR_PTR, spiRead(BG_RF95_REG_10_FIFO_RX_CURRENT_ADDR));
|
|
||||||
spiBurstRead(BG_RF95_REG_00_FIFO, _buf, len);
|
|
||||||
_bufLen = len;
|
|
||||||
spiWrite(BG_RF95_REG_12_IRQ_FLAGS, 0xff); // Clear all IRQ flags
|
spiWrite(BG_RF95_REG_12_IRQ_FLAGS, 0xff); // Clear all IRQ flags
|
||||||
|
|
||||||
// Remember the RSSI of this packet
|
|
||||||
// this is according to the doc, but is it really correct?
|
|
||||||
// weakest receiveable signals are reported RSSI at about -66
|
|
||||||
_lastRssi = spiRead(BG_RF95_REG_1A_PKT_RSSI_VALUE) - 137;
|
|
||||||
|
|
||||||
_lastSNR = spiRead(BG_RF95_REG_19_PKT_SNR_VALUE);
|
|
||||||
|
|
||||||
// We have received a message.
|
|
||||||
validateRxBuf();
|
|
||||||
if (_rxBufValid)
|
|
||||||
setModeIdle(); // Got one
|
|
||||||
} else if (_mode == RHModeTx && irq_flags & BG_RF95_TX_DONE) {
|
|
||||||
_txGood++;
|
|
||||||
setModeIdle();
|
|
||||||
}
|
|
||||||
|
|
||||||
spiWrite(BG_RF95_REG_12_IRQ_FLAGS, 0xff); // Clear all IRQ flags
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// These are low level functions that call the interrupt handler for the correct
|
// These are low level functions that call the interrupt handler for the correct
|
||||||
// instance of BG_RF95.
|
// instance of BG_RF95.
|
||||||
// 3 interrupts allows us to have 3 different devices
|
// 3 interrupts allows us to have 3 different devices
|
||||||
void BG_RF95::isr0() {
|
void BG_RF95::isr0()
|
||||||
if (_deviceForInterrupt[0])
|
{
|
||||||
_deviceForInterrupt[0]->handleInterrupt();
|
if (_deviceForInterrupt[0])
|
||||||
|
_deviceForInterrupt[0]->handleInterrupt();
|
||||||
}
|
}
|
||||||
|
void BG_RF95::isr1()
|
||||||
void BG_RF95::isr1() {
|
{
|
||||||
if (_deviceForInterrupt[1])
|
if (_deviceForInterrupt[1])
|
||||||
_deviceForInterrupt[1]->handleInterrupt();
|
_deviceForInterrupt[1]->handleInterrupt();
|
||||||
}
|
}
|
||||||
|
void BG_RF95::isr2()
|
||||||
void BG_RF95::isr2() {
|
{
|
||||||
if (_deviceForInterrupt[2])
|
if (_deviceForInterrupt[2])
|
||||||
_deviceForInterrupt[2]->handleInterrupt();
|
_deviceForInterrupt[2]->handleInterrupt();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check whether the latest received message is complete and uncorrupted
|
// Check whether the latest received message is complete and uncorrupted
|
||||||
void BG_RF95::validateRxBuf() {
|
void BG_RF95::validateRxBuf()
|
||||||
_promiscuous = 1;
|
{
|
||||||
if (_bufLen < 4)
|
_promiscuous = 1;
|
||||||
return; // Too short to be a real message
|
if (_bufLen < 4)
|
||||||
// Extract the 4 headers
|
return; // Too short to be a real message
|
||||||
//Serial.println("validateRxBuf >= 4");
|
// Extract the 4 headers
|
||||||
_rxHeaderTo = _buf[0];
|
//Serial.println("validateRxBuf >= 4");
|
||||||
_rxHeaderFrom = _buf[1];
|
_rxHeaderTo = _buf[0];
|
||||||
_rxHeaderId = _buf[2];
|
_rxHeaderFrom = _buf[1];
|
||||||
_rxHeaderFlags = _buf[3];
|
_rxHeaderId = _buf[2];
|
||||||
if (_promiscuous ||
|
_rxHeaderFlags = _buf[3];
|
||||||
_rxHeaderTo == _thisAddress ||
|
if (_promiscuous ||
|
||||||
_rxHeaderTo == RH_BROADCAST_ADDRESS) {
|
_rxHeaderTo == _thisAddress ||
|
||||||
_rxGood++;
|
_rxHeaderTo == RH_BROADCAST_ADDRESS)
|
||||||
_rxBufValid = true;
|
{
|
||||||
}
|
_rxGood++;
|
||||||
|
_rxBufValid = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BG_RF95::available() {
|
bool BG_RF95::available()
|
||||||
if (_mode == RHModeTx)
|
{
|
||||||
return false;
|
if (_mode == RHModeTx)
|
||||||
setModeRx();
|
return false;
|
||||||
return _rxBufValid; // Will be set by the interrupt handler when a good message is received
|
setModeRx();
|
||||||
|
return _rxBufValid; // Will be set by the interrupt handler when a good message is received
|
||||||
}
|
}
|
||||||
|
|
||||||
void BG_RF95::clearRxBuf() {
|
void BG_RF95::clearRxBuf()
|
||||||
ATOMIC_BLOCK_START;
|
{
|
||||||
_rxBufValid = false;
|
ATOMIC_BLOCK_START;
|
||||||
_bufLen = 0;
|
_rxBufValid = false;
|
||||||
ATOMIC_BLOCK_END;
|
_bufLen = 0;
|
||||||
|
ATOMIC_BLOCK_END;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// BG 3 Byte header
|
// BG 3 Byte header
|
||||||
bool BG_RF95::recvAPRS(uint8_t *buf, uint8_t *len) {
|
bool BG_RF95::recvAPRS(uint8_t* buf, uint8_t* len)
|
||||||
if (!available())
|
{
|
||||||
return false;
|
if (!available())
|
||||||
if (buf && len) {
|
return false;
|
||||||
ATOMIC_BLOCK_START;
|
if (buf && len)
|
||||||
// Skip the 4 headers that are at the beginning of the rxBuf
|
{
|
||||||
if (*len > _bufLen - BG_RF95_HEADER_LEN)
|
ATOMIC_BLOCK_START;
|
||||||
*len = _bufLen - (BG_RF95_HEADER_LEN - 1);
|
// Skip the 4 headers that are at the beginning of the rxBuf
|
||||||
memcpy(buf, _buf + (BG_RF95_HEADER_LEN - 1), *len); // BG only 3 Byte header (-1)
|
if (*len > _bufLen-BG_RF95_HEADER_LEN)
|
||||||
ATOMIC_BLOCK_END;
|
*len = _bufLen-(BG_RF95_HEADER_LEN-1);
|
||||||
}
|
memcpy(buf, _buf+(BG_RF95_HEADER_LEN-1), *len); // BG only 3 Byte header (-1)
|
||||||
clearRxBuf(); // This message accepted and cleared
|
ATOMIC_BLOCK_END;
|
||||||
return true;
|
}
|
||||||
|
clearRxBuf(); // This message accepted and cleared
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BG_RF95::recv(uint8_t *buf, uint8_t *len) {
|
bool BG_RF95::recv(uint8_t* buf, uint8_t* len)
|
||||||
if (!available())
|
{
|
||||||
return false;
|
if (!available())
|
||||||
if (buf && len) {
|
return false;
|
||||||
ATOMIC_BLOCK_START;
|
if (buf && len)
|
||||||
// Skip the 4 headers that are at the beginning of the rxBuf
|
{
|
||||||
if (*len > _bufLen - BG_RF95_HEADER_LEN)
|
ATOMIC_BLOCK_START;
|
||||||
*len = _bufLen - BG_RF95_HEADER_LEN;
|
// Skip the 4 headers that are at the beginning of the rxBuf
|
||||||
memcpy(buf, _buf + BG_RF95_HEADER_LEN, *len);
|
if (*len > _bufLen-BG_RF95_HEADER_LEN)
|
||||||
ATOMIC_BLOCK_END;
|
*len = _bufLen-BG_RF95_HEADER_LEN;
|
||||||
}
|
memcpy(buf, _buf+BG_RF95_HEADER_LEN, *len);
|
||||||
clearRxBuf(); // This message accepted and cleared
|
ATOMIC_BLOCK_END;
|
||||||
return true;
|
}
|
||||||
|
clearRxBuf(); // This message accepted and cleared
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t BG_RF95::lastSNR() {
|
uint8_t BG_RF95::lastSNR()
|
||||||
return (_lastSNR);
|
{
|
||||||
|
return(_lastSNR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool BG_RF95::send(const uint8_t *data, uint8_t len) {
|
bool BG_RF95::send(const uint8_t* data, uint8_t len)
|
||||||
if (len > BG_RF95_MAX_MESSAGE_LEN)
|
{
|
||||||
return false;
|
if (len > BG_RF95_MAX_MESSAGE_LEN)
|
||||||
|
return false;
|
||||||
|
|
||||||
waitPacketSent(); // Make sure we dont interrupt an outgoing message
|
waitPacketSent(); // Make sure we dont interrupt an outgoing message
|
||||||
setModeIdle();
|
setModeIdle();
|
||||||
|
|
||||||
// Position at the beginning of the FIFO
|
// Position at the beginning of the FIFO
|
||||||
spiWrite(BG_RF95_REG_0D_FIFO_ADDR_PTR, 0);
|
spiWrite(BG_RF95_REG_0D_FIFO_ADDR_PTR, 0);
|
||||||
// The headers
|
// The headers
|
||||||
spiWrite(BG_RF95_REG_00_FIFO, _txHeaderTo);
|
spiWrite(BG_RF95_REG_00_FIFO, _txHeaderTo);
|
||||||
spiWrite(BG_RF95_REG_00_FIFO, _txHeaderFrom);
|
spiWrite(BG_RF95_REG_00_FIFO, _txHeaderFrom);
|
||||||
spiWrite(BG_RF95_REG_00_FIFO, _txHeaderId);
|
spiWrite(BG_RF95_REG_00_FIFO, _txHeaderId);
|
||||||
spiWrite(BG_RF95_REG_00_FIFO, _txHeaderFlags);
|
spiWrite(BG_RF95_REG_00_FIFO, _txHeaderFlags);
|
||||||
// The message data
|
// The message data
|
||||||
spiBurstWrite(BG_RF95_REG_00_FIFO, data, len);
|
spiBurstWrite(BG_RF95_REG_00_FIFO, data, len);
|
||||||
spiWrite(BG_RF95_REG_22_PAYLOAD_LENGTH, len + BG_RF95_HEADER_LEN);
|
spiWrite(BG_RF95_REG_22_PAYLOAD_LENGTH, len + BG_RF95_HEADER_LEN);
|
||||||
|
|
||||||
setModeTx(); // Start the transmitter
|
setModeTx(); // Start the transmitter
|
||||||
// when Tx is done, interruptHandler will fire and radio mode will return to STANDBY
|
// when Tx is done, interruptHandler will fire and radio mode will return to STANDBY
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BG_RF95::sendAPRS(const uint8_t *data, uint8_t len) {
|
bool BG_RF95::sendAPRS(const uint8_t* data, uint8_t len)
|
||||||
if (len > BG_RF95_MAX_MESSAGE_LEN)
|
{
|
||||||
return false;
|
if (len > BG_RF95_MAX_MESSAGE_LEN)
|
||||||
|
return false;
|
||||||
|
|
||||||
waitPacketSent(); // Make sure we dont interrupt an outgoing message
|
waitPacketSent(); // Make sure we dont interrupt an outgoing message
|
||||||
setModeIdle();
|
setModeIdle();
|
||||||
|
|
||||||
// Position at the beginning of the FIFO
|
// Position at the beginning of the FIFO
|
||||||
spiWrite(BG_RF95_REG_0D_FIFO_ADDR_PTR, 0);
|
spiWrite(BG_RF95_REG_0D_FIFO_ADDR_PTR, 0);
|
||||||
// The headers for APRS
|
// The headers for APRS
|
||||||
spiWrite(BG_RF95_REG_00_FIFO, '<');
|
spiWrite(BG_RF95_REG_00_FIFO, '<');
|
||||||
spiWrite(BG_RF95_REG_00_FIFO, _txHeaderFrom);
|
spiWrite(BG_RF95_REG_00_FIFO, _txHeaderFrom);
|
||||||
spiWrite(BG_RF95_REG_00_FIFO, 0x1);
|
spiWrite(BG_RF95_REG_00_FIFO, 0x1 );
|
||||||
//spiWrite(BG_RF95_REG_00_FIFO, _txHeaderFlags);
|
//spiWrite(BG_RF95_REG_00_FIFO, _txHeaderFlags);
|
||||||
// The message data
|
// The message data
|
||||||
spiBurstWrite(BG_RF95_REG_00_FIFO, data, len);
|
spiBurstWrite(BG_RF95_REG_00_FIFO, data, len);
|
||||||
spiWrite(BG_RF95_REG_22_PAYLOAD_LENGTH, len + BG_RF95_HEADER_LEN - 1); // only 3 Byte header BG
|
spiWrite(BG_RF95_REG_22_PAYLOAD_LENGTH, len + BG_RF95_HEADER_LEN -1 ); // only 3 Byte header BG
|
||||||
|
|
||||||
setModeTx(); // Start the transmitter
|
setModeTx(); // Start the transmitter
|
||||||
// when Tx is done, interruptHandler will fire and radio mode will return to STANDBY
|
// when Tx is done, interruptHandler will fire and radio mode will return to STANDBY
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BG_RF95::printRegisters() {
|
bool BG_RF95::printRegisters()
|
||||||
|
{
|
||||||
#ifdef RH_HAVE_SERIAL
|
#ifdef RH_HAVE_SERIAL
|
||||||
uint8_t registers[] = {0x01, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13,
|
uint8_t registers[] = { 0x01, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x014, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x4d };
|
||||||
0x014, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22,
|
|
||||||
0x23, 0x24, 0x25, 0x26, 0x27, 0x4d};
|
|
||||||
|
|
||||||
uint8_t i;
|
uint8_t i;
|
||||||
for (i = 0; i < sizeof(registers); i++) {
|
for (i = 0; i < sizeof(registers); i++)
|
||||||
Serial.print(registers[i], HEX);
|
{
|
||||||
Serial.print(": ");
|
Serial.print(registers[i], HEX);
|
||||||
Serial.println(spiRead(registers[i]), HEX);
|
Serial.print(": ");
|
||||||
}
|
Serial.println(spiRead(registers[i]), HEX);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t BG_RF95::maxMessageLength() {
|
uint8_t BG_RF95::maxMessageLength()
|
||||||
return BG_RF95_MAX_MESSAGE_LEN;
|
{
|
||||||
|
return BG_RF95_MAX_MESSAGE_LEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BG_RF95::setFrequency(float centre) {
|
bool BG_RF95::setFrequency(float centre)
|
||||||
// Frf = FRF / FSTEP
|
{
|
||||||
uint32_t frf = (centre * 1000000.0) / BG_RF95_FSTEP;
|
// Frf = FRF / FSTEP
|
||||||
spiWrite(BG_RF95_REG_06_FRF_MSB, (frf >> 16) & 0xff);
|
uint32_t frf = (centre * 1000000.0) / BG_RF95_FSTEP;
|
||||||
spiWrite(BG_RF95_REG_07_FRF_MID, (frf >> 8) & 0xff);
|
spiWrite(BG_RF95_REG_06_FRF_MSB, (frf >> 16) & 0xff);
|
||||||
spiWrite(BG_RF95_REG_08_FRF_LSB, frf & 0xff);
|
spiWrite(BG_RF95_REG_07_FRF_MID, (frf >> 8) & 0xff);
|
||||||
|
spiWrite(BG_RF95_REG_08_FRF_LSB, frf & 0xff);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BG_RF95::setModeIdle() {
|
void BG_RF95::setModeIdle()
|
||||||
if (_mode != RHModeIdle) {
|
{
|
||||||
spiWrite(BG_RF95_REG_01_OP_MODE, BG_RF95_MODE_STDBY);
|
if (_mode != RHModeIdle)
|
||||||
_mode = RHModeIdle;
|
{
|
||||||
}
|
spiWrite(BG_RF95_REG_01_OP_MODE, BG_RF95_MODE_STDBY);
|
||||||
|
_mode = RHModeIdle;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool BG_RF95::sleep() {
|
bool BG_RF95::sleep()
|
||||||
if (_mode != RHModeSleep) {
|
{
|
||||||
spiWrite(BG_RF95_REG_01_OP_MODE, BG_RF95_MODE_SLEEP);
|
if (_mode != RHModeSleep)
|
||||||
_mode = RHModeSleep;
|
{
|
||||||
}
|
spiWrite(BG_RF95_REG_01_OP_MODE, BG_RF95_MODE_SLEEP);
|
||||||
return true;
|
_mode = RHModeSleep;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BG_RF95::setModeRx() {
|
void BG_RF95::setModeRx()
|
||||||
if (_mode != RHModeRx) {
|
{
|
||||||
//Serial.println("SetModeRx");
|
if (_mode != RHModeRx)
|
||||||
_mode = RHModeRx;
|
{
|
||||||
spiWrite(BG_RF95_REG_01_OP_MODE, BG_RF95_MODE_RXCONTINUOUS);
|
//Serial.println("SetModeRx");
|
||||||
spiWrite(BG_RF95_REG_40_DIO_MAPPING1, 0x00); // Interrupt on RxDone
|
_mode = RHModeRx;
|
||||||
}
|
spiWrite(BG_RF95_REG_01_OP_MODE, BG_RF95_MODE_RXCONTINUOUS);
|
||||||
|
spiWrite(BG_RF95_REG_40_DIO_MAPPING1, 0x00); // Interrupt on RxDone
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BG_RF95::setModeTx() {
|
void BG_RF95::setModeTx()
|
||||||
if (_mode != RHModeTx) {
|
{
|
||||||
|
if (_mode != RHModeTx)
|
||||||
|
{
|
||||||
_mode = RHModeTx; // set first to avoid possible race condition
|
_mode = RHModeTx; // set first to avoid possible race condition
|
||||||
spiWrite(BG_RF95_REG_01_OP_MODE, BG_RF95_MODE_TX);
|
spiWrite(BG_RF95_REG_01_OP_MODE, BG_RF95_MODE_TX);
|
||||||
spiWrite(BG_RF95_REG_40_DIO_MAPPING1, 0x40); // Interrupt on TxDone
|
spiWrite(BG_RF95_REG_40_DIO_MAPPING1, 0x40); // Interrupt on TxDone
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BG_RF95::setTxPower(int8_t power, bool useRFO) {
|
void BG_RF95::setTxPower(int8_t power, bool useRFO)
|
||||||
// Sigh, different behaviours depending on whther the module use PA_BOOST or the RFO pin
|
{
|
||||||
// for the transmitter output
|
// Sigh, different behaviours depending on whther the module use PA_BOOST or the RFO pin
|
||||||
if (useRFO) {
|
// for the transmitter output
|
||||||
if (power > 19) power = 19;
|
if (useRFO)
|
||||||
if (power < -1) power = -1;
|
{
|
||||||
spiWrite(BG_RF95_REG_09_PA_CONFIG, BG_RF95_MAX_POWER | (power + 1));
|
if (power > 14) power = 14;
|
||||||
} else {
|
if (power < -1) power = -1;
|
||||||
if (power > 23) power = 23;
|
spiWrite(BG_RF95_REG_09_PA_CONFIG, BG_RF95_MAX_POWER | (power + 1));
|
||||||
if (power < 5) power = 5;
|
} else {
|
||||||
|
if (power > 23) power = 23;
|
||||||
|
if (power < 5) power = 5;
|
||||||
|
|
||||||
// For BG_RF95_PA_DAC_ENABLE, manual says '+20dBm on PA_BOOST when OutputPower=0xf'
|
// For BG_RF95_PA_DAC_ENABLE, manual says '+20dBm on PA_BOOST when OutputPower=0xf'
|
||||||
// BG_RF95_PA_DAC_ENABLE actually adds about 3dBm to all power levels. We will us it
|
// BG_RF95_PA_DAC_ENABLE actually adds about 3dBm to all power levels. We will us it
|
||||||
// for 21, 22 and 23dBm -= 3;
|
// for 21, 22 and 23dBm -= 3;
|
||||||
}
|
}
|
||||||
if (power > 20) {
|
if (power > 20) {
|
||||||
spiWrite(BG_RF95_REG_0B_OCP, (BG_RF95_OCP_ON | BG_RF95_OCP_TRIM)); // Trim max current tp 240mA
|
spiWrite(BG_RF95_REG_0B_OCP, ( BG_RF95_OCP_ON | BG_RF95_OCP_TRIM ) ); // Trim max current tp 240mA
|
||||||
spiWrite(BG_RF95_REG_4D_PA_DAC, BG_RF95_PA_DAC_ENABLE);
|
spiWrite(BG_RF95_REG_4D_PA_DAC, BG_RF95_PA_DAC_ENABLE);
|
||||||
//power -= 3;
|
//power -= 3;
|
||||||
power = 23; // and set PA_DAC_ENABLE
|
power = 20; // and set PA_DAC_ENABLE
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
spiWrite(BG_RF95_REG_4D_PA_DAC, BG_RF95_PA_DAC_DISABLE);
|
spiWrite(BG_RF95_REG_4D_PA_DAC, BG_RF95_PA_DAC_DISABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// RFM95/96/97/98 does not have RFO pins connected to anything. Only PA_BOOST
|
// RFM95/96/97/98 does not have RFO pins connected to anything. Only PA_BOOST
|
||||||
// pin is connected, so must use PA_BOOST
|
// pin is connected, so must use PA_BOOST
|
||||||
// Pout = 2 + OutputPower.
|
// Pout = 2 + OutputPower.
|
||||||
// The documentation is pretty confusing on this topic: PaSelect says the max power is 20dBm,
|
// The documentation is pretty confusing on this topic: PaSelect says the max power is 20dBm,
|
||||||
// but OutputPower claims it would be 17dBm.
|
// but OutputPower claims it would be 17dBm.
|
||||||
// My measurements show 20dBm is correct
|
// My measurements show 20dBm is correct
|
||||||
//spiWrite(BG_RF95_REG_09_PA_CONFIG, (BG_RF95_PA_SELECT | (power-5)) );
|
//spiWrite(BG_RF95_REG_09_PA_CONFIG, (BG_RF95_PA_SELECT | (power-5)) );
|
||||||
spiWrite(BG_RF95_REG_09_PA_CONFIG, (BG_RF95_PA_SELECT | BG_RF95_MAX_POWER | (power - 5)));
|
spiWrite(BG_RF95_REG_09_PA_CONFIG, (BG_RF95_PA_SELECT | BG_RF95_MAX_POWER | (power-5)) );
|
||||||
|
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sets registers from a canned modem configuration structure
|
// Sets registers from a canned modem configuration structure
|
||||||
void BG_RF95::setModemRegisters(const ModemConfig *config) {
|
void BG_RF95::setModemRegisters(const ModemConfig* config)
|
||||||
spiWrite(BG_RF95_REG_1D_MODEM_CONFIG1, config->reg_1d);
|
{
|
||||||
spiWrite(BG_RF95_REG_1E_MODEM_CONFIG2, config->reg_1e);
|
spiWrite(BG_RF95_REG_1D_MODEM_CONFIG1, config->reg_1d);
|
||||||
spiWrite(BG_RF95_REG_26_MODEM_CONFIG3, config->reg_26);
|
spiWrite(BG_RF95_REG_1E_MODEM_CONFIG2, config->reg_1e);
|
||||||
|
spiWrite(BG_RF95_REG_26_MODEM_CONFIG3, config->reg_26);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set one of the canned FSK Modem configs
|
// Set one of the canned FSK Modem configs
|
||||||
// Returns true if its a valid choice
|
// Returns true if its a valid choice
|
||||||
bool BG_RF95::setModemConfig(ModemConfigChoice index) {
|
bool BG_RF95::setModemConfig(ModemConfigChoice index)
|
||||||
if (index > (signed int) (sizeof(MODEM_CONFIG_TABLE) / sizeof(ModemConfig)))
|
{
|
||||||
return false;
|
if (index > (signed int)(sizeof(MODEM_CONFIG_TABLE) / sizeof(ModemConfig)))
|
||||||
|
return false;
|
||||||
|
|
||||||
ModemConfig cfg;
|
ModemConfig cfg;
|
||||||
memcpy_P(&cfg, &MODEM_CONFIG_TABLE[index], sizeof(BG_RF95::ModemConfig));
|
memcpy_P(&cfg, &MODEM_CONFIG_TABLE[index], sizeof(BG_RF95::ModemConfig));
|
||||||
setModemRegisters(&cfg);
|
setModemRegisters(&cfg);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BG_RF95::setPreambleLength(uint16_t bytes) {
|
void BG_RF95::setPreambleLength(uint16_t bytes)
|
||||||
spiWrite(BG_RF95_REG_20_PREAMBLE_MSB, bytes >> 8);
|
{
|
||||||
spiWrite(BG_RF95_REG_21_PREAMBLE_LSB, bytes & 0xff);
|
spiWrite(BG_RF95_REG_20_PREAMBLE_MSB, bytes >> 8);
|
||||||
|
spiWrite(BG_RF95_REG_21_PREAMBLE_LSB, bytes & 0xff);
|
||||||
}
|
}
|
||||||
|
|
|
@ -183,15 +183,15 @@
|
||||||
|
|
||||||
// BG_RF95_REG_1D_MODEM_CONFIG1 0x1d
|
// BG_RF95_REG_1D_MODEM_CONFIG1 0x1d
|
||||||
#define BG_RF95_BW 0xc0
|
#define BG_RF95_BW 0xc0
|
||||||
#define BG_RF95_BW_125KHZ 0x70
|
#define BG_RF95_BW_125KHZ 0x00
|
||||||
#define BG_RF95_BW_250KHZ 0x80
|
#define BG_RF95_BW_250KHZ 0x40
|
||||||
#define BG_RF95_BW_500KHZ 0x90
|
#define BG_RF95_BW_500KHZ 0x80
|
||||||
#define BG_RF95_BW_RESERVED 0xc0
|
#define BG_RF95_BW_RESERVED 0xc0
|
||||||
#define BG_RF95_CODING_RATE 0x38
|
#define BG_RF95_CODING_RATE 0x38
|
||||||
#define BG_RF95_CODING_RATE_4_5 0x02
|
#define BG_RF95_CODING_RATE_4_5 0x00
|
||||||
#define BG_RF95_CODING_RATE_4_6 0x04
|
#define BG_RF95_CODING_RATE_4_6 0x08
|
||||||
#define BG_RF95_CODING_RATE_4_7 0x06
|
#define BG_RF95_CODING_RATE_4_7 0x10
|
||||||
#define BG_RF95_CODING_RATE_4_8 0x08
|
#define BG_RF95_CODING_RATE_4_8 0x18
|
||||||
#define BG_RF95_IMPLICIT_HEADER_MODE_ON 0x04
|
#define BG_RF95_IMPLICIT_HEADER_MODE_ON 0x04
|
||||||
#define BG_RF95_RX_PAYLOAD_CRC_ON 0x02
|
#define BG_RF95_RX_PAYLOAD_CRC_ON 0x02
|
||||||
#define BG_RF95_LOW_DATA_RATE_OPTIMIZE 0x01
|
#define BG_RF95_LOW_DATA_RATE_OPTIMIZE 0x01
|
||||||
|
@ -461,7 +461,7 @@
|
||||||
/// -1 to +14 (for modules that use RFO transmitter pin)
|
/// -1 to +14 (for modules that use RFO transmitter pin)
|
||||||
/// The default is 13. Eg:
|
/// The default is 13. Eg:
|
||||||
/// \code
|
/// \code
|
||||||
/// driver.setTxPower(23); // use PA_BOOST transmitter pin
|
/// driver.setTxPower(10); // use PA_BOOST transmitter pin
|
||||||
/// driver.setTxPower(10, true); // use PA_RFO pin transmitter pin
|
/// driver.setTxPower(10, true); // use PA_RFO pin transmitter pin
|
||||||
/// \endcode
|
/// \endcode
|
||||||
///
|
///
|
||||||
|
@ -542,12 +542,13 @@ public:
|
||||||
/// you may need to change the RHReliableDatagram timeout for reliable operations.
|
/// you may need to change the RHReliableDatagram timeout for reliable operations.
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
Bw125Cr45Sf128 = 0, ///< Bw = 125 kHz, Cr = 4/5, Sf = 128chips/symbol, CRC on. Default medium range
|
Bw125Cr45Sf128 = 0, ///< Bw = 125 kHz, Cr = 4/5, Sf = 128chips/symbol, CRC on. Default medium range
|
||||||
Bw125Cr48Sf4096, ///< Bw = 125 kHz, Cr = 4/8, Sf = 4096chips/symbol, CRC on. Slow+long range
|
Bw500Cr45Sf128, ///< Bw = 500 kHz, Cr = 4/5, Sf = 128chips/symbol, CRC on. Fast+short range
|
||||||
Bw125Cr45Sf4096, ///< APRS
|
Bw31_25Cr48Sf512, ///< Bw = 31.25 kHz, Cr = 4/8, Sf = 512chips/symbol, CRC on. Slow+long range
|
||||||
Bw125Cr47Sf512, /// 1200 bps
|
Bw125Cr48Sf4096, ///< Bw = 125 kHz, Cr = 4/8, Sf = 4096chips/symbol, CRC on. Slow+long range
|
||||||
Bw125Cr45Sf2048, ///<Bw = 125 kHz Cr = 4/5, Sf= 2048 chips/symbol, CRC on.
|
Bw125Cr45Sf4096, ///< APRS
|
||||||
Bw250Cr48Sf4096, ///< Bw = 250 kHz, Cr = 4/8, Sf = 4096chips/symbol, CRC on.
|
Bw125Cr45Sf2048, ///< M0IGA Messup speed / 698baud (not 1200)
|
||||||
|
Bw125Cr47Sf512, ///< corrected 1200 baud
|
||||||
} ModemConfigChoice;
|
} ModemConfigChoice;
|
||||||
|
|
||||||
/// Constructor. You can have multiple instances, but each instance must have its own
|
/// Constructor. You can have multiple instances, but each instance must have its own
|
||||||
|
|
|
@ -707,12 +707,12 @@ void setup(){
|
||||||
#endif
|
#endif
|
||||||
batt_read();
|
batt_read();
|
||||||
writedisplaytext("LoRa-APRS","","Init:","ADC OK!","BAT: "+String(BattVolts,1),"");
|
writedisplaytext("LoRa-APRS","","Init:","ADC OK!","BAT: "+String(BattVolts,1),"");
|
||||||
rf95.setFrequency(433.775);
|
|
||||||
#ifdef SPEED_1200
|
#ifdef SPEED_1200
|
||||||
rf95.setModemConfig(BG_RF95::Bw125Cr47Sf512);
|
rf95.setModemConfig(BG_RF95::Bw125Cr47Sf512);
|
||||||
#else
|
#else
|
||||||
rf95.setModemConfig(BG_RF95::Bw125Cr45Sf4096);
|
rf95.setModemConfig(BG_RF95::Bw125Cr45Sf4096);
|
||||||
#endif
|
#endif
|
||||||
|
rf95.setFrequency(433.775);
|
||||||
rf95.setTxPower(txPower);
|
rf95.setTxPower(txPower);
|
||||||
delay(250);
|
delay(250);
|
||||||
#ifdef KISS_PROTOCOL
|
#ifdef KISS_PROTOCOL
|
||||||
|
|
Loading…
Reference in New Issue