[SX128x] Added finishTransmit
This commit is contained in:
parent
8a81a7c827
commit
0b5cd51828
3 changed files with 22 additions and 10 deletions
|
@ -110,6 +110,11 @@ void loop() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// clean up after transmission is finished
|
||||||
|
// this will ensure transmitter is disabled,
|
||||||
|
// RF switch is powered down etc.
|
||||||
|
radio.finishTransmit();
|
||||||
|
|
||||||
// wait a second before transmitting again
|
// wait a second before transmitting again
|
||||||
delay(1000);
|
delay(1000);
|
||||||
|
|
||||||
|
|
|
@ -300,20 +300,12 @@ int16_t SX128x::transmit(uint8_t* data, size_t len, uint8_t addr) {
|
||||||
while(!_mod->digitalRead(_mod->getIrq())) {
|
while(!_mod->digitalRead(_mod->getIrq())) {
|
||||||
_mod->yield();
|
_mod->yield();
|
||||||
if(_mod->micros() - start > timeout) {
|
if(_mod->micros() - start > timeout) {
|
||||||
clearIrqStatus();
|
finishTransmit();
|
||||||
standby();
|
|
||||||
return(RADIOLIB_ERR_TX_TIMEOUT);
|
return(RADIOLIB_ERR_TX_TIMEOUT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// clear interrupt flags
|
return(finishTransmit());
|
||||||
state = clearIrqStatus();
|
|
||||||
RADIOLIB_ASSERT(state);
|
|
||||||
|
|
||||||
// set mode to standby to disable transmitter
|
|
||||||
state = standby();
|
|
||||||
|
|
||||||
return(state);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t SX128x::receive(uint8_t* data, size_t len) {
|
int16_t SX128x::receive(uint8_t* data, size_t len) {
|
||||||
|
@ -522,6 +514,14 @@ int16_t SX128x::startTransmit(uint8_t* data, size_t len, uint8_t addr) {
|
||||||
return(state);
|
return(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int16_t SX128x::finishTransmit() {
|
||||||
|
// clear interrupt flags
|
||||||
|
clearIrqStatus();
|
||||||
|
|
||||||
|
// set mode to standby to disable transmitter/RF switch
|
||||||
|
return(standby());
|
||||||
|
}
|
||||||
|
|
||||||
int16_t SX128x::startReceive(uint16_t timeout) {
|
int16_t SX128x::startReceive(uint16_t timeout) {
|
||||||
// check active modem
|
// check active modem
|
||||||
if(getPacketType() == RADIOLIB_SX128X_PACKET_TYPE_RANGING) {
|
if(getPacketType() == RADIOLIB_SX128X_PACKET_TYPE_RANGING) {
|
||||||
|
|
|
@ -553,6 +553,13 @@ class SX128x: public PhysicalLayer {
|
||||||
*/
|
*/
|
||||||
int16_t startTransmit(uint8_t* data, size_t len, uint8_t addr = 0) override;
|
int16_t startTransmit(uint8_t* data, size_t len, uint8_t addr = 0) override;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\brief Clean up after transmission is done.
|
||||||
|
|
||||||
|
\returns \ref status_codes
|
||||||
|
*/
|
||||||
|
int16_t finishTransmit() override;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Interrupt-driven receive method. DIO1 will be activated when full packet is received.
|
\brief Interrupt-driven receive method. DIO1 will be activated when full packet is received.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue