# RadioLib: src/modules/RF69/RF69.h Source File

RF69.h
#if !defined(_RADIOLIB_RF69_H)
#define _RADIOLIB_RF69_H
#include "../../TypeDef.h"
#if !defined(RADIOLIB_EXCLUDE_RF69)
#include "../../Module.h"
#include "../../protocols/PhysicalLayer/PhysicalLayer.h"
// RF69 physical layer properties
#define RADIOLIB_RF69_FREQUENCY_STEP_SIZE 61.03515625
#define RADIOLIB_RF69_MAX_PACKET_LENGTH 64
#define RADIOLIB_RF69_CRYSTAL_FREQ 32.0
#define RADIOLIB_RF69_DIV_EXPONENT 19
// RF69 register map
#define RADIOLIB_RF69_REG_FIFO 0x00
#define RADIOLIB_RF69_REG_OP_MODE 0x01
#define RADIOLIB_RF69_REG_DATA_MODUL 0x02
#define RADIOLIB_RF69_REG_BITRATE_MSB 0x03
#define RADIOLIB_RF69_REG_BITRATE_LSB 0x04
#define RADIOLIB_RF69_REG_FDEV_MSB 0x05
#define RADIOLIB_RF69_REG_FDEV_LSB 0x06
#define RADIOLIB_RF69_REG_FRF_MSB 0x07
#define RADIOLIB_RF69_REG_FRF_MID 0x08
#define RADIOLIB_RF69_REG_FRF_LSB 0x09
#define RADIOLIB_RF69_REG_OSC_1 0x0A
#define RADIOLIB_RF69_REG_AFC_CTRL 0x0B
#define RADIOLIB_RF69_REG_LISTEN_1 0x0D
#define RADIOLIB_RF69_REG_LISTEN_2 0x0E
#define RADIOLIB_RF69_REG_LISTEN_3 0x0F
#define RADIOLIB_RF69_REG_VERSION 0x10
#define RADIOLIB_RF69_REG_PA_LEVEL 0x11
#define RADIOLIB_RF69_REG_PA_RAMP 0x12
#define RADIOLIB_RF69_REG_OCP 0x13
#define RADIOLIB_RF69_REG_LNA 0x18
#define RADIOLIB_RF69_REG_RX_BW 0x19
#define RADIOLIB_RF69_REG_AFC_BW 0x1A
#define RADIOLIB_RF69_REG_OOK_PEAK 0x1B
#define RADIOLIB_RF69_REG_OOK_AVG 0x1C
#define RADIOLIB_RF69_REG_OOK_FIX 0x1D
#define RADIOLIB_RF69_REG_AFC_FEI 0x1E
#define RADIOLIB_RF69_REG_AFC_MSB 0x1F
#define RADIOLIB_RF69_REG_AFC_LSB 0x20
#define RADIOLIB_RF69_REG_FEI_MSB 0x21
#define RADIOLIB_RF69_REG_FEI_LSB 0x22
#define RADIOLIB_RF69_REG_RSSI_CONFIG 0x23
#define RADIOLIB_RF69_REG_RSSI_VALUE 0x24
#define RADIOLIB_RF69_REG_DIO_MAPPING_1 0x25
#define RADIOLIB_RF69_REG_DIO_MAPPING_2 0x26
#define RADIOLIB_RF69_REG_IRQ_FLAGS_1 0x27
#define RADIOLIB_RF69_REG_IRQ_FLAGS_2 0x28
#define RADIOLIB_RF69_REG_RSSI_THRESH 0x29
#define RADIOLIB_RF69_REG_RX_TIMEOUT_1 0x2A
#define RADIOLIB_RF69_REG_RX_TIMEOUT_2 0x2B
#define RADIOLIB_RF69_REG_PREAMBLE_MSB 0x2C
#define RADIOLIB_RF69_REG_PREAMBLE_LSB 0x2D
#define RADIOLIB_RF69_REG_SYNC_CONFIG 0x2E
#define RADIOLIB_RF69_REG_SYNC_VALUE_1 0x2F
#define RADIOLIB_RF69_REG_SYNC_VALUE_2 0x30
#define RADIOLIB_RF69_REG_SYNC_VALUE_3 0x31
#define RADIOLIB_RF69_REG_SYNC_VALUE_4 0x32
#define RADIOLIB_RF69_REG_SYNC_VALUE_5 0x33
#define RADIOLIB_RF69_REG_SYNC_VALUE_6 0x34
#define RADIOLIB_RF69_REG_SYNC_VALUE_7 0x35
#define RADIOLIB_RF69_REG_SYNC_VALUE_8 0x36
#define RADIOLIB_RF69_REG_PACKET_CONFIG_1 0x37
#define RADIOLIB_RF69_REG_PAYLOAD_LENGTH 0x38
#define RADIOLIB_RF69_REG_NODE_ADRS 0x39
#define RADIOLIB_RF69_REG_BROADCAST_ADRS 0x3A
#define RADIOLIB_RF69_REG_AUTO_MODES 0x3B
#define RADIOLIB_RF69_REG_FIFO_THRESH 0x3C
#define RADIOLIB_RF69_REG_PACKET_CONFIG_2 0x3D
#define RADIOLIB_RF69_REG_AES_KEY_1 0x3E
#define RADIOLIB_RF69_REG_AES_KEY_2 0x3F
#define RADIOLIB_RF69_REG_AES_KEY_3 0x40
#define RADIOLIB_RF69_REG_AES_KEY_4 0x41
#define RADIOLIB_RF69_REG_AES_KEY_5 0x42
#define RADIOLIB_RF69_REG_AES_KEY_6 0x43
#define RADIOLIB_RF69_REG_AES_KEY_7 0x44
#define RADIOLIB_RF69_REG_AES_KEY_8 0x45
#define RADIOLIB_RF69_REG_AES_KEY_9 0x46
#define RADIOLIB_RF69_REG_AES_KEY_10 0x47
#define RADIOLIB_RF69_REG_AES_KEY_11 0x48
#define RADIOLIB_RF69_REG_AES_KEY_12 0x49
#define RADIOLIB_RF69_REG_AES_KEY_13 0x4A
#define RADIOLIB_RF69_REG_AES_KEY_14 0x4B
#define RADIOLIB_RF69_REG_AES_KEY_15 0x4C
#define RADIOLIB_RF69_REG_AES_KEY_16 0x4D
#define RADIOLIB_RF69_REG_TEMP_1 0x4E
#define RADIOLIB_RF69_REG_TEMP_2 0x4F
#define RADIOLIB_RF69_REG_TEST_LNA 0x58
#define RADIOLIB_RF69_REG_TEST_PA1 0x5A
#define RADIOLIB_RF69_REG_TEST_PA2 0x5C
#define RADIOLIB_RF69_REG_TEST_DAGC 0x6F
// RF69 modem settings
// RADIOLIB_RF69_REG_OP_MODE MSB LSB DESCRIPTION
#define RADIOLIB_RF69_SEQUENCER_OFF 0b00000000 // 7 7 disable automatic sequencer
#define RADIOLIB_RF69_SEQUENCER_ON 0b10000000 // 7 7 enable automatic sequencer
#define RADIOLIB_RF69_LISTEN_OFF 0b00000000 // 6 6 disable Listen mode
#define RADIOLIB_RF69_LISTEN_ON 0b01000000 // 6 6 enable Listen mode
#define RADIOLIB_RF69_LISTEN_ABORT 0b00100000 // 5 5 abort Listen mode (has to be set together with RF69_LISTEN_OFF)
#define RADIOLIB_RF69_SLEEP 0b00000000 // 4 2 sleep
#define RADIOLIB_RF69_STANDBY 0b00000100 // 4 2 standby
#define RADIOLIB_RF69_FS 0b00001000 // 4 2 frequency synthesis
#define RADIOLIB_RF69_TX 0b00001100 // 4 2 transmit
#define RADIOLIB_RF69_RX 0b00010000 // 4 2 receive
// RADIOLIB_RF69_REG_DATA_MODUL
#define RADIOLIB_RF69_PACKET_MODE 0b00000000 // 6 5 packet mode (default)
#define RADIOLIB_RF69_CONTINUOUS_MODE_WITH_SYNC 0b01000000 // 6 5 continuous mode with bit synchronizer
#define RADIOLIB_RF69_CONTINUOUS_MODE 0b01100000 // 6 5 continuous mode without bit synchronizer
#define RADIOLIB_RF69_FSK 0b00000000 // 4 3 modulation: FSK (default)
#define RADIOLIB_RF69_OOK 0b00001000 // 4 3 OOK
#define RADIOLIB_RF69_NO_SHAPING 0b00000000 // 1 0 modulation shaping: no shaping (default)
#define RADIOLIB_RF69_FSK_GAUSSIAN_1_0 0b00000001 // 1 0 FSK modulation Gaussian filter, BT = 1.0
#define RADIOLIB_RF69_FSK_GAUSSIAN_0_5 0b00000010 // 1 0 FSK modulation Gaussian filter, BT = 0.5
#define RADIOLIB_RF69_FSK_GAUSSIAN_0_3 0b00000011 // 1 0 FSK modulation Gaussian filter, BT = 0.3
#define RADIOLIB_RF69_OOK_FILTER_BR 0b00000001 // 1 0 OOK modulation filter, f_cutoff = BR
#define RADIOLIB_RF69_OOK_FILTER_2BR 0b00000010 // 1 0 OOK modulation filter, f_cutoff = 2*BR
// RADIOLIB_RF69_REG_BITRATE_MSB + REG_BITRATE_LSB
#define RADIOLIB_RF69_BITRATE_MSB 0x1A // 7 0 bit rate setting: rate = F(XOSC) / BITRATE
#define RADIOLIB_RF69_BITRATE_LSB 0x0B // 7 0 default value: 4.8 kbps
// RADIOLIB_RF69_REG_FDEV_MSB + REG_FDEV_LSB
#define RADIOLIB_RF69_FDEV_MSB 0x00 // 5 0 frequency deviation: f_dev = f_step * FDEV
#define RADIOLIB_RF69_FDEV_LSB 0x52 // 7 0 default value: 5 kHz
// RADIOLIB_RF69_REG_FRF_MSB + REG_FRF_MID + REG_FRF_LSB
#define RADIOLIB_RF69_FRF_MSB 0xE4 // 7 0 carrier frequency setting: f_RF = (F(XOSC) * FRF)/2^19
#define RADIOLIB_RF69_FRF_MID 0xC0 // 7 0 where F(XOSC) = 32 MHz
#define RADIOLIB_RF69_FRF_LSB 0x00 // 7 0 default value: 915 MHz
// RADIOLIB_RF69_REG_OSC_1
#define RADIOLIB_RF69_RC_CAL_START 0b10000000 // 7 7 force RC oscillator calibration
#define RADIOLIB_RF69_RC_CAL_RUNNING 0b00000000 // 6 6 RC oscillator calibration is still running
#define RADIOLIB_RF69_RC_CAL_DONE 0b00000000 // 5 5 RC oscillator calibration has finished
// RADIOLIB_RF69_REG_AFC_CTRL
#define RADIOLIB_RF69_AFC_LOW_BETA_OFF 0b00000000 // 5 5 standard AFC routine
#define RADIOLIB_RF69_AFC_LOW_BETA_ON 0b00100000 // 5 5 improved AFC routine for signals with modulation index less than 2
// RADIOLIB_RF69_REG_LISTEN_1
#define RADIOLIB_RF69_LISTEN_RES_IDLE_64_US 0b01000000 // 7 6 resolution of Listen mode idle time: 64 us
#define RADIOLIB_RF69_LISTEN_RES_IDLE_4_1_MS 0b10000000 // 7 6 4.1 ms (default)
#define RADIOLIB_RF69_LISTEN_RES_IDLE_262_MS 0b11000000 // 7 6 262 ms
#define RADIOLIB_RF69_LISTEN_RES_RX_64_US 0b00010000 // 5 4 resolution of Listen mode rx time: 64 us (default)
#define RADIOLIB_RF69_LISTEN_RES_RX_4_1_MS 0b00100000 // 5 4 4.1 ms
#define RADIOLIB_RF69_LISTEN_RES_RX_262_MS 0b00110000 // 5 4 262 ms
#define RADIOLIB_RF69_LISTEN_ACCEPT_ABOVE_RSSI_THRESH 0b00000000 // 3 3 packet acceptance criteria: RSSI above threshold
#define RADIOLIB_RF69_LISTEN_ACCEPT_MATCH_SYNC_ADDRESS 0b00001000 // 3 3 RSSI above threshold AND sync address matched
#define RADIOLIB_RF69_LISTEN_END_KEEP_RX 0b00000000 // 2 1 action after packet acceptance: stay in Rx mode
#define RADIOLIB_RF69_LISTEN_END_KEEP_RX_TIMEOUT 0b00000010 // 2 1 stay in Rx mode until timeout (default)
#define RADIOLIB_RF69_LISTEN_END_KEEP_RX_TIMEOUT_RESUME 0b00000100 // 2 1 stay in Rx mode until timeout, Listen mode will resume
// RADIOLIB_RF69_REG_LISTEN_2
#define RADIOLIB_RF69_LISTEN_COEF_IDLE 0xF5 // 7 0 duration of idle phase in Listen mode
// RADIOLIB_RF69_REG_LISTEN_3
#define RADIOLIB_RF69_LISTEN_COEF_RX 0x20 // 7 0 duration of Rx phase in Listen mode
// RADIOLIB_RF69_REG_VERSION
#define RADIOLIB_RF69_CHIP_VERSION 0x24 // 7 0
// RADIOLIB_RF69_REG_PA_LEVEL
#define RADIOLIB_RF69_PA0_OFF 0b00000000 // 7 7 PA0 disabled
#define RADIOLIB_RF69_PA0_ON 0b10000000 // 7 7 PA0 enabled (default)
#define RADIOLIB_RF69_PA1_OFF 0b00000000 // 6 6 PA1 disabled (default)
#define RADIOLIB_RF69_PA1_ON 0b01000000 // 6 6 PA1 enabled
#define RADIOLIB_RF69_PA2_OFF 0b00000000 // 5 5 PA2 disabled (default)
#define RADIOLIB_RF69_PA2_ON 0b00100000 // 5 5 PA2 enabled
#define RADIOLIB_RF69_OUTPUT_POWER 0b00011111 // 4 0 output power: P_out = -18 + OUTPUT_POWER
// RADIOLIB_RF69_REG_PA_RAMP
#define RADIOLIB_RF69_PA_RAMP_3_4_MS 0b00000000 // 3 0 PA ramp rise/fall time: 3.4 ms
#define RADIOLIB_RF69_PA_RAMP_2_MS 0b00000001 // 3 0 2 ms
#define RADIOLIB_RF69_PA_RAMP_1_MS 0b00000010 // 3 0 1 ms
#define RADIOLIB_RF69_PA_RAMP_500_US 0b00000011 // 3 0 500 us
#define RADIOLIB_RF69_PA_RAMP_250_US 0b00000100 // 3 0 250 us
#define RADIOLIB_RF69_PA_RAMP_125_US 0b00000101 // 3 0 125 us
#define RADIOLIB_RF69_PA_RAMP_100_US 0b00000110 // 3 0 100 us
#define RADIOLIB_RF69_PA_RAMP_62_US 0b00000111 // 3 0 62 us
#define RADIOLIB_RF69_PA_RAMP_50_US 0b00001000 // 3 0 50 us
#define RADIOLIB_RF69_PA_RAMP_40_US 0b00001001 // 3 0 40 us (default)
#define RADIOLIB_RF69_PA_RAMP_31_US 0b00001010 // 3 0 31 us
#define RADIOLIB_RF69_PA_RAMP_25_US 0b00001011 // 3 0 25 us
#define RADIOLIB_RF69_PA_RAMP_20_US 0b00001100 // 3 0 20 us
#define RADIOLIB_RF69_PA_RAMP_15_US 0b00001101 // 3 0 15 us
#define RADIOLIB_RF69_PA_RAMP_12_US 0b00001110 // 3 0 12 us
#define RADIOLIB_RF69_PA_RAMP_10_US 0b00001111 // 3 0 10 us
// RADIOLIB_RF69_REG_OCP
#define RADIOLIB_RF69_OCP_OFF 0b00000000 // 4 4 PA overload current protection disabled
#define RADIOLIB_RF69_OCP_ON 0b00010000 // 4 4 PA overload current protection enabled
#define RADIOLIB_RF69_OCP_TRIM 0b00001010 // 3 0 OCP current: I_max(OCP_TRIM = 0b1010) = 95 mA
// RADIOLIB_RF69_REG_LNA
#define RADIOLIB_RF69_LNA_Z_IN_50_OHM 0b00000000 // 7 7 LNA input impedance: 50 ohm
#define RADIOLIB_RF69_LNA_Z_IN_200_OHM 0b10000000 // 7 7 200 ohm
#define RADIOLIB_RF69_LNA_CURRENT_GAIN 0b00001000 // 5 3 manually set LNA current gain
#define RADIOLIB_RF69_LNA_GAIN_AUTO 0b00000000 // 2 0 LNA gain setting: set automatically by AGC
#define RADIOLIB_RF69_LNA_GAIN_MAX 0b00000001 // 2 0 max gain
#define RADIOLIB_RF69_LNA_GAIN_MAX_6_DB 0b00000010 // 2 0 max gain - 6 dB
#define RADIOLIB_RF69_LNA_GAIN_MAX_12_DB 0b00000011 // 2 0 max gain - 12 dB
#define RADIOLIB_RF69_LNA_GAIN_MAX_24_DB 0b00000100 // 2 0 max gain - 24 dB
#define RADIOLIB_RF69_LNA_GAIN_MAX_36_DB 0b00000101 // 2 0 max gain - 36 dB
#define RADIOLIB_RF69_LNA_GAIN_MAX_48_DB 0b00000110 // 2 0 max gain - 48 dB
// RADIOLIB_RF69_REG_RX_BW
#define RADIOLIB_RF69_DCC_FREQ 0b01000000 // 7 5 DC offset canceller cutoff frequency (4% Rx BW by default)
#define RADIOLIB_RF69_RX_BW_MANT_16 0b00000000 // 4 3 Channel filter bandwidth FSK: RxBw = F(XOSC)/(RxBwMant * 2^(RxBwExp + 2))
#define RADIOLIB_RF69_RX_BW_MANT_20 0b00001000 // 4 3 OOK: RxBw = F(XOSC)/(RxBwMant * 2^(RxBwExp + 3))
#define RADIOLIB_RF69_RX_BW_MANT_24 0b00010000 // 4 3
#define RADIOLIB_RF69_RX_BW_EXP 0b00000101 // 2 0 default RxBwExp value = 5
// RADIOLIB_RF69_REG_AFC_BW
#define RADIOLIB_RF69_DCC_FREQ_AFC 0b10000000 // 7 5 default DccFreq parameter for AFC
#define RADIOLIB_RF69_DCC_RX_BW_MANT_AFC 0b00001000 // 4 3 default RxBwMant parameter for AFC
#define RADIOLIB_RF69_DCC_RX_BW_EXP_AFC 0b00000011 // 2 0 default RxBwExp parameter for AFC
// RADIOLIB_RF69_REG_OOK_PEAK
#define RADIOLIB_RF69_OOK_THRESH_FIXED 0b00000000 // 7 6 OOK threshold type: fixed
#define RADIOLIB_RF69_OOK_THRESH_PEAK 0b01000000 // 7 6 peak (default)
#define RADIOLIB_RF69_OOK_THRESH_AVERAGE 0b10000000 // 7 6 average
#define RADIOLIB_RF69_OOK_PEAK_THRESH_STEP_0_5_DB 0b00000000 // 5 3 OOK demodulator step size: 0.5 dB (default)
#define RADIOLIB_RF69_OOK_PEAK_THRESH_STEP_1_0_DB 0b00001000 // 5 3 1.0 dB
#define RADIOLIB_RF69_OOK_PEAK_THRESH_STEP_1_5_DB 0b00010000 // 5 3 1.5 dB
#define RADIOLIB_RF69_OOK_PEAK_THRESH_STEP_2_0_DB 0b00011000 // 5 3 2.0 dB
#define RADIOLIB_RF69_OOK_PEAK_THRESH_STEP_3_0_DB 0b00100000 // 5 3 3.0 dB
#define RADIOLIB_RF69_OOK_PEAK_THRESH_STEP_4_0_DB 0b00101000 // 5 3 4.0 dB
#define RADIOLIB_RF69_OOK_PEAK_THRESH_STEP_5_0_DB 0b00110000 // 5 3 5.0 dB
#define RADIOLIB_RF69_OOK_PEAK_THRESH_STEP_6_0_DB 0b00111000 // 5 3 6.0 dB
#define RADIOLIB_RF69_OOK_PEAK_THRESH_DEC_1_1_CHIP 0b00000000 // 2 0 OOK demodulator step period: once per chip (default)
#define RADIOLIB_RF69_OOK_PEAK_THRESH_DEC_1_2_CHIP 0b00000001 // 2 0 once every 2 chips
#define RADIOLIB_RF69_OOK_PEAK_THRESH_DEC_1_4_CHIP 0b00000010 // 2 0 once every 4 chips
#define RADIOLIB_RF69_OOK_PEAK_THRESH_DEC_1_8_CHIP 0b00000011 // 2 0 once every 8 chips
#define RADIOLIB_RF69_OOK_PEAK_THRESH_DEC_2_1_CHIP 0b00000100 // 2 0 2 times per chip
#define RADIOLIB_RF69_OOK_PEAK_THRESH_DEC_4_1_CHIP 0b00000101 // 2 0 4 times per chip
#define RADIOLIB_RF69_OOK_PEAK_THRESH_DEC_8_1_CHIP 0b00000110 // 2 0 8 times per chip
#define RADIOLIB_RF69_OOK_PEAK_THRESH_DEC_16_1_CHIP 0b00000111 // 2 0 16 times per chip
// RADIOLIB_RF69_REG_OOK_AVG
#define RADIOLIB_RF69_OOK_AVG_THRESH_FILT_32_PI 0b00000000 // 7 6 OOK average filter coefficient: chip rate / 32*pi
#define RADIOLIB_RF69_OOK_AVG_THRESH_FILT_8_PI 0b01000000 // 7 6 chip rate / 8*pi
#define RADIOLIB_RF69_OOK_AVG_THRESH_FILT_4_PI 0b10000000 // 7 6 chip rate / 4*pi (default)
#define RADIOLIB_RF69_OOK_AVG_THRESH_FILT_2_PI 0b11000000 // 7 6 chip rate / 2*pi
// RADIOLIB_RF69_REG_OOK_FIX
#define RADIOLIB_RF69_OOK_FIXED_THRESH 0b00000110 // 7 0 default OOK fixed threshold (6 dB)
// RADIOLIB_RF69_REG_AFC_FEI
#define RADIOLIB_RF69_FEI_RUNNING 0b00000000 // 6 6 FEI status: on-going
#define RADIOLIB_RF69_FEI_DONE 0b01000000 // 6 6 done
#define RADIOLIB_RF69_FEI_START 0b00100000 // 5 5 force new FEI measurement
#define RADIOLIB_RF69_AFC_RUNNING 0b00000000 // 4 4 AFC status: on-going
#define RADIOLIB_RF69_AFC_DONE 0b00010000 // 4 4 done
#define RADIOLIB_RF69_AFC_AUTOCLEAR_OFF 0b00000000 // 3 3 AFC register autoclear disabled
#define RADIOLIB_RF69_AFC_AUTOCLEAR_ON 0b00001000 // 3 3 AFC register autoclear enabled
#define RADIOLIB_RF69_AFC_AUTO_OFF 0b00000000 // 2 2 perform AFC only manually
#define RADIOLIB_RF69_AFC_AUTO_ON 0b00000100 // 2 2 perform AFC each time Rx mode is started
#define RADIOLIB_RF69_AFC_CLEAR 0b00000010 // 1 1 clear AFC register
#define RADIOLIB_RF69_AFC_START 0b00000001 // 0 0 start AFC
// RADIOLIB_RF69_REG_RSSI_CONFIG
#define RADIOLIB_RF69_RSSI_RUNNING 0b00000000 // 1 1 RSSI status: on-going
#define RADIOLIB_RF69_RSSI_DONE 0b00000010 // 1 1 done
#define RADIOLIB_RF69_RSSI_START 0b00000001 // 0 0 start RSSI measurement
// RADIOLIB_RF69_REG_DIO_MAPPING_1
#define RADIOLIB_RF69_DIO0_CONT_MODE_READY 0b11000000 // 7 6
#define RADIOLIB_RF69_DIO0_CONT_PLL_LOCK 0b00000000 // 7 6
#define RADIOLIB_RF69_DIO0_CONT_SYNC_ADDRESS 0b00000000 // 7 6
#define RADIOLIB_RF69_DIO0_CONT_TIMEOUT 0b01000000 // 7 6
#define RADIOLIB_RF69_DIO0_CONT_RSSI 0b10000000 // 7 6
#define RADIOLIB_RF69_DIO0_CONT_TX_READY 0b01000000 // 7 6
#define RADIOLIB_RF69_DIO0_PACK_PLL_LOCK 0b11000000 // 7 6
#define RADIOLIB_RF69_DIO0_PACK_CRC_OK 0b00000000 // 7 6
#define RADIOLIB_RF69_DIO0_PACK_PAYLOAD_READY 0b01000000 // 7 6
#define RADIOLIB_RF69_DIO0_PACK_SYNC_ADDRESS 0b10000000 // 7 6
#define RADIOLIB_RF69_DIO0_PACK_RSSI 0b11000000 // 7 6
#define RADIOLIB_RF69_DIO0_PACK_PACKET_SENT 0b00000000 // 7 6
#define RADIOLIB_RF69_DIO0_PACK_TX_READY 0b01000000 // 7 6
#define RADIOLIB_RF69_DIO1_CONT_PLL_LOCK 0b00110000 // 5 4
#define RADIOLIB_RF69_DIO1_CONT_DCLK 0b00000000 // 5 4
#define RADIOLIB_RF69_DIO1_CONT_RX_READY 0b00010000 // 5 4
#define RADIOLIB_RF69_DIO1_CONT_SYNC_ADDRESS 0b00110000 // 5 4
#define RADIOLIB_RF69_DIO1_CONT_TX_READY 0b00010000 // 5 4
#define RADIOLIB_RF69_DIO1_PACK_FIFO_LEVEL 0b00000000 // 5 4
#define RADIOLIB_RF69_DIO1_PACK_FIFO_FULL 0b00010000 // 5 4
#define RADIOLIB_RF69_DIO1_PACK_FIFO_NOT_EMPTY 0b00100000 // 5 4
#define RADIOLIB_RF69_DIO1_PACK_PLL_LOCK 0b00110000 // 5 4
#define RADIOLIB_RF69_DIO1_PACK_TIMEOUT 0b00110000 // 5 4
#define RADIOLIB_RF69_DIO2_CONT_DATA 0b00000000 // 3 2
#define RADIOLIB_RF69_DIO2_PACK_FIFO_NOT_EMPTY 0b00000000 // 3 2
#define RADIOLIB_RF69_DIO2_PACK_AUTO_MODE 0b00001100 // 3 2
#define RADIOLIB_RF69_DIO2_PACK_DATA 0b00000100 // 3 2
#define RADIOLIB_RF69_DIO3_CONT_AUTO_MODE 0b00000010 // 0 1
#define RADIOLIB_RF69_DIO3_CONT_RSSI 0b00000000 // 0 1
#define RADIOLIB_RF69_DIO3_CONT_RX_READY 0b00000001 // 0 1
#define RADIOLIB_RF69_DIO3_CONT_TIMEOUT 0b00000011 // 0 1
#define RADIOLIB_RF69_DIO3_CONT_TX_READY 0b00000001 // 0 1
#define RADIOLIB_RF69_DIO3_PACK_FIFO_FULL 0b00000000 // 0 1
#define RADIOLIB_RF69_DIO3_PACK_PLL_LOCK 0b00000011 // 0 1
#define RADIOLIB_RF69_DIO3_PACK_RSSI 0b00000001 // 0 1
#define RADIOLIB_RF69_DIO3_PACK_SYNC_ADDRESSS 0b00000010 // 0 1
#define RADIOLIB_RF69_DIO3_PACK_TX_READY 0b00000001 // 0 1
// RADIOLIB_RF69_REG_DIO_MAPPING_2
#define RADIOLIB_RF69_DIO4_CONT_PLL_LOCK 0b11000000 // 7 6
#define RADIOLIB_RF69_DIO4_CONT_TIMEOUT 0b00000000 // 7 6
#define RADIOLIB_RF69_DIO4_CONT_RX_READY 0b01000000 // 7 6
#define RADIOLIB_RF69_DIO4_CONT_SYNC_ADDRESS 0b10000000 // 7 6
#define RADIOLIB_RF69_DIO4_CONT_TX_READY 0b01000000 // 7 6
#define RADIOLIB_RF69_DIO4_PACK_PLL_LOCK 0b11000000 // 7 6
#define RADIOLIB_RF69_DIO4_PACK_TIMEOUT 0b00000000 // 7 6
#define RADIOLIB_RF69_DIO4_PACK_RSSI 0b01000000 // 7 6
#define RADIOLIB_RF69_DIO4_PACK_RX_READY 0b10000000 // 7 6
#define RADIOLIB_RF69_DIO4_PACK_MODE_READY 0b00000000 // 7 6
#define RADIOLIB_RF69_DIO4_PACK_TX_READY 0b01000000 // 7 6
#define RADIOLIB_RF69_DIO5_CONT_MODE_READY 0b00110000 // 5 4
#define RADIOLIB_RF69_DIO5_CONT_CLK_OUT 0b00000000 // 5 4
#define RADIOLIB_RF69_DIO5_CONT_RSSI 0b00010000 // 5 4
#define RADIOLIB_RF69_DIO5_PACK_MODE_READY 0b00110000 // 5 4
#define RADIOLIB_RF69_DIO5_PACK_CLK_OUT 0b00000000 // 5 4
#define RADIOLIB_RF69_DIO5_PACK_DATA 0b00010000 // 5 4
#define RADIOLIB_RF69_CLK_OUT_FXOSC 0b00000000 // 2 0 ClkOut frequency: F(XOSC)
#define RADIOLIB_RF69_CLK_OUT_FXOSC_2 0b00000001 // 2 0 F(XOSC) / 2
#define RADIOLIB_RF69_CLK_OUT_FXOSC_4 0b00000010 // 2 0 F(XOSC) / 4
#define RADIOLIB_RF69_CLK_OUT_FXOSC_8 0b00000011 // 2 0 F(XOSC) / 8
#define RADIOLIB_RF69_CLK_OUT_FXOSC_16 0b00000100 // 2 0 F(XOSC) / 16
#define RADIOLIB_RF69_CLK_OUT_FXOSC_32 0b00000101 // 2 0 F(XOSC) / 31
#define RADIOLIB_RF69_CLK_OUT_RC 0b00000110 // 2 0 RC
#define RADIOLIB_RF69_CLK_OUT_OFF 0b00000111 // 2 0 disabled (default)
// RADIOLIB_RF69_REG_IRQ_FLAGS_1
#define RADIOLIB_RF69_IRQ_MODE_READY 0b10000000 // 7 7 requested mode was set
#define RADIOLIB_RF69_IRQ_RX_READY 0b01000000 // 6 6 Rx mode ready
#define RADIOLIB_RF69_IRQ_TX_READY 0b00100000 // 5 5 Tx mode ready
#define RADIOLIB_RF69_IRQ_PLL_LOCK 0b00010000 // 4 4 PLL is locked
#define RADIOLIB_RF69_IRQ_RSSI 0b00001000 // 3 3 RSSI value exceeded RssiThreshold
#define RADIOLIB_RF69_IRQ_TIMEOUT 0b00000100 // 2 2 timeout occurred
#define RADIOLIB_RF69_IRQ_AUTO_MODE 0b00000010 // 1 1 entered intermediate mode
#define RADIOLIB_RF69_SYNC_ADDRESS_MATCH 0b00000001 // 0 0 sync address detected
// RADIOLIB_RF69_REG_IRQ_FLAGS_2
#define RADIOLIB_RF69_IRQ_FIFO_FULL 0b10000000 // 7 7 FIFO is full
#define RADIOLIB_RF69_IRQ_FIFO_NOT_EMPTY 0b01000000 // 6 6 FIFO contains at least 1 byte
#define RADIOLIB_RF69_IRQ_FIFO_LEVEL 0b00100000 // 5 5 FIFO contains more than FifoThreshold bytes
#define RADIOLIB_RF69_IRQ_FIFO_OVERRUN 0b00010000 // 4 4 FIFO overrun occurred
#define RADIOLIB_RF69_IRQ_PACKET_SENT 0b00001000 // 3 3 packet was sent
#define RADIOLIB_RF69_IRQ_PAYLOAD_READY 0b00000100 // 2 2 last payload byte received and CRC check passed
#define RADIOLIB_RF69_IRQ_CRC_OK 0b00000010 // 1 1 CRC check passed
// RADIOLIB_RF69_REG_RSSI_THRESH
#define RADIOLIB_RF69_RSSI_THRESHOLD 0xE4 // 7 0 RSSI threshold level (2 dB by default)
// RADIOLIB_RF69_REG_RX_TIMEOUT_1
#define RADIOLIB_RF69_TIMEOUT_RX_START_OFF 0x00 // 7 0 RSSI interrupt timeout disabled (default)
#define RADIOLIB_RF69_TIMEOUT_RX_START 0xFF // 7 0 timeout will occur if RSSI interrupt is not received
// RADIOLIB_RF69_REG_RX_TIMEOUT_2
#define RADIOLIB_RF69_TIMEOUT_RSSI_THRESH_OFF 0x00 // 7 0 PayloadReady interrupt timeout disabled (default)
#define RADIOLIB_RF69_TIMEOUT_RSSI_THRESH 0xFF // 7 0 timeout will occur if PayloadReady interrupt is not received
// RADIOLIB_RF69_REG_PREAMBLE_MSB + REG_PREAMBLE_MSB
#define RADIOLIB_RF69_PREAMBLE_MSB 0x00 // 7 0 2-byte preamble size value
#define RADIOLIB_RF69_PREAMBLE_LSB 0x03 // 7 0
// RADIOLIB_RF69_REG_SYNC_CONFIG
#define RADIOLIB_RF69_SYNC_OFF 0b00000000 // 7 7 sync word detection off
#define RADIOLIB_RF69_SYNC_ON 0b10000000 // 7 7 sync word detection on (default)
#define RADIOLIB_RF69_FIFO_FILL_CONDITION_SYNC 0b00000000 // 6 6 FIFO fill condition: on SyncAddress interrupt (default)
#define RADIOLIB_RF69_FIFO_FILL_CONDITION 0b01000000 // 6 6 as long as the bit is set
#define RADIOLIB_RF69_SYNC_SIZE 0b00001000 // 5 3 size of sync word: SyncSize + 1 bytes
#define RADIOLIB_RF69_SYNC_TOL 0b00000000 // 2 0 number of tolerated errors in sync word
// RADIOLIB_RF69_REG_SYNC_VALUE_1 - SYNC_VALUE_8
#define RADIOLIB_RF69_SYNC_BYTE_1 0x01 // 7 0 sync word: 1st byte (MSB)
#define RADIOLIB_RF69_SYNC_BYTE_2 0x01 // 7 0 2nd byte
#define RADIOLIB_RF69_SYNC_BYTE_3 0x01 // 7 0 3rd byte
#define RADIOLIB_RF69_SYNC_BYTE_4 0x01 // 7 0 4th byte
#define RADIOLIB_RF69_SYNC_BYTE_5 0x01 // 7 0 5th byte
#define RADIOLIB_RF69_SYNC_BYTE_6 0x01 // 7 0 6th byte
#define RADIOLIB_RF69_SYNC_BYTE_7 0x01 // 7 0 7th byte
#define RADIOLIB_RF69_SYNC_BYTE_8 0x01 // 7 0 8th byte (LSB)
// RADIOLIB_RF69_REG_PACKET_CONFIG_1
#define RADIOLIB_RF69_PACKET_FORMAT_FIXED 0b00000000 // 7 7 fixed packet length (default)
#define RADIOLIB_RF69_PACKET_FORMAT_VARIABLE 0b10000000 // 7 7 variable packet length
#define RADIOLIB_RF69_DC_FREE_NONE 0b00000000 // 6 5 DC-free encoding: none (default)
#define RADIOLIB_RF69_DC_FREE_MANCHESTER 0b00100000 // 6 5 Manchester
#define RADIOLIB_RF69_DC_FREE_WHITENING 0b01000000 // 6 5 Whitening
#define RADIOLIB_RF69_CRC_OFF 0b00000000 // 4 4 CRC disabled
#define RADIOLIB_RF69_CRC_ON 0b00010000 // 4 4 CRC enabled (default)
#define RADIOLIB_RF69_CRC_AUTOCLEAR_ON 0b00000000 // 3 3 discard packet when CRC check fails (default)
#define RADIOLIB_RF69_CRC_AUTOCLEAR_OFF 0b00001000 // 3 3 keep packet when CRC check fails
#define RADIOLIB_RF69_ADDRESS_FILTERING_OFF 0b00000000 // 2 1 address filtering: none (default)
#define RADIOLIB_RF69_ADDRESS_FILTERING_NODE 0b00000010 // 2 1 node
#define RADIOLIB_RF69_ADDRESS_FILTERING_NODE_BROADCAST 0b00000100 // 2 1 node or broadcast
// RADIOLIB_RF69_REG_PAYLOAD_LENGTH
#define RADIOLIB_RF69_PAYLOAD_LENGTH 0xFF // 7 0 payload length
// RADIOLIB_RF69_REG_AUTO_MODES
#define RADIOLIB_RF69_ENTER_COND_NONE 0b00000000 // 7 5 condition for entering intermediate mode: none, AutoModes disabled (default)
#define RADIOLIB_RF69_ENTER_COND_FIFO_NOT_EMPTY 0b00100000 // 7 5 FifoNotEmpty rising edge
#define RADIOLIB_RF69_ENTER_COND_FIFO_LEVEL 0b01000000 // 7 5 FifoLevel rising edge
#define RADIOLIB_RF69_ENTER_COND_CRC_OK 0b01100000 // 7 5 CrcOk rising edge
#define RADIOLIB_RF69_ENTER_COND_PAYLOAD_READY 0b10000000 // 7 5 PayloadReady rising edge
#define RADIOLIB_RF69_ENTER_COND_SYNC_ADDRESS 0b10100000 // 7 5 SyncAddress rising edge
#define RADIOLIB_RF69_ENTER_COND_PACKET_SENT 0b11000000 // 7 5 PacketSent rising edge
#define RADIOLIB_RF69_ENTER_COND_FIFO_EMPTY 0b11100000 // 7 5 FifoNotEmpty falling edge
#define RADIOLIB_RF69_EXIT_COND_NONE 0b00000000 // 4 2 condition for exiting intermediate mode: none, AutoModes disabled (default)
#define RADIOLIB_RF69_EXIT_COND_FIFO_EMPTY 0b00100000 // 4 2 FifoNotEmpty falling edge
#define RADIOLIB_RF69_EXIT_COND_FIFO_LEVEL 0b01000000 // 4 2 FifoLevel rising edge
#define RADIOLIB_RF69_EXIT_COND_CRC_OK 0b01100000 // 4 2 CrcOk rising edge
#define RADIOLIB_RF69_EXIT_COND_PAYLOAD_READY 0b10000000 // 4 2 PayloadReady rising edge
#define RADIOLIB_RF69_EXIT_COND_SYNC_ADDRESS 0b10100000 // 4 2 SyncAddress rising edge
#define RADIOLIB_RF69_EXIT_COND_PACKET_SENT 0b11000000 // 4 2 PacketSent rising edge
#define RADIOLIB_RF69_EXIT_COND_TIMEOUT 0b11100000 // 4 2 timeout rising edge
#define RADIOLIB_RF69_INTER_MODE_SLEEP 0b00000000 // 1 0 intermediate mode: sleep (default)
#define RADIOLIB_RF69_INTER_MODE_STANDBY 0b00000001 // 1 0 standby
#define RADIOLIB_RF69_INTER_MODE_RX 0b00000010 // 1 0 Rx
#define RADIOLIB_RF69_INTER_MODE_TX 0b00000011 // 1 0 Tx
// RADIOLIB_RF69_REG_FIFO_THRESH
#define RADIOLIB_RF69_TX_START_CONDITION_FIFO_LEVEL 0b00000000 // 7 7 packet transmission start condition: FifoLevel
#define RADIOLIB_RF69_TX_START_CONDITION_FIFO_NOT_EMPTY 0b10000000 // 7 7 FifoNotEmpty (default)
#define RADIOLIB_RF69_FIFO_THRESH 0x1F // 6 0 default threshold to trigger FifoLevel interrupt
// RADIOLIB_RF69_REG_PACKET_CONFIG_2
#define RADIOLIB_RF69_INTER_PACKET_RX_DELAY 0b00000000 // 7 4 delay between FIFO empty and start of new RSSI phase
#define RADIOLIB_RF69_RESTART_RX 0b00000100 // 2 2 force receiver into wait mode
#define RADIOLIB_RF69_AUTO_RX_RESTART_OFF 0b00000000 // 1 1 auto Rx restart disabled
#define RADIOLIB_RF69_AUTO_RX_RESTART_ON 0b00000010 // 1 1 auto Rx restart enabled (default)
#define RADIOLIB_RF69_AES_OFF 0b00000000 // 0 0 AES encryption disabled (default)
#define RADIOLIB_RF69_AES_ON 0b00000001 // 0 0 AES encryption enabled, payload size limited to 66 bytes
// RADIOLIB_RF69_REG_TEST_LNA
#define RADIOLIB_RF69_TEST_LNA_BOOST_NORMAL 0x1B // 7 0
#define RADIOLIB_RF69_TEST_LNA_BOOST_HIGH 0x2D // 7 0
// RADIOLIB_RF69_REG_TEMP_1
#define RADIOLIB_RF69_TEMP_MEAS_START 0b00001000 // 3 3 trigger temperature measurement
#define RADIOLIB_RF69_TEMP_MEAS_RUNNING 0b00000100 // 2 2 temperature measurement status: on-going
#define RADIOLIB_RF69_TEMP_MEAS_DONE 0b00000000 // 2 2 done
// RADIOLIB_RF69_REG_TEST_DAGC
#define RADIOLIB_RF69_CONTINUOUS_DAGC_NORMAL 0x00 // 7 0 fading margin improvement: normal mode
#define RADIOLIB_RF69_CONTINUOUS_DAGC_LOW_BETA_ON 0x20 // 7 0 improved mode for AfcLowBetaOn
#define RADIOLIB_RF69_CONTINUOUS_DAGC_LOW_BETA_OFF 0x30 // 7 0 improved mode for AfcLowBetaOff (default)
// RADIOLIB_RF69_REG_TEST_PA1
#define RADIOLIB_RF69_PA1_NORMAL 0x55 // 7 0 PA_BOOST: none
#define RADIOLIB_RF69_PA1_20_DBM 0x5D // 7 0 +20 dBm
// RADIOLIB_RF69_REG_TEST_PA2
#define RADIOLIB_RF69_PA2_NORMAL 0x70 // 7 0 PA_BOOST: none
#define RADIOLIB_RF69_PA2_20_DBM 0x7C // 7 0 +20 dBm
// RadioLib defaults
#define RADIOLIB_RF69_DEFAULT_FREQ 434.0
#define RADIOLIB_RF69_DEFAULT_BR 4.8
#define RADIOLIB_RF69_DEFAULT_FREQDEV 5.0
#define RADIOLIB_RF69_DEFAULT_RXBW 125.0
#define RADIOLIB_RF69_DEFAULT_POWER 10
#define RADIOLIB_RF69_DEFAULT_PREAMBLELEN 16
#define RADIOLIB_RF69_DEFAULT_SW {0x12, 0xAD}
#define RADIOLIB_RF69_DEFAULT_SW_LEN 2
class RF69: public PhysicalLayer {
public:
// introduce PhysicalLayer overloads
using PhysicalLayer::transmit;
using PhysicalLayer::receive;
using PhysicalLayer::startTransmit;
using PhysicalLayer::readData;
RF69(Module* module);
Module* getMod();
// basic methods
int16_t begin(
float freq = RADIOLIB_RF69_DEFAULT_FREQ,
float br = RADIOLIB_RF69_DEFAULT_BR,
float freqDev = RADIOLIB_RF69_DEFAULT_FREQDEV,
float rxBw = RADIOLIB_RF69_DEFAULT_RXBW,
int8_t pwr = RADIOLIB_RF69_DEFAULT_POWER,
uint8_t preambleLen = RADIOLIB_RF69_DEFAULT_PREAMBLELEN);
void reset();
int16_t transmit(uint8_t* data, size_t len, uint8_t addr = 0) override;
int16_t receive(uint8_t* data, size_t len) override;
int16_t sleep();
int16_t standby() override;
int16_t standby(uint8_t mode) override;
int16_t transmitDirect(uint32_t frf = 0) override;
int16_t receiveDirect() override;
int16_t packetMode();
// hardware AES support
void setAESKey(uint8_t* key);
int16_t enableAES();
int16_t disableAES();
// interrupt methods
void setDio0Action(void (*func)(void));
void clearDio0Action();
void setDio1Action(void (*func)(void));
void clearDio1Action();
void setPacketReceivedAction(void (*func)(void));
void clearPacketReceivedAction();
void setPacketSentAction(void (*func)(void));
void clearPacketSentAction();
void setFifoEmptyAction(void (*func)(void));
void clearFifoEmptyAction();
void setFifoFullAction(void (*func)(void));
void clearFifoFullAction();
bool fifoAdd(uint8_t* data, int totalLen, int* remLen);
bool fifoGet(volatile uint8_t* data, int totalLen, volatile int* rcvLen);
int16_t startTransmit(uint8_t* data, size_t len, uint8_t addr = 0) override;
int16_t finishTransmit() override;
int16_t startReceive();
int16_t startReceive(uint32_t timeout, uint16_t irqFlags, uint16_t irqMask, size_t len);
int16_t readData(uint8_t* data, size_t len) override;
// configuration methods
int16_t setFrequency(float freq);
int16_t getFrequency(float *freq);
int16_t setBitRate(float br);
int16_t setRxBandwidth(float rxBw);
int16_t setFrequencyDeviation(float freqDev) override;
int16_t getFrequencyDeviation(float *freqDev);
int16_t setOutputPower(int8_t pwr, bool highPower = false);
int16_t setSyncWord(uint8_t* syncWord, size_t len, uint8_t maxErrBits = 0);
int16_t setPreambleLength(uint8_t preambleLen);
int16_t setNodeAddress(uint8_t nodeAddr);
int16_t setBroadcastAddress(uint8_t broadAddr);
int16_t disableAddressFiltering();
// measurement methods
void setAmbientTemperature(int16_t tempAmbient);
int16_t getTemperature();
size_t getPacketLength(bool update = true) override;
int16_t setOOK(bool enable);
int16_t setOokThresholdType(uint8_t type);
int16_t setOokFixedThreshold(uint8_t value);
int16_t setOokPeakThresholdDecrement(uint8_t value);
int16_t fixedPacketLengthMode(uint8_t len = RADIOLIB_RF69_MAX_PACKET_LENGTH);
int16_t variablePacketLengthMode(uint8_t maxLen = RADIOLIB_RF69_MAX_PACKET_LENGTH);
int16_t enableSyncWordFiltering(uint8_t maxErrBits = 0);
int16_t disableSyncWordFiltering();
int16_t enableContinuousModeBitSync();
int16_t disableContinuousModeBitSync();
int16_t setCrcFiltering(bool crcOn = true);
int16_t setPromiscuousMode(bool enable = true);
int16_t setDataShaping(uint8_t sh) override;
int16_t setEncoding(uint8_t encoding) override;
int16_t setLnaTestBoost(bool value);
float getRSSI();
int16_t setRSSIThreshold(float dbm);
void setRfSwitchPins(uint32_t rxEn, uint32_t txEn);
void setRfSwitchTable(const uint32_t (&pins)[Module::RFSWITCH_MAX_PINS], const Module::RfSwitchMode_t table[]);
uint8_t randomByte();
int16_t getChipVersion();
#if !defined(RADIOLIB_EXCLUDE_DIRECT_RECEIVE)
void setDirectAction(void (*func)(void));
void readBit(uint32_t pin);
#endif
int16_t setDIOMapping(uint32_t pin, uint32_t value);
#if !defined(RADIOLIB_GODMODE) && !defined(RADIOLIB_LOW_LEVEL)
protected:
#endif
Module* mod;
#if !defined(RADIOLIB_GODMODE)
protected:
#endif
float frequency = RADIOLIB_RF69_DEFAULT_FREQ;
float bitRate = RADIOLIB_RF69_DEFAULT_BR;
float rxBandwidth = RADIOLIB_RF69_DEFAULT_RXBW;
bool ookEnabled = false;
int16_t tempOffset = 0;
int8_t power = RADIOLIB_RF69_DEFAULT_POWER;
size_t packetLength = 0;
bool packetLengthQueried = false;
uint8_t packetLengthConfig = RADIOLIB_RF69_PACKET_FORMAT_VARIABLE;
bool promiscuous = false;
uint8_t syncWordLength = RADIOLIB_RF69_DEFAULT_SW_LEN;
bool bitSync = true;
int16_t config();
int16_t directMode();
int16_t setPacketMode(uint8_t mode, uint8_t len);
#if !defined(RADIOLIB_GODMODE)
private:
#endif
int16_t setMode(uint8_t mode);
void clearIRQFlags();
void clearFIFO(size_t count);
};
#endif
#endif
Module
Implements all common low-level methods to control the wireless module. Every module class contains o...
Definition: Module.h:31
Module::RFSWITCH_MAX_PINS
static const size_t RFSWITCH_MAX_PINS
The maximum number of pins supported by the RF switch code.
Definition: Module.h:42
PhysicalLayer
Provides common interface for protocols that run on LoRa/FSK modules, such as RTTY or LoRaWAN....
Definition: PhysicalLayer.h:33
PhysicalLayer::readData
virtual int16_t readData(uint8_t *data, size_t len)
Reads data that was received after calling startReceive method.
Definition: PhysicalLayer.cpp:209
PhysicalLayer::transmit
int16_t transmit(const char *str, uint8_t addr=0)
C-string transmit method.
Definition: PhysicalLayer.cpp:52
PhysicalLayer::startTransmit
int16_t startTransmit(const char *str, uint8_t addr=0)
Interrupt-driven Arduino String transmit method. Unlike the standard transmit method,...
Definition: PhysicalLayer.cpp:149
PhysicalLayer::receive
virtual int16_t receive(uint8_t *data, size_t len)
Binary receive method. Must be implemented in module class.
Definition: PhysicalLayer.cpp:112
RF69
Control class for RF69 module. Also serves as base class for SX1231.
Definition: RF69.h:479
RF69::getTemperature
int16_t getTemperature()
Measures temperature.
Definition: RF69.cpp:768
RF69::getChipVersion
int16_t getChipVersion()
Read version SPI register. Should return RF69_CHIP_VERSION (0x24) if SX127x is connected and working.
Definition: RF69.cpp:985
RF69::setDIOMapping
int16_t setDIOMapping(uint32_t pin, uint32_t value)
Configure DIO pin mapping to get a given signal on a DIO pin (if available).
Definition: RF69.cpp:973
RF69::clearFifoEmptyAction
void clearFifoEmptyAction()
Clears interrupt service routine to call when FIFO is empty.
Definition: RF69.cpp:324
RF69::fixedPacketLengthMode
int16_t fixedPacketLengthMode(uint8_t len=RADIOLIB_RF69_MAX_PACKET_LENGTH)
Set modem in fixed packet length mode.
Definition: RF69.cpp:798
RF69::disableAES
int16_t disableAES()
Disables AES encryption.
Definition: RF69.cpp:234
RF69::setFifoFullAction
void setFifoFullAction(void(*func)(void))
Set interrupt service routine function to call when FIFO is full.
Definition: RF69.cpp:328
RF69::setBroadcastAddress
int16_t setBroadcastAddress(uint8_t broadAddr)
Sets broadcast address. Calling this method will also enable address filtering for node and broadcast...
Definition: RF69.cpp:742
RF69::enableAES
int16_t enableAES()
Enables AES encryption.
Definition: RF69.cpp:230
RF69::randomByte
uint8_t randomByte()
Get one truly random byte from RSSI noise.
Definition: RF69.cpp:944
RF69::standby
int16_t standby() override
Sets the module to standby mode.
Definition: RF69.cpp:159
RF69::setOokThresholdType
int16_t setOokThresholdType(uint8_t type)
Selects the type of threshold in the OOK data slicer.
Definition: RF69.cpp:509
RF69::transmitDirect
int16_t transmitDirect(uint32_t frf=0) override
Starts direct mode transmission.
Definition: RF69.cpp:172
RF69::getFrequency
int16_t getFrequency(float *freq)
Gets carrier frequency.
Definition: RF69.cpp:545
RF69::setSyncWord
int16_t setSyncWord(uint8_t *syncWord, size_t len, uint8_t maxErrBits=0)
Sets sync word. Up to 8 bytes can be set as sync word.
Definition: RF69.cpp:695
RF69::setPacketSentAction
void setPacketSentAction(void(*func)(void))
Sets interrupt service routine to call when a packet is sent.
Definition: RF69.cpp:305
RF69::getFrequencyDeviation
int16_t getFrequencyDeviation(float *freqDev)
Gets frequency deviation.
Definition: RF69.cpp:633
RF69::setOokFixedThreshold
int16_t setOokFixedThreshold(uint8_t value)
Fixed threshold for the Data Slicer in OOK mode or floor threshold for the Data Slicer in OOK when Pe...
Definition: RF69.cpp:516
RF69::readData
virtual int16_t readData(uint8_t *data, size_t len)
Reads data that was received after calling startReceive method.
Definition: PhysicalLayer.cpp:209
RF69::clearPacketSentAction
void clearPacketSentAction()
Clears interrupt service routine to call when a packet is sent.
Definition: RF69.cpp:309
RF69::finishTransmit
int16_t finishTransmit() override
Clean up after transmission is done.
Definition: RF69.cpp:445
RF69::disableSyncWordFiltering
int16_t disableSyncWordFiltering()
Disable preamble and sync word filtering and generation.
Definition: RF69.cpp:811
RF69::setDataShaping
int16_t setDataShaping(uint8_t sh) override
Sets Gaussian filter bandwidth-time product that will be used for data shaping. Allowed values are RA...
Definition: RF69.cpp:880
RF69::setOokPeakThresholdDecrement
int16_t setOokPeakThresholdDecrement(uint8_t value)
Period of decrement of the RSSI threshold in the OOK demodulator.
Definition: RF69.cpp:520
RF69::setOOK
int16_t setOOK(bool enable)
Enables/disables OOK modulation instead of FSK. Note: This function calls setRxBandwidth again,...
Definition: RF69.cpp:490
RF69::sleep
int16_t sleep()
Sets the module to sleep mode.
Definition: RF69.cpp:151
RF69::transmit
int16_t transmit(const char *str, uint8_t addr=0)
C-string transmit method.
Definition: PhysicalLayer.cpp:52
RF69::disableAddressFiltering
int16_t disableAddressFiltering()
Disables address filtering. Calling this method will also erase previously set addresses.
Definition: RF69.cpp:751
RF69::begin
int16_t begin(float freq=RADIOLIB_RF69_DEFAULT_FREQ, float br=RADIOLIB_RF69_DEFAULT_BR, float freqDev=RADIOLIB_RF69_DEFAULT_FREQDEV, float rxBw=RADIOLIB_RF69_DEFAULT_RXBW, int8_t pwr=RADIOLIB_RF69_DEFAULT_POWER, uint8_t preambleLen=RADIOLIB_RF69_DEFAULT_PREAMBLELEN)
Initialization method.
Definition: RF69.cpp:13
RF69::enableSyncWordFiltering
int16_t enableSyncWordFiltering(uint8_t maxErrBits=0)
Enable sync word filtering and generation.
Definition: RF69.cpp:806
RF69::packetMode
int16_t packetMode()
Stops direct mode. It is required to call this method to switch from direct transmissions to packet-b...
Definition: RF69.cpp:222
RF69::setOutputPower
int16_t setOutputPower(int8_t pwr, bool highPower=false)
Sets output power. Allowed values range from -18 to 13 dBm for low power modules (RF69C/CW) or -2 to ...
Definition: RF69.cpp:657
RF69::setRxBandwidth
int16_t setRxBandwidth(float rxBw)
Sets receiver bandwidth. Allowed values are 2.6, 3.1, 3.9, 5.2, 6.3, 7.8, 10.4, 12....
Definition: RF69.cpp:582
RF69::setFifoEmptyAction
void setFifoEmptyAction(void(*func)(void))
Set interrupt service routine function to call when FIFO is empty.
Definition: RF69.cpp:313
RF69::setPreambleLength
int16_t setPreambleLength(uint8_t preambleLen)
Sets preamble length.
Definition: RF69.cpp:721
RF69::enableContinuousModeBitSync
int16_t enableContinuousModeBitSync()
Enable Bit synchronization in continuous mode.
Definition: RF69.cpp:816
RF69::setDirectAction
void setDirectAction(void(*func)(void))
Set interrupt service routine function to call when data bit is received in direct mode.
Definition: RF69.cpp:964
RF69::getPacketLength
size_t getPacketLength(bool update=true) override
Query modem for the packet length of received payload.
Definition: RF69.cpp:785
RF69::startTransmit
int16_t startTransmit(const char *str, uint8_t addr=0)
Interrupt-driven Arduino String transmit method. Unlike the standard transmit method,...
Definition: PhysicalLayer.cpp:149
RF69::clearDio0Action
void clearDio0Action()
Clears interrupt service routine to call when DIO0 activates.
Definition: RF69.cpp:278
RF69::disableContinuousModeBitSync
int16_t disableContinuousModeBitSync()
Disable Bit synchronization in continuous mode.
Definition: RF69.cpp:825
RF69::setDio0Action
void setDio0Action(void(*func)(void))
Sets interrupt service routine to call when DIO0 activates.
Definition: RF69.cpp:274
RF69::setLnaTestBoost
int16_t setLnaTestBoost(bool value)
Enable/disable LNA Boost mode (disabled by default).
Definition: RF69.cpp:918
RF69::fifoGet
bool fifoGet(volatile uint8_t *data, int totalLen, volatile int *rcvLen)
Set interrupt service routine function to call when FIFO is sufficiently full to read.
Definition: RF69.cpp:365
RF69::setDio1Action
void setDio1Action(void(*func)(void))
Sets interrupt service routine to call when DIO1 activates.
Definition: RF69.cpp:282
RF69::setEncoding
int16_t setEncoding(uint8_t encoding) override
Sets transmission encoding. Allowed values are RADIOLIB_ENCODING_NRZ, RADIOLIB_ENCODING_MANCHESTER an...
Definition: RF69.cpp:900
RF69::setFrequency
int16_t setFrequency(float freq)
Sets carrier frequency. Allowed values are in bands 290.0 to 340.0 MHz, 431.0 to 510....
Definition: RF69.cpp:524
RF69::fifoAdd
bool fifoAdd(uint8_t *data, int totalLen, int *remLen)
Set interrupt service routine function to call when FIFO is empty.
Definition: RF69.cpp:342
RF69::readBit
void readBit(uint32_t pin)
Function to read and process data bit in direct reception mode.
Definition: RF69.cpp:968
RF69::receive
virtual int16_t receive(uint8_t *data, size_t len)
Binary receive method. Must be implemented in module class.
Definition: PhysicalLayer.cpp:112
RF69::setNodeAddress
int16_t setNodeAddress(uint8_t nodeAddr)
Sets node address. Calling this method will also enable address filtering for node address only.
Definition: RF69.cpp:733
RF69::receiveDirect
int16_t receiveDirect() override
Starts direct mode reception.
Definition: RF69.cpp:193
RF69::setAESKey
void setAESKey(uint8_t *key)
Sets AES key.
Definition: RF69.cpp:226
RF69::setCrcFiltering
int16_t setCrcFiltering(bool crcOn=true)
Enable CRC filtering and generation.
Definition: RF69.cpp:834
RF69::clearPacketReceivedAction
void clearPacketReceivedAction()
Clears interrupt service routine to call when a packet is received.
Definition: RF69.cpp:301
RF69::setRfSwitchPins
void setRfSwitchPins(uint32_t rxEn, uint32_t txEn)
Some modules contain external RF switch controlled by pins. This function gives RadioLib control over...
Definition: RF69.cpp:936
RF69::setAmbientTemperature
void setAmbientTemperature(int16_t tempAmbient)
Sets ambient temperature. Required to correct values from on-board temperature sensor.
Definition: RF69.cpp:764
RF69::getRSSI
float getRSSI()
Gets RSSI (Recorded Signal Strength Indicator) of the last received packet.
Definition: RF69.cpp:926
RF69::setPacketReceivedAction
void setPacketReceivedAction(void(*func)(void))
Sets interrupt service routine to call when a packet is received.
Definition: RF69.cpp:297
RF69::setBitRate
int16_t setBitRate(float br)
Sets bit rate. Allowed values range from 0.5 to 300.0 kbps.
Definition: RF69.cpp:560
RF69::setFrequencyDeviation
int16_t setFrequencyDeviation(float freqDev) override
Sets frequency deviation.
Definition: RF69.cpp:610
RF69::clearDio1Action
void clearDio1Action()
Clears interrupt service routine to call when DIO1 activates.
Definition: RF69.cpp:290
RF69::setPromiscuousMode
int16_t setPromiscuousMode(bool enable=true)
Set modem in "sniff" mode: no packet filtering (e.g., no preamble, sync word, address,...
Definition: RF69.cpp:842
RF69::clearFifoFullAction
void clearFifoFullAction()
Clears interrupt service routine to call when FIFO is full.
Definition: RF69.cpp:337
RF69::variablePacketLengthMode
int16_t variablePacketLengthMode(uint8_t maxLen=RADIOLIB_RF69_MAX_PACKET_LENGTH)
Set modem in variable packet length mode.
Definition: RF69.cpp:802
RF69::reset
void reset()
Reset method. Will reset the chip to the default state using RST pin.
Definition: RF69.cpp:97
RF69::startReceive
int16_t startReceive()
Interrupt-driven receive method. GDO0 will be activated when full packet is received.
Definition: RF69.cpp:238
RF69::RF69
RF69(Module *module)
Default constructor.
Definition: RF69.cpp:5
RF69::setRSSIThreshold
int16_t setRSSIThreshold(float dbm)
Sets the RSSI value above which the RSSI interrupt is signaled.
Definition: RF69.cpp:930
RF69::setRfSwitchTable
void setRfSwitchTable(const uint32_t(&pins)[Module::RFSWITCH_MAX_PINS], const Module::RfSwitchMode_t table[])
Some modules contain external RF switch controlled by pins. This function gives RadioLib control over...
Definition: RF69.cpp:940
Module::RfSwitchMode_t
Definition: Module.h:49