Skip to content

Commit

Permalink
Add function to get automatic retransmission count (#558)
Browse files Browse the repository at this point in the history
Added getARC() to get automatic retransmission count (ARC_CNT)

Co-authored-by: Georgios Karnas <kargeor@gmail.com>
  • Loading branch information
Avamander and kargeor authored Jan 18, 2020
1 parent d1a5d5e commit 7a1a597
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
8 changes: 8 additions & 0 deletions RF24.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1478,6 +1478,14 @@ uint8_t RF24::getPALevel(void)

/****************************************************************************/

uint8_t RF24::getARC(void)
{

return read_register(OBSERVE_TX) & 0x0F;
}

/****************************************************************************/

bool RF24::setDataRate(rf24_datarate_e speed)
{
bool result = false;
Expand Down
19 changes: 14 additions & 5 deletions RF24.h
Original file line number Diff line number Diff line change
Expand Up @@ -889,13 +889,22 @@ class RF24 {
uint8_t getPALevel(void);

/**
* Set the transmission data rate
* Returns automatic retransmission count (ARC_CNT)
*
* @warning setting RF24_250KBPS will fail for non-plus units
* Value resets with each new transmission. Allows roughly estimating signal strength.
*
* @param speed RF24_250KBPS for 250kbs, RF24_1MBPS for 1Mbps, or RF24_2MBPS for 2Mbps
* @return true if the change was successful
* @return Returns values from 0 to 15.
*/
uint8_t getARC(void);

/**
* Set the transmission data rate
*
* @warning setting RF24_250KBPS will fail for non-plus units
*
* @param speed RF24_250KBPS for 250kbs, RF24_1MBPS for 1Mbps, or RF24_2MBPS for 2Mbps
* @return true if the change was successful
*/
bool setDataRate(rf24_datarate_e speed);

/**
Expand Down Expand Up @@ -1118,7 +1127,7 @@ class RF24 {
*/
uint8_t get_status(void);

#if ! defined (MINIMAL)
#if !defined (MINIMAL)

/**
* Decode and print the given status to stdout
Expand Down

0 comments on commit 7a1a597

Please sign in to comment.