Index: firmware/App/Services/FpgaTD.c =================================================================== diff -u -r50f4b79164155c1bc375dd3ff0e8588f934dc729 -rb824ef4b479578c5aa702abd9147aef505a6fb04 --- firmware/App/Services/FpgaTD.c (.../FpgaTD.c) (revision 50f4b79164155c1bc375dd3ff0e8588f934dc729) +++ firmware/App/Services/FpgaTD.c (.../FpgaTD.c) (revision b824ef4b479578c5aa702abd9147aef505a6fb04) @@ -1,17 +1,17 @@ /************************************************************************** * -* Copyright (c) 2024-2024 Diality Inc. - All Rights Reserved. +* Copyright (c) 2024-2025 Diality Inc. - All Rights Reserved. * * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * -* @file FPGA.c +* @file FpgaTD.c * -* @author (last) Sean Nash -* @date (last) 30-Jul-2024 +* @author (last) Dara Navaei +* @date (last) 07-Nov-2025 * * @author (original) Sean Nash -* @date (original) 30-Jul-2024 +* @date (original) 01-Aug-2024 * ***************************************************************************/ @@ -46,7 +46,9 @@ #define MIN_POWER_ON_TIME_FOR_COMM_FAILS ( 1 * MS_PER_SECOND ) ///< Allow FPGA comm errors for first second after power-up #define FPGA_H4_ENABLE_BIT_MASK 0x01 ///< Bit mask for enabling the blood pump. -#define FPGA_H4_DIRECTION_REV_BIT_MASK 0x02 ///< Bit mask for setting the blood pump direction. +#define FPGA_H4_DIR_FORWARD_BIT_MASK 0x02 ///< Bit mask for setting the blood pump direction. +#define FPGA_H4_BRAKE_AND_HOLD_TORQUE 0x06 ///< Bit mask for braking the blood pump while holding the torque of the pump. +#define FPGA_H4_BIT_2_INDEX 2 ///< Blood pump bit 2 index. #define FPGA_H13_OPEN_BIT_MASK 0x01 ///< Bit mask for setting H13 valve position to open. #define FPGA_H20_OPEN_BIT_MASK 0x02 ///< Bit mask for setting H20 valve position to open. @@ -110,20 +112,18 @@ S16 h2Temperature; ///< Reg 274. H2 raw temperature data. U08 h2ReadCount; ///< Reg 276. H2 read count. U08 h2ErrorCount; ///< Reg 277. H2 error count. - S16 H1CmdPosition; ///< Reg 278. H1 commanded position (200 steps/rev). - S16 H1EncPosition; ///< Reg 280. H1 encoder position (1024 counts/rev). - U08 H1Status; ///< Reg 282. H1 status. - U08 reserved1; ///< Reg 283. Reserved and available for future use. - U08 reserved2; ///< Reg 284. Reserved and available for future use. - U08 reserved3; ///< Reg 285. Reserved and available for future use. - S32 reserved4; ///< Reg 286. Reserved and available for future use. - S16 H4Period; ///< Reg 290. H4 measured period (10 uSec). - S16 H4Torque; ///< Reg 292. H4 measured torque. - S16 H4SpeedFromHall; ///< Reg 294. H4 measured speed from hall sensor(s). - S16 H19CmdPosition; ///< Reg 296. H19 commanded position (200 steps/rev). - S16 H19EncPosition; ///< Reg 298. H19 encoder position (1024 counts/rev). - U08 H19Status; ///< Reg 300. H19 status. - U08 H4Status; ///< Reg 301. H4 status. + U16 reserved1; ///< Reg 278. Reserved and available for future use. + 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. + U16 reserved3; ///< Reg 288. Reserved and available for future use. + S16 h4Period; ///< Reg 290. H4 measured period (10 uSec). + S16 h4Torque; ///< Reg 292. H4 measured torque. + 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. U16 GPIOReg; ///< Reg 302. GPIO register. U08 HEPStatus; ///< Reg 304. HEP status register. U08 HEPAdcReadCount; ///< Reg 305. HEP ADC read counter. @@ -147,31 +147,46 @@ S16 ACPower2Voltage; ///< Reg 338. AC power voltage - 2. S16 ACPower3Current; ///< Reg 340. AC power current - 3. 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. + S16 h4RotorHallCount; ///< Reg 344. H4 rotor count from hall sensor. + U08 h6RotorStatus; ///< Reg 346. H6 rotor status. + U08 reserved5; ///< + 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. + U16 baroPresSensitivity; ///< Reg 354. Baro sensor prom coefficient 1. + U16 baroPresOffset; ///< Reg 356. Baro sensor prom coefficient 2. + U16 baroTempCoeffOfPresSense; ///< Reg 358. Baro sensor prom coefficient 3. + U16 baroTempCoeffPresOffset; ///< Reg 360. Baro sensor prom coefficient 4. + U16 baroRefTemp; ///< Reg 362. Baro sensor prom coefficient 5. + U16 baroTempCoeffOfTemp; ///< Reg 364. Baro sensor prom coefficient 6. + U16 baroPromCRC; ///< Reg 366. Baro prom CRC. + U32 baroPressure; ///< Reg 368. Baro pressure value in counts. + U32 baroTemperature; ///< Reg 372. Baro temperature value in counts. + U08 baroReadCount; ///< Reg 376. Baro read count. + U08 baroErrorCount; ///< Reg 377. Baro error count. } FPGA_SENSORS_T; /// Record structure for FPGA continuous priority writes. typedef struct { U16 fpgaGenWrRd; ///< Reg 04. FPGA general write/read-back register (mirrored to a general read register in read page at addr 256). - U08 airTrapControl; ///< Reg 06. Air trap valve control register. - U08 airTrapPWMEnable; ///< Reg 07. Air trap valve PWM enable register. + U08 h13h20AirTrapValveControl; ///< Reg 06. H13 & H20 air trap valve control register. + U08 h13h20AirTrapValvePWMEnable; ///< Reg 07. H13 & H20 air trap valve PWM enable register. U16 h13PWMLowPeriod; ///< Reg 08. H13 PWM low signal period register. U16 h13PWMPeriod; ///< Reg 10. H13 PWM period register. U16 h13PWMPUllInTime; ///< Reg 12. H13 PWM pull in time register. U08 h12Control; ///< Reg 14. H12 Air pump control register. U08 h5Control; ///< Reg 15. H5 ejector stepper motor control register. U16 NotUsed; ///< Reg 16. Reserved. - U16 H4SetSpeed; ///< Reg 18. H4 Blood pump speed set register (RPM). - U08 H4Control; ///< Reg 20. H4 Blood pump control register. - U08 H19Control; ///< Reg 21. H19 control register. - U16 H19Position; ///< Reg 22. H19 position set register (200 steps/rev). - U16 H19MotorSpeed; ///< Reg 24. H19 stepper motor speed (uSec/step). - U16 H1Position; ///< Reg 26. H1 position set register (200 steps/rev). - U16 H1MotorSpeed; ///< Reg 28. H1 stepper motor speed (uSec/step). - U08 H1Control; ///< Reg 30. H1 control register. - U08 valveEncoderControl; ///< Reg 31. H1/H19 encoder control register. + U16 h4SetSpeed; ///< Reg 18. H4 Blood pump speed set register (RPM). + U08 h4Control; ///< Reg 20. H4 Blood pump control register. + U08 h19Control; ///< Reg 21. H19 control register. + S16 h19Position; ///< Reg 22. H19 position set register (200 steps/rev). + U16 NotUsed2; ///< Reg 24. Reserved. + S16 h1Position; ///< Reg 26. H1 position set register (200 steps/rev). + U16 NotUsed3; ///< Reg 28. Reserved. + U08 h1Control; ///< Reg 30. H1 control register. + U08 h1h19ValveEncoderControl; ///< Reg 31. H1/H19 valve encoder control register. U08 alarmControl; ///< Reg 32. Alarm audio control register. U08 syrPumpControl; ///< Reg 33. Syringe pump control register. U32 syrPumpSpeed; ///< Reg 34. Syringe pump time between step toggle (1/2 step period). @@ -215,8 +230,8 @@ fpgaActuatorSetPoints.alarmControl = (U08)MIN_ALARM_VOLUME_ATTENUATION << 2; // Start alarm audio volume at maximum // Set H1 and H19 to default configuration + disabled so they do not run immediately on power up - fpgaActuatorSetPoints.H1Control = FPGA_PINCH_VALVES_1_32_STEP | FPGA_PINCH_VALVES_DISABLE | FPGA_PINCH_VALVES_NOT_RESET | FPGA_PINCH_VALVES_NOT_SLEEP; - fpgaActuatorSetPoints.H19Control = FPGA_PINCH_VALVES_1_32_STEP | FPGA_PINCH_VALVES_DISABLE | FPGA_PINCH_VALVES_NOT_RESET | FPGA_PINCH_VALVES_NOT_SLEEP; + fpgaActuatorSetPoints.h1Control = FPGA_PINCH_VALVES_1_8_STEP | FPGA_PINCH_VALVES_DISABLE | FPGA_PINCH_VALVES_NOT_RESET | FPGA_PINCH_VALVES_NOT_SLEEP; + fpgaActuatorSetPoints.h19Control = FPGA_PINCH_VALVES_1_8_STEP | FPGA_PINCH_VALVES_DISABLE | FPGA_PINCH_VALVES_NOT_RESET | FPGA_PINCH_VALVES_NOT_SLEEP; // initialize FPGA comm failures windowed timer count initTimeWindowedCount( TIME_WINDOWED_COUNT_FPGA_COMM_FAILURES, MAX_FPGA_COMM_FAILURES, MAX_FPGA_COMM_FAILURES_WINDOW_MS); @@ -454,11 +469,11 @@ { if ( TRUE == enable ) { - fpgaActuatorSetPoints.H4Control |= FPGA_H4_ENABLE_BIT_MASK; + fpgaActuatorSetPoints.h4Control |= FPGA_H4_ENABLE_BIT_MASK; } else { - fpgaActuatorSetPoints.H4Control &= ~((U08)FPGA_H4_ENABLE_BIT_MASK); + fpgaActuatorSetPoints.h4Control &= ~((U08)FPGA_H4_ENABLE_BIT_MASK); } } @@ -467,21 +482,23 @@ * The setH4Direction function sets the direction for the blood pump * motor to the given direction. * @details \b Inputs: none - * @details \b Outputs: Blood pump motor direction is set (bit 1 of BP control register). + * @details \b Outputs: Blood pump motor direction is set (bit 1 and 2 of BP control register). * 0 - CW (forward) * 1 - CCW (reverse) * @param dir the desired direction for the blood pump motor (fwd or rev) * @return none *************************************************************************/ void setH4Direction( MOTOR_DIR_T dir ) { - if ( MOTOR_DIR_REVERSE == dir ) + if ( MOTOR_DIR_FORWARD == dir ) { - fpgaActuatorSetPoints.H4Control |= FPGA_H4_DIRECTION_REV_BIT_MASK; + // First clear bit 2 if it is on otherwise the pump can be kept on brake + fpgaActuatorSetPoints.h4Control &= ~( 1 << FPGA_H4_BIT_2_INDEX ); + fpgaActuatorSetPoints.h4Control |= FPGA_H4_DIR_FORWARD_BIT_MASK; } else { - fpgaActuatorSetPoints.H4Control &= ~((U08)FPGA_H4_DIRECTION_REV_BIT_MASK); + fpgaActuatorSetPoints.h4Control &= ~((U08)FPGA_H4_DIR_FORWARD_BIT_MASK); } } @@ -490,30 +507,43 @@ * The setH4SetSpeed function sets the fpga blood pump set speed * to the given speed (0..3000 RPM). * @details \b Inputs: none - * @details \b Outputs: fpgaActuatorSetPoints + * @details \b Outputs: fpgaActuatorSetPoints.h4SetSpeed * @param rpm the set point for the H4 pump speed (in RPM). * @return none *************************************************************************/ void setH4SetSpeed( U16 rpm ) { - fpgaActuatorSetPoints.H4SetSpeed = rpm; + fpgaActuatorSetPoints.h4SetSpeed = rpm; } /*********************************************************************//** * @brief * The getH4Period function gets the latest blood pump period (in 10uSec) * from the FPGA. - * @details \b Inputs: fpgaSensorReadings + * @details \b Inputs: fpgaSensorReadings.h4Period * @details \b Outputs: none * @return Latest blood pump period. *************************************************************************/ U16 getH4Period( void ) { - return fpgaSensorReadings.H4Period; + return fpgaSensorReadings.h4Period; } /*********************************************************************//** * @brief + * The setH4BrakeAndHoldTorque function brakes the pump while holding the torque. + * The pump will not coast. + * @details \b Inputs: none + * @details \b Outputs: Blood pump motor control register + * @return none + *************************************************************************/ +void setH4BrakeAndHoldTorque( void ) +{ + fpgaActuatorSetPoints.h4Control |= FPGA_H4_BRAKE_AND_HOLD_TORQUE; +} + +/*********************************************************************//** + * @brief * The getH6Status function gets the latest blood pump hall sensor status. * Bit 0: 1=Magnet is detected (used for homing in forward direction) * Bit 1: 0=Reverse pump direction detected, 1=Forward pump direction detected @@ -529,21 +559,50 @@ /*********************************************************************//** * @brief + * The getH6RotorStatus function gets the latest blood pump hall sensor status. + * Bit 0: 0=Magnet is detected (used for homing in forward direction) + * Bit 1: 0=Reverse pump direction detected, 1=Forward pump direction detected + * Bit 2..7: Not used. + * @details \b Inputs: fpgaSensorReadings.h6RotorStatus + * @details \b Outputs: none + * @return Latest blood pump hall sensor status bits. + *************************************************************************/ +U08 getH6RotorStatus( void ) +{ + return fpgaSensorReadings.h6RotorStatus; +} + +/*********************************************************************//** + * @brief * The getH4RotorCount function gets the latest blood pump * hall sensor count. Count is number of ms between rotor revolutions. * If direction is forward, the count will be positive. If direction is * reverse, the count will be negative. - * @details \b Inputs: fpgaSensorReadings.H4RotorHallCount + * @details \b Inputs: fpgaSensorReadings.h4RotorHallCount * @details \b Outputs: none * @return Latest blood pump hall sensor count reading. *************************************************************************/ S16 getH4RotorCount( void ) { - return fpgaSensorReadings.H4RotorHallCount; + return fpgaSensorReadings.h4RotorHallCount; } /*********************************************************************//** * @brief + * The getH4TorqueCount function gets the latest blood pump + * torque count. Count is the period in 10 uS resolution. Firmware converts + * the period to frequency and 1kHz = 10mN.m. + * @details \b Inputs: fpgaSensorReadings.h4Torque + * @details \b Outputs: none + * @return Latest blood pump torque sensor count reading. + *************************************************************************/ +S16 getH4TorqueCount( void ) +{ + return fpgaSensorReadings.h4Torque; +} + +/*********************************************************************//** + * @brief * The setH5ControlFlags function sets the control flags for the H5 ejector * stepper motor. * @note Bit 0 - MS1 (bit 1 of microstepping configuration setting) @@ -700,6 +759,81 @@ /*********************************************************************//** * @brief + * The getH23MfgCoeffs function updates the baro sensor's manufacturing + * information into the provided buffer. + * @details \b Inputs: fpgaSensorReadings.baroManufactInfo, + * fpgaSensorReadings.baroPromCoeff1, fpgaSensorReadings.baroPromCoeff2, + * fpgaSensorReadings.baroPromCoeff3, fpgaSensorReadings.baroPromCoeff4, + * fpgaSensorReadings.baroPromCoeff5, fpgaSensorReadings.baroPromCoeff6, + * fpgaSensorReadings.baroPromCRC + * @details \b Outputs: none + * @param baroMfgCoeffs The baro sensor mfg info buffer. + * @return none + *************************************************************************/ +void getH23MfgCoeffs( BARO_PRES_SENSOR_MFG_T* baroMfgCoeffs ) +{ + baroMfgCoeffs->baroManufactInfo = fpgaSensorReadings.baroManufactInfo; + baroMfgCoeffs->baroPresSensitivity = fpgaSensorReadings.baroPresSensitivity; + baroMfgCoeffs->baroPresOffset = fpgaSensorReadings.baroPresOffset; + baroMfgCoeffs->baroTempCoeffOfPresSense = fpgaSensorReadings.baroTempCoeffOfPresSense; + baroMfgCoeffs->baroTempCoeffPresOffset = fpgaSensorReadings.baroTempCoeffPresOffset; + baroMfgCoeffs->baroRefTemp = fpgaSensorReadings.baroRefTemp; + baroMfgCoeffs->baroTempCoeffOfTemp = fpgaSensorReadings.baroTempCoeffOfTemp; + baroMfgCoeffs->baroPromCRC = fpgaSensorReadings.baroPromCRC; +} + +/*********************************************************************//** + * @brief + * The getH23Pressure function reads the baro sensor pressure. + * @details \b Inputs: fpgaSensorReadings.baroPressure + * @details \b Outputs: none + * @return Latest baro sensor pressure. + *************************************************************************/ +U32 getH23Pressure( void ) +{ + return ( fpgaSensorReadings.baroPressure & MASK_OFF_U32_MSB ); +} + +/*********************************************************************//** + * @brief + * The getH23Temperature function reads the baro sensor temperature. + * @details \b Inputs: fpgaSensorReadings.baroTemperature + * @details \b Outputs: none + * @return Latest baro sensor temperature. + *************************************************************************/ +U32 getH23Temperature( void ) +{ + return ( fpgaSensorReadings.baroTemperature & MASK_OFF_U32_MSB ); +} + +/*********************************************************************//** + * @brief + * The getH23ReadCounter function gets the latest baro pressure + * sensor read counter. + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return latest baro pressure sensor read counter + *************************************************************************/ +U08 getH23ReadCounter( void ) +{ + return fpgaSensorReadings.baroReadCount; +} + +/*********************************************************************//** + * @brief + * The getH23ErrorCounter function gets the latest baro pressure + * sensor error counter. + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return latest baro pressure sensor error counter + *************************************************************************/ +U08 getH23ErrorCounter( void ) +{ + return fpgaSensorReadings.baroErrorCount; +} + +/*********************************************************************//** + * @brief * The getFPGABackupAlarmAudioCurrent function gets the latest piezo alarm * audio current reading. * @details \b Inputs: fpgaSensorReadings @@ -736,41 +870,41 @@ * @brief * The setH13ValveState function sets the command position for H13 valve. * @note VBTControl register bit 0 will drive state of H13 valve (0=closed, 1=open). - * @details \b Inputs: fpgaActuatorSetPoints - * @details \b Outputs: fpgaActuatorSetPoints + * @details \b Inputs: fpgaActuatorSetPoints.h13h20AirTrapValveControl + * @details \b Outputs: fpgaActuatorSetPoints.h13h20AirTrapValveControl * @param state : The valve state to command H13 valve to * @return none *************************************************************************/ void setH13ValveState( VALVE_3WAY_STATE_T state ) { if ( VALVE_3WAY_COMMON_TO_OPEN_STATE == state ) { - fpgaActuatorSetPoints.airTrapControl |= FPGA_H13_OPEN_BIT_MASK; + fpgaActuatorSetPoints.h13h20AirTrapValveControl |= FPGA_H13_OPEN_BIT_MASK; } else { - fpgaActuatorSetPoints.airTrapControl &= ~((U08)FPGA_H13_OPEN_BIT_MASK); + fpgaActuatorSetPoints.h13h20AirTrapValveControl &= ~((U08)FPGA_H13_OPEN_BIT_MASK); } } /*********************************************************************//** * @brief * The setH20ValveState function sets the command position for H20 valve. * @note VBTControl register bit 0 will drive state of H13 valve (0=closed, 1=open). - * @details \b Inputs: fpgaActuatorSetPoints - * @details \b Outputs: fpgaActuatorSetPoints + * @details \b Inputs: fpgaActuatorSetPoints.h13h20AirTrapValveControl + * @details \b Outputs: fpgaActuatorSetPoints.h13h20AirTrapValveControl * @param state The valve state to command H13 valve to * @return none *************************************************************************/ void setH20ValveState( VALVE_3WAY_STATE_T state ) { if ( VALVE_3WAY_COMMON_TO_OPEN_STATE == state ) { - fpgaActuatorSetPoints.airTrapControl |= FPGA_H20_OPEN_BIT_MASK; + fpgaActuatorSetPoints.h13h20AirTrapValveControl |= FPGA_H20_OPEN_BIT_MASK; } else { - fpgaActuatorSetPoints.airTrapControl &= ~((U08)FPGA_H20_OPEN_BIT_MASK); + fpgaActuatorSetPoints.h13h20AirTrapValveControl &= ~((U08)FPGA_H20_OPEN_BIT_MASK); } } @@ -859,8 +993,7 @@ * 6=1/4 step * 7=1/8 step * Direction: bit 3 - * 0=forward - * 1=reverse + * 1=reset encoder * Enable: bit 4 (active low) * 0=enabled * 1=disabled @@ -870,39 +1003,39 @@ * 0=sleep mode * Reserved: bit 7 * @details \b Inputs: none - * @details \b Outputs: fpgaActuatorSetPoints + * @details \b Outputs: fpgaActuatorSetPoints.h19Control * @param controlBits The control bits to apply to the venous pinch valve. * @return none *************************************************************************/ void setH19Control( U08 controlBits ) { - fpgaActuatorSetPoints.H19Control = controlBits; + fpgaActuatorSetPoints.h19Control = controlBits; } /*********************************************************************//** * @brief * The getH19Control function gets the current control bits for the H19 valve. - * @details \b Inputs: fpgaActuatorSetPoints + * @details \b Inputs: fpgaActuatorSetPoints.h19Control * @details \b Outputs: none * @return fpgaActuatorSetPoints.H19Control *************************************************************************/ U08 getH19Control( void ) { - return fpgaActuatorSetPoints.H19Control; + return fpgaActuatorSetPoints.h19Control; } /*********************************************************************//** * @brief * The setH19Position function sets the travel from current position for the * H19 valve in counts (or microcounts if microstepping is set in control register). * @details \b Inputs: none - * @details \b Outputs: fpgaActuatorSetPoints + * @details \b Outputs: fpgaActuatorSetPoints.h19Position * @param setPoint The target encoder position of the H19 valve in counts * @return none *************************************************************************/ -void setH19Position( U16 setPoint ) +void setH19Position( S16 setPoint ) { - fpgaActuatorSetPoints.H19Position = setPoint; + fpgaActuatorSetPoints.h19Position = setPoint; } /*********************************************************************//** @@ -917,34 +1050,19 @@ *************************************************************************/ S16 getH19EncoderPosition( void ) { - return fpgaSensorReadings.H19EncPosition; + return fpgaSensorReadings.h19EncPosition; } /*********************************************************************//** * @brief - * The getH19CmdPosition function returns the current amount of travel - * from the pre-command position in steps (or microsteps if microstepping is - * set in control register) for H19 valve. - * @note There are 200 steps per revolution - * @details \b Inputs: fpgaSensorReadings - * @details \b Outputs: none - * @return The commanded encoder position of H19 valve - *************************************************************************/ -S16 getH19CmdPosition( void ) -{ - return fpgaSensorReadings.H19CmdPosition; -} - -/*********************************************************************//** - * @brief * The getH19Status function reads the status of the venous pinch valve. - * @details \b Inputs: fpgaSensorReadings + * @details \b Inputs: fpgaSensorReadings.h19Status * @details \b Outputs: none * @return Latest status of the venous pinch valve *************************************************************************/ U16 getH19Status( void ) { - return fpgaSensorReadings.H19Status; + return fpgaSensorReadings.h19Status; } /*********************************************************************//** @@ -959,9 +1077,9 @@ * 5=1/2 step (modified) * 6=1/4 step * 7=1/8 step - * Direction: bit 3 - * 0=forward - * 1=reverse + * Encoder Reset: bit 3 + * 0=not reset + * 1=reset * Enable: bit 4 (active low) * 0=enabled * 1=disabled @@ -971,80 +1089,65 @@ * 0=sleep mode * Reserved: bit 7 * @details \b Inputs: none - * @details \b Outputs: fpgaActuatorSetPoints + * @details \b Outputs: fpgaActuatorSetPoints.h1Control * @param controlBits The control bits to apply to the arterial pinch valve. * @return none *************************************************************************/ void setH1Control( U08 controlBits ) { - fpgaActuatorSetPoints.H1Control = controlBits; + fpgaActuatorSetPoints.h1Control = controlBits; } /*********************************************************************//** * @brief * The getH1Control function gets the current control bits for the H1 valve. - * @details \b Inputs: fpgaActuatorSetPoints + * @details \b Inputs: fpgaActuatorSetPoints.h1Control * @details \b Outputs: none - * @return fpgaActuatorSetPoints.H1Control + * @return fpgaActuatorSetPoints.h1Control *************************************************************************/ U08 getH1Control( void ) { - return fpgaActuatorSetPoints.H1Control; + return fpgaActuatorSetPoints.h1Control; } /*********************************************************************//** * @brief * The setH1Position function sets the travel from current position for the * H1 valve in counts (or microcounts if microstepping is set in control register). * @details \b Inputs: none - * @details \b Outputs: fpgaActuatorSetPoints + * @details \b Outputs: fpgaActuatorSetPoints.h1Position * @param setPoint The target encoder position of the H1 valve in counts * @return none *************************************************************************/ -void setH1Position( U16 setPoint ) +void setH1Position( S16 setPoint ) { - fpgaActuatorSetPoints.H1Position = setPoint; + fpgaActuatorSetPoints.h1Position = setPoint; } /*********************************************************************//** * @brief * The getH1EncoderPosition function reads the current encoder position of the * H1 valve in counts. * @note There are 1024 encoder counts per revolution - * @details \b Inputs: fpgaSensorReadings + * @details \b Inputs: fpgaSensorReadings.h1EncPosition * @details \b Outputs: none * @return The latest encoder position of H1 valve *************************************************************************/ S16 getH1EncoderPosition( void ) { - return fpgaSensorReadings.H1EncPosition; + return fpgaSensorReadings.h1EncPosition; } /*********************************************************************//** * @brief - * The getH1CmdPosition function returns returns the current amount of travel - * from the pre-command position in steps (or microsteps if microstepping is - * set in control register) for H1 valve. - * @note There are 200 steps per revolution - * @details \b Inputs: fpgaSensorReadings - * @details \b Outputs: none - * @return The commanded encoder position of H1 valve - *************************************************************************/ -S16 getH1CmdPosition( void ) -{ - return fpgaSensorReadings.H1CmdPosition; -} - -/*********************************************************************//** - * @brief * The getH1Status function reads the status of the arterial pinch valve. - * @details \b Inputs: fpgaSensorReadings + * @details \b Inputs: fpgaSensorReadings.h1Status * @details \b Outputs: none * @return Latest status of the arterial pinch valve *************************************************************************/ U16 getH1Status( void ) { - return fpgaSensorReadings.H1Status; + return fpgaSensorReadings.h1Status; } /*********************************************************************//** @@ -1118,7 +1221,9 @@ { if ( TRUE == incTimeWindowedCount( TIME_WINDOWED_COUNT_FPGA_COMM_FAILURES ) ) { +#ifndef TEST_DEBUGGER SET_ALARM_WITH_2_U32_DATA( ALARM_ID_TD_FPGA_COMM_TIMEOUT, MAX_FPGA_COMM_FAILURES, (U32)fpgaSensorReadings.errorCountProcessor ) +#endif } } } @@ -1144,7 +1249,9 @@ { if ( TRUE == incTimeWindowedCount( TIME_WINDOWED_COUNT_FPGA_COMM_FAILURES ) ) { +#ifndef TEST_DEBUGGER SET_ALARM_WITH_2_U32_DATA( ALARM_ID_TD_FPGA_COMM_TIMEOUT, MAX_FPGA_COMM_FAILURES, (U32)fpgaSensorReadings.errorCountProcessor ) +#endif } } }