Charging method and device of handwriting pen, handwriting pen, system and storage medium

CN122890641APending Publication Date: 2026-10-09MAXEYE SMART TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611162102.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-31
Publication Date
2026-10-09

AI Technical Summary

Technical Problem

[0003]在对手写笔进行充电时,若平板端的充电口存在金属异物,例如金属碎屑、灰尘、导电杂质等,供电端输出的额定充电电流会直接通过异物形成回路,导致充电口局部电阻过大、发热严重,进而引发充电口烧毁,甚至可能损坏电容笔内部电路或供电设备,影响产品使用寿命和使用安全性

Benefits of technology

[0046]上述手写笔的充电方法、装置和手写笔、系统及存储介质,在确定手写笔与电子设备物理连接的情况下,通过充电端口向手写笔输出第一电流,并启动计时;在预设时长内检测到手写笔发送的识别信号的情况下,确定充电端口不存在异物;根据识别信号对手写笔进行充电。通过设置异物检测,能够对充电过程中的手写笔与电子设备的充电状态进行实时判定,并在无异物的情况下对手写笔进行充电,提升了充电的安全性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122890641A_ABST
    Figure CN122890641A_ABST
Patent Text Reader

Abstract

The application relates to a charging method and device of a handwriting pen, the handwriting pen, a system and a storage medium. In a case where the handwriting pen is physically connected to an electronic device, a first current is output to the handwriting pen through a charging port, and timing is started. In a case where a recognition signal sent by the handwriting pen is detected within a preset time length, it is determined that there is no foreign matter in the charging port. The handwriting pen is charged according to the recognition signal. Through the setting of the foreign matter detection, the charging state of the handwriting pen and the electronic device during the charging process can be determined in real time, and the handwriting pen is charged in the case where there is no foreign matter, so that the safety of the charging is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of wireless communication technology, and in particular to a method, apparatus, stylus, system, and storage medium for charging a stylus. Background Technology

[0002] With the rapid development of technology, the smart stylus market has expanded to encompass multiple fields, from education and office work to artistic creation. Styluses not only support handwriting input but also feature voice recognition, meeting diverse user needs. The stylus has three charging ports, such as... Figure 1 As shown, from left to right, GND, 5V, and GND are arranged to enable charging regardless of whether the pen is attached to the tablet in either direction. Charging starts as soon as the pen is attached to the tablet.

[0003] When charging the stylus, if there are metal foreign objects, such as metal shavings, dust, or conductive impurities, in the charging port on the tablet side, the rated charging current output from the power supply end will directly pass through the foreign object to form a circuit, causing excessive local resistance and severe heat generation in the charging port, which may lead to the burning out of the charging port, or even damage to the internal circuitry or power supply equipment of the capacitive pen, affecting the product's lifespan and safety.

[0004] However, current styluses on the market do not have foreign object detection capabilities, resulting in low charging safety. Summary of the Invention

[0005] Therefore, it is necessary to provide a charging method, device, stylus, system, and storage medium for a stylus that can improve the charging safety of the stylus in response to the above-mentioned technical problems.

[0006] In a first aspect, this application provides a method for charging a stylus, applied to an electronic device, comprising:

[0007] Once the physical connection between the stylus and the electronic device is confirmed, the first current is output to the stylus through the charging port, and the timing is started.

[0008] If a recognition signal sent by the stylus is detected within a preset time period, it is determined that there are no foreign objects in the charging port;

[0009] The stylus is charged based on the recognition signal.

[0010] In one embodiment, the method further includes:

[0011] If no recognition signal is detected from the stylus within a preset time period, it is determined that there is a foreign object in the charging port. The overcurrent protection circuit in the electronic device is controlled to disconnect the connection between the battery and the charging port to stop the output of the first current, and the device checks whether it is physically connected to the stylus according to a preset cycle.

[0012] In one embodiment, the identification signal includes a stylus identifier; charging the stylus based on the identification signal includes:

[0013] If the stylus's identity is in the list of authorized identifiers, the first current modulation signal of the stylus is detected; wherein, the first current modulation signal carries a request current;

[0014] A voltage modulation signal is generated based on the first current modulation signal and the electronic device's own state; wherein, the voltage modulation signal carries the charging current supported by the electronic device and the current charging temperature;

[0015] The stylus is detected by a second current modulation signal determined based on a voltage modulation signal, and the stylus is charged according to the second current modulation signal; wherein, the second current modulation signal includes confirmation information.

[0016] In one embodiment, the method further includes: if the stylus identifier is not in the list of authorized identifiers, controlling the overcurrent protection circuit in the electronic device to disconnect the connection between the battery and the charging port to stop the output of the first current.

[0017] In one embodiment, the method further includes:

[0018] Analyze the first current modulation signal;

[0019] If the parsed first current modulation signal is inconsistent with the format of the current modulation protocol, a new first current modulation signal is requested from the stylus, and the new first current modulation signal sent by the stylus is detected.

[0020] In one embodiment, the method further includes:

[0021] The second current modulation signal is analyzed;

[0022] If the parsed second current modulation signal is inconsistent with the format of the current modulation protocol, a new second current modulation signal is requested from the stylus, and the new second current modulation signal sent by the stylus is detected.

[0023] Secondly, this application also provides a method for charging a stylus, applied to a stylus, the method further including:

[0024] With the physical connection between the stylus and the electronic device confirmed, the first current output by the electronic device is detected.

[0025] When the first current is received within the preset detection window, an identification signal is output to the electronic device so that the electronic device can detect the identification signal within a preset time period and determine that there are no foreign objects in the charging port of the electronic device.

[0026] The second current output by the electronic device is detected to charge the stylus; wherein the second current is greater than the first current.

[0027] In one embodiment, the method further includes:

[0028] If no first current is received within the preset detection window, it is determined that there is a foreign object in the charging port of the stylus.

[0029] In one embodiment, the method further includes:

[0030] If no second current is received within the preset detection window, it is determined that there is a foreign object in the charging port of the stylus.

[0031] Thirdly, this application also provides a charging device for a stylus, applied to a stylus, the device comprising:

[0032] The pen tip detection module is used to detect the first current output by the electronic device after confirming that the stylus is physically connected to the electronic device;

[0033] The transmitting module is used to output an identification signal to the electronic device when it receives the first current within a preset detection window, so that the electronic device can detect the identification signal within a preset time period and determine that there is no foreign object in the charging port of the electronic device;

[0034] The receiving module is used to detect the second current output by the electronic device to charge the stylus; the second current is greater than the first current.

[0035] Fourthly, this application also provides a charging system for a stylus, the system including a stylus and an electronic device;

[0036] An electronic device for performing a stylus charging method as described in any of the above embodiments;

[0037] A stylus for performing a stylus charging method as described in any of the above embodiments.

[0038] Fifthly, this application also provides a stylus, including a memory and a processor, wherein the memory stores a computer program, which, when executed by the processor, performs the following steps:

[0039] With the physical connection between the stylus and the electronic device confirmed, the first current output by the electronic device is detected.

[0040] When the first current is received within the preset detection window, an identification signal is output to the electronic device so that the electronic device can detect the identification signal within a preset time period and determine that there are no foreign objects in the charging port of the electronic device.

[0041] The second current output by the electronic device is detected to charge the stylus; the second current is greater than the first current.

[0042] Sixthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, performs the following steps:

[0043] Once the physical connection between the stylus and the electronic device is confirmed, the first current is output to the stylus through the charging port, and the timing is started.

[0044] If a recognition signal sent by the stylus is detected within a preset time period, it is determined that there are no foreign objects in the charging port;

[0045] The stylus is charged based on the recognition signal.

[0046] The aforementioned charging method, device, stylus, system, and storage medium, upon confirming a physical connection between the stylus and the electronic device, output a first current to the stylus through the charging port and initiate a timer; if a recognition signal sent by the stylus is detected within a preset time period, it is determined that there is no foreign object at the charging port; and the stylus is charged based on the recognition signal. By incorporating foreign object detection, the charging status of the stylus and the electronic device can be determined in real time during the charging process, and the stylus can be charged only when there is no foreign object, thus improving charging safety. Attached Figure Description

[0047] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments of this application or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort. In the drawings:

[0048] Figure 1 This is a schematic diagram of the structure of a stylus;

[0049] Figure 2 This is a structural block diagram of a stylus charging system in one embodiment;

[0050] Figure 3 This is a flowchart illustrating a method for charging a stylus on an electronic device in one embodiment.

[0051] Figure 4 This is a schematic diagram illustrating the application of a current modulation protocol signal in one embodiment;

[0052] Figure 5 This is a flowchart illustrating a scenario where no recognition signal from the stylus is detected in one embodiment.

[0053] Figure 6 This is a schematic diagram illustrating the process of charging a stylus based on a recognition signal in one embodiment;

[0054] Figure 7 This is a schematic diagram illustrating the application of voltage modulation protocol signals in one embodiment;

[0055] Figure 8 This is a schematic diagram of the process of parsing the first current modulation signal in one embodiment;

[0056] Figure 9 This is a schematic diagram of the process of parsing the second current modulation signal in one embodiment;

[0057] Figure 10 This is a flowchart illustrating a method for charging a stylus in one embodiment;

[0058] Figure 11 This is a schematic diagram of the process for determining that there is a foreign object in the charging port of the stylus in one embodiment;

[0059] Figure 12 This is a schematic diagram illustrating the process of determining that there is a foreign object in the charging port of the stylus in another embodiment;

[0060] Figure 13 This is a schematic diagram of the interaction process of a stylus charging system in one embodiment;

[0061] Figure 14 This is a structural block diagram of a charging device for a stylus in one embodiment;

[0062] Figure 15 A structural block diagram of the charging device for the stylus in another embodiment; and

[0063] Figure 16 This is a diagram of the internal structure of an electronic device in one embodiment. Detailed Implementation

[0064] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0065] It should be noted that the terms "first," "second," etc., used in this application can be used to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish the first element from the second element. The terms "comprising" and "having," and any variations thereof, used in this application, are intended to cover non-exclusive inclusion. The term "multiple" used in this application refers to two or more. The term "and / or" used in this application refers to one of the embodiments, or any combination of multiple embodiments.

[0066] To address the issue that current styluses on the market lack foreign object detection capabilities, resulting in low charging safety, this application provides a charging method that can improve the charging safety of styluses. The following embodiments will specifically illustrate this stylus charging method.

[0067] The stylus charging method provided in this application embodiment can be applied to, for example... Figure 2 The charging system shown includes a stylus 102 and an electronic device 104. The stylus 102 and electronic device 104 are connected wirelessly or via wire. The stylus 102 can be an active pen, a capacitive pen, or a touch pen, such as any type of active capacitive pen that supports tilt pressure sensitivity, is ergonomically designed, has anti-attenuation design, or has smart functions. It can also be any other stylus that can interact with electronic device 104; there are no restrictions here. The electronic device 104 can be a mobile terminal device, tablet, laptop, or other screen device that can interact with stylus 102; there are no restrictions here. The stylus 102 is physically connected to electronic device 104. It determines whether there are foreign objects based on the detected voltage modulation signal of electronic device 104, and electronic device 104 determines whether there are foreign objects at its own charging port based on the detected current modulation signal of stylus 102. If there are no foreign objects, electronic device 104 charges stylus 102.

[0068] In one exemplary embodiment, such as Figure 3 As shown, a method for charging a stylus is provided. This embodiment illustrates the application of this method to an electronic device, including:

[0069] S201, after confirming that the stylus is physically connected to the electronic device, outputs a first current to the stylus through the charging port and starts timing.

[0070] The initial current can be 20mA, or it can be adaptively set according to the actual charging scenario; there are no restrictions here. The charging port can be a charging pin, using two power supply levels to charge the stylus: a high level of 5.5V and a low level of 4.5V. The default charging state is the low level of 4.5V.

[0071] In the embodiments of this application, the electronic device can determine whether the stylus is physically connected to the electronic device by the impedance of its own charging port. That is, when it detects that the impedance of its own charging port changes from high impedance to low impedance (open circuit to loaded circuit), it determines that the stylus is physically connected to the electronic device and starts an internal timer. Then, the electronic device outputs a first current to the stylus through the charging port, at which time the voltage is output at a low level of 4.5V. It should be noted that when the first current exceeds a preset threshold, the connection between the electronic device and the battery or power supply is turned off.

[0072] S202, if the recognition signal of the stylus is detected within a preset time, determine that there is no foreign object in the charging port.

[0073] The preset charging time can be set according to the actual charging scenario and is not limited here. The identification signal can be obtained through a pre-negotiated current modulation protocol between the stylus and the electronic device. The identification signal includes the stylus's identity identifier. The signal transmission form of the stylus based on the current modulation protocol is as follows: Figure 4 As shown, the preamble is represented by six consecutive 50ms intervals of 20mA charging followed by a 50ms interval of deactivating the charging function (101010101010). Figure 4 The preamble part), then the start bit is represented by two 50ms charging 20mA levels and two 50ms non-charging levels. Figure 4 (The start part), b0 to b3 represent data packets, Checksum represents the checksum bit, and Stop represents the stop bit.

[0074] In the embodiments of this application, after confirming the physical connection between the stylus and the electronic device, the electronic device starts its internally preset timer to determine whether the electronic device detects the stylus's recognition signal within a preset time period. When the output level of the electronic device's charging port is 4.5V and 5.5V, and the output current of the stylus's charging port is 20mA and 0mA, and both output currents are transmitted according to a current modulation protocol, it indicates that the electronic device has detected the stylus's recognition signal. In this case, the signal transmission between the stylus and the electronic device is not affected, the electronic device determines that there are no foreign objects at its charging port, and receives the recognition signal output by the stylus. It should be noted that after sending the recognition signal, the stylus returns to the default current output state, i.e., outputting a current of 20mA.

[0075] S203 charges the stylus based on the recognition signal.

[0076] In the embodiments of this application, when an electronic device receives an identification signal transmitted by a stylus, it parses the data packets in the identification signal to obtain a stylus identification identifier, matches the stylus identification identifier with the authorized identifier list of the electronic device, and determines whether to charge the stylus based on the matching result.

[0077] The aforementioned stylus charging method, after confirming a physical connection between the stylus and the electronic device, outputs a first current to the stylus through the charging port and times it; if a recognition signal from the stylus is detected within a preset time, it is determined that there are no foreign objects at the charging port; and the stylus is charged based on the recognition signal. By incorporating foreign object detection, the charging status of the stylus and the electronic device can be determined in real time during the charging process, and the stylus can be charged only when there are no foreign objects, thus improving charging safety.

[0078] In one exemplary embodiment, such as Figure 5 As shown, the method also includes:

[0079] S204 If no recognition signal sent by the stylus is detected within a preset time period, it is determined that there is a foreign object in the charging port. The overcurrent protection circuit in the electronic device is controlled to cut off the connection between the battery and the charging port to stop the output of the first current, and the device is checked for physical connection with the stylus according to a preset cycle.

[0080] The preset cycle can be 5 minutes, which can be set according to the actual charging scenario.

[0081] In the embodiments of this application, the electronic device determines whether it detects a stylus recognition signal within a preset time period. When the output level of the charging port of the electronic device is low (4.5V) within the preset time period, and the stylus output current is 20mA within the preset time period, it indicates that the electronic device has not detected the recognition signal sent by the stylus. In this case, it indicates that the signal transmission between the stylus and the electronic device is affected, and it is determined that there is a foreign object in the charging port of the electronic device. Continuing to charge in this case will damage the charging performance of the electronic device and the stylus. At this time, the overcurrent protection circuit in the electronic device disconnects the connection between the battery and the electronic device port to stop the output of the first current. It also checks whether the electronic device and the stylus are physically connected according to a preset cycle, that is, whether the foreign object has been removed and whether the stylus is effectively connected to the electronic device. When it detects that the impedance of its own charging port changes from high impedance to low impedance (open circuit to load), it is determined that the stylus and the electronic device are physically connected. After that, the electronic device outputs the first current to the stylus through the charging port, and the voltage is output at a low level of 4.5V. If a stylus recognition signal is detected within the preset time period, it is determined that there is no foreign object in the charging port of the electronic device. Finally, the stylus is charged based on the recognition signal.

[0082] The above method, by setting up foreign object detection, can determine the charging status of the stylus and electronic device in real time during the charging process, and charge the stylus in the absence of foreign objects, thereby improving the safety of charging.

[0083] In one exemplary embodiment, such as Figure 6 As shown, the identification signal includes a stylus identifier; charging the stylus based on the identification signal includes:

[0084] S301, if the stylus identifier is in the authorized identifier list, detect the first current modulation signal of the stylus.

[0085] The first current modulation signal carries the requested current; for example, the requested current is 500mA. The first current modulation signal may also include other encrypted information, such as the stylus ID. The first current modulation signal has the same form as the identification signal, both consisting of a preamble, start bit, data packet, check bit, and end bit set by the current modulation protocol. The requested current and other encrypted information are located in the data packet. The first current modulation signal follows a preset communication protocol, such as UART / I2C. This communication protocol can be set according to the actual scenario; only the electronic device and the stylus need to specify the communication protocol for encrypted communication. The authorized identifier list includes all stylus identifiers authorized by the electronic device, such as the stylus ID.

[0086] In the embodiments of this application, after receiving the identification signal sent by the stylus, the electronic device parses the identification signal to obtain the stylus identification. The stylus identification is matched against an authorized identifier list. If the stylus identification is in the authorized identifier list, it indicates that the stylus and the electronic device are paired devices, and the electronic device can charge the stylus. Therefore, the connection between the battery and the charging port is no longer disconnected via overcurrent to allow the stylus and the electronic device to establish a handshake. The electronic device detects the stylus's first current modulation signal within a preset time period, specifically whether the stylus's charging port current is 20mA and 0mA, and whether the two output currents continuously switch according to the current modulation protocol. If yes, it indicates that the stylus has sent a valid first current modulation signal to the electronic device, and the electronic device receives the first current modulation signal. If no, it indicates that the stylus has not sent a first current modulation signal to the electronic device, or that the stylus has sent an invalid first current modulation signal. In this case, the first current modulation signal is discarded, and the detection of the stylus's first current modulation signal continues.

[0087] S302 generates a voltage modulation signal based on the first current modulation signal and the electronic device's own state.

[0088] The voltage modulation signal carries the charging current supported by the electronic device and the current charging temperature. It can also include other types of data, such as BLE MAC address acquisition, stylus hardware and software version, and battery level reading, depending on the specific scenario. The identification signal can be obtained through a pre-negotiated current modulation protocol between the stylus and the electronic device. The signal transmission form of the electronic device based on the voltage modulation protocol is as follows: Figure 7 As shown, the preamble is represented by six consecutive 50ms cycles of 5.5V charging followed by 50ms cycles of 4.5V (101010101010). Figure 7 The preamble part), then uses two 5.5V levels + two 4.5V levels to represent the start bit ( Figure 7 The start portion (b0 to b3) represents the data packet, checksum represents the parity bit, and stop represents the stop bit. It should be noted that the voltage modulation signal follows a preset communication protocol, such as UART / I2C. This communication protocol can be configured according to the actual scenario; both the electronic device and the stylus only need to specify the communication protocol and encrypt the communication. The electronic device's own status can be its current remaining battery power and current charging temperature.

[0089] In the embodiments of this application, after receiving the first current modulation signal, the electronic device parses the first current modulation signal to obtain the requested current of the stylus; it also detects its own state to obtain the current remaining power and the current charging temperature, and determines the charging current supported by the electronic device based on the current remaining power and the requested current of the stylus. That is, if the current remaining power is within a first power range, the requested current of the stylus is used as the charging current supported by the electronic device; if the current remaining power is within a second power range, a preset current is used as the charging current supported by the electronic device. The power in the first power range is greater than the power in the second power range, and the requested current of the stylus is greater than the preset current. After determining the supported charging current, the electronic device generates a data packet with the supported charging current and the current charging temperature, and outputs the voltage in the transmission form specified by the voltage modulation protocol, that is, the charging port switches between a high level of 5.5V and a low level of 4.5V to form a voltage modulation signal. It should be noted that after the electronic device completes the transmission of the voltage modulation signal, the charging port outputs at a low level of 4.5V; and before sending the voltage modulation signal, it also outputs at a low level of 4.5V.

[0090] S303 detects the second current modulation signal determined by the voltage modulation signal of the stylus, and charges the stylus according to the second current modulation signal.

[0091] The second current modulation signal includes an acknowledgment message. The first and second current modulation signals have the same form, both consisting of a preamble, start bit, data packet, check bit, and end bit set by the current modulation protocol. The acknowledgment message is located within the data packet. The second current modulation signal follows a preset communication protocol, such as UART / I2C. This communication protocol can be configured according to the actual scenario; both the electronic device and the stylus only need to specify the communication protocol and encrypt the communication.

[0092] In the embodiments of this application, after sending the first current modulation signal, the stylus detects the voltage change of the charging port of the electronic device in real time. When it detects that the output voltage of the charging port of the electronic device alternates between a low level of 4.5V and a high level of 5.5V and a low level of 4.5V, it indicates that the stylus has received a valid voltage modulation signal. The stylus then parses the voltage modulation signal to obtain the charging current supported by the electronic device and the current charging temperature, and generates a charging authorization confirmation message. This message is then used to generate a data packet, and the current is output according to the transmission format specified by the current modulation protocol. Specifically, the stylus's charging port switches between 20mA and 0mA current outputs, generating a second current modulation signal. When the electronic device detects the stylus's charging port switching between 20mA and 0mA current outputs, it indicates that the stylus has sent a valid second current modulation signal to the electronic device, and receives the second current modulation signal. The electronic device parses the second current modulation signal to obtain the charging authorization confirmation message. At this point, the electronic device and the stylus have successfully established a handshake. Finally, the electronic device charges the stylus according to the supported charging current, such as 500mA.

[0093] In one exemplary embodiment, if the stylus identifier is not in the list of authorized identifiers, the overcurrent protection circuit in the control electronic device disconnects the connection between the battery and the charging port to stop the output of the first current.

[0094] In the embodiments of this application, when the electronic device matches the stylus identifier with the list of authorized identifiers, it determines whether the electronic device and the stylus are paired devices. If the stylus identifier is not in the list of authorized identifiers, it indicates that the electronic device and the stylus are not paired devices, and the electronic device cannot directly charge the stylus. In this case, the electronic device controls the overcurrent protection circuit to disconnect the connection between the battery and the charging port to stop the output of the first current.

[0095] In some embodiments, the electronic device can also detect whether it is physically connected to a new stylus at a preset cycle. When it detects that the impedance of its own charging port changes from high impedance to low impedance (open circuit to loaded circuit), it determines that the new stylus is physically connected to the electronic device. Then, the electronic device outputs a first current to the stylus through the charging port, at which time the voltage is output at a low level of 4.5V. If a recognition signal from the new stylus is detected within a preset time, it is determined that there are no foreign objects in the charging port of the electronic device. The recognition signal of the new stylus is parsed. When the new stylus's identifier is in the authorized identifier list of the electronic device, the electronic device performs a handshake with the stylus by switching between a high level of 5.5V and a low level of 4.5V, so as to charge the stylus after a successful handshake.

[0096] In one exemplary embodiment, such as Figure 8 As shown, the method also includes:

[0097] S401, analyzes the first current modulation signal.

[0098] In the embodiments of this application, after receiving the first current modulation signal output by the stylus, the electronic device parses the first current modulation signal to obtain the preamble, start bit, data packet, check bit and end bit of the first current modulation signal.

[0099] S402, if the parsed first current modulation signal is inconsistent with the format of the current modulation protocol, request a new first current modulation signal from the stylus and detect the new first current modulation signal sent by the stylus.

[0100] In the embodiments of this application, the electronic device compares the format of the first current modulation signal with that of the current modulation protocol. When the preamble of the first current modulation signal is inconsistent with the preamble of the current modulation protocol, it requests a new first current modulation signal from the stylus. When the output current of the stylus's charging port switches between 20mA and 0mA current switching output modes, it receives the new first current modulation signal output by the stylus. The new first current modulation signal is then parsed to obtain its preamble, start bit, data packet, check bit, and end bit. When the preamble of the first current modulation signal matches the preamble of the current modulation protocol, a voltage modulation signal is generated based on the new first current modulation signal and the device's own state.

[0101] In some embodiments, the electronic device compares the format of the first current modulation signal with that of the current modulation protocol. If the preamble and start bit of the first current modulation signal do not match those of the current modulation protocol, the device requests a new first current modulation signal from the stylus. When the output current of the stylus's charging port switches between 20mA and 0mA current switching output modes, the device receives the new first current modulation signal output by the stylus. The new first current modulation signal is then parsed to obtain its preamble, start bit, data packet, check bit, and end bit. If the preamble of the first current modulation signal matches the preamble and start bit of the current modulation protocol, a voltage modulation signal is generated based on the new first current modulation signal and the device's own state.

[0102] The above method sets the output signal of the stylus to a current modulation signal and the output signal of the electronic device to a voltage modulation signal, so as to distinguish the output results of the stylus and the electronic device, which facilitates the stable operation of two-way communication and thus improves the safety of stylus charging.

[0103] In one exemplary embodiment, such as Figure 9As shown, the method also includes:

[0104] S501 analyzes the second current modulation signal.

[0105] In the embodiments of this application, after receiving the second current modulation signal output by the stylus, the electronic device parses the second current modulation signal to obtain the preamble, start bit, data packet, check bit and end bit of the second current modulation signal.

[0106] S502, if the parsed second current modulation signal is inconsistent with the format of the current modulation protocol, requests a new second current modulation signal from the stylus and detects the new second current modulation signal sent by the stylus.

[0107] In the embodiments of this application, the electronic device compares the format of the second current modulation signal with that of the current modulation protocol. When the preamble of the second current modulation signal is inconsistent with the preamble of the current modulation protocol, it requests a new second current modulation signal from the stylus. When the output current of the stylus's charging port switches between 20mA and 0mA current switching output modes, it receives the new second current modulation signal output by the stylus. The new second current modulation signal is then parsed to obtain its preamble, start bit, data packet, check bit, and end bit. When the preamble of the second current modulation signal matches the preamble of the current modulation protocol, a voltage modulation signal is generated based on the new second current modulation signal and the device's own state.

[0108] In some embodiments, the electronic device compares the format of the second current modulation signal with that of the current modulation protocol. If the preamble and start bit of the second current modulation signal do not match those of the current modulation protocol, it requests a new second current modulation signal from the stylus. When the output current of the stylus's charging port switches between 20mA and 0mA current switching output modes, it receives the new second current modulation signal output by the stylus. The new second current modulation signal is then parsed to obtain its preamble, start bit, data packet, check bit, and end bit. When the preamble of the second current modulation signal matches the preamble and start bit of the current modulation protocol, a voltage modulation signal is generated based on the new second current modulation signal and the device's own state.

[0109] In one exemplary embodiment, such as Figure 10 As shown, a method for charging a stylus is provided. This embodiment illustrates the application of this method to a stylus, including:

[0110] S601 detects the first current output by the electronic device when it is confirmed that the stylus is physically connected to the electronic device.

[0111] In the embodiments of this application, the electronic device can determine whether the stylus is physically connected to the electronic device by the impedance of its own charging port. That is, when it detects that the impedance of its own charging port changes from high impedance to low impedance (open circuit to loaded circuit), it determines that the stylus is physically connected to the electronic device. Then, the electronic device outputs a first current to the stylus through the charging port, at which time the voltage is output at a low level of 4.5V.

[0112] S602, when the first current is received within the preset detection window, an identification signal is output to the electronic device so that the electronic device detects the identification signal within a preset time period and determines that there is no foreign object in the charging port of the electronic device.

[0113] In the embodiments of this application, after detecting the first current output by the electronic device, the stylus outputs an identification signal to the electronic device, that is, it outputs the identification signal in a form that switches between two output currents: 20mA and 0mA. The electronic device monitors the current of the stylus's charging port in real time. When it detects that the stylus's charging port is outputting in a form that switches between 20mA and 0mA, it indicates that the electronic device has detected the stylus's identification signal. In this case, the signal transmission between the stylus and the electronic device is not affected. The electronic device determines that there are no foreign objects in the charging port of the electronic device and receives the identification signal output by the stylus. It should be noted that after the stylus finishes sending the identification signal, it restores the default current output state, that is, it outputs a current of 20mA.

[0114] S603 detects the second current output by the electronic device to charge the stylus.

[0115] The second current is greater than the first current; for example, the second current is 500mA.

[0116] In the embodiments of this application, upon receiving an identification signal transmitted by a stylus, the electronic device parses the data packets in the identification signal to obtain a stylus identifier. The stylus identifier is then matched against the electronic device's list of authorized identifiers. If the stylus identifier is within the authorized identifier list, the electronic device outputs a voltage modulation signal to the stylus. The stylus, based on the voltage modulation signal, outputs a current modulation signal to the electronic device, thus achieving a successful handshake. After the handshake is successful, when the stylus detects that the output current of the electronic device's charging port is a second current, it determines that the stylus is charging.

[0117] In some embodiments, when the stylus identifier is in the authorized identifier list, the electronic device sends a voltage modulation signal to the stylus to allow the stylus to send a charging request. If the stylus detects within a preset time period after receiving the voltage modulation signal that its charging port is in a non-charging state (i.e., the output current in the non-charging state is 0mA), the stylus outputs a first current modulation signal to the electronic device. After detecting the voltage modulation signal output by the electronic device based on the first current modulation signal and the electronic device's own state, the voltage modulation signal is parsed to obtain the charging current supported by the electronic device and the current charging temperature. Based on this charging current and current charging temperature, the electronic device calculates its maximum load charging requirement and outputs it as a second current modulation signal to ensure a successful handshake between the two devices.

[0118] In some embodiments, after receiving a voltage modulation signal sent by an electronic device, the stylus parses the voltage modulation signal. If the parsed voltage modulation signal is inconsistent with the format of the voltage modulation protocol, the stylus requests a new voltage modulation signal from the electronic device and detects the new voltage modulation signal sent by the electronic device.

[0119] In one exemplary embodiment, such as Figure 11 As shown, the method also includes:

[0120] S604: If no first current is received within the preset detection window, it is determined that there is a foreign object in the charging port of the stylus.

[0121] The preset detection window can be adaptively set according to the actual charging scenario, and there are no restrictions here.

[0122] In the embodiments of this application, the stylus can determine whether it is physically connected to the electronic device by detecting the impedance of its own charging port. Specifically, when it detects a change in impedance from high to low at its charging port, it determines that the stylus is physically connected to the electronic device. A timer is also pre-configured inside the stylus. After confirming the physical connection, the timer starts. If no first current is received from the electronic device within a preset time period, it is determined that there is a foreign object in the stylus's charging port. This situation indicates that continued charging of the stylus will affect the charging performance of both the electronic device and the stylus. In this case, the overcurrent protection circuit in the stylus will disconnect the battery from the stylus's charging port to maintain a power-off mode. After the foreign object is manually removed, it will continue to sense whether it is physically connected to the electronic device.

[0123] In one exemplary embodiment, such as Figure 12 As shown, the method also includes:

[0124] S605: If no second current is received within the preset detection window, it is determined that there is a foreign object in the charging port of the stylus.

[0125] The preset detection window can be adaptively set according to the actual charging scenario, and there are no restrictions here.

[0126] In the embodiments of this application, after the stylus successfully hands over with the electronic device, a pre-configured timer starts timing. If no second current is received from the electronic device within a preset detection window, it is determined that there is a foreign object in the stylus's charging port. This situation indicates that continued charging of the stylus will affect the charging performance of both the electronic device and the stylus. At this time, the overcurrent protection circuit in the stylus will disconnect the battery from the stylus's charging port to maintain a power-off mode. After the foreign object is manually removed, the stylus continues to send an identification signal to the electronic device to achieve successful charging.

[0127] In one exemplary embodiment, such as Figure 13 As shown, a charging system for a stylus is provided. The system includes a stylus and an electronic device, wherein:

[0128] S701, once the physical connection between the stylus and the electronic device is confirmed, the electronic device outputs a first current to the stylus through the charging port and starts the timing.

[0129] S702: When the stylus outputs a recognition signal within a preset time, the electronic device determines that there is no foreign object in the charging port.

[0130] S703, if the stylus does not output a recognition signal within a preset time, the electronic device determines that there is a foreign object in the charging port; controls the overcurrent protection circuit in the electronic device to disconnect the connection between the battery and the charging port to stop the output of the first current, and checks whether it is physically connected to the stylus according to a preset cycle.

[0131] S704, when the stylus's identifier is in the list of authorized identifiers, the stylus outputs a first current modulation signal to the electronic device;

[0132] S705, the electronic device parses the first current modulation signal; if the parsed first current modulation signal is inconsistent with the format of the current modulation protocol, it requests a new first current modulation signal from the stylus and detects the new first current modulation signal sent by the stylus.

[0133] S706, when the parsed first current modulation signal is consistent with the format of the current modulation protocol, the electronic device generates a voltage modulation signal based on the first current modulation signal and its own state, and outputs the voltage modulation signal to the stylus.

[0134] S707: The stylus parses the voltage modulation signal. If the parsed voltage modulation signal is consistent with the voltage modulation protocol format, the stylus outputs a second current modulation signal to the electronic device.

[0135] S708, if the parsed voltage modulation signal is inconsistent with the format of the voltage modulation protocol, requests a new voltage modulation signal from the electronic device and detects the new voltage modulation signal sent by the electronic device.

[0136] S709, the electronic device parses the second current modulation signal; if the parsed second current modulation signal is inconsistent with the format of the current modulation protocol, it requests a new second current modulation signal from the stylus and detects the new second current modulation signal sent by the stylus.

[0137] S710: When the parsed second current modulation signal is consistent with the format of the current modulation protocol, the electronic device outputs a second current to charge the stylus through the charging port.

[0138] It should be understood that although the steps in the flowcharts of the above embodiments are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages in other steps. It is understood that the steps in different embodiments can be freely combined as needed, and all non-contradictory solutions formed by such combinations are within the scope of protection of this application.

[0139] Based on the same inventive concept, this application also provides a stylus charging device for implementing the above-described stylus charging method. The solution provided by this device is similar to the solution described in the above method; therefore, the specific limitations of one or more stylus charging device embodiments provided below can be found in the limitations of the stylus charging method described above, and will not be repeated here.

[0140] In one exemplary embodiment, such as Figure 14 As shown, a charging device for a stylus is provided, applied to an electronic device, including: a device-side detection module 81, a determination module 82, and a charging module 83, wherein:

[0141] The device-side detection module 81 is used to output a first current to the stylus through the charging port and start timing when it is determined that the stylus is physically connected to the electronic device;

[0142] The determination module 82 is used to determine that there is no foreign object in the charging port when the recognition signal sent by the stylus is detected within a preset time period;

[0143] The charging module 83 is used to charge the stylus based on the recognition signal.

[0144] In an exemplary embodiment, the charging device further includes a disconnection module, configured to: determine that there is a foreign object in the charging port if no recognition signal sent by the stylus is detected within a preset time period, control the overcurrent protection circuit in the electronic device to disconnect the connection between the battery and the charging port to stop the output of the first current, and detect whether there is a physical connection with the stylus according to a preset cycle.

[0145] In an exemplary embodiment, the charging module is specifically configured to: detect a first current modulation signal of the stylus when the stylus's identity is in the authorized identifier list; wherein the first current modulation signal carries a requested current; generate a voltage modulation signal based on the first current modulation signal and the electronic device's own state; wherein the voltage modulation signal carries the charging current supported by the electronic device and the current charging temperature; detect a second current modulation signal determined by the stylus based on the voltage modulation signal, and charge the stylus according to the second current modulation signal; wherein the second current modulation signal includes confirmation information.

[0146] In one exemplary embodiment, the charging module is specifically configured to: control the overcurrent protection circuit in the electronic device to disconnect the connection between the battery and the charging port to stop the output of the first current when the stylus identifier is not in the list of authorized identifiers.

[0147] In an exemplary embodiment, the charging module is specifically configured to: parse the first current modulation signal; if the parsed first current modulation signal is inconsistent with the format of the current modulation protocol, request a new first current modulation signal from the stylus, and detect the new first current modulation signal sent by the stylus.

[0148] In an exemplary embodiment, the charging module is specifically configured to: parse the second current modulation signal; if the parsed second current modulation signal is inconsistent with the format of the current modulation protocol, request a new second current modulation signal from the stylus, and detect the new second current modulation signal sent by the stylus.

[0149] In one exemplary embodiment, such as Figure 15 As shown, a charging device for a stylus is provided, which is applied to the stylus and includes: a pen tip detection module 91, a transmitting module 92, and a receiving module 93, wherein:

[0150] The pen tip detection module 91 is used to detect the first current output by the electronic device when it is determined that the stylus is physically connected to the electronic device;

[0151] The transmitting module 92 is used to output an identification signal to the electronic device when it receives the first current within a preset detection window, so that the electronic device can detect the identification signal within a preset time period and determine that there is no foreign object in the charging port of the electronic device;

[0152] The receiving module 93 is used to detect the second current output by the electronic device to charge the stylus; the second current is greater than the first current.

[0153] In one exemplary embodiment, the device further includes a pen tip determination module for determining that there is a foreign object at the charging port of the stylus when no first current is received within a preset detection window.

[0154] In an exemplary embodiment, the pen tip determination module is further configured to: determine that there is a foreign object in the charging port of the stylus when no second current is received within a preset detection window.

[0155] The various modules in the aforementioned stylus charging device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in the processor of a computer device in hardware form or independent of it, or stored in the memory of a computer device in software form, so that the processor can call and execute the operations corresponding to each module.

[0156] In one exemplary embodiment, an electronic device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 16 As shown, this electronic device includes a processor, memory, input / output (I / O) interfaces, and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The database stores current modulation protocols and voltage modulation protocols. The I / O interfaces are used for information exchange between the processor and external devices. The communication interface is used for communication with external terminals via a network connection. When the computer program is executed by the processor, it implements a method for charging a stylus.

[0157] Those skilled in the art will understand that Figure 16The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the electronic device to which the present application is applied. The specific electronic device may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0158] In one exemplary embodiment, an electronic device is provided, including a memory and a processor. The memory stores a computer program that, when executed by the processor, performs the following steps:

[0159] Once the physical connection between the stylus and the electronic device is confirmed, the first current is output to the stylus through the charging port, and the timing is started.

[0160] If a recognition signal sent by the stylus is detected within a preset time period, it is determined that there are no foreign objects in the charging port;

[0161] The stylus is charged based on the recognition signal.

[0162] In one embodiment, when executed by a processor, a computer program is used to perform the following steps:

[0163] If no recognition signal is detected from the stylus within a preset time period, it is determined that there is a foreign object in the charging port. The overcurrent protection circuit in the electronic device is controlled to disconnect the connection between the battery and the charging port to stop the output of the first current, and the device checks whether it is physically connected to the stylus according to a preset cycle.

[0164] In one embodiment, when executed by a processor, a computer program is used to perform the following steps:

[0165] If the stylus's identity is in the list of authorized identifiers, the first current modulation signal of the stylus is detected; wherein, the first current modulation signal carries a request current;

[0166] A voltage modulation signal is generated based on the first current modulation signal and the electronic device's own state; wherein, the voltage modulation signal carries the charging current supported by the electronic device and the current charging temperature;

[0167] The stylus is detected by a second current modulation signal determined based on a voltage modulation signal, and the stylus is charged according to the second current modulation signal; wherein, the second current modulation signal includes confirmation information.

[0168] In one embodiment, when executed by a processor, a computer program is used to perform the following steps:

[0169] If the stylus identifier is not in the list of authorized identifiers, the overcurrent protection circuit in the control electronic device disconnects the connection between the battery and the charging port to stop the output of the first current.

[0170] In one embodiment, when executed by a processor, a computer program is used to perform the following steps:

[0171] Analyze the first current modulation signal;

[0172] If the parsed first current modulation signal is inconsistent with the format of the current modulation protocol, a new first current modulation signal is requested from the stylus, and the new first current modulation signal sent by the stylus is detected.

[0173] In one embodiment, when executed by a processor, a computer program is used to perform the following steps:

[0174] The second current modulation signal is analyzed;

[0175] If the parsed second current modulation signal is inconsistent with the format of the current modulation protocol, a new second current modulation signal is requested from the stylus, and the new second current modulation signal sent by the stylus is detected.

[0176] In one exemplary embodiment, a stylus is provided, including a memory and a processor. The memory stores a computer program that, when executed by the processor, performs the following steps:

[0177] With the physical connection between the stylus and the electronic device confirmed, the first current output by the electronic device is detected.

[0178] When the first current is received within the preset detection window, an identification signal is output to the electronic device so that the electronic device can detect the identification signal within a preset time period and determine that there is no foreign object in the charging port of the electronic device.

[0179] The second current output by the electronic device is detected to charge the stylus; wherein the second current is greater than the first current.

[0180] In one embodiment, when executed by a processor, a computer program is used to perform the following steps:

[0181] If no first current is received within the preset detection window, it is determined that there is a foreign object in the charging port of the stylus.

[0182] In one embodiment, when executed by a processor, a computer program is used to perform the following steps:

[0183] If no second current is received within the preset detection window, it is determined that there is a foreign object in the charging port of the stylus.

[0184] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, performs the following steps:

[0185] Once the physical connection between the stylus and the electronic device is confirmed, the first current is output to the stylus through the charging port, and the timing is started.

[0186] If a recognition signal sent by the stylus is detected within a preset time period, it is determined that there are no foreign objects in the charging port;

[0187] The stylus is charged based on the recognition signal.

[0188] In one embodiment, when executed by a processor, a computer program is used to perform the following steps:

[0189] If no recognition signal is detected from the stylus within a preset time period, it is determined that there is a foreign object in the charging port. The overcurrent protection circuit in the electronic device is controlled to disconnect the connection between the battery and the charging port to stop the output of the first current, and the device checks whether it is physically connected to the stylus according to a preset cycle.

[0190] In one embodiment, when executed by a processor, a computer program is used to perform the following steps:

[0191] If the stylus's identity is in the list of authorized identifiers, the first current modulation signal of the stylus is detected; wherein, the first current modulation signal carries a request current;

[0192] A voltage modulation signal is generated based on the first current modulation signal and the electronic device's own state; wherein, the voltage modulation signal carries the charging current supported by the electronic device and the current charging temperature;

[0193] The stylus is detected by a second current modulation signal determined based on a voltage modulation signal, and the stylus is charged according to the second current modulation signal; wherein, the second current modulation signal includes confirmation information.

[0194] In one embodiment, when executed by a processor, a computer program is used to perform the following steps:

[0195] If the stylus identifier is not in the list of authorized identifiers, the overcurrent protection circuit in the control electronic device disconnects the connection between the battery and the charging port to stop the output of the first current.

[0196] In one embodiment, when executed by a processor, a computer program is used to perform the following steps:

[0197] Analyze the first current modulation signal;

[0198] If the parsed first current modulation signal is inconsistent with the format of the current modulation protocol, a new first current modulation signal is requested from the stylus, and the new first current modulation signal sent by the stylus is detected.

[0199] In one embodiment, when executed by a processor, a computer program is used to perform the following steps:

[0200] The second current modulation signal is analyzed;

[0201] If the parsed second current modulation signal is inconsistent with the format of the current modulation protocol, a new second current modulation signal is requested from the stylus, and the new second current modulation signal sent by the stylus is detected.

[0202] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, the computer program performing the following steps when executed by a processor:

[0203] With the physical connection between the stylus and the electronic device confirmed, the first current output by the electronic device is detected.

[0204] When the first current is received within the preset detection window, an identification signal is output to the electronic device so that the electronic device can detect the identification signal within a preset time period and determine that there is no foreign object in the charging port of the electronic device.

[0205] The second current output by the electronic device is detected to charge the stylus; wherein the second current is greater than the first current.

[0206] In one embodiment, when executed by a processor, a computer program is used to perform the following steps:

[0207] If no first current is received within the preset detection window, it is determined that there is a foreign object in the charging port of the stylus.

[0208] In one embodiment, when executed by a processor, a computer program is used to perform the following steps:

[0209] If no second current is received within the preset detection window, it is determined that there is a foreign object in the charging port of the stylus.

[0210] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.

[0211] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited to these.

[0212] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0213] The above embodiments are merely illustrative of several implementation methods of this application, and their descriptions are relatively specific and detailed. However, they should not be construed as limiting the scope of this application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A method for charging a stylus, characterized in that, Applied to electronic devices, the method includes: Once the physical connection between the stylus and the electronic device is confirmed, a first current is output to the stylus through the charging port, and a timer is started. If the recognition signal sent by the stylus is detected within a preset time period, it is determined that there is no foreign object in the charging port; The stylus is charged based on the recognition signal.

2. The method according to claim 1, characterized in that, The method further includes: If no recognition signal is detected from the stylus within the preset time period, it is determined that there is a foreign object in the charging port. The overcurrent protection circuit in the electronic device is controlled to disconnect the connection between the battery and the charging port to stop the output of the first current, and to detect whether it is physically connected to the stylus according to a preset cycle.

3. The method according to claim 1, characterized in that, The identification signal includes a stylus identifier; Charging the stylus according to the recognition signal includes: If the stylus identifier is in the list of authorized identifiers, a first current modulation signal of the stylus is detected; wherein, the first current modulation signal carries a request current; A voltage modulation signal is generated based on the first current modulation signal and the state of the electronic device itself; wherein the voltage modulation signal carries the charging current supported by the electronic device and the current charging temperature; The stylus is detected to determine a second current modulation signal based on the voltage modulation signal, and the stylus is charged according to the second current modulation signal; wherein, the second current modulation signal includes confirmation information.

4. The method according to claim 3, characterized in that, Also includes: If the stylus identifier is not in the list of authorized identifiers, the overcurrent protection circuit in the electronic device is controlled to disconnect the connection between the battery and the charging port to stop the output of the first current.

5. The method according to claim 3, characterized in that, The method further includes: The first current modulation signal is analyzed; If the parsed first current modulation signal is inconsistent with the format of the current modulation protocol, a new first current modulation signal is requested from the stylus, and the new first current modulation signal sent by the stylus is detected.

6. The method according to claim 3, characterized in that, The method further includes: The second current modulation signal is analyzed; If the parsed second current modulation signal is inconsistent with the format of the current modulation protocol, a new second current modulation signal is requested from the stylus, and the new second current modulation signal sent by the stylus is detected.

7. A method for charging a stylus, characterized in that, Applied to a stylus, the method further includes: If the stylus is physically connected to the electronic device, detect the first current output by the electronic device. When the first current is received within a preset detection window, an identification signal is output to the electronic device so that the electronic device detects the identification signal within a preset time period and determines that there is no foreign object in the charging port of the electronic device; The second current output by the electronic device is detected to charge the stylus; wherein the second current is greater than the first current.

8. The method according to claim 7, characterized in that, The method further includes: If the first current is not received within the preset detection window, it is determined that there is a foreign object in the charging port of the stylus.

9. The method according to claim 7, characterized in that, The method further includes: If the second current is not received within the preset detection window, it is determined that there is a foreign object in the charging port of the stylus.

10. A charging device for a stylus, characterized in that, Applied to a stylus, the device includes: The pen tip detection module is used to detect the first current output by the electronic device when it is determined that the stylus is physically connected to the electronic device; The transmitting module is used to output an identification signal to the electronic device when the first current is received within a preset detection window, so that the electronic device can detect the identification signal within a preset time period and determine that there is no foreign object in the charging port of the electronic device; A receiving module is used to detect a second current output by the electronic device to charge the stylus; the second current is greater than the first current.

11. A stylus, comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When executed by the processor, the computer program is used to implement the method as described in claim 7 or 8.

12. A charging system for a stylus, characterized in that, The charging system includes electronic devices and a stylus; The electronic device is used to perform the charging method of the stylus as described in any one of claims 1 to 6; The stylus is used to perform the stylus charging method as described in any one of claims 7 to 9.

13. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the computer program is used to implement the method as claimed in any one of claims 1 to 6 or 7 to 9.