summaryrefslogtreecommitdiff
path: root/src/driver
diff options
context:
space:
mode:
authorDaniel Friesel <daniel.friesel@uos.de>2019-06-25 15:52:18 +0200
committerDaniel Friesel <daniel.friesel@uos.de>2019-06-25 15:52:18 +0200
commitf4394afb4e7915457f0a901e9c3d9d0f08470593 (patch)
treee2ec37b32a87a4d9e891cc65e276df3d182cdf28 /src/driver
parenta73f21f7aa05638203ca0b928849f956cd4269ee (diff)
addsetautoack
Diffstat (limited to 'src/driver')
-rw-r--r--src/driver/nrf24l01.cc29
1 files changed, 27 insertions, 2 deletions
diff --git a/src/driver/nrf24l01.cc b/src/driver/nrf24l01.cc
index 194b1b7..921f69d 100644
--- a/src/driver/nrf24l01.cc
+++ b/src/driver/nrf24l01.cc
@@ -338,7 +338,7 @@ uint8_t Nrf24l01::writeRegister(uint8_t reg, uint8_t value)
return rxbuf[0];
}
-void Nrf24l01::enableDynamicPayloads(const bool enabled)
+void Nrf24l01::setDynamicPayloads(const bool enabled)
{
if (enabled)
{
@@ -354,7 +354,7 @@ void Nrf24l01::enableDynamicPayloads(const bool enabled)
dynamic_payloads_enabled = enabled;
}
-void Nrf24l01::enableDynamicAck(const bool enabled)
+void Nrf24l01::setDynamicAck(const bool enabled)
{
if (enabled)
{
@@ -366,6 +366,31 @@ void Nrf24l01::enableDynamicAck(const bool enabled)
}
}
+void Nrf24l01::setAutoAck(bool enable)
+{
+ if ( enable )
+ writeRegister(EN_AA, 0b111111);
+ else
+ writeRegister(EN_AA, 0);
+}
+
+void Nrf24l01::setAutoAck( uint8_t pipe, bool enable )
+{
+ if ( pipe <= 6 )
+ {
+ uint8_t en_aa = readRegister( EN_AA ) ;
+ if( enable )
+ {
+ en_aa |= (1<<pipe) ;
+ }
+ else
+ {
+ en_aa &= ~(1<<pipe) ;
+ }
+ writeRegister( EN_AA, en_aa ) ;
+ }
+}
+
uint8_t Nrf24l01::writePayload(const void *buf, uint8_t data_len, const uint8_t writeType)
{
data_len = rf24_min(data_len, payload_size);