Files
2019-11-15 10:21:40 +01:00

18 lines
535 B
C

#include "AntennaLevel.h"
#include "LEDHook.h"
#include "Application/Application.h"
#define FIELD_MIN_RSSI 500
void AntennaLevelTick(void) {
uint16_t rssi = AntennaLevelGet();
if (rssi < FIELD_MIN_RSSI) {
LEDHook(LED_FIELD_DETECTED, LED_OFF);
if (ActiveConfiguration.UidSize != 0) // this implies that we are emulating right now
ApplicationReset(); // reset the application just like a real card gets reset when there is no field
} else {
LEDHook(LED_FIELD_DETECTED, LED_ON);
}
}