ESPHome 2026.11.0-dev
Loading...
Searching...
No Matches
ash_protocol.cpp
Go to the documentation of this file.
1#include "ash_protocol.h"
2
4
6
7void ash_build_ack_frame(uint8_t *output, uint8_t ack_num) {
8 // ACK control byte: 100nrPPP, where PPP is the next frame number expected
9 const uint8_t control = 0x80 | (ack_num & ASH_MAX_SEQUENCE);
10 const uint16_t crc = crc16be(&control, 1, ASH_CRC_INIT);
11
12 output[0] = ASH_FLAG_BYTE;
13 output[1] = control;
14 output[2] = crc >> 8;
15 output[3] = crc & 0xFF;
16 output[4] = ASH_FLAG_BYTE;
17}
18
19} // namespace esphome::ezsp_proxy_tap
void ash_build_ack_frame(uint8_t *output, uint8_t ack_num)
uint16_t crc16be(const uint8_t *data, uint16_t len, uint16_t crc, uint16_t poly, bool refin, bool refout)
Definition helpers.cpp:135