当前位置:网站首页>STM32库函数进行GPIO初始化
STM32库函数进行GPIO初始化
2022-07-02 11:21:00 【Little BigUs】
按理来说下面的两段代码应该是等效的,但是发现用上面的代码初始化就可以,用下面的代码初始化就不行,不知道为啥。
void KEY_Init(void) {
GPIO_InitTypeDef GPIO_InitStruct;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOE, ENABLE);
GPIO_InitStruct.GPIO_Pin = GPIO_Pin_3 | GPIO_Pin_4;
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IPU;
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOE, &GPIO_InitStruct);
GPIO_InitStruct.GPIO_Pin = GPIO_Pin_0;
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IPD;
GPIO_Init(GPIOA, &GPIO_InitStruct);
}
void KEY_Init(void) {
GPIO_InitTypeDef *GPIO_InitStruct;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOE, ENABLE);
GPIO_InitStruct->GPIO_Pin = GPIO_Pin_3 | GPIO_Pin_4;
GPIO_InitStruct->GPIO_Mode = GPIO_Mode_IPU;
GPIO_InitStruct->GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOE, GPIO_InitStruct);
GPIO_InitStruct->GPIO_Pin = GPIO_Pin_0;
GPIO_InitStruct->GPIO_Mode = GPIO_Mode_IPD;
GPIO_Init(GPIOA, GPIO_InitStruct);
}
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
我是猪,
定义了一个结构体变量,却没有让他指向结构体,自然就没用了,改成上面那样就可以了。
边栏推荐
- Fabric. Usage of JS eraser (including recovery function)
- 无主灯设计:如何让智能照明更加「智能」?
- Essential elements of science fiction 3D scenes - City
- Golang quickly generates model and queryset of database tables
- [development environment] 010 editor tool (tool download | binary file analysis template template installation | shortcut key viewing and setting)
- The evolution process of the correct implementation principle of redis distributed lock and the summary of redison's actual combat
- Selenium element positioning method
- 2022 home projector preferred! Dangbei F5 brings the ultimate audio-visual experience with its powerful audio-visual effect
- Pychart connects to the remote server
- Adhere to the foundation of 20 minutes go every day II
猜你喜欢

What is erdma? Popular science cartoon illustration

Fabric. JS upper dash, middle dash (strikethrough), underline

Custom events, global event bus, message subscription and publishing, $nexttick

Systemserver process

MySQL45讲——学习极客时间MySQL实战45讲笔记—— 04 | 深入浅出索引(上)

Analysis of CPU surge in production environment service

没有从远程服务器‘‘映射到本地用户‘(null)/sa‘的远程用户‘sa‘及服务主密码解密错误的解决办法

Federated Search: all requirements in search

Fabric.js 橡皮擦的用法(包含恢复功能)

uniapp自动化测试学习
随机推荐
MySQL45讲——学习极客时间MySQL实战45讲笔记—— 05 | 深入浅出索引(下)
Pychart connects to the remote server
Solve the problem that openocd fails to burn STM32 and cannot connect through SWD
Yolov3 & yolov5 output result description
Basic knowledge of QT original code
篇9:XShell免费版安装
数据湖(十一):Iceberg表数据组织与查询
Fabric.js 上划线、中划线(删除线)、下划线
Use of freemaker
NLA natural language analysis makes data analysis more intelligent
Fabric.js 元素被选中时保持原有层级
C crystal report printing
线性dp求解 最长子序列 —— 小题三则
C语言高级用法--函数指针:回调函数;转换表
Codeforces Round #803 (Div. 2)(A~D)
P1908 reverse sequence pair
Fabric. Usage of JS eraser (including recovery function)
P1908 逆序对
当贝投影4K激光投影X3 Pro获得一致好评:万元投影仪首选
万物生长大会在杭召开,当贝入选2022中国未来独角兽TOP100榜单