support for auto ACK and retransmissions added
Dependents: JNP3_IOT_6_RADIO_ECHO_FIXED nRF24L01P_NET_GW nRF24L01P_NET_SENSOR Kubus ... more
Fork of nRF24L01P by
Revision 4:d1c0020f1c87, committed 2017-01-19
- Comitter:
- ttajmajer
- Date:
- Thu Jan 19 08:56:18 2017 +0000
- Parent:
- 2:3012f09dfcc2
- Child:
- 5:92d0bd6eade7
- Commit message:
- added disableRXPipe and enableRXPipe;
Changed in this revision
| nRF24L01P.cpp | Show annotated file Show diff for this revision Revisions of this file |
| nRF24L01P.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/nRF24L01P.cpp Wed Jan 04 10:58:27 2017 +0000
+++ b/nRF24L01P.cpp Thu Jan 19 08:56:18 2017 +0000
@@ -649,6 +649,36 @@
setRegister(_NRF24L01P_REG_EN_RXADDR, enRxAddr);
}
+void nRF24L01P::disablePipeRX(int pipe) {
+
+ if ( ( pipe < NRF24L01P_PIPE_P0 ) || ( pipe > NRF24L01P_PIPE_P5 ) ) {
+ error( "nRF24L01P: Invalid setRxAddress pipe number %d\r\n", pipe );
+ return;
+ }
+
+ int enRxAddr = getRegister(_NRF24L01P_REG_EN_RXADDR);
+
+ enRxAddr &= ~(1 << ( pipe - NRF24L01P_PIPE_P0 ) );
+
+ setRegister(_NRF24L01P_REG_EN_RXADDR, enRxAddr);
+
+}
+
+void nRF24L01P::enablePipeRX(int pipe) {
+
+ if ( ( pipe < NRF24L01P_PIPE_P0 ) || ( pipe > NRF24L01P_PIPE_P5 ) ) {
+ error( "nRF24L01P: Invalid setRxAddress pipe number %d\r\n", pipe );
+ return;
+ }
+
+ int enRxAddr = getRegister(_NRF24L01P_REG_EN_RXADDR);
+
+ enRxAddr |= (1 << ( pipe - NRF24L01P_PIPE_P0 ) );
+
+ setRegister(_NRF24L01P_REG_EN_RXADDR, enRxAddr);
+
+}
+
/*
* This version of setRxAddress is just a wrapper for the version that takes 'long long's,
* in case the main code doesn't want to deal with long long's.
--- a/nRF24L01P.h Wed Jan 04 10:58:27 2017 +0000
+++ b/nRF24L01P.h Thu Jan 19 08:56:18 2017 +0000
@@ -181,6 +181,9 @@
void setTxAddress(unsigned long long address = DEFAULT_NRF24L01P_ADDRESS, int width = DEFAULT_NRF24L01P_ADDRESS_WIDTH);
void setTxAddress(unsigned long msb_address, unsigned long lsb_address, int width);
+
+ void disablePipeRX(int pipe);
+ void enablePipeRX(int pipe);
/**
* Get the Receive address.
