#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 VALVE_POSITION_A_INSERT_EJECT, ///< Valve is in Position A, Insert/Eject VALVE_POSITION_B_OPEN, ///< Valve is in Position B, Open VALVE_POSITION_C_CLOSE, ///< Valve is in Position C, Close NUM_OF_VALVE_POSITIONS, ///< Number of valve positions } VALVE_POSITION_T; /// Valves names typedef enum valveNames { 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; S16 posA; S16 posB; } 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 HD_VALVE_DATA_T valveData; ///< Valves data 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 ); BOOL setValveBloodTrap( OPN_CLS_STATE_T state ); BOOL testSetValvesDataPublishInterval( U32 value ); BOOL testResetValvesDataPublishInterval( void ); BOOL testSetValvesPositionOverride( U32 valve, U32 position ); BOOL testResetValvesPositionOverride( U32 valve ); /**@}*/ #endif