Linear motor driving method and device, electronic equipment and storage medium
By generating a target drive signal matching the natural frequency of the linear motor and timing using a standard clock signal, the problem of linear motor driving clock adjustment affecting the timing accuracy is solved, and the user's vibration sensing experience and vibration consistency are improved.
Patent Information
- Application Number
- CN202411097907.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-09
- Publication Date
- 2024-11-22
AI Technical Summary
The existing linear motor driving method causes clock adjustment during F0 calibration, affecting the timing accuracy, and leading to poor user vibration experience, especially when the natural frequency of the linear motor is offset, the vibration effect is reduced.
By obtaining the waveform content and time information in the command data packet, a target driving signal matching the natural frequency of the linear motor is generated, and a standard clock signal is used for timing to control the actual driving time of the linear motor and ensure that the driving time is consistent with the timing result.
The vibration effect of linear motors and the user's vibrating experience are improved, the vibration amount reduction caused by natural frequency offset is avoided, and the vibration duration consistency between the same batch of linear motors is ensured.
Smart Images

Figure CN119010706A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of linear motor technology, and in particular, to a linear motor driving method, device, electronic device and storage medium. Background Art
[0002] At present, some consumer electronic devices represented by mobile phones and tablet computers basically use touch feedback technology to bring users tactile interactive effects. Tactile feedback technology is generally achieved through the vibration of linear motors.
[0003] In the prior art, electronic devices including linear motors usually perform F0 calibration on the driver chip of the linear motor according to the natural frequency of the linear motor before leaving the factory, so that the frequency of the drive signal generated by the driver chip is the same as the natural frequency of the linear motor, so as to enhance the vibration effect of the linear motor. However, when performing F0 calibration on the driver chip, the clock inside the driver chip is usually adjusted, causing the clock to change. Therefore, using the clock signal of the clock to time the driving of the linear motor may cause the timing to deviate, causing the actual time of driving the linear motor to be longer or shorter than the timing time, affecting the user's vibration experience. Summary of the invention
[0004] In view of this, embodiments of the present application provide a linear motor driving method, device, electronic device and storage medium to solve the above problems.
[0005] According to a first aspect of an embodiment of the present application, a linear motor driving method is provided, comprising: acquiring an instruction data packet, wherein the instruction data packet comprises at least one waveform content and time information corresponding to the waveform content; generating a target drive signal corresponding to the waveform content according to a target clock signal and the waveform content, wherein the frequency of the target drive signal is the natural frequency of the linear motor; the target clock signal is a clock signal that matches the natural frequency of the linear motor; driving the linear motor by means of the target drive signal, and timing the driving duration of the linear motor according to a standard clock signal; and controlling the actual duration of driving the linear motor by means of the target drive signal according to the timing result and the playback duration indicated by the time information corresponding to the target drive signal.
[0006] In a possible implementation, controlling the actual duration of driving the linear motor by the target drive signal according to the timing result and the playback duration indicated by the time information corresponding to the target drive signal includes: determining, according to the timing result and the playback duration indicated by the time information corresponding to the target drive signal, a phase of a signal value in the target drive signal for driving the linear motor when the drive duration reaches the playback duration; and controlling the actual duration of driving the linear motor by the target drive signal according to the determined phase.
[0007] In a possible implementation, controlling the actual duration of driving the linear motor by the target drive signal according to the determined phase includes: when the position where the signal value in the target drive signal is zero is the sampling point position of the target drive signal: if the signal value of the target drive signal in the phase is zero, then when the phase is reached during the process of the target drive signal driving the linear motor, the driving of the linear motor by the target drive signal is stopped; if the signal value of the target drive signal in the phase is not zero, determining a zero-point phase at which the next signal value of the target drive signal after the phase is zero, and when the zero-point phase is reached during the process of the target drive signal driving the linear motor, the driving of the linear motor by the target drive signal is stopped.
[0008] In one possible implementation, the driving of the linear motor by the target drive signal includes: if the time required for the linear motor to play the waveform content corresponding to the target drive signal is less than the playback time indicated by the time information corresponding to the waveform content, then after the linear motor is driven by the target drive signal to play the corresponding waveform content, the linear motor is driven to repeatedly play the waveform content corresponding to the target drive signal.
[0009] In a possible implementation, the time information corresponding to the waveform content includes the end time of playing the waveform content, so that the playing duration is indicated by the end time of playing; the method also includes: determining the end time of playing the waveform content as the start time of playing the next waveform content after the waveform content.
[0010] In a possible implementation, the time information corresponding to the waveform content includes a playback duration of the waveform content, so that the playback duration is indicated by the playback duration; the method also includes: determining the playback start time of the waveform content based on the time of obtaining the instruction data packet including the waveform content.
[0011] In a possible implementation, the method further includes: calibrating a sampling clock signal referenced by the target drive signal sampling according to the natural frequency of the linear motor to obtain the target clock signal.
[0012] According to a second aspect of an embodiment of the present application, a linear motor driving device is provided, comprising: an acquisition module for acquiring an instruction data packet, wherein the instruction data packet comprises at least one waveform content and time information corresponding to the waveform content; a generation module for generating a target drive signal corresponding to the waveform content according to a target clock signal and the waveform content, wherein the frequency of the target drive signal is the natural frequency of the linear motor; the target clock signal is a clock signal that matches the natural frequency of the linear motor; a drive module for driving the linear motor by means of the target drive signal; a timing module for timing the driving duration of the linear motor according to a standard clock signal; and a control module for controlling the actual duration of driving the linear motor by means of the target drive signal according to the timing result and the playback duration indicated by the time information corresponding to the target drive signal.
[0013] According to a third aspect of an embodiment of the present application, there is provided an electronic device, comprising: a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus; the memory is used to store at least one executable instruction, and the executable instruction enables the processor to execute a method as described in any embodiment of the first aspect above.
[0014] According to a fourth aspect of the embodiments of the present application, a computer storage medium is provided, on which a computer program is stored. When the program is executed by a processor, the method described in any embodiment of the first aspect above is implemented.
[0015] In the embodiment of the present application, after acquiring the instruction data packet, a target drive signal with a frequency of the natural frequency of the linear motor can be generated according to the target clock signal and the waveform content included in the instruction data packet, and the linear motor can be driven by the target drive signal to ensure the vibration effect of the linear motor. At the same time, the driving duration of the linear motor is timed according to the standard clock signal, and the actual driving duration of the linear motor can be controlled based on the accurate timing result, so that the actual driving duration of the linear motor is the same as the timing result, so as to ensure that the user has a good vibration experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the embodiments of the present application. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.
[0017] Figure 1 is a flow chart of steps of a linear motor driving method provided by an optional embodiment of the present application;
[0018] Figure 2 is a timing diagram of a target driving signal of an optional embodiment of the present application;
[0019] Figure 3 is a timing diagram of another target driving signal of an optional embodiment of the present application;
[0020] Figure 4 This is a schematic diagram of time settings for a continuous time mode in an optional embodiment of the present application;
[0021] Figure 5 This is a schematic diagram of time setting for an intermittent time mode in an optional embodiment of the present application;
[0022] Figure 6 is a structural block diagram of a linear motor driving device provided in an optional embodiment of the present application;
[0023] Figure 7 is a structural block diagram of another linear motor driving device provided in an optional embodiment of the present application;
[0024] Figure 8 It is a structural schematic diagram of an electronic device provided by an optional embodiment of the present application. DETAILED DESCRIPTION
[0025] In order to enable those skilled in the art to better understand the technical solutions in the embodiments of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the embodiments of the present application should fall within the scope of protection of the embodiments of the present application.
[0026] The terms used in this application are for the purpose of describing specific embodiments only and are not intended to limit this application. The singular forms of "a", "said" and "the" used in this application and the appended claims are also intended to include plural forms unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.
[0027] It should be understood that although the terms first, second, third, etc. may be used in this application to describe various information, such information should not be limited to these terms. For example, without departing from the scope of this application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0028] A first aspect of an embodiment of the present application provides a linear motor driving method to solve the above-mentioned problem.
[0029] like Figure 1 As shown, the linear motor driving method provided by the embodiment of the present application includes:
[0030] S110: Acquire an instruction data packet, wherein the instruction data packet includes at least one waveform content and time information corresponding to the waveform content.
[0031] The instruction data packet may be an instruction data packet issued by a processor such as a CPU in an electronic device, so that the processor of the electronic device controls the vibration of the linear motor through the instruction data packet. The waveform content in the instruction data packet can be understood as the vibration content of the linear motor. For example, the waveform content may be instruction data indicating the correspondence between the vibration amplitude of the linear motor and time, or it may be instruction data indicating the vibration mode executed by the linear motor. It should be understood that in the embodiment of the present application, some fixed vibration modes may be preset, and the correspondence between the vibration amplitude of the linear motor and time corresponding to these vibration modes may be stored. Different vibration modes have different vibration contents, such as short vibration, long vibration, sinusoidal waveform vibration, etc. When the waveform content is instruction data indicating the vibration mode executed by the linear motor, the correspondence between the vibration amplitude of the linear motor and time corresponding to the vibration mode may be obtained according to the vibration mode indicated by the waveform content.
[0032] The time information corresponding to the waveform content may include time information such as the start time, end time, and playback duration of driving the linear motor to play the waveform content. It should be noted that the process of the linear motor playing the waveform content is the process of the linear motor vibrating under the drive of the target drive signal generated based on the waveform content. The method provided by the implementation of the present application can be applied to the driver chip of the linear motor, so that the driver chip can drive the linear motor to play the waveform content based on the waveform content and the corresponding time information included in the instruction data packet.
[0033] S120: Generate a target drive signal corresponding to the waveform content according to the target clock signal and the waveform content, wherein the frequency of the target drive signal is the natural frequency of the linear motor; and the target clock signal is a clock signal that matches the natural frequency of the linear motor.
[0034] The natural frequency of a linear motor is also called the resonant frequency of the linear motor, F0 frequency, etc., and its magnitude is determined by the material or structure of the linear motor itself. When the frequency of the driving signal driving the linear motor is the same as the natural frequency of the linear motor, resonance occurs between the driving signal and the linear motor, thereby enhancing the vibration effect of the linear motor.
[0035] It should be noted that when the driver chip of the linear motor generates a target drive signal, the signal value of the target drive signal needs to be collected according to a certain sampling frequency, and the signal values collected at different times are connected in sequence to obtain the target drive signal. Since the number of sampling times within a signal cycle of the target drive signal is fixed, the sampling frequency of the target drive signal determines the frequency of the target drive signal. The sampling frequency of the target drive signal is generally a fixed frequency division of the sampling clock signal referenced by the sampling. For example, the sampling frequency of the target drive signal can be 1 / 2, 1 / 4 or 1 / 8 of the sampling clock signal frequency. Therefore, the frequency of the target drive signal determined by its sampling frequency has a fixed multiple relationship with the frequency of the sampling clock signal referenced by the sampling. It should be understood that the sampling clock signal is generally a clock signal generated inside the driver chip of the linear motor, so that the driver chip can generate a corresponding target drive signal according to the sampling clock signal.
[0036] The clock signal that matches the natural frequency of the linear motor can be understood as a clock signal obtained by performing F0 calibration according to the natural frequency of the linear motor, such as a target clock signal obtained by calibration in the following embodiment.
[0037] In the prior art, with the use of electronic devices including linear motors, the natural frequency of the linear motor may shift due to temperature environment, humidity environment, component aging, etc. At this time, continuing to use the clock signal obtained according to the original natural frequency of the linear motor to sample the target drive signal will cause the linear motor to be unable to operate at the resonant frequency, and the vibration amount of the motor will be reduced, thereby affecting the user's vibration experience.
[0038] In some optional embodiments, the method provided in the present application further includes: calibrating a sampling clock signal referenced by the target drive signal sampling according to the natural frequency of the linear motor to obtain a target clock signal.
[0039] According to the above embodiments, there is a fixed multiple relationship between the frequency of the target drive signal and the frequency of the reference clock signal to which it is sampled. In the embodiment of the present application, the frequency of the sampling clock signal can be calibrated according to the natural frequency of the linear motor and the relationship between the frequency of the sampling clock signal and the frequency of the target drive signal to obtain the target clock signal. Thereby, the frequency of the target drive signal obtained by sampling according to the target clock signal is the same as the natural frequency of the linear motor. The method for detecting the natural frequency of the drive motor can refer to the relevant technology and will not be repeated here.
[0040] In an embodiment of the present application, the sampling clock signal used as a reference for sampling the target drive signal can be calibrated according to the natural frequency of the linear motor each time the electronic device is turned on, thereby ensuring that the frequency of the target drive signal generated according to the target clock signal is the natural frequency of the linear motor, thereby avoiding deviation between the frequency of the target drive signal and the natural frequency of the linear motor due to an offset in the natural frequency of the linear motor.
[0041] It should be understood that the sampling clock signal referenced by the target drive signal sampling can be the target clock signal calibrated when the electronic device was last powered on, or it can be the sampling clock signal preset when the electronic device leaves the factory, both of which are within the protection scope of the embodiments of the present application.
[0042] S130: driving the linear motor by the target driving signal, and timing the driving duration of the linear motor according to the standard clock signal.
[0043] The standard clock signal is a clock signal used to indicate the standard time. In the embodiment of the present application, in the process of driving the linear motor by the target drive signal, the target clock signal is not used to time the driving time of the linear motor, but the standard clock signal is used to time the driving time of the linear motor to ensure the accuracy of the timing of the driving time of the linear motor. The standard clock signal can be a standard clock signal issued by a processor such as a CPU in an electronic device, or a standard clock generated by other clock sources outside the driver chip, or a standard clock generated by the clock module inside the driver chip itself. The embodiment of the present application does not limit the method of obtaining the standard clock signal.
[0044] S140: According to the timing result and the playing time indicated by the time information corresponding to the target driving signal, controlling the actual time duration for driving the linear motor by the target driving signal.
[0045] It should be noted that, similar to the way a speaker plays music content through vibration, the "play" in the embodiment of the present application can be understood as the linear motor "playing" the vibration content indicated by the above waveform content through vibration. According to the timing result and the play time indicated by the time information corresponding to the target drive signal, the drive of the linear motor can be stopped at the moment when the play time is met to control the actual time of driving the linear motor through the target drive signal.
[0046] In the embodiment of the present application, after acquiring the instruction data packet, a target drive signal with a frequency of the natural frequency of the linear motor can be generated according to the target clock signal and the waveform content included in the instruction data packet, and the linear motor can be driven by the target drive signal to ensure the vibration effect of the linear motor. At the same time, the driving duration of the linear motor is timed according to the standard clock signal, and the actual driving duration of the linear motor can be controlled based on the accurate timing result, so that the actual driving duration of the linear motor is the same as the timing result, so as to ensure that the user has a good vibration experience.
[0047] It should be noted that the natural frequencies of linear motors belonging to the same batch may also be different. If the natural frequencies of multiple linear motors in the same batch are different, when the driver chips of the linear motors in the same batch are subjected to F0 calibration, the clock signals obtained by the F0 calibration of the driver chips of the linear motors with different natural frequencies will also be different. In the prior art, the clock signal obtained by the F0 calibration is usually directly used to time the driving duration of the linear motor. This will result in different timing results after the same time when timing the linear motors with different natural frequencies in the same batch, resulting in poor consistency in the vibration duration between the linear motors with different natural frequencies.
[0048] In an embodiment of the present application, the linear motor can be driven by a target driving signal generated based on a target clock signal, and at the same time, the driving duration of the linear motor can be timed according to a standard clock signal. This can ensure the vibration sense of the linear motor while making the actual driving duration of the linear motor the same as the timing result. When faced with linear motors of the same batch with different natural frequencies, the problem of poor consistency in vibration duration between linear motors with different natural frequencies can be solved while ensuring the vibration sense.
[0049] In some optional embodiments, the actual duration of driving the linear motor by the target drive signal is controlled according to the timing result and the playback duration indicated by the time information corresponding to the target drive signal, including: determining the phase of the signal value in the target drive signal for driving the linear motor when the driving duration reaches the playback duration according to the timing result and the playback duration indicated by the time information corresponding to the target drive signal; and controlling the actual duration of driving the linear motor by the target drive signal according to the determined phase.
[0050] It should be understood that phase is the position of a wave (such as the target drive signal) at a specific moment in its wave cycle, usually in degrees (angles), also known as phase angle. For example, That is, its phase at time t. Among them, y is used to represent the fluctuation amplitude of the sine wave at time t; A, ω, are all constants, and A>0, ω>0, A is the amplitude of the sine wave, ω is the circular frequency of the sine wave, is the initial phase of the sine wave.
[0051] After obtaining the target drive signal, the phase of the signal value of the target drive signal driving the linear motor when the driving duration reaches the playback duration can be determined based on the timing result of the standard clock signal and the playback duration indicated by the time information corresponding to the target drive signal. Then, the actual duration of driving the linear motor by the target drive signal can be controlled based on the determined phase. For example, when the target drive signal reaches the phase during the process of driving the linear motor, the drive of the linear motor by the target drive signal can be stopped. This makes the actual duration of driving the linear motor by the target drive signal reach the maximum value.
[0052] When sampling the signal value of the target drive signal, the position of the sampling point in each cycle of the target drive signal is fixed. Optionally, in each cycle of the target drive signal, the position of the sampling point may be the zero point position of the target drive signal, that is, the position where the signal value of the target drive signal is zero; or, the position of the sampling point may also be other positions such as the peak position and the trough position of the target drive signal.
[0053] In some optional embodiments, controlling the actual duration of driving the linear motor by the target driving signal according to the determined phase includes:
[0054] When the position where the signal value in the target drive signal is zero is the sampling point position of the target drive signal: if the signal value of the target drive signal at the above determined phase is zero, then when the target drive signal reaches this phase during the process of driving the linear motor, the driving of the linear motor by the target drive signal is stopped. If the signal value of the target drive signal at the above determined phase is not zero, then the zero-point phase at which the next signal value of the target drive signal after the phase is zero is determined, and when the target drive signal reaches this zero-point phase during the process of driving the linear motor, the driving of the linear motor by the target drive signal is stopped.
[0055] For example, Figure 2 A timing diagram of a target drive signal for driving a linear motor is shown. If it is determined that the phase of the target drive signal when the drive duration reaches the playback duration is the phase corresponding to time t1 (the signal value is not zero), then the zero-point phase at which the next signal value of the target drive signal after this phase is zero can be determined to be the phase corresponding to time t2, so that the driving of the linear motor by the target drive signal can be stopped at time t2.
[0056] In the embodiment of the present application, if the signal value of the target drive signal at the phase determined above is zero, the target drive signal can stop driving the linear motor when the phase is reached during the process of the target drive signal driving the linear motor. In addition, if the signal value of the target drive signal at the phase determined above is not zero, the zero-point phase at which the next signal value of the target drive signal after the phase is zero can be determined, and the target drive signal can stop driving the linear motor when the zero-point phase is reached during the process of the target drive signal driving the linear motor. Therefore, regardless of whether the signal value corresponding to the phase determined in the above embodiment is zero, the target drive signal can stop driving the linear motor at the signal value of zero, so that the linear motor loses power when its vibration amplitude is the smallest, and the linear motor can make the transition from vibration to stop smoother, thereby improving the user's vibration experience.
[0057] Of course, in some other optional embodiments, if the signal value of the target driving signal at a phase is not zero, the driving of the linear motor by the target driving signal can be stopped when the phase is reached during the process of the target driving signal driving the linear motor. Figure 2 The target drive signal shown can also directly stop driving the linear motor through the target drive signal at time t1.
[0058] In the embodiment of the present application, the phase of the signal value of the target drive signal driving the linear motor when the driving time reaches the playing time can be determined according to the timing result and the playing time indicated by the time information corresponding to the target drive signal, and the actual time of driving the linear motor by the target drive signal can be controlled according to the phase. When the target drive signal reaches the phase directly during the process of driving the linear motor, the driving of the linear motor by the target drive signal can be stopped, or when the target drive signal reaches the zero phase after the phase during the process of driving the linear motor, the driving of the linear motor by the target drive signal can be stopped, so that the control of the actual driving time of the linear motor is more flexible.
[0059] As a feasible implementation method, when the position where the signal value in the target drive signal is zero is not the sampling point position of the target drive signal, the zero-point phase at which the next signal value of the target drive signal is zero after the phase can be determined, and the phase of the first sampling point after the zero-point phase is determined based on the determined zero-point phase. When the phase of the first sampling point after the zero-point phase is reached during the process of the target drive signal driving the linear motor, the driving of the linear motor by the target drive signal is stopped, thereby improving the smoothness of the transition of the linear motor from vibration to stop.
[0060] Since there may be a deviation between the target clock signal and the standard clock signal, after the target drive signal corresponding to the waveform content is generated according to the target clock signal, the time required for the linear motor to play the waveform content corresponding to the target drive signal may deviate from the playing time indicated by the time information corresponding to the waveform content. Figure 3 The T moment is used to indicate the playback duration indicated by the corresponding time information. The target drive signal 1, the target drive signal 2, and the target drive signal 3 are three target drive signals generated according to the same waveform content and different target clock signals. For the target drive signal 1, before reaching the T moment, its corresponding waveform content has been played. For the target drive signal 1, when reaching the T moment, its corresponding waveform content has just been played. For the target drive signal 1, when reaching the T moment, its corresponding waveform content has not been played.
[0061] When the time required for the linear motor to play the waveform content corresponding to the target drive signal is greater than or equal to the play time indicated by the time information corresponding to the waveform content, there is enough waveform content for the linear motor to play before the corresponding play time is reached, and the actual time for driving the linear motor can be controlled only according to the method of the above embodiment. When the time required for the linear motor to play the waveform content corresponding to the target drive signal is less than the play time indicated by the time information corresponding to the waveform content, there will be a period of time before the corresponding play time is reached without waveform content for the linear motor to play, which may cause the driving of the linear motor by the target drive signal to end prematurely.
[0062] To solve the above problem, in some optional embodiments of the present application, driving the linear motor by the target driving signal includes:
[0063] If the time required for the linear motor to play the waveform content corresponding to the target drive signal is less than the playback time indicated by the time information corresponding to the waveform content, then after the linear motor is driven by the target drive signal to play the corresponding waveform content, the linear motor is driven to repeatedly play the waveform content corresponding to the target drive signal until the actual time for driving the linear motor is reached, which is controlled according to the playback time corresponding to the waveform content.
[0064] In an embodiment of the present application, if the time required for the linear motor to play the waveform content corresponding to the target drive signal is less than the playback time indicated by the time information corresponding to the waveform content, then after the linear motor is driven by the target drive signal to play the corresponding waveform content, the linear motor can be driven repeatedly using the target drive signal to repeatedly play the waveform content corresponding to the target drive signal, thereby avoiding the premature termination of the driving of the linear motor before the playback time indicated by the time information corresponding to the waveform content is reached, thereby ensuring the vibration effect of the linear motor.
[0065] In the embodiment of the present application, the time mode of driving the linear motor may include a continuous time mode and a discontinuous time mode.
[0066] As a feasible implementation, in the continuous time mode, the time information corresponding to the waveform content may include the playback end time of the waveform content, so as to indicate the playback duration by the playback end time. The method provided in the embodiment of the present application may include: determining the playback end time of the waveform content as the playback start time of the next waveform content after the waveform content, thereby simplifying the time information.
[0067] The playback end time may be an absolute time, such as 13:00:00. In the embodiment of the present application, the playback end time of each waveform content may be timed by a standard clock signal. It should be understood that, in the time information included in the acquired instruction data packet, the time information including the playback end time closest to the playback end time may also include the playback start time, that is, the playback start time of the waveform content corresponding to the time information, so as to determine the time to start driving the linear motor to play the waveform content. Alternatively, the time information including the playback end time closest to the playback end time may also not include the playback start time. In this case, the time when the instruction data packet is acquired may be determined as the playback start time of the waveform content corresponding to the time information, that is, after receiving the instruction data packet, the target time signal is directly generated according to the waveform content corresponding to the above time information and the target clock signal, and the linear motor is driven to vibrate. In addition, in the embodiment of the present application, the corresponding playback duration may be indicated by the playback start time and playback end time included in the time information. Alternatively, the corresponding playback duration may also be indicated by the playback end time included in the time information and the playback start time of the waveform content corresponding to the time information determined.
[0068] As an optional embodiment, the time information corresponding to waveform content 1 may include the playback end time T1 of waveform content 1, the time information corresponding to waveform content 2 may include the playback end time T2 of waveform content 2, ..., and the time information corresponding to waveform content n may include the playback end time Tn of waveform content n. Figure 4 As shown, when the linear motor is driven by the target drive signal generated according to the waveform content, Figure 4 At time T=T1, the drive of the linear motor by the target drive signal corresponding to waveform content 1 ends, and the drive of the linear motor by the target drive signal corresponding to waveform content 2 begins. Figure 4 At time T2, the driving of the linear motor by the target driving signal corresponding to waveform content 2 ends, and the driving of the linear motor by the target driving signal corresponding to waveform content 3 begins, and so on, until the playback end time Tn of waveform content n is reached.
[0069] In the process of driving the linear motor, the timer can be used to time the end time of the playback indicated by the time information corresponding to the waveform content according to the standard clock signal. In addition, the timer can be in a cumulative timing state to ensure the accuracy of the timing, so that the linear motor can be driven to produce a specific vibration at a specific time. If the waveform content used to generate the target drive signal is a waveform content generated according to the rhythm of music, then in the continuous time mode, the linear motor can be driven to vibrate more accurately according to the rhythm of music corresponding to the waveform content according to the target drive signal, thereby realizing the function of the electronic device vibrating with the sound.
[0070] In some optional embodiments, the embodiments of the present application can generate a command data packet based on the music that the music player of the electronic device is about to play, and obtain the waveform content and time information corresponding to the music (rhythm). Generate a target drive signal based on the waveform content corresponding to the music. Drive the linear motor through this target drive signal, and control the actual time of driving the linear motor to be the same as the actual time of playing the music by the music player according to the corresponding time information and the standard time signal, so that the electronic device can achieve the effect of vibrating with the sound.
[0071] As a feasible implementation, in the intermittent time mode, the time information corresponding to the waveform content includes the playing duration of the waveform content, so that the playing duration is indicated by the playing duration. The method provided in the embodiment of the present application also includes: determining the playing start time of the waveform content according to the time when the instruction data packet including the waveform content is obtained. In the embodiment of the present application, the playing duration indicated by the time information can be the same as the playing duration of the corresponding waveform content.
[0072] As an optional embodiment, the time information corresponding to waveform content 1' may include the playback duration A1 of waveform content 1', the time information corresponding to waveform content 2' may include the playback duration A2 of waveform content 2', the time information corresponding to waveform content 3' may include the playback duration A3 of waveform content 3', ..., the time information corresponding to waveform content n' may include the playback duration An of waveform content n'.
[0073] like Figure 5 As shown, in the relative mode, if the driver chip receives a command data packet including waveform content 1' and playing duration A1 at time T0', then time T0' can be determined as the playing start time of waveform content 1', and the linear motor can be directly driven to play waveform content 1'. Playing duration A1 can indicate that the playing duration is A1. According to the playing duration A1, Figure 5 If at a certain time point T2' after T1', the driver chip receives a command data packet including waveform content 2' and playback duration A2, then T2' can be determined as the playback start time of waveform content 2', and the linear motor can be directly driven to play waveform content 2'. The playback duration A2 can indicate that the playback duration is A2. According to the playback duration A2, Figure 5 Similarly, when the driver chip receives the waveform content and the corresponding playback duration at times T4', T6', etc., the same method can be used to determine the playback start time of the corresponding waveform content.
[0074] In the embodiment of the present application, the time information corresponding to the waveform content includes the duration of playing the waveform content, and the start time of playing the waveform content can be determined according to the time of acquiring the instruction data packet including the waveform content. For example, the time when the driver chip acquires the instruction data packet can be directly determined as the start time of playing the corresponding waveform content. Therefore, the waveform content included in the instruction data packet can be played at any time when the instruction data packet is received, thereby meeting the need to drive the linear motor to vibrate at any time, making the time of driving the linear motor more flexible.
[0075] According to a second aspect of the embodiments of the present application, a linear motor driving device is provided, which can be applied to a driving chip of a linear motor. Figure 6 As shown, the linear motor driving device includes:
[0076] An acquisition module 601 is used to acquire an instruction data packet, wherein the instruction data packet includes at least one waveform content and time information corresponding to the waveform content;
[0077] A generating module 602 is used to generate a target drive signal corresponding to the waveform content according to the target clock signal and the waveform content, wherein the frequency of the target drive signal is the natural frequency of the linear motor; and the target clock signal is a clock signal matching the natural frequency of the linear motor;
[0078] A driving module 603, used to drive the linear motor through a target driving signal;
[0079] A timing module 604, used to time the driving time of the linear motor according to the standard clock signal;
[0080] The control module 605 is used to control the actual duration of driving the linear motor by the target drive signal according to the timing result and the playback duration indicated by the time information corresponding to the target drive signal. The control module can control the actual duration of driving the linear motor by controlling the start time and the end time of driving the linear motor by the target drive signal.
[0081] The linear motor driving device provided in the embodiment of the present application and the aforementioned linear motor driving method embodiment are based on the same inventive concept and can achieve the same effect. The specific implementation process can be found in the description in the aforementioned data storage method embodiment, which will not be repeated here.
[0082] like Figure 7 As shown, in some optional embodiments, the linear motor driving device may further include a parsing module 606 , an F0 calibration module 607 , a first clock module 608 and a second clock module 609 .
[0083] The parsing module 606 is used to parse the instruction data packet to obtain the waveform content and the time information corresponding to the waveform content.
[0084] The F0 calibration module 607 is used to detect the natural frequency of the linear motor and calculate the F0 calibration value according to the natural frequency of the linear motor. The F0 calibration value can be used to adjust the clock signal in the driver chip to obtain the target clock signal. The F0 calibration value can be the frequency difference between the adjusted target clock signal and the original clock signal in the driver chip, or the frequency of the adjusted target clock signal, or other suitable parameters.
[0085] The first clock module 608 is used to adjust the clock signal in the driver chip according to the F0 calibration value to generate a target clock signal.
[0086] The second clock module 609 is used to obtain a standard clock signal, for example, to obtain a standard clock signal from a CPU that sends a command data packet, and if the driving chip of the linear motor includes a clock generator that generates a standard clock signal, the second clock module can also obtain the standard clock signal from the clock generator.
[0087] In the embodiment of the present application, the linear motor driving device may further include a parsing module 606, an F0 calibration module 607, a first clock module 608 and a second clock module 609, so that the instruction data packet acquired by the acquisition module 601 can be parsed by the parsing module 606 to obtain the waveform content included and the time information corresponding to the waveform content; the F0 calibration value can be obtained by the F0 calibration module 607, so that the target clock signal can be generated according to the F0 calibration value by the first clock module 608; and the standard clock signal can also be obtained by the second clock module 609, so that the timing module 604 can time the driving duration of the linear motor according to the standard clock signal.
[0088] According to a third aspect of the embodiments of the present application, an electronic device is also provided. Figure 8 , shows a schematic diagram of the structure of an electronic device according to an embodiment of the present application. The specific embodiment of the present application does not limit the specific implementation of the electronic device.
[0089] like Figure 8 As shown, the electronic device may include: a processor (processor) 802 , a communication interface (Communications Interface) 804 , a memory (memory) 806 , and a communication bus 808 .
[0090] in:
[0091] The processor 802 , the communication interface 804 , and the memory 806 communicate with each other via a communication bus 808 .
[0092] The communication interface 804 is used to communicate with other electronic devices or servers.
[0093] The processor 802 is used to execute the program 810, and specifically can execute the relevant steps in the above-mentioned linear motor driving method embodiment.
[0094] Specifically, the program 810 may include program codes, which include computer operation instructions.
[0095] The processor 802 may be a CPU, or an application specific integrated circuit ASIC (Application Specific Integrated Circuit), or one or more integrated circuits configured to implement the embodiments of the present application. The one or more processors included in the smart device may be processors of the same type, such as one or more CPUs; or processors of different types, such as one or more CPUs and one or more ASICs.
[0096] The memory 806 is used to store the program 810. The memory 806 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.
[0097] The program 810 may include multiple computer instructions. Specifically, the program 810 may enable the processor 802 to execute operations corresponding to the linear motor driving method described in any of the aforementioned method embodiments through the multiple computer instructions.
[0098] The specific implementation of each step in program 810 can refer to the corresponding description of the corresponding steps and units in the above method embodiment, and has corresponding beneficial effects, which will not be repeated here. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working process of the above-described devices and modules can refer to the corresponding process description in the above method embodiment, which will not be repeated here.
[0099] The present application also provides a computer storage medium on which a computer program is stored, and when the program is executed by a processor, the method described in any of the above-mentioned multiple method embodiments is implemented. The computer storage medium includes but is not limited to: a compact disc read-only memory (CD-ROM), a random access memory (RAM), a floppy disk, a hard disk or a magneto-optical disk, etc.
[0100] It should be pointed out that, according to the needs of implementation, the various components / steps described in the embodiments of the present application can be split into more components / steps, or two or more components / steps or partial operations of components / steps can be combined into new components / steps to achieve the purpose of the embodiments of the present application.
[0101] Those of ordinary skill in the art will appreciate that the units and method steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the embodiments of the present application.
[0102] The above implementation methods are only used to illustrate the embodiments of the present application, and are not limitations on the embodiments of the present application. Ordinary technicians in the relevant technical field can make various changes and modifications without departing from the spirit and scope of the embodiments of the present application. Therefore, all equivalent technical solutions also belong to the scope of the embodiments of the present application. The scope of patent protection of the embodiments of the present application should be limited by the claims.
Claims
1. A linear motor driving method, characterized in that: include: Acquire an instruction data packet, wherein the instruction data packet includes at least one waveform content and time information corresponding to the waveform content; According to the target clock signal and the waveform content, a target drive signal corresponding to the waveform content is generated, wherein the frequency of the target drive signal is the natural frequency of the linear motor; and the target clock signal is a clock signal matching the natural frequency of the linear motor; The linear motor is driven by the target driving signal, and the driving duration of the linear motor is timed according to a standard clock signal; According to the timing result and the playing time indicated by the time information corresponding to the target driving signal, the actual time duration for driving the linear motor by the target driving signal is controlled.
2. The method according to claim 1, characterized in that The controlling the actual duration of driving the linear motor by the target driving signal according to the timing result and the playing duration indicated by the time information corresponding to the target driving signal comprises: Determine, according to the timing result and the playback duration indicated by the time information corresponding to the target drive signal, a phase of a signal value in the target drive signal that drives the linear motor when the drive duration reaches the playback duration; According to the determined phase, the actual duration of driving the linear motor by the target driving signal is controlled.
3. The method according to claim 2, characterized in that The step of controlling the actual duration of driving the linear motor by the target driving signal according to the determined phase comprises: When the position where the signal value in the target drive signal is zero is the sampling point position of the target drive signal: If the signal value of the target driving signal at the phase is zero, when the phase is reached during the process of the target driving signal driving the linear motor, the driving of the linear motor by the target driving signal is stopped; If the signal value of the target drive signal at the phase is not zero, the zero-point phase at which the next signal value of the target drive signal after the phase is determined to be zero, and when the zero-point phase is reached during the process of the target drive signal driving the linear motor, the driving of the linear motor by the target drive signal is stopped.
4. The method according to claim 1, characterized in that: The driving the linear motor by the target driving signal comprises: If the time required for the linear motor to play the waveform content corresponding to the target drive signal is less than the playback time indicated by the time information corresponding to the waveform content, then after the linear motor is driven by the target drive signal to play the corresponding waveform content, the linear motor is driven to repeatedly play the waveform content corresponding to the target drive signal.
5. The method according to any one of claims 1 to 4, characterized in that The time information corresponding to the waveform content includes the end time of playing the waveform content, so as to indicate the length of the playing time by the end time of playing; The method further includes: determining the end time of playing the waveform content as the start time of playing the next waveform content after the waveform content.
6. The method according to any one of claims 1 to 4, characterized in that The time information corresponding to the waveform content includes a playing duration of playing the waveform content, so that the playing duration is indicated by the playing duration; The method further includes: determining a start time of playing the waveform content according to a time of acquiring an instruction data packet including the waveform content.
7. The method according to any one of claims 1 to 4, characterized in that The method further comprises: The sampling clock signal referenced by the target drive signal is calibrated according to the natural frequency of the linear motor to obtain the target clock signal.
8. A linear motor driving device, characterized in that: include: An acquisition module, used for acquiring an instruction data packet, wherein the instruction data packet includes at least one waveform content and time information corresponding to the waveform content; A generating module, configured to generate a target drive signal corresponding to the waveform content according to a target clock signal and the waveform content, wherein the frequency of the target drive signal is the natural frequency of the linear motor; and the target clock signal is a clock signal matching the natural frequency of the linear motor; A driving module, configured to drive the linear motor through the target driving signal; A timing module, used for timing the driving duration of the linear motor according to a standard clock signal; The control module is used to control the actual duration of driving the linear motor by the target driving signal according to the timing result and the playing duration indicated by the time information corresponding to the target driving signal.
9. An electronic device, comprising: A processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus; The memory is used to store at least one executable instruction, and the executable instruction enables the processor to execute the method according to any one of claims 1-7.
10. A computer storage medium having a computer program stored thereon, wherein the program, when executed by a processor, implements the method according to any one of claims 1 to 7.
