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 "nordic_global.h" 00028 #include "nrf_error.h" 00029 00030 /**@brief Function for error handling, which is called when an error has occurred. 00031 * 00032 * @param[in] error_code Error code supplied to the handler. 00033 * @param[in] line_num Line number where the handler is called. 00034 * @param[in] p_file_name Pointer to the file name. 00035 */ 00036 void app_error_handler(uint32_t error_code, uint32_t line_num, const uint8_t * p_file_name); 00037 00038 /**@brief Macro for calling error handler function. 00039 * 00040 * @param[in] ERR_CODE Error code supplied to the error handler. 00041 */ 00042 #define APP_ERROR_HANDLER(ERR_CODE) \ 00043 do \ 00044 { \ 00045 app_error_handler((ERR_CODE), __LINE__, (uint8_t*) __FILE__); \ 00046 } while (0) 00047 00048 /**@brief Macro for calling error handler function if supplied error code any other than NRF_SUCCESS. 00049 * 00050 * @param[in] ERR_CODE Error code supplied to the error handler. 00051 */ 00052 #define APP_ERROR_CHECK(ERR_CODE) \ 00053 do \ 00054 { \ 00055 const uint32_t LOCAL_ERR_CODE = (ERR_CODE); \ 00056 if (LOCAL_ERR_CODE != NRF_SUCCESS) \ 00057 { \ 00058 APP_ERROR_HANDLER(LOCAL_ERR_CODE); \ 00059 } \ 00060 } while (0) 00061 00062 /**@brief Macro for calling error handler function if supplied boolean value is false. 00063 * 00064 * @param[in] BOOLEAN_VALUE Boolean value to be evaluated. 00065 */ 00066 #define APP_ERROR_CHECK_BOOL(BOOLEAN_VALUE) \ 00067 do \ 00068 { \ 00069 const bool LOCAL_BOOLEAN_VALUE = (BOOLEAN_VALUE); \ 00070 if (!LOCAL_BOOLEAN_VALUE) \ 00071 { \ 00072 APP_ERROR_HANDLER(0); \ 00073 } \ 00074 } while (0) 00075 00076 #endif // APP_ERROR_H__ 00077 00078 /** @} */
Generated on Tue Jul 12 2022 19:00:51 by
