Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of nRF51822 by
app_error.h
00001 /* Copyright (c) 2013 Nordic Semiconductor. All Rights Reserved. 00002 * 00003 * The information contained herein is property of Nordic Semiconductor ASA. 00004 * Terms and conditions of usage are described in detail in NORDIC 00005 * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 00006 * 00007 * Licensees are granted free, non-transferable use of the information. NO 00008 * WARRANTY of ANY KIND is provided. This heading must NOT be removed from 00009 * the file. 00010 * 00011 */ 00012 00013 /** @file 00014 * 00015 * @defgroup app_error Common application error handler 00016 * @{ 00017 * @ingroup app_common 00018 * 00019 * @brief Common application error handler and macros for utilizing a common error handler. 00020 */ 00021 00022 #ifndef APP_ERROR_H__ 00023 #define APP_ERROR_H__ 00024 00025 #include <stdint.h> 00026 #include <stdbool.h> 00027 #include "nrf_error.h" 00028 00029 #ifdef __cplusplus 00030 extern "C" { 00031 #endif 00032 00033 /**@brief Function for error handling, which is called when an error has occurred. 00034 * 00035 * @param[in] error_code Error code supplied to the handler. 00036 * @param[in] line_num Line number where the handler is called. 00037 * @param[in] p_file_name Pointer to the file name. 00038 */ 00039 void app_error_handler(uint32_t error_code, uint32_t line_num, const uint8_t * p_file_name); 00040 00041 #ifdef __cplusplus 00042 } 00043 #endif 00044 00045 /**@brief Macro for calling error handler function. 00046 * 00047 * @param[in] ERR_CODE Error code supplied to the error handler. 00048 */ 00049 #ifdef DEBUG 00050 #define APP_ERROR_HANDLER(ERR_CODE) \ 00051 do \ 00052 { \ 00053 app_error_handler((ERR_CODE), __LINE__, (uint8_t*) __FILE__); \ 00054 } while (0) 00055 #else 00056 #define APP_ERROR_HANDLER(ERR_CODE) \ 00057 do \ 00058 { \ 00059 app_error_handler((ERR_CODE), 0, 0); \ 00060 } while (0) 00061 #endif 00062 /**@brief Macro for calling error handler function if supplied error code any other than NRF_SUCCESS. 00063 * 00064 * @param[in] ERR_CODE Error code supplied to the error handler. 00065 */ 00066 #define APP_ERROR_CHECK(ERR_CODE) \ 00067 do \ 00068 { \ 00069 const uint32_t LOCAL_ERR_CODE = (ERR_CODE); \ 00070 if (LOCAL_ERR_CODE != NRF_SUCCESS) \ 00071 { \ 00072 APP_ERROR_HANDLER(LOCAL_ERR_CODE); \ 00073 } \ 00074 } while (0) 00075 00076 /**@brief Macro for calling error handler function if supplied boolean value is false. 00077 * 00078 * @param[in] BOOLEAN_VALUE Boolean value to be evaluated. 00079 */ 00080 #define APP_ERROR_CHECK_BOOL(BOOLEAN_VALUE) \ 00081 do \ 00082 { \ 00083 const uint32_t LOCAL_BOOLEAN_VALUE = (BOOLEAN_VALUE); \ 00084 if (!LOCAL_BOOLEAN_VALUE) \ 00085 { \ 00086 APP_ERROR_HANDLER(0); \ 00087 } \ 00088 } while (0) 00089 00090 #endif // APP_ERROR_H__ 00091 00092 /** @} */
Generated on Tue Jul 12 2022 16:21:02 by
