ASK LoGO: enable progressive field feature.

This commit is contained in:
Romuald Conty 2011-04-04 09:53:33 +00:00
parent 71c400ae14
commit b21d3c6728
2 changed files with 30 additions and 4 deletions

View file

@ -187,4 +187,13 @@ static const pn53x_command pn53x_commands[] = {
PNCMD( TgGetTargetStatus, PN531|PN532|PN533 ), PNCMD( TgGetTargetStatus, PN531|PN532|PN533 ),
}; };
#define _BV( X ) (1 << X)
#define P30 0
#define P31 1
#define P32 2
#define P33 3
#define P34 4
#define P35 5
#endif /* __PN53X_INTERNAL_H__ */ #endif /* __PN53X_INTERNAL_H__ */

View file

@ -547,14 +547,31 @@ On ASK LoGO hardware:
field by switching off the field on PN533 then set P34 to '0'. field by switching off the field on PN533 then set P34 to '0'.
*/ */
/* Set P30, P31, P33, P34, P35 to logic 1 and P32 to 0 logic */ /* Set P30, P31, P33, P35 to logic 1 and P32, P34 to 0 logic */
/* ie. Switch LED1 on */ /* ie. Switch LED1 on and turn off progressive field */
pn53x_write_register (pnd, SFR_P3, 0xFF, 0x3B); pn53x_write_register (pnd, SFR_P3, 0xFF, _BV (P30) | _BV (P31) | _BV (P33) | _BV (P35));
} }
return true; return true;
} }
bool
pn53x_usb_configure (nfc_device_t * pnd, const nfc_device_option_t ndo, const bool bEnable)
{
if (!pn53x_configure (pnd, ndo, bEnable))
return false;
if (ASK_LOGO == DRIVER_DATA (pnd)->model) {
if (NDO_ACTIVATE_FIELD == ndo) {
// Switch on/off progressive field according to ACTIVATE_FIELD option
DBG ("Switch progressive field %s", bEnable ? "On" : "Off");
if (!pn53x_write_register (pnd, SFR_P3, _BV (P34), bEnable ? 0xff : 0x00))
return false;
}
}
return true;
}
const struct pn53x_io pn53x_usb_io = { const struct pn53x_io pn53x_usb_io = {
.send = pn53x_usb_send, .send = pn53x_usb_send,
.receive = pn53x_usb_receive, .receive = pn53x_usb_receive,
@ -581,5 +598,5 @@ const struct nfc_driver_t pn53x_usb_driver = {
.target_send_bits = pn53x_target_send_bits, .target_send_bits = pn53x_target_send_bits,
.target_receive_bits = pn53x_target_receive_bits, .target_receive_bits = pn53x_target_receive_bits,
.configure = pn53x_configure, .configure = pn53x_usb_configure,
}; };