5 namespace remote_base {
7 static const char *
const TAG =
"remote.sony";
9 static const uint32_t HEADER_HIGH_US = 2400;
10 static const uint32_t HEADER_LOW_US = 600;
11 static const uint32_t BIT_ONE_HIGH_US = 1200;
12 static const uint32_t BIT_ZERO_HIGH_US = 600;
13 static const uint32_t BIT_LOW_US = 600;
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_ONE_HIGH_US, BIT_LOW_US);
25 dst->
item(BIT_ZERO_HIGH_US, BIT_LOW_US);
34 if (!src.
expect_item(HEADER_HIGH_US, HEADER_LOW_US))
37 for (; out.nbits < 20; out.nbits++) {
43 }
else if (out.nbits == 12 || out.nbits == 15) {
49 out.data = (out.data << 1UL) | bit;
54 if (out.nbits == 12 || out.nbits == 15 || out.nbits == 20)
65 ESP_LOGI(TAG,
"Received Sony: data=0x%08" PRIX32
", nbits=%d", data.
data, data.
nbits);
void set_carrier_frequency(uint32_t carrier_frequency)
void encode(RemoteTransmitData *dst, const SonyData &data) override
void item(uint32_t mark, uint32_t space)
bool expect_space(uint32_t length)
bool expect_mark(uint32_t length)
optional< SonyData > decode(RemoteReceiveData src) override
Implementation of SPI Controller mode.
void dump(const SonyData &data) override
void reserve(uint32_t len)
bool expect_item(uint32_t mark, uint32_t space)
bool peek_space_at_least(uint32_t length, uint32_t offset=0) const