/************************************************************************** * * Copyright (c) 2019-2024 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) Dara Navaei * @date (last) 22-Sep-2022 * * @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 "NVDataMgmt.h" #include "InternalADC.h" #include "SyringePump.h" #include "SystemComm.h" #include "Valves.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 * @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 if ( TRUE == uiCommunicated() ) { // 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 _RELEASE_ if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_SYRINGE_PUMP ) != SW_CONFIG_ENABLE_VALUE ) #endif { // Control/Monitor syringe pump execSyringePump(); } // 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(); // Exec blood leak embedded mode execBloodLeakEmbModeCommand(); // Monitor blood leak detector execBloodLeak(); // Monitor air bubble detectors execBubbles(); #ifndef _RELEASE_ if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_ACCELEROMETERS ) != SW_CONFIG_ENABLE_VALUE ) #endif { // Monitor accelerometer execAccel(); } // Exec and monitor valves execValves(); #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 } /**@}*/