Initial commit

Dependencies:   FastPWM

Committer:
lypinator
Date:
Wed Sep 16 01:11:49 2020 +0000
Revision:
0:bb348c97df44
Added PWM

Who changed what in which revision?

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