t

Fork of mbed-dev by mbed official

Committer:
AnnaBridge
Date:
Wed Nov 08 13:50:44 2017 +0000
Revision:
178:d650f5d4c87a
Parent:
168:e84263d55307
This updates the lib to the mbed lib v 155

Who changed what in which revision?

UserRevisionLine numberNew contents of line
<> 149:156823d33999 1
<> 149:156823d33999 2 /** \addtogroup platform */
<> 149:156823d33999 3 /** @{*/
<> 149:156823d33999 4 /* mbed Microcontroller Library
<> 149:156823d33999 5 * Copyright (c) 2006-2013 ARM Limited
<> 149:156823d33999 6 *
<> 149:156823d33999 7 * Licensed under the Apache License, Version 2.0 (the "License");
<> 149:156823d33999 8 * you may not use this file except in compliance with the License.
<> 149:156823d33999 9 * You may obtain a copy of the License at
<> 149:156823d33999 10 *
<> 149:156823d33999 11 * http://www.apache.org/licenses/LICENSE-2.0
<> 149:156823d33999 12 *
<> 149:156823d33999 13 * Unless required by applicable law or agreed to in writing, software
<> 149:156823d33999 14 * distributed under the License is distributed on an "AS IS" BASIS,
<> 149:156823d33999 15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<> 149:156823d33999 16 * See the License for the specific language governing permissions and
<> 149:156823d33999 17 * limitations under the License.
<> 149:156823d33999 18 */
<> 149:156823d33999 19 #ifndef MBED_ERROR_H
<> 149:156823d33999 20 #define MBED_ERROR_H
<> 149:156823d33999 21
AnnaBridge 168:e84263d55307 22
AnnaBridge 168:e84263d55307 23
<> 149:156823d33999 24 /** To generate a fatal compile-time error, you can use the pre-processor #error directive.
<> 149:156823d33999 25 *
AnnaBridge 168:e84263d55307 26 * @param format C string that contains data stream to be printed.
AnnaBridge 168:e84263d55307 27 * Code snippets below show valid format.
AnnaBridge 168:e84263d55307 28 *
<> 149:156823d33999 29 * @code
<> 149:156823d33999 30 * #error "That shouldn't have happened!"
<> 149:156823d33999 31 * @endcode
<> 149:156823d33999 32 *
<> 149:156823d33999 33 * If the compiler evaluates this line, it will report the error and stop the compile.
<> 149:156823d33999 34 *
<> 149:156823d33999 35 * For example, you could use this to check some user-defined compile-time variables:
<> 149:156823d33999 36 *
<> 149:156823d33999 37 * @code
<> 149:156823d33999 38 * #define NUM_PORTS 7
<> 149:156823d33999 39 * #if (NUM_PORTS > 4)
<> 149:156823d33999 40 * #error "NUM_PORTS must be less than 4"
<> 149:156823d33999 41 * #endif
<> 149:156823d33999 42 * @endcode
<> 149:156823d33999 43 *
<> 149:156823d33999 44 * Reporting Run-Time Errors:
<> 149:156823d33999 45 * To generate a fatal run-time error, you can use the mbed error() function.
<> 149:156823d33999 46 *
<> 149:156823d33999 47 * @code
<> 149:156823d33999 48 * error("That shouldn't have happened!");
<> 149:156823d33999 49 * @endcode
<> 149:156823d33999 50 *
<> 149:156823d33999 51 * If the mbed running the program executes this function, it will print the
<> 149:156823d33999 52 * message via the USB serial port, and then die with the blue lights of death!
<> 149:156823d33999 53 *
<> 149:156823d33999 54 * The message can use printf-style formatting, so you can report variables in the
<> 149:156823d33999 55 * message too. For example, you could use this to check a run-time condition:
<> 149:156823d33999 56 *
<> 149:156823d33999 57 * @code
<> 149:156823d33999 58 * if(x >= 5) {
<> 149:156823d33999 59 * error("expected x to be less than 5, but got %d", x);
<> 149:156823d33999 60 * }
AnnaBridge 168:e84263d55307 61 * @endcode
AnnaBridge 168:e84263d55307 62 *
AnnaBridge 168:e84263d55307 63 *
<> 149:156823d33999 64 */
<> 149:156823d33999 65
<> 149:156823d33999 66 #ifdef __cplusplus
<> 149:156823d33999 67 extern "C" {
<> 149:156823d33999 68 #endif
<> 149:156823d33999 69 void error(const char* format, ...);
<> 149:156823d33999 70
<> 149:156823d33999 71 #ifdef __cplusplus
<> 149:156823d33999 72 }
<> 149:156823d33999 73 #endif
<> 149:156823d33999 74
<> 149:156823d33999 75 #endif
<> 149:156823d33999 76
<> 149:156823d33999 77 /** @}*/