Capturing PWM

Create timer for capture PWM via interrupts
This commit is contained in:
2024-09-02 09:28:38 +03:00
parent 4ad21d4102
commit 78e0a88604
5 changed files with 132 additions and 49 deletions

16
gpio.c
View File

@@ -38,7 +38,6 @@
* Output
* EVENT_OUT
* EXTI
PA0-WKUP ------> ADCx_IN0
PB1 ------> ADCx_IN9
*/
void MX_GPIO_Init(void)
@@ -66,17 +65,6 @@ void MX_GPIO_Init(void)
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
/*Configure GPIO pin : PA0 */
GPIO_InitStruct.Pin = GPIO_PIN_0;
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
/*Configure GPIO pin : PtPin */
GPIO_InitStruct.Pin = PWM_CTRL_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING_FALLING;
GPIO_InitStruct.Pull = GPIO_PULLUP;
HAL_GPIO_Init(PWM_CTRL_GPIO_Port, &GPIO_InitStruct);
/*Configure GPIO pins : PAPin PAPin PAPin PAPin */
GPIO_InitStruct.Pin = HEATING_Pin|LED2_Pin|VLV_M_Pin|VLV_REVERSE_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
@@ -131,10 +119,6 @@ void MX_GPIO_Init(void)
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
/* EXTI interrupt init*/
HAL_NVIC_SetPriority(EXTI3_IRQn, 0, 0);
HAL_NVIC_EnableIRQ(EXTI3_IRQn);
}
/* USER CODE BEGIN 2 */