当前位置:网站首页>Design and driver transplantation of matrix keyboard circuit of Ti am335x industrial control module
Design and driver transplantation of matrix keyboard circuit of Ti am335x industrial control module
2022-07-26 02:03:00 【szembed】
The verification of this content uses yingpengfei embedded CoM-335x Core module and Evaluation Board EAC-335X, The brief introduction is as follows :

Preface
Compared with keys , Matrix key ( keyboard ) Use less GPIO Implement more key interfaces . following , be based on COM-335x Core module , Introduce linux The coding practice process of matrix keyboard in embedded system , Simply from the principle 、 Key value code description .
1 Principle introduction
Press the effective electric bisector of the key , It can be divided into high-level trigger and low-level trigger . In a general way , Button triggered by high level , In principle design, the uplink address is pulled down by resistance ; Low level trigger , Line address pull up . Separately shown 1-1、 chart 1-2 Shown , Pay attention to the trigger level when configuring the software .


Software level ,Linux input Subsystems provide support . Its architecture is shown in the figure 1-3, More about input Subsystem , Please refer to resources or kernel code .

2 Key configuration
Key configuration focuses on two issues , One is IO Distribute , The second is the key value .IO Distribute according to the principle , Pay attention to the effective level 、 The row is configured as input ; Key values can be obtained in two ways , Manual calculation and function call . The following two sections introduce section 1 How to configure the keys in Chapter .
2.1 Key configuration triggered by high level
, chart 1-1 The key for is 3 That's ok 2 Column , Line address drop-down .IO Configure line input 、 Column output 、 The drop-down 、 High level trigger , stay COM-335x Of dts The configuration in is as follows :

notes : In the above code list , The red font is the line address IO Distribute , Black is the column address IO Distribute .

notes :
① In the above code list , each GPIO The average effective electricity is high , namely :GPIO_ACTIVE_HIGH;
② debounce-delay-ms It means time to shake , The unit is millisecond ;
③ col-scan-delay-us Indicates the column scan interval , In microseconds .
④ linux,keymap The value of the attribute is the key value , It is calculated that . The calculation formula is shown in the figure 2-1:

With “MENU” For example , Its “linux,keymap” The value of is calculated as follows :

from include/dt-bindings/input/linux-event-codes.h In file , find MENU The value of is 139, namely 16 It's binary 8B( common 4 position 16 Hexadecimal number , Insufficient high-level compensation 0), Pictured 2-2 Shown .

chart 2-2
Sum up ,32~25 Bit is line number 、24~17 Position is listed 、 low 16 Bit is key value , convert to 16 Hexadecimal numbers are easy to read (4 position 2 A decimal number means 1 position 16 Hexadecimal number ).0x0000008b Express 0 That's ok 0 Column 、 The key value is 139.
2.2 Key configuration triggered by low level
chart 1-2 The key for is 6 That's ok 3 Column , Line address pull up .IO Configure line input 、 Column output 、 Pull up 、 Low level trigger , stay COM-335x Of dts The configuration in is as follows :

notes : In the above code list , The red font is the line address IO Distribute , Black is the column address IO Distribute .



notes :
① gpio-activelow Indicates low level trigger , If there is no such attribute , It means that the high level is valid ;
② linux,no-autorepeat Indicates that key repetition is disabled , namely : Long press a key , Print only once ;
③ call MATRIX_KEY Function calculates the key value , This method is better than 2.1 Section is intuitive , Please run the function as shown in the figure 2-3, The definition of key value is still from include/dt-bindings/input/linux-event-codes.h From the file .

chart 2-3
边栏推荐
- My Mysql to MySQL data table synchronization, only the code written in the first order will take effect, and the rest will not take effect. This may be
- 重发布基础与配置
- 1205 Lock wait timeout exceeded; Try restarting transaction processing
- C# 迭代器的实现
- I.MX6UL核心模块使用连载-WIFI测试 (八)
- Worthington产气荚膜梭菌神经氨酸酶的特征及测定
- vite 本地运行首次进入页面加载慢问题
- Basic usage of set, map, DOM classlist in ES6
- E2. escape the maze (hard version)
- BGP知识点总结
猜你喜欢

【2020】【论文笔记】磁控溅射法生长Bi2Te3/CoFeB双层异质结——

1. Mx6ul core module use serial TF card read / write test (V)

I.MX6UL核心模块使用连载-RS485测试 (十)

The slow loading of the first entry page of vite local operation

PHP Alipay transfer to Alipay account

SQL manual blind injection and error reporting injection

AutoCAD -- Method of calculating area

i.MX6ULL SNVS电源域GPIO状态保持验证

vite 本地运行首次进入页面加载慢问题

1. Mx6ul core module serial Ethernet test (VII)
随机推荐
Dqn pytoch example
flutter 下 grpc list没有Setter 方法 ,如何使用相关属性
pt-onnx-ncnn转换的问题记录(接yolov5训练)
HTC手机官解、S-ON/S-OFF与超级CID的关系
Guys, the flinksql datahub source table has a field timestamp 16 bits, which is written to ora
Leetcode/ numbers that appear only once
How idea can quickly delete recently opened projects
SQLyog数据导入导出图文教程
G. Count the trains (thought set + two points)
Make and makefile summary II
What is the difference between for... In... And for... Of
E. Split into two sets
Detailed explanation of redis6.x configuration parameters
1. Mx6ul core module serial use - touch screen calibration (IX)
Worthington papain - production of glycopeptides from purified proteoglycans (attached Literature)
P3166 number triangle (tolerance and exclusion +gcd)
What is JSX?
劳驾问一下各位老师 oracle 到pg cdc oracle 那边字段大写 pg 这边小写 同
Characteristics and determination of neuraminidase from Clostridium perfringens in Worthington
My Mysql to MySQL data table synchronization, only the code written in the first order will take effect, and the rest will not take effect. This may be