/************************************************************************** * * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. * * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * @file ModeStandby.c * * @date 19-Sep-2019 * @author S. Nash * * @brief Top-level state machine for the standby mode. * **************************************************************************/ #include "AlarmLamp.h" #include "BloodFlow.h" #include "DialInFlow.h" #include "DialOutFlow.h" #include "Buttons.h" #include "OperationModes.h" #include "SystemCommMessages.h" #include "ModeStandby.h" #ifdef RM46_EVAL_BOARD_TARGET #include "Timers.h" static U32 start; #endif // ********** private data ********** // ********** private function prototypes ********** /************************************************************************* * @brief initStandbyMode * The initStandbyMode function initializes the Standby Mode module. * @details * Inputs : none * Outputs : Standby Mode module initialized. * @param none * @return none *************************************************************************/ void initStandbyMode( void ) { } /************************************************************************* * @brief transitionToStandbyMode * The transitionToStandbyMode function prepares for transition to standby mode. * @details * Inputs : none * Outputs : * @param none * @return none *************************************************************************/ void transitionToStandbyMode( void ) { // temporary test code - TODO - remove later #ifndef UF_TEST_ENABLED setBloodPumpTargetFlowRate( 0, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_CLOSED_LOOP ); setDialInPumpTargetFlowRate( 0, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_CLOSED_LOOP ); setDialOutPumpTargetRate( 0, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_OPEN_LOOP ); #endif #ifdef RM46_EVAL_BOARD_TARGET start = getMSTimerCount(); #endif } /************************************************************************* * @brief execStandbyMode * The execStandbyMode function executes the Standby Mode state machine. * @details * Inputs : none * Outputs : * @param none * @return none *************************************************************************/ void execStandbyMode( void ) { BOOL stop = isStopButtonPressed(); if ( TRUE == stop ) { cmdStartDG(); requestNewOperationMode( MODE_PRES ); } #ifdef RM46_EVAL_BOARD_TARGET if ( TRUE == didTimeout( start, 5000U ) ) { requestNewOperationMode( MODE_PRES ); } #endif }