RFAL library for the STMicroelectronics X-NUCLEO-NFC05A1

Dependents:   mbed-os-nfc05a1

Committer:
DiegoOstuni
Date:
Thu Nov 14 14:34:50 2019 +0000
Revision:
0:75fc82583a41
Add files

Who changed what in which revision?

UserRevisionLine numberNew contents of line
DiegoOstuni 0:75fc82583a41 1
DiegoOstuni 0:75fc82583a41 2 /******************************************************************************
DiegoOstuni 0:75fc82583a41 3 * @attention
DiegoOstuni 0:75fc82583a41 4 *
DiegoOstuni 0:75fc82583a41 5 * <h2><center>&copy; COPYRIGHT 2016 STMicroelectronics</center></h2>
DiegoOstuni 0:75fc82583a41 6 *
DiegoOstuni 0:75fc82583a41 7 * Licensed under ST MYLIBERTY SOFTWARE LICENSE AGREEMENT (the "License");
DiegoOstuni 0:75fc82583a41 8 * You may not use this file except in compliance with the License.
DiegoOstuni 0:75fc82583a41 9 * You may obtain a copy of the License at:
DiegoOstuni 0:75fc82583a41 10 *
DiegoOstuni 0:75fc82583a41 11 * http://www.st.com/myliberty
DiegoOstuni 0:75fc82583a41 12 *
DiegoOstuni 0:75fc82583a41 13 * Unless required by applicable law or agreed to in writing, software
DiegoOstuni 0:75fc82583a41 14 * distributed under the License is distributed on an "AS IS" BASIS,
DiegoOstuni 0:75fc82583a41 15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
DiegoOstuni 0:75fc82583a41 16 * AND SPECIFICALLY DISCLAIMING THE IMPLIED WARRANTIES OF MERCHANTABILITY,
DiegoOstuni 0:75fc82583a41 17 * FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
DiegoOstuni 0:75fc82583a41 18 * See the License for the specific language governing permissions and
DiegoOstuni 0:75fc82583a41 19 * limitations under the License.
DiegoOstuni 0:75fc82583a41 20 *
DiegoOstuni 0:75fc82583a41 21 ******************************************************************************/
DiegoOstuni 0:75fc82583a41 22
DiegoOstuni 0:75fc82583a41 23 /*
DiegoOstuni 0:75fc82583a41 24 * PROJECT: ST25R391x firmware
DiegoOstuni 0:75fc82583a41 25 * $Revision: $
DiegoOstuni 0:75fc82583a41 26 * LANGUAGE: ISO C99
DiegoOstuni 0:75fc82583a41 27 */
DiegoOstuni 0:75fc82583a41 28
DiegoOstuni 0:75fc82583a41 29 /*! \file rfal_nfcb.c
DiegoOstuni 0:75fc82583a41 30 *
DiegoOstuni 0:75fc82583a41 31 * \author Gustavo Patricio
DiegoOstuni 0:75fc82583a41 32 *
DiegoOstuni 0:75fc82583a41 33 * \brief Implementation of NFC-B (ISO14443B) helpers
DiegoOstuni 0:75fc82583a41 34 *
DiegoOstuni 0:75fc82583a41 35 */
DiegoOstuni 0:75fc82583a41 36
DiegoOstuni 0:75fc82583a41 37 /*
DiegoOstuni 0:75fc82583a41 38 ******************************************************************************
DiegoOstuni 0:75fc82583a41 39 * INCLUDES
DiegoOstuni 0:75fc82583a41 40 ******************************************************************************
DiegoOstuni 0:75fc82583a41 41 */
DiegoOstuni 0:75fc82583a41 42 #include <platform1.h>
DiegoOstuni 0:75fc82583a41 43 #include "rfal_nfcb.h"
DiegoOstuni 0:75fc82583a41 44 #include "utils.h"
DiegoOstuni 0:75fc82583a41 45
DiegoOstuni 0:75fc82583a41 46
DiegoOstuni 0:75fc82583a41 47 /*
DiegoOstuni 0:75fc82583a41 48 ******************************************************************************
DiegoOstuni 0:75fc82583a41 49 * ENABLE SWITCH
DiegoOstuni 0:75fc82583a41 50 ******************************************************************************
DiegoOstuni 0:75fc82583a41 51 */
DiegoOstuni 0:75fc82583a41 52
DiegoOstuni 0:75fc82583a41 53 #ifndef RFAL_FEATURE_NFCB
DiegoOstuni 0:75fc82583a41 54 #error " RFAL: Module configuration missing. Please enable/disable NFC-B module by setting: RFAL_FEATURE_NFCB "
DiegoOstuni 0:75fc82583a41 55 #endif
DiegoOstuni 0:75fc82583a41 56
DiegoOstuni 0:75fc82583a41 57 #if RFAL_FEATURE_NFCB
DiegoOstuni 0:75fc82583a41 58
DiegoOstuni 0:75fc82583a41 59 /*
DiegoOstuni 0:75fc82583a41 60 ******************************************************************************
DiegoOstuni 0:75fc82583a41 61 * GLOBAL DEFINES
DiegoOstuni 0:75fc82583a41 62 ******************************************************************************
DiegoOstuni 0:75fc82583a41 63 */
DiegoOstuni 0:75fc82583a41 64
DiegoOstuni 0:75fc82583a41 65 #define RFAL_NFCB_SENSB_REQ_EXT_SENSB_RES_SUPPORTED 0x10 /*!< Bit mask for Extended SensB Response support in SENSB_REQ */
DiegoOstuni 0:75fc82583a41 66 #define RFAL_NFCB_SENSB_RES_PROT_TYPE_RFU 0x08 /*!< Bit mask for Protocol Type RFU in SENSB_RES */
DiegoOstuni 0:75fc82583a41 67 #define RFAL_NFCB_SLOT_MARKER_SC_SHIFT 4 /*!< Slot Code position on SLOT_MARKER APn */
DiegoOstuni 0:75fc82583a41 68
DiegoOstuni 0:75fc82583a41 69 #define RFAL_NFCB_SLOTMARKER_SLOTCODE_MIN 1 /*!< SLOT_MARKER Slot Code minimum Digital 1.1 Table 37 */
DiegoOstuni 0:75fc82583a41 70 #define RFAL_NFCB_SLOTMARKER_SLOTCODE_MAX 16 /*!< SLOT_MARKER Slot Code maximum Digital 1.1 Table 37 */
DiegoOstuni 0:75fc82583a41 71
DiegoOstuni 0:75fc82583a41 72 #define RFAL_NFCB_ACTIVATION_FWT (RFAL_NFCB_FWTSENSB + RFAL_NFCB_DFWT_10) /*!< FWT(SENSB) + dFWT Digital 1.1 7.9.1.5 */
DiegoOstuni 0:75fc82583a41 73
DiegoOstuni 0:75fc82583a41 74 /*! Advanced and Extended bit mask in Parameter of SENSB_REQ */
DiegoOstuni 0:75fc82583a41 75 #define RFAL_NFCB_SENSB_REQ_PARAM (RFAL_NFCB_SENSB_REQ_ADV_FEATURE | RFAL_NFCB_SENSB_REQ_EXT_SENSB_RES_SUPPORTED)
DiegoOstuni 0:75fc82583a41 76
DiegoOstuni 0:75fc82583a41 77
DiegoOstuni 0:75fc82583a41 78 /*! NFC-B commands definition */
DiegoOstuni 0:75fc82583a41 79 static enum
DiegoOstuni 0:75fc82583a41 80 {
DiegoOstuni 0:75fc82583a41 81 RFAL_NFCB_CMD_SENSB_REQ = 0x05, /*!< SENSB_REQ (REQB) & SLOT_MARKER Digital 1.1 Table 24 */
DiegoOstuni 0:75fc82583a41 82 RFAL_NFCB_CMD_SENSB_RES = 0x50, /*!< SENSB_RES (ATQB) & SLOT_MARKER Digital 1.1 Table 27 */
DiegoOstuni 0:75fc82583a41 83 RFAL_NFCB_CMD_SLPB_REQ = 0x50, /*!< SLPB_REQ (HLTB command) Digital 1.1 Table 38 */
DiegoOstuni 0:75fc82583a41 84 RFAL_NFCB_CMD_SLPB_RES = 0x00 /*!< SLPB_RES (HLTB Answer) Digital 1.1 Table 39 */
DiegoOstuni 0:75fc82583a41 85 }rfalCmd;
DiegoOstuni 0:75fc82583a41 86
DiegoOstuni 0:75fc82583a41 87 /*
DiegoOstuni 0:75fc82583a41 88 ******************************************************************************
DiegoOstuni 0:75fc82583a41 89 * GLOBAL MACROS
DiegoOstuni 0:75fc82583a41 90 ******************************************************************************
DiegoOstuni 0:75fc82583a41 91 */
DiegoOstuni 0:75fc82583a41 92
DiegoOstuni 0:75fc82583a41 93 #define rfalNfcbNI2NumberOfSlots( ni ) (1 << ni) /*!< Converts the Number of slots Identifier to slot number*/
DiegoOstuni 0:75fc82583a41 94
DiegoOstuni 0:75fc82583a41 95 /*
DiegoOstuni 0:75fc82583a41 96 ******************************************************************************
DiegoOstuni 0:75fc82583a41 97 * GLOBAL TYPES
DiegoOstuni 0:75fc82583a41 98 ******************************************************************************
DiegoOstuni 0:75fc82583a41 99 */
DiegoOstuni 0:75fc82583a41 100
DiegoOstuni 0:75fc82583a41 101 /*! ALLB_REQ (WUPB) and SENSB_REQ (REQB) Command Format Digital 1.1 7.6.1 */
DiegoOstuni 0:75fc82583a41 102 typedef struct
DiegoOstuni 0:75fc82583a41 103 {
DiegoOstuni 0:75fc82583a41 104 uint8_t cmd; /*!< xxxxB_REQ: 05h */
DiegoOstuni 0:75fc82583a41 105 uint8_t AFI; /*!< NFC Identifier */
DiegoOstuni 0:75fc82583a41 106 uint8_t PARAM; /*!< Application Data */
DiegoOstuni 0:75fc82583a41 107 } rfalNfcbSensbReq;
DiegoOstuni 0:75fc82583a41 108
DiegoOstuni 0:75fc82583a41 109 /*! SLOT_MARKER Command format Digital 1.1 7.7.1 */
DiegoOstuni 0:75fc82583a41 110 typedef struct
DiegoOstuni 0:75fc82583a41 111 {
DiegoOstuni 0:75fc82583a41 112 uint8_t APn; /*!< Slot number 2..16 | 0101b */
DiegoOstuni 0:75fc82583a41 113 } rfalNfcbSlotMarker;
DiegoOstuni 0:75fc82583a41 114
DiegoOstuni 0:75fc82583a41 115 /*! SLPB_REQ (HLTB) Command Format Digital 1.1 7.8.1 */
DiegoOstuni 0:75fc82583a41 116 typedef struct
DiegoOstuni 0:75fc82583a41 117 {
DiegoOstuni 0:75fc82583a41 118 uint8_t cmd; /*!< SLPB_REQ: 50h */
DiegoOstuni 0:75fc82583a41 119 uint8_t nfcid0[RFAL_NFCB_NFCID0_LEN]; /*!< NFC Identifier (PUPI)*/
DiegoOstuni 0:75fc82583a41 120 } rfalNfcbSlpbReq;
DiegoOstuni 0:75fc82583a41 121
DiegoOstuni 0:75fc82583a41 122
DiegoOstuni 0:75fc82583a41 123 /*! SLPB_RES (HLTB) Response Format Digital 1.1 7.8.2 */
DiegoOstuni 0:75fc82583a41 124 typedef struct
DiegoOstuni 0:75fc82583a41 125 {
DiegoOstuni 0:75fc82583a41 126 uint8_t cmd; /*!< SLPB_RES: 00h */
DiegoOstuni 0:75fc82583a41 127 } rfalNfcbSlpbRes;
DiegoOstuni 0:75fc82583a41 128
DiegoOstuni 0:75fc82583a41 129
DiegoOstuni 0:75fc82583a41 130 /*! RFAL NFC-B instance */
DiegoOstuni 0:75fc82583a41 131 typedef struct
DiegoOstuni 0:75fc82583a41 132 {
DiegoOstuni 0:75fc82583a41 133 uint8_t AFI; /*!< AFI to be used */
DiegoOstuni 0:75fc82583a41 134 uint8_t PARAM; /*!< PARAM to be used */
DiegoOstuni 0:75fc82583a41 135 } rfalNfcb;
DiegoOstuni 0:75fc82583a41 136
DiegoOstuni 0:75fc82583a41 137 /*
DiegoOstuni 0:75fc82583a41 138 ******************************************************************************
DiegoOstuni 0:75fc82583a41 139 * LOCAL FUNCTION PROTOTYPES
DiegoOstuni 0:75fc82583a41 140 ******************************************************************************
DiegoOstuni 0:75fc82583a41 141 */
DiegoOstuni 0:75fc82583a41 142 static ReturnCode rfalNfcbCheckSensbRes( rfalNfcbSensbRes *sensbRes, uint8_t sensbResLen );
DiegoOstuni 0:75fc82583a41 143
DiegoOstuni 0:75fc82583a41 144
DiegoOstuni 0:75fc82583a41 145 /*
DiegoOstuni 0:75fc82583a41 146 ******************************************************************************
DiegoOstuni 0:75fc82583a41 147 * LOCAL VARIABLES
DiegoOstuni 0:75fc82583a41 148 ******************************************************************************
DiegoOstuni 0:75fc82583a41 149 */
DiegoOstuni 0:75fc82583a41 150 /*! TR2 Table according to Digital 1.1 Table 33 */
DiegoOstuni 0:75fc82583a41 151 static const uint16_t rfalNfcbTr2Table[] = { 1792, 3328, 5376, 9472 };
DiegoOstuni 0:75fc82583a41 152
DiegoOstuni 0:75fc82583a41 153 rfalNfcb gRfalNfcb; /*!< RFAL NFC-B Instance */
DiegoOstuni 0:75fc82583a41 154
DiegoOstuni 0:75fc82583a41 155
DiegoOstuni 0:75fc82583a41 156 /*
DiegoOstuni 0:75fc82583a41 157 ******************************************************************************
DiegoOstuni 0:75fc82583a41 158 * LOCAL FUNCTIONS
DiegoOstuni 0:75fc82583a41 159 ******************************************************************************
DiegoOstuni 0:75fc82583a41 160 */
DiegoOstuni 0:75fc82583a41 161
DiegoOstuni 0:75fc82583a41 162 /*******************************************************************************/
DiegoOstuni 0:75fc82583a41 163 static ReturnCode rfalNfcbCheckSensbRes( rfalNfcbSensbRes *sensbRes, uint8_t sensbResLen )
DiegoOstuni 0:75fc82583a41 164 {
DiegoOstuni 0:75fc82583a41 165 /* Check response length */
DiegoOstuni 0:75fc82583a41 166 if( ( (sensbResLen != RFAL_NFCB_SENSB_RES_LEN) && (sensbResLen != RFAL_NFCB_SENSB_RES_EXT_LEN) ) )
DiegoOstuni 0:75fc82583a41 167 {
DiegoOstuni 0:75fc82583a41 168 return ERR_PROTO;
DiegoOstuni 0:75fc82583a41 169 }
DiegoOstuni 0:75fc82583a41 170
DiegoOstuni 0:75fc82583a41 171 /* Check SENSB_RES and Protocol Type Digital 1.1 7.6.2.19 */
DiegoOstuni 0:75fc82583a41 172 if( (sensbRes->protInfo.FsciProType & RFAL_NFCB_SENSB_RES_PROT_TYPE_RFU) || (sensbRes->cmd != RFAL_NFCB_CMD_SENSB_RES) )
DiegoOstuni 0:75fc82583a41 173 {
DiegoOstuni 0:75fc82583a41 174 return ERR_PROTO;
DiegoOstuni 0:75fc82583a41 175 }
DiegoOstuni 0:75fc82583a41 176 return ERR_NONE;
DiegoOstuni 0:75fc82583a41 177 }
DiegoOstuni 0:75fc82583a41 178
DiegoOstuni 0:75fc82583a41 179 /*
DiegoOstuni 0:75fc82583a41 180 ******************************************************************************
DiegoOstuni 0:75fc82583a41 181 * GLOBAL FUNCTIONS
DiegoOstuni 0:75fc82583a41 182 ******************************************************************************
DiegoOstuni 0:75fc82583a41 183 */
DiegoOstuni 0:75fc82583a41 184
DiegoOstuni 0:75fc82583a41 185 /*******************************************************************************/
DiegoOstuni 0:75fc82583a41 186 ReturnCode rfalNfcbPollerInitialize( SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 )
DiegoOstuni 0:75fc82583a41 187 {
DiegoOstuni 0:75fc82583a41 188 ReturnCode ret;
DiegoOstuni 0:75fc82583a41 189
DiegoOstuni 0:75fc82583a41 190 EXIT_ON_ERR( ret, rfalSetMode( RFAL_MODE_POLL_NFCB, RFAL_BR_106, RFAL_BR_106, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) );
DiegoOstuni 0:75fc82583a41 191 rfalSetErrorHandling( RFAL_ERRORHANDLING_NFC );
DiegoOstuni 0:75fc82583a41 192
DiegoOstuni 0:75fc82583a41 193 rfalSetGT( RFAL_GT_NFCB );
DiegoOstuni 0:75fc82583a41 194 rfalSetFDTListen( RFAL_FDT_LISTEN_NFCB_POLLER );
DiegoOstuni 0:75fc82583a41 195 rfalSetFDTPoll( RFAL_FDT_POLL_NFCB_POLLER );
DiegoOstuni 0:75fc82583a41 196
DiegoOstuni 0:75fc82583a41 197 gRfalNfcb.AFI = RFAL_NFCB_AFI;
DiegoOstuni 0:75fc82583a41 198 gRfalNfcb.PARAM = RFAL_NFCB_PARAM;
DiegoOstuni 0:75fc82583a41 199
DiegoOstuni 0:75fc82583a41 200 return ERR_NONE;
DiegoOstuni 0:75fc82583a41 201 }
DiegoOstuni 0:75fc82583a41 202
DiegoOstuni 0:75fc82583a41 203 /*******************************************************************************/
DiegoOstuni 0:75fc82583a41 204 ReturnCode rfalNfcbPollerInitializeWithParams( uint8_t AFI, uint8_t PARAM, SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 )
DiegoOstuni 0:75fc82583a41 205 {
DiegoOstuni 0:75fc82583a41 206 ReturnCode ret;
DiegoOstuni 0:75fc82583a41 207
DiegoOstuni 0:75fc82583a41 208 EXIT_ON_ERR( ret, rfalNfcbPollerInitialize( mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) );
DiegoOstuni 0:75fc82583a41 209
DiegoOstuni 0:75fc82583a41 210 gRfalNfcb.AFI = AFI;
DiegoOstuni 0:75fc82583a41 211 gRfalNfcb.PARAM = (PARAM & RFAL_NFCB_SENSB_REQ_PARAM);
DiegoOstuni 0:75fc82583a41 212
DiegoOstuni 0:75fc82583a41 213 return ERR_NONE;
DiegoOstuni 0:75fc82583a41 214 }
DiegoOstuni 0:75fc82583a41 215
DiegoOstuni 0:75fc82583a41 216
DiegoOstuni 0:75fc82583a41 217 /*******************************************************************************/
DiegoOstuni 0:75fc82583a41 218 ReturnCode rfalNfcbPollerCheckPresence( rfalNfcbSensCmd cmd, rfalNfcbSlots slots, rfalNfcbSensbRes *sensbRes, uint8_t *sensbResLen, SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 )
DiegoOstuni 0:75fc82583a41 219 {
DiegoOstuni 0:75fc82583a41 220 uint16_t rxLen;
DiegoOstuni 0:75fc82583a41 221 ReturnCode ret;
DiegoOstuni 0:75fc82583a41 222 rfalNfcbSensbReq sensbReq;
DiegoOstuni 0:75fc82583a41 223
DiegoOstuni 0:75fc82583a41 224
DiegoOstuni 0:75fc82583a41 225 /* Check if the command requested and given the slot number are valid */
DiegoOstuni 0:75fc82583a41 226 if( ((RFAL_NFCB_SENS_CMD_SENSB_REQ != cmd) && (RFAL_NFCB_SENS_CMD_ALLB_REQ != cmd)) ||
DiegoOstuni 0:75fc82583a41 227 (slots > RFAL_NFCB_SLOT_NUM_16) || (sensbRes == NULL) || (sensbResLen == NULL) )
DiegoOstuni 0:75fc82583a41 228 {
DiegoOstuni 0:75fc82583a41 229 return ERR_PARAM;
DiegoOstuni 0:75fc82583a41 230 }
DiegoOstuni 0:75fc82583a41 231
DiegoOstuni 0:75fc82583a41 232 *sensbResLen = 0;
DiegoOstuni 0:75fc82583a41 233 ST_MEMSET(sensbRes, 0x00, sizeof(rfalNfcbSensbRes) );
DiegoOstuni 0:75fc82583a41 234
DiegoOstuni 0:75fc82583a41 235 /* Compute SENSB_REQ */
DiegoOstuni 0:75fc82583a41 236 sensbReq.cmd = RFAL_NFCB_CMD_SENSB_REQ;
DiegoOstuni 0:75fc82583a41 237 sensbReq.AFI = gRfalNfcb.AFI;
DiegoOstuni 0:75fc82583a41 238 sensbReq.PARAM = ((gRfalNfcb.PARAM & RFAL_NFCB_SENSB_REQ_PARAM) | cmd | slots);
DiegoOstuni 0:75fc82583a41 239
DiegoOstuni 0:75fc82583a41 240 /* Send SENSB_REQ and disable AGC to detect collisions */
DiegoOstuni 0:75fc82583a41 241 ret = rfalTransceiveBlockingTxRx( (uint8_t*)&sensbReq, sizeof(rfalNfcbSensbReq), (uint8_t*)sensbRes, sizeof(rfalNfcbSensbRes), &rxLen, RFAL_TXRX_FLAGS_DEFAULT, RFAL_NFCB_FWTSENSB, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:75fc82583a41 242 *sensbResLen = rxLen;
DiegoOstuni 0:75fc82583a41 243
DiegoOstuni 0:75fc82583a41 244 /* Check if a transmission error was detected */
DiegoOstuni 0:75fc82583a41 245 if( (ret == ERR_CRC) || (ret == ERR_FRAMING) )
DiegoOstuni 0:75fc82583a41 246 {
DiegoOstuni 0:75fc82583a41 247 /* Invalidate received frame as an error was detected (CollisionResolution checks if valid) */
DiegoOstuni 0:75fc82583a41 248 *sensbResLen = 0;
DiegoOstuni 0:75fc82583a41 249 return ERR_NONE;
DiegoOstuni 0:75fc82583a41 250 }
DiegoOstuni 0:75fc82583a41 251
DiegoOstuni 0:75fc82583a41 252 if( ret == ERR_NONE )
DiegoOstuni 0:75fc82583a41 253 {
DiegoOstuni 0:75fc82583a41 254 return rfalNfcbCheckSensbRes( sensbRes, *sensbResLen );
DiegoOstuni 0:75fc82583a41 255 }
DiegoOstuni 0:75fc82583a41 256
DiegoOstuni 0:75fc82583a41 257 return ret;
DiegoOstuni 0:75fc82583a41 258 }
DiegoOstuni 0:75fc82583a41 259
DiegoOstuni 0:75fc82583a41 260
DiegoOstuni 0:75fc82583a41 261 /*******************************************************************************/
DiegoOstuni 0:75fc82583a41 262 ReturnCode rfalNfcbPollerSleep( uint8_t* nfcid0, SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 )
DiegoOstuni 0:75fc82583a41 263 {
DiegoOstuni 0:75fc82583a41 264 uint16_t rxLen;
DiegoOstuni 0:75fc82583a41 265 ReturnCode ret;
DiegoOstuni 0:75fc82583a41 266 rfalNfcbSlpbReq slpbReq;
DiegoOstuni 0:75fc82583a41 267 rfalNfcbSlpbRes slpbRes;
DiegoOstuni 0:75fc82583a41 268
DiegoOstuni 0:75fc82583a41 269 if( nfcid0 == NULL )
DiegoOstuni 0:75fc82583a41 270 {
DiegoOstuni 0:75fc82583a41 271 return ERR_PARAM;
DiegoOstuni 0:75fc82583a41 272 }
DiegoOstuni 0:75fc82583a41 273
DiegoOstuni 0:75fc82583a41 274 /* Compute SLPB_REQ */
DiegoOstuni 0:75fc82583a41 275 slpbReq.cmd = RFAL_NFCB_CMD_SLPB_REQ;
DiegoOstuni 0:75fc82583a41 276 ST_MEMCPY( slpbReq.nfcid0, nfcid0, RFAL_NFCB_NFCID0_LEN );
DiegoOstuni 0:75fc82583a41 277
DiegoOstuni 0:75fc82583a41 278 EXIT_ON_ERR( ret, rfalTransceiveBlockingTxRx( (uint8_t*)&slpbReq, sizeof(rfalNfcbSlpbReq), (uint8_t*)&slpbRes, sizeof(rfalNfcbSlpbRes), &rxLen, RFAL_TXRX_FLAGS_DEFAULT, RFAL_NFCB_ACTIVATION_FWT, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) );
DiegoOstuni 0:75fc82583a41 279
DiegoOstuni 0:75fc82583a41 280 /* Check SLPB_RES */
DiegoOstuni 0:75fc82583a41 281 if( (rxLen != sizeof(rfalNfcbSlpbRes)) || (slpbRes.cmd != RFAL_NFCB_CMD_SLPB_RES) )
DiegoOstuni 0:75fc82583a41 282 {
DiegoOstuni 0:75fc82583a41 283 return ERR_PROTO;
DiegoOstuni 0:75fc82583a41 284 }
DiegoOstuni 0:75fc82583a41 285 return ERR_NONE;
DiegoOstuni 0:75fc82583a41 286 }
DiegoOstuni 0:75fc82583a41 287
DiegoOstuni 0:75fc82583a41 288
DiegoOstuni 0:75fc82583a41 289 /*******************************************************************************/
DiegoOstuni 0:75fc82583a41 290 ReturnCode rfalNfcbPollerSlotMarker( uint8_t slotCode, rfalNfcbSensbRes *sensbRes, uint8_t *sensbResLen, SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 )
DiegoOstuni 0:75fc82583a41 291 {
DiegoOstuni 0:75fc82583a41 292 ReturnCode ret;
DiegoOstuni 0:75fc82583a41 293 rfalNfcbSlotMarker slotMarker;
DiegoOstuni 0:75fc82583a41 294 uint16_t rxLen;
DiegoOstuni 0:75fc82583a41 295
DiegoOstuni 0:75fc82583a41 296 /* Check parameters */
DiegoOstuni 0:75fc82583a41 297 if( (sensbRes == NULL) || (sensbResLen == NULL) ||
DiegoOstuni 0:75fc82583a41 298 (slotCode < RFAL_NFCB_SLOTMARKER_SLOTCODE_MIN) ||
DiegoOstuni 0:75fc82583a41 299 (slotCode > RFAL_NFCB_SLOTMARKER_SLOTCODE_MAX) )
DiegoOstuni 0:75fc82583a41 300 {
DiegoOstuni 0:75fc82583a41 301 return ERR_PARAM;
DiegoOstuni 0:75fc82583a41 302 }
DiegoOstuni 0:75fc82583a41 303 /* Compose and send SLOT_MARKER with disabled AGC to detect collisions */
DiegoOstuni 0:75fc82583a41 304 slotMarker.APn = ((slotCode << RFAL_NFCB_SLOT_MARKER_SC_SHIFT) | RFAL_NFCB_CMD_SENSB_REQ);
DiegoOstuni 0:75fc82583a41 305
DiegoOstuni 0:75fc82583a41 306 ret = rfalTransceiveBlockingTxRx( (uint8_t*)&slotMarker, sizeof(rfalNfcbSlotMarker), (uint8_t*)sensbRes, sizeof(rfalNfcbSensbRes), &rxLen, RFAL_TXRX_FLAGS_DEFAULT, RFAL_NFCB_ACTIVATION_FWT, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:75fc82583a41 307 *sensbResLen = rxLen;
DiegoOstuni 0:75fc82583a41 308
DiegoOstuni 0:75fc82583a41 309 /* Check if a transmission error was detected */
DiegoOstuni 0:75fc82583a41 310 if( (ret == ERR_CRC) || (ret == ERR_FRAMING) )
DiegoOstuni 0:75fc82583a41 311 {
DiegoOstuni 0:75fc82583a41 312 return ERR_RF_COLLISION;
DiegoOstuni 0:75fc82583a41 313 }
DiegoOstuni 0:75fc82583a41 314
DiegoOstuni 0:75fc82583a41 315 if( ret == ERR_NONE )
DiegoOstuni 0:75fc82583a41 316 {
DiegoOstuni 0:75fc82583a41 317 return rfalNfcbCheckSensbRes( sensbRes, *sensbResLen );
DiegoOstuni 0:75fc82583a41 318 }
DiegoOstuni 0:75fc82583a41 319
DiegoOstuni 0:75fc82583a41 320 return ret;
DiegoOstuni 0:75fc82583a41 321 }
DiegoOstuni 0:75fc82583a41 322
DiegoOstuni 0:75fc82583a41 323
DiegoOstuni 0:75fc82583a41 324 ReturnCode rfalNfcbPollerTechnologyDetection( rfalComplianceMode compMode, rfalNfcbSensbRes *sensbRes, uint8_t *sensbResLen, SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 )
DiegoOstuni 0:75fc82583a41 325 {
DiegoOstuni 0:75fc82583a41 326 NO_WARNING(compMode);
DiegoOstuni 0:75fc82583a41 327
DiegoOstuni 0:75fc82583a41 328 return rfalNfcbPollerCheckPresence( RFAL_NFCB_SENS_CMD_SENSB_REQ, RFAL_NFCB_SLOT_NUM_1, sensbRes, sensbResLen, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:75fc82583a41 329 }
DiegoOstuni 0:75fc82583a41 330
DiegoOstuni 0:75fc82583a41 331
DiegoOstuni 0:75fc82583a41 332 /*******************************************************************************/
DiegoOstuni 0:75fc82583a41 333 ReturnCode rfalNfcbPollerCollisionResolution( rfalComplianceMode compMode, uint8_t devLimit, rfalNfcbListenDevice *nfcbDevList, uint8_t *devCnt, SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 )
DiegoOstuni 0:75fc82583a41 334 {
DiegoOstuni 0:75fc82583a41 335 bool colPending; /* dummy */
DiegoOstuni 0:75fc82583a41 336 return rfalNfcbPollerCollisionResolutionSlotted( compMode, devLimit, RFAL_NFCB_SLOT_NUM_1, RFAL_NFCB_SLOT_NUM_16, nfcbDevList, devCnt, &colPending, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:75fc82583a41 337 }
DiegoOstuni 0:75fc82583a41 338
DiegoOstuni 0:75fc82583a41 339
DiegoOstuni 0:75fc82583a41 340 /*******************************************************************************/
DiegoOstuni 0:75fc82583a41 341 ReturnCode rfalNfcbPollerCollisionResolutionSlotted( rfalComplianceMode compMode, uint8_t devLimit, rfalNfcbSlots initSlots, rfalNfcbSlots endSlots, rfalNfcbListenDevice *nfcbDevList, uint8_t *devCnt, bool *colPending, SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 )
DiegoOstuni 0:75fc82583a41 342 {
DiegoOstuni 0:75fc82583a41 343 ReturnCode ret;
DiegoOstuni 0:75fc82583a41 344 rfalNfcbSlots slotsNum;
DiegoOstuni 0:75fc82583a41 345 uint8_t slotCode;
DiegoOstuni 0:75fc82583a41 346 uint8_t curDevCnt;
DiegoOstuni 0:75fc82583a41 347
DiegoOstuni 0:75fc82583a41 348
DiegoOstuni 0:75fc82583a41 349 /* Check parameters. In ISO | Activity 1.0 mode the initial slots must be 1 as continuation of Technology Detection */
DiegoOstuni 0:75fc82583a41 350 if( (nfcbDevList == NULL) || (devCnt == NULL) || (colPending == NULL) || (initSlots > RFAL_NFCB_SLOT_NUM_16) ||
DiegoOstuni 0:75fc82583a41 351 (endSlots > RFAL_NFCB_SLOT_NUM_16) || ((compMode == RFAL_COMPLIANCE_MODE_ISO) && (initSlots != RFAL_NFCB_SLOT_NUM_1)) )
DiegoOstuni 0:75fc82583a41 352 {
DiegoOstuni 0:75fc82583a41 353 return ERR_PARAM;
DiegoOstuni 0:75fc82583a41 354 }
DiegoOstuni 0:75fc82583a41 355
DiegoOstuni 0:75fc82583a41 356 /* Initialise as no error in case Activity 1.0 where the previous SENSB_RES from technology detection should be used */
DiegoOstuni 0:75fc82583a41 357 ret = ERR_NONE;
DiegoOstuni 0:75fc82583a41 358 *devCnt = 0;
DiegoOstuni 0:75fc82583a41 359 curDevCnt = 0;
DiegoOstuni 0:75fc82583a41 360 *colPending = false;
DiegoOstuni 0:75fc82583a41 361
DiegoOstuni 0:75fc82583a41 362
DiegoOstuni 0:75fc82583a41 363 /* Send ALLB_REQ Activity 1.1 9.3.5.2 and 9.3.5.3 (Symbol 1 and 2) */
DiegoOstuni 0:75fc82583a41 364 if( compMode != RFAL_COMPLIANCE_MODE_ISO )
DiegoOstuni 0:75fc82583a41 365 {
DiegoOstuni 0:75fc82583a41 366 ret = rfalNfcbPollerCheckPresence( RFAL_NFCB_SENS_CMD_ALLB_REQ, initSlots, &nfcbDevList->sensbRes, &nfcbDevList->sensbResLen, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:75fc82583a41 367 if( (ret != ERR_NONE) && (initSlots == RFAL_NFCB_SLOT_NUM_1) )
DiegoOstuni 0:75fc82583a41 368 {
DiegoOstuni 0:75fc82583a41 369 return ret;
DiegoOstuni 0:75fc82583a41 370 }
DiegoOstuni 0:75fc82583a41 371 }
DiegoOstuni 0:75fc82583a41 372
DiegoOstuni 0:75fc82583a41 373
DiegoOstuni 0:75fc82583a41 374 /* Check if there was a transmission error on WUPB EMVCo 2.6 9.3.3.1 */
DiegoOstuni 0:75fc82583a41 375 if( (compMode == RFAL_COMPLIANCE_MODE_EMV) && (nfcbDevList->sensbResLen == 0) )
DiegoOstuni 0:75fc82583a41 376 {
DiegoOstuni 0:75fc82583a41 377 return ERR_FRAMING;
DiegoOstuni 0:75fc82583a41 378 }
DiegoOstuni 0:75fc82583a41 379 //(int)slotsNum = (int)initSlots; (int)slotsNum <= (int)endSlots; ((int)slotsNum)++ )
DiegoOstuni 0:75fc82583a41 380
DiegoOstuni 0:75fc82583a41 381 for( int i = 0; i < RFAL_NFCB_SLOT_NUM_16; i++)
DiegoOstuni 0:75fc82583a41 382 {
DiegoOstuni 0:75fc82583a41 383 rfalNfcbSlots slotsNum = (rfalNfcbSlots) i;
DiegoOstuni 0:75fc82583a41 384 /* Activity 1.1 9.3.5.23 - Symbol 22 */
DiegoOstuni 0:75fc82583a41 385 if( (compMode == RFAL_COMPLIANCE_MODE_NFC) && (curDevCnt != 0) )
DiegoOstuni 0:75fc82583a41 386 {
DiegoOstuni 0:75fc82583a41 387 rfalNfcbPollerSleep( nfcbDevList[(*devCnt-1)].sensbRes.nfcid0, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:75fc82583a41 388 nfcbDevList[(*devCnt-1)].isSleep = true;
DiegoOstuni 0:75fc82583a41 389 }
DiegoOstuni 0:75fc82583a41 390
DiegoOstuni 0:75fc82583a41 391 /* Send SENSB_REQ with number of slots if not the first Activity 1.1 9.3.5.24 - Symbol 23 */
DiegoOstuni 0:75fc82583a41 392 if( (slotsNum != initSlots) || *colPending )
DiegoOstuni 0:75fc82583a41 393 {
DiegoOstuni 0:75fc82583a41 394 ret = rfalNfcbPollerCheckPresence( RFAL_NFCB_SENS_CMD_SENSB_REQ, slotsNum, &nfcbDevList[*devCnt].sensbRes, &nfcbDevList[*devCnt].sensbResLen, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:75fc82583a41 395 }
DiegoOstuni 0:75fc82583a41 396
DiegoOstuni 0:75fc82583a41 397 /* Activity 1.1 9.3.5.6 - Symbol 5 */
DiegoOstuni 0:75fc82583a41 398 slotCode = 0;
DiegoOstuni 0:75fc82583a41 399 curDevCnt = 0;
DiegoOstuni 0:75fc82583a41 400 *colPending = false;
DiegoOstuni 0:75fc82583a41 401
DiegoOstuni 0:75fc82583a41 402 do{
DiegoOstuni 0:75fc82583a41 403 /* Activity 1.1 9.3.5.26 - Symbol 25 */
DiegoOstuni 0:75fc82583a41 404 if( slotCode != 0 )
DiegoOstuni 0:75fc82583a41 405 {
DiegoOstuni 0:75fc82583a41 406 ret = rfalNfcbPollerSlotMarker( slotCode, &nfcbDevList[*devCnt].sensbRes, &nfcbDevList[*devCnt].sensbResLen, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:75fc82583a41 407 }
DiegoOstuni 0:75fc82583a41 408
DiegoOstuni 0:75fc82583a41 409 /* Activity 1.1 9.3.5.7 and 9.3.5.8 - Symbol 6 */
DiegoOstuni 0:75fc82583a41 410 if( ret != ERR_TIMEOUT )
DiegoOstuni 0:75fc82583a41 411 {
DiegoOstuni 0:75fc82583a41 412 /* Activity 1.1 9.3.5.8 - Symbol 7 */
DiegoOstuni 0:75fc82583a41 413 if( (ret == ERR_NONE) && (rfalNfcbCheckSensbRes( &nfcbDevList[*devCnt].sensbRes, nfcbDevList[*devCnt].sensbResLen) == ERR_NONE) )
DiegoOstuni 0:75fc82583a41 414 {
DiegoOstuni 0:75fc82583a41 415 nfcbDevList[*devCnt].isSleep = false;
DiegoOstuni 0:75fc82583a41 416
DiegoOstuni 0:75fc82583a41 417 if( compMode == RFAL_COMPLIANCE_MODE_EMV )
DiegoOstuni 0:75fc82583a41 418 {
DiegoOstuni 0:75fc82583a41 419 (*devCnt)++;
DiegoOstuni 0:75fc82583a41 420 return ret;
DiegoOstuni 0:75fc82583a41 421 }
DiegoOstuni 0:75fc82583a41 422 else if( compMode == RFAL_COMPLIANCE_MODE_ISO )
DiegoOstuni 0:75fc82583a41 423 {
DiegoOstuni 0:75fc82583a41 424 /* Activity 1.0 9.3.5.8 - Symbol 7 */
DiegoOstuni 0:75fc82583a41 425 (*devCnt)++;
DiegoOstuni 0:75fc82583a41 426 curDevCnt++;
DiegoOstuni 0:75fc82583a41 427
DiegoOstuni 0:75fc82583a41 428 /* Activity 1.0 9.3.5.10 - Symbol 9 */
DiegoOstuni 0:75fc82583a41 429 if( (*devCnt >= devLimit) || (slotsNum == RFAL_NFCB_SLOT_NUM_1) )
DiegoOstuni 0:75fc82583a41 430 {
DiegoOstuni 0:75fc82583a41 431 return ret;
DiegoOstuni 0:75fc82583a41 432 }
DiegoOstuni 0:75fc82583a41 433
DiegoOstuni 0:75fc82583a41 434 /* Activity 1.0 9.3.5.11 - Symbol 10 */
DiegoOstuni 0:75fc82583a41 435 rfalNfcbPollerSleep( nfcbDevList[*devCnt-1].sensbRes.nfcid0, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:75fc82583a41 436 nfcbDevList[*devCnt-1].isSleep = true;
DiegoOstuni 0:75fc82583a41 437 }
DiegoOstuni 0:75fc82583a41 438 else if( compMode == RFAL_COMPLIANCE_MODE_NFC )
DiegoOstuni 0:75fc82583a41 439 {
DiegoOstuni 0:75fc82583a41 440 /* Activity 1.1 9.3.5.10 and 9.3.5.11 - Symbol 9 and Symbol 11*/
DiegoOstuni 0:75fc82583a41 441 if(curDevCnt != 0)
DiegoOstuni 0:75fc82583a41 442 {
DiegoOstuni 0:75fc82583a41 443 rfalNfcbPollerSleep( nfcbDevList[*devCnt-1].sensbRes.nfcid0, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:75fc82583a41 444 nfcbDevList[*devCnt-1].isSleep = true;
DiegoOstuni 0:75fc82583a41 445 }
DiegoOstuni 0:75fc82583a41 446
DiegoOstuni 0:75fc82583a41 447 /* Activity 1.1 9.3.5.12 - Symbol 11 */
DiegoOstuni 0:75fc82583a41 448 (*devCnt)++;
DiegoOstuni 0:75fc82583a41 449 curDevCnt++;
DiegoOstuni 0:75fc82583a41 450
DiegoOstuni 0:75fc82583a41 451 /* Activity 1.1 9.3.5.6 - Symbol 13 */
DiegoOstuni 0:75fc82583a41 452 if( (*devCnt >= devLimit) || (slotsNum == RFAL_NFCB_SLOT_NUM_1) )
DiegoOstuni 0:75fc82583a41 453 {
DiegoOstuni 0:75fc82583a41 454 return ret;
DiegoOstuni 0:75fc82583a41 455 }
DiegoOstuni 0:75fc82583a41 456 }
DiegoOstuni 0:75fc82583a41 457 }
DiegoOstuni 0:75fc82583a41 458 else
DiegoOstuni 0:75fc82583a41 459 {
DiegoOstuni 0:75fc82583a41 460 /* If deviceLimit is set to 0 the NFC Forum Device is configured to perform collision detection only Activity 1.0 and 1.1 9.3.5.5 - Symbol 4 */
DiegoOstuni 0:75fc82583a41 461 if( (devLimit == 0) && (slotsNum == RFAL_NFCB_SLOT_NUM_1) )
DiegoOstuni 0:75fc82583a41 462 {
DiegoOstuni 0:75fc82583a41 463 return ERR_RF_COLLISION;
DiegoOstuni 0:75fc82583a41 464 }
DiegoOstuni 0:75fc82583a41 465
DiegoOstuni 0:75fc82583a41 466 /* Activity 1.1 9.3.5.9 - Symbol 8 */
DiegoOstuni 0:75fc82583a41 467 *colPending = true;
DiegoOstuni 0:75fc82583a41 468 }
DiegoOstuni 0:75fc82583a41 469 }
DiegoOstuni 0:75fc82583a41 470
DiegoOstuni 0:75fc82583a41 471 /* Activity 1.1 9.3.5.15 - Symbol 14 */
DiegoOstuni 0:75fc82583a41 472 (int)slotCode++;
DiegoOstuni 0:75fc82583a41 473 }
DiegoOstuni 0:75fc82583a41 474 while( slotCode < rfalNfcbNI2NumberOfSlots(slotsNum) );
DiegoOstuni 0:75fc82583a41 475
DiegoOstuni 0:75fc82583a41 476 /* Activity 1.1 9.3.5.17 - Symbol 16 */
DiegoOstuni 0:75fc82583a41 477 if( !(*colPending) )
DiegoOstuni 0:75fc82583a41 478 {
DiegoOstuni 0:75fc82583a41 479 return ERR_NONE;
DiegoOstuni 0:75fc82583a41 480 }
DiegoOstuni 0:75fc82583a41 481
DiegoOstuni 0:75fc82583a41 482 /* Activity 1.1 9.3.5.18 - Symbol 17 */
DiegoOstuni 0:75fc82583a41 483 if( curDevCnt != 0 )
DiegoOstuni 0:75fc82583a41 484 {
DiegoOstuni 0:75fc82583a41 485 /* If a collision is detected and card(s) were found on this loop keep the same number of available slots */
DiegoOstuni 0:75fc82583a41 486 //((int)slotsNum)--;
DiegoOstuni 0:75fc82583a41 487 i--;
DiegoOstuni 0:75fc82583a41 488 }
DiegoOstuni 0:75fc82583a41 489
DiegoOstuni 0:75fc82583a41 490 }
DiegoOstuni 0:75fc82583a41 491
DiegoOstuni 0:75fc82583a41 492 return ERR_NONE;
DiegoOstuni 0:75fc82583a41 493 }
DiegoOstuni 0:75fc82583a41 494
DiegoOstuni 0:75fc82583a41 495
DiegoOstuni 0:75fc82583a41 496 /*******************************************************************************/
DiegoOstuni 0:75fc82583a41 497 uint32_t rfalNfcbTR2ToFDT( uint8_t tr2Code )
DiegoOstuni 0:75fc82583a41 498 {
DiegoOstuni 0:75fc82583a41 499 return rfalNfcbTr2Table[ (tr2Code & RFAL_NFCB_SENSB_RES_PROTO_TR2_MASK) ];
DiegoOstuni 0:75fc82583a41 500 }
DiegoOstuni 0:75fc82583a41 501
DiegoOstuni 0:75fc82583a41 502 #endif /* RFAL_FEATURE_NFCB */