[SX126x] Skip SPI verification during block calibration (#583)
This commit is contained in:
parent
f6e5d02481
commit
170ce9752b
2 changed files with 25 additions and 13 deletions
|
@ -1617,7 +1617,7 @@ int16_t SX126x::config(uint8_t modem) {
|
|||
|
||||
// calibrate all blocks
|
||||
data[0] = RADIOLIB_SX126X_CALIBRATE_ALL;
|
||||
state = SPIwriteCommand(RADIOLIB_SX126X_CMD_CALIBRATE, data, 1);
|
||||
state = SPIwriteCommand(RADIOLIB_SX126X_CMD_CALIBRATE, data, 1, true, false);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
// wait for calibration completion
|
||||
|
@ -1662,43 +1662,55 @@ int16_t SX126x::checkCommandResult() {
|
|||
return(state);
|
||||
}
|
||||
|
||||
int16_t SX126x::SPIwriteCommand(uint8_t* cmd, uint8_t cmdLen, uint8_t* data, uint8_t numBytes, bool waitForBusy) {
|
||||
int16_t SX126x::SPIwriteCommand(uint8_t* cmd, uint8_t cmdLen, uint8_t* data, uint8_t numBytes, bool waitForBusy, bool verify) {
|
||||
// send the command
|
||||
int16_t state = SX126x::SPItransfer(cmd, cmdLen, true, data, NULL, numBytes, waitForBusy);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
// check the status
|
||||
state = checkCommandResult();
|
||||
if(verify) {
|
||||
state = checkCommandResult();
|
||||
}
|
||||
|
||||
return(state);
|
||||
}
|
||||
|
||||
int16_t SX126x::SPIwriteCommand(uint8_t cmd, uint8_t* data, uint8_t numBytes, bool waitForBusy) {
|
||||
int16_t SX126x::SPIwriteCommand(uint8_t cmd, uint8_t* data, uint8_t numBytes, bool waitForBusy, bool verify) {
|
||||
// send the command
|
||||
int16_t state = SX126x::SPItransfer(&cmd, 1, true, data, NULL, numBytes, waitForBusy);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
// check the status
|
||||
state = checkCommandResult();
|
||||
if(verify) {
|
||||
state = checkCommandResult();
|
||||
}
|
||||
|
||||
return(state);
|
||||
}
|
||||
|
||||
int16_t SX126x::SPIreadCommand(uint8_t* cmd, uint8_t cmdLen, uint8_t* data, uint8_t numBytes, bool waitForBusy) {
|
||||
int16_t SX126x::SPIreadCommand(uint8_t* cmd, uint8_t cmdLen, uint8_t* data, uint8_t numBytes, bool waitForBusy, bool verify) {
|
||||
// send the command
|
||||
int16_t state = SX126x::SPItransfer(cmd, cmdLen, false, NULL, data, numBytes, waitForBusy);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
// check the status
|
||||
state = checkCommandResult();
|
||||
if(verify) {
|
||||
state = checkCommandResult();
|
||||
}
|
||||
|
||||
return(state);
|
||||
}
|
||||
|
||||
int16_t SX126x::SPIreadCommand(uint8_t cmd, uint8_t* data, uint8_t numBytes, bool waitForBusy) {
|
||||
int16_t SX126x::SPIreadCommand(uint8_t cmd, uint8_t* data, uint8_t numBytes, bool waitForBusy, bool verify) {
|
||||
// send the command
|
||||
int16_t state = SX126x::SPItransfer(&cmd, 1, false, NULL, data, numBytes, waitForBusy);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
// check the status
|
||||
state = checkCommandResult();
|
||||
if(verify) {
|
||||
state = checkCommandResult();
|
||||
}
|
||||
|
||||
return(state);
|
||||
}
|
||||
|
||||
|
|
|
@ -1005,10 +1005,10 @@ class SX126x: public PhysicalLayer {
|
|||
Module* _mod;
|
||||
|
||||
// common low-level SPI interface
|
||||
int16_t SPIwriteCommand(uint8_t cmd, uint8_t* data, uint8_t numBytes, bool waitForBusy = true);
|
||||
int16_t SPIwriteCommand(uint8_t* cmd, uint8_t cmdLen, uint8_t* data, uint8_t numBytes, bool waitForBusy = true);
|
||||
int16_t SPIreadCommand(uint8_t cmd, uint8_t* data, uint8_t numBytes, bool waitForBusy = true);
|
||||
int16_t SPIreadCommand(uint8_t* cmd, uint8_t cmdLen, uint8_t* data, uint8_t numBytes, bool waitForBusy = true);
|
||||
int16_t SPIwriteCommand(uint8_t cmd, uint8_t* data, uint8_t numBytes, bool waitForBusy = true, bool verify = true);
|
||||
int16_t SPIwriteCommand(uint8_t* cmd, uint8_t cmdLen, uint8_t* data, uint8_t numBytes, bool waitForBusy = true, bool verify = true);
|
||||
int16_t SPIreadCommand(uint8_t cmd, uint8_t* data, uint8_t numBytes, bool waitForBusy = true, bool verify = true);
|
||||
int16_t SPIreadCommand(uint8_t* cmd, uint8_t cmdLen, uint8_t* data, uint8_t numBytes, bool waitForBusy = true, bool verify = true);
|
||||
int16_t SPItransfer(uint8_t* cmd, uint8_t cmdLen, bool write, uint8_t* dataOut, uint8_t* dataIn, uint8_t numBytes, bool waitForBusy, uint32_t timeout = 5000);
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE)
|
||||
|
|
Loading…
Add table
Reference in a new issue