[SX126x] Removed DIO2 from constructor

This commit is contained in:
jgromes 2019-11-27 08:50:21 +01:00
parent 49f6a7c75a
commit b0dee4c51c
9 changed files with 12 additions and 33 deletions

View file

@ -18,9 +18,8 @@
// SX1262 has the following connections:
// NSS pin: 10
// DIO1 pin: 2
// DIO2 pin: 3
// BUSY pin: 9
SX1262 lora = new Module(10, 2, 3, 9);
SX1262 lora = new Module(10, 2, 9);
// or using RadioShield
// https://github.com/jgromes/RadioShield

View file

@ -19,9 +19,8 @@
// SX1262 has the following connections:
// NSS pin: 10
// DIO1 pin: 2
// DIO2 pin: 3
// BUSY pin: 9
SX1262 fsk = new Module(10, 2, 3, 9);
SX1262 fsk = new Module(10, 2, 9);
// or using RadioShield
// https://github.com/jgromes/RadioShield

View file

@ -25,7 +25,7 @@
// DIO1 pin: 2
// DIO2 pin: 3
// BUSY pin: 9
SX1262 lora = new Module(10, 2, 3, 9);
SX1262 lora = new Module(10, 2, 9);
// or using RadioShield
// https://github.com/jgromes/RadioShield

View file

@ -24,9 +24,8 @@
// SX1262 has the following connections:
// NSS pin: 10
// DIO1 pin: 2
// DIO2 pin: 3
// BUSY pin: 9
SX1262 lora = new Module(10, 2, 3, 9);
SX1262 lora = new Module(10, 2, 9);
// or using RadioShield
// https://github.com/jgromes/RadioShield

View file

@ -27,16 +27,14 @@
// SX1262 has the following connections:
// NSS pin: 10
// DIO1 pin: 2
// DIO2 pin: 3
// BUSY pin: 9
SX1262 loraSX1262 = new Module(10, 2, 3, 9);
SX1262 loraSX1262 = new Module(10, 2, 9);
// SX12628 has different connections:
// NSS pin: 8
// DIO1 pin: 4
// DIO2 pin: 5
// BUSY pin: 6
SX1268 loraSX1268 = new Module(8, 4, 5, 6);
SX1268 loraSX1268 = new Module(8, 4, 6);
// or using RadioShield
// https://github.com/jgromes/RadioShield

View file

@ -19,9 +19,8 @@
// SX1262 has the following connections:
// NSS pin: 10
// DIO1 pin: 2
// DIO2 pin: 3
// BUSY pin: 9
SX1262 lora = new Module(10, 2, 3, 9);
SX1262 lora = new Module(10, 2, 9);
// or using RadioShield
// https://github.com/jgromes/RadioShield

View file

@ -20,9 +20,8 @@
// SX1262 has the following connections:
// NSS pin: 10
// DIO1 pin: 2
// DIO2 pin: 3
// BUSY pin: 9
SX1262 lora = new Module(10, 2, 3, 9);
SX1262 lora = new Module(10, 2, 9);
// save transmission state between loops
int transmissionState = ERR_NONE;

View file

@ -7,7 +7,6 @@ SX126x::SX126x(Module* mod) : PhysicalLayer(SX126X_CRYSTAL_FREQ, SX126X_DIV_EXPO
int16_t SX126x::begin(float bw, uint8_t sf, uint8_t cr, uint16_t syncWord, float currentLimit, uint16_t preambleLength, float tcxoVoltage) {
// set module properties
_mod->init(RADIOLIB_USE_SPI, RADIOLIB_INT_BOTH);
pinMode(_mod->getRx(), INPUT);
// BW in kHz and SF are required in order to calculate LDRO for setModulationParams
_bwKhz = bw;
@ -80,7 +79,6 @@ int16_t SX126x::begin(float bw, uint8_t sf, uint8_t cr, uint16_t syncWord, float
int16_t SX126x::beginFSK(float br, float freqDev, float rxBw, float currentLimit, uint16_t preambleLength, float dataShaping, float tcxoVoltage) {
// set module properties
_mod->init(RADIOLIB_USE_SPI, RADIOLIB_INT_BOTH);
pinMode(_mod->getRx(), INPUT);
// initialize configuration variables (will be overwritten during public settings configuration)
_br = 21333; // 48.0 kbps
@ -374,10 +372,6 @@ void SX126x::setDio1Action(void (*func)(void)) {
attachInterrupt(digitalPinToInterrupt(_mod->getInt0()), func, RISING);
}
void SX126x::setDio2Action(void (*func)(void)) {
attachInterrupt(digitalPinToInterrupt(_mod->getInt1()), func, RISING);
}
int16_t SX126x::startTransmit(uint8_t* data, size_t len, uint8_t addr) {
// suppress unused variable warning
(void)addr;
@ -443,7 +437,7 @@ int16_t SX126x::startTransmit(uint8_t* data, size_t len, uint8_t addr) {
}
// wait for BUSY to go low (= PA ramp up done)
while(digitalRead(_mod->getRx()));
while(digitalRead(_mod->getInt1()));
return(state);
}
@ -1400,9 +1394,8 @@ int16_t SX126x::config(uint8_t modem) {
}
// wait for calibration completion
//delayMicroseconds(1);
delay(5);
while(digitalRead(_mod->getRx()));
while(digitalRead(_mod->getInt1()));
return(ERR_NONE);
}
@ -1438,7 +1431,7 @@ int16_t SX126x::SPItransfer(uint8_t* cmd, uint8_t cmdLen, bool write, uint8_t* d
// ensure BUSY is low (state meachine ready)
RADIOLIB_VERBOSE_PRINTLN(F("Wait for BUSY ... "));
uint32_t start = millis();
while(digitalRead(_mod->getRx())) {
while(digitalRead(_mod->getInt1())) {
if(millis() - start >= timeout) {
return(ERR_SPI_CMD_TIMEOUT);
}
@ -1505,7 +1498,7 @@ int16_t SX126x::SPItransfer(uint8_t* cmd, uint8_t cmdLen, bool write, uint8_t* d
if(waitForBusy) {
delayMicroseconds(1);
start = millis();
while(digitalRead(_mod->getRx())) {
while(digitalRead(_mod->getInt1())) {
if(millis() - start >= timeout) {
status = SX126X_STATUS_CMD_TIMEOUT;
break;

View file

@ -476,13 +476,6 @@ class SX126x: public PhysicalLayer {
*/
void setDio1Action(void (*func)(void));
/*!
\brief Sets interrupt service routine to call when DIO2 activates.
\param func ISR to call.
*/
void setDio2Action(void (*func)(void));
/*!
\brief Interrupt-driven binary transmit method.
Overloads for string-based transmissions are implemented in PhysicalLayer.