25 lines
No EOL
939 B
C
25 lines
No EOL
939 B
C
#pragma once
|
|
#include "protocol.h"
|
|
#define HYDROLINK_MSG_ID_ACK 1
|
|
#define HYDROLINK_MSG_ID_ACK_LEN 1
|
|
#define HYDROLINK_MSG_ID_1_LEN 1
|
|
#define HYDROLINK_MSG_ID_ACK_CRC_EXTRA 73
|
|
|
|
typedef struct hydrolink_msg_ack_t_s {
|
|
uint8_t ack; ///
|
|
} hydrolink_msg_ack_t;
|
|
|
|
static inline void hydrolink_ack_msg_encode(uint8_t src_id, uint8_t dst_id, const hydrolink_msg_ack_t *msg, hydrolink_msg_t *packet) {
|
|
packet->id = HYDROLINK_MSG_ID_ACK;
|
|
packet->src_id = src_id;
|
|
packet->dst_id = dst_id;
|
|
packet->payload_length = HYDROLINK_MSG_ID_1_LEN + HYDROLINK_NON_PAYLOAD_LEN;
|
|
hydrolink_put_uint8_t(HYDROLINK_PAYLOAD_NON_CONST(packet), 0, msg->ack);
|
|
}
|
|
|
|
static inline uint8_t hydrolink_msg_ack_get_ack(const hydrolink_msg_t *packet) {
|
|
return HYDROLINK_RETURN_uint8_t(packet, 0);
|
|
}
|
|
static inline void hydrolink_msgack_decode(const hydrolink_msg_t *packet, hydrolink_msg_ack_t *ack) {
|
|
ack->ack = hydrolink_msg_ack_get_ack(packet);
|
|
} |