Index: firmware/App/Drivers/BPDriver.c =================================================================== diff -u -ra3f8bc317c09b4641bb9f561a9b64a69993cd523 -re36419ec3d1b64f3831b631d57f30ce4018646c5 --- firmware/App/Drivers/BPDriver.c (.../BPDriver.c) (revision a3f8bc317c09b4641bb9f561a9b64a69993cd523) +++ firmware/App/Drivers/BPDriver.c (.../BPDriver.c) (revision e36419ec3d1b64f3831b631d57f30ce4018646c5) @@ -31,7 +31,7 @@ #define BP_MODULE_ERROR_MASK 0x40 ///< Blood pressure module error mask. #define BP_MODULE_BUSY_MASK 0x80 ///< Blood Pressure module busy mask #define BP_RESP_CODE_BPDATA 0x07 ///< Blood pressure response code indicating BP data is available. -#define BP_MODULE_BUSY_CLEAR 0 +#define BP_MODULE_BUSY_CLEAR 0 ///< Blood pressure module buy clear /// Blood pressure driver states. typedef enum @@ -51,6 +51,8 @@ static BOOL requestAdultBPMeasurement; ///< Request adult BP measurement static BOOL requestPedsBPMeasurement; ///< Request pediatric BP measurement static BOOL requestAbortBPMeasurement; ///< Request abort BP measurement +static BOOL bpCuffConnected; ///< Blood pressure cuff connection +static BOOL bpResultsAvailable; ///< Blood pressure results available // ********** private function prototypes ********** @@ -74,6 +76,8 @@ requestAdultBPMeasurement = FALSE; requestPedsBPMeasurement = FALSE; requestAbortBPMeasurement = FALSE; + bpCuffConnected = FALSE; + bpResultsAvailable = FALSE; bpResults.systolic = 0; bpResults.diastolic = 0; bpResults.heartRate = 0; @@ -97,11 +101,13 @@ * machine. * @details \b Alarm: ALARM_ID_TD_SOFTWARE_FAULT * @details \b Inputs: bpDriverState - * @details \b Outputs: bpDriverState, bpResults + * @details \b Outputs: bpDriverState * @return none ***************************************************************************/ void execBPDriver( void ) { + bpCuffConnected = ( getNIBPControlStatus() != 0 ); + switch ( bpDriverState ) { case BP_DRIVER_IDLE_STATE: @@ -141,21 +147,21 @@ requestAdultBPMeasurement = FALSE; bpMeasurementReady = FALSE; bpDriverError = FALSE; - setNIBPCommand( FPGA_NIBP_CMD_START_BP ); + setNIBPCommand( (U08)BP_CMD_START_BP ); nextState = BP_DRIVER_MEASURE_STATE; } else if ( TRUE == requestPedsBPMeasurement ) { requestPedsBPMeasurement = FALSE; bpMeasurementReady = FALSE; bpDriverError = FALSE; - setNIBPCommand( FPGA_NIBP_CMD_START_PEDS_BP ); + setNIBPCommand( (U08)BP_CMD_START_PEDS_BP ); nextState = BP_DRIVER_MEASURE_STATE; } else if ( TRUE == requestAbortBPMeasurement ) { requestAbortBPMeasurement = FALSE; - setNIBPCommand( FPGA_NIBP_CMD_ABORT_BP ); + setNIBPCommand( (U08)BP_CMD_ABORT_BP ); } return nextState; @@ -178,7 +184,7 @@ // Verify BP measurement data is available if ( BP_RESP_CODE_BPDATA == getBPResponseCode() ) { - setNIBPCommand( FPGA_NIBP_CMD_GET_BP_DATA ); + setNIBPCommand( (U08)BP_CMD_GET_BP_DATA ); nextState = BP_DRIVER_GET_DATA_STATE; } // Check whether BP module error occurred @@ -198,7 +204,7 @@ * The handleBPDriverGetDataState function retrieves blood pressure * measurement results. * @details \b Inputs: getNIBPStatusResponse -* @details \b Outputs: bpResults +* @details \b Outputs: bpMeasurementReady * @return next BP driver state ***************************************************************************/ static BP_DRIVER_STATE_T handleBPDriverGetDataState( void ) @@ -260,8 +266,8 @@ * @brief * The isBPMeasurementReady function returns the blood pressure * measurement ready status - * @details \b Inputs: bpMeasurementReady - * @details \b Outputs: none + * @details \b Inputs: none + * @details \b Outputs: bpMeasurementReady * @return TRUE if measurement ready, FALSE otherwise. ***************************************************************************/ BOOL isBPMeasurementReady( void ) @@ -273,8 +279,8 @@ * @brief * The hasBPDriverError function returns the blood pressure driver * error status. - * @details \b Inputs: bpDriverError - * @details \b Outputs: none + * @details \b Inputs: none + * @details \b Outputs: bpDriverError * @return TRUE if module error exists, FALSE otherwise. ***************************************************************************/ BOOL hasBPDriverError( void ) @@ -284,6 +290,19 @@ /*********************************************************************//** * @brief + * The hasBPDriverError function returns the blood pressure driver + * error status. + * @details \b Inputs: none + * @details \b Outputs: bpCuffConnected + * @return TRUE if module error exists, FALSE otherwise. + ***************************************************************************/ +BOOL isBPCuffConnected( void ) +{ + return bpCuffConnected; +} + +/*********************************************************************//** + * @brief * The getBPResults function returns the latest BP measurement results. * @note * This function shall only be called from the GeneralTask context to