diff --git a/software/tests/nfc_detect/Makefile b/software/tests/nfc_detect/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..85ec727e684a50f365c99e14c1fe9070ffefc40a --- /dev/null +++ b/software/tests/nfc_detect/Makefile @@ -0,0 +1 @@ +objs += main.o diff --git a/software/tests/nfc_detect/config b/software/tests/nfc_detect/config new file mode 100644 index 0000000000000000000000000000000000000000..6b422b8e1805227321961d755f3270b221f4275f --- /dev/null +++ b/software/tests/nfc_detect/config @@ -0,0 +1,11 @@ +%set OUTPUT_NAME nfc +%append MODULES $(OUTPUT_NAME):$(CONFIGPATH) + +CONFIG_MUTEK_THREAD +CONFIG_LICENSE_APP_BSD +CONFIG_APP_START +CONFIG_MUTEK_CONTEXT_SCHED + +%inherit bmaaa-pinky +%inherit nfc +%include bmaaa.build diff --git a/software/tests/nfc_detect/main.c b/software/tests/nfc_detect/main.c new file mode 100644 index 0000000000000000000000000000000000000000..3456ca0c744c932ccaf71a6fa1698220321daba6 --- /dev/null +++ b/software/tests/nfc_detect/main.c @@ -0,0 +1,38 @@ +#include +#include +#include + +#include + +static CONTEXT_ENTRY(nfc_main) +{ + error_t err; + struct device_nfc_s nfc; + struct dev_nfc_rq_s req; + struct dev_nfc_peer_s peer; + + req.peer = &peer; + peer.side = DEV_NFC_PASSIVE_PICC; + peer.protocol = DEV_NFC_14443A; + peer.atqa = 0; + + err = device_get_accessor_by_path(&nfc.base, NULL, "/nfc0", DRIVER_CLASS_NFC); + assert(!err); + + req.type = DEV_NFC_WRITE; + err = dev_nfc_wait_request(&nfc, &req); + assert(!err); + + req.type = DEV_NFC_READ; + err = dev_nfc_wait_request(&nfc, &req); + assert(!err); +} + +void app_start(void) +{ + struct thread_attr_s attr = { + .stack_size = 1024, + }; + + thread_create(nfc_main, 0, &attr); +}