Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -rdd3356035996866e5db7678d352f933fc22ad789 -r17c1faab385513df4ed46829c476f409a6abb864 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision dd3356035996866e5db7678d352f933fc22ad789) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 17c1faab385513df4ed46829c476f409a6abb864) @@ -25,6 +25,7 @@ #include "SystemComm.h" #include "RTC.h" #include "LoadCell.h" +#include "Valves.h" // ********** private definitions ********** @@ -352,7 +353,35 @@ return result; } +/************************************************************************* + * @brief + * The broadcastValvesStates function sends out DG valves states. + * @details + * Inputs : none + * Outputs : Valves states msg constructed and queued + * @param valvesStates : valves states + * refer to setFPGAValveStates function in FPGA.c for details + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL broadcastValvesStates( U16 valvesStates ) +{ + BOOL result; + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + // create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_DG_VALVES_STATES; + msg.hdr.payloadLen = sizeof( U16 ); + + memcpy( payloadPtr, &valvesStates, sizeof( U16 ) ); + + // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_DG_BROADCAST, ACK_NOT_REQUIRED ); + + return result; +} + /************************************************************************* * TEST SUPPORT FUNCTIONS *************************************************************************/ @@ -541,3 +570,27 @@ // respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } + +/************************************************************************* + * @brief + * The handleTestValveStateOverrideRequest function handles a request to \n + * override the state value read from the given valve. + * @details + * Inputs : none + * Outputs : message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +DATA_ARRAY_OVERRIDE_HANDLER_FUNC_U32( BOOL, handleTestValveStateOverrideRequest, testSetValveStateOverride, testResetValveStateOverride ) + +/************************************************************************* + * @brief + * The handleTestValvesStatesPublishIntervalOverrideRequest function handles \n + * a request to override the publish interval of valves states from the given valve. + * @details + * Inputs : none + * Outputs : message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +DATA_OVERRIDE_HANDLER_FUNC_U32( BOOL, handleTestValvesStatesPublishIntervalOverrideRequest, testSetValvesStatesPublishIntervalOverride, testResetValvesStatesPublishIntervalOverride )