Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ClusterM/flipperzero-firmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgornekich <44112859+gornekich@users.noreply.github.com>2021-03-12 16:18:01 +0300
committerGitHub <noreply@github.com>2021-03-12 16:18:01 +0300
commitca9862ef6c9f57ccc45c08a6f2d0f9827cea7479 (patch)
tree8e3cd76f9e25bcc8462a996dd5d013cdf55bbe79 /applications/nfc/nfc_worker.c
parent1daef3d025856b6695a646aa3c598b60233009cd (diff)
Nfc: add nfc detection cli command (#379)
Co-authored-by: あく <alleteam@gmail.com>
Diffstat (limited to 'applications/nfc/nfc_worker.c')
-rw-r--r--applications/nfc/nfc_worker.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/applications/nfc/nfc_worker.c b/applications/nfc/nfc_worker.c
index 88a3c5b3..657cf009 100644
--- a/applications/nfc/nfc_worker.c
+++ b/applications/nfc/nfc_worker.c
@@ -59,7 +59,9 @@ void nfc_worker_task(void* context) {
rfalLowPowerModeStop();
if(nfc_worker->state == NfcWorkerStatePoll) {
- nfc_worker_poll(nfc_worker);
+ nfc_worker_poll(nfc_worker, 0);
+ } else if(nfc_worker->state == NfcWorkerStatePollOnce) {
+ nfc_worker_poll(nfc_worker, 5);
} else if(nfc_worker->state == NfcWorkerStateEmulate) {
nfc_worker_emulate(nfc_worker);
} else if(nfc_worker->state == NfcWorkerStateField) {
@@ -73,15 +75,17 @@ void nfc_worker_task(void* context) {
osThreadExit();
}
-void nfc_worker_poll(NfcWorker* nfc_worker) {
- while(nfc_worker->state == NfcWorkerStatePoll) {
+void nfc_worker_poll(NfcWorker* nfc_worker, uint8_t cycles) {
+ while((nfc_worker->state == NfcWorkerStatePoll) ||
+ ((nfc_worker->state == NfcWorkerStatePollOnce) && cycles)) {
bool is_found = false;
is_found |= nfc_worker_nfca_poll(nfc_worker);
is_found |= nfc_worker_nfcb_poll(nfc_worker);
is_found |= nfc_worker_nfcf_poll(nfc_worker);
is_found |= nfc_worker_nfcv_poll(nfc_worker);
rfalFieldOff();
- if(!is_found) {
+ cycles--;
+ if((!is_found) && (!cycles)) {
NfcMessage message;
message.type = NfcMessageTypeDeviceNotFound;
furi_check(