EXP: simple debounce experiment

This commit is contained in:
Robin Dietzel 2022-12-15 20:51:00 +01:00
parent 68de383ca6
commit 370da128e9
4 changed files with 39 additions and 2 deletions

12
Core/Inc/git_rev.h Normal file
View File

@ -0,0 +1,12 @@
//
// Created by robtor on 15.12.22.
//
#ifndef FLOATPUMP_GIT_REVISION_TEMPLATE_H
#define FLOATPUMP_GIT_REVISION_TEMPLATE_H
// Auto generated header file containing the last git revision
#define GIT_HASH "4f8cf4c"
#endif //FLOATPUMP_GIT_REVISION_TEMPLATE_H

View File

@ -55,6 +55,7 @@ void SVC_Handler(void);
void DebugMon_Handler(void);
void PendSV_Handler(void);
void SysTick_Handler(void);
void EXTI4_IRQHandler(void);
void OTG_FS_IRQHandler(void);
/* USER CODE BEGIN EFP */

View File

@ -339,12 +339,18 @@ static void MX_GPIO_Init(void) {
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
/*Configure GPIO pins : RRDT_Pin RRSW_Pin RRCLK_Pin */
GPIO_InitStruct.Pin = RRDT_Pin | RRSW_Pin | RRCLK_Pin;
/*Configure GPIO pins : RRDT_Pin RRCLK_Pin */
GPIO_InitStruct.Pin = RRDT_Pin | RRCLK_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_PULLUP;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
/*Configure GPIO pin : RRSW_Pin */
GPIO_InitStruct.Pin = RRSW_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
GPIO_InitStruct.Pull = GPIO_PULLUP;
HAL_GPIO_Init(RRSW_GPIO_Port, &GPIO_InitStruct);
/*Configure GPIO pin : ADC1_2_Pin */
GPIO_InitStruct.Pin = ADC1_2_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
@ -366,6 +372,9 @@ static void MX_GPIO_Init(void) {
GPIO_InitStruct.Pull = GPIO_PULLDOWN;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
/* EXTI interrupt init*/
HAL_NVIC_SetPriority(EXTI4_IRQn, 0, 0);
HAL_NVIC_EnableIRQ(EXTI4_IRQn);
}
/**

View File

@ -198,6 +198,21 @@ void SysTick_Handler(void)
/* please refer to the startup file (startup_stm32f4xx.s). */
/******************************************************************************/
/**
* @brief This function handles EXTI line4 interrupt.
*/
void EXTI4_IRQHandler(void)
{
/* USER CODE BEGIN EXTI4_IRQn 0 */
HAL_GPIO_TogglePin(LED1_GPIO_Port, LED1_Pin);
/* USER CODE END EXTI4_IRQn 0 */
HAL_GPIO_EXTI_IRQHandler(RRSW_Pin);
/* USER CODE BEGIN EXTI4_IRQn 1 */
/* USER CODE END EXTI4_IRQn 1 */
}
/**
* @brief This function handles USB On The Go FS global interrupt.
*/