added state_machine.c

This commit is contained in:
2024-05-23 19:08:23 +03:00
parent a3e7c2c266
commit 61c8d173a1
3 changed files with 217 additions and 10 deletions

View File

@ -121,9 +121,6 @@ int main(void)
AMS_Init(&hspi1);
ams_can_init(&hcan);
bool relay_actual = false;
bool relay_target = true;
uint32_t target_time = HAL_GetTick() + 10000;
/* USER CODE END 2 */
@ -142,13 +139,6 @@ int main(void)
ams_can_send_error();
}
ams_can_send_log();
if (HAL_GetTick() >= target_time) {
HAL_GPIO_WritePin(RELAY_EN_GPIO_Port, RELAY_EN_Pin, relay_target ? GPIO_PIN_SET : GPIO_PIN_RESET);
HAL_GPIO_WritePin(STATUS_LED_R_GPIO_Port, STATUS_LED_R_Pin, relay_target ? GPIO_PIN_RESET : GPIO_PIN_SET);
target_time = HAL_GetTick() + 10000;
relay_target = !relay_target;
}
}
/* USER CODE END 3 */
}