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_st25tb.c
DiegoOstuni 0:75fc82583a41 30 *
DiegoOstuni 0:75fc82583a41 31 * \author Gustavo Patricio
DiegoOstuni 0:75fc82583a41 32 *
DiegoOstuni 0:75fc82583a41 33 * \brief Implementation of ST25TB interface
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 "rfal_st25tb.h"
DiegoOstuni 0:75fc82583a41 43 #include "utils.h"
DiegoOstuni 0:75fc82583a41 44 #include "platform1.h"
DiegoOstuni 0:75fc82583a41 45
DiegoOstuni 0:75fc82583a41 46 /*
DiegoOstuni 0:75fc82583a41 47 ******************************************************************************
DiegoOstuni 0:75fc82583a41 48 * ENABLE SWITCH
DiegoOstuni 0:75fc82583a41 49 ******************************************************************************
DiegoOstuni 0:75fc82583a41 50 */
DiegoOstuni 0:75fc82583a41 51 #ifndef RFAL_FEATURE_ST25TB
DiegoOstuni 0:75fc82583a41 52 #error " RFAL: Module configuration missing. Please enable/disable ST25TB module by setting: RFAL_FEATURE_ST25TB "
DiegoOstuni 0:75fc82583a41 53 #endif
DiegoOstuni 0:75fc82583a41 54
DiegoOstuni 0:75fc82583a41 55 #if RFAL_FEATURE_ST25TB
DiegoOstuni 0:75fc82583a41 56
DiegoOstuni 0:75fc82583a41 57 /*
DiegoOstuni 0:75fc82583a41 58 ******************************************************************************
DiegoOstuni 0:75fc82583a41 59 * GLOBAL DEFINES
DiegoOstuni 0:75fc82583a41 60 ******************************************************************************
DiegoOstuni 0:75fc82583a41 61 */
DiegoOstuni 0:75fc82583a41 62
DiegoOstuni 0:75fc82583a41 63 #define RFAL_ST25TB_CMD_LEN 1 /*!< ST25TB length of a command */
DiegoOstuni 0:75fc82583a41 64 #define RFAL_ST25TB_SLOTS 16 /*!< ST25TB number of slots */
DiegoOstuni 0:75fc82583a41 65 #define RFAL_ST25TB_SLOTNUM_MASK 0x0F /*!< ST25TB Slot Number bit mask on SlotMarker */
DiegoOstuni 0:75fc82583a41 66 #define RFAL_ST25TB_SLOTNUM_SHIFT 4 /*!< ST25TB Slot Number shift on SlotMarker */
DiegoOstuni 0:75fc82583a41 67
DiegoOstuni 0:75fc82583a41 68 #define RFAL_ST25TB_INITIATE_CMD1 0x06 /*!< ST25TB Initiate command byte1 */
DiegoOstuni 0:75fc82583a41 69 #define RFAL_ST25TB_INITIATE_CMD2 0x00 /*!< ST25TB Initiate command byte2 */
DiegoOstuni 0:75fc82583a41 70 #define RFAL_ST25TB_PCALL_CMD1 0x06 /*!< ST25TB Pcall16 command byte1 */
DiegoOstuni 0:75fc82583a41 71 #define RFAL_ST25TB_PCALL_CMD2 0x04 /*!< ST25TB Pcall16 command byte2 */
DiegoOstuni 0:75fc82583a41 72 #define RFAL_ST25TB_SELECT_CMD 0x0E /*!< ST25TB Select command */
DiegoOstuni 0:75fc82583a41 73 #define RFAL_ST25TB_GET_UID_CMD 0x0B /*!< ST25TB Get UID command */
DiegoOstuni 0:75fc82583a41 74 #define RFAL_ST25TB_COMPLETION_CMD 0x0F /*!< ST25TB Completion command */
DiegoOstuni 0:75fc82583a41 75 #define RFAL_ST25TB_RESET_INV_CMD 0x0C /*!< ST25TB Reset to Inventory command */
DiegoOstuni 0:75fc82583a41 76 #define RFAL_ST25TB_READ_BLOCK_CMD 0x08 /*!< ST25TB Read Block command */
DiegoOstuni 0:75fc82583a41 77 #define RFAL_ST25TB_WRITE_BLOCK_CMD 0x09 /*!< ST25TB Write Block command */
DiegoOstuni 0:75fc82583a41 78
DiegoOstuni 0:75fc82583a41 79
DiegoOstuni 0:75fc82583a41 80 #define RFAL_ST25TB_T0 2157 /*!< ST25TB t0 159 us ST25TB RF characteristics */
DiegoOstuni 0:75fc82583a41 81 #define RFAL_ST25TB_T1 2048 /*!< ST25TB t1 151 us ST25TB RF characteristics */
DiegoOstuni 0:75fc82583a41 82
DiegoOstuni 0:75fc82583a41 83 #define RFAL_ST25TB_FWT (RFAL_ST25TB_T0 + RFAL_ST25TB_T1) /*!< ST25TB FWT = T0 + T1 */
DiegoOstuni 0:75fc82583a41 84 #define RFAL_ST25TB_TW rfalConvMsTo1fc(7) /*!< ST25TB TW : Programming time for write max 7ms */
DiegoOstuni 0:75fc82583a41 85
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 /*
DiegoOstuni 0:75fc82583a41 94 ******************************************************************************
DiegoOstuni 0:75fc82583a41 95 * GLOBAL TYPES
DiegoOstuni 0:75fc82583a41 96 ******************************************************************************
DiegoOstuni 0:75fc82583a41 97 */
DiegoOstuni 0:75fc82583a41 98
DiegoOstuni 0:75fc82583a41 99 /*! Initiate Request */
DiegoOstuni 0:75fc82583a41 100 typedef struct
DiegoOstuni 0:75fc82583a41 101 {
DiegoOstuni 0:75fc82583a41 102 uint8_t cmd1; /*!< Initiate Request cmd1: 0x06 */
DiegoOstuni 0:75fc82583a41 103 uint8_t cmd2; /*!< Initiate Request cmd2: 0x00 */
DiegoOstuni 0:75fc82583a41 104 } rfalSt25tbInitiateReq;
DiegoOstuni 0:75fc82583a41 105
DiegoOstuni 0:75fc82583a41 106 /*! Pcall16 Request */
DiegoOstuni 0:75fc82583a41 107 typedef struct
DiegoOstuni 0:75fc82583a41 108 {
DiegoOstuni 0:75fc82583a41 109 uint8_t cmd1; /*!< Pcal16 Request cmd1: 0x06 */
DiegoOstuni 0:75fc82583a41 110 uint8_t cmd2; /*!< Pcal16 Request cmd2: 0x04 */
DiegoOstuni 0:75fc82583a41 111 } rfalSt25tbPcallReq;
DiegoOstuni 0:75fc82583a41 112
DiegoOstuni 0:75fc82583a41 113
DiegoOstuni 0:75fc82583a41 114 /*! Select Request */
DiegoOstuni 0:75fc82583a41 115 typedef struct
DiegoOstuni 0:75fc82583a41 116 {
DiegoOstuni 0:75fc82583a41 117 uint8_t cmd; /*!< Select Request cmd: 0x0E */
DiegoOstuni 0:75fc82583a41 118 uint8_t chipId; /*!< Chip ID */
DiegoOstuni 0:75fc82583a41 119 } rfalSt25tbSelectReq;
DiegoOstuni 0:75fc82583a41 120
DiegoOstuni 0:75fc82583a41 121 /*! Read Block Request */
DiegoOstuni 0:75fc82583a41 122 typedef struct
DiegoOstuni 0:75fc82583a41 123 {
DiegoOstuni 0:75fc82583a41 124 uint8_t cmd; /*!< Select Request cmd: 0x08 */
DiegoOstuni 0:75fc82583a41 125 uint8_t address; /*!< Block address */
DiegoOstuni 0:75fc82583a41 126 } rfalSt25tbReadBlockReq;
DiegoOstuni 0:75fc82583a41 127
DiegoOstuni 0:75fc82583a41 128 /*! Write Block Request */
DiegoOstuni 0:75fc82583a41 129 typedef struct
DiegoOstuni 0:75fc82583a41 130 {
DiegoOstuni 0:75fc82583a41 131 uint8_t cmd; /*!< Select Request cmd: 0x09 */
DiegoOstuni 0:75fc82583a41 132 uint8_t address; /*!< Block address */
DiegoOstuni 0:75fc82583a41 133 rfalSt25tbBlock data; /*!< Block Data */
DiegoOstuni 0:75fc82583a41 134 } rfalSt25tbWriteBlockReq;
DiegoOstuni 0:75fc82583a41 135
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
DiegoOstuni 0:75fc82583a41 143
DiegoOstuni 0:75fc82583a41 144 /*
DiegoOstuni 0:75fc82583a41 145 ******************************************************************************
DiegoOstuni 0:75fc82583a41 146 * LOCAL VARIABLES
DiegoOstuni 0:75fc82583a41 147 ******************************************************************************
DiegoOstuni 0:75fc82583a41 148 */
DiegoOstuni 0:75fc82583a41 149
DiegoOstuni 0:75fc82583a41 150 /*
DiegoOstuni 0:75fc82583a41 151 ******************************************************************************
DiegoOstuni 0:75fc82583a41 152 * GLOBAL FUNCTIONS
DiegoOstuni 0:75fc82583a41 153 ******************************************************************************
DiegoOstuni 0:75fc82583a41 154 */
DiegoOstuni 0:75fc82583a41 155
DiegoOstuni 0:75fc82583a41 156 /*******************************************************************************/
DiegoOstuni 0:75fc82583a41 157 ReturnCode rfalSt25tbPollerInitialize( 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 158 {
DiegoOstuni 0:75fc82583a41 159 return rfalNfcbPollerInitialize( mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:75fc82583a41 160 }
DiegoOstuni 0:75fc82583a41 161
DiegoOstuni 0:75fc82583a41 162
DiegoOstuni 0:75fc82583a41 163 /*******************************************************************************/
DiegoOstuni 0:75fc82583a41 164 ReturnCode rfalSt25tbPollerCheckPresence( uint8_t *chipId, 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 165 {
DiegoOstuni 0:75fc82583a41 166 ReturnCode ret;
DiegoOstuni 0:75fc82583a41 167 uint8_t chipIdRes;
DiegoOstuni 0:75fc82583a41 168
DiegoOstuni 0:75fc82583a41 169 chipIdRes = 0x00;
DiegoOstuni 0:75fc82583a41 170
DiegoOstuni 0:75fc82583a41 171 /* Send Initiate Request */
DiegoOstuni 0:75fc82583a41 172 ret = rfalSt25tbPollerInitiate( &chipIdRes, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:75fc82583a41 173
DiegoOstuni 0:75fc82583a41 174 /* Check if a transmission error was detected */
DiegoOstuni 0:75fc82583a41 175 if( (ret == ERR_CRC) || (ret == ERR_FRAMING) )
DiegoOstuni 0:75fc82583a41 176 {
DiegoOstuni 0:75fc82583a41 177 return ERR_NONE;
DiegoOstuni 0:75fc82583a41 178 }
DiegoOstuni 0:75fc82583a41 179
DiegoOstuni 0:75fc82583a41 180 /* Copy chip ID if requested */
DiegoOstuni 0:75fc82583a41 181 if( chipId != NULL )
DiegoOstuni 0:75fc82583a41 182 {
DiegoOstuni 0:75fc82583a41 183 *chipId = chipIdRes;
DiegoOstuni 0:75fc82583a41 184 }
DiegoOstuni 0:75fc82583a41 185
DiegoOstuni 0:75fc82583a41 186 return ret;
DiegoOstuni 0:75fc82583a41 187 }
DiegoOstuni 0:75fc82583a41 188
DiegoOstuni 0:75fc82583a41 189
DiegoOstuni 0:75fc82583a41 190 /*******************************************************************************/
DiegoOstuni 0:75fc82583a41 191 ReturnCode rfalSt25tbPollerInitiate( uint8_t *chipId,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 192 {
DiegoOstuni 0:75fc82583a41 193 ReturnCode ret;
DiegoOstuni 0:75fc82583a41 194 uint16_t rxLen;
DiegoOstuni 0:75fc82583a41 195 rfalSt25tbInitiateReq initiateReq;
DiegoOstuni 0:75fc82583a41 196 uint8_t rxBuf[RFAL_ST25TB_CHIP_ID_LEN + RFAL_ST25TB_CRC_LEN]; /* In case we receive less data that CRC, RF layer will not remove the CRC from buffer */
DiegoOstuni 0:75fc82583a41 197
DiegoOstuni 0:75fc82583a41 198 /* Compute Initiate Request */
DiegoOstuni 0:75fc82583a41 199 initiateReq.cmd1 = RFAL_ST25TB_INITIATE_CMD1;
DiegoOstuni 0:75fc82583a41 200 initiateReq.cmd2 = RFAL_ST25TB_INITIATE_CMD2;
DiegoOstuni 0:75fc82583a41 201
DiegoOstuni 0:75fc82583a41 202 /* Send Initiate Request */
DiegoOstuni 0:75fc82583a41 203 ret = rfalTransceiveBlockingTxRx( (uint8_t*)&initiateReq, sizeof(rfalSt25tbInitiateReq), (uint8_t*)rxBuf, sizeof(rxBuf), &rxLen, RFAL_TXRX_FLAGS_DEFAULT, RFAL_ST25TB_FWT, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:75fc82583a41 204
DiegoOstuni 0:75fc82583a41 205 /* Check for valid Select Response */
DiegoOstuni 0:75fc82583a41 206 if( (ret == ERR_NONE) && (rxLen != RFAL_ST25TB_CHIP_ID_LEN) )
DiegoOstuni 0:75fc82583a41 207 {
DiegoOstuni 0:75fc82583a41 208 return ERR_PROTO;
DiegoOstuni 0:75fc82583a41 209 }
DiegoOstuni 0:75fc82583a41 210
DiegoOstuni 0:75fc82583a41 211 /* Copy chip ID if requested */
DiegoOstuni 0:75fc82583a41 212 if( chipId != NULL )
DiegoOstuni 0:75fc82583a41 213 {
DiegoOstuni 0:75fc82583a41 214 *chipId = *rxBuf;
DiegoOstuni 0:75fc82583a41 215 }
DiegoOstuni 0:75fc82583a41 216
DiegoOstuni 0:75fc82583a41 217 return ret;
DiegoOstuni 0:75fc82583a41 218 }
DiegoOstuni 0:75fc82583a41 219
DiegoOstuni 0:75fc82583a41 220
DiegoOstuni 0:75fc82583a41 221 /*******************************************************************************/
DiegoOstuni 0:75fc82583a41 222 ReturnCode rfalSt25tbPollerPcall( uint8_t *chipId,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 223 {
DiegoOstuni 0:75fc82583a41 224 ReturnCode ret;
DiegoOstuni 0:75fc82583a41 225 uint16_t rxLen;
DiegoOstuni 0:75fc82583a41 226 rfalSt25tbPcallReq pcallReq;
DiegoOstuni 0:75fc82583a41 227
DiegoOstuni 0:75fc82583a41 228 /* Compute Pcal16 Request */
DiegoOstuni 0:75fc82583a41 229 pcallReq.cmd1 = RFAL_ST25TB_PCALL_CMD1;
DiegoOstuni 0:75fc82583a41 230 pcallReq.cmd2 = RFAL_ST25TB_PCALL_CMD2;
DiegoOstuni 0:75fc82583a41 231
DiegoOstuni 0:75fc82583a41 232 /* Send Pcal16 Request */
DiegoOstuni 0:75fc82583a41 233 ret = rfalTransceiveBlockingTxRx( (uint8_t*)&pcallReq, sizeof(rfalSt25tbPcallReq), (uint8_t*)chipId, RFAL_ST25TB_CHIP_ID_LEN, &rxLen, RFAL_TXRX_FLAGS_DEFAULT, RFAL_ST25TB_FWT, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:75fc82583a41 234
DiegoOstuni 0:75fc82583a41 235 /* Check for valid Select Response */
DiegoOstuni 0:75fc82583a41 236 if( (ret == ERR_NONE) && (rxLen != RFAL_ST25TB_CHIP_ID_LEN) )
DiegoOstuni 0:75fc82583a41 237 {
DiegoOstuni 0:75fc82583a41 238 return ERR_PROTO;
DiegoOstuni 0:75fc82583a41 239 }
DiegoOstuni 0:75fc82583a41 240
DiegoOstuni 0:75fc82583a41 241 return ret;
DiegoOstuni 0:75fc82583a41 242 }
DiegoOstuni 0:75fc82583a41 243
DiegoOstuni 0:75fc82583a41 244
DiegoOstuni 0:75fc82583a41 245 /*******************************************************************************/
DiegoOstuni 0:75fc82583a41 246 ReturnCode rfalSt25tbPollerSlotMarker( uint8_t slotNum, uint8_t *chipIdRes,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 247 {
DiegoOstuni 0:75fc82583a41 248 ReturnCode ret;
DiegoOstuni 0:75fc82583a41 249 uint16_t rxLen;
DiegoOstuni 0:75fc82583a41 250 uint8_t slotMarker;
DiegoOstuni 0:75fc82583a41 251
DiegoOstuni 0:75fc82583a41 252 if( (slotNum == 0) || (slotNum > 15) )
DiegoOstuni 0:75fc82583a41 253 {
DiegoOstuni 0:75fc82583a41 254 return ERR_PARAM;
DiegoOstuni 0:75fc82583a41 255 }
DiegoOstuni 0:75fc82583a41 256
DiegoOstuni 0:75fc82583a41 257 /* Compute SlotMarker */
DiegoOstuni 0:75fc82583a41 258 slotMarker = ( ((slotNum & RFAL_ST25TB_SLOTNUM_MASK) << RFAL_ST25TB_SLOTNUM_SHIFT) | RFAL_ST25TB_PCALL_CMD1 );
DiegoOstuni 0:75fc82583a41 259
DiegoOstuni 0:75fc82583a41 260
DiegoOstuni 0:75fc82583a41 261 /* Send SlotMarker */
DiegoOstuni 0:75fc82583a41 262 ret = rfalTransceiveBlockingTxRx( (uint8_t*)&slotMarker, RFAL_ST25TB_CMD_LEN, (uint8_t*)chipIdRes, RFAL_ST25TB_CHIP_ID_LEN, &rxLen, RFAL_TXRX_FLAGS_DEFAULT, RFAL_ST25TB_FWT, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:75fc82583a41 263
DiegoOstuni 0:75fc82583a41 264 /* Check for valid ChipID Response */
DiegoOstuni 0:75fc82583a41 265 if( (ret == ERR_NONE) && (rxLen != RFAL_ST25TB_CHIP_ID_LEN) )
DiegoOstuni 0:75fc82583a41 266 {
DiegoOstuni 0:75fc82583a41 267 return ERR_PROTO;
DiegoOstuni 0:75fc82583a41 268 }
DiegoOstuni 0:75fc82583a41 269
DiegoOstuni 0:75fc82583a41 270 return ret;
DiegoOstuni 0:75fc82583a41 271 }
DiegoOstuni 0:75fc82583a41 272
DiegoOstuni 0:75fc82583a41 273
DiegoOstuni 0:75fc82583a41 274 /*******************************************************************************/
DiegoOstuni 0:75fc82583a41 275 ReturnCode rfalSt25tbPollerSelect( uint8_t chipId,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 276 {
DiegoOstuni 0:75fc82583a41 277 ReturnCode ret;
DiegoOstuni 0:75fc82583a41 278 uint16_t rxLen;
DiegoOstuni 0:75fc82583a41 279 rfalSt25tbSelectReq selectReq;
DiegoOstuni 0:75fc82583a41 280 uint8_t chipIdRes;
DiegoOstuni 0:75fc82583a41 281
DiegoOstuni 0:75fc82583a41 282 /* Compute Select Request */
DiegoOstuni 0:75fc82583a41 283 selectReq.cmd = RFAL_ST25TB_SELECT_CMD;
DiegoOstuni 0:75fc82583a41 284 selectReq.chipId = chipId;
DiegoOstuni 0:75fc82583a41 285
DiegoOstuni 0:75fc82583a41 286 /* Send Select Request */
DiegoOstuni 0:75fc82583a41 287 ret = rfalTransceiveBlockingTxRx( (uint8_t*)&selectReq, sizeof(rfalSt25tbSelectReq), (uint8_t*)&chipIdRes, RFAL_ST25TB_CHIP_ID_LEN, &rxLen, RFAL_TXRX_FLAGS_DEFAULT, RFAL_ST25TB_FWT, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:75fc82583a41 288
DiegoOstuni 0:75fc82583a41 289 /* Check for valid Select Response */
DiegoOstuni 0:75fc82583a41 290 if( (ret == ERR_NONE) && ((rxLen != RFAL_ST25TB_CHIP_ID_LEN) || (chipIdRes != chipId)) )
DiegoOstuni 0:75fc82583a41 291 {
DiegoOstuni 0:75fc82583a41 292 return ERR_PROTO;
DiegoOstuni 0:75fc82583a41 293 }
DiegoOstuni 0:75fc82583a41 294
DiegoOstuni 0:75fc82583a41 295 return ret;
DiegoOstuni 0:75fc82583a41 296 }
DiegoOstuni 0:75fc82583a41 297
DiegoOstuni 0:75fc82583a41 298
DiegoOstuni 0:75fc82583a41 299 /*******************************************************************************/
DiegoOstuni 0:75fc82583a41 300 ReturnCode rfalSt25tbPollerGetUID( rfalSt25tbUID *UID,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 301 {
DiegoOstuni 0:75fc82583a41 302 ReturnCode ret;
DiegoOstuni 0:75fc82583a41 303 uint16_t rxLen;
DiegoOstuni 0:75fc82583a41 304 uint8_t getUidReq;
DiegoOstuni 0:75fc82583a41 305
DiegoOstuni 0:75fc82583a41 306
DiegoOstuni 0:75fc82583a41 307 /* Compute Get UID Request */
DiegoOstuni 0:75fc82583a41 308 getUidReq = RFAL_ST25TB_GET_UID_CMD;
DiegoOstuni 0:75fc82583a41 309
DiegoOstuni 0:75fc82583a41 310 /* Send Select Request */
DiegoOstuni 0:75fc82583a41 311 ret = rfalTransceiveBlockingTxRx( (uint8_t*)&getUidReq, RFAL_ST25TB_CMD_LEN, (uint8_t*)UID, sizeof(rfalSt25tbUID), &rxLen, RFAL_TXRX_FLAGS_DEFAULT, RFAL_ST25TB_FWT, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:75fc82583a41 312
DiegoOstuni 0:75fc82583a41 313 /* Check for valid UID Response */
DiegoOstuni 0:75fc82583a41 314 if( (ret == ERR_NONE) && (rxLen != RFAL_ST25TB_UID_LEN) )
DiegoOstuni 0:75fc82583a41 315 {
DiegoOstuni 0:75fc82583a41 316 return ERR_PROTO;
DiegoOstuni 0:75fc82583a41 317 }
DiegoOstuni 0:75fc82583a41 318
DiegoOstuni 0:75fc82583a41 319 return ret;
DiegoOstuni 0:75fc82583a41 320 }
DiegoOstuni 0:75fc82583a41 321
DiegoOstuni 0:75fc82583a41 322
DiegoOstuni 0:75fc82583a41 323 /*******************************************************************************/
DiegoOstuni 0:75fc82583a41 324 ReturnCode rfalSt25tbPollerCollisionResolution( uint8_t devLimit, rfalSt25tbListenDevice *st25tbDevList, 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 325 {
DiegoOstuni 0:75fc82583a41 326 uint8_t i;
DiegoOstuni 0:75fc82583a41 327 uint8_t chipId;
DiegoOstuni 0:75fc82583a41 328 ReturnCode ret;
DiegoOstuni 0:75fc82583a41 329 bool detected; /* collision or device was detected */
DiegoOstuni 0:75fc82583a41 330
DiegoOstuni 0:75fc82583a41 331 if( (st25tbDevList == NULL) || (devCnt == NULL) || (devLimit == 0) )
DiegoOstuni 0:75fc82583a41 332 {
DiegoOstuni 0:75fc82583a41 333 return ERR_PARAM;
DiegoOstuni 0:75fc82583a41 334 }
DiegoOstuni 0:75fc82583a41 335
DiegoOstuni 0:75fc82583a41 336 *devCnt = 0;
DiegoOstuni 0:75fc82583a41 337
DiegoOstuni 0:75fc82583a41 338 /* Step 1: Send Initiate */
DiegoOstuni 0:75fc82583a41 339 ret = rfalSt25tbPollerInitiate( &chipId, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:75fc82583a41 340 if( ret == ERR_NONE )
DiegoOstuni 0:75fc82583a41 341 {
DiegoOstuni 0:75fc82583a41 342 /* If only 1 answer is detected */
DiegoOstuni 0:75fc82583a41 343 st25tbDevList[*devCnt].chipID = chipId;
DiegoOstuni 0:75fc82583a41 344 st25tbDevList[*devCnt].isDeselected = false;
DiegoOstuni 0:75fc82583a41 345
DiegoOstuni 0:75fc82583a41 346 /* Retrieve its UID and keep it Selected*/
DiegoOstuni 0:75fc82583a41 347 ret = rfalSt25tbPollerSelect( chipId, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:75fc82583a41 348
DiegoOstuni 0:75fc82583a41 349 if( ERR_NONE == ret )
DiegoOstuni 0:75fc82583a41 350 {
DiegoOstuni 0:75fc82583a41 351 ret = rfalSt25tbPollerGetUID( &st25tbDevList[*devCnt].UID, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:75fc82583a41 352 }
DiegoOstuni 0:75fc82583a41 353
DiegoOstuni 0:75fc82583a41 354 if( ERR_NONE == ret )
DiegoOstuni 0:75fc82583a41 355 {
DiegoOstuni 0:75fc82583a41 356 (*devCnt)++;
DiegoOstuni 0:75fc82583a41 357 }
DiegoOstuni 0:75fc82583a41 358 }
DiegoOstuni 0:75fc82583a41 359 /* Always proceed to Pcall16 anticollision as phase differences of tags can lead to no tag recognized, even if there is one */
DiegoOstuni 0:75fc82583a41 360 if( *devCnt < devLimit )
DiegoOstuni 0:75fc82583a41 361 {
DiegoOstuni 0:75fc82583a41 362 /* Multiple device responses */
DiegoOstuni 0:75fc82583a41 363 do
DiegoOstuni 0:75fc82583a41 364 {
DiegoOstuni 0:75fc82583a41 365 detected = false;
DiegoOstuni 0:75fc82583a41 366
DiegoOstuni 0:75fc82583a41 367 for(i = 0; i < RFAL_ST25TB_SLOTS; i++)
DiegoOstuni 0:75fc82583a41 368 {
DiegoOstuni 0:75fc82583a41 369 platformDelay(1); /* Wait t2: Answer to new request delay */
DiegoOstuni 0:75fc82583a41 370
DiegoOstuni 0:75fc82583a41 371 if( i==0 )
DiegoOstuni 0:75fc82583a41 372 {
DiegoOstuni 0:75fc82583a41 373 /* Step 2: Send Pcall16 */
DiegoOstuni 0:75fc82583a41 374 ret = rfalSt25tbPollerPcall( &chipId, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:75fc82583a41 375 }
DiegoOstuni 0:75fc82583a41 376 else
DiegoOstuni 0:75fc82583a41 377 {
DiegoOstuni 0:75fc82583a41 378 /* Step 3-17: Send Pcall16 */
DiegoOstuni 0:75fc82583a41 379 ret = rfalSt25tbPollerSlotMarker( i, &chipId, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:75fc82583a41 380 }
DiegoOstuni 0:75fc82583a41 381
DiegoOstuni 0:75fc82583a41 382 if( ret == ERR_NONE )
DiegoOstuni 0:75fc82583a41 383 {
DiegoOstuni 0:75fc82583a41 384 /* Found another device */
DiegoOstuni 0:75fc82583a41 385 st25tbDevList[*devCnt].chipID = chipId;
DiegoOstuni 0:75fc82583a41 386 st25tbDevList[*devCnt].isDeselected = false;
DiegoOstuni 0:75fc82583a41 387
DiegoOstuni 0:75fc82583a41 388 /* Select Device, retrieve its UID */
DiegoOstuni 0:75fc82583a41 389 ret = rfalSt25tbPollerSelect( chipId, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:75fc82583a41 390
DiegoOstuni 0:75fc82583a41 391 /* By Selecting this device, the previous gets Deselected */
DiegoOstuni 0:75fc82583a41 392 if( (*devCnt) > 0 )
DiegoOstuni 0:75fc82583a41 393 {
DiegoOstuni 0:75fc82583a41 394 st25tbDevList[(*devCnt)-1].isDeselected = true;
DiegoOstuni 0:75fc82583a41 395 }
DiegoOstuni 0:75fc82583a41 396
DiegoOstuni 0:75fc82583a41 397 if( ERR_NONE == ret )
DiegoOstuni 0:75fc82583a41 398 {
DiegoOstuni 0:75fc82583a41 399 rfalSt25tbPollerGetUID( &st25tbDevList[*devCnt].UID, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:75fc82583a41 400 }
DiegoOstuni 0:75fc82583a41 401
DiegoOstuni 0:75fc82583a41 402 if( ERR_NONE == ret )
DiegoOstuni 0:75fc82583a41 403 {
DiegoOstuni 0:75fc82583a41 404 (*devCnt)++;
DiegoOstuni 0:75fc82583a41 405 }
DiegoOstuni 0:75fc82583a41 406 }
DiegoOstuni 0:75fc82583a41 407 else if( (ret == ERR_CRC) || (ret == ERR_FRAMING) )
DiegoOstuni 0:75fc82583a41 408 {
DiegoOstuni 0:75fc82583a41 409 detected = true;
DiegoOstuni 0:75fc82583a41 410 }
DiegoOstuni 0:75fc82583a41 411
DiegoOstuni 0:75fc82583a41 412 if( *devCnt >= devLimit )
DiegoOstuni 0:75fc82583a41 413 {
DiegoOstuni 0:75fc82583a41 414 break;
DiegoOstuni 0:75fc82583a41 415 }
DiegoOstuni 0:75fc82583a41 416 }
DiegoOstuni 0:75fc82583a41 417 }
DiegoOstuni 0:75fc82583a41 418 while( (detected == true) && (*devCnt < devLimit) );
DiegoOstuni 0:75fc82583a41 419 }
DiegoOstuni 0:75fc82583a41 420
DiegoOstuni 0:75fc82583a41 421 return ERR_NONE;
DiegoOstuni 0:75fc82583a41 422 }
DiegoOstuni 0:75fc82583a41 423
DiegoOstuni 0:75fc82583a41 424
DiegoOstuni 0:75fc82583a41 425 /*******************************************************************************/
DiegoOstuni 0:75fc82583a41 426 ReturnCode rfalSt25tbPollerReadBlock( uint8_t blockAddress, rfalSt25tbBlock *blockData,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 427 {
DiegoOstuni 0:75fc82583a41 428 ReturnCode ret;
DiegoOstuni 0:75fc82583a41 429 uint16_t rxLen;
DiegoOstuni 0:75fc82583a41 430 rfalSt25tbReadBlockReq readBlockReq;
DiegoOstuni 0:75fc82583a41 431
DiegoOstuni 0:75fc82583a41 432
DiegoOstuni 0:75fc82583a41 433 /* Compute Read Block Request */
DiegoOstuni 0:75fc82583a41 434 readBlockReq.cmd = RFAL_ST25TB_READ_BLOCK_CMD;
DiegoOstuni 0:75fc82583a41 435 readBlockReq.address = blockAddress;
DiegoOstuni 0:75fc82583a41 436
DiegoOstuni 0:75fc82583a41 437 /* Send Read Block Request */
DiegoOstuni 0:75fc82583a41 438 ret = rfalTransceiveBlockingTxRx( (uint8_t*)&readBlockReq, sizeof(rfalSt25tbReadBlockReq), (uint8_t*)blockData, sizeof(rfalSt25tbBlock), &rxLen, RFAL_TXRX_FLAGS_DEFAULT, RFAL_ST25TB_FWT, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:75fc82583a41 439
DiegoOstuni 0:75fc82583a41 440 /* Check for valid UID Response */
DiegoOstuni 0:75fc82583a41 441 if( (ret == ERR_NONE) && (rxLen != RFAL_ST25TB_BLOCK_LEN) )
DiegoOstuni 0:75fc82583a41 442 {
DiegoOstuni 0:75fc82583a41 443 return ERR_PROTO;
DiegoOstuni 0:75fc82583a41 444 }
DiegoOstuni 0:75fc82583a41 445
DiegoOstuni 0:75fc82583a41 446 return ret;
DiegoOstuni 0:75fc82583a41 447 }
DiegoOstuni 0:75fc82583a41 448
DiegoOstuni 0:75fc82583a41 449
DiegoOstuni 0:75fc82583a41 450 /*******************************************************************************/
DiegoOstuni 0:75fc82583a41 451 ReturnCode rfalSt25tbPollerWriteBlock( uint8_t blockAddress, rfalSt25tbBlock *blockData,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 452 {
DiegoOstuni 0:75fc82583a41 453 ReturnCode ret;
DiegoOstuni 0:75fc82583a41 454 uint16_t rxLen;
DiegoOstuni 0:75fc82583a41 455 rfalSt25tbWriteBlockReq writeBlockReq;
DiegoOstuni 0:75fc82583a41 456 rfalSt25tbBlock tmpBlockData;
DiegoOstuni 0:75fc82583a41 457
DiegoOstuni 0:75fc82583a41 458
DiegoOstuni 0:75fc82583a41 459 /* Compute Write Block Request */
DiegoOstuni 0:75fc82583a41 460 writeBlockReq.cmd = RFAL_ST25TB_WRITE_BLOCK_CMD;
DiegoOstuni 0:75fc82583a41 461 writeBlockReq.address = blockAddress;
DiegoOstuni 0:75fc82583a41 462 ST_MEMCPY( writeBlockReq.data, blockData, RFAL_ST25TB_BLOCK_LEN );
DiegoOstuni 0:75fc82583a41 463
DiegoOstuni 0:75fc82583a41 464 /* Send Write Block Request */
DiegoOstuni 0:75fc82583a41 465 ret = rfalTransceiveBlockingTxRx( (uint8_t*)&writeBlockReq, sizeof(rfalSt25tbWriteBlockReq), tmpBlockData, RFAL_ST25TB_BLOCK_LEN, &rxLen, RFAL_TXRX_FLAGS_DEFAULT, (RFAL_ST25TB_FWT + RFAL_ST25TB_TW), mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:75fc82583a41 466
DiegoOstuni 0:75fc82583a41 467 /* Check if an unexpected answer was received */
DiegoOstuni 0:75fc82583a41 468 if( ret == ERR_NONE )
DiegoOstuni 0:75fc82583a41 469 {
DiegoOstuni 0:75fc82583a41 470 return ERR_PROTO;
DiegoOstuni 0:75fc82583a41 471 }
DiegoOstuni 0:75fc82583a41 472 /* Check there was any error besides Timeout*/
DiegoOstuni 0:75fc82583a41 473 else if( ret != ERR_TIMEOUT )
DiegoOstuni 0:75fc82583a41 474 {
DiegoOstuni 0:75fc82583a41 475 return ret;
DiegoOstuni 0:75fc82583a41 476 }
DiegoOstuni 0:75fc82583a41 477
DiegoOstuni 0:75fc82583a41 478 ret = rfalSt25tbPollerReadBlock(blockAddress, &tmpBlockData, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:75fc82583a41 479 if( ret == ERR_NONE )
DiegoOstuni 0:75fc82583a41 480 {
DiegoOstuni 0:75fc82583a41 481 if( !ST_BYTECMP( tmpBlockData, blockData, RFAL_ST25TB_BLOCK_LEN ) )
DiegoOstuni 0:75fc82583a41 482 {
DiegoOstuni 0:75fc82583a41 483 return ERR_NONE;
DiegoOstuni 0:75fc82583a41 484 }
DiegoOstuni 0:75fc82583a41 485 return ERR_PROTO;
DiegoOstuni 0:75fc82583a41 486 }
DiegoOstuni 0:75fc82583a41 487 return ret;
DiegoOstuni 0:75fc82583a41 488 }
DiegoOstuni 0:75fc82583a41 489
DiegoOstuni 0:75fc82583a41 490
DiegoOstuni 0:75fc82583a41 491 /*******************************************************************************/
DiegoOstuni 0:75fc82583a41 492 ReturnCode rfalSt25tbPollerCompletion( 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 493 {
DiegoOstuni 0:75fc82583a41 494 uint8_t completionReq;
DiegoOstuni 0:75fc82583a41 495
DiegoOstuni 0:75fc82583a41 496 /* Compute Completion Request */
DiegoOstuni 0:75fc82583a41 497 completionReq = RFAL_ST25TB_COMPLETION_CMD;
DiegoOstuni 0:75fc82583a41 498
DiegoOstuni 0:75fc82583a41 499 /* Send Completion Request, no response is expected */
DiegoOstuni 0:75fc82583a41 500 return rfalTransceiveBlockingTxRx( (uint8_t*)&completionReq, RFAL_ST25TB_CMD_LEN, NULL, 0, NULL, RFAL_TXRX_FLAGS_DEFAULT, RFAL_ST25TB_FWT, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:75fc82583a41 501 }
DiegoOstuni 0:75fc82583a41 502
DiegoOstuni 0:75fc82583a41 503
DiegoOstuni 0:75fc82583a41 504 /*******************************************************************************/
DiegoOstuni 0:75fc82583a41 505 ReturnCode rfalSt25tbPollerResetToInventory( 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 506 {
DiegoOstuni 0:75fc82583a41 507 uint8_t resetInvReq;
DiegoOstuni 0:75fc82583a41 508
DiegoOstuni 0:75fc82583a41 509 /* Compute Completion Request */
DiegoOstuni 0:75fc82583a41 510 resetInvReq = RFAL_ST25TB_RESET_INV_CMD;
DiegoOstuni 0:75fc82583a41 511
DiegoOstuni 0:75fc82583a41 512 /* Send Completion Request, no response is expected */
DiegoOstuni 0:75fc82583a41 513 return rfalTransceiveBlockingTxRx( (uint8_t*)&resetInvReq, RFAL_ST25TB_CMD_LEN, NULL, 0, NULL, RFAL_TXRX_FLAGS_DEFAULT, RFAL_ST25TB_FWT, mspiChannel, mST25, gpio_cs, IRQ, fieldLED_01, fieldLED_02, fieldLED_03, fieldLED_04, fieldLED_05, fieldLED_06 ) ;
DiegoOstuni 0:75fc82583a41 514 }
DiegoOstuni 0:75fc82583a41 515
DiegoOstuni 0:75fc82583a41 516 #endif /* RFAL_FEATURE_ST25TB */