The BERG Cloud connection library for mbed. This works in conjunction with the BERG Cloud Devshield available via http://bergcloud.com/platform/devkit/

Dependents:   LittleCounter-Example

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers BERGCloudLogPrint.h Source File

BERGCloudLogPrint.h

00001 /*
00002 
00003 Debug logging helpers
00004 
00005 Copyright (c) 2013 BERG Cloud Ltd. http://bergcloud.com/
00006 
00007 Permission is hereby granted, free of charge, to any person obtaining a copy
00008 of this software and associated documentation files (the "Software"), to deal
00009 in the Software without restriction, including without limitation the rights
00010 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
00011 copies of the Software, and to permit persons to whom the Software is
00012 furnished to do so, subject to the following conditions:
00013 
00014 The above copyright notice and this permission notice shall be included in
00015 all copies or substantial portions of the Software.
00016 
00017 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00018 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00019 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
00020 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00021 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00022 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
00023 THE SOFTWARE.
00024 
00025 */
00026 
00027 #ifndef BERGCLOUDLOGPRINT_H
00028 #define BERGCLOUDLOGPRINT_H
00029 
00030 #ifdef BERGCLOUD_LOG
00031 #ifdef ARDUINO
00032 #include <Arduino.h>
00033 // Workaround for http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34734
00034 // Credit: http://forum.arduino.cc/index.php/topic,85840.0.html
00035 #ifdef PROGMEM
00036 #undef PROGMEM
00037 #define PROGMEM __attribute__((section(".progmem.data")))
00038 #endif // #ifdef PROGMEM
00039 #define _LOG(x) Serial.print(F(x))
00040 #define _LOG_HEX(x) if ((x) < 0x10) Serial.print(F("0")); Serial.print((x), HEX)
00041 #else // #ifdef ARDUINO
00042 #include <stdio.h>
00043 #define _LOG(x) printf(x)
00044 #define _LOG_HEX(x) printf("%02X", (x))
00045 #endif // #ifdef ARDUINO
00046 #else // #ifdef BERGCLOUD_LOG
00047 #define _LOG(x)
00048 #endif // #ifdef BERGCLOUD_LOG
00049 
00050 #endif // #ifndef BERGCLOUDLOGPRINT_H
00051