Index: firmware/App/Services/FpgaDD.c =================================================================== diff -u -r275ee4fdc1ace09febcf9788c80171f7a6372c99 -rbef932558c7e8e50ab60c5f8c0c1967b8d7d4ca4 --- firmware/App/Services/FpgaDD.c (.../FpgaDD.c) (revision 275ee4fdc1ace09febcf9788c80171f7a6372c99) +++ firmware/App/Services/FpgaDD.c (.../FpgaDD.c) (revision bef932558c7e8e50ab60c5f8c0c1967b8d7d4ca4) @@ -1,18 +1,18 @@ /************************************************************************** * -* Copyright (c) 2024-2024 Diality Inc. - All Rights Reserved. +* Copyright (c) 2024-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 FpgaDD.c * -* @author (last) Vinayakam Mani -* @date (last) 05-Aug-2024 +* @author (last) “rkallala” +* @date (last) 19-Jan-2026 * * @author (original) Vinayakam Mani -* @date (original) 05-Aug-2024 +* @date (original) 26-Aug-2024 * ***************************************************************************/ @@ -91,7 +91,7 @@ #define FPGA_D12_PUMP_ERROR_BIT 0x01 ///< Fresh dialysate pump error bit mask. #define FPGA_D48_PUMP_ERROR_BIT 0x02 ///< Spent dialysate pump error bit mask. -#define FPGA_D6_FLOATER_LEVEL_BIT 0x03 ///< Floater level bit mask. +#define FPGA_D6_FLOATER_LEVEL_BIT 0x07 ///< Floater level bit mask. #define FPGA_D5_HEATER_CNTRL_BIT 0x01 ///< FPGA GIO D5 heater control bit mask #define FPGA_D5_HEATER_PWM_ENABLE_BIT 0x02 ///< FPGA D5 PWM based heater control bit mask @@ -102,11 +102,18 @@ #define MAX_FPGA_COMM_FAILURES 3 ///< FPGA maximum comm failures per MAX_FPGA_COMM_FAILURES_WINDOW_MS #define MIN_POWER_ON_TIME_FOR_COMM_FAILS ( 1 * MS_PER_SECOND ) ///< Allow FPGA comm errors for first second after power-up -#define FPGA_CONDUCTIVITY_RESET_BIT 0x01 ///< Conductivity Sensor reset bit mask. -#define FPGA_CONDUCTIVITY_INIT_ENABLE_BIT 0x02 ///< Conductivity Sensor initialization enable bit mask. -#define FPGA_CONDUCTIVITY_WR_ENABLE_BIT 0x04 ///< Conductivity Sensor write enable bit mask. -#define FPGA_CONDUCTIVITY_RD_ENABLE_BIT 0x08 ///< Conductivity Sensor read enable bit mask. +#define FPGA_CONDUCTIVITY_RESET_BIT 0x01 ///< Conductivity Sensor reset bit mask. +#define FPGA_CONDUCTIVITY_INIT_ENABLE_BIT 0x02 ///< Conductivity Sensor initialization enable bit mask. +#define FPGA_CONDUCTIVITY_WR_ENABLE_BIT 0x04 ///< Conductivity Sensor write enable bit mask. +#define FPGA_CONDUCTIVITY_RD_ENABLE_BIT 0x08 ///< Conductivity Sensor read enable bit mask. +#define FPGA_D42_BLOOD_LEAK_STATUS_MASK 0x04 ///< Bit mask for blood leak detector. +#define FPGA_D42_BLOOD_LEAK_ST_BIT_INDEX 2 ///< Bit index for the blood leak self test status bit. + +#define MAX_PUMP_SPEED 3000.0F ///< Maxon controller pump maximum speed +#define PUMP_SPEED_OFFSET 168.7F ///< Speed Scale adjustment intercept factor +#define PUMP_SPEED_FULL_SCALE 3187.0F ///< Speed scale adjustment slope factor + #pragma pack(push,1) /// FPGA header struct. typedef struct @@ -202,8 +209,8 @@ U08 fpgaD76PumpFault; ///< Reg 658: UF pump fault U08 fpga_UnUsed_3; ///< reg 659: Not used - S16 pressureM1; ///< Reg 660. M1 pressure data. - U16 temperatureM1; ///< Reg 662. M1 temperature data. + S16 pressureP46; ///< Reg 660. P46 pressure data. + U16 temperatureP46; ///< Reg 662. P46 temperature data. S16 pressureM3; ///< Reg 664. M3 pressure data. U16 temperatureM3; ///< Reg 666. M3 temperature data. S16 pressureP8; ///< Reg 668. P8 pressure data. @@ -228,10 +235,12 @@ U16 flowRateP7; ///< Reg 704. P7 flow sensor rate. U16 flowTempP7; ///< Reg 706. P7 flow sensor temperature. U16 p12PumpTachCount; ///< Reg 708. P12 pump tachometer counter. - U16 dsPumpTachCount; ///< Reg 710. DSP tachometer counter. + U16 d79SpeedPulseWidth; ///< Reg 710. D79 pusle width feedback. U16 flowIntTempP7; ///< Reg 712. P7 flow sensor internal temperature. - U16 valveControlReadback; ///< Reg 714. Valve control bits read back. - U16 valvePWMEnableReadback; ///< Reg 716. Valve PWM enable read back. + U08 valveIOControlReadback; ///< Reg 714. IO Valve control bits read back. + U08 valveFPControlReadback; ///< Reg 715. FP Valve control enable read back. + U08 valveIOPWMEnableReadback; ///< Reg 714. IO Valve PWM enable read back. + U08 valveFPPWMEnableReadback; ///< Reg 715. FP Valve PWM enable read back. U16 p12PumpPWMReadback; ///< Reg 718. P12 pump PWM read back. U16 p40PumpPWMReadback; ///< Reg 720. P40 pump PWM read back. U08 p7flowReadCount; ///< Reg 722. P7 Flow sensor read counter. @@ -286,13 +295,13 @@ U08 fpgaD42FIFOTx; ///< Reg 48. Blood leak sensor FIFO transmit control U08 fpgaD5HeaterPWMControl; ///< Reg 49. Primary heater PWM control U08 fpgaD45HeaterPWMControl; ///< Reg 50. Trimmer heater PWM control - U08 fpgaNotUsed; ///< Reg 51. Not used + U08 fpgaD79PWMPumpCtl; ///< Reg 51. Rinse pump PWM control U16 fpgaVBCPWMLow; ///< Reg 52. VBC PWM low ( Balancing chamber valves) U16 fpgaVBCPWMPeriod; ///< Reg 54. VBC PWM period - U16 fpgaVBCPWMPullin; ///< Reg 56. VBC PWM pull in + U16 fpgaVBCPWMPullIn; ///< Reg 56. VBC PWM pull in U16 fpgaVSPPWMLow; ///< Reg 58. VSP PWM low ( Spare valves ) U16 fpgaVSPPWMPeriod; ///< Reg 60. VSP PWM period - U16 fpgaVSPPWMPullin; ///< Reg 62. VSP PWM pull in + U16 fpgaVSPPWMPullIn; ///< Reg 62. VSP PWM pull in U16 fpgaD11PumpRevCount; ///< Reg 64. Acid Concentrate pump revolution count U16 fpgaD10PumpRevCount; ///< Reg 66. Bicarb Concentrate pump revolution count U08 fpgaADCControl; ///< Reg 68. FPGA internal ADC Control register for debugging @@ -304,7 +313,8 @@ U08 fpgaD76PumpControl; ///< Reg 78. UF Pump Control U08 notused; ///< Reg 79. Not used - U16 valveControl; ///< Reg 80. Valve control register. + U08 valveIOControl; ///< Reg 80. IO Valve control register. + U08 valveFPControl; ///< Reg 81. FP Valve control register. U08 conductivityP9Control; ///< Reg 82. P9 conductivity control register. U08 conductivityP18Control; ///< Reg 83. P18 conductivity control register. U16 conductivityP9Address; ///< Reg 84. P9 conductivity address register. @@ -314,16 +324,17 @@ U16 descalePumpSpeed; ///< Reg 96. Descaler pump speed register. U08 descalePumpControl; ///< Reg 98. Descaler pump control register. U08 p12PumpControl; ///< Reg 99. P12 pump control register. - U16 valveVwiPWMLow; ///< Reg 100. Valve VWi PWM low pulse period in 0.1 uSec. - U16 valveVwiPWMPeriod; ///< Reg 102. Valve VWi PWM full period in 0.1 uSec. - U16 valvePWMPullIn; ///< Reg 104. Valve PWM high pulse period when valve is on in 0.1 uSec. + U16 valveIOFPPWMLow; ///< Reg 100. Valve VWi PWM low pulse period in 0.1 uSec. + U16 valveIOFPPWMPeriod; ///< Reg 102. Valve VWi PWM full period in 0.1 uSec. + U16 valveIOFPPWMPullIn; ///< Reg 104. Valve PWM high pulse period when valve is on in 0.1 uSec. U16 p12PumpPWMDutyCyclePct; ///< Reg 106. P12 pump PWM duty cycle in percentage. U16 p40PumpPWMDutyCyclePct; ///< Reg 108. P40 pump PWM duty cycle in percentage. U08 p40PumpControl; ///< Reg 110. P40 pump control register. U08 reserved1; ///< Reg 111. Reserved. U08 flowControlp7; ///< Reg 112. P7 AVS Romer flow sensor control register. U08 flowAddressp7; ///< Reg 113. P7 AVS Romer flow sensor I2C slave address register. - U16 valvePWMEnable; ///< Reg 114. Valve PWM enable register. + U08 valveIOPWMEnable; ///< Reg 114. Valve IO PWM enable register. + U08 valveFPPWMEnable; ///< Reg 115. Valve FP PWM enable register. U08 flowControlp16; ///< Reg 116. P16 AVS Romer flow sensor control register. U08 flowAddressp16; ///< Reg 117. P16 AVS Romer flow sensor I2C slave address register. @@ -524,6 +535,219 @@ /*********************************************************************//** * @brief + * The setFPGAValveDDPWMEnable function sets the DD valve PWM states with + * * an 8-bit mask representing the set of states with a 1 meaning "enabled" + * and a 0 meaning "disabled" + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.fpgaValvePWMEnable + * @param valvePWMStates bit mask for requested valve states. + * @return none + *************************************************************************/ +void setFPGAValveDDPWMEnable( U16 valvePWMStates ) +{ + fpgaActuatorSetPoints.fpgaValvePWMEnable = valvePWMStates; +} + +/*********************************************************************//** + * @brief + * The getFPGAValveDDPWMEnable function gets the DD valve pwm states with + * an 8-bit mask representing the set of states with a 1 meaning "enabled" + * and a 0 meaning "disabled". + * @details \b Inputs: none + * @details \b Outputs: fpgaSensorReadings.fpgaValvePWMEnableStates + * @return none + *************************************************************************/ +U16 getFPGAValveDDPWMEnable( void ) +{ + return fpgaSensorReadings.fpgaValvePWMEnableStates; +} + +/*********************************************************************//** + * @brief + * The setFPGAValveDDPWMPullIn function sets the DD valves Pull-in "strike" + * period where PWM is at 100% in 1ms resolution. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.fpgaDDValvePWMPullin + * @param valvePWMPullIn Pull-in period in 1ms resolution. + * @return none + *************************************************************************/ +void setFPGAValveDDPWMPullIn( U16 valvePWMPullIn ) +{ + fpgaActuatorSetPoints.fpgaDDValvePWMPullin = valvePWMPullIn; +} + +/*********************************************************************//** + * @brief + * The setFPGAValveDDPWMLow function sets the DD valves "low" + * period where PWM is at 0% in 0.1us resolution. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.fpgaDDValvePWMLow + * @param valvePWMLow low period in 0.1us resolution. + * @return none + *************************************************************************/ +void setFPGAValveDDPWMLow( U16 valvePWMLow ) +{ + fpgaActuatorSetPoints.fpgaDDValvePWMLow = valvePWMLow; +} + +/*********************************************************************//** + * @brief + * The setFPGAValveDDPWMPeriod function sets the DD valves pwm + * period in 0.1us resolution. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.fpgaDDValvePWMPeriod + * @param valvePWMPeriod period in 0.1us resolution. + * @return none + *************************************************************************/ +void setFPGAValveDDPWMPeriod( U16 valvePWMPeriod ) +{ + fpgaActuatorSetPoints.fpgaDDValvePWMPeriod = valvePWMPeriod; +} + +/*********************************************************************//** + * @brief + * The setFPGAValveBCPWMEnable function sets the BC valve PWM states with + * * an 8-bit mask representing the set of states with a 1 meaning "enabled" + * and a 0 meaning "disabled" + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.fpgaBCValvePWMControl + * @param valvePWMStates bit mask for requested valve states. + * @return none + *************************************************************************/ +void setFPGAValveBCPWMEnable( U08 valvePWMStates ) +{ + fpgaActuatorSetPoints.fpgaBCValvePWMControl = valvePWMStates; +} + +/*********************************************************************//** + * @brief + * The getFPGAValveBCPWMEnable function gets the BC valve pwm states with + * an 8-bit mask representing the set of states with a 1 meaning "enabled" + * and a 0 meaning "disabled". + * @details \b Inputs: none + * @details \b Outputs: fpgaSensorReadings.fpgaValveBCPWMStates + * @return none + *************************************************************************/ +U08 getFPGAValveBCPWMEnable( void ) +{ + return fpgaSensorReadings.fpgaValveBCPWMStates; +} + +/*********************************************************************//** + * @brief + * The setFPGAValveBCPWMPullIn function sets the BC valves Pull-in "strike" + * period where PWM is at 100% in 1ms resolution. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.fpgaVBCPWMPullin + * @param valvePWMPullIn Pull-in period in 1ms resolution. + * @return none + *************************************************************************/ +void setFPGAValveBCPWMPullIn( U16 valvePWMPullIn ) +{ + fpgaActuatorSetPoints.fpgaVBCPWMPullIn = valvePWMPullIn; +} + +/*********************************************************************//** + * @brief + * The setFPGAValveBCPWMLow function sets the BC valves "low" + * period where PWM is at 0% in 0.1us resolution. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.fpgaVBCPWMLow + * @param valvePWMLow low period in 0.1us resolution. + * @return none + *************************************************************************/ +void setFPGAValveBCPWMLow( U16 valvePWMLow ) +{ + fpgaActuatorSetPoints.fpgaVBCPWMLow = valvePWMLow; +} + +/*********************************************************************//** + * @brief + * The setFPGAValveBCPWMPeriod function sets the BC valves pwm + * period in 0.1us resolution. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.fpgaVBCPWMPeriod + * @param valvePWMPeriod period in 0.1us resolution. + * @return none + *************************************************************************/ +void setFPGAValveBCPWMPeriod( U16 valvePWMPeriod ) +{ + fpgaActuatorSetPoints.fpgaVBCPWMPeriod = valvePWMPeriod; +} + +/*********************************************************************//** + * @brief + * The setFPGAValveSPPWMEnable function sets the Spare valve PWM states with + * * an 8-bit mask representing the set of states with a 1 meaning "enabled" + * and a 0 meaning "disabled" + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.fpgaDDSpareValvePWMControl + * @param valvePWMStates bit mask for requested valve states. + * @return none + *************************************************************************/ +void setFPGAValveSPPWMEnable( U08 valvePWMStates ) +{ + fpgaActuatorSetPoints.fpgaDDSpareValvePWMControl = valvePWMStates; +} + +/*********************************************************************//** + * @brief + * The getFPGAValveSPPWMEnable function gets the Spare valve pwm states with + * an 8-bit mask representing the set of states with a 1 meaning "enabled" + * and a 0 meaning "disabled". + * @details \b Inputs: none + * @details \b Outputs: fpgaSensorReadings.fpgaValveSpPWMStates + * @return none + *************************************************************************/ +U08 getFPGAValveSPPWMEnable( void ) +{ + return fpgaSensorReadings.fpgaValveSpPWMStates; +} + +/*********************************************************************//** + * @brief + * The setFPGAValveSPPWMPullIn function sets the Spare valves Pull-in "strike" + * period where PWM is at 100% in 1ms resolution. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.fpgaVSPPWMPullIn + * @param valvePWMPullIn Pull-in period in 1ms resolution. + * @return none + *************************************************************************/ +void setFPGAValveSPPWMPullIn( U16 valvePWMPullIn ) +{ + fpgaActuatorSetPoints.fpgaVSPPWMPullIn = valvePWMPullIn; +} + +/*********************************************************************//** + * @brief + * The setFPGAValveSPPWMLow function sets the Spare valves "low" + * period where PWM is at 0% in 0.1us resolution. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.fpgaVSPPWMLow + * @param valvePWMLow low period in 0.1us resolution. + * @return none + *************************************************************************/ +void setFPGAValveSPPWMLow( U16 valvePWMLow ) +{ + fpgaActuatorSetPoints.fpgaVSPPWMLow = valvePWMLow; +} + +/*********************************************************************//** + * @brief + * The setFPGAValveSPPWMPeriod function sets the Spare valves pwm + * period in 0.1us resolution. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.fpgaVSPPWMPeriod + * @param valvePWMPeriod period in 0.1us resolution. + * @return none + *************************************************************************/ +void setFPGAValveSPPWMPeriod( U16 valvePWMPeriod ) +{ + fpgaActuatorSetPoints.fpgaVSPPWMPeriod = valvePWMPeriod; +} + +/*********************************************************************//** + * @brief * The setFPGAD48PumpSpeed function sets the speed for the * spent dialysate pump (SDP). * @details \b Inputs: none @@ -533,7 +757,16 @@ *************************************************************************/ void setFPGAD48PumpSpeed( U16 speed ) { - fpgaActuatorSetPoints.fpgaD48PumpSpeed = speed; +#ifdef __MAXON_SPEED_UPDATE__ + { + U16 currentSpeed =(U16)( ( ( speed + PUMP_SPEED_OFFSET ) / PUMP_SPEED_FULL_SCALE ) * MAX_PUMP_SPEED ); + fpgaActuatorSetPoints.fpgaD48PumpSpeed = currentSpeed; + } +#else + { + fpgaActuatorSetPoints.fpgaD48PumpSpeed = speed; + } +#endif } /*********************************************************************//** @@ -547,7 +780,16 @@ *************************************************************************/ void setFPGAD12PumpSpeed( U16 speed ) { - fpgaActuatorSetPoints.fpgaD12PumpSpeed = speed; +#ifdef __MAXON_SPEED_UPDATE__ + { + U16 currentSpeed =(U16)( ( ( speed + PUMP_SPEED_OFFSET ) / PUMP_SPEED_FULL_SCALE ) * MAX_PUMP_SPEED ); + fpgaActuatorSetPoints.fpgaD12PumpSpeed = currentSpeed; + } +#else + { + fpgaActuatorSetPoints.fpgaD12PumpSpeed = speed; + } +#endif } /*********************************************************************//** @@ -2727,7 +2969,7 @@ *************************************************************************/ U08 getFPGABloodLeakStatus( void ) { - U08 selfTestStatus = fpgaSensorReadings.fpgaD42PulseStatus; + U08 selfTestStatus = ( fpgaSensorReadings.fpgaD42PulseStatus & FPGA_D42_BLOOD_LEAK_STATUS_MASK ) >> FPGA_D42_BLOOD_LEAK_ST_BIT_INDEX; return selfTestStatus; } @@ -2812,44 +3054,213 @@ /*********************************************************************//** * @brief - * The setFPGAIOFPValveStates function sets the RO valve states with an 8-bit + * The setFPGAD79RinsePumpControl function sets the control bit of the rinse + * pump to turn it on or off. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.fpgaDDSpareValveControl + * @return none + *************************************************************************/ +void setFPGAD79RinsePumpControl( U08 value ) +{ + fpgaActuatorSetPoints.fpgaDDSpareValveControl &= value; +} + +/*********************************************************************//** + * @brief + * The setFPGAD79RinsePumpPWMControl function sets the PWM value of the rinse + * pump to turn it on or off. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.fpgaD79PWMPumpCtl + * @return none + *************************************************************************/ +void setFPGAD79RinsePumpPWMControl( U08 value ) +{ + fpgaActuatorSetPoints.fpgaD79PWMPumpCtl = value; +} + +/*********************************************************************//** + * @brief + * The getFPGAD79RinsePumpPulseWidth function returns the 4-wire rinse pump + * pulse width. + * @details \b Inputs: d79SpeedPulseWidth + * @details \b Outputs: none + * @return fpgaSensorReadings.d79SpeedPulseWidth + *************************************************************************/ +U16 getFPGAD79RinsePumpPulseWidth( void ) +{ + return fpgaSensorReadings.d79SpeedPulseWidth; +} + +/*********************************************************************//** + * @brief + * The setFPGAFPValveStates function sets the FP valve states with an 8-bit * mask of states - one bit per valve, with a 1 meaning "energized" and a 0 * meaning "de-energized". The bit positions for these bit states are as follows: - * 0 - M4.\n - * 1 - P11.\n - * 2 - P33.\n - * 3 - P34.\n - * 4 - P37.\n - * 5 - P39.\n - * 6 - P43.\n - * 7 - P6.\n - * 15:8 - Not used. \n + * 0 - P11.\n + * 1 - P33.\n + * 2 - P34.\n + * 3 - P37.\n + * 4 - P39.\n + * 5 - P6.\n + * 6:8 - Not used. \n * @details \b Inputs: none - * @details \b Outputs: fpgaActuatorSetPoints.valveControl + * @details \b Outputs: fpgaActuatorSetPoints.valveFPControl * @param valveStates bit mask for requested valve states * @return none *************************************************************************/ -void setFPGAIOFPValveStates( U16 valveStates ) +void setFPGAFPValveStates( U08 valveStates ) { - fpgaActuatorSetPoints.valveControl = valveStates; + fpgaActuatorSetPoints.valveFPControl = valveStates; } /*********************************************************************//** * @brief - * The getFPGAValveStates function gets the RO valve commanded states with + * The getFPGAFPValveStates function gets the FP valve commanded states with * an 8-bit mask representing the set of states with a 1 meaning "energized" * and a 0 meaning "de-energized". * @details \b Inputs: none - * @details \b Outputs: fpgaSensorReadings.valveControlReadback + * @details \b Outputs: fpgaSensorReadings.valveFPControlReadback * @return none *************************************************************************/ -U16 getFPGAIOFPValveStates( void ) +U08 getFPGAFPValveStates( void ) { - return fpgaSensorReadings.valveControlReadback; + return fpgaSensorReadings.valveFPControlReadback; } /*********************************************************************//** * @brief + * The setFPGAIOValveStates function sets the IO valve states with an 8-bit + * mask of states - one bit per valve, with a 1 meaning "energized" and a 0 + * meaning "de-energized". The bit positions for these bit states are as follows: + * 0 - M4_VALV.\n + * 1 - M12_VALV.\n + * 2:8 - Not used. \n + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.valveIOControl + * @param valveStates bit mask for requested valve states + * @return none + *************************************************************************/ +void setFPGAIOValveStates( U08 valveStates ) +{ + fpgaActuatorSetPoints.valveIOControl = valveStates; +} + +/*********************************************************************//** + * @brief + * The getFPGAIOValveStates function gets the IO valve commanded states with + * an 8-bit mask representing the set of states with a 1 meaning "energized" + * and a 0 meaning "de-energized". + * @details \b Inputs: none + * @details \b Outputs: fpgaSensorReadings.valveIOControlReadback + * @return none + *************************************************************************/ +U08 getFPGAIOValveStates( void ) +{ + return fpgaSensorReadings.valveIOControlReadback; +} + +/*********************************************************************//** + * @brief + * The setFPGAValveIOPWMEnable function sets the IO valve PWM states with + * * an 8-bit mask representing the set of states with a 1 meaning "enabled" + * and a 0 meaning "disabled" + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.valveIOPWMEnable + * @param valvePWMStates bit mask for requested valve states. + * @return none + *************************************************************************/ +void setFPGAValveIOPWMEnable( U08 valvePWMStates ) +{ + fpgaActuatorSetPoints.valveIOPWMEnable = valvePWMStates; +} + +/*********************************************************************//** + * @brief + * The getFPGAValveIOPWMEnable function gets the IO valve pwm states with + * an 8-bit mask representing the set of states with a 1 meaning "enabled" + * and a 0 meaning "disabled". + * @details \b Inputs: none + * @details \b Outputs: fpgaSensorReadings.valveIOPWMEnableReadback + * @return none + *************************************************************************/ +U08 getFPGAValveIOPWMEnable( void ) +{ + return fpgaSensorReadings.valveIOPWMEnableReadback; +} + +/*********************************************************************//** + * @brief + * The setFPGAValveFPPWMEnable function sets the FP valve PWM states with + * * an 8-bit mask representing the set of states with a 1 meaning "enabled" + * and a 0 meaning "disabled" + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.valveFPPWMEnable + * @param valvePWMStates bit mask for requested valve states. + * @return none + *************************************************************************/ +void setFPGAValveFPPWMEnable( U08 valvePWMStates ) +{ + fpgaActuatorSetPoints.valveFPPWMEnable = valvePWMStates; +} + +/*********************************************************************//** + * @brief + * The getFPGAValveFPPWMEnable function gets the FP valve pwm states with + * an 8-bit mask representing the set of states with a 1 meaning "enabled" + * and a 0 meaning "disabled". + * @details \b Inputs: none + * @details \b Outputs: fpgaSensorReadings.valveFPPWMEnableReadback + * @return none + *************************************************************************/ +U08 getFPGAValveFPPWMEnable( void ) +{ + return fpgaSensorReadings.valveFPPWMEnableReadback; +} + +/*********************************************************************//** + * @brief + * The setFPGAValveIOFPPWMPullIn function sets the IO & FP valves Pull-in "strike" + * period where PWM is at 100% in 1ms resolution. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.valveIOFPPWMPullIn + * @param valvePWMPullIn Pull-in period in 1ms resolution. + * @return none + *************************************************************************/ +void setFPGAValveIOFPPWMPullIn( U16 valvePWMPullIn ) +{ + fpgaActuatorSetPoints.valveIOFPPWMPullIn = valvePWMPullIn; +} + +/*********************************************************************//** + * @brief + * The setFPGAValveIOFPPWMLow function sets the IO & FP valves "low" + * period where PWM is at 0% in 0.1us resolution. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.valveIOFPPWMLow + * @param valvePWMLow low period in 0.1us resolution. + * @return none + *************************************************************************/ +void setFPGAValveIOFPPWMLow( U16 valvePWMLow ) +{ + fpgaActuatorSetPoints.valveIOFPPWMLow = valvePWMLow; +} + +/*********************************************************************//** + * @brief + * The setFPGAValveIOFPPWMPeriod function sets the IO & FP valves pwm + * period in 0.1us resolution. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.valveIOFPPWMPeriod + * @param valvePWMPeriod period in 0.1us resolution. + * @return none + *************************************************************************/ +void setFPGAValveIOFPPWMPeriod( U16 valvePWMPeriod ) +{ + fpgaActuatorSetPoints.valveIOFPPWMPeriod = valvePWMPeriod; +} + +/*********************************************************************//** + * @brief * The setFPGAP12PumpEnable function enables or disables the P12 pump. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.p12PumpControl @@ -2934,26 +3345,26 @@ /*********************************************************************//** * @brief - * The getFPGAM1RawPressure function gets the M1 pressure reading. - * @details \b Inputs: fpgaSensorReadings.pressureM1 + * The getFPGAP46RawPressure function gets the P46 pressure reading. + * @details \b Inputs: fpgaSensorReadings.pressureP46 * @details \b Outputs: none - * @return M1 pressure + * @return P46 pressure *************************************************************************/ -S16 getFPGAM1RawPressure( void ) +S16 getFPGAP46RawPressure( void ) { - return fpgaSensorReadings.pressureM1; + return fpgaSensorReadings.pressureP46; } /*********************************************************************//** * @brief - * The getFPGAM1RawTemperature function gets the M1 sensor temperature reading. - * @details \b Inputs: fpgaSensorReadings.temperatureM1 + * The getFPGAP46RawTemperature function gets the P46 sensor temperature reading. + * @details \b Inputs: fpgaSensorReadings.temperatureP46 * @details \b Outputs: none - * @return M1 sensor temperature + * @return P46 sensor temperature *************************************************************************/ -S16 getFPGAM1RawTemperature( void ) +S16 getFPGAP46RawTemperature( void ) { - return fpgaSensorReadings.temperatureM1; + return fpgaSensorReadings.temperatureP46; } /*********************************************************************//** @@ -3115,6 +3526,19 @@ /*********************************************************************//** * @brief + * The getFPGAFlowP16InternalTemp function gets the P16 flow sensor + * internal temperature. + * @details \b Inputs: fpgaSensorReadings.flowIntTempP16 + * @details \b Outputs: none + * @return P16 internal temperature + *************************************************************************/ +U16 getFPGAFlowP16InternalTemp( void ) +{ + return fpgaSensorReadings.flowIntTempP16; +} + +/*********************************************************************//** + * @brief * The getFPGAFlowP7 function gets the P7 flow rate (in mL/min). * @details \b Inputs: fpgaSensorReadings.flowRateP7 * @details \b Outputs: none @@ -3140,6 +3564,19 @@ /*********************************************************************//** * @brief + * The getFPGAFlowP7InternalTemp function gets the P7 flow sensor + * internal temperature. + * @details \b Inputs: fpgaSensorReadings.flowIntTempP7 + * @details \b Outputs: none + * @return P7 internal temperature + *************************************************************************/ +U16 getFPGAFlowP7InternalTemp( void ) +{ + return fpgaSensorReadings.flowIntTempP7; +} + +/*********************************************************************//** + * @brief * The setFPGAP9Control function sets the FPGA P9 sensor control register * to perform a given action. * bit 4..7: unused