/************************************************************************** * * 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) Quang Nguyen * @date (last) 13-Jul-2020 * * @author (original) Dara Navaei * @date (original) 05-Nov-2019 * ***************************************************************************/ #include "gio.h" #include "Accel.h" #include "DrainPump.h" #include "FPGA.h" #include "InternalADC.h" #include "LoadCell.h" #include "Pressures.h" #include "ROPump.h" #include "TaskPriority.h" #include "TemperatureSensors.h" #include "Valves.h" #include "WatchdogMgmt.h" #include "TemperatureSensors.h" #include "ConductivitySensors.h" #include "Heaters.h" #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 taskPriority * 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. *************************************************************************/ 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 // 1st pass for FPGA execFPGAIn(); // monitor internal ADC channels execInternalADC(); // monitor pressures execPressures(); // monitor load cells execLoadCell(); #ifndef DISABLE_HEATERS_AND_TEMPS // Temperature sensors read execTemperatureSensors(); #endif // conductivity sensors read execConductivitySensors(); // control valves execValves(); #ifndef DISABLE_ACCELS // monitor accelerometer execAccel(); #endif // monitor RO pump execROPumpMonitor(); // monitor drain pump execDrainPumpMonitor(); // Heaters monitor execHeatersMonitor(); // 2nd pass for FPGA execFPGAOut(); // 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 }