[SX126x] Added module presence check (#48)
This commit is contained in:
parent
eb4fbe9a3d
commit
5cf9c50b01
1 changed files with 9 additions and 4 deletions
|
@ -1297,7 +1297,8 @@ int16_t SX126x::SPItransfer(uint8_t* cmd, uint8_t cmdLen, bool write, uint8_t* d
|
||||||
// check status
|
// check status
|
||||||
if(((in & 0b00001110) == SX126X_STATUS_CMD_TIMEOUT) ||
|
if(((in & 0b00001110) == SX126X_STATUS_CMD_TIMEOUT) ||
|
||||||
((in & 0b00001110) == SX126X_STATUS_CMD_INVALID) ||
|
((in & 0b00001110) == SX126X_STATUS_CMD_INVALID) ||
|
||||||
((in & 0b00001110) == SX126X_STATUS_CMD_FAILED)) {
|
((in & 0b00001110) == SX126X_STATUS_CMD_FAILED) ||
|
||||||
|
in == 0x00 || in == 0xFF) {
|
||||||
status = in;
|
status = in;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1313,7 +1314,8 @@ int16_t SX126x::SPItransfer(uint8_t* cmd, uint8_t cmdLen, bool write, uint8_t* d
|
||||||
// check status
|
// check status
|
||||||
if(((in & 0b00001110) == SX126X_STATUS_CMD_TIMEOUT) ||
|
if(((in & 0b00001110) == SX126X_STATUS_CMD_TIMEOUT) ||
|
||||||
((in & 0b00001110) == SX126X_STATUS_CMD_INVALID) ||
|
((in & 0b00001110) == SX126X_STATUS_CMD_INVALID) ||
|
||||||
((in & 0b00001110) == SX126X_STATUS_CMD_FAILED)) {
|
((in & 0b00001110) == SX126X_STATUS_CMD_FAILED) ||
|
||||||
|
in == 0x00 || in == 0xFF) {
|
||||||
status = in;
|
status = in;
|
||||||
}
|
}
|
||||||
for(uint8_t n = 0; n < numBytes; n++) {
|
for(uint8_t n = 0; n < numBytes; n++) {
|
||||||
|
@ -1349,6 +1351,9 @@ int16_t SX126x::SPItransfer(uint8_t* cmd, uint8_t cmdLen, bool write, uint8_t* d
|
||||||
return(ERR_SPI_CMD_INVALID);
|
return(ERR_SPI_CMD_INVALID);
|
||||||
case SX126X_STATUS_CMD_FAILED:
|
case SX126X_STATUS_CMD_FAILED:
|
||||||
return(ERR_SPI_CMD_FAILED);
|
return(ERR_SPI_CMD_FAILED);
|
||||||
|
case(0x00):
|
||||||
|
case(0xFF):
|
||||||
|
return(ERR_CHIP_NOT_FOUND);
|
||||||
default:
|
default:
|
||||||
return(ERR_NONE);
|
return(ERR_NONE);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue