Commit 1e2f41c3 authored by TMRh20's avatar TMRh20

Inspired idea to change TX standby code

Realised that data would be lost if dropping to standby or power down
mode before the FIFO is empty.
txStandby now returns a boolean value to indicate whether the
transmission is complete. If there is data in the TX FIFO the radio will
not drop out of TX mode. eg: while(  !txStandBy()  ){}
parent 77b1e2c1
...@@ -545,8 +545,13 @@ void RF24::startWrite( const void* buf, uint8_t len ){ //TMRh20 ...@@ -545,8 +545,13 @@ void RF24::startWrite( const void* buf, uint8_t len ){ //TMRh20
} }
void RF24::txStandBy(){ bool RF24::txStandBy(){
ce(LOW);
if ( (read_register(FIFO_STATUS) & _BV(TX_EMPTY))){
ce(LOW);
return 1;
}
return 0;
} }
/****************************************************************************/ /****************************************************************************/
......
...@@ -222,7 +222,7 @@ protected: ...@@ -222,7 +222,7 @@ protected:
public: public:
//TMRh20 //TMRh20
void txStandBy(); bool txStandBy();
bool writeBlocking( const void* buf, uint8_t len ); bool writeBlocking( const void* buf, uint8_t len );
void reUseTX(); void reUseTX();
bool writeFast( const void* buf, uint8_t len ); //Fills FIFO buffer, uses packet re-use function of the chip and returns 0 if packet failed and re-sent bool writeFast( const void* buf, uint8_t len ); //Fills FIFO buffer, uses packet re-use function of the chip and returns 0 if packet failed and re-sent
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment