Index: firmware/App/Services/FpgaDD.c =================================================================== diff -u -r8d390efa9309c8a0f430ba4652528fdbdbb6e2b8 -r3a87ca0e2a722318216623d7e1f4c354c58c506c --- firmware/App/Services/FpgaDD.c (.../FpgaDD.c) (revision 8d390efa9309c8a0f430ba4652528fdbdbb6e2b8) +++ firmware/App/Services/FpgaDD.c (.../FpgaDD.c) (revision 3a87ca0e2a722318216623d7e1f4c354c58c506c) @@ -76,10 +76,10 @@ #define CONCENTRATE_CAP_SWITCH_MASK 0x10 ///< Concentrate cap switch bit mask. #define FPGA_CONC_PUMP_FAULT_BITS 0x03 ///< Concentrate pump fault bits mask. -#define FPGA_CP1_PARKED_BIT 0x04 ///< Concentrate pump 1 parked status bit mask. -#define FPGA_CP2_PARKED_BIT 0x10 ///< Concentrate pump 2 parked status bit mask. -#define FPGA_CP1_PARK_FAULT_BIT 0x08 ///< Concentrate pump 1 park fault status bit mask. -#define FPGA_CP2_PARK_FAULT_BIT 0x20 ///< Concentrate pump 2 park fault status bit mask. +#define FPGA_CPA_PARKED_BIT 0x04 ///< Concentrate pump 1 parked status bit mask. +#define FPGA_CPB_PARKED_BIT 0x10 ///< Concentrate pump 2 parked status bit mask. +#define FPGA_CPA_PARK_FAULT_BIT 0x08 ///< Concentrate pump 1 park fault status bit mask. +#define FPGA_CPB_PARK_FAULT_BIT 0x20 ///< Concentrate pump 2 park fault status bit mask. #define FPGA_CONC_PUMP_PARK_COMMAND 0x80 ///< Park command bit for the concentrate pumps. #define FPGA_THD_CONTROL_COMMAND 0X01 ///< FPGA THd control command. #define FPGA_POWER_OUT_TIMEOUT_MS ( 2 * MS_PER_SECOND ) ///< FPGA power out timeout in milliseconds. @@ -182,6 +182,9 @@ U08 fpgaValveBCPWMStates; ///< Reg 351. Balancing Chamber Valve PWM states U08 fpgaValveUFStates; ///< Reg 352. Ultrafiltration Valves states U08 fpgaValveUFPWMStates; ///< Reg 353. Ultrafiltration Valves PWM states + U08 fpgaCPACPBFault; ///< Reg 354. Concentrate pump fault register for CPA and CPB + U16 fpgaCPAHallSense; ///< Reg 356. Concentrate pump CPA hall sensor pulse width + U16 fpgaCPBHallSense; ///< Reg 358. Concentrate pump CPB hall sensor pulse width } DD_FPGA_SENSORS_T; typedef struct @@ -521,7 +524,7 @@ /*********************************************************************//** * @brief * The setFPGABicarbSetStepSpeed function sets the step speed period for - * concentrate pump CP2. + * concentrate pump CPB. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaCPBSpeed * @param stepSpeed The concentrate pump step speed period @@ -1271,6 +1274,109 @@ /*********************************************************************//** * @brief + * The getFPGAConcentratePumpsFault function gets concentrate pumps fault + * reported by FGPA. + * @details \b Inputs: fpgaSensorReadings.fpgaCPACPBFault + * @details \b Outputs: none + * @return Latest concentrate pumps fault value + *************************************************************************/ +U08 getFPGAConcentratePumpsFault( void ) +{ + return fpgaSensorReadings.fpgaCPACPBFault & FPGA_CONC_PUMP_FAULT_BITS; +} + +/*********************************************************************//** + * @brief + * The getFPGAAcidPumpIsParked function gets whether the acid pump is currently + * parked. + * @details \b Inputs: fpgaSensorReadings.fpgaCPACPBFault + * @details \b Outputs: none + * @return TRUE if acid pump is parked, FALSE if not + *************************************************************************/ +BOOL getFPGAAcidPumpIsParked( void ) +{ + U08 mask = fpgaSensorReadings.fpgaCPACPBFault & FPGA_CPA_PARKED_BIT; + BOOL result = ( mask > 0 ? TRUE : FALSE ); + + return result; +} + +/*********************************************************************//** + * @brief + * The getFPGABicarbPumpIsParked function gets whether the bicarb pump is currently + * parked. + * @details \b Inputs: fpgaSensorReadings.fpgaCPACPBFault + * @details \b Outputs: none + * @return TRUE if bicarb pump is parked, FALSE if not + *************************************************************************/ +BOOL getFPGABicarbPumpIsParked( void ) +{ + U08 mask = fpgaSensorReadings.fpgaCPACPBFault & FPGA_CPB_PARKED_BIT; + BOOL result = ( mask > 0 ? TRUE : FALSE ); + + return result; +} + +/*********************************************************************//** + * @brief + * The getFPGAAcidPumpParkFault function gets whether the acid pump park command + * has faulted. + * @details \b Inputs: fpgaSensorReadings.fpgaCPACPBFault + * @details \b Outputs: none + * @return TRUE if acid pump park command faulted, FALSE if not + *************************************************************************/ +BOOL getFPGAAcidPumpParkFault( void ) +{ + U08 mask = fpgaSensorReadings.fpgaCPACPBFault & FPGA_CPA_PARK_FAULT_BIT; + BOOL result = ( mask > 0 ? TRUE : FALSE ); + + return result; +} + +/*********************************************************************//** + * @brief + * The getFPGABicarbPumpParkFault function gets whether the bicarb pump park command + * has faulted. + * @details \b Inputs: fpgaSensorReadings.fpgaCPACPBFault + * @details \b Outputs: none + * @return TRUE if bicarb pump park command faulted, FALSE if not + *************************************************************************/ +BOOL getFPGABicarbPumpParkFault( void ) +{ + U08 mask = fpgaSensorReadings.fpgaCPACPBFault & FPGA_CPB_PARK_FAULT_BIT; + BOOL result = ( mask > 0 ? TRUE : FALSE ); + + return result; +} + +/*********************************************************************//** + * @brief + * The getFPGACPAHallSensePulseWidth function gets concentrate pump CPA + * hall sense pulse width. + * @details \b Inputs: fpgaSensorReadings.fpgaCPAHallSense + * @details \b Outputs: none + * @return concentrate pump CPA hall sense pulse width + *************************************************************************/ +U16 getFPGACPAHallSensePulseWidth( void ) +{ + return fpgaSensorReadings.fpgaCPAHallSense; +} + +/*********************************************************************//** + * @brief + * The getFPGACPBHallSensePulseWidth function gets concentrate pump CPB + * hall sense pulse width. + * @details \b Inputs: fpgaSensorReadings.fpgaCPBHallSense + * @details \b Outputs: none + * @return concentrate pump CPB hall sense pulse width + *************************************************************************/ +U16 getFPGACPBHallSensePulseWidth( void ) +{ + return fpgaSensorReadings.fpgaCPBHallSense; +} + +/*********************************************************************//** + * @brief * The getFPGAValveStates function gets the latest sensed valve states. * See setFPGAValveStates for valve state bit positions. * @details \b Inputs: fpgaSensorReadings.fpgaValveStates