Mangue Baja Box

Dependencies:   mbed

Committer:
einsteingustavo
Date:
Mon Jul 29 20:38:00 2019 +0000
Revision:
0:0dee8840a1c0
Mangue Baja Box

Who changed what in which revision?

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