Level setting method and electronic equipment

CN120604197APending Publication Date: 2025-09-05HONOR DEVICE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202480009972.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2023-07-03
Filing Date
2024-03-12
Publication Date
2025-09-05

AI Technical Summary

Technical Problem

After a long period of use, the keyboard in electronic devices may cause abnormal oxides to cause incorrect key scanning results, shortening the service life and reducing the user experience.

Method used

By monitoring the keyboard usage status, adjust the level of the output pin to reduce the potential difference between the input pin and the output pin, including setting it to low level in the keyboard off state and high level in the on state, Ensure the accuracy of key scanning and extend keyboard life.

Benefits of technology

Effectively slow down the generation of abnormal oxides, improve the accuracy of keyboard scanning results, extend the service life of the keyboard, and improve user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120604197A_ABST
    Figure CN120604197A_ABST
Patent Text Reader

Abstract

The embodiment of the invention is applied to the field of circuit control, and provides a level setting method and electronic equipment. Under the condition that the electronic equipment determines that the keyboard is in the closed state, the level states of all the output pins in the keyboard are configured to be the first level, so that potential difference between the input pins and the output pins is avoided. And under the condition that the keyboard is in the open state, the electronic equipment configures the levels of all output pins corresponding to keys in the keyboard as a second level or a third level. Under the condition that the level of the output pin is the second level or the third level, when the keyboard receives the click operation of the user on the key, interruption can be normally generated, so that the electronic equipment can determine the key clicked by the user based on the interruption. In the application, generation of abnormal oxides can be slowed down by reducing the duration of the potential difference, the probability of keyboard aging is reduced, the service life of the electronic equipment is prolonged, and the use experience of a user is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Level setting method and electronic equipment

[0001] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office on July 3, 2023, with application number 202310810477.5 and invention name “A level setting method and electronic device”, the entire contents of which are incorporated by reference into this application. Technical Field

[0002] The present application relates to the field of circuit control, and in particular to a level setting method and electronic equipment. Background Art

[0003] With the development of technology, electronic devices (such as tablet computers) are usually equipped with corresponding keyboards. When a user uses the keyboard to input, the user can click a key on the keyboard. The keyboard responds to the key click operation and generates an interrupt. The electronic device can scan the key based on the interrupt and obtain the corresponding key scan result, that is, determine the key clicked by the user, and then perform corresponding processing operations, such as displaying the content corresponding to the key clicked by the user.

[0004] However, after using the keyboard for a period of time, abnormal oxides may be generated on the keyboard circuit, causing the electronic device to obtain incorrect key scanning results, thereby causing the electronic device to be unable to correctly perform corresponding processing, shortening the service life of the keyboard and reducing the user experience.

[0005] Summary of the Invention

[0006] The embodiments of the present application provide a level setting method and an electronic device for ensuring the accuracy of key scanning results and extending the service life of a keyboard.

[0007] To achieve the above objectives, the embodiments of the present application adopt the following technical solutions:

[0008] In a first aspect, a level setting method is provided, which can be applied to an electronic device equipped with or connected to a keyboard. The electronic device can obtain the usage status of the keyboard, wherein the usage status of the keyboard includes an off state and an on state. When the keyboard is in the off state, the electronic device can configure the level status of all output pins in the keyboard to a first level; or, when the keyboard is in the on state, the electronic device configures the levels of all output pins corresponding to the keys in the keyboard to a target level; wherein the target level includes a second level or a third level, the target level is higher than the first level, the second level is lower than the third level, and the second level and the third level are used for the keyboard to generate an interrupt in response to a triggering operation of a key in the keyboard; the levels of all input pins corresponding to the keys in the keyboard are the first level.

[0009] In this application, if the keyboard is in the off state, it means that the keyboard is not used by the user. Therefore, the electronic device can adjust the level state of all output pins in the keyboard to a low level. And from the above, it can be seen that all input pins in the keyboard default to the first level. Therefore, it can be said that if the keyboard is in the off state, there is no potential difference between the input pins and the output pins. That is to say, by the above method of judging the use state of the keyboard, the duration of the potential difference between the input pins and the output pins can be reduced, thereby slowing down the generation of abnormal oxides, reducing the probability of keyboard aging, increasing the service life of the electronic device, and improving the user experience. If the keyboard is in the on state, it means that the user may use the keyboard. Therefore, the electronic device can set the level of all output pins corresponding to the keys in the keyboard to the second level or the third level. When the level of the output pin is the second level, the potential difference between the input pins and the output pins is small. The smaller the potential difference, the slower the rate of abnormal oxide generation. Therefore, the rate of abnormal oxide generation can be reduced, ensuring the accuracy of the keyboard scanning results and extending the service life of the keyboard.

[0010] In one possible implementation of the first aspect, the keyboard may be a matrix keyboard. An electronic device equipped with a keyboard means the keyboard is part of the electronic device and is generally not removable. An electronic device connected to a keyboard means the keyboard is externally connected to the electronic device and can be removed based on user needs. The keyboard being externally connected to the electronic device may mean the keyboard is connected to the electronic device via a wired connection or wirelessly.

[0011] In this application, since the keyboard is a matrix keyboard, and the matrix keyboard refers to a keyboard group with a matrix-like arrangement used in the external device of the microcontroller unit, by adopting a matrix keyboard, multiple keys in the keyboard can share one input pin or multiple keys can share one output pin. In this way, the waste of interface resources can be reduced and the interface utilization rate can be improved.

[0012] In a possible implementation manner of the first aspect, in response to a user pushing operation on the electronic device and / or the keyboard, the electronic device may obtain a usage status of the keyboard.

[0013] In this embodiment, when the user pushes the electronic device and / or keyboard, the angle between the surface where the display screen in the electronic device is located and the front of the keyboard changes. Therefore, the electronic device can obtain the usage status of the keyboard. In this way, the waste of resources caused by real-time acquisition of the usage status of the keyboard can be reduced, and unnecessary power consumption loss can be reduced.

[0014] In a possible implementation of the first aspect, the keyboard's activation state includes an expanded static state and a scanning state, wherein the expanded static state indicates that the keyboard can be used as an input device but has not received a trigger operation for a key on the keyboard, and the scanning state indicates that the keyboard is used as an input device.

[0015] The process of configuring the target level may specifically include: when the keyboard is in the unfolded static state, the electronic device configures the levels of all the output pins to the second level; when the keyboard is in the scanning state, the electronic device configures the levels of all the output pins to the third level.

[0016] In this application, if the keyboard is in the unfolded static state, it means that the keyboard is in the open state, but the keys in the keyboard are not clicked, that is, the keyboard does not generate an interrupt and the electronic device does not scan the keyboard. Therefore, in order to slow down the generation of abnormal oxides, the electronic device can configure the levels of all output pins to the second level to reduce the potential difference between the input pins and the output pins, thereby slowing down the generation of abnormal oxides, reducing the probability of keyboard aging, increasing the service life of the electronic device, and improving the user experience. And because there is a potential difference between the input pins and output pins corresponding to the keys, the keyboard can still generate an interrupt.

[0017] In one possible implementation of the first aspect, when the keyboard is in an extended, static state, the electronic device configures the voltage levels of all output pins corresponding to keys on the keyboard to a second voltage level. Subsequently, in response to a user triggering a key on the keyboard, the electronic device switches the keyboard's usage state from the extended, static state to a scanning state and configures the voltage levels of all output pins corresponding to keys on the keyboard to a third voltage level. The electronic device then scans the keys on the keyboard to determine the key triggered by the user, that is, to determine the target key.

[0018] In this application, if the keyboard is in the expanded and static state and a key in the keyboard is triggered, it means that the keyboard is currently being used by the user. Therefore, the electronic device can convert the keyboard's usage state from the expanded and static state to the scanning state, and configure the levels of all output pins corresponding to the keys in the keyboard to the third level, so as to facilitate scanning of the keys on the keyboard according to the generated interrupt signal. In this way, while slowing down the generation of abnormal oxides, the accuracy of target key determination can be guaranteed, thereby improving the user experience.

[0019] In a possible implementation manner of the first aspect, the triggering operation on a key in the keyboard may be a clicking operation on the key in the keyboard.

[0020] In a possible implementation of the first aspect, the process of determining the target key may include: the electronic device configuring the levels of output pins other than a target output pin to a first level; the target output pin being any pin among all output pins of the keyboard. Thereafter, the electronic device obtains level information for all input pins, where the level information includes the first level and a third level. Thereafter, based on the level information for each input pin, the electronic device determines whether the target key exists among the keys corresponding to the target output pin. If the target key exists among the keys corresponding to the target output pin, the electronic device determines the input pin with the third level and the key corresponding to the target output pin as the target key.

[0021] In the present application, by configuring the level of any one of all output pins to the third level, the input pin with the third level is determined, and the target key is determined based on the input pin with the third level and the output pin with the third level. In this way, the accuracy of determining the target key can be improved.

[0022] In a possible implementation of the first aspect, the target output pin may be an output pin located at the first position in the keyboard, or may be an output pin located at the last position in the keyboard.

[0023] In this application, the level of the output pin can be regularly configured to improve the efficiency of key scanning.

[0024] In a possible implementation of the first aspect, the above-mentioned process of obtaining the level information of all input pins may specifically include: the electronic device may simultaneously obtain the level information of all input pins. After the level information is obtained, the electronic device determines whether the key corresponding to the target output pin is clicked based on the level information of each input pin, that is, determines whether the target key exists among the keys corresponding to the target output pin.

[0025] In the present application, the level information of the input pins can be obtained simultaneously, which can improve the efficiency of obtaining the level information and further improve the efficiency of determining the target key.

[0026] In a possible implementation of the first aspect, the process of obtaining level information for all input pins may specifically include: the electronic device may obtain level information for a first input pin, where the first input pin is any one of all input pins corresponding to keys on a keyboard. The electronic device may then determine, based on the level information for the first input pin, whether the key corresponding to the first input pin and the target output pin is a target key; if the key corresponding to the first input pin and the target output pin is the target key, the electronic device may determine that the target key exists among the keys corresponding to the target output pin.

[0027] In the present application, if the key corresponding to the first input pin and the above-mentioned target output pin is the target key, the electronic device can directly determine the target key without performing subsequent key scanning steps, thereby improving the efficiency of determining the target key.

[0028] In a possible implementation of the first aspect, the above further includes: if the key corresponding to the first input pin and the target output pin is not the target key, or if the key corresponding to the first input pin and the target output pin is the target key, the electronic device may obtain level information of the second input pin. Thereafter, the electronic device uses the second input pin as the first input pin and returns to the step of "the electronic device may determine whether the key corresponding to the first input pin and the target output pin is the target key based on the level information of the first input pin" until the target key is determined to exist or the key corresponding to the target output pin is determined to be the target key.

[0029] In the present application, regardless of whether the key corresponding to the first input pin and the above-mentioned target output pin is the target key, the level information of other input pins except the first input pin can be obtained. In this way, the accuracy of target key determination can be improved and the occurrence of keys being clicked but not scanned can be reduced.

[0030] In a possible implementation of the first aspect, the method further includes: if the target key does not exist among the keys corresponding to the target output pin, the electronic device configures the level of the first output pin to a third level, and configures the levels of all output pins other than the first output pin to the first level; wherein the first output pin is any output pin among all output pins corresponding to keys on the keyboard that is not determined as a target output pin. The electronic device then uses the first output pin as the target output pin and returns to the step of "the electronic device determines, based on the level information of each input pin, whether the target key exists among the keys corresponding to the target output pin" until the target key is determined.

[0031] In this application, by scanning the keys sequentially, the accuracy of determining the target keys can be improved, thereby improving the user experience.

[0032] In a possible implementation of the first aspect, after determining the target key, the electronic device determines whether any key in the keyboard is pressed. If all keys in the keyboard are not pressed, the electronic device stops scanning and configures the levels of all output pins to the second level.

[0033] In the present application, after determining the target key, the electronic device can continue to determine whether there is a key pressed in the keyboard, that is, whether the user clicks a key in the keyboard again. If all the keys on the keyboard are not pressed, it means that the electronic device has not received the user's click operation on any key in the keyboard. Therefore, the electronic device can stop scanning the keys on the keyboard and configure the levels of all output pins to the second level to wait for the user's next click operation. In this way, the potential difference between the input pin and the output pin can be reduced, thereby slowing down the rate of generation of abnormal oxides.

[0034] In one possible implementation of the first aspect, when the keyboard is in a scanning state, the method further includes: in response to a first user operation (e.g., a push, flip, or close operation) on the electronic device and / or the keyboard, determining an angle between a surface of the electronic device where a display screen is located and a front surface of the keyboard. Then, if the angle is a reflex angle, a finite angle, or zero angle, the electronic device configures the levels of all output pins to a first level and switches the keyboard from a scanning state to an off state.

[0035] In this application, if the angle between the surface where the display screen is located and the front of the keyboard in the electronic device is an apparent angle, a full angle or a zero angle, it means that the keyboard cannot be used by the user. Therefore, the electronic device can configure the levels of all output pins to the first level to reduce the duration of the potential difference between the input pin and the output pin, thereby slowing down the generation of abnormal oxides, reducing the probability of keyboard aging, increasing the service life of the electronic device, and improving the user experience.

[0036] In one possible implementation of the first aspect, when the keyboard is in the extended, static state, the method further includes: in response to a second user operation on the electronic device and / or the keyboard (e.g., a push operation, a folding operation, or a closing operation), determining an angle between a surface of the electronic device where the display screen is located and a front surface of the keyboard. Thereafter, if the angle is a reflex angle, a finite angle, or a zero angle, the electronic device configures the levels of all output pins to a first level and switches the keyboard's usage state from the extended, static state to a closed state.

[0037] In this application, if the angle between the surface where the display screen is located and the front of the keyboard in the electronic device is an apparent angle, a full angle or a zero angle, it means that the keyboard cannot be used by the user. Therefore, the electronic device can configure the levels of all output pins to the first level to reduce the duration of the potential difference between the input pin and the output pin, thereby slowing down the generation of abnormal oxides, reducing the probability of keyboard aging, increasing the service life of the electronic device, and improving the user experience.

[0038] In one possible implementation of the first aspect, when the keyboard is in the closed state, the method further includes: in response to a third operation of the electronic device and / or the keyboard, determining an angle between a surface of the electronic device where the display screen is located and a front surface of the keyboard. Thereafter, if the angle is a poor angle (e.g., an obtuse angle, a right angle, an acute angle, or a flat angle), the electronic device may switch the keyboard to the static extended state and configure the levels of all output pins to the second level.

[0039] In this application, if the angle between the surface where the display screen is located and the front of the keyboard in the electronic device is a poor angle, it means that the keyboard can be used by the user. Therefore, the electronic device can configure the levels of all output pins to the second level to wait for the user to click on the keys in the keyboard. In this way, while slowing down the generation of abnormal oxides, the accuracy of the target key determination can be guaranteed, thereby improving the user experience.

[0040] In a possible implementation of the first aspect, the first level is 0V, and the second level is 1.8V.

[0041] In this application, since the hardware default voltage in the electronic device is three levels, namely 0V, 1.8V and 3.3V, an interrupt can be generated when there is a potential difference between the input pin and the output pin corresponding to the key. Therefore, in order to generate an interrupt while reducing the value of the potential difference, the voltage corresponding to the second level can be configured to 1.8V.

[0042] In addition, considering that the speed of abnormal oxide generation is also related to the size of the potential difference, the larger the potential difference, the faster the abnormal oxide generation, and the smaller the potential difference, the slower the abnormal oxide generation. Therefore, compared with the potential difference of 3.3V, the potential difference of 1.8V can slow down the speed of abnormal oxide generation, thereby reducing the probability of keyboard aging, increasing the service life of electronic equipment, ensuring the correctness of keyboard scanning results, and then being able to correctly receive the user's click operation on any key on the keyboard, thereby improving the user's experience.

[0043] In a possible implementation of the first aspect, the third level is 3.3V.

[0044] In this application, since the hardware default voltage in the electronic device is three levels, namely 0V, 1.8V and 3.3V, and the electronic device requires sufficient voltage when scanning the keys in the keyboard, if the potential difference between the input pin and the output pin is still 1.8V, the electronic device may not be able to scan the keys. In order to ensure normal scanning, the electronic device can configure the voltage corresponding to the third level to 3.3V.

[0045] In a second aspect, an electronic device is provided, comprising: a keyboard, a display screen, a memory, and one or more processors; the keyboard, the display screen, the memory, and the processor are coupled; the keyboard is used to receive trigger operations for keys in the keyboard, the display screen is used to display images generated by the processor, and the memory is used to store computer program code, wherein the computer program code includes computer instructions; when the processor executes the computer instructions, the electronic device executes the level setting method of any one of the above-mentioned first aspects.

[0046] In a third aspect, an electronic device is provided, comprising: an external keyboard connected to the electronic device, the keyboard being used to receive trigger operations for keys in the keyboard, the electronic device comprising a display screen, a memory and one or more processors; the display screen, the memory and the processor are coupled; the display screen is used to display an image generated by the processor, the memory is used to store computer program code, the computer program code comprising computer instructions; when the processor executes the computer instructions, the electronic device executes the level setting method of any one of the above-mentioned first aspects.

[0047] In a fourth aspect, a computer-readable storage medium is provided, comprising computer instructions. When the computer instructions are executed on an electronic device, the electronic device executes any one of the user identity identification methods of the first aspect.

[0048] In a fifth aspect, a computer program product is provided. When the computer program product is run on a computer, the computer is caused to execute any one of the user identity identification methods of the first aspect.

[0049] In the sixth aspect, a chip is provided, comprising: an input interface, an output interface, a processor and a memory, wherein the input interface, the output interface, the processor and the memory are connected through an internal connection path, and the processor is used to execute the code in the memory. When the code is executed, the processor is used to execute the method as described above.

[0050] It can be understood that the beneficial effects that can be achieved by the electronic devices described in the second and third aspects provided above, the computer-readable storage medium described in the fourth aspect, the computer program product described in the fifth aspect, and the chip described in the sixth aspect can refer to the beneficial effects in the first aspect and any possible design method thereof, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] FIG1A is a schematic diagram of a WIFI connection interface provided in an embodiment of the present application;

[0052] FIG1B is a second schematic diagram of a WIFI connection interface provided by an embodiment of the present application;

[0053] FIG2 is a hardware schematic diagram of a matrix keyboard provided in an embodiment of the present application;

[0054] FIG3 is a flow chart of a method for determining a target key provided by an embodiment of the present application;

[0055] FIG4 is a physical diagram showing foreign matter attached to the intersection of a display matrix keyboard provided by an embodiment of the present application;

[0056] FIG5 is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application;

[0057] FIG6 is a flow chart of a level setting method provided in an embodiment of the present application;

[0058] FIG7 is a schematic diagram of a scenario in which a keyboard is in a locked support state according to an embodiment of the present application;

[0059] FIG8 is a schematic diagram of a scene in which a keyboard is in a closed state according to an embodiment of the present application;

[0060] FIG9 is a schematic diagram of a scene in which a keyboard is in a folded state according to an embodiment of the present application;

[0061] FIG10 is a schematic diagram of a scene in which a keyboard provided by an embodiment of the present application is in an unfolded support state;

[0062] FIG11 is a schematic diagram of a scene in which a keyboard is in an unfolded state provided by an embodiment of the present application;

[0063] FIG12 is a schematic diagram of a scenario in which a keyboard provided by an embodiment of the present application is switched from a closed state to an unfolded static state;

[0064] FIG13 is a schematic diagram of a scenario in which a keyboard is converted from a scanning state to an unfolded static state according to an embodiment of the present application;

[0065] FIG14 is a schematic diagram of a scenario in which a keyboard is converted from a scanning state to a closed state according to an embodiment of the present application;

[0066] FIG15 is a flow chart of a key scanning method provided in an embodiment of the present application. DETAILED DESCRIPTION

[0067] The technical solutions in the embodiments of the present application will be described below in conjunction with the accompanying drawings in the embodiments of the present application. Wherein, in the description of the present application, unless otherwise specified, the "and / or" in the present application is merely a kind of association relationship describing the associated objects, indicating that there can be three kinds of relationships, for example, A and / or B, which can represent: A exists alone, A and B exist at the same time, and B exists alone, wherein A and B can be singular or plural. Moreover, in the description of the present application, unless otherwise specified, "multiple" refers to two or more than two. "At least one of the following" or its similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can represent: a, b, c, ab, ac, bc, or abc, wherein a, b, c can be single or multiple. In addition, in order to facilitate the clear description of the technical solutions in the embodiments of the present application, in the embodiments of the present application, words such as "first" and "second" are used to distinguish between identical or similar items with substantially the same functions and effects. Those skilled in the art will understand that words such as "first" and "second" do not limit the quantity and execution order, and words such as "first" and "second" do not necessarily limit differences. At the same time, in the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or design. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a concrete way for easy understanding.

[0068] In some embodiments, electronic devices (such as laptops, tablets, etc.) are generally equipped with corresponding keyboards, and users can trigger the electronic devices to perform corresponding operations by clicking keys on the keyboard. For example, when a user wants the tablet to connect to a WIFI network named "Xiaohong", the user can trigger the "Xiaohong" control 10 as shown in Figure 1A. In response to the triggering operation of the control 10, the tablet can display the password input interface corresponding to the WIFI network named "Xiaohong", and the password input interface includes a password input control. Afterwards, the user can enter the password in the password input control. For example, the user can click keys "1", "2", and "3" on the keyboard in sequence to enter the password. Afterwards, the tablet can display the corresponding content ("123" as shown in Figure 1B) in the password input control on the password input interface based on the keys clicked (keys "1", "2", and "3").

[0069] It should be noted that the above-mentioned key "1", key "2" and key "3" can be input keys on the keyboard, and the keyboard can also have functional keys, such as the functional keys shown in Figure 1A or Figure 1B above.

[0070] It is understandable that before using the keyboard, the user needs to connect the tablet computer to the keyboard, for example, via Bluetooth, a data cable, etc. After the connection is completed, the user can trigger the tablet computer to perform corresponding operations by clicking a button on the keyboard.

[0071] In some embodiments, as can be seen from the keyboard shown in Figure 1A or Figure 1B above, there are multiple keys on the keyboard. If the input pin and output pin of each key are connected to the general-purpose input / output port (GPIO) in the microcontroller unit (MCU), it will cause excessive waste of interface resources. Therefore, in this embodiment, the waste of interface resources can be reduced by adopting a method in which multiple keys share one input pin or multiple keys share one output pin.

[0072] For example, keys in the same column can be mapped to an output pin, and keys in the same row can be mapped to an input pin. For example, taking the 4*4 matrix keyboard in Figure 2 as an example, the 4*4 matrix keyboard contains 16 keys. That is, each row of the 4*4 matrix keyboard includes 4 keys, and similarly, each column of the 4*4 matrix keyboard also includes 4 keys. The matrix keyboard refers to a keyboard group with a matrix-like layout used in external devices of the microcontroller unit.

[0073] In the embodiment of the present application, the four horizontal pins are used as a group of input pins (keyboard scan in), that is, P17, P16, P15, and P14 are used as input pins, and the voltage levels of the input pins are set to low by default; the four vertical pins are used as a group of output pins (keyboard scan out), that is, P33, P34, P35, and P36 are used as output pins, and the voltage levels of the output pins are set to high by default. In other words, each column of keys corresponds to an output pin (or is described as each column of keys being connected in parallel to / sharing an output pin), for example, keys "1", "5", "9", and "Stop" share output pin P33; each row of keys corresponds to an input pin (or is described as each row of keys being connected in parallel to / sharing an input pin), for example, keys "1", "2", "3", and "4" share input pin P17.

[0074] It is understandable that the above-mentioned input pins and output pins are respectively connected to the general-purpose input / output ports (GPIO) in the microcontroller unit (MCU), that is, the above-mentioned input pins and output pins can be controlled by the 8 GPIO pins drawn out by the MCU. Among them, the electronic device can configure the input pin to an interrupt input mode, which refers to setting the GPIO pin connected to the above-mentioned input pin to an interrupt input mode to realize the interrupt function. Specifically, when a key on the keyboard is pressed, the rising edge corresponding to the key is triggered, that is, the level of the input pin corresponding to the key is pulled high, so that the input signal corresponding to the GPIO pin connected to the input pin changes, generating an interrupt (or described as generating an interrupt signal). Afterwards, the MCU executes the corresponding interrupt process, such as starting a key scan to determine the key pressed by the user, that is, the key triggered by the user.

[0075] Accordingly, electronic devices can configure output pins to push-pull output mode. This push-pull output mode sets the GPIO pin connected to the output pin to push-pull output mode to implement push-pull output control. Specifically, when a key on the keyboard is pressed, the MCU can pull the output signal of the output pin corresponding to the key high or low. For example, the electronic device can configure the voltage of the output pin to a high level (such as 3.3V) and output a high level by default.

[0076] It should be noted that the above-mentioned method in which each input pin corresponds to a GPIO pin and each output pin corresponds to a GPIO pin (such as the above-mentioned input pins and output pins can be controlled by 8 GPIO pins brought out by the MCU) is only an example. Multiple input pins or output pins can also be connected to one GPIO pin. This application does not limit the connection relationship between the input pins and output pins and the GPIO pins in the microcontroller unit.

[0077] In some embodiments, in response to a user clicking a key on a keyboard, the electronic device triggers an interrupt. Afterwards, the electronic device may sequentially scan the keys on the keyboard to determine a target key, that is, the clicked key.

[0078] Specifically, as shown in FIG3 , the electronic device's scanning process for keys on a keyboard may include: the electronic device may set all output pins except the output pins corresponding to the keys in the first column to a low level. Thereafter, the electronic device may sequentially obtain the level states (or simply levels) of all input pins. If any of the multiple input pins has a high level state, the electronic device may determine that a target key exists in the first column, i.e., the key corresponding to the input pin with the high level state and the output pins in the first column is determined as the target key. If the multiple input pins have all low level states, the electronic device may determine that none of the keys in the first column have been clicked by the user. Therefore, the electronic device may continue to set the levels of the output pins corresponding to the keys in the second column to a high level, and set all output pins except the output pins corresponding to the keys in the second column to a low level. Thereafter, the electronic device may return to the step of "the electronic device may sequentially obtain the level states of all input pins" until all output pins have been scanned, the target key is determined, and row-by-row and column-by-column scanning is achieved.

[0079] For example, taking the 4*4 matrix keyboard in FIG. 2 as an example, when a user presses a key on the keyboard, the keyboard generates an interrupt. First, in response to the interrupt, the electronic device can set the level of output pin P33 to a high level, and then set the levels of P34, P35, and P36 to a low level (e.g., 0V). If the level of input pin P17 is high, the electronic device can determine that key "1" corresponding to output pin P33 and input pin P17 is the clicked key, i.e., the target key. If input pin P17 is low, the electronic device can continue to sequentially scan the input pins (e.g., P16, P15, and P14) corresponding to the other row keys in the column where output pin P33 is located to determine whether the other row keys (key "5", key "9," and key "Stop") are triggered. If input pin P16 is high, the electronic device can determine that key "5" corresponding to output pin P33 and input pin P16 is the target key.

[0080] If input pins P16, P15, and P14 are all at a low level, this indicates that the user has not clicked key "1" corresponding to output pin P33 and input pin P17, key "5" corresponding to output pin P33 and input pin P16, key "9" corresponding to output pin P33 and input pin P15, and key "Stop" corresponding to output pin P33 and input pin P14. In other words, none of the keys in the first column have been clicked, and the electronic device can continue scanning the keys in the second column. Therefore, the electronic device can continue to set the level of output pin P34 to a high level and the levels of output pins P33, P35, and P36 to low levels. The electronic device can then determine whether a key in the second column has been clicked based on the levels of input pins P17, P16, P15, and P14. If input pin P16 is at a high level, the electronic device can determine that key "6" corresponding to output pin P34 and input pin P16 has been clicked and is the target key.

[0081] It should be noted that before a key in the keyboard is clicked, the electronic device can configure the voltage of the output pin to a high level (such as 3.3V), so that all output pins in the keyboard output a high level, and all input pins in the keyboard are set to a low level.

[0082] It can be understood that there is usually an intersection between the connection lines of the input pins and output pins corresponding to the keys on the keyboard as shown in Figure 4, and there is generally an electric potential difference at the intersection. The electronic device can determine the key pressed by the user on the keyboard by judging the change in the above potential difference.

[0083] However, due to factors such as the environment and operating time, the intersections between the input pins and output pins corresponding to the keys in the keyboard can promote the generation of abnormal oxides due to the presence of potential differences. If an electronic device (that is, the keyboard corresponding to the electronic device) is operated for a long time in a high temperature and high humidity environment, the intersections between the input pins and output pins corresponding to the keys in the keyboard will produce gray attachments as shown by the black line edge in Figure 4, causing impedance changes, which in turn causes abnormal conduction between the input pins and output pins containing the abnormal oxides, ultimately affecting the accuracy of the key scanning results. It is possible that a key that was not pressed by the user may be mistakenly considered to have been pressed, which in turn reduces the service life of the keyboard and the user experience.

[0084] Therefore, in view of the above problems, considering that the generation of abnormal oxides is related to potential difference, in order to slow down the generation of abnormal oxides, increase the service life of the keyboard and ensure the accuracy of the key scanning result, the embodiment of the present application provides a level setting method. In this method, the electronic device obtains the use state of the keyboard, wherein the use state of the keyboard includes an off state and an on state. When the keyboard is in the off state, the keyboard is in a locked state, indicating that the keyboard is not currently used as an input device, that is, the user will not use the keyboard, therefore, the electronic device can adjust the levels of all output pins corresponding to the keys in the keyboard to a first level (such as 0V) respectively. When the keyboard is in the on state, it indicates that the keyboard can currently be used as an input device, and the user may use the keyboard. Therefore, in order to ensure that the keyboard can be used normally by the user, the electronic device can adjust the levels of all output pins corresponding to the keys in the keyboard to a target level respectively, and the target level includes a second level or a third level, and the third level is greater than the second level. The target level is greater than the first level. When the level of the output pin is the target level, the keyboard can normally generate an interrupt when receiving a click operation of the user on the key, so that the electronic device can perform relevant processing based on the interrupt, ensuring user experience. Wherein, no matter which use state the keyboard is in, the levels of all input pins corresponding to the keys in the keyboard are all at the first level.

[0085] In this embodiment, if the keyboard is in the off state, the levels of the input pin and the output pin are both at the first level, and there is no potential difference between the input pin and the output pin. That is, by the above method of determining the usage status of the keyboard, the duration of the potential difference between the input pin and the output pin can be reduced, thereby slowing down the generation of abnormal oxides, ensuring the accuracy of the keyboard scanning results, reducing the probability of keyboard aging, increasing the service life of the keyboard, and improving the user experience. When the keyboard is in the on state, the electronic device can set the level of the output pin to the second level or the third level as needed. When the level of the output pin is at the second level, the potential difference between the input pin and the output pin is small. The smaller the potential difference, the slower the rate of abnormal oxide generation. Therefore, the rate of abnormal oxide generation can be reduced, ensuring the accuracy of the keyboard scanning results, and extending the service life of the keyboard.

[0086] For example, the electronic device in the embodiments of the present application can be a tablet computer, a laptop computer, a portable computer, a personal computer (PC), a car computer, or other device with a keyboard or capable of connecting to a keyboard. The following embodiments do not impose any special restrictions on the specific form of the electronic device.

[0087] Taking the electronic device as a tablet computer as an example, FIG5 shows a schematic structural diagram of the electronic device 100 .

[0088] The electronic device 100 may include a processor 110, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a sensor module 180, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, a button 190, a motor 191, an indicator 192, cameras 1-N 193, a display 194, and subscriber identification module (SIM) card interfaces 1-N 195. The sensor module 180 may include an accelerometer 180A, a pressure sensor, a gyroscope sensor, an air pressure sensor, a magnetic sensor, a distance sensor, a proximity light sensor, a fingerprint sensor, a temperature sensor, a touch sensor, an ambient light sensor, a bone conduction sensor, and the like.

[0089] It should be understood that the structure illustrated in the embodiments of the present invention does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown, or may combine or separate certain components, or arrange the components differently. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0090] The processor 110 may include one or more processing units. For example, the processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU). The different processing units may be independent devices or integrated into one or more processors.

[0091] The controller may be the nerve center and command center of the electronic device 100. The controller may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.

[0092] Processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in processor 110 is a cache memory. This memory can store instructions or data that have just been used or are being recycled by processor 110. If processor 110 needs to use the same instruction or data again, it can directly access the memory. This avoids duplicate accesses, reduces processor 110 latency, and thus improves system efficiency.

[0093] In some embodiments, the processor 110 may include one or more interfaces. The interfaces may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, etc.

[0094] The I2S interface can be used for audio communication. In some embodiments, the processor 110 can include multiple I2S buses. The processor 110 can be coupled to the audio module 170 via the I2S bus to enable communication between the processor 110 and the audio module 170. In some embodiments, the audio module 170 can transmit audio signals to the wireless communication module 160 via the I2S interface, enabling the function of answering calls through a Bluetooth headset.

[0095] The PCM interface can also be used for audio communication, sampling, quantizing, and encoding analog signals. In some embodiments, the audio module 170 and the wireless communication module 160 can be coupled via a PCM bus interface. In some embodiments, the audio module 170 can also transmit audio signals to the wireless communication module 160 via the PCM interface, enabling the function of answering calls via a Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.

[0096] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.

[0097] Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In other embodiments, the antennas can be used in conjunction with a tuning switch.

[0098] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G applied to the electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.

[0099] The modem processor may include a modulator and a demodulator. The modulator is used to modulate the low-frequency baseband signal to be transmitted into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After being processed by the baseband processor, the low-frequency baseband signal is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to the speaker 170A, the receiver 170B, etc.) or displays an image or video through the display screen 194. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 110 and be set in the same device as the mobile communication module 150 or other functional modules.

[0100] The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as WIFI (wireless fidelity) network), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared technology (IR), etc. applied to the electronic device 100. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, frequency modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, frequency modulate it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2. In some embodiments, at least some functional modules of the wireless communication module 160 can be set in the processor 110.

[0101] In some embodiments, the antenna 1 of the electronic device 100 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the electronic device 100 can communicate with a network and other devices through wireless communication technologies. The wireless communication technologies may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology. The GNSS may include a global positioning system (GPS), a global navigation satellite system (GLONASS), a Beidou navigation satellite system (BDS), a quasi-zenith satellite system (QZSS) and / or a satellite based augmentation system (SBAS).

[0102] It is understood that the interface connection relationship between the modules illustrated in the embodiment of the present invention is merely an illustrative illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods from the above embodiments, or a combination of multiple interface connection methods.

[0103] The charging management module 140 is configured to receive charging input from a charger. While charging the battery 142 , the charging management module 140 can also provide power to the electronic device 100 through the power management module 141 .

[0104] Electronic device 100 implements display functionality through a GPU, display screen 194, and an application processor. A GPU is a microprocessor for image processing that connects display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 110 may include one or more GPUs that execute program instructions to generate or modify display information.

[0105] The display screen 194 is used to display images, videos, etc. In some embodiments, the electronic device 100 may include 1 or N display screens 194 , where N is a positive integer greater than 1.

[0106] The electronic device 100 can implement a shooting function through an ISP, a camera 193, a video codec, a GPU, a display screen 194, and an application processor.

[0107] The ISP is used to process data fed back by the camera 193. The camera 193 is used to capture still images or videos. In some embodiments, the electronic device 100 may include 1 or N cameras 193, where N is a positive integer greater than 1.

[0108] The digital signal processor is used to process digital signals. In addition to processing digital image signals, it can also process other digital signals. For example, when the electronic device 100 selects a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.

[0109] The electronic device 100 can implement audio functions such as music playback and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack, and the application processor.

[0110] The audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. The audio module 170 can also be used to encode and decode audio signals. In some embodiments, the audio module 170 can be provided in the processor 110, or some functional modules of the audio module 170 can be provided in the processor 110.

[0111] The speaker 170A, also called a "speaker", is used to convert audio electrical signals into sound signals. The electronic device 100 can listen to music or listen to hands-free calls through the speaker.

[0112] The receiver 170B, also called a "handset", is used to convert audio electrical signals into sound signals. When the electronic device 100 receives a call or a voice message, the user can place the receiver 170B close to the ear to hear the voice.

[0113] Microphone 170C, also known as "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can speak by putting their mouth close to the microphone 170C to input the sound signal into the microphone 170C. The electronic device 100 can be provided with at least one microphone 170C. In other embodiments, the electronic device 100 can be provided with two microphones 170C, which can not only collect sound signals but also realize noise reduction function. In other embodiments, the electronic device 100 can also be provided with three, four or more microphones 170C to collect sound signals, reduce noise, identify the source of sound, realize directional recording function, etc.

[0114] The headphone jack is used to connect a wired headphone and can be a USB port 130 or a 3.5mm open mobile terminal platform (OMTP) standard port or a cellular telecommunications industry association of the USA (CTIA) standard port.

[0115] Accelerometer 180A can detect the magnitude of acceleration of electronic device 100 in all directions (generally three axes). When electronic device 100 is stationary, it can detect the magnitude and direction of gravity. It can also be used to identify the electronic device's posture, enabling applications such as switching between landscape and portrait modes and pedometers.

[0116] In this embodiment, the acceleration sensor 180A can be used to detect the angle between the side where the display screen is located and the front side of the keyboard (i.e., the side with the keys), thereby determining the keyboard's usage status. It is understood that if the angle between the side where the display screen is located and the front side of the keyboard is between 90 degrees and 180 degrees, the keyboard can be confirmed to be in the open state; if the angle between the side where the display screen is located and the front side of the keyboard is between 0 degrees or between 180 degrees and 360 degrees, the keyboard can be confirmed to be in the closed state.

[0117] The gyroscope sensor can be used to determine the motion posture of the electronic device 100. In some embodiments, the angular velocity of the electronic device 100 around three axes (ie, x, y, and z axes) can be determined by the gyroscope sensor.

[0118] A touch sensor, also known as a "touch panel," can be provided on the display screen 194. The touch sensor and the display screen 194 form a touch screen, also known as a "touch screen." The touch sensor is used to detect touch operations applied to or near the touch sensor. The touch sensor can transmit the detected touch operations to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In other embodiments, the touch sensor can also be provided on the surface of the electronic device 100, in a location different from that of the display screen 194.

[0119] A magnetometer can be used to test the strength and direction of a magnetic field and locate the orientation of an electronic device. The principle of a magnetometer is similar to that of a compass, and it can measure the angle between the current electronic device and the four directions of east, south, west, and north.

[0120] The linear acceleration sensor is the data obtained by the acceleration sensor after subtracting the influence of gravity.

[0121] The gravity acceleration sensor can sense the change of acceleration force, which is the force acting on the electronic device when it is accelerating.

[0122] The rotation vector in the rotation vector sensor represents the direction of the electronic device and is a data obtained by mixing the coordinate axis and angle.

[0123] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100.

[0124] The internal memory 121 can be used to store computer executable program codes, which include instructions. The processor 110 executes various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 121. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area can store data created during the use of the electronic device 100 (such as audio data, a phone book, etc.), etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.

[0125] The buttons 190 include a power button, a volume button, and the like. The buttons 190 may be mechanical buttons or touch buttons. The electronic device 100 may receive key inputs and generate key signal inputs related to user settings and function control of the electronic device 100.

[0126] Motor 191 can generate vibration prompts. Motor 191 can be used for incoming call vibration prompts or touch vibration feedback. Indicator 192 can be an indicator light.

[0127] The SIM card interface 195 is used to connect a SIM card.

[0128] An embodiment of the present application provides a level setting method, which can be applied to an electronic device that has or is connected to a keyboard, the keyboard including a plurality of keys, and the keyboard can be a matrix keyboard as described above, or other types of keyboards. Among them, an electronic device with a keyboard means that the keyboard is part of the electronic device, and generally the keyboard is not disassembled, such as the electronic device with a keyboard can be a laptop computer. An electronic device connected to a keyboard means that the keyboard is externally connected to the electronic device, and the keyboard can be disassembled according to user needs, such as the electronic device connected to the keyboard can be a tablet computer. Exemplarily, the keyboard externally connected to the electronic device can be the keyboard connected to the electronic device by a wired connection (such as a data cable), or the keyboard can be connected to the electronic device by a wireless connection (such as Bluetooth), and the specific details are not limited.

[0129] Taking the above-mentioned electronic device being a tablet computer and the keyboard connected to the electronic device being a matrix keyboard as an example, as shown in FIG6 , the level setting method may include S701 to S708 .

[0130] S701: The tablet computer obtains the usage status of the keyboard.

[0131] The keyboard usage status may include an off state and an on state.

[0132] In some embodiments, the closed state of the keyboard indicates that the keyboard is not used as an input device, that is, the keyboard cannot be used, that is, the keyboard is locked.

[0133] In one example, the closed state of the keyboard represents a locked support state, which can be the state corresponding to when the front side of the keyboard (i.e., the side with keys) serves as the support surface for the display screen. As shown in FIG7 , the front side 2A of the keyboard is in contact with the work surface E, i.e., the angle θ between the back side 2B of the keyboard (i.e., the side without keys) and the back side of the display screen (or the back side of the tablet computer) 1B is an acute angle or a right angle. In other words, the locked support state means that the keyboard keycaps serve as the support surface and the keyboard is locked. The work surface refers to the plane on which the tablet computer is placed, and the work surface can be a desktop, a cabinet, the user's legs, or the like, where the keyboard is placed, without specific limitation.

[0134] In another example, the closed state of the above-mentioned keyboard represents a closed state, which may be a state corresponding to when the front face of the keyboard is in contact with the surface where the display screen is located. As shown in FIG8 , the angle between the front face 2A of the keyboard (the side opposite to the back face 2B of the keyboard) and the surface 1A where the display screen is located (the side opposite to the back face 1B of the above-mentioned display screen) is zero, that is, the closed state indicates that the keyboard keycaps are facing the display screen and the keyboard is locked.

[0135] In another example, the closed state of the keyboard represents a folded state, in which the back of the keyboard (the side opposite to the front 2A of the keyboard) is fitted with the back of the display screen (the side opposite to the side 1A where the display screen is located), that is, the state corresponding to when the front of the keyboard is opposite to the side where the display screen is located. As shown in Figure 9, the angle between the back 2B of the keyboard and the back 1B of the display screen is zero, that is, the folded state indicates that the keyboard keycaps are facing away from the display screen, and the front of the keyboard serves as the support surface of the display screen, and the keyboard is locked.

[0136] In other embodiments, the keyboard's open state indicates a state in which the keyboard can be used, that is, a state in which the keyboard is activated. In one example, the keyboard's open state indicates an extended support state, which may be a state corresponding to when the back of the keyboard serves as a support surface for a display screen. As shown in FIG10 , the back of the keyboard 2B is in contact with the work surface, that is, the angle γ between the front of the keyboard 2A and the surface 1A where the display screen resides is an obtuse angle, a right angle, or an acute angle. In the extended support state, the tablet computer and keyboard are used in combination, and the keyboard is activated.

[0137] In another example, the open state of the above-mentioned keyboard represents the unfolded state, which can be the state corresponding to when the keyboard and the display screen are in the same plane. As shown in Figure 11, the back of the keyboard is in contact with the work surface and / or the back of the display screen is in contact with the work surface, and the angle between the front surface 2A of the keyboard and the surface 1A where the display screen is located is a right angle. In the unfolded state, the tablet computer and the keyboard are in the same horizontal plane, and the keyboard is activated.

[0138] The keyboard's open state can include an extended static state and a scanning state. The extended static state indicates that the keyboard can be used as an input device, but has not received a trigger operation for a key on the keyboard. In other words, the keyboard is in an open state, but no key on the keyboard has been clicked. It is understood that the extended static state can be the extended support state or the extended state. The scanning state indicates that the keyboard is in use as an input device, that is, the keyboard receives a user click on a key on the keyboard. In other words, the electronic device needs to scan the keyboard. For example, in response to a user click on any key on the keyboard, a tablet computer scans the keys on the keyboard, so that the tablet computer can receive the content corresponding to the clicked key. Therefore, the tablet computer can switch the keyboard's use state from the extended static state to the scanning state. For example, if the "Enter" key on the keyboard shown in Figure 1A or Figure 1B is clicked, it indicates that the keyboard is currently in use by the user. Therefore, the keyboard's use state can be switched from the extended static state to the scanning state. For another example, after determining that the keyboard is in a scanning state, if the tablet computer does not receive a click operation from the user on any key on the keyboard (such as no click operation from the user on the key within a preset time), it means that the user is not currently using the keyboard, but the user may still use the keyboard. Therefore, in order to ensure that the keyboard can generate interrupts normally, that is, to enable the keyboard to be used normally by the user, the tablet computer can switch the keyboard's usage state from a scanning state to an expanded and static state.

[0139] In some embodiments, when a user performs a related operation on a keyboard or electronic device, causing the angle between the keyboard and the tablet to change, resulting in a change in the keyboard's usage status, the tablet can obtain the latest keyboard usage status. In other words, the tablet does not need to obtain the keyboard's usage status in real time, thereby reducing the waste of resources caused by obtaining the keyboard's usage status in real time and reducing unnecessary power consumption. Alternatively, the tablet can periodically obtain the keyboard's usage status.

[0140] S702: When the keyboard is in the closed state, the tablet computer configures the level states of all output pins corresponding to the keys in the keyboard to be the first level.

[0141] Specifically, if the keyboard is in the closed state, it means that the keyboard is locked, which means that the user is unlikely to use the keyboard. Therefore, the tablet computer does not need to scan the keys in the closed keyboard to determine the target key clicked by the user. The tablet computer can adjust the level states of all output pins corresponding to the keys in the keyboard to a first level. The first level can be a low level, for example, the voltage value corresponding to the low level can be 0V.

[0142] It can be understood from the above that all input pins corresponding to the keys in the keyboard are set to a low level by default. If all output pins corresponding to the keys in the keyboard are also set to a low level, the level of the input pin is the same as the level of the output pin, and there will be no potential difference at the intersection between the input pin and the output pin. Therefore, by adjusting the level state of all output pins in the keyboard, the duration of the potential difference between the input pin and the output pin can be reduced, thereby slowing down the generation of abnormal oxides, reducing the probability of keyboard aging, increasing the service life of electronic equipment, improving user experience, and reducing the probability of errors in key scanning results due to abnormal oxides.

[0143] S703: When the keyboard is in the unfolded static state, the tablet computer configures the level states of all output pins corresponding to the keys in the keyboard to be the second level.

[0144] In an embodiment of the present application, after determining that the keyboard is not in the closed state, that is, the key is in the open state, the tablet computer can determine whether the keyboard is in the extended static state. If the keyboard is in the extended static state, in order to trigger an interrupt, the tablet computer can configure the voltage levels of all output pins corresponding to the keys in the keyboard to a second voltage level. Wherein, the second voltage level is higher than the first voltage level. For example, since the hardware in the tablet computer (such as the MCU) has three default voltage levels, namely 0V, 1.8V, and 3.3V, an interrupt can be generated when there is a potential difference between the input pin and the output pin corresponding to the key. Therefore, in order to generate an interrupt while reducing the value of the potential difference, the voltage corresponding to the second voltage level can be configured to 1.8V.

[0145] It can be understood from the above that all input pins corresponding to the keys in the keyboard default to a low level, that is, the voltage value of all input pins corresponding to the keys in the keyboard is 0V. If the voltage of all output pins corresponding to the keys in the keyboard is configured to 1.8V, it can be determined that the voltage level of the input pin is different from the voltage level of the output pin, and the potential difference between the input pin and the output pin is 1.8V. Considering that the generation rate of abnormal oxides is also related to the size of the potential difference, the larger the potential difference, the faster the generation rate of abnormal oxides, and the smaller the potential difference, the slower the generation rate of abnormal oxides, therefore, compared to the potential difference of 3.3V, the potential difference of 1.8V can slow down the generation rate of abnormal oxides, thereby reducing the probability of keyboard aging, increasing the service life of electronic devices, ensuring the accuracy of keyboard scanning results, and thus correctly receiving the user's click operation on any key in the keyboard, improving the user experience. In addition, the keyboard can generate a corresponding interrupt after the user presses a key to ensure that the key pressed by the user can be detected.

[0146] In some embodiments, the keyboard can be switched from a closed state to an extended, static state. For example, as shown in FIG12 , in response to a user pushing the closed keyboard 2 and / or tablet computer 1, that is, the user unfolding the tablet computer 1 and keyboard 2 while they are being joined, the tablet computer detects that the angle between the front surface of the tablet computer (i.e., the side where the display screen is located) and the front surface of the keyboard satisfies the angle corresponding to the extended, static state (e.g., a right angle), and the tablet computer can switch the keyboard from the scanning state to the extended, static state to facilitate subsequent user key-clicking operations.

[0147] In other embodiments, the keyboard's usage state can be switched from a scanning state to an expanded, static state. For example, as shown in FIG13 , after any key on keyboard 2 (e.g., the "space" key) is clicked, if the tablet computer does not receive any further clicks from the user on any key on the keyboard within a preset time, it indicates that the user has not clicked any other key since clicking the "space" key, meaning that the user is no longer using the keyboard. Therefore, the tablet computer can switch the keyboard's usage state from a scanning state to an expanded, static state to slow down the generation of abnormal oxides. Furthermore, since the keyboard may still be used by the user at this time, switching to the expanded, static state allows the keyboard to still respond to the user's clicks and generate an interrupt (or an interrupt signal).

[0148] In one possible implementation, the scanning state and the static state are merely examples of the active state. Upon determining that the keyboard is not in the closed state, that is, the keys are in the active state, the tablet computer can directly configure the levels of all output pins corresponding to the keys on the keyboard to the second level or the third level, without determining whether the keyboard is in the expanded static state or the scanning state.

[0149] S704 , in response to a user clicking operation on any key in the keyboard, the tablet computer switches the keyboard usage state from the unfolded static state to the scanning state, and configures the level states of all output pins corresponding to the keys in the keyboard to the third level.

[0150] In one embodiment, if a key in the keyboard is clicked and the keyboard generates a corresponding interrupt signal, it means that the key in the keyboard is currently being used by the user. Therefore, after receiving the interrupt signal, the tablet computer can convert the keyboard usage state from the unfolded static state to the scanning state.

[0151] It can be understood that after determining that a key in the keyboard is clicked, the tablet computer needs to stop the task before the key is clicked to perform the task of scanning the keys in the keyboard. That is to say, after any key in the keyboard is clicked, the tablet computer responds to the interrupt signal about the keyboard and the tablet computer can perform the key scanning task.

[0152] Specifically, when the keyboard is in the scanning state, it indicates that the keyboard is being used by the user, that is, the user has clicked a key on the keyboard. To determine the key clicked by the user, the tablet computer can configure the voltage levels of all output pins corresponding to the keys on the keyboard to a third voltage level. The third voltage level is higher than the second voltage level. For example, since the hardware default voltage in the tablet computer is three levels, namely 0V, 1.8V, and 3.3V, and the tablet computer requires sufficient voltage when scanning the keys on the keyboard, if the potential difference between the input pins and the output pins is still 1.8V, the tablet computer may not be able to scan the keys. To ensure normal scanning, the tablet computer can configure the third voltage level to 3.3V.

[0153] In some embodiments, when the above-mentioned open state does not include the expanded static state and the scanning state, if any key in the keyboard is clicked, the tablet computer does not need to switch the usage state of the keyboard, and can directly configure the level of the output pin. In this way, unnecessary power consumption loss can be reduced and the efficiency of key scanning can be improved.

[0154] S705: The tablet computer scans the keys on the keyboard to determine the target keys.

[0155] In some embodiments, the process of scanning the keys on the keyboard and determining the target keys may include the key scanning process shown in FIG. 3 .

[0156] Specifically, after configuring the levels of all output pins corresponding to the keys in the keyboard to the third level, the tablet computer can retain the level corresponding to the target output pin, and at the same time configure the levels of the output pins other than the target output pin to the first level. The target output pin refers to any pin among all the output pins in the keyboard. For example, as shown in FIG2 , the target output pin can be any one of P33, P34, P35, and P36. In this embodiment, the target output pin can be the output pin located in the first position in the keyboard, such as the target output pin is P33 as shown in FIG2 above. In other embodiments, the target output pin can also be the output pin located in the last position in the keyboard. For example, as shown in FIG2 , the target output pin is P36.

[0157] After that, the tablet can obtain the level status of all input pins.

[0158] In some embodiments, the tablet computer can simultaneously obtain the level status of all input pins corresponding to each row of keys in the column where the target output pin is located, that is, obtain the level status of all input pins in the keyboard. After the level status is obtained, the tablet computer determines whether the key corresponding to the target output pin (that is, each key in the column where the target output pin is located) has been clicked based on the level status of each input pin among all input pins, that is, determines whether the target key exists among the keys corresponding to the target output pin.

[0159] For example, using the 4*4 matrix keyboard in Figure 2 above as an example, where the target output pin is P33, the tablet computer can obtain the level states of input pins P17, P16, P15, and P14. If input pin P17 is at the third level, the tablet computer can determine that key "1," corresponding to input pin P17 and target output pin P33, is the target key. If the levels of input pins P17, P16, P15, and P14 are all at the first level, the tablet computer can determine that none of the target keys, including keys "1," "5," "9," and "Stop," corresponding to target output pin P33, exist. In other words, none of keys "1," "5," "9," or "Stop" have been clicked by the user.

[0160] In other embodiments, the tablet computer can obtain the level status of the input pins in sequence. Specifically, the tablet computer can obtain the level status of the first input pin. The first input pin refers to any pin among all the input pins corresponding to the keys in the keyboard. For example, as shown in FIG2 , the target input pin can be any one of P17, P16, P15 and P14. In this embodiment, the first input pin can be the input pin located in the first position in the keyboard. For example, as shown in FIG3 , the first input pin is P17. In other embodiments, the first input pin can also be the input pin located in the last position in the keyboard. For example, as shown in FIG2 , the first input pin is P14.

[0161] The tablet computer can then determine, based on the level status of the first input pin, whether the key corresponding to the first input pin and the target output pin is the target key. If the key corresponding to the first input pin and the target output pin is not the target key, the tablet computer can obtain the level status of the second input pin. The tablet computer then uses the second input pin as the first input pin and returns to the step of "the tablet computer can determine, based on the level status of the first input pin, whether the key corresponding to the first input pin and the target output pin is the target key" until the target key is determined to exist or the key corresponding to the target output pin is determined to be the target key.

[0162] In one example, if the key corresponding to the first input pin and the above-mentioned target output pin is the target key, the tablet computer can directly determine the target key without performing subsequent key scanning steps, thereby improving the efficiency of determining the target key; in another example, if the key corresponding to the first input pin and the above-mentioned target output pin is the target key, the tablet computer can continue to obtain the level status of other input pins except the first input pin until the key corresponding to the above-mentioned target output pin is judged and the target key is determined, thereby improving the accuracy of target key determination and reducing the occurrence of keys being clicked but not scanned.

[0163] For example, taking the 4*4 matrix keyboard in Figure 2 above as an example, the tablet computer can first obtain the level status of the input pin P17. If the input pin P17 is at the third level, the tablet computer can determine the key "1" corresponding to the input pin P17 and the target output pin P33 as the target key; if the input pin P17 is at the first level, the tablet computer can continue to obtain the level status of the input pin P16 until it is determined that the target key exists in the keyboard or the key corresponding to the target output pin is determined.

[0164] In some embodiments, if a target key exists among the keys corresponding to the target output pin, the tablet computer may determine the key corresponding to the target output pin and the input pin with a third level as the target key. For example, referring to FIG. 2 , as shown above, if the target output pin is P33 and the input pin with a third level is P16, the tablet computer may determine that key "5" is the target key.

[0165] In other embodiments, if the target output pin does not exist among the keys corresponding to the target output pin, the tablet computer may configure the voltage level of the first output pin to the third voltage level and configure the voltage levels of all output pins other than the first output pin to the first voltage level. The first output pin refers to any output pin among all output pins corresponding to keys on the keyboard that is not identified as the target output pin. For example, referring to FIG. 2 , as can be seen from the above description, if the target output pin is P33, the first output pin may be any output pin among P34, P35, and P36.

[0166] Afterwards, the tablet computer can use the first output pin as the target output pin and return to the above step of "the tablet computer determines whether the target key exists in the keys corresponding to the target output pin based on the level information of all input pins" to continue to determine whether the target key exists in the keys corresponding to the target output pin based on the level information of the input pins, until all output pins corresponding to the keys in the keyboard are scanned or it is determined that the target key exists in the keyboard, thereby obtaining the target key.

[0167] S706: The tablet computer determines whether there is a key pressed on the keyboard.

[0168] Specifically, after determining the target key, the tablet computer can continue to determine whether there is a key pressed in the keyboard, that is, whether the user clicks a key in the keyboard again. If there is a key pressed in the keyboard, it means that the tablet computer has received the user's click operation on the key in the keyboard again, that is, the current keyboard usage status is still the scanning status, so the tablet computer can return to the above step S705 to continue scanning the keys on the keyboard; if all the keys in the keyboard are not pressed, it means that the tablet computer has not received the user's click operation on any key in the keyboard, so the tablet computer can stop scanning the keys on the keyboard.

[0169] In some embodiments, after determining the target key, if the tablet computer does not receive an interrupt signal sent by the keyboard within a certain period of time (such as the preset time mentioned above), the tablet computer can determine that the user is no longer using the keyboard. Therefore, the tablet computer can stop scanning the keys on the keyboard to reduce unnecessary power consumption loss caused by key scanning.

[0170] S707: The tablet computer stops scanning and changes the keyboard usage state from the scanning state to the unfolded static state.

[0171] S708: The tablet computer configures the level states of all the above output pins to be the second level.

[0172] Specifically, after determining that no key on the keyboard has been pressed, the tablet computer may stop scanning the keys on the keyboard and switch the keyboard's usage state from the scanning state to the unfolded static state. The tablet computer may then return to step S703 to wait for the user's next click operation.

[0173] In some embodiments, after determining that no key in the keyboard is pressed, the keyboard's usage state can also be converted from a scanning state to a closed state. The user performs relevant operations on the tablet computer or keyboard so that the angle θ between the back of the keyboard and the back of the display screen is an acute angle or a right angle, or the angle between the front of the keyboard and the surface where the display screen is located is zero, or the angle between the back of the keyboard and the back of the display screen is zero. In response to this operation, the tablet computer switches the keyboard's usage state to a closed state. For example, as shown in Figure 14, after any key in the keyboard 2 (such as the "space" key) is clicked, if the tablet computer receives a push operation from the user on the display screen, so that the surface where the display screen is located is aligned with the front of the keyboard, the tablet computer can stop scanning the keys on the keyboard, convert the keyboard's usage state from a scanning state to a closed state, and set the levels of all output pins to the levels in the closed state (i.e., the first level).

[0174] In some embodiments, the keyboard's usage state can also be switched from the extended static state to the closed state. The process of switching from the extended static state to the closed state is similar to the process of switching from the scanning state to the closed state described above. However, the tablet computer in the extended static state does not need to scan. The user performs relevant operations on the tablet computer or keyboard so that the angle θ between the back of the keyboard and the back of the display screen is an acute angle or a right angle, or the angle between the front of the keyboard and the surface where the display screen is located is zero, or the angle between the back of the keyboard and the back of the display screen is zero. In response to this operation, the tablet computer switches the usage state of the keyboard in the extended static state to the closed state.

[0175] In some embodiments, when the above-mentioned open state does not include the expanded static state and the scanning state, if no key is pressed in the keyboard, the tablet computer does not need to switch the keyboard usage state and can directly return to the above-mentioned step S703 to wait for the user's next click operation. In this way, unnecessary power consumption loss can be reduced and the work efficiency of key scanning can be improved.

[0176] The following will describe in detail how the tablet computer performs key scanning, combining the structure shown in FIG5 and the key scanning process shown in FIG15 .

[0177] S1501: In response to a user pushing operation on a display screen and / or a keyboard, an acceleration sensor in the tablet computer determines an angle between a surface where the display screen is located and a front surface of the keyboard.

[0178] A push operation on the display screen and / or keyboard refers to an operation in which a user's finger touches the display screen and / or keyboard and pushes the display screen and / or keyboard. In one example, the push operation can be a first operation that triggers the keyboard's usage state to switch from a scanning state to a closed state. Specifically, the push operation can be an operation that aligns the display screen and keyboard, such as the operation performed by the user to turn off the tablet computer after clicking a key on the keyboard, as shown in FIG14 . In another example, the push operation can be a second operation that triggers the keyboard's usage state to switch from an extended static state to a closed state. Specifically, the push operation can be an operation that aligns the display screen and keyboard, such as the operation performed by the user to turn off the tablet computer without clicking a key. In another example, the push operation can be a third operation that triggers the keyboard's usage state to switch from a closed state to the extended static state. Specifically, the push operation can be an operation that separates the display screen and keyboard, such as the operation performed by the user to turn on the tablet computer, as shown in FIG12 .

[0179] In some embodiments, the accelerometer is used to detect acceleration and gravity of the tablet computer during motion. Specifically, the acceleration and gravity can be detected along three axes (X, Y, and Z). For example, the accelerometer can detect the tilt of the tablet computer and calculate the angle between the display screen and the front of the keyboard based on the tilt.

[0180] S1502: The processor in the tablet computer receives the angle between the surface where the display screen is located and the front surface of the keyboard sent by the acceleration sensor.

[0181] Specifically, after the acceleration sensor determines the angle between the surface where the display screen is located and the front surface of the keyboard, the angle can be sent to the processor in the tablet computer to facilitate subsequent determination of the usage status of the keyboard.

[0182] S1503. The processor determines the usage status of the keyboard according to the angle between the surface where the display screen is located and the front surface of the keyboard.

[0183] In some embodiments, if the angle between the surface where the display screen is located and the front surface of the keyboard is a reflex angle, a full angle, or a zero angle, the processor may determine that the keyboard is in a closed state. A reflex angle refers to an angle greater than 180 degrees and less than 360 degrees. A full angle refers to an angle of 360 degrees. A zero angle refers to an angle of 0 degrees.

[0184] In other embodiments, if the angle between the front of the tablet computer body (i.e., the side where the display screen is located) and the front of the keyboard is a minor angle, the processor may determine that the keyboard is in the open state. A minor angle refers to an angle greater than 0 degrees and less than 180 degrees. The minor angle may include an acute angle, a right angle, and an obtuse angle. An acute angle refers to an angle greater than 0 degrees and less than 90 degrees. A right angle refers to an angle of 90 degrees. An obtuse angle refers to an angle greater than 90 degrees and less than 180 degrees.

[0185] S1504: When the keyboard is in the closed state, the processor sends a first configuration instruction to the micro control unit.

[0186] S1505: The micro control unit receives the first configuration instruction and configures the level states of all output pins corresponding to the keys in the keyboard to be the first level.

[0187] S1506: When the keyboard is in the unfolded and static state, the processor sends a second configuration instruction to the micro control unit.

[0188] S1507: The micro control unit receives the second configuration instruction and configures the level states of all output pins corresponding to the keys in the keyboard to the second level.

[0189] S1508: The keyboard receives a click operation from the user on any key on the keyboard.

[0190] S1509: The keyboard sends a scan instruction to the processor.

[0191] S1510: The processor receives the scanning instruction and changes the keyboard's usage state from the unfolded static state to the scanning state.

[0192] S1511. The keyboard sends an interrupt signal to the microcontroller unit.

[0193] In some embodiments, the above S1509 and S1511 can be performed simultaneously, that is, after receiving a click operation of the user on any key, the keyboard can simultaneously send a scan instruction to the processor and an interrupt instruction to the microcontroller unit. In this way, work efficiency can be improved and time cost can be reduced.

[0194] In other embodiments, the above S1509 and S1511 may also be performed in sequence, that is, after receiving a click operation of the user on any key, the keyboard may first send a scan indication to the processor, and then send an interrupt indication to the microcontroller unit; or, it may first send an interrupt indication to the microcontroller unit, and then send a scan indication to the processor, without specific limitation.

[0195] S1512: The micro control unit receives the interrupt signal, triggers an interrupt, and configures the level states of all output pins in the keyboard to be the third level.

[0196] In some embodiments, upon receiving a user click on any key on the keyboard, the keyboard may directly send a scan instruction to the processor. Alternatively, the keyboard may first send an interrupt signal to the microcontroller unit, which then triggers an interrupt upon receiving the interrupt signal and sends a scan instruction to the processor. In other words, the scan instruction may be sent by the keyboard or the microcontroller unit, without limitation.

[0197] S1513: The micro control unit sets the output pins other than the target output pin to the first level.

[0198] S1514: The micro control unit determines whether a target key exists among the keys corresponding to the target output pin according to the levels of all input pins.

[0199] For example, if the levels of all input pins are the first level, it means that the target key does not exist among the keys corresponding to the target output pin; if the level of any input pin among all input pins is the third level, it means that the target key exists among the keys corresponding to the target output pin.

[0200] S1515. When the target key does not exist among the keys corresponding to the target output pin, the micro control unit configures the level of the first output pin to the third level, and configures the levels of the other output pins except the first output pin to the first level.

[0201] The first output pin refers to any output pin among all output pins corresponding to keys in the keyboard that is not determined as a target output pin.

[0202] In some embodiments, after determining that the target key does not exist among the keys corresponding to the target output pin, the microcontroller unit can configure the level of the first output pin to the third level, and configure the levels of other output pins except the first output pin to the first level to continue to determine whether the target key exists among the keys corresponding to the first output pin.

[0203] S1516: The micro control unit uses the first output pin as the target output pin and returns to the above step S1514.

[0204] Specifically, after the level state of the output pin is set, the micro control unit can use the first output pin as the new target output pin and return to the above step S1514 to continue to determine whether there is a target key in the keys corresponding to the new target output pin based on the level of the input pin.

[0205] S1517: When the target key exists among the keys corresponding to the target output pin, the micro control unit reports the data corresponding to the input pin with the third level and the target output pin to the processor.

[0206] S1518. The processor receives the above data and determines the target button based on the data.

[0207] Specifically, after receiving the above data, the processor can compare the data with the target data corresponding to each key on the keyboard to determine the target key. It can be understood that each key on the keyboard corresponds to a target data, which can be pre-set to indicate that the key has been pressed. For example, taking key "1" in Figure 2 as an example, if the data 01 indicates that key "1" has been pressed, and the data reported to the processor is 01, the processor can determine that key "1" on the keyboard has been pressed by the user.

[0208] S1519: After determining the target key, the keyboard determines whether any key is pressed.

[0209] Specifically, after determining the target key, the keyboard can continue to determine whether there is a key pressed, that is, whether the user clicks a key on the keyboard again. If there is a key pressed on the keyboard, the keyboard can return to the above step S1511 to continue scanning the keys on the keyboard; if all keys on the keyboard are not pressed, indicating that the user may not use the keyboard temporarily, the microcontroller unit can stop scanning the keys on the keyboard, that is, the keyboard can send a stop scanning instruction to the microcontroller unit.

[0210] S1520: When no key is pressed on the keyboard, the keyboard may send a stop scanning instruction to the micro control unit.

[0211] In some embodiments, after determining that all keys on the keyboard are not pressed, the keyboard may send a stop scanning instruction to the micro control unit, so that the micro control unit stops scanning the keys on the keyboard.

[0212] S1521. The micro control unit receives the above-mentioned stop scanning instruction and stops scanning the keys on the keyboard.

[0213] S1522: The keyboard sends a rest instruction to the processor.

[0214] Specifically, after determining that all keys on the keyboard are not pressed, the keyboard can directly send a quiescence instruction to the processor. Alternatively, the keyboard can first send a stop scanning instruction to the microcontroller unit. After the microcontroller unit receives the stop scanning instruction, the microcontroller unit stops scanning the keys on the keyboard and sends a quiescence instruction to the processor. In other words, the quiescence instruction can be sent by the keyboard or the microcontroller unit, and the specific method is not limited thereto.

[0215] In some embodiments, the above S1520 and S1522 can be performed simultaneously, that is, after the keyboard determines that all keys are not pressed, it can simultaneously send a static instruction to the processor and a stop scanning instruction to the microcontroller unit. In this way, work efficiency can be improved and time cost can be reduced.

[0216] In other embodiments, the above S1520 and S1522 may also be performed in sequence, that is, after the keyboard determines that all keys are not pressed, it may first send a quiet instruction to the processor, and then send a stop scanning instruction to the microcontroller unit; or, it may first send a stop scanning instruction to the microcontroller unit, and then send a quiet instruction to the processor, without specific limitation.

[0217] S1523: The processor receives the static instruction and changes the keyboard usage state from the scanning state to the unfolded static state.

[0218] It should be noted that the above S1504 and S1505 as well as the above S1506 to S1523 are parallel schemes, that is, if the keyboard is in the closed state, the above S1504 and S1505 are executed; if the keyboard is in the open state, the above S1506 to S1523 are executed.

[0219] It should be understood that the corresponding steps executed by the various modules in the aforementioned mobile phone may also be executed by other modules in the tablet computer. For example, the process in which the aforementioned keyboard sends a scan instruction to the processor may also be the process in which the aforementioned microcontroller unit sends the instruction to the processor. For another example, the process in which the aforementioned keyboard sends a rest instruction to the processor may also be the process in which the aforementioned microcontroller unit sends the instruction to the processor, without further limitation.

[0220] An embodiment of the present application also provides a computer-readable storage medium, which includes computer instructions. When the computer instructions are executed on the above-mentioned electronic device, the electronic device executes each function or step in the above-mentioned method embodiment.

[0221] An embodiment of the present application further provides a computer program product, including a computer program. When the computer program runs on an electronic device, the electronic device executes each function or step in the above method embodiment.

[0222] The present application provides a chip for executing instructions. When the chip is running, the technical solution of the above embodiment is executed. The implementation principle and technical effect are similar and will not be described here.

[0223] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware, or any combination thereof. When implemented using software, all or part of the embodiments may be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present application are generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated therein. The available medium may be a magnetic medium (eg, a floppy disk, a hard disk, a magnetic tape), an optical medium (eg, a high-density digital video disc (DVD)), or a semiconductor medium (eg, a solid state disk (SSD)).

[0224] It should be understood that the “embodiment” mentioned throughout the specification means that the specific features, structures or characteristics related to the embodiment are included in at least one embodiment of the present application. Therefore, the various embodiments in the entire specification do not necessarily refer to the same embodiment. In addition, these specific features, structures or characteristics can be combined in one or more embodiments in any suitable manner. It should be understood that in the various embodiments of the present application, the size of the sequence number of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present application.

[0225] It should also be understood that in this application, "when", "if" and "if" all mean that the UE or base station will take corresponding measures under certain objective circumstances. It does not limit the time, and does not require the UE or base station to take judgment actions when implementing it, nor does it mean that there are other limitations.

[0226] Those skilled in the art will understand that the various numerical numbers such as first and second involved in this application are only for the convenience of description and are not used to limit the scope of the embodiments of this application, and also indicate the order of precedence.

[0227] In this application, elements expressed in the singular are intended to mean "one or more" rather than "one and only one" unless otherwise specified. In this application, unless otherwise specified, "at least one" is intended to mean "one or more" and "a plurality" is intended to mean "two or more."

[0228] The term "and / or" in this article is merely a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. A can be singular or plural, and B can be singular or plural.

[0229] In this document, the term "at least one of..." or "at least one of..." means all or any combination of the listed items. For example, "at least one of A, B and C" may mean: A exists alone, B exists alone, C exists alone, A and B exist at the same time, B and C exist at the same time, and A, B and C exist at the same time. A may be singular or plural, B may be singular or plural, and C may be singular or plural.

[0230] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0231] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0232] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0233] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.

[0234] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0235] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0236] The same or similar parts between the various embodiments in this application can refer to each other. In the various embodiments in this application, and the various implementation methods / implementation methods / implementation methods in each embodiment, if there is no special explanation and logical conflict, the terms and / or descriptions between different embodiments and the various implementation methods / implementation methods / implementation methods in each embodiment are consistent and can be referenced to each other. The technical features in different embodiments and the various implementation methods / implementation methods / implementation methods in each embodiment can be combined to form new embodiments, implementation methods, implementation methods, or implementation methods according to their inherent logical relationships. The above-described implementation methods of this application do not constitute a limitation on the scope of protection of this application.

[0237] The above is only a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or replacements within the technical scope disclosed in the present application, which should be included in the scope of protection of the present application. Therefore, the scope of protection of the present application should be based on the scope of protection of the claims. In short, the above is only a preferred embodiment of the technical solution of the present application, and is not used to limit the scope of protection of the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application should be included in the scope of protection of the present application.

Claims

1. A level setting method, characterized in that: Applied to an electronic device having or connected to a keyboard, the keyboard comprising a plurality of keys, the method comprising: When the keyboard is in a closed state, the electronic device configures the levels of all output pins corresponding to the keys in the keyboard to be a first level; wherein the closed state indicates that the keyboard is not used as an input device; When the keyboard is in an on state, the electronic device configures the levels of all output pins corresponding to the keys in the keyboard to be a target level; the target level includes a second level or a third level, the target level is higher than the first level; the second level is lower than the third level, and the second level and the third level are used for the keyboard to generate an interrupt in response to a triggering operation of the keys in the keyboard; Wherein, the levels of all input pins corresponding to the keys in the keyboard are the first level.

2. The method according to claim 1, characterized in that The open state includes an unfolded static state and a scanning state, wherein the unfolded static state indicates that the keyboard can be used as an input device but has not received a trigger operation for a key in the keyboard; the scanning state indicates that the keyboard is used as an input device; When the keyboard is in the on state, the electronic device configures the levels of all output pins corresponding to the keys in the keyboard to be target levels, including: When the keyboard is in an unfolded static state, the electronic device configures the levels of all the output pins to be the second level; When the keyboard is in a scanning state, the electronic device configures the levels of all the output pins to be the third level.

3. The method according to claim 1 or 2, characterized in that: The open state includes an unfolded static state and a scanning state, and the method further includes: When the keyboard is in an unfolded and stationary state, the electronic device receives a trigger operation for a key in the keyboard; In response to the trigger operation, the electronic device configures the levels of all output pins corresponding to the keys in the keyboard to the third level; wherein the third level corresponds to the scanning state; The electronic device scans the keys on the keyboard to determine the target keys.

4. The method according to claim 3, characterized in that After determining the target key, the method further includes: In the case where the trigger operation for the key in the keyboard is not received, the electronic device stops scanning and configures the levels of all the output pins to be the second level; wherein the second level corresponds to the expanded static state.

5. The method according to any one of claims 2 to 4, characterized in that: When the keyboard is in the scanning state, the method further includes: In response to a first operation of the electronic device and / or the keyboard, the electronic device configures the levels of all the output pins to the first level; wherein the first level corresponds to the off state; and the first operation can trigger the use state of the keyboard to switch from the scanning state to the off state.

6. The method according to claim 2 or 4, characterized in that: When the keyboard is in the unfolded static state, the method further includes: In response to a second operation of the electronic device and / or the keyboard, the electronic device configures the levels of all the output pins to the first level; wherein the first level corresponds to the closed state; and the second operation can trigger the use state of the keyboard to switch from the expanded static state to the closed state.

7. The method according to claim 1, characterized in that When the keyboard is in a closed state, the method further includes: In response to a third operation of the electronic device and / or the keyboard, the electronic device configures the levels of all the output pins to the second level; wherein the second level corresponds to the expanded and static state of the keyboard, and the third operation can trigger the use state of the keyboard to switch from the closed state to the expanded and static state.

8. The method according to any one of claims 1 to 7, characterized in that The first level is 0V, the second level is 1.8V, and the third level is 3.3V.

9. An electronic device, characterized in that: include: The electronic device comprises a keyboard, a display screen, a memory and one or more processors; the keyboard, the display screen, the memory and the processor are coupled; The keyboard is used to receive a trigger operation for a key in the keyboard, the display screen is used to display an image generated by the processor, and the memory is used to store computer program code, wherein the computer program code includes computer instructions; when the processor executes the computer instructions, the electronic device executes the level setting method as described in any one of claims 1 to 8.

10. An electronic device, characterized in that: include: The electronic device is connected to an external keyboard, and the keyboard is used to receive a trigger operation for a key in the keyboard. The electronic device includes a display screen, a memory and one or more processors; the display screen, the memory and the processor are coupled; the display screen is used to display an image generated by the processor, and the memory is used to store computer program code, and the computer program code includes computer instructions; when the processor executes the computer instructions, the electronic device executes the level setting method as described in any one of claims 1 to 8.

11. A computer-readable storage medium, characterized in that: The method comprises computer instructions, and when the computer instructions are executed on an electronic device, the electronic device executes the level setting method according to any one of claims 1 to 8.