1 /* 2 * Copyright (c) 2022 HiSilicon (Shanghai) Technologies CO., LIMITED. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef APP_DEMO_CONFIG_H 17 #define APP_DEMO_CONFIG_H 18 19 #include <hi_i2c.h> 20 21 #define CHECK 22 #define NFC_I2C_REG_ARRAY_LEN (32) 23 #define NFC_SEND_BUFF (3) 24 #define C08I_NFC_DEMO_TASK_STAK_SIZE (1024*10) 25 #define NFC_DISPLAY_TASK_STAK_SIZE (1024) 26 #define C08I_NFC_DEMO_TASK_PRIORITY (25) 27 #define C08I_NFC_TASK_PRIORITY (26) 28 #define NFC_TAG_WECHAT 29 #define CLEAN_STOP_SIGNAL (hi_u8(0x00)) 30 31 #define CLA (1) 32 #define INS (2) 33 #define P1 (3) 34 #define P2 (4) 35 #define LC (5) 36 #define DATA (6) 37 38 #define C081_NFC_ADDR 0xAE // 7 bit slave device address 1010 111 0/1 39 #define I2C_WR 0x00 40 #define I2C_RD 0x01 41 #define C081_NFC_READ_ADDR 0xAF 42 #define C081NFC_WRITE_ADDR (C081_NFC_ADDR|I2C_WR) 43 #define C081NFC_READ_ADDR (C081_NFC_ADDR|I2C_RD) 44 #define FM11_E2_USER_ADDR 0x0010 45 #define FM11_E2_MANUF_ADDR 0x03FF 46 #define FM11_E2_BLOCK_SIZE 16 47 48 #define FM327_FIFO 0xFFF0 49 #define FIFO_FLUSH_REG 0xFFF1 50 #define FIFO_WORDCNT_REG 0xFFF2 51 #define RF_STATUS_REG 0xFFF3 52 #define RF_TXEN_REG 0xFFF4 53 #define RF_BAUD_REG 0xFFF5 54 #define RF_RATS_REG 0xFFF6 55 #define MAIN_IRQ_REG 0xFFF7 56 #define FIFO_IRQ_REG 0xFFF8 57 #define AUX_IRQ_REG 0xFFF9 58 #define MAIN_IRQ_MASK_REG 0xFFFA 59 #define FIFO_IRQ_MASK_REG 0xFFFB 60 #define AUX_IRQ_MASK_REG 0xFFFC 61 #define NFC_CFG_REG 0xFFFD 62 #define VOUT_CFG_REG 0xFFFE 63 #define EE_WR_CTRL_REG 0xFFFF 64 65 #define MAIN_IRQ 0xFFF7 66 #define FIFO_IRQ 0xFFF8 67 #define AUX_IRQ 0xFFF9 68 #define MAIN_IRQ_MASK 0xFFFA 69 #define FIFO_IRQ_MASK 0xFFFB 70 #define AUX_IRQ_MASK 0xFFFC 71 #define FIFO_FLUSH 0xFFF1 72 #define FIFO_WORDCNT 0xFFF2 73 74 #define MAIN_IRQ_RF_PWON 0x80 75 #define MAIN_IRQ_ACTIVE 0x40 76 #define MAIN_IRQ_RX_START 0x20 77 #define MAIN_IRQ_RX_DONE 0x10 78 #define MAIN_IRQ_TX_DONE 0x08 79 #define MAIN_IRQ_ARBIT 0x04 80 #define MAIN_IRQ_FIFO 0x02 81 #define MAIN_IRQ_AUX 0x01 82 #define FIFO_IRQ_WL 0x08 83 84 typedef enum { 85 NONE, 86 CC_FILE, 87 NDEF_FILE 88 } T4T_FILE; 89 90 typedef enum { 91 NFC_RECOVERY = 0, 92 NFC_CLEAN 93 } NFCCleanStopSignal; 94 95 #define SEND_OLED_FILL_SCRRENC_CMD ((unsigned char)0x0) 96 #define SEND_CMD_LEN (8) 97 98 #define OLED_X_POSITION_0 (0) 99 #define OLED_X_POSITION_15 (15) 100 #define OLED_X_POSITION_16 (16) 101 #define OLED_X_POSITION_18 (18) 102 #define OLED_X_POSITION_40 (40) 103 #define OLED_X_POSITION_48 (48) 104 #define OLED_X_POSITION_56 (56) 105 #define OLED_X_POSITION_60 (60) 106 #define OLED_X_POSITION_81 (81) 107 #define OLED_X_POSITION_120 (120) 108 109 #define OLED_Y_POSITION_0 ((unsigned char)0x0) 110 #define OLED_Y_POSITION_1 ((unsigned char)0x1) 111 #define OLED_Y_POSITION_2 ((unsigned char)0x2) 112 #define OLED_Y_POSITION_3 ((unsigned char)0x3) 113 #define OLED_Y_POSITION_4 ((unsigned char)0x4) 114 #define OLED_Y_POSITION_5 ((unsigned char)0x5) 115 #define OLED_Y_POSITION_6 ((unsigned char)0x6) 116 #define OLED_Y_POSITION_7 ((unsigned char)0x7) 117 118 #define OLED_DISPLAY_STRING_TYPE_1 (1) 119 #define OLED_DISPLAY_STRING_TYPE_16 (16) 120 121 void SetNdefData(void); 122 unsigned char GetNdefData(unsigned char *ndefFileData, unsigned int ndefLen); 123 void NfcRead(void); 124 hi_void OledNfcDisplay(hi_void); 125 #endif 126