A keyboard control method, device, apparatus and storage medium

CN120429022BActive Publication Date: 2026-09-25GUANGZHOU ZHONO ELECTRONICS TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510632055.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-05-16
Publication Date
2026-09-25
Estimated Expiration
2045-05-16

AI Technical Summary

Technical Problem

[0004]本申请实施例提供了一种键盘控制方法、装置、设备及存储介质,解决了现有技术中在特定的场景上,键盘性能无法得到更好的优化,导致在不同场景上存在较多性能的损失,软硬协同能力较差的问题,能够实现对键盘的高效控制和响应,优化了不同应用场景下的性能

Benefits of technology

[0042]本申请实施例中,基于第一DMA控制寄存器被外部DMA模块写入灯效设置数据的情况下,获取第二DMA控制寄存器的配置信息,根据配置信息确定键盘灯效显示的灯效更新模式和灯效更新速率,在DMA控制器基于灯效更新模式下对灯效寄存器进行访问,并根据灯效设置数据对所述灯效寄存器的灯效数据进行更新,通过灯光控制器基于灯效更新速率和更新后的灯效数据对键盘的灯效进行控制,其中,灯效更新模式包括色彩数据独立模式和色彩数据一致模式,灯效更新速率包括列更新速率、帧更新速率和闪烁更新速率,灯效数据包括灯效色彩数据和灯效亮度数据。本方案解决了现有技术中在特定的场景上,键盘性能无法得到更好的优化,导致在不同场景上存在较多性能的损失,软硬协同能力较差的问题,能够实现对键盘的高效控制和响应,优化了不同应用场景下的性能。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120429022B_ABST
    Figure CN120429022B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a keyboard control method, device, equipment and storage medium, the method comprises: based on the first DMA control register is written by external DMA module lamp effect setting data, obtain the configuration information of the second DMA control register, determine the lamp effect update mode and the lamp effect update rate of the keyboard lamp effect display according to the configuration information; in the DMA controller based on the lamp effect update mode to access the lamp effect register, and update the lamp effect data of the lamp effect register according to the lamp effect setting data; the lamp light controller controls the lamp effect of the keyboard based on the lamp effect update rate and the updated lamp effect data. The present scheme can realize efficient control and response of the keyboard, and optimize the performance in different application scenarios.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a keyboard control method, apparatus, device, and storage medium. Background Technology

[0002] Keyboard drivers can be categorized into software-driven and hardware-plus-software-driven models. Software-driven keyboards are entirely controlled by application software, resulting in a complex workflow and significantly lower performance compared to hardware-plus-software driven keyboards. Hardware-plus-software driven keyboards, on the other hand, utilize hardware for key detection and backlight control, with the software only needing to respond to key presses, thus offering higher performance.

[0003] In related technologies, most keyboard hardware designs apply general functions to different application scenarios. The hardware design is not good enough to match various application environments, and the hardware operation is complex. In specific scenarios, the keyboard performance cannot be better optimized, resulting in a lot of performance loss in different scenarios and poor software and hardware synergy. Summary of the Invention

[0004] This application provides a keyboard control method, device, equipment, and storage medium, which solves the problem in the prior art that the keyboard performance cannot be better optimized in specific scenarios, resulting in significant performance loss in different scenarios and poor software and hardware coordination. It can achieve efficient control and response of the keyboard and optimize performance in different application scenarios.

[0005] In a first aspect, embodiments of this application provide a keyboard control method, including:

[0006] When the first DMA control register is written with lighting effect setting data by an external DMA module, the configuration information of the second DMA control register is obtained, and the lighting effect update mode and lighting effect update rate of the keyboard lighting effect display are determined according to the configuration information.

[0007] The DMA controller accesses the lighting effect register based on the lighting effect update mode and updates the lighting effect data in the lighting effect register according to the lighting effect setting data;

[0008] The lighting effects of the keyboard are controlled by a lighting controller based on the lighting effect update rate and the updated lighting effect data.

[0009] The lighting effect update modes include color data independent mode and color data consistent mode; the lighting effect update rate includes column update rate, frame update rate and blink update rate; and the lighting effect data includes lighting effect color data and lighting effect brightness data.

[0010] Optionally, the access to the lighting effect register by the DMA controller based on the lighting effect update mode includes:

[0011] When the lighting effect update mode is the color data independent mode, the DMA controller links the first DMA control register to the lighting effect register according to the DMA pointer of the second DMA control register, wherein the number of links is equal to the number of keyboard rows; and / or

[0012] When the lighting effect update mode is the color data consistency mode, the DMA controller links the first DMA control register to the lighting effect register according to the DMA pointer of the second DMA control register, wherein the linking is performed once.

[0013] Optionally, when the lighting effect register is a color register, the lighting effect color data is the PWM output duty cycle of the blue channel, the PWM output duty cycle of the green channel, and the PWM output duty cycle of the red channel configured in the color register, and the lighting effect brightness data is the PWM unit masking value configured in the color register.

[0014] Optionally, when the lighting effect register is a color register and a dead-time register, the lighting effect color data is the duty cycle of the blue channel PWM output, the duty cycle of the green channel PWM output, and the duty cycle of the red channel PWM output configured in the color register, and the lighting effect brightness data is the dead-time length configured in the dead-time register.

[0015] Optionally, before the lighting effect setting data is written to the first DMA control register by the external DMA module, the method further includes:

[0016] The lighting effect update rate is determined based on the configuration information of the second DMA control register, and the DMA request initiation time is determined accordingly.

[0017] At the time the DMA request is initiated, an access to an external DMA module is initiated, which is used by the external DMA module to provide feedback on the lighting effect settings data.

[0018] Optionally, the determination of the lighting effect update rate based on the configuration information of the second DMA control register, and the determination of the DMA request initiation time, include:

[0019] When the lighting effect update rate is determined to be the column update rate based on the configuration information of the second DMA control register, the time when the dead zone begins after the column scan of each column of the keyboard ends is determined as the DMA request initiation time.

[0020] When the lighting effect update rate determined based on the configuration information of the second DMA control register is the frame update rate, the time when the dead zone begins after the column scan of the last column of the keyboard ends is determined as the DMA request initiation time.

[0021] If the lighting effect update rate is determined to be the blink update rate based on the configuration information of the second DMA control register, the start time of the keyboard light blinking off frame is determined as the DMA request initiation time.

[0022] Optionally, the method further includes:

[0023] The key state of the keyboard keys is determined based on the key state capture time, and key response processing is performed according to the key state. The key state capture time is a time period after a preset duration after the start of the column scan time of the key.

[0024] Optionally, determining the key state of a keyboard key based on the key state capture time includes:

[0025] If all key outputs are active during the key state capture time, the key state of the keyboard key is determined to be active.

[0026] If, during the key state capture time, a key output is detected to have both a valid level and an invalid level, the key state of the keyboard key is determined to be key maintenance.

[0027] If the key output is found to be completely invalid during the key state capture time, the key state of the keyboard key is determined to be key released.

[0028] Optionally, the key response processing based on the key state includes:

[0029] When the key state is active and / or the key is held, execute the key processing action control logic;

[0030] When the button is in the "button released" state, the button processing action control logic is not executed.

[0031] Secondly, embodiments of this application also provide a keyboard control device, including:

[0032] The acquisition module is configured to acquire the configuration information of the second DMA control register when the first DMA control register is written with lighting effect setting data by an external DMA module.

[0033] The determination module is configured to determine the lighting effect update mode and lighting effect update rate of the keyboard lighting effect display based on the configuration information. The lighting effect update mode includes color data independent mode and color data consistent mode. The lighting effect update rate includes column update rate, frame update rate and blink update rate.

[0034] The access module is configured to access the lighting effect registers in the lighting effect update mode based on the DMA controller;

[0035] The update module is configured to update the lighting effect data in the lighting effect register according to the lighting effect setting data, wherein the lighting effect data includes lighting effect color data and lighting effect brightness data;

[0036] The control module is configured to control the keyboard's lighting effects via a lighting controller based on the lighting effect update rate and the updated lighting effect data.

[0037] Thirdly, embodiments of this application also provide a keyboard control device, the device comprising:

[0038] One or more processors;

[0039] Storage device for storing one or more programs.

[0040] When the one or more programs are executed by the one or more processors, the one or more processors implement the keyboard control method described in the embodiments of this application.

[0041] Fourthly, embodiments of this application also provide a storage medium for storing computer-executable instructions, which, when executed by a computer processor, are used to perform the keyboard control method described in embodiments of this application.

[0042] In this embodiment, when the first DMA control register is written with lighting effect setting data by an external DMA module, the configuration information of the second DMA control register is obtained. Based on the configuration information, the lighting effect update mode and update rate for the keyboard lighting display are determined. The DMA controller accesses the lighting effect register based on the lighting effect update mode and updates the lighting effect data in the register according to the lighting effect setting data. The lighting controller controls the keyboard lighting effect based on the lighting effect update rate and the updated lighting effect data. The lighting effect update mode includes independent color data mode and consistent color data mode; the lighting effect update rate includes column update rate, frame update rate, and blink update rate; and the lighting effect data includes lighting effect color data and lighting effect brightness data. This solution solves the problem in the prior art where keyboard performance cannot be better optimized in specific scenarios, resulting in significant performance loss in different scenarios and poor hardware-software co-operation capabilities. It enables efficient control and response of the keyboard, optimizing performance in different application scenarios. Attached Figure Description

[0043] Figure 1 A flowchart illustrating a keyboard control method provided in an embodiment of this application;

[0044] Figure 2 A flowchart illustrating a keyboard control method including access mode of a lighting effect register, provided for an embodiment of this application;

[0045] Figure 3 A flowchart illustrating a keyboard control method for accessing a color register and updating lighting effect data, provided in an embodiment of this application;

[0046] Figure 4 A schematic diagram illustrating the shielding configuration of a PWM unit for a row of keyboard keys, provided in an embodiment of this application;

[0047] Figure 5 A flowchart illustrating a keyboard control method for accessing a color register and a dead-zone register and updating lighting effect data, provided for embodiments of this application;

[0048] Figure 6 A schematic diagram illustrating the dead zone length of a column of keyboard keys provided in an embodiment of this application;

[0049] Figure 7 A flowchart of a keyboard control method for determining the DMA request initiation time is provided for embodiments of this application;

[0050] Figure 8 A flowchart illustrating a keyboard control method for determining the key state and key response of keyboard keys, provided for an embodiment of this application;

[0051] Figure 9A module structure block diagram of a keyboard control device provided in an embodiment of this application;

[0052] Figure 10 This is a schematic diagram of the structure of a keyboard control device provided in an embodiment of this application. Detailed Implementation

[0053] The embodiments of this application will be further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are merely illustrative of the embodiments of this application and are not intended to limit the scope of the embodiments. Furthermore, it should be noted that, for ease of description, only the parts relevant to the embodiments of this application are shown in the accompanying drawings, not the entire structure.

[0054] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.

[0055] The keyboard control method provided in this application embodiment can be applied to keyboard control scenarios such as mechanical keyboards, gaming keyboards, and wireless keyboards.

[0056] Figure 1 A flowchart of a keyboard control method provided in an embodiment of this application is shown below. Figure 1 As shown, it specifically includes:

[0057] Step S101: When the first DMA control register is written with lighting effect setting data by the external DMA module, obtain the configuration information of the second DMA control register, and determine the lighting effect update mode and lighting effect update rate of the keyboard lighting effect display according to the configuration information.

[0058] DMA (Direct Memory Access) is a data transfer mechanism that does not require CPU intervention. It can independently handle data transfer between peripherals and memory / registers, saving CPU resources and improving transfer speed. The external DMA module is an independent hardware module that works in conjunction with the DMA controller. The external DMA module is primarily responsible for bus operations and physical data transfer, while the DMA controller is primarily responsible for logic control. Through this external DMA module, the first DMA control register can be accessed, and lighting effect setting data can be written to it. Based on the lighting effect setting data written to the first DMA control register by the external DMA module, the configuration information of the second DMA control register can be obtained. The lighting effect setting data can be data information about lighting effect settings that is pre-written by software to any contiguous address memory space accessible by the external DMA module. The first DMA control register and the second DMA control register refer to registers used to control and manage various parameters and states of DMA transfer. The first DMA control register is mainly used to manage the lighting effect setting data written by the external DMA module, and the second DMA control register is mainly used to store DMA configuration information. The configuration information of the second DMA control register can determine the lighting effect update mode and update rate of the keyboard lighting display. The lighting effect update mode describes the way the keyboard lighting effects are updated, and can include color data independent mode and color data consistent mode. Color data independent mode means that each key press updates with different color data. Color data consistent mode means that each column of keys updates with the same color data. The lighting effect update rate describes the speed at which the keyboard lighting effects are updated, and can include column update rate, frame update rate, and blink update rate. Column update rate means that the lighting effect is updated after each column of keys has completed its effective scan. Frame update rate means that the lighting effect is updated after all columns of keys have completed their effective scan. Blink update rate means that the lighting effect is updated after the keys have finished blinking.

[0059] For example, when an external DMA module accesses the first DMA control register to write lighting effect setting data, if the configuration information of the second DMA control register is obtained as color data independent mode and column update rate, then the lighting effect update mode of the keyboard lighting effect display is determined to be color data independent mode and the lighting effect update rate is column update rate.

[0060] Step S102: The DMA controller accesses the lighting effect register based on the lighting effect update mode and updates the lighting effect data in the lighting effect register according to the lighting effect setting data.

[0061] After determining the keyboard lighting effect update mode and update rate, the DMA controller can access the lighting effect register based on the update mode. Simultaneously, the lighting effect data in the register can be updated using the lighting effect setting data written to the first DMA control register. The DMA controller is responsible for performing high-speed data transfer operations independently of the CPU, interacting with external DMA modules via DMA request signals. The lighting effect register represents the register storing data related to keyboard key lighting effects. Lighting effect data refers to the data controlling the keyboard key display lighting effects. Lighting effect data includes lighting effect color data and lighting effect brightness data. Lighting effect color data controls the color of the keyboard keys, and lighting effect brightness data controls the brightness of the keyboard keys. In one embodiment, accessing the lighting effect register can be achieved as follows: In the color data independent update mode, the DMA controller links the first DMA control register to the lighting effect register based on the DMA pointer of the second DMA control register, where the number of links corresponds to the number of keyboard rows. In the color data consistent update mode, the DMA controller links the first DMA control register to the lighting effect register based on the DMA pointer of the second DMA control register, where the number of links is one. Color data consistent mode refers to an update mode where the color data updated for each row of keyboard keys is the same. By employing a configurable DMA pointer linking mechanism, differentiated lighting effect configurations can be achieved based on the color data independent mode, while full keyboard lighting effect synchronization can be achieved through the color data consistent mode. This reduces redundant data transfers and register access operations, significantly reducing memory usage and bus resource consumption.

[0062] Step S103: Control the keyboard lighting effect using the lighting controller based on the lighting effect update rate and the updated lighting effect data.

[0063] After updating the lighting effect data in the lighting effect register, the lighting controller can control the keyboard lighting effects based on the lighting effect update rate and the updated lighting effect data. The lighting controller is responsible for controlling the keyboard lighting display. It is responsible for the PWM control output of each row of RGB lights on the keyboard. Each row of RGB lights has three PWM wave outputs, each composed of individual PWM units. One PWM unit is an RGB unit, which refers to the color unit of an RGB light, i.e., the unit that obtains the color by mixing the three PWM waveforms of R (red), G (green), and B (blue) over a period of time. For example, if the lighting effect update rate is per column, and the lighting effect data is the PWM output control data of each row of keyboard keys, then after the current column of keys has finished scanning and the lighting effect data has been updated, the lighting controller controls the PWM output of each key on the keyboard according to the updated PWM output control data of each row of keyboard keys to display the keyboard lighting effects.

[0064] As described above, by accessing the first DMA control register through an external DMA module to write lighting effect setting data, the configuration information of the second DMA control register is obtained. Based on the configuration information, the lighting effect update mode and update rate of the keyboard lighting display are determined. The lighting effect update mode includes color data independent mode and color data consistent mode. The lighting effect update rate includes column update rate, frame update rate, and blink update rate. The DMA controller accesses the lighting effect register based on the lighting effect update mode and updates the lighting effect data in the lighting effect register according to the lighting effect setting data. The lighting effect data includes lighting effect color data and lighting effect brightness data. The lighting controller controls the keyboard lighting effect based on the lighting effect update rate and the updated lighting effect data. This solution solves the problem in the prior art that the keyboard performance cannot be better optimized in specific scenarios, resulting in significant performance loss in different scenarios and poor software and hardware coordination capabilities. It can achieve efficient control and response of the keyboard and optimize performance in different application scenarios.

[0065] Figure 2 A flowchart illustrating a keyboard control method including access to a lighting effect register, provided in an embodiment of this application, is shown below. Figure 2 As shown, it specifically includes:

[0066] Step S201: When the first DMA control register is written with lighting effect setting data by the external DMA module, obtain the configuration information of the second DMA control register, and determine the lighting effect update mode and lighting effect update rate of the keyboard lighting effect display according to the configuration information.

[0067] Step S202: When the lighting effect update mode is color data independent mode, the DMA controller links the first DMA control register to the lighting effect register according to the DMA pointer of the second DMA control register, wherein the number of links is the number of keyboard rows.

[0068] The DMA pointer represents an address value stored in the second DMA control register, guiding the DMA controller to the target location for data transfer. In one embodiment, when the lighting effect update mode is color data independent mode, the DMA controller can link the first DMA control register to the lighting effect registers corresponding to each keyboard row based on the DMA pointer of the second DMA control register. Each lighting effect register stores the lighting effect data for one row of keyboard keys. For example, in color data independent mode, where the lighting effect data for each keyboard key is different, the current DMA pointer of the second DMA control register is 0x00, pointing to lighting effect register 0 corresponding to the first row of keyboard keys. The DMA controller then links the first DMA control register to lighting effect register 0. After the link is complete and the lighting effect setting data for lighting effect register 0 is transmitted, the DMA pointer of the second DMA control register is automatically updated to 0x01, pointing to lighting effect register 1 corresponding to the second row of keyboard keys, and so on, until all rows of keyboard key lighting effect registers are linked to the first DMA control register.

[0069] Step S203: When the lighting effect update mode is the color data consistency mode, the DMA controller links the first DMA control register to the lighting effect register according to the DMA pointer of the second DMA control register, wherein the linking is performed once.

[0070] In one embodiment, when the lighting effect update mode is a color data consistency mode, the DMA controller links the first DMA control register to the lighting effect register corresponding to any keyboard row based on the DMA pointer of the second DMA control register. After the lighting effect data in that lighting effect register is updated, the updated lighting effect data in that register is then updated to the lighting effect registers corresponding to other keyboard rows. For example, in the color data consistency mode, where the lighting effect data for each column of keyboard keys is the same, and the DMA pointer of the second DMA control register points to the lighting effect register corresponding to the first keyboard row, the DMA controller links the first DMA control register to the lighting effect register corresponding to the first keyboard row. After the transmission of lighting setting data between the first DMA control register and the lighting effect register corresponding to the first keyboard row is completed, the updated lighting effect data in the lighting effect register corresponding to the first keyboard row is updated to the lighting effect registers corresponding to other keyboard rows. During this process, only one link between the first DMA control register and the lighting effect register is performed.

[0071] Step S204: Update the lighting effect data in the lighting effect register according to the lighting effect setting data.

[0072] Step S205: Control the keyboard lighting effect using the lighting controller based on the lighting effect update rate and the updated lighting effect data.

[0073] As described above, when the lighting effect update mode is color data independent, the DMA controller links the first DMA control register to the lighting effect register according to the DMA pointer in the second DMA control register. The number of links is equal to the number of keyboard rows. When the lighting effect update mode is color data consistent, the DMA controller links the first DMA control register to the lighting effect register according to the DMA pointer in the second DMA control register, and the number of links is one. This solution, by employing a configurable DMA pointer linking mechanism, can achieve differentiated lighting effect configuration based on color data independent mode, while simultaneously completing synchronized updates of all keyboard lighting effects through color data consistent mode. This reduces redundant data transfers and register access operations, significantly reducing memory usage and bus resource consumption.

[0074] Figure 3 A flowchart illustrating a keyboard control method including access to a color register and updating lighting effect data, provided in this application embodiment, is shown below. Figure 3 As shown, it specifically includes:

[0075] Step S301: When the first DMA control register is written with lighting effect setting data by the external DMA module, obtain the configuration information of the second DMA control register, and determine the lighting effect update mode and lighting effect update rate of the keyboard lighting effect display according to the configuration information.

[0076] Step S302: The DMA controller accesses the color register based on the lighting effect update mode and updates the lighting effect data of the color register according to the lighting effect setting data.

[0077] In the case where the lighting effect register is a color register, the lighting effect color data consists of the PWM output duty cycles of the blue, green, and red channels configured in the color register, while the lighting effect brightness data is the PWM unit mask value configured in the color register. The PWM output duty cycle of each color channel refers to the duty cycle of the PWM (Pulse Width Modulation) signal for the corresponding color channel (red, green, blue), representing the proportion of the conduction time of that color channel within one cycle. By adjusting the combination of the duty cycles of the three color channels, various colors of RGB lights can be generated. For example, if the PWM output duty cycles of the blue, green, and red channels are all 100%, the resulting color is white.

[0078] The PWM unit masking value represents the amount of PWM signal that is masked in the RGB LED output PWM unit during column scanning of the keyboard keys. This PWM unit masking value can be used to adjust the brightness of the keyboard keys; the smaller the masking value, the brighter the corresponding key. For example, ... Figure 4 As shown, Figure 4 This is a schematic diagram illustrating the PWM unit shielding of a column of keyboard keys according to an embodiment of this application. The column length is the time required to scan a column of keys, the scan length is the effective scan time (i.e., the time for which the scan voltage is applied), and the dead zone is the ineffective scan time (i.e., the time for which no scan voltage is applied). The keyboard has four rows of keys. Each PWM module represents a PWM unit output by the RGB LEDs of the keyboard keys. The scan length is eight PWM units. The first row outputs PWM units with the same scan length and has the brightest brightness. The second row outputs PWM units with a value of 7 and a shielding value of 1, making its brightness less than that of the first row of keys. The third row outputs PWM units with a value of 6 and a shielding value of 2, making its brightness less than that of the second row of keys. The fourth row does not output any PWM unit values ​​and has a shielding value of 8, equal to the scan length; therefore, the RGB LEDs of these keyboard keys are off.

[0079] Step S303: Control the keyboard lighting effect using the lighting controller based on the lighting effect update rate and the updated lighting effect data.

[0080] As described above, when the lighting effect register is a color register, the lighting effect color data consists of the PWM output duty cycles of the blue channel, green channel, and red channel configured in the color register, while the lighting effect brightness data consists of the PWM unit masking value configured in the color register. This solution allows for individual adjustment of the brightness of a single RGB light by adjusting the PWM output time of each RGB light.

[0081] Figure 5A flowchart illustrating a keyboard control method for accessing color registers and dead-time registers and updating lighting effect data, provided as an embodiment of this application, is shown below. Figure 5 As shown, it specifically includes:

[0082] Step S401: When the first DMA control register is written with lighting effect setting data by the external DMA module, obtain the configuration information of the second DMA control register, and determine the lighting effect update mode and lighting effect update rate of the keyboard lighting effect display according to the configuration information.

[0083] Step S402: The DMA controller accesses the color register and dead zone register based on the lighting effect update mode, and updates the lighting effect data of the color register and dead zone register according to the lighting effect setting data.

[0084] In the case where the lighting effect register consists of a color register and a dead-zone register, the lighting effect color data is the duty cycle of the blue channel PWM output, the duty cycle of the green channel PWM output, and the duty cycle of the red channel PWM output configured in the color register. The lighting effect brightness data is the dead-zone length configured in the dead-zone register. The dead-zone register is used to store relevant data about the dead zone. The dead zone is the length of time during which an invalid scan occurs within the keyboard column scan length, i.e., the length of time during which no scan voltage is applied. It is used to wait for the output state of the current column to become invalid before scanning the next column, preventing the key input (scan) of the previous column from affecting the state output of the key in the next column when switching between two columns. The dead-zone length is used to characterize the duration of the dead zone. This dead-zone length can adjust the proportion of the light within the column length time to adjust the brightness; the shorter the dead-zone length, the brighter the light. For example, as shown... Figure 6 As shown, Figure 6 This is a schematic diagram of the dead zone length of a column of keyboard keys provided in an embodiment of this application. The keyboard has four rows of keys. The dead zone output of the first row corresponds to DTL=1, indicating a dead zone length of 1 PWM unit length. The dead zone output of the second row corresponds to DTL=3, indicating a dead zone length of 3 PWM units. The dead zone output of the third row corresponds to DTL=5, indicating a dead zone length of 5 PWM units. The dead zone output of the fourth row corresponds to DTL=2, indicating a dead zone length of 2 PWM units. The brightness of the lights is arranged according to the dead zone length of each row, resulting in the following order: first row keyboard key brightness > fourth row keyboard key brightness > second row keyboard key brightness > third row keyboard key brightness.

[0085] Step S403: Control the keyboard lighting effect using the lighting controller based on the lighting effect update rate and the updated lighting effect data.

[0086] As described above, when the lighting effect register consists of a color register and a dead-time register, the lighting effect color data is the duty cycle of the blue channel PWM output, the duty cycle of the green channel PWM output, and the duty cycle of the red channel PWM output configured in the color register, and the lighting effect brightness data is the dead-time length configured in the dead-time register. This solution allows for adjustment of the keyboard key lighting by updating the dead-time length in the dead-time register.

[0087] Figure 7 A flowchart of a keyboard control method for determining the DMA request initiation time, provided as an embodiment of this application, is shown below. Figure 7 As shown, it specifically includes:

[0088] Step S501: Based on the configuration information of the second DMA control register, determine the lighting effect update rate, determine the DMA request initiation time, and initiate access to the external DMA module at the DMA request initiation time for the external DMA module to provide feedback on the lighting effect setting data.

[0089] The DMA request is a signal that requests access to an external DMA module and returns lighting effect setting data. The initiation time of this DMA request varies depending on the lighting effect update rate. Optionally, the DMA request initiation time can be determined based on the lighting effect update rate determined by the configuration information of the second DMA control register. One method for determining the DMA request initiation time is as follows: when the lighting effect update rate is the column update rate, the time when the dead zone begins after the column scan of each column of the keyboard ends is determined as the DMA request initiation time; when the lighting effect update rate is the frame update rate, the time when the dead zone begins after the column scan of the last column of the keyboard ends is determined as the DMA request initiation time; when the lighting effect update rate is the blink update rate, the time when the blinking off frame of the keyboard lights begins is determined as the DMA request initiation time. For example, if the lighting effect update rate is the column update rate, and the current column scan of the nth column of the keyboard has ended, then a DMA request is initiated to the external DMA module at the start time of the dead zone of the nth column scan. By initiating the DMA request at the start time of the dead zone, the normal new data output of the PWM unit can be unaffected, while avoiding the increase of buffered data.

[0090] In another embodiment, one method for determining the DMA request initiation time is as follows: If the DMA pointer in the configuration information of the second DMA control register points to the dead-time register and the lighting effect update rate is the column update rate, the start time of the first PWM unit output of the next column after the column scan of each keyboard column is completed is determined as the DMA request time. If the DMA pointer in the configuration information of the second DMA control register points to the dead-time register and the lighting effect update rate is the frame update rate, the start time of the first PWM unit output after the column scan of all keyboard columns is completed is determined as the DMA request time. If the DMA pointer in the configuration information of the second DMA control register points to the dead-time register and the lighting effect update rate is the blink update rate, the start time of the first PWM unit output after the blink off frame of the keyboard lights is completed is determined as the DMA request initiation time. By delaying the DMA request corresponding to the dead-time register to be initiated and terminated within the first PWM unit, the possibility of DMA underflow exceptions can be reduced. Since the data update after the dead zone will take effect at the end of the first PWM unit (the scan length is determined by the column length and the dead zone length and is at least 1 PWM unit), there is more time left for the DMA to work normally. It is only required that the DMA access process of at least all keyboard rows can be completed within the dead zone and that 1 DMA access process can be completed within the first PWM unit, rather than that all DMA access processes are required to be completed within the dead zone.

[0091] Step S502: When the first DMA control register is written with lighting effect setting data by the external DMA module, obtain the configuration information of the second DMA control register, and determine the lighting effect update mode and lighting effect update rate of the keyboard lighting effect display according to the configuration information.

[0092] Step S503: The DMA controller accesses the lighting effect register based on the lighting effect update mode and updates the lighting effect data in the lighting effect register according to the lighting effect setting data.

[0093] Step S504: Control the keyboard lighting effect using the lighting controller based on the lighting effect update rate and the updated lighting effect data.

[0094] As described above, before the external DMA module accesses the first DMA control register to write the lighting effect setting data, the DMA request initiation time is determined by the lighting effect update rate based on the configuration information of the second DMA control register. At the DMA request initiation time, an access to the external DMA module is initiated for the external DMA module to provide feedback on the lighting effect setting data. This solution determines the DMA request initiation time by configuring the lighting effect update rate, establishing a precise coordination mechanism between hardware timing and software control. It balances performance, real-time performance, and energy efficiency, providing a fundamental guarantee for the smooth operation of complex keyboard lighting effects.

[0095] Figure 8 A flowchart illustrating a keyboard control method for determining the key states and key responses of keyboard keys, as provided in this application embodiment, is shown below. Figure 8 As shown, it specifically includes:

[0096] Step S601: When the first DMA control register is written with lighting effect setting data by the external DMA module, obtain the configuration information of the second DMA control register, and determine the lighting effect update mode and lighting effect update rate of the keyboard lighting effect display according to the configuration information.

[0097] Step S602: The DMA controller accesses the lighting effect register based on the lighting effect update mode, and updates the lighting effect data in the lighting effect register according to the lighting effect setting data.

[0098] Step S603: Control the keyboard lighting effect using the lighting controller based on the lighting effect update rate and the updated lighting effect data.

[0099] Step S604: Determine the key state of the keyboard keys based on the set key state capture time, and perform corresponding key response processing according to the key state. The key state capture time is the time period after the preset duration after the start of the column scan time of the key.

[0100] The key state capture time characterizes the time taken to detect the key state of the keyboard during column scanning. This key state capture time is the time period following a preset duration after the start of the column scan time. Based on the determined key state, corresponding key response processing can be performed. Optionally, one method for determining the key state is as follows: if all key outputs are detected as valid during the key state capture time, the key state is determined to be "keystroke active"; if both valid and invalid key outputs are detected during the key state capture time, the key state is determined to be "key held"; and if all key outputs are detected as invalid during the key state capture time, the key state is determined to be "key released". For example, the column scan time of the buttons is set to 20ms, and the preset duration is 10ms. That is, the button state capture time is the last 10ms of the column scan time. The effective level value is 1, and the ineffective level value is 0. If button a is detected to have all 1s in the last 10ms of the column scan time, the button state of button a is keystroke active. If button b is detected to have all 0s in the last 10ms of the column scan time, the button state of button b is keystroke released. If button c is detected to have both 1s and 0s in the last 10ms of the column scan time, the button state of button c is keystroke sustained. Here, buttons a, b, and c are buttons in the same column.

[0101] In another embodiment, a method for determining a key state may be to sample the key output within the same scanning cycle multiple times during the key state capture time. If the proportion of valid levels in N consecutive samples exceeds a preset threshold, the key state of the keyboard key is determined to be a keystroke valid. If the proportion of invalid levels in N consecutive samples exceeds a preset threshold, the key state of the keyboard key is determined to be a key release. Otherwise, the key state of the keyboard key is determined to be a key hold. Here, N is an integer greater than 1, and the time interval between the multiple samplings is less than a preset duration.

[0102] In one embodiment, the specific process of handling key responses based on key states can be as follows: when the key state is "keystroke active" and / or "key held," key processing action control logic is executed; when the key state is "key released," key processing action control logic is not executed. The specific key processing action control logic is based on different hardware and software function settings. Taking a numeric keypad lock key on a keyboard as an example, when a keystroke is detected as active, the corresponding numeric keypad lock or unlock control logic is executed. Of course, the key response processing process described above can also be reversed; for example, when the key state is "keystroke active" and / or "key held," key processing action control logic is not executed, but when the key state is "key released," key processing action control logic is executed.

[0103] As described above, the key state of the keyboard is determined based on the set key state capture time, and corresponding key response processing is performed according to the key state. The key state capture time is the time period following a preset duration after the start of the column scan time for the set key. This solution avoids capturing the key state for a period of time before the column scan, making the key state dependent on the later period of the column scan. This avoids obtaining an incorrect key state and improves the accuracy of the key state.

[0104] Figure 9 This is a block diagram of a keyboard control device provided in an embodiment of this application. The device is used to execute a keyboard control method provided in the above embodiment, and has corresponding functional modules and beneficial effects for executing the method. Figure 9 As shown, the system specifically includes:

[0105] The acquisition module 101 is configured to acquire the configuration information of the second DMA control register when the first DMA control register is written with lighting effect setting data by an external DMA module.

[0106] The determining module 102 is configured to determine the lighting effect update mode and lighting effect update rate of the keyboard lighting effect display based on the configuration information. The lighting effect update mode includes color data independent mode and color data consistent mode. The lighting effect update rate includes column update rate, frame update rate and blink update rate.

[0107] Access module 103 is configured to access the lighting effect register in the lighting effect update mode based on the DMA controller;

[0108] The update module 104 is configured to update the lighting effect data in the lighting effect register according to the lighting effect setting data, wherein the lighting effect data includes lighting effect color data and lighting effect brightness data.

[0109] The control module 105 is configured to control the lighting effects of the keyboard based on the lighting effect update rate and the updated lighting effect data via a lighting controller.

[0110] As described above, when the first DMA control register is written with lighting effect setting data by an external DMA module, the configuration information of the second DMA control register is obtained. Based on the configuration information, the lighting effect update mode and update rate for the keyboard lighting display are determined. The DMA controller accesses the lighting effect register based on the lighting effect update mode and updates the lighting effect data in the register according to the lighting effect setting data. The lighting controller then controls the keyboard lighting effects based on the lighting effect update rate and the updated lighting effect data. The lighting effect update modes include independent color data mode and consistent color data mode; the lighting effect update rate includes column update rate, frame update rate, and blink update rate; and the lighting effect data includes lighting effect color data and lighting effect brightness data. This solution solves the problem in existing technologies where keyboard performance cannot be better optimized in specific scenarios, resulting in significant performance loss in different scenarios and poor hardware-software synergy. It enables efficient control and response of the keyboard, optimizing performance in different application scenarios.

[0111] In one possible embodiment, the access module is specifically configured as follows:

[0112] When the lighting effect update mode is the color data independent mode, the DMA controller links the first DMA control register to the lighting effect register according to the DMA pointer of the second DMA control register, wherein the number of links is equal to the number of keyboard rows; and / or

[0113] When the lighting effect update mode is the color data consistency mode, the DMA controller links the first DMA control register to the lighting effect register according to the DMA pointer of the second DMA control register, wherein the linking is performed once.

[0114] Optionally, when the lighting effect register is a color register, the lighting effect color data is the PWM output duty cycle of the blue channel, the PWM output duty cycle of the green channel, and the PWM output duty cycle of the red channel configured in the color register, and the lighting effect brightness data is the PWM unit masking value configured in the color register.

[0115] Optionally, when the lighting effect register is a color register and a dead-time register, the lighting effect color data is the duty cycle of the blue channel PWM output, the duty cycle of the green channel PWM output, and the duty cycle of the red channel PWM output configured in the color register, and the lighting effect brightness data is the dead-time length configured in the dead-time register.

[0116] Optionally, the device also includes a request sending module, configured as follows:

[0117] Before the lighting effect setting data is written to the first DMA control register by the external DMA module, the DMA request initiation time is determined based on the lighting effect update rate determined by the configuration information of the second DMA control register.

[0118] At the time the DMA request is initiated, an access to an external DMA module is initiated, which is used by the external DMA module to provide feedback on the lighting effect settings data.

[0119] Optionally, the request sending module is specifically configured as follows:

[0120] When the lighting effect update rate is determined to be the column update rate based on the configuration information of the second DMA control register, the time when the dead zone begins after the column scan of each column of the keyboard ends is determined as the DMA request initiation time.

[0121] When the lighting effect update rate determined based on the configuration information of the second DMA control register is the frame update rate, the time when the dead zone begins after the column scan of the last column of the keyboard ends is determined as the DMA request initiation time.

[0122] If the lighting effect update rate is determined to be the blink update rate based on the configuration information of the second DMA control register, the start time of the keyboard light blinking off frame is determined as the DMA request initiation time.

[0123] Optionally, the device also includes a key processing module, configured as follows:

[0124] The key state of the keyboard keys is determined based on the key state capture time, and key response processing is performed according to the key state. The key state capture time is a time period after a preset duration after the start of the column scan time of the key.

[0125] Optional, button processing module, specifically configured as follows:

[0126] If all key outputs are active during the key state capture time, the key state of the keyboard key is determined to be active.

[0127] If, during the key state capture time, a key output is detected to have both a valid level and an invalid level, the key state of the keyboard key is determined to be key maintenance.

[0128] If the key output is found to be completely invalid during the key state capture time, the key state of the keyboard key is determined to be key released.

[0129] Optional, button processing module, specifically configured as follows:

[0130] When the key state is active and / or the key is held, execute the key processing action control logic;

[0131] When the button is in the "button released" state, the button processing action control logic is not executed.

[0132] Figure 10 This is a schematic diagram of the structure of a keyboard control device provided in an embodiment of this application, as shown below. Figure 10 As shown, the device includes a processor 201, a memory 202, an input device 203, and an output device 204; the number of processors 201 in the device can be one or more. Figure 10 Taking a processor 201 as an example; the processor 201, memory 202, input device 203, and output device 204 in the device can be connected via a bus or other means. Figure 10 Taking a bus connection as an example, the memory 202, as a computer-readable storage medium, can be used to store software programs, computer-executable programs, and modules, such as the program instructions or modules corresponding to a keyboard control method in this embodiment. The processor 201 executes various functional applications and data processing of the device by running the software programs, instructions, and modules stored in the memory 202, thereby implementing the aforementioned keyboard control method. The input device 203 can be used to receive input numerical or character information and generate key signal inputs related to user settings and function control of the device. The output device 204 may include a display device such as a screen.

[0133] This application also provides a storage medium containing computer-executable instructions, which, when executed by a computer processor, are used to perform a keyboard control method, the method comprising:

[0134] When the first DMA control register is written with lighting effect setting data by an external DMA module, the configuration information of the second DMA control register is obtained, and the lighting effect update mode and lighting effect update rate of the keyboard lighting effect display are determined according to the configuration information.

[0135] The DMA controller accesses the lighting effect register based on the lighting effect update mode and updates the lighting effect data in the lighting effect register according to the lighting effect setting data;

[0136] The lighting effects of the keyboard are controlled by a lighting controller based on the lighting effect update rate and the updated lighting effect data.

[0137] The lighting effect update modes include color data independent mode and color data consistent mode; the lighting effect update rate includes column update rate, frame update rate and blink update rate; and the lighting effect data includes lighting effect color data and lighting effect brightness data.

[0138] It is worth noting that in the above-described embodiment of a keyboard control method system, the various units and modules included are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be achieved; in addition, the specific names of each functional unit are only for easy differentiation and are not used to limit the protection scope of the embodiments of this application.

[0139] Note that the above are merely preferred embodiments and the technical principles applied in this application. Those skilled in the art will understand that the embodiments of this application are not limited to the specific embodiments described herein, and various obvious changes, readjustments, and substitutions can be made by those skilled in the art without departing from the protection scope of the embodiments of this application. Therefore, although the embodiments of this application have been described in detail through the above embodiments, the embodiments of this application are not limited to the above embodiments. More other equivalent embodiments may be included without departing from the concept of the embodiments of this application, and the scope of the embodiments of this application is determined by the scope of the appended claims.

Claims

1. A keyboard control method, characterized in that, include: When the first DMA control register is written with lighting effect setting data by an external DMA module, the configuration information of the second DMA control register is obtained, and the lighting effect update mode and lighting effect update rate of the keyboard lighting effect display are determined according to the configuration information; The DMA controller accesses the lighting effect register based on the lighting effect update mode and updates the lighting effect data of the lighting effect register according to the lighting effect setting data. The access of the lighting effect register based on the lighting effect update mode by the DMA controller includes: when the lighting effect update mode is a color data independent mode, the DMA controller links the first DMA control register to the lighting effect register according to the DMA pointer of the second DMA control register, wherein the number of links is the number of keyboard rows. The lighting effects of the keyboard are controlled by a lighting controller based on the lighting effect update rate and the updated lighting effect data. The lighting effect update modes include independent color data mode and consistent color data mode. The lighting effect update rate includes column update rate, frame update rate, and blink update rate. The lighting effect data includes lighting effect color data and lighting effect brightness data. The independent color data mode refers to a mode in which the color data updated for each keyboard key is different. The consistent color data mode refers to an update mode in which the color data updated for each column of keyboard keys is the same. The column update rate refers to the lighting effect update performed after the effective scan of each column of keyboard keys is completed. The frame update rate refers to the lighting effect update performed after the effective scan of all columns of keyboard keys is completed. The blink update rate refers to the lighting effect update performed after the keyboard keys have finished blinking.

2. The keyboard control method according to claim 1, characterized in that, The access to the lighting effect register by the DMA controller based on the lighting effect update mode further includes: When the lighting effect update mode is the color data consistency mode, the DMA controller links the first DMA control register to the lighting effect register according to the DMA pointer of the second DMA control register, wherein the linking is performed once.

3. The keyboard control method according to claim 1 or 2, characterized in that, When the lighting effect register is a color register, the lighting effect color data is the duty cycle of the blue channel PWM output, the duty cycle of the green channel PWM output, and the duty cycle of the red channel PWM output configured in the color register, and the lighting effect brightness data is the PWM unit mask value configured in the color register.

4. The keyboard control method according to claim 1 or 2, characterized in that, When the lighting effect register is a color register and a dead-time register, the lighting effect color data is the duty cycle of the blue channel PWM output, the duty cycle of the green channel PWM output, and the duty cycle of the red channel PWM output configured in the color register, and the lighting effect brightness data is the dead-time length configured in the dead-time register.

5. The keyboard control method according to any one of claims 1-2, characterized in that, Before the lighting effect setting data is written to the first DMA control register by the external DMA module, the following is also included: The lighting effect update rate is determined based on the configuration information of the second DMA control register, and the DMA request initiation time is determined accordingly. At the time the DMA request is initiated, an access to an external DMA module is initiated, which is used by the external DMA module to provide feedback on the lighting effect settings data.

6. The keyboard control method according to claim 5, characterized in that, The lighting effect update rate determined based on the configuration information of the second DMA control register, and the DMA request initiation time determined, include: When the lighting effect update rate is determined to be the column update rate based on the configuration information of the second DMA control register, the time when the dead zone begins after the column scan of each column of the keyboard ends is determined as the DMA request initiation time. When the lighting effect update rate determined based on the configuration information of the second DMA control register is the frame update rate, the time when the dead zone begins after the column scan of the last column of the keyboard ends is determined as the DMA request initiation time. If the lighting effect update rate is determined to be the blink update rate based on the configuration information of the second DMA control register, the start time of the keyboard light blinking off frame is determined as the DMA request initiation time.

7. The keyboard control method according to claim 1, characterized in that, The method further includes: The key state of the keyboard keys is determined based on the key state capture time, and key response processing is performed according to the key state. The key state capture time is a time period after a preset duration after the start of the column scan time of the key.

8. The keyboard control method according to claim 7, characterized in that, The method of determining the key state of the keyboard based on the key state capture time includes: If all key outputs are active during the key state capture time, the key state of the keyboard key is determined to be active. If, during the key state capture time, a key output is detected to have both a valid level and an invalid level, the key state of the keyboard key is determined to be key maintenance. If the key output is found to be completely invalid during the key state capture time, the key state of the keyboard key is determined to be key released.

9. The keyboard control method according to claim 7, characterized in that, The key response processing based on the key state includes: When the key state is active and / or the key is held, execute the key processing action control logic; When the button is in the "button released" state, the button processing action control logic is not executed.

10. A keyboard control device, characterized in that, include: The acquisition module is configured to acquire the configuration information of the second DMA control register when the first DMA control register is written with lighting effect setting data by an external DMA module. The determination module is configured to determine the lighting effect update mode and lighting effect update rate of the keyboard lighting effect display based on the configuration information. The lighting effect update mode includes a color data independent mode and a color data consistent mode. The lighting effect update rate includes a column update rate, a frame update rate, and a blink update rate. The color data independent mode refers to a mode in which the color data updated by each keyboard key is different. The color data consistent mode refers to an update mode in which the color data updated by each column of keyboard keys is the same. The column update rate refers to the lighting effect update performed after the effective scan of each column of keyboard keys is completed. The frame update rate refers to the lighting effect update performed after the effective scan of all columns of keyboard keys is completed. The blink update rate refers to the lighting effect update performed after the keyboard keys have finished blinking. The access module is configured to access the lighting effect register in the lighting effect update mode based on the DMA controller. Specifically, the access module is configured to: when the lighting effect update mode is the color data independent mode, link the first DMA control register to the lighting effect register through the DMA controller according to the DMA pointer of the second DMA control register, wherein the number of links is the number of keyboard rows. The update module is configured to update the lighting effect data in the lighting effect register according to the lighting effect setting data, wherein the lighting effect data includes lighting effect color data and lighting effect brightness data; The control module is configured to control the keyboard's lighting effects via a lighting controller based on the lighting effect update rate and the updated lighting effect data.

11. A keyboard control device, the device comprising: One or more processors; A storage device for storing one or more programs, which, when executed by one or more processors, cause the one or more processors to implement the keyboard control method as described in any one of claims 1-9.

12. A storage medium storing computer-executable instructions, which, when executed by a computer processor, are used to perform the keyboard control method as described in any one of claims 1-9.

Citation Information

Patent Citations

  • MCU capable of driving multiple groups of RGB lamps and driving method thereof

    CN113434199A

  • Atmosphere lamp control method, controller, electronic equipment and storage medium

    CN115568055A