stm332函数默认参数
时间: 2023-10-18 07:06:08 浏览: 61
STM32F2xx系列的STM32Cube库中,包含了一些函数的默认参数,这些默认参数可以在函数调用时不指定,系统会自动使用默认值。以下是一些常用的函数默认参数:
1. GPIO_InitTypeDef结构体中的默认值:
```c
GPIO_InitTypeDef GPIO_InitStruct = {0};
GPIO_InitStruct.Pin = GPIO_PIN_0;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
```
其中,结构体中的其他成员变量默认值为0。
2. TIM_TimeBaseInitTypeDef结构体中的默认值:
```c
TIM_TimeBaseInitTypeDef TIM_InitStruct = {0};
TIM_InitStruct.Prescaler = 0;
TIM_InitStruct.CounterMode = TIM_COUNTERMODE_UP;
TIM_InitStruct.Period = 0;
TIM_InitStruct.ClockDivision = TIM_CLOCKDIVISION_DIV1;
TIM_InitStruct.RepetitionCounter = 0;
HAL_TIM_Base_Init(&TIM_InitStruct);
```
其中,结构体中的其他成员变量默认值为0。
3. ADC_InitTypeDef结构体中的默认值:
```c
ADC_InitTypeDef ADC_InitStruct = {0};
ADC_InitStruct.ClockPrescaler = ADC_CLOCK_SYNC_PCLK_DIV2;
ADC_InitStruct.Resolution = ADC_RESOLUTION_12B;
ADC_InitStruct.DataAlign = ADC_DATAALIGN_RIGHT;
ADC_InitStruct.ScanConvMode = DISABLE;
ADC_InitStruct.EOCSelection = ADC_EOC_SINGLE_CONV;
HAL_ADC_Init(&ADC_InitStruct);
```
其中,结构体中的其他成员变量默认值为0。
需要注意的是,不同的STM32系列可能会有不同的默认参数,具体可以查看相应的库文件或者开发板示例代码。
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)