14 #include <RHGenericDriver.h>
21 #define RH_E32_MAX_PAYLOAD_LEN 58
30 #define RH_E32_HEADER_LEN 5
33 #define RH_E32_MAX_MESSAGE_LEN (RH_E32_MAX_PAYLOAD_LEN-RH_E32_HEADER_LEN)
36 #define RH_E32_COMMAND_WRITE_PARAMS_SAVE 0xC0
37 #define RH_E32_COMMAND_READ_PARAMS 0xC1
38 #define RH_E32_COMMAND_WRITE_PARAMS_NOSAVE 0xC2
39 #define RH_E32_COMMAND_READ_VERSION 0xC3
40 #define RH_E32_COMMAND_RESET 0xC4
43 #define RH_E32_PARAM_SPED_UART_MODE_MASK 0xC0
44 #define RH_E32_PARAM_SPED_UART_MODE_8N1 0x00
45 #define RH_E32_PARAM_SPED_UART_MODE_8O1 0x40
46 #define RH_E32_PARAM_SPED_UART_MODE_8E1 0x80
48 #define RH_E32_PARAM_SPED_UART_BAUD_MASK 0x38
49 #define RH_E32_PARAM_SPED_UART_BAUD_1200 0x00
50 #define RH_E32_PARAM_SPED_UART_BAUD_2400 0x08
51 #define RH_E32_PARAM_SPED_UART_BAUD_4800 0x10
52 #define RH_E32_PARAM_SPED_UART_BAUD_9600 0x18
53 #define RH_E32_PARAM_SPED_UART_BAUD_19200 0x20
54 #define RH_E32_PARAM_SPED_UART_BAUD_38400 0x28
55 #define RH_E32_PARAM_SPED_UART_BAUD_57600 0x30
56 #define RH_E32_PARAM_SPED_UART_BAUD_115200 0x38
58 #define RH_E32_PARAM_SPED_DATARATE_MASK 0x07
59 #define RH_E32_PARAM_SPED_DATARATE_1KBPS 0x00
60 #define RH_E32_PARAM_SPED_DATARATE_2KBPS 0x01
61 #define RH_E32_PARAM_SPED_DATARATE_5KBPS 0x02
62 #define RH_E32_PARAM_SPED_DATARATE_8KBPS 0x03
63 #define RH_E32_PARAM_SPED_DATARATE_10KBPS 0x04
64 #define RH_E32_PARAM_SPED_DATARATE_15KBPS 0x05
65 #define RH_E32_PARAM_SPED_DATARATE_20KBPS 0x06
66 #define RH_E32_PARAM_SPED_DATARATE_25KBPS 0x07
68 #define RH_E32_PARAM_OPTION_FIXED_MASK 0x80
70 #define RH_E32_PARAM_OPTION_IODRIVE_MASK 0x40
72 #define RH_E32_PARAM_OPTION_WAKEUP_TIME_MASK 0x38
73 #define RH_E32_PARAM_OPTION_WAKEUP_TIME_250MS 0x00
74 #define RH_E32_PARAM_OPTION_WAKEUP_TIME_500MS 0x08
75 #define RH_E32_PARAM_OPTION_WAKEUP_TIME_750MS 0x10
76 #define RH_E32_PARAM_OPTION_WAKEUP_TIME_1000MS 0x18
77 #define RH_E32_PARAM_OPTION_WAKEUP_TIME_1250MS 0x20
78 #define RH_E32_PARAM_OPTION_WAKEUP_TIME_1500MS 0x28
79 #define RH_E32_PARAM_OPTION_WAKEUP_TIME_1750MS 0x30
80 #define RH_E32_PARAM_OPTION_WAKEUP_TIME_2000MS 0x38
82 #define RH_E32_PARAM_OPTION_FEC_MASK 0x04
84 #define RH_E32_PARAM_OPTION_POWER_MASK 0x03
85 #define RH_E32_PARAM_OPTION_POWER_30DBM 0x00
86 #define RH_E32_PARAM_OPTION_POWER_27DBM 0x01
87 #define RH_E32_PARAM_OPTION_POWER_24DBM 0x02
88 #define RH_E32_PARAM_OPTION_POWER_21DBM 0x03
232 DataRate1kbps = RH_E32_PARAM_SPED_DATARATE_1KBPS,
233 DataRate2kbps = RH_E32_PARAM_SPED_DATARATE_2KBPS,
234 DataRate5kbps = RH_E32_PARAM_SPED_DATARATE_5KBPS,
235 DataRate8kbps = RH_E32_PARAM_SPED_DATARATE_8KBPS,
236 DataRate10kbps = RH_E32_PARAM_SPED_DATARATE_10KBPS,
237 DataRate15kbps = RH_E32_PARAM_SPED_DATARATE_15KBPS,
238 DataRate20kbps = RH_E32_PARAM_SPED_DATARATE_20KBPS,
239 DataRate25kbps = RH_E32_PARAM_SPED_DATARATE_25KBPS
246 Power30dBm = RH_E32_PARAM_OPTION_POWER_30DBM,
247 Power27dBm = RH_E32_PARAM_OPTION_POWER_27DBM,
248 Power24dBm = RH_E32_PARAM_OPTION_POWER_24DBM,
249 Power21dBm = RH_E32_PARAM_OPTION_POWER_21DBM,
257 BaudRate1200 = RH_E32_PARAM_SPED_UART_BAUD_1200,
258 BaudRate2400 = RH_E32_PARAM_SPED_UART_BAUD_2400,
259 BaudRate4800 = RH_E32_PARAM_SPED_UART_BAUD_4800,
260 BaudRate9600 = RH_E32_PARAM_SPED_UART_BAUD_9600,
261 BaudRate19200 = RH_E32_PARAM_SPED_UART_BAUD_19200,
262 BaudRate38400 = RH_E32_PARAM_SPED_UART_BAUD_38400,
263 BaudRate57600 = RH_E32_PARAM_SPED_UART_BAUD_57600,
264 BaudRate115200 = RH_E32_PARAM_SPED_UART_BAUD_115200,
270 Parity8N1 = RH_E32_PARAM_SPED_UART_MODE_8N1,
271 Parity8O1 = RH_E32_PARAM_SPED_UART_MODE_8O1,
272 Parity8E1 = RH_E32_PARAM_SPED_UART_MODE_8E1,
282 RH_E32(Stream *s=&Serial, uint8_t m0_pin = 4, uint8_t m1_pin = 5, uint8_t aux_pin = 8);
313 bool recv(uint8_t* buf, uint8_t* len);
322 bool send(
const uint8_t* data, uint8_t len);
442 uint8_t _buf[RH_E32_MAX_PAYLOAD_LEN];
volatile uint16_t _rxGood
Count of the number of successfully transmitted messaged.
Definition: RHGenericDriver.h:292
PowerLevel
Values to be passed to setPower() to control the transmitter power.
Definition: RH_E32.h:244
@ ModeWakeUp
Adds a long preamble to transmission to allow destination receivers to wake up.
Definition: RH_E32.h:363
uint8_t addh
High address byte (not used by this driver)
Definition: RH_E32.h:374
void setOperatingMode(OperatingMode mode)
uint8_t maxMessageLength()
uint8_t chan
Radio channel.
Definition: RH_E32.h:377
@ ModeSleep
Use during parameter setting.
Definition: RH_E32.h:365
uint8_t sped
Data and baud rate parameters.
Definition: RH_E32.h:376
volatile uint8_t _rxHeaderFrom
FROM header in the last received mesasge.
Definition: RHGenericDriver.h:265
volatile uint16_t _rxBad
Count of the number of bad messages (eg bad checksum etc) received.
Definition: RHGenericDriver.h:289
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
@ ModeNormal
Normal mode for sending and receiving messages.
Definition: RH_E32.h:362
Driver to send and receive unaddressed, unreliable datagrams via a EBYTE E32-TTL-1W and similar seria...
Definition: RH_E32.h:223
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
bool setBaudRate(BaudRate rate=BaudRate9600, Parity parity=Parity8N1)
bool setDataRate(DataRate rate)
bool _promiscuous
Whether the transport is in promiscuous mode.
Definition: RHGenericDriver.h:259
BaudRate
Values to be passed to setBaudRate() to control the radio serial connection baud rate.
Definition: RH_E32.h:255
volatile uint8_t _rxHeaderFlags
FLAGS header in the last received mesasge.
Definition: RHGenericDriver.h:271
bool readParameters(Parameters ¶ms)
RH_E32(Stream *s=&Serial, uint8_t m0_pin=4, uint8_t m1_pin=5, uint8_t aux_pin=8)
bool recv(uint8_t *buf, uint8_t *len)
bool send(const uint8_t *data, uint8_t len)
Structure for reading and writing radio control parameters.
Definition: RH_E32.h:371
OperatingMode
Defines values to be passed to setOperatinMode.
Definition: RH_E32.h:360
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
bool writeParameters(Parameters ¶ms, bool save=false)
uint8_t head
0xc2 (no save) or 0xc0 (save)
Definition: RH_E32.h:373
bool setPower(PowerLevel level)
uint8_t _txHeaderFlags
FLAGS header to send in all messages.
Definition: RHGenericDriver.h:283
Parity
Values to be passed to setBaudRate() to control the parity of the serial connection to the radio.
Definition: RH_E32.h:268
volatile uint8_t _rxHeaderId
ID header in the last received mesasge.
Definition: RHGenericDriver.h:268
uint8_t addl
Low address byte (not used by this driver)
Definition: RH_E32.h:375
uint8_t option
Various control options.
Definition: RH_E32.h:378
volatile RHMode _mode
The current transport operating mode.
Definition: RHGenericDriver.h:253
DataRate
Values to be passed to setDataRate() to control the on-air data rate.
Definition: RH_E32.h:230
@ ModePowerSaving
Receiver sleeps until a message is received.
Definition: RH_E32.h:364
@ 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 void setMode(RHMode mode)
Sets the operating mode of the transport.
Definition: RHGenericDriver.cpp:164
bool setFrequency(uint16_t frequency)