Index: MessageSupport.c =================================================================== diff -u --- MessageSupport.c (revision 0) +++ MessageSupport.c (revision 706d450e92a86b9751fccce9e71aa0080798ea01) @@ -0,0 +1,44 @@ + +#include "SystemCommMessages.h" +#include "Utilities.h" + +/** + * @addtogroup MessageSupport + * @{ + */ + +// ********** private function prototypes ********** + + +/*********************************************************************//** + * @brief + * The broadcastData function broadcasts data. + * @details Inputs: none + * @details Outputs: load cell data msg constructed and queued + * @param msgID message ID of the data is broadcast + * @param buffer comm buffer ID + * @param dataPtr pointer to the start of the buffer + * @param length length of the data buffer + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL broadcastData( MSG_ID_T msgID, COMM_BUFFER_T buffer, U08* dataPtr, U32 length ) +{ + BOOL result; + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + + // create a message record + blankMessage( &msg ); + msg.hdr.msgID = msgID; + msg.hdr.payloadLen = length; + + memcpy( payloadPtr, dataPtr, length ); + + // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + result = serializeMessage( msg, buffer, ACK_NOT_REQUIRED ); + + return result; +} + +/**@}*/ + Index: MessageSupport.h =================================================================== diff -u --- MessageSupport.h (revision 0) +++ MessageSupport.h (revision 706d450e92a86b9751fccce9e71aa0080798ea01) @@ -0,0 +1,18 @@ + +#ifndef __MESSAGESUPPORT_H__ +#define __MESSAGESUPPORT_H__ + +#include "CommBuffers.h" + +/** + * @defgroup MessageSupport MessageSupport + * @brief Provides commonly used function for messaging + * + * @addtogroup MessageSupport + * @{ + */ + +// Generic broadcast function +BOOL broadcastData( MSG_ID_T msgID, COMM_BUFFER_T buffer, U08* dataPtr, U32 length ); + +#endif