/************************************************************************** * * Copyright (c) 2024-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 Valves.h * * @author (last) Sean * @date (last) 08-Oct-2024 * * @author (original) Sean * @date (original) 08-Oct-2024 * ***************************************************************************/ #ifndef __VALVES_H__ #define __VALVES_H__ // ********** public definitions ********** #include "TDCommon.h" #include "RotaryValve.h" /** * @defgroup Valves Valves * @brief Valves controller unit. Provides higher level control of the pinch valves. * * @addtogroup Valves * @{ */ // ********** public definitions ********** /// Valves positions typedef enum valveStatesNames { VALVE_POSITION_NOT_IN_POSITION = 0, ///< Valve position is unknown (cannot be used as a command) VALVE_POSITION_A_INSERT_EJECT, ///< Position A, Insert/Eject VALVE_POSITION_B_OPEN, ///< Position B, Open VALVE_POSITION_C_CLOSE, ///< Position C, Close VALVE_POSITION_D_VENOUS, ///< Position D, Venous NUM_OF_VALVE_POSITIONS, ///< Number of valve positions } VALVE_POSITION_T; #pragma pack(push, 1) /// TD valves broadcast data typedef struct { U32 valveID; ///< Valve ID U32 state; ///< Current state of the state machine U32 currentPosID; ///< Current position (enum) S16 currentPos; ///< Current position in encoder counts S16 cmdPos; ///< Commanded position (enum) S16 posA; ///< Position A (count) S16 posB; ///< Position B (count) S16 posC; ///< Position C (count) } TD_VALVE_DATA_T; #pragma pack(pop) // ********** public function prototypes ********** void initValves(void); void execValvesController(void); SELF_TEST_STATUS_T execValvesSelfTest( void ); BOOL homeValve( VALVE_T valve, BOOL force, BOOL cartridge ); BOOL setValvePosition( VALVE_T valve, VALVE_POSITION_T position ); VALVE_POSITION_T getValvePosition( VALVE_T valve ); BOOL testValvesDataPublishIntervalOverride( MESSAGE_T *message ); BOOL testValveSetABCCmdPosition( MESSAGE_T *message ); BOOL testHomeValve( MESSAGE_T *message ); /**@}*/ #endif