/************************************************************************** * * Copyright (c) 2021-2023 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 SyringePump.h * * @author (last) Sean Nash * @date (last) 15-May-2023 * * @author (original) Sean Nash * @date (original) 04-Mar-2021 * ***************************************************************************/ #ifndef __SYRINGE_PUMP_H__ #define __SYRINGE_PUMP_H__ #include "HDCommon.h" #include "HDDefs.h" /** * @defgroup SyringePump SyringePump * @brief Syringe pump controller/monitor module. Controls the syringe pump * and monitors status. * * @addtogroup SyringePump * @{ */ // ********** public definitions ********** #define SYRINGE_PUMP_PRIME_VOLUME_ML 0.353F ///< Target syringe prime volume (in mL). #define SYRINGE_PUMP_FILL_VOLUME_OFFSET_ML 0.8F ///< Advised fill volume offset due to HW variance. /// Enumeration of syringe pump operations. typedef enum SyringePumpOperations { SYRINGE_PUMP_OP_STOP = 0, ///< Syringe pump stopped - no operation. SYRINGE_PUMP_OP_RETRACT = 1, ///< Syringe pump retract operation. Retract to home postion. SYRINGE_PUMP_OP_SEEK = 2, ///< Syringe pump seek operation. Seek syringe plunger. SYRINGE_PUMP_OP_PRIME = 3, ///< Syringe pump prime operation. Prime Heparin line. SYRINGE_PUMP_OP_BOLUS = 4, ///< Syringe pump bolus operation. Deliver bolus volume of Heparin. SYRINGE_PUMP_OP_CONTINUOUS = 5, ///< Syringe pump continuous dispense operation. Deliver Heparin at set rate. NUM_OF_SYRINGE_PUMP_OPS = 6 ///< Number of syringe pump operation. } SYRINGE_PUMP_OPERATION_T; /// Payload record structure for the syringe pump operation request message. typedef struct { U32 syringePumpOp; F32 rate; F32 volume; } SYRINGE_PUMP_OP_PAYLOAD_T; /// Payload record structure for the syringe pump data message. typedef struct { U32 syringePumpState; U32 heparinDeliveryState; F32 syringePumpSetRate; F32 syringePumpMeasRate; S32 syringePumpPosition; F32 syringePumpVolumeDelivered; F32 syringePumpMeasHome; F32 syringePumpMeasSwitch; F32 syringePumpMeasForce; F32 syringePumpSafetyVolume; U32 syringePumpStatus; } SYRINGE_PUMP_DATA_PAYLOAD_T; /// Heparin publish data structure typedef struct { F32 syringePumpVolumeDelivered; ///< Syringe pump volume delivered. F32 syringePumpVolumeRequired; ///< Syringe pump volume required for therapy. } SYRINGE_PUMP_VOLUME_DATA_T; // ********** public function prototypes ********** void initSyringePump( void ); void execSyringePump( void ); SELF_TEST_STATUS_T execSyringePumpSelfTest( void ); BOOL userHeparinRequest( HEPARIN_CMD_T cmd ); void setHeparinOff( void ); void setHeparinStopped( void ); void setHeparinCompleted( void ); HEPARIN_STATE_T getHeparinState( void ); void resetPreLoadStatus( void ); void stopSyringePump( void ); BOOL retractSyringePump( void ); BOOL preloadSyringePlunger( void ); BOOL seekSyringePlunger( void ); BOOL primeSyringePump( void ); BOOL checkForSyringeOcclusion( BOOL stopPump ); BOOL startHeparinBolus( void ); BOOL startHeparinContinuous( void ); BOOL setSyringePumpDACVref( void ); void syringeDetectionRequired( BOOL req ); void syringePumpVerifyForceSensorDACCalibration( void ); BOOL isSyringeDetected( void ); BOOL isSyringePumpHome( void ); BOOL isSyringePumpStopped( void ); BOOL isSyringePlungerFound( void ); BOOL isSyringeVolumeAdequate( void ); BOOL isSyringePumpPrimed( void ); BOOL isSyringePumpRunning( void ); BOOL isSyringePumpPreLoaded( void ); F32 getSyringePumpVolumeDelivered( void ); BOOL testSetSyringePumpDataPublishIntervalOverride( U32 value ); BOOL testResetSyringePumpDataPublishIntervalOverride( void ); BOOL testSyringePumpOperationRequest( SYRINGE_PUMP_OP_PAYLOAD_T opParams ); BOOL testSetSyringePumpMeasuredRateOverride( F32 value ); BOOL testResetSyringePumpMeasuredRateOverride( void ); BOOL testSetHeprinBolusTargetRateOverride( F32 value ); BOOL testResetHeprinBolusTargetRateOverride( void ); BOOL testSetSyringePumpMeasuredForceOverride( F32 value ); BOOL testResetSyringePumpMeasuredForceOverride( void ); BOOL testSetSyringePumpMeasuredSyringeDetectOverride( F32 value ); BOOL testResetSyringePumpMeasuredSyringeDetectOverride( void ); BOOL testSetSyringePumpMeasuredHomeOverride( F32 value ); BOOL testResetSyringePumpMeasuredHomeOverride( void ); BOOL testSetSyringePumpMeasuredPositionOverride( S32 value ); BOOL testResetSyringePumpMeasuredPositionOverride( void ); BOOL testSetSyringePumpMeasuredVolumeOverride( F32 value ); BOOL testResetSyringePumpMeasuredVolumeOverride( void ); BOOL testSetSyringePumpStatus( U32 status ); BOOL testResetSyringePumpStatus( void ); BOOL testSetSyringePumpEncoderStatus( U32 status ); BOOL testResetSyringePumpEncoderStatus( void ); BOOL testSetSyringePumpADCandDACStatus( U32 status ); BOOL testResetSyringePumpADCandDACStatus( void ); BOOL testSetSyringePumpADCReadCounter( U32 ctr ); BOOL testResetSyringePumpADCReadCounter( void ); /**@}*/ #endif