/************************************************************************** * * 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 TaskGeneral.c * * @author (last) Sean Nash * @date (last) 14-Oct-2020 * * @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 "NVDataMgmt.h" #include "OperationModes.h" #include "PresOccl.h" #include "RTC.h" #include "SystemComm.h" #include "SystemCommMessages.h" #include "TaskGeneral.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: Executive for the TBD 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 #ifndef SIMULATE_UI if ( TRUE == uiCommunicated() ) #endif { #ifndef BOARD_WITH_NO_HARDWARE // Monitor DG execDGInterfaceMonitor(); // Monitor pressure/occlusion sensors execPresOccl(); #endif // Monitor voltages execVoltagesMonitor(); // Run operation mode state machine execOperationModes(); #ifndef BOARD_WITH_NO_HARDWARE // Control air trap valve execAirTrapController(); // Control blood pump execBloodFlowController(); // Control dialysate inlet pump execDialInFlowController(); // Control dialysate outlet pump execDialOutFlowController(); #endif // Manage RTC execRTC(); // Manage NVDataMgmt process record state machine execNVDataMgmtProcessRecord(); #ifndef RM46_EVAL_BOARD_TARGET // 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 } /**@}*/