5 namespace remote_base {
7 static const char *
const TAG =
"remote.dish";
9 static const uint32_t HEADER_HIGH_US = 400;
10 static const uint32_t HEADER_LOW_US = 6100;
11 static const uint32_t BIT_HIGH_US = 400;
12 static const uint32_t BIT_ONE_LOW_US = 1700;
13 static const uint32_t BIT_ZERO_LOW_US = 2800;
20 dst->
item(HEADER_HIGH_US, HEADER_LOW_US);
24 for (uint i = 0; i < 4; i++) {
26 for (uint8_t mask = 1UL << 5; mask; mask >>= 1) {
28 dst->
item(BIT_HIGH_US, BIT_ONE_LOW_US);
30 dst->
item(BIT_HIGH_US, BIT_ZERO_LOW_US);
35 for (uint8_t mask = 1UL; mask < 1UL << 4; mask <<= 1) {
36 if ((data.
address - 1) & mask) {
37 dst->
item(BIT_HIGH_US, BIT_ONE_LOW_US);
39 dst->
item(BIT_HIGH_US, BIT_ZERO_LOW_US);
43 for (uint j = 0; j < 6; j++)
44 dst->
item(BIT_HIGH_US, BIT_ZERO_LOW_US);
47 dst->
item(HEADER_HIGH_US, HEADER_LOW_US);
55 if (!src.
expect_item(HEADER_HIGH_US, HEADER_LOW_US))
58 for (uint8_t mask = 1UL << 5; mask != 0; mask >>= 1) {
61 }
else if (src.
expect_item(BIT_HIGH_US, BIT_ZERO_LOW_US)) {
62 data.command &= ~mask;
68 for (uint8_t mask = 1UL; mask < 1UL << 5; mask <<= 1) {
71 }
else if (src.
expect_item(BIT_HIGH_US, BIT_ZERO_LOW_US)) {
72 data.address &= ~mask;
77 for (uint j = 0; j < 6; j++) {
78 if (!src.
expect_item(BIT_HIGH_US, BIT_ZERO_LOW_US)) {
90 ESP_LOGI(TAG,
"Received Dish: address=0x%02X, command=0x%02X", data.
address, data.
command);
void set_carrier_frequency(uint32_t carrier_frequency)
void item(uint32_t mark, uint32_t space)
optional< DishData > decode(RemoteReceiveData src) override
Implementation of SPI Controller mode.
void reserve(uint32_t len)
void encode(RemoteTransmitData *dst, const DishData &data) override
bool expect_item(uint32_t mark, uint32_t space)
void dump(const DishData &data) override