A switching method for an electronic pen, the electronic pen, and the electronic device.

CN115309276BActive Publication Date: 2026-09-01HUAWEI TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210785098.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-05
Publication Date
2026-09-01
Estimated Expiration
2042-07-05

AI Technical Summary

Technical Problem

然而,目前的电子笔在触摸屏上使用时,通常只通过电子笔的一端来实现比较单一的书写和点击等输入功能,电子笔的实用性不高

Benefits of technology

[0073]可以理解地,上述提供的第三方面及其任一种可能的实现的电子笔的切换装置,第五方面的电子笔,第七方面的系统,第八方面的电子设备,第九方面的计算机存储介质以及第十一方面的计算机程序产品所能达到的有益效果,可参考第一方面及其任一种可能的实现方式中的有益效果,上述提供的第四方面及其任一种可能的实现的电子笔的切换装置,第六方面的电子设备,第七方面的系统,第八方面的电子设备,第十方面的计算机存储介质以及第十一方面的计算机程序产品所能达到的有益效果,可参考第二方面及其任一种可能的实现方式中的有益效果,此处不再赘述。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115309276B_ABST
    Figure CN115309276B_ABST
Patent Text Reader

Abstract

This application discloses a switching method for an electronic pen, an electronic pen, and an electronic device, relating to the field of terminal technology. The electronic pen can accurately identify whether it is in a tip-operated state or a tail-operated state by utilizing acceleration values ​​detected by a sensor within the pen, thereby accurately realizing the tip-operated and tail-operated functions of the electronic pen. In this solution, the electronic pen is communicatively connected to the electronic device. The electronic pen includes a sensor for detecting the acceleration of the electronic pen. If the acceleration of the electronic pen meets a first acceleration condition, the electronic pen can determine that it is in a tail-operated state and can send this tail-operated state to the electronic device to instruct the electronic device to enter the tail-operated function mode. If the acceleration of the electronic pen meets a second acceleration condition, the electronic pen can determine that it is in a tip-operated state and can send this tip-operated state to the electronic device to instruct the electronic device to enter the tip-operated function mode.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of terminal technology, and in particular to a switching method for an electronic pen, an electronic pen, and an electronic device. Background Technology

[0002] With the widespread use of smartphones, tablets, and other electronic devices, touchscreen and touch display technologies have also become widely adopted. Typically, users input data by touching the touchscreen with their body, such as their fingers, or with an electronic pen. An electronic pen consists of a tip and a stylus. However, currently, when using electronic pens on touchscreens, they usually only utilize one end for basic writing and clicking functions, limiting their practicality. Summary of the Invention

[0003] This application provides a method for switching electronic pens, an electronic pen, and an electronic device. It can accurately identify which end of the electronic pen, the tail end or the tip end, is in contact with the screen by using the acceleration value detected by the sensor inside the electronic pen. This enables the accurate implementation of the tip and tail end functions of the electronic pen, thereby improving the user experience.

[0004] To achieve the above objectives, this application adopts the following technical solution:

[0005] Firstly, this application provides a switching method for an electronic pen, which can be applied to an electronic pen. The electronic pen is communicatively connected to an electronic device, and the electronic pen may include a sensor for detecting the acceleration of the electronic pen. The switching method for the electronic pen includes:

[0006] When the acceleration of the electronic pen meets the first acceleration condition, the electronic pen determines that it is in the pen tail working state and sends the pen tail working state to the electronic device to instruct the electronic device to enter the pen tail function mode.

[0007] or,

[0008] When the acceleration of the electronic pen meets the second acceleration condition, the electronic pen determines that it is in the pen tip working state and sends the pen tip working state to the electronic device to instruct the electronic device to enter the pen tip function mode.

[0009] The solution provided in the first aspect above allows the electronic pen to detect acceleration values ​​from its internal sensors when the user points the pen towards the screen with either the tip or the end of the pen. These acceleration conditions satisfy different conditions, allowing the electronic pen to determine whether it is currently in tip or end-of-pen mode. When the electronic pen determines it is in tip mode, it transmits this information to a connected electronic device, instructing the device to enter the corresponding tip function mode. Similarly, when it determines it is in end-of-pen mode, it transmits this information to the connected device, instructing it to enter the corresponding end-of-pen function mode. Thus, the electronic pen can accurately identify which end of the pen—the tip or the end—is in contact with the screen using the acceleration values ​​detected by its internal sensors, thereby accurately implementing both tip and end-of-pen functions.

[0010] In one possible implementation, the aforementioned acceleration can be an acceleration along a first axis parallel to the pen's body. Thus, the pen can identify whether its tip or the end is facing the screen solely based on the acceleration value detected by sensors within the pen itself, resulting in short computation time and high real-time performance.

[0011] Alternatively, the aforementioned acceleration can be the acceleration calculated jointly along multiple axes, including the first axis mentioned above. In this way, the electronic pen can integrate the acceleration values ​​detected by its internal sensors along multiple axes to identify whether the pen's tip or the end is currently facing the screen, thus improving recognition accuracy.

[0012] In one possible implementation, the first acceleration condition and the second acceleration condition can be set using either a first setting strategy or a second setting strategy. In the first setting strategy, the first acceleration condition includes: acceleration greater than a first threshold; the second acceleration condition includes: acceleration less than a second threshold, where the second threshold is equal to or less than the first threshold. In the second setting strategy, the first acceleration condition includes: acceleration less than a second threshold; the second acceleration condition includes: acceleration greater than a first threshold, where the second threshold is equal to or less than the first threshold.

[0013] Because different electronic pens may have sensors positioned differently, the first or second acceleration condition satisfied by the sensors may also differ when the pen's tail or tip faces the screen. Therefore, optionally, this application can select a matching setting strategy from the first and second setting strategies described above, based on the sensor's orientation, to set the first and second acceleration conditions.

[0014] In one possible implementation, when the positive direction of the first axis of the sensor inside the electronic pen is aligned with the direction from the tip of the pen to the tail, the aforementioned first acceleration condition and second acceleration condition can be set using a first setting strategy. It is understood that the orientation of the electronic pen inside is usually fixed after it leaves the factory; that is, during the use of the electronic pen, the aforementioned first acceleration condition and second acceleration condition are usually set using the first setting strategy.

[0015] In one possible implementation, when the positive direction of the first axis of the sensor inside the electronic pen is aligned with the direction from the end of the pen to the tip, the aforementioned first and second acceleration conditions can be set using a second setting strategy. It is understood that the orientation of the sensor inside the electronic pen is usually fixed after it leaves the factory; that is, during the use of the electronic pen, the aforementioned first and second acceleration conditions are usually set using the second strategy. In other words, if the orientation of the sensor inside the electronic pen is reversed, the settings of the aforementioned first and second acceleration conditions will also be reversed.

[0016] Since the first acceleration condition or the second acceleration condition satisfied by the sensor inside the electronic pen may differ depending on whether the electronic pen is used with the screen facing up or with the screen facing down, this application may optionally select a matching setting strategy from the first setting strategy and the second setting strategy to set the first acceleration condition and the second acceleration condition according to the screen state of the electronic device.

[0017] In one possible implementation, when the positive direction of the first axis of the sensor within the electronic pen is aligned with the direction from the pen tip to the pen tail, during use of the electronic pen, if the screen of the electronic device is facing upwards, the electronic pen can set the aforementioned first and second acceleration conditions using a first setting strategy. If the screen of the electronic device is facing downwards, the electronic pen can set the aforementioned first and second acceleration conditions using a second setting strategy. That is, when the screen of the electronic device is inverted, the settings of the aforementioned first and second acceleration conditions will also be reversed.

[0018] In one possible implementation, when the positive direction of the first axis of the sensor within the electronic pen is aligned with the direction from the end of the pen to the tip, during use of the electronic pen, if the screen of the electronic device is facing upwards, the electronic pen can set the aforementioned first and second acceleration conditions using a second setting strategy. If the screen of the electronic device is facing downwards, the electronic pen can set the aforementioned first and second acceleration conditions using a first setting strategy. That is, when the screen of the electronic device is inverted, the settings of the aforementioned first and second acceleration conditions will also be reversed.

[0019] In one possible implementation, the aforementioned sensor is also used to detect the angle information of the electronic pen, including tilt angle and / or rotation angle. After sending the pen tail working status to the electronic device, the switching method of the electronic pen further includes:

[0020] Based on the angle change value of the angle information, the electronic device is instructed to adjust the pen tail function parameters corresponding to the pen tail function mode, where the angle change value is greater than the preset angle threshold.

[0021] Alternatively, after sending the pen tip's operating status to the electronic device, the switching method for the electronic pen may also include:

[0022] Based on the angle change value of the angle information, the electronic device is instructed to adjust the pen tip function parameters corresponding to the pen tip function mode, where the angle change value is greater than the preset angle threshold.

[0023] Thus, the electronic pen monitors changes in its tilt or rotation angle in real time to instruct the electronic device to adjust the parameters of the pen tip or pen tail function. Furthermore, this application improves the accuracy of parameter adjustment by setting preset thresholds for changes in the tilt or rotation angles to prevent the electronic device from erroneously adjusting the parameters of the pen tip or pen tail function. Therefore, when using the pen tip or pen tail function, the user can adjust the parameters of that function by adjusting the pen's tilt or rotation angle.

[0024] Since the tilt angle or rotation angle of the electronic pen may change unintentionally during movement, the electronic device should not adjust the parameters of the pen tip or pen tail function in this case. Therefore, optionally, this application can reasonably increase the preset threshold value of the change value of the tilt angle or rotation angle to avoid the electronic device accidentally adjusting the parameters of the pen tip or pen tail function during the movement of the electronic pen.

[0025] In one possible implementation, before adjusting the pen tip or pen tail function parameters, the electronic pen switching method further includes detecting that the electronic pen's sliding speed is less than a preset speed threshold. Thus, when the electronic pen's sliding speed is relatively high, the electronic device will not adjust the pen tip or pen tail function parameters, avoiding the possibility of the electronic device mistakenly adjusting these parameters during the pen's movement.

[0026] In one possible implementation, the aforementioned angle change value is the angle difference between the current angle and the initial angle of the electronic pen.

[0027] Optionally, the initial angle can be the angle of the electronic pen when it contacts the screen of the electronic device. In this way, the electronic pen will monitor the initial angle of the electronic pen when either end of the electronic pen contacts the screen of the electronic device, so that the electronic device can adjust the parameters of the pen tip function or pen tail function according to the relative angle change with respect to the initial angle when in contact with the screen.

[0028] Optionally, the initial angle can also be the angle of the electronic pen when the sliding speed of the electronic pen on the screen of the electronic device is less than a preset speed threshold. In this way, the electronic pen will monitor the angle of the electronic pen when the sliding speed of the electronic pen on the screen of the electronic device is less than the preset speed threshold, and use this angle as the new initial angle. Thus, the electronic device can adjust the parameters of the pen tip function or pen tail function according to the relative angle change with respect to this new initial angle.

[0029] In one possible implementation, the above-mentioned instruction to the electronic device to adjust the pen tail function parameters corresponding to the pen tail function mode based on the angle change value of the angle information includes: instructing the electronic device to adjust the pen tail function parameters corresponding to the pen tail function mode based on the angle change value of the angle information and the preset correspondence between the angle change value and the pen tail function parameter change value.

[0030] Alternatively, the aforementioned method of instructing the electronic device to adjust the pen tip function parameters corresponding to the pen tip function mode based on the angle change value of the angle information includes: instructing the electronic device to adjust the pen tip function parameters corresponding to the pen tip function mode based on the angle change value of the angle information and a preset correspondence between the angle change value and the pen tip function parameter change value. In this way, the electronic pen can pre-store the correspondence between the angle change value and the pen tip function parameter change value, or the correspondence between the angle change value and the pen tip function parameter change value, so that the electronic pen can determine the parameter change corresponding to the current angle change value through this pre-stored correspondence.

[0031] In one possible implementation, the pen tail function mode is an eraser mode, and the pen tail function parameters include eraser radius and / or eraser opacity. Based on the angle change value of the angle information, the electronic device is instructed to adjust the pen tail function parameters corresponding to the pen tail function mode, including: based on the angle change value of the tilt angle, instructing the electronic device to adjust the eraser radius; and / or based on the angle change value of the rotation angle, instructing the electronic device to adjust the eraser opacity.

[0032] Alternatively, the electronic device can be instructed to adjust the eraser radius based on the change in rotation angle; and / or to adjust the eraser opacity based on the change in tilt angle. Thus, when using the end of the stylus to perform the eraser function, the user can adjust the eraser radius or opacity by adjusting the stylus's tilt or rotation angle.

[0033] In one possible implementation, the pen tail function mode is a screenshot mode. The pen tail function parameters include the radius of the screenshot area. Based on the angle change value of the angle information, the electronic device is instructed to adjust the pen tail function parameters corresponding to the pen tail function mode. This includes: adjusting the radius of the screenshot area based on the angle change value of the tilt angle; or, adjusting the radius of the screenshot area based on the angle change value of the rotation angle. Thus, when a user uses the pen tail to perform a screenshot function, they can adjust the screenshot radius by adjusting the tilt angle or rotation angle of the electronic pen.

[0034] In one possible implementation, based on the angle change value of the angle information, the electronic device is instructed to adjust the pen tail function parameters corresponding to the pen tail function mode, including: sending the adjusted pen tail function parameters to the electronic device based on the angle change value of the angle information, so as to instruct the electronic device to adjust the pen tail function parameters corresponding to the pen tail function mode based on the adjusted pen tail function parameters.

[0035] or,

[0036] Based on the angle change value of the angle information, the electronic pen instructs the electronic device to adjust the pen tip function parameters corresponding to the pen tip function mode. This includes: sending the adjusted pen tip function parameters to the electronic device based on the angle change value, instructing the electronic device to adjust the pen tip function parameters corresponding to the pen tip function mode based on the adjusted pen tip function parameters. In this way, the electronic pen can determine the adjusted pen tip function parameters or pen tail function parameters based on the detected angle change value, and then the electronic pen can notify the electronic device of the adjusted pen tip function parameters or pen tail function parameters, so that the electronic device can perform the parameter adjustment operation.

[0037] In one possible implementation, the aforementioned sensor is also used to detect the angle information of the electronic pen, which includes tilt angle and / or rotation angle. Based on the angle change value of the angle information, the electronic device is instructed to adjust the pen tail function parameters corresponding to the pen tail function mode. This includes sending the angle information to the electronic device to instruct the electronic device to adjust the pen tail function parameters corresponding to the pen tail function mode based on the angle change value of the angle information.

[0038] or,

[0039] Based on the angle change value of the angle information, the electronic device is instructed to adjust the pen tip function parameters corresponding to the pen tip function mode. This includes sending angle information to the electronic device to instruct it to adjust the pen tip function parameters corresponding to the pen tip function mode based on the angle change value. In this way, the electronic pen can monitor only the pen's angle information and notify the electronic device of the monitored angle information for further processing.

[0040] Secondly, this application provides a method for switching electronic pens, which can be applied to electronic devices. The electronic device is communicatively connected to the electronic pen, and the electronic pen may include a sensor for detecting the pen's acceleration. The electronic pen switching method includes:

[0041] Receive the pen tail working status sent by the electronic pen. The pen tail working status is determined by the electronic pen when the acceleration meets the first acceleration condition; enter the pen tail function mode.

[0042] or,

[0043] Receives the pen tip working status sent by the electronic pen, which is determined by the electronic pen when the acceleration meets the second acceleration condition; enters the pen tip function mode.

[0044] The solution provided in the second aspect above allows the electronic device, upon receiving the pen tip's operating status from the pen, to enter the corresponding pen tip function mode. Similarly, upon receiving the pen tail's operating status from the pen, the electronic device can enter the corresponding pen tail function mode. Thus, after the pen accurately identifies its current operating status as either pen tip or pen tail using the acceleration value detected by its internal sensors, the electronic device can accurately implement the corresponding pen tip and pen tail functions.

[0045] In one possible implementation, the aforementioned sensor is used to detect the angle information of the electronic pen, including tilt angle and / or rotation angle. After entering the pen tail function mode, the method further includes:

[0046] Receive angle information sent by the electronic pen; adjust the pen tail function parameters corresponding to the pen tail function mode according to the angle change value of the angle information, when the angle change value is greater than the preset angle threshold.

[0047] or,

[0048] After entering the pen tip function mode, the method also includes:

[0049] The device receives angle information from the electronic pen; based on the angle change value, it adjusts the pen tip function parameters corresponding to the pen tip function mode, provided the angle change value exceeds a preset angle threshold. Thus, after receiving real-time monitoring of the electronic pen's tilt or rotation angle, the electronic device can adjust the pen tip or pen tail function parameters according to the change value of the tilt or rotation angle. Furthermore, this application improves the accuracy of parameter adjustment by setting a preset threshold for the change value of the tilt or rotation angle, preventing the electronic device from erroneously adjusting the pen tip or pen tail function parameters. Therefore, when using the pen tip or pen tail function, the user can adjust the parameters of that function by adjusting the pen's tilt or rotation angle.

[0050] Since the tilt angle or rotation angle of the electronic pen may change unintentionally during movement, the electronic device should not adjust the parameters of the pen tip or pen tail function in this case. Therefore, optionally, this application can reasonably increase the preset threshold value of the change value of the tilt angle or rotation angle to avoid the electronic device accidentally adjusting the parameters of the pen tip or pen tail function during the movement of the electronic pen.

[0051] In one possible implementation, before adjusting the pen tip or pen tail function parameters, the method further includes detecting that the electronic pen's sliding speed is less than a preset speed threshold. Thus, when the electronic pen's sliding speed is relatively high, the electronic device will not adjust the pen tip or pen tail function parameters, avoiding the possibility of the electronic device mistakenly adjusting these parameters during the pen's movement.

[0052] In one possible implementation, the angle change value is the angle difference between the current angle and the initial angle of the electronic pen.

[0053] Optionally, the initial angle can be the angle of the electronic pen when it contacts the screen of the electronic device. In this way, the electronic pen will monitor the initial angle of the electronic pen when either end of the electronic pen contacts the screen of the electronic device, so that the electronic device can adjust the parameters of the pen tip function or pen tail function according to the relative angle change with respect to the initial angle when in contact with the screen.

[0054] Optionally, the initial angle can be the angle of the electronic pen when the sliding speed of the electronic pen on the screen of the electronic device is less than a preset speed threshold. In this way, the electronic pen will monitor the angle of the electronic pen when the sliding speed of the electronic pen on the screen of the electronic device is less than the preset speed threshold, and use this angle as the new initial angle. Thus, the electronic device can adjust the parameters of the pen tip function or pen tail function according to the relative angle change with respect to this new initial angle.

[0055] In one possible implementation, the pen tail function parameters corresponding to the pen tail function mode are adjusted according to the angle change value of the angle information, including: adjusting the pen tail function parameters corresponding to the pen tail function mode according to the angle change value of the angle information and the preset correspondence between the angle change value and the pen tail function parameter change value.

[0056] Alternatively, based on the angle change value of the angle information, the pen tip function parameters corresponding to the pen tip function mode can be adjusted. This includes adjusting the pen tip function parameters corresponding to the pen tip function mode based on the angle change value of the angle information and a preset correspondence between the angle change value and the pen tip function parameter change value. In this way, the electronic device can pre-store the correspondence between the angle change value and the pen tip function parameter change value or the correspondence between the angle change value and the pen tip function parameter change value. Thus, the electronic device can determine the parameter change corresponding to the current angle change value through the pre-stored correspondence.

[0057] In one possible implementation, the pen tail function mode is an eraser mode, and the pen tail function parameters include eraser radius and / or eraser opacity. The pen tail function parameters corresponding to the pen tail function mode are adjusted according to the angle change value of the angle information, including: adjusting the eraser radius according to the angle change value of the tilt angle; and / or adjusting the eraser opacity according to the angle change value of the rotation angle.

[0058] Alternatively, the eraser radius can be adjusted based on the change in rotation angle; and / or the eraser opacity can be adjusted based on the change in tilt angle. Thus, when using the stylus's end to perform the eraser function, the user can adjust the eraser radius or opacity by adjusting the stylus's tilt or rotation angle.

[0059] In one possible implementation, the pen tail function mode is a screenshot mode. The pen tail function parameters include the radius of the screenshot area. These parameters are adjusted based on the angle change value of the angle information, including: adjusting the radius of the screenshot area based on the angle change value of the tilt angle; or, adjusting the radius of the screenshot area based on the angle change value of the rotation angle. Thus, when a user uses the pen tail to take a screenshot, they can adjust the screenshot radius by adjusting the tilt angle or rotation angle of the pen.

[0060] In one possible implementation, the sensor is used to detect the angle information of the electronic pen, including tilt angle and / or rotation angle. After entering the pen tail function mode, the method further includes: receiving the adjusted pen tail function parameters sent by the electronic pen, the adjusted pen tail function parameters being determined by the electronic pen based on the angle change value of the angle information; and adjusting the pen tail function parameters corresponding to the pen tail function mode based on the adjusted pen tail function parameters.

[0061] or,

[0062] After entering the pen tip function mode, the method further includes: receiving the adjusted pen tip function parameters sent by the electronic pen, the adjusted pen tip function parameters being determined by the electronic pen based on the angle change value of the angle information; and adjusting the pen tip function parameters corresponding to the pen tip function mode based on the adjusted pen tip function parameters. Thus, after the electronic pen determines the adjusted pen tip function parameters or pen tail function parameters based on the monitored angle change value, the electronic device can receive the adjusted pen tip function parameters or pen tail function parameters sent by the electronic pen, and the electronic device only performs parameter adjustment operations.

[0063] In one possible implementation, the stylus of the electronic pen is a brush, and the stylus function mode is a brush writing mode. After entering the stylus function mode, the method further includes: responding to a touch operation by the electronic pen on the screen of the electronic device, displaying the touch trajectory of the touch operation on the screen in the form of a brush writing effect. Thus, this application allows the stylus of the electronic pen to be designed with a structure and material similar to a brush, enabling the electronic device to display a brush writing effect when the user uses the stylus function.

[0064] Thirdly, this application provides a switching device for an electronic pen, which is included in the electronic pen and has the function of implementing the electronic pen behavior in any of the methods of the first aspect and its possible implementations. This function can be implemented by hardware or by hardware executing corresponding software. The hardware or software includes one or more modules or units corresponding to the above-described function.

[0065] Fourthly, this application provides a switching device for an electronic pen, which is included in an electronic device and has the function of implementing the behavior of the electronic device in any of the methods of the second aspect and its possible implementations. This function can be implemented by hardware or by hardware executing corresponding software. The hardware or software includes one or more modules or units corresponding to the above-described function.

[0066] Fifthly, this application provides an electronic pen that includes a sensor, a memory, and one or more processors. The sensor is used to detect the acceleration of the electronic pen. The memory and the processor are coupled; the memory is used to store computer program code, which includes computer instructions. When the processor executes the computer instructions, the electronic pen executes the electronic pen switching method in any possible implementation of the first aspect described above.

[0067] In a sixth aspect, this application provides an electronic device including a memory and one or more processors. The memory and processors are coupled; the memory stores computer program code, which includes computer instructions, and when the processor executes the computer instructions, the electronic device executes the electronic pen switching method in any possible implementation of the second aspect described above.

[0068] In a seventh aspect, this application provides a system comprising an electronic pen and an electronic device. The electronic device is communicatively connected to the electronic pen, which includes a sensor for detecting the acceleration of the electronic pen. The electronic pen executes the electronic pen switching method of any possible implementation of the first aspect described above, and the electronic device executes the electronic pen switching method of any possible implementation of the second aspect described above.

[0069] Eighthly, this application provides an electronic device including an electronic pen as described in the fifth aspect of this application. The electronic pen executes the electronic pen switching method in any possible implementation of the first aspect, and the electronic device executes the electronic pen switching method in any possible implementation of the second aspect.

[0070] Ninthly, this application provides a computer storage medium including computer instructions that, when executed on an electronic pen, cause the electronic pen to perform the electronic pen switching method in any possible implementation of the first aspect described above.

[0071] In a tenth aspect, this application provides a computer storage medium including computer instructions that, when executed on an electronic device, cause the electronic device to perform the electronic pen switching method in any possible implementation of the second aspect described above.

[0072] In the eleventh aspect, this application provides a computer program product that, when run on a computer, causes the computer to execute the electronic pen switching method in any possible implementation of the first aspect, or causes the computer to execute the electronic pen switching method in any possible implementation of the second aspect.

[0073] Understandably, the beneficial effects achieved by the electronic pen switching device of the third aspect and any possible implementation thereof, the electronic pen of the fifth aspect, the system of the seventh aspect, the electronic device of the eighth aspect, the computer storage medium of the ninth aspect, and the computer program product of the eleventh aspect can be referred to the beneficial effects of the first aspect and any possible implementation thereof. The beneficial effects achieved by the electronic pen switching device of the fourth aspect and any possible implementation thereof, the electronic device of the sixth aspect, the system of the seventh aspect, the electronic device of the eighth aspect, the computer storage medium of the tenth aspect, and the computer program product of the eleventh aspect can be referred to the beneficial effects of the second aspect and any possible implementation thereof, and will not be repeated here. Attached Figure Description

[0074] Figure 1 A system schematic diagram provided for an embodiment of this application;

[0075] Figure 2A A schematic diagram of the structure of an electronic pen provided in an embodiment of this application;

[0076] Figure 2B This is a schematic diagram of another electronic pen provided in an embodiment of this application;

[0077] Figure 3 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application;

[0078] Figure 4 A flowchart illustrating an electronic pen switching method provided in an embodiment of this application;

[0079] Figure 5 A schematic diagram of the working state of an electronic pen provided in an embodiment of this application;

[0080] Figure 6 This is a schematic diagram of the sensor detection results of an electronic pen provided in an embodiment of this application;

[0081] Figure 7 This is another schematic diagram of the working state of an electronic pen provided in an embodiment of this application;

[0082] Figure 8 A schematic diagram of sensor detection results for another electronic pen provided in an embodiment of this application;

[0083] Figure 9 A schematic diagram illustrating the working state of an electronic pen provided in this application embodiment;

[0084] Figure 10 A schematic diagram illustrating the working state of another electronic pen provided in this application embodiment;

[0085] Figure 11 Another schematic diagram of the working state of an electronic pen provided in this application embodiment;

[0086] Figure 12 A flowchart illustrating an electronic pen switching method provided in an embodiment of this application;

[0087] Figure 13 A schematic diagram illustrating the switching effect of an electronic pen provided in an embodiment of this application;

[0088] Figure 14 A schematic diagram illustrating the switching effect of another electronic pen provided in an embodiment of this application;

[0089] Figure 15 A schematic diagram illustrating the switching effect of an electronic pen provided in an embodiment of this application;

[0090] Figure 16 This is a flowchart illustrating an electronic pen switching method provided in an embodiment of this application. Detailed Implementation

[0091] The technical solutions of the embodiments of this application will now be described with reference to the accompanying drawings. Hereinafter, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this embodiment, unless otherwise stated, "multiple" means two or more.

[0092] Currently, with the improvement of touchscreen and electronic pen performance, more and more users are starting to use electronic pens for artistic creation and recording. Users can use electronic pens to freely interact and control on touchscreens. However, most electronic pens currently mainly use the tip end for writing and clicking, while the tail end has not been well developed, resulting in low practicality and failing to meet users' needs in different scenarios.

[0093] Therefore, it is necessary to utilize the tail of the electronic pen to improve its practicality. To accurately implement the tail function, it is first necessary to identify both ends of the pen to determine which end is facing the screen or which end is in contact with it. This allows for the implementation of corresponding pen tip functions (such as writing) when the pen tip is identified, and corresponding pen tail functions (such as eraser) when the pen tail is identified.

[0094] Currently, one solution to accurately implement the tail function of an electronic pen is to add a device to the tail of the pen to identify which end of the pen is currently in contact with the screen, thus accurately implementing the tail function when contact is detected. However, this requires installing a complex structure at the tail of the pen, affecting the product's shape design and reliability.

[0095] As an alternative solution, the inertial measurement unit (IMU) within the electronic pen can calculate the pen's tilt angle. This tilt angle can then be used to identify which end of the pen is currently facing the screen, allowing for accurate tail-point control when the pen's tail is detected. However, since the IMU cannot directly obtain the tilt angle, it typically uses integration to calculate it. IMUs have zero-bias errors, which accumulate and amplify over time. In other words, the tilt angle calculated by the IMU becomes highly inaccurate after a period of use, affecting the judgment of which end of the pen is facing the screen.

[0096] To address the aforementioned issues, this application provides a method for switching electronic pens, an electronic pen, and an electronic device. This method utilizes acceleration values ​​detected by sensors within the electronic pen to identify which end of the pen is currently facing the screen, thereby accurately realizing the pen's tail function. This solution eliminates the need for additional devices at the pen's tail, ensuring product design integrity, and avoids the accumulation of errors generated during IMU device calculations of the pen's tilt angle, thus guaranteeing the accuracy of pen tail recognition.

[0097] Figure 1 A schematic diagram of a system provided in this application is shown. Figure 1 As shown, the system includes an electronic device 10 and an electronic pen 20. The electronic pen 20 can provide input to the electronic device 10, and the electronic device 10 performs an operation in response to the input based on the input from the electronic pen 20.

[0098] In this embodiment, the electronic device 10 can be a mobile phone, tablet computer, wearable device such as a smartwatch, smart bracelet, etc., smart home device such as a television, smart screen, game console, smart speaker, smart projector, smart TV box, in-vehicle device, augmented reality (AR) / virtual reality (VR) device, laptop computer, ultra-mobile personal computer (UMPC), netbook, personal digital assistant (PDA), etc. This embodiment does not impose any special limitations on the specific device form of the electronic device 10.

[0099] The electronic device 10 may include a touch panel (TP) 11, which can also be called a touch control panel. The touch panel can perform various operations, such as sending and receiving signals. It should be understood that the electronic device 10 may also include other units or modules. For example, if the electronic device is a smartphone, it may also include modules such as a speaker, microphone, and light sensor.

[0100] The electronic pen 20 can be, but is not limited to, an inductive pen and a capacitive pen. Capacitive pens can include passive capacitive pens and active capacitive pens. Passive capacitive pens can be called passive capacitive pens, and active capacitive pens can be called active capacitive pens.

[0101] In this embodiment, the electronic device 10 and the electronic pen 20 can establish a communication connection via wired or wireless means. Optionally, the electronic device 10 can establish a wireless connection with the electronic pen 20 via a wireless communication module. The wireless connection method can be Bluetooth (BT), wireless local area networks (WLAN) such as Wireless Fidelity (Wi-Fi), near field communication (NFC), infrared (IR), etc. This embodiment does not limit the wireless connection method. Optionally, the electronic device 10 can also establish a wired connection with the electronic pen 20 via a universal serial bus (USB) interface. This embodiment does not limit the specific communication method between the electronic device 10 and the electronic pen 20.

[0102] Taking wireless connection as an example of Bluetooth connection, both electronic device 10 and electronic pen 20 can include a Bluetooth module with integrated Bluetooth function for communication via Bluetooth transmission.

[0103] In one possible implementation, the Bluetooth module of the electronic pen 20 can be always on. Optionally, the electronic pen 20 can also be equipped with a power switch. When the power is turned on, the Bluetooth module is powered on and can be discovered by nearby devices with Bluetooth modules. After the electronic device 10 enables Bluetooth, it can use its Bluetooth module to search for nearby Bluetooth devices within the Bluetooth transmission range, including the electronic pen 20. Optionally, the user can click to view the Bluetooth device list on the electronic device 10 and then select the icon of the electronic pen 20, thereby initiating the Bluetooth pairing process between the electronic device 10 and the electronic pen 20, and establishing a Bluetooth connection after successful pairing.

[0104] In another possible implementation, when the user attaches the electronic pen 20 to the side frame of the electronic device 10 or the touch screen 11, the Bluetooth pairing and / or Bluetooth connection process between the electronic pen 20 and the electronic device 10 can also be triggered.

[0105] Optionally, when the user does not need to use the electronic pen 20, or the electronic pen 20 is not in pairing mode, or the remaining battery of the electronic pen 20 is insufficient, the user can also directly bring the electronic pen 20 close to the electronic device 10 and rely on the "strong magnetic attraction" to attach the electronic pen 20 to the frame of the electronic device 10 or the touch screen 11. For example, the electronic pen 20 can be attached to the long frame of the electronic device 10.

[0106] The "strong magnetic attraction" ensures the safe storage of the electronic pen 20. In some embodiments, the "strong magnetic attraction" can trigger pairing and / or connection between the electronic pen 20 and the electronic device 10. In other embodiments, the "strong magnetic attraction" can also complete the magnetic charging process of the electronic pen 20, which is not limited in this application embodiment.

[0107] In the embodiments of this application, such as Figure 1 As shown, the electronic pen 20 may include a pen tip 21 and a pen tail 22 respectively disposed at both ends of the electronic pen 20. After the electronic device 10 and the electronic pen 20 establish a communication connection, the user can use the pen tip 21 or the pen tail 22 of the electronic pen 20 to contact the touch screen 11 of the electronic device 10, such as by pressing, tapping, and sliding, to realize the pen tip function or pen tail function of the electronic pen.

[0108] At least a portion of the pen tip 21 and at least a portion of the pen tail 22 are used to contact the touchscreen 11 of the electronic device 10, so that the electronic device 10 can determine the touch position of the electronic pen 20 on the touchscreen 11. Therefore, when a user holds the electronic pen 20, they can use the pen tip 21 or the pen tail 22 to contact the touchscreen 11 to input information to the electronic device 10.

[0109] For example, a user can use the tip 21 of the electronic pen 20 to write text, draw patterns, and other input content on the touch screen 11 of the electronic device 10. The electronic device 10 can recognize the text, patterns, and other input content written by the electronic pen 20 on the touch screen 11, so that the text, patterns, and other input content are input into the electronic device 10 in the form of data and displayed on the touch screen 11 of the electronic device 10.

[0110] In one possible implementation, such as Figure 2A As shown, the pen tip 21 can be one end of the electronic pen 20 used for basic functions such as writing and clicking, while the pen tail 22 can be the other end of the electronic pen 20 used for extended functions besides writing and clicking, such as an eraser function or a screenshot function. The pen tip 21 and pen tail 22 can have the same shape, structure, and material, or they can be different. Therefore, the user can use the pen tip 21 to touch the touchscreen 11 to write and draw. The user can use the pen tail 22 to touch the touchscreen 11 to erase writing and drawing marks or take screenshots.

[0111] In another possible implementation, the electronic pen 20 can also be similar to Figure 2B The dual-tip electronic pen shown. Figure 2B As shown, both the pen tip 21 and the pen tail 22 can be used for writing. The shape, structure, and material of the pen tip 21 can be similar to the shape, structure, and material of the tip of a traditional electronic pen for regular writing and drawing. The shape, structure, and material of the pen tail 22 can be similar to the shape, structure, and material of the brush of a special pen such as a calligraphy brush or watercolor brush for artistic writing and drawing. Therefore, users can use the pen tip 21 to touch the touchscreen 11 for regular writing and drawing, and use the pen tail 22 to touch the touchscreen 11 for artistic writing and drawing. This allows users to experience two different pen touches, making their writing and drawing experience more realistic.

[0112] In this embodiment, after the electronic device 10 and the electronic pen 20 establish a communication connection, the user can also use the pen tip 21 or pen tail 22 of the electronic pen 20 to remotely control the electronic device 10. That is, when the user controls the electronic device 10 with the pen tip 21 or pen tail 22 of the electronic pen 20, the pen tip 21 or pen tail 22 does not need to contact the touch screen 11.

[0113] Optionally, when holding the electronic pen 20, the user can point the tip 21 of the electronic pen 20 downwards to control the electronic device 10 to perform a first operation. The user can also point the end 22 of the electronic pen 20 downwards to control the electronic device 10 to perform a second operation. For example, when the electronic device 10 is playing an audio-visual file, the user can point the tip 21 of the electronic pen 20 downwards to control the electronic device 10 to perform a fast-forward operation on the audio-visual file. The user can also point the end 22 of the electronic pen 20 downwards to control the electronic device 10 to perform a rewind operation on the audio-visual file.

[0114] As an example, please refer to Figure 2A and Figure 2B , Figure 2A and Figure 2B This is a schematic diagram of the structure of an electronic pen 20 provided in an embodiment of this application. Figure 2A and Figure 2B As shown, the electronic pen 20 may include components such as a controller, memory, IMU device, communication unit, and power supply.

[0115] It is understood that the structure illustrated in the embodiments of this application does not constitute a specific limitation on the electronic pen 20. In other embodiments, the electronic pen 20 may include... Figure 2A and Figure 2B The pen may contain more or fewer components, or combine some components, or separate some components, or have different component arrangements. The components illustrated may be implemented in hardware, software, or a combination of software and hardware. For example, the electronic pen 20 may also include components such as a shell, a pen tip, and a pen tail.

[0116] The IMU device may include one or more of an accelerometer, a gyroscope, and a magnetometer. These three sensors can measure the attitude, sliding speed, and other state information of the electronic pen 20 through individual or joint operations. In this embodiment, the attitude of the electronic pen may include the tilt angle and / or rotation angle of the electronic pen.

[0117] In one possible implementation, the aforementioned accelerometer sensor can be used to detect the acceleration of the electronic pen 20, the gyroscope sensor can be used to detect the rotational angular velocity of the electronic pen 20, and the magnetometer sensor can be used to detect the angle between the electronic pen 20 and the cardinal directions.

[0118] This application does not specifically limit the sensor devices used to detect the attitude, sliding speed, and other state information of the electronic pen 20. It is understood that any sensors or instruments used to detect the attitude, sliding speed, and other state information of the electronic pen 20 should fall within the protection scope of this application.

[0119] The communication unit can be used to enable information exchange between the electronic pen 20 and the electronic device 10. Optionally, the communication unit may include a wireless communication module and / or a communication interface. The wireless communication module can be used for signal reception and transmission during information exchange. For example, it may be a radio frequency circuit or a Wi-Fi module. The communication interface can be used to directly connect to the electronic device 10 to enable information exchange between the electronic pen 20 and the electronic device 10. For example, it may be a USB interface.

[0120] In addition, the communication unit may also include components such as a Bluetooth module and an infrared module that enable information electronics between the electronic pen 20 and the electronic device 10; this application embodiment does not specifically limit this. The Bluetooth module may include a classic Bluetooth BT module and a Bluetooth Low Energy (BLE) module.

[0121] The power supply can be used to provide energy to all other devices and apparatus within the electronic pen 20.

[0122] The memory can be used to store computer-executable program code, including instructions. The controller executes various functional applications and data processing of the electronic pen 20 by running the instructions stored in the memory. The memory can also store data created during the use of the electronic pen 20. Optionally, the memory can store the tilt angle and / or rotation angle of the electronic pen 20 measured by the IMU device. Optionally, the memory can also store the correspondence between the tilt angle change value and the functional parameter change value, and / or the correspondence between the rotation angle change value and the functional parameter change value.

[0123] The controller can be used to control IMU devices, communication units, memory, and other devices. Specifically, the controller can serve as the central nervous system and command center of the electronic pen 20. The controller can generate operation control signals based on instruction opcodes and timing signals to control the reading and execution of instructions.

[0124] As an example, the controller can determine the current working state of the electronic pen 20 as the pen tail working state when the acceleration value measured by the IMU device, such as the single-axis acceleration value or the acceleration value obtained by multi-axis joint calculation, meets a first acceleration condition. Specifically, when the electronic pen 20 is in the pen tail working state, the pen tail end 22 of the electronic pen 20 is close to the touch screen 11, and the pen tip 21 of the electronic pen 20 is far away from the touch screen 11, indicating that the user wants to activate the pen tail function.

[0125] Optionally, when the controller determines that the current working state of the electronic pen 20 is the pen tail working state, the controller can also control the communication unit to send the pen tail working state to the electronic device 10. After receiving the pen tail working state, the electronic device 10 can call relevant processes or instructions to enter the pen tail function mode corresponding to the pen tail working state, such as the aforementioned extended function modes corresponding to the pen tail, such as the eraser function, screenshot function, etc.

[0126] As another example, the controller can also be used to determine the current working state of the electronic pen 20 as the pen tip working state when the acceleration value measured by the IMU device, such as the single-axis acceleration value or the acceleration value obtained by multi-axis joint calculation, meets the second acceleration condition. When the electronic pen 20 is in the pen tip working state, the tip 21 of the electronic pen 20 is close to the touch screen 11, and the tail 22 of the electronic pen 20 is away from the touch screen 11, indicating that the user wants to activate the pen tip function.

[0127] Optionally, when the controller determines that the current working state of the electronic pen 20 is the pen tip working state, the controller can also control the communication unit to send the pen tip working state to the electronic device 10. After receiving the pen tip working state, the electronic device 10 can call relevant processes or instructions to enter the pen tip function mode corresponding to the pen tip working state, such as the aforementioned writing function, click function, and other basic function modes corresponding to the pen tip.

[0128] It should be noted that the embodiments of this application do not specifically limit the components used in controlling IMU devices, communication units, and other devices. It is understood that any modules or devices used to control IMU devices, communication units, and other devices should fall within the protection scope of the embodiments of this application. For example, the controller can also be replaced by a processor or processing module.

[0129] As an example, please refer to Figure 3 , Figure 3 This is a schematic diagram of the structure of an electronic device 300 provided in an embodiment of this application. For example... Figure 3As shown, the electronic device 300 may include a processor 310, an external memory interface 320, an internal memory 321, a USB interface 330, a charging management module 340, a power management module 341, a battery 342, antenna 1, antenna 2, a mobile communication module 350, a wireless communication module 360, an audio module 370, a speaker 370A, a receiver 370B, a microphone 370C, a headphone jack 370D, a sensor module 380, buttons 390, a motor 391, an indicator 392, a camera 393, a display screen 394, and a SIM card interface 395, etc. The sensor module 380 may include a pressure sensor 380A, a gyroscope sensor 380B, a barometric pressure sensor 380C, a magnetic sensor 380D, an accelerometer sensor 380E, a proximity sensor 380F, a proximity light sensor 380G, a fingerprint sensor 380H, a temperature sensor 380J, a touch sensor 380K, an ambient light sensor 380L, a bone conduction sensor 380M, etc.

[0130] It is understood that the structure illustrated in this embodiment does not constitute a specific limitation on the electronic device 300. In other embodiments, the electronic device 300 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0131] Processor 310 may include one or more processing units, such as: application processor (AP), modem processor, graphics processing unit (GPU), image signal processor (ISP), controller, memory, video codec, digital signal processor (DSP), baseband processor, and / or neural network processing unit (NPU), etc. The different processing units may be independent devices or integrated into one or more processors.

[0132] The controller can be the nerve center and command center of the electronic device 300. The controller can generate operation control signals based on the instruction opcode and timing signals to control the fetching and execution of instructions.

[0133] The processor 310 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 310 is a cache memory. This memory can store instructions or data that the processor 310 has just used or that are used repeatedly. If the processor 310 needs to use the instruction or data again, it can retrieve it directly from the memory. This avoids repeated accesses, reduces the waiting time of the processor 310, and thus improves the efficiency of the system.

[0134] In some embodiments, the processor 310 may include one or more interfaces. Interfaces may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.

[0135] USB port 330 is a USB standard compliant interface, which can be a Mini USB port, Micro USB port, USB Type-C port, etc. USB port 330 can be used to connect a charger to charge electronic device 300, and can also be used for data transfer between electronic device 300 and peripheral devices. It can also be used to connect headphones for audio playback. This interface can also be used to connect other electronic devices.

[0136] It is understood that the interface connection relationships between the modules illustrated in this embodiment are merely illustrative and do not constitute a structural limitation on the electronic device 300. In other embodiments, the electronic device 300 may also employ different interface connection methods or combinations of multiple interface connection methods as described in the above embodiments.

[0137] The charging management module 340 receives charging input from a charger. The charger can be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 340 receives charging input from the wired charger via a USB interface 330. In some wireless charging embodiments, the charging management module 340 receives wireless charging input via the wireless charging coil of the electronic device 300. While charging the battery 342, the charging management module 340 can also supply power to the electronic device via the power management module 341.

[0138] The power management module 341 is used to connect the battery 342, the charging management module 340, and the processor 310. The power management module 341 receives input from the battery 342 and / or the charging management module 340 to power the processor 310, internal memory 321, external memory, display 394, camera 393, and wireless communication module 360, etc.

[0139] The wireless communication function of electronic device 300 can be realized through antenna 1, antenna 2, mobile communication module 350, wireless communication module 360, modem processor and baseband processor, etc.

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

[0141] The mobile communication module 350 can provide solutions for wireless communication, including 2G / 3G / 4G / 5G, applied to the electronic device 300. The mobile communication module 350 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc. The mobile communication module 350 can receive electromagnetic waves via antenna 1, and perform filtering, amplification, and other processing on the received electromagnetic waves before transmitting them to a modem processor for demodulation. The mobile communication module 350 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves for radiation via antenna 1. In some embodiments, at least some functional modules of the mobile communication module 350 may be housed in the processor 310. In some embodiments, at least some functional modules of the mobile communication module 350 and at least some modules of the processor 310 may be housed in the same device.

[0142] The modem processor may include a modulator and a demodulator. The modulator modulates the low-frequency baseband signal to be transmitted into a mid-to-high frequency signal. The demodulator demodulates the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After processing by the baseband processor, the low-frequency baseband signal is transmitted to the application processor. The application processor outputs sound signals through audio devices, such as a speaker 370A, a receiver 370B, etc., or displays images or videos through a display screen 394. In some embodiments, the modem processor may be a separate device. In other embodiments, the modem processor may be independent of the processor 310 and may be housed in the same device as the mobile communication module 350 or other functional modules.

[0143] The wireless communication module 360 ​​can provide solutions for wireless communication applications on the electronic device 300, including WLAN, BT, Global Navigation Satellite System (GNSS), Frequency Modulation (FM), NFC, and IR. The wireless communication module 360 ​​can be one or more devices integrating at least one communication processing module. The wireless communication module 360 ​​receives electromagnetic waves via antenna 2, performs frequency modulation and filtering of the electromagnetic wave signal, and sends the processed signal to processor 310. The wireless communication module 360 ​​can also receive signals to be transmitted from processor 310, perform frequency modulation and amplification, and convert them into electromagnetic waves for radiation via antenna 2.

[0144] In some embodiments, antenna 1 of electronic device 300 is coupled to mobile communication module 350, and antenna 2 is coupled to wireless communication module 360, enabling electronic device 300 to communicate with networks and other devices via wireless communication technology. The wireless communication technology may include Global System for Mobile Communications (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Time Division Code Division Multiple Access (TD-SCDMA), Long Term Evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technologies, etc. GNSS can include the Global Positioning System (GPS), the Global Navigation Satellite System (GLONASS), the BeiDou Navigation Satellite System (BDS), the Quasi-Zenith Satellite System (QZSS), and / or satellite-based augmentation systems (SBAS).

[0145] Electronic device 300 can implement audio functions such as music playback and recording through audio module 370, speaker 370A, receiver 370B, microphone 370C, headphone jack 370D, and application processor.

[0146] Pressure sensor 380A is used to sense pressure signals and convert them into electrical signals. In some embodiments, pressure sensor 380A may be disposed on display screen 394. There are many types of pressure sensors 380A, such as resistive pressure sensors, inductive pressure sensors, and capacitive pressure sensors. A capacitive pressure sensor may include at least two parallel plates with conductive material. When a force is applied to pressure sensor 380A, the capacitance between the electrodes changes. Electronic device 300 determines the pressure intensity based on the change in capacitance. When a touch operation is applied to display screen 394, electronic device 300 detects the intensity of the touch operation based on pressure sensor 380A. Electronic device 300 can also calculate the touch position based on the detection signal from pressure sensor 380A.

[0147] The gyroscope sensor 380B can be used to determine the motion attitude of the electronic device 300. In some embodiments, the angular velocity of the electronic device 300 about three axes, such as the x, y, and z axes, can be determined by the gyroscope sensor 380B.

[0148] The accelerometer 380E can detect the magnitude of acceleration of electronic device 300 in various directions, such as the x, y, and z axes. When electronic device 300 is stationary, it can detect the magnitude and direction of gravity. It can also be used to identify the posture of electronic device and applied to applications such as screen orientation switching and pedometers.

[0149] In some embodiments, the electronic device 300 can determine its attitude by one or more sensors such as a gyroscope sensor 380B, an accelerometer sensor 380E, or a gravity sensor, so that the electronic pen can accurately identify its working state by combining the attitude of the electronic device 300.

[0150] For example, the electronic device 300 can determine whether it is currently in an upright or inverted state by using one or more sensors such as a gyroscope sensor 380B, an accelerometer sensor 380E, or a gravity sensor. When the electronic device 300 is in an upright state, the display screen 394 faces upwards; when the electronic device 300 is in an inverted state, the display screen 394 faces downwards.

[0151] In one possible implementation, when the electronic device 300 is in an upright position, the electronic pen can use an acceleration greater than 0 as a first acceleration condition for identifying the pen tip's working state, and an acceleration less than 0 as a second acceleration condition for identifying the pen tail's working state. When the electronic device 300 is in an inverted position, the conditions for identifying the pen tip's working state and the pen tail's working state can be reversed. In this case, the electronic pen can use an acceleration less than 0 as the first acceleration condition for identifying the pen tip's working state, and an acceleration greater than 0 as the second acceleration condition for identifying the pen tail's working state.

[0152] In some embodiments, the gyroscope sensor 380B and the accelerometer sensor 380E can also be combined to form an IMU sensor. The IMU sensor is used to detect the acceleration and angular velocity of the electronic device 300 on three axes, namely the x, y, and z axes.

[0153] Touch sensor 380K, also known as a "touch panel," can be located on display screen 394. The touch sensor 380K and display screen 394 together form a touchscreen, also called a touch display. Touch sensor 380K detects touch operations applied to or near it. The touch sensor can transmit the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through display screen 394. In other embodiments, touch sensor 380K may also be located on the surface of electronic device 300, in a different position than display screen 394.

[0154] The electronic device 300 can implement shooting functions through an ISP, a camera 393, a video codec, a GPU, a display 394, and an application processor. In some embodiments, the electronic device 300 may include one or N cameras 393, where N is a positive integer greater than 1.

[0155] Electronic device 300 can implement display functions through a GPU, display screen 394, and application processor. The GPU is a microprocessor for image processing, connecting the display screen 394 and the application processor. The GPU is used to perform mathematical and geometric calculations and for graphics rendering. Processor 310 may include one or more GPUs, which execute program instructions to generate or modify display information.

[0156] The display screen 394 is used to display images, videos, etc. In some embodiments, the electronic device 300 may include one or N display screens 394, where N is a positive integer greater than 1. Optionally, the display screen 394 may be used to display information input by an electronic pen. For example, in this embodiment, the display screen 394 may be used to display the movement trajectory of the electronic pen. Optionally, the display screen 394 may also display an interface related to the electronic pen input based on the electronic pen input. For example, in this embodiment, the display screen 394 may display the application interface of a video application based on a click operation of the electronic pen on a video application icon.

[0157] The methods described in the following embodiments can all be implemented in electronic pens and electronic devices with the above-described hardware structure.

[0158] The following will use electronic devices as an example to specifically illustrate the technical solutions provided in the embodiments of this application. Figure 4 As shown, the switching method of the electronic pen may include:

[0159] The S400 and electronic pen establish a communication connection with the electronic device.

[0160] Optionally, the electronic pen and the electronic device can establish a communication connection via Bluetooth, NFC, or other wireless methods. Alternatively, the electronic pen and the electronic device can also establish a communication connection via a wired connection such as a USB data transfer cable. This application does not limit the communication connection method between the electronic pen and the electronic device.

[0161] The following example illustrates the process of establishing a Bluetooth connection between an electronic pen and an electronic device. Both the electronic pen and the electronic device have Bluetooth functionality.

[0162] Optionally, the electronic pen can broadcast messages to its surroundings when it needs to establish a Bluetooth connection with an electronic device. For example, when the electronic pen is magnetically attached to an electronic device, it can establish a Bluetooth connection and broadcast messages to its surroundings. Alternatively, when the electronic pen detects that a user has removed it from the electronic device, it can determine that the user intends to use the pen and therefore needs to establish a Bluetooth connection, broadcasting messages to its surroundings. Another example is that the electronic pen may have a touch button for activating its Bluetooth function. When a user presses the touch button, it can be determined that the user intends to use the pen and therefore needs to establish a Bluetooth connection. In this case, the electronic pen can respond to the user's action on the touch button by broadcasting messages to its surroundings. These broadcast messages can be sent at regular intervals. After each broadcast message, the electronic pen opens a short-term radio frequency reception window to receive connection requests that may be sent by the electronic device.

[0163] When Bluetooth is enabled, electronic devices can listen for broadcast messages from nearby Bluetooth devices. Upon detecting a broadcast message from a stylus, the electronic device can send a connection request message to the stylus to establish a Bluetooth connection. Optionally, if the electronic device has not previously connected to the stylus, upon detecting the stylus's broadcast message, it can display the stylus's device information in its list of connectable devices. When the user clicks on this device information, the electronic device sends a connection request message to the stylus. Optionally, if the electronic device has previously connected to the stylus, upon detecting the stylus's broadcast message, it can directly send a connection request message to the stylus.

[0164] Optionally, after receiving a connection request message from an electronic device, if the electronic pen agrees to establish a connection, it can send a connection confirmation message to the electronic device in response. Upon receiving the connection confirmation message, the electronic device confirms that a successful Bluetooth connection has been established. Subsequently, the electronic pen and electronic device can transmit data via this Bluetooth connection, such as transmitting the electronic pen's operating status information.

[0165] S410. When the acceleration of the electronic pen meets the first acceleration condition, the electronic pen is determined to be in the pen tail working state.

[0166] In this embodiment, the electronic pen incorporates a sensor that can measure the pen's acceleration in various directions. In one possible implementation, in a three-dimensional x, y, z coordinate system, the sensor can measure the pen's acceleration *a* along the x, y, and z axes. x ay a z .

[0167] Optionally, the sensor can be an accelerometer or an IMU sensor. The IMU sensor can include one or more of an accelerometer, a gyroscope, and a magnetometer. These three sensors, individually or in combination, can measure the pen's attitude, sliding speed, and other state information. Specifically, the accelerometer can measure the pen's acceleration along the x, y, and z axes; the gyroscope can measure the pen's angular velocity around the x, y, and z axes; and the magnetometer can measure the angle between the pen and the cardinal directions. The specific sensor type is not limited in this embodiment.

[0168] It should be understood that after an electronic pen leaves the factory, the installation position and orientation of the sensor inside the pen usually do not change. That is, during the use of the electronic pen, the installation position and orientation of the sensor are fixed, and the coordinate system corresponding to the acceleration values ​​acquired by the sensor during operation is also fixed. For different electronic pens, the installation position and orientation of the sensor inside the pen may be different or the same.

[0169] For example, such as Figure 5 As shown, assuming the sensor is installed at the tail of the electronic pen, the three-axis coordinate system corresponding to the sensor's orientation is: Figure 5 The coordinate system O shown xyz. For example, coordinate system O xyz can be a Cartesian coordinate system. Where, coordinate system O... The origin O of xyz can be any position on the body of the electronic pen. Figure 5 This example uses the origin O located at the end of the pen. Coordinate system O In the xyz matrix, the z-axis is parallel to the pen body, with the positive direction of the z-axis pointing from the pen tip to the pen tail, and the negative direction pointing from the pen tail to the pen tip. The x, y, and z axes are all pairwise orthogonal. The positive directions of the x, y, and z axes satisfy the right-hand rule. Therefore, when the positive z-axis points from the pen tip to the pen tail, the positive directions of the x and y axes can be determined based on the right-hand rule, which will not be elaborated further here.

[0170] like Figure 5 As shown, with the screen of the electronic device facing upwards, when the tip of the electronic pen is pointing towards the screen, due to gravity F, the electronic pen experiences a decomposed force F in the negative direction of the z-axis. z Correspondingly, the electronic pen has an acceleration 'a' in the negative direction of the z-axis. zTherefore, the acceleration value (in meters per second) detected by the sensor inside the electronic pen on the z-axis. 2 ) can be like Figure 6 As shown in curve 601, the acceleration value is negative and typically fluctuates around a negative bias value, such as... Figure 6 The value -5.0 corresponds to the dashed line 602. Here, "screen facing upwards" includes the screen of the electronic device facing upwards at a horizontal angle, or the screen of the electronic device facing upwards at a certain angle relative to the horizontal plane.

[0171] Similarly, the three-axis coordinate system corresponding to the sensor's orientation is still [missing information]. Figure 5 The coordinate system O shown xyz, the user rotates the pen's orientation. For example, as... Figure 7 As shown, with the screen of the electronic device facing upwards, when the tip of the stylus is pointing towards the screen, due to gravity F, the stylus experiences a decomposed force F in the positive z-axis direction. z Correspondingly, the electronic pen has an acceleration 'a' in the positive direction of the z-axis. z Therefore, the acceleration value detected by the sensor on the z-axis (in meters per second) 2 ) can be like Figure 8 As shown in curve 801, the acceleration value is positive and typically fluctuates around a positive bias value, such as... Figure 8 The value 5.0 corresponds to the dashed line 802.

[0172] Combination Figures 5-8 It can be observed that the three-axis coordinate system corresponding to the sensor's orientation is as follows: Figure 5 The coordinate system O shown When the screen of the electronic device is facing upwards and both ends of the electronic pen are pointing towards the screen, the acceleration values ​​detected by the sensors inside the electronic pen exhibit the following pattern: when the tip of the electronic pen is pointing towards the screen, the acceleration value detected by the sensors inside the electronic pen on the z-axis is negative and often at a specific negative bias value; when the tail of the electronic pen is pointing towards the screen, the acceleration value detected by the sensors inside the electronic pen on the z-axis is positive and often at a specific positive bias value.

[0173] Therefore, based on the above rules, the electronic pen can directly identify which end of the electronic pen is currently facing the screen based on the acceleration value detected by the sensor inside the electronic pen.

[0174] In this embodiment, the electronic pen can determine that it is in a pen-tail working state when the acceleration detected by the sensor meets a first acceleration condition. The electronic pen can include two working states: a pen-tail working state and a pen-tip working state. When the electronic pen is in the pen-tip working state, such as... Figure 5As shown, the tip of the electronic pen is close to the screen of the electronic device, while the tail of the electronic pen is away from the screen. When the electronic pen is in the tail-operated state, as... Figure 7 As shown, the end of the electronic pen is close to the screen of the electronic device, while the tip of the electronic pen is far away from the screen of the electronic device.

[0175] Optionally, the first acceleration condition can refer to the numerical condition that the acceleration value of the electronic pen needs to meet when the electronic pen is in the pen tail working state. The first acceleration condition corresponds to the pen tail working state. The first acceleration condition can be reasonably set according to specific application scenarios, and it can be pre-stored in the electronic pen. This application embodiment does not impose specific limitations.

[0176] In this way, the electronic pen can directly identify whether the user is using the end of the pen to contact the screen based on the acceleration value detected by the sensor, without needing to use the tilt angle recognition obtained by sensor integration. This solution eliminates the need for additional devices at the end of the pen, ensuring the product's shape design, and also avoids the impact of error accumulation caused by the IMU device in calculating the tilt angle of the electronic pen, ensuring the accuracy of recognition at both the pen tip and the end of the pen.

[0177] Optionally, the acceleration satisfying the first acceleration condition can be that the target acceleration of the electronic pen in the direction of the first axis satisfies the first acceleration condition. The first axis is parallel to the pen body. Therefore, when the first acceleration of the electronic pen on the first axis satisfies the first acceleration condition, the electronic pen can determine that it is in the pen-tail working state. In this way, the electronic pen can identify whether the user is using the pen-tail tip to contact the screen based solely on the acceleration value on a single axis, resulting in short calculation time and high real-time performance.

[0178] Optionally, when the positive direction of the first axis, i.e., the direction in which the first axis points, is the direction in which the tip of the electronic pen points to the tail of the pen, the first acceleration condition can be that the first acceleration of the electronic pen on the first axis is greater than a first threshold. The first threshold can be 0 (i.e., the acceleration is positive), or it can be a positive value smaller than the aforementioned positive bias value, such as 2. The first threshold is not limited in this embodiment and can be set reasonably according to the actual situation.

[0179] For example, with Figure 7 Taking the coordinate system shown as an example, the first axis is the z-axis, parallel to the body of the electronic pen. The direction pointed to by the z-axis is the positive direction of the z-axis, which is the direction from the tip of the electronic pen to the tail. Therefore, when the acceleration value a of the electronic pen on the z-axis... z When the first acceleration condition is met, the electronic pen can determine that it is in the pen-tail working state. At this time, the first acceleration condition can be the acceleration value 'a' on the z-axis detected by the sensor. z It is greater than the first threshold.

[0180] Optionally, the above acceleration satisfies the first acceleration condition, or the acceleration of the electronic pen on multiple axes satisfies the first acceleration condition.

[0181] It is understandable that when the screen of the electronic device is facing upwards and the tip of the electronic pen is pointing towards the screen, the pen will... Figure 5 Taking the coordinate system shown as an example, due to gravity F, the electronic pen experiences a decomposed force Fz in the negative direction of the z-axis, a decomposed force Fx in the positive direction of the x-axis, and a decomposed force Fy in the positive direction of the y-axis. Therefore, the acceleration value a on the z-axis detected by the sensor... z The acceleration value a on both the x and y axes is negative. x a y It is positive.

[0182] Similarly, when the screen of an electronic device is facing upwards, and the tip of the stylus is pointing towards the screen, as... Figure 7 As shown, due to gravity F, the electronic pen experiences a decomposed force Fz in the positive z-axis direction, a decomposed force Fy in the negative y-axis direction, and a decomposed force Fx in the negative x-axis direction. Therefore, the acceleration value a detected by the sensor on the z-axis is... z For positive values, the acceleration values ​​a on the x and y axes x a y It is negative.

[0183] In other words, when the screen of an electronic device is facing upwards and the two ends of the electronic pen are pointing towards the screen, in addition to the different patterns of acceleration values ​​detected by the sensors on the z-axis, the acceleration values ​​on the x and y axes also show different patterns. Therefore, the electronic pen can also combine the acceleration values ​​on multiple axes to identify which end of the pen is currently facing the screen, thus improving accuracy.

[0184] For example, with Figure 7 Taking the coordinate system shown as an example, when the acceleration of the electronic pen on at least two of the x-axis, y-axis and z-axis meets the first acceleration condition, the electronic pen can be determined to be in the pen tail working state.

[0185] As an example, when the acceleration of the electronic pen on both the x-axis and y-axis meets the first acceleration condition, the electronic pen can be determined to be in the pen tail working state. In this case, the first acceleration condition can be the acceleration value 'a' of the electronic pen on the x-axis. x The acceleration value a on the y-axis is negative. y It is negative.

[0186] As an example, when the acceleration of the electronic pen on both the x-axis and z-axis meets the first acceleration condition, the electronic pen can be determined to be in the pen tail working state. In this case, the first acceleration condition can be the acceleration value 'a' of the electronic pen on the x-axis. x The acceleration value a on the z-axis is negative. z It is positive.

[0187] As an example, when the acceleration of the electronic pen on both the y-axis and z-axis meets the first acceleration condition, the electronic pen can be determined to be in the pen tail working state. In this case, the first acceleration condition can be the acceleration value 'a' of the electronic pen on the y-axis. y The acceleration value a on the z-axis is negative. z It is positive.

[0188] As an example, when the acceleration of the electronic pen on the x, y, and z axes all meets the first acceleration condition, the electronic pen can be determined to be in the pen tail working state. In this case, the first acceleration condition can be the acceleration value 'a' of the electronic pen on the x and y axes. x a y The acceleration value a on the z-axis is negative. z It is positive.

[0189] Optionally, the above acceleration satisfies the first acceleration condition, or the acceleration calculated jointly by the three axes of x-axis, y-axis and z-axis satisfies the first acceleration condition.

[0190] It's understandable that when the screen of an electronic device is facing upwards, and the tip of the stylus is pointing towards the screen, it... Figure 5 Taking the coordinate system shown as an example, since the acceleration value a on the z-axis detected by the sensor... z The acceleration value a on both the x and y axes is negative. x a y The value is positive. Therefore, the acceleration value 'a' after joint calculation of the three axes (x-axis, y-axis, and z-axis) is positive. y a y a z It is negative.

[0191] When the screen of the electronic device is facing upwards, and the tip of the stylus is pointing towards the screen, as... Figure 7 As shown, the acceleration value a on the z-axis detected by the sensor z For positive values, the acceleration values ​​a on the x and y axes x a y The value is negative. Therefore, the acceleration value 'a' after joint calculation of the three axes (x-axis, y-axis, and z-axis) is negative. y a y a zIt is positive.

[0192] In other words, when the screen of an electronic device is facing upwards and the two ends of the electronic pen are pointing towards the screen, the acceleration values ​​calculated jointly along the x, y, and z axes will exhibit different patterns. Therefore, the electronic pen can also combine the acceleration values ​​calculated jointly along multiple axes to identify which end of the pen is currently facing the screen, thus improving accuracy.

[0193] For example, the screen of an electronic device faces upwards, so as to... Figure 7 Taking the coordinate system shown as an example, when the combined acceleration of the electronic pen along the x, y, and z axes satisfies the first acceleration condition, the electronic pen can be determined to be in the pen-tail working state. At this time, the first acceleration condition can be the acceleration value 'a' resulting from the combined calculation of the x, y, and z axes. y a y a z It is positive.

[0194] S420: The electronic pen sends the pen tail working status to the electronic device, instructing the electronic device to enter the pen tail function mode.

[0195] In this embodiment, the electronic pen can transmit its current operating status information to the electronic device in real time. After determining the current operating status of the electronic pen, the electronic device can invoke relevant processes or instructions to enter the functional mode corresponding to that operating status.

[0196] Optionally, when it is determined that the electronic pen is currently in the pen tail working state, the electronic pen can send the status information of the pen tail working state to the electronic device. Upon receiving the pen tail working state, the electronic device can determine that the user is currently using the pen tail end, and then the electronic device can invoke relevant processes or instructions to enter the pen tail function mode corresponding to the pen tail working state, thus realizing the pen tail function of the electronic pen.

[0197] Optionally, the pen end function mode can be an extended function mode of the electronic pen, such as eraser or screenshot. The eraser mode can be used to erase writing and drawing marks displayed on the screen of the electronic device. The screenshot mode can be used to capture content displayed on the screen of the electronic device, which can be writing and drawing marks from the electronic pen, or application interface content on the electronic device; the content captured is not limited in this embodiment.

[0198] Thus, when a user uses an electronic pen to write or draw on an electronic device, and then wants to use functions other than writing, such as erasing, they do not need to use the pen tip to find and select the eraser tool on the electronic device. They can simply turn the electronic pen around and use the end of the pen to erase.

[0199] Optionally, the pen-end function mode can also be a writing function mode for special pens, which can be used to display the writing and drawing marks of special pens on the screen of electronic devices. The special pen can be a brush, watercolor brush, or other brush with a brush tip shape, structure, and material different from traditional electronic pens.

[0200] Optionally, the pen-end function mode can also be a control mode used to control the electronic device to perform the first operation. For example, when the electronic device is playing an audio-visual file, the pen-end function mode can be a fast-forward mode used to control the electronic device to perform a fast-forward operation on the audio-visual file. The pen-end function mode is not limited in this embodiment of the application, and can be reasonably set according to the actual situation.

[0201] S430: When the acceleration meets the second acceleration condition, the electronic pen is determined to be in the pen tip working state.

[0202] Refer to the aforementioned patterns and combine them with... Figures 5-8 It can be observed that the three-axis coordinate system corresponding to the sensor's orientation is as follows: Figure 5 The coordinate system O shown In xyz mode, when the screen of an electronic device is facing upwards and the tip of an electronic pen is pointing towards the screen, the acceleration value detected by the sensor inside the pen on the z-axis is negative and often at a specific negative bias value. Therefore, the electronic pen can directly identify whether the user is using the pen with the tip pointing towards the screen based on the acceleration value detected by the sensor inside the pen.

[0203] In this embodiment, the electronic pen can determine that it is in a pen tip working state when the acceleration detected by the sensor meets a second acceleration condition. The second acceleration condition refers to the numerical condition that the acceleration value of the electronic pen must meet when it is in the pen tip working state. The second acceleration condition corresponds to the pen tip working state. The second acceleration condition can be reasonably set according to specific application scenarios and can be pre-stored in the electronic pen; this embodiment does not impose specific limitations on it.

[0204] In this way, the electronic pen can accurately identify which end of the pen, the tip or the tail, is in contact with the screen based on the acceleration value detected by the sensor, without needing to use the tilt angle obtained by sensor integration. This solution eliminates the need for an additional device at the pen tail, ensuring the product's shape design, and also avoids the impact of error accumulation during the IMU device's calculation of the pen's tilt angle, guaranteeing the accuracy of the identification of both the pen tip and tail.

[0205] Optionally, the acceleration satisfying the second acceleration condition can be achieved by the electronic pen's first acceleration along the first axis satisfying the second acceleration condition. The first axis is parallel to the pen body. Therefore, when the electronic pen's first acceleration along the first axis satisfies the second acceleration condition, the electronic pen can determine that it is in a pen-tip working state. In this way, the electronic pen can identify whether the user is using the pen tip to contact the screen based solely on the acceleration value along a single axis, resulting in short calculation time and high real-time performance.

[0206] Optionally, when the direction pointed to by the first axis, i.e. the positive direction of the first axis, is the direction in which the tip of the electronic pen points to the tail of the pen, the second acceleration condition can be that the first acceleration of the electronic pen in the direction of the first axis is less than the second threshold.

[0207] For example, with Figure 5 Taking the coordinate system shown as an example, the first axis is the z-axis, parallel to the body of the electronic pen, and the positive direction of the z-axis is the direction from the tip of the electronic pen to the tail. The electronic pen can operate at an acceleration value a. z When the second acceleration condition is met, the electronic pen can determine that it is in pen tip working state. At this time, the second acceleration condition can be the acceleration value 'a' on the z-axis detected by the sensor. z Less than the second threshold.

[0208] Optionally, the second threshold can be the same as the first threshold. For example, with Figure 5 Taking the coordinate system shown as an example, both the second threshold and the first threshold can be 0, so the electronic pen can operate at acceleration values ​​a. z When the acceleration is less than 0, i.e., negative, it can be determined that the electronic pen is in pen tip working mode; the electronic pen can operate at acceleration values ​​a. z When the acceleration is greater than 0, i.e., a positive value, it can be determined that the electronic pen is in the end-of-pen working state. In this way, the electronic pen can identify its working state by simply setting a threshold value, based on the acceleration value detected within the pen.

[0209] Optionally, the second threshold may also be different from the first threshold. For example, the second threshold may be a negative value larger than the aforementioned negative bias value, such as -3. The second threshold is not limited in this embodiment and can be set reasonably according to actual conditions. In this way, the electronic pen can set a threshold reasonably for each different working state to accurately identify the working state of the electronic pen based on the acceleration value detected within the pen. The second threshold is not limited in this embodiment and can be set reasonably according to actual conditions.

[0210] Alternatively, referring to the aforementioned principle, the acceleration satisfying the second acceleration condition can also mean that the acceleration of the electronic pen on multiple axes all satisfy the second acceleration condition.

[0211] For example, with Figure 5Taking the coordinate system shown as an example, when the acceleration of the electronic pen on at least two of the x-axis, y-axis and z-axis satisfies the second acceleration condition, the electronic pen can determine that the electronic pen is in the pen tip working state.

[0212] As an example, when the acceleration of the electronic pen along the x-axis and y-axis satisfies the second acceleration condition, the electronic pen can determine that it is in the pen tip working state. In this case, the second acceleration condition can be the acceleration value 'a' of the electronic pen along the x-axis. x The acceleration value a on the y-axis is positive. y It is positive.

[0213] As an example, when the acceleration of the electronic pen along the x-axis and z-axis satisfies the second acceleration condition, the electronic pen can determine that it is in the pen tip working state. In this case, the second acceleration condition can be the acceleration value 'a' of the electronic pen along the x-axis. x The acceleration value a on the z-axis is positive. z It is negative.

[0214] As an example, when the acceleration of the electronic pen along the y-axis and z-axis satisfies the second acceleration condition, the electronic pen can determine that it is in the pen tip working state. In this case, the second acceleration condition can be the acceleration value 'a' of the electronic pen along the y-axis. y The acceleration value a on the z-axis is positive. z It is negative.

[0215] As an example, when the acceleration of the electronic pen along the x, y, and z axes satisfies the second acceleration condition, the electronic pen can be determined to be in a pen tip working state. In this case, the second acceleration condition can be the acceleration value 'a' of the electronic pen along the x and y axes. x a y The acceleration value a on the z-axis is positive. z It is negative.

[0216] Alternatively, referring to the aforementioned principle, the acceleration that satisfies the second acceleration condition can also be the acceleration calculated jointly by the three axes of x-axis, y-axis, and z-axis.

[0217] For example, with Figure 5 Taking the coordinate system shown as an example, when the combined acceleration of the electronic pen along the x, y, and z axes satisfies the second acceleration condition, the electronic pen can be determined to be in a pen tip working state. In this case, the second acceleration condition can be the acceleration value 'a' resulting from the combined calculation of the x, y, and z axes. y a y a z It is negative.

[0218] S440: The electronic pen sends the pen tip working status to the electronic device to indicate that the electronic device enters the pen tip function mode.

[0219] Optionally, when the electronic pen is determined to be in the pen tip working state, it can send the status information of this pen tip working state to the electronic device. Upon receiving the pen tip working state, the electronic device can determine that the user is currently using the pen tip, and can then invoke relevant processes or commands to enter the pen tip function mode corresponding to the pen tip working state, thereby realizing the pen tip function of the electronic pen.

[0220] Optionally, the pen tip function mode can be the basic function mode of an electronic pen, such as writing or clicking, and can be used to display the writing and drawing marks of a traditional electronic pen on the screen of an electronic device.

[0221] Optionally, the pen tip function mode can also be a control mode used to control the electronic device to perform a second operation. For example, when the electronic device is playing an audio-visual file, the pen tip function mode can be a rewind mode used to control the electronic device to perform a rewind operation on the audio-visual file. The pen tip function mode is not limited in this embodiment of the application, and can be reasonably set according to the actual situation.

[0222] It can be understood that S410 & S420 and S430 & S440 are parallel processes. The electronic pen either executes S410 & S420 to determine that the electronic pen's working state is the pen tail working state and sends the pen tail working state to the electronic device, or executes S430 & S440 to determine that the electronic pen's working state is the pen tip working state and sends the pen tip working state to the electronic device. In this way, regardless of whether the electronic pen is currently in the pen tail working state or the pen tip working state, the electronic pen can determine its working state and then instruct the electronic device to enter the corresponding functional mode based on the determined working state.

[0223] It should be noted that the pattern of acceleration values ​​detected by the sensors inside the electronic pen depends on the orientation of the sensors within the pen. In other words, when the sensor's orientation is relative to... Figure 5 When the sensors in the electronic device are placed in opposite directions, with the screen facing upwards and the two ends of the electronic pen pointing towards the screen, the acceleration values ​​detected by the sensors inside the electronic pen will also show an opposite pattern.

[0224] For example, please refer to Figure 9 Assume the coordinate system corresponding to the sensor's orientation is... Figure 9 The coordinate system O' shown x'y'z' is about to Figure 5 The coordinate system O shown x, y, and z are inverted by 180°. The coordinate system O' is... In the x'y'z' coordinate system, the z' axis remains parallel to the pen body, but the positive direction of the z' axis points from the pen tip to the pen body, while the negative direction points from the pen body to the pen tip. Coordinate system O' In x'y'z', the x' axis, y' axis, and z' axis are all orthogonal to each other, and the positive directions of the x' axis and y' axis can be determined based on the right-hand rule.

[0225] like Figure 9 As shown, with the screen of the electronic device facing upwards, when the tip of the stylus is pointing towards the screen, due to gravity F, the stylus experiences a decomposed force F' in the positive direction of the z' axis. z Correspondingly, the electronic pen has an acceleration a' in the positive direction of the z' axis. z Therefore, the acceleration value on the z' axis detected by the sensor can be as follows: Figure 8 As shown in curve 801, the acceleration value is positive and typically fluctuates around a positive bias value, such as... Figure 8 The value 5.0 corresponds to the dashed line 802.

[0226] Similarly, the three-axis coordinate system corresponding to the sensor's orientation is still [missing information]. Figure 9 The coordinate system O' shown x'y'z', the user rotates the pen's orientation. For example, as... Figure 10 As shown, with the screen of the electronic device facing upwards, when the tip of the stylus is pointing towards the screen, due to gravity F, the stylus experiences a decomposed force F' in the negative direction of the z-axis. z Correspondingly, the electronic pen experiences an acceleration a' in the negative direction of the z' axis. z Therefore, the acceleration value on the z' axis detected by the sensor can be as follows: Figure 6 As shown in curve 601, the acceleration value is negative and typically fluctuates around a negative bias value, such as... Figure 6 The value -5.0 corresponds to the dashed line 602.

[0227] from Figure 5 , Figure 7 , Figure 9 and Figure 10 It can be seen that when the orientation of the sensor is reversed, Figure 5 and Figure 7 The coordinate system O corresponding to the acceleration value acquired by the sensor during operation xyz, where the positive direction of the z-axis is the direction from the tip of the electronic pen to the end of the pen, is also flipped to... Figure 9 and Figure 10 The coordinate system O' shown x'y'z', where the positive direction of the z' axis is the direction from which the pen's tail points to its tip. Based on this, when the screen of the electronic device is facing upwards, when... Figure 9 and Figure 10 When the two ends of the electronic pen are pointed towards the screen of an electronic device, the acceleration values ​​detected by the sensors inside the pen show a pattern similar to... Figure 5 and Figure 7 When the two ends of the electronic pen are facing the screen of the electronic device, the acceleration values ​​detected by the sensors inside the pen show opposite patterns.

[0228] In other words, when the coordinate system corresponding to the acceleration value acquired by the sensor during operation is as follows: Figure 9 and Figure 10 O' shown When x'y'z', if the screen of the electronic device is facing upwards, and the end of the electronic pen is pointing towards the screen, the acceleration value detected by the sensor inside the electronic pen on the z-axis is negative and is usually at a specific negative bias value; if the tip of the electronic pen is pointing towards the screen, the acceleration value detected by the sensor inside the electronic pen on the z-axis is positive and is usually at a specific positive bias value.

[0229] therefore, Figure 9 and Figure 10 The numerical judgment conditions for the two working states of the electronic pen should also be consistent with... Figure 5 and Figure 7 The numerical decision conditions for the two working states of the electronic pen are opposite.

[0230] The orientation of the sensors in the electronic pen, such as Figure 5 and Figure 7 Taking the coordinate axes shown as an example, the positive direction of the z-axis is the direction from the tip of the electronic pen to the tail. The first acceleration condition for identifying the working state of the electronic pen's tail can be that the first acceleration of the electronic pen on the first axis is greater than a first threshold; the second acceleration condition for identifying the working state of the electronic pen's tip can be that the first acceleration of the electronic pen on the first axis is less than a second threshold.

[0231] The orientation of the sensors in the electronic pen, such as Figure 9 and Figure 10 Taking the coordinate system shown as an example, the positive direction of the first axis z' is the direction from the pen tail to the pen tip. The first acceleration condition used to identify the working state of the pen tail can be transformed into the first acceleration of the pen on the first axis being less than the second threshold; the second acceleration condition used to identify the working state of the pen tip can be transformed into the first acceleration of the pen on the first axis being greater than the first threshold.

[0232] It is understood that, due to the similarity of the principles, the possible implementation methods of the aforementioned first acceleration condition and second acceleration condition are also applicable here. They can be reasonably adjusted according to the situation, and will not be described again in the embodiments of this application.

[0233] It should be noted that the orientation of the sensors within the electronic pen described above is based on the z-axis of the coordinate system being parallel to the pen body. If the sensor orientation is based on the x-axis or y-axis of the coordinate system being parallel to the pen body, then, according to a similar principle, the electronic pen can also use the acceleration values ​​on the x-axis or y-axis to identify which end of the pen is currently facing the screen.

[0234] It is understood that the possible implementation methods used above for identifying the two ends of the electronic pen by using acceleration on the z-axis are also applicable here. They can be reasonably adjusted according to the situation, and will not be repeated in the embodiments of this application.

[0235] Furthermore, the conditions for determining the two working states of the electronic pen can be reversed in some special use cases. It's understandable that current electronic pens can be used not only with tablets, laptops, and other electronic devices on platforms like desktops, but also with tablets, mobile phones, smartwatches, and other electronic devices on non-platforms. For example, a user can use an electronic device equipped with an electronic pen while lying in bed. When a user uses an electronic device equipped with an electronic pen while lying in bed, the electronic device is inverted, which causes the way the electronic pen recognizes both ends to be reversed.

[0236] For example, please refer to Figure 11 Assuming the sensor's orientation corresponds to the three-axis coordinate system, Figure 5 The coordinate system O shown xyz. That is, coordinate system O. In the xyz coordinate system, the z-axis is parallel to the pen body, and the positive direction of the z-axis is the direction from the pen tip to the pen tail. In xyz, the x-axis, y-axis, and z-axis are all orthogonal to each other, and the directions of the x-axis and y-axis can be determined based on the right-hand rule.

[0237] When the pen tip is pointed towards the screen of the electronic device, since the device is inverted with the screen facing down, the pen's weight F has a decomposed force F in the positive direction of the z-axis. z Correspondingly, the electronic pen has an acceleration 'a' in the positive direction of the z-axis. z Therefore, the acceleration value on the z-axis detected by the sensor inside the electronic pen can be as follows: Figure 8 As shown in curve 801, the acceleration value is positive and typically fluctuates around a positive bias value, such as... Figure 8The value 5.0 corresponds to the dashed line 802.

[0238] In other words, when the electronic device is in an inverted state, with the pen tip pointing towards the screen, the acceleration values ​​detected by the sensors inside the pen exhibit the opposite pattern to those detected when the device is in an upright state, with the pen tip pointing towards the screen. Therefore, when the electronic device is in an inverted state, the criteria for determining the pen's two operating states should be reversed.

[0239] Optionally, when the electronic pen detects that the screen of the electronic device is facing down, the electronic pen can reverse the judgment conditions for the two working states.

[0240] The orientation of the sensors in the electronic pen, such as Figure 5 and Figure 7 Taking the example shown, the positive direction of the z-axis is the direction in which the tip of the electronic pen points to the end of the pen. When the electronic pen detects that the screen of the electronic device is facing down, the first acceleration condition used to identify the working state of the end of the electronic pen can be transformed into the first acceleration of the electronic pen on the first axis being less than the second threshold; the second acceleration condition used to identify the working state of the tip of the electronic pen can be transformed into the first acceleration of the electronic pen on the first axis being greater than the first threshold.

[0241] Similarly, if the sensor in the electronic pen is oriented as follows: Figure 9 and Figure 10 As shown, the positive direction of the first axis z' axis is the direction from the end of the electronic pen to the tip. When the electronic pen detects that the screen of the electronic device is facing down, the first acceleration condition for identifying the working state of the end of the electronic pen can be transformed into the first acceleration of the electronic pen on the first axis being greater than the first threshold; the second acceleration condition for identifying the working state of the tip of the electronic pen can be transformed into the first acceleration of the electronic pen on the first axis being less than the second threshold.

[0242] Optionally, the electronic device can detect its own posture information. Upon detecting a screen-down posture, it can send this posture information to the electronic pen. After receiving the screen-down posture information from the electronic device, the electronic pen can reverse the conditions for determining the pen tip and pen tail working states. Optionally, the electronic device can also send posture information other than screen-down to the electronic pen. After receiving non-screen-down posture information from the electronic device, the electronic pen can restore the initial conditions for determining the pen tip and pen tail working states.

[0243] Optionally, electronic devices are typically equipped with sensor devices similar to an IMU (Instrument Detector) that can detect the device's posture. Therefore, the electronic device can identify its posture information by using the method described above, which identifies the direction of the pen tip or end based on acceleration values. In this way, the electronic pen can also combine data from the electronic device's IMU to solve usage problems in special scenarios and improve the user experience. It is understood that the electronic device can also use posture recognition methods from other related technologies to identify its posture; the posture recognition method for the electronic device is not limited in this embodiment.

[0244] In this embodiment, after the electronic pen identifies its own working state and transmits its working state information to the electronic device so that the electronic device enters the functional mode corresponding to the working state, it can also adjust the functional parameters related to the functional mode according to the posture change information of the electronic pen.

[0245] The following assumes that the first and second thresholds are the same, and the orientation of the sensors in the electronic pen is as follows: Figure 5 and Figure 7 The technical solution provided in the embodiments of this application will be described using the example shown.

[0246] Please see Figure 12 , Figure 12 A flowchart illustrating a switching method for an electronic pen according to an embodiment of this application is shown. Figure 12 As shown, the switching method of the electronic pen may include:

[0247] S1201: The electronic pen determines whether the acceleration detected by the sensor is greater than the target threshold. If yes, proceed to S1203; otherwise, proceed to S1202.

[0248] Refer to the aforementioned principles, and combine them with... Figures 5-8 It can be observed that when the electronic pen is in the tip-operated state, the acceleration value detected by the sensor inside the pen on the z-axis is negative and often within a specific negative bias value; when the electronic pen is in the tail-operated state, the acceleration value detected by the sensor inside the pen on the z-axis is positive and often within a specific positive bias value. That is, when the electronic pen is in the two operating states, the acceleration value detected by the sensor exhibits two distinct numerical ranges.

[0249] Therefore, a target threshold can be set between the two separated numerical ranges. By judging the relationship between the acceleration currently detected by the sensor and the target threshold, it can be determined which numerical range the currently detected acceleration falls into, thereby identifying whether the electronic pen is in the pen tip working state or the pen tail working state.

[0250] The target threshold can be 0, or it can be a value between the negative bias value and the positive bias value mentioned above. This application embodiment does not make specific limitations on this, and it can be set reasonably according to the actual situation.

[0251] For example, when the target threshold is 0, if the electronic pen determines that the acceleration detected by the sensor is greater than 0 and the acceleration value is positive, then the electronic pen can be determined to be in the pen tail working state; if the electronic pen determines that the acceleration detected by the sensor is less than 0 and the acceleration value is negative, then the electronic pen can be determined to be in the pen tip working state.

[0252] S1202, the electronic pen is in pen tip working mode.

[0253] When an electronic pen determines that it is currently in pen tip working mode, it can send the status information of that pen tip working mode to the electronic device. After receiving the pen tip working mode status, the electronic device can determine that the user is currently using the pen tip, and can then invoke relevant processes or commands to enter the pen tip function mode corresponding to the pen tip working mode, thereby realizing the pen tip function of the electronic pen.

[0254] In some embodiments, when the electronic device determines that the electronic pen is in a pen tip working state, the electronic device and / or the electronic pen can detect whether the electronic pen is in contact with the touch screen of the electronic device. When the electronic device determines that the electronic pen is in contact with the touch screen of the electronic device, the electronic device can execute the pen tip function corresponding to the pen tip working state. For example, when the pen tip function mode is the writing mode of the electronic pen, the electronic device can display lines on the display screen that conform to the touch trajectory of the electronic pen in response to the touch operation of the electronic pen on the touch screen of the electronic device.

[0255] In some embodiments, the electronic device and / or electronic pen may not need to detect whether the electronic pen is in contact with the touchscreen of the electronic device. The user can remotely control or control the electronic device based on the pen tip posture. For example, when the electronic device is playing an audio or video file, if the electronic pen determines that it is currently in pen tip working state, the electronic pen can transmit the pen tip working state to the electronic device, and the electronic device can directly perform the fast forward operation of the audio or video file.

[0256] S1203, the electronic pen is in pen tail working state.

[0257] Optionally, when the electronic pen determines that it is currently in the pen tail working state, it can send the status information of this pen tail working state to the electronic device. After receiving the pen tail working state, the electronic device can determine that the user is currently using the pen tail end, and can then invoke relevant processes or commands to enter the pen tail function mode corresponding to the pen tail working state. In this way, when the user turns the direction of the electronic pen to use the pen tail function, the electronic device can accurately implement the pen tail function.

[0258] S1204: The electronic pen determines whether it is in contact with the touchscreen of the electronic device. If yes, proceed to S1205; otherwise, return to S1203.

[0259] In some embodiments, when the electronic device determines that the electronic pen is in the pen-end working state, the electronic device and / or the electronic pen can detect whether the electronic pen is in contact with the touch screen of the electronic device. When the electronic device determines that the electronic pen is in contact with the touch screen of the electronic device, the electronic device can execute the pen-end function corresponding to the pen-end working state. For example, when the pen-end function mode is the eraser mode of the electronic pen, the electronic device can display an eraser icon on the display screen.

[0260] In some embodiments, the electronic device and / or electronic pen may not need to detect whether the electronic pen is in contact with the touchscreen of the electronic device. The user can remotely control or control the electronic device based on the pen's end posture. For example, when the electronic device is playing an audio or video file, if the electronic pen determines that it is currently in the end-of-pen working state, the electronic pen can transmit the end-of-pen working state to the electronic device, and the electronic device can directly perform a fast-rewind operation on the audio or video file.

[0261] In this embodiment, when the electronic device enters the pen tail working state corresponding to the pen tail function mode or the pen tip working state corresponding to the pen tip function mode, the electronic device can also adjust the function parameters of the function mode according to the angle change of the electronic pen. For example, the line thickness parameter of the writing function mode, the radius parameter of the eraser, the radius parameter of the screenshot area, etc.

[0262] In some embodiments, when the electronic device enters the pen tail function mode corresponding to the pen tail working state or the pen tip function mode corresponding to the pen tip working state, the values ​​of various function parameters of the pen tail function mode or the pen tip function mode can be initialized to a default value, or they can be initialized to the parameter values ​​when the electronic device last exited the pen tail function mode or the pen tip function mode. The default value can be set by the system and the user, and this embodiment of the application does not limit this setting.

[0263] Optionally, each time one end of the electronic pen leaves the touchscreen of the electronic device and then touches the touchscreen again, the electronic device can initialize the values ​​of various function parameters of the function mode to default values, or initialize them to the values ​​when the electronic pen last left the touchscreen of the electronic device.

[0264] The following will use the pen tail function mode corresponding to the electronic device entering the pen tail working state as an example to illustrate the function parameter adjustment scheme provided in the embodiments of this application.

[0265] S1205: The electronic pen records the current sliding speed and angle of the electronic pen.

[0266] Because the various functional parameters of the pen's end-of-pen function are initialized every time the electronic pen leaves and re-enters the touchscreen, these parameters may not meet the user's needs. Therefore, it is necessary to adjust the pen's end-of-pen function parameters according to the user's requirements.

[0267] For example, when an electronic device performs the eraser function at the end of a pen, the device can display an eraser icon on the screen, and the eraser's radius parameter is initialized to the default radius r0. The user can adjust the eraser's radius parameter so that the eraser icon on the electronic device's screen can display corresponding changes.

[0268] In this embodiment, when contact between the electronic pen and the touchscreen of the electronic device is detected, the electronic pen and / or the electronic device can detect and record the pen's sliding speed and angle information, and then monitor the pen's angle change value in real time to adjust the functional parameters of the pen's tail function mode according to the angle change. Thus, when the user turns the pen to use the tail function, the user can adjust the parameters of the tail function by adjusting the pen's angle.

[0269] Optionally, each time the electronic pen first contacts the touchscreen of the electronic device, the electronic pen and / or the electronic device can detect and record the initial sliding speed v0 and initial angle information A0 of the electronic pen at that moment. The initial angle information A0 can be used as a reference value to determine the angle change value of the electronic pen. For example, the electronic pen and / or the electronic device can detect the real-time angle information of the electronic pen, and then subtract the initial angle information A0 from the real-time angle information to obtain the angle change value of the electronic pen.

[0270] It is understandable that regardless of the angle at which the electronic pen contacts the touchscreen of the electronic device, the electronic device can initialize the value of the pen tail function parameter to the default value, or it can initialize it to the value when the electronic pen last left the touchscreen. In other words, when the electronic pen detects and records its initial angle information A0, the pen tail function parameter is usually the initialization parameter. Then, the electronic device can adjust the pen tail function parameter from the initial parameter to the parameter corresponding to the angle change value based on the angle change value of the electronic pen relative to the initial angle information A0.

[0271] Optionally, the angle of the electronic pen can include the tilt angle and rotation angle. The tilt angle can refer to the angle between each axis of the sensor within the electronic pen and the corresponding axis in a coordinate system such as the world coordinate system. The rotation angle refers to the angle by which the sensor within the electronic pen rotates around each axis.

[0272] It is understandable that when the electronic pen is moved, its tilt or rotation angle may change unintentionally, causing unintentional changes to the parameters of the tail function. Therefore, to avoid the influence of this factor, this embodiment of the application determines whether the change in the electronic pen's angle is a change intentionally caused by the user or caused by the movement of the electronic pen, based on the sliding speed of the electronic pen. Thus, when the change in the electronic pen's angle is a change intentionally caused by the user, the functional parameters of the function mode can be changed accordingly; when the change in the electronic pen's angle is caused by the movement of the electronic pen, the functional parameters of the function mode do not need to be changed according to the change in angle.

[0273] Optionally, the sliding speed and angle information of the electronic pen can both be detected by the electronic pen itself. Alternatively, the sliding speed of the electronic pen can be detected by the electronic device, and the angle information of the electronic pen can be detected by the electronic pen itself. The methods for detecting the sliding speed and angle information of the electronic pen are not limited in this embodiment.

[0274] S1206: The electronic pen determines whether the sliding speed is greater than a preset speed threshold. If yes, return to S1205; otherwise, execute S1207.

[0275] Optionally, when a user intends to adjust the angle of the electronic pen, the user usually stops moving the pen, meaning the pen's sliding speed is typically low. Conversely, when a user does not wish to adjust the pen's angle, they typically move the pen to input information, at which point the pen's sliding speed is typically high. Therefore, in this embodiment, the electronic pen can determine whether its sliding speed exceeds a preset speed threshold V. S It determines whether the user intends to adjust the angle of the electronic pen.

[0276] Among them, the preset speed threshold V S This can be used to indicate the maximum sliding speed that the electronic pen can achieve when the electronic device can adjust the pen tail function mode. Optionally, a preset speed threshold V is provided. S This information can be pre-stored in the electronic pen, allowing the pen to determine the swiping speed. Optionally, a preset speed threshold V can be used. S Alternatively, the speed can be pre-stored in the electronic device, allowing the electronic pen to send the real-time detected swipe speed to the device for judgment. This can be understood as a preset speed threshold V. S The storage method and values ​​are not limited in this application embodiment, and can be reasonably set according to the actual situation.

[0277] Optionally, the electronic pen and / or electronic device can detect the sliding speed of the electronic pen at fixed intervals. The fixed interval can be set according to actual needs, and is not limited in the embodiments of this application.

[0278] Optionally, the sliding speed being greater than the preset speed threshold can be either the average value of the sliding speeds detected in multiple consecutive cycles being greater than the preset speed threshold, or the sliding speed detected in the most recent cycle being greater than the preset speed threshold.

[0279] Optionally, if the electronic pen determines the sliding speed, when it detects a sliding speed greater than a preset speed threshold, it can assume the user is unlikely to adjust the pen's angle, and the user may be performing writing or other information input operations. Therefore, the electronic pen can refrain from sending angle change information to the electronic device and continue monitoring the sliding speed and angle change information. In this case, the electronic device will not adjust the function parameters of the pen tail function mode based on the pen's angle change. This achieves locking of relevant function parameters during the pen's sliding process, avoiding changes in function parameters caused by angle changes during pen sliding. Alternatively, when the electronic pen detects a sliding speed that is not greater than, i.e., less than or equal to, the preset speed threshold, it can assume the user is likely to adjust the pen's angle, and the user may not be performing writing or other information input operations. In this case, the electronic pen can send angle change information to the electronic device, allowing the electronic device to adjust the pen tail function parameters of the pen tail function mode based on the pen's angle change.

[0280] Optionally, if the electronic device determines the sliding speed of the electronic pen, the electronic pen can send its sliding speed information to the electronic device. When the electronic device detects that the sliding speed is greater than a preset speed threshold, it can assume that the user intends to adjust the pen's angle, and therefore the electronic device does not need to adjust the function parameters of the pen tail mode based on the pen's angle change. When the electronic device detects that the sliding speed is not greater than the preset speed threshold, it can assume that the user intends to adjust the pen's angle, and therefore the electronic device can adjust the function parameters of the pen tail mode based on the pen's angle change. Optionally, the electronic device can also directly detect the sliding speed of the electronic pen, allowing it to directly determine the sliding speed.

[0281] S1207: The electronic pen determines whether the angle change value is greater than the preset angle threshold. If yes, execute S1208; otherwise, return to S1205.

[0282] S1208: The electronic pen instructs the electronic device to adjust the pen tail function parameters corresponding to the pen tail function mode based on the angle change value.

[0283] In this embodiment of the application, when the sliding speed of the electronic pen is not greater than, i.e. less than or equal to, a preset speed threshold V... SAt this point, it can be preliminarily assumed that the user intends to adjust the angle of the electronic pen. The electronic pen can then detect its current angle information A1 and, based on A1 and its initial angle information A0, determine the angle change value. Optionally, the angle change value can be the difference between the current angle information A1 and the initial angle information A0, A1 - A0.

[0284] The angle change value of the electronic pen reflects the magnitude of the angle change, such as decreasing the angle by a certain value or increasing the angle by a certain value. The preset angle threshold indicates the minimum angle change required for the electronic pen to adjust the function parameters of the pen tail mode. The specific preset angle threshold is not limited in this embodiment; it can be set reasonably according to actual conditions. For example, the preset angle threshold could be 5°.

[0285] Optionally, whether the angle change value is greater than a preset angle threshold can be determined by whether the absolute value of the angle change value, |A1-A0|, is greater than the preset angle threshold △A. The absolute value of the angle change value reflects the magnitude of the angle change of the electronic pen.

[0286] Optionally, when the angle change of the electronic pen exceeds a preset angle threshold, the angle change is relatively large. The electronic device can assume that the user intends to adjust the angle of the electronic pen, and thus adjust the pen tail function parameters corresponding to the pen tail function mode based on the angle change value A1-A0. When the angle change of the electronic pen does not exceed the preset angle threshold, the angle change is relatively slight. The electronic device can assume that the angle change may not have occurred intentionally, and may not adjust the pen tail function parameters corresponding to the pen tail function mode, maintaining the current function parameter value.

[0287] It should be noted that this application adjusts the function parameters by changing the angle value, rather than by directly adjusting the function parameters based on the angle obtained from the integration calculation of the IMU device. This avoids the impact of error accumulation caused by using the IMU device to calculate tilt and rotation angles over a long period of time, thereby achieving accurate control of the function parameters.

[0288] Optionally, taking the eraser mode as an example, the pen tail function parameters may include the eraser radius and / or eraser opacity. The electronic pen can instruct the electronic device to adjust the eraser radius based on the angle change of the tilt angle, or it can instruct the electronic device to adjust the eraser opacity based on the angle change of the rotation angle. Alternatively, the electronic pen can instruct the electronic device to adjust the eraser radius based on the angle change of the rotation angle, or it can instruct the electronic device to adjust the eraser opacity based on the angle change of the tilt angle.

[0289] Optionally, taking the pen-tail function mode as a screenshot mode as an example, the pen-tail function parameters may include the radius of the screenshot area. The electronic pen can instruct the electronic device to adjust the radius of the screenshot area based on the angle change value of the tilt angle, or it can instruct the electronic device to adjust the radius of the screenshot area based on the angle change value of the rotation angle.

[0290] Optionally, the electronic pen can store the correspondence between angle change values ​​and pen tail parameter change values. This allows the electronic pen to adjust the pen tail function parameters corresponding to the pen tail function mode based on the real-time monitored angle change values, and send the adjusted pen tail function parameters to the electronic device to instruct the electronic device to adjust the pen tail function parameters corresponding to the pen tail function mode accordingly. For example, when the pen tail function mode is eraser mode, the electronic pen can increase the eraser radius parameter based on the real-time monitored angle change values. The electronic device can then display the eraser icon and the erasing effect based on the increased eraser radius.

[0291] Optionally, the electronic device may also store the correspondence between angle change values ​​and pen tail parameter change values, so that the electronic pen can send the real-time monitored angle change values ​​to the electronic device, and the electronic device can adjust the pen tail function parameters corresponding to the pen tail function mode according to the angle change values ​​of the electronic pen.

[0292] Optionally, the sign of the angle change value can correspond to the sign of the parameter change value. For example, when the angle change value A1-A0 is positive, the parameter change value can be positive, meaning the electronic device can increase the function parameter value. Conversely, when the angle change value A1-A0 is negative, the parameter change value can be negative, meaning the electronic device can decrease the function parameter value.

[0293] Optionally, the correspondence between the angle change value and the pen tail parameter change value can be obtained in advance based on a large number of experiments, or it can be set by the user. This application embodiment does not limit this.

[0294] Optionally, after the electronic device adjusts its function parameters, if the user needs to readjust the function parameters after using the electronic pen for a period of time, or if the electronic pen leaves the touchscreen of the electronic device and then re-enters the touchscreen, the electronic pen needs to re-record and detect the current sliding speed v0 and angle information A0. The recorded angle information A0 can be used as a new reference value to determine the angle change value of the electronic pen, which can be understood as reference value initialization. Then, the electronic device can monitor the angle change value of the electronic pen in real time based on the current angle information A0, and readjust the function parameters of the pen's tail function mode according to the angle change.

[0295] Alternatively, when the electronic pen first comes into contact with the touchscreen of the electronic device, the user may not adjust the pen's function parameters initially; that is, the user can write directly on the electronic device without adjusting the pen's angle. The user can then adjust the pen's function parameters after using it for a period of time.

[0296] It's understandable that regardless of whether the user adjusts the pen's function parameters when it first comes into contact with the electronic device's touchscreen, the user can readjust these parameters by adjusting the pen's angle after using it for a period of time. However, since the pen has already been used for some time before this angle adjustment, and the pen's angle has changed during that time, the change in angle cannot be determined based on the initial angle when the pen first came into contact with the electronic device. Therefore, it's necessary to acquire and record the new initial angle of the pen at the time of this adjustment.

[0297] Since users typically stop moving the stylus after using it for a while and intend to adjust its angle, meaning the stylus's sliding speed becomes relatively low, the stylus can optionally be adjusted so that its sliding speed on the electronic device's touchscreen is less than or equal to a preset speed threshold V. S At that moment, the angle information of the electronic pen is acquired and recorded as the new initial angle for adjusting the electronic pen.

[0298] In other words, the electronic pen can detect when its sliding speed on the touchscreen of the electronic device is less than or equal to a preset speed threshold V. S When the pen's sliding speed becomes relatively low, it can be considered that the pen has entered an angle adjustment state. Therefore, when the pen's sliding speed on the electronic device's touchscreen is detected to be less than or equal to a preset speed threshold V, the pen is considered to be in a position to adjust its angle. S At this moment, the electronic pen can detect and record its angle information A0 as a new initial angle. This new initial angle can be used as a new reference value to determine the angle change value of the electronic pen, i.e., reference value initialization.

[0299] It is understandable that the above method of determining a new initial angle can also be performed by an electronic device, with the electronic pen only responsible for detecting and sending the pen's angle information to the electronic device.

[0300] For example, taking the pen tail function mode as the eraser and the function parameter as the eraser radius as an example. Figure 13 Images (a) through (f) illustrate the effect of an electronic device adjusting the eraser size based on the tilt angle of the electronic pen. Figure 13 In each of the diagrams (a) to (f), the diagram at the top is a top-down view, and the diagram at the bottom is a level view.

[0301] Please see Figure 13 In (a), the user places the electronic pen with the tip facing down. At this time, the electronic pen can detect that its internal sensors, such as an IMU, measure an acceleration value for single-axis or multi-axis combined operations that is less than a target threshold, thus determining that the electronic pen is in the tip-operated state. The electronic pen can then transmit this tip-operated state information to the electronic device via a communication unit.

[0302] Please see Figure 13 In (b), the user begins to draw using the tip of the electronic pen. At this time, the electronic device and / or the electronic pen detect that the electronic pen is in contact with the touch screen of the electronic device, and the electronic device is aware that the electronic pen is in the pen tip working state. Therefore, the electronic device performs the writing function corresponding to the pen tip working state, such as drawing lines, and displays lines on the display screen that conform to the writing trajectory of the electronic pen.

[0303] Please see Figure 13 In step (c), the user rotates the electronic pen, bringing the pen's end into contact with the electronic device's touchscreen. At this point, the electronic pen detects that its internal sensors measure an acceleration value greater than a target threshold for single-axis or multi-axis combined computation, confirming that the pen is in the pen-end working state. The electronic pen transmits this pen-end working state information to the electronic device via a communication unit. The electronic device and / or the electronic pen detect the contact between the pen and the touchscreen, and the electronic device is aware that the pen is in the pen-end working state. Therefore, the electronic device executes the eraser function corresponding to this pen-end working state and displays an eraser icon on the screen, with the eraser radius being the default radius r0. The electronic pen and / or the electronic device can measure the pen's sliding speed at this moment as v0, where v0 is less than a preset speed threshold V. S Meanwhile, the electronic pen can measure and record the tilt angle of the electronic pen at this time as a0, and this tilt angle a0 can be used as a reference value for determining the subsequent angle change value.

[0304] Please see Figure 13 In step (d), the user adjusts the tilt angle of the electronic pen. At this time, the electronic pen and / or electronic device measure the pen's sliding speed as v1. Since the slight speed caused by the user adjusting the tilt angle is less than the preset speed threshold Vs, the change in the pen's tilt angle can be considered to be intentional on the user's part. The electronic pen measures the tilt angle as a1. If the absolute value of a1 - a0 is greater than the preset angle threshold Δa, the size of the eraser, such as its radius, can change according to the correspondence between the change in tilt angle and the change in eraser size; for example, the eraser radius increases from r0 to r1. The eraser icon on the electronic device's display screen can show the corresponding change, such as... Figure 13 (c) to Figure 13The circle in (d) is enlarged. It can be understood that if the absolute value of a1-a0 is less than the preset angle threshold △a, the radius of the eraser will not change.

[0305] Please see Figure 13 In step (e), after the electronic device adjusts the eraser size, the user begins erasing. At this time, the electronic pen and / or electronic device can measure the pen's sliding speed as v2, which is greater than a preset speed threshold V. S The electronic pen measures the tilt angle as a2 at this moment. Although the tilt angle has changed, the sliding speed v2 > V. S The electronic device can assume that the change in tilt angle is caused by the sliding process and is not a change caused by the user's intention. Therefore, the electronic device does not need to adjust the parameters of the eraser mode, and the radius of the eraser is locked at r1.

[0306] Please see Figure 13 In step (f), the user stops erasing and needs to readjust the function parameters. At this point, the user no longer moves the electronic pen rapidly, and the electronic pen and / or electronic device measures the pen's sliding speed at this moment as v3, which is less than the preset speed threshold V. S Due to potential changes during the swiping process, the tilt angle may no longer be a1 as it was at the start of erasing. Therefore, the pen needs to be remeasured and recorded as a3. Since this adjustment is based on the previous adjustment, the angle change cannot be determined based on the initial tilt angle a0. Therefore, the remeasured and recorded tilt angle a3 needs to be used as the benchmark for determining subsequent angle changes.

[0307] Please see Figure 13 In step (g), the user readjusts the tilt angle of the electronic pen. At this point, the electronic pen and / or electronic device measures the pen's sliding speed as v4, which is less than the preset speed threshold V. S The tilt angle change of the electronic pen can be considered to be a result of the user's intention. The electronic pen measures the tilt angle at this moment as a4. If the absolute value of a4-a3 is greater than the preset angle threshold △a, the size of the eraser, such as its radius, changes according to the correspondence between the change in tilt angle and the change in eraser size; for example, the eraser radius decreases from r1 to r2. The eraser icon on the electronic device's display screen can show the corresponding change, such as... Figure 13 (f) in Figure 13 The circle reduction effect compared to (g) in the text. It can be understood that if the absolute value of a4-a3 is less than the preset angle threshold △a, then the radius of the eraser will not change.

[0308] Please see Figure 13In step (h), the user begins fine-tuning the eraser. At this point, the electronic pen and / or electronic device measures the pen's sliding speed as v5, which is greater than a preset speed threshold V. S The electronic pen measures the pen's tilt angle as a5 at this moment. Although the tilt angle has changed, the sliding speed v5 > V S The electronic device can assume that the change in tilt angle is caused by the sliding process and is not a change caused by the user's intention. Therefore, the electronic device does not need to adjust the parameters of the eraser mode, and the radius of the eraser is locked at r2.

[0309] For example, let's take the pen tail function mode as the eraser and the function parameter as the eraser opacity as an example. Figure 14 Images (a) through (h) illustrate the effect of an electronic device adjusting the eraser opacity based on the rotation angle of the electronic pen. Figure 14 In each of the diagrams (a) to (h), the top diagram is a top-down view, and the bottom diagram is a level view. The dots on the pen are used to indicate the rotation of the pen.

[0310] Please see Figure 14 In (a), the user places the electronic pen with the tip facing down. At this time, the electronic pen can detect that its internal sensors, such as an IMU, measure an acceleration value for single-axis or multi-axis combined operations that is less than a target threshold, thus determining that the electronic pen is in the tip-operated state. The electronic pen can then transmit this tip-operated state information to the electronic device via a communication unit.

[0311] Please see Figure 14 In (b), the user begins to draw using the tip of the electronic pen. At this time, the electronic device and / or the electronic pen detect that the electronic pen is in contact with the touch screen of the electronic device, and the electronic device is aware that the electronic pen is in the pen tip working state. Therefore, the electronic device performs the writing function corresponding to the pen tip working state, such as drawing lines, and displays lines on the display screen that conform to the writing trajectory of the electronic pen.

[0312] Please see Figure 14 In step (c), the user rotates the electronic pen, bringing the pen's end into contact with the touchscreen of the electronic device. At this point, the electronic pen detects that its internal sensors measure an acceleration value greater than a target threshold for single-axis or multi-axis combined computation, confirming that the pen is in the pen-end working state. The electronic pen transmits this pen-end working state information to the electronic device via a communication unit. The electronic device and / or the electronic pen detect the contact between the pen and the touchscreen, and the electronic device is aware that the pen is in the pen-end working state. Therefore, the electronic device executes the eraser function corresponding to this pen-end working state and displays an eraser icon on the screen. The eraser opacity is the default opacity t0. The electronic pen and / or the electronic device can measure the pen's sliding speed at this time as v0, which is less than a preset speed threshold V.S Meanwhile, the electronic pen can measure and record the tilt angle of the electronic pen at this time as b0, and this tilt angle b0 can be used as a reference value for determining the subsequent angle change value.

[0313] Please see Figure 14 In step (d), the user rotates the pen counterclockwise to adjust its rotation angle. At this time, the pen and / or electronic device measure the pen's sliding speed as v1. The slight speed caused by the user adjusting the rotation angle is less than a preset speed threshold V. S Therefore, the change in the pen's rotation angle can be considered to be caused by the user's intention. The pen measures its rotation angle as b1. If the absolute value of b1-b0 is greater than a preset angle threshold Δb, the eraser's opacity can change according to the correspondence between the change in rotation angle and the change in eraser opacity; for example, the eraser opacity decreases from t0 to t1. The eraser icon on the electronic device's display screen can show the corresponding change, such as... Figure 14 (c) to Figure 14 The circle in (d) changes from opaque black to transparent white. It can be understood that if the absolute value of b1-b0 is less than the preset angle threshold △b, the eraser's opacity will not change.

[0314] Please see Figure 14 In step (e), after the electronic device adjusts the eraser's opacity, the user begins erasing. At this point, the electronic pen and / or electronic device can measure the pen's sliding speed as v2, which is greater than a preset speed threshold V. S The electronic pen measures the rotation angle as b2 at this moment. Although the rotation angle has changed, the sliding speed v2 > V. S The electronic device can assume that the change in rotation angle is caused by the sliding process and is not a change caused by the user's intention. Therefore, the electronic device does not need to adjust the parameters of the eraser mode, and the opacity of the eraser is locked at t1.

[0315] Please see Figure 14 In step (f), the user stops erasing and needs to readjust the function parameters. At this point, the user no longer moves the electronic pen rapidly, and the electronic pen and / or electronic device measures the pen's sliding speed at this moment as v3, which is less than the preset speed threshold V. S Due to potential changes during the sliding process, the rotation angle may no longer be b1 as it was at the start of erasing. Therefore, the pen needs to be remeasured and recorded as b3. Since this adjustment is based on the previous one, the angle change cannot be determined based on the initial tilt angle b0. Therefore, the remeasured and recorded rotation angle b3 needs to be used as the benchmark for determining subsequent angle changes.

[0316] Please see Figure 14 In step (g), the user rotates the pen clockwise to readjust the pen's rotation angle. At this point, the pen and / or electronic device measures the pen's sliding speed as v4, which is less than a preset speed threshold V. S The slight speed decrease caused by the user adjusting the rotation angle is less than the preset speed threshold V. S Therefore, the change in the pen's rotation angle can be considered to be caused by the user's intention. The pen measures the rotation angle at this moment as b4. If the absolute value of b4-b3 is greater than the preset angle threshold Δb, the eraser's opacity changes according to the correspondence between the change in rotation angle and the change in eraser opacity, for example, the eraser opacity increases from t1 to t2. The eraser icon on the electronic device's display screen can show the corresponding change, such as... Figure 14 (d) in Figure 14 The effect of the eraser changing from transparent white to opaque black is compared to (g) in the text. It can be understood that if the absolute value of b4-b3 is less than the preset angle threshold △b, the opacity of the eraser will not change.

[0317] Please see Figure 14 In step (h), the user begins erasing again. At this point, the electronic pen and / or electronic device measures the pen's sliding speed as v5, which is greater than a preset speed threshold V. S The electronic pen measures the pen's rotation angle as b5 at this moment. Although the rotation angle has changed, the sliding speed v5 > V. S The electronic device can assume that the change in rotation angle is caused by the sliding process and is not a change caused by the user's intention. Therefore, the electronic device does not need to adjust the parameters of the eraser mode, and the opacity of the eraser is locked at t2.

[0318] For example, taking the pen tail function mode as the screenshot mode and the function parameter as the screenshot radius as an example. Figure 15 Images (a) through (e) illustrate the effect of an electronic device adjusting the screenshot area based on the tilt angle of the electronic pen. Figure 15 In each of the diagrams (a) to (e), the diagram at the top is a top-down view, and the diagram at the bottom is a level view.

[0319] Please see Figure 15 In (a), the user has just finished drawing using the tip of the electronic pen. At this time, the electronic pen can detect that the acceleration value of single-axis or multi-axis joint operation measured by the sensor inside the pen, such as the IMU, is less than the target threshold, and can determine that the electronic pen is in the pen tip working state. The electronic pen can transmit this pen tip working state information to the electronic device through the communication unit.

[0320] Please see Figure 15In (b), the user rotates the electronic pen, bringing the pen's end into contact with the touchscreen of the electronic device. At this point, the electronic pen detects that its internal sensors measure an acceleration value greater than a target threshold for single-axis or multi-axis combined computation, confirming that the pen is in the pen-end working state. The electronic pen can transmit this pen-end working state information to the electronic device via a communication unit. The electronic device and / or the electronic pen detect the contact between the pen and the touchscreen, and the electronic device is aware that the pen is in the pen-end working state; therefore, the electronic device executes the screenshot function corresponding to this pen-end working state. The electronic pen and / or the electronic device can measure the pen's sliding speed at this moment as v0, where v0 is less than a preset speed threshold V. S Meanwhile, the electronic pen can measure and record the tilt angle of the electronic pen at this time as a0.

[0321] Please see Figure 15 In (c), the user selects the part they want to capture. At this time, the electronic pen and / or electronic device measures the pen's sliding speed as v1, which is greater than a preset speed threshold V. S The electronic pen measures the pen's tilt angle as a1 at this moment. Although the tilt angle has changed, the sliding speed v1 > V S The electronic device can assume that the change in tilt angle is caused by the sliding process and not by the user's intention. Therefore, the electronic device does not need to adjust the screenshot mode parameters, and the screenshot range will not change.

[0322] Please see Figure 15 In step (d), the user completes the screenshot. At this point, the user stops moving the stylus rapidly, and the stylus and / or electronic device measures the stylus's sliding speed as v2, which is less than a preset speed threshold V. S Since users may need to adjust the screenshot area based on the pen's tilt angle, the pen can measure and record the current tilt angle as a2. The radius of the screenshot area is r0. This tilt angle a2 can be used as a reference value for determining subsequent angle changes.

[0323] Please see Figure 15 In step (e), the user adjusts the tilt angle of the electronic pen. At this time, the electronic pen and / or electronic device measures the pen's sliding speed as v3. The slight speed decrease caused by the user adjusting the tilt angle is less than the preset speed threshold V. S Therefore, the change in the pen's tilt angle can be considered to be intentional on the user's part. The pen measures the tilt angle at this moment as a3. If the absolute value of a3-a2 is greater than the preset angle threshold △a, the radius of the screenshot area changes according to the correspondence between the change in tilt angle and the change in the radius of the screenshot area. For example, the radius of the screenshot area r0 increases to r1. The screenshot area indicator on the screen can display the corresponding change, such as... Figure 15(d) to Figure 15 The effect of circles (e) increasing in size. If the absolute value of a3-a2 is less than the preset angle threshold △a, the radius of the screenshot area will not change.

[0324] In this embodiment of the application, the electronic pen may also identify whether the angle change of the electronic pen is a change caused by the user's intention, rather than by the sliding speed.

[0325] Please see Figure 16 , Figure 16 A flowchart illustrating a switching method for an electronic pen according to an embodiment of this application is shown. Figure 16 As shown, the switching method of the electronic pen may include:

[0326] S1601: The electronic pen determines whether the acceleration detected by the sensor is greater than the target threshold. If yes, proceed to S1603; otherwise, proceed to S1602.

[0327] S1602, the electronic pen is in pen tip working mode.

[0328] S1603, the electronic pen is in pen tail working state.

[0329] S1604: The electronic pen determines whether it is in contact with the touchscreen of the electronic device. If yes, proceed to S1605; otherwise, return to S1603.

[0330] S1605, The electronic pen records the current angle of the electronic pen.

[0331] S1606: The electronic pen determines whether the angle change value is greater than the preset angle threshold. If yes, proceed to S1607; otherwise, return to S1605.

[0332] S1607. The electronic pen instructs the electronic device to adjust the pen tail function parameters corresponding to the pen tail function mode based on the angle change value.

[0333] It's understandable that when a user intends to adjust the pen's angle, the change in angle is usually quite significant. Conversely, when a user doesn't intend to adjust the pen's angle, they typically move the pen to input information, and the angle change during this movement is usually minimal. Therefore, by setting a pre-defined angle threshold, minute angle changes during pen movement can be filtered out, allowing for accurate identification of the user's intended angle change. This eliminates the need to use swiping speed as a criterion, reducing power consumption and latency.

[0334] Optionally, when the angle change of the electronic pen is greater than a preset angle threshold, the electronic pen can consider the current angle change of the electronic pen as the angle change desired by the user, and the electronic pen can instruct the electronic device to adjust the pen tail function parameters corresponding to the pen tail function mode according to the angle change value.

[0335] Optionally, if the angle change of the electronic pen is not greater than a preset angle threshold, the electronic pen may consider the current angle change of the electronic pen to be an angle change that is not intended by the user, and the electronic pen may not instruct the electronic device to adjust the pen tail function parameters of the pen tail function mode.

[0336] In summary, this application provides a method and device for switching electronic pens. By utilizing only the acceleration values ​​detected by sensors within the electronic pen, it can identify which end of the pen is currently facing the screen, thus accurately realizing the pen tip and tail functions. Furthermore, the electronic pen can, in conjunction with an electronic device, record the angle when either end of the pen contacts the touchscreen of the electronic device, and then monitor the change in this angle in real time. Based on the correspondence between the angle change values ​​and parameter change values ​​in the memory, relevant functional parameters are adjusted. This eliminates the need for additional devices at the pen tail, ensuring the product's shape design, and avoids the impact of error accumulation during the IMU device's calculation of the pen's tilt angle, guaranteeing the accuracy of pen tail recognition.

[0337] It is understood that the aforementioned electronic pen or electronic device, in order to achieve the above functions, includes hardware and / or software modules corresponding to the execution of each function. Based on the algorithm steps of the various examples described in conjunction with the embodiments disclosed herein, this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed in hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application in conjunction with the embodiments, but such implementation should not be considered beyond the scope of this application.

[0338] This embodiment can divide the electronic pen or electronic device into functional modules according to the above method example. For example, each function can be divided into its own functional modules, or two or more functions can be integrated into one processing module. The integrated modules can be implemented in hardware. It should be noted that the module division in this embodiment is illustrative and only represents one logical functional division. In actual implementation, there may be other division methods.

[0339] When using integrated units, both the electronic pen and the electronic device can include a processing module, a storage module, and a communication module. The processing module of the electronic pen can be used to control and manage the pen's actions. The storage module of the electronic pen can support the storage of program code and data. The communication module of the electronic pen can support communication between the electronic pen and other devices, such as electronic devices. Similarly, the processing module of the electronic device can be used to control and manage the actions of the electronic device. The storage module of the electronic device can support the storage of program code and data. The communication module of the electronic device can support communication between the electronic device and other devices, such as the electronic pen.

[0340] The processing module can be a processor or a controller. It can implement or execute various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. The processor can also be a combination of functions that implement computing capabilities, such as a combination of one or more microprocessors, a combination of digital signal processing (DSP) and a microprocessor, etc. The storage module can be a memory. The communication module can be a radio frequency circuit, a Bluetooth chip, a Wi-Fi chip, or other electronic devices.

[0341] In one embodiment, when the processing module is a processor and the storage module is a memory, the structure of the electronic pen involved in this embodiment can be referred to... Figure 2A and Figure 2B The structure of the electronic pen shown in this embodiment can be referenced from the structure of the electronic device involved in this embodiment. Figure 3 The structure of the electronic device shown.

[0342] Other embodiments of this application also provide a switching device for an electronic pen, which can be applied to the aforementioned electronic pen. This device is used to perform various functions or steps performed by the electronic pen in the above method embodiments.

[0343] Other embodiments of this application also provide a switching device for an electronic pen, which can be applied to the aforementioned electronic device. This device is used to perform various functions or steps performed by the electronic device in the above method embodiments.

[0344] Other embodiments of this application also provide an electronic device including the aforementioned electronic pen. The electronic device is communicatively connected to the electronic pen, which includes a sensor for detecting the pen's acceleration. The electronic pen is used to perform the various functions or steps performed by the electronic pen in the above method embodiments, and the electronic device is used to perform the various functions or steps performed by the electronic device in the above method embodiments.

[0345] This application also provides a chip system including at least one processor and at least one interface circuit. The processor and the interface circuit are interconnected via lines. The interface circuit can read instructions stored in memory and send the instructions to the processor. When the instructions are executed by the processor, an electronic pen or electronic device can perform the steps in the above embodiments. Of course, the chip system may also include other discrete devices, and this application does not specifically limit this.

[0346] This application also provides a computer storage medium including computer instructions. When the computer instructions are executed on the electronic pen, the electronic pen performs the various functions or steps performed by the electronic pen in the above method embodiments. When the computer instructions are executed on the electronic device, the electronic device performs the various functions or steps performed by the electronic device in the above method embodiments.

[0347] This application also provides a computer program product that, when run on a computer, causes the computer to perform various functions or steps performed by the mobile phone or electronic device in the above method embodiments.

[0348] In this embodiment, the electronic pen, electronic device, electronic device, computer storage medium, computer program product or chip are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can be referred to the beneficial effects in the corresponding methods provided above, and will not be repeated here.

[0349] Through the above description of the embodiments, those skilled in the art can clearly understand that, for the sake of convenience and brevity, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

[0350] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another apparatus, or some features may be ignored or not executed. Furthermore, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.

[0351] The units described as separate components may or may not be physically separate. A component shown as a unit can be one or more physical units; that is, it can be located in one place or distributed in multiple different locations. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0352] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0353] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solutions of the embodiments of this application, essentially, or the parts that contribute to the prior art, or all or part of the technical solutions, can be embodied in the form of a software product. This software product is stored in a storage medium and includes several instructions to cause a device, such as a microcontroller, chip, or processor, to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0354] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A switching method for an electronic pen, characterized in that, Applied to an electronic pen, the electronic pen being communicatively connected to an electronic device, the electronic pen including a sensor, the method includes: The sensor inside the electronic pen detects acceleration, and when the acceleration meets a first acceleration condition, it is determined that the electronic pen is in the pen tail working state. Send the pen tail working status to the electronic device to instruct the electronic device to enter the pen tail function mode; or, When the acceleration satisfies the second acceleration condition, the electronic pen is determined to be in the pen tip working state; Send the pen tip working status to the electronic device to instruct the electronic device to enter the pen tip function mode; The first acceleration condition and the second acceleration condition are dynamically set based on the screen state of the electronic device; the screen state includes a screen-up state or a screen-down state; when the screen state is a screen-up state, the first acceleration condition and the second acceleration condition are set according to a first setting strategy; when the screen state is a screen-down state, the first acceleration condition and the second acceleration condition are set according to a second setting strategy.

2. The method according to claim 1, characterized in that, The first acceleration condition in the first setting strategy includes the acceleration being greater than a first threshold, and the second acceleration condition in the first setting strategy includes the acceleration being less than a second threshold, wherein the second threshold is equal to or less than the first threshold; the first acceleration condition in the second setting strategy includes the acceleration being less than a second threshold, wherein the second threshold is equal to or less than the first threshold, and the second acceleration condition in the second setting strategy includes the acceleration being greater than the first threshold.

3. The method according to claim 1, characterized in that, The first acceleration condition in the first setting strategy includes: the acceleration is less than a second threshold; the second acceleration condition in the first setting strategy includes: the acceleration is greater than a first threshold, and the second threshold is equal to or less than the first threshold; the first acceleration condition in the second setting strategy includes: the acceleration is greater than the first threshold; the second acceleration condition in the second setting strategy includes: the acceleration is less than the second threshold, and the second threshold is equal to or less than the first threshold.

4. The method according to any one of claims 1-3, characterized in that, The acceleration is an acceleration along a first axis, which is parallel to the body of the electronic pen; or, the acceleration is an acceleration calculated by combining multiple axis directions, including the first axis direction.

5. The method according to any one of claims 1-3, characterized in that, The sensor is also used to detect the angle information of the electronic pen, the angle information including tilt angle and / or rotation angle. After sending the pen tail working status to the electronic device, the method further includes: Based on the angle change value of the angle information, the electronic device is instructed to adjust the pen tail function parameters corresponding to the pen tail function mode, where the angle change value is greater than a preset angle threshold. or, After sending the pen tip operating status to the electronic device, the method further includes: Based on the angle change value of the angle information, the electronic device is instructed to adjust the pen tip function parameters corresponding to the pen tip function mode, where the angle change value is greater than a preset angle threshold.

6. The method according to claim 5, characterized in that, The angle change value is the angle difference between the current angle and the initial angle of the electronic pen, wherein the initial angle is the angle of the electronic pen when it is in contact with the screen of the electronic device, or the initial angle is the angle of the electronic pen when the sliding speed of the electronic pen on the screen of the electronic device is less than a preset speed threshold.

7. The method according to claim 5, characterized in that, Before adjusting the pen tail function parameters or the pen tip function parameters, the method further includes: The sliding speed of the electronic pen was detected to be less than a preset speed threshold.

8. The method according to claim 5, characterized in that, The step of instructing the electronic device to adjust the pen tail function parameters corresponding to the pen tail function mode based on the angle change value of the angle information includes: Based on the angle change value of the angle information and the preset correspondence between the angle change value and the pen tail function parameter change value, the electronic device is instructed to adjust the pen tail function parameter corresponding to the pen tail function mode. or, The step of instructing the electronic device to adjust the pen tip function parameters corresponding to the pen tip function mode based on the angle change value of the angle information includes: Based on the angle change value of the angle information and the preset correspondence between the angle change value and the pen tip function parameter change value, the electronic device is instructed to adjust the pen tip function parameters corresponding to the pen tip function mode.

9. The method according to claim 5, characterized in that, The pen tail function mode is an eraser mode, and the pen tail function parameters include eraser radius and / or eraser opacity. The step of instructing the electronic device to adjust the pen tail function parameters corresponding to the pen tail function mode based on the angle change value of the angle information includes: Based on the angle change value of the tilt angle, the electronic device is instructed to adjust the eraser radius; and / or Based on the change in the rotation angle, the electronic device is instructed to adjust the opacity of the eraser; or, Based on the angular change value of the rotation angle, the electronic device is instructed to adjust the eraser radius; and / or The electronic device is instructed to adjust the opacity of the eraser based on the change in the tilt angle.

10. The method according to claim 5, characterized in that, The pen tail function mode is a screenshot mode, and the pen tail function parameters include the radius of the screenshot area. The step of instructing the electronic device to adjust the pen tail function parameters corresponding to the pen tail function mode based on the angle change value of the angle information includes: Based on the change in the tilt angle, the electronic device is instructed to adjust the radius of the screenshot area; or, Based on the change in the rotation angle, the electronic device is instructed to adjust the radius of the screenshot area.

11. The method according to claim 5, characterized in that, The step of instructing the electronic device to adjust the pen tail function parameters corresponding to the pen tail function mode based on the angle change value of the angle information includes: Based on the angle change value of the angle information, the adjusted pen tail function parameters are sent to the electronic device to instruct the electronic device to adjust the pen tail function parameters corresponding to the pen tail function mode based on the adjusted pen tail function parameters. or, The step of instructing the electronic device to adjust the pen tip function parameters corresponding to the pen tip function mode based on the angle change value of the angle information includes: Based on the angle change value of the angle information, the adjusted pen tip function parameters are sent to the electronic device to instruct the electronic device to adjust the pen tip function parameters corresponding to the pen tip function mode based on the adjusted pen tip function parameters.

12. The method according to claim 5, characterized in that, The step of instructing the electronic device to adjust the pen tail function parameters corresponding to the pen tail function mode based on the angle change value of the angle information includes: Sending the angle information to the electronic device is used to instruct the electronic device to adjust the pen tail function parameters corresponding to the pen tail function mode based on the angle change value of the angle information; or, The step of instructing the electronic device to adjust the pen tip function parameters corresponding to the pen tip function mode based on the angle change value of the angle information includes: The angle information is sent to the electronic device to instruct the electronic device to adjust the pen tip function parameters corresponding to the pen tip function mode based on the angle change value of the angle information.

13. A switching method for an electronic pen, characterized in that, Applied to an electronic device, the electronic device being communicatively connected to an electronic pen, the electronic pen including a sensor, the method includes: The pen tail working status is received from the electronic pen, and the pen tail working status is determined by the sensor in the electronic pen when the acceleration meets the first acceleration condition. Enter the pen tail function mode; or, The pen tip working state is received from the electronic pen, and the pen tip working state is determined by the electronic pen when the acceleration meets the second acceleration condition. Enter pen tip function mode; The first acceleration condition and the second acceleration condition are dynamically set based on the screen state of the electronic device; the screen state includes a screen-up state or a screen-down state; when the screen state is a screen-up state, the first acceleration condition and the second acceleration condition are set according to a first setting strategy; when the screen state is a screen-down state, the first acceleration condition and the second acceleration condition are set according to a second setting strategy.

14. The method according to claim 13, characterized in that, The first acceleration condition in the first setting strategy includes the acceleration being greater than a first threshold, and the second acceleration condition in the first setting strategy includes the acceleration being less than a second threshold, wherein the second threshold is equal to or less than the first threshold; the first acceleration condition in the second setting strategy includes the acceleration being less than a second threshold, wherein the second threshold is equal to or less than the first threshold, and the second acceleration condition in the second setting strategy includes the acceleration being greater than the first threshold.

15. The method according to claim 13, characterized in that, The first acceleration condition in the first setting strategy includes: the acceleration is less than a second threshold; the second acceleration condition in the first setting strategy includes: the acceleration is greater than a first threshold, and the second threshold is equal to or less than the first threshold; the first acceleration condition in the second setting strategy includes: the acceleration is greater than the first threshold; the second acceleration condition in the second setting strategy includes: the acceleration is less than the second threshold, and the second threshold is equal to or less than the first threshold.

16. The method according to any one of claims 13-15, characterized in that, The sensor is used to detect the angle information of the electronic pen, the angle information including tilt angle and / or rotation angle. After entering the pen tail function mode, the method further includes: Receive the angle information sent by the electronic pen; Based on the angle change value of the angle information, adjust the pen tail function parameters corresponding to the pen tail function mode, where the angle change value is greater than a preset angle threshold. or, After entering the pen tip function mode, the method further includes: Receive the angle information sent by the electronic pen; Based on the angle change value of the angle information, adjust the pen tip function parameters corresponding to the pen tip function mode, where the angle change value is greater than a preset angle threshold.

17. The method according to claim 16, characterized in that, The angle change value is the angle difference between the current angle and the initial angle of the electronic pen, wherein the initial angle is the angle of the electronic pen when it is in contact with the screen of the electronic device, or the initial angle is the angle of the electronic pen when the sliding speed of the electronic pen on the screen of the electronic device is less than a preset speed threshold.

18. The method according to claim 16, characterized in that, Before adjusting the pen tail function parameters or the pen tip function parameters, the method further includes: The sliding speed of the electronic pen was detected to be less than a preset speed threshold.

19. The method according to claim 16, characterized in that, The step of adjusting the pen tail function parameters corresponding to the pen tail function mode based on the angle change value of the angle information includes: Based on the angle change value of the angle information and the correspondence between the preset angle change value and the pen tail function parameter change value, adjust the pen tail function parameters corresponding to the pen tail function mode. or, The step of adjusting the pen tip function parameters corresponding to the pen tip function mode based on the angle change value of the angle information includes: Based on the angle change value of the angle information and the preset correspondence between the angle change value and the pen tip function parameter change value, adjust the pen tip function parameters corresponding to the pen tip function mode.

20. The method according to claim 16, characterized in that, The pen tail function mode is an eraser mode, and the pen tail function parameters include eraser radius and / or eraser opacity. Adjusting the pen tail function parameters corresponding to the pen tail function mode based on the angle change value of the angle information includes: Adjust the eraser radius according to the angle change value of the tilt angle; and / or Adjust the eraser opacity based on the change in the rotation angle; or, Adjust the eraser radius based on the change in the rotation angle; and / or The eraser opacity is adjusted based on the change in the tilt angle.

21. The method according to claim 16, characterized in that, The pen tail function mode is a screenshot mode, and the pen tail function parameters include the radius of the screenshot area. Adjusting the pen tail function parameters corresponding to the pen tail function mode based on the angle change value of the angle information includes: Adjust the radius of the screenshot area based on the angle change value of the tilt angle; or, The radius of the screenshot area is adjusted based on the change in the rotation angle.

22. The method according to claim 13, characterized in that, The sensor is used to detect the angle information of the electronic pen, the angle information including tilt angle and / or rotation angle. After entering the pen tail function mode, the method further includes: The system receives the adjusted pen tail function parameters sent by the electronic pen, wherein the adjusted pen tail function parameters are determined by the electronic pen based on the angle change value of the angle information. Based on the adjusted pen tail function parameters, adjust the pen tail function parameters corresponding to the pen tail function mode. or, After entering the pen tip function mode, the method further includes: The system receives adjusted pen tip function parameters sent by the electronic pen, wherein the adjusted pen tip function parameters are determined by the electronic pen based on the angle change value of the angle information. Based on the adjusted pen tip function parameters, adjust the pen tip function parameters corresponding to the pen tip function mode.

23. The method according to any one of claims 13-15, characterized in that, The electronic pen has a brush at its end, and the brush end function mode is a brush writing mode. After entering the brush end function mode, the method further includes: In response to a touch operation performed by the electronic pen on the screen of the electronic device, the touch trajectory of the touch operation is displayed on the screen in a brush writing effect.

24. An electronic pen, characterized in that, The electronic pen includes a sensor, a memory, and one or more processors; the memory and the processors are coupled; the memory is used to store computer program code, the computer program code including computer instructions, and when the processor executes the computer instructions, the electronic pen performs the method as described in any one of claims 1-12.

25. An electronic device, characterized in that, The electronic device includes a memory and one or more processors; the memory and the processors are coupled; the memory is used to store computer program code, the computer program code including computer instructions, and when the processor executes the computer instructions, the electronic device performs the method as described in any one of claims 13-23.

26. An electronic device, characterized in that, Including the electronic pen as described in claim 24.

27. A computer storage medium, characterized in that, Includes computer instructions that, when executed on an electronic pen, cause the electronic pen to perform the method as described in any one of claims 1-12.

28. A computer storage medium, characterized in that, Includes computer instructions that, when executed on an electronic device, cause the electronic device to perform the method as described in any one of claims 13-23.

Citation Information

Patent Citations

  • Electronic pen control system and method

    CN105786215A