Method and system for LED flashing indication of communication equipment
By monitoring the status on the control chip of the communication device and using the interrupt response mechanism to realize LED flashing indication, the problem of excessive resource occupation is solved, the stability and frequency flexibility of the flashing indication are achieved, and the problem of excessive resource occupation in the existing technology is solved. resulting in stability issues.
Patent Information
- Application Number
- CN202111324790.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-10
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2041-11-10
AI Technical Summary
In existing communication equipment, the realization of LED flashing indication and the change of flashing frequency are directly controlled by the main process of the control chip, resulting in excessive resource usage and affecting the stability and efficiency of other control modules.
By monitoring the status of the communication equipment on the control chip, and using the interrupt response mechanism to cyclically perform constant-on and flashing status monitoring, it avoids the occupation of main process resources, realizes LED flashing indication, and flexibly adjusts the flashing frequency.
It effectively avoids the interference between the main process and the lighting operation, reduces resource occupation, achieves the stability and frequency flexibility of the flashing indication, and balances the on-off duty cycle.
Smart Images

Figure CN114244733B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of communication equipment, and in particular relates to a method and system for LED flashing indication of communication equipment. Background Art
[0002] LED indicators are generally used on communication equipment to indicate the status of ports. Different states are represented by constant on, flashing, and flashing frequencies, such as normal, abnormal, port connection, data transmission, etc. Usually, the on and off control of the LED can be controlled by the high and low levels of the chip's GPIO output.
[0003] However, if the flashing of the LED and the change of the flashing frequency are directly implemented by the main process of the control chip, it will greatly occupy the main process resources and affect other control modules; for example: the indicator light of the equipment is controlled by a special control chip, and the control chip only performs LED control, consuming software and hardware resources; the main process of the control chip directly controls the LED, which affects the control of other processes or the LED control is affected by other processes, resulting in unstable flashing indication. Summary of the invention
[0004] The present invention aims to solve one of the technical problems in the related art at least to a certain extent. To this end, one object of the present invention is to provide a method and system for LED flashing indication of a communication device.
[0005] In order to solve the above technical problems, the embodiments of the present invention provide the following technical solutions:
[0006] A method for LED flashing indication of a communication device, comprising:
[0007] Monitor the status of the communication device based on the control chip, enable interrupt response, and cyclically execute any of the following:
[0008] Entering the constant light state monitoring, when the triggering condition of the constant light state is detected, the state of the communication device is updated to the constant light state; otherwise, entering the flashing state monitoring, when the triggering condition of the flashing state is detected, the state of the communication device is updated to the flashing state;
[0009] When the interrupt time is reached, the interrupt state is entered and the GPIO is turned on.
[0010] Optionally, the performing the always-on state monitoring, and updating the state of the communication device to the always-on state after a triggering condition of the always-on state is detected, includes:
[0011] When the control chip detects the trigger condition of the constant light state, the constant light state flag lightup is set to 1, and the flashing state monitoring is started;
[0012] When the control chip fails to detect the trigger condition of the always-on state, the always-on state flag bit lightup is set to 0, and the flashing state monitoring is entered.
[0013] Optionally, the entering into the flashing state monitoring, when a triggering condition of the flashing state is detected, updating the state of the communication device to the flashing state, includes:
[0014] When the control chip fails to detect the triggering condition of the blinking state, the blinking state flag bit blink is set to 0, and the control chip returns to the constant light state monitoring;
[0015] When the control chip detects the triggering condition of the blinking state, the blinking state flag bit blink is set to 1, and the blinking frequency is determined based on the triggering condition of the blinking state, and then the control chip returns to the constant light state monitoring.
[0016] Optionally, determining the flickering frequency based on the triggering condition of the flickering state, and then returning to the constant light state monitoring, includes:
[0017] Determine a flashing time interval T according to a trigger condition of the flashing state; wherein T is greater than 0;
[0018] The flashing frequency is determined according to the flashing time interval T, and the monitoring of the constant light state is returned to.
[0019] Optionally, when the interrupt time is reached, entering the interrupt state and lighting the GPIO include:
[0020] The control chip performs a timed interrupt; wherein the control chip enters the interrupt state every M time; M is greater than 0;
[0021] After the M time has elapsed, the control chip enters the interrupt state and performs GPIO lighting; wherein the GPIO lighting includes constant lighting or flashing lighting.
[0022] Optionally, the control chip enters the interrupt state and performs GPIO lighting, including:
[0023] Disable interrupt response;
[0024] Determine whether the flashing time interval T has ended;
[0025] If the flashing time interval T has not ended, the light is turned on continuously;
[0026] If the flashing time interval T ends, the flashing light is turned on.
[0027] Optionally, if the flashing time interval T has not ended, then lighting the lamp constantly includes:
[0028] Determine whether the value of the blinking status flag bit blink is 0;
[0029] If the value of the blinking status flag bit blink is 1, the light will not be constantly on;
[0030] If the value of the blinking state flag bit blink is 0, the GPIO is turned on or off according to the value of the constant light state flag bit lightup, and then the blinking time interval T is updated to T-1, and the interrupt response is enabled.
[0031] Optionally, if the flashing time interval T ends, flashing the light includes:
[0032] Determine the parity sign;
[0033] When the parity flag is 1, the GPIO output flipping is continued, the parity flag is cleared, and the flashing time interval T is reset;
[0034] When the parity flag is 0, the value of the blink flag bit blink is determined, and the state is updated according to the value of the blink flag bit blink.
[0035] Optionally, updating the status according to the value of the blinking flag bit blink includes:
[0036] When the value of the blink flag bit blink is 0, the blink time interval T is reset;
[0037] When the value of the blink flag bit blink is 1, the GPIO output flip is executed, the parity flag is set to 1, and the blink time interval T is reset.
[0038] An embodiment of the present invention further provides a device for LED flashing indication of a communication device, comprising:
[0039] The control module is used to monitor the status of the communication device system based on the control chip, enable interrupt response, and cyclically execute any of the following:
[0040] A monitoring module, used to enter the constant light state monitoring, and when the triggering condition of the constant light state is detected, the state of the communication device system is updated to the constant light state; otherwise, enter the flashing state monitoring, and when the triggering condition of the flashing state is detected, the state of the communication device is updated to the flashing state;
[0041] The response module is used to enter the interrupt state and light up normally or flash when the interrupt time is reached.
[0042] An embodiment of the present invention further provides a system for LED flashing indication of a communication device, comprising:
[0043] Communications equipment;
[0044] A control chip, the control chip is in communication connection with the communication device; the control chip is used to monitor the status of the communication device and enable interrupt response;
[0045] A status indicator light is communicatively connected to the control chip, and the status indicator light updates its status based on a control instruction sent by the control chip.
[0046] An embodiment of the present invention further provides an electronic device, comprising a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor implements the method described above when executing the computer program.
[0047] An embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium includes a stored computer program, wherein when the computer program is executed, the device where the computer-readable storage medium is located is controlled to execute the method described above.
[0048] The embodiments of the present invention have the following technical effects:
[0049] The above technical solution of the present invention, (1) status monitoring analysis and lighting are placed in the main process and interrupt process respectively to avoid mutual interference;
[0050] (2) LED flashing is achieved through interruption, which avoids the occupation of main process resources when GPIO outputs flashing indication, and at the same time realizes flexible adjustment of flashing frequency and balanced on-off duty cycle.
[0051] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] Figure 1 It is a flow chart of a method for LED flashing indication of a communication device provided by an embodiment of the present invention;
[0053] Figure 2 It is a block diagram of the main process provided by an embodiment of the present invention;
[0054] Figure 3 is a block diagram of an interruption process provided by an embodiment of the present invention;
[0055] Figure 4This is an example of the main process provided by the embodiment of the present invention;
[0056] Figure 5 This is an example of an interruption process provided by an embodiment of the present invention;
[0057] Figure 6 It is a structural schematic diagram of a device for LED flashing indication of a communication device provided by an embodiment of the present invention;
[0058] Figure 7 It is a structural schematic diagram of a system for LED flashing indication of a communication device provided by an embodiment of the present invention;
[0059] Figure 8 This is an example of a system for LED flashing indication of a communication device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0060] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present invention, and should not be construed as limiting the present invention.
[0061] In order to facilitate the understanding of the embodiments by those skilled in the art, some terms are explained:
[0062] (1)LED: light emitting diode.
[0063] (2)GPIO: General-purpose input / output.
[0064] (3) MCU: Microcontroller Unit.
[0065] (4)Link and Act states: link and activity states.
[0066] (5)MDI interface: Medium Dependent Interface, media related interface.
[0067] (6) RGMII interface: Reduced Gigabit Media Independent Interface is ReducedGMII, Gigabit Media Independent Interface.
[0068] (7) RJ45 port: Usually used for data transmission, the most common application is the network card interface.
[0069] (8) SFP port: Small Form-factor Pluggable, used for signal conversion and data transmission.
[0070] (9)SMI: Serial Management Interface, serial interface.
[0071] (10)Switch chip: switch chip.
[0072] (11)link status: link status.
[0073] (12)mib: Management Information Base, management information base.
[0074] See also Figure 1 , an embodiment of the present invention provides a method for LED flashing indication of a communication device, comprising:
[0075] Step S1: Monitor the status of the communication device based on the control chip, enable interrupt response, and cyclically execute any of the following:
[0076] Step S2: Entering the constant light state monitoring, when the triggering condition of the constant light state is detected, the state of the communication device is updated to the constant light state; otherwise, entering the flashing state monitoring, when the triggering condition of the flashing state is detected, the state of the communication device is updated to the flashing state;
[0077] Specifically, the main process is responsible for updating the port status. The LED indication is divided into three stages: constant light status monitoring, flashing status monitoring, and GPIO lighting. This cycle is repeated to achieve the indication of the port status.
[0078] In actual application scenarios, please refer to Figure 2 After initialization is completed, the control chip enters the constant light state monitoring. The control chip monitors the status information of the communication device. Once the constant light state trigger condition is detected, the constant light state flag bit lightup is set to 1, otherwise the constant light state flag bit lightup is set to 0, and then enters the flashing state monitoring;
[0079] After entering the flashing state monitoring, the control chip monitors the system status information. If the flashing trigger condition is not detected, the flashing state flag blink is set to 0, and the system returns to the constant light state monitoring. Once the flashing state trigger condition is detected, the flashing state flag blink is set to 1. According to different state trigger conditions, the corresponding flashing time interval T is mapped. Different T values correspond to different flashing frequencies. Then the system re-enters the constant light state monitoring, and the cycle continues.
[0080] In the embodiment of the present invention, the status monitoring analysis and lighting are respectively placed in the main process and the interrupt process to avoid mutual interference.
[0081] In an optional embodiment of the present invention, the step of performing the always-on state monitoring and updating the state of the communication device to the always-on state after a trigger condition of the always-on state is detected includes:
[0082] When the control chip detects the trigger condition of the constant light state, the constant light state flag lightup is set to 1, and the flashing state monitoring is started;
[0083] When the control chip fails to detect the trigger condition of the always-on state, the always-on state flag bit lightup is set to 0, and the flashing state monitoring is entered.
[0084] Specifically, the control chip monitors the blinking state of the communication device at every interval A. Once a blinking trigger condition is detected, the corresponding blinking state flag bit blink is set to 1, wherein A>0.
[0085] In an optional embodiment of the present invention, the step of entering the flashing state monitoring, when a triggering condition of the flashing state is detected, updating the state of the communication device to the flashing state, comprises:
[0086] When the control chip does not detect the triggering condition of the flashing state, the flashing state flag blink is set to 0 and the control chip returns to the normally light state monitoring; when the control chip detects the triggering condition of the flashing state, the flashing state flag blink is set to 1, and the flashing frequency is determined based on the triggering condition of the flashing state, and then the control chip returns to the normally light state monitoring.
[0087] In an optional embodiment of the present invention, the determining of the flickering frequency based on the triggering condition of the flickering state and then returning to the constant light state monitoring includes:
[0088] Determine a flashing time interval T according to the triggering condition of the flashing state; wherein T is greater than 0; determine the flashing frequency according to the flashing time interval T, and return to the constant light state monitoring.
[0089] For details, please refer to Figure 2 , confirm the category of the trigger condition (the trigger conditions include three categories: N1, N2, and N3), where N1, N2, and N3 represent different subdivision states, corresponding to three different flashing time intervals T1, T2, and T3, that is, corresponding to three different flashing frequencies.
[0090] Step S3: When the interrupt time is reached, the interrupt state is entered and the GPIO is turned on.
[0091] Specifically, the interrupt process is responsible for executing the lighting operation according to the status.
[0092] In an optional embodiment of the present invention, when the interrupt time is reached, entering the interrupt state and lighting the GPIO include:
[0093] The control chip performs a timed interrupt; wherein, the control chip enters the interrupt state every M time; M is greater than 0; after the M time has passed, the control chip enters the interrupt state and performs GPIO lighting; wherein, the GPIO lighting includes constant lighting or flashing lighting.
[0094] Specifically, the control chip may be an MCU; M is generally at the ms level;
[0095] Among them, after the constant light timing interrupt is triggered, the corresponding GPIO outputs a high level or a low level (corresponding to LED high drive and low drive respectively) according to the stored constant light state flag lightup;
[0096] See also Figure 3 The flashing light is realized by flipping the GPIO of the corresponding port LED every time an interrupt is entered to realize the flashing indication of the LED. The time of the timed interrupt is the minimum cycle. According to the three levels of N1, N2, and N3, the GPIO flip is executed once when entering T1, T2, and T3 interrupts respectively, to realize the LED flashing frequency corresponding to the different receiving and sending packet rates of the port. The corresponding flashing frequencies are f1=1 / (T1*M), f2=1 / (T2*M), and f3=1 / (T3*M). At the same time, the parity flag is set in the interrupt to ensure that the GPIO must complete an even number of flips, so as to ensure that the flashing of the LED is a complete cycle.
[0097] In actual application scenarios, please refer to Figure 3 The interrupt process mainly executes GPIO lighting. The interrupt is a timed interrupt with a timing time of M, that is, the interrupt processing is executed every M. No matter where the main process (status monitoring) is executed, the interrupt processing will be paused after the timed interrupt timing ends, and the lighting operation will be performed with the current status flag. After the interrupt process ends, it will return to the original place to continue the main process to monitor the device status.
[0098] In an optional embodiment of the present invention, the control chip enters the interrupt state and performs GPIO lighting, including:
[0099] Disable interrupt response;
[0100] Determine whether the flashing time interval T has ended;
[0101] If the flashing time interval T has not ended, the light is turned on continuously;
[0102] If the flashing time interval T ends, the flashing light is turned on.
[0103] In actual application scenarios, please refer to Figure 3 The interruption process includes constant lighting and flashing lighting. After entering the interruption, first turn off the interruption response, then determine whether the time interval T count has ended. If the count has not ended, directly enter the constant lighting step; if the count has reached, enter the flashing lighting step;
[0104] In an optional embodiment of the present invention, if the flashing time interval T has not ended, then the lighting is turned on continuously, including:
[0105] Determine whether the value of the blinking status flag bit blink is 0;
[0106] If the value of the blinking status flag bit blink is 1, the light will not be constantly on;
[0107] If the value of the blinking state flag bit blink is 0, the GPIO is turned on or off according to the value of the constant light state flag bit lightup, and then the blinking time interval T is updated to T-1, and the interrupt response is enabled. In actual application scenarios, please refer to Figure 3 In the step of always lighting up, it is determined whether the blinking state flag blink is 0. If it is 0, it indicates that there is no blinking state, and then the GPIO lighting or light-off operation is performed according to the always lighting state flag lightup; if it is 1, it indicates that there is a blinking state, and the always lighting operation is not performed;
[0108] After the step of constantly lighting up the light, the flashing time interval T is reduced by 1, and the interrupt is jumped out after the interrupt response is enabled.
[0109] In an optional embodiment of the present invention, if the flashing time interval T ends, then flashing the light includes:
[0110] Determine the parity sign;
[0111] When the parity flag is 1, the GPIO output flipping is continued, the parity flag is cleared, and the flashing time interval T is reset;
[0112] When the parity flag is 0, the value of the blink flag bit blink is determined, and the state is updated according to the value of the blink flag bit blink.
[0113] In actual application scenarios, please refer to Figure 3In the flashing step, the parity flag is first determined. If the parity flag is 1, it indicates that this is the 2nth (n is a positive integer) time to enter the interrupt. At this time, regardless of whether the flashing flag is 1, the GPIO output flip is continued, and the parity flag is cleared and the flashing time interval T is reset; if the parity flag is 0, it indicates that this is the 2n-1th (n is a positive integer) time to enter the interrupt. At this time, the flashing flag blink needs to be determined again. If it is 0, it indicates that within the flashing time interval, the last status update of the main process no longer triggers the flashing condition. At this time, jump directly to the flashing time interval T reset, otherwise execute the GPIO output flip first, set the parity flag to 1, and then reset the flashing time interval T, and then enter the constant lighting step.
[0114] In an optional embodiment of the present invention, the state updating according to the value of the blinking flag bit blink includes:
[0115] When the value of the blink flag bit blink is 0, the blink time interval T is reset;
[0116] When the value of the blink flag bit blink is 1, the GPIO output flip is executed, the parity flag is set to 1, and the blink time interval T is reset.
[0117] In the embodiment of the present invention, LED flashing is achieved through interruption, which avoids the occupation of main process resources when the GPIO outputs a flashing indication. At the same time, the design of the flashing scheme enables flexible adjustment of the flashing frequency and balanced on-off duty cycle.
[0118] The above embodiments of the present invention are implemented by the following implementation methods:
[0119] See also Figure 4 , main process:
[0120] (1) After initialization is completed, the MCU enters the Link status monitoring. The MCU monitors the linkstatus register of the Switch chip through the SMI interface. Once the port link is detected, the Link status flag lightup of the corresponding port is set to 1, and then the Act status monitoring is entered; otherwise, the Link status flag lightup and Act flag blink are set to 0 and the last number of sent and received packets Rx and Tx are cleared, and then the Link status monitoring is performed again.
[0121] (2) After entering the Act status monitoring, the MCU reads the mib register of the Switch chip through the SMI interface to obtain the current transceiver packet data Rx1 and Tx1, and compares Rx1 and Tx1 with the data Rx0 and Tx0 read last time. If Rx1 and Tx1 have no change relative to Rx0 and Tx0, it indicates that there is no data transmission or reception. The Act status flag bit blink is set to 0, and the link status monitoring is returned. Otherwise, the Act status flag bit blink is set to 1, and the number of transceiver packets in the time interval of the two read mib transceiver packet data Rx1-Rx0, Tx1 -Tx0 is divided into three levels, and the flashing time interval T corresponds to different values; if Rx1-Rx0 and Tx1-Tx0 are both less than N1, the flashing time interval T is T1, if the larger of Rx1-Rx0 and Tx1-Tx0 is greater than or equal to N1 and less than N2, the flashing interval T is T2, if the larger of Rx1-Rx0 and Tx1-Tx0 is greater than or equal to N2, the flashing interval T is T3. After completing the level distinction of the number of sent and received packets, the sent and received packet data will be updated, and the Rx1 and Tx1 data read this time will be stored as a comparison for the next data read, and then the Link status monitoring will be re-entered.
[0122] See also Figure 5 , interrupt the process:
[0123] (1) The interruption process mainly executes GPIO lighting. The interruption is a timed interruption with a timer period of M, that is, the interruption processing is executed every M. No matter where the main process is executed, it will pause and enter the interruption processing after the timer interruption ends, and perform the lighting operation with the current status flag. After the interruption process ends, it returns to the original place and continues the main process to monitor the port status. The interruption process includes the implementation of two steps: Link lighting and Act lighting.
[0124] (2) After entering the interrupt, first turn off the interrupt response, then determine whether the flashing time interval T count has ended. If the count has not ended, directly enter the Link lighting step; if the count has reached, enter the Act lighting step;
[0125] (3) In the Act lighting step, the parity flag is first determined. If the parity flag is 1, it indicates that this is the 2nth (n is a positive integer) time that the interrupt has been entered. At this time, regardless of whether the flashing flag is 1, the GPIO output flip is continued, and the parity flag is cleared and the flashing time interval T is reset. If the parity flag is 0, it indicates that this is the 2n-1th (n is a positive integer) time that the interrupt has been entered. At this time, the flashing flag blink needs to be determined again. If it is 0, it indicates that during the flashing time interval, the main process has no data sent or received at the last status update port. At this time, it directly jumps to the flashing time interval T reset. Otherwise, the GPIO output flip is executed first, and the parity flag is set to 1 and the flashing time interval T is reset. Then, the Link lighting step is entered.
[0126] (4) Link lighting step determines whether the blinking status flag is 0. If it is 0, it indicates that no data is being sent or received, and then the GPIO lighting or lighting operation is performed according to the link status flag lightup. If it is 1, it indicates that data is being sent or received, and no lighting operation is performed;
[0127] (5) After the Link lighting step, the flashing time interval T is reduced by 1, and the interrupt response is enabled and the interrupt is jumped out.
[0128] See also Figure 6 The embodiment of the present invention further provides a device 600 for LED flashing indication of a communication device, comprising:
[0129] The control module 601 is used to monitor the status of the communication device system based on the control chip, enable interrupt response, and cyclically execute any one of the following:
[0130] The monitoring module 602 is used to enter the constant light state monitoring, and when the trigger condition of the constant light state is detected, the state of the communication device system is updated to the constant light state; otherwise, enter the flashing state monitoring, and when the trigger condition of the flashing state is detected, the state of the communication device is updated to the flashing state;
[0131] The response module 603 is used to enter the interrupt state and perform constant lighting or flashing lighting when the interrupt time is reached.
[0132] Optionally, the performing the always-on state monitoring, and updating the state of the communication device to the always-on state after a triggering condition of the always-on state is detected, includes:
[0133] When the control chip detects the trigger condition of the constant light state, the constant light state flag lightup is set to 1, and the flashing state monitoring is started;
[0134] When the control chip fails to detect the trigger condition of the always-on state, the always-on state flag bit lightup is set to 0, and the flashing state monitoring is entered.
[0135] Optionally, the entering into the flashing state monitoring, when a triggering condition of the flashing state is detected, updating the state of the communication device to the flashing state, includes:
[0136] When the control chip fails to detect the triggering condition of the blinking state, the blinking state flag bit blink is set to 0, and the control chip returns to the constant light state monitoring;
[0137] When the control chip detects the triggering condition of the blinking state, the blinking state flag bit blink is set to 1, and the blinking frequency is determined based on the triggering condition of the blinking state, and then the control chip returns to the constant light state monitoring.
[0138] Optionally, determining the flickering frequency based on the triggering condition of the flickering state, and then returning to the constant light state monitoring, includes:
[0139] Determine a flashing time interval T according to a trigger condition of the flashing state; wherein T is greater than 0;
[0140] The flashing frequency is determined according to the flashing time interval T, and the monitoring of the constant light state is returned to.
[0141] Optionally, when the interrupt time is reached, entering the interrupt state and lighting the GPIO include:
[0142] The control chip performs a timed interrupt; wherein the control chip enters the interrupt state every M time; M is greater than 0;
[0143] After the M time has elapsed, the control chip enters the interrupt state and performs GPIO lighting; wherein the GPIO lighting includes constant lighting or flashing lighting.
[0144] Optionally, the control chip enters the interrupt state and performs GPIO lighting, including:
[0145] Disable interrupt response;
[0146] Determine whether the flashing time interval T has ended;
[0147] If the flashing time interval T has not ended, the light is turned on continuously;
[0148] If the flashing time interval T ends, the flashing light is turned on.
[0149] Optionally, if the flashing time interval T has not ended, then lighting the lamp constantly includes:
[0150] Determine whether the value of the blinking status flag bit blink is 0;
[0151] If the value of the blinking status flag bit blink is 1, the light will not be constantly on;
[0152] If the value of the blinking state flag bit blink is 0, the GPIO is turned on or off according to the value of the constant light state flag bit lightup, and then the blinking time interval T is updated to T-1, and the interrupt response is enabled.
[0153] Optionally, if the flashing time interval T ends, flashing the light includes:
[0154] Determine the parity sign;
[0155] When the parity flag is 1, the GPIO output flipping is continued, the parity flag is cleared, and the flashing time interval T is reset;
[0156] When the parity flag is 0, the value of the blink flag bit blink is determined, and the state is updated according to the value of the blink flag bit blink.
[0157] Optionally, updating the status according to the value of the blinking flag bit blink includes:
[0158] When the value of the blink flag bit blink is 0, the blink time interval T is reset;
[0159] When the value of the blink flag bit blink is 1, the GPIO output flip is executed, the parity flag is set to 1, and the blink time interval T is reset.
[0160] See also Figure 7 , an embodiment of the present invention further provides a system for LED flashing indication of a communication device, comprising:
[0161] Communications equipment;
[0162] A control chip, the control chip is in communication connection with the communication device; the control chip is used to monitor the status of the communication device and enable interrupt response;
[0163] A status indicator light is communicatively connected to the control chip, and the status indicator light updates its status based on a control instruction sent by the control chip.
[0164] For details, please refer to Figure 8,(1) When the LED signal source output pin of the communication chip is multiplexed with other interfaces and other interfaces must be used, the corresponding LED control signal is provided by the GPIO of the MCU (control chip);
[0165] (2) When the communication chip has different interfaces, for example, the MDI interface and the RGMII interface multiplex the port LED signal source, and the communication device also provides the corresponding MDI interface RJ45 port and the corresponding RGMII interface SFP port to the outside, the communication chip provides the LED signal of one of the ports, and the LED control signal of the other port is provided by the GPIO of the MCU; the MCU monitors the status and data information of the corresponding port of the device, and realizes the Link and Act status of the port through the GPIO to realize the constant lighting and flashing of the LED.
[0166] Among them, port status and LED indication mechanism:
[0167] The LED indication is divided into three stages: Link status monitoring, Act status monitoring, and GPIO lighting. This cycle is repeated to indicate the port status.
[0168] Specific:
[0169] (1) Link status monitoring: The MCU reads the link status register of the switch chip through the MDI interface to monitor the link status of the port. Once a port link is detected, the link status flag lightup of the corresponding port is set to 1;
[0170] (2) Act status monitoring: Monitor the ports that have entered the Link state. The MCU reads the mib register of the switching chip through the MDI every T1 interval to obtain the number of received packets Rx and sent packets Tx of the port. Once there is a received or sent packet on the port within T1, the Act status flag of the corresponding port is set to blink 1. At the same time, the port with a larger number of received packets Rx and sent packets Tx is divided into three levels: N1, N2, and N3, representing three different frequencies of receiving and sending packets, and corresponding to the three blinking time intervals T1, T2, and T3 respectively.
[0171] (3) GPIO lighting: The lighting is performed during the MCU interrupt. The MCU sets a timer interrupt and enters an interrupt every M interval (the MCU timer interrupt is generally at the ms level) to perform the GPIO lighting operation. There are two types of lighting: constant light indication and flashing indication:
[0172] Always-on indication: After the timing interrupt is triggered, the corresponding GPIO outputs a high level or a low level (corresponding to LED high drive and low drive, respectively) according to the stored Link status flag lightup;
[0173] Flashing indication: With the time of the timing interrupt as the minimum cycle, the three levels of N1, N2, and N3 correspond to entering T1, T2, and T3 interrupts respectively to execute a GPIO flip, so as to realize the LED flashing frequency corresponding to the different receiving and sending packet rates of the port, and the corresponding flashing frequencies are f1=1 / (t1*T2), f2=1 / (t2*T2), and f3=1 / (t3*T2). At the same time, the parity flag is set in the interrupt to ensure that the GPIO must complete an even number of flips, so as to ensure that the flashing of the LED is a complete cycle.
[0174] An embodiment of the present invention further provides an electronic device, comprising a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor implements the method described above when executing the computer program.
[0175] An embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium includes a stored computer program, wherein when the computer program is executed, the device where the computer-readable storage medium is located is controlled to execute the method described above.
[0176] In addition, other structures and functions of the device in the embodiment of the present invention are known to those skilled in the art and will not be described in detail here to reduce redundancy.
[0177] It should be noted that the logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be specifically implemented in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in combination with these instruction execution systems, devices or apparatuses. For the purposes of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in combination with these instruction execution systems, devices or apparatuses. More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection portion with one or more wirings (electronic device), a portable computer disk box (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium and then editing, interpreting or processing in other suitable ways if necessary, and then stored in a computer memory.
[0178] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, a plurality of steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0179] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.
[0180] In the description of the present invention, it is to be understood that the terms “center”, “longitudinal”, “lateral”, “length”, “width”, “thickness”, “up”, “down”, “front”, “back”, “left”, “right”, “vertical”, “horizontal”, “top”, “bottom”, “inside”, “outside”, “clockwise”, “counterclockwise”, “axial”, “radial”, “circumferential”, etc., indicating orientations or positional relationships based on the orientations or positional relationships shown in the accompanying drawings, are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the referred device or element must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be understood as limiting the present invention.
[0181] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In the description of the present invention, the meaning of "plurality" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.
[0182] In the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", "connected", "fixed" and the like should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, it can be the internal connection of two elements or the interaction relationship between two elements, unless otherwise clearly defined. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0183] In the present invention, unless otherwise clearly specified and limited, a first feature being "above" or "below" a second feature may mean that the first and second features are in direct contact, or the first and second features are in indirect contact through an intermediate medium. Moreover, a first feature being "above", "above" or "above" a second feature may mean that the first feature is directly above or obliquely above the second feature, or simply means that the first feature is higher in level than the second feature. A first feature being "below", "below" or "below" a second feature may mean that the first feature is directly below or obliquely below the second feature, or simply means that the first feature is lower in level than the second feature.
[0184] Although the embodiments of the present invention have been shown and described above, it is to be understood that the above embodiments are exemplary and are not to be construed as limitations of the present invention. A person skilled in the art may change, modify, replace and vary the above embodiments within the scope of the present invention.
Claims
1. A method for LED flashing indication of communication equipment, characterized in that: include: Based on the control chip, the status of the communication equipment is monitored, the interrupt response is enabled, and the following interrupt process is triggered regularly; Entering the constant light state monitoring, when the triggering condition of the constant light state is detected, the state of the communication device is updated to the constant light state; otherwise, entering the flashing state monitoring, when the triggering condition of the flashing state is detected, the state of the communication device is updated to the flashing state; When the interrupt time is reached, the interrupt state is entered and the GPIO is turned on; When the interrupt time is reached, the interrupt state is entered and the GPIO is turned on, including: The control chip performs a timed interrupt; wherein the control chip enters the interrupt state every M time; M is greater than 0; After the M time has elapsed, the control chip enters the interrupt state and performs GPIO lighting; wherein the GPIO lighting includes constant lighting or flashing lighting; The control chip enters the interrupt state and performs GPIO lighting, including: Disable interrupt response; Determine whether the flashing time interval T has ended; If the flashing time interval T has not ended, the constant lighting process is performed; The process of performing constant lighting includes: Determine whether the value of the blinking status flag bit blink is 0; If the value of the blinking status flag bit blink is 1, the light will not be constantly on; If the value of the blinking state flag bit blink is 0, the GPIO is turned on or off according to the value of the constant light state flag bit lightup, and then the blinking time interval number T is updated to T-1, and the interrupt response is turned on, and the blinking time interval number T is greater than zero; If the flashing time interval T ends, the flashing lighting process is performed.
2. The method according to claim 1, characterized in that The step of entering the always-on state monitoring, and updating the state of the communication device to the always-on state after a triggering condition of the always-on state is detected, includes: When the control chip detects the trigger condition of the constant light state, the constant light state flag lightup is set to 1, and the flashing state monitoring is started; When the control chip fails to detect the trigger condition of the always-on state, the always-on state flag bit lightup is set to 0, and the flashing state monitoring is entered.
3. The method according to claim 1, characterized in that The step of entering the flashing state monitoring and updating the state of the communication device to the flashing state after detecting the triggering condition of the flashing state comprises: When the control chip fails to detect the triggering condition of the blinking state, the blinking state flag bit blink is set to 0, and the control chip returns to the constant light state monitoring; When the control chip detects the triggering condition of the blinking state, the blinking state flag bit blink is set to 1, and the blinking frequency is determined based on the triggering condition of the blinking state, and then the control chip returns to the constant light state monitoring.
4. The method according to claim 1, characterized in that: If the flashing time interval T ends, the flashing lighting process is performed, including: Determine the parity sign; When the parity flag is 1, the GPIO output flipping is continued, the parity flag is cleared, and the flashing time interval T is reset; When the parity flag is 0, the value of the blink flag bit blink is determined, and the state is updated according to the value of the blink flag bit blink.
5. A system for LED flashing indication of communication equipment, characterized in that: include: Communications equipment; A control chip, the control chip is in communication connection with the communication device; the control chip is used to monitor the status of the communication device and enable interrupt response; A status indicator light, the status indicator light being in communication with the control chip, and the status of the status indicator light being updated based on a control instruction sent by the control chip; The control chip enters the interrupt state every M time; M is greater than 0; after the M time has passed, the control chip enters the interrupt state and performs GPIO lighting; wherein the GPIO lighting includes constant lighting or flashing lighting; The control chip enters the interrupt state and performs GPIO lighting, including: Disable interrupt response; Determine whether the flashing time interval T has ended; If the flashing time interval T has not ended, the constant lighting process is performed; The process of performing constant lighting includes: Determine whether the value of the blinking status flag bit blink is 0; If the value of the blinking status flag bit blink is 1, the light will not be constantly on; If the value of the blinking state flag bit blink is 0, the GPIO is turned on or off according to the value of the constant light state flag bit lightup, and then the blinking time interval number T is updated to T-1, and the interrupt response is turned on, and the blinking time interval number T is greater than zero; If the flashing time interval T ends, the flashing lighting process is performed.
6. An electronic device, characterized in that: The method comprises a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor implements the method according to any one of claims 1 to 4 when executing the computer program.
7. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored computer program, wherein when the computer program is executed, the device where the computer-readable storage medium is located is controlled to execute the method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Control device for indicating lamp
CN103313459A
LED (light emitting diode) lamp meter reading flickering method and system based on STM32 timer
CN104507230A
