/************************************************************************** * * 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 ModeTreatment.c * * @date 19-Sep-2019 * @author S. Nash * * @brief Top-level state machine for the treatment mode. * **************************************************************************/ #include #include "AlarmLamp.h" #include "BloodFlow.h" #include "Buttons.h" #include "OperationModes.h" #include "ModeTreatment.h" #ifdef RM46_EVAL_BOARD_TARGET #include "Timers.h" static U32 start; #endif // ********** private data ********** // ********** private function prototypes ********** /************************************************************************* * @brief initTreatmentMode * The initTreatmentMode function initializes the Treatment Mode module. * @details * Inputs : none * Outputs : Treatment Mode module initialized. * @param none * @return none *************************************************************************/ void initTreatmentMode( void ) { } /************************************************************************* * @brief transitionToTreatmentMode * The transitionToTreatmentMode function prepares for transition to treatment mode. * @details * Inputs : none * Outputs : * @param none * @return none *************************************************************************/ void transitionToTreatmentMode( void ) { // temporary test code - alarm lamp medium alarm setBloodPumpTargetFlowRate( 400, MOTOR_DIR_REVERSE ); #ifdef RM46_EVAL_BOARD_TARGET // TODO - temporary test code for eval board start = getMSTimerCount(); #endif } /************************************************************************* * @brief execTreatmentMode * The execTreatmentMode function executes the Treatment Mode state machine. * @details * Inputs : none * Outputs : * @param none * @return none *************************************************************************/ void execTreatmentMode( void ) { BOOL stop = isStopButtonPressed(); if ( TRUE == stop ) { requestNewOperationMode( MODE_POST ); } #ifdef RM46_EVAL_BOARD_TARGET // TODO - temporary test code for eval board - move to next mode after 10 sec if ( TRUE == didTimeout( start, 10000U ) ) { requestNewOperationMode( MODE_POST ); } #endif }