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 BLE_WallbotBLE_Challenge 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 #define APP_ERROR_HANDLER(ERR_CODE) \ 00050 do \ 00051 { \ 00052 app_error_handler((ERR_CODE), __LINE__, (uint8_t*) __FILE__); \ 00053 } while (0) 00054 00055 /**@brief Macro for calling error handler function if supplied error code any other than NRF_SUCCESS. 00056 * 00057 * @param[in] ERR_CODE Error code supplied to the error handler. 00058 */ 00059 #define APP_ERROR_CHECK(ERR_CODE) \ 00060 do \ 00061 { \ 00062 const uint32_t LOCAL_ERR_CODE = (ERR_CODE); \ 00063 if (LOCAL_ERR_CODE != NRF_SUCCESS) \ 00064 { \ 00065 APP_ERROR_HANDLER(LOCAL_ERR_CODE); \ 00066 } \ 00067 } while (0) 00068 00069 /**@brief Macro for calling error handler function if supplied boolean value is false. 00070 * 00071 * @param[in] BOOLEAN_VALUE Boolean value to be evaluated. 00072 */ 00073 #define APP_ERROR_CHECK_BOOL(BOOLEAN_VALUE) \ 00074 do \ 00075 { \ 00076 const bool LOCAL_BOOLEAN_VALUE = (BOOLEAN_VALUE); \ 00077 if (!LOCAL_BOOLEAN_VALUE) \ 00078 { \ 00079 APP_ERROR_HANDLER(0); \ 00080 } \ 00081 } while (0) 00082 00083 #endif // APP_ERROR_H__ 00084 00085 /** @} */
Generated on Tue Jul 12 2022 13:52:30 by
