-/* Copyright (C) 2011-2014 by Jacob Alexander
+/* Copyright (C) 2011-2015 by Jacob Alexander
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* THE SOFTWARE.
*/
-#ifndef print_h__
-#define print_h__
+#pragma once
// ----- Includes -----
*/
// Function Aliases
-#define dPrint(c) output_putstr(c)
-#define dPrintStr(c) output_putstr(c)
+#define dPrint(c) Output_putstr(c)
+#define dPrintStr(c) Output_putstr(c)
#define dPrintStrs(...) printstrs(__VA_ARGS__, "\0\0\0") // Convenience Variadic Macro
#define dPrintStrNL(c) dPrintStrs (c, NL) // Appends New Line Macro
#define dPrintStrsNL(...) printstrs(__VA_ARGS__, NL, "\0\0\0") // Appends New Line Macro
// Special Msg Constructs (Uses VT100 tags)
#define dPrintMsg(colour_code_str,msg,...) \
- printstrs("\033[", colour_code_str, "m", msg, "\033[0m - ", __VA_ARGS__, NL, "\0\0\0")
+ printstrs("\033[", colour_code_str, "m", msg, "\033[0m - ", __VA_ARGS__, NL, "\0\0\0")
#define printMsgNL(colour_code_str,msg,str) \
- print("\033[" colour_code_str "m" msg "\033[0m - " str NL)
+ print("\033[" colour_code_str "m" msg "\033[0m - " str NL)
#define printMsg(colour_code_str,msg,str) \
- print("\033[" colour_code_str "m" msg "\033[0m - " str)
+ print("\033[" colour_code_str "m" msg "\033[0m - " str)
// Info Messages
#define info_dPrint(...) dPrintMsg ("1;32", "INFO", __VA_ARGS__) // Info Msg
// Static String Printing
+#if defined(_at90usb162_) || defined(_atmega32u4_) || defined(_at90usb646_) || defined(_at90usb1286_)
#define print(s) _print(PSTR(s))
+#else
+#define print(s) _print(s)
+#endif
-void _print(const char *s);
+void _print( const char *s );
void printstrs( char* first, ... );
// Printing numbers
-#define printHex(hex) printHex_op(hex, 1)
+#define printHex(hex) printHex_op(hex, 1)
+#define printHex32(hex) printHex32_op(hex, 1)
-void printInt8 ( uint8_t in );
-void printInt16 ( uint16_t in );
-void printInt32 ( uint32_t in );
-void printHex_op( uint16_t in, uint8_t op );
+void printInt8 ( uint8_t in );
+void printInt16 ( uint16_t in );
+void printInt32 ( uint32_t in );
+void printHex_op ( uint16_t in, uint8_t op );
+void printHex32_op( uint32_t in, uint8_t op );
// String Functions
#define hexToStr(hex, out) hexToStr_op(hex, out, 1)
-void int8ToStr ( uint8_t in, char* out );
-void int16ToStr ( uint16_t in, char* out );
-void int32ToStr ( uint32_t in, char* out );
-void hexToStr_op( uint16_t in, char* out, uint8_t op );
-void revsStr ( char* in );
-uint16_t lenStr ( char* in );
-int16_t eqStr ( char* str1, char* str2 ); // Returns -1 if identical, last character of str1 comparison (0 if str1 is like str2)
-int decToInt ( char* in ); // Returns the int representation of a string
-
-#endif
+void int8ToStr ( uint8_t in, char* out );
+void int16ToStr ( uint16_t in, char* out );
+void int32ToStr ( uint32_t in, char* out );
+void hexToStr_op ( uint16_t in, char* out, uint8_t op );
+void hex32ToStr_op( uint32_t in, char* out, uint8_t op );
+void revsStr ( char* in );
+uint16_t lenStr ( char* in );
+int16_t eqStr ( char* str1, char* str2 ); // Returns -1 if identical, last character of str1 comparison (0 if str1 is like str2)
+int numToInt ( char* in ); // Returns the int representation of a string