RadioHead
RH_ASK.h
1// RH_ASK.h
2//
3// Copyright (C) 2014 Mike McCauley
4// $Id: RH_ASK.h,v 1.22 2020/05/06 22:26:45 mikem Exp $
5
6#ifndef RH_ASK_h
7#define RH_ASK_h
8
9#include <RHGenericDriver.h>
10
11// Maximum message length (including the headers, byte count and FCS) we are willing to support
12// This is pretty arbitrary
13#define RH_ASK_MAX_PAYLOAD_LEN 67
14
15// The length of the headers we add (To, From, Id, Flags)
16// The headers are inside the payload and are therefore protected by the FCS
17#define RH_ASK_HEADER_LEN 4
18
19// This is the maximum message length that can be supported by this library.
20// Can be pre-defined to a smaller size (to save SRAM) prior to including this header
21// Here we allow for 1 byte message length, 4 bytes headers, user data and 2 bytes of FCS
22#ifndef RH_ASK_MAX_MESSAGE_LEN
23 #define RH_ASK_MAX_MESSAGE_LEN (RH_ASK_MAX_PAYLOAD_LEN - RH_ASK_HEADER_LEN - 3)
24#endif
25
26#if !defined(RH_ASK_RX_SAMPLES_PER_BIT)
27/// Number of samples per bit
28 #define RH_ASK_RX_SAMPLES_PER_BIT 8
29#endif //RH_ASK_RX_SAMPLES_PER_BIT
30
31/// The size of the receiver ramp. Ramp wraps modulo this number
32#define RH_ASK_RX_RAMP_LEN 160
33
34// Ramp adjustment parameters
35// Standard is if a transition occurs before RH_ASK_RAMP_TRANSITION (80) in the ramp,
36// the ramp is retarded by adding RH_ASK_RAMP_INC_RETARD (11)
37// else by adding RH_ASK_RAMP_INC_ADVANCE (29)
38// If there is no transition it is adjusted by RH_ASK_RAMP_INC (20)
39/// Internal ramp adjustment parameter
40#define RH_ASK_RAMP_INC (RH_ASK_RX_RAMP_LEN/RH_ASK_RX_SAMPLES_PER_BIT)
41/// Internal ramp adjustment parameter
42#define RH_ASK_RAMP_TRANSITION RH_ASK_RX_RAMP_LEN/2
43/// Internal ramp adjustment parameter
44#define RH_ASK_RAMP_ADJUST 9
45/// Internal ramp adjustment parameter
46#define RH_ASK_RAMP_INC_RETARD (RH_ASK_RAMP_INC-RH_ASK_RAMP_ADJUST)
47/// Internal ramp adjustment parameter
48#define RH_ASK_RAMP_INC_ADVANCE (RH_ASK_RAMP_INC+RH_ASK_RAMP_ADJUST)
49
50/// Outgoing message bits grouped as 6-bit words
51/// 36 alternating 1/0 bits, followed by 12 bits of start symbol (together called the preamble)
52/// Followed immediately by the 4-6 bit encoded byte count,
53/// message buffer and 2 byte FCS
54/// Each byte from the byte count on is translated into 2x6-bit words
55/// Caution, each symbol is transmitted LSBit first,
56/// but each byte is transmitted high nybble first
57/// This is the number of 6 bit nibbles in the preamble
58#define RH_ASK_PREAMBLE_LEN 8
59
60/////////////////////////////////////////////////////////////////////
61/// \class RH_ASK RH_ASK.h <RH_ASK.h>
62/// \brief Driver to send and receive unaddressed, unreliable datagrams via inexpensive ASK (Amplitude Shift Keying) or
63/// OOK (On Off Keying) RF transceivers.
64///
65/// The message format and software technology is based on our earlier VirtualWire library
66/// (http://www.airspayce.com/mikem/arduino/VirtualWire), with which it is compatible.
67/// See http://www.airspayce.com/mikem/arduino/VirtualWire.pdf for more details.
68/// VirtualWire is now obsolete and unsupported and is replaced by this library.
69///
70/// RH_ASK is a Driver for Arduino, Maple and others that provides features to send short
71/// messages, without addressing, retransmit or acknowledgment, a bit like UDP
72/// over wireless, using ASK (amplitude shift keying). Supports a number of
73/// inexpensive radio transmitters and receivers. All that is required is
74/// transmit data, receive data and (for transmitters, optionally) a PTT
75/// transmitter enable. Can also be used over various analog connections (not just a data radio),
76/// such as the audio channel of an A/V sender, or long TTL lines.
77///
78/// It is intended to be compatible with the RF Monolithics (www.rfm.com)
79/// Virtual Wire protocol, but this has not been tested.
80///
81/// Does not use the Arduino UART. Messages are sent with a training preamble,
82/// message length and checksum. Messages are sent with 4-to-6 bit encoding
83/// for good DC balance, and a CRC checksum for message integrity.
84///
85/// But why not just use a UART connected directly to the
86/// transmitter/receiver? As discussed in the RFM documentation, ASK receivers
87/// require a burst of training pulses to synchronize the transmitter and
88/// receiver, and also requires good balance between 0s and 1s in the message
89/// stream in order to maintain the DC balance of the message. UARTs do not
90/// provide these. They work a bit with ASK wireless, but not as well as this
91/// code.
92///
93/// \par Theory of operation
94///
95/// See ASH Transceiver Software Designer's Guide of 2002.08.07
96/// http://wireless.murata.com/media/products/apnotes/tr_swg05.pdf
97///
98/// http://web.engr.oregonstate.edu/~moon/research/files/cas2_mar_07_dpll.pdf while not directly relevant
99/// is also interesting.
100///
101/// \par Implementation Details
102///
103/// Messages of up to RH_ASK_MAX_PAYLOAD_LEN (67) bytes can be sent
104/// Each message is transmitted as:
105///
106/// - 36 bit training preamble consisting of 0-1 bit pairs
107/// - 12 bit start symbol 0xb38
108/// - 1 byte of message length byte count (4 to 30), count includes byte count and FCS bytes
109/// - n message bytes (including 4 bytes of header), maximum n is RH_ASK_MAX_MESSAGE_LEN + 4 (64)
110/// - 2 bytes FCS, sent low byte-hi byte
111///
112/// Everything after the start symbol is encoded 4 to 6 bits, Therefore a byte in the message
113/// is encoded as 2x6 bit symbols, sent hi nybble, low nybble. Each symbol is sent LSBit
114/// first. The message may consist of any binary digits.
115///
116/// The Arduino Diecimila clock rate is 16MHz => 62.5ns/cycle.
117/// For an RF bit rate of 2000 bps, need 500microsec bit period.
118/// The ramp requires 8 samples per bit period, so need 62.5microsec per sample => interrupt tick is 62.5microsec.
119///
120/// The maximum packet length consists of
121/// (6 + 2 + RH_ASK_MAX_MESSAGE_LEN*2) * 6 = 768 bits = 0.384 secs (at 2000 bps).
122/// where RH_ASK_MAX_MESSAGE_LEN is RH_ASK_MAX_PAYLOAD_LEN - 7 (= 60).
123/// The code consists of an ISR interrupt handler. Most of the work is done in the interrupt
124/// handler for both transmit and receive, but some is done from the user level. Expensive
125/// functions like CRC computations are always done in the user level.
126///
127/// \par Supported Hardware
128///
129/// A range of communications
130/// hardware is supported. The ones listed below are available in common retail
131/// outlets in Australia and other countries for under $10 per unit. Many
132/// other modules may also work with this software.
133///
134/// Runs on a wide range of Arduino processors using Arduino IDE 1.0 or later.
135/// Also runs on on Energia,
136/// with MSP430G2553 / G2452 and Arduino with ATMega328 (courtesy Yannick DEVOS - XV4Y),
137/// but untested by us. It also runs on Teensy 3.0 (courtesy of Paul
138/// Stoffregen), but untested by us. Also compiles and runs on ATtiny85 in
139/// Arduino environment, courtesy r4z0r7o3. Also compiles on maple-ide-v0.0.12,
140/// and runs on Maple, flymaple 1.1 etc. Runs on ATmega8/168 (Arduino Diecimila,
141/// Uno etc), ATmega328 and can run on almost any other AVR8 platform,
142/// without relying on the Arduino framework, by properly configuring the
143/// library editing the RH_ASK.h header file for describing the access
144/// to IO pins and for setting up the timer.
145/// Runs on ChipKIT Core supported processors such as Uno32 etc.
146///
147/// - Receivers
148/// - RX-B1 (433.92MHz) (also known as ST-RX04-ASK)
149/// - RFM83C from HopeRF http://www.hoperfusa.com/details.jsp?pid=126
150/// - SYN480R and other similar ASK receivers
151/// - Transmitters:
152/// - TX-C1 (433.92MHz)
153/// - RFM85 from HopeRF http://www.hoperfusa.com/details.jsp?pid=127
154/// - SYN115, F115 and other similar ASK transmitters
155/// - Transceivers
156/// - DR3100 (433.92MHz)
157///
158/// \par Interoperation with other systems
159/// RH_ASK is reported to be supported by RTL-SDR https://www.rtl-sdr.com/tag/rtl_433/
160///
161/// \par Connecting to Arduino
162///
163/// Most transmitters can be connected to Arduino like this:
164/// \code
165/// Arduino Transmitter
166/// GND------------------------------GND
167/// D12------------------------------Data
168/// 5V-------------------------------VCC
169/// \endcode
170///
171/// Most receivers can be connected to Arduino like this:
172/// \code
173/// Arduino Receiver
174/// GND------------------------------GND
175/// D11------------------------------Data
176/// 5V-------------------------------VCC
177/// SHUT (not connected)
178/// WAKEB (not connected)
179/// GND |
180/// ANT |- connect to your antenna syetem
181/// \endcode
182///
183/// RH_ASK works with ATTiny85, using Arduino 1.0.5 and tinycore from
184/// https://code.google.com/p/arduino-tiny/downloads/detail?name=arduino-tiny-0100-0018.zip
185/// Tested with the examples ask_transmitter and ask_receiver on ATTiny85.
186/// Caution: The RAM memory requirements on an ATTiny85 are *very* tight. Even the bare bones
187/// ask_transmitter sketch barely fits in eh RAM available on the ATTiny85. Its unlikely to work on
188/// smaller ATTinys such as the ATTiny45 etc. If you have wierd behaviour, consider
189/// reducing the size of RH_ASK_MAX_PAYLOAD_LEN to the minimum you can work with.
190/// Caution: the default internal clock speed on an ATTiny85 is 1MHz. You MUST set the internal clock speed
191/// to 8MHz. You can do this with Arduino IDE, tineycore and ArduinoISP by setting the board type to "ATtiny85@8MHz',
192/// setting theProgrammer to 'Arduino as ISP' and selecting Tools->Burn Bootloader. This does not actually burn a
193/// bootloader into the tiny, it just changes the fuses so the chip runs at 8MHz.
194/// If you run the chip at 1MHz, you will get RK_ASK speeds 1/8th of the expected.
195///
196/// Initialise RH_ASK for ATTiny85 like this:
197/// \code
198/// // #include <SPI.h> // comment this out, not needed
199/// RH_ASK driver(2000, 4, 3); // 200bps, TX on D3 (pin 2), RX on D4 (pin 3)
200/// \endcode
201/// then:
202/// Connect D3 (pin 2) as the output to the transmitter
203/// Connect D4 (pin 3) as the input from the receiver.
204///
205/// With AtTiny x17 (such as 3217 etc) using Spencer Kondes megaTinyCore, You can initialise like this:
206/// RH_ASK driver(2000, 6, 7);
207/// which will transmit on digital pin 7 == PB4 == physical pin 12 on Attiny x17
208/// and receive on digital pin 6 == PB5 == physical pin 11 on Attiny x17
209/// Uses Timer B1.
210///
211/// With AtTiny x16 (such as 3216 etc) using Spencer Kondes megaTinyCore, You can initialise like this:
212/// RH_ASK driver(2000, 11, 12);
213/// which will transmit on digital pin 12 == PC2 == physical pin 14 on Attiny x16
214/// and receive on digital pin 11 == PC1 == physical pin 13 on Attiny x16
215/// Uses Timer B1.
216///
217/// With AtTiny x14 (such as 1614 etc) using Spencer Kondes megaTinyCore, You can initialise like this:
218/// RH_ASK driver(2000, 6, 7);
219/// which will transmit on digital pin 7 == PB0 == physical pin 9 on Attiny x14
220/// and receive on digital pin 6 == PB1 == physical pin 8 on Attiny x16
221/// Uses Timer B1.
222///
223/// For testing purposes you can connect 2 Arduino RH_ASK instances directly, by
224/// connecting pin 12 of one to 11 of the other and vice versa, like this for a duplex connection:
225///
226/// \code
227/// Arduino 1 wires Arduino 1
228/// D11-----------------------------D12
229/// D12-----------------------------D11
230/// GND-----------------------------GND
231/// \endcode
232///
233/// You can also connect 2 RH_ASK instances over a suitable analog
234/// transmitter/receiver, such as the audio channel of an A/V transmitter/receiver. You may need
235/// buffers at each end of the connection to convert the 0-5V digital output to a suitable analog voltage.
236///
237/// Measured power output from RFM85 at 5V was 18dBm.
238///
239/// \par ESP8266
240/// This module has been tested with the ESP8266 using an ESP-12 on a breakout board
241/// ESP-12E SMD Adaptor Board with Power Regulator from tronixlabs
242/// http://tronixlabs.com.au/wireless/esp8266/esp8266-esp-12e-smd-adaptor-board-with-power-regulator-australia/
243/// compiled on Arduino 1.6.5 and the ESP8266 support 2.0 installed with Board Manager.
244/// CAUTION: do not use pin 11 for IO with this chip: it will cause the sketch to hang. Instead
245/// use constructor arguments to configure different pins, eg:
246/// \code
247/// RH_ASK driver(2000, 2, 4, 5);
248/// \endcode
249/// Which will initialise the driver at 2000 bps, recieve on GPIO2, transmit on GPIO4, PTT on GPIO5.
250/// Caution: on the tronixlabs breakout board, pins 4 and 5 may be labelled vice-versa.
251///
252/// \par Timers
253/// The RH_ASK driver uses a timer-driven interrupt to generate 8 interrupts per bit period. RH_ASK
254/// takes over a timer on Arduino-like platforms. By default it takes over Timer 1. You can force it
255/// to use Timer 2 instead by enabling the define RH_ASK_ARDUINO_USE_TIMER2 near the top of RH_ASK.cpp
256/// On Arduino Zero it takes over timer TC3. On Arduino Due it takes over timer
257/// TC0. On ESP8266, takes over timer0 (which conflicts with ServoTimer0).
258///
259/// Caution: ATTiny85 has only 2 timers, one (timer 0) usually used for
260/// millis() and one (timer 1) for PWM analog outputs. The RH_ASK Driver
261/// library, when built for ATTiny85, takes over timer 0, which prevents use
262/// of millis() etc but does permit analog outputs. This will affect the accuracy of millis() and time
263/// measurement.
264///
265/// \par STM32 F4 Discovery with Arduino and Arduino_STM32
266/// You can initialise the driver like this:
267/// \code
268/// RH_ASK driver(2000, PA3, PA4);
269/// \endcode
270/// and connect the serial to pins PA3 and PA4
272{
273public:
274 /// Constructor.
275 /// At present only one instance of RH_ASK per sketch is supported.
276 /// \param[in] speed The desired bit rate in bits per second
277 /// \param[in] rxPin The pin that is used to get data from the receiver
278 /// \param[in] txPin The pin that is used to send data to the transmitter
279 /// \param[in] pttPin The pin that is connected to the transmitter controller. It will be set HIGH to enable the transmitter (unless pttInverted is true).
280 /// \param[in] pttInverted true if you desire the pttin to be inverted so that LOW wil enable the transmitter.
281 RH_ASK(uint16_t speed = 2000, uint8_t rxPin = 11, uint8_t txPin = 12, uint8_t pttPin = 10, bool pttInverted = false);
282
283 /// Initialise the Driver transport hardware and software.
284 /// Make sure the Driver is properly configured before calling init().
285 /// \return true if initialisation succeeded.
286 virtual bool init();
287
288 /// Tests whether a new message is available
289 /// from the Driver.
290 /// On most drivers, this will also put the Driver into RHModeRx mode until
291 /// a message is actually received bythe transport, when it wil be returned to RHModeIdle.
292 /// This can be called multiple times in a timeout loop
293 /// \return true if a new, complete, error-free uncollected message is available to be retreived by recv()
294 virtual bool available();
295
296 /// Turns the receiver on if it not already on.
297 /// If there is a valid message available, copy it to buf and return true
298 /// else return false.
299 /// If a message is copied, *len is set to the length (Caution, 0 length messages are permitted).
300 /// You should be sure to call this function frequently enough to not miss any messages
301 /// It is recommended that you call it in your main loop.
302 /// \param[in] buf Location to copy the received message
303 /// \param[in,out] len Pointer to the number of octets available in buf. The number be reset to the actual number of octets copied.
304 /// \return true if a valid message was copied to buf
305 RH_INTERRUPT_ATTR virtual bool recv(uint8_t* buf, uint8_t* len);
306
307 /// Waits until any previous transmit packet is finished being transmitted with waitPacketSent().
308 /// Then loads a message into the transmitter and starts the transmitter. Note that a message length
309 /// of 0 is NOT permitted.
310 /// \param[in] data Array of data to be sent
311 /// \param[in] len Number of bytes of data to send (> 0)
312 /// \return true if the message length was valid and it was correctly queued for transmit
313 virtual bool send(const uint8_t* data, uint8_t len);
314
315 /// Returns the maximum message length
316 /// available in this Driver.
317 /// \return The maximum legal message length
318 virtual uint8_t maxMessageLength();
319
320 /// If current mode is Rx or Tx changes it to Idle. If the transmitter or receiver is running,
321 /// disables them.
322 RH_INTERRUPT_ATTR void setModeIdle();
323
324 /// If current mode is Tx or Idle, changes it to Rx.
325 /// Starts the receiver in the RF69.
326 RH_INTERRUPT_ATTR void setModeRx();
327
328 /// If current mode is Rx or Idle, changes it to Rx. F
329 /// Starts the transmitter in the RF69.
330 void setModeTx();
331
332 /// dont call this it used by the interrupt handler
333 RH_INTERRUPT_ATTR void handleTimerInterrupt();
334
335 /// Returns the current speed in bits per second
336 /// \return The current speed in bits per second
337 uint16_t speed() { return _speed;}
338
339#if (RH_PLATFORM == RH_PLATFORM_ESP8266)
340 /// ESP8266 timer0 increment value
341 uint32_t _timerIncrement;
342#endif
343
344protected:
345 /// Helper function for calculating timer ticks
346 uint8_t timerCalc(uint16_t speed, uint16_t max_ticks, uint16_t *nticks);
347
348 /// Set up the timer and its interrutps so the interrupt handler is called at the right frequency
349 void timerSetup();
350
351 /// Read the rxPin in a platform dependent way, taking into account whether it is inverted or not
352 RH_INTERRUPT_ATTR bool readRx();
353
354 /// Write the txPin in a platform dependent way
355 void writeTx(bool value);
356
357 /// Write the txPin in a platform dependent way, taking into account whether it is inverted or not
358 void writePtt(bool value);
359
360 /// Translates a 6 bit symbol to its 4 bit plaintext equivalent
361 RH_INTERRUPT_ATTR uint8_t symbol_6to4(uint8_t symbol);
362
363 /// The receiver handler function, called a 8 times the bit rate
364 void receiveTimer();
365
366 /// The transmitter handler function, called a 8 times the bit rate
367 void transmitTimer();
368
369 /// Check whether the latest received message is complete and uncorrupted
370 /// We should always check the FCS at user level, not interrupt level
371 /// since it is slow
372 void validateRxBuf();
373
374 /// Configure bit rate in bits per second
375 uint16_t _speed;
376
377 /// The configure receiver pin
378 uint8_t _rxPin;
379
380 /// The configure transmitter pin
381 uint8_t _txPin;
382
383 /// The configured transmitter enable pin
384 uint8_t _pttPin;
385
386 /// True of the sense of the rxPin is to be inverted
388
389 /// True of the sense of the pttPin is to be inverted
391
392 // Used in the interrupt handlers
393 /// Buf is filled but not validated
394 volatile bool _rxBufFull;
395
396 /// Buf is full and valid
397 volatile bool _rxBufValid;
398
399 /// Last digital input from the rx data pin
400 volatile bool _rxLastSample;
401
402 /// This is the integrate and dump integral. If there are <5 0 samples in the PLL cycle
403 /// the bit is declared a 0, else a 1
404 volatile uint8_t _rxIntegrator;
405
406 /// PLL ramp, varies between 0 and RH_ASK_RX_RAMP_LEN-1 (159) over
407 /// RH_ASK_RX_SAMPLES_PER_BIT (8) samples per nominal bit time.
408 /// When the PLL is synchronised, bit transitions happen at about the
409 /// 0 mark.
410 volatile uint8_t _rxPllRamp;
411
412 /// Flag indicates if we have seen the start symbol of a new message and are
413 /// in the processes of reading and decoding it
414 volatile uint8_t _rxActive;
415
416 /// Last 12 bits received, so we can look for the start symbol
417 volatile uint16_t _rxBits;
418
419 /// How many bits of message we have received. Ranges from 0 to 12
420 volatile uint8_t _rxBitCount;
421
422 /// The incoming message buffer
423 uint8_t _rxBuf[RH_ASK_MAX_PAYLOAD_LEN];
424
425 /// The incoming message expected length
426 volatile uint8_t _rxCount;
427
428 /// The incoming message buffer length received so far
429 volatile uint8_t _rxBufLen;
430
431 /// Index of the next symbol to send. Ranges from 0 to vw_tx_len
432 uint8_t _txIndex;
433
434 /// Bit number of next bit to send
435 uint8_t _txBit;
436
437 /// Sample number for the transmitter. Runs 0 to 7 during one bit interval
438 uint8_t _txSample;
439
440 /// The transmitter buffer in _symbols_ not data octets
441 uint8_t _txBuf[(RH_ASK_MAX_PAYLOAD_LEN * 2) + RH_ASK_PREAMBLE_LEN];
442
443 /// Number of symbols in _txBuf to be sent;
444 uint8_t _txBufLen;
445
446};
447
448/// @example ask_reliable_datagram_client.ino
449/// @example ask_reliable_datagram_server.ino
450/// @example ask_transmitter.ino
451/// @example ask_receiver.ino
452#endif
Abstract base class for a RadioHead driver.
Definition: RHGenericDriver.h:42
Driver to send and receive unaddressed, unreliable datagrams via inexpensive ASK (Amplitude Shift Key...
Definition: RH_ASK.h:272
uint8_t _txBufLen
Number of symbols in _txBuf to be sent;.
Definition: RH_ASK.h:444
RH_INTERRUPT_ATTR uint8_t symbol_6to4(uint8_t symbol)
Translates a 6 bit symbol to its 4 bit plaintext equivalent.
Definition: RH_ASK.cpp:903
void receiveTimer()
The receiver handler function, called a 8 times the bit rate.
Definition: RH_ASK.cpp:950
void setModeTx()
Definition: RH_ASK.cpp:593
uint8_t _txBit
Bit number of next bit to send.
Definition: RH_ASK.h:435
volatile uint8_t _rxCount
The incoming message expected length.
Definition: RH_ASK.h:426
volatile uint8_t _rxPllRamp
Definition: RH_ASK.h:410
uint8_t _pttPin
The configured transmitter enable pin.
Definition: RH_ASK.h:384
uint8_t _txSample
Sample number for the transmitter. Runs 0 to 7 during one bit interval.
Definition: RH_ASK.h:438
uint8_t _txIndex
Index of the next symbol to send. Ranges from 0 to vw_tx_len.
Definition: RH_ASK.h:432
uint8_t timerCalc(uint16_t speed, uint16_t max_ticks, uint16_t *nticks)
Helper function for calculating timer ticks.
Definition: RH_ASK.cpp:138
uint8_t _rxPin
The configure receiver pin.
Definition: RH_ASK.h:378
virtual bool send(const uint8_t *data, uint8_t len)
Definition: RH_ASK.cpp:643
virtual bool available()
Definition: RH_ASK.cpp:610
volatile bool _rxBufValid
Buf is full and valid.
Definition: RH_ASK.h:397
volatile uint8_t _rxBitCount
How many bits of message we have received. Ranges from 0 to 12.
Definition: RH_ASK.h:420
RH_INTERRUPT_ATTR void setModeRx()
Definition: RH_ASK.cpp:582
void validateRxBuf()
Definition: RH_ASK.cpp:922
void writePtt(bool value)
Write the txPin in a platform dependent way, taking into account whether it is inverted or not.
Definition: RH_ASK.cpp:732
void transmitTimer()
The transmitter handler function, called a 8 times the bit rate.
Definition: RH_ASK.cpp:1039
volatile uint16_t _rxBits
Last 12 bits received, so we can look for the start symbol.
Definition: RH_ASK.h:417
bool _pttInverted
True of the sense of the pttPin is to be inverted.
Definition: RH_ASK.h:390
volatile uint8_t _rxBufLen
The incoming message buffer length received so far.
Definition: RH_ASK.h:429
RH_INTERRUPT_ATTR bool readRx()
Read the rxPin in a platform dependent way, taking into account whether it is inverted or not.
Definition: RH_ASK.cpp:707
void timerSetup()
Set up the timer and its interrutps so the interrupt handler is called at the right frequency.
Definition: RH_ASK.cpp:199
RH_INTERRUPT_ATTR void handleTimerInterrupt()
dont call this it used by the interrupt handler
Definition: RH_ASK.cpp:1067
uint8_t _txBuf[(RH_ASK_MAX_PAYLOAD_LEN *2)+RH_ASK_PREAMBLE_LEN]
The transmitter buffer in symbols not data octets.
Definition: RH_ASK.h:441
uint8_t _rxBuf[RH_ASK_MAX_PAYLOAD_LEN]
The incoming message buffer.
Definition: RH_ASK.h:423
virtual RH_INTERRUPT_ATTR bool recv(uint8_t *buf, uint8_t *len)
Definition: RH_ASK.cpp:623
volatile bool _rxBufFull
Buf is filled but not validated.
Definition: RH_ASK.h:394
uint16_t speed()
Definition: RH_ASK.h:337
volatile uint8_t _rxActive
Definition: RH_ASK.h:414
uint8_t _txPin
The configure transmitter pin.
Definition: RH_ASK.h:381
volatile bool _rxLastSample
Last digital input from the rx data pin.
Definition: RH_ASK.h:400
bool _rxInverted
True of the sense of the rxPin is to be inverted.
Definition: RH_ASK.h:387
RH_INTERRUPT_ATTR void setModeIdle()
Definition: RH_ASK.cpp:571
uint16_t _speed
Configure bit rate in bits per second.
Definition: RH_ASK.h:375
void writeTx(bool value)
Write the txPin in a platform dependent way.
Definition: RH_ASK.cpp:719
virtual uint8_t maxMessageLength()
Definition: RH_ASK.cpp:748
RH_ASK(uint16_t speed=2000, uint8_t rxPin=11, uint8_t txPin=12, uint8_t pttPin=10, bool pttInverted=false)
Definition: RH_ASK.cpp:75
virtual bool init()
Definition: RH_ASK.cpp:91
volatile uint8_t _rxIntegrator
Definition: RH_ASK.h:404