/* USER CODE BEGIN Header */ /** ****************************************************************************** * @file : main.c * @brief : Main program body ****************************************************************************** * @attention * * Copyright (c) 2025 STMicroelectronics. * All rights reserved. * * This software is licensed under terms that can be found in the LICENSE file * in the root directory of this software component. * If no LICENSE file comes with this software, it is provided AS-IS. * ****************************************************************************** */ /* USER CODE END Header */ /* Includes ------------------------------------------------------------------*/ #include "main.h" #include "app_subghz_phy.h" /* Private includes ----------------------------------------------------------*/ /* USER CODE BEGIN Includes */ #include "gpio.h" /* 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 ---------------------------------------------------------*/ //IPCC_HandleTypeDef hipcc; //RTC_HandleTypeDef hrtc; //SUBGHZ_HandleTypeDef hsubghz; /* USER CODE BEGIN PV */ /* USER CODE END PV */ /* Private function prototypes -----------------------------------------------*/ //static void MX_GPIO_Init(void); //static void MX_DMA_Init(void); //static void MX_RTC_Init(void); /* 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) { /* USER CODE BEGIN 1 */ /* USER CODE END 1 */ /* MCU Configuration--------------------------------------------------------*/ /* Reset of all peripherals, Initializes the Flash interface and the Systick. */ HAL_Init(); /* USER CODE BEGIN Init */ /* USER CODE END Init */ /* USER CODE BEGIN SysInit */ /* USER CODE END SysInit */ /* Initialize all configured peripherals */ MX_GPIO_Init(); //MX_DMA_Init(); //MX_RTC_Init(); /* USER CODE BEGIN 2 */ MX_SubGHz_Phy_Init(); /* USER CODE END 2 */ /* Infinite loop */ /* USER CODE BEGIN WHILE */ while (1) { /* USER CODE END WHILE */ MX_SubGHz_Phy_Process(); /* USER CODE BEGIN 3 */ } /* USER CODE END 3 */ } ///** // * @brief IPCC Initialization Function // * @param None // * @retval None // */ //void MX_IPCC_Init(void) //{ // // /* USER CODE BEGIN IPCC_Init 0 */ //// // /* USER CODE END IPCC_Init 0 */ // // /* USER CODE BEGIN IPCC_Init 1 */ //// // /* USER CODE END IPCC_Init 1 */ // hipcc.Instance = IPCC; // if (HAL_IPCC_Init(&hipcc) != HAL_OK) // { // Error_Handler(); // } // /* USER CODE BEGIN IPCC_Init 2 */ //// // /* USER CODE END IPCC_Init 2 */ // //} ///** // * @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 */ // // RTC_AlarmTypeDef sAlarm = {0}; // // /* USER CODE BEGIN RTC_Init 1 */ //// // /* USER CODE END RTC_Init 1 */ // // /** Initialize RTC Only // */ // hrtc.Instance = RTC; // hrtc.Init.AsynchPrediv = RTC_PREDIV_A; // 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; // hrtc.Init.BinMode = RTC_BINARY_ONLY; // if (HAL_RTC_Init(&hrtc) != HAL_OK) // { // Error_Handler(); // } // // /* USER CODE BEGIN Check_RTC_BKUP */ //// // /* USER CODE END Check_RTC_BKUP */ // // /** Initialize RTC and set the Time and Date // */ // if (HAL_RTCEx_SetSSRU_IT(&hrtc) != HAL_OK) // { // Error_Handler(); // } // // /** Enable the Alarm A // */ // sAlarm.BinaryAutoClr = RTC_ALARMSUBSECONDBIN_AUTOCLR_YES; // sAlarm.AlarmTime.SubSeconds = 0x0; // sAlarm.AlarmMask = RTC_ALARMMASK_NONE; // sAlarm.AlarmSubSecondMask = RTC_ALARMSUBSECONDBINMASK_NONE; // sAlarm.Alarm = RTC_ALARM_A; // if (HAL_RTC_SetAlarm_IT(&hrtc, &sAlarm, 0) != HAL_OK) // { // Error_Handler(); // } // /* USER CODE BEGIN RTC_Init 2 */ //// // /* USER CODE END RTC_Init 2 */ // //} ///** // * @brief SUBGHZ Initialization Function // * @param None // * @retval None // */ //void MX_SUBGHZ_Init(void) //{ // // /* USER CODE BEGIN SUBGHZ_Init 0 */ //// // /* USER CODE END SUBGHZ_Init 0 */ // // /* USER CODE BEGIN SUBGHZ_Init 1 */ //// // /* USER CODE END SUBGHZ_Init 1 */ // hsubghz.Init.BaudratePrescaler = SUBGHZSPI_BAUDRATEPRESCALER_8; // if (HAL_SUBGHZ_Init(&hsubghz) != HAL_OK) // { // Error_Handler(); // } // /* USER CODE BEGIN SUBGHZ_Init 2 */ //// // /* USER CODE END SUBGHZ_Init 2 */ // //} ///** // * Enable DMA controller clock // */ //static void MX_DMA_Init(void) //{ // // /* DMA controller clock enable */ // __HAL_RCC_DMAMUX1_CLK_ENABLE(); // __HAL_RCC_DMA1_CLK_ENABLE(); // //} ///** // * @brief GPIO Initialization Function // * @param None // * @retval None // */ //static void MX_GPIO_Init(void) //{ // GPIO_InitTypeDef GPIO_InitStruct = {0}; ///* USER CODE BEGIN MX_GPIO_Init_1 */ ///* USER CODE END MX_GPIO_Init_1 */ // // /* GPIO Ports Clock Enable */ // __HAL_RCC_GPIOB_CLK_ENABLE(); // // /*Configure GPIO pin Output Level */ // HAL_GPIO_WritePin(GPIOB, LED2_Pin|PROB2_Pin|PROB1_Pin|LED3_Pin, GPIO_PIN_RESET); // // /*Configure GPIO pin : LED2_Pin */ // GPIO_InitStruct.Pin = LED2_Pin; // GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; // GPIO_InitStruct.Pull = GPIO_NOPULL; // GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH; // HAL_GPIO_Init(LED2_GPIO_Port, &GPIO_InitStruct); // // /*Configure GPIO pins : PROB2_Pin PROB1_Pin LED3_Pin */ // GPIO_InitStruct.Pin = PROB2_Pin|PROB1_Pin|LED3_Pin; // GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; // GPIO_InitStruct.Pull = GPIO_NOPULL; // GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; // HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); // ///* USER CODE BEGIN MX_GPIO_Init_2 */ ///* USER CODE END MX_GPIO_Init_2 */ //} /* 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 */