惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

F
Fortinet All Blogs
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
有赞技术团队
有赞技术团队
www.infosecurity-magazine.com
www.infosecurity-magazine.com
大猫的无限游戏
大猫的无限游戏
爱范儿
爱范儿
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
T
Threatpost
V
Visual Studio Blog
Apple Machine Learning Research
Apple Machine Learning Research
博客园 - Franky
人人都是产品经理
人人都是产品经理
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
The Cloudflare Blog
N
News and Events Feed by Topic
L
Lohrmann on Cybersecurity
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
酷 壳 – CoolShell
酷 壳 – CoolShell
V
V2EX
AWS News Blog
AWS News Blog
S
SegmentFault 最新的问题
T
Tailwind CSS Blog
Hugging Face - Blog
Hugging Face - Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Spread Privacy
Spread Privacy
J
Java Code Geeks
博客园 - 聂微东
T
Tor Project blog
宝玉的分享
宝玉的分享
博客园 - 叶小钗
Webroot Blog
Webroot Blog
博客园 - 【当耐特】
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
H
Heimdal Security Blog
Y
Y Combinator Blog
T
The Blog of Author Tim Ferriss
MongoDB | Blog
MongoDB | Blog
I
InfoQ
Security Latest
Security Latest
Martin Fowler
Martin Fowler
Hacker News: Ask HN
Hacker News: Ask HN
P
Privacy International News Feed
C
CERT Recently Published Vulnerability Notes
Latest news
Latest news
雷峰网
雷峰网
D
Darknet – Hacking Tools, Hacker News & Cyber Security
C
Cisco Blogs
H
Help Net Security
L
LINUX DO - 最新话题
L
LINUX DO - 热门话题

洛屿的小站

一种简单的卡尔曼滤波器设计 Cadence - 应律而动,落指成音 Zephyr - 聆风之息,为你而奏 不改一行插件代码,实现消息优先级与阻断 洛玖定时任务系统 在 butterfly 主题中添加首页点集动画(基于p2line项目) 你好,2026 stm32f4xx-ads1256驱动 stm32f4xx-ad9854并行驱动 主动式网站状态监测实现及其应用 右键菜单加入用Trae打开文件和文件夹 三角洲行动ID映射表 洛玖SDK说明 为网页文章开头添加原文连接 Hexo-Butterfly主题在主页添加GitHub贡献日历 Proteus中555定时器仿真问题 装饰器 洛玖开发日记 STS3032舵机获取力矩输出 kotlin网页前后端那些事 mspm0g3507-ad9850 奇怪的bug Paddle模型转PaddleLite 人工智能考核 构建一个yolov3网络 yolo和paddle模型常见输出参数 PaddleDetection 随便写的一些东西 实验室C语言第一次考核题目讲解及相关代码解读 C语言神经网络房价预测系统 C、C++数组,指针,指针数组,数组指针的区别 C、C++的大括号是必须的部分吗? C、C++预处理详解 C、C++其他关键字详解 C、C++存储类型关键字详解 C、C++控制语句关键字详解 C、C++数据类型关键字详解 C、C++关键字 C++药品管理系统 Bi-LSTM(Attention)的PyTorch实现 C语言实现波士顿房价预测 easy库的使用 edgeboardFZ3A相关问题 Predict.py的编写 Paddle环境搭建 百度Paddle模型训练 GMD09601-0.96OLED显示屏 【LeetCode 1617】统计子树中城市之间最大距离 C语言学习相关 CH32(F10X F20X) 最短路 拓扑排序
STM32阵列按键
洛屿 · 2023-03-12 · via 洛屿的小站
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
uint8_t Key_GetNum(void) {
uint8_t keyNum = 0;

/*
在Key_init()中
设置所有行为高电平,列为输入下拉模式(IPD)
GPIO_SetBits(GPIOB, Key_ROW1 | Key_ROW2 | Key_ROW3 | Key_ROW4);
GPIO_ResetBits(GPIOA, Key_Pin_A_All);
GPIO_ResetBits(GPIOC, Key_Pin_C_All);
*/
GPIO_SetBits(GPIOB, Key_ROW4);
GPIO_ResetBits(GPIOB, Key_ROW1);
if (GPIO_ReadInputDataBit(GPIOA, Key_COL1) == Bit_RESET && keyNum == 0) {Delay_ms(10);
while(GPIO_ReadInputDataBit(GPIOA, Key_COL1) == Bit_RESET);
keyNum = 1;
} else if (GPIO_ReadInputDataBit(GPIOA, Key_COL2) == Bit_RESET && keyNum == 0) {Delay_ms(10);
while(GPIO_ReadInputDataBit(GPIOA, Key_COL2) == Bit_RESET);
keyNum = 5;
} else if (GPIO_ReadInputDataBit(GPIOC, Key_COL3) == Bit_RESET && keyNum == 0) {Delay_ms(10);
while(GPIO_ReadInputDataBit(GPIOC, Key_COL3) == Bit_RESET);
keyNum = 9;
} else if (GPIO_ReadInputDataBit(GPIOC, Key_COL4) == Bit_RESET && keyNum == 0) {Delay_ms(10);
while(GPIO_ReadInputDataBit(GPIOC, Key_COL4) == Bit_RESET);
keyNum = 13;
}
// 等待一段时间,避免检测到多个按键同时按下
Delay_ms(10);

GPIO_SetBits(GPIOB, Key_ROW1);
GPIO_ResetBits(GPIOB, Key_ROW2);
if (GPIO_ReadInputDataBit(GPIOA, Key_COL1) == Bit_RESET && keyNum == 0) {Delay_ms(10);
while(GPIO_ReadInputDataBit(GPIOA, Key_COL1) == Bit_RESET);
keyNum = 2;
} else if (GPIO_ReadInputDataBit(GPIOA, Key_COL2) == Bit_RESET && keyNum == 0) {Delay_ms(10);
while(GPIO_ReadInputDataBit(GPIOA, Key_COL2) == Bit_RESET);
keyNum = 6;
} else if (GPIO_ReadInputDataBit(GPIOC, Key_COL3) == Bit_RESET && keyNum == 0) {Delay_ms(10);
while(GPIO_ReadInputDataBit(GPIOC, Key_COL3) == Bit_RESET);
keyNum = 10;
} else if (GPIO_ReadInputDataBit(GPIOC, Key_COL4) == Bit_RESET && keyNum == 0) {Delay_ms(10);
while(GPIO_ReadInputDataBit(GPIOC, Key_COL4) == Bit_RESET);
keyNum = 14;
}
Delay_ms(10);

GPIO_SetBits(GPIOB, Key_ROW2);
GPIO_ResetBits(GPIOB, Key_ROW3);
if (GPIO_ReadInputDataBit(GPIOA, Key_COL1) == Bit_RESET && keyNum == 0) {Delay_ms(10);
while(GPIO_ReadInputDataBit(GPIOA, Key_COL1) == Bit_RESET);
keyNum = 3;
} else if (GPIO_ReadInputDataBit(GPIOA, Key_COL2) == Bit_RESET && keyNum == 0) {Delay_ms(10);
while(GPIO_ReadInputDataBit(GPIOA, Key_COL2) == Bit_RESET);
keyNum = 7;
} else if (GPIO_ReadInputDataBit(GPIOC, Key_COL3) == Bit_RESET && keyNum == 0) {Delay_ms(10);
while(GPIO_ReadInputDataBit(GPIOC, Key_COL3) == Bit_RESET);
keyNum = 11;
} else if (GPIO_ReadInputDataBit(GPIOC, Key_COL4) == Bit_RESET && keyNum == 0) {Delay_ms(10);
while(GPIO_ReadInputDataBit(GPIOC, Key_COL4) == Bit_RESET);
keyNum = 15;
}
Delay_ms(10);

GPIO_SetBits(GPIOB, Key_ROW3);
GPIO_ResetBits(GPIOB, Key_ROW4);
if (GPIO_ReadInputDataBit(GPIOA, Key_COL1) == Bit_RESET && keyNum == 0) {Delay_ms(10);
while(GPIO_ReadInputDataBit(GPIOA, Key_COL1) == Bit_RESET);
keyNum = 4;
} else if (GPIO_ReadInputDataBit(GPIOA, Key_COL2) == Bit_RESET && keyNum == 0) {Delay_ms(10);
while(GPIO_ReadInputDataBit(GPIOA, Key_COL2) == Bit_RESET);
keyNum = 8;
} else if (GPIO_ReadInputDataBit(GPIOC, Key_COL3) == Bit_RESET && keyNum == 0) {Delay_ms(10);
while(GPIO_ReadInputDataBit(GPIOC, Key_COL3) == Bit_RESET);
keyNum = 12;
} else if (GPIO_ReadInputDataBit(GPIOC, Key_COL4) == Bit_RESET && keyNum == 0) {Delay_ms(10);
while(GPIO_ReadInputDataBit(GPIOC, Key_COL4) == Bit_RESET);
keyNum = 16;
}
Delay_ms(10);

return keyNum;
}