AppNearMe µNFC stack for the NXP PN532 chip License: You can use the stack free of charge to prototype with mbed; if you want to use the stack with your commercial product, get in touch!

Dependents:   IOT_sensor_nfc AppNearMe_MuNFC_PN532_Test p2p_nfc_test NFCMoodLamp ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers pn532_cmd.h Source File

pn532_cmd.h

00001 /*
00002     pn532_cmd.h 
00003     Copyright (c) Donatien Garnier 2012
00004     donatien.garnier@appnearme.com
00005     http://www.appnearme.com/
00006 */
00007 
00008 
00009 #ifndef PN532_CMD_H_
00010 #define PN532_CMD_H_
00011 
00012 #ifdef __cplusplus
00013 extern "C" {
00014 #endif
00015 
00016 #include "core/fwk.h"
00017 
00018 // Commands
00019 int pn532_cmd_get_firmware_version( uint8_t* pIc, uint16_t* pVersion, int timeout );
00020 
00021 #define PN532_PARAMETERS_NONE             0x00
00022 #define PN532_PARAMETERS_NAD_USED         0x01
00023 #define PN532_PARAMETERS_DID_USED         0x02
00024 #define PN532_PARAMETERS_AUTO_ATR_RES     0x04
00025 #define PN532_PARAMETERS_AUTO_RATS        0x10
00026 #define PN532_PARAMETERS_ISO_14443_4_EMU  0x20
00027 #define PN532_PARAMETERS_NO_PRE_POSTAMBLE 0x40
00028 
00029 int pn532_cmd_set_parameters( uint8_t flags, int timeout );
00030 
00031 int pn532_cmd_sam_configuration( uint8_t mode, int timeout );
00032 
00033 //Target mode selection
00034 #define PN532_TARGET_PASSIVE_ONLY  0x01
00035 #define PN532_TARGET_DEP_ONLY      0x02
00036 #define PN532_TARGET_PICC_ONLY     0x04
00037 
00038 //Target mode
00039 #define PN532_TARGET_BAUDRATE_MASK    0x70
00040 #define PN532_TARGET_BAUDRATE_106K    0x00
00041 #define PN532_TARGET_BAUDRATE_212K    0x01
00042 #define PN532_TARGET_BAUDRATE_414K    0x02
00043 #define PN532_TARGET_ISO_14443_4_PICC 0x08
00044 #define PN532_TARGET_DEP              0x04
00045 #define PN532_TARGET_FRAMING_MASK     0x03
00046 #define PN532_TARGET_FRAMING_MIFARE   0x00
00047 #define PN532_TARGET_FRAMING_ACTIVE   0x01
00048 #define PN532_TARGET_FRAMING_FELICA   0x02
00049 
00050 //Initiator mode
00051 #define PN532_READER_MODE_ISO14443A_106K    0x00
00052 #define PN532_READER_MODE_FELICA_212K       0x01
00053 #define PN532_READER_MODE_FELICA_424K       0x02
00054 #define PN532_READER_MODE_ISO14443B_106K    0x03
00055 #define PN532_READER_MODE_JEWEL_106K        0x04
00056 
00057 // pMifareParams : 6 bytes long, pFelicaParams : 18, pNfcId3 : 10
00058 int pn532_cmd_target_init( uint8_t outMode, buffer* pMifareParams, buffer* pFelicaParams,
00059     buffer* pNfcId3, buffer* pAtrG, buffer* pAtrT, uint8_t* pInMode, buffer* pData, int timeout);
00060 
00061 int pn532_cmd_target_get( buffer* pData, uint8_t* pStatus, int timeout );
00062 
00063 int pn532_cmd_target_respond( buffer* pData, uint8_t* pStatus, int timeout );
00064 
00065 //PN532 handles framing
00066 int pn532_cmd_target_data_get( buffer* pData, uint8_t* pStatus, int timeout );
00067 
00068 int pn532_cmd_target_data_respond( buffer* pData, uint8_t* pStatus, int timeout );
00069 
00070 int pn532_cmd_target_status( uint8_t* pState, uint8_t* pBaudrate, int timeout );
00071 
00072 int pn532_cmd_reader_poll( uint8_t mode, uint8_t* pTargetDetected, buffer* pInitiatorData, int timeout );
00073 
00074 //PN532 handles framing
00075 int pn532_cmd_reader_data_transceive( buffer* pDataOut, buffer* pDataIn, uint8_t* pStatus, int timeout );
00076 
00077 int pn532_cmd_register_read( uint16_t address, uint8_t* pData, int timeout );
00078 
00079 int pn532_cmd_register_write( uint16_t address, uint8_t data, int timeout );
00080 
00081 int pn532_cmd_set_rf_field( bool on, int timeout );
00082 
00083 int pn532_cmd_set_rf_iso14443a_params( buffer* pData, int timeout );
00084 
00085 int pn532_cmd_get_status( uint8_t* pErr, uint8_t* pField, int timeout );
00086 
00087 // Low-level command
00088 int pn532_cmd_exec( buffer* pDataOut, buffer* pDataIn, int timeout );
00089 
00090 #ifdef __cplusplus
00091 }
00092 #endif
00093 
00094 #endif /* PN532_CMD_H_ */