• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 Bestechnic (Shanghai) Co., Ltd. All rights reserved.
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 #ifndef __TOUCH_ZTW523_H__
16 #define __TOUCH_ZTW523_H__
17 
18 #include "touch.h"
19 
20 #define TOUCH_POINT_MODE 0
21 #define MAX_SUPPORTED_FINGER_NUM 1
22 #define TPD_RES_MAX_X 454
23 #define TPD_RES_MAX_Y 454
24 
25 #define CHIP_ON_DELAY 200
26 #define CHIP_OFF_DELAY 70
27 #define FIRMWARE_ON_DELAY 150
28 
29 /* chip code */
30 #define ZTW523_CHIP_CODE 0xE628
31 #define ZTW522_CHIP_CODE 0xE532
32 #define ZT7548_CHIP_CODE 0xE548
33 #define ZT7538_CHIP_CODE 0xE538
34 #define ZT7554_CHIP_CODE 0xE700
35 
36 /* Register Map */
37 #define ZINITIX_SWRESET_CMD 0x0000
38 #define ZINITIX_WAKEUP_CMD 0x0001
39 #define ZINITIX_IDLE_CMD 0x0004
40 #define ZINITIX_SLEEP_CMD 0x0005
41 #define ZINITIX_CLEAR_INT_STATUS_CMD 0x0003
42 #define ZINITIX_CALIBRATE_CMD 0x0006
43 #define ZINITIX_SAVE_STATUS_CMD 0x0007
44 #define ZINITIX_SAVE_CALIBRATION_CMD 0x0008
45 #define ZINITIX_RECALL_FACTORY_CMD 0x000f
46 #define ZINITIX_VENDOR_CMD 0xC000
47 #define ZINITIX_INTN_CLEAR_CMD 0xC004
48 #define ZINITIX_NVM_INIT_CMD 0xC002
49 #define ZINITIX_PROGRAM_START_CMD 0xC001
50 #define ZINITIX_NVM_VPP 0xC003
51 #define ZINITIX_NVM_WP 0xC104
52 
53 #define ZINITIX_INIT_RETRY_CNT 3
54 #define TOUCH_CHECK_SHORT_MODE 14
55 #define TOUCH_SEC_MODE 48
56 #define TOUCH_REF_MODE 10
57 #define TOUCH_NORMAL_MODE 5
58 #define TOUCH_DELTA_MODE 3
59 #define TOUCH_DND_MODE 6
60 #define TOUCH_PDND_MODE 11
61 #define NORMAL_SHORT_VALUE 1000
62 
63 #define ZINITIX_SENSITIVITY 0x0020
64 #define ZINITIX_I2C_CHECKSUM_WCNT 0x016a
65 #define ZINITIX_I2C_CHECKSUM_RESULT 0x016c
66 #define ZINITIX_DEBUG_REG 0x0115
67 #define ZINITIX_TOUCH_MODE 0x0010
68 #define ZINITIX_CHIP_REVISION 0x0011
69 #define ZINITIX_FIRMWARE_VERSION 0x0012
70 #define ZINITIX_MINOR_FW_VERSION 0x0121
71 #define ZINITIX_DATA_VERSION_REG 0x0013
72 #define ZINITIX_HW_ID 0x0014
73 #define ZINITIX_SUPPORTED_FINGER_NUM 0x0015
74 #define ZINITIX_EEPROM_INFO 0x0018
75 #define ZINITIX_INITIAL_TOUCH_MODE 0x0019
76 #define ZINITIX_TOTAL_NUMBER_OF_X 0x0060
77 #define ZINITIX_TOTAL_NUMBER_OF_Y 0x0061
78 #define ZINITIX_DELAY_RAW_FOR_HOST 0x007f
79 #define ZINITIX_BUTTON_SUPPORTED_NUM 0x00B0
80 #define ZINITIX_BUTTON_SENSITIVITY 0x00B2
81 #define ZINITIX_X_RESOLUTION 0x00C0
82 #define ZINITIX_Y_RESOLUTION 0x00C1
83 #define ZINITIX_POINT_STATUS_REG 0x0080
84 #define ZINITIX_ICON_STATUS_REG 0x00AA
85 #define ZINITIX_AFE_FREQUENCY 0x0100
86 #define ZINITIX_DND_N_COUNT 0x0122
87 #define ZINITIX_DND_U_COUNT 0x0135
88 #define ZINITIX_RAWDATA_REG 0x0200
89 #define ZINITIX_EEPROM_INFO_REG 0x0018
90 #define ZINITIX_INT_ENABLE_FLAG 0x00f0
91 #define ZINITIX_PERIODICAL_INTERRUPT_INTERVAL 0x00f1
92 #define ZINITIX_CHECKSUM_RESULT 0x012c
93 #define ZINITIX_INIT_FLASH 0x01d0
94 #define ZINITIX_WRITE_FLASH 0x01d1
95 #define ZINITIX_READ_FLASH 0x01d2
96 #define ZINITIX_VENDOR_REG 0xC000
97 #define ZINITIX_NVM_REG 0xC002
98 #define ZINITIX_CHIP_ID_REG 0xCC00
99 
100 #define BIT_PT_CNT_CHANGE 0
101 #define BIT_DOWN 1
102 #define BIT_MOVE 2
103 #define BIT_UP 3
104 #define BIT_PALM 4
105 #define BIT_PALM_REJECT 5
106 #define BIT_WAKEUP 6
107 #define RESERVED_1 7
108 #define BIT_WEIGHT_CHANGE 8
109 #define BIT_PT_NO_CHANGE 9
110 #define BIT_REJECT 10
111 #define BIT_PT_EXIST 11
112 #define RESERVED_2 12
113 #define BIT_MUST_ZERO 13
114 #define BIT_DEBUG 14
115 #define BIT_ICON_EVENT 15
116 
117 #define SUB_BIT_EXIST 0
118 #define SUB_BIT_DOWN 1
119 #define SUB_BIT_MOVE 2
120 #define SUB_BIT_UP 3
121 #define SUB_BIT_UPDATE 4
122 #define SUB_BIT_WAIT 5
123 
124 /* preriod raw data interval */
125 #define zinitix_bit_set(val, n) ((val) &= ~(1 << (n)), (val) |= (1 << (n)))
126 #define zinitix_bit_clr(val, n) ((val) &= ~(1 << (n)))
127 #define zinitix_bit_test(val, n) ((val) & (1 << (n)))
128 #define zinitix_swap_v(a, b, t) ((t) = (a), (a) = (b), (b) = (t))
129 #define zinitix_swap_16(s) (((((s)&0xff) << 8) | (((s) >> 8) & 0xff)))
130 
131 #endif
132