MAX1233/MAX1234觸摸屏控制器入門
I C 0 3
I 0 0
I R 0
T W GC 0000
(C4,C3,C2,C1) x (R4,R3,R2,R1);
GPIO outputs: none;
GPIO inputs: none
0x004f 0x0000
T W KC bf00
maximum debounce and hold times
0x0041 0xbf00
I R 0
T R KB
0x8004 0x0000
I R 0
T R KB
0x8004 0x0000
I R 0
T R KB
0x8004 0x0000
4.4) 從鍵盤中屏蔽單個按鍵
使用鍵盤屏蔽寄存器和鍵盤2結果寄存器來屏蔽每個按鍵。屏蔽掉的按鍵被掃描至KPD寄存器,但是不在鍵盤2結果寄存器中報告。表17. 按鍵命令序列:屏蔽單個按鍵
DEMO1234 Command | Action | SPI data in | Verification |
T W GC 0000 | Keypad: (C4,C3,C2,C1) x (R4,R3,R2,R1); GPIO outputs: none; GPIO inputs: none | 0x004f 0x0000 | |
T W KC bf00 | Wait for keypress; maximum debounce and hold times | 0x0041 0xbf00 | |
T W KM 0020 | Mask only R2C2 key | 0x0050 0x0020 | |
Press and release R1C1 (key "1") | |||
T R KB | Read raw keypad result | 0x8004 0x0000 | 0x0001 = R1C1 key |
T R K2 | Read masked keypad result | 0x8011 0x0000 | 0x0001 = R1C1 key |
Press and release R2C2 (key "5") | |||
T R KB | Read raw keypad result | 0x8004 0x0000 | 0x0020 = R2C2 key |
T R K2 | Read masked keypad result | 0x8011 0x0000 | 0x0000 = no key |
Press and release R3C2 (key "8") | |||
T R KB | Read raw keypad result | 0x8004 0x0000 | 0x0040 = R3C2 key |
T R K2 | Read masked keypad result | 0x8011 0x0000 | 0x0040 = R3C2 key |
4.5) 從鍵盤中屏蔽一列
使用鍵盤列寄存器來屏蔽所有列。不掃描屏蔽列,因此,KPD寄存器不會探測這些列中的按鍵。表18. 按鍵命令序列:屏蔽鍵盤的一列
DEMO1234 Command | Action | SPI data in | Verification |
T W GC 0000 | Keypad: (C4,C3,C2,C1) x (R4,R3,R2,R1); GPIO outputs: none; GPIO inputs: none | 0x004f 0x0000 | |
T W KC bf00 | Wait for keypress; maximum debounce and hold times | 0x0041 0xbf00 | |
T W KK 2000 | Mask entire C2 column | 0x0051 0x2000 | |
Press and release R1C1 (key "1") | |||
T R KB | Read raw keypad result | 0x8004 0x0000 | 0x0001 = R1C1 key |
Press and release R2C2 (key "5") | |||
T R KB | Read raw keypad result | 0x8004 0x0000 | (previous value) |
Press and release R3C2 (key "8") | |||
T R KB | Read raw keypad result | 0x8004 0x0000 | (previous value) |
Press and release R2C3 (key "6") | |||
T R KB | Read raw keypad result | 0x8004 0x0000 | 0x0200 = R2C3 key |
5) 電源管理
表19. 關斷命令DEMO1234 Command | Action | SPI data in | Verification |
T W AC C000 | Power off ADC | 0x0040 0xc000 | — |
T W AC 0300 | Power off internal reference | 0x0040 0x0300 | REF = not driven |
T W DC 8000 | Disable DAC | 0x0042 0x8000 | DACOUT = 0.0V |
T W KC C000 | Power off keypad | 0x0041 0xc000 | — |
6) 菜單系統(tǒng)
全部源代碼實現(xiàn)下面的控制臺菜單系統(tǒng),它連接至MINIQUSB+模塊。CmodComm測試程序主菜單—在連接前
A) adjust timing parameters
L) CmodLog... functions
C) connect
D) Debug Messages
X) exit
對C (連接)命令的響應
C
Hardware supports optimized native SMBus commands.
Board connected.
Got board banner: Maxim MINIQUSB V01.05.41 >
Firmware version is OK.
(configured for SPI auto-CS 4-byte mode) (SCLK=2MHz) ...
主菜單—連接后有效
T) Test the device
8) CmodP8Bus... functions
A) adjust timing parameters
L) CmodLog... functions
P) CmodPin... functions
S) CmodSpi... functions
M) CmodSMBus... functions
$) CmodCommStringWrite list of hex codes
R) CmodBoardReset
D) Disconnect
測試菜單命令—連接后有效
R) Read register
W) Write register
M0) measure no measurement; configure reference
M1) measure X,Y
M2) measure X,Y,Z1,Z2
M3) measure X
M4) measure Y
M5) measure Z1,Z2
M6) measure BAT1/4
M7) measure BAT2/4
M8) measure AUX1
M9) measure AUX2
MA) measure TEMP1
MB) measure BAT1/4,BAT2/4,AUX1,AUX2,TEMP1,TEMP2
MC) measure TEMP1,TEMP2
MD) no measurement; drive Y+,Y-
ME) no measurement; drive X+,X-
MF) no measurement; drive Y+,X-
.) Exit this menu
6.1) 寄存器讀/寫命令
表20. 讀取寄存器助記符DEMO1234 Command | Mnemonic | SPI data in |
T R A1 | Test Read AUX1 register | 0x8007 0x0000 |
T R A2 | Test Read AUX2 register | 0x8008 0x0000 |
T R AC | Test Read ADC_control register | 0x8040 0x0000 |
T R AX | Test Read X register | 0x8000 0x0000 |
T R AY | Test Read Y register | 0x8001 0x0000 |
T R AZ1 | Test Read Z1 register | 0x8002 0x0000 |
T R AZ2 | Test Read Z2 register | 0x8003 0x0000 |
T R B1 | Test Read BAT1 register | 0x8005 0x0000 相關推薦技術專區(qū) |
評論