hello world
Fork of lmic_MOTE_L152RC by
Diff: debug.h
- Revision:
- 0:f2716e543d97
- Child:
- 11:671d85a0f15b
diff -r 000000000000 -r f2716e543d97 debug.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/debug.h Tue Jun 02 19:04:29 2015 +0000 @@ -0,0 +1,53 @@ +/******************************************************************************* + * Copyright (c) 2014-2015 IBM Corporation. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Zurich Research Lab - initial API, implementation and documentation + *******************************************************************************/ + +#include <stdarg.h> +#include <stdio.h> + + /** Output a debug message + * + * @param format printf-style format string, followed by variables + */ +static inline void debug(const char *format, ...) { + va_list args; + va_start(args, format); + vfprintf(stderr, format, args); + va_end(args); +} + +// intialize debug library +void debug_init (void); + +// set LED state +void debug_led (u1_t val); + +// write character to USART +void debug_char (u1_t c); + +// write byte as two hex digits to USART +void debug_hex (u1_t b); + +// write buffer as hex dump to USART +void debug_buf (const u1_t* buf, u2_t len); + +// write 32-bit integer as eight hex digits to USART +void debug_uint (u4_t v); + +// write nul-terminated string to USART +void debug_str (const char* str); + +// write LMiC event name to USART +void debug_event (int ev); + +// write label and 32-bit value as hex to USART +void debug_val (const char* label, u4_t val); + +void debug_done(void);