36 #include <oc_errors.h> 41 #include <oc_system_cfg.h> 59 const char * Function;
61 const char * Description;
62 oC_ErrorCode_t ErrorCode;
71 #define _ADD_ERROR_TO_STRING_LIST( CODE_NAME , CODE_STR ) CODE_STR , 84 oC_ERRORS_LIST(_ADD_ERROR_TO_STRING_LIST)
88 static SavedError_t SavedErrors[CFG_UINT8_MAXIMUM_NUMBER_OF_SAVED_ERRORS];
89 static uint8_t FreeIndex = 0;
90 static bool Locked =
false;
117 const char *
string =
NULL;
118 if ( ErrorCode < oC_ErrorCode_NumberOfErrorsDefinitions )
139 bool oC_SaveErrorFunction(
const char * Description , oC_ErrorCode_t ErrorCode ,
const char * Function, uint32_t LineNumber )
141 bool success =
false;
143 if(Locked ==
false && FreeIndex < CFG_UINT8_MAXIMUM_NUMBER_OF_SAVED_ERRORS)
145 SavedErrors[FreeIndex].Description = Description;
146 SavedErrors[FreeIndex].ErrorCode = ErrorCode;
147 SavedErrors[FreeIndex].Function = Function;
148 SavedErrors[FreeIndex].LineNumber = LineNumber;
162 bool oC_ReadLastError(
const char ** outDescription , oC_ErrorCode_t * outErrorCode ,
const char ** outFunction , uint32_t * outLineNumber )
169 *outDescription = SavedErrors[FreeIndex].Description;
170 *outErrorCode = SavedErrors[FreeIndex].ErrorCode;
171 *outFunction = SavedErrors[FreeIndex].Function;
172 *outLineNumber = SavedErrors[FreeIndex].LineNumber;
void oC_SetLockSavingErrors(bool Lock)
locks or unlocks saving errors
static const char * oC_ErrorsStrings[]
The file with interface for the GPIO driver.
Static array definitions.
Definition of the null pointer.
bool oC_SaveErrorFunction(const char *Description, oC_ErrorCode_t ErrorCode, const char *Function, uint32_t LineNumber)
save error code with description for later
const char * oC_GetErrorString(oC_ErrorCode_t ErrorCode)
bool oC_ReadLastError(const char **outDescription, oC_ErrorCode_t *outErrorCode, const char **outFunction, uint32_t *outLineNumber)
reads error code with description from the errors stack
#define NULL
pointer to a zero