Commit e48054c2 authored by Nicolas Pouillon's avatar Nicolas Pouillon

soft: Add NFC detect test

parent 714a7c19
%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
#include <mutek/startup.h>
#include <mutek/thread.h>
#include <mutek/printk.h>
#include <device/class/nfc.h>
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);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment