IoT Home Alarm System

Dependents:   IoTBurglar_and_Fire_AlarmSystem

Committer:
kbrahmbhatt6
Date:
Fri Apr 29 06:59:59 2016 +0000
Revision:
0:2f388b030837
1

Who changed what in which revision?

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