当前位置:网站首页>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);
}
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
我是猪,
定义了一个结构体变量,却没有让他指向结构体,自然就没用了,改成上面那样就可以了。
边栏推荐
- The use of TestNG, the testing framework (II): the use of TestNG XML
- Penetrate the remote connection database through the Intranet
- Fabric.js 动态设置字号大小
- 路由(二)
- Dangbei projection 4K laser projection X3 Pro received unanimous praise: 10000 yuan projector preferred
- TeamTalk源码分析之win-client
- Fabric. JS upper dash, middle dash (strikethrough), underline
- Thymeleaf dependency
- 千元投影小明Q1 Pro和极米NEW Play谁更好?和哈趣K1比哪款配置更高?
- Pychart connects to the remote server
猜你喜欢

Codeforces Round #803 (Div. 2)(A~D)
![[deep learning] simple implementation of neural network forward propagation](/img/a6/9b4896c62e9b77f9d528c3c9efc58f.jpg)
[deep learning] simple implementation of neural network forward propagation

The conference on the growth of all things was held in Hangzhou, and dangbei was selected into the top 100 list of future unicorns in China in 2022

Yolov3 & yolov5 output result description

C crystal report printing

Who is better, Qianyuan projection Xiaoming Q1 pro or Jimi new play? Which configuration is higher than haqu K1?

Error: eacces: permission denied, access to "/usr/lib/node_modules"

Getting started with QT - making a simple calculator

Fabric. JS zoom canvas

Whole house Wi Fi: a pain point that no one can solve?
随机推荐
STM32-DAC实验&高频DAC输出测试
YOLOv3&YOLOv5输出结果说明
[development environment] StarUML tool (download software | StarUML installation | StarUML creation project)
删除元素(带过渡动画)
PyQt5_QScrollArea内容保存成图片
MQ教程 | Exchange(交换机)
故事點 vs. 人天
Analysis of CPU surge in production environment service
Fabric.js 上划线、中划线(删除线)、下划线
无主灯设计:如何让智能照明更加「智能」?
uniapp自动化测试学习
mongodb的认识
There is no solution to the decryption error of the remote user 'sa' and the service master password mapped from the remote server 'to the local user' (null) /sa '
MySQL 45 lecture - learning from the actual battle of geek time MySQL 45 Lecture Notes - 04 | easy to understand index (Part 1)
Whole house Wi Fi: a pain point that no one can solve?
Development and design of animation surrounding mall sales website based on php+mysql
给Android程序员的一些面试建议「建议收藏」
【虹科技术分享】如何测试 DNS 服务器:DNS 性能和响应时间测试
Openharmony notes --------- (4)
Getting started with QT - making a simple calculator