A method for driving a motor and a terminal device
By receiving an event that triggers motor vibration in the terminal device, the output voltage of the vibration chip is controlled to make the amplitude of the linear motor reach the maximum value in a short time, solving the problem of stopping vibration when the vibration intensity in the prior art is not reached, and the effect of clearly perceiving vibration by the user is achieved.
Patent Information
- Application Number
- CN202211466439.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-22
- Publication Date
- 2025-05-09
- Estimated Expiration
- 2042-11-22
AI Technical Summary
In the prior art, linear motors need to stop vibration when the vibration intensity does not reach the maximum in a short period of time, resulting in weak vibration intensity and users may not be able to sense vibration.
By receiving the event that triggers the motor vibration, the vibration chip controls outputs the first voltage within the first time period, so that the amplitude of the motor quickly reaches the maximum value, and then maintains the maximum value under the action of the second voltage.
The amplitude of the linear motor reaches its maximum value in a short period of time, ensuring that the user can clearly perceive the vibration, thereby improving the user experience.
Smart Images

Figure CN118074595B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of motor drive technology, and in particular to a method and terminal device for driving a motor. Background Art
[0002] At present, in order to improve the user experience when using terminal equipment, when the user performs certain operations on the terminal, the terminal can prompt the user by vibration. For example, when the user is playing games on the terminal, the terminal can vibrate when the user performs a preset operation to give the user tactile feedback and immerse the user in the experience. Among them, the vibration of the terminal is achieved by the vibration of the motor installed in the terminal. Motors can be divided into nonlinear motors and linear motors. Compared with nonlinear motors that are controlled by on and off power and have only two modes of start and stop, linear motors can be driven by pulse voltage signals, and according to the different periods, amplitudes, and frequencies of the pulse voltage signals, linear motors can vibrate in different ways and intensities, giving users a rich vibration experience.
[0003] In the prior art, considering the compatibility of nonlinear motors and linear motors, when some third-party applications have vibration requirements, the general vibration interface provided by the operating system can be called to send a vibration request to the motor driver, so that the motor driver outputs a driving voltage with a rated frequency and rated voltage to continuously drive the motor to vibrate. Under the action of the driving voltage, the vibration intensity of the linear motor gradually increases to the maximum intensity over time and maintains the maximum intensity for continuous vibration. For some extremely short vibrations, the vibration intensity of the linear motor needs to stop before it reaches the maximum, which will result in a weak vibration intensity and the user may not be able to perceive the vibration. Summary of the invention
[0004] The embodiments of the present application provide a method and a terminal device for driving a motor, which can increase the amplitude of a linear motor in a short period of time.
[0005] To achieve the above objectives, the embodiments of the present application adopt the following technical solutions:
[0006] In a first aspect, a method for driving a motor is provided, which is applied to a terminal device, wherein the terminal device includes a vibration chip and a motor, and the motor is a linear motor. The method includes: receiving a first vibration event for triggering the vibration of the motor, wherein the first vibration event may include receiving an operation of unlocking the terminal device by a user, receiving an operation of online payment by a user, receiving an operation of entering a face by a user, receiving an operation of releasing a skill by a user, receiving an incoming call request, or the current time matches a preset time, etc. In response to the first vibration event, the vibration chip is controlled to output a first voltage to the motor within a first duration so that the amplitude of the motor reaches a maximum value at the end of the first duration, and the vibration chip is controlled to output a second voltage to the motor from the end of the first duration so that the amplitude of the motor remains at a maximum value; wherein the first voltage is in the same direction as the second voltage, and the absolute value of the first voltage is greater than the absolute value of the second voltage. In this way, the amplitude of the motor can quickly reach a maximum value under the action of the first voltage, and then remain at a maximum value under the action of the second voltage. In other words, the amplitude of the motor can also reach a maximum value when the vibration duration is very short, so as to bring a significant vibration feeling to the user and improve the user experience.
[0007] In an embodiment provided in the first aspect, in response to a first vibration event, the vibration chip is controlled to output a first voltage to the motor within a first duration so that the amplitude of the motor reaches a maximum value at the end of the first duration, and the vibration chip is controlled to output a second voltage to the motor from the end of the first duration so that the amplitude of the motor is maintained at a maximum value, further comprising: in response to the first vibration event, the vibration parameters of the motor are obtained; in the case where the vibration parameters do not include the vibration duration, the vibration chip is controlled to output a first voltage to the motor within the first duration so that the amplitude of the motor reaches a maximum value at the end of the first duration, and the vibration chip is controlled to output a second voltage to the motor from the end of the first duration so that the amplitude of the motor is maintained at a maximum value. It can be understood that, according to the actual setting of the application, the vibration parameters may include the vibration duration or not include the vibration duration. In the case where the vibration parameters do not include the vibration duration, the terminal device may first control the motor to start quickly, and then control the motor to stop vibrating later.
[0008] In one embodiment provided in the first aspect, the method further includes: when the control vibration chip receives the end of the preset duration of the first vibration event from the terminal device, outputting a third voltage to the motor so that the amplitude of the motor is reduced from a maximum value to 0 within the second duration; wherein the third voltage is opposite to the second voltage, and the absolute value of the third voltage is greater than the absolute value of the second voltage, and the preset duration is greater than the first duration. Generally, each vibration event may correspond to a theoretical vibration duration, for example, the theoretical vibration duration corresponding to the first vibration event is a preset duration, that is, the terminal device needs to control the motor to stop vibrating after receiving the preset duration of the first vibration event, so the control vibration chip receives the end of the preset duration of the first vibration event from the terminal device, and outputs a third voltage to the motor so that the motor stops vibrating. For example, if the terminal device receives the first vibration event at 10:00, and the first vibration event requires the motor to stop vibrating after 1 minute, the terminal device may output a third voltage to the motor at 10:01 to control the motor to stop vibrating. At the same time, compared with the method of stopping the output voltage to stop the motor from vibrating, this embodiment can quickly stop the motor from vibrating and reduce vibration tailing by outputting a third voltage that is opposite to the second voltage and larger than the second voltage.
[0009] In an implementation manner provided in the first aspect, the method further includes: controlling the vibration chip to output a third voltage to the motor when the actual vibration duration of the motor reaches a first value, so that the amplitude of the motor is reduced from a maximum value to 0 within a second duration; wherein the third voltage is opposite to the second voltage, and the absolute value of the third voltage is greater than the absolute value of the second voltage. In other words, the terminal device can obtain the actual vibration duration of the motor in real time, and when the actual vibration duration reaches the first value, output a third voltage to the motor to stop the motor from vibrating, so as to reduce the situation where the actual vibration duration of the motor is too short and the user cannot perceive the vibration. In addition, the first value can be the theoretical vibration duration corresponding to the first vibration event (i.e., the aforementioned preset duration), or the first value can be other parameters, see below for details, which will not be repeated here. At the same time, compared with the method of stopping the output voltage to stop the motor from vibrating, this implementation method can quickly stop the motor from vibrating and reduce the vibration tail by outputting a third voltage that is opposite to the second voltage and greater than the second voltage.
[0010] In one embodiment provided in the first aspect, in response to a first vibration event, the vibration chip is controlled to output a first voltage to the motor within a first time period so that the amplitude of the motor reaches a maximum value at the end of the first time period, and the vibration chip is controlled to output a second voltage to the motor from the end of the first time period so that the amplitude of the motor is maintained at a maximum value, further comprising: in response to the first vibration event, obtaining the vibration parameters of the motor; when the vibration parameters include the vibration duration, the vibration chip is controlled to output the first voltage to the motor within the first time period so that the amplitude of the motor reaches a maximum value at the end of the first time period, and the vibration chip is controlled to output the second voltage to the motor within the vibration duration from the end of the first time period so that the amplitude of the motor is maintained at a maximum value, and the vibration chip is controlled to output a third voltage to the motor from the end of the vibration duration so that the amplitude of the motor is reduced from the maximum value to 0 within the second time period; wherein the third voltage is opposite to the second voltage, and the absolute value of the third voltage is greater than the absolute value of the second voltage. It can be understood that when the vibration parameters include vibration duration, the terminal device knows how long the motor needs to vibrate, and therefore can output a second voltage to the motor within the vibration duration starting from the end of the first duration, so that the actual vibration duration of the motor can reach the vibration duration included in the vibration parameters.
[0011] In an embodiment provided in the first aspect, the vibration chip is controlled to output a first voltage to the motor within a first duration so that the amplitude of the motor reaches a maximum value at the end of the first duration, and the vibration chip is controlled to output a second voltage to the motor within the vibration duration from the end of the first duration so that the amplitude of the motor is maintained at the maximum value, and the vibration chip is controlled to output a third voltage to the motor from the end of the vibration duration so that the amplitude of the motor is reduced from the maximum value to 0 within the second duration, further comprising: if the vibration duration is less than the second value, the vibration chip is controlled to output a first voltage to the motor within the first duration so that the amplitude of the motor reaches a maximum value at the end of the first duration, and the vibration chip is controlled to output a second voltage to the motor within the vibration duration from the end of the first duration so that the amplitude of the motor is maintained at the maximum value, and the vibration chip is controlled to output a third voltage to the motor from the end of the vibration duration so that the amplitude of the motor is reduced from the maximum value to 0 within the second duration. In this way, for vibration events with a vibration duration greater than or equal to the second value, and vibration events with a vibration duration less than the second value, the terminal device can use different driving methods to control the vibration of the motor. Among them, for vibration events with a vibration duration greater than or equal to the second value, the amplitude of the motor is less affected by the vibration duration, and thus the motor can be driven to vibrate in a conventional manner; while for vibration events with a vibration duration less than the second value, the amplitude of the motor is greatly affected by the vibration duration, and the smaller the vibration duration, the smaller the amplitude of the motor, that is, the user is not easy to perceive the vibration, and thus the amplitude of the motor can be quickly made to reach the maximum value to reduce the impact of the vibration duration on the amplitude, giving the user a clear sense of vibration.
[0012] In an embodiment provided in the first aspect, the first vibration event includes one of the following: receiving an operation of a user unlocking a terminal device, receiving an operation of a user making an online payment, receiving an operation of a user entering a face, receiving an operation of a user releasing a skill, receiving an incoming call request, or the current time matches a preset time.
[0013] In an implementation manner provided in the first aspect, a terminal device includes a first application, a vibration service, a vibration hardware abstraction layer HAL and a vibration driver; wherein the vibration HAL includes a type judgment module, a first interface and a second interface, and in response to a first vibration event, controls the vibration chip to output a first voltage to the motor within a first time period so that the amplitude of the motor reaches a maximum value at the end of the first time period, and controls the vibration chip to output a second voltage to the motor starting from the end of the first time period so that the amplitude of the motor is maintained at the maximum value, further including: in response to the first vibration event, the first application sends a vibration request to the vibration service; the vibration service sends a vibration request to the type judgment module, the vibration request includes vibration parameters; the type judgment module determines whether the motor is a linear motor; based on the vibration parameters When the type of number indicates that the vibration interface is the first interface, the type judgment module sends a vibration request and a message indicating that the motor is a linear motor to the first interface; the first interface sends a vibration request to the second interface; the second interface updates the vibration parameter based on the first parameter, and the first parameter is used to describe the vibration waveform generated by the motor vibrating for a first time under the action of a first voltage; the second interface sends the first vibration parameter to the vibration driver, and the first vibration parameter is the vibration parameter updated based on the first parameter; the vibration driver writes the first vibration parameter into the vibration chip; the vibration chip outputs a first voltage to the motor within the first time so that the amplitude of the motor reaches a maximum value at the end of the first time, and starts to output a second voltage to the motor from the end of the first time to keep the amplitude of the motor at the maximum value.
[0014] In an implementation manner provided in the first aspect, the second interface updating the vibration parameter based on the first parameter further includes: when the vibration parameter does not include the vibration duration, the second interface updating the vibration parameter based on the first parameter.
[0015] In one embodiment provided in the first aspect, the method also includes: the first application sends a request to stop vibration to the vibration service when the preset time starting from receiving the first vibration event ends; the vibration service sends a request to stop vibration to the first interface; the first interface sends a second parameter to the vibration driver, and the second parameter is used to describe the vibration waveform generated by the motor vibrating for a second time under the action of a third voltage; the vibration driver writes the second parameter to the vibration chip; and the vibration chip outputs a third voltage to the motor to reduce the amplitude of the motor from a maximum value to 0 within the second time.
[0016] In an embodiment provided in the first aspect, the method also includes: in response to receiving a vibration request, the second interface starts a first timer to obtain a third duration; in response to receiving a request to stop vibration, the first interface starts a second timer to obtain a fourth duration; the first interface sends a second parameter to the vibration driver, further including: when the actual vibration duration of the motor reaches a first value, the first interface sends a second parameter to the vibration driver, and the first value is the difference between the third duration and the fourth duration.
[0017] In one embodiment provided in the first aspect, the method also includes: when the vibration parameters include vibration duration, the second interface updates the vibration parameters based on the first parameters and the second parameters, the second parameters are used to describe the vibration waveform generated by the motor vibrating for a second duration under the action of a third voltage; the second interface sends the second vibration parameters to the vibration driver, the second vibration parameters are the vibration parameters updated based on the first parameters and the second parameters; the vibration driver writes the second vibration parameters into the vibration chip; the vibration chip outputs a first voltage to the motor within the first duration so that the amplitude of the motor reaches a maximum value at the end of the first duration, and starts to output a second voltage to the motor within the vibration duration from the end of the first duration so that the amplitude of the motor remains at the maximum value, and starts to output a third voltage to the motor from the end of the vibration duration so that the amplitude of the motor is reduced from the maximum value to 0 within the second duration; wherein the third voltage is opposite to the second voltage, and the absolute value of the third voltage is greater than the absolute value of the second voltage.
[0018] In an implementation provided in the first aspect, when the vibration parameters include vibration duration, the second interface updates the vibration parameters based on the first parameters and the second parameters, further including: when the vibration parameters include vibration duration and the vibration duration is less than a second value, the second interface updates the vibration parameters based on the first parameters and the second parameters.
[0019] In an implementation provided in the first aspect, the method also includes: the first interface determines whether the vibration duration is less than a second value; the first interface sends a vibration request to the second interface, further including: if the vibration duration is less than the second value, the first interface sends a vibration request to the second interface.
[0020] In one implementation provided by the first aspect, in response to a first vibration event, a first application sends a vibration request to a vibration service, including: in response to the first vibration event, the first application sends a request to the vibration service to turn on the motor; the vibration service detects whether a motor exists and sends the detection result to the first application; if the detection result indicates that a motor exists, the first application sends a vibration request to the vibration service.
[0021] In a second aspect, the present application provides a chip system, which includes one or more interface circuits and one or more processors. The interface circuit and the processor are interconnected by lines. The above chip system can be applied to an electronic device including a communication module and a memory. The interface circuit is used to receive a signal from the memory of the electronic device and send the received signal to the processor, and the signal includes a computer instruction stored in the memory. When the processor executes the computer instruction, the electronic device can execute the method described in the first aspect and any possible design thereof.
[0022] In a third aspect, the present application provides a computer-readable storage medium, which includes computer instructions. When the computer instructions are executed on a terminal device (such as a mobile phone), the terminal device executes the method described in the first aspect and any possible design thereof.
[0023] In a fourth aspect, the present application provides a computer program product, which, when executed on a terminal device, enables the terminal device to execute the method described in the first aspect and any possible design thereof.
[0024] In a fifth aspect, the present application provides a terminal device, comprising: a memory and one or more processors; the memory is coupled to the processor; wherein the memory is used to store computer program code, and the computer program code includes computer instructions; when the computer instructions are executed by the processor, the terminal device executes the method described in the first aspect and any possible design method thereof.
[0025] Among them, the technical effects brought about by any design method in the fourth to fifth aspects can refer to the technical effects brought about by different design methods in the first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] Figure 1 is a waveform diagram of a driving voltage signal S1 and a vibration acceleration signal S2 of a linear motor;
[0027] Figure 2 is a waveform diagram of a driving voltage signal S3 and a vibration acceleration signal S4 of a linear motor;
[0028] Figure 3 A schematic diagram of the structure of a terminal device provided in an embodiment of the present application;
[0029] Figure 4 A schematic diagram of a software module architecture of a terminal device provided in an embodiment of the present application;
[0030] Figure 5 A schematic diagram of interaction between software modules provided in an embodiment of the present application;
[0031] Figure 6 A schematic diagram of a method for driving a motor provided in an embodiment of the present application Figure 1 ;
[0032] Figure 7 A waveform diagram of a driving voltage signal S5 and a vibration acceleration signal S6 provided in an embodiment of the present application;
[0033] Figure 8 A schematic diagram of a method for driving a motor provided in an embodiment of the present application Figure 2 ;
[0034] Fig. 9 A schematic diagram of a method for driving a motor provided in an embodiment of the present application Figure 3 ;
[0035] Fig.10 A time node diagram of a motor vibration process is provided for an embodiment of the present application;
[0036] Fig.11 A schematic diagram of a method for driving a motor provided in an embodiment of the present application Figure 4 ;
[0037] Fig.12 Another time node diagram of a motor vibration process is provided for an embodiment of the present application. DETAILED DESCRIPTION
[0038] The following is a description of exemplary embodiments of the present application in conjunction with the accompanying drawings, including various details of the embodiments of the present application to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present application. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0039] In order to make the description of the following embodiments clear and concise, a brief introduction to the related technology is first given.
[0040] Nonlinear motors, also known as rotor motors, can include iron core motors and flat motors. They generate vibrations by rotating the eccentric mass block (also called the rotor) on the shaft when the shaft is powered.
[0041] A linear motor is a mechanism that generates a changing electromagnetic field through a pulse voltage signal, and the changing electromagnetic field drives the magnet to drive the mass block to perform periodic motion. The vibration intensity of the linear motor will be different if the frequency and amplitude of the pulse voltage signal are different.
[0042] The resonant frequency, also known as the natural frequency, refers to the frequency point at which the linear motor can resonate. When the frequency of the driving voltage is the resonant frequency, the linear motor can vibrate at the resonant frequency and have the maximum amplitude, that is, the maximum vibration intensity.
[0043] At present, in addition to prompting users by sound, terminals can also prompt users by vibration to improve the user experience of the terminal. For example, for a conference scene, when a user performs certain operations on a mobile phone, in order to avoid the mobile phone prompt sound interfering with other users in the conference scene, the mobile phone can prompt the user by vibration. For another example, when a mobile phone receives an incoming call request, in order to prompt the user to respond to the incoming call request in time, the mobile phone can prompt the user by ringing and vibrating at the same time. In particular, when the user performs certain operations in the terminal, in order to improve the user experience, the terminal can provide vibration feedback in time when the user's operation is detected. In some scenarios, the terminal vibrates for a short time, that is, the terminal performs a short vibration at this time. At this time, the vibration time of the terminal should not be too long, so as not to affect the user experience. That is, the linear motor in the terminal needs to be able to start and stop quickly.
[0044] However, considering that it can adapt to both nonlinear motors and linear motors, when some third-party applications have vibration requirements, the universal vibration interface provided by the operating system can be called to send vibration parameters so that the vibration chip can output the rated frequency and rated voltage to drive the motor to vibrate. Figure 1 As shown, it is a waveform diagram of a driving voltage signal S1 and a vibration acceleration signal S2 of a linear motor. The driving voltage signal S1 is the driving voltage output by the vibration chip to the linear motor, and its duration is 0 to 500ms. The vibration acceleration signal S2 is used to indicate the vibration acceleration generated by the linear motor under the action of the driving voltage signal S1. In addition, the frequency of the driving voltage signal S1 is the resonant frequency f0 of the linear motor, and accordingly, the frequency of the vibration acceleration signal S2 is also the resonant frequency f0 of the linear motor. According to Figure 1It can be seen that under the action of the driving voltage signal S1, the vibration process of the linear motor from starting to stopping may include three stages, namely: the starting stage P1, the steady-state stage P2 and the braking stage P3. In the starting stage P1 and the steady-state stage P2, the vibration chip stably outputs the driving voltage signal S1. After stopping the output of the driving voltage signal S1, it enters the braking stage P3. Among them, in the starting stage P1 (0th to 80ms), the amplitude of the vibration acceleration signal S2 increases from 0 to the maximum value (for example, 0.65V), indicating that the linear motor startup amplitude gradually increases. In the steady-state stage P2 (80th to 500ms), the amplitude of the vibration acceleration signal S6 continues to remain at the maximum value, indicating that the amplitude of the linear motor remains at the maximum value. In the braking stage P3 (500th to 710ms), the amplitude of the vibration acceleration signal S2 gradually decreases from the maximum value to 0, indicating that the linear motor performs damped vibration until the vibration stops.
[0045] It can be seen that under the action of the driving voltage, the amplitude (also called vibration intensity) of the linear motor gradually increases to the maximum value over time and remains at the maximum value; after not receiving the driving voltage, the linear motor ends the vibration with damped oscillation. This is for those scenarios where the linear motor needs to start and stop quickly, and the vibration intensity of the linear motor needs to stop before it reaches the maximum. For example, Figure 2 The waveform diagram of a driving voltage signal S3 and a vibration acceleration signal S4 of a linear motor is shown. The driving voltage signal S3 is the driving voltage output by the vibration chip to the linear motor, and its duration is 0 to 50 ms. The vibration acceleration signal S4 is used to indicate the vibration acceleration generated by the linear motor under the action of the driving voltage signal S3. Figure 2 It can be seen that the vibration chip starts to output the driving voltage signal S3 to the linear motor from the 0th second, and stops outputting the driving voltage signal S3 at the 50th ms. At the same time, the amplitude of the vibration acceleration signal S4 gradually increases during the period from 0th to 50th ms, and gradually decreases to 0 at the 50th ms. Figure 1 and Figure 2 It can be seen that the linear motor first enters the starting phase P1 (0-50ms) under the action of the driving voltage signal S3, and then directly enters the braking phase P3 (50-189ms) due to the disappearance of the driving voltage signal S3. That is, the vibration amplitude of the linear motor begins to decrease before reaching the maximum value.
[0046] It can be seen that in the scenario where the linear motor needs to start and stop quickly, there is a problem in the prior art that the amplitude of the linear motor during the rapid start and stop process is too small, resulting in the user not being able to perceive the vibration, and the user cannot be reminded by vibration.
[0047] In view of this, the present application provides a method for driving a motor, which is applied to a terminal device including a linear motor. The terminal device can provide a first voltage to the linear motor when the linear motor is started, so that the amplitude of the linear motor quickly reaches a maximum value under the action of the first voltage. In this way, the linear motor can vibrate at its maximum amplitude, making it easier for the user to perceive the vibration, thereby effectively reminding the user and improving the user experience.
[0048] It should be noted that the terminal device described in this embodiment may be a mobile phone, a tablet computer, a personal communication service (PCS) phone, a virtual reality (VR) terminal device, an augmented reality (AR) terminal device, a wireless terminal in industrial control, a wireless terminal in self driving, a wireless terminal in remote medical surgery, a wireless terminal in a smart grid, a wireless terminal in transportation safety, a wireless terminal in a smart city, a wireless terminal in a smart home, etc., without specific limitation herein.
[0049] Figure 3 A schematic diagram of the structure of a terminal device provided in an embodiment of the present application. Figure 3 As shown, the terminal device may include: a processor 210, an external memory interface 220, an internal memory 221, a universal serial bus (USB) interface 230, a charging management module 240, a power management module 241, a battery 242, an antenna 1, an antenna 2, a mobile communication module 250, a wireless communication module 260, an audio module 270, a speaker 270A, a receiver 270B, a microphone 270C, an earphone interface 270D, a sensor module 280, a button 290, a motor 291, an indicator 292, a camera 293, a display screen 294, and a subscriber identification module (SIM) card interface 295, etc.
[0050] Among them, the processor 210 may include one or more processing units, for example: the processor 210 may include an application processor (application processor, AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), a controller, a memory, a video codec, a digital signal processor (digital signal processor, DSP), a baseband processor, and / or a neural-network processing unit (neural-network processing unit, NPU), etc. Among them, different processing units can be independent devices or integrated in one or more processors. The processor 210 can be the nerve center and command center of the terminal device. The processor 210 can generate an operation control signal according to the instruction opcode and the timing signal to complete the control of fetching and executing instructions.
[0051] The processor 210 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 210 is a cache memory. The memory may store instructions or data that the processor 210 has just used or cyclically used. If the processor 210 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 210, and thus improves the efficiency of the system.
[0052] In some embodiments, the processor 210 may include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.
[0053] The external memory interface 220 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the terminal device. The external memory card communicates with the processor 210 through the external memory interface 220 to implement a data storage function. For example, files such as music and videos can be stored in the external memory card.
[0054] The internal memory 221 may be used to store computer executable program codes, which include instructions. The processor 210 executes various functional applications and data processing of the terminal device by running the instructions stored in the internal memory 221. For example, in an embodiment of the present application, the processor 210 may execute instructions stored in the internal memory 221, and the internal memory 221 may include a program storage area and a data storage area.
[0055] The program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), a configuration file of the motor 291, etc. The data storage area may store data created during the use of the terminal device (such as audio data, a phone book, etc.), etc. In addition, the internal memory 221 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.
[0056] The charging management module 240 is used to receive charging input from a charger. The charger can be a wireless charger or a wired charger. While the charging management module 240 charges the battery 242, it can also power the terminal device through the power management module 241.
[0057] The power management module 241 is used to connect the battery 242, the charging management module 240 and the processor 210. The power management module 241 receives input from the battery 242 and / or the charging management module 240, and supplies power to the processor 210, the internal memory 221, the external memory, the display screen 294, the camera 293, and the wireless communication module 260. In some embodiments, the power management module 241 and the charging management module 240 can also be set in the same device.
[0058] The wireless communication function of the terminal device can be implemented through antenna 1, antenna 2, mobile communication module 250, wireless communication module 260, modem processor and baseband processor, etc. In some embodiments, antenna 1 of the terminal device is coupled with mobile communication module 250, and antenna 2 is coupled with wireless communication module 260, so that the terminal device can communicate with the network and other devices through wireless communication technology.
[0059] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in the terminal device can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of the antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.
[0060] The mobile communication module 250 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to terminal devices. The mobile communication module 250 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 250 can receive electromagnetic waves from the antenna 1, and filter, amplify, etc. the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation.
[0061] The mobile communication module 250 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some functional modules of the mobile communication module 250 can be set in the processor 210. In some embodiments, at least some functional modules of the mobile communication module 250 can be set in the same device as at least some modules of the processor 210.
[0062] The wireless communication module 260 can provide wireless communication solutions including WLAN (such as (wirelessfidelity, Wi-Fi) network), bluetooth (bluetooth, BT), global navigation satellite system (global navigation satellite system, GNSS), frequency modulation (frequency modulation, FM), nearfield communication technology (nearfield communication, NFC), infrared technology (infrared, IR), etc. applied to the terminal device.
[0063] The wireless communication module 260 may be one or more devices integrating at least one communication processing module. The wireless communication module 260 receives electromagnetic waves via the antenna 2, modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 210. The wireless communication module 260 may also receive signals to be sent from the processor 210, modulate the frequencies of the signals, amplify the signals, and convert the signals into electromagnetic waves for radiation via the antenna 2.
[0064] The terminal device can implement audio functions such as music playing and recording through the audio module 270, the speaker 270A, the receiver 270B, the microphone 270C, the earphone interface 270D, and the application processor.
[0065] The sensor module 280 may include sensors such as a pressure sensor, a gyroscope sensor, an air pressure sensor, a magnetic sensor, an acceleration sensor, a distance sensor, a proximity light sensor, a fingerprint sensor, a temperature sensor, a touch sensor, an ambient light sensor, and a bone conduction sensor. The terminal device may collect various data through the sensor module 280.
[0066] The terminal device implements the display function through a GPU, a display screen 294, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 294 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 210 may include one or more GPUs, which execute program instructions to generate or change display information.
[0067] The display screen 294 is used to display images, videos, etc. The display screen 294 includes a display panel.
[0068] The terminal device can realize the shooting function through ISP, camera 293, video codec, GPU, display screen 294 and application processor. ISP is used to process the data fed back by camera 293. Camera 293 is used to capture static images or videos. In some embodiments, the terminal device may include 1 or N cameras 293, where N is a positive integer greater than 1.
[0069] The button 290 includes a power button, a volume button, etc. The button 290 can be a mechanical button. It can also be a touch button. The motor 291 can generate a vibration prompt. The motor 291 can be used for incoming call vibration prompts, and can also be used for touch vibration feedback. The indicator 292 can be an indicator light, which can be used to indicate the charging status, power changes, messages, missed calls, notifications, etc. The SIM card interface 295 is used to connect the SIM card. The SIM card can be inserted into the SIM card interface 295, or pulled out from the SIM card interface 295 to achieve contact and separation with the terminal device. The terminal device can support 1 or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 295 can support Nano SIM cards, Micro SIM cards, SIM cards, etc.
[0070] It is understandable that the interface connection relationship between the modules illustrated in this embodiment is only a schematic illustration and does not constitute a structural limitation on the terminal device. In other embodiments, the terminal device may also include more or fewer modules than those provided in the above embodiment, and the modules may also adopt different interface connection methods in the above embodiment, or a combination of multiple interface connection methods.
[0071] The software system of the terminal device can adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture. The embodiment of the present invention takes the layered architecture of the Android system as an example to exemplify the software structure of the terminal device.
[0072] The layered architecture divides the software into several layers, each with clear roles and division of labor. The layers communicate with each other through interfaces. In some embodiments, the Android system may include an application layer, an application framework layer, an Android runtime (Android runtime) and a system library, a hardware abstraction layer (HAL) and a kernel layer. It should be noted that the embodiments of the present application are illustrated by taking the Android system as an example. In other operating systems (such as Hongmeng system, IOS system, etc.), as long as the functions implemented by each functional module are similar to those of the embodiments of the present application, the solutions of the present application can also be implemented.
[0073] The application layer may include a series of application packages. Figure 4 As shown, the application package may include camera application, gallery, calendar, call, map, navigation, WLAN, settings, music, lock screen application, short message and other applications. Of course, the application layer may also include other application packages, such as payment application, shopping application, banking application, chat application or financial management application and other third-party applications, which are not limited in this application.
[0074] The application framework layer provides an application programming interface (API) and a programming framework for the application programs of the application layer. The application framework layer includes some predefined functions. For example, it may include an activity manager, a window manager, a content provider, a view system, a resource manager, a notification manager, a vibration service, etc., and the embodiment of the present application does not impose any restrictions on this. The vibration service is used to provide services related to vibration support.
[0075] The system library can include multiple functional modules, such as surface manager, media libraries, OpenGL ES, SGL, etc.
[0076] The surface manager is used to manage the display subsystem and provide the fusion of 2D and 3D layers for multiple applications.
[0077] The media library supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
[0078] OpenGL ES is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.
[0079] SGL is a graphics engine for 2D graphics.
[0080] Android runtime includes core library and virtual machine. Android runtime is responsible for scheduling and management of Android system. The core library consists of two parts: one is the function that Java language needs to call, and the other is the core library of Android. The application layer and application framework layer run in the virtual machine. The virtual machine executes the Java files of the application layer and application framework layer as binary files. The virtual machine is used to perform object life cycle management, stack management, thread management, security and exception management, and garbage collection.
[0081] The HAL layer is an encapsulation of the Linux kernel driver, providing an interface to the upper layer and shielding the implementation details of the underlying hardware.
[0082] The HAL layer may include a vibration HAL (vibrator HAL), a camera HAL (camera HAL), and the like.
[0083] Among them, the vibration HAL may include a type judgment module, a general vibration interface, a self-developed vibration interface, and a 4D vibration interface, etc. The type judgment module can determine whether the motor is a linear motor or a nonlinear motor by reading the configuration file of the motor.
[0084] The universal vibration interface, the self-developed vibration interface, and the 4D vibration interface can all interact with the vibration drive of the core layer. The difference is that the three vibration interfaces can process different vibration parameters. Among them, for the content of the vibration parameters processed by the three vibration interfaces, refer to S604 and related descriptions, which will not be repeated here.
[0085] The kernel layer is the layer between hardware and software. The kernel layer contains at least display driver, audio driver, camera driver, vibration driver, etc. Among them, the vibration driver is a program that allows high-level computer software to interact with hardware, that is, a set of programs that drive the motor to work.
[0086] The hardware layer includes memory, vibration chip and motor, etc. Among them, the vibration chip is used to output driving voltage to the motor to drive the motor to vibrate. The motor is used to vibrate to give the user a vibration feeling.
[0087] The following describes the software modules and the interactions between the modules involved in the method for driving a motor provided in the embodiment of the present application. Figure 5 As shown, the first application in the application layer can interact with the vibration service in the application framework layer by calling a preset application programming interface (API) interface, and the vibration service can interact with the vibration HAL in the HAL layer. The vibration HAL may include a type judgment module, a general vibration interface, a self-developed vibration interface, and a 4D vibration interface. The type judgment module can read the configuration information of the motor to determine the motor type (including linear motors and nonlinear motors). When the type judgment module determines that the motor type is a linear motor, it can interact with the vibration driver of the kernel layer through a general vibration interface, a self-developed vibration interface, or directly interact with the vibration driver of the kernel layer through a self-developed vibration interface or a 4D vibration interface. When the type judgment module determines that the motor type is a nonlinear motor, it can directly interact with the vibration driver of the kernel layer through a general vibration interface. The vibration driver can configure the vibration chip in the hardware layer so that the vibration chip outputs a driving voltage to drive the motor to vibrate.
[0088] The method for driving a motor provided by the present application will be described below with reference to the accompanying drawings.
[0089] In an optional implementation, the terminal device receives a first vibration event, and the first vibration event is used to trigger the motor to vibrate. The first vibration event includes receiving an operation of unlocking the terminal device by a user, receiving an operation of online payment by a user, receiving an operation of entering a face by a user, receiving an operation of releasing a skill by a user, receiving an incoming call request, or the current time matches a preset time, etc.
[0090] In response to the first vibration event, the vibration chip is controlled to output a first voltage to the motor within a first duration so that the amplitude of the motor reaches a maximum value at the end of the first duration; and the vibration chip is controlled to output a second voltage to the motor starting from the end of the first duration so that the amplitude of the motor is maintained at a maximum value, the first voltage and the second voltage are in the same direction, and the absolute value of the first voltage is greater than the absolute value of the second voltage. Wherein, the first voltage and the second voltage are both alternating currents, and the absolute value of the first voltage being greater than the absolute value of the second voltage can refer to that the amplitude of the first voltage is greater than the amplitude of the second voltage. The first voltage and the second voltage are in the same direction can refer to that the current directions of the first voltage and the second voltage are the same at the end of the first duration.
[0091] In this way, the amplitude of the motor can quickly reach the maximum value under the action of the first voltage, and then remain at the maximum value under the action of the second voltage. In other words, the amplitude of the motor can reach the maximum value even when the vibration duration is very short, so as to bring a significant vibration feeling to the user and improve the user experience.
[0092] In this embodiment, in response to the first vibration event, the terminal device may obtain a vibration parameter of the motor. The vibration parameter is used to indicate the vibration mode of the motor. Depending on whether the vibration parameter includes the vibration duration or does not include the vibration duration, the present application may provide different methods to drive the motor to vibrate.
[0093] In an optional embodiment, when the vibration parameter includes the vibration duration, the terminal device may control the vibration chip to output a first voltage to the motor within the first duration so that the amplitude of the motor reaches a maximum value at the end of the first duration; the terminal device may also control the vibration chip to output a second voltage to the motor within the vibration duration from the end of the first duration so that the amplitude of the motor remains at the maximum value, and control the vibration chip to output a third voltage to the motor from the end of the vibration duration so that the amplitude of the motor decreases from the maximum value to 0 within the second duration. The third voltage is opposite to the second voltage, and the absolute value of the third voltage is greater than the absolute value of the second voltage. It can be understood that the third voltage is also an alternating current, and the third voltage is opposite to the second voltage, which means that the current direction of the third voltage is the same as that of the second voltage at the end of the vibration duration. The absolute value of the third voltage being greater than the absolute value of the second voltage may mean that the amplitude of the third voltage is greater than the amplitude of the second voltage.
[0094] When the vibration parameters do not include the vibration duration, the terminal device can control the vibration chip to output a first voltage to the motor within a first duration so that the amplitude of the motor reaches a maximum value at the end of the first duration; and control the vibration chip to output a second voltage to the motor starting from the end of the first duration so that the amplitude of the motor is maintained at the maximum value.
[0095] It is understandable that when the vibration parameters include the vibration duration, the terminal device knows the duration for which the motor needs to vibrate, and thus can control the vibration chip to output a second voltage to the motor within the vibration duration starting from the end of the first duration, so that the actual vibration duration of the motor can reach the vibration duration included in the vibration parameters. When the vibration parameters do not include the vibration duration, the terminal device is not very clear about the duration for which the motor needs to vibrate, and can control the motor to start quickly first, and then control the motor to stop vibrating later.
[0096] In order to implement the method of driving a motor provided by the present application, the present application provides a method of driving a motor, which is used to illustrate the process of controlling the vibration of a motor by a terminal device when the vibration parameters include the vibration duration. Figure 6 As shown, Figure 6 A schematic diagram of a method for driving a motor provided in this application Figure 1 , the method for driving a motor comprises the following steps:
[0097] S601: In response to receiving a first vibration event, a first application sends a request to turn on a motor to a vibration service.
[0098] The first application can receive the first vibration event, and after receiving the first vibration event, send a request to the vibration service to turn on the motor. Depending on the actual application scenario, the first vibration event may be different. For example, when the first application is a lock screen application, the first vibration event may be receiving an operation of the user unlocking the terminal device through a virtual button. For another example, when the first application is a game application, the first vibration event may be receiving an operation of the user releasing a game skill. For another example, if the first application is a call application, the first vibration event may be receiving an incoming call request. For another example, if the first application is an alarm clock application, the first vibration event may be that the current time is consistent with the preset time set by the user.
[0099] The first application may call a preset API interface to send a request to turn on the motor to the vibration service.
[0100] S602, the vibration service detects whether there is a motor.
[0101] Optionally, the vibration service can detect whether the terminal device has a motor through the vibrator.hasVibrator() function.
[0102] It is understandable that the first application is not clear whether the terminal device includes a motor, so it is necessary to determine whether the terminal device has a motor before sending a vibration request.
[0103] S603: The vibration service sends the detection result to the first application.
[0104] The detection result may include true or false. If the detection result is false, the vibration service notifies the first application that the terminal device does not have a motor. If the detection result is true, the vibration service notifies the first application that the terminal device does have a motor, and S604 and subsequent steps may be executed.
[0105] Optionally, the vibration service can also detect whether the motor is in an idle state. The detection result also includes information that the motor is in an idle state or not in an idle state. If the detection result indicates that the terminal device has a motor and the motor is in an idle state, the first application can execute S604 and subsequent steps. If the detection result indicates that the terminal device does not have a motor or the motor is in a non-idle state, the first application can determine that the motor is unavailable.
[0106] S604: The first application sends a vibration request to the vibration service.
[0107] The vibration request carries a vibration parameter. The vibration parameter is used to indicate the vibration mode required by the first application. In this embodiment, the content included in the vibration parameter may be different according to the vibration interface called by the first application. The vibration interface called by the first application may include: a universal vibration interface (also referred to as a first interface), a native vibration interface (also referred to as a second interface), and a 4D vibration interface.
[0108] The universal vibration interface can also be called the Google vibration interface, which can control linear motors and nonlinear motors through vibration drive. For applications that call the universal vibration interface, the vibration parameters sent by them may include vibration type, vibration duration, sleep duration and other parameters that can be used by both linear motors and nonlinear motors. Among them, the sleep duration can refer to the time interval between two vibrations.
[0109] The native vibration interface is a vibration interface developed by the device manufacturer itself, which can control the linear motor through vibration drive. For applications that call the native vibration interface, the vibration parameters sent may include information such as the name of the vibration waveform and the sleep duration. Among them, the terminal device stores description files of various vibration waveforms pre-designed by developers, each of which has a different name. The native vibration interface can find the corresponding description file through the name of the received vibration waveform, and parse the description file to obtain the vibration waveform data. This vibration waveform data is used to describe the vibration waveform. This vibration mode is more complicated and cannot be achieved by nonlinear motors.
[0110] The 4D vibration interface can be a vibration interface jointly developed by the device manufacturer and a third party, which can realize the control of the linear motor through vibration drive. For applications that call the 4D vibration interface, the vibration parameters sent include waveform ID and waveform file data. The waveform file data is used to indicate the storage address of the description file. Similar to the native vibration interface, the vibration mode realized by the 4D vibration interface is more complex and is not suitable for nonlinear motors.
[0111] The first application may call a preset API interface to send a vibration request to the vibration service.
[0112] S605: The vibration service sends a vibration request to the type determination module.
[0113] For the description of the vibration request, please refer to the relevant content of S604, which will not be described in detail here.
[0114] S606: The type determination module obtains motor type information.
[0115] In this embodiment, the type determination module can read a configuration file from a preset storage address. The configuration file includes configuration information of the motor, and the configuration information may include information such as motor type information and motor resonant frequency. The motor type may include a linear motor (e.g., marked as 1) and a nonlinear motor (e.g., marked as 2).
[0116] S607: The type determination module determines whether the motor is a linear motor.
[0117] Exemplarily, if the motor type information is 1, the type determination module may determine that the motor is a linear motor; if the motor type information is 2, the type determination module may determine that the motor is a nonlinear motor.
[0118] The following description takes the example of the type determination module determining that the motor is a linear motor. After S607, S608 to S615 are also included:
[0119] S608: The type determination module determines the vibration interface according to the vibration parameters.
[0120] Specifically, the type judgment module can determine the vibration interface according to the type of vibration parameters. For example, if the vibration parameters include vibration duration and sleep duration, the vibration interface can be determined to be a universal vibration interface. If the vibration parameters include the name of the vibration waveform and the sleep duration, the vibration interface can be determined to be a native vibration interface. If the vibration parameters include a waveform ID and waveform file data, the vibration interface can be determined to be a 4D vibration interface.
[0121] The following is an example in which the type determination module determines that the vibration interface is a universal vibration interface.
[0122] S609: The type determination module sends a vibration request and a message indicating that the motor is a linear motor to the universal vibration interface.
[0123] S610: The universal vibration interface determines whether the vibration duration is less than a second value.
[0124] The second value may be the time required for the linear motor to change from an amplitude of 0 to a maximum value under the action of the rated voltage, determined based on multiple tests. Exemplarily, the second value may be 100 milliseconds.
[0125] In this embodiment, if the universal vibration interface determines that the vibration duration is less than the second value, S611 can be executed; if the universal vibration interface determines that the vibration duration is greater than or equal to the second value, the universal vibration interface can directly send the vibration request to the vibration driver, and control the motor vibration through the vibration driver. For example, after receiving the vibration request, the vibration driver can directly control the vibration chip to output the second voltage to the motor, so that the motor can vibrate according to the vibration request. Figure 1 The waveform diagram of the vibration acceleration signal S2 is shown in FIG.
[0126] S611, the general vibration interface sends a vibration request to the self-developed vibration interface.
[0127] S612, the self-developed vibration interface updates the vibration parameters based on the first parameter and the second parameter.
[0128] Among them, the first parameter is used to describe the vibration waveform generated by the linear motor vibrating for the first time under the action of the first voltage, and the first voltage is used to increase the amplitude of the motor from 0 to the maximum value within the first time. The second parameter is used to describe the vibration waveform generated by the linear motor vibrating for the second time under the drive of the third voltage, and the third voltage is used to reduce the amplitude of the motor from the maximum value to 0 within the second time. Optionally, the first time and the second time can be 1 to 1.5 (including 1 and 1.5) times the resonance period, and the first time and the second time can be the same or different, and no specific restrictions are made here. The resonance period is the reciprocal of the natural frequency of the linear motor. The first voltage can be a voltage value obtained based on multiple tests, which can make the linear motor vibrate to the maximum amplitude within the first time. The third voltage can be a voltage value obtained based on multiple tests, which can change the vibration amplitude of the linear motor from the maximum value to 0 (causing the linear motor to stop vibrating quickly) within the second time.
[0129] S613, the self-developed vibration interface sends the updated vibration parameters (also referred to as second vibration parameters) to the vibration driver.
[0130] S614, the vibration driver writes the updated vibration parameters into the vibration chip.
[0131] S615, the vibration chip outputs a first voltage to the motor within the first time period so that the amplitude of the motor reaches a maximum value at the end of the first time period, and starts to output a second voltage to the motor within the vibration time period from the end of the first time period so that the amplitude of the motor is maintained at the maximum value, and starts to output a third voltage to the motor from the end of the vibration time period so that the amplitude of the motor decreases from the maximum value to 0 within the second time period.
[0132] The absolute value of the first voltage is greater than the absolute value of the second voltage, the absolute value of the third voltage is greater than the absolute value of the second voltage, the first voltage is in the same direction as the second voltage, and the third voltage is in the opposite direction to the second voltage. That is, the vibration chip first outputs the first voltage for a first duration, then outputs the second voltage for a vibration duration, and finally outputs the third voltage for a second duration.
[0133] Figure 71 shows a waveform diagram of a driving voltage signal S5 and a vibration acceleration signal S6. The driving voltage signal S5 is the driving voltage output by the vibration chip, and the vibration acceleration signal S6 is the vibration acceleration generated by the linear motor under the action of the driving voltage signal S1. Figure 7 As shown, the first duration can be 10 milliseconds, the vibration duration can be 26 milliseconds, and the third duration can be 9 milliseconds. The driving voltage signal S5 outputs a first voltage during T1, a second voltage during T2, and a third voltage during T3. Under the action of the first voltage, the amplitude of the vibration acceleration signal S6 reaches a maximum value in a very short time (e.g., 10 milliseconds), indicating that the amplitude of the linear motor reaches a maximum value from 0 within 10 milliseconds; under the action of the second voltage, the amplitude of the vibration acceleration signal S6 continues to remain at the maximum value, indicating that the amplitude of the motor maintains the maximum value. Under the action of the third voltage, the amplitude of the vibration acceleration signal S6 decreases from the maximum value to 0 in a very short time (e.g., 9 milliseconds), indicating that the motor stops vibrating quickly.
[0134] It can be seen that when the vibration parameter includes the vibration duration, the terminal device can first determine whether the vibration duration is less than the second value. If the vibration duration is less than the second value, the vibration chip is controlled to output the first voltage to the motor within the first duration so that the amplitude of the motor reaches the maximum value at the end of the first duration, and the vibration chip is controlled to output the second voltage to the motor within the vibration duration from the end of the first duration so that the amplitude of the motor is maintained at the maximum value, and the vibration chip is controlled to output the third voltage to the motor from the end of the vibration duration so that the amplitude of the motor is reduced from the maximum value to 0 within the second duration. In this way, the amplitude of the linear motor can quickly reach the maximum value under the action of the first voltage and maintain the maximum value under the action of the second voltage, making it easier for users to perceive vibration, improving user experience, and avoiding the problem that the motor amplitude is small due to the short vibration duration, and thus the user cannot perceive the vibration. In addition, after the actual vibration duration of the motor reaches the vibration duration required by the first application, the terminal device can output a high voltage (i.e., the third voltage) opposite to the original driving voltage (i.e., the second voltage) to stop the motor from vibrating quickly, reduce vibration tailing, and avoid the discomfort caused by vibration procrastination to the user.
[0135] In an optional implementation, the terminal device does not need to determine whether the vibration duration is less than the second value. Instead, after receiving the first vibration event, the terminal device directly controls the vibration chip to output the first voltage to the motor within the first duration, so that the amplitude of the motor reaches the maximum value at the end of the first duration, and controls the vibration chip to output the second voltage to the motor within the vibration duration from the end of the first duration, so that the amplitude of the motor is maintained at the maximum value, and outputs the third voltage to the motor from the end of the vibration duration, so that the amplitude of the motor is reduced from the maximum value to 0 within the second duration. In this case, Figure 6The flowchart shown may not include S610. That is to say, after the universal vibration interface receives the vibration request sent by the type judgment module, it may not determine whether the vibration duration is less than the second value, but directly send a vibration request to the self-developed vibration interface, and execute S612 and subsequent steps. Among them, S610 is used to determine whether the vibration duration is less than the second value. It can be distinguished in advance whether the terminal device may have the problem of unclear vibration due to insufficient vibration duration. If the terminal device determines that the vibration duration is less than the second value, it indicates that there is a problem of unclear vibration due to the short vibration duration, so the first voltage can be output to increase the amplitude of the motor from 0 to the maximum value in a short time (for example, the first duration). If the terminal device determines that the vibration duration is greater than or equal to the second value, it indicates that the vibration duration may be sufficient for the user to perceive the vibration, and there is no need for the motor to quickly reach the maximum amplitude. This method can not only enable the user to clearly feel the vibration, but also reduce the waste of resources caused by unnecessary processes.
[0136] It should be noted that if the type determination module determines in S608 that the vibration interface is a native vibration interface or a 4D vibration interface, the type determination module may send a vibration request to the corresponding vibration interface. After receiving the vibration request, the corresponding vibration interface may directly pass the vibration parameters to the vibration driver, which writes the vibration parameters into the vibration chip, so that the vibration chip outputs the voltage according to the configuration of the vibration parameters to realize motor vibration.
[0137] In an optional embodiment, the motor may also be a nonlinear motor. Figure 8 , take the example of the type judgment module judging that the motor is a nonlinear motor, Figure 8 A schematic diagram of a method for driving a motor provided in this application Figure 2 .like Figure 8 As shown, after S607, the method for driving the motor further includes S616 to S620.
[0138] S616: The type determination module sends a vibration request and a message indicating that the motor is a nonlinear motor to the universal vibration interface.
[0139] For the description of the vibration request, please refer to the relevant content of S604, which will not be repeated here.
[0140] S617, the general vibration interface extracts available parameters from the vibration parameters.
[0141] Among them, the available parameters may include parameters applicable to nonlinear motors, such as vibration duration, sleep duration, etc. Specifically, the universal vibration interface can remove parameters that are not applicable to nonlinear motors from the vibration parameters, and retain parameters applicable to nonlinear motors to achieve control of nonlinear motors. It should be noted that the parameters applicable to nonlinear motors refer to parameters that can be used to control nonlinear motors, and the parameters that are not applicable to nonlinear motors refer to parameters that cannot be used to control nonlinear motors, such as parameters related to vibration waveforms in S604.
[0142] Exemplarily, if the vibration parameters sent by the first application include the name of the vibration waveform and the sleep duration, the universal vibration interface may remove the name of the vibration waveform and retain the sleep duration as an available parameter.
[0143] S618, the general vibration interface sends available parameters to the vibration driver.
[0144] S619, the vibration driver writes the available parameters into the vibration chip.
[0145] S620, the universal vibration interface outputs a second voltage to the motor.
[0146] In this embodiment, if the terminal device determines that the motor is a nonlinear motor, the terminal device no longer needs to determine the vibration interface according to the type of vibration parameters, but can directly extract the parameters that the nonlinear motor can adapt to (i.e., available parameters) from the vibration parameters, and configure the vibration chip based on the available parameters, so that the vibration chip outputs a driving voltage (i.e., a second voltage) to vibrate the nonlinear motor. It can be understood that the nonlinear motor does not support a rich sense of vibration due to its own physical characteristics. By extracting the applicable parameters of the nonlinear motor from the vibration parameters, the problem of the nonlinear motor being unable to vibrate due to the incompatibility of the vibration parameters with the nonlinear motor can be avoided, thereby achieving efficient and stable control of the motor.
[0147] As mentioned above, when the vibration parameters do not include the vibration duration, the terminal device can control the vibration chip to output a first voltage to the motor within a first duration so that the amplitude of the motor reaches a maximum value at the end of the first duration, and start outputting a second voltage to the motor from the end of the first duration to keep the amplitude of the motor at the maximum value.
[0148] Optionally, the terminal device may also control the vibration chip to output a third voltage to the motor when the preset time duration from the start of the first vibration event received by the terminal device ends, so that the amplitude of the motor is reduced from a maximum value to 0 within the second time duration. Generally, each vibration event may be pre-set with a theoretical vibration duration, for example, the theoretical vibration duration corresponding to the first vibration event is a preset duration. For example, if the terminal device receives a first vibration event at 10:00, and the first vibration event requires the motor to stop vibrating after 1 minute, the terminal device may output a third voltage to the motor at 10:01 to control the motor to stop vibrating.
[0149] Fig. 9 A schematic diagram of a method for driving a motor provided in this application Figure 3 , which illustrates the process of the terminal device controlling the motor to vibrate and controlling the motor to stop vibrating when the vibration duration does not include the vibration parameters. Fig. 9 As shown, the method for driving a motor provided in this embodiment includes: S901 to S919.
[0150] S901: In response to receiving a first vibration event, the first application sends a request to turn on a motor to a vibration service.
[0151] S902, the vibration service detects whether a motor exists.
[0152] S903: The vibration service sends the detection result to the first application.
[0153] S904: The first application sends a vibration request to the vibration service.
[0154] S905: The vibration service sends a vibration request to the type determination module.
[0155] S906: The type determination module obtains motor type information.
[0156] S907: The type determination module determines whether the motor is a linear motor.
[0157] S908: The type determination module determines the vibration interface according to the vibration parameters.
[0158] S909 , the type determination module sends a vibration request and a message indicating that the motor is a linear motor to the universal vibration interface.
[0159] S910: The general vibration interface sends a vibration request to the self-developed vibration interface.
[0160] Among them, Figure 6Compared with the process shown in FIG. 1 , in this embodiment, the vibration parameter does not include the vibration duration, so the universal vibration interface does not need to determine whether the vibration duration is less than the second value after receiving the vibration request. When it is determined that the motor is a linear motor, the universal vibration interface can directly send the vibration request to the self-developed vibration interface after receiving the vibration request, and the motor can be quickly vibrated at the maximum amplitude through the self-developed vibration interface.
[0161] S911, the self-developed vibration interface updates the vibration parameter based on the first parameter.
[0162] According to S612, the first parameter is a parameter used to control the amplitude of the linear motor to reach a maximum value from 0 within a first duration, and the second parameter is a parameter used to change the amplitude of the linear motor from a maximum value to 0 within a second duration. Since the vibration parameter does not include the vibration duration, the terminal device does not know when to control the motor to stop vibrating. Therefore, the self-developed vibration interface does not need to update the vibration parameter based on the second parameter, but only updates the vibration parameter based on the first parameter, so that the motor can vibrate quickly at the maximum amplitude.
[0163] S912, the self-developed vibration interface sends updated vibration parameters (also referred to as first vibration parameters) to the vibration driver.
[0164] S913, the vibration driver writes the updated vibration parameters into the vibration chip.
[0165] S914, the vibration chip outputs a first voltage to the motor within a first time period so that the amplitude of the motor reaches a maximum value at the end of the first time period, and starts to output a second voltage to the motor from the end of the first time period so that the amplitude of the motor is maintained at the maximum value.
[0166] Thus, under the action of the first voltage, the amplitude of the motor quickly reaches a maximum value from 0; and under the action of the second voltage, the amplitude of the motor is maintained at the maximum value.
[0167] S915: The first application sends a request to stop vibration to the vibration service.
[0168] Specifically, the first application may send a vibration stop request to the vibration service at the end of the preset time from when the vibration request to the vibration service is sent. For example, the first application sends a vibration request to the vibration service at 9:10, and the preset time is 2 minutes, then the first application sends a vibration stop request to the vibration service at 9:12. The vibration stop request is used to trigger the motor to stop vibrating.
[0169] S916: The vibration service sends a request to stop vibration to the general vibration interface.
[0170] S917: The general vibration interface sends a second parameter to the vibration driver.
[0171] For the description of the second parameter, please refer to S612 and will not be repeated here.
[0172] S918, the vibration driver writes the second parameter into the vibration chip.
[0173] S919, the vibration chip outputs a third voltage to the motor.
[0174] Simple comparison Figure 6 and Fig. 9 It can be seen that Figure 6 The method of driving the motor shown is Fig. 9 The method of driving the motor shown is similar, the difference between the two is: Figure 6 The motor stops vibrating by setting the vibration duration. Fig. 9 The motor stops vibrating by requesting to stop vibration. Figure 6 And related descriptions are not repeated here.
[0175] Fig.10 The terminal device is shown Fig. 9 The process shown is a time node diagram of the motor vibration process. Among them, t1 is the moment when the first application sends a request to turn on the motor (i.e., the moment corresponding to S901), t2 is the moment when the first application sends a request to stop vibration (i.e., the moment corresponding to S915), t3 is the moment when the vibration chip outputs a first voltage to control the vibration of the motor (i.e., the moment corresponding to S914), and t4 is the moment when the vibration chip outputs a third voltage to control the motor to stop vibrating (i.e., the moment corresponding to S919). Among them, the time difference between moment t3 and moment t1 is ΔT1, and ΔT1 is used to characterize the time used to control the vibration of the motor. The time difference between moment t4 and moment t2 is ΔT2, and ΔT2 is used to characterize the time used to control the stopping of the vibration of the motor. The time difference between moment t2 and moment t1 is ΔT3, and ΔT3 is used to characterize the vibration duration requested by the first application. The time difference between moment t4 and moment t3 is ΔT4, and ΔT4 is used to characterize the actual vibration duration of the motor.
[0176] It can be seen that the terminal device needs to perform more operations from the time the first application sends a request to turn on the motor to the time the vibration chip outputs a voltage to drive the motor to vibrate (i.e., from S901 to S914); the terminal device only needs to perform fewer operations from the time the first application sends a request to stop vibration to the time the vibration chip outputs a voltage to drive the motor to stop vibrating (i.e., from S915 to S919), i.e., ΔT1 is greater than ΔT2. This will cause ΔT4 to be less than ΔT3, i.e., the actual vibration duration of the motor (i.e., ΔT4) is less than the vibration duration requested by the first application (i.e., ΔT3). If the actual vibration duration of the motor is too short, it may make it difficult for the user to perceive the vibration, affecting the user experience.
[0177] In an optional implementation, in order to prevent the actual vibration duration of the motor (i.e., the actual vibration duration of the motor) from being too short, the terminal device may control the vibration chip to output a third voltage to the motor when the actual vibration duration of the motor reaches a first value, so that the amplitude of the motor is reduced from a maximum value to 0 within a second duration. Optionally, the first value may be the time difference between the moment when the terminal device generates a vibration request and the moment when it generates a request to stop vibration. Alternatively, the first value may be other parameters. The following is another implementation of the terminal device controlling the vibration chip to output a third voltage to the motor when the actual vibration duration of the motor is greater than the first value.
[0178] exist Fig. 9 Based on the flowchart shown, this embodiment provides another method for driving a motor. Fig.11 A schematic diagram of a method for driving a motor provided in this application Figure 4 .
[0179] contrast Fig.11 and Fig. 9 It can be seen that Fig.11 A method for driving a motor is provided Fig. 9 The methods provided for driving the motor are similar, with the following differences: Fig.11 The provided method for driving a motor also includes S1101, S1102 and S1103. S1101, S1102 and S1103 will be described in detail below. For the same contents of the two implementations, please refer to Fig. 9 And related descriptions will not be repeated here.
[0180] S1101, the self-developed vibration interface starts the first timer to obtain the third duration.
[0181] It should be noted that S1101 may be executed earlier than S911, or executed simultaneously with S911, and no specific limitation is made here.
[0182] It can be understood that after the self-developed vibration interface starts the first timer, the third duration starts from 0 and increases in real time.
[0183] After the vibration service sends a request to stop vibration to the universal vibration interface, the universal vibration interface may further execute S1102 and S1103.
[0184] S1102: The universal vibration interface starts a second timer to obtain a fourth duration.
[0185] Similarly, after the universal vibration interface starts the second timer, the fourth duration starts to increase in real time from 0.
[0186] S1103, the universal vibration interface determines whether the actual vibration duration is greater than or equal to the difference between the third duration and the fourth duration.
[0187] If the universal vibration interface determines that the actual vibration duration is greater than or equal to the difference between the third duration and the fourth duration, S917 can be executed (i.e., the second parameter is sent to the vibration driver); if the universal vibration interface determines that the actual vibration duration is less than the difference between the third duration and the fourth duration, the second timer can be waited for to continue timing, and S1103 can be re-executed until the actual vibration duration is greater than or equal to the difference between the third duration and the fourth duration. It can be understood that in this embodiment, the first value is the difference between the third duration and the fourth duration.
[0188] Fig.12 (a) and (b) in FIG. 1 respectively show the terminal device with Fig. 9 , Fig.10 The process shown in FIG. 1 is a time node diagram of the motor vibration process. Among them, t3 is the moment when the vibration chip outputs the first voltage to control the motor vibration (i.e., the moment corresponding to S914), t4 is Fig. 9 The vibration chip outputs a third voltage to control the moment when the motor stops vibrating (i.e. Fig. 9 The time corresponding to S919 in the figure), t5 is the time when the self-developed vibration interface receives the vibration request, t6 is the time when the universal vibration interface receives the request to stop vibration, and t7 is the time when the self-developed vibration interface receives the request to stop vibration. Fig.11 The vibration chip outputs a third voltage to control the moment when the motor stops vibrating (i.e. Fig.11 The time difference between time t4 and time t3 is Δt4, which is used to represent the time difference between time t4 and time t3. Fig. 9 The actual vibration duration of the motor when the flow chart shown in the figure controls the motor vibration. The time difference between time t7 and time t3 is Δt4', which is used to represent the actual vibration duration of the motor when the motor vibrates. Fig.11 The flowchart shown controls the actual vibration duration of the motor when the motor vibrates.
[0189] contrast Fig.12 It can be seen from (a) and (b) that by judging whether the actual vibration duration is greater than or equal to the difference between the third duration and the fourth duration, and only executing S917 when the actual vibration duration is greater than or equal to the difference between the third duration and the fourth duration, so as to control the motor to stop vibrating, the actual vibration duration of the motor can be changed from Δt4 to Δt4', which increases the actual vibration duration of the motor, so as to bring a clear vibration feeling to the user and improve the user experience.
[0190] Some embodiments of the present application provide a terminal device, which may include: a memory and one or more processors. The memory is coupled to the processor. The memory is used to store computer program code, and the computer program code includes computer instructions. When the processor executes the computer instructions, the terminal device may perform various functions or steps performed by the terminal device in the above method embodiment. The structure of the terminal device can refer to Figure 3 The structure of the terminal device shown.
[0191] An embodiment of the present application also provides a motor, which can be used to realize vibration waveforms under various configuration parameters in the above embodiments, etc. A terminal device equipped with the motor can execute various functions or steps executed by the terminal device in the above method embodiments.
[0192] An embodiment of the present application also provides a computer-readable storage medium, which includes computer instructions. When the computer instructions are executed on the above-mentioned terminal device, the terminal device executes each function or step executed by the terminal device in the above-mentioned method embodiment.
[0193] The embodiment of the present application also provides a computer program product. When the computer program product is run on a terminal device, the terminal device is enabled to execute each function or step executed by the terminal device in the above method embodiment.
[0194] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned 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.
[0195] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0196] The units described as separate components may or may not be physically separated, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0197] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0198] If the integrated unit is implemented in the form of 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 solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium, including several instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.
[0199] The above contents are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application shall be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
Claims
1. A method for driving a motor, characterized in that: Applied to a terminal device, the terminal device includes a vibration chip and a motor, the motor is a linear motor, and the method includes: receiving a first vibration event for triggering the motor to vibrate; In response to the first vibration event, acquiring a vibration parameter of the motor; When the vibration parameter includes a vibration duration, and the vibration duration is less than a second value, controlling the vibration chip to output a first voltage to the motor within a first duration, so that the amplitude of the motor reaches a maximum value at the end of the first duration; and controlling the vibration chip to output a second voltage to the motor starting from the end of the first duration, so that the amplitude of the motor is maintained at the maximum value; Wherein, the first voltage and the second voltage have the same direction, and the absolute value of the first voltage is greater than the absolute value of the second voltage; When the vibration duration is greater than or equal to the second value, the vibration chip is controlled to output the second voltage to the motor.
2. The method according to claim 1, characterized in that The method further comprises: When the vibration parameters do not include the vibration duration, the vibration chip is controlled to output the first voltage to the motor within the first duration so that the amplitude of the motor reaches the maximum value at the end of the first duration, and the vibration chip is controlled to output the second voltage to the motor starting from the end of the first duration so that the amplitude of the motor is maintained at the maximum value.
3. The method according to claim 2, characterized in that The method further comprises: Controlling the vibration chip to output a third voltage to the motor when the preset time duration from when the first vibration event starts to be received from the terminal device ends, so that the amplitude of the motor decreases from the maximum value to 0 within a second time duration; wherein, The third voltage is opposite to the second voltage, and an absolute value of the third voltage is greater than an absolute value of the second voltage; and The preset duration is greater than the first duration.
4. The method according to claim 2, characterized in that: The method further comprises: Controlling the vibration chip to output a third voltage to the motor when the actual vibration duration of the motor reaches a first value, so that the amplitude of the motor decreases from the maximum value to 0 within a second duration; The third voltage is opposite to the second voltage, and an absolute value of the third voltage is greater than an absolute value of the second voltage.
5. The method according to claim 1, characterized in that The method further comprises: In the case where the vibration parameter includes the vibration duration, Controlling the vibration chip to output a third voltage to the motor starting from the end of the vibration duration, so that the amplitude of the motor decreases from the maximum value to 0 within a second duration; The third voltage is opposite to the second voltage, and an absolute value of the third voltage is greater than an absolute value of the second voltage.
6. The method according to claim 1, characterized in that The first vibration event includes one of the following: receiving an operation of a user unlocking the terminal device, receiving an operation of a user making an online payment, receiving an operation of a user entering a face, receiving an operation of a user releasing a skill, receiving an incoming call request, or the current time matches a preset time.
7. The method according to any one of claims 1 to 6, characterized in that: The terminal device includes a first application, a vibration service, a vibration HAL and a vibration driver; wherein the vibration HAL includes a type determination module, a first interface and a second interface; The step of acquiring a vibration parameter of the motor in response to the first vibration event includes: In response to the first vibration event, the first application sends a vibration request to the vibration service; The vibration service sends the vibration request to the type determination module, where the vibration request includes vibration parameters; The step of controlling the vibration chip to output a first voltage to the motor within a first time period so that the amplitude of the motor reaches a maximum value at the end of the first time period; and controlling the vibration chip to output a second voltage to the motor starting from the end of the first time period so that the amplitude of the motor is maintained at the maximum value, comprises: The type determination module determines whether the motor is a linear motor; In a case where the type of the vibration parameter indicates that the vibration interface is the first interface, the type determination module sends the vibration request and a message indicating that the motor is a linear motor to the first interface; The first interface sends the vibration request to the second interface; The second interface updates the vibration parameter based on a first parameter, where the first parameter is used to describe a vibration waveform generated when the motor vibrates for the first duration under the action of the first voltage; The second interface sends a first vibration parameter to the vibration driver, where the first vibration parameter is a vibration parameter updated based on the first parameter; The vibration driver writes the first vibration parameter into the vibration chip; and The vibration chip outputs a first voltage to the motor during the first time period so that the amplitude of the motor reaches a maximum value at the end of the first time period, and starts to output a second voltage to the motor from the end of the first time period so that the amplitude of the motor is maintained at the maximum value.
8. The method according to claim 7, characterized in that The second interface updates the vibration parameter based on the first parameter, further comprising: In a case where the vibration parameter does not include a vibration duration, the second interface updates the vibration parameter based on the first parameter.
9. The method according to claim 8, characterized in that The method further comprises: The first application sends a request to the vibration service to stop vibration when a preset time period from when the first vibration event is received ends; The vibration service sends the request to stop vibration to the first interface; The first interface sends a second parameter to the vibration driver, where the second parameter is used to describe a vibration waveform generated when the motor vibrates for a second time under the action of a third voltage; The vibration driver writes the second parameter into the vibration chip; and The vibration chip outputs the third voltage to the motor so that the amplitude of the motor decreases from the maximum value to 0 within the second time period.
10. The method according to claim 9, characterized in that The method further comprises: In response to receiving the vibration request, the second interface starts a first timer to obtain a third duration; In response to receiving the request to stop vibration, the first interface starts a second timer to obtain a fourth duration; The first interface sending the second parameter to the vibration driver further comprises: When the actual vibration duration of the motor reaches a first value, the first interface sends the second parameter to the vibration driver, and the first value is the difference between the third duration and the fourth duration.
11. The method according to claim 8, characterized in that The method further comprises: In the case where the vibration parameter includes the vibration duration, the second interface updates the vibration parameter based on the first parameter and a second parameter, the second parameter being used to describe a vibration waveform generated when the motor vibrates for a second duration under the action of a third voltage; The second interface sends a second vibration parameter to the vibration driver, where the second vibration parameter is a vibration parameter updated based on the first parameter and the second parameter; The vibration driver writes the second vibration parameter into the vibration chip; The vibration chip outputs a first voltage to the motor during the first duration so that the amplitude of the motor reaches the maximum value at the end of the first duration, and outputs a second voltage to the motor during the vibration duration from the end of the first duration so that the amplitude of the motor is maintained at the maximum value, and outputs a third voltage to the motor from the end of the vibration duration so that the amplitude of the motor decreases from the maximum value to 0 during the second duration; The third voltage is opposite to the second voltage, and an absolute value of the third voltage is greater than an absolute value of the second voltage.
12. The method according to claim 11, characterized in that In the case where the vibration parameter includes the vibration duration, the second interface updates the vibration parameter based on the first parameter and the second parameter, further comprising: In a case where the vibration parameter includes the vibration duration and the vibration duration is less than a second value, the second interface updates the vibration parameter based on the first parameter and the second parameter.
13. The method according to claim 12, characterized in that The method further comprises: The first interface determines whether the vibration duration is less than a second value; The first interface sends the vibration request to the second interface, further comprising: If the vibration duration is less than the second value, the first interface sends the vibration request to the second interface.
14. The method according to claim 7, characterized in that In response to the first vibration event, the first application sending a vibration request to the vibration service further comprises: In response to the first vibration event, the first application sends a request to the vibration service to turn on a motor; The vibration service detects whether a motor exists and sends a detection result to the first application; If the detection result indicates that a motor is present, the first application sends the vibration request to the vibration service.
15. A terminal device, characterized in that: The terminal device comprises: a memory and one or more processors; the memory is coupled to the processor; The memory is used to store computer program code, and the computer program code includes computer instructions; when the computer instructions are executed by the processor, the terminal device executes the method as described in any one of claims 1-14.
16. A computer-readable storage medium, characterized in that: including computer instructions; When the computer instructions are executed on a terminal device, the terminal device is caused to execute the method according to any one of claims 1 to 14.
Citation Information
Patent Citations
Motor vibration control method and device and computer readable storage medium
CN110380664A
Cited By
Motor driving method and terminal device
EP4601186A1
Motor driving method and terminal device
WO2024109263A1