Skip to content

Commit

Permalink
支持ESP32。
Browse files Browse the repository at this point in the history
  • Loading branch information
Sucareto committed Apr 28, 2022
1 parent fad512d commit 029e06e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cmd.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ CRGB leds[NUM_LEDS];
#pragma message "当前的开发板是 NodeMCU_32S"
#define SerialDevice Serial
#define LED_PIN 13
#define PN532_SPI_SS 5

#else
#error "未经测试的开发板,请检查串口和阵脚定义"
Expand Down Expand Up @@ -167,7 +168,7 @@ static void sg_res_init(uint8_t payload_len = 0) { //初始化模板

static void sg_nfc_cmd_reset() { //重置读卡器
nfc.begin();
nfc.setPassiveActivationRetries(0x10); //设定等待次数,0xFF永远等待
nfc.setPassiveActivationRetries(0x01); //设定等待次数,0xFF永远等待
nfc.SAMConfig();
if (nfc.getFirmwareVersion()) {
nfc.SAMConfig();
Expand Down Expand Up @@ -237,7 +238,7 @@ static void sg_nfc_cmd_poll() { //卡号发送
res.type = 0x10;
return;
}
else if (nfc.felica_Polling(0xFFFF, 0x00, res.IDm, res.PMm, &SystemCode, 0x0F) == 1) {//< 0: error
else if (nfc.felica_Polling(0xFFFF, 0x00, res.IDm, res.PMm, &SystemCode, 200) == 1) {//< 0: error
sg_res_init(0x13);
res.count = 1;
res.type = 0x20;
Expand Down Expand Up @@ -285,7 +286,7 @@ static void sg_nfc_cmd_mifare_read_block() {//读取卡扇区数据

static void sg_nfc_cmd_felica_encap() {
uint16_t SystemCode;
if (nfc.felica_Polling(0xFFFF, 0x01, res.encap_IDm, res.poll_PMm, &SystemCode, 0x0F) == 1) {
if (nfc.felica_Polling(0xFFFF, 0x01, res.encap_IDm, res.poll_PMm, &SystemCode, 200) == 1) {
SystemCode = SystemCode >> 8 | SystemCode << 8;//SystemCode,大小端反转注意
}
else {
Expand Down

0 comments on commit 029e06e

Please sign in to comment.