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_DEBUG_H
ethaderu 3:78f223d34f36 17 #define MBED_DEBUG_H
ethaderu 3:78f223d34f36 18 #include "device.h"
ethaderu 3:78f223d34f36 19
ethaderu 3:78f223d34f36 20 #ifdef __cplusplus
ethaderu 3:78f223d34f36 21 extern "C" {
ethaderu 3:78f223d34f36 22 #endif
ethaderu 3:78f223d34f36 23
ethaderu 3:78f223d34f36 24 #if DEVICE_STDIO_MESSAGES
ethaderu 3:78f223d34f36 25 #include <stdio.h>
ethaderu 3:78f223d34f36 26 #include <stdarg.h>
ethaderu 3:78f223d34f36 27
ethaderu 3:78f223d34f36 28 /** Output a debug message
ethaderu 3:78f223d34f36 29 *
ethaderu 3:78f223d34f36 30 * @param format printf-style format string, followed by variables
ethaderu 3:78f223d34f36 31 */
ethaderu 3:78f223d34f36 32 static inline void debug(const char *format, ...) {
ethaderu 3:78f223d34f36 33 va_list args;
ethaderu 3:78f223d34f36 34 va_start(args, format);
ethaderu 3:78f223d34f36 35 vfprintf(stderr, format, args);
ethaderu 3:78f223d34f36 36 va_end(args);
ethaderu 3:78f223d34f36 37 }
ethaderu 3:78f223d34f36 38
ethaderu 3:78f223d34f36 39 /** Conditionally output a debug message
ethaderu 3:78f223d34f36 40 *
ethaderu 3:78f223d34f36 41 * NOTE: If the condition is constant false (!= 1) and the compiler optimization
ethaderu 3:78f223d34f36 42 * level is greater than 0, then the whole function will be compiled away.
ethaderu 3:78f223d34f36 43 *
ethaderu 3:78f223d34f36 44 * @param condition output only if condition is true (== 1)
ethaderu 3:78f223d34f36 45 * @param format printf-style format string, followed by variables
ethaderu 3:78f223d34f36 46 */
ethaderu 3:78f223d34f36 47 static inline void debug_if(int condition, const char *format, ...) {
ethaderu 3:78f223d34f36 48 if (condition == 1) {
ethaderu 3:78f223d34f36 49 va_list args;
ethaderu 3:78f223d34f36 50 va_start(args, format);
ethaderu 3:78f223d34f36 51 vfprintf(stderr, format, args);
ethaderu 3:78f223d34f36 52 va_end(args);
ethaderu 3:78f223d34f36 53 }
ethaderu 3:78f223d34f36 54 }
ethaderu 3:78f223d34f36 55
ethaderu 3:78f223d34f36 56 #else
ethaderu 3:78f223d34f36 57 static inline void debug(const char *format, ...) {}
ethaderu 3:78f223d34f36 58 static inline void debug_if(int condition, const char *format, ...) {}
ethaderu 3:78f223d34f36 59
ethaderu 3:78f223d34f36 60 #endif
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