]>
git.gir.st - tmk_keyboard.git/blob - tool/mbed/mbed-sdk/libraries/mbed/targets/hal/TARGET_NORDIC/TARGET_MCU_NRF51822/Lib/nordic_sdk/components/libraries/util/app_error.h
1 /* Copyright (c) 2013 Nordic Semiconductor. All Rights Reserved.
3 * The information contained herein is property of Nordic Semiconductor ASA.
4 * Terms and conditions of usage are described in detail in NORDIC
5 * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
7 * Licensees are granted free, non-transferable use of the information. NO
8 * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
15 * @defgroup app_error Common application error handler
19 * @brief Common application error handler and macros for utilizing a common error handler.
27 #include "nrf_error.h"
33 /**@brief Function for error handling, which is called when an error has occurred.
35 * @param[in] error_code Error code supplied to the handler.
36 * @param[in] line_num Line number where the handler is called.
37 * @param[in] p_file_name Pointer to the file name.
39 void app_error_handler(uint32_t error_code
, uint32_t line_num
, const uint8_t * p_file_name
);
45 /**@brief Macro for calling error handler function.
47 * @param[in] ERR_CODE Error code supplied to the error handler.
50 #define APP_ERROR_HANDLER(ERR_CODE) \
53 app_error_handler((ERR_CODE), __LINE__, (uint8_t*) __FILE__); \
56 #define APP_ERROR_HANDLER(ERR_CODE) \
59 app_error_handler((ERR_CODE), 0, 0); \
62 /**@brief Macro for calling error handler function if supplied error code any other than NRF_SUCCESS.
64 * @param[in] ERR_CODE Error code supplied to the error handler.
66 #define APP_ERROR_CHECK(ERR_CODE) \
69 const uint32_t LOCAL_ERR_CODE = (ERR_CODE); \
70 if (LOCAL_ERR_CODE != NRF_SUCCESS) \
72 APP_ERROR_HANDLER(LOCAL_ERR_CODE); \
76 /**@brief Macro for calling error handler function if supplied boolean value is false.
78 * @param[in] BOOLEAN_VALUE Boolean value to be evaluated.
80 #define APP_ERROR_CHECK_BOOL(BOOLEAN_VALUE) \
83 const uint32_t LOCAL_BOOLEAN_VALUE = (BOOLEAN_VALUE); \
84 if (!LOCAL_BOOLEAN_VALUE) \
86 APP_ERROR_HANDLER(0); \
90 #endif // APP_ERROR_H__