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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1310
68e172d9791e add missing files for the record
drewp <drewp@bigasterisk.com>
parents:
diff changeset
1 import nfc-nim/nfc, nfc-nim/freefare
68e172d9791e add missing files for the record
drewp <drewp@bigasterisk.com>
parents:
diff changeset
2
68e172d9791e add missing files for the record
drewp <drewp@bigasterisk.com>
parents:
diff changeset
3 var m = freefare.mad_new(0)
68e172d9791e add missing files for the record
drewp <drewp@bigasterisk.com>
parents:
diff changeset
4
68e172d9791e add missing files for the record
drewp <drewp@bigasterisk.com>
parents:
diff changeset
5 echo(freefare.mad_get_version(m))
68e172d9791e add missing files for the record
drewp <drewp@bigasterisk.com>
parents:
diff changeset
6
68e172d9791e add missing files for the record
drewp <drewp@bigasterisk.com>
parents:
diff changeset
7 freefare.mad_free(m)
68e172d9791e add missing files for the record
drewp <drewp@bigasterisk.com>
parents:
diff changeset
8 var context: ptr nfc.context
68e172d9791e add missing files for the record
drewp <drewp@bigasterisk.com>
parents:
diff changeset
9 nfc.init(addr context)
68e172d9791e add missing files for the record
drewp <drewp@bigasterisk.com>
parents:
diff changeset
10
68e172d9791e add missing files for the record
drewp <drewp@bigasterisk.com>
parents:
diff changeset
11 var connstrings: array[10, nfc.connstring]
68e172d9791e add missing files for the record
drewp <drewp@bigasterisk.com>
parents:
diff changeset
12 var n = nfc.list_devices(context, cast[ptr nfc.connstring](addr connstrings), len(connstrings))
68e172d9791e add missing files for the record
drewp <drewp@bigasterisk.com>
parents:
diff changeset
13 echo(n)
68e172d9791e add missing files for the record
drewp <drewp@bigasterisk.com>
parents:
diff changeset
14 #var dev = nfc.open(context, "pn532_i2c:/dev/i2c-1")
68e172d9791e add missing files for the record
drewp <drewp@bigasterisk.com>
parents:
diff changeset
15 #echo(device_get_last_error(dev))
68e172d9791e add missing files for the record
drewp <drewp@bigasterisk.com>
parents:
diff changeset
16
68e172d9791e add missing files for the record
drewp <drewp@bigasterisk.com>
parents:
diff changeset
17 #nfc.close(dev)
68e172d9791e add missing files for the record
drewp <drewp@bigasterisk.com>
parents:
diff changeset
18 nfc.exit(context)