You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
736 B
33 lines
736 B
15 years ago
|
// MESSAGE BOOT PACKING
|
||
|
|
||
|
#define MESSAGE_ID_BOOT 1
|
||
|
|
||
|
/**
|
||
|
* @brief Send a boot message
|
||
|
*
|
||
|
* @param version The onboard software version
|
||
|
* @return length of the message in bytes (excluding serial stream start sign)
|
||
|
*/
|
||
|
static inline uint16_t message_boot_pack(uint8_t system_id, CommMessage_t* msg, uint32 version)
|
||
|
{
|
||
|
msg->msgid = MESSAGE_ID_BOOT;
|
||
|
uint16_t i = 0;
|
||
|
|
||
|
i += put_uint32_by_index(version, i, msg->payload); //The onboard software version
|
||
|
|
||
|
return finalize_message(msg, system_id, i);
|
||
|
}
|
||
|
|
||
|
// MESSAGE BOOT UNPACKING
|
||
|
|
||
|
/**
|
||
|
* @brief Get field version from boot message
|
||
|
*
|
||
|
* @return The onboard software version
|
||
|
*/
|
||
|
static inline uint32 message_boot_get_version(CommMessage_t* msg)
|
||
|
{
|
||
|
return *((uint32*) (void*)msg->payload);
|
||
|
}
|
||
|
|