Port of Maniacbug's Arduino RF24 library to mbed.
Dependents: STM32F407VET6_nRF24L01_Master STM32F407VET6_nRF24L01_Slave Main_ntp_sd_nrf IRC_MASTER
Revision 1:d96c2056bf37, committed 2019-01-25
- Comitter:
- hudakz
- Date:
- Fri Jan 25 14:01:33 2019 +0000
- Parent:
- 0:2007da485383
- Commit message:
- Modified begin()
Changed in this revision
RF24.cpp | Show annotated file Show diff for this revision Revisions of this file |
RF24.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/RF24.cpp Wed Jan 23 17:34:34 2019 +0000 +++ b/RF24.cpp Fri Jan 25 14:01:33 2019 +0000 @@ -400,7 +400,7 @@ // /*$on*/ -void RF24::begin (void) +bool RF24::begin (void) { // Initialize pins // pinMode(ce_pin,OUTPUT); @@ -425,6 +425,11 @@ // sizes must never be used. See documentation for a more complete explanation. write_register(SETUP_RETR, (4 << ARD) | (15 << ARC)); + // Test whether setPALevel works. + setPALevel(RF24_PA_MIN); + if (getPALevel() != RF24_PA_MIN) + return false; // Something went wrog. Check whether nRF24L01 is connected. + // Restore our default PA level setPALevel(RF24_PA_MAX); @@ -462,6 +467,8 @@ // set EN_RXADDRR to 0 to prevent pipe 0 and pipe 1 from receiving write_register(EN_RXADDR, 0); + + return true; } /** @@ -1233,3 +1240,4 @@ else return b; } +
--- a/RF24.h Wed Jan 23 17:34:34 2019 +0000 +++ b/RF24.h Fri Jan 25 14:01:33 2019 +0000 @@ -355,8 +355,10 @@ * Begin operation of the chip * * Call this in setup(), before calling any other methods. + * + * @return True on success. False otherwise. */ - void begin(void); + bool begin(void); /** * Retrieve the current status of the chip