Index: firmware/App/Modes/OperationModes.h =================================================================== diff -u -rb64c49fdcf2b6d95e61e63f8e258c4e600935bbd -r7d4711edd7b40cd3e29f43e766f79a8a09586fe9 --- firmware/App/Modes/OperationModes.h (.../OperationModes.h) (revision b64c49fdcf2b6d95e61e63f8e258c4e600935bbd) +++ firmware/App/Modes/OperationModes.h (.../OperationModes.h) (revision 7d4711edd7b40cd3e29f43e766f79a8a09586fe9) @@ -1,45 +1,59 @@ /************************************************************************** - * - * 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 OperationModes.h - * - * @date 11-Dec-2019 - * @author L. Baloa - * - * @brief Header file for Operation Modes. - * - **************************************************************************/ +* +* Copyright (c) 2019-2024 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 OperationModes.h +* +* @author (last) Dara Navaei +* @date (last) 14-Sep-2023 +* +* @author (original) Dara Navaei +* @date (original) 05-Nov-2019 +* +***************************************************************************/ #ifndef __OP_MODES_H__ #define __OP_MODES_H__ #include "DGCommon.h" +#include "DGDefs.h" +/** + * @defgroup DGOperationModes DGOperationModes + * @brief Operation Modes module. Manages the top level operation modes of the DG via a state machine. + * + * @addtogroup DGOperationModes + * @{ + */ + // ********** public definitions ********** -typedef enum Op_Modes // These are in order of priority (highest to lowest) +#define NO_SUB_STATE 0xFF ///< value for when submode does not have specific substates and is not applicable. + +/// Operation modes data structure +typedef struct { - MODE_FAUL = 0, // Fault - MODE_SERV, // Service - MODE_INIT, // Initialization & POST - MODE_STAN, // Standby - MODE_FILL, // Fill mode - MODE_DRAI, // Drain - MODE_FLUS, // Flush - MODE_DISI, // Disinfect - MODE_NLEG, // Not legal - NUM_OF_MODES -} OP_MODE; + U32 currentMode; ///< Current Mode. + U32 currentSubMode; ///< Current Submode. +} OP_MODES_DATA_T; // ********** public function prototypes ********** -void initOperationModes( void ); // initialize this module -void execOperationModes( void ); // execute the operation modes state machine (scheduled periodic call) -void requestNewOperationMode( OP_MODE newMode ); // request a transition to a new operation mode -OP_MODE getCurrentOperationMode( void ); // get the current operation mode +void initOperationModes( void ); // initialize this module +void execOperationModes( void ); // execute the operation modes state machine (scheduled periodic call) +void requestNewOperationMode( DG_OP_MODE_T newMode ); // request a transition to a new operation mode +DG_OP_MODE_T getCurrentOperationMode( void ); // get the current operation mode +DG_OP_MODE_T getPreviousOperationMode( void ); // get the previous operation mode +U32 getCurrentOperationSubMode( void ); // get current operation sub mode +void setCurrentSubState( U32 subState ); // Set the current substate. +BOOL testSetOperationMode( DG_OP_MODE_T newMode ); // Force transition to a given mode (if allowed) +BOOL testSetDGOpModePublishIntervalOverride( U32 value ); +BOOL testResetDGOpModePublishIntervalOverride( void ); + +/**@}*/ + #endif