+void MeasureAntennaTuningHf(void)\r
+{\r
+ int vHf = 0; // in mV\r
+\r
+ DbpString("Measuring HF antenna characteristics, press button to exit");\r
+\r
+ for (;;) {\r
+ // Let the FPGA drive the high-frequency antenna around 13.56 MHz.\r
+ FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_READER_RX_XCORR);\r
+ SpinDelay(20);\r
+ // Vref = 3300mV, and an 10:1 voltage divider on the input\r
+ // can measure voltages up to 33000 mV\r
+ vHf = (33000 * AvgAdc(ADC_CHAN_HF)) >> 10;\r
+ \r
+ Dbprintf("%d mV",vHf);\r
+ if (BUTTON_PRESS()) break;\r
+ }\r
+ DbpString("cancelled");\r
+}\r
+\r
+\r