Summary of the invention
The embodiment of the invention provides control method, control circuit and the electronic equipment of a kind of connecting line, electronic equipment, does not need to pull down the mainboard of 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, an 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, R channel contact, ground wire contact and microphone contact;
Described connecting line inside comprises four wires, and described four contacts are connected with computer by described four wires respectively.
In the possible implementation of the first, by described four wires, described L channel contact is connected to the UART output interface in the computer, described R channel contact is connected to the high level in the computer, described ground wire contact is connected to the ground wire in the computer, and described microphone contact is connected to the UART input interface in the computer.
In conjunction with the possible implementation of the first, in the possible implementation of the second, described headset plug is used for inserting the earphone interface of electronic equipment, is provided with switch unit in the described electronic equipment;
Described R 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 first or the possible implementation of the second, in the third possible implementation, the other end of described connecting line is serial interface plug, and is connected to the serial ports of computer.
On the other hand, the present invention also provides a kind of control method of electronic equipment, comprising:
When in the earphone interface of described electronic equipment during the plugged earphone plug, detect the level of the R channel contact of described headset plug;
When the R 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 R 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 possible implementation of the first, the control method of this electronic equipment also comprises:
The CPU of described electronic equipment is by universal input/output (General Purpose Input Output, GPIO) interface receives the level of the R channel contact of described headset plug, and inserts the type of the headset plug in the described earphone interface according to this electrical level judging.
On the other hand, the present invention also provides a kind of control circuit of electronic equipment, comprises earphone interface and switch unit;
Be provided with four contacts in the described earphone interface, described four contacts are respectively L channel contact, R channel contact, ground wire contact and microphone contact;
Described L channel contact and described microphone contact all are connected to described switch unit, and described R channel contact is connected to the control end of described switch unit, and described R channel contact also is connected to the right-channel signals line, described ground wire contact ground connection;
When the control end of described switch unit was high level, described L channel contact was 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 was low level, described L channel contact was connected to the left channel signals line by described switch unit, and described microphone contact is connected to the microphone signal line by described switch unit.
In the possible implementation of the first, be provided with filter unit between the control end of described R channel contact and described switch unit.
In conjunction with the possible implementation of the first, in the possible implementation of the second, the control end of described switch unit also links to each other with the GPIO interface of described electronic equipment, so that the CPU of described electronic equipment receives the level of the control end of described switch unit by described GPIO interface, and insert the type of the headset plug in the 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 links to each other with external equipment by the described connecting line of above-mentioned any one implementation, is provided with the described control circuit of above-mentioned any one implementation in the described electronic equipment.
Compared with prior art, technique scheme provided by the present invention has following advantage: when common earphone cord being inserted 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 R channel contact at earphone interface place, and ground wire is connected to earphone by the ground wire contact.Switch unit is connected to the L channel contact with the left channel signals line of electronic equipment, and further is connected to earphone, and the microphone signal line with electronic equipment is connected to the microphone contact simultaneously, and further is connected to earphone.When the user inserts normal earphone cord like this, can not affect the normal use of earphone.
When connecting line provided by the invention being inserted in the earphone interface of electronic equipment, the control end of the switch unit in the control circuit can be at the R channel contact place of earphone interface be connected to high level in the computer by connecting line, and the ground wire of electronic equipment is connected to ground wire in the computer by the ground wire contact.At this moment, switch unit links to each other the UART input interface of electronic equipment with the L channel contact, and is connected to the UART output interface of computer by connecting line; Simultaneously, switch unit also links to each other the UART output interface of electronic equipment with the microphone contact, and is connected to the UART input interface of computer by connecting line.So just can pass through the UART interface, extract system's running log information of electronic equipment by computer, and by the UART interface electronic equipment be debugged.Therefore technical scheme provided by the invention does not need to pull down the mainboard of electronic equipment, just can extraction system running log information, avoided the damage to all parts in the electronic equipment, and also improved electronic equipment in exploitation or the debugging efficiency when keeping in repair.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the invention, the technical scheme in the embodiment of the invention is clearly and completely described, obviously, described embodiment only is the present invention's part embodiment, rather than whole embodiment.Based on the embodiment among the present invention, the every other embodiment that those of ordinary skills obtain under the prerequisite of not paying creative work belongs to the scope of protection of the invention.
As depicted in figs. 1 and 2, the embodiment of the invention provides a kind of connecting line, and an 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, R channel contact, ground wire contact and microphone contact; Connecting line inside comprises four wires, and four contacts are connected with computer by four wires respectively.
As shown in Figure 2, in the present embodiment, an 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, the L channel contact is connected to general asynchronous receiving-transmitting transmitter (the Universal Asynchronous Receiver/Transmitter in the computer, UART) output interface, the R channel contact is connected to the high level in the computer, the ground wire contact is connected to the ground wire in the computer, and the microphone contact is connected to the UART input interface in the 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 to utilize a pull-up resistor R1, provides 3V voltage by computer.
The embodiment of the invention also provides a kind of control method of electronic equipment, comprising:
When in the earphone interface of electronic equipment during the plugged earphone plug, the level of the R channel contact of Test earphone plug;
When the R 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 R 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 is by the level of the R channel contact of universal input/output (General Purpose Input Output, GPIO) interface reception 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 invention also provides a kind of control circuit of electronic equipment, and present embodiment describes as an example of mobile phone example, also this control circuit can be applied in the electronic equipments such as panel computer, navigator in other embodiments.This control circuit comprises earphone interface and switch unit; Be provided with four contacts in the earphone interface, be respectively L channel contact L, R channel contact R, ground wire GND, microphone contact MIC, and corresponding one by one with four contacts on the headset plug.
Usually above-mentioned four contacts are connected to respectively left channel signals line, right-channel signals line, ground wire, the microphone signal line of mobile phone.In the present embodiment, the L channel contact is connected to switch unit, and optionally is connected to left channel signals line or UART input interface by switch unit; The microphone contact also is connected to switch unit, and optionally is connected to microphone signal line or UART output interface by switch unit; The R channel contact is connected to the control end S of switch unit, also is connected to simultaneously the right-channel signals line; Ground wire contact ground connection.As a preferred version, the control end S of switch unit also links to each other with the GPIO interface of mobile phone, so that the CPU of mobile phone receives the level of the control end S of switch unit by the GPIO interface, 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 invention.
When the control end S of switch unit was high level, the L channel contact was connected to the UART input interface of mobile phone by switch unit, and the microphone contact is connected to the UART output interface of mobile phone by switch unit.When the control end S of switch unit was low level, the L channel contact was connected to the left channel signals line by switch unit, and the microphone contact is connected to the microphone signal line by switch unit.
The 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 is connected voice-frequency channel, namely by default, the L channel contact is connected the left channel signals line, and the microphone contact is connected the microphone signal line.When common earphone cord being inserted in the earphone interface of mobile phone, control end S or the low level of switch unit, the right-channel signals line of mobile phone is connected to earphone by the R channel contact by the earphone interface place, and ground wire is connected to earphone by the ground wire contact.Switch unit is connected to the L channel contact with the left channel signals line of mobile phone, and further is connected to earphone, and the microphone signal line with mobile phone is connected to the microphone contact simultaneously, and further is connected to earphone.The GPIO interface also is low level simultaneously, and mobile phone CPU is judged as and has inserted normal headset plug, when the user inserts normal earphone cord like this, can not affect the normal use of earphone.
When the connecting line that the embodiment of the invention is provided inserts in the earphone interface of mobile phone, the control end S of the switch unit in the control circuit can be at the R channel contact place of earphone interface be connected to high level in the computer by connecting line, and the ground wire of mobile phone is connected to ground wire in the computer by the ground wire contact.At this moment, switch unit is connected the UART path, namely the L channel contact is connected the UART input interface of mobile phone, and the microphone contact is connected the 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; Simultaneously, also the UART output interface of mobile phone is connected to the UART input interface of computer by connecting line.The GPIO interface also is high level simultaneously, and mobile phone CPU is judged as and has inserted the cable plug that is used for the UART transfer of data.So just can pass through the UART interface, extract system's running log information of mobile phone by computer, and by the UART interface mobile phone be debugged.Therefore the technical scheme that provides of the embodiment of the invention does not need to pull down the mainboard of mobile phone, just can extraction system running log information, avoided the damage to all parts in the mobile phone, and also improved mobile phone in exploitation or the debugging efficiency when keeping in repair.
Below introduce the various situations when mobile phone uses loudspeaker music playing or hand-free call:
When inserting external sound equipment or power amplifier, because all draw or drop-down level on not on the L channel of external sound equipment or power amplifier and the R channel, so the control end S of switch unit also keeps the low level given tacit consent to, the GPIO interface also is low level, mobile phone CPU is judged as and has inserted common headphones (sound equipment) plug, mobile phone CPU can not close voice-frequency channel, and audio frequency plays back from external sound equipment or power amplifier.
When inserting normal earphone cord, the R channel of earphone cord draws or drop-down level on not, so the control end S of switch unit also keeps the low level given tacit consent to, the GPIO interface also is low level, mobile phone CPU is judged as and has inserted the 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 invention provides, the level that the R channel of connecting line draws on having artificially, so the control end S of switch unit becomes high level, the GPIO interface also is high level, mobile phone CPU is judged as and has inserted the cable plug that is used for the 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.The computer expert crosses system's running log information that earphone interface extracts mobile phone, and mobile phone is debugged.
Further, also be provided with filter unit between the control end S of R channel contact and switch unit, filter unit specifically comprises filter resistance R and the filter capacitor C of series connection, forms the RC filter, wherein the size of filter resistance R is 10k Ω, and the size of filter capacitor C is 100nF.
In earphone interface, insert normal headset plug, during playing audio signal, audio signal with transmission R channel on the right-channel signals line that the R channel contact links to each other, because this audio signal is AC signal, so need to filter unit be set at the front end of the control end S of switch unit, make the low level of control end S held stationary, thereby make switch unit connect all the time voice-frequency channel.
Should be noted that, the embodiment of the invention is the UART input interface of the left channel signals line in the earphone circuit as mobile phone, the UART output interface of the microphone signal line in the earphone circuit as mobile phone, move the 3V high level to by a resistance on the right-channel signals line in the earphone circuit, this is the mode of reequiping the most easily on the earphone cord original base.Certainly, in other embodiments, also can be with the UART input interface of right-channel signals line as mobile phone, the 3V high level will be moved to simultaneously on the left channel signals line, namely the left channel signals line in the present embodiment and right-channel signals line are exchanged, can realize equally the function of UART transfer of data.
The present invention also provides a kind of electronic equipment, specifically can be mobile phone or panel computer (pad) etc., this electronic equipment links to each other with external equipment (for example 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 invention, be used for connecting line that electronic equipment links to each other with computer as depicted in figs. 1 and 2, an end of connecting line is headset plug, 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, R channel contact, ground wire contact and microphone contact; Connecting line inside comprises four wires, and four contacts are connected with UART in the computer by four wires respectively.
Control circuit in the electronic equipment that the embodiment of the invention provides as shown in Figure 3, this control circuit comprises earphone interface and switch unit; Be provided with four contacts in the earphone interface, be respectively L channel contact L, R channel contact R, ground wire GND, microphone contact MIC, and corresponding one by one with four contacts on the headset plug.
The L channel contact is connected to switch unit, and optionally is connected to left channel signals line or UART input interface by switch unit; The microphone contact also is connected to switch unit, and optionally is connected to microphone signal line or UART output interface by switch unit; The R channel contact is connected to the control end S of switch unit, also is connected to simultaneously the right-channel signals line; Ground wire contact ground connection.When the control end S of switch unit was high level, the L channel contact was connected to the UART input interface of electronic equipment by switch unit, and the microphone contact is connected to the UART output interface of electronic equipment by switch unit.When the control end S of switch unit was low level, the L channel contact was connected to the left channel signals line by switch unit, and the microphone contact is connected to the microphone signal line by switch unit.
The 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, control end S or the low level of switch unit, the right-channel signals line of electronic equipment is connected to earphone by the R channel contact by the earphone interface place, and ground wire is connected to earphone by the ground wire contact.Switch unit is connected to the L channel contact with the left channel signals line of electronic equipment, and further is connected to earphone, and the microphone signal line with electronic equipment is connected to the microphone contact simultaneously, and further is connected to earphone.The GPIO interface also is low level simultaneously, and electronic equipment CPU is judged as and has inserted normal headset plug, when the user inserts normal earphone cord like this, can not affect the normal use of earphone.
As a preferred version, the control end S of switch unit also links to each other with the GPIO interface of electronic equipment, so that the CPU of electronic equipment receives the level of the control end S of switch unit by the GPIO interface, 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 invention.
When connecting line being inserted in the earphone interface of electronic equipment, the control end S of the switch unit in the control circuit can be at the R channel contact place of earphone interface be connected to high level in the computer by connecting line, and the ground wire of electronic equipment is connected to ground wire in the computer by the ground wire contact.At this moment, switch unit is connected the UART path, namely the L channel contact is connected the UART input interface of electronic equipment, and the microphone contact is connected the 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; Simultaneously, also the UART output interface of electronic equipment is connected to the UART input interface of computer by connecting line.The GPIO interface also is high level simultaneously, and electronic equipment CPU is judged as and has inserted the cable plug that is used for the UART transfer of data.So just can pass through the UART interface, extract system's running log information of electronic equipment by computer, and by the UART interface electronic equipment be debugged.Therefore the technical scheme that provides of the embodiment of the invention does not need to pull down the mainboard of electronic equipment, just can extraction system running log information, avoided the damage to all parts in the electronic equipment, and also improved electronic equipment in exploitation or the debugging efficiency when keeping in repair.
Through the above description of the embodiments, the those skilled in the art can be well understood to the present invention and can realize with hardware, or the firmware realization, or their compound mode realizes.When using software to realize, above-mentioned functions can be stored in the computer-readable medium or as one or more instructions or code on the computer-readable medium and transmit.Computer-readable medium comprises computer-readable storage medium and communication media, and wherein communication media comprises any medium of being convenient to transmit from a place to another place computer program.Storage medium can be any usable medium that computer can access.As example but be not limited to: 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 the program code that carries or store the expectation with instruction or data structure form and can be by any other medium of computer access.In addition.Any connection can be suitable become computer-readable medium.For example, if software be use coaxial cable, optical fiber cable, twisted-pair feeder, Digital Subscriber Line (DSL) or the wireless technology such as infrared ray, radio and microwave from the website, server or the transmission of other remote source, under coaxial cable, optical fiber cable, twisted-pair feeder, DSL or the wireless technology such as infrared ray, wireless and microwave are included in so in the photographic fixing of medium.As used in the present invention, dish (Disk) and dish (disc) comprise compression laser disc (CD), laser dish, laser disc, digital universal laser disc (DVD), floppy disk and Blu-ray Disc, the copy data of the common magnetic of its mid-game, dish then come the copy data of optics with laser.Top combination also should be included within the protection range of computer-readable medium.
The above; be the specific embodiment of the present invention only, but protection scope of the present invention is not limited to this, anyly is familiar with those skilled in the art in the technical scope that the present invention discloses; the variation 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.