Index: firmware/App/Modes/FPModes/FPModeFault.c =================================================================== diff -u -r830213bc6dcc1a684610caf78c79d55f2cb41e93 -r886964fa2bf6a5bb61b33b8b5547f3d0c585b360 --- firmware/App/Modes/FPModes/FPModeFault.c (.../FPModeFault.c) (revision 830213bc6dcc1a684610caf78c79d55f2cb41e93) +++ firmware/App/Modes/FPModes/FPModeFault.c (.../FPModeFault.c) (revision 886964fa2bf6a5bb61b33b8b5547f3d0c585b360) @@ -307,4 +307,66 @@ } } + +/************************************************************************* + * TEST SUPPORT FUNCTIONS + *************************************************************************/ + + +/*********************************************************************//** + * @brief + * The testValidateFaultChangeReq function validate whether + * requested sub mode change is legal or not. + * @details \b Inputs: none + * @details \b Outputs: none + * @param newSubMode the enumerated sub state of the mode. + * @return TRUE if request is legal, FALSE if not. + *************************************************************************/ +BOOL testValidateFaultChangeReq( U32 newSubMode ) +{ + BOOL result = FALSE; + + if ( newSubMode < NUM_OF_FP_FAULT_STATES ) + { + switch ( newSubMode ) + { + case FP_FAULT_STATE_START: + case FP_FAULT_DEENERGIZED_STATE: + case FP_FAULT_ENERGIZED_STATE: + default: + result = TRUE; + break; + } + } + + return result; +} + +/*********************************************************************//** + * @brief + * The testSignalNewFaultSubMode function requests transition + * to a new fault sub mode. + * @details \b Inputs: none + * @details \b Outputs: none + * @param newSubMode the enumerated sub state of the mode. + * @return none + *************************************************************************/ +void testSignalNewFaultSubMode( U32 newSubMode ) +{ + if ( newSubMode < NUM_OF_FP_FAULT_STATES ) + { + faultState = (FP_FAULT_STATE_T)newSubMode; + // handle the prerequisite if any + switch ( newSubMode ) + { + // Any of these state require no special handling + case FP_FAULT_STATE_START: + case FP_FAULT_DEENERGIZED_STATE: + case FP_FAULT_ENERGIZED_STATE: + default: + break; + } + } +} + /**@}*/