Skip to content

Commit

Permalink
- Slight modification to reUseTX cmd
Browse files Browse the repository at this point in the history
- put the CE HIGH, LOW changes in the cmd for non-internal use
- Put the clearing of MAX_RT in the reUse cmd for non-internal use
- Removed unneeded delay from writeBlocking()
  • Loading branch information
TMRh20 committed Mar 19, 2014
1 parent 281ace4 commit 77b1e2c
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions RF24.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -480,11 +480,7 @@ bool RF24::writeBlocking( const void* buf, uint8_t len )
while ( (read_register(FIFO_STATUS) & _BV(FIFO_FULL))){ //Blocking only if FIFO is full. This will loop and block until TX is successful

if( get_status() & _BV(MAX_RT)){
write_register(STATUS,_BV(MAX_RT) ); //Clear max retry flag
reUseTX(); //Set re-transmit
ce(LOW); //Re-Transfer packet
ce(HIGH);
delayMicroseconds(15);
}

}
Expand All @@ -496,10 +492,12 @@ bool RF24::writeBlocking( const void* buf, uint8_t len )


void RF24::reUseTX(){
write_register(STATUS,_BV(MAX_RT) ); //Clear max retry flag
csn(LOW);
SPI.transfer( REUSE_TX_PL );
csn(HIGH);

ce(LOW); //Re-Transfer packet
ce(HIGH);
}

/****************************************************************************/
Expand All @@ -518,8 +516,6 @@ bool RF24::writeFast( const void* buf, uint8_t len )
if( get_status() & _BV(MAX_RT)){
write_register(STATUS,_BV(MAX_RT) ); //Clear max retry flag
reUseTX(); //Set re-transmit
ce(LOW); //Re-Transfer packet
ce(HIGH);
delayMicroseconds(15); //CE needs to stay high for 10us, for TX_REUSE to engage
return 0; //Return 0. The previous payload has been retransmitted
//From the user perspective, if you get a 0, just keep trying to send the same payload
Expand Down

0 comments on commit 77b1e2c

Please sign in to comment.