9#include "system/pins.h"
28 int16_t threshold, int16_t hysLimit,
29 uint16_t thresholdCnt, uint32_t hysCnt)
56 int16_t thresholdMin, int16_t hysLimitMin,
57 int16_t thresholdMax, int16_t hysLimitMax,
58 uint16_t thresholdCnt, uint32_t hysCnt)
137 if (callback != NULL)
187 if ((faultSource <= faultInput->Val1_Threshold) && (faultInput->
FaultActive ==
false))
194 if (callback != NULL)
238 if ((faultBit) && (faultInput->
FaultActive ==
false))
246 if (callback != NULL)
255 else if ((!faultBit) && (faultInput->
FaultActive ==
true))
291 if ((inputValue <= faultInput->Val1_Threshold) ||
298 if (callback != NULL)
314 (inputValue < faultInput->Val2_Hysteresis))
Contains fault generic public functions.
void(* FAULT_CALLBACK)(void)
bool FAULT_CheckMax(FAULT_OBJ_T *faultInput, int16_t faultSource, FAULT_CALLBACK callback)
This function compares the fault source value with the threshold limits and sets (or) resets the faul...
bool FAULT_CheckRange(FAULT_OBJ_T *faultInput, int16_t inputValue, FAULT_CALLBACK callback)
bool FAULT_CheckBit(FAULT_OBJ_T *faultInput, bool faultBit, FAULT_CALLBACK callback)
void FAULT_InitRange(FAULT_OBJ_T *faultInput, int16_t thresholdMin, int16_t hysLimitMin, int16_t thresholdMax, int16_t hysLimitMax, uint16_t thresholdCnt, uint32_t hysCnt)
This function initializes the fault object data structure with the values that required to detect a f...
void FAULT_SetCounters(FAULT_OBJ_T *faultInput, uint16_t fltThresholdCnt, uint32_t fltHysCnt)
This function initializes/sets the fault structure with the counter limits.
void FAULT_SetThresholds(FAULT_OBJ_T *faultInput, int16_t fltThreshold, int16_t fltHysLimit)
This function initializes/sets the fault structure with the threshold limits.
bool FAULT_CheckMin(FAULT_OBJ_T *faultInput, int16_t faultSource, FAULT_CALLBACK callback)
This function compares the fault source value with the threshold limits and sets (or) resets the faul...
void FAULT_Init(FAULT_OBJ_T *faultInput, int16_t threshold, int16_t hysLimit, uint16_t thresholdCnt, uint32_t hysCnt)
This function initializes the fault object data structure with the values that required to detect a f...
The Fault object data structure contains a list of elements/variables that are used to detect/check a...
uint16_t FaultCounter
Internal counter for activating/removing fault.
uint8_t FaultActive
Set/Cleared inside flt check loop
int16_t Val1_Hysteresis
Fault hysteresis limit. If hysteresis is not needed, fltThreshold = fltHysLimit.
uint8_t FaultLatch
Flag indicating if FAULT has been tripped.
uint16_t FaultCode
Code that can be used to display fault (1st fault occurred) to global variable.
int16_t Val1_Threshold
Fault threshold limit: Range of -32768 to 32767.
int16_t Val2_Hysteresis
Fault hysteresis limit. If hysteresis is not needed, fltThreshold = fltHysLimit.
uint32_t CounterReset
Number of consecutive events when input outside hysteresis limit in order to remove fault,...
uint16_t CounterSet
Number of consecutive fault events before fault becomes active.
int16_t Val2_Threshold
Fault threshold limit: Range of -32768 to 32767.