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
nrf_assert.h
00001 /* 00002 * Copyright (c) 2006 Nordic Semiconductor. All Rights Reserved. 00003 * 00004 * The information contained herein is confidential property of Nordic Semiconductor. The use, 00005 * copying, transfer or disclosure of such information is prohibited except by express written 00006 * agreement with Nordic Semiconductor. 00007 * 00008 */ 00009 00010 /** @file 00011 * @brief Utilities for verifying program logic 00012 */ 00013 00014 #ifndef NRF_ASSERT_H_ 00015 #define NRF_ASSERT_H_ 00016 00017 #include <stdint.h> 00018 #include "nordic_global.h" 00019 00020 #if defined(DEBUG_NRF) || defined(DEBUG_NRF_USER) 00021 00022 /** @brief Function for handling assertions. 00023 * 00024 * 00025 * @note 00026 * This function is called when an assertion has triggered. 00027 * 00028 * 00029 * @post 00030 * All hardware is put into an idle non-emitting state (in particular the radio is highly 00031 * important to switch off since the radio might be in a state that makes it send 00032 * packets continiously while a typical final infinit ASSERT loop is executing). 00033 * 00034 * 00035 * @param line_num The line number where the assertion is called 00036 * @param file_name Pointer to the file name 00037 */ 00038 void assert_nrf_callback(uint16_t line_num, const uint8_t *file_name); 00039 00040 /*lint -emacro(506, ASSERT) */ /* Suppress "Constant value Boolean */ 00041 /*lint -emacro(774, ASSERT) */ /* Suppress "Boolean within 'if' always evaluates to True" */ \ 00042 00043 /** @brief Function for checking intended for production code. 00044 * 00045 * Check passes if "expr" evaluates to true. */ 00046 #define ASSERT(expr) \ 00047 if (expr) \ 00048 { \ 00049 } \ 00050 else \ 00051 { \ 00052 assert_nrf_callback((uint16_t)__LINE__, (uint8_t *)__FILE__); \ 00053 } 00054 #else 00055 #define ASSERT(expr) //!< Assert empty when disabled 00056 void assert_nrf_callback(uint16_t line_num, const uint8_t *file_name); 00057 #endif /* defined(DEBUG_NRF) || defined(DEBUG_NRF_USER) */ 00058 00059 #endif /* NRF_ASSERT_H_ */
Generated on Tue Jul 12 2022 19:00:52 by
