⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 request.c

📁 飞利浦RC522芯片源代码。该芯片主要针对三表市场和手持设备
💻 C
字号:
/*************************************************
Function:       Request
Description:
     REQA, request to see if have a ISO14443A card in the field
Parameter:
     req_code   command code(ISO14443_3_REQALL or ISO14443_3_REQIDL)
     atq        the buffer to save the answer to request from the card
Return:
     short      status of implement
**************************************************/
short Request(unsigned char req_code, unsigned char *atq)
{
   char  status = STATUS_SUCCESS;

   /************* initialize *****************/
   RcModifyReg(JREG_STATUS2, 0, JBIT_CRYPTO1ON);  /* disable Crypto if activated before */
   RcSetReg(JREG_COLL, JBIT_VALUESAFTERCOLL);  //active values after coll
   RcModifyReg(JREG_TXMODE, 0, JBIT_CRCEN);  //disable TxCRC and RxCRC
   RcModifyReg(JREG_RXMODE, 0, JBIT_CRCEN);
   RcSetReg(JREG_BITFRAMING, REQUEST_BITS);

   /* set necessary parameters for transmission */
   ResetInfo(MInfo);
   SerBuffer[0] = req_code;
   MInfo.nBytesToSend   = 1;

   /* Set timeout for REQA, ANTICOLL, SELECT*/
 SetTimeOut(300);

   status = M522PcdCmd(JCMD_TRANSCEIVE,
                      SerBuffer,
                      &MInfo);
   if (status)      // error occured
   {
      *atq = 0;
   }
   else
   {
      if (MInfo.nBytesReceived != 2) // 2 bytes expected
      {
         *atq = 0;
         status = STATUS_BITCOUNT_ERROR;
      }
      else
      {
         status = STATUS_SUCCESS;
         memcpy(atq,SerBuffer,2);
      }
   }
   return status;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -