Code for controlling mbed hardware (LED's, motors), as well as code for the Raspberry Pi to run a Support Vector Machine that identifies objects using the Pi camera

Dependencies:   mbed Motordriver mbed-rtos PololuLedStrip

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers mbed_assert.h Source File

mbed_assert.h

00001 
00002 /** \addtogroup platform */
00003 /** @{*/
00004 /* mbed Microcontroller Library
00005  * Copyright (c) 2006-2013 ARM Limited
00006  *
00007  * Licensed under the Apache License, Version 2.0 (the "License");
00008  * you may 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,
00015  * WITHOUT 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 #ifndef MBED_ASSERT_H
00020 #define MBED_ASSERT_H
00021 
00022 #ifdef __cplusplus
00023 extern "C" {
00024 #endif
00025 
00026 /** Internal mbed assert function which is invoked when MBED_ASSERT macro failes.
00027  *  This function is active only if NDEBUG is not defined prior to including this
00028  *  assert header file.
00029  *  In case of MBED_ASSERT failing condition, error() is called with the assertation message.
00030  *  @param expr Expresion to be checked.
00031  *  @param file File where assertation failed.
00032  *  @param line Failing assertation line number.
00033  */
00034 void mbed_assert_internal(const char *expr, const char *file, int line);
00035 
00036 #ifdef __cplusplus
00037 }
00038 #endif
00039 
00040 #ifdef NDEBUG
00041 #define MBED_ASSERT(expr) ((void)0)
00042 
00043 #else
00044 #define MBED_ASSERT(expr)                                \
00045 do {                                                     \
00046     if (!(expr)) {                                       \
00047         mbed_assert_internal(#expr, __FILE__, __LINE__); \
00048     }                                                    \
00049 } while (0)
00050 #endif
00051 
00052 #endif
00053 
00054 /** @}*/