The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.
Dependents: hello SerialTestv11 SerialTestv12 Sierpinski ... more
mbed 2
This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.
TARGET_NRF51822/TARGET_NORDIC/TARGET_MCU_NRF51822/Lib/nordic_sdk/components/libraries/util/app_error.h@98:8ab26030e058, 2015-04-29 (annotated)
- Committer:
- Kojto
- Date:
- Wed Apr 29 10:16:23 2015 +0100
- Revision:
- 98:8ab26030e058
- Parent:
- 97:433970e64889
Release 98 of the mbed library
Changes:
- Silabs new targets (Giant, Zero, Happy, Leopard, Wonder Geckos)
- Asynchronous SPI, I2C, Serial
- LowPower classes
- Nordic - nordic SDK v8.0 update
- Teensy - gcc arm fix for startup
- Nucleo F411 - usb freq fix
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Kojto | 97:433970e64889 | 1 | /* Copyright (c) 2013 Nordic Semiconductor. All Rights Reserved. |
Kojto | 97:433970e64889 | 2 | * |
Kojto | 97:433970e64889 | 3 | * The information contained herein is property of Nordic Semiconductor ASA. |
Kojto | 97:433970e64889 | 4 | * Terms and conditions of usage are described in detail in NORDIC |
Kojto | 97:433970e64889 | 5 | * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. |
Kojto | 97:433970e64889 | 6 | * |
Kojto | 97:433970e64889 | 7 | * Licensees are granted free, non-transferable use of the information. NO |
Kojto | 97:433970e64889 | 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from |
Kojto | 97:433970e64889 | 9 | * the file. |
Kojto | 97:433970e64889 | 10 | * |
Kojto | 97:433970e64889 | 11 | */ |
Kojto | 97:433970e64889 | 12 | |
Kojto | 97:433970e64889 | 13 | /** @file |
Kojto | 97:433970e64889 | 14 | * |
Kojto | 97:433970e64889 | 15 | * @defgroup app_error Common application error handler |
Kojto | 97:433970e64889 | 16 | * @{ |
Kojto | 97:433970e64889 | 17 | * @ingroup app_common |
Kojto | 97:433970e64889 | 18 | * |
Kojto | 97:433970e64889 | 19 | * @brief Common application error handler and macros for utilizing a common error handler. |
Kojto | 97:433970e64889 | 20 | */ |
Kojto | 97:433970e64889 | 21 | |
Kojto | 97:433970e64889 | 22 | #ifndef APP_ERROR_H__ |
Kojto | 97:433970e64889 | 23 | #define APP_ERROR_H__ |
Kojto | 97:433970e64889 | 24 | |
Kojto | 97:433970e64889 | 25 | #include <stdint.h> |
Kojto | 97:433970e64889 | 26 | #include <stdbool.h> |
Kojto | 97:433970e64889 | 27 | #include "nrf_error.h" |
Kojto | 97:433970e64889 | 28 | |
Kojto | 98:8ab26030e058 | 29 | #ifdef __cplusplus |
Kojto | 98:8ab26030e058 | 30 | extern "C" { |
Kojto | 98:8ab26030e058 | 31 | #endif |
Kojto | 98:8ab26030e058 | 32 | |
Kojto | 97:433970e64889 | 33 | /**@brief Function for error handling, which is called when an error has occurred. |
Kojto | 97:433970e64889 | 34 | * |
Kojto | 97:433970e64889 | 35 | * @param[in] error_code Error code supplied to the handler. |
Kojto | 97:433970e64889 | 36 | * @param[in] line_num Line number where the handler is called. |
Kojto | 97:433970e64889 | 37 | * @param[in] p_file_name Pointer to the file name. |
Kojto | 97:433970e64889 | 38 | */ |
Kojto | 97:433970e64889 | 39 | void app_error_handler(uint32_t error_code, uint32_t line_num, const uint8_t * p_file_name); |
Kojto | 97:433970e64889 | 40 | |
Kojto | 98:8ab26030e058 | 41 | #ifdef __cplusplus |
Kojto | 98:8ab26030e058 | 42 | } |
Kojto | 98:8ab26030e058 | 43 | #endif |
Kojto | 98:8ab26030e058 | 44 | |
Kojto | 97:433970e64889 | 45 | /**@brief Macro for calling error handler function. |
Kojto | 97:433970e64889 | 46 | * |
Kojto | 97:433970e64889 | 47 | * @param[in] ERR_CODE Error code supplied to the error handler. |
Kojto | 97:433970e64889 | 48 | */ |
Kojto | 97:433970e64889 | 49 | #ifdef DEBUG |
Kojto | 97:433970e64889 | 50 | #define APP_ERROR_HANDLER(ERR_CODE) \ |
Kojto | 97:433970e64889 | 51 | do \ |
Kojto | 97:433970e64889 | 52 | { \ |
Kojto | 97:433970e64889 | 53 | app_error_handler((ERR_CODE), __LINE__, (uint8_t*) __FILE__); \ |
Kojto | 97:433970e64889 | 54 | } while (0) |
Kojto | 97:433970e64889 | 55 | #else |
Kojto | 97:433970e64889 | 56 | #define APP_ERROR_HANDLER(ERR_CODE) \ |
Kojto | 97:433970e64889 | 57 | do \ |
Kojto | 97:433970e64889 | 58 | { \ |
Kojto | 97:433970e64889 | 59 | app_error_handler((ERR_CODE), 0, 0); \ |
Kojto | 97:433970e64889 | 60 | } while (0) |
Kojto | 97:433970e64889 | 61 | #endif |
Kojto | 97:433970e64889 | 62 | /**@brief Macro for calling error handler function if supplied error code any other than NRF_SUCCESS. |
Kojto | 97:433970e64889 | 63 | * |
Kojto | 97:433970e64889 | 64 | * @param[in] ERR_CODE Error code supplied to the error handler. |
Kojto | 97:433970e64889 | 65 | */ |
Kojto | 97:433970e64889 | 66 | #define APP_ERROR_CHECK(ERR_CODE) \ |
Kojto | 97:433970e64889 | 67 | do \ |
Kojto | 97:433970e64889 | 68 | { \ |
Kojto | 97:433970e64889 | 69 | const uint32_t LOCAL_ERR_CODE = (ERR_CODE); \ |
Kojto | 97:433970e64889 | 70 | if (LOCAL_ERR_CODE != NRF_SUCCESS) \ |
Kojto | 97:433970e64889 | 71 | { \ |
Kojto | 97:433970e64889 | 72 | APP_ERROR_HANDLER(LOCAL_ERR_CODE); \ |
Kojto | 97:433970e64889 | 73 | } \ |
Kojto | 97:433970e64889 | 74 | } while (0) |
Kojto | 97:433970e64889 | 75 | |
Kojto | 97:433970e64889 | 76 | /**@brief Macro for calling error handler function if supplied boolean value is false. |
Kojto | 97:433970e64889 | 77 | * |
Kojto | 97:433970e64889 | 78 | * @param[in] BOOLEAN_VALUE Boolean value to be evaluated. |
Kojto | 97:433970e64889 | 79 | */ |
Kojto | 97:433970e64889 | 80 | #define APP_ERROR_CHECK_BOOL(BOOLEAN_VALUE) \ |
Kojto | 97:433970e64889 | 81 | do \ |
Kojto | 97:433970e64889 | 82 | { \ |
Kojto | 97:433970e64889 | 83 | const uint32_t LOCAL_BOOLEAN_VALUE = (BOOLEAN_VALUE); \ |
Kojto | 97:433970e64889 | 84 | if (!LOCAL_BOOLEAN_VALUE) \ |
Kojto | 97:433970e64889 | 85 | { \ |
Kojto | 97:433970e64889 | 86 | APP_ERROR_HANDLER(0); \ |
Kojto | 97:433970e64889 | 87 | } \ |
Kojto | 97:433970e64889 | 88 | } while (0) |
Kojto | 97:433970e64889 | 89 | |
Kojto | 97:433970e64889 | 90 | #endif // APP_ERROR_H__ |
Kojto | 97:433970e64889 | 91 | |
Kojto | 97:433970e64889 | 92 | /** @} */ |