10 #include <RHGenericDriver.h>
14 #define RH_NRF51_MAX_PAYLOAD_LEN 254
26 #define RH_NRF51_HEADER_LEN 7
30 #define RH_NRF51_MAX_MESSAGE_LEN (RH_NRF51_MAX_PAYLOAD_LEN-RH_NRF51_HEADER_LEN)
34 #define RH_NRF51_HAVE_ENCRYPTION 1
37 #define RH_NRF51_MAX_ENCRYPTED_MESSAGE_LEN (27-4)
40 #define RH_NRF51_ENCRYPTION_KEY_LENGTH 16
44 #define RH_NRF51_AES_CCM_CNF_SIZE 33
211 bool send(
const uint8_t* data, uint8_t len);
246 bool recv(uint8_t* buf, uint8_t* len);
278 uint8_t _buf[RH_NRF51_MAX_PAYLOAD_LEN+1];
283 #if RH_NRF51_HAVE_ENCRYPTION
289 uint8_t _scratch[RH_NRF51_MAX_PAYLOAD_LEN+1+16];
292 uint8_t _encryption_cnf[RH_NRF51_AES_CCM_CNF_SIZE];
void validateRxBuf()
Examine the receive buffer to determine whether the message is for this node.
volatile uint16_t _rxGood
Count of the number of successfully transmitted messaged.
Definition: RHGenericDriver.h:292
@ TransmitPower4dBm
4 dBm
Definition: RH_NRF51.h:142
Send and receive unaddressed, unreliable datagrams by nRF51 and nRF52 compatible transceivers.
Definition: RH_NRF51.h:126
@ DataRate1Mbps
1 Mbps
Definition: RH_NRF51.h:133
DataRate
Defines convenient values for setting data rates in setRF()
Definition: RH_NRF51.h:131
volatile uint8_t _rxHeaderFrom
FROM header in the last received mesasge.
Definition: RHGenericDriver.h:265
void setModeTx()
Sets the radio in TX mode.
@ TransmitPowerm4dBm
-4 dBm
Definition: RH_NRF51.h:144
void setModeRx()
Sets the radio in RX mode.
volatile uint16_t _rxBad
Count of the number of bad messages (eg bad checksum etc) received.
Definition: RHGenericDriver.h:289
@ DataRate2Mbps
2 Mbps
Definition: RH_NRF51.h:134
volatile uint8_t _rxHeaderTo
TO header in the last received mesasge.
Definition: RHGenericDriver.h:262
uint8_t _txHeaderFrom
FROM header to send in all messages.
Definition: RHGenericDriver.h:277
Abstract base class for a RadioHead driver.
Definition: RHGenericDriver.h:41
@ TransmitPowerm30dBm
-30 dBm
Definition: RH_NRF51.h:149
bool recv(uint8_t *buf, uint8_t *len)
void setEncryptionKey(uint8_t *key=NULL)
bool send(const uint8_t *data, uint8_t len)
@ TransmitPowerm8dBm
-8 dBm
Definition: RH_NRF51.h:145
uint8_t _thisAddress
This node id.
Definition: RHGenericDriver.h:256
volatile uint16_t _txGood
Count of the number of bad messages (correct checksum etc) received.
Definition: RHGenericDriver.h:295
@ TransmitPowerm12dBm
-12 dBm
Definition: RH_NRF51.h:146
bool _promiscuous
Whether the transport is in promiscuous mode.
Definition: RHGenericDriver.h:259
@ DataRate250kbps
250 kbps
Definition: RH_NRF51.h:135
void clearRxBuf()
Clear our local receive buffer.
volatile uint8_t _rxHeaderFlags
FLAGS header in the last received mesasge.
Definition: RHGenericDriver.h:271
bool setRF(DataRate data_rate, TransmitPower power)
TransmitPower
Convenient values for setting transmitter power in setRF()
Definition: RH_NRF51.h:139
@ TransmitPowerm16dBm
-16 dBm
Definition: RH_NRF51.h:147
virtual bool waitPacketSent()
@ TransmitPowerm20dBm
-20 dBm
Definition: RH_NRF51.h:148
uint8_t _txHeaderId
ID header to send in all messages.
Definition: RHGenericDriver.h:280
uint8_t _txHeaderTo
TO header to send in all messages.
Definition: RHGenericDriver.h:274
uint8_t _txHeaderFlags
FLAGS header to send in all messages.
Definition: RHGenericDriver.h:283
volatile uint8_t _rxHeaderId
ID header in the last received mesasge.
Definition: RHGenericDriver.h:268
@ TransmitPower0dBm
0 dBm
Definition: RH_NRF51.h:143
@ RHModeIdle
Transport is idle.
Definition: RHGenericDriver.h:52
volatile RHMode _mode
The current transport operating mode.
Definition: RHGenericDriver.h:253
uint8_t maxMessageLength()
bool setNetworkAddress(uint8_t *address, uint8_t len)
@ RHModeTx
Transport is in the process of transmitting a message.
Definition: RHGenericDriver.h:53
virtual RHMode mode()
Definition: RHGenericDriver.cpp:159
@ RHModeRx
Transport is in the process of receiving a message.
Definition: RHGenericDriver.h:54
virtual bool waitCAD()
Definition: RHGenericDriver.cpp:72
bool setChannel(uint8_t channel)