当前位置:网站首页>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);
}
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
我是猪,
定义了一个结构体变量,却没有让他指向结构体,自然就没用了,改成上面那样就可以了。
边栏推荐
- 测试框架TestNG的使用(二):testNG xml的使用
- Quarkus learning IV - project development to deployment
- Solve the problem that openocd fails to burn STM32 and cannot connect through SWD
- Use of swagger
- 无主灯设计:如何让智能照明更加「智能」?
- 2022 home projector preferred! Dangbei F5 brings the ultimate audio-visual experience with its powerful audio-visual effect
- Fabric.js 缩放画布
- YOLOv3&YOLOv5输出结果说明
- Design of non main lamp: how to make intelligent lighting more "intelligent"?
- [development environment] 010 editor tool (tool download | binary file analysis template template installation | shortcut key viewing and setting)
猜你喜欢

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

当贝投影4K激光投影X3 Pro获得一致好评:万元投影仪首选

PyQt5_QScrollArea内容保存成图片

Available solution development oral arithmetic training machine / math treasure / children's oral arithmetic treasure / intelligent math treasure LCD LCD driver ic-vk1622 (lqfp64 package), original te

kaggle如何使用utility script
![[development environment] 010 editor tool (tool download | binary file analysis template template installation | shortcut key viewing and setting)](/img/de/7d70f513577e93f1bde1969935a29e.jpg)
[development environment] 010 editor tool (tool download | binary file analysis template template installation | shortcut key viewing and setting)

<口算练习机 方案开发原理图>口算练习机/口算宝/儿童数学宝/儿童计算器 LCD液晶显示驱动IC-VK1621B,提供技术支持

Tencent cloud tstor unified storage passed the evaluation of the first batch of basic file storage capabilities of the ICT Institute

2022 home projector preferred! Dangbei F5 brings the ultimate audio-visual experience with its powerful audio-visual effect

Method of creating linked server for cross server data access
随机推荐
Advanced usage of C language -- function pointer: callback function; Conversion table
uni-app中使用computed解决了tab切换中data()值显示的异常
MQ教程 | Exchange(交换机)
kaggle如何使用utility script
Quarkus学习四 - 项目开发到部署
< schéma de développement de la machine d'exercice oral > machine d'exercice oral / trésor d'exercice oral / trésor de mathématiques pour enfants / lecteur LCD de calculatrice pour enfants IC - vk1621
当贝投影4K激光投影X3 Pro获得一致好评:万元投影仪首选
Pychart connects to the remote server
P1908 逆序对
Story point vs. Human Sky
Openharmony notes --------- (4)
docker mysql
关于Flink框架窗口(window)函数最全解析
Fabric. JS zoom canvas
Fabric.js 橡皮擦的用法(包含恢复功能)
STM32-DAC实验&高频DAC输出测试
YOLOv3&YOLOv5输出结果说明
MySQL45讲——学习极客时间MySQL实战45讲笔记—— 04 | 深入浅出索引(上)
什么是 eRDMA?丨科普漫画图解
OpenHarmony笔记-----------(四)