CN204993296U - Circuit of GPIO extension button - Google Patents
Circuit of GPIO extension button Download PDFInfo
- Publication number
- CN204993296U CN204993296U CN201520834799.4U CN201520834799U CN204993296U CN 204993296 U CN204993296 U CN 204993296U CN 201520834799 U CN201520834799 U CN 201520834799U CN 204993296 U CN204993296 U CN 204993296U
- Authority
- CN
- China
- Prior art keywords
- circuit
- gpio
- expansion
- keyboard
- extension
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Expired - Fee Related
Links
Landscapes
- Push-Button Switches (AREA)
Abstract
本实用新型公开了一种GPIO扩展按键的电路,包括CPU微处理器、键盘矩阵,该电路还包括扩展电路,以所述键盘矩阵的某一行为键盘扩展基础行,在所述CPU微处理器的GPIO扩展口和与所述键盘扩展基础行间跨接所述扩展电路,本实用新型通过采用二极管分离器件搭出与门电路或者专门利用与门逻辑器件实现了手机按键电路的扩展。
The utility model discloses a circuit for extending GPIO keys, which includes a CPU microprocessor and a keyboard matrix. The GPIO expansion port and the expansion circuit of the keyboard are bridged between the basic rows. The utility model realizes the expansion of the key circuit of the mobile phone by using a diode separation device to form an AND gate circuit or specially utilizing an AND logic device.
Description
技术领域technical field
本实用新型涉及一种按键电路,特别是涉及一种GPIO(GeneralPurposeInputOutpu,通用输入输出)扩展按键的电路。The utility model relates to a key circuit, in particular to a GPIO (General Purpose Input Output, general purpose input and output) extended key circuit.
背景技术Background technique
目前,手机平台提供按键信号是Keyou0-out6和Keyin0-keyin5,一般最多能支持7*6=42个按键。那么如果想实现多于42个物理按键,则比较麻烦,尚无有效的解决方法。Currently, the key signals provided by the mobile phone platform are Keyou0-out6 and Keyin0-keyin5, and generally can support up to 7*6=42 keys. Then if you want to realize more than 42 physical buttons, it will be troublesome, and there is no effective solution.
发明内容Contents of the invention
为克服上述现有技术存在的不足,本实用新型之一目的在于提供一种GPIO扩展按键的电路,其通过采用二极管分离器件搭出与门电路或者专门利用与门逻辑器件实现了手机按键电路的扩展。In order to overcome the deficiencies in the above-mentioned prior art, one purpose of the present invention is to provide a GPIO extended button circuit, which uses a diode separation device to build an AND gate circuit or specifically uses an AND logic device to realize the mobile phone button circuit. expand.
为达上述及其它目的,本实用新型提出一种GPIO扩展按键的电路,包括CPU微处理器、键盘矩阵,该电路还包括扩展电路,以所述键盘矩阵的某一行为键盘扩展基础行,在所述CPU微处理器的GPIO扩展口和与所述键盘扩展基础行间跨接所述扩展电路。For reaching above-mentioned and other purposes, the utility model proposes a kind of circuit of GPIO expansion button, comprises CPU microprocessor, keyboard matrix, and this circuit also comprises expansion circuit, expands basic row with certain behavior keyboard of described keyboard matrix, in The expansion circuit is bridged between the GPIO expansion port of the CPU microprocessor and the keyboard expansion basic row.
进一步地,所述扩展电路包括若干二极管,每个二极管跨接于所述键盘扩展基础行与每个GPIO扩展口之间。Further, the expansion circuit includes several diodes, and each diode is connected between the keyboard expansion basic row and each GPIO expansion port.
进一步地,所述二极管阴极接GPIO扩展口,阳极接所述键盘扩展基础行。Further, the cathode of the diode is connected to the GPIO expansion port, and the anode is connected to the keyboard expansion basic row.
进一步地,所述扩展电路包括与门电路,所述与门电路的输入脚接所述GPIO扩展口,所述与门电路的输出脚接所述键盘扩展基础行。Further, the expansion circuit includes an AND circuit, the input pin of the AND circuit is connected to the GPIO expansion port, and the output pin of the AND circuit is connected to the keyboard expansion basic row.
进一步地,所述CPU微处理器的行扫描GPIO口设置为输出,列扫描GPIO口设置为中断输入,每行每列间跨接一个自复位按键组成的所述键盘矩阵。Further, the row scanning GPIO port of the CPU microprocessor is set as output, and the column scanning GPIO port is set as interrupt input, and the keyboard matrix composed of a self-resetting button is connected between each row and each column.
进一步地,所述列扫描GPIO口均设置一上拉电阻。Further, a pull-up resistor is set on each column scanning GPIO port.
进一步地,所述二极管为正向导通电压比较低的肖特基二极管。Further, the diode is a Schottky diode with relatively low forward conduction voltage.
与现有技术相比,本实用新型一种GPIO扩展按键的电路,其通过采用二极管分离器件搭出与门电路或者专门利用与门逻辑器件实现了手机按键电路的扩展。Compared with the prior art, the utility model is a GPIO extended button circuit, which realizes the expansion of the mobile phone button circuit by using a diode separation device to build an AND gate circuit or specially using an AND logic device.
附图说明Description of drawings
图1为本实用新型一种GPIO扩展按键的电路第一较佳实施例的电路结构图;Fig. 1 is the circuit structural diagram of the first preferred embodiment of the circuit of a kind of GPIO expansion button of the utility model;
图2为本实用新型一种GPIO扩展按键的电路第二较佳实施例的电路结构图。Fig. 2 is a circuit structure diagram of a second preferred embodiment of the circuit of a GPIO extension key according to the present invention.
具体实施方式detailed description
以下通过特定的具体实例并结合附图说明本实用新型的实施方式,本领域技术人员可由本说明书所揭示的内容轻易地了解本实用新型的其它优点与功效。本实用新型亦可通过其它不同的具体实例加以施行或应用,本说明书中的各项细节亦可基于不同观点与应用,在不背离本实用新型的精神下进行各种修饰与变更。The implementation of the utility model will be described below through specific examples and in conjunction with the accompanying drawings. Those skilled in the art can easily understand other advantages and effects of the utility model from the content disclosed in this specification. The utility model can also be implemented or applied through other different specific examples, and various modifications and changes can be made to the details in this specification based on different viewpoints and applications without departing from the spirit of the utility model.
图1为本实用新型一种GPIO扩展按键的电路第一较佳实施例的电路结构图。如图1所示,本实用新型一种GPIO扩展按键的电路包括CPU微处理器10、键盘矩阵20以及扩展电路30。CPU微处理器10和键盘矩阵20为常规电路,行扫描GPIO口设置为输出,图示为KEYOUT0-6,列扫描GPIO口设置为中断输入,图示为KEYIN0-5以及GPIO0-2,每行每列间跨接一个自复位按键组成键盘矩阵20,第i+1行KEYOUTi和第1列KEYIN0、第2列KEYIN1、第3列KEYIN2、第4列KEYIN3、第5列KEYIN4、第6列KEYIN5以及扩展列(GPIO扩展口对应的列)GPIO0、GPIO1、GPIO2间分别接一个自复位开关组成第i+1行键盘,i取值从0到6,这样得到总共7行键盘,选择某一行为键盘扩展基础行,图示为KEYIN5,在GPIO扩展口GPIO0、GPIO1、GPIO2和键盘扩展基础行间跨接二极管D1-D3组成扩展电路30。FIG. 1 is a circuit structure diagram of a first preferred embodiment of a circuit of a GPIO extension key according to the present invention. As shown in FIG. 1 , a circuit of a GPIO extended button of the present invention includes a CPU microprocessor 10 , a keyboard matrix 20 and an extended circuit 30 . The CPU microprocessor 10 and the keyboard matrix 20 are conventional circuits, and the row scanning GPIO ports are set as output, shown as KEYOUT0-6, and the column scanning GPIO ports are set as interrupt input, shown as KEYIN0-5 and GPIO0-2, each row A self-resetting button is connected between each column to form a keyboard matrix 20, the i+1th row KEYOUTi and the first column KEYIN0, the second column KEYIN1, the third column KEYIN2, the fourth column KEYIN3, the fifth column KEYIN4, and the sixth column KEYIN5 And the extension column (the column corresponding to the GPIO expansion port) GPIO0, GPIO1, and GPIO2 are respectively connected with a self-resetting switch to form the i+1th row of keyboards, and the value of i is from 0 to 6, so that a total of 7 rows of keyboards are obtained, and a certain behavior is selected The keyboard extension basic row, shown as KEYIN5 in the figure, connects diodes D1-D3 between the GPIO expansion ports GPIO0, GPIO1, GPIO2 and the keyboard extension basic row to form an extension circuit 30 .
较佳的,本实用新型中所用的二极管选用正向导通电压比较低的肖特基二极管(正向导通电压在0.2V左右),如果选用普通的二极管,由于有0.7V的压降,KEYIN5的中断有可能会判决不到。Preferably, the diode used in the utility model selects a Schottky diode with a relatively low forward conduction voltage (the forward conduction voltage is about 0.2V). If a common diode is selected, due to the voltage drop of 0.7V, the KEYIN5 Interruption may not be judged.
图2为本实用新型一种GPIO扩展按键的电路第一较佳实施例的电路结构图。与第一较佳实施例不同的是,第二较佳实施例中,扩展电路30使用与门构成,与门的输入脚接GPIO扩展口GPIO0、GPIO1、GPIO2,与门的输出脚接键盘扩展基础行(KEYIN5)。Fig. 2 is a circuit structure diagram of a first preferred embodiment of a circuit of a GPIO extension key according to the present invention. Different from the first preferred embodiment, in the second preferred embodiment, the expansion circuit 30 is formed by an AND gate, the input pin of the AND gate is connected to the GPIO expansion ports GPIO0, GPIO1, and GPIO2, and the output pin of the AND gate is connected to the keyboard expansion port. The base row (KEYIN5).
在本实用新型中,GPIO口的KEYOUT0-6设置为扫描输出,GPIO口KEYIN0-5设置为中断输入,如有内部上拉电阻则打开内部上拉电阻以减少成本,若需要加强抗干扰则外加上拉电阻。如图1所示R1-R9,选择合适的GPIO扩展口(允许设置为中断输入)如图示GPIO0-2,利用二极管实现键盘扩展,3个GPIO扩展口,在KEYIN5基础上可以扩展出3列键盘,每个GPIO扩展口可以扩出7个键盘(KEYOUT0-6),当然,需要GPIO扩展口数量由所需扩展键盘数量决定,在此不予限定。In this utility model, KEYOUT0-6 of the GPIO port is set as scan output, and KEYIN0-5 of the GPIO port is set as interrupt input. If there is an internal pull-up resistor, turn on the internal pull-up resistor to reduce costs. Pull-up resistor. As shown in Figure 1, R1-R9, select the appropriate GPIO expansion port (allow to be set as interrupt input) as shown in the figure GPIO0-2, use diodes to realize keyboard expansion, 3 GPIO expansion ports, 3 columns can be expanded on the basis of KEYIN5 Keyboard, each GPIO expansion port can expand 7 keyboards (KEYOUT0-6). Of course, the number of GPIO expansion ports is determined by the number of expansion keyboards required, and is not limited here.
以下说明本实用新型的原理:The following illustrates the principle of the utility model:
在没有按键按下的情况下,KEYIN5和GPIO0-2由于没有上拉电阻,高电平状态,此时不会触发按键中断。When no button is pressed, KEYIN5 and GPIO0-2 will not trigger a button interrupt at this time because they have no pull-up resistors and are in a high level state.
如果KEYIN5这一列上有按键按下,KEYIN5就会被拉低,触发按键中断,此时CPU需要去判别GPIO键盘扩展基础行0-2的状态,三根GPIO由于二极管反向截止,仍旧处于高电平状态,即可判断出具体的键值。If a button is pressed on the KEYIN5 column, KEYIN5 will be pulled low to trigger a button interrupt. At this time, the CPU needs to judge the state of the GPIO keyboard extension basic row 0-2. The three GPIOs are still in high power due to the reverse cut-off of the diode. In the flat state, the specific key value can be determined.
如果是GPIO0-2扩展的按键被按下,就会把相应列的GPIO拉低,此时二极管正向导通,同时会把KEYIN5拉低,就会触发KEYIN5的按键中断,此时CPU需要去判别GPIO0-2的状态,从而判断出具体的键值。由于CPU对键值的的具体判断为现有技术,在此不予赘述,不属本实用新型保护的范围。If the extended button of GPIO0-2 is pressed, the GPIO of the corresponding column will be pulled down. At this time, the diode is forward-conducting, and at the same time, KEYIN5 will be pulled down, which will trigger the button interrupt of KEYIN5. At this time, the CPU needs to judge The state of GPIO0-2 can determine the specific key value. Since the specific judgment of the key value by the CPU is a prior art, it will not be repeated here, and it does not belong to the scope of protection of the present invention.
由于采用与门构成的扩展电路的原理与二极管组成的扩展电路的原理一样,在此不予赘述。Since the principle of the expansion circuit composed of AND gates is the same as that of the expansion circuit composed of diodes, it will not be repeated here.
上述实施例仅例示性说明本实用新型的原理及其功效,而非用于限制本实用新型。任何本领域技术人员均可在不违背本实用新型的精神及范畴下,对上述实施例进行修饰与改变。因此,本实用新型的权利保护范围,应如权利要求书所列。The above-mentioned embodiments only illustrate the principles and effects of the present utility model, but are not intended to limit the present utility model. Any person skilled in the art can modify and change the above-mentioned embodiments without departing from the spirit and scope of the present invention. Therefore, the protection scope of the utility model should be as listed in the claims.
Claims (7)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201520834799.4U CN204993296U (en) | 2015-10-26 | 2015-10-26 | Circuit of GPIO extension button |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201520834799.4U CN204993296U (en) | 2015-10-26 | 2015-10-26 | Circuit of GPIO extension button |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN204993296U true CN204993296U (en) | 2016-01-20 |
Family
ID=55127615
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201520834799.4U Expired - Fee Related CN204993296U (en) | 2015-10-26 | 2015-10-26 | Circuit of GPIO extension button |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN204993296U (en) |
Cited By (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN109613863A (en) * | 2018-12-10 | 2019-04-12 | 南京木牛自动化系统有限公司 | A kind of input port expansion circuit with delivery outlet multiplexing function |
| CN109922194A (en) * | 2018-12-21 | 2019-06-21 | 贵州财富之舟科技有限公司 | Key expansion method, system and terminal |
| CN111600591A (en) * | 2020-07-27 | 2020-08-28 | 北京维普无限智能技术有限公司 | Key identification method and system of matrix keyboard |
-
2015
- 2015-10-26 CN CN201520834799.4U patent/CN204993296U/en not_active Expired - Fee Related
Cited By (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN109613863A (en) * | 2018-12-10 | 2019-04-12 | 南京木牛自动化系统有限公司 | A kind of input port expansion circuit with delivery outlet multiplexing function |
| CN109922194A (en) * | 2018-12-21 | 2019-06-21 | 贵州财富之舟科技有限公司 | Key expansion method, system and terminal |
| CN109922194B (en) * | 2018-12-21 | 2021-06-29 | 贵州财富之舟科技有限公司 | Key expansion method, system and terminal |
| CN111600591A (en) * | 2020-07-27 | 2020-08-28 | 北京维普无限智能技术有限公司 | Key identification method and system of matrix keyboard |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN101943948B (en) | Keyboard scanning device and keyboard scanning method | |
| CN101581764B (en) | Key press detecting circuit | |
| CN204993296U (en) | Circuit of GPIO extension button | |
| CN101995956B (en) | Keyboard, keyboard scanning circuit and method | |
| CN102075194B (en) | Circuit and method for scanning keyboard and electronic equipment | |
| CN103560796B (en) | Matrix circuit and scan method | |
| CN102289291B (en) | Keyboard circuit capable of improving key-press scanning speed | |
| CN103324296A (en) | Detection method of keyboard module and keyboard matrix | |
| CN101645947A (en) | Method for realizing full keyboard of mobile phone | |
| US8989801B2 (en) | Mobile phone and key detection device | |
| CN203406859U (en) | An analog-to-digital converting button circuit | |
| CN104202055B (en) | Key circuit for detecting key trigger sate in real time, gamepad and method | |
| CN102857232B (en) | A kind of key press detecting circuit and detection method | |
| CN204517782U (en) | A kind of switching circuit and there is the terminal of this circuit | |
| US20190074848A1 (en) | Keyboard apparatus | |
| CN206442359U (en) | The not internal control circuit of lock switch | |
| CN103095307B (en) | A kind of matrix switch key | |
| TWI497267B (en) | Power on reset circuit | |
| CN104317481A (en) | Input interface display method and device | |
| CN204131504U (en) | A kind of key circuit of real-time detection button trigger state and game paddle | |
| CN202931275U (en) | Button circuit and electronic apparatus | |
| CN203590188U (en) | a switching circuit | |
| CN207766247U (en) | Key circuit and electronic equipment thereof | |
| CN104168026A (en) | Sectional type current-steering DAC circuit | |
| CN105227188A (en) | A kind of many key press detecting circuits |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| C14 | Grant of patent or utility model | ||
| GR01 | Patent grant | ||
| CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20160120 Termination date: 20171026 |
|
| CF01 | Termination of patent right due to non-payment of annual fee |