Index: PersistentAlarm.c =================================================================== diff -u -r75e6d3ffab11ae6ff0521efb9c16d5698402a669 -r7e186bb97310fb59f525e5399ec7a74711bea571 --- PersistentAlarm.c (.../PersistentAlarm.c) (revision 75e6d3ffab11ae6ff0521efb9c16d5698402a669) +++ PersistentAlarm.c (.../PersistentAlarm.c) (revision 7e186bb97310fb59f525e5399ec7a74711bea571) @@ -207,6 +207,36 @@ /*********************************************************************//** * @brief + * The checkPersistentAlarm function triggers/clears an alarm if an alarm condition + * has persisted/cleared over given time limit. + * @details Inputs: none + * @details Outputs: checks whether an alarm is triggered or an alarm condition is cleared + * @param alarmID ID of alarm to check + * @param isErrorOccured Flag indicates alarm condition is active or not + * @param data alarm data + * @param limit alarm condition limit + * @return TRUE if given alarm is active, FALSE if not + *************************************************************************/ +BOOL checkPersistentAlarm( ALARM_ID_T alarm, BOOL isErrorOccured, F32 data, F32 limit ) +{ + BOOL status = FALSE; + + if ( TRUE == isPersistentAlarmTriggered( alarm, isErrorOccured ) ) + { + SET_ALARM_WITH_2_F32_DATA( alarm, data, limit ); + } + + if ( TRUE == isPersistentAlarmConditionCleared( alarm, isErrorOccured ) ) + { + clearAlarmCondition( alarm ); + status = TRUE; + } + + return status; +} + +/*********************************************************************//** + * @brief * The resetPersistentAlarmTimer function resets the start time for error * condition clear start time and error start time. * @details Inputs: none