Home Alert System

Dependencies:   PWM_Tone_Library DHT

Committer:
ethaderu
Date:
Tue Mar 05 02:34:44 2019 +0000
Revision:
3:78f223d34f36
Publish 1

Who changed what in which revision?

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