mediCAL's first BLE project
Fork of nRF51822 by
nordic/nrf-sdk/nrf_assert.h@65:98215c4f3a25, 2014-09-08 (annotated)
- Committer:
- Rohit Grover
- Date:
- Mon Sep 08 17:21:46 2014 +0100
- Revision:
- 65:98215c4f3a25
- Parent:
- 49:c941433e0eb0
Release 0.1.3
Update to v6.1.0 of Nordic's SDK.
Bugfixes
~~~~~~~~
- Handle all valid disconnection reasons.
Compatible with Release 0.1.1 of the BLE_API.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bogdanm | 0:eff01767de02 | 1 | /* |
bogdanm | 0:eff01767de02 | 2 | * Copyright (c) 2006 Nordic Semiconductor. All Rights Reserved. |
bogdanm | 0:eff01767de02 | 3 | * |
bogdanm | 0:eff01767de02 | 4 | * The information contained herein is confidential property of Nordic Semiconductor. The use, |
bogdanm | 0:eff01767de02 | 5 | * copying, transfer or disclosure of such information is prohibited except by express written |
bogdanm | 0:eff01767de02 | 6 | * agreement with Nordic Semiconductor. |
bogdanm | 0:eff01767de02 | 7 | * |
bogdanm | 0:eff01767de02 | 8 | */ |
bogdanm | 0:eff01767de02 | 9 | |
bogdanm | 0:eff01767de02 | 10 | /** @file |
bogdanm | 0:eff01767de02 | 11 | * @brief Utilities for verifying program logic |
bogdanm | 0:eff01767de02 | 12 | */ |
bogdanm | 0:eff01767de02 | 13 | |
bogdanm | 0:eff01767de02 | 14 | #ifndef NRF_ASSERT_H_ |
bogdanm | 0:eff01767de02 | 15 | #define NRF_ASSERT_H_ |
bogdanm | 0:eff01767de02 | 16 | |
bogdanm | 0:eff01767de02 | 17 | #include <stdint.h> |
bogdanm | 0:eff01767de02 | 18 | |
Rohit Grover |
49:c941433e0eb0 | 19 | #ifdef __cplusplus |
Rohit Grover |
49:c941433e0eb0 | 20 | extern "C" { |
Rohit Grover |
49:c941433e0eb0 | 21 | #endif |
Rohit Grover |
49:c941433e0eb0 | 22 | |
bogdanm | 0:eff01767de02 | 23 | #if defined(DEBUG_NRF) || defined(DEBUG_NRF_USER) |
bogdanm | 0:eff01767de02 | 24 | |
bogdanm | 0:eff01767de02 | 25 | /** @brief Function for handling assertions. |
bogdanm | 0:eff01767de02 | 26 | * |
bogdanm | 0:eff01767de02 | 27 | * |
bogdanm | 0:eff01767de02 | 28 | * @note |
bogdanm | 0:eff01767de02 | 29 | * This function is called when an assertion has triggered. |
bogdanm | 0:eff01767de02 | 30 | * |
bogdanm | 0:eff01767de02 | 31 | * |
bogdanm | 0:eff01767de02 | 32 | * @post |
bogdanm | 0:eff01767de02 | 33 | * All hardware is put into an idle non-emitting state (in particular the radio is highly |
bogdanm | 0:eff01767de02 | 34 | * important to switch off since the radio might be in a state that makes it send |
bogdanm | 0:eff01767de02 | 35 | * packets continiously while a typical final infinit ASSERT loop is executing). |
bogdanm | 0:eff01767de02 | 36 | * |
bogdanm | 0:eff01767de02 | 37 | * |
bogdanm | 0:eff01767de02 | 38 | * @param line_num The line number where the assertion is called |
bogdanm | 0:eff01767de02 | 39 | * @param file_name Pointer to the file name |
bogdanm | 0:eff01767de02 | 40 | */ |
bogdanm | 0:eff01767de02 | 41 | void assert_nrf_callback(uint16_t line_num, const uint8_t *file_name); |
bogdanm | 0:eff01767de02 | 42 | |
Rohit Grover |
49:c941433e0eb0 | 43 | /*lint -emacro(506, ASSERT) */ /* Suppress "Constant value Boolean */ |
bogdanm | 0:eff01767de02 | 44 | /*lint -emacro(774, ASSERT) */ /* Suppress "Boolean within 'if' always evaluates to True" */ \ |
bogdanm | 0:eff01767de02 | 45 | |
bogdanm | 0:eff01767de02 | 46 | /** @brief Function for checking intended for production code. |
bogdanm | 0:eff01767de02 | 47 | * |
bogdanm | 0:eff01767de02 | 48 | * Check passes if "expr" evaluates to true. */ |
bogdanm | 0:eff01767de02 | 49 | #define ASSERT(expr) \ |
bogdanm | 0:eff01767de02 | 50 | if (expr) \ |
bogdanm | 0:eff01767de02 | 51 | { \ |
bogdanm | 0:eff01767de02 | 52 | } \ |
bogdanm | 0:eff01767de02 | 53 | else \ |
bogdanm | 0:eff01767de02 | 54 | { \ |
bogdanm | 0:eff01767de02 | 55 | assert_nrf_callback((uint16_t)__LINE__, (uint8_t *)__FILE__); \ |
bogdanm | 0:eff01767de02 | 56 | } |
bogdanm | 0:eff01767de02 | 57 | #else |
bogdanm | 0:eff01767de02 | 58 | #define ASSERT(expr) //!< Assert empty when disabled |
bogdanm | 0:eff01767de02 | 59 | void assert_nrf_callback(uint16_t line_num, const uint8_t *file_name); |
bogdanm | 0:eff01767de02 | 60 | #endif /* defined(DEBUG_NRF) || defined(DEBUG_NRF_USER) */ |
bogdanm | 0:eff01767de02 | 61 | |
Rohit Grover |
49:c941433e0eb0 | 62 | #ifdef __cplusplus |
Rohit Grover |
49:c941433e0eb0 | 63 | } |
Rohit Grover |
49:c941433e0eb0 | 64 | #endif |
Rohit Grover |
49:c941433e0eb0 | 65 | |
bogdanm | 0:eff01767de02 | 66 | #endif /* NRF_ASSERT_H_ */ |