
Rev. 1.00
549 of 576
January 28, 2022
32-Bit Arm
®
Cortex
®
-M0+ MCU
HT32F54231/HT32F54241/HT32F54243/HT32F54253
28 T
ouch Key
28 T
ouch Key
When the time slot counter in all the touch key modules or in the touch key module 0 overflows, an
actual touch key TKRCOV interrupt will take place. The touch keys mentioned here are the keys
which are enabled.
Auto Scan Mode
The auto scan mode can minimise the load of the application program and improve the touch key
scan operation performance. When the TKMOD[1:0] bits are set to b00, the auto scan mode is
selected to scan the module keys in a specific sequence determined by the MnSKm[1:0] bits in the
TKMnKCFGR register. Each Touch key has its own corresponding reference oscillator capacitance,
its capacitance is set by TKMnKmCPR register.
In the auto scan mode the module n key oscillator and reference oscillator which are required to
be used will be enabled by hardware automatically when the TKST bit is set from low to high and
disabled automatically when the TKBUSY bit changes from high to low. When the TKST bit is set
from low to high in the auto scan mode, the internal capacitor value of the reference oscillator for
the selected key to be scanned in the time slot 0 will first be set by TKMnKmCPR register. Then
the 16-bit C/F counter value will be written into the corresponding register TKMnKmCNTR.
After this, the selected key will start to be scanned in time slot 0. At the end of the time slot 0 key
scan operation, the reference oscillator internal capacitor value for the next selected key will be set
by the next TKMnKmCPR register. Then the 16-bit C/F counter value of the current scanned key
will be written into the TKMnKmCNTR register. The whole auto scan operation will sequentially
be carried out in the above specific way from time slot 0 to time slot 3. At the end of the time slot 3
key scan operation, the reference oscillator internal capacitor value for the time slot 0 selected key
will again be read from the MnKmCPR register. Then the 16-bit C/F counter value will be written
into the relevant location of the time slot 3 scanned key in the TKMnKmCNTR register. After
all the selected keys are scanned, the TKRCOV bit will be set high and the TKBUSY bit will be
cleared to zero as well as an auto scan mode operation is completed.
Periodic Auto Scan Mode
In addition to those actions mentioned in the auto scan mode, the periodic auto scan mode provides
periodic auto scan and C/F counter upper/lower threshold comparison functions. When the
TKMOD[1:0] bit field are set to 10 or 11, the periodic auto scan mode is selected to scan the module
keys automatically and periodically. Note that this mode can be used in the Deep sleep modes, in
order to monitor the touch key state and minimise power consumption.
In the periodic auto scan mode the touch key scan operation will be implemented automatically
on a periodic basis, which can be determined by the ASMP[1:0] bit field in the TKCR register.
The number of touch key scan times depends upon the Periodic auto scan mode time-out period,
T
ASMTO
, and the periodic auto scan mode period, T
KEY
. Each auto scan operation will sequentially be
carried out in a specific way from time slot 0 to time slot 3 like the auto scan mode. The reference
oscillator internal capacitor value for each time slot selected key will be set by the TKMnKmCPR
register. However, only at the end of the last scan operation in the Periodic auto scan mode time-
out cycle, the 16-bit C/F counter value for all scanned keys will be written into the corresponding
TKMnKmCNTR register.
In addition, the 16 bit upper/lower threshold value for the selected key to be scanned in the time
slot 0 will be set by the TKMnKmTHR register before the selected key will start to be scanned
in time slot 0. Each touch key has its own independent upper/lower threshold comparator. The
upper/lower threshold comparison function will automatically be enabled in the periodic auto scan