Modification of mbed-src library only for STM32F030F4, very cheap microcontroller in 20-Pin TSSOP package, with 16Kbytes of Flash and 4Kbytes of Ram. **Target for online compilator must be Nucleo 32F030R8.**

Dependents:   STM32F031_blink_LED_2

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers mbed_debug.h Source File

mbed_debug.h

00001 /* mbed Microcontroller Library
00002  * Copyright (c) 2006-2013 ARM Limited
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 #ifndef MBED_DEBUG_H
00017 #define MBED_DEBUG_H
00018 #include "device.h"
00019 
00020 #ifdef __cplusplus
00021 extern "C" {
00022 #endif
00023 
00024 #if DEVICE_STDIO_MESSAGES
00025 #include <stdio.h>
00026 #include <stdarg.h>
00027 
00028 /** Output a debug message
00029  *
00030  * @param format printf-style format string, followed by variables
00031  */
00032 static inline void debug(const char *format, ...) {
00033     va_list args;
00034     va_start(args, format);
00035     vfprintf(stderr, format, args);
00036     va_end(args);
00037 }
00038 
00039 /** Conditionally output a debug message
00040  *
00041  * NOTE: If the condition is constant false (!= 1) and the compiler optimization
00042  * level is greater than 0, then the whole function will be compiled away.
00043  *
00044  * @param condition output only if condition is true (== 1)
00045  * @param format printf-style format string, followed by variables
00046  */
00047 static inline void debug_if(int condition, const char *format, ...) {
00048     if (condition == 1) {
00049         va_list args;
00050         va_start(args, format);
00051         vfprintf(stderr, format, args);
00052         va_end(args);
00053     }
00054 }
00055 
00056 #else
00057 static inline void debug(const char *format, ...) {}
00058 static inline void debug_if(int condition, const char *format, ...) {}
00059 
00060 #endif
00061 
00062 #ifdef __cplusplus
00063 }
00064 #endif
00065 
00066 #endif