ST Expansion SW Team / RFAL

Dependents:   mbed-os-nfc05a1

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers rfal_t1t.h Source File

rfal_t1t.h

Go to the documentation of this file.
00001 
00002 /******************************************************************************
00003   * @attention
00004   *
00005   * <h2><center>&copy; COPYRIGHT 2016 STMicroelectronics</center></h2>
00006   *
00007   * Licensed under ST MYLIBERTY SOFTWARE LICENSE AGREEMENT (the "License");
00008   * You may not use this file except in compliance with the License.
00009   * You may obtain a copy of the License at:
00010   *
00011   *        http://www.st.com/myliberty
00012   *
00013   * Unless required by applicable law or agreed to in writing, software
00014   * distributed under the License is distributed on an "AS IS" BASIS,
00015   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
00016   * AND SPECIFICALLY DISCLAIMING THE IMPLIED WARRANTIES OF MERCHANTABILITY,
00017   * FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
00018   * See the License for the specific language governing permissions and
00019   * limitations under the License.
00020   *
00021 ******************************************************************************/
00022 
00023 /*
00024  *      PROJECT:   ST25R391x firmware
00025  *      $Revision: $
00026  *      LANGUAGE:  ISO C99
00027  */
00028 
00029 /*! \file rfal_t1t.h
00030  *
00031  *  \author Gustavo Patricio
00032  *
00033  *  \brief Provides NFC-A T1T convenience methods and definitions
00034  *
00035  *  This module provides an interface to perform as a NFC-A Reader/Writer
00036  *  to handle a Type 1 Tag T1T (Topaz)
00037  *
00038  *
00039  * @addtogroup RFAL
00040  * @{
00041  *
00042  * @addtogroup RFAL-AL
00043  * @brief RFAL Abstraction Layer
00044  * @{
00045  *
00046  * @addtogroup T1T
00047  * @brief RFAL T1T Module
00048  * @{
00049  *
00050  */
00051 
00052 
00053 #ifndef RFAL_T1T_H
00054 #define RFAL_T1T_H
00055 
00056 /*
00057  ******************************************************************************
00058  * INCLUDES
00059  ******************************************************************************
00060  */
00061 #include "platform1.h"
00062 #include "st_errno.h"
00063 #include "rfal_rf.h"
00064 
00065 /*
00066  ******************************************************************************
00067  * GLOBAL DEFINES
00068  ******************************************************************************
00069  */
00070 #define RFAL_T1T_UID_LEN               4   /*!< T1T UID length of cascade level 1 only tag  */
00071 #define RFAL_T1T_HR_LENGTH             2   /*!< T1T HR(Header ROM) length                   */
00072 
00073 #define RFAL_T1T_HR0_NDEF_MASK      0xF0   /*!< T1T HR0 NDEF capability mask  T1T 1.2 2.2.2 */
00074 #define RFAL_T1T_HR0_NDEF_SUPPORT   0x10   /*!< T1T HR0 NDEF capable value    T1T 1.2 2.2.2 */
00075 
00076 
00077 /*! NFC-A T1T (Topaz) command set */
00078 typedef enum
00079 {
00080     RFAL_T1T_CMD_RID       = 0x78,          /*!< T1T Read UID                                */
00081     RFAL_T1T_CMD_RALL      = 0x00,          /*!< T1T Read All                                */
00082     RFAL_T1T_CMD_READ      = 0x01,          /*!< T1T Read                                    */
00083     RFAL_T1T_CMD_WRITE_E   = 0x53,          /*!< T1T Write with erase (single byte)          */
00084     RFAL_T1T_CMD_WRITE_NE  = 0x1A           /*!< T1T Write with no erase (single byte)       */
00085 } rfalT1Tcmds ;
00086 
00087 
00088 /*
00089 ******************************************************************************
00090 * GLOBAL TYPES
00091 ******************************************************************************
00092 */
00093 
00094 
00095 /*! NFC-A T1T (Topaz) RID_RES  Digital 1.1  10.6.2 & Table 50 */
00096 typedef struct
00097 {
00098     uint8_t hr0 ;                           /*!< T1T Header ROM: HR0                         */
00099     uint8_t hr1 ;                           /*!< T1T Header ROM: HR1                         */
00100     uint8_t uid[RFAL_T1T_UID_LEN];         /*!< T1T UID                                     */
00101 } rfalT1TRidRes ;
00102 
00103 /*
00104 ******************************************************************************
00105 * GLOBAL FUNCTION PROTOTYPES
00106 ******************************************************************************
00107 */
00108 
00109 
00110 /*!
00111  *****************************************************************************
00112  * \brief  Initialize NFC-A T1T Poller mode
00113  *
00114  * This methods configures RFAL RF layer to perform as a
00115  * NFC-A T1T Poller/RW (Topaz) including all default timings
00116  *
00117  * \return ERR_WRONG_STATE  : RFAL not initialized or mode not set
00118  * \return ERR_NONE         : No error
00119  *****************************************************************************
00120  */
00121 ReturnCode rfalT1TPollerInitialize( 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 );
00122 
00123 
00124 /*!
00125  *****************************************************************************
00126  * \brief  NFC-A T1T Poller RID
00127  *
00128  * This method reads the UID of a NFC-A T1T Listener device
00129  *
00130  *
00131  * \param[out]  ridRes : pointer to place the RID_RES
00132  *
00133  * \return ERR_WRONG_STATE  : RFAL not initialized or mode not set
00134  * \return ERR_PARAM        : Invalid parameter
00135  * \return ERR_NONE         : No error
00136  *****************************************************************************
00137  */
00138 ReturnCode rfalT1TPollerRid( rfalT1TRidRes  *ridRes, 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 );
00139 
00140 
00141 /*!
00142  *****************************************************************************
00143  * \brief  NFC-A T1T Poller RALL
00144  *
00145  * This method send a Read All command to a NFC-A T1T Listener device
00146  *
00147  *
00148  * \param[in]   uid       : the UID of the device to read data
00149  * \param[out]  rxBuf     : pointer to place the read data
00150  * \param[in]   rxBufLen  : size of rxBuf
00151  * \param[out]  rxRcvdLen : actual received data
00152  *
00153  * \return ERR_WRONG_STATE  : RFAL not initialized or mode not set
00154  * \return ERR_PARAM        : Invalid parameter
00155  * \return ERR_NONE         : No error
00156  *****************************************************************************
00157  */
00158 ReturnCode rfalT1TPollerRall( uint8_t* uid, uint8_t* rxBuf, uint16_t rxBufLen, uint16_t *rxRcvdLen,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 );
00159 
00160 
00161 /*!
00162  *****************************************************************************
00163  * \brief  NFC-A T1T Poller Write
00164  *
00165  * This method writes the given data on the address of a NFC-A T1T Listener device
00166  *
00167  *
00168  * \param[in]   uid       : the UID of the device to read data
00169  * \param[in]   address   : address to write the data
00170  * \param[in]   data      : the data to be written
00171  *
00172  * \return ERR_WRONG_STATE  : RFAL not initialized or mode not set
00173  * \return ERR_PARAM        : Invalid parameter
00174  * \return ERR_NONE         : No error
00175  *****************************************************************************
00176  */
00177 ReturnCode rfalT1TPollerWrite( uint8_t* uid, uint8_t address, uint8_t data,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 );
00178 
00179 #endif /* RFAL_T1T_H */
00180 
00181 /**
00182   * @}
00183   *
00184   * @}
00185   *
00186   * @}
00187   */