新手上路
- 积分
- 31
- 金钱
- 31
- 注册时间
- 2019-8-24
- 在线时间
- 9 小时
|
2金钱
本帖最后由 linping 于 2019-8-29 10:47 编辑
各位:
我想请教下F103ZE跑马灯实验时。
1. 为啥不能定义GPIO_InitTypeDef类型变量为指针型,注释掉的部分是原子哥视频的代码。我觉得指针型变量写起来道理是一样的呀,
但是实际用ST-link烧写进去后原子哥的代码是正常的,而我用的指针变量代码是没有现象的。
2. 为啥原子哥视频上ST-link烧写进去就看到实验现象了,而我需要复位后,才看得到。
有空的大佬麻烦看看,指点一下,谢谢了。
void LED_Init(void)
{
GPIO_InitTypeDef* GPIO_InitStruct;
//GPIO_InitTypeDef GPIO_InitStruction;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB |
RCC_APB2Periph_GPIOE, ENABLE);
GPIO_InitStruct->GPIO_Mode=GPIO_Mode_Out_PP;
GPIO_InitStruct->GPIO_Pin=GPIO_Pin_5;
GPIO_InitStruct->GPIO_Speed=GPIO_Speed_50MHz;
GPIO_Init(GPIOB,GPIO_InitStruct);
GPIO_SetBits(GPIOB, GPIO_Pin_5);
GPIO_InitStruct->GPIO_Mode=GPIO_Mode_Out_PP;
GPIO_InitStruct->GPIO_Pin=GPIO_Pin_5;
GPIO_InitStruct->GPIO_Speed=GPIO_Speed_50MHz;
GPIO_Init(GPIOE,GPIO_InitStruct);
GPIO_SetBits(GPIOE, GPIO_Pin_5);
/*
GPIO_InitStruction.GPIO_Mode=GPIO_Mode_Out_PP;
GPIO_InitStruction.GPIO_Pin=GPIO_Pin_5;
GPIO_InitStruction.GPIO_Speed=GPIO_Speed_50MHz;
GPIO_Init(GPIOB,&GPIO_InitStruction);
GPIO_SetBits(GPIOB, GPIO_Pin_5);
GPIO_InitStruction.GPIO_Mode=GPIO_Mode_Out_PP;
GPIO_InitStruction.GPIO_Pin=GPIO_Pin_5;
GPIO_InitStruction.GPIO_Speed=GPIO_Speed_50MHz;
GPIO_Init(GPIOE,&GPIO_InitStruction);
GPIO_SetBits(GPIOE, GPIO_Pin_5);
*/
}
|
|