BOOL at134khz;
// see if 'h' was specified
- if(command[strlen(command) - 1] == 'h')
+ if(command[strlen((char *) command) - 1] == 'h')
at134khz= TRUE;
else
at134khz= FALSE;
void SweepLFrange()
{
BYTE *dest = (BYTE *)BigBuf;
- int i;
+ char dummy[12];
+ int i, peak= 0, ptr= 0;
+ double freq;
// clear buffer
memset(BigBuf,0,sizeof(BigBuf));
FpgaSendCommand(FPGA_CMD_SET_DIVISOR, i);
SpinDelay(20);
dest[i] = (137500 * AvgAdc(ADC_CHAN_LF)) >> 18;
+ if(dest[i] > peak) {
+ peak= dest[i];
+ ptr= i;
+ }
}
+ dummy[11]= '\0';
+ dummy[10]= 'z';
+ dummy[9]= 'H';
+ dummy[8]= 'k';
+ dummy[7]= ' ';
+ freq= 12000000/(ptr + 1);
+ for(i= 6; i > 3 ; --i) {
+ dummy[i]= '0' + ((int) freq) % 10;
+ freq /= 10;
+ }
+ dummy[3]= '.';
+ for(i= 2; i >= 0 ; --i) {
+ dummy[i]= '0' + ((int) freq) % 10;
+ freq /= 10;
+ }
+ DbpString("Antenna resonates at:");
+ DbpString(dummy);
}
void MeasureAntennaTuning(void)
for(;;) {
while(!(PIO_PIN_DATA_STATUS & (1<<GPIO_SSC_CLK))) {
if(BUTTON_PRESS()) {
+ DbpString("Stopped");
return;
}
WDT_HIT();
while(PIO_PIN_DATA_STATUS & (1<<GPIO_SSC_CLK)) {
if(BUTTON_PRESS()) {
+ DbpString("Stopped");
return;
}
WDT_HIT();
WDT_HIT();
LED_A_ON();
if(BUTTON_PRESS()) {
+ DbpString("Stopped");
LED_A_OFF();
return;
}
// listen for external reader
void ListenReaderField(int limit)
{
- int lf_av, lf_av_new, lf_baseline= -1, lf_count= 0;
- int hf_av, hf_av_new, hf_baseline= -1, hf_count= 0;
+ int lf_av, lf_av_new, lf_baseline= 0, lf_count= 0;
+ int hf_av, hf_av_new, hf_baseline= 0, hf_count= 0;
#define LF_ONLY 1
#define HF_ONLY 2
lf_av= ReadAdc(ADC_CHAN_LF);
- if(limit != HF_ONLY && lf_baseline == -1)
+ if(limit != HF_ONLY)
{
DbpString("LF 125/134 Baseline:");
DbpIntegers(lf_av,0,0);
hf_av= ReadAdc(ADC_CHAN_HF);
- if (limit != LF_ONLY && hf_baseline == -1)
+ if (limit != LF_ONLY)
{
DbpString("HF 13.56 Baseline:");
DbpIntegers(hf_av,0,0);
{
if(BUTTON_PRESS())
{
+ DbpString("Stopped");
LED_B_OFF();
LED_D_OFF();
return;