Touch key based digital processing system and chip
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- AMICRO SEMICONDUCTOR CO LTD
- Filing Date
- 2022-06-24
- Publication Date
- 2026-08-07
AI Technical Summary
[0003]目前,有的触摸按键设计架构包括模拟电路部分,则该模拟电路部分直接将按键判断结果(二进制信号)输出;有的触摸按键的设计架构包括模拟电路部分和数字逻辑模块,往往模拟电路部分的设计方式决定数字逻辑模块的功能,其中,模拟电路部分直接将采样电容值或电容的充电时间数值传输给数字逻辑模块,由数字逻辑模块做触摸按键的检测,但是,数字逻辑模块的内部电路在采样和检测模拟电路部分的多个按键通道所传输的信息的过程中,往往会出现计数时序资源协调混乱的问题,并会影响相关电路模块或管脚的分配调度,不能灵活地将触摸按键设计架构套用于各种算法场景下
[0018]相对于现有技术,本发明公开的数字处理系统通过时序逻辑电路(组织成状态机调度的方式)依次对每个触摸按键的实时电容值重复多次采样,并在寄存器配置单元的配置下以同一个触摸按键的一定采样次数为标准建立起一轮按键消抖操作,以满足按键消抖所需的采样次数,克服单次采样值容易出现误差的问题,提高按键触摸判定的准确性。
Smart Images

Figure CN115001474B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the technical field of touch button detection, and particularly relates to a digital processing system and chip for a group of touch buttons under multiple working state scheduling. Background Technology
[0002] Typical touch button layouts are mostly N*M matrix arrangements. The internal design mainly includes modules for matrix button scanning, processing, and encoding. Each module is implemented in different ways, such as row and column scanning, state machine scanning, delay debouncing, state machine debouncing, register debouncing, RS flip-flop debouncing, RC filtering, median filtering, BCD encoding, and so on. Different arrangements and combinations constitute different design architectures for the digital portion of the touch buttons. Debouncing for each touch button is equivalent to debounce, including eliminating level jitter.
[0003] Currently, some touch button design architectures include analog circuitry, which directly outputs the button judgment result (binary signal). Other touch button design architectures include analog circuitry and digital logic modules. Often, the design of the analog circuitry determines the function of the digital logic module. In this case, the analog circuitry directly transmits the sampled capacitor value or the capacitor charging time value to the digital logic module, which then performs touch button detection. However, during the sampling and detection of information transmitted from multiple button channels in the analog circuitry, the internal circuitry of the digital logic module often experiences problems with the coordination of counting timing resources. This can affect the allocation and scheduling of related circuit modules or pins, making it difficult to flexibly apply the touch button design architecture to various algorithm scenarios. Summary of the Invention
[0004] To overcome the aforementioned technical deficiencies, this invention revolves around the working state transitions of a large state machine, sampling the capacitance value inside the same touch button multiple times, and performing multiple touch judgments and confirmations based on the sampling to achieve button debouncing. It also provides the real-time sampled capacitance discharge information inside a single touch button to the software for processing, and can reuse related ports after sampling of all touch buttons is complete. The specific technical solution is as follows:
[0005] A digital processing system based on touch buttons is electrically connected to a capacitance sampling circuit. The capacitance sampling circuit includes multiple sampling branches connected to a group of touch buttons, each configured to be electrically connected to the capacitor inside a touch button. The digital processing system includes a clock source, a register configuration unit, and a sampling control unit. The sampling control unit is a sequential logic circuit within the digital logic circuitry. Driven by a clock signal provided by the clock source, the sampling control unit repeatedly samples the capacitance value of each touch button within the group of touch buttons, and then controls the multiple capacitance values of the same touch button to perform a round of button debouncing. The number of times the capacitance value of each touch button is sampled in a round of button debouncing is configured by the register configuration unit. The data cached within the register configuration unit can be externally refreshed.
[0006] Furthermore, the digital processing system also includes an averaging filter unit; the sampling control unit is used to perform a preset number of pre-debouncing operations on each touch button, and marks a pre-debouncing operation performed on a touch button for a preset number of times as one round of debouncing operation; in each pre-debouncing operation, the sampling control unit samples the capacitance value of a touch button a first preset number of times to poll and scan the touch button; the averaging filter unit is used to calculate the average value of the capacitance values of the same touch button sampled in each pre-debouncing operation, and determine whether the touch button is in a state of coarse touch or in a state of no touch; in each round of debouncing operation, if the averaging filter unit... If the sampling control unit determines that the same touch button is in a coarse touch state in the preset number of button touch pre-debouncing operations, then it determines that the touch button has been touched, thereby achieving the effect of button debouncing. The preset number of judgments is equal to the difference between the preset debouncing quantity and the value 1. The sampling control unit includes a debouncing count counter, which counts the number of times button touch pre-debouncing is executed in each round of button debouncing operation. Both the first preset quantity and the preset debouncing quantity are configured by the register configuration unit. Each round of button debouncing operation involves a preset number of button touch pre-debouncing operations, ensuring that the number of times the capacitance sampling value of each touch button is sampled in one round of button debouncing operation is equal to the product of the preset debouncing quantity and the first preset quantity.
[0007] Furthermore, the sampling control unit includes a sampling delay counter. The sampling control unit configures the working state between two adjacent key touch pre-debouncing operations, or between two adjacent single sampling working states, as a low-power delay working state. The sampling delay counter is used to time the duration of the sampling control unit in the low-power delay working state. The duration of the low-power delay working state is determined by the count value of the clock signal provided to the sampling control unit by the clock source by the sampling delay counter. In the low-power delay working state, the sampling control unit controls the frequency of the clock signal provided by the clock source to decrease, thereby extending the sampling delay. The counting period of the time counter is increased, thereby increasing the time interval between two adjacent key touch pre-debouncing operations or between two adjacent single sampling working states; wherein, the sampling control unit includes a state machine composed of timing logic circuits; a sampling process of the capacitance sampling value of a touch key is configured as a working state by the state machine and recorded as a single sampling working state, and the sampling control unit transmits the capacitance sampling value of the touch key sampled in each single sampling working state to the register configuration unit for external reading; wherein, relative to the single sampling working state, the low-power delay working state is configured as another working state by the state machine.
[0008] Furthermore, after all the touch buttons in the group of touch buttons have completed one round of key debouncing, the sampling control unit determines that sampling of the group of touch buttons is finished. The state machine jumps to the function multiplexing working state, configures the port in the digital processing system used to connect to the capacitance sampling circuit to transmit a signal different from the signal transmitted during the one round of key debouncing, and multiplexes it to perform functions other than sampling the capacitance sampling value of the touch buttons. This continues until the functions other than sampling the capacitance sampling value of the touch buttons are completed. When the time the state machine is in the function multiplexing working state is the preset delay debouncing time, the state machine jumps from the function multiplexing working state to the single sampling working state to start sampling the capacitance of each touch button in a new group of touch buttons. The sampling value is sampled; the sampling control unit includes a debounce delay counter. After the execution of the functions other than sampling the capacitance sampling value of the touch button is completed, and the debounce delay counter reaches the preset delay debounce time, the sampling control unit configures the aforementioned port to transmit the signal transmitted during the first round of button debounce operation, and reuses it to sample the capacitance sampling value of the touch button in the single sampling working state. The electronic components connected to the aforementioned port in the function multiplexing working state remain unchanged. The preset delay debounce time is configured by the register configuration unit. When the state machine jumps to the function multiplexing working state, the attribute of the port in the digital processing system used to connect to the capacitance sampling circuit supports changing from input to output or from output to input.
[0009] Furthermore, each sampling branch of the capacitor sampling circuit is configured to share a charging time counter, or each sampling branch of the capacitor sampling circuit is configured with its own charging time counter; whenever the sampling control unit enters the single sampling working state, the charge discharged by the capacitor inside a touch button charges the capacitor inside the corresponding sampling branch; the sampling control unit is used to control the charging time counter to count the charging time of the capacitor inside the corresponding sampling branch under the driving action of the clock signal provided by the clock source; whenever the capacitor inside the touch button completes its discharge, the count value of the charging time counter is saved and configured... The capacitance sample value of the touch button in one sampling is set to identify the change in the discharge amount of the capacitor inside the touch button, and then the capacitance sample value is transmitted to the average filtering unit; whenever the number of times the sampling control unit continuously enters the single sampling working state reaches the first preset number, it is determined that the touch button has completed one key touch pre-debouncing and enters the low power delay working state, and the charging time counter is controlled to keep its count value unchanged; when the sampling control unit jumps from the low power delay working state back to the single sampling working state, the charging time counter is controlled to continue counting to continue counting the charging time of the capacitor inside the corresponding sampling branch.
[0010] Furthermore, each sampling branch of the capacitor sampling circuit is an RC oscillation circuit; all sampling branches share a discharge feedback port, which is used to output a first valid level when the capacitor inside the currently sampled touch button has completed discharging, and to trigger the charging time counter to pause counting when the discharge feedback port outputs the first valid level; the discharge feedback port is also used to output a second valid level when the capacitor inside the currently sampled touch button has not completed discharging; whenever the discharge feedback port outputs the first valid level, the sampling control unit feeds back a flag signal to the clock source, causing the clock source to drive the capacitor inside the touch button to charge, so as to charge the capacitor inside the RC oscillation circuit in the subsequent single sampling working state.
[0011] Furthermore, under the scheduling of the sampling control unit, after all the touch buttons in the group of touch buttons have completed one round of button debouncing operation, the system enters the function multiplexing working state. Then, the input port in the digital processing system used to receive feedback signals or capacitance sampling values is multiplexed as an output port to send control signals to the LEDs to adjust their brightness. The port in the digital processing system used to select touch buttons is also multiplexed to select one of the LEDs in the LED array, so that the brightness of the selected LED is adjusted by the input port in the digital processing system used to receive the feedback signals or capacitance sampling values. The feedback signal is a signal that reflects the discharge status of the capacitor inside the touch button, and the... The feedback signal originates from an output port of a sampling branch electrically connected to a capacitor inside the touch button. This feedback signal represents the charging voltage signal of the capacitor in the sampling branch electrically connected to the capacitor inside the touch button. One output port of the sampling branch electrically connected to the capacitor inside the touch button is configured as a discharge feedback port. Output ports of corresponding sampling branches electrically connected to capacitors inside other touch buttons in the same group are all connected to this discharge feedback port, allowing all sampling branches within the capacitor sampling circuit to share this discharge feedback port. The sampling branch includes a capacitor. One output port of the sampling branch electrically connected to the capacitor inside the touch button is an input port for an LED.
[0012] Further, the averaging filter unit is used to, from all capacitance sample values of the same touch button sampled by the sampling control unit in each key touch pre-debouncing, remove the maximum and minimum capacitance sample values, and then calculate the average value of the remaining capacitance sample values to obtain the average capacitance sample value of the touch button; when the averaging filter unit detects that the average capacitance sample value of the touch button is less than or equal to the reference capacitance value of the touch button, it determines that the touch button is in an untouched state; when the averaging filter unit detects that the average capacitance sample value of the touch button is greater than the reference capacitance value of the touch button... When the value is reached, the touch button is determined to be in a coarse touch state. In each round of button debouncing operation, the average filtering unit is used to determine whether the same touch button is in a coarse touch state in each preset number of button pre-debouncing operations. If so, the touch button is determined to be in a valid touch state, and thus the touch button is determined to be touched. Otherwise, the touch button is determined to be in a valid release state, and the touch button is determined not to be touched. The sampling control unit is also used to transmit the average capacitance sampling value of the touch button calculated by the average filtering unit to the register configuration unit in each round of button debouncing operation for external reading.
[0013] Further, the average filtering unit includes a reference value processing unit and a reference capacitance value register. The reference value processing unit is configured to update the average sampled value output by the average filtering unit to the reference capacitance value stored in the reference capacitance value register and configure it as the reference capacitance value of the touch button whenever the touch button pre-debouncing is performed once. The reference value processing unit is also configured to keep the reference capacitance value stored in the reference capacitance value register unchanged whenever the touch button pre-debouncing is performed once the touch button is touched and the average filtering unit determines that the touch button has been touched. Each reference capacitance value register is connected to a corresponding sampling branch in the capacitance sampling circuit, and each reference capacitance value register is matched with a corresponding touch button.
[0014] Further, the sampling control unit includes a key scan counter and a key count counter; the key scan counter is used to drive the sampling control unit to sample the capacitance value of a touch button in a discharging state within a group of touch buttons; wherein, the touch button in a discharging state is the touch button sampled when the discharge feedback port outputs a first valid level; when the capacitance of the touch button completes discharge, the sampling control unit samples the capacitance value of the touch button and transmits the capacitance value to the averaging filter unit, and controls the key scan counter to count once, while determining that one sampling of the capacitance value of the touch button is completed within the single sampling operation state; whenever the change value of the key scan counter reaches the first preset number, it is determined that the sampling control unit has completed one key touch pre-debouncing of the capacitance value of the touch button, and then triggers the control of the number of debouncing operations. After the low-power delay period, the counter counts once, and the sampling control unit starts sampling the capacitance value of one of the same touch buttons in the same group that is in a discharging state. Whenever the change value of the debouncing count counter reaches the preset debouncing number, it is determined that one round of key debouncing operation for that touch button is completed. The key count counter counts once to switch to another touch button in the same group, and the sampling control unit is driven to sample the capacitance value of the other touch button in the discharging state. This continues until the change value of the key count counter reaches the second preset number, at which point the sampling control unit is determined to have completed one round of key debouncing operation for all touch buttons in the same group, and the sampling control unit ends sampling of the group of touch buttons. The number of all touch buttons in the same group is equal to the second preset number.
[0015] Furthermore, if the change in the key scan counter reaches the first preset number, the change in the debouncing count counter reaches the preset debouncing number, and the change in the key count counter reaches the second preset number, then the following situations exist: when the state machine is not in a low-power delay operating state and the discharge feedback port outputs a first valid level, it is determined that the sampling control unit has completed one round of key debouncing operation on the capacitance sampling values of all touch keys in the same group of touch keys, and the sampling control unit ends the sampling of the group of touch keys; ... When the feed port outputs a second valid level and the state machine is in the function multiplexing working state, it is determined that the sampling control unit has completed one round of key debouncing operation on the capacitance sampling values of all touch keys in the same group of touch keys. The sampling control unit ends the sampling of the capacitance sampling values of each touch key in the same group of touch keys. The time from the first sampled touch key in the same group of touch keys entering the single sampling working state to the last sampled touch key in the same group undergoing the last key touch pre-debouncing reaches a preset total sampling time threshold. The preset total sampling time threshold is configured by the register configuration unit.
[0016] Furthermore, for a currently sampled touch button, under the conditions that the state machine is not in a low-power delay operating state and the discharge feedback port outputs a second valid level, or under the conditions that the sampling control unit is in a low-power delay operating state for a period of time equal to the reference time interval and the discharge feedback port outputs a second valid level, the following situations exist: when the change value of the button scan counter does not reach the first preset number, the change value of the button quantity counter does not reach the second preset number, and the change value of the debouncing count counter does not reach the preset debouncing number, the state machine jumps to the single sampling operating state, simultaneously triggering the button scan counter to count once, and maintaining the count values of the button quantity counter and the debouncing count counter unchanged; the count value of the button scan counter... When the change value of the key scan counter reaches the first preset number, and the change value of the key count counter does not reach the second preset number, and the change value of the debouncing count counter does not reach the preset debouncing number, the state machine jumps to the single sampling working state, simultaneously triggering the key scan counter to count once, and triggering the debouncing count counter to count once, while maintaining the key count counter's count value unchanged; when the change value of the key scan counter reaches the first preset number, and the change value of the key count counter does not reach the second preset number, and the change value of the debouncing count counter reaches the preset debouncing number, the state machine jumps to the single sampling working state, simultaneously triggering the key count counter to count once, and triggering the debouncing count counter to count once.
[0017] A chip that includes the digital processing system.
[0018] Compared to existing technologies, the digital processing system disclosed in this invention uses sequential logic circuits (organized into a state machine scheduling method) to repeatedly sample the real-time capacitance value of each touch button multiple times. Under the configuration of the register configuration unit, a round of button debouncing operation is established based on a certain number of samplings of the same touch button to meet the sampling number required for button debouncing, overcome the problem that single sampling values are prone to errors, and improve the accuracy of button touch judgment.
[0019] The present invention also performs multiple pre-debouncing operations on key touches in a single round of key debouncing, and combines the results of the determination of the touch state of the touch key in the multiple pre-debouncing operations to determine the final touch state of the same key touch. This overcomes the influence of noise signals introduced by touch key bounce or capacitive sampling circuit, prevents misjudgment caused by touch key bounce, and ensures the accuracy and stability of the sampling and detection results of the digital processing system.
[0020] The present invention also sets a delay time period in both the low-power delay working state and the function multiplexing working state. In the low-power delay working state, the capacitor reference value can be updated. In the function multiplexing working state, delay debouncing is performed before port switching to overcome the jitter caused by port switching, thereby ensuring that the sampling control unit jumps to the corresponding working state in sequence to control the accuracy of the working state scheduling.
[0021] In this invention, the number of times key touch pre-debouncing is executed in a round of key debouncing operation is also configured by the register configuration unit. The data cached inside the register configuration unit can be refreshed externally, so the associated sampling number and the number of key touch pre-debouncing executions in its internal cache are configurable, which makes it highly adaptable to the application environment of the digital processing system.
[0022] In this invention, the real-time capacitance value of each touch button is obtained by counting using a capacitor charging counter inside the digital processing system and recorded as a capacitance sampling value. This value can be sent to the software system or hardware module for reading through the register configuration unit. After reading the capacitance sampling value, the software can flexibly use different algorithms to perform touch judgment according to the application scenario, thereby improving the versatility of the digital processing system. Thus, the digital processing system can be used to detect the touch state (including the press state detection) of various combinations of touch buttons.
[0023] On the other hand, after all the touch buttons in a set of touch buttons have completed a round of button debouncing, the digital processing system can obtain the corresponding touch state determination result. Then, after initialization, it can jump to the function multiplexing working state to implement the function multiplexing of the same port, such as multiplexing it to connect to the port of the LED light, without needing to allocate a new port to control the LED light. It makes full use of the LED light's sleep period to sequentially sample, debounc, and detect the touch buttons. After completing a series of touch button operations, the port electrically connected to the touch button is multiplexed to connect to the port of the LED light to start the LED light. This realizes the time-division multiplexing of related ports in the digital processing system, saves the use of analog circuits, and reduces the chip area occupied by the digital processing system. Attached Figure Description
[0024] Figure 1 This is a schematic diagram of a digital processing system based on touch buttons, as disclosed in an embodiment of the present invention. Detailed Implementation
[0025] The technical solutions of the embodiments of the present invention will be described in detail below with reference to the accompanying drawings. To further illustrate the embodiments, the present invention provides accompanying drawings. These drawings are part of the disclosure of the present invention, mainly used to illustrate the embodiments, and can be used in conjunction with the relevant descriptions in the specification to explain the operating principles of the embodiments.
[0026] Unless otherwise defined, the technical or scientific terms used in this invention should be understood in their ordinary sense by one of ordinary skill in the art to which this application pertains. The terms "a," "an," "the," etc., used in this application do not indicate quantity limitation and may represent singular or plural. The terms "comprising," "including," "having," and any variations thereof, used in this application, are intended to cover non-exclusive inclusion, such as: a process, method, system product, or device that includes a series of steps or modules is not limited to the listed steps or units, but may also include steps or modules not listed, or may also include other steps or units inherent to these processes, methods, products, or devices. The terms "first," "second," "third," etc., used in this application are merely used to distinguish similar correspondences and do not represent a specific ordering of objects.
[0027] This embodiment discloses a digital processing system based on a touch button. The touch button is a capacitive touch button, and the capacitance inside the touch button is equivalent to the capacitance of the detection port to ground. It can also be regarded as the capacitance of the touch button or the capacitance inside the touch button. When the user touches the touch button with their finger, the capacitance value of the touch button changes. The capacitance value of the touch button mentioned in this invention can be the real-time capacitance value of the touch button, or it can be understood as the capacitance value of the capacitor inside the touch button, which can reflect the discharge information of the capacitor. The digital processing system is electrically connected to the capacitance sampling circuit. The capacitance sampling circuit is an analog circuit, while the digital processing system is a digital logic circuit. Since there are multiple touch buttons to be sampled, forming a group of touch buttons, the capacitance sampling circuit includes multiple sampling branches connected to this group of touch buttons. Each sampling branch is configured to be electrically connected to the capacitor inside a single touch button, and each sampling branch is used to acquire the capacitance value of the touch button it is connected to. A one-to-one matching sampling relationship is formed between each sampling branch and the capacitance of a single touch button. The sampling output terminal of each sampling branch outputs the sampled capacitance value or the discharge amount of the capacitor of the connected touch button. Each sampling branch's sampling output is connected to a corresponding input in a multiplexer. Controlled by the multiplexer's gating signal, it outputs the capacitance value sampled by the corresponding sampling branch to the relevant port of the digital processing system, forming a sampling channel. This channel samples the capacitance value of a touch button electrically connected to that branch, facilitating the digital processing system's acquisition of the touch button's capacitance value, debouncing the touch button, and determining its touch state. To improve accuracy and stability across multiple application scenarios, a polling mechanism for multiple sampling detections, high / low power consumption modes, and port function multiplexing modes are also implemented. In this embodiment, the gating signal is a sampling channel selection signal issued by the digital processing system. When the sampling channel selection signal changes, the selected sampling channel changes, and the connected touch button changes accordingly, enabling sampling of the new touch button's capacitance value. Preferably, the gating signal is a 5-bit signal, allowing selection of up to 32 sampling channels, corresponding to 32 touch buttons.
[0028] In this embodiment, the digital processing system includes a clock source, a register configuration unit, and a sampling control unit. The clock source provides clock signals to the sampling control unit, the capacitor sampling circuit, and the capacitor of the touch button. The clock signal provided by the clock source to the sampling control unit is a clock signal with a fixed duty cycle, and its frequency is preferably 1MHz. This clock signal serves as the operating clock of the digital processing system, driving its internal operation and digital logic calculations. The clock signal provided by the clock source to the capacitor sampling circuit is a clock signal with a configurable duty cycle, and its frequency is preferably 1MHz. When each sampling branch of the capacitor sampling circuit is an RC oscillation circuit, the clock signal provided by the clock source to the capacitor sampling circuit drives the RC oscillation circuit to receive the oscillation pulse emitted from the detection port of the touch button. The clock signal provided by the clock source to the capacitor of the touch button controls the voltage of the touch button. The charging and discharging time of the capacitor; preferably, the clock signal provided by the clock source to the capacitor of the touch button is equivalent to an oscillation signal. This oscillation signal is used to control the capacitor of the touch button to discharge to the capacitor inside the capacitor sampling circuit. The capacitor of the touch button discharges, charging the capacitor inside the capacitor sampling circuit, and determining that the capacitor of the touch button is in a discharging state, and at the same time determining that the capacitor inside the capacitor sampling circuit is in a charging state; wherein, the capacitor sampling circuit also feeds back a signal to the sampling control unit on the capacitor discharge status of the touch button. Preferably, when the feedback signal is set to a logic high level, it is determined that the capacitor discharge of the corresponding touch button is complete, and the voltage of the capacitor inside the capacitor sampling circuit rises to a voltage threshold, wherein the logic high level is greater than 3.3V; preferably, when the feedback signal is set to a logic low level, it is determined that the capacitor discharge of the corresponding touch button is not complete, and the voltage of the capacitor inside the capacitor sampling circuit is at a lower voltage, such as 0 to 1V, while the logic low level can be 0V.
[0029] In the digital processing system, the sampling control unit is a sequential logic circuit within the digital logic circuitry. This sequential logic circuit, driven by a clock signal provided by a clock source, generates a sequence of control signals related to the computation process. Therefore, the sampling control unit may include a counter and a frequency divider circuit (for dividing the clock signal). In this digital processing system, a synchronous state machine (synchronous sequential circuit) is often used to generate multiple control signal sequences closely related to the clock cycle, used to control the opening or closing of multiplexers or data channels, enabling the related combinational logic units to operate in an orderly and efficient manner. The sampling control unit disclosed in this embodiment includes a state machine composed of sequential logic circuits, or the sampling control unit is a state machine.
[0030] The sampling control unit is used to repeatedly sample the capacitance value of each touch button in a group of touch buttons under the drive of a clock signal provided by a clock source, and then control the multiple capacitance values of the same touch button to perform a round of button debouncing operation. The number of times the capacitance value of each touch button is sampled in a round of button debouncing operation is configured by a register configuration unit. The number of samplings is a configurable parameter within the sampling control unit. The data cached inside the register configuration unit can be refreshed externally or automatically according to a predetermined clock signal. Starting a round of button debouncing operation or a single touch button sampling requires triggering an enable signal, specifically enabling sampling of one touch button within a group of touch buttons. This sampling can be understood as sampling the touch button, equivalent to sampling the capacitance inside the touch button, equivalent to sampling or acquiring the capacitance value of the touch button, and equivalent to sampling the capacitance value or capacitance sample value of the capacitor inside the touch button. Because of the presence of a clock signal, the sampling control unit scans a corresponding touch button in a group of touch buttons using a counting method. It then repeatedly samples the capacitance value of that touch button using a counting method, and can optionally generate a delay every certain number of samples to eliminate the touch button's bounce (referred to as debouncing). Several samples correspond to one pre-debouncing operation for a single touch button. Repeatedly sampling the capacitance value of that touch button can be considered as one round of debouncing operation. Therefore, one round of debouncing operation includes multiple pre-debouncing operations for a single touch button. A pre-debouncing operation for a single touch button also includes multiple samplings of the capacitance value of that touch button. In this embodiment, the number of times the capacitance value of the same touch button is sampled in one pre-debouncing operation is set as a configurable parameter, as is the number of times the pre-debouncing operation for the same touch button is executed in one round of debouncing operation. Of course, the number of touch buttons in a group of touch buttons is also set to be greater than 1. Therefore, the sampling control unit needs to design a counter to generate one key touch pre-debouncing operation. Based on this, the sampling control unit also needs to design a counter to generate one round of key debouncing operation. Simultaneously, in order to switch from one touch button to scanning another touch button or to select a new sampling channel, the sampling control unit designs a dedicated counter. This counter generates the selection signal, which corresponds to the order of each touch button within a group. Based on the selection signal generated by the latest count, the multiplexer can select the capacitor of the corresponding touch button for discharge, so that the sampling control unit can sample its corresponding capacitance value. This capacitance sample value is equivalent to an additional charging counter timing the charging time of the touch button's capacitor within the corresponding sampling branch (actually, it belongs to the count value of a related counter and can be used to reflect capacitance change information).The aforementioned register configuration unit can configure the register values required by the analog circuit and digital processing system, and accept parameters transmitted from the external system bus, making them subject to software read and write control.
[0031] In summary, the digital processing system disclosed in this embodiment repeatedly samples the real-time capacitance value of each touch button multiple times using sequential logic circuits (organized into a state machine scheduling method). Under the configuration of the register configuration unit, a round of button debouncing operation is established based on a certain number of samples for the same touch button, thus meeting the sampling number required for button debouncing, overcoming the problem of errors easily occurring in single sampling values, and improving the accuracy of button touch detection. Furthermore, in this embodiment, the number of button touch pre-debouncing operations in a round of button debouncing operation is also configured by the register configuration unit. The data cached internally by the register configuration unit can be refreshed externally, making the associated sampling number and the number of button touch pre-debouncing operations configurable, thus exhibiting strong adaptability to the application environment of the digital processing system.
[0032] Preferably, the sampling control unit is a state machine or includes a corresponding state machine. Under the scheduling of the sampling control unit, after the digital processing system determines that all touch buttons in the group of touch buttons have completed a round of button debouncing operation, the port used to connect to the capacitance sampling circuit is reused to allow electrical connection with the relevant ports of other circuit modules (which may be the same as the output port of the capacitance of the touch button or an output port of the sampling branch), so as to reuse it for functions other than sampling the capacitance sampling value of the touch button. Preferably, the other circuit modules are LEDs that share a port with an output port of the sampling branch. Then the sampling control unit can be reused to control the on / off state of the LED module or LED array, or to detect the brightness of one of the LEDs. Therefore, after all the touch buttons in a set of touch buttons have completed a round of debouncing, the digital processing system can obtain the corresponding touch state determination result. Then, after initialization, it can jump to the function reuse working state to implement the function reuse of the same port. For example, it can be reused to connect to the port of the LED light without allocating a new port to control the LED light. It makes full use of the LED light's sleep period to sequentially sample, debounc, and detect the touch buttons. After completing a series of touch button operations, the port electrically connected to the touch button is switched to connect to the LED light to start the LED light. Then, after the LED light finishes working, it is reused to receive feedback signals from all the touch buttons in a new set of touch buttons. This realizes the time-division multiplexing of related ports in the digital processing system, saves the use of analog circuits, and reduces the chip area occupied by the digital processing system.
[0033] As one embodiment, the digital processing system further includes an averaging filter unit; the sampling control unit is used to perform a preset number of pre-debouncing operations on each touch button, and to mark a preset number of pre-debouncing operations on a touch button as one round of debouncing operation; in each pre-debouncing operation, the sampling control unit samples the capacitance value of a touch button a first preset number of times to poll and scan the touch button, that is, while the capacitor inside the touch button is in a discharging state, the capacitance value of the touch button is repeatedly sampled a first preset number of times, even if there is a delay time interval between two adjacent samples where the capacitance value is not sampled. The average filtering unit is used to calculate the average value of the capacitance sampled value of the same touch button during each key touch pre-debouncing, especially when entering the sampling completion working state configured in the state machine. The average value calculation method can be the mean filtering method. Specifically, the mean filtering of the capacitance sampled value of the same touch button needs to be performed according to the sampling number configured in the software. In the sampling completion working state, it is determined whether the touch button is in a coarse touch state or an untouched state. Whenever the key touch pre-debouncing is completed for the same touch button (equivalent to sampling the capacitance sampled value of the same touch button a first preset number of times), it is determined that the capacitor inside the same touch button has completed the discharge to end the sampling of the capacitance sampled value. Then, it jumps to a sampling completion working state, and calculates the average value of the capacitance sampled value of the same touch button in the sampling completion working state. Based on this average value, a coarse judgment is made on the touch state of the touch button. At the same time, all capacitance sampled values and their average values are saved and transmitted to the register configuration unit. In each round of key debouncing, if the average filtering unit determines that the same touch button is in a coarse touch state in the key touch pre-debouncing process for a preset number of judgments, then it determines that the touch button has been touched, thus achieving the effect of key debouncing. The preset number of judgments is equal to the difference between a preset debouncing quantity and the value 1, and represents the threshold number of times required to debouncing the touch button. Each round of key debouncing involves a preset number of key touch pre-debouncing operations, such that the number of times the capacitance sample value of each touch button is sampled in one round of key debouncing is equal to the product of the preset debouncing quantity and a first preset quantity.It should be noted that the sampling control unit includes a debounce count counter, which counts the number of times the key touch pre-debounce is executed in each round of key debounce operation. It can characterize the number of times the touch key completes the sampling operation of the capacitance sampling value of the first preset number of times. Whenever the preset number of key touch pre-debounces are completed, the preset number of coarse judgments of debounce is completed. Only then is the debounce process of the touch key marked as complete. At this time, the average filtering unit sends the average value of the final filtered output to the register configuration unit and marks the end of filtering for the touch key. The sampling control unit can enable the sampling of a new touch key in the same group of touch keys (i.e., send an enable signal to the corresponding sampling branch to sample the capacitance sampling value of a new touch key). The preset judgment count, the first preset number, and the preset debounce number are all configured by the register configuration unit. In some embodiments, whenever the average value of the capacitance sampled for the same touch button is calculated in the sampling completion working state, and a coarse judgment is made on the touch state of the touch button based on this average value, if the count value or change value of the debouncing count counter does not reach the preset debouncing number, a new key touch pre-debouncing is performed. The debouncing count counter starts counting from the first capacitance sampled value or the first key touch pre-debouncing in this round of key debouncing operation. In summary, this embodiment performs multiple key touch pre-debouncing operations in one round of key debouncing, and combines the judgment results of the touch state of the touch button in multiple key touch pre-debouncing operations to determine the final touch state of the same key touch, making the judgment result valid and recognizable by the CPU. This overcomes the influence of touch button bounce or noise signals introduced by the capacitance sampling circuit, prevents misjudgments caused by touch button bounce, and ensures the accuracy and stability of the sampling detection results of the digital processing system.
[0034] As one embodiment, the sampling control unit includes a sampling delay counter; the sampling control unit configures the working state between two adjacent key touch pre-debouncing operations, or the working state between two adjacent single sampling working states, as a low-power delay working state. The time interval between two adjacent key touch pre-debouncing operations is also equivalent to the time interval between the last sampling of the capacitance value of the same touch button (equivalent to the real-time capacitance value) in the previous key touch pre-debouncing operation (including sampling the capacitance value of the same touch button a first preset number of times) and the first sampling of the capacitance value of the same touch button (equivalent to the real-time capacitance value) in the current key touch pre-debouncing operation (including sampling the capacitance value of the same touch button a first preset number of times). Therefore, when crossing two key touch pre-debouncing operations, it is equivalent to the working state between two adjacent single sampling working states, which can be understood as forming an idle working state. The sampling delay counter is used to time the time during which the sampling control unit is in a low-power delay state. The duration of this low-power delay state is determined by the count value of the clock signal provided to the sampling control unit by the clock source. This count generates the time interval between two capacitor samples, allowing the sampling control unit to perform parameter updates and configurations (excluding key touch pre-debouncing) in the low-power delay state to adapt to the environment of the touch button. Since it only involves parameter updates and operates at a low frequency, it reduces the overall system power. Whenever a pulse is detected in the clock signal provided to the sampling control unit by the clock source, the sampling delay counter counts once (usually incrementing by one). If the sampling delay counter starts counting from 0 after a key touch pre-debouncing ends, the count value of the sampling delay counter or its change directly represents the time spent in the low-power delay state. In this embodiment, after responding to the low-power state enable signal, the sampling control unit enters a low-power delay working state. In the low-power delay working state, the sampling control unit controls the frequency of the clock signal provided by the clock source to be reduced, preferably to 32KHz, in order to extend the counting period of the sampling delay counter, thereby increasing the time interval between two adjacent key touch pre-debouncing or between two adjacent single sampling working states, interrupting continuous sampling operations, thereby reducing the power consumed by the digital processing system in the idle working state.
[0035] It should be noted that the sampling control unit includes a state machine composed of timing logic circuits; a single sampling process of the capacitance sampling value of a touch button is configured as a working state by the state machine and recorded as a single sampling working state; relative to the single sampling working state, the low-power delay working state is configured as another working state by the state machine. The sampling completion state is also a working state configured by the state machine. The relevant counters included in the sampling control unit can count within the sampling completion state, and the averaging filter unit can perform calculation operations within the sampling completion state. The sampling control unit is used to transmit the capacitance sampling value of the touch button sampled in each single sampling working state to the register configuration unit for external reading, and to transmit the average value of the capacitance sampling values of the touch button sampled multiple times to the register configuration unit for software reading, and to use it as a detection parameter in the key touch detection algorithm at the software level. In particular, when the external system bus sends a request command, the capacitance sampling value of the sampled touch button is transmitted to the register configuration unit, and then directly read by the external system bus for software use. Preferably, the capacitance sampling values of each touch button in the same group of touch buttons are transmitted in a time-division multiplexing manner.
[0036] As one embodiment, whenever all the touch buttons in the group of touch buttons have completed a round of button debouncing, the sampling control unit determines to end the sampling of the group of touch buttons, and the state machine jumps to the function multiplexing working state; preferably, after the state machine ends the single sampling working state, it first jumps to the initial state, initializes its internal counters and registers, generally by clearing them, and then jumps to the function multiplexing working state. In the function multiplexing operation state, the sampling control unit configures the ports (including input ports and output ports) in the digital processing system used to connect to the capacitance sampling circuit to transmit signals different from those transmitted during the first round of key debouncing operation, and multiplexes them to perform functions other than sampling the capacitance sampling value of the touch keys, thereby achieving time-division multiplexing of the same function port; until the sampling control unit finishes performing the functions other than sampling the capacitance sampling value of the touch keys through its port connected to the capacitance sampling circuit, when the state machine is in the function multiplexing operation state for a preset delay debouncing time, the state machine jumps from the function multiplexing operation state to the single sampling operation state to delay and remove possible jitter during the function change of the port, and begins to sample the capacitance sampling value of each touch key in a new set of touch keys.
[0037] In this embodiment, the sampling control unit includes a debounce delay counter. After the execution of functions other than sampling the capacitance value of the touch buttons is completed, and the debounce delay counter reaches a preset delay debounce time, the sampling control unit configures the aforementioned port to transmit the signals it previously transmitted during the first round of button debounce operation. Specifically, this is a feedback signal indicating the discharge status of the capacitor inside the touch buttons in a new set of touch buttons, or the capacitance sampling value of the touch buttons, and reuses it to sample the capacitance sampling value of the corresponding touch buttons in the single sampling working state. It should be noted that the electronic components connected to the aforementioned ports in the function reuse working state do not change, that is, the ports in the digital processing system used to connect to the capacitance sampling circuit are connected to fixed electronic components or fixed circuit modules. The preset delay debounce time is configured by the register configuration unit. When the state machine jumps to the function reuse working state, the attributes of the ports in the digital processing system used to connect to the capacitance sampling circuit support changing from input to output, or supporting changing from output to input. Then, the same input port reuses different types of input and output signals in different circuit modules, and the same output port reuses different types of input and output signals in different circuit modules.
[0038] Based on the above embodiments, under the scheduling of the sampling control unit, after all the touch buttons in the group of touch buttons have completed a round of button debouncing operation (which can be completed sequentially according to the scheduling of the state machine), the system enters the function multiplexing working state. Then, the input port in the digital processing system used to receive feedback signals or capacitor sampling values is multiplexed as an output port to send control signals to the LEDs to adjust their brightness. The port in the digital processing system used to select touch buttons is also multiplexed to select one of the LEDs in the LED array, so that the brightness of the selected LED is adjusted by the input port in the digital processing system used to receive the feedback signals or capacitor sampling values. In this embodiment, the feedback signal is a signal that reflects the discharge status of the capacitor inside the touch button, and the feedback signal originates from an output port of a sampling branch electrically connected to the capacitor inside the touch button. The feedback signal is used to represent the charging voltage signal of the capacitor in the sampling branch electrically connected to the capacitor inside the touch button. In this embodiment, one output port of the sampling branch electrically connected to the capacitor inside the touch button is configured as a discharge feedback port. The output ports of the corresponding sampling branches electrically connected to the capacitors inside other touch buttons in the same group are all connected to this discharge feedback port, so that all sampling branches in the capacitor sampling circuit share this discharge feedback port. The sampling branch includes a capacitor. Wherein, the port receiving the feedback signal of the capacitor discharge status inside the touch button is the output terminal of the LED. Therefore, under the scheduling control of the state machine (the sampling control unit), the port's function multiplexing at the same time is either touch button input to sample the capacitor or LED control current output.
[0039] As one embodiment, each sampling branch of the capacitance sampling circuit is configured to share a charging time counter, or each sampling branch of the capacitance sampling circuit is configured with its own charging time counter to reduce the number of reset operations, thus better preserving the capacitance sampling value of a single touch button (using the count value of the charging time or its corresponding delay time to represent the charging voltage of the capacitor inside the sampling branch). Whenever the sampling control unit enters the single sampling working state, the charge released by the capacitor inside a touch button charges the capacitor inside the corresponding sampling branch. The sampling control unit is used to control the charging time counter to count the charging time of the capacitor inside the corresponding sampling branch under the driving action of the clock signal provided by the clock source. Whenever the charging time counter detects a pulse of the clock signal provided by the clock source, the charging time counter increments by one, and the real-time count value of the charging time counter is used to represent the capacitance sampling value of the corresponding touch button. Preferably, the count value of the charging time counter is configured as a 16-bit binary number. Whenever the capacitor inside the touch button completes its discharge, the sampling control unit saves the count value of the charging time counter and configures it as the capacitance sampling value of the touch button in one sampling, so as to identify the change in the discharge amount of the capacitor inside the touch button, and then transmits the capacitance sampling value to the averaging filter unit; at the same time, the sampling control unit can also feed back an end flag signal to the clock source, which controls the capacitor of the touch button to charge, so as to discharge the internal capacitor of the connected sampling branch, ensuring that subsequent repeated sampling, button touch pre-debouncing, or the first round of button debouncing operation can be implemented.
[0040] Whenever the sampling control unit continuously enters the single-sampling working state (where there is an idle working state between two adjacent samplings, i.e., the working state between two adjacent single-sampling working states (low-power delay working state)) a number of times reaches the first preset number, it is determined that the touch button has completed one key touch pre-debouncing and enters the low-power delay working state. The charging time counter is controlled to maintain its count value to obtain the latest capacitance sampling value of the same touch button. Preferably, after saving the count value of the charging time counter through a relevant register, the charging time counter is controlled to pause counting and clear its count value to zero during the low-power delay working state, so as to identify the capacitance sampling value sampled by the same touch button in the next key touch pre-debouncing. When the sampling control unit jumps from the low-power delay working state back to the single-sampling working state, the charging time counter is controlled to continue counting to continue counting the charging time of the capacitor inside the corresponding sampling branch to obtain the latest capacitance sampling value of the same touch button.
[0041] Preferably, each sampling branch of the capacitance sampling circuit is an RC oscillation circuit; all sampling branches share a discharge feedback port, which can be controlled by the capacitance sampling circuit and set and toggled to logic high and logic low levels; the discharge feedback port is used to output a first valid level when the capacitor inside the currently sampled touch button has completed discharging, and when the discharge feedback port outputs the first valid level, it triggers the charging time counter to pause counting, and the current count value of the charging time counter is configured as the capacitance sampling value of the touch button in the current sampling, wherein the first valid level is a logic high level, and the capacitor inside the sampling branch is charged to a voltage threshold. The discharge feedback port is also used to output a second valid level when the capacitor inside the currently sampled touch button has not completed discharging, wherein the second valid level is a logic low level, at which time the capacitor inside the currently sampled touch button is discharging; or, the capacitor inside the currently sampled touch button may still be charging and has not yet had time to discharge. Whenever the discharge feedback port outputs a first valid level, it is determined that the capacitor inside the currently sampled touch button has finished discharging. Then, the sampling control unit feeds back a flag signal to the clock source, causing the clock source to drive the capacitor inside the touch button to charge. The driving method can be to introduce power into the capacitor inside the currently sampled touch button through a switch switch inside the capacitor sampling circuit or outside the digital processing system, so that the capacitor inside the currently sampled touch button can continue to discharge, so as to charge the capacitor inside the RC oscillation circuit in the subsequent single sampling working state. At the same time, the charging time counter is triggered to time this charging process of the capacitor inside the RC oscillation circuit.
[0042] Based on the aforementioned embodiment regarding the average filtering unit, the average filtering unit is used to, from all capacitance sample values of the same touch button sampled by the sampling control unit in each key touch pre-debounce, remove the maximum and minimum capacitance sample values, and calculate the average value of the remaining capacitance sample values to obtain the average capacitance sample value of the touch button, thereby completing one average filtering of the capacitance sample values with a specific number of samplings. In each key touch pre-debounce (every time a first preset number of samplings have occurred), when the average filtering unit detects that the average capacitance sample value of the touch button is less than or equal to the reference capacitance value of the touch button, it determines that the touch button is in an untouched state; in each key touch pre-debounce (every time a first preset number of samplings have occurred), when the average filtering unit detects that the average capacitance sample value of the touch button is greater than the reference capacitance value of the touch button, it determines that the touch button is in a coarse touch state, representing a preliminary judgment result for a single touch button. Based on this, in each round of key debouncing operation, the average filtering unit is used to determine whether the same touch button is in a coarse touch state in the key pre-debouncing process of a preset number of judgments. If so, it determines that the touch button is in a valid touch state, and thus determines that the touch button has been touched to achieve the effect of key debouncing. Otherwise, it determines that the touch button is in a valid release state and that the touch button has not been touched. In this embodiment, when the average filtering unit determines that the touch button has been touched, it outputs a first detection result signal, which can be a logic high level; when the average filtering unit determines that the touch button has not been touched, it outputs a second detection result signal, which can be a logic low level. In each round of key debouncing operation, if the same touch button is determined to be in a coarse touch state in a preset number of judgments, then the touch button is determined to be touched. This can also be understood as the same touch button being in a coarse touch state for a certain number of key scan times, then the touch button can be regarded by the CPU as being in a truly touched state. Preferably, the key touch pre-debouncing of the preset number of judgments can be a continuous key touch pre-debouncing of the preset number of judgments, or there can be two discontinuous key touch pre-debouncing. Reduce the impact of noise on the capacitance sampling values of touch buttons and lower the risk of detection errors.
[0043] It should be noted that the averaging filter unit calculates the average of the capacitance sample values obtained by the same touch button within a single button touch pre-debouncing operation. After removing the maximum and minimum capacitance sample values, the specific operation for calculating the average is that the averaging filter unit accumulates the count value of the charging time counter each time the discharge feedback port outputs the first effective level, and then calculates the average of the accumulated results. It should be noted that within the averaging filter unit, the accumulator is used to perform the aforementioned accumulation operation, and the frequency divider or divider is used to calculate the average of the accumulated results. The sampling control unit is also used to transmit the average capacitance sample value of the touch button calculated by the averaging filter unit to the register configuration unit in each round of button debouncing operation, so that it can be read externally and the software system can obtain the average capacitance sample value of the touch button. Preferably, the specific judgment operation performed by the averaging filter unit can be implemented by a comparator and the detection result of whether the corresponding touch button has been touched can be output by a selector. Of course, the detection results of all touch buttons in the group of touch buttons can be obtained sequentially, so that it can be known which touch button is currently touched.
[0044] Based on the above embodiments, the average filtering unit includes a reference value processing unit and a reference capacitance value register. The reference value processing unit is used to update the average sampled value output by the average filtering unit to the reference capacitance value stored in the reference capacitance value register whenever the key touch pre-debouncing is performed on a touch button, particularly during the low-power delay operation state. This update occurs when the average filtering unit determines that the touch button remains untouched, i.e., during the low-power delay operation state (which may include one round of key debouncing operation) until the second detection result signal is detected. This reference value is then configured as the reference capacitance value for the touch button. The reference capacitance value register stores the reference capacitance value of the corresponding touch button. In this embodiment, the reference capacitance value serves as a reference quantity for detecting the touch state or capacitance value change of the corresponding touch button and is refreshable to adapt to changes in the equivalent capacitance value of the touch button imposed by the external environment. In some embodiments, the number of reference capacitance value registers included in the digital processing system is equal to the number of all touch buttons in the group of touch buttons. Each reference capacitance value register is matched with a corresponding sampling branch, so that each touch button corresponds to a corresponding reference capacitance value register. The reference value processing unit is further configured to maintain the reference capacitance value stored in the reference capacitance value register unchanged whenever the button touch pre-debouncing is performed on a touch button, especially during the low-power delay operation state, if the average filtering unit determines that the touch button has been touched, i.e., when detecting the first detection result signal; wherein each reference capacitance value register is connected to a corresponding sampling branch in the capacitance sampling circuit, and each reference capacitance value register is matched with a corresponding touch button. In some embodiments, water droplets may be present on the touch button (touch electrode surface), or the touch button may experience temperature changes. In such cases, the capacitance changes caused by the aforementioned physical factors need to be fed back to the reference capacitance value of the touch button. Therefore, the average sampling value output by the average filtering unit needs to be updated to the reference capacitance value stored in the reference capacitance value register, which is used to participate in the determination of the touch state of the same touch button in a new button touch pre-debouncing, so as to improve the sensitivity of touch judgment. The reference value processing unit in this embodiment updates the currently stored reference capacitance value based on the comparison result between the average sampled value of the corresponding touch button output by the average filtering unit and the reference capacitance value of the touch button (corresponding to the detection result of the touch button). This enables adaptive correction of the reference capacitance value when environmental changes or other factors cause the reference capacitance value of each touch button to differ from its initial value. Furthermore, the updated reference capacitance value is used to determine the touch state of the same touch button, adapting to the influence of the external environment on the equivalent capacitance value of the touch button.
[0045] It should be noted that the reference capacitance register associated with the same touch button and the sampling branch are two separate paths. This improves the versatility of the digital processing system, demonstrating its ability to detect the touch or press states of various combinations of touch buttons.
[0046] In summary, the sampling control unit sets a delay time period in both the low-power delay operation state and the function multiplexing operation state. In the low-power delay operation state, the capacitor reference value can be updated. In the function multiplexing operation state, delay debouncing is performed before port switching to overcome the jitter caused by port switching. This ensures that the sampling control unit jumps to the corresponding operation state in sequence, thereby controlling the accuracy of the operation state scheduling.
[0047] As one embodiment, the sampling control unit includes a key scan counter and a key count counter; the key scan counter is used to drive the sampling control unit to sample the capacitance value of a touch button in a discharging state within a group of touch buttons; wherein, the touch button in a discharging state is the touch button sampled when the discharge feedback port outputs the second valid level; it should be noted that, under the same clock cycle (for example, under the clock cycle of the clock signal provided by the clock source to the sampling control unit), the sampling control unit only samples one touch button within a group of touch buttons. When the capacitor of the touch button completes its discharge, i.e., when the discharge feedback port outputs the first valid level, the sampling control unit samples the capacitance value of the touch button and transmits it to the averaging filter unit. It also controls the button scan counter to count once, specifically incrementing the count by one. Simultaneously, it determines that one sampling of the touch button's capacitance value is completed within the single sampling working state (the most recently transitioned single sampling working state of the state machine), and also determines that the touch button ends a single sampling working state. This continues until the change in the button scan counter's count value reaches the first preset number. At this point, the averaging filter unit calculates the average of the currently acquired first preset number of capacitance sampling values, configures the calculated average as the average sampling value of the corresponding touch button, and outputs it to the register configuration unit. If the change in the button scan counter's count value does not reach the first preset number, the capacitance value of the same touch button is repeatedly sampled, and this repeated sampling process is recorded as one key touch pre-debouncing. Therefore, whenever the change in the key scan counter reaches the first preset number, the sampling control unit determines that it has completed one key touch pre-debouncing operation for the capacitance sampling value of the touch key. Then, it triggers the control unit to count once, simultaneously driving the sampling control unit to pause sampling the capacitance sampling value of the touch keys within a group of touch keys, and triggers the sampling delay counter to start counting until the change in the sampling delay counter reaches a preset delay interval. At this point, the sampling control unit determines that one low-power delay operation state has ended, and then drives the sampling control unit to start sampling the capacitance sampling value of the same touch key within the same group of touch keys that is in a discharging state. The capacitance within the same touch key can recover to a discharging state within the low-power delay operation state under the driving action of the clock signal provided by the clock source to the analog circuit (analog terminal). The preset delay interval is configured by the register configuration unit and is the time interval between two adjacent key touch pre-debouncing operations, equivalent to the non-touch scan time. The duration of the low-power delay operation state is determined by the count value of the sampling delay counter on the clock signal provided by the clock source to the sampling control unit.Whenever the change in the count value of the debounce count counter reaches the preset debounce number, it is determined that one round of key debounce operation for the touch button has been completed, thus overcoming the jitter effect of the touch button. At the same time, the key count counter counts once to switch to another touch button in the same group of touch buttons. The key count counter increments by one according to a given scheduling sequence and sets the count value of the key count counter to the number of the sampling channel, which corresponds to the strobe signal. When the count value changes, the sampling channel selected by the strobe signal in the capacitor sampling circuit changes, and the corresponding sampled touch button also changes. Then, the sampling control unit is driven to sample the capacitance value of the other touch button in the discharge state; until the change value of the button count counter reaches a second preset number, it is determined that the sampling control unit has completed one round of button debouncing operation for all touch buttons in the same group of touch buttons, and the sampling control unit ends the sampling of the group of touch buttons; if the change value of the button count counter does not reach the second preset number, a new touch button is selected and sampled by the count value of the button count counter, and this repeated sampling process is recorded as the sampling control unit performing one round of button debouncing operation for each touch button in the same group of touch buttons. The number of all touch buttons in the same group of touch buttons is equal to the second preset number. In summary, this embodiment revolves around the working state transition of a large state machine. It sequentially samples the capacitance value inside each touch button multiple times, performs the first preset number of samplings on a single touch button, performs button touch pre-debouncing a number of times on a single touch button, and then performs a round of button debouncing operation on each touch button in a group of touch buttons. Through a three-layer loop scheduling method, a group of touch buttons is scanned, and the corresponding touch state judgment result, average sampling value, and capacitance sampling value in the corresponding working state can be obtained. In this way, the repeated charging and discharging of the capacitance of the touch button drives the operation of the state machine and overcomes the touch button jitter problem after multiple operations.
[0048] Based on the above embodiments, if the change value of the key scan counter reaches the first preset number, the change value of the debouncing count counter reaches the preset debouncing number, and the change value of the key count counter reaches the second preset number, then the following situation exists: On the one hand, when the state machine is not in the low-power delay working state and the discharge feedback port outputs the first effective level (the capacitor inside the touch key has been discharged), it is determined that the sampling control unit has completed one round of key debouncing operation of the capacitance sampling values of all touch keys in the same group of touch keys. The sampling control unit ends the sampling of the group of touch keys, determines the touched state of each touch key, obtains and saves multiple capacitance sampling values of each touch key and the average sampling value that can be obtained for the same touch key in each key touch pre-debouncing. On the other hand, when the state machine is not in a low-power delay working state, the discharge feedback port outputs a second valid level (the capacitor inside the touch button is still discharging, keeping the discharge feedback port at the second valid level), and the state machine is in a function reuse working state, it is determined that the sampling control unit has completed one round of key debouncing operation for the capacitance sampling values of all touch buttons in the same group of touch buttons. The sampling control unit ends the sampling of the capacitance sampling value of each touch button in the group of touch buttons. Then, the sampling control unit waits for a new group of touch buttons to be sampled in the function reuse working state, that is, waits for the relevant port to be reused for sampling a new group of touch buttons.
[0049] It should be noted that, under the scheduling of the state machine, driven sequentially by the key scan counter, debouncing count counter, and key count counter, the time from the first sampled touch button in the same group of touch buttons entering the single sampling working state to the last sampled touch button in the same group experiencing its last key touch pre-debouncing reaches the preset total sampling time threshold. The preset total sampling time threshold is configured by the register configuration unit and is used to represent the time during which the relevant ports are multiplexed to maintain connection with the capacitance sampling circuit during the sampling control unit's sampling of the capacitance sampling value of each touch button in a group of touch buttons. In the first round of key debouncing operation, the relevant ports are at least multiplexed as input ports for receiving the feedback signal (a signal that feedbacks the capacitance discharge status inside the touch button) or the capacitance sampling value, and as ports for selecting touch buttons.
[0050] As one embodiment, for a currently sampled touch button, under the conditions that the state machine is not in a low-power delay operating state and the discharge feedback port outputs a second valid level (the capacitor inside the currently sampled touch button is still discharging), or under the conditions that the sampling control unit is in a low-power delay operating state for a period of time reaching the reference time interval and the discharge feedback port outputs a second valid level (the capacitor inside the currently sampled touch button is still discharging), the following situations exist:
[0051] When the change in the key scan counter value does not reach the first preset number, the change in the key count counter value does not reach the second preset number, and the change in the debouncing count counter value does not reach the preset debouncing number, the key scan counter is triggered to count once. The state machine is currently in the sampling completion working state and is configured to jump from the current sampling completion working state to the single sampling working state. Therefore, the state machine needs to trigger the key scan counter to count once in the sampling completion working state, indicating that one sampling has been completed for the currently sampled touch key. Simultaneously, the count values of the key count counter and the debouncing count counter are kept unchanged, and the number of touch keys that have been sampled and the number of pre-debouncing operations performed on the currently sampled touch key are recorded. It is also determined that the currently sampled touch key has not completed one round of key debouncing operation, and that the sampling control unit has not completed the sampling of the capacitance values of all touch keys within a group of touch keys.
[0052] When the change in the key scan counter reaches the first preset number, and the change in the key count counter does not reach the second preset number, and the change in the debouncing count counter does not reach the preset debouncing number, the state machine is currently in the sampling completion working state, and the state machine is configured to jump from the current sampling completion working state to the single sampling working state; the state machine triggers the key scan counter to count once in the sampling completion working state, indicating that one sampling has been completed for the currently sampled touch key, and triggers the debouncing count counter to count once, indicating that the sampling control unit has performed one key touch pre-debouncing for the currently sampled touch key; since it has not switched to scanning another touch key, the key count counter is not triggered, but the count value of the key count counter remains unchanged; at this time, it is determined that the currently sampled touch key has not completed a round of key debouncing operation, and it is determined that the sampling control unit has not completed the sampling of the capacitance sampling values of all touch keys in a group of touch keys.
[0053] When the change in the key scan counter reaches the first preset number, the change in the key count counter does not reach the second preset number, and the change in the debouncing count counter reaches the preset debouncing number, the state machine is configured to transition from the current sampling completion state to the single sampling state. Simultaneously, the state machine triggers the key scan counter to count once, indicating that one sampling has been completed for the currently sampled touch key. Simultaneously, the state machine triggers the debouncing count counter to count once, indicating that the sampling control unit has performed one key touch pre-debouncing operation on the currently sampled touch key. Simultaneously, the state machine triggers the key count counter to count once, indicating that one round of debouncing operation has been completed for the currently sampled touch key, thus prompting a switch to the touch key corresponding to the latest count value of the key count counter for sampling. It is determined that one round of key debouncing operation has been completed for the currently sampled touch key, but the sampling control unit has not completed sampling of the capacitance values of all touch keys within a group of touch keys.
[0054] In summary, the digital processing system determines the following in sequence by judging the changes in the key scan counter, the key count counter, and the debouncing count counter: completing one sampling of a currently sampled touch key, performing one key touch pre-debouncing operation on a currently sampled touch key, and completing one round of debouncing operation on a currently sampled touch key. This orderly control of the state machine scheduling comprehensively reflects the cyclic sampling results of each touch key within a set of touch keys. The transition between single sampling states can adapt to parameter requirements under various working conditions, improving system stability.
[0055] It should be noted that the time consumed by one round of key debouncing operation is one detection cycle of a touch button, and the time consumed by one key touch pre-debouncing operation is one polling cycle of a touch button. One detection cycle is equal to the product of one polling cycle and the preset debouncing count. The single sampling cycle of the touch button's capacitance sampling value is obtained by counting using a charging timer, driven by a clock signal provided to the sampling control unit by a clock source, counting pulses (the number of pulses of the clock signal), and counting occurs while the capacitor inside the touch button is in a discharging state. Each time the capacitor inside the touch button finishes discharging, a capacitance sampling value is sampled, and the key scan counter counts once. The key scan counter is used to time the single sampling cycle of the touch button. Each time the sampling control unit performs one key touch pre-debouncing operation on the capacitor inside the touch button, the debouncing count counter counts once, and the debouncing count counter is used to time the polling cycle of the touch button. Each time the sampling control unit performs one round of key debouncing operation on the capacitor inside the touch button, the key count counter counts once, and the key count counter is used to time the detection cycle of the touch button.
[0056] Preferably, when the sampling control unit is in a low-power delay working state for a period of time that reaches the reference time interval under the counting drive of the sampling delay counter, the sampling control unit needs to change its working state. However, before the working state change occurs, the change in the count value of the key scan counter, the change in the count value of the key count counter, and the change in the debouncing count counter need to be judged in sequence.
[0057] Preferably, whenever the change in the key scan counter reaches the first preset number, the change in the key count counter does not reach the second preset number, and the change in the debouncing count counter reaches the preset debouncing number, the key count counter increments by one and marks it as the sampling channel number. Then, the sampling control unit samples the capacitance sampling values of the larger-ordered touch keys within the same group of touch keys. The state machine continues to jump back to the single sampling working state until the capacitance sampling values of all touch keys within the same group of touch keys have been scanned. It is determined that the sampling control unit completes the scanning of all touch keys in all sampling channels sequentially from the smallest number to the largest number according to the numbering order of the sampling channels. In summary, this accurately and comprehensively reflects the capacitance sampling values of all touch keys in a group of touch keys and their touched state, overcoming the delay effect of only one sampling end flag signal between the corresponding key encoding signals output after two adjacent touch keys are touched simultaneously, and avoiding the reading of invalid signals between the corresponding feedback signals output after two adjacent touch keys are touched successively or between the capacitance sampling values generated by the charging time counter.
[0058] Based on the foregoing embodiments, the present invention also discloses a chip including the aforementioned digital processing system. Building upon the foregoing embodiments, the chip uses a timing logic circuit (organized into a state machine scheduling method) to repeatedly sample the real-time capacitance value of each touch button multiple times. Under the configuration of the register configuration unit, a round of button debouncing operation is established based on a certain number of samplings of the same touch button, thus meeting the sampling number required for button debouncing, overcoming the problem of errors easily occurring in single sampling values, and improving the accuracy of button touch judgment. The chip also performs multiple pre-debouncing operations on button touches within a round of debouncing, and combines the judgment results of the touch state of the touch button in multiple pre-debouncing operations to determine the final touch state of the same button touch. This overcomes the influence of noise signals introduced by touch button jitter or the capacitance sampling circuit, prevents misjudgments caused by touch button jitter, and ensures the accuracy and stability of the capacitance values sampled by the chip.
[0059] In the chip, the number of times key touch pre-debouncing is performed in one round of key debouncing operation is also configured by the register configuration unit. The data cached inside the register configuration unit can be refreshed externally, so the associated sampling number and the number of key touch pre-debouncing executions in its internal cache are configurable, making it highly adaptable to the application environment of the digital processing system.
[0060] The chip also sets a delay time period in both the low-power delay working state and the function multiplexing working state. In the low-power delay working state, the capacitor reference value can be updated. In the function multiplexing working state, delay debouncing is performed before port switching to overcome the jitter caused by port switching, thereby ensuring that the sampling control unit jumps to the corresponding working state in sequence to control the accuracy of the working state scheduling.
[0061] It should be noted that the real-time capacitance value of each touch button is obtained by counting using the capacitor charging counter inside the chip and recorded as a capacitance sampling value. This value can be sent to the software system or hardware module for reading through the register configuration unit. After reading the capacitance sampling value, the software can flexibly use different algorithms to perform touch judgment according to the application scenario, thereby improving the versatility of the digital processing system. Thus, the digital processing system can be used to detect the touch state (including the press state detection) of various combinations of touch buttons.
[0062] On the other hand, after all the touch buttons in a set of touch buttons have completed a round of button debouncing, the chip can obtain the corresponding touch state judgment result. Then, after initialization, it can jump to the function reuse working state to reuse the functions of related function ports, such as reusing them to connect to the LED light, without needing to allocate a new port to control the LED light. It makes full use of the LED light's sleep period to sequentially sample, debounc, and detect the touch buttons, realizing time-division multiplexing. Then, after the LED light finishes working, it reuses the sampling capacitance values of all the touch buttons in a new set of touch buttons, realizing time-division multiplexing of the chip's related ports, saving the use of analog circuits and reducing the chip's area.
[0063] The above embodiments are only for illustrating the technical concept and features of the present invention, and are intended to enable those skilled in the art to understand the content of the present invention and implement it accordingly. They should not be construed as limiting the scope of protection of the present invention. All equivalent transformations or modifications made in accordance with the spirit and essence of the present invention should be covered within the scope of protection of the present invention.
Claims
1. A digital processing system based on touch buttons, wherein the digital processing system is electrically connected to a capacitive sampling circuit, and the capacitive sampling circuit includes multiple sampling branches connected to a set of touch buttons, wherein, Each sampling branch is configured to be electrically connected to a capacitor inside a touch button; characterized in that the digital processing system includes a clock source, a register configuration unit, and a sampling control unit; wherein the sampling control unit is a sequential logic circuit in digital logic circuits; The sampling control unit is used to repeatedly sample the capacitance sampling value of each touch button in a set of touch buttons under the driving action of the clock signal provided by the clock source, and then control the multiple capacitance sampling values of the same touch button to perform a round of button debouncing operation. The number of times the capacitance sampling value of each touch button is sampled in a round of button debouncing operation is configured by the register configuration unit. The data cached inside the register configuration unit can be refreshed externally. The digital processing system also includes an average filtering unit; the sampling control unit is used to perform a preset number of key touch pre-debouncing operations on each touch button, and to mark a preset number of key touch pre-debouncing operations performed on a touch button as one round of key debouncing operation. During each key touch pre-debouncing, the sampling control unit samples the capacitance value of a touch button a first preset number of times to poll and scan the touch button; the average filtering unit is used to calculate the average value of the capacitance value of the same touch button sampled in each key touch pre-debouncing, and to determine whether the touch button is in a state of being coarsely touched or in a state of not being touched. In each round of key debouncing operation, if the average filtering unit determines that the same touch key is in a coarse touch state in the key touch pre-debouncing process of a preset number of judgments, then it determines that the touch key has been touched, so as to achieve the effect of key debouncing; wherein, the preset number of judgments is equal to the difference between the preset debouncing quantity and the value 1. The sampling control unit includes a debounce count counter, which is used to count the number of times the button touch pre-debounce is executed in each round of button debounce operation; The first preset quantity and the preset debouncing quantity are both configured by the register configuration unit. In each round of key debouncing operation, there is a preset number of key touch pre-debouncing, so that the number of times the capacitance sampling value of each touch key is sampled in a round of key debouncing operation is equal to the product of the preset debouncing quantity and the first preset quantity.
2. The digital processing system according to claim 1, characterized in that, The sampling control unit includes a sampling delay counter. The sampling control unit configures the working state between two adjacent key touch pre-debouncing operations or between two adjacent single sampling working states as a low-power delay working state. The sampling delay counter is used to time the time that the sampling control unit is in the low-power delay working state. The duration of the low-power delay working state is determined by the count value of the sampling delay counter on the clock signal provided to the sampling control unit by the clock source. In the low-power delay operation state, the sampling control unit controls the frequency of the clock signal provided by the clock source to decrease, so as to extend the counting period of the sampling delay counter, thereby increasing the time interval between two adjacent key touch pre-debouncing or between two adjacent single sampling operation states. The sampling control unit includes a state machine composed of timing logic circuits; a sampling process of the capacitance sampling value of a touch button is configured as a working state by the state machine and recorded as a single sampling working state; the sampling control unit is used to transmit the capacitance sampling value of the touch button sampled in each single sampling working state to the register configuration unit for external reading. In contrast to the single-sampling working state, the low-power delay working state is configured as another working state by the state machine.
3. The digital processing system according to claim 2, characterized in that, After all the touch buttons in the group of touch buttons have completed one round of button debouncing, the sampling control unit determines to end the sampling of the group of touch buttons. The state machine jumps to the function multiplexing working state, configures the port in the digital processing system used to connect to the capacitance sampling circuit to transmit a signal different from the signal transmitted during the one round of button debouncing, and multiplexes it to perform functions other than sampling the capacitance sampling value of the touch buttons. After the functions other than sampling the capacitance sampling value of the touch buttons are completed, when the time the state machine is in the function multiplexing working state is the preset delay debouncing time, the state machine jumps from the function multiplexing working state to the single sampling working state to start sampling the capacitance sampling value of each touch button in a new group of touch buttons. The sampling control unit includes a debounce delay counter. After performing functions other than sampling the capacitance value of the touch button, the debounce delay counter counts for a preset debounce delay time. Then, the sampling control unit configures the aforementioned port to transmit the signal transmitted during the first round of button debounce operation and reuses it to sample the capacitance value of the touch button in the single sampling operation state. The electronic components connected to the aforementioned port remain unchanged in the function reuse operation state. The preset debounce delay time is configured by the register configuration unit. When the state machine transitions to the function multiplexing working state, the attribute of the port in the digital processing system used to connect to the capacitor sampling circuit can be changed from input to output or from output to input.
4. The digital processing system according to claim 3, characterized in that, Each sampling branch of the capacitor sampling circuit is configured to share a charging time counter, or each sampling branch of the capacitor sampling circuit is configured with a charging time counter. Whenever the sampling control unit enters the single sampling working state, the charge released by the capacitor inside a touch button charges the capacitor inside the corresponding sampling branch; the sampling control unit is used to control the charging time counter to count the charging time of the capacitor inside the corresponding sampling branch under the driving action of the clock signal provided by the clock source. Whenever the capacitor inside the touch button finishes discharging, the count value of the charging time counter is saved and configured as the capacitance sampling value of the touch button in one sampling to identify the change in the discharge amount of the capacitor inside the touch button, and then the capacitance sampling value is transmitted to the average filtering unit. Whenever the sampling control unit enters the single sampling working state a certain number of times, it is determined that the touch button has completed one touch pre-debouncing and enters the low power delay working state, and the charging time counter is controlled to keep its count value unchanged; when the sampling control unit jumps back from the low power delay working state to the single sampling working state, the charging time counter is controlled to continue counting to continue counting the charging time of the capacitor inside the corresponding sampling branch.
5. The digital processing system according to claim 4, characterized in that, Each sampling branch of the capacitor sampling circuit is an RC oscillation circuit. All sampling branches share a discharge feedback port, which outputs a first valid level when the capacitor inside the currently sampled touch button has finished discharging, and triggers the charging time counter to pause counting when the first valid level is output at the discharge feedback port. The discharge feedback port also outputs a second valid level when the capacitor inside the currently sampled touch button has not finished discharging. Whenever the discharge feedback port outputs the first valid level, the sampling control unit feeds back a flag signal to the clock source, causing the clock source to drive the capacitor inside the touch button to charge, so as to charge the capacitor inside the RC oscillation circuit in the subsequent single sampling operation state.
6. The digital processing system according to claim 4, characterized in that, Under the scheduling of the sampling control unit, after all the touch buttons in the group of touch buttons have completed a round of button debouncing operation, the system enters the function multiplexing working state. Then, the input port of the digital processing system used to receive feedback signals or capacitance sampling values is multiplexed into the output port of the LED to send control signals to adjust the brightness of the LED. The port of the digital processing system used to select touch buttons is also multiplexed into the selection of one of the LEDs in the LED array, so that the brightness of the selected LED is adjusted by the input port of the digital processing system used to receive the feedback signals or capacitance sampling values. The feedback signal is a signal that reflects the discharge status of the capacitor inside the touch button. The feedback signal originates from an output port of a sampling branch electrically connected to the capacitor inside the touch button. The feedback signal represents the charging voltage signal of the capacitor in the sampling branch electrically connected to the capacitor inside the touch button. An output port of the sampling branch electrically connected to the capacitor inside the touch button is configured as a discharge feedback port. Output ports of corresponding sampling branches electrically connected to the capacitors inside other touch buttons in the same group are all connected to this discharge feedback port, so that all sampling branches in the capacitor sampling circuit share this discharge feedback port. The sampling branch includes a capacitor. One of the output ports of the sampling branch, which is electrically connected to the capacitor inside the touch button, is the input port of the LED.
7. The digital processing system according to claim 2, characterized in that, The average filtering unit is used to remove the maximum and minimum values of the capacitance samples from all the capacitance samples of the same touch button sampled by the sampling control unit in each key touch pre-debounce, and then calculate the average value of the remaining capacitance samples to obtain the average capacitance sample value of the touch button. When the average filtering unit detects that the average sampled value of the capacitance of the touch button is less than or equal to the reference capacitance value of the touch button, it determines that the touch button is in a non-touch state. When the average filtering unit detects that the average sampled value of the capacitance of the touch button is greater than the reference capacitance value of the touch button, it determines that the touch button is in a state of being coarsely touched. In each round of key debouncing operation, the average filtering unit is used to determine whether the same touch key is in the coarse touch state in the key pre-debouncing of the preset number of judgments. If so, it is determined that the touch key is in the touch valid state and thus the touch key is touched. Otherwise, it is determined that the touch key is in the release valid state and the touch key is not touched. The sampling control unit is also used to transmit the average capacitance sampling value of the touch button calculated by the average filtering unit to the register configuration unit in each round of button debouncing operation, so as to be read externally.
8. The digital processing system according to claim 7, characterized in that, The average filtering unit includes a reference value processing unit and a reference capacitance value register; The reference value processing unit is used to update the average sampled value output by the average filtering unit to the reference capacitance value stored in the reference capacitance value register and configure it as the reference capacitance value of the touch button whenever the touch button is pre-debounced once. The reference value processing unit is also used to keep the reference capacitance value stored in the reference capacitance value register unchanged whenever the average filtering unit determines that the touch button has been touched after the button touch pre-debouncing is performed once on a touch button. Each reference capacitance value register is connected to a corresponding sampling branch within the capacitance sampling circuit, and each reference capacitance value register is matched with a corresponding touch button.
9. The digital processing system according to claim 5, characterized in that, The sampling control unit includes a key scan counter and a key count counter; A key scan counter is used to drive the sampling control unit to sample the capacitance value of a touch button in a discharging state within a group of touch buttons; wherein, the touch button in a discharging state is the touch button sampled when the discharge feedback port outputs the first valid level; When the capacitor of the touch button finishes discharging, the sampling control unit samples the capacitance value of the touch button and transmits the capacitance value to the averaging filter unit, and controls the button scan counter to count once, while determining that one sampling of the capacitance value of the touch button is completed within the single sampling working state; Whenever the change value of the key scan counter reaches the first preset number, it is determined that the sampling control unit has completed one key touch pre-debouncing of the capacitance sampling value of the touch key, and then the control unit is triggered to count the debouncing count once. After the low power delay working state, the sampling control unit is driven to start sampling the capacitance sampling value of the same touch key in the same group of touch keys that is in the discharge state. Whenever the change in the count value of the debounce count counter reaches the preset debounce count, it is determined that one round of key debounce operation for that touch button is completed. The key count counter counts once to switch to another touch button in the same group of touch buttons, and drives the sampling control unit to sample the capacitance value of the other touch button that is in a discharging state. Until the change in the count value of the key count counter reaches the second preset count, it is determined that the sampling control unit has completed one round of key debounce operation for all touch buttons in the same group of touch buttons, and the sampling control unit ends the sampling of the group of touch buttons. The number of all touch buttons in the same group of touch buttons is equal to the second preset count.
10. The digital processing system according to claim 9, characterized in that, If the change in the key scan counter reaches the first preset number, the change in the debouncing count counter reaches the preset debouncing number, and the change in the key count counter reaches the second preset number, then the following situation exists: When the state machine is not in a low-power delay working state and the discharge feedback port outputs the first effective level, it is determined that the sampling control unit has completed one round of key debouncing operation of the capacitance sampling values of all touch keys in the same group of touch keys, and the sampling control unit ends the sampling of the group of touch keys. When the state machine is not in a low-power delay working state, the discharge feedback port outputs a second valid level, and the state machine is in a function multiplexing working state, it is determined that the sampling control unit has completed one round of key debouncing operation on the capacitance sampling values of all touch keys in the same group of touch keys. The sampling control unit ends the sampling of the capacitance sampling values of each touch key in the same group of touch keys. The time from the first sampled touch key in the same group of touch keys entering the single sampling working state to the last sampled touch key in the same group undergoing the last key touch pre-debouncing reaches a preset total sampling time threshold. The preset total sampling time threshold is configured by the register configuration unit.
11. The digital processing system according to claim 10, characterized in that, For a currently sampled touch button, under the conditions that the state machine is not in a low-power delay operating state and the discharge feedback port outputs a second valid level, or under the conditions that the sampling control unit has been in a low-power delay operating state for a period of time equal to the reference time interval and the discharge feedback port outputs a second valid level, the following situations exist: When the change in the count value of the key scan counter does not reach the first preset number, the change in the count value of the key count counter does not reach the second preset number, and the change in the count value of the debouncing count counter does not reach the preset debouncing number, the state machine jumps to the single sampling working state, and at the same time triggers the key scan counter to count once, and keeps the count values of the key count counter and the debouncing count counter unchanged. When the change in the count value of the key scan counter reaches the first preset number, and the change in the count value of the key count counter does not reach the second preset number, and the change in the count value of the debouncing count counter does not reach the preset debouncing number, the state machine jumps to the single sampling working state, and simultaneously triggers the key scan counter to count once, and triggers the debouncing count counter to count once, while maintaining the count value of the key count counter unchanged. When the change in the count value of the key scan counter reaches the first preset number, the change in the count value of the key count counter does not reach the second preset number, and the change in the count value of the debouncing count counter reaches the preset debouncing number, the state machine jumps to the single sampling working state, and simultaneously triggers the key count counter to count once and the debouncing count counter to count once.
12. A chip, characterized in that, The chip includes the digital processing system according to any one of claims 1 to 11.
Citation Information
Patent Citations
Capacitive touch detecting device capable of self-calibration
US20200241665A1