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.
mbed_error.h
00001 00002 /** \addtogroup platform */ 00003 /** @{*/ 00004 /** 00005 * \defgroup platform_error Error functions 00006 * @{ 00007 */ 00008 /* mbed Microcontroller Library 00009 * Copyright (c) 2006-2013 ARM Limited 00010 * 00011 * Licensed under the Apache License, Version 2.0 (the "License"); 00012 * you may not use this file except in compliance with the License. 00013 * You may obtain a copy of the License at 00014 * 00015 * http://www.apache.org/licenses/LICENSE-2.0 00016 * 00017 * Unless required by applicable law or agreed to in writing, software 00018 * distributed under the License is distributed on an "AS IS" BASIS, 00019 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00020 * See the License for the specific language governing permissions and 00021 * limitations under the License. 00022 */ 00023 #ifndef MBED_ERROR_H 00024 #define MBED_ERROR_H 00025 00026 00027 00028 /** To generate a fatal compile-time error, you can use the pre-processor #error directive. 00029 * 00030 * @param format C string that contains data stream to be printed. 00031 * Code snippets below show valid format. 00032 * 00033 * @code 00034 * #error "That shouldn't have happened!" 00035 * @endcode 00036 * 00037 * If the compiler evaluates this line, it will report the error and stop the compile. 00038 * 00039 * For example, you could use this to check some user-defined compile-time variables: 00040 * 00041 * @code 00042 * #define NUM_PORTS 7 00043 * #if (NUM_PORTS > 4) 00044 * #error "NUM_PORTS must be less than 4" 00045 * #endif 00046 * @endcode 00047 * 00048 * Reporting Run-Time Errors: 00049 * To generate a fatal run-time error, you can use the mbed error() function. 00050 * 00051 * @code 00052 * error("That shouldn't have happened!"); 00053 * @endcode 00054 * 00055 * If the mbed running the program executes this function, it will print the 00056 * message via the USB serial port, and then die with the blue lights of death! 00057 * 00058 * The message can use printf-style formatting, so you can report variables in the 00059 * message too. For example, you could use this to check a run-time condition: 00060 * 00061 * @code 00062 * if(x >= 5) { 00063 * error("expected x to be less than 5, but got %d", x); 00064 * } 00065 * @endcode 00066 * 00067 * 00068 */ 00069 00070 #ifdef __cplusplus 00071 extern "C" { 00072 #endif 00073 void error(const char* format, ...); 00074 00075 #ifdef __cplusplus 00076 } 00077 #endif 00078 00079 #endif 00080 00081 /** @}*/ 00082 /** @}*/
Generated on Tue Jul 12 2022 18:18:43 by
