Complete mbed library/workspace for HelloWorld_NFC02A1

Dependencies:   NDefLib X_NUCLEO_NFC02A1 mbed

Fork of HelloWorld_NFC02A1 by ST Expansion SW Team

X-NUCLEO-NFC02A1 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-NFC02A1 Dynamic NFC Tag Expansion Board based on M24LR.

Example Application

This is just a simple "hello world" style program for the X-NUCLEO-NFC02A1 Dynamic NFC Tag Expansion Board. The program writes a URI link to the M24LR dynamic tag using the synchronous programming model. It then reads back the URI from the tag to display it on terminal. The URI can also be retrieved from an NFC enabled smartphone/tablet.

Committer:
rosarium
Date:
Tue Aug 30 09:18:50 2016 +0000
Revision:
1:11ae12d41082
NDefLib middle-ware library ported on HelloWorld_NFC02A1. Now NFC02A1 using the same middle-ware library as NFC01A1.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
rosarium 1:11ae12d41082 1 /**
rosarium 1:11ae12d41082 2 ******************************************************************************
rosarium 1:11ae12d41082 3 * @file nfc.h
rosarium 1:11ae12d41082 4 * @author ST Central Labs
rosarium 1:11ae12d41082 5 * @version V1.0.0
rosarium 1:11ae12d41082 6 * @date 14-October-2015
rosarium 1:11ae12d41082 7 * @brief This header file contains the functions prototypes for the
rosarium 1:11ae12d41082 8 * NFC device driver.
rosarium 1:11ae12d41082 9 ******************************************************************************
rosarium 1:11ae12d41082 10 * @attention
rosarium 1:11ae12d41082 11 *
rosarium 1:11ae12d41082 12 * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
rosarium 1:11ae12d41082 13 *
rosarium 1:11ae12d41082 14 * Redistribution and use in source and binary forms, with or without modification,
rosarium 1:11ae12d41082 15 * are permitted provided that the following conditions are met:
rosarium 1:11ae12d41082 16 * 1. Redistributions of source code must retain the above copyright notice,
rosarium 1:11ae12d41082 17 * this list of conditions and the following disclaimer.
rosarium 1:11ae12d41082 18 * 2. Redistributions in binary form must reproduce the above copyright notice,
rosarium 1:11ae12d41082 19 * this list of conditions and the following disclaimer in the documentation
rosarium 1:11ae12d41082 20 * and/or other materials provided with the distribution.
rosarium 1:11ae12d41082 21 * 3. Neither the name of STMicroelectronics nor the names of its contributors
rosarium 1:11ae12d41082 22 * may be used to endorse or promote products derived from this software
rosarium 1:11ae12d41082 23 * without specific prior written permission.
rosarium 1:11ae12d41082 24 *
rosarium 1:11ae12d41082 25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
rosarium 1:11ae12d41082 26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
rosarium 1:11ae12d41082 27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
rosarium 1:11ae12d41082 28 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
rosarium 1:11ae12d41082 29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
rosarium 1:11ae12d41082 30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
rosarium 1:11ae12d41082 31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
rosarium 1:11ae12d41082 32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
rosarium 1:11ae12d41082 33 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
rosarium 1:11ae12d41082 34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
rosarium 1:11ae12d41082 35 *
rosarium 1:11ae12d41082 36 ******************************************************************************
rosarium 1:11ae12d41082 37 */
rosarium 1:11ae12d41082 38 #ifndef __NFC_H_
rosarium 1:11ae12d41082 39 #define __NFC_H_
rosarium 1:11ae12d41082 40
rosarium 1:11ae12d41082 41 #ifdef __cplusplus
rosarium 1:11ae12d41082 42 extern "C" {
rosarium 1:11ae12d41082 43 #endif
rosarium 1:11ae12d41082 44
rosarium 1:11ae12d41082 45 /* Includes ------------------------------------------------------------------*/
rosarium 1:11ae12d41082 46 #include <stdint.h>
rosarium 1:11ae12d41082 47 #include "component.h"
rosarium 1:11ae12d41082 48 /** @addtogroup BSP
rosarium 1:11ae12d41082 49 * @{
rosarium 1:11ae12d41082 50 */
rosarium 1:11ae12d41082 51
rosarium 1:11ae12d41082 52 /** @addtogroup Components
rosarium 1:11ae12d41082 53 * @{
rosarium 1:11ae12d41082 54 */
rosarium 1:11ae12d41082 55
rosarium 1:11ae12d41082 56 /** @addtogroup NFC
rosarium 1:11ae12d41082 57 * @{
rosarium 1:11ae12d41082 58 */
rosarium 1:11ae12d41082 59
rosarium 1:11ae12d41082 60 /** @defgroup NFC_Exported_Types
rosarium 1:11ae12d41082 61 * @{
rosarium 1:11ae12d41082 62 */
rosarium 1:11ae12d41082 63
rosarium 1:11ae12d41082 64 /**
rosarium 1:11ae12d41082 65 * @brief NFC status enumerator definition
rosarium 1:11ae12d41082 66 */
rosarium 1:11ae12d41082 67 typedef enum {
rosarium 1:11ae12d41082 68 NFC_SUCCESS=0x9000,
rosarium 1:11ae12d41082 69 NFC_ERROR=0x6F00,
rosarium 1:11ae12d41082 70 NFC_FILE_OVERFLOW_LE = 0x6280,
rosarium 1:11ae12d41082 71 NFC_EOF = 0x6282,
rosarium 1:11ae12d41082 72 NFC_PASSWORD_REQUIRED = 0x6300,
rosarium 1:11ae12d41082 73 NFC_PASSWORD_INCORRECT = 0x63C0,
rosarium 1:11ae12d41082 74 NFC_PASSWORD_INCORRECT1RETRY = 0x63C1,
rosarium 1:11ae12d41082 75 NFC_PASSWORD_INCORRECT2RETRY = 0x63C2,
rosarium 1:11ae12d41082 76 NFC_WRONG_LENGHT = 0x6700,
rosarium 1:11ae12d41082 77 NFC_UNSUCESSFUL_UPDATING = 0x6581,
rosarium 1:11ae12d41082 78 NFC_INCOPATIBLE_COMMAND= 0x6981,
rosarium 1:11ae12d41082 79 NFC_SECURITY_UNSATISFIED = 0x6982,
rosarium 1:11ae12d41082 80 NFC_REFERENCE_DATA_NOT_USABLE = 0x6984,
rosarium 1:11ae12d41082 81
rosarium 1:11ae12d41082 82 NFC_INCORRECT_PARAMETER = 0x6a80,
rosarium 1:11ae12d41082 83 NFC_FILE_NOT_FOUND=0x6a82,
rosarium 1:11ae12d41082 84 NFC_FILE_OVERFLOW_LC = 0x6A84, //TODO difference with Le??
rosarium 1:11ae12d41082 85
rosarium 1:11ae12d41082 86 NFC_INCORRECT_P1_OR_P2 = 0x6A86, //TODO better name?
rosarium 1:11ae12d41082 87 NFC_RF_SESSION_KILLED=0x6500,
rosarium 1:11ae12d41082 88 NFC_INS_NOT_SUPPORTED=0x6D00,
rosarium 1:11ae12d41082 89 NFC_CLASS_NOT_SUPPORTED=0x6E00,
rosarium 1:11ae12d41082 90
rosarium 1:11ae12d41082 91 //IOError
rosarium 1:11ae12d41082 92 NFC_IO_ERROR_I2CTIMEOUT=0x0011,
rosarium 1:11ae12d41082 93 NFC_IO_ERROR_CRC=0x0012,
rosarium 1:11ae12d41082 94 NFC_IO_ERROR_NACK=0x0013,
rosarium 1:11ae12d41082 95 NFC_IO_ERROR_PARAMETER=0x0014,
rosarium 1:11ae12d41082 96 NFC_IO_ERROR_NBATEMPT=0x0015,
rosarium 1:11ae12d41082 97 NFC_IO_NOACKNOWLEDGE=0x0016
rosarium 1:11ae12d41082 98 } NFC_StatusTypeDef;
rosarium 1:11ae12d41082 99
rosarium 1:11ae12d41082 100 /**
rosarium 1:11ae12d41082 101 * @brief NFC component identifier enumerator definition.
rosarium 1:11ae12d41082 102 */
rosarium 1:11ae12d41082 103 typedef enum
rosarium 1:11ae12d41082 104 {
rosarium 1:11ae12d41082 105 NFC_NONE_COMPONENT = 0,
rosarium 1:11ae12d41082 106 NFC_M24SR_COMPONENT = 1
rosarium 1:11ae12d41082 107 } NFC_ComponentTypeDef;
rosarium 1:11ae12d41082 108
rosarium 1:11ae12d41082 109 /**
rosarium 1:11ae12d41082 110 * @brief GPO state structure
rosarium 1:11ae12d41082 111 */
rosarium 1:11ae12d41082 112 typedef enum {
rosarium 1:11ae12d41082 113 HIGH_IMPEDANCE = 0,
rosarium 1:11ae12d41082 114 SESSION_OPENED =1,
rosarium 1:11ae12d41082 115 WIP=2,
rosarium 1:11ae12d41082 116 I2C_ANSWER_READY=3,
rosarium 1:11ae12d41082 117 INTERRUPT=4,
rosarium 1:11ae12d41082 118 STATE_CONTROL=5
rosarium 1:11ae12d41082 119 } NFC_GPO_MGMT;
rosarium 1:11ae12d41082 120
rosarium 1:11ae12d41082 121
rosarium 1:11ae12d41082 122 /**
rosarium 1:11ae12d41082 123 * @brief NFC driver structure definition
rosarium 1:11ae12d41082 124 */
rosarium 1:11ae12d41082 125 typedef struct {
rosarium 1:11ae12d41082 126 /* Generic */
rosarium 1:11ae12d41082 127 NFC_StatusTypeDef (*Init) (void *handle, void *init);
rosarium 1:11ae12d41082 128 NFC_StatusTypeDef (*ReadID) (void *handle, uint8_t *id);
rosarium 1:11ae12d41082 129
rosarium 1:11ae12d41082 130 /* Interrupts */
rosarium 1:11ae12d41082 131 NFC_StatusTypeDef (*SendInterrupt)(void *handle);
rosarium 1:11ae12d41082 132
rosarium 1:11ae12d41082 133 /* Specific */
rosarium 1:11ae12d41082 134 //I2C session Commands:
rosarium 1:11ae12d41082 135 NFC_StatusTypeDef (*GetSession)(void *handle);
rosarium 1:11ae12d41082 136 NFC_StatusTypeDef (*KillSession)(void *handle);
rosarium 1:11ae12d41082 137 NFC_StatusTypeDef (*Deselect)(void *handle);
rosarium 1:11ae12d41082 138
rosarium 1:11ae12d41082 139 //NFC forum type 4 commands:
rosarium 1:11ae12d41082 140 NFC_StatusTypeDef (*SelectApplication)(void *handle);
rosarium 1:11ae12d41082 141 NFC_StatusTypeDef (*SelectCCfile)(void *handle);
rosarium 1:11ae12d41082 142 NFC_StatusTypeDef (*SelectNDEFfile)(void *handle, uint16_t NDEFfileId);
rosarium 1:11ae12d41082 143 NFC_StatusTypeDef (*SelectSystemfile)(void *handle);
rosarium 1:11ae12d41082 144 NFC_StatusTypeDef (*ReadBinary)(void *handle, uint16_t Offset, uint8_t NbByteToRead, uint8_t *pBufferRead);
rosarium 1:11ae12d41082 145 NFC_StatusTypeDef (*UpdateBinary)(void *handle, uint16_t Offset, uint8_t NbByteToWrite, uint8_t *pDataToWrite);
rosarium 1:11ae12d41082 146
rosarium 1:11ae12d41082 147 //ISO/IEC 7816-4 commands:
rosarium 1:11ae12d41082 148 NFC_StatusTypeDef (*Verify)(void *handle, uint16_t uPwdId, uint8_t NbPwdByte, uint8_t *pPwd);
rosarium 1:11ae12d41082 149 NFC_StatusTypeDef (*ChangeReferenceData)(void *handle, uint16_t uPwdId, uint8_t *pPwd);
rosarium 1:11ae12d41082 150 NFC_StatusTypeDef (*EnableVerificationRequirement)(void *handle, uint16_t uReadOrWrite);
rosarium 1:11ae12d41082 151 NFC_StatusTypeDef (*DisableVerificationRequirement)(void *handle, uint16_t uReadOrWrite);
rosarium 1:11ae12d41082 152
rosarium 1:11ae12d41082 153 //ST Specific
rosarium 1:11ae12d41082 154 NFC_StatusTypeDef (*STReadBinary)(void *handle, uint16_t Offset, uint8_t NbByteToRead, uint8_t *pBufferRead);
rosarium 1:11ae12d41082 155 NFC_StatusTypeDef (*EnablePermanentState)(void *handle, uint16_t uReadOrWrite);
rosarium 1:11ae12d41082 156 NFC_StatusTypeDef (*DisablePermanentState)(void *handle, uint16_t uReadOrWrite);
rosarium 1:11ae12d41082 157
rosarium 1:11ae12d41082 158 //??
rosarium 1:11ae12d41082 159
rosarium 1:11ae12d41082 160 NFC_StatusTypeDef (*StateControl)(void *handle, uint8_t uSetOrReset);
rosarium 1:11ae12d41082 161 NFC_StatusTypeDef (*ManageI2CGPO)(void *handle, uint8_t GPO_I2Cconfig);
rosarium 1:11ae12d41082 162 NFC_StatusTypeDef (*ManageRFGPO)(void *handle, uint8_t GPO_RFconfig);
rosarium 1:11ae12d41082 163 NFC_StatusTypeDef (*RFConfig)(void *handle, uint8_t OnOffChoice);
rosarium 1:11ae12d41082 164
rosarium 1:11ae12d41082 165 } NFC_DrvVTableTypeDef;
rosarium 1:11ae12d41082 166
rosarium 1:11ae12d41082 167 /**
rosarium 1:11ae12d41082 168 * @}
rosarium 1:11ae12d41082 169 */
rosarium 1:11ae12d41082 170
rosarium 1:11ae12d41082 171 /**
rosarium 1:11ae12d41082 172 * @}
rosarium 1:11ae12d41082 173 */
rosarium 1:11ae12d41082 174
rosarium 1:11ae12d41082 175 /**
rosarium 1:11ae12d41082 176 * @}
rosarium 1:11ae12d41082 177 */
rosarium 1:11ae12d41082 178
rosarium 1:11ae12d41082 179 /**
rosarium 1:11ae12d41082 180 * @}
rosarium 1:11ae12d41082 181 */
rosarium 1:11ae12d41082 182
rosarium 1:11ae12d41082 183 #ifdef __cplusplus
rosarium 1:11ae12d41082 184 }
rosarium 1:11ae12d41082 185 #endif
rosarium 1:11ae12d41082 186
rosarium 1:11ae12d41082 187 #endif /* __NFC_H_ */
rosarium 1:11ae12d41082 188
rosarium 1:11ae12d41082 189 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/