9#include <RHGenericDriver.h>
13#define RH_ASK_MAX_PAYLOAD_LEN 67
17#define RH_ASK_HEADER_LEN 4
22#ifndef RH_ASK_MAX_MESSAGE_LEN
23 #define RH_ASK_MAX_MESSAGE_LEN (RH_ASK_MAX_PAYLOAD_LEN - RH_ASK_HEADER_LEN - 3)
26#if !defined(RH_ASK_RX_SAMPLES_PER_BIT)
28 #define RH_ASK_RX_SAMPLES_PER_BIT 8
32#define RH_ASK_RX_RAMP_LEN 160
40#define RH_ASK_RAMP_INC (RH_ASK_RX_RAMP_LEN/RH_ASK_RX_SAMPLES_PER_BIT)
42#define RH_ASK_RAMP_TRANSITION RH_ASK_RX_RAMP_LEN/2
44#define RH_ASK_RAMP_ADJUST 9
46#define RH_ASK_RAMP_INC_RETARD (RH_ASK_RAMP_INC-RH_ASK_RAMP_ADJUST)
48#define RH_ASK_RAMP_INC_ADVANCE (RH_ASK_RAMP_INC+RH_ASK_RAMP_ADJUST)
58#define RH_ASK_PREAMBLE_LEN 8
281 RH_ASK(uint16_t
speed = 2000, uint8_t rxPin = 11, uint8_t txPin = 12, uint8_t pttPin = 10,
bool pttInverted =
false);
305 RH_INTERRUPT_ATTR
virtual bool recv(uint8_t* buf, uint8_t* len);
313 virtual bool send(
const uint8_t* data, uint8_t len);
339#if (RH_PLATFORM == RH_PLATFORM_ESP8266)
341 uint32_t _timerIncrement;
346 uint8_t
timerCalc(uint16_t
speed, uint16_t max_ticks, uint16_t *nticks);
352 RH_INTERRUPT_ATTR
bool readRx();
361 RH_INTERRUPT_ATTR uint8_t
symbol_6to4(uint8_t symbol);
441 uint8_t
_txBuf[(RH_ASK_MAX_PAYLOAD_LEN * 2) + RH_ASK_PREAMBLE_LEN];
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