Classes | Public Types | Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
RH_RF69 Class Reference

Driver to send and receive unaddressed, unreliable datagrams via an RF69 and compatible radio transceiver. More...

#include <RH_RF69.h>

Inheritance diagram for RH_RF69:
RHSPIDriver RHGenericDriver


struct  ModemConfig
 Defines register values for a set of modem configuration registers. More...

Public Types

enum  ModemConfigChoice {
  FSK_Rb2Fd5 = 0, FSK_Rb2_4Fd4_8, FSK_Rb4_8Fd9_6, FSK_Rb9_6Fd19_2,
  FSK_Rb19_2Fd38_4, FSK_Rb38_4Fd76_8, FSK_Rb57_6Fd120, FSK_Rb125Fd125,
  FSK_Rb250Fd250, FSK_Rb55555Fd50, GFSK_Rb2Fd5, GFSK_Rb2_4Fd4_8,
  GFSK_Rb4_8Fd9_6, GFSK_Rb9_6Fd19_2, GFSK_Rb19_2Fd38_4, GFSK_Rb38_4Fd76_8,
  GFSK_Rb57_6Fd120, GFSK_Rb125Fd125, GFSK_Rb250Fd250, GFSK_Rb55555Fd50,
  OOK_Rb1Bw1, OOK_Rb1_2Bw75, OOK_Rb2_4Bw4_8, OOK_Rb4_8Bw9_6,
  OOK_Rb9_6Bw19_2, OOK_Rb19_2Bw38_4, OOK_Rb32Bw64
- Public Types inherited from RHGenericDriver
enum  RHMode {
  RHModeInitialising = 0, RHModeSleep, RHModeIdle, RHModeTx,
  RHModeRx, RHModeCad
 Defines different operating modes for the transport hardware. More...

Public Member Functions

 RH_RF69 (uint8_t slaveSelectPin=SS, uint8_t interruptPin=2, RHGenericSPI &spi=hardware_spi)
bool init ()
int8_t temperatureRead ()
bool setFrequency (float centre, float afcPullInRange=0.05)
int8_t rssiRead ()
void setOpMode (uint8_t mode)
void setModeIdle ()
void setModeRx ()
void setModeTx ()
void setTxPower (int8_t power, bool ishighpowermodule=RH_RF69_DEFAULT_HIGHPOWER)
void setModemRegisters (const ModemConfig *config)
bool setModemConfig (ModemConfigChoice index)
bool available ()
bool recv (uint8_t *buf, uint8_t *len)
bool send (const uint8_t *data, uint8_t len)
void setPreambleLength (uint16_t bytes)
void setSyncWords (const uint8_t *syncWords=NULL, uint8_t len=0)
void setEncryptionKey (uint8_t *key=NULL)
uint32_t getLastPreambleTime ()
uint8_t maxMessageLength ()
bool printRegister (uint8_t reg)
bool printRegisters ()
void setIdleMode (uint8_t idleMode)
virtual bool sleep ()
uint16_t deviceType ()
- Public Member Functions inherited from RHSPIDriver
 RHSPIDriver (uint8_t slaveSelectPin=SS, RHGenericSPI &spi=hardware_spi)
bool init ()
uint8_t spiRead (uint8_t reg)
uint8_t spiWrite (uint8_t reg, uint8_t val)
uint8_t spiBurstRead (uint8_t reg, uint8_t *dest, uint8_t len)
uint8_t spiBurstWrite (uint8_t reg, const uint8_t *src, uint8_t len)
void setSlaveSelectPin (uint8_t slaveSelectPin)
- Public Member Functions inherited from RHGenericDriver
 RHGenericDriver ()
virtual void waitAvailable ()
virtual bool waitPacketSent ()
virtual bool waitPacketSent (uint16_t timeout)
virtual bool waitAvailableTimeout (uint16_t timeout)
virtual bool waitCAD ()
void setCADTimeout (unsigned long cad_timeout)
virtual bool isChannelActive ()
virtual void setThisAddress (uint8_t thisAddress)
virtual void setHeaderTo (uint8_t to)
virtual void setHeaderFrom (uint8_t from)
virtual void setHeaderId (uint8_t id)
virtual void setHeaderFlags (uint8_t set, uint8_t clear=RH_FLAGS_APPLICATION_SPECIFIC)
virtual void setPromiscuous (bool promiscuous)
virtual uint8_t headerTo ()
virtual uint8_t headerFrom ()
virtual uint8_t headerId ()
virtual uint8_t headerFlags ()
int16_t lastRssi ()
RHMode mode ()
void setMode (RHMode mode)
 Sets the operating mode of the transport.
virtual uint16_t rxBad ()
virtual uint16_t rxGood ()
virtual uint16_t txGood ()

Protected Member Functions

void handleInterrupt ()
void readFifo ()

Static Protected Member Functions

static void isr0 ()
 Low level interrupt service routine for RF69 connected to interrupt 0.
static void isr1 ()
 Low level interrupt service routine for RF69 connected to interrupt 1.
static void isr2 ()
 Low level interrupt service routine for RF69 connected to interrupt 1.

Protected Attributes

uint8_t _interruptPin
 The configured interrupt pin connected to this instance.
uint8_t _myInterruptIndex
uint8_t _idleMode
 The radio OP mode to use when mode is RHModeIdle.
uint8_t _deviceType
 The reported device type.
int8_t _power
 The selected output power in dBm.
volatile uint8_t _bufLen
 The message length in _buf.
uint8_t _buf [RH_RF69_MAX_MESSAGE_LEN]
 Array of octets of teh last received message or the next to transmit message.
volatile bool _rxBufValid
 True when there is a valid message in the Rx buffer.
uint32_t _lastPreambleTime
 Time in millis since the last preamble was received (and the last time the RSSI was measured)
- Protected Attributes inherited from RHSPIDriver
 Reference to the RHGenericSPI instance to use to transfer data with teh SPI device.
uint8_t _slaveSelectPin
 The pin number of the Slave Select pin that is used to select the desired device.
- Protected Attributes inherited from RHGenericDriver
volatile RHMode _mode
 The current transport operating mode.
uint8_t _thisAddress
 This node id.
bool _promiscuous
 Whether the transport is in promiscuous mode.
volatile uint8_t _rxHeaderTo
 TO header in the last received mesasge.
volatile uint8_t _rxHeaderFrom
 FROM header in the last received mesasge.
volatile uint8_t _rxHeaderId
 ID header in the last received mesasge.
volatile uint8_t _rxHeaderFlags
 FLAGS header in the last received mesasge.
uint8_t _txHeaderTo
 TO header to send in all messages.
uint8_t _txHeaderFrom
 FROM header to send in all messages.
uint8_t _txHeaderId
 ID header to send in all messages.
uint8_t _txHeaderFlags
 FLAGS header to send in all messages.
volatile int16_t _lastRssi
 The value of the last received RSSI value, in some transport specific units.
volatile uint16_t _rxBad
 Count of the number of bad messages (eg bad checksum etc) received.
volatile uint16_t _rxGood
 Count of the number of successfully transmitted messaged.
volatile uint16_t _txGood
 Count of the number of bad messages (correct checksum etc) received.
volatile bool _cad
 Channel activity detected.
unsigned int _cad_timeout
 Channel activity timeout in ms.

Static Protected Attributes

static RH_RF69_deviceForInterrupt [] = {0, 0, 0}
 Array of instances connected to interrupts 0 and 1.
static uint8_t _interruptCount = 0
 Index of next interrupt number to use in _deviceForInterrupt.

Additional Inherited Members

- Static Public Member Functions inherited from RHGenericDriver
static void printBuffer (const char *prompt, const uint8_t *buf, uint8_t len)

Detailed Description

Driver to send and receive unaddressed, unreliable datagrams via an RF69 and compatible radio transceiver.

Works with


This class provides basic functions for sending and receiving unaddressed, unreliable datagrams of arbitrary length to 64 octets per packet.

Manager classes may use this class to implement reliable, addressed datagrams and streams, mesh routers, repeaters, translators etc.

Naturally, for any 2 radios to communicate that must be configured to use the same frequency and modulation scheme.

This Driver provides an object-oriented interface for sending and receiving data messages with Hope-RF RF69B and compatible radio modules, such as the RFM69 module.

The Hope-RF ( RF69 is a low-cost ISM transceiver chip. It supports FSK, GFSK, OOK over a wide range of frequencies and programmable data rates. It also suports AES encryption of up to 64 octets of payload It is available prepackaged on modules such as the RFM69W. And such modules can be prepacked on processor boards such as the Moteino from LowPowerLabs (which is what we used to develop the RH_RF69 driver)

This Driver provides functions for sending and receiving messages of up to 60 octets on any frequency supported by the RF69, in a range of predefined data rates and frequency deviations. Frequency can be set with 61Hz precision to any frequency from 240.0MHz to 960.0MHz. Caution: most modules only support a more limited range of frequencies due to antenna tuning.

Up to 2 RF69B modules can be connected to an Arduino (3 on a Mega), permitting the construction of translators and frequency changers, etc.

The following modulation types are suppported with a range of modem configurations for common data rates and frequency deviations:

Support for other RF69 features such as on-chip temperature measurement, transmitter power control etc is also provided.

Tested on USB-Moteino with arduino-1.0.5 on OpenSuSE 13.1

Packet Format

All messages sent and received by this RH_RF69 Driver conform to this packet format:

For technical reasons, the message format is not protocol compatible with the 'HopeRF Radio Transceiver Message Library for Arduino' from the same author. Nor is it compatible with messages sent by 'Virtual Wire' also from the same author. Nor is it compatible with messages sent by 'RF22' also from the same author.

Connecting RFM-69 to Arduino

We tested with Moteino, which is an Arduino Uno compatible with the RFM69W module on-board. Therefore it needs no connections other than the USB programming connection and an antenna to make it work.

If you have a bare RFM69W that you want to connect to an Arduino, you might use these connections: CAUTION: you must use a 3.3V type Arduino, otherwise you will also need voltage level shifters between the Arduino and the RFM69. CAUTION, you must also ensure you connect an antenna

Arduino RFM69W
GND----------GND (ground in)
3V3----------3.3V (3.3V in)
interrupt 0 pin D2-----------DIO0 (interrupt request out)
SS pin D10----------NSS (chip select in)
SCK pin D13----------SCK (SPI clock in)
MOSI pin D11----------MOSI (SPI Data in)
MISO pin D12----------MISO (SPI Data out)

For Arduino Due, use these connections:

Arduino RFM69W
GND----------GND (ground in)
3V3----------3.3V (3.3V in)
interrupt 0 pin D2-----------DIO0 (interrupt request out)
SS pin D10----------NSS (chip select in)
SCK SPI pin 3----------SCK (SPI clock in)
MOSI SPI pin 4----------MOSI (SPI Data in)
MISO SPI pin 1----------MISO (SPI Data out)

With these connections, you can then use the default constructor RH_RF69(). You can override the default settings for the SS pin and the interrupt in the RH_RF69 constructor if you wish to connect the slave select SS to other than the normal one for your Arduino (D10 for Diecimila, Uno etc and D53 for Mega) or the interrupt request to other than pin D2 (Caution, different processors have different constraints as to the pins available for interrupts).

If you have a Teensy 3.1 and a compatible RFM69 breakout board, you will need to construct the RH_RF69 instance like this:

RH_RF69 driver(15, 16);

If you have a MoteinoMEGA with RFM69 on board, you dont need to make any wiring connections (the RFM69 module is soldered onto the MotienoMEGA), but you must initialise the RH_RF69 constructor like this:

RH_RF69 driver(4, 2);

Make sure you have the MoteinoMEGA core installed in your Arduino hardware folder as described in the documentation for the MoteinoMEGA.

If you have an Arduino M0 Pro from, you should note that you cannot use Pin 2 for the interrupt line (Pin 2 is for the NMI only). The same comments apply to Pin 4 on Arduino Zero from Instead you can use any other pin (we use Pin 3) and initialise RH_RF69 like this:

// Slave Select is pin 10, interrupt is Pin 3
RH_RF69 driver(10, 3);

If you have a Rocket Scream Mini Ultra Pro with the RFM69HCW

If you have a talk2 Whisper Node board with on-board RF69 radio, the example rf69_* sketches work without modifications. Initialise the radio like with the default constructor:

RH_RF69 driver;

If you have a Feather 32u4 with RFM69HCW you need to initialise the driver like:

RH_RF69 driver(8, 7);

and since the radio is the high power HCW model, you must set the Tx power in the range 14 to 20 like this:


If you are connecting an RF69 to a ESP8266 board breakout board that exposes pins 12, 13, 14, 15 (ie NOT an ESP-01) you can connect like this:

ESP8266 RFM69W
GND-----------GND (ground in)
VIN-----------3.3V (3.3V in)
interrupt D0 pin GPIO0-----------DIO0 (interrupt request out)
SS pin GPIO15----------NSS (chip select in)
SCK SPI pin GPIO14----------SCK (SPI clock in)
MOSI SPI pin GPIO13----------MOSI (SPI Data in)
MISO SPI pin GPIO12----------MISO (SPI Data out)

and initialise with

RH_RF69 driver(15, 0);

It is possible to have 2 or more radios connected to one Arduino, provided each radio has its own SS and interrupt line (SCK, SDI and SDO are common to all radios)

Caution: on some Arduinos such as the Mega 2560, if you set the slave select pin to be other than the usual SS pin (D53 on Mega 2560), you may need to set the usual SS pin to be an output to force the Arduino into SPI master mode.

Caution: Power supply requirements of the RF69 module may be relevant in some circumstances: RF69 modules are capable of pulling 45mA+ at full power, where Arduino's 3.3V line can give 50mA. You may need to make provision for alternate power supply for the RF69, especially if you wish to use full transmit power, and/or you have other shields demanding power. Inadequate power for the RF69 is likely to cause symptoms such as: -reset's/bootups terminate with "init failed" messages -random termination of communication after 5-30 packets sent/received -"fake ok" state, where initialization passes fluently, but communication doesn't happen -shields hang Arduino boards, especially during the flashing


The RH_RF69 driver uses interrupts to react to events in the RF69 module, such as the reception of a new packet, or the completion of transmission of a packet. The RH_RF69 driver interrupt service routine reads status from and writes data to the the RF69 module via the SPI interface. It is very important therefore, that if you are using the RH_RF69 driver with another SPI based deviced, that you disable interrupts while you transfer data to and from that other device. Use cli() to disable interrupts and sei() to reenable them.


The RH_RF69 driver requires non-trivial amounts of memory. The sample programs above all compile to about 8kbytes each, which will fit in the flash proram memory of most Arduinos. However, the RAM requirements are more critical. Therefore, you should be vary sparing with RAM use in programs that use the RH_RF69 driver.

It is often hard to accurately identify when you are hitting RAM limits on Arduino. The symptoms can include:

Automatic Frequency Control (AFC)

The RF69 module is configured by the RH_RF69 driver to always use AFC.

Transmitter Power

You can control the transmitter power on the RF69 transceiver with the RH_RF69::setTxPower() function. The argument can be any of -18 to +13 (for RF69W) or -14 to 20 (for RF69HW) The default is 13. Eg:


We have made some actual power measurements against programmed power for Moteino (with RF69W)


Some simple speed performance tests have been conducted. In general packet transmission rate will be limited by the modulation scheme. Also, if your code does any slow operations like Serial printing it will also limit performance. We disabled any printing in the tests below. We tested with RH_RF69::GFSK_Rb250Fd250, which is probably the fastest scheme available. We tested with a 13 octet message length, over a very short distance of 10cm.

Transmission (no reply) tests with modulation RH_RF69::GFSK_Rb250Fd250 and a 13 octet message show about 152 messages per second transmitted and received.

Transmit-and-wait-for-a-reply tests with modulation RH_RF69::GFSK_Rb250Fd250 and a 13 octet message (send and receive) show about 68 round trips per second.

Member Enumeration Documentation

◆ ModemConfigChoice

Choices for setModemConfig() for a selected subset of common modulation types, and data rates. If you need another configuration, use the register calculator. and call setModemRegisters() with your desired settings. These are indexes into MODEM_CONFIG_TABLE. We strongly recommend you use these symbolic definitions and not their integer equivalents: its possible that new values will be introduced in later versions (though we will try to avoid it). CAUTION: some of these configurations do not work corectly and are marked as such.


FSK, Whitening, Rb = 2kbs, Fd = 5kHz.


FSK, Whitening, Rb = 2.4kbs, Fd = 4.8kHz.


FSK, Whitening, Rb = 4.8kbs, Fd = 9.6kHz.


FSK, Whitening, Rb = 9.6kbs, Fd = 19.2kHz.


FSK, Whitening, Rb = 19.2kbs, Fd = 38.4kHz.


FSK, Whitening, Rb = 38.4kbs, Fd = 76.8kHz.


FSK, Whitening, Rb = 57.6kbs, Fd = 120kHz.


FSK, Whitening, Rb = 125kbs, Fd = 125kHz.


FSK, Whitening, Rb = 250kbs, Fd = 250kHz.


FSK, Whitening, Rb = 55555kbs,Fd = 50kHz for RFM69 lib compatibility.


GFSK, Whitening, Rb = 2kbs, Fd = 5kHz.


GFSK, Whitening, Rb = 2.4kbs, Fd = 4.8kHz.


GFSK, Whitening, Rb = 4.8kbs, Fd = 9.6kHz.


GFSK, Whitening, Rb = 9.6kbs, Fd = 19.2kHz.


GFSK, Whitening, Rb = 19.2kbs, Fd = 38.4kHz.


GFSK, Whitening, Rb = 38.4kbs, Fd = 76.8kHz.


GFSK, Whitening, Rb = 57.6kbs, Fd = 120kHz.


GFSK, Whitening, Rb = 125kbs, Fd = 125kHz.


GFSK, Whitening, Rb = 250kbs, Fd = 250kHz.


GFSK, Whitening, Rb = 55555kbs,Fd = 50kHz.


OOK, Whitening, Rb = 1kbs, Rx Bandwidth = 1kHz.


OOK, Whitening, Rb = 1.2kbs, Rx Bandwidth = 75kHz.


OOK, Whitening, Rb = 2.4kbs, Rx Bandwidth = 4.8kHz.


OOK, Whitening, Rb = 4.8kbs, Rx Bandwidth = 9.6kHz.


OOK, Whitening, Rb = 9.6kbs, Rx Bandwidth = 19.2kHz.


OOK, Whitening, Rb = 19.2kbs, Rx Bandwidth = 38.4kHz.


OOK, Whitening, Rb = 32kbs, Rx Bandwidth = 64kHz.

Constructor & Destructor Documentation

◆ RH_RF69()

RH_RF69::RH_RF69 ( uint8_t  slaveSelectPin = SS,
uint8_t  interruptPin = 2,
RHGenericSPI spi = hardware_spi 

Constructor. You can have multiple instances, but each instance must have its own interrupt and slave select pin. After constructing, you must call init() to initialise the interface and the radio module. A maximum of 3 instances can co-exist on one processor, provided there are sufficient distinct interrupt lines, one for each instance.

[in]slaveSelectPinthe Arduino pin number of the output to use to select the RF69 before accessing it. Defaults to the normal SS pin for your Arduino (D10 for Diecimila, Uno etc, D53 for Mega, D10 for Maple)
[in]interruptPinThe interrupt Pin number that is connected to the RF69 DIO0 interrupt line. Defaults to pin 2. Caution: You must specify an interrupt capable pin. On many Arduino boards, there are limitations as to which pins may be used as interrupts. On Leonardo pins 0, 1, 2 or 3. On Mega2560 pins 2, 3, 18, 19, 20, 21. On Due and Teensy, any digital pin. On Arduino Zero from, any digital pin other than 4. On Arduino M0 Pro from, any digital pin other than 2. On other Arduinos pins 2 or 3. See for more details. On Chipkit Uno32, pins 38, 2, 7, 8, 35. On other boards, any digital pin may be used.
[in]spiPointer to the SPI interface object to use. Defaults to the standard Arduino hardware SPI interface

References _idleMode, _interruptPin, and _myInterruptIndex.

Member Function Documentation

◆ available()

bool RH_RF69::available ( )

Starts the receiver and checks whether a received message is available. This can be called multiple times in a timeout loop

true if a complete, valid message has been received and is able to be retrieved by recv()

Implements RHGenericDriver.

References RHGenericDriver::_mode, _rxBufValid, RHGenericDriver::RHModeTx, and setModeRx().

Referenced by recv().

◆ deviceType()

uint16_t RH_RF69::deviceType ( )

Return the integer value of the device type as read from the device in from RH_RF69_REG_10_VERSION. Expect 0x24, depending on the type of device actually connected.

The integer device type

References _deviceType, handleInterrupt(), isr0(), isr1(), isr2(), and readFifo().

◆ getLastPreambleTime()

uint32_t RH_RF69::getLastPreambleTime ( )

Returns the time in millis since the most recent preamble was received, and when the most recent RSSI measurement was made.

◆ handleInterrupt()

void RH_RF69::handleInterrupt ( )

This is a low level function to handle the interrupts for one instance of RF69. Called automatically by isr*() Should not need to be called by user code.

References _lastPreambleTime, RHGenericDriver::_lastRssi, RHGenericDriver::_mode, RHGenericDriver::_txGood, readFifo(), RHGenericDriver::RHModeRx, RHGenericDriver::RHModeTx, setModeIdle(), and RHSPIDriver::spiRead().

Referenced by deviceType(), isr0(), isr1(), and isr2().

◆ init()

bool RH_RF69::init ( )

Initialises this instance and the radio module connected to it. The following steps are taken:

  • Initialise the slave select pin and the SPI interface library
  • Checks the connected RF69 module can be communicated
  • Attaches an interrupt handler
  • Configures the RF69 module
  • Sets the frequency to 434.0 MHz
  • Sets the modem data rate to FSK_Rb2Fd5
    true if everything was successful

Reimplemented from RHGenericDriver.

References _deviceForInterrupt, _deviceType, _interruptCount, _interruptPin, _myInterruptIndex, GFSK_Rb250Fd250, RHSPIDriver::init(), isr0(), isr1(), isr2(), setEncryptionKey(), setFrequency(), setModeIdle(), setModemConfig(), setPreambleLength(), setSyncWords(), setTxPower(), RHSPIDriver::spiRead(), and RHSPIDriver::spiWrite().

◆ maxMessageLength()

uint8_t RH_RF69::maxMessageLength ( )

The maximum message length supported by this driver

The maximum message length supported by this driver

Implements RHGenericDriver.

◆ printRegister()

bool RH_RF69::printRegister ( uint8_t  reg)

Prints the value of a single register to the Serial device if RH_HAVE_SERIAL is defined for the current platform For debugging/testing only

true if successful

References RHSPIDriver::spiRead().

Referenced by printRegisters().

◆ printRegisters()

bool RH_RF69::printRegisters ( )

Prints the value of all the RF69 registers to the Serial device if RH_HAVE_SERIAL is defined for the current platform For debugging/testing only

true if successful

References printRegister().

◆ readFifo()

void RH_RF69::readFifo ( )

◆ recv()

bool RH_RF69::recv ( uint8_t *  buf,
uint8_t *  len 

Turns the receiver on if it not already on. If there is a valid message available, copy it to buf and return true else return false. If a message is copied, *len is set to the length (Caution, 0 length messages are permitted). You should be sure to call this function frequently enough to not miss any messages It is recommended that you call it in your main loop.

[in]bufLocation to copy the received message
[in,out]lenPointer to available space in buf. Set to the actual number of octets copied.
true if a valid message was copied to buf

Implements RHGenericDriver.

References _buf, _bufLen, _rxBufValid, and available().

◆ rssiRead()

int8_t RH_RF69::rssiRead ( )

Reads and returns the current RSSI value. Causes the current signal strength to be measured and returned If you want to find the RSSI of the last received message, use lastRssi() instead.

The current RSSI value on units of 0.5dB.

References RHSPIDriver::spiRead(), and RHSPIDriver::spiWrite().

◆ send()

bool RH_RF69::send ( const uint8_t *  data,
uint8_t  len 

Waits until any previous transmit packet is finished being transmitted with waitPacketSent(). Then loads a message into the transmitter and starts the transmitter. Note that a message length of 0 is NOT permitted.

[in]dataArray of data to be sent
[in]lenNumber of bytes of data to send (> 0)
true if the message length was valid and it was correctly queued for transmit

Implements RHGenericDriver.

References RHSPIDriver::_slaveSelectPin, RHSPIDriver::_spi, RHGenericDriver::_txHeaderFlags, RHGenericDriver::_txHeaderFrom, RHGenericDriver::_txHeaderId, RHGenericDriver::_txHeaderTo, setModeIdle(), setModeTx(), RHGenericSPI::transfer(), RHGenericDriver::waitCAD(), and RHGenericDriver::waitPacketSent().

◆ setEncryptionKey()

void RH_RF69::setEncryptionKey ( uint8_t *  key = NULL)

Enables AES encryption and sets the AES encryption key, used to encrypt and decrypt all messages. The default is disabled.

[in]keyThe key to use. Must be 16 bytes long. The same key must be installed in other instances of RF69, otherwise communications will not work correctly. If key is NULL, encryption is disabled, which is the default.

References RHSPIDriver::spiBurstWrite(), RHSPIDriver::spiRead(), and RHSPIDriver::spiWrite().

Referenced by init().

◆ setFrequency()

bool RH_RF69::setFrequency ( float  centre,
float  afcPullInRange = 0.05 

Sets the transmitter and receiver centre frequency

[in]centreFrequency in MHz. 240.0 to 960.0. Caution, RF69 comes in several different frequency ranges, and setting a frequency outside that range of your radio will probably not work
[in]afcPullInRangeNot used
true if the selected frquency centre is within range

References RHSPIDriver::spiWrite().

Referenced by init().

◆ setIdleMode()

void RH_RF69::setIdleMode ( uint8_t  idleMode)

Sets the radio operating mode for the case when the driver is idle (ie not transmitting or receiving), allowing you to control the idle mode power requirements at the expense of slower transitions to transmit and receive modes. By default, the idle mode is RH_RF69_OPMODE_MODE_STDBY, but eg setIdleMode(RH_RF69_OPMODE_MODE_SLEEP) will provide a much lower idle current but slower transitions. Call this function after init().

[in]idleModeThe chip operating mode to use when the driver is idle. One of RH_RF69_OPMODE_*

References _idleMode.

◆ setModeIdle()

void RH_RF69::setModeIdle ( )

If current mode is Rx or Tx changes it to Idle. If the transmitter or receiver is running, disables them.

References _idleMode, RHGenericDriver::_mode, _power, RHGenericDriver::RHModeIdle, setOpMode(), and RHSPIDriver::spiWrite().

Referenced by handleInterrupt(), init(), and send().

◆ setModemConfig()

bool RH_RF69::setModemConfig ( ModemConfigChoice  index)

Select one of the predefined modem configurations. If you need a modem configuration not provided here, use setModemRegisters() with your own ModemConfig. The default after init() is RH_RF69::GFSK_Rb250Fd250.

[in]indexThe configuration choice.
true if index is a valid choice.

References setModemRegisters().

Referenced by init().

◆ setModemRegisters()

void RH_RF69::setModemRegisters ( const ModemConfig config)

Sets all the registers required to configure the data modem in the RF69, including the data rate, bandwidths etc. You can use this to configure the modem with custom configurations if none of the canned configurations in ModemConfigChoice suit you.

[in]configA ModemConfig structure containing values for the modem configuration registers.

References RH_RF69::ModemConfig::reg_02, RH_RF69::ModemConfig::reg_19, RH_RF69::ModemConfig::reg_37, RHSPIDriver::spiBurstWrite(), and RHSPIDriver::spiWrite().

Referenced by setModemConfig().

◆ setModeRx()

void RH_RF69::setModeRx ( )

If current mode is Tx or Idle, changes it to Rx. Starts the receiver in the RF69.

References RHGenericDriver::_mode, _power, RHGenericDriver::RHModeRx, setOpMode(), and RHSPIDriver::spiWrite().

Referenced by available().

◆ setModeTx()

void RH_RF69::setModeTx ( )

If current mode is Rx or Idle, changes it to Rx. F Starts the transmitter in the RF69.

References RHGenericDriver::_mode, _power, RHGenericDriver::RHModeTx, setOpMode(), and RHSPIDriver::spiWrite().

Referenced by send().

◆ setOpMode()

void RH_RF69::setOpMode ( uint8_t  mode)

Sets the parameters for the RF69 OPMODE. This is a low level device access function, and should not normally ned to be used by user code. Instead can use stModeRx(), setModeTx(), setModeIdle()

[in]modeRF69 OPMODE to set, one of RH_RF69_OPMODE_MODE_*.

References RHSPIDriver::spiRead(), and RHSPIDriver::spiWrite().

Referenced by setModeIdle(), setModeRx(), and setModeTx().

◆ setPreambleLength()

void RH_RF69::setPreambleLength ( uint16_t  bytes)

Sets the length of the preamble in bytes. Caution: this should be set to the same value on all nodes in your network. Default is 4. Sets the message preamble length in REG_0?_PREAMBLE?SB

[in]bytesPreamble length in bytes.

References RHSPIDriver::spiWrite().

Referenced by init().

◆ setSyncWords()

void RH_RF69::setSyncWords ( const uint8_t *  syncWords = NULL,
uint8_t  len = 0 

Sets the sync words for transmit and receive Caution: SyncWords should be set to the same value on all nodes in your network. Nodes with different SyncWords set will never receive each others messages, so different SyncWords can be used to isolate different networks from each other. Default is { 0x2d, 0xd4 }. Caution: tests here show that with a single sync word (ie where len == 1), RFM69 reception can be unreliable.

[in]syncWordsArray of sync words, 1 to 4 octets long. NULL if no sync words to be used.
[in]lenNumber of sync words to set, 1 to 4. 0 if no sync words to be used.

References RHSPIDriver::spiBurstWrite(), RHSPIDriver::spiRead(), and RHSPIDriver::spiWrite().

Referenced by init().

◆ setTxPower()

void RH_RF69::setTxPower ( int8_t  power,
bool  ishighpowermodule = RH_RF69_DEFAULT_HIGHPOWER 

Sets the transmitter power output level. Be a good neighbour and set the lowest power level you need. Caution: legal power limits may apply in certain countries. After init(), the power will be set to 13dBm for a low power module. If you are using a high p[ower modfule such as an RFM69HW, you MUST set the power level with the ishighpowermodule flag set to true. Else you wil get no measurable power output. Simlarly if you are not using a high power module, you must NOT set the ishighpowermodule (which is the default)

[in]powerTransmitter power level in dBm. For RF69W (ishighpowermodule = false), valid values are from -18 to +13.; Values outside this range are trimmed. For RF69HW (ishighpowermodule = true), valid values are from -2 to +20. Caution: at +20dBm, duty cycle is limited to 1% and a maximum VSWR of 3:1 at the antenna port.
ishighpowermoduleSet to true if the connected module is a high power module RFM69HW

References _power, and RHSPIDriver::spiWrite().

Referenced by init().

◆ sleep()

bool RH_RF69::sleep ( )

Sets the radio into low-power sleep mode. If successful, the transport will stay in sleep mode until woken by changing mode it idle, transmit or receive (eg by calling send(), recv(), available() etc) Caution: there is a time penalty as the radio takes a finite time to wake from sleep mode.

true if sleep mode was successfully entered.

Reimplemented from RHGenericDriver.

References RHGenericDriver::_mode, RHGenericDriver::RHModeSleep, and RHSPIDriver::spiWrite().

◆ temperatureRead()

int8_t RH_RF69::temperatureRead ( )

Reads the on-chip temperature sensor. The RF69 must be in Idle mode (= RF69 Standby) to measure temperature. The measurement is uncalibrated and without calibration, you can expect it to be far from correct.

The measured temperature, in degrees C from -40 to 85 (uncalibrated)

References RHSPIDriver::spiRead(), and RHSPIDriver::spiWrite().

Member Data Documentation

◆ _myInterruptIndex

uint8_t RH_RF69::_myInterruptIndex

The index into _deviceForInterrupt[] for this device (if an interrupt is already allocated) else 0xff

Referenced by init(), and RH_RF69().

The documentation for this class was generated from the following files: