#include "BMZ00050.h"
BMZ00050 nfc(8,10,TRANSPARENT_MODE);                //SPI硬件

/*
//BMZ00050 nfc(TRANSPARENT_MODE);                   //uart硬件
//BMZ00050 nfc(8,10,TRANSPARENT_MODE);              //SPI硬件
//BMZ00050 nfc(8,13,12,11,10,TRANSPARENT_MODE);     //SPI軟件
//BMZ00050 nfc(8,TRANSPARENT_MODE);                 //IIC硬件
//BMZ00050 nfc(8,A5,A4,TRANSPARENT_MODE);           //IIC軟件
//BMZ00050 nfc(TRANSPARENT_MODE);                   //uart
*/

uint8_t BUFF_WRITE[8]={0x41,0x41,0x41,0x41,0x42,0x42,0x42,0x42};  //SRAM_WRITE[]為想寫入的數據
uint8_t BUFF_READ[61]={0};                                        //SRAM_READ[]存儲想讀取的數據
uint8_t writedata_count=1;                                        //寫數據次數
void setup()
{
    
    Serial.begin(9600);                            //初始化串口，以便serial monitor使用
    nfc.begin();                                   //初始化模塊
    
}

void loop() 
{
  
    if(writedata_count == 1)
    {
       nfc.writeDataPacket(BUFF_WRITE,8);
       writedata_count = 0;
    }

    if(nfc.readDataPacket(BUFF_READ)==1)                //判斷是否有數據
    {
       Serial.println(" ");
       Serial.print("DataLen： ");                       //顯示數據長度DataLen于serial monitor
       Serial.println(BUFF_READ[0],DEC);
   
       Serial.print("readData： ");
       for(uint8_t i=0;i<BUFF_READ[0];i++)               //顯示數據于serial monitor
       {
           Serial.print(BUFF_READ[i+1],DEC);
           Serial.print(" ");
       }
       Serial.println(" ");
    }

}
