ESPHome 2026.12.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
11 output[0] = ASH_FLAG_BYTE;
12 output[1] = control;
13 put_be16(output + 2, crc16be(&control, 1, ASH_CRC_INIT));
14 output[4] = ASH_FLAG_BYTE;
15}
16
17} // 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:154
constexpr uint8_t * put_be16(uint8_t *dst, uint16_t value)
Write the low 16, 24 or 32 bits of value to dst, most significant byte first (be) or least significan...
Definition helpers.h:1296