|
@@ -44,6 +44,8 @@ IWDG_HandleTypeDef hiwdg;
|
|
|
|
|
|
UART_HandleTypeDef hlpuart1;
|
|
UART_HandleTypeDef hlpuart1;
|
|
|
|
|
|
|
|
+RTC_HandleTypeDef hrtc;
|
|
|
|
+
|
|
TIM_HandleTypeDef htim7;
|
|
TIM_HandleTypeDef htim7;
|
|
TIM_HandleTypeDef htim15;
|
|
TIM_HandleTypeDef htim15;
|
|
TIM_HandleTypeDef htim16;
|
|
TIM_HandleTypeDef htim16;
|
|
@@ -62,6 +64,7 @@ static void MX_TIM15_Init(void);
|
|
static void MX_TIM16_Init(void);
|
|
static void MX_TIM16_Init(void);
|
|
static void MX_TIM17_Init(void);
|
|
static void MX_TIM17_Init(void);
|
|
static void MX_TIM7_Init(void);
|
|
static void MX_TIM7_Init(void);
|
|
|
|
+static void MX_RTC_Init(void);
|
|
/* USER CODE BEGIN PFP */
|
|
/* USER CODE BEGIN PFP */
|
|
|
|
|
|
/* USER CODE END PFP */
|
|
/* USER CODE END PFP */
|
|
@@ -105,6 +108,7 @@ int main(void)
|
|
MX_TIM16_Init();
|
|
MX_TIM16_Init();
|
|
MX_TIM17_Init();
|
|
MX_TIM17_Init();
|
|
MX_TIM7_Init();
|
|
MX_TIM7_Init();
|
|
|
|
+ MX_RTC_Init();
|
|
/* USER CODE BEGIN 2 */
|
|
/* USER CODE BEGIN 2 */
|
|
|
|
|
|
/* USER CODE END 2 */
|
|
/* USER CODE END 2 */
|
|
@@ -133,10 +137,17 @@ void SystemClock_Config(void)
|
|
*/
|
|
*/
|
|
HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1_BOOST);
|
|
HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1_BOOST);
|
|
|
|
|
|
|
|
+ /** Configure LSE Drive Capability
|
|
|
|
+ */
|
|
|
|
+ HAL_PWR_EnableBkUpAccess();
|
|
|
|
+ __HAL_RCC_LSEDRIVE_CONFIG(RCC_LSEDRIVE_LOW);
|
|
|
|
+
|
|
/** Initializes the RCC Oscillators according to the specified parameters
|
|
/** Initializes the RCC Oscillators according to the specified parameters
|
|
* in the RCC_OscInitTypeDef structure.
|
|
* in the RCC_OscInitTypeDef structure.
|
|
*/
|
|
*/
|
|
- RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI|RCC_OSCILLATORTYPE_LSI;
|
|
|
|
|
|
+ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI|RCC_OSCILLATORTYPE_LSI
|
|
|
|
+ |RCC_OSCILLATORTYPE_LSE;
|
|
|
|
+ RCC_OscInitStruct.LSEState = RCC_LSE_ON;
|
|
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
|
|
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
|
|
RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
|
|
RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
|
|
RCC_OscInitStruct.LSIState = RCC_LSI_ON;
|
|
RCC_OscInitStruct.LSIState = RCC_LSI_ON;
|
|
@@ -243,6 +254,43 @@ static void MX_LPUART1_UART_Init(void)
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+/**
|
|
|
|
+ * @brief RTC Initialization Function
|
|
|
|
+ * @param None
|
|
|
|
+ * @retval None
|
|
|
|
+ */
|
|
|
|
+static void MX_RTC_Init(void)
|
|
|
|
+{
|
|
|
|
+
|
|
|
|
+ /* USER CODE BEGIN RTC_Init 0 */
|
|
|
|
+
|
|
|
|
+ /* USER CODE END RTC_Init 0 */
|
|
|
|
+
|
|
|
|
+ /* USER CODE BEGIN RTC_Init 1 */
|
|
|
|
+
|
|
|
|
+ /* USER CODE END RTC_Init 1 */
|
|
|
|
+
|
|
|
|
+ /** Initialize RTC Only
|
|
|
|
+ */
|
|
|
|
+ hrtc.Instance = RTC;
|
|
|
|
+ hrtc.Init.HourFormat = RTC_HOURFORMAT_24;
|
|
|
|
+ hrtc.Init.AsynchPrediv = 127;
|
|
|
|
+ hrtc.Init.SynchPrediv = 255;
|
|
|
|
+ hrtc.Init.OutPut = RTC_OUTPUT_DISABLE;
|
|
|
|
+ hrtc.Init.OutPutRemap = RTC_OUTPUT_REMAP_NONE;
|
|
|
|
+ hrtc.Init.OutPutPolarity = RTC_OUTPUT_POLARITY_HIGH;
|
|
|
|
+ hrtc.Init.OutPutType = RTC_OUTPUT_TYPE_OPENDRAIN;
|
|
|
|
+ hrtc.Init.OutPutPullUp = RTC_OUTPUT_PULLUP_NONE;
|
|
|
|
+ if (HAL_RTC_Init(&hrtc) != HAL_OK)
|
|
|
|
+ {
|
|
|
|
+ Error_Handler();
|
|
|
|
+ }
|
|
|
|
+ /* USER CODE BEGIN RTC_Init 2 */
|
|
|
|
+
|
|
|
|
+ /* USER CODE END RTC_Init 2 */
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* @brief TIM7 Initialization Function
|
|
* @brief TIM7 Initialization Function
|
|
* @param None
|
|
* @param None
|