Senet-ized LMIC for MOTE_L152RC

Fork of lmic_MOTE_L152RC by Semtech

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers debug.h Source File

debug.h

00001 /*******************************************************************************
00002  * Copyright (c) 2014-2015 IBM Corporation.
00003  * All rights reserved. This program and the accompanying materials
00004  * are made available under the terms of the Eclipse Public License v1.0
00005  * which accompanies this distribution, and is available at
00006  * http://www.eclipse.org/legal/epl-v10.html
00007  *
00008  * Contributors:
00009  *    IBM Zurich Research Lab - initial API, implementation and documentation
00010  *******************************************************************************/
00011  
00012 #include <stdarg.h>
00013 #include <stdio.h>
00014  
00015  /** Output a debug message
00016  * 
00017  * @param format printf-style format string, followed by variables
00018  */
00019 static inline void debug(const char *format, ...) {
00020     va_list args;
00021     va_start(args, format);
00022     vfprintf(stderr, format, args);
00023     va_end(args);
00024 }
00025 
00026 // intialize debug library
00027 void debug_init (void);
00028 
00029 // set LED state
00030 void debug_led (u1_t val);
00031 
00032 // write character to USART
00033 void debug_char (u1_t c);
00034 
00035 // write byte as two hex digits to USART
00036 void debug_hex (u1_t b);
00037 
00038 // write buffer as hex dump to USART
00039 void debug_buf (const u1_t* buf, u2_t len);
00040 
00041 // write 32-bit integer as eight hex digits to USART
00042 void debug_uint (u4_t v);
00043 
00044 // write nul-terminated string to USART
00045 void debug_str (const char* str);
00046 
00047 // write LMiC event name to USART
00048 void debug_event (int ev);
00049 
00050 // write label and 32-bit value as hex to USART
00051 void debug_val (const char* label, u4_t val);
00052 
00053 void debug_done(void);