mbed.h verzija za koristenje na predmetu PAI

Committer:
esokic
Date:
Tue Mar 10 09:51:52 2015 +0000
Revision:
0:05aad811ea07
mbed.h verzija od marta 2014, za koristenje na predmetu PAI

Who changed what in which revision?

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