Method, electronic device, chip, system and medium for controlling stylus pen charging
Through the comprehensive judgment of the magnetic sensor and charging chip, the problem of misjudgment of the stylus pen state caused by magnetic field interference during the wireless charging process of electronic devices is solved, ensuring normal charging of the stylus pen and improving the user experience.
Patent Information
- Application Number
- CN202410509954.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-26
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2044-04-26
AI Technical Summary
In the existing technology, when electronic devices wirelessly charge a stylus, due to magnetic field interference, it is easy to misjudge the in-position status of the stylus, resulting in charging abnormalities. For example, the stylus stops charging or frequently switches charging states, affecting the user experience.
The magnetic sensor is used to detect the adsorption state of the stylus, and combined with whether the charging chip reports an interruption event of charging stop, a comprehensive judgment is made to confirm whether the removal event of the stylus is true, thereby deciding whether to continue or stop charging the stylus. Avoid misjudgments.
It effectively avoids abnormal charging of the stylus, ensures that the stylus continues to charge normally, reduces the frequent switching between stopping and resuming charging of electronic devices, and improves the user experience.
Smart Images

Figure CN118100461B
Abstract
Description
Technical Field
[0001] The present application relates to the field of terminal technology, and in particular to a method, electronic device, chip, system and medium for controlling charging of a stylus pen. Background Art
[0002] With the development of electronic technology, there are more and more types of electronic devices. For example, tablet computers have become a must-have item for people to work and study. In order to make it more convenient in actual use, most tablet computers currently provide a stylus pen, which can be adsorbed on the tablet computer by magnetic attraction and can be removed when in use.
[0003] When the stylus is attached to the tablet, the tablet can wirelessly charge the stylus. The tablet needs to detect the presence of the stylus, and only when the stylus is in place can wireless charging be started.
[0004] However, when the tablet computer is wirelessly charging the stylus, the stylus often charges abnormally due to magnetic field interference caused by accessories such as leather cases or keyboards. For example, in some cases, due to the influence of magnetic field changes, the tablet computer will misjudge that the stylus is in the removed state or switched to the removed state, and therefore will not charge the stylus or will stop charging the stylus; in other cases, due to the influence of magnetic field changes, the tablet computer detects that the stylus has switched from the removed state to the in-place state, so it starts wireless charging again and pops up a window again to prompt the stylus to start charging. This abnormal charging situation seriously affects the user experience. Summary of the invention
[0005] The present application provides a method, electronic device, chip, system and medium for controlling the charging of a stylus pen, which can effectively avoid the situation where the stylus pen stops charging due to misjudgment of the state caused by magnetic field interference when the stylus pen is charging, and avoid the electronic device from popping up a second window to prompt the stylus pen charging information, thereby improving the user experience.
[0006] In a first aspect, the present application provides a method for controlling the charging of a stylus pen, which is applied to an electronic device, wherein the electronic device supports the stylus pen to be magnetically adsorbed to a preset area of the electronic device, and a magnet is provided at the preset area. The method for controlling the charging of the stylus pen comprises: detecting, by a magnetic sensor, that the stylus pen is adsorbed to the electronic device; the electronic device switches the stylus pen to an in-place state; when the stylus pen is switched to the in-place state, the electronic device charges the stylus pen; and according to whether the magnetic sensor reports an event of the stylus pen being removed and whether the charging chip reports an interruption event of charging being stopped, the electronic device continues or stops charging the stylus pen.
[0007] According to the method for controlling stylus charging provided by the embodiment of the present application, when the stylus is attached to the electronic device and is being charged, due to the interference of the surrounding magnetic field, the magnetic sensor may falsely report the stylus removal event, thereby causing abnormal charging of the stylus. For example, if the electronic device is charging the stylus, if the stylus removal event is detected, the electronic device will stop charging the stylus. In order to avoid misjudgment of the stylus state, the present application comprehensively judges whether the stylus removal event is true based on whether the magnetic sensor reports the stylus removal event and whether the charging chip reports the interruption event of charging stop, and then continues or stops charging the stylus based on the judgment result. For example, if the charging chip reports the interruption event of charging stop, then the stylus removal event is confirmed to be true and the charging of the stylus is stopped; if the charging chip does not report the interruption event of charging stop, then the stylus removal event is confirmed to be false and the charging of the stylus continues (i.e., does not stop). Through the application scheme, misjudgment of the stylus status is effectively avoided, and thus abnormal charging of the stylus is avoided. For example, it can avoid the situation where the stylus stops charging due to misjudgment of the status caused by magnetic field interference when the stylus is charging. In this way, the stylus can be ensured to charge normally and continuously, and the electronic device can be prevented from frequently switching between stopping charging the stylus and resuming charging the stylus. This can also avoid the electronic device from popping up windows to prompt the stylus charging information multiple times, thereby improving the user experience.
[0008] It should be noted that in the present application, when the stylus is being charged, if the stylus is actually taken away, the processor will receive the interruption event / request for charging stop reported by the charging chip; if the stylus is not actually taken away, the processor will not receive the interruption event / request for charging stop reported by the charging chip. Therefore, in order to avoid misjudgment, when the magnetic sensor reports the stylus removal event, it is further detected whether the charging chip reports the interruption event for charging stop to determine whether the stylus removal event is true, thereby improving the accuracy of the removal detection logic.
[0009] In some possible implementations, the electronic device may be a tablet computer, or may be a mobile phone or other electronic device that supports the adsorption and charging of a stylus pen. The electronic device may support the stylus pen as an input device of the electronic device.
[0010] In some possible implementations, there are two possible situations for continuing or stopping charging the stylus pen according to whether the magnetic sensor reports the stylus pen removal event and whether the charging chip reports the charging stop interruption event:
[0011] Case 1: When the magnetic sensor reports a stylus removal event, but the charging chip does not report a charging stop interruption event, the electronic device determines that the stylus removal event is false, and the electronic device continues to charge the stylus.
[0012] It should be noted that if the stylus is in place, the interrupt request for charging stop will not be triggered; conversely, if the interrupt request for charging stop is not triggered, it means that the stylus is in place. Based on the mutually exclusive states of being in place and being removed, if the charging chip does not report the interrupt event for charging stop, it means that the stylus is in place, and the stylus removal event can be judged to be false.
[0013] Case 2: When the magnetic sensor reports a stylus removal event and the charging chip reports a charging stop interruption event, the electronic device determines that the stylus removal event is true, and stops charging the stylus.
[0014] It should be noted that if the stylus is removed, an interrupt request to stop charging will be triggered; conversely, if the interrupt request to stop charging is triggered, it means that the stylus is removed. Based on the fact that the in-position and removed states are mutually exclusive, if the charging chip reports an interrupt event of stopping charging, it means that the stylus is removed, and the stylus removal event can be judged to be true.
[0015] Compared with the solution in the related art that determines whether the stylus is removed by the value reported by the magnetic sensor reaching the removal detection threshold, the electronic device in the present application is based on the fact that being in place and being removed are mutually exclusive states, and through more rigorous logical judgment, it can more accurately confirm that the stylus is removed.
[0016] In some possible implementations, the electronic device is magnetically attached to the first accessory, and the first accessory is provided with a magnet. For example, the first accessory may be a magnetic keyboard, and the electronic device supports the magnetic keyboard as an input device of the electronic device, and the magnetic keyboard supports the user to fold it after being attached to the electronic device. For another example, the first accessory may be a magnetic leather case, and the magnetic leather case supports the user to fold it after being attached to the electronic device.
[0017] The embodiments of the present application can solve the following problems and have corresponding technical effects:
[0018] Question 1: In actual use, the stylus is attached to the electronic device, in place and charging. When the user operates the electronic device, accessories such as the magnetic leather case or keyboard rub against the electronic device, causing strong magnetic field interference. As a result, the magnetic sensor in the electronic device may falsely report the stylus removal event, thereby causing abnormal charging of the stylus. For example, if the electronic device is charging the stylus and detects that the stylus is removed, the electronic device will stop charging the stylus.
[0019] The present application scheme can solve this problem: in order to avoid misjudgment of the stylus status, the electronic device determines whether the charging chip reports an interruption event of charging stop to confirm whether the stylus removal event is true. Specifically, if the charging chip reports an interruption event of charging stop, then the electronic device confirms that the stylus removal event is true, and accordingly, the electronic device stops charging the stylus; if the charging chip does not report an interruption event of charging stop, then the electronic device confirms that the stylus removal event is false; accordingly, the electronic device continues (i.e., does not stop) charging the stylus. Through the present application scheme, misjudgment of the stylus status is effectively avoided, and thus abnormal charging of the stylus is avoided. For example, it can avoid the situation where the stylus stops charging due to misjudgment of the status caused by magnetic field interference when the stylus is charging. This can ensure that the stylus continues to charge normally, so the present application scheme improves the user experience.
[0020] Question 2: In actual use, when the stylus is attached to the electronic device, the electronic device starts charging the stylus, and a pop-up window appears on the electronic device to remind you that the stylus is charging. Due to magnetic field interference, the magnetic sensor in the electronic device may falsely report the stylus removal event, which may cause charging abnormalities. The electronic device may frequently switch between stopping charging the stylus and resuming charging the stylus, which will cause the electronic device to pop up multiple windows to remind you of the stylus charging information.
[0021] The present application solution can solve this problem: the electronic device determines whether the charging chip reports an interruption event of charging stop to confirm whether the stylus removal event is true. If the electronic device detects that the charging chip does not report an interruption event of charging stop, the electronic device confirms that the stylus removal event is false and continues (i.e., does not stop) charging the stylus, thereby avoiding abnormal charging, thereby avoiding the electronic device from switching back and forth between stopping charging the stylus and resuming charging the stylus, and further avoiding the electronic device from popping up windows to prompt stylus charging information multiple times. Therefore, the present application solution improves the user experience.
[0022] In some possible implementations, the method further includes: during charging of the stylus pen, detecting a relative position relationship between the first accessory and the electronic device; determining whether the relative position relationship satisfies a preset position condition; and if it is determined that the relative position relationship satisfies the preset position condition, detecting whether the magnetic sensor reports an event of the stylus being removed, and detecting whether the charging chip reports an interruption event of charging being stopped.
[0023] In some possible implementations, determining that the relative position relationship satisfies a preset position condition includes: if an angle between the first accessory and the electronic device is within a preset angle range, determining that the relative position relationship satisfies the preset position condition.
[0024] Through the above scheme, when the electronic device is charging the stylus, by detecting the relative position relationship between the magnetic leather case / keyboard and the electronic device, and when the preset position condition is met, that is, when there is a high possibility of friction and rubbing between the magnetic leather case / keyboard and the electronic device (friction and rubbing are likely to cause misjudgment of the stylus state), the stylus removal detection is started, that is, detecting whether the magnetic sensor reports the stylus removal event and detecting whether the charging chip reports the charging stop interrupt event, so that it can more accurately determine whether the stylus is removed.
[0025] In some possible implementations, the magnetic sensor may be a Hall element, or other magnetic sensor that can detect changes in magnetic field strength.
[0026] In some possible implementations, the method further includes: when the magnetic sensor reports a stylus removal event and the charging chip reports a charging stop interruption event, the electronic device switches the stylus from the in-place state to the removed state. With this solution, after the stylus switches to the removed state, the stylus stops charging, and the user can hold the stylus to input on the display screen of the electronic device. The stylus and the electronic device can establish a wireless communication connection via Bluetooth.
[0027] In some possible implementations, after the stylus pen is switched to the removed state, the method further includes: updating the stylus pen state tag, wherein the updated stylus pen state tag indicates that the stylus pen is in the removed state. With this solution, based on the fact that the in-position and removed states are mutually exclusive, the updated stylus pen state tag can be used in the subsequent stylus pen in-position detection step.
[0028] In some possible implementations, switching the stylus pen to the in-place state includes: when it is detected that the stylus pen is adsorbed to the electronic device, detecting a recorded stylus pen status tag, the stylus pen status tag indicating that the stylus pen is in a removed state or in-place state; when it is detected that the stylus pen is adsorbed to the electronic device and the stylus pen is in a removed state before the adsorption, establishing a wireless charging connection between the electronic device and the stylus pen; when it is detected that the stylus pen is adsorbed to the electronic device and the stylus pen is in a removed state before the adsorption, and a wireless charging connection has been established between the electronic device and the stylus pen, switching the stylus pen to the in-place state.
[0029] The present application solution can accurately detect whether the stylus is in place. Compared with the solution in the related art that determines the stylus is in place only when the value reported by the magnetic sensor reaches the in-place detection threshold, the electronic device in the present application solution is based on the mutually exclusive states of in-place and removed, and can more accurately confirm the stylus is in place through more rigorous logical judgment.
[0030] In some possible implementations, establishing a wireless charging connection between the electronic device and the stylus includes: the electronic device sends a digital ping message to the stylus, the digital ping message carrying a wireless charging protocol; the electronic device receives a confirmation message returned by the stylus based on the digital ping message; the electronic device establishes a wireless charging connection with the stylus based on the wireless charging protocol. Through this solution, when the electronic device and the stylus establish a wireless charging connection, the electronic device can wirelessly charge the stylus.
[0031] In some possible implementations, after the stylus is switched to the in-place state, the method further includes: displaying information about the stylus in a pop-up window on the display screen of the electronic device; wherein the information about the stylus includes the product model and / or the remaining power value of the stylus. With this solution, when the electronic device switches the stylus to the in-place state and starts wirelessly charging the stylus, a pop-up window is displayed on the display screen to prompt the information about the stylus, so that the user can obtain timely information that the stylus is adsorbed to the electronic device and is being charged, thereby improving the user experience.
[0032] In some possible implementations, after the stylus is switched to the in-place state, the method further includes: updating the stylus state tag, wherein the updated stylus state tag indicates that the stylus is in the in-place state. With this solution, based on the fact that in-place and removed are mutually exclusive states, the updated stylus state tag can be used in the subsequent stylus removal detection step.
[0033] In a second aspect, the present application provides a device for controlling stylus pen charging, the device comprising a unit for executing the method in the first aspect. The device may correspond to executing the method described in the first aspect, and the relevant description of the unit in the device can refer to the description of the first aspect, which will not be repeated here for the sake of brevity.
[0034] The method described in the first aspect above can be implemented by hardware, or by hardware executing corresponding software. The hardware or software includes one or more modules or units corresponding to the above functions. For example, a processing module or unit, a display module or unit, etc.
[0035] In a third aspect, the present application provides an electronic device, comprising a processor, a computer program or instructions stored in the processor and a memory, wherein the processor is configured to execute the computer program or instructions so that the method in the first aspect is executed.
[0036] In a fourth aspect, the present application provides a system for controlling charging of a stylus pen, the system comprising a stylus pen and the electronic device in the third aspect; wherein the electronic device supports magnetic attraction of the stylus pen to the electronic device and supports wireless charging of the stylus pen. The electronic device is magnetically attracted to a first accessory, the first accessory being provided with a magnet; wherein the first accessory may be a keyboard or a leather case.
[0037] In a fifth aspect, the present application provides a computer-readable storage medium on which a computer program (also referred to as instructions or codes) for implementing the method in the first aspect is stored. For example, when the computer program is executed by a computer, the computer can execute the method in the first aspect.
[0038] In a sixth aspect, the present application provides a chip, including a processor. The processor is used to read and execute a computer program stored in a memory to perform the method in the first aspect and any possible implementation thereof. Optionally, the chip also includes a memory, and the memory is connected to the processor via a circuit or wire.
[0039] In a seventh aspect, the present application provides a chip system, including a processor. The processor is used to read and execute a computer program stored in a memory to perform the method in the first aspect and any possible implementation thereof. Optionally, the chip system also includes a memory, and the memory is connected to the processor via a circuit or wire.
[0040] In an eighth aspect, the present application provides a computer program product, comprising a computer program (also referred to as instructions or codes), wherein when the computer program is executed by an electronic device, the electronic device implements the method in the first aspect.
[0041] It can be understood that the beneficial effects of the second to eighth aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 A schematic diagram of an application scenario of the method for controlling stylus pen charging provided in an embodiment of the present application;
[0043] Figure 2 A flowchart of a method for controlling stylus charging provided in the related art;
[0044] Figure 3 A schematic diagram of a system architecture for controlling stylus pen charging provided in an embodiment of the present application;
[0045] Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;
[0046] Figure 5A schematic diagram of a software architecture of an electronic device provided in an embodiment of the present application;
[0047] Figure 6 A schematic flow chart of a method for controlling stylus pen charging provided in an embodiment of the present application;
[0048] Figure 7 Interface diagram of the method for controlling stylus pen charging provided in the embodiment of the present application Figure 1 ;
[0049] Figure 8 Schematic diagram of the process of controlling stylus pen charging provided in the embodiment of the present application Figure 2 ;
[0050] Fig. 9 A schematic diagram of the relative position relationship between the electronic device and the leather case / keyboard provided in an embodiment of the present application;
[0051] Fig.10 Schematic diagram of the process of controlling stylus pen charging provided in the embodiment of the present application Figure 3 ;
[0052] Fig.11 Schematic diagram of the process of controlling stylus pen charging provided in the embodiment of the present application Figure 4 ;
[0053] Fig.12 Schematic diagram of the process of controlling stylus pen charging provided in the embodiment of the present application Figure 5 ;
[0054] Fig.13 A schematic diagram of the structure of a device for controlling stylus pen charging provided in an embodiment of the present application. DETAILED DESCRIPTION
[0055] The embodiments of the present application are further described in detail below in combination with specific embodiments and with reference to the accompanying drawings.
[0056] Figure 1 A schematic diagram of an application scenario in an embodiment of the present application is shown. Figure 1 The electronic device 100, stylus pen 200, leather case / keyboard, and magnetic sensor are only for illustration, and the specific product form may be different.
[0057] refer to Figure 1 As shown, taking the electronic device 100 as a tablet computer 100 as an example, the stylus pen 200 can be adsorbed on the tablet computer 100 by magnetic attraction, and the stylus pen 200 can be removed when in use. Figure 1As shown in the dotted box in , the tablet computer 100 is provided with a magnetic component (such as a magnetic metal strip) for adsorbing the stylus, and the tablet computer 100 is also provided with a magnetic sensor for detecting whether the stylus is adsorbed or removed. It should be noted that at least one magnetic adsorption component is provided inside the stylus 200. When the stylus 200 approaches or contacts the dotted box area of the tablet computer 100, the magnetic adsorption component attracts the magnetic component of the tablet computer 100 to adsorb and fix the stylus 200 at the dotted box area of the tablet computer 100.
[0058] When the stylus pen 200 is attached to the tablet computer 100, the tablet computer 100 can wirelessly charge the stylus pen 200. The tablet computer 100 needs to detect the presence of the stylus pen 200, and only when the stylus pen 200 is in place, wireless charging is started. However, when the tablet computer 100 wirelessly charges the stylus pen 200, due to magnetic field interference caused by accessories such as a leather case or a keyboard, the stylus pen 200 often charges abnormally.
[0059] For example, in some cases, the stylus 200 is actually in the in-place state. When the user operates the tablet computer, accessories such as the leather case or keyboard move up and down / left and right relative to the tablet computer, causing rubbing and friction, which causes magnetic field interference. Due to the influence of the magnetic field change, the magnetic sensor built into the tablet computer 100 reports an abnormal value, causing the tablet computer 100 to misjudge that the stylus 200 is in the removed state or switches to the removed state, so the stylus 200 is not charged or the charging of the stylus 200 is stopped. However, the stylus 200 is actually in the in-place state and needs to be charged. Due to the misjudgment of the tablet computer 100, the stylus is not charged, which is inconsistent with the user's expectations and affects the user experience. For example, when the user uses the stylus 200, the stylus 200 may be too low in power to be used, resulting in a poor user experience.
[0060] For another example, in some other cases, the stylus pen 200 is actually in the in-position state, but the tablet computer 100 mistakenly determines that the stylus pen 200 is in the removed state, and then the accessories such as the leather case or keyboard rub against the tablet computer, causing magnetic field interference, and the tablet computer 100 detects that the stylus pen 200 switches from the removed state to the in-position state, so the tablet computer 100 starts wireless charging again and pops up a window again to prompt the stylus pen 200 to start charging. This may happen repeatedly, and multiple pop-up prompts may appear, which is inconsistent with user expectations and affects the user experience.
[0061] Figure 2 1 is a flow chart of a method for controlling stylus charging provided by related technology. Figure 2 As shown, the method includes the following steps.
[0062] S301: The electronic device determines whether the value reported by the magnetic sensor meets a stylus presence threshold.
[0063] S302: When the electronic device determines that the reported value of the magnetic sensor meets the stylus presence threshold, the electronic device determines that the stylus is in place.
[0064] S303: When the electronic device determines that the stylus is in place, the electronic device charges the stylus.
[0065] S304: While the electronic device is charging the stylus pen, the electronic device will continue to receive the value reported by the magnetic sensor and determine whether the value reported by the magnetic sensor meets the stylus pen removal threshold.
[0066] S305: When the electronic device determines that the reported value of the magnetic sensor meets the stylus removal threshold, the electronic device determines that the stylus is removed.
[0067] S306: When the electronic device determines that the stylus pen is taken away, the electronic device stops charging the stylus pen.
[0068] S307: When the electronic device determines that the reported value of the magnetic sensor does not meet the stylus removal threshold, the electronic device continues to determine whether the stylus is fully charged. When the electronic device determines that the stylus is not fully charged, the electronic device continues to charge the stylus until the stylus is fully charged.
[0069] analyze Figure 2 It can be seen from the process shown that the reason for the misjudgment of the related technology is not only the objective reasons such as the magnetic field interference caused by the leather case or keyboard described above, but also because the logic of the in-place detection and removal detection provided by the related technology is too simple. For example, the in-place detection logic provided by the related technology is that when the reported value of the magnetic sensor reaches the in-place threshold, the stylus is considered to be in place, and the removal detection logic is that when the reported value of the magnetic sensor reaches the removal threshold, the stylus is considered to be removed. This judgment logic is too dependent on the reported value of the magnetic sensor, and the reported value of the magnetic sensor is easily affected by the friction of accessories such as the leather case or keyboard. Once the reported value of the magnetic sensor is wrong, the stylus status will be misjudged.
[0070] In view of the above problems, the embodiments of the present application provide a method for controlling the charging of a stylus pen and an electronic device. In order to better understand the embodiments of the present application, the embodiments of the present application are briefly described below:
[0071] Through the present application scheme, when the stylus is attached to an electronic device and is being charged, due to the interference of the surrounding magnetic field, the magnetic sensor may falsely report the stylus removal event, thereby causing abnormal charging of the stylus. For example, if the electronic device is charging the stylus, if the stylus removal event is detected, the electronic device will stop charging the stylus. In order to avoid misjudgment of the stylus status, the present application comprehensively judges whether the stylus removal event is true based on whether the magnetic sensor reports the stylus removal event and whether the charging chip reports the charging stop interrupt event, and then continues or stops charging the stylus based on the judgment result. For example, if the charging chip reports the charging stop interrupt event, then the stylus removal event is confirmed to be true and the charging of the stylus is stopped; if the charging chip does not report the charging stop interrupt event, then the stylus removal event is confirmed to be false and the charging of the stylus continues (i.e., does not stop).
[0072] Through the application scheme, misjudgment of the stylus status is effectively avoided, and thus abnormal charging of the stylus is avoided. For example, it can avoid the situation where the stylus stops charging due to misjudgment of the status caused by magnetic field interference when the stylus is charging. In this way, the stylus can be ensured to charge normally and continuously, and the electronic device can be prevented from frequently switching between stopping charging the stylus and resuming charging the stylus. This can also avoid the electronic device from popping up windows to prompt the stylus charging information multiple times, thereby improving the user experience.
[0073] Figure 3 Schematic diagram of system architecture involved in various exemplary embodiments of the present application is shown. Figure 3 As shown, the system architecture includes an electronic device, a stylus, and a leather case / keyboard. The electronic device and the stylus are magnetically attracted to each other, and the electronic device can wirelessly charge the stylus; the electronic device and the leather case / keyboard are magnetically attracted to each other.
[0074] The following is a description of the electronic device to which the method for controlling stylus pen charging provided in the embodiment of the present application is applied in conjunction with the accompanying drawings. For example, the electronic device in the embodiment of the present application may be a mobile phone, a tablet computer, a netbook, a personal digital assistant (PDA), or other device that supports stylus pen input, and the embodiment of the present application does not impose any special restrictions on the specific form of the electronic device.
[0075] Figure 4 FIG. 1 is a schematic diagram showing a hardware structure of an electronic device provided in an embodiment of the present application. For example, taking a tablet computer as an example, Figure 4As shown, the electronic device may include: a processor 110, 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, 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 (i.e., an earpiece) 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc.
[0076] In the embodiment of the present application, the sensor module 180 may include a magnetic sensor. The electronic device may detect whether the stylus is adsorbed to the electronic device through the magnetic sensor, and detect whether the stylus is taken away through the magnetic sensor.
[0077] 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 processor (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), etc. Among them, different processing units may be independent devices or integrated into one or more processors. The controller may be the nerve center and command center of the electronic device. The controller may generate an operation control signal according to the instruction opcode and the timing signal to complete the control of fetching and executing instructions.
[0078] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0079] In some embodiments, the processor 110 may include one or more interfaces. The interface 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, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc. It can be understood that the interface connection relationship between the modules illustrated in this embodiment is only a schematic illustration and does not constitute a structural limitation of the electronic device. In other embodiments, the electronic device may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
[0080] In an embodiment of the present application, the electronic device supports the stylus to be magnetically adsorbed to a preset area of the electronic device. When the magnetic sensor detects that the stylus is adsorbed to the electronic device, the electronic device can switch the stylus to an in-place state through the processor 110; and when the stylus is switched to the in-place state, the processor 110 controls the charging management module 140 (e.g., a charging chip) to charge the stylus; and the processor 110 controls the charging management module 140 to continue or stop charging the stylus according to whether the magnetic sensor reports an event of the stylus being removed and whether the charging management module 140 receives an interrupt event of stopping charging.
[0081] The internal memory 121 can be used to store computer executable program codes, and the executable program codes include instructions. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as controlling the electronic device to wirelessly charge the stylus or stop charging the stylus), etc. The data storage area may store data created during the use of the electronic device (such as stylus status information, stylus remaining power information), 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. The processor 110 executes various functional applications and data processing of the electronic device by running instructions stored in the internal memory 121 and / or instructions stored in a memory provided in the processor.
[0082] In the embodiment of the present application, the processor 110 can implement the method for controlling the charging of the stylus pen in the embodiment of the present application by executing instructions stored in the internal memory 121 .
[0083] The charging management module 140 is used to receive charging input from a charger (such as a wireless charger or a wired charger) to charge the battery 142. The power management module 141 is used to connect to the battery 142, and the charging management module 140 is connected to the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140 to power various components of the electronic device.
[0084] In the embodiment of the present application, the charging management module 140 may be a charging chip. In other embodiments, the charging management module 140 and the charging chip may be two independent devices.
[0085] The electronic device can realize the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
[0086] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light-emitting diode (QLED), etc.
[0087] The above is a specific description of the embodiment of the present application using the electronic device 100 as an example. It should be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 100. The electronic device 100 may have more or fewer components than those shown in the figure, may combine two or more components, or may have different component configurations. The various components shown in the figure may be implemented in hardware, software, or a combination of hardware and software including one or more signal processing and / or application specific integrated circuits.
[0088] In addition, an operating system is running on the above hardware. The operating system of the operating system layer can be any one or more computer operating systems that implement business processing through processes, such as Linux operating system, Unix operating system, Android operating system, iOS operating system or Windows operating system, etc. Applications can be installed and run on the operating system.
[0089] The operating system of the electronic device 100 may adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture. The embodiment of the present application takes the Android system of the layered architecture as an example to exemplify the software structure of the electronic device 100.
[0090] Figure 5 It is a software structure block diagram of the electronic device 100 according to an embodiment of the present application.
[0091] The layered architecture divides the software into several layers, each with a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, Android TM The system is divided into five layers, from top to bottom: application layer, application framework layer, Android runtime (Android TMruntime) and system library layer, hardware abstraction layer (HAL) and kernel layer (kernel).
[0092] The application layer may include a series of application packages. For example, the application layer may include applications such as a camera app, a gallery app, etc. (applications may be referred to as apps for short).
[0093] In the embodiment of the present application, the application layer may also include a context awareness module, a business logic processing module, a business presentation module, etc. The context awareness module, the business logic processing module, and the business presentation module may be independent APPs, or may be integrated in different APPs, or may be integrated in the same APP, which is not limited in the present application.
[0094] Among them, the context awareness module runs permanently or in a low-power form, and has the ability to perceive external facts or environments. The context awareness module can detect related events and obtain the status of events from other applications in the application layer or the application framework layer or the system layer or the kernel layer through the application programming interface (API), such as detecting Bluetooth connections, network connections, monitoring user text messages, custom timers, etc. In an embodiment of the present application, the main function of the context awareness module is to monitor whether the stylus is adsorbed to the electronic device, monitor whether the stylus is removed, and whether an interrupt event indicating that the stylus charging has stopped occurs. The context awareness module can notify the business logic processing module of the monitored information.
[0095] The business logic processing module has business logic processing capabilities, and is used to perform data processing or logic judgment based on the information monitored by the context perception module and the preset logic algorithm to determine whether the stylus is in the in-place state. For example, when the stylus is adsorbed to the electronic device, the business logic processing module determines whether the stylus status tag records the removal event, and determines whether the stylus has established a wireless charging connection with the electronic device, and then, if the conditions are met, determines that the stylus is in the in-place state, starts wireless charging of the stylus, and pops up a window to prompt that the stylus is being charged. The specific judgment process will be described in detail below.
[0096] The service presentation module is used to pop up a window on the screen of the electronic device to prompt that the stylus is being charged and the power level of the stylus according to the instruction of the service logic processing module.
[0097] The application framework layer provides an application programming interface (API) and a programming framework for the applications in the application layer. The application framework layer includes some predefined functions. The application framework layer may include a call manager, a window manager, a content provider, a view system, a resource manager, a notification manager, an activity manager, etc., and the embodiments of the present application do not impose any restrictions on this.
[0098] The notification manager enables applications to display notification information in the status bar. It can be used to convey notification-type messages and can disappear automatically after a short stay without user interaction. For example, the notification manager is used to notify that the current call has turned on smart privacy calls. For example, when the electronic device detects that the stylus is attached to the preset area of the electronic device, the electronic device starts to wirelessly charge the stylus, and a pop-up window prompts the screen to start wireless charging of the stylus, etc. This information disappears automatically after a short stay.
[0099] The Android runtime is responsible for scheduling and management of the Android system. The Android runtime includes a core library and a virtual machine. The core library consists of two parts: one is the function that the Java language needs to call, and the other is the Android core library. The application layer and the application framework layer run in the virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform object life cycle management, stack management, thread management, security and exception management, and garbage collection.
[0100] The system library can include multiple functional modules. For example: surface manager, media libraries, 3D graphics processing library (for example: openGL ES), 2D graphics engine (for example: SGL), etc. The surface manager is used to manage the display subsystem and provides the fusion of 2D and 3D layers for multiple applications. The system library layer can also be called the native layer, the local service layer or the local framework layer. This layer is a native code platform library that can provide native services and link libraries for hardware operations for the upper layer.
[0101] The HAL layer is a package of the Linux kernel driver, providing an interface to the upper layer and shielding the implementation details of the low-level hardware. For example, the HAL layer may include display HAL, sensor HAL, wireless charging HAL, etc.
[0102] The kernel layer is the layer between hardware and software. The kernel layer includes at least display driver, sensor driver, and wireless charging driver.
[0103] For the sake of convenience, the figure also shows the hardware layer that interacts with the above software structure. For example, the hardware layer may include hardware such as a display screen, a magnetic sensor, and a magnetic component.
[0104] It should be noted that although the embodiments of the present application are described using the Android system as an example, its basic principles are also applicable to electronic devices based on operating systems such as iOS or Windows.
[0105] The execution subject of the method for controlling the charging of the stylus pen provided in the embodiment of the present application can be the above-mentioned electronic device (such as a tablet computer or a mobile phone), or it can be a functional module and / or functional entity in the electronic device that can implement the method for controlling the charging of the stylus pen, and the present application scheme can be implemented in hardware and / or software, which can be determined according to actual use requirements, and the embodiment of the present application is not limited. The following takes an electronic device as an example, and combines the accompanying drawings to exemplarily illustrate the method for controlling the charging of the stylus pen provided in the embodiment of the present application.
[0106] The following will be combined with the accompanying drawings to illustrate the embodiments of the present application through the following multiple exemplary embodiments. The methods in the following embodiments can be implemented in an electronic device with the above hardware structure and software architecture. The hardware structure diagram of the electronic device can be as follows: Figure 4 As shown, the software structure diagram of the electronic device can be as follows Figure 5 For the sake of convenience, the embodiments of the present application are all based on electronic devices as shown in FIG. Figure 5 The tablet shown is used as an example.
[0107] The following describes a method for controlling stylus pen charging provided by an embodiment of the present application in conjunction with a specific embodiment.
[0108] Embodiment 1
[0109] The method for controlling the charging of a stylus provided in an embodiment of the present application is applied to an electronic device, wherein a magnetic component is provided in a preset area of the electronic device, and the stylus is also provided with a magnet, and the electronic device supports the stylus to be magnetically adsorbed to the preset area of the electronic device. The magnetic component may also be referred to as a magnet or a magnet.
[0110] Figure 6 is a flow chart of a method for controlling stylus pen charging provided in an embodiment of the present application. Figure 6 As shown, the method includes the following steps.
[0111] S401: The electronic device detects, through a magnetic sensor, that the stylus pen is attached to the electronic device.
[0112] The magnetic sensor may be a Hall element (or Hall sensor), or other possible magnetic sensors.
[0113] In the embodiment of the present application, the magnetic sensor built into the electronic device senses the change in magnetic field strength in real time and reports the detected magnetic field strength value to the processor of the electronic device. The processor of the electronic device receives the value reported by the magnetic sensor and determines whether the value reported by the magnetic sensor meets the preset threshold value of stylus adsorption.
[0114] For example, when the stylus is close to the electronic device, the magnetic sensor senses the change in magnetic field strength and reports it to the processor of the electronic device. When the processor of the electronic device determines that the reported value of the magnetic sensor meets the preset threshold of stylus adsorption, it can be determined that the stylus is adsorbed.
[0115] In some embodiments, a sensor such as a gyroscope sensor that can detect the spatial position of the stylus may be disposed inside the stylus to feed back the position information of the stylus to the electronic device.
[0116] Among them, the electronic device supports a stylus pen as an input device of the electronic device.
[0117] In some embodiments, a communication connection such as Bluetooth can be established between the electronic device and the stylus pen to implement the input function of the stylus pen on the electronic device.
[0118] S402: The electronic device determines that the stylus is in place.
[0119] When the electronic device detects that the stylus pen is attached to the electronic device, the electronic device can further determine whether the stylus pen is in place, that is, whether the adsorption position of the stylus pen meets the position requirement. Figure 7 When the position shown is adsorbed on the top of the electronic device 100, the electronic device can determine that the stylus is in place. When the electronic device determines that the stylus is in place, the electronic device records that the stylus is in place.
[0120] S403: When the stylus pen is in the in-place state, the electronic device charges the stylus pen.
[0121] When the electronic device determines that the stylus is in place, the electronic device starts the wireless charging function and starts wireless charging of the stylus. The electronic device can charge the stylus through a charging chip.
[0122] In some embodiments, the electronic device can support the stylus to be fixed on the top of the electronic device by magnetic attraction. When the electronic device detects that the stylus is in place, the electronic device wirelessly charges the stylus. The embodiment of the present application is exemplified by taking the stylus being fixed on the top of the electronic device by magnetic attraction as an example.
[0123] In some embodiments, the electronic device may support the stylus to be fixed in the pen slot of the electronic device by magnetic attraction, and when the electronic device detects that the stylus is in place, the electronic device wirelessly charges the stylus.
[0124] In some embodiments, the electronic device is provided with a transmitting coil, and a receiving coil is provided inside the stylus, and electromagnetic induction is performed between the transmitting coil and the receiving coil to transfer energy. Through the interaction between the transmitting coil and the receiving coil, the electronic device can wirelessly charge the stylus.
[0125] In some embodiments, the electronic device may send a digital Ping to the stylus to establish wireless charging communication with the stylus. After the communication is successful, the electronic device may wirelessly charge the stylus.
[0126] In some embodiments, when the electronic device determines that the stylus is in place and starts charging the stylus, Figure 7 As shown, the electronic device 100 can display the product model "Stylus P3" and the remaining power information of the stylus 200 in a pop-up window through the display screen. The electronic device automatically hides the message after a preset time.
[0127] S404: The magnetic sensor reports the stylus removal event to the processor of the electronic device.
[0128] In the embodiment of the present application, the magnetic sensor can obtain the stylus presence / removal data in real time. The magnetic sensor senses the change in magnetic field strength. When the change in magnetic field strength meets the preset removal threshold, the magnetic sensor reports the stylus removal event. It should be noted that the removal event may be true or false (i.e., misjudgment).
[0129] S405: When the magnetic sensor reports the stylus removal event, the electronic device detects whether the charging chip reports a charging stop interruption event.
[0130] As mentioned above, magnetic sensors are easily affected by factors such as current fields and hard magnetism. When users use electronic devices, the presence / removal detection data (referred to as reported values) reported by the magnetic sensors to the electronic devices may be incorrect, causing the electronic devices to misjudge the state of the stylus (such as presence / removal). For example, the stylus is actually in the presence state and the stylus is charging, but the electronic device misjudges that the stylus is removed and stops charging the stylus. Because the removal detection logic provided by the relevant technology is too simple and prone to misjudgment, the present application improves the removal detection logic to avoid misjudgment.
[0131] In an embodiment of the present application, when the magnetic sensor reports a stylus removal event, in order to avoid misjudgment, a step of "detecting whether the charging chip reports a charging stop interruption event" is added to improve the accuracy of the removal detection logic.
[0132] The above-mentioned interrupt event of charging stop is an interrupt request of stopping charging of the stylus pen.
[0133] It should be noted that an interrupt request (IRQ) is an interrupt signal of a processor. An interrupt is an asynchronous event that interrupts the current execution flow of the processor to execute a specific interrupt service routine (ISR) to handle a specific event.
[0134] Specifically, an interrupt is a mechanism that responds to external events in a timely manner without the need for the processor to actively poll. When an external device or internal event requires the processor to perform a task, the external device or internal event will notify the processor by sending an interrupt request IRQ signal. After receiving the interrupt request, the processor will interrupt the currently executed instruction flow, save the current context, and then switch to execute the corresponding interrupt service routine. After the interrupt service routine is completed, the processor will restore the previous context and continue to execute the original program.
[0135] Specifically in the present application, when the stylus is being charged, if the stylus is actually taken away, the processor will receive the interruption event / request for charging stop reported by the charging chip; if the stylus is not actually taken away, the processor will not receive the interruption event / request for charging stop reported by the charging chip. Therefore, in the case where the magnetic sensor reports the stylus removal event, in order to avoid misjudgment, it is further detected whether the charging chip reports the interruption event of charging stop to determine whether the stylus removal event is true, thereby improving the accuracy of the removal detection logic.
[0136] It should be noted that when an electronic device charges a stylus pen through a charging chip, if the stylus pen is taken away, the charging chip will report an interrupt event of charging stop to a processor such as a system on chip (SOC) or an application processor AP. For the sake of convenience, the embodiment of the present application takes the example of the charging chip reporting an interrupt event of charging stop to the processor as an example.
[0137] S406A: When the magnetic sensor reports the stylus removal event but the charging chip does not report the charging stop interruption event, continue charging the stylus.
[0138] It should be noted that if the stylus is in place, the interrupt request for charging stop will not be triggered; conversely, if the interrupt request for charging stop is not triggered, it means that the stylus is in place. Based on the mutually exclusive states of being in place and being removed, if the charging chip does not report the interrupt event for charging stop, it means that the stylus is in place, and the stylus removal event can be judged to be false.
[0139] S406B: When the magnetic sensor reports a stylus removal event and the charging chip reports a charging stop interruption event, stop charging the stylus.
[0140] It should be noted that if the stylus is removed, an interrupt request to stop charging will be triggered; conversely, if the interrupt request to stop charging is triggered, it means that the stylus is removed. Based on the fact that the in-position and removed states are mutually exclusive, if the charging chip reports an interrupt event of stopping charging, it means that the stylus is removed, and the stylus removal event can be judged to be true.
[0141] Compared with the solution in the related art that determines whether the stylus is removed by the value reported by the magnetic sensor reaching the removal detection threshold, the electronic device in the present application is based on the fact that being in place and being removed are mutually exclusive states, and through more rigorous logical judgment, it can more accurately confirm that the stylus is removed.
[0142] On the one hand, reference Figure 8 As shown in S406A in FIG. 1 , if the magnetic sensor reports the stylus removal event, but the charging chip does not report the interruption event of charging stop, then the electronic device determines that the stylus removal event is false. In other words, the magnetic sensor reports an abnormal value, and the removal event is a misjudgment. It can be understood that if the electronic device determines that the removal event is false, then the electronic device continues to charge the stylus.
[0143] On the other hand, reference Figure 8 As shown in S406B in FIG. 1 , if the magnetic sensor reports a stylus removal event and the charging chip reports a charging stop interruption event, the electronic device determines that the stylus removal event is true. In other words, the magnetic sensor reports a normal value. It can be understood that if the electronic device determines that the removal event is true, the electronic device stops charging the stylus.
[0144] In an embodiment of the present application, the electronic device determines that the removal event is true, and then the electronic device can update the stylus status label, and the updated stylus status label indicates that the stylus is in the removed state.
[0145] The scenario applied in the above-mentioned embodiment 1 involves an electronic device and a stylus, and the interference source causing the misjudgment may be certain magnetic objects close to the electronic device, such as a magnetic key. In actual applications, the electronic device can be connected to an external leather case, or the electronic device can be connected to an external keyboard. In the scenario where the electronic device is connected to an external leather case or keyboard light accessory, when the user uses the electronic device, the external leather case or keyboard and other accessories will be folded by the user and come into frictional contact (rubbing) with the electronic device, causing the magnetic field strength around the electronic device to change, thereby causing the stylus state (such as in place / removed) to be misjudged. The method for controlling the charging of a stylus provided in the embodiment of the present application will be described in detail below through embodiment 2.
[0146] Embodiment 2
[0147] As mentioned above, magnetic sensors are easily affected by factors such as electric current fields and hard magnetism. When users use electronic devices, due to the rubbing friction between the first accessories such as leather cases / keyboards and the electronic devices, it is easy to cause the magnetic sensor to report the in-place / removal detection data (referred to as the reported value) to the electronic device incorrectly, thereby causing the electronic device to misjudge the state of the stylus. For example, the stylus is actually in the in-place state and the stylus is charging, but the electronic device misjudges that the stylus is removed and stops charging the stylus. Because the removal detection logic provided by the relevant technology is too simple and prone to misjudgment, the present application improves the removal detection logic to avoid misjudgment.
[0148] The following first analyzes the possible situations in which accessories such as a leather case / keyboard may cause misjudgment of the stylus state in conjunction with the accompanying drawings. Fig. 9 The relative positions between accessories such as a leather case and keyboard and the electronic device and the possible rubbing and friction are shown.
[0149] like Fig. 9 As shown in (a), the angle between the leather case / keyboard and other accessories and the electronic device is 0°, and the leather case / keyboard and other accessories are in a closed state. At this time, the small-scale rubbing friction between the leather case / keyboard and other accessories and the electronic device has basically no effect on the charging of the stylus and can be ignored. Fig. 9 (b) shows the unfolding process, and the angle between the accessories such as the leather case / keyboard and the electronic device is greater than 0°.
[0150] like Fig. 9 As shown in (c) in the figure, the angle between the leather case / keyboard and the electronic device (or the accessory unfolding angle) is 360°, and the leather case / keyboard is in a folded unfolded state, and the user often operates the tablet computer in this unfolded state. Fig. 9As shown in (c), (d) and (e) in the figure, when a user operates a tablet computer, accessories such as a leather case or keyboard may move up and down / left and right relative to the tablet computer, causing rubbing and friction, resulting in strong magnetic field interference, which to a certain extent affects the magnetic sensor in the tablet computer's judgment of the state of the stylus, thereby causing abnormal charging of the stylus.
[0151] It is understandable that electronic devices are equipped with magnetic sensors and magnetic components, styluses are equipped with adsorption magnets, and accessories such as leather cases and keyboards are also equipped with magnets. The magnetic sensors built into tablet computers are easily affected by factors such as electric current fields and hard magnets. When users use electronic devices, due to the inevitable rubbing and friction between accessories such as leather cases and keyboards and the electronic devices, it is easy to misjudge the status of the stylus.
[0152] The method provided in the embodiment of the present application can be used to solve Fig. 9 In the scenario shown, the stylus status is misjudged, resulting in abnormal charging of the stylus. Fig.10 This is a flow chart of a method for controlling stylus charging provided in an embodiment of the present application. Fig.10 As shown, the method includes S501 to S507A or S507B.
[0153] S501. The electronic device is magnetically attracted to a first accessory, where the first accessory is provided with a magnet.
[0154] In an embodiment of the present application, the electronic device is adsorbed to the first accessory by magnetic attraction, and the first accessory is provided with a magnet.
[0155] In some embodiments, the first accessory is a magnetic keyboard, the electronic device supports the keyboard as an input device of the electronic device, and the keyboard supports the user to fold it after being adsorbed to the electronic device.
[0156] In some embodiments, the first accessory is a magnetic leather case, which supports users to fold it after being attached to the electronic device.
[0157] Regarding the implementation process of S502 to S507A or S507B, reference may be made to the detailed description of the above S401 to S406A or S406B, which will not be repeated here.
[0158] It should be noted that the magnetic sensor reported the stylus removal event. Since the electronic device is magnetically attached to the first accessory such as a keyboard or leather case, the first accessory and the electronic device may have frictional contact, which may cause the magnetic sensor to report an incorrect value and the removal event may be false. Among them, the relative position relationship between the first accessory and the electronic device is different, the possibility of frictional contact is different, and the magnetic interference to the magnetic sensor is different. Therefore, it is necessary to detect the relative position relationship between the first accessory and the electronic device and make a judgment based on the relative position relationship.
[0159] In some embodiments, during the process of charging the stylus pen by the electronic device, the electronic device monitors whether the relative position of the first accessory and the electronic device changes and determines whether the relative position relationship between the two satisfies a preset position condition. In addition, during the process of charging the stylus pen by the electronic device, the electronic device (specifically, the processor) monitors whether the magnetic sensor reports a stylus removal event. When the relative position relationship satisfies the preset position condition, the electronic device can confirm whether the stylus pen is removed based on whether the magnetic sensor reports a stylus removal event and whether the charging chip reports a charging stop interruption event.
[0160] Exemplarily, the electronic device determines whether the relative position relationship satisfies the preset position condition, including: the electronic device determines whether the first accessory is in an unfolded state and whether the unfolded angle of the accessory is within a preset angle range. The preset angle range can be set according to actual needs and is not limited in this application. Fig. 9 As shown in (c), when the accessory is unfolded to an angle of 360°, it is within the preset angle range.
[0161] In some embodiments, Fig. 9 As shown in (c), (d) and (e), the electronic device detects that the first accessory is in the unfolded state and the unfolded angle of the accessory is within the preset angle range. The relative position relationship between the first accessory and the electronic device meets the preset position condition. In this case, the first accessory and the electronic device may have friction and rubbing, which may cause misjudgment of the stylus state. Therefore, it is necessary to add judgment conditions to avoid misjudgment. Therefore, the electronic device confirms whether the stylus is removed based on whether the magnetic sensor reports the stylus removal event and whether the charging chip reports the interruption event of charging stop.
[0162] In some embodiments, reference Fig. 9 As shown in (a) of FIG. 1 , the electronic device detects that the first accessory is in a closed state, and the relative position relationship between the first accessory and the electronic device does not meet the preset position condition; Fig. 9 As shown in (b), when the electronic device determines that the first accessory is in the unfolded state, but the unfolding angle of the accessory is not within the preset angle range, the electronic device determines that the relative position relationship between the first accessory and the electronic device does not meet the preset position condition; in the above two cases, there is basically no friction between the first accessory and the electronic device, so the possibility of misjudging the state of the stylus is relatively low. Therefore, the electronic device can confirm whether the stylus is taken away based on whether the magnetic sensor reports the stylus removal event.
[0163] In some embodiments, when the magnetic sensor reports a stylus removal event and the charging chip reports a charging stop interruption event, the electronic device determines that the removal event is true, switches the stylus from the in-place state to the removed state, and records a stylus state tag, which indicates that the stylus is in the removed state. When the stylus switches to the removed state, the electronic device stops charging the stylus.
[0164] The embodiments of the present application can solve the following problems and have corresponding technical effects:
[0165] Question 1: In actual use, the stylus is attached to the tablet, in place and charging. When the user operates the tablet, accessories such as the leather case or keyboard rub against the tablet, causing strong magnetic field interference. As a result, the magnetic sensor in the tablet may falsely report the stylus removal event, which in turn causes abnormal charging of the stylus. For example, if the tablet is charging the stylus and detects the stylus removal event, the tablet will stop charging the stylus.
[0166] The present application solution can solve this problem: in order to avoid misjudgment of the stylus status, the tablet computer determines whether the charging chip reports an interruption event of charging stop to confirm whether the stylus removal event is true. Specifically, if the charging chip reports an interruption event of charging stop, then the tablet computer confirms that the stylus removal event is true, and accordingly, the tablet computer stops charging the stylus; if the charging chip does not report an interruption event of charging stop, then the tablet computer confirms that the stylus removal event is false; accordingly, the tablet computer continues (i.e., does not stop) charging the stylus. Through the present application solution, misjudgment of the stylus status is effectively avoided, and thus abnormal charging of the stylus is avoided. For example, it can avoid the situation where the stylus stops charging due to misjudgment of the status caused by magnetic field interference when the stylus is charging. This can ensure that the stylus continues to charge normally, so the present application solution improves the user experience.
[0167] Question 2: In actual use, when the stylus is attached to the tablet, the tablet starts charging the stylus, and a pop-up window appears on the tablet to remind you that the stylus is charging. Due to magnetic field interference, the magnetic sensor in the tablet may falsely report the stylus removal event, which may cause charging abnormalities. The tablet may switch back and forth between stopping and resuming charging the stylus, which will cause the tablet to pop up multiple windows to remind you of the stylus charging information.
[0168] The present application solution can solve this problem: the tablet computer determines whether the charging chip reports an interruption event of charging stop to confirm whether the stylus removal event is true. If the tablet computer detects that the charging chip does not report an interruption event of charging stop, the tablet computer confirms that the stylus removal event is false and continues (i.e., does not stop) charging the stylus, thus avoiding abnormal charging. This avoids the tablet computer switching back and forth between stopping charging the stylus and resuming charging the stylus, and further avoids the tablet computer popping up windows to prompt stylus charging information multiple times. Therefore, the present application solution improves the user experience.
[0169] In addition, since the stylus is fixed to the electronic device by magnetic adsorption, the electronic device in the related art determines whether the stylus is adsorbed by the magnetic field strength, which may lead to inaccurate or even misjudgment of the adsorption detection of the stylus. This application also provides a corresponding solution to this problem. This application solution is based on the mutual exclusive states of being in place and being removed, and through more rigorous logical judgment, it can more accurately confirm that the stylus is in place.
[0170] For example, in combination Fig.10 ,like Fig.11 As shown, the step (S503) of the electronic device determining that the stylus pen is in position may include the following steps.
[0171] S5031. When it is detected that the stylus pen is adsorbed to the electronic device, detect a recorded stylus pen status tag, where the stylus pen status tag indicates that the stylus pen is in a removed state or in an in-place state before adsorption.
[0172] It should be noted that, in fact, in-place and removed are two mutually exclusive states. Based on this idea, the present application proposes an interlocking detection method for detecting whether the stylus is in-place / removed.
[0173] Wherein, whenever a removal event occurs, the stylus state label is updated: the stylus is in the removed state.
[0174] Wherein, whenever an in-place event occurs, the stylus state tag is updated: the stylus is in the in-place state.
[0175] That is to say, the present application uses a stylus status label to record the status of the stylus, and the status recorded by the stylus status label is either taken away or in place.
[0176] It is understandable that when the stylus is detected to be adsorbed to the electronic device, if the stylus status tag detects that the stylus is in a removed state before adsorption, the electronic device can determine that the stylus needs to be switched from the removed state to the in-place state after this adsorption.
[0177] S5032: When it is detected that the stylus pen is adsorbed to the electronic device and the stylus pen is in a detached state before the adsorption, a wireless charging connection is established between the electronic device and the stylus pen.
[0178] It can be understood that after the electronic device establishes a wireless charging connection with the stylus, the electronic device can wirelessly charge the stylus.
[0179] In some embodiments, the electronic device sends a digital ping message to the stylus, the digital ping message carrying the wireless charging protocol, the electronic device receives a confirmation message returned by the stylus based on the digital ping message, and then the electronic device establishes a wireless charging connection with the stylus based on the wireless charging protocol.
[0180] S5033: Determine that the stylus is in place when it is detected that the stylus is adsorbed to the electronic device and the stylus is in a detached state before the adsorption and a wireless charging connection has been established between the electronic device and the stylus.
[0181] After the electronic device determines that the stylus is in place, the electronic device may update the stylus status tag, and the updated stylus status tag indicates that the stylus is in place.
[0182] Fig.12 Another schematic diagram of the method for controlling stylus charging provided by an embodiment of the present application is shown. Fig.12 As shown, the method includes S601 to S611.
[0183] S601: Whether the magnetic sensor reports that the stylus is attached to the electronic device.
[0184] S602: When the magnetic sensor reports that the stylus pen is attached to the electronic device, the electronic device detects whether the stylus pen status tag records a removal event.
[0185] Exemplarily, the stylus status tag is flag1=1, indicating that a removal event occurs.
[0186] S603: When the magnetic sensor reports that the stylus pen is attached to the electronic device and the stylus pen status tag records that a removal event has occurred, the electronic device determines whether to establish a wireless charging connection with the stylus pen.
[0187] The electronic device transmits a digital ping message to the stylus pen, and then the electronic device establishes a wireless charging connection with the stylus pen based on the wireless charging protocol in the digital ping message.
[0188] S604: When the magnetic sensor reports that the stylus is attached to the electronic device, the stylus status tag records that a removal event has occurred, and the electronic device and the stylus establish a wireless charging connection, the electronic device determines that the stylus is in place.
[0189] S605: The electronic device starts the wireless charging function and charges the stylus, displays a pop-up window on the display screen to prompt the stylus charging information, and updates the stylus status label to an in-place event.
[0190] Exemplarily, the stylus status flag is flag2=1, indicating that the stylus is in the on-position state.
[0191] S606: The electronic device determines whether the stylus pen has been fully charged.
[0192] If the electronic device determines that the stylus pen has finished charging, the electronic device ends the charging process and turns off the wireless charging function.
[0193] If the electronic device determines that the stylus pen has not been completely charged, the electronic device continues to charge the stylus pen.
[0194] S607: During the charging process of the stylus pen, the electronic device determines whether a charging stop interruption event A occurs, and the charging stop interruption event A indicates charging stop.
[0195] S608: During the charging process of the stylus pen, the electronic device determines whether the magnetic sensor reports the stylus pen removal event B.
[0196] The removal event B reported by the magnetic sensor may be false, that is, a false alarm.
[0197] S609: The electronic device determines whether the charging stop interruption event A and the stylus removal event B occur simultaneously.
[0198] S610: When the electronic device determines that the charging stop interruption event A and the stylus removal event B occur simultaneously, the electronic device determines that the stylus removal event is true.
[0199] S611: The electronic device stops charging the stylus pen and updates the stylus pen status tag to indicate that a removal event has occurred (flag1=1).
[0200] It should be noted that after the stylus status tag is updated in step S611 to indicate that a removal event has occurred (flag1=1), the process returns to step S602. It is understandable that if the magnetic sensor reports that the stylus is adsorbed to the electronic device in step S601, step S602 is continued to be executed to obtain the stylus status tag updated in step S611, and the stylus status is determined based on the stylus status tag.
[0201] According to the method for controlling stylus charging provided by the embodiment of the present application, when the stylus is attached to the electronic device and is being charged, due to the interference of the surrounding magnetic field, the magnetic sensor may falsely report the stylus removal event, thereby causing abnormal charging of the stylus. For example, if the electronic device is charging the stylus, if the stylus removal event is detected, the electronic device will stop charging the stylus. In order to avoid misjudgment of the stylus state, the present application comprehensively judges whether the stylus removal event is true based on whether the magnetic sensor reports the stylus removal event and whether the charging chip reports the interruption event of charging stop, and then continues or stops charging the stylus based on the judgment result. For example, if the charging chip reports the interruption event of charging stop, then the stylus removal event is confirmed to be true and the charging of the stylus is stopped; if the charging chip does not report the interruption event of charging stop, then the stylus removal event is confirmed to be false and the charging of the stylus continues (i.e., does not stop). Through the application scheme, misjudgment of the stylus status is effectively avoided, and thus abnormal charging of the stylus is avoided. For example, it can avoid the situation where the stylus stops charging due to misjudgment of the status caused by magnetic field interference when the stylus is charging. In this way, the stylus can be ensured to charge normally and continuously, and the electronic device can be prevented from frequently switching between stopping charging the stylus and resuming charging the stylus. This can also avoid the electronic device from popping up windows to prompt the stylus charging information multiple times, thereby improving the user experience.
[0202] It should be noted that, in the embodiments of the present application, "greater than" can be replaced by "greater than or equal to", "less than or equal to" can be replaced by "less than", or "greater than or equal to" can be replaced by "greater than", and "less than" can be replaced by "less than or equal to".
[0203] The various embodiments described herein may be independent solutions or may be combined according to internal logic, and all of these solutions fall within the protection scope of this application.
[0204] The above mainly describes the solution provided by the embodiment of the present application from the perspective of method steps. It is understandable that, in order to achieve the above functions, the electronic device implementing the method includes a hardware structure and / or software module corresponding to the execution of each function. Those skilled in the art should be aware that, in combination with the units and algorithm steps of each example described in the embodiments disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware 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 to exceed the scope of protection of the present application.
[0205] The embodiment of the present application can divide the functional modules of the electronic device according to the above method example. For example, each functional module can be divided corresponding to each function, or two or more functions can be integrated into one processing module. The above integrated module can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the embodiment of the present application is schematic and is only a logical function division. There may be other feasible division methods in actual implementation. The following is an example of dividing each functional module corresponding to each function.
[0206] Fig.13 A schematic block diagram of a device 700 for controlling stylus charging provided in an embodiment of the present application. The device 700 can be used to perform the actions performed by the electronic device in the above method embodiment. The electronic device supports the stylus to be magnetically adsorbed to a preset area of the electronic device, and a magnet is provided at the preset area. The device 700 includes a magnetic sensing unit 710, a processing unit 720, and a charging management unit 730.
[0207] The magnetic sensing unit 710 is used to detect that the stylus pen is attached to the electronic device.
[0208] The processing unit 720 is used to switch the stylus pen to an in-place state when the magnetic sensing unit 710 detects that the stylus pen is attached to the electronic device.
[0209] A charging management unit 730, used to charge the stylus when the stylus is in the in-place state;
[0210] The processing unit 720 is further used to control the charging management unit 730 to continue or stop charging the stylus pen according to whether the magnetic sensing unit 710 reports a stylus pen removal event and whether the charging chip reports a charging stop interruption event.
[0211] In some embodiments, the processing unit 720 is specifically configured to:
[0212] When the magnetic sensing unit 710 reports the stylus removal event, but the charging chip of the electronic device does not report the charging stop interruption event, the charging management unit 730 is controlled to continue charging the stylus;
[0213] When the magnetic sensing unit 710 reports the stylus removal event and the charging chip reports the charging stop interruption event, the charging management unit 730 is controlled to stop charging the stylus.
[0214] Through the device for controlling stylus charging provided by the embodiment of the present application, when the stylus is attached to the electronic device and is being charged, due to the interference of the surrounding magnetic field, the magnetic sensor may falsely report the stylus removal event, thereby causing abnormal charging of the stylus. For example, if the electronic device is charging the stylus, if the stylus removal event is detected, the electronic device will stop charging the stylus. In order to avoid misjudgment of the stylus state, the present application comprehensively judges whether the stylus removal event is true based on whether the magnetic sensor reports the stylus removal event and whether the charging chip reports the charging stop interrupt event, and then continues or stops charging the stylus based on the judgment result. For example, if the charging chip reports the charging stop interrupt event, then the stylus removal event is confirmed to be true and the charging of the stylus is stopped; if the charging chip does not report the charging stop interrupt event, then the stylus removal event is confirmed to be false, and the charging of the stylus continues (i.e., does not stop). Through the application scheme, misjudgment of the stylus status is effectively avoided, and thus abnormal charging of the stylus is avoided. For example, it can avoid the situation where the stylus stops charging due to misjudgment of the status caused by magnetic field interference when the stylus is charging. In this way, the stylus can be ensured to charge normally and continuously, and the electronic device can be prevented from frequently switching between stopping charging the stylus and resuming charging the stylus. This can also avoid the electronic device from popping up windows to prompt the stylus charging information multiple times, thereby improving the user experience.
[0215] According to the embodiment of the present application, the device 700 may correspond to executing the method described in the embodiment of the present application, and the above and other operations and / or functions of the units in the device 700 are respectively for implementing the corresponding processes of the method, which will not be repeated here for the sake of brevity.
[0216] The present application also provides a chip, which is coupled to a memory and is used to read and execute computer programs or instructions stored in the memory to execute the methods in the above embodiments.
[0217] The present application also provides an electronic device, which includes a chip, and the chip is used to read and execute a computer program or instruction stored in a memory, so that the method in each embodiment is executed.
[0218] The present application also provides a system for controlling the charging of a stylus pen, the communication system comprising a stylus pen and an electronic device; wherein the electronic device supports the stylus pen to be magnetically attached to the electronic device and supports wireless charging of the stylus pen. The electronic device is magnetically attached to a first accessory, the first accessory being provided with a magnet; wherein the first accessory may be a keyboard or a leather case. The electronic device is used to read and execute a computer program or instruction stored in a memory to execute the methods in the above embodiments.
[0219] This embodiment further provides a computer-readable storage medium, in which computer instructions are stored. When the computer instructions are executed on an electronic device, the electronic device executes the above-mentioned related method steps to implement the method for controlling the charging of the stylus pen in the above-mentioned embodiment.
[0220] This embodiment further provides a computer program product, wherein the computer-readable storage medium stores program codes. When the computer program product is run on a computer, the computer executes the above-mentioned related steps to implement the method for controlling the charging of the stylus pen in the above-mentioned embodiment.
[0221] Among them, the electronic device, computer-readable storage medium, computer program product or chip provided in this embodiment are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding methods provided above and will not be repeated here.
[0222] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, 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.
[0223] The term "and / or" in this article is a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The symbol " / " in this article indicates that the associated objects are in an or relationship, for example, A / B means A or B.
[0224] The terms "first" and "second" in the specification and claims herein are used to distinguish different objects rather than to describe a specific order of objects. In the description of the embodiments of the present application, unless otherwise specified, the meaning of "multiple" refers to two or more than two, for example, multiple processing units refer to two or more processing units, etc.; multiple elements refer to two or more elements, etc.
[0225] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A method for controlling charging of a stylus pen, characterized in that: Applied to an electronic device, the electronic device supports a stylus pen to be magnetically adsorbed to a preset area of the electronic device, a magnet is provided at the preset area, the electronic device is magnetically adsorbed to a first accessory, the first accessory is provided with a magnet, the method includes: Detecting that the stylus is attached to the electronic device by a magnetic sensor; Switching the stylus pen to an in-place state; When the stylus pen is in the in-place state, charging the stylus pen; During the process of charging the stylus pen, detecting the relative position relationship between the first accessory and the electronic device; When it is determined that the relative position relationship meets the preset position condition, charging of the stylus pen is continued or stopped according to whether the magnetic sensor reports a stylus pen removal event and whether the charging chip reports a charging stop interruption event.
2. The method according to claim 1, characterized in that: The step of continuing or stopping charging the stylus pen according to whether the magnetic sensor reports a stylus pen removal event and whether the charging chip reports a charging stop interruption event includes: When the magnetic sensor reports the stylus removal event but the charging chip does not report the charging stop interruption event, continue charging the stylus; When the magnetic sensor reports the stylus removal event and the charging chip reports the charging stop interruption event, charging of the stylus is stopped.
3. The method according to claim 1, characterized in that The method further comprises: During the charging process of the stylus pen, detecting by the magnetic sensor whether the stylus pen is taken away; When the magnetic sensor reports the stylus removal event, it is detected whether the charging chip reports a charging stop interruption event.
4. The method according to claim 2, characterized in that: The method further comprises: When the magnetic sensor reports the stylus removal event but the charging chip does not report the charging stop interruption event, determining that the stylus removal event is false; When the magnetic sensor reports the stylus removal event and the charging chip reports the charging stop interruption event, it is determined that the stylus removal event is true.
5. The method according to claim 1, characterized in that Before continuing or stopping charging the stylus according to whether the magnetic sensor reports the stylus removal event and whether the charging chip reports the charging stop interruption event, the method further includes: It is detected whether the magnetic sensor reports the stylus removal event, and it is detected whether the charging chip reports the charging stop interruption event.
6. The method according to claim 1, characterized in that The determining that the relative position relationship satisfies the preset position condition includes: If the angle between the first accessory and the electronic device is within a preset angle range, it is determined that the relative position relationship satisfies the preset position condition.
7. The method according to claim 1, characterized in that The first accessory is a magnetic keyboard, and the electronic device supports the magnetic keyboard as an input device of the electronic device, and the magnetic keyboard supports a user to fold it after being adsorbed to the electronic device.
8. The method according to claim 1, characterized in that The first accessory is a magnetic leather case, which supports users to fold it after being adsorbed onto the electronic device.
9. The method according to claim 2, characterized in that: The method further comprises: When the magnetic sensor reports the stylus removal event and the charging chip reports the charging stop interruption event, the stylus is switched from the in-place state to the removed state.
10. The method according to claim 9, characterized in that After the stylus pen is switched to the removed state, the method further includes: The stylus state label is updated, and the updated stylus state label indicates that the stylus is in a removed state.
11. The method according to any one of claims 1 to 10, characterized in that Switching the stylus pen to the in-place state includes: In the case where it is detected that the stylus pen is adsorbed to the electronic device, detecting a recorded stylus pen status tag, wherein the stylus pen status tag indicates that the stylus pen is in a removed state or in a positioned state before adsorption; When it is detected that the stylus pen is adsorbed to the electronic device and the stylus pen is in a detached state before the adsorption, a wireless charging connection is established between the electronic device and the stylus pen; When it is detected that the stylus pen is adsorbed to the electronic device, and the stylus pen is in a removed state before adsorption, and a wireless charging connection has been established between the electronic device and the stylus pen, the stylus pen is switched to an in-place state.
12. The method according to claim 11, characterized in that The step of establishing a wireless charging connection between the electronic device and the stylus comprises: The electronic device sends a digital ping message to the stylus, wherein the digital ping message carries a wireless charging protocol; The electronic device receives a confirmation message returned by the stylus based on the digital ping message; The electronic device establishes a wireless charging connection with the stylus based on the wireless charging protocol.
13. The method according to any one of claims 1 to 10, characterized in that After switching the stylus pen to the in-place state, the method further includes: Displaying information of the stylus in a pop-up window on a display screen of the electronic device; The information of the stylus pen includes the product model and / or the remaining power value of the stylus pen.
14. The method according to any one of claims 1 to 10, characterized in that After switching the stylus pen to the in-place state, the method further includes: The stylus status tag is updated, and the updated stylus status tag indicates that the stylus is in position.
15. The method according to any one of claims 1 to 10, characterized in that The magnetic sensor is a Hall element.
16. An electronic device, characterized in that: The electronic device includes: one or more processors, and a memory; The memory is coupled to the one or more processors, and the memory is used to store computer program codes, wherein the computer program codes include computer instructions, and the one or more processors call the computer instructions to enable the electronic device to perform the method as claimed in any one of claims 1 to 15.
17. A chip, characterized in that: The chip is applied to an electronic device, and the chip includes one or more processors, and the one or more processors are used to call computer instructions so that the electronic device executes any one of the methods described in claims 1 to 15.
18. A system for controlling charging of a stylus pen, characterized in that: The system comprises a stylus and the electronic device as claimed in claim 15; wherein the electronic device supports the stylus to be magnetically adsorbed to the electronic device and supports wireless charging of the stylus.
19. The system according to claim 18, characterized in that The electronic device is adsorbed to the first accessory by magnetic attraction, and the first accessory is provided with a magnet; wherein the first accessory is a keyboard or a leather case.
20. A computer-readable storage medium, characterized in that: The computer-readable storage medium comprises instructions, which, when executed on an electronic device, cause the electronic device to perform the method as claimed in any one of claims 1 to 15.
