Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#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);
}