[RF69] Added finishTransmit
This commit is contained in:
parent
598982c782
commit
8a81a7c827
3 changed files with 23 additions and 10 deletions
|
@ -128,6 +128,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
|
||||
delay(1000);
|
||||
|
||||
|
|
|
@ -125,19 +125,12 @@ int16_t RF69::transmit(uint8_t* data, size_t len, uint8_t addr) {
|
|||
_mod->yield();
|
||||
|
||||
if(_mod->micros() - start > timeout) {
|
||||
standby();
|
||||
clearIRQFlags();
|
||||
finishTransmit();
|
||||
return(RADIOLIB_ERR_TX_TIMEOUT);
|
||||
}
|
||||
}
|
||||
|
||||
// set mode to standby
|
||||
standby();
|
||||
|
||||
// clear interrupt flags
|
||||
clearIRQFlags();
|
||||
|
||||
return(RADIOLIB_ERR_NONE);
|
||||
|
||||
return(finishTransmit());
|
||||
}
|
||||
|
||||
int16_t RF69::receive(uint8_t* data, size_t len) {
|
||||
|
@ -442,6 +435,14 @@ int16_t RF69::startTransmit(uint8_t* data, size_t len, uint8_t addr) {
|
|||
return(state);
|
||||
}
|
||||
|
||||
int16_t RF69::finishTransmit() {
|
||||
// clear interrupt flags
|
||||
clearIRQFlags();
|
||||
|
||||
// set mode to standby to disable transmitter/RF switch
|
||||
return(standby());
|
||||
}
|
||||
|
||||
int16_t RF69::readData(uint8_t* data, size_t len) {
|
||||
// set mode to standby
|
||||
int16_t state = standby();
|
||||
|
|
|
@ -684,6 +684,13 @@ class RF69: public PhysicalLayer {
|
|||
*/
|
||||
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. GDO0 will be activated when full packet is received.
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue