CN108595018B - Keyboard scanning method and device, computer equipment and storage medium - Google Patents

Keyboard scanning method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN108595018B
CN108595018B CN201810068680.9A CN201810068680A CN108595018B CN 108595018 B CN108595018 B CN 108595018B CN 201810068680 A CN201810068680 A CN 201810068680A CN 108595018 B CN108595018 B CN 108595018B
Authority
CN
China
Prior art keywords
key code
key
frequency
scanning
codes
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201810068680.9A
Other languages
Chinese (zh)
Other versions
CN108595018A (en
Inventor
刘喜增
劳铜霭
李敏贤
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhuhai Jieli Technology Co Ltd
Original Assignee
Zhuhai Jieli Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhuhai Jieli Technology Co Ltd filed Critical Zhuhai Jieli Technology Co Ltd
Priority to CN201810068680.9A priority Critical patent/CN108595018B/en
Publication of CN108595018A publication Critical patent/CN108595018A/en
Application granted granted Critical
Publication of CN108595018B publication Critical patent/CN108595018B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/02Input arrangements using manually operated switches, e.g. using keyboards or dials
    • G06F3/023Arrangements for converting discrete items of information into a coded form, e.g. arrangements for interpreting keyboard generated codes as alphanumeric codes, operand codes or instruction codes

Abstract

The invention relates to a keyboard scanning method, a device, computer equipment and a storage medium, comprising the following steps: acquiring the use frequency of key codes in a keyboard, and dividing all the key codes into a plurality of key code subareas according to the use frequency of the key codes; setting different scanning frequencies for different key code partitions, wherein the scanning frequency corresponding to the key code partition where the key code with lower frequency is used is lower; and scanning the key codes contained in different key code partitions according to the scanning frequency. According to the technical scheme, the key codes are divided into a plurality of different key code partitions according to the using frequency of the key codes on the keyboard, and the corresponding scanning frequency is set for each key code partition, so that the corresponding scanning frequency can be set according to the using frequency of the key codes in the key code partitions, the scanning frequency of the keyboard is reduced, and the radiation of the keyboard is reduced.

Description

Keyboard scanning method and device, computer equipment and storage medium
Technical Field
The present invention relates to the field of electromagnetic radiation, and in particular, to a keyboard scanning method, apparatus, computer device, and storage medium.
Background
With the rapid development of scientific technology, intellectualization and informatization are deeply carried out in various fields of production and life of people, such as intelligent informatization of industry, agriculture, traffic, medical treatment, aerospace and the like, so that the intelligent informatization platform not only improves the living standard of people, but also effectively drives the rapid development of social economy and promotes the appearance of other emerging fields and emerging technologies. As for computers playing a major role in intellectualization and informatization, it can be said that no computer appears and the era of intellectualization and informatization of the present society does not come. At present, computers play a great role in many fields, and people are increasingly unable to leave computers. The computer can be used in the fields of scientific calculation, industrial and agricultural management control, transportation and the like, and can also be applied to various places such as daily office, personal life, work and study, entertainment and leisure and the like. Because of the powerful capabilities of computers, many people now need to sit next to a computer, either for work or for entertainment games, almost daily in society. Computers are electronic devices, and certain electromagnetic radiation exists in the computers, so that the computers can bring certain influence on the health of people when sitting beside the computers for a long time. According to some data, keyboard radiation is one of the hardware parts with larger radiation in a computer, and the keyboard is often placed at the position closest to the human body, so that the harm to the human health is also very large.
At present, the method for reducing the radiation of the computer keyboard is mainly to add a casing film for reducing the electromagnetic radiation outside the keyboard or add some shielding layers for preventing the electromagnetic radiation inside the keyboard. However, these methods only isolate the radiation source and do not actually reduce the radiation from the keyboard.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a keyboard scanning method, device, computer device and storage medium for solving the problem of keyboard radiation.
A keyboard scanning method, comprising:
acquiring the use frequency of key codes in a keyboard, and dividing all the key codes into a plurality of key code subareas according to the use frequency of the key codes;
setting different scanning frequencies for different key code partitions, wherein the scanning frequency corresponding to the key code partition where the key code with lower frequency is used is lower;
and scanning the key codes contained in different key code partitions according to the scanning frequency.
In one embodiment, the keyboard scanning method further includes: acquiring the latest key code triggering time of each key code partition, and calculating the time difference between the latest key code triggering time of each key code partition and the current time; and adjusting the scanning frequency corresponding to each key code partition according to the time difference.
In one embodiment, the step of adjusting the scanning frequency corresponding to each keycode area according to the time difference includes: when the time difference is greater than a first set threshold and less than or equal to a second set threshold, adjusting the scanning frequency of each key code partition according to a preset first rule; when the time difference is greater than the second set threshold and less than or equal to a third set threshold, adjusting the scanning frequency of each key code partition according to a preset second rule; and when the time difference is larger than the third set threshold, adjusting the scanning frequency of each key code partition according to a preset third rule.
In one embodiment, after the step of adjusting the scanning frequency corresponding to each keycode area according to the time difference, the method further includes: and detecting key code triggering events, and restoring the scanning frequency of each key code partition into the scanning frequency before adjustment after any key code triggering event is detected.
In one embodiment, the step of dividing the key partitions according to the frequency of use of the key includes: dividing the key code according to the use frequency to obtain a key code high-frequency area, a key code medium-frequency area and a key code low-frequency area; the step of setting different scanning frequencies for different key code partitions includes: setting the scanning frequency corresponding to the key code high-frequency area to be higher than the scanning frequency of the key code medium-frequency area; and setting the scanning frequency of the key code middle frequency area to be higher than the scanning frequency of the key code low frequency area.
In one embodiment, the step of dividing the total key codes into a plurality of key code sections according to the frequency of use of the key codes includes: acquiring the number of key codes on a keyboard and a preset key code partition; if the number of the key codes can be evenly distributed to each key code subarea, the key codes on the keyboard are evenly distributed to each key code subarea according to the use frequency of the key codes; or when the number of the key codes cannot be evenly distributed to the key code division areas, reducing the key codes of the keyboard to be evenly distributed, then evenly dividing the key codes on the keyboard into the key code subareas according to the use frequency of the key codes, and then dividing the reduced key codes into the corresponding key code subareas according to the use frequency of the reduced key codes.
In one embodiment, after the step of dividing all the key codes into a plurality of key code partitions according to the frequency of use of the key codes, the method further comprises: and counting the use frequency of the key codes within the set time, and adjusting the key code partition where the key codes are located according to the counted use frequency of the key codes and preset adjustment conditions.
In one embodiment, the step of adjusting the key code partition where the key code is located according to the counted usage frequency of the key code and a preset adjustment condition includes: when the counted using frequency of the key codes is larger than the set frequency range, adjusting the key codes to key code partitions with higher scanning frequency; when the counted use frequency of the key code is smaller than the set frequency range, adjusting the key code to a key code partition with lower scanning frequency; and when the counted use frequency of the key code is within a set frequency range, keeping the key code partition of the key code unchanged.
In one embodiment, after the step of adjusting the key code partition where the key code is located according to the frequency of use of the key code and a preset adjustment rule, the method further includes: and acquiring the current key code number of each key code partition, and when the current key code number of any key code partition is larger than the sum of the key code numbers of other key code partitions, carrying out key code partition on all the key codes on the keyboard again.
In one embodiment, the step of adjusting the scanning frequency of each key code partition according to a preset first rule when the time difference is greater than a first set threshold and less than or equal to a second set threshold includes: when the time difference is larger than a first set threshold and smaller than or equal to a second set threshold, adjusting the scanning frequency of each key code partition according to a first scale factor; when the time difference is greater than the second set threshold and less than or equal to a third set threshold, adjusting the scanning frequency of each key code partition according to a preset second rule, including: when the time difference is greater than the second set threshold and less than or equal to a third set threshold, adjusting the scanning frequency of each key code partition according to a second proportionality coefficient; when the time difference is greater than the third set threshold, adjusting the scanning frequency of each key code partition according to a preset third rule, including: when the time difference is larger than the third set threshold, adjusting the scanning frequency of each key code partition according to a third proportionality coefficient; wherein the first scaling factor is greater than the second scaling factor; the second scaling factor is greater than the third scaling factor; and the scanning frequency of each key code partition adjusted according to the third scaling factor is not lower than the lowest scanning frequency corresponding to the partition.
A keyboard scanning device, comprising:
the key code partition acquiring module is used for acquiring the use frequency of the key codes in the keyboard and dividing all the key codes into a plurality of key code partitions according to the use frequency of the key codes;
the scanning frequency setting module is used for setting different scanning frequencies for different key code partitions, wherein the scanning frequency corresponding to the key code partition where the key code with the lower frequency is used is lower;
and the scanning module is used for scanning the key codes contained in different key code partitions according to the scanning frequency.
According to the keyboard scanning method and the keyboard scanning device, the key codes are divided into a plurality of different key code partitions according to the using frequency of the key codes on the keyboard, and the corresponding scanning frequency is set for each key code partition, so that the corresponding scanning frequency can be set according to the using frequency of the key codes in the key code partitions, the scanning frequency of the keyboard is reduced, and the radiation of the keyboard is reduced.
A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the method of keyboard scanning as described above when executing the computer program.
The computer equipment realizes the reduction of the keyboard scanning frequency through the computer program running on the processor.
A computer storage medium having stored thereon a computer program which, when executed by a processor, implements the keyboard scanning method as described above.
The computer storage medium realizes the reduction of the keyboard scanning frequency through the stored computer program.
Drawings
FIG. 1 is a diagram of an application environment of a keyboard scanning method according to an embodiment;
FIG. 2 is a flow diagram of an embodiment of a keyboard scanning method;
FIG. 3 is a flow diagram of another embodiment keyboard scanning method;
FIG. 4 is a schematic diagram of an implementation of a routine inline scan implementation;
fig. 5 is a schematic structural diagram of a keyboard scanning device according to an embodiment.
Detailed Description
In order to further explain the technical means and effects of the present invention, the following description will be made for clear and complete descriptions of the technical solutions of the embodiments of the present invention with reference to the accompanying drawings and preferred embodiments.
It should be noted that the terms "first \ second \ third" related to the embodiments of the present invention are merely used for distinguishing similar objects, and do not represent a specific ordering for the objects, and it should be understood that "first \ second \ third" may exchange a specific order or sequence order if allowed. It should be understood that "first \ second \ third" distinct objects may be interchanged under appropriate circumstances such that embodiments of the invention described herein may be practiced in an order other than those illustrated or described herein.
FIG. 1 is a diagram of an application environment of a keyboard scanning method according to an embodiment. As shown in FIG. 1, computer system 100 includes a processor 110, a memory 120, a system bus 130, and a storage device 140. The processor 110 is hardware used to execute computer program instructions through basic arithmetic and logical operations in a computer system. Memory 120 is a physical device used for temporarily or permanently storing computing programs or data (e.g., program state information). The system bus 130 may be any of several types of bus structures including a memory bus or memory controller, a peripheral bus, and a local bus. The processor 110 and the memory 120 may be in data communication via a system bus 130. Wherein memory 120 includes Read Only Memory (ROM) or flash memory (neither shown), and Random Access Memory (RAM), which generally refers to main memory loaded with an operating system and application programs. Storage device 140 may be selected from a variety of computer readable media, which refers to any available media that can be accessed by computer system 100, including both removable and non-removable media. For example, computer-readable media includes, but is not limited to, flash memory (micro SD cards), CD-ROM, Digital Versatile Disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium which can be used to store the desired information and which can accessed by computer system 100.
Computer system 100 also includes an input device 150 and an input interface 160 (e.g., an IO controller). A user may enter commands and information into the computer system 100 through input devices 160, such as a keyboard. Input device 160 is typically connected to system bus 130 through input interface 150, but may be connected by other interface and bus structures, such as a Universal Serial Bus (USB).
As described in detail above, a computer system 100 suitable for use with the present invention is capable of performing the designated operations of the keyboard scanning method. Computer system 100 performs these operations by processor 110 in the form of software instructions running in a computer-readable medium. The software instructions stored in memory 120 cause processor 110 to perform the keyboard scanning method described above. Furthermore, the present invention can be implemented by hardware circuits or by a combination of hardware circuits and software instructions. Thus, implementations of the invention are not limited to any specific combination of hardware circuitry and software.
As shown in fig. 2, fig. 2 is a flowchart of a keyboard scanning method according to an embodiment, including the following steps:
step S21, obtaining the use frequency of the key codes in the keyboard, and dividing all the key codes into a plurality of key code subareas according to the use frequency of the key codes.
Step S22, different scanning frequencies are set for different key code partitions, wherein the lower the frequency of use, the lower the scanning frequency corresponding to the key code partition in which the key code is located.
And step S23, scanning the key codes contained in different key code partitions according to the scanning frequency.
In the above step, the key code is used frequently as the number of times the key code is triggered within a period of time. Each key code on the keyboard corresponds to a structure variable, and the structure variable comprises four member parameters: the line scan code, the column scan code, the frequency of key code usage, and the key code scan latency. Each key code has a determined scanning code, the scanning code and the column scanning code can be determined according to the connection of a hardware circuit, and the current trigger state of any key code can be randomly acquired through the scanning code. The use frequency of the key codes records the number of times the key codes are triggered, and when the keyboard is initially powered on, the use frequency of the key codes is a default parameter approximately determined according to the daily use condition of the key codes. For example, the key codes corresponding to 26 english alphabet keys in the keyboard are used most frequently, and then the key codes corresponding to keys such as an arabic numeral key, a space, a punctuation mark and the like are used, and the minimum key codes corresponding to keys such as Ctrl, Tab, insertion, magnification, F1-F12 and the like are used; the scanning delay time is the interval time of two times of scanning, and the scanning delay time is shorter as the scanning times are more.
And acquiring the number of times each key code is triggered through the structure body variable of the key code. And dividing the key code into partitions according to the triggering times of the key codes. The plurality of key code subareas can be divided as required, for example, the key codes are divided into three key code subareas according to the number of times that the key codes are triggered, a plurality of key codes with the highest number of times that the key codes are triggered are divided into the same key code subarea, a plurality of key codes with the lowest number of times that the key codes are triggered are divided into the same key code subarea, and the rest key codes are divided into the same key code subarea.
The scanning frequency is the number of times of scanning the key code set in the set time, and the scanning frequency is higher as the number of times of scanning is higher. The keyboard scans the key codes according to the preset scanning frequency of each key code partition. The key codes in the same key code partition have the same scanning frequency, and the key codes in different key code partitions have different scanning frequencies.
According to the keyboard scanning method, the key codes are divided into a plurality of different key code subareas according to the using frequency of the key codes on the keyboard, and after the corresponding scanning frequency is set for each key code subarea, the key codes in different key code subareas can be scanned at different scanning frequencies, so that the scanning frequency of the keyboard is reduced, and the radiation of the keyboard is reduced.
In an embodiment, the present invention further provides a specific method for partitioning a key code partition. Namely, the step of dividing the total key codes into a plurality of key code partitions according to the frequency of use of the key codes includes: a1, acquiring the number of key codes on the keyboard and preset key code partitions; a2, if the number of the key codes can be evenly distributed to each key code subarea, evenly dividing the key codes on the keyboard into each key code subarea according to the use frequency of the key codes; or A3, if the number of the key codes can not be evenly distributed to the key code areas, reducing the key codes of the keyboard to be evenly distributed, then evenly dividing the key codes on the keyboard into each key code area according to the use frequency of the key codes, and then dividing the reduced key codes into the corresponding key code areas according to the use frequency of the reduced key codes. In order to keep the number of the key codes in each key code partition equal, two situations exist when the key codes on the keyboard are partitioned: one is a case where the number of key codes on the keyboard can be evenly distributed to the respective preset key code sections, and the other is a case where the number of key codes on the keyboard cannot be evenly distributed to the respective preset key code sections. When the number of the key codes on the keyboard can be evenly distributed to each preset key code partition, executing step a2: and according to the use frequency of the key codes, sequentially dividing all the key codes on the keyboard into each key code partition. When the number of the key codes on the keyboard cannot be evenly distributed to each preset key code partition, executing step a3: subtracting a plurality of key codes with the lowest use frequency, averagely distributing the rest key codes to each set key code partition, and then re-dividing the subtracted key codes into the key code partitions with the lowest use frequency of the key codes; or subtracting a plurality of key codes with the highest use frequency, then averagely distributing the rest key codes to each set key code partition, and then re-dividing the subtracted key codes into the key code partitions with the highest use frequency of the key codes.
As shown in fig. 3, fig. 3 is a flowchart of a keyboard scanning method according to another embodiment, which includes the following steps:
step S31, obtaining the use frequency of the key codes in the keyboard, and dividing all the key codes into a plurality of key code subareas according to the use frequency of the key codes.
Step S32, different scanning frequencies are set for different key code partitions, wherein the lower the frequency of use, the lower the scanning frequency corresponding to the key code partition in which the key code is located.
And step S33, scanning the key codes contained in different key code partitions according to the scanning frequency.
And step S34, counting the use frequency of the key code within the set time, and adjusting the key code partition where the key code is located according to the counted use frequency of the key code and the preset adjustment condition.
In the above step, the key code is used frequently as the number of times the key code is triggered within a period of time. Each key code on the keyboard corresponds to a structure variable, and the structure variable comprises four member parameters: the line scan code, the column scan code, the frequency of key code usage, and the key code scan latency. Each key code has a determined scanning code, the scanning code and the column scanning code can be determined according to the connection of a hardware circuit, and the current trigger state of any key code can be randomly acquired through the scanning code; the use frequency of the key codes records the number of times the key codes are triggered, and when the keyboard is initially powered on, the use frequency of the key codes is a default parameter approximately determined according to the daily use condition of the key codes. And acquiring the number of times each key code is triggered through the structure body variable of the key code. And then dividing a plurality of key code subareas according to the triggering times of the key codes. The scanning frequency is the number of times of scanning the key code set in the set time, and the scanning frequency is higher as the number of times of scanning is higher. The keyboard scans the key codes according to the preset scanning frequency of each key code partition, the scanning frequency of the key codes in the same key code partition is the same, and the scanning frequency of the key codes in different key code partitions is different. After all the key codes on the keyboard are partitioned, the processor on the keyboard can monitor the use frequency of all the key codes within a set time, and properly adjust the key code partition where the key codes are located according to the use frequency of the key codes.
According to the keyboard scanning method, firstly, the key codes are divided into a plurality of different key code subareas according to the use frequency of the key codes on the keyboard; then, after setting corresponding scanning frequency for each key code partition, scanning the key codes in different key code partitions at different scanning frequencies; and finally, adjusting the key code partition where the key code is located in real time according to the use frequency of the key code, and controlling the integral scanning times of the keyboard to be in a lower horizontal state by effectively limiting the number of the key codes in the high-frequency partition, so that the scanning times of the keyboard are reduced, and the radiation of the keyboard is reduced.
In one embodiment, the step of adjusting the key code partition where the key code is located according to the counted usage frequency of the key code and a preset adjustment condition includes: when the counted using frequency of the key codes is larger than the set frequency range, adjusting the key codes to key code partitions with higher scanning frequency; when the counted using frequency of the key code is smaller than the set frequency range, adjusting the key code to a key code partition with lower scanning frequency; and when the counted use frequency of the key code is within a set frequency range, keeping the key code partition of the key code unchanged. For example, if it is monitored that the frequency of use of a key code in a set time is k, when k is greater than a set frequency range, the key code is adjusted to a key code partition with a higher scanning frequency; when k is in the set frequency range, keeping the key code partition where the key code is located unchanged; when k is smaller than the set frequency range, the key code is adjusted to the key code partition with lower scanning frequency.
In one embodiment, after the step of adjusting the key code partition in which the key code is located according to the frequency of use of the key code and a preset adjustment rule, the method further includes: and acquiring the current key code number of each key code partition, and when the current key code number of any key code partition is larger than the sum of the key code numbers of other key code partitions, carrying out key code partition on all the key codes on the keyboard again. The keyboard monitors the number of the key codes in each key code partition in real time, and when the monitored number of the key codes in one key code partition is larger than the sum of the number of the key codes of all other key code partitions, the key codes on the keyboard are partitioned again according to the use frequency of the key codes, so that the number of the key codes in each key code partition is effectively limited, and the scanning frequency of the whole keyboard is controlled to be in a lower horizontal state.
In one embodiment, after the step of adjusting the scanning frequency corresponding to each keycode area according to the time difference, the method further includes: and detecting key code triggering events, and restoring the scanning frequency of each key code partition into the scanning frequency before adjustment after any key code triggering event is detected.
After the key codes on the keyboard are divided into key code sections, the scanning is started at the scanning frequency set by the key code sections. However, when the keyboard is not pressed down for a long time, the scanning times of each key code partition can be correspondingly reduced to the set minimum value, so that the keyboard can monitor the triggering condition of the key codes in real time, and once the key codes are triggered, the scanning times of the initial setting of each key code partition can be quickly recovered.
In one embodiment, the keyboard scanning method further comprises: acquiring the triggering time of the latest key code, and calculating the time difference between the triggered time of the latest key code and the current time; and adjusting the scanning frequency corresponding to each key code partition according to the time difference.
In an embodiment, the step of adjusting the scanning frequency corresponding to each keycode area according to the time difference includes: when the time difference is greater than a first set threshold and less than or equal to a second set threshold, adjusting the scanning frequency of each key code partition according to a preset first rule; when the time difference is greater than the second set threshold and less than or equal to a third set threshold, adjusting the scanning frequency of each key code partition according to a preset second rule; and when the time difference is larger than the third set threshold, adjusting the scanning frequency of each key code partition according to a preset third rule.
After the keyboard receives the key code triggering signal, the keyboard scans the key codes on the keyboard by initially setting the scanning times of each key code partition, and a counter on the keyboard starts counting. And when the key code continuous triggering signal is not received after a period of time is separated from the key code triggering time, reducing the key code scanning times of each key code subarea according to a certain proportion. For example, three time periods T0, T1, and T2 are set, where T2> T1> T0. When the keyboard does not receive the key code triggering signal any more after the key code triggering time T0, reducing the scanning times of each key code partition according to a certain proportion; when the keyboard does not receive the key code triggering signal any more after the key code triggering time T1, further reducing the scanning times of each key code partition according to a certain proportion; when the keyboard does not receive the key code triggering signal after the key code triggering time T2, the scanning times of each key code partition are reduced to a preset minimum value.
In one embodiment, the dividing the key partitions according to the frequency of use of the key includes: dividing the key codes according to the use frequency of the key codes to obtain a key code high-frequency area, a key code medium-frequency area and a key code low-frequency area; the step of setting different scanning frequencies for different key code partitions includes: setting the scanning frequency corresponding to the key code high-frequency area to be higher than the scanning frequency of the key code medium-frequency area; and setting the scanning frequency of the key code middle frequency area to be higher than the scanning frequency of the key code low frequency area.
All the key codes on the keyboard can be divided into several parts from high to low according to the frequency of the key codes. For example, if all the key codes are divided into three parts, the three parts correspond to the key code high frequency region, the key code middle frequency region and the key code low frequency region, respectively. The key codes divided in the key code high frequency area are a part of key codes with the highest frequency of use in the keyboard, the frequency of use of the key codes divided in the key code medium frequency area is less than that of the key codes divided in the key code high frequency area, and the frequency of use of the key codes divided in the key code low frequency area is less than that of the key codes divided in the key code medium frequency area. Therefore, the scanning frequency of the high-frequency area of the corresponding set key code is higher than that of the medium-frequency area of the key code, and the scanning frequency of the medium-frequency area of the set key code is higher than that of the low-frequency area of the key code.
In one embodiment, the implementation flow of the scanning method of the keyboard in an application environment is as follows:
firstly, each key code on the keyboard is provided with a corresponding structure variable, and the structure variable comprises four member parameters: the line scan code, the column scan code, the frequency of key code usage, and the key code scan latency. Each key code has a determined scanning code, the scanning code and the column scanning code can be determined according to the connection of a hardware circuit, and the current trigger state of any key code can be randomly acquired through the scanning code. As shown in fig. 4, fig. 4 is a schematic diagram for implementing a routine scanning implementation method, where R0 to R5 are row scanning lines, and C0 to C6 are column scanning lines. The voltage signal of the initial node position level of each line is constantly changed, and the change of the node position signal is radiated in an electromagnetic mode by the lead-out wire.
And within the set time, dividing the key code into key code partitions according to the use frequency of the key codes on the keyboard. In order to reduce the scanning times of the keyboard to a greater extent under the condition of not influencing the use effect, the keyboard key codes are divided into three subareas from high to low according to the use frequency, the first subarea is a key code high-frequency area, the second subarea is a key code medium-frequency area, and the third subarea is a key code low-frequency area. The key codes divided in the key code high frequency area are a part of key codes with the highest frequency of use in the keyboard, the frequency of use of the key codes divided in the key code medium frequency area is less than that of the key codes divided in the key code high frequency area, and the frequency of use of the key codes divided in the key code low frequency area is less than that of the key codes divided in the key code medium frequency area. When the key code can not be completely equally divided into three regions, subtracting one or two key codes with the lowest frequency of use, then carrying out average distribution, and putting the subtracted one or two key codes with lower frequency into a third partition; or subtracting one or two keys with the highest frequency of use, then performing average allocation, and putting the subtracted one or two keys with the highest frequency into the first partition.
Further, after key codes are partitioned, the use frequency of each key code on the keyboard within a certain time is monitored, if the use frequency of one key code within a set time is monitored to be k, and when k is larger than a set frequency range, the key code is adjusted to a key code high-frequency area; when k is in the set frequency range, keeping the key code partition where the key code is located unchanged; when k is smaller than the set frequency range, the key code is adjusted to the key code low frequency area.
And monitoring whether the number of the key codes in each key code partition meets the set rule or not in real time. When the monitored key code number in one of the key code subareas is larger than the sum of the key codes of all other key code subareas, the key codes on the keyboard are subaread again according to the use frequency of the key codes, so that the number of the key codes in each key code subarea is effectively limited, and the scanning frequency of the whole keyboard is controlled to be in a lower horizontal state.
Then, the key condition on the keyboard is monitored in real time, and once the key is pressed, the scanning times of the key code are quickly recovered. The keyboard scans all key codes through a scanning function, and the scanning function controls the scanning times of the key codes through two parameter values m and K. And determining the scanning times of each key code partition as m × K according to the parameter K and the parameter m. The scan functions corresponding to the Key code high frequency region, the Key code medium frequency region and the Key code low frequency region are Key _ L (), Key _ M (), and Key _ H (), respectively. The parameters corresponding to Key _ L () are M0 and K0, the parameters corresponding to Key _ M () are M1 and K1, and the parameters corresponding to Key _ H () are M2 and K2. Namely, the lowest scan times corresponding to the key code high frequency region, the key code intermediate frequency region, and the key code low frequency region are K0, K1, and K2, respectively, and the adjustment coefficients corresponding to the key code high frequency region, the key code intermediate frequency region, and the key code low frequency region are m0, m1, and m2, respectively. It should be noted that m0 takes a maximum value of Max0, m1 takes a maximum value of Max1, m2 takes a maximum value of Max2, and when the keyboard is just initialized or no key is pressed for a long time, the parameter m takes a value of 1.
Three interval periods T0, T1, and T2 are set in a period from the most recent key depression, where T2> T1> T0. When the keyboard monitors that the key is pressed continuously in the T0 time period, the maximum scanning times of the three key code partitions are respectively Max 0K 0, Max 1K 1 and Max 2K 2; when the key is not pressed continuously in the T0 time period, the m0 is adjusted to be Max0/2, the m1 is Max1/2, the m2 is adjusted to be Max2/2, and the scanning times corresponding to the three key code partitions are Max 0/2K 0, Max 1/2K 1 and Max 2/2K 2 respectively.
When the keyboard monitors that the key is pressed in the time period T1, keeping the current scanning times; if no key is pressed, adjusting m0 to Max0/8, m1 to Max1/8, m2 to Max2/8, and respectively setting the scanning times corresponding to the three key code partitions to Max 0/8K 0, Max 1/8K 1 and Max 2/8K 2.
When the keyboard monitors that a key is pressed in a T2 time period, the current scanning times are kept, if no key is pressed, m 0-m 1-m 2-1 are adjusted, and the three key code partitions correspond to the lowest scanning times K0, K1 and K2.
As shown in fig. 5, fig. 5 is a schematic structural diagram of a keyboard scanning device according to an embodiment, including:
the key code partition acquiring module 510 is configured to acquire a frequency of using key codes in a keyboard, and divide all key codes into a plurality of key code partitions according to the frequency of using the key codes.
The scan frequency setting module 520 is configured to set different scan frequencies for different key code partitions, where the lower the frequency of use, the lower the scan frequency corresponding to the key code partition in which the key code is located.
A scanning module 530, configured to scan the key codes included in different key code partitions according to the scanning frequency.
Wherein the key code is used frequently as the number of times the key code is triggered within a period of time. Each key code on the keyboard corresponds to a structure variable, and the structure variable comprises four member parameters: the line scan code, the column scan code, the frequency of key code usage, and the key code scan latency. Each key code has a determined scanning code, the scanning code and the column scanning code can be determined according to the connection of a hardware circuit, and the current trigger state of any key code can be randomly acquired through the scanning code; the use frequency of the parameter key code is the number of times of triggering the key code, when the keyboard is initialized and powered on, a default value parameter is used, and the use frequency of the parameter is approximately determined through the daily use condition of the key code. For example, the key codes corresponding to 26 english alphabet keys in the keyboard are used most frequently, and then the key codes corresponding to keys such as an arabic numeral key, a space, a punctuation mark and the like are used, and the minimum key codes corresponding to keys such as Ctrl, Tab, insertion, magnification, F1-F12 and the like are used; the scanning delay time is the interval time of two times of scanning, and the scanning delay time is shorter as the scanning times are more.
And acquiring the number of times of triggering each key code through the structure body variable of the key code. And dividing the key code into partitions according to the triggering times of the key codes. The key code partition may be divided into a plurality of sections as required, for example, the key code is divided into three key code partitions according to the number of times the key code is triggered, a plurality of key codes with the highest number of times the key code is triggered are divided into the same key code partition, a plurality of key codes with the lowest number of times the key code is triggered are divided into the same key code partition, and the remaining key codes are divided into the same key code partition.
The scanning frequency is the number of times of scanning the key code set within the set time, and the scanning frequency is higher as the number of times of scanning is larger. The keyboard scans the key codes according to the preset scanning frequency of each key code partition, the scanning frequency of the key codes in the same key code partition is the same, and the scanning frequency of the key codes in different key code partitions is different.
According to the keyboard scanning device, the key codes are divided into a plurality of different key code partitions by the key code partition acquisition module 510 according to the using frequency of the key codes on the keyboard, and the corresponding scanning frequency is set for each key code partition by the scanning frequency setting module 520, so that the key codes in different key code partitions can be scanned at different scanning frequencies by the scanning module 530, the scanning frequency of the keyboard is reduced, and the radiation of the keyboard is reduced.
Based on the examples described above, there is also provided in one embodiment a computer device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor, when executing the program, implements any one of the keyboard scanning methods in the embodiments described above.
The computer equipment realizes the reduction of the keyboard scanning frequency through the computer program running on the processor.
It will be understood by those skilled in the art that all or part of the processes in the methods of the above embodiments may be implemented by a computer program, which is stored in a non-volatile computer readable storage medium, and in the embodiments of the present invention, the program may be stored in the storage medium of a computer system and executed by at least one processor in the computer system to implement the processes including the embodiments of the sleep assistance methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like.
Accordingly, in an embodiment, a storage medium is further provided, on which a computer program is stored, wherein the program is executed by a processor to implement any one of the keyboard scanning methods in the above embodiments.
The computer storage medium realizes the reduction of the keyboard scanning frequency through the stored computer program.
The technical features of the embodiments described above may be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the embodiments described above are not described, but should be considered as being within the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present invention, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that various changes and modifications can be made by those skilled in the art without departing from the spirit of the invention, and these changes and modifications are all within the scope of the invention. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (10)

1. A keyboard scanning method, comprising:
respectively acquiring the use frequency of each key code in a keyboard, wherein the keyboard is hardware connected with a computer through an input interface, each key code on the keyboard corresponds to a structural body variable, and the structural body variable comprises four member parameters: the use frequency of the line scanning codes, the column scanning codes and the key codes and the scanning delay of the key codes;
dividing the key codes according to the use frequency of the key codes to obtain a key code high-frequency area, a key code medium-frequency area and a key code low-frequency area;
if the number of the key codes on the keyboard can be evenly distributed to each key code partition, evenly distributing the key codes on the keyboard to each key code partition according to the use frequency of the key codes; or, if the number of the key codes on the keyboard cannot be evenly distributed to the key code subareas, reducing the key codes of the keyboard to be evenly distributed, then evenly dividing the key codes on the keyboard into the key code subareas according to the use frequency of the key codes, and then dividing the reduced key codes into the corresponding key code subareas according to the reduced use frequency of the key codes;
setting different scanning frequencies for different key code partitions; the lower the frequency of use, the lower the scanning frequency corresponding to the key code partition where the key code is located; the keyboard scans all the key codes through a scanning function, the scanning function controls the scanning times of the key codes by adjusting a coefficient m and the lowest scanning times K set in each key code partition, and the scanning times of each key code partition are m × K; the lowest scanning times corresponding to each key code partition are different;
acquiring the latest key code triggering time, and calculating the time difference between the latest key code triggering time and the current time;
when the time difference is larger than a first set threshold and smaller than or equal to a second set threshold, adjusting the scanning frequency of each key code partition according to a first scale factor; when the time difference is greater than the second set threshold and less than or equal to a third set threshold, adjusting the scanning frequency of each key code partition according to a second proportionality coefficient; when the time difference is larger than the third set threshold, adjusting the scanning frequency of each key code partition according to a third proportionality coefficient; wherein the first scaling factor is greater than the second scaling factor; the second scaling factor is greater than the third scaling factor; the scanning frequency of each key code partition adjusted according to the third proportionality coefficient is not lower than the lowest scanning frequency corresponding to the partition; scanning the key codes contained in different key code partitions according to the adjusted scanning frequency;
and after any key code triggering event is detected, restoring the scanning frequency subsection of each key code partition to the set scanning frequency.
2. The keyboard scanning method of claim 1,
the step of setting different scanning frequencies for different key code partitions includes:
setting the scanning frequency corresponding to the key code high-frequency area to be higher than the scanning frequency of the key code medium-frequency area; and setting the scanning frequency of the key code middle frequency area to be higher than the scanning frequency of the key code low frequency area.
3. The keyboard scanning method of claim 1, further comprising, after the step of dividing the entire key codes into a plurality of key code sections according to the frequency of use of the key codes:
and counting the use frequency of the key codes within the set time, and adjusting the key code subareas where the key codes are located according to the counted use frequency of the key codes and preset adjustment conditions.
4. The keyboard scanning method of claim 3, wherein the step of adjusting the key code partition in which the key code is located according to the counted frequency of use of the key code and a preset adjustment condition comprises:
when the counted using frequency of the key codes is larger than the set frequency range, adjusting the key codes to key code partitions with higher scanning frequency;
when the counted using frequency of the key code is smaller than the set frequency range, adjusting the key code to a key code partition with lower scanning frequency;
when the counted use frequency of the key code is within the set frequency range, keeping the key code partition of the key code unchanged.
5. The keyboard scanning method according to claim 3 or 4, wherein after the step of adjusting the key code partition where the key code is located according to the frequency of use of the key code and a preset adjustment rule, the method further comprises:
and acquiring the current key code number of each key code partition, and when the current key code number of any key code partition is larger than the sum of the key code numbers of other key code partitions, carrying out key code partition on all the key codes on the keyboard again.
6. The keyboard scanning method of claim 1, wherein the input interface is a universal serial bus.
7. The keyboard scanning method of claim 1, wherein the key codes in the same key code division have the same scanning frequency, and the key codes in different key code divisions have different scanning frequencies.
8. A keyboard scanning device, comprising:
the key code partition acquisition module is used for respectively acquiring the use frequency of each key code in the keyboard and the number of the key codes on the keyboard, the keyboard is hardware connected with a computer through an input interface, each key code on the keyboard corresponds to a structure body variable, and the structure body variable comprises four member parameters: dividing the key codes according to the use frequency of the key codes to obtain a key code high-frequency area, a key code medium-frequency area and a key code low-frequency area; if the number of the key codes can be evenly distributed to each key code subarea, the key codes on the keyboard are evenly distributed to each key code subarea according to the use frequency of the key codes; or if the number of the key codes cannot be evenly distributed to the key code subareas, reducing the key codes of the keyboard to be evenly distributed, then evenly dividing the key codes on the keyboard into the key code subareas according to the use frequency of the key codes, and then dividing the reduced key codes into the corresponding key code subareas according to the reduced use frequency of the key codes;
the scanning frequency setting module is used for setting different scanning frequencies for different key code partitions; the lower the frequency of use, the lower the scanning frequency corresponding to the key code partition where the key code is located; the keyboard scans all the key codes through a scanning function, the scanning function controls the scanning times of the key codes by adjusting a coefficient m and the lowest scanning times K set in each key code partition, and the scanning times of each key code partition are m & ltK & gt; the lowest scanning times corresponding to each key code partition are different;
the scanning module is used for acquiring the latest key code triggering time and calculating the time difference between the latest key code triggering time and the current time; when the time difference is larger than a first set threshold and smaller than or equal to a second set threshold, adjusting the adjusting coefficient according to a first proportional coefficient; when the time difference is larger than the second set threshold and smaller than or equal to a third set threshold, adjusting the adjustment coefficient according to a second proportionality coefficient; when the time difference is larger than the third set threshold, adjusting the adjustment coefficient according to a third proportionality coefficient; wherein the first scaling factor is greater than the second scaling factor; the second scaling factor is greater than the third scaling factor; the scanning frequency of each key code partition adjusted according to the third proportionality coefficient is not lower than the lowest scanning frequency corresponding to the partition; scanning the key codes contained in different key code partitions according to the adjusted scanning frequency; and after any key code triggering event is detected, restoring the scanning frequency subsection of each key code partition to the set scanning frequency.
9. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the keyboard scanning method of any one of claims 1 to 7.
10. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the steps of the keyboard scanning method of any one of claims 1 to 7 are implemented when the program is executed by the processor.
CN201810068680.9A 2018-01-24 2018-01-24 Keyboard scanning method and device, computer equipment and storage medium Active CN108595018B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810068680.9A CN108595018B (en) 2018-01-24 2018-01-24 Keyboard scanning method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810068680.9A CN108595018B (en) 2018-01-24 2018-01-24 Keyboard scanning method and device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN108595018A CN108595018A (en) 2018-09-28
CN108595018B true CN108595018B (en) 2022-05-17

Family

ID=63608224

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810068680.9A Active CN108595018B (en) 2018-01-24 2018-01-24 Keyboard scanning method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN108595018B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI807385B (en) * 2021-08-10 2023-07-01 達方電子股份有限公司 Keyboard detection method

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101355365A (en) * 2007-07-27 2009-01-28 佛山市顺德区顺达电脑厂有限公司 Method for detecting and processing scanning code of designable computer keyboard key
CN102346648B (en) * 2011-09-23 2013-11-06 惠州Tcl移动通信有限公司 Method and system for realizing priorities of input characters of squared up based on touch screen
CN105446493A (en) * 2015-12-31 2016-03-30 马晋龙 Left-hand keyboard and matched right-hand keyboard mouse
CN107391328A (en) * 2017-07-11 2017-11-24 Tcl移动通信科技(宁波)有限公司 A kind of mobile terminal key control method, mobile terminal and storage device

Also Published As

Publication number Publication date
CN108595018A (en) 2018-09-28

Similar Documents

Publication Publication Date Title
Spadone et al. Dynamic reorganization of human resting-state networks during visuospatial attention
US8749187B2 (en) Dynamically modified fan speed table for cooling a computer
Hart et al. Connectome analysis for pre-operative brain mapping in neurosurgery
Spitzer et al. Stimulus-dependent EEG activity reflects internal updating of tactile working memory in humans
O’Reilly et al. How can a Bayesian approach inform neuroscience?
US20150310262A1 (en) Apparatus and method of determining facial expression type
DE112010005616T5 (en) Heat management of an electronic device
CN108595018B (en) Keyboard scanning method and device, computer equipment and storage medium
CN104424361B (en) Automatic definition heat storage and big workload
Levin et al. The political polarization of COVID-19 treatments among physicians and laypeople in the United States
TWI514278B (en) Method for generating a reduced snapshot image for booting, computing apparatus readable recording medium, and computing apparatus
JP2017215868A (en) Anonymization processor, anonymization processing method, and program
Jones Does the ageing population correctly predict the need for medical beds? Part two: Wider implications
Lengler et al. Note on the coefficient of variations of neuronal spike trains
CN114999619A (en) Infectious disease bed dynamic quantification method based on time lag analysis
WO2016203752A1 (en) Information processing device, information processing method, and storage medium
Yamasaki et al. Front-presented looming sound selectively alters the perceived size of a visual looming object
CN109905722B (en) Method for determining suspected node and related equipment
US20160147966A1 (en) Apparatus and method for setting multi-hierarchy event alarm according user response
US20220391713A1 (en) Storage medium, information processing method, and information processing apparatus
CN109905443B (en) Data processing method, system, electronic device and computer readable medium
JP2016151959A (en) Secular change prediction system
Martz When more is not better
Slud Relative efficiency of the log rank test within a multiplicative intensity model
Tajmirriahi et al. Statistical inference of COVID-19 outbreak: Delay distribution effect in EQIR modeling of epidemic

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information
CB02 Change of applicant information

Address after: 519000 No. 333, Kexing Road, Xiangzhou District, Zhuhai City, Guangdong Province

Applicant after: ZHUHAI JIELI TECHNOLOGY Co.,Ltd.

Address before: Floor 1-107, building 904, ShiJiHua Road, Zhuhai City, Guangdong Province

Applicant before: ZHUHAI JIELI TECHNOLOGY Co.,Ltd.

GR01 Patent grant
GR01 Patent grant