/************************************************************************** * * 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) Dara Navaei * @date (last) 06-Jul-2022 * * @author (original) Dara Navaei * @date (original) 05-Nov-2019 * ***************************************************************************/ #include "gio.h" #include "Accel.h" #include "ConductivitySensors.h" #include "DrainPump.h" #include "FluidLeak.h" #include "FPGA.h" #include "Heaters.h" #include "InternalADC.h" #include "LoadCell.h" #include "Pressures.h" #include "ROPump.h" #include "DialysateFlow.h" #include "TaskPriority.h" #include "TemperatureSensors.h" #include "Valves.h" #include "WatchdogMgmt.h" /** * @addtogroup TaskPriority * @{ */ #ifdef TASK_TIMING_OUTPUT_ENABLED #include "mibspi.h" #define TASK_TIMING_TEST_PIN_SPI1_PORT_MASK 0x00000020 // (CS5 - re-purposed as output GPIO) #define SET_TASK_ON() { mibspiREG3->PC3 |= TASK_TIMING_TEST_PIN_SPI1_PORT_MASK; } #define SET_TASK_OFF() { mibspiREG3->PC3 &= ~TASK_TIMING_TEST_PIN_SPI1_PORT_MASK; } #endif /*********************************************************************//** * @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: Executive for the FPGA, pumps, valves, and buttons called. *************************************************************************/ void taskPriority( void ) { #ifdef TASK_TIMING_OUTPUT_ENABLED // SET_TASK_ON(); // TODO - uncomment and define TASK_TIMING_OUTPUT_ENABLED to monitor this tasks timing #endif #ifndef BOARD_WITH_NO_HARDWARE // First pass for FPGA execFPGAIn(); // Monitor internal ADC channels execInternalADC(); // Monitor pressures execPressures(); // Monitor load cells execLoadCell(); // Monitor dialysate flow meter execDialysateFlowMeterMonitor(); // Temperature sensors read execTemperatureSensors(); // Conductivity sensors read execConductivitySensors(); // Control valves execValves(); // Monitor accelerometer execAccel(); // Monitor RO pump execROPumpMonitor(); // Monitor drain pump execDrainPumpMonitor(); // Heaters monitor execHeatersMonitor(); // Monitor fluid leak detector execFluidLeak(); // Second pass for FPGA execFPGAOut(); #endif // Check in with watchdog manager checkInWithWatchdogMgmt( TASK_PRIORITY ); #ifdef TASK_TIMING_OUTPUT_ENABLED // SET_TASK_OFF(); // TODO - uncomment and define TASK_TIMING_OUTPUT_ENABLED to monitor this tasks timing #endif } /**@}*/