/************************************************************************** * * Copyright (c) 2019-2022 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 Nash * @date (last) 12-Nov-2021 * * @author (original) Dara Navaei * @date (original) 05-Nov-2019 * ***************************************************************************/ #include "Accel.h" #include "AirTrap.h" #include "BloodFlow.h" #include "BloodLeak.h" #include "Bubble.h" #include "Buttons.h" #include "CPLD.h" #include "DialInFlow.h" #include "DialOutFlow.h" #include "FluidLeak.h" #include "FPGA.h" #include "InternalADC.h" #include "SyringePump.h" #include "SystemComm.h" #include "Valves.h" #include "WatchdogMgmt.h" #include "TaskPriority.h" #include "Fans.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 * @details Outputs: Executives running in priority task are 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 BOARD_WITH_NO_HARDWARE // Verify processor clock speed against FPGA clock execFPGAClockSpeedTest(); #ifndef CAN_TEST // Monitor and process buttons execButtons(); // Monitor internal ADC channels execInternalADC(); // Monitor air trap level sensors execAirTrapMonitor(); #ifndef DISABLE_SYRINGE_PUMP // Control/Monitor syringe pump execSyringePump(); #endif // Monitor blood pump and flow execBloodFlowMonitor(); // Monitor dialysate inlet pump and flow execDialInFlowMonitor(); // Monitor dialysate outlet pump and load cells execDialOutFlowMonitor(); // Monitor fluid leak detector execFluidLeak(); // Monitor blood leak detector execBloodLeak(); // Monitor air bubble detectors execBubbles(); #ifndef DISABLE_ACCELS // Monitor accelerometer execAccel(); #endif #ifndef DISABLE_3WAY_VALVES // Exec and monitor valves execValves(); #endif #endif #endif #ifdef BOARD_WITH_NO_HARDWARE // Monitor blood leak detector for testing on a fixture only execBloodLeak(); #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 } /**@}*/