diff --git a/Firmware/Core/apps/Inc/key.h b/Firmware/Core/apps/Inc/key.h index 12604cd..48fa7ee 100644 --- a/Firmware/Core/apps/Inc/key.h +++ b/Firmware/Core/apps/Inc/key.h @@ -12,5 +12,6 @@ #include "main.h" -void CheckButtonEvents(); +uint16_t getSensor_Count(); +void setSensor_Count(uint16_t count); #endif //APPS_CORE_APPS_INC_KEY_H_ diff --git a/Firmware/Core/apps/src/key.c b/Firmware/Core/apps/src/key.c index 075cb1f..4038790 100644 --- a/Firmware/Core/apps/src/key.c +++ b/Firmware/Core/apps/src/key.c @@ -1,5 +1,6 @@ #include "key.h" +uint16_t sensor_Count = 0; 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) { @@ -19,5 +20,17 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) { keyVal = 3; } } + //光耦测速模块 + if(GPIO_Pin == SENOR_Pin){ + if(HAL_GPIO_ReadPin(SENOR_GPIO_Port,SENOR_Pin) == GPIO_PIN_SET){ + sensor_Count++; + } + } +} +uint16_t getSensor_Count(){ + return sensor_Count; +} +void setSensor_Count(uint16_t count){ + sensor_Count = count; }