当前位置:网站首页>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.js 自由绘制椭圆
- uniapp自动化测试学习
- 删除元素(带过渡动画)
- Fabric.js 缩放画布
- Fabric. JS free drawing ellipse
- Solving the longest subsequence with linear DP -- three questions
- Design and implementation of car query system based on php+mysql
- < schematic diagram of oral arithmetic exercise machine program development> oral arithmetic exercise machine / oral arithmetic treasure / children's math treasure / children's calculator LCD LCD driv
- Penetrate the remote connection database through the Intranet
- PyQt5_QScrollArea内容保存成图片
猜你喜欢
测试框架TestNG的使用(二):testNG xml的使用
In 2021, the global revenue of structural bolts was about $796.4 million, and it is expected to reach $1097.6 million in 2028
Essential elements of science fiction 3D scenes - City
Default slot, named slot, scope slot
What is erdma? Popular science cartoon illustration
每日学习2
自定义事件,全局事件总线,消息订阅与发布,$nextTick
MySQL45讲——学习极客时间MySQL实战45讲笔记—— 05 | 深入浅出索引(下)
HMS core machine learning service helps zaful users to shop conveniently
A white hole formed by antineutrons produced by particle accelerators
随机推荐
Data consistency between redis and database
Solve the problem that openocd fails to burn STM32 and cannot connect through SWD
Solving the longest subsequence with linear DP -- three questions
[to be continued] [UE4 notes] l5ue4 model import
Talk about idempotent design
Generally speaking, if the error of inconsistent tab and space occurs frequently
Systemserver process
路由(二)
Quick analysis: easy to share the Internet
Fabric.js 缩放画布
Start to write a small demo - three piece chess
Fabric.js 元素被选中时保持原有层级
Chinese science and technology from the Winter Olympics (III): the awakening and evolution of digital people
PyQt5_ Qscrollarea content is saved as a picture
Whole house Wi Fi: a pain point that no one can solve?
QT new project_ MyNotepad++
关于Flink框架窗口(window)函数最全解析
In 2021, the global revenue of structural bolts was about $796.4 million, and it is expected to reach $1097.6 million in 2028
TeamTalk源码分析之win-client
快解析:轻松实现共享上网