[MOD] Added option to use SX126x without GPIO
This commit is contained in:
parent
efbec6b9d1
commit
6d54ea65db
1 changed files with 21 additions and 13 deletions
|
@ -246,6 +246,9 @@ int16_t Module::SPItransferStream(uint8_t* cmd, uint8_t cmdLen, bool write, uint
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ensure GPIO is low
|
// ensure GPIO is low
|
||||||
|
if(this->gpioPin == RADIOLIB_NC) {
|
||||||
|
this->hal->delay(1);
|
||||||
|
} else {
|
||||||
uint32_t start = this->hal->millis();
|
uint32_t start = this->hal->millis();
|
||||||
while(this->hal->digitalRead(this->gpioPin)) {
|
while(this->hal->digitalRead(this->gpioPin)) {
|
||||||
this->hal->yield();
|
this->hal->yield();
|
||||||
|
@ -254,6 +257,7 @@ int16_t Module::SPItransferStream(uint8_t* cmd, uint8_t cmdLen, bool write, uint
|
||||||
return(RADIOLIB_ERR_SPI_CMD_TIMEOUT);
|
return(RADIOLIB_ERR_SPI_CMD_TIMEOUT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// pull NSS low
|
// pull NSS low
|
||||||
this->hal->digitalWrite(this->csPin, this->hal->GpioLevelLow);
|
this->hal->digitalWrite(this->csPin, this->hal->GpioLevelLow);
|
||||||
|
@ -312,6 +316,9 @@ int16_t Module::SPItransferStream(uint8_t* cmd, uint8_t cmdLen, bool write, uint
|
||||||
|
|
||||||
// wait for GPIO to go high and then low
|
// wait for GPIO to go high and then low
|
||||||
if(waitForGpio) {
|
if(waitForGpio) {
|
||||||
|
if(this->gpioPin == RADIOLIB_NC) {
|
||||||
|
this->hal->delay(1);
|
||||||
|
} else {
|
||||||
this->hal->delayMicroseconds(1);
|
this->hal->delayMicroseconds(1);
|
||||||
uint32_t start = this->hal->millis();
|
uint32_t start = this->hal->millis();
|
||||||
while(this->hal->digitalRead(this->gpioPin)) {
|
while(this->hal->digitalRead(this->gpioPin)) {
|
||||||
|
@ -322,6 +329,7 @@ int16_t Module::SPItransferStream(uint8_t* cmd, uint8_t cmdLen, bool write, uint
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// print debug output
|
// print debug output
|
||||||
#if defined(RADIOLIB_VERBOSE)
|
#if defined(RADIOLIB_VERBOSE)
|
||||||
|
|
Loading…
Add table
Reference in a new issue