7 namespace lightwaverf {
15 static const uint8_t RX_STAT_HIGH_AVE = 0;
16 static const uint8_t RX_STAT_HIGH_MAX = 1;
17 static const uint8_t RX_STAT_HIGH_MIN = 2;
18 static const uint8_t RX_STAT_LOW0_AVE = 3;
19 static const uint8_t RX_STAT_LOW0_MAX = 4;
20 static const uint8_t RX_STAT_LOW0_MIN = 5;
21 static const uint8_t RX_STAT_LOW1_AVE = 6;
22 static const uint8_t RX_STAT_LOW1_MAX = 7;
23 static const uint8_t RX_STAT_LOW1_MIN = 8;
24 static const uint8_t RX_STAT_COUNT = 9;
27 static const uint8_t RX_MAXPAIRS = 10;
29 static const uint8_t RX_NIBBLE[] = {0xF6, 0xEE, 0xED, 0xEB, 0xDE, 0xDD, 0xDB, 0xBE,
30 0xBD, 0xBB, 0xB7, 0x7E, 0x7D, 0x7B, 0x77, 0x6F};
31 static const uint8_t RX_CMD_OFF = 0xF6;
32 static const uint8_t RX_CMD_ON = 0xEE;
33 static const uint8_t RX_CMD_MOOD = 0xED;
34 static const uint8_t RX_PAR0_ALLOFF = 0x7D;
35 static const uint8_t RX_DEV_15 = 0x6F;
37 static const uint8_t RX_MSGLEN = 10;
39 static const uint8_t RX_STATE_IDLE = 0;
40 static const uint8_t RX_STATE_MSGSTARTFOUND = 1;
41 static const uint8_t RX_STATE_BYTESTARTFOUND = 2;
42 static const uint8_t RX_STATE_GETBYTE = 3;
45 static const uint16_t LWRX_STATSDFLT[RX_STAT_COUNT] = {5000, 0, 5000, 20000, 0, 2500, 4000, 0, 500};
70 uint8_t
lwrx_getpair(uint8_t *pairdata, uint8_t pairnumber);
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
Copy of GPIOPin that is safe to use from ISRs (with no virtual functions)
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.
uint8_t rx_buf[RX_MSGLEN]
InternalGPIOPin * rx_pin_
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.
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 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