/************************************************************************** * * Copyright (c) 2019-2023 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 TaskGeneral.c * * @author (last) Dara Navaei * @date (last) 17-Oct-2022 * * @author (original) Dara Navaei * @date (original) 05-Nov-2019 * ***************************************************************************/ #include "AirTrap.h" #include "AlarmLamp.h" #include "BloodFlow.h" #include "CPLD.h" #include "DGInterface.h" #include "DialInFlow.h" #include "DialOutFlow.h" #include "Fans.h" #include "Integrity.h" #include "NVDataMgmt.h" #include "OperationModes.h" #include "PresOccl.h" #include "RTC.h" #include "Switches.h" #include "SystemComm.h" #include "SystemCommMessages.h" #include "TaskGeneral.h" #include "Temperatures.h" #include "Voltages.h" #include "WatchdogMgmt.h" /** * @addtogroup TaskGeneral * @{ */ // ********** private data ********** /*********************************************************************//** * @brief * The taskGeneral function handles the scheduled General Task interrupt. * Calls the executive functions for most monitors and controllers, the * operation modes, the system communications, and alarms. * @details Inputs: none * @details Outputs: Executives running in general task are called. * @return none *************************************************************************/ void taskGeneral( void ) { #ifdef TASK_TIMING_OUTPUT_ENABLED // Set GPIO high to indicate general task has begun executing setCPLDLampGreen( PIN_SIGNAL_HIGH ); #endif // Check in with watchdog manager checkInWithWatchdogMgmt( TASK_GENERAL ); // Do this first to keep timing consistent with watchdog management // Manage data received from other sub-systems execSystemCommRx(); // Prevent most processing until UI has started communicating if ( TRUE == uiCommunicated() ) { #ifndef BOARD_WITH_NO_HARDWARE // Monitor DG execDGInterfaceMonitor(); // Monitor pressure/occlusion sensors execPresOccl(); // Monitor voltages execVoltagesMonitor(); // Monitor switches execSwitches(); // Monitor temperatures execTemperatures(); #endif // Monitor processor RAM status execRAMMonitor(); // Run operation mode state machine execOperationModes(); #ifndef BOARD_WITH_NO_HARDWARE // Manage RTC execRTC(); // Control air trap valve execAirTrapController(); // Control blood pump execBloodFlowController(); // Control dialysate inlet pump execDialInFlowController(); // Control dialysate outlet pump (keep after call to BP and DPi controllers) execDialOutFlowController(); // Control Air Pump execAirPumpController(); // Monitor/Control fans execFans(); // Manage NVDataMgmt process record state machine execNVDataMgmtProcessRecord(); // Manage alarm state execAlarmMgmt(); #endif // Manage data to be transmitted to other sub-systems execSystemCommTx(); } #ifdef TASK_TIMING_OUTPUT_ENABLED // Set GPIO low to indicate general task has finished executing setCPLDLampGreen( PIN_SIGNAL_LOW ); #endif } /**@}*/