LoGO progressive field: remove hacks, unneeded with revised initializations

This commit is contained in:
Philippe Teuwen 2011-05-05 12:45:56 +00:00
parent 64b036b129
commit 8dd8d25ef7
2 changed files with 7 additions and 38 deletions

View file

@ -571,39 +571,14 @@ On ASK LoGO hardware:
field by switching off the field on PN533 then set P34 to '0'.
*/
/* Set P30, P31, P33, P35, P34 to logic 1 and P32 to 0 logic */
/* ie. Switch LED1 on and turn on progressive field */
pn53x_write_register (pnd, SFR_P3, 0xFF, _BV (P30) | _BV (P31) | _BV (P33) | _BV (P34) | _BV (P35));
/* Set P30, P31, P33, P35 to logic 1 and P32, P34 to 0 logic */
/* ie. Switch LED1 on and turn off progressive field */
pn53x_write_register (pnd, SFR_P3, 0xFF, _BV (P30) | _BV (P31) | _BV (P33) | _BV (P35));
}
return true;
}
bool
pn53x_usb_initiator_select_passive_target (nfc_device_t * pnd,
const nfc_modulation_t nm,
const byte_t * pbtInitData, const size_t szInitData,
nfc_target_t * pnt)
{
if (nm.nmt == NMT_ISO14443B) {
if (DRIVER_DATA (pnd)->model == ASK_LOGO) {
/* Switch RF field off, progressive field off and LED2 off */
byte_t abtCmd[] = { RFConfiguration, RFCI_FIELD, 0x00 };
if (!pn53x_transceive (pnd, abtCmd, sizeof (abtCmd), NULL, NULL))
return false;
if (!pn53x_write_register (pnd, SFR_P3, _BV(P34) | _BV(P31), _BV(P31)))
return false;
/* Switch RF field on, progressive field on and LED2 on */
abtCmd[2] = 0x01;
if (!pn53x_transceive (pnd, abtCmd, sizeof (abtCmd), NULL, NULL))
return false;
if (!pn53x_write_register (pnd, SFR_P3, _BV(P34) | _BV(P31), _BV(P34)))
return false;
}
}
return (pn53x_initiator_select_passive_target (pnd, nm, pbtInitData, szInitData, pnt));
}
bool
pn53x_usb_configure (nfc_device_t * pnd, const nfc_device_option_t ndo, const bool bEnable)
{
@ -613,8 +588,9 @@ pn53x_usb_configure (nfc_device_t * pnd, const nfc_device_option_t ndo, const bo
switch (DRIVER_DATA (pnd)->model) {
case ASK_LOGO:
if (NDO_ACTIVATE_FIELD == ndo) {
/* Switch on/off LED2 according to ACTIVATE_FIELD option */
if (!pn53x_write_register (pnd, SFR_P3, _BV(P31), bEnable ? 0 : _BV (P31)))
/* Switch on/off LED2 and Progressive Field GPIO according to ACTIVATE_FIELD option */
DBG ("Switch progressive field %s", bEnable ? "On" : "Off");
if (!pn53x_write_register (pnd, SFR_P3, _BV(P31) | _BV(P34), bEnable ? _BV (P34) : _BV (P31)))
return false;
}
break;
@ -651,7 +627,7 @@ const struct nfc_driver_t pn53x_usb_driver = {
.strerror = pn53x_strerror,
.initiator_init = pn53x_initiator_init,
.initiator_select_passive_target = pn53x_usb_initiator_select_passive_target,
.initiator_select_passive_target = pn53x_initiator_select_passive_target,
.initiator_poll_targets = pn53x_initiator_poll_targets,
.initiator_select_dep_target = pn53x_initiator_select_dep_target,
.initiator_deselect_target = pn53x_initiator_deselect_target,

View file

@ -389,13 +389,6 @@ nfc_initiator_list_passive_targets (nfc_device_t * pnd,
while (nfc_initiator_select_passive_target (pnd, nm, pbtInitData, szInitDataLen, &nt)) {
nfc_initiator_deselect_target (pnd);
// some readers have to reset the RF field (e.g. LoGO) so we stop if we see more than once the same tag
if (nm.nmt == NMT_ISO14443B && szTargetFound >= 1) {
if (0 == memcmp(nt.nti.nbi.abtPupi, ant[0].nti.nbi.abtPupi, sizeof (nt.nti.nbi.abtPupi))) {
break;
}
}
if (szTargets > szTargetFound) {
memcpy (&(ant[szTargetFound]), &nt, sizeof (nfc_target_t));
} else {