11 #ifndef __PACKET_FORMAT_H__
12 #define __PACKET_FORMAT_H__
15 #define STATIC_ASSERT(COND,MSG) typedef char static_assertion_##MSG[(!!(COND))*2-1]
16 #define COMPILE_TIME_ASSERT3(X,L) STATIC_ASSERT(X,static_assertion_at_line_##L)
17 #define COMPILE_TIME_ASSERT2(X,L) COMPILE_TIME_ASSERT3(X,L)
18 #define COMPILE_TIME_ASSERT(X) COMPILE_TIME_ASSERT2(X,__LINE__)
20 #include "../firmware.h"
22 #define PACKET_PREAMBLE_WORD 0x55555555
23 #define PACKET_PREAMBLE_LENGTH 4
25 #define PACKET_SYNC_WORD 0x42A6F8B3
26 #define PACKET_SYNC_LENGTH 4
28 #define PACKET_SPACECRAFT_ID 0x4242
29 #define PACKET_CODED_DATA_LENGTH 1024
88 void Packet_telecommand_512_encode(
packet_telecommand_512 *input_packet, uint8_t *output_buffer,
const uint16_t origin,
const uint8_t *key, uint32_t key_length);
90 bool Packet_telecommand_512_decode(uint8_t *input_buffer,
packet_telecommand_512 *output_packet,
const uint16_t destination,
const uint8_t *key, uint32_t key_length);
110 bool Packet_telemetry_1024_decode(uint8_t *input_buffer,
packet_telemetry_1024 *output_packet,
const uint16_t destination,
const uint8_t *key, uint32_t key_length);
112 void Packet_sign_shake128(
const uint8_t *input, uint32_t input_length,
const uint8_t *key, uint32_t key_length, uint8_t *output);
void Packet_telemetry_1024_encode(packet_telemetry_1024 *input_packet, uint8_t *output_buffer, const uint16_t origin, const uint8_t *key, uint32_t key_length)