Mercurial > code > home > repos > homeauto
annotate service/rfid_pn532/freefare_demo.nim @ 1310:68e172d9791e
add missing files for the record
Ignore-this: 8541c95ef1644cf85b311259602d2892
darcs-hash:1e575d63deb747c9c320daa32f27f0ce93621afb
author | drewp <drewp@bigasterisk.com> |
---|---|
date | Sun, 21 Apr 2019 03:28:21 -0700 |
parents | |
children |
rev | line source |
---|---|
1310 | 1 import nfc-nim/nfc, nfc-nim/freefare |
2 | |
3 var m = freefare.mad_new(0) | |
4 | |
5 echo(freefare.mad_get_version(m)) | |
6 | |
7 freefare.mad_free(m) | |
8 var context: ptr nfc.context | |
9 nfc.init(addr context) | |
10 | |
11 var connstrings: array[10, nfc.connstring] | |
12 var n = nfc.list_devices(context, cast[ptr nfc.connstring](addr connstrings), len(connstrings)) | |
13 echo(n) | |
14 #var dev = nfc.open(context, "pn532_i2c:/dev/i2c-1") | |
15 #echo(device_get_last_error(dev)) | |
16 | |
17 #nfc.close(dev) | |
18 nfc.exit(context) |