Index: firmware/App/Tasks/TaskPriority.c =================================================================== diff -u -rf7e3018ec6ab762fe08efb42b21fb2ca970174b0 -rc67def50892f9a7c2f1f22985b5351465a8f6773 --- firmware/App/Tasks/TaskPriority.c (.../TaskPriority.c) (revision f7e3018ec6ab762fe08efb42b21fb2ca970174b0) +++ firmware/App/Tasks/TaskPriority.c (.../TaskPriority.c) (revision c67def50892f9a7c2f1f22985b5351465a8f6773) @@ -1,69 +1,99 @@ -/************************************************************************** - * - * 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 - * - * @date 19-Sep-2019 - * @author S. Nash - * - * @brief Priority task handler. - * - **************************************************************************/ - -//#include "gio.h" - -#include "InternalADC.h" +/************************************************************************** +* +* 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 Nash +* @date (last) 14-Oct-2020 +* +* @author (original) Dara Navaei +* @date (original) 05-Nov-2019 +* +***************************************************************************/ + +#include "Accel.h" +#include "AirTrap.h" #include "BloodFlow.h" -#include "Buttons.h" +#include "Buttons.h" +#include "CPLD.h" #include "DialInFlow.h" +#include "DialOutFlow.h" #include "FPGA.h" -#include "SystemComm.h" +#include "InternalADC.h" +#include "SystemComm.h" +#include "Valves.h" #include "WatchdogMgmt.h" #include "TaskPriority.h" -/************************************************************************* - * @brief taskPriority +/** + * @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. + * @details Inputs: none + * @details 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 RM46_EVAL_BOARD_TARGET +#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(); + execInternalADC(); + + // monitor air trap level sensors + execAirTrapMonitor(); // 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 + // Exec and monitor valves + execValves(); +#endif // 2nd pass for FPGA execFPGAOut(); - } // check in with watchdog manager checkInWithWatchdogMgmt( TASK_PRIORITY ); - - // toggle GPIO to indicate priority task has executed -// gioToggleBit( gioPORTB, 3 ); + +#ifdef TASK_TIMING_OUTPUT_ENABLED + // set GPIO low to indicate priority task has finished executing + setCPLDLampRed( PIN_SIGNAL_LOW ); +#endif } - + +/**@}*/