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