Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers fnet_assert.h Source File

fnet_assert.h

00001 /**************************************************************************
00002 *
00003 * Copyright 2016 by Andrey Butok. FNET Community.
00004 *
00005 ***************************************************************************
00006 *
00007 *  Licensed under the Apache License, Version 2.0 (the "License"); you may
00008 *  not use this file except in compliance with the License.
00009 *  You may obtain a copy of the License at
00010 *
00011 *  http://www.apache.org/licenses/LICENSE-2.0
00012 *
00013 *  Unless required by applicable law or agreed to in writing, software
00014 *  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
00015 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00016 *  See the License for the specific language governing permissions and
00017 *  limitations under the License.
00018 *
00019 **********************************************************************/
00020 /*!
00021 * @brief FNET assert macros.
00022 *
00023 ***************************************************************************/
00024 #ifndef _FNET_ASSERT_H_
00025 #define _FNET_ASSERT_H_
00026 
00027 #if FNET_CFG_ASSERT
00028 
00029     #define FNET_ASSERT_ERROR_MESSAGE   "FNET ASSERT: %s: %s: %d\n\r"
00030 
00031     /* Checks that the given condition is true, otherwise it prints error message 
00032      * and stops the program execution.*/
00033     #define FNET_ASSERT(condition)                                                  \
00034             if (!(condition))                                                       \
00035             {                                                                       \
00036                 printf(FNET_ASSERT_ERROR_MESSAGE, __func__, __FILE__, __LINE__);    \
00037                 while (1);                                                          \
00038             } 
00039 #else
00040     #define FNET_ASSERT(condition)  ((void) 0)
00041 #endif
00042 
00043 #endif  /* _FNET_ASSERT_H_ */
00044