Index: firmware/App/Services/FpgaTD.c =================================================================== diff -u -r0eb4b76d5209ff2adf583a9ab6ec8f87a5aa011b -r5eda216f634a74512a5bc11b0984676567512d80 --- firmware/App/Services/FpgaTD.c (.../FpgaTD.c) (revision 0eb4b76d5209ff2adf583a9ab6ec8f87a5aa011b) +++ firmware/App/Services/FpgaTD.c (.../FpgaTD.c) (revision 5eda216f634a74512a5bc11b0984676567512d80) @@ -62,6 +62,8 @@ #define FPGA_BACKUP_ALARM_AUDIO_CONVERT 0.4F ///< Converts backup (piezo) alarm audio ADC volts to amps. #define H9_SWITCH_MASK 0x0001 ///< Front door switch bit mask. Bit 0 of the GPIO register. +#define EJECTOR_OPTICAL_SNSR_RET_MASK 0x0010 ///< Ejector optical sensor retract bit mask. Bit 4 of the GPIO register. +#define EJECTOR_OPTICAL_SNSR_ENG_MASK 0x0020 ///< Ejectro optical sensor engage bit mask. Bit 5 of the GPIO register. #define FPGA_AIRTRAP_LEVEL_LOW_H17_MASK 0x0008 ///< Bit mask for air trap lower level sensor. #define FPGA_AIRTRAP_LEVEL_HIGH_H16_MASK 0x0004 ///< Bit mask for air trap upper level sensor. @@ -112,7 +114,7 @@ S16 h2Temperature; ///< Reg 274. H2 raw temperature data. U08 h2ReadCount; ///< Reg 276. H2 read count. U08 h2ErrorCount; ///< Reg 277. H2 error count. - U16 reserved1; ///< Reg 278. Reserved and available for future use. + S16 h1MaxEncPosition; ///< Reg 278. H1 max encoder position. S16 h1EncPosition; ///< Reg 280. H1 encoder position (1000 steps/rev). U16 h1Status; ///< Reg 282. H1 status. U32 reserved2; ///< Reg 284. Reserved and available for future use. @@ -122,8 +124,7 @@ S16 h4SpeedFromHall; ///< Reg 294. H4 measured speed from hall sensor(s). U16 h19Status; ///< Reg 296. H19 status. S16 h19EncPosition; ///< Reg 298. H19 encoder position (1000 steps/rev). - U08 reserved4; ///< Reg 300. H19 status. - U08 h4Status; ///< Reg 301. H4 status. + S16 h19MaxEncPosition; ///< Reg 300. H19 max encoder position. U16 GPIOReg; ///< Reg 302. GPIO register. U08 HEPStatus; ///< Reg 304. HEP status register. U08 HEPAdcReadCount; ///< Reg 305. HEP ADC read counter. @@ -149,7 +150,7 @@ S16 ACPower3Voltage; ///< Reg 342. AC power voltage - 3. S16 h4RotorHallCount; ///< Reg 344. H4 rotor count from hall sensor. U08 h6RotorStatus; ///< Reg 346. H6 rotor status. - U08 reserved5; ///< + U08 reserved5; ///< Reg 347. Reserved register. U16 h12Speed; ///< Reg 348. H12 speed (air pump in RPM). U16 rotorRevsCounter; ///< Reg 350. Rotor revs counter U16 baroManufactInfo; ///< Reg 352. Baro sensor manufacturing information. @@ -1001,7 +1002,9 @@ * 0=reset (set to 1 after power up) * Sleep: bit 6 (active low) * 0=sleep mode - * Reserved: bit 7 + * Homing: bit 7 (set 1 to enable homing) + * 0=disable homing + * 1=enable homing * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.h19Control * @param controlBits The control bits to apply to the venous pinch valve. @@ -1067,6 +1070,19 @@ /*********************************************************************//** * @brief + * The getH19MaxEncPosition function reads max encoder position of the venous + * pinch valve prior to losing the shaft. + * @details \b Inputs: fpgaSensorReadings.h19MaxEncPosition + * @details \b Outputs: none + * @return Max encoder position of the venous pinch valve + *************************************************************************/ +S16 getH19MaxEncPosition( void ) +{ + return fpgaSensorReadings.h19MaxEncPosition; +} + +/*********************************************************************//** + * @brief * The setH1Control function sets the control bits for the arterial pinch valve. * Microstep setting: bits 0..2: * 0=full step (100% torque) @@ -1087,7 +1103,9 @@ * 0=reset (set to 1 after power up) * Sleep: bit 6 (active low) * 0=sleep mode - * Reserved: bit 7 + * Homing: bit 7 (set 1 to enable homing) + * 0=disable homing + * 1=enable homing * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.h1Control * @param controlBits The control bits to apply to the arterial pinch valve. @@ -1152,6 +1170,19 @@ /*********************************************************************//** * @brief + * The getH1MaxEncPosition function reads max encoder position of the arterial + * pinch valve prior to losing its shaft. + * @details \b Inputs: fpgaSensorReadings.h1MaxEncPosition + * @details \b Outputs: none + * @return Max encoder value of the arterial pinch valve + *************************************************************************/ +S16 getH1MaxEncPosition( void ) +{ + return fpgaSensorReadings.h1MaxEncPosition; +} + +/*********************************************************************//** + * @brief * The getFPGABoardTemperature function reads the FPGA board temperature. * @details \b Inputs: fpgaSensorReadings * @details \b Outputs: none @@ -1182,6 +1213,34 @@ } /*********************************************************************//** + * The getFPGAEjectorRetractOpticalSensor function returns the FPGA ejector + * optical sensor retract status bit 4. + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return 1 if retract is inactive, 0 if retract is active. + *************************************************************************/ +U32 getFPGAEjectorRetractOpticalSensor( void ) +{ + U32 ejectorOpticalRetract = (U32)fpgaSensorReadings.GPIOReg & EJECTOR_OPTICAL_SNSR_RET_MASK; + + return ejectorOpticalRetract; +} + +/*********************************************************************//** + * The getFPGAEjectorEngageOpticalSensor function returns the FPGA ejector + * optical sensor engage status bit 5. + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return 1 if engage is inactive, 0 if engage is active. + *************************************************************************/ +U32 getFPGAEjectorEngageOpticalSensor( void ) +{ + U32 ejectorOpticalEngage = (U32)fpgaSensorReadings.GPIOReg & EJECTOR_OPTICAL_SNSR_ENG_MASK; + + return ejectorOpticalEngage; +} + +/*********************************************************************//** * @brief * The getFPGAPBAADCTemperature function returns the PBA ADC temperature. * @details \b Inputs: fpgaSensorReadings