Data processing method and device, storage medium and interaction panel
By using the free reception buffer of double buffers in serial communication to receive and process touch data, the problem of low data transmission efficiency is solved, parallel reception and processing is realized, and data reception efficiency of serial communication is improved.
Patent Information
- Application Number
- CN202311643997.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-30
- Publication Date
- 2025-05-30
AI Technical Summary
In serial communication, the data transmission efficiency may be caused by differences between hardware devices and mismatch in data processing speeds, resulting in the receiver need to wait for the sender to prepare the data.
The free receiving buffer in the double buffer is used to store the touch data received by the communication serial port, and write the data when the free receiving buffer is available, and then read the data from the free receiving buffer for processing, realizing parallel reception and processing.
Through the use of double buffers, the data reception efficiency in serial communication is improved, the problem of data packet loss in asynchronous scenarios is avoided, and the overall data processing efficiency is improved.
Smart Images

Figure CN120067016A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of serial communication technology, and particularly to a data processing method, apparatus, storage medium, and interactive flat panel. Background Art
[0002] The serial port buffer is an important part in serial communication. The serial port buffer plays the role of buffering and transmitting data. In serial communication, the transmission efficiency of data may be affected by factors such as differences between hardware devices and mismatches in data processing speeds. To solve these problems, a serial port buffer can be used for data buffering and scheduling.
[0003] The serial port buffer can solve the problem of data rate mismatch between the sending device and the receiving device. By using the serial port buffer, the sending device can write data into the buffer and then continue to process other tasks without waiting for the receiving device to be ready to receive data. In this way, when the receiving device is ready to process data, it reads the data from the serial port buffer for processing. Summary of the Invention
[0004] Embodiments of the present application provide a data processing method, apparatus, computer storage medium, and interactive flat panel. In the embodiments of the present application, the free receive buffer in the dual buffer is used to store the touch data received by the communication serial port, and then the data written into the free receive buffer is processed accordingly. That is to say, while the free receive buffer can be used to receive data, the non-free buffer in the dual buffer can be used to process data, realizing parallel reception and processing of data. Coupled with the fact that the two receive buffers can work alternately to receive data, the reception efficiency of data in serial communication is thus improved. The technical solutions are as follows:
[0005] In a first aspect, embodiments of the present application provide a data processing method, which is applied to a processor in a touch display device. The touch display device includes a touch frame, a communication serial port, and a processor. The processor includes a preset ping-pong buffer. The touch frame is connected to the communication serial port, and the communication serial port is connected to the processor. The method includes:
[0006] Determine the free receive buffer in the preset ping-pong buffer;
[0007] Receive touch data of the touch frame through the communication serial port;
[0008] Write the touch data into the free receive buffer;
[0009] Read the touch data from the free receive buffer and perform data processing on the touch data;
[0010] Switch the reference receive buffer in the preset ping-pong buffer other than the free receive buffer to the free receive buffer.
[0011] In a second aspect, an embodiment of the present application provides a data processing device, which is applied to a processor in a touch display device. The touch display device includes a touch frame, a communication serial port, and a processor. The processor includes a preset ping-pong buffer. The touch frame is connected to the communication serial port, and the communication serial port is connected to the processor. The device includes:
[0012] A buffer determination module, configured to determine an idle receive buffer in the preset ping-pong buffer;
[0013] A data reception module, configured to receive touch data of the touch frame through the communication serial port;
[0014] A data writing module, configured to write the touch data into the idle receive buffer;
[0015] A data processing module, configured to read the touch data from the idle receive buffer and perform data processing on the touch data;
[0016] A buffer update module, configured to switch a reference receive buffer in the preset ping-pong buffer other than the idle receive buffer to the idle receive buffer.
[0017] In a third aspect, an embodiment of the present application provides a computer storage medium, which has multiple instructions, and the instructions are suitable for being loaded and executed by a processor to perform the above method steps.
[0018] In a fourth aspect, an embodiment of the present application provides an interactive flat panel, which may include: a memory and a processor; wherein, the memory stores a computer program, and the computer program is suitable for being loaded and executed by the memory to perform the above method steps.
[0019] The beneficial effects brought by the technical solution provided by the embodiment of the present application at least include:
[0020] In the embodiment of the present application, first, an idle receive buffer in the preset ping-pong buffer is determined, touch data of the touch frame is received through the communication serial port, then the touch data is written into the idle receive buffer, and then the touch data is read from the idle receive buffer and data processing is performed on the touch data. Then, a reference receive buffer in the preset ping-pong buffer other than the idle receive buffer is switched to the idle receive buffer. In the embodiment of the present application, the idle receive buffer in the double buffer is used to store the touch data received by the communication serial port, and then corresponding processing is performed on the data written into the idle receive buffer. That is to say, while the idle receive buffer can be used to receive data, the non-idle buffer in the double buffer can be used to process data, realizing parallel reception and processing of data. Coupled with the fact that the two receive buffers can work alternately to receive data, the reception efficiency of data in serial communication is thus improved. Description of the Drawings
[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the accompanying drawings required in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For those skilled in the art, without creative efforts, other accompanying drawings can be obtained based on these drawings.
[0022] Figure 1 is a schematic structural diagram of a touch display device provided by an embodiment of the present application;
[0023] Figure 2 is a schematic flowchart of a data processing method provided by an embodiment of the present application;
[0024] Figure 3 is a schematic flowchart of another data processing method provided by an embodiment of the present application;
[0025] Figure 4 is a schematic structural diagram of a preset ping-pong buffer provided by an embodiment of the present application;
[0026] Figure 5 is a schematic structural diagram of a data processing device provided by an embodiment of the present application;
[0027] Figure 6 is a schematic structural diagram of an interactive flat panel provided by an embodiment of the present application. Detailed implementation manners
[0028] In order to make the invention objectives, features, and advantages of the embodiments of the present application more obvious and understandable, the following will clearly and completely describe the technical solutions in the embodiments of the present application with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only some embodiments of the present application, rather than all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative efforts belong to the scope of protection of the present application.
[0029] In the description of the present application, it should be understood that terms such as "first", "second", etc. are only used for descriptive purposes and cannot be construed as indicating or implying relative importance. In the description of the present application, it should be noted that unless otherwise clearly specified and limited, "including" and "having", as well as any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units is not limited to the listed steps or units, but optionally further includes steps or units not listed, or optionally further includes other steps or units inherent to these processes, methods, products, or devices. For those of ordinary skill in the art, the specific meanings of the above terms in the present application can be understood in specific circumstances. In addition, in the description of the present application, unless otherwise stated, "a plurality of" means two or more. "And / or" describes the association relationship of associated objects and indicates that three relationships can exist. For example, A and / or B can represent: A exists alone, A and B exist simultaneously, and B exists alone. The character " / " generally represents an "or" relationship between the associated objects before and after.
[0030] In the related art, when the receiver in serial communication receives the data sent by the sender using the serial port buffer, usually a single buffer is used as the serial port buffer to receive data, and the data is processed after the complete data is received. Therefore, there is a problem of low data reception efficiency when using a single buffer to receive data.
[0031] In order to solve the above technical problems, the present application will be described in detail below in conjunction with specific embodiments.
[0032] Please refer to Figure 1 , which is a schematic structural diagram of a touch display device provided by an embodiment of the present application. As Figure 1 shown, the touch display device includes a touch frame, a communication serial port, and a processor. In the touch display device, the touch frame is connected to the communication serial port, and the communication serial port is connected to the processor.
[0033] The touch display device can be an interactive flat panel, and the interactive flat panel can be an integrated device that manipulates the content displayed on the display screen through touch technology and realizes human-computer interaction operations. The touch display device has a touch screen. On the touch screen, the user can achieve touch operations by touching the touch screen with a finger or a writing pen. Correspondingly, the interactive flat panel detects the touch position and responds according to the touch position to achieve the touch function.
[0034] Typically, the interactive tablet is installed with at least one operating system, wherein the operating system includes but is not limited to Android system, Linux system, Windows system and Huawei Hongmeng system, which is used to control and coordinate the interactive tablet and external devices, so that various independent hardware in the interactive tablet can work in coordination as a stable whole, and the architectural level where the operating system is located is defined as the system layer. On the basis of the system layer, the interactive tablet is installed with applications developed to meet different fields and different problems of users, and the corresponding architectural level is the application layer. In the description of the specific embodiment of this scheme, the interactive tablet can install at least one application with a writing function. Among them, the application with a writing function can be an application that comes with the operating system, and it can also be an application downloaded from a third-party device or server. Optionally, in addition to the writing function based on touch operation, the application also has other editing functions, such as deletion function, inserting tables, inserting pictures, illustration graphics, drawing tables, drawing graphics and other functions.
[0035] In an embodiment of the present application, the touch display device may be an infrared touch screen. In this case, the touch sensing module in the infrared touch screen is an infrared touch frame. The touch signal collected by the infrared touch frame may include a signal indicating that the infrared ray is blocked. The converted touch signal may include a position touch signal, which may include the X coordinate and Y coordinate of the touch position.
[0036] In the embodiment of the present application, firstly, an idle receiving buffer in the preset ping-pong buffer is determined, touch data of the touch frame is received through the communication serial port, and then the touch data is written into the idle receiving buffer, and then the touch data is read from the idle receiving buffer and data processing is performed on the touch data, and then the reference receiving buffer other than the idle receiving buffer in the preset ping-pong buffer is switched to the idle receiving buffer. The embodiment of the present application uses the idle receiving buffer in the double buffer to store the touch data received by the communication serial port, and then the data written in the idle receiving buffer is processed accordingly, that is, while the idle receiving buffer can be used to receive data, the non-idle buffer in the double buffer can be used to process data, so as to realize parallel reception and processing of data, thereby improving the efficiency of receiving data in serial communication.
[0037] In the following method embodiments, for the convenience of description, only the execution subject of each step is introduced and described as the processor in the touch display device.
[0038] See also Figure 2 , is a flow chart of a data processing method provided in an embodiment of the present application. Figure 2 As shown, the method of the embodiment of the present application may include the following steps:
[0039] S201, determine the free receive buffer in the preset ping-pong buffer.
[0040] It is easy to understand that the preset ping-pong buffer refers to a buffer structure composed of two buffers. The preset ping-pong buffer is a dual buffer set in the processor. Optionally, the preset ping-pong buffer can be composed of two memory spaces of the same size. The two buffers in the preset ping-pong buffer perform different read and write operations at the same time. For example, when one buffer is performing a read operation, the other buffer can perform a write operation, or the other buffer neither performs a write operation nor a read operation.
[0041] The free receive buffer can be understood as a buffer that neither performs a read operation nor a write operation.
[0042] In some embodiments, the steps for the processor to determine the free receive buffer in the preset ping-pong buffer may include the following operations: obtain the flag bit information corresponding to the preset ping-pong buffer, determine the specified buffer corresponding to the writable flag bit in the flag bit information, and use the specified buffer as the free receive buffer. Among them, the flag bit information may include one or both of the readable flag bit and the writable flag bit. Since the preset ping-pong buffer contains two buffers, the flag bit information contains the target flag bits corresponding to the two buffers respectively. The target flag bit can be a writable flag bit or a readable flag bit. When the writable flag bit information contains two writable flag bits, it can be determined that both buffers in the preset ping-pong buffer correspond to the writable flag bits, and any one of the two buffers can be used as the specified buffer; when the writable flag bit information contains one writable flag bit and one readable flag bit, it can be determined that one buffer in the preset ping-pong buffer corresponds to the writable flag bit, and the other buffer corresponds to the readable flag bit. The buffer corresponding to the writable flag bit can be used as the specified buffer.
[0043] S202, receive the touch data of the touch frame through the communication serial port.
[0044] It is easy to understand that the communication serial port refers to a serial communication device that supports synchronous operations and asynchronous operations. The communication serial port supports synchronous sending, synchronous receiving, asynchronous sending, and asynchronous receiving. Optionally, the communication serial port can adopt a Universal Synchronous / Asynchronous Receiver / Transmitter (USART for short).
[0045] The touch frame refers to a touch control component that makes up the touch screen. Specifically, the touch frame can be an infrared touch frame. The infrared touch frame is a touch control device implemented by using infrared touch sensing technology. The infrared touch frame can be used in conjunction with any flat screen, arc screen, cylindrical screen, etc. to realize functions such as multi-touch, writing, and graffiti on the screen.
[0046] Touch data refers to data such as touch coordinate data and touch object data collected by a touch screen when a touch object performs a touch operation on the touch screen. The touch coordinate data can be coordinate data corresponding to the touch position. The touch object data can refer to attribute data of the touch object, such as data on the width of the touch object.
[0047] In some embodiments, the present method can be applied to a scenario where the touch display device is an interactive flat panel. In this scenario, the interactive flat panel can include a touch frame, a communication serial port, and a processor. When the interactive flat panel is powered on and turned on, the touch frame can collect touch data and send the touch data to the communication serial port, and the processor receives the touch data of the touch frame through the communication serial port. Therefore, when the interactive flat panel is powered on and turned on, when a touch object performs a touch operation on the touch display screen, the touch frame can collect touch data, and then the touch frame can send the touch data to the communication serial port, so that the processor can receive the touch data of the touch frame through the communication serial port.
[0048] S203, write the touch data into the idle receive buffer.
[0049] In some embodiments, the processor can obtain the write operation address corresponding to the preset ping-pong buffer, and can use this write operation address as the starting write address to write the touch data into the idle receive buffer. Among them, the write operation address refers to the memory address pointed to by the public write pointer of the preset ping-pong buffer. The preset ping-pong buffer has a public write pointer and a public read pointer. The public write pointer is used to point to the memory address where data is written in the preset ping-pong buffer, and the public read pointer is used to point to the memory address where data is read from the preset ping-pong buffer.
[0050] For a scenario where there is one write operation address, it can be understood that there is only one idle buffer in the preset ping-pong buffer, and this write operation address is the storage address corresponding to the idle buffer.
[0051] For a scenario where there are two write operation addresses, it can be understood that there are two idle buffers in the preset ping-pong buffer, that is, both of the two buffers that make up the preset ping-pong buffer are idle buffers. At this time, the two write operation addresses are the storage addresses corresponding to the two idle buffers respectively. For example, including address 1 and address 2, address 1 is the write operation address corresponding to idle buffer A, and address 2 is the write operation address corresponding to idle buffer B. If address 1 is used as the starting write address, the touch data can be written into idle buffer A; if address 2 is used as the starting write address, the touch data can be written into idle buffer B.
[0052] S204, read the touch data from the idle receive buffer and perform data processing on the touch data.
[0053] In some embodiments, the processor may obtain the read operation address corresponding to the preset ping-pong buffer, use the read operation address as the starting read address to read touch data from the idle receive buffer, and then perform data processing on the touch data. The read operation address refers to the memory address pointed to by the public read pointer of the preset ping-pong buffer. The preset ping-pong buffer has a public write pointer and a public read pointer. The public write pointer is used to point to the memory address where data is written in the preset ping-pong buffer, and the public read pointer is used to point to the memory address where data is read from the preset ping-pong buffer.
[0054] Specifically, the data processing of the processor for the touch data may include processing operations such as coordinate recognition processing and object type recognition processing. Coordinate recognition processing may refer to determining the touch coordinates corresponding to the touch position in the touch data and performing coordinate recognition on the touch coordinates. Object category recognition processing may refer to determining the touch width of the touch object in the touch data and determining the object category based on the touch width.
[0055] Optionally, before obtaining the read operation address corresponding to the preset ping-pong buffer, the processor may also determine whether the idle receive buffer has received a full packet of data. When the idle receive buffer has received a full packet of data, the processor obtains the read operation address corresponding to the preset ping-pong buffer.
[0056] Optionally, before obtaining the read operation address corresponding to the preset ping-pong buffer, the processor may also obtain the flag bit information corresponding to the preset ping-pong buffer, determine whether there is a readable flag bit in the flag bit information. When there is a readable flag bit in the flag bit information, determine whether the buffer indicated by the readable flag bit includes the idle receive buffer. When the buffer indicated by the readable flag bit includes the idle receive buffer, obtain the read operation address corresponding to the preset ping-pong buffer.
[0057] S205. Switch the reference receive buffer other than the idle receive buffer in the preset ping-pong buffer to the idle receive buffer.
[0058] In some embodiments, performing step S205 may include the following operations: obtaining the flag bit information corresponding to the preset ping-pong buffer, and updating the buffer indicated by the writable flag bit in the flag bit information to the reference receive buffer. The reference receive buffer is the buffer other than the idle receive buffer in the preset ping-pong buffer. Optionally, before updating the buffer indicated by the writable flag bit in the flag bit information to the reference receive buffer, the idle receive buffer may also be used as the buffer indicated by the readable flag bit in the flag bit information.
[0059] In an embodiment of the present application, first, an idle receive buffer in a preset ping-pong buffer is determined, touch data of a touch frame is received through a communication serial port, and then the touch data is written into the idle receive buffer. After that, the touch data is read from the idle receive buffer and data processing is performed on the touch data. Then, a reference receive buffer other than the idle receive buffer in the preset ping-pong buffer is switched to the idle receive buffer. In the embodiment of the present application, the idle receive buffer in the dual buffer is used to store the touch data received by the communication serial port, and then corresponding processing is performed on the data written into the idle receive buffer. That is to say, while the idle receive buffer can be used to receive data, the non-idle buffer in the dual buffer can be used to process data, realizing parallel reception and processing of data. Coupled with the fact that the two receive buffers can work alternately to receive data, the reception efficiency of data in serial communication is thus improved.
[0060] Please refer to Figure 3 , which is a schematic flowchart of a data processing method provided by an embodiment of the present application. As Figure 3 shown, the method of the embodiment of the present application may include the following steps:
[0061] S301, obtain status flag information corresponding to a preset ping-pong buffer.
[0062] It is easy to understand that the status flag information refers to information used to identify the working status of the two buffers in the preset ping-pong buffer. The working status of the buffers in the preset ping-pong buffer may include a writable state, a writing state, a readable state, and a reading state. The writable state refers to the working state in which there is a preset remaining byte quantity of storage space in the buffer currently; wherein, the preset remaining byte quantity can be set to be less than or equal to the byte quantity of the maximum storage space of a buffer. The writing state refers to the working state of currently writing data into the buffer. The readable state refers to the working state in which there is a preset to-be-read byte quantity of storage space in the buffer currently; wherein, the preset to-be-read byte quantity can be set to be less than or equal to the byte quantity of the maximum storage space of a buffer. The reading state refers to the working state of currently reading data from the buffer.
[0063] The interpretations of the communication serial port, the touch frame, the touch data, and the preset ping-pong buffer can be specifically referred to the descriptions in the embodiments shown in Figure 2 , and will not be elaborated here.
[0064] The preset ping-pong buffer may include a first buffer and a second buffer, and the memory sizes of the first buffer and the second buffer may be the same.
[0065] In some embodiments, the processor may obtain status flag information corresponding to a preset ping-pong buffer from a preset register. Specifically, the status flag information obtained by the processor includes information for identifying the working state of the first buffer and information for identifying the working state of the second buffer.
[0066] Optionally, the latest status flag information may be stored in the preset register, that is, when the working state of the first buffer and / or the second buffer changes, the status flag information stored in the preset register will also change accordingly. For example, when the first buffer changes from the write state to the readable state, the change process of the information for identifying the first working state in the status flag information may be: from the information indicating that the first buffer is in the write state to the information indicating that the first buffer is in the readable state.
[0067] S302. Determine the flag status type of the status flag information, and determine the idle receive buffer from the first buffer and the second buffer based on the flag status type.
[0068] In some embodiments, determining the flag status type of the status flag information can be understood as determining the flag status type corresponding to the working state of the first buffer and the flag status type corresponding to the working state of the second buffer according to the status flag information. From the description of S301, the working state may include the writable state, the write state, the readable state, and the read state. Correspondingly, the flag status type may include the writable state type, the write state type, the readable state type, and the read state type. That is, when the working state is the writable state, it can be determined that the flag status type corresponding to this working state is the writable state type; when the working state is the write state, it can be determined that the flag status type corresponding to this working state is the write state type; when the working state is the readable state, it can be determined that the flag status type corresponding to this working state is the readable state type; when the working state is the read state, it can be determined that the flag status type corresponding to this working state is the read state type.
[0069] Determining the idle receive buffer from the first buffer and the second buffer based on the flag status type may specifically include the following steps: If the flag status type is the writable state type, determine the target buffer indicated by the writable state type from the first buffer and the second buffer, and use the target buffer as the idle receive buffer. If the flag status type is the readable state type, determine the target buffer indicated by the readable state type from the first buffer and the second buffer, and use the target buffer as the non-idle receive buffer.
[0070] It should be noted that since the flag status type of the status flag information can be one type or two types among the writable status type, write status type, readable status type, and read status type, when the flag status type is only the writable status type, it indicates that the working statuses of both the first buffer and the second buffer are in the writable status. Therefore, the target buffer indicated by the writable status type can be either the first buffer or the second buffer; when the flag status type is the writable status type and any one of the readable status type and the read status type, and the working status of the first buffer corresponds to the writable status type, it can be determined that the target buffer indicated by the writable status type is the first buffer; when the flag status type is the writable status type and any one of the readable status type and the read status type, and the working status of the second buffer corresponds to the writable status type, it can be determined that the target buffer indicated by the writable status type is the second buffer.
[0071] For example: Please refer to Figure 4 the structural schematic diagram of a preset ping-pong buffer shown in Figure 4 As shown, the preset ping-pong buffer includes a first buffer (i.e., the blank rectangular box) and a second buffer (i.e., the shaded rectangular box). At this time, the working status of the first buffer is in the writable status, and the working status of the second buffer can be in the readable status / read status. The working status of the second buffer being in the readable status can be understood as that there are a certain number of bytes of data in the second buffer, and the second buffer is in a state of waiting for the data to be read. The working status of the second buffer being in the read status can be understood as that the second buffer is in a state where the data is being read. That is to say, regardless of whether the second buffer is in the read status or the readable status, the second buffer has completed the data reception process. Next, the second buffer enters the data processing stage. Therefore, during the process of the second buffer being in the data processing stage, the first buffer is in the writable status, that is, the first buffer is an idle reception buffer and the second buffer is a non-idle reception buffer, and the first buffer can be used to continue receiving data. It should be noted that the first buffer receiving data does not affect the second buffer's data processing. Even in an asynchronous processing scenario, that is, when the data processing speed of the second buffer is greater than the data reception speed of the first buffer, the first buffer receiving data does not affect the second buffer's data processing. Thus, on the basis of improving the data reception efficiency, the effect of avoiding data packet loss in the asynchronous scenario is also achieved.
[0072] Through the above method of determining the idle reception buffer and the non-idle reception buffer in the embodiments of the present application, in the case where there already exists a non-idle reception buffer, the specific idle reception buffer can be determined, so as to use the idle reception buffer to write data to implement data reception, and at the same time, the non-idle reception buffer is also used to process data. Therefore, parallel processing of data and data reception is achieved.
[0073] In the embodiments of the present application, by detecting the type of information, the effect of accurately determining the idle receive buffer is achieved.
[0074] S303. Receive the touch data of the touch frame through the communication serial port.
[0075] Specifically, for the method of executing step S303, reference can be made to the description of S202 in the Figure 2 illustrated embodiment, which will not be elaborated here.
[0076] S304. Obtain the write operation pointer corresponding to the preset ping-pong buffer.
[0077] It is easy to understand that the write operation pointer refers to the pointer used to point to the write address corresponding to the write operation. In the embodiments of the present application, the preset ping-pong buffer may have a write operation pointer, and the write operation pointer is equivalent to Figure 2 the public write pointer described in the
[0078] In some embodiments, the processor may obtain the write operation pointer corresponding to the preset ping-pong buffer from the preset write pointer register. Since the write operation pointer can point to the write address corresponding to the write operation, specifically, the write address may be the starting address of the data to be written when writing.
[0079] S305. Write the touch data into the idle receive buffer based on the write operation pointer.
[0080] In some embodiments, the step of writing the touch data into the idle receive buffer based on the write operation pointer may specifically include the following operations: perform packet integrity verification processing on the touch data to obtain a verification result; if the type of the verification result is the complete type, write the touch data into the idle receive buffer based on the write operation pointer.
[0081] The step of performing packet integrity verification processing on the touch data to obtain a verification result may specifically include the following operations: detect whether the data structure of the touch data is complete. If the data structure of the touch data is complete, generate a structure verification result; perform byte verification on the touch data to obtain a byte verification result; generate a verification result according to the structure verification result and the byte verification result.
[0082] Detecting whether the data structure of the touch data is complete. If the data structure of the touch data is complete, generating a structure verification result can be understood as: detecting whether there is a packet header, a data body, and a packet tail in the touch data. If there is a packet header, a data body, and a packet tail in the touch data, generate a first structure verification result of the complete structure type; if any one of the packet header, the data body, and the packet tail is missing in the touch data, generate a second structure verification result of the incomplete structure type.
[0083] Perform byte verification on the touch data to obtain a byte verification result. It can be understood that: determine single-byte touch data based on the touch data, and determine whether the byte header, byte tail, and checksum in the single-byte touch data meet the corresponding requirements. If the byte header, byte tail, and checksum all meet the requirements, a first byte verification result of the byte verification success type can be generated; if any one of the byte header, byte tail, and checksum does not meet the requirements, a second byte verification result of the byte verification failure type can be generated.
[0084] Generate a verification result based on the structure verification result and the byte verification result. It can be understood that: generate a verification result that includes the structure verification result and the byte verification result. If the structure verification result is the above first structure verification result and the byte verification result is the above first byte verification result, the type of the verification result can be determined as the complete type, and a first verification result of the complete type is generated; otherwise, the type of the verification result can be determined as the incomplete type, and a second verification result of the incomplete type is generated.
[0085] In the embodiment of the present application, by performing the above verification process on the touch data, the touch data is written into the idle receive buffer only when the type of the verification result of the touch data is determined to be the complete type, which can ensure the accuracy of the data written into the idle receive buffer.
[0086] Optionally, if the verification result is the second verification result of the incomplete type, the touch data is not written into the idle receive buffer.
[0087] Optionally, after performing the operation of writing the touch data into the idle receive buffer based on the write operation pointer, the following steps can further be included: obtain the number of written bytes in the idle receive buffer; monitor whether the number of written bytes reaches a preset number of bytes; if the number of written bytes reaches the preset number of bytes, update the status flag information corresponding to the preset ping-pong buffer.
[0088] Among them, the number of written bytes refers to the number of bytes of the touch data already written in the idle receive buffer; the preset number of bytes can be set to the number of bytes corresponding to a data packet. For example, if a data packet can store N bytes of data, the preset number of bytes can be set to N.
[0089] Monitor whether the written bytes reach the preset number of bytes. It can be understood that it monitors whether the touch data of a data packet has been written into the idle receive buffer. If the number of written bytes reaches the preset number of bytes, it means that the touch data of a data packet has been written into the idle receive buffer, and the working state of the idle receive buffer can be updated to the readable state, that is, the working state of the idle receive buffer is updated from the write state to the readable state. Therefore, updating the status flag information corresponding to the preset ping-pong buffer can be understood as updating the information in the status flag information that is used to identify the working state of the idle buffer. Thus, it can be ensured that the information stored in the status flag information is the information of the latest working state of the first buffer and the second buffer, that is, to ensure the accuracy of the status flag information, and thus the data reception efficiency and data processing efficiency in serial communication can be ensured.
[0090] S306, monitor whether there is readable status flag information for the idle receive buffer in the status flag information.
[0091] It is easy to understand that the readable status flag information refers to the information used to identify that the working state of the idle receive buffer is the readable state.
[0092] In some embodiments, it is possible to periodically monitor whether there is readable status flag information for the idle receive buffer in the status flag information. For example, it can be configured to monitor whether there is readable status flag information for the idle receive buffer in the status flag information every 3 minutes. By monitoring whether there is readable status flag information in the status flag information, data is read in the case of the existence of readable status flag information, reducing the latency time for reading data from the buffer and improving the efficiency of reading data from the buffer.
[0093] S307, if there is readable status flag information in the status flag information, obtain the read operation pointer corresponding to the preset ping-pong buffer, read the touch data from the idle receive buffer based on the read operation pointer, and perform data processing on the touch data.
[0094] It is easy to understand that the read operation pointer refers to the pointer used to point to the read address corresponding to the read operation. In the embodiments of the present application, the preset ping-pong buffer can have a read operation pointer, and the read operation pointer is equivalent to Figure 2 the public read pointer described in the embodiments shown.
[0095] In some embodiments, if there is readable status flag information in the status flag information, it can be determined that the working state of the idle receive buffer is the readable state. At this time, the read operation pointer corresponding to the preset ping-pong buffer can be obtained, the touch data is read from the idle receive buffer based on the read operation pointer, and data processing is performed on the touch data.
[0096] Perform the step of obtaining the read operation pointer corresponding to the preset ping-pong buffer. Specifically, it can be: obtain the read operation pointer corresponding to the preset ping-pong buffer from the preset read pointer register.
[0097] Perform the step of reading touch data from the free receive buffer based on the read operation pointer. Specifically, it can be: determine the read address according to the read operation pointer, and use this read address as the starting address to read touch data from the free receive buffer until the remaining data in the free receive buffer is empty.
[0098] Perform the step of processing the touch data. Specifically, it can include the following steps: determine the touch coordinates corresponding to the touch position based on the touch data, and perform coordinate recognition processing based on the touch coordinates; or, determine the touch width of the touch object based on the touch data, and determine the object type of the touch object based on the touch width.
[0099] Among them, the touch position refers to the position of the contact point or contact area between the touch object and the touch screen when the touch object performs a touch operation on the touch screen. The touch coordinates refer to the coordinates of the touch position in the touch screen.
[0100] Determining the touch coordinates corresponding to the touch position based on the touch data can be understood as: determining the touch coordinate data in the touch data, and determining the touch coordinates corresponding to the touch position according to the touch coordinate data; when the touch position is the position of the contact point, the touch coordinates are the coordinates of the contact point; when the touch position is the position of the contact area, the touch coordinates are the coordinates of the contact area.
[0101] Performing coordinate recognition processing based on the touch coordinates can be understood as: detecting whether the touch coordinates are target coordinates. If the touch coordinates are target coordinates, generate a coordinate recognition result indicating that the touch coordinates are target coordinates, so as to facilitate corresponding control processing according to the coordinate recognition result.
[0102] For example: The target coordinates can be the boundary coordinates of the touch screen. At this time, the coordinate recognition result can be used to indicate that the touch coordinates reach the boundary coordinates, and the control processing based on this coordinate recognition result can be: output an out-of-bounds reminder message, and the boundary reminder message can be used to remind the user that the current touch position exceeds the boundary of the touch screen. Another example is that the target coordinates are the preset coordinates of a certain preset icon. At this time, the coordinate recognition result can be used to indicate that the touch coordinates reach the preset coordinates, and the control processing based on this coordinate recognition result can be: switch the display interface of the touch screen to the target interface corresponding to the preset icon.
[0103] Determine the touch width of the touch object based on the touch data, and determine the object type of the touch object based on the touch width. It can be understood that the touch width of the touch object is read from the touch data, the width mapping relationship between the preset touch width and the preset object type is obtained, the target object type corresponding to the touch width is found in the width mapping relationship, and the target object type is used as the object type of the touch object.
[0104] S308, determine the writable status flag information in the status flag information, and update the buffer indicated by the writable status flag information to the reference receiving buffer except the idle receiving buffer in the preset ping-pong buffer.
[0105] In some embodiments, determining the writable status flag information in the status flag information can be understood as identifying the status types of the respective flag information in the status flag information, and determining the information of the writable status type as the writable status flag information.
[0106] Updating the buffer indicated by the writable status flag information to the reference receiving buffer except the idle receiving buffer in the preset ping-pong buffer can be understood as switching the identifier of the idle receiving buffer stored in the writable status flag information to the identifier of the reference receiving buffer, and the reference receiving buffer is the buffer except the idle receiving buffer in the preset ping-pong buffer.
[0107] In the embodiment of the present application, by obtaining the status flag information corresponding to a preset ping-pong buffer, an idle receive buffer is determined from a first buffer and a second buffer according to the status flag information. Touch data of a touch frame is received through a communication serial port. Then, a write operation pointer corresponding to the preset ping-pong buffer is obtained, and the touch data is written into the idle receive buffer based on the write operation pointer. It is monitored whether there is readable status flag information for the idle receive buffer in the status flag information. If there is readable status flag information in the status flag information, a read operation pointer corresponding to the preset ping-pong buffer is obtained, and the touch data is read from the idle receive buffer based on the read operation pointer, and the touch data is processed. Then, the writable status flag information in the status flag information is determined, and the buffer indicated by the writable status flag information is updated to a reference receive buffer other than the idle receive buffer in the preset ping-pong buffer. In the embodiment of the present application, an idle receive buffer is determined in two buffers to use the idle receive buffer to implement data reception. During this data reception process, it does not affect the other buffer to perform data processing. Therefore, parallel reception and processing of data are realized. In addition, the two receive buffers can work alternately to receive data, thereby improving the data reception efficiency in serial communication. Moreover, when the data processing speed of the other buffer is greater than or equal to the data reception speed of the idle receive buffer, the problem of data packet loss in an asynchronous processing scenario can also be avoided. In addition, the above method of detecting the type of information achieves the effect of accurately determining the idle receive buffer. The above method of monitoring whether there is readable status flag information in the status flag information reads data when there is readable status flag information, reducing the latency time for reading data from the buffer and improving the efficiency of reading data from the buffer.
[0108] The following will be combined with Figure 5 to introduce in detail the data processing device provided by the embodiment of the present application. It should be noted that Figure 5 The data processing device shown is used to execute the method of the embodiment of the present application Figure 2 and Figure 3 shown. For the sake of illustration, only the parts related to the embodiment of the present application are shown. For the specific technical details not disclosed, please refer to the embodiments shown in the present application Figure 2 and Figure 3 shown.
[0109] Please refer to Figure 5 , which shows a schematic structural diagram of the data processing device of the embodiment of the present application. The data processing device 1 can be implemented as all or part of the device through software, hardware, or a combination of both. According to some embodiments, the data processing device 1 includes a buffer determination module 11, a data reception module 12, a data write module 13, a data processing module 14, and a buffer update module 15, and is specifically used for:
[0110] A buffer determination module 11, configured to determine an idle receive buffer in a preset ping-pong buffer;
[0111] A data receiving module 12, configured to receive touch data of a touch frame through a communication serial port;
[0112] A data writing module 13, configured to write the touch data into the idle receive buffer;
[0113] A data processing module 14, configured to read the touch data from the idle receive buffer and perform data processing on the touch data;
[0114] A buffer update module 15, configured to switch a reference receive buffer other than the idle receive buffer in the preset ping-pong buffer to the idle receive buffer.
[0115] Optionally, the buffer determination module 11 includes:
[0116] A first determination unit, configured to obtain status flag information corresponding to the preset ping-pong buffer, where the preset ping-pong buffer includes a first buffer and a second buffer;
[0117] A second determination unit, configured to determine a flag status type of the status flag information, and determine the idle receive buffer from the first buffer and the second buffer based on the flag status type.
[0118] Optionally, the second determination unit is specifically configured to:
[0119] If the flag status type is a writable status type, determine a target buffer indicated by the writable status type from the first buffer and the second buffer, and use the target buffer as the idle receive buffer.
[0120] Optionally, the buffer determination module 11 is further configured to:
[0121] If the flag status type is a readable status type, determine a target buffer indicated by the readable status type from the first buffer and the second buffer, and use the target buffer as a non-idle receive buffer.
[0122] Optionally, the data writing module 12 includes:
[0123] A first writing unit, configured to obtain a writing operation pointer corresponding to the preset ping-pong buffer;
[0124] A second writing unit, configured to write the touch data into the idle receive buffer based on the writing operation pointer.
[0125] Optionally, the second writing unit is specifically configured to:
[0126] Perform packet integrity verification processing on the touch data to obtain a verification result;
[0127] If the type of the verification result is the complete type, write the touch data into the idle receive buffer based on the write operation pointer.
[0128] Optionally, the data writing module 12 is further configured to:
[0129] Obtain the number of bytes written into the idle receive buffer;
[0130] Monitor whether the number of bytes written reaches a preset number of bytes;
[0131] If the number of bytes written reaches the preset number of bytes, update the status flag information corresponding to the preset ping-pong buffer.
[0132] Optionally, the data processing module 13 is configured to:
[0133] A first processing unit, configured to obtain the status flag information corresponding to the preset ping-pong buffer;
[0134] A second processing unit, configured to monitor whether there is readable status flag information for the idle receive buffer in the status flag information;
[0135] A third processing unit, configured to, if there is readable status flag information in the status flag information, obtain the read operation pointer corresponding to the preset ping-pong buffer, read the touch data from the idle receive buffer based on the read operation pointer, and perform data processing on the touch data.
[0136] Optionally, the third processing unit is specifically configured to:
[0137] Determine the touch coordinates corresponding to the touch position based on the touch data, and perform coordinate recognition processing based on the touch coordinates; or,
[0138] Determine the touch width of the touch object based on the touch data, and determine the object type of the touch object based on the touch width.
[0139] Optionally, the data processing module is specifically configured to:
[0140] Determine the writable status flag information in the status flag information, and update the buffer indicated by the writable status flag information to the reference receive buffer other than the idle receive buffer in the preset ping-pong buffer.
[0141] Please refer to Figure 6 , Figure 6 which is a schematic structural diagram of an interactive flat panel provided by an embodiment of the present application. As Figure 6 shown, the interactive flat panel 600 may include: at least one processor 601, at least one network interface 604, a user interface 603, a memory 605, a display screen component 606, and at least one communication bus 602.
[0142] Among them, the communication bus 602 is used to implement the connection and communication between these components.
[0143] Among them, the user interface 603 may include a display screen and a camera. Optionally, the user interface 603 may also include a standard wired interface and a wireless interface.
[0144] Among them, the network interface 604 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface).
[0145] Among them, the processor 601 may include one or more processing cores. The processor 601 uses various interfaces and circuits to connect various parts within the entire interactive flat panel 600. By running or executing instructions, programs, code sets, or instruction sets stored in the memory 605, and by calling the data stored in the memory 605, the processor 601 performs various functions of the interactive flat panel 600 and processes data. Optionally, the processor 601 may be implemented in at least one of the hardware forms of digital signal processing (DSP), field-programmable gate array (FPGA), and programmable logic array (PLA). The processor 601 may integrate one or several combinations of a central processing unit (CPU), a graphics processing unit (GPU), and a modem, etc. Among them, the CPU mainly processes the operating system, the user interface, and application programs, etc.; the GPU is responsible for the rendering and drawing of the content to be displayed on the display screen; the modem is used to process wireless communication. It can be understood that the above modem may not be integrated into the processor 601 and may be implemented separately by a single chip.
[0146] Among them, the memory 605 may include a Random Access Memory (RAM), or may also include a Read-Only Memory. Optionally, the memory 605 includes a non-transitory computer-readable storage medium. The memory 605 can be used to store instructions, programs, codes, code sets or instruction sets. The memory 605 may include a program storage area and a data storage area. Among them, the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc.; the data storage area may store the data involved in the above-mentioned various method embodiments, etc. Optionally, the memory 605 may also be at least one storage device located far from the aforementioned processor 601. As Figure 6 shown, in the memory 605 as a computer storage medium, an operating system, a network communication module, a user interface module, and a program of a data processing method may be included.
[0147] In Figure 6 the interactive flat panel 600 shown, the user interface 603 is mainly used to provide an input interface for the user and obtain the data input by the user; while the processor 601 can be used to call the program of the data processing method stored in the memory 605 and specifically perform the following operations:
[0148] Determine the free receive buffer in the preset ping-pong buffer;
[0149] Receive the touch data of the touch frame through the communication serial port;
[0150] Write the touch data into the free receive buffer;
[0151] Read the touch data from the free receive buffer and perform data processing on the touch data;
[0152] Switch the reference receive buffer other than the free receive buffer in the preset ping-pong buffer to the free receive buffer.
[0153] In one embodiment, when the processor 601 executes the step of determining the free receive buffer in the preset ping-pong buffer, it specifically performs the following operations:
[0154] Obtain the status flag information corresponding to the preset ping-pong buffer. The preset ping-pong buffer includes a first buffer and a second buffer;
[0155] Determine the flag status type of the status flag information, and determine the free receive buffer from the first buffer and the second buffer based on the flag status type.
[0156] In one embodiment, when the processor 601 executes the step of determining the idle receive buffer from the first buffer and the second buffer based on the flag status type, the following operations are specifically performed:
[0157] If the flag status type is the writable status type, determine the target buffer indicated by the writable status type from the first buffer and the second buffer, and use the target buffer as the idle receive buffer.
[0158] In one embodiment, the processor 601 further performs the following operations:
[0159] If the flag status type is the readable status type, determine the target buffer indicated by the readable status type from the first buffer and the second buffer, and use the target buffer as the non-idle receive buffer.
[0160] In one embodiment, when the processor 601 executes the step of writing touch data into the idle receive buffer, the following operations are specifically performed:
[0161] Obtain the write operation pointer corresponding to the preset ping-pong buffer;
[0162] Write the touch data into the idle receive buffer based on the write operation pointer.
[0163] In one embodiment, when the processor 601 executes the step of writing touch data into the idle receive buffer based on the write operation pointer, the following operations are specifically performed:
[0164] Perform packet integrity verification processing on the touch data to obtain a verification result;
[0165] If the type of the verification result is the complete type, write the touch data into the idle receive buffer based on the write operation pointer.
[0166] In one embodiment, after the processor 601 executes the step of writing touch data into the idle receive buffer based on the write operation pointer, the following operations are further performed:
[0167] Obtain the number of written bytes of the idle receive buffer;
[0168] Monitor whether the number of written bytes reaches the preset number of bytes;
[0169] If the number of written bytes reaches the preset number of bytes, update the status flag information corresponding to the preset ping-pong buffer.
[0170] In one embodiment, when the processor 601 executes the step of reading touch data from the idle receive buffer and performing data processing on the touch data, the following operations are specifically performed:
[0171] Obtain the status flag information corresponding to the preset ping-pong buffer;
[0172] Monitor whether there is readable status flag information for the idle receive buffer in the status flag information;
[0173] If there is readable status flag information in the status flag information, obtain the read operation pointer corresponding to the preset ping-pong buffer, read the touch data from the idle receive buffer based on the read operation pointer, and perform data processing on the touch data.
[0174] In one embodiment, when the processor 601 executes the step of performing data processing on the touch data, the following operations are specifically performed:
[0175] Determine the touch coordinates corresponding to the touch position based on the touch data, and perform coordinate recognition processing based on the touch coordinates; or,
[0176] Determine the touch width of the touch object based on the touch data, and determine the object type of the touch object based on the touch width.
[0177] In one embodiment, when the processor 601 executes the step of switching the reference receive buffer other than the idle receive buffer in the preset ping-pong buffer to the idle receive buffer, the following operations are specifically performed:
[0178] Determine the writable status flag information in the status flag information, and switch the buffer indicated by the writable status flag information from the idle receive buffer to the reference receive buffer other than the idle receive buffer in the preset ping-pong buffer.
[0179] In addition, those skilled in the art can understand that the structure of the interactive flat panel 600 shown in the above drawings does not limit the interactive flat panel 600. The interactive flat panel may include more or fewer components than shown in the drawings, or combine some components, or have different component arrangements. For example, the interactive flat panel 600 further includes components such as a radio frequency circuit, an audio circuit, a WiFi component, a power supply, and a Bluetooth component, which will not be elaborated here.
[0180] The embodiment of the present application also provides a computer-readable storage medium, which stores at least one instruction, and the at least one instruction is used to be executed by a processor to implement the data processing method as described in the above various embodiments.
[0181] The embodiment of the present application also provides a computer program product, which stores at least one instruction, and the at least one instruction is loaded and executed by the processor to implement the data processing method as described in the above various embodiments.
[0182] Those skilled in the art should be able to realize that in one or more of the above examples, the functions described in the embodiments of the present application can be implemented by hardware, software, firmware, or any combination thereof. When implemented using software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium. The computer-readable medium includes computer storage media and communication media, where the communication media includes any medium that facilitates the transfer of a computer program from one place to another. The storage media can be any available medium accessible by a general-purpose or special-purpose computer.
[0183] The above are only alternative embodiments of the present application and are not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application shall be included within the protection scope of the present application.
Claims
1. A data processing method, characterized in that, it is applied to a processor in a touch display device, the touch display device includes a touch frame, a communication serial port and the processor, the processor includes a preset ping-pong buffer, the touch frame is connected to the communication serial port, the communication serial port is connected to the processor, and the method includes: Determine the idle receive buffer in the preset ping-pong buffer; Receive the touch data of the touch frame through the communication serial port; Write the touch data into the idle receive buffer; Read the touch data from the idle receive buffer and perform data processing on the touch data; Switch the reference receive buffer other than the idle receive buffer in the preset ping-pong buffer to the idle receive buffer.
2. The method according to claim 1, characterized in that, the determining the idle receive buffer in the preset ping-pong buffer includes: Obtain the status flag information corresponding to the preset ping-pong buffer, and the preset ping-pong buffer includes a first buffer and a second buffer; Determine the flag status type of the status flag information, and determine the idle receive buffer from the first buffer and the second buffer based on the flag status type.
3. The method according to claim 2, characterized in that, the determining the idle receive buffer from the first buffer and the second buffer based on the flag status type includes: If the flag status type is a writable status type, determine the target buffer indicated by the writable status type from the first buffer and the second buffer, and use the target buffer as the idle receive buffer.
4. The method according to claim 2, characterized in that, the method further includes: If the flag status type is a readable status type, determine the target buffer indicated by the readable status type from the first buffer and the second buffer, and use the target buffer as a non-idle receive buffer.
5. The method according to claim 1, characterized in that, the writing the touch data into the idle receive buffer includes: Obtain the write operation pointer corresponding to the preset ping-pong buffer; Write the touch data into the idle receive buffer based on the write operation pointer.
6. The method according to claim 5, characterized in that, the writing the touch data into the idle receive buffer based on the write operation pointer includes: Perform packet integrity check processing on the touch data to obtain a check result; If the type of the check result is a complete type, write the touch data into the idle receive buffer based on the write operation pointer.
7. The method according to claim 5, characterized in that, after the writing the touch data into the idle receive buffer based on the write operation pointer, it further includes: Obtain the number of written bytes of the idle receive buffer; Monitor whether the number of written bytes reaches a preset number of bytes; If the number of written bytes reaches the preset number of bytes, update the status flag information corresponding to the preset ping-pong buffer.
8. The method according to claim 1, wherein, said reading the touch data from the idle receive buffer and performing data processing on the touch data includes: obtaining status flag information corresponding to the preset ping-pong buffer; monitoring whether there is readable status flag information for the idle receive buffer in the status flag information; if there is the readable status flag information in the status flag information, obtaining a read operation pointer corresponding to the preset ping-pong buffer, reading the touch data from the idle receive buffer based on the read operation pointer, and performing data processing on the touch data.
9. The method according to claim 8, wherein, said performing data processing on the touch data includes: determining touch coordinates corresponding to a touch position based on the touch data and performing coordinate recognition processing based on the touch coordinates; or, determining a touch width of a touch object based on the touch data and determining an object type of the touch object based on the touch width.
10. The method according to claim 8, wherein, said switching a reference receive buffer other than the idle receive buffer in the preset ping-pong buffer to the idle receive buffer includes: determining writable status flag information in the status flag information and updating the buffer indicated by the writable status flag information to a reference receive buffer other than the idle receive buffer in the preset ping-pong buffer.
11. A computer storage medium, wherein, the computer storage medium stores multiple instructions, and the instructions are adapted to be loaded and executed by a processor to perform the method steps of any one of claims 1 to 10.
12. An interactive flat panel, wherein, comprising: a processor and a memory; wherein, the memory stores a computer program, and the computer program is adapted to be loaded and executed by the processor to perform the method steps of any one of claims 1 to 10.