Adaptive key debounce digital processing method and system based on branch prediction

Through the adaptive key debounce method based on branch prediction, the key debounce time is dynamically adjusted, which solves the problem of poor user experience caused by the fixed debounce time in the existing technology, and improves the comfort of different groups of people and key types.

CN116186086BActive Publication Date: 2024-10-22辰芯半导体(深圳)有限公司
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202310090314.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-09
Publication Date
2024-10-22
Estimated Expiration
2043-02-09

AI Technical Summary

Technical Problem

The existing button debounce technology has a fixed debounce time and cannot adapt to differences in different groups of people and button types, resulting in poor user experience, especially for e-sports players and the elderly. Customized designs also cause waste of resources and difficulty in design transplantation. question.

Method used

The adaptive key debounce digital processing method based on branch prediction is adopted. By receiving the key signal, the key jitter time is calculated, the debounce time is dynamically adjusted, and the preset debounce time is adjusted based on the comparison between the debounce delay time and the reference time. Achieve personalized key debounce.

Benefits of technology

It achieves dynamic matching of button debounce time, improves the comfort of different groups of people and button types, improves the experience of e-sports players, and avoids waste of resources and difficulties in design transplantation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116186086B_ABST
    Figure CN116186086B_ABST
Patent Text Reader

Abstract

The present invention proposes an adaptive key debouncing digital processing method based on branch prediction, and the method includes the following steps: when receiving a key signal, determining whether the current key signal is the first key signal; if it is determined that the current key signal is the first key signal, obtaining the key signal cached when the key is pressed; calculating the key jitter time according to the cached key signal; calculating the debouncing delay time according to the preset predicted debouncing time and the key jitter time; calculating the predicted debouncing time according to the comparison of the debouncing delay time and the reference time, and storing it; if it is determined that the current key signal is not the first key signal, debouncing the current key signal according to the stored predicted debouncing time. The present invention dynamically adjusts the key debouncing time according to the debouncing delay time, so that the key debouncing time matches different objects.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of key debouncing, and in particular to an adaptive key debouncing digital processing method based on branch prediction and a system thereof. Background Art

[0002] The debounce time of the current key debounce technology is fixed at the time of design, such as the above-mentioned 40ms, which cannot be changed. However, the key jitter time will vary due to the different mechanical characteristics of the key and the different user groups. For example, the jitter time when the elderly and hand-disabled people press the key is generally slightly longer than the average time, while the jitter time when young people or e-sports players press the key is generally shorter than the average time; the jitter time of long-stroke, high-damping key types is also longer than that of short-stroke, low-damping key types. In order to ensure that the key is not misjudged when pressed, the existing method is to debounce for 30-40ms (40ms is generally the limit time from rapid pressing to rebounding). Although this can ensure that the key is not easily misjudged when pressed, it also leads to the fact that the comfort of key use for different groups and different key types cannot be optimal. For example, when the key jitter time is 5ms and the debounce time is 40ms, it will cause a delay of 35ms, which cannot bring the best experience to the e-sports crowd, unless the design is customized according to different user groups and key types, but this will cause a waste of resources and difficulties in design transplantation. Summary of the invention

[0003] The main purpose of the present invention is to propose an adaptive key debouncing digital processing method based on branch prediction and its system, aiming to dynamically adjust the key debouncing time so that the debouncing time matches different objects.

[0004] Therefore, the present invention proposes an adaptive key debouncing digital processing method based on branch prediction, the method comprising the following steps:

[0005] When receiving a key signal, determining whether the current key signal is the first key signal;

[0006] If it is determined that the current key signal is the first key signal, then the key signal cached when the key is pressed is obtained;

[0007] Calculate the key jitter time based on the cached key signal;

[0008] Calculating the de-jitter delay time according to the preset predicted de-jitter time and the key jitter time;

[0009] Calculate the predicted de-jitter time based on the comparison between the de-jitter delay time and the reference time, and store the calculated de-jitter time;

[0010] If it is determined that the current key signal is not the first key signal, de-bounce the current key signal according to the predicted de-bounce time.

[0011] Optionally, when a key signal is received, determining whether the current key signal is a first key signal comprises: when a key signal is received, performing an N+1 operation, and determining whether N+1-N is equal to 1;

[0012] If it is determined that the current key signal is the first key signal, obtaining the key signal cached when the key is pressed includes: if it is determined that N+1-N is equal to 1, obtaining the key signal cached when the key is pressed;

[0013] If it is determined that the current key signal is not the first key signal, de-bouncing the current key signal according to the stored predicted de-bouncing time includes: if it is determined that N+1-N is greater than 1, de-bouncing the current key signal according to the stored predicted de-bouncing time.

[0014] Optionally, calculating the de-bouncing delay time according to the preset predicted de-bouncing time and the key jitter time includes: calculating the de-bouncing delay time according to the difference between the preset predicted de-bouncing time and the key jitter time.

[0015] Optionally, calculating the predicted de-jittering time according to the comparison of the de-jittering delay time and the reference time includes:

[0016] When the de-jitter delay time is greater than the reference time, it is determined that the de-jitter delay time is too long;

[0017] The preset predicted debounce time jumps to the de-valued state and de-values;

[0018] The current predicted debouncing time is determined according to the preset predicted debouncing time after the value reduction.

[0019] Optionally, calculating the predicted de-jittering time according to the comparison of the de-jittering delay time and the reference time includes:

[0020] When the de-jitter delay time is less than the reference time, it is determined that the de-jitter delay time is too short;

[0021] The preset predicted debounce time jumps to the value-added state and increases the value;

[0022] The current predicted debouncing time is determined according to the preset predicted debouncing time after the value increase.

[0023] Optionally, calculating the predicted de-jittering time according to the comparison of the de-jittering delay time and the reference time includes:

[0024] When the de-jitter delay time is equal to the reference time, determining that the de-jitter delay time is optimal;

[0025] Preset predicted debounce time to jump to static state;

[0026] Determine whether the current predicted debounce time is equal to the preset predicted debounce time.

[0027] The present invention also proposes an adaptive key debouncing digital processing system based on branch prediction, including a cache component and a prediction debouncing component;

[0028] The prediction debouncing component is electrically connected to the cache component;

[0029] The cache component is used to calculate the key jitter time;

[0030] The predictive debouncing component is used to calculate the debouncing delay time according to the preset predicted debouncing time and the key jitter time, and to calculate the predicted debouncing time according to the debouncing delay time and the reference time.

[0031] Optionally, the branch prediction-based adaptive key debouncing digital processing system further includes a key debouncing component;

[0032] The key debouncing component is electrically connected to the prediction debouncing component;

[0033] The key debouncing component is used to receive the predicted debouncing time of the predicted debouncing component, and perform key debouncing on the current key signal according to the predicted debouncing time.

[0034] Optionally, the predictive debouncing component includes a decreasing state, an increasing state and a static state.

[0035] Optionally, the prediction debouncing component is implemented using a two-bit key prediction counter.

[0036] The present invention proposes an adaptive key debouncing digital processing method based on branch prediction, and the method includes the following steps: when receiving a key signal, determining whether the current key signal is the first key signal; if it is determined that the current key signal is the first key signal, obtaining the key signal cached when the key is pressed; calculating the key jitter time according to the cached key signal; calculating the debouncing delay time according to the preset predicted debouncing time and the key jitter time; calculating the predicted debouncing time according to the comparison of the debouncing delay time and the reference time, and storing it; if it is determined that the current key signal is not the first key signal, debouncing the current key signal according to the stored predicted debouncing time. The present invention dynamically adjusts the key debouncing time according to the debouncing delay time, so that the key debouncing time matches different objects. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the structures shown in these drawings without paying creative work.

[0038] Figure 1 It is a schematic diagram of the circuit function modules of the adaptive key debouncing digital processing method based on branch prediction and the system thereof of the present invention;

[0039] Figure 2 It is a schematic diagram of circuit function modules of another embodiment of the adaptive key debouncing digital processing method and system thereof based on branch prediction of the present invention;

[0040] Figure 3 It is a flow chart of the adaptive key debouncing digital processing method and system based on branch prediction of the present invention;

[0041] Figure 4 for Figure 3 When a key signal is received, a detailed flow chart of determining whether the current key signal is the first key signal;

[0042] Figure 5 for Figure 3 A detailed flow chart of calculating the predicted de-jittering time according to the comparison between the de-jittering delay time and the reference time;

[0043] Figure 6 for Figure 3 A detailed flow chart of another embodiment of calculating the predicted de-jittering time according to the de-jittering delay time and the reference time;

[0044] Figure 7 for Figure 3 A detailed flow chart of another embodiment of calculating the predicted de-jittering time based on the comparison between the de-jittering delay time and the reference time.

[0045] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0046] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0047] It should be noted that all directional indications (such as up, down, left, right, front, back, etc.) in the embodiments of the present invention are only used to explain the relative position relationship, movement status, etc. between the components under a certain specific posture (as shown in the accompanying drawings). If the specific posture changes, the directional indication will also change accordingly.

[0048] In the present invention, unless otherwise clearly specified and limited, the terms "connection", "fixation", etc. should be understood in a broad sense. For example, "fixation" can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, it can be the internal connection of two elements or the interaction relationship between two elements, unless otherwise clearly defined. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0049] In addition, in the present invention, descriptions such as "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in the field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such a combination of technical solutions does not exist and is not within the scope of protection required by the present invention.

[0050] It should be understood that the switches usually used for key jitter are mechanical elastic switches. When the mechanical contacts are disconnected and closed, due to the elastic effect of the mechanical contacts, a key switch will not be immediately stably connected when closed, nor will it be completely disconnected at once when disconnected, but will be accompanied by a series of jitters at the moment of closing and disconnecting. The jitter time is determined by the mechanical characteristics of the key, and is generally between 5-10ms. The debounce time of the current key debounce technology is fixed at the time of design, such as the above-mentioned 40ms, which cannot be changed. However, the key jitter time will vary due to the different mechanical characteristics of the key and the different user groups. For example, the jitter time when the elderly and hand-disabled people press the key is generally slightly longer than the average time, while the jitter time when young people or e-sports players press the key is generally shorter than the average time; the long-stroke, high-damping key type also has a longer jitter time than the short-stroke, low-damping key type. To ensure that the button is not misjudged when pressed, the existing method is to debounce for 30-40ms (40ms is generally the maximum time from a quick press to a bounce). Although this can ensure that the button is not easily misjudged when pressed, it also results in the inability to achieve the best comfort for different groups of people and different button types. For example, if the button jitter time is 5ms and the debounce time is 40ms, it will cause a 35ms delay, which cannot bring the best experience to the e-sports crowd, unless the design is customized according to different user groups and button types, but this will cause a waste of resources and difficulties in design transplantation.

[0051] The present invention proposes an adaptive key debouncing digital processing method based on branch prediction, the method comprising the following steps:

[0052] When receiving the key signal Key, determining whether the current key signal Key is the first key signal Key;

[0053] If it is determined that the current key signal Key is the first key signal Key, then the key signal Key cached when the key is pressed is obtained;

[0054] Calculate the key jitter time Tj according to the cached key signal Key;

[0055] Calculate the de-jitter delay time Td according to the preset predicted de-jitter time Tdj and the key jitter time Tj;

[0056] According to the comparison between the de-jitter delay time Td and the reference time Tre, the predicted de-jitter time Tdjp is calculated and stored;

[0057] If it is determined that the current key signal Key is not the first key signal Key, de-bounce is performed on the current key signal Key according to the predicted de-bounce time Tdjp.

[0058] Specifically, when the user presses the key for the first time, the key outputs the first key signal Key to the cache component 10 to trigger the cache component 10 to work, so that the cache component 10 caches the key signal Key corresponding to the first key signal Key, and calculates and outputs the key jitter time Tj based on the cached key signal Key. Among them, the key jitter time Tj can be used as the key input signal Tj of the prediction de-jitter component 20 to trigger the prediction de-jitter component 20 to work. Further, after being triggered, the prediction de-jitter component 20 outputs the preset prediction de-jitter time Tdj set by the user to the key de-jitter component 30, so that the key de-jitter component 30 de-jitters the first key signal Key according to the preset prediction de-jitter time Tdj, ​​and outputs the signal Key_de after key de-jittering to the mechanical contact of the key to complete the key de-jitter work of the mechanical contact. It should be understood that when determining that the user presses the key for the first time, the preset prediction de-jitter time Tdj can be set by the user, which is not limited here.

[0059] When the cache component 10 outputs the key input signal Tj to the prediction de-jitter component 20 to trigger the prediction de-jitter component 20 to output the preset prediction de-jitter time Tdj to the key de-jitter component 30, the prediction de-jitter component 20 will also obtain the de-jitter delay time Td based on the difference between the currently received key jitter time Tj and the preset prediction de-jitter time Tdj. For example, the user sets the preset prediction de-jitter time Tdj to 20ms, and when the key jitter time Tj calculated by the cache component 10 is 5ms, the delay time Td is the difference between the preset prediction de-jitter time Tdj and the key jitter time Tj (20ms-5ms=15ms). In addition, when it is determined that the user is not pressing the key for the first time, the preset prediction de-jitter time Tdj is the last prediction de-jitter time Tdjp. That is, when the user is not pressing the key for the first time, the prediction de-jitter time Tdjp calculated by the prediction de-jitter component 20 when the key was pressed last time will be input as the preset prediction de-jitter time Tdj of the current prediction de-jitter component 20.

[0060] Furthermore, the predictive de-jitter component 20 also contains a fixed reference time Tre. On the premise that the user presses the button for the first time, the predictive de-jitter component 20 obtains the corresponding de-jitter delay time Td based on the difference between the button jitter time Tj and the preset predicted de-jitter time Tdj. Further, the predictive de-jitter component 20 compares the de-jitter delay time Td with the reference time Tre, and determines whether the current de-jitter delay time Td is too long or too short based on the comparison result, and then adjusts the preset predicted de-jitter time Tdj to increase or decrease in value. When the de-jitter delay time Td is greater than the reference time Tre, it is determined that the de-jitter delay time Td is too long, and it is further determined that the preset predicted de-jitter time Tdj set by the current user is too long. The preset predicted de-jitter time Tdj jumps to the de-jitter state and is de-jittered. The de-jittered preset predicted de-jitter time Tdj is output as the current predicted de-jitter time Tdjp. When the de-bouncing delay time Td is less than or equal to the reference time Tre, it is determined that the de-bouncing delay time Td is too short, and it is further determined that the preset predicted de-bouncing time Tdj set by the current user is too short. The preset predicted de-bouncing time Tdj jumps to the value-added state and increases in value. The preset predicted de-bouncing time Tdj after the value-added is used as the current predicted de-bouncing time Tdjp.

[0061] In one embodiment, the key jitter time Tj is 5ms, the preset predicted de-jitter time Tdj is 25ms, the de-jitter delay time Td is 20ms, the fixed time value is 0.5ms, and the reference time Tre is 15ms. It should be understood that the fixed time value is set by the user. If the de-jitter delay time Td is greater than the reference time Tre (20ms>15ms), it can be determined that the de-jitter delay time Td is too long, and further it is determined that the preset predicted de-jitter time Tdj set by the user is too long. Since the de-jitter delay time Td is equal to the preset predicted de-jitter time Tdj minus the key de-jitter time (Td=Tdj-Tj), when the de-jitter delay time Td is too long, the preset predicted de-jitter time Tdj can be reduced to reduce the fixed time value, and the current predicted de-jitter time Tdjp is equal to the preset predicted de-jitter time Tdj minus the fixed time value. It should be understood that when the user presses the button once, the preset predicted de-bounce time Tdj is reduced once, that is, the fixed time value is reduced once; when the user presses the button multiple times and the de-bounce delay time Td is still greater than the reference time Tre, the preset predicted de-bounce time Tdj is reduced multiple times (Td=Tdj-0.5ms-Tj) until the de-bounce delay time Td is less than or equal to the reference time Tre (Td≤15ms) to obtain the best predicted de-bounce time Tdjp. Therefore, according to the user's multiple keystrokes to de-bounce the key signal Key, the calculated predicted de-bounce time Tdjp will become more accurate as the number of times increases. For example, the key jitter time Tj is 5ms, and the condition for Td≤15ms is Tdj-0.5ms≤20ms. Furthermore, since the preset predicted de-bounce time Tdj is 25ms, Tdj-0.5ms must be pressed at least 10 times or more to make Tdj-0.5ms≤20ms and Td≤15ms at the same time. That is, the user needs to press the key at least 10 times or more to make Tdj-0.5ms≤20ms to obtain the best predicted debounce time Tdjp.

[0062] In another embodiment, the key jitter time Tj is 5ms, the preset predicted de-jitter time Tdj is 15ms, the de-jitter delay time Td is 10ms, the fixed time value is 0.5ms, and the reference time Tre is 15ms. It should be understood that the fixed time value is set by the user. If the de-jitter delay time Td is less than the reference time Tre (10ms < 15ms), it can be determined that the de-jitter delay time Td is too short, and further it is determined that the preset predicted de-jitter time Tdj set by the user is too short. Since the de-jitter delay time Td is equal to the preset predicted de-jitter time Tdj minus the key de-jitter time (Td = Tdj-Tj), when the de-jitter delay time Td is too short, the preset predicted de-jitter time Tdj can be increased to increase the fixed time value, and the current predicted de-jitter time Tdjp is equal to the preset predicted de-jitter time Tdj plus the fixed time value. It should be understood that when the user presses the button once, the preset predicted de-bounce time Tdj will be incremented once, that is, the fixed time value will be increased once; when the user presses the button multiple times and the de-bounce delay time Td is still less than the reference time Tre, the preset predicted de-bounce time Tdj will be incremented, that is, multiple fixed time values ​​will be increased (Td=Tdj+0.5ms-Tj) until the de-bounce delay time Td is greater than or equal to the reference time Tre (Td≥15ms) to obtain the best predicted de-bounce time Tdjp. Therefore, according to the user's multiple keystrokes to de-bounce the key signal Key, the calculated predicted de-bounce time Tdjp will become more accurate as the number of times increases. For example, the key jitter time Tj is 5ms, and the condition for Td≥15ms is Td+0.5ms≥20ms. Furthermore, since the preset predicted de-bounce time Tdj is 15ms, Tdj+0.5ms must be pressed at least 10 times or more to make Tdj+0.5ms≥20ms and Td≥15ms at the same time. That is, the user needs to press the key at least 10 times or more to make Tdj+0.5ms≥20ms to obtain the best predicted debounce time Tdjp.

[0063] The present invention proposes an adaptive key debouncing digital processing method based on branch prediction, the method comprising the following steps: when receiving a key signal Key, determining whether the current key signal Key is the first key signal Key; if it is determined that the current key signal Key is the first key signal Key, obtaining the key signal Key cached when the key is pressed; calculating the key jitter time Tj according to the cached key signal Key; calculating the debouncing delay time Td according to the preset predicted debouncing time Tdj and the key jitter time Tj; calculating the predicted debouncing time Tdjp according to the debouncing delay time Td and the reference time Tre, and storing it; if it is determined that the current key signal Key is not the first key signal Key, debouncing the current key signal Key according to the stored last predicted debouncing time Tdjp. The present invention dynamically adjusts the key debouncing time according to the debouncing delay time, so that the key debouncing time matches different objects.

[0064] In this embodiment, refer to Figure 3 and Figure 4 , when the key signal Key is received, determining whether the current key signal Key is the first key signal Key includes: when the key signal Key is received, performing N+1 operation, and determining whether N+1-N is equal to 1;

[0065] If it is determined that the current key signal Key is the first key signal Key, obtaining the key signal Key cached when the key is pressed includes: determining whether N+1-N is equal to 1, and if it is determined that N+1-N is equal to 1, obtaining the key signal Key cached when the key is pressed;

[0066] If it is determined that the current key signal Key is not the first key signal Key, de-bouncing the current key signal Key according to the stored predicted de-bouncing time Tdjp includes: if it is determined that N+1-N is greater than 1, de-bouncing the current key signal Key according to the stored predicted de-bouncing time Tdjp.

[0067] It should be understood that the present invention determines whether the preset predicted de-bouncing time Tdj set by the user is too long or too short by comparing the de-bouncing delay time Td with the reference time Tre, and further adjusts the value of the preset predicted de-bouncing time Tdj to calculate the predicted de-bouncing time Tdjp, so that the key de-bouncing component 30 de-bouncing the current key signal Key according to the predicted de-bouncing time Tdjp, thereby allowing the user to achieve a better key experience.

[0068] The debounce delay time Td is the difference between the preset predicted debounce time Tdj and the key jitter time Tj (Td=Tdj-Tj). Among them, the key jitter time Tj can be calculated based on the key signal Key cached by the cache component 10, and the preset predicted debounce time Tdj needs to be set by the user. Therefore, when the user presses the key for the first time, the key debounce component 30 uses the preset predicted debounce time Tdj set by the user as the current predicted debounce time Tdjp to debounce the first key signal Key and output the debounced signal Key_de to the mechanical contact of the key to complete the key debounce work of the mechanical contact. In addition, while the prediction de-bouncing component 20 outputs the preset prediction de-bouncing time Tdj to the key de-bouncing component 30 so that the key de-bouncing component 30 de-bounces the first key signal Key according to the preset prediction de-bouncing time Tdj, ​​the prediction de-bouncing component 20 also calculates the predicted de-bouncing time Tdjp based on the de-bouncing delay time Td and the reference time Tre and stores it, so that when the user presses the button next time, the prediction de-bouncing component 20 will use the stored last predicted de-bouncing time Tdjp as a reference time for de-bouncing the current key signal Key.

[0069] Therefore, when the user presses a key, it is necessary to first determine whether the key signal Key output by the current key is the first key signal Key. For example, when the key signal Key is pressed for the first time, N=1, N+1-N=1, and it is determined that N+1-N is equal to 1, then the key signal Key cached when the key is pressed is obtained, and the current key signal Key is debounced according to the preset predicted debounce time Tdj set by the user; when the key signal Key is pressed for the second time, N=2, N+1-N=2, and it is determined that N+1-N is greater than 1, then the current key signal Key is debounced according to the last predicted debounce time Tdjp stored in the predicted debounce component 20. When the key signal Key is pressed for the third time, N=3, N+1-N=3, and it is determined that N+1-N is greater than 1, then the current key signal Key is debounced according to the last predicted debounce time Tdjp stored in the predicted debounce component 20.

[0070] In this embodiment, the step of calculating the de-bouncing delay time Td according to the preset predicted de-bouncing time Tdj and the key jitter time Tj includes: calculating the de-bouncing delay time Td according to the difference between the preset predicted de-bouncing time Tdj and the key jitter time Tj.

[0071] It is understandable that the key jitter time Tj will vary due to the different mechanical characteristics of the keys and the different user groups. For example, the key jitter time Tj of the elderly and hand-disabled people when pressing keys is generally slightly longer than the average time, while the key jitter time Tj of young people or e-sports players when pressing keys is generally shorter than the average time; the key jitter time Tj of long-stroke, high-damping keys is also longer than that of short-stroke, low-damping keys. For example, when the key jitter time Tj is 5ms and the predicted de-jitter time is 40ms, it will cause a de-jitter delay time of 35ms, which cannot bring the best experience to the e-sports crowd.

[0072] Therefore, before debouncing the key signal Key, it is necessary to determine whether the debouncing delay time Td is too long or too short to avoid affecting the user's key pressing experience when the debouncing delay time Td is too long or too short. In addition, when the user presses the key for the first time, the debouncing delay time Td can be calculated based on the difference between the preset predicted debouncing time Tdj and the key jitter time Tj (Td=Tdj-Tj), where the preset predicted debouncing time Tdj is set by the user; when the user does not press the key for the first time, the debouncing delay time Td can be calculated based on the difference between the last predicted debouncing time Tdj and the key jitter time Tj stored in the predicted debouncing component 20 (Td=Tdj-Tj).

[0073] In this embodiment, refer to Figure 5 , the calculation of the predicted de-jittering time Tdjp according to the comparison of the de-jittering delay time Td and the reference time Tre comprises:

[0074] When the de-jitter delay time Td is greater than the reference time Tre, it is determined that the de-jitter delay time Td is too long;

[0075] The preset predicted debounce time Tdj jumps to the decrement state and decrements;

[0076] The current predicted de-bouncing time Tdjp is determined according to the preset predicted de-bouncing time Tdj after the reduction.

[0077] It can be understood that when the de-bouncing delay time Td is greater than the reference time Tre (Td>Tre), it can be determined that the de-bouncing delay time Td is too long. Since the de-bouncing delay time Td is the difference between the preset predicted de-bouncing time Tdj and the key jitter time Tj (Td=Tdj-Tj), when the de-bouncing delay time Td is too long, the binary value of the preset predicted de-bouncing time Tdj can be reduced to shorten the de-bouncing delay time Td. When the user presses the key multiple times and the de-bouncing delay time Td is still greater than the reference time Tre, the preset predicted de-bouncing time Tdj jumps to the reduced value state multiple times, and each time the preset predicted de-bouncing time Tdj is reduced by a fixed time value, thereby indirectly reducing the de-bouncing delay time Td until the de-bouncing delay time Td is less than or equal to the reference value Tre (Td≤Tre). In this embodiment, the fixed time value is set to 0.5ms, and the reference time Tre is set to 15ms as an example for explanation.

[0078] For example, when the user presses the button for the first time, the de-bounce delay time Td is greater than the reference time Tre (Td>Tre), the preset predicted de-bounce time Tdj jumps to the decreasing state for the first time, and the de-bounce delay time Td is the value of the preset predicted de-bounce time Tdj minus 0.5ms minus the value of the key jitter time Tj (Td=Tdj-0.5ms-Tj); when the user presses the button for the second time, the de-bounce delay time Td is still greater than the reference time Tre (Td>Tre), the preset predicted de-bounce time Tdj decreases for the second time, and the de-bounce delay time Td The preset predicted debounce time Tdj minus 0.5ms twice minus the key jitter time Tj (Td=Tdj-0.5ms-0.5ms-Tj); when the user presses the key for the third time, the debounce delay time Td is still greater than the reference time Tre (Td>Tre), and the preset predicted debounce time Tdj is reduced for the third time, and the debounce delay time Td is the preset predicted debounce time Tdj minus 0.5ms three times minus the key jitter time Tj (Td=Tdj-0.5ms-0.5ms-0.5ms-Tj). When the user presses the key for the Nth time (N can be regarded as the number of key presses by the user and the number of preset predicted debounce time Tdj), the debounce delay time Td is less than or equal to the reference value Tre (Td≤15ms), and the preset predicted debounce time Tdj-0.5ms×N is used as the current predicted debounce time Tdjp.

[0079] For example, when a user presses a key for the first time, the key jitter time Tj is 5ms, the preset predicted debounce time Tdj is 25ms, the debounce delay time Td is 20ms, the fixed time value is 0.5ms, and the reference time Tre is 15ms. The debounce delay time Td is greater than the reference time Tre (20ms>15ms), the preset predicted debounce time Tdj jumps to the decrement state and decreases by 0.5ms, and the current predicted debounce time Tdjp is Tdjp=Tdj-0.5ms=25ms-0.5ms=24.5ms.

[0080] Furthermore, when the user presses the button for the second time, the button jitter time Tj is 5ms, the preset predicted debounce time Tdj is 24.5ms, the debounce delay time Td is 19.5ms, the fixed time value is 0.5ms, and the reference time Tre is 15ms. The debounce delay time Td is still greater than the reference time Tre (19.5ms>15ms), the preset predicted debounce time Tdj remains in the degraded state and decreases by 0.5ms, and the current predicted debounce time Tdjp is Tdjp=Tdj-0.5ms=24.5ms-0.5ms=24ms.

[0081] Until the user presses the key for the tenth time, the debounce delay time Td is less than or equal to the reference time Tre (Td≤15ms). Since the key jitter time Tj is set to 5ms, the condition for Td≤15ms is Tdj-0.5ms≤20ms. Furthermore, since the preset predicted debounce time Tdj is 25ms, Tdj-0.5ms must be pressed at least 10 times or more to make Tdj-0.5ms≤20ms and Td≤15ms at the same time. The current formula for the predicted debounce time Tdjp is Tdjp=Tdj-0.5ms×10=25ms-5ms=20ms.

[0082] Further, refer to Figure 6 , the calculation of the predicted de-jittering time Tdjp according to the comparison of the de-jittering delay time Td and the reference time Tre comprises:

[0083] When the de-jitter delay time Td is less than the reference time Tre, it is determined that the de-jitter delay time Td is too short;

[0084] The preset predicted debounce time Tdj jumps to the value-added state and increases in value;

[0085] The current predicted de-jitter time Tdjp is determined according to the preset predicted de-jitter time Tdj after the value increase.

[0086] It can be understood that when the de-bouncing delay time Td is less than the reference time Tre (Td<Tre), it can be determined that the de-bouncing delay time Td is too short. Since the de-bouncing delay time Td is the difference between the preset predicted de-bouncing time Tdj and the key jitter time Tj (Td=Tdj-Tj), when the de-bouncing delay time Td is too short, the binary value of the preset predicted de-bouncing time Tdj can be increased to extend the de-bouncing delay time Td. Specifically, the preset predicted de-bouncing time Tdj jumps to the value-added state, and each time the preset predicted de-bouncing time Tdj increases by a fixed time value, the de-bouncing delay time Td is indirectly increased until the de-bouncing delay time Td is greater than or equal to the reference value Tre (Td≥Tre). In this embodiment, the fixed time value is set to 0.5ms, and the reference time Tre is set to 15ms as an example for explanation.

[0087] For example, when the user presses a key for the first time, the debounce delay time Td is less than the reference time Tre (Td<Tre), and the preset predicted debounce time Tdj jumps to the increment state for the first time. The debounce delay time Td is the preset predicted debounce time Tdj plus 0.5ms minus the key jitter time Tj (Td=Tdj+0.5ms-Tj);

[0088] When the user presses the button for the second time, the de-bouncing delay time Td is still less than the reference time Tre (Td<Tre), and the preset predicted de-bouncing time Tdj is in the increment state for the second time, and the de-bouncing delay time Td is the preset predicted de-bouncing time Tdj plus two 0.5ms values ​​and then minus the key jitter time Tj value (Td=Tdj+0.5ms+0.5ms-Tj); when the user presses the button for the third time, the de-bouncing delay time Td is still less than the reference time Tre (Td<Tre), and the preset predicted de-bouncing time Tdj is in the increment state for the third time, and the de-bouncing delay time Td is the preset predicted de-bouncing time Tdj plus three 0.5ms values ​​and then minus the key jitter time Tj value (Td=Tdj+0.5ms+0.5ms+0.5ms-Tj). The user presses the key for the Nth time (N can be regarded as the number of times the user presses the key and the number of preset predicted de-bouncing time Tdj), the de-bouncing delay time Td is less than or equal to the reference value Tre (Td≤15ms), and the preset predicted de-bouncing time Tdj+0.5ms×N is used as the value of the current predicted de-bouncing time Tdjp.

[0089] For example, when a user presses a key for the first time, the key jitter time Tj is 5ms, the preset predicted debounce time Tdj is 15ms, the debounce delay time Td is 10ms, the fixed time value is 0.5ms, and the reference time Tre is 15ms. The debounce delay time Td is less than the reference time Tre (10ms<15ms), the preset predicted debounce time Tdj jumps to the value-added state and increases by 0.5ms, and the current predicted debounce time Tdjp is Tdjp=Tdj+0.5ms=15ms+0.5ms=15.5ms.

[0090] Furthermore, when the user presses the button for the second time, the button jitter time Tj is 5ms, the preset predicted de-jitter time Tdj is 15.5ms, the de-jitter delay time Td is 10.5ms, the fixed time value is 0.5ms, and the reference time Tre is 15ms. The de-jitter delay time Td is still less than the reference time Tre (10.5ms < 15ms), the preset predicted de-jitter time Tdj remains in the value-added state and increases by 0.5ms, and the current predicted de-jitter time Tdjp is Tdjp = Tdj + 0.5ms = 15.5ms + 0.5ms = 16ms.

[0091] Until the tenth time the user presses the button, the debounce delay time Td is greater than or equal to the reference time Tre (Td ≥ 15ms). Since the preset predicted debounce time Tdj is 15ms, Tdj+0.5ms must be pressed at least 10 times or more to make Tdj+0.5ms≥20ms and Td≥15ms. The current predicted debounce time Tdjp formula is Tdjp=Tdj+0.5ms×10=15ms+5ms=20ms.

[0092] Further, refer to Figure 7 , the calculation of the predicted de-jittering time Tdjp according to the comparison of the de-jittering delay time Td and the reference time Tre comprises:

[0093] When the de-jitter delay time Td is equal to the reference time Tre, it is determined that the de-jitter delay time Td is optimal;

[0094] The preset predicted de-jitter time Tdj jumps to the static state;

[0095] Determine whether the current predicted de-jitter time Tdj is equal to the preset predicted de-jitter time Tdjp.

[0096] It can be understood that when the de-bouncing delay time Td is equal to the reference time Tre (Td=Tre), the de-bouncing delay time Td can be determined to be the optimal time. The preset predicted de-bouncing time Tdj jumps to a static state, and its value does not increase or decrease. In this embodiment, the reference time Tre is set to 15ms. Therefore, when the user presses the button for the first time and the de-bouncing delay time Td is 15ms, the predicted de-bouncing time Tdjp calculated by the current predicted de-bouncing component 20 is equal to the preset predicted de-bouncing time Tdj set by the user (Tdjp=Tdj); in addition, when the user does not press the button for the first time and the de-bouncing delay time Td is 15ms, the predicted de-bouncing time Tdjp calculated by the current predicted de-bouncing component 20 is equal to the predicted de-bouncing time Tdj stored by the predicted de-bouncing component 20 last time (Tdjp=Tdj).

[0097] The present invention also proposes an adaptive key debounce digital processing system based on branch prediction, referring to Figure 1 , including a cache component 10 and a prediction and de-jitter component 20;

[0098] The prediction debouncing component 20 is electrically connected to the cache component 10;

[0099] The cache component 10 is used to calculate the key jitter time Tj;

[0100] The predictive debouncing component 20 is used to calculate the debouncing delay time Td according to the preset predicted debouncing time Tdj and the key jitter time Tj, and to calculate the predicted debouncing time Tdjp according to the debouncing delay time Td and the reference time Tre.

[0101] Specifically, when the user presses the key for the first time, the key outputs the first key signal Key to the cache component 10 to trigger the cache component 10 to work. The cache component 10 detects and caches the key signal Key when the user presses the key, and calculates the jitter time Tj of the key. The jitter time Tj of the key can be used as the key input signal of the prediction de-jitter component 20. Further, after being triggered, the prediction de-jitter component 20 outputs the preset prediction de-jitter time Tdj set by the user to the key de-jitter component 30, so that the key de-jitter component 30 de-jitters the first key signal Key according to the preset prediction de-jitter time Tdj, ​​and outputs the signal Key_de after key de-jittering to the mechanical contact of the key to complete the key de-jittering work of the mechanical contact. While the cache component 10 outputs the key input signal Tj to the prediction de-jitter component 20 to trigger the prediction de-jitter component 20 to output the preset prediction de-jitter time Tdj to the key de-jitter component 30, the prediction de-jitter component 20 will also obtain the de-jitter delay time Td according to the difference between the currently received key jitter time Tj and the preset prediction de-jitter time Tdj. Furthermore, the prediction de-jitter component 20 compares the de-jitter delay time Td with the reference time Tre, and determines and stores the current predicted de-jitter time Tdjp based on the comparison result.

[0102] Further, refer to Figure 1 , the branch prediction-based adaptive key debouncing digital processing system further includes a key debouncing component 30;

[0103] The key debouncing component 30 is electrically connected to the prediction debouncing component 20;

[0104] The key debouncing component 30 is used to receive the predicted debouncing time of the predicted debouncing component 20, and debouncing the current key signal Key according to the predicted debouncing time.

[0105] It can be understood that when the user presses a key for the first time, the prediction de-bouncing component 20 is triggered and outputs the preset prediction de-bouncing time Tdj set by the user to the key de-bouncing component 30, so that the key de-bouncing component 30 de-bounces the first key signal Key according to the preset prediction de-bouncing time Tdj, ​​and outputs the de-bouncing signal Key_de to the mechanical contacts of the key to complete the key de-bouncing work on the mechanical contacts.

[0106] In this embodiment, refer to Figure 2 The predictive debouncing component 20 includes a decreasing state, an increasing state and a static state.

[0107] It can be understood that, in this embodiment, the fixed time value is set to 0.5 ms.

[0108] Therefore, when the de-jitter delay time Td is greater than the reference time Tre (Td>Tre), the prediction de-jitter component 20 jumps to the de-value state, so that the preset prediction de-jitter time Tdj jumps to the de-value state. The preset prediction de-jitter time Tdj minus the fixed time value can determine the current prediction de-jitter time Tdjp as Tdj-0.5ms; when the de-jitter delay time Td is less than the reference time Tre (Td<Tre), the prediction de-jitter component 20 jumps to the value-added state, so that the preset prediction de-jitter time Tdj jumps to the de-value state. The jitter time Tdj jumps to the value-added state, and the preset predicted de-jitter time Tdj minus the fixed time value can determine the current predicted de-jitter time Tdjp as Tdj-+0.5ms; when the de-jitter delay time Td is equal to the reference time Tre (Td=Tre), the predicted de-jitter component 20 jumps to the static state, so that the preset predicted de-jitter time Tdj jumps to the static state, and the current predicted de-jitter time Tdjp is equal to the preset predicted de-jitter time Tdj (Tdjp=Tdj).

[0109] Further, refer to Figure 2 The prediction debouncing component 20 is implemented using a two-bit key prediction counter.

[0110] It can be understood that, in this embodiment, the two-digit key prediction counter includes a binary value 00, a binary value 01, a binary value 10, and a binary value 11, the binary value 00 corresponds to state 0, the binary value 01 corresponds to state 1, the binary value 10 corresponds to state 2, and the binary value 11 corresponds to state 3. Among them, state 0 is the increment state of the two-digit key prediction counter, state 1 and state 2 are the static states of the two-digit key prediction counter, and state 3 is the decrement state of the two-digit key prediction counter.

[0111] Specifically, refer to Figure 2 When the de-bouncing delay time Td is greater than the reference time Tre, the two-digit key prediction counter is a binary value of 00, which means that the two-digit key prediction counter jumps to state 0, that is, the two-digit key prediction counter jumps to the decreasing state; when the de-bouncing delay time Td is less than the reference time, the two-digit key prediction counter is a binary value of 11, which means that the two-digit key prediction counter is in state 3, that is, the two-digit key prediction counter jumps to the increasing state; when the de-bouncing delay time Td is equal to the reference time Tre, the two-digit key prediction counter is a binary value of 01 or a binary value of 10, which means that the two-digit key prediction counter is in state 1 or state 2, that is, the two-digit key prediction counter jumps to the static state.

[0112] In one embodiment, the initial value of the user's two-digit key prediction counter is set to 10, that is, the two-digit key prediction counter is in state 2, and the preset prediction de-jitter time Tdj is set to 25ms, the reference time is set to 15ms, and the fixed time value is set to 0.5ms. Further, when the cache component 10 outputs a key jitter time Tj of 5ms, the prediction de-jitter component 20 calculates a de-jitter delay time Td of 20ms based on the preset prediction de-jitter time Tdj of 25ms and the key jitter time Tj of 5ms; further, the de-jitter delay time Td is greater than the reference time Tre (20ms>15ms), at this time, the two-digit key prediction counter jumps from the binary value 10 to the binary value 11, that is, the two-digit key prediction counter jumps from state 2 to state 3. Since state 2 is a static state and state 3 is a decreasing state, the two-digit key prediction counter can be understood as jumping from a static state to a decreasing state. The current predicted de-jitter time Tdjp is calculated as Tdj-0.5=24.5 ms, and the predicted de-jitter time Tdjp of 24.5 ms is used as the value of the next preset predicted de-jitter time Tdj.

[0113] In another embodiment, the initial value of the user's two-digit key prediction counter is set to 01, that is, the two-digit key prediction counter is in state 1, and the preset prediction de-jitter time Tdj is set to 25ms, the reference time is set to 15ms, and the fixed time value is set to 0.5ms. Further, when the cache component 10 outputs a key jitter time Tj of 5ms, the prediction de-jitter component 20 calculates a de-jitter delay time Td of 20ms based on the preset prediction de-jitter time Tdj of 25ms and the key jitter time Tj of 5ms; further, the de-jitter delay time Td is greater than the reference time Tre (20ms>15ms), at this time, the two-digit key prediction counter jumps from the binary value 01 to the binary value 10, that is, the two-digit key prediction counter jumps from state 1 to state 2. Since state 2 and state 1 are both static states, the two-digit key prediction counter can be understood as jumping from a static state to another static state. The current predicted de-bouncing time Tdjp is equal to the preset predicted de-bouncing time Tdj (Tdjp=Tdj=25ms), and the predicted de-bouncing time Tdjp of 25ms is used as the value of the next preset predicted de-bouncing time Tdj.

[0114] Further, when the user presses the key again, and the cache component 10 still outputs a 5ms key jitter time, the prediction de-jitter component 20 calculates a 20ms de-jitter delay time Td based on the 25ms preset prediction de-jitter time Tdj and the 5ms key jitter time Tj; further, the de-jitter delay time Td is greater than the reference time Tre (20ms>15ms), and since the last time the user pressed the key, the two-digit key prediction counter stayed in state 2, that is, the two-digit key prediction counter stayed at the binary value 10, the two-digit key prediction counter jumped from the binary value 10 to the binary value 11, that is, the two-digit key prediction counter jumped from state 2 to state 3. Since state 2 is a static state and state 3 is a decreasing state, at this time, the two-digit key prediction counter can be understood as jumping from a static state to a decreasing state. The current formula for the predicted de-jitter time Tdjp is Tdj-0.5=24.5ms, and the predicted de-jitter time Tdjp of 24.5ms is used as the value of the next preset predicted de-jitter time Tdj.

[0115] In this way, when the user presses the key multiple times, the predicted de-bouncing time Tdjp calculated by the predicted de-bouncing component 20 is closer to the exact value, so that the de-bouncing delay time Td eventually reaches the same as the reference time Tre, making the key de-bouncing time match different objects, allowing users to achieve a better key pressing experience.

[0116] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. All equivalent structural changes made using the contents of the present invention's specification and drawings, or directly / indirectly applied in other related technical fields, are included in the patent protection scope of the present invention.

Claims

1. An adaptive key debouncing digital processing method based on branch prediction, characterized in that: The method comprises the following steps: When a key signal is received, it is determined that the current key signal is the first key signal, and the key signal cached when the key is pressed is obtained; Determining that the current key signal is not the first key signal, debounce the current key signal according to the stored predicted debounce time; Receive and cache the key signal when the user presses the key, and calculate the key jitter time based on the cached key signal; Calculating the debounce delay time according to the difference between the preset predicted debounce time and the key jitter time; When the debouncing delay time is greater than the reference time, it is determined that the debouncing delay time is too long, the preset predicted debouncing time jumps to a decrement state and is decremented, and the current predicted debouncing time is determined according to the decremented preset predicted debouncing time and stored; When the debouncing delay time is less than the reference time, it is determined that the debouncing delay time is too short, the preset predicted debouncing time jumps to the value-added state and is increased in value, and the current predicted debouncing time is determined according to the preset predicted debouncing time after the value-added, and is stored; When the de-jitter delay time is equal to the reference time, the de-jitter delay time is determined to be optimal, the preset predicted de-jitter time jumps to a static state, and the current predicted de-jitter time is determined to be equal to the preset predicted de-jitter time according to the preset predicted de-jitter time of the static state, and is stored.

2. An adaptive key debounce digital processing system based on branch prediction, characterized in that: It includes a cache component, a prediction debouncing component and a key debouncing component, wherein the prediction debouncing component is electrically connected to the cache component, and the prediction debouncing component is electrically connected to the key debouncing component; The cache component is used to receive and cache the key signal when the user presses the key, and calculate the key jitter time according to the cached key signal; The prediction de-bouncing component is used to, when the cache component receives a key signal, determine that the current key signal is the first key signal, and then obtain the key signal cached when the key is pressed; determine that the current key signal is not the first key signal, and then de-bouncing the current key signal according to the stored prediction de-bouncing time; The de-bouncing delay time is calculated based on the difference between the preset predicted de-bouncing time and the button jitter time; when the de-bouncing delay time is greater than the reference time, it is determined that the de-bouncing delay time is too long, and the preset predicted de-bouncing time jumps to a decreasing state and decreases in value, and the current predicted de-bouncing time is determined based on the preset predicted de-bouncing time after the decrease in value, and is stored; when the de-bouncing delay time is less than the reference time, it is determined that the de-bouncing delay time is too short, and the preset predicted de-bouncing time jumps to an increasing state and increases in value, and the current predicted de-bouncing time is determined based on the preset predicted de-bouncing time after the increase in value, and is stored; when the de-bouncing delay time is equal to the reference time, it is determined that the de-bouncing delay time is optimal, and the preset predicted de-bouncing time jumps to a static state, and the current predicted de-bouncing time is determined to be equal to the preset predicted de-bouncing time based on the preset predicted de-bouncing time in the static state, and is stored; The key debouncing component is used to debouncing the key signal according to the preset predicted debouncing time after the debouncing delay time is greater than the reference time; to debouncing the key signal according to the preset predicted debouncing time after the debouncing delay time is less than the reference time; and to debouncing the key signal according to the preset predicted debouncing time in a stationary state when the debouncing delay time is equal to the reference time. Among them, the prediction debouncing component is implemented using a two-bit key prediction counter.

Citation Information

Patent Citations

  • Keyboard debounce method, scan controller, master controller and measurement instrument

    CN108270447A

  • Microphone PTT signal jitter elimination algorithm for adaptive time domain telescopic window short-wave radio station

    CN111245678A

  • Universal dynamic delay jitter elimination method and device, terminal and storage medium

    CN113765504A

  • Devices, methods for controlling a device, and computer-readable media

    EP3475793A1

  • Debounce Circuit with Dynamic Time Base Adjustment for a Digital System

    US20160087615A1