Index: firmware/App/Services/FPGA.c =================================================================== diff -u -rf908e396e3ea2a08378d77089e6d6b8dd8da3cdc -r1c04924590760ca29e1c9fe19bca65ec5ce428fe --- firmware/App/Services/FPGA.c (.../FPGA.c) (revision f908e396e3ea2a08378d77089e6d6b8dd8da3cdc) +++ firmware/App/Services/FPGA.c (.../FPGA.c) (revision 1c04924590760ca29e1c9fe19bca65ec5ce428fe) @@ -8,7 +8,7 @@ * @file FPGA.c * * @author (last) Dara Navaei -* @date (last) 16-Jun-2022 +* @date (last) 20-Jun-2022 * * @author (original) Dara Navaei * @date (original) 05-Nov-2019 @@ -91,7 +91,9 @@ #define FPGA_FLUID_LEAK_STATE_MASK 0x0040 ///< Bit mask for fluid leak detector. #define FPGA_BLOOD_LEAK_STATUS_MASK 0x1000 ///< Bit mask for blood leak detector. +#define FPGA_BLOOD_LEAK_ST_BIT_INDEX 12 ///< Bit index for the blood leak self test status bit. #define FPGA_BLOOD_LEAK_ZERO_STATE_MASK 0x2000 ///< Bit mask for blood leak detector zero. +#define FPAG_BLOOD_LEAK_ZERO_BIT_INDEX 13 ///< Bit index for the blood leak zero status bit. #define FPGA_BLOOD_LEAK_ZERO_CMD 0x02 ///< Bit for blood leak detector zero command. #define FPGA_BLOOD_LEAK_SELF_TEST_CMD 0x01 ///< Bit for blood leak detector self test command. @@ -1982,21 +1984,6 @@ /*********************************************************************//** * @brief - * The FPGABloodLeakZeroDetected function returns TRUE if blood leak zeroing has - * been detected and FALSE if no blood leak zeroing has been detected. - * @details Inputs: fpgaSensorReadings - * @details Outputs: none - * @return FPGABloodLeakZeroDetected - *************************************************************************/ -BOOL FPGABloodLeakZeroDetected( void ) -{ - U16 FPGABloodLeakZeroDetected = fpgaSensorReadings.fpgaGPIO & FPGA_BLOOD_LEAK_ZERO_STATE_MASK; - - return ( 0 == FPGABloodLeakZeroDetected ? FALSE : TRUE ); -} - -/*********************************************************************//** - * @brief * The setFPGABloodLeakZero function sets the Blood Leak detector into * zeroing mode via the FPGA. * @details Inputs: none @@ -2049,6 +2036,34 @@ /*********************************************************************//** * @brief + * The getFPGABloodLeakZeroStatus function returns the blood leak sensor's + * zero status bit. + * @details Inputs: fpgaSensorReadings + * @details Outputs: none + * @return blood leak sensor zero status bit + *************************************************************************/ +U08 getFPGABloodLeakZeroStatus( void ) +{ + U08 zeroStatus = (U08)( ( fpgaSensorReadings.fpgaGPIO & FPGA_BLOOD_LEAK_ZERO_STATE_MASK ) >> FPAG_BLOOD_LEAK_ZERO_BIT_INDEX ); + return zeroStatus; +} + +/*********************************************************************//** + * @brief + * The getFPGABloodLeakStatus function returns the blood leak sensor's + * blood detection status bit. + * @details Inputs: fpgaSensorReadings + * @details Outputs: none + * @return blood leak sensor self test status bit + *************************************************************************/ +U08 getFPGABloodLeakStatus( void ) +{ + U08 selfTestStatus = (U08)( ( fpgaSensorReadings.fpgaGPIO & FPGA_BLOOD_LEAK_STATUS_MASK ) >> FPGA_BLOOD_LEAK_ST_BIT_INDEX ); + return selfTestStatus; +} + +/*********************************************************************//** + * @brief * The setFPGABloodLeakUARTControl function sets the blood leak sensor UART * control value. * @details Inputs: fpgaSensorReadings @@ -2193,7 +2208,7 @@ * @details Outputs: none * @return fpgaSensorReadings.bloodLeakRxFIFOCount *************************************************************************/ -U08 getFPGABloodLeakRxFIFOCount( void ) +U16 getFPGABloodLeakRxFIFOCount( void ) { return fpgaSensorReadings.bloodLeakRxFIFOCount; } @@ -2226,6 +2241,32 @@ /*********************************************************************//** * @brief + * The getFPGABloodLeakSelfTestErrorCounter function returns the blood leak + * self test error counter. + * @details Inputs: none + * @details Outputs: none + * @return fpgaSensorReadings.bloodLeakSelfTestErrorCounter + *************************************************************************/ +U08 getFPGABloodLeakSelfTestErrorCounter( void ) +{ + return fpgaSensorReadings.bloodLeakSelfTestErrorCounter; +} + +/*********************************************************************//** + * @brief + * The getFPGABloodLeakZeroErrorCounter function returns the blood leak + * zero error counter. + * @details Inputs: none + * @details Outputs: none + * @return fpgaSensorReadings.bloodLeakZeroErrorCounter + *************************************************************************/ +U08 getFPGABloodLeakZeroErrorCounter( void ) +{ + return fpgaSensorReadings.bloodLeakZeroErrorCounter; +} + +/*********************************************************************//** + * @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