def __init__(self, chipset):
self.chipset = chipset
# perform a communication line test
if self.chipset.diagnose("line", "nfcpy") is not True:
raise IOError(errno.EIO, os.strerror(errno.EIO))
self._vendor_name = "NXP"
self._device_name = self.chipset.ic
RWT_WTX = {'PN531': (14, 7), "PN532": (14, 7), "PN533": (8, 1)}
rwt, wtx = RWT_WTX[self.chipset.ic]
# set ATR_RES timeout: 102.4 ms, non-DEP: 51.2 ms)
atr_res_to = 11 # T = 100 * 2^(x-1) s
non_dep_to = 10 # T = 100 * 2^(x-1) s
log.debug("ATR_RES timeout: {0:7.1f} ms".format(0.1*2**(atr_res_to-1)))
log.debug("non-DEP timeout: {0:7.1f} ms".format(0.1*2**(non_dep_to-1)))
atr_res_to = chr(atr_res_to); non_dep_to = chr(non_dep_to)
self.chipset.rf_configuration(0x02, chr(11) + atr_res_to + non_dep_to)
# retries for ATR_REQ, PSL_REQ, target activation
log.debug("set retries: ATR_REQ=2 PSL_REQ=1 PassiveTarget=3")
self.chipset.rf_configuration(0x05, "\x02\x01\x03")
评论列表
文章目录