#endif
}
-static void set_output(int16_t i)
-{
- int8_t detected = 0;
-
- if (cpt_filter > 250)
- detected = 1;
-
-#ifdef HOST_VERSION
- printf("%d fil_fond=%d fil_harm1=%d fil_other=%d\n",
- i, fil_fond, fil_harm1, fil_other);
- printf("%d pow_fond=%d pow_harm1=%d pow_other=%d cpt_filter=%d detected=%d\n",
- i, pow_fond, pow_harm1, pow_other, cpt_filter, detected);
-#else
- if (detected)
- LED_ON();
- else
- LED_OFF();
-
- /* when we receive, output a square signal at 625 hz */
- if ((detected == 1) && (i & 4))
- BUZZER_ON();
- else
- BUZZER_OFF();
-#endif
-}
-
/*
The CPU runs at 8Mhz.
Fe = 5Khz
*/
int main(void)
{
+ int8_t detected = 0;
int16_t i;
/* led and buzzer are outputs */
else if (cpt_filter > 0)
cpt_filter--;
- set_output(i);
+#ifdef HOST_VERSION
+ /* display values */
+ printf("%d fil_fond=%d fil_harm1=%d fil_other=%d\n",
+ i, fil_fond, fil_harm1, fil_other);
+ printf("%d pow_fond=%d pow_harm1=%d pow_other=%d "
+ "cpt_filter=%d detected=%d\n",
+ i, pow_fond, pow_harm1, pow_other, cpt_filter, detected);
+#else
+ if (detected)
+ LED_ON();
+ else
+ LED_OFF();
+
+ /* output a square signal at 625 hz if beacon is
+ * detected */
+ if ((detected == 1) && (i & 4))
+ BUZZER_ON();
+ else
+ BUZZER_OFF();
+
+#endif
i ++;
+
#ifdef HOST_VERSION
if (i >= sizeof(x))
break;