Add ISO/IEC 14443B baud rates: 212, 424 and 847 kbps. Set a device error when using a not supported modulation baud rate in InListPassive().

This commit is contained in:
Romuald Conty 2010-10-06 10:06:12 +00:00
parent e03fb8a916
commit da7a2bc4c6
2 changed files with 40 additions and 9 deletions

View file

@ -162,9 +162,6 @@ typedef enum {
NDO_FORCE_ISO14443_A = 0x42,
} nfc_device_option_t;
////////////////////////////////////////////////////////////////////
// nfc_reader_list_passive - using InListPassiveTarget
/**
* @enum nfc_modulation_t
* @brief NFC modulation
@ -176,14 +173,20 @@ typedef enum {
NM_FELICA_212 = 0x01,
/** JIS X 6319-4 (Sony Felica) http://en.wikipedia.org/wiki/FeliCa */
NM_FELICA_424 = 0x02,
/** ISO14443-B http://en.wikipedia.org/wiki/ISO/IEC_14443 */
/** ISO14443-B http://en.wikipedia.org/wiki/ISO/IEC_14443 (Not supported by PN531) */
NM_ISO14443B_106 = 0x03,
/** Jewel Topaz (Innovision Research & Development) */
/** Jewel Topaz (Innovision Research & Development) (Not supported by PN531) */
NM_JEWEL_106 = 0x04,
/** ISO14443-B http://en.wikipedia.org/wiki/ISO/IEC_14443 (Not supported by PN531 nor PN532) */
NM_ISO14443B_212 = 0x06,
/** ISO14443-B http://en.wikipedia.org/wiki/ISO/IEC_14443 (Not supported by PN531 nor PN532) */
NM_ISO14443B_424 = 0x07,
/** ISO14443-B http://en.wikipedia.org/wiki/ISO/IEC_14443 (Not supported by PN531 nor PN532) */
NM_ISO14443B_847 = 0x08,
/** Active DEP */
NM_ACTIVE_DEP = 0x05,
NM_ACTIVE_DEP,
/** Passive DEP */
NM_PASSIVE_DEP = 0x06
NM_PASSIVE_DEP
} nfc_modulation_t;
/**

View file

@ -463,8 +463,36 @@ pn53x_InListPassiveTarget (nfc_device_t * pnd,
byte_t abtCmd[sizeof (pncmd_initiator_list_passive)];
memcpy (abtCmd, pncmd_initiator_list_passive, sizeof (pncmd_initiator_list_passive));
// FIXME PN531 doesn't support all available modulations
abtCmd[2] = szMaxTargets; // MaxTg
// XXX Is there is a better way to do this ?
switch(nmInitModulation) {
case NM_ISO14443A_106:
case NM_FELICA_212:
case NM_FELICA_424:
// all gone fine.
break;
case NM_ISO14443B_106:
case NM_JEWEL_106:
if(pnd->nc == NC_PN531) {
// These modulations are not supported by pn531
pnd->iLastError = DENOTSUP;
return false;
}
break;
case NM_ISO14443B_212:
case NM_ISO14443B_424:
case NM_ISO14443B_847:
if(pnd->nc != NC_PN533) {
// These modulations are not supported by pn531 neither pn532
pnd->iLastError = DENOTSUP;
return false;
}
break;
default:
pnd->iLastError = DENOTSUP;
return false;
}
abtCmd[3] = nmInitModulation; // BrTy, the type of init modulation used for polling a passive tag
// Set the optional initiator data (used for Felica, ISO14443B, Topaz Polling or for ISO14443A selecting a specific UID).