Index: firmware/App/Controllers/Valves.c =================================================================== diff -u --- firmware/App/Controllers/Valves.c (revision 0) +++ firmware/App/Controllers/Valves.c (revision 4a5f3c9dfe803562a40aeea3bbc9fc3be0d1e26d) @@ -0,0 +1,49 @@ +/* + * Valves.c + * + * Created on: Aug 7, 2020 + * Author: fw + */ + +#include "Valves.h" + + +void initValves( void ) +{ + +} + +SELF_TEST_STATUS_T execValvesSelfTest( void ) +{ + +} + +void execValves( void ) +{ + +} + +BOOL homeDialyzerInletValve( void ) +{ + +} + +BOOL homeDialyzerOutletValve( void ) +{ + +} + +BOOL homeBloodArterialValve( void ) +{ + +} + +BOOL homeBloodVenousValve( void ) +{ + +} + +BOOL homeBloodTrapValve( void ) +{ + +} Index: firmware/App/Controllers/Valves.h =================================================================== diff -u --- firmware/App/Controllers/Valves.h (revision 0) +++ firmware/App/Controllers/Valves.h (revision 4a5f3c9dfe803562a40aeea3bbc9fc3be0d1e26d) @@ -0,0 +1,47 @@ +/* + * Valves.h + * + * Created on: Aug 7, 2020 + * Author: fw + */ + +#ifndef _VALVES_H_ +#define _VALVES_H_ + +#include "Common.h" + +typedef enum valveStatesNames +{ + VALVE_STATE_POS_A_INSERT_EJECT = 0, + VALVE_STATE_POS_B_OPEN, + VALVE_STATE_POS_C_CLOSE, + NUM_OF_VALVE_STATES, +} VALVE_STATE_NAMES_T; + +typedef enum valveNames +{ + VDI = 0, + VDO, + VBA, + VBV, + VAT, + NUM_OF_VALVES +} VALVES_T; + +void initValves( void ); + +SELF_TEST_STATUS_T execValvesSelfTest( void ); + +void execValves( void ); + +BOOL homeDialyzerInletValve( void ); + +BOOL homeDialyzerOutletValve( void ); + +BOOL homeBloodArterialValve( void ); + +BOOL homeBloodVenousValve( void ); + +BOOL homeBloodTrapValve( void ); + +#endif Index: firmware/App/Services/FPGA.c =================================================================== diff -u -rf4545d449a2a2f9353307a55d2bce9e150591c3d -r4a5f3c9dfe803562a40aeea3bbc9fc3be0d1e26d --- firmware/App/Services/FPGA.c (.../FPGA.c) (revision f4545d449a2a2f9353307a55d2bce9e150591c3d) +++ firmware/App/Services/FPGA.c (.../FPGA.c) (revision 4a5f3c9dfe803562a40aeea3bbc9fc3be0d1e26d) @@ -1310,6 +1310,47 @@ { *cnt = fpgaSensorReadings.accelSampleCounter; *err = fpgaSensorReadings.accelFaultRegister; +} + +void enableValvesPIDControl( U16 enableBits ) +{ + fpgaActuatorSetPoints.fpgaPIDControl = 0xFF; +} + +void setDialyzerInletValvePosition( U16 setPoint ) +{ + fpgaActuatorSetPoints.VDiSetPoint = setPoint; +} +S16 getDialyzerInletValvePosition( void ) +{ + return fpgaSensorReadings.VDiPosition; +} + +void setDialyzerOutletValvePosition( U16 setPoint ) +{ + fpgaActuatorSetPoints.VDoSetPoint = setPoint; +} +S16 getDialyzerOutletValvePosition( void ) +{ + return fpgaSensorReadings.VDoPosition; +} + +void setVenousBloodValvePosition( U16 setPoint ) +{ + fpgaActuatorSetPoints.VBVSetPoint = setPoint; +} +S16 getVenousBloodValvePoistion( void ) +{ + return fpgaSensorReadings.VBVPosition; +} + +void setArterialBloodValvePosition( U16 setPoint ) +{ + fpgaActuatorSetPoints.VBASetPoint = setPoint; +} +S16 getArterialBloodValvePoistion( void ) +{ + return fpgaSensorReadings.VBAPosition; } /*********************************************************************//** Index: firmware/App/Services/FPGA.h =================================================================== diff -u -r3ded5ffcbcade3f1da5d40c52936ab5f97fc6ec9 -r4a5f3c9dfe803562a40aeea3bbc9fc3be0d1e26d --- firmware/App/Services/FPGA.h (.../FPGA.h) (revision 3ded5ffcbcade3f1da5d40c52936ab5f97fc6ec9) +++ firmware/App/Services/FPGA.h (.../FPGA.h) (revision 4a5f3c9dfe803562a40aeea3bbc9fc3be0d1e26d) @@ -67,7 +67,21 @@ void getFPGAAccelAxes( S16 *x, S16 *y, S16 *z ); void getFPGAAccelMaxes( S16 *xm, S16*ym, S16*zm ); void getFPGAAccelStatus( U16 *cnt, U16 *accelFPGAFaultReg ); - + +void enableValvesPIDControl( U16 enableBits ); + +void setDialyzerInletValvePosition( U16 setPoint ); +S16 getDialyzerInletValvePosition( void ); + +void setDialyzerOutletValvePosition( U16 setPoint ); +S16 getDialyzerOutletValvePosition( void ); + +void setVenousBloodValvePosition( U16 setPoint ); +S16 getVenousBloodValvePoistion( void ); + +void setArterialBloodValvePosition( U16 setPoint ); +S16 getArterialBloodValvePoistion( void ); + /**@}*/ #endif