[SX126x] Fixed warnings
This commit is contained in:
parent
10bda6ceab
commit
9f68933d0c
1 changed files with 14 additions and 2 deletions
|
@ -308,6 +308,9 @@ void SX126x::setDio2Action(void (*func)(void)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t SX126x::startTransmit(uint8_t* data, size_t len, uint8_t addr) {
|
int16_t SX126x::startTransmit(uint8_t* data, size_t len, uint8_t addr) {
|
||||||
|
// suppress unused variable warning
|
||||||
|
(void)addr;
|
||||||
|
|
||||||
// set packet Length
|
// set packet Length
|
||||||
uint8_t modem = getPacketType();
|
uint8_t modem = getPacketType();
|
||||||
if(modem == SX126X_PACKET_TYPE_LORA) {
|
if(modem == SX126X_PACKET_TYPE_LORA) {
|
||||||
|
@ -1025,8 +1028,9 @@ void SX126x::SPIreadCommand(uint8_t cmd, uint8_t* data, uint8_t numBytes, bool w
|
||||||
}
|
}
|
||||||
|
|
||||||
void SX126x::SPItransfer(uint8_t cmd, bool write, uint8_t* dataOut, uint8_t* dataIn, uint8_t numBytes, bool waitForBusy) {
|
void SX126x::SPItransfer(uint8_t cmd, bool write, uint8_t* dataOut, uint8_t* dataIn, uint8_t numBytes, bool waitForBusy) {
|
||||||
// get pointer to used SPI interface
|
// get pointer to used SPI interface and the settings
|
||||||
SPIClass* spi = _mod->getSpi();
|
SPIClass* spi = _mod->getSpi();
|
||||||
|
SPISettings spiSettings = _mod->getSpiSettings();
|
||||||
|
|
||||||
// ensure BUSY is low (state meachine ready)
|
// ensure BUSY is low (state meachine ready)
|
||||||
// TODO timeout
|
// TODO timeout
|
||||||
|
@ -1034,7 +1038,7 @@ void SX126x::SPItransfer(uint8_t cmd, bool write, uint8_t* dataOut, uint8_t* dat
|
||||||
|
|
||||||
// start transfer
|
// start transfer
|
||||||
digitalWrite(_mod->getCs(), LOW);
|
digitalWrite(_mod->getCs(), LOW);
|
||||||
spi->beginTransaction(SPISettings(2000000, MSBFIRST, SPI_MODE0));
|
spi->beginTransaction(spiSettings);
|
||||||
|
|
||||||
// send command byte
|
// send command byte
|
||||||
spi->transfer(cmd);
|
spi->transfer(cmd);
|
||||||
|
@ -1044,7 +1048,11 @@ void SX126x::SPItransfer(uint8_t cmd, bool write, uint8_t* dataOut, uint8_t* dat
|
||||||
// send/receive all bytes
|
// send/receive all bytes
|
||||||
if(write) {
|
if(write) {
|
||||||
for(uint8_t n = 0; n < numBytes; n++) {
|
for(uint8_t n = 0; n < numBytes; n++) {
|
||||||
|
#ifdef RADIOLIB_DEBUG
|
||||||
uint8_t in = spi->transfer(dataOut[n]);
|
uint8_t in = spi->transfer(dataOut[n]);
|
||||||
|
#else
|
||||||
|
spi->transfer(dataOut[n]);
|
||||||
|
#endif
|
||||||
DEBUG_PRINT(dataOut[n], HEX);
|
DEBUG_PRINT(dataOut[n], HEX);
|
||||||
DEBUG_PRINT('\t');
|
DEBUG_PRINT('\t');
|
||||||
DEBUG_PRINT(in, HEX);
|
DEBUG_PRINT(in, HEX);
|
||||||
|
@ -1053,7 +1061,11 @@ void SX126x::SPItransfer(uint8_t cmd, bool write, uint8_t* dataOut, uint8_t* dat
|
||||||
DEBUG_PRINTLN();
|
DEBUG_PRINTLN();
|
||||||
} else {
|
} else {
|
||||||
// skip the first byte for read-type commands (status-only)
|
// skip the first byte for read-type commands (status-only)
|
||||||
|
#ifdef RADIOLIB_DEBUG
|
||||||
uint8_t in = spi->transfer(SX126X_CMD_NOP);
|
uint8_t in = spi->transfer(SX126X_CMD_NOP);
|
||||||
|
#else
|
||||||
|
spi->transfer(SX126X_CMD_NOP);
|
||||||
|
#endif
|
||||||
DEBUG_PRINT(SX126X_CMD_NOP, HEX);
|
DEBUG_PRINT(SX126X_CMD_NOP, HEX);
|
||||||
DEBUG_PRINT('\t');
|
DEBUG_PRINT('\t');
|
||||||
DEBUG_PRINT(in, HEX);
|
DEBUG_PRINT(in, HEX);
|
||||||
|
|
Loading…
Add table
Reference in a new issue