13 namespace lightwaverf {
24 uint16_t dur = (curr - args->
rx_prev);
28 }
else if (dur < 500) {
30 }
else if (dur < 2000) {
32 }
else if (dur > 5000) {
42 args->
rx_state = RX_STATE_MSGSTARTFOUND;
46 case RX_STATE_MSGSTARTFOUND:
53 args->
rx_state = RX_STATE_BYTESTARTFOUND;
61 case RX_STATE_BYTESTARTFOUND:
82 case RX_STATE_GETBYTE:
125 uint32_t curr_millis =
millis();
131 int16_t i = RX_MSGLEN;
134 }
while ((i >= 0) && (args->
rx_msg[i] == args->
rx_buf[i]));
150 if (args->
rx_msg[3] == RX_CMD_ON) {
152 }
else if (args->
rx_msg[3] == RX_CMD_OFF) {
165 args->
rx_state = RX_STATE_BYTESTARTFOUND;
188 for (uint8_t i = 0; ret && i < RX_MSGLEN; i++) {
242 for (uint8_t i = 0; i < 8; i++) {
264 for (uint8_t i = 0; i < 8; i++) {
283 memcpy(stats, this->
lwrx_stats, 2 * RX_STAT_COUNT);
297 memcpy(this->
lwrx_stats, LWRX_STATSDFLT,
sizeof(LWRX_STATSDFLT));
319 memcpy(this->
lwrx_stats, LWRX_STATSDFLT,
sizeof(LWRX_STATSDFLT));
332 all_devices = ((this->
rx_msg[3] == RX_CMD_MOOD && this->
rx_msg[2] == RX_DEV_15) ||
333 (this->rx_msg[3] == RX_CMD_OFF && this->rx_msg[0] == RX_PAR0_ALLOFF));
344 if (RX_NIBBLE[i] == data)
366 this->rx_paircount++;
382 int16_t jstart, jend;
391 jend = (all_devices) ? 2 : 0;
393 while (pair > 0 && j < 0) {
399 if (this->
rx_pairs[pair][j] != buf[j]) {
405 return (j >= 0) ? pair : -1;
416 for (uint8_t j = 0; j < 8; j++) {
bool lwrx_getmessage(uint8_t *buf, uint8_t len)
Transfer a message to user buffer.
uint32_t rx_pairstarttime
uint32_t lwrx_packetinterval()
Return time in milliseconds since last packet received.
void rx_addpairfrommsg_()
add pair from message buffer
void lwrx_setstatsenable_(bool rx_stats_enable)
Set stats mode.
static void rx_process_bits(LwRx *arg)
Pin change interrupt routine that identifies 1 and 0 LightwaveRF bits and constructs a message when a...
void lwrx_setfilter(uint8_t repeats, uint8_t timeout)
Set up repeat filtering of received messages.
uint32_t IRAM_ATTR HOT micros()
uint8_t rx_buf[RX_MSGLEN]
uint32_t IRAM_ATTR HOT millis()
uint8_t rx_pairs[RX_MAXPAIRS][8]
bool lwrx_message()
Test if a message has arrived.
uint8_t lwrx_getpair(uint8_t *pairdata, uint8_t pairnumber)
Get pair data (translated back to nibble form.
void lwrx_set_pair_mode(bool pair_enforce, bool pair_base_only)
Set pairs behaviour.
bool lwrx_getstats_(uint16_t *stats)
Return stats on high and low pulses.
int16_t rx_check_pairs_(const uint8_t *buf, bool all_devices)
Check to see if message matches one of the pairs if mode is pairBase only then ignore device and room...
void lwrx_makepair(uint8_t timeout)
Make a pair from next message successfully received.
virtual ISRInternalGPIOPin to_isr() const =0
void lwrx_clearpairing_()
Clear all pairing.
int16_t rx_find_nibble_(uint8_t data)
Find nibble from byte returns -1 if none found.
uint16_t lwrx_stats[RX_STAT_COUNT]
Implementation of SPI Controller mode.
void rx_remove_pair_(uint8_t *buf)
Remove an existing pair matching the buffer.
uint8_t lwrx_addpair(const uint8_t *pairdata)
Add a pair to filter received messages pairdata is device,dummy,5*addr,room pairdata is held in trans...
ISRInternalGPIOPin rx_pin_isr_
void lwrx_setup(InternalGPIOPin *pin)
Set things up to receive LightWaveRF 434Mhz messages pin must be 2 or 3 to trigger interrupts !!! For...
uint8_t rx_msg[RX_MSGLEN]
void attach_interrupt(void(*func)(T *), T *arg, gpio::InterruptType type) const
void lwrx_settranslate(bool translate)
Set translate mode.
bool rx_report_message_()
Check a message to see if it should be reported under pairing / mood / all off rules returns -1 if no...
void rx_paircommit_()
check and commit pair