#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
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
BYTE *dest = (BYTE *)BigBuf;\r
int n = sizeof(BigBuf);\r
int i;\r
- char output_string[64];\r
\r
memset(dest, 0, n);\r
i = 0;\r
if (i >= n) break;\r
}\r
}\r
- sprintf(output_string, "read samples, dest[0]=%x dest[1]=%x",\r
- dest[0], dest[1]);\r
- DbpString(output_string);\r
+ Dbprintf("read samples, dest[0]=%x dest[1]=%x", dest[0], dest[1]);\r
}\r
\r
void ModThenAcquireRawAdcSamples125k(int delay_off, int period_0, int period_1, BYTE *command)\r
crc = update_crc16(crc, (shift1>>16)&0xff);\r
crc = update_crc16(crc, (shift1>>24)&0xff);\r
\r
- char output_string[64];\r
- sprintf(output_string, "Info: Tag data_hi=%x, data_lo=%x, crc=%x",\r
+ Dbprintf("Info: Tag data_hi=%x, data_lo=%x, crc=%x",\r
(unsigned int)shift1, (unsigned int)shift0, (unsigned int)shift2 & 0xFFFF);\r
- DbpString(output_string);\r
if (crc != (shift2&0xffff)) {\r
- sprintf(output_string, "Error: CRC mismatch, expected %x", (unsigned int)crc);\r
- DbpString(output_string);\r
+ Dbprintf("Error: CRC mismatch, expected %x", (unsigned int)crc);\r
} else {\r
DbpString("Info: CRC is good");\r
}\r
crc = update_crc16(crc, (idhi>>16)&0xff);\r
crc = update_crc16(crc, (idhi>>24)&0xff);\r
}\r
- char output_string[64];\r
- sprintf(output_string, "Writing the following data to tag: %x, %x, %x",\r
+ Dbprintf("Writing the following data to tag: %x, %x, %x",\r
(unsigned int) idhi, (unsigned int) idlo, crc);\r
- DbpString(output_string);\r
\r
// TI tags charge at 134.2Khz\r
FpgaSendCommand(FPGA_CMD_SET_DIVISOR, 88); //134.8Khz\r
found=1;\r
idx+=6;\r
if (found && (hi|lo)) {\r
- char output_string[64];\r
- sprintf(output_string, "TAG ID: %x %x %x", \r
+ Dbprintf("TAG ID: %x %x %x", \r
(unsigned int) hi, (unsigned int) lo, (unsigned int) (lo>>1) & 0xFFFF);\r
- DbpString(output_string);\r
/* if we're only looking for one tag */\r
if (findone)\r
{\r
found=1;\r
idx+=6;\r
if (found && (hi|lo)) {\r
- char output_string[64];\r
- sprintf(output_string, "TAG ID: %x %x %x", \r
+ Dbprintf("TAG ID: %x %x %x", \r
(unsigned int) hi, (unsigned int) lo, (unsigned int) (lo>>1) & 0xFFFF);\r
- DbpString(output_string);\r
/* if we're only looking for one tag */\r
if (findone)\r
{\r