8static constexpr uint32_t HEADER_HIGH_US = 5000;
9static constexpr uint32_t HEADER_LOW_US = 1500;
10static constexpr uint32_t SHORT_US = 350;
11static constexpr uint32_t LONG_US = 750;
12static constexpr BitTimings BIT_TIMINGS{.one_space = SHORT_US,
13 .zero_space = LONG_US,
16 .zero_mark = SHORT_US};
22 dst->
item(HEADER_HIGH_US, HEADER_LOW_US);
24 const uint8_t bytes[5] = {
static_cast<uint8_t
>(data.id >> 16),
static_cast<uint8_t
>(data.id >> 8),
25 static_cast<uint8_t
>(data.id), data.channel,
26 static_cast<uint8_t
>((data.button & 0x0F) << 4 | (data.check & 0x0F))};
27 dst->
item_bytes<BIT_TIMINGS>(bytes,
sizeof(bytes));
31 if (!
src.expect_item(HEADER_HIGH_US, HEADER_LOW_US) || !
src.expect_bytes_last_mark<BIT_TIMINGS>(bytes,
sizeof(bytes)))
36 .button =
static_cast<uint8_t
>(bytes[4] >> 4),
37 .check =
static_cast<uint8_t
>(bytes[4] & 0x0F),
41 ESP_LOGI(TAG,
"Received Dooya: id=0x%08" PRIX32
", channel=%d, button=%d, check=%d", data.id, data.channel,
42 data.button, data.check);
optional< DooyaData > decode(RemoteReceiveData src)
void encode(RemoteTransmitData *dst, const DooyaData &data)
void dump(const DooyaData &data)
void set_carrier_frequency(uint32_t carrier_frequency)
void item(uint32_t mark, uint32_t space)
void item_bytes(const uint8_t *bytes, size_t len)
One item per bit of each byte.
void reserve(uint32_t len)
ESPHOME_LOG_TAG(TAG, "remote.abbwelcome")
constexpr uint32_t encode_uint24(uint8_t byte1, uint8_t byte2, uint8_t byte3)
Encode a 24-bit value given three bytes in most to least significant byte order.
A bit is a mark (one_mark or zero_mark, both bit_mark unless set) and a space (one_space or zero_spac...