当前位置:网站首页>STM32 library function for GPIO initialization
STM32 library function for GPIO initialization
2022-07-02 14:30:00 【Little BigUs】
The following two pieces of code should be equivalent , But I found that it is OK to initialize with the above code , You can't initialize with the following code , I don't know why .
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);
}
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
I am a pig ,
Defines a structure variable , But didn't let him point to the structure , Naturally, it's useless , Just change it to the above .
边栏推荐
- Quick analysis: easy to share the Internet
- 篇9:XShell免费版安装
- 跨服务器数据访问的创建链接服务器方法
- MQ教程 | Exchange(交换机)
- Penetrate the remote connection database through the Intranet
- C crystal report printing
- Story point vs. Human Sky
- Advanced usage of C language -- function pointer: callback function; Conversion table
- P1908 逆序对
- Codeforces Round #803 (Div. 2)(A~D)
猜你喜欢
随机推荐
P1908 reverse sequence pair
NLA natural language analysis makes data analysis more intelligent
String matching problem
每天坚持20分钟go的基础二
Fabric.js 元素被选中时保持原有层级
Fabric. JS dynamically set font size
Start to write a small demo - three piece chess
<口算練習機 方案開發原理圖>口算練習機/口算寶/兒童數學寶/兒童計算器 LCD液晶顯示驅動IC-VK1621B,提供技術支持
测试框架TestNG的使用(二):testNG xml的使用
跨服务器数据访问的创建链接服务器方法
《可供方案开发》口算训练机/数学宝/儿童口算宝/智能数学宝 LCD液晶显示驱动IC-VK1622(LQFP64封装),原厂技术支持
Launcher startup process
Tencent cloud tstor unified storage passed the evaluation of the first batch of basic file storage capabilities of the ICT Institute
MQ教程 | Exchange(交换机)
Openharmony notes --------- (4)
Qt新建项目
腾讯云 TStor 统一存储通过信通院首批文件存储基础能力评测
docker mysql
Tip: SQL Server blocked the state 'openrowset/opendatasource' of component 'ad hoc distributed queries'
C语言高级用法--函数指针:回调函数;转换表