config GPIO A/B/C to analog
This commit is contained in:
parent
aebafc0d8c
commit
f1038b5351
|
@ -49,23 +49,30 @@ void MX_GPIO_Init(void)
|
||||||
__HAL_RCC_GPIOC_CLK_ENABLE();
|
__HAL_RCC_GPIOC_CLK_ENABLE();
|
||||||
__HAL_RCC_GPIOA_CLK_ENABLE();
|
__HAL_RCC_GPIOA_CLK_ENABLE();
|
||||||
|
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_All;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||||
|
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
||||||
|
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||||
|
|
||||||
/*Configure GPIO pin Output Level */
|
/*Configure GPIO pin Output Level */
|
||||||
HAL_GPIO_WritePin(GPIOB, LED1_Pin|LED2_Pin|PROB2_Pin|PROB1_Pin
|
HAL_GPIO_WritePin(GPIOB, LED1_Pin|LED2_Pin|PROB2_Pin|PROB1_Pin
|
||||||
|LED3_Pin, GPIO_PIN_RESET);
|
|LED3_Pin, GPIO_PIN_RESET);
|
||||||
|
#if 0
|
||||||
/*Configure GPIO pins : PBPin PBPin PBPin */
|
/*Configure GPIO pins : PBPin PBPin PBPin */
|
||||||
GPIO_InitStruct.Pin = LED1_Pin|LED2_Pin|LED3_Pin;
|
GPIO_InitStruct.Pin = LED1_Pin|LED2_Pin|LED3_Pin;
|
||||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
|
||||||
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||||
|
#endif
|
||||||
/*Configure GPIO pins : PAPin PAPin */
|
/*Configure GPIO pins : PAPin PAPin */
|
||||||
GPIO_InitStruct.Pin = BUT1_Pin|BUT2_Pin;
|
GPIO_InitStruct.Pin = BUT1_Pin|BUT2_Pin;
|
||||||
GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
|
GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
|
||||||
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
||||||
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||||
|
#if 0
|
||||||
/*Configure GPIO pins : PBPin PBPin */
|
/*Configure GPIO pins : PBPin PBPin */
|
||||||
GPIO_InitStruct.Pin = PROB2_Pin|PROB1_Pin;
|
GPIO_InitStruct.Pin = PROB2_Pin|PROB1_Pin;
|
||||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||||
|
@ -78,7 +85,7 @@ void MX_GPIO_Init(void)
|
||||||
GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
|
GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
|
||||||
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
||||||
HAL_GPIO_Init(BUT3_GPIO_Port, &GPIO_InitStruct);
|
HAL_GPIO_Init(BUT3_GPIO_Port, &GPIO_InitStruct);
|
||||||
|
#endif
|
||||||
/* EXTI interrupt init*/
|
/* EXTI interrupt init*/
|
||||||
HAL_NVIC_SetPriority(EXTI0_IRQn, 0, 0);
|
HAL_NVIC_SetPriority(EXTI0_IRQn, 0, 0);
|
||||||
HAL_NVIC_EnableIRQ(EXTI0_IRQn);
|
HAL_NVIC_EnableIRQ(EXTI0_IRQn);
|
||||||
|
|
Loading…
Reference in New Issue