diff --git a/Firmware/Core/apps/src/key.c b/Firmware/Core/apps/src/key.c index 82f64ed..075cb1f 100644 --- a/Firmware/Core/apps/src/key.c +++ b/Firmware/Core/apps/src/key.c @@ -1,11 +1,23 @@ -#include #include "key.h" -#include "tim.h" -#include "stdbool.h" - - void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) { - + if (GPIO_Pin == KEY1_Pin) { + if (HAL_GPIO_ReadPin(KEY1_GPIO_Port, KEY1_Pin) == GPIO_PIN_SET) { + while (HAL_GPIO_ReadPin(KEY1_GPIO_Port, KEY1_Pin) == GPIO_PIN_SET); + keyVal = 1; + } + } + if (GPIO_Pin == KEY2_Pin) { + if (HAL_GPIO_ReadPin(KEY2_GPIO_Port, KEY2_Pin) == GPIO_PIN_RESET) { + while (HAL_GPIO_ReadPin(KEY2_GPIO_Port, KEY2_Pin) == GPIO_PIN_RESET); + keyVal = 2; + } + } + if (GPIO_Pin == KEY3_Pin) { + if (HAL_GPIO_ReadPin(KEY3_GPIO_Port, KEY3_Pin) == GPIO_PIN_RESET) { + while (HAL_GPIO_ReadPin(KEY3_GPIO_Port, KEY3_Pin) == GPIO_PIN_RESET); + keyVal = 3; + } + } }