Fork of the GitHub

Committer:
DiegoOstuni
Date:
Thu Nov 14 14:34:17 2019 +0000
Revision:
0:8e1d760507b5
Add files

Who changed what in which revision?

UserRevisionLine numberNew contents of line
DiegoOstuni 0:8e1d760507b5 1 /**
DiegoOstuni 0:8e1d760507b5 2 ******************************************************************************
DiegoOstuni 0:8e1d760507b5 3 * @file x_nucleo_nfc04a1.c
DiegoOstuni 0:8e1d760507b5 4 * @author MMY Application Team
DiegoOstuni 0:8e1d760507b5 5 * @version $Revision: 3351 $
DiegoOstuni 0:8e1d760507b5 6 * @date $Date: 2017-01-25 17:28:08 +0100 (Wed, 25 Jan 2017) $
DiegoOstuni 0:8e1d760507b5 7 * @brief This file provides nfc05a1 specific functions
DiegoOstuni 0:8e1d760507b5 8 ******************************************************************************
DiegoOstuni 0:8e1d760507b5 9 * @attention
DiegoOstuni 0:8e1d760507b5 10 *
DiegoOstuni 0:8e1d760507b5 11 * <h2><center>&copy; COPYRIGHT 2017 STMicroelectronics</center></h2>
DiegoOstuni 0:8e1d760507b5 12 *
DiegoOstuni 0:8e1d760507b5 13 * Licensed under ST MYLIBERTY SOFTWARE LICENSE AGREEMENT (the "License");
DiegoOstuni 0:8e1d760507b5 14 * You may not use this file except in compliance with the License.
DiegoOstuni 0:8e1d760507b5 15 * You may obtain a copy of the License at:
DiegoOstuni 0:8e1d760507b5 16 *
DiegoOstuni 0:8e1d760507b5 17 * http://www.st.com/myliberty
DiegoOstuni 0:8e1d760507b5 18 *
DiegoOstuni 0:8e1d760507b5 19 * Unless required by applicable law or agreed to in writing, software
DiegoOstuni 0:8e1d760507b5 20 * distributed under the License is distributed on an "AS IS" BASIS,
DiegoOstuni 0:8e1d760507b5 21 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
DiegoOstuni 0:8e1d760507b5 22 * AND SPECIFICALLY DISCLAIMING THE IMPLIED WARRANTIES OF MERCHANTABILITY,
DiegoOstuni 0:8e1d760507b5 23 * FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
DiegoOstuni 0:8e1d760507b5 24 * See the License for the specific language governing permissions and
DiegoOstuni 0:8e1d760507b5 25 * limitations under the License.
DiegoOstuni 0:8e1d760507b5 26 *
DiegoOstuni 0:8e1d760507b5 27 ******************************************************************************
DiegoOstuni 0:8e1d760507b5 28 */
DiegoOstuni 0:8e1d760507b5 29
DiegoOstuni 0:8e1d760507b5 30 /*
DiegoOstuni 0:8e1d760507b5 31 ******************************************************************************
DiegoOstuni 0:8e1d760507b5 32 * INCLUDES
DiegoOstuni 0:8e1d760507b5 33 ******************************************************************************
DiegoOstuni 0:8e1d760507b5 34 */
DiegoOstuni 0:8e1d760507b5 35
DiegoOstuni 0:8e1d760507b5 36 #include "utils.h"
DiegoOstuni 0:8e1d760507b5 37 #include "rfal_rf.h"
DiegoOstuni 0:8e1d760507b5 38 #include "rfal_nfca.h"
DiegoOstuni 0:8e1d760507b5 39 #include "rfal_nfcb.h"
DiegoOstuni 0:8e1d760507b5 40 #include "rfal_nfcf.h"
DiegoOstuni 0:8e1d760507b5 41 #include "rfal_nfcv.h"
DiegoOstuni 0:8e1d760507b5 42 #include "rfal_st25tb.h"
DiegoOstuni 0:8e1d760507b5 43 #include "rfal_nfcDep.h"
DiegoOstuni 0:8e1d760507b5 44 #include "rfal_isoDep.h"
DiegoOstuni 0:8e1d760507b5 45 #include "DigitalOut.h"
DiegoOstuni 0:8e1d760507b5 46 #include "st25r3911_interrupt.h"
DiegoOstuni 0:8e1d760507b5 47
DiegoOstuni 0:8e1d760507b5 48
DiegoOstuni 0:8e1d760507b5 49 /*
DiegoOstuni 0:8e1d760507b5 50 ******************************************************************************
DiegoOstuni 0:8e1d760507b5 51 * GLOBAL DEFINES
DiegoOstuni 0:8e1d760507b5 52 ******************************************************************************
DiegoOstuni 0:8e1d760507b5 53 */
DiegoOstuni 0:8e1d760507b5 54
DiegoOstuni 0:8e1d760507b5 55 /* Definition of possible states the demo state machine could have */
DiegoOstuni 0:8e1d760507b5 56 #define DEMO_ST_FIELD_OFF 0
DiegoOstuni 0:8e1d760507b5 57 #define DEMO_ST_POLL_ACTIVE_TECH 1
DiegoOstuni 0:8e1d760507b5 58 #define DEMO_ST_POLL_PASSIV_TECH 2
DiegoOstuni 0:8e1d760507b5 59 #define DEMO_ST_WAIT_WAKEUP 3
DiegoOstuni 0:8e1d760507b5 60
DiegoOstuni 0:8e1d760507b5 61 #define DEMO_BUF_LEN 255
DiegoOstuni 0:8e1d760507b5 62
DiegoOstuni 0:8e1d760507b5 63 /* macro to cycle through states */
DiegoOstuni 0:8e1d760507b5 64 #define NEXT_STATE() {state++; state %= sizeof(stateArray);}
DiegoOstuni 0:8e1d760507b5 65
DiegoOstuni 0:8e1d760507b5 66
DiegoOstuni 0:8e1d760507b5 67
DiegoOstuni 0:8e1d760507b5 68
DiegoOstuni 0:8e1d760507b5 69 /*
DiegoOstuni 0:8e1d760507b5 70 ******************************************************************************
DiegoOstuni 0:8e1d760507b5 71 * LOCAL VARIABLES
DiegoOstuni 0:8e1d760507b5 72 ******************************************************************************
DiegoOstuni 0:8e1d760507b5 73 */
DiegoOstuni 0:8e1d760507b5 74
DiegoOstuni 0:8e1d760507b5 75 /* State array of all possible states to be executed one after each other */
DiegoOstuni 0:8e1d760507b5 76 static uint8_t stateArray[] = { DEMO_ST_FIELD_OFF,
DiegoOstuni 0:8e1d760507b5 77 DEMO_ST_POLL_ACTIVE_TECH,
DiegoOstuni 0:8e1d760507b5 78 DEMO_ST_POLL_PASSIV_TECH,
DiegoOstuni 0:8e1d760507b5 79 DEMO_ST_WAIT_WAKEUP
DiegoOstuni 0:8e1d760507b5 80 };
DiegoOstuni 0:8e1d760507b5 81
DiegoOstuni 0:8e1d760507b5 82 /* P2P communication data */
DiegoOstuni 0:8e1d760507b5 83 static uint8_t NFCID3[] = {0x01, 0xFE, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A};
DiegoOstuni 0:8e1d760507b5 84 static uint8_t GB[] = {0x46, 0x66, 0x6d, 0x01, 0x01, 0x11, 0x02, 0x02, 0x07, 0x80, 0x03, 0x02, 0x00, 0x03, 0x04, 0x01, 0x32, 0x07, 0x01, 0x03};
DiegoOstuni 0:8e1d760507b5 85
DiegoOstuni 0:8e1d760507b5 86 /* APDUs communication data */
DiegoOstuni 0:8e1d760507b5 87 static uint8_t ndefSelectApp[] = { 0x00, 0xA4, 0x04, 0x00, 0x07, 0xD2, 0x76, 0x00, 0x00, 0x85, 0x01, 0x01, 0x00 };
DiegoOstuni 0:8e1d760507b5 88 static uint8_t ccSelectFile[] = { 0x00, 0xA4, 0x00, 0x0C, 0x02, 0xE1, 0x03};
DiegoOstuni 0:8e1d760507b5 89 static uint8_t readBynary[] = { 0x00, 0xB0, 0x00, 0x00, 0x0F };
DiegoOstuni 0:8e1d760507b5 90 /*static uint8_t ppseSelectApp[] = { 0x00, 0xA4, 0x04, 0x00, 0x0E, 0x32, 0x50, 0x41, 0x59, 0x2E, 0x53, 0x59, 0x53, 0x2E, 0x44, 0x44, 0x46, 0x30, 0x31, 0x00 };*/
DiegoOstuni 0:8e1d760507b5 91
DiegoOstuni 0:8e1d760507b5 92 /* P2P communication data */
DiegoOstuni 0:8e1d760507b5 93 static uint8_t ndefPing[] = {0x00, 0x00};
DiegoOstuni 0:8e1d760507b5 94 static uint8_t ndefInit[] = {0x05, 0x20, 0x06, 0x0F, 0x75, 0x72, 0x6E, 0x3A, 0x6E, 0x66, 0x63, 0x3A, 0x73, 0x6E, 0x3A, 0x73, 0x6E, 0x65, 0x70, 0x02, 0x02, 0x07, 0x80, 0x05, 0x01, 0x02};
DiegoOstuni 0:8e1d760507b5 95 static uint8_t ndefUriSTcom[] = {0x13, 0x20, 0x00, 0x10, 0x02, 0x00, 0x00, 0x00, 0x19, 0xc1, 0x01, 0x00, 0x00, 0x00, 0x12, 0x55, 0x00, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x73, 0x74, 0x2e, 0x63, 0x6f, 0x6d};
DiegoOstuni 0:8e1d760507b5 96
DiegoOstuni 0:8e1d760507b5 97
DiegoOstuni 0:8e1d760507b5 98 /*
DiegoOstuni 0:8e1d760507b5 99 ******************************************************************************
DiegoOstuni 0:8e1d760507b5 100 * LOCAL VARIABLES
DiegoOstuni 0:8e1d760507b5 101 ******************************************************************************
DiegoOstuni 0:8e1d760507b5 102 */
DiegoOstuni 0:8e1d760507b5 103
DiegoOstuni 0:8e1d760507b5 104 /*! Transmit buffers union, only one interface is used at a time */
DiegoOstuni 0:8e1d760507b5 105 static union{
DiegoOstuni 0:8e1d760507b5 106 rfalIsoDepApduBufFormat isoDepTxBuf; /* ISO-DEP Tx buffer format (with header/prologue) */
DiegoOstuni 0:8e1d760507b5 107 rfalNfcDepBufFormat nfcDepTxBuf; /* NFC-DEP Rx buffer format (with header/prologue) */
DiegoOstuni 0:8e1d760507b5 108 uint8_t txBuf[DEMO_BUF_LEN]; /* Generic buffer abstraction */
DiegoOstuni 0:8e1d760507b5 109 }gTxBuf;
DiegoOstuni 0:8e1d760507b5 110
DiegoOstuni 0:8e1d760507b5 111
DiegoOstuni 0:8e1d760507b5 112 /*! Receive buffers union, only one interface is used at a time */
DiegoOstuni 0:8e1d760507b5 113 static union {
DiegoOstuni 0:8e1d760507b5 114 rfalIsoDepApduBufFormat isoDepRxBuf; /* ISO-DEP Rx buffer format (with header/prologue) */
DiegoOstuni 0:8e1d760507b5 115 rfalNfcDepBufFormat nfcDepRxBuf; /* NFC-DEP Rx buffer format (with header/prologue) */
DiegoOstuni 0:8e1d760507b5 116 uint8_t rxBuf[DEMO_BUF_LEN]; /* Generic buffer abstraction */
DiegoOstuni 0:8e1d760507b5 117 }gRxBuf;
DiegoOstuni 0:8e1d760507b5 118
DiegoOstuni 0:8e1d760507b5 119 static rfalIsoDepBufFormat tmpBuf; /* tmp buffer required for ISO-DEP APDU interface, I-Block interface does not */
DiegoOstuni 0:8e1d760507b5 120
DiegoOstuni 0:8e1d760507b5 121 /*! Receive buffers union, only one interface is used at a time */
DiegoOstuni 0:8e1d760507b5 122 static union {
DiegoOstuni 0:8e1d760507b5 123 rfalIsoDepDevice isoDepDev; /* ISO-DEP Device details */
DiegoOstuni 0:8e1d760507b5 124 rfalNfcDepDevice nfcDepDev; /* NFC-DEP Device details */
DiegoOstuni 0:8e1d760507b5 125 }gDevProto;
DiegoOstuni 0:8e1d760507b5 126
DiegoOstuni 0:8e1d760507b5 127 static bool doWakeUp = false; /*!< by default do not perform Wake-Up */
DiegoOstuni 0:8e1d760507b5 128 static uint8_t state = DEMO_ST_FIELD_OFF; /*!< Actual state, starting with RF field turned off */
DiegoOstuni 0:8e1d760507b5 129
DiegoOstuni 0:8e1d760507b5 130
DiegoOstuni 0:8e1d760507b5 131
DiegoOstuni 0:8e1d760507b5 132 extern volatile bool wakeupFlag;
DiegoOstuni 0:8e1d760507b5 133
DiegoOstuni 0:8e1d760507b5 134
DiegoOstuni 0:8e1d760507b5 135
DiegoOstuni 0:8e1d760507b5 136
DiegoOstuni 0:8e1d760507b5 137 /*
DiegoOstuni 0:8e1d760507b5 138 ******************************************************************************
DiegoOstuni 0:8e1d760507b5 139 * LOCAL FUNCTION PROTOTYPES
DiegoOstuni 0:8e1d760507b5 140 ******************************************************************************
DiegoOstuni 0:8e1d760507b5 141 */
DiegoOstuni 0:8e1d760507b5 142
DiegoOstuni 0:8e1d760507b5 143 static bool demoPollAP2P( 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:8e1d760507b5 144 static bool demoPollNFCA( 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:8e1d760507b5 145 static bool demoPollNFCB( 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:8e1d760507b5 146 static bool demoPollST25TB( 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:8e1d760507b5 147 static bool demoPollNFCF( 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:8e1d760507b5 148 static bool demoPollNFCV( 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:8e1d760507b5 149 static ReturnCode demoActivateP2P( uint8_t* nfcid, uint8_t nfidLen, bool isActive, rfalNfcDepDevice *nfcDepDev, 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:8e1d760507b5 150 static ReturnCode demoNfcDepBlockingTxRx( rfalNfcDepDevice *nfcDepDev, const uint8_t *txBuf, uint16_t txBufSize, uint8_t *rxBuf, uint16_t rxBufSize, uint16_t *rxActLen, 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:8e1d760507b5 151 static ReturnCode demoIsoDepBlockingTxRx( rfalIsoDepDevice *isoDepDev, const uint8_t *txBuf, uint16_t txBufSize, uint8_t *rxBuf, uint16_t rxBufSize, uint16_t *rxActLen, 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:8e1d760507b5 152 static void demoSendNdefUri( 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:8e1d760507b5 153 static void demoSendAPDUs( 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:8e1d760507b5 154
DiegoOstuni 0:8e1d760507b5 155
DiegoOstuni 0:8e1d760507b5 156 /*!
DiegoOstuni 0:8e1d760507b5 157 *****************************************************************************
DiegoOstuni 0:8e1d760507b5 158 * \brief Demo Cycle
DiegoOstuni 0:8e1d760507b5 159 *
DiegoOstuni 0:8e1d760507b5 160 * This function executes the actual state of the demo state machine.
DiegoOstuni 0:8e1d760507b5 161 * Must be called cyclically
DiegoOstuni 0:8e1d760507b5 162 *****************************************************************************
DiegoOstuni 0:8e1d760507b5 163 */
DiegoOstuni 0:8e1d760507b5 164
DiegoOstuni 0:8e1d760507b5 165
DiegoOstuni 0:8e1d760507b5 166
DiegoOstuni 0:8e1d760507b5 167 void demoCycle(SPI* mspiChannel, ST25R3911* mST25, DigitalIn * uButton, 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:8e1d760507b5 168 {
DiegoOstuni 0:8e1d760507b5 169 bool found = false;
DiegoOstuni 0:8e1d760507b5 170
DiegoOstuni 0:8e1d760507b5 171 /* Code below is commented since not implemented. It may be of interest to uncommented if going through the wake up mode */
DiegoOstuni 0:8e1d760507b5 172
DiegoOstuni 0:8e1d760507b5 173 /* Check if USER button is pressed */
DiegoOstuni 0:8e1d760507b5 174 // if( uButton -> read() == 1 )
DiegoOstuni 0:8e1d760507b5 175 //{
DiegoOstuni 0:8e1d760507b5 176
DiegoOstuni 0:8e1d760507b5 177 //doWakeUp = 1;
DiegoOstuni 0:8e1d760507b5 178 //!doWakeUp; /* enable/disable wakeup */
DiegoOstuni 0:8e1d760507b5 179 // state = DEMO_ST_FIELD_OFF; /* restart loop */
DiegoOstuni 0:8e1d760507b5 180
DiegoOstuni 0:8e1d760507b5 181 /* Debounce button */
DiegoOstuni 0:8e1d760507b5 182 // while( uButton -> read() == 0 );
DiegoOstuni 0:8e1d760507b5 183 // }
DiegoOstuni 0:8e1d760507b5 184
DiegoOstuni 0:8e1d760507b5 185 switch( stateArray[state] )
DiegoOstuni 0:8e1d760507b5 186 {
DiegoOstuni 0:8e1d760507b5 187 //
DiegoOstuni 0:8e1d760507b5 188 case DEMO_ST_FIELD_OFF:
DiegoOstuni 0:8e1d760507b5 189
DiegoOstuni 0:8e1d760507b5 190 fieldLED_01 -> write(0);
DiegoOstuni 0:8e1d760507b5 191 fieldLED_02 -> write(0);
DiegoOstuni 0:8e1d760507b5 192 fieldLED_03 -> write(0);
DiegoOstuni 0:8e1d760507b5 193 fieldLED_04 -> write(0);
DiegoOstuni 0:8e1d760507b5 194 fieldLED_05 -> write(0);
DiegoOstuni 0:8e1d760507b5 195 fieldLED_06 -> write(0);
DiegoOstuni 0:8e1d760507b5 196
DiegoOstuni 0:8e1d760507b5 197
DiegoOstuni 0:8e1d760507b5 198 rfalFieldOff( mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:8e1d760507b5 199 rfalWakeUpModeStop( mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:8e1d760507b5 200 platformDelay(300);
DiegoOstuni 0:8e1d760507b5 201
DiegoOstuni 0:8e1d760507b5 202 /* If WakeUp is to be executed, enable Wake-Up mode */
DiegoOstuni 0:8e1d760507b5 203 if( doWakeUp )
DiegoOstuni 0:8e1d760507b5 204 {
DiegoOstuni 0:8e1d760507b5 205 //"Going to Wakeup mode.\r\n");
DiegoOstuni 0:8e1d760507b5 206
DiegoOstuni 0:8e1d760507b5 207 rfalWakeUpModeStart( NULL, mST25, mspiChannel, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:8e1d760507b5 208 state = DEMO_ST_WAIT_WAKEUP;
DiegoOstuni 0:8e1d760507b5 209 break;
DiegoOstuni 0:8e1d760507b5 210 }
DiegoOstuni 0:8e1d760507b5 211
DiegoOstuni 0:8e1d760507b5 212 NEXT_STATE();
DiegoOstuni 0:8e1d760507b5 213 break;
DiegoOstuni 0:8e1d760507b5 214
DiegoOstuni 0:8e1d760507b5 215 //
DiegoOstuni 0:8e1d760507b5 216 case DEMO_ST_POLL_ACTIVE_TECH:
DiegoOstuni 0:8e1d760507b5 217 demoPollAP2P( mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:8e1d760507b5 218 platformDelay(40);
DiegoOstuni 0:8e1d760507b5 219 NEXT_STATE();
DiegoOstuni 0:8e1d760507b5 220 break;
DiegoOstuni 0:8e1d760507b5 221
DiegoOstuni 0:8e1d760507b5 222 //
DiegoOstuni 0:8e1d760507b5 223 case DEMO_ST_POLL_PASSIV_TECH:
DiegoOstuni 0:8e1d760507b5 224 found |= demoPollNFCA( mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:8e1d760507b5 225 found |= demoPollNFCB( mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:8e1d760507b5 226 found |= demoPollST25TB( mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:8e1d760507b5 227 found |= demoPollNFCF( mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:8e1d760507b5 228 found |= demoPollNFCV( mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:8e1d760507b5 229
DiegoOstuni 0:8e1d760507b5 230 platformDelay(300);
DiegoOstuni 0:8e1d760507b5 231 state = DEMO_ST_FIELD_OFF;
DiegoOstuni 0:8e1d760507b5 232 break;
DiegoOstuni 0:8e1d760507b5 233
DiegoOstuni 0:8e1d760507b5 234 //
DiegoOstuni 0:8e1d760507b5 235 case DEMO_ST_WAIT_WAKEUP:
DiegoOstuni 0:8e1d760507b5 236
DiegoOstuni 0:8e1d760507b5 237
DiegoOstuni 0:8e1d760507b5 238
DiegoOstuni 0:8e1d760507b5 239
DiegoOstuni 0:8e1d760507b5 240 st25r3911Isr(mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:8e1d760507b5 241
DiegoOstuni 0:8e1d760507b5 242
DiegoOstuni 0:8e1d760507b5 243 if( st25r3911ChipHasWoke() )
DiegoOstuni 0:8e1d760507b5 244 {
DiegoOstuni 0:8e1d760507b5 245 rfalSetWumState();
DiegoOstuni 0:8e1d760507b5 246 }
DiegoOstuni 0:8e1d760507b5 247
DiegoOstuni 0:8e1d760507b5 248
DiegoOstuni 0:8e1d760507b5 249 /* Check if Wake-Up Mode has been awaked */
DiegoOstuni 0:8e1d760507b5 250 if( rfalWakeUpModeHasWoke(mST25, mspiChannel, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) )
DiegoOstuni 0:8e1d760507b5 251 {
DiegoOstuni 0:8e1d760507b5 252 /* If awake, go directly to Poll */
DiegoOstuni 0:8e1d760507b5 253 rfalWakeUpModeStop( mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:8e1d760507b5 254 state = DEMO_ST_POLL_ACTIVE_TECH;
DiegoOstuni 0:8e1d760507b5 255 }
DiegoOstuni 0:8e1d760507b5 256 break;
DiegoOstuni 0:8e1d760507b5 257
DiegoOstuni 0:8e1d760507b5 258 default:
DiegoOstuni 0:8e1d760507b5 259 break;
DiegoOstuni 0:8e1d760507b5 260 }
DiegoOstuni 0:8e1d760507b5 261
DiegoOstuni 0:8e1d760507b5 262 }
DiegoOstuni 0:8e1d760507b5 263
DiegoOstuni 0:8e1d760507b5 264
DiegoOstuni 0:8e1d760507b5 265 /*!
DiegoOstuni 0:8e1d760507b5 266 *****************************************************************************
DiegoOstuni 0:8e1d760507b5 267 * \brief Poll NFC-AP2P
DiegoOstuni 0:8e1d760507b5 268 *
DiegoOstuni 0:8e1d760507b5 269 * Configures the RFAL to AP2P communication and polls for a nearby
DiegoOstuni 0:8e1d760507b5 270 * device. If a device is found turns On a LED and logs its UID.
DiegoOstuni 0:8e1d760507b5 271 * If the Device supports NFC-DEP protocol (P2P) it will activate
DiegoOstuni 0:8e1d760507b5 272 * the device and try to send an URI record.
DiegoOstuni 0:8e1d760507b5 273 *
DiegoOstuni 0:8e1d760507b5 274 * This methid first tries to establish communication at 424kb/s and if
DiegoOstuni 0:8e1d760507b5 275 * failed, tries also at 106kb/s
DiegoOstuni 0:8e1d760507b5 276 *
DiegoOstuni 0:8e1d760507b5 277 *
DiegoOstuni 0:8e1d760507b5 278 * \return true : AP2P device found
DiegoOstuni 0:8e1d760507b5 279 * \return false : No device found
DiegoOstuni 0:8e1d760507b5 280 *
DiegoOstuni 0:8e1d760507b5 281 *****************************************************************************
DiegoOstuni 0:8e1d760507b5 282 */
DiegoOstuni 0:8e1d760507b5 283 bool demoPollAP2P( 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:8e1d760507b5 284 {
DiegoOstuni 0:8e1d760507b5 285 ReturnCode err;
DiegoOstuni 0:8e1d760507b5 286 bool try106 = false;
DiegoOstuni 0:8e1d760507b5 287
DiegoOstuni 0:8e1d760507b5 288
DiegoOstuni 0:8e1d760507b5 289 while (!try106)
DiegoOstuni 0:8e1d760507b5 290 {
DiegoOstuni 0:8e1d760507b5 291 /*******************************************************************************/
DiegoOstuni 0:8e1d760507b5 292 /* NFC_ACTIVE_POLL_MODE */
DiegoOstuni 0:8e1d760507b5 293 /*******************************************************************************/
DiegoOstuni 0:8e1d760507b5 294 /* Initialize RFAL as AP2P Initiator NFC BR 424 */
DiegoOstuni 0:8e1d760507b5 295 err = rfalSetMode(RFAL_MODE_POLL_ACTIVE_P2P, ((try106) ? RFAL_BR_106 : RFAL_BR_424), ((try106) ? RFAL_BR_106 : RFAL_BR_424), mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:8e1d760507b5 296
DiegoOstuni 0:8e1d760507b5 297 rfalSetErrorHandling(RFAL_ERRORHANDLING_NFC);
DiegoOstuni 0:8e1d760507b5 298 rfalSetFDTListen(RFAL_FDT_LISTEN_AP2P_POLLER);
DiegoOstuni 0:8e1d760507b5 299 rfalSetFDTPoll(RFAL_TIMING_NONE);
DiegoOstuni 0:8e1d760507b5 300
DiegoOstuni 0:8e1d760507b5 301 rfalSetGT( RFAL_GT_AP2P_ADJUSTED );
DiegoOstuni 0:8e1d760507b5 302 err = rfalFieldOnAndStartGT( mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:8e1d760507b5 303
DiegoOstuni 0:8e1d760507b5 304
DiegoOstuni 0:8e1d760507b5 305 err = demoActivateP2P( NFCID3, RFAL_NFCDEP_NFCID3_LEN, true, &gDevProto.nfcDepDev, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:8e1d760507b5 306 if (err == ERR_NONE)
DiegoOstuni 0:8e1d760507b5 307 {
DiegoOstuni 0:8e1d760507b5 308 /****************************************************************************/
DiegoOstuni 0:8e1d760507b5 309 /* Active P2P device activated */
DiegoOstuni 0:8e1d760507b5 310 /* NFCID / UID is contained in : nfcDepDev.activation.Target.ATR_RES.NFCID3 */
DiegoOstuni 0:8e1d760507b5 311 // //("NFC Active P2P device found. NFCID3: %s\r\n", hex2Str(gDevProto.nfcDepDev.activation.Target.ATR_RES.NFCID3, RFAL_NFCDEP_NFCID3_LEN));
DiegoOstuni 0:8e1d760507b5 312 fieldLED_05 -> write(1);
DiegoOstuni 0:8e1d760507b5 313 /* Send an URI record */
DiegoOstuni 0:8e1d760507b5 314 demoSendNdefUri( mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:8e1d760507b5 315 return true;
DiegoOstuni 0:8e1d760507b5 316 }
DiegoOstuni 0:8e1d760507b5 317
DiegoOstuni 0:8e1d760507b5 318 /* AP2P at 424kb/s didn't found any device, try at 106kb/s */
DiegoOstuni 0:8e1d760507b5 319 try106 = true;
DiegoOstuni 0:8e1d760507b5 320 rfalFieldOff( mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:8e1d760507b5 321 }
DiegoOstuni 0:8e1d760507b5 322
DiegoOstuni 0:8e1d760507b5 323 return false;
DiegoOstuni 0:8e1d760507b5 324 }
DiegoOstuni 0:8e1d760507b5 325
DiegoOstuni 0:8e1d760507b5 326 /*!
DiegoOstuni 0:8e1d760507b5 327 *****************************************************************************
DiegoOstuni 0:8e1d760507b5 328 * \brief Poll NFC-A
DiegoOstuni 0:8e1d760507b5 329 *
DiegoOstuni 0:8e1d760507b5 330 * Configures the RFAL to NFC-A (ISO14443A) communication and polls for a nearby
DiegoOstuni 0:8e1d760507b5 331 * NFC-A device.
DiegoOstuni 0:8e1d760507b5 332 * If a device is found turns On a LED and logs its UID.
DiegoOstuni 0:8e1d760507b5 333 *
DiegoOstuni 0:8e1d760507b5 334 * Additionally, if the Device supports NFC-DEP protocol (P2P) it will activate
DiegoOstuni 0:8e1d760507b5 335 * the device and try to send an URI record.
DiegoOstuni 0:8e1d760507b5 336 * If the device supports ISO-DEP protocol (ISO144443-4) it will
DiegoOstuni 0:8e1d760507b5 337 * activate the device and try exchange some APDUs with PICC.
DiegoOstuni 0:8e1d760507b5 338 *
DiegoOstuni 0:8e1d760507b5 339 *
DiegoOstuni 0:8e1d760507b5 340 * \return true : NFC-A device found
DiegoOstuni 0:8e1d760507b5 341 * \return false : No device found
DiegoOstuni 0:8e1d760507b5 342 *
DiegoOstuni 0:8e1d760507b5 343 *****************************************************************************
DiegoOstuni 0:8e1d760507b5 344 */
DiegoOstuni 0:8e1d760507b5 345 bool demoPollNFCA( 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:8e1d760507b5 346 {
DiegoOstuni 0:8e1d760507b5 347 ReturnCode err;
DiegoOstuni 0:8e1d760507b5 348 bool found = false;
DiegoOstuni 0:8e1d760507b5 349 uint8_t devIt = 0;
DiegoOstuni 0:8e1d760507b5 350 rfalNfcaSensRes sensRes;
DiegoOstuni 0:8e1d760507b5 351
DiegoOstuni 0:8e1d760507b5 352 rfalNfcaPollerInitialize( mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ; /* Initialize for NFC-A */
DiegoOstuni 0:8e1d760507b5 353 rfalFieldOnAndStartGT( mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ; /* Turns the Field On if not already and start GT timer */
DiegoOstuni 0:8e1d760507b5 354
DiegoOstuni 0:8e1d760507b5 355 err = rfalNfcaPollerTechnologyDetection( RFAL_COMPLIANCE_MODE_NFC, &sensRes, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:8e1d760507b5 356 if(err == ERR_NONE)
DiegoOstuni 0:8e1d760507b5 357 {
DiegoOstuni 0:8e1d760507b5 358 rfalNfcaListenDevice nfcaDevList[1];
DiegoOstuni 0:8e1d760507b5 359 uint8_t devCnt;
DiegoOstuni 0:8e1d760507b5 360
DiegoOstuni 0:8e1d760507b5 361 err = rfalNfcaPollerFullCollisionResolution( RFAL_COMPLIANCE_MODE_NFC, 1, nfcaDevList, &devCnt, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:8e1d760507b5 362
DiegoOstuni 0:8e1d760507b5 363 if ( (err == ERR_NONE) && (devCnt > 0) )
DiegoOstuni 0:8e1d760507b5 364 {
DiegoOstuni 0:8e1d760507b5 365 found = true;
DiegoOstuni 0:8e1d760507b5 366 devIt = 0;
DiegoOstuni 0:8e1d760507b5 367
DiegoOstuni 0:8e1d760507b5 368 fieldLED_03 -> write(1);
DiegoOstuni 0:8e1d760507b5 369
DiegoOstuni 0:8e1d760507b5 370 /* Check if it is Topaz aka T1T */
DiegoOstuni 0:8e1d760507b5 371 if( nfcaDevList[devIt].type == RFAL_NFCA_T1T )
DiegoOstuni 0:8e1d760507b5 372 {
DiegoOstuni 0:8e1d760507b5 373 /********************************************/
DiegoOstuni 0:8e1d760507b5 374 /* NFC-A T1T card found */
DiegoOstuni 0:8e1d760507b5 375 /* NFCID/UID is contained in: t1tRidRes.uid */
DiegoOstuni 0:8e1d760507b5 376 // //("ISO14443A/Topaz (NFC-A T1T) TAG found. UID: %s\r\n", hex2Str(nfcaDevList[devIt].ridRes.uid, RFAL_T1T_UID_LEN));
DiegoOstuni 0:8e1d760507b5 377 }
DiegoOstuni 0:8e1d760507b5 378 else
DiegoOstuni 0:8e1d760507b5 379 {
DiegoOstuni 0:8e1d760507b5 380 /*********************************************/
DiegoOstuni 0:8e1d760507b5 381 /* NFC-A device found */
DiegoOstuni 0:8e1d760507b5 382 /* NFCID/UID is contained in: nfcaDev.nfcId1 */
DiegoOstuni 0:8e1d760507b5 383 // //("ISO14443A/NFC-A card found. UID: %s\r\n", hex2Str(nfcaDevList[0].nfcId1, nfcaDevList[0].nfcId1Len));
DiegoOstuni 0:8e1d760507b5 384 }
DiegoOstuni 0:8e1d760507b5 385
DiegoOstuni 0:8e1d760507b5 386
DiegoOstuni 0:8e1d760507b5 387 /* Check if device supports P2P/NFC-DEP */
DiegoOstuni 0:8e1d760507b5 388 if( (nfcaDevList[devIt].type == RFAL_NFCA_NFCDEP) || (nfcaDevList[devIt].type == RFAL_NFCA_T4T_NFCDEP))
DiegoOstuni 0:8e1d760507b5 389 {
DiegoOstuni 0:8e1d760507b5 390 /* Continue with P2P Activation .... */
DiegoOstuni 0:8e1d760507b5 391
DiegoOstuni 0:8e1d760507b5 392 err = demoActivateP2P( NFCID3, RFAL_NFCDEP_NFCID3_LEN, false, &gDevProto.nfcDepDev, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:8e1d760507b5 393 if (err == ERR_NONE)
DiegoOstuni 0:8e1d760507b5 394 {
DiegoOstuni 0:8e1d760507b5 395 /*********************************************/
DiegoOstuni 0:8e1d760507b5 396 /* Passive P2P device activated */
DiegoOstuni 0:8e1d760507b5 397 // //("NFCA Passive P2P device found. NFCID: %s\r\n", hex2Str(gDevProto.nfcDepDev.activation.Target.ATR_RES.NFCID3, RFAL_NFCDEP_NFCID3_LEN));
DiegoOstuni 0:8e1d760507b5 398
DiegoOstuni 0:8e1d760507b5 399 /* Send an URI record */
DiegoOstuni 0:8e1d760507b5 400 demoSendNdefUri( mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:8e1d760507b5 401 }
DiegoOstuni 0:8e1d760507b5 402 }
DiegoOstuni 0:8e1d760507b5 403 /* Check if device supports ISO14443-4/ISO-DEP */
DiegoOstuni 0:8e1d760507b5 404 else if (nfcaDevList[devIt].type == RFAL_NFCA_T4T)
DiegoOstuni 0:8e1d760507b5 405 {
DiegoOstuni 0:8e1d760507b5 406 /* Activate the ISO14443-4 / ISO-DEP layer */
DiegoOstuni 0:8e1d760507b5 407
DiegoOstuni 0:8e1d760507b5 408 rfalIsoDepInitialize();
DiegoOstuni 0:8e1d760507b5 409 err = rfalIsoDepPollAHandleActivation((rfalIsoDepFSxI)RFAL_ISODEP_FSDI_DEFAULT, RFAL_ISODEP_NO_DID, RFAL_BR_424, &gDevProto.isoDepDev, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:8e1d760507b5 410 if( err == ERR_NONE )
DiegoOstuni 0:8e1d760507b5 411 {
DiegoOstuni 0:8e1d760507b5 412 // //("ISO14443-4/ISO-DEP layer activated. \r\n");
DiegoOstuni 0:8e1d760507b5 413
DiegoOstuni 0:8e1d760507b5 414 /* Exchange APDUs */
DiegoOstuni 0:8e1d760507b5 415 demoSendAPDUs( mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:8e1d760507b5 416 }
DiegoOstuni 0:8e1d760507b5 417 }
DiegoOstuni 0:8e1d760507b5 418 }
DiegoOstuni 0:8e1d760507b5 419 }
DiegoOstuni 0:8e1d760507b5 420 return found;
DiegoOstuni 0:8e1d760507b5 421 }
DiegoOstuni 0:8e1d760507b5 422
DiegoOstuni 0:8e1d760507b5 423 /*!
DiegoOstuni 0:8e1d760507b5 424 *****************************************************************************
DiegoOstuni 0:8e1d760507b5 425 * \brief Poll NFC-B
DiegoOstuni 0:8e1d760507b5 426 *
DiegoOstuni 0:8e1d760507b5 427 * Configures the RFAL to NFC-B (ISO14443B) communication and polls for a nearby
DiegoOstuni 0:8e1d760507b5 428 * NFC-B device.
DiegoOstuni 0:8e1d760507b5 429 * If a device is found turns On a LED and logs its UID.
DiegoOstuni 0:8e1d760507b5 430 * Additionally, if the Device supports ISO-DEP protocol (ISO144443-4) it will
DiegoOstuni 0:8e1d760507b5 431 * activate the device and try exchange some APDUs with PICC
DiegoOstuni 0:8e1d760507b5 432 *
DiegoOstuni 0:8e1d760507b5 433 * \return true : NFC-B device found
DiegoOstuni 0:8e1d760507b5 434 * \return false : No device found
DiegoOstuni 0:8e1d760507b5 435 *
DiegoOstuni 0:8e1d760507b5 436 *****************************************************************************
DiegoOstuni 0:8e1d760507b5 437 */
DiegoOstuni 0:8e1d760507b5 438 bool demoPollNFCB( 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:8e1d760507b5 439 {
DiegoOstuni 0:8e1d760507b5 440 ReturnCode err;
DiegoOstuni 0:8e1d760507b5 441 rfalNfcbListenDevice nfcbDev;
DiegoOstuni 0:8e1d760507b5 442 bool found = false;
DiegoOstuni 0:8e1d760507b5 443 uint8_t devCnt = 0;
DiegoOstuni 0:8e1d760507b5 444
DiegoOstuni 0:8e1d760507b5 445 /*******************************************************************************/
DiegoOstuni 0:8e1d760507b5 446 /* ISO14443B/NFC_B_PASSIVE_POLL_MODE */
DiegoOstuni 0:8e1d760507b5 447 /*******************************************************************************/
DiegoOstuni 0:8e1d760507b5 448
DiegoOstuni 0:8e1d760507b5 449 rfalNfcbPollerInitialize( mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ; /* Initialize for NFC-B */
DiegoOstuni 0:8e1d760507b5 450 rfalFieldOnAndStartGT( mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ; /* Turns the Field On if not already and start GT timer */
DiegoOstuni 0:8e1d760507b5 451
DiegoOstuni 0:8e1d760507b5 452
DiegoOstuni 0:8e1d760507b5 453 err = rfalNfcbPollerCollisionResolution( RFAL_COMPLIANCE_MODE_NFC, 1, &nfcbDev, &devCnt, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:8e1d760507b5 454 if( (err == ERR_NONE) && (devCnt > 0) )
DiegoOstuni 0:8e1d760507b5 455 {
DiegoOstuni 0:8e1d760507b5 456 /**********************************************/
DiegoOstuni 0:8e1d760507b5 457 /* NFC-B card found */
DiegoOstuni 0:8e1d760507b5 458 /* NFCID/UID is contained in: sensbRes.nfcid0 */
DiegoOstuni 0:8e1d760507b5 459 found = true;
DiegoOstuni 0:8e1d760507b5 460
DiegoOstuni 0:8e1d760507b5 461 fieldLED_02 -> write(1);
DiegoOstuni 0:8e1d760507b5 462 // //("ISO14443B/NFC-B card found. UID: %s\r\n", hex2Str(nfcbDev.sensbRes.nfcid0, RFAL_NFCB_NFCID0_LEN));
DiegoOstuni 0:8e1d760507b5 463
DiegoOstuni 0:8e1d760507b5 464 }
DiegoOstuni 0:8e1d760507b5 465
DiegoOstuni 0:8e1d760507b5 466 /* Check if device supports ISO14443-4/ISO-DEP */
DiegoOstuni 0:8e1d760507b5 467 if( nfcbDev.sensbRes.protInfo.FsciProType & RFAL_NFCB_SENSB_RES_PROTO_ISO_MASK )
DiegoOstuni 0:8e1d760507b5 468 {
DiegoOstuni 0:8e1d760507b5 469
DiegoOstuni 0:8e1d760507b5 470 /* Activate the ISO14443-4 / ISO-DEP layer */
DiegoOstuni 0:8e1d760507b5 471 rfalIsoDepInitialize();
DiegoOstuni 0:8e1d760507b5 472 err = rfalIsoDepPollBHandleActivation((rfalIsoDepFSxI)RFAL_ISODEP_FSDI_DEFAULT, RFAL_ISODEP_NO_DID, RFAL_BR_424, RFAL_ISODEP_ATTRIB_REQ_PARAM1_DEFAULT, &nfcbDev, NULL, 0, &gDevProto.isoDepDev, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:8e1d760507b5 473
DiegoOstuni 0:8e1d760507b5 474 if( err == ERR_NONE )
DiegoOstuni 0:8e1d760507b5 475 {
DiegoOstuni 0:8e1d760507b5 476 //("ISO14443-4/ISO-DEP layer activated. \r\n");
DiegoOstuni 0:8e1d760507b5 477
DiegoOstuni 0:8e1d760507b5 478 /* Exchange APDUs */
DiegoOstuni 0:8e1d760507b5 479 demoSendAPDUs( mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:8e1d760507b5 480 }
DiegoOstuni 0:8e1d760507b5 481 }
DiegoOstuni 0:8e1d760507b5 482 return found;
DiegoOstuni 0:8e1d760507b5 483 }
DiegoOstuni 0:8e1d760507b5 484
DiegoOstuni 0:8e1d760507b5 485 /*!
DiegoOstuni 0:8e1d760507b5 486 *****************************************************************************
DiegoOstuni 0:8e1d760507b5 487 * \brief Poll ST25TB
DiegoOstuni 0:8e1d760507b5 488 *
DiegoOstuni 0:8e1d760507b5 489 * Configures the RFAL and polls for a nearby ST25TB device.
DiegoOstuni 0:8e1d760507b5 490 * If a device is found turns On a LED and logs its UID.
DiegoOstuni 0:8e1d760507b5 491 *
DiegoOstuni 0:8e1d760507b5 492 * \return true : ST25TB device found
DiegoOstuni 0:8e1d760507b5 493 * \return false : No device found
DiegoOstuni 0:8e1d760507b5 494 *
DiegoOstuni 0:8e1d760507b5 495 *****************************************************************************
DiegoOstuni 0:8e1d760507b5 496 */
DiegoOstuni 0:8e1d760507b5 497 bool demoPollST25TB( 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:8e1d760507b5 498 {
DiegoOstuni 0:8e1d760507b5 499 ReturnCode err;
DiegoOstuni 0:8e1d760507b5 500 bool found = false;
DiegoOstuni 0:8e1d760507b5 501 uint8_t devCnt = 0;
DiegoOstuni 0:8e1d760507b5 502 rfalSt25tbListenDevice st25tbDev;
DiegoOstuni 0:8e1d760507b5 503
DiegoOstuni 0:8e1d760507b5 504 /*******************************************************************************/
DiegoOstuni 0:8e1d760507b5 505 /* ST25TB_PASSIVE_POLL_MODE */
DiegoOstuni 0:8e1d760507b5 506 /*******************************************************************************/
DiegoOstuni 0:8e1d760507b5 507
DiegoOstuni 0:8e1d760507b5 508 rfalSt25tbPollerInitialize( mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:8e1d760507b5 509 rfalFieldOnAndStartGT( mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:8e1d760507b5 510
DiegoOstuni 0:8e1d760507b5 511 err = rfalSt25tbPollerCheckPresence(NULL, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:8e1d760507b5 512 if( err == ERR_NONE )
DiegoOstuni 0:8e1d760507b5 513 {
DiegoOstuni 0:8e1d760507b5 514 err = rfalSt25tbPollerCollisionResolution(1, &st25tbDev, &devCnt, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:8e1d760507b5 515
DiegoOstuni 0:8e1d760507b5 516 if ((err == ERR_NONE) && (devCnt > 0))
DiegoOstuni 0:8e1d760507b5 517 {
DiegoOstuni 0:8e1d760507b5 518 /******************************************************/
DiegoOstuni 0:8e1d760507b5 519 /* ST25TB card found */
DiegoOstuni 0:8e1d760507b5 520 /* NFCID/UID is contained in: st25tbDev.UID */
DiegoOstuni 0:8e1d760507b5 521 found = true;
DiegoOstuni 0:8e1d760507b5 522 fieldLED_02 -> write(1);
DiegoOstuni 0:8e1d760507b5 523 //// //("ST25TB card found. UID: %s\r\n", hex2Str(st25tbDev.UID, RFAL_ST25TB_UID_LEN));
DiegoOstuni 0:8e1d760507b5 524
DiegoOstuni 0:8e1d760507b5 525 }
DiegoOstuni 0:8e1d760507b5 526 }
DiegoOstuni 0:8e1d760507b5 527 return found;
DiegoOstuni 0:8e1d760507b5 528 }
DiegoOstuni 0:8e1d760507b5 529
DiegoOstuni 0:8e1d760507b5 530
DiegoOstuni 0:8e1d760507b5 531 /*!
DiegoOstuni 0:8e1d760507b5 532 *****************************************************************************
DiegoOstuni 0:8e1d760507b5 533 * \brief Poll NFC-F
DiegoOstuni 0:8e1d760507b5 534 *
DiegoOstuni 0:8e1d760507b5 535 * Configures the RFAL to NFC-F (FeliCa) communication and polls for a nearby
DiegoOstuni 0:8e1d760507b5 536 * NFC-F device.
DiegoOstuni 0:8e1d760507b5 537 * If a device is found turns On a LED and logs its UID.
DiegoOstuni 0:8e1d760507b5 538 * Additionally, if the Device supports NFC-DEP protocol (P2P) it will
DiegoOstuni 0:8e1d760507b5 539 * activate the device and try to send an URI record
DiegoOstuni 0:8e1d760507b5 540 *
DiegoOstuni 0:8e1d760507b5 541 * \return true : NFC-F device found
DiegoOstuni 0:8e1d760507b5 542 * \return false : No device found
DiegoOstuni 0:8e1d760507b5 543 *
DiegoOstuni 0:8e1d760507b5 544 *****************************************************************************
DiegoOstuni 0:8e1d760507b5 545 */
DiegoOstuni 0:8e1d760507b5 546 bool demoPollNFCF( 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:8e1d760507b5 547 {
DiegoOstuni 0:8e1d760507b5 548 ReturnCode err;
DiegoOstuni 0:8e1d760507b5 549 rfalNfcfListenDevice nfcfDev;
DiegoOstuni 0:8e1d760507b5 550 uint8_t devCnt = 0;
DiegoOstuni 0:8e1d760507b5 551 bool found = false;
DiegoOstuni 0:8e1d760507b5 552
DiegoOstuni 0:8e1d760507b5 553 /*******************************************************************************/
DiegoOstuni 0:8e1d760507b5 554 /* Felica/NFC_F_PASSIVE_POLL_MODE */
DiegoOstuni 0:8e1d760507b5 555 /*******************************************************************************/
DiegoOstuni 0:8e1d760507b5 556
DiegoOstuni 0:8e1d760507b5 557 rfalNfcfPollerInitialize( RFAL_BR_212, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ; /* Initialize for NFC-F */
DiegoOstuni 0:8e1d760507b5 558 rfalFieldOnAndStartGT( mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ; /* Turns the Field On if not already and start GT timer */
DiegoOstuni 0:8e1d760507b5 559
DiegoOstuni 0:8e1d760507b5 560 err = rfalNfcfPollerCheckPresence( mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:8e1d760507b5 561 if( err == ERR_NONE )
DiegoOstuni 0:8e1d760507b5 562 {
DiegoOstuni 0:8e1d760507b5 563 err = rfalNfcfPollerCollisionResolution( RFAL_COMPLIANCE_MODE_NFC, 1, &nfcfDev, &devCnt, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:8e1d760507b5 564
DiegoOstuni 0:8e1d760507b5 565 if( (err == ERR_NONE) && (devCnt > 0) )
DiegoOstuni 0:8e1d760507b5 566 {
DiegoOstuni 0:8e1d760507b5 567 /******************************************************/
DiegoOstuni 0:8e1d760507b5 568 /* NFC-F card found */
DiegoOstuni 0:8e1d760507b5 569 /* NFCID/UID is contained in: nfcfDev.sensfRes.NFCID2 */
DiegoOstuni 0:8e1d760507b5 570 found = true;
DiegoOstuni 0:8e1d760507b5 571 fieldLED_01 -> write(1);
DiegoOstuni 0:8e1d760507b5 572 //("Felica/NFC-F card found. UID: %s\r\n", hex2Str(nfcfDev.sensfRes.NFCID2, RFAL_NFCF_NFCID2_LEN));
DiegoOstuni 0:8e1d760507b5 573
DiegoOstuni 0:8e1d760507b5 574
DiegoOstuni 0:8e1d760507b5 575
DiegoOstuni 0:8e1d760507b5 576 /* Check if device supports P2P/NFC-DEP */
DiegoOstuni 0:8e1d760507b5 577 if( rfalNfcfIsNfcDepSupported( &nfcfDev ) )
DiegoOstuni 0:8e1d760507b5 578 {
DiegoOstuni 0:8e1d760507b5 579 /* Continue with P2P (NFC-DEP) activation */
DiegoOstuni 0:8e1d760507b5 580 err = demoActivateP2P( nfcfDev.sensfRes.NFCID2, RFAL_NFCDEP_NFCID3_LEN, false, &gDevProto.nfcDepDev, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:8e1d760507b5 581 if (err == ERR_NONE)
DiegoOstuni 0:8e1d760507b5 582 {
DiegoOstuni 0:8e1d760507b5 583 /*********************************************/
DiegoOstuni 0:8e1d760507b5 584 /* Passive P2P device activated */
DiegoOstuni 0:8e1d760507b5 585 //("NFCF Passive P2P device found. NFCID: %s\r\n", hex2Str(gDevProto.nfcDepDev.activation.Target.ATR_RES.NFCID3, RFAL_NFCDEP_NFCID3_LEN));
DiegoOstuni 0:8e1d760507b5 586
DiegoOstuni 0:8e1d760507b5 587 /* Send an URI record */
DiegoOstuni 0:8e1d760507b5 588 demoSendNdefUri( mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:8e1d760507b5 589 }
DiegoOstuni 0:8e1d760507b5 590 }
DiegoOstuni 0:8e1d760507b5 591 }
DiegoOstuni 0:8e1d760507b5 592 }
DiegoOstuni 0:8e1d760507b5 593 return found;
DiegoOstuni 0:8e1d760507b5 594 }
DiegoOstuni 0:8e1d760507b5 595
DiegoOstuni 0:8e1d760507b5 596
DiegoOstuni 0:8e1d760507b5 597 /*!
DiegoOstuni 0:8e1d760507b5 598 *****************************************************************************
DiegoOstuni 0:8e1d760507b5 599 * \brief Poll NFC-V
DiegoOstuni 0:8e1d760507b5 600 *
DiegoOstuni 0:8e1d760507b5 601 * Configures the RFAL to NFC-V (ISO15693) communication, polls for a nearby
DiegoOstuni 0:8e1d760507b5 602 * NFC-V device. If a device is found turns On a LED and logs its UID
DiegoOstuni 0:8e1d760507b5 603 *
DiegoOstuni 0:8e1d760507b5 604 *
DiegoOstuni 0:8e1d760507b5 605 * \return true : NFC-V device found
DiegoOstuni 0:8e1d760507b5 606 * \return false : No device found
DiegoOstuni 0:8e1d760507b5 607 *
DiegoOstuni 0:8e1d760507b5 608 *****************************************************************************
DiegoOstuni 0:8e1d760507b5 609 */
DiegoOstuni 0:8e1d760507b5 610 bool demoPollNFCV( 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:8e1d760507b5 611 {
DiegoOstuni 0:8e1d760507b5 612 ReturnCode err;
DiegoOstuni 0:8e1d760507b5 613 rfalNfcvListenDevice nfcvDev;
DiegoOstuni 0:8e1d760507b5 614 bool found = false;
DiegoOstuni 0:8e1d760507b5 615 uint8_t devCnt = 0;
DiegoOstuni 0:8e1d760507b5 616
DiegoOstuni 0:8e1d760507b5 617 /*******************************************************************************/
DiegoOstuni 0:8e1d760507b5 618 /* ISO15693/NFC_V_PASSIVE_POLL_MODE */
DiegoOstuni 0:8e1d760507b5 619 /*******************************************************************************/
DiegoOstuni 0:8e1d760507b5 620
DiegoOstuni 0:8e1d760507b5 621 rfalNfcvPollerInitialize( mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ; /* Initialize for NFC-F */
DiegoOstuni 0:8e1d760507b5 622 rfalFieldOnAndStartGT( mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ; /* Turns the Field On if not already and start GT timer */
DiegoOstuni 0:8e1d760507b5 623
DiegoOstuni 0:8e1d760507b5 624 err = rfalNfcvPollerCollisionResolution(1, &nfcvDev, &devCnt, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:8e1d760507b5 625 if( (err == ERR_NONE) && (devCnt > 0) )
DiegoOstuni 0:8e1d760507b5 626 {
DiegoOstuni 0:8e1d760507b5 627 /******************************************************/
DiegoOstuni 0:8e1d760507b5 628 /* NFC-V card found */
DiegoOstuni 0:8e1d760507b5 629 /* NFCID/UID is contained in: invRes.UID */
DiegoOstuni 0:8e1d760507b5 630 REVERSE_BYTES(nfcvDev.InvRes.UID, RFAL_NFCV_UID_LEN);
DiegoOstuni 0:8e1d760507b5 631
DiegoOstuni 0:8e1d760507b5 632 found = true;
DiegoOstuni 0:8e1d760507b5 633 fieldLED_04 -> write(1);
DiegoOstuni 0:8e1d760507b5 634 //("ISO15693/NFC-V card found. UID: %s\r\n", hex2Str(nfcvDev.InvRes.UID, RFAL_NFCV_UID_LEN));
DiegoOstuni 0:8e1d760507b5 635
DiegoOstuni 0:8e1d760507b5 636 }
DiegoOstuni 0:8e1d760507b5 637
DiegoOstuni 0:8e1d760507b5 638 return found;
DiegoOstuni 0:8e1d760507b5 639 }
DiegoOstuni 0:8e1d760507b5 640
DiegoOstuni 0:8e1d760507b5 641 /*!
DiegoOstuni 0:8e1d760507b5 642 *****************************************************************************
DiegoOstuni 0:8e1d760507b5 643 * \brief Activate P2P
DiegoOstuni 0:8e1d760507b5 644 *
DiegoOstuni 0:8e1d760507b5 645 * Configures NFC-DEP layer and executes the NFC-DEP/P2P activation (ATR_REQ
DiegoOstuni 0:8e1d760507b5 646 * and PSL_REQ if applicable)
DiegoOstuni 0:8e1d760507b5 647 *
DiegoOstuni 0:8e1d760507b5 648 * \param[in] nfcid : nfcid to be used
DiegoOstuni 0:8e1d760507b5 649 * \param[in] nfcidLen : length of nfcid
DiegoOstuni 0:8e1d760507b5 650 * \param[in] isActive : Active or Passive communication
DiegoOstuni 0:8e1d760507b5 651 * \param[out] nfcDepDev : If activation successful, device's Info
DiegoOstuni 0:8e1d760507b5 652 *
DiegoOstuni 0:8e1d760507b5 653 * \return ERR_PARAM : Invalid parameters
DiegoOstuni 0:8e1d760507b5 654 * \return ERR_TIMEOUT : Timeout error
DiegoOstuni 0:8e1d760507b5 655 * \return ERR_FRAMING : Framing error detected
DiegoOstuni 0:8e1d760507b5 656 * \return ERR_PROTO : Protocol error detected
DiegoOstuni 0:8e1d760507b5 657 * \return ERR_NONE : No error, activation successful
DiegoOstuni 0:8e1d760507b5 658 *
DiegoOstuni 0:8e1d760507b5 659 *****************************************************************************
DiegoOstuni 0:8e1d760507b5 660 */
DiegoOstuni 0:8e1d760507b5 661 ReturnCode demoActivateP2P( uint8_t* nfcid, uint8_t nfidLen, bool isActive, rfalNfcDepDevice *nfcDepDev, 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:8e1d760507b5 662 {
DiegoOstuni 0:8e1d760507b5 663 rfalNfcDepAtrParam nfcDepParams;
DiegoOstuni 0:8e1d760507b5 664
DiegoOstuni 0:8e1d760507b5 665 nfcDepParams.nfcid = nfcid;
DiegoOstuni 0:8e1d760507b5 666 nfcDepParams.nfcidLen = nfidLen;
DiegoOstuni 0:8e1d760507b5 667 nfcDepParams.BS = RFAL_NFCDEP_Bx_NO_HIGH_BR;
DiegoOstuni 0:8e1d760507b5 668 nfcDepParams.BR = RFAL_NFCDEP_Bx_NO_HIGH_BR;
DiegoOstuni 0:8e1d760507b5 669 nfcDepParams.LR = RFAL_NFCDEP_LR_254;
DiegoOstuni 0:8e1d760507b5 670 nfcDepParams.DID = RFAL_NFCDEP_DID_NO;
DiegoOstuni 0:8e1d760507b5 671 nfcDepParams.NAD = RFAL_NFCDEP_NAD_NO;
DiegoOstuni 0:8e1d760507b5 672 nfcDepParams.GBLen = sizeof(GB);
DiegoOstuni 0:8e1d760507b5 673 nfcDepParams.GB = GB;
DiegoOstuni 0:8e1d760507b5 674 nfcDepParams.commMode = ((isActive) ? RFAL_NFCDEP_COMM_ACTIVE : RFAL_NFCDEP_COMM_PASSIVE);
DiegoOstuni 0:8e1d760507b5 675 nfcDepParams.operParam = (RFAL_NFCDEP_OPER_FULL_MI_EN | RFAL_NFCDEP_OPER_EMPTY_DEP_DIS | RFAL_NFCDEP_OPER_ATN_EN | RFAL_NFCDEP_OPER_RTOX_REQ_EN);
DiegoOstuni 0:8e1d760507b5 676
DiegoOstuni 0:8e1d760507b5 677 /* Initialize NFC-DEP protocol layer */
DiegoOstuni 0:8e1d760507b5 678 rfalNfcDepInitialize();
DiegoOstuni 0:8e1d760507b5 679
DiegoOstuni 0:8e1d760507b5 680 /* Handle NFC-DEP Activation (ATR_REQ and PSL_REQ if applicable) */
DiegoOstuni 0:8e1d760507b5 681 return rfalNfcDepInitiatorHandleActivation( &nfcDepParams, RFAL_BR_424, nfcDepDev, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:8e1d760507b5 682 }
DiegoOstuni 0:8e1d760507b5 683
DiegoOstuni 0:8e1d760507b5 684
DiegoOstuni 0:8e1d760507b5 685 /*!
DiegoOstuni 0:8e1d760507b5 686 *****************************************************************************
DiegoOstuni 0:8e1d760507b5 687 * \brief Send URI
DiegoOstuni 0:8e1d760507b5 688 *
DiegoOstuni 0:8e1d760507b5 689 * Sends a NDEF URI record 'http://www.ST.com' via NFC-DEP (P2P) protocol.
DiegoOstuni 0:8e1d760507b5 690 *
DiegoOstuni 0:8e1d760507b5 691 * This method sends a set of static predefined frames which tries to establish
DiegoOstuni 0:8e1d760507b5 692 * a LLCP connection, followed by the NDEF record, and then keeps sending
DiegoOstuni 0:8e1d760507b5 693 * LLCP SYMM packets to maintain the connection.
DiegoOstuni 0:8e1d760507b5 694 *
DiegoOstuni 0:8e1d760507b5 695 *
DiegoOstuni 0:8e1d760507b5 696 * \return true : NDEF URI was sent
DiegoOstuni 0:8e1d760507b5 697 * \return false : Exchange failed
DiegoOstuni 0:8e1d760507b5 698 *
DiegoOstuni 0:8e1d760507b5 699 *****************************************************************************
DiegoOstuni 0:8e1d760507b5 700 */
DiegoOstuni 0:8e1d760507b5 701 void demoSendNdefUri( 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:8e1d760507b5 702 {
DiegoOstuni 0:8e1d760507b5 703 uint16_t actLen = 0;
DiegoOstuni 0:8e1d760507b5 704 ReturnCode err = ERR_NONE;
DiegoOstuni 0:8e1d760507b5 705
DiegoOstuni 0:8e1d760507b5 706 //(" Initalize device .. ");
DiegoOstuni 0:8e1d760507b5 707 if(ERR_NONE != demoNfcDepBlockingTxRx( &gDevProto.nfcDepDev, ndefInit, sizeof(ndefInit), gRxBuf.rxBuf, sizeof(gRxBuf.rxBuf), &actLen , mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) )
DiegoOstuni 0:8e1d760507b5 708 {
DiegoOstuni 0:8e1d760507b5 709 //("failed.");
DiegoOstuni 0:8e1d760507b5 710 return;
DiegoOstuni 0:8e1d760507b5 711 }
DiegoOstuni 0:8e1d760507b5 712 //("succeeded.\r\n");
DiegoOstuni 0:8e1d760507b5 713
DiegoOstuni 0:8e1d760507b5 714 actLen = 0;
DiegoOstuni 0:8e1d760507b5 715 //(" Push NDEF Uri: www.ST.com .. ");
DiegoOstuni 0:8e1d760507b5 716 if(ERR_NONE != demoNfcDepBlockingTxRx( &gDevProto.nfcDepDev, ndefUriSTcom, sizeof(ndefUriSTcom), gRxBuf.rxBuf, sizeof(gRxBuf.rxBuf), &actLen, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) )
DiegoOstuni 0:8e1d760507b5 717 {
DiegoOstuni 0:8e1d760507b5 718 //("failed.");
DiegoOstuni 0:8e1d760507b5 719 return;
DiegoOstuni 0:8e1d760507b5 720 }
DiegoOstuni 0:8e1d760507b5 721 //("succeeded.\r\n");
DiegoOstuni 0:8e1d760507b5 722
DiegoOstuni 0:8e1d760507b5 723
DiegoOstuni 0:8e1d760507b5 724 //(" Device present, maintaining connection ");
DiegoOstuni 0:8e1d760507b5 725 while(err == ERR_NONE)
DiegoOstuni 0:8e1d760507b5 726 {
DiegoOstuni 0:8e1d760507b5 727 err = demoNfcDepBlockingTxRx( &gDevProto.nfcDepDev, ndefPing, sizeof(ndefPing), gRxBuf.rxBuf, sizeof(gRxBuf.rxBuf), &actLen, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:8e1d760507b5 728 //(".");
DiegoOstuni 0:8e1d760507b5 729 platformDelay(50);
DiegoOstuni 0:8e1d760507b5 730 }
DiegoOstuni 0:8e1d760507b5 731 //("\r\n Device removed.\r\n");
DiegoOstuni 0:8e1d760507b5 732
DiegoOstuni 0:8e1d760507b5 733 }
DiegoOstuni 0:8e1d760507b5 734
DiegoOstuni 0:8e1d760507b5 735
DiegoOstuni 0:8e1d760507b5 736 /*!
DiegoOstuni 0:8e1d760507b5 737 *****************************************************************************
DiegoOstuni 0:8e1d760507b5 738 * \brief Exchange APDUs
DiegoOstuni 0:8e1d760507b5 739 *
DiegoOstuni 0:8e1d760507b5 740 * Example how to exchange a set of predefined APDUs with PICC. The NDEF
DiegoOstuni 0:8e1d760507b5 741 * application will be selected and then CC will be selected and read.
DiegoOstuni 0:8e1d760507b5 742 *
DiegoOstuni 0:8e1d760507b5 743 *****************************************************************************
DiegoOstuni 0:8e1d760507b5 744 */
DiegoOstuni 0:8e1d760507b5 745 void demoSendAPDUs( 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:8e1d760507b5 746 {
DiegoOstuni 0:8e1d760507b5 747 uint16_t rxLen;
DiegoOstuni 0:8e1d760507b5 748 ReturnCode err;
DiegoOstuni 0:8e1d760507b5 749
DiegoOstuni 0:8e1d760507b5 750 /* Exchange APDU: NDEF Tag Application Select command */
DiegoOstuni 0:8e1d760507b5 751 err = demoIsoDepBlockingTxRx(&gDevProto.isoDepDev, ndefSelectApp, sizeof(ndefSelectApp), gRxBuf.rxBuf, sizeof(gRxBuf.rxBuf), &rxLen, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:8e1d760507b5 752
DiegoOstuni 0:8e1d760507b5 753 if( (err == ERR_NONE) && gRxBuf.rxBuf[0] == 0x90 && gRxBuf.rxBuf[1] == 0x00)
DiegoOstuni 0:8e1d760507b5 754 {
DiegoOstuni 0:8e1d760507b5 755 //(" Select NDEF App successfully \r\n");
DiegoOstuni 0:8e1d760507b5 756
DiegoOstuni 0:8e1d760507b5 757 /* Exchange APDU: Select Capability Container File */
DiegoOstuni 0:8e1d760507b5 758 err = demoIsoDepBlockingTxRx(&gDevProto.isoDepDev, ccSelectFile, sizeof(ccSelectFile), gRxBuf.rxBuf, sizeof(gRxBuf.rxBuf), &rxLen, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:8e1d760507b5 759
DiegoOstuni 0:8e1d760507b5 760 /* Exchange APDU: Read Capability Container File */
DiegoOstuni 0:8e1d760507b5 761 err = demoIsoDepBlockingTxRx(&gDevProto.isoDepDev, readBynary, sizeof(readBynary), gRxBuf.rxBuf, sizeof(gRxBuf.rxBuf), &rxLen, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:8e1d760507b5 762 }
DiegoOstuni 0:8e1d760507b5 763 }
DiegoOstuni 0:8e1d760507b5 764
DiegoOstuni 0:8e1d760507b5 765 /*!
DiegoOstuni 0:8e1d760507b5 766 *****************************************************************************
DiegoOstuni 0:8e1d760507b5 767 * \brief ISO-DEP Blocking Transceive
DiegoOstuni 0:8e1d760507b5 768 *
DiegoOstuni 0:8e1d760507b5 769 * Helper function to send data in a blocking manner via the rfalIsoDep module
DiegoOstuni 0:8e1d760507b5 770 *
DiegoOstuni 0:8e1d760507b5 771 * \warning A protocol transceive handles long timeouts (several seconds),
DiegoOstuni 0:8e1d760507b5 772 * transmission errors and retransmissions which may lead to a long period of
DiegoOstuni 0:8e1d760507b5 773 * time where the MCU/CPU is blocked in this method.
DiegoOstuni 0:8e1d760507b5 774 * This is a demo implementation, for a non-blocking usage example please
DiegoOstuni 0:8e1d760507b5 775 * refer to the Examples available with RFAL
DiegoOstuni 0:8e1d760507b5 776 *
DiegoOstuni 0:8e1d760507b5 777 *
DiegoOstuni 0:8e1d760507b5 778 * \param[in] isoDepDev : device details retrived during activation
DiegoOstuni 0:8e1d760507b5 779 * \param[in] txBuf : data to be transmitted
DiegoOstuni 0:8e1d760507b5 780 * \param[in] txBufSize : size of the data to be transmited
DiegoOstuni 0:8e1d760507b5 781 * \param[out] rxBuf : buffer to place receive data
DiegoOstuni 0:8e1d760507b5 782 * \param[in] rxBufSize : size of the reception buffer
DiegoOstuni 0:8e1d760507b5 783 * \param[out] rxActLen : number of data bytes received
DiegoOstuni 0:8e1d760507b5 784
DiegoOstuni 0:8e1d760507b5 785 *
DiegoOstuni 0:8e1d760507b5 786 * \return ERR_PARAM : Invalid parameters
DiegoOstuni 0:8e1d760507b5 787 * \return ERR_TIMEOUT : Timeout error
DiegoOstuni 0:8e1d760507b5 788 * \return ERR_FRAMING : Framing error detected
DiegoOstuni 0:8e1d760507b5 789 * \return ERR_PROTO : Protocol error detected
DiegoOstuni 0:8e1d760507b5 790 * \return ERR_NONE : No error, activation successful
DiegoOstuni 0:8e1d760507b5 791 *
DiegoOstuni 0:8e1d760507b5 792 *****************************************************************************
DiegoOstuni 0:8e1d760507b5 793 */
DiegoOstuni 0:8e1d760507b5 794 ReturnCode demoIsoDepBlockingTxRx( rfalIsoDepDevice *isoDepDev, const uint8_t *txBuf, uint16_t txBufSize, uint8_t *rxBuf, uint16_t rxBufSize, uint16_t *rxActLen, 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:8e1d760507b5 795 {
DiegoOstuni 0:8e1d760507b5 796 ReturnCode err;
DiegoOstuni 0:8e1d760507b5 797 rfalIsoDepApduTxRxParam isoDepTxRx;
DiegoOstuni 0:8e1d760507b5 798
DiegoOstuni 0:8e1d760507b5 799 /* Initialize the ISO-DEP protocol transceive context */
DiegoOstuni 0:8e1d760507b5 800 isoDepTxRx.txBuf = &gTxBuf.isoDepTxBuf;
DiegoOstuni 0:8e1d760507b5 801 isoDepTxRx.txBufLen = txBufSize;
DiegoOstuni 0:8e1d760507b5 802 isoDepTxRx.DID = isoDepDev->info.DID;
DiegoOstuni 0:8e1d760507b5 803 isoDepTxRx.FWT = isoDepDev->info.FWT;
DiegoOstuni 0:8e1d760507b5 804 isoDepTxRx.dFWT = isoDepDev->info.dFWT;
DiegoOstuni 0:8e1d760507b5 805 isoDepTxRx.FSx = isoDepDev->info.FSx;
DiegoOstuni 0:8e1d760507b5 806 isoDepTxRx.ourFSx = RFAL_ISODEP_FSX_KEEP;
DiegoOstuni 0:8e1d760507b5 807 isoDepTxRx.rxBuf = &gRxBuf.isoDepRxBuf;
DiegoOstuni 0:8e1d760507b5 808 isoDepTxRx.rxLen = rxActLen;
DiegoOstuni 0:8e1d760507b5 809 isoDepTxRx.tmpBuf = &tmpBuf;
DiegoOstuni 0:8e1d760507b5 810
DiegoOstuni 0:8e1d760507b5 811
DiegoOstuni 0:8e1d760507b5 812 /* Copy data to send */
DiegoOstuni 0:8e1d760507b5 813 ST_MEMMOVE( gTxBuf.isoDepTxBuf.apdu, txBuf, MIN( txBufSize, RFAL_ISODEP_DEFAULT_FSC ) );
DiegoOstuni 0:8e1d760507b5 814
DiegoOstuni 0:8e1d760507b5 815 /* Perform the ISO-DEP Transceive in a blocking way */
DiegoOstuni 0:8e1d760507b5 816 rfalIsoDepStartApduTransceive( isoDepTxRx );
DiegoOstuni 0:8e1d760507b5 817 do {
DiegoOstuni 0:8e1d760507b5 818 rfalWorker( mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:8e1d760507b5 819 err = rfalIsoDepGetApduTransceiveStatus( mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:8e1d760507b5 820 } while(err == ERR_BUSY);
DiegoOstuni 0:8e1d760507b5 821
DiegoOstuni 0:8e1d760507b5 822 //(" ISO-DEP TxRx %s: - Tx: %s Rx: %s \r\n", (err != ERR_NONE) ? "FAIL": "OK", hex2Str((uint8_t*)txBuf, txBufSize), (err != ERR_NONE) ? "": hex2Str( isoDepTxRx.rxBuf->apdu, *rxActLen));
DiegoOstuni 0:8e1d760507b5 823
DiegoOstuni 0:8e1d760507b5 824 if( err != ERR_NONE )
DiegoOstuni 0:8e1d760507b5 825 {
DiegoOstuni 0:8e1d760507b5 826 return err;
DiegoOstuni 0:8e1d760507b5 827 }
DiegoOstuni 0:8e1d760507b5 828
DiegoOstuni 0:8e1d760507b5 829 /* Copy received data */
DiegoOstuni 0:8e1d760507b5 830 ST_MEMMOVE( rxBuf, isoDepTxRx.rxBuf->apdu, MIN(*rxActLen, rxBufSize) );
DiegoOstuni 0:8e1d760507b5 831 return ERR_NONE;
DiegoOstuni 0:8e1d760507b5 832 }
DiegoOstuni 0:8e1d760507b5 833
DiegoOstuni 0:8e1d760507b5 834
DiegoOstuni 0:8e1d760507b5 835 /*!
DiegoOstuni 0:8e1d760507b5 836 *****************************************************************************
DiegoOstuni 0:8e1d760507b5 837 * \brief NFC-DEP Blocking Transceive
DiegoOstuni 0:8e1d760507b5 838 *
DiegoOstuni 0:8e1d760507b5 839 * Helper function to send data in a blocking manner via the rfalNfcDep module
DiegoOstuni 0:8e1d760507b5 840 *
DiegoOstuni 0:8e1d760507b5 841 * \warning A protocol transceive handles long timeouts (several seconds),
DiegoOstuni 0:8e1d760507b5 842 * transmission errors and retransmissions which may lead to a long period of
DiegoOstuni 0:8e1d760507b5 843 * time where the MCU/CPU is blocked in this method.
DiegoOstuni 0:8e1d760507b5 844 * This is a demo implementation, for a non-blocking usage example please
DiegoOstuni 0:8e1d760507b5 845 * refer to the Examples available with RFAL
DiegoOstuni 0:8e1d760507b5 846 *
DiegoOstuni 0:8e1d760507b5 847 * \param[in] nfcDepDev : device details retrived during activation
DiegoOstuni 0:8e1d760507b5 848 * \param[in] txBuf : data to be transmitted
DiegoOstuni 0:8e1d760507b5 849 * \param[in] txBufSize : size of the data to be transmited
DiegoOstuni 0:8e1d760507b5 850 * \param[out] rxBuf : buffer to place receive data
DiegoOstuni 0:8e1d760507b5 851 * \param[in] rxBufSize : size of the reception buffer
DiegoOstuni 0:8e1d760507b5 852 * \param[out] rxActLen : number of data bytes received
DiegoOstuni 0:8e1d760507b5 853
DiegoOstuni 0:8e1d760507b5 854 *
DiegoOstuni 0:8e1d760507b5 855 * \return ERR_PARAM : Invalid parameters
DiegoOstuni 0:8e1d760507b5 856 * \return ERR_TIMEOUT : Timeout error
DiegoOstuni 0:8e1d760507b5 857 * \return ERR_FRAMING : Framing error detected
DiegoOstuni 0:8e1d760507b5 858 * \return ERR_PROTO : Protocol error detected
DiegoOstuni 0:8e1d760507b5 859 * \return ERR_NONE : No error, activation successful
DiegoOstuni 0:8e1d760507b5 860 *
DiegoOstuni 0:8e1d760507b5 861 *****************************************************************************
DiegoOstuni 0:8e1d760507b5 862 */
DiegoOstuni 0:8e1d760507b5 863 ReturnCode demoNfcDepBlockingTxRx( rfalNfcDepDevice *nfcDepDev, const uint8_t *txBuf, uint16_t txBufSize, uint8_t *rxBuf, uint16_t rxBufSize, uint16_t *rxActLen, 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:8e1d760507b5 864 {
DiegoOstuni 0:8e1d760507b5 865 ReturnCode err;
DiegoOstuni 0:8e1d760507b5 866 bool isChaining;
DiegoOstuni 0:8e1d760507b5 867 rfalNfcDepTxRxParam rfalNfcDepTxRx;
DiegoOstuni 0:8e1d760507b5 868
DiegoOstuni 0:8e1d760507b5 869
DiegoOstuni 0:8e1d760507b5 870 /* Initialize the NFC-DEP protocol transceive context */
DiegoOstuni 0:8e1d760507b5 871 rfalNfcDepTxRx.txBuf = &gTxBuf.nfcDepTxBuf;
DiegoOstuni 0:8e1d760507b5 872 rfalNfcDepTxRx.txBufLen = txBufSize;
DiegoOstuni 0:8e1d760507b5 873 rfalNfcDepTxRx.rxBuf = &gRxBuf.nfcDepRxBuf;
DiegoOstuni 0:8e1d760507b5 874 rfalNfcDepTxRx.rxLen = rxActLen;
DiegoOstuni 0:8e1d760507b5 875 rfalNfcDepTxRx.DID = RFAL_NFCDEP_DID_NO;
DiegoOstuni 0:8e1d760507b5 876 rfalNfcDepTxRx.FSx = rfalNfcDepLR2FS( rfalNfcDepPP2LR( nfcDepDev->activation.Target.ATR_RES.PPt ) );
DiegoOstuni 0:8e1d760507b5 877 rfalNfcDepTxRx.FWT = nfcDepDev->info.FWT;
DiegoOstuni 0:8e1d760507b5 878 rfalNfcDepTxRx.dFWT = nfcDepDev->info.dFWT;
DiegoOstuni 0:8e1d760507b5 879 rfalNfcDepTxRx.isRxChaining = &isChaining;
DiegoOstuni 0:8e1d760507b5 880 rfalNfcDepTxRx.isTxChaining = false;
DiegoOstuni 0:8e1d760507b5 881
DiegoOstuni 0:8e1d760507b5 882 /* Copy data to send */
DiegoOstuni 0:8e1d760507b5 883 ST_MEMMOVE( gTxBuf.nfcDepTxBuf.inf, txBuf, MIN( txBufSize, RFAL_NFCDEP_FRAME_SIZE_MAX_LEN ) );
DiegoOstuni 0:8e1d760507b5 884
DiegoOstuni 0:8e1d760507b5 885 /* Perform the NFC-DEP Transceive in a blocking way */
DiegoOstuni 0:8e1d760507b5 886 rfalNfcDepStartTransceive( &rfalNfcDepTxRx );
DiegoOstuni 0:8e1d760507b5 887 do {
DiegoOstuni 0:8e1d760507b5 888 rfalWorker( mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:8e1d760507b5 889 err = rfalNfcDepGetTransceiveStatus( mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:8e1d760507b5 890 } while(err == ERR_BUSY);
DiegoOstuni 0:8e1d760507b5 891
DiegoOstuni 0:8e1d760507b5 892 /* //(" NFC-DEP TxRx %s: - Tx: %s Rx: %s \r\n", (err != ERR_NONE) ? "FAIL": "OK", hex2Str( (uint8_t*)rfalNfcDepTxRx.txBuf, txBufSize), (err != ERR_NONE) ? "": hex2Str( rfalNfcDepTxRx.rxBuf->inf, *rxActLen)); */
DiegoOstuni 0:8e1d760507b5 893
DiegoOstuni 0:8e1d760507b5 894 if( err != ERR_NONE )
DiegoOstuni 0:8e1d760507b5 895 {
DiegoOstuni 0:8e1d760507b5 896 return err;
DiegoOstuni 0:8e1d760507b5 897 }
DiegoOstuni 0:8e1d760507b5 898
DiegoOstuni 0:8e1d760507b5 899 /* Copy received data */
DiegoOstuni 0:8e1d760507b5 900 ST_MEMMOVE( rxBuf, gRxBuf.nfcDepRxBuf.inf, MIN(*rxActLen, rxBufSize) );
DiegoOstuni 0:8e1d760507b5 901 return ERR_NONE;
DiegoOstuni 0:8e1d760507b5 902 }
DiegoOstuni 0:8e1d760507b5 903
DiegoOstuni 0:8e1d760507b5 904
DiegoOstuni 0:8e1d760507b5 905
DiegoOstuni 0:8e1d760507b5 906
DiegoOstuni 0:8e1d760507b5 907 /**
DiegoOstuni 0:8e1d760507b5 908 * @}
DiegoOstuni 0:8e1d760507b5 909 */
DiegoOstuni 0:8e1d760507b5 910
DiegoOstuni 0:8e1d760507b5 911 /**
DiegoOstuni 0:8e1d760507b5 912 * @}
DiegoOstuni 0:8e1d760507b5 913 */
DiegoOstuni 0:8e1d760507b5 914
DiegoOstuni 0:8e1d760507b5 915 /**
DiegoOstuni 0:8e1d760507b5 916 * @}
DiegoOstuni 0:8e1d760507b5 917 */
DiegoOstuni 0:8e1d760507b5 918
DiegoOstuni 0:8e1d760507b5 919 /******************* (C) COPYRIGHT 2017 STMicroelectronics *****END OF FILE****/