Add sensor_Count

This commit is contained in:
小冯Sir 2024-05-04 05:19:26 +08:00
parent da901cc0f4
commit 305bc61274
2 changed files with 15 additions and 1 deletions

View File

@ -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_

View File

@ -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;
}