Handwriting pen control method and equipment

By setting a contact connector and ID PIN on the stylus, automatically identifying and switching data paths, the problems of limited space and weight of the stylus and function solidification are solved, and functions are expanded and user needs are met.

CN120295496APending Publication Date: 2025-07-11LONGCHEER ELECTRONICS HUIZHOU
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510368227.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-26
Publication Date
2025-07-11

AI Technical Summary

Technical Problem

Due to limited space and weight, existing stylus have solid functions and are difficult to expand new functions without adding hardware design.

Method used

By setting the connection points of the contact connector on the stylus, including the data transfer pin and the identity pin ID PIN, identify the removable module by polling the level value of the ID PIN, and switching the corresponding data paths to enable the removable module's functionality.

Benefits of technology

It realizes automatic identification of the detachable module of the stylus, enriches the functions of the stylus, reduces the integration pressure of the motherboard ornaments, and meets the users' changing needs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120295496A_ABST
    Figure CN120295496A_ABST
Patent Text Reader

Abstract

The invention provides a control method and device of a handwriting pen. The handwriting pen is provided with a connection point of a contact type connector comprising a data transmission pin and an identity pin ID PIN. And when the ID PIN is configured to be input pull-up, polling and reading the level value of the ID PIN. If it is determined that the detachable module is connected to the handwriting pen according to the level value of the ID PIN, an ADC value is read, the type of the detachable module is determined according to the ADC value, and a corresponding data path formed by the data transmission pins is switched according to the type of the detachable module, so that the handwriting pen interacts with the detachable module. The handwriting pen is provided with the detachable module, the type of the connected detachable module can be automatically recognized, the integration pressure of a mainboard ornament is relieved, the functions of the handwriting pen are enriched, the defects of the handwriting pen in space, weight and function extension methods are effectively overcome, the market prospect of the handwriting pen is widened, and the market prospect of the handwriting pen is widened. And the continuously changing use requirements of the user are met.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to a stylus, and more particularly to a control method and device for a stylus. Background Art

[0002] With the development of intelligent terminals, styluses have also been widely used. However, for the styluses launched by current manufacturers, due to the limited space in the pen body, the integration degree of the components on the main board is already very high. If more functions are to be integrated at the pen end, there are significant challenges in the component design of the main board and the control of the pen-end weight. In addition, once a stylus is launched on the market, its functions are already determined, and it is difficult to expand new functions without adding hardware design. It can be seen that current styluses face the defects of limited space and weight as well as function solidification. Summary of the Invention

[0003] The control method and device for a stylus provided in this application are used to overcome the defects of limited space and weight as well as function solidification of current styluses.

[0004] In a first aspect, this application provides a control method for a stylus. The stylus is provided with connection points of a contact connector. The connection points of the contact connector include data transmission pins and an identity pin ID PIN. The method includes:

[0005] When the ID PIN is configured as input pull-up, polling and reading the level value of the ID PIN;

[0006] When it is determined according to the level value of the ID PIN that a detachable module is connected to the stylus, reading the ADC value;

[0007] Determining the type of the detachable module according to the ADC value, and switching the corresponding data path according to the type of the detachable module, so that the stylus enables the function of the detachable module. The data transmission pins are used to form the data path.

[0008] In a possible implementation manner, the data transmission pins include pins of DATA1 and DATA2;

[0009] The DATA1 and DATA2 form the corresponding data path through a multiplexed data transmission interface, and the data transmission interface is arranged on the stylus.

[0010] In a possible implementation manner, the data transmission interface includes at least one of a USB interface, a UART interface, and an IIC interface.

[0011] In a possible implementation manner, the stylus further includes:

[0012] A switching chip, which is respectively connected to the contact connector and the data transmission interface, is used to switch the data path.

[0013] In a possible implementation manner, the connection points of the contact connector further include: connection points of the voltage bus VBUS;

[0014] The VBUS is used to step down the voltage for the detachable module.

[0015] In a possible implementation manner, if the stylus does not support the output of the target voltage, the stylus further includes a boost circuit connected to the connection point of the VBUS.

[0016] In a possible implementation manner, after switching the corresponding data path according to the type of the detachable module, it further includes:

[0017] Outputting a target voltage to supply power to the detachable module.

[0018] In a possible implementation manner, after polling and reading the level value of the ID PIN, the method further includes:

[0019] If it is determined that the level value of the ID PIN is not the first preset level, it is determined that the detachable module is connected to the stylus.

[0020] In a possible implementation manner, after polling and reading the level value of the ID PIN, the method further includes:

[0021] If it is determined that the level value of the ID PIN is not the second preset level, it is determined that the detachable module is disconnected from the stylus, and the first preset level is different from the second preset level.

[0022] In a possible implementation manner, after determining that the detachable module is disconnected from the stylus, the method further includes: stopping supplying power to the detachable module, and closing the data path.

[0023] In a possible implementation manner, the detachable module includes one or more of a camera, a microphone, a mouse, a keyboard, a sensor, a flashlight, and a fan.

[0024] In a possible implementation manner, the sensor includes one or more of an accelerometer, a gyroscope sensor, a magnetometer sensor, a proximity sensor, a Hall sensor, a UWB sensor, and an infrared sensor.

[0025] In a possible implementation manner, the stylus is an active stylus.

[0026] Second aspect, the present application provides a control device for a stylus. The stylus is provided with connection points of a contact connector, and the connection points of the contact connector include data transmission pins and an identity pin ID PIN; the device includes:

[0027] A first reading module, configured to poll and read the level value of the ID PIN when the ID PIN is configured as an input pull-up.

[0028] A second reading module, configured to read the ADC value when it is determined according to the level value of the ID PIN that a detachable module is connected to the stylus.

[0029] A processing module, configured to determine the type of the detachable module according to the ADC value, so as to switch a corresponding data path according to the type of the detachable module, so that the stylus enables the function of the detachable module. The data transmission pins are used to form the data path.

[0030] In a possible implementation manner, the data transmission pins include pins of DATA1 and DATA2;

[0031] The DATA1 and DATA2 form the corresponding data path through a multiplexed data transmission interface, and the data transmission interface is arranged on the stylus.

[0032] In a possible implementation manner, the data transmission interface includes at least one of a USB interface, a UART interface, and an IIC interface.

[0033] In a possible implementation manner, the stylus further includes:

[0034] A switch chip, respectively connected to the contact connector and the data transmission interface, for switching the data path.

[0035] In a possible implementation manner, the connection points of the contact connector further include: a connection point of a voltage bus VBUS;

[0036] The VBUS is used to step down the voltage for the detachable module.

[0037] In a possible implementation manner, if the stylus does not support the output of a target voltage, the stylus further includes a boost circuit connected to the connection point of the VBUS.

[0038] In a possible implementation manner, the processing module is further configured to:

[0039] Output a target voltage to supply power to the detachable module.

[0040] In a possible implementation, the processing module is further configured to:

[0041] If it is determined that the level value of the ID PIN is not the first preset level, determine that the detachable module is connected to the stylus.

[0042] In a possible implementation, the processing module is further configured to:

[0043] If it is determined that the level value of the ID PIN is not the second preset level, determine that the detachable module is disconnected from the stylus, where the first preset level is different from the second preset level.

[0044] In a possible implementation, the processing module is further configured to: stop powering the detachable module and close the data path.

[0045] In a possible implementation, the detachable module includes one or more of a camera, a microphone, a mouse, a keyboard, a sensor, a flashlight, and a fan.

[0046] In a possible implementation, the sensor includes one or more of an accelerometer, a gyroscope sensor, a magnetometer sensor, a proximity sensor, a Hall sensor, a UWB sensor, and an infrared sensor.

[0047] In a possible implementation, the stylus is an active stylus.

[0048] In a third aspect, the present application provides an electronic device, including: a memory, a processor;

[0049] The memory stores computer-executable instructions;

[0050] The processor executes the computer-executable instructions stored in the memory, so that the processor executes the above first aspect and / or various possible implementations of the first aspect.

[0051] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, where computer-executable instructions are stored in the computer-readable storage medium, and when the computer-executable instructions are executed by a processor, they are used to implement the above first aspect and / or various possible implementations of the first aspect.

[0052] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, and when the computer program is executed by a processor, it implements the above first aspect and / or various possible implementations of the first aspect.

[0053] The control method and device for a stylus provided in this application. The stylus is provided with connection points of a contact connector, and the connection points of the contact connector include data transmission pins and an identity pin (ID PIN). When the ID PIN is configured as an input pull-up, the level value of the ID PIN is polled and read. If it is determined according to the level value of the ID PIN that a detachable module is connected to the stylus, the ADC value is further read to determine the type of the detachable module according to the ADC value. Furthermore, the corresponding data path formed by the data transmission pins can be switched according to the type of the detachable module, so that the stylus can use the detachable module. The stylus provided in this application has a detachable module and can automatically identify the type of the connected detachable module, so that the user can independently select the type of the detachable module according to their own needs, reducing the integration pressure of the main board components, enriching the functions of the stylus, effectively solving the defects of the stylus in terms of space, weight, and function expansion methods, broadening the market prospect of the stylus, and meeting the ever-changing usage needs of users. Description of the Drawings

[0054] The drawings here are incorporated into the specification and form a part of this specification, showing embodiments consistent with this application and used together with the specification to explain the principles of this application.

[0055] Figure 1 It is a schematic flowchart of the stylus control method provided in this application;

[0056] Figure 2 It is a schematic wiring diagram of some pins of the stylus provided in this application;

[0057] Figure 3 It is a schematic interaction flowchart between the stylus and the detachable module when the detachable module provided in this application is a camera;

[0058] Figure 4 It is a schematic interaction flowchart between the stylus and the detachable module when the detachable module provided in this application is a microphone;

[0059] Figure 5 It is a schematic interaction flowchart between the stylus and the detachable module when the detachable module provided in this application is a mouse or a keyboard;

[0060] Figure 6 It is a schematic interaction flowchart between the stylus and the detachable module when the detachable module provided in this application is a sensor;

[0061] Figure 7 It is a schematic interaction flowchart between the stylus and the detachable module when the detachable module provided in this application is a flashlight or a fan;

[0062] Figure 8 It is a schematic structural diagram of the control device for the stylus provided in this application;

[0063] Figure 9 Schematic diagram of the electronic device provided by this application.

[0064] Through the above-mentioned drawings, specific embodiments of this application have been shown, and there will be more detailed descriptions hereinafter. These drawings and textual descriptions are not intended to limit the scope of the concept of this application in any way, but to illustrate the concept of this application to those skilled in the art by referring to specific embodiments. Detailed implementation manners

[0065] Here, exemplary embodiments will be described in detail, and examples are shown in the drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementation manners described in the following exemplary embodiments do not represent all implementation manners consistent with this application. On the contrary, they are merely examples of devices and methods consistent with some aspects of this application as detailed in the appended claims.

[0066] For the styluses currently launched by various manufacturers, due to the limited space in the pen body, the integration degree of the components on the main board is already very high. Usually, only small-package chips can be used to reduce the position of the components, but this is limited by the design of the chip supplier. There may be a need for a chip, but there is no suitable package size for the chip to place the main board of the stylus. Therefore, if more functions are to be integrated at the pen end, there are quite challenges in the component design of the main board and the control of the pen-end weight. In addition, once the stylus is launched on the market, its functions are already determined. If new functions are to be expanded, only new styluses can be launched. Therefore, it is difficult to expand new functions without increasing the hardware design.

[0067] Combined with the above description, it can be seen that in the prior art, the stylus faces technical problems such as limited space and weight and fixed functions.

[0068] For the control method and device of the stylus provided by this application, the stylus is provided with connection points of a contact connector, and the connection points of the contact connector include data transmission pins and an identity pin ID PIN. By polling and reading the level value of the ID PIN, it can be determined whether a detachable module is connected to the stylus. When it is determined that a detachable module is connected to the stylus, the type of the detachable module can be automatically identified, and the corresponding data path can be switched according to the type of the detachable module, so that the stylus can use the detachable module. It can be seen that the stylus provided by this application has a detachable module, can automatically identify the type of the connected detachable module, and users can independently select the type of the detachable module according to their own needs. This not only reduces the integration pressure of the components on the main board, but also enriches the functions of the stylus, effectively solves the defects of the stylus in terms of space, weight, and function expansion method, broadens the market prospect of the stylus, and meets the changing usage needs of users.

[0069] The following uses specific embodiments to elaborate in detail on the technical solution of the present application and how the technical solution of the present application solves the above technical problems. The following several specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0070] Figure 1 It is a schematic flowchart of the stylus control method provided by the present application. As Figure 1 shown, the method includes:

[0071] S101. When the ID PIN is configured as an input pull-up, poll and read the level value of the ID PIN.

[0072] The stylus control method provided by the embodiments of the present application can be executed by a processor configured in the stylus. The processor can be executed by, for example, a microcontroller unit (MCU for short).

[0073] Referring to Figure 2 the schematic diagram of the wiring of some pins of the stylus shown, connection points of a contact connector (pogopin) are provided on the stylus. The connection points of the contact connector include data transmission pins and an identity pin (ID PIN). Among them, the data transmission pins are used to form a data path so that the detachable module on the stylus and the stylus can interact.

[0074] In some embodiments, the data transmission pins can be, for example, pins such as DATA1 and DATA2. DATA1 and DATA2 can form multiple different corresponding data paths through a multiplexed data transmission interface. The data transmission interface is provided on the stylus.

[0075] In some embodiments, the data transmission interface can be, for example, one or more of a USB (Universal Serial Bus) interface, a UART (Universal Asynchronous Receiver / Transmitter) interface, and an IIC (Inter-Integrated Circuit) interface. Figure 2 Three cases of the data transmission interface are shown by taking the D+ / D- of the USB interface, the TX / RX of the UART interface, and the SCL / SDA of the IIC interface as examples.

[0076] Optionally, the connection points of the contact connector further include a ground pin such as Figure 2 GND in

[0077] The connection points of the contact connector include an identity pin (ID PIN). The stylus determines whether a detachable module is connected by the level value of the ID PIN. Specifically, when the ID PIN of the stylus is configured as an input pull-up, the MCU polls and reads the level value of the ID PIN.

[0078] S102: Determine whether the level value of the read ID PIN is a first preset level.

[0079] Assume that the first preset level is a high level. Then determine whether the level value of the read ID PIN is not a high level. After judgment, if it is not a high level, that is, not the first preset level, it means that a detachable module is currently connected to the stylus, and step S103 is executed; on the contrary, after judgment, if it is the first preset level, that is, a high level, it means that no detachable module is currently connected to the stylus, and continue to poll and read the level value of the ID PIN, that is, execute step S101.

[0080] In some embodiments, the connection of the detachable module to the stylus can be achieved by establishing a communication connection between the two, or the detachable module can be mechanically connected to the stylus, such as insertion, etc. The embodiments of the present application do not limit this.

[0081] S103: Read the ADC value and determine the type of the detachable module according to the ADC value.

[0082] Refer to Figure 2 As shown, different detachable modules have different resistance values R1 and R2, so the input voltage of the ID PIN port is different. Therefore, when it is determined according to the level value of the ID PIN that a detachable module is connected to the stylus, the IDPIN of the MCU of the stylus is configured as an input of an analog-to-digital converter (ADC), that is, it switches from reading the level value of the ID PIN to reading the ADC value through the ADC interface, and the type of the connected detachable module is distinguished according to the read ADC value.

[0083] In some embodiments, the detachable module can be one or several of a camera, a microphone, a mouse, a keyboard, a sensor, a flashlight, and a fan.

[0084] Optionally, the sensor can include one or more of an accelerometer and gyroscope sensor (A+G sensor), a magnetometer sensor (M sensor), a proximity sensor (Sar sensor), a Hall sensor, a UWB (Ultra-Wideband) sensor, and an infrared sensor.

[0085] Optionally, the stylus can be connected to one detachable module at the same time, or can be connected to multiple detachable modules at the same time. The control method of the stylus provided by the embodiments of the present application can identify the connection or disconnection of each detachable module.

[0086] S104: Switch the corresponding data path according to the type of the detachable module.

[0087] For different types of detachable modules, different communication protocols may be required, so the corresponding data paths are different. Or some detachable modules do not require a data path. The data path is, for example, a USB data path implemented through a USB interface, or a UART data path implemented through a UART interface, or an IIC data path implemented through an IIC interface, etc.

[0088] Therefore, after determining the type of the detachable module, switch the corresponding data path that conforms to the communication protocol of the currently connected detachable module, so that the stylus and the detachable module interact through the data path.

[0089] In some embodiments, as Figure 2 shown, the stylus may further include a switch chip (such as Figure 2 Switch shown in). The switch chip is respectively connected to the data transmission interfaces of the contact connectors, and is used to switch the data transmission interfaces to switch the data paths.

[0090] For example, the switch chip can control DATA1 and DATA2 multiplexed data transmission interfaces through IO1 / IO2 to form a data path corresponding to the multiplexed data transmission interface. In other words, D+ / D- of USB, TX / RX of UART, and SCL / SDA of IIC are all directly connected to the switch chip, and which path can be conducted to the pins of DATA1 and DATA2 of the contact connector is controlled by IO1 / IO2 of the switch chip.

[0091] It should be noted that some detachable modules can interact with the stylus without the above data transmission interfaces, such as flashlights, fans, etc.

[0092] S105: Output a target voltage to supply power to the detachable module.

[0093] After switching the data path corresponding to the detachable module, output a target voltage to supply power to the detachable module.

[0094] Referring to Figure 2 shown, the connection points of the contact connector may further include connection points of the voltage bus (abbreviated as VBUS). VBUS can step down the voltage for the detachable module according to its power supply requirements.

[0095] Optionally, if the MCU of the stylus supports the output of the target voltage, for example, it can be directly output from the MCU. If it does not support, the stylus can also include a boost circuit connected to the connection point of VBUS and is powered by the boosted voltage.

[0096] In some embodiments, the target voltage can be 5V, for example.

[0097] S106: Enable the function of the detachable module.

[0098] After powering the detachable module, the stylus can enable the function of the detachable module, and there can be an interaction between the detachable module and the stylus. Taking the camera as an example of the detachable module, the stylus sends a shooting request to the camera, and the camera responds to the shooting request to collect an image and then send it back to the stylus, etc. The camera is used to shoot images.

[0099] In summary, the stylus determines whether there is a detachable module connected by polling the level value of the ID PIN, and then switches the ID PIN to the ADC interface to read the level and read the ADC value. Since the resistance values of different types of detachable modules are different, the ADC values read are different, that is, there is a corresponding relationship between the ADC value and the type of the detachable module, so that the type of the detachable module can be distinguished according to the read ADC value. And switch the corresponding data path, so that there can be an interaction between the stylus and the detachable module, completing the automatic recognition of the detachable module connected to the stylus.

[0100] Further, it further includes:

[0101] S107: Determine whether the level value of the read ID PIN is the second preset level.

[0102] After step S106, further, when the first preset level is a high level and the second preset level is different from the first preset level, the second preset level is a low level. Poll and judge the level value of the read ID PIN to determine whether it is the second preset level. After judgment, if it is, that is, it is not the first preset level, it means that the connected detachable module has not been disconnected from the stylus, and continue to execute step S101; otherwise, if it is not, that is, it is the first preset level, that is, it is not the second preset level, it means that the connected detachable module has been disconnected from the stylus, and then execute step S108.

[0103] S108: Determine that the detachable module is disconnected from the stylus, stop powering the detachable module and close the data path.

[0104] After determining that the detachable module is disconnected from the stylus, close the output of the target voltage, and configure IO1 / IO2 to close the data path corresponding to the current detachable module formed by DATA1 and DATA2.

[0105] In some embodiments, the disconnection of the detachable module from the stylus may be to disconnect the communication connection established during access, or to disconnect the mechanical connection between the two, such as pulling out, etc. The embodiments of the present application do not limit this.

[0106] Thus, steps S107 and S108 achieve the automatic recognition of the disconnection between the detachable module and the stylus.

[0107] As can be seen from the description of the above embodiments, the stylus provided by the embodiments of the present application has a detachable module, and the control method of the stylus can achieve the automatic recognition of the access and disconnection of the detachable module from the stylus. Thereby, the user can independently select the type of the detachable module according to their own needs, reducing the integration pressure of the main board layout, enriching the functions of the stylus, effectively solving the defects of the stylus in terms of space, weight, and function expansion method, broadening the market prospect of the stylus, and meeting the changing usage needs of users.

[0108] Figure 3 It is a schematic diagram of the interaction process between the detachable module provided by the present application and the stylus when the detachable module is a camera. As Figure 3 shown, when the camera is connected to the stylus, the stylus can recognize that a detachable module is connected by reading the level value of the ID PIN, and switches to read the ADC value to recognize that the connected detachable module is a camera. Then, the MCU of the stylus controls the D+ / D- of the USB to conduct with DATA1 and DATA2 through IO1 / IO2 to form a data path corresponding to the USB interface. The MCU of the stylus powers the camera, and the camera powers on and works. In the interaction between the stylus and the camera, if the stylus sends a shooting request to the camera, such as sending a shooting request to the camera through a button or other means, the camera responds to the shooting request, captures an image, and returns it to the stylus through the data path corresponding to the USB interface. The stylus can forward the image to a smart terminal paired with the stylus, such as a tablet or a mobile phone, through Bluetooth or other means, so that the image can be displayed on the smart terminal. Among them, if the camera is disconnected from the stylus, the interaction between the stylus and the camera ends. If the connection with the camera is not disconnected, the interaction between the camera and the stylus continues.

[0109] Figure 4 It is a schematic diagram of the interaction process between the detachable module provided by the present application and the stylus when the detachable module is a microphone. As Figure 4As shown, when a microphone is connected to the stylus, the stylus can identify that a detachable module is connected by reading the level value of the ID PIN, and then switches to read the ADC value to identify that the connected detachable module is a microphone. Subsequently, the MCU of the stylus controls the D+ / D- of the USB to conduct with DATA1 and DATA2 through IO1 / IO2 to form the data path corresponding to the USB interface. The MCU of the stylus powers the microphone, and the microphone powers on and works. In the interaction between the stylus and the microphone, if the stylus initiates a collection request to the microphone, such as by pressing a button or other means, the microphone responds to the collection request, collects the voice, and transmits it back to the stylus through the data path corresponding to the USB interface. The stylus can forward the voice to a smart terminal paired with the stylus, such as a tablet or a mobile phone, via Bluetooth or other means, enabling the voice to be applied on the smart terminal. Among them, if the microphone is disconnected from the stylus, the interaction between the stylus and the microphone ends. If they are not disconnected, the interaction between the microphone and the stylus continues.

[0110] Figure 5 The following is a schematic diagram of the interaction process between the detachable module provided by this application, which is a mouse or a keyboard, and the stylus. As Figure 5 shown, when a mouse or a keyboard is connected to the stylus, the stylus can identify that a detachable module is connected by reading the level value of the ID PIN, and then switches to read the ADC value to identify that the connected detachable module is a mouse or a keyboard. Subsequently, the MCU of the stylus controls the D+ / D- of the USB to conduct with DATA1 and DATA2 through IO1 / IO2 to form the data path corresponding to the USB interface. The MCU of the stylus powers the mouse or the keyboard, and the mouse or the keyboard powers on and works. In the interaction between the stylus and the mouse or the keyboard, if the mouse or the keyboard collects the input information of the user, the mouse or the keyboard transmits the input information back to the stylus through the data path corresponding to the USB interface. The stylus can forward the input information to a smart terminal paired with the stylus, such as a tablet or a mobile phone, via Bluetooth or other means, enabling the input information to be applied on the smart terminal. Among them, if the mouse or the keyboard is disconnected from the stylus, the interaction between the stylus and the mouse or the keyboard ends. If they are not disconnected, the interaction between the mouse or the keyboard and the stylus continues.

[0111] Figure 6 The following is a schematic diagram of the interaction process between the detachable module provided by this application, which is a sensor, and the stylus. As Figure 6As shown in the figure, when the sensor is connected to the stylus, the stylus can identify that a detachable module is connected by reading the level value of the ID PIN, and then switches to read the ADC value to identify that the connected detachable module is a sensor, and can determine the specific type of the sensor. Furthermore, the MCU of the stylus controls the SCL / SDA of the IIC to conduct with DATA1 and DATA2 through IO1 / IO2 to form a data path corresponding to the IIC interface. The MCU of the stylus powers the sensor, and the sensor powers on and works. In the interaction between the stylus and the sensor, the stylus can actively read the data of the sensor, or perform corresponding response actions according to the read data, or forward the read data to a smart terminal paired with the stylus, such as a tablet or a mobile phone, so that the data can be applied on the smart terminal. Among them, if the sensor is disconnected from the stylus, the interaction between the stylus and the sensor ends. If it is not disconnected from the sensor, the interaction between the sensor and the stylus continues.

[0112] Figure 7 The following is a schematic diagram of the interaction process between the detachable module provided by this application, which is a flashlight or a fan, and the stylus. As Figure 7 shown in the figure, when the flashlight or the fan is connected to the stylus, the stylus can identify that a detachable module is connected by reading the level value of the ID PIN, and then switches to read the ADC value to identify that the connected detachable module is a flashlight or a fan. The MCU of the stylus powers the flashlight or the fan, and the flashlight or the fan powers on and works, the flashlight lights up or the fan starts to rotate. If the flashlight or the fan is disconnected from the stylus, the interaction between the stylus and the flashlight or the fan ends. If it is not disconnected from the flashlight or the fan, the interaction between the flashlight or the fan and the stylus continues.

[0113] It should be noted that Figures 3 to 7 This is only a schematic example of the interaction between the detachable module, which is a camera, a microphone, a mouse, a keyboard, a sensor, a flashlight or a fan, and the stylus, and is not a limitation on the type of the detachable module.

[0114] Optionally, the stylus described in each of the above embodiments may also be an active stylus.

[0115] Figure 8 The following is a schematic diagram of the control device structure of the stylus provided by this application. The stylus is provided with connection points of a contact connector, and the connection points of the contact connector include data transmission pins and an identity pin ID PIN. As Figure 8 shown in the figure, the control device 40 of the stylus provided in this embodiment includes:

[0116] A first reading module 401, configured to poll and read the level value of the ID PIN when the ID PIN is configured as an input pull-up;

[0117] The second reading module 402 is configured to read the ADC value when it is determined that the detachable module is connected to the stylus according to the level value of the ID PIN.

[0118] The processing module 403 is configured to determine the type of the detachable module according to the ADC value, so as to switch the corresponding data path according to the type of the detachable module, enable the function of the detachable module of the stylus, and the data transmission pin is used to form the data path.

[0119] In a possible implementation manner, the data transmission pins include the pins of DATA1 and DATA2;

[0120] DATA1 and DATA2 form the corresponding data path through the multiplexed data transmission interface, and the data transmission interface is arranged on the stylus.

[0121] In a possible implementation manner, the data transmission interface includes at least one of a USB interface, a UART interface, and an IIC interface.

[0122] In a possible implementation manner, the stylus further includes:

[0123] A switch chip, which is respectively connected to the contact connector and the data transmission interface, and is used to switch the data transmission path.

[0124] In a possible implementation manner, the connection points of the contact connector further include: the connection point of the voltage bus VBUS;

[0125] VBUS is used to step down the voltage for the detachable module.

[0126] In a possible implementation manner, if the stylus does not support the output of the target voltage, the stylus further includes a boost circuit connected to the connection point of VBUS.

[0127] In a possible implementation manner, the processing module 403 is further configured to:

[0128] Output the target voltage to supply power to the detachable module.

[0129] In a possible implementation manner, the processing module 403 is further configured to:

[0130] If it is determined that the level value of the ID PIN is not the first preset level, it is determined that the detachable module is connected to the stylus.

[0131] In a possible implementation manner, the processing module 403 is further configured to:

[0132] If it is determined that the level value of the ID PIN is not the second preset level, it is determined that the detachable module is disconnected from the stylus, and the first preset level is different from the second preset level.

[0133] In a possible implementation manner, the processing module 403 is further configured to: stop power supply to the detachable module and close the data path.

[0134] In a possible implementation manner, the detachable module includes one or more of a camera, a microphone, a mouse, a keyboard, a sensor, a flashlight, and a fan.

[0135] In a possible implementation manner, the sensor includes one or more of an accelerometer, a gyroscope sensor, a magnetometer sensor, a proximity sensor, a Hall sensor, a UWB sensor, and an infrared sensor.

[0136] The control device of the stylus provided in this embodiment can execute the method provided in the above method embodiment. The implementation principle and technical effects are similar, and will not be elaborated here in this embodiment.

[0137] Figure 9 It is a schematic structural diagram of the electronic device provided in this application. As Figure 9 shown, the electronic device 50 provided in this embodiment includes: at least one processor 501 and a memory 502. Optionally, the electronic device 50 further includes a communication component 503. Among them, the processor 501, the memory 502, and the communication component 503 are connected through a bus.

[0138] In the specific implementation process, at least one processor 501 executes the computer execution instructions stored in the memory 502, so that at least one processor 501 executes the above method.

[0139] The specific implementation process of the processor 501 can refer to the above method embodiment. The implementation principle and technical effects are similar, and will not be elaborated here in this embodiment.

[0140] In the above Figures 1 to 8 In the shown embodiment, the processor is described and illustrated by taking the MCU as an example. It should be understood that the processor may also be a central processing unit (English: Central Processing Unit, abbreviated: CPU), and may also be other general-purpose processors, digital signal processors (English: Digital Signal Processor, abbreviated: DSP), application specific integrated circuits (English: Application Specific Integrated Circuit, abbreviated: ASIC), etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in combination with the invention can be directly embodied as being executed by a hardware processor, or executed by a combination of hardware and software modules in the processor.

[0141] The memory may include a high-speed memory (Random Access Memory, RAM), and may also include a non-volatile memory (Non-volatile Memory, NVM), such as at least one disk memory.

[0142] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the buses in the drawings of this application are not limited to only one bus or one type of bus.

[0143] This application also provides a computer program product, including a computer program which, when executed by a processor, implements the above method.

[0144] This application also provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the above method.

[0145] The above-readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as a static random access memory (SRAM), an electrically erasable programmable read-only memory (EEPROM), an erasable programmable read-only memory (EPROM), a programmable read-only memory (PROM), a read-only memory (ROM), a magnetic memory, a flash memory, a magnetic disk or an optical disk. The readable storage medium can be any available medium accessible by a general-purpose or special-purpose computer.

[0146] An exemplary readable storage medium is coupled to the processor, enabling the processor to read information from and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can be located in an Application Specific Integrated Circuit (ASIC). Of course, the processor and the readable storage medium can also exist as discrete components in a device.

[0147] The division of units is merely a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the couplings or direct couplings or communication connections shown or discussed among each other can be indirect couplings or communication connections through some interfaces, devices or units, and can be in electrical, mechanical or other forms.

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

[0149] In addition, in each embodiment of the present invention, the functional units can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit.

[0150] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods in each embodiment of the present invention. And the aforementioned storage medium includes: USB flash drives, mobile hard disks, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), magnetic disks or optical discs and other various media that can store program codes.

[0151] Those of ordinary skill in the art can understand that all or part of the steps of implementing the above method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When this program is executed, it executes the steps including the above method embodiments; and the aforementioned storage medium includes: ROM, RAM, magnetic disks or optical discs and other various media that can store program codes.

[0152] Finally, it should be noted that those skilled in the art will readily conceive of other embodiments of the present invention after considering the specification and practicing the invention disclosed herein. The present invention is intended to cover any variations, uses, or adaptations of the present invention, which follow the general principles of the present invention and include well-known common general knowledge or conventional technical means in the technical field not disclosed by the present invention. It is not limited to the exact structures described above and shown in the drawings, and various modifications and changes can be made without departing from its scope. The scope of the present invention is only limited by the appended claims.

Claims

1. A control method for a stylus, characterized in that, The stylus is provided with connection points of a contact connector, and the connection points of the contact connector include data transmission pins and an identity pin ID PIN; the method includes: When the ID PIN is configured as input pull-up, polling and reading the level value of the ID PIN; When it is determined that the detachable module is connected to the stylus according to the level value of the ID PIN, reading the ADC value; Determining the type of the detachable module according to the ADC value, so as to switch the corresponding data path according to the type of the detachable module, enabling the function of the detachable module by the stylus, and the data transmission pins are used to form the data path.

2. The method according to claim 1, wherein The data transmission pins include pins of DATA1 and DATA2; The DATA1 and DATA2 form the corresponding data path through a multiplexed data transmission interface, and the data transmission interface is arranged on the stylus.

3. The method according to claim 2, wherein The data transmission interface includes at least one of a USB interface, a UART interface, and an IIC interface.

4. The method according to claim 3, characterized in that, The stylus further includes: A switch chip, which is respectively connected to the contact connector and the data transmission interface, and is used to switch the data path.

5. The method according to claim 1, wherein The connection points of the contact connector further include: connection points of a voltage bus VBUS; The VBUS is used to step down the voltage for the detachable module.

6. The method according to claim 5, wherein If the stylus does not support the output of the target voltage, the stylus further includes a boost circuit connected to the connection point of the VBUS.

7. The method according to claim 5 or 6, characterized in that, After switching the corresponding data path according to the type of the detachable module, it further includes: Outputting a target voltage to supply power to the detachable module.

8. The method according to claim 1, wherein After polling and reading the level value of the ID PIN, the method further includes: If it is determined that the level value of the ID PIN is not the first preset level, determining that the detachable module is connected to the stylus.

9. The method according to claim 8, wherein After polling and reading the level value of the ID PIN, the method further includes: If it is determined that the level value of the ID PIN is not the second preset level, determining that the detachable module is disconnected from the stylus, and the first preset level is different from the second preset level.

10. The method according to claim 9, wherein After determining that the detachable module is disconnected from the stylus, the method further includes: stopping supplying power to the detachable module, and closing the data path.

11. The method according to claim 1, wherein The detachable module includes one or more of a camera, a microphone, a mouse, a keyboard, a sensor, a flashlight, and a fan.

12. The method according to claim 11, characterized in that, The sensor includes one or more of an accelerometer and gyroscope sensor, a magnetometer sensor, a proximity sensor, a Hall sensor, a UWB sensor, and an infrared sensor.

13. A control device for a stylus, characterized in that, The stylus is provided with connection points of a contact connector, and the connection points of the contact connector include data transmission pins and an identity pin ID PIN; the device includes: A first reading module, which is used to poll and read the level value of the ID PIN when the ID PIN is configured as input pull-up; A second reading module, which is used to read the ADC value when it is determined that the detachable module is connected to the stylus according to the level value of the ID PIN; A processing module, configured to determine the type of the detachable module according to the ADC value, so as to switch a corresponding data path according to the type of the detachable module, enabling the stylus to enable the function of the detachable module, where the data transmission pins are used to form the data path.

14. An electronic device, characterized in that, Comprising: A memory and a processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory, so that the processor executes the method according to any one of claims 1-12.

15. A computer-readable storage medium, characterized in that, Computer-executable instructions are stored in the computer-readable storage medium, and when the computer-executable instructions are executed by a processor, they are used to implement the method according to any one of claims 1-12.

16. A computer program product, characterized in that, Comprising a computer program, which implements the method according to any one of claims 1-12 when executed by a processor.