10#include <RHGenericSPI.h>
11#include <RHNRFSPIDriver.h>
15#define RH_NRF905_MAX_PAYLOAD_LEN 32
22#define RH_NRF905_HEADER_LEN 5
26#define RH_NRF905_MAX_MESSAGE_LEN (RH_NRF905_MAX_PAYLOAD_LEN-RH_NRF905_HEADER_LEN)
29#define RH_NRF905_REG_MASK 0x0f
30#define RH_NRF905_REG_W_CONFIG 0x00
31#define RH_NRF905_REG_R_CONFIG 0x10
32#define RH_NRF905_REG_W_TX_PAYLOAD 0x20
33#define RH_NRF905_REG_R_TX_PAYLOAD 0x21
34#define RH_NRF905_REG_W_TX_ADDRESS 0x22
35#define RH_NRF905_REG_R_TX_ADDRESS 0x23
36#define RH_NRF905_REG_R_RX_PAYLOAD 0x24
37#define RH_NRF905_REG_CHANNEL_CONFIG 0x80
40#define RH_NRF905_CONFIG_0 0x00
41#define RH_NRF905_CONFIG_0_CH_NO 0xff
43#define RH_NRF905_CONFIG_1 0x01
44#define RH_NRF905_CONFIG_1_AUTO_RETRAN 0x20
45#define RH_NRF905_CONFIG_1_RX_RED_PWR 0x10
46#define RH_NRF905_CONFIG_1_PA_PWR 0x0c
47#define RH_NRF905_CONFIG_1_PA_PWR_N10DBM 0x00
48#define RH_NRF905_CONFIG_1_PA_PWR_N2DBM 0x04
49#define RH_NRF905_CONFIG_1_PA_PWR_6DBM 0x08
50#define RH_NRF905_CONFIG_1_PA_PWR_10DBM 0x0c
51#define RH_NRF905_CONFIG_1_HFREQ_PLL 0x02
52#define RH_NRF905_CONFIG_1_CH_NO 0x01
54#define RH_NRF905_CONFIG_2 0x02
55#define RH_NRF905_CONFIG_2_TX_AFW 0x70
56#define RH_NRF905_CONFIG_2_RX_AFW 0x07
58#define RH_NRF905_CONFIG_3 0x03
59#define RH_NRF905_CONFIG_3_RX_PW 0x3f
61#define RH_NRF905_CONFIG_4 0x04
62#define RH_NRF905_CONFIG_4_TX_PW 0x3f
64#define RH_NRF905_CONFIG_5 0x05
65#define RH_NRF905_CONFIG_5_RX_ADDRESS 0xff
67#define RH_NRF905_CONFIG_6 0x06
68#define RH_NRF905_CONFIG_6_RX_ADDRESS 0xff
70#define RH_NRF905_CONFIG_7 0x07
71#define RH_NRF905_CONFIG_7_RX_ADDRESS 0xff
73#define RH_NRF905_CONFIG_8 0x08
74#define RH_NRF905_CONFIG_8_RX_ADDRESS 0xff
76#define RH_NRF905_CONFIG_9 0x09
77#define RH_NRF905_CONFIG_9_CRC_MODE_16BIT 0x80
78#define RH_NRF905_CONFIG_9_CRC_EN 0x40
79#define RH_NRF905_CONFIG_9_XOF 0x38
80#define RH_NRF905_CONFIG_9_XOF_4MHZ 0x00
81#define RH_NRF905_CONFIG_9_XOF_8MHZ 0x08
82#define RH_NRF905_CONFIG_9_XOF_12MHZ 0x10
83#define RH_NRF905_CONFIG_9_XOF_16MHZ 0x18
84#define RH_NRF905_CONFIG_9_XOF_20MHZ 0x20
85#define RH_NRF905_CONFIG_9_UP_CLK_EN 0x04
86#define RH_NRF905_CONFIG_9_UP_CLK_FREQ 0x03
87#define RH_NRF905_CONFIG_9_UP_CLK_FREQ_4MHZ 0x00
88#define RH_NRF905_CONFIG_9_UP_CLK_FREQ_2MHZ 0x01
89#define RH_NRF905_CONFIG_9_UP_CLK_FREQ_1MHZ 0x02
90#define RH_NRF905_CONFIG_9_UP_CLK_FREQ_500KHZ 0x03
93#define RH_NRF905_STATUS_AM 0x80
94#define RH_NRF905_STATUS_DR 0x20
260 RH_NRF905(uint8_t chipEnablePin = 8, uint8_t txEnablePin = 9, uint8_t slaveSelectPin = SS,
RHGenericSPI& spi = hardware_spi);
308 bool setChannel(uint16_t channel,
bool hiFrequency =
false);
347 bool send(
const uint8_t* data, uint8_t len);
386 bool recv(uint8_t* buf, uint8_t* len);
401 uint8_t _configuration;
404 uint8_t _chipEnablePin;
407 uint8_t _txEnablePin;
413 uint8_t _buf[RH_NRF905_MAX_PAYLOAD_LEN];
Base class for SPI interfaces.
Definition RHGenericSPI.h:31
Base class for RadioHead drivers that use the SPI bus to communicate with its NRF family transport ha...
Definition RHNRFSPIDriver.h:34
Send and receive unaddressed, unreliable datagrams by nRF905 and compatible transceivers.
Definition RH_NRF905.h:235
void setModeIdle()
Definition RH_NRF905.cpp:110
bool available()
Definition RH_NRF905.cpp:226
bool printRegisters()
Definition RH_NRF905.cpp:193
void clearRxBuf()
Clear our local receive buffer.
Definition RH_NRF905.cpp:246
uint8_t spiReadRegister(uint8_t reg)
Definition RH_NRF905.cpp:48
virtual bool waitPacketSent()
Definition RH_NRF905.cpp:163
bool init()
Definition RH_NRF905.cpp:16
bool setRF(TransmitPower power)
Definition RH_NRF905.cpp:100
uint8_t spiBurstWriteRegister(uint8_t reg, uint8_t *src, uint8_t len)
Definition RH_NRF905.cpp:63
bool printRegister(uint8_t reg)
Definition RH_NRF905.cpp:182
bool recv(uint8_t *buf, uint8_t *len)
Definition RH_NRF905.cpp:252
TransmitPower
Convenient values for setting transmitter power in setRF() These are designed to agree with the value...
Definition RH_NRF905.h:242
@ TransmitPower10dBm
10 dBm
Definition RH_NRF905.h:246
@ TransmitPower6dBm
6 dBm
Definition RH_NRF905.h:245
@ TransmitPowerm2dBm
-2 dBm
Definition RH_NRF905.h:244
@ TransmitPowerm10dBm
-10 dBm
Definition RH_NRF905.h:243
bool send(const uint8_t *data, uint8_t len)
Definition RH_NRF905.cpp:141
uint8_t statusRead()
Definition RH_NRF905.cpp:68
bool setChannel(uint16_t channel, bool hiFrequency=false)
Definition RH_NRF905.cpp:74
void setModeTx()
Definition RH_NRF905.cpp:130
uint8_t spiWriteRegister(uint8_t reg, uint8_t val)
Definition RH_NRF905.cpp:53
bool isSending()
Definition RH_NRF905.cpp:174
uint8_t maxMessageLength()
Definition RH_NRF905.cpp:267
uint8_t spiBurstReadRegister(uint8_t reg, uint8_t *dest, uint8_t len)
Definition RH_NRF905.cpp:58
void setModeRx()
Definition RH_NRF905.cpp:120
void validateRxBuf()
Examine the revceive buffer to determine whether the message is for this node.
Definition RH_NRF905.cpp:204
bool setNetworkAddress(uint8_t *address, uint8_t len)
Definition RH_NRF905.cpp:89