初级会员

- 积分
- 151
- 金钱
- 151
- 注册时间
- 2017-7-19
- 在线时间
- 31 小时
|

楼主 |
发表于 2017-12-6 16:38:59
|
显示全部楼层
#ifndef __KEY_H_
#define __KEY_H_
#define LED0 PFout(9)
#define LED1 PFout(10)
#define Key0 PEin(3)
#define Key1 PEin(4)
void Key_Init(void);
#endif
#include "stm32f4xx_gpio.h"
#include "stm32f4xx_rcc.h"
#include "KEY.h"
void Key_Init(void)
{
GPIO_InitTypeDef GPIO_Struct;
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOE|RCC_AHB1Periph_GPIOF,ENABLE);
//Õaò»¾äD′×îoóÃæê¼ÖÕê1Äüê§°ü£¿
GPIO_Struct.GPIO_Mode = GPIO_Mode_OUT;
GPIO_Struct.GPIO_OType = GPIO_OType_PP;
GPIO_Struct.GPIO_Pin = GPIO_Pin_9|GPIO_Pin_10;
GPIO_Struct.GPIO_PuPd = GPIO_PuPd_UP;
GPIO_Struct.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOF,&GPIO_Struct);
GPIO_Struct.GPIO_Mode = GPIO_Mode_IN;
//GPIO_Struct.GPIO_OType = GPIO_OType_PP;
GPIO_Struct.GPIO_Pin = GPIO_Pin_3|GPIO_Pin_4;
GPIO_Struct.GPIO_PuPd = GPIO_PuPd_UP;
GPIO_Struct.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOE,&GPIO_Struct);
// PFout(9) = 1;
// PFout(10) = 1;
}
|
|