583 lines
16 KiB
C
583 lines
16 KiB
C
#if 1
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include "ql_rtos.h"
|
|
#include "ql_application.h"
|
|
#include "ql_audio.h"
|
|
#include "ql_dev.h"
|
|
#include "ql_iic.h"
|
|
#include "ql_gpio.h"
|
|
#include "app_inc.h"
|
|
#include "ql_fs.h"
|
|
#include "DP1312EA.h"
|
|
#include "TypeA.h"
|
|
#include "LPCD.h"
|
|
#include "hal_api.h"
|
|
|
|
#define DP1312EA_PIN_IRQ GPIO_PIN_NO_85
|
|
#define NFC_TX_MODE_DURATION_MS 30000U
|
|
#define NFC_TICKS_PER_MS_DIVISOR 5U
|
|
|
|
extern int fota_start;
|
|
extern int audio_packet_type;
|
|
extern volatile int tts_playing;
|
|
extern int g_testmode;
|
|
extern uint8_t get_sleep_mode(void);
|
|
extern int get_mqtt_connect_status(void);
|
|
extern bool vad_audio_is_recording(void);
|
|
extern int xiaoice_get_play_counter(void);
|
|
|
|
static ql_sem_t nfc_irq_sem = NULL;
|
|
|
|
// NFC 任务状态
|
|
typedef enum {
|
|
NFC_STATE_LPCD_WAIT, // 低功耗等待中断
|
|
NFC_STATE_POLLING, // 500ms 轮询读卡中
|
|
} nfc_state_t;
|
|
|
|
static volatile nfc_state_t g_nfc_state = NFC_STATE_LPCD_WAIT;
|
|
static volatile int g_poll_fail_count = 0;
|
|
static volatile int g_nfc_irq_trigger = 0;
|
|
static volatile u8 g_nfc_tx_mode_requested = 0;
|
|
static volatile u32 g_nfc_tx_mode_deadline = 0;
|
|
|
|
#define NFC_CARD_FRAME_MAX 64
|
|
#define NFC_CARD_TX_POLLS 20
|
|
#define NFC_CARD_RX_POLLS 200
|
|
#define NFC_CARD_SESSION_POLL_MS 1
|
|
#define NFC_TYPE2_PAGE_SIZE 4
|
|
#define NFC_TYPE2_READ_SIZE 16
|
|
#define NFC_TYPE2_MEMORY_SIZE 160
|
|
#define NFC_TYPE2_NDEF_OFFSET 16
|
|
#define NFC_IMEI_DIGITS 15
|
|
|
|
#define NFC_IRQ_TX 0x40
|
|
#define NFC_IRQ_RX 0x20
|
|
#define NFC_IRQ_ERR 0x02
|
|
|
|
extern int hal_os_get_device_sn(char *pdevice_sn);
|
|
extern s8 Test_NTAG213(void);
|
|
|
|
static u8 nfc_type2_memory[NFC_TYPE2_MEMORY_SIZE];
|
|
|
|
static u8 nfc_tx_mode_is_active(void)
|
|
{
|
|
u32 now;
|
|
|
|
if (!g_nfc_tx_mode_requested) {
|
|
return 0;
|
|
}
|
|
|
|
now = ql_rtos_get_systicks();
|
|
if ((s32)(now - g_nfc_tx_mode_deadline) >= 0) {
|
|
g_nfc_tx_mode_requested = 0;
|
|
return 0;
|
|
}
|
|
|
|
return 1;
|
|
}
|
|
|
|
void app_nfc_tx_mode_start(void)
|
|
{
|
|
g_nfc_tx_mode_deadline = ql_rtos_get_systicks() +
|
|
(NFC_TX_MODE_DURATION_MS / NFC_TICKS_PER_MS_DIVISOR);
|
|
g_nfc_tx_mode_requested = 1;
|
|
|
|
if (nfc_irq_sem != NULL) {
|
|
ql_rtos_semaphore_release(nfc_irq_sem);
|
|
}
|
|
|
|
printf("NFC TX mode requested for 30 seconds\r\n");
|
|
}
|
|
|
|
static void nfc_card_emulation_log_status(const char *reason)
|
|
{
|
|
printf("NFC card emulation %s: cmd=%02X irq=%02X err=%02X status1=%02X status2=%02X fifo=%02X txm=%02X rxm=%02X framing=%02X\r\n",
|
|
reason,
|
|
DP1312EA_ReadRawRC(CommandReg),
|
|
DP1312EA_ReadRawRC(ComIrqReg),
|
|
DP1312EA_ReadRawRC(ErrorReg),
|
|
DP1312EA_ReadRawRC(Status1Reg),
|
|
DP1312EA_ReadRawRC(Status2Reg),
|
|
DP1312EA_ReadRawRC(FIFOLevelReg),
|
|
DP1312EA_ReadRawRC(TxModeReg),
|
|
DP1312EA_ReadRawRC(RxModeReg),
|
|
DP1312EA_ReadRawRC(BitFramingReg));
|
|
}
|
|
|
|
static u8 nfc_card_emulation_read_frame(u8 *frame, u8 capacity)
|
|
{
|
|
u8 fifo_len = DP1312EA_ReadRawRC(FIFOLevelReg) & 0x7F;
|
|
u8 read_len = fifo_len;
|
|
|
|
if (read_len > capacity) {
|
|
read_len = capacity;
|
|
}
|
|
|
|
if (read_len > 0) {
|
|
DP1312EA_ReadFIFO(frame, read_len);
|
|
}
|
|
|
|
while (read_len < fifo_len) {
|
|
(void)DP1312EA_ReadRawRC(FIFODataReg);
|
|
read_len++;
|
|
}
|
|
|
|
return fifo_len > capacity ? capacity : fifo_len;
|
|
}
|
|
|
|
static void nfc_card_emulation_log_frame(const char *prefix,
|
|
const u8 *frame,
|
|
u8 length)
|
|
{
|
|
u8 i;
|
|
|
|
printf("NFC %s (%u):", prefix, length);
|
|
for (i = 0; i < length; i++) {
|
|
printf(" %02X", frame[i]);
|
|
}
|
|
printf("\r\n");
|
|
}
|
|
|
|
static u8 nfc_card_emulation_send_frame(const u8 *frame, u8 length)
|
|
{
|
|
u16 poll_count;
|
|
u8 irq;
|
|
|
|
/* AutoColl has activated target mode and changed to Transceive. Keep it
|
|
* active: writing Idle here clears TargetActivated in Status2Reg. */
|
|
DP1312EA_WriteRawRC(ComIrqReg, 0x7F);
|
|
DP1312EA_SetBitMask(FIFOLevelReg, 0x80);
|
|
DP1312EA_SetBitMask(TxModeReg, 0x80);
|
|
DP1312EA_SetBitMask(RxModeReg, 0x80);
|
|
DP1312EA_WriteRawRC(BitFramingReg, 0x00);
|
|
DP1312EA_WriteFIFO((u8 *)frame, length);
|
|
DP1312EA_SetBitMask(BitFramingReg, 0x80);
|
|
|
|
for (poll_count = 0; poll_count < NFC_CARD_TX_POLLS; poll_count++) {
|
|
irq = DP1312EA_ReadRawRC(ComIrqReg);
|
|
if ((irq & NFC_IRQ_TX) != 0) {
|
|
DP1312EA_WriteRawRC(BitFramingReg, 0x00);
|
|
return 1;
|
|
}
|
|
if ((irq & NFC_IRQ_ERR) != 0) {
|
|
break;
|
|
}
|
|
ql_rtos_task_sleep_ms(NFC_CARD_SESSION_POLL_MS);
|
|
}
|
|
|
|
DP1312EA_WriteRawRC(BitFramingReg, 0x00);
|
|
nfc_card_emulation_log_status("frame transmit failed");
|
|
return 0;
|
|
}
|
|
|
|
static void nfc_type2_build_ndef(void)
|
|
{
|
|
char device_id[32] = {0};
|
|
char serial_number[32] = {0};
|
|
char imei[32] = {0};
|
|
char json[128];
|
|
int json_len;
|
|
u8 *ndef;
|
|
u8 record_len;
|
|
|
|
if (hal_os_get_device_id(device_id) != 0) {
|
|
strcpy(device_id, "unknown");
|
|
}
|
|
if (hal_os_get_device_sn(serial_number) != 0) {
|
|
strcpy(serial_number, "unknown");
|
|
}
|
|
if (ql_dev_get_imei(imei, sizeof(imei)) != QL_DEV_SUCCESS ||
|
|
imei[0] == '\0') {
|
|
strcpy(imei, "unknown");
|
|
} else {
|
|
imei[NFC_IMEI_DIGITS] = '\0';
|
|
}
|
|
|
|
json_len = snprintf(json, sizeof(json),
|
|
"{\"device_id\":\"%s\",\"serial_number\":\"%s\","
|
|
"\"imei\":\"%s\"}",
|
|
device_id, serial_number, imei);
|
|
if (json_len < 0) {
|
|
json_len = 0;
|
|
} else if (json_len >= (int)sizeof(json)) {
|
|
json_len = sizeof(json) - 1;
|
|
}
|
|
|
|
memset(nfc_type2_memory, 0, sizeof(nfc_type2_memory));
|
|
|
|
/* Static UID/manufacturer pages followed by a read-only Type 2 CC. */
|
|
nfc_type2_memory[0] = 0x08;
|
|
nfc_type2_memory[1] = 0xAA;
|
|
nfc_type2_memory[2] = 0xBB;
|
|
nfc_type2_memory[3] = 0xCC;
|
|
nfc_type2_memory[12] = 0xE1;
|
|
nfc_type2_memory[13] = 0x10;
|
|
nfc_type2_memory[14] = 0x12; /* 144 data bytes (18 x 8). */
|
|
nfc_type2_memory[15] = 0x0F; /* Read-only access. */
|
|
|
|
ndef = &nfc_type2_memory[NFC_TYPE2_NDEF_OFFSET];
|
|
record_len = (u8)(7 + json_len);
|
|
ndef[0] = 0x03; /* NDEF Message TLV. */
|
|
ndef[1] = record_len;
|
|
ndef[2] = 0xD1; /* MB, ME, SR, TNF well-known. */
|
|
ndef[3] = 0x01; /* Type length. */
|
|
ndef[4] = (u8)(3 + json_len); /* Text status/lang plus JSON. */
|
|
ndef[5] = 'T';
|
|
ndef[6] = 0x02; /* UTF-8, language length 2. */
|
|
ndef[7] = 'e';
|
|
ndef[8] = 'n';
|
|
memcpy(&ndef[9], json, json_len);
|
|
ndef[9 + json_len] = 0xFE; /* Terminator TLV. */
|
|
|
|
printf("NFC Type 2 NDEF: %s\r\n", json);
|
|
}
|
|
|
|
static void nfc_type2_read_pages(u8 start_page, u8 *response)
|
|
{
|
|
u16 start = (u16)start_page * NFC_TYPE2_PAGE_SIZE;
|
|
u8 i;
|
|
|
|
for (i = 0; i < NFC_TYPE2_READ_SIZE; i++) {
|
|
u16 offset = start + i;
|
|
response[i] = offset < NFC_TYPE2_MEMORY_SIZE
|
|
? nfc_type2_memory[offset]
|
|
: 0x00;
|
|
}
|
|
}
|
|
|
|
static void nfc_card_emulation_configure_type2(void)
|
|
{
|
|
static const u8 card_config[] = {
|
|
0x04, 0x00, /* ATQA: single-size (4-byte) UID */
|
|
0xAA, 0xBB, 0xCC, /* NFCID1; first byte 08 is added by PN512 */
|
|
0x00, /* SEL_RES / SAK: Type 2, no ISO-DEP */
|
|
0x01, 0xFE, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
|
|
0x07, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
|
|
0xFF, 0xFF,
|
|
0x88
|
|
};
|
|
|
|
DP1312EA_PcdConfigISOType('K');
|
|
ql_rtos_task_sleep_ms(2);
|
|
DP1312EA_WriteFIFO((u8 *)card_config, sizeof(card_config));
|
|
ql_rtos_task_sleep_ms(2);
|
|
DP1312EA_WriteRawRC(CommandReg, DP1312EA_MEM);
|
|
DP1312EA_WriteRawRC(CommandReg, DP1312EA_AUTOCOLL);
|
|
}
|
|
|
|
static void nfc_card_emulation_start(void)
|
|
{
|
|
DP1312EA_WriteRawRC(CommandReg, DP1312EA_IDLE);
|
|
DP1312EA_WriteRawRC(ComIrqReg, 0x7F);
|
|
DP1312EA_WriteRawRC(DivIrqReg, 0x7F);
|
|
DP1312EA_SetBitMask(FIFOLevelReg, 0x80);
|
|
|
|
nfc_type2_build_ndef();
|
|
nfc_card_emulation_configure_type2();
|
|
nfc_card_emulation_log_status("started");
|
|
printf("NFC Type 2 tag: ATQA=04 00, UID=08 AA BB CC, SAK=00\r\n");
|
|
}
|
|
|
|
static void nfc_card_emulation_task(void)
|
|
{
|
|
u8 frame[NFC_CARD_FRAME_MAX];
|
|
u8 response[NFC_TYPE2_READ_SIZE];
|
|
u8 frame_len;
|
|
u16 poll_count;
|
|
u8 last_command = 0xFF;
|
|
u8 command;
|
|
|
|
nfc_card_emulation_start();
|
|
|
|
while (nfc_tx_mode_is_active()) {
|
|
command = DP1312EA_ReadRawRC(CommandReg) & 0x0F;
|
|
|
|
if (command != last_command) {
|
|
nfc_card_emulation_log_status("state changed");
|
|
last_command = command;
|
|
}
|
|
|
|
if (command == DP1312EA_TRANSCEIVE) {
|
|
frame_len = nfc_card_emulation_read_frame(frame, sizeof(frame));
|
|
while (nfc_tx_mode_is_active() &&
|
|
frame_len >= 2 && frame[0] == 0x30) {
|
|
nfc_card_emulation_log_frame("Type 2 READ RX", frame,
|
|
frame_len);
|
|
nfc_type2_read_pages(frame[1], response);
|
|
if (!nfc_card_emulation_send_frame(response,
|
|
sizeof(response))) {
|
|
break;
|
|
}
|
|
printf("NFC Type 2 READ page %u TX complete\r\n", frame[1]);
|
|
nfc_card_emulation_log_frame("Type 2 READ TX", response,
|
|
sizeof(response));
|
|
|
|
DP1312EA_WriteRawRC(ComIrqReg, NFC_IRQ_TX);
|
|
for (poll_count = 0;
|
|
poll_count < NFC_CARD_RX_POLLS &&
|
|
nfc_tx_mode_is_active();
|
|
poll_count++) {
|
|
u8 irq = DP1312EA_ReadRawRC(ComIrqReg);
|
|
|
|
if ((irq & NFC_IRQ_ERR) != 0) {
|
|
nfc_card_emulation_log_status("Type 2 receive error");
|
|
break;
|
|
}
|
|
|
|
if ((irq & NFC_IRQ_RX) != 0 &&
|
|
(DP1312EA_ReadRawRC(FIFOLevelReg) & 0x7F) != 0) {
|
|
frame_len = nfc_card_emulation_read_frame(
|
|
frame, sizeof(frame));
|
|
break;
|
|
}
|
|
|
|
ql_rtos_task_sleep_ms(NFC_CARD_SESSION_POLL_MS);
|
|
}
|
|
|
|
if (poll_count == NFC_CARD_RX_POLLS) {
|
|
nfc_card_emulation_log_status("Type 2 receive timeout");
|
|
break;
|
|
}
|
|
|
|
if ((DP1312EA_ReadRawRC(ComIrqReg) & NFC_IRQ_ERR) != 0) {
|
|
break;
|
|
}
|
|
}
|
|
|
|
if (frame_len > 0 && !(frame_len >= 2 && frame[0] == 0x30)) {
|
|
nfc_card_emulation_log_frame("Type 2 session end RX", frame,
|
|
frame_len);
|
|
}
|
|
|
|
nfc_card_emulation_log_status("session complete");
|
|
nfc_card_emulation_start();
|
|
last_command = DP1312EA_AUTOCOLL;
|
|
} else if (command != DP1312EA_AUTOCOLL) {
|
|
nfc_card_emulation_log_status("unexpected command");
|
|
nfc_card_emulation_start();
|
|
last_command = DP1312EA_AUTOCOLL;
|
|
}
|
|
|
|
ql_rtos_task_sleep_ms(1);
|
|
}
|
|
|
|
DP1312EA_WriteRawRC(CommandReg, DP1312EA_IDLE);
|
|
DP1312EA_WriteRawRC(ComIrqReg, 0x7F);
|
|
DP1312EA_SetBitMask(FIFOLevelReg, 0x80);
|
|
printf("NFC TX mode expired, restoring reader mode\r\n");
|
|
}
|
|
|
|
static void nfc_irq_wake(void *args)
|
|
{
|
|
PIN_LEVEL_E level = PIN_LEVEL_LOW;
|
|
|
|
ql_eint_disable_wakeup(DP1312EA_PIN_IRQ);
|
|
ql_gpio_get_level(DP1312EA_PIN_IRQ, &level);
|
|
printf("DP1312EA_PIN_IRQ level:%d\n", level);
|
|
|
|
ql_eint_enable_wakeup(DP1312EA_PIN_IRQ, PIN_RISING_EDGE);
|
|
|
|
if (g_nfc_tx_mode_requested) {
|
|
return;
|
|
}
|
|
|
|
if(g_nfc_irq_trigger==0){
|
|
g_nfc_irq_trigger = 1;
|
|
ql_rtos_semaphore_release(nfc_irq_sem);
|
|
}
|
|
}
|
|
|
|
|
|
static void nfc_reader_prepare(void)
|
|
{
|
|
DP1312EA_Reset();
|
|
Check_Chip();
|
|
g_nfc_state = NFC_STATE_LPCD_WAIT;
|
|
g_poll_fail_count = 0;
|
|
g_nfc_irq_trigger = 0;
|
|
}
|
|
|
|
static void nfc_reader_task_step(void)
|
|
{
|
|
s8 read_status;
|
|
int can_read = 0;
|
|
|
|
if (g_nfc_state == NFC_STATE_LPCD_WAIT) {
|
|
DP1312EA_LPCD_Start();
|
|
printf("NFC enter LPCD mode, waiting for IRQ...\r\n");
|
|
ql_rtos_semaphore_wait(nfc_irq_sem, 0xFFFFFFFF);
|
|
|
|
if (g_nfc_tx_mode_requested) {
|
|
return;
|
|
}
|
|
|
|
DP1312EA_CLEAR_IRQ();
|
|
ql_rtos_task_sleep_ms(10);
|
|
printf("NFC IRQ wake up, switch to polling mode\r\n");
|
|
g_nfc_state = NFC_STATE_POLLING;
|
|
g_poll_fail_count = 0;
|
|
return;
|
|
}
|
|
|
|
if (fota_start == 0 &&
|
|
get_sleep_mode() != 1 &&
|
|
get_mqtt_connect_status() == 1) {
|
|
if ((vad_audio_is_recording() != 1 &&
|
|
audio_packet_type == 0 &&
|
|
tts_playing == 0 &&
|
|
xiaoice_get_play_counter() == 0) ||
|
|
g_testmode == 1) {
|
|
can_read = 1;
|
|
}
|
|
}
|
|
|
|
if (!can_read) {
|
|
ql_rtos_task_sleep_ms(300);
|
|
return;
|
|
}
|
|
|
|
read_status = Test_NTAG213();
|
|
if (read_status == 0) {
|
|
printf("NFC read OK, back to LPCD\r\n");
|
|
g_nfc_state = NFC_STATE_LPCD_WAIT;
|
|
g_poll_fail_count = 0;
|
|
g_nfc_irq_trigger = 0;
|
|
ql_rtos_task_sleep_ms(10);
|
|
return;
|
|
}
|
|
|
|
g_poll_fail_count++;
|
|
printf("NFC read failed, fail_count=%d\r\n", g_poll_fail_count);
|
|
if (g_poll_fail_count >= 3) {
|
|
printf("NFC fail 3 times, card removed, back to LPCD\r\n");
|
|
g_nfc_state = NFC_STATE_LPCD_WAIT;
|
|
g_poll_fail_count = 0;
|
|
g_nfc_irq_trigger = 0;
|
|
ql_rtos_task_sleep_ms(10);
|
|
} else {
|
|
ql_rtos_task_sleep_ms(300);
|
|
}
|
|
}
|
|
|
|
void ql_nfc_task_thread(void *arvg)
|
|
{
|
|
printf("NFC work mode: READER (5 clicks enable Type 2 TX)\r\n");
|
|
|
|
while (1) {
|
|
if (nfc_tx_mode_is_active()) {
|
|
printf("NFC TX mode enabled\r\n");
|
|
DP1312EA_Reset();
|
|
Check_Chip();
|
|
nfc_card_emulation_task();
|
|
nfc_reader_prepare();
|
|
continue;
|
|
}
|
|
|
|
nfc_reader_task_step();
|
|
}
|
|
}
|
|
|
|
|
|
void DP1312EA_Init(void)
|
|
{
|
|
ql_rtos_semaphore_create(&nfc_irq_sem, 0);
|
|
|
|
ql_gpio_init(DP1312EA_PIN_IRQ, PIN_DIRECTION_IN, PIN_PULL_PD, PIN_LEVEL_LOW);
|
|
ql_eint_register(DP1312EA_PIN_IRQ, PIN_RISING_EDGE, PIN_PULL_PD, NULL, nfc_irq_wake);
|
|
ql_eint_enable_wakeup(DP1312EA_PIN_IRQ, PIN_RISING_EDGE);
|
|
|
|
DP1312EA_Reset();
|
|
Check_Chip();
|
|
g_nfc_state = NFC_STATE_LPCD_WAIT;
|
|
g_poll_fail_count = 0;
|
|
|
|
ql_task_t nfcTaskRef = NULL;
|
|
ql_rtos_task_create(&nfcTaskRef, 1024*6, 100, "nfc_Task_Ref", ql_nfc_task_thread, NULL);
|
|
}
|
|
#endif
|
|
|
|
#if 0
|
|
#include <stdio.h>
|
|
#include "ql_rtos.h"
|
|
#include "ql_application.h"
|
|
#include "ql_audio.h"
|
|
#include "ql_iic.h"
|
|
#include "ql_gpio.h"
|
|
#include "app_inc.h"
|
|
#include "ql_fs.h"
|
|
#include "ql_rtos.h"
|
|
|
|
extern int fota_start;
|
|
|
|
static ql_sem_t nfc_irq_sem = NULL;
|
|
|
|
extern int audio_packet_type;
|
|
extern volatile int tts_playing;
|
|
extern int g_testmode;
|
|
|
|
#define DP1312EA_PIN_IRQ GPIO_PIN_NO_87
|
|
|
|
static void nfc_irq_wake(void *args)
|
|
{
|
|
unsigned char level = 0;
|
|
|
|
ql_eint_disable_wakeup(DP1312EA_PIN_IRQ);
|
|
|
|
ql_gpio_get_level(DP1312EA_PIN_IRQ, &level);
|
|
printf("DP1312EA_PIN_IRQ level:%d\n", level);
|
|
|
|
// ql_eint_enable_wakeup(DP1312EA_PIN_IRQ, PIN_RISING_EDGE);
|
|
|
|
ql_rtos_semaphore_release(nfc_irq_sem);
|
|
}
|
|
|
|
|
|
void ql_nfc_task_thread(void *arvg)
|
|
{
|
|
while(1)
|
|
{
|
|
#if 0
|
|
DP1312EA_LPCD_Start();//进入低功耗检卡,并等待中断,开启之后打开对应读卡函数(模拟卡除外)
|
|
|
|
ql_rtos_semaphore_wait(nfc_irq_sem, 0xFFFFFFFF);
|
|
|
|
DP1312EA_CLEAR_IRQ();
|
|
|
|
ql_rtos_task_sleep_ms(30);
|
|
#endif
|
|
|
|
if(fota_start==0&&get_sleep_mode()!=1&&get_mqtt_connect_status()==1){
|
|
//在连上mqtt和后台 且非录音和播音状态下可以支持刷nfc
|
|
if(get_xiaoice_connected_status()==2&&vad_audio_is_recording()!=1 \
|
|
&&audio_packet_type==0&&tts_playing==0&&xiaoice_get_play_counter()==0 \
|
|
|| g_testmode==1 ){
|
|
Test_NTAG213();
|
|
}
|
|
}
|
|
|
|
ql_rtos_task_sleep_ms(2000);
|
|
//ql_eint_enable_wakeup(DP1312EA_PIN_IRQ, PIN_RISING_EDGE);
|
|
}
|
|
}
|
|
|
|
|
|
void DP1312EA_Init(void)
|
|
{
|
|
#if 0
|
|
ql_gpio_init(DP1312EA_PIN_IRQ,PIN_DIRECTION_IN,PIN_PULL_PD,PIN_LEVEL_LOW);
|
|
ql_eint_register(DP1312EA_PIN_IRQ, PIN_RISING_EDGE, PIN_PULL_PD, NULL, nfc_irq_wake);
|
|
ql_eint_enable_wakeup(DP1312EA_PIN_IRQ, PIN_RISING_EDGE);
|
|
#endif
|
|
//I2C初始化
|
|
DP1312EA_Reset();
|
|
Check_Chip();
|
|
|
|
ql_rtos_semaphore_create(&nfc_irq_sem, 0);
|
|
|
|
ql_task_t nfcTaskRef = NULL;
|
|
ql_rtos_task_create(&nfcTaskRef, 1024*6, 100, "nfc_Task_Ref", ql_nfc_task_thread, NULL);
|
|
}
|
|
|
|
#endif
|