Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: JNP3_IOT_6_RADIO_ECHO_FIXED2_2
Diff: nRF24L01P.cpp
- Revision:
- 4:d1c0020f1c87
- Parent:
- 2:3012f09dfcc2
- Child:
- 5:92d0bd6eade7
--- 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.