初级会员

- 积分
- 75
- 金钱
- 75
- 注册时间
- 2016-11-7
- 在线时间
- 39 小时
|
1金钱
//初始化手柄接口.
void JOYPAD_Init(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB|RCC_APB2Periph_GPIOD, ENABLE); //使能PB,PD端口时钟
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11; //
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; //推挽输出
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOB, &GPIO_InitStructure); //初始化GPIO
GPIO_SetBits(GPIOB,GPIO_Pin_11); //上拉
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3; //
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; //推挽输出
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOD, &GPIO_InitStructure); //初始化GPIO
GPIO_SetBits(GPIOD,GPIO_Pin_3); //上拉
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU;//上拉输入
GPIO_Init(GPIOB, &GPIO_InitStructure); //初始化GPIO
GPIO_SetBits(GPIOB,GPIO_Pin_10); //上拉
|
|