4#ifndef PROTOCORE_ZIGBEE_H
5#define PROTOCORE_ZIGBEE_H
45#define ASH_ESCAPE 0x7D
47#define ASH_RSTACK 0xC1
53 uint16_t (*ash_crc16)(uint8_t *,
const uint8_t *, uint16_t);
54 uint16_t (*ash_frame_encode)(uint8_t *, uint8_t,
const uint8_t *, uint16_t, uint8_t *, uint16_t);
55 int (*ash_frame_decode)(uint8_t *,
const uint8_t *, uint16_t, uint8_t *, uint8_t *, uint16_t, uint16_t *);
78 uint8_t *out, uint16_t cap);
91 uint8_t *payload, uint16_t pay_cap, uint16_t *pay_len);
#define PROTOCORE_NS_LAYOUT(T,...)
Pin every dispatch slot of a table that is nothing but function pointers.
#define PROTOCORE_NS
Storage for a dispatch table. The const is load bearing.
Dispatch table. Addressed by offset, so the layout is asserted below.
uint16_t(* ash_crc16)(uint8_t *, const uint8_t *, uint16_t)
#define PROTOCORE_BEGIN_DECLS
Give a header's declarations C linkage, so their symbol names carry no parameter types.
#define PROTOCORE_END_DECLS
uint16_t protocore_zigbee_ash_crc16(uint8_t *work, const uint8_t *buf, uint16_t len)
CRC-16/CCITT (polynomial 0x1021, MSB-first, init 0xFFFF) over buf.
PROTOCORE_NS ZigbeeNs Zigbee PROTOCORE_UNUSED
Module namespace.
uint16_t protocore_zigbee_ash_frame_encode(uint8_t *work, uint8_t control, const uint8_t *payload, uint16_t len, uint8_t *out, uint16_t cap)
Encode an ASH frame: [control | payload] + CRC-16, byte-stuffed, .
int protocore_zigbee_ash_frame_decode(uint8_t *work, const uint8_t *raw, uint16_t len, uint8_t *control, uint8_t *payload, uint16_t pay_cap, uint16_t *pay_len)
Decode one ASH frame from the front of raw: find the flag, remove .