]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - armsrc/appmain.c
create Dbprintf convenience function
[proxmark3-svn] / armsrc / appmain.c
index 11047b1cbdc75820e41ef104c1b3ab7447da05bd..8d6c1812f08a522e1a0a811725f2af8fc340d160 100644 (file)
 #include "LCD.h"\r
 #endif\r
 \r
+#define va_list __builtin_va_list\r
+#define va_start __builtin_va_start\r
+#define va_arg __builtin_va_arg\r
+#define va_end __builtin_va_end\r
+int kvsprintf(char const *fmt, void *arg, int radix, va_list ap);\r
+       \r
 //=============================================================================\r
 // A buffer where we can queue things up to be sent through the FPGA, for\r
 // any purpose (fake tag, as reader, whatever). We go MSB first, since that\r
@@ -94,6 +100,18 @@ void DbpIntegers(int x1, int x2, int x3)
        SpinDelay(50);\r
 }\r
 \r
+void Dbprintf(const char *fmt, ...) {\r
+// should probably limit size here; oh well, let's just use a big buffer\r
+       char output_string[128];\r
+       va_list ap;\r
+\r
+       va_start(ap, fmt);\r
+       kvsprintf(fmt, output_string, 10, ap);\r
+       va_end(ap);\r
\r
+       DbpString(output_string);\r
+}\r
+\r
 //-----------------------------------------------------------------------------\r
 // Read an ADC channel and block till it completes, then return the result\r
 // in ADC units (0 to 1023). Also a routine to average 32 samples and\r
Impressum, Datenschutz