Skip to content

Commit

Permalink
Inspired idea to change TX standby code
Browse files Browse the repository at this point in the history
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()  ){}
  • Loading branch information
TMRh20 committed Mar 19, 2014
1 parent 77b1e2c commit 1e2f41c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions RF24.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -545,8 +545,13 @@ void RF24::startWrite( const void* buf, uint8_t len ){ //TMRh20
}


void RF24::txStandBy(){
ce(LOW);
bool RF24::txStandBy(){

if ( (read_register(FIFO_STATUS) & _BV(TX_EMPTY))){
ce(LOW);
return 1;
}
return 0;
}

/****************************************************************************/
Expand Down
2 changes: 1 addition & 1 deletion RF24.h
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ class RF24
public:

//TMRh20
void txStandBy();
bool txStandBy();
bool writeBlocking( const void* buf, uint8_t len );
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
Expand Down

0 comments on commit 1e2f41c

Please sign in to comment.