CN115442946A - LED light source control method and device and LED light source equipment - Google Patents

LED light source control method and device and LED light source equipment Download PDF

Info

Publication number
CN115442946A
CN115442946A CN202210916841.1A CN202210916841A CN115442946A CN 115442946 A CN115442946 A CN 115442946A CN 202210916841 A CN202210916841 A CN 202210916841A CN 115442946 A CN115442946 A CN 115442946A
Authority
CN
China
Prior art keywords
light source
led light
code element
element data
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210916841.1A
Other languages
Chinese (zh)
Inventor
王雷
陈熙
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ecoflow Technology Ltd
Original Assignee
Ecoflow Technology Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ecoflow Technology Ltd filed Critical Ecoflow Technology Ltd
Priority to CN202210916841.1A priority Critical patent/CN115442946A/en
Publication of CN115442946A publication Critical patent/CN115442946A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H05ELECTRIC TECHNIQUES NOT OTHERWISE PROVIDED FOR
    • H05BELECTRIC HEATING; ELECTRIC LIGHT SOURCES NOT OTHERWISE PROVIDED FOR; CIRCUIT ARRANGEMENTS FOR ELECTRIC LIGHT SOURCES, IN GENERAL
    • H05B47/00Circuit arrangements for operating light sources in general, i.e. where the type of light source is not relevant
    • H05B47/10Controlling the light source
    • H05B47/165Controlling the light source following a pre-assigned programmed sequence; Logic control [LC]
    • HELECTRICITY
    • H05ELECTRIC TECHNIQUES NOT OTHERWISE PROVIDED FOR
    • H05BELECTRIC HEATING; ELECTRIC LIGHT SOURCES NOT OTHERWISE PROVIDED FOR; CIRCUIT ARRANGEMENTS FOR ELECTRIC LIGHT SOURCES, IN GENERAL
    • H05B45/00Circuit arrangements for operating light-emitting diodes [LED]
    • H05B45/10Controlling the intensity of the light
    • HELECTRICITY
    • H05ELECTRIC TECHNIQUES NOT OTHERWISE PROVIDED FOR
    • H05BELECTRIC HEATING; ELECTRIC LIGHT SOURCES NOT OTHERWISE PROVIDED FOR; CIRCUIT ARRANGEMENTS FOR ELECTRIC LIGHT SOURCES, IN GENERAL
    • H05B45/00Circuit arrangements for operating light-emitting diodes [LED]
    • H05B45/20Controlling the colour of the light
    • HELECTRICITY
    • H05ELECTRIC TECHNIQUES NOT OTHERWISE PROVIDED FOR
    • H05BELECTRIC HEATING; ELECTRIC LIGHT SOURCES NOT OTHERWISE PROVIDED FOR; CIRCUIT ARRANGEMENTS FOR ELECTRIC LIGHT SOURCES, IN GENERAL
    • H05B45/00Circuit arrangements for operating light-emitting diodes [LED]
    • H05B45/30Driver circuits
    • HELECTRICITY
    • H05ELECTRIC TECHNIQUES NOT OTHERWISE PROVIDED FOR
    • H05BELECTRIC HEATING; ELECTRIC LIGHT SOURCES NOT OTHERWISE PROVIDED FOR; CIRCUIT ARRANGEMENTS FOR ELECTRIC LIGHT SOURCES, IN GENERAL
    • H05B47/00Circuit arrangements for operating light sources in general, i.e. where the type of light source is not relevant
    • H05B47/10Controlling the light source
    • H05B47/17Operational modes, e.g. switching from manual to automatic mode or prohibiting specific operations

Abstract

The embodiment of the application provides an LED light source control method, an LED light source control device and LED light source equipment, wherein the method comprises the following steps: the method comprises the steps of obtaining a control instruction of an LED light source, converting the control instruction into code element data according to a preset coding protocol, determining a target sending mode of the code element data according to the current running state of a control device, and sending the code element data to the LED light source through a serial peripheral interface based on the target sending mode so that the LED light source displays according to the code element data and a target display mode; by determining the target sending mode of the code element data according to the current running state of the control device, the target sending mode of the code element data can be adapted to the current running state of the control device, and the stability and the reliability of the adjustment of the LED light source display effect in the current running state are improved.

Description

LED light source control method and device and LED light source equipment
Technical Field
The present application relates to the field of light source control technologies, and in particular, to a method and an apparatus for controlling an LED light source, and an LED light source device.
Background
With the development of science and technology, the current Light Emitting Diode (LED) Light source can achieve the effect of intelligently controlling the Light intensity, the Light color and other Light language display of the LED Light source. However, the conventional control device cannot adjust the display effect of the LED light source stably when controlling the LED light source.
Disclosure of Invention
The embodiment of the application provides an LED light source control method and device and an LED light source device, which can improve the stability and reliability of adjustment of the display effect of an LED light source.
In a first aspect, the present application provides a method for controlling an LED light source, where the method is used for controlling a device, and the control device is connected to the LED light source through a serial peripheral interface, and the method includes:
acquiring a control instruction of an LED light source; the control instruction is used for indicating a target display mode of the LED light source;
converting the control instruction into code element data according to a preset encoding protocol;
determining a target transmission mode of the code element data according to the current operation state of the control device; the target sending mode comprises at least one of an interrupt sending mode and a Direct Memory Access (DMA) sending mode;
and based on the target transmission mode, transmitting the code element data to the LED light source through the serial peripheral interface so that the LED light source displays according to the code element data in the target display mode.
In a second aspect, the present application provides a control apparatus comprising:
the microcontroller is integrated with a processor and a serial peripheral unit, the serial peripheral unit is connected with the processor, and a serial peripheral interface of the serial peripheral unit is used for being connected with the LED light source;
the processor is used for realizing the steps of the LED light source control method.
In a third aspect, the present application provides an LED light source apparatus comprising:
the aforementioned control device; and
an LED light source;
the control device is used for controlling the LED light source to display.
In a fourth aspect, the present application provides a computer readable storage medium storing a computer program which, when executed by a processor, causes the processor to implement the steps of the LED light source control method described above.
The application discloses a method and a device for controlling an LED light source and LED light source equipment, wherein the method comprises the following steps: the method comprises the steps of obtaining a control instruction of the LED light source, converting the control instruction into code element data according to a preset coding protocol, determining a target sending mode of the code element data according to the current running state of the control device, and sending the code element data to the LED light source through a serial peripheral interface based on the target sending mode so that the LED light source displays according to the code element data and the target display mode. The target sending mode of the code element data is determined according to the current running state of the control device, so that the target sending mode of the code element data can be adapted to the current running state of the control device, and the stability and reliability of the adjustment of the LED light source display effect in the current running state are improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the description below are some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings without creative efforts.
Fig. 1 is a schematic flow chart of an LED light source control method according to an embodiment of the present application.
Fig. 2 is a schematic block diagram of a control device according to an embodiment of the present application.
Fig. 3 is a schematic block diagram of an LED light source apparatus provided in an embodiment of the present application.
FIG. 4 is a diagram illustrating RGB data according to an embodiment.
FIG. 5 is a diagram of a unipolar return to zero code in one embodiment.
FIG. 6 is a block diagram of a serial peripheral interface according to an embodiment.
FIG. 7 is a diagram illustrating a full duplex mode based on a serial peripheral interface according to an embodiment.
Fig. 8 is a diagram illustrating transmission of symbol data based on a host data transmission line according to an embodiment.
FIG. 9 is a diagram illustrating the timing and data format of a serial peripheral interface according to an embodiment.
Fig. 10 is a schematic block diagram of an LED light source apparatus in an embodiment.
Fig. 11 is a schematic diagram illustrating a data transmission process of controlling a plurality of LED light sources by a control device according to an embodiment.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some, but not all, of the embodiments of the present application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The flow diagrams depicted in the figures are merely illustrative and do not necessarily include all of the elements and operations/steps, nor do they necessarily have to be performed in the order depicted. For example, some operations/steps may be decomposed, combined or partially combined, so that the actual execution sequence may be changed according to the actual situation.
The embodiment of the application provides an LED light source control method and device and LED light source equipment, and the target sending mode of code element data is determined according to the current running state of the control device, so that the target sending mode of the code element data can be adapted to the current running state of the control device, and the stability and reliability of the adjustment of the display effect of the LED light source in the current running state are improved.
Some embodiments of the present application will be described in detail below with reference to the accompanying drawings. The embodiments and features of the embodiments described below can be combined with each other without conflict.
Referring to fig. 1, fig. 1 is a schematic flowchart illustrating a method for controlling an LED light source according to an embodiment of the present disclosure. The LED light source control method is used for controlling the display mode of the LED light source.
The LED light source control method provided in the embodiment of the present application may be applied to a control device, for example, a chip or a circuit in an LED light source device, or may also be a control device of an LED light source or a chip or a circuit in a control device.
The LED light source control method provided in the embodiment of the present application may be applied to LED light source equipment, where the LED light source equipment refers to equipment having an LED light source, and includes, but is not limited to, self-moving equipment or power supply equipment, where the self-moving equipment is, for example, a mowing robot, a sweeping robot, a mine clearance robot, a cruise robot, and the like, and this embodiment is not particularly limited thereto.
Referring to fig. 2 and fig. 3, fig. 2 is a schematic block diagram of a control device 100 provided in an embodiment of the present application, and fig. 3 is a schematic block diagram of an LED light source apparatus 10 provided in an embodiment of the present application.
The control device 100 comprises a microcontroller 110, the microcontroller 110 is integrated with a serial peripheral unit 111 and a processor 112, the serial peripheral unit 111 is connected with the processor 112, and a Serial Peripheral Interface (SPI) of the serial peripheral unit 111 is used for connecting with the LED light source 200, wherein the processor 112 is used for implementing steps of the LED light source control method.
For example, the microcontroller 110 is a GD32 single chip microcomputer, and has the advantage of low cost. It is understood that the control device 100 may further include peripheral circuits of the microcontroller 110, such as a power supply circuit, a crystal oscillator circuit, and the like, but is not limited thereto.
By adopting the serial peripheral interface to connect the LED light source 200, the advantages of fast data transmission rate, fast control response, and the like can be realized.
As shown in fig. 3, the LED light source device 10 includes: control device 100 and LED light source 200, control device 100 is used for controlling LED light source 200 and shows.
In some embodiments, the control device 100 is connected to the LED light source 200 through a serial peripheral interface. For example, the LED light source 200 is an intelligent externally-controlled LED light source capable of displaying different colors, such as an intelligent externally-controlled LED light source capable of displaying a combination of three primary colors RGB (red, green, and blue), but is not limited thereto. The intelligent external control LED light source is widely applied to electronic consumer products, and particularly can provide a lamp language function based on the intelligent external control LED light source for an outdoor robot lacking a human-computer interaction interface.
As shown in fig. 1, the LED light source control method includes the following steps S110 to S140.
Step S110, obtaining a control instruction of the LED light source; the control instruction is used for indicating a target display mode of the LED light source.
In the present embodiment, the LED light source capable of displaying a combination of three primary colors of RGB (red, green, and blue) is mainly described as an example, and in other embodiments, the LED light source is not limited to an LED light source displaying a combination of three primary colors of RGB, and may be an LED light source displaying a combination of four primary colors of RGBY, for example. Referring to fig. 4, the RGB data corresponding to each LED light source carried by the control command of the LED light source with the three primary colors RGB combination includes 3 × 8=24bit (bit) data, that is, the RGB data includes 24 bits of data formed by combining 0 code and 1 code; wherein the first 8Bit data is indicative of a green (G) component value of the LED light source, the middle 8Bit data is indicative of a red (R) component value of the LED light source, and the last 8Bit data is indicative of a blue (B) component value of the LED light source; the component values of different preset colors (red, green and blue) in the LED light source are controlled based on the RGB data, and the display mode of the LED light source, such as displaying yellow, purple or pink, can be adjusted.
In some embodiments, the LED light source apparatus further comprises a human-computer interaction device, the human-computer interaction device is connected to the control device, and the control device is configured to control the LED light source according to a user operation detected by the human-computer interaction device. The man-machine interaction device comprises at least one of a key, a knob, a touch screen and the like. Optionally, the control instruction of the LED light source may be determined according to a user operation detected by the human-computer interaction device.
In some embodiments, the LED light source device further comprises a communication device, the communication device is connected with the control device, and the control device can communicate with the terminal device through the communication device; the communication device includes at least one of a bluetooth module and a WiFi module, and the terminal device includes a mobile phone, a tablet computer, a smart home control terminal, and the like, but is not limited thereto. Illustratively, the control device may acquire a control instruction sent by the terminal device, or acquire a target display mode of the LED light source sent by the terminal device, and generate the control instruction of the LED light source according to the target display mode.
In some embodiments, the control device may determine the control instruction of the LED light source according to at least one of an operating state of the target device, a device parameter, an environmental parameter detected by the target device, and the like. Optionally, the target device may be a device having an LED light source, such as a self-moving device or a power supply device, or may be another device other than the above devices, which is not particularly limited in this embodiment.
For example, the control instruction may be determined to carry RGB data according to a target display mode of the LED light source, for example, displaying pink based on a preset RGB to hexadecimal color comparison table, for example, converting the RGB color of the target display mode into corresponding 24-Bit data.
And step S120, converting the control command into code element data according to a preset encoding protocol.
In some embodiments, if the RGB data is sent directly to the LED light sources, the LED light sources cannot display in the target display mode directly from the RGB data. The RGB data may be converted into symbol data that can be recognized by the LED light source.
Illustratively, converting the control command into symbol data according to a predetermined encoding protocol includes: and converting each binary bit in the control instruction into a unipolar return-to-zero code to obtain code element data. The code element data is obtained by converting each bit of data in the RGB data in the control command into a unipolar return-to-zero code that can be recognized by the LED light source, for example, converting 0 code data in the RGB data into 0xF800 data, and converting 1 code data in the RGB data into 0xFF80 data. By converting the data of 0 code and 1 code in the RGB data into code element data with wider data width and controlling the LED light source through the code element data, the robustness, stability and flexibility of control can be improved.
Referring to fig. 5 in conjunction with table 1, each valid symbol in the unipolar return-to-zero code must have a high level and a low level. For example, each valid symbol starts at a high level, and is determined to be a 0 code or a 1 code according to the time width of the high and low levels.
TABLE 1 unipolar Return-to-zero codes
Name (R) Description of the invention Typical value Tolerance error Unit
T0H
0 code, high level time 0.3 ±0.15 us
T1H 1 code, high level time 0.6 ±0.15 us
T0L Code 0, low level time 0.9 ±0.15 us
T1L 1 code, low level time 0.6 ±0.15 us
Trest Reset code, low level time 80 - us
Unipolar return-to-zero codes refer to high and zero levels representing binary codes 1 and 0, respectively, no voltage representing 0, a constant positive voltage representing 1, but a duration shorter than the temporal width of one valid symbol, i.e., a narrow pulse is emitted. The middle point of the symbol time of each effective symbol is the sampling time, and the decision threshold is half amplitude level. The unipolar return-to-zero code has the main advantage that the synchronous signal can be directly extracted, so the unipolar return-to-zero code is often used as a transition code pattern when other code patterns extract the synchronous signal, that is, other code patterns which are suitable for channel transmission but cannot directly extract the synchronous signal can be firstly converted into the unipolar return-to-zero code, and then the synchronous signal is extracted.
For example, the symbol data may be sent to the LED light source at a certain frequency through a Serial Peripheral Interface (SPI), so that the LED light source displays according to the symbol data in the target display mode.
Step S130, determining a target transmission mode of the code element data according to the current operation state of the control device; the target transmission mode includes at least one of an interrupt transmission mode and a Direct Memory Access (DMA) transmission mode.
The current running state refers to at least one of a current task operating state of the control device, a DMA resource state, a light effect adjusting frequency of the LED light source, and the like.
In some embodiments, a target data sending mode matched with the control device and/or the working scene of the LED light source may be determined according to at least one of the current task operation state of the control device, the DMA resource state, the light effect adjustment frequency of the LED light source, and the like, so as to improve the stability and reliability of the adjustment of the display effect of the LED light source in each working scene. The code element data sending mode is flexible and efficient, has certain generalization capability and anti-interference capability, can be adapted to the current running state of the control device by determining the target sending mode according to at least one of the task operating state, the DMA resource state, the light effect adjusting frequency of the LED light source and the like, improves the stability and reliability of the adjustment of the LED light source display effect in the current running state, and enables the LED light source display effect to be stable and reliable and the lamp language display effect to be stable and reliable.
And step S140, based on the target sending mode, sending the code element data to the LED light source through the serial peripheral interface so that the LED light source displays according to the code element data and the target display mode.
Illustratively, the LED light source decodes the code element data to obtain a control instruction, and displays the target display mode according to the control instruction.
Fig. 6 is a block diagram of a serial Peripheral interface, in which an APB (Advanced Peripheral Bus) is a Peripheral Bus, which may be connected to a Peripheral and used as a standard on-chip Peripheral Bus structure, and a serial Peripheral unit includes a control register, a transmission/reception control logic, a shift register, a clock generator, and a serial Peripheral interface. Wherein the serial peripheral interface comprises six control lines (PAD): control line SCK (Serial Clock), control line NSS, control line MOSI (Master Output Slave Input), control line MISO (Master Input Slave Output), control line IO2, and control line IO3. The control line SCK is a clock signal line and the control line NSS is a chip select control line. The control line MOSI, the control line MISO, the control line IO2 and the control line IO3 are data lines. The control line MOSI may be referred to as a host data transmission line.
The serial peripheral unit configures an internal register through the control register, the control register SPI _ CTL0 saves temporary data in the transmission process through a transmitting buffer and a receiving buffer, and the communication speed is selectively controlled through frequency division of the control register. The serial peripheral unit generates an SCK communication clock through a clock generator, and provides timing of serial input and output operations by a control line SCK. The serial peripheral unit transmits data of the transmitting buffer area and the receiving buffer area through the shift register and controls serial data transmitting and receiving on the control line MOSI, the control line MISO, the control line IO2 and the control line IO3. The serial peripheral unit generates a control logic according to the SPI command through the sending/receiving control logic, performs I/O control, generates an output signal and controls communication, and controls receiving communication according to the received SCK signal and the received NSS signal.
Fig. 7 is a schematic diagram of a full duplex mode based on a serial peripheral interface, in which a master is, for example, a control device, and a slave is an LED light source; the SPI signal lines are described in table 2:
TABLE 2 description of SPI signal lines
Figure BDA0003776091080000091
For example, the control device may transmit the symbol data to the LED light source through a host data transmission line MOSI of the serial peripheral interface. Referring to fig. 8, based on the output function of the host data transmission line, the 0 code or 1 code of the RGB data of the LED light source is simulated by transmitting one byte or half byte of data, for example, the clock frequency of the serial peripheral interface is configured to control the LED light source.
FIG. 9 is a schematic diagram of the timing and data format of the serial peripheral interface. The CKPL (Clock Polarity) bit and CKPH (Clock Phase) bit in the control register SPI _ CTL0 of the SPI determine the timing of the SPI Clock and data signals. The CKPL bit determines the level of the SCK clock in the idle state, and the CKPH bit determines the first or second clock transition edge as the active sampling edge.
In some embodiments, the serial peripheral interface of the serial peripheral unit supports an interrupt transmit mode and a DMA transmit mode. The control means may transmit the symbol data to the LED light source through the serial peripheral interface based on the interrupt transmission mode or the DMA transmission mode.
Illustratively, the procedure for transmitting symbol data in the interrupted transmission mode is as follows: the processor of the control device transmits symbol data frame by frame, for example 16 bits (equal to the width of the effective symbol) of data per frame, through the serial peripheral unit. When the serial peripheral unit finishes sending one frame of data and the sending buffer area of the serial peripheral unit has no data, the serial peripheral unit sends an interrupt request signal with the empty buffer area to the processor. The processor responds to the interrupt signal that the buffer of the serial peripheral unit is empty and stops the current task to process the interrupt operation of the sending buffer. The next frame data is filled in the serial peripheral unit to be sent until the code element data for controlling the LED light source is sent completely, and the interruption of the serial peripheral unit can be closed at the moment.
Illustratively, when the serial peripheral unit starts to transmit the symbol data to the LED light source, each frame of data, for example, 16 bits of data, is first loaded from the transmission buffer into the shift register, and then the shift register starts to transmit the loaded data. After the first bit of each frame of data is transmitted, TBE (transmit buffer empty) flag position 1, TBE flag position 1 is used to indicate that the transmit buffer is empty. And when the code element data for controlling the LED light source is not sent completely, the processor of the control device continuously loads data to the shift register of the serial peripheral unit. For example, data of the next frame may be loaded into the shift register before data transmission of the shift register is completed, to realize a continuous transmission function of symbol data in the host mode.
The DMA transmit mode may copy data from one address space to another, providing high speed data transfer between a peripheral and memory or between memory and memory. The embodiment of the application adopts a data transmission mode from a memory (a memory of a control device) to an external device (an LED light source). Specifically, the memory storage address of the DMA channel is configured as the storage address of the code element data on the control device, and the peripheral address is configured as the address of the LED light source, for example, the address of the LED light source may be determined according to a pin connected to the LED light source through the serial peripheral interface. The transmission direction is configured as the transmission direction from the memory to the peripheral, the width of data transmission is equal to the width of an effective code element, for example, 16 bits, the memory adopts address increment transmission, the peripheral address is kept unchanged, then the priority of DMA transmission is configured, and then the code element data can be transmitted to the LED light source through a DMA transmission mode by enabling the DMA channel.
It should be noted that, when the symbol data is transmitted in the interrupt transmission mode, resources of the control device, such as processor processing resources, are occupied, and the processor is affected to perform other tasks besides controlling the LED light source. For example, an interrupt signal that the buffer is empty can interrupt the processor to perform other tasks. The DMA transmission mode is started by setting the memory storage address of the DMA channel as the storage address of the code element data on the control device, setting the width of data transmission as the size of the code element data. In the DMA transmission mode, after the code element data is transmitted to the LED light source, the identification position corresponding to the DMA channel is set to indicate that the data transmission of the DMA channel is completed. It will be appreciated that transmitting the symbol data based on the DMA transmit mode may reduce the use of resources of the control device, such as processor processing resources.
In some embodiments, the running state comprises a task operating state. For example, the task operating state is used to indicate whether the control device is in a single task system or a multitask system.
For example, when the control device is in a multitasking system, the control device may be used for performing other tasks besides controlling the LED light source, such as acquiring sensor data, controlling a motor, and the like, but is not limited thereto. The number of tasks performed by the control device at different times may be the same or different, e.g. some tasks may or may not be performed at different times.
Illustratively, determining the target transmission mode of the symbol data according to the current operation state of the control device includes: when the current running state is a task operating state, determining the number of tasks according to the task operating state; when the task number is larger than or equal to the task number threshold value, determining that the target transmission mode of the code element data is a DMA transmission mode; and when the task number is smaller than the task number threshold value, determining that the target transmission mode of the code element data is an interrupt transmission mode.
For example, when the current task number of the control device is smaller than the task number threshold, such as in the case of executing only a single task of controlling the LED light source, the interrupt of the serial peripheral unit does not affect other tasks, or the interrupt has a small impact on other tasks, the target transmission mode of the symbol data may be determined to be the interrupt transmission mode, so as to reduce the occupation of the DMA resources. When the number of tasks is greater than or equal to the threshold of the number of tasks, such as under the condition of multitask, the DMA sending mode is adopted, so that the condition that the resource of a processor of the control device is occupied by other tasks to influence the sending of code element data can be prevented, the sending stability and reliability of the code element data are improved, and the stability and reliability of the adjustment of the LED light source display effect are improved; and the influence of the sending task of the code element data on other tasks can be reduced or eliminated, for example, the interruption generated in the sending process of the code element data can be prevented from influencing the execution of other tasks.
In some embodiments, the run state comprises a DMA resource state. Illustratively, determining the target transmission mode of the symbol data according to the current operation state of the control device includes: when the DMA resource state is an occupied state, determining that a target transmission mode of the code element data is an interrupt transmission mode; when the DMA resource state is an idle state, determining that a target transmission mode of the code element data is a DMA transmission mode; or when the idle resource in the DMA resource state is less than or equal to a preset resource threshold value, determining that the target transmission mode of the code element data is an interrupt transmission mode; and when the idle resource of the DMA resource state is greater than a preset resource threshold value, determining that the target transmission mode of the code element data is a DMA transmission mode.
Illustratively, when the DMA resource status of the DMA channel of the serial peripheral unit is in an idle status, or the idle DMA resource is more, and if the DMA channel is not occupied, the DMA transmission mode may be preferentially adopted, so as to improve the stability and reliability of symbol data transmission and improve the stability and reliability of LED light source display effect adjustment.
Exemplarily, when the DMA resource status of the DMA channel of the serial peripheral unit is an occupied status or the idle DMA resource is insufficient, the symbol data is transmitted based on the interrupt transmission mode; the method has the advantages that enough DMA resources do not need to be waited for, the sending efficiency of code element data can be improved, the sending stability and reliability of the code element data are improved, and the adjusting stability and reliability of the LED light source display effect are improved.
In some embodiments, the target transmission mode of the symbol data may also be determined according to the light effect adjustment frequency of the LED light source. Illustratively, when the light efficiency adjustment frequency of the LED light source is less than or equal to a preset frequency threshold, the target transmission mode of the symbol data is determined to be the interrupted transmission mode. Illustratively, when the light effect adjustment frequency of the LED light source is greater than a preset frequency threshold, the target transmission mode of the symbol data is determined to be the DMA transmission mode.
For example, when the LED light source does not need to switch colors and dynamic pipelining effects quickly, that is, the control period is long, it may be determined that the target transmission mode of the symbol data is the interrupt transmission mode, so as to reduce the occupation of DMA resources; when the DMA resources are occupied or insufficient, enough DMA resources do not need to wait, and the transmission efficiency of the code element data can be improved.
In some embodiments, after determining the target transmission mode of the symbol data according to the current operation state of the control device, the method further comprises: obtaining assignment corresponding to a target sending mode; wherein, the assignment corresponds to the target sending mode one by one; and invoking a target sending mode of the code element data according to the assignment.
For example, by assigning the mode identification bits of the processor and/or the mode identification bits of the serial peripheral unit, when the code element data needs to be sent, the corresponding target sending mode can be called according to the assignment of the mode identification bits, and the code element data can be sent to the LED light source through the serial peripheral interface based on the target sending mode. It is understood that, in some embodiments, after determining the target transmission mode of the symbol data according to the current operating state of the control device, the target transmission mode may not be determined again when the symbol data is transmitted subsequently, but the target transmission mode of the symbol data may be directly invoked according to the assignment, which may improve the transmission efficiency of the symbol data.
In some embodiments, before transmitting the symbol data to the LED light source through the serial peripheral interface based on the target transmission mode, the method further comprises: outputting a first level with a maintaining time length larger than or equal to a first preset time length (such as 200 us) to the LED light source so as to enable the LED light source to be in an idle state; and outputting a second level with the maintaining time length being more than or equal to a second preset time length to the LED light source so as to Reset (Reset) the LED light source.
The LED light source may be brought into a state ready to receive symbol data by sending a second level to reset the LED light source.
For example, referring to fig. 5, the valid symbol in the unipolar return-to-zero code starts at a high level, and the time width of the high level and the low level determines that the valid symbol is a 0 code or a 1 code. If the LED light source is not turned high to be in an idle state, the LED light source may erroneously display the high level (e.g., the high level in the symbol data) and the low level in the reset signal (e.g., the reset code) transmitted from the control device as 0 code or 1 code in the unipolar return-to-zero code according to the erroneous 0 code or 1 code. According to the embodiment of the application, the LED light source is in the idle state by outputting the first level with the maintaining time length being more than or equal to the first preset time length to the LED light source before the second level is sent to reset the LED light source, so that the data sent by the LED light source false identification control device is prevented, the effective reset of the LED light source can be ensured, and the data loss in the original data transmission process is prevented. The stability and robustness of code element data transmission are improved, and the stability and reliability of LED light source display effect adjustment are improved.
In some embodiments, after transmitting the symbol data to the LED light source based on the target transmission mode, the method further comprises: outputting a second level with the maintaining time length being greater than or equal to a second preset time length to the LED light source so as to reset the LED light source; and outputting a first level with the maintaining time length being more than or equal to a first preset time length to the LED light source so as to enable the LED light source to be in an idle state.
For example, after the symbol data is transmitted, the low level maintaining time period reaches about 200us, that is, the reset signal resets the LED light source. The LED light source displays according to the symbol data based on the reset signal, i.e., the reset signal validates the symbol data. After the second level is sent to reset the LED light source, when the high level maintaining time reaches about 200us, the LED light source can be in an idle state, the data sent by the LED light source misidentification control device is prevented, and effective resetting of the LED light source can be guaranteed.
Optionally, based on the target sending mode, the serial peripheral interface outputs a first level with a duration greater than or equal to a first preset duration to the LED light source to enable the LED light source to be in an idle state, and/or outputs a second level with a duration greater than or equal to a second preset duration to enable the LED light source to be reset, that is, the SPI data is sent to enable the LED light source to be in the idle state or to reset the LED light source, so that low latency for controlling the LED light source can be ensured, loss of symbol data is prevented, stability of controlling the LED light source is improved, and high concurrency characteristics of the control device can be enhanced.
In some embodiments, the number of the LED light sources is plural, and may be determined according to application requirements. And the plurality of LED light sources are connected in sequence, and at least one LED light source is connected with the control device. Referring to fig. 10, the LED light source D1 is connected to the control device, and the LED light source D1, the LED light source D2, and the LED light source D3 are connected in sequence.
The control data of the LED light sources includes control data of a plurality of LED light sources, and the control data of the plurality of LED light sources corresponds to the plurality of LED light sources one to one, wherein the control data corresponding to the LED light source D1 connected to the control device may be referred to as first control data. Referring to fig. 11, symbol data corresponding to control data (i.e., first control data) of the LED light source D1 is represented as RGB1, symbol data corresponding to control data of the LED light source D2 is represented as RGB2, and symbol data corresponding to control data of the LED light source D3 is represented as RGB4.
The control device is configured to transmit symbol data (RGB 1, RGB2, RGB3, for example, 3 × 24 bits in total) corresponding to control data of the plurality of LED light sources to the LED light source D1 connected to the control device, so that the LED light source D1 connected to the control device displays the symbol data RGB1 corresponding to the first control data. The LED light source D1 connected with the control device is also used for sending code element data (RGB 2, RGB 3) corresponding to the rest control data except the first control data to the next LED light source D2 connected with the LED light source D1; the LED light source D2 displays according to the symbol data RGB2, and the remaining symbol data RGB3 is transmitted to the next LED light source D3 connected to the LED light source D2, and the LED light source D3 displays according to the symbol data RGB 3.
The LED light source control method provided by the embodiment of the application comprises the following steps: the method comprises the steps of obtaining a control instruction of an LED light source, converting the control instruction into code element data according to a preset coding protocol, determining a target sending mode of the code element data according to the current running state of a control device, and sending the code element data to the LED light source through a serial peripheral interface based on the target sending mode so that the LED light source displays according to the code element data and a target display mode; the target sending mode of the code element data is determined according to the current running state of the control device, so that the target sending mode of the code element data can be adapted to the current running state of the control device, and the stability and reliability of the adjustment of the LED light source display effect in the current running state are improved.
The embodiment of the present application further provides a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, where the computer program includes program instructions, and when the computer program is executed by a processor, the processor is enabled to implement the steps of the LED light source control method provided in the foregoing embodiment.
The computer readable storage medium may be the control device or an internal storage unit of the LED light source apparatus described in any of the foregoing embodiments, for example, a hard disk or a memory of the LED light source apparatus. The computer readable storage medium may also be an external storage device of the control device or the LED light source device, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like provided on the control device.
It is to be understood that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application.
It should also be understood that the term "and/or" as used in this application and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
While the invention has been described with reference to specific embodiments, the scope of the invention is not limited thereto, and those skilled in the art can easily conceive various equivalent modifications or substitutions within the technical scope of the invention. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (10)

1. An LED light source control method is used for a control device, the control device is connected with an LED light source through a serial peripheral interface, and the method comprises the following steps:
acquiring a control instruction of the LED light source; wherein the control instruction is used for indicating a target display mode of the LED light source;
converting the control instruction into code element data according to a preset encoding protocol;
determining a target transmission mode of the code element data according to the current running state of the control device; wherein the target transmission mode comprises at least one of an interrupt transmission mode and a DMA transmission mode;
and based on the target sending mode, sending the code element data to the LED light source through the serial peripheral interface so as to enable the LED light source to display according to the code element data and the target display mode.
2. The LED light source control method of claim 1, wherein the operational state comprises a task operational state; the determining a target transmission mode of the symbol data according to the current operation state of the control device includes:
when the current running state is a task operating state, determining the number of tasks according to the task operating state;
when the task number is larger than or equal to a task number threshold value, determining that a target transmission mode of the code element data is a DMA transmission mode;
and when the task number is smaller than the task number threshold, determining that the target sending mode of the code element data is an interrupt sending mode.
3. The LED light source control method of claim 1, wherein the operational status comprises a DMA resource status; the determining a target transmission mode of the symbol data according to the current operation state of the control device includes:
when the DMA resource state is an occupied state, determining that a target sending mode of the code element data is an interrupt sending mode; when the DMA resource state is an idle state, determining that a target transmission mode of the code element data is a DMA transmission mode; or
When the idle resources in the DMA resource state are less than or equal to a preset resource threshold value, determining that a target transmission mode of the code element data is an interrupt transmission mode; and when the idle resource of the DMA resource state is larger than the preset resource threshold value, determining that the target transmission mode of the code element data is a DMA transmission mode.
4. The LED light source control method of claim 1, further comprising:
when the light effect adjusting frequency of the LED light source is smaller than or equal to a preset frequency threshold, determining that the target sending mode of the code element data is an interrupt sending mode;
and when the light effect adjusting frequency of the LED light source is greater than the preset frequency threshold, determining that the target sending mode of the code element data is a DMA sending mode.
5. The LED light source control method according to claim 1, wherein after said determining a target transmission pattern of the symbol data according to a current operation state of the control device, the method further comprises:
obtaining the assignment corresponding to the target sending mode; wherein, the assignment corresponds to the target sending mode one by one;
and calling a target sending mode of the code element data according to the assignment.
6. The LED light source control method according to any one of claims 1-5, wherein the converting the control command into symbol data according to a preset encoding protocol comprises:
and converting each binary bit in the control instruction into a unipolar return-to-zero code to obtain the code element data.
7. The LED light source control method according to any one of claims 1-5, wherein before the transmitting the symbol data to the LED light source through the serial peripheral interface based on the target transmission mode, the method further comprises:
outputting a first level with a maintaining time length larger than or equal to a first preset time length to the LED light source so as to enable the LED light source to be in an idle state;
and outputting a second level with the maintaining time length being more than or equal to a second preset time length to the LED light source so as to reset the LED light source.
8. The LED light source control method according to any one of claims 1-5, wherein after the transmitting the symbol data to the LED light source through the serial peripheral interface based on the target transmission mode, the method further comprises:
outputting a second level with the maintaining time length being greater than or equal to a second preset time length to the LED light source so as to reset the LED light source;
and outputting a first level with the maintaining time length being greater than or equal to a first preset time length to the LED light source so as to enable the LED light source to be in an idle state.
9. A control device, comprising:
the LED light source comprises a microcontroller, wherein the microcontroller is integrated with a processor and a serial peripheral unit, the serial peripheral unit is connected with the processor, and a serial peripheral interface of the serial peripheral unit is used for being connected with the LED light source;
wherein the processor is configured to implement the steps of the LED light source control method according to any one of claims 1 to 8.
10. An LED light source apparatus, comprising:
the control device of claim 9; and
an LED light source;
the control device is used for controlling the LED light source to display.
CN202210916841.1A 2022-08-01 2022-08-01 LED light source control method and device and LED light source equipment Pending CN115442946A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210916841.1A CN115442946A (en) 2022-08-01 2022-08-01 LED light source control method and device and LED light source equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210916841.1A CN115442946A (en) 2022-08-01 2022-08-01 LED light source control method and device and LED light source equipment

Publications (1)

Publication Number Publication Date
CN115442946A true CN115442946A (en) 2022-12-06

Family

ID=84241982

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210916841.1A Pending CN115442946A (en) 2022-08-01 2022-08-01 LED light source control method and device and LED light source equipment

Country Status (1)

Country Link
CN (1) CN115442946A (en)

Similar Documents

Publication Publication Date Title
US10452603B2 (en) Sensors global bus
US10007628B2 (en) Dynamically adjustable multi-line bus shared by multi-protocol devices
US10241955B2 (en) Dynamically adjustable multi-line bus shared by multi-protocol devices
US10140242B2 (en) General purpose input/output (GPIO) signal bridging with I3C bus interfaces and virtualization in a multi-node network
US7565470B2 (en) Serial bus device with address assignment by master device
EP2174311B1 (en) Remote control signaling infrared generator
JP2019508915A (en) Optimal latency packetizer finite state machine for messaging and I / O transfer interfaces
US10120827B2 (en) Communication system with serial ports for automatically identifying device types and communication protocols and method thereof
US10417172B2 (en) Sensors global bus
CN110569208B (en) Control circuit, signal control device, signal control method and system
WO2022161244A1 (en) Multi-host arbitration method and apparatus, and readable storage medium
CN104156333A (en) FPGA-based UART multi-interface extension system and method
CN109977055A (en) A kind of processing method and handheld device
CN110990319B (en) Synchronous serial bus multiplexing method, device, terminal and non-transitory computer readable storage medium
US11106618B2 (en) Method for addressing an integrated circuit on a bus and corresponding device
CN115442946A (en) LED light source control method and device and LED light source equipment
CN112003928B (en) Multifunctional screen synchronous control method, device and equipment
KR20200093106A (en) Semiconductor integrated circuit and operation method thereof
CN112416837A (en) Method, circuit and electronic device for forwarding data from SPI module to UART module
US10372663B2 (en) Short address mode for communicating waveform
KR200439053Y1 (en) Device having reconfigurable chip for interacting with processor using serial communication channel and system thereof
CN111130678A (en) Data transmission method, device, equipment and computer readable storage medium
WO2019070361A1 (en) Dynamically adjustable multi-line bus shared by multi-protocol devices
CN113660481B (en) Port detection method, video processing circuit and video monitoring equipment
CN117708035A (en) Communication system and method of AD chip

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination