From edb62bd1cbed91e01e0662752c5221e40d774dd6 Mon Sep 17 00:00:00 2001 From: Romuald Conty Date: Fri, 23 Jul 2010 13:30:06 +0000 Subject: [PATCH] Create pn53x_InDeselect function. --- libnfc/chips/pn53x.c | 10 ++++++++++ libnfc/chips/pn53x.h | 3 ++- libnfc/nfc.c | 4 ++-- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/libnfc/chips/pn53x.c b/libnfc/chips/pn53x.c index 691a94a..b7a46e7 100644 --- a/libnfc/chips/pn53x.c +++ b/libnfc/chips/pn53x.c @@ -300,3 +300,13 @@ pn53x_InListPassiveTarget(const nfc_device_t* pnd, return false; } } + +bool +pn53x_InDeselect(const nfc_device_t* pnd, const uint8_t ui8Target) +{ + byte_t abtCmd[sizeof(pncmd_initiator_deselect)]; + memcpy(abtCmd,pncmd_initiator_deselect,sizeof(pncmd_initiator_deselect)); + abtCmd[2] = ui8Target; + + return(pn53x_transceive(pnd,abtCmd,sizeof(abtCmd),NULL,NULL)); +} \ No newline at end of file diff --git a/libnfc/chips/pn53x.h b/libnfc/chips/pn53x.h index 804ec0e..cc6ce59 100644 --- a/libnfc/chips/pn53x.h +++ b/libnfc/chips/pn53x.h @@ -1,7 +1,7 @@ /*- * Public platform independent Near Field Communication (NFC) library * - * Copyright (C) 2009, Roel Verdult + * Copyright (C) 2009, 2010, Roel Verdult, Romuald Conty * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by the @@ -79,6 +79,7 @@ bool pn53x_unwrap_frame(const byte_t* pbtFrame, const size_t szFrameBits, byte_t bool pn53x_decode_target_data(const byte_t* pbtRawData, size_t szDataLen, nfc_chip_t nc, nfc_target_type_t ntt, nfc_target_info_t* pnti); bool pn53x_InListPassiveTarget(const nfc_device_t* pnd, const nfc_modulation_t nmInitModulation, const byte_t szMaxTargets, const byte_t* pbtInitiatorData, const size_t szInitiatorDataLen, byte_t* pbtTargetsData, size_t* pszTargetsData); +bool pn53x_InDeselect(const nfc_device_t* pnd, const uint8_t ui8Target); #endif // __NFC_CHIPS_PN53X_H__ diff --git a/libnfc/nfc.c b/libnfc/nfc.c index 11ef4af..78284ab 100644 --- a/libnfc/nfc.c +++ b/libnfc/nfc.c @@ -53,7 +53,7 @@ extern const byte_t pncmd_rf_configure [ 14]; // extern const byte_t pncmd_initiator_list_passive [264]; extern const byte_t pncmd_initiator_jump_for_dep [ 68]; // extern const byte_t pncmd_initiator_select [ 3]; -extern const byte_t pncmd_initiator_deselect [ 3]; +// extern const byte_t pncmd_initiator_deselect [ 3]; // extern const byte_t pncmd_initiator_release [ 3]; // extern const byte_t pncmd_initiator_set_baud_rate [ 5]; extern const byte_t pncmd_initiator_exchange_data [265]; @@ -550,7 +550,7 @@ nfc_initiator_select_passive_target(const nfc_device_t* pnd, */ bool nfc_initiator_deselect_target(const nfc_device_t* pnd) { - return (pn53x_transceive(pnd,pncmd_initiator_deselect,3,NULL,NULL)); + return (pn53x_InDeselect(pnd, 0)); // 0 mean deselect all selected targets } /**