Driving waveform generation method and device, storage medium and electronic device
By storing instruction data packets in the driver chip and generating drive waveforms of multiple mode waveform slices, the problem that the driver chip is difficult to adapt to rich haptic effects is solved, and efficient generation and flexible combination of drive waveforms are achieved.
Patent Information
- Application Number
- CN202411057605.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-02
- Publication Date
- 2025-08-29
AI Technical Summary
In the prior art, the driver chip is difficult to adapt to the rich linear motor haptic effects, resulting in a large amount of data transmission, a long time occupancy of the CPU bus, and affecting the bus bandwidth requirements.
By storing the instruction data packets to the local storage unit, the amount of transmitted waveform data is reduced, and the driving waveforms are generated sliced by multiple mode waveforms are realized, combining and splicing of driving waveforms is improved, and the generation freedom and flexibility are improved.
It reduces the demand for bus bandwidth, improves the freedom and flexibility of driving waveform generation, and avoids bus occupation caused by large data volume.
Smart Images

Figure CN119010670A9_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of electronic information technology, and in particular to a driving waveform generation method and device, a storage medium, and an electronic device. Background Art
[0002] In the existing technology, the driver chip drives the linear motor to vibrate according to the driving waveform to achieve the tactile effect of the linear motor. As the tactile effects of the linear motor become richer and richer, the driving waveform becomes more and more complex, resulting in the existing driver chip gradually becoming difficult to adapt to the rich tactile effect requirements. To solve this problem, related technologies develop software to adapt to various application scenarios to meet the rich tactile effects of the linear motor.
[0003] The software developed in related technologies typically generates complex waveform data. The CPU (Central Processing Unit) then transmits this waveform data to a driver chip via a protocol interface, such as an I2C bus interface. The driver chip then generates a driving waveform based on the waveform data, driving the linear motor to vibrate and produce different tactile effects. However, the waveform data transmitted in related technologies is composed of a large number of waveform data points. During the transmission process from the CPU to the storage space of the driver chip via the bus interface, the large amount of data transmitted occupies the CPU bus for a long time, resulting in a high demand for bus bandwidth. Summary of the Invention
[0004] In view of this, embodiments of the present application provide a driving waveform generating method and device, a storage medium, and an electronic device to solve or alleviate the problems existing in the prior art.
[0005] According to the first aspect of an embodiment of the present application, a driving waveform generation method is provided, which stores a received instruction data packet in a local storage unit, wherein the instruction data packet includes at least a waveform pattern describing the driving waveform and corresponding playback parameters, and the driving waveform represents the tactile effect of the linear motor; according to the received playback request, the instruction data packet is read from the local storage unit to obtain the current waveform pattern; the current playback parameters having a mapping relationship with the current waveform pattern are read from the local storage unit to generate a playback instruction for the current driving waveform; based on the playback instruction of the current driving waveform, the current driving waveform is generated and output.
[0006] In some embodiments of the present application, an instruction data packet is composed of multiple instruction data units, each instruction data unit includes a waveform pattern describing a driving waveform and corresponding playback parameters, wherein the current waveform pattern is a waveform pattern of multiple waveform slices; current playback parameters having a mapping relationship with the current waveform pattern are read from a local storage unit to generate playback instructions for the current driving waveform, including: determining multiple playback parameters having a mapping relationship with the waveform pattern of multiple waveform slices; generating playback instructions for multiple waveform slices based on the multiple playback parameters respectively; and generating a playback instruction sequence from the playback instructions of the multiple waveform slices in sequence based on the sorting of the multiple waveform slices.
[0007] In some embodiments of the present application, multiple playback parameters having a mapping relationship with the waveform patterns of multiple waveform slices are determined, including: obtaining corresponding first playback parameters and second playback parameters from an instruction data packet based on the waveform patterns of the multiple waveform slices, wherein the waveform pattern includes at least one of a pre-stored waveform pattern, a real-time waveform pattern, a DC waveform pattern, a sinusoidal waveform pattern, a shaped square wave pattern, a braking waveform pattern and a triangular waveform pattern, the first playback parameter includes at least one of vibration duration, number of occurrences, vibration cycle and braking time, and the second playback parameter includes at least one of a waveform gain coefficient, vibration voltage, vibration intensity, waveform sequence, vibration intensity regularity parameter, vibration frequency, waveform amplitude and reverse electromotive force voltage; based on the first playback parameter and the second playback parameter, multiple playback parameters are obtained.
[0008] In some embodiments of the present application, the instruction header of the playback instruction of each waveform slice carries the waveform mode encoding information or control instruction of the waveform slice.
[0009] In some embodiments of the present application, the playback instruction of each waveform slice includes an instruction header and an instruction body, the instruction header carries the waveform mode encoding information of the waveform slice, and the instruction body carries the playback parameters of the waveform slice.
[0010] In some embodiments of the present application, based on the playback instruction of the current driving waveform, the current driving waveform is generated and output, including: decoding the waveform pattern encoding information in the instruction header of each waveform slice to obtain the waveform pattern; reading the playback parameters corresponding to the waveform pattern from the local storage unit, and generating each waveform slice based on the playback parameters; and outputting the slice sequence of the generated waveform slices as the current driving waveform.
[0011] In some embodiments of the present application, each waveform slice is generated based on the playback parameters, including: when the first playback parameter among the playback parameters corresponding to the current instruction data unit reaches a preset condition, generating a completion identification signal of the current instruction data unit, wherein the completion identification signal is used to identify that the waveform slice corresponding to the current instruction data unit has been generated; obtaining the playback parameters of the next instruction data unit in the instruction data packet, and generating the next waveform slice; when the end instruction in the playback instruction is obtained, stopping the generation of waveform slices.
[0012] According to a second aspect of an embodiment of the present application, a driving waveform generating device is provided, comprising: a storage module for storing a received instruction data packet in a local storage unit, wherein the instruction data packet includes at least a waveform pattern describing a driving waveform and corresponding playback parameters, and the driving waveform represents the tactile effect of the linear motor; a first reading module for reading the instruction data packet from the local storage unit to obtain the current waveform pattern according to a received playback request; a second reading module for reading the current playback parameters having a mapping relationship with the current waveform pattern from the local storage unit, and generating a playback instruction for the current driving waveform; and a generation module for generating and outputting the current driving waveform based on the playback instruction of the current driving waveform.
[0013] According to a third aspect of an embodiment of the present application, an electronic device is provided, 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 perform an operation corresponding to the drive waveform generation method of any of the above embodiments.
[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 driving waveform generating method as described in any of the above embodiments is implemented.
[0015] According to the driving waveform generation method and device, storage medium, and electronic device provided in the embodiments of the present application, by transmitting a command data packet consisting of a small amount of data to a local storage unit, the demand for bus bandwidth is reduced by reducing the amount of waveform data transmitted, and the current waveform mode and corresponding current playback parameters are obtained by processing the command data packet in the local storage unit, so as to generate a current driving waveform with multiple pattern waveform slices based on the command data packet, thereby realizing the combined splicing of driving waveforms of various waveform modes and improving the freedom and flexibility of generating driving waveforms. 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 following briefly introduces the drawings required for use in the embodiments or the description of the prior art. 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 A structural block diagram of a system used in a driving waveform generation method in the related art;
[0018] Figure 2 This is a flow chart of a method for generating a driving waveform according to an embodiment of the present application;
[0019] Figure 3 A structural block diagram of a driving waveform generating system applied to a driving waveform generating method;
[0020] Figure 4 1 is a schematic diagram of the overall flow of a driving waveform generating method according to one embodiment of the present application;
[0021] Figure 5 1 is a schematic diagram of the structure of an instruction data unit according to an embodiment of the present application;
[0022] Figure 6 is a waveform diagram of a current driving waveform according to one embodiment of the present application;
[0023] Figure 7 A schematic diagram of a process for generating an instruction data packet according to an embodiment of the present application;
[0024] Figure 8 is a structural block diagram of a driving waveform generating device according to an embodiment of the present application;
[0025] Figure 9 The figure is a structural block diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0026] 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. Based on the embodiments in the embodiments of the present application, all other embodiments obtained by ordinary technicians in this field should fall within the scope of protection of the embodiments of the present application.
[0027] Specifically, Figure 1 FIG. 1 is a structural block diagram of a system used in a driving waveform generation method in the related art. Figure 1As shown, the system 10 applied to the driving waveform generation method includes a CPU 100 , a driving chip 200 and a linear motor 300 , wherein the driving chip 200 includes a protocol interface unit 201 , a main control unit 202 and a waveform generation and control unit 203 .
[0028] It is understood that in the related art, when the CPU receives a play request from the upper layer, it sends a data packet consisting of all waveform data points of the driving waveform through the protocol interface unit 201 (such as the I2C bus interface) to the memory unit (RAM, random access memory) of the driver chip 200. The main control unit 202 of the driver chip 200 then reads the waveform point data packet from the memory unit and sends it to the waveform generation and control unit 203 to generate the corresponding driving waveform, thereby driving the linear motor 300 to execute the driving waveform to produce the corresponding tactile effect. The waveform generation and control unit 203 may include a real-time waveform data storage and reading control module, a pre-stored waveform data storage and reading control module, a shaped square wave generation module, and a brake waveform generation module to generate the corresponding driving waveform through these modules.
[0029] However, since the waveform point data packet in the related art is composed of all waveform data points of the driving waveform, the data volume of the waveform point data packet is large. For example, the driving waveform is a 170HZ sine wave, and the sampling rate is 24K. It is calculated that there are 141 waveform data points that need to be transmitted. At this time, the waveform point data packet needs to include these 141 waveform data points. Therefore, when transmitting the waveform point data packet, the CPU, I2C interface and bus will be occupied to a large extent. When a chip with a higher priority uses the bus to transmit data, the transmission of the waveform point data packet will be interrupted, causing the linear motor to be disconnected.
[0030] Therefore, the present application proposes a driving waveform generation method and device, a storage medium and an electronic device, which reduces the demand for bus bandwidth by transmitting an instruction data packet consisting of a small amount of data to a local storage unit to reduce the amount of waveform data transmitted, and obtains the current waveform mode and the corresponding current playback parameters by processing the instruction data packet in the local storage unit, so as to generate a current driving waveform with multiple pattern waveform slices according to the instruction data packet, realize the combination and splicing of driving waveforms of various waveform modes, and improve the freedom and flexibility of generating driving waveforms.
[0031] The specific implementation of the embodiment of the present application is further explained below in conjunction with the accompanying drawings of the embodiment of the present application.
[0032] Figure 2 FIG. 1 is a flow chart of a method for generating a driving waveform according to an embodiment of the present application. Figure 2 As shown, the driving waveform generating method includes:
[0033] S21: Storing the received instruction data packet in a local storage unit, wherein the instruction data packet at least includes a waveform pattern describing a driving waveform and corresponding playback parameters, and the driving waveform represents a tactile effect of the linear motor.
[0034] Specifically, the instruction data packet includes waveform pattern data describing the driving waveform and playback parameter data corresponding to various waveform pattern data. A waveform pattern of a complex driving waveform composed of various different modes of driving waveforms and the mapping relationship between the corresponding playback parameters can be stored in an instruction data packet. The instruction data packet also includes start address data and end address data for dividing each instruction data packet.
[0035] By parsing the instruction data packet, the waveform pattern of the driving waveform can be obtained. Further, based on the mapping relationship between the waveform pattern and the playback parameters, the playback parameters of the driving waveform can be obtained, thereby generating a driving waveform so that the driver chip can control the linear motor to execute the driving waveform to produce a corresponding tactile effect. During the transmission process, only the instruction data packet including the waveform pattern of the driving waveform and the corresponding playback parameters needs to be transmitted, without the need to transmit a large number of waveform data points, which effectively reduces the amount of data and reduces the demand for bus bandwidth when the CPU sends the instruction data packet to the driver chip.
[0036] The local storage unit includes, but is not limited to, the SRAM (Static Random-Access Memory), FLASH (flash memory), and ROM (Read Only Memory) storage units of the driver chip. The local storage unit includes an instruction pre-storage subunit and an instruction real-time storage subunit. The instruction pre-storage subunit stores instruction data packets such as waveform patterns and corresponding playback parameters corresponding to commonly used driving waveforms initialized by the CPU after the driver chip is powered on. That is, the instruction data packets in the instruction pre-storage subunit are first stored in full, and then the instruction data packets are called according to the playback request to play the waveform slice. The instruction data can be updated according to demand.
[0037] The instruction real-time storage subunit stores the instruction data packets sent by the CPU to the driver chip in real time. That is, while transmitting the instruction data packets to the instruction real-time storage subunit in real time, the instruction data packets are called to play waveform slices. One or more instruction data packets can be stored in the instruction pre-stored storage subunit and the instruction real-time storage subunit.
[0038] S22: According to the received play request, read the instruction data packet from the local storage unit to obtain the current waveform pattern.
[0039] A play request instructs the player to play a driving waveform. The play request includes parameters that instruct the driver to retrieve a command data packet from the pre-stored instruction storage subunit or the real-time instruction storage subunit of the local storage unit. When the driver chip receives the play request from the CPU, it retrieves the command data packet from the pre-stored instruction storage subunit or the real-time instruction storage subunit based on the parameters in the play request and parses the command data packet to obtain the current waveform pattern.
[0040] S23: Reading current playback parameters that have a mapping relationship with the current waveform pattern from the local storage unit, and generating a playback instruction for the current driving waveform.
[0041] Furthermore, in some embodiments of the present application, current playback parameters having a mapping relationship with the current waveform pattern are read from a local storage unit to generate playback instructions for the current driving waveform, including: determining multiple playback parameters having a mapping relationship with the waveform pattern of multiple waveform slices; generating playback instructions for multiple waveform slices based on the multiple playback parameters respectively; and generating a playback instruction sequence from the playback instructions of the multiple waveform slices in sequence based on the sorting of the multiple waveform slices.
[0042] Because the instruction data packet includes different waveform patterns and corresponding playback parameters, it is composed of multiple instruction data units, each of which includes a waveform pattern describing a driving waveform and corresponding playback parameters. That is, each instruction data unit includes a waveform pattern describing a driving waveform and corresponding playback parameter data, and multiple instruction data units are spliced together to form an instruction data packet with different waveform patterns and corresponding playback parameters. Furthermore, the current waveform pattern is a waveform pattern of multiple waveform slices, i.e., the current waveform pattern is a freely combined waveform pattern of multiple waveform slices.
[0043] That is to say, by determining the waveform patterns of multiple waveform slices in the current waveform pattern, the playback parameters corresponding to the waveform pattern of each waveform slice are obtained in turn, and they are spliced into the current playback parameters corresponding to the current waveform pattern to form a playback instruction, and the playback sequence of the playback instruction is formed according to the order of multiple waveform slices.
[0044] S24: Based on the playback instruction of the current driving waveform, generate the current driving waveform and output it.
[0045] It can be understood that the playback instruction has multiple waveform patterns and corresponding playback parameters. According to the playback instruction, a current driving waveform composed of multiple different driving waveforms can be generated and output, so that the linear motor produces a corresponding tactile effect based on the current driving waveform. In this way, by combining the waveform patterns of multiple waveform slices to obtain the current waveform pattern, and generating a current driving waveform with multiple waveform slices according to the current playback parameters corresponding to the current waveform pattern, the driving waveforms of various waveform patterns can be combined and spliced, thereby improving the freedom and flexibility of generating the driving waveform.
[0046] For example, Figure 3 The structure block diagram of the driving waveform generation system applied to the driving waveform generation method is shown in FIG.
[0047] like Figure 3 As shown, the driving waveform generation system 30 includes a protocol interface unit 201 , a local storage unit 301 , a main control unit 202 , a waveform generation and control unit 203 and a waveform processing unit 302 .
[0048] The protocol interface unit 201 may be an AHB interface (Advanced High-performance Bus), an APB interface (Advanced Peripheral Bus), an I3C bus interface, an I2C bus interface, an I2S interface, or an SPI interface (Serial Peripheral Interface), or other interfaces, which are not limited herein. The CPU may send instruction data packets to the local storage unit via the protocol interface unit 201, and the main control unit 202 may also communicate with the CPU via the protocol interface unit 201, sending its own status to the CPU and receiving instructions issued by the CPU.
[0049] The local storage unit 301 includes an instruction real-time storage subunit 3011 and an instruction pre-stored storage subunit 3012. The instruction real-time storage subunit 3011 is used to store the instruction data packets sent by the CPU to the driver chip in real time; the instruction pre-stored storage subunit 3012 is used to store the waveform mode and corresponding playback parameters corresponding to the commonly used driving waveform initialized by the CPU after the driver chip is powered on. The instruction data can be updated from time to time according to demand. One or more instruction data packets can be stored in the instruction pre-stored storage subunit and the instruction real-time storage subunit.
[0050] The main control unit 202 includes an instruction data packet reading subunit 2021 for reading the instruction data packet in the local storage unit; an instruction data parsing subunit 2022 for parsing the waveform mode data and playback parameter data in the instruction data packet; and a playback mode control subunit 2023 for controlling the playback switching of different waveform modes.
[0051] The waveform generation and control unit 203 includes a pre-stored waveform generation subunit 2031, a real-time waveform generation subunit 2032, a DC square wave generation subunit 2033, a sine wave generation subunit 2034, a shaped square wave generation subunit 2035, a brake wave generation subunit 2036, and a triangle wave generation subunit 2037. These subunits are used to generate corresponding drive waveforms. The DC square wave generation subunit 2033, the sine wave generation subunit 2034, the shaped square wave generation subunit 2035, the brake wave generation subunit 2036, and the triangle wave generation subunit 2037 are built-in waveform generation subunits. The waveform processing unit 302 generates the final drive waveform using amplitude-frequency modulation (AM / FM) techniques.
[0052] Figure 4 FIG. 1 is a schematic diagram of the overall flow of a method for generating a driving waveform according to an embodiment of the present application. Figure 4 As shown, the driving waveform generating method includes:
[0053] S31: The CPU initializes the pre-stored driving waveform and the instruction data packet in the initialization instruction pre-store storage subunit, wherein the initialized pre-stored driving waveform refers to a driving waveform pre-stored in the driving chip, and the driving waveform is composed of a plurality of waveform point data;
[0054] S32: The CPU issues a play request, the driver chip identifies the instruction parameters in the play request, and selects to read an instruction data packet from the instruction real-time storage subunit or the instruction pre-stored storage subunit, wherein the instruction data packet is composed of multiple instruction data units, each instruction data unit including a waveform pattern describing a driving waveform and corresponding play parameter data;
[0055] S33: Parsing each instruction data unit in the instruction data packet to determine the waveform mode encoding information of the waveform slice carried by the instruction header in the instruction data unit, wherein the instruction header of each instruction data unit carries the waveform mode encoding information of the waveform slice corresponding to the instruction data unit, and the instruction body may carry the playback parameters of the waveform slice corresponding to the instruction data unit;
[0056] S34: Decode the waveform pattern encoding information of the waveform slice carried by the instruction header to obtain the waveform pattern;
[0057] S35: Determine whether the waveform mode obtained by decoding conforms to the preset waveform mode. If so, proceed to S36; if not, proceed to S42, wherein the preset waveform mode is the waveform mode supported by the driver chip;
[0058] S36: generating an enable signal for the waveform mode, and reading playback parameters corresponding to the waveform mode from the real-time instruction storage subunit or the pre-stored instruction storage subunit, wherein reading the playback parameters corresponding to the waveform mode from the real-time instruction storage subunit or the pre-stored instruction storage subunit refers to reading the playback parameters corresponding to the waveform mode from the instruction body of each instruction data unit split from the instruction data packet stored in the local storage unit;
[0059] S37: Sending the read playback parameters to each subunit of the waveform generation and control unit respectively, so as to generate each waveform slice according to the playback parameters. When the enable signal corresponding to the waveform mode is at a high level and the playback parameters corresponding to the waveform mode have been acquired by the corresponding waveform generation and control unit subunit, the waveform generation and control unit subunit will start working to generate each waveform slice according to the playback parameters;
[0060] S38: When a first playback parameter (such as playback duration or playback cycle) among the playback parameters of the current instruction data unit reaches a preset condition, a completion identification signal of the current instruction data unit is generated, wherein the preset condition may be other parameters such as a playback duration threshold or a playback cycle threshold. Since each instruction data unit forms a waveform slice, when the completion identification signal of the current instruction data unit is generated, it is indicated that the waveform slice represented by the instruction data unit has been generated. At this time, each sub-unit of the waveform generation and control unit sends a completion identification signal to the main control unit;
[0061] S39: The main control unit reads the waveform pattern and corresponding playback mode of the next instruction data unit in the instruction data packet from the instruction real-time storage subunit or the instruction pre-stored storage subunit, and repeats the above S36-S38 or repeats the above S33-S38;
[0062] S40: Determine whether the end instruction or pause instruction in the play instruction is obtained, if so, enter S41, if not, return to S34;
[0063] S41: Stop generating waveform slices and output the current driving waveform, wherein the current driving waveform includes multiple waveform slices of different modes. Each sub-unit of the waveform generation and control unit sends the waveform slices to the waveform data processing unit to perform amplitude and frequency modulation operations on the waveform slices to obtain the current driving waveform;
[0064] S42: Reporting command abnormal interruption, and exiting the playback of the current drive waveform, and no longer obtaining subsequent command data packets.
[0065] In this way, by transmitting an instruction data packet consisting of a small amount of data to a local storage unit, the demand for bus bandwidth is reduced by reducing the amount of waveform data transmitted, and by processing the instruction data packet in the local storage unit to obtain the current waveform mode and the corresponding current playback parameters, the current driving waveform with multiple pattern waveform slices is generated according to the instruction data packet, thereby realizing the combined splicing of driving waveforms of various waveform modes, and improving the freedom and flexibility of generating driving waveforms.
[0066] In some embodiments, multiple playback parameters having a mapping relationship with the waveform patterns of multiple waveform slices are determined, including: obtaining corresponding first playback parameters and second playback parameters from the instruction data packet based on the waveform patterns of the multiple waveform slices, wherein the waveform patterns include at least one of a pre-stored waveform pattern, a real-time waveform pattern, a DC waveform pattern, a sinusoidal waveform pattern, a shaped square wave pattern, a braking waveform pattern and a triangular waveform pattern, the first playback parameter includes at least one of vibration duration, number of occurrences, vibration cycle and braking time, and the second playback parameter includes at least one of waveform gain coefficient, vibration voltage, vibration intensity, waveform sequence, vibration intensity regularity parameter, vibration frequency, waveform amplitude and reverse electromotive force voltage; based on the first playback parameter and the second playback parameter, multiple playback parameters are obtained.
[0067] Specifically, Table 1 shows the various waveform modes and the corresponding playback parameters. Figure 3 The pre-stored waveform mode is an instruction pre-stored storage subunit 3012 for storing a pre-stored waveform in the driver chip by initialization of the CPU. The pre-stored waveform is a commonly used driving waveform. If there is a playback request for the waveform mode 1, the pre-stored waveform generation subunit 2031 will read the pre-stored waveform and send it to the waveform processing unit 302 for amplitude modulation and frequency modulation to obtain the current driving waveform. Among them, the playback sequence indicates that the driving waveform with the corresponding sequence number is selected for playback, and the waveform gain coefficient indicates the parameter for modulating the amplitude of the driving waveform.
[0068] If there is a playback request for waveform mode 2, the driver chip will read the playback parameters corresponding to the waveform mode from the instruction real-time storage subunit 3011 and send it to the real-time waveform generation subunit 2032 to generate the corresponding waveform slice and send it to the waveform processing unit 302 for amplitude and frequency modulation processing to obtain the current driving waveform.
[0069] If there is a playback request for waveform mode 3, the driver chip will select the corresponding playback parameters according to waveform mode 3, send them to the DC square wave generation sub-unit 2033 to generate a DC square wave waveform slice (such as selecting the playback parameters of a 1.5V DC waveform for 100ms), and send the DC square wave waveform slice to the waveform processing unit 302 for amplitude and frequency modulation processing to obtain the current driving waveform, where the waveform amplitude indicates that the driving waveform is played at a certain fixed amplitude voltage.
[0070] If there is a playback request for waveform mode 4, the driver chip will select the corresponding playback parameters according to waveform mode 4, send it to the sine wave generation subunit 2034 to generate a sine wave waveform slice (select a sine wave with a fixed time of 100ms, a fixed frequency of 170Hz and a maximum amplitude of 2V for loop playback), and send the sine wave waveform slice to the waveform processing unit 302 for amplitude and frequency modulation processing to obtain the current driving waveform.
[0071] If there is a request to play waveform mode 5, the driver chip monitors the motor's back electromotive force voltage to track the motor's F0, selects the corresponding playback parameters based on waveform mode 5, and sends them to the shaped square wave generation subunit 2035 to generate a shaped square wave waveform slice (e.g., playing a shaped square wave with an amplitude of 2V for 100ms). The shaped square wave waveform slice is then sent to the waveform processing unit 302 for amplitude and frequency modulation to obtain the current driving waveform. Shaping refers to modulating the edge of the square wave to obtain a smooth edge rather than an abrupt jump edge, and the waveform slice is sent to the waveform processing unit 302 for amplitude and frequency modulation to obtain the current driving waveform.
[0072] If there is a playback request for waveform mode 6, the driver chip will detect the motor back electromotive force voltage to automatically brake and output the brake waveform. The driver chip controls the brake wave generation subunit 2036 to output a fixed-time brake wave waveform slice (such as a brake waveform with a braking time of 50ms) according to the playback parameters, and sends the brake wave waveform slice to the waveform processing unit 302 for amplitude and frequency modulation to obtain the current drive waveform. Among them, the brake time in the playback parameters is the maximum time, the brake gain is used to adjust the brake amplitude / intensity / voltage, and the brake back electromotive force voltage threshold is the sign of brake stop. Triangle wave generation subunit 2037
[0073] If there is a request for playback mode 7, the triangle wave generation subunit 2037 generates a triangle wave waveform slice based on the set triangle wave playback time and the starting voltage, ending voltage and step voltage per unit time, and sends the triangle wave waveform slice to the waveform processing unit 302 for amplitude modulation and frequency modulation processing to obtain the current driving waveform.
[0074] Table 1 Various waveform modes and corresponding playback parameters
[0075] In summary, the above-mentioned different waveform generation subunits generate a complex current drive waveform composed of waveform slices of various different modes, thereby improving the freedom of generating the drive waveform. In addition, the order of the playback parameters can be adjusted arbitrarily, the encoding method of the waveform mode can also be adjusted arbitrarily, and the waveform mode and playback parameters can be expanded according to actual needs. The playback parameter bit width is the same as the instruction header bit width. The instruction header can be encoded with a bit width of 2, 4, 8, 16, 24, 32, 64 bits, etc. This application does not limit the waveform mode and playback parameters.
[0076] In some embodiments, the instruction header of the playback instruction of each waveform slice carries the waveform mode encoding information or control instructions of the waveform slice.
[0077] In some embodiments, the playback instruction of each waveform slice includes an instruction header and an instruction body, the instruction header carries the waveform mode encoding information of the waveform slice, and the instruction body carries the playback parameters of the waveform slice.
[0078] Figure 5 This is a schematic diagram of the structure of the instruction data unit of an embodiment of the present application, such as Figure 5 As shown, the instruction data unit may be composed of an instruction header and an instruction body, wherein the instruction header carries the waveform pattern encoding information of the waveform slice, and the instruction body carries the playback parameters of the waveform slice.
[0079] In addition, the instruction body can also carry control instructions (configuration instructions or shutdown instructions), which can be used to control the switching of certain chip modules when playing the current driving waveform. For example, in a certain driving mode, a certain module of the driving chip (boost module) is turned off according to the shutdown instruction to achieve low power consumption, or a certain module parameter in the driving mode is configured according to the configuration instruction (configuration voltage parameters or switching power supply frequency parameters) to reduce the power consumption of the playing waveform.
[0080] The instruction data unit may also be composed of a separate instruction header, which carries the waveform mode encoding information of the waveform slice, and the waveform mode encoding information corresponds to the pre-configured playback parameters, and the pre-configured playback parameters are not stored in the instruction data unit; the instruction header may also carry some control instructions, such as empty instructions, mode switching instructions, stop playback instructions, etc., through which certain chip modules can be controlled to switch on and off when playing the current driving waveform, or the parameters of certain chip modules can be adjusted through pre-configured playback parameters.
[0081] In this way, by storing corresponding parameters in the instruction header or instruction body of the instruction data unit, when the CPU sends an instruction data packet to the driver chip, it only needs to send an instruction data packet consisting of multiple instruction data units. This can effectively reduce the amount of data transmitted, avoid the problem of increasing the CPU and the demand for the I2C bus due to playing complex and long-term driving waveforms in real-time data mode, and significantly reduce the demand for bus bandwidth.
[0082] In some embodiments, based on the playback instruction of the current driving waveform, the current driving waveform is generated and output, including: decoding the waveform pattern encoding information in the instruction header of each waveform slice to obtain the waveform pattern; reading the playback parameters corresponding to the waveform pattern from the local storage unit, and generating each waveform slice based on the playback parameters; and outputting the slice sequence of the generated waveform slices as the current driving waveform.
[0083] It can be understood that the current waveform mode corresponding to the current driving waveform is a waveform mode of multiple waveform slices, so it is necessary to generate each waveform slice and combine each waveform slice to obtain the current driving waveform.
[0084] As shown in Table 1, the waveform pattern instruction header data corresponding to each waveform slice is the waveform pattern encoding data, such as: the waveform pattern encoding data includes CH3, CH4, CH5, CH6, CH7, CH8 and CH9, and the waveform pattern encoding data are 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 and 0x07 according to the corresponding decoding data. Among them, the waveform pattern instruction header data corresponding to the instruction header data of the pre-stored waveform pattern is CH3. If 0x01 is obtained by decoding the waveform pattern encoding data, it is determined that the decoding result meets the preset waveform pattern, and an enable signal corresponding to the pre-stored waveform pattern is generated. The playback parameters corresponding to the pre-stored waveform pattern are further read from the local storage unit, and the waveform slices of the pre-stored waveform are generated based on the playback parameters. The waveform slices of other modes are generated in this way, and the current driving waveform is generated based on the slice sequence of the generated waveform slices.
[0085] Conversely, if the waveform pattern encoded data is decoded to 0x00, then it is determined that the decoded result does not conform to the preset waveform pattern, and the waveform pattern encoded data is discarded, and an interrupt exception signal is reported. It is understood that the slicing sequence of the waveform slices can also be adjusted according to actual needs to generate a current driving waveform that meets actual needs.
[0086] For example, Figure 6 is a waveform diagram of a current driving waveform according to an embodiment of the present application, such as Figure 6As shown, the current driving waveform is obtained by parsing different instruction data units, and is specifically composed of a sawtooth wave corresponding to instruction data unit 1, a sine wave corresponding to instruction data unit 2, a DC square wave corresponding to instruction data unit 3, a sine wave corresponding to instruction data unit 4, a shaped square wave corresponding to instruction data unit 5, and a brake wave corresponding to instruction data unit 6. The above multiple instruction data units are composed of an instruction header and an instruction body.
[0087] In this way, by generating waveform slices of various different modes and combining and splicing them into a complex current driving waveform, since the current driving waveform can be arbitrarily arranged, combined and spliced according to waveform slices of multiple different modes, the freedom and flexibility of generating the driving waveform are improved, which helps to generate a complex current driving waveform.
[0088] In some embodiments, each waveform slice is generated based on the playback parameters, including: when the first playback parameter among the playback parameters corresponding to the current instruction data unit reaches a preset condition, generating a completion identification signal of the current instruction data unit, wherein the completion identification signal is used to identify that the waveform slice corresponding to the current instruction data unit has been generated; obtaining the playback parameters of the next instruction data unit in the instruction data packet, and generating the next waveform slice; when the end instruction in the playback instruction is obtained, stopping the generation of waveform slices.
[0089] It can be understood that by judging whether the first playback parameter corresponding to the current instruction data unit meets the preset conditions, the switching of different instruction data units is realized, and waveform slices of different modes are further generated. Compared with the traditional waveform playback method, after the playback of a driving waveform of a certain mode is completed, the CPU waits for the playback request instruction to be issued again before playing the driving waveforms of the remaining modes, the present application can automatically switch the playback of driving waveforms of different modes according to the comparison result of the first playback parameter and the preset conditions, without the need for the CPU to frequently issue playback request instructions. It can reduce the occupancy of the bus and protocol interface while improving the freedom and flexibility of generating the driving waveform.
[0090] It should be noted that before the driver chip stores the received instruction data packet into the local storage unit, the CPU will segment, arrange, combine and splice the required vibration request and the driving waveform of the tactile effect to form the instruction data packet. Figure 7 This is a flow chart of generating an instruction data packet according to an embodiment of the present application. Figure 7 As shown, the process includes:
[0091] S51: Determine a preset driving waveform corresponding to a preset tactile effect;
[0092] S52: Segmenting the preset driving waveform according to the waveform mode supported by the driver chip to obtain multiple groups of preset driving waveforms, wherein each group of preset driving waveforms can be formed by combining driving waveforms corresponding to the above waveform mode;
[0093] S53: Split each group of preset driving waveforms into waveform slices of multiple patterns, and write corresponding instruction data units according to the waveform pattern and playback parameters of each waveform slice;
[0094] S54: Splice each instruction data unit into an instruction data packet and store it in the memory unit of the CPU;
[0095] S55: Send the instruction data packet in the memory to the local storage unit of the driver chip through the protocol interface unit according to the request.
[0096] Therefore, by processing the preset driving waveform to obtain a spliced instruction data packet, the CPU only needs to transmit the instruction data packet with waveform pattern information and playback parameter information to the driver chip to process and generate a complex driving waveform, without the need to transmit a large number of waveform data points, avoiding the problem of occupying the CPU and bus interface for a long time due to the large amount of transmitted data, and reducing the resource consumption of the CPU and bus interface.
[0097] The driving waveform generation method of this embodiment can be executed by any appropriate electronic device with data processing capabilities, including but not limited to: a server, a mobile terminal (such as a mobile phone, a PAD, etc.) and a PC.
[0098] Figure 8 A structural block diagram of a driving waveform generating device according to an embodiment of the present application.
[0099] like Figure 8 As shown, the driving waveform generating device 400 can execute Figure 2 The driving waveform generation method of the present invention is as follows: the driving waveform generation device 400 includes: a storage module 401, which is used to store the received instruction data packet in a local storage unit, wherein the instruction data packet at least includes a waveform pattern describing the driving waveform and corresponding playback parameters, and the driving waveform represents the tactile effect of the linear motor; a first reading module 402, which is used to read the instruction data packet from the local storage unit to obtain the current waveform pattern according to the received playback request; a second reading module 403, which is used to read the current playback parameters having a mapping relationship with the current waveform pattern from the local storage unit, and generate a playback instruction for the current driving waveform; and a generation module 404, which is used to generate and output the current driving waveform based on the playback instruction of the current driving waveform.
[0100] In some embodiments of the present application, the instruction data packet is composed of multiple instruction data units, each instruction data unit includes a waveform pattern describing a driving waveform and corresponding playback parameters, wherein the current waveform pattern is a waveform pattern of multiple waveform slices; the second reading module 403 is specifically used to: determine multiple playback parameters that have a mapping relationship with the waveform pattern of multiple waveform slices; generate playback instructions for multiple waveform slices based on the multiple playback parameters respectively; based on the sorting of the multiple waveform slices, generate a playback instruction sequence for the playback instructions of the multiple waveform slices in sequence.
[0101] In some embodiments of the present application, the second reading module 403 is specifically used to: obtain corresponding first playback parameters and second playback parameters from the instruction data packet based on the waveform mode of multiple waveform slices, wherein the waveform mode includes at least one of a pre-stored waveform mode, a real-time waveform mode, a DC waveform mode, a sinusoidal waveform mode, a shaped square wave mode, a braking waveform mode and a triangular waveform mode, the first playback parameter includes at least one of vibration duration, number of occurrences, vibration cycle and braking time, and the second playback parameter includes at least one of waveform gain coefficient, vibration voltage, vibration intensity, waveform sequence, vibration intensity regularity parameter, vibration frequency, waveform amplitude and back electromotive force voltage; based on the first playback parameter and the second playback parameter, multiple playback parameters are obtained.
[0102] In some embodiments of the present application, the instruction header of the playback instruction of each waveform slice carries the waveform mode encoding information or control instruction of the waveform slice.
[0103] In some embodiments of the present application, the playback instruction of each waveform slice includes an instruction header and an instruction body, the instruction header carries the waveform mode encoding information of the waveform slice, and the instruction body carries the playback parameters of the waveform slice.
[0104] In some embodiments of the present application, the generation module 404 is specifically used to: decode the waveform pattern encoding information in the instruction header of each waveform slice to obtain the waveform pattern; read the playback parameters corresponding to the waveform pattern from the local storage unit, and generate each waveform slice based on the playback parameters; and output the slice sequence of the generated waveform slices as the current driving waveform.
[0105] In some embodiments of the present application, the generation module 404 is specifically used to: generate a completion identification signal of the current instruction data unit when the first playback parameter among the playback parameters corresponding to the current instruction data unit reaches a preset condition, wherein the completion identification signal is used to indicate that the waveform slice corresponding to the current instruction data unit has been generated; obtain the playback parameters of the next instruction data unit in the instruction data packet and generate the next waveform slice; and stop generating waveform slices when the end instruction in the playback instruction is obtained.
[0106] According to the driving waveform generating device of the embodiment of the present application, by transmitting an instruction data packet consisting of a small amount of data to a local storage unit, the demand for bus bandwidth is reduced by reducing the amount of waveform data transmitted, and the current waveform mode and corresponding current playback parameters are obtained by processing the instruction data packet in the local storage unit, so as to generate a current driving waveform with multiple pattern waveform slices according to the instruction data packet, realize the combined splicing of driving waveforms of various waveform modes, and improve the freedom and flexibility of generating driving waveforms.
[0107] The drive waveform generation device of this embodiment is used to implement the corresponding drive waveform generation methods of the aforementioned multiple method embodiments and has the beneficial effects of the corresponding method embodiments, which will not be described in detail here. In addition, the functional implementation of each module in the drive waveform generation device of this embodiment can refer to the corresponding descriptions of the aforementioned method embodiments and will not be described in detail here.
[0108] Figure 9 This is a structural block diagram 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.
[0109] like Figure 9 As shown, the electronic device 500 may include: a processor 502, a memory 503, a communication interface 504 and a communication bus 505. The processor 502, the memory 503 and the communication interface 504 communicate with each other via the communication bus 505; the memory 503 is used to store at least one executable instruction, and the executable instruction enables the processor 502 to perform an operation corresponding to the driving waveform generation method of any of the above embodiments.
[0110] Processor 502 may be a central processing unit (CPU), an application-specific integrated circuit (ASIC), 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 may be processors of different types, such as one or more CPUs and one or more ASICs.
[0111] The memory 503 is used to store programs, and 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.
[0112] Through the electronic device of this embodiment, by transmitting an instruction data packet consisting of a small amount of data to a local storage unit, the demand for bus bandwidth is reduced by reducing the amount of waveform data transmitted, and the current waveform mode and the corresponding current playback parameters are obtained by processing the instruction data packet in the local storage unit, so as to generate a current driving waveform with multiple pattern waveform slices according to the instruction data packet, realize the combined splicing of driving waveforms of various waveform modes, and improve the freedom and flexibility of generating driving waveforms.
[0113] An embodiment of the present application further provides a computer storage medium storing a computer program, which, when executed by a processor, implements the driving waveform generating method of any of the above embodiments.
[0114] According to the computer storage medium of the embodiment of the present application, by transmitting an instruction data packet consisting of a small amount of data to a local storage unit, the demand for bus bandwidth is reduced by reducing the amount of waveform data transmitted, and the current waveform mode and the corresponding current playback parameters are obtained by processing the instruction data packet in the local storage unit, so as to generate a current driving waveform with multiple pattern waveform slices according to the instruction data packet, realize the combined splicing of driving waveforms of various waveform modes, and improve the freedom and flexibility of generating driving waveforms.
[0115] 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.
[0116] The above-described method according to the embodiment of the present application can be implemented in hardware, firmware, or as software or computer code that can be stored in a recording medium (such as a CD ROM, RAM, floppy disk, hard disk or magneto-optical disk), or as computer code originally stored in a remote recording medium or a non-transitory machine-readable medium downloaded via a network and then stored in a local recording medium, so that the method described herein can be stored in such software processing on a recording medium using a general-purpose computer, a dedicated processor or programmable or dedicated hardware (such as an ASIC or FPGA). It can be understood that a computer, a processor, a microprocessor controller or programmable hardware includes a storage component (e.g., RAM, ROM, flash memory, etc.) that can store or receive software or computer code. When the software or computer code is accessed and executed by the computer, processor or hardware, the drive waveform generation method described herein is implemented. In addition, when a general-purpose computer accesses the code for implementing the drive waveform generation method shown herein, the execution of the code converts the general-purpose computer into a dedicated computer for executing the drive waveform generation method shown herein.
[0117] Those skilled 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 this application.
[0118] The above embodiments are only used to illustrate the embodiments of the present application and are not intended to limit 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 fall within the scope of the embodiments of the present application, and the scope of patent protection of the embodiments of the present application should be defined by the claims. The systems, devices, or modules described in the above embodiments can be implemented by computer chips or entities, or by products with certain functions.
Claims
1. A driving waveform generating method, characterized in that: include: storing the received instruction data packet in a local storage unit, wherein the instruction data packet includes at least a waveform pattern describing a driving waveform and corresponding playback parameters, wherein the driving waveform represents a tactile effect of the linear motor; Reading the instruction data packet from the local storage unit to obtain a current waveform pattern according to the received play request; Reading a current playback parameter having a mapping relationship with the current waveform pattern from the local storage unit to generate a playback instruction for the current driving waveform; Based on the playback instruction of the current driving waveform, the current driving waveform is generated and output.
2. The method according to claim 1, characterized in that The instruction data packet is composed of a plurality of instruction data units, each instruction data unit including a waveform pattern describing a driving waveform and corresponding playback parameters, wherein the current waveform pattern is a waveform pattern of a plurality of waveform slices; Reading a current playback parameter having a mapping relationship with the current waveform mode from the local storage unit to generate a playback instruction for the current driving waveform includes: determining a plurality of playback parameters having the mapping relationship with the waveform patterns of the plurality of waveform slices; generating playback instructions for the plurality of waveform slices based on a plurality of playback parameters respectively; Based on the order of the plurality of waveform slices, the play instructions of the plurality of waveform slices are sequentially generated into a play instruction sequence.
3. The method according to claim 2, characterized in that Determining a plurality of playback parameters having the mapping relationship with the waveform patterns of the plurality of waveform slices includes: Obtaining corresponding first and second playback parameters from the instruction data packet based on waveform patterns of the multiple waveform slices, wherein the waveform pattern includes at least one of a pre-stored waveform pattern, a real-time waveform pattern, a DC waveform pattern, a sine waveform pattern, a shaped square wave pattern, a braking waveform pattern, and a triangular waveform pattern; the first playback parameter includes at least one of a vibration duration, a number of occurrences, a vibration cycle, and a braking time; and the second playback parameter includes at least one of a waveform gain coefficient, a vibration voltage, a vibration intensity, a waveform sequence, a vibration intensity regularity parameter, a vibration frequency, a waveform amplitude, and a back electromotive force voltage; The multiple playback parameters are obtained based on the first playback parameter and the second playback parameter.
4. The method according to claim 2, characterized in that The instruction header of the play instruction of each waveform slice carries the waveform mode coding information or control instruction of the waveform slice.
5. The method according to claim 4, characterized in that The playback instruction of each waveform slice includes an instruction header and an instruction body, wherein the instruction header carries the waveform mode coding information of the waveform slice, and the instruction body carries the playback parameters of the waveform slice.
6. The method according to claim 4, characterized in that Based on the playback instruction of the current driving waveform, generating and outputting the current driving waveform includes: Decoding the waveform pattern encoding information in the instruction header of each waveform slice to obtain the waveform pattern; Reading playback parameters corresponding to the waveform pattern from a local storage unit, and generating each waveform slice based on the playback parameters; The generated slice sequence of the waveform slices is output as the current driving waveform.
7. The method according to claim 6, characterized in that Based on the playback parameters, each waveform slice is generated, including: When a first playback parameter among the playback parameters corresponding to the current instruction data unit meets a preset condition, generating a completion identification signal of the current instruction data unit, wherein the completion identification signal is used to indicate that the waveform slice corresponding to the current instruction data unit has been generated; Obtaining playback parameters of a next instruction data unit in the instruction data packet, and generating the next waveform slice; When the end instruction in the play instruction is obtained, the generation of waveform slices is stopped.
8. A driving waveform generating device, characterized in that: include: a storage module configured to store a received instruction data packet in a local storage unit, wherein the instruction data packet includes at least a waveform pattern describing a driving waveform and corresponding playback parameters, wherein the driving waveform represents a tactile effect of the linear motor; A first reading module is configured to read the instruction data packet from the local storage unit to obtain a current waveform pattern according to a received play request; A second reading module is configured to read a current playback parameter having a mapping relationship with the current waveform mode from the local storage unit, and generate a playback instruction for the current driving waveform; A generating module is used to generate and output the current driving waveform based on the playing instruction of the current driving waveform.
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 an operation corresponding to the driving waveform generation method according to any one of claims 1 to 7.
10. A computer storage medium having a computer program stored thereon, wherein when the program is executed by a processor, the method for generating a driving waveform according to any one of claims 1 to 7 is implemented.