Index: firmware/App/Services/FpgaRO.c =================================================================== diff -u -rc7dcb245c2378b1c96eeaa02f120f61dff598b11 -r0d2351b8e47e40fdcd706ed7b7ac1379b69a20ef --- firmware/App/Services/FpgaRO.c (.../FpgaRO.c) (revision c7dcb245c2378b1c96eeaa02f120f61dff598b11) +++ firmware/App/Services/FpgaRO.c (.../FpgaRO.c) (revision 0d2351b8e47e40fdcd706ed7b7ac1379b69a20ef) @@ -17,16 +17,9 @@ #include "string.h" // for memset(), memcpy() -#include "gio.h" // hal headers -#include "sci.h" -#include "sys_dma.h" - -#include "Comm.h" #include "Compatible.h" -#include "FPGA.h" -#include "Messaging.h" +#include "FpgaRO.h" #include "OperationModes.h" -#include "PersistentAlarm.h" #include "Timers.h" #include "Utilities.h" @@ -124,7 +117,14 @@ U08 conductSensor2ReadCount; ///< Reg 354. Conductivity sensor 2 read counter. U08 conductSensor2ErrorCount; ///< Reg 355. Conductivity sensor 2 error counter. U16 flowRateCountFmp; ///< Reg 356. FMP flow sensor pulse counter. - U16 levelSwitch; ///< Reg 358. LRO1..3 level sensors. + U16 flowTemp; ///< Reg 358. FMP flow sensor temperature. + U16 roPumpTachCount; ///< Reg 360. ROP tachometer counter. + U16 dsPumpTachCount; ///< Reg 362. DSP tachometer counter. + U16 flowIntTemp; ///< Reg 364. FMP flow sensor internal temperature. + U08 valveControlReadback; ///< Reg 366. Valve control bits read back. + U08 valvePWMEnableReadback; ///< Reg 367. Valve PWM enable read back. + U16 roPumpPWMReadback; ///< Reg 368. ROP PWM read back. + U16 heaterPWMReadback; ///< Reg 370. Heater PWM read back. } FPGA_SENSORS_T; /// Record structure for FPGA continuous priority writes. @@ -144,16 +144,9 @@ U08 reserved1; ///< Reg 25. Reserved. U16 valveVwiPWMLow; ///< Reg 26. Valve VWi PWM low pulse period in 0.1 uSec. U16 valveVwiPWMPeriod; ///< Reg 28. Valve VWi PWM full period in 0.1 uSec. - U16 valveVffPWMLow; ///< Reg 30. - U16 valveVffPWMPeriod; ///< Reg 32. - U16 valveVPiPWMLow; ///< Reg 34. - U16 valveVPiPWMPeriod; ///< Reg 36. - U16 valveVcrPWMLow; ///< Reg 38. - U16 valveVcrPWMPeriod; ///< Reg 40. - U16 valveVcmPWMLow; ///< Reg 42. - U16 valveVcmPWMPeriod; ///< Reg 44. - U16 valveVprPWMLow; ///< Reg 46. - U16 valveVprPWMPeriod; ///< Reg 48. + U16 valvePWMPullIn; ///< Reg 30. Valve PWM high pulse period when valve is on in 0.1 uSec. + U16 roPumpPWMDutyCyclePct; ///< Reg 32. ROP PWM duty cycle in percentage. + U16 heaterPWMDutyCyclePct; ///< Reg 34. HRO PWM duty cycle in percentage. } FPGA_ACTUATORS_T; #pragma pack(pop) @@ -350,14 +343,14 @@ * The setFPGAValveStates function sets the RO 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 - VFf.\n - * 1 - VPi.\n - * 2 - VLp.\n - * 3 - VCr.\n - * 4 - VCb.\n - * 5 - VCd1.\n - * 6 - VROd.\n - * 7 - reserved or unused. + * 0 - VWi.\n + * 1 - VFb.\n + * 2 - VFf.\n + * 3 - VPi.\n + * 4 - VCr.\n + * 5 - VCb.\n + * 6 - VCd.\n + * 7 - VROd.\n * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.valveControl * @param valveStates bit mask for requested valve states @@ -374,13 +367,55 @@ * 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.TBD + * @details \b Outputs: fpgaSensorReadings.valveControlReadback * @return none *************************************************************************/ U08 getFPGAValveStates( void ) { -// return fpgaSensorReadings.TBD; - return 0; // TODO + return fpgaSensorReadings.valveControlReadback; } +/*********************************************************************//** + * @brief + * The setROPumpPWMPct function sets the RO pump PWM duty cycle. + * The higher the PWM duty cycle (0..500), the faster the pump will go. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.roPumpPWMDutyCyclePct + * @param pwm PWM duty cycle magnitude + * @return none + *************************************************************************/ +void setROPumpPWMPct( U16 pwm ) +{ + if ( pwm <= MAX_RO_PUMP_PWM ) + { + fpgaActuatorSetPoints.roPumpPWMDutyCyclePct = pwm; + } +} + +/*********************************************************************//** + * @brief + * The getROPumpPWMPct function gets a read back from FPGA of RO pump PWM + * duty cycle. + * @details \b Inputs: fpgaSensorReadings.roPumpPWMReadback + * @details \b Outputs: none + * @return measured speed (RPM) of the RO pump + *************************************************************************/ +U16 getROPumpPWMPct( void ) +{ + return fpgaSensorReadings.roPumpPWMReadback; +} + +/*********************************************************************//** + * @brief + * The getROPumpTachCount function gets the running 16-bit tachometer count + * from the RO pump hall sensor. + * @details \b Inputs: fpgaSensorReadings.roPumpTachCount + * @details \b Outputs: none + * @return RO pump tachometer count + *************************************************************************/ +U16 getROPumpTachCount( void ) +{ + return fpgaSensorReadings.roPumpTachCount; +} + /**@}*/