/** * @brief this function reads the configuration registers according to AFE_SET_ANALOG_CONFIG command * @param *pDataRead : Pointer to the PCD response * @retval ISO14443B_SUCCESSCODE : the function is successful. * @retval ISO14443B_ERRORCODE_DEFAULT : an error occured */ static int8_t ISO14443BReadARConfigB (uint8_t *pDataRead ) { int8_t status; uc8 data = 0x01; /* Select the register */ errchk(PCD_WriteRegister (0x03,AFE_ANALOG_CONF_REG_SELECTION,0x00,&data,pDataRead)); /* Read the ARConfigA and B register */ errchk(PCD_ReadRegister ( 0x03,AFE_ANALOG_CONF_REG_SELECTION,0x02,0x01,pDataRead)); return ISO14443B_SUCCESSCODE; Error: return ISO14443B_ERRORCODE_DEFAULT; }
/** * @brief this command initializes the PCD device for the IS014443A protocol * @param none * @return ISO14443A_SUCCESSCODE the function is succesful * @return ISO14443A_ERRORCODE_DEFAULT : an error occured */ int8_t ISO14443A_Init ( void ) { u8 ProtocolSelectParameters [] = {0x00, 0x01, 0xA0}, WriteRegisterParameters [] = {0x5A, 0x04}, DemoGainParameters [] = {0x01, 0xDF}; uint8_t *pDataRead = u95HFBuffer; int8_t status; ISO14443A_InitStructure( ); /* sends a protocol Select command to the pcd to configure it */ errchk(PCD_ProtocolSelect(0x04,PCD_PROTOCOL_ISO14443A,ProtocolSelectParameters,pDataRead)); errchk(PCD_WriteRegister ( 0x04,0x3A,0x00,WriteRegisterParameters,pDataRead)); /* in order to adjust the demoduation gain of the PCD*/ errchk(PCD_WriteRegister (0x04,0x68,0x01,DemoGainParameters,u95HFBuffer)); #if 0 errchk(PCD_WriteRegister ( 0x03,0x68,0x00,&StartIndex,pDataRead)); for(i=0; i<=1; i++) { errchk(PCD_WriteRegister ( 0x03,0x69,0x00,&DemoGainParameters[i],pDataRead)); } errchk(PCD_WriteRegister ( 0x03,0x68,0x00,&StartIndex,pDataRead)); for(i=0; i<=5; i++) { errchk(PCD_ReadRegister ( 0x03,0x69,0x01,0x00,pDataRead)); DemoGainParameters[i] = pDataRead[2]; } #endif return ISO14443A_SUCCESSCODE; Error: return ISO14443A_ERRORCODE_DEFAULT; }