/************************************************************************** * * 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 ModePreTreat.c * * @date 19-Sep-2019 * @author S. Nash * * @brief Top-level state machine for the pre-treatment mode. * *************************************************************************/ #include #include "AlarmLamp.h" #include "BloodFlow.h" #include "Buttons.h" #include "OperationModes.h" #include "ModePreTreat.h" #ifdef RM46_EVAL_BOARD_TARGET #include "Timers.h" static U32 start; #endif // ********** private data ********** // ********** private function prototypes ********** /************************************************************************* * @brief initPreTreatmentMode * The initPreTreatmentMode function initializes the Pre-Treatment Mode module. * @details * Inputs : none * Outputs : Pre-Treatment Mode module initialized. * @param none * @return none *************************************************************************/ void initPreTreatmentMode( void ) { } /************************************************************************* * @brief transitionToPreTreatmentMode * The transitionToPreTreatmentMode function prepares for transition to \n * pre-treatment mode. * @details * Inputs : none * Outputs : * @param none * @return none *************************************************************************/ void transitionToPreTreatmentMode( void ) { // temporary test code - alarm lamp low alarm setBloodPumpTargetFlowRate( 0, MOTOR_DIR_FORWARD ); #ifdef RM46_EVAL_BOARD_TARGET start = getMSTimerCount(); #endif } /************************************************************************* * @brief execPreTreatmentMode * The execFaultMode function executes the Pre-Treatment Mode state machine. * @details * Inputs : none * Outputs : * @param none * @return none *************************************************************************/ void execPreTreatmentMode( void ) { BOOL stop = isStopButtonPressed(); if ( TRUE == stop ) { requestNewOperationMode( MODE_TREA ); } #ifdef RM46_EVAL_BOARD_TARGET if ( TRUE == didTimeout( start, 10000U ) ) { requestNewOperationMode( MODE_TREA ); } #endif }