IWDG заведен

This commit is contained in:
2025-03-31 18:39:34 +03:00
parent b9d5ff7f46
commit 6b5edc1c41
5 changed files with 100 additions and 5 deletions

View File

@@ -22,7 +22,9 @@
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
#include "recorder_buffer.h"
#include "usbd_cdc.h"
#include "usbd_cdc_if.h"
/* USER CODE END Includes */
/* Private typedef -----------------------------------------------------------*/
@@ -105,7 +107,27 @@ int main(void)
MX_TIM11_Init();
MX_IWDG_Init();
/* USER CODE BEGIN 2 */
char isIwdgReset = 0;
if (RCC->CSR & RCC_CSR_IWDGRSTF) {
SET_BIT(RCC->CSR, RCC_CSR_RMVF);
isIwdgReset = 1;
}
HAL_IWDG_Refresh(&hiwdg);
ChannelBuffer_reset(&buffer_ch1);
ChannelBuffer_reset(&buffer_ch2);
{
HAL_Delay(1000);
if (isIwdgReset) {
char msg[] = "RESET_IWDG\r\nINIT_COMPLETE\r\n";
CDC_Transmit_FS(msg, 27);
} else {
char msg[] = "INIT_COMPLETE\r\n";
CDC_Transmit_FS(msg, 15);
}
}
HAL_IWDG_Refresh(&hiwdg);
/* USER CODE END 2 */
/* Infinite loop */