[FL-1442] Fix nfc emulation (#520)

* api-hal-nfc: rework nfc detection
* nfc: increase nfc detection timeout
* api-hal-nfc: add 2 emulation parameters for mifare and emv
* nfc: choose emulation parameters
This commit is contained in:
gornekich
2021-06-16 17:45:35 +03:00
committed by GitHub
parent 9e69164b1b
commit 9943c93189
5 changed files with 168 additions and 108 deletions

View File

@@ -24,7 +24,7 @@ void nfc_cli_detect(Cli* cli, string_t args, void* context) {
printf("Detecting nfc...\r\nPress Ctrl+C to abort\r\n");
while(!cmd_exit) {
cmd_exit |= cli_cmd_interrupt_received(cli);
cmd_exit |= api_hal_nfc_detect(&dev_list, &dev_cnt, 100, true);
cmd_exit |= api_hal_nfc_detect(&dev_list, &dev_cnt, 1000, true);
if(dev_cnt > 0) {
printf("Found %d devices\r\n", dev_cnt);
for(uint8_t i = 0; i < dev_cnt; i++) {
@@ -57,7 +57,7 @@ void nfc_cli_emulate(Cli* cli, string_t args, void* context) {
printf("Press Ctrl+C to abort\r\n");
while(!cli_cmd_interrupt_received(cli)) {
if(api_hal_nfc_listen(100)) {
if(api_hal_nfc_listen(ApiHalNfcEmulateParamsMifare, 100)) {
printf("Reader detected\r\n");
api_hal_nfc_deactivate();
}