9static const char *
const TAG =
"remote.beo4";
27constexpr uint32_t
N_BITS = 1 + 8 + 8;
30constexpr uint32_t
N_SYM = 2 + ((3 + 17 + 1) * 2u);
36 uint32_t beo_code = ((uint32_t) data.
source << 8) + (uint32_t) data.
command;
37 uint32_t jc = 0, ic = 0;
55 for (jc = 15, ic = 0; ic < 16; ic++, jc--) {
56 cur_bit = ((beo_code) >> jc) & 1;
57 if (cur_bit == pre_bit) {
59 }
else if (1 == cur_bit) {
72 int32_t n_sym = src.
size();
80 static uint32_t beo_code = 0;
86 ESP_LOGD(TAG,
"Beo4: n_sym=%" PRId32, n_sym);
87 for (jc = 0, ic = 0; ic < (n_sym - 1); ic += 2, jc++) {
88 int32_t pulse_width = src[ic] - src[ic + 1];
90 if (pulse_width > 1500) {
91 int32_t pulse_code = (pulse_width + 1560) / 3125;
103 uint32_t cur_bit = 0;
104 switch (pulse_code) {
106 cur_bit = pre_bit = 0;
114 cur_bit = pre_bit = 1;
122 beo_code = (beo_code << 1) + cur_bit;
123 if (++cnt_bit ==
N_BITS) {
130 data.source = (uint8_t) ((beo_code >> 8) & 0xff);
131 data.command = (uint8_t) ((beo_code) &0xff);
134 if ((n_sym - ic) < 42) {
149 ESP_LOGI(TAG,
"Beo4: source=0x%02x command=0x%02x repeats=%d ", data.
source, data.
command, data.
repeats);
void dump(const Beo4Data &data) override
optional< Beo4Data > decode(RemoteReceiveData src) override
void encode(RemoteTransmitData *dst, const Beo4Data &data) override
void set_carrier_frequency(uint32_t carrier_frequency)
void mark(uint32_t length)
void item(uint32_t mark, uint32_t space)
void reserve(uint32_t len)
constexpr uint32_t N_BITS
constexpr uint16_t PW_ONE_US
constexpr uint16_t PW_CARR_US
constexpr uint8_t PC_START
constexpr uint16_t PW_ZERO_US
constexpr uint8_t PC_STOP
constexpr uint8_t PC_SAME
constexpr uint8_t PC_ZERO
constexpr uint16_t PW_STOP_US
constexpr uint16_t PW_SAME_US
constexpr uint16_t PW_START_US
Providing packet encoding functions for exchanging data with a remote host.