#ifndef _VALVES_H_ #define _VALVES_H_ #include "Common.h" /** * @defgroup Valves Valves * @brief Valves module * Driver that runs the valves in HD. * * @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 (current position or commanded) VALVE_POSITION_B_OPEN, ///< Position B, Open (current position or commanded) VALVE_POSITION_C_CLOSE, ///< Position C, Close (current position or commanded) NUM_OF_VALVE_POSITIONS, ///< Number of valve positions } VALVE_POSITION_T; /// 3 way valves names typedef enum valvesNames { VDI = 0, ///< Valve Dialyzer Inlet VDO, ///< Valve Dialyzer Outlet VBA, ///< Valve Blood Arterial VBV, ///< Valve Blood Venous NUM_OF_VALVES ///< Number of valves } VALVE_T; #pragma pack(push, 1) /// HD valves broadcast data typedef struct { U32 valveID; ///< Valve ID U32 state; ///< Current state of the state machine U32 currentPosID; ///< Current position in enum S16 currentPos; ///< Current position in counts S16 nextPos; ///< Next position in counts F32 current; ///< Current of the valves S16 posC; ///< Calculated Position C S16 posA; ///< Calculated Position A S16 posB; ///< Calculated Position B } HD_VALVE_DATA_T; // TODO REMOVE the struct typedef struct { S16 currentPos; F32 current; S16 cmdPosition; } HD_VALVE_FAST_DATA_T; #pragma pack(pop) HD_VALVE_FAST_DATA_T fastDataRemoveLater; // TODO REMOVE THE struct // ********** public function prototypes ********* void initValves( void ); SELF_TEST_STATUS_T execValvesSelfTest( void ); void execValves( void ); void homeValve( VALVE_T valve ); BOOL setValvePosition( VALVE_T valve, VALVE_POSITION_T position ); VALVE_POSITION_T getValvePosition( VALVE_T valve ); void setValveAirTrap( OPN_CLS_STATE_T state ); BOOL testSetValvesDataPublishInterval( U32 value ); BOOL testResetValvesDataPublishInterval( void ); BOOL testSetValvesPositionOverride( U32 valve, U32 position ); BOOL testResetValvesPositionOverride( U32 valve ); BOOL testSetValveControlMode( U32 valve, U32 mode ); BOOL testResetValveControlMode( U32 valve ); /**@}*/ #endif