ESPHome  2024.12.2
Public Member Functions | Static Public Member Functions | Data Fields | Protected Member Functions | Protected Attributes
esphome::lightwaverf::LwRx Class Reference

#include <LwRx.h>

Public Member Functions

void lwrx_setup (InternalGPIOPin *pin)
 Set things up to receive LightWaveRF 434Mhz messages pin must be 2 or 3 to trigger interrupts !!! For Spark, any pin will work. More...
 
void lwrx_settranslate (bool translate)
 Set translate mode. More...
 
bool lwrx_message ()
 Test if a message has arrived. More...
 
bool lwrx_getmessage (uint8_t *buf, uint8_t len)
 Transfer a message to user buffer. More...
 
void lwrx_setfilter (uint8_t repeats, uint8_t timeout)
 Set up repeat filtering of received messages. More...
 
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 translated form to make comparisons quicker. More...
 
uint8_t lwrx_getpair (uint8_t *pairdata, uint8_t pairnumber)
 Get pair data (translated back to nibble form. More...
 
void lwrx_makepair (uint8_t timeout)
 Make a pair from next message successfully received. More...
 
void lwrx_set_pair_mode (bool pair_enforce, bool pair_base_only)
 Set pairs behaviour. More...
 
uint32_t lwrx_packetinterval ()
 Return time in milliseconds since last packet received. More...
 

Static Public Member Functions

static void rx_process_bits (LwRx *arg)
 Pin change interrupt routine that identifies 1 and 0 LightwaveRF bits and constructs a message when a valid packet of data is received. More...
 

Data Fields

uint8_t rx_paircount = 0
 
uint8_t rx_pairs [RX_MAXPAIRS][8]
 
bool rx_pairEnforce = false
 
bool rx_pairBaseOnly = false
 
uint8_t rx_pairtimeout = 0
 
uint8_t rx_repeats = 2
 
uint8_t rx_repeatcount = 0
 
uint8_t rx_timeout = 20
 
uint32_t rx_prevpkttime = 0
 
uint32_t rx_pairstarttime = 0
 
uint8_t rx_msg [RX_MSGLEN]
 
uint8_t rx_buf [RX_MSGLEN]
 
uint32_t rx_prev
 
bool rx_msgcomplete = false
 
bool rx_translate = true
 
uint8_t rx_state = 0
 
uint8_t rx_num_bits = 0
 
uint8_t rx_num_bytes = 0
 
uint16_t lwrx_stats [RX_STAT_COUNT]
 
bool lwrx_stats_enable = true
 

Protected Member Functions

void lwrx_clearpairing_ ()
 Clear all pairing. More...
 
bool lwrx_getstats_ (uint16_t *stats)
 Return stats on high and low pulses. More...
 
void lwrx_setstatsenable_ (bool rx_stats_enable)
 Set stats mode. More...
 
bool rx_report_message_ ()
 Check a message to see if it should be reported under pairing / mood / all off rules returns -1 if none found. More...
 
int16_t rx_find_nibble_ (uint8_t data)
 Find nibble from byte returns -1 if none found. More...
 
void rx_addpairfrommsg_ ()
 add pair from message buffer More...
 
void rx_paircommit_ ()
 check and commit pair More...
 
void rx_remove_pair_ (uint8_t *buf)
 Remove an existing pair matching the buffer. More...
 
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 if allDevices is true then ignore the device number Returns matching pair number, -1 if not found, -2 if no pairs defined. More...
 

Protected Attributes

ISRInternalGPIOPin rx_pin_isr_
 
InternalGPIOPinrx_pin_
 

Detailed Description

Definition at line 47 of file LwRx.h.

Member Function Documentation

◆ lwrx_addpair()

uint8_t esphome::lightwaverf::LwRx::lwrx_addpair ( const uint8_t *  pairdata)

Add a pair to filter received messages pairdata is device,dummy,5*addr,room pairdata is held in translated form to make comparisons quicker.

Definition at line 240 of file LwRx.cpp.

◆ lwrx_clearpairing_()

void esphome::lightwaverf::LwRx::lwrx_clearpairing_ ( )
protected

Clear all pairing.

Definition at line 276 of file LwRx.cpp.

◆ lwrx_getmessage()

bool esphome::lightwaverf::LwRx::lwrx_getmessage ( uint8_t *  buf,
uint8_t  len 
)

Transfer a message to user buffer.

Definition at line 184 of file LwRx.cpp.

◆ lwrx_getpair()

uint8_t esphome::lightwaverf::LwRx::lwrx_getpair ( uint8_t *  pairdata,
uint8_t  pairnumber 
)

Get pair data (translated back to nibble form.

Definition at line 261 of file LwRx.cpp.

◆ lwrx_getstats_()

bool esphome::lightwaverf::LwRx::lwrx_getstats_ ( uint16_t *  stats)
protected

Return stats on high and low pulses.

Definition at line 281 of file LwRx.cpp.

◆ lwrx_makepair()

void esphome::lightwaverf::LwRx::lwrx_makepair ( uint8_t  timeout)

Make a pair from next message successfully received.

Definition at line 253 of file LwRx.cpp.

◆ lwrx_message()

bool esphome::lightwaverf::LwRx::lwrx_message ( )

Test if a message has arrived.

Definition at line 175 of file LwRx.cpp.

◆ lwrx_packetinterval()

uint32_t esphome::lightwaverf::LwRx::lwrx_packetinterval ( )

Return time in milliseconds since last packet received.

Definition at line 225 of file LwRx.cpp.

◆ lwrx_set_pair_mode()

void esphome::lightwaverf::LwRx::lwrx_set_pair_mode ( bool  pair_enforce,
bool  pair_base_only 
)

Set pairs behaviour.

Definition at line 303 of file LwRx.cpp.

◆ lwrx_setfilter()

void esphome::lightwaverf::LwRx::lwrx_setfilter ( uint8_t  repeats,
uint8_t  timeout 
)

Set up repeat filtering of received messages.

Definition at line 230 of file LwRx.cpp.

◆ lwrx_setstatsenable_()

void esphome::lightwaverf::LwRx::lwrx_setstatsenable_ ( bool  rx_stats_enable)
protected

Set stats mode.

Definition at line 293 of file LwRx.cpp.

◆ lwrx_settranslate()

void esphome::lightwaverf::LwRx::lwrx_settranslate ( bool  translate)

Set translate mode.

Definition at line 180 of file LwRx.cpp.

◆ lwrx_setup()

void esphome::lightwaverf::LwRx::lwrx_setup ( InternalGPIOPin pin)

Set things up to receive LightWaveRF 434Mhz messages pin must be 2 or 3 to trigger interrupts !!! For Spark, any pin will work.

Definition at line 313 of file LwRx.cpp.

◆ rx_addpairfrommsg_()

void esphome::lightwaverf::LwRx::rx_addpairfrommsg_ ( )
protected

add pair from message buffer

Definition at line 354 of file LwRx.cpp.

◆ rx_check_pairs_()

int16_t esphome::lightwaverf::LwRx::rx_check_pairs_ ( const uint8_t *  buf,
bool  all_devices 
)
protected

Check to see if message matches one of the pairs if mode is pairBase only then ignore device and room if allDevices is true then ignore the device number Returns matching pair number, -1 if not found, -2 if no pairs defined.

Definition at line 376 of file LwRx.cpp.

◆ rx_find_nibble_()

int16_t esphome::lightwaverf::LwRx::rx_find_nibble_ ( uint8_t  data)
protected

Find nibble from byte returns -1 if none found.

Definition at line 341 of file LwRx.cpp.

◆ rx_paircommit_()

void esphome::lightwaverf::LwRx::rx_paircommit_ ( )
protected

check and commit pair

Definition at line 364 of file LwRx.cpp.

◆ rx_process_bits()

void IRAM_ATTR esphome::lightwaverf::LwRx::rx_process_bits ( LwRx arg)
static

Pin change interrupt routine that identifies 1 and 0 LightwaveRF bits and constructs a message when a valid packet of data is received.

Definition at line 20 of file LwRx.cpp.

◆ rx_remove_pair_()

void esphome::lightwaverf::LwRx::rx_remove_pair_ ( uint8_t *  buf)
protected

Remove an existing pair matching the buffer.

Definition at line 412 of file LwRx.cpp.

◆ rx_report_message_()

bool esphome::lightwaverf::LwRx::rx_report_message_ ( )
protected

Check a message to see if it should be reported under pairing / mood / all off rules returns -1 if none found.

Definition at line 326 of file LwRx.cpp.

Field Documentation

◆ lwrx_stats

uint16_t esphome::lightwaverf::LwRx::lwrx_stats[RX_STAT_COUNT]

Definition at line 116 of file LwRx.h.

◆ lwrx_stats_enable

bool esphome::lightwaverf::LwRx::lwrx_stats_enable = true

Definition at line 118 of file LwRx.h.

◆ rx_buf

uint8_t esphome::lightwaverf::LwRx::rx_buf[RX_MSGLEN]

Definition at line 104 of file LwRx.h.

◆ rx_msg

uint8_t esphome::lightwaverf::LwRx::rx_msg[RX_MSGLEN]

Definition at line 103 of file LwRx.h.

◆ rx_msgcomplete

bool esphome::lightwaverf::LwRx::rx_msgcomplete = false

Definition at line 108 of file LwRx.h.

◆ rx_num_bits

uint8_t esphome::lightwaverf::LwRx::rx_num_bits = 0

Definition at line 113 of file LwRx.h.

◆ rx_num_bytes

uint8_t esphome::lightwaverf::LwRx::rx_num_bytes = 0

Definition at line 114 of file LwRx.h.

◆ rx_pairBaseOnly

bool esphome::lightwaverf::LwRx::rx_pairBaseOnly = false

Definition at line 91 of file LwRx.h.

◆ rx_paircount

uint8_t esphome::lightwaverf::LwRx::rx_paircount = 0

Definition at line 86 of file LwRx.h.

◆ rx_pairEnforce

bool esphome::lightwaverf::LwRx::rx_pairEnforce = false

Definition at line 89 of file LwRx.h.

◆ rx_pairs

uint8_t esphome::lightwaverf::LwRx::rx_pairs[RX_MAXPAIRS][8]

Definition at line 87 of file LwRx.h.

◆ rx_pairstarttime

uint32_t esphome::lightwaverf::LwRx::rx_pairstarttime = 0

Definition at line 100 of file LwRx.h.

◆ rx_pairtimeout

uint8_t esphome::lightwaverf::LwRx::rx_pairtimeout = 0

Definition at line 93 of file LwRx.h.

◆ rx_pin_

InternalGPIOPin* esphome::lightwaverf::LwRx::rx_pin_
protected

Definition at line 138 of file LwRx.h.

◆ rx_pin_isr_

ISRInternalGPIOPin esphome::lightwaverf::LwRx::rx_pin_isr_
protected

Definition at line 137 of file LwRx.h.

◆ rx_prev

uint32_t esphome::lightwaverf::LwRx::rx_prev

Definition at line 106 of file LwRx.h.

◆ rx_prevpkttime

uint32_t esphome::lightwaverf::LwRx::rx_prevpkttime = 0

Definition at line 99 of file LwRx.h.

◆ rx_repeatcount

uint8_t esphome::lightwaverf::LwRx::rx_repeatcount = 0

Definition at line 97 of file LwRx.h.

◆ rx_repeats

uint8_t esphome::lightwaverf::LwRx::rx_repeats = 2

Definition at line 96 of file LwRx.h.

◆ rx_state

uint8_t esphome::lightwaverf::LwRx::rx_state = 0

Definition at line 111 of file LwRx.h.

◆ rx_timeout

uint8_t esphome::lightwaverf::LwRx::rx_timeout = 20

Definition at line 98 of file LwRx.h.

◆ rx_translate

bool esphome::lightwaverf::LwRx::rx_translate = true

Definition at line 109 of file LwRx.h.


The documentation for this class was generated from the following files: