/************************************************************************** * * Copyright (c) 2026-2026 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 PinchValve.h * * @author (last) Varshini Nagabooshanam * @date (last) 08-Jul-2026 * * @author (original) Varshini Nagabooshanam * @date (original) 08-Jul-2026 * ***************************************************************************/ #ifndef __PINCHVALVE_H__ #define __PINCHVALVE_H__ #include "TDCommon.h" #include "RotaryValve.h" /** * @defgroup PinchValve PinchValve * @brief pinch valve communication driver. * This driver sends one generic command at a time through the FPGA * interface. High level functions such as homing and movement to positions * A, B, and C belong in the controller layer. * * @addtogroup PinchValve * @{ */ // ********** public definitions ********** #define PINCH_VALVE_MAX_INPUT_WORDS 3 ///< Maximum number of command input words. #define PINCH_VALVE_MAX_OUTPUT_WORDS 3 ///< Maximum number of command output words. /// Pinch valve command request. typedef struct { U16 cmdHeader; ///< Command header. U16 inputWord1; ///< Input word 1. U16 inputWord2; ///< Input word 2. U16 inputWord3; ///< Input word 3. U08 inputWordCount; ///< Number of valid input words, excluding the command header. U08 outputWordCount; ///< Number of output words expected. BOOL writeOnly; ///< TRUE for a write-only command. } PINCH_VALVE_COMMAND_T; /// Pinch valve command response. typedef struct { U16 outputWord1; ///< Output word 1. U16 outputWord2; ///< Output word 2. U16 outputWord3; ///< Output word 3. U08 spiCmdStatus; ///< FPGA SPI command status. U08 readCount; ///< FPGA read count. U08 errorCount; ///< FPGA invalid command error count. } PINCH_VALVE_RESPONSE_T; /// Pinch valve driver command result. typedef enum pinchValveCommandResults { PINCH_VALVE_CMD_RESULT_IDLE = 0, ///< No command has been requested. PINCH_VALVE_CMD_RESULT_BUSY, ///< Command is executing. PINCH_VALVE_CMD_RESULT_COMPLETE, ///< Command completed successfully. PINCH_VALVE_CMD_RESULT_ERROR ///< Command failed. } PINCH_VALVE_CMD_RESULT_T; // ********** public function prototypes ********** void initPinchValveDriver( void ); void execPinchValveDriver( void ); BOOL setPinchValveCommand( VALVE_T valve, const PINCH_VALVE_COMMAND_T *command ); void setPinchValveEnableReset( VALVE_T valve, BOOL enable, BOOL reset ); U08 getPinchValveEnableReset( VALVE_T valve ); BOOL isPinchValveBusy( void ); PINCH_VALVE_CMD_RESULT_T getPinchValveCommandResult( void ); BOOL getPinchValveResponse( VALVE_T valve, PINCH_VALVE_RESPONSE_T *response ); /**@}*/ #endif