From 8759712f127bef55a62e7748ff3c2c5daee566ac Mon Sep 17 00:00:00 2001 From: Henrik Ekblad Date: Thu, 1 May 2014 18:55:01 +0200 Subject: [PATCH] Added closeReadingPipe. --- RF24.cpp | 8 ++++++++ RF24.h | 9 +++++++++ 2 files changed, 17 insertions(+) diff --git a/RF24.cpp b/RF24.cpp index ebfbf81..000cfed 100644 --- a/RF24.cpp +++ b/RF24.cpp @@ -860,6 +860,14 @@ void RF24::openReadingPipe(uint8_t child, uint64_t address) } } +/****************************************************************************/ + +void RF24::closeReadingPipe( uint8_t pipe ) +{ + write_register(EN_RXADDR,read_register(EN_RXADDR) & ~_BV(pgm_read_byte(&child_pipe_enable[pipe]))); +} + + /****************************************************************************/ void RF24::toggle_features(void) diff --git a/RF24.h b/RF24.h index 1571113..09390ed 100644 --- a/RF24.h +++ b/RF24.h @@ -208,6 +208,15 @@ public: */ void openReadingPipe(uint8_t number, uint64_t address); + + + /** + * Close a pipe after it has been previously opened. + * Can be safely called without having previously opened a pipe. + * @param pipe Which pipe # to close, 0-5. + */ + void closeReadingPipe( uint8_t pipe ) ; + /**@}*/ /** * @name Advanced Operation