Implement LF RFID emulation (#208)

* migrate code from old repo, not work
* fix emulation
* disable irq handling while RFID emulating
* add testcase
This commit is contained in:
coreglitch
2020-10-28 14:38:04 +06:00
committed by GitHub
parent 665f6d7d9c
commit de968b13b4
6 changed files with 130 additions and 3 deletions

View File

@@ -48,6 +48,15 @@ struct Nfc {
#define EXAMPLE_NFCA_DEVICES 5
// TODO replace with pubsub
static bool isr_enabled = false;
void nfc_isr() {
if(isr_enabled) {
st25r3916Isr();
}
}
void nfc_worker_task(void* context) {
Nfc* nfc = context;
ReturnCode err;
@@ -61,6 +70,8 @@ void nfc_worker_task(void* context) {
nfc->ticker = 0;
isr_enabled = true;
while(widget_is_enabled(nfc->widget)) {
rfalFieldOff();
platformDelay(1000);
@@ -132,6 +143,7 @@ void nfc_worker_task(void* context) {
widget_update(nfc->widget);
}
isr_enabled = false;
rfalFieldOff();
rfalLowPowerModeStart();
nfc->ret = ERR_NONE;