---vl6180dr
This commit is contained in:
16
App/app.cpp
16
App/app.cpp
@@ -75,7 +75,7 @@ void AppInit(void)
|
||||
uint8_t temp[2];
|
||||
uint32_t controlPinMs = 0;
|
||||
uint8_t controlPinFlag = 0;
|
||||
uint8_t controlPinHighStart = 0;
|
||||
uint32_t controlPinDetectedMs = 0;
|
||||
uint8_t updateMode = 0;
|
||||
|
||||
void zummerOff (void)
|
||||
@@ -153,15 +153,15 @@ void AppTask(void)
|
||||
lightStartMs = 0;
|
||||
lightingOff();
|
||||
}
|
||||
if (HAL_GPIO_ReadPin(CONTROL_PIN_GPIO_Port, CONTROL_PIN_Pin) == GPIO_PIN_SET) {
|
||||
if (controlPinFlag == 0)
|
||||
{
|
||||
controlPinHighStart = HAL_GetTick();
|
||||
if (HAL_GPIO_ReadPin(CONTROL_PIN_GPIO_Port, CONTROL_PIN_Pin) == GPIO_PIN_RESET && controlPinFlag == 0) {
|
||||
controlPinDetectedMs = HAL_GetTick();
|
||||
controlPinFlag = 1;
|
||||
}
|
||||
} else if (controlPinFlag == 1) {
|
||||
} else if (controlPinFlag == 1 && HAL_GPIO_ReadPin(CONTROL_PIN_GPIO_Port, CONTROL_PIN_Pin) == GPIO_PIN_SET ) {
|
||||
controlPinFlag = 0;
|
||||
uint32_t ms = HAL_GetTick() - controlPinHighStart;
|
||||
uint32_t ms = 0;
|
||||
if (controlPinDetectedMs != 0)
|
||||
ms = HAL_GetTick() - controlPinDetectedMs;
|
||||
controlPinDetectedMs = 0;
|
||||
if (ms >= 5000 && ms < 5200) {
|
||||
////////Update mode
|
||||
HAL_UART_DeInit(&huart1);
|
||||
|
||||
Reference in New Issue
Block a user