Invention content
Place in view of above-mentioned deficiencies of the prior art, the purpose of the present invention is to provide a kind of switch process sides of multiple antennas
Method, storage medium and mobile terminal.When mobile terminal uses call function, the mutiple antennas switching energy on mobile terminal
It is enough more flexibly to use same set of control program, reduce the consumption of mobile terminal memory headroom, the system for improving mobile terminal
Performance.
In order to achieve the above object, this invention takes following technical schemes:
A kind of switch process method of multiple antennas, includes the following steps:
Detection obtains the level detection result of the corresponding detection pin of each antenna;
It detects and whether generates interruption on each detection pin;
When generating interruption on the detection pin for detecting antenna, the detection is enabled according to corresponding level detection result and is drawn
The interrupt function of foot.
In the switch process method of the multiple antennas, the level of the corresponding detection pin of each antenna is obtained in the detection
Further include step before the step of testing result:
The control of the switching detection to each antenna is indicated using different control parameters respectively, the control parameter includes day
Line number, detection pin number and detection level value;
When the level detection result for detecting pin is identical as detection level value, indicate that antenna is opened;When the level of detection pin
When testing result is opposite with detection level value, indicate that antenna is closed.
It is described when generation interruption on the detection pin for detecting antenna in the switch process method of the multiple antennas
When, according to corresponding level detection result enable it is described detection pin interrupt function the step of specifically include:
When generating interruption on the detection pin for detecting mutiple antennas, obtains each antenna and generate the detection of interruption respectively and draw
Foot number, and corresponding detection interrupting information is preserved according to detection pin number;
According to the holding time sequence of the detection interrupting information of preservation, and according to corresponding level detection as a result, processing pair successively
The interrupt function for the detection pin answered.
It is described in being generated on the detection pin for detecting mutiple antennas in the switch process method of the multiple antennas
When disconnected, the detection pin number that each antenna generates interruption respectively is obtained, and corresponding detection is preserved according to detection pin number and is interrupted
The step of information, specifically includes:
When generating interruption on the detection pin detected in mutiple antennas, obtains each antenna and generate the detection pin interrupted
Number, and forbidden energy corresponds to the interrupt function of detection pin;
Control parameter and the preservation of corresponding detection pin are obtained according to detection pin number respectively, records and is preserved per a line control parameter
Time.
It is described that corresponding detection pin is obtained according to detection pin number respectively in the switch process method of the multiple antennas
Further include step before the step of control parameter simultaneously preserves, the time that record is preserved per a line control parameter:
If having preserved the control parameter of same detection pin number, the control parameter of the same detection pin number preserved is deleted
It removes.
In the switch process method of the multiple antennas, the holding time of the detection interrupting information according to preservation is suitable
Sequence, and according to corresponding level detection as a result, the step of handling the interrupt function of corresponding detection pin successively specifically includes:
Judge whether the control parameter preserved;
If in the presence of the control parameter preserved, holding time earliest control parameter is obtained;
Current time is obtained, the holding time of holding time earliest control parameter is obtained, by the earliest of current time and gained
Holding time makes the difference to obtain the time difference;
If the time difference is more than predetermined threshold, level detection is compared as a result, obtaining respective antenna according to the control parameter of preservation
Open and-shut mode;
If the time difference is less than predetermined threshold, after delay scheduled time, level detection is compared according to the control parameter of preservation as a result,
Obtain the open and-shut mode of respective antenna;
According to the corresponding level detection of detection pin as a result, the interrupt function of the enabled detection pin.
In the switch process method of the multiple antennas, the corresponding level detection according to detection pin is as a result, make
It can be specifically included the step of the interrupt function for detecting pin:
If the level detection result for detecting pin is high level, the low level interrupt function of the detection pin is enabled;
If the level detection result for detecting pin is low level, the high level interrupt function of the detection pin is enabled.
In the switch process method of the multiple antennas, the corresponding level detection according to detection pin is as a result, make
Further include step after the step of interrupt function of the energy detection pin:
Delete the corresponding control parameter preserved of the detection pin.
A kind of non-transient computer readable storage medium, is stored with computer executable instructions, and the computer can be held
Row instruction is set as the switch process method of above-mentioned multiple antennas.
A kind of mobile terminal is provided with mutiple antennas on the mobile terminal, and the mobile terminal includes:
With the central processing unit of mutiple antennas communication connection;And
With the memory of central processing unit communication connection;Wherein,
The memory is stored with the instruction that can be executed by the central processing unit, and described instruction is held by the central processing unit
Row, so that the central processing unit executes the switch process method of above-mentioned multiple antennas.
Compared to the prior art, a kind of switch process method of multiple antennas provided by the invention, storage medium and movement are whole
End, the switch process method of multiple antennas therein include the following steps:Detection obtains the level of the corresponding detection pin of each antenna
Testing result;It detects and whether generates interruption on each detection pin;When generating interruption on the detection pin for detecting antenna, root
The interrupt function of the detection pin is enabled according to corresponding level detection result.Lead to which the present invention can be used in mobile terminal
When talking about function, enables the mutiple antennas switching on mobile terminal more can flexibly use same set of control program, reduce
The consumption of mobile terminal memory headroom improves the performance of the system of mobile terminal.
Specific implementation mode
The present invention provides a kind of switch process method, storage medium and the mobile terminal of multiple antennas, to make the mesh of the present invention
, technical solution and effect it is clearer, clear, the present invention is described in more detail for the embodiment that develops simultaneously referring to the drawings.
It should be appreciated that described herein, specific examples are only used to explain the present invention, is not intended to limit the present invention.
Referring to Fig. 1, the flow chart of the switch process method for multiple antennas provided by the invention, described in the present invention more
The switch process method of antenna is based on as run on the mobile terminal with mutiple antennas such as mobile phone comprising following operation
Step:
S100, detection obtain the level detection result of the corresponding detection pin of each antenna;
Interruption whether is generated on S200, each detection pin of detection;
S300, when generating interruption on the detection pin for detecting antenna, it is enabled described according to corresponding level detection result
Detect the interrupt function of pin.
Further include step preferably, before step S100:
The control of the switching detection to each antenna is indicated using different control parameters respectively, the control parameter includes day
Line number, detection pin number and detection level value;
When the level detection result for detecting pin is identical as detection level value, indicate that antenna is opened;When the level of detection pin
When testing result is opposite with detection level value, indicate that antenna is closed.
It is the hardware architecture diagram of the preferred embodiment of mobile terminal provided by the invention please continue to refer to Fig. 2.
In specific embodiment, a duplexer switching control file can be set in the terminal, call AF in the following text, duplexer switching
The control for indicating a duplexer change detection in file per a line is controlled, is made of three parameters per a line:
Parameter 1, antenna number, a number represent an antenna;
Parameter 2, switching detect pin number, each detection pin number corresponds to an antenna number, can be drawn by detecting this
Foot judges whether its corresponding antenna opens or closes;For example, 33 indicate that detection pin number is GPIO33(Detecting pin number is
It is No. GPIO);
Parameter 3, detection level value indicate to indicate antenna opening when which kind of level switching detection pin be, will be this
Level negates expression and indicates antenna closing when which kind of level switching detection pin be;For example, when detection level value is 1
When, indicate there is antenna opening when switching detection pin is high level, switching detection pin has antenna when being low level
It closes.
The three row control parameters carried in the AF for being below the present embodiment citing:
2,893,1
5,28,0
12,66,1
It is indicated respectively per a line:
The antenna that number is 2 is switched using GPIO893 to detect duplexer, is had when switching detection pin is high level
Antenna is opened, and has antenna closing when switching detection pin is low level;
The antenna that number is 5 is switched using GPIO28 to detect duplexer, is had when switching detection pin is low level
Antenna is opened, and has antenna closing when switching detection pin is high level;
The antenna that number is 12 is switched using GPIO66 to detect duplexer, is had when switching detection pin is high level
Antenna is opened, and has antenna closing when switching detection pin is low level.
Further, referring to Fig. 3, the step S300 is specifically included:
S310, when on the detection pin for detecting mutiple antennas generate interruption when, obtain each antenna generates respectively interruption
Pin number is detected, and corresponding detection interrupting information is preserved according to detection pin number;
S320, the holding time sequence for detecting interrupting information according to preservation, and according to corresponding level detection as a result, locating successively
Manage the interrupt function of corresponding detection pin.
During the concrete application of the switch process method of multiple antennas provided by the invention, an antenna may be based on
Switching detects program and realizes, but the antenna changeover program is multiplexed by mutiple antennas, is opened when generating mutiple antennas simultaneously
Concern is changed, and possibly can not be handled at once when detection is interrupted, be needed first to save, until switching detects program at one's leisure again
Processing;Therefore, as shown in Fig. 2, a duplexer can be arranged in the terminal in specific embodiment provided by the invention
Hand-off process caches, and calls AFC in the following text, and AFC is used to preserve the duplexer detection interrupting information for having generated but also having had little time processing, should
It is the corresponding control parameter of antenna to detect interrupting information, and the detailed process of processing is as follows:
A1, when on the detection pin detected in antenna generate interruption when, obtain generate interrupt detection pin number, and according to
Pin number obtains a line control parameter corresponding to the detection pin in AF, and the interruption work(of pin is then detected described in forbidden energy
Energy;
A2, a line control parameter will be obtained in step A1 being saved in AFC, when preservation took by the time for generating detection interrupting information
It is successively preserved, and also needs to record the time that every a line control parameter addition preserves, i.e. every a line control parameter in AFC
Including four parameters:First three parameter is consistent with three parameters mentioned in AF, and the 4th parameter is this row control parameter in AFC
In holding time.
Further include step also, before step S310:
If having preserved the control parameter of same detection pin number, the control parameter of the same detection pin number preserved is deleted
It removes.If having keeping records of for the control parameter of same detection pin number i.e. in AFC, then it is deleted, avoids influencing this
The preservation of secondary control parameter and subsequent processing.
Further, referring to Fig. 4, the step S320 is specifically included:
S321, the control parameter preserved is judged whether;
If S322, in the presence of the control parameter preserved, holding time earliest control parameter is obtained;
S323, current time is obtained, obtains the holding time of holding time earliest control parameter, by current time and gained
The earliest holding time makes the difference to obtain the time difference;
If S324, time difference are more than predetermined threshold, level detection is compared as a result, obtaining corresponding day according to the control parameter of preservation
The open and-shut mode of line;
If S325, time difference are less than predetermined threshold, after delay scheduled time, level detection is compared according to the control parameter of preservation
As a result, obtaining the open and-shut mode of respective antenna;
S326, according to the corresponding level detection of detection pin as a result, the interrupt function of the enabled detection pin.
Further, referring to Fig. 5, the step S326 is specifically included:
If S3261, the level detection result for detecting pin are high level, the low level for enabling the detection pin interrupts work(
Energy;
If S3262, the level detection result for detecting pin are low level, the high level for enabling the detection pin interrupts work(
Energy.
It is noted that the interrupt function for repeating enabled detection pin in order to prevent further includes after step S326
Step:Delete the corresponding control parameter preserved of the detection pin.
In the particular embodiment, can in the terminal there are one by each duplexer change detection be multiplexed antenna
Switching detects program, calls AFP in the following text, AFP specific workflows are as follows:
C1, judge whether AFC is empty, C1 is thened follow the steps if it is sky, if not being that sky thens follow the steps C2;
C2, it obtains and generates break period earliest a line control parameter in AFC;
C3, current time, the holding time of a line control parameter obtained in obtaining step C2, by current time and preservation are obtained
Time obtains time difference tdd as difference, if tdd thens follow the steps C4 more than or equal to threshold value tddth, otherwise delay time
Tddth-tdd executes step C4 again;The tddth is a time value, for preventing mobile terminal from causing due to vibration etc.
Error detection caused by antenna instantaneous touch is bad, it is 80 milliseconds that tddth, which can more preferably be arranged,;
Whether the level of the switching detection pin in that a line control parameter obtained in C4, obtaining step C2 is electric with detection
Flat identical, if the same explanation has antenna opening, and explanation has antenna closing if opposite;
C5, the interrupt function for enabling switching detection pin:Make if current switch change detection pin is high level
The low level interrupt function of the energy pin enables the high level of the pin if current switch change detection pin is low level
Interrupt function executes step C1 later.
A kind of switch process method based on above-mentioned multiple antennas, at switch for realizing the multiple antennas
The device of reason method, referring to Fig. 6, the device is the electronic equipment of a connection mutiple antennas, including following module:
Pin read module 10 is detected, for detecting the level detection result for obtaining the corresponding detection pin of each antenna;
It detects pin and interrupts detection module 20, interruption whether is generated on each detection pin for detecting;
Pin interruption control module 30 is detected, for when generating interruption on the detection pin for detecting antenna, according to correspondence
Level detection result enable it is described detection pin interrupt function.
For the more vivid description present invention, the present invention provides a kind of specific descriptions of the realization step of preferred embodiment such as
Under:
Please refer to Fig. 2 and Fig. 6, the switching detection on the mobile terminal realized in the present embodiment in three antennas, packet
It includes:Central processing unit, antenna 2, antenna 5, antenna 8;
The hardware configuration of three antennas is as follows:
Antenna 2 is connected with the GPIO33 of central processing unit, and antenna opening is indicated when GPIO33 is high level, when
GPIO33 indicates antenna closing when being low level;
Antenna 5 is connected with the GPIO33 of central processing unit, and antenna opening is indicated when GPIO28 is low level, when
GPIO28 indicates antenna closing when being high level;
Antenna 8 is connected with the GPIO33 of central processing unit, and antenna opening is indicated when GPIO66 is high level, when
GPIO66 indicates antenna closing when being low level;
In addition, further including inside central processing unit:AF, AFC, AFP, detection pin read module, detection pin interrupt detection mould
Block and detection pin interruption control module;
Wherein, AF specifically includes three row control parameters, as follows:
2,33,1;
5,28,0;
8,66,1;
The switch process method of the multiple antennas of the present embodiment includes the following steps:
Step S1, when mobile terminal-opening, the level of GPIO33,28,66 is obtained by detection pin read module, if level
It is consistent with the third parameter in AF, illustrate that antenna has been opened, otherwise illustrates that antenna is not switched on;
Step S2, detection pin interrupts detection module and carries out interruption control to GPIO33,28,66, if current switch switching inspection
It is the low level interrupt function that high level then enables the pin to survey pin, if current switch change detection pin is low level
Enable the high level interrupt function of the pin;
Step S3, when generating interruption on the detection pin detected in antenna, the detection pin number for generating and interrupting is obtained, and
A line control corresponding to the detection pin is obtained in AF according to pin number;Then the interruption work(of pin is detected described in forbidden energy
Energy;
Step S4, a line control will be obtained in step S3 and is saved in AFC, and when preservation takes and carries out by generating the time order and function interrupted
Preserve, and if in AFC have the same antenna number keep records of if be deleted;In addition, also needing to record every a line
The time that control parameter preserves, i.e. every a line in AFC include four parameters:Three parameters mentioned in first three parameter and AF
Unanimously, details are not described herein again, and the 4th parameter is the time of control parameter addition.
The processing of duplexer handoff is handled by AFP, is included the following steps:
Step S5, judge whether AFC is empty, and S5 is thened follow the steps if it is sky, if not being that sky thens follow the steps S6;
Step S6, it obtains and generates break period earliest a line control parameter in AFC;
Step S7, current time is obtained, the addition time of a line control parameter obtained in obtaining step S6, it is poor that two times are made
Time difference tdd is obtained, if tdd thens follow the steps S8 more than or equal to threshold value tddth, otherwise delay time tddth-tdd is again
Execute step S8;
Step S8, in that a line control parameter obtained in obtaining step S6 switching detection pin level whether with inspection
It is identical to survey level, if the same explanation has antenna opening, and explanation has antenna closing if opposite;
Step S9, the interrupt function of switching detection pin is enabled:If current switch change detection pin is high level
The low level interrupt function for then enabling the pin enables the height of the pin if current switch change detection pin is low level
Level interrupt function executes step S5 later.
The present invention also provides a kind of non-transient computer readable storage mediums, are stored with computer executable instructions, institute
State the switch process method for the multiple antennas that computer executable instructions are arranged to carry out in above-described embodiment.
The present invention also provides a kind of mobile terminals.The mobile terminal can execute corresponding method and step.Such as Fig. 2 institutes
Show, the mobile terminal(Such as smart mobile phone)On be provided with mutiple antennas 50, and further include:
At least one central processing unit(processor)In 40, Fig. 2 by taking a central processing unit 40 as an example;Display screen 41;And
Memory(memory)42, can also include communication interface(Communications Interface)43 and bus 44.Wherein,
Central processing unit 40, display screen 41, memory 42 and communication interface 43 can complete mutual communication by bus 44.Display
Screen 41 is set as preset user in display initial setting mode and interface and automatically prompting user is guided to carry out duplexer switching.
Communication interface 43 can transmit information.Central processing unit 40 can call the logical order in memory 42, to execute above-mentioned reality
Apply the method in example.
In addition, the logical order in above-mentioned memory 42 can be realized by the form of SFU software functional unit and is used as only
Vertical product is sold or in use, can be stored in a computer read/write memory medium.
Memory 42 is used as a kind of computer readable storage medium, and it is executable to may be configured as storage software program, computer
Program, such as the corresponding program instruction of method or module in the embodiment of the present disclosure.Central processing unit 40 is stored in by operation
Software program, instruction in reservoir 42 or module are realized in above-described embodiment to execute application of function and data processing
Method.
Memory 42 may include storing program area and storage data field, wherein storing program area can storage program area, extremely
Application program needed for a few function;Storage data field can be stored uses created data etc. according to terminal device.This
Outside, memory 42 may include high-speed random access memory, can also include nonvolatile memory.
The all or part of step of above-described embodiment can be completed by hardware, can also instruct correlation by program
Hardware complete, which can be stored in a computer readable storage medium, and storage medium can be non-transient storage Jie
Matter, including USB flash disk, mobile hard disk, read-only memory(Read-Only Memory, ROM), random access memory(Random
Access Memory, RAM), a variety of media that can store program code of disk or CD etc., can also be transient state storage
Medium.
In conclusion switch process method, storage medium and the mobile terminal of a kind of multiple antennas provided by the invention, wherein
The switch process method of multiple antennas include the following steps:Detection obtains the level detection knot of the corresponding detection pin of each antenna
Fruit;It detects and whether generates interruption on each detection pin;When generating interruption on the detection pin for detecting antenna, according to correspondence
Level detection result enable it is described detection pin interrupt function.To which the present invention can use call function in mobile terminal
When, it enables the mutiple antennas switching on mobile terminal more can flexibly use same set of control program, reduces mobile whole
The consumption in end memory space improves the performance of the system of mobile terminal.
It, can according to the technique and scheme of the present invention and its hair it is understood that for those of ordinary skills
Bright design is subject to equivalent substitution or change, and all these changes or replacement should all belong to the guarantor of appended claims of the invention
Protect range.