/* USER CODE BEGIN Header */ /** ****************************************************************************** * @file : main.c * @brief : Main program body ****************************************************************************** * @attention * *

© Copyright (c) 2021 STMicroelectronics. * All rights reserved.

* * This software component is licensed by ST under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** */ /* USER CODE END Header */ /* Includes ------------------------------------------------------------------*/ #include "main.h" /* Private includes ----------------------------------------------------------*/ /* USER CODE BEGIN Includes */ /* USER CODE END Includes */ /* Private typedef -----------------------------------------------------------*/ /* USER CODE BEGIN PTD */ /* USER CODE END PTD */ /* Private define ------------------------------------------------------------*/ /* USER CODE BEGIN PD */ /* USER CODE END PD */ /* Private macro -------------------------------------------------------------*/ /* USER CODE BEGIN PM */ /* USER CODE END PM */ /* Private variables ---------------------------------------------------------*/ /* USER CODE BEGIN PV */ volatile flag_t Flag = {0}; /* USER CODE END PV */ /* Private function prototypes -----------------------------------------------*/ /* USER CODE BEGIN PFP */ /* USER CODE END PFP */ /* Private user code ---------------------------------------------------------*/ /* USER CODE BEGIN 0 */ /* USER CODE END 0 */ /** * @brief The application entry point. * @retval int */ int main(void) { /* Initialize onBoard Hardware */ Board_Init(); /* Initialize Scheduler */ RTOS_Init(); /* tdelay_ms() work now, I2C can work too */ /* Initialize Event State Machine */ ES_Init(stShowTime); /* Init devices at I2C bus */ // RTC_Init(); // tdelay_ms(10); RTC_Init(); sensor_Init(); es_event_t event = eventNull; RTC_ReadAll(&Clock); showTime(); /** Set tasks for Sheduler */ RTOS_SetTask(btnProcess, 1, BTN_SCAN_PERIOD); /* USER CODE BEGIN WHILE */ /* Infinite loop */ while (1) { /* new second interrupt from RTC */ if (Flag.RTC_IRQ != 0) { Flag.RTC_IRQ = 0; new_Second(); } /* end of New second */ /* USER CODE END WHILE */ /* USER CODE BEGIN 3 */ event = ES_GetEvent(); if (event) { ES_Dispatch(event); } RTOS_DispatchTask(); __WFI(); } /* USER CODE END 3 */ } /* End of mine() */ /* USER CODE BEGIN 4 */ /* USER CODE END 4 */ /** * @brief This function is executed in case of error occurrence. * @retval None */ void Error_Handler(void) { /* USER CODE BEGIN Error_Handler_Debug */ /* User can add his own implementation to report the HAL error return state */ __disable_irq(); while (1) { } /* USER CODE END Error_Handler_Debug */ } #ifdef USE_FULL_ASSERT /** * @brief Reports the name of the source file and the source line number * where the assert_param error has occurred. * @param file: pointer to the source file name * @param line: assert_param error line source number * @retval None */ void assert_failed(uint8_t *file, uint32_t line) { /* USER CODE BEGIN 6 */ /* User can add his own implementation to report the file name and line number, ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */ /* USER CODE END 6 */ } #endif /* USE_FULL_ASSERT */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/