Index: firmware/App/Services/FpgaDD.c =================================================================== diff -u -r521cd469ec8e35476a27475170848d0f62aa0ec8 -ra9983d3e6b07e7c927fab3d16e80b715594fe221 --- firmware/App/Services/FpgaDD.c (.../FpgaDD.c) (revision 521cd469ec8e35476a27475170848d0f62aa0ec8) +++ firmware/App/Services/FpgaDD.c (.../FpgaDD.c) (revision a9983d3e6b07e7c927fab3d16e80b715594fe221) @@ -65,6 +65,11 @@ #define FPGA_D43_WR_ENABLE_BIT 0x40 ///< Conductivity Sensor D43 write enable bit mask. #define FPGA_D43_RD_ENABLE_BIT 0x80 ///< Conductivity Sensor D43 read enable bit mask. +#define FPGA_D74_RESET_BIT 0x01 ///< Conductivity Sensor D74 reset bit mask. +#define FPGA_D74_INIT_ENABLE_BIT 0x02 ///< Conductivity Sensor D74 Initialization enable bit mask. +#define FPGA_D74_WR_ENABLE_BIT 0x04 ///< Conductivity Sensor D74 write enable bit mask. +#define FPGA_D74_RD_ENABLE_BIT 0x08 ///< Conductivity Sensor D74 read enable bit mask. + // Assuming all valves are ON/OFF based control ( No PWM control used) #define FPGA_ENABLE_VALVES_PWM 0x0000 ///< FPGA enable valves PWM. #define FPGA_ENABLE_BC_VALVES_PWM 0x00 ///< FPGA enable Balancing chamber valves PWM. @@ -233,6 +238,12 @@ U08 fpgaFloater2Status; ///< Reg 427. Floater 2 level sensor status U16 fpgaD11PumpStepCountStatus; ///< Reg 428. Acid concentrate pump revolution down count status U16 fpgaD10PumpStepCountStatus; ///< Reg 430. Bicarb concentrate pump revolution down count status + + U32 fpgaD74CondDataOut; ///< Reg 432. Data read from Conductivity Sensor D74 register + U16 fpgaD74CondCond; ///< Reg 436. D74 conductivity + U16 fpgaD74CondTemp; ///< Reg 438. D74 Temperature + U08 fpgaD74CondReadCnt; ///< Reg 440. D74 successful read count + U08 fpgaD74CondErrorCnt; ///< Reg 441. D74 error read count } DD_FPGA_SENSORS_T; typedef struct @@ -327,6 +338,11 @@ U08 fpgaGPIOControl; ///< Reg 147. FPGA GPIO control interface U16 fpgaACRelayPWMLow; ///< Reg 148. Length of time in 10us resoultion that PWM output stays low. U16 fpgaACRelayPWMPeriod; ///< Reg 150. PWM period for AC relay/heater. + + U08 fpgaConSensD74Control; ///< Reg 152. Conductivity/Temperature Sensors D74 Control registers + U16 fpgaConSensD74_Addrs; ///< Reg 153. D74 Initialization Address register + U32 fpgaConSensD74_Data_In; ///< Reg 155. D74 Initialization data register + } FPGA_ACTUATORS_T; #pragma pack(pop) @@ -1167,6 +1183,125 @@ /*********************************************************************//** * @brief + * The setFPGAD74CondReset function resets the FPGA Conductivity + * Sensor D74. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD74Control + * @param none + * @return none + *************************************************************************/ +void setFPGAD74CondReset( void ) +{ + fpgaActuatorSetPoints.fpgaConSensD74Control |= FPGA_D74_RESET_BIT; +} + +/*********************************************************************//** + * @brief + * The clearFPGAD74CondReset function clears the reset of FPGA Conductivity + * Sensor D74. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD74Control + * @param none + * @return none + *************************************************************************/ +void clearFPGAD74CondReset( void ) +{ + fpgaActuatorSetPoints.fpgaConSensD74Control &= ~FPGA_D74_RESET_BIT; +} + +/*********************************************************************//** + * @brief + * The setFPGAD74CondInitEnable function enables the FPGA Conductivity + * Sensor D74 initialzation procedure. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD74Control + * @param none + * @return none + *************************************************************************/ +void setFPGAD74CondInitEnable( void ) +{ + fpgaActuatorSetPoints.fpgaConSensD74Control |= FPGA_D74_INIT_ENABLE_BIT; +} + +/*********************************************************************//** + * @brief + * The clearFPGAD74CondInitEnable function clears the init process of FPGA Conductivity + * Sensor D74. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD74Control + * @param none + * @return none + *************************************************************************/ +void clearFPGAD74CondInitEnable( void ) +{ + fpgaActuatorSetPoints.fpgaConSensD74Control &= ~FPGA_D74_INIT_ENABLE_BIT; +} + +/*********************************************************************//** + * @brief + * The setFPGAD74CondWriteEnable function enables the FPGA Conductivity + * Sensor D74 write transaction. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD74Control + * @param none + * @warning: The address (setFPGACD74Address) and data (setFPGACD74Data) register + * must be populated before invoking this write enable function to initiate + * write transaction with the sensor. + * @return none + *************************************************************************/ +void setFPGAD74CondWriteEnable( void ) +{ + fpgaActuatorSetPoints.fpgaConSensD74Control |= FPGA_D74_WR_ENABLE_BIT; +} + +/*********************************************************************//** + * @brief + * The clearFPGAD74CondWriteEnable function clears the write enable of FPGA Conductivity + * Sensor D74. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD74Control + * @param none + * @return none + *************************************************************************/ +void clearFPGAD74CondWriteEnable( void ) +{ + fpgaActuatorSetPoints.fpgaConSensD74Control &= ~FPGA_D74_WR_ENABLE_BIT; +} + +/*********************************************************************//** + * @brief + * The setFPGAD74CondReadEnable function enables the FPGA Conductivity + * Sensor D74 read transaction. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD74Control + * @param none + * @warning: The address (setFPGACD74Address) register must be populated + * before invoking this read enable function to initiate read transaction + * with the sensor. + * @return none + *************************************************************************/ +void setFPGAD74CondReadEnable( void ) +{ + fpgaActuatorSetPoints.fpgaConSensD74Control |= FPGA_D74_RD_ENABLE_BIT; +} + +/*********************************************************************//** + * @brief + * The clearFPGAD74CondReadEnable function clears the read enable of FPGA Conductivity + * Sensor D74. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD74Control + * @param none + * @return none + *************************************************************************/ +void clearFPGAD74CondReadEnable( void ) +{ + fpgaActuatorSetPoints.fpgaConSensD74Control &= ~FPGA_D74_RD_ENABLE_BIT; +} + + +/*********************************************************************//** + * @brief * The setFpgaCD12Control function sets the FPGA Conductivity * Sensor control register for CD1&2. * bit 7: Enables D27 read transaction (1), address needed @@ -1211,6 +1346,25 @@ /*********************************************************************//** * @brief + * The setFpgaCD5Control function sets the FPGA Conductivity + * Sensor control register for CD5. + * bit 4- 7: Reserved. + * bit 3: Enables D74 read transaction (1), address needed + * bit 2: Enables D74 write transaction (1), address and data needs to be set + * bit 1: Enable D74 Init procedure (1) + * bit 0: reset D74 Conduct sensor (1) + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD74Control + * @param control Conductivity sensor control set + * @return none + *************************************************************************/ +void setFPGACD5Control( U08 control ) +{ + fpgaActuatorSetPoints.fpgaConSensD74Control = control; +} + +/*********************************************************************//** + * @brief * The setFPGACD12Address function sets the conductivity sensor * CD12 address register to perform read and write operations. * @details \b Inputs: none @@ -1239,6 +1393,20 @@ /*********************************************************************//** * @brief + * The setFPGACD5Address function sets the conductivity sensor + * D74 address register to perform read and write operations. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD74_Addrs + * @param address The conductivity sensor CD74 address + * @return none + *************************************************************************/ +void setFPGACD5Address( U16 address ) +{ + fpgaActuatorSetPoints.fpgaConSensD74_Addrs = address; +} + +/*********************************************************************//** + * @brief * The setFPGACD12Data function sets the conductivity sensor * CD12 data outputfor write operations. * @details \b Inputs: none @@ -1267,6 +1435,20 @@ /*********************************************************************//** * @brief + * The setFPGACD5Data function sets the conductivity sensor + * CD5 data outputfor write operations. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.fpgaConSensD74_Data_In + * @param data The conductivity sensor CD74 Data + * @return none + *************************************************************************/ +void setFPGACD5Data( U32 data ) +{ + fpgaActuatorSetPoints.fpgaConSensD74_Data_In = data; +} + +/*********************************************************************//** + * @brief * The setFPGAD5HeaterPWMControl function sets the primary heater * PWM input. * @details \b Inputs: none @@ -2345,6 +2527,66 @@ /*********************************************************************//** * @brief + * The getFPGAD74CondReadCount function gets D74 conductivity sensor read count. + * @details \b Inputs: fpgaSensorReadings.fpgaD74CondReadCnt + * @details \b Outputs: none + * @return Latest D74 conductivity sensor read count + *************************************************************************/ +U08 getFPGAD74CondReadCount( void ) +{ + return fpgaSensorReadings.fpgaD74CondReadCnt; +} + +/*********************************************************************//** + * @brief + * The getFPGAD74CondErrorCount function gets D74 conductivity sensor error count. + * @details \b Inputs: fpgaSensorReadings.fpgaD74CondErrorCnt + * @details \b Outputs: none + * @return Latest D74 conductivity sensor read error count + *************************************************************************/ +U08 getFPGAD74CondErrorCount( void ) +{ + return fpgaSensorReadings.fpgaD74CondErrorCnt; +} + +/*********************************************************************//** + * @brief + * The getFPGAD74Cond function gets D74 conductivity sensor value. + * @details \b Inputs: fpgaSensorReadings.fpgaD74Cond + * @details \b Outputs: none + * @return Latest D74 conductivity sensor value + *************************************************************************/ +U16 getFPGAD74Cond( void ) +{ + return fpgaSensorReadings.fpgaD74CondCond; +} + +/*********************************************************************//** + * @brief + * The getFPGAD74CondTemp function gets D74 conductivity sensor temperature value. + * @details \b Inputs: fpgaSensorReadings.fpgaD74CondTemp + * @details \b Outputs: none + * @return Latest D74 conductivity sensor temperature value + *************************************************************************/ +U16 getFPGAD74CondTemp( void ) +{ + return fpgaSensorReadings.fpgaD74CondTemp; +} + +/*********************************************************************//** + * @brief + * The getFPGAD74CondData function gets D74 conductivity sensor register value. + * @details \b Inputs: fpgaSensorReadings.fpgaD74CondDataOut + * @details \b Outputs: none + * @return Latest D74 conductivity sensor register data value + *************************************************************************/ +U32 getFPGAD74CondData( void ) +{ + return fpgaSensorReadings.fpgaD74CondDataOut; +} + +/*********************************************************************//** + * @brief * The getFPGAD63LevelSensor function gets the latest FPGA D63 level sensor * reading. * @details \b Inputs: fpgaSensorReadings.fpgaD63LevelSensor