Index: firmware/App/Services/FPGA.c =================================================================== diff -u -rcc4f8440e8ad7fa8f2ced2467d922be7422c344c -r208ceefa8e8b1cc30feb93be771ced6d313e6995 --- firmware/App/Services/FPGA.c (.../FPGA.c) (revision cc4f8440e8ad7fa8f2ced2467d922be7422c344c) +++ firmware/App/Services/FPGA.c (.../FPGA.c) (revision 208ceefa8e8b1cc30feb93be771ced6d313e6995) @@ -7,8 +7,8 @@ * * @file FPGA.c * -* @author (last) Dara Navaei -* @date (last) 14-Feb-2022 +* @author (last) Darren Cox +* @date (last) 10-Mar-2022 * * @author (original) Dara Navaei * @date (original) 05-Nov-2019 @@ -80,8 +80,8 @@ #define MAX_COMM_ERROR_RETRIES 5 ///< Maximum consecutive FPGA communication error retries. -#define FPGA_INPUT_VOLTAGE_SCALE 3.0 ///< FPGA source and aux voltage. -#define FPGA_PVN_VOLTAGE_SCALE 1.0 ///< FPGA pvn voltage. +#define FPGA_INPUT_VOLTAGE_SCALE 3.0F ///< FPGA source and aux voltage. +#define FPGA_PVN_VOLTAGE_SCALE 1.0F ///< FPGA pvn voltage. #define FPGA_ADC1_AUTO_READ_ENABLE 0x01 ///< Auto-read enable bit for ADC1 control register. @@ -100,14 +100,14 @@ #define FPGA_ADA_BUBBLE_SELF_TEST_CMD 0x04 ///< Bit for arterial air bubble detector self-test command. #define FPGA_ADV_BUBBLE_SELF_TEST_CMD 0x08 ///< Bit for venous air bubble detector self-test command. -#define FPGA_PBO_TEMP_DIVISOR 2047.0 ///< Used in conversion of PBo temperature reading to deg C. -#define FPGA_PBO_TEMP_GAIN 200.0 ///< Used in conversion of PBo temperature reading to deg C. -#define FPGA_PBO_TEMP_OFFSET 50.0 ///< Used in conversion of PBo temperature reading to deg C. +#define FPGA_PBO_TEMP_DIVISOR 2047.0F ///< Used in conversion of PBo temperature reading to deg C. +#define FPGA_PBO_TEMP_GAIN 200.0F ///< Used in conversion of PBo temperature reading to deg C. +#define FPGA_PBO_TEMP_OFFSET 50.0F ///< Used in conversion of PBo temperature reading to deg C. #define FPGA_ALARM_AUDIO_VOLUME_SHIFT 3 ///< Shift alarm audio volume 3 bits to left before writing to register. #define FPGA_ALARM_AUDIO_DIVIDE_SHIFT 6 ///< Shift alarm audio volume divider 6 bits to left before writing to register. -#define FPGA_BACKUP_ALARM_AUDIO_CONVERT 0.4 ///< Converts backup (piezo) alarm audio ADC volts to amps. +#define FPGA_BACKUP_ALARM_AUDIO_CONVERT 0.4F ///< Converts backup (piezo) alarm audio ADC volts to amps. #define FRONT_DOOR_SWITCH_MASK 0x0010 ///< Front door switch bit mask. Bit 4 of the GPIO register. #define PUMP_TRACK_SWITCH_MASK 0x0020 ///< Pump track switch bit mask. Bit 5 of the GPIO register. @@ -229,15 +229,19 @@ U08 BLeakCounter; ///< Reg 427. Blood leak counter. U08 PBoErrorCount; ///< Reg 428. PBo error count. U08 bloodLeakZeroedStatus; ///< Reg 429. Blood leak and sensor zeored status. - U16 bloodDetectSetPoint; ///< Reg 430. Blood leak stored set point value. - U16 bloodDetectLevel; ///< Reg 432. Blood leak detection stored level value. - U16 bloodStCount; ///< Reg 434. Blood leak St Count. - U16 bloodLEDIntensity; ///< Reg 436. Blood leak LED intensity. - U16 bloodRdCounter; ///< Reg 438. Blood leak register counter. + U16 bloodLeakDetectSetPoint; ///< Reg 430. Blood leak stored set point value. + U16 bloodLeakDetectLevel; ///< Reg 432. Blood leak detection stored level value. + U16 bloodLeakStCount; ///< Reg 434. Blood leak St Count. + U16 bloodLeakLEDIntensity; ///< Reg 436. Blood leak LED intensity. + U16 bloodLeakRdCounter; ///< Reg 438. Blood leak register counter. U16 arterialPressure; ///< Reg 440. Arterial pressure sensor. U16 arterialPressureTemperature; ///< Reg 442. Arterial pressure sensor temperature. U08 arterialPressureReadCount; ///< Reg 444. Arterial pressure sensor read count. U08 arterialPressureErrorCount; ///< Reg 445. Arterial pressure sensor error count. + U08 bloodLeakTxFIFOCount; ///< Reg 446. Blood leak transmit FIFO count. + U08 bloodLeakRxFIFOCount; ///< Reg 447. Blood leak receive FIFO count. + U08 bloodLeakRxErrorCount; ///< Reg 448. Blood leak receive error count. + U08 bloodLeakRxFIFODataOut; ///< Reg 449. Blood leak receive FIFO data out. } FPGA_SENSORS_T; /// Record structure for FPGA continuous priority writes. @@ -1925,21 +1929,6 @@ /*********************************************************************//** * @brief - * The getDoorState function gets the current state of door switch. - * @details Inputs: none - * @details Outputs: none - * @return current door state - *************************************************************************/ -OPN_CLS_STATE_T getFPGADoorState( void ) -{ - // TODO: Get actual door state from FPGA or GPIO - BOOL const status = 0x0; - - return ( 0 == status ? STATE_CLOSED : STATE_OPEN ); -} - -/*********************************************************************//** - * @brief * The setFPGAValvesControlMode function sets the valves control mode. * @details Inputs: fpgaActuatorSetPoints * @details Outputs: fpgaActuatorSetPoints @@ -2133,7 +2122,7 @@ *************************************************************************/ U16 getFPGABloodLeakDetectSetPoint( void ) { - return fpgaSensorReadings.bloodDetectSetPoint; + return fpgaSensorReadings.bloodLeakDetectSetPoint; } /*********************************************************************//** @@ -2145,7 +2134,7 @@ *************************************************************************/ U16 getFPGABloodLeakDetectLevel( void ) { - return fpgaSensorReadings.bloodDetectLevel; + return fpgaSensorReadings.bloodLeakDetectLevel; } /*********************************************************************//** @@ -2157,7 +2146,7 @@ *************************************************************************/ U16 getFPGABloodLeakStCount( void ) { - return fpgaSensorReadings.bloodStCount; + return fpgaSensorReadings.bloodLeakStCount; } /*********************************************************************//** @@ -2169,7 +2158,7 @@ *************************************************************************/ U16 getFPGABloodLeakLEDIntensity( void ) { - return fpgaSensorReadings.bloodLEDIntensity; + return fpgaSensorReadings.bloodLeakLEDIntensity; } /*********************************************************************//** @@ -2182,11 +2171,63 @@ *************************************************************************/ U16 getFPGABloodLeakRegisterCounter( void ) { - return fpgaSensorReadings.bloodRdCounter; + return fpgaSensorReadings.bloodLeakRdCounter; } /*********************************************************************//** * @brief + * The getFPGABloodLeakTxFIFOCount function returns the blood leak transmit + * FIFO count. + * @details Inputs: none + * @details Outputs: none + * @return fpgaSensorReadings.bloodLeakTxFIFOCount + *************************************************************************/ +U08 getFPGABloodLeakTxFIFOCount( void ) +{ + return fpgaSensorReadings.bloodLeakTxFIFOCount; +} + +/*********************************************************************//** + * @brief + * The getFPGABloodLeakRxFIFOCount function returns the blood leak receive + * FIFO count. + * @details Inputs: none + * @details Outputs: none + * @return fpgaSensorReadings.bloodLeakRxFIFOCount + *************************************************************************/ +U08 getFPGABloodLeakRxFIFOCount( void ) +{ + return fpgaSensorReadings.bloodLeakRxFIFOCount; +} + +/*********************************************************************//** + * @brief + * The getFPGABloodLeakRxErrorCount function returns the blood leak receive + * error count. + * @details Inputs: none + * @details Outputs: none + * @return fpgaSensorReadings.bloodLeakRxErrorCount + *************************************************************************/ +U08 getFPGABloodLeakRxErrorCount( void ) +{ + return fpgaSensorReadings.bloodLeakRxErrorCount; +} + +/*********************************************************************//** + * @brief + * The getFPGABloodLeakRxFIFODataOut function returns the blood leak receive + * FIFO data out. + * @details Inputs: none + * @details Outputs: none + * @return fpgaSensorReadings.bloodLeakRxFIFODataOut + *************************************************************************/ +U08 getFPGABloodLeakRxFIFODataOut( void ) +{ + return fpgaSensorReadings.bloodLeakRxFIFODataOut; +} + +/*********************************************************************//** + * @brief * The noFPGABubbleDetected function returns TRUE if no air bubble has been * detected and FALSE if an air bubble has been detected. * @details Inputs: fpgaSensorReadings