Index: firmware/App/Services/FPGA.c =================================================================== diff -u -r3dd12fb9d032f85126db82ca48812a4652a5b75f -r5c53288436774f0cf6a24132ace29a64a66d619d --- firmware/App/Services/FPGA.c (.../FPGA.c) (revision 3dd12fb9d032f85126db82ca48812a4652a5b75f) +++ firmware/App/Services/FPGA.c (.../FPGA.c) (revision 5c53288436774f0cf6a24132ace29a64a66d619d) @@ -83,8 +83,9 @@ #define FPGA_FLUIDLEAK_STATE_MASK 0x0004 ///< Bit mask for fluid leak detector. -#define CONCENTRATE_CAP_SWITCH_MASK 0x10 ///< Concentrate cap switch bit mask -#define DIALYSATE_CAP_SWITCH_MASK 0x20 ///< Dialysate cap switch bit mask.. +#define CONCENTRATE_CAP_SWITCH_MASK 0x10 ///< Concentrate cap switch bit mask. +#define DIALYSATE_CAP_SWITCH_MASK 0x20 ///< Dialysate cap switch bit mask. +#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. #define FPGA_GPIO_POWER_STATUS_PIN 7 ///< FPGA GPIO power status pin. #define FPGA_READ_V3_START_BYTE_NUM 256 ///< FPGA V3 read sensors start byte number. @@ -196,8 +197,8 @@ U16 fpgaADCVccAux; ///< Reg 408. Internal FPGA Vcc auxiliary voltage U16 fpgaADCVPVN; ///< Reg 410. Internal FPGA VPVN voltage U16 fpgaDialysateFlowRate; ///< Reg 412. Dialysate flow rate measurement - U16 fpgaROFlowRateCount; ///< Reg 414. RO flow rate count - U16 fpgaDialysateFlowRateCount; ///< Reg 416. Dialysate flow rate count + U16 fpgaROFlowSensorEdgeCount; ///< Reg 414. RO flow sensor edge count + U16 fpgaDialysateFlowSensorEdgeCount; ///< Reg 416. Dialysate flow sensor edge count // DVT changes U16 fpgaDrainPumpSpeedFeedback; ///< Reg 418. Drain pump speed feedback @@ -367,6 +368,9 @@ memset( &fpgaSensorReadings, 0, sizeof(DG_FPGA_SENSORS_T) ); memset( &fpgaActuatorSetPoints, 0, sizeof(FPGA_ACTUATORS_T) ); + // Set the THd control register to 0x1 to make sure its ADC is running + fpgaActuatorSetPoints.fpgaTHdControlReg = FPGA_THD_CONTROL_COMMAND; + // TODO Remove the below line // Initialize the valves fpgaActuatorSetPoints.fpgaValveStates = 0x015F; @@ -2291,4 +2295,30 @@ return fpgaSensorReadings.fpgaTHdRTDErrorCount; } +/*********************************************************************//** + * @brief + * The getFPGAROFlowSensorEdgeCount function gets the FPGA RO flow sensor + * edge count. + * @details Inputs: fpgaSensorReadings.fpgaROFlowSensorEdgeCount + * @details Outputs: none + * @return RO flow sensor edge count + *************************************************************************/ +U16 getFPGAROFlowSensorEdgeCount( void ) +{ + return fpgaSensorReadings.fpgaROFlowSensorEdgeCount; +} + +/*********************************************************************//** + * @brief + * The getFPGADialysateFlowSensorEdgeCount function gets the FPGA dialysate + * flow sensor edge count + * @details Inputs: fpgaSensorReadings.fpgaDialysateFlowSensorEdgeCount + * @details Outputs: none + * @return Dialysate flow sensor edge count + *************************************************************************/ +U16 getFPGADialysateFlowSensorEdgeCount( void ) +{ + return fpgaSensorReadings.fpgaDialysateFlowSensorEdgeCount; +} + /**@}*/