/************************************************************************** * * 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 TaskPriority.c * * @author (last) Sean * @date (last) 26-Feb-2020 * * @author (original) Dara Navaei * @date (original) 05-Nov-2019 * ***************************************************************************/ #include "Accel.h" #include "BloodFlow.h" #include "Buttons.h" #include "CPLD.h" #include "DialInFlow.h" #include "DialOutFlow.h" #include "FPGA.h" #include "InternalADC.h" #include "SystemComm.h" #include "WatchdogMgmt.h" #include "TaskPriority.h" /** * @addtogroup TaskPriority * @{ */ /*********************************************************************//** * @brief * The taskPriority function handles the scheduled Priority Task interrupt. * Calls the executive functions for FPGA, pumps, valves, and buttons. * @details * Inputs : none * Outputs : Executive for the FPGA, pumps, valves, and buttons called. * @return none *************************************************************************/ void taskPriority( void ) { #ifdef TASK_TIMING_OUTPUT_ENABLED // set GPIO high to indicate priority task has begun executing setCPLDLampRed( PIN_SIGNAL_HIGH ); #endif // prevent most processing until UI has started communicating #ifndef SIMULATE_UI if ( TRUE == uiCommunicated() ) #endif { // 1st pass for FPGA execFPGAIn(); #ifndef CAN_TEST // monitor and process buttons execButtons(); // monitor internal ADC channels execInternalADC(); // monitor blood pump and flow execBloodFlowMonitor(); // monitor dialysate inlet pump and flow execDialInFlowMonitor(); // monitor dialysate outlet pump and load cells execDialOutFlowMonitor(); #ifndef DISABLE_ACCELS // monitor accelerometer execAccel(); #endif #endif // 2nd pass for FPGA execFPGAOut(); } // check in with watchdog manager checkInWithWatchdogMgmt( TASK_PRIORITY ); #ifdef TASK_TIMING_OUTPUT_ENABLED // set GPIO low to indicate priority task has finished executing setCPLDLampRed( PIN_SIGNAL_LOW ); #endif } /**@}*/