15 for (uint8_t i = 0; i < this->
size() - 1; i++) {
17 temp = temp ^ (uint16_t) (((
uint32_t) temp << 0x11) >> 0x10) ^ (uint16_t) (((
uint32_t) temp << 0x12) >> 0x10) ^
18 (uint16_t) (((
uint32_t) temp << 0x13) >> 0x10) ^ (uint16_t) (((
uint32_t) temp << 0x14) >> 0x10) ^
19 (uint16_t) (((
uint32_t) temp << 0x15) >> 0x10) ^ (uint16_t) (((
uint32_t) temp << 0x16) >> 0x10) ^
20 (uint16_t) (((
uint32_t) temp << 0x17) >> 0x10);
21 checksum = (temp & 0xfe) ^ ((temp >> 8) & 1);
58 if (!
src.expect_mark(BIT_ZERO_MARK_US))
60 uint32_t next_space = BIT_ZERO_SPACE_US;
61 for (uint8_t mask = 1 << 7; mask; mask >>= 1) {
64 if (
src.expect_space(next_space)) {
65 if (!
src.expect_mark(BIT_ZERO_MARK_US))
67 next_space = BIT_ZERO_SPACE_US;
70 next_space += BIT_ONE_SPACE_US;
73 next_space += BYTE_SPACE_US;
76 done = !(
src.expect_space(next_space));
81 if (
src.expect_item(BIT_ZERO_MARK_US, BIT_ZERO_SPACE_US) &&
82 src.expect_item(BIT_ZERO_MARK_US, BIT_ZERO_SPACE_US + BIT_ONE_SPACE_US) &&
83 src.expect_item(BIT_ZERO_MARK_US, BIT_ZERO_SPACE_US + BIT_ONE_SPACE_US) &&
84 src.expect_item(BIT_ZERO_MARK_US, BIT_ZERO_SPACE_US + BIT_ONE_SPACE_US) &&
85 src.expect_item(BIT_ZERO_MARK_US, BIT_ZERO_SPACE_US + BIT_ONE_SPACE_US + BYTE_SPACE_US) &&
86 src.expect_item(BIT_ZERO_MARK_US, BIT_ZERO_SPACE_US + 8 * BIT_ONE_SPACE_US + BYTE_SPACE_US)) {
87 ESP_LOGVV(TAG,
"Received Header: 0x55FF");
93 uint8_t received_bytes = 2;
94 for (; (received_bytes <
length) && !done; received_bytes++) {
98 ESP_LOGW(TAG,
"Received incomplete packet: %s", out.
format_to(buf, received_bytes));
101 if (received_bytes == 2) {
102 length += std::min(
static_cast<uint8_t
>(data & DATA_LENGTH_MASK), MAX_DATA_LENGTH);
107 ESP_LOGVV(TAG,
"Received Byte: 0x%02X", data);
108 out[received_bytes] = data;
112 ESP_LOGI(TAG,
"Received: %s", out.
format_to(buf));
115 ESP_LOGW(TAG,
"Received malformed packet: %s", out.
format_to(buf, received_bytes));