6 namespace remote_base {
8 static const char *
const TAG =
"remote.samsung";
10 static const uint32_t HEADER_HIGH_US = 4500;
11 static const uint32_t HEADER_LOW_US = 4500;
12 static const uint32_t BIT_HIGH_US = 560;
13 static const uint32_t BIT_ONE_LOW_US = 1690;
14 static const uint32_t BIT_ZERO_LOW_US = 560;
15 static const uint32_t FOOTER_HIGH_US = 560;
16 static const uint32_t FOOTER_LOW_US = 560;
22 dst->
item(HEADER_HIGH_US, HEADER_LOW_US);
24 for (uint8_t bit = data.
nbits; bit > 0; bit--) {
25 if ((data.
data >> (bit - 1)) & 1) {
26 dst->
item(BIT_HIGH_US, BIT_ONE_LOW_US);
28 dst->
item(BIT_HIGH_US, BIT_ZERO_LOW_US);
32 dst->
item(FOOTER_HIGH_US, FOOTER_LOW_US);
39 if (!src.
expect_item(HEADER_HIGH_US, HEADER_LOW_US))
42 for (out.nbits = 0; out.nbits < 64; out.nbits++) {
44 out.data = (out.data << 1) | 1;
45 }
else if (src.
expect_item(BIT_HIGH_US, BIT_ZERO_LOW_US)) {
46 out.data = (out.data << 1) | 0;
47 }
else if (out.nbits >= 31) {
61 ESP_LOGI(TAG,
"Received Samsung: data=0x%" PRIX64
", nbits=%d", data.
data, data.
nbits);
optional< SamsungData > decode(RemoteReceiveData src) override
void dump(const SamsungData &data) override
void set_carrier_frequency(uint32_t carrier_frequency)
void item(uint32_t mark, uint32_t space)
bool expect_mark(uint32_t length)
Implementation of SPI Controller mode.
void reserve(uint32_t len)
bool expect_item(uint32_t mark, uint32_t space)
void encode(RemoteTransmitData *dst, const SamsungData &data) override