5 namespace remote_base {
7 static const char *
const TAG =
"remote.lg";
9 static const uint32_t HEADER_HIGH_US = 8000;
10 static const uint32_t HEADER_LOW_US = 4000;
11 static const uint32_t BIT_HIGH_US = 600;
12 static const uint32_t BIT_ONE_LOW_US = 1600;
13 static const uint32_t BIT_ZERO_LOW_US = 550;
19 dst->
item(HEADER_HIGH_US, HEADER_LOW_US);
21 for (uint32_t mask = 1UL << (data.
nbits - 1); mask != 0; mask >>= 1) {
22 if (data.
data & mask) {
23 dst->
item(BIT_HIGH_US, BIT_ONE_LOW_US);
25 dst->
item(BIT_HIGH_US, BIT_ZERO_LOW_US);
29 dst->
mark(BIT_HIGH_US);
36 if (!src.
expect_item(HEADER_HIGH_US, HEADER_LOW_US))
39 for (out.nbits = 0; out.nbits < 32; out.nbits++) {
41 out.data = (out.data << 1) | 1;
42 }
else if (src.
expect_item(BIT_HIGH_US, BIT_ZERO_LOW_US)) {
43 out.data = (out.data << 1) | 0;
44 }
else if (out.nbits == 28) {
54 ESP_LOGI(TAG,
"Received LG: data=0x%08" PRIX32
", nbits=%d", data.
data, data.
nbits);
optional< LGData > decode(RemoteReceiveData src) override
void set_carrier_frequency(uint32_t carrier_frequency)
void item(uint32_t mark, uint32_t space)
void dump(const LGData &data) override
void mark(uint32_t length)
void encode(RemoteTransmitData *dst, const LGData &data) override
Implementation of SPI Controller mode.
void reserve(uint32_t len)
bool expect_item(uint32_t mark, uint32_t space)