Backup 1

Committer:
borlanic
Date:
Tue Apr 24 11:45:18 2018 +0000
Revision:
0:02dd72d1d465
BaBoRo_test2 - backup 1

Who changed what in which revision?

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