当前位置:网站首页>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);
}
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
我是猪,
定义了一个结构体变量,却没有让他指向结构体,自然就没用了,改成上面那样就可以了。
边栏推荐
- 给Android程序员的一些面试建议「建议收藏」
- How many knowledge points can a callable interface have?
- MySQL 45 lecture - learning the actual battle of MySQL in Geek time 45 Lecture Notes - 05 | easy to understand index (Part 2)
- Slashgear shares 2021 life changing technology products, which are somewhat unexpected
- Who is better, Qianyuan projection Xiaoming Q1 pro or Jimi new play? Which configuration is higher than haqu K1?
- Dangbei projection 4K laser projection X3 Pro received unanimous praise: 10000 yuan projector preferred
- The evolution process of the correct implementation principle of redis distributed lock and the summary of redison's actual combat
- 博睿数据一体化智能可观测平台入选中国信通院2022年“云原生产品名录”
- php链表创建和遍历
- In 2021, the global TCB adapter revenue was about $93 million, and it is expected to reach $315.5 million in 2028
猜你喜欢
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
Getting started with QT - making a simple calculator
Fabric. JS upper dash, middle dash (strikethrough), underline
Error: eacces: permission denied, access to "/usr/lib/node_modules"
<口算練習機 方案開發原理圖>口算練習機/口算寶/兒童數學寶/兒童計算器 LCD液晶顯示驅動IC-VK1621B,提供技術支持
php链表创建和遍历
每日学习3
c# 水晶报表打印
Chinese science and technology from the Winter Olympics (III): the awakening and evolution of digital people
默认插槽,具名插槽,作用域插槽
随机推荐
Method of creating linked server for cross server data access
< 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
给Android程序员的一些面试建议「建议收藏」
Data Lake (11): Iceberg table data organization and query
MySQL 45 lecture - learning the actual battle of MySQL in Geek time 45 Lecture Notes - 05 | easy to understand index (Part 2)
数据湖(十一):Iceberg表数据组织与查询
Tencent cloud tstor unified storage passed the evaluation of the first batch of basic file storage capabilities of the ICT Institute
Understanding of mongodb
Use of swagger
<口算練習機 方案開發原理圖>口算練習機/口算寶/兒童數學寶/兒童計算器 LCD液晶顯示驅動IC-VK1621B,提供技術支持
Fabric. Usage of JS eraser (including recovery function)
Go operation redis
[Hongke technology sharing] how to test DNS server: DNS performance and response time test
【虹科技术分享】如何测试 DNS 服务器:DNS 性能和响应时间测试
QT new project_ MyNotepad++
Solving the longest subsequence with linear DP -- three questions
故事點 vs. 人天
The use of TestNG, the testing framework (II): the use of TestNG XML
What is erdma? Popular science cartoon illustration
Route (II)