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.

Committer:
Kojto
Date:
Tue Apr 14 10:58:58 2015 +0200
Revision:
97:433970e64889
Child:
98:8ab26030e058
Release 97 of the mbed library

Changes:
- NRF51 - Update Softdevice, fix us ticker
- MTS Dragonfly - bugfixes, IAR support
- MTS mdot - bootloader support
- RZ_A1 - nvic wrapper
- STM F3xx, F4xx - hal reorganization

Who changed what in which revision?

UserRevisionLine numberNew 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 97:433970e64889 29 /**@brief Function for error handling, which is called when an error has occurred.
Kojto 97:433970e64889 30 *
Kojto 97:433970e64889 31 * @param[in] error_code Error code supplied to the handler.
Kojto 97:433970e64889 32 * @param[in] line_num Line number where the handler is called.
Kojto 97:433970e64889 33 * @param[in] p_file_name Pointer to the file name.
Kojto 97:433970e64889 34 */
Kojto 97:433970e64889 35 void app_error_handler(uint32_t error_code, uint32_t line_num, const uint8_t * p_file_name);
Kojto 97:433970e64889 36
Kojto 97:433970e64889 37 /**@brief Macro for calling error handler function.
Kojto 97:433970e64889 38 *
Kojto 97:433970e64889 39 * @param[in] ERR_CODE Error code supplied to the error handler.
Kojto 97:433970e64889 40 */
Kojto 97:433970e64889 41 #ifdef DEBUG
Kojto 97:433970e64889 42 #define APP_ERROR_HANDLER(ERR_CODE) \
Kojto 97:433970e64889 43 do \
Kojto 97:433970e64889 44 { \
Kojto 97:433970e64889 45 app_error_handler((ERR_CODE), __LINE__, (uint8_t*) __FILE__); \
Kojto 97:433970e64889 46 } while (0)
Kojto 97:433970e64889 47 #else
Kojto 97:433970e64889 48 #define APP_ERROR_HANDLER(ERR_CODE) \
Kojto 97:433970e64889 49 do \
Kojto 97:433970e64889 50 { \
Kojto 97:433970e64889 51 app_error_handler((ERR_CODE), 0, 0); \
Kojto 97:433970e64889 52 } while (0)
Kojto 97:433970e64889 53 #endif
Kojto 97:433970e64889 54 /**@brief Macro for calling error handler function if supplied error code any other than NRF_SUCCESS.
Kojto 97:433970e64889 55 *
Kojto 97:433970e64889 56 * @param[in] ERR_CODE Error code supplied to the error handler.
Kojto 97:433970e64889 57 */
Kojto 97:433970e64889 58 #define APP_ERROR_CHECK(ERR_CODE) \
Kojto 97:433970e64889 59 do \
Kojto 97:433970e64889 60 { \
Kojto 97:433970e64889 61 const uint32_t LOCAL_ERR_CODE = (ERR_CODE); \
Kojto 97:433970e64889 62 if (LOCAL_ERR_CODE != NRF_SUCCESS) \
Kojto 97:433970e64889 63 { \
Kojto 97:433970e64889 64 APP_ERROR_HANDLER(LOCAL_ERR_CODE); \
Kojto 97:433970e64889 65 } \
Kojto 97:433970e64889 66 } while (0)
Kojto 97:433970e64889 67
Kojto 97:433970e64889 68 /**@brief Macro for calling error handler function if supplied boolean value is false.
Kojto 97:433970e64889 69 *
Kojto 97:433970e64889 70 * @param[in] BOOLEAN_VALUE Boolean value to be evaluated.
Kojto 97:433970e64889 71 */
Kojto 97:433970e64889 72 #define APP_ERROR_CHECK_BOOL(BOOLEAN_VALUE) \
Kojto 97:433970e64889 73 do \
Kojto 97:433970e64889 74 { \
Kojto 97:433970e64889 75 const uint32_t LOCAL_BOOLEAN_VALUE = (BOOLEAN_VALUE); \
Kojto 97:433970e64889 76 if (!LOCAL_BOOLEAN_VALUE) \
Kojto 97:433970e64889 77 { \
Kojto 97:433970e64889 78 APP_ERROR_HANDLER(0); \
Kojto 97:433970e64889 79 } \
Kojto 97:433970e64889 80 } while (0)
Kojto 97:433970e64889 81
Kojto 97:433970e64889 82 #endif // APP_ERROR_H__
Kojto 97:433970e64889 83
Kojto 97:433970e64889 84 /** @} */