[PHY] Make transmit data const (#1156)

This commit is contained in:
jgromes 2024-07-13 16:42:46 +01:00
parent a93dd1af91
commit fffb1fae9f
18 changed files with 46 additions and 47 deletions

View file

@ -98,7 +98,7 @@ void CC1101::reset() {
SPIsendCommand(RADIOLIB_CC1101_CMD_RESET); SPIsendCommand(RADIOLIB_CC1101_CMD_RESET);
} }
int16_t CC1101::transmit(uint8_t* data, size_t len, uint8_t addr) { int16_t CC1101::transmit(const uint8_t* data, size_t len, uint8_t addr) {
// calculate timeout (5ms + 500 % of expected time-on-air) // calculate timeout (5ms + 500 % of expected time-on-air)
RadioLibTime_t timeout = 5 + (RadioLibTime_t)((((float)(len * 8)) / this->bitRate) * 5); RadioLibTime_t timeout = 5 + (RadioLibTime_t)((((float)(len * 8)) / this->bitRate) * 5);
@ -289,7 +289,7 @@ void CC1101::clearGdo2Action() {
this->mod->hal->detachInterrupt(this->mod->hal->pinToInterrupt(this->mod->getGpio())); this->mod->hal->detachInterrupt(this->mod->hal->pinToInterrupt(this->mod->getGpio()));
} }
int16_t CC1101::startTransmit(uint8_t* data, size_t len, uint8_t addr) { int16_t CC1101::startTransmit(const uint8_t* data, size_t len, uint8_t addr) {
// check packet length // check packet length
if(len > RADIOLIB_CC1101_MAX_PACKET_LENGTH) { if(len > RADIOLIB_CC1101_MAX_PACKET_LENGTH) {
return(RADIOLIB_ERR_PACKET_TOO_LONG); return(RADIOLIB_ERR_PACKET_TOO_LONG);
@ -317,7 +317,7 @@ int16_t CC1101::startTransmit(uint8_t* data, size_t len, uint8_t addr) {
} }
// fill the FIFO // fill the FIFO
SPIwriteRegisterBurst(RADIOLIB_CC1101_REG_FIFO, data, len); SPIwriteRegisterBurst(RADIOLIB_CC1101_REG_FIFO, const_cast<uint8_t*>(data), len);
// set RF switch (if present) // set RF switch (if present)
this->mod->setRfSwitchState(Module::MODE_TX); this->mod->setRfSwitchState(Module::MODE_TX);

View file

@ -575,7 +575,7 @@ class CC1101: public PhysicalLayer {
\param addr Address to send the data to. Will only be added if address filtering was enabled. \param addr Address to send the data to. Will only be added if address filtering was enabled.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t transmit(uint8_t* data, size_t len, uint8_t addr = 0) override; int16_t transmit(const uint8_t* data, size_t len, uint8_t addr = 0) override;
/*! /*!
\brief Blocking binary receive method. \brief Blocking binary receive method.
@ -687,7 +687,7 @@ class CC1101: public PhysicalLayer {
\param addr Address to send the data to. Will only be added if address filtering was enabled. \param addr Address to send the data to. Will only be added if address filtering was enabled.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t startTransmit(uint8_t* data, size_t len, uint8_t addr = 0) override; int16_t startTransmit(const uint8_t* data, size_t len, uint8_t addr = 0) override;
/*! /*!
\brief Clean up after transmission is done. \brief Clean up after transmission is done.

View file

@ -130,7 +130,7 @@ int16_t LR11x0::reset() {
return(RADIOLIB_ERR_NONE); return(RADIOLIB_ERR_NONE);
} }
int16_t LR11x0::transmit(uint8_t* data, size_t len, uint8_t addr) { int16_t LR11x0::transmit(const uint8_t* data, size_t len, uint8_t addr) {
// set mode to standby // set mode to standby
int16_t state = standby(); int16_t state = standby();
RADIOLIB_ASSERT(state); RADIOLIB_ASSERT(state);
@ -363,7 +363,7 @@ void LR11x0::clearPacketSentAction() {
this->clearIrqAction(); this->clearIrqAction();
} }
int16_t LR11x0::startTransmit(uint8_t* data, size_t len, uint8_t addr) { int16_t LR11x0::startTransmit(const uint8_t* data, size_t len, uint8_t addr) {
// suppress unused variable warning // suppress unused variable warning
(void)addr; (void)addr;
@ -401,12 +401,12 @@ int16_t LR11x0::startTransmit(uint8_t* data, size_t len, uint8_t addr) {
if(modem == RADIOLIB_LR11X0_PACKET_TYPE_LR_FHSS) { if(modem == RADIOLIB_LR11X0_PACKET_TYPE_LR_FHSS) {
// in LR-FHSS mode, the packet is built by the device // in LR-FHSS mode, the packet is built by the device
// TODO add configurable grid step and device offset // TODO add configurable grid step and device offset
state = lrFhssBuildFrame(this->lrFhssHdrCount, this->lrFhssCr, RADIOLIB_LR11X0_LR_FHSS_GRID_STEP_FCC, true, this->lrFhssBw, this->lrFhssHopSeq, 0, data, len); state = lrFhssBuildFrame(this->lrFhssHdrCount, this->lrFhssCr, RADIOLIB_LR11X0_LR_FHSS_GRID_STEP_FCC, true, this->lrFhssBw, this->lrFhssHopSeq, 0, const_cast<uint8_t*>(data), len);
RADIOLIB_ASSERT(state); RADIOLIB_ASSERT(state);
} else { } else {
// write packet to buffer // write packet to buffer
state = writeBuffer8(data, len); state = writeBuffer8(const_cast<uint8_t*>(data), len);
RADIOLIB_ASSERT(state); RADIOLIB_ASSERT(state);
} }

View file

@ -797,7 +797,7 @@ class LR11x0: public PhysicalLayer {
\param addr Address to send the data to. Will only be added if address filtering was enabled. \param addr Address to send the data to. Will only be added if address filtering was enabled.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t transmit(uint8_t* data, size_t len, uint8_t addr = 0) override; int16_t transmit(const uint8_t* data, size_t len, uint8_t addr = 0) override;
/*! /*!
\brief Blocking binary receive method. \brief Blocking binary receive method.
@ -911,7 +911,7 @@ class LR11x0: public PhysicalLayer {
\param addr Address to send the data to. Will only be added if address filtering was enabled. \param addr Address to send the data to. Will only be added if address filtering was enabled.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t startTransmit(uint8_t* data, size_t len, uint8_t addr = 0) override; int16_t startTransmit(const uint8_t* data, size_t len, uint8_t addr = 0) override;
/*! /*!
\brief Clean up after transmission is done. \brief Clean up after transmission is done.

View file

@ -98,7 +98,7 @@ void RF69::reset() {
this->mod->hal->delay(10); this->mod->hal->delay(10);
} }
int16_t RF69::transmit(uint8_t* data, size_t len, uint8_t addr) { int16_t RF69::transmit(const uint8_t* data, size_t len, uint8_t addr) {
// calculate timeout (5ms + 500 % of expected time-on-air) // calculate timeout (5ms + 500 % of expected time-on-air)
RadioLibTime_t timeout = 5 + (RadioLibTime_t)((((float)(len * 8)) / this->bitRate) * 5); RadioLibTime_t timeout = 5 + (RadioLibTime_t)((((float)(len * 8)) / this->bitRate) * 5);
@ -380,7 +380,7 @@ bool RF69::fifoGet(volatile uint8_t* data, int totalLen, volatile int* rcvLen) {
return(false); return(false);
} }
int16_t RF69::startTransmit(uint8_t* data, size_t len, uint8_t addr) { int16_t RF69::startTransmit(const uint8_t* data, size_t len, uint8_t addr) {
// set mode to standby // set mode to standby
int16_t state = setMode(RADIOLIB_RF69_STANDBY); int16_t state = setMode(RADIOLIB_RF69_STANDBY);
RADIOLIB_ASSERT(state); RADIOLIB_ASSERT(state);
@ -413,7 +413,7 @@ int16_t RF69::startTransmit(uint8_t* data, size_t len, uint8_t addr) {
packetLen = RADIOLIB_RF69_FIFO_THRESH - 1; packetLen = RADIOLIB_RF69_FIFO_THRESH - 1;
this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_FIFO_THRESH, RADIOLIB_RF69_TX_START_CONDITION_FIFO_NOT_EMPTY, 7, 7); this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_FIFO_THRESH, RADIOLIB_RF69_TX_START_CONDITION_FIFO_NOT_EMPTY, 7, 7);
} }
this->mod->SPIwriteRegisterBurst(RADIOLIB_RF69_REG_FIFO, data, packetLen); this->mod->SPIwriteRegisterBurst(RADIOLIB_RF69_REG_FIFO, const_cast<uint8_t*>(data), packetLen);
// this is a hack, but it seems than in Stream mode, Rx FIFO level is getting triggered 1 byte before it should // this is a hack, but it seems than in Stream mode, Rx FIFO level is getting triggered 1 byte before it should
// just add a padding byte that can be dropped without consequence // just add a padding byte that can be dropped without consequence

View file

@ -523,7 +523,7 @@ class RF69: public PhysicalLayer {
\param addr Address to send the data to. Will only be added if address filtering was enabled. \param addr Address to send the data to. Will only be added if address filtering was enabled.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t transmit(uint8_t* data, size_t len, uint8_t addr = 0) override; int16_t transmit(const uint8_t* data, size_t len, uint8_t addr = 0) override;
/*! /*!
\brief Blocking binary receive method. \brief Blocking binary receive method.
@ -685,7 +685,7 @@ class RF69: public PhysicalLayer {
\param addr Address to send the data to. Will only be added if address filtering was enabled. \param addr Address to send the data to. Will only be added if address filtering was enabled.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t startTransmit(uint8_t* data, size_t len, uint8_t addr = 0) override; int16_t startTransmit(const uint8_t* data, size_t len, uint8_t addr = 0) override;
/*! /*!
\brief Clean up after transmission is done. \brief Clean up after transmission is done.

View file

@ -228,7 +228,7 @@ int16_t SX126x::reset(bool verify) {
} }
} }
int16_t SX126x::transmit(uint8_t* data, size_t len, uint8_t addr) { int16_t SX126x::transmit(const uint8_t* data, size_t len, uint8_t addr) {
// set mode to standby // set mode to standby
int16_t state = standby(); int16_t state = standby();
RADIOLIB_ASSERT(state); RADIOLIB_ASSERT(state);
@ -512,8 +512,7 @@ void SX126x::clearChannelScanAction() {
this->clearDio1Action(); this->clearDio1Action();
} }
int16_t SX126x::startTransmit(const 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 // suppress unused variable warning
(void)addr; (void)addr;
@ -548,7 +547,7 @@ int16_t SX126x::startTransmit(uint8_t* data, size_t len, uint8_t addr) {
RADIOLIB_ASSERT(state); RADIOLIB_ASSERT(state);
// write packet to buffer // write packet to buffer
state = writeBuffer(data, len); state = writeBuffer(const_cast<uint8_t*>(data), len);
RADIOLIB_ASSERT(state); RADIOLIB_ASSERT(state);
// clear interrupt flags // clear interrupt flags

View file

@ -506,7 +506,7 @@ class SX126x: public PhysicalLayer {
\param addr Address to send the data to. Will only be added if address filtering was enabled. \param addr Address to send the data to. Will only be added if address filtering was enabled.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t transmit(uint8_t* data, size_t len, uint8_t addr = 0) override; int16_t transmit(const uint8_t* data, size_t len, uint8_t addr = 0) override;
/*! /*!
\brief Blocking binary receive method. \brief Blocking binary receive method.
@ -630,7 +630,7 @@ class SX126x: public PhysicalLayer {
\param addr Address to send the data to. Will only be added if address filtering was enabled. \param addr Address to send the data to. Will only be added if address filtering was enabled.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t startTransmit(uint8_t* data, size_t len, uint8_t addr = 0) override; int16_t startTransmit(const uint8_t* data, size_t len, uint8_t addr = 0) override;
/*! /*!
\brief Clean up after transmission is done. \brief Clean up after transmission is done.

View file

@ -141,7 +141,7 @@ int16_t SX127x::beginFSK(uint8_t* chipVersions, uint8_t numVersions, float freqD
return(state); return(state);
} }
int16_t SX127x::transmit(uint8_t* data, size_t len, uint8_t addr) { int16_t SX127x::transmit(const uint8_t* data, size_t len, uint8_t addr) {
// set mode to standby // set mode to standby
int16_t state = setMode(RADIOLIB_SX127X_STANDBY); int16_t state = setMode(RADIOLIB_SX127X_STANDBY);
RADIOLIB_ASSERT(state); RADIOLIB_ASSERT(state);
@ -549,7 +549,7 @@ bool SX127x::fifoGet(volatile uint8_t* data, int totalLen, volatile int* rcvLen)
return(false); return(false);
} }
int16_t SX127x::startTransmit(uint8_t* data, size_t len, uint8_t addr) { int16_t SX127x::startTransmit(const uint8_t* data, size_t len, uint8_t addr) {
// set mode to standby // set mode to standby
int16_t state = setMode(RADIOLIB_SX127X_STANDBY); int16_t state = setMode(RADIOLIB_SX127X_STANDBY);
@ -609,7 +609,7 @@ int16_t SX127x::startTransmit(uint8_t* data, size_t len, uint8_t addr) {
packetLen = RADIOLIB_SX127X_FIFO_THRESH - 1; packetLen = RADIOLIB_SX127X_FIFO_THRESH - 1;
this->mod->SPIsetRegValue(RADIOLIB_SX127X_REG_FIFO_THRESH, RADIOLIB_SX127X_TX_START_FIFO_NOT_EMPTY, 7, 7); this->mod->SPIsetRegValue(RADIOLIB_SX127X_REG_FIFO_THRESH, RADIOLIB_SX127X_TX_START_FIFO_NOT_EMPTY, 7, 7);
} }
this->mod->SPIwriteRegisterBurst(RADIOLIB_SX127X_REG_FIFO, data, packetLen); this->mod->SPIwriteRegisterBurst(RADIOLIB_SX127X_REG_FIFO, const_cast<uint8_t*>(data), packetLen);
// set RF switch (if present) // set RF switch (if present)
this->mod->setRfSwitchState(Module::MODE_TX); this->mod->setRfSwitchState(Module::MODE_TX);

View file

@ -633,7 +633,7 @@ class SX127x: public PhysicalLayer {
\param addr Node address to transmit the packet to. Only used in FSK mode. \param addr Node address to transmit the packet to. Only used in FSK mode.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t transmit(uint8_t* data, size_t len, uint8_t addr = 0) override; int16_t transmit(const uint8_t* data, size_t len, uint8_t addr = 0) override;
/*! /*!
\brief Binary receive method. Will attempt to receive arbitrary binary data up to 255 bytes long using %LoRa or up to 63 bytes using FSK modem. \brief Binary receive method. Will attempt to receive arbitrary binary data up to 255 bytes long using %LoRa or up to 63 bytes using FSK modem.
@ -797,7 +797,7 @@ class SX127x: public PhysicalLayer {
\param addr Node address to transmit the packet to. Only used in FSK mode. \param addr Node address to transmit the packet to. Only used in FSK mode.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t startTransmit(uint8_t* data, size_t len, uint8_t addr = 0) override; int16_t startTransmit(const uint8_t* data, size_t len, uint8_t addr = 0) override;
/*! /*!
\brief Clean up after transmission is done. \brief Clean up after transmission is done.

View file

@ -301,7 +301,7 @@ int16_t SX128x::reset(bool verify) {
} }
} }
int16_t SX128x::transmit(uint8_t* data, size_t len, uint8_t addr) { int16_t SX128x::transmit(const uint8_t* data, size_t len, uint8_t addr) {
// check packet length // check packet length
if(len > RADIOLIB_SX128X_MAX_PACKET_LENGTH) { if(len > RADIOLIB_SX128X_MAX_PACKET_LENGTH) {
return(RADIOLIB_ERR_PACKET_TOO_LONG); return(RADIOLIB_ERR_PACKET_TOO_LONG);
@ -485,7 +485,7 @@ void SX128x::clearPacketSentAction() {
this->clearDio1Action(); this->clearDio1Action();
} }
int16_t SX128x::startTransmit(uint8_t* data, size_t len, uint8_t addr) { int16_t SX128x::startTransmit(const uint8_t* data, size_t len, uint8_t addr) {
// suppress unused variable warning // suppress unused variable warning
(void)addr; (void)addr;
@ -519,10 +519,10 @@ int16_t SX128x::startTransmit(uint8_t* data, size_t len, uint8_t addr) {
// write packet to buffer // write packet to buffer
if(modem == RADIOLIB_SX128X_PACKET_TYPE_BLE) { if(modem == RADIOLIB_SX128X_PACKET_TYPE_BLE) {
// first 2 bytes of BLE payload are PDU header // first 2 bytes of BLE payload are PDU header
state = writeBuffer(data, len, 2); state = writeBuffer(const_cast<uint8_t*>(data), len, 2);
RADIOLIB_ASSERT(state); RADIOLIB_ASSERT(state);
} else { } else {
state = writeBuffer(data, len); state = writeBuffer(const_cast<uint8_t*>(data), len);
RADIOLIB_ASSERT(state); RADIOLIB_ASSERT(state);
} }

View file

@ -426,7 +426,7 @@ class SX128x: public PhysicalLayer {
\param addr Address to send the data to. Unsupported, compatibility only. \param addr Address to send the data to. Unsupported, compatibility only.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t transmit(uint8_t* data, size_t len, uint8_t addr = 0) override; int16_t transmit(const uint8_t* data, size_t len, uint8_t addr = 0) override;
/*! /*!
\brief Blocking binary receive method. \brief Blocking binary receive method.
@ -530,7 +530,7 @@ class SX128x: public PhysicalLayer {
\param addr Address to send the data to. Unsupported, compatibility only. \param addr Address to send the data to. Unsupported, compatibility only.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t startTransmit(uint8_t* data, size_t len, uint8_t addr = 0) override; int16_t startTransmit(const uint8_t* data, size_t len, uint8_t addr = 0) override;
/*! /*!
\brief Clean up after transmission is done. \brief Clean up after transmission is done.

View file

@ -71,7 +71,7 @@ void Si443x::reset() {
this->mod->hal->delay(100); this->mod->hal->delay(100);
} }
int16_t Si443x::transmit(uint8_t* data, size_t len, uint8_t addr) { int16_t Si443x::transmit(const uint8_t* data, size_t len, uint8_t addr) {
// calculate timeout (5ms + 500 % of expected time-on-air) // calculate timeout (5ms + 500 % of expected time-on-air)
RadioLibTime_t timeout = 5 + (uint32_t)((((float)(len * 8)) / this->bitRate) * 5); RadioLibTime_t timeout = 5 + (uint32_t)((((float)(len * 8)) / this->bitRate) * 5);
@ -226,7 +226,7 @@ void Si443x::clearPacketSentAction() {
this->clearIrqAction(); this->clearIrqAction();
} }
int16_t Si443x::startTransmit(uint8_t* data, size_t len, uint8_t addr) { int16_t Si443x::startTransmit(const uint8_t* data, size_t len, uint8_t addr) {
// check packet length // check packet length
if(len > RADIOLIB_SI443X_MAX_PACKET_LENGTH) { if(len > RADIOLIB_SI443X_MAX_PACKET_LENGTH) {
return(RADIOLIB_ERR_PACKET_TOO_LONG); return(RADIOLIB_ERR_PACKET_TOO_LONG);
@ -252,7 +252,7 @@ int16_t Si443x::startTransmit(uint8_t* data, size_t len, uint8_t addr) {
(void)addr; (void)addr;
// write packet to FIFO // write packet to FIFO
this->mod->SPIwriteRegisterBurst(RADIOLIB_SI443X_REG_FIFO_ACCESS, data, len); this->mod->SPIwriteRegisterBurst(RADIOLIB_SI443X_REG_FIFO_ACCESS, const_cast<uint8_t*>(data), len);
// set RF switch (if present) // set RF switch (if present)
this->mod->setRfSwitchState(Module::MODE_TX); this->mod->setRfSwitchState(Module::MODE_TX);

View file

@ -591,7 +591,7 @@ class Si443x: public PhysicalLayer {
\param addr Node address to transmit the packet to. \param addr Node address to transmit the packet to.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t transmit(uint8_t* data, size_t len, uint8_t addr = 0) override; int16_t transmit(const uint8_t* data, size_t len, uint8_t addr = 0) override;
/*! /*!
\brief Binary receive method. Will attempt to receive arbitrary binary data up to 64 bytes long. \brief Binary receive method. Will attempt to receive arbitrary binary data up to 64 bytes long.
@ -683,7 +683,7 @@ class Si443x: public PhysicalLayer {
\param addr Node address to transmit the packet to. \param addr Node address to transmit the packet to.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t startTransmit(uint8_t* data, size_t len, uint8_t addr = 0) override; int16_t startTransmit(const uint8_t* data, size_t len, uint8_t addr = 0) override;
/*! /*!
\brief Clean up after transmission is done. \brief Clean up after transmission is done.

View file

@ -82,7 +82,7 @@ int16_t nRF24::standby(uint8_t mode) {
return(this->mod->SPIsetRegValue(RADIOLIB_NRF24_REG_CONFIG, mode, 1, 1)); return(this->mod->SPIsetRegValue(RADIOLIB_NRF24_REG_CONFIG, mode, 1, 1));
} }
int16_t nRF24::transmit(uint8_t* data, size_t len, uint8_t addr) { int16_t nRF24::transmit(const uint8_t* data, size_t len, uint8_t addr) {
// start transmission // start transmission
int16_t state = startTransmit(data, len, addr); int16_t state = startTransmit(data, len, addr);
RADIOLIB_ASSERT(state); RADIOLIB_ASSERT(state);
@ -175,7 +175,7 @@ void nRF24::clearPacketSentAction() {
this->clearIrqAction(); this->clearIrqAction();
} }
int16_t nRF24::startTransmit(uint8_t* data, size_t len, uint8_t addr) { int16_t nRF24::startTransmit(const uint8_t* data, size_t len, uint8_t addr) {
// suppress unused variable warning // suppress unused variable warning
(void)addr; (void)addr;
@ -205,7 +205,7 @@ int16_t nRF24::startTransmit(uint8_t* data, size_t len, uint8_t addr) {
uint8_t buff[32]; uint8_t buff[32];
memset(buff, 0x00, 32); memset(buff, 0x00, 32);
memcpy(buff, data, len); memcpy(buff, data, len);
SPIwriteTxPayload(data, len); SPIwriteTxPayload(const_cast<uint8_t*>(data), len);
// CE high to start transmitting // CE high to start transmitting
this->mod->hal->digitalWrite(this->mod->getRst(), this->mod->hal->GpioLevelHigh); this->mod->hal->digitalWrite(this->mod->getRst(), this->mod->hal->GpioLevelHigh);

View file

@ -238,7 +238,7 @@ class nRF24: public PhysicalLayer {
\param addr Dummy address parameter, to ensure PhysicalLayer compatibility. \param addr Dummy address parameter, to ensure PhysicalLayer compatibility.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t transmit(uint8_t* data, size_t len, uint8_t addr) override; int16_t transmit(const uint8_t* data, size_t len, uint8_t addr) override;
/*! /*!
\brief Blocking binary receive method. \brief Blocking binary receive method.
@ -305,7 +305,7 @@ class nRF24: public PhysicalLayer {
\param addr Dummy address parameter, to ensure PhysicalLayer compatibility. \param addr Dummy address parameter, to ensure PhysicalLayer compatibility.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t startTransmit(uint8_t* data, size_t len, uint8_t addr) override; int16_t startTransmit(const uint8_t* data, size_t len, uint8_t addr) override;
/*! /*!
\brief Clean up after transmission is done. \brief Clean up after transmission is done.

View file

@ -53,7 +53,7 @@ int16_t PhysicalLayer::transmit(const char* str, uint8_t addr) {
return(transmit((uint8_t*)str, strlen(str), addr)); return(transmit((uint8_t*)str, strlen(str), addr));
} }
int16_t PhysicalLayer::transmit(uint8_t* data, size_t len, uint8_t addr) { int16_t PhysicalLayer::transmit(const uint8_t* data, size_t len, uint8_t addr) {
(void)data; (void)data;
(void)len; (void)len;
(void)addr; (void)addr;
@ -150,7 +150,7 @@ int16_t PhysicalLayer::startTransmit(const char* str, uint8_t addr) {
return(startTransmit((uint8_t*)str, strlen(str), addr)); return(startTransmit((uint8_t*)str, strlen(str), addr));
} }
int16_t PhysicalLayer::startTransmit(uint8_t* data, size_t len, uint8_t addr) { int16_t PhysicalLayer::startTransmit(const uint8_t* data, size_t len, uint8_t addr) {
(void)data; (void)data;
(void)len; (void)len;
(void)addr; (void)addr;

View file

@ -98,7 +98,7 @@ class PhysicalLayer {
\param addr Node address to transmit the packet to. Only used in FSK mode. \param addr Node address to transmit the packet to. Only used in FSK mode.
\returns \ref status_codes \returns \ref status_codes
*/ */
virtual int16_t transmit(uint8_t* data, size_t len, uint8_t addr = 0); virtual int16_t transmit(const uint8_t* data, size_t len, uint8_t addr = 0);
#if defined(RADIOLIB_BUILD_ARDUINO) #if defined(RADIOLIB_BUILD_ARDUINO)
/*! /*!
@ -181,7 +181,7 @@ class PhysicalLayer {
\param addr Node address to transmit the packet to. Only used in FSK mode. \param addr Node address to transmit the packet to. Only used in FSK mode.
\returns \ref status_codes \returns \ref status_codes
*/ */
virtual int16_t startTransmit(uint8_t* data, size_t len, uint8_t addr = 0); virtual int16_t startTransmit(const uint8_t* data, size_t len, uint8_t addr = 0);
/*! /*!
\brief Clean up after transmission is done. \brief Clean up after transmission is done.