Skip to content

Commit 5051d51

Browse files
Yveauxtekka007
authored andcommitted
Add lowlevel nRF24 functions (#1190)
* Implemented nRF24 constant carrier wave For testing purposes only! Not used by regular MySensors stack. * Please Jenkins for unused functions
1 parent 46568ba commit 5051d51

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

drivers/RF24/RF24.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,20 @@ LOCAL int16_t RF24_getSendingRSSI(void)
418418
return static_cast<int16_t>(-29 - (8 * (RF24_getObserveTX() & 0xF)));
419419
}
420420

421+
LOCAL void RF24_enableConstantCarrierWave(void)
422+
{
423+
RF24_standBy();
424+
delayMicroseconds(1500);
425+
RF24_setRFSetup(RF24_RF_SETUP | _BV(RF24_CONT_WAVE) | _BV(RF24_PLL_LOCK) );
426+
RF24_ce(HIGH);
427+
}
428+
429+
LOCAL void RF24_disableConstantCarrierWave(void)
430+
{
431+
RF24_ce(LOW);
432+
RF24_setRFSetup(RF24_RF_SETUP);
433+
}
434+
421435
#if defined(MY_RX_MESSAGE_BUFFER_FEATURE)
422436
LOCAL void RF24_irqHandler(void)
423437
{

drivers/RF24/RF24.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ extern HardwareSPI SPI; //!< SPI
146146
#define RF24_CONFIGURATION (uint8_t) (RF24_CRC_16 << 2) //!< RF24_CONFIGURATION
147147
#endif
148148
#define RF24_FEATURE (uint8_t)( _BV(RF24_EN_DPL)) //!< RF24_FEATURE
149-
#define RF24_RF_SETUP (uint8_t)( ((MY_RF24_DATARATE & 0b10 ) << 4) | ((MY_RF24_DATARATE & 0b01 ) << 3) | (MY_RF24_PA_LEVEL << 1) ) + 1 //!< RF24_RF_SETUP, +1 for Si24R1 and LNA
149+
#define RF24_RF_SETUP (uint8_t)(( ((MY_RF24_DATARATE & 0b10 ) << 4) | ((MY_RF24_DATARATE & 0b01 ) << 3) | (MY_RF24_PA_LEVEL << 1) ) + 1) //!< RF24_RF_SETUP, +1 for Si24R1 and LNA
150150

151151
// powerup delay
152152
#define RF24_POWERUP_DELAY_MS (100u) //!< Power up delay, allow VCC to settle, transport to become fully operational
@@ -392,6 +392,14 @@ LOCAL bool RF24_setTxPowerPercent(const uint8_t newPowerPercent);
392392
* @return Pseudo-RSSI based on ARC register
393393
*/
394394
LOCAL int16_t RF24_getSendingRSSI(void);
395+
/**
396+
* @brief Generate a constant carrier wave at active channel & transmit power (for testing only).
397+
*/
398+
LOCAL void RF24_enableConstantCarrierWave(void) __attribute__((unused));
399+
/**
400+
* @brief Stop generating a constant carrier wave (for testing only).
401+
*/
402+
LOCAL void RF24_disableConstantCarrierWave(void) __attribute__((unused));
395403

396404

397405
#if defined(MY_RX_MESSAGE_BUFFER_FEATURE)

drivers/RF24/RF24registers.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@
129129
#define RF24_ARD (4)
130130
#define RF24_ARC (0)
131131
#define RF24_PLL_LOCK (4)
132+
#define RF24_CONT_WAVE (7)
132133
#define RF24_RF_DR (3)
133134
#define RF24_RF_PWR (6)
134135
#define RF24_RX_DR (6)

0 commit comments

Comments
 (0)