+ *vHf = (MAX_ADC_HF_VOLTAGE * AvgAdc(ADC_CHAN_HF)) >> 10;
+ LED_A_OFF();
+
+ return;
+}
+
+void MeasureAntennaTuning(int mode)
+{
+ uint8_t LF_Results[256] = {0};
+ int peakv = 0, peakf = 0;
+ int vLf125 = 0, vLf134 = 0, vHf = 0; // in mV
+
+ LED_B_ON();
+
+ if (((mode & FLAG_TUNE_ALL) == FLAG_TUNE_ALL) && (FpgaGetCurrent() == FPGA_BITSTREAM_HF)) {
+ // Reverse "standard" order if HF already loaded, to avoid unnecessary swap.
+ MeasureAntennaTuningHfOnly(&vHf);
+ MeasureAntennaTuningLfOnly(&vLf125, &vLf134, &peakf, &peakv, LF_Results);
+ } else {
+ if (mode & FLAG_TUNE_LF) {
+ MeasureAntennaTuningLfOnly(&vLf125, &vLf134, &peakf, &peakv, LF_Results);
+ }
+ if (mode & FLAG_TUNE_HF) {
+ MeasureAntennaTuningHfOnly(&vHf);
+ }
+ }