33#ifndef DETERMINISTICESPASYNCWEBSERVER_DEVICENET_H
34#define DETERMINISTICESPASYNCWEBSERVER_DEVICENET_H
38#if DETWS_ENABLE_DEVICENET
45#define DEVICENET_G1_BASE 0x000u
46#define DEVICENET_G2_BASE 0x400u
47#define DEVICENET_G3_BASE 0x600u
48#define DEVICENET_G4_BASE 0x7C0u
49#define DEVICENET_MAC_MASK 0x3Fu
52#define DEVICENET_G2_UNCONNECTED_EXPLICIT_REQ 4u
53#define DEVICENET_G2_EXPLICIT_RESPONSE 3u
54#define DEVICENET_G2_POLL_COMMAND 5u
55#define DEVICENET_G2_DUP_MAC_CHECK 7u
58#define DEVICENET_HDR_FRAG 0x80u
59#define DEVICENET_HDR_XID 0x40u
62#define DEVICENET_FRAG_FIRST 0x00u
63#define DEVICENET_FRAG_MIDDLE 0x40u
64#define DEVICENET_FRAG_LAST 0x80u
65#define DEVICENET_FRAG_ACK 0xC0u
66#define DEVICENET_FRAG_TYPE_MASK 0xC0u
67#define DEVICENET_FRAG_COUNT_MASK 0x3Fu
70enum class DeviceNetGroup : uint8_t
72 DEVICENET_GROUP_1 = 1,
73 DEVICENET_GROUP_2 = 2,
74 DEVICENET_GROUP_3 = 3,
75 DEVICENET_GROUP_4 = 4,
87enum class DeviceNetFragResult : uint8_t
89 DEVICENET_FRAG_IGNORED = 0,
90 DEVICENET_FRAG_STARTED,
91 DEVICENET_FRAG_PROGRESS,
92 DEVICENET_FRAG_COMPLETE,
102 uint8_t buf[DETWS_DEVICENET_MSG_MAX];
108bool devicenet_encode_id(uint32_t *
id, DeviceNetGroup group, uint8_t msg_id, uint8_t mac_id);
111bool devicenet_decode_id(uint32_t can_id, DeviceNetId *out);
116uint8_t devicenet_msg_header(
bool frag,
bool xid, uint8_t mac_id);
119uint8_t devicenet_frag_octet(uint8_t type, uint8_t count);
127bool devicenet_build_explicit(
CanFrame *out, DeviceNetGroup group, uint8_t msg_id, uint8_t mac_id,
const uint8_t *body,
133void devicenet_frag_reset(DeviceNetFragRx *rx);
140DeviceNetFragResult devicenet_frag_feed(DeviceNetFragRx *rx,
const uint8_t *body, uint8_t body_len);
User-facing configuration for DeterministicESPAsyncWebServer.
Shared CAN 2.0 frame type for the CAN-based industrial codecs (one source of truth).