Firmware library for the X-NUCLEO-NFC01A1 Dynamic NFC Tag board.

Dependencies:   M24SR

Dependents:   NFC M2M_2016_STM32 MyongjiElec_capstone1 IDW01M1_Cloud_IBM ... more

Fork of X_NUCLEO_NFC01A1 by ST Expansion SW Team

X-NUCLEO-NFC01A1 Dynamic NFC Tag Expansion Board Firmware Package

Introduction

This firmware package includes Components Device Drivers, Board Support Package and example applications for STMicroelectronics X-NUCLEO-NFC01A1 Dynamic NFC Tag Expansion Board based on M24SR.

Firmware Library

Class X_NUCLEO_NFC01A1 is intended to represent the Dynamic NFC Tag Expansion Board with the same name.
It provides an API to access to the M24SR component and to the three onboard LEDs.
It is intentionally implemented as a singleton because only one X_NUCLEO_NFC01A1 at a time might be deployed in a HW component stack.
The library also provides an implementation of the NDEF library API for M24SR, providing an simple way to read/write NDEF formatted messages from/to the M24SR dynamic NFC tag.

Example applications

1. Hello World
2. Asynchronous Hello World

Committer:
giovannivisentini
Date:
Thu Jan 28 14:01:18 2016 +0000
Revision:
19:0b65a5813059
Parent:
12:d1f5eaa85deb
Child:
21:ccc4f3fed4b3
add async api

Who changed what in which revision?

UserRevisionLine numberNew contents of line
giovannivisentini 0:969a2be49f41 1 /**
giovannivisentini 0:969a2be49f41 2 ******************************************************************************
giovannivisentini 0:969a2be49f41 3 * @file Nfc_class.h
giovannivisentini 6:96389fb79676 4 * @author ST Central Labs
giovannivisentini 9:9f2e2e68d695 5 * @version V1.0.0
giovannivisentini 0:969a2be49f41 6 * @date 13-April-2015
giovannivisentini 0:969a2be49f41 7 * @brief This file contains the abstract class describing the interface of a
giovannivisentini 0:969a2be49f41 8 * nfc component.
giovannivisentini 0:969a2be49f41 9 ******************************************************************************
giovannivisentini 0:969a2be49f41 10 * @attention
giovannivisentini 0:969a2be49f41 11 *
giovannivisentini 0:969a2be49f41 12 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
giovannivisentini 0:969a2be49f41 13 *
giovannivisentini 0:969a2be49f41 14 * Redistribution and use in source and binary forms, with or without modification,
giovannivisentini 0:969a2be49f41 15 * are permitted provided that the following conditions are met:
giovannivisentini 0:969a2be49f41 16 * 1. Redistributions of source code must retain the above copyright notice,
giovannivisentini 0:969a2be49f41 17 * this list of conditions and the following disclaimer.
giovannivisentini 0:969a2be49f41 18 * 2. Redistributions in binary form must reproduce the above copyright notice,
giovannivisentini 0:969a2be49f41 19 * this list of conditions and the following disclaimer in the documentation
giovannivisentini 0:969a2be49f41 20 * and/or other materials provided with the distribution.
giovannivisentini 0:969a2be49f41 21 * 3. Neither the name of STMicroelectronics nor the names of its contributors
giovannivisentini 0:969a2be49f41 22 * may be used to endorse or promote products derived from this software
giovannivisentini 0:969a2be49f41 23 * without specific prior written permission.
giovannivisentini 0:969a2be49f41 24 *
giovannivisentini 0:969a2be49f41 25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
giovannivisentini 0:969a2be49f41 26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
giovannivisentini 0:969a2be49f41 27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
giovannivisentini 0:969a2be49f41 28 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
giovannivisentini 0:969a2be49f41 29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
giovannivisentini 0:969a2be49f41 30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
giovannivisentini 0:969a2be49f41 31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
giovannivisentini 0:969a2be49f41 32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
giovannivisentini 0:969a2be49f41 33 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
giovannivisentini 0:969a2be49f41 34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
giovannivisentini 0:969a2be49f41 35 *
giovannivisentini 0:969a2be49f41 36 ******************************************************************************
giovannivisentini 0:969a2be49f41 37 */
giovannivisentini 0:969a2be49f41 38
giovannivisentini 0:969a2be49f41 39
giovannivisentini 0:969a2be49f41 40 /* Generated with Stm32CubeTOO -----------------------------------------------*/
giovannivisentini 0:969a2be49f41 41
giovannivisentini 0:969a2be49f41 42 /* Define to prevent from recursive inclusion --------------------------------*/
giovannivisentini 0:969a2be49f41 43
giovannivisentini 0:969a2be49f41 44 #ifndef __NFC_CLASS_H
giovannivisentini 0:969a2be49f41 45 #define __NFC_CLASS_H
giovannivisentini 0:969a2be49f41 46
giovannivisentini 0:969a2be49f41 47
giovannivisentini 0:969a2be49f41 48 /* Includes ------------------------------------------------------------------*/
giovannivisentini 0:969a2be49f41 49
giovannivisentini 0:969a2be49f41 50 #include "Component_class.h"
giovannivisentini 19:0b65a5813059 51 #include "../Common/nfc.h"
giovannivisentini 0:969a2be49f41 52
giovannivisentini 0:969a2be49f41 53 /* Classes ------------------------------------------------------------------*/
giovannivisentini 0:969a2be49f41 54
giovannivisentini 9:9f2e2e68d695 55 /**
giovannivisentini 9:9f2e2e68d695 56 * An abstract class for Nfc components.
giovannivisentini 19:0b65a5813059 57 * This component has two operation mode, sync or async.
giovannivisentini 19:0b65a5813059 58 * In the sync mode each function will return only when the command is complete.
giovannivisentini 19:0b65a5813059 59 * In the async mode the function will only send the command and the answer will be notify
giovannivisentini 19:0b65a5813059 60 * thought a callback.
giovannivisentini 19:0b65a5813059 61 * The default behavior is sync mode.
giovannivisentini 19:0b65a5813059 62 * For enable the async mode you have to call the ManageI2CGPO(I2C_ANSWER_READY) function.
giovannivisentini 19:0b65a5813059 63 * Then when an interrupt happen you have to call the {@link ManageInterrupt} function.
giovannivisentini 19:0b65a5813059 64 * Note that when you call ManageI2CGPO with other parameters the component will return in sync mode.
giovannivisentini 0:969a2be49f41 65 */
giovannivisentini 0:969a2be49f41 66 class Nfc : public Component
giovannivisentini 0:969a2be49f41 67 {
giovannivisentini 0:969a2be49f41 68 public:
giovannivisentini 0:969a2be49f41 69
giovannivisentini 0:969a2be49f41 70 /**
giovannivisentini 9:9f2e2e68d695 71 * Possible password to set.
giovannivisentini 0:969a2be49f41 72 */
giovannivisentini 0:969a2be49f41 73 typedef enum{
giovannivisentini 12:d1f5eaa85deb 74 ReadPwd, //!< Password to use before read the tag
giovannivisentini 12:d1f5eaa85deb 75 WritePwd, //!< Password to use before write the tag
giovannivisentini 12:d1f5eaa85deb 76 I2CPwd, //!< Root password, used only thought nfc
giovannivisentini 0:969a2be49f41 77 }PasswordType_t;
giovannivisentini 0:969a2be49f41 78
giovannivisentini 19:0b65a5813059 79 typedef void(*gpoEventCallback)(void);
giovannivisentini 19:0b65a5813059 80
giovannivisentini 19:0b65a5813059 81 /**
giovannivisentini 19:0b65a5813059 82 * Object that contains all the callback fired by this class, each command has its own callback.
giovannivisentini 19:0b65a5813059 83 * The callback default implementation is an empty function.
giovannivisentini 19:0b65a5813059 84 */
giovannivisentini 19:0b65a5813059 85 class Callback{
giovannivisentini 19:0b65a5813059 86 public:
giovannivisentini 19:0b65a5813059 87
giovannivisentini 19:0b65a5813059 88 /** call when GetSession or KillSession finish */
giovannivisentini 19:0b65a5813059 89 virtual void onSessionOpen(Nfc *nfc,NFC_StatusTypeDef status){
giovannivisentini 19:0b65a5813059 90 (void)nfc; (void)status;
giovannivisentini 19:0b65a5813059 91 }
giovannivisentini 19:0b65a5813059 92
giovannivisentini 19:0b65a5813059 93 virtual void onDeselect(Nfc *nfc,NFC_StatusTypeDef status){
giovannivisentini 19:0b65a5813059 94 (void)nfc; (void)status;
giovannivisentini 19:0b65a5813059 95 }
giovannivisentini 19:0b65a5813059 96
giovannivisentini 19:0b65a5813059 97 virtual void onSelectedApplication(Nfc *nfc,NFC_StatusTypeDef status){
giovannivisentini 19:0b65a5813059 98 (void)nfc; (void)status;
giovannivisentini 19:0b65a5813059 99 }
giovannivisentini 19:0b65a5813059 100
giovannivisentini 19:0b65a5813059 101 virtual void onSelectedCCFile(Nfc *nfc,NFC_StatusTypeDef status){
giovannivisentini 19:0b65a5813059 102 (void)nfc; (void)status;
giovannivisentini 19:0b65a5813059 103 }
giovannivisentini 19:0b65a5813059 104
giovannivisentini 19:0b65a5813059 105 virtual void onSelectedNDEFFile(Nfc *nfc,NFC_StatusTypeDef status){
giovannivisentini 19:0b65a5813059 106 (void)nfc; (void)status;
giovannivisentini 19:0b65a5813059 107 }
giovannivisentini 19:0b65a5813059 108
giovannivisentini 19:0b65a5813059 109 virtual void onSelectedSystemFile(Nfc *nfc,NFC_StatusTypeDef status){
giovannivisentini 19:0b65a5813059 110 (void)nfc; (void)status;
giovannivisentini 19:0b65a5813059 111 }
giovannivisentini 19:0b65a5813059 112
giovannivisentini 19:0b65a5813059 113 virtual void onReadByte(Nfc *nfc,NFC_StatusTypeDef status,
giovannivisentini 19:0b65a5813059 114 uint16_t offset,uint8_t *readByte, uint16_t nReadByte){
giovannivisentini 19:0b65a5813059 115 (void)nfc; (void)status;(void)offset; (void)readByte; (void)nReadByte;
giovannivisentini 19:0b65a5813059 116 }
giovannivisentini 19:0b65a5813059 117
giovannivisentini 19:0b65a5813059 118 virtual void onUpdatedBinary(Nfc *nfc,NFC_StatusTypeDef status,uint16_t offset,
giovannivisentini 19:0b65a5813059 119 uint8_t *writeByte,uint16_t nWriteByte){
giovannivisentini 19:0b65a5813059 120 (void)nfc; (void)status; (void)writeByte; (void)nWriteByte; (void)offset;
giovannivisentini 19:0b65a5813059 121 }
giovannivisentini 19:0b65a5813059 122
giovannivisentini 19:0b65a5813059 123 virtual void onVerifyed(Nfc *nfc,NFC_StatusTypeDef status){
giovannivisentini 19:0b65a5813059 124 (void)nfc; (void)status;
giovannivisentini 19:0b65a5813059 125 }
giovannivisentini 19:0b65a5813059 126
giovannivisentini 19:0b65a5813059 127 virtual void onManageI2CGPO(Nfc *nfc,NFC_StatusTypeDef status,NFC_GPO_MGMT newStatus){
giovannivisentini 19:0b65a5813059 128 (void)nfc; (void)status;(void)newStatus;
giovannivisentini 19:0b65a5813059 129 }
giovannivisentini 19:0b65a5813059 130
giovannivisentini 19:0b65a5813059 131 virtual void onManageRFGPO(Nfc *nfc,NFC_StatusTypeDef status,NFC_GPO_MGMT newStatus){
giovannivisentini 19:0b65a5813059 132 (void)nfc; (void)status;(void)newStatus;
giovannivisentini 19:0b65a5813059 133 }
giovannivisentini 19:0b65a5813059 134
giovannivisentini 19:0b65a5813059 135 virtual void onChangeReferenceData(Nfc *nfc ,NFC_StatusTypeDef status,PasswordType_t type,
giovannivisentini 19:0b65a5813059 136 uint8_t *data){
giovannivisentini 19:0b65a5813059 137 (void)nfc; (void)status;(void)type;(void)data;
giovannivisentini 19:0b65a5813059 138 }
giovannivisentini 19:0b65a5813059 139
giovannivisentini 19:0b65a5813059 140 virtual void onEnableVerificationRequirement(Nfc *nfc ,NFC_StatusTypeDef status,PasswordType_t type){
giovannivisentini 19:0b65a5813059 141 (void)nfc; (void)status;(void)type;
giovannivisentini 19:0b65a5813059 142 }
giovannivisentini 19:0b65a5813059 143
giovannivisentini 19:0b65a5813059 144 virtual void onDisableVerificationRequirement(Nfc *nfc , NFC_StatusTypeDef status,PasswordType_t type){
giovannivisentini 19:0b65a5813059 145 (void)nfc; (void)status;(void)type;
giovannivisentini 19:0b65a5813059 146 }
giovannivisentini 19:0b65a5813059 147
giovannivisentini 19:0b65a5813059 148 virtual void onEnablePermanentState(Nfc *nfc, NFC_StatusTypeDef status, PasswordType_t type){
giovannivisentini 19:0b65a5813059 149 (void)nfc; (void)status;(void)type;
giovannivisentini 19:0b65a5813059 150 }
giovannivisentini 19:0b65a5813059 151
giovannivisentini 19:0b65a5813059 152 virtual void onDisablePermanentState(Nfc *nfc, NFC_StatusTypeDef status, PasswordType_t type){
giovannivisentini 19:0b65a5813059 153 (void)nfc; (void)status;(void)type;
giovannivisentini 19:0b65a5813059 154 }
giovannivisentini 19:0b65a5813059 155
giovannivisentini 19:0b65a5813059 156 virtual void onReadId(Nfc *nfc, NFC_StatusTypeDef status, uint8_t *id){
giovannivisentini 19:0b65a5813059 157 (void)nfc; (void)status;(void)id;
giovannivisentini 19:0b65a5813059 158 }
giovannivisentini 19:0b65a5813059 159
giovannivisentini 19:0b65a5813059 160 virtual void onEnableReadPassword(Nfc *nfc, NFC_StatusTypeDef status,const uint8_t *newPwd){
giovannivisentini 19:0b65a5813059 161 (void)nfc; (void)status;(void)newPwd;
giovannivisentini 19:0b65a5813059 162 }
giovannivisentini 19:0b65a5813059 163
giovannivisentini 19:0b65a5813059 164 virtual void onEnableWritePassword(Nfc *nfc, NFC_StatusTypeDef status,const uint8_t *newPwd){
giovannivisentini 19:0b65a5813059 165 (void)nfc; (void)status;(void)newPwd;
giovannivisentini 19:0b65a5813059 166 }
giovannivisentini 19:0b65a5813059 167
giovannivisentini 19:0b65a5813059 168 virtual void onDisableReadPassword(Nfc *nfc, NFC_StatusTypeDef status){
giovannivisentini 19:0b65a5813059 169 (void)nfc; (void)status;
giovannivisentini 19:0b65a5813059 170 }
giovannivisentini 19:0b65a5813059 171
giovannivisentini 19:0b65a5813059 172 virtual void onDisableWritePassword(Nfc *nfc, NFC_StatusTypeDef status){
giovannivisentini 19:0b65a5813059 173 (void)nfc; (void)status;
giovannivisentini 19:0b65a5813059 174 }
giovannivisentini 19:0b65a5813059 175
giovannivisentini 19:0b65a5813059 176 virtual void onDisableAllPassword(Nfc *nfc, NFC_StatusTypeDef status){
giovannivisentini 19:0b65a5813059 177 (void)nfc; (void)status;
giovannivisentini 19:0b65a5813059 178 }
giovannivisentini 19:0b65a5813059 179
giovannivisentini 19:0b65a5813059 180 virtual void onEnableReadOnly(Nfc *nfc,NFC_StatusTypeDef status){
giovannivisentini 19:0b65a5813059 181 (void)nfc; (void)status;
giovannivisentini 19:0b65a5813059 182 }
giovannivisentini 19:0b65a5813059 183
giovannivisentini 19:0b65a5813059 184 virtual void onEnableWriteOnly(Nfc *nfc,NFC_StatusTypeDef status){
giovannivisentini 19:0b65a5813059 185 (void)nfc; (void)status;
giovannivisentini 19:0b65a5813059 186 }
giovannivisentini 19:0b65a5813059 187
giovannivisentini 19:0b65a5813059 188 virtual void onDisableReadOnly(Nfc *nfc,NFC_StatusTypeDef status){
giovannivisentini 19:0b65a5813059 189 (void)nfc; (void)status;
giovannivisentini 19:0b65a5813059 190 }
giovannivisentini 19:0b65a5813059 191
giovannivisentini 19:0b65a5813059 192 virtual void onDisableWriteOnly(Nfc *nfc,NFC_StatusTypeDef status){
giovannivisentini 19:0b65a5813059 193 (void)nfc; (void)status;
giovannivisentini 19:0b65a5813059 194 }
giovannivisentini 19:0b65a5813059 195
giovannivisentini 19:0b65a5813059 196 virtual ~Callback(){};
giovannivisentini 19:0b65a5813059 197 };
giovannivisentini 19:0b65a5813059 198
giovannivisentini 19:0b65a5813059 199 Nfc():mCallback(&defaultCallback){ }
giovannivisentini 0:969a2be49f41 200
giovannivisentini 0:969a2be49f41 201 /**
giovannivisentini 9:9f2e2e68d695 202 * Open a I2C connection with the tag if an RF connection isn't already open.
giovannivisentini 0:969a2be49f41 203 * @return operation status
giovannivisentini 0:969a2be49f41 204 */
giovannivisentini 0:969a2be49f41 205 virtual NFC_StatusTypeDef GetSession(void) = 0;
giovannivisentini 9:9f2e2e68d695 206
giovannivisentini 0:969a2be49f41 207 /**
giovannivisentini 9:9f2e2e68d695 208 * Force to open an I2C connection , abort the RF connection.
giovannivisentini 7:19fc04b8fec6 209 * @return NFC_SUCCESS if the session is acquired
giovannivisentini 0:969a2be49f41 210 */
giovannivisentini 0:969a2be49f41 211 virtual NFC_StatusTypeDef KillSession(void) = 0;
giovannivisentini 0:969a2be49f41 212
giovannivisentini 0:969a2be49f41 213 /**
giovannivisentini 9:9f2e2e68d695 214 * Close an I2C connection.
giovannivisentini 7:19fc04b8fec6 215 * @return NFC_SUCCESS if the session is release
giovannivisentini 0:969a2be49f41 216 */
giovannivisentini 0:969a2be49f41 217 virtual NFC_StatusTypeDef Deselect(void) = 0;
giovannivisentini 0:969a2be49f41 218
giovannivisentini 0:969a2be49f41 219 /**
giovannivisentini 9:9f2e2e68d695 220 * Select the application file.
giovannivisentini 7:19fc04b8fec6 221 * @return NFC_SUCCESS if the application is selected
giovannivisentini 0:969a2be49f41 222 */
giovannivisentini 0:969a2be49f41 223 virtual NFC_StatusTypeDef SelectApplication(void) = 0;
giovannivisentini 0:969a2be49f41 224
giovannivisentini 0:969a2be49f41 225 /**
giovannivisentini 9:9f2e2e68d695 226 * Select the CC file.
giovannivisentini 9:9f2e2e68d695 227 * @return NFC_SUCCESS if the CC file is selected.
giovannivisentini 0:969a2be49f41 228 */
giovannivisentini 0:969a2be49f41 229 virtual NFC_StatusTypeDef SelectCCfile(void) = 0;
giovannivisentini 0:969a2be49f41 230
giovannivisentini 0:969a2be49f41 231 /**
giovannivisentini 9:9f2e2e68d695 232 * Select the ndef file.
giovannivisentini 9:9f2e2e68d695 233 * @param NDEFfileId File id to open.
giovannivisentini 7:19fc04b8fec6 234 * @return NFC_SUCCESS if the file is selected
giovannivisentini 0:969a2be49f41 235 */
giovannivisentini 0:969a2be49f41 236 virtual NFC_StatusTypeDef SelectNDEFfile(uint16_t NDEFfileId) = 0;
giovannivisentini 0:969a2be49f41 237
giovannivisentini 0:969a2be49f41 238 /**
giovannivisentini 9:9f2e2e68d695 239 * Select the system file.
giovannivisentini 7:19fc04b8fec6 240 * @return NFC_SUCCESS if the system file is selected
giovannivisentini 0:969a2be49f41 241 */
giovannivisentini 0:969a2be49f41 242 virtual NFC_StatusTypeDef SelectSystemfile(void) = 0;
giovannivisentini 0:969a2be49f41 243
giovannivisentini 0:969a2be49f41 244 /**
giovannivisentini 9:9f2e2e68d695 245 * Read data from the tag.
giovannivisentini 9:9f2e2e68d695 246 * @param Offset Read offset.
giovannivisentini 9:9f2e2e68d695 247 * @param NbByteToRead Number of bytes to read.
giovannivisentini 9:9f2e2e68d695 248 * @param[out] pBufferRead Buffer to store the read data into.
giovannivisentini 9:9f2e2e68d695 249 * @return NFC_SUCCESS if no errors
giovannivisentini 0:969a2be49f41 250 */
giovannivisentini 0:969a2be49f41 251 virtual NFC_StatusTypeDef ReadBinary(uint16_t Offset, uint8_t NbByteToRead, uint8_t *pBufferRead) = 0;
giovannivisentini 0:969a2be49f41 252
giovannivisentini 0:969a2be49f41 253 /**
giovannivisentini 9:9f2e2e68d695 254 * Write data to the tag.
giovannivisentini 9:9f2e2e68d695 255 * @param Offset Write offset.
giovannivisentini 9:9f2e2e68d695 256 * @param NbByteToWrite Number of bytes to write.
giovannivisentini 9:9f2e2e68d695 257 * @param pDataToWrite Buffer to write.
giovannivisentini 9:9f2e2e68d695 258 * @return NFC_SUCCESS if no errors
giovannivisentini 0:969a2be49f41 259 */
giovannivisentini 0:969a2be49f41 260 virtual NFC_StatusTypeDef UpdateBinary(uint16_t Offset, uint8_t NbByteToWrite, uint8_t *pDataToWrite) = 0;
giovannivisentini 0:969a2be49f41 261
giovannivisentini 0:969a2be49f41 262 /**
giovannivisentini 9:9f2e2e68d695 263 * Check that the password is correct.
giovannivisentini 9:9f2e2e68d695 264 * @param uPwdId Password type.
giovannivisentini 9:9f2e2e68d695 265 * @param NbPwdByte Password size ( must be 0x10).
giovannivisentini 9:9f2e2e68d695 266 * @param pPwd Password buffer.
giovannivisentini 9:9f2e2e68d695 267 * @return NFC_SUCCESS if no errors and write/read permission granted
giovannivisentini 0:969a2be49f41 268 */
giovannivisentini 0:969a2be49f41 269 virtual NFC_StatusTypeDef Verify(PasswordType_t uPwdId, uint8_t NbPwdByte,const uint8_t *pPwd) = 0;
giovannivisentini 0:969a2be49f41 270
giovannivisentini 0:969a2be49f41 271 /**
giovannivisentini 9:9f2e2e68d695 272 * Replace the read or write password.
giovannivisentini 9:9f2e2e68d695 273 * @param uPwdId Password to change.
giovannivisentini 9:9f2e2e68d695 274 * @param pPwd New password.
giovannivisentini 9:9f2e2e68d695 275 * @return NFC_SUCCESS if no errors
giovannivisentini 0:969a2be49f41 276 */
giovannivisentini 0:969a2be49f41 277 virtual NFC_StatusTypeDef ChangeReferenceData(PasswordType_t uPwdId,const uint8_t *pPwd) = 0;
giovannivisentini 8:5e637c71cbb3 278
giovannivisentini 8:5e637c71cbb3 279 /**
giovannivisentini 9:9f2e2e68d695 280 * Activate NDEF file password protection.
giovannivisentini 9:9f2e2e68d695 281 * When this command is successful, read or write access to the NDEF file is protected by a 128-bit password.
giovannivisentini 9:9f2e2e68d695 282 * @param uReadOrWrite Read or write password.
giovannivisentini 9:9f2e2e68d695 283 * @return NFC_SUCCESS if no errors
giovannivisentini 8:5e637c71cbb3 284 */
giovannivisentini 0:969a2be49f41 285 virtual NFC_StatusTypeDef EnableVerificationRequirement(PasswordType_t uReadOrWrite) = 0;
giovannivisentini 8:5e637c71cbb3 286
giovannivisentini 8:5e637c71cbb3 287 /**
giovannivisentini 9:9f2e2e68d695 288 * Deactivate NDEF file password protection.
giovannivisentini 9:9f2e2e68d695 289 * When this command is successful, read or write access to the NDEF file is granted.
giovannivisentini 9:9f2e2e68d695 290 * with no security enforcement.
giovannivisentini 9:9f2e2e68d695 291 * @param uReadOrWrite Read or write password.
giovannivisentini 9:9f2e2e68d695 292 * @return NFC_SUCCESS if no errors
giovannivisentini 8:5e637c71cbb3 293 */
giovannivisentini 0:969a2be49f41 294 virtual NFC_StatusTypeDef DisableVerificationRequirement(PasswordType_t uReadOrWrite) = 0;
giovannivisentini 7:19fc04b8fec6 295
giovannivisentini 7:19fc04b8fec6 296 /**
giovannivisentini 9:9f2e2e68d695 297 * Same as {@link NFC#ReadBinary}, however permitting to read more bytes than available.
giovannivisentini 9:9f2e2e68d695 298 * @param Offset read offset.
giovannivisentini 9:9f2e2e68d695 299 * @param NbByteToRead Number of bytes to read.
giovannivisentini 9:9f2e2e68d695 300 * @param[out] pBufferRead Buffer to store the read data into.
giovannivisentini 9:9f2e2e68d695 301 * @return NFC_SUCCESS if no errors
giovannivisentini 7:19fc04b8fec6 302 */
giovannivisentini 0:969a2be49f41 303 virtual NFC_StatusTypeDef STReadBinary(uint16_t Offset, uint8_t NbByteToRead, uint8_t *pBufferRead) = 0;
giovannivisentini 7:19fc04b8fec6 304
giovannivisentini 7:19fc04b8fec6 305 /**
giovannivisentini 9:9f2e2e68d695 306 * Set the tag as read/write only, stored in the eeprom.
giovannivisentini 9:9f2e2e68d695 307 * @param uReadOrWrite ReadPwd if write only, WritePwd if read only.
giovannivisentini 9:9f2e2e68d695 308 * @return NFC_SUCCESS if no errors
giovannivisentini 7:19fc04b8fec6 309 */
giovannivisentini 0:969a2be49f41 310 virtual NFC_StatusTypeDef EnablePermanentState(PasswordType_t uReadOrWrite) = 0;
giovannivisentini 9:9f2e2e68d695 311
giovannivisentini 7:19fc04b8fec6 312 /**
giovannivisentini 9:9f2e2e68d695 313 * Unset the tag as read/write only, stored in the eeprom.
giovannivisentini 9:9f2e2e68d695 314 * @param uReadOrWrite ReadPwd if write only, WritePwd if read only.
giovannivisentini 9:9f2e2e68d695 315 * @return NFC_SUCCESS if no errors
giovannivisentini 9:9f2e2e68d695 316 * @par Caller must have I2Csuper user permissions to call this function.
giovannivisentini 7:19fc04b8fec6 317 */
giovannivisentini 0:969a2be49f41 318 virtual NFC_StatusTypeDef DisablePermanentState(PasswordType_t uReadOrWrite) = 0;
giovannivisentini 7:19fc04b8fec6 319
giovannivisentini 7:19fc04b8fec6 320 /**
giovannivisentini 9:9f2e2e68d695 321 * Set the gpo output pin.
giovannivisentini 9:9f2e2e68d695 322 * @param uSetOrReset New pin status.
giovannivisentini 9:9f2e2e68d695 323 * @return NFC_SUCCESS if no errors
giovannivisentini 7:19fc04b8fec6 324 */
giovannivisentini 0:969a2be49f41 325 virtual NFC_StatusTypeDef StateControl(uint8_t uSetOrReset) = 0;
giovannivisentini 7:19fc04b8fec6 326
giovannivisentini 7:19fc04b8fec6 327 /**
giovannivisentini 9:9f2e2e68d695 328 * @brief This function configures GPO for I2C session.
giovannivisentini 9:9f2e2e68d695 329 * @param GPO_I2Cconfig GPO configuration to set.
giovannivisentini 9:9f2e2e68d695 330 * @return NFC_SUCCESS if no errors
giovannivisentini 7:19fc04b8fec6 331 */
giovannivisentini 19:0b65a5813059 332 virtual NFC_StatusTypeDef ManageI2CGPO(NFC_GPO_MGMT GPO_I2Cconfig) = 0;
giovannivisentini 7:19fc04b8fec6 333
giovannivisentini 7:19fc04b8fec6 334 /**
giovannivisentini 9:9f2e2e68d695 335 * @brief This function configures GPO for RF session.
giovannivisentini 9:9f2e2e68d695 336 * @param GPO_RFconfig GPO configuration to set.
giovannivisentini 9:9f2e2e68d695 337 * @return NFC_SUCCESS if no errors
giovannivisentini 7:19fc04b8fec6 338 */
giovannivisentini 0:969a2be49f41 339 virtual NFC_StatusTypeDef ManageRFGPO(uint8_t GPO_RFconfig) = 0;
giovannivisentini 7:19fc04b8fec6 340
giovannivisentini 7:19fc04b8fec6 341 /**
giovannivisentini 9:9f2e2e68d695 342 * @brief This function enables or disables the RF communication.
giovannivisentini 9:9f2e2e68d695 343 * @param OnOffChoice GPO configuration to set.
giovannivisentini 9:9f2e2e68d695 344 * @return NFC_SUCCESS if no errors
giovannivisentini 7:19fc04b8fec6 345 */
giovannivisentini 0:969a2be49f41 346 virtual NFC_StatusTypeDef RFConfig(uint8_t OnOffChoice) = 0;
giovannivisentini 0:969a2be49f41 347
giovannivisentini 19:0b65a5813059 348 /**
giovannivisentini 19:0b65a5813059 349 * Generates a negative pulse on the GPO pin.
giovannivisentini 19:0b65a5813059 350 * Pulse starts immediately after the command is issued and ends at the end of the RF response.
giovannivisentini 19:0b65a5813059 351 * @return NFC_SUCCESS if no errors
giovannivisentini 19:0b65a5813059 352 */
giovannivisentini 19:0b65a5813059 353 virtual NFC_StatusTypeDef SendInterrupt(void)=0;
giovannivisentini 19:0b65a5813059 354
giovannivisentini 19:0b65a5813059 355 /**
giovannivisentini 19:0b65a5813059 356 * Change the function to call when a command ends
giovannivisentini 19:0b65a5813059 357 * @param commandCallback object containings the callback, if NULL it will use empty callback
giovannivisentini 19:0b65a5813059 358 */
giovannivisentini 19:0b65a5813059 359 void SetCallBack(Callback *commandCallback){
giovannivisentini 19:0b65a5813059 360 if(commandCallback!=NULL)
giovannivisentini 19:0b65a5813059 361 mCallback = commandCallback;
giovannivisentini 19:0b65a5813059 362 else
giovannivisentini 19:0b65a5813059 363 mCallback = &defaultCallback;
giovannivisentini 19:0b65a5813059 364 }
giovannivisentini 19:0b65a5813059 365
giovannivisentini 19:0b65a5813059 366 /**
giovannivisentini 19:0b65a5813059 367 * function to call when the component fire an interrupt
giovannivisentini 19:0b65a5813059 368 * @return last operation status
giovannivisentini 19:0b65a5813059 369 */
giovannivisentini 19:0b65a5813059 370 virtual NFC_StatusTypeDef ManageEvent()=0;
giovannivisentini 19:0b65a5813059 371
giovannivisentini 0:969a2be49f41 372 virtual ~Nfc(){};
giovannivisentini 19:0b65a5813059 373
giovannivisentini 19:0b65a5813059 374 private:
giovannivisentini 19:0b65a5813059 375 /** object containing empty callback to use in the default case*/
giovannivisentini 19:0b65a5813059 376 Callback defaultCallback;
giovannivisentini 19:0b65a5813059 377
giovannivisentini 19:0b65a5813059 378 protected:
giovannivisentini 19:0b65a5813059 379 /** object containing the callback to use*/
giovannivisentini 19:0b65a5813059 380 Callback *mCallback;
giovannivisentini 19:0b65a5813059 381
giovannivisentini 0:969a2be49f41 382 };
giovannivisentini 0:969a2be49f41 383
giovannivisentini 0:969a2be49f41 384 #endif /* __NFC_CLASS_H */
giovannivisentini 0:969a2be49f41 385
giovannivisentini 0:969a2be49f41 386 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/