LPC11U35 ADC Tick & USBSerial

Dependencies:   mbed

Dependents:   SmallDoseMeter_SingleCH_AE_lpc11u35_V1_00

Committer:
H_Tsunemoto
Date:
Mon Feb 19 08:51:33 2018 +0000
Revision:
0:871ab6846b18
test

Who changed what in which revision?

UserRevisionLine numberNew contents of line
H_Tsunemoto 0:871ab6846b18 1 /* mbed Microcontroller Library
H_Tsunemoto 0:871ab6846b18 2 * Copyright (c) 2006-2013 ARM Limited
H_Tsunemoto 0:871ab6846b18 3 *
H_Tsunemoto 0:871ab6846b18 4 * Licensed under the Apache License, Version 2.0 (the "License");
H_Tsunemoto 0:871ab6846b18 5 * you may not use this file except in compliance with the License.
H_Tsunemoto 0:871ab6846b18 6 * You may obtain a copy of the License at
H_Tsunemoto 0:871ab6846b18 7 *
H_Tsunemoto 0:871ab6846b18 8 * http://www.apache.org/licenses/LICENSE-2.0
H_Tsunemoto 0:871ab6846b18 9 *
H_Tsunemoto 0:871ab6846b18 10 * Unless required by applicable law or agreed to in writing, software
H_Tsunemoto 0:871ab6846b18 11 * distributed under the License is distributed on an "AS IS" BASIS,
H_Tsunemoto 0:871ab6846b18 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
H_Tsunemoto 0:871ab6846b18 13 * See the License for the specific language governing permissions and
H_Tsunemoto 0:871ab6846b18 14 * limitations under the License.
H_Tsunemoto 0:871ab6846b18 15 */
H_Tsunemoto 0:871ab6846b18 16 #ifndef MBED_DEBUG_H
H_Tsunemoto 0:871ab6846b18 17 #define MBED_DEBUG_H
H_Tsunemoto 0:871ab6846b18 18 #include "device.h"
H_Tsunemoto 0:871ab6846b18 19
H_Tsunemoto 0:871ab6846b18 20 #ifdef __cplusplus
H_Tsunemoto 0:871ab6846b18 21 extern "C" {
H_Tsunemoto 0:871ab6846b18 22 #endif
H_Tsunemoto 0:871ab6846b18 23
H_Tsunemoto 0:871ab6846b18 24 #if DEVICE_STDIO_MESSAGES
H_Tsunemoto 0:871ab6846b18 25 #include <stdio.h>
H_Tsunemoto 0:871ab6846b18 26 #include <stdarg.h>
H_Tsunemoto 0:871ab6846b18 27
H_Tsunemoto 0:871ab6846b18 28 /** Output a debug message
H_Tsunemoto 0:871ab6846b18 29 *
H_Tsunemoto 0:871ab6846b18 30 * @param format printf-style format string, followed by variables
H_Tsunemoto 0:871ab6846b18 31 */
H_Tsunemoto 0:871ab6846b18 32 static inline void debug(const char *format, ...) {
H_Tsunemoto 0:871ab6846b18 33 va_list args;
H_Tsunemoto 0:871ab6846b18 34 va_start(args, format);
H_Tsunemoto 0:871ab6846b18 35 vfprintf(stderr, format, args);
H_Tsunemoto 0:871ab6846b18 36 va_end(args);
H_Tsunemoto 0:871ab6846b18 37 }
H_Tsunemoto 0:871ab6846b18 38
H_Tsunemoto 0:871ab6846b18 39 /** Conditionally output a debug message
H_Tsunemoto 0:871ab6846b18 40 *
H_Tsunemoto 0:871ab6846b18 41 * NOTE: If the condition is constant false (!= 1) and the compiler optimization
H_Tsunemoto 0:871ab6846b18 42 * level is greater than 0, then the whole function will be compiled away.
H_Tsunemoto 0:871ab6846b18 43 *
H_Tsunemoto 0:871ab6846b18 44 * @param condition output only if condition is true (== 1)
H_Tsunemoto 0:871ab6846b18 45 * @param format printf-style format string, followed by variables
H_Tsunemoto 0:871ab6846b18 46 */
H_Tsunemoto 0:871ab6846b18 47 static inline void debug_if(int condition, const char *format, ...) {
H_Tsunemoto 0:871ab6846b18 48 if (condition == 1) {
H_Tsunemoto 0:871ab6846b18 49 va_list args;
H_Tsunemoto 0:871ab6846b18 50 va_start(args, format);
H_Tsunemoto 0:871ab6846b18 51 vfprintf(stderr, format, args);
H_Tsunemoto 0:871ab6846b18 52 va_end(args);
H_Tsunemoto 0:871ab6846b18 53 }
H_Tsunemoto 0:871ab6846b18 54 }
H_Tsunemoto 0:871ab6846b18 55
H_Tsunemoto 0:871ab6846b18 56 #else
H_Tsunemoto 0:871ab6846b18 57 static inline void debug(const char *format, ...) {}
H_Tsunemoto 0:871ab6846b18 58 static inline void debug_if(int condition, const char *format, ...) {}
H_Tsunemoto 0:871ab6846b18 59
H_Tsunemoto 0:871ab6846b18 60 #endif
H_Tsunemoto 0:871ab6846b18 61
H_Tsunemoto 0:871ab6846b18 62 #ifdef __cplusplus
H_Tsunemoto 0:871ab6846b18 63 }
H_Tsunemoto 0:871ab6846b18 64 #endif
H_Tsunemoto 0:871ab6846b18 65
H_Tsunemoto 0:871ab6846b18 66 #endif