Summary of the invention
Embodiments provide a kind of connecting line, the control method of electronic equipment, control circuit and electronic equipment, do not need the mainboard pulling down electronic equipment, just can extraction system running log information.
For achieving the above object, embodiments of the invention adopt following technical scheme:
On the one hand, the invention provides a kind of connecting line, one end of described connecting line is headset plug, and the other end of described connecting line is connected to computer;
Described headset plug is provided with four contacts, and described four contacts are respectively L channel contact, right channel contact, ground wire contact and microphone contact;
Described connecting line inside comprises four wires, and described four contacts are connected with computer respectively by described four wires.
In the implementation that the first is possible, by described four wires, described L channel contact is connected to the UART output interface in computer, described right channel contact is connected to the high level in computer, described ground wire contact is connected to the ground wire in computer, and described microphone contact is connected to the UART input interface in computer.
In conjunction with the implementation that the first is possible, in the implementation that the second is possible, described headset plug, for inserting in the earphone interface of electronic equipment, is provided with switch unit in described electronic equipment;
Described right channel contact is connected to the control end of described switch unit, described L channel contact is connected to the UART input interface of described electronic equipment by described switch unit, and described microphone contact is connected to the UART output interface of described electronic equipment by described switch unit.
In conjunction with the implementation that the first or the second are possible, in the implementation that the third is possible, the other end of described connecting line is serial interface plug, and is connected to the serial ports of computer.
On the other hand, present invention also offers a kind of control method of electronic equipment, comprising:
In the earphone interface of described electronic equipment during plugged earphone plug, detect the level of the right channel contact of described headset plug;
When the right channel contact of described headset plug is high level, the UART input interface of described electronic equipment is connected to the L channel contact of described headset plug, the UART output interface of described electronic equipment is connected to the microphone contact of described headset plug;
When the right channel contact of described headset plug is low level, the left channel signals line of described electronic equipment is connected to the L channel contact of described headset plug, the microphone signal line of described electronic equipment is connected to the microphone contact of described headset plug.
In the implementation that the first is possible, the control method of this electronic equipment, also comprises:
The CPU of described electronic equipment passes through the level of the right channel contact of headset plug described in universal input/output (GeneralPurposeInputOutput, GPIO) interface, and inserts the type of the headset plug in described earphone interface according to this electrical level judging.
On the other hand, present invention also offers a kind of control circuit of electronic equipment, comprise earphone interface and switch unit;
Be provided with four contacts in described earphone interface, described four contacts are respectively L channel contact, right channel contact, ground wire contact and microphone contact;
Described L channel contact and described microphone contact are all connected to described switch unit, and described right channel contact is connected to the control end of described switch unit, and described right channel contact is also connected to right-channel signals line, described ground wire contact ground connection;
When the control end of described switch unit is high level, described L channel contact is connected to the UART input interface of described electronic equipment by described switch unit, and described microphone contact is connected to the UART output interface of described electronic equipment by described switch unit;
When the control end of described switch unit is low level, described L channel contact is connected to left channel signals line by described switch unit, and described microphone contact is connected to microphone signal line by described switch unit.
In the implementation that the first is possible, between the control end of described right channel contact and described switch unit, be provided with filter unit.
In conjunction with the implementation that the first is possible, in the implementation that the second is possible, the control end of described switch unit is also connected with the GPIO interface of described electronic equipment, to make the CPU of described electronic equipment by the level of the control end of switch unit described in described GPIO interface, and insert the type of the headset plug in described earphone interface according to this electrical level judging.
On the other hand, the present invention also provides a kind of electronic equipment, and described electronic equipment is connected with external equipment by the connecting line described in any one implementation above-mentioned, is provided with the control circuit described in any one implementation above-mentioned in described electronic equipment.
Compared with prior art, technique scheme tool provided by the present invention has the following advantages: when being inserted by common earphone cord in the earphone interface of electronic equipment, the control end of switch unit is low level, the right-channel signals line of electronic equipment is connected to earphone by the right channel contact at earphone interface place, and ground wire is connected to earphone by ground wire contact.The left channel signals line of electronic equipment is connected to L channel contact by switch unit, and is connected to earphone further, the microphone signal line of electronic equipment is connected to microphone contact simultaneously, and is connected to earphone further.When such user inserts normal earphone cord, the normal use of earphone can not be affected.
When connecting line provided by the invention being inserted in the earphone interface of electronic equipment, the control end of the switch unit in control circuit can be connected to the high level in computer by connecting line at the right channel contact place of earphone interface, the ground wire of electronic equipment is connected to the ground wire in computer by ground wire contact.Now, the UART input interface of electronic equipment is connected with L channel contact by switch unit, and is connected to the UART output interface of computer by connecting line; Meanwhile, the UART output interface of electronic equipment is also connected with microphone contact by switch unit, and is connected to the UART input interface of computer by connecting line.So just can pass through UART interface, be extracted the system cloud gray model log information of electronic equipment by computer, and by UART interface, electronic equipment is debugged.Therefore technical scheme provided by the invention does not need the mainboard pulling down electronic equipment, just can extraction system running log information, avoids the damage to all parts in electronic equipment, also improve electronic equipment develop or maintenance time debugging efficiency.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, be clearly and completely described the technical scheme in the embodiment of the present invention, obviously, described embodiment is only the present invention's part embodiment, instead of whole embodiments.Based on the embodiment in the present invention, the every other embodiment that those of ordinary skill in the art obtain under the prerequisite not paying creative work, all belongs to the scope of protection of the invention.
As depicted in figs. 1 and 2, embodiments provide a kind of connecting line, one end of this connecting line is headset plug, and the other end of connecting line is connected to computer.As shown in Figure 1, headset plug is provided with four contacts, and four contacts are respectively L channel contact, right channel contact, ground wire contact and microphone contact; Connecting line inside comprises four wires, and four contacts are connected with computer respectively by four wires.
As shown in Figure 2, in the present embodiment, one end of connecting line is headset plug, and the other end is serial interface plug, and is connected to the serial ports of computer.By above-mentioned four wires, L channel contact is connected to the universal asynchronous receiving-transmitting transmitter (UniversalAsynchronousReceiver/Transmitter in computer, UART) output interface, right channel contact is connected to the high level in computer, ground wire contact is connected to the ground wire in computer, and microphone contact is connected to the UART input interface in computer.
Certainly, the other end of connecting line also can pass through USB plug or other data-interfaces, is connected to the UART of computer.
As a preferred version, the implementation of above-mentioned high level can be utilize a pull-up resistor R1, provides 3V voltage by computer.
The embodiment of the present invention additionally provides a kind of control method of electronic equipment, comprising:
In the earphone interface of electronic equipment during plugged earphone plug, the level of the right channel contact of Test earphone plug;
When the right channel contact of headset plug is high level, the UART input interface of electronic equipment is connected to the L channel contact of headset plug, the UART output interface of electronic equipment is connected to the microphone contact of headset plug;
When the right channel contact of headset plug is low level, the left channel signals line of electronic equipment is connected to the L channel contact of headset plug, the microphone signal line of electronic equipment is connected to the microphone contact of headset plug.
Further, the control method of this electronic equipment, also comprises:
The CPU of electronic equipment by the level of the right channel contact of universal input/output (GeneralPurposeInputOutput, GPIO) interface headset plug, and according to the type of the headset plug in this electrical level judging plugged earphone interface.
As shown in Figure 3, the embodiment of the present invention additionally provides a kind of control circuit of electronic equipment, and the present embodiment is described for mobile phone, also this control circuit can be applied in the electronic equipment such as panel computer, navigator in other embodiments.This control circuit comprises earphone interface and switch unit; Be provided with four contacts in earphone interface, be respectively L channel contact L, right channel contact R, ground wire GND, microphone contact MIC, and with the contact one_to_one corresponding of four on headset plug.
Usually above-mentioned four contacts are connected to left channel signals line, right-channel signals line, ground wire, the microphone signal line of mobile phone respectively.In the present embodiment, L channel contact is connected to switch unit, and is optionally connected to left channel signals line or UART input interface by switch unit; Microphone contact is also connected to switch unit, and is optionally connected to microphone signal line or UART output interface by switch unit; Right channel contact is connected to the control end S of switch unit, is also connected to right-channel signals line simultaneously; Ground wire contact ground connection.As a preferred version, the control end S of switch unit is also connected with the GPIO interface of mobile phone, to make the CPU of mobile phone by the level of the control end S of GPIO interface switch unit, and according to the type of the headset plug in this electrical level judging plugged earphone interface, be the headset plug on the connecting line that provides of common headphones plug or the embodiment of the present invention.
When the control end S of switch unit is high level, L channel contact is connected to the UART input interface of mobile phone by switch unit, and microphone contact is connected to the UART output interface of mobile phone by switch unit.When the control end S of switch unit is low level, L channel contact is connected to left channel signals line by switch unit, and microphone contact is connected to microphone signal line by switch unit.
Switch unit inner classes is similar to two single-pole double-throw switch (SPDT)s, the control end S of switch unit is by a pull down resistor R0 ground connection, its default conditions are low level, switch unit connects voice-frequency channel, namely by default, L channel contact left channel signals line, microphone contact microphone signal line.When being inserted by common earphone cord in the earphone interface of mobile phone, the control end S of switch unit or low level, the right-channel signals line of mobile phone is by being connected to earphone by the right channel contact at earphone interface place, and ground wire is connected to earphone by ground wire contact.The left channel signals line of mobile phone is connected to L channel contact by switch unit, and is connected to earphone further, the microphone signal line of mobile phone is connected to microphone contact simultaneously, and is connected to earphone further.GPIO interface is also low level simultaneously, and mobile phone CPU is judged as inserting normal headset plug, when such user inserts normal earphone cord, can not affect the normal use of earphone.
When the connecting line embodiment of the present invention provided inserts in the earphone interface of mobile phone, the control end S of the switch unit in control circuit can be connected to the high level in computer by connecting line at the right channel contact place of earphone interface, the ground wire of mobile phone is connected to the ground wire in computer by ground wire contact.Now, switch unit connects UART path, namely by the UART input interface of L channel contact mobile phone, and microphone contact UART output interface.So just the UART input interface of mobile phone can be connected to the UART output interface of computer by connecting line; Meanwhile, also the UART output interface of mobile phone is connected to the UART input interface of computer by connecting line.GPIO interface is also high level simultaneously, and mobile phone CPU is judged as inserting the cable plug for UART transfer of data.This makes it possible to by UART interface, extracted the system cloud gray model log information of mobile phone by computer, and by UART interface, mobile phone is debugged.Therefore the technical scheme that provides of the embodiment of the present invention, does not need the mainboard pulling down mobile phone, just can extraction system running log information, avoids the damage to all parts in mobile phone, also improve mobile phone develop or maintenance time debugging efficiency.
Below introduce the various situations when mobile phone uses loudspeaker broadcasting music or hand-free call:
When inserting boom box or power amplifier, because the L channel of boom box or power amplifier and R channel all do not have pullup or pulldown level, so the control end S of switch unit also keeps the low level given tacit consent to, GPIO interface is also low level, mobile phone CPU is judged as inserting common headphones (sound equipment) plug, mobile phone CPU can not close voice-frequency channel, and audio frequency plays back from boom box or power amplifier.
When inserting normal earphone cord, the R channel of earphone cord does not have pullup or pulldown level, so the control end S of switch unit also keeps the low level given tacit consent to, GPIO interface is also low level, mobile phone CPU is judged as inserting common headphones plug, mobile phone CPU can not close voice-frequency channel, and audio frequency plays back from earphone.
When inserting the connecting line that the embodiment of the present invention provides, the R channel of connecting line has the level of artificial pull-up, so the control end S of switch unit becomes high level, GPIO interface is also high level, mobile phone CPU is judged as inserting the cable plug for UART transfer of data, mobile phone CPU does not close voice-frequency channel, and audio frequency still plays back from the loudspeaker of mobile phone.Computer extracts the system cloud gray model log information of mobile phone by earphone interface, and mobile phone is debugged.
Further, also be provided with filter unit between the control end S of right channel contact and switch unit, filter unit specifically comprises filter resistance R and the filter capacitor C of series connection, forms RC filter, wherein the size of filter resistance R is 10k Ω, and the size of filter capacitor C is 100nF.
When inserting normal headset plug in earphone interface, during playing audio signal, the right-channel signals line be connected with right channel contact transmits the audio signal of R channel, because this audio signal is AC signal, so need to arrange filter unit in the front end of the control end S of switch unit, make the low level of control end S held stationary, thus make switch unit connect voice-frequency channel all the time.
Should be noted that, the embodiment of the present invention is using the UART input interface of the left channel signals line in earphone circuit as mobile phone, using the UART output interface of the microphone signal line in earphone circuit as mobile phone, right-channel signals line in earphone circuit is pulled upward to 3V high level by a resistance, and this reequips mode the most easily on earphone cord original base.Certainly, in other embodiments, also can using the UART input interface of right-channel signals line as mobile phone, left channel signals line is pulled upward to 3V high level simultaneously, namely the left channel signals line in the present embodiment and right-channel signals line are exchanged, the function of UART transfer of data can be realized equally.
Present invention also offers a kind of electronic equipment, can be specifically mobile phone or panel computer (pad) etc., this electronic equipment is connected with external equipment (such as computer) by the connecting line in above-described embodiment, and is provided with the control circuit in above-described embodiment in this electronic equipment.
In the embodiment of the present invention, as depicted in figs. 1 and 2, one end of connecting line is headset plug to the connecting line be connected with computer for electronic equipment, and the other end of connecting line is connected to computer.Headset plug is provided with four contacts, and four contacts are respectively L channel contact, right channel contact, ground wire contact and microphone contact; Connecting line inside comprises four wires, and four contacts are connected with the UART in computer respectively by four wires.
As shown in Figure 3, this control circuit comprises earphone interface and switch unit to control circuit in the electronic equipment that the embodiment of the present invention provides; Be provided with four contacts in earphone interface, be respectively L channel contact L, right channel contact R, ground wire GND, microphone contact MIC, and with the contact one_to_one corresponding of four on headset plug.
L channel contact is connected to switch unit, and is optionally connected to left channel signals line or UART input interface by switch unit; Microphone contact is also connected to switch unit, and is optionally connected to microphone signal line or UART output interface by switch unit; Right channel contact is connected to the control end S of switch unit, is also connected to right-channel signals line simultaneously; Ground wire contact ground connection.When the control end S of switch unit is high level, L channel contact is connected to the UART input interface of electronic equipment by switch unit, and microphone contact is connected to the UART output interface of electronic equipment by switch unit.When the control end S of switch unit is low level, L channel contact is connected to left channel signals line by switch unit, and microphone contact is connected to microphone signal line by switch unit.
Switch unit inner classes is similar to two single-pole double-throw switch (SPDT)s, and the control end S of switch unit is by a pull down resistor R0 ground connection, and its default conditions are low level.When common earphone cord being inserted in the earphone interface of electronic equipment, the control end S of switch unit or low level, the right-channel signals line of electronic equipment is by being connected to earphone by the right channel contact at earphone interface place, and ground wire is connected to earphone by ground wire contact.The left channel signals line of electronic equipment is connected to L channel contact by switch unit, and is connected to earphone further, the microphone signal line of electronic equipment is connected to microphone contact simultaneously, and is connected to earphone further.GPIO interface is also low level simultaneously, and electronic equipment CPU is judged as inserting normal headset plug, when such user inserts normal earphone cord, can not affect the normal use of earphone.
As a preferred version, the control end S of switch unit is also connected with the GPIO interface of electronic equipment, to make the CPU of electronic equipment by the level of the control end S of GPIO interface switch unit, and according to the type of the headset plug in this electrical level judging plugged earphone interface, be the headset plug on the connecting line that provides of common headphones plug or the embodiment of the present invention.
When connecting line being inserted in the earphone interface of electronic equipment, the control end S of the switch unit in control circuit can be connected to the high level in computer by connecting line at the right channel contact place of earphone interface, the ground wire of electronic equipment is connected to the ground wire in computer by ground wire contact.Now, switch unit connects UART path, namely by the UART input interface of L channel contact electronic equipment, and microphone contact UART output interface.So just the UART input interface of electronic equipment can be connected to the UART output interface of computer by connecting line; Meanwhile, also the UART output interface of electronic equipment is connected to the UART input interface of computer by connecting line.GPIO interface is also high level simultaneously, and electronic equipment CPU is judged as inserting the cable plug for UART transfer of data.This makes it possible to by UART interface, extracted the system cloud gray model log information of electronic equipment by computer, and by UART interface, electronic equipment is debugged.Therefore the technical scheme that provides of the embodiment of the present invention, does not need the mainboard pulling down electronic equipment, just can extraction system running log information, avoids the damage to all parts in electronic equipment, also improve electronic equipment develop or maintenance time debugging efficiency.
Through the above description of the embodiments, those skilled in the art can be well understood to the present invention can use hardware implementing, or firmware realizes, or their compound mode realizes.When implemented in software, above-mentioned functions can be stored in computer-readable medium or as the one or more instruction on computer-readable medium or code and transmit.Computer-readable medium comprises computer-readable storage medium and communication media, and wherein communication media comprises any medium being convenient to transmit computer program from a place to another place.Storage medium can be any usable medium that computer can access.Be not limited to as example: computer-readable medium can comprise RAM, ROM, EEPROM, CD-ROM or other optical disc storage, magnetic disk storage medium or other magnetic storage apparatus or can be used in carrying or storing the expectation with instruction or data structure form program code and can by any other medium of computer access.In addition.Any connection can be suitable become computer-readable medium.Such as, if software be use coaxial cable, optical fiber cable, twisted-pair feeder, Digital Subscriber Line (DSL) or such as infrared ray, radio and microwave and so on wireless technology from website, server or other remote source, so the wireless technology of coaxial cable, optical fiber cable, twisted-pair feeder, DSL or such as infrared ray, wireless and microwave and so on be included in affiliated medium fixing in.As used in the present invention, dish (Disk) and dish (disc) comprise compression laser disc (CD), laser dish, laser disc, Digital Versatile Disc (DVD), floppy disk and Blu-ray Disc, the copy data of the usual magnetic of its mid-game, dish then carrys out the copy data of optics with laser.Combination above also should be included within the protection range of computer-readable medium.
The above; be only the specific embodiment of the present invention, but protection scope of the present invention is not limited thereto, is anyly familiar with those skilled in the art in the technical scope that the present invention discloses; the change that can expect easily or replacement, all should be encompassed within protection scope of the present invention.Therefore, protection scope of the present invention should be as the criterion with the protection range of claim.