unleashed-firmware/applications/external/nfc_magic/lib/magic/common.c
Avery 490447bbd4
NFC: Add support for Gen4 "ultimate card" in Magic app (#2238)
* NFC: gen4 gtu detect in magic app
* NFC: more support for GTU card
* NFC: Fix Gen1 in Magic
* Allow double UIDs for MFClassic on GTU cards
* NFC: Small magic app tweaks
* nfc magic: notify card event on wiping
* nfc magic: fix power consumption
* nfc magic: disable i2c writing and fix wipe loop
* NfcMagic: correct formatting in printf
* NfcMagic: correct formatting in printf, proper version
* nfc_magic: rework card found notification and gen4 wiping

Co-authored-by: あく <alleteam@gmail.com>
2023-05-26 02:01:02 +09:00

33 lines
No EOL
863 B
C

#include "common.h"
#include <furi_hal_nfc.h>
#define REQA (0x26)
#define CL1_PREFIX (0x93)
#define SELECT (0x70)
#define MAGIC_BUFFER_SIZE (32)
bool magic_activate() {
FuriHalNfcReturn ret = 0;
// Setup nfc poller
furi_hal_nfc_exit_sleep();
furi_hal_nfc_ll_txrx_on();
furi_hal_nfc_ll_poll();
ret = furi_hal_nfc_ll_set_mode(
FuriHalNfcModePollNfca, FuriHalNfcBitrate106, FuriHalNfcBitrate106);
if(ret != FuriHalNfcReturnOk) return false;
furi_hal_nfc_ll_set_fdt_listen(FURI_HAL_NFC_LL_FDT_LISTEN_NFCA_POLLER);
furi_hal_nfc_ll_set_fdt_poll(FURI_HAL_NFC_LL_FDT_POLL_NFCA_POLLER);
furi_hal_nfc_ll_set_error_handling(FuriHalNfcErrorHandlingNfc);
furi_hal_nfc_ll_set_guard_time(FURI_HAL_NFC_LL_GT_NFCA);
return true;
}
void magic_deactivate() {
furi_hal_nfc_ll_txrx_off();
furi_hal_nfc_sleep();
}