summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <daniel.friesel@uos.de>2019-07-18 15:38:36 +0200
committerDaniel Friesel <daniel.friesel@uos.de>2019-07-18 15:38:36 +0200
commitbc3745b67fb92baffa3d02a7678638be21137c4a (patch)
tree917e0b2fee0ab9527303134669fdd3b9c0ad8b54
parentb47295e3b04413cc5d278df2ea8fe2c168beefd2 (diff)
nrf24: Add observe tx accessor
-rw-r--r--include/driver/nrf24l01.h7
-rw-r--r--src/driver/nrf24l01.cc5
2 files changed, 12 insertions, 0 deletions
diff --git a/include/driver/nrf24l01.h b/include/driver/nrf24l01.h
index ecf4bc2..3a1f145 100644
--- a/include/driver/nrf24l01.h
+++ b/include/driver/nrf24l01.h
@@ -193,6 +193,13 @@ public:
*/
uint8_t flushRx(void);
+ /**
+ * Get observe value.
+ *
+ * @return Current Observe TX value. 7:4 counts lost packets since last channel change, 3:0 gives retransmission count of latest packet.
+ */
+ uint8_t getObserveTx(void);
+
void setup();
/**
* Set Power Amplifier (PA) level to one of four levels:
diff --git a/src/driver/nrf24l01.cc b/src/driver/nrf24l01.cc
index 937831b..9433534 100644
--- a/src/driver/nrf24l01.cc
+++ b/src/driver/nrf24l01.cc
@@ -135,6 +135,11 @@ void Nrf24l01::powerDown(void)
writeRegister(NRF_CONFIG, readRegister(NRF_CONFIG) & ~(1 << PWR_UP));
}
+uint8_t Nrf24l01::getObserveTx(void)
+{
+ return readRegister(OBSERVE_TX);
+}
+
void Nrf24l01::setRetries(uint8_t delay, uint8_t count)
{
writeRegister(SETUP_RETR, (delay & 0xf) << ARD | (count & 0xf) << ARC);